[dolfin] 01/03: Imported Upstream version 2016.1.0

Johannes Ring johannr-guest at moszumanska.debian.org
Mon Jul 4 12:13:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

johannr-guest pushed a commit to branch master
in repository dolfin.

commit c0a1581222b51d44744dc1e47ed5651cf58487b6
Author: Johannes Ring <johannr at simula.no>
Date:   Mon Jun 27 10:24:02 2016 +0200

    Imported Upstream version 2016.1.0
---
 .gitignore                                         |   137 +
 AUTHORS                                            |     2 +-
 CMakeLists.txt                                     |   359 +-
 ChangeLog                                          |    59 +-
 INSTALL                                            |     5 +-
 README.rst                                         |    21 +-
 bench/bench.py                                     |     4 +-
 bench/common/progress/cpp/CMakeLists.txt           |    43 +-
 bench/common/timing/cpp/CMakeLists.txt             |    43 +-
 bench/fem/assembly/cpp/CMakeLists.txt              |    43 +-
 bench/fem/assembly/cpp/forms.h                     |    41 +-
 bench/fem/assembly/cpp/forms/Elasticity3D.h        |  1292 +-
 bench/fem/assembly/cpp/forms/NSEMomentum3D.h       |  4363 ++-
 bench/fem/assembly/cpp/forms/Poisson2DP1.h         |  2757 +-
 bench/fem/assembly/cpp/forms/Poisson2DP2.h         |  4636 ++-
 bench/fem/assembly/cpp/forms/Poisson2DP3.h         |  4540 ++-
 bench/fem/assembly/cpp/forms/StabStokes2D.h        |  1889 +-
 bench/fem/assembly/cpp/forms/THStokes2D.h          |  8488 +++--
 bench/fem/assembly/cpp/forms/compile.log           |  2349 +-
 bench/fem/assembly/cpp/main.cpp                    |     9 +-
 bench/fem/convergence/cpp/CMakeLists.txt           |    43 +-
 bench/fem/convergence/cpp/Poisson2D_1.cpp          |  2564 +-
 bench/fem/convergence/cpp/Poisson2D_1.h            |  1048 +-
 bench/fem/convergence/cpp/Poisson2D_2.cpp          |  4682 ++-
 bench/fem/convergence/cpp/Poisson2D_2.h            |  1212 +-
 bench/fem/convergence/cpp/Poisson2D_3.cpp          |  4848 ++-
 bench/fem/convergence/cpp/Poisson2D_3.h            |  1212 +-
 bench/fem/convergence/cpp/Poisson2D_4.cpp          |  7684 ++--
 bench/fem/convergence/cpp/Poisson2D_4.h            |  1212 +-
 bench/fem/convergence/cpp/Poisson2D_5.cpp          |  2876 +-
 bench/fem/convergence/cpp/Poisson2D_5.h            |  1212 +-
 bench/fem/convergence/cpp/Poisson3D_1.cpp          |  4130 ++-
 bench/fem/convergence/cpp/Poisson3D_1.h            |  1048 +-
 bench/fem/convergence/cpp/Poisson3D_2.cpp          |  8493 ++++-
 bench/fem/convergence/cpp/Poisson3D_2.h            |  1212 +-
 bench/fem/convergence/cpp/Poisson3D_3.cpp          |  8895 +++--
 bench/fem/convergence/cpp/Poisson3D_3.h            |  1212 +-
 bench/fem/convergence/cpp/Poisson3D_4.cpp          |  4853 ++-
 bench/fem/convergence/cpp/Poisson3D_4.h            |  1212 +-
 bench/fem/convergence/cpp/compile.log              |  2705 +-
 bench/fem/convergence/cpp/main.cpp                 |    90 +-
 bench/fem/multicore/cpp/CMakeLists.txt             |    43 +-
 bench/fem/multicore/cpp/NavierStokes.h             |  2443 +-
 bench/fem/multicore/cpp/Poisson.h                  |  4371 ++-
 bench/fem/multicore/cpp/compile.log                |   459 +-
 bench/fem/multicore/cpp/main.cpp                   |    12 +-
 bench/fem/speedup/cpp/CMakeLists.txt               |    43 +-
 bench/fem/speedup/cpp/Poisson.h                    |  4747 ++-
 bench/fem/speedup/cpp/assemble-poisson.cpp         |     6 +-
 bench/fem/speedup/cpp/bench_fem_speedup_cpp        |     9 +-
 bench/fem/speedup/cpp/compile.log                  |   205 +-
 bench/fem/speedup/cpp/solve-poisson.cpp            |    35 +-
 bench/function/evaluation/cpp/CMakeLists.txt       |    43 +-
 bench/function/evaluation/cpp/P1.h                 |   418 +-
 bench/function/evaluation/cpp/compile.log          |    76 +-
 bench/function/evaluation/cpp/main.cpp             |    16 +-
 .../python/bench_function_extrapolation_python     |     9 +-
 .../python/bench_function_interpolation_python     |    11 +-
 .../bounding_box_tree_build/cpp/CMakeLists.txt     |    43 +-
 .../geometry/bounding_box_tree_build/cpp/main.cpp  |     3 +
 .../cpp/CMakeLists.txt                             |    43 +-
 .../cpp/main.cpp                                   |     3 +
 .../cpp/CMakeLists.txt                             |    43 +-
 .../cpp/main.cpp                                   |     3 +
 bench/la/cusp/python/bench_la_cusp_python          |    90 -
 bench/la/vector/access/cpp/CMakeLists.txt          |    43 +-
 bench/la/vector/assignment/cpp/CMakeLists.txt      |    43 +-
 bench/logs/bench.log                               | 17449 ++++++++-
 bench/logs/milestones.log                          |    14 +-
 bench/mesh/iteration/cpp/CMakeLists.txt            |    43 +-
 bench/mesh/iteration/cpp/main.cpp                  |     4 +-
 bench/mesh/refinement/cpp/CMakeLists.txt           |    43 +-
 bench/mesh/topology/cpp/CMakeLists.txt             |    43 +-
 bench/mesh/topology/cpp/main.cpp                   |     8 +
 bench/mesh/unitcube/cpp/CMakeLists.txt             |    43 +-
 bench/plot.py                                      |    70 +-
 cmake/modules/FindPETSc.cmake                      |    87 +-
 cmake/modules/FindPaStiX.cmake                     |   159 -
 cmake/modules/FindSLEPc.cmake                      |     2 +-
 cmake/modules/FindUFC.cmake                        |    81 +
 cmake/modules/ResolveCompilerPaths.cmake           |    16 +-
 cmake/scripts/copy-test-demo-data                  |     2 +-
 cmake/scripts/download-demo-data                   |     2 -
 cmake/scripts/generate-cmakefiles                  |    51 +-
 cmake/scripts/generate-form-files                  |     2 +-
 cmake/templates/UseDOLFIN.cmake.in                 |     7 +-
 cmake/templates/dolfin.conf.in                     |     4 +-
 demo/README                                        |    58 +
 .../auto-adaptive-poisson/cpp/AdaptivePoisson.h    | 14160 +++----
 .../auto-adaptive-poisson/cpp/CMakeLists.txt       |    43 +-
 .../auto-adaptive-poisson/cpp/compile.log          |  1054 +-
 demo/documented/auto-adaptive-poisson/cpp/main.cpp |    39 +-
 .../auto-adaptive-poisson/python/documentation.rst |     4 +-
 demo/documented/bcs/cpp/CMakeLists.txt             |    43 +-
 demo/documented/bcs/cpp/Poisson.h                  |  4747 ++-
 demo/documented/bcs/cpp/compile.log                |   205 +-
 demo/documented/bcs/cpp/main.cpp                   |    14 +-
 demo/documented/bcs/python/documentation.rst       |    54 +-
 demo/documented/biharmonic/cpp/Biharmonic.h        |  8002 ++--
 demo/documented/biharmonic/cpp/CMakeLists.txt      |    43 +-
 demo/documented/biharmonic/cpp/compile.log         |   480 +-
 demo/documented/biharmonic/cpp/documentation.rst   |    12 +-
 demo/documented/biharmonic/cpp/main.cpp            |    12 +-
 .../biharmonic/python/demo_biharmonic.py           |     2 +-
 .../documented/biharmonic/python/documentation.rst |     2 +-
 demo/documented/built-in-meshes/cpp/CMakeLists.txt |    43 +-
 .../built-in-meshes/python/documentation.rst       |     6 +-
 demo/documented/cahn-hilliard/common.txt           |    26 +-
 demo/documented/cahn-hilliard/cpp/CMakeLists.txt   |    43 +-
 .../cahn-hilliard/cpp/CahnHilliard2D.cpp           |  3229 +-
 demo/documented/cahn-hilliard/cpp/CahnHilliard2D.h |  1823 +-
 .../cahn-hilliard/cpp/CahnHilliard2D.ufl           |     3 +-
 .../cahn-hilliard/cpp/CahnHilliard3D.cpp           |  5289 ++-
 demo/documented/cahn-hilliard/cpp/CahnHilliard3D.h |  1823 +-
 .../cahn-hilliard/cpp/CahnHilliard3D.ufl           |     3 +-
 demo/documented/cahn-hilliard/cpp/compile.log      |  5898 ++-
 .../documented/cahn-hilliard/cpp/documentation.rst |    85 +-
 demo/documented/cahn-hilliard/cpp/main.cpp         |    41 +-
 .../cahn-hilliard/python/demo_cahn-hilliard.py     |    10 +-
 .../cahn-hilliard/python/documentation.rst         |    19 +-
 demo/documented/eigenvalue/cpp/CMakeLists.txt      |    43 +-
 demo/documented/eigenvalue/cpp/StiffnessMatrix.h   |  4371 ++-
 demo/documented/eigenvalue/cpp/compile.log         |   194 +-
 demo/documented/eigenvalue/cpp/main.cpp            |     8 +-
 demo/documented/hyperelasticity/cpp/CMakeLists.txt |    43 +-
 .../hyperelasticity/cpp/HyperElasticity.h          |  2992 +-
 .../hyperelasticity/cpp/HyperElasticity.ufl        |     2 +-
 demo/documented/hyperelasticity/cpp/compile.log    |   757 +-
 .../hyperelasticity/cpp/documentation.rst          |    44 +-
 demo/documented/hyperelasticity/cpp/main.cpp       |    28 +-
 .../hyperelasticity/python/demo_hyperelasticity.py |     6 +-
 .../hyperelasticity/python/documentation.rst       |     6 +-
 .../mixed-poisson-dual/cpp/CMakeLists.txt          |    43 +-
 .../mixed-poisson-dual/cpp/MixedPoissonDual.h      |  5078 ++-
 demo/documented/mixed-poisson-dual/cpp/compile.log |   577 +-
 .../mixed-poisson-dual/cpp/documentation.rst       |    16 +-
 demo/documented/mixed-poisson-dual/cpp/main.cpp    |    15 +-
 .../python/demo_mixed-poisson-dual.py              |    12 +-
 .../mixed-poisson-dual/python/documentation.rst    |    30 +-
 demo/documented/mixed-poisson/cpp/CMakeLists.txt   |    43 +-
 demo/documented/mixed-poisson/cpp/MixedPoisson.h   |  4228 ++-
 demo/documented/mixed-poisson/cpp/compile.log      |   295 +-
 .../documented/mixed-poisson/cpp/documentation.rst |    15 +-
 demo/documented/mixed-poisson/cpp/main.cpp         |    13 +-
 .../mixed-poisson/python/demo_mixed-poisson.py     |    14 +-
 .../mixed-poisson/python/documentation.rst         |    32 +-
 demo/documented/navier-stokes/cpp/CMakeLists.txt   |    43 +-
 demo/documented/navier-stokes/cpp/PressureUpdate.h |  4538 ++-
 .../navier-stokes/cpp/TentativeVelocity.h          |  5670 ++-
 demo/documented/navier-stokes/cpp/VelocityUpdate.h |  8041 ++--
 demo/documented/navier-stokes/cpp/compile.log      |  2897 +-
 .../documented/navier-stokes/cpp/documentation.rst |    46 +-
 demo/documented/navier-stokes/cpp/main.cpp         |    44 +-
 .../navier-stokes/python/demo_navier-stokes.py     |     2 +-
 .../navier-stokes/python/documentation.rst         |     2 +-
 demo/documented/neumann-poisson/cpp/CMakeLists.txt |    43 +-
 demo/documented/neumann-poisson/cpp/Poisson.h      |  4196 ++-
 demo/documented/neumann-poisson/cpp/compile.log    |   194 +-
 demo/documented/neumann-poisson/cpp/main.cpp       |    23 +-
 .../neumann-poisson/python/demo_neumann-poisson.py |    14 +-
 .../neumann-poisson/python/documentation.rst       |    54 +-
 .../nonlinear-poisson/cpp/CMakeLists.txt           |    43 +-
 .../nonlinear-poisson/cpp/NonlinearPoisson.h       |  3239 +-
 demo/documented/nonlinear-poisson/cpp/compile.log  |   147 +-
 demo/documented/nonlinear-poisson/cpp/main.cpp     |    18 +-
 .../python/demo_nonlinear-poisson.py               |     5 +-
 .../nonlinear-poisson/python/documentation.rst     |    51 +-
 demo/documented/periodic/cpp/CMakeLists.txt        |    43 +-
 demo/documented/periodic/cpp/Poisson.h             |  3181 +-
 demo/documented/periodic/cpp/compile.log           |   120 +-
 demo/documented/periodic/cpp/main.cpp              |    12 +-
 demo/documented/periodic/python/demo_periodic.py   |     2 +-
 demo/documented/periodic/python/documentation.rst  |    93 +-
 demo/documented/poisson/cpp/CMakeLists.txt         |    43 +-
 demo/documented/poisson/cpp/Poisson.h              |  3283 +-
 demo/documented/poisson/cpp/compile.log            |   131 +-
 demo/documented/poisson/cpp/documentation.rst      |    12 +-
 demo/documented/poisson/cpp/main.cpp               |    12 +-
 demo/documented/poisson/python/demo_poisson.py     |     4 +-
 demo/documented/poisson/python/documentation.rst   |     4 +-
 .../documented/singular-poisson/cpp/CMakeLists.txt |    43 +-
 demo/documented/singular-poisson/cpp/Poisson.h     |  3283 +-
 demo/documented/singular-poisson/cpp/compile.log   |   131 +-
 demo/documented/singular-poisson/cpp/main.cpp      |    19 +-
 .../python/demo_singular-poisson.py                |    15 +-
 .../singular-poisson/python/documentation.rst      |    69 +-
 .../documented/stokes-iterative/cpp/CMakeLists.txt |    43 +-
 demo/documented/stokes-iterative/cpp/Stokes.h      | 16346 ++++----
 .../stokes-iterative/cpp/StokesPreconditioner.h    | 15960 ++++----
 demo/documented/stokes-iterative/cpp/compile.log   |  2492 +-
 demo/documented/stokes-iterative/cpp/main.cpp      |    33 +-
 .../python/demo_stokes-iterative.py                |    11 +-
 .../stokes-iterative/python/documentation.rst      |    22 +-
 .../stokes-mini/python/demo_stokes-mini.py         |    25 +-
 .../stokes-mini/python/documentation.rst           |    53 +-
 demo/documented/stokes-stabilized/common.txt       |    84 -
 .../stokes-stabilized/cpp/CMakeLists.txt           |    46 -
 demo/documented/stokes-stabilized/cpp/Stokes.h     |  6299 ----
 demo/documented/stokes-stabilized/cpp/Stokes.ufl   |    40 -
 demo/documented/stokes-stabilized/cpp/compile.log  |   953 -
 .../stokes-stabilized/cpp/documentation.rst        |     6 -
 demo/documented/stokes-stabilized/cpp/main.cpp     |   116 -
 demo/documented/stokes-stabilized/cpp/plot.py      |     9 -
 .../stokes-stabilized/dolfin_fine.xml.gz           |   Bin 88283 -> 0 bytes
 .../dolfin_fine_subdomains.xml.gz                  |   Bin 42459 -> 0 bytes
 demo/documented/stokes-stabilized/plot_p.png       |   Bin 49829 -> 0 bytes
 demo/documented/stokes-stabilized/plot_u.png       |   Bin 94743 -> 0 bytes
 .../python/demo_stokes-stabilized.py               |    82 -
 .../stokes-stabilized/python/documentation.rst     |   133 -
 .../stokes-taylor-hood/cpp/CMakeLists.txt          |    43 +-
 demo/documented/stokes-taylor-hood/cpp/Stokes.h    |  9180 +++--
 demo/documented/stokes-taylor-hood/cpp/compile.log |   538 +-
 demo/documented/stokes-taylor-hood/cpp/main.cpp    |    24 +-
 .../python/demo_stokes-taylor-hood.py              |     9 +-
 .../stokes-taylor-hood/python/documentation.rst    |   112 +-
 .../python/demo_subdomains-poisson.py              |     4 +-
 .../subdomains-poisson/python/documentation.rst    |     4 +-
 demo/documented/subdomains/cpp/CMakeLists.txt      |    43 +-
 demo/documented/subdomains/cpp/main.cpp            |     8 +-
 .../documented/subdomains/python/documentation.rst |    98 +-
 .../python/demo_tensor-weighted-poisson.py         |     4 +-
 .../python/documentation.rst                       |   172 +-
 .../python/demo_adaptive-poisson.py                |     4 +-
 .../advection-diffusion/cpp/AdvectionDiffusion.h   |  4235 ++-
 .../advection-diffusion/cpp/CMakeLists.txt         |    43 +-
 .../advection-diffusion/cpp/Velocity.h             |   912 +-
 .../advection-diffusion/cpp/compile.log            |   595 +-
 demo/undocumented/advection-diffusion/cpp/main.cpp |    32 +-
 demo/undocumented/ale/cpp/CMakeLists.txt           |    43 +-
 demo/undocumented/ale/cpp/main.cpp                 |    19 +-
 demo/undocumented/ale/python/demo_ale.py           |     2 +-
 .../cpp/AdaptiveNavierStokes.h                     | 37007 ++++++++++---------
 .../auto-adaptive-navier-stokes/cpp/CMakeLists.txt |    43 +-
 .../auto-adaptive-navier-stokes/cpp/compile.log    | 17207 ++++-----
 .../auto-adaptive-navier-stokes/cpp/main.cpp       |    51 +-
 .../python/demo_auto-adaptive-navier-stokes.py     |     8 +-
 demo/undocumented/block-matrix/cpp/CMakeLists.txt  |    43 +-
 .../block-matrix/cpp/StiffnessMatrix.h             |  3109 +-
 demo/undocumented/block-matrix/cpp/compile.log     |   131 +-
 demo/undocumented/block-matrix/cpp/main.cpp        |     4 +-
 .../buckling-tao/python/demo_buckling-tao.py       |    25 +-
 .../python/demo_collision-detection.py             |     5 +
 demo/undocumented/coloring/cpp/CMakeLists.txt      |    43 +-
 demo/undocumented/coloring/cpp/main.cpp            |    22 +-
 .../python/Probe/Probe.cpp                         |     6 +-
 .../compiled-extension-module/python/Probe/Probe.h |     2 +-
 .../python/demo_compiled-extension-module.py       |     6 +-
 demo/undocumented/conditional/cpp/CMakeLists.txt   |    43 +-
 demo/undocumented/conditional/cpp/Conditional.h    |  5235 ++-
 demo/undocumented/conditional/cpp/compile.log      |   173 +-
 demo/undocumented/conditional/cpp/main.cpp         |     8 +-
 .../contact-vi-snes/cpp/CMakeLists.txt             |    43 +-
 .../contact-vi-snes/cpp/HyperElasticity.h          |  2612 +-
 demo/undocumented/contact-vi-snes/cpp/compile.log  |   308 +-
 demo/undocumented/contact-vi-snes/cpp/main.cpp     |    38 +-
 .../contact-vi-snes/python/demo_contact-vi-snes.py |    22 +-
 .../undocumented/contact-vi-tao/cpp/CMakeLists.txt |    43 +-
 demo/undocumented/contact-vi-tao/cpp/Elasticity.h  |  2480 +-
 demo/undocumented/contact-vi-tao/cpp/compile.log   |   194 +-
 demo/undocumented/contact-vi-tao/cpp/main.cpp      |    20 +-
 .../contact-vi-tao/python/demo_contact-vi-tao.py   |    22 +-
 demo/undocumented/coordinates/cpp/README           |     1 +
 .../coordinates/python/demo_coordinates.py         |    52 +
 demo/undocumented/curl-curl/cpp/CMakeLists.txt     |    43 +-
 demo/undocumented/curl-curl/cpp/CurrentDensity.h   |  6688 ++--
 demo/undocumented/curl-curl/cpp/EddyCurrents.h     |  2178 +-
 .../undocumented/curl-curl/cpp/P1Space.h           |   436 +-
 .../undocumented/curl-curl/cpp/P1Space.ufl         |    14 +-
 demo/undocumented/curl-curl/cpp/compile.log        |   981 +-
 demo/undocumented/curl-curl/cpp/main.cpp           |   156 +-
 .../curl-curl/python/demo_curl-curl.py             |   133 +-
 .../cpp/AdvectionDiffusion.h                       |  6276 +++-
 .../dg-advection-diffusion/cpp/CMakeLists.txt      |    43 +-
 .../dg-advection-diffusion/cpp/Projection.h        |  3456 +-
 .../dg-advection-diffusion/cpp/Velocity.h          |   912 +-
 .../dg-advection-diffusion/cpp/compile.log         |  1600 +-
 .../dg-advection-diffusion/cpp/main.cpp            |    24 +-
 .../python/demo_dg-advection-diffusion.py          |     2 +-
 demo/undocumented/dg-poisson/cpp/CMakeLists.txt    |    43 +-
 demo/undocumented/dg-poisson/cpp/Poisson.h         |  4558 ++-
 demo/undocumented/dg-poisson/cpp/compile.log       |   281 +-
 demo/undocumented/dg-poisson/cpp/main.cpp          |    16 +-
 .../dg-poisson/python/demo_dg-poisson.py           |     6 +-
 demo/undocumented/elasticity/cpp/CMakeLists.txt    |    43 +-
 demo/undocumented/elasticity/cpp/Elasticity.h      | 10045 ++---
 demo/undocumented/elasticity/cpp/compile.log       |   925 +-
 demo/undocumented/elasticity/cpp/main.cpp          |    95 +-
 .../elasticity/python/demo_elasticity.py           |    38 +-
 .../undocumented/elastodynamics/cpp/CMakeLists.txt |    43 +-
 demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h  |  1743 +-
 .../elastodynamics/cpp/ElastoDynamics.h            |  3213 +-
 demo/undocumented/elastodynamics/cpp/compile.log   |   349 +-
 demo/undocumented/elastodynamics/cpp/main.cpp      |    70 +-
 .../elastodynamics/python/demo_elastodynamics.py   |    10 +-
 demo/undocumented/eval/cpp/CMakeLists.txt          |    43 +-
 demo/undocumented/eval/cpp/Projection.h            |  9029 +++--
 demo/undocumented/eval/cpp/compile.log             |   312 +-
 demo/undocumented/eval/cpp/main.cpp                |     8 +-
 demo/undocumented/eval/python/demo_eval.py         |     2 +-
 demo/undocumented/extrapolation/cpp/CMakeLists.txt |    43 +-
 demo/undocumented/extrapolation/cpp/P1.h           |   376 +-
 demo/undocumented/extrapolation/cpp/P2.h           |   430 +-
 demo/undocumented/extrapolation/cpp/compile.log    |   164 +-
 demo/undocumented/extrapolation/cpp/main.cpp       |     6 +-
 .../extrapolation/python/demo_extrapolation.py     |     2 +-
 demo/undocumented/functional/cpp/CMakeLists.txt    |    43 +-
 demo/undocumented/functional/cpp/EnergyNorm.h      |  4547 ++-
 demo/undocumented/functional/cpp/compile.log       |   214 +-
 demo/undocumented/functional/cpp/main.cpp          |     8 +-
 demo/undocumented/ghost-mesh/python/.gitignore     |     1 +
 .../ghost-mesh/python/demo_ghost-mesh.py           |    39 +-
 .../interpolation/python/demo_interpolation.py     |     5 +-
 demo/undocumented/lift-drag/cpp/CMakeLists.txt     |    43 +-
 demo/undocumented/lift-drag/cpp/Functionals.h      |  2663 +-
 demo/undocumented/lift-drag/cpp/Functionals.ufl    |     1 +
 demo/undocumented/lift-drag/cpp/compile.log        |   147 +-
 demo/undocumented/lift-drag/cpp/main.cpp           |    10 +-
 .../lift-drag/python/demo_lift-drag.py             |     2 +-
 demo/undocumented/mesh-quality/cpp/CMakeLists.txt  |    43 +-
 demo/undocumented/mesh-quality/python/.gitignore   |     1 +
 .../mesh-quality/python/demo_mesh-quality.py       |     4 +-
 .../meshfunction-refinement/cpp/CMakeLists.txt     |    43 +-
 .../meshfunction-refinement/cpp/main.cpp           |    16 +-
 .../python/demo_mixed-poisson-sphere.py            |    21 +-
 demo/undocumented/mplot/cpp/README                 |     2 +
 demo/undocumented/mplot/python/.gitignore          |     2 +
 demo/undocumented/mplot/python/demo_mplot.py       |   132 +
 .../multimesh-poisson/cpp/CMakeLists.txt           |    43 +-
 .../multimesh-poisson/cpp/MultiMeshPoisson.h       |  3440 +-
 .../multimesh-poisson/cpp/MultiMeshPoisson.ufl     |    30 +-
 .../undocumented/multimesh-poisson/cpp/compile.log |   184 +-
 demo/undocumented/multimesh-poisson/cpp/main.cpp   |   133 +-
 .../python/demo_multimesh-poisson.py               |   132 +
 .../multimesh-stokes/cpp/CMakeLists.txt            |    43 +-
 .../multimesh-stokes/cpp/MultiMeshStokes.h         | 10032 ++---
 .../multimesh-stokes/cpp/MultiMeshStokes.ufl       |    45 +-
 demo/undocumented/multimesh-stokes/cpp/Stokes.h    |  9180 +++--
 demo/undocumented/multimesh-stokes/cpp/compile.log |  1222 +-
 demo/undocumented/multimesh-stokes/cpp/main.cpp    |   172 +-
 .../python/demo_multimesh-stokes.py                |   167 +
 .../python/demo_multistage-solver.py               |     2 +-
 .../nonmatching-interpolation/cpp/CMakeLists.txt   |    43 +-
 .../nonmatching-interpolation/cpp/P1.h             |   376 +-
 .../nonmatching-interpolation/cpp/P3.h             |   594 +-
 .../nonmatching-interpolation/cpp/compile.log      |   212 +-
 .../nonmatching-interpolation/cpp/main.cpp         |     8 +-
 .../nonmatching-projection/cpp/CMakeLists.txt      |    43 +-
 .../nonmatching-projection/cpp/P1_projection.h     |  7076 ++--
 demo/undocumented/nonmatching-projection/cpp/P3.h  |   594 +-
 .../nonmatching-projection/cpp/compile.log         |   389 +-
 .../nonmatching-projection/cpp/main.cpp            |    14 +-
 .../optimization/python/demo_optimization.py       |     2 +-
 .../parallel-refinement/cpp/CMakeLists.txt         |    43 +-
 demo/undocumented/parallel-refinement/cpp/main.cpp |    14 +-
 demo/undocumented/parameters/cpp/CMakeLists.txt    |    43 +-
 .../parameters/python/demo_parameters.py           |     9 -
 demo/undocumented/petsc4py/python/demo_petsc4py.py |   102 -
 .../plot-qt/cpp/BoundaryMeshFunction.h             |    48 -
 demo/undocumented/plot-qt/cpp/CMakeLists.txt       |   103 -
 demo/undocumented/plot-qt/cpp/CoordLabel.cpp       |    49 -
 demo/undocumented/plot-qt/cpp/CoordLabel.h         |    49 -
 demo/undocumented/plot-qt/cpp/PlotWidget.h         |    57 -
 demo/undocumented/plot-qt/cpp/Plotter.cpp          |   108 -
 demo/undocumented/plot-qt/cpp/Plotter.h            |    73 -
 demo/undocumented/plot-qt/cpp/main.cpp             |   106 -
 demo/undocumented/plot/cpp/CMakeLists.txt          |    43 +-
 .../point-integral/python/demo_point-integral.py   |     6 +-
 demo/undocumented/poisson-disc/cpp/CMakeLists.txt  |    45 +
 .../Velocity.h => poisson-disc/cpp/PoissonDisc.h}  |  2564 +-
 demo/undocumented/poisson-disc/cpp/PoissonDisc.ufl |    53 +
 demo/undocumented/poisson-disc/cpp/compile.log     |  2073 ++
 .../poisson-disc}/cpp/main.cpp                     |    66 +-
 .../poisson-disc/python/demo_poisson-disc.py       |   111 +
 .../poisson1D-in-2D/cpp/CMakeLists.txt             |    43 +-
 demo/undocumented/poisson1D-in-2D/cpp/Poisson.h    |  2561 +-
 demo/undocumented/poisson1D-in-2D/cpp/compile.log  |    95 +-
 demo/undocumented/poisson1D-in-2D/cpp/main.cpp     |    16 +-
 .../poisson1D-in-2D/python/demo_poisson1D-in-2D.py |     4 +-
 demo/undocumented/poisson1D/cpp/CMakeLists.txt     |    43 +-
 demo/undocumented/poisson1D/cpp/Poisson.h          |  2230 +-
 demo/undocumented/poisson1D/cpp/compile.log        |    92 +-
 demo/undocumented/poisson1D/cpp/main.cpp           |    12 +-
 .../poisson1D/python/demo_poisson1D.py             |     4 +-
 demo/undocumented/refinement/cpp/CMakeLists.txt    |    43 +-
 demo/undocumented/refinement/cpp/main.cpp          |    20 +-
 .../spatial-coordinates/cpp/CMakeLists.txt         |    43 +-
 .../spatial-coordinates/cpp/SpatialCoordinates.h   |  5273 ++-
 .../spatial-coordinates/cpp/compile.log            |   182 +-
 demo/undocumented/spatial-coordinates/cpp/main.cpp |    23 +-
 .../python/demo_sub-function-assignment.py         |     6 +-
 demo/undocumented/submesh/cpp/CMakeLists.txt       |    43 +-
 demo/undocumented/submesh/cpp/main.cpp             |    29 +-
 demo/undocumented/submesh/python/demo_submesh.py   |     2 +-
 .../sym-dirichlet-bc/cpp/CMakeLists.txt            |    43 +-
 demo/undocumented/sym-dirichlet-bc/cpp/Poisson.h   |  3283 +-
 demo/undocumented/sym-dirichlet-bc/cpp/compile.log |   131 +-
 demo/undocumented/sym-dirichlet-bc/cpp/main.cpp    |    18 +-
 .../python/demo_sym-dirichlet-bc.py                |     4 +-
 demo/undocumented/time-series/cpp/CMakeLists.txt   |    43 +-
 demo/undocumented/timing/python/.gitignore         |     1 +
 demo/undocumented/timing/python/demo_timing.py     |     4 +-
 demo/undocumented/waveguide/cpp/CMakeLists.txt     |    43 +-
 demo/undocumented/waveguide/cpp/Forms.h            |  4877 ++-
 demo/undocumented/waveguide/cpp/compile.log        |  1267 +-
 demo/undocumented/waveguide/cpp/main.cpp           |    34 +-
 {doc => doc-old}/CMakeLists.txt                    |     0
 {doc => doc-old}/README                            |     0
 {doc => doc-old}/copy_and_split_demo_doc.py        |     0
 {doc => doc-old}/generate_api_doc.py               |     0
 {doc => doc-old}/generate_main_index.py            |     0
 {doc => doc-old}/man/man1/dolfin-convert.1.gz      |   Bin
 {doc => doc-old}/man/man1/dolfin-order.1.gz        |   Bin
 {doc => doc-old}/man/man1/dolfin-plot.1.gz         |   Bin
 {doc => doc-old}/man/man1/dolfin-version.1.gz      |   Bin
 {doc => doc-old}/quick_reference_cpp.rst           |     0
 {doc => doc-old}/quick_reference_python.rst        |     0
 {doc => doc-old}/sphinx-common/Makefile            |     0
 {doc => doc-old}/sphinx-common/README              |     0
 {doc => doc-old}/sphinx-common/source/conf.py      |     0
 {doc => doc-old}/sphinx-common/source/index.rst    |     0
 doc/{sphinx-common => }/Makefile                   |    94 +-
 doc/source/api.rst                                 |     7 +
 doc/{sphinx-common => }/source/conf.py             |   225 +-
 doc/source/developer.rst                           |    14 +
 doc/source/documenting_dolfin_api.rst              |   244 +
 doc/source/help.rst                                |     7 +
 doc/source/index.rst                               |    29 +
 doc/source/installation.rst                        |    16 +
 doc/source/styleguide_cpp.rst                      |   343 +
 doc/source/using.rst                               |     7 +
 dolfin/CMakeLists.txt                              |    99 +-
 .../adaptivity/AdaptiveLinearVariationalSolver.cpp |    11 +-
 .../adaptivity/AdaptiveLinearVariationalSolver.h   |    14 +-
 .../AdaptiveNonlinearVariationalSolver.cpp         |    14 +-
 .../AdaptiveNonlinearVariationalSolver.h           |    13 +-
 dolfin/adaptivity/ErrorControl.cpp                 |    88 +-
 dolfin/adaptivity/ErrorControl.h                   |     7 +-
 dolfin/adaptivity/Extrapolation.cpp                |    33 +-
 dolfin/adaptivity/Extrapolation.h                  |     6 +-
 .../GenericAdaptiveVariationalSolver.cpp           |    23 +-
 dolfin/adaptivity/LocalAssembler.cpp               |   206 -
 dolfin/adaptivity/LocalAssembler.h                 |    92 -
 dolfin/adaptivity/TimeSeries.cpp                   |     5 +-
 dolfin/adaptivity/TimeSeries.h                     |    12 +-
 dolfin/adaptivity/adapt.cpp                        |   153 +-
 dolfin/adaptivity/adapt.h                          |    59 +-
 dolfin/adaptivity/adaptivesolve.cpp                |    54 +-
 dolfin/adaptivity/dolfin_adaptivity.h              |     1 -
 dolfin/ale/ALE.cpp                                 |    63 +-
 dolfin/ale/ALE.h                                   |    58 +-
 dolfin/ale/HarmonicSmoothing.cpp                   |    27 +-
 dolfin/ale/HarmonicSmoothing.h                     |    13 +-
 dolfin/ale/MeshDisplacement.cpp                    |    19 +-
 dolfin/ale/MeshDisplacement.h                      |     3 +-
 dolfin/ale/Poisson1D.h                             |  1870 +-
 dolfin/ale/Poisson2D.h                             |  2757 +-
 dolfin/ale/Poisson3D.h                             |  4371 ++-
 dolfin/ale/compile.log                             |   375 +-
 dolfin/common/MPI.cpp                              |    36 +-
 dolfin/common/MPI.h                                |    34 +-
 dolfin/common/SubSystemsManager.cpp                |    26 +-
 dolfin/common/SubSystemsManager.h                  |     8 +-
 dolfin/common/Timer.cpp                            |     7 -
 dolfin/common/Timer.h                              |     3 -
 dolfin/common/defines.cpp                          |    23 +-
 dolfin/common/defines.h                            |    10 +-
 dolfin/common/timing.cpp                           |     5 -
 dolfin/common/timing.h                             |     8 -
 dolfin/common/unittest.h                           |    40 -
 dolfin/common/utils.h                              |    37 +-
 dolfin/common/version.h.in                         |     1 +
 dolfin/fem/Assembler.cpp                           |    54 +-
 dolfin/fem/Assembler.h                             |    10 +-
 dolfin/fem/AssemblerBase.cpp                       |   124 +-
 dolfin/fem/BasisFunction.h                         |    49 +-
 dolfin/fem/DirichletBC.cpp                         |   261 +-
 dolfin/fem/DirichletBC.h                           |   102 +-
 dolfin/fem/DiscreteOperators.cpp                   |   167 +
 dolfin/fem/DiscreteOperators.h                     |    53 +
 dolfin/fem/DofMap.cpp                              |   221 +-
 dolfin/fem/DofMap.h                                |   119 +-
 dolfin/fem/DofMapBuilder.cpp                       |   395 +-
 dolfin/fem/DofMapBuilder.h                         |    37 +-
 dolfin/fem/DomainAssigner.cpp                      |    83 -
 dolfin/fem/DomainAssigner.h                        |   127 -
 dolfin/fem/FiniteElement.cpp                       |    38 +-
 dolfin/fem/FiniteElement.h                         |    58 +-
 dolfin/fem/Form.cpp                                |    71 +-
 dolfin/fem/Form.h                                  |    78 +-
 dolfin/fem/GenericDofMap.h                         |    40 +-
 dolfin/fem/LinearTimeDependentProblem.cpp          |    71 +-
 dolfin/fem/LinearTimeDependentProblem.h            |    27 +-
 dolfin/fem/LinearVariationalProblem.cpp            |    63 +-
 dolfin/fem/LinearVariationalProblem.h              |    30 +-
 dolfin/fem/LinearVariationalSolver.cpp             |    42 +-
 dolfin/fem/LinearVariationalSolver.h               |     6 +-
 dolfin/fem/LocalAssembler.cpp                      |   306 +
 dolfin/fem/LocalAssembler.h                        |   111 +
 dolfin/fem/LocalSolver.cpp                         |   411 +-
 dolfin/fem/LocalSolver.h                           |    53 +-
 dolfin/fem/MultiMeshAssembler.cpp                  |   544 +-
 dolfin/fem/MultiMeshDirichletBC.cpp                |   249 +-
 dolfin/fem/MultiMeshDirichletBC.h                  |    74 +-
 dolfin/fem/MultiMeshDofMap.cpp                     |    30 +-
 dolfin/fem/MultiMeshDofMap.h                       |    25 +-
 dolfin/fem/MultiMeshForm.cpp                       |    31 +-
 dolfin/fem/MultiMeshForm.h                         |    37 +-
 dolfin/fem/NonlinearVariationalProblem.cpp         |   132 +-
 dolfin/fem/NonlinearVariationalProblem.h           |    80 +-
 dolfin/fem/NonlinearVariationalSolver.cpp          |    87 +-
 dolfin/fem/NonlinearVariationalSolver.h            |    78 +-
 dolfin/fem/OpenMpAssembler.cpp                     |    52 +-
 dolfin/fem/OpenMpAssembler.h                       |    10 +-
 dolfin/fem/PointSource.cpp                         |    22 +-
 dolfin/fem/PointSource.h                           |    16 +-
 dolfin/fem/SparsityPatternBuilder.cpp              |    91 +-
 dolfin/fem/SparsityPatternBuilder.h                |    14 +-
 dolfin/fem/SystemAssembler.cpp                     |   247 +-
 dolfin/fem/SystemAssembler.h                       |    48 +-
 dolfin/fem/UFC.cpp                                 |    42 +-
 dolfin/fem/UFC.h                                   |    96 +-
 dolfin/fem/assemble.cpp                            |    50 +-
 dolfin/fem/assemble.h                              |    53 +-
 dolfin/fem/assemble_local.cpp                      |    83 +
 dolfin/{la/STLVector.h => fem/assemble_local.h}    |    23 +-
 dolfin/fem/dolfin_fem.h                            |     3 +
 dolfin/fem/fem_utils.cpp                           |   228 +-
 dolfin/fem/fem_utils.h                             |    77 +-
 dolfin/fem/solve.cpp                               |    84 +-
 dolfin/function/CoefficientAssigner.cpp            |    10 +-
 dolfin/function/CoefficientAssigner.h              |     6 +-
 dolfin/function/Constant.cpp                       |    44 +
 dolfin/function/Constant.h                         |    17 +-
 dolfin/function/Expression.cpp                     |     9 +-
 dolfin/function/Expression.h                       |    10 +-
 dolfin/function/Function.cpp                       |   214 +-
 dolfin/function/Function.h                         |    59 +-
 dolfin/function/FunctionAXPY.cpp                   |    25 +-
 dolfin/function/FunctionAXPY.h                     |    16 +-
 dolfin/function/FunctionAssigner.cpp               |    17 +-
 dolfin/function/FunctionSpace.cpp                  |   206 +-
 dolfin/function/FunctionSpace.h                    |    65 +-
 dolfin/function/GenericFunction.cpp                |     4 +-
 dolfin/function/GenericFunction.h                  |     9 +-
 dolfin/function/LagrangeInterpolator.cpp           |    42 +-
 dolfin/function/LagrangeInterpolator.h             |    96 +-
 .../function/MultiMeshCoefficientAssigner.cpp      |    54 +-
 ...ntAssigner.h => MultiMeshCoefficientAssigner.h} |    34 +-
 dolfin/function/MultiMeshFunction.cpp              |    19 +-
 dolfin/function/MultiMeshFunction.h                |    18 +-
 dolfin/function/MultiMeshFunctionSpace.cpp         |    40 +-
 dolfin/function/MultiMeshFunctionSpace.h           |    40 +-
 dolfin/function/MultiMeshSubSpace.cpp              |    18 +-
 dolfin/function/MultiMeshSubSpace.h                |     4 +-
 dolfin/function/SpecialFunctions.cpp               |    22 +-
 dolfin/function/SpecialFunctions.h                 |    15 +-
 dolfin/function/SubSpace.cpp                       |    62 -
 dolfin/function/SubSpace.h                         |    61 -
 dolfin/function/dolfin_function.h                  |     1 -
 dolfin/generation/BoxMesh.cpp                      |    13 +-
 dolfin/generation/IntervalMesh.cpp                 |     5 +-
 dolfin/generation/RectangleMesh.cpp                |     6 +-
 dolfin/generation/SphericalShellMesh.cpp           |   102 +
 .../ALEType.h => generation/SphericalShellMesh.h}  |    21 +-
 dolfin/generation/UnitCubeMesh.h                   |     2 +-
 dolfin/generation/UnitDiscMesh.cpp                 |   127 +
 .../UnitDiscMesh.h}                                |    26 +-
 dolfin/generation/UnitHexMesh.cpp                  |     4 +-
 dolfin/generation/UnitHexMesh.h                    |     2 +-
 dolfin/generation/UnitIntervalMesh.h               |     2 +-
 dolfin/generation/UnitQuadMesh.cpp                 |     3 +-
 dolfin/generation/UnitQuadMesh.h                   |     3 +-
 dolfin/generation/UnitSquareMesh.h                 |     2 +-
 dolfin/generation/dolfin_generation.h              |     2 +
 dolfin/geometry/BoundingBoxTree.cpp                |    31 +-
 dolfin/geometry/BoundingBoxTree.h                  |    17 +-
 dolfin/geometry/CollisionDetection.cpp             |    13 +-
 dolfin/geometry/GenericBoundingBoxTree.cpp         |   106 +-
 dolfin/geometry/GenericBoundingBoxTree.h           |    20 +-
 dolfin/geometry/Point.h                            |    36 +-
 dolfin/graph/CSRGraph.h                            |    44 +-
 dolfin/graph/Graph.h                               |     1 -
 dolfin/graph/GraphBuilder.cpp                      |   291 +-
 dolfin/graph/GraphBuilder.h                        |    60 +-
 dolfin/graph/GraphOrdering.cpp                     |   196 -
 dolfin/graph/GraphOrdering.h                       |    99 -
 dolfin/graph/ParMETIS.cpp                          |   380 +-
 dolfin/graph/ParMETIS.h                            |    83 +-
 dolfin/graph/SCOTCH.cpp                            |   192 +-
 dolfin/graph/SCOTCH.h                              |    30 +-
 dolfin/graph/ZoltanPartition.cpp                   |   466 -
 dolfin/graph/ZoltanPartition.h                     |    99 -
 dolfin/io/Encoder.h                                |    13 +-
 dolfin/io/File.cpp                                 |    40 +-
 dolfin/io/File.h                                   |    10 +-
 dolfin/io/GenericFile.cpp                          |     4 +-
 dolfin/io/GenericFile.h                            |    23 +-
 dolfin/io/HDF5File.cpp                             |  1105 +-
 dolfin/io/HDF5File.h                               |    72 +-
 dolfin/io/HDF5Interface.cpp                        |    59 +-
 dolfin/io/HDF5Interface.h                          |   153 +-
 dolfin/io/HDF5Utility.cpp                          |    30 +-
 dolfin/io/RAWFile.cpp                              |     4 +-
 dolfin/io/VTKWriter.cpp                            |    30 +-
 dolfin/io/VTKWriter.h                              |    18 +-
 dolfin/io/X3DFile.cpp                              |   219 +-
 dolfin/io/X3DFile.h                                |    11 -
 dolfin/io/X3DOM.cpp                                |  1059 +
 dolfin/io/X3DOM.h                                  |   322 +
 dolfin/io/XDMFFile.cpp                             |  2189 +-
 dolfin/io/XDMFFile.h                               |   364 +-
 dolfin/io/XDMFxml.cpp                              |   265 +-
 dolfin/io/XDMFxml.h                                |    72 +-
 dolfin/io/XMLFile.cpp                              |     8 +-
 dolfin/io/XMLMesh.cpp                              |    12 +-
 dolfin/io/XMLMeshValueCollection.h                 |     2 +-
 dolfin/io/XYZFile.cpp                              |     4 +-
 dolfin/io/dolfin_io.h                              |     1 +
 dolfin/io/pugiconfig.hpp                           |     5 +-
 dolfin/io/pugixml.cpp                              |  2246 +-
 dolfin/io/pugixml.hpp                              |    56 +-
 dolfin/io/xmlutils.cpp                             |    33 +-
 dolfin/io/xmlutils.h                               |    28 +-
 dolfin/la/Amesos2LUSolver.cpp                      |   234 +
 dolfin/la/Amesos2LUSolver.h                        |   104 +
 dolfin/la/BelosKrylovSolver.cpp                    |   131 +-
 dolfin/la/BelosKrylovSolver.h                      |    23 +-
 dolfin/la/BlockMatrix.cpp                          |     2 +-
 dolfin/la/BlockVector.h                            |     2 +-
 dolfin/la/CoordinateMatrix.cpp                     |     6 +-
 dolfin/la/DefaultFactory.cpp                       |    24 +-
 dolfin/la/DefaultFactory.h                         |    11 +-
 dolfin/la/EigenFactory.h                           |    26 +-
 dolfin/la/EigenKrylovSolver.cpp                    |   102 +-
 dolfin/la/EigenKrylovSolver.h                      |    13 +-
 dolfin/la/EigenMatrix.cpp                          |    57 +-
 dolfin/la/EigenMatrix.h                            |     5 +-
 dolfin/la/EigenVector.cpp                          |    23 +-
 dolfin/la/EigenVector.h                            |    25 +-
 dolfin/la/GenericLUSolver.h                        |     6 +
 dolfin/la/GenericLinearAlgebraFactory.h            |    16 +-
 dolfin/la/GenericLinearOperator.h                  |     2 +-
 dolfin/la/GenericLinearSolver.h                    |     9 -
 dolfin/la/GenericMatrix.cpp                        |     3 +-
 dolfin/la/GenericMatrix.h                          |     6 +-
 dolfin/la/GenericPreconditioner.h                  |    66 -
 dolfin/la/GenericSparsityPattern.h                 |   129 -
 dolfin/la/GenericTensor.h                          |    13 +-
 dolfin/la/GenericVector.h                          |    39 +-
 dolfin/la/Ifpack2Preconditioner.cpp                |    12 +-
 dolfin/la/IndexMap.cpp                             |   138 +
 dolfin/la/IndexMap.h                               |   133 +
 dolfin/la/KrylovSolver.cpp                         |    81 +-
 dolfin/la/KrylovSolver.h                           |    18 +-
 dolfin/la/LUSolver.cpp                             |    24 +-
 dolfin/la/LUSolver.h                               |    17 +-
 dolfin/la/LinearAlgebraObject.h                    |     4 +
 dolfin/la/LinearOperator.cpp                       |    19 +-
 dolfin/la/LinearOperator.h                         |    11 +-
 dolfin/la/LinearSolver.cpp                         |     7 +-
 dolfin/la/LinearSolver.h                           |    19 +-
 dolfin/la/MUMPSLUSolver.cpp                        |   209 -
 dolfin/la/MUMPSLUSolver.h                          |    80 -
 dolfin/la/Matrix.h                                 |     6 +-
 dolfin/la/MueluPreconditioner.cpp                  |    40 +-
 dolfin/la/MueluPreconditioner.h                    |     3 +
 dolfin/la/PETScBaseMatrix.cpp                      |    85 +-
 dolfin/la/PETScBaseMatrix.h                        |    17 +-
 dolfin/la/PETScFactory.cpp                         |    34 +-
 dolfin/la/PETScFactory.h                           |    13 +-
 dolfin/la/PETScKrylovSolver.cpp                    |   545 +-
 dolfin/la/PETScKrylovSolver.h                      |   109 +-
 dolfin/la/PETScLUSolver.cpp                        |   227 +-
 dolfin/la/PETScLUSolver.h                          |    33 +-
 dolfin/la/PETScLinearOperator.cpp                  |    37 +-
 dolfin/la/PETScLinearOperator.h                    |     6 +-
 dolfin/la/PETScMatrix.cpp                          |   433 +-
 dolfin/la/PETScMatrix.h                            |    27 +-
 dolfin/la/PETScOptions.cpp                         |     4 +
 dolfin/la/PETScOptions.h                           |    11 +-
 dolfin/la/PETScPreconditioner.cpp                  |   118 +-
 dolfin/la/PETScPreconditioner.h                    |    25 +-
 dolfin/la/PETScUserPreconditioner.cpp              |     4 -
 dolfin/la/PETScVector.cpp                          |   374 +-
 dolfin/la/PETScVector.h                            |    42 +-
 dolfin/la/PaStiXLUSolver.cpp                       |   292 -
 dolfin/la/PaStiXLUSolver.h                         |    69 -
 dolfin/la/SLEPcEigenSolver.cpp                     |   279 +-
 dolfin/la/SLEPcEigenSolver.h                       |    87 +-
 dolfin/la/STLFactory.cpp                           |    28 -
 dolfin/la/STLFactory.h                             |   115 -
 dolfin/la/STLFactoryCSC.cpp                        |    26 -
 dolfin/la/STLFactoryCSC.h                          |    60 -
 dolfin/la/STLMatrix.cpp                            |   470 -
 dolfin/la/STLMatrix.h                              |   410 -
 dolfin/la/Scalar.h                                 |    24 +-
 dolfin/la/SparsityPattern.cpp                      |   405 +-
 dolfin/la/SparsityPattern.h                        |    88 +-
 dolfin/la/TensorLayout.cpp                         |    78 +-
 dolfin/la/TensorLayout.h                           |    59 +-
 dolfin/la/TpetraFactory.cpp                        |    38 +-
 dolfin/la/TpetraFactory.h                          |    17 +-
 dolfin/la/TpetraMatrix.cpp                         |   315 +-
 dolfin/la/TpetraMatrix.h                           |    17 +-
 dolfin/la/TpetraVector.cpp                         |   175 +-
 dolfin/la/TpetraVector.h                           |    10 +-
 dolfin/la/TrilinosParameters.cpp                   |    82 +
 .../UnitQuadMesh.h => la/TrilinosParameters.h}     |    26 +-
 dolfin/la/TrilinosPreconditioner.h                 |    14 +-
 dolfin/la/Vector.h                                 |     8 +-
 dolfin/la/VectorSpaceBasis.cpp                     |    34 +-
 dolfin/la/VectorSpaceBasis.h                       |    21 +-
 dolfin/la/dolfin_la.h                              |    12 +-
 dolfin/la/solve.cpp                                |    23 +-
 dolfin/la/test_nullspace.cpp                       |     2 +-
 dolfin/log/LogManager.h                            |     4 +-
 dolfin/log/LogStream.cpp                           |     9 +-
 dolfin/log/LogStream.h                             |     8 +-
 dolfin/log/Logger.cpp                              |    32 +-
 dolfin/log/Logger.h                                |    16 +-
 dolfin/log/log.cpp                                 |    14 +-
 dolfin/log/log.h                                   |     7 +-
 dolfin/math/basic.cpp                              |    20 +-
 dolfin/math/basic.h                                |     3 +-
 dolfin/mesh/BoundaryComputation.cpp                |    25 +-
 dolfin/mesh/BoundaryComputation.h                  |     9 +-
 dolfin/mesh/Cell.h                                 |   101 +-
 dolfin/mesh/CellType.cpp                           |   138 +-
 dolfin/mesh/CellType.h                             |    26 +-
 dolfin/mesh/DistributedMeshTools.cpp               |    94 +-
 dolfin/mesh/DistributedMeshTools.h                 |     4 +-
 dolfin/mesh/DynamicMeshEditor.cpp                  |     1 -
 dolfin/mesh/Edge.h                                 |     5 -
 dolfin/mesh/Face.h                                 |     5 -
 dolfin/mesh/Facet.h                                |     6 -
 dolfin/mesh/HexahedronCell.cpp                     |    12 +-
 dolfin/mesh/HexahedronCell.h                       |    10 +-
 dolfin/mesh/IntervalCell.cpp                       |    45 +-
 dolfin/mesh/IntervalCell.h                         |    12 +-
 dolfin/mesh/LocalMeshData.cpp                      |   215 +-
 dolfin/mesh/LocalMeshData.h                        |   110 +-
 dolfin/mesh/LocalMeshValueCollection.h             |    13 +-
 dolfin/mesh/Mesh.cpp                               |    69 +-
 dolfin/mesh/Mesh.h                                 |    62 +-
 dolfin/mesh/MeshColoring.cpp                       |    39 +-
 dolfin/mesh/MeshColoring.h                         |    26 +-
 dolfin/mesh/MeshConnectivity.h                     |    26 +-
 dolfin/mesh/MeshEditor.cpp                         |    70 +-
 dolfin/mesh/MeshEditor.h                           |    30 +-
 dolfin/mesh/MeshEntity.cpp                         |     2 +-
 dolfin/mesh/MeshEntity.h                           |    10 +-
 dolfin/mesh/MeshFunction.h                         |   206 +-
 dolfin/mesh/MeshGeometry.cpp                       |   107 +-
 dolfin/mesh/MeshGeometry.h                         |   117 +-
 dolfin/mesh/MeshHierarchy.cpp                      |    58 +-
 dolfin/mesh/MeshPartitioning.cpp                   |   831 +-
 dolfin/mesh/MeshPartitioning.h                     |   231 +-
 dolfin/mesh/MeshQuality.cpp                        |   185 +-
 dolfin/mesh/MeshQuality.h                          |    24 +-
 dolfin/mesh/MeshRenumbering.cpp                    |     4 +-
 dolfin/mesh/MeshSmoothing.cpp                      |    58 +-
 dolfin/mesh/MeshTopology.cpp                       |     8 +-
 dolfin/mesh/MeshTopology.h                         |    14 +-
 dolfin/mesh/MeshTransformation.cpp                 |    74 +-
 dolfin/mesh/MeshTransformation.h                   |    88 +-
 dolfin/mesh/MeshValueCollection.h                  |    60 +-
 dolfin/mesh/MultiMesh.cpp                          |    78 +-
 dolfin/mesh/MultiMesh.h                            |    52 +-
 dolfin/mesh/PeriodicBoundaryComputation.cpp        |     7 +-
 dolfin/mesh/PointCell.cpp                          |    15 +-
 dolfin/mesh/PointCell.h                            |    12 +-
 dolfin/mesh/QuadrilateralCell.cpp                  |    14 +-
 dolfin/mesh/QuadrilateralCell.h                    |    12 +-
 dolfin/mesh/Restriction.cpp                        |    84 -
 dolfin/mesh/Restriction.h                          |   118 -
 dolfin/mesh/SubDomain.cpp                          |     2 +-
 dolfin/mesh/SubMesh.cpp                            |     6 +-
 dolfin/mesh/TetrahedronCell.cpp                    |   121 +-
 dolfin/mesh/TetrahedronCell.h                      |    18 +-
 dolfin/mesh/TopologyComputation.cpp                |   384 +-
 dolfin/mesh/TopologyComputation.h                  |    31 +-
 dolfin/mesh/TriangleCell.cpp                       |    61 +-
 dolfin/mesh/TriangleCell.h                         |    10 +-
 dolfin/mesh/Vertex.h                               |     5 -
 dolfin/mesh/dolfin_mesh.h                          |     1 -
 dolfin/multistage/MultiStageScheme.cpp             |    30 +-
 dolfin/multistage/MultiStageScheme.h               |    50 +-
 dolfin/multistage/PointIntegralSolver.cpp          |   309 +-
 dolfin/multistage/PointIntegralSolver.h            |    54 +-
 dolfin/multistage/RKSolver.cpp                     |     7 +-
 dolfin/multistage/RKSolver.h                       |     6 +-
 dolfin/nls/NewtonSolver.cpp                        |    27 +-
 dolfin/nls/NewtonSolver.h                          |     6 +-
 dolfin/nls/PETScSNESSolver.cpp                     |   292 +-
 dolfin/nls/PETScSNESSolver.h                       |    38 +-
 dolfin/nls/PETScTAOSolver.cpp                      |   264 +-
 dolfin/nls/PETScTAOSolver.h                        |    44 +-
 dolfin/nls/TAOLinearBoundSolver.cpp                |   358 +-
 dolfin/nls/TAOLinearBoundSolver.h                  |    34 +-
 dolfin/parameter/GlobalParameters.h                |    17 +-
 dolfin/parameter/Parameters.cpp                    |    17 +-
 dolfin/plot/VTKPlotter.cpp                         |   247 +-
 dolfin/plot/VTKPlotter.h                           |    85 +-
 dolfin/plot/VTKWindowOutputStage.cpp               |   130 +-
 dolfin/plot/VTKWindowOutputStage.h                 |    24 +-
 dolfin/plot/plot.cpp                               |    35 +-
 dolfin/plot/plot.h                                 |    24 +-
 dolfin/refinement/BisectionRefinement1D.cpp        |    98 +-
 dolfin/refinement/BisectionRefinement1D.h          |     8 +-
 dolfin/refinement/LocalMeshCoarsening.cpp          |    16 +-
 dolfin/refinement/LocalMeshRefinement.cpp          |    75 -
 dolfin/refinement/LocalMeshRefinement.h            |    49 -
 dolfin/refinement/ParallelRefinement.cpp           |    45 +-
 dolfin/refinement/ParallelRefinement.h             |     2 +-
 dolfin/refinement/PlazaRefinementND.cpp            |   176 +-
 dolfin/refinement/PlazaRefinementND.h              |    27 +-
 dolfin/refinement/RegularCutRefinement.cpp         |    41 +-
 dolfin/refinement/RegularCutRefinement.h           |     3 +-
 dolfin/refinement/UniformMeshRefinement.cpp        |   109 -
 dolfin/refinement/refine.cpp                       |   103 +-
 dolfin/refinement/refine.h                         |    18 +
 dolfin/swig/CMakeLists.txt                         |    16 +-
 dolfin/swig/adaptivity/docstrings.i                |    67 +-
 dolfin/swig/adaptivity/post.i                      |     1 -
 dolfin/swig/adaptivity/pre.i                       |    20 +-
 dolfin/swig/ale/docstrings.i                       |    47 +-
 dolfin/swig/common/docstrings.i                    |    51 +-
 dolfin/swig/common/post.i                          |    46 +
 dolfin/swig/common/pre.i                           |   100 +-
 dolfin/swig/fem/docstrings.i                       |   721 +-
 dolfin/swig/fem/post.i                             |    40 +-
 dolfin/swig/fem/pre.i                              |    80 +-
 dolfin/swig/forwarddeclarations.i                  |    14 +
 dolfin/swig/function/docstrings.i                  |   211 +-
 dolfin/swig/function/post.i                        |    23 +-
 dolfin/swig/function/pre.i                         |    12 +-
 dolfin/swig/generation/docstrings.i                |    11 +
 dolfin/swig/geometry/docstrings.i                  |    27 +
 dolfin/swig/globalincludes.i                       |    10 +-
 dolfin/swig/graph/docstrings.i                     |     7 +-
 .../swig/graph/pre.i                               |    33 +-
 dolfin/swig/io/docstrings.i                        |   337 +-
 dolfin/swig/io/post.i                              |    24 +
 dolfin/swig/io/pre.i                               |     2 +
 dolfin/swig/la/docstrings.i                        |   803 +-
 dolfin/swig/la/post.i                              |    25 +
 dolfin/swig/la/pre.i                               |    12 +-
 dolfin/swig/log/docstrings.i                       |     5 +-
 dolfin/swig/math/docstrings.i                      |     3 +-
 dolfin/swig/mesh/docstrings.i                      |   493 +-
 dolfin/swig/mesh/post.i                            |    80 +-
 dolfin/swig/mesh/pre.i                             |    50 +-
 dolfin/swig/modules/common/dependencies.txt        |     2 +-
 dolfin/swig/modules/fem/dependencies.txt           |     2 +-
 dolfin/swig/modules/fem/module.i                   |    16 +-
 dolfin/swig/modules/function/dependencies.txt      |     2 +-
 dolfin/swig/modules/function/module.i              |    11 -
 dolfin/swig/modules/io/dependencies.txt            |     2 +-
 dolfin/swig/modules/io/module.i                    |     8 +
 dolfin/swig/modules/la/dependencies.txt            |     2 +-
 dolfin/swig/modules/la/module.i                    |    22 +-
 dolfin/swig/modules/mesh/dependencies.txt          |     2 +-
 dolfin/swig/modules/mesh/module.i                  |    18 +-
 dolfin/swig/multistage/docstrings.i                |    11 +-
 dolfin/swig/nls/docstrings.i                       |    69 +-
 dolfin/swig/parameter/post.i                       |    47 +-
 dolfin/swig/plot/docstrings.i                      |    41 +-
 dolfin/swig/plot/pre.i                             |    10 +-
 dolfin/swig/refinement/docstrings.i                |    25 +
 dolfin/swig/shared_ptr_classes.i                   |    22 +-
 dolfin/swig/typemaps/array.i                       |     1 +
 dolfin/swig/typemaps/includes.i                    |     1 +
 dolfin/swig/typemaps/std_array.i                   |   109 +
 dolfin/swig/typemaps/std_map.i                     |     3 +
 dolfin/swig/typemaps/std_pair.i                    |    55 +-
 dolfin/swig/typemaps/std_vector.i                  |    16 +-
 site-packages/dolfin/__init__.py                   |     1 +
 site-packages/dolfin/common/__init__.py            |     1 +
 site-packages/dolfin/common/constants.py           |     1 +
 site-packages/dolfin/common/globalparameters.py.in |    44 +-
 site-packages/dolfin/common/math.py                |     1 +
 site-packages/dolfin/common/memory.py              |     1 +
 site-packages/dolfin/common/plotting.py            |   438 +-
 site-packages/dolfin/common/time.py                |     1 +
 site-packages/dolfin/compilemodules/__init__.py    |     1 +
 .../dolfin/compilemodules/compilemodule.py         |    29 +-
 site-packages/dolfin/compilemodules/expressions.py |     3 +-
 site-packages/dolfin/compilemodules/jit.py         |    95 +-
 site-packages/dolfin/compilemodules/subdomains.py  |    33 +-
 .../dolfin/compilemodules/swigimportinfo.py        |    68 +-
 site-packages/dolfin/cpp/__init__.py               |     2 +
 site-packages/dolfin/deprecation.py                |     1 +
 site-packages/dolfin/fem/__init__.py               |     3 +
 site-packages/dolfin/fem/adaptivesolving.py        |    17 +-
 site-packages/dolfin/fem/assembling.py             |   172 +-
 site-packages/dolfin/fem/assembling_local.py       |    76 +
 site-packages/dolfin/fem/bcs.py                    |    66 +-
 site-packages/dolfin/fem/errorcontrolgenerator.py  |     2 +
 site-packages/dolfin/fem/form.py                   |    87 +-
 site-packages/dolfin/fem/formmanipulations.py      |    94 +-
 site-packages/dolfin/fem/interpolation.py          |    16 +-
 site-packages/dolfin/fem/norms.py                  |    32 +-
 site-packages/dolfin/fem/projection.py             |    51 +-
 site-packages/dolfin/fem/solving.py                |    79 +-
 site-packages/dolfin/functions/__init__.py         |     1 +
 site-packages/dolfin/functions/constant.py         |    36 +-
 site-packages/dolfin/functions/expression.py       |   365 +-
 site-packages/dolfin/functions/function.py         |   140 +-
 site-packages/dolfin/functions/functionspace.py    |   874 +-
 site-packages/dolfin/functions/specialfunctions.py |    46 +-
 .../dolfin/functions/ufc_functionspace.py          |    32 -
 site-packages/dolfin/importhandler/__init__.py     |     1 +
 site-packages/dolfin/mesh/__init__.py              |     1 +
 site-packages/dolfin/mesh/ale.py                   |    25 +-
 .../dolfin/mesh/boundarysubdomainfinder.py         |     1 +
 site-packages/dolfin/mesh/meshes.py                |    10 +-
 site-packages/dolfin/mesh/refinement.py            |     1 +
 site-packages/dolfin/mesh/svgtools.py              |     5 +-
 site-packages/dolfin/multistage/__init__.py        |     1 +
 site-packages/dolfin/multistage/factorize.py       |    27 +-
 .../dolfin/multistage/multistagescheme.py          |    56 +-
 .../dolfin/multistage/multistagesolvers.py         |     1 +
 .../dolfin/multistage/rushlarsenschemes.py         |     1 +
 site-packages/dolfin_utils/commands.py             |     1 +
 .../dolfin_utils/cppparser/CppHeaderParser.py      |   305 +-
 site-packages/dolfin_utils/cppparser/__init__.py   |     1 +
 site-packages/dolfin_utils/cppparser/utils.py      |     1 +
 .../dolfin_utils/documentation/__init__.py         |     1 +
 .../dolfin_utils/documentation/docstringutils.py   |     1 +
 .../documentation/extractdocumentation.py          |     1 +
 .../dolfin_utils/documentation/generatecpprst.py   |     1 +
 .../documentation/generatepythonrst.py             |     1 +
 .../dolfin_utils/documentation/indextemplates.py   |     1 +
 site-packages/dolfin_utils/meshconvert/abaqus.py   |     1 +
 .../dolfin_utils/meshconvert/meshconvert.py        |    48 +-
 .../dolfin_utils/meshconvert/xml_writer.py         |     1 +
 site-packages/dolfin_utils/ordereddict.py          |     1 +
 site-packages/dolfin_utils/pjobs/__init__.py       |     1 +
 site-packages/dolfin_utils/pjobs/pjobs.py          |     3 +-
 site-packages/dolfin_utils/pjobs/sge.py            |     1 +
 site-packages/dolfin_utils/pjobs/slurm.py          |     1 +
 site-packages/dolfin_utils/pjobs/torque.py         |     3 +-
 site-packages/dolfin_utils/test/__init__.py        |     1 +
 site-packages/dolfin_utils/test/fixtures.py        |    15 +-
 site-packages/dolfin_utils/test/paths.py           |     3 +-
 site-packages/dolfin_utils/test/skips.py           |     3 +-
 site-packages/dolfin_utils/test/tests.py           |     3 +-
 site-packages/fenics/__init__.py                   |     1 +
 test/CMakeLists.txt                                |    58 -
 ...est_coding_style.py => test_coding_style.py.in} |    45 +-
 test/documentation/verify_demo_code_snippets.py    |     5 +
 test/regression/test.py                            |    83 +-
 test/unit/CMakeLists.txt                           |    37 +
 test/unit/common/cpp/CMakeLists.txt                |    46 -
 test/unit/common/cpp/test_cpp_common.py            |     3 -
 test/unit/cpp/CMakeLists.txt                       |    90 +
 .../cpp => cpp/common}/SubSystemsManager.cpp       |    42 +-
 test/unit/cpp/function/Expression.cpp              |    92 +
 .../unit/cpp/function/Projection.h                 |  8432 +++--
 .../{function/cpp => cpp/function}/Projection.ufl  |     0
 test/unit/cpp/function/compile.log                 |   260 +
 test/unit/cpp/io/XMLMeshData.cpp                   |    75 +
 test/unit/cpp/io/XMLMeshValueCollection.cpp        |    53 +
 .../cpp => cpp/io}/xml_value_collection_ref.xml    |     0
 test/unit/cpp/la/LinearOperator.cpp                |   126 +
 test/unit/cpp/la/Vector.cpp                        |   182 +
 .../unit/cpp/la/forms/ReactionDiffusion.h          |  2096 +-
 .../{la/cpp => cpp/la}/forms/ReactionDiffusion.ufl |     0
 .../unit/cpp/la/forms/ReactionDiffusionAction.h    |  1990 +-
 .../la}/forms/ReactionDiffusionAction.ufl          |     0
 test/unit/{la/cpp => cpp/la}/forms/compile.log     |   233 +-
 test/unit/cpp/mesh/Mesh.cpp                        |   240 +
 test/unit/cpp/mesh/MeshFunction.cpp                |    85 +
 test/unit/cpp/mesh/MeshValueCollection.cpp         |   174 +
 test/unit/cpp/multimesh/MultiMesh.cpp              |   307 +
 .../cpp => cpp/parameter}/Parameters.cpp           |    68 +-
 .../cpp/test_cpp_io.py => cpp/test_cpp_unit.py}    |     2 +-
 test/unit/function/cpp/CMakeLists.txt              |    46 -
 test/unit/function/cpp/Expression.cpp              |   108 -
 test/unit/function/cpp/Projection.h                |  4488 ---
 test/unit/function/cpp/compile.log                 |   236 -
 test/unit/function/cpp/test_cpp_function.py        |     3 -
 test/unit/io/cpp/CMakeLists.txt                    |    48 -
 test/unit/io/cpp/XMLMeshData.cpp                   |    85 -
 test/unit/io/cpp/XMLMeshValueCollection.cpp        |    65 -
 test/unit/la/cpp/CMakeLists.txt                    |    48 -
 test/unit/la/cpp/LinearOperator.cpp                |   135 -
 test/unit/la/cpp/Vector.cpp                        |   199 -
 test/unit/la/cpp/forms/ReactionDiffusion.h         |  2127 --
 test/unit/la/cpp/forms/ReactionDiffusionAction.h   |  1689 -
 test/unit/la/cpp/test_cpp_la.py                    |     3 -
 test/unit/mesh/cpp/CMakeLists.txt                  |    50 -
 test/unit/mesh/cpp/Mesh.cpp                        |   322 -
 test/unit/mesh/cpp/MeshFunction.cpp                |    97 -
 test/unit/mesh/cpp/MeshValueCollection.cpp         |   187 -
 test/unit/mesh/cpp/test_cpp_mesh.py                |     3 -
 test/unit/multimesh/cpp/CMakeLists.txt             |    46 -
 test/unit/multimesh/cpp/MultiMesh.cpp              |   442 -
 test/unit/multimesh/cpp/MultiMeshStokes2D.h        | 20923 -----------
 test/unit/multimesh/cpp/MultiMeshStokes2D.ufl      |   104 -
 test/unit/multimesh/cpp/compile.log                |  1402 -
 test/unit/multimesh/cpp/test_cpp_multimesh.py      |     3 -
 test/unit/parameter/cpp/CMakeLists.txt             |    46 -
 test/unit/parameter/cpp/test_cpp_parameter.py      |     3 -
 test/unit/python/adaptivity/test_error_control.py  |    12 +-
 test/unit/python/adaptivity/test_time_series.py    |     4 +-
 test/unit/python/ale/test_harmonic_smoothing.py    |    14 +-
 test/unit/python/book/README                       |     8 +-
 .../stationary/nonlinear_poisson/alg_newton_np.py  |     2 +-
 .../stationary/nonlinear_poisson/pde_newton_np.py  |     2 +-
 .../stationary/nonlinear_poisson/picard_np.py      |     2 +-
 .../stationary/nonlinear_poisson/vp1_np.py         |     6 +-
 .../stationary/nonlinear_poisson/vp2_np.py         |     5 +-
 .../chapter_1_files/stationary/poisson/d1_p2D.py   |     2 +-
 .../chapter_1_files/stationary/poisson/d2_p2D.py   |     2 +-
 .../chapter_1_files/stationary/poisson/d3_p2D.py   |     2 +-
 .../chapter_1_files/stationary/poisson/d4_p2D.py   |     2 +-
 .../chapter_1_files/stationary/poisson/d5_p2D.py   |     2 +-
 .../chapter_1_files/stationary/poisson/d6_p2D.py   |     6 +-
 .../chapter_1_files/stationary/poisson/dn1_p2D.py  |     4 +-
 .../chapter_1_files/stationary/poisson/dn2_p2D.py  |     8 +-
 .../chapter_1_files/stationary/poisson/dn3_p2D.py  |     8 +-
 .../chapter_1_files/stationary/poisson/dn4_p2D.py  |     8 +-
 .../chapter_1_files/stationary/poisson/dnr_p2D.py  |    10 +-
 .../chapter_1_files/stationary/poisson/mat2_p2D.py |     2 +-
 .../stationary/poisson/membrane1.py                |     4 +-
 .../stationary/poisson/membrane1v.py               |     2 +-
 .../book/chapter_1_files/stationary/poisson/paD.py |     2 +-
 .../chapter_1_files/stationary/poisson/vcp2D.py    |     6 +-
 .../chapter_1_files/transient/diffusion/d1_d2D.py  |     2 +-
 .../chapter_1_files/transient/diffusion/d2_d2D.py  |     4 +-
 .../chapter_1_files/transient/diffusion/sin_daD.py |    13 +-
 test/unit/python/book/test_chapter_10.py           |    62 +-
 test/unit/python/fem/test_assembler.py             |   177 +-
 test/unit/python/fem/test_dirichlet_bc.py          |     8 +-
 test/unit/python/fem/test_discrete_operators.py    |    64 +
 test/unit/python/fem/test_dofmap.py                |   212 +-
 test/unit/python/fem/test_dp_assemble.py           |    41 +-
 test/unit/python/fem/test_finite_element.py        |    53 +-
 test/unit/python/fem/test_form.py                  |   166 +-
 .../fem/test_interior_facet_integral_sides.py      |     6 +-
 test/unit/python/fem/test_local_assembler.py       |   159 +
 test/unit/python/fem/test_local_solver.py          |    63 +-
 test/unit/python/fem/test_manifolds.py             |    56 +-
 .../python/fem/test_symbolic_geometry_assembly.py  |   873 +
 test/unit/python/fem/test_system_assembler.py      |    75 +-
 test/unit/python/fem/test_variational_problem.py   |    73 +
 test/unit/python/function/test_constant.py         |    57 +-
 .../function/test_constrained_function_space.py    |    39 +-
 test/unit/python/function/test_expression.py       |   278 +-
 test/unit/python/function/test_function.py         |   213 +-
 .../unit/python/function/test_function_assigner.py |    23 +-
 test/unit/python/function/test_function_space.py   |    30 +-
 .../python/function/test_lagrange_interpolator.py  |     9 +-
 .../function/test_nonmatching_interpolation.py     |     7 +-
 .../unit/python/geometry/test_bounding_box_tree.py |    33 +-
 test/unit/python/geometry/test_coordinates.py      |   125 +
 test/unit/python/geometry/test_issues.py           |     2 +-
 test/unit/python/io/test_HDF5.py                   |     2 +-
 test/unit/python/io/test_HDF5_series.py            |     3 +-
 test/unit/python/io/test_SVG.py                    |     9 +
 test/unit/python/io/test_X3D.py                    |    58 +
 test/unit/python/io/test_XDMF.py                   |   346 +-
 test/unit/python/io/test_XDMF_cell_output.py       |     6 +-
 test/unit/python/io/test_XMLFunction.py            |     2 +-
 test/unit/python/jit/test_jit.py                   |    25 +-
 test/unit/python/la/test_krylov_solver.py          |   125 +-
 test/unit/python/la/test_la_basic.py               |    12 +-
 test/unit/python/la/test_linear_operator.py        |     1 +
 test/unit/python/la/test_matrix.py                 |    38 +-
 test/unit/python/la/test_nullspace.py              |    61 +-
 test/unit/python/la/test_petsc.py                  |    83 +-
 test/unit/python/la/test_scalar.py                 |     2 +
 test/unit/python/la/test_tensor_layout.py          |   114 +
 test/unit/python/la/test_vector.py                 |    11 +-
 test/unit/python/math/test_math.py                 |    18 +
 test/unit/python/mesh/test_boundary_mesh.py        |     4 +-
 test/unit/python/mesh/test_cell.py                 |     6 +-
 test/unit/python/mesh/test_edge.py                 |     4 +
 test/unit/python/mesh/test_face.py                 |     2 +
 test/unit/python/mesh/test_ghost_mesh.py           |   100 +
 .../unit/python/mesh/test_manifold_point_search.py |    13 +-
 test/unit/python/mesh/test_mesh.py                 |    98 +-
 test/unit/python/mesh/test_mesh_coloring.py        |     3 +-
 test/unit/python/mesh/test_mesh_data.py            |     6 +-
 test/unit/python/mesh/test_mesh_editor.py          |     3 +-
 test/unit/python/mesh/test_mesh_function.py        |    28 +-
 test/unit/python/mesh/test_mesh_markers.py         |     4 +
 test/unit/python/mesh/test_mesh_quality.py         |    19 +-
 test/unit/python/mesh/test_mesh_transformation.py  |    26 +-
 .../unit/python/mesh/test_mesh_value_collection.py |    19 +-
 .../python/mesh/test_multi_mesh_integration.py     |    27 +-
 .../mesh/test_periodic_boundary_computation.py     |     6 +-
 test/unit/python/mesh/test_sub_domain.py           |    53 +-
 test/unit/python/mesh/test_sub_mesh.py             |    30 +-
 .../unit/python/meshconvert/test_mesh_converter.py |    20 +-
 .../xml/convertall => test/unit/python/mpipipe.sh  |    40 +-
 test/unit/python/multistage/test_RK_solver.py      |     4 +-
 .../multistage/test_point_integral_solver.py       |    16 +-
 test/unit/python/nls/test_PETScSNES_solver.py      |    14 +-
 test/unit/python/nls/test_PETScTAOSolver.py        |     2 +-
 .../python/nls/test_TAO_linear_bound_solver.py     |     2 +-
 .../test_solve_result_against_reference.py         |     7 +
 test/unit/python/parameter/test_parameters.py      |     9 +-
 utils/gid/DOLFIN.bas                               |    17 -
 utils/matlab/meshindex.m                           |    54 -
 utils/matlab/plotcontroller.m                      |    35 -
 utils/matlab/plotslab.m                            |   173 -
 utils/matlab/xmlmatrix.m                           |    72 -
 utils/matlab/xmlmesh.m                             |    97 -
 utils/matlab/xmlvector.m                           |    58 -
 utils/octave/README                                |    28 -
 utils/octave/pdemesh.m                             |    29 -
 utils/octave/pdeplot.m                             |   230 -
 utils/octave/pdesurf.m                             |    26 -
 utils/python/README                                |     2 -
 utils/python/extract2d                             |    88 -
 utils/swig/dolfin-swig                             |   156 -
 utils/system/monitor                               |    42 -
 utils/tetgen/dolfin-tetgen                         |    36 -
 utils/vim/macros                                   |     6 -
 1121 files changed, 346197 insertions(+), 240850 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5851e86
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,137 @@
+# Compiled source
+*.o
+*.Plo
+*.Po
+*.lo
+*.la
+*.a
+*.os
+*.pyc
+*.so
+*.pc
+*.pyd
+*.def
+*.dll
+*.exe
+*.dylib
+dolfin/libdolfin.so*
+
+# FFC generated code in library
+dolfin/ale/Poisson*D.h
+
+# FFC generated code in benchmarks
+bench/fem/convergence/cpp/Poisson2D_1.cpp
+bench/fem/convergence/cpp/Poisson2D_2.cpp
+bench/fem/convergence/cpp/Poisson2D_3.cpp
+bench/fem/convergence/cpp/Poisson2D_4.cpp
+bench/fem/convergence/cpp/Poisson2D_5.cpp
+bench/fem/convergence/cpp/Poisson3D_1.cpp
+bench/fem/convergence/cpp/Poisson3D_2.cpp
+bench/fem/convergence/cpp/Poisson3D_3.cpp
+bench/fem/convergence/cpp/Poisson3D_4.cpp
+
+# Log files
+*.log
+
+# Install directory
+/local
+/local.*
+
+# SWIG generated files
+dolfin/swig/**/**/*.py
+dolfin/swig/**/**/*.h
+dolfin/swig/**/**/*.cc
+dolfin/swig/**/**/*.cxx
+dolfin/swig/**/**/module.i
+dolfin/swig/**/**/dependencies.txt
+swigimportinfo.py
+
+# Documentation
+docstrings.i
+
+# Configuration files
+dolfin.conf
+dolfin-version
+dolfin-config.cmake
+DOLFINConfig.cmake
+DOLFINConfigVersion.cmake
+UseDOLFIN.cmake
+dolfin-config-version.cmake
+
+# Demos and tests
+build_demo.*
+test_*_tempdir
+test/unit/mesh/{cpp,python}/*.{xml,m}
+test/unit/parameter/{cpp,python}/*.{xml,xml.gz}
+bench/**/**/cpp/forms/*.h
+bench/**/**/cpp/*.h
+test/unit/**/python/*.xml
+test/unit/**/cpp/*.xml
+test/unit/cpp/function/Projection.h
+test/unit/cpp/la/forms/ReactionDiffusion.h
+test/unit/cpp/la/forms/ReactionDiffusionAction.h
+test/unit/cpp/multimesh/MultiMeshStokes2D.h
+test/**/.cache/
+
+# FFC generated demo files
+demo/**/**/cpp/*.h
+demo/documented/cahn-hilliard/cpp/CahnHilliard2D.cpp
+demo/documented/cahn-hilliard/cpp/CahnHilliard3D.cpp
+
+
+# QT generated code
+moc_*
+
+# Temporaries
+*~
+
+# Compressed files
+*.xz
+*.gz
+*.zs-old
+
+# Data files
+*.pvd
+*.pvtu
+*.vtu
+*.h5
+*.xdmf
+*.bin
+
+# CMake and Make file
+CMakeLists.txt
+!/CMakeLists.txt
+!dolfin/CMakeLists.txt
+!bench/CMakeLists.txt
+!dolfin/swig/CMakeLists.txt
+!doc/CMakeLists.txt
+!demo/CMakeLists.txt
+!test/unit/CMakeLists.txt
+!test/unit/cpp/CMakeLists.txt
+
+
+CMakeCache.txt
+CMakeFiles
+cmake_install.cmake
+cmake_uninstall.cmake
+Makefile
+install_manifest.txt
+
+# Local build files
+/build
+/build.*/
+
+# OS X files
+.DS_Store
+.DS_Store?
+
+# Eclipse files
+.*project
+.settings
+
+cmake.local
+
+# Google Test Files
+/GoogleTest/
+
+build/
\ No newline at end of file
diff --git a/AUTHORS b/AUTHORS
index f023ee5..582d769 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -76,4 +76,4 @@ Authors/contributors in alphabetical order:
 (-) = minor change, copyright form not signed
 
 Missing credits? Tell us and we will fix it.
-Send an email to fenics at fenicsproject.org
+Send an email to fenics-dev at googlegroups.com
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f14a3bb..7126f4b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,12 +8,12 @@ cmake_minimum_required(VERSION 2.8)
 
 project(DOLFIN)
 set(DOLFIN_VERSION_RELEASE 1)
-set(DOLFIN_VERSION_MAJOR "1")
-set(DOLFIN_VERSION_MINOR "6")
+set(DOLFIN_VERSION_MAJOR "2016")
+set(DOLFIN_VERSION_MINOR "1")
 set(DOLFIN_VERSION_MICRO "0")
 set(DOLFIN_VERSION "${DOLFIN_VERSION_MAJOR}.${DOLFIN_VERSION_MINOR}.${DOLFIN_VERSION_MICRO}")
 if (NOT DOLFIN_VERSION_RELEASE)
-  set(DOLFIN_VERSION "${DOLFIN_VERSION}dev")
+  set(DOLFIN_VERSION "${DOLFIN_VERSION}.dev0")
 endif()
 
 #------------------------------------------------------------------------------
@@ -53,7 +53,7 @@ endif()
 # Set CMake options, see `cmake --help-policy CMP000x`
 if (COMMAND cmake_policy)
   cmake_policy(SET CMP0003 NEW)
-  cmake_policy(SET CMP0004 OLD)
+  cmake_policy(SET CMP0004 NEW)
   if(POLICY CMP0042)
     cmake_policy(SET CMP0042 NEW)
   endif()
@@ -69,21 +69,51 @@ set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_CURRENT_BINARY_DIR}/dolfin)
 #------------------------------------------------------------------------------
 # Configurable options for how we want to build
 
+include(FeatureSummary)
+
 option(BUILD_SHARED_LIBS "Build DOLFIN with shared libraries." ON)
-option(CMAKE_SKIP_RPATH "Do not add runtime paths when using shared libraries." OFF)
-option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Add paths to linker search and installed rpath." ON)
 option(CMAKE_USE_RELATIVE_PATHS "Use relative paths in makefiles and projects." OFF)
-option(DOLFIN_AUTO_DETECT_MPI "Detect MPI automatically - turn this off to use the MPI compiler wrappers directly via setting CXX, CXX, FC." ON)
+option(DOLFIN_AUTO_DETECT_MPI "Detect MPI automatically (turn this off to use the MPI compiler wrappers directly via setting CXX, CXX, FC)." ON)
 option(DOLFIN_ENABLE_CODE_COVERAGE "Enable code coverage." OFF)
 option(DOLFIN_WITH_LIBRARY_VERSION "Build with library version information." ON)
-option(DOLFIN_ENABLE_UNIT_TESTS "Enable unit tests." ON)
 option(DOLFIN_ENABLE_TESTING "Enable testing." OFF)
+option(DOLFIN_ENABLE_GTEST "Enable C++ unit tests with Google Test if DOLFIN_ENABLE_TESTING is true (requires Internet connection to download Google Test when first configured)." ON)
 option(DOLFIN_ENABLE_BENCHMARKS "Enable benchmark programs." OFF)
 option(DOLFIN_ENABLE_DOCS "Enable generation of documentation." ON)
-option(DOLFIN_SKIP_BUILD_TESTS "Skip build tests." OFF)
+option(DOLFIN_SKIP_BUILD_TESTS "Skip build tests for testing usability of dependency packages." OFF)
 option(DOLFIN_DEPRECATION_ERROR "Turn deprecation warnings into errors." OFF)
 option(DOLFIN_IGNORE_PETSC4PY_VERSION "Ignore version of PETSc4py." OFF)
 
+add_feature_info(BUILD_SHARED_LIBS BUILD_SHARED_LIBS "Build DOLFIN with shared libraries.")
+add_feature_info(CMAKE_USE_RELATIVE_PATHS CMAKE_USE_RELATIVE_PATHS "Use relative paths in makefiles and projects.")
+add_feature_info(DOLFIN_AUTO_DETECT_MPI DOLFIN_AUTO_DETECT_MPI "Detect MPI automatically (turn this off to use the MPI compiler wrappers directly via setting CXX, CXX, FC).")
+add_feature_info(DOLFIN_ENABLE_CODE_COVERAGE DOLFIN_ENABLE_CODE_COVERAGE "Enable code coverage.")
+add_feature_info(DOLFIN_WITH_LIBRARY_VERSION DOLFIN_WITH_LIBRARY_VERSION "Build with library version information.")
+add_feature_info(DOLFIN_ENABLE_TESTING DOLFIN_ENABLE_TESTING "Enable testing.")
+add_feature_info(DOLFIN_ENABLE_GTEST DOLFIN_ENABLE_GTEST "Enable C++ unit tests with Google Test if DOLFIN_ENABLE_TESTING is true (requires Internet connection to download Google Test when first configured).")
+add_feature_info(DOLFIN_ENABLE_BENCHMARKS DOLFIN_ENABLE_BENCHMARKS "Enable benchmark programs.")
+add_feature_info(DOLFIN_ENABLE_DOCS DOLFIN_ENABLE_DOCS "Enable generation of documentation.")
+add_feature_info(DOLFIN_SKIP_BUILD_TESTS DOLFIN_SKIP_BUILD_TESTS "Skip build tests for testing usability of dependency packages.")
+add_feature_info(DOLFIN_DEPRECATION_ERROR DOLFIN_DEPRECATION_ERROR "Turn deprecation warnings into errors.")
+add_feature_info(DOLFIN_IGNORE_PETSC4PY_VERSION DOLFIN_IGNORE_PETSC4PY_VERSION "Ignore version of PETSc4py.")
+
+# Add shared library paths so shared libs in non-system paths are found
+option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Add paths to linker search and installed rpath." ON)
+add_feature_info(CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INSTALL_RPATH_USE_LINK_PATH "Add paths to linker search and installed rpath.")
+
+# Hande RPATH on OSX when not installing to a system directory, see
+# https://groups.google.com/d/msg/fenics-dev/KSCrob4M_1M/zsJwdN-SCAAJ
+# and https://cmake.org/Wiki/CMake_RPATH_handling#Always_full_RPATH.
+if (APPLE)
+  # The RPATH to be used when installing, but only if it's not a
+  # system directory
+  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+  LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+  IF("${isSystemDir}" STREQUAL "-1")
+     SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+  ENDIF("${isSystemDir}" STREQUAL "-1")
+endif()
+
 #------------------------------------------------------------------------------
 # This should be removed when Clang support OpenMP is ready
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -106,7 +136,6 @@ list(APPEND OPTIONAL_PACKAGES "SLEPc4py")
 list(APPEND OPTIONAL_PACKAGES "Trilinos")
 list(APPEND OPTIONAL_PACKAGES "UMFPACK")
 list(APPEND OPTIONAL_PACKAGES "CHOLMOD")
-list(APPEND OPTIONAL_PACKAGES "PaStiX")
 list(APPEND OPTIONAL_PACKAGES "SCOTCH")
 list(APPEND OPTIONAL_PACKAGES "ParMETIS")
 list(APPEND OPTIONAL_PACKAGES "zlib")
@@ -114,12 +143,12 @@ list(APPEND OPTIONAL_PACKAGES "Python")
 list(APPEND OPTIONAL_PACKAGES "Sphinx")
 list(APPEND OPTIONAL_PACKAGES "HDF5")
 list(APPEND OPTIONAL_PACKAGES "VTK")
-list(APPEND OPTIONAL_PACKAGES "QT")
 
 # Add options
 foreach (OPTIONAL_PACKAGE ${OPTIONAL_PACKAGES})
   string(TOUPPER "DOLFIN_ENABLE_${OPTIONAL_PACKAGE}" OPTION_NAME)
   option(${OPTION_NAME} "Compile with support for ${OPTIONAL_PACKAGE}." ON)
+  add_feature_info(${OPTION_NAME} ${OPTION_NAME} "Compile with support for ${OPTIONAL_PACKAGE}.")
 endforeach()
 
 #------------------------------------------------------------------------------
@@ -157,7 +186,8 @@ if (HAVE_PEDANTIC)
 endif()
 
 # Workaround https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/1352356
-# NOTE: Remove this block when bug is fixed upstream or GCC 4.6 support is dropped
+# NOTE: Remove this block when bug is fixed upstream or GCC 4.6
+# support is dropped
 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
   if (NOT DEFINED CMAKE_CXX_COMPILER_VERSION)
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
@@ -280,6 +310,9 @@ endif()
 if (DOLFIN_ENABLE_MPI)
   if (DOLFIN_AUTO_DETECT_MPI)
     find_package(MPI)
+    set_package_properties(MPI PROPERTIES TYPE OPTIONAL
+      DESCRIPTION "Message Passing Interface (MPI)"
+      PURPOSE "Enables DOLFIN to run in parallel with MPI")
     if (MPI_CXX_FOUND)
       set(MPI_FOUND TRUE)
     endif()
@@ -295,6 +328,9 @@ endif()
 # Test for OpenMP (but not for Clang, which does not support OpenMP)
 if (DOLFIN_ENABLE_OPENMP)
   find_package(OpenMP)
+  set_package_properties(OpenMP PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "Open Multi-Processing API"
+    PURPOSE "Enables DOLFIN to run in parallel with OpenMP")
   include(CheckOpenMP)
   check_openmp_unsigned_int_loop_control_variable(OPENMP_UINT_TEST_RUNS)
   if (NOT OPENMP_UINT_TEST_RUNS)
@@ -320,22 +356,17 @@ set(Boost_ADDITIONAL_VERSIONS 1.48 1.48.0 1.49 1.49.0 1.50 1.50.0)
 
 find_package(Boost 1.48 QUIET REQUIRED)
 
-set(DOLFIN_BOOST_COMPONENTS filesystem program_options system thread iostreams
-    timer)
+set(DOLFIN_BOOST_COMPONENTS filesystem program_options system iostreams timer)
 find_package(Boost COMPONENTS ${DOLFIN_BOOST_COMPONENTS} REQUIRED)
-
-# Check for required package UFC
-find_package(UFC 1.6.0 QUIET HINTS ${UFC_DIR})
-if (NOT UFC_FOUND)
-  message(FATAL_ERROR "Could not find a configuration file for package UFC that is "
-    "compatible with requested version 1.6.0.\n"
-    "Set UFC_DIR to the directory containing a CMake configuration file for UFC.")
-else()
-  message(STATUS "UFC version: ${UFC_VERSION_STRING}")
-endif()
+set_package_properties(Boost PROPERTIES TYPE REQUIRED
+  DESCRIPTION "Boost C++ libraries"
+  URL "http://www.boost.org")
 
 # Check for required package Eigen3
 find_package(Eigen3 3.2.0 REQUIRED)
+set_package_properties(Eigen3 PROPERTIES TYPE REQUIRED
+  DESCRIPTION "Lightweight C++ template library for linear algebra"
+  URL "http://eigen.tuxfamily.org")
 
 #------------------------------------------------------------------------------
 # Run tests to find optional packages
@@ -345,7 +376,12 @@ find_package(Eigen3 3.2.0 REQUIRED)
 #       dolfin_utils
 # FIXME PY3: Select python 3 based on config flag?
 find_package(PythonInterp 2)
+set_package_properties(PythonInterp PROPERTIES TYPE REQUIRED
+  DESCRIPTION "Interactive high-level object-oriented language"
+  URL "http://www.python.org")
+
 if (DOLFIN_ENABLE_PYTHON)
+  set_package_properties(PythonInterp PROPERTIES PURPOSE "Needed for the Python interface to DOLFIN")
 
   # Set variables to help find Python library that is compatible with
   # interpreter
@@ -375,7 +411,9 @@ if (DOLFIN_ENABLE_PYTHON)
     endif()
 
     # Find Pythons libs
-    find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT QUIET REQUIRED)
+    find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT REQUIRED)
+    set_package_properties(PythonLibs PROPERTIES TYPE REQUIRED
+      DESCRIPTION "Include paths and libraries for Python")
     set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH_SAVE})
   endif()
 
@@ -384,10 +422,18 @@ if (DOLFIN_ENABLE_PYTHON)
 
     # Check for NumPy
     find_package(NumPy REQUIRED)
+    set_package_properties(NumPy PROPERTIES TYPE REQUIRED
+      DESCRIPTION "Array processing for numbers, strings, records, and objects in Python."
+      URL "http://www.numpy.org"
+      PURPOSE "Needed for the Python interface to DOLFIN")
 
     # Check for ply
     include(FindPythonModule)
     find_python_module(ply REQUIRED)
+    set_package_properties(ply PROPERTIES TYPE REQUIRED
+      DESCRIPTION "Python Lex & Yacc"
+      URL "http://www.dabeaz.com/ply/"
+      PURPOSE "Needed for the Python interface to DOLFIN")
     if (NOT PY_PLY_FOUND)
       message(FATAL_ERROR "Required Python module 'ply' (http://www.dabeaz.com/ply/) could not be found. Install ply or set DOLFIN_ENABLE_PYTHON to false.")
     endif()
@@ -397,7 +443,11 @@ if (DOLFIN_ENABLE_PYTHON)
       set(SWIG_EXECUTABLE ${UFC_SWIG_EXECUTABLE})
     endif()
     find_package(SWIG REQUIRED)
-    set(REQUIRED_SWIG_VERSION "3.0.3")
+    set_package_properties(SWIG PROPERTIES TYPE REQUIRED
+      DESCRIPTION "Tool to wrap C/C++ libraries in high-level languages"
+      URL "http://swig.org"
+      PURPOSE "Needed for the Python interface to DOLFIN")
+    set(REQUIRED_SWIG_VERSION "3.0.5")
     if ("${SWIG_VERSION}" VERSION_LESS "${REQUIRED_SWIG_VERSION}")
       message(FATAL_ERROR " DOLFIN requires SWIG version ${REQUIRED_SWIG_VERSION} or greater. You have version ${SWIG_VERSION}. Set DOLFIN_ENABLE_PYTHON to false or install correct SWIG version.")
     endif()
@@ -407,12 +457,25 @@ if (DOLFIN_ENABLE_PYTHON)
 
 endif()
 
+# Check for required package UFC
+find_package(UFC MODULE 2016.1)
+set_package_properties(UFC PROPERTIES TYPE REQUIRED
+  DESCRIPTION "Unified language for form-compilers (part of FFC)"
+  URL "https://bitbucket.org/fenics-project/ffc")
+
 # Check for PETSc, SLEPc and petsc4py, slepc4py
 if (DOLFIN_ENABLE_PETSC)
-  find_package(PETSc 3.4)
+  find_package(PETSc 3.6)
+  set_package_properties(PETSc PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "Portable, Extensible Toolkit for Scientific Computation"
+    URL "https://www.mcs.anl.gov/petsc/"
+    PURPOSE "Enables the PETSc linear algebra backend")
 
   if (PETSC_FOUND AND PYTHON_FOUND AND DOLFIN_ENABLE_PETSC4PY)
     find_package(PETSc4py)
+    set_package_properties(PETSc4py PROPERTIES TYPE OPTIONAL
+      DESCRIPTION "Python bindings for PETSc"
+      URL "https://bitbucket.org/petsc/petsc4py/")
     if (PETSC4PY_FOUND)
       if (NOT ("${PETSC4PY_VERSION_MAJOR}" EQUAL "${PETSC_VERSION_MAJOR}"
                AND "${PETSC4PY_VERSION_MINOR}" EQUAL "${PETSC_VERSION_MINOR}") AND NOT DOLFIN_IGNORE_PETSC4PY_VERSION)
@@ -423,10 +486,16 @@ if (DOLFIN_ENABLE_PETSC)
   endif()
 
   if (PETSC_FOUND AND DOLFIN_ENABLE_SLEPC)
-    find_package(SLEPc 3.4)
+    find_package(SLEPc 3.6)
+    set_package_properties(SLEPc PROPERTIES TYPE OPTIONAL
+      DESCRIPTION "Scalable Library for Eigenvalue Problem Computations"
+      URL "http://slepc.upv.es/")
 
     if (SLEPC_FOUND AND PYTHON_FOUND AND DOLFIN_ENABLE_SLEPC4PY)
-      find_package(SLEPc4py 3.5.1)
+      find_package(SLEPc4py)
+      set_package_properties(SLEPc4py PROPERTIES TYPE OPTIONAL
+	DESCRIPTION "Python bindings for SLEPc"
+	URL "https://bitbucket.org/slepc/slepc4py/")
       if (SLEPC4PY_FOUND)
         if (NOT ("${SLEPC4PY_VERSION_MAJOR}" EQUAL "${SLEPC_VERSION_MAJOR}"
               AND "${SLEPC4PY_VERSION_MINOR}" EQUAL "${SLEPC_VERSION_MINOR}"))
@@ -436,22 +505,24 @@ if (DOLFIN_ENABLE_PETSC)
       endif()
     endif()
   endif()
-
-  # Enable TAO for PETSc version > 3.4
-  if ((PETSC_VERSION VERSION_GREATER 3.4.100))
-    set(PETSC_HAS_TAO TRUE)
-  endif()
-
 endif()
 
 # Check for ParMETIS and SCOTCH
 if (DOLFIN_ENABLE_MPI AND MPI_C_FOUND)
   if (DOLFIN_ENABLE_PARMETIS)
     find_package(ParMETIS 4.0.2)
+    set_package_properties(ParMETIS PROPERTIES TYPE OPTIONAL
+      DESCRIPTION "Parallel Graph Partitioning and Fill-reducing Matrix Ordering"
+      URL "http://glaros.dtc.umn.edu/gkhome/metis/parmetis/overview"
+      PURPOSE "Enables parallel graph partitioning")
   endif()
 
   if (DOLFIN_ENABLE_SCOTCH)
     find_package(SCOTCH)
+    set_package_properties(SCOTCH PROPERTIES TYPE OPTIONAL
+      DESCRIPTION "Programs and libraries for graph, mesh and hypergraph partitioning"
+      URL "https://www.labri.fr/perso/pelegrin/scotch"
+      PURPOSE "Enables parallel graph partitioning")
   endif()
 endif()
 
@@ -459,12 +530,21 @@ endif()
 if (DOLFIN_ENABLE_UMFPACK)
   find_package(AMD QUIET)
   find_package(BLAS QUIET)
-  find_package(UMFPACK QUIET)
+  set_package_properties(BLAS PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "Basic Linear Algebra Subprograms"
+    URL "http://netlib.org/blas/")
+  find_package(UMFPACK)
+  set_package_properties(UMFPACK PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "Sparse LU factorization library"
+    URL "http://faculty.cse.tamu.edu/davis/suitesparse.html")
 endif()
 
 # Check for CHOLMOD
 if (DOLFIN_ENABLE_CHOLMOD)
-  find_package(CHOLMOD QUIET)
+  find_package(CHOLMOD)
+  set_package_properties(CHOLMOD PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "Sparse Cholesky factorization library for sparse matrices"
+    URL "http://faculty.cse.tamu.edu/davis/suitesparse.html")
 endif()
 
 # Check for HDF5
@@ -472,7 +552,11 @@ if (DOLFIN_ENABLE_HDF5)
   if (NOT DEFINED ENV{HDF5_ROOT})
     set(ENV{HDF5_ROOT} "$ENV{HDF5_DIR}")
   endif()
+  set(HDF5_PREFER_PARALLEL TRUE)
   find_package(HDF5)
+  set_package_properties(HDF5 PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "Hierarchical Data Format 5 (HDF5)"
+    URL "https://www.hdfgroup.org/HDF5")
 
   # Check that HDF5 has parallel support
   if (HDF5_FOUND)
@@ -488,23 +572,22 @@ if (DOLFIN_ENABLE_HDF5)
   endif()
 endif()
 
-# Check for PaStiX
-if (DOLFIN_ENABLE_PASTIX)
-  find_package(PaStiX 5.2.1)
-endif()
-
 # Check for Trilinos and the requires Trilinos packages
 if (DOLFIN_ENABLE_TRILINOS)
   message(STATUS "Checking for Trilinos")
   find_package(Trilinos PATHS ${TRILINOS_DIR} ${Trilinos_DIR}
-    $ENV{TRILINOS_DIR} QUIET)
+    $ENV{TRILINOS_DIR})
   set(DOLFIN_TRILINOS_PACKAGES "Tpetra;Zoltan;MueLu;Amesos2;Ifpack2;Belos")
 
-  if ("${Trilinos_VERSION}" VERSION_LESS "11.0.0")
+  if ("${Trilinos_VERSION}" VERSION_LESS "12.4.0")
     set(Trilinos_FOUND FALSE)
-    message(STATUS "Unable to find Trilinos (>= 11.0.0)")
+    message(STATUS "Unable to find Trilinos (>= 12.4.0)")
   endif()
 
+  set_package_properties(Trilinos PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "Object-oriented framework for large-scale problems"
+    URL "https://trilinos.org")
+
   # Check for required packages
   set(DOLFIN_TRILINOS_PACKAGES_FOUND false)
   if (Trilinos_FOUND)
@@ -568,38 +651,49 @@ endif()
 # Check for zlib
 if (DOLFIN_ENABLE_ZLIB)
   find_package(ZLIB)
-endif()
-
-# Check for cppunit
-if (DOLFIN_ENABLE_UNIT_TESTS)
-  find_package(CppUnit)
-
-  # Older version of CPPUNIT use std::auto_ptr, which is deprecated
-  if (CPPUNIT_FOUND)
-    if ("${CPPUNIT_VERSION}" VERSION_LESS "1.13.1")
-      include(CheckCXXCompilerFlag)
-      CHECK_CXX_COMPILER_FLAG(-Wno-deprecated HAVE_NO_DEPRECATED)
-      if (HAVE_NO_DEPRECATED)
-        set(CMAKE_CXX_FLAGS_DEVELOPER "${CMAKE_CXX_FLAGS_DEVELOPER} -Wno-deprecated")
-      endif()
-    endif()
-  endif()
-
+  set_package_properties(ZLIB PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "Compression library"
+    URL "http://www.zlib.net")
 endif()
 
 # Check for Sphinx
 if (DOLFIN_ENABLE_DOCS AND PYTHON_FOUND)
   find_package(Sphinx 1.1.0)
-endif()
-
-# Check for Qt4
-if (DOLFIN_ENABLE_QT)
-  find_package(Qt4)
+  set_package_properties(Sphinx PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "Python documentation generator"
+    URL "http://www.sphinx-doc.org"
+    PURPOSE "Needed to build documentation")
 endif()
 
 # Check for VTK
 if (DOLFIN_ENABLE_VTK)
+  # Find all modules
   find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE)
+  set_package_properties(VTK PROPERTIES TYPE OPTIONAL
+    DESCRIPTION "The Visualization Toolkit - A high level 3D visualization library"
+    URL "https://www.vtk.org"
+    PURPOSE "Enables plotting with VTK as backend")
+
+  # Add required modules (depends on VTK version)
+  if(TARGET vtkRenderingOpenGL2)
+    # VTK 7.0
+    find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} COMPONENTS vtkViewsCore
+      vtkRenderingCore vtkRenderingLabel vtkFiltersTexture vtkRenderingOpenGL2
+      NO_MODULE)
+  elseif(TARGET vtkRenderingFreeTypeOpenGL)
+    # For VTK < 6.3, vtkRenderingFreeTypeOpenGL module is required, so
+    # add if available (vtkRenderingFreeTypeOpenGL was removed from
+    # VTK 6.3)
+    find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} COMPONENTS vtkViewsCore
+      vtkRenderingCore vtkRenderingLabel vtkFiltersTexture vtkRenderingOpenGL
+      vtkRenderingFreeTypeOpenGL NO_MODULE)
+  elseif(TARGET vtkRenderingOpenGL)
+    # VTK 6.3
+    find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} COMPONENTS vtkViewsCore
+      vtkRenderingCore vtkRenderingLabel vtkFiltersTexture
+      vtkRenderingOpenGL NO_MODULE)
+  endif()
+
   set(VTK_VERSION "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}")
   if (VTK_FOUND)
     if ("${VTK_VERSION}" VERSION_LESS "5.2")
@@ -623,57 +717,7 @@ endif()
 #------------------------------------------------------------------------------
 # Print summary of found and not found optional packages
 
-# FIXME: Use FeatureSummary.cmake to do this
-
-# Gather information about which optional packages were found and not found
-set(OPTIONAL_PACKAGES_FOUND "")
-set(OPTIONAL_PACKAGES_NOT_FOUND "")
-set(OPTIONAL_PACKAGES_NOT_ENABLED "")
-foreach (OPTIONAL_PACKAGE ${OPTIONAL_PACKAGES})
-  string(TOUPPER "${OPTIONAL_PACKAGE}" PKG)
-  if (${PKG}_FOUND OR ${OPTIONAL_PACKAGE}_FOUND)
-    list(APPEND OPTIONAL_PACKAGES_FOUND ${PKG})
-  elseif (DOLFIN_ENABLE_${PKG})
-    list(APPEND OPTIONAL_PACKAGES_NOT_FOUND ${PKG})
-  else()
-    list(APPEND OPTIONAL_PACKAGES_NOT_ENABLED ${PKG})
-  endif()
-endforeach()
-
-message(STATUS "")
-
-# Print information about packages that were found
-if (OPTIONAL_PACKAGES_FOUND)
-  message(STATUS "The following optional packages were found:")
-  message(STATUS "-------------------------------------------")
-  foreach (OPTIONAL_PACKAGE ${OPTIONAL_PACKAGES_FOUND})
-    string(TOUPPER "${OPTIONAL_PACKAGE}" PKG)
-    message(STATUS "(OK) ${OPTIONAL_PACKAGE}")
-  endforeach()
-  message(STATUS "")
-endif()
-
-# Print information about packages that were not enabled
-if (OPTIONAL_PACKAGES_NOT_ENABLED)
-  message(STATUS "The following optional packages were not enabled:")
-  message(STATUS "-------------------------------------------------")
-  foreach (OPTIONAL_PACKAGE ${OPTIONAL_PACKAGES_NOT_ENABLED})
-    string(TOUPPER "${OPTIONAL_PACKAGE}" PKG)
-    message(STATUS "(--) ${OPTIONAL_PACKAGE}")
-  endforeach()
-  message(STATUS "")
-endif()
-
-# Print information about packages that were not found
-if (OPTIONAL_PACKAGES_NOT_FOUND)
-  message(STATUS "The following optional packages were not found:")
-  message(STATUS "-----------------------------------------------")
-  foreach (OPTIONAL_PACKAGE ${OPTIONAL_PACKAGES_NOT_FOUND})
-    string(TOUPPER "${OPTIONAL_PACKAGE}" PKG)
-    message(STATUS "(**) ${OPTIONAL_PACKAGE}")
-  endforeach()
-  message(STATUS "")
-endif()
+feature_summary(WHAT ALL)
 
 #------------------------------------------------------------------------------
 # Get installation paths for Python modules (pure and platform-dependent)
@@ -815,7 +859,7 @@ install(FILES ${DOLFIN_UTILITIES}
 #------------------------------------------------------------------------------
 # Installation of DOLFIN manual pages
 
-install(DIRECTORY ${DOLFIN_SOURCE_DIR}/doc/man/
+install(DIRECTORY ${DOLFIN_SOURCE_DIR}/doc-old/man/
   DESTINATION ${DOLFIN_MAN_DIR}
   USE_SOURCE_PERMISSIONS
   COMPONENT RuntimeExecutables)
@@ -847,7 +891,7 @@ configure_file(${DOLFIN_CMAKE_DIR}/templates/dolfin-version.in
                ${CMAKE_BINARY_DIR}/dolfin-version @ONLY)
 install(FILES ${CMAKE_BINARY_DIR}/dolfin-version
         DESTINATION ${DOLFIN_BIN_DIR}
-	PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
+  PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
         OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
         COMPONENT RuntimeExecutables)
 
@@ -858,7 +902,7 @@ configure_file(${DOLFIN_CMAKE_DIR}/templates/dolfin-get-demos.in
                ${CMAKE_BINARY_DIR}/dolfin-get-demos @ONLY)
 install(FILES ${CMAKE_BINARY_DIR}/dolfin-get-demos
         DESTINATION ${DOLFIN_BIN_DIR}
-	PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
+  PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
         COMPONENT RuntimeExecutables)
 
 
@@ -892,7 +936,7 @@ if (NOT EXISTS ${DOLFIN_SOURCE_DIR}/demo/documented/poisson/cpp/Poisson.h)
 endif()
 
 #------------------------------------------------------------------------------
-# Generate CMakeLists.txt files for tests, bench and demos if not
+# Generate CMakeLists.txt files for bench and demos if not
 # exists
 # FIXME: Generate files in Build directory instead?
 # NOTE: We need to call this script after generate-formfiles
@@ -1005,7 +1049,7 @@ if (DOLFIN_ENABLE_DOCS)
   if (NOT SPHINX_FOUND)
     message(STATUS "Disabling generation of documentation because Sphinx is missing.")
   else()
-    add_subdirectory(doc)
+    add_subdirectory(doc-old)
   endif()
 endif()
 
@@ -1034,17 +1078,30 @@ if (DOLFIN_ENABLE_BENCHMARKS)
     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bench")
 endif()
 
-if (CPPUNIT_FOUND)
-  # Add test but do not add to default target
-  add_subdirectory(test EXCLUDE_FROM_ALL)
+if (DOLFIN_ENABLE_TESTING)
 
-  # Add target "tests" for building tests
-  add_custom_target(tests
-                    COMMAND ${MAKE_PROGRAM}
-                    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test")
-endif()
+  # Google Test needs to be downloaded and compiled by CMake, so we
+  # handle it as a special case.
+  if (DOLFIN_ENABLE_GTEST)
+    # Add sub directory to build GoogleTest
+    add_subdirectory(test/unit)
 
-if (DOLFIN_ENABLE_TESTING)
+    # Add target "unittests_cpp", but do not add to default target
+    add_subdirectory(test/unit/cpp EXCLUDE_FROM_ALL)
+
+    # Add target "run_unittests_cpp" for running only C++ unit tests
+    add_custom_target(run_unittests_cpp
+      COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test/unit/cpp/unittests_cpp
+      DEPENDS copy_data_test_demo unittests_cpp)
+  else()
+    # Add dummy targets for C++ unit tests
+    add_custom_target(unittests_cpp)
+    add_custom_target(run_unittests_cpp)
+  endif()
+
+  # FIXME: remove this buildbot updated to call unittests_cpp
+  # Add alias for unittests_cpp
+  add_custom_target(tests DEPENDS unittests_cpp)
 
   # Add target "run_memorytests" for running memory tests
   add_custom_target(copy_data_test_demo
@@ -1063,29 +1120,9 @@ if (DOLFIN_ENABLE_TESTING)
     DEPENDS copy_data_test_demo demo
     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/regression")
 
-  # Add target "run_systemtests" for running system tests
-  add_custom_target(run_systemtests
-    COMMAND echo "System tests are removed.")
-
-  # TODO: Make buildbot run the dependencies here separately?
   # Add target "run_unittests" for running unit tests
   add_custom_target(run_unittests
-    DEPENDS run_unittests_2)
-
-  # ... attempt at controlling dependency execution order ...
-  add_custom_target(run_unittests_2
-    DEPENDS run_unittests_py_mpi run_unittests_1)
-  add_custom_target(run_unittests_1
-    DEPENDS run_unittests_cpp run_unittests_0)
-  add_custom_target(run_unittests_0
-    DEPENDS run_unittests_py)
-
-  # TODO: Use google test for C++ unit tests?
-  # Add target "run_unittests_cpp" for running only C++ unit tests
-  add_custom_target(run_unittests_cpp
-    COMMAND ${PYTHON_EXECUTABLE} "-B" "-u" "-m" "pytest" "-vs" "-k" "cpp"
-    DEPENDS copy_data_test_demo tests
-    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/unit")
+    DEPENDS run_unittests_cpp run_unittests_py run_unittests_py_mpi)
 
   # Add target "run_unittests_py" for running Python unit tests
   add_custom_target(run_unittests_py
@@ -1095,7 +1132,7 @@ if (DOLFIN_ENABLE_TESTING)
 
   # Add target "run_unittests_py_mpi" for running Python unit tests with mpi
   add_custom_target(run_unittests_py_mpi
-    COMMAND ${MPIEXEC} "-np" "3" ${PYTHON_EXECUTABLE} "-B" "-u" "-m" "pytest" "-vs"
+    COMMAND ${MPIEXEC} "-np" "3" "./mpipipe.sh" ${PYTHON_EXECUTABLE} "-B" "-u" "-m" "pytest" "-vs"
     DEPENDS copy_data_test_demo
     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/unit/python")
 
@@ -1113,14 +1150,18 @@ if (DOLFIN_ENABLE_TESTING)
     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/documentation")
 
   # Add target "run_styletest" for running documentation tests
-  #add_custom_target(run_styletest
-  #  COMMAND ${PYTHON_EXECUTABLE} "-B" "test_coding_style.py"
-  #  DEPENDS copy_data_test_demo
-  #  WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/codingstyle")
+  add_custom_target(run_styletest
+    COMMAND ${PYTHON_EXECUTABLE} "-B" "test_coding_style.py"
+    DEPENDS copy_data_test_demo
+    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/codingstyle")
+
+  # Create test_coding_style.py in build dir (depends on source path)
+  configure_file(${CMAKE_SOURCE_DIR}/test/codingstyle/test_coding_style.py.in
+    ${CMAKE_BINARY_DIR}/test/codingstyle/test_coding_style.py @ONLY)
 
   # Add target "runtests" for running all tests
   add_custom_target(runtests
-    DEPENDS run_doctest run_regressiontests run_unittests)# run_styletest)
+    DEPENDS run_doctest run_regressiontests run_unittests run_styletest)
 endif()
 
 #------------------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 1a075d4..786e0ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,58 @@
+2016.1.0 [2016-06-23]
+- Remove support for 'uint'-valued MeshFunction (replaced by 'size_t')
+- Major performance improvements and simplifications of the XDMF IO.
+- Remove Zoltan graph partitioning interface
+- Add new algorithm for computing mesh entiites. Typical speed-up
+	of two with gcc and four with clang. Reduced memory usage for
+	meshes with irregularly numbered cells.
+- Remove STLMatrix, STLVector, MUMPSLUSolver and PastixLUSolver classes
+- Remove PETScPreconditioner::set_near_nullspace and add
+	PETScMatrix::set_near_nullspace
+- Build system updates for VTK 7.0
+- Remove XDMF from File interface. XDMF is XML based, and has many
+	possibilities for file access, which are not accessible through
+	the limited File interface and "<<" ">>" operators. Instead of
+	File, use XDMFFile, and use XDMFFile.read() and XDMFFile.write()
+	for I/O. Demos and tests have been updated to show usage.  XDMF
+	now also supports ASCII I/O in serial, useful for compatibility
+	with users who do not have the HDF5 library available.
+- Require polynomial degree or finite element for Expressions in
+	the Python interface (fixes Issue #355,
+	https://bitbucket.org/fenics-project/dolfin/issues/355)
+- Switch to Google Test framwork for C++ unit tests
+- Fix bug when reading domain data from mesh file for a ghosted mesh
+- Add interface for manipulating mesh geometry using (higher-order) FE
+	functions: free functions set_coordinates, get_coordinates, create_mesh
+- Fix bug when reading domain data from mesh file for a ghosted mesh.
+- Remove reference versions of constructors for many classes that
+	store a pointer/reference to the object passed to the
+	constructor. This is an intrusive interface change for C++ users,
+	but necessary to improve code maintainabilty and to improve memory
+	safety. The Python interface is (virtually) unaffected.
+- Remove class SubSpace. Using FunctionSpace::sub(...) instead
+- Remove reference versions constructors of NonlinearVariationalSolver
+- Remove setting of bounds from NonlinearVariationalSolver (was
+	already available through NonlinearVariationalProblem)
+- Update Trilinos support to include Amesos2, and better support from Python
+- Rewrite interface of TensorLayout and SparsityPattern; local-to-global
+	maps now handled using new IndexMap class; GenericSparsityPattern
+	class removed
+- Remove QT (was an optional dependency)
+- PETScTAOSolver::solve() now returns a pair of number of
+	iterations (std::size_t) and whether iteration converged (bool)
+- Better quality refinement in 2D in Plaza algorithm, by choosing refinement
+	pattern based on max/min edge ratio
+- Removed refine_cell() method in CellTypes
+- Enable marker refinement to work in parallel for 1D meshes too
+- Add std::abort to Python exception hook to avoid parallel deadlocks
+- Extend dof_to_vertex_map with unowned dofs, thus making dof_to_vertex_map
+	an inverse of vertex_to_dof_map
+- Clean-up in PyDOLFIN function space design, issue #576
+- Deprecate MixedFunctionSpace and EnrichedFunctionSpace in favour of
+	initialization by suitable UFL element
+- Add experimental matplotlib-based plotting backend, see mplot demo
+- Remove method argument of DirichletBC::get_boundary_values()
+- Change return types of free functions adapt() to shared_ptr
 1.6.0 [2015-07-28]
 - Remove redundant pressure boundary condition in Stokes demos
 - Require Point in RectangleMesh and BoxMesh constructors
@@ -39,11 +94,11 @@
 - list_timings() is now collective and returns MPI average across processes
 - Add dump_timings_to_xml()
 - Add enum TimingType { wall, user, system } for selecting wall-clock,
-  user and system time in timing routines
+	user and system time in timing routines
 - Bump required SWIG version to 3.0.3
 - Increase default maximum iterations in NewtonSolver to 50.
 - Deprecate Python free function homogenize(bc) in favour of member
-  function DirichletBC::homogenize()
+	function DirichletBC::homogenize()
 1.5.0 [2015-01-12]
  - DG demos working in parallel
  - Simplify re-use of LU factorisations
diff --git a/INSTALL b/INSTALL
index 2e263ad..c518dfe 100644
--- a/INSTALL
+++ b/INSTALL
@@ -25,7 +25,10 @@ Local installation
 It may sometimes be advantageous to install DOLFIN locally as part
 of the DOLFIN source tree. To do this, simply type
 
-  ./cmake.local
+  mkdir build
+  cd build
+  cmake -DCMAKE_INSTALL_PREFIX=$PWD/../local ..
+  make install
 
 This configures, compiles, and install DOLFIN in a directory named
 'local' in the DOLFIN source tree.
diff --git a/README.rst b/README.rst
index a50a93b..2285454 100644
--- a/README.rst
+++ b/README.rst
@@ -2,9 +2,8 @@
 DOLFIN
 ======
 
-DOLFIN is the C++/Python interface of FEniCS, providing a consistent
-PSE (Problem Solving Environment) for ordinary and partial
-differential equations.
+DOLFIN is the computational backend of FEniCS and implements
+the FEniCS PSE (Problem Solving Environment) in Python and C++.
 
 Installation
 ============
@@ -41,9 +40,14 @@ Contact
 
 For comments and requests, send an email to the FEniCS mailing list:
 
-  fenics at fenicsproject.org
+  fenics-dev at googlegroups.com
 
-For questions and bug reports, visit the FEniCS Q&A page:
+For questions related to obtaining, building or installing DOLFIN, send
+an email to the FEniCS support mailing list:
+
+  fenics-support at googlegroups.com
+
+For questions about using DOLFIN, visit the FEniCS Q&A page:
 
   http://fenicsproject.org/qa
 
@@ -61,3 +65,10 @@ authors can be found in the file AUTHORS. For more information about
 DOLFIN, visit
 
   http://fenicsproject.org
+
+
+
+Automated Testing
+=================
+
+We use Atlassian Bamboo to perform automatic testing at http://magpie.bpi.cam.ac.uk:8085
\ No newline at end of file
diff --git a/bench/bench.py b/bench/bench.py
index d0e2c02..88c7d91 100644
--- a/bench/bench.py
+++ b/bench/bench.py
@@ -70,7 +70,7 @@ def run_bench(arg, directory, files):
     f = open(logfile)
     run_timings = [("", elapsed_time)]
     for line in [line for line in f.read().split("\n") if "BENCH" in line]:
-        words = [word.strip() for word in line.split(" ")]
+        words = [word.strip() for word in line.split()]
         # Override total time
         if len(words) == 2:
             run_timings[0] = ("", float(words[1]))
@@ -89,7 +89,7 @@ def run_bench(arg, directory, files):
             d = description
         else:
             n = "%s-%s" % (name, postfix)
-            d = "%s (%s)" % (description, postfix)
+            d = "%s ((%s))" % (description, postfix)
         f.write('%s %s %g "%s"\n'  % (date, n, timing, d))
 
     return status == 0
diff --git a/bench/common/progress/cpp/CMakeLists.txt b/bench/common/progress/cpp/CMakeLists.txt
index 9fcda66..23faea1 100644
--- a/bench/common/progress/cpp/CMakeLists.txt
+++ b/bench/common/progress/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/common/timing/cpp/CMakeLists.txt b/bench/common/timing/cpp/CMakeLists.txt
index 97bdfe8..7697e74 100644
--- a/bench/common/timing/cpp/CMakeLists.txt
+++ b/bench/common/timing/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/fem/assembly/cpp/CMakeLists.txt b/bench/fem/assembly/cpp/CMakeLists.txt
index 4c320d6..218d0a9 100644
--- a/bench/fem/assembly/cpp/CMakeLists.txt
+++ b/bench/fem/assembly/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/fem/assembly/cpp/forms.h b/bench/fem/assembly/cpp/forms.h
index 6bf6bda..449b185 100644
--- a/bench/fem/assembly/cpp/forms.h
+++ b/bench/fem/assembly/cpp/forms.h
@@ -18,6 +18,7 @@
 // First added:  2008-07-22
 // Last changed: 2010-05-03
 
+#include <memory>
 #include <dolfin.h>
 
 #include "forms/Poisson2DP1.h"
@@ -37,56 +38,56 @@ double bench_form(std::string form_name, double (*foo)(Form&))
 {
   if (form_name == "poisson1")
   {
-    UnitSquareMesh mesh(SIZE_2D, SIZE_2D);
-    Poisson2DP1::FunctionSpace V(mesh);
+    auto mesh = std::make_shared<UnitSquareMesh>(SIZE_2D, SIZE_2D);
+    auto V = std::make_shared<Poisson2DP1::FunctionSpace>(mesh);
     Poisson2DP1::BilinearForm form(V, V);
     return foo(form);
   }
   else if (form_name == "poisson2")
   {
-    UnitSquareMesh mesh(SIZE_2D, SIZE_2D);
-    Poisson2DP2::FunctionSpace V(mesh);
+    auto mesh = std::make_shared<UnitSquareMesh>(SIZE_2D, SIZE_2D);
+    auto V = std::make_shared<Poisson2DP2::FunctionSpace>(mesh);
     Poisson2DP2::BilinearForm form(V, V);
     return foo(form);
   }
   else if (form_name == "poisson3")
   {
-    UnitSquareMesh mesh(SIZE_2D, SIZE_2D);
-    Poisson2DP3::FunctionSpace V(mesh);
+    auto mesh = std::make_shared<UnitSquareMesh>(SIZE_2D, SIZE_2D);
+    auto V = std::make_shared<Poisson2DP3::FunctionSpace>(mesh);
     Poisson2DP3::BilinearForm form(V, V);
     return foo(form);
   }
   else if (form_name == "stokes")
   {
-    UnitSquareMesh mesh(SIZE_2D, SIZE_2D);
-    THStokes2D::FunctionSpace V(mesh);
+    auto mesh = std::make_shared<UnitSquareMesh>(SIZE_2D, SIZE_2D);
+    auto V = std::make_shared<THStokes2D::FunctionSpace>(mesh);
     THStokes2D::BilinearForm form(V, V);
     return foo(form);
   }
   else if (form_name == "stabilization")
   {
-    UnitSquareMesh mesh(SIZE_2D, SIZE_2D);
-    StabStokes2D::FunctionSpace V(mesh);
-    Constant h(1.0);
+    auto mesh = std::make_shared<UnitSquareMesh>(SIZE_2D, SIZE_2D);
+    auto V = std::make_shared<StabStokes2D::FunctionSpace>(mesh);
+    auto h = std::make_shared<Constant>(1.0);
     StabStokes2D::BilinearForm form(V, V, h);
     return foo(form);
   }
   else if (form_name == "elasticity")
   {
-    UnitCubeMesh mesh(SIZE_3D, SIZE_3D, SIZE_3D);
-    Elasticity3D::FunctionSpace V(mesh);
+    auto mesh = std::make_shared<UnitCubeMesh>(SIZE_3D, SIZE_3D, SIZE_3D);
+    auto V = std::make_shared<Elasticity3D::FunctionSpace>(mesh);
     Elasticity3D::BilinearForm form(V, V);
     return foo(form);
   }
   else if (form_name == "navierstokes")
   {
-    UnitCubeMesh mesh(SIZE_3D, SIZE_3D, SIZE_3D);
-    NSEMomentum3D::FunctionSpace V(mesh);
-    Constant  w(1.0, 1.0, 1.0);
-    Constant d1(1.0);
-    Constant d2(1.0);
-    Constant k(1.0);
-    Constant nu(1.0);
+    auto mesh = std::make_shared<UnitCubeMesh>(SIZE_3D, SIZE_3D, SIZE_3D);
+    auto V = std::make_shared<NSEMomentum3D::FunctionSpace>(mesh);
+    auto w = std::make_shared<Constant>(1.0, 1.0, 1.0);
+    auto d1 = std::make_shared<Constant>(1.0);
+    auto d2 = std::make_shared<Constant>(1.0);
+    auto k = std::make_shared<Constant>(1.0);
+    auto nu = std::make_shared<Constant>(1.0);
     NSEMomentum3D::BilinearForm form(V, V, w, d1, d2, k, nu);
     return foo(form);
   }
diff --git a/bench/fem/assembly/cpp/forms/Elasticity3D.h b/bench/fem/assembly/cpp/forms/Elasticity3D.h
index b1dc2ff..e71a218 100644
--- a/bench/fem/assembly/cpp/forms/Elasticity3D.h
+++ b/bench/fem/assembly/cpp/forms/Elasticity3D.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __ELASTICITY3D_H
 #define __ELASTICITY3D_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class elasticity3d_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   elasticity3d_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity3d_finite_element_0()
+  ~elasticity3d_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -257,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -279,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -318,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -330,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -339,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1041,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1098,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1106,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1132,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1171,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1219,98 +1222,86 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new elasticity3d_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class elasticity3d_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   elasticity3d_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity3d_finite_element_1()
+  ~elasticity3d_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1324,16 +1315,54 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1342,9 +1371,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1733,20 +1762,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1755,7 +1782,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -1763,21 +1790,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1797,7 +1822,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1809,7 +1834,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1818,9 +1843,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -3776,28 +3801,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -3833,7 +3856,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -3841,22 +3864,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -3867,108 +3888,108 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 9:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 10:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 11:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -3978,86 +3999,84 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[8] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[10] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[11] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4076,30 +4095,53 @@ public:
     vertex_values[11] = dof_values[11];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 3;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4123,41 +4165,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new elasticity3d_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class elasticity3d_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   elasticity3d_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity3d_dofmap_0()
+  ~elasticity3d_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4186,39 +4221,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4247,20 +4271,18 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4296,9 +4318,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -4359,71 +4380,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new elasticity3d_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class elasticity3d_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   elasticity3d_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity3d_dofmap_1()
+  ~elasticity3d_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4452,39 +4447,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 9;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4513,32 +4497,30 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[0][0];
-    dofs[5] = offset + c.entity_indices[0][1];
-    dofs[6] = offset + c.entity_indices[0][2];
-    dofs[7] = offset + c.entity_indices[0][3];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[8] = offset + c.entity_indices[0][0];
-    dofs[9] = offset + c.entity_indices[0][1];
-    dofs[10] = offset + c.entity_indices[0][2];
-    dofs[11] = offset + c.entity_indices[0][3];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4598,9 +4580,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -4669,56 +4650,13 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = vertex_coordinates[6];
-    dof_coordinates[19] = vertex_coordinates[7];
-    dof_coordinates[20] = vertex_coordinates[8];
-    dof_coordinates[21] = vertex_coordinates[9];
-    dof_coordinates[22] = vertex_coordinates[10];
-    dof_coordinates[23] = vertex_coordinates[11];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[6];
-    dof_coordinates[31] = vertex_coordinates[7];
-    dof_coordinates[32] = vertex_coordinates[8];
-    dof_coordinates[33] = vertex_coordinates[9];
-    dof_coordinates[34] = vertex_coordinates[10];
-    dof_coordinates[35] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4742,50 +4680,42 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new elasticity3d_dofmap_1();
   }
 
 };
 
-/// 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 elasticity3d_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   elasticity3d_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~elasticity3d_cell_integral_0_otherwise()
+  ~elasticity3d_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -5071,66 +5001,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class elasticity3d_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   elasticity3d_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity3d_form_0()
+  ~elasticity3d_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "6806fff0ccbf9ac607c9ae22a3c8ee59201f1f47a3617cbd815bbe6b223be97bcfcc5a270c3510a2ee27177f0d3fef4640ef345f70e3d7adb184ec82e450afdb";
+    return "fd00f09ed35bb8cb304b0545d1fdcca15aad314ea0a9e1c3ea03be6310a6dce72001b465ac47e17f6fce6aae0e4069eaaff4f2d67a23f258787e407408ada41b";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new elasticity3d_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new elasticity3d_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5149,8 +5071,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5169,126 +5090,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new elasticity3d_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -5302,14 +5259,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Elasticity3D
 {
@@ -5318,43 +5281,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity3d_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity3d_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity3d_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity3d_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity3d_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity3d_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity3d_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity3d_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5365,63 +5305,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity3d_dofmap_1()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity3d_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity3d_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity3d_dofmap_1()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity3d_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity3d_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity3d_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity3d_dofmap_1()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity3d_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -5429,7 +5376,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity3d_form_0());
+    _ufc_form = std::make_shared<const elasticity3d_form_0>();
   }
 
   // Destructor
@@ -5459,14 +5406,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/assembly/cpp/forms/NSEMomentum3D.h b/bench/fem/assembly/cpp/forms/NSEMomentum3D.h
index da6da2e..534dff4 100644
--- a/bench/fem/assembly/cpp/forms/NSEMomentum3D.h
+++ b/bench/fem/assembly/cpp/forms/NSEMomentum3D.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,403 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __NSEMOMENTUM3D_H
 #define __NSEMOMENTUM3D_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class nsemomentum3d_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   nsemomentum3d_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nsemomentum3d_finite_element_0()
+  ~nsemomentum3d_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Compute subdeterminants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-    vertex_values[3] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t value_size() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new nsemomentum3d_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class nsemomentum3d_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  nsemomentum3d_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~nsemomentum3d_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, 3, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    }
-    
-    return 0;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -418,37 +121,58 @@ public:
     
     
     // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
     
     // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
     
     
     // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
+    *values = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[1] = {0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -456,21 +180,29 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[1] = {0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -478,21 +210,59 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[1] = {0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -500,51 +270,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
+    double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -556,7 +319,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -564,317 +327,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
+    if (n > 1)
     {
     return ;
     }
     
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[3];
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 2:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[1] = vals[1];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[2] = vals[2];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[0];
-    vertex_values[6] = dof_values[0];
-    vertex_values[9] = dof_values[0];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[1];
-    vertex_values[4] = dof_values[1];
-    vertex_values[7] = dof_values[1];
-    vertex_values[10] = dof_values[1];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[2];
-    vertex_values[5] = dof_values[2];
-    vertex_values[8] = dof_values[2];
-    vertex_values[11] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 3;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new nsemomentum3d_finite_element_0();
-        break;
-      }
-    case 1:
-      {
-        return new nsemomentum3d_finite_element_0();
-        break;
-      }
-    case 2:
-      {
-        return new nsemomentum3d_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new nsemomentum3d_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class nsemomentum3d_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  nsemomentum3d_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~nsemomentum3d_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 4;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -883,240 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1816,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1873,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1881,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1907,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1946,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1994,98 +1222,110 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new nsemomentum3d_finite_element_2();
+    return new nsemomentum3d_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class nsemomentum3d_finite_element_3: public ufc::finite_element
+class nsemomentum3d_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  nsemomentum3d_finite_element_3() : ufc::finite_element()
+  nsemomentum3d_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nsemomentum3d_finite_element_3()
+  ~nsemomentum3d_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2099,16 +1339,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -2117,9 +1371,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -2508,20 +1762,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2530,7 +1782,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -2538,21 +1790,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2572,7 +1822,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2584,7 +1834,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -2593,9 +1843,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -4551,28 +3801,965 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new nsemomentum3d_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new nsemomentum3d_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new nsemomentum3d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new nsemomentum3d_finite_element_1();
+  }
+
+};
+
+
+class nsemomentum3d_finite_element_2: public ufc::finite_element
+{
+public:
+
+  nsemomentum3d_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~nsemomentum3d_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', tetrahedron, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Compute subdeterminants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+    vertex_values[3] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new nsemomentum3d_finite_element_2();
+  }
+
+};
+
+
+class nsemomentum3d_finite_element_3: public ufc::finite_element
+{
+public:
+
+  nsemomentum3d_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~nsemomentum3d_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Discontinuous Lagrange', tetrahedron, 0), dim=3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Compute subdeterminants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4584,7 +4771,7 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
@@ -4593,22 +4780,22 @@ public:
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 0)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[9];
-    for (unsigned int r = 0; r < 9; r++)
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -4616,22 +4803,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -4642,108 +4827,27 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 5:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
-    case 6:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 8:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 9:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 10:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 11:
+    case 2:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -4753,128 +4857,77 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[4] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[8] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
-    values[9] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[10] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    values[1] = vals[1];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
-    values[11] = vals[2];
+    values[2] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    vertex_values[9] = dof_values[3];
+    vertex_values[3] = dof_values[0];
+    vertex_values[6] = dof_values[0];
+    vertex_values[9] = dof_values[0];
     // Evaluate function and change variables
-    vertex_values[1] = dof_values[4];
-    vertex_values[4] = dof_values[5];
-    vertex_values[7] = dof_values[6];
-    vertex_values[10] = dof_values[7];
+    vertex_values[1] = dof_values[1];
+    vertex_values[4] = dof_values[1];
+    vertex_values[7] = dof_values[1];
+    vertex_values[10] = dof_values[1];
     // Evaluate function and change variables
-    vertex_values[2] = dof_values[8];
-    vertex_values[5] = dof_values[9];
-    vertex_values[8] = dof_values[10];
-    vertex_values[11] = dof_values[11];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[2] = dof_values[2];
+    vertex_values[5] = dof_values[2];
+    vertex_values[8] = dof_values[2];
+    vertex_values[11] = dof_values[2];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[3] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[4] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[5] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[6] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[7] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[8] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 3;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4898,47 +4951,40 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new nsemomentum3d_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class nsemomentum3d_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   nsemomentum3d_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nsemomentum3d_dofmap_0()
+  ~nsemomentum3d_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -4953,7 +4999,7 @@ public:
       }
     case 3:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -4961,45 +5007,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[3];
+    return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
@@ -5014,7 +5049,7 @@ public:
       }
     case 3:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -5022,47 +5057,55 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[3][0];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
         break;
       }
     case 3:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -5073,7 +5116,35 @@ public:
     {
     case 0:
       {
-        
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -5088,80 +5159,58 @@ public:
       }
     case 3:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new nsemomentum3d_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class nsemomentum3d_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   nsemomentum3d_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nsemomentum3d_dofmap_1()
+  ~nsemomentum3d_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, 3, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -5176,7 +5225,7 @@ public:
       }
     case 3:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -5184,45 +5233,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3*num_global_entities[3];
+    return 3*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 9;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 3;
         break;
       }
     case 1:
@@ -5237,7 +5275,7 @@ public:
       }
     case 3:
       {
-        return 3;
+        return 0;
         break;
       }
     }
@@ -5245,53 +5283,91 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[1] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[2] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
         break;
       }
     case 3:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -5302,7 +5378,43 @@ public:
     {
     case 0:
       {
-        
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -5317,43 +5429,20 @@ public:
       }
     case 3:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[3] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[4] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[5] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[6] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[7] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[8] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5377,47 +5466,40 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new nsemomentum3d_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class nsemomentum3d_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   nsemomentum3d_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nsemomentum3d_dofmap_2()
+  ~nsemomentum3d_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', tetrahedron, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -5432,7 +5514,7 @@ public:
       }
     case 3:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -5440,45 +5522,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return num_global_entities[3];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 4;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 0;
         break;
       }
     case 1:
@@ -5493,7 +5564,7 @@ public:
       }
     case 3:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -5501,58 +5572,44 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    dofs[0] = entity_indices[3][0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
+        
         break;
       }
     case 3:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -5563,35 +5620,7 @@ public:
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -5606,84 +5635,63 @@ public:
       }
     case 3:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new nsemomentum3d_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class nsemomentum3d_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   nsemomentum3d_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nsemomentum3d_dofmap_3()
+  ~nsemomentum3d_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Discontinuous Lagrange', tetrahedron, 0), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -5698,7 +5706,7 @@ public:
       }
     case 3:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -5706,45 +5714,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3*num_global_entities[0];
+    return 3*num_global_entities[3];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 9;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 3;
+        return 0;
         break;
       }
     case 1:
@@ -5759,7 +5756,7 @@ public:
       }
     case 3:
       {
-        return 0;
+        return 3;
         break;
       }
     }
@@ -5767,94 +5764,50 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[0][0];
-    dofs[5] = offset + c.entity_indices[0][1];
-    dofs[6] = offset + c.entity_indices[0][2];
-    dofs[7] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[8] = offset + c.entity_indices[0][0];
-    dofs[9] = offset + c.entity_indices[0][1];
-    dofs[10] = offset + c.entity_indices[0][2];
-    dofs[11] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
+    dofs[0] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[1] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[2] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 5;
-      dofs[4] = 6;
-      dofs[5] = 7;
-      dofs[6] = 9;
-      dofs[7] = 10;
-      dofs[8] = 11;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 6;
-      dofs[5] = 7;
-      dofs[6] = 8;
-      dofs[7] = 10;
-      dofs[8] = 11;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 7;
-      dofs[6] = 8;
-      dofs[7] = 9;
-      dofs[8] = 11;
+        
         break;
       }
     case 3:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 6;
-      dofs[6] = 8;
-      dofs[7] = 9;
-      dofs[8] = 10;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -5865,43 +5818,7 @@ public:
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 4;
-        dofs[2] = 8;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 5;
-        dofs[2] = 9;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 6;
-        dofs[2] = 10;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-        dofs[1] = 7;
-        dofs[2] = 11;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -5916,63 +5833,27 @@ public:
       }
     case 3:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = vertex_coordinates[6];
-    dof_coordinates[19] = vertex_coordinates[7];
-    dof_coordinates[20] = vertex_coordinates[8];
-    dof_coordinates[21] = vertex_coordinates[9];
-    dof_coordinates[22] = vertex_coordinates[10];
-    dof_coordinates[23] = vertex_coordinates[11];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[6];
-    dof_coordinates[31] = vertex_coordinates[7];
-    dof_coordinates[32] = vertex_coordinates[8];
-    dof_coordinates[33] = vertex_coordinates[9];
-    dof_coordinates[34] = vertex_coordinates[10];
-    dof_coordinates[35] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5996,50 +5877,42 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new nsemomentum3d_dofmap_3();
   }
 
 };
 
-/// 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 nsemomentum3d_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   nsemomentum3d_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~nsemomentum3d_cell_integral_0_otherwise()
+  ~nsemomentum3d_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -6060,53 +5933,53 @@ public:
     // Quadrature points on the UFC reference element: (0.585410196624969, 0.138196601125011, 0.138196601125011), (0.138196601125011, 0.585410196624969, 0.138196601125011), (0.138196601125011, 0.138196601125011, 0.585410196624969), (0.138196601125011, 0.138196601125011, 0.138196601125011)
     
     // Values of basis functions at quadrature points.
-    static const double FE2_C0[4][4] = \
+    static const double FE1_C0[4][4] = \
     {{0.138196601125009, 0.585410196624969, 0.138196601125011, 0.138196601125011},
     {0.138196601125009, 0.138196601125011, 0.585410196624969, 0.138196601125011},
     {0.138196601125009, 0.138196601125011, 0.138196601125011, 0.585410196624969},
     {0.585410196624967, 0.138196601125011, 0.138196601125011, 0.138196601125011}};
     
     // Array of non-zero columns
-    static const unsigned int nzc3[4] = {0, 1, 2, 3};
+    static const unsigned int nzc0[4] = {0, 1, 2, 3};
     
     // Array of non-zero columns
-    static const unsigned int nzc7[4] = {4, 5, 6, 7};
+    static const unsigned int nzc4[4] = {4, 5, 6, 7};
     
     // Array of non-zero columns
-    static const unsigned int nzc11[4] = {8, 9, 10, 11};
+    static const unsigned int nzc8[4] = {8, 9, 10, 11};
     
-    static const double FE2_C0_D001[4][2] = \
+    static const double FE1_C0_D001[4][2] = \
     {{-1.0, 1.0},
     {-1.0, 1.0},
     {-1.0, 1.0},
     {-1.0, 1.0}};
     
     // Array of non-zero columns
-    static const unsigned int nzc4[2] = {0, 3};
+    static const unsigned int nzc1[2] = {0, 3};
     
     // Array of non-zero columns
-    static const unsigned int nzc5[2] = {0, 2};
+    static const unsigned int nzc2[2] = {0, 2};
     
     // Array of non-zero columns
-    static const unsigned int nzc6[2] = {0, 1};
+    static const unsigned int nzc3[2] = {0, 1};
     
     // Array of non-zero columns
-    static const unsigned int nzc8[2] = {4, 7};
+    static const unsigned int nzc5[2] = {4, 7};
     
     // Array of non-zero columns
-    static const unsigned int nzc9[2] = {4, 6};
+    static const unsigned int nzc6[2] = {4, 6};
     
     // Array of non-zero columns
-    static const unsigned int nzc10[2] = {4, 5};
+    static const unsigned int nzc7[2] = {4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc12[2] = {8, 11};
+    static const unsigned int nzc9[2] = {8, 11};
     
     // Array of non-zero columns
-    static const unsigned int nzc13[2] = {8, 10};
+    static const unsigned int nzc10[2] = {8, 10};
     
     // Array of non-zero columns
-    static const unsigned int nzc14[2] = {8, 9};
+    static const unsigned int nzc11[2] = {8, 9};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 144; r++)
@@ -6115,78 +5988,78 @@ public:
     } // end loop over 'r'
     // Number of operations to compute geometry constants: 864.
     double G[72];
-    G[0] = 0.5*det*w[3][0]*(K[1]*K[1]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]) + w[4][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
-    G[1] = 0.5*det*w[3][0]*(K[1]*K[8]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
-    G[2] = 0.5*det*w[3][0]*(K[1]*K[5]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
-    G[3] = 0.5*det*w[3][0]*(K[1]*K[2]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
-    G[4] = 0.5*det*w[3][0]*(K[1]*K[6]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
-    G[5] = 0.5*det*w[3][0]*(K[1]*K[3]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
-    G[6] = 0.5*det*w[3][0]*(K[0]*K[1]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
-    G[7] = 0.5*det*w[3][0]*(K[1]*K[7]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]) + w[4][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
-    G[8] = 0.5*det*w[3][0]*(K[1]*K[4]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]) + w[4][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
-    G[9] = 0.5*det*w[3][0]*(K[8]*K[8]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]) + w[4][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
-    G[10] = 0.5*det*w[3][0]*(K[5]*K[8]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]) + w[4][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
-    G[11] = 0.5*det*w[3][0]*(K[2]*K[8]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]) + w[4][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
-    G[12] = 0.5*det*w[3][0]*(K[6]*K[8]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
-    G[13] = 0.5*det*w[3][0]*(K[3]*K[8]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
-    G[14] = 0.5*det*w[3][0]*(K[0]*K[8]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
-    G[15] = 0.5*det*w[3][0]*(K[7]*K[8]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
-    G[16] = 0.5*det*w[3][0]*(K[4]*K[8]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
-    G[17] = 0.5*det*w[3][0]*(K[5]*K[5]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]) + w[4][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
-    G[18] = 0.5*det*w[3][0]*(K[2]*K[5]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]) + w[4][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
-    G[19] = 0.5*det*w[3][0]*(K[5]*K[6]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
-    G[20] = 0.5*det*w[3][0]*(K[3]*K[5]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
-    G[21] = 0.5*det*w[3][0]*(K[0]*K[5]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
-    G[22] = 0.5*det*w[3][0]*(K[5]*K[7]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
-    G[23] = 0.5*det*w[3][0]*(K[4]*K[5]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
-    G[24] = 0.5*det*w[3][0]*(K[2]*K[2]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]) + w[4][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
-    G[25] = 0.5*det*w[3][0]*(K[2]*K[6]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
-    G[26] = 0.5*det*w[3][0]*(K[2]*K[3]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
-    G[27] = 0.5*det*w[3][0]*(K[0]*K[2]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
-    G[28] = 0.5*det*w[3][0]*(K[2]*K[7]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
-    G[29] = 0.5*det*w[3][0]*(K[2]*K[4]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
-    G[30] = 0.5*det*w[3][0]*(K[6]*K[6]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]) + w[4][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
-    G[31] = 0.5*det*w[3][0]*(K[3]*K[6]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]) + w[4][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
-    G[32] = 0.5*det*w[3][0]*(K[0]*K[6]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]) + w[4][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
-    G[33] = 0.5*det*w[3][0]*(K[6]*K[7]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
-    G[34] = 0.5*det*w[3][0]*(K[4]*K[6]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
-    G[35] = 0.5*det*w[3][0]*(K[3]*K[3]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]) + w[4][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
-    G[36] = 0.5*det*w[3][0]*(K[0]*K[3]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]) + w[4][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
-    G[37] = 0.5*det*w[3][0]*(K[3]*K[7]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
-    G[38] = 0.5*det*w[3][0]*(K[3]*K[4]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
-    G[39] = 0.5*det*w[3][0]*(K[0]*K[0]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]) + w[4][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
-    G[40] = 0.5*det*w[3][0]*(K[0]*K[7]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
-    G[41] = 0.5*det*w[3][0]*(K[0]*K[4]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
-    G[42] = 0.5*det*w[3][0]*(K[7]*K[7]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]) + w[4][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
-    G[43] = 0.5*det*w[3][0]*(K[4]*K[7]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]) + w[4][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
-    G[44] = 0.5*det*w[3][0]*(K[4]*K[4]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]) + w[4][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
-    G[45] = 0.5*K[2]*det*w[0][1]*w[3][0];
-    G[46] = 0.5*K[8]*det*w[0][2]*w[3][0];
-    G[47] = 0.5*K[5]*det*w[0][2]*w[3][0];
-    G[48] = 0.5*K[2]*det*w[0][2]*w[3][0];
-    G[49] = 0.5*K[8]*det*w[0][0]*w[3][0];
-    G[50] = 0.5*K[5]*det*w[0][0]*w[3][0];
-    G[51] = 0.5*K[2]*det*w[0][0]*w[3][0];
-    G[52] = 0.5*K[8]*det*w[0][1]*w[3][0];
-    G[53] = 0.5*K[5]*det*w[0][1]*w[3][0];
-    G[54] = 0.5*K[0]*det*w[0][1]*w[3][0];
-    G[55] = 0.5*K[6]*det*w[0][2]*w[3][0];
-    G[56] = 0.5*K[3]*det*w[0][2]*w[3][0];
-    G[57] = 0.5*K[0]*det*w[0][2]*w[3][0];
-    G[58] = 0.5*K[6]*det*w[0][0]*w[3][0];
-    G[59] = 0.5*K[3]*det*w[0][0]*w[3][0];
-    G[60] = 0.5*K[0]*det*w[0][0]*w[3][0];
-    G[61] = 0.5*K[6]*det*w[0][1]*w[3][0];
-    G[62] = 0.5*K[3]*det*w[0][1]*w[3][0];
-    G[63] = 0.5*K[1]*det*w[0][1]*w[3][0];
-    G[64] = 0.5*K[7]*det*w[0][2]*w[3][0];
-    G[65] = 0.5*K[4]*det*w[0][2]*w[3][0];
-    G[66] = 0.5*K[1]*det*w[0][2]*w[3][0];
-    G[67] = 0.5*K[7]*det*w[0][0]*w[3][0];
-    G[68] = 0.5*K[4]*det*w[0][0]*w[3][0];
-    G[69] = 0.5*K[1]*det*w[0][0]*w[3][0];
-    G[70] = 0.5*K[7]*det*w[0][1]*w[3][0];
-    G[71] = 0.5*K[4]*det*w[0][1]*w[3][0];
+    G[0] = 0.5*det*w[3][0]*(K[5]*K[5]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]) + w[4][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
+    G[1] = 0.5*det*w[3][0]*(K[2]*K[5]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]) + w[4][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
+    G[2] = 0.5*det*w[3][0]*(K[5]*K[6]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
+    G[3] = 0.5*det*w[3][0]*(K[3]*K[5]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
+    G[4] = 0.5*det*w[3][0]*(K[0]*K[5]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
+    G[5] = 0.5*det*w[3][0]*(K[5]*K[7]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
+    G[6] = 0.5*det*w[3][0]*(K[4]*K[5]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
+    G[7] = 0.5*det*w[3][0]*(K[1]*K[5]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
+    G[8] = 0.5*det*w[3][0]*(K[5]*K[8]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]) + w[4][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
+    G[9] = 0.5*det*w[3][0]*(K[2]*K[2]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]) + w[4][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
+    G[10] = 0.5*det*w[3][0]*(K[2]*K[6]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
+    G[11] = 0.5*det*w[3][0]*(K[2]*K[3]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
+    G[12] = 0.5*det*w[3][0]*(K[0]*K[2]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
+    G[13] = 0.5*det*w[3][0]*(K[2]*K[7]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
+    G[14] = 0.5*det*w[3][0]*(K[2]*K[4]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
+    G[15] = 0.5*det*w[3][0]*(K[1]*K[2]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
+    G[16] = 0.5*det*w[3][0]*(K[2]*K[8]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]) + w[4][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
+    G[17] = 0.5*det*w[3][0]*(K[6]*K[6]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]) + w[4][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
+    G[18] = 0.5*det*w[3][0]*(K[3]*K[6]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]) + w[4][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
+    G[19] = 0.5*det*w[3][0]*(K[0]*K[6]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]) + w[4][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
+    G[20] = 0.5*det*w[3][0]*(K[6]*K[7]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
+    G[21] = 0.5*det*w[3][0]*(K[4]*K[6]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
+    G[22] = 0.5*det*w[3][0]*(K[1]*K[6]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
+    G[23] = 0.5*det*w[3][0]*(K[6]*K[8]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
+    G[24] = 0.5*det*w[3][0]*(K[3]*K[3]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]) + w[4][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
+    G[25] = 0.5*det*w[3][0]*(K[0]*K[3]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]) + w[4][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
+    G[26] = 0.5*det*w[3][0]*(K[3]*K[7]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
+    G[27] = 0.5*det*w[3][0]*(K[3]*K[4]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
+    G[28] = 0.5*det*w[3][0]*(K[1]*K[3]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
+    G[29] = 0.5*det*w[3][0]*(K[3]*K[8]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
+    G[30] = 0.5*det*w[3][0]*(K[0]*K[0]*w[2][0] + w[0][0]*w[0][0]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]) + w[4][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
+    G[31] = 0.5*det*w[3][0]*(K[0]*K[7]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
+    G[32] = 0.5*det*w[3][0]*(K[0]*K[4]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
+    G[33] = 0.5*det*w[3][0]*(K[0]*K[1]*w[2][0] + w[0][0]*w[0][1]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
+    G[34] = 0.5*det*w[3][0]*(K[0]*K[8]*w[2][0] + w[0][0]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
+    G[35] = 0.5*det*w[3][0]*(K[7]*K[7]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]) + w[4][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
+    G[36] = 0.5*det*w[3][0]*(K[4]*K[7]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]) + w[4][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
+    G[37] = 0.5*det*w[3][0]*(K[1]*K[7]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]) + w[4][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
+    G[38] = 0.5*det*w[3][0]*(K[7]*K[8]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
+    G[39] = 0.5*det*w[3][0]*(K[4]*K[4]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]) + w[4][0]*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]));
+    G[40] = 0.5*det*w[3][0]*(K[1]*K[4]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]) + w[4][0]*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]));
+    G[41] = 0.5*det*w[3][0]*(K[4]*K[8]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]));
+    G[42] = 0.5*det*w[3][0]*(K[1]*K[1]*w[2][0] + w[0][1]*w[0][1]*w[1][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]) + w[4][0]*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]));
+    G[43] = 0.5*det*w[3][0]*(K[1]*K[8]*w[2][0] + w[0][1]*w[0][2]*w[1][0]*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]));
+    G[44] = 0.5*det*w[3][0]*(K[8]*K[8]*w[2][0] + w[0][2]*w[0][2]*w[1][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]) + w[4][0]*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]));
+    G[45] = 0.5*K[3]*det*w[0][2]*w[3][0];
+    G[46] = 0.5*K[0]*det*w[0][2]*w[3][0];
+    G[47] = 0.5*K[6]*det*w[0][0]*w[3][0];
+    G[48] = 0.5*K[3]*det*w[0][0]*w[3][0];
+    G[49] = 0.5*K[0]*det*w[0][0]*w[3][0];
+    G[50] = 0.5*K[6]*det*w[0][1]*w[3][0];
+    G[51] = 0.5*K[3]*det*w[0][1]*w[3][0];
+    G[52] = 0.5*K[0]*det*w[0][1]*w[3][0];
+    G[53] = 0.5*K[6]*det*w[0][2]*w[3][0];
+    G[54] = 0.5*K[4]*det*w[0][2]*w[3][0];
+    G[55] = 0.5*K[1]*det*w[0][2]*w[3][0];
+    G[56] = 0.5*K[7]*det*w[0][0]*w[3][0];
+    G[57] = 0.5*K[4]*det*w[0][0]*w[3][0];
+    G[58] = 0.5*K[1]*det*w[0][0]*w[3][0];
+    G[59] = 0.5*K[7]*det*w[0][1]*w[3][0];
+    G[60] = 0.5*K[4]*det*w[0][1]*w[3][0];
+    G[61] = 0.5*K[1]*det*w[0][1]*w[3][0];
+    G[62] = 0.5*K[7]*det*w[0][2]*w[3][0];
+    G[63] = 0.5*K[5]*det*w[0][2]*w[3][0];
+    G[64] = 0.5*K[2]*det*w[0][2]*w[3][0];
+    G[65] = 0.5*K[8]*det*w[0][0]*w[3][0];
+    G[66] = 0.5*K[5]*det*w[0][0]*w[3][0];
+    G[67] = 0.5*K[2]*det*w[0][0]*w[3][0];
+    G[68] = 0.5*K[8]*det*w[0][1]*w[3][0];
+    G[69] = 0.5*K[5]*det*w[0][1]*w[3][0];
+    G[70] = 0.5*K[2]*det*w[0][1]*w[3][0];
+    G[71] = 0.5*K[8]*det*w[0][2]*w[3][0];
     
     // Compute element tensor using UFL quadrature representation
     // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
@@ -6424,167 +6297,167 @@ public:
         for (unsigned int k = 0; k < 2; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc10[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[0];
+          A[nzc10[j]*12 + nzc10[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[0];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc12[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[1];
+          A[nzc10[j]*12 + nzc11[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[1];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc13[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[2];
+          A[nzc10[j]*12 + nzc1[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[2];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc14[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[3];
+          A[nzc10[j]*12 + nzc2[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[3];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc4[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[4];
+          A[nzc10[j]*12 + nzc3[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[4];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc5[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[5];
+          A[nzc10[j]*12 + nzc5[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[5];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc6[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[6];
+          A[nzc10[j]*12 + nzc6[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[6];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc8[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[7];
+          A[nzc10[j]*12 + nzc7[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[7];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc9[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[8];
+          A[nzc10[j]*12 + nzc9[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[8];
           // Number of operations to compute entry: 3
-          A[nzc12[j]*12 + nzc10[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[1];
+          A[nzc11[j]*12 + nzc10[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[1];
           // Number of operations to compute entry: 3
-          A[nzc12[j]*12 + nzc12[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[9];
+          A[nzc11[j]*12 + nzc11[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[9];
           // Number of operations to compute entry: 3
-          A[nzc12[j]*12 + nzc13[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[10];
+          A[nzc11[j]*12 + nzc1[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[10];
           // Number of operations to compute entry: 3
-          A[nzc12[j]*12 + nzc14[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[11];
+          A[nzc11[j]*12 + nzc2[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[11];
           // Number of operations to compute entry: 3
-          A[nzc12[j]*12 + nzc4[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[12];
+          A[nzc11[j]*12 + nzc3[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[12];
           // Number of operations to compute entry: 3
-          A[nzc12[j]*12 + nzc5[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[13];
+          A[nzc11[j]*12 + nzc5[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[13];
           // Number of operations to compute entry: 3
-          A[nzc12[j]*12 + nzc6[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[14];
+          A[nzc11[j]*12 + nzc6[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[14];
           // Number of operations to compute entry: 3
-          A[nzc12[j]*12 + nzc8[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[15];
+          A[nzc11[j]*12 + nzc7[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[15];
           // Number of operations to compute entry: 3
-          A[nzc12[j]*12 + nzc9[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[16];
+          A[nzc11[j]*12 + nzc9[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[16];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*12 + nzc10[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[2];
+          A[nzc1[j]*12 + nzc10[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[2];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*12 + nzc12[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[10];
+          A[nzc1[j]*12 + nzc11[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[10];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*12 + nzc13[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[17];
+          A[nzc1[j]*12 + nzc1[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[17];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*12 + nzc14[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[18];
+          A[nzc1[j]*12 + nzc2[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[18];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*12 + nzc4[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[19];
+          A[nzc1[j]*12 + nzc3[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[19];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*12 + nzc5[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[20];
+          A[nzc1[j]*12 + nzc5[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[20];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*12 + nzc6[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[21];
+          A[nzc1[j]*12 + nzc6[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[21];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*12 + nzc8[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[22];
+          A[nzc1[j]*12 + nzc7[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[22];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*12 + nzc9[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[23];
+          A[nzc1[j]*12 + nzc9[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[23];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*12 + nzc10[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[3];
+          A[nzc2[j]*12 + nzc10[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[3];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*12 + nzc12[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[11];
+          A[nzc2[j]*12 + nzc11[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[11];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*12 + nzc13[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[18];
+          A[nzc2[j]*12 + nzc1[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[18];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*12 + nzc14[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[24];
+          A[nzc2[j]*12 + nzc2[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[24];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*12 + nzc4[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[25];
+          A[nzc2[j]*12 + nzc3[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[25];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*12 + nzc5[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[26];
+          A[nzc2[j]*12 + nzc5[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[26];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*12 + nzc6[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[27];
+          A[nzc2[j]*12 + nzc6[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[27];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*12 + nzc8[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[28];
+          A[nzc2[j]*12 + nzc7[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[28];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*12 + nzc9[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[29];
+          A[nzc2[j]*12 + nzc9[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[29];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*12 + nzc10[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[4];
+          A[nzc3[j]*12 + nzc10[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[4];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*12 + nzc12[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[12];
+          A[nzc3[j]*12 + nzc11[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[12];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*12 + nzc13[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[19];
+          A[nzc3[j]*12 + nzc1[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[19];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*12 + nzc14[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[25];
+          A[nzc3[j]*12 + nzc2[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[25];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*12 + nzc4[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[30];
+          A[nzc3[j]*12 + nzc3[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[30];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*12 + nzc5[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[31];
+          A[nzc3[j]*12 + nzc5[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[31];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*12 + nzc6[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[32];
+          A[nzc3[j]*12 + nzc6[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[32];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*12 + nzc8[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[33];
+          A[nzc3[j]*12 + nzc7[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[33];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*12 + nzc9[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[34];
+          A[nzc3[j]*12 + nzc9[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[34];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc10[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[5];
+          A[nzc5[j]*12 + nzc10[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[5];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc12[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[13];
+          A[nzc5[j]*12 + nzc11[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[13];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc13[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[20];
+          A[nzc5[j]*12 + nzc1[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[20];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc14[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[26];
+          A[nzc5[j]*12 + nzc2[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[26];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc4[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[31];
+          A[nzc5[j]*12 + nzc3[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[31];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc5[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[35];
+          A[nzc5[j]*12 + nzc5[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[35];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc6[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[36];
+          A[nzc5[j]*12 + nzc6[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[36];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc8[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[37];
+          A[nzc5[j]*12 + nzc7[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[37];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc9[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[38];
+          A[nzc5[j]*12 + nzc9[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[38];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc10[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[6];
+          A[nzc6[j]*12 + nzc10[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[6];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc12[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[14];
+          A[nzc6[j]*12 + nzc11[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[14];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc13[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[21];
+          A[nzc6[j]*12 + nzc1[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[21];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc14[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[27];
+          A[nzc6[j]*12 + nzc2[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[27];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc4[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[32];
+          A[nzc6[j]*12 + nzc3[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[32];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc5[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[36];
+          A[nzc6[j]*12 + nzc5[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[36];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc6[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[39];
+          A[nzc6[j]*12 + nzc6[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[39];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc8[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[40];
+          A[nzc6[j]*12 + nzc7[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[40];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc9[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[41];
+          A[nzc6[j]*12 + nzc9[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[41];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc10[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[7];
+          A[nzc7[j]*12 + nzc10[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[7];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc12[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[15];
+          A[nzc7[j]*12 + nzc11[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[15];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc13[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[22];
+          A[nzc7[j]*12 + nzc1[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[22];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc14[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[28];
+          A[nzc7[j]*12 + nzc2[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[28];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc4[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[33];
+          A[nzc7[j]*12 + nzc3[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[33];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc5[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[37];
+          A[nzc7[j]*12 + nzc5[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[37];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc6[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[40];
+          A[nzc7[j]*12 + nzc6[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[40];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc8[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[42];
+          A[nzc7[j]*12 + nzc7[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[42];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc9[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[43];
+          A[nzc7[j]*12 + nzc9[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[43];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc10[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[8];
+          A[nzc9[j]*12 + nzc10[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[8];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc12[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[16];
+          A[nzc9[j]*12 + nzc11[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[16];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc13[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[23];
+          A[nzc9[j]*12 + nzc1[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[23];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc14[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[29];
+          A[nzc9[j]*12 + nzc2[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[29];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc4[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[34];
+          A[nzc9[j]*12 + nzc3[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[34];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc5[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[38];
+          A[nzc9[j]*12 + nzc5[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[38];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc6[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[41];
+          A[nzc9[j]*12 + nzc6[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[41];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc8[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[43];
+          A[nzc9[j]*12 + nzc7[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[43];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc9[k]] += FE2_C0_D001[ip][j]*FE2_C0_D001[ip][k]*I[44];
+          A[nzc9[j]*12 + nzc9[k]] += FE1_C0_D001[ip][j]*FE1_C0_D001[ip][k]*I[44];
         } // end loop over 'k'
       } // end loop over 'j'
       
@@ -6594,59 +6467,59 @@ public:
         for (unsigned int k = 0; k < 2; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc10[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[45];
+          A[nzc0[j]*12 + nzc10[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[45];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc12[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[46];
+          A[nzc0[j]*12 + nzc11[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[46];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc13[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[47];
+          A[nzc0[j]*12 + nzc1[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[47];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc14[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[48];
+          A[nzc0[j]*12 + nzc2[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[48];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc4[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[49];
+          A[nzc0[j]*12 + nzc3[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[49];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc5[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[50];
+          A[nzc0[j]*12 + nzc5[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[50];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc6[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[51];
+          A[nzc0[j]*12 + nzc6[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[51];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc8[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[52];
+          A[nzc0[j]*12 + nzc7[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[52];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc9[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[53];
+          A[nzc0[j]*12 + nzc9[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[53];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc10[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[54];
+          A[nzc4[j]*12 + nzc10[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[54];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc12[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[55];
+          A[nzc4[j]*12 + nzc11[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[55];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc13[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[56];
+          A[nzc4[j]*12 + nzc1[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[56];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc14[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[57];
+          A[nzc4[j]*12 + nzc2[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[57];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc4[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[58];
+          A[nzc4[j]*12 + nzc3[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[58];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc5[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[59];
+          A[nzc4[j]*12 + nzc5[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[59];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc6[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[60];
+          A[nzc4[j]*12 + nzc6[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[60];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc8[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[61];
+          A[nzc4[j]*12 + nzc7[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[61];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc9[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[62];
+          A[nzc4[j]*12 + nzc9[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[62];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc10[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[63];
+          A[nzc8[j]*12 + nzc10[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[63];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc12[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[64];
+          A[nzc8[j]*12 + nzc11[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[64];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc13[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[65];
+          A[nzc8[j]*12 + nzc1[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[65];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc14[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[66];
+          A[nzc8[j]*12 + nzc2[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[66];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc4[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[67];
+          A[nzc8[j]*12 + nzc3[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[67];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc5[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[68];
+          A[nzc8[j]*12 + nzc5[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[68];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc6[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[69];
+          A[nzc8[j]*12 + nzc6[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[69];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc8[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[70];
+          A[nzc8[j]*12 + nzc7[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[70];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc9[k]] += FE2_C0[ip][j]*FE2_C0_D001[ip][k]*I[71];
+          A[nzc8[j]*12 + nzc9[k]] += FE1_C0[ip][j]*FE1_C0_D001[ip][k]*I[71];
         } // end loop over 'k'
       } // end loop over 'j'
       
@@ -6656,11 +6529,11 @@ public:
         for (unsigned int k = 0; k < 4; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc11[k]] += FE2_C0[ip][j]*FE2_C0[ip][k]*I[72];
+          A[nzc0[j]*12 + nzc0[k]] += FE1_C0[ip][j]*FE1_C0[ip][k]*I[72];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc3[k]] += FE2_C0[ip][j]*FE2_C0[ip][k]*I[72];
+          A[nzc4[j]*12 + nzc4[k]] += FE1_C0[ip][j]*FE1_C0[ip][k]*I[72];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc7[k]] += FE2_C0[ip][j]*FE2_C0[ip][k]*I[72];
+          A[nzc8[j]*12 + nzc8[k]] += FE1_C0[ip][j]*FE1_C0[ip][k]*I[72];
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -6668,102 +6541,94 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class nsemomentum3d_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   nsemomentum3d_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nsemomentum3d_form_0()
+  ~nsemomentum3d_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "9d6058600c512e96bb88d28dcb820aafd5f04258c9aa48ba917f49204d79165a50e6a9c31ee5fe697d7240958b9bee3b13b9d5a302c1793ecf1565f773d39c07";
+    return "11066ded22f921635e1562428220e4b7eb18d945ee33602296bd2396aafb619d4e88650d751c9a4ea50f5e2cc89a459bb336e9b36c54b343ec1b15aa9b86bf57";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 5;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3, 4});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new nsemomentum3d_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new nsemomentum3d_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new nsemomentum3d_finite_element_3();
+        return new nsemomentum3d_finite_element_1();
         break;
       }
     case 1:
       {
-        return new nsemomentum3d_finite_element_3();
+        return new nsemomentum3d_finite_element_1();
         break;
       }
     case 2:
       {
-        return new nsemomentum3d_finite_element_1();
+        return new nsemomentum3d_finite_element_3();
         break;
       }
     case 3:
       {
-        return new nsemomentum3d_finite_element_0();
+        return new nsemomentum3d_finite_element_2();
         break;
       }
     case 4:
       {
-        return new nsemomentum3d_finite_element_0();
+        return new nsemomentum3d_finite_element_2();
         break;
       }
     case 5:
       {
-        return new nsemomentum3d_finite_element_0();
+        return new nsemomentum3d_finite_element_2();
         break;
       }
     case 6:
       {
-        return new nsemomentum3d_finite_element_0();
+        return new nsemomentum3d_finite_element_2();
         break;
       }
     }
@@ -6771,44 +6636,43 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new nsemomentum3d_dofmap_3();
+        return new nsemomentum3d_dofmap_1();
         break;
       }
     case 1:
       {
-        return new nsemomentum3d_dofmap_3();
+        return new nsemomentum3d_dofmap_1();
         break;
       }
     case 2:
       {
-        return new nsemomentum3d_dofmap_1();
+        return new nsemomentum3d_dofmap_3();
         break;
       }
     case 3:
       {
-        return new nsemomentum3d_dofmap_0();
+        return new nsemomentum3d_dofmap_2();
         break;
       }
     case 4:
       {
-        return new nsemomentum3d_dofmap_0();
+        return new nsemomentum3d_dofmap_2();
         break;
       }
     case 5:
       {
-        return new nsemomentum3d_dofmap_0();
+        return new nsemomentum3d_dofmap_2();
         break;
       }
     case 6:
       {
-        return new nsemomentum3d_dofmap_0();
+        return new nsemomentum3d_dofmap_2();
         break;
       }
     }
@@ -6816,126 +6680,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new nsemomentum3d_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -6949,14 +6849,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace NSEMomentum3D
 {
@@ -6965,43 +6871,20 @@ class CoefficientSpace_d1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_d1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_d1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_d1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_d1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7012,43 +6895,20 @@ class CoefficientSpace_d2: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_d2(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_d2(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_d2(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_d2(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7059,43 +6919,20 @@ class CoefficientSpace_k: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7106,43 +6943,20 @@ class CoefficientSpace_nu: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_nu(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_nu(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_nu(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_nu(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7153,43 +6967,20 @@ class CoefficientSpace_w: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_w(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_w(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7200,43 +6991,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7247,45 +7015,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nsemomentum3d_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nsemomentum3d_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nsemomentum3d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nsemomentum3d_dofmap_3()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -7305,21 +7090,21 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nsemomentum3d_form_0());
+    _ufc_form = std::make_shared<const nsemomentum3d_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& d1, const dolfin::GenericFunction& d2, const dolfin::GenericFunction& k, const dolfin::GenericFunction& nu):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> d1, std::shared_ptr<const dolfin::GenericFunction> d2, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> nu):
     dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->w = w;
     this->d1 = d1;
@@ -7327,69 +7112,124 @@ public:
     this->k = k;
     this->nu = nu;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nsemomentum3d_form_0());
+    _ufc_form = std::make_shared<const nsemomentum3d_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> d1, std::shared_ptr<const dolfin::GenericFunction> d2, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
+  // Destructor
+  ~Form_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    if (name == "w")
+      return 0;
+    else if (name == "d1")
+      return 1;
+    else if (name == "d2")
+      return 2;
+    else if (name == "k")
+      return 3;
+    else if (name == "nu")
+      return 4;
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
 
-    this->w = *w;
-    this->d1 = *d1;
-    this->d2 = *d2;
-    this->k = *k;
-    this->nu = *nu;
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "w";
+    case 1:
+      return "d1";
+    case 2:
+      return "d2";
+    case 3:
+      return "k";
+    case 4:
+      return "nu";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nsemomentum3d_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_w;
+  typedef Form_a_FunctionSpace_3 CoefficientSpace_d1;
+  typedef Form_a_FunctionSpace_4 CoefficientSpace_d2;
+  typedef Form_a_FunctionSpace_5 CoefficientSpace_k;
+  typedef Form_a_FunctionSpace_6 CoefficientSpace_nu;
+
+  // Coefficients
+  dolfin::CoefficientAssigner w;
+  dolfin::CoefficientAssigner d1;
+  dolfin::CoefficientAssigner d2;
+  dolfin::CoefficientAssigner k;
+  dolfin::CoefficientAssigner nu;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nsemomentum3d_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& d1, const dolfin::GenericFunction& d2, const dolfin::GenericFunction& k, const dolfin::GenericFunction& nu):
-    dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> d1, std::shared_ptr<const dolfin::GenericFunction> d2, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> nu):
+    dolfin::MultiMeshForm(V1, V0), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
+    /// Assign coefficients
     this->w = w;
     this->d1 = d1;
     this->d2 = d2;
     this->k = k;
     this->nu = nu;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nsemomentum3d_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> d1, std::shared_ptr<const dolfin::GenericFunction> d2, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->w = *w;
-    this->d1 = *d1;
-    this->d2 = *d2;
-    this->k = *k;
-    this->nu = *nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new nsemomentum3d_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -7438,6 +7278,8 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_w;
   typedef Form_a_FunctionSpace_3 CoefficientSpace_d1;
   typedef Form_a_FunctionSpace_4 CoefficientSpace_d2;
@@ -7445,17 +7287,20 @@ public:
   typedef Form_a_FunctionSpace_6 CoefficientSpace_nu;
 
   // Coefficients
-  dolfin::CoefficientAssigner w;
-  dolfin::CoefficientAssigner d1;
-  dolfin::CoefficientAssigner d2;
-  dolfin::CoefficientAssigner k;
-  dolfin::CoefficientAssigner nu;
+  dolfin::MultiMeshCoefficientAssigner w;
+  dolfin::MultiMeshCoefficientAssigner d1;
+  dolfin::MultiMeshCoefficientAssigner d2;
+  dolfin::MultiMeshCoefficientAssigner k;
+  dolfin::MultiMeshCoefficientAssigner nu;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/assembly/cpp/forms/Poisson2DP1.h b/bench/fem/assembly/cpp/forms/Poisson2DP1.h
index 2ba3fa9..c328953 100644
--- a/bench/fem/assembly/cpp/forms/Poisson2DP1.h
+++ b/bench/fem/assembly/cpp/forms/Poisson2DP1.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON2DP1_H
 #define __POISSON2DP1_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson2dp1_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson2dp1_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2dp1_finite_element_0()
+  ~poisson2dp1_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +902,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson2dp1_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson2dp1_dofmap_0: public ufc::dofmap
+class poisson2dp1_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson2dp1_dofmap_0() : ufc::dofmap()
+  poisson2dp1_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2dp1_dofmap_0()
+  ~poisson2dp1_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -1041,270 +989,1957 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    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;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson2dp1_dofmap_0();
-  }
-
-};
-
-/// 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 poisson2dp1_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson2dp1_cell_integral_0_otherwise() : ufc::cell_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~poisson2dp1_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class poisson2dp1_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  poisson2dp1_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson2dp1_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "0c7e0f1eaace01e099992d5092e8c534c97ede7d8326d6617cd7d735806a987b695277de93283491516cb2a54e7dea47a7a058140878a03a311bcce2d1a27153";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 0;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
     switch (i)
     {
     case 0:
       {
-        return new poisson2dp1_finite_element_0();
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     case 1:
       {
-        return new poisson2dp1_finite_element_0();
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2dp1_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2dp1_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson2dp1_finite_element_1();
+  }
+
+};
+
+
+class poisson2dp1_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson2dp1_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp1_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson2dp1_dofmap_0();
+  }
+
+};
+
+
+class poisson2dp1_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson2dp1_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp1_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2dp1_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2dp1_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson2dp1_dofmap_1();
+  }
+
+};
+
+
+class poisson2dp1_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson2dp1_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson2dp1_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+  }
+
+};
+
+
+class poisson2dp1_form_0: public ufc::form
+{
+public:
+
+  poisson2dp1_form_0() : ufc::form()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp1_form_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "560105570458d6e740a11e280dfea41873e1184b3b4b6a27bdcf3b30ee48abc7f82a7d6df9ff6f71c089742611a379c666768881db214700c8fc4205d1e2ed24";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_coefficients() const final override
+  {
+    return 0;
+  }
+
+  std::size_t original_coefficient_position(std::size_t i) const final override
+  {
+    static const std::vector<std::size_t> position({});
+    return position[i];
+  }
+
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson2dp1_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson2dp1_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2dp1_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2dp1_finite_element_0();
         break;
       }
     }
@@ -1312,8 +2947,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1332,126 +2966,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson2dp1_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1465,14 +3135,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson2DP1
 {
@@ -1481,43 +3157,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp1_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp1_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1528,63 +3181,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp1_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp1_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp1_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2dp1_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1592,7 +3252,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2dp1_form_0());
+    _ufc_form = std::make_shared<const poisson2dp1_form_0>();
   }
 
   // Destructor
@@ -1622,14 +3282,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/assembly/cpp/forms/Poisson2DP2.h b/bench/fem/assembly/cpp/forms/Poisson2DP2.h
index f210d96..2b6b6e8 100644
--- a/bench/fem/assembly/cpp/forms/Poisson2DP2.h
+++ b/bench/fem/assembly/cpp/forms/Poisson2DP2.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON2DP2_H
 #define __POISSON2DP2_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson2dp2_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson2dp2_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2dp2_finite_element_0()
+  ~poisson2dp2_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,33 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -159,33 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -195,141 +192,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -339,48 +220,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -459,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -481,81 +358,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -570,9 +427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -582,11 +439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -596,11 +453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -609,9 +466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -632,81 +489,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -721,9 +558,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -733,11 +570,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -747,11 +584,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -760,9 +597,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -783,81 +620,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -872,9 +689,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -884,11 +701,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -898,11 +715,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -911,9 +728,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -930,129 +747,2692 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson2dp2_finite_element_0();
+  }
+
+};
+
+
+class poisson2dp2_finite_element_1: public ufc::finite_element
+{
+public:
+
+  poisson2dp2_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp2_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2dp2_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2dp2_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson2dp2_finite_element_1();
+  }
+
+};
+
+
+class poisson2dp2_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson2dp2_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp2_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
               for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
@@ -1124,7 +3504,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +3655,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1376,273 +3756,678 @@ public:
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson2dp2_finite_element_2();
+  }
+
+};
+
+
+class poisson2dp2_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson2dp2_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp2_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
         break;
       }
     }
     
+    return false;
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  std::size_t topological_dimension() const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    return 2;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
     }
     
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
     {
-      num_derivatives *= 2;
-    } // end loop over 'r'
+    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;
+      }
+    }
     
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    switch (d)
     {
-      return ;
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson2dp2_dofmap_0();
+  }
+
+};
+
+
+class poisson2dp2_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson2dp2_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp2_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
     {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
     
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
     
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
+        if (i > 2)
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+      throw std::runtime_error("i is larger than number of entities (2)");
       }
-    case 2:
+      
+      switch (i)
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
       }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+      
         break;
       }
-    case 4:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 5:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2dp2_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2dp2_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new poisson2dp2_finite_element_0();
+    return new poisson2dp2_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson2dp2_dofmap_0: public ufc::dofmap
+class poisson2dp2_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  poisson2dp2_dofmap_0() : ufc::dofmap()
+  poisson2dp2_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2dp2_dofmap_0()
+  ~poisson2dp2_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1666,39 +4451,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1722,25 +4496,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1769,9 +4541,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -1845,76 +4616,49 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new poisson2dp2_dofmap_0();
+    return new poisson2dp2_dofmap_2();
   }
 
 };
 
-/// 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 poisson2dp2_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2dp2_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson2dp2_cell_integral_0_otherwise()
+  ~poisson2dp2_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
@@ -1923,7 +4667,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1941,116 +4685,108 @@ public:
     
     // Compute element tensor
     A[0] = 0.5*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.500000000000002*G0_1_1;
-    A[1] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_1_0;
+    A[1] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_1_0;
     A[2] = 0.166666666666666*G0_0_1 + 0.166666666666666*G0_1_1;
     A[3] = 0.0;
     A[4] = -0.666666666666668*G0_0_1 - 0.666666666666668*G0_1_1;
-    A[5] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_1_0;
-    A[6] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_0_1;
+    A[5] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_1_0;
+    A[6] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_0_1;
     A[7] = 0.5*G0_0_0;
-    A[8] = -0.166666666666667*G0_0_1;
+    A[8] = -0.166666666666666*G0_0_1;
     A[9] = 0.666666666666664*G0_0_1;
     A[10] = 0.0;
     A[11] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_0_1;
     A[12] = 0.166666666666666*G0_1_0 + 0.166666666666666*G0_1_1;
-    A[13] = -0.166666666666667*G0_1_0;
+    A[13] = -0.166666666666666*G0_1_0;
     A[14] = 0.5*G0_1_1;
     A[15] = 0.666666666666667*G0_1_0;
-    A[16] = -0.666666666666667*G0_1_0 - 0.666666666666665*G0_1_1;
+    A[16] = -0.666666666666667*G0_1_0 - 0.666666666666666*G0_1_1;
     A[17] = 0.0;
     A[18] = 0.0;
     A[19] = 0.666666666666664*G0_1_0;
     A[20] = 0.666666666666667*G0_0_1;
-    A[21] = 1.33333333333333*G0_0_0 + 0.666666666666655*G0_0_1 + 0.666666666666655*G0_1_0 + 1.33333333333331*G0_1_1;
-    A[22] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666655*G0_1_0;
+    A[21] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333332*G0_1_1;
+    A[22] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666656*G0_1_0;
     A[23] = -0.666666666666665*G0_0_1 - 0.666666666666666*G0_1_0 - 1.33333333333332*G0_1_1;
     A[24] = -0.666666666666668*G0_1_0 - 0.666666666666668*G0_1_1;
     A[25] = 0.0;
     A[26] = -0.666666666666667*G0_0_1 - 0.666666666666665*G0_1_1;
-    A[27] = -1.33333333333333*G0_0_0 - 0.666666666666655*G0_0_1 - 0.666666666666659*G0_1_0;
+    A[27] = -1.33333333333333*G0_0_0 - 0.666666666666656*G0_0_1 - 0.666666666666659*G0_1_0;
     A[28] = 1.33333333333333*G0_0_0 + 0.666666666666659*G0_0_1 + 0.666666666666659*G0_1_0 + 1.33333333333333*G0_1_1;
-    A[29] = 0.666666666666665*G0_0_1 + 0.666666666666666*G0_1_0;
-    A[30] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_0_1;
+    A[29] = 0.666666666666665*G0_0_1 + 0.666666666666667*G0_1_0;
+    A[30] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_0_1;
     A[31] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_1_0;
     A[32] = 0.0;
     A[33] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_0 - 1.33333333333332*G0_1_1;
-    A[34] = 0.666666666666666*G0_0_1 + 0.666666666666665*G0_1_0;
+    A[34] = 0.666666666666667*G0_0_1 + 0.666666666666665*G0_1_0;
     A[35] = 1.33333333333334*G0_0_0 + 0.666666666666668*G0_0_1 + 0.666666666666668*G0_1_0 + 1.33333333333333*G0_1_1;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2dp2_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2dp2_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2dp2_form_0()
+  ~poisson2dp2_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "c3da890ea2a1e9358201da459ad7a679cb61dbf70cbb65cae200329bcac229460d1382142bb2f8ccada67d7fc6988e0ac1f0439fb399b5256bfcf725a7460ddc";
+    return "b0bb9a2ea74d021bf869d3255a82fde17ca5a120ad2872a5a25bf304d22abcd31ae3445b694daf82e47df8ff685cb10778ce7ad75d5df1480fcf7a01906835ce";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson2dp2_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson2dp2_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson2dp2_finite_element_0();
+        return new poisson2dp2_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2dp2_finite_element_0();
+        return new poisson2dp2_finite_element_2();
         break;
       }
     }
@@ -2058,19 +4794,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson2dp2_dofmap_0();
+        return new poisson2dp2_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2dp2_dofmap_0();
+        return new poisson2dp2_dofmap_2();
         break;
       }
     }
@@ -2078,126 +4813,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson2dp2_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -2211,14 +4982,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson2DP2
 {
@@ -2227,43 +5004,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp2_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp2_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp2_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2274,63 +5028,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp2_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp2_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp2_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2dp2_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -2338,7 +5099,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2dp2_form_0());
+    _ufc_form = std::make_shared<const poisson2dp2_form_0>();
   }
 
   // Destructor
@@ -2368,14 +5129,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/assembly/cpp/forms/Poisson2DP3.h b/bench/fem/assembly/cpp/forms/Poisson2DP3.h
index 7b85aa3..98697f2 100644
--- a/bench/fem/assembly/cpp/forms/Poisson2DP3.h
+++ b/bench/fem/assembly/cpp/forms/Poisson2DP3.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON2DP3_H
 #define __POISSON2DP3_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson2dp3_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson2dp3_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2dp3_finite_element_0()
+  ~poisson2dp3_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 10;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,41 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -167,41 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -211,287 +192,2690 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson2dp3_finite_element_0();
+  }
+
+};
+
+
+class poisson2dp3_finite_element_1: public ufc::finite_element
+{
+public:
+
+  poisson2dp3_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp3_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2dp3_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2dp3_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson2dp3_finite_element_1();
+  }
+
+};
+
+
+class poisson2dp3_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson2dp3_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp3_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 10;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
       basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
@@ -563,20 +2947,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -585,26 +2967,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -624,7 +3004,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -636,7 +3016,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -645,8 +3025,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -746,21 +3126,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -921,21 +3301,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1096,21 +3476,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1271,21 +3651,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1446,21 +3826,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1621,21 +4001,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1796,21 +4176,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1971,21 +4351,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2146,21 +4526,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2321,21 +4701,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2455,310 +4835,723 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 3)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[8] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[9] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[10] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[11] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[15] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[18] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[19] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson2dp3_finite_element_2();
+  }
+
+};
+
+
+class poisson2dp3_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson2dp3_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp3_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    return 2;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
     }
     
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
+        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;
+      }
+    }
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
     {
-      return ;
+    throw std::runtime_error("d is larger than dimension (2)");
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
+    switch (d)
     {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
     
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson2dp3_dofmap_0();
+  }
+
+};
+
+
+class poisson2dp3_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson2dp3_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson2dp3_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  std::size_t topological_dimension() const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    return 2;
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 2;
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 3:
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
-    case 4:
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
+        if (i > 2)
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+      throw std::runtime_error("i is larger than number of entities (2)");
       }
-    case 6:
+      
+      switch (i)
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
       }
-    case 7:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+      
         break;
       }
-    case 8:
+    case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 9:
+    case 2:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2dp3_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2dp3_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new poisson2dp3_finite_element_0();
+    return new poisson2dp3_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson2dp3_dofmap_0: public ufc::dofmap
+class poisson2dp3_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  poisson2dp3_dofmap_0() : ufc::dofmap()
+  poisson2dp3_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2dp3_dofmap_0()
+  ~poisson2dp3_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2782,39 +5575,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2838,30 +5620,28 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
+    dofs[3] = offset + 2*entity_indices[1][0];
+    dofs[4] = offset + 2*entity_indices[1][0] + 1;
+    dofs[5] = offset + 2*entity_indices[1][1];
+    dofs[6] = offset + 2*entity_indices[1][1] + 1;
+    dofs[7] = offset + 2*entity_indices[1][2];
+    dofs[8] = offset + 2*entity_indices[1][2] + 1;
     offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
+    dofs[9] = offset + entity_indices[2][0];
     offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2893,9 +5673,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2977,84 +5756,49 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new poisson2dp3_dofmap_0();
+    return new poisson2dp3_dofmap_2();
   }
 
 };
 
-/// 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 poisson2dp3_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2dp3_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson2dp3_cell_integral_0_otherwise()
+  ~poisson2dp3_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
@@ -3063,7 +5807,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3081,94 +5825,94 @@ public:
     
     // Compute element tensor
     A[0] = 0.425*G0_0_0 + 0.425*G0_0_1 + 0.425*G0_1_0 + 0.425*G0_1_1;
-    A[1] = -0.0875000000000006*G0_0_0 - 0.0875000000000017*G0_1_0;
-    A[2] = -0.0875000000000015*G0_0_1 - 0.0875000000000018*G0_1_1;
-    A[3] = -0.0374999999999995*G0_0_0 - 0.0375000000000016*G0_0_1 - 0.0375000000000009*G0_1_0 - 0.0375000000000043*G0_1_1;
-    A[4] = -0.0375000000000024*G0_0_0 - 0.0374999999999988*G0_0_1 - 0.0375000000000028*G0_1_0 - 0.0374999999999987*G0_1_1;
-    A[5] = 0.0375000000000003*G0_0_0 - 0.675*G0_0_1 + 0.0375000000000014*G0_1_0 - 0.674999999999999*G0_1_1;
-    A[6] = 0.0375000000000024*G0_0_0 + 0.3375*G0_0_1 + 0.0375000000000029*G0_1_0 + 0.3375*G0_1_1;
-    A[7] = -0.675*G0_0_0 + 0.0375000000000006*G0_0_1 - 0.675*G0_1_0 + 0.0375000000000015*G0_1_1;
-    A[8] = 0.337500000000001*G0_0_0 + 0.0375*G0_0_1 + 0.337500000000002*G0_1_0 + 0.0375000000000027*G0_1_1;
+    A[1] = -0.0875000000000003*G0_0_0 - 0.0875000000000015*G0_1_0;
+    A[2] = -0.0875000000000016*G0_0_1 - 0.0875000000000018*G0_1_1;
+    A[3] = -0.0374999999999991*G0_0_0 - 0.0375000000000009*G0_0_1 - 0.037500000000001*G0_1_0 - 0.037500000000004*G0_1_1;
+    A[4] = -0.0375000000000027*G0_0_0 - 0.037499999999999*G0_0_1 - 0.0375000000000029*G0_1_0 - 0.037499999999999*G0_1_1;
+    A[5] = 0.0375000000000003*G0_0_0 - 0.675*G0_0_1 + 0.0375000000000015*G0_1_0 - 0.674999999999999*G0_1_1;
+    A[6] = 0.0375000000000028*G0_0_0 + 0.3375*G0_0_1 + 0.0375000000000029*G0_1_0 + 0.3375*G0_1_1;
+    A[7] = -0.675*G0_0_0 + 0.0375000000000009*G0_0_1 - 0.675*G0_1_0 + 0.0375000000000018*G0_1_1;
+    A[8] = 0.3375*G0_0_0 + 0.0374999999999993*G0_0_1 + 0.337500000000001*G0_1_0 + 0.0375000000000024*G0_1_1;
     A[9] = 0.0;
-    A[10] = -0.0875000000000006*G0_0_0 - 0.0875000000000017*G0_0_1;
+    A[10] = -0.0875000000000002*G0_0_0 - 0.0875000000000015*G0_0_1;
     A[11] = 0.425000000000002*G0_0_0;
-    A[12] = 0.0875000000000005*G0_0_1;
-    A[13] = 0.037500000000002*G0_0_0 + 0.712500000000005*G0_0_1;
-    A[14] = 0.0375*G0_0_0 - 0.300000000000001*G0_0_1;
+    A[12] = 0.0875000000000004*G0_0_1;
+    A[13] = 0.037500000000002*G0_0_0 + 0.712500000000004*G0_0_1;
+    A[14] = 0.0374999999999999*G0_0_0 - 0.300000000000001*G0_0_1;
     A[15] = -0.0375000000000006*G0_0_0;
     A[16] = -0.0375*G0_0_0;
-    A[17] = 0.337500000000002*G0_0_0 + 0.3*G0_0_1;
-    A[18] = -0.675000000000003*G0_0_0 - 0.712500000000002*G0_0_1;
+    A[17] = 0.337500000000001*G0_0_0 + 0.3*G0_0_1;
+    A[18] = -0.675000000000003*G0_0_0 - 0.712500000000001*G0_0_1;
     A[19] = 0.0;
-    A[20] = -0.0875000000000015*G0_1_0 - 0.0875000000000018*G0_1_1;
+    A[20] = -0.0875000000000017*G0_1_0 - 0.0875000000000018*G0_1_1;
     A[21] = 0.0875000000000004*G0_1_0;
     A[22] = 0.425000000000003*G0_1_1;
-    A[23] = -0.3*G0_1_0 + 0.0375000000000001*G0_1_1;
-    A[24] = 0.712500000000005*G0_1_0 + 0.0375000000000014*G0_1_1;
+    A[23] = -0.3*G0_1_0 + 0.0375000000000006*G0_1_1;
+    A[24] = 0.712500000000005*G0_1_0 + 0.0375000000000009*G0_1_1;
     A[25] = 0.300000000000004*G0_1_0 + 0.337500000000005*G0_1_1;
     A[26] = -0.712500000000005*G0_1_0 - 0.675000000000005*G0_1_1;
     A[27] = -0.0375000000000021*G0_1_1;
-    A[28] = -0.0375000000000001*G0_1_1;
+    A[28] = -0.0375*G0_1_1;
     A[29] = 0.0;
-    A[30] = -0.0374999999999995*G0_0_0 - 0.0375000000000009*G0_0_1 - 0.0375000000000016*G0_1_0 - 0.0375000000000043*G0_1_1;
-    A[31] = 0.0375000000000019*G0_0_0 + 0.712500000000005*G0_1_0;
-    A[32] = -0.3*G0_0_1 + 0.0375*G0_1_1;
-    A[33] = 1.6875*G0_0_0 + 0.843750000000007*G0_0_1 + 0.843750000000007*G0_1_0 + 1.68750000000002*G0_1_1;
-    A[34] = -0.337500000000001*G0_0_0 + 0.843749999999992*G0_0_1 - 0.168750000000005*G0_1_0 - 0.337500000000009*G0_1_1;
-    A[35] = 0.337500000000002*G0_0_0 + 0.168750000000003*G0_0_1 + 0.16875*G0_1_0;
-    A[36] = 0.337500000000001*G0_0_0 + 0.168750000000004*G0_0_1 + 0.168750000000005*G0_1_0;
-    A[37] = 0.168749999999999*G0_0_1 + 0.168750000000005*G0_1_0 + 0.337499999999998*G0_1_1;
-    A[38] = -0.843749999999998*G0_0_1 - 0.843750000000008*G0_1_0 - 1.68750000000001*G0_1_1;
+    A[30] = -0.0374999999999991*G0_0_0 - 0.037500000000001*G0_0_1 - 0.0375000000000009*G0_1_0 - 0.0375000000000039*G0_1_1;
+    A[31] = 0.037500000000002*G0_0_0 + 0.712500000000004*G0_1_0;
+    A[32] = -0.3*G0_0_1 + 0.0375000000000006*G0_1_1;
+    A[33] = 1.6875*G0_0_0 + 0.843750000000007*G0_0_1 + 0.843750000000007*G0_1_0 + 1.68750000000001*G0_1_1;
+    A[34] = -0.337500000000001*G0_0_0 + 0.843749999999992*G0_0_1 - 0.168750000000004*G0_1_0 - 0.337500000000009*G0_1_1;
+    A[35] = 0.337500000000002*G0_0_0 + 0.168750000000003*G0_0_1 + 0.168750000000001*G0_1_0;
+    A[36] = 0.337500000000001*G0_0_0 + 0.168750000000004*G0_0_1 + 0.168750000000004*G0_1_0;
+    A[37] = 0.168749999999999*G0_0_1 + 0.168750000000003*G0_1_0 + 0.337499999999997*G0_1_1;
+    A[38] = -0.843749999999999*G0_0_1 - 0.843750000000007*G0_1_0 - 1.6875*G0_1_1;
     A[39] = -2.025*G0_0_0 - 1.01250000000001*G0_0_1 - 1.01250000000001*G0_1_0;
-    A[40] = -0.0375000000000024*G0_0_0 - 0.0375000000000028*G0_0_1 - 0.0374999999999988*G0_1_0 - 0.0374999999999987*G0_1_1;
+    A[40] = -0.0375000000000027*G0_0_0 - 0.0375000000000028*G0_0_1 - 0.037499999999999*G0_1_0 - 0.037499999999999*G0_1_1;
     A[41] = 0.0374999999999999*G0_0_0 - 0.300000000000001*G0_1_0;
-    A[42] = 0.712500000000005*G0_0_1 + 0.0375000000000014*G0_1_1;
-    A[43] = -0.337500000000001*G0_0_0 - 0.168750000000005*G0_0_1 + 0.843749999999992*G0_1_0 - 0.337500000000009*G0_1_1;
-    A[44] = 1.68750000000001*G0_0_0 + 0.843750000000002*G0_0_1 + 0.843750000000002*G0_1_0 + 1.6875*G0_1_1;
-    A[45] = 0.33750000000001*G0_0_0 + 0.168750000000008*G0_0_1 + 0.16875000000001*G0_1_0;
-    A[46] = -1.68750000000001*G0_0_0 - 0.843750000000007*G0_0_1 - 0.843750000000003*G0_1_0;
-    A[47] = 0.168749999999999*G0_0_1 + 0.16875*G0_1_0 + 0.337500000000005*G0_1_1;
-    A[48] = 0.168750000000004*G0_0_1 + 0.168750000000001*G0_1_0 + 0.33750000000001*G0_1_1;
+    A[42] = 0.712500000000005*G0_0_1 + 0.0375000000000009*G0_1_1;
+    A[43] = -0.337500000000001*G0_0_0 - 0.168750000000004*G0_0_1 + 0.843749999999992*G0_1_0 - 0.337500000000009*G0_1_1;
+    A[44] = 1.68750000000001*G0_0_0 + 0.843750000000001*G0_0_1 + 0.843750000000001*G0_1_0 + 1.6875*G0_1_1;
+    A[45] = 0.33750000000001*G0_0_0 + 0.168750000000008*G0_0_1 + 0.168750000000009*G0_1_0;
+    A[46] = -1.68750000000001*G0_0_0 - 0.843750000000006*G0_0_1 - 0.843750000000002*G0_1_0;
+    A[47] = 0.16875*G0_0_1 + 0.16875*G0_1_0 + 0.337500000000005*G0_1_1;
+    A[48] = 0.168750000000004*G0_0_1 + 0.16875*G0_1_0 + 0.33750000000001*G0_1_1;
     A[49] = -1.01250000000001*G0_0_1 - 1.0125*G0_1_0 - 2.02500000000001*G0_1_1;
-    A[50] = 0.0375000000000002*G0_0_0 + 0.0375000000000013*G0_0_1 - 0.675*G0_1_0 - 0.674999999999999*G0_1_1;
+    A[50] = 0.0375000000000003*G0_0_0 + 0.0375000000000015*G0_0_1 - 0.675*G0_1_0 - 0.675*G0_1_1;
     A[51] = -0.0375000000000006*G0_0_0;
     A[52] = 0.300000000000004*G0_0_1 + 0.337500000000005*G0_1_1;
-    A[53] = 0.337500000000002*G0_0_0 + 0.16875*G0_0_1 + 0.168750000000003*G0_1_0;
-    A[54] = 0.33750000000001*G0_0_0 + 0.16875000000001*G0_0_1 + 0.168750000000009*G0_1_0;
-    A[55] = 1.6875*G0_0_0 + 0.843750000000001*G0_0_1 + 0.843750000000001*G0_1_0 + 1.6875*G0_1_1;
-    A[56] = -0.33750000000001*G0_0_0 - 1.18125000000001*G0_0_1 - 0.168750000000009*G0_1_0 - 1.35000000000001*G0_1_1;
-    A[57] = 0.84375*G0_0_1 + 0.843749999999996*G0_1_0;
-    A[58] = -0.168750000000003*G0_0_1 - 0.16875*G0_1_0;
+    A[53] = 0.337500000000002*G0_0_0 + 0.168750000000001*G0_0_1 + 0.168750000000003*G0_1_0;
+    A[54] = 0.33750000000001*G0_0_0 + 0.168750000000009*G0_0_1 + 0.168750000000008*G0_1_0;
+    A[55] = 1.6875*G0_0_0 + 0.84375*G0_0_1 + 0.84375*G0_1_0 + 1.6875*G0_1_1;
+    A[56] = -0.33750000000001*G0_0_0 - 1.18125000000001*G0_0_1 - 0.168750000000008*G0_1_0 - 1.35*G0_1_1;
+    A[57] = 0.843750000000001*G0_0_1 + 0.843749999999997*G0_1_0;
+    A[58] = -0.168750000000003*G0_0_1 - 0.168749999999999*G0_1_0;
     A[59] = -2.02500000000001*G0_0_0 - 1.0125*G0_0_1 - 1.0125*G0_1_0;
-    A[60] = 0.0375000000000024*G0_0_0 + 0.0375000000000029*G0_0_1 + 0.3375*G0_1_0 + 0.3375*G0_1_1;
+    A[60] = 0.0375000000000028*G0_0_0 + 0.0375000000000029*G0_0_1 + 0.3375*G0_1_0 + 0.3375*G0_1_1;
     A[61] = -0.0375*G0_0_0;
     A[62] = -0.712500000000005*G0_0_1 - 0.675000000000005*G0_1_1;
-    A[63] = 0.337500000000001*G0_0_0 + 0.168750000000005*G0_0_1 + 0.168750000000004*G0_1_0;
-    A[64] = -1.68750000000001*G0_0_0 - 0.843750000000003*G0_0_1 - 0.843750000000007*G0_1_0;
-    A[65] = -0.33750000000001*G0_0_0 - 0.168750000000009*G0_0_1 - 1.18125000000001*G0_1_0 - 1.35000000000001*G0_1_1;
+    A[63] = 0.337500000000001*G0_0_0 + 0.168750000000004*G0_0_1 + 0.168750000000004*G0_1_0;
+    A[64] = -1.68750000000001*G0_0_0 - 0.843750000000002*G0_0_1 - 0.843750000000006*G0_1_0;
+    A[65] = -0.33750000000001*G0_0_0 - 0.168750000000008*G0_0_1 - 1.18125000000001*G0_1_0 - 1.35*G0_1_1;
     A[66] = 1.68750000000001*G0_0_0 + 0.843750000000007*G0_0_1 + 0.843750000000007*G0_1_0 + 1.68750000000001*G0_1_1;
-    A[67] = -0.168749999999999*G0_0_1 - 0.168749999999996*G0_1_0;
+    A[67] = -0.16875*G0_0_1 - 0.168749999999997*G0_1_0;
     A[68] = -0.168750000000004*G0_0_1 - 0.168750000000004*G0_1_0;
-    A[69] = 1.01250000000001*G0_0_1 + 1.01250000000001*G0_1_0;
-    A[70] = -0.675*G0_0_0 - 0.675*G0_0_1 + 0.0375000000000006*G0_1_0 + 0.0375000000000015*G0_1_1;
-    A[71] = 0.337500000000002*G0_0_0 + 0.3*G0_1_0;
+    A[69] = 1.01250000000001*G0_0_1 + 1.0125*G0_1_0;
+    A[70] = -0.675*G0_0_0 - 0.675*G0_0_1 + 0.0375000000000008*G0_1_0 + 0.0375000000000018*G0_1_1;
+    A[71] = 0.337500000000001*G0_0_0 + 0.3*G0_1_0;
     A[72] = -0.0375000000000021*G0_1_1;
-    A[73] = 0.168750000000005*G0_0_1 + 0.168749999999999*G0_1_0 + 0.337499999999998*G0_1_1;
-    A[74] = 0.16875*G0_0_1 + 0.168749999999999*G0_1_0 + 0.337500000000005*G0_1_1;
-    A[75] = 0.843749999999996*G0_0_1 + 0.84375*G0_1_0;
-    A[76] = -0.168749999999996*G0_0_1 - 0.168749999999999*G0_1_0;
-    A[77] = 1.6875*G0_0_0 + 0.843749999999999*G0_0_1 + 0.843749999999999*G0_1_0 + 1.68750000000001*G0_1_1;
-    A[78] = -1.35*G0_0_0 - 0.168750000000004*G0_0_1 - 1.18125*G0_1_0 - 0.337500000000001*G0_1_1;
+    A[73] = 0.168750000000003*G0_0_1 + 0.168749999999999*G0_1_0 + 0.337499999999998*G0_1_1;
+    A[74] = 0.16875*G0_0_1 + 0.16875*G0_1_0 + 0.337500000000005*G0_1_1;
+    A[75] = 0.843749999999997*G0_0_1 + 0.843750000000001*G0_1_0;
+    A[76] = -0.168749999999997*G0_0_1 - 0.16875*G0_1_0;
+    A[77] = 1.6875*G0_0_0 + 0.843749999999998*G0_0_1 + 0.843749999999998*G0_1_0 + 1.68750000000001*G0_1_1;
+    A[78] = -1.35*G0_0_0 - 0.168750000000003*G0_0_1 - 1.18125*G0_1_0 - 0.3375*G0_1_1;
     A[79] = -1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.025*G0_1_1;
-    A[80] = 0.337500000000001*G0_0_0 + 0.337500000000002*G0_0_1 + 0.0375*G0_1_0 + 0.0375000000000027*G0_1_1;
-    A[81] = -0.675000000000003*G0_0_0 - 0.712500000000002*G0_1_0;
-    A[82] = -0.0375000000000001*G0_1_1;
-    A[83] = -0.843750000000008*G0_0_1 - 0.843749999999999*G0_1_0 - 1.68750000000001*G0_1_1;
-    A[84] = 0.168750000000001*G0_0_1 + 0.168750000000004*G0_1_0 + 0.33750000000001*G0_1_1;
-    A[85] = -0.16875*G0_0_1 - 0.168750000000003*G0_1_0;
+    A[80] = 0.3375*G0_0_0 + 0.337500000000001*G0_0_1 + 0.0374999999999993*G0_1_0 + 0.0375000000000024*G0_1_1;
+    A[81] = -0.675000000000003*G0_0_0 - 0.712500000000001*G0_1_0;
+    A[82] = -0.0375*G0_1_1;
+    A[83] = -0.843750000000007*G0_0_1 - 0.843749999999999*G0_1_0 - 1.6875*G0_1_1;
+    A[84] = 0.16875*G0_0_1 + 0.168750000000004*G0_1_0 + 0.33750000000001*G0_1_1;
+    A[85] = -0.168749999999999*G0_0_1 - 0.168750000000003*G0_1_0;
     A[86] = -0.168750000000004*G0_0_1 - 0.168750000000004*G0_1_0;
-    A[87] = -1.35*G0_0_0 - 1.18125*G0_0_1 - 0.168750000000004*G0_1_0 - 0.337500000000001*G0_1_1;
-    A[88] = 1.6875*G0_0_0 + 0.843750000000006*G0_0_1 + 0.843750000000006*G0_1_0 + 1.6875*G0_1_1;
+    A[87] = -1.35*G0_0_0 - 1.18125*G0_0_1 - 0.168750000000002*G0_1_0 - 0.3375*G0_1_1;
+    A[88] = 1.6875*G0_0_0 + 0.843750000000004*G0_0_1 + 0.843750000000004*G0_1_0 + 1.68749999999999*G0_1_1;
     A[89] = 1.0125*G0_0_1 + 1.0125*G0_1_0;
     A[90] = 0.0;
     A[91] = 0.0;
@@ -3176,7 +5920,7 @@ public:
     A[93] = -2.025*G0_0_0 - 1.01250000000001*G0_0_1 - 1.01250000000001*G0_1_0;
     A[94] = -1.0125*G0_0_1 - 1.01250000000001*G0_1_0 - 2.02500000000001*G0_1_1;
     A[95] = -2.02500000000001*G0_0_0 - 1.0125*G0_0_1 - 1.0125*G0_1_0;
-    A[96] = 1.01250000000001*G0_0_1 + 1.01250000000001*G0_1_0;
+    A[96] = 1.0125*G0_0_1 + 1.01250000000001*G0_1_0;
     A[97] = -1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.025*G0_1_1;
     A[98] = 1.0125*G0_0_1 + 1.0125*G0_1_0;
     A[99] = 4.05000000000001*G0_0_0 + 2.02500000000001*G0_0_1 + 2.02500000000001*G0_1_0 + 4.05000000000001*G0_1_1;
@@ -3184,77 +5928,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2dp3_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2dp3_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2dp3_form_0()
+  ~poisson2dp3_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "aba01d56c70a122a23e9b52fe46f2a9dc7e717ed186d3df4a004a99853fe1e4fdff15daeb926817e2966b0e3b473a58fb7b7eeb8d78ca8af15196d403b0c4970";
+    return "f3d27c01eee78f3664dfedcb125c6f8d31599b21f46f3c23dbfae4c130521ba985ff57671fd0a826ebea49015cdbfa10e45eb52b6bd7df817fd54de4192580ea";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson2dp3_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson2dp3_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson2dp3_finite_element_0();
+        return new poisson2dp3_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2dp3_finite_element_0();
+        return new poisson2dp3_finite_element_2();
         break;
       }
     }
@@ -3262,19 +5998,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson2dp3_dofmap_0();
+        return new poisson2dp3_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2dp3_dofmap_0();
+        return new poisson2dp3_dofmap_2();
         break;
       }
     }
@@ -3282,126 +6017,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson2dp3_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -3415,14 +6186,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson2DP3
 {
@@ -3431,43 +6208,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp3_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp3_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp3_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -3478,63 +6232,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp3_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp3_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2dp3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2dp3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2dp3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2dp3_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2dp3_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -3542,7 +6303,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2dp3_form_0());
+    _ufc_form = std::make_shared<const poisson2dp3_form_0>();
   }
 
   // Destructor
@@ -3572,14 +6333,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/assembly/cpp/forms/StabStokes2D.h b/bench/fem/assembly/cpp/forms/StabStokes2D.h
index e3beb0a..a6cf7a2 100644
--- a/bench/fem/assembly/cpp/forms/StabStokes2D.h
+++ b/bench/fem/assembly/cpp/forms/StabStokes2D.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __STABSTOKES2D_H
 #define __STABSTOKES2D_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class stabstokes2d_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stabstokes2d_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_finite_element_0()
+  ~stabstokes2d_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,98 +902,104 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new stabstokes2d_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class stabstokes2d_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stabstokes2d_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_finite_element_1()
+  ~stabstokes2d_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1004,16 +1013,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1022,8 +1045,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1206,20 +1229,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1228,7 +1249,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1236,21 +1257,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1270,7 +1289,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1282,7 +1301,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1291,8 +1310,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2137,28 +2156,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2194,7 +2211,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2202,22 +2219,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2228,48 +2243,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -2279,50 +2294,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2334,30 +2347,29 @@ public:
     vertex_values[5] = dof_values[5];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2376,84 +2388,102 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new stabstokes2d_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class stabstokes2d_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stabstokes2d_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_finite_element_2()
+  ~stabstokes2d_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2487,41 +2517,37 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2541,7 +2567,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2553,44 +2579,40 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -2601,8 +2623,8 @@ public:
     {
     case 0:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -2612,30 +2634,28 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2643,98 +2663,100 @@ public:
     vertex_values[2] = dof_values[0];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new stabstokes2d_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class stabstokes2d_finite_element_3: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stabstokes2d_finite_element_3() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_finite_element_3()
+  ~stabstokes2d_finite_element_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None), **{'value_shape': (3,) })";
+    return "MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), FiniteElement('Discontinuous Lagrange', triangle, 0))";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 7;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2748,16 +2770,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2766,8 +2802,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2973,20 +3009,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2995,7 +3029,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 7; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -3003,21 +3037,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -3037,7 +3069,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -3049,7 +3081,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3058,8 +3090,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -4021,28 +4053,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4078,7 +4108,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 7; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -4086,22 +4116,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -4112,56 +4140,56 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 6:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -4171,54 +4199,52 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[6] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4234,30 +4260,31 @@ public:
     vertex_values[8] = dof_values[6];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4276,41 +4303,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new stabstokes2d_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class stabstokes2d_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   stabstokes2d_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_dofmap_0()
+  ~stabstokes2d_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4334,39 +4354,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4390,19 +4399,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4428,9 +4435,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4481,65 +4487,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new stabstokes2d_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class stabstokes2d_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   stabstokes2d_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_dofmap_1()
+  ~stabstokes2d_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4563,39 +4549,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4619,25 +4594,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4669,9 +4642,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4725,32 +4697,13 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4769,41 +4722,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new stabstokes2d_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class stabstokes2d_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   stabstokes2d_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_dofmap_2()
+  ~stabstokes2d_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4827,39 +4773,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4883,17 +4818,15 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[2][0];
+    dofs[0] = entity_indices[2][0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4916,9 +4849,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4951,61 +4883,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new stabstokes2d_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class stabstokes2d_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   stabstokes2d_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_dofmap_3()
+  ~stabstokes2d_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), FiniteElement('Discontinuous Lagrange', triangle, 0))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5029,39 +4945,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0] + num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 7;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5085,27 +4990,25 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[6] = offset + c.entity_indices[2][0];
+    dofs[6] = offset + entity_indices[2][0];
     offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5137,9 +5040,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -5198,34 +5100,13 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5244,50 +5125,42 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new stabstokes2d_dofmap_3();
   }
 
 };
 
-/// 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 stabstokes2d_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   stabstokes2d_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_cell_integral_0_otherwise()
+  ~stabstokes2d_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5312,16 +5185,16 @@ public:
     {{-1.0, 1.0}};
     
     // Array of non-zero columns
-    static const unsigned int nzc7[2] = {0, 2};
+    static const unsigned int nzc1[2] = {0, 2};
     
     // Array of non-zero columns
-    static const unsigned int nzc8[2] = {0, 1};
+    static const unsigned int nzc2[2] = {0, 1};
     
     // Array of non-zero columns
-    static const unsigned int nzc10[2] = {3, 5};
+    static const unsigned int nzc4[2] = {3, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc11[2] = {3, 4};
+    static const unsigned int nzc5[2] = {3, 4};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 49; r++)
@@ -5330,17 +5203,17 @@ public:
     } // end loop over 'r'
     // Number of operations to compute geometry constants: 31.
     double G[11];
-    G[0] =  - K[3]*W1*det;
-    G[1] =  - K[1]*W1*det;
-    G[2] =  - K[2]*W1*det;
-    G[3] =  - K[0]*W1*det;
+    G[0] =  - K[2]*W1*det;
+    G[1] =  - K[0]*W1*det;
+    G[2] =  - K[3]*W1*det;
+    G[3] =  - K[1]*W1*det;
     G[4] = W1*det*(K[2]*K[2] + K[3]*K[3]);
     G[5] = W1*det*(K[0]*K[2] + K[1]*K[3]);
     G[6] = W1*det*(K[0]*K[0] + K[1]*K[1]);
-    G[7] = K[3]*W1*det;
-    G[8] = K[1]*W1*det;
-    G[9] = K[2]*W1*det;
-    G[10] = K[0]*W1*det;
+    G[7] = K[2]*W1*det;
+    G[8] = K[0]*W1*det;
+    G[9] = K[3]*W1*det;
+    G[10] = K[1]*W1*det;
     
     // Compute element tensor using UFL quadrature representation
     // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
@@ -5354,13 +5227,13 @@ public:
       for (unsigned int j = 0; j < 2; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc10[j]*7 + 6] += FE1_C0_D01[0][j]*G[0];
+        A[nzc1[j]*7 + 6] += FE1_C0_D01[0][j]*G[0];
         // Number of operations to compute entry: 2
-        A[nzc11[j]*7 + 6] += FE1_C0_D01[0][j]*G[1];
+        A[nzc2[j]*7 + 6] += FE1_C0_D01[0][j]*G[1];
         // Number of operations to compute entry: 2
-        A[nzc7[j]*7 + 6] += FE1_C0_D01[0][j]*G[2];
+        A[nzc4[j]*7 + 6] += FE1_C0_D01[0][j]*G[2];
         // Number of operations to compute entry: 2
-        A[nzc8[j]*7 + 6] += FE1_C0_D01[0][j]*G[3];
+        A[nzc5[j]*7 + 6] += FE1_C0_D01[0][j]*G[3];
       } // end loop over 'j'
       
       // Number of operations for primary indices: 96
@@ -5369,21 +5242,21 @@ public:
         for (unsigned int k = 0; k < 2; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc10[j]*7 + nzc10[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[4];
+          A[nzc1[j]*7 + nzc1[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[4];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*7 + nzc11[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
+          A[nzc1[j]*7 + nzc2[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*7 + nzc10[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
+          A[nzc2[j]*7 + nzc1[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*7 + nzc11[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[6];
+          A[nzc2[j]*7 + nzc2[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[6];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*7 + nzc7[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[4];
+          A[nzc4[j]*7 + nzc4[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[4];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*7 + nzc8[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
+          A[nzc4[j]*7 + nzc5[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*7 + nzc7[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
+          A[nzc5[j]*7 + nzc4[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*7 + nzc8[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[6];
+          A[nzc5[j]*7 + nzc5[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[6];
         } // end loop over 'k'
       } // end loop over 'j'
       
@@ -5391,79 +5264,71 @@ public:
       for (unsigned int k = 0; k < 2; k++)
       {
         // Number of operations to compute entry: 2
-        A[6*7 + nzc10[k]] += FE1_C0_D01[0][k]*G[7];
+        A[6*7 + nzc1[k]] += FE1_C0_D01[0][k]*G[7];
         // Number of operations to compute entry: 2
-        A[6*7 + nzc11[k]] += FE1_C0_D01[0][k]*G[8];
+        A[6*7 + nzc2[k]] += FE1_C0_D01[0][k]*G[8];
         // Number of operations to compute entry: 2
-        A[6*7 + nzc7[k]] += FE1_C0_D01[0][k]*G[9];
+        A[6*7 + nzc4[k]] += FE1_C0_D01[0][k]*G[9];
         // Number of operations to compute entry: 2
-        A[6*7 + nzc8[k]] += FE1_C0_D01[0][k]*G[10];
+        A[6*7 + nzc5[k]] += FE1_C0_D01[0][k]*G[10];
       } // end loop over 'k'
     } // end loop over 'ip'
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stabstokes2d_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   stabstokes2d_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stabstokes2d_form_0()
+  ~stabstokes2d_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "0dcdec03acdc7a68b41930754a2b07c07cdfc8f5354b64bd4d552bf7253925a6e5993999b7f09f907cc8a29fac96204e0eb1ab20a84d83a52860d735fae8f084";
+    return "d0ae19f9fa2202d3bd4aab86321763af350c772f7f5d59b4c2024dccc497212ffaea5f17f91b642ad03c1cd12e99ac84de02c1ba75a537897255655508201464";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stabstokes2d_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stabstokes2d_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5487,8 +5352,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5512,126 +5376,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stabstokes2d_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -5645,14 +5545,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace StabStokes2D
 {
@@ -5661,43 +5567,20 @@ class CoefficientSpace_h: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_h(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_h(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_h(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stabstokes2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stabstokes2d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_h(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stabstokes2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stabstokes2d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5708,43 +5591,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stabstokes2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stabstokes2d_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stabstokes2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stabstokes2d_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5755,45 +5615,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stabstokes2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stabstokes2d_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stabstokes2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stabstokes2d_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stabstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stabstokes2d_dofmap_3()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -5805,75 +5682,114 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 1), h(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stabstokes2d_form_0());
+    _ufc_form = std::make_shared<const stabstokes2d_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& h):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> h):
     dolfin::Form(2, 1), h(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->h = h;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stabstokes2d_form_0());
+    _ufc_form = std::make_shared<const stabstokes2d_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> h):
-    dolfin::Form(2, 1), h(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_a()
+  {}
 
-    this->h = *h;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "h")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stabstokes2d_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 1), h(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "h";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stabstokes2d_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_h;
+
+  // Coefficients
+  dolfin::CoefficientAssigner h;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& h):
-    dolfin::Form(2, 1), h(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), h(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->h = h;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stabstokes2d_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> h):
-    dolfin::Form(2, 1), h(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> h):
+    dolfin::MultiMeshForm(V1, V0), h(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->h = *h;
+    /// Assign coefficients
+    this->h = h;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stabstokes2d_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -5906,16 +5822,21 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_h;
 
   // Coefficients
-  dolfin::CoefficientAssigner h;
+  dolfin::MultiMeshCoefficientAssigner h;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/assembly/cpp/forms/THStokes2D.h b/bench/fem/assembly/cpp/forms/THStokes2D.h
index 7141879..741839b 100644
--- a/bench/fem/assembly/cpp/forms/THStokes2D.h
+++ b/bench/fem/assembly/cpp/forms/THStokes2D.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __THSTOKES2D_H
 #define __THSTOKES2D_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class thstokes2d_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   thstokes2d_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~thstokes2d_finite_element_0()
+  ~thstokes2d_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,33 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -159,33 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -195,141 +192,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -339,48 +220,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -459,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -481,81 +358,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -570,9 +427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -582,11 +439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -596,11 +453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -609,9 +466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -632,81 +489,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -721,9 +558,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -733,11 +570,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -747,11 +584,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -760,9 +597,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -783,81 +620,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -872,9 +689,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -884,11 +701,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -898,11 +715,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -911,9 +728,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -930,42 +747,2152 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new thstokes2d_finite_element_0();
+  }
+
+};
+
+
+class thstokes2d_finite_element_1: public ufc::finite_element
+{
+public:
+
+  thstokes2d_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~thstokes2d_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new thstokes2d_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new thstokes2d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new thstokes2d_finite_element_1();
+  }
+
+};
+
+
+class thstokes2d_finite_element_2: public ufc::finite_element
+{
+public:
+
+  thstokes2d_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~thstokes2d_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[6][6] = \
@@ -973,7 +2900,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1081,7 +3008,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 1:
       {
         
       // Array of basisvalues
@@ -1108,7 +3035,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -1124,7 +3051,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1232,7 +3159,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 2:
       {
         
       // Array of basisvalues
@@ -1259,7 +3186,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -1275,7 +3202,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1383,339 +3310,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new thstokes2d_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class thstokes2d_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  thstokes2d_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~thstokes2d_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 12;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 3:
       {
         
       // Array of basisvalues
@@ -1742,52 +3337,131 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 4:
       {
         
       // Array of basisvalues
@@ -1814,16 +3488,131 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 5:
       {
         
       // Array of basisvalues
@@ -1850,160 +3639,483 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
     case 5:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new thstokes2d_finite_element_2();
+  }
+
+};
+
+
+class thstokes2d_finite_element_3: public ufc::finite_element
+{
+public:
+
+  thstokes2d_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~thstokes2d_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        return 2;
         break;
       }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        return 2;
         break;
       }
-    case 8:
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -2030,16 +4142,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 1:
       {
         
       // Array of basisvalues
@@ -2066,16 +4178,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 2:
       {
         
       // Array of basisvalues
@@ -2102,16 +4214,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 3:
       {
         
       // Array of basisvalues
@@ -2138,161 +4250,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
-      {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
+    case 4:
       {
         
       // Array of basisvalues
@@ -2317,133 +4284,18 @@ public:
       basisvalues[4] *= std::sqrt(4.5);
       basisvalues[3] *= std::sqrt(7.5);
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 5:
       {
         
       // Array of basisvalues
@@ -2470,131 +4322,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 6:
       {
         
       // Array of basisvalues
@@ -2621,131 +4358,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 7:
       {
         
       // Array of basisvalues
@@ -2772,131 +4394,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 8:
       {
         
       // Array of basisvalues
@@ -2923,131 +4430,52 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        break;
+      }
+    case 9:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 10:
       {
         
       // Array of basisvalues
@@ -3074,131 +4502,193 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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--)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          if (combinations[row][col] + 1 > 1)
+            combinations[row][col] = 0;
+          else
           {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
-    case 6:
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -3241,7 +4731,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3344,12 +4834,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 1:
       {
         
       // Array of basisvalues
@@ -3392,7 +4882,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3495,12 +4985,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 2:
       {
         
       // Array of basisvalues
@@ -3543,7 +5033,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3646,12 +5136,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 3:
       {
         
       // Array of basisvalues
@@ -3694,7 +5184,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3797,12 +5287,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 4:
       {
         
       // Array of basisvalues
@@ -3845,7 +5335,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3948,12 +5438,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 5:
       {
         
       // Array of basisvalues
@@ -3996,7 +5486,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4020,787 +5510,622 @@ public:
       double dmats_old[6][6] = \
       {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 8:
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 9:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 10:
+    case 6:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[3] = dof_values[7];
-    vertex_values[5] = dof_values[8];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new thstokes2d_finite_element_0();
-        break;
-      }
-    case 1:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new thstokes2d_finite_element_0();
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new thstokes2d_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class thstokes2d_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  thstokes2d_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~thstokes2d_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
         {
-          if (combinations[row][col] + 1 > 1)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 6; u++)
           {
-            combinations[row][col] += 1;
-            break;
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4815,9 +6140,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4827,11 +6152,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4841,11 +6166,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4854,9 +6179,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4868,70 +6193,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 10:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4946,9 +6291,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4958,11 +6303,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4972,11 +6317,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4985,9 +6330,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4999,70 +6344,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 11:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5077,9 +6442,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5089,11 +6454,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5103,11 +6468,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5116,9 +6481,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5130,7 +6495,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -5139,28 +6504,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5172,57 +6535,55 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = 0.0;
+        values[r*2*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 2)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
+        values[r*2*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
@@ -5230,164 +6591,312 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
+    case 6:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
     }
     
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[1];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[6];
+    vertex_values[3] = dof_values[7];
+    vertex_values[5] = dof_values[8];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new thstokes2d_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new thstokes2d_finite_element_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new thstokes2d_finite_element_2();
+    return new thstokes2d_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class thstokes2d_finite_element_3: public ufc::finite_element
+class thstokes2d_finite_element_4: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  thstokes2d_finite_element_3() : ufc::finite_element()
+  thstokes2d_finite_element_4() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~thstokes2d_finite_element_3()
+  ~thstokes2d_finite_element_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 15;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5401,16 +6910,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5419,8 +6942,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -5952,20 +7475,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -5974,7 +7495,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -5982,21 +7503,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -6016,7 +7535,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -6028,7 +7547,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6037,8 +7556,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -6136,7 +7655,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6287,7 +7806,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6438,7 +7957,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6589,7 +8108,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6740,7 +8259,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6891,7 +8410,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7042,7 +8561,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7193,7 +8712,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7344,7 +8863,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7495,7 +9014,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7646,7 +9165,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7797,7 +9316,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8302,28 +9821,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -8359,7 +9876,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -8367,22 +9884,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -8393,120 +9908,120 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 12:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 13:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 14:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -8516,136 +10031,247 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[12] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[13] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[14] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[6];
+    vertex_values[4] = dof_values[7];
+    vertex_values[7] = dof_values[8];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[12];
+    vertex_values[5] = dof_values[13];
+    vertex_values[8] = dof_values[14];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new thstokes2d_finite_element_3();
+        break;
+      }
+    case 1:
+      {
+        return new thstokes2d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new thstokes2d_finite_element_4();
+  }
+
+};
+
+
+class thstokes2d_dofmap_0: public ufc::dofmap
+{
+public:
+
+  thstokes2d_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~thstokes2d_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
   {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[4] = dof_values[7];
-    vertex_values[7] = dof_values[8];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[12];
-    vertex_values[5] = dof_values[13];
-    vertex_values[8] = dof_values[14];
+    return 2;
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    return num_global_entities[0];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  std::size_t num_element_dofs() const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 3;
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
-    switch (i)
+    switch (d)
     {
     case 0:
       {
-        return new thstokes2d_finite_element_1();
+        return 1;
         break;
       }
     case 1:
       {
-        return new thstokes2d_finite_element_2();
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
         break;
       }
     }
@@ -8653,41 +10279,133 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    return new thstokes2d_finite_element_3();
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new thstokes2d_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class thstokes2d_dofmap_0: public ufc::dofmap
+class thstokes2d_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  thstokes2d_dofmap_0() : ufc::dofmap()
+  thstokes2d_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~thstokes2d_dofmap_0()
+  ~thstokes2d_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -8698,7 +10416,7 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -8711,50 +10429,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0] + num_global_entities[1];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -8767,25 +10474,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -8793,30 +10498,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
-      dofs[2] = 3;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 4;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 5;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -8837,16 +10544,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -8855,30 +10565,7 @@ public:
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
@@ -8890,71 +10577,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new thstokes2d_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new thstokes2d_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new thstokes2d_dofmap_0();
+    return new thstokes2d_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class thstokes2d_dofmap_1: public ufc::dofmap
+class thstokes2d_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  thstokes2d_dofmap_1() : ufc::dofmap()
+  thstokes2d_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~thstokes2d_dofmap_1()
+  ~thstokes2d_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -8978,50 +10653,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2*num_global_entities[0] + 2*num_global_entities[1];
+    return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 1;
         break;
       }
     case 1:
       {
-        return 2;
+        return 1;
         break;
       }
     case 2:
@@ -9034,33 +10698,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9069,9 +10723,6 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
         break;
       }
     case 1:
@@ -9079,9 +10730,6 @@ public:
         dofs[0] = 0;
       dofs[1] = 2;
       dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
         break;
       }
     case 2:
@@ -9089,18 +10737,14 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9121,19 +10765,16 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 8;
           break;
         }
       }
@@ -9152,125 +10793,70 @@ public:
       case 0:
         {
           dofs[0] = 3;
-        dofs[1] = 9;
           break;
         }
       case 1:
         {
           dofs[0] = 4;
-        dofs[1] = 10;
           break;
         }
       case 2:
         {
           dofs[0] = 5;
-        dofs[1] = 11;
           break;
         }
       }
-      
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 2;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new thstokes2d_dofmap_0();
+      
         break;
       }
-    case 1:
+    case 2:
       {
-        return new thstokes2d_dofmap_0();
+        
         break;
       }
     }
     
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    return new thstokes2d_dofmap_1();
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new thstokes2d_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class thstokes2d_dofmap_2: public ufc::dofmap
+class thstokes2d_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  thstokes2d_dofmap_2() : ufc::dofmap()
+  thstokes2d_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~thstokes2d_dofmap_2()
+  ~thstokes2d_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9281,7 +10867,7 @@ public:
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -9294,50 +10880,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 0;
+        return 2;
         break;
       }
     case 2:
@@ -9350,19 +10925,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9370,27 +10957,38 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
+      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9411,16 +11009,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 8;
           break;
         }
       }
@@ -9429,7 +11030,33 @@ public:
       }
     case 1:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 9;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+        dofs[1] = 10;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+        dofs[1] = 11;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -9441,65 +11068,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new thstokes2d_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new thstokes2d_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new thstokes2d_dofmap_2();
+    return new thstokes2d_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class thstokes2d_dofmap_3: public ufc::dofmap
+class thstokes2d_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  thstokes2d_dofmap_3() : ufc::dofmap()
+  thstokes2d_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~thstokes2d_dofmap_3()
+  ~thstokes2d_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9523,39 +11144,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 15;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 8;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9579,37 +11189,35 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[12] = offset + c.entity_indices[0][0];
-    dofs[13] = offset + c.entity_indices[0][1];
-    dofs[14] = offset + c.entity_indices[0][2];
+    dofs[12] = offset + entity_indices[0][0];
+    dofs[13] = offset + entity_indices[0][1];
+    dofs[14] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9653,9 +11261,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9738,61 +11345,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new thstokes2d_dofmap_1();
+        return new thstokes2d_dofmap_3();
         break;
       }
     case 1:
       {
-        return new thstokes2d_dofmap_2();
+        return new thstokes2d_dofmap_0();
         break;
       }
     }
@@ -9800,46 +11370,38 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new thstokes2d_dofmap_3();
+    return new thstokes2d_dofmap_4();
   }
 
 };
 
-/// 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 thstokes2d_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   thstokes2d_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~thstokes2d_cell_integral_0_otherwise()
+  ~thstokes2d_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    32
@@ -9848,7 +11410,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -9903,7 +11465,7 @@ public:
     A[15] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_0_1 + 0.166666666666668*G2_0_0 + 0.166666666666666*G2_0_1;
     A[16] = 0.5*G0_0_0 + 0.5*G2_0_0;
     A[17] = -0.166666666666666*G0_0_1 - 0.166666666666666*G2_0_1;
-    A[18] = 0.666666666666663*G0_0_1 + 0.666666666666663*G2_0_1;
+    A[18] = 0.666666666666664*G0_0_1 + 0.666666666666664*G2_0_1;
     A[19] = 0.0;
     A[20] = -0.666666666666667*G0_0_0 - 0.666666666666666*G0_0_1 - 0.666666666666667*G2_0_0 - 0.666666666666666*G2_0_1;
     A[21] = 0.0;
@@ -9931,9 +11493,9 @@ public:
     A[43] = 0.0;
     A[44] = -0.166666666666667*G4_1;
     A[45] = 0.0;
-    A[46] = 0.666666666666663*G0_1_0 + 0.666666666666663*G2_1_0;
+    A[46] = 0.666666666666664*G0_1_0 + 0.666666666666664*G2_1_0;
     A[47] = 0.666666666666666*G0_0_1 + 0.666666666666666*G2_0_1;
-    A[48] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333331*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666656*G2_0_1 + 0.666666666666656*G2_1_0 + 1.33333333333331*G2_1_1;
+    A[48] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333332*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666656*G2_0_1 + 0.666666666666656*G2_1_0 + 1.33333333333332*G2_1_1;
     A[49] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666656*G0_1_0 - 1.33333333333333*G2_0_0 - 0.666666666666659*G2_0_1 - 0.666666666666656*G2_1_0;
     A[50] = -0.666666666666665*G0_0_1 - 0.666666666666666*G0_1_0 - 1.33333333333332*G0_1_1 - 0.666666666666665*G2_0_1 - 0.666666666666666*G2_1_0 - 1.33333333333332*G2_1_1;
     A[51] = 0.0;
@@ -9950,7 +11512,7 @@ public:
     A[62] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_1 - 0.666666666666666*G2_0_1 - 0.666666666666665*G2_1_1;
     A[63] = -1.33333333333333*G0_0_0 - 0.666666666666656*G0_0_1 - 0.666666666666659*G0_1_0 - 1.33333333333333*G2_0_0 - 0.666666666666656*G2_0_1 - 0.666666666666659*G2_1_0;
     A[64] = 1.33333333333333*G0_0_0 + 0.666666666666659*G0_0_1 + 0.666666666666659*G0_1_0 + 1.33333333333333*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666659*G2_0_1 + 0.666666666666659*G2_1_0 + 1.33333333333333*G2_1_1;
-    A[65] = 0.666666666666665*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666665*G2_1_0;
+    A[65] = 0.666666666666665*G0_0_1 + 0.666666666666666*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666666*G2_1_0;
     A[66] = 0.0;
     A[67] = 0.0;
     A[68] = 0.0;
@@ -9964,7 +11526,7 @@ public:
     A[76] = -0.666666666666667*G0_0_0 - 0.666666666666666*G0_1_0 - 0.666666666666667*G2_0_0 - 0.666666666666666*G2_1_0;
     A[77] = 0.0;
     A[78] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_0 - 1.33333333333332*G0_1_1 - 0.666666666666666*G2_0_1 - 0.666666666666665*G2_1_0 - 1.33333333333332*G2_1_1;
-    A[79] = 0.666666666666665*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666665*G2_1_0;
+    A[79] = 0.666666666666666*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666666*G2_0_1 + 0.666666666666665*G2_1_0;
     A[80] = 1.33333333333333*G0_0_0 + 0.666666666666667*G0_0_1 + 0.666666666666667*G0_1_0 + 1.33333333333333*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666667*G2_0_1 + 0.666666666666667*G2_1_0 + 1.33333333333333*G2_1_1;
     A[81] = 0.0;
     A[82] = 0.0;
@@ -9999,7 +11561,7 @@ public:
     A[111] = 0.166666666666668*G1_0_0 + 0.166666666666666*G1_0_1 + 0.166666666666668*G3_0_0 + 0.166666666666666*G3_0_1;
     A[112] = 0.5*G1_0_0 + 0.5*G3_0_0;
     A[113] = -0.166666666666666*G1_0_1 - 0.166666666666666*G3_0_1;
-    A[114] = 0.666666666666663*G1_0_1 + 0.666666666666663*G3_0_1;
+    A[114] = 0.666666666666664*G1_0_1 + 0.666666666666664*G3_0_1;
     A[115] = 0.0;
     A[116] = -0.666666666666667*G1_0_0 - 0.666666666666666*G1_0_1 - 0.666666666666667*G3_0_0 - 0.666666666666666*G3_0_1;
     A[117] = 0.0;
@@ -10027,9 +11589,9 @@ public:
     A[139] = 0.0;
     A[140] = 0.0;
     A[141] = 0.0;
-    A[142] = 0.666666666666663*G1_1_0 + 0.666666666666663*G3_1_0;
+    A[142] = 0.666666666666664*G1_1_0 + 0.666666666666664*G3_1_0;
     A[143] = 0.666666666666666*G1_0_1 + 0.666666666666666*G3_0_1;
-    A[144] = 1.33333333333333*G1_0_0 + 0.666666666666656*G1_0_1 + 0.666666666666656*G1_1_0 + 1.33333333333331*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666656*G3_0_1 + 0.666666666666656*G3_1_0 + 1.33333333333331*G3_1_1;
+    A[144] = 1.33333333333333*G1_0_0 + 0.666666666666656*G1_0_1 + 0.666666666666656*G1_1_0 + 1.33333333333332*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666656*G3_0_1 + 0.666666666666656*G3_1_0 + 1.33333333333332*G3_1_1;
     A[145] = -1.33333333333333*G1_0_0 - 0.666666666666659*G1_0_1 - 0.666666666666656*G1_1_0 - 1.33333333333333*G3_0_0 - 0.666666666666659*G3_0_1 - 0.666666666666656*G3_1_0;
     A[146] = -0.666666666666665*G1_0_1 - 0.666666666666666*G1_1_0 - 1.33333333333332*G1_1_1 - 0.666666666666665*G3_0_1 - 0.666666666666666*G3_1_0 - 1.33333333333332*G3_1_1;
     A[147] = -0.166666666666666*G5_0 - 0.166666666666665*G5_1;
@@ -10046,7 +11608,7 @@ public:
     A[158] = -0.666666666666666*G1_0_1 - 0.666666666666665*G1_1_1 - 0.666666666666666*G3_0_1 - 0.666666666666665*G3_1_1;
     A[159] = -1.33333333333333*G1_0_0 - 0.666666666666656*G1_0_1 - 0.666666666666659*G1_1_0 - 1.33333333333333*G3_0_0 - 0.666666666666656*G3_0_1 - 0.666666666666659*G3_1_0;
     A[160] = 1.33333333333333*G1_0_0 + 0.666666666666659*G1_0_1 + 0.666666666666659*G1_1_0 + 1.33333333333333*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666659*G3_0_1 + 0.666666666666659*G3_1_0 + 1.33333333333333*G3_1_1;
-    A[161] = 0.666666666666665*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666665*G3_1_0;
+    A[161] = 0.666666666666665*G1_0_1 + 0.666666666666666*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666666*G3_1_0;
     A[162] = 0.166666666666666*G5_0 - 0.166666666666668*G5_1;
     A[163] = 0.166666666666666*G5_0;
     A[164] = 0.333333333333333*G5_0 + 0.166666666666665*G5_1;
@@ -10060,7 +11622,7 @@ public:
     A[172] = -0.666666666666667*G1_0_0 - 0.666666666666666*G1_1_0 - 0.666666666666667*G3_0_0 - 0.666666666666666*G3_1_0;
     A[173] = 0.0;
     A[174] = -0.666666666666666*G1_0_1 - 0.666666666666665*G1_1_0 - 1.33333333333332*G1_1_1 - 0.666666666666666*G3_0_1 - 0.666666666666665*G3_1_0 - 1.33333333333332*G3_1_1;
-    A[175] = 0.666666666666665*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666665*G3_1_0;
+    A[175] = 0.666666666666666*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666666*G3_0_1 + 0.666666666666665*G3_1_0;
     A[176] = 1.33333333333333*G1_0_0 + 0.666666666666667*G1_0_1 + 0.666666666666667*G1_1_0 + 1.33333333333333*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666667*G3_0_1 + 0.666666666666667*G3_1_0 + 1.33333333333333*G3_1_1;
     A[177] = -0.166666666666667*G5_0 + 0.166666666666667*G5_1;
     A[178] = 0.166666666666667*G5_0 + 0.333333333333333*G5_1;
@@ -10114,77 +11676,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class thstokes2d_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   thstokes2d_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~thstokes2d_form_0()
+  ~thstokes2d_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "b09b377c06ecc96e334de0b26d6f197196a371cfb88886cd25459d7d06fa6d98a8c24516f87cc94c5254744e71491a4877bfb352e417944a8f69d7ae365c5e61";
+    return "e4d3ecbcdcc80b02d3c0adee30cc75bba2be1e9a878bd5bcbaad2828d515a74c3f10875315ab6377135f3f73085ca535c1ae31a4c3cec4e7cad1313629a5cc25";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new thstokes2d_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new thstokes2d_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new thstokes2d_finite_element_3();
+        return new thstokes2d_finite_element_4();
         break;
       }
     case 1:
       {
-        return new thstokes2d_finite_element_3();
+        return new thstokes2d_finite_element_4();
         break;
       }
     }
@@ -10192,19 +11746,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new thstokes2d_dofmap_3();
+        return new thstokes2d_dofmap_4();
         break;
       }
     case 1:
       {
-        return new thstokes2d_dofmap_3();
+        return new thstokes2d_dofmap_4();
         break;
       }
     }
@@ -10212,126 +11765,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new thstokes2d_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -10345,14 +11934,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace THStokes2D
 {
@@ -10361,43 +11956,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new thstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new thstokes2d_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new thstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new thstokes2d_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new thstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new thstokes2d_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<thstokes2d_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<thstokes2d_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new thstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new thstokes2d_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<thstokes2d_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<thstokes2d_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -10408,63 +11980,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new thstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new thstokes2d_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<thstokes2d_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<thstokes2d_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new thstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new thstokes2d_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<thstokes2d_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<thstokes2d_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new thstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new thstokes2d_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new thstokes2d_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new thstokes2d_dofmap_3()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new thstokes2d_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -10472,7 +12051,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new thstokes2d_form_0());
+    _ufc_form = std::make_shared<const thstokes2d_form_0>();
   }
 
   // Destructor
@@ -10502,14 +12081,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/assembly/cpp/forms/compile.log b/bench/fem/assembly/cpp/forms/compile.log
index 0cefad1..58917b6 100644
--- a/bench/fem/assembly/cpp/forms/compile.log
+++ b/bench/fem/assembly/cpp/forms/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson2DP1
 
@@ -12,26 +13,34 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.0365479 seconds.
+Compiler stage 1 finished in 0.0933712 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -41,7 +50,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000707 seconds
+  36 entries computed in 0.00112 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -49,87 +58,78 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00477505 seconds.
+Compiler stage 2 finished in 0.017751 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000159025 seconds.
+Compiler stage 3 finished in 0.00027895 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.035336 seconds.
+Compiler stage 4 finished in 0.145894 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000392199 seconds.
+Compiler stage 4.1 finished in 0.00122404 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson2DP1.h.
-Compiler stage 5 finished in 0.000580072 seconds.
+Compiler stage 5 finished in 0.00143909 seconds.
 
-FFC finished in 0.07814 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.260714 seconds.
+Output written to ./Poisson2DP1.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Elasticity3D
 
@@ -149,11 +149,11 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for terminal Identity.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.0184901 seconds.
+Compiler stage 1 finished in 0.028918 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -163,9 +163,13 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 2 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -174,7 +178,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1.],
+  {1: {VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1.],
           [ 0.],
           [ 0.]],
   
@@ -582,13 +586,13 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.120016 seconds.
+Compiler stage 2 finished in 0.256037 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.0222969 seconds.
+Compiler stage 3 finished in 0.0409961 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
@@ -597,323 +601,132 @@ Compiler stage 4: Generating code
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: area
@@ -930,23 +743,24 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.228339 seconds.
+Compiler stage 4 finished in 0.369227 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000389099 seconds.
+Compiler stage 4.1 finished in 0.000780106 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Elasticity3D.h.
-Compiler stage 5 finished in 0.000782967 seconds.
+Compiler stage 5 finished in 0.00231385 seconds.
 
-FFC finished in 0.390669 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.698999 seconds.
+Output written to ./Elasticity3D.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form NSEMomentum3D
 
@@ -1028,11 +842,11 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 6
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.076798 seconds.
+Compiler stage 1 finished in 0.126585 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -1045,11 +859,17 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -1062,7 +882,17 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {4: {VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1.],
+  {4: {FiniteElement('Discontinuous Lagrange', tetrahedron, 0): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.]])}}}, VectorElement(FiniteElement('Discontinuous Lagrange', tetrahedron, 0), dim=3): {None: {None: {(0, 0, 0): array([[[ 1.,  1.,  1.,  1.],
+          [ 0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.],
+          [ 1.,  1.,  1.,  1.],
+          [ 0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.],
+          [ 1.,  1.,  1.,  1.]]])}}}, VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1.],
           [ 0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.]],
   
@@ -1318,64 +1148,25 @@ Compiler stage 2: Computing intermediate representation
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
           [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00]]])}}}, VectorElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, dim=3, quad_scheme=None): {None: {None: {(0, 0, 0): array([[[ 1.,  1.,  1.,  1.],
-          [ 0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.],
-          [ 1.,  1.,  1.,  1.],
-          [ 0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.],
-          [ 1.,  1.,  1.,  1.]]])}}}, FiniteElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.]])}}}}}
+             1.00000000e+00]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE2_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0': array([[ 1.,  0.,  0.],
-         [ 1.,  0.,  0.],
-         [ 1.,  0.,  0.],
-         [ 1.,  0.,  0.]]), 'FE1_C1': array([[ 0.,  1.,  0.],
-         [ 0.,  1.,  0.],
-         [ 0.,  1.,  0.],
-         [ 0.,  1.,  0.]]), 'FE1_C2': array([[ 0.,  0.,  1.],
-         [ 0.,  0.,  1.],
-         [ 0.,  0.,  1.],
-         [ 0.,  0.,  1.]]), 'FE2_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE2_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.5854102,  0.1381966,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.1381966,  0.5854102,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.1381966,  0.1381966,  0.5854102,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.5854102,
-           0.1381966,  0.1381966,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ]]), 'FE2_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
            0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
            0.       ,  0.       ],
          [ 0.1381966,  0.1381966,  0.5854102,  0.1381966,  0.       ,
@@ -1386,7 +1177,18 @@ Compiler stage 2: Computing intermediate representation
            0.       ,  0.       ],
          [ 0.5854102,  0.1381966,  0.1381966,  0.1381966,  0.       ,
            0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ]]), 'FE2_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ]]), 'FE1_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.5854102,  0.1381966,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.1381966,  0.5854102,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.1381966,  0.1381966,  0.5854102,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.5854102,
+           0.1381966,  0.1381966,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ]]), 'FE1_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
            0.       ,  0.       ,  0.       ,  0.1381966,  0.5854102,
            0.1381966,  0.1381966],
          [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
@@ -1397,55 +1199,25 @@ Compiler stage 2: Computing intermediate representation
            0.1381966,  0.5854102],
          [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
            0.       ,  0.       ,  0.       ,  0.5854102,  0.1381966,
-           0.1381966,  0.1381966]]), 'FE2_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE2_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.1381966,  0.1381966]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -2.77555756e-16,   1.00000000e+00,   0.00000000e+00],
+           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1460,7 +1232,13 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.,  1.,  0.],
+         [ 0.,  1.,  0.],
+         [ 0.,  1.,  0.],
+         [ 0.,  1.,  0.]]), 'FE2_C0': array([[ 1.,  0.,  0.],
+         [ 1.,  0.,  0.],
+         [ 1.,  0.,  0.],
+         [ 1.,  0.,  0.]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1475,93 +1253,19 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
-  
-  tables: {'FE2_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0': array([[ 1.,  0.,  0.],
-         [ 1.,  0.,  0.],
-         [ 1.,  0.,  0.],
-         [ 1.,  0.,  0.]]), 'FE1_C1': array([[ 0.,  1.,  0.],
-         [ 0.,  1.,  0.],
-         [ 0.,  1.,  0.],
-         [ 0.,  1.,  0.]]), 'FE1_C2': array([[ 0.,  0.,  1.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C2': array([[ 0.,  0.,  1.],
          [ 0.,  0.,  1.],
          [ 0.,  0.,  1.],
-         [ 0.,  0.,  1.]]), 'FE2_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  1.]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE2_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.5854102,  0.1381966,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.1381966,  0.5854102,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.1381966,  0.1381966,  0.5854102,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.5854102,
-           0.1381966,  0.1381966,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ]]), 'FE2_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.1381966,  0.1381966,  0.5854102,  0.1381966,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.1381966,  0.1381966,  0.1381966,  0.5854102,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.5854102,  0.1381966,  0.1381966,  0.1381966,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ]]), 'FE2_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.5854102,
-           0.1381966,  0.1381966],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
-           0.5854102,  0.1381966],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
-           0.1381966,  0.5854102],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.5854102,  0.1381966,
-           0.1381966,  0.1381966]]), 'FE2_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0': array([[ 1.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0': array([[ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE2_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ 1.]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
            -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
@@ -1576,7 +1280,7 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1591,27 +1295,101 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+  
+  tables: {'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -2.77555756e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.1381966,  0.1381966,  0.5854102,  0.1381966,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.1381966,  0.1381966,  0.1381966,  0.5854102,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.5854102,  0.1381966,  0.1381966,  0.1381966,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ]]), 'FE1_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.5854102,  0.1381966,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.1381966,  0.5854102,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.1381966,  0.1381966,  0.5854102,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.5854102,
+           0.1381966,  0.1381966,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ]]), 'FE1_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.5854102,
+           0.1381966,  0.1381966],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
+           0.5854102,  0.1381966],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
+           0.1381966,  0.5854102],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.5854102,  0.1381966,
+           0.1381966,  0.1381966]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -2.77555756e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.,  1.,  0.],
+         [ 0.,  1.,  0.],
+         [ 0.,  1.,  0.],
+         [ 0.,  1.,  0.]]), 'FE2_C0': array([[ 1.,  0.,  0.],
+         [ 1.,  0.,  0.],
+         [ 1.,  0.,  0.],
+         [ 1.,  0.,  0.]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1621,26 +1399,68 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C2': array([[ 0.,  0.,  1.],
+         [ 0.,  0.,  1.],
+         [ 0.,  0.,  1.],
+         [ 0.,  0.,  1.]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -2.77555756e-16,   1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
   
   name_map: {}
   
-  inv_name_map: {'FE2_C1_D100': 'FE2_C1_D100', 'FE0': 'FE0', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE2_C0_D100': 'FE2_C0_D100', 'FE2_C2_D100': 'FE2_C2_D100', 'FE2_C1': 'FE2_C1', 'FE2_C0': 'FE2_C0', 'FE2_C2': 'FE2_C2', 'FE2_C0_D001': 'FE2_C0_D001', 'FE2_C2_D001': 'FE2_C2_D001', 'FE2_C2_D010': 'FE2_C2_D010', 'FE2_C1_D001': 'FE2_C1_D001', 'FE2_C0_D010': 'FE2_C0_D010', 'FE2_C1_D010': 'FE2_C1_D010'}
+  inv_name_map: {'FE1_C0_D001': 'FE1_C0_D001', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE1_C0_D100': 'FE1_C0_D100', 'FE1_C2_D001': 'FE1_C2_D001', 'FE1_C0_D010': 'FE1_C0_D010', 'FE2_C1': 'FE2_C1', 'FE2_C0': 'FE2_C0', 'FE1_C1_D010': 'FE1_C1_D010', 'FE2_C2': 'FE2_C2', 'FE1_C1_D100': 'FE1_C1_D100', 'FE1_C2_D100': 'FE1_C2_D100', 'FE0': 'FE0', 'FE1_C2_D010': 'FE1_C2_D010', 'FE1_C1_D001': 'FE1_C1_D001'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE2_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966],
-         [ 0.1381966,  0.1381966,  0.5854102,  0.1381966],
-         [ 0.1381966,  0.1381966,  0.1381966,  0.5854102],
-         [ 0.5854102,  0.1381966,  0.1381966,  0.1381966]]), 'FE2_C0_D001': array([[-1.,  1.],
+  {'FE1_C0_D001': array([[-1.,  1.],
          [-1.,  1.],
          [-1.,  1.],
-         [-1.,  1.]]), 'FE0': array([[ 1.],
+         [-1.,  1.]]), 'FE1_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966],
+         [ 0.1381966,  0.1381966,  0.5854102,  0.1381966],
+         [ 0.1381966,  0.1381966,  0.1381966,  0.5854102],
+         [ 0.5854102,  0.1381966,  0.1381966,  0.1381966]]), 'FE0': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE2_C1_D100': ('FE2_C0_D001', (10, [4, 5]), False, False), 'FE0': ('FE0', (), False, True), 'FE1_C0': ('FE0', (0, [0]), False, True), 'FE1_C1': ('FE0', (1, [1]), False, True), 'FE1_C2': ('FE0', (2, [2]), False, True), 'FE2_C0_D100': ('FE2_C0_D001', (6, [0, 1]), False, False), 'FE2_C2_D100': ('FE2_C0_D001', (14, [8, 9]), False, False), 'FE2_C1': ('FE2_C0', (7, [4, 5, 6, 7]), False, False), 'FE2_C0': ('FE2_C0', (3, [0, 1, 2, 3]), False, False), 'FE2_C2': ('FE2_C0', (11, [8, 9, 10, 11]) [...]
+  {'FE1_C0_D001': ('FE1_C0_D001', (1, [0, 3]), False, False), 'FE1_C0': ('FE1_C0', (0, [0, 1, 2, 3]), False, False), 'FE1_C1': ('FE1_C0', (4, [4, 5, 6, 7]), False, False), 'FE1_C2': ('FE1_C0', (8, [8, 9, 10, 11]), False, False), 'FE1_C0_D100': ('FE1_C0_D001', (3, [0, 1]), False, False), 'FE1_C2_D001': ('FE1_C0_D001', (9, [8, 11]), False, False), 'FE1_C0_D010': ('FE1_C0_D001', (2, [0, 2]), False, False), 'FE2_C1': ('FE0', (13, [1]), False, True), 'FE2_C0': ('FE0', (12, [0]), False, True), [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -1835,13 +1655,13 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.147124 seconds.
+Compiler stage 2 finished in 0.265885 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.0586538 seconds.
+Compiler stage 3 finished in 0.10322 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
@@ -1850,397 +1670,182 @@ Compiler stage 4: Generating code
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Z
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: d_22
-  Removing unused variable: d_21
-  Removing unused variable: d_20
-  Removing unused variable: d_12
-  Removing unused variable: d_11
-  Removing unused variable: d_10
-  Removing unused variable: d_02
-  Removing unused variable: d_01
-  Removing unused variable: d_00
-  Removing unused variable: C2
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Z
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: d_22
-  Removing unused variable: d_21
-  Removing unused variable: d_20
-  Removing unused variable: d_12
-  Removing unused variable: d_11
-  Removing unused variable: d_10
-  Removing unused variable: d_02
-  Removing unused variable: d_01
-  Removing unused variable: d_00
-  Removing unused variable: C2
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Z
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: d_22
+  Removing unused variable: d_21
+  Removing unused variable: d_20
+  Removing unused variable: d_12
+  Removing unused variable: d_11
+  Removing unused variable: d_10
+  Removing unused variable: d_02
+  Removing unused variable: d_01
+  Removing unused variable: d_00
+  Removing unused variable: C2
+  Removing unused variable: C1
+  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Z
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: d_22
+  Removing unused variable: d_21
+  Removing unused variable: d_20
+  Removing unused variable: d_12
+  Removing unused variable: d_11
+  Removing unused variable: d_10
+  Removing unused variable: d_02
+  Removing unused variable: d_01
+  Removing unused variable: d_00
+  Removing unused variable: C2
+  Removing unused variable: C1
+  Removing unused variable: C0
   Generating code for 4 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: area
@@ -2257,23 +1862,24 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.298408 seconds.
+Compiler stage 4 finished in 0.431912 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000638008 seconds.
+Compiler stage 4.1 finished in 0.00201106 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./NSEMomentum3D.h.
-Compiler stage 5 finished in 0.000964165 seconds.
+Compiler stage 5 finished in 0.00182509 seconds.
 
-FFC finished in 0.58295 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.932369 seconds.
+Output written to ./NSEMomentum3D.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson2DP2
 
@@ -2286,26 +1892,37 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0796909 seconds.
+Compiler stage 1 finished in 0.215108 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -2315,7 +1932,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000731 seconds
+  144 entries computed in 0.000941 seconds
   Shape of reference tensor: (6, 6, 2, 2)
   Primary multi index:   rank = 2 dims = [6, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -2323,111 +1940,78 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00346518 seconds.
+Compiler stage 2 finished in 0.0268922 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000139952 seconds.
+Compiler stage 3 finished in 0.000219822 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.075197 seconds.
+Compiler stage 4 finished in 0.211254 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000375032 seconds.
+Compiler stage 4.1 finished in 0.000579119 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson2DP2.h.
-Compiler stage 5 finished in 0.00058794 seconds.
+Compiler stage 5 finished in 0.000978231 seconds.
 
-FFC finished in 0.159777 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.455527 seconds.
+Output written to ./Poisson2DP2.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson2DP3
 
@@ -2440,26 +2024,37 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG3(?)'
-  Unique sub elements:       'CG3(?)'
+  Unique elements:           'CG3(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG3(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.197419 seconds.
+Compiler stage 1 finished in 0.477397 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -2469,7 +2064,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  400 entries computed in 0.000955 seconds
+  400 entries computed in 0.00119 seconds
   Shape of reference tensor: (10, 10, 2, 2)
   Primary multi index:   rank = 2 dims = [10, 10] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 0], [5, 1], [5, 2], [5, 3], [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -2477,159 +2072,78 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00428987 seconds.
+Compiler stage 2 finished in 0.036521 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000156879 seconds.
+Compiler stage 3 finished in 0.000261068 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.180204 seconds.
+Compiler stage 4 finished in 0.407207 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000401974 seconds.
+Compiler stage 4.1 finished in 0.000652075 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson2DP3.h.
-Compiler stage 5 finished in 0.000724077 seconds.
+Compiler stage 5 finished in 0.00113487 seconds.
 
-FFC finished in 0.383532 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.923826 seconds.
+Output written to ./Poisson2DP3.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form StabStokes2D
 
@@ -2642,7 +2156,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'Mixed<Vector<2 x CG1(?)>, DG0(?)>, DG0(?)'
+  Unique elements:           'Mixed<Vector<2 x CG1(?)>, DG0(?)>, DG0(?), Vector<2 x 
+                             CG1(?)>'
   Unique sub elements:       'Mixed<Vector<2 x CG1(?)>, DG0(?)>, DG0(?), Vector<2 x 
                              CG1(?)>, CG1(?)'
   
@@ -2694,11 +2209,11 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 1
-  quadrature_degree: auto --> 1
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 1
+  quadrature_degree: 1
   
-Compiler stage 1 finished in 0.053503 seconds.
+Compiler stage 1 finished in 0.116892 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -2712,11 +2227,17 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -2726,170 +2247,171 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.]])}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
-          [  0.00000000e+00],
+  {1: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
           [  0.00000000e+00]],
   
          [[  8.88178420e-16],
-          [  0.00000000e+00],
           [  0.00000000e+00]],
   
          [[  1.00000000e+00],
-          [  0.00000000e+00],
-          [  0.00000000e+00]],
-  
-         [[  0.00000000e+00],
-          [ -1.00000000e+00],
           [  0.00000000e+00]],
   
          [[  0.00000000e+00],
-          [  8.88178420e-16],
-          [  0.00000000e+00]],
+          [ -1.00000000e+00]],
   
          [[  0.00000000e+00],
-          [  1.00000000e+00],
-          [  0.00000000e+00]],
+          [  8.88178420e-16]],
   
          [[  0.00000000e+00],
-          [  0.00000000e+00],
-          [  0.00000000e+00]]]), (1, 0): array([[[-1.],
-          [ 0.],
+          [  1.00000000e+00]]]), (1, 0): array([[[-1.],
           [ 0.]],
   
          [[ 1.],
-          [ 0.],
           [ 0.]],
   
          [[ 0.],
-          [ 0.],
           [ 0.]],
   
          [[ 0.],
-          [-1.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 1.],
-          [ 0.]],
+          [-1.]],
   
          [[ 0.],
-          [ 0.],
-          [ 0.]],
+          [ 1.]],
   
          [[ 0.],
-          [ 0.],
           [ 0.]]]), (0, 0): array([[[ 0.33333333],
-          [ 0.        ],
           [ 0.        ]],
   
          [[ 0.33333333],
-          [ 0.        ],
           [ 0.        ]],
   
          [[ 0.33333333],
-          [ 0.        ],
           [ 0.        ]],
   
          [[ 0.        ],
-          [ 0.33333333],
-          [ 0.        ]],
-  
-         [[ 0.        ],
-          [ 0.33333333],
-          [ 0.        ]],
+          [ 0.33333333]],
   
          [[ 0.        ],
-          [ 0.33333333],
-          [ 0.        ]],
+          [ 0.33333333]],
   
          [[ 0.        ],
-          [ 0.        ],
-          [ 1.        ]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
+          [ 0.33333333]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 0): {None: {None: {(0, 0): array([[ 1.]])}}}, MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), FiniteElement('Discontinuous Lagrange', triangle, 0)): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
+          [  0.00000000e+00],
           [  0.00000000e+00]],
   
          [[  8.88178420e-16],
+          [  0.00000000e+00],
           [  0.00000000e+00]],
   
          [[  1.00000000e+00],
+          [  0.00000000e+00],
           [  0.00000000e+00]],
   
          [[  0.00000000e+00],
-          [ -1.00000000e+00]],
+          [ -1.00000000e+00],
+          [  0.00000000e+00]],
   
          [[  0.00000000e+00],
-          [  8.88178420e-16]],
+          [  8.88178420e-16],
+          [  0.00000000e+00]],
   
          [[  0.00000000e+00],
-          [  1.00000000e+00]]]), (1, 0): array([[[-1.],
+          [  1.00000000e+00],
+          [  0.00000000e+00]],
+  
+         [[  0.00000000e+00],
+          [  0.00000000e+00],
+          [  0.00000000e+00]]]), (1, 0): array([[[-1.],
+          [ 0.],
           [ 0.]],
   
          [[ 1.],
+          [ 0.],
           [ 0.]],
   
          [[ 0.],
+          [ 0.],
           [ 0.]],
   
          [[ 0.],
-          [-1.]],
+          [-1.],
+          [ 0.]],
   
          [[ 0.],
-          [ 1.]],
+          [ 1.],
+          [ 0.]],
   
          [[ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
           [ 0.]]]), (0, 0): array([[[ 0.33333333],
+          [ 0.        ],
           [ 0.        ]],
   
          [[ 0.33333333],
+          [ 0.        ],
           [ 0.        ]],
   
          [[ 0.33333333],
+          [ 0.        ],
           [ 0.        ]],
   
          [[ 0.        ],
-          [ 0.33333333]],
+          [ 0.33333333],
+          [ 0.        ]],
   
          [[ 0.        ],
-          [ 0.33333333]],
+          [ 0.33333333],
+          [ 0.        ]],
   
          [[ 0.        ],
-          [ 0.33333333]]])}}}}}
+          [ 0.33333333],
+          [ 0.        ]],
+  
+         [[ 0.        ],
+          [ 0.        ],
+          [ 1.        ]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C2_D01': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333,  0.        ]]), 'FE1_C2': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  1.]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ]]), 'FE0': array([[ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333,  0.        ]]), 'FE2_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ,  0.        ]]), 'FE2_C2': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  1.]]), 'FE0': array([[ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D01': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.]])}
+            0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.]])}
   
   tables: {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C2_D01': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333,  0.        ]]), 'FE1_C2': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  1.]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE2_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ]]), 'FE0': array([[ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333,  0.        ]]), 'FE2_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ,  0.        ]]), 'FE2_C2': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  1.]]), 'FE0': array([[ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D01': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.]])}
+            0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.]])}
   
-  name_map: {'FE2_C2_D01': ['FE2_C2_D10']}
+  name_map: {'FE1_C2_D01': ['FE1_C2_D10']}
   
-  inv_name_map: {'FE2_C1_D01': 'FE2_C1_D01', 'FE2_C1_D10': 'FE2_C1_D10', 'FE2_C0': 'FE2_C0', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C1_D01': 'FE1_C1_D01', 'FE2_C2_D10': 'FE2_C2_D01', 'FE1_C1_D10': 'FE1_C1_D10', 'FE2_C1': 'FE2_C1', 'FE2_C0_D01': 'FE2_C0_D01', 'FE2_C2': 'FE2_C2', 'FE0': 'FE0', 'FE2_C0_D10': 'FE2_C0_D10', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE2_C2_D01': 'FE2_C2_D01'}
+  inv_name_map: {'FE2_C1_D01': 'FE2_C1_D01', 'FE2_C1': 'FE2_C1', 'FE2_C1_D10': 'FE2_C1_D10', 'FE0': 'FE0', 'FE2_C0': 'FE2_C0', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE1_C1_D10': 'FE1_C1_D10', 'FE1_C2_D10': 'FE1_C2_D01', 'FE2_C0_D01': 'FE2_C0_D01', 'FE1_C2_D01': 'FE1_C2_D01', 'FE2_C0_D10': 'FE2_C0_D10', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE1_C1_D01': 'FE1_C1_D01'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333]]), 'FE0': array([[ 1.]]), 'FE1_C0_D01': array([[-1.,  1.]]), 'FE2_C2_D01': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.]])}
+  {'FE1_C2_D01': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333]]), 'FE0': array([[ 1.]]), 'FE1_C0_D01': array([[-1.,  1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE2_C1_D01': ('FE1_C0_D01', (10, [3, 5]), False, False), 'FE2_C1_D10': ('FE1_C0_D01', (11, [3, 4]), False, False), 'FE2_C0': ('FE1_C0', (6, [0, 1, 2]), False, False), 'FE1_C0': ('FE1_C0', (0, [0, 1, 2]), False, False), 'FE1_C1': ('FE1_C0', (3, [3, 4, 5]), False, False), 'FE1_C1_D01': ('FE1_C0_D01', (4, [3, 5]), False, False), 'FE2_C2_D10': ('FE2_C2_D01', (), True, False), 'FE1_C1_D10': ('FE1_C0_D01', (5, [3, 4]), False, False), 'FE2_C1': ('FE1_C0', (9, [3, 4, 5]), False, False), 'FE2 [...]
+  {'FE2_C1_D01': ('FE1_C0_D01', (11, [3, 5]), False, False), 'FE2_C1': ('FE1_C0', (10, [3, 4, 5]), False, False), 'FE2_C1_D10': ('FE1_C0_D01', (12, [3, 4]), False, False), 'FE0': ('FE0', (), False, True), 'FE2_C0': ('FE1_C0', (7, [0, 1, 2]), False, False), 'FE1_C0': ('FE1_C0', (0, [0, 1, 2]), False, False), 'FE1_C1': ('FE1_C0', (3, [3, 4, 5]), False, False), 'FE1_C2': ('FE0', (6, [6]), False, True), 'FE1_C1_D10': ('FE1_C0_D01', (5, [3, 4]), False, False), 'FE1_C2_D10': ('FE1_C2_D01', (), [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -2936,289 +2458,92 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0362921 seconds.
+Compiler stage 2 finished in 0.067472 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.00181198 seconds.
+Compiler stage 3 finished in 0.00303197 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 4 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: Y
   Removing unused variable: X
   Removing unused variable: C1
   Removing unused variable: C0
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 4 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -3227,23 +2552,24 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.153572 seconds.
+Compiler stage 4 finished in 0.233634 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000499964 seconds.
+Compiler stage 4.1 finished in 0.000781059 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./StabStokes2D.h.
-Compiler stage 5 finished in 0.000826836 seconds.
+Compiler stage 5 finished in 0.00103617 seconds.
 
-FFC finished in 0.246843 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.423422 seconds.
+Output written to ./StabStokes2D.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form THStokes2D
 
@@ -3256,9 +2582,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>'
-  Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)>,
-                              CG1(?), CG2(?)'
+  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1(?)>,
+                              Vector<2 x CG2(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -3296,15 +2622,15 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   
-Compiler stage 1 finished in 0.109013 seconds.
+Compiler stage 1 finished in 0.237832 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -3314,11 +2640,22 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 5 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -3357,7 +2694,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00161 seconds
+  900 entries computed in 0.00219 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -3366,7 +2703,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00149 seconds
+  900 entries computed in 0.00196 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -3375,7 +2712,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00149 seconds
+  900 entries computed in 0.00292 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -3384,7 +2721,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00145 seconds
+  900 entries computed in 0.00327 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -3393,7 +2730,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00141 seconds
+  450 entries computed in 0.00192 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -3402,7 +2739,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00142 seconds
+  450 entries computed in 0.00169 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -3411,7 +2748,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00141 seconds
+  450 entries computed in 0.0017 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -3420,7 +2757,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00145 seconds
+  450 entries computed in 0.00173 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -3428,490 +2765,84 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.031162 seconds.
+Compiler stage 2 finished in 0.052774 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000180006 seconds.
+Compiler stage 3 finished in 0.000258923 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Generating code for 5 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.439503 seconds.
+Compiler stage 4 finished in 0.708637 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000382185 seconds.
+Compiler stage 4.1 finished in 0.000615835 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./THStokes2D.h.
-Compiler stage 5 finished in 0.00103712 seconds.
+Compiler stage 5 finished in 0.00195909 seconds.
 
-FFC finished in 0.581628 seconds.
+FFC finished in 1.00277 seconds.
+Output written to ./THStokes2D.h.
diff --git a/bench/fem/assembly/cpp/main.cpp b/bench/fem/assembly/cpp/main.cpp
index 665ef13..8f76565 100644
--- a/bench/fem/assembly/cpp/main.cpp
+++ b/bench/fem/assembly/cpp/main.cpp
@@ -68,7 +68,14 @@ int main(int argc, char* argv[])
   forms.push_back("navierstokes");
 
   // Backends
-  std::vector<std::string> backends = {"PETSc", "Tpetra", "Eigen", "STL"};
+  std::vector<std::string> backends = {"PETSc", "Tpetra", "Eigen"};
+  {
+    for (auto it = backends.begin(); it != backends.end();)
+      if (has_linear_algebra_backend(*it))
+        ++it;
+      else
+        it = backends.erase(it);
+  }
 
   // Override forms and backends with command-line arguments
   if (argc == 3)
diff --git a/bench/fem/convergence/cpp/CMakeLists.txt b/bench/fem/convergence/cpp/CMakeLists.txt
index 3c24daf..77a9563 100644
--- a/bench/fem/convergence/cpp/CMakeLists.txt
+++ b/bench/fem/convergence/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} Poisson3D_4.cpp Poisson3D_3.cpp Poisson3D_2.cpp Poisson2D_4.cpp Poisson2D_2.cpp Poisson3D_1.cpp Poisson2D_1.cpp Poisson2D_3.cpp main.cpp Poisson2D_5.cpp)
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_1.cpp b/bench/fem/convergence/cpp/Poisson2D_1.cpp
index bd10f3d..8498c70 100644
--- a/bench/fem/convergence/cpp/Poisson2D_1.cpp
+++ b/bench/fem/convergence/cpp/Poisson2D_1.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,81 +13,99 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "Poisson2D_1.h"
 
-/// Constructor
 poisson2d_1_finite_element_0::poisson2d_1_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_1_finite_element_0::~poisson2d_1_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* poisson2d_1_finite_element_0::signature() const
+const char * poisson2d_1_finite_element_0::signature() const
 {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
 }
 
-/// Return the cell shape
 ufc::shape poisson2d_1_finite_element_0::cell_shape() const
 {
-    return ufc::triangle;
+    return ufc::shape::triangle;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t poisson2d_1_finite_element_0::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t poisson2d_1_finite_element_0::geometric_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t poisson2d_1_finite_element_0::space_dimension() const
 {
     return 3;
 }
 
-/// Return the rank of the value space
 std::size_t poisson2d_1_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t poisson2d_1_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
+std::size_t poisson2d_1_finite_element_0::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_1_finite_element_0::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_1_finite_element_0::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_1_finite_element_0::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_1_finite_element_0::degree() const
+{
+    return 1;
+}
+
+const char * poisson2d_1_finite_element_0::family() const
+{
+    return "Lagrange";
+}
+
 void poisson2d_1_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -96,8 +114,8 @@ void poisson2d_1_finite_element_0::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -195,10 +213,9 @@ void poisson2d_1_finite_element_0::_evaluate_basis(std::size_t i,
     
 }
 
-/// Evaluate all basis functions at given point x in cell
-void poisson2d_1_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void poisson2d_1_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
@@ -207,17 +224,16 @@ void poisson2d_1_finite_element_0::_evaluate_basis_all(double* values,
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
 void poisson2d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
     
@@ -237,7 +253,7 @@ void poisson2d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -249,7 +265,7 @@ void poisson2d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -258,8 +274,8 @@ void poisson2d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -711,17 +727,16 @@ void poisson2d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
 void poisson2d_1_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
                                                     int cell_orientation)
 {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -757,7 +772,7 @@ void poisson2d_1_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -765,10 +780,9 @@ void poisson2d_1_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     } // end loop over 'r'
 }
 
-/// Evaluate linear functional for dof i on the function f
 double poisson2d_1_finite_element_0::evaluate_dof(std::size_t i,
                                    const ufc::function& f,
-                                   const double* vertex_coordinates,
+                                   const double * coordinate_dofs,
                                    int cell_orientation,
                                    const ufc::cell& c) const
 {
@@ -781,24 +795,24 @@ double poisson2d_1_finite_element_0::evaluate_dof(std::size_t i,
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -808,10 +822,9 @@ double poisson2d_1_finite_element_0::evaluate_dof(std::size_t i,
     return 0.0;
 }
 
-/// Evaluate linear functionals for all dofs on the function f
-void poisson2d_1_finite_element_0::evaluate_dofs(double* values,
+void poisson2d_1_finite_element_0::evaluate_dofs(double * values,
                                   const ufc::function& f,
-                                  const double* vertex_coordinates,
+                                  const double * coordinate_dofs,
                                   int cell_orientation,
                                   const ufc::cell& c) const
 {
@@ -820,24 +833,23 @@ void poisson2d_1_finite_element_0::evaluate_dofs(double* values,
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
 }
 
-/// Interpolate vertex values from dof values
-void poisson2d_1_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
+void poisson2d_1_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
                                               int cell_orientation,
                                               const ufc::cell& c) const
 {
@@ -847,132 +859,80 @@ void poisson2d_1_finite_element_0::interpolate_vertex_values(double* vertex_valu
     vertex_values[2] = dof_values[2];
 }
 
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void poisson2d_1_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-}
-
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void poisson2d_1_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+void poisson2d_1_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
 }
 
-/// Return the number of sub elements (for a mixed element)
 std::size_t poisson2d_1_finite_element_0::num_sub_elements() const
 {
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* poisson2d_1_finite_element_0::create_sub_element(std::size_t i) const
+ufc::finite_element * poisson2d_1_finite_element_0::create_sub_element(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::finite_element* poisson2d_1_finite_element_0::create() const
+ufc::finite_element * poisson2d_1_finite_element_0::create() const
 {
     return new poisson2d_1_finite_element_0();
 }
 
-/// Constructor
-poisson2d_1_dofmap_0::poisson2d_1_dofmap_0() : ufc::dofmap()
+
+poisson2d_1_finite_element_1::poisson2d_1_finite_element_1() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
-poisson2d_1_dofmap_0::~poisson2d_1_dofmap_0()
+poisson2d_1_finite_element_1::~poisson2d_1_finite_element_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* poisson2d_1_dofmap_0::signature() const
+const char * poisson2d_1_finite_element_1::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool poisson2d_1_dofmap_0::needs_mesh_entities(std::size_t d) const
+ufc::shape poisson2d_1_finite_element_1::cell_shape() const
 {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t poisson2d_1_dofmap_0::topological_dimension() const
+std::size_t poisson2d_1_finite_element_1::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the geometric dimension of the associated cell shape
-std::size_t poisson2d_1_dofmap_0::geometric_dimension() const
+std::size_t poisson2d_1_finite_element_1::geometric_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t poisson2d_1_dofmap_0::global_dimension(const std::vector<std::size_t>&
-                                            num_global_entities) const
-{
-    return num_global_entities[0];
-}
-
-/// Return the dimension of the local finite element function space for a cell
-std::size_t poisson2d_1_dofmap_0::num_element_dofs() const
+std::size_t poisson2d_1_finite_element_1::space_dimension() const
 {
-    return 3;
+    return 6;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t poisson2d_1_dofmap_0::num_facet_dofs() const
+std::size_t poisson2d_1_finite_element_1::value_rank() const
 {
-    return 2;
+    return 1;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t poisson2d_1_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t poisson2d_1_finite_element_1::value_dimension(std::size_t i) const
 {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -980,281 +940,1934 @@ std::size_t poisson2d_1_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void poisson2d_1_dofmap_0::tabulate_dofs(std::size_t* dofs,
-                                  const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+std::size_t poisson2d_1_finite_element_1::value_size() const
 {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void poisson2d_1_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
-                                        std::size_t facet) const
+std::size_t poisson2d_1_finite_element_1::reference_value_rank() 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;
-      }
-    }
-    
+    return 1;
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void poisson2d_1_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
-                                  std::size_t d, std::size_t i) const
+std::size_t poisson2d_1_finite_element_1::reference_value_dimension(std::size_t i) const
 {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-}
-
-/// Tabulate the coordinates of all dofs on a cell
-void poisson2d_1_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t poisson2d_1_dofmap_0::num_sub_dofmaps() const
-{
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* poisson2d_1_dofmap_0::create_sub_dofmap(std::size_t i) const
-{
-    return 0;
-}
-
-/// Create a new class instance
-ufc::dofmap* poisson2d_1_dofmap_0::create() const
-{
-    return new poisson2d_1_dofmap_0();
-}
-
-/// Constructor
-poisson2d_1_cell_integral_0_otherwise::poisson2d_1_cell_integral_0_otherwise() : ufc::cell_integral()
+std::size_t poisson2d_1_finite_element_1::reference_value_size() const
 {
-    // Do nothing
+    return 2;
 }
 
-/// Destructor
-poisson2d_1_cell_integral_0_otherwise::~poisson2d_1_cell_integral_0_otherwise()
+std::size_t poisson2d_1_finite_element_1::degree() const
 {
-    // Do nothing
+    return 1;
 }
 
-/// Tabulate which form coefficients are used by this integral
-const std::vector<bool> & poisson2d_1_cell_integral_0_otherwise::enabled_coefficients() const
+const char * poisson2d_1_finite_element_1::family() const
 {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_1_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
-                                    int cell_orientation) const
+void poisson2d_1_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
 {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
-    
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-}
-
-/// Constructor
-poisson2d_1_cell_integral_1_otherwise::poisson2d_1_cell_integral_1_otherwise() : ufc::cell_integral()
-{
-    // Do nothing
-}
-
-/// Destructor
-poisson2d_1_cell_integral_1_otherwise::~poisson2d_1_cell_integral_1_otherwise()
-{
-    // Do nothing
-}
-
-/// Tabulate which form coefficients are used by this integral
-const std::vector<bool> & poisson2d_1_cell_integral_1_otherwise::enabled_coefficients() const
-{
-    static const std::vector<bool> enabled({true});
-    return enabled;
-}
-
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_1_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
-                                    int cell_orientation) const
-{
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    3
-    // Number of operations (multiply-add pairs) for tensor contraction: 7
-    // Total number of operations (multiply-add pairs):                  13
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Compute geometry tensor
-    const double G0_0 = det*w[0][0]*(1.0);
-    const double G0_1 = det*w[0][1]*(1.0);
-    const double G0_2 = det*w[0][2]*(1.0);
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
-    // Compute element tensor
-    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
-    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
-    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
-}
-
-/// Constructor
-poisson2d_1_form_0::poisson2d_1_form_0() : ufc::form()
-{
-    // Do nothing
-}
-
-/// Destructor
-poisson2d_1_form_0::~poisson2d_1_form_0()
-{
-    // Do nothing
-}
-
-/// Return a string identifying the form
-const char* poisson2d_1_form_0::signature() const
-{
-    return "22988ca63a6060f91b7c480b8ab7bf24c51065b041f895f759d48e86dcf0f01710900a12067f5860e2f8dbc1cfb0e2d74868ae808fddd21a2dee45180a3caa5c";
-}
-
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_1_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void poisson2d_1_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_1_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_1_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_1_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+}
+
+void poisson2d_1_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+}
+
+void poisson2d_1_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+}
+
+std::size_t poisson2d_1_finite_element_1::num_sub_elements() const
+{
+    return 2;
+}
+
+ufc::finite_element * poisson2d_1_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_1_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_1_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * poisson2d_1_finite_element_1::create() const
+{
+    return new poisson2d_1_finite_element_1();
+}
+
+
+poisson2d_1_dofmap_0::poisson2d_1_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_1_dofmap_0::~poisson2d_1_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * poisson2d_1_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+}
+
+bool poisson2d_1_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson2d_1_dofmap_0::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_1_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t poisson2d_1_dofmap_0::num_element_dofs() const
+{
+    return 3;
+}
+
+std::size_t poisson2d_1_dofmap_0::num_facet_dofs() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_1_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson2d_1_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+}
+
+void poisson2d_1_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t 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;
+      }
+    }
+    
+}
+
+void poisson2d_1_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+}
+
+std::size_t poisson2d_1_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_1_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_1_dofmap_0::create() const
+{
+    return new poisson2d_1_dofmap_0();
+}
+
+
+poisson2d_1_dofmap_1::poisson2d_1_dofmap_1() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_1_dofmap_1::~poisson2d_1_dofmap_1()
+{
+    // Do nothing
+}
+
+const char * poisson2d_1_dofmap_1::signature() const
+{
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+}
+
+bool poisson2d_1_dofmap_1::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson2d_1_dofmap_1::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_1_dofmap_1::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return 2*num_global_entities[0];
+}
+
+std::size_t poisson2d_1_dofmap_1::num_element_dofs() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_1_dofmap_1::num_facet_dofs() const
+{
+    return 4;
+}
+
+std::size_t poisson2d_1_dofmap_1::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson2d_1_dofmap_1::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+}
+
+void poisson2d_1_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_1_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+}
+
+std::size_t poisson2d_1_dofmap_1::num_sub_dofmaps() const
+{
+    return 2;
+}
+
+ufc::dofmap * poisson2d_1_dofmap_1::create_sub_dofmap(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_1_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_1_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::dofmap * poisson2d_1_dofmap_1::create() const
+{
+    return new poisson2d_1_dofmap_1();
+}
+
+
+poisson2d_1_cell_integral_0_otherwise::poisson2d_1_cell_integral_0_otherwise() : ufc::cell_integral()
+{
+    
+}
+
+poisson2d_1_cell_integral_0_otherwise::~poisson2d_1_cell_integral_0_otherwise()
+{
+    
+}
+
+const std::vector<bool> & poisson2d_1_cell_integral_0_otherwise::enabled_coefficients() const
+{
+    static const std::vector<bool> enabled({});
+    return enabled;
+}
+
+void poisson2d_1_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation) const
+{
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+}
+
+
+poisson2d_1_cell_integral_1_otherwise::poisson2d_1_cell_integral_1_otherwise() : ufc::cell_integral()
+{
+    
+}
+
+poisson2d_1_cell_integral_1_otherwise::~poisson2d_1_cell_integral_1_otherwise()
+{
+    
+}
+
+const std::vector<bool> & poisson2d_1_cell_integral_1_otherwise::enabled_coefficients() const
+{
+    static const std::vector<bool> enabled({true});
+    return enabled;
+}
+
+void poisson2d_1_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation) const
+{
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    3
+    // Number of operations (multiply-add pairs) for tensor contraction: 7
+    // Total number of operations (multiply-add pairs):                  13
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0 = det*w[0][0]*(1.0);
+    const double G0_1 = det*w[0][1]*(1.0);
+    const double G0_2 = det*w[0][2]*(1.0);
+    
+    // Compute element tensor
+    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
+    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
+    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
+}
+
+
+poisson2d_1_form_0::poisson2d_1_form_0() : ufc::form()
+{
+    // Do nothing
+}
+
+poisson2d_1_form_0::~poisson2d_1_form_0()
+{
+    // Do nothing
+}
+
+const char * poisson2d_1_form_0::signature() const
+{
+    return "19b425e17889d62d86285b64713d25de6a9d28c3bf37be81e351fd1214bae8f3ab570ea127ee8fa95c6788e1b1652bd8b1a9a91f5f2e67712064bb901dcbf177";
+}
 
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_1_form_0::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_1_form_0::num_coefficients() const
 {
     return 0;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_1_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_1_form_0::create_coordinate_finite_element() const
+{
+    return new poisson2d_1_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_1_form_0::create_coordinate_dofmap() const
+{
+    return new poisson2d_1_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_1_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_1_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_1_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
@@ -1273,8 +2886,7 @@ ufc::finite_element* poisson2d_1_form_0::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_1_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_1_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
@@ -1293,172 +2905,214 @@ ufc::dofmap* poisson2d_1_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_1_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_1_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_1_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_1_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_1_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_1_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_1_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_1_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_1_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_1_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_1_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_1_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_1_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_1_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_1_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_1_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_1_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_1_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_1_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_1_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_1_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_1_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_1_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_1_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_1_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_1_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_1_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_1_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_1_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_1_form_0::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_1_form_0::create_default_cell_integral() const
 {
     return new poisson2d_1_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_1_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_1_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_1_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_1_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * poisson2d_1_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_1_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * poisson2d_1_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_1_form_0::create_default_vertex_integral() const
+ufc::interface_integral * poisson2d_1_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_1_form_0::create_default_custom_integral() const
+ufc::overlap_integral * poisson2d_1_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 poisson2d_1_form_1::poisson2d_1_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_1_form_1::~poisson2d_1_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson2d_1_form_1::signature() const
+const char * poisson2d_1_form_1::signature() const
 {
-    return "9b3ffdf60467e039d8e8a97e79c7ff10aafc42a857591aa4af5591dbc4c3a0fdb2fddbef0bbdd9059db18858572b02dab934b8253fc38648f9f82876cd336c76";
+    return "92c518e8d0beb49f0835ca6333b891530ac780c1757521b8add952f7823551f2029560f0f1c361aeb61c5d6664af01c47d85599f161e4fdf4b43e8af78c2089a";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_1_form_1::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_1_form_1::num_coefficients() const
 {
     return 1;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_1_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_1_form_1::create_coordinate_finite_element() const
+{
+    return new poisson2d_1_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_1_form_1::create_coordinate_dofmap() const
+{
+    return new poisson2d_1_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_1_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_1_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_1_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
@@ -1477,8 +3131,7 @@ ufc::finite_element* poisson2d_1_form_1::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_1_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_1_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
@@ -1497,128 +3150,163 @@ ufc::dofmap* poisson2d_1_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_1_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_1_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_1_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_1_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_1_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_1_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_1_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_1_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_1_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_1_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_1_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_1_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_1_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_1_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_1_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_1_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_1_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_1_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_1_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_1_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_1_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_1_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_1_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_1_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_1_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_1_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_1_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_1_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_1_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_1_form_1::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_1_form_1::create_default_cell_integral() const
 {
     return new poisson2d_1_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_1_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_1_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_1_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_1_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_1_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * poisson2d_1_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_1_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * poisson2d_1_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_1_form_1::create_default_custom_integral() const
+ufc::interface_integral * poisson2d_1_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_1_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_1.h b/bench/fem/convergence/cpp/Poisson2D_1.h
index ab19815..825e414 100644
--- a/bench/fem/convergence/cpp/Poisson2D_1.h
+++ b/bench/fem/convergence/cpp/Poisson2D_1.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,500 +13,569 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __POISSON2D_1_H
 #define __POISSON2D_1_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson2d_1_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson2d_1_finite_element_0();
 
-  /// Destructor
-  virtual ~poisson2d_1_finite_element_0();
+  ~poisson2d_1_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t geometric_dimension() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t space_dimension() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson2d_1_finite_element_1: public ufc::finite_element
+{
+public:
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
+  poisson2d_1_finite_element_1();
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
+  ~poisson2d_1_finite_element_1() override;
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class poisson2d_1_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   poisson2d_1_dofmap_0();
 
-  /// Destructor
-  virtual ~poisson2d_1_dofmap_0();
+  ~poisson2d_1_dofmap_0() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  std::size_t num_sub_dofmaps() const final override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  ufc::dofmap * create() const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+};
+
+
+class poisson2d_1_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson2d_1_dofmap_1();
+
+  ~poisson2d_1_dofmap_1() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 poisson2d_1_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_1_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_1_cell_integral_0_otherwise();
+  ~poisson2d_1_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 poisson2d_1_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_1_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_1_cell_integral_1_otherwise();
+  ~poisson2d_1_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_1_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_1_form_0();
 
-  /// Destructor
-  virtual ~poisson2d_1_form_0();
+  ~poisson2d_1_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  std::size_t original_coefficient_position(std::size_t i) const final override;
 
+  ufc::finite_element * create_coordinate_finite_element() const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_custom_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
+  bool has_cell_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_interior_facet_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
+  bool has_interface_integrals() const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  bool has_overlap_integrals() const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_1_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_1_form_1();
 
-  /// Destructor
-  virtual ~poisson2d_1_form_1();
+  ~poisson2d_1_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
+
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_vertex_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_cutcell_integrals() const final override;
 
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::custom_integral * create_default_custom_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -516,14 +585,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson2D_1
 {
@@ -532,43 +607,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -579,43 +631,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -626,63 +655,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_1_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -690,7 +726,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_1_form_0());
+    _ufc_form = std::make_shared<const poisson2d_1_form_0>();
   }
 
   // Destructor
@@ -720,57 +756,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -778,69 +869,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_1_form_1());
+    _ufc_form = std::make_shared<const poisson2d_1_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_1_form_1());
+    _ufc_form = std::make_shared<const poisson2d_1_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_1_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_1_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_1_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_1_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -872,18 +1004,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_2.cpp b/bench/fem/convergence/cpp/Poisson2D_2.cpp
index 3f8abc7..4522a94 100644
--- a/bench/fem/convergence/cpp/Poisson2D_2.cpp
+++ b/bench/fem/convergence/cpp/Poisson2D_2.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,81 +13,99 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "Poisson2D_2.h"
 
-/// Constructor
 poisson2d_2_finite_element_0::poisson2d_2_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_2_finite_element_0::~poisson2d_2_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* poisson2d_2_finite_element_0::signature() const
+const char * poisson2d_2_finite_element_0::signature() const
 {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
 }
 
-/// Return the cell shape
 ufc::shape poisson2d_2_finite_element_0::cell_shape() const
 {
-    return ufc::triangle;
+    return ufc::shape::triangle;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t poisson2d_2_finite_element_0::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t poisson2d_2_finite_element_0::geometric_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t poisson2d_2_finite_element_0::space_dimension() const
 {
-    return 6;
+    return 3;
 }
 
-/// Return the rank of the value space
 std::size_t poisson2d_2_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t poisson2d_2_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
+std::size_t poisson2d_2_finite_element_0::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_2_finite_element_0::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_2_finite_element_0::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_2_finite_element_0::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_2_finite_element_0::degree() const
+{
+    return 1;
+}
+
+const char * poisson2d_2_finite_element_0::family() const
+{
+    return "Lagrange";
+}
+
 void poisson2d_2_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -96,8 +114,8 @@ void poisson2d_2_finite_element_0::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -111,33 +129,25 @@ void poisson2d_2_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -147,33 +157,25 @@ void poisson2d_2_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -183,141 +185,25 @@ void poisson2d_2_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -327,29 +213,27 @@ void poisson2d_2_finite_element_0::_evaluate_basis(std::size_t i,
     
 }
 
-/// Evaluate all basis functions at given point x in cell
-void poisson2d_2_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void poisson2d_2_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
 void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
     
@@ -369,19 +253,19 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -390,18 +274,18 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -428,7 +312,7 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -450,81 +334,61 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -539,9 +403,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -551,11 +415,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -565,11 +429,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -578,9 +442,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -601,81 +465,61 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -690,9 +534,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -702,11 +546,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -716,11 +560,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -729,9 +573,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -752,81 +596,61 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -841,9 +665,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -853,11 +677,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -867,11 +691,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -880,9 +704,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -899,236 +723,642 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+}
+
+void poisson2d_2_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_2_finite_element_0::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_2_finite_element_0::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+}
+
+void poisson2d_2_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+}
+
+void poisson2d_2_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+}
+
+std::size_t poisson2d_2_finite_element_0::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_2_finite_element_0::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_2_finite_element_0::create() const
+{
+    return new poisson2d_2_finite_element_0();
+}
+
+
+poisson2d_2_finite_element_1::poisson2d_2_finite_element_1() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson2d_2_finite_element_1::~poisson2d_2_finite_element_1()
+{
+    // Do nothing
+}
+
+const char * poisson2d_2_finite_element_1::signature() const
+{
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+}
+
+ufc::shape poisson2d_2_finite_element_1::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t poisson2d_2_finite_element_1::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_2_finite_element_1::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_2_finite_element_1::space_dimension() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_2_finite_element_1::value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_2_finite_element_1::value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson2d_2_finite_element_1::value_size() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_2_finite_element_1::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_2_finite_element_1::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson2d_2_finite_element_1::reference_value_size() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_2_finite_element_1::degree() const
+{
+    return 1;
+}
+
+const char * poisson2d_2_finite_element_1::family() const
+{
+    return "Lagrange";
+}
+
+void poisson2d_2_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_2_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void poisson2d_2_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1143,9 +1373,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1155,11 +1385,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1169,11 +1399,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1182,9 +1412,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1201,85 +1431,65 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1294,9 +1504,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1306,11 +1516,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1320,11 +1530,11 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1333,9 +1543,9 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1352,236 +1562,2725 @@ void poisson2d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    }
-    
-}
-
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void poisson2d_2_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
-                                                    int cell_orientation)
-{
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 2:
       {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-}
-
-/// Evaluate linear functional for dof i on the function f
-double poisson2d_2_finite_element_0::evaluate_dof(std::size_t i,
-                                   const ufc::function& f,
-                                   const double* vertex_coordinates,
-                                   int cell_orientation,
-                                   const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_2_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_2_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_2_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+}
+
+void poisson2d_2_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+}
+
+void poisson2d_2_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+}
+
+std::size_t poisson2d_2_finite_element_1::num_sub_elements() const
+{
+    return 2;
+}
+
+ufc::finite_element * poisson2d_2_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_2_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_2_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * poisson2d_2_finite_element_1::create() const
+{
+    return new poisson2d_2_finite_element_1();
+}
+
+
+poisson2d_2_finite_element_2::poisson2d_2_finite_element_2() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson2d_2_finite_element_2::~poisson2d_2_finite_element_2()
+{
+    // Do nothing
+}
+
+const char * poisson2d_2_finite_element_2::signature() const
+{
+    return "FiniteElement('Lagrange', triangle, 2)";
+}
+
+ufc::shape poisson2d_2_finite_element_2::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t poisson2d_2_finite_element_2::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_2_finite_element_2::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_2_finite_element_2::space_dimension() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_2_finite_element_2::value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_2_finite_element_2::value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_2_finite_element_2::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_2_finite_element_2::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_2_finite_element_2::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_2_finite_element_2::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_2_finite_element_2::degree() const
+{
+    return 2;
+}
+
+const char * poisson2d_2_finite_element_2::family() const
+{
+    return "Lagrange";
+}
+
+void poisson2d_2_finite_element_2::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_2_finite_element_2::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson2d_2_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_2_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_2_finite_element_2::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_2_finite_element_2::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+}
+
+void poisson2d_2_finite_element_2::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+}
+
+void poisson2d_2_finite_element_2::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+}
+
+std::size_t poisson2d_2_finite_element_2::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_2_finite_element_2::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_2_finite_element_2::create() const
+{
+    return new poisson2d_2_finite_element_2();
+}
+
+
+poisson2d_2_dofmap_0::poisson2d_2_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_2_dofmap_0::~poisson2d_2_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * poisson2d_2_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+}
+
+bool poisson2d_2_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson2d_2_dofmap_0::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_2_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t poisson2d_2_dofmap_0::num_element_dofs() const
+{
+    return 3;
+}
+
+std::size_t poisson2d_2_dofmap_0::num_facet_dofs() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_2_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson2d_2_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+}
+
+void poisson2d_2_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t 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;
+      }
+    }
+    
+}
+
+void poisson2d_2_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+}
+
+std::size_t poisson2d_2_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_2_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_2_dofmap_0::create() const
+{
+    return new poisson2d_2_dofmap_0();
+}
+
+
+poisson2d_2_dofmap_1::poisson2d_2_dofmap_1() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_2_dofmap_1::~poisson2d_2_dofmap_1()
+{
+    // Do nothing
+}
+
+const char * poisson2d_2_dofmap_1::signature() const
+{
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+}
+
+bool poisson2d_2_dofmap_1::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson2d_2_dofmap_1::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_2_dofmap_1::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return 2*num_global_entities[0];
+}
+
+std::size_t poisson2d_2_dofmap_1::num_element_dofs() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_2_dofmap_1::num_facet_dofs() const
+{
+    return 4;
+}
+
+std::size_t poisson2d_2_dofmap_1::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson2d_2_dofmap_1::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+}
+
+void poisson2d_2_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_2_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
     
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
+        if (i > 2)
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+      throw std::runtime_error("i is larger than number of entities (2)");
       }
-    case 2:
+      
+      switch (i)
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
       }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+      
         break;
       }
-    case 4:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 5:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-}
-
-/// Evaluate linear functionals for all dofs on the function f
-void poisson2d_2_finite_element_0::evaluate_dofs(double* values,
-                                  const ufc::function& f,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation,
-                                  const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-}
-
-/// Interpolate vertex values from dof values
-void poisson2d_2_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation,
-                                              const ufc::cell& c) const
-{
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-}
-
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void poisson2d_2_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
 }
 
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void poisson2d_2_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+std::size_t poisson2d_2_dofmap_1::num_sub_dofmaps() const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 2;
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t poisson2d_2_finite_element_0::num_sub_elements() const
+ufc::dofmap * poisson2d_2_dofmap_1::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_2_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_2_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* poisson2d_2_finite_element_0::create_sub_element(std::size_t i) const
+ufc::dofmap * poisson2d_2_dofmap_1::create() const
 {
-    return 0;
+    return new poisson2d_2_dofmap_1();
 }
 
-/// Create a new class instance
-ufc::finite_element* poisson2d_2_finite_element_0::create() const
-{
-    return new poisson2d_2_finite_element_0();
-}
 
-/// Constructor
-poisson2d_2_dofmap_0::poisson2d_2_dofmap_0() : ufc::dofmap()
+poisson2d_2_dofmap_2::poisson2d_2_dofmap_2() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-poisson2d_2_dofmap_0::~poisson2d_2_dofmap_0()
+poisson2d_2_dofmap_2::~poisson2d_2_dofmap_2()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* poisson2d_2_dofmap_0::signature() const
+const char * poisson2d_2_dofmap_2::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool poisson2d_2_dofmap_0::needs_mesh_entities(std::size_t d) const
+bool poisson2d_2_dofmap_2::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
@@ -1605,39 +4304,28 @@ bool poisson2d_2_dofmap_0::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t poisson2d_2_dofmap_0::topological_dimension() const
-{
-    return 2;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t poisson2d_2_dofmap_0::geometric_dimension() const
+std::size_t poisson2d_2_dofmap_2::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t poisson2d_2_dofmap_0::global_dimension(const std::vector<std::size_t>&
+std::size_t poisson2d_2_dofmap_2::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
     return num_global_entities[0] + num_global_entities[1];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t poisson2d_2_dofmap_0::num_element_dofs() const
+std::size_t poisson2d_2_dofmap_2::num_element_dofs() const
 {
     return 6;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t poisson2d_2_dofmap_0::num_facet_dofs() const
+std::size_t poisson2d_2_dofmap_2::num_facet_dofs() const
 {
     return 3;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t poisson2d_2_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t poisson2d_2_dofmap_2::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
@@ -1661,24 +4349,22 @@ std::size_t poisson2d_2_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void poisson2d_2_dofmap_0::tabulate_dofs(std::size_t* dofs,
+void poisson2d_2_dofmap_2::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void poisson2d_2_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
+void poisson2d_2_dofmap_2::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
@@ -1708,8 +4394,7 @@ void poisson2d_2_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void poisson2d_2_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
+void poisson2d_2_dofmap_2::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 2)
@@ -1784,65 +4469,41 @@ void poisson2d_2_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void poisson2d_2_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t poisson2d_2_dofmap_0::num_sub_dofmaps() const
+std::size_t poisson2d_2_dofmap_2::num_sub_dofmaps() const
 {
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* poisson2d_2_dofmap_0::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_2_dofmap_2::create_sub_dofmap(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* poisson2d_2_dofmap_0::create() const
+ufc::dofmap * poisson2d_2_dofmap_2::create() const
 {
-    return new poisson2d_2_dofmap_0();
+    return new poisson2d_2_dofmap_2();
 }
 
-/// Constructor
+
 poisson2d_2_cell_integral_0_otherwise::poisson2d_2_cell_integral_0_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson2d_2_cell_integral_0_otherwise::~poisson2d_2_cell_integral_0_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson2d_2_cell_integral_0_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_2_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson2d_2_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -1852,7 +4513,7 @@ void poisson2d_2_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1870,66 +4531,63 @@ void poisson2d_2_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute element tensor
     A[0] = 0.5*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.500000000000002*G0_1_1;
-    A[1] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_1_0;
+    A[1] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_1_0;
     A[2] = 0.166666666666666*G0_0_1 + 0.166666666666666*G0_1_1;
     A[3] = 0.0;
     A[4] = -0.666666666666668*G0_0_1 - 0.666666666666668*G0_1_1;
-    A[5] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_1_0;
-    A[6] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_0_1;
+    A[5] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_1_0;
+    A[6] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_0_1;
     A[7] = 0.5*G0_0_0;
-    A[8] = -0.166666666666667*G0_0_1;
+    A[8] = -0.166666666666666*G0_0_1;
     A[9] = 0.666666666666664*G0_0_1;
     A[10] = 0.0;
     A[11] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_0_1;
     A[12] = 0.166666666666666*G0_1_0 + 0.166666666666666*G0_1_1;
-    A[13] = -0.166666666666667*G0_1_0;
+    A[13] = -0.166666666666666*G0_1_0;
     A[14] = 0.5*G0_1_1;
     A[15] = 0.666666666666667*G0_1_0;
-    A[16] = -0.666666666666667*G0_1_0 - 0.666666666666665*G0_1_1;
+    A[16] = -0.666666666666667*G0_1_0 - 0.666666666666666*G0_1_1;
     A[17] = 0.0;
     A[18] = 0.0;
     A[19] = 0.666666666666664*G0_1_0;
     A[20] = 0.666666666666667*G0_0_1;
-    A[21] = 1.33333333333333*G0_0_0 + 0.666666666666655*G0_0_1 + 0.666666666666655*G0_1_0 + 1.33333333333331*G0_1_1;
-    A[22] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666655*G0_1_0;
+    A[21] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333332*G0_1_1;
+    A[22] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666656*G0_1_0;
     A[23] = -0.666666666666665*G0_0_1 - 0.666666666666666*G0_1_0 - 1.33333333333332*G0_1_1;
     A[24] = -0.666666666666668*G0_1_0 - 0.666666666666668*G0_1_1;
     A[25] = 0.0;
     A[26] = -0.666666666666667*G0_0_1 - 0.666666666666665*G0_1_1;
-    A[27] = -1.33333333333333*G0_0_0 - 0.666666666666655*G0_0_1 - 0.666666666666659*G0_1_0;
+    A[27] = -1.33333333333333*G0_0_0 - 0.666666666666656*G0_0_1 - 0.666666666666659*G0_1_0;
     A[28] = 1.33333333333333*G0_0_0 + 0.666666666666659*G0_0_1 + 0.666666666666659*G0_1_0 + 1.33333333333333*G0_1_1;
-    A[29] = 0.666666666666665*G0_0_1 + 0.666666666666666*G0_1_0;
-    A[30] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_0_1;
+    A[29] = 0.666666666666665*G0_0_1 + 0.666666666666667*G0_1_0;
+    A[30] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_0_1;
     A[31] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_1_0;
     A[32] = 0.0;
     A[33] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_0 - 1.33333333333332*G0_1_1;
-    A[34] = 0.666666666666666*G0_0_1 + 0.666666666666665*G0_1_0;
+    A[34] = 0.666666666666667*G0_0_1 + 0.666666666666665*G0_1_0;
     A[35] = 1.33333333333334*G0_0_0 + 0.666666666666668*G0_0_1 + 0.666666666666668*G0_1_0 + 1.33333333333333*G0_1_1;
 }
 
-/// Constructor
+
 poisson2d_2_cell_integral_1_otherwise::poisson2d_2_cell_integral_1_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson2d_2_cell_integral_1_otherwise::~poisson2d_2_cell_integral_1_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson2d_2_cell_integral_1_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_2_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson2d_2_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -1939,7 +4597,7 @@ void poisson2d_2_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1966,58 +4624,65 @@ void poisson2d_2_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     A[5] = -0.0111111111111111*G0_2 + 0.0444444444444443*G0_3 + 0.0444444444444443*G0_4 + 0.0888888888888887*G0_5;
 }
 
-/// Constructor
+
 poisson2d_2_form_0::poisson2d_2_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_2_form_0::~poisson2d_2_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson2d_2_form_0::signature() const
+const char * poisson2d_2_form_0::signature() const
 {
-    return "5d0e26e899fb5e2ae17c683376f11127d84dee62a2be23ddc82108f9094fbac7af65da7ef0e1a9eb437b28c7b6ed8ce9f1f691fe2c926727c760a1d10f52f6da";
+    return "d023eca51774f7e21edccd888316f3e9ba9131c4ee99dc3ff5f92b32f5a44a0fb4fa9577c0daa77dd64312d069dda7a7150599923455a0de6a3dbd38085f0c41";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_2_form_0::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_2_form_0::num_coefficients() const
 {
     return 0;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_2_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_2_form_0::create_coordinate_finite_element() const
+{
+    return new poisson2d_2_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_2_form_0::create_coordinate_dofmap() const
+{
+    return new poisson2d_2_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_2_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_2_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_2_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_2_finite_element_0();
+        return new poisson2d_2_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_2_finite_element_0();
+        return new poisson2d_2_finite_element_2();
         break;
       }
     }
@@ -2025,19 +4690,18 @@ ufc::finite_element* poisson2d_2_form_0::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_2_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_2_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_2_dofmap_0();
+        return new poisson2d_2_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_2_dofmap_0();
+        return new poisson2d_2_dofmap_2();
         break;
       }
     }
@@ -2045,183 +4709,225 @@ ufc::dofmap* poisson2d_2_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_2_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_2_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_2_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_2_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_2_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_2_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_2_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_2_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_2_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_2_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_2_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_2_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_2_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_2_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_2_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_2_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_2_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_2_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_2_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_2_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_2_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_2_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_2_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_2_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_2_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_2_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_2_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_2_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_2_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_2_form_0::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_2_form_0::create_default_cell_integral() const
 {
     return new poisson2d_2_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_2_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_2_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_2_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_2_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * poisson2d_2_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_2_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * poisson2d_2_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_2_form_0::create_default_vertex_integral() const
+ufc::interface_integral * poisson2d_2_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_2_form_0::create_default_custom_integral() const
+ufc::overlap_integral * poisson2d_2_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 poisson2d_2_form_1::poisson2d_2_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_2_form_1::~poisson2d_2_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson2d_2_form_1::signature() const
+const char * poisson2d_2_form_1::signature() const
 {
-    return "07b6393b633a38325050104913c136e7e5d2b2da205ac08c6ad897ae1258184c9375821d518bfb41a40331a1e3897d3a5cbbad74735bc7a72894514860ffe114";
+    return "9050c89a2c6705ec05da94c4d5c93d1d37302b91b6887ea41c8842c0fbd8b77d1bd95bd6274fd5b43b484e3d801496a90a286f3c61fe7a258147be1208ad6abe";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_2_form_1::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_2_form_1::num_coefficients() const
 {
     return 1;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_2_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_2_form_1::create_coordinate_finite_element() const
+{
+    return new poisson2d_2_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_2_form_1::create_coordinate_dofmap() const
+{
+    return new poisson2d_2_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_2_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_2_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_2_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_2_finite_element_0();
+        return new poisson2d_2_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_2_finite_element_0();
+        return new poisson2d_2_finite_element_2();
         break;
       }
     }
@@ -2229,19 +4935,18 @@ ufc::finite_element* poisson2d_2_form_1::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_2_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_2_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_2_dofmap_0();
+        return new poisson2d_2_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_2_dofmap_0();
+        return new poisson2d_2_dofmap_2();
         break;
       }
     }
@@ -2249,128 +4954,163 @@ ufc::dofmap* poisson2d_2_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_2_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_2_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_2_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_2_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_2_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_2_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_2_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_2_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_2_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_2_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_2_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_2_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_2_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_2_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_2_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_2_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_2_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_2_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_2_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_2_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_2_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_2_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_2_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_2_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_2_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_2_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_2_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_2_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_2_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_2_form_1::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_2_form_1::create_default_cell_integral() const
 {
     return new poisson2d_2_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_2_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_2_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_2_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_2_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_2_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * poisson2d_2_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_2_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * poisson2d_2_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_2_form_1::create_default_custom_integral() const
+ufc::interface_integral * poisson2d_2_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_2_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_2.h b/bench/fem/convergence/cpp/Poisson2D_2.h
index e88dc9c..e46d1f1 100644
--- a/bench/fem/convergence/cpp/Poisson2D_2.h
+++ b/bench/fem/convergence/cpp/Poisson2D_2.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,500 +13,735 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __POISSON2D_2_H
 #define __POISSON2D_2_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson2d_2_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson2d_2_finite_element_0();
 
-  /// Destructor
-  virtual ~poisson2d_2_finite_element_0();
+  ~poisson2d_2_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t space_dimension() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson2d_2_finite_element_1: public ufc::finite_element
+{
+public:
+
+  poisson2d_2_finite_element_1();
+
+  ~poisson2d_2_finite_element_1() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson2d_2_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson2d_2_finite_element_2();
+
+  ~poisson2d_2_finite_element_2() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
+  std::size_t num_sub_elements() const final override;
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class poisson2d_2_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   poisson2d_2_dofmap_0();
 
-  /// Destructor
-  virtual ~poisson2d_2_dofmap_0();
+  ~poisson2d_2_dofmap_0() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson2d_2_dofmap_1: public ufc::dofmap
+{
+public:
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  poisson2d_2_dofmap_1();
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  ~poisson2d_2_dofmap_1() override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  const char * signature() const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson2d_2_dofmap_2: public ufc::dofmap
+{
+public:
+
+  poisson2d_2_dofmap_2();
+
+  ~poisson2d_2_dofmap_2() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
+
+  std::size_t num_facet_dofs() const final override;
+
+  std::size_t num_entity_dofs(std::size_t d) const final override;
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 poisson2d_2_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_2_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_2_cell_integral_0_otherwise();
+  ~poisson2d_2_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 poisson2d_2_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_2_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_2_cell_integral_1_otherwise();
+  ~poisson2d_2_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_2_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_2_form_0();
 
-  /// Destructor
-  virtual ~poisson2d_2_form_0();
+  ~poisson2d_2_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_2_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_2_form_1();
 
-  /// Destructor
-  virtual ~poisson2d_2_form_1();
+  ~poisson2d_2_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -516,14 +751,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson2D_2
 {
@@ -532,43 +773,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -579,43 +797,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -626,63 +821,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_2_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -690,7 +892,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_2_form_0());
+    _ufc_form = std::make_shared<const poisson2d_2_form_0>();
   }
 
   // Destructor
@@ -720,57 +922,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_2_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -778,69 +1035,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_2_form_1());
+    _ufc_form = std::make_shared<const poisson2d_2_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_2_form_1());
+    _ufc_form = std::make_shared<const poisson2d_2_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_2_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_2_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_2_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->f = *f;
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_2_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -872,18 +1170,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_3.cpp b/bench/fem/convergence/cpp/Poisson2D_3.cpp
index a5f3261..0144cc5 100644
--- a/bench/fem/convergence/cpp/Poisson2D_3.cpp
+++ b/bench/fem/convergence/cpp/Poisson2D_3.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,81 +13,99 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "Poisson2D_3.h"
 
-/// Constructor
 poisson2d_3_finite_element_0::poisson2d_3_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_3_finite_element_0::~poisson2d_3_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* poisson2d_3_finite_element_0::signature() const
+const char * poisson2d_3_finite_element_0::signature() const
 {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
 }
 
-/// Return the cell shape
 ufc::shape poisson2d_3_finite_element_0::cell_shape() const
 {
-    return ufc::triangle;
+    return ufc::shape::triangle;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t poisson2d_3_finite_element_0::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t poisson2d_3_finite_element_0::geometric_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t poisson2d_3_finite_element_0::space_dimension() const
 {
-    return 10;
+    return 3;
 }
 
-/// Return the rank of the value space
 std::size_t poisson2d_3_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t poisson2d_3_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
+std::size_t poisson2d_3_finite_element_0::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_3_finite_element_0::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_3_finite_element_0::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_3_finite_element_0::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_3_finite_element_0::degree() const
+{
+    return 1;
+}
+
+const char * poisson2d_3_finite_element_0::family() const
+{
+    return "Lagrange";
+}
+
 void poisson2d_3_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -96,8 +114,8 @@ void poisson2d_3_finite_element_0::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -111,41 +129,25 @@ void poisson2d_3_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -155,41 +157,25 @@ void poisson2d_3_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -199,580 +185,472 @@ void poisson2d_3_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+}
+
+void poisson2d_3_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 0;
+    }
+    
+    // Generate combinations of derivatives
+    for (unsigned int row = 1; row < num_derivatives; row++)
+    {
+      for (unsigned int num = 0; num < row; num++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+        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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
       {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
-    case 4:
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-}
-
-/// Evaluate all basis functions at given point x in cell
-void poisson2d_3_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
-                                        int cell_orientation)
-{
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-}
-
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
-                                                std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
-                                                int cell_orientation)
-{
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[8][3];
-    for (unsigned int row = 0; row < 8; row++)
-    {
-      for (unsigned int col = 0; col < 3; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[8][8];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -787,9 +665,9 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -799,11 +677,11 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -813,11 +691,11 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -826,9 +704,9 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -845,13 +723,2438 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
+    }
+    
+}
+
+void poisson2d_3_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_3_finite_element_0::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_3_finite_element_0::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+}
+
+void poisson2d_3_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+}
+
+void poisson2d_3_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+}
+
+std::size_t poisson2d_3_finite_element_0::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_3_finite_element_0::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_3_finite_element_0::create() const
+{
+    return new poisson2d_3_finite_element_0();
+}
+
+
+poisson2d_3_finite_element_1::poisson2d_3_finite_element_1() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson2d_3_finite_element_1::~poisson2d_3_finite_element_1()
+{
+    // Do nothing
+}
+
+const char * poisson2d_3_finite_element_1::signature() const
+{
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+}
+
+ufc::shape poisson2d_3_finite_element_1::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t poisson2d_3_finite_element_1::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_3_finite_element_1::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_3_finite_element_1::space_dimension() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_3_finite_element_1::value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_3_finite_element_1::value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson2d_3_finite_element_1::value_size() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_3_finite_element_1::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_3_finite_element_1::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson2d_3_finite_element_1::reference_value_size() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_3_finite_element_1::degree() const
+{
+    return 1;
+}
+
+const char * poisson2d_3_finite_element_1::family() const
+{
+    return "Lagrange";
+}
+
+void poisson2d_3_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_3_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void poisson2d_3_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_3_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_3_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_3_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+}
+
+void poisson2d_3_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+}
+
+void poisson2d_3_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+}
+
+std::size_t poisson2d_3_finite_element_1::num_sub_elements() const
+{
+    return 2;
+}
+
+ufc::finite_element * poisson2d_3_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_3_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_3_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * poisson2d_3_finite_element_1::create() const
+{
+    return new poisson2d_3_finite_element_1();
+}
+
+
+poisson2d_3_finite_element_2::poisson2d_3_finite_element_2() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson2d_3_finite_element_2::~poisson2d_3_finite_element_2()
+{
+    // Do nothing
+}
+
+const char * poisson2d_3_finite_element_2::signature() const
+{
+    return "FiniteElement('Lagrange', triangle, 3)";
+}
+
+ufc::shape poisson2d_3_finite_element_2::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t poisson2d_3_finite_element_2::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_3_finite_element_2::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_3_finite_element_2::space_dimension() const
+{
+    return 10;
+}
+
+std::size_t poisson2d_3_finite_element_2::value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_3_finite_element_2::value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_3_finite_element_2::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_3_finite_element_2::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_3_finite_element_2::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_3_finite_element_2::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_3_finite_element_2::degree() const
+{
+    return 3;
+}
+
+const char * poisson2d_3_finite_element_2::family() const
+{
+    return "Lagrange";
+}
+
+void poisson2d_3_finite_element_2::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_3_finite_element_2::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson2d_3_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 3)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[8][3];
+    for (unsigned int row = 0; row < 8; row++)
+    {
+      for (unsigned int col = 0; col < 3; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[8][8];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       double tmp1 = (1.0 - Y)/2.0;
       double tmp2 = tmp1*tmp1;
@@ -890,21 +3193,21 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1065,21 +3368,21 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1240,21 +3543,21 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1415,21 +3718,21 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1590,21 +3893,21 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1765,21 +4068,21 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1940,21 +4243,21 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2115,21 +4418,21 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2290,21 +4593,21 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2413,291 +4716,695 @@ void poisson2d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_3_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 3)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_3_finite_element_2::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_3_finite_element_2::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+}
+
+void poisson2d_3_finite_element_2::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+}
+
+void poisson2d_3_finite_element_2::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[8] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[9] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[10] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[11] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[15] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[18] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[19] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+}
+
+std::size_t poisson2d_3_finite_element_2::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_3_finite_element_2::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_3_finite_element_2::create() const
+{
+    return new poisson2d_3_finite_element_2();
+}
+
+
+poisson2d_3_dofmap_0::poisson2d_3_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_3_dofmap_0::~poisson2d_3_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * poisson2d_3_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+}
+
+bool poisson2d_3_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson2d_3_dofmap_0::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_3_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t poisson2d_3_dofmap_0::num_element_dofs() const
+{
+    return 3;
+}
+
+std::size_t poisson2d_3_dofmap_0::num_facet_dofs() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_3_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
         break;
       }
     }
     
+    return 0;
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void poisson2d_3_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
-                                                    int cell_orientation)
+void poisson2d_3_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+}
+
+void poisson2d_3_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
+    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;
+      }
     }
     
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
+}
+
+void poisson2d_3_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
     {
-      num_derivatives *= 2;
-    } // end loop over 'r'
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
     
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
+    switch (d)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-      return ;
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
+}
+
+std::size_t poisson2d_3_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_3_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_3_dofmap_0::create() const
+{
+    return new poisson2d_3_dofmap_0();
+}
+
+
+poisson2d_3_dofmap_1::poisson2d_3_dofmap_1() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_3_dofmap_1::~poisson2d_3_dofmap_1()
+{
+    // Do nothing
+}
+
+const char * poisson2d_3_dofmap_1::signature() const
+{
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+}
+
+bool poisson2d_3_dofmap_1::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
 }
 
-/// Evaluate linear functional for dof i on the function f
-double poisson2d_3_finite_element_0::evaluate_dof(std::size_t i,
-                                   const ufc::function& f,
-                                   const double* vertex_coordinates,
-                                   int cell_orientation,
-                                   const ufc::cell& c) const
+std::size_t poisson2d_3_dofmap_1::topological_dimension() const
 {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    return 2;
+}
+
+std::size_t poisson2d_3_dofmap_1::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return 2*num_global_entities[0];
+}
+
+std::size_t poisson2d_3_dofmap_1::num_element_dofs() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_3_dofmap_1::num_facet_dofs() const
+{
+    return 4;
+}
+
+std::size_t poisson2d_3_dofmap_1::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 2;
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 3:
+    }
+    
+    return 0;
+}
+
+void poisson2d_3_dofmap_1::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+}
+
+void poisson2d_3_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
-    case 4:
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_3_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
+        if (i > 2)
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+      throw std::runtime_error("i is larger than number of entities (2)");
       }
-    case 6:
+      
+      switch (i)
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
       }
-    case 7:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+      
         break;
       }
-    case 8:
+    case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 9:
+    case 2:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-}
-
-/// Evaluate linear functionals for all dofs on the function f
-void poisson2d_3_finite_element_0::evaluate_dofs(double* values,
-                                  const ufc::function& f,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation,
-                                  const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-}
-
-/// Interpolate vertex values from dof values
-void poisson2d_3_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation,
-                                              const ufc::cell& c) const
-{
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-}
-
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void poisson2d_3_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
 }
 
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void poisson2d_3_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+std::size_t poisson2d_3_dofmap_1::num_sub_dofmaps() const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 2;
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t poisson2d_3_finite_element_0::num_sub_elements() const
+ufc::dofmap * poisson2d_3_dofmap_1::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_3_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_3_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* poisson2d_3_finite_element_0::create_sub_element(std::size_t i) const
+ufc::dofmap * poisson2d_3_dofmap_1::create() const
 {
-    return 0;
+    return new poisson2d_3_dofmap_1();
 }
 
-/// Create a new class instance
-ufc::finite_element* poisson2d_3_finite_element_0::create() const
-{
-    return new poisson2d_3_finite_element_0();
-}
 
-/// Constructor
-poisson2d_3_dofmap_0::poisson2d_3_dofmap_0() : ufc::dofmap()
+poisson2d_3_dofmap_2::poisson2d_3_dofmap_2() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-poisson2d_3_dofmap_0::~poisson2d_3_dofmap_0()
+poisson2d_3_dofmap_2::~poisson2d_3_dofmap_2()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* poisson2d_3_dofmap_0::signature() const
+const char * poisson2d_3_dofmap_2::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 3)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool poisson2d_3_dofmap_0::needs_mesh_entities(std::size_t d) const
+bool poisson2d_3_dofmap_2::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
@@ -2721,39 +5428,28 @@ bool poisson2d_3_dofmap_0::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t poisson2d_3_dofmap_0::topological_dimension() const
-{
-    return 2;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t poisson2d_3_dofmap_0::geometric_dimension() const
+std::size_t poisson2d_3_dofmap_2::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t poisson2d_3_dofmap_0::global_dimension(const std::vector<std::size_t>&
+std::size_t poisson2d_3_dofmap_2::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
     return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t poisson2d_3_dofmap_0::num_element_dofs() const
+std::size_t poisson2d_3_dofmap_2::num_element_dofs() const
 {
     return 10;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t poisson2d_3_dofmap_0::num_facet_dofs() const
+std::size_t poisson2d_3_dofmap_2::num_facet_dofs() const
 {
     return 4;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t poisson2d_3_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t poisson2d_3_dofmap_2::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
@@ -2777,29 +5473,27 @@ std::size_t poisson2d_3_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void poisson2d_3_dofmap_0::tabulate_dofs(std::size_t* dofs,
+void poisson2d_3_dofmap_2::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
+    dofs[3] = offset + 2*entity_indices[1][0];
+    dofs[4] = offset + 2*entity_indices[1][0] + 1;
+    dofs[5] = offset + 2*entity_indices[1][1];
+    dofs[6] = offset + 2*entity_indices[1][1] + 1;
+    dofs[7] = offset + 2*entity_indices[1][2];
+    dofs[8] = offset + 2*entity_indices[1][2] + 1;
     offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
+    dofs[9] = offset + entity_indices[2][0];
     offset += num_global_entities[2];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void poisson2d_3_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
+void poisson2d_3_dofmap_2::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
@@ -2832,8 +5526,7 @@ void poisson2d_3_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void poisson2d_3_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
+void poisson2d_3_dofmap_2::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 2)
@@ -2916,73 +5609,41 @@ void poisson2d_3_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void poisson2d_3_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t poisson2d_3_dofmap_0::num_sub_dofmaps() const
+std::size_t poisson2d_3_dofmap_2::num_sub_dofmaps() const
 {
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* poisson2d_3_dofmap_0::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_3_dofmap_2::create_sub_dofmap(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* poisson2d_3_dofmap_0::create() const
+ufc::dofmap * poisson2d_3_dofmap_2::create() const
 {
-    return new poisson2d_3_dofmap_0();
+    return new poisson2d_3_dofmap_2();
 }
 
-/// Constructor
+
 poisson2d_3_cell_integral_0_otherwise::poisson2d_3_cell_integral_0_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson2d_3_cell_integral_0_otherwise::~poisson2d_3_cell_integral_0_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson2d_3_cell_integral_0_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_3_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson2d_3_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -2992,7 +5653,7 @@ void poisson2d_3_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3010,94 +5671,94 @@ void poisson2d_3_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute element tensor
     A[0] = 0.425*G0_0_0 + 0.425*G0_0_1 + 0.425*G0_1_0 + 0.425*G0_1_1;
-    A[1] = -0.0875000000000006*G0_0_0 - 0.0875000000000017*G0_1_0;
-    A[2] = -0.0875000000000015*G0_0_1 - 0.0875000000000018*G0_1_1;
-    A[3] = -0.0374999999999995*G0_0_0 - 0.0375000000000016*G0_0_1 - 0.0375000000000009*G0_1_0 - 0.0375000000000043*G0_1_1;
-    A[4] = -0.0375000000000024*G0_0_0 - 0.0374999999999988*G0_0_1 - 0.0375000000000028*G0_1_0 - 0.0374999999999987*G0_1_1;
-    A[5] = 0.0375000000000003*G0_0_0 - 0.675*G0_0_1 + 0.0375000000000014*G0_1_0 - 0.674999999999999*G0_1_1;
-    A[6] = 0.0375000000000024*G0_0_0 + 0.3375*G0_0_1 + 0.0375000000000029*G0_1_0 + 0.3375*G0_1_1;
-    A[7] = -0.675*G0_0_0 + 0.0375000000000006*G0_0_1 - 0.675*G0_1_0 + 0.0375000000000015*G0_1_1;
-    A[8] = 0.337500000000001*G0_0_0 + 0.0375*G0_0_1 + 0.337500000000002*G0_1_0 + 0.0375000000000027*G0_1_1;
+    A[1] = -0.0875000000000003*G0_0_0 - 0.0875000000000015*G0_1_0;
+    A[2] = -0.0875000000000016*G0_0_1 - 0.0875000000000018*G0_1_1;
+    A[3] = -0.0374999999999991*G0_0_0 - 0.0375000000000009*G0_0_1 - 0.037500000000001*G0_1_0 - 0.037500000000004*G0_1_1;
+    A[4] = -0.0375000000000027*G0_0_0 - 0.037499999999999*G0_0_1 - 0.0375000000000029*G0_1_0 - 0.037499999999999*G0_1_1;
+    A[5] = 0.0375000000000003*G0_0_0 - 0.675*G0_0_1 + 0.0375000000000015*G0_1_0 - 0.674999999999999*G0_1_1;
+    A[6] = 0.0375000000000028*G0_0_0 + 0.3375*G0_0_1 + 0.0375000000000029*G0_1_0 + 0.3375*G0_1_1;
+    A[7] = -0.675*G0_0_0 + 0.0375000000000009*G0_0_1 - 0.675*G0_1_0 + 0.0375000000000018*G0_1_1;
+    A[8] = 0.3375*G0_0_0 + 0.0374999999999993*G0_0_1 + 0.337500000000001*G0_1_0 + 0.0375000000000024*G0_1_1;
     A[9] = 0.0;
-    A[10] = -0.0875000000000006*G0_0_0 - 0.0875000000000017*G0_0_1;
+    A[10] = -0.0875000000000002*G0_0_0 - 0.0875000000000015*G0_0_1;
     A[11] = 0.425000000000002*G0_0_0;
-    A[12] = 0.0875000000000005*G0_0_1;
-    A[13] = 0.037500000000002*G0_0_0 + 0.712500000000005*G0_0_1;
-    A[14] = 0.0375*G0_0_0 - 0.300000000000001*G0_0_1;
+    A[12] = 0.0875000000000004*G0_0_1;
+    A[13] = 0.037500000000002*G0_0_0 + 0.712500000000004*G0_0_1;
+    A[14] = 0.0374999999999999*G0_0_0 - 0.300000000000001*G0_0_1;
     A[15] = -0.0375000000000006*G0_0_0;
     A[16] = -0.0375*G0_0_0;
-    A[17] = 0.337500000000002*G0_0_0 + 0.3*G0_0_1;
-    A[18] = -0.675000000000003*G0_0_0 - 0.712500000000002*G0_0_1;
+    A[17] = 0.337500000000001*G0_0_0 + 0.3*G0_0_1;
+    A[18] = -0.675000000000003*G0_0_0 - 0.712500000000001*G0_0_1;
     A[19] = 0.0;
-    A[20] = -0.0875000000000015*G0_1_0 - 0.0875000000000018*G0_1_1;
+    A[20] = -0.0875000000000017*G0_1_0 - 0.0875000000000018*G0_1_1;
     A[21] = 0.0875000000000004*G0_1_0;
     A[22] = 0.425000000000003*G0_1_1;
-    A[23] = -0.3*G0_1_0 + 0.0375000000000001*G0_1_1;
-    A[24] = 0.712500000000005*G0_1_0 + 0.0375000000000014*G0_1_1;
+    A[23] = -0.3*G0_1_0 + 0.0375000000000006*G0_1_1;
+    A[24] = 0.712500000000005*G0_1_0 + 0.0375000000000009*G0_1_1;
     A[25] = 0.300000000000004*G0_1_0 + 0.337500000000005*G0_1_1;
     A[26] = -0.712500000000005*G0_1_0 - 0.675000000000005*G0_1_1;
     A[27] = -0.0375000000000021*G0_1_1;
-    A[28] = -0.0375000000000001*G0_1_1;
+    A[28] = -0.0375*G0_1_1;
     A[29] = 0.0;
-    A[30] = -0.0374999999999995*G0_0_0 - 0.0375000000000009*G0_0_1 - 0.0375000000000016*G0_1_0 - 0.0375000000000043*G0_1_1;
-    A[31] = 0.0375000000000019*G0_0_0 + 0.712500000000005*G0_1_0;
-    A[32] = -0.3*G0_0_1 + 0.0375*G0_1_1;
-    A[33] = 1.6875*G0_0_0 + 0.843750000000007*G0_0_1 + 0.843750000000007*G0_1_0 + 1.68750000000002*G0_1_1;
-    A[34] = -0.337500000000001*G0_0_0 + 0.843749999999992*G0_0_1 - 0.168750000000005*G0_1_0 - 0.337500000000009*G0_1_1;
-    A[35] = 0.337500000000002*G0_0_0 + 0.168750000000003*G0_0_1 + 0.16875*G0_1_0;
-    A[36] = 0.337500000000001*G0_0_0 + 0.168750000000004*G0_0_1 + 0.168750000000005*G0_1_0;
-    A[37] = 0.168749999999999*G0_0_1 + 0.168750000000005*G0_1_0 + 0.337499999999998*G0_1_1;
-    A[38] = -0.843749999999998*G0_0_1 - 0.843750000000008*G0_1_0 - 1.68750000000001*G0_1_1;
+    A[30] = -0.0374999999999991*G0_0_0 - 0.037500000000001*G0_0_1 - 0.0375000000000009*G0_1_0 - 0.0375000000000039*G0_1_1;
+    A[31] = 0.037500000000002*G0_0_0 + 0.712500000000004*G0_1_0;
+    A[32] = -0.3*G0_0_1 + 0.0375000000000006*G0_1_1;
+    A[33] = 1.6875*G0_0_0 + 0.843750000000007*G0_0_1 + 0.843750000000007*G0_1_0 + 1.68750000000001*G0_1_1;
+    A[34] = -0.337500000000001*G0_0_0 + 0.843749999999992*G0_0_1 - 0.168750000000004*G0_1_0 - 0.337500000000009*G0_1_1;
+    A[35] = 0.337500000000002*G0_0_0 + 0.168750000000003*G0_0_1 + 0.168750000000001*G0_1_0;
+    A[36] = 0.337500000000001*G0_0_0 + 0.168750000000004*G0_0_1 + 0.168750000000004*G0_1_0;
+    A[37] = 0.168749999999999*G0_0_1 + 0.168750000000003*G0_1_0 + 0.337499999999997*G0_1_1;
+    A[38] = -0.843749999999999*G0_0_1 - 0.843750000000007*G0_1_0 - 1.6875*G0_1_1;
     A[39] = -2.025*G0_0_0 - 1.01250000000001*G0_0_1 - 1.01250000000001*G0_1_0;
-    A[40] = -0.0375000000000024*G0_0_0 - 0.0375000000000028*G0_0_1 - 0.0374999999999988*G0_1_0 - 0.0374999999999987*G0_1_1;
+    A[40] = -0.0375000000000027*G0_0_0 - 0.0375000000000028*G0_0_1 - 0.037499999999999*G0_1_0 - 0.037499999999999*G0_1_1;
     A[41] = 0.0374999999999999*G0_0_0 - 0.300000000000001*G0_1_0;
-    A[42] = 0.712500000000005*G0_0_1 + 0.0375000000000014*G0_1_1;
-    A[43] = -0.337500000000001*G0_0_0 - 0.168750000000005*G0_0_1 + 0.843749999999992*G0_1_0 - 0.337500000000009*G0_1_1;
-    A[44] = 1.68750000000001*G0_0_0 + 0.843750000000002*G0_0_1 + 0.843750000000002*G0_1_0 + 1.6875*G0_1_1;
-    A[45] = 0.33750000000001*G0_0_0 + 0.168750000000008*G0_0_1 + 0.16875000000001*G0_1_0;
-    A[46] = -1.68750000000001*G0_0_0 - 0.843750000000007*G0_0_1 - 0.843750000000003*G0_1_0;
-    A[47] = 0.168749999999999*G0_0_1 + 0.16875*G0_1_0 + 0.337500000000005*G0_1_1;
-    A[48] = 0.168750000000004*G0_0_1 + 0.168750000000001*G0_1_0 + 0.33750000000001*G0_1_1;
+    A[42] = 0.712500000000005*G0_0_1 + 0.0375000000000009*G0_1_1;
+    A[43] = -0.337500000000001*G0_0_0 - 0.168750000000004*G0_0_1 + 0.843749999999992*G0_1_0 - 0.337500000000009*G0_1_1;
+    A[44] = 1.68750000000001*G0_0_0 + 0.843750000000001*G0_0_1 + 0.843750000000001*G0_1_0 + 1.6875*G0_1_1;
+    A[45] = 0.33750000000001*G0_0_0 + 0.168750000000008*G0_0_1 + 0.168750000000009*G0_1_0;
+    A[46] = -1.68750000000001*G0_0_0 - 0.843750000000006*G0_0_1 - 0.843750000000002*G0_1_0;
+    A[47] = 0.16875*G0_0_1 + 0.16875*G0_1_0 + 0.337500000000005*G0_1_1;
+    A[48] = 0.168750000000004*G0_0_1 + 0.16875*G0_1_0 + 0.33750000000001*G0_1_1;
     A[49] = -1.01250000000001*G0_0_1 - 1.0125*G0_1_0 - 2.02500000000001*G0_1_1;
-    A[50] = 0.0375000000000002*G0_0_0 + 0.0375000000000013*G0_0_1 - 0.675*G0_1_0 - 0.674999999999999*G0_1_1;
+    A[50] = 0.0375000000000003*G0_0_0 + 0.0375000000000015*G0_0_1 - 0.675*G0_1_0 - 0.675*G0_1_1;
     A[51] = -0.0375000000000006*G0_0_0;
     A[52] = 0.300000000000004*G0_0_1 + 0.337500000000005*G0_1_1;
-    A[53] = 0.337500000000002*G0_0_0 + 0.16875*G0_0_1 + 0.168750000000003*G0_1_0;
-    A[54] = 0.33750000000001*G0_0_0 + 0.16875000000001*G0_0_1 + 0.168750000000009*G0_1_0;
-    A[55] = 1.6875*G0_0_0 + 0.843750000000001*G0_0_1 + 0.843750000000001*G0_1_0 + 1.6875*G0_1_1;
-    A[56] = -0.33750000000001*G0_0_0 - 1.18125000000001*G0_0_1 - 0.168750000000009*G0_1_0 - 1.35000000000001*G0_1_1;
-    A[57] = 0.84375*G0_0_1 + 0.843749999999996*G0_1_0;
-    A[58] = -0.168750000000003*G0_0_1 - 0.16875*G0_1_0;
+    A[53] = 0.337500000000002*G0_0_0 + 0.168750000000001*G0_0_1 + 0.168750000000003*G0_1_0;
+    A[54] = 0.33750000000001*G0_0_0 + 0.168750000000009*G0_0_1 + 0.168750000000008*G0_1_0;
+    A[55] = 1.6875*G0_0_0 + 0.84375*G0_0_1 + 0.84375*G0_1_0 + 1.6875*G0_1_1;
+    A[56] = -0.33750000000001*G0_0_0 - 1.18125000000001*G0_0_1 - 0.168750000000008*G0_1_0 - 1.35*G0_1_1;
+    A[57] = 0.843750000000001*G0_0_1 + 0.843749999999997*G0_1_0;
+    A[58] = -0.168750000000003*G0_0_1 - 0.168749999999999*G0_1_0;
     A[59] = -2.02500000000001*G0_0_0 - 1.0125*G0_0_1 - 1.0125*G0_1_0;
-    A[60] = 0.0375000000000024*G0_0_0 + 0.0375000000000029*G0_0_1 + 0.3375*G0_1_0 + 0.3375*G0_1_1;
+    A[60] = 0.0375000000000028*G0_0_0 + 0.0375000000000029*G0_0_1 + 0.3375*G0_1_0 + 0.3375*G0_1_1;
     A[61] = -0.0375*G0_0_0;
     A[62] = -0.712500000000005*G0_0_1 - 0.675000000000005*G0_1_1;
-    A[63] = 0.337500000000001*G0_0_0 + 0.168750000000005*G0_0_1 + 0.168750000000004*G0_1_0;
-    A[64] = -1.68750000000001*G0_0_0 - 0.843750000000003*G0_0_1 - 0.843750000000007*G0_1_0;
-    A[65] = -0.33750000000001*G0_0_0 - 0.168750000000009*G0_0_1 - 1.18125000000001*G0_1_0 - 1.35000000000001*G0_1_1;
+    A[63] = 0.337500000000001*G0_0_0 + 0.168750000000004*G0_0_1 + 0.168750000000004*G0_1_0;
+    A[64] = -1.68750000000001*G0_0_0 - 0.843750000000002*G0_0_1 - 0.843750000000006*G0_1_0;
+    A[65] = -0.33750000000001*G0_0_0 - 0.168750000000008*G0_0_1 - 1.18125000000001*G0_1_0 - 1.35*G0_1_1;
     A[66] = 1.68750000000001*G0_0_0 + 0.843750000000007*G0_0_1 + 0.843750000000007*G0_1_0 + 1.68750000000001*G0_1_1;
-    A[67] = -0.168749999999999*G0_0_1 - 0.168749999999996*G0_1_0;
+    A[67] = -0.16875*G0_0_1 - 0.168749999999997*G0_1_0;
     A[68] = -0.168750000000004*G0_0_1 - 0.168750000000004*G0_1_0;
-    A[69] = 1.01250000000001*G0_0_1 + 1.01250000000001*G0_1_0;
-    A[70] = -0.675*G0_0_0 - 0.675*G0_0_1 + 0.0375000000000006*G0_1_0 + 0.0375000000000015*G0_1_1;
-    A[71] = 0.337500000000002*G0_0_0 + 0.3*G0_1_0;
+    A[69] = 1.01250000000001*G0_0_1 + 1.0125*G0_1_0;
+    A[70] = -0.675*G0_0_0 - 0.675*G0_0_1 + 0.0375000000000008*G0_1_0 + 0.0375000000000018*G0_1_1;
+    A[71] = 0.337500000000001*G0_0_0 + 0.3*G0_1_0;
     A[72] = -0.0375000000000021*G0_1_1;
-    A[73] = 0.168750000000005*G0_0_1 + 0.168749999999999*G0_1_0 + 0.337499999999998*G0_1_1;
-    A[74] = 0.16875*G0_0_1 + 0.168749999999999*G0_1_0 + 0.337500000000005*G0_1_1;
-    A[75] = 0.843749999999996*G0_0_1 + 0.84375*G0_1_0;
-    A[76] = -0.168749999999996*G0_0_1 - 0.168749999999999*G0_1_0;
-    A[77] = 1.6875*G0_0_0 + 0.843749999999999*G0_0_1 + 0.843749999999999*G0_1_0 + 1.68750000000001*G0_1_1;
-    A[78] = -1.35*G0_0_0 - 0.168750000000004*G0_0_1 - 1.18125*G0_1_0 - 0.337500000000001*G0_1_1;
+    A[73] = 0.168750000000003*G0_0_1 + 0.168749999999999*G0_1_0 + 0.337499999999998*G0_1_1;
+    A[74] = 0.16875*G0_0_1 + 0.16875*G0_1_0 + 0.337500000000005*G0_1_1;
+    A[75] = 0.843749999999997*G0_0_1 + 0.843750000000001*G0_1_0;
+    A[76] = -0.168749999999997*G0_0_1 - 0.16875*G0_1_0;
+    A[77] = 1.6875*G0_0_0 + 0.843749999999998*G0_0_1 + 0.843749999999998*G0_1_0 + 1.68750000000001*G0_1_1;
+    A[78] = -1.35*G0_0_0 - 0.168750000000003*G0_0_1 - 1.18125*G0_1_0 - 0.3375*G0_1_1;
     A[79] = -1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.025*G0_1_1;
-    A[80] = 0.337500000000001*G0_0_0 + 0.337500000000002*G0_0_1 + 0.0375*G0_1_0 + 0.0375000000000027*G0_1_1;
-    A[81] = -0.675000000000003*G0_0_0 - 0.712500000000002*G0_1_0;
-    A[82] = -0.0375000000000001*G0_1_1;
-    A[83] = -0.843750000000008*G0_0_1 - 0.843749999999999*G0_1_0 - 1.68750000000001*G0_1_1;
-    A[84] = 0.168750000000001*G0_0_1 + 0.168750000000004*G0_1_0 + 0.33750000000001*G0_1_1;
-    A[85] = -0.16875*G0_0_1 - 0.168750000000003*G0_1_0;
+    A[80] = 0.3375*G0_0_0 + 0.337500000000001*G0_0_1 + 0.0374999999999993*G0_1_0 + 0.0375000000000024*G0_1_1;
+    A[81] = -0.675000000000003*G0_0_0 - 0.712500000000001*G0_1_0;
+    A[82] = -0.0375*G0_1_1;
+    A[83] = -0.843750000000007*G0_0_1 - 0.843749999999999*G0_1_0 - 1.6875*G0_1_1;
+    A[84] = 0.16875*G0_0_1 + 0.168750000000004*G0_1_0 + 0.33750000000001*G0_1_1;
+    A[85] = -0.168749999999999*G0_0_1 - 0.168750000000003*G0_1_0;
     A[86] = -0.168750000000004*G0_0_1 - 0.168750000000004*G0_1_0;
-    A[87] = -1.35*G0_0_0 - 1.18125*G0_0_1 - 0.168750000000004*G0_1_0 - 0.337500000000001*G0_1_1;
-    A[88] = 1.6875*G0_0_0 + 0.843750000000006*G0_0_1 + 0.843750000000006*G0_1_0 + 1.6875*G0_1_1;
+    A[87] = -1.35*G0_0_0 - 1.18125*G0_0_1 - 0.168750000000002*G0_1_0 - 0.3375*G0_1_1;
+    A[88] = 1.6875*G0_0_0 + 0.843750000000004*G0_0_1 + 0.843750000000004*G0_1_0 + 1.68749999999999*G0_1_1;
     A[89] = 1.0125*G0_0_1 + 1.0125*G0_1_0;
     A[90] = 0.0;
     A[91] = 0.0;
@@ -3105,35 +5766,32 @@ void poisson2d_3_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     A[93] = -2.025*G0_0_0 - 1.01250000000001*G0_0_1 - 1.01250000000001*G0_1_0;
     A[94] = -1.0125*G0_0_1 - 1.01250000000001*G0_1_0 - 2.02500000000001*G0_1_1;
     A[95] = -2.02500000000001*G0_0_0 - 1.0125*G0_0_1 - 1.0125*G0_1_0;
-    A[96] = 1.01250000000001*G0_0_1 + 1.01250000000001*G0_1_0;
+    A[96] = 1.0125*G0_0_1 + 1.01250000000001*G0_1_0;
     A[97] = -1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.025*G0_1_1;
     A[98] = 1.0125*G0_0_1 + 1.0125*G0_1_0;
     A[99] = 4.05000000000001*G0_0_0 + 2.02500000000001*G0_0_1 + 2.02500000000001*G0_1_0 + 4.05000000000001*G0_1_1;
 }
 
-/// Constructor
+
 poisson2d_3_cell_integral_1_otherwise::poisson2d_3_cell_integral_1_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson2d_3_cell_integral_1_otherwise::~poisson2d_3_cell_integral_1_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson2d_3_cell_integral_1_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_3_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson2d_3_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -3143,7 +5801,7 @@ void poisson2d_3_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3178,58 +5836,65 @@ void poisson2d_3_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     A[9] = 0.0026785714285714*G0_0 + 0.00267857142857142*G0_1 + 0.00267857142857142*G0_2 + 0.0120535714285713*G0_3 + 0.0120535714285713*G0_4 + 0.0120535714285715*G0_5 + 0.0120535714285714*G0_6 + 0.0120535714285715*G0_7 + 0.0120535714285714*G0_8 + 0.144642857142856*G0_9;
 }
 
-/// Constructor
+
 poisson2d_3_form_0::poisson2d_3_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_3_form_0::~poisson2d_3_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson2d_3_form_0::signature() const
+const char * poisson2d_3_form_0::signature() const
 {
-    return "f3e989e69fd0d1253e0a30bac61a1638160b98a127414930af83d2169f7836045db89a31b996d2216ec0891e68b5af3fc1fb1ba397c9315381cbbf5e19bd1c14";
+    return "ad3faf6db8fdde114fe0e1549f5b3c8918a6372deb6b9112d3872802011fb1bec52cfbcc15b398b890025cbb108e8034c4841932009d5187a90486bb52c69f37";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_3_form_0::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_3_form_0::num_coefficients() const
 {
     return 0;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_3_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_3_form_0::create_coordinate_finite_element() const
+{
+    return new poisson2d_3_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_3_form_0::create_coordinate_dofmap() const
+{
+    return new poisson2d_3_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_3_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_3_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_3_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_3_finite_element_0();
+        return new poisson2d_3_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_3_finite_element_0();
+        return new poisson2d_3_finite_element_2();
         break;
       }
     }
@@ -3237,19 +5902,18 @@ ufc::finite_element* poisson2d_3_form_0::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_3_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_3_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_3_dofmap_0();
+        return new poisson2d_3_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_3_dofmap_0();
+        return new poisson2d_3_dofmap_2();
         break;
       }
     }
@@ -3257,183 +5921,225 @@ ufc::dofmap* poisson2d_3_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_3_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_3_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_3_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_3_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_3_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_3_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_3_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_3_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_3_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_3_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_3_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_3_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_3_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_3_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_3_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_3_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_3_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_3_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_3_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_3_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_3_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_3_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_3_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_3_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_3_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_3_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_3_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_3_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_3_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_3_form_0::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_3_form_0::create_default_cell_integral() const
 {
     return new poisson2d_3_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_3_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_3_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_3_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_3_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * poisson2d_3_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_3_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * poisson2d_3_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_3_form_0::create_default_vertex_integral() const
+ufc::interface_integral * poisson2d_3_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_3_form_0::create_default_custom_integral() const
+ufc::overlap_integral * poisson2d_3_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 poisson2d_3_form_1::poisson2d_3_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_3_form_1::~poisson2d_3_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson2d_3_form_1::signature() const
+const char * poisson2d_3_form_1::signature() const
 {
-    return "967d975e9fad954b93c8c9082ffb01bc253b85c7de7917cef010817321fc35976f3ebf2639fd53b854f63da7b5f4fa635b3d9936fcafa9b004043f8442cabab6";
+    return "34a38aca18128f59f350f66a58f16bb3241ad64f66697d50943024feec40acf8e8415a7c33ae2421b93a8269d9b0a18a0dc0e87eadc85b80817ee4784dbcc87a";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_3_form_1::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_3_form_1::num_coefficients() const
 {
     return 1;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_3_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_3_form_1::create_coordinate_finite_element() const
+{
+    return new poisson2d_3_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_3_form_1::create_coordinate_dofmap() const
+{
+    return new poisson2d_3_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_3_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_3_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_3_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_3_finite_element_0();
+        return new poisson2d_3_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_3_finite_element_0();
+        return new poisson2d_3_finite_element_2();
         break;
       }
     }
@@ -3441,19 +6147,18 @@ ufc::finite_element* poisson2d_3_form_1::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_3_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_3_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_3_dofmap_0();
+        return new poisson2d_3_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_3_dofmap_0();
+        return new poisson2d_3_dofmap_2();
         break;
       }
     }
@@ -3461,128 +6166,163 @@ ufc::dofmap* poisson2d_3_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_3_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_3_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_3_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_3_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_3_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_3_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_3_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_3_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_3_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_3_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_3_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_3_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_3_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_3_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_3_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_3_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_3_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_3_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_3_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_3_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_3_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_3_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_3_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_3_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_3_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_3_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_3_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_3_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_3_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_3_form_1::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_3_form_1::create_default_cell_integral() const
 {
     return new poisson2d_3_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_3_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_3_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_3_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_3_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_3_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * poisson2d_3_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_3_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * poisson2d_3_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_3_form_1::create_default_custom_integral() const
+ufc::interface_integral * poisson2d_3_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_3_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_3.h b/bench/fem/convergence/cpp/Poisson2D_3.h
index 19428d5..4b1884d 100644
--- a/bench/fem/convergence/cpp/Poisson2D_3.h
+++ b/bench/fem/convergence/cpp/Poisson2D_3.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,500 +13,735 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __POISSON2D_3_H
 #define __POISSON2D_3_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson2d_3_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson2d_3_finite_element_0();
 
-  /// Destructor
-  virtual ~poisson2d_3_finite_element_0();
+  ~poisson2d_3_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t space_dimension() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson2d_3_finite_element_1: public ufc::finite_element
+{
+public:
+
+  poisson2d_3_finite_element_1();
+
+  ~poisson2d_3_finite_element_1() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson2d_3_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson2d_3_finite_element_2();
+
+  ~poisson2d_3_finite_element_2() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
+  std::size_t num_sub_elements() const final override;
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class poisson2d_3_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   poisson2d_3_dofmap_0();
 
-  /// Destructor
-  virtual ~poisson2d_3_dofmap_0();
+  ~poisson2d_3_dofmap_0() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson2d_3_dofmap_1: public ufc::dofmap
+{
+public:
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  poisson2d_3_dofmap_1();
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  ~poisson2d_3_dofmap_1() override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  const char * signature() const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson2d_3_dofmap_2: public ufc::dofmap
+{
+public:
+
+  poisson2d_3_dofmap_2();
+
+  ~poisson2d_3_dofmap_2() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
+
+  std::size_t num_facet_dofs() const final override;
+
+  std::size_t num_entity_dofs(std::size_t d) const final override;
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 poisson2d_3_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_3_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_3_cell_integral_0_otherwise();
+  ~poisson2d_3_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 poisson2d_3_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_3_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_3_cell_integral_1_otherwise();
+  ~poisson2d_3_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_3_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_3_form_0();
 
-  /// Destructor
-  virtual ~poisson2d_3_form_0();
+  ~poisson2d_3_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_3_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_3_form_1();
 
-  /// Destructor
-  virtual ~poisson2d_3_form_1();
+  ~poisson2d_3_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -516,14 +751,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson2D_3
 {
@@ -532,43 +773,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -579,43 +797,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -626,63 +821,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_3_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -690,7 +892,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_3_form_0());
+    _ufc_form = std::make_shared<const poisson2d_3_form_0>();
   }
 
   // Destructor
@@ -720,57 +922,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_3_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -778,69 +1035,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_3_form_1());
+    _ufc_form = std::make_shared<const poisson2d_3_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_3_form_1());
+    _ufc_form = std::make_shared<const poisson2d_3_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_3_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_3_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_3_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->f = *f;
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_3_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -872,18 +1170,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_4.cpp b/bench/fem/convergence/cpp/Poisson2D_4.cpp
index d65ffee..8e08b96 100644
--- a/bench/fem/convergence/cpp/Poisson2D_4.cpp
+++ b/bench/fem/convergence/cpp/Poisson2D_4.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,81 +13,99 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "Poisson2D_4.h"
 
-/// Constructor
 poisson2d_4_finite_element_0::poisson2d_4_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_4_finite_element_0::~poisson2d_4_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* poisson2d_4_finite_element_0::signature() const
+const char * poisson2d_4_finite_element_0::signature() const
 {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 4, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
 }
 
-/// Return the cell shape
 ufc::shape poisson2d_4_finite_element_0::cell_shape() const
 {
-    return ufc::triangle;
+    return ufc::shape::triangle;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t poisson2d_4_finite_element_0::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t poisson2d_4_finite_element_0::geometric_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t poisson2d_4_finite_element_0::space_dimension() const
 {
-    return 15;
+    return 3;
 }
 
-/// Return the rank of the value space
 std::size_t poisson2d_4_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t poisson2d_4_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
+std::size_t poisson2d_4_finite_element_0::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_4_finite_element_0::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_4_finite_element_0::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_4_finite_element_0::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_4_finite_element_0::degree() const
+{
+    return 1;
+}
+
+const char * poisson2d_4_finite_element_0::family() const
+{
+    return "Lagrange";
+}
+
 void poisson2d_4_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -96,8 +114,8 @@ void poisson2d_4_finite_element_0::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -111,51 +129,25 @@ void poisson2d_4_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976278, 0.0224478343233824, 0.0129602631893289, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.023944356611608, 0.0185472188784818, 0.0107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -165,51 +157,25 @@ void poisson2d_4_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.0, 0.0412393049421162, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.0259205263786579, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -219,701 +185,994 @@ void poisson2d_4_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.0, 0.0, 0.0476190476190476, 0.0, 0.0, 0.038880789567987, 0.0, 0.0, 0.0, 0.0598608915290199, 0.0, 0.0, 0.0, 0.0, 0.0535412090610519};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+}
+
+void poisson2d_4_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348238, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087791, 0.0478887132232159, 0.0, 0.0566626896277045, -0.0838052481406279, 0.0834624849531682, -0.0535412090610519};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {-0.0314269680527355, 0.0109971479845643, 0.00634920634920626, 0.0, 0.188561808316413, -0.163299316185545, 0.0, 0.0936971158568409, 0.0, -0.0419026240703139, 0.0, 0.0, 0.0838052481406278, -0.139104141588614, 0.107082418122104};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0.0, 0.035916534917412, 0.155523158271948, 0.0, 0.0, 0.103682105514632, -0.011972178305804, 0.0, 0.0, 0.0, 0.0927360943924091, -0.107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087792, 0.0478887132232159, 0.0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531681, -0.0535412090610519};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {-0.0314269680527353, -0.0109971479845643, 0.00634920634920621, 0.0, -0.188561808316413, -0.163299316185545, 0.0, 0.0936971158568409, 0.0, -0.0419026240703138, 0.0, 0.0, 0.0838052481406278, 0.139104141588614, 0.107082418122104};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0.0, -0.0359165349174119, 0.155523158271948, 0.0, 0.0, -0.103682105514632, -0.011972178305804, 0.0, 0.0, 0.0, -0.0927360943924091, -0.107082418122104};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
         
-      // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924089, 0.0107082418122104};
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    }
+    
+}
+
+void poisson2d_4_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_4_finite_element_0::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_4_finite_element_0::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+}
+
+void poisson2d_4_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+}
+
+void poisson2d_4_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+}
+
+std::size_t poisson2d_4_finite_element_0::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_4_finite_element_0::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_4_finite_element_0::create() const
+{
+    return new poisson2d_4_finite_element_0();
+}
+
+
+poisson2d_4_finite_element_1::poisson2d_4_finite_element_1() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson2d_4_finite_element_1::~poisson2d_4_finite_element_1()
+{
+    // Do nothing
+}
+
+const char * poisson2d_4_finite_element_1::signature() const
+{
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+}
+
+ufc::shape poisson2d_4_finite_element_1::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t poisson2d_4_finite_element_1::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_4_finite_element_1::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_4_finite_element_1::space_dimension() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_4_finite_element_1::value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_4_finite_element_1::value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson2d_4_finite_element_1::value_size() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_4_finite_element_1::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_4_finite_element_1::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson2d_4_finite_element_1::reference_value_size() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_4_finite_element_1::degree() const
+{
+    return 1;
+}
+
+const char * poisson2d_4_finite_element_1::family() const
+{
+    return "Lagrange";
+}
+
+void poisson2d_4_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {-0.0314269680527352, 0.0, -0.0126984126984128, -0.243432247780074, 0.0, 0.0544331053951818, 0.0, 0.0936971158568409, 0.0, -0.0419026240703139, 0.192748352619787, 0.0, -0.0239443566116079, 0.0, 0.0107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.051841052757316, -0.041902624070314, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.00927360943924091, 0.0107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 12:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0.0, 0.169988068883114, 0.0838052481406278, -0.0278208283177227, -0.053541209061052};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 13:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.251415744421883, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087792, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0.0, -0.169988068883114, 0.0838052481406278, 0.0278208283177227, -0.0535412090610519};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 14:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.251415744421883, 0.0, 0.406349206349206, 0.0, 0.0, -0.186627789926337, 0.0, -0.187394231713682, 0.0, -0.203527031198668, 0.0, 0.0, -0.167610496281256, 0.0, 0.107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 15; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -921,29 +1180,30 @@ void poisson2d_4_finite_element_0::_evaluate_basis(std::size_t i,
     
 }
 
-/// Evaluate all basis functions at given point x in cell
-void poisson2d_4_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void poisson2d_4_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
+    double dof_values[2] = {0.0, 0.0};
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 15; r++)
+    for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
+void poisson2d_4_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
     
@@ -955,7 +1215,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -963,19 +1223,19 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 4)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -984,18 +1244,18 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[16][4];
-    for (unsigned int row = 0; row < 16; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 4; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -1022,7 +1282,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[16][16];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -1044,135 +1304,61 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976278, 0.0224478343233824, 0.0129602631893289, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.023944356611608, 0.0185472188784818, 0.0107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[16];
-      for (unsigned int r = 0; r < 16; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 15; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 15; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1187,9 +1373,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1199,11 +1385,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1213,11 +1399,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1226,9 +1412,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 15; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1249,135 +1435,61 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.0, 0.0412393049421162, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.0259205263786579, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[16];
-      for (unsigned int r = 0; r < 16; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 15; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 15; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1392,9 +1504,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1404,11 +1516,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1418,11 +1530,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1431,9 +1543,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 15; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1454,135 +1566,61 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.0, 0.0, 0.0476190476190476, 0.0, 0.0, 0.038880789567987, 0.0, 0.0, 0.0, 0.0598608915290199, 0.0, 0.0, 0.0, 0.0, 0.0535412090610519};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[16];
-      for (unsigned int r = 0; r < 16; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 15; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 15; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1597,9 +1635,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1609,11 +1647,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1623,11 +1661,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1636,9 +1674,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 15; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1659,135 +1697,61 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348238, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087791, 0.0478887132232159, 0.0, 0.0566626896277045, -0.0838052481406279, 0.0834624849531682, -0.0535412090610519};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[16];
-      for (unsigned int r = 0; r < 16; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 15; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 15; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1802,9 +1766,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1814,11 +1778,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1828,11 +1792,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1841,9 +1805,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 15; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1855,7 +1819,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -1864,135 +1828,61 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {-0.0314269680527355, 0.0109971479845643, 0.00634920634920626, 0.0, 0.188561808316413, -0.163299316185545, 0.0, 0.0936971158568409, 0.0, -0.0419026240703139, 0.0, 0.0, 0.0838052481406278, -0.139104141588614, 0.107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[16];
-      for (unsigned int r = 0; r < 16; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 15; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 15; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2007,9 +1897,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2019,11 +1909,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2033,11 +1923,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2046,9 +1936,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 15; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2060,7 +1950,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -2069,135 +1959,61 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0.0, 0.035916534917412, 0.155523158271948, 0.0, 0.0, 0.103682105514632, -0.011972178305804, 0.0, 0.0, 0.0, 0.0927360943924091, -0.107082418122104};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[16];
-      for (unsigned int r = 0; r < 16; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 15; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 15; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2212,9 +2028,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2224,11 +2040,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2238,11 +2054,11 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 15; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 15; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2251,9 +2067,9 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 15; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 15; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2265,302 +2081,2994 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    }
+    
+}
+
+void poisson2d_4_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087792, 0.0478887132232159, 0.0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531681, -0.0535412090610519};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[16];
-      for (unsigned int r = 0; r < 16; r++)
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_4_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 15; t++)
-        {
-          for (unsigned int u = 0; u < 15; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 15; t++)
-          {
-            for (unsigned int u = 0; u < 15; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 15; t++)
-          {
-            for (unsigned int u = 0; u < 15; u++)
-            {
-              for (unsigned int tu = 0; tu < 15; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 15; t++)
-          {
-            for (unsigned int u = 0; u < 15; u++)
-            {
-              for (unsigned int tu = 0; tu < 15; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 15; s++)
-        {
-          for (unsigned int t = 0; t < 15; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 7:
+    case 2:
       {
-        
-      // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {-0.0314269680527353, -0.0109971479845643, 0.00634920634920621, 0.0, -0.188561808316413, -0.163299316185545, 0.0, 0.0936971158568409, 0.0, -0.0419026240703138, 0.0, 0.0, 0.0838052481406278, 0.139104141588614, 0.107082418122104};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[16];
-      for (unsigned int r = 0; r < 16; r++)
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_4_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+}
+
+void poisson2d_4_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+}
+
+void poisson2d_4_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+}
+
+std::size_t poisson2d_4_finite_element_1::num_sub_elements() const
+{
+    return 2;
+}
+
+ufc::finite_element * poisson2d_4_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_4_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_4_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * poisson2d_4_finite_element_1::create() const
+{
+    return new poisson2d_4_finite_element_1();
+}
+
+
+poisson2d_4_finite_element_2::poisson2d_4_finite_element_2() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson2d_4_finite_element_2::~poisson2d_4_finite_element_2()
+{
+    // Do nothing
+}
+
+const char * poisson2d_4_finite_element_2::signature() const
+{
+    return "FiniteElement('Lagrange', triangle, 4)";
+}
+
+ufc::shape poisson2d_4_finite_element_2::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t poisson2d_4_finite_element_2::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_4_finite_element_2::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_4_finite_element_2::space_dimension() const
+{
+    return 15;
+}
+
+std::size_t poisson2d_4_finite_element_2::value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_4_finite_element_2::value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_4_finite_element_2::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_4_finite_element_2::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_4_finite_element_2::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_4_finite_element_2::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_4_finite_element_2::degree() const
+{
+    return 4;
+}
+
+const char * poisson2d_4_finite_element_2::family() const
+{
+    return "Lagrange";
+}
+
+void poisson2d_4_finite_element_2::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976278, 0.0224478343233824, 0.0129602631893289, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.023944356611608, 0.0185472188784818, 0.0107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.0, 0.0412393049421162, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.0259205263786579, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.0, 0.0, 0.0476190476190476, 0.0, 0.0, 0.038880789567987, 0.0, 0.0, 0.0, 0.0598608915290199, 0.0, 0.0, 0.0, 0.0, 0.0535412090610519};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348238, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087791, 0.0478887132232159, 0.0, 0.0566626896277045, -0.0838052481406279, 0.0834624849531682, -0.0535412090610519};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {-0.0314269680527355, 0.0109971479845643, 0.00634920634920626, 0.0, 0.188561808316413, -0.163299316185545, 0.0, 0.0936971158568409, 0.0, -0.0419026240703139, 0.0, 0.0, 0.0838052481406278, -0.139104141588614, 0.107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0.0, 0.035916534917412, 0.155523158271948, 0.0, 0.0, 0.103682105514632, -0.011972178305804, 0.0, 0.0, 0.0, 0.0927360943924091, -0.107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087792, 0.0478887132232159, 0.0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531681, -0.0535412090610519};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {-0.0314269680527353, -0.0109971479845643, 0.00634920634920621, 0.0, -0.188561808316413, -0.163299316185545, 0.0, 0.0936971158568409, 0.0, -0.0419026240703138, 0.0, 0.0, 0.0838052481406278, 0.139104141588614, 0.107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0.0, -0.0359165349174119, 0.155523158271948, 0.0, 0.0, -0.103682105514632, -0.011972178305804, 0.0, 0.0, 0.0, -0.0927360943924091, -0.107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924089, 0.0107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {-0.0314269680527352, 0.0, -0.0126984126984128, -0.243432247780074, 0.0, 0.0544331053951818, 0.0, 0.0936971158568409, 0.0, -0.0419026240703139, 0.192748352619787, 0.0, -0.0239443566116079, 0.0, 0.0107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.051841052757316, -0.041902624070314, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.00927360943924091, 0.0107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 12:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0.0, 0.169988068883114, 0.0838052481406278, -0.0278208283177227, -0.053541209061052};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 13:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.251415744421883, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087792, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0.0, -0.169988068883114, 0.0838052481406278, 0.0278208283177227, -0.0535412090610519};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 14:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.251415744421883, 0.0, 0.406349206349206, 0.0, 0.0, -0.186627789926337, 0.0, -0.187394231713682, 0.0, -0.203527031198668, 0.0, 0.0, -0.167610496281256, 0.0, 0.107082418122104};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 15; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_4_finite_element_2::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 15; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson2d_4_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 4)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[16][4];
+    for (unsigned int row = 0; row < 16; row++)
+    {
+      for (unsigned int col = 0; col < 4; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[16][16];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976278, 0.0224478343233824, 0.0129602631893289, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.023944356611608, 0.0185472188784818, 0.0107082418122104};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
+      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[16];
+      for (unsigned int r = 0; r < 16; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 15; t++)
+        {
+          for (unsigned int u = 0; u < 15; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 15; s++)
+        {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.0, 0.0412393049421162, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.0259205263786579, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
+      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[16];
+      for (unsigned int r = 0; r < 16; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 15; t++)
+        {
+          for (unsigned int u = 0; u < 15; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 15; s++)
+        {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.0, 0.0, 0.0476190476190476, 0.0, 0.0, 0.038880789567987, 0.0, 0.0, 0.0, 0.0598608915290199, 0.0, 0.0, 0.0, 0.0, 0.0535412090610519};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
+      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[16];
+      for (unsigned int r = 0; r < 16; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 15; t++)
+        {
+          for (unsigned int u = 0; u < 15; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 15; s++)
+        {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348238, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087791, 0.0478887132232159, 0.0, 0.0566626896277045, -0.0838052481406279, 0.0834624849531682, -0.0535412090610519};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
+      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[16];
+      for (unsigned int r = 0; r < 16; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 15; t++)
+        {
+          for (unsigned int u = 0; u < 15; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 15; s++)
+        {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {-0.0314269680527355, 0.0109971479845643, 0.00634920634920626, 0.0, 0.188561808316413, -0.163299316185545, 0.0, 0.0936971158568409, 0.0, -0.0419026240703139, 0.0, 0.0, 0.0838052481406278, -0.139104141588614, 0.107082418122104};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
+      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[16];
+      for (unsigned int r = 0; r < 16; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 15; t++)
+        {
+          for (unsigned int u = 0; u < 15; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 15; s++)
+        {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0.0, 0.035916534917412, 0.155523158271948, 0.0, 0.0, 0.103682105514632, -0.011972178305804, 0.0, 0.0, 0.0, 0.0927360943924091, -0.107082418122104};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
+      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[16];
+      for (unsigned int r = 0; r < 16; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 15; t++)
+        {
+          for (unsigned int u = 0; u < 15; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 15; s++)
+        {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087792, 0.0478887132232159, 0.0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531681, -0.0535412090610519};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
+      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[16];
+      for (unsigned int r = 0; r < 16; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 15; t++)
+        {
+          for (unsigned int u = 0; u < 15; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 15; s++)
+        {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {-0.0314269680527353, -0.0109971479845643, 0.00634920634920621, 0.0, -0.188561808316413, -0.163299316185545, 0.0, 0.0936971158568409, 0.0, -0.0419026240703138, 0.0, 0.0, 0.0838052481406278, 0.139104141588614, 0.107082418122104};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
+      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[16];
+      for (unsigned int r = 0; r < 16; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[15][15] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 15; t++)
+        {
+          for (unsigned int u = 0; u < 15; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            for (unsigned int u = 0; u < 15; u++)
+            {
+              for (unsigned int tu = 0; tu < 15; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 15; s++)
+        {
+          for (unsigned int t = 0; t < 15; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
+      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[14] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[13] *= std::sqrt(7.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[12] *= std::sqrt(12.5);
+      basisvalues[6] *= std::sqrt(14.0);
+      basisvalues[11] *= std::sqrt(17.5);
+      basisvalues[10] *= std::sqrt(22.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[15] = \
+      {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0.0, -0.0359165349174119, 0.155523158271948, 0.0, 0.0, -0.103682105514632, -0.011972178305804, 0.0, 0.0, 0.0, -0.0927360943924091, -0.107082418122104};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
+      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[15][15] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[16];
+      for (unsigned int r = 0; r < 16; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
@@ -2680,7 +5188,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 9:
       {
         
       // Array of basisvalues
@@ -2725,7 +5233,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       
       // Table(s) of coefficients
       static const double coefficients0[15] = \
-      {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0.0, -0.0359165349174119, 0.155523158271948, 0.0, 0.0, -0.103682105514632, -0.011972178305804, 0.0, 0.0, 0.0, -0.0927360943924091, -0.107082418122104};
+      {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924089, 0.0107082418122104};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[15][15] = \
@@ -2735,13 +5243,13 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
       {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
@@ -2750,17 +5258,17 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -2885,7 +5393,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 10:
       {
         
       // Array of basisvalues
@@ -2930,7 +5438,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       
       // Table(s) of coefficients
       static const double coefficients0[15] = \
-      {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924089, 0.0107082418122104};
+      {-0.0314269680527352, 0.0, -0.0126984126984128, -0.243432247780074, 0.0, 0.0544331053951818, 0.0, 0.0936971158568409, 0.0, -0.0419026240703139, 0.192748352619787, 0.0, -0.0239443566116079, 0.0, 0.0107082418122104};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[15][15] = \
@@ -2940,13 +5448,13 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
       {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
@@ -2955,17 +5463,17 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -3090,7 +5598,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 11:
       {
         
       // Array of basisvalues
@@ -3135,7 +5643,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       
       // Table(s) of coefficients
       static const double coefficients0[15] = \
-      {-0.0314269680527352, 0.0, -0.0126984126984128, -0.243432247780074, 0.0, 0.0544331053951818, 0.0, 0.0936971158568409, 0.0, -0.0419026240703139, 0.192748352619787, 0.0, -0.0239443566116079, 0.0, 0.0107082418122104};
+      {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.051841052757316, -0.041902624070314, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.00927360943924091, 0.0107082418122104};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[15][15] = \
@@ -3145,13 +5653,13 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
       {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
@@ -3160,17 +5668,17 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -3295,7 +5803,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 12:
       {
         
       // Array of basisvalues
@@ -3340,7 +5848,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       
       // Table(s) of coefficients
       static const double coefficients0[15] = \
-      {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.051841052757316, -0.041902624070314, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.00927360943924091, 0.0107082418122104};
+      {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0.0, 0.169988068883114, 0.0838052481406278, -0.0278208283177227, -0.053541209061052};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[15][15] = \
@@ -3350,13 +5858,13 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
       {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
@@ -3365,17 +5873,17 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -3500,7 +6008,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 12:
+    case 13:
       {
         
       // Array of basisvalues
@@ -3545,7 +6053,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       
       // Table(s) of coefficients
       static const double coefficients0[15] = \
-      {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0.0, 0.169988068883114, 0.0838052481406278, -0.0278208283177227, -0.053541209061052};
+      {0.251415744421883, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087792, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0.0, -0.169988068883114, 0.0838052481406278, 0.0278208283177227, -0.0535412090610519};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[15][15] = \
@@ -3555,13 +6063,13 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
       {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
@@ -3570,17 +6078,17 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -3705,7 +6213,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 13:
+    case 14:
       {
         
       // Array of basisvalues
@@ -3750,7 +6258,7 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       
       // Table(s) of coefficients
       static const double coefficients0[15] = \
-      {0.251415744421883, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087792, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0.0, -0.169988068883114, 0.0838052481406278, 0.0278208283177227, -0.0535412090610519};
+      {0.251415744421883, 0.0, 0.406349206349206, 0.0, 0.0, -0.186627789926337, 0.0, -0.187394231713682, 0.0, -0.203527031198668, 0.0, 0.0, -0.167610496281256, 0.0, 0.107082418122104};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[15][15] = \
@@ -3760,13 +6268,13 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
+      {5.29150262212921, -5.48740879635665e-14, -2.99332590941917, 13.6626010212795, 1.52100554373646e-14, 0.61101009266079, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, -1.3399275167356e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.15463194561016e-14, 0.0},
       {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-5.51746958652424e-14, 10.9544511501033, 4.05488425439909e-14, -8.75140573595602e-14, -3.83325938999965, -1.61888738032678e-14, 17.7482393492988, 1.72481552542989e-14, 0.553283335172495, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.73286382647969, -3.26753313814188e-14, 3.34664010613629, 4.36435780471985, -6.3948846218409e-14, -5.07468037933236, 0.0, 17.0084012854152, 2.52729613987574e-14, 1.52127765851132, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.30741720818685e-14, 2.44948974278317, 0.0, 0.0, 9.14285714285707, -1.77960816807272e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
@@ -3775,17 +6283,17 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749983, 2.19089023002067, 2.52982212813469, 8.08290376865478, 6.26099033699943, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958086, -1.91662969499983, 0.66394000220698, 8.87411967464943, -1.07142857142856, 0.276641667586248, -0.09583148474999, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.36643191323983, 2.89827534923785, 1.67332005306815, 2.18217890235985, 5.74704893215389, -2.53734018966618, 10.062305898749, 8.50420064270763, -2.19577516413418, 0.760638829255664, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2, 1.22474487139158, 3.53553390593272, -7.37711113563323, 4.57142857142853, 1.64957219768466, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.5491933384829, 6.64078308635357, 3.83405790253617, 0.0, -6.19677335393183, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696598, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -3903,556 +6411,765 @@ void poisson2d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_4_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 15; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 4)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[16];
+    for (unsigned int r = 0; r < 16; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 15; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_4_finite_element_2::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+      y[1] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[4];
+      y[1] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[4];
+      y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[4];
+      y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[2];
+      y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[2];
+      y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 12:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 13:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+      y[1] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 14:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_4_finite_element_2::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+    y[1] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[4];
+    y[1] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[4];
+    y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[4];
+    y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[2];
+    y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[10] = vals[0];
+    y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[2];
+    y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[12] = vals[0];
+    y[0] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+    y[1] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[13] = vals[0];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[14] = vals[0];
+}
+
+void poisson2d_4_finite_element_2::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+}
+
+void poisson2d_4_finite_element_2::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+    dof_coordinates[7] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[4];
+    dof_coordinates[11] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[5];
+    dof_coordinates[12] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[4];
+    dof_coordinates[13] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[5];
+    dof_coordinates[14] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[15] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[16] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[4];
+    dof_coordinates[17] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[5];
+    dof_coordinates[18] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[2];
+    dof_coordinates[19] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[3];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[22] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[2];
+    dof_coordinates[23] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[3];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
+    dof_coordinates[26] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+    dof_coordinates[27] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
+    dof_coordinates[28] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+}
+
+std::size_t poisson2d_4_finite_element_2::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_4_finite_element_2::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_4_finite_element_2::create() const
+{
+    return new poisson2d_4_finite_element_2();
+}
+
+
+poisson2d_4_dofmap_0::poisson2d_4_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_4_dofmap_0::~poisson2d_4_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * poisson2d_4_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+}
+
+bool poisson2d_4_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
         break;
       }
-    case 14:
+    case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[15] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[10] = basisvalues[6]*1.75*tmp0 - basisvalues[3]*0.75*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[11] = basisvalues[6]*(3.5 + 4.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[14] = basisvalues[9]*(0.0285714285714286 + Y*1.8) - basisvalues[5]*0.771428571428571;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[13] = basisvalues[8]*(0.285714285714286 + Y*2.0) - basisvalues[4]*0.714285714285714;
-      basisvalues[12] = basisvalues[7]*(1.02040816326531 + Y*2.57142857142857) - basisvalues[3]*0.551020408163265;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[14] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[13] *= std::sqrt(7.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[12] *= std::sqrt(12.5);
-      basisvalues[6] *= std::sqrt(14.0);
-      basisvalues[11] *= std::sqrt(17.5);
-      basisvalues[10] *= std::sqrt(22.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[15] = \
-      {0.251415744421883, 0.0, 0.406349206349206, 0.0, 0.0, -0.186627789926337, 0.0, -0.187394231713682, 0.0, -0.203527031198668, 0.0, 0.0, -0.167610496281256, 0.0, 0.107082418122104};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.0, 0.0, 7.07106781186547, 0.0, 1.06581410364015e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212921, -5.05164625919128e-14, -2.99332590941917, 13.6626010212795, 0.0, 0.611010092660788, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004133, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.50990331349021e-14, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-5.01948941673766e-14, 10.9544511501033, 3.70841635675611e-14, -7.99645407921091e-14, -3.83325938999966, -1.22279032086585e-14, 17.7482393492988, 1.10031507407824e-14, 0.553283335172497, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.73286382647969, -2.91226177026183e-14, 3.34664010613629, 4.36435780471985, -7.72715225139109e-14, -5.07468037933235, 0.0, 17.0084012854152, 2.88256750775579e-14, 1.52127765851132, 0.0, -1.19624848747263e-14, 0.0, 0.0, 0.0},
-      {0.0, 2.44948974278316, 0.0, 0.0, 9.14285714285707, 1.30197094873322e-14, 0.0, 0.0, 14.8461497791618, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.09838667696594, 0.0, 7.66811580507236, 0.0, 0.0, 10.733126291999, 0.0, 0.0, 0.0, 9.2951600308978, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[15][15] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.91287092917528, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 1.50990331349021e-14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106458, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.305505046330396, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749984, 2.19089023002067, 2.52982212813468, 8.08290376865479, 6.26099033699942, -1.80739222823012, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454315, 3.91918358845309, 0.0, 9.6994845223857, 4.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.68328157299972, 5.47722557505165, -1.89736659610101, 7.42307488958087, -1.91662969499983, 0.663940002206984, 8.87411967464943, -1.07142857142857, 0.276641667586249, -0.0958314847499904, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.36643191323984, 2.89827534923785, 1.67332005306815, 2.18217890235986, 5.74704893215388, -2.53734018966617, 10.062305898749, 8.50420064270762, -2.19577516413418, 0.760638829255662, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2, 1.22474487139158, 3.53553390593273, -7.37711113563323, 4.57142857142853, 1.64957219768467, 0.0, 11.4997781699989, 7.42307488958091, -2.57142857142857, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.54919333848291, 6.64078308635357, 3.83405790253616, 1.37089762322799e-14, -6.19677335393182, 5.36656314599952, 0.0, 0.0, 13.4164078649987, 4.6475800154489, 1.01765024526089e-14, 0.0, 0.0, 0.0, 0.0},
-      {-3.57770876399969, 0.0, 8.85437744847144, 0.0, -1.06581410364015e-14, -3.09838667696597, 0.0, 0.0, 0.0, 16.0996894379985, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[16];
-      for (unsigned int r = 0; r < 16; r++)
+        return false;
+        break;
+      }
+    case 2:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[15][15] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson2d_4_dofmap_0::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_4_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t poisson2d_4_dofmap_0::num_element_dofs() const
+{
+    return 3;
+}
+
+std::size_t poisson2d_4_dofmap_0::num_facet_dofs() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_4_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 15; t++)
-        {
-          for (unsigned int u = 0; u < 15; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 15; t++)
-          {
-            for (unsigned int u = 0; u < 15; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 15; t++)
-          {
-            for (unsigned int u = 0; u < 15; u++)
-            {
-              for (unsigned int tu = 0; tu < 15; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 15; t++)
-          {
-            for (unsigned int u = 0; u < 15; u++)
-            {
-              for (unsigned int tu = 0; tu < 15; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 15; s++)
-        {
-          for (unsigned int t = 0; t < 15; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        return 1;
+        break;
+      }
+    case 1:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
         break;
       }
     }
     
+    return 0;
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void poisson2d_4_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
-                                                    int cell_orientation)
+void poisson2d_4_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 15; r++)
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+}
+
+void poisson2d_4_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 4)
-    {
-      return ;
+        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;
+      }
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[16];
-    for (unsigned int r = 0; r < 16; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 15; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
 }
 
-/// Evaluate linear functional for dof i on the function f
-double poisson2d_4_finite_element_0::evaluate_dof(std::size_t i,
-                                   const ufc::function& f,
-                                   const double* vertex_coordinates,
-                                   int cell_orientation,
-                                   const ufc::cell& c) const
+void poisson2d_4_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
 {
-    // Declare variables for result of evaluation
-    double vals[1];
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
     
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 3:
+    }
+    
+}
+
+std::size_t poisson2d_4_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_4_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_4_dofmap_0::create() const
+{
+    return new poisson2d_4_dofmap_0();
+}
+
+
+poisson2d_4_dofmap_1::poisson2d_4_dofmap_1() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_4_dofmap_1::~poisson2d_4_dofmap_1()
+{
+    // Do nothing
+}
+
+const char * poisson2d_4_dofmap_1::signature() const
+{
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+}
+
+bool poisson2d_4_dofmap_1::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-      y[1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return true;
         break;
       }
-    case 4:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
-    case 5:
+    case 2:
       {
-        y[0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
-      y[1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
-    case 6:
+    }
+    
+    return false;
+}
+
+std::size_t poisson2d_4_dofmap_1::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_4_dofmap_1::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return 2*num_global_entities[0];
+}
+
+std::size_t poisson2d_4_dofmap_1::num_element_dofs() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_4_dofmap_1::num_facet_dofs() const
+{
+    return 4;
+}
+
+std::size_t poisson2d_4_dofmap_1::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
-      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 2;
         break;
       }
-    case 7:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 8:
+    case 2:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
-      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 9:
+    }
+    
+    return 0;
+}
+
+void poisson2d_4_dofmap_1::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+}
+
+void poisson2d_4_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
       {
-        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
-      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
-    case 10:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
-    case 11:
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_4_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
-      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
       }
-    case 12:
+      
+      switch (i)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
         break;
       }
-    case 13:
+    case 1:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-      y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 14:
+    case 2:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-}
-
-/// Evaluate linear functionals for all dofs on the function f
-void poisson2d_4_finite_element_0::evaluate_dofs(double* values,
-                                  const ufc::function& f,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation,
-                                  const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-    y[1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
-    y[1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
-    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
-    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
-    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[10] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
-    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[12] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-    y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[13] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[14] = vals[0];
-}
-
-/// Interpolate vertex values from dof values
-void poisson2d_4_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation,
-                                              const ufc::cell& c) const
-{
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-}
-
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void poisson2d_4_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
 }
 
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void poisson2d_4_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+std::size_t poisson2d_4_dofmap_1::num_sub_dofmaps() const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 2;
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t poisson2d_4_finite_element_0::num_sub_elements() const
+ufc::dofmap * poisson2d_4_dofmap_1::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_4_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_4_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* poisson2d_4_finite_element_0::create_sub_element(std::size_t i) const
+ufc::dofmap * poisson2d_4_dofmap_1::create() const
 {
-    return 0;
+    return new poisson2d_4_dofmap_1();
 }
 
-/// Create a new class instance
-ufc::finite_element* poisson2d_4_finite_element_0::create() const
-{
-    return new poisson2d_4_finite_element_0();
-}
 
-/// Constructor
-poisson2d_4_dofmap_0::poisson2d_4_dofmap_0() : ufc::dofmap()
+poisson2d_4_dofmap_2::poisson2d_4_dofmap_2() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-poisson2d_4_dofmap_0::~poisson2d_4_dofmap_0()
+poisson2d_4_dofmap_2::~poisson2d_4_dofmap_2()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* poisson2d_4_dofmap_0::signature() const
+const char * poisson2d_4_dofmap_2::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 4, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 4)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool poisson2d_4_dofmap_0::needs_mesh_entities(std::size_t d) const
+bool poisson2d_4_dofmap_2::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
@@ -4476,39 +7193,28 @@ bool poisson2d_4_dofmap_0::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t poisson2d_4_dofmap_0::topological_dimension() const
-{
-    return 2;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t poisson2d_4_dofmap_0::geometric_dimension() const
+std::size_t poisson2d_4_dofmap_2::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t poisson2d_4_dofmap_0::global_dimension(const std::vector<std::size_t>&
+std::size_t poisson2d_4_dofmap_2::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
     return num_global_entities[0] + 3*num_global_entities[1] + 3*num_global_entities[2];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t poisson2d_4_dofmap_0::num_element_dofs() const
+std::size_t poisson2d_4_dofmap_2::num_element_dofs() const
 {
     return 15;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t poisson2d_4_dofmap_0::num_facet_dofs() const
+std::size_t poisson2d_4_dofmap_2::num_facet_dofs() const
 {
     return 5;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t poisson2d_4_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t poisson2d_4_dofmap_2::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
@@ -4532,34 +7238,32 @@ std::size_t poisson2d_4_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void poisson2d_4_dofmap_0::tabulate_dofs(std::size_t* dofs,
+void poisson2d_4_dofmap_2::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 3*c.entity_indices[1][0];
-    dofs[4] = offset + 3*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 3*c.entity_indices[1][0] + 2;
-    dofs[6] = offset + 3*c.entity_indices[1][1];
-    dofs[7] = offset + 3*c.entity_indices[1][1] + 1;
-    dofs[8] = offset + 3*c.entity_indices[1][1] + 2;
-    dofs[9] = offset + 3*c.entity_indices[1][2];
-    dofs[10] = offset + 3*c.entity_indices[1][2] + 1;
-    dofs[11] = offset + 3*c.entity_indices[1][2] + 2;
+    dofs[3] = offset + 3*entity_indices[1][0];
+    dofs[4] = offset + 3*entity_indices[1][0] + 1;
+    dofs[5] = offset + 3*entity_indices[1][0] + 2;
+    dofs[6] = offset + 3*entity_indices[1][1];
+    dofs[7] = offset + 3*entity_indices[1][1] + 1;
+    dofs[8] = offset + 3*entity_indices[1][1] + 2;
+    dofs[9] = offset + 3*entity_indices[1][2];
+    dofs[10] = offset + 3*entity_indices[1][2] + 1;
+    dofs[11] = offset + 3*entity_indices[1][2] + 2;
     offset += 3*num_global_entities[1];
-    dofs[12] = offset + 3*c.entity_indices[2][0];
-    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
-    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
+    dofs[12] = offset + 3*entity_indices[2][0];
+    dofs[13] = offset + 3*entity_indices[2][0] + 1;
+    dofs[14] = offset + 3*entity_indices[2][0] + 2;
     offset += 3*num_global_entities[2];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void poisson2d_4_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
+void poisson2d_4_dofmap_2::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
@@ -4595,8 +7299,7 @@ void poisson2d_4_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void poisson2d_4_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
+void poisson2d_4_dofmap_2::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 2)
@@ -4684,83 +7387,41 @@ void poisson2d_4_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void poisson2d_4_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-    dof_coordinates[7] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
-    dof_coordinates[11] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
-    dof_coordinates[12] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
-    dof_coordinates[13] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
-    dof_coordinates[14] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[15] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[16] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
-    dof_coordinates[17] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
-    dof_coordinates[18] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
-    dof_coordinates[19] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[22] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
-    dof_coordinates[23] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
-    dof_coordinates[26] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-    dof_coordinates[27] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
-    dof_coordinates[28] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t poisson2d_4_dofmap_0::num_sub_dofmaps() const
+std::size_t poisson2d_4_dofmap_2::num_sub_dofmaps() const
 {
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* poisson2d_4_dofmap_0::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_4_dofmap_2::create_sub_dofmap(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* poisson2d_4_dofmap_0::create() const
+ufc::dofmap * poisson2d_4_dofmap_2::create() const
 {
-    return new poisson2d_4_dofmap_0();
+    return new poisson2d_4_dofmap_2();
 }
 
-/// Constructor
+
 poisson2d_4_cell_integral_0_otherwise::poisson2d_4_cell_integral_0_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson2d_4_cell_integral_0_otherwise::~poisson2d_4_cell_integral_0_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson2d_4_cell_integral_0_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_4_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson2d_4_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -4770,7 +7431,7 @@ void poisson2d_4_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4788,255 +7449,252 @@ void poisson2d_4_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute element tensor
     A[0] = 0.373015873015879*G0_0_0 + 0.373015873015879*G0_0_1 + 0.373015873015879*G0_1_0 + 0.373015873015879*G0_1_1;
-    A[1] = 0.0566137566137575*G0_0_0 + 0.0566137566137564*G0_1_0;
-    A[2] = 0.0566137566137572*G0_0_1 + 0.0566137566137568*G0_1_1;
-    A[3] = 0.0423280423280426*G0_0_0 + 0.0423280423280413*G0_0_1 + 0.042328042328041*G0_1_0 + 0.0423280423280381*G0_1_1;
-    A[4] = 0.0423280423280441*G0_0_0 + 0.0423280423280453*G0_0_1 + 0.0423280423280453*G0_1_0 + 0.0423280423280471*G0_1_1;
-    A[5] = 0.0423280423280441*G0_0_0 + 0.0423280423280442*G0_0_1 + 0.0423280423280427*G0_1_0 + 0.0423280423280429*G0_1_1;
-    A[6] = 0.126984126984129*G0_0_0 - 0.651851851851861*G0_0_1 + 0.126984126984129*G0_1_0 - 0.65185185185186*G0_1_1;
-    A[7] = 0.0423280423280426*G0_0_0 + 0.467724867724872*G0_0_1 + 0.0423280423280443*G0_1_0 + 0.467724867724872*G0_1_1;
-    A[8] = -0.0423280423280441*G0_0_0 - 0.245502645502648*G0_0_1 - 0.0423280423280427*G0_1_0 - 0.245502645502648*G0_1_1;
-    A[9] = -0.651851851851863*G0_0_0 + 0.126984126984129*G0_0_1 - 0.651851851851862*G0_1_0 + 0.126984126984128*G0_1_1;
-    A[10] = 0.467724867724875*G0_0_0 + 0.0423280423280429*G0_0_1 + 0.467724867724875*G0_1_0 + 0.042328042328042*G0_1_1;
-    A[11] = -0.245502645502649*G0_0_0 - 0.0423280423280437*G0_0_1 - 0.245502645502647*G0_1_0 - 0.0423280423280406*G0_1_1;
-    A[12] = -0.084656084656088*G0_0_0 - 0.0846560846560872*G0_0_1 - 0.0846560846560879*G0_1_0 - 0.0846560846560848*G0_1_1;
-    A[13] = -0.0846560846560837*G0_0_0 - 0.0846560846560859*G0_0_1 - 0.0846560846560823*G0_1_0 - 0.0846560846560868*G0_1_1;
-    A[14] = -0.0846560846560868*G0_0_0 - 0.0846560846560852*G0_0_1 - 0.0846560846560896*G0_1_0 - 0.0846560846560859*G0_1_1;
-    A[15] = 0.0566137566137575*G0_0_0 + 0.0566137566137564*G0_0_1;
+    A[1] = 0.0566137566137574*G0_0_0 + 0.0566137566137565*G0_1_0;
+    A[2] = 0.0566137566137571*G0_0_1 + 0.0566137566137568*G0_1_1;
+    A[3] = 0.0423280423280422*G0_0_0 + 0.0423280423280411*G0_0_1 + 0.0423280423280405*G0_1_0 + 0.0423280423280383*G0_1_1;
+    A[4] = 0.0423280423280446*G0_0_0 + 0.0423280423280451*G0_0_1 + 0.0423280423280457*G0_1_0 + 0.0423280423280465*G0_1_1;
+    A[5] = 0.0423280423280435*G0_0_0 + 0.0423280423280441*G0_0_1 + 0.0423280423280422*G0_1_0 + 0.042328042328043*G0_1_1;
+    A[6] = 0.12698412698413*G0_0_0 - 0.651851851851861*G0_0_1 + 0.12698412698413*G0_1_0 - 0.651851851851861*G0_1_1;
+    A[7] = 0.0423280423280427*G0_0_0 + 0.467724867724873*G0_0_1 + 0.0423280423280442*G0_1_0 + 0.467724867724873*G0_1_1;
+    A[8] = -0.0423280423280435*G0_0_0 - 0.245502645502648*G0_0_1 - 0.0423280423280422*G0_1_0 - 0.245502645502648*G0_1_1;
+    A[9] = -0.651851851851863*G0_0_0 + 0.126984126984129*G0_0_1 - 0.651851851851863*G0_1_0 + 0.126984126984129*G0_1_1;
+    A[10] = 0.467724867724875*G0_0_0 + 0.042328042328043*G0_0_1 + 0.467724867724875*G0_1_0 + 0.0423280423280421*G0_1_1;
+    A[11] = -0.245502645502649*G0_0_0 - 0.0423280423280434*G0_0_1 - 0.245502645502648*G0_1_0 - 0.0423280423280406*G0_1_1;
+    A[12] = -0.0846560846560886*G0_0_0 - 0.0846560846560873*G0_0_1 - 0.0846560846560888*G0_1_0 - 0.0846560846560853*G0_1_1;
+    A[13] = -0.0846560846560831*G0_0_0 - 0.0846560846560859*G0_0_1 - 0.0846560846560813*G0_1_0 - 0.0846560846560864*G0_1_1;
+    A[14] = -0.0846560846560874*G0_0_0 - 0.0846560846560849*G0_0_1 - 0.08465608465609*G0_1_0 - 0.0846560846560856*G0_1_1;
+    A[15] = 0.0566137566137574*G0_0_0 + 0.0566137566137565*G0_0_1;
     A[16] = 0.373015873015876*G0_0_0;
-    A[17] = -0.056613756613757*G0_0_1;
-    A[18] = 0.126984126984126*G0_0_0 + 0.778835978835984*G0_0_1;
-    A[19] = 0.042328042328044*G0_0_0 - 0.425396825396829*G0_0_1;
-    A[20] = -0.0423280423280437*G0_0_0 + 0.203174603174603*G0_0_1;
-    A[21] = 0.0423280423280439*G0_0_0;
+    A[17] = -0.0566137566137571*G0_0_1;
+    A[18] = 0.126984126984126*G0_0_0 + 0.778835978835983*G0_0_1;
+    A[19] = 0.0423280423280441*G0_0_0 - 0.425396825396828*G0_0_1;
+    A[20] = -0.0423280423280439*G0_0_0 + 0.203174603174603*G0_0_1;
+    A[21] = 0.0423280423280441*G0_0_0;
     A[22] = 0.0423280423280454*G0_0_0;
-    A[23] = 0.0423280423280437*G0_0_0;
-    A[24] = -0.245502645502647*G0_0_0 - 0.203174603174605*G0_0_1;
-    A[25] = 0.467724867724869*G0_0_0 + 0.425396825396828*G0_0_1;
+    A[23] = 0.042328042328044*G0_0_0;
+    A[24] = -0.245502645502647*G0_0_0 - 0.203174603174604*G0_0_1;
+    A[25] = 0.467724867724869*G0_0_0 + 0.425396825396827*G0_0_1;
     A[26] = -0.651851851851855*G0_0_0 - 0.778835978835983*G0_0_1;
-    A[27] = -0.0846560846560875*G0_0_0;
-    A[28] = -0.0846560846560828*G0_0_0;
-    A[29] = -0.0846560846560894*G0_0_0;
-    A[30] = 0.0566137566137572*G0_1_0 + 0.0566137566137568*G0_1_1;
-    A[31] = -0.056613756613757*G0_1_0;
+    A[27] = -0.0846560846560883*G0_0_0;
+    A[28] = -0.0846560846560816*G0_0_0;
+    A[29] = -0.0846560846560895*G0_0_0;
+    A[30] = 0.0566137566137571*G0_1_0 + 0.0566137566137568*G0_1_1;
+    A[31] = -0.0566137566137571*G0_1_0;
     A[32] = 0.373015873015876*G0_1_1;
-    A[33] = 0.203174603174605*G0_1_0 - 0.0423280423280418*G0_1_1;
-    A[34] = -0.42539682539683*G0_1_0 + 0.0423280423280409*G0_1_1;
+    A[33] = 0.203174603174606*G0_1_0 - 0.0423280423280422*G0_1_1;
+    A[34] = -0.425396825396831*G0_1_0 + 0.0423280423280413*G0_1_1;
     A[35] = 0.778835978835986*G0_1_0 + 0.126984126984128*G0_1_1;
     A[36] = -0.203174603174605*G0_1_0 - 0.245502645502647*G0_1_1;
-    A[37] = 0.425396825396831*G0_1_0 + 0.467724867724872*G0_1_1;
+    A[37] = 0.42539682539683*G0_1_0 + 0.467724867724872*G0_1_1;
     A[38] = -0.778835978835986*G0_1_0 - 0.651851851851857*G0_1_1;
-    A[39] = 0.0423280423280431*G0_1_1;
+    A[39] = 0.0423280423280433*G0_1_1;
     A[40] = 0.0423280423280456*G0_1_1;
-    A[41] = 0.0423280423280437*G0_1_1;
-    A[42] = -0.0846560846560863*G0_1_1;
-    A[43] = -0.0846560846560896*G0_1_1;
-    A[44] = -0.0846560846560841*G0_1_1;
-    A[45] = 0.0423280423280426*G0_0_0 + 0.042328042328041*G0_0_1 + 0.0423280423280413*G0_1_0 + 0.0423280423280381*G0_1_1;
-    A[46] = 0.126984126984126*G0_0_0 + 0.778835978835984*G0_1_0;
-    A[47] = 0.203174603174605*G0_0_1 - 0.0423280423280418*G0_1_1;
-    A[48] = 1.82857142857144*G0_0_0 + 1.04973544973546*G0_0_1 + 1.04973544973546*G0_1_0 + 2.09947089947092*G0_1_1;
-    A[49] = -0.660317460317462*G0_0_0 + 0.82116402116403*G0_0_1 - 0.296296296296294*G0_1_0 - 0.761904761904771*G0_1_1;
-    A[50] = 0.338624338624346*G0_0_0 - 0.440211640211639*G0_0_1 + 0.101587301587306*G0_1_0 + 0.338624338624345*G0_1_1;
-    A[51] = -0.203174603174608*G0_0_0 - 0.101587301587301*G0_0_1 - 0.101587301587309*G0_1_0;
-    A[52] = -0.152380952380963*G0_0_0 - 0.0423280423280453*G0_0_1 - 0.0423280423280381*G0_1_0;
-    A[53] = -0.338624338624346*G0_0_0 - 0.101587301587292*G0_0_1 - 0.101587301587305*G0_1_0;
-    A[54] = -0.135449735449738*G0_0_0 - 0.237037037037048*G0_0_1 - 0.237037037037034*G0_1_0 - 0.338624338624349*G0_1_1;
-    A[55] = 0.101587301587305*G0_0_0 + 0.465608465608478*G0_0_1 + 0.465608465608459*G0_1_0 + 0.761904761904767*G0_1_1;
+    A[41] = 0.0423280423280439*G0_1_1;
+    A[42] = -0.0846560846560869*G0_1_1;
+    A[43] = -0.0846560846560904*G0_1_1;
+    A[44] = -0.0846560846560831*G0_1_1;
+    A[45] = 0.0423280423280422*G0_0_0 + 0.0423280423280405*G0_0_1 + 0.0423280423280412*G0_1_0 + 0.0423280423280383*G0_1_1;
+    A[46] = 0.126984126984126*G0_0_0 + 0.778835978835983*G0_1_0;
+    A[47] = 0.203174603174606*G0_0_1 - 0.0423280423280422*G0_1_1;
+    A[48] = 1.82857142857144*G0_0_0 + 1.04973544973545*G0_0_1 + 1.04973544973545*G0_1_0 + 2.09947089947091*G0_1_1;
+    A[49] = -0.660317460317463*G0_0_0 + 0.82116402116403*G0_0_1 - 0.296296296296294*G0_1_0 - 0.761904761904769*G0_1_1;
+    A[50] = 0.338624338624348*G0_0_0 - 0.440211640211639*G0_0_1 + 0.101587301587305*G0_1_0 + 0.338624338624345*G0_1_1;
+    A[51] = -0.203174603174608*G0_0_0 - 0.101587301587299*G0_0_1 - 0.101587301587308*G0_1_0;
+    A[52] = -0.152380952380962*G0_0_0 - 0.0423280423280468*G0_0_1 - 0.0423280423280387*G0_1_0;
+    A[53] = -0.338624338624347*G0_0_0 - 0.101587301587293*G0_0_1 - 0.101587301587305*G0_1_0;
+    A[54] = -0.135449735449738*G0_0_0 - 0.237037037037048*G0_0_1 - 0.237037037037034*G0_1_0 - 0.338624338624348*G0_1_1;
+    A[55] = 0.101587301587305*G0_0_0 + 0.465608465608476*G0_0_1 + 0.46560846560846*G0_1_0 + 0.761904761904764*G0_1_1;
     A[56] = -0.135449735449735*G0_0_0 - 1.04973544973545*G0_0_1 - 1.04973544973545*G0_1_0 - 2.09947089947091*G0_1_1;
-    A[57] = 0.812698412698434*G0_0_0 + 0.33862433862435*G0_0_1 + 0.338624338624353*G0_1_0 + 1.00475183728577e-14*G0_1_1;
+    A[57] = 0.812698412698433*G0_0_0 + 0.338624338624351*G0_0_1 + 0.33862433862435*G0_1_0;
     A[58] = -2.43809523809527*G0_0_0 - 1.28677248677251*G0_0_1 - 1.2867724867725*G0_1_0;
-    A[59] = 0.812698412698425*G0_0_0 + 0.338624338624325*G0_0_1 + 0.338624338624332*G0_1_0 - 2.17326157070374e-14*G0_1_1;
-    A[60] = 0.0423280423280441*G0_0_0 + 0.0423280423280453*G0_0_1 + 0.0423280423280453*G0_1_0 + 0.0423280423280471*G0_1_1;
-    A[61] = 0.042328042328044*G0_0_0 - 0.425396825396829*G0_1_0;
-    A[62] = -0.42539682539683*G0_0_1 + 0.0423280423280409*G0_1_1;
-    A[63] = -0.660317460317462*G0_0_0 - 0.296296296296294*G0_0_1 + 0.82116402116403*G0_1_0 - 0.761904761904771*G0_1_1;
-    A[64] = 2.45079365079368*G0_0_0 + 0.971428571428585*G0_0_1 + 0.971428571428585*G0_1_0 + 2.45079365079368*G0_1_1;
-    A[65] = -0.761904761904775*G0_0_0 + 0.821164021164029*G0_0_1 - 0.296296296296305*G0_1_0 - 0.66031746031747*G0_1_1;
-    A[66] = -0.152380952380959*G0_0_0 - 0.11005291005292*G0_0_1 - 0.110052910052904*G0_1_0 - 0.067724867724875*G0_1_1;
-    A[67] = 0.39365079365081*G0_0_0 + 0.196825396825416*G0_0_1 + 0.196825396825392*G0_1_0 + 0.0507936507936545*G0_1_1;
-    A[68] = 0.761904761904774*G0_0_0 + 0.296296296296291*G0_0_1 + 0.296296296296305*G0_1_0 - 0.0677248677248662*G0_1_1;
-    A[69] = -0.0677248677248729*G0_0_0 - 0.110052910052916*G0_0_1 - 0.11005291005292*G0_1_0 - 0.152380952380956*G0_1_1;
-    A[70] = 0.0507936507936558*G0_0_0 + 0.196825396825401*G0_0_1 + 0.196825396825416*G0_1_0 + 0.393650793650814*G0_1_1;
-    A[71] = -0.0677248677248709*G0_0_0 + 0.296296296296296*G0_0_1 + 0.296296296296287*G0_1_0 + 0.761904761904772*G0_1_1;
-    A[72] = 0.406349206349221*G0_0_0 + 0.457142857142873*G0_0_1 + 0.457142857142865*G0_1_0 + 0.40634920634921*G0_1_1;
-    A[73] = 0.4063492063492*G0_0_0 - 1.16825396825399*G0_0_1 - 1.16825396825399*G0_1_0 - 2.8444444444445*G0_1_1;
-    A[74] = -2.84444444444449*G0_0_0 - 1.16825396825399*G0_0_1 - 1.16825396825398*G0_1_0 + 0.406349206349214*G0_1_1;
-    A[75] = 0.0423280423280441*G0_0_0 + 0.0423280423280427*G0_0_1 + 0.0423280423280442*G0_1_0 + 0.0423280423280429*G0_1_1;
-    A[76] = -0.0423280423280437*G0_0_0 + 0.203174603174603*G0_1_0;
+    A[59] = 0.812698412698425*G0_0_0 + 0.338624338624325*G0_0_1 + 0.338624338624333*G0_1_0 - 1.97741129026596e-14*G0_1_1;
+    A[60] = 0.0423280423280446*G0_0_0 + 0.0423280423280457*G0_0_1 + 0.0423280423280451*G0_1_0 + 0.0423280423280465*G0_1_1;
+    A[61] = 0.0423280423280441*G0_0_0 - 0.425396825396828*G0_1_0;
+    A[62] = -0.425396825396831*G0_0_1 + 0.0423280423280413*G0_1_1;
+    A[63] = -0.660317460317463*G0_0_0 - 0.296296296296294*G0_0_1 + 0.82116402116403*G0_1_0 - 0.761904761904769*G0_1_1;
+    A[64] = 2.45079365079369*G0_0_0 + 0.971428571428586*G0_0_1 + 0.971428571428586*G0_1_0 + 2.45079365079368*G0_1_1;
+    A[65] = -0.761904761904778*G0_0_0 + 0.821164021164027*G0_0_1 - 0.296296296296305*G0_1_0 - 0.660317460317471*G0_1_1;
+    A[66] = -0.152380952380959*G0_0_0 - 0.110052910052922*G0_0_1 - 0.110052910052906*G0_1_0 - 0.0677248677248747*G0_1_1;
+    A[67] = 0.39365079365081*G0_0_0 + 0.196825396825416*G0_0_1 + 0.196825396825393*G0_1_0 + 0.0507936507936553*G0_1_1;
+    A[68] = 0.761904761904778*G0_0_0 + 0.296296296296293*G0_0_1 + 0.296296296296305*G0_1_0 - 0.0677248677248661*G0_1_1;
+    A[69] = -0.0677248677248733*G0_0_0 - 0.110052910052915*G0_0_1 - 0.110052910052919*G0_1_0 - 0.152380952380956*G0_1_1;
+    A[70] = 0.0507936507936558*G0_0_0 + 0.196825396825401*G0_0_1 + 0.196825396825416*G0_1_0 + 0.393650793650815*G0_1_1;
+    A[71] = -0.0677248677248711*G0_0_0 + 0.296296296296296*G0_0_1 + 0.296296296296287*G0_1_0 + 0.761904761904772*G0_1_1;
+    A[72] = 0.406349206349222*G0_0_0 + 0.457142857142873*G0_0_1 + 0.457142857142868*G0_1_0 + 0.406349206349211*G0_1_1;
+    A[73] = 0.406349206349199*G0_0_0 - 1.16825396825399*G0_0_1 - 1.16825396825399*G0_1_0 - 2.8444444444445*G0_1_1;
+    A[74] = -2.8444444444445*G0_0_0 - 1.16825396825399*G0_0_1 - 1.16825396825398*G0_1_0 + 0.406349206349213*G0_1_1;
+    A[75] = 0.0423280423280435*G0_0_0 + 0.0423280423280422*G0_0_1 + 0.0423280423280441*G0_1_0 + 0.042328042328043*G0_1_1;
+    A[76] = -0.042328042328044*G0_0_0 + 0.203174603174603*G0_1_0;
     A[77] = 0.778835978835986*G0_0_1 + 0.126984126984128*G0_1_1;
-    A[78] = 0.338624338624346*G0_0_0 + 0.101587301587306*G0_0_1 - 0.440211640211639*G0_1_0 + 0.338624338624345*G0_1_1;
-    A[79] = -0.761904761904775*G0_0_0 - 0.296296296296305*G0_0_1 + 0.821164021164029*G0_1_0 - 0.66031746031747*G0_1_1;
-    A[80] = 2.09947089947093*G0_0_0 + 1.04973544973546*G0_0_1 + 1.04973544973546*G0_1_0 + 1.82857142857145*G0_1_1;
-    A[81] = -0.338624338624347*G0_0_0 - 0.237037037037042*G0_0_1 - 0.23703703703705*G0_1_0 - 0.135449735449743*G0_1_1;
-    A[82] = 0.761904761904777*G0_0_0 + 0.465608465608474*G0_0_1 + 0.465608465608489*G0_1_0 + 0.101587301587317*G0_1_1;
-    A[83] = -2.09947089947093*G0_0_0 - 1.04973544973546*G0_0_1 - 1.04973544973546*G0_1_0 - 0.13544973544974*G0_1_1;
-    A[84] = -0.101587301587306*G0_0_1 - 0.101587301587306*G0_1_0 - 0.203174603174614*G0_1_1;
-    A[85] = -0.0423280423280415*G0_0_1 - 0.042328042328048*G0_1_0 - 0.152380952380963*G0_1_1;
+    A[78] = 0.338624338624348*G0_0_0 + 0.101587301587305*G0_0_1 - 0.440211640211639*G0_1_0 + 0.338624338624345*G0_1_1;
+    A[79] = -0.761904761904778*G0_0_0 - 0.296296296296305*G0_0_1 + 0.821164021164027*G0_1_0 - 0.660317460317471*G0_1_1;
+    A[80] = 2.09947089947093*G0_0_0 + 1.04973544973547*G0_0_1 + 1.04973544973547*G0_1_0 + 1.82857142857145*G0_1_1;
+    A[81] = -0.338624338624345*G0_0_0 - 0.237037037037041*G0_0_1 - 0.237037037037049*G0_1_0 - 0.135449735449743*G0_1_1;
+    A[82] = 0.761904761904774*G0_0_0 + 0.465608465608473*G0_0_1 + 0.465608465608488*G0_1_0 + 0.101587301587316*G0_1_1;
+    A[83] = -2.09947089947093*G0_0_0 - 1.04973544973546*G0_0_1 - 1.04973544973547*G0_1_0 - 0.13544973544974*G0_1_1;
+    A[84] = -0.101587301587306*G0_0_1 - 0.101587301587306*G0_1_0 - 0.203174603174613*G0_1_1;
+    A[85] = -0.0423280423280419*G0_0_1 - 0.0423280423280475*G0_1_0 - 0.152380952380963*G0_1_1;
     A[86] = -0.101587301587298*G0_0_1 - 0.101587301587294*G0_1_0 - 0.338624338624339*G0_1_1;
-    A[87] = 0.338624338624353*G0_0_1 + 0.33862433862436*G0_1_0 + 0.812698412698448*G0_1_1;
-    A[88] = 0.338624338624336*G0_0_1 + 0.338624338624329*G0_1_0 + 0.812698412698425*G0_1_1;
-    A[89] = -1.28677248677251*G0_0_1 - 1.28677248677252*G0_1_0 - 2.43809523809529*G0_1_1;
-    A[90] = 0.126984126984129*G0_0_0 + 0.126984126984129*G0_0_1 - 0.651851851851861*G0_1_0 - 0.65185185185186*G0_1_1;
-    A[91] = 0.0423280423280439*G0_0_0;
+    A[87] = 0.338624338624353*G0_0_1 + 0.338624338624358*G0_1_0 + 0.812698412698448*G0_1_1;
+    A[88] = -1.04950770296597e-14*G0_0_0 + 0.338624338624335*G0_0_1 + 0.338624338624329*G0_1_0 + 0.812698412698426*G0_1_1;
+    A[89] = -1.28677248677251*G0_0_1 - 1.28677248677251*G0_1_0 - 2.43809523809529*G0_1_1;
+    A[90] = 0.12698412698413*G0_0_0 + 0.12698412698413*G0_0_1 - 0.651851851851861*G0_1_0 - 0.651851851851861*G0_1_1;
+    A[91] = 0.0423280423280441*G0_0_0;
     A[92] = -0.203174603174605*G0_0_1 - 0.245502645502647*G0_1_1;
-    A[93] = -0.203174603174608*G0_0_0 - 0.101587301587309*G0_0_1 - 0.101587301587301*G0_1_0;
-    A[94] = -0.152380952380959*G0_0_0 - 0.110052910052904*G0_0_1 - 0.110052910052921*G0_1_0 - 0.067724867724875*G0_1_1;
-    A[95] = -0.338624338624347*G0_0_0 - 0.23703703703705*G0_0_1 - 0.237037037037042*G0_1_0 - 0.135449735449743*G0_1_1;
-    A[96] = 1.82857142857145*G0_0_0 + 0.778835978835991*G0_0_1 + 0.778835978835991*G0_1_0 + 1.82857142857145*G0_1_1;
-    A[97] = -0.66031746031746*G0_0_0 - 1.4814814814815*G0_0_1 - 0.364021164021167*G0_1_0 - 1.94708994708997*G0_1_1;
-    A[98] = 0.338624338624347*G0_0_0 + 0.778835978835982*G0_0_1 + 0.237037037037042*G0_1_0 + 1.01587301587302*G0_1_1;
-    A[99] = -0.135449735449746*G0_0_0 + 0.914285714285717*G0_0_1 + 0.914285714285723*G0_1_0 - 0.13544973544974*G0_1_1;
-    A[100] = 0.101587301587317*G0_0_0 - 0.364021164021167*G0_0_1 - 0.364021164021162*G0_1_0 - 0.0677248677248677*G0_1_1;
-    A[101] = -0.135449735449744*G0_0_0 + 0.101587301587302*G0_0_1 + 0.101587301587297*G0_1_0;
+    A[93] = -0.203174603174608*G0_0_0 - 0.101587301587308*G0_0_1 - 0.101587301587299*G0_1_0;
+    A[94] = -0.152380952380959*G0_0_0 - 0.110052910052906*G0_0_1 - 0.110052910052922*G0_1_0 - 0.0677248677248747*G0_1_1;
+    A[95] = -0.338624338624346*G0_0_0 - 0.237037037037049*G0_0_1 - 0.237037037037041*G0_1_0 - 0.135449735449743*G0_1_1;
+    A[96] = 1.82857142857145*G0_0_0 + 0.77883597883599*G0_0_1 + 0.77883597883599*G0_1_0 + 1.82857142857145*G0_1_1;
+    A[97] = -0.660317460317459*G0_0_0 - 1.4814814814815*G0_0_1 - 0.364021164021167*G0_1_0 - 1.94708994708997*G0_1_1;
+    A[98] = 0.338624338624346*G0_0_0 + 0.778835978835981*G0_0_1 + 0.237037037037041*G0_1_0 + 1.01587301587303*G0_1_1;
+    A[99] = -0.135449735449746*G0_0_0 + 0.914285714285717*G0_0_1 + 0.914285714285725*G0_1_0 - 0.13544973544974*G0_1_1;
+    A[100] = 0.101587301587317*G0_0_0 - 0.364021164021167*G0_0_1 - 0.364021164021163*G0_1_0 - 0.0677248677248673*G0_1_1;
+    A[101] = -0.135449735449745*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587297*G0_1_0;
     A[102] = -2.43809523809528*G0_0_0 - 1.15132275132276*G0_0_1 - 1.15132275132277*G0_1_0 + 0.135449735449737*G0_1_1;
-    A[103] = 0.812698412698441*G0_0_0 + 0.474074074074079*G0_0_1 + 0.474074074074084*G0_1_0 + 0.135449735449742*G0_1_1;
-    A[104] = 0.812698412698418*G0_0_0 + 0.474074074074096*G0_0_1 + 0.474074074074088*G0_1_0 + 0.135449735449744*G0_1_1;
-    A[105] = 0.0423280423280427*G0_0_0 + 0.0423280423280443*G0_0_1 + 0.467724867724872*G0_1_0 + 0.467724867724872*G0_1_1;
+    A[103] = 0.812698412698443*G0_0_0 + 0.474074074074081*G0_0_1 + 0.474074074074082*G0_1_0 + 0.135449735449742*G0_1_1;
+    A[104] = 0.812698412698416*G0_0_0 + 0.474074074074096*G0_0_1 + 0.474074074074089*G0_1_0 + 0.135449735449744*G0_1_1;
+    A[105] = 0.0423280423280427*G0_0_0 + 0.0423280423280442*G0_0_1 + 0.467724867724873*G0_1_0 + 0.467724867724873*G0_1_1;
     A[106] = 0.0423280423280454*G0_0_0;
-    A[107] = 0.425396825396831*G0_0_1 + 0.467724867724872*G0_1_1;
-    A[108] = -0.152380952380963*G0_0_0 - 0.0423280423280381*G0_0_1 - 0.0423280423280453*G0_1_0;
-    A[109] = 0.39365079365081*G0_0_0 + 0.196825396825392*G0_0_1 + 0.196825396825416*G0_1_0 + 0.0507936507936545*G0_1_1;
-    A[110] = 0.761904761904777*G0_0_0 + 0.465608465608489*G0_0_1 + 0.465608465608474*G0_1_0 + 0.101587301587317*G0_1_1;
-    A[111] = -0.66031746031746*G0_0_0 - 0.364021164021167*G0_0_1 - 1.4814814814815*G0_1_0 - 1.94708994708997*G0_1_1;
+    A[107] = 0.42539682539683*G0_0_1 + 0.467724867724872*G0_1_1;
+    A[108] = -0.152380952380962*G0_0_0 - 0.0423280423280387*G0_0_1 - 0.0423280423280468*G0_1_0;
+    A[109] = 0.39365079365081*G0_0_0 + 0.196825396825393*G0_0_1 + 0.196825396825417*G0_1_0 + 0.0507936507936553*G0_1_1;
+    A[110] = 0.761904761904775*G0_0_0 + 0.465608465608488*G0_0_1 + 0.465608465608474*G0_1_0 + 0.101587301587316*G0_1_1;
+    A[111] = -0.660317460317459*G0_0_0 - 0.364021164021167*G0_0_1 - 1.4814814814815*G0_1_0 - 1.94708994708997*G0_1_1;
     A[112] = 2.45079365079368*G0_0_0 + 1.4793650793651*G0_0_1 + 1.4793650793651*G0_1_0 + 2.95873015873019*G0_1_1;
-    A[113] = -0.761904761904777*G0_0_0 - 1.58306878306881*G0_0_1 - 0.465608465608475*G0_1_0 - 1.94708994708997*G0_1_1;
-    A[114] = -0.0677248677248669*G0_0_0 - 0.364021164021163*G0_0_1 - 0.36402116402116*G0_1_0 + 0.101587301587309*G0_1_1;
-    A[115] = 0.0507936507936533*G0_0_0 - 0.146031746031747*G0_0_1 - 0.146031746031758*G0_1_0 + 0.0507936507936549*G0_1_1;
-    A[116] = -0.0677248677248746*G0_0_0 + 0.0423280423280399*G0_0_1 + 0.0423280423280452*G0_1_0;
+    A[113] = -0.761904761904775*G0_0_0 - 1.58306878306881*G0_0_1 - 0.465608465608474*G0_1_0 - 1.94708994708997*G0_1_1;
+    A[114] = -0.0677248677248671*G0_0_0 - 0.364021164021163*G0_0_1 - 0.364021164021162*G0_1_0 + 0.10158730158731*G0_1_1;
+    A[115] = 0.0507936507936535*G0_0_0 - 0.146031746031747*G0_0_1 - 0.146031746031757*G0_1_0 + 0.0507936507936538*G0_1_1;
+    A[116] = -0.0677248677248745*G0_0_0 + 0.0423280423280408*G0_0_1 + 0.0423280423280455*G0_1_0;
     A[117] = 0.40634920634919*G0_0_0 + 1.57460317460318*G0_0_1 + 1.5746031746032*G0_1_0 - 0.10158730158731*G0_1_1;
-    A[118] = 0.406349206349233*G0_0_0 - 0.0507936507936454*G0_0_1 - 0.0507936507936539*G0_1_0 - 0.101587301587311*G0_1_1;
-    A[119] = -2.8444444444445*G0_0_0 - 1.67619047619051*G0_0_1 - 1.67619047619051*G0_1_0 - 0.101587301587313*G0_1_1;
-    A[120] = -0.0423280423280441*G0_0_0 - 0.0423280423280427*G0_0_1 - 0.245502645502648*G0_1_0 - 0.245502645502648*G0_1_1;
-    A[121] = 0.0423280423280437*G0_0_0;
+    A[118] = 0.40634920634923*G0_0_0 - 0.0507936507936479*G0_0_1 - 0.0507936507936521*G0_1_0 - 0.101587301587311*G0_1_1;
+    A[119] = -2.84444444444449*G0_0_0 - 1.6761904761905*G0_0_1 - 1.67619047619051*G0_1_0 - 0.101587301587314*G0_1_1;
+    A[120] = -0.0423280423280435*G0_0_0 - 0.0423280423280422*G0_0_1 - 0.245502645502648*G0_1_0 - 0.245502645502648*G0_1_1;
+    A[121] = 0.042328042328044*G0_0_0;
     A[122] = -0.778835978835986*G0_0_1 - 0.651851851851857*G0_1_1;
-    A[123] = -0.338624338624346*G0_0_0 - 0.101587301587305*G0_0_1 - 0.101587301587292*G0_1_0;
-    A[124] = 0.761904761904774*G0_0_0 + 0.296296296296305*G0_0_1 + 0.296296296296291*G0_1_0 - 0.0677248677248662*G0_1_1;
-    A[125] = -2.09947089947093*G0_0_0 - 1.04973544973546*G0_0_1 - 1.04973544973546*G0_1_0 - 0.13544973544974*G0_1_1;
-    A[126] = 0.338624338624347*G0_0_0 + 0.237037037037042*G0_0_1 + 0.778835978835982*G0_1_0 + 1.01587301587302*G0_1_1;
-    A[127] = -0.761904761904777*G0_0_0 - 0.465608465608475*G0_0_1 - 1.58306878306881*G0_1_0 - 1.94708994708997*G0_1_1;
+    A[123] = -0.338624338624347*G0_0_0 - 0.101587301587305*G0_0_1 - 0.101587301587293*G0_1_0;
+    A[124] = 0.761904761904778*G0_0_0 + 0.296296296296305*G0_0_1 + 0.296296296296293*G0_1_0 - 0.0677248677248661*G0_1_1;
+    A[125] = -2.09947089947093*G0_0_0 - 1.04973544973547*G0_0_1 - 1.04973544973546*G0_1_0 - 0.13544973544974*G0_1_1;
+    A[126] = 0.338624338624346*G0_0_0 + 0.237037037037041*G0_0_1 + 0.778835978835981*G0_1_0 + 1.01587301587303*G0_1_1;
+    A[127] = -0.761904761904775*G0_0_0 - 0.465608465608474*G0_0_1 - 1.58306878306881*G0_1_0 - 1.94708994708997*G0_1_1;
     A[128] = 2.09947089947093*G0_0_0 + 1.04973544973546*G0_0_1 + 1.04973544973546*G0_1_0 + 1.82857142857145*G0_1_1;
-    A[129] = 0.101587301587306*G0_0_1 + 0.101587301587297*G0_1_0 - 0.135449735449746*G0_1_1;
-    A[130] = 0.0423280423280414*G0_0_1 + 0.0423280423280461*G0_1_0 - 0.0677248677248762*G0_1_1;
+    A[129] = 0.101587301587306*G0_0_1 + 0.101587301587298*G0_1_0 - 0.135449735449746*G0_1_1;
+    A[130] = 0.0423280423280418*G0_0_1 + 0.0423280423280454*G0_1_0 - 0.0677248677248762*G0_1_1;
     A[131] = 0.101587301587298*G0_0_1 + 0.101587301587305*G0_1_0;
-    A[132] = -1.04291575375726e-14*G0_0_0 - 0.338624338624353*G0_0_1 - 0.33862433862434*G0_1_0 + 0.135449735449746*G0_1_1;
-    A[133] = -0.338624338624336*G0_0_1 - 0.338624338624351*G0_1_0 + 0.135449735449745*G0_1_1;
-    A[134] = 1.28677248677251*G0_0_1 + 1.28677248677252*G0_1_0 + 0.135449735449738*G0_1_1;
-    A[135] = -0.651851851851863*G0_0_0 - 0.651851851851862*G0_0_1 + 0.126984126984129*G0_1_0 + 0.126984126984128*G0_1_1;
-    A[136] = -0.245502645502647*G0_0_0 - 0.203174603174605*G0_1_0;
-    A[137] = 0.0423280423280431*G0_1_1;
-    A[138] = -0.135449735449738*G0_0_0 - 0.237037037037034*G0_0_1 - 0.237037037037048*G0_1_0 - 0.338624338624349*G0_1_1;
-    A[139] = -0.0677248677248729*G0_0_0 - 0.11005291005292*G0_0_1 - 0.110052910052916*G0_1_0 - 0.152380952380956*G0_1_1;
-    A[140] = -0.101587301587306*G0_0_1 - 0.101587301587306*G0_1_0 - 0.203174603174614*G0_1_1;
-    A[141] = -0.135449735449746*G0_0_0 + 0.914285714285723*G0_0_1 + 0.914285714285717*G0_1_0 - 0.13544973544974*G0_1_1;
-    A[142] = -0.0677248677248669*G0_0_0 - 0.36402116402116*G0_0_1 - 0.364021164021163*G0_1_0 + 0.101587301587309*G0_1_1;
-    A[143] = 0.101587301587297*G0_0_1 + 0.101587301587306*G0_1_0 - 0.135449735449746*G0_1_1;
+    A[132] = -0.338624338624353*G0_0_1 - 0.338624338624339*G0_1_0 + 0.135449735449747*G0_1_1;
+    A[133] = 1.05922215443144e-14*G0_0_0 - 0.338624338624335*G0_0_1 - 0.338624338624349*G0_1_0 + 0.135449735449745*G0_1_1;
+    A[134] = 1.28677248677251*G0_0_1 + 1.28677248677251*G0_1_0 + 0.135449735449737*G0_1_1;
+    A[135] = -0.651851851851863*G0_0_0 - 0.651851851851863*G0_0_1 + 0.126984126984129*G0_1_0 + 0.126984126984129*G0_1_1;
+    A[136] = -0.245502645502647*G0_0_0 - 0.203174603174604*G0_1_0;
+    A[137] = 0.0423280423280433*G0_1_1;
+    A[138] = -0.135449735449738*G0_0_0 - 0.237037037037034*G0_0_1 - 0.237037037037048*G0_1_0 - 0.338624338624348*G0_1_1;
+    A[139] = -0.0677248677248732*G0_0_0 - 0.110052910052919*G0_0_1 - 0.110052910052915*G0_1_0 - 0.152380952380956*G0_1_1;
+    A[140] = -0.101587301587306*G0_0_1 - 0.101587301587306*G0_1_0 - 0.203174603174613*G0_1_1;
+    A[141] = -0.135449735449746*G0_0_0 + 0.914285714285725*G0_0_1 + 0.914285714285717*G0_1_0 - 0.13544973544974*G0_1_1;
+    A[142] = -0.0677248677248671*G0_0_0 - 0.364021164021162*G0_0_1 - 0.364021164021163*G0_1_0 + 0.10158730158731*G0_1_1;
+    A[143] = 0.101587301587298*G0_0_1 + 0.101587301587306*G0_1_0 - 0.135449735449746*G0_1_1;
     A[144] = 1.82857142857146*G0_0_0 + 0.778835978835987*G0_0_1 + 0.778835978835987*G0_1_0 + 1.82857142857145*G0_1_1;
-    A[145] = -1.94708994708997*G0_0_0 - 0.364021164021163*G0_0_1 - 1.48148148148149*G0_1_0 - 0.660317460317458*G0_1_1;
-    A[146] = 1.01587301587303*G0_0_0 + 0.237037037037036*G0_0_1 + 0.778835978835982*G0_1_0 + 0.338624338624343*G0_1_1;
+    A[145] = -1.94708994708997*G0_0_0 - 0.364021164021164*G0_0_1 - 1.48148148148149*G0_1_0 - 0.660317460317457*G0_1_1;
+    A[146] = 1.01587301587302*G0_0_0 + 0.237037037037036*G0_0_1 + 0.778835978835982*G0_1_0 + 0.338624338624341*G0_1_1;
     A[147] = 0.135449735449747*G0_0_0 - 1.15132275132277*G0_0_1 - 1.15132275132276*G0_1_0 - 2.43809523809528*G0_1_1;
-    A[148] = 0.135449735449737*G0_0_0 + 0.47407407407408*G0_0_1 + 0.474074074074093*G0_1_0 + 0.812698412698418*G0_1_1;
-    A[149] = 0.13544973544974*G0_0_0 + 0.474074074074091*G0_0_1 + 0.474074074074079*G0_1_0 + 0.812698412698447*G0_1_1;
-    A[150] = 0.467724867724875*G0_0_0 + 0.467724867724875*G0_0_1 + 0.0423280423280429*G0_1_0 + 0.042328042328042*G0_1_1;
-    A[151] = 0.467724867724869*G0_0_0 + 0.425396825396828*G0_1_0;
+    A[148] = 0.135449735449737*G0_0_0 + 0.47407407407408*G0_0_1 + 0.474074074074093*G0_1_0 + 0.812698412698419*G0_1_1;
+    A[149] = 0.13544973544974*G0_0_0 + 0.474074074074092*G0_0_1 + 0.474074074074078*G0_1_0 + 0.812698412698447*G0_1_1;
+    A[150] = 0.467724867724875*G0_0_0 + 0.467724867724875*G0_0_1 + 0.042328042328043*G0_1_0 + 0.0423280423280421*G0_1_1;
+    A[151] = 0.467724867724869*G0_0_0 + 0.425396825396827*G0_1_0;
     A[152] = 0.0423280423280456*G0_1_1;
-    A[153] = 0.101587301587305*G0_0_0 + 0.465608465608459*G0_0_1 + 0.465608465608478*G0_1_0 + 0.761904761904767*G0_1_1;
-    A[154] = 0.0507936507936558*G0_0_0 + 0.196825396825416*G0_0_1 + 0.196825396825401*G0_1_0 + 0.393650793650814*G0_1_1;
-    A[155] = -0.042328042328048*G0_0_1 - 0.0423280423280415*G0_1_0 - 0.152380952380963*G0_1_1;
-    A[156] = 0.101587301587317*G0_0_0 - 0.364021164021162*G0_0_1 - 0.364021164021167*G0_1_0 - 0.0677248677248677*G0_1_1;
-    A[157] = 0.0507936507936533*G0_0_0 - 0.146031746031758*G0_0_1 - 0.146031746031747*G0_1_0 + 0.0507936507936549*G0_1_1;
-    A[158] = 0.0423280423280461*G0_0_1 + 0.0423280423280414*G0_1_0 - 0.0677248677248762*G0_1_1;
-    A[159] = -1.94708994708997*G0_0_0 - 1.48148148148149*G0_0_1 - 0.364021164021163*G0_1_0 - 0.660317460317458*G0_1_1;
+    A[153] = 0.101587301587305*G0_0_0 + 0.46560846560846*G0_0_1 + 0.465608465608476*G0_1_0 + 0.761904761904764*G0_1_1;
+    A[154] = 0.0507936507936558*G0_0_0 + 0.196825396825416*G0_0_1 + 0.196825396825401*G0_1_0 + 0.393650793650815*G0_1_1;
+    A[155] = -0.0423280423280475*G0_0_1 - 0.0423280423280419*G0_1_0 - 0.152380952380963*G0_1_1;
+    A[156] = 0.101587301587317*G0_0_0 - 0.364021164021163*G0_0_1 - 0.364021164021167*G0_1_0 - 0.0677248677248673*G0_1_1;
+    A[157] = 0.0507936507936535*G0_0_0 - 0.146031746031757*G0_0_1 - 0.146031746031747*G0_1_0 + 0.0507936507936538*G0_1_1;
+    A[158] = 0.0423280423280454*G0_0_1 + 0.0423280423280417*G0_1_0 - 0.0677248677248762*G0_1_1;
+    A[159] = -1.94708994708997*G0_0_0 - 1.48148148148149*G0_0_1 - 0.364021164021164*G0_1_0 - 0.660317460317457*G0_1_1;
     A[160] = 2.95873015873019*G0_0_0 + 1.47936507936509*G0_0_1 + 1.47936507936509*G0_1_0 + 2.45079365079369*G0_1_1;
-    A[161] = -1.94708994708997*G0_0_0 - 0.465608465608461*G0_0_1 - 1.5830687830688*G0_1_0 - 0.761904761904768*G0_1_1;
-    A[162] = -0.101587301587322*G0_0_0 + 1.57460317460319*G0_0_1 + 1.57460317460319*G0_1_0 + 0.406349206349184*G0_1_1;
-    A[163] = -0.101587301587301*G0_0_0 - 1.67619047619051*G0_0_1 - 1.6761904761905*G0_1_0 - 2.8444444444445*G0_1_1;
-    A[164] = -0.101587301587309*G0_0_0 - 0.0507936507936534*G0_0_1 - 0.0507936507936531*G0_1_0 + 0.406349206349237*G0_1_1;
-    A[165] = -0.245502645502649*G0_0_0 - 0.245502645502647*G0_0_1 - 0.0423280423280437*G0_1_0 - 0.0423280423280406*G0_1_1;
+    A[161] = -1.94708994708996*G0_0_0 - 0.465608465608461*G0_0_1 - 1.5830687830688*G0_1_0 - 0.761904761904766*G0_1_1;
+    A[162] = -0.10158730158732*G0_0_0 + 1.57460317460319*G0_0_1 + 1.57460317460319*G0_1_0 + 0.406349206349183*G0_1_1;
+    A[163] = -0.101587301587302*G0_0_0 - 1.67619047619051*G0_0_1 - 1.6761904761905*G0_1_0 - 2.8444444444445*G0_1_1;
+    A[164] = -0.101587301587309*G0_0_0 - 0.0507936507936541*G0_0_1 - 0.0507936507936537*G0_1_0 + 0.406349206349239*G0_1_1;
+    A[165] = -0.245502645502649*G0_0_0 - 0.245502645502648*G0_0_1 - 0.0423280423280434*G0_1_0 - 0.0423280423280406*G0_1_1;
     A[166] = -0.651851851851855*G0_0_0 - 0.778835978835983*G0_1_0;
-    A[167] = 0.0423280423280437*G0_1_1;
+    A[167] = 0.042328042328044*G0_1_1;
     A[168] = -0.135449735449735*G0_0_0 - 1.04973544973545*G0_0_1 - 1.04973544973545*G0_1_0 - 2.09947089947091*G0_1_1;
-    A[169] = -0.0677248677248709*G0_0_0 + 0.296296296296287*G0_0_1 + 0.296296296296296*G0_1_0 + 0.761904761904772*G0_1_1;
+    A[169] = -0.0677248677248711*G0_0_0 + 0.296296296296287*G0_0_1 + 0.296296296296296*G0_1_0 + 0.761904761904772*G0_1_1;
     A[170] = -0.101587301587294*G0_0_1 - 0.101587301587298*G0_1_0 - 0.338624338624339*G0_1_1;
-    A[171] = -0.135449735449744*G0_0_0 + 0.101587301587297*G0_0_1 + 0.101587301587302*G0_1_0;
-    A[172] = -0.0677248677248746*G0_0_0 + 0.0423280423280452*G0_0_1 + 0.0423280423280399*G0_1_0;
+    A[171] = -0.135449735449745*G0_0_0 + 0.101587301587297*G0_0_1 + 0.101587301587301*G0_1_0;
+    A[172] = -0.0677248677248745*G0_0_0 + 0.0423280423280455*G0_0_1 + 0.0423280423280408*G0_1_0;
     A[173] = 0.101587301587305*G0_0_1 + 0.101587301587298*G0_1_0;
-    A[174] = 1.01587301587303*G0_0_0 + 0.778835978835982*G0_0_1 + 0.237037037037036*G0_1_0 + 0.338624338624343*G0_1_1;
-    A[175] = -1.94708994708997*G0_0_0 - 1.5830687830688*G0_0_1 - 0.465608465608461*G0_1_0 - 0.761904761904768*G0_1_1;
+    A[174] = 1.01587301587302*G0_0_0 + 0.778835978835982*G0_0_1 + 0.237037037037036*G0_1_0 + 0.338624338624341*G0_1_1;
+    A[175] = -1.94708994708996*G0_0_0 - 1.5830687830688*G0_0_1 - 0.465608465608461*G0_1_0 - 0.761904761904766*G0_1_1;
     A[176] = 1.82857142857144*G0_0_0 + 1.04973544973545*G0_0_1 + 1.04973544973545*G0_1_0 + 2.09947089947091*G0_1_1;
-    A[177] = 0.13544973544975*G0_0_0 - 0.338624338624333*G0_0_1 - 0.33862433862435*G0_1_0;
-    A[178] = 0.13544973544973*G0_0_0 + 1.28677248677251*G0_0_1 + 1.2867724867725*G0_1_0;
-    A[179] = 0.135449735449745*G0_0_0 - 0.338624338624349*G0_0_1 - 0.338624338624336*G0_1_0 + 1.72344777338296e-14*G0_1_1;
-    A[180] = -0.084656084656088*G0_0_0 - 0.0846560846560879*G0_0_1 - 0.0846560846560872*G0_1_0 - 0.0846560846560849*G0_1_1;
-    A[181] = -0.0846560846560875*G0_0_0;
-    A[182] = -0.0846560846560863*G0_1_1;
-    A[183] = 0.812698412698434*G0_0_0 + 0.338624338624353*G0_0_1 + 0.338624338624349*G0_1_0 + 1.00006808390063e-14*G0_1_1;
-    A[184] = 0.406349206349221*G0_0_0 + 0.457142857142865*G0_0_1 + 0.457142857142873*G0_1_0 + 0.40634920634921*G0_1_1;
-    A[185] = 0.33862433862436*G0_0_1 + 0.338624338624353*G0_1_0 + 0.812698412698448*G0_1_1;
+    A[177] = 0.135449735449751*G0_0_0 - 0.338624338624333*G0_0_1 - 0.338624338624348*G0_1_0;
+    A[178] = 0.135449735449729*G0_0_0 + 1.28677248677251*G0_0_1 + 1.2867724867725*G0_1_0;
+    A[179] = 0.135449735449746*G0_0_0 - 0.33862433862435*G0_0_1 - 0.338624338624337*G0_1_0 + 1.46323925198644e-14*G0_1_1;
+    A[180] = -0.0846560846560886*G0_0_0 - 0.0846560846560888*G0_0_1 - 0.0846560846560873*G0_1_0 - 0.0846560846560853*G0_1_1;
+    A[181] = -0.0846560846560883*G0_0_0;
+    A[182] = -0.0846560846560869*G0_1_1;
+    A[183] = 0.812698412698433*G0_0_0 + 0.33862433862435*G0_0_1 + 0.338624338624351*G0_1_0;
+    A[184] = 0.406349206349222*G0_0_0 + 0.457142857142868*G0_0_1 + 0.457142857142873*G0_1_0 + 0.406349206349211*G0_1_1;
+    A[185] = 0.338624338624358*G0_0_1 + 0.338624338624353*G0_1_0 + 0.812698412698448*G0_1_1;
     A[186] = -2.43809523809528*G0_0_0 - 1.15132275132277*G0_0_1 - 1.15132275132276*G0_1_0 + 0.135449735449737*G0_1_1;
     A[187] = 0.40634920634919*G0_0_0 + 1.5746031746032*G0_0_1 + 1.57460317460318*G0_1_0 - 0.10158730158731*G0_1_1;
-    A[188] = -1.04291575375726e-14*G0_0_0 - 0.33862433862434*G0_0_1 - 0.338624338624353*G0_1_0 + 0.135449735449746*G0_1_1;
+    A[188] = -0.338624338624339*G0_0_1 - 0.338624338624353*G0_1_0 + 0.135449735449747*G0_1_1;
     A[189] = 0.135449735449747*G0_0_0 - 1.15132275132276*G0_0_1 - 1.15132275132277*G0_1_0 - 2.43809523809528*G0_1_1;
-    A[190] = -0.101587301587321*G0_0_0 + 1.57460317460319*G0_0_1 + 1.57460317460319*G0_1_0 + 0.406349206349184*G0_1_1;
-    A[191] = 0.13544973544975*G0_0_0 - 0.33862433862435*G0_0_1 - 0.338624338624333*G0_1_0;
-    A[192] = 5.68888888888898*G0_0_0 + 2.84444444444445*G0_0_1 + 2.84444444444445*G0_1_0 + 5.68888888888897*G0_1_1;
-    A[193] = -4.06349206349213*G0_0_0 - 2.03174603174606*G0_0_1 - 2.03174603174604*G0_1_0 - 0.812698412698395*G0_1_1;
-    A[194] = -0.81269841269841*G0_0_0 - 2.03174603174605*G0_0_1 - 2.03174603174605*G0_1_0 - 4.06349206349214*G0_1_1;
-    A[195] = -0.0846560846560837*G0_0_0 - 0.0846560846560822*G0_0_1 - 0.0846560846560859*G0_1_0 - 0.0846560846560868*G0_1_1;
-    A[196] = -0.0846560846560828*G0_0_0;
-    A[197] = -0.0846560846560896*G0_1_1;
+    A[190] = -0.101587301587321*G0_0_0 + 1.57460317460319*G0_0_1 + 1.57460317460319*G0_1_0 + 0.406349206349183*G0_1_1;
+    A[191] = 0.135449735449751*G0_0_0 - 0.338624338624348*G0_0_1 - 0.338624338624333*G0_1_0;
+    A[192] = 5.68888888888898*G0_0_0 + 2.84444444444446*G0_0_1 + 2.84444444444446*G0_1_0 + 5.68888888888897*G0_1_1;
+    A[193] = -4.06349206349213*G0_0_0 - 2.03174603174606*G0_0_1 - 2.03174603174605*G0_1_0 - 0.812698412698398*G0_1_1;
+    A[194] = -0.812698412698412*G0_0_0 - 2.03174603174605*G0_0_1 - 2.03174603174605*G0_1_0 - 4.06349206349214*G0_1_1;
+    A[195] = -0.0846560846560831*G0_0_0 - 0.0846560846560814*G0_0_1 - 0.0846560846560858*G0_1_0 - 0.0846560846560863*G0_1_1;
+    A[196] = -0.0846560846560815*G0_0_0;
+    A[197] = -0.0846560846560904*G0_1_1;
     A[198] = -2.43809523809527*G0_0_0 - 1.2867724867725*G0_0_1 - 1.28677248677251*G0_1_0;
-    A[199] = 0.4063492063492*G0_0_0 - 1.16825396825399*G0_0_1 - 1.16825396825399*G0_1_0 - 2.8444444444445*G0_1_1;
-    A[200] = 0.33862433862433*G0_0_1 + 0.338624338624336*G0_1_0 + 0.812698412698425*G0_1_1;
-    A[201] = 0.812698412698442*G0_0_0 + 0.474074074074084*G0_0_1 + 0.474074074074079*G0_1_0 + 0.135449735449742*G0_1_1;
-    A[202] = 0.406349206349233*G0_0_0 - 0.0507936507936542*G0_0_1 - 0.0507936507936454*G0_1_0 - 0.101587301587311*G0_1_1;
-    A[203] = -0.338624338624351*G0_0_1 - 0.338624338624336*G0_1_0 + 0.135449735449745*G0_1_1;
-    A[204] = 0.135449735449737*G0_0_0 + 0.474074074074093*G0_0_1 + 0.47407407407408*G0_1_0 + 0.812698412698418*G0_1_1;
-    A[205] = -0.101587301587301*G0_0_0 - 1.6761904761905*G0_0_1 - 1.67619047619051*G0_1_0 - 2.8444444444445*G0_1_1;
-    A[206] = 0.13544973544973*G0_0_0 + 1.2867724867725*G0_0_1 + 1.28677248677251*G0_1_0;
-    A[207] = -4.06349206349213*G0_0_0 - 2.03174603174604*G0_0_1 - 2.03174603174606*G0_1_0 - 0.812698412698395*G0_1_1;
+    A[199] = 0.406349206349199*G0_0_0 - 1.16825396825399*G0_0_1 - 1.16825396825399*G0_1_0 - 2.8444444444445*G0_1_1;
+    A[200] = -1.04950770296597e-14*G0_0_0 + 0.33862433862433*G0_0_1 + 0.338624338624335*G0_1_0 + 0.812698412698426*G0_1_1;
+    A[201] = 0.812698412698443*G0_0_0 + 0.474074074074082*G0_0_1 + 0.474074074074081*G0_1_0 + 0.135449735449742*G0_1_1;
+    A[202] = 0.40634920634923*G0_0_0 - 0.0507936507936522*G0_0_1 - 0.0507936507936479*G0_1_0 - 0.101587301587311*G0_1_1;
+    A[203] = 1.061997711993e-14*G0_0_0 - 0.33862433862435*G0_0_1 - 0.338624338624335*G0_1_0 + 0.135449735449745*G0_1_1;
+    A[204] = 0.135449735449737*G0_0_0 + 0.474074074074094*G0_0_1 + 0.47407407407408*G0_1_0 + 0.812698412698419*G0_1_1;
+    A[205] = -0.101587301587302*G0_0_0 - 1.6761904761905*G0_0_1 - 1.67619047619051*G0_1_0 - 2.8444444444445*G0_1_1;
+    A[206] = 0.135449735449729*G0_0_0 + 1.2867724867725*G0_0_1 + 1.28677248677251*G0_1_0;
+    A[207] = -4.06349206349213*G0_0_0 - 2.03174603174605*G0_0_1 - 2.03174603174606*G0_1_0 - 0.812698412698398*G0_1_1;
     A[208] = 5.68888888888896*G0_0_0 + 2.84444444444449*G0_0_1 + 2.84444444444449*G0_1_0 + 5.68888888888899*G0_1_1;
-    A[209] = -0.812698412698433*G0_0_0 + 1.21904761904763*G0_0_1 + 1.21904761904763*G0_1_0 - 0.812698412698445*G0_1_1;
-    A[210] = -0.0846560846560868*G0_0_0 - 0.0846560846560896*G0_0_1 - 0.0846560846560852*G0_1_0 - 0.0846560846560859*G0_1_1;
-    A[211] = -0.0846560846560894*G0_0_0;
-    A[212] = -0.0846560846560841*G0_1_1;
-    A[213] = 0.812698412698425*G0_0_0 + 0.338624338624332*G0_0_1 + 0.338624338624325*G0_1_0 - 2.17291462600855e-14*G0_1_1;
-    A[214] = -2.84444444444449*G0_0_0 - 1.16825396825398*G0_0_1 - 1.16825396825399*G0_1_0 + 0.406349206349214*G0_1_1;
-    A[215] = -1.28677248677252*G0_0_1 - 1.28677248677251*G0_1_0 - 2.43809523809529*G0_1_1;
-    A[216] = 0.812698412698418*G0_0_0 + 0.474074074074088*G0_0_1 + 0.474074074074096*G0_1_0 + 0.135449735449744*G0_1_1;
-    A[217] = -2.8444444444445*G0_0_0 - 1.67619047619051*G0_0_1 - 1.67619047619051*G0_1_0 - 0.101587301587313*G0_1_1;
-    A[218] = 1.28677248677252*G0_0_1 + 1.28677248677251*G0_1_0 + 0.135449735449738*G0_1_1;
-    A[219] = 0.13544973544974*G0_0_0 + 0.474074074074079*G0_0_1 + 0.474074074074091*G0_1_0 + 0.812698412698447*G0_1_1;
-    A[220] = -0.101587301587309*G0_0_0 - 0.0507936507936531*G0_0_1 - 0.0507936507936537*G0_1_0 + 0.406349206349237*G0_1_1;
-    A[221] = 0.135449735449745*G0_0_0 - 0.338624338624336*G0_0_1 - 0.338624338624349*G0_1_0 + 1.72899888850608e-14*G0_1_1;
-    A[222] = -0.81269841269841*G0_0_0 - 2.03174603174605*G0_0_1 - 2.03174603174605*G0_1_0 - 4.06349206349214*G0_1_1;
-    A[223] = -0.812698412698433*G0_0_0 + 1.21904761904763*G0_0_1 + 1.21904761904763*G0_1_0 - 0.812698412698445*G0_1_1;
+    A[209] = -0.812698412698429*G0_0_0 + 1.21904761904763*G0_0_1 + 1.21904761904764*G0_1_0 - 0.812698412698444*G0_1_1;
+    A[210] = -0.0846560846560874*G0_0_0 - 0.08465608465609*G0_0_1 - 0.084656084656085*G0_1_0 - 0.0846560846560856*G0_1_1;
+    A[211] = -0.0846560846560896*G0_0_0;
+    A[212] = -0.0846560846560831*G0_1_1;
+    A[213] = 0.812698412698425*G0_0_0 + 0.338624338624333*G0_0_1 + 0.338624338624325*G0_1_0 - 1.97723781791836e-14*G0_1_1;
+    A[214] = -2.8444444444445*G0_0_0 - 1.16825396825398*G0_0_1 - 1.16825396825399*G0_1_0 + 0.406349206349214*G0_1_1;
+    A[215] = -1.28677248677251*G0_0_1 - 1.28677248677251*G0_1_0 - 2.43809523809529*G0_1_1;
+    A[216] = 0.812698412698417*G0_0_0 + 0.474074074074089*G0_0_1 + 0.474074074074096*G0_1_0 + 0.135449735449744*G0_1_1;
+    A[217] = -2.84444444444449*G0_0_0 - 1.67619047619051*G0_0_1 - 1.6761904761905*G0_1_0 - 0.101587301587314*G0_1_1;
+    A[218] = 1.28677248677251*G0_0_1 + 1.28677248677251*G0_1_0 + 0.135449735449737*G0_1_1;
+    A[219] = 0.13544973544974*G0_0_0 + 0.474074074074078*G0_0_1 + 0.474074074074092*G0_1_0 + 0.812698412698447*G0_1_1;
+    A[220] = -0.101587301587309*G0_0_0 - 0.0507936507936537*G0_0_1 - 0.0507936507936541*G0_1_0 + 0.406349206349238*G0_1_1;
+    A[221] = 0.135449735449746*G0_0_0 - 0.338624338624337*G0_0_1 - 0.33862433862435*G0_1_0 + 1.46462703076722e-14*G0_1_1;
+    A[222] = -0.812698412698412*G0_0_0 - 2.03174603174605*G0_0_1 - 2.03174603174605*G0_1_0 - 4.06349206349214*G0_1_1;
+    A[223] = -0.812698412698429*G0_0_0 + 1.21904761904764*G0_0_1 + 1.21904761904763*G0_1_0 - 0.812698412698444*G0_1_1;
     A[224] = 5.68888888888899*G0_0_0 + 2.84444444444449*G0_0_1 + 2.84444444444449*G0_1_0 + 5.68888888888898*G0_1_1;
 }
 
-/// Constructor
+
 poisson2d_4_cell_integral_1_otherwise::poisson2d_4_cell_integral_1_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson2d_4_cell_integral_1_otherwise::~poisson2d_4_cell_integral_1_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson2d_4_cell_integral_1_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_4_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson2d_4_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -5046,7 +7704,7 @@ void poisson2d_4_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5091,58 +7749,65 @@ void poisson2d_4_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     A[14] = -0.00141093474426807*G0_0 - 0.00141093474426808*G0_1 + 0.00141093474426806*G0_2 + 0.0022574955908289*G0_3 + 0.00338624338624337*G0_4 + 0.0112874779541446*G0_5 + 0.00225749559082892*G0_6 + 0.00338624338624335*G0_7 + 0.0112874779541446*G0_8 - 0.00225749559082891*G0_9 - 0.00677248677248673*G0_10 - 0.00225749559082891*G0_11 - 0.0135449735449735*G0_12 - 0.0135449735449735*G0_13 + 0.0948148148148144*G0_14;
 }
 
-/// Constructor
+
 poisson2d_4_form_0::poisson2d_4_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_4_form_0::~poisson2d_4_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson2d_4_form_0::signature() const
+const char * poisson2d_4_form_0::signature() const
 {
-    return "9f490b3c950f6457cc74ce1bc47bf82652f3218b5996719fce9048e47ab09c1e90d4ad93ceb9d403fa332dcf15d30770938c8fa735ab98cf20a98995d606d313";
+    return "713e6753a5bbd4888a92f2a9683c727abd2cb30c49e0af56d26b2510aabf394eaa9b1a6652f7924875bb5f3be6b570919094928b83c54656c3157a98440d7f13";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_4_form_0::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_4_form_0::num_coefficients() const
 {
     return 0;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_4_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_4_form_0::create_coordinate_finite_element() const
+{
+    return new poisson2d_4_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_4_form_0::create_coordinate_dofmap() const
+{
+    return new poisson2d_4_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_4_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_4_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_4_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_4_finite_element_0();
+        return new poisson2d_4_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_4_finite_element_0();
+        return new poisson2d_4_finite_element_2();
         break;
       }
     }
@@ -5150,19 +7815,18 @@ ufc::finite_element* poisson2d_4_form_0::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_4_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_4_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_4_dofmap_0();
+        return new poisson2d_4_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_4_dofmap_0();
+        return new poisson2d_4_dofmap_2();
         break;
       }
     }
@@ -5170,183 +7834,225 @@ ufc::dofmap* poisson2d_4_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_4_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_4_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_4_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_4_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_4_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_4_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_4_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_4_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_4_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_4_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_4_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_4_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_4_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_4_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_4_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_4_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_4_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_4_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_4_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_4_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_4_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_4_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_4_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_4_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_4_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_4_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_4_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_4_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_4_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_4_form_0::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_4_form_0::create_default_cell_integral() const
 {
     return new poisson2d_4_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_4_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_4_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_4_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_4_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * poisson2d_4_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_4_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * poisson2d_4_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_4_form_0::create_default_vertex_integral() const
+ufc::interface_integral * poisson2d_4_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_4_form_0::create_default_custom_integral() const
+ufc::overlap_integral * poisson2d_4_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 poisson2d_4_form_1::poisson2d_4_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_4_form_1::~poisson2d_4_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson2d_4_form_1::signature() const
+const char * poisson2d_4_form_1::signature() const
 {
-    return "5fd410bde45173ad71d2afab9a9813b8b42fba04775c93d7bb622cce212a9d159cfd37e60b7aa95be91faa1064f2ae6d67521625ae770d9a75e2392ccb222e23";
+    return "857039e500cfecf0f73a9f3b68d2909bee3e2c0b305e02d8056f963d0ee74534ac8a14102ad61851ec10b0e897c782b39f969c15b67a3dcd62385fb0b7d0e92a";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_4_form_1::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_4_form_1::num_coefficients() const
 {
     return 1;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_4_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_4_form_1::create_coordinate_finite_element() const
+{
+    return new poisson2d_4_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_4_form_1::create_coordinate_dofmap() const
+{
+    return new poisson2d_4_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_4_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_4_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_4_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_4_finite_element_0();
+        return new poisson2d_4_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_4_finite_element_0();
+        return new poisson2d_4_finite_element_2();
         break;
       }
     }
@@ -5354,19 +8060,18 @@ ufc::finite_element* poisson2d_4_form_1::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_4_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_4_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_4_dofmap_0();
+        return new poisson2d_4_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_4_dofmap_0();
+        return new poisson2d_4_dofmap_2();
         break;
       }
     }
@@ -5374,128 +8079,163 @@ ufc::dofmap* poisson2d_4_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_4_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_4_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_4_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_4_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_4_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_4_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_4_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_4_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_4_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_4_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_4_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_4_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_4_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_4_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_4_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_4_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_4_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_4_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_4_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_4_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_4_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_4_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_4_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_4_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_4_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_4_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_4_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_4_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_4_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_4_form_1::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_4_form_1::create_default_cell_integral() const
 {
     return new poisson2d_4_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_4_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_4_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_4_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_4_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_4_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * poisson2d_4_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_4_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * poisson2d_4_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_4_form_1::create_default_custom_integral() const
+ufc::interface_integral * poisson2d_4_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_4_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_4.h b/bench/fem/convergence/cpp/Poisson2D_4.h
index 859266b..947a217 100644
--- a/bench/fem/convergence/cpp/Poisson2D_4.h
+++ b/bench/fem/convergence/cpp/Poisson2D_4.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,500 +13,735 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __POISSON2D_4_H
 #define __POISSON2D_4_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson2d_4_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson2d_4_finite_element_0();
 
-  /// Destructor
-  virtual ~poisson2d_4_finite_element_0();
+  ~poisson2d_4_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t space_dimension() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson2d_4_finite_element_1: public ufc::finite_element
+{
+public:
+
+  poisson2d_4_finite_element_1();
+
+  ~poisson2d_4_finite_element_1() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson2d_4_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson2d_4_finite_element_2();
+
+  ~poisson2d_4_finite_element_2() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
+  std::size_t num_sub_elements() const final override;
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class poisson2d_4_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   poisson2d_4_dofmap_0();
 
-  /// Destructor
-  virtual ~poisson2d_4_dofmap_0();
+  ~poisson2d_4_dofmap_0() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson2d_4_dofmap_1: public ufc::dofmap
+{
+public:
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  poisson2d_4_dofmap_1();
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  ~poisson2d_4_dofmap_1() override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  const char * signature() const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson2d_4_dofmap_2: public ufc::dofmap
+{
+public:
+
+  poisson2d_4_dofmap_2();
+
+  ~poisson2d_4_dofmap_2() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
+
+  std::size_t num_facet_dofs() const final override;
+
+  std::size_t num_entity_dofs(std::size_t d) const final override;
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 poisson2d_4_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_4_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_4_cell_integral_0_otherwise();
+  ~poisson2d_4_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 poisson2d_4_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_4_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_4_cell_integral_1_otherwise();
+  ~poisson2d_4_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_4_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_4_form_0();
 
-  /// Destructor
-  virtual ~poisson2d_4_form_0();
+  ~poisson2d_4_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_4_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_4_form_1();
 
-  /// Destructor
-  virtual ~poisson2d_4_form_1();
+  ~poisson2d_4_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -516,14 +751,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson2D_4
 {
@@ -532,43 +773,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_4_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_4_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -579,43 +797,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_4_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_4_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -626,63 +821,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_4_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_4_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_4_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -690,7 +892,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_4_form_0());
+    _ufc_form = std::make_shared<const poisson2d_4_form_0>();
   }
 
   // Destructor
@@ -720,57 +922,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_4_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_4_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_4_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -778,69 +1035,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
+    _ufc_form = std::make_shared<const poisson2d_4_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
+    _ufc_form = std::make_shared<const poisson2d_4_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->f = *f;
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -872,18 +1170,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_5.cpp b/bench/fem/convergence/cpp/Poisson2D_5.cpp
index fbd0be6..89ba85a 100644
--- a/bench/fem/convergence/cpp/Poisson2D_5.cpp
+++ b/bench/fem/convergence/cpp/Poisson2D_5.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -15,120 +15,135 @@
 //   format:                         'dolfin'
 //   no-evaluate_basis:              True
 //   no-evaluate_basis_derivatives:  True
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "Poisson2D_5.h"
 
-/// Constructor
 poisson2d_5_finite_element_0::poisson2d_5_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_5_finite_element_0::~poisson2d_5_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* poisson2d_5_finite_element_0::signature() const
+const char * poisson2d_5_finite_element_0::signature() const
 {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 5, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
 }
 
-/// Return the cell shape
 ufc::shape poisson2d_5_finite_element_0::cell_shape() const
 {
-    return ufc::triangle;
+    return ufc::shape::triangle;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t poisson2d_5_finite_element_0::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t poisson2d_5_finite_element_0::geometric_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t poisson2d_5_finite_element_0::space_dimension() const
 {
-    return 21;
+    return 3;
 }
 
-/// Return the rank of the value space
 std::size_t poisson2d_5_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t poisson2d_5_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
+std::size_t poisson2d_5_finite_element_0::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_5_finite_element_0::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_5_finite_element_0::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_5_finite_element_0::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_5_finite_element_0::degree() const
+{
+    return 1;
+}
+
+const char * poisson2d_5_finite_element_0::family() const
+{
+    return "Lagrange";
+}
+
 void poisson2d_5_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
 throw std::runtime_error("// Function evaluate_basis not generated (compiled with -fno-evaluate_basis)");
 }
 
-/// Evaluate all basis functions at given point x in cell
-void poisson2d_5_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void poisson2d_5_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 21; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
 void poisson2d_5_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
 throw std::runtime_error("// Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)");
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
 void poisson2d_5_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
                                                     int cell_orientation)
 {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -140,7 +155,7 @@ void poisson2d_5_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 21; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
@@ -149,22 +164,22 @@ void poisson2d_5_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 5)
+    if (n > 1)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[32];
-    for (unsigned int r = 0; r < 32; r++)
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 21; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -172,10 +187,9 @@ void poisson2d_5_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     } // end loop over 'r'
 }
 
-/// Evaluate linear functional for dof i on the function f
 double poisson2d_5_finite_element_0::evaluate_dof(std::size_t i,
                                    const ufc::function& f,
-                                   const double* vertex_coordinates,
+                                   const double * coordinate_dofs,
                                    int cell_orientation,
                                    const ufc::cell& c) const
 {
@@ -188,342 +202,1389 @@ double poisson2d_5_finite_element_0::evaluate_dof(std::size_t i,
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.8*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-      y[1] = 0.8*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 4:
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_5_finite_element_0::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+}
+
+void poisson2d_5_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+}
+
+void poisson2d_5_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+}
+
+std::size_t poisson2d_5_finite_element_0::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_5_finite_element_0::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_5_finite_element_0::create() const
+{
+    return new poisson2d_5_finite_element_0();
+}
+
+
+poisson2d_5_finite_element_1::poisson2d_5_finite_element_1() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson2d_5_finite_element_1::~poisson2d_5_finite_element_1()
+{
+    // Do nothing
+}
+
+const char * poisson2d_5_finite_element_1::signature() const
+{
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+}
+
+ufc::shape poisson2d_5_finite_element_1::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t poisson2d_5_finite_element_1::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_5_finite_element_1::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_5_finite_element_1::space_dimension() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_5_finite_element_1::value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_5_finite_element_1::value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = 0.6*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
-      y[1] = 0.6*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 2;
         break;
       }
-    case 5:
+    }
+    
+    return 0;
+}
+
+std::size_t poisson2d_5_finite_element_1::value_size() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_5_finite_element_1::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_5_finite_element_1::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = 0.4*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
-      y[1] = 0.4*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 2;
         break;
       }
-    case 6:
+    }
+    
+    return 0;
+}
+
+std::size_t poisson2d_5_finite_element_1::reference_value_size() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_5_finite_element_1::degree() const
+{
+    return 1;
+}
+
+const char * poisson2d_5_finite_element_1::family() const
+{
+    return "Lagrange";
+}
+
+void poisson2d_5_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+throw std::runtime_error("// Function evaluate_basis not generated (compiled with -fno-evaluate_basis)");
+}
+
+void poisson2d_5_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
       {
-        y[0] = 0.2*vertex_coordinates[2] + 0.8*vertex_coordinates[4];
-      y[1] = 0.2*vertex_coordinates[3] + 0.8*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void poisson2d_5_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+throw std::runtime_error("// Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)");
+}
+
+void poisson2d_5_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        y[0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[4];
-      y[1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        y[0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[4];
-      y[1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_5_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[4];
-      y[1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[5];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 10:
+    case 1:
       {
-        y[0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[4];
-      y[1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[5];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 11:
+    case 2:
       {
-        y[0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[2];
-      y[1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[3];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 12:
+    case 3:
       {
-        y[0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[2];
-      y[1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[3];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
-    case 13:
+    case 4:
       {
-        y[0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[2];
-      y[1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
-    case 14:
+    case 5:
       {
-        y[0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[2];
-      y[1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[3];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
-    case 15:
-      {
-        y[0] = 0.6*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-      y[1] = 0.6*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_5_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+}
+
+void poisson2d_5_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+}
+
+void poisson2d_5_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+}
+
+std::size_t poisson2d_5_finite_element_1::num_sub_elements() const
+{
+    return 2;
+}
+
+ufc::finite_element * poisson2d_5_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_5_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_5_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * poisson2d_5_finite_element_1::create() const
+{
+    return new poisson2d_5_finite_element_1();
+}
+
+
+poisson2d_5_finite_element_2::poisson2d_5_finite_element_2() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson2d_5_finite_element_2::~poisson2d_5_finite_element_2()
+{
+    // Do nothing
+}
+
+const char * poisson2d_5_finite_element_2::signature() const
+{
+    return "FiniteElement('Lagrange', triangle, 5)";
+}
+
+ufc::shape poisson2d_5_finite_element_2::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t poisson2d_5_finite_element_2::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_5_finite_element_2::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_5_finite_element_2::space_dimension() const
+{
+    return 21;
+}
+
+std::size_t poisson2d_5_finite_element_2::value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_5_finite_element_2::value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_5_finite_element_2::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_5_finite_element_2::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_5_finite_element_2::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson2d_5_finite_element_2::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson2d_5_finite_element_2::degree() const
+{
+    return 5;
+}
+
+const char * poisson2d_5_finite_element_2::family() const
+{
+    return "Lagrange";
+}
+
+void poisson2d_5_finite_element_2::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+throw std::runtime_error("// Function evaluate_basis not generated (compiled with -fno-evaluate_basis)");
+}
+
+void poisson2d_5_finite_element_2::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 21; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson2d_5_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+throw std::runtime_error("// Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)");
+}
+
+void poisson2d_5_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 21; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 5)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[32];
+    for (unsigned int r = 0; r < 32; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 21; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson2d_5_finite_element_2::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 16:
+    case 1:
       {
-        y[0] = 0.4*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-      y[1] = 0.4*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 17:
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.8*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+      y[1] = 0.8*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.6*coordinate_dofs[2] + 0.4*coordinate_dofs[4];
+      y[1] = 0.6*coordinate_dofs[3] + 0.4*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.4*coordinate_dofs[2] + 0.6*coordinate_dofs[4];
+      y[1] = 0.4*coordinate_dofs[3] + 0.6*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.2*coordinate_dofs[2] + 0.8*coordinate_dofs[4];
+      y[1] = 0.2*coordinate_dofs[3] + 0.8*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.8*coordinate_dofs[0] + 0.2*coordinate_dofs[4];
+      y[1] = 0.8*coordinate_dofs[1] + 0.2*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
       {
-        y[0] = 0.2*vertex_coordinates[0] + 0.6*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-      y[1] = 0.2*vertex_coordinates[1] + 0.6*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
+        y[0] = 0.6*coordinate_dofs[0] + 0.4*coordinate_dofs[4];
+      y[1] = 0.6*coordinate_dofs[1] + 0.4*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 18:
-      {
-        y[0] = 0.4*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
-      y[1] = 0.4*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+    case 9:
+      {
+        y[0] = 0.4*coordinate_dofs[0] + 0.6*coordinate_dofs[4];
+      y[1] = 0.4*coordinate_dofs[1] + 0.6*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.2*coordinate_dofs[0] + 0.8*coordinate_dofs[4];
+      y[1] = 0.2*coordinate_dofs[1] + 0.8*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.8*coordinate_dofs[0] + 0.2*coordinate_dofs[2];
+      y[1] = 0.8*coordinate_dofs[1] + 0.2*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 12:
+      {
+        y[0] = 0.6*coordinate_dofs[0] + 0.4*coordinate_dofs[2];
+      y[1] = 0.6*coordinate_dofs[1] + 0.4*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 13:
+      {
+        y[0] = 0.4*coordinate_dofs[0] + 0.6*coordinate_dofs[2];
+      y[1] = 0.4*coordinate_dofs[1] + 0.6*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 14:
+      {
+        y[0] = 0.2*coordinate_dofs[0] + 0.8*coordinate_dofs[2];
+      y[1] = 0.2*coordinate_dofs[1] + 0.8*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 15:
+      {
+        y[0] = 0.6*coordinate_dofs[0] + 0.2*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+      y[1] = 0.6*coordinate_dofs[1] + 0.2*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 16:
+      {
+        y[0] = 0.4*coordinate_dofs[0] + 0.4*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+      y[1] = 0.4*coordinate_dofs[1] + 0.4*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 17:
+      {
+        y[0] = 0.2*coordinate_dofs[0] + 0.6*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+      y[1] = 0.2*coordinate_dofs[1] + 0.6*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 18:
+      {
+        y[0] = 0.4*coordinate_dofs[0] + 0.2*coordinate_dofs[2] + 0.4*coordinate_dofs[4];
+      y[1] = 0.4*coordinate_dofs[1] + 0.2*coordinate_dofs[3] + 0.4*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 19:
+      {
+        y[0] = 0.2*coordinate_dofs[0] + 0.4*coordinate_dofs[2] + 0.4*coordinate_dofs[4];
+      y[1] = 0.2*coordinate_dofs[1] + 0.4*coordinate_dofs[3] + 0.4*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 20:
+      {
+        y[0] = 0.2*coordinate_dofs[0] + 0.2*coordinate_dofs[2] + 0.6*coordinate_dofs[4];
+      y[1] = 0.2*coordinate_dofs[1] + 0.2*coordinate_dofs[3] + 0.6*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson2d_5_finite_element_2::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.8*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+    y[1] = 0.8*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.6*coordinate_dofs[2] + 0.4*coordinate_dofs[4];
+    y[1] = 0.6*coordinate_dofs[3] + 0.4*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.4*coordinate_dofs[2] + 0.6*coordinate_dofs[4];
+    y[1] = 0.4*coordinate_dofs[3] + 0.6*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.2*coordinate_dofs[2] + 0.8*coordinate_dofs[4];
+    y[1] = 0.2*coordinate_dofs[3] + 0.8*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.8*coordinate_dofs[0] + 0.2*coordinate_dofs[4];
+    y[1] = 0.8*coordinate_dofs[1] + 0.2*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.6*coordinate_dofs[0] + 0.4*coordinate_dofs[4];
+    y[1] = 0.6*coordinate_dofs[1] + 0.4*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.4*coordinate_dofs[0] + 0.6*coordinate_dofs[4];
+    y[1] = 0.4*coordinate_dofs[1] + 0.6*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+    y[0] = 0.2*coordinate_dofs[0] + 0.8*coordinate_dofs[4];
+    y[1] = 0.2*coordinate_dofs[1] + 0.8*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[10] = vals[0];
+    y[0] = 0.8*coordinate_dofs[0] + 0.2*coordinate_dofs[2];
+    y[1] = 0.8*coordinate_dofs[1] + 0.2*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[0];
+    y[0] = 0.6*coordinate_dofs[0] + 0.4*coordinate_dofs[2];
+    y[1] = 0.6*coordinate_dofs[1] + 0.4*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[12] = vals[0];
+    y[0] = 0.4*coordinate_dofs[0] + 0.6*coordinate_dofs[2];
+    y[1] = 0.4*coordinate_dofs[1] + 0.6*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[13] = vals[0];
+    y[0] = 0.2*coordinate_dofs[0] + 0.8*coordinate_dofs[2];
+    y[1] = 0.2*coordinate_dofs[1] + 0.8*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[14] = vals[0];
+    y[0] = 0.6*coordinate_dofs[0] + 0.2*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+    y[1] = 0.6*coordinate_dofs[1] + 0.2*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[15] = vals[0];
+    y[0] = 0.4*coordinate_dofs[0] + 0.4*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+    y[1] = 0.4*coordinate_dofs[1] + 0.4*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[16] = vals[0];
+    y[0] = 0.2*coordinate_dofs[0] + 0.6*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+    y[1] = 0.2*coordinate_dofs[1] + 0.6*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[17] = vals[0];
+    y[0] = 0.4*coordinate_dofs[0] + 0.2*coordinate_dofs[2] + 0.4*coordinate_dofs[4];
+    y[1] = 0.4*coordinate_dofs[1] + 0.2*coordinate_dofs[3] + 0.4*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[18] = vals[0];
+    y[0] = 0.2*coordinate_dofs[0] + 0.4*coordinate_dofs[2] + 0.4*coordinate_dofs[4];
+    y[1] = 0.2*coordinate_dofs[1] + 0.4*coordinate_dofs[3] + 0.4*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[19] = vals[0];
+    y[0] = 0.2*coordinate_dofs[0] + 0.2*coordinate_dofs[2] + 0.6*coordinate_dofs[4];
+    y[1] = 0.2*coordinate_dofs[1] + 0.2*coordinate_dofs[3] + 0.6*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[20] = vals[0];
+}
+
+void poisson2d_5_finite_element_2::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+}
+
+void poisson2d_5_finite_element_2::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.8*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+    dof_coordinates[7] = 0.8*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+    dof_coordinates[8] = 0.6*coordinate_dofs[2] + 0.4*coordinate_dofs[4];
+    dof_coordinates[9] = 0.6*coordinate_dofs[3] + 0.4*coordinate_dofs[5];
+    dof_coordinates[10] = 0.4*coordinate_dofs[2] + 0.6*coordinate_dofs[4];
+    dof_coordinates[11] = 0.4*coordinate_dofs[3] + 0.6*coordinate_dofs[5];
+    dof_coordinates[12] = 0.2*coordinate_dofs[2] + 0.8*coordinate_dofs[4];
+    dof_coordinates[13] = 0.2*coordinate_dofs[3] + 0.8*coordinate_dofs[5];
+    dof_coordinates[14] = 0.8*coordinate_dofs[0] + 0.2*coordinate_dofs[4];
+    dof_coordinates[15] = 0.8*coordinate_dofs[1] + 0.2*coordinate_dofs[5];
+    dof_coordinates[16] = 0.6*coordinate_dofs[0] + 0.4*coordinate_dofs[4];
+    dof_coordinates[17] = 0.6*coordinate_dofs[1] + 0.4*coordinate_dofs[5];
+    dof_coordinates[18] = 0.4*coordinate_dofs[0] + 0.6*coordinate_dofs[4];
+    dof_coordinates[19] = 0.4*coordinate_dofs[1] + 0.6*coordinate_dofs[5];
+    dof_coordinates[20] = 0.2*coordinate_dofs[0] + 0.8*coordinate_dofs[4];
+    dof_coordinates[21] = 0.2*coordinate_dofs[1] + 0.8*coordinate_dofs[5];
+    dof_coordinates[22] = 0.8*coordinate_dofs[0] + 0.2*coordinate_dofs[2];
+    dof_coordinates[23] = 0.8*coordinate_dofs[1] + 0.2*coordinate_dofs[3];
+    dof_coordinates[24] = 0.6*coordinate_dofs[0] + 0.4*coordinate_dofs[2];
+    dof_coordinates[25] = 0.6*coordinate_dofs[1] + 0.4*coordinate_dofs[3];
+    dof_coordinates[26] = 0.4*coordinate_dofs[0] + 0.6*coordinate_dofs[2];
+    dof_coordinates[27] = 0.4*coordinate_dofs[1] + 0.6*coordinate_dofs[3];
+    dof_coordinates[28] = 0.2*coordinate_dofs[0] + 0.8*coordinate_dofs[2];
+    dof_coordinates[29] = 0.2*coordinate_dofs[1] + 0.8*coordinate_dofs[3];
+    dof_coordinates[30] = 0.6*coordinate_dofs[0] + 0.2*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+    dof_coordinates[31] = 0.6*coordinate_dofs[1] + 0.2*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+    dof_coordinates[32] = 0.4*coordinate_dofs[0] + 0.4*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+    dof_coordinates[33] = 0.4*coordinate_dofs[1] + 0.4*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+    dof_coordinates[34] = 0.2*coordinate_dofs[0] + 0.6*coordinate_dofs[2] + 0.2*coordinate_dofs[4];
+    dof_coordinates[35] = 0.2*coordinate_dofs[1] + 0.6*coordinate_dofs[3] + 0.2*coordinate_dofs[5];
+    dof_coordinates[36] = 0.4*coordinate_dofs[0] + 0.2*coordinate_dofs[2] + 0.4*coordinate_dofs[4];
+    dof_coordinates[37] = 0.4*coordinate_dofs[1] + 0.2*coordinate_dofs[3] + 0.4*coordinate_dofs[5];
+    dof_coordinates[38] = 0.2*coordinate_dofs[0] + 0.4*coordinate_dofs[2] + 0.4*coordinate_dofs[4];
+    dof_coordinates[39] = 0.2*coordinate_dofs[1] + 0.4*coordinate_dofs[3] + 0.4*coordinate_dofs[5];
+    dof_coordinates[40] = 0.2*coordinate_dofs[0] + 0.2*coordinate_dofs[2] + 0.6*coordinate_dofs[4];
+    dof_coordinates[41] = 0.2*coordinate_dofs[1] + 0.2*coordinate_dofs[3] + 0.6*coordinate_dofs[5];
+}
+
+std::size_t poisson2d_5_finite_element_2::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_5_finite_element_2::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson2d_5_finite_element_2::create() const
+{
+    return new poisson2d_5_finite_element_2();
+}
+
+
+poisson2d_5_dofmap_0::poisson2d_5_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_5_dofmap_0::~poisson2d_5_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * poisson2d_5_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+}
+
+bool poisson2d_5_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson2d_5_dofmap_0::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_5_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t poisson2d_5_dofmap_0::num_element_dofs() const
+{
+    return 3;
+}
+
+std::size_t poisson2d_5_dofmap_0::num_facet_dofs() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_5_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson2d_5_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+}
+
+void poisson2d_5_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t 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;
+      }
+    }
+    
+}
+
+void poisson2d_5_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+}
+
+std::size_t poisson2d_5_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_5_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson2d_5_dofmap_0::create() const
+{
+    return new poisson2d_5_dofmap_0();
+}
+
+
+poisson2d_5_dofmap_1::poisson2d_5_dofmap_1() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson2d_5_dofmap_1::~poisson2d_5_dofmap_1()
+{
+    // Do nothing
+}
+
+const char * poisson2d_5_dofmap_1::signature() const
+{
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+}
+
+bool poisson2d_5_dofmap_1::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson2d_5_dofmap_1::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t poisson2d_5_dofmap_1::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return 2*num_global_entities[0];
+}
+
+std::size_t poisson2d_5_dofmap_1::num_element_dofs() const
+{
+    return 6;
+}
+
+std::size_t poisson2d_5_dofmap_1::num_facet_dofs() const
+{
+    return 4;
+}
+
+std::size_t poisson2d_5_dofmap_1::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson2d_5_dofmap_1::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+}
+
+void poisson2d_5_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+}
+
+void poisson2d_5_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
         break;
       }
-    case 19:
+    case 1:
       {
-        y[0] = 0.2*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
-      y[1] = 0.2*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 20:
+    case 2:
       {
-        y[0] = 0.2*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
-      y[1] = 0.2*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-}
-
-/// Evaluate linear functionals for all dofs on the function f
-void poisson2d_5_finite_element_0::evaluate_dofs(double* values,
-                                  const ufc::function& f,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation,
-                                  const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.8*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-    y[1] = 0.8*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.6*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
-    y[1] = 0.6*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.4*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
-    y[1] = 0.4*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.2*vertex_coordinates[2] + 0.8*vertex_coordinates[4];
-    y[1] = 0.2*vertex_coordinates[3] + 0.8*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[4];
-    y[1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[4];
-    y[1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[4];
-    y[1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-    y[0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[4];
-    y[1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[10] = vals[0];
-    y[0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[2];
-    y[1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[0];
-    y[0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[2];
-    y[1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[12] = vals[0];
-    y[0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[2];
-    y[1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[13] = vals[0];
-    y[0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[2];
-    y[1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[14] = vals[0];
-    y[0] = 0.6*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-    y[1] = 0.6*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[15] = vals[0];
-    y[0] = 0.4*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-    y[1] = 0.4*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[16] = vals[0];
-    y[0] = 0.2*vertex_coordinates[0] + 0.6*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-    y[1] = 0.2*vertex_coordinates[1] + 0.6*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[17] = vals[0];
-    y[0] = 0.4*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
-    y[1] = 0.4*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[18] = vals[0];
-    y[0] = 0.2*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
-    y[1] = 0.2*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[19] = vals[0];
-    y[0] = 0.2*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
-    y[1] = 0.2*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[20] = vals[0];
-}
-
-/// Interpolate vertex values from dof values
-void poisson2d_5_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation,
-                                              const ufc::cell& c) const
-{
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-}
-
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void poisson2d_5_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
 }
 
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void poisson2d_5_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+std::size_t poisson2d_5_dofmap_1::num_sub_dofmaps() const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 2;
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t poisson2d_5_finite_element_0::num_sub_elements() const
+ufc::dofmap * poisson2d_5_dofmap_1::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_5_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_5_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* poisson2d_5_finite_element_0::create_sub_element(std::size_t i) const
+ufc::dofmap * poisson2d_5_dofmap_1::create() const
 {
-    return 0;
+    return new poisson2d_5_dofmap_1();
 }
 
-/// Create a new class instance
-ufc::finite_element* poisson2d_5_finite_element_0::create() const
-{
-    return new poisson2d_5_finite_element_0();
-}
 
-/// Constructor
-poisson2d_5_dofmap_0::poisson2d_5_dofmap_0() : ufc::dofmap()
+poisson2d_5_dofmap_2::poisson2d_5_dofmap_2() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-poisson2d_5_dofmap_0::~poisson2d_5_dofmap_0()
+poisson2d_5_dofmap_2::~poisson2d_5_dofmap_2()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* poisson2d_5_dofmap_0::signature() const
+const char * poisson2d_5_dofmap_2::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 5, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 5)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool poisson2d_5_dofmap_0::needs_mesh_entities(std::size_t d) const
+bool poisson2d_5_dofmap_2::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
@@ -547,39 +1608,28 @@ bool poisson2d_5_dofmap_0::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t poisson2d_5_dofmap_0::topological_dimension() const
-{
-    return 2;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t poisson2d_5_dofmap_0::geometric_dimension() const
+std::size_t poisson2d_5_dofmap_2::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t poisson2d_5_dofmap_0::global_dimension(const std::vector<std::size_t>&
+std::size_t poisson2d_5_dofmap_2::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
     return num_global_entities[0] + 4*num_global_entities[1] + 6*num_global_entities[2];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t poisson2d_5_dofmap_0::num_element_dofs() const
+std::size_t poisson2d_5_dofmap_2::num_element_dofs() const
 {
     return 21;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t poisson2d_5_dofmap_0::num_facet_dofs() const
+std::size_t poisson2d_5_dofmap_2::num_facet_dofs() const
 {
     return 6;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t poisson2d_5_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t poisson2d_5_dofmap_2::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
@@ -603,40 +1653,38 @@ std::size_t poisson2d_5_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void poisson2d_5_dofmap_0::tabulate_dofs(std::size_t* dofs,
+void poisson2d_5_dofmap_2::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 4*c.entity_indices[1][0];
-    dofs[4] = offset + 4*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 4*c.entity_indices[1][0] + 2;
-    dofs[6] = offset + 4*c.entity_indices[1][0] + 3;
-    dofs[7] = offset + 4*c.entity_indices[1][1];
-    dofs[8] = offset + 4*c.entity_indices[1][1] + 1;
-    dofs[9] = offset + 4*c.entity_indices[1][1] + 2;
-    dofs[10] = offset + 4*c.entity_indices[1][1] + 3;
-    dofs[11] = offset + 4*c.entity_indices[1][2];
-    dofs[12] = offset + 4*c.entity_indices[1][2] + 1;
-    dofs[13] = offset + 4*c.entity_indices[1][2] + 2;
-    dofs[14] = offset + 4*c.entity_indices[1][2] + 3;
+    dofs[3] = offset + 4*entity_indices[1][0];
+    dofs[4] = offset + 4*entity_indices[1][0] + 1;
+    dofs[5] = offset + 4*entity_indices[1][0] + 2;
+    dofs[6] = offset + 4*entity_indices[1][0] + 3;
+    dofs[7] = offset + 4*entity_indices[1][1];
+    dofs[8] = offset + 4*entity_indices[1][1] + 1;
+    dofs[9] = offset + 4*entity_indices[1][1] + 2;
+    dofs[10] = offset + 4*entity_indices[1][1] + 3;
+    dofs[11] = offset + 4*entity_indices[1][2];
+    dofs[12] = offset + 4*entity_indices[1][2] + 1;
+    dofs[13] = offset + 4*entity_indices[1][2] + 2;
+    dofs[14] = offset + 4*entity_indices[1][2] + 3;
     offset += 4*num_global_entities[1];
-    dofs[15] = offset + 6*c.entity_indices[2][0];
-    dofs[16] = offset + 6*c.entity_indices[2][0] + 1;
-    dofs[17] = offset + 6*c.entity_indices[2][0] + 2;
-    dofs[18] = offset + 6*c.entity_indices[2][0] + 3;
-    dofs[19] = offset + 6*c.entity_indices[2][0] + 4;
-    dofs[20] = offset + 6*c.entity_indices[2][0] + 5;
+    dofs[15] = offset + 6*entity_indices[2][0];
+    dofs[16] = offset + 6*entity_indices[2][0] + 1;
+    dofs[17] = offset + 6*entity_indices[2][0] + 2;
+    dofs[18] = offset + 6*entity_indices[2][0] + 3;
+    dofs[19] = offset + 6*entity_indices[2][0] + 4;
+    dofs[20] = offset + 6*entity_indices[2][0] + 5;
     offset += 6*num_global_entities[2];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void poisson2d_5_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
+void poisson2d_5_dofmap_2::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
@@ -675,8 +1723,7 @@ void poisson2d_5_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void poisson2d_5_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
+void poisson2d_5_dofmap_2::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 2)
@@ -770,105 +1817,51 @@ void poisson2d_5_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void poisson2d_5_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.8*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-    dof_coordinates[7] = 0.8*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
-    dof_coordinates[8] = 0.6*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
-    dof_coordinates[9] = 0.6*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
-    dof_coordinates[10] = 0.4*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
-    dof_coordinates[11] = 0.4*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
-    dof_coordinates[12] = 0.2*vertex_coordinates[2] + 0.8*vertex_coordinates[4];
-    dof_coordinates[13] = 0.2*vertex_coordinates[3] + 0.8*vertex_coordinates[5];
-    dof_coordinates[14] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[4];
-    dof_coordinates[15] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[5];
-    dof_coordinates[16] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[4];
-    dof_coordinates[17] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[5];
-    dof_coordinates[18] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[4];
-    dof_coordinates[19] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[5];
-    dof_coordinates[20] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[4];
-    dof_coordinates[21] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[5];
-    dof_coordinates[22] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[2];
-    dof_coordinates[23] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[3];
-    dof_coordinates[24] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[2];
-    dof_coordinates[25] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[3];
-    dof_coordinates[26] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[2];
-    dof_coordinates[27] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[3];
-    dof_coordinates[28] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[2];
-    dof_coordinates[29] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[3];
-    dof_coordinates[30] = 0.6*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-    dof_coordinates[31] = 0.6*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
-    dof_coordinates[32] = 0.4*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-    dof_coordinates[33] = 0.4*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
-    dof_coordinates[34] = 0.2*vertex_coordinates[0] + 0.6*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
-    dof_coordinates[35] = 0.2*vertex_coordinates[1] + 0.6*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
-    dof_coordinates[36] = 0.4*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
-    dof_coordinates[37] = 0.4*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
-    dof_coordinates[38] = 0.2*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
-    dof_coordinates[39] = 0.2*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
-    dof_coordinates[40] = 0.2*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
-    dof_coordinates[41] = 0.2*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t poisson2d_5_dofmap_0::num_sub_dofmaps() const
+std::size_t poisson2d_5_dofmap_2::num_sub_dofmaps() const
 {
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* poisson2d_5_dofmap_0::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_5_dofmap_2::create_sub_dofmap(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* poisson2d_5_dofmap_0::create() const
+ufc::dofmap * poisson2d_5_dofmap_2::create() const
 {
-    return new poisson2d_5_dofmap_0();
+    return new poisson2d_5_dofmap_2();
 }
 
-/// Constructor
+
 poisson2d_5_cell_integral_0_otherwise::poisson2d_5_cell_integral_0_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson2d_5_cell_integral_0_otherwise::~poisson2d_5_cell_integral_0_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson2d_5_cell_integral_0_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_5_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson2d_5_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 1282
-    // Total number of operations (multiply-add pairs):                  1293
+    // Number of operations (multiply-add pairs) for tensor contraction: 1275
+    // Total number of operations (multiply-add pairs):                  1286
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -886,471 +1879,468 @@ void poisson2d_5_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute element tensor
     A[0] = 0.342406580687831*G0_0_0 + 0.342406580687831*G0_0_1 + 0.342406580687831*G0_1_0 + 0.342406580687831*G0_1_1;
-    A[1] = -0.0409984016754838*G0_0_0 - 0.0409984016754849*G0_1_0;
-    A[2] = -0.0409984016754852*G0_0_1 - 0.0409984016754856*G0_1_1;
-    A[3] = -0.0408192791005273*G0_0_0 - 0.0408192791005278*G0_0_1 - 0.0408192791005289*G0_1_0 - 0.0408192791005309*G0_1_1;
-    A[4] = -0.0379774305555557*G0_0_0 - 0.037977430555554*G0_0_1 - 0.0379774305555556*G0_1_0 - 0.0379774305555529*G0_1_1;
-    A[5] = -0.0379774305555527*G0_0_0 - 0.0379774305555551*G0_0_1 - 0.0379774305555528*G0_1_0 - 0.037977430555556*G0_1_1;
-    A[6] = -0.0408192791005289*G0_0_0 - 0.040819279100527*G0_0_1 - 0.0408192791005301*G0_1_0 - 0.0408192791005277*G0_1_1;
-    A[7] = 0.202287946428572*G0_0_0 - 0.648027584876543*G0_0_1 + 0.202287946428572*G0_1_0 - 0.648027584876543*G0_1_1;
-    A[8] = -0.0158454585537941*G0_0_0 + 0.594204695767193*G0_0_1 - 0.0158454585537928*G0_1_0 + 0.594204695767194*G0_1_1;
-    A[9] = -0.0696683476631375*G0_0_0 - 0.449959352954142*G0_0_1 - 0.0696683476631376*G0_1_0 - 0.449959352954143*G0_1_1;
-    A[10] = 0.0408192791005288*G0_0_0 + 0.202374063051146*G0_0_1 + 0.0408192791005301*G0_1_0 + 0.202374063051146*G0_1_1;
-    A[11] = -0.648027584876542*G0_0_0 + 0.202287946428572*G0_0_1 - 0.648027584876544*G0_1_0 + 0.202287946428572*G0_1_1;
-    A[12] = 0.594204695767193*G0_0_0 - 0.0158454585537934*G0_0_1 + 0.594204695767195*G0_1_0 - 0.0158454585537933*G0_1_1;
-    A[13] = -0.449959352954143*G0_0_0 - 0.0696683476631383*G0_0_1 - 0.449959352954144*G0_1_0 - 0.0696683476631397*G0_1_1;
-    A[14] = 0.202374063051145*G0_0_0 + 0.040819279100527*G0_0_1 + 0.202374063051146*G0_1_0 + 0.0408192791005301*G0_1_1;
-    A[15] = -0.215291556437394*G0_0_0 - 0.215291556437392*G0_0_1 - 0.215291556437395*G0_1_0 - 0.215291556437391*G0_1_1;
-    A[16] = -0.0538228891093415*G0_0_0 - 0.0538228891093432*G0_0_1 - 0.0538228891093418*G0_1_0 - 0.0538228891093423*G0_1_1;
-    A[17] = 0.10764577821869*G0_0_0 + 0.107645778218691*G0_0_1 + 0.107645778218692*G0_1_0 + 0.107645778218691*G0_1_1;
-    A[18] = -0.0538228891093438*G0_0_0 - 0.0538228891093471*G0_0_1 - 0.0538228891093442*G0_1_0 - 0.0538228891093479*G0_1_1;
-    A[19] = 0.107645778218693*G0_0_0 + 0.107645778218696*G0_0_1 + 0.107645778218693*G0_1_0 + 0.107645778218696*G0_1_1;
-    A[20] = 0.10764577821869*G0_0_0 + 0.107645778218692*G0_0_1 + 0.107645778218691*G0_1_0 + 0.107645778218693*G0_1_1;
-    A[21] = -0.0409984016754838*G0_0_0 - 0.0409984016754849*G0_0_1;
+    A[1] = -0.0409984016754841*G0_0_0 - 0.0409984016754849*G0_1_0;
+    A[2] = -0.0409984016754853*G0_0_1 - 0.0409984016754856*G0_1_1;
+    A[3] = -0.0408192791005276*G0_0_0 - 0.0408192791005278*G0_0_1 - 0.0408192791005292*G0_1_0 - 0.0408192791005303*G0_1_1;
+    A[4] = -0.0379774305555559*G0_0_0 - 0.0379774305555543*G0_0_1 - 0.0379774305555559*G0_1_0 - 0.0379774305555536*G0_1_1;
+    A[5] = -0.0379774305555525*G0_0_0 - 0.0379774305555542*G0_0_1 - 0.0379774305555527*G0_1_0 - 0.0379774305555551*G0_1_1;
+    A[6] = -0.0408192791005289*G0_0_0 - 0.0408192791005273*G0_0_1 - 0.0408192791005301*G0_1_0 - 0.0408192791005281*G0_1_1;
+    A[7] = 0.202287946428573*G0_0_0 - 0.648027584876543*G0_0_1 + 0.202287946428573*G0_1_0 - 0.648027584876542*G0_1_1;
+    A[8] = -0.0158454585537945*G0_0_0 + 0.594204695767193*G0_0_1 - 0.015845458553793*G0_1_0 + 0.594204695767194*G0_1_1;
+    A[9] = -0.0696683476631373*G0_0_0 - 0.449959352954143*G0_0_1 - 0.0696683476631375*G0_1_0 - 0.449959352954144*G0_1_1;
+    A[10] = 0.0408192791005289*G0_0_0 + 0.202374063051146*G0_0_1 + 0.0408192791005301*G0_1_0 + 0.202374063051147*G0_1_1;
+    A[11] = -0.648027584876542*G0_0_0 + 0.202287946428572*G0_0_1 - 0.648027584876543*G0_1_0 + 0.202287946428571*G0_1_1;
+    A[12] = 0.594204695767193*G0_0_0 - 0.0158454585537931*G0_0_1 + 0.594204695767194*G0_1_0 - 0.0158454585537933*G0_1_1;
+    A[13] = -0.449959352954142*G0_0_0 - 0.0696683476631388*G0_0_1 - 0.449959352954143*G0_1_0 - 0.0696683476631395*G0_1_1;
+    A[14] = 0.202374063051145*G0_0_0 + 0.0408192791005277*G0_0_1 + 0.202374063051146*G0_1_0 + 0.0408192791005302*G0_1_1;
+    A[15] = -0.215291556437394*G0_0_0 - 0.215291556437393*G0_0_1 - 0.215291556437395*G0_1_0 - 0.215291556437391*G0_1_1;
+    A[16] = -0.0538228891093423*G0_0_0 - 0.0538228891093427*G0_0_1 - 0.0538228891093422*G0_1_0 - 0.0538228891093419*G0_1_1;
+    A[17] = 0.107645778218691*G0_0_0 + 0.107645778218691*G0_0_1 + 0.107645778218693*G0_1_0 + 0.10764577821869*G0_1_1;
+    A[18] = -0.0538228891093435*G0_0_0 - 0.0538228891093459*G0_0_1 - 0.0538228891093444*G0_1_0 - 0.053822889109347*G0_1_1;
+    A[19] = 0.107645778218694*G0_0_0 + 0.107645778218695*G0_0_1 + 0.107645778218693*G0_1_0 + 0.107645778218696*G0_1_1;
+    A[20] = 0.10764577821869*G0_0_0 + 0.107645778218692*G0_0_1 + 0.10764577821869*G0_1_0 + 0.107645778218692*G0_1_1;
+    A[21] = -0.0409984016754841*G0_0_0 - 0.0409984016754849*G0_0_1;
     A[22] = 0.342406580687827*G0_0_0;
-    A[23] = 0.0409984016754848*G0_0_1;
+    A[23] = 0.0409984016754849*G0_0_1;
     A[24] = 0.202287946428567*G0_0_0 + 0.850315531305104*G0_0_1;
-    A[25] = -0.0158454585537916*G0_0_0 - 0.610050154320986*G0_0_1;
-    A[26] = -0.0696683476631382*G0_0_0 + 0.380291005291006*G0_0_1;
-    A[27] = 0.0408192791005285*G0_0_0 - 0.161554783950619*G0_0_1;
-    A[28] = -0.0408192791005301*G0_0_0;
-    A[29] = -0.0379774305555554*G0_0_0;
-    A[30] = -0.037977430555555*G0_0_0;
+    A[25] = -0.0158454585537918*G0_0_0 - 0.610050154320986*G0_0_1;
+    A[26] = -0.0696683476631376*G0_0_0 + 0.380291005291006*G0_0_1;
+    A[27] = 0.0408192791005284*G0_0_0 - 0.161554783950619*G0_0_1;
+    A[28] = -0.0408192791005304*G0_0_0;
+    A[29] = -0.037977430555556*G0_0_0;
+    A[30] = -0.0379774305555547*G0_0_0;
     A[31] = -0.0408192791005284*G0_0_0;
-    A[32] = 0.202374063051143*G0_0_0 + 0.161554783950614*G0_0_1;
-    A[33] = -0.449959352954138*G0_0_0 - 0.380291005290998*G0_0_1;
-    A[34] = 0.594204695767185*G0_0_0 + 0.610050154320978*G0_0_1;
+    A[32] = 0.202374063051144*G0_0_0 + 0.161554783950614*G0_0_1;
+    A[33] = -0.449959352954138*G0_0_0 - 0.380291005290997*G0_0_1;
+    A[34] = 0.594204695767184*G0_0_0 + 0.610050154320977*G0_0_1;
     A[35] = -0.648027584876533*G0_0_0 - 0.850315531305105*G0_0_1;
-    A[36] = 0.107645778218697*G0_0_0;
-    A[37] = -0.0538228891093525*G0_0_0 - 1.02100944886219e-14*G0_0_1;
-    A[38] = -0.215291556437381*G0_0_0 + 1.11416409952214e-14*G0_0_1;
-    A[39] = 0.107645778218694*G0_0_0;
-    A[40] = -0.0538228891093473*G0_0_0;
-    A[41] = 0.107645778218693*G0_0_0;
-    A[42] = -0.0409984016754852*G0_1_0 - 0.0409984016754856*G0_1_1;
-    A[43] = 0.0409984016754848*G0_1_0;
+    A[36] = 0.107645778218698*G0_0_0;
+    A[37] = -0.0538228891093521*G0_0_0 - 1.07706270117969e-14*G0_0_1;
+    A[38] = -0.215291556437382*G0_0_0 + 1.21370470097804e-14*G0_0_1;
+    A[39] = 0.107645778218696*G0_0_0;
+    A[40] = -0.0538228891093484*G0_0_0;
+    A[41] = 0.107645778218692*G0_0_0;
+    A[42] = -0.0409984016754853*G0_1_0 - 0.0409984016754856*G0_1_1;
+    A[43] = 0.0409984016754849*G0_1_0;
     A[44] = 0.342406580687831*G0_1_1;
-    A[45] = -0.161554783950616*G0_1_0 + 0.0408192791005305*G0_1_1;
-    A[46] = 0.380291005291006*G0_1_0 - 0.0696683476631394*G0_1_1;
-    A[47] = -0.610050154320989*G0_1_0 - 0.0158454585537905*G0_1_1;
-    A[48] = 0.850315531305116*G0_1_0 + 0.202287946428569*G0_1_1;
-    A[49] = 0.161554783950616*G0_1_0 + 0.202374063051147*G0_1_1;
-    A[50] = -0.380291005291006*G0_1_0 - 0.449959352954147*G0_1_1;
-    A[51] = 0.61005015432099*G0_1_0 + 0.5942046957672*G0_1_1;
-    A[52] = -0.850315531305116*G0_1_0 - 0.648027584876546*G0_1_1;
-    A[53] = -0.0408192791005306*G0_1_1;
-    A[54] = -0.037977430555556*G0_1_1;
-    A[55] = -0.0379774305555563*G0_1_1;
-    A[56] = -0.0408192791005295*G0_1_1;
-    A[57] = 0.107645778218696*G0_1_1;
+    A[45] = -0.161554783950616*G0_1_0 + 0.0408192791005307*G0_1_1;
+    A[46] = 0.380291005291006*G0_1_0 - 0.0696683476631403*G0_1_1;
+    A[47] = -0.610050154320989*G0_1_0 - 0.0158454585537902*G0_1_1;
+    A[48] = 0.850315531305115*G0_1_0 + 0.202287946428569*G0_1_1;
+    A[49] = 0.161554783950617*G0_1_0 + 0.202374063051147*G0_1_1;
+    A[50] = -0.380291005291006*G0_1_0 - 0.449959352954146*G0_1_1;
+    A[51] = 0.61005015432099*G0_1_0 + 0.594204695767199*G0_1_1;
+    A[52] = -0.850315531305115*G0_1_0 - 0.648027584876545*G0_1_1;
+    A[53] = -0.0408192791005308*G0_1_1;
+    A[54] = -0.0379774305555558*G0_1_1;
+    A[55] = -0.0379774305555562*G0_1_1;
+    A[56] = -0.0408192791005298*G0_1_1;
+    A[57] = 0.107645778218697*G0_1_1;
     A[58] = 0.107645778218696*G0_1_1;
-    A[59] = 0.107645778218696*G0_1_1;
-    A[60] = -0.0538228891093475*G0_1_1;
-    A[61] = -0.053822889109352*G0_1_1;
-    A[62] = -0.215291556437386*G0_1_1;
-    A[63] = -0.0408192791005273*G0_0_0 - 0.0408192791005289*G0_0_1 - 0.0408192791005278*G0_1_0 - 0.0408192791005309*G0_1_1;
+    A[59] = 0.107645778218697*G0_1_1;
+    A[60] = -0.0538228891093493*G0_1_1;
+    A[61] = -0.0538228891093528*G0_1_1;
+    A[62] = -0.215291556437384*G0_1_1;
+    A[63] = -0.0408192791005276*G0_0_0 - 0.0408192791005292*G0_0_1 - 0.0408192791005278*G0_1_0 - 0.0408192791005303*G0_1_1;
     A[64] = 0.202287946428567*G0_0_0 + 0.850315531305104*G0_1_0;
-    A[65] = -0.161554783950616*G0_0_1 + 0.0408192791005305*G0_1_1;
+    A[65] = -0.161554783950616*G0_0_1 + 0.0408192791005307*G0_1_1;
     A[66] = 1.98929398148146*G0_0_0 + 1.28098476080245*G0_0_1 + 1.28098476080245*G0_1_0 + 2.56196952160491*G0_1_1;
-    A[67] = -0.906377452601407*G0_0_0 + 0.796578758818334*G0_0_1 - 0.529617228835975*G0_1_0 - 1.39508928571429*G0_1_1;
-    A[68] = 0.818107914462076*G0_0_0 - 0.482253086419749*G0_0_1 + 0.23251488095238*G0_1_0 + 0.895612874779544*G0_1_1;
-    A[69] = -0.340160659171074*G0_0_0 + 0.329396081349202*G0_0_1 - 0.0710462136243368*G0_1_0 - 0.340160659171082*G0_1_1;
-    A[70] = 0.142092427248671*G0_0_0 + 0.0710462136243376*G0_0_1 + 0.0710462136243282*G0_1_0;
-    A[71] = 0.131327849426813*G0_0_0 + 0.0301408179012434*G0_0_1 + 0.03014081790124*G0_1_0;
-    A[72] = 0.172233245149906*G0_0_0 + 0.0301408179012269*G0_0_1 + 0.0301408179012339*G0_1_0;
-    A[73] = 0.340160659171074*G0_0_0 + 0.0710462136243443*G0_0_1 + 0.0710462136243367*G0_1_0;
-    A[74] = 0.198068231922389*G0_0_0 + 0.269114445546723*G0_0_1 + 0.26911444554673*G0_1_0 + 0.340160659171058*G0_1_1;
-    A[75] = -0.359536899250424*G0_0_0 - 0.663097993827144*G0_0_1 - 0.663097993827144*G0_1_0 - 0.89561287477952*G0_1_1;
-    A[76] = 0.286337770061709*G0_0_0 + 0.865472056878291*G0_0_1 + 0.86547205687828*G0_1_0 + 1.39508928571426*G0_1_1;
+    A[67] = -0.906377452601406*G0_0_0 + 0.796578758818336*G0_0_1 - 0.529617228835974*G0_1_0 - 1.39508928571428*G0_1_1;
+    A[68] = 0.818107914462077*G0_0_0 - 0.482253086419749*G0_0_1 + 0.232514880952381*G0_1_0 + 0.895612874779545*G0_1_1;
+    A[69] = -0.340160659171075*G0_0_0 + 0.329396081349201*G0_0_1 - 0.0710462136243369*G0_1_0 - 0.340160659171081*G0_1_1;
+    A[70] = 0.142092427248671*G0_0_0 + 0.0710462136243381*G0_0_1 + 0.0710462136243278*G0_1_0;
+    A[71] = 0.131327849426813*G0_0_0 + 0.0301408179012417*G0_0_1 + 0.030140817901238*G0_1_0;
+    A[72] = 0.172233245149905*G0_0_0 + 0.0301408179012275*G0_0_1 + 0.0301408179012343*G0_1_0;
+    A[73] = 0.340160659171075*G0_0_0 + 0.0710462136243448*G0_0_1 + 0.0710462136243367*G0_1_0;
+    A[74] = 0.19806823192239*G0_0_0 + 0.269114445546723*G0_0_1 + 0.26911444554673*G0_1_0 + 0.340160659171058*G0_1_1;
+    A[75] = -0.359536899250423*G0_0_0 - 0.663097993827143*G0_0_1 - 0.663097993827141*G0_1_0 - 0.895612874779516*G0_1_1;
+    A[76] = 0.286337770061708*G0_0_0 + 0.86547205687829*G0_0_1 + 0.865472056878275*G0_1_0 + 1.39508928571425*G0_1_1;
     A[77] = -0.286337770061714*G0_0_0 - 1.28098476080245*G0_0_1 - 1.28098476080244*G0_1_0 - 2.56196952160491*G0_1_1;
-    A[78] = -0.667403824955892*G0_0_0 - 0.262655698853601*G0_0_1 - 0.262655698853598*G0_1_0 + 1.96945324631992e-14*G0_1_1;
-    A[79] = 1.35633680555553*G0_0_0 + 0.572675540123428*G0_0_1 + 0.572675540123436*G0_1_0 - 3.07267232491082e-14*G0_1_1;
-    A[80] = -2.82031938932977*G0_0_0 - 1.66205081569661*G0_0_1 - 1.66205081569662*G0_1_0 + 3.90402770875098e-14*G0_1_1;
-    A[81] = -0.419818535052917*G0_0_0 - 0.0731991291887169*G0_0_1 - 0.0731991291887196*G0_1_0;
-    A[82] = 1.19486813822751*G0_0_0 + 0.572675540123454*G0_0_1 + 0.572675540123455*G0_1_0;
-    A[83] = -0.990341159611982*G0_0_0 - 0.262655698853613*G0_0_1 - 0.262655698853614*G0_1_0;
-    A[84] = -0.0379774305555557*G0_0_0 - 0.0379774305555556*G0_0_1 - 0.037977430555554*G0_1_0 - 0.0379774305555529*G0_1_1;
-    A[85] = -0.0158454585537916*G0_0_0 - 0.610050154320986*G0_1_0;
-    A[86] = 0.380291005291006*G0_0_1 - 0.0696683476631394*G0_1_1;
-    A[87] = -0.906377452601406*G0_0_0 - 0.529617228835975*G0_0_1 + 0.796578758818335*G0_1_0 - 1.39508928571429*G0_1_1;
+    A[78] = -0.667403824955893*G0_0_0 - 0.2626556988536*G0_0_1 - 0.262655698853598*G0_1_0 + 1.78941063355698e-14*G0_1_1;
+    A[79] = 1.35633680555553*G0_0_0 + 0.572675540123428*G0_0_1 + 0.572675540123436*G0_1_0 - 3.28734435506295e-14*G0_1_1;
+    A[80] = -2.82031938932977*G0_0_0 - 1.66205081569661*G0_0_1 - 1.66205081569662*G0_1_0 + 4.30304663429082e-14*G0_1_1;
+    A[81] = -0.419818535052913*G0_0_0 - 0.0731991291887139*G0_0_1 - 0.0731991291887135*G0_1_0;
+    A[82] = 1.19486813822751*G0_0_0 + 0.572675540123449*G0_0_1 + 0.57267554012345*G0_1_0;
+    A[83] = -0.990341159611982*G0_0_0 - 0.262655698853614*G0_0_1 - 0.262655698853615*G0_1_0;
+    A[84] = -0.0379774305555559*G0_0_0 - 0.0379774305555559*G0_0_1 - 0.0379774305555543*G0_1_0 - 0.0379774305555536*G0_1_1;
+    A[85] = -0.0158454585537918*G0_0_0 - 0.610050154320986*G0_1_0;
+    A[86] = 0.380291005291006*G0_0_1 - 0.0696683476631403*G0_1_1;
+    A[87] = -0.906377452601406*G0_0_0 - 0.529617228835974*G0_0_1 + 0.796578758818336*G0_1_0 - 1.39508928571428*G0_1_1;
     A[88] = 3.07436342592591*G0_0_0 + 1.17549189814814*G0_0_1 + 1.17549189814814*G0_1_0 + 3.6944031084656*G0_1_1;
-    A[89] = -1.80414324294532*G0_0_0 + 0.699697558421508*G0_0_1 - 0.350925236992949*G0_1_0 - 1.80414324294533*G0_1_1;
-    A[90] = 0.895612874779545*G0_0_0 - 0.48225308641975*G0_0_1 + 0.232514880952382*G0_1_0 + 0.818107914462085*G0_1_1;
-    A[91] = 0.131327849426811*G0_0_0 + 0.101187031525575*G0_0_1 + 0.101187031525581*G0_1_0 + 0.0710462136243371*G0_1_1;
-    A[92] = -0.297102347883603*G0_0_0 - 0.148551173941805*G0_0_1 - 0.148551173941804*G0_1_0 - 0.017223324514993*G0_1_1;
-    A[93] = -0.219597387566129*G0_0_0 - 0.0624345513668318*G0_0_1 - 0.0624345513668436*G0_1_0 - 0.0172233245149868*G0_1_1;
-    A[94] = -0.895612874779544*G0_0_0 - 0.232514880952386*G0_0_1 - 0.232514880952382*G0_1_0 + 0.0710462136243377*G0_1_1;
-    A[95] = 0.111951609347441*G0_0_0 + 0.142092427248675*G0_0_1 + 0.142092427248672*G0_1_0 + 0.172233245149914*G0_1_1;
-    A[96] = -0.11195160934744*G0_0_0 - 0.157162836199289*G0_0_1 - 0.157162836199285*G0_1_0 - 0.219597387566129*G0_1_1;
-    A[97] = 0.103339947089948*G0_0_0 + 0.133480764991185*G0_0_1 + 0.13348076499118*G0_1_0 + 0.266961529982367*G0_1_1;
-    A[98] = -0.049517057980603*G0_0_0 + 0.529617228835976*G0_0_1 + 0.529617228835973*G0_1_0 + 1.39508928571429*G0_1_1;
-    A[99] = -0.344466490299815*G0_0_0 - 0.447806437389766*G0_0_1 - 0.447806437389763*G0_1_0 - 0.516699735449741*G0_1_1;
-    A[100] = 0.387524801587288*G0_0_0 + 0.859013310185171*G0_0_1 + 0.859013310185163*G0_1_0 + 1.01187031525572*G0_1_1;
+    A[89] = -1.80414324294532*G0_0_0 + 0.699697558421508*G0_0_1 - 0.350925236992948*G0_1_0 - 1.80414324294533*G0_1_1;
+    A[90] = 0.895612874779544*G0_0_0 - 0.482253086419749*G0_0_1 + 0.23251488095238*G0_1_0 + 0.818107914462084*G0_1_1;
+    A[91] = 0.131327849426811*G0_0_0 + 0.101187031525574*G0_0_1 + 0.101187031525581*G0_1_0 + 0.0710462136243375*G0_1_1;
+    A[92] = -0.297102347883603*G0_0_0 - 0.148551173941802*G0_0_1 - 0.148551173941803*G0_1_0 - 0.0172233245149918*G0_1_1;
+    A[93] = -0.219597387566127*G0_0_0 - 0.0624345513668325*G0_0_1 - 0.0624345513668431*G0_1_0 - 0.0172233245149873*G0_1_1;
+    A[94] = -0.895612874779544*G0_0_0 - 0.232514880952387*G0_0_1 - 0.23251488095238*G0_1_0 + 0.0710462136243389*G0_1_1;
+    A[95] = 0.111951609347442*G0_0_0 + 0.142092427248674*G0_0_1 + 0.142092427248673*G0_1_0 + 0.172233245149913*G0_1_1;
+    A[96] = -0.111951609347442*G0_0_0 - 0.157162836199288*G0_0_1 - 0.157162836199289*G0_1_0 - 0.219597387566131*G0_1_1;
+    A[97] = 0.10333994708995*G0_0_0 + 0.133480764991185*G0_0_1 + 0.133480764991185*G0_1_0 + 0.266961529982371*G0_1_1;
+    A[98] = -0.0495170579806034*G0_0_0 + 0.529617228835976*G0_0_1 + 0.529617228835971*G0_1_0 + 1.39508928571429*G0_1_1;
+    A[99] = -0.344466490299814*G0_0_0 - 0.447806437389765*G0_0_1 - 0.447806437389764*G0_1_0 - 0.516699735449737*G0_1_1;
+    A[100] = 0.387524801587286*G0_0_0 + 0.85901331018517*G0_0_1 + 0.859013310185163*G0_1_0 + 1.01187031525572*G0_1_1;
     A[101] = 0.731991291887125*G0_0_0 - 1.30897266313932*G0_0_1 - 1.30897266313931*G0_1_0 - 3.96136463844796*G0_1_1;
-    A[102] = 1.03339947089947*G0_0_0 + 0.374607308201053*G0_0_1 + 0.374607308201062*G0_1_0 + 0.0430583112874824*G0_1_1;
-    A[103] = -3.81066054894177*G0_0_0 - 1.4015480324074*G0_0_1 - 1.4015480324074*G0_1_0 + 1.01187031525573*G0_1_1;
-    A[104] = 2.02374063051145*G0_0_0 + 0.413359788359788*G0_0_1 + 0.413359788359793*G0_1_0 - 0.516699735449735*G0_1_1;
-    A[105] = -0.0379774305555526*G0_0_0 - 0.0379774305555528*G0_0_1 - 0.0379774305555551*G0_1_0 - 0.037977430555556*G0_1_1;
-    A[106] = -0.0696683476631382*G0_0_0 + 0.380291005291006*G0_1_0;
-    A[107] = -0.610050154320989*G0_0_1 - 0.0158454585537904*G0_1_1;
-    A[108] = 0.818107914462076*G0_0_0 + 0.23251488095238*G0_0_1 - 0.482253086419749*G0_1_0 + 0.895612874779545*G0_1_1;
-    A[109] = -1.80414324294532*G0_0_0 - 0.350925236992949*G0_0_1 + 0.699697558421508*G0_1_0 - 1.80414324294533*G0_1_1;
-    A[110] = 3.69440310846559*G0_0_0 + 1.17549189814813*G0_0_1 + 1.17549189814813*G0_1_0 + 3.07436342592591*G0_1_1;
-    A[111] = -1.39508928571429*G0_0_0 + 0.796578758818336*G0_0_1 - 0.529617228835975*G0_1_0 - 0.906377452601417*G0_1_1;
-    A[112] = 0.172233245149898*G0_0_0 + 0.142092427248662*G0_0_1 + 0.142092427248663*G0_1_0 + 0.111951609347436*G0_1_1;
-    A[113] = -0.219597387566119*G0_0_0 - 0.157162836199268*G0_0_1 - 0.157162836199279*G0_1_0 - 0.111951609347427*G0_1_1;
-    A[114] = 0.26696152998234*G0_0_0 + 0.133480764991158*G0_0_1 + 0.133480764991172*G0_1_0 + 0.103339947089936*G0_1_1;
-    A[115] = 1.39508928571429*G0_0_0 + 0.529617228835992*G0_0_1 + 0.529617228835976*G0_1_0 - 0.0495170579805947*G0_1_1;
-    A[116] = 0.0710462136243316*G0_0_0 + 0.101187031525568*G0_0_1 + 0.101187031525569*G0_1_0 + 0.131327849426796*G0_1_1;
-    A[117] = -0.0172233245149871*G0_0_0 - 0.148551173941796*G0_0_1 - 0.148551173941797*G0_1_0 - 0.297102347883596*G0_1_1;
-    A[118] = -0.0172233245149933*G0_0_0 - 0.0624345513668474*G0_0_1 - 0.0624345513668455*G0_1_0 - 0.219597387566143*G0_1_1;
-    A[119] = 0.0710462136243398*G0_0_0 - 0.232514880952381*G0_0_1 - 0.232514880952378*G0_1_0 - 0.895612874779546*G0_1_1;
-    A[120] = -0.516699735449712*G0_0_0 - 0.447806437389761*G0_0_1 - 0.447806437389749*G0_1_0 - 0.344466490299801*G0_1_1;
-    A[121] = 0.043058311287465*G0_0_0 + 0.37460730820105*G0_0_1 + 0.374607308201046*G0_1_0 + 1.03339947089945*G0_1_1;
-    A[122] = -0.516699735449728*G0_0_0 + 0.413359788359802*G0_0_1 + 0.41335978835979*G0_1_0 + 2.02374063051148*G0_1_1;
-    A[123] = 1.0118703152557*G0_0_0 + 0.859013310185161*G0_0_1 + 0.859013310185149*G0_1_0 + 0.387524801587276*G0_1_1;
-    A[124] = 1.01187031525575*G0_0_0 - 1.40154803240739*G0_0_1 - 1.40154803240738*G0_1_0 - 3.81066054894177*G0_1_1;
-    A[125] = -3.96136463844793*G0_0_0 - 1.30897266313931*G0_0_1 - 1.30897266313931*G0_1_0 + 0.731991291887139*G0_1_1;
-    A[126] = -0.0408192791005289*G0_0_0 - 0.0408192791005301*G0_0_1 - 0.040819279100527*G0_1_0 - 0.0408192791005277*G0_1_1;
-    A[127] = 0.0408192791005285*G0_0_0 - 0.161554783950619*G0_1_0;
-    A[128] = 0.850315531305116*G0_0_1 + 0.202287946428569*G0_1_1;
-    A[129] = -0.340160659171074*G0_0_0 - 0.0710462136243369*G0_0_1 + 0.329396081349202*G0_1_0 - 0.340160659171082*G0_1_1;
-    A[130] = 0.895612874779545*G0_0_0 + 0.232514880952382*G0_0_1 - 0.48225308641975*G0_1_0 + 0.818107914462085*G0_1_1;
-    A[131] = -1.39508928571429*G0_0_0 - 0.529617228835975*G0_0_1 + 0.796578758818336*G0_1_0 - 0.906377452601417*G0_1_1;
+    A[102] = 1.03339947089946*G0_0_0 + 0.37460730820105*G0_0_1 + 0.374607308201056*G0_1_0 + 0.0430583112874761*G0_1_1;
+    A[103] = -3.81066054894177*G0_0_0 - 1.4015480324074*G0_0_1 - 1.40154803240739*G0_1_0 + 1.01187031525573*G0_1_1;
+    A[104] = 2.02374063051145*G0_0_0 + 0.41335978835979*G0_0_1 + 0.413359788359791*G0_1_0 - 0.516699735449733*G0_1_1;
+    A[105] = -0.0379774305555525*G0_0_0 - 0.0379774305555528*G0_0_1 - 0.0379774305555543*G0_1_0 - 0.0379774305555551*G0_1_1;
+    A[106] = -0.0696683476631376*G0_0_0 + 0.380291005291006*G0_1_0;
+    A[107] = -0.610050154320989*G0_0_1 - 0.0158454585537902*G0_1_1;
+    A[108] = 0.818107914462077*G0_0_0 + 0.232514880952381*G0_0_1 - 0.482253086419749*G0_1_0 + 0.895612874779545*G0_1_1;
+    A[109] = -1.80414324294532*G0_0_0 - 0.350925236992948*G0_0_1 + 0.699697558421508*G0_1_0 - 1.80414324294533*G0_1_1;
+    A[110] = 3.69440310846559*G0_0_0 + 1.17549189814814*G0_0_1 + 1.17549189814814*G0_1_0 + 3.07436342592591*G0_1_1;
+    A[111] = -1.39508928571429*G0_0_0 + 0.796578758818334*G0_0_1 - 0.529617228835976*G0_1_0 - 0.906377452601417*G0_1_1;
+    A[112] = 0.172233245149898*G0_0_0 + 0.142092427248664*G0_0_1 + 0.142092427248662*G0_1_0 + 0.111951609347435*G0_1_1;
+    A[113] = -0.219597387566117*G0_0_0 - 0.157162836199271*G0_0_1 - 0.15716283619928*G0_1_0 - 0.111951609347427*G0_1_1;
+    A[114] = 0.266961529982337*G0_0_0 + 0.13348076499116*G0_0_1 + 0.133480764991171*G0_1_0 + 0.103339947089937*G0_1_1;
+    A[115] = 1.39508928571429*G0_0_0 + 0.529617228835992*G0_0_1 + 0.529617228835977*G0_1_0 - 0.049517057980595*G0_1_1;
+    A[116] = 0.0710462136243318*G0_0_0 + 0.101187031525569*G0_0_1 + 0.101187031525568*G0_1_0 + 0.131327849426797*G0_1_1;
+    A[117] = -0.0172233245149868*G0_0_0 - 0.148551173941797*G0_0_1 - 0.148551173941795*G0_1_0 - 0.297102347883594*G0_1_1;
+    A[118] = -0.0172233245149941*G0_0_0 - 0.0624345513668477*G0_0_1 - 0.0624345513668495*G0_1_0 - 0.219597387566148*G0_1_1;
+    A[119] = 0.0710462136243395*G0_0_0 - 0.232514880952382*G0_0_1 - 0.232514880952376*G0_1_0 - 0.895612874779545*G0_1_1;
+    A[120] = -0.516699735449715*G0_0_0 - 0.447806437389763*G0_0_1 - 0.447806437389749*G0_1_0 - 0.344466490299805*G0_1_1;
+    A[121] = 0.0430583112874692*G0_0_0 + 0.374607308201052*G0_0_1 + 0.374607308201046*G0_1_0 + 1.03339947089945*G0_1_1;
+    A[122] = -0.516699735449729*G0_0_0 + 0.413359788359802*G0_0_1 + 0.413359788359791*G0_1_0 + 2.02374063051148*G0_1_1;
+    A[123] = 1.0118703152557*G0_0_0 + 0.859013310185166*G0_0_1 + 0.859013310185156*G0_1_0 + 0.387524801587282*G0_1_1;
+    A[124] = 1.01187031525574*G0_0_0 - 1.4015480324074*G0_0_1 - 1.40154803240738*G0_1_0 - 3.81066054894178*G0_1_1;
+    A[125] = -3.96136463844793*G0_0_0 - 1.30897266313931*G0_0_1 - 1.30897266313931*G0_1_0 + 0.731991291887138*G0_1_1;
+    A[126] = -0.0408192791005289*G0_0_0 - 0.0408192791005301*G0_0_1 - 0.0408192791005273*G0_1_0 - 0.0408192791005281*G0_1_1;
+    A[127] = 0.0408192791005284*G0_0_0 - 0.161554783950619*G0_1_0;
+    A[128] = 0.850315531305115*G0_0_1 + 0.202287946428569*G0_1_1;
+    A[129] = -0.340160659171075*G0_0_0 - 0.0710462136243369*G0_0_1 + 0.329396081349201*G0_1_0 - 0.340160659171081*G0_1_1;
+    A[130] = 0.895612874779544*G0_0_0 + 0.23251488095238*G0_0_1 - 0.482253086419749*G0_1_0 + 0.818107914462084*G0_1_1;
+    A[131] = -1.39508928571429*G0_0_0 - 0.529617228835976*G0_0_1 + 0.796578758818334*G0_1_0 - 0.906377452601418*G0_1_1;
     A[132] = 2.56196952160494*G0_0_0 + 1.28098476080247*G0_0_1 + 1.28098476080247*G0_1_0 + 1.98929398148148*G0_1_1;
-    A[133] = 0.340160659171077*G0_0_0 + 0.269114445546741*G0_0_1 + 0.269114445546738*G0_1_0 + 0.198068231922395*G0_1_1;
-    A[134] = -0.895612874779546*G0_0_0 - 0.66309799382717*G0_0_1 - 0.663097993827158*G0_1_0 - 0.359536899250438*G0_1_1;
-    A[135] = 1.39508928571429*G0_0_0 + 0.865472056878321*G0_0_1 + 0.865472056878305*G0_1_0 + 0.28633777006173*G0_1_1;
+    A[133] = 0.340160659171078*G0_0_0 + 0.26911444554674*G0_0_1 + 0.269114445546738*G0_1_0 + 0.198068231922395*G0_1_1;
+    A[134] = -0.895612874779547*G0_0_0 - 0.663097993827166*G0_0_1 - 0.663097993827157*G0_1_0 - 0.359536899250437*G0_1_1;
+    A[135] = 1.3950892857143*G0_0_0 + 0.865472056878318*G0_0_1 + 0.865472056878307*G0_1_0 + 0.286337770061729*G0_1_1;
     A[136] = -2.56196952160494*G0_0_0 - 1.28098476080248*G0_0_1 - 1.28098476080247*G0_1_0 - 0.286337770061727*G0_1_1;
-    A[137] = 0.0710462136243374*G0_0_1 + 0.071046213624336*G0_1_0 + 0.142092427248679*G0_1_1;
-    A[138] = 0.0301408179012358*G0_0_1 + 0.0301408179012371*G0_1_0 + 0.131327849426813*G0_1_1;
-    A[139] = 0.0301408179012334*G0_0_1 + 0.0301408179012332*G0_1_0 + 0.172233245149912*G0_1_1;
-    A[140] = 0.0710462136243404*G0_0_1 + 0.0710462136243397*G0_1_0 + 0.340160659171084*G0_1_1;
-    A[141] = -0.262655698853616*G0_0_1 - 0.262655698853611*G0_1_0 - 0.667403824955912*G0_1_1;
-    A[142] = -0.0731991291887071*G0_0_1 - 0.0731991291887131*G0_1_0 - 0.419818535052907*G0_1_1;
-    A[143] = -0.262655698853615*G0_0_1 - 0.262655698853614*G0_1_0 - 0.990341159611994*G0_1_1;
-    A[144] = 1.10467190950203e-14*G0_0_0 + 0.572675540123454*G0_0_1 + 0.572675540123457*G0_1_0 + 1.35633680555555*G0_1_1;
-    A[145] = -1.12826414877532e-14*G0_0_0 + 0.572675540123437*G0_0_1 + 0.57267554012345*G0_1_0 + 1.1948681382275*G0_1_1;
-    A[146] = -1.66205081569664*G0_0_1 - 1.66205081569664*G0_1_0 - 2.82031938932979*G0_1_1;
-    A[147] = 0.202287946428572*G0_0_0 + 0.202287946428572*G0_0_1 - 0.648027584876543*G0_1_0 - 0.648027584876543*G0_1_1;
-    A[148] = -0.0408192791005301*G0_0_0;
-    A[149] = 0.161554783950616*G0_0_1 + 0.202374063051147*G0_1_1;
-    A[150] = 0.142092427248671*G0_0_0 + 0.0710462136243282*G0_0_1 + 0.0710462136243376*G0_1_0;
-    A[151] = 0.13132784942681*G0_0_0 + 0.101187031525581*G0_0_1 + 0.101187031525575*G0_1_0 + 0.0710462136243371*G0_1_1;
-    A[152] = 0.172233245149898*G0_0_0 + 0.142092427248663*G0_0_1 + 0.142092427248662*G0_1_0 + 0.111951609347436*G0_1_1;
-    A[153] = 0.340160659171077*G0_0_0 + 0.269114445546738*G0_0_1 + 0.269114445546741*G0_1_0 + 0.198068231922395*G0_1_1;
-    A[154] = 1.98929398148147*G0_0_0 + 0.70830922067901*G0_0_1 + 0.70830922067901*G0_1_0 + 1.98929398148148*G0_1_1;
-    A[155] = -0.9063774526014*G0_0_0 - 1.70295621141975*G0_0_1 - 0.376760223765425*G0_1_0 - 2.56842826829805*G0_1_1;
-    A[156] = 0.818107914462074*G0_0_0 + 1.30036100088183*G0_0_1 + 0.585593033509694*G0_1_0 + 1.96345899470899*G0_1_1;
-    A[157] = -0.340160659171077*G0_0_0 - 0.669556740520283*G0_0_1 - 0.269114445546741*G0_1_0 - 0.938671186067018*G0_1_1;
+    A[137] = 0.0710462136243366*G0_0_1 + 0.0710462136243364*G0_1_0 + 0.142092427248678*G0_1_1;
+    A[138] = 0.0301408179012366*G0_0_1 + 0.0301408179012359*G0_1_0 + 0.131327849426812*G0_1_1;
+    A[139] = 0.0301408179012341*G0_0_1 + 0.0301408179012352*G0_1_0 + 0.172233245149915*G0_1_1;
+    A[140] = 0.0710462136243402*G0_0_1 + 0.0710462136243382*G0_1_0 + 0.340160659171083*G0_1_1;
+    A[141] = -0.262655698853614*G0_0_1 - 0.262655698853612*G0_1_0 - 0.66740382495591*G0_1_1;
+    A[142] = -0.0731991291887087*G0_0_1 - 0.0731991291887117*G0_1_0 - 0.419818535052907*G0_1_1;
+    A[143] = -0.262655698853613*G0_0_1 - 0.262655698853615*G0_1_0 - 0.990341159611995*G0_1_1;
+    A[144] = 0.572675540123449*G0_0_1 + 0.572675540123451*G0_1_0 + 1.35633680555555*G0_1_1;
+    A[145] = 0.572675540123438*G0_0_1 + 0.572675540123454*G0_1_0 + 1.1948681382275*G0_1_1;
+    A[146] = -1.66205081569663*G0_0_1 - 1.66205081569664*G0_1_0 - 2.82031938932979*G0_1_1;
+    A[147] = 0.202287946428573*G0_0_0 + 0.202287946428573*G0_0_1 - 0.648027584876543*G0_1_0 - 0.648027584876542*G0_1_1;
+    A[148] = -0.0408192791005304*G0_0_0;
+    A[149] = 0.161554783950617*G0_0_1 + 0.202374063051147*G0_1_1;
+    A[150] = 0.142092427248671*G0_0_0 + 0.0710462136243278*G0_0_1 + 0.0710462136243381*G0_1_0;
+    A[151] = 0.131327849426811*G0_0_0 + 0.101187031525582*G0_0_1 + 0.101187031525574*G0_1_0 + 0.0710462136243375*G0_1_1;
+    A[152] = 0.172233245149898*G0_0_0 + 0.142092427248662*G0_0_1 + 0.142092427248663*G0_1_0 + 0.111951609347435*G0_1_1;
+    A[153] = 0.340160659171078*G0_0_0 + 0.269114445546738*G0_0_1 + 0.26911444554674*G0_1_0 + 0.198068231922395*G0_1_1;
+    A[154] = 1.98929398148147*G0_0_0 + 0.708309220679009*G0_0_1 + 0.708309220679009*G0_1_0 + 1.98929398148148*G0_1_1;
+    A[155] = -0.906377452601401*G0_0_0 - 1.70295621141975*G0_0_1 - 0.376760223765425*G0_1_0 - 2.56842826829805*G0_1_1;
+    A[156] = 0.818107914462074*G0_0_0 + 1.30036100088183*G0_0_1 + 0.585593033509693*G0_1_0 + 1.96345899470899*G0_1_1;
+    A[157] = -0.340160659171078*G0_0_0 - 0.669556740520282*G0_0_1 - 0.26911444554674*G0_1_0 - 0.938671186067019*G0_1_1;
     A[158] = -0.286337770061733*G0_0_0 + 0.994646990740734*G0_0_1 + 0.99464699074074*G0_1_0 - 0.286337770061725*G0_1_1;
-    A[159] = 0.286337770061733*G0_0_0 - 0.579134286816572*G0_0_1 - 0.579134286816578*G0_1_0 - 0.0495170579805965*G0_1_1;
-    A[160] = -0.359536899250443*G0_0_0 + 0.303561094576717*G0_0_1 + 0.30356109457672*G0_1_0 + 0.0710462136243435*G0_1_1;
-    A[161] = 0.1980682319224*G0_0_0 - 0.071046213624333*G0_0_1 - 0.0710462136243409*G0_1_0;
-    A[162] = -2.8203193893298*G0_0_0 - 1.15826857363314*G0_0_1 - 1.15826857363315*G0_1_0 + 0.503782242063491*G0_1_1;
-    A[163] = 1.35633680555555*G0_0_0 + 0.783661265432091*G0_0_1 + 0.783661265432091*G0_1_0 + 0.210985725308632*G0_1_1;
-    A[164] = -0.667403824955899*G0_0_0 - 0.404748126102296*G0_0_1 - 0.404748126102291*G0_1_0 - 0.142092427248677*G0_1_1;
-    A[165] = 1.1948681382275*G0_0_0 + 0.622192598104038*G0_0_1 + 0.622192598104041*G0_1_0 + 0.0495170579805949*G0_1_1;
-    A[166] = -0.419818535052909*G0_0_0 - 0.346619405864177*G0_0_1 - 0.346619405864191*G0_1_0 - 0.273420276675479*G0_1_1;
-    A[167] = -0.990341159611971*G0_0_0 - 0.727685460758366*G0_0_1 - 0.727685460758356*G0_1_0 - 0.465029761904753*G0_1_1;
-    A[168] = -0.0158454585537941*G0_0_0 - 0.0158454585537928*G0_0_1 + 0.594204695767193*G0_1_0 + 0.594204695767194*G0_1_1;
-    A[169] = -0.0379774305555554*G0_0_0;
-    A[170] = -0.380291005291006*G0_0_1 - 0.449959352954147*G0_1_1;
-    A[171] = 0.131327849426813*G0_0_0 + 0.03014081790124*G0_0_1 + 0.0301408179012433*G0_1_0;
-    A[172] = -0.297102347883603*G0_0_0 - 0.148551173941804*G0_0_1 - 0.148551173941805*G0_1_0 - 0.017223324514993*G0_1_1;
-    A[173] = -0.219597387566119*G0_0_0 - 0.157162836199279*G0_0_1 - 0.157162836199268*G0_1_0 - 0.111951609347427*G0_1_1;
-    A[174] = -0.895612874779546*G0_0_0 - 0.663097993827158*G0_0_1 - 0.663097993827169*G0_1_0 - 0.359536899250438*G0_1_1;
-    A[175] = -0.9063774526014*G0_0_0 - 0.376760223765425*G0_0_1 - 1.70295621141975*G0_1_0 - 2.56842826829805*G0_1_1;
+    A[159] = 0.286337770061733*G0_0_0 - 0.579134286816571*G0_0_1 - 0.579134286816577*G0_1_0 - 0.0495170579805966*G0_1_1;
+    A[160] = -0.359536899250443*G0_0_0 + 0.303561094576716*G0_0_1 + 0.303561094576719*G0_1_0 + 0.0710462136243428*G0_1_1;
+    A[161] = 0.198068231922401*G0_0_0 - 0.0710462136243325*G0_0_1 - 0.0710462136243403*G0_1_0;
+    A[162] = -2.8203193893298*G0_0_0 - 1.15826857363314*G0_0_1 - 1.15826857363315*G0_1_0 + 0.503782242063493*G0_1_1;
+    A[163] = 1.35633680555555*G0_0_0 + 0.78366126543209*G0_0_1 + 0.783661265432091*G0_1_0 + 0.210985725308631*G0_1_1;
+    A[164] = -0.667403824955899*G0_0_0 - 0.404748126102295*G0_0_1 - 0.404748126102292*G0_1_0 - 0.142092427248674*G0_1_1;
+    A[165] = 1.1948681382275*G0_0_0 + 0.62219259810404*G0_0_1 + 0.622192598104042*G0_1_0 + 0.0495170579805924*G0_1_1;
+    A[166] = -0.419818535052908*G0_0_0 - 0.346619405864178*G0_0_1 - 0.346619405864191*G0_1_0 - 0.273420276675479*G0_1_1;
+    A[167] = -0.990341159611971*G0_0_0 - 0.727685460758366*G0_0_1 - 0.727685460758356*G0_1_0 - 0.465029761904751*G0_1_1;
+    A[168] = -0.0158454585537945*G0_0_0 - 0.015845458553793*G0_0_1 + 0.594204695767193*G0_1_0 + 0.594204695767194*G0_1_1;
+    A[169] = -0.037977430555556*G0_0_0;
+    A[170] = -0.380291005291006*G0_0_1 - 0.449959352954146*G0_1_1;
+    A[171] = 0.131327849426812*G0_0_0 + 0.030140817901238*G0_0_1 + 0.0301408179012417*G0_1_0;
+    A[172] = -0.297102347883603*G0_0_0 - 0.148551173941803*G0_0_1 - 0.148551173941802*G0_1_0 - 0.0172233245149918*G0_1_1;
+    A[173] = -0.219597387566117*G0_0_0 - 0.15716283619928*G0_0_1 - 0.157162836199271*G0_1_0 - 0.111951609347427*G0_1_1;
+    A[174] = -0.895612874779547*G0_0_0 - 0.663097993827157*G0_0_1 - 0.663097993827166*G0_1_0 - 0.359536899250437*G0_1_1;
+    A[175] = -0.906377452601401*G0_0_0 - 0.376760223765425*G0_0_1 - 1.70295621141975*G0_1_0 - 2.56842826829805*G0_1_1;
     A[176] = 3.07436342592591*G0_0_0 + 1.89887152777776*G0_0_1 + 1.89887152777776*G0_1_0 + 4.41778273809522*G0_1_1;
-    A[177] = -1.80414324294531*G0_0_0 - 2.50384080136683*G0_0_1 - 1.45321800595237*G0_1_0 - 3.95705880731921*G0_1_1;
-    A[178] = 0.895612874779546*G0_0_0 + 1.37786596119929*G0_0_1 + 0.66309799382717*G0_1_0 + 1.96345899470899*G0_1_1;
-    A[179] = -0.0495170579805944*G0_0_0 - 0.579134286816572*G0_0_1 - 0.579134286816577*G0_1_0 + 0.286337770061723*G0_1_1;
-    A[180] = 0.103339947089944*G0_0_0 - 0.0301408179012369*G0_0_1 - 0.0301408179012345*G0_1_0 + 0.103339947089942*G0_1_1;
-    A[181] = -0.111951609347442*G0_0_0 + 0.0452112268518514*G0_0_1 + 0.0452112268518509*G0_1_0 - 0.0172233245149971*G0_1_1;
-    A[182] = 0.111951609347442*G0_0_0 - 0.0301408179012386*G0_0_1 - 0.0301408179012333*G0_1_0;
-    A[183] = 0.73199129188711*G0_0_0 + 2.04096395502644*G0_0_1 + 2.04096395502644*G0_1_0 - 0.611428020282184*G0_1_1;
-    A[184] = 0.387524801587304*G0_0_0 - 0.471488508597877*G0_0_1 - 0.471488508597881*G0_1_0 - 0.318631503527328*G0_1_1;
-    A[185] = -0.344466490299826*G0_0_0 + 0.103339947089948*G0_0_1 + 0.103339947089943*G0_1_0 + 0.0344466490299849*G0_1_1;
-    A[186] = -3.81066054894178*G0_0_0 - 2.40911251653437*G0_0_1 - 2.40911251653437*G0_1_0 + 0.00430583112875413*G0_1_1;
-    A[187] = 1.03339947089947*G0_0_0 + 0.658792162698402*G0_0_1 + 0.658792162698407*G0_1_0 + 0.327243165784822*G0_1_1;
-    A[188] = 2.02374063051143*G0_0_0 + 1.61038084215166*G0_0_1 + 1.61038084215164*G0_1_0 + 0.68032131834214*G0_1_1;
-    A[189] = -0.0696683476631375*G0_0_0 - 0.0696683476631376*G0_0_1 - 0.449959352954142*G0_1_0 - 0.449959352954143*G0_1_1;
-    A[190] = -0.037977430555555*G0_0_0;
-    A[191] = 0.61005015432099*G0_0_1 + 0.5942046957672*G0_1_1;
-    A[192] = 0.172233245149906*G0_0_0 + 0.0301408179012339*G0_0_1 + 0.0301408179012269*G0_1_0;
-    A[193] = -0.219597387566129*G0_0_0 - 0.0624345513668436*G0_0_1 - 0.0624345513668318*G0_1_0 - 0.0172233245149868*G0_1_1;
-    A[194] = 0.26696152998234*G0_0_0 + 0.133480764991172*G0_0_1 + 0.133480764991158*G0_1_0 + 0.103339947089936*G0_1_1;
-    A[195] = 1.39508928571429*G0_0_0 + 0.865472056878305*G0_0_1 + 0.865472056878321*G0_1_0 + 0.28633777006173*G0_1_1;
-    A[196] = 0.818107914462074*G0_0_0 + 0.585593033509694*G0_0_1 + 1.30036100088183*G0_1_0 + 1.96345899470899*G0_1_1;
-    A[197] = -1.80414324294531*G0_0_0 - 1.45321800595237*G0_0_1 - 2.50384080136683*G0_1_0 - 3.95705880731921*G0_1_1;
+    A[177] = -1.80414324294532*G0_0_0 - 2.50384080136683*G0_0_1 - 1.45321800595237*G0_1_0 - 3.95705880731921*G0_1_1;
+    A[178] = 0.895612874779547*G0_0_0 + 1.37786596119929*G0_0_1 + 0.663097993827166*G0_1_0 + 1.96345899470899*G0_1_1;
+    A[179] = -0.0495170579805942*G0_0_0 - 0.579134286816572*G0_0_1 - 0.579134286816577*G0_1_0 + 0.286337770061724*G0_1_1;
+    A[180] = 0.103339947089945*G0_0_0 - 0.0301408179012369*G0_0_1 - 0.0301408179012344*G0_1_0 + 0.103339947089942*G0_1_1;
+    A[181] = -0.111951609347442*G0_0_0 + 0.0452112268518504*G0_0_1 + 0.0452112268518512*G0_1_0 - 0.0172233245149974*G0_1_1;
+    A[182] = 0.111951609347443*G0_0_0 - 0.0301408179012373*G0_0_1 - 0.0301408179012331*G0_1_0;
+    A[183] = 0.73199129188711*G0_0_0 + 2.04096395502644*G0_0_1 + 2.04096395502644*G0_1_0 - 0.611428020282188*G0_1_1;
+    A[184] = 0.387524801587303*G0_0_0 - 0.471488508597876*G0_0_1 - 0.471488508597883*G0_1_0 - 0.318631503527328*G0_1_1;
+    A[185] = -0.344466490299825*G0_0_0 + 0.103339947089949*G0_0_1 + 0.103339947089946*G0_1_0 + 0.0344466490299823*G0_1_1;
+    A[186] = -3.81066054894177*G0_0_0 - 2.40911251653437*G0_0_1 - 2.40911251653437*G0_1_0 + 0.00430583112875813*G0_1_1;
+    A[187] = 1.03339947089947*G0_0_0 + 0.658792162698401*G0_0_1 + 0.658792162698405*G0_1_0 + 0.327243165784824*G0_1_1;
+    A[188] = 2.02374063051143*G0_0_0 + 1.61038084215166*G0_0_1 + 1.61038084215164*G0_1_0 + 0.680321318342135*G0_1_1;
+    A[189] = -0.0696683476631373*G0_0_0 - 0.0696683476631374*G0_0_1 - 0.449959352954143*G0_1_0 - 0.449959352954144*G0_1_1;
+    A[190] = -0.0379774305555547*G0_0_0;
+    A[191] = 0.61005015432099*G0_0_1 + 0.594204695767199*G0_1_1;
+    A[192] = 0.172233245149905*G0_0_0 + 0.0301408179012343*G0_0_1 + 0.0301408179012275*G0_1_0;
+    A[193] = -0.219597387566127*G0_0_0 - 0.0624345513668431*G0_0_1 - 0.0624345513668325*G0_1_0 - 0.0172233245149873*G0_1_1;
+    A[194] = 0.266961529982337*G0_0_0 + 0.133480764991171*G0_0_1 + 0.13348076499116*G0_1_0 + 0.103339947089937*G0_1_1;
+    A[195] = 1.3950892857143*G0_0_0 + 0.865472056878307*G0_0_1 + 0.865472056878318*G0_1_0 + 0.286337770061729*G0_1_1;
+    A[196] = 0.818107914462075*G0_0_0 + 0.585593033509693*G0_0_1 + 1.30036100088183*G0_1_0 + 1.96345899470899*G0_1_1;
+    A[197] = -1.80414324294532*G0_0_0 - 1.45321800595237*G0_0_1 - 2.50384080136683*G0_1_0 - 3.95705880731921*G0_1_1;
     A[198] = 3.69440310846559*G0_0_0 + 2.51891121031745*G0_0_1 + 2.51891121031745*G0_1_0 + 4.41778273809523*G0_1_1;
-    A[199] = -1.39508928571429*G0_0_0 - 2.19166804453263*G0_0_1 - 0.865472056878321*G0_1_0 - 2.56842826829806*G0_1_1;
-    A[200] = 0.0710462136243353*G0_0_0 + 0.303561094576721*G0_0_1 + 0.303561094576717*G0_1_0 - 0.359536899250436*G0_1_1;
-    A[201] = -0.0172233245149909*G0_0_0 + 0.0452112268518544*G0_0_1 + 0.0452112268518522*G0_1_0 - 0.111951609347441*G0_1_1;
-    A[202] = -0.0172233245149897*G0_0_0 + 0.131327849426808*G0_0_1 + 0.131327849426808*G0_1_0 - 0.0172233245149879*G0_1_1;
-    A[203] = 0.0710462136243372*G0_0_0 - 0.0301408179012364*G0_0_1 - 0.0301408179012341*G0_1_0;
-    A[204] = -0.516699735449723*G0_0_0 - 0.93005952380952*G0_0_1 - 0.930059523809516*G0_1_0 + 0.68032131834215*G0_1_1;
-    A[205] = 0.0430583112874741*G0_0_0 - 0.331548996913582*G0_0_1 - 0.33154899691358*G0_1_0 + 0.32724316578483*G0_1_1;
-    A[206] = -0.516699735449731*G0_0_0 - 0.0688932980599598*G0_0_1 - 0.0688932980599625*G0_1_0 + 0.0344466490299801*G0_1_1;
-    A[207] = 1.01187031525572*G0_0_0 + 2.41341834766312*G0_0_1 + 2.41341834766312*G0_1_0 + 0.00430583112874244*G0_1_1;
-    A[208] = 1.01187031525573*G0_0_0 + 0.152857005070553*G0_0_1 + 0.152857005070544*G0_1_0 - 0.318631503527333*G0_1_1;
-    A[209] = -3.96136463844792*G0_0_0 - 2.65239197530862*G0_0_1 - 2.65239197530861*G0_1_0 - 0.611428020282181*G0_1_1;
-    A[210] = 0.0408192791005288*G0_0_0 + 0.0408192791005301*G0_0_1 + 0.202374063051146*G0_1_0 + 0.202374063051146*G0_1_1;
-    A[211] = -0.0408192791005285*G0_0_0;
-    A[212] = -0.850315531305116*G0_0_1 - 0.648027584876546*G0_1_1;
-    A[213] = 0.340160659171074*G0_0_0 + 0.0710462136243367*G0_0_1 + 0.0710462136243443*G0_1_0;
-    A[214] = -0.895612874779544*G0_0_0 - 0.232514880952382*G0_0_1 - 0.232514880952386*G0_1_0 + 0.0710462136243376*G0_1_1;
-    A[215] = 1.39508928571429*G0_0_0 + 0.529617228835976*G0_0_1 + 0.529617228835992*G0_1_0 - 0.0495170579805946*G0_1_1;
+    A[199] = -1.3950892857143*G0_0_0 - 2.19166804453263*G0_0_1 - 0.865472056878319*G0_1_0 - 2.56842826829806*G0_1_1;
+    A[200] = 0.071046213624335*G0_0_0 + 0.303561094576721*G0_0_1 + 0.303561094576719*G0_1_0 - 0.359536899250438*G0_1_1;
+    A[201] = -0.0172233245149909*G0_0_0 + 0.0452112268518549*G0_0_1 + 0.0452112268518513*G0_1_0 - 0.111951609347442*G0_1_1;
+    A[202] = -0.0172233245149894*G0_0_0 + 0.131327849426809*G0_0_1 + 0.131327849426809*G0_1_0 - 0.0172233245149869*G0_1_1;
+    A[203] = 0.0710462136243368*G0_0_0 - 0.0301408179012371*G0_0_1 - 0.0301408179012349*G0_1_0;
+    A[204] = -0.516699735449723*G0_0_0 - 0.930059523809521*G0_0_1 - 0.930059523809513*G0_1_0 + 0.680321318342153*G0_1_1;
+    A[205] = 0.0430583112874743*G0_0_0 - 0.331548996913583*G0_0_1 - 0.331548996913578*G0_1_0 + 0.32724316578483*G0_1_1;
+    A[206] = -0.516699735449731*G0_0_0 - 0.068893298059959*G0_0_1 - 0.0688932980599645*G0_1_0 + 0.0344466490299808*G0_1_1;
+    A[207] = 1.01187031525571*G0_0_0 + 2.41341834766312*G0_0_1 + 2.41341834766312*G0_1_0 + 0.00430583112873867*G0_1_1;
+    A[208] = 1.01187031525573*G0_0_0 + 0.15285700507055*G0_0_1 + 0.152857005070546*G0_1_0 - 0.318631503527336*G0_1_1;
+    A[209] = -3.96136463844793*G0_0_0 - 2.65239197530862*G0_0_1 - 2.65239197530861*G0_1_0 - 0.611428020282176*G0_1_1;
+    A[210] = 0.0408192791005289*G0_0_0 + 0.0408192791005301*G0_0_1 + 0.202374063051146*G0_1_0 + 0.202374063051147*G0_1_1;
+    A[211] = -0.0408192791005284*G0_0_0;
+    A[212] = -0.850315531305115*G0_0_1 - 0.648027584876545*G0_1_1;
+    A[213] = 0.340160659171075*G0_0_0 + 0.0710462136243367*G0_0_1 + 0.0710462136243448*G0_1_0;
+    A[214] = -0.895612874779544*G0_0_0 - 0.23251488095238*G0_0_1 - 0.232514880952387*G0_1_0 + 0.0710462136243389*G0_1_1;
+    A[215] = 1.39508928571429*G0_0_0 + 0.529617228835977*G0_0_1 + 0.529617228835992*G0_1_0 - 0.0495170579805949*G0_1_1;
     A[216] = -2.56196952160494*G0_0_0 - 1.28098476080247*G0_0_1 - 1.28098476080248*G0_1_0 - 0.286337770061727*G0_1_1;
-    A[217] = -0.340160659171077*G0_0_0 - 0.269114445546741*G0_0_1 - 0.669556740520282*G0_1_0 - 0.938671186067018*G0_1_1;
-    A[218] = 0.895612874779546*G0_0_0 + 0.66309799382717*G0_0_1 + 1.37786596119929*G0_1_0 + 1.96345899470899*G0_1_1;
-    A[219] = -1.39508928571429*G0_0_0 - 0.865472056878321*G0_0_1 - 2.19166804453263*G0_1_0 - 2.56842826829806*G0_1_1;
-    A[220] = 2.56196952160494*G0_0_0 + 1.28098476080248*G0_0_1 + 1.28098476080248*G0_1_0 + 1.98929398148149*G0_1_1;
-    A[221] = -0.0710462136243373*G0_0_1 - 0.0710462136243385*G0_1_0 + 0.198068231922396*G0_1_1;
-    A[222] = -0.0301408179012361*G0_0_1 - 0.0301408179012348*G0_1_0 + 0.11195160934744*G0_1_1;
-    A[223] = -0.0301408179012333*G0_0_1 - 0.0301408179012346*G0_1_0 + 0.0710462136243369*G0_1_1;
-    A[224] = -0.0710462136243402*G0_0_1 - 0.0710462136243395*G0_1_0;
-    A[225] = 0.262655698853616*G0_0_1 + 0.262655698853613*G0_1_0 - 0.465029761904762*G0_1_1;
-    A[226] = 0.0731991291887078*G0_0_1 + 0.073199129188712*G0_1_0 - 0.273420276675486*G0_1_1;
-    A[227] = 0.262655698853615*G0_0_1 + 0.262655698853614*G0_1_0 - 0.142092427248677*G0_1_1;
-    A[228] = -1.07414077632484e-14*G0_0_0 - 0.572675540123454*G0_0_1 - 0.572675540123454*G0_1_0 + 0.049517057980602*G0_1_1;
-    A[229] = 1.0019762797242e-14*G0_0_0 - 0.572675540123438*G0_0_1 - 0.57267554012345*G0_1_0 + 0.210985725308645*G0_1_1;
-    A[230] = 1.66205081569664*G0_0_1 + 1.66205081569664*G0_1_0 + 0.503782242063489*G0_1_1;
-    A[231] = -0.648027584876542*G0_0_0 - 0.648027584876544*G0_0_1 + 0.202287946428572*G0_1_0 + 0.202287946428572*G0_1_1;
-    A[232] = 0.202374063051143*G0_0_0 + 0.161554783950614*G0_1_0;
-    A[233] = -0.0408192791005306*G0_1_1;
-    A[234] = 0.198068231922389*G0_0_0 + 0.26911444554673*G0_0_1 + 0.269114445546723*G0_1_0 + 0.340160659171058*G0_1_1;
-    A[235] = 0.111951609347441*G0_0_0 + 0.142092427248672*G0_0_1 + 0.142092427248675*G0_1_0 + 0.172233245149913*G0_1_1;
-    A[236] = 0.0710462136243316*G0_0_0 + 0.101187031525569*G0_0_1 + 0.101187031525568*G0_1_0 + 0.131327849426796*G0_1_1;
-    A[237] = 0.071046213624336*G0_0_1 + 0.0710462136243374*G0_1_0 + 0.142092427248679*G0_1_1;
+    A[217] = -0.340160659171078*G0_0_0 - 0.26911444554674*G0_0_1 - 0.669556740520282*G0_1_0 - 0.93867118606702*G0_1_1;
+    A[218] = 0.895612874779547*G0_0_0 + 0.663097993827166*G0_0_1 + 1.37786596119929*G0_1_0 + 1.96345899470899*G0_1_1;
+    A[219] = -1.3950892857143*G0_0_0 - 0.865472056878319*G0_0_1 - 2.19166804453263*G0_1_0 - 2.56842826829806*G0_1_1;
+    A[220] = 2.56196952160495*G0_0_0 + 1.28098476080248*G0_0_1 + 1.28098476080248*G0_1_0 + 1.98929398148149*G0_1_1;
+    A[221] = -0.0710462136243366*G0_0_1 - 0.0710462136243391*G0_1_0 + 0.198068231922397*G0_1_1;
+    A[222] = -0.030140817901237*G0_0_1 - 0.0301408179012341*G0_1_0 + 0.11195160934744*G0_1_1;
+    A[223] = -0.030140817901234*G0_0_1 - 0.0301408179012355*G0_1_0 + 0.0710462136243357*G0_1_1;
+    A[224] = -0.07104621362434*G0_0_1 - 0.0710462136243386*G0_1_0;
+    A[225] = 0.262655698853614*G0_0_1 + 0.262655698853611*G0_1_0 - 0.465029761904765*G0_1_1;
+    A[226] = 0.0731991291887095*G0_0_1 + 0.0731991291887117*G0_1_0 - 0.273420276675485*G0_1_1;
+    A[227] = 0.262655698853613*G0_0_1 + 0.262655698853615*G0_1_0 - 0.142092427248678*G0_1_1;
+    A[228] = -0.572675540123449*G0_0_1 - 0.57267554012345*G0_1_0 + 0.049517057980605*G0_1_1;
+    A[229] = -0.572675540123439*G0_0_1 - 0.572675540123452*G0_1_0 + 0.210985725308647*G0_1_1;
+    A[230] = 1.66205081569663*G0_0_1 + 1.66205081569664*G0_1_0 + 0.503782242063485*G0_1_1;
+    A[231] = -0.648027584876542*G0_0_0 - 0.648027584876543*G0_0_1 + 0.202287946428572*G0_1_0 + 0.202287946428571*G0_1_1;
+    A[232] = 0.202374063051144*G0_0_0 + 0.161554783950614*G0_1_0;
+    A[233] = -0.0408192791005308*G0_1_1;
+    A[234] = 0.19806823192239*G0_0_0 + 0.26911444554673*G0_0_1 + 0.269114445546723*G0_1_0 + 0.340160659171058*G0_1_1;
+    A[235] = 0.111951609347442*G0_0_0 + 0.142092427248673*G0_0_1 + 0.142092427248674*G0_1_0 + 0.172233245149913*G0_1_1;
+    A[236] = 0.0710462136243318*G0_0_0 + 0.101187031525568*G0_0_1 + 0.101187031525569*G0_1_0 + 0.131327849426798*G0_1_1;
+    A[237] = 0.0710462136243364*G0_0_1 + 0.0710462136243366*G0_1_0 + 0.142092427248678*G0_1_1;
     A[238] = -0.286337770061733*G0_0_0 + 0.99464699074074*G0_0_1 + 0.994646990740734*G0_1_0 - 0.286337770061725*G0_1_1;
-    A[239] = -0.0495170579805945*G0_0_0 - 0.579134286816577*G0_0_1 - 0.579134286816572*G0_1_0 + 0.286337770061723*G0_1_1;
-    A[240] = 0.0710462136243353*G0_0_0 + 0.303561094576717*G0_0_1 + 0.303561094576721*G0_1_0 - 0.359536899250436*G0_1_1;
-    A[241] = -0.0710462136243385*G0_0_1 - 0.0710462136243373*G0_1_0 + 0.198068231922396*G0_1_1;
+    A[239] = -0.0495170579805942*G0_0_0 - 0.579134286816577*G0_0_1 - 0.579134286816572*G0_1_0 + 0.286337770061724*G0_1_1;
+    A[240] = 0.071046213624335*G0_0_0 + 0.303561094576719*G0_0_1 + 0.303561094576721*G0_1_0 - 0.359536899250438*G0_1_1;
+    A[241] = -0.0710462136243391*G0_0_1 - 0.0710462136243366*G0_1_0 + 0.198068231922397*G0_1_1;
     A[242] = 1.98929398148147*G0_0_0 + 0.708309220679005*G0_0_1 + 0.708309220679005*G0_1_0 + 1.98929398148147*G0_1_1;
-    A[243] = -2.56842826829805*G0_0_0 - 0.376760223765422*G0_0_1 - 1.70295621141974*G0_1_0 - 0.906377452601395*G0_1_1;
-    A[244] = 1.96345899470898*G0_0_0 + 0.58559303350969*G0_0_1 + 1.30036100088182*G0_1_0 + 0.818107914462071*G0_1_1;
-    A[245] = -0.938671186067011*G0_0_0 - 0.269114445546731*G0_0_1 - 0.669556740520273*G0_1_0 - 0.340160659171063*G0_1_1;
-    A[246] = 0.503782242063507*G0_0_0 - 1.15826857363314*G0_0_1 - 1.15826857363314*G0_1_0 - 2.82031938932979*G0_1_1;
-    A[247] = 0.0495170579805767*G0_0_0 + 0.622192598104035*G0_0_1 + 0.62219259810404*G0_1_0 + 1.19486813822749*G0_1_1;
-    A[248] = -0.46502976190474*G0_0_0 - 0.727685460758358*G0_0_1 - 0.727685460758355*G0_1_0 - 0.990341159611981*G0_1_1;
-    A[249] = 0.210985725308633*G0_0_0 + 0.783661265432095*G0_0_1 + 0.78366126543209*G0_1_0 + 1.35633680555554*G0_1_1;
-    A[250] = -0.27342027667548*G0_0_0 - 0.34661940586419*G0_0_1 - 0.346619405864192*G0_1_0 - 0.419818535052888*G0_1_1;
-    A[251] = -0.142092427248668*G0_0_0 - 0.404748126102288*G0_0_1 - 0.404748126102289*G0_1_0 - 0.667403824955905*G0_1_1;
-    A[252] = 0.594204695767193*G0_0_0 + 0.594204695767195*G0_0_1 - 0.0158454585537934*G0_1_0 - 0.0158454585537934*G0_1_1;
-    A[253] = -0.449959352954138*G0_0_0 - 0.380291005290998*G0_1_0;
-    A[254] = -0.037977430555556*G0_1_1;
-    A[255] = -0.359536899250424*G0_0_0 - 0.663097993827144*G0_0_1 - 0.663097993827144*G0_1_0 - 0.89561287477952*G0_1_1;
-    A[256] = -0.11195160934744*G0_0_0 - 0.157162836199285*G0_0_1 - 0.157162836199289*G0_1_0 - 0.219597387566128*G0_1_1;
-    A[257] = -0.0172233245149871*G0_0_0 - 0.148551173941797*G0_0_1 - 0.148551173941796*G0_1_0 - 0.297102347883596*G0_1_1;
-    A[258] = 0.0301408179012371*G0_0_1 + 0.0301408179012358*G0_1_0 + 0.131327849426813*G0_1_1;
-    A[259] = 0.286337770061733*G0_0_0 - 0.579134286816578*G0_0_1 - 0.579134286816572*G0_1_0 - 0.0495170579805965*G0_1_1;
-    A[260] = 0.103339947089944*G0_0_0 - 0.0301408179012346*G0_0_1 - 0.0301408179012369*G0_1_0 + 0.103339947089942*G0_1_1;
-    A[261] = -0.0172233245149909*G0_0_0 + 0.0452112268518522*G0_0_1 + 0.0452112268518544*G0_1_0 - 0.111951609347441*G0_1_1;
-    A[262] = -0.0301408179012348*G0_0_1 - 0.0301408179012361*G0_1_0 + 0.11195160934744*G0_1_1;
-    A[263] = -2.56842826829805*G0_0_0 - 1.70295621141974*G0_0_1 - 0.376760223765422*G0_1_0 - 0.906377452601395*G0_1_1;
-    A[264] = 4.41778273809521*G0_0_0 + 1.89887152777775*G0_0_1 + 1.89887152777775*G0_1_0 + 3.0743634259259*G0_1_1;
+    A[243] = -2.56842826829805*G0_0_0 - 0.376760223765422*G0_0_1 - 1.70295621141974*G0_1_0 - 0.906377452601392*G0_1_1;
+    A[244] = 1.96345899470898*G0_0_0 + 0.585593033509691*G0_0_1 + 1.30036100088182*G0_1_0 + 0.818107914462068*G0_1_1;
+    A[245] = -0.938671186067012*G0_0_0 - 0.269114445546732*G0_0_1 - 0.669556740520273*G0_1_0 - 0.340160659171063*G0_1_1;
+    A[246] = 0.503782242063506*G0_0_0 - 1.15826857363314*G0_0_1 - 1.15826857363314*G0_1_0 - 2.82031938932979*G0_1_1;
+    A[247] = 0.0495170579805781*G0_0_0 + 0.622192598104034*G0_0_1 + 0.622192598104038*G0_1_0 + 1.19486813822749*G0_1_1;
+    A[248] = -0.465029761904741*G0_0_0 - 0.727685460758357*G0_0_1 - 0.727685460758354*G0_1_0 - 0.990341159611978*G0_1_1;
+    A[249] = 0.210985725308634*G0_0_0 + 0.783661265432093*G0_0_1 + 0.78366126543209*G0_1_0 + 1.35633680555555*G0_1_1;
+    A[250] = -0.273420276675481*G0_0_0 - 0.346619405864189*G0_0_1 - 0.346619405864191*G0_1_0 - 0.419818535052891*G0_1_1;
+    A[251] = -0.142092427248668*G0_0_0 - 0.404748126102287*G0_0_1 - 0.40474812610229*G0_1_0 - 0.667403824955905*G0_1_1;
+    A[252] = 0.594204695767193*G0_0_0 + 0.594204695767194*G0_0_1 - 0.0158454585537931*G0_1_0 - 0.0158454585537933*G0_1_1;
+    A[253] = -0.449959352954138*G0_0_0 - 0.380291005290997*G0_1_0;
+    A[254] = -0.0379774305555558*G0_1_1;
+    A[255] = -0.359536899250423*G0_0_0 - 0.663097993827141*G0_0_1 - 0.663097993827143*G0_1_0 - 0.895612874779516*G0_1_1;
+    A[256] = -0.111951609347442*G0_0_0 - 0.157162836199289*G0_0_1 - 0.157162836199288*G0_1_0 - 0.219597387566131*G0_1_1;
+    A[257] = -0.0172233245149868*G0_0_0 - 0.148551173941795*G0_0_1 - 0.148551173941797*G0_1_0 - 0.297102347883594*G0_1_1;
+    A[258] = 0.0301408179012359*G0_0_1 + 0.0301408179012366*G0_1_0 + 0.131327849426812*G0_1_1;
+    A[259] = 0.286337770061734*G0_0_0 - 0.579134286816577*G0_0_1 - 0.579134286816571*G0_1_0 - 0.0495170579805966*G0_1_1;
+    A[260] = 0.103339947089945*G0_0_0 - 0.0301408179012344*G0_0_1 - 0.0301408179012369*G0_1_0 + 0.103339947089942*G0_1_1;
+    A[261] = -0.0172233245149909*G0_0_0 + 0.0452112268518513*G0_0_1 + 0.045211226851855*G0_1_0 - 0.111951609347442*G0_1_1;
+    A[262] = -0.0301408179012341*G0_0_1 - 0.030140817901237*G0_1_0 + 0.11195160934744*G0_1_1;
+    A[263] = -2.56842826829805*G0_0_0 - 1.70295621141974*G0_0_1 - 0.376760223765422*G0_1_0 - 0.906377452601392*G0_1_1;
+    A[264] = 4.41778273809521*G0_0_0 + 1.89887152777775*G0_0_1 + 1.89887152777775*G0_1_0 + 3.07436342592589*G0_1_1;
     A[265] = -3.95705880731919*G0_0_0 - 1.45321800595236*G0_0_1 - 2.50384080136681*G0_1_0 - 1.80414324294529*G0_1_1;
-    A[266] = 1.96345899470897*G0_0_0 + 0.663097993827145*G0_0_1 + 1.37786596119927*G0_1_0 + 0.89561287477952*G0_1_1;
-    A[267] = -0.611428020282207*G0_0_0 + 2.04096395502644*G0_0_1 + 2.04096395502643*G0_1_0 + 0.731991291887103*G0_1_1;
-    A[268] = 0.00430583112878294*G0_0_0 - 2.40911251653435*G0_0_1 - 2.40911251653435*G0_1_0 - 3.81066054894176*G0_1_1;
-    A[269] = 0.680321318342116*G0_0_0 + 1.61038084215164*G0_0_1 + 1.61038084215164*G0_1_0 + 2.02374063051142*G0_1_1;
-    A[270] = -0.31863150352733*G0_0_0 - 0.471488508597881*G0_0_1 - 0.471488508597877*G0_1_0 + 0.387524801587314*G0_1_1;
-    A[271] = 0.327243165784825*G0_0_0 + 0.658792162698403*G0_0_1 + 0.658792162698402*G0_1_0 + 1.03339947089946*G0_1_1;
-    A[272] = 0.0344466490299796*G0_0_0 + 0.103339947089945*G0_0_1 + 0.103339947089942*G0_1_0 - 0.344466490299829*G0_1_1;
-    A[273] = -0.449959352954143*G0_0_0 - 0.449959352954144*G0_0_1 - 0.0696683476631383*G0_1_0 - 0.0696683476631397*G0_1_1;
-    A[274] = 0.594204695767185*G0_0_0 + 0.610050154320978*G0_1_0;
+    A[266] = 1.96345899470897*G0_0_0 + 0.663097993827144*G0_0_1 + 1.37786596119927*G0_1_0 + 0.895612874779517*G0_1_1;
+    A[267] = -0.611428020282207*G0_0_0 + 2.04096395502644*G0_0_1 + 2.04096395502643*G0_1_0 + 0.731991291887102*G0_1_1;
+    A[268] = 0.00430583112878251*G0_0_0 - 2.40911251653435*G0_0_1 - 2.40911251653435*G0_1_0 - 3.81066054894176*G0_1_1;
+    A[269] = 0.680321318342116*G0_0_0 + 1.61038084215164*G0_0_1 + 1.61038084215164*G0_1_0 + 2.02374063051141*G0_1_1;
+    A[270] = -0.318631503527332*G0_0_0 - 0.471488508597882*G0_0_1 - 0.471488508597879*G0_1_0 + 0.387524801587311*G0_1_1;
+    A[271] = 0.327243165784827*G0_0_0 + 0.658792162698405*G0_0_1 + 0.658792162698402*G0_1_0 + 1.03339947089947*G0_1_1;
+    A[272] = 0.0344466490299792*G0_0_0 + 0.103339947089946*G0_0_1 + 0.103339947089942*G0_1_0 - 0.344466490299829*G0_1_1;
+    A[273] = -0.449959352954142*G0_0_0 - 0.449959352954143*G0_0_1 - 0.0696683476631388*G0_1_0 - 0.0696683476631395*G0_1_1;
+    A[274] = 0.594204695767184*G0_0_0 + 0.610050154320977*G0_1_0;
     A[275] = -0.0379774305555562*G0_1_1;
-    A[276] = 0.286337770061709*G0_0_0 + 0.86547205687828*G0_0_1 + 0.865472056878291*G0_1_0 + 1.39508928571426*G0_1_1;
-    A[277] = 0.103339947089948*G0_0_0 + 0.13348076499118*G0_0_1 + 0.133480764991184*G0_1_0 + 0.266961529982367*G0_1_1;
-    A[278] = -0.0172233245149933*G0_0_0 - 0.0624345513668455*G0_0_1 - 0.0624345513668474*G0_1_0 - 0.219597387566143*G0_1_1;
-    A[279] = 0.0301408179012332*G0_0_1 + 0.0301408179012335*G0_1_0 + 0.172233245149912*G0_1_1;
-    A[280] = -0.359536899250443*G0_0_0 + 0.30356109457672*G0_0_1 + 0.303561094576717*G0_1_0 + 0.0710462136243435*G0_1_1;
-    A[281] = -0.111951609347441*G0_0_0 + 0.0452112268518508*G0_0_1 + 0.0452112268518514*G0_1_0 - 0.0172233245149971*G0_1_1;
-    A[282] = -0.0172233245149897*G0_0_0 + 0.131327849426808*G0_0_1 + 0.131327849426808*G0_1_0 - 0.0172233245149879*G0_1_1;
-    A[283] = -0.0301408179012346*G0_0_1 - 0.0301408179012333*G0_1_0 + 0.0710462136243369*G0_1_1;
-    A[284] = 1.96345899470898*G0_0_0 + 1.30036100088182*G0_0_1 + 0.58559303350969*G0_1_0 + 0.818107914462071*G0_1_1;
+    A[276] = 0.286337770061708*G0_0_0 + 0.865472056878275*G0_0_1 + 0.865472056878289*G0_1_0 + 1.39508928571425*G0_1_1;
+    A[277] = 0.10333994708995*G0_0_0 + 0.133480764991185*G0_0_1 + 0.133480764991185*G0_1_0 + 0.266961529982371*G0_1_1;
+    A[278] = -0.0172233245149941*G0_0_0 - 0.0624345513668494*G0_0_1 - 0.0624345513668477*G0_1_0 - 0.219597387566148*G0_1_1;
+    A[279] = 0.0301408179012352*G0_0_1 + 0.0301408179012341*G0_1_0 + 0.172233245149915*G0_1_1;
+    A[280] = -0.359536899250443*G0_0_0 + 0.303561094576719*G0_0_1 + 0.303561094576716*G0_1_0 + 0.0710462136243428*G0_1_1;
+    A[281] = -0.111951609347442*G0_0_0 + 0.0452112268518512*G0_0_1 + 0.0452112268518504*G0_1_0 - 0.0172233245149974*G0_1_1;
+    A[282] = -0.0172233245149894*G0_0_0 + 0.131327849426809*G0_0_1 + 0.131327849426809*G0_1_0 - 0.0172233245149869*G0_1_1;
+    A[283] = -0.0301408179012355*G0_0_1 - 0.030140817901234*G0_1_0 + 0.0710462136243357*G0_1_1;
+    A[284] = 1.96345899470898*G0_0_0 + 1.30036100088182*G0_0_1 + 0.585593033509691*G0_1_0 + 0.818107914462068*G0_1_1;
     A[285] = -3.95705880731919*G0_0_0 - 2.50384080136681*G0_0_1 - 1.45321800595236*G0_1_0 - 1.80414324294529*G0_1_1;
-    A[286] = 4.4177827380952*G0_0_0 + 2.51891121031743*G0_0_1 + 2.51891121031743*G0_1_0 + 3.69440310846557*G0_1_1;
-    A[287] = -2.56842826829803*G0_0_0 - 0.865472056878282*G0_0_1 - 2.1916680445326*G0_1_0 - 1.39508928571426*G0_1_1;
-    A[288] = 0.68032131834217*G0_0_0 - 0.930059523809508*G0_0_1 - 0.930059523809505*G0_1_0 - 0.516699735449723*G0_1_1;
-    A[289] = 0.00430583112871343*G0_0_0 + 2.4134183476631*G0_0_1 + 2.4134183476631*G0_1_0 + 1.01187031525569*G0_1_1;
-    A[290] = -0.611428020282149*G0_0_0 - 2.6523919753086*G0_0_1 - 2.6523919753086*G0_1_0 - 3.96136463844793*G0_1_1;
-    A[291] = 0.32724316578483*G0_0_0 - 0.33154899691358*G0_0_1 - 0.331548996913577*G0_1_0 + 0.0430583112874746*G0_1_1;
-    A[292] = -0.318631503527335*G0_0_0 + 0.152857005070552*G0_0_1 + 0.152857005070542*G0_1_0 + 1.01187031525574*G0_1_1;
-    A[293] = 0.0344466490299814*G0_0_0 - 0.0688932980599652*G0_0_1 - 0.0688932980599611*G0_1_0 - 0.516699735449733*G0_1_1;
-    A[294] = 0.202374063051145*G0_0_0 + 0.202374063051146*G0_0_1 + 0.040819279100527*G0_1_0 + 0.0408192791005301*G0_1_1;
+    A[286] = 4.41778273809519*G0_0_0 + 2.51891121031742*G0_0_1 + 2.51891121031742*G0_1_0 + 3.69440310846556*G0_1_1;
+    A[287] = -2.56842826829803*G0_0_0 - 0.865472056878278*G0_0_1 - 2.1916680445326*G0_1_0 - 1.39508928571426*G0_1_1;
+    A[288] = 0.680321318342169*G0_0_0 - 0.93005952380951*G0_0_1 - 0.930059523809504*G0_1_0 - 0.516699735449723*G0_1_1;
+    A[289] = 0.00430583112871392*G0_0_0 + 2.4134183476631*G0_0_1 + 2.4134183476631*G0_1_0 + 1.01187031525569*G0_1_1;
+    A[290] = -0.611428020282149*G0_0_0 - 2.6523919753086*G0_0_1 - 2.6523919753086*G0_1_0 - 3.96136463844792*G0_1_1;
+    A[291] = 0.327243165784832*G0_0_0 - 0.331548996913577*G0_0_1 - 0.331548996913577*G0_1_0 + 0.043058311287478*G0_1_1;
+    A[292] = -0.318631503527337*G0_0_0 + 0.152857005070549*G0_0_1 + 0.152857005070543*G0_1_0 + 1.01187031525574*G0_1_1;
+    A[293] = 0.034446649029982*G0_0_0 - 0.0688932980599656*G0_0_1 - 0.0688932980599619*G0_1_0 - 0.516699735449734*G0_1_1;
+    A[294] = 0.202374063051145*G0_0_0 + 0.202374063051146*G0_0_1 + 0.0408192791005277*G0_1_0 + 0.0408192791005302*G0_1_1;
     A[295] = -0.648027584876533*G0_0_0 - 0.850315531305105*G0_1_0;
-    A[296] = -0.0408192791005295*G0_1_1;
+    A[296] = -0.0408192791005298*G0_1_1;
     A[297] = -0.286337770061714*G0_0_0 - 1.28098476080244*G0_0_1 - 1.28098476080245*G0_1_0 - 2.56196952160491*G0_1_1;
-    A[298] = -0.049517057980603*G0_0_0 + 0.529617228835973*G0_0_1 + 0.529617228835976*G0_1_0 + 1.39508928571429*G0_1_1;
-    A[299] = 0.0710462136243398*G0_0_0 - 0.232514880952378*G0_0_1 - 0.232514880952381*G0_1_0 - 0.895612874779545*G0_1_1;
-    A[300] = 0.0710462136243397*G0_0_1 + 0.0710462136243404*G0_1_0 + 0.340160659171084*G0_1_1;
-    A[301] = 0.1980682319224*G0_0_0 - 0.0710462136243409*G0_0_1 - 0.071046213624333*G0_1_0;
-    A[302] = 0.111951609347442*G0_0_0 - 0.0301408179012333*G0_0_1 - 0.0301408179012386*G0_1_0;
-    A[303] = 0.0710462136243372*G0_0_0 - 0.0301408179012341*G0_0_1 - 0.0301408179012364*G0_1_0;
-    A[304] = -0.0710462136243394*G0_0_1 - 0.0710462136243402*G0_1_0;
-    A[305] = -0.938671186067011*G0_0_0 - 0.669556740520273*G0_0_1 - 0.269114445546731*G0_1_0 - 0.340160659171063*G0_1_1;
-    A[306] = 1.96345899470897*G0_0_0 + 1.37786596119927*G0_0_1 + 0.663097993827145*G0_1_0 + 0.89561287477952*G0_1_1;
-    A[307] = -2.56842826829803*G0_0_0 - 2.1916680445326*G0_0_1 - 0.865472056878282*G0_1_0 - 1.39508928571426*G0_1_1;
-    A[308] = 1.98929398148146*G0_0_0 + 1.28098476080245*G0_0_1 + 1.28098476080244*G0_1_0 + 2.56196952160491*G0_1_1;
-    A[309] = -0.46502976190477*G0_0_0 + 0.262655698853606*G0_0_1 + 0.262655698853601*G0_1_0 - 1.58241475478604e-14*G0_1_1;
-    A[310] = 0.0495170579806184*G0_0_0 - 0.57267554012343*G0_0_1 - 0.572675540123438*G0_1_0 + 3.02619257777637e-14*G0_1_1;
-    A[311] = 0.503782242063466*G0_0_0 + 1.66205081569662*G0_0_1 + 1.66205081569662*G0_1_0 - 3.41132287348667e-14*G0_1_1;
-    A[312] = -0.273420276675486*G0_0_0 + 0.0731991291887123*G0_0_1 + 0.0731991291887157*G0_1_0;
-    A[313] = 0.210985725308646*G0_0_0 - 0.572675540123459*G0_0_1 - 0.572675540123454*G0_1_0;
-    A[314] = -0.142092427248676*G0_0_0 + 0.262655698853616*G0_0_1 + 0.262655698853617*G0_1_0;
-    A[315] = -0.215291556437394*G0_0_0 - 0.215291556437394*G0_0_1 - 0.215291556437392*G0_1_0 - 0.21529155643739*G0_1_1;
-    A[316] = 0.107645778218697*G0_0_0;
-    A[317] = 0.107645778218696*G0_1_1;
-    A[318] = -0.667403824955892*G0_0_0 - 0.262655698853598*G0_0_1 - 0.262655698853601*G0_1_0 + 1.96945324631992e-14*G0_1_1;
-    A[319] = -0.344466490299815*G0_0_0 - 0.447806437389763*G0_0_1 - 0.447806437389766*G0_1_0 - 0.516699735449741*G0_1_1;
-    A[320] = -0.516699735449712*G0_0_0 - 0.447806437389749*G0_0_1 - 0.447806437389761*G0_1_0 - 0.344466490299801*G0_1_1;
-    A[321] = -0.262655698853611*G0_0_1 - 0.262655698853616*G0_1_0 - 0.667403824955912*G0_1_1;
-    A[322] = -2.8203193893298*G0_0_0 - 1.15826857363315*G0_0_1 - 1.15826857363314*G0_1_0 + 0.503782242063491*G0_1_1;
-    A[323] = 0.73199129188711*G0_0_0 + 2.04096395502644*G0_0_1 + 2.04096395502644*G0_1_0 - 0.611428020282184*G0_1_1;
-    A[324] = -0.516699735449723*G0_0_0 - 0.930059523809516*G0_0_1 - 0.93005952380952*G0_1_0 + 0.68032131834215*G0_1_1;
-    A[325] = 0.262655698853613*G0_0_1 + 0.262655698853616*G0_1_0 - 0.465029761904762*G0_1_1;
+    A[298] = -0.0495170579806034*G0_0_0 + 0.529617228835971*G0_0_1 + 0.529617228835976*G0_1_0 + 1.39508928571429*G0_1_1;
+    A[299] = 0.0710462136243395*G0_0_0 - 0.232514880952376*G0_0_1 - 0.232514880952382*G0_1_0 - 0.895612874779545*G0_1_1;
+    A[300] = 0.0710462136243382*G0_0_1 + 0.0710462136243402*G0_1_0 + 0.340160659171083*G0_1_1;
+    A[301] = 0.198068231922401*G0_0_0 - 0.0710462136243403*G0_0_1 - 0.0710462136243326*G0_1_0;
+    A[302] = 0.111951609347443*G0_0_0 - 0.0301408179012331*G0_0_1 - 0.0301408179012373*G0_1_0;
+    A[303] = 0.0710462136243367*G0_0_0 - 0.0301408179012349*G0_0_1 - 0.0301408179012371*G0_1_0;
+    A[304] = -0.0710462136243386*G0_0_1 - 0.07104621362434*G0_1_0;
+    A[305] = -0.938671186067012*G0_0_0 - 0.669556740520273*G0_0_1 - 0.269114445546732*G0_1_0 - 0.340160659171063*G0_1_1;
+    A[306] = 1.96345899470897*G0_0_0 + 1.37786596119927*G0_0_1 + 0.663097993827144*G0_1_0 + 0.895612874779517*G0_1_1;
+    A[307] = -2.56842826829803*G0_0_0 - 2.1916680445326*G0_0_1 - 0.865472056878279*G0_1_0 - 1.39508928571426*G0_1_1;
+    A[308] = 1.98929398148146*G0_0_0 + 1.28098476080244*G0_0_1 + 1.28098476080244*G0_1_0 + 2.56196952160491*G0_1_1;
+    A[309] = -0.465029761904771*G0_0_0 + 0.262655698853608*G0_0_1 + 0.262655698853602*G0_1_0 - 1.43186244111471e-14*G0_1_1;
+    A[310] = 0.049517057980618*G0_0_0 - 0.57267554012343*G0_0_1 - 0.57267554012344*G0_1_0 + 3.21598216806995e-14*G0_1_1;
+    A[311] = 0.503782242063467*G0_0_0 + 1.66205081569662*G0_0_1 + 1.66205081569663*G0_1_0 - 3.60780199118449e-14*G0_1_1;
+    A[312] = -0.273420276675488*G0_0_0 + 0.0731991291887093*G0_0_1 + 0.0731991291887106*G0_1_0;
+    A[313] = 0.210985725308648*G0_0_0 - 0.572675540123456*G0_0_1 - 0.572675540123449*G0_1_0;
+    A[314] = -0.142092427248675*G0_0_0 + 0.262655698853616*G0_0_1 + 0.262655698853619*G0_1_0;
+    A[315] = -0.215291556437394*G0_0_0 - 0.215291556437395*G0_0_1 - 0.215291556437393*G0_1_0 - 0.215291556437391*G0_1_1;
+    A[316] = 0.107645778218698*G0_0_0;
+    A[317] = 0.107645778218697*G0_1_1;
+    A[318] = -0.667403824955893*G0_0_0 - 0.262655698853598*G0_0_1 - 0.2626556988536*G0_1_0 + 1.78663507599541e-14*G0_1_1;
+    A[319] = -0.344466490299814*G0_0_0 - 0.447806437389764*G0_0_1 - 0.447806437389765*G0_1_0 - 0.516699735449737*G0_1_1;
+    A[320] = -0.516699735449715*G0_0_0 - 0.447806437389749*G0_0_1 - 0.447806437389762*G0_1_0 - 0.344466490299805*G0_1_1;
+    A[321] = -0.262655698853612*G0_0_1 - 0.262655698853614*G0_1_0 - 0.66740382495591*G0_1_1;
+    A[322] = -2.8203193893298*G0_0_0 - 1.15826857363315*G0_0_1 - 1.15826857363314*G0_1_0 + 0.503782242063493*G0_1_1;
+    A[323] = 0.731991291887109*G0_0_0 + 2.04096395502644*G0_0_1 + 2.04096395502644*G0_1_0 - 0.611428020282188*G0_1_1;
+    A[324] = -0.516699735449723*G0_0_0 - 0.930059523809514*G0_0_1 - 0.930059523809521*G0_1_0 + 0.680321318342154*G0_1_1;
+    A[325] = 0.262655698853611*G0_0_1 + 0.262655698853614*G0_1_0 - 0.465029761904765*G0_1_1;
     A[326] = 0.503782242063506*G0_0_0 - 1.15826857363314*G0_0_1 - 1.15826857363314*G0_1_0 - 2.82031938932979*G0_1_1;
     A[327] = -0.611428020282207*G0_0_0 + 2.04096395502643*G0_0_1 + 2.04096395502644*G0_1_0 + 0.731991291887102*G0_1_1;
-    A[328] = 0.68032131834217*G0_0_0 - 0.930059523809505*G0_0_1 - 0.930059523809508*G0_1_0 - 0.516699735449723*G0_1_1;
-    A[329] = -0.46502976190477*G0_0_0 + 0.262655698853601*G0_0_1 + 0.262655698853606*G0_1_0 - 1.57963919722448e-14*G0_1_1;
-    A[330] = 7.06156305114636*G0_0_0 + 3.10019841269838*G0_0_1 + 3.10019841269838*G0_1_0 + 7.06156305114635*G0_1_1;
-    A[331] = -6.32957175925922*G0_0_0 - 3.05714010141089*G0_0_1 - 3.0571401014109*G0_1_0 - 1.80844907407403*G0_1_1;
+    A[328] = 0.68032131834217*G0_0_0 - 0.930059523809504*G0_0_1 - 0.93005952380951*G0_1_0 - 0.516699735449723*G0_1_1;
+    A[329] = -0.465029761904771*G0_0_0 + 0.262655698853602*G0_0_1 + 0.262655698853608*G0_1_0 - 1.43177570494091e-14*G0_1_1;
+    A[330] = 7.06156305114635*G0_0_0 + 3.10019841269838*G0_0_1 + 3.10019841269838*G0_1_0 + 7.06156305114635*G0_1_1;
+    A[331] = -6.32957175925922*G0_0_0 - 3.0571401014109*G0_0_1 - 3.0571401014109*G0_1_0 - 1.80844907407403*G0_1_1;
     A[332] = 2.75573192239855*G0_0_0 + 1.37786596119926*G0_0_1 + 1.37786596119927*G0_1_0 + 1.03339947089946*G0_1_1;
     A[333] = -1.80844907407404*G0_0_0 - 3.0571401014109*G0_0_1 - 3.0571401014109*G0_1_0 - 6.32957175925923*G0_1_1;
-    A[334] = 1.42092427248675*G0_0_0 + 1.46398258377421*G0_0_1 + 1.46398258377423*G0_1_0 + 1.42092427248673*G0_1_1;
-    A[335] = 1.03339947089943*G0_0_0 + 1.37786596119927*G0_0_1 + 1.37786596119928*G0_1_0 + 2.75573192239857*G0_1_1;
-    A[336] = -0.0538228891093415*G0_0_0 - 0.0538228891093418*G0_0_1 - 0.0538228891093432*G0_1_0 - 0.0538228891093423*G0_1_1;
-    A[337] = -0.0538228891093524*G0_0_0 - 1.02101486987305e-14*G0_1_0;
+    A[334] = 1.42092427248674*G0_0_0 + 1.46398258377422*G0_0_1 + 1.46398258377422*G0_1_0 + 1.42092427248674*G0_1_1;
+    A[335] = 1.03339947089944*G0_0_0 + 1.37786596119927*G0_0_1 + 1.37786596119928*G0_1_0 + 2.75573192239857*G0_1_1;
+    A[336] = -0.0538228891093423*G0_0_0 - 0.0538228891093422*G0_0_1 - 0.0538228891093427*G0_1_0 - 0.0538228891093419*G0_1_1;
+    A[337] = -0.0538228891093521*G0_0_0 - 1.07498103300852e-14*G0_1_0;
     A[338] = 0.107645778218696*G0_1_1;
-    A[339] = 1.35633680555553*G0_0_0 + 0.572675540123436*G0_0_1 + 0.572675540123428*G0_1_0 - 3.08377455515707e-14*G0_1_1;
-    A[340] = 0.387524801587288*G0_0_0 + 0.859013310185163*G0_0_1 + 0.859013310185171*G0_1_0 + 1.01187031525572*G0_1_1;
-    A[341] = 0.043058311287465*G0_0_0 + 0.374607308201046*G0_0_1 + 0.37460730820105*G0_1_0 + 1.03339947089945*G0_1_1;
-    A[342] = -0.0731991291887131*G0_0_1 - 0.0731991291887071*G0_1_0 - 0.419818535052907*G0_1_1;
-    A[343] = 1.35633680555555*G0_0_0 + 0.783661265432091*G0_0_1 + 0.783661265432091*G0_1_0 + 0.210985725308632*G0_1_1;
-    A[344] = 0.387524801587303*G0_0_0 - 0.471488508597881*G0_0_1 - 0.471488508597877*G0_1_0 - 0.318631503527328*G0_1_1;
-    A[345] = 0.043058311287474*G0_0_0 - 0.33154899691358*G0_0_1 - 0.331548996913582*G0_1_0 + 0.32724316578483*G0_1_1;
-    A[346] = 0.073199129188712*G0_0_1 + 0.0731991291887078*G0_1_0 - 0.273420276675486*G0_1_1;
-    A[347] = 0.0495170579805767*G0_0_0 + 0.62219259810404*G0_0_1 + 0.622192598104035*G0_1_0 + 1.19486813822749*G0_1_1;
-    A[348] = 0.00430583112878261*G0_0_0 - 2.40911251653435*G0_0_1 - 2.40911251653435*G0_1_0 - 3.81066054894176*G0_1_1;
-    A[349] = 0.00430583112871343*G0_0_0 + 2.4134183476631*G0_0_1 + 2.4134183476631*G0_1_0 + 1.01187031525569*G0_1_1;
-    A[350] = 0.0495170579806184*G0_0_0 - 0.572675540123438*G0_0_1 - 0.57267554012343*G0_1_0 + 3.02584563308117e-14*G0_1_1;
+    A[339] = 1.35633680555553*G0_0_0 + 0.572675540123437*G0_0_1 + 0.572675540123428*G0_1_0 - 3.28695404228085e-14*G0_1_1;
+    A[340] = 0.387524801587286*G0_0_0 + 0.859013310185163*G0_0_1 + 0.859013310185169*G0_1_0 + 1.01187031525572*G0_1_1;
+    A[341] = 0.0430583112874692*G0_0_0 + 0.374607308201046*G0_0_1 + 0.374607308201052*G0_1_0 + 1.03339947089945*G0_1_1;
+    A[342] = -0.0731991291887117*G0_0_1 - 0.0731991291887087*G0_1_0 - 0.419818535052907*G0_1_1;
+    A[343] = 1.35633680555555*G0_0_0 + 0.783661265432091*G0_0_1 + 0.78366126543209*G0_1_0 + 0.210985725308632*G0_1_1;
+    A[344] = 0.387524801587303*G0_0_0 - 0.471488508597883*G0_0_1 - 0.471488508597876*G0_1_0 - 0.318631503527328*G0_1_1;
+    A[345] = 0.0430583112874743*G0_0_0 - 0.331548996913578*G0_0_1 - 0.331548996913583*G0_1_0 + 0.32724316578483*G0_1_1;
+    A[346] = 0.0731991291887117*G0_0_1 + 0.0731991291887095*G0_1_0 - 0.273420276675485*G0_1_1;
+    A[347] = 0.049517057980578*G0_0_0 + 0.622192598104038*G0_0_1 + 0.622192598104034*G0_1_0 + 1.19486813822749*G0_1_1;
+    A[348] = 0.00430583112878251*G0_0_0 - 2.40911251653435*G0_0_1 - 2.40911251653435*G0_1_0 - 3.81066054894176*G0_1_1;
+    A[349] = 0.00430583112871425*G0_0_0 + 2.4134183476631*G0_0_1 + 2.4134183476631*G0_1_0 + 1.01187031525569*G0_1_1;
+    A[350] = 0.049517057980618*G0_0_0 - 0.57267554012344*G0_0_1 - 0.57267554012343*G0_1_0 + 3.21593879998305e-14*G0_1_1;
     A[351] = -6.32957175925922*G0_0_0 - 3.0571401014109*G0_0_1 - 3.05714010141089*G0_1_0 - 1.80844907407403*G0_1_1;
     A[352] = 9.94646990740733*G0_0_0 + 4.97323495370363*G0_0_1 + 4.97323495370363*G0_1_0 + 8.65472056878301*G0_1_1;
-    A[353] = -6.32957175925919*G0_0_0 - 3.27243165784826*G0_0_1 - 3.27243165784826*G0_1_0 - 2.0237406305114*G0_1_1;
-    A[354] = -0.387524801587315*G0_0_0 + 2.55120494378304*G0_0_1 + 2.55120494378305*G0_1_0 - 0.387524801587334*G0_1_1;
-    A[355] = -0.387524801587272*G0_0_0 - 2.93872974537033*G0_0_1 - 2.93872974537034*G0_1_0 - 5.87745949074071*G0_1_1;
-    A[356] = -0.0861166225749395*G0_0_0 - 0.043058311287471*G0_0_1 - 0.0430583112874693*G0_1_0 + 1.42092427248678*G0_1_1;
-    A[357] = 0.10764577821869*G0_0_0 + 0.107645778218692*G0_0_1 + 0.107645778218691*G0_1_0 + 0.107645778218691*G0_1_1;
-    A[358] = -0.215291556437381*G0_0_0 + 1.1128576359043e-14*G0_1_0;
-    A[359] = 0.107645778218696*G0_1_1;
-    A[360] = -2.82031938932977*G0_0_0 - 1.66205081569662*G0_0_1 - 1.66205081569661*G0_1_0 + 3.90404939279443e-14*G0_1_1;
-    A[361] = 0.731991291887125*G0_0_0 - 1.30897266313931*G0_0_1 - 1.30897266313932*G0_1_0 - 3.96136463844796*G0_1_1;
-    A[362] = -0.516699735449728*G0_0_0 + 0.41335978835979*G0_0_1 + 0.413359788359802*G0_1_0 + 2.02374063051148*G0_1_1;
-    A[363] = -0.262655698853614*G0_0_1 - 0.262655698853615*G0_1_0 - 0.990341159611994*G0_1_1;
-    A[364] = -0.667403824955899*G0_0_0 - 0.404748126102291*G0_0_1 - 0.404748126102296*G0_1_0 - 0.142092427248677*G0_1_1;
-    A[365] = -0.344466490299826*G0_0_0 + 0.103339947089943*G0_0_1 + 0.103339947089948*G0_1_0 + 0.0344466490299849*G0_1_1;
-    A[366] = -0.516699735449731*G0_0_0 - 0.0688932980599625*G0_0_1 - 0.0688932980599598*G0_1_0 + 0.0344466490299801*G0_1_1;
-    A[367] = 0.262655698853614*G0_0_1 + 0.262655698853615*G0_1_0 - 0.142092427248677*G0_1_1;
-    A[368] = -0.46502976190474*G0_0_0 - 0.727685460758355*G0_0_1 - 0.727685460758358*G0_1_0 - 0.990341159611981*G0_1_1;
-    A[369] = 0.680321318342116*G0_0_0 + 1.61038084215164*G0_0_1 + 1.61038084215164*G0_1_0 + 2.02374063051142*G0_1_1;
-    A[370] = -0.611428020282149*G0_0_0 - 2.6523919753086*G0_0_1 - 2.6523919753086*G0_1_0 - 3.96136463844793*G0_1_1;
-    A[371] = 0.503782242063466*G0_0_0 + 1.66205081569662*G0_0_1 + 1.66205081569662*G0_1_0 - 3.38911841299416e-14*G0_1_1;
+    A[353] = -6.32957175925919*G0_0_0 - 3.27243165784826*G0_0_1 - 3.27243165784825*G0_1_0 - 2.0237406305114*G0_1_1;
+    A[354] = -0.387524801587313*G0_0_0 + 2.55120494378305*G0_0_1 + 2.55120494378305*G0_1_0 - 0.38752480158733*G0_1_1;
+    A[355] = -0.387524801587272*G0_0_0 - 2.93872974537034*G0_0_1 - 2.93872974537034*G0_1_0 - 5.87745949074071*G0_1_1;
+    A[356] = -0.0861166225749442*G0_0_0 - 0.0430583112874711*G0_0_1 - 0.0430583112874703*G0_1_0 + 1.42092427248678*G0_1_1;
+    A[357] = 0.107645778218691*G0_0_0 + 0.107645778218693*G0_0_1 + 0.10764577821869*G0_1_0 + 0.10764577821869*G0_1_1;
+    A[358] = -0.215291556437382*G0_0_0 + 1.21370470097804e-14*G0_1_0;
+    A[359] = 0.107645778218697*G0_1_1;
+    A[360] = -2.82031938932977*G0_0_0 - 1.66205081569662*G0_0_1 - 1.66205081569661*G0_1_0 + 4.29197693010974e-14*G0_1_1;
+    A[361] = 0.731991291887125*G0_0_0 - 1.30897266313932*G0_0_1 - 1.30897266313932*G0_1_0 - 3.96136463844796*G0_1_1;
+    A[362] = -0.516699735449729*G0_0_0 + 0.413359788359791*G0_0_1 + 0.413359788359802*G0_1_0 + 2.02374063051148*G0_1_1;
+    A[363] = -0.262655698853615*G0_0_1 - 0.262655698853613*G0_1_0 - 0.990341159611995*G0_1_1;
+    A[364] = -0.667403824955899*G0_0_0 - 0.404748126102292*G0_0_1 - 0.404748126102295*G0_1_0 - 0.142092427248674*G0_1_1;
+    A[365] = -0.344466490299825*G0_0_0 + 0.103339947089946*G0_0_1 + 0.103339947089949*G0_1_0 + 0.0344466490299823*G0_1_1;
+    A[366] = -0.516699735449731*G0_0_0 - 0.0688932980599644*G0_0_1 - 0.068893298059959*G0_1_0 + 0.0344466490299808*G0_1_1;
+    A[367] = 0.262655698853614*G0_0_1 + 0.262655698853613*G0_1_0 - 0.142092427248678*G0_1_1;
+    A[368] = -0.465029761904741*G0_0_0 - 0.727685460758354*G0_0_1 - 0.727685460758357*G0_1_0 - 0.990341159611978*G0_1_1;
+    A[369] = 0.680321318342116*G0_0_0 + 1.61038084215164*G0_0_1 + 1.61038084215164*G0_1_0 + 2.02374063051141*G0_1_1;
+    A[370] = -0.611428020282149*G0_0_0 - 2.6523919753086*G0_0_1 - 2.6523919753086*G0_1_0 - 3.96136463844792*G0_1_1;
+    A[371] = 0.503782242063467*G0_0_0 + 1.66205081569663*G0_0_1 + 1.66205081569662*G0_1_0 - 3.60780199118449e-14*G0_1_1;
     A[372] = 2.75573192239856*G0_0_0 + 1.37786596119927*G0_0_1 + 1.37786596119926*G0_1_0 + 1.03339947089946*G0_1_1;
-    A[373] = -6.32957175925919*G0_0_0 - 3.27243165784826*G0_0_1 - 3.27243165784826*G0_1_0 - 2.0237406305114*G0_1_1;
+    A[373] = -6.32957175925919*G0_0_0 - 3.27243165784825*G0_0_1 - 3.27243165784826*G0_1_0 - 2.0237406305114*G0_1_1;
     A[374] = 7.06156305114631*G0_0_0 + 3.9613646384479*G0_0_1 + 3.9613646384479*G0_1_0 + 7.92272927689587*G0_1_1;
-    A[375] = 1.42092427248678*G0_0_0 - 0.0430583112874671*G0_0_1 - 0.0430583112874752*G0_1_0 - 0.0861166225749504*G0_1_1;
-    A[376] = -1.80844907407408*G0_0_0 + 1.24869102733684*G0_0_1 + 1.24869102733685*G0_1_0 - 2.02374063051147*G0_1_1;
-    A[377] = 1.03339947089946*G0_0_0 - 0.344466490299826*G0_0_1 - 0.344466490299842*G0_1_0 + 1.03339947089946*G0_1_1;
-    A[378] = -0.0538228891093438*G0_0_0 - 0.0538228891093442*G0_0_1 - 0.0538228891093471*G0_1_0 - 0.053822889109348*G0_1_1;
-    A[379] = 0.107645778218694*G0_0_0;
-    A[380] = -0.0538228891093475*G0_1_1;
-    A[381] = -0.419818535052917*G0_0_0 - 0.0731991291887196*G0_0_1 - 0.0731991291887169*G0_1_0;
-    A[382] = 1.03339947089947*G0_0_0 + 0.374607308201062*G0_0_1 + 0.374607308201053*G0_1_0 + 0.0430583112874823*G0_1_1;
-    A[383] = 1.0118703152557*G0_0_0 + 0.859013310185149*G0_0_1 + 0.859013310185161*G0_1_0 + 0.387524801587276*G0_1_1;
-    A[384] = 1.10189635194047e-14*G0_0_0 + 0.572675540123457*G0_0_1 + 0.572675540123454*G0_1_0 + 1.35633680555555*G0_1_1;
-    A[385] = 1.1948681382275*G0_0_0 + 0.622192598104041*G0_0_1 + 0.622192598104038*G0_1_0 + 0.0495170579805949*G0_1_1;
-    A[386] = -3.81066054894178*G0_0_0 - 2.40911251653437*G0_0_1 - 2.40911251653437*G0_1_0 + 0.00430583112875424*G0_1_1;
-    A[387] = 1.01187031525572*G0_0_0 + 2.41341834766312*G0_0_1 + 2.41341834766312*G0_1_0 + 0.00430583112874239*G0_1_1;
-    A[388] = -1.07414077632484e-14*G0_0_0 - 0.572675540123454*G0_0_1 - 0.572675540123454*G0_1_0 + 0.049517057980602*G0_1_1;
-    A[389] = 0.210985725308633*G0_0_0 + 0.78366126543209*G0_0_1 + 0.783661265432095*G0_1_0 + 1.35633680555554*G0_1_1;
-    A[390] = -0.31863150352733*G0_0_0 - 0.471488508597877*G0_0_1 - 0.471488508597881*G0_1_0 + 0.387524801587314*G0_1_1;
-    A[391] = 0.32724316578483*G0_0_0 - 0.331548996913577*G0_0_1 - 0.33154899691358*G0_1_0 + 0.0430583112874745*G0_1_1;
-    A[392] = -0.273420276675486*G0_0_0 + 0.0731991291887157*G0_0_1 + 0.0731991291887122*G0_1_0;
+    A[375] = 1.42092427248677*G0_0_0 - 0.0430583112874735*G0_0_1 - 0.0430583112874738*G0_1_0 - 0.0861166225749466*G0_1_1;
+    A[376] = -1.80844907407408*G0_0_0 + 1.24869102733685*G0_0_1 + 1.24869102733685*G0_1_0 - 2.02374063051147*G0_1_1;
+    A[377] = 1.03339947089946*G0_0_0 - 0.344466490299825*G0_0_1 - 0.344466490299842*G0_1_0 + 1.03339947089946*G0_1_1;
+    A[378] = -0.0538228891093435*G0_0_0 - 0.0538228891093444*G0_0_1 - 0.0538228891093459*G0_1_0 - 0.053822889109347*G0_1_1;
+    A[379] = 0.107645778218696*G0_0_0;
+    A[380] = -0.0538228891093493*G0_1_1;
+    A[381] = -0.419818535052913*G0_0_0 - 0.0731991291887135*G0_0_1 - 0.0731991291887139*G0_1_0;
+    A[382] = 1.03339947089946*G0_0_0 + 0.374607308201056*G0_0_1 + 0.37460730820105*G0_1_0 + 0.0430583112874761*G0_1_1;
+    A[383] = 1.0118703152557*G0_0_0 + 0.859013310185156*G0_0_1 + 0.859013310185166*G0_1_0 + 0.387524801587282*G0_1_1;
+    A[384] = 0.572675540123451*G0_0_1 + 0.572675540123449*G0_1_0 + 1.35633680555555*G0_1_1;
+    A[385] = 1.1948681382275*G0_0_0 + 0.622192598104042*G0_0_1 + 0.62219259810404*G0_1_0 + 0.0495170579805924*G0_1_1;
+    A[386] = -3.81066054894177*G0_0_0 - 2.40911251653437*G0_0_1 - 2.40911251653437*G0_1_0 + 0.00430583112875868*G0_1_1;
+    A[387] = 1.01187031525571*G0_0_0 + 2.41341834766312*G0_0_1 + 2.41341834766312*G0_1_0 + 0.00430583112873867*G0_1_1;
+    A[388] = -0.57267554012345*G0_0_1 - 0.572675540123449*G0_1_0 + 0.0495170579806051*G0_1_1;
+    A[389] = 0.210985725308634*G0_0_0 + 0.78366126543209*G0_0_1 + 0.783661265432093*G0_1_0 + 1.35633680555555*G0_1_1;
+    A[390] = -0.318631503527332*G0_0_0 - 0.471488508597879*G0_0_1 - 0.471488508597882*G0_1_0 + 0.387524801587311*G0_1_1;
+    A[391] = 0.327243165784832*G0_0_0 - 0.331548996913577*G0_0_1 - 0.331548996913577*G0_1_0 + 0.043058311287478*G0_1_1;
+    A[392] = -0.273420276675488*G0_0_0 + 0.0731991291887106*G0_0_1 + 0.0731991291887093*G0_1_0;
     A[393] = -1.80844907407404*G0_0_0 - 3.0571401014109*G0_0_1 - 3.0571401014109*G0_1_0 - 6.32957175925923*G0_1_1;
-    A[394] = -0.387524801587316*G0_0_0 + 2.55120494378305*G0_0_1 + 2.55120494378304*G0_1_0 - 0.387524801587334*G0_1_1;
-    A[395] = 1.42092427248678*G0_0_0 - 0.0430583112874752*G0_0_1 - 0.0430583112874671*G0_1_0 - 0.0861166225749505*G0_1_1;
-    A[396] = 8.65472056878302*G0_0_0 + 4.97323495370366*G0_0_1 + 4.97323495370366*G0_1_0 + 9.94646990740737*G0_1_1;
-    A[397] = -5.87745949074071*G0_0_0 - 2.93872974537033*G0_0_1 - 2.93872974537034*G0_1_0 - 0.387524801587262*G0_1_1;
+    A[394] = -0.387524801587313*G0_0_0 + 2.55120494378305*G0_0_1 + 2.55120494378305*G0_1_0 - 0.38752480158733*G0_1_1;
+    A[395] = 1.42092427248677*G0_0_0 - 0.043058311287474*G0_0_1 - 0.0430583112874735*G0_1_0 - 0.0861166225749467*G0_1_1;
+    A[396] = 8.65472056878301*G0_0_0 + 4.97323495370365*G0_0_1 + 4.97323495370365*G0_1_0 + 9.94646990740736*G0_1_1;
+    A[397] = -5.8774594907407*G0_0_0 - 2.93872974537033*G0_0_1 - 2.93872974537033*G0_1_0 - 0.38752480158727*G0_1_1;
     A[398] = -2.02374063051141*G0_0_0 - 3.27243165784829*G0_0_1 - 3.27243165784828*G0_1_0 - 6.32957175925922*G0_1_1;
-    A[399] = 0.107645778218693*G0_0_0 + 0.107645778218693*G0_0_1 + 0.107645778218696*G0_1_0 + 0.107645778218696*G0_1_1;
-    A[400] = -0.0538228891093474*G0_0_0;
-    A[401] = -0.053822889109352*G0_1_1;
-    A[402] = 1.19486813822751*G0_0_0 + 0.572675540123455*G0_0_1 + 0.572675540123454*G0_1_0;
-    A[403] = -3.81066054894177*G0_0_0 - 1.4015480324074*G0_0_1 - 1.4015480324074*G0_1_0 + 1.01187031525573*G0_1_1;
-    A[404] = 1.01187031525575*G0_0_0 - 1.40154803240738*G0_0_1 - 1.40154803240739*G0_1_0 - 3.81066054894177*G0_1_1;
-    A[405] = -1.12271303365219e-14*G0_0_0 + 0.57267554012345*G0_0_1 + 0.572675540123437*G0_1_0 + 1.1948681382275*G0_1_1;
-    A[406] = -0.419818535052909*G0_0_0 - 0.346619405864191*G0_0_1 - 0.346619405864177*G0_1_0 - 0.273420276675479*G0_1_1;
-    A[407] = 1.03339947089947*G0_0_0 + 0.658792162698408*G0_0_1 + 0.658792162698402*G0_1_0 + 0.327243165784822*G0_1_1;
-    A[408] = 1.01187031525573*G0_0_0 + 0.152857005070544*G0_0_1 + 0.152857005070553*G0_1_0 - 0.318631503527333*G0_1_1;
-    A[409] = -0.57267554012345*G0_0_1 - 0.572675540123438*G0_1_0 + 0.210985725308645*G0_1_1;
-    A[410] = -0.27342027667548*G0_0_0 - 0.346619405864192*G0_0_1 - 0.34661940586419*G0_1_0 - 0.419818535052888*G0_1_1;
-    A[411] = 0.327243165784825*G0_0_0 + 0.658792162698402*G0_0_1 + 0.658792162698403*G0_1_0 + 1.03339947089946*G0_1_1;
-    A[412] = -0.318631503527336*G0_0_0 + 0.152857005070542*G0_0_1 + 0.152857005070552*G0_1_0 + 1.01187031525574*G0_1_1;
-    A[413] = 0.210985725308647*G0_0_0 - 0.572675540123454*G0_0_1 - 0.572675540123459*G0_1_0;
-    A[414] = 1.42092427248675*G0_0_0 + 1.46398258377423*G0_0_1 + 1.46398258377421*G0_1_0 + 1.42092427248673*G0_1_1;
-    A[415] = -0.387524801587273*G0_0_0 - 2.93872974537034*G0_0_1 - 2.93872974537033*G0_1_0 - 5.87745949074071*G0_1_1;
-    A[416] = -1.80844907407408*G0_0_0 + 1.24869102733685*G0_0_1 + 1.24869102733684*G0_1_0 - 2.02374063051147*G0_1_1;
-    A[417] = -5.87745949074071*G0_0_0 - 2.93872974537034*G0_0_1 - 2.93872974537033*G0_1_0 - 0.387524801587262*G0_1_1;
-    A[418] = 8.65472056878302*G0_0_0 + 3.68148561507933*G0_0_1 + 3.68148561507933*G0_1_0 + 8.65472056878301*G0_1_1;
-    A[419] = -2.02374063051147*G0_0_0 + 1.24869102733685*G0_0_1 + 1.24869102733684*G0_1_0 - 1.80844907407408*G0_1_1;
-    A[420] = 0.10764577821869*G0_0_0 + 0.107645778218691*G0_0_1 + 0.107645778218692*G0_1_0 + 0.107645778218693*G0_1_1;
-    A[421] = 0.107645778218693*G0_0_0;
-    A[422] = -0.215291556437386*G0_1_1;
-    A[423] = -0.990341159611982*G0_0_0 - 0.262655698853614*G0_0_1 - 0.262655698853613*G0_1_0;
-    A[424] = 2.02374063051145*G0_0_0 + 0.413359788359793*G0_0_1 + 0.413359788359788*G0_1_0 - 0.516699735449735*G0_1_1;
-    A[425] = -3.96136463844793*G0_0_0 - 1.30897266313931*G0_0_1 - 1.30897266313931*G0_1_0 + 0.731991291887139*G0_1_1;
-    A[426] = -1.66205081569664*G0_0_1 - 1.66205081569664*G0_1_0 - 2.82031938932979*G0_1_1;
-    A[427] = -0.990341159611971*G0_0_0 - 0.727685460758356*G0_0_1 - 0.727685460758366*G0_1_0 - 0.465029761904753*G0_1_1;
-    A[428] = 2.02374063051143*G0_0_0 + 1.61038084215164*G0_0_1 + 1.61038084215166*G0_1_0 + 0.68032131834214*G0_1_1;
-    A[429] = -3.96136463844792*G0_0_0 - 2.65239197530861*G0_0_1 - 2.65239197530862*G0_1_0 - 0.611428020282181*G0_1_1;
-    A[430] = 1.66205081569664*G0_0_1 + 1.66205081569664*G0_1_0 + 0.503782242063489*G0_1_1;
-    A[431] = -0.142092427248668*G0_0_0 - 0.404748126102289*G0_0_1 - 0.404748126102288*G0_1_0 - 0.667403824955905*G0_1_1;
-    A[432] = 0.0344466490299796*G0_0_0 + 0.103339947089942*G0_0_1 + 0.103339947089945*G0_1_0 - 0.344466490299829*G0_1_1;
-    A[433] = 0.0344466490299815*G0_0_0 - 0.0688932980599611*G0_0_1 - 0.0688932980599652*G0_1_0 - 0.516699735449733*G0_1_1;
-    A[434] = -0.142092427248676*G0_0_0 + 0.262655698853617*G0_0_1 + 0.262655698853616*G0_1_0;
-    A[435] = 1.03339947089943*G0_0_0 + 1.37786596119928*G0_0_1 + 1.37786596119927*G0_1_0 + 2.75573192239857*G0_1_1;
-    A[436] = -0.0861166225749396*G0_0_0 - 0.0430583112874694*G0_0_1 - 0.0430583112874709*G0_1_0 + 1.42092427248678*G0_1_1;
-    A[437] = 1.03339947089946*G0_0_0 - 0.344466490299842*G0_0_1 - 0.344466490299826*G0_1_0 + 1.03339947089946*G0_1_1;
+    A[399] = 0.107645778218694*G0_0_0 + 0.107645778218693*G0_0_1 + 0.107645778218695*G0_1_0 + 0.107645778218696*G0_1_1;
+    A[400] = -0.0538228891093484*G0_0_0;
+    A[401] = -0.0538228891093528*G0_1_1;
+    A[402] = 1.19486813822751*G0_0_0 + 0.57267554012345*G0_0_1 + 0.572675540123449*G0_1_0;
+    A[403] = -3.81066054894177*G0_0_0 - 1.40154803240739*G0_0_1 - 1.4015480324074*G0_1_0 + 1.01187031525573*G0_1_1;
+    A[404] = 1.01187031525574*G0_0_0 - 1.40154803240738*G0_0_1 - 1.4015480324074*G0_1_0 - 3.81066054894178*G0_1_1;
+    A[405] = 0.572675540123454*G0_0_1 + 0.572675540123438*G0_1_0 + 1.1948681382275*G0_1_1;
+    A[406] = -0.419818535052908*G0_0_0 - 0.346619405864191*G0_0_1 - 0.346619405864178*G0_1_0 - 0.273420276675479*G0_1_1;
+    A[407] = 1.03339947089947*G0_0_0 + 0.658792162698405*G0_0_1 + 0.658792162698401*G0_1_0 + 0.327243165784824*G0_1_1;
+    A[408] = 1.01187031525573*G0_0_0 + 0.152857005070546*G0_0_1 + 0.15285700507055*G0_1_0 - 0.318631503527336*G0_1_1;
+    A[409] = -0.572675540123452*G0_0_1 - 0.572675540123439*G0_1_0 + 0.210985725308647*G0_1_1;
+    A[410] = -0.273420276675481*G0_0_0 - 0.346619405864191*G0_0_1 - 0.346619405864189*G0_1_0 - 0.419818535052891*G0_1_1;
+    A[411] = 0.327243165784827*G0_0_0 + 0.658792162698402*G0_0_1 + 0.658792162698404*G0_1_0 + 1.03339947089947*G0_1_1;
+    A[412] = -0.318631503527337*G0_0_0 + 0.152857005070543*G0_0_1 + 0.152857005070549*G0_1_0 + 1.01187031525574*G0_1_1;
+    A[413] = 0.210985725308648*G0_0_0 - 0.572675540123449*G0_0_1 - 0.572675540123456*G0_1_0;
+    A[414] = 1.42092427248674*G0_0_0 + 1.46398258377422*G0_0_1 + 1.46398258377422*G0_1_0 + 1.42092427248674*G0_1_1;
+    A[415] = -0.387524801587272*G0_0_0 - 2.93872974537034*G0_0_1 - 2.93872974537034*G0_1_0 - 5.87745949074071*G0_1_1;
+    A[416] = -1.80844907407408*G0_0_0 + 1.24869102733685*G0_0_1 + 1.24869102733685*G0_1_0 - 2.02374063051147*G0_1_1;
+    A[417] = -5.8774594907407*G0_0_0 - 2.93872974537033*G0_0_1 - 2.93872974537033*G0_1_0 - 0.38752480158727*G0_1_1;
+    A[418] = 8.65472056878301*G0_0_0 + 3.68148561507933*G0_0_1 + 3.68148561507933*G0_1_0 + 8.65472056878302*G0_1_1;
+    A[419] = -2.02374063051147*G0_0_0 + 1.24869102733684*G0_0_1 + 1.24869102733685*G0_1_0 - 1.80844907407407*G0_1_1;
+    A[420] = 0.10764577821869*G0_0_0 + 0.10764577821869*G0_0_1 + 0.107645778218692*G0_1_0 + 0.107645778218692*G0_1_1;
+    A[421] = 0.107645778218692*G0_0_0;
+    A[422] = -0.215291556437384*G0_1_1;
+    A[423] = -0.990341159611982*G0_0_0 - 0.262655698853615*G0_0_1 - 0.262655698853614*G0_1_0;
+    A[424] = 2.02374063051145*G0_0_0 + 0.413359788359791*G0_0_1 + 0.41335978835979*G0_1_0 - 0.516699735449733*G0_1_1;
+    A[425] = -3.96136463844793*G0_0_0 - 1.30897266313931*G0_0_1 - 1.30897266313931*G0_1_0 + 0.731991291887138*G0_1_1;
+    A[426] = -1.66205081569664*G0_0_1 - 1.66205081569663*G0_1_0 - 2.82031938932979*G0_1_1;
+    A[427] = -0.990341159611971*G0_0_0 - 0.727685460758356*G0_0_1 - 0.727685460758366*G0_1_0 - 0.465029761904751*G0_1_1;
+    A[428] = 2.02374063051143*G0_0_0 + 1.61038084215164*G0_0_1 + 1.61038084215165*G0_1_0 + 0.680321318342135*G0_1_1;
+    A[429] = -3.96136463844793*G0_0_0 - 2.65239197530861*G0_0_1 - 2.65239197530862*G0_1_0 - 0.611428020282176*G0_1_1;
+    A[430] = 1.66205081569664*G0_0_1 + 1.66205081569663*G0_1_0 + 0.503782242063485*G0_1_1;
+    A[431] = -0.142092427248668*G0_0_0 - 0.40474812610229*G0_0_1 - 0.404748126102287*G0_1_0 - 0.667403824955905*G0_1_1;
+    A[432] = 0.0344466490299792*G0_0_0 + 0.103339947089942*G0_0_1 + 0.103339947089946*G0_1_0 - 0.344466490299829*G0_1_1;
+    A[433] = 0.034446649029982*G0_0_0 - 0.0688932980599619*G0_0_1 - 0.0688932980599655*G0_1_0 - 0.516699735449734*G0_1_1;
+    A[434] = -0.142092427248675*G0_0_0 + 0.262655698853619*G0_0_1 + 0.262655698853616*G0_1_0;
+    A[435] = 1.03339947089944*G0_0_0 + 1.37786596119928*G0_0_1 + 1.37786596119927*G0_1_0 + 2.75573192239857*G0_1_1;
+    A[436] = -0.0861166225749441*G0_0_0 - 0.0430583112874703*G0_0_1 - 0.0430583112874711*G0_1_0 + 1.42092427248678*G0_1_1;
+    A[437] = 1.03339947089946*G0_0_0 - 0.344466490299842*G0_0_1 - 0.344466490299825*G0_1_0 + 1.03339947089946*G0_1_1;
     A[438] = -2.02374063051141*G0_0_0 - 3.27243165784828*G0_0_1 - 3.27243165784829*G0_1_0 - 6.32957175925922*G0_1_1;
-    A[439] = -2.02374063051147*G0_0_0 + 1.24869102733684*G0_0_1 + 1.24869102733685*G0_1_0 - 1.80844907407408*G0_1_1;
-    A[440] = 7.92272927689585*G0_0_0 + 3.96136463844792*G0_0_1 + 3.96136463844792*G0_1_0 + 7.06156305114633*G0_1_1;
+    A[439] = -2.02374063051147*G0_0_0 + 1.24869102733685*G0_0_1 + 1.24869102733684*G0_1_0 - 1.80844907407407*G0_1_1;
+    A[440] = 7.92272927689585*G0_0_0 + 3.96136463844793*G0_0_1 + 3.96136463844793*G0_1_0 + 7.06156305114632*G0_1_1;
 }
 
-/// Constructor
+
 poisson2d_5_cell_integral_1_otherwise::poisson2d_5_cell_integral_1_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson2d_5_cell_integral_1_otherwise::~poisson2d_5_cell_integral_1_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson2d_5_cell_integral_1_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson2d_5_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson2d_5_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -1360,7 +2350,7 @@ void poisson2d_5_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1417,58 +2407,65 @@ void poisson2d_5_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     A[20] = 0.00087943338811397*G0_0 + 0.000879433388113975*G0_1 + 0.000892481361231383*G0_2 - 0.00280531422024484*G0_3 + 0.00508870951579303*G0_4 - 0.00143527704291596*G0_5 + 0.0102426588971731*G0_6 - 0.00280531422024483*G0_7 + 0.00508870951579299*G0_8 - 0.00143527704291599*G0_9 + 0.0102426588971731*G0_10 + 0.000782878387045098*G0_11 + 0.00313151354818029*G0_12 + 0.00313151354818032*G0_13 + 0.000782878387045092*G0_14 + 0.0117431758056762*G0_15 + 0.00391439193522542*G0_16 + 0.01174317580 [...]
 }
 
-/// Constructor
+
 poisson2d_5_form_0::poisson2d_5_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_5_form_0::~poisson2d_5_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson2d_5_form_0::signature() const
+const char * poisson2d_5_form_0::signature() const
 {
-    return "e88c5396a60bd3055e045b314bd929cd9dc7eefa5ea101af566570317a9c3e1d569987a64a6c76a5b60e6491de0557a46720df9852e20affb824013861f47613";
+    return "1bc0138e7fa5eaefa938690a0c6b17c679fa6f1074cbd4bd4fd681067ecd02d9cd0c91bacb45d126c7920a72e5a1d2bfbf0ff52559cede2485079e696c379f69";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_5_form_0::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_5_form_0::num_coefficients() const
 {
     return 0;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_5_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_5_form_0::create_coordinate_finite_element() const
+{
+    return new poisson2d_5_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_5_form_0::create_coordinate_dofmap() const
+{
+    return new poisson2d_5_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_5_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_5_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_5_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_5_finite_element_0();
+        return new poisson2d_5_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_5_finite_element_0();
+        return new poisson2d_5_finite_element_2();
         break;
       }
     }
@@ -1476,19 +2473,18 @@ ufc::finite_element* poisson2d_5_form_0::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_5_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_5_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_5_dofmap_0();
+        return new poisson2d_5_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_5_dofmap_0();
+        return new poisson2d_5_dofmap_2();
         break;
       }
     }
@@ -1496,183 +2492,225 @@ ufc::dofmap* poisson2d_5_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_5_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_5_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_5_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_5_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_5_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_5_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_5_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_5_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_5_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_5_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_5_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_5_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_5_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_5_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_5_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_5_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_5_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_5_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_5_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_5_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_5_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_5_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_5_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_5_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_5_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_5_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_5_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_5_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_5_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_5_form_0::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_5_form_0::create_default_cell_integral() const
 {
     return new poisson2d_5_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_5_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_5_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_5_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_5_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * poisson2d_5_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_5_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * poisson2d_5_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_5_form_0::create_default_vertex_integral() const
+ufc::interface_integral * poisson2d_5_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_5_form_0::create_default_custom_integral() const
+ufc::overlap_integral * poisson2d_5_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 poisson2d_5_form_1::poisson2d_5_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson2d_5_form_1::~poisson2d_5_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson2d_5_form_1::signature() const
+const char * poisson2d_5_form_1::signature() const
 {
-    return "f3c4cfd5ce2d317cbaf2fa686e9e30381be1f50f9fdebebf1f2c812bae32d133be9a5559a587c69fbdd688c2a08a785479227343f381262b45bb639b8cb2a941";
+    return "e1b9a9ae891a7b0463aa644c4f13f4cae623032c35d10c0ba56a4e1f2880e4bfd3c5cd6996b2b4a5c0f17169305c79e0e36b85378f8ffd1d2ced662503db7bee";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson2d_5_form_1::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson2d_5_form_1::num_coefficients() const
 {
     return 1;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson2d_5_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0});
     return position[i];
 }
 
+ufc::finite_element * poisson2d_5_form_1::create_coordinate_finite_element() const
+{
+    return new poisson2d_5_finite_element_1();
+}
+
+ufc::dofmap * poisson2d_5_form_1::create_coordinate_dofmap() const
+{
+    return new poisson2d_5_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson2d_5_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson2d_5_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson2d_5_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_5_finite_element_0();
+        return new poisson2d_5_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_5_finite_element_0();
+        return new poisson2d_5_finite_element_2();
         break;
       }
     }
@@ -1680,19 +2718,18 @@ ufc::finite_element* poisson2d_5_form_1::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson2d_5_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson2d_5_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_5_dofmap_0();
+        return new poisson2d_5_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson2d_5_dofmap_0();
+        return new poisson2d_5_dofmap_2();
         break;
       }
     }
@@ -1700,128 +2737,163 @@ ufc::dofmap* poisson2d_5_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson2d_5_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson2d_5_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson2d_5_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson2d_5_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson2d_5_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson2d_5_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_5_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson2d_5_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson2d_5_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson2d_5_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson2d_5_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson2d_5_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson2d_5_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson2d_5_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_5_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson2d_5_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson2d_5_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson2d_5_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson2d_5_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson2d_5_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson2d_5_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson2d_5_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson2d_5_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson2d_5_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson2d_5_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson2d_5_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson2d_5_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson2d_5_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_5_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson2d_5_form_1::create_default_cell_integral() const
+ufc::cell_integral * poisson2d_5_form_1::create_default_cell_integral() const
 {
     return new poisson2d_5_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson2d_5_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson2d_5_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson2d_5_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson2d_5_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson2d_5_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * poisson2d_5_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson2d_5_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * poisson2d_5_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson2d_5_form_1::create_default_custom_integral() const
+ufc::interface_integral * poisson2d_5_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson2d_5_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/bench/fem/convergence/cpp/Poisson2D_5.h b/bench/fem/convergence/cpp/Poisson2D_5.h
index c8b8446..ec51428 100644
--- a/bench/fem/convergence/cpp/Poisson2D_5.h
+++ b/bench/fem/convergence/cpp/Poisson2D_5.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -15,500 +15,735 @@
 //   format:                         'dolfin'
 //   no-evaluate_basis:              True
 //   no-evaluate_basis_derivatives:  True
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __POISSON2D_5_H
 #define __POISSON2D_5_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson2d_5_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson2d_5_finite_element_0();
 
-  /// Destructor
-  virtual ~poisson2d_5_finite_element_0();
+  ~poisson2d_5_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t space_dimension() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson2d_5_finite_element_1: public ufc::finite_element
+{
+public:
+
+  poisson2d_5_finite_element_1();
+
+  ~poisson2d_5_finite_element_1() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson2d_5_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson2d_5_finite_element_2();
+
+  ~poisson2d_5_finite_element_2() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
+  std::size_t num_sub_elements() const final override;
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class poisson2d_5_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   poisson2d_5_dofmap_0();
 
-  /// Destructor
-  virtual ~poisson2d_5_dofmap_0();
+  ~poisson2d_5_dofmap_0() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson2d_5_dofmap_1: public ufc::dofmap
+{
+public:
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  poisson2d_5_dofmap_1();
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  ~poisson2d_5_dofmap_1() override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  const char * signature() const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson2d_5_dofmap_2: public ufc::dofmap
+{
+public:
+
+  poisson2d_5_dofmap_2();
+
+  ~poisson2d_5_dofmap_2() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
+
+  std::size_t num_facet_dofs() const final override;
+
+  std::size_t num_entity_dofs(std::size_t d) const final override;
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 poisson2d_5_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_5_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_5_cell_integral_0_otherwise();
+  ~poisson2d_5_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 poisson2d_5_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson2d_5_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~poisson2d_5_cell_integral_1_otherwise();
+  ~poisson2d_5_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_5_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_5_form_0();
 
-  /// Destructor
-  virtual ~poisson2d_5_form_0();
+  ~poisson2d_5_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson2d_5_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson2d_5_form_1();
 
-  /// Destructor
-  virtual ~poisson2d_5_form_1();
+  ~poisson2d_5_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -518,14 +753,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson2D_5
 {
@@ -534,43 +775,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_5_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_5_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_5_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_5_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -581,43 +799,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_5_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_5_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_5_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_5_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -628,63 +823,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_5_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_5_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_5_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_5_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_5_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -692,7 +894,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_5_form_0());
+    _ufc_form = std::make_shared<const poisson2d_5_form_0>();
   }
 
   // Destructor
@@ -722,57 +924,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_5_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_5_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_5_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_5_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_5_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_5_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -780,69 +1037,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_5_form_1());
+    _ufc_form = std::make_shared<const poisson2d_5_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_5_form_1());
+    _ufc_form = std::make_shared<const poisson2d_5_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_5_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_5_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_5_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->f = *f;
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_5_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -874,18 +1172,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/convergence/cpp/Poisson3D_1.cpp b/bench/fem/convergence/cpp/Poisson3D_1.cpp
index f06bfad..eac5862 100644
--- a/bench/fem/convergence/cpp/Poisson3D_1.cpp
+++ b/bench/fem/convergence/cpp/Poisson3D_1.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,81 +13,99 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "Poisson3D_1.h"
 
-/// Constructor
 poisson3d_1_finite_element_0::poisson3d_1_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_1_finite_element_0::~poisson3d_1_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* poisson3d_1_finite_element_0::signature() const
+const char * poisson3d_1_finite_element_0::signature() const
 {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
 }
 
-/// Return the cell shape
 ufc::shape poisson3d_1_finite_element_0::cell_shape() const
 {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t poisson3d_1_finite_element_0::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t poisson3d_1_finite_element_0::geometric_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t poisson3d_1_finite_element_0::space_dimension() const
 {
     return 4;
 }
 
-/// Return the rank of the value space
 std::size_t poisson3d_1_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t poisson3d_1_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
+std::size_t poisson3d_1_finite_element_0::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_1_finite_element_0::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_1_finite_element_0::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_1_finite_element_0::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_1_finite_element_0::degree() const
+{
+    return 1;
+}
+
+const char * poisson3d_1_finite_element_0::family() const
+{
+    return "Lagrange";
+}
+
 void poisson3d_1_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -96,9 +114,9 @@ void poisson3d_1_finite_element_0::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -245,10 +263,9 @@ void poisson3d_1_finite_element_0::_evaluate_basis(std::size_t i,
     
 }
 
-/// Evaluate all basis functions at given point x in cell
-void poisson3d_1_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void poisson3d_1_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
@@ -257,17 +274,16 @@ void poisson3d_1_finite_element_0::_evaluate_basis_all(double* values,
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
 void poisson3d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
     
@@ -287,7 +303,7 @@ void poisson3d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -299,7 +315,7 @@ void poisson3d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -308,9 +324,9 @@ void poisson3d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1010,17 +1026,16 @@ void poisson3d_1_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
 void poisson3d_1_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
                                                     int cell_orientation)
 {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1056,7 +1071,7 @@ void poisson3d_1_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1064,10 +1079,9 @@ void poisson3d_1_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     } // end loop over 'r'
 }
 
-/// Evaluate linear functional for dof i on the function f
 double poisson3d_1_finite_element_0::evaluate_dof(std::size_t i,
                                    const ufc::function& f,
-                                   const double* vertex_coordinates,
+                                   const double * coordinate_dofs,
                                    int cell_orientation,
                                    const ufc::cell& c) const
 {
@@ -1080,36 +1094,36 @@ double poisson3d_1_finite_element_0::evaluate_dof(std::size_t i,
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1119,10 +1133,9 @@ double poisson3d_1_finite_element_0::evaluate_dof(std::size_t i,
     return 0.0;
 }
 
-/// Evaluate linear functionals for all dofs on the function f
-void poisson3d_1_finite_element_0::evaluate_dofs(double* values,
+void poisson3d_1_finite_element_0::evaluate_dofs(double * values,
                                   const ufc::function& f,
-                                  const double* vertex_coordinates,
+                                  const double * coordinate_dofs,
                                   int cell_orientation,
                                   const ufc::cell& c) const
 {
@@ -1131,32 +1144,31 @@ void poisson3d_1_finite_element_0::evaluate_dofs(double* values,
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
 }
 
-/// Interpolate vertex values from dof values
-void poisson3d_1_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
+void poisson3d_1_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
                                               int cell_orientation,
                                               const ufc::cell& c) const
 {
@@ -1167,142 +1179,86 @@ void poisson3d_1_finite_element_0::interpolate_vertex_values(double* vertex_valu
     vertex_values[3] = dof_values[3];
 }
 
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void poisson3d_1_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-}
-
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void poisson3d_1_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+void poisson3d_1_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
 }
 
-/// Return the number of sub elements (for a mixed element)
 std::size_t poisson3d_1_finite_element_0::num_sub_elements() const
 {
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* poisson3d_1_finite_element_0::create_sub_element(std::size_t i) const
+ufc::finite_element * poisson3d_1_finite_element_0::create_sub_element(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::finite_element* poisson3d_1_finite_element_0::create() const
+ufc::finite_element * poisson3d_1_finite_element_0::create() const
 {
     return new poisson3d_1_finite_element_0();
 }
 
-/// Constructor
-poisson3d_1_dofmap_0::poisson3d_1_dofmap_0() : ufc::dofmap()
+
+poisson3d_1_finite_element_1::poisson3d_1_finite_element_1() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
-poisson3d_1_dofmap_0::~poisson3d_1_dofmap_0()
+poisson3d_1_finite_element_1::~poisson3d_1_finite_element_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* poisson3d_1_dofmap_0::signature() const
+const char * poisson3d_1_finite_element_1::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool poisson3d_1_dofmap_0::needs_mesh_entities(std::size_t d) const
+ufc::shape poisson3d_1_finite_element_1::cell_shape() const
 {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    case 3:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::tetrahedron;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t poisson3d_1_dofmap_0::topological_dimension() const
+std::size_t poisson3d_1_finite_element_1::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the geometric dimension of the associated cell shape
-std::size_t poisson3d_1_dofmap_0::geometric_dimension() const
+std::size_t poisson3d_1_finite_element_1::geometric_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t poisson3d_1_dofmap_0::global_dimension(const std::vector<std::size_t>&
-                                            num_global_entities) const
-{
-    return num_global_entities[0];
-}
-
-/// Return the dimension of the local finite element function space for a cell
-std::size_t poisson3d_1_dofmap_0::num_element_dofs() const
+std::size_t poisson3d_1_finite_element_1::space_dimension() const
 {
-    return 4;
+    return 12;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t poisson3d_1_dofmap_0::num_facet_dofs() const
+std::size_t poisson3d_1_finite_element_1::value_rank() const
 {
-    return 3;
+    return 1;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t poisson3d_1_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t poisson3d_1_finite_element_1::value_dimension(std::size_t i) const
 {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    case 3:
-      {
-        return 0;
+        return 3;
         break;
       }
     }
@@ -1310,251 +1266,3417 @@ std::size_t poisson3d_1_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void poisson3d_1_dofmap_0::tabulate_dofs(std::size_t* dofs,
-                                  const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+std::size_t poisson3d_1_finite_element_1::value_size() const
 {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    return 3;
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void poisson3d_1_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
-                                        std::size_t facet) const
+std::size_t poisson3d_1_finite_element_1::reference_value_rank() const
 {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-        break;
-      }
-    case 3:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-        break;
-      }
-    }
-    
+    return 1;
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void poisson3d_1_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
-                                  std::size_t d, std::size_t i) const
+std::size_t poisson3d_1_finite_element_1::reference_value_dimension(std::size_t i) const
 {
-    if (d > 3)
-    {
-    throw std::runtime_error("d is larger than dimension (3)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        
+        return 3;
         break;
       }
     }
     
-}
-
-/// Tabulate the coordinates of all dofs on a cell
-void poisson3d_1_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t poisson3d_1_dofmap_0::num_sub_dofmaps() const
-{
-    return 0;
-}
-
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* poisson3d_1_dofmap_0::create_sub_dofmap(std::size_t i) const
-{
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* poisson3d_1_dofmap_0::create() const
-{
-    return new poisson3d_1_dofmap_0();
-}
-
-/// Constructor
-poisson3d_1_cell_integral_0_otherwise::poisson3d_1_cell_integral_0_otherwise() : ufc::cell_integral()
+std::size_t poisson3d_1_finite_element_1::reference_value_size() const
 {
-    // Do nothing
+    return 3;
 }
 
-/// Destructor
-poisson3d_1_cell_integral_0_otherwise::~poisson3d_1_cell_integral_0_otherwise()
+std::size_t poisson3d_1_finite_element_1::degree() const
 {
-    // Do nothing
+    return 1;
 }
 
-/// Tabulate which form coefficients are used by this integral
-const std::vector<bool> & poisson3d_1_cell_integral_0_otherwise::enabled_coefficients() const
+const char * poisson3d_1_finite_element_1::family() const
 {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson3d_1_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
-                                    int cell_orientation) const
+void poisson3d_1_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
 {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    27
-    // Number of operations (multiply-add pairs) for tensor contraction: 28
-    // Total number of operations (multiply-add pairs):                  58
-    
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
     double detJ;
     compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
-    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
-    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
-    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
-    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
-    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
-    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
-    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
-    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
-    // Compute element tensor
-    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
-    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
-    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
-    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
-    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
-    A[5] = 0.166666666666667*G0_0_0;
-    A[6] = 0.166666666666667*G0_0_1;
-    A[7] = 0.166666666666667*G0_0_2;
-    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
-    A[9] = 0.166666666666667*G0_1_0;
-    A[10] = 0.166666666666667*G0_1_1;
-    A[11] = 0.166666666666667*G0_1_2;
-    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
-    A[13] = 0.166666666666667*G0_2_0;
-    A[14] = 0.166666666666667*G0_2_1;
-    A[15] = 0.166666666666667*G0_2_2;
-}
-
-/// Constructor
-poisson3d_1_cell_integral_1_otherwise::poisson3d_1_cell_integral_1_otherwise() : ufc::cell_integral()
-{
-    // Do nothing
-}
-
-/// Destructor
-poisson3d_1_cell_integral_1_otherwise::~poisson3d_1_cell_integral_1_otherwise()
-{
-    // Do nothing
-}
-
-/// Tabulate which form coefficients are used by this integral
-const std::vector<bool> & poisson3d_1_cell_integral_1_otherwise::enabled_coefficients() const
-{
-    static const std::vector<bool> enabled({true});
-    return enabled;
-}
-
-/// Tabulate the tensor for the contribution from a local cell
-void poisson3d_1_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
-                                    int cell_orientation) const
-{
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_1_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void poisson3d_1_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_1_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson3d_1_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson3d_1_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+}
+
+void poisson3d_1_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+}
+
+void poisson3d_1_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+}
+
+std::size_t poisson3d_1_finite_element_1::num_sub_elements() const
+{
+    return 3;
+}
+
+ufc::finite_element * poisson3d_1_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson3d_1_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson3d_1_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson3d_1_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * poisson3d_1_finite_element_1::create() const
+{
+    return new poisson3d_1_finite_element_1();
+}
+
+
+poisson3d_1_dofmap_0::poisson3d_1_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson3d_1_dofmap_0::~poisson3d_1_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * poisson3d_1_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+}
+
+bool poisson3d_1_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson3d_1_dofmap_0::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_1_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t poisson3d_1_dofmap_0::num_element_dofs() const
+{
+    return 4;
+}
+
+std::size_t poisson3d_1_dofmap_0::num_facet_dofs() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_1_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson3d_1_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+}
+
+void poisson3d_1_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_1_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+}
+
+std::size_t poisson3d_1_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson3d_1_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson3d_1_dofmap_0::create() const
+{
+    return new poisson3d_1_dofmap_0();
+}
+
+
+poisson3d_1_dofmap_1::poisson3d_1_dofmap_1() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson3d_1_dofmap_1::~poisson3d_1_dofmap_1()
+{
+    // Do nothing
+}
+
+const char * poisson3d_1_dofmap_1::signature() const
+{
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+}
+
+bool poisson3d_1_dofmap_1::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson3d_1_dofmap_1::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_1_dofmap_1::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return 3*num_global_entities[0];
+}
+
+std::size_t poisson3d_1_dofmap_1::num_element_dofs() const
+{
+    return 12;
+}
+
+std::size_t poisson3d_1_dofmap_1::num_facet_dofs() const
+{
+    return 9;
+}
+
+std::size_t poisson3d_1_dofmap_1::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson3d_1_dofmap_1::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+}
+
+void poisson3d_1_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_1_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+}
+
+std::size_t poisson3d_1_dofmap_1::num_sub_dofmaps() const
+{
+    return 3;
+}
+
+ufc::dofmap * poisson3d_1_dofmap_1::create_sub_dofmap(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson3d_1_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson3d_1_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson3d_1_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::dofmap * poisson3d_1_dofmap_1::create() const
+{
+    return new poisson3d_1_dofmap_1();
+}
+
+
+poisson3d_1_cell_integral_0_otherwise::poisson3d_1_cell_integral_0_otherwise() : ufc::cell_integral()
+{
+    
+}
+
+poisson3d_1_cell_integral_0_otherwise::~poisson3d_1_cell_integral_0_otherwise()
+{
+    
+}
+
+const std::vector<bool> & poisson3d_1_cell_integral_0_otherwise::enabled_coefficients() const
+{
+    static const std::vector<bool> enabled({});
+    return enabled;
+}
+
+void poisson3d_1_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation) const
+{
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    27
+    // Number of operations (multiply-add pairs) for tensor contraction: 28
+    // Total number of operations (multiply-add pairs):                  58
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
+    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
+    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
+    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
+    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
+    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
+    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
+    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
+    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    
+    // Compute element tensor
+    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
+    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
+    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
+    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
+    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
+    A[5] = 0.166666666666667*G0_0_0;
+    A[6] = 0.166666666666667*G0_0_1;
+    A[7] = 0.166666666666667*G0_0_2;
+    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
+    A[9] = 0.166666666666667*G0_1_0;
+    A[10] = 0.166666666666667*G0_1_1;
+    A[11] = 0.166666666666667*G0_1_2;
+    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
+    A[13] = 0.166666666666667*G0_2_0;
+    A[14] = 0.166666666666667*G0_2_1;
+    A[15] = 0.166666666666667*G0_2_2;
+}
+
+
+poisson3d_1_cell_integral_1_otherwise::poisson3d_1_cell_integral_1_otherwise() : ufc::cell_integral()
+{
+    
+}
+
+poisson3d_1_cell_integral_1_otherwise::~poisson3d_1_cell_integral_1_otherwise()
+{
+    
+}
+
+const std::vector<bool> & poisson3d_1_cell_integral_1_otherwise::enabled_coefficients() const
+{
+    static const std::vector<bool> enabled({true});
+    return enabled;
+}
+
+void poisson3d_1_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation) const
+{
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    4
     // Number of operations (multiply-add pairs) for tensor contraction: 14
@@ -1562,7 +4684,7 @@ void poisson3d_1_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1585,47 +4707,54 @@ void poisson3d_1_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     A[3] = 0.0083333333333333*G0_0 + 0.00833333333333337*G0_1 + 0.00833333333333337*G0_2 + 0.0166666666666667*G0_3;
 }
 
-/// Constructor
+
 poisson3d_1_form_0::poisson3d_1_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_1_form_0::~poisson3d_1_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson3d_1_form_0::signature() const
+const char * poisson3d_1_form_0::signature() const
 {
-    return "6179bb1310ebea32c45207586f40e584c036d5e7a20418f95845e305a80e3152dc03e3f68e9ce4245a2a8d13863d012fc848a9c0e2491bea9d60df2c762780cf";
+    return "a5a4eb2857e1f781c59964b5fc599a7cef178f0b27de4e5bd142c2729b67e53de3ee49a87380114d9b4ac64f1ebc4bafb7efacb7bd9eb7a53b9d3d5a89779278";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson3d_1_form_0::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson3d_1_form_0::num_coefficients() const
 {
     return 0;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson3d_1_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({});
     return position[i];
 }
 
+ufc::finite_element * poisson3d_1_form_0::create_coordinate_finite_element() const
+{
+    return new poisson3d_1_finite_element_1();
+}
+
+ufc::dofmap * poisson3d_1_form_0::create_coordinate_dofmap() const
+{
+    return new poisson3d_1_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson3d_1_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson3d_1_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson3d_1_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
@@ -1644,8 +4773,7 @@ ufc::finite_element* poisson3d_1_form_0::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson3d_1_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_1_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
@@ -1664,172 +4792,214 @@ ufc::dofmap* poisson3d_1_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson3d_1_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson3d_1_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson3d_1_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson3d_1_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson3d_1_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson3d_1_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_1_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_1_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson3d_1_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson3d_1_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson3d_1_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson3d_1_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson3d_1_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson3d_1_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_1_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_1_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson3d_1_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson3d_1_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson3d_1_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson3d_1_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson3d_1_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson3d_1_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson3d_1_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson3d_1_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson3d_1_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson3d_1_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson3d_1_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson3d_1_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_1_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson3d_1_form_0::create_default_cell_integral() const
+ufc::cell_integral * poisson3d_1_form_0::create_default_cell_integral() const
 {
     return new poisson3d_1_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson3d_1_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson3d_1_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson3d_1_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson3d_1_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * poisson3d_1_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson3d_1_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * poisson3d_1_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson3d_1_form_0::create_default_vertex_integral() const
+ufc::interface_integral * poisson3d_1_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson3d_1_form_0::create_default_custom_integral() const
+ufc::overlap_integral * poisson3d_1_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 poisson3d_1_form_1::poisson3d_1_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_1_form_1::~poisson3d_1_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson3d_1_form_1::signature() const
+const char * poisson3d_1_form_1::signature() const
 {
-    return "053c29b0c24f1ac3175b0cd77af28e3d3f6a58a66b7f57342ffa6a931a0130fb972afdcc2cd4d374109faff5696ad57c5820a436d946dc2f1f867d42659f57a9";
+    return "470381f6c50d836d63b6912c4a746c1a99cd16761099e4c805917a5cd062fe3d5fddfc0f6f28a8c3569d0963e530883569d351198336cf8b410d96d777e71761";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson3d_1_form_1::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson3d_1_form_1::num_coefficients() const
 {
     return 1;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson3d_1_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0});
     return position[i];
 }
 
+ufc::finite_element * poisson3d_1_form_1::create_coordinate_finite_element() const
+{
+    return new poisson3d_1_finite_element_1();
+}
+
+ufc::dofmap * poisson3d_1_form_1::create_coordinate_dofmap() const
+{
+    return new poisson3d_1_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson3d_1_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson3d_1_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson3d_1_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
@@ -1848,8 +5018,7 @@ ufc::finite_element* poisson3d_1_form_1::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson3d_1_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_1_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
@@ -1868,128 +5037,163 @@ ufc::dofmap* poisson3d_1_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson3d_1_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson3d_1_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson3d_1_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson3d_1_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson3d_1_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson3d_1_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_1_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_1_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson3d_1_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson3d_1_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson3d_1_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson3d_1_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson3d_1_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson3d_1_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_1_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_1_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson3d_1_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson3d_1_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson3d_1_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson3d_1_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson3d_1_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson3d_1_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson3d_1_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson3d_1_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson3d_1_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson3d_1_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson3d_1_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson3d_1_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_1_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson3d_1_form_1::create_default_cell_integral() const
+ufc::cell_integral * poisson3d_1_form_1::create_default_cell_integral() const
 {
     return new poisson3d_1_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson3d_1_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson3d_1_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson3d_1_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson3d_1_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson3d_1_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * poisson3d_1_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson3d_1_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * poisson3d_1_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson3d_1_form_1::create_default_custom_integral() const
+ufc::interface_integral * poisson3d_1_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_1_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/bench/fem/convergence/cpp/Poisson3D_1.h b/bench/fem/convergence/cpp/Poisson3D_1.h
index 899d564..61fddd4 100644
--- a/bench/fem/convergence/cpp/Poisson3D_1.h
+++ b/bench/fem/convergence/cpp/Poisson3D_1.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,500 +13,569 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __POISSON3D_1_H
 #define __POISSON3D_1_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson3d_1_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson3d_1_finite_element_0();
 
-  /// Destructor
-  virtual ~poisson3d_1_finite_element_0();
+  ~poisson3d_1_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t geometric_dimension() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t space_dimension() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson3d_1_finite_element_1: public ufc::finite_element
+{
+public:
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
+  poisson3d_1_finite_element_1();
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
+  ~poisson3d_1_finite_element_1() override;
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class poisson3d_1_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   poisson3d_1_dofmap_0();
 
-  /// Destructor
-  virtual ~poisson3d_1_dofmap_0();
+  ~poisson3d_1_dofmap_0() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  std::size_t num_sub_dofmaps() const final override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  ufc::dofmap * create() const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+};
+
+
+class poisson3d_1_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson3d_1_dofmap_1();
+
+  ~poisson3d_1_dofmap_1() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 poisson3d_1_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson3d_1_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~poisson3d_1_cell_integral_0_otherwise();
+  ~poisson3d_1_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 poisson3d_1_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson3d_1_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~poisson3d_1_cell_integral_1_otherwise();
+  ~poisson3d_1_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson3d_1_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson3d_1_form_0();
 
-  /// Destructor
-  virtual ~poisson3d_1_form_0();
+  ~poisson3d_1_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  std::size_t original_coefficient_position(std::size_t i) const final override;
 
+  ufc::finite_element * create_coordinate_finite_element() const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_custom_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
+  bool has_cell_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_interior_facet_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
+  bool has_interface_integrals() const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  bool has_overlap_integrals() const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson3d_1_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson3d_1_form_1();
 
-  /// Destructor
-  virtual ~poisson3d_1_form_1();
+  ~poisson3d_1_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
+
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_vertex_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_cutcell_integrals() const final override;
 
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::custom_integral * create_default_custom_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -516,14 +585,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson3D_1
 {
@@ -532,43 +607,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -579,43 +631,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -626,63 +655,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_1_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -690,7 +726,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_1_form_0());
+    _ufc_form = std::make_shared<const poisson3d_1_form_0>();
   }
 
   // Destructor
@@ -720,57 +756,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -778,69 +869,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_1_form_1());
+    _ufc_form = std::make_shared<const poisson3d_1_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_1_form_1());
+    _ufc_form = std::make_shared<const poisson3d_1_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_1_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_1_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_1_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_1_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -872,18 +1004,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/convergence/cpp/Poisson3D_2.cpp b/bench/fem/convergence/cpp/Poisson3D_2.cpp
index 1bb2832..07b7900 100644
--- a/bench/fem/convergence/cpp/Poisson3D_2.cpp
+++ b/bench/fem/convergence/cpp/Poisson3D_2.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,81 +13,99 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "Poisson3D_2.h"
 
-/// Constructor
 poisson3d_2_finite_element_0::poisson3d_2_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_2_finite_element_0::~poisson3d_2_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* poisson3d_2_finite_element_0::signature() const
+const char * poisson3d_2_finite_element_0::signature() const
 {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
 }
 
-/// Return the cell shape
 ufc::shape poisson3d_2_finite_element_0::cell_shape() const
 {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t poisson3d_2_finite_element_0::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t poisson3d_2_finite_element_0::geometric_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t poisson3d_2_finite_element_0::space_dimension() const
 {
-    return 10;
+    return 4;
 }
 
-/// Return the rank of the value space
 std::size_t poisson3d_2_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t poisson3d_2_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
+std::size_t poisson3d_2_finite_element_0::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_2_finite_element_0::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_2_finite_element_0::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_2_finite_element_0::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_2_finite_element_0::degree() const
+{
+    return 1;
+}
+
+const char * poisson3d_2_finite_element_0::family() const
+{
+    return "Lagrange";
+}
+
 void poisson3d_2_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -96,9 +114,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -125,43 +143,27 @@ void poisson3d_2_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -171,43 +173,27 @@ void poisson3d_2_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -217,43 +203,27 @@ void poisson3d_2_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -263,321 +233,792 @@ void poisson3d_2_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    }
+    
+}
+
+void poisson3d_2_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
@@ -585,31 +1026,18 @@ void poisson3d_2_finite_element_0::_evaluate_basis(std::size_t i,
     
 }
 
-/// Evaluate all basis functions at given point x in cell
-void poisson3d_2_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
-                                        int cell_orientation)
+void poisson3d_2_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
 {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 10; r++)
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-}
-
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
-                                                std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
-                                                int cell_orientation)
-{
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
     
     // Compute number of derivatives.
     unsigned int num_derivatives = 1;
@@ -618,28 +1046,274 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       num_derivatives *= 3;
     } // end loop over 'r'
     
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
     {
-      values[r] = 0.0;
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
     } // end loop over 'r'
     
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
       return ;
     }
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    // Helper variable to hold values of a single dof.
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
     {
-    return ;
-    }
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
     
-    // Compute Jacobian
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson3d_2_finite_element_0::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson3d_2_finite_element_0::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+}
+
+void poisson3d_2_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+}
+
+void poisson3d_2_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+}
+
+std::size_t poisson3d_2_finite_element_0::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_2_finite_element_0::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_2_finite_element_0::create() const
+{
+    return new poisson3d_2_finite_element_0();
+}
+
+
+poisson3d_2_finite_element_1::poisson3d_2_finite_element_1() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson3d_2_finite_element_1::~poisson3d_2_finite_element_1()
+{
+    // Do nothing
+}
+
+const char * poisson3d_2_finite_element_1::signature() const
+{
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+}
+
+ufc::shape poisson3d_2_finite_element_1::cell_shape() const
+{
+    return ufc::shape::tetrahedron;
+}
+
+std::size_t poisson3d_2_finite_element_1::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_2_finite_element_1::geometric_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_2_finite_element_1::space_dimension() const
+{
+    return 12;
+}
+
+std::size_t poisson3d_2_finite_element_1::value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_2_finite_element_1::value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson3d_2_finite_element_1::value_size() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_2_finite_element_1::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_2_finite_element_1::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson3d_2_finite_element_1::reference_value_size() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_2_finite_element_1::degree() const
+{
+    return 1;
+}
+
+const char * poisson3d_2_finite_element_1::family() const
+{
+    return "Lagrange";
+}
+
+void poisson3d_2_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -648,9 +1322,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -669,578 +1343,581 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
     
     
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[9][2];
-    for (unsigned int row = 0; row < 9; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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 > 2)
-            combinations[row][col] = 0;
-          else
-          {
-            combinations[row][col] += 1;
-            break;
-          }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[9][9];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_2_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void poisson3d_2_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1255,9 +1932,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1267,11 +1944,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1281,11 +1958,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1295,11 +1972,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1308,9 +1985,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1327,123 +2004,77 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1458,9 +2089,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1470,11 +2101,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1484,11 +2115,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1498,11 +2129,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1511,9 +2142,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1530,123 +2161,77 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1661,9 +2246,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1673,11 +2258,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1687,11 +2272,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1701,11 +2286,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1714,9 +2299,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1733,123 +2318,77 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1864,9 +2403,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1876,11 +2415,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1890,11 +2429,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1904,11 +2443,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1917,9 +2456,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1936,123 +2475,77 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2067,9 +2560,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2079,11 +2572,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2093,11 +2586,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2107,11 +2600,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2120,9 +2613,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2134,128 +2627,82 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2270,9 +2717,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2282,11 +2729,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2296,11 +2743,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2310,11 +2757,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2323,9 +2770,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2337,128 +2784,82 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2473,9 +2874,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2485,11 +2886,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2499,11 +2900,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2513,11 +2914,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2526,9 +2927,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2540,128 +2941,82 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2676,9 +3031,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2688,11 +3043,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2702,11 +3057,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2716,11 +3071,11 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2729,9 +3084,9 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2743,310 +3098,4545 @@ void poisson3d_2_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-}
-
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void poisson3d_2_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
-                                                    int cell_orientation)
-{
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 8:
       {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[9];
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-}
-
-/// Evaluate linear functional for dof i on the function f
-double poisson3d_2_finite_element_0::evaluate_dof(std::size_t i,
-                                   const ufc::function& f,
-                                   const double* vertex_coordinates,
-                                   int cell_orientation,
-                                   const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_2_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson3d_2_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson3d_2_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+}
+
+void poisson3d_2_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+}
+
+void poisson3d_2_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+}
+
+std::size_t poisson3d_2_finite_element_1::num_sub_elements() const
+{
+    return 3;
+}
+
+ufc::finite_element * poisson3d_2_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson3d_2_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson3d_2_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson3d_2_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * poisson3d_2_finite_element_1::create() const
+{
+    return new poisson3d_2_finite_element_1();
+}
+
+
+poisson3d_2_finite_element_2::poisson3d_2_finite_element_2() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson3d_2_finite_element_2::~poisson3d_2_finite_element_2()
+{
+    // Do nothing
+}
+
+const char * poisson3d_2_finite_element_2::signature() const
+{
+    return "FiniteElement('Lagrange', tetrahedron, 2)";
+}
+
+ufc::shape poisson3d_2_finite_element_2::cell_shape() const
+{
+    return ufc::shape::tetrahedron;
+}
+
+std::size_t poisson3d_2_finite_element_2::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_2_finite_element_2::geometric_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_2_finite_element_2::space_dimension() const
+{
+    return 10;
+}
+
+std::size_t poisson3d_2_finite_element_2::value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_2_finite_element_2::value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_2_finite_element_2::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_2_finite_element_2::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_2_finite_element_2::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_2_finite_element_2::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_2_finite_element_2::degree() const
+{
+    return 2;
+}
+
+const char * poisson3d_2_finite_element_2::family() const
+{
+    return "Lagrange";
+}
+
+void poisson3d_2_finite_element_2::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_2_finite_element_2::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson3d_2_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[9][2];
+    for (unsigned int row = 0; row < 9; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[9][9];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_2_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson3d_2_finite_element_2::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson3d_2_finite_element_2::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+}
+
+void poisson3d_2_finite_element_2::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+}
+
+void poisson3d_2_finite_element_2::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[13] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[14] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[19] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[20] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[21] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[22] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[23] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[26] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[27] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[28] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+}
+
+std::size_t poisson3d_2_finite_element_2::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_2_finite_element_2::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_2_finite_element_2::create() const
+{
+    return new poisson3d_2_finite_element_2();
+}
+
+
+poisson3d_2_dofmap_0::poisson3d_2_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson3d_2_dofmap_0::~poisson3d_2_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * poisson3d_2_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+}
+
+bool poisson3d_2_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson3d_2_dofmap_0::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_2_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t poisson3d_2_dofmap_0::num_element_dofs() const
+{
+    return 4;
+}
+
+std::size_t poisson3d_2_dofmap_0::num_facet_dofs() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_2_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson3d_2_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+}
+
+void poisson3d_2_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_2_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+}
+
+std::size_t poisson3d_2_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson3d_2_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson3d_2_dofmap_0::create() const
+{
+    return new poisson3d_2_dofmap_0();
+}
+
+
+poisson3d_2_dofmap_1::poisson3d_2_dofmap_1() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson3d_2_dofmap_1::~poisson3d_2_dofmap_1()
+{
+    // Do nothing
+}
+
+const char * poisson3d_2_dofmap_1::signature() const
+{
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+}
+
+bool poisson3d_2_dofmap_1::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson3d_2_dofmap_1::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_2_dofmap_1::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return 3*num_global_entities[0];
+}
+
+std::size_t poisson3d_2_dofmap_1::num_element_dofs() const
+{
+    return 12;
+}
+
+std::size_t poisson3d_2_dofmap_1::num_facet_dofs() const
+{
+    return 9;
+}
+
+std::size_t poisson3d_2_dofmap_1::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson3d_2_dofmap_1::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+}
+
+void poisson3d_2_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_2_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 7:
+    }
+    
+}
+
+std::size_t poisson3d_2_dofmap_1::num_sub_dofmaps() const
+{
+    return 3;
+}
+
+ufc::dofmap * poisson3d_2_dofmap_1::create_sub_dofmap(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return new poisson3d_2_dofmap_0();
         break;
       }
-    case 8:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return new poisson3d_2_dofmap_0();
         break;
       }
-    case 9:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return new poisson3d_2_dofmap_0();
         break;
       }
     }
     
-    return 0.0;
-}
-
-/// Evaluate linear functionals for all dofs on the function f
-void poisson3d_2_finite_element_0::evaluate_dofs(double* values,
-                                  const ufc::function& f,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation,
-                                  const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-}
-
-/// Interpolate vertex values from dof values
-void poisson3d_2_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation,
-                                              const ufc::cell& c) const
-{
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-}
-
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void poisson3d_2_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-}
-
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void poisson3d_2_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
-{
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-}
-
-/// Return the number of sub elements (for a mixed element)
-std::size_t poisson3d_2_finite_element_0::num_sub_elements() const
-{
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* poisson3d_2_finite_element_0::create_sub_element(std::size_t i) const
+ufc::dofmap * poisson3d_2_dofmap_1::create() const
 {
-    return 0;
+    return new poisson3d_2_dofmap_1();
 }
 
-/// Create a new class instance
-ufc::finite_element* poisson3d_2_finite_element_0::create() const
-{
-    return new poisson3d_2_finite_element_0();
-}
 
-/// Constructor
-poisson3d_2_dofmap_0::poisson3d_2_dofmap_0() : ufc::dofmap()
+poisson3d_2_dofmap_2::poisson3d_2_dofmap_2() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-poisson3d_2_dofmap_0::~poisson3d_2_dofmap_0()
+poisson3d_2_dofmap_2::~poisson3d_2_dofmap_2()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* poisson3d_2_dofmap_0::signature() const
+const char * poisson3d_2_dofmap_2::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 2)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool poisson3d_2_dofmap_0::needs_mesh_entities(std::size_t d) const
+bool poisson3d_2_dofmap_2::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
@@ -3075,39 +7665,28 @@ bool poisson3d_2_dofmap_0::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t poisson3d_2_dofmap_0::topological_dimension() const
-{
-    return 3;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t poisson3d_2_dofmap_0::geometric_dimension() const
+std::size_t poisson3d_2_dofmap_2::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t poisson3d_2_dofmap_0::global_dimension(const std::vector<std::size_t>&
+std::size_t poisson3d_2_dofmap_2::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
     return num_global_entities[0] + num_global_entities[1];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t poisson3d_2_dofmap_0::num_element_dofs() const
+std::size_t poisson3d_2_dofmap_2::num_element_dofs() const
 {
     return 10;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t poisson3d_2_dofmap_0::num_facet_dofs() const
+std::size_t poisson3d_2_dofmap_2::num_facet_dofs() const
 {
     return 6;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t poisson3d_2_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t poisson3d_2_dofmap_2::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
@@ -3136,28 +7715,26 @@ std::size_t poisson3d_2_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void poisson3d_2_dofmap_0::tabulate_dofs(std::size_t* dofs,
+void poisson3d_2_dofmap_2::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[1][0];
-    dofs[5] = offset + c.entity_indices[1][1];
-    dofs[6] = offset + c.entity_indices[1][2];
-    dofs[7] = offset + c.entity_indices[1][3];
-    dofs[8] = offset + c.entity_indices[1][4];
-    dofs[9] = offset + c.entity_indices[1][5];
+    dofs[4] = offset + entity_indices[1][0];
+    dofs[5] = offset + entity_indices[1][1];
+    dofs[6] = offset + entity_indices[1][2];
+    dofs[7] = offset + entity_indices[1][3];
+    dofs[8] = offset + entity_indices[1][4];
+    dofs[9] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void poisson3d_2_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
+void poisson3d_2_dofmap_2::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
@@ -3206,8 +7783,7 @@ void poisson3d_2_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void poisson3d_2_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
+void poisson3d_2_dofmap_2::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 3)
@@ -3307,83 +7883,41 @@ void poisson3d_2_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void poisson3d_2_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t poisson3d_2_dofmap_0::num_sub_dofmaps() const
+std::size_t poisson3d_2_dofmap_2::num_sub_dofmaps() const
 {
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* poisson3d_2_dofmap_0::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_2_dofmap_2::create_sub_dofmap(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* poisson3d_2_dofmap_0::create() const
+ufc::dofmap * poisson3d_2_dofmap_2::create() const
 {
-    return new poisson3d_2_dofmap_0();
+    return new poisson3d_2_dofmap_2();
 }
 
-/// Constructor
+
 poisson3d_2_cell_integral_0_otherwise::poisson3d_2_cell_integral_0_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson3d_2_cell_integral_0_otherwise::~poisson3d_2_cell_integral_0_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson3d_2_cell_integral_0_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson3d_2_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson3d_2_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -3393,7 +7927,7 @@ void poisson3d_2_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -3419,21 +7953,21 @@ void poisson3d_2_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     A[1] = 0.0333333333333333*G0_0_0 + 0.0333333333333333*G0_1_0 + 0.0333333333333333*G0_2_0;
     A[2] = 0.0333333333333334*G0_0_1 + 0.0333333333333334*G0_1_1 + 0.0333333333333334*G0_2_1;
     A[3] = 0.0333333333333334*G0_0_2 + 0.0333333333333334*G0_1_2 + 0.0333333333333334*G0_2_2;
-    A[4] = 0.0333333333333345*G0_0_1 + 0.0333333333333345*G0_0_2 + 0.0333333333333345*G0_1_1 + 0.0333333333333345*G0_1_2 + 0.0333333333333344*G0_2_1 + 0.0333333333333344*G0_2_2;
-    A[5] = 0.0333333333333345*G0_0_0 + 0.0333333333333346*G0_0_2 + 0.0333333333333345*G0_1_0 + 0.0333333333333346*G0_1_2 + 0.0333333333333344*G0_2_0 + 0.0333333333333345*G0_2_2;
-    A[6] = 0.0333333333333345*G0_0_0 + 0.0333333333333345*G0_0_1 + 0.0333333333333345*G0_1_0 + 0.0333333333333345*G0_1_1 + 0.0333333333333344*G0_2_0 + 0.0333333333333344*G0_2_1;
-    A[7] = -0.0333333333333345*G0_0_0 - 0.0333333333333345*G0_0_1 - 0.133333333333334*G0_0_2 - 0.0333333333333346*G0_1_0 - 0.0333333333333345*G0_1_1 - 0.133333333333334*G0_1_2 - 0.0333333333333345*G0_2_0 - 0.0333333333333345*G0_2_1 - 0.133333333333334*G0_2_2;
-    A[8] = -0.0333333333333345*G0_0_0 - 0.133333333333333*G0_0_1 - 0.0333333333333345*G0_0_2 - 0.0333333333333345*G0_1_0 - 0.133333333333333*G0_1_1 - 0.0333333333333345*G0_1_2 - 0.0333333333333344*G0_2_0 - 0.133333333333333*G0_2_1 - 0.0333333333333344*G0_2_2;
-    A[9] = -0.133333333333333*G0_0_0 - 0.0333333333333345*G0_0_1 - 0.0333333333333345*G0_0_2 - 0.133333333333333*G0_1_0 - 0.0333333333333345*G0_1_1 - 0.0333333333333345*G0_1_2 - 0.133333333333333*G0_2_0 - 0.0333333333333344*G0_2_1 - 0.0333333333333345*G0_2_2;
+    A[4] = 0.0333333333333345*G0_0_1 + 0.0333333333333345*G0_0_2 + 0.0333333333333345*G0_1_1 + 0.0333333333333344*G0_1_2 + 0.0333333333333345*G0_2_1 + 0.0333333333333344*G0_2_2;
+    A[5] = 0.0333333333333345*G0_0_0 + 0.0333333333333345*G0_0_2 + 0.0333333333333345*G0_1_0 + 0.0333333333333346*G0_1_2 + 0.0333333333333345*G0_2_0 + 0.0333333333333345*G0_2_2;
+    A[6] = 0.0333333333333345*G0_0_0 + 0.0333333333333344*G0_0_1 + 0.0333333333333345*G0_1_0 + 0.0333333333333345*G0_1_1 + 0.0333333333333345*G0_2_0 + 0.0333333333333344*G0_2_1;
+    A[7] = -0.0333333333333345*G0_0_0 - 0.0333333333333345*G0_0_1 - 0.133333333333333*G0_0_2 - 0.0333333333333345*G0_1_0 - 0.0333333333333345*G0_1_1 - 0.133333333333333*G0_1_2 - 0.0333333333333345*G0_2_0 - 0.0333333333333345*G0_2_1 - 0.133333333333333*G0_2_2;
+    A[8] = -0.0333333333333345*G0_0_0 - 0.133333333333333*G0_0_1 - 0.0333333333333345*G0_0_2 - 0.0333333333333345*G0_1_0 - 0.133333333333333*G0_1_1 - 0.0333333333333345*G0_1_2 - 0.0333333333333345*G0_2_0 - 0.133333333333333*G0_2_1 - 0.0333333333333344*G0_2_2;
+    A[9] = -0.133333333333333*G0_0_0 - 0.0333333333333344*G0_0_1 - 0.0333333333333344*G0_0_2 - 0.133333333333333*G0_1_0 - 0.0333333333333345*G0_1_1 - 0.0333333333333345*G0_1_2 - 0.133333333333333*G0_2_0 - 0.0333333333333344*G0_2_1 - 0.0333333333333344*G0_2_2;
     A[10] = 0.0333333333333333*G0_0_0 + 0.0333333333333333*G0_0_1 + 0.0333333333333333*G0_0_2;
     A[11] = 0.1*G0_0_0;
     A[12] = -0.0333333333333334*G0_0_1;
     A[13] = -0.0333333333333334*G0_0_2;
-    A[14] = -0.0333333333333332*G0_0_1 - 0.0333333333333332*G0_0_2;
+    A[14] = -0.0333333333333332*G0_0_1 - 0.0333333333333331*G0_0_2;
     A[15] = -0.0333333333333332*G0_0_0 + 0.1*G0_0_2;
-    A[16] = -0.0333333333333333*G0_0_0 + 0.1*G0_0_1;
+    A[16] = -0.0333333333333332*G0_0_0 + 0.1*G0_0_1;
     A[17] = 0.0333333333333332*G0_0_0 + 0.0333333333333332*G0_0_1;
-    A[18] = 0.0333333333333333*G0_0_0 + 0.0333333333333333*G0_0_2;
+    A[18] = 0.0333333333333332*G0_0_0 + 0.0333333333333332*G0_0_2;
     A[19] = -0.133333333333333*G0_0_0 - 0.1*G0_0_1 - 0.1*G0_0_2;
     A[20] = 0.0333333333333334*G0_1_0 + 0.0333333333333334*G0_1_1 + 0.0333333333333334*G0_1_2;
     A[21] = -0.0333333333333334*G0_1_0;
@@ -3450,13 +7984,13 @@ void poisson3d_2_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     A[32] = -0.0333333333333333*G0_2_1;
     A[33] = 0.1*G0_2_2;
     A[34] = 0.1*G0_2_1 - 0.033333333333334*G0_2_2;
-    A[35] = 0.1*G0_2_0 - 0.0333333333333336*G0_2_2;
+    A[35] = 0.1*G0_2_0 - 0.0333333333333337*G0_2_2;
     A[36] = -0.0333333333333338*G0_2_0 - 0.0333333333333339*G0_2_1;
-    A[37] = -0.1*G0_2_0 - 0.1*G0_2_1 - 0.133333333333334*G0_2_2;
+    A[37] = -0.1*G0_2_0 - 0.1*G0_2_1 - 0.133333333333333*G0_2_2;
     A[38] = 0.0333333333333338*G0_2_0 + 0.0333333333333338*G0_2_2;
     A[39] = 0.0333333333333338*G0_2_1 + 0.0333333333333337*G0_2_2;
-    A[40] = 0.0333333333333345*G0_1_0 + 0.0333333333333345*G0_1_1 + 0.0333333333333344*G0_1_2 + 0.0333333333333345*G0_2_0 + 0.0333333333333345*G0_2_1 + 0.0333333333333344*G0_2_2;
-    A[41] = -0.0333333333333332*G0_1_0 - 0.0333333333333332*G0_2_0;
+    A[40] = 0.0333333333333345*G0_1_0 + 0.0333333333333345*G0_1_1 + 0.0333333333333345*G0_1_2 + 0.0333333333333345*G0_2_0 + 0.0333333333333344*G0_2_1 + 0.0333333333333344*G0_2_2;
+    A[41] = -0.0333333333333332*G0_1_0 - 0.0333333333333331*G0_2_0;
     A[42] = -0.0333333333333334*G0_1_1 + 0.1*G0_2_1;
     A[43] = 0.1*G0_1_2 - 0.033333333333334*G0_2_2;
     A[44] = 0.266666666666668*G0_1_1 + 0.133333333333334*G0_1_2 + 0.133333333333334*G0_2_1 + 0.266666666666668*G0_2_2;
@@ -3465,18 +7999,18 @@ void poisson3d_2_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     A[47] = -0.266666666666668*G0_1_0 - 0.266666666666668*G0_1_1 - 0.133333333333335*G0_1_2 - 0.133333333333334*G0_2_0 - 0.133333333333334*G0_2_1;
     A[48] = -0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_2 - 0.266666666666668*G0_2_0 - 0.133333333333335*G0_2_1 - 0.266666666666668*G0_2_2;
     A[49] = -0.133333333333334*G0_1_1 - 0.133333333333334*G0_1_2 - 0.133333333333334*G0_2_1 - 0.133333333333334*G0_2_2;
-    A[50] = 0.0333333333333345*G0_0_0 + 0.0333333333333345*G0_0_1 + 0.0333333333333344*G0_0_2 + 0.0333333333333346*G0_2_0 + 0.0333333333333346*G0_2_1 + 0.0333333333333345*G0_2_2;
+    A[50] = 0.0333333333333345*G0_0_0 + 0.0333333333333345*G0_0_1 + 0.0333333333333345*G0_0_2 + 0.0333333333333345*G0_2_0 + 0.0333333333333346*G0_2_1 + 0.0333333333333345*G0_2_2;
     A[51] = -0.0333333333333332*G0_0_0 + 0.1*G0_2_0;
     A[52] = -0.0333333333333334*G0_0_1 - 0.0333333333333335*G0_2_1;
-    A[53] = 0.1*G0_0_2 - 0.0333333333333336*G0_2_2;
+    A[53] = 0.1*G0_0_2 - 0.0333333333333337*G0_2_2;
     A[54] = 0.266666666666668*G0_0_1 + 0.133333333333334*G0_0_2 + 0.133333333333335*G0_2_1 + 0.133333333333335*G0_2_2;
     A[55] = 0.266666666666668*G0_0_0 + 0.133333333333335*G0_0_2 + 0.133333333333335*G0_2_0 + 0.26666666666667*G0_2_2;
     A[56] = 0.133333333333334*G0_0_0 + 0.133333333333335*G0_0_1 + 0.133333333333335*G0_2_0 + 0.266666666666669*G0_2_1;
     A[57] = -0.266666666666668*G0_0_0 - 0.266666666666668*G0_0_1 - 0.133333333333335*G0_0_2 - 0.133333333333335*G0_2_0 - 0.133333333333335*G0_2_1;
     A[58] = -0.133333333333334*G0_0_0 - 0.133333333333334*G0_0_2 - 0.133333333333335*G0_2_0 - 0.133333333333335*G0_2_2;
     A[59] = -0.133333333333334*G0_0_1 - 0.133333333333334*G0_0_2 - 0.133333333333335*G0_2_0 - 0.266666666666669*G0_2_1 - 0.266666666666668*G0_2_2;
-    A[60] = 0.0333333333333345*G0_0_0 + 0.0333333333333345*G0_0_1 + 0.0333333333333344*G0_0_2 + 0.0333333333333345*G0_1_0 + 0.0333333333333345*G0_1_1 + 0.0333333333333344*G0_1_2;
-    A[61] = -0.0333333333333333*G0_0_0 + 0.1*G0_1_0;
+    A[60] = 0.0333333333333345*G0_0_0 + 0.0333333333333345*G0_0_1 + 0.0333333333333345*G0_0_2 + 0.0333333333333344*G0_1_0 + 0.0333333333333345*G0_1_1 + 0.0333333333333344*G0_1_2;
+    A[61] = -0.0333333333333332*G0_0_0 + 0.1*G0_1_0;
     A[62] = 0.1*G0_0_1 - 0.0333333333333334*G0_1_1;
     A[63] = -0.0333333333333338*G0_0_2 - 0.0333333333333339*G0_1_2;
     A[64] = 0.133333333333334*G0_0_1 + 0.266666666666668*G0_0_2 + 0.133333333333335*G0_1_1 + 0.133333333333335*G0_1_2;
@@ -3485,61 +8019,58 @@ void poisson3d_2_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     A[67] = -0.133333333333334*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333335*G0_1_0 - 0.133333333333335*G0_1_1;
     A[68] = -0.266666666666668*G0_0_0 - 0.133333333333335*G0_0_1 - 0.266666666666668*G0_0_2 - 0.133333333333335*G0_1_0 - 0.133333333333335*G0_1_2;
     A[69] = -0.133333333333334*G0_0_1 - 0.133333333333334*G0_0_2 - 0.133333333333335*G0_1_0 - 0.266666666666668*G0_1_1 - 0.266666666666668*G0_1_2;
-    A[70] = -0.0333333333333345*G0_0_0 - 0.0333333333333346*G0_0_1 - 0.0333333333333345*G0_0_2 - 0.0333333333333345*G0_1_0 - 0.0333333333333345*G0_1_1 - 0.0333333333333345*G0_1_2 - 0.133333333333334*G0_2_0 - 0.133333333333334*G0_2_1 - 0.133333333333334*G0_2_2;
+    A[70] = -0.0333333333333345*G0_0_0 - 0.0333333333333345*G0_0_1 - 0.0333333333333345*G0_0_2 - 0.0333333333333345*G0_1_0 - 0.0333333333333345*G0_1_1 - 0.0333333333333345*G0_1_2 - 0.133333333333333*G0_2_0 - 0.133333333333333*G0_2_1 - 0.133333333333333*G0_2_2;
     A[71] = 0.0333333333333332*G0_0_0 + 0.0333333333333332*G0_1_0;
     A[72] = 0.0333333333333334*G0_0_1 + 0.0333333333333334*G0_1_1;
-    A[73] = -0.1*G0_0_2 - 0.1*G0_1_2 - 0.133333333333334*G0_2_2;
+    A[73] = -0.1*G0_0_2 - 0.1*G0_1_2 - 0.133333333333333*G0_2_2;
     A[74] = -0.266666666666668*G0_0_1 - 0.133333333333334*G0_0_2 - 0.266666666666668*G0_1_1 - 0.133333333333334*G0_1_2 - 0.133333333333335*G0_2_1;
     A[75] = -0.266666666666668*G0_0_0 - 0.133333333333335*G0_0_2 - 0.266666666666668*G0_1_0 - 0.133333333333335*G0_1_2 - 0.133333333333335*G0_2_0;
     A[76] = -0.133333333333334*G0_0_0 - 0.133333333333335*G0_0_1 - 0.133333333333334*G0_1_0 - 0.133333333333335*G0_1_1;
     A[77] = 0.266666666666668*G0_0_0 + 0.266666666666668*G0_0_1 + 0.133333333333335*G0_0_2 + 0.266666666666668*G0_1_0 + 0.266666666666668*G0_1_1 + 0.133333333333335*G0_1_2 + 0.133333333333335*G0_2_0 + 0.133333333333335*G0_2_1 + 0.266666666666667*G0_2_2;
-    A[78] = 0.133333333333334*G0_0_0 + 0.133333333333334*G0_0_2 + 0.133333333333334*G0_1_0 + 0.133333333333334*G0_1_2 + 0.133333333333333*G0_2_1;
+    A[78] = 0.133333333333334*G0_0_0 + 0.133333333333334*G0_0_2 + 0.133333333333334*G0_1_0 + 0.133333333333334*G0_1_2 + 0.133333333333334*G0_2_1;
     A[79] = 0.133333333333334*G0_0_1 + 0.133333333333334*G0_0_2 + 0.133333333333334*G0_1_1 + 0.133333333333334*G0_1_2 + 0.133333333333334*G0_2_0;
-    A[80] = -0.0333333333333345*G0_0_0 - 0.0333333333333345*G0_0_1 - 0.0333333333333344*G0_0_2 - 0.133333333333333*G0_1_0 - 0.133333333333333*G0_1_1 - 0.133333333333333*G0_1_2 - 0.0333333333333345*G0_2_0 - 0.0333333333333345*G0_2_1 - 0.0333333333333344*G0_2_2;
-    A[81] = 0.0333333333333333*G0_0_0 + 0.0333333333333333*G0_2_0;
+    A[80] = -0.0333333333333345*G0_0_0 - 0.0333333333333345*G0_0_1 - 0.0333333333333345*G0_0_2 - 0.133333333333333*G0_1_0 - 0.133333333333333*G0_1_1 - 0.133333333333333*G0_1_2 - 0.0333333333333345*G0_2_0 - 0.0333333333333345*G0_2_1 - 0.0333333333333344*G0_2_2;
+    A[81] = 0.0333333333333332*G0_0_0 + 0.0333333333333332*G0_2_0;
     A[82] = -0.1*G0_0_1 - 0.133333333333333*G0_1_1 - 0.1*G0_2_1;
     A[83] = 0.0333333333333338*G0_0_2 + 0.0333333333333338*G0_2_2;
     A[84] = -0.133333333333334*G0_0_1 - 0.266666666666668*G0_0_2 - 0.133333333333335*G0_1_2 - 0.133333333333334*G0_2_1 - 0.266666666666668*G0_2_2;
     A[85] = -0.133333333333334*G0_0_0 - 0.133333333333335*G0_0_2 - 0.133333333333334*G0_2_0 - 0.133333333333335*G0_2_2;
-    A[86] = -0.266666666666668*G0_0_0 - 0.133333333333335*G0_0_1 - 0.133333333333335*G0_1_0 - 0.266666666666668*G0_2_0 - 0.133333333333335*G0_2_1;
+    A[86] = -0.266666666666668*G0_0_0 - 0.133333333333335*G0_0_1 - 0.133333333333335*G0_1_0 - 0.266666666666667*G0_2_0 - 0.133333333333335*G0_2_1;
     A[87] = 0.133333333333334*G0_0_0 + 0.133333333333334*G0_0_1 + 0.133333333333333*G0_1_2 + 0.133333333333334*G0_2_0 + 0.133333333333334*G0_2_1;
     A[88] = 0.266666666666668*G0_0_0 + 0.133333333333335*G0_0_1 + 0.266666666666668*G0_0_2 + 0.133333333333335*G0_1_0 + 0.266666666666667*G0_1_1 + 0.133333333333335*G0_1_2 + 0.266666666666668*G0_2_0 + 0.133333333333335*G0_2_1 + 0.266666666666667*G0_2_2;
     A[89] = 0.133333333333334*G0_0_1 + 0.133333333333334*G0_0_2 + 0.133333333333333*G0_1_0 + 0.133333333333334*G0_2_1 + 0.133333333333334*G0_2_2;
-    A[90] = -0.133333333333333*G0_0_0 - 0.133333333333333*G0_0_1 - 0.133333333333333*G0_0_2 - 0.0333333333333345*G0_1_0 - 0.0333333333333345*G0_1_1 - 0.0333333333333345*G0_1_2 - 0.0333333333333345*G0_2_0 - 0.0333333333333345*G0_2_1 - 0.0333333333333345*G0_2_2;
+    A[90] = -0.133333333333333*G0_0_0 - 0.133333333333333*G0_0_1 - 0.133333333333333*G0_0_2 - 0.0333333333333344*G0_1_0 - 0.0333333333333345*G0_1_1 - 0.0333333333333344*G0_1_2 - 0.0333333333333344*G0_2_0 - 0.0333333333333345*G0_2_1 - 0.0333333333333344*G0_2_2;
     A[91] = -0.133333333333333*G0_0_0 - 0.1*G0_1_0 - 0.1*G0_2_0;
     A[92] = 0.0333333333333334*G0_1_1 + 0.0333333333333335*G0_2_1;
     A[93] = 0.0333333333333338*G0_1_2 + 0.0333333333333337*G0_2_2;
     A[94] = -0.133333333333334*G0_1_1 - 0.133333333333334*G0_1_2 - 0.133333333333334*G0_2_1 - 0.133333333333334*G0_2_2;
     A[95] = -0.133333333333335*G0_0_2 - 0.133333333333334*G0_1_0 - 0.266666666666669*G0_1_2 - 0.133333333333334*G0_2_0 - 0.266666666666668*G0_2_2;
     A[96] = -0.133333333333335*G0_0_1 - 0.133333333333334*G0_1_0 - 0.266666666666668*G0_1_1 - 0.133333333333334*G0_2_0 - 0.266666666666668*G0_2_1;
-    A[97] = 0.133333333333334*G0_0_2 + 0.133333333333334*G0_1_0 + 0.133333333333334*G0_1_1 + 0.133333333333334*G0_2_0 + 0.133333333333334*G0_2_1;
+    A[97] = 0.133333333333333*G0_0_2 + 0.133333333333334*G0_1_0 + 0.133333333333334*G0_1_1 + 0.133333333333334*G0_2_0 + 0.133333333333334*G0_2_1;
     A[98] = 0.133333333333333*G0_0_1 + 0.133333333333334*G0_1_0 + 0.133333333333334*G0_1_2 + 0.133333333333334*G0_2_0 + 0.133333333333334*G0_2_2;
-    A[99] = 0.266666666666667*G0_0_0 + 0.133333333333335*G0_0_1 + 0.133333333333335*G0_0_2 + 0.133333333333335*G0_1_0 + 0.266666666666668*G0_1_1 + 0.266666666666667*G0_1_2 + 0.133333333333335*G0_2_0 + 0.266666666666667*G0_2_1 + 0.266666666666667*G0_2_2;
+    A[99] = 0.266666666666667*G0_0_0 + 0.133333333333335*G0_0_1 + 0.133333333333335*G0_0_2 + 0.133333333333335*G0_1_0 + 0.266666666666667*G0_1_1 + 0.266666666666667*G0_1_2 + 0.133333333333335*G0_2_0 + 0.266666666666667*G0_2_1 + 0.266666666666667*G0_2_2;
 }
 
-/// Constructor
+
 poisson3d_2_cell_integral_1_otherwise::poisson3d_2_cell_integral_1_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson3d_2_cell_integral_1_otherwise::~poisson3d_2_cell_integral_1_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson3d_2_cell_integral_1_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson3d_2_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson3d_2_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -3549,7 +8080,7 @@ void poisson3d_2_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -3584,58 +8115,65 @@ void poisson3d_2_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     A[9] = -0.00158730158730158*G0_0 - 0.00158730158730158*G0_1 - 0.00238095238095238*G0_2 - 0.00238095238095238*G0_3 + 0.00317460317460317*G0_4 + 0.00634920634920635*G0_5 + 0.00634920634920635*G0_6 + 0.00634920634920635*G0_7 + 0.00634920634920634*G0_8 + 0.0126984126984127*G0_9;
 }
 
-/// Constructor
+
 poisson3d_2_form_0::poisson3d_2_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_2_form_0::~poisson3d_2_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson3d_2_form_0::signature() const
+const char * poisson3d_2_form_0::signature() const
 {
-    return "200b237060f8ef073f4cfcbe8b56b06af165f28cc3fda639445d1bdb621676f45eb02e550cf46078865cd670ca77b3e8d7ff5b525ef23519f48078ef68d334a8";
+    return "0655a4547e37f8b30872a0b3725ec77faa46af27c3ea2587c0638dd7abeb12db68bf7c7c1fe9af18e8e62fb5971bdb7588edc46ed67a98e1b1dd6e23f5d2a409";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson3d_2_form_0::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson3d_2_form_0::num_coefficients() const
 {
     return 0;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson3d_2_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({});
     return position[i];
 }
 
+ufc::finite_element * poisson3d_2_form_0::create_coordinate_finite_element() const
+{
+    return new poisson3d_2_finite_element_1();
+}
+
+ufc::dofmap * poisson3d_2_form_0::create_coordinate_dofmap() const
+{
+    return new poisson3d_2_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson3d_2_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson3d_2_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson3d_2_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_2_finite_element_0();
+        return new poisson3d_2_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_2_finite_element_0();
+        return new poisson3d_2_finite_element_2();
         break;
       }
     }
@@ -3643,19 +8181,18 @@ ufc::finite_element* poisson3d_2_form_0::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson3d_2_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_2_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_2_dofmap_0();
+        return new poisson3d_2_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_2_dofmap_0();
+        return new poisson3d_2_dofmap_2();
         break;
       }
     }
@@ -3663,183 +8200,225 @@ ufc::dofmap* poisson3d_2_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson3d_2_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson3d_2_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson3d_2_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson3d_2_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson3d_2_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson3d_2_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_2_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_2_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson3d_2_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson3d_2_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson3d_2_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson3d_2_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson3d_2_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson3d_2_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_2_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_2_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson3d_2_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson3d_2_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson3d_2_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson3d_2_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson3d_2_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson3d_2_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson3d_2_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson3d_2_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson3d_2_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson3d_2_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson3d_2_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson3d_2_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_2_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson3d_2_form_0::create_default_cell_integral() const
+ufc::cell_integral * poisson3d_2_form_0::create_default_cell_integral() const
 {
     return new poisson3d_2_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson3d_2_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson3d_2_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson3d_2_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson3d_2_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * poisson3d_2_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson3d_2_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * poisson3d_2_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson3d_2_form_0::create_default_vertex_integral() const
+ufc::interface_integral * poisson3d_2_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson3d_2_form_0::create_default_custom_integral() const
+ufc::overlap_integral * poisson3d_2_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 poisson3d_2_form_1::poisson3d_2_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_2_form_1::~poisson3d_2_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson3d_2_form_1::signature() const
+const char * poisson3d_2_form_1::signature() const
 {
-    return "14280f26afff16c433cf2017cc4e5a8311d176b7ed68f7c087c7e5f4c219ef81820bc16f078b41360f191473f0abb75e6353ddf46a811574bf764685e083de9a";
+    return "b46f48f12472849460aaeef75428df45f03cbf7e5e71982657486800128cac564af2c7e6859be4ca7806acf21213e185a39ae9199ece9584b2159606163cd264";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson3d_2_form_1::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson3d_2_form_1::num_coefficients() const
 {
     return 1;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson3d_2_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0});
     return position[i];
 }
 
+ufc::finite_element * poisson3d_2_form_1::create_coordinate_finite_element() const
+{
+    return new poisson3d_2_finite_element_1();
+}
+
+ufc::dofmap * poisson3d_2_form_1::create_coordinate_dofmap() const
+{
+    return new poisson3d_2_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson3d_2_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson3d_2_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson3d_2_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_2_finite_element_0();
+        return new poisson3d_2_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_2_finite_element_0();
+        return new poisson3d_2_finite_element_2();
         break;
       }
     }
@@ -3847,19 +8426,18 @@ ufc::finite_element* poisson3d_2_form_1::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson3d_2_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_2_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_2_dofmap_0();
+        return new poisson3d_2_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_2_dofmap_0();
+        return new poisson3d_2_dofmap_2();
         break;
       }
     }
@@ -3867,128 +8445,163 @@ ufc::dofmap* poisson3d_2_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson3d_2_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson3d_2_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson3d_2_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson3d_2_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson3d_2_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson3d_2_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_2_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_2_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson3d_2_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson3d_2_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson3d_2_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson3d_2_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson3d_2_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson3d_2_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_2_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_2_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson3d_2_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson3d_2_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson3d_2_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson3d_2_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson3d_2_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson3d_2_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson3d_2_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson3d_2_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson3d_2_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson3d_2_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson3d_2_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson3d_2_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_2_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson3d_2_form_1::create_default_cell_integral() const
+ufc::cell_integral * poisson3d_2_form_1::create_default_cell_integral() const
 {
     return new poisson3d_2_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson3d_2_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson3d_2_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson3d_2_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson3d_2_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson3d_2_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * poisson3d_2_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson3d_2_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * poisson3d_2_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson3d_2_form_1::create_default_custom_integral() const
+ufc::interface_integral * poisson3d_2_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_2_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/bench/fem/convergence/cpp/Poisson3D_2.h b/bench/fem/convergence/cpp/Poisson3D_2.h
index 5c10af5..47dfc74 100644
--- a/bench/fem/convergence/cpp/Poisson3D_2.h
+++ b/bench/fem/convergence/cpp/Poisson3D_2.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,500 +13,735 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __POISSON3D_2_H
 #define __POISSON3D_2_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson3d_2_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson3d_2_finite_element_0();
 
-  /// Destructor
-  virtual ~poisson3d_2_finite_element_0();
+  ~poisson3d_2_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t space_dimension() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson3d_2_finite_element_1: public ufc::finite_element
+{
+public:
+
+  poisson3d_2_finite_element_1();
+
+  ~poisson3d_2_finite_element_1() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson3d_2_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson3d_2_finite_element_2();
+
+  ~poisson3d_2_finite_element_2() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
+  std::size_t num_sub_elements() const final override;
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class poisson3d_2_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   poisson3d_2_dofmap_0();
 
-  /// Destructor
-  virtual ~poisson3d_2_dofmap_0();
+  ~poisson3d_2_dofmap_0() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson3d_2_dofmap_1: public ufc::dofmap
+{
+public:
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  poisson3d_2_dofmap_1();
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  ~poisson3d_2_dofmap_1() override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  const char * signature() const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson3d_2_dofmap_2: public ufc::dofmap
+{
+public:
+
+  poisson3d_2_dofmap_2();
+
+  ~poisson3d_2_dofmap_2() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
+
+  std::size_t num_facet_dofs() const final override;
+
+  std::size_t num_entity_dofs(std::size_t d) const final override;
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 poisson3d_2_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson3d_2_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~poisson3d_2_cell_integral_0_otherwise();
+  ~poisson3d_2_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 poisson3d_2_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson3d_2_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~poisson3d_2_cell_integral_1_otherwise();
+  ~poisson3d_2_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson3d_2_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson3d_2_form_0();
 
-  /// Destructor
-  virtual ~poisson3d_2_form_0();
+  ~poisson3d_2_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson3d_2_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson3d_2_form_1();
 
-  /// Destructor
-  virtual ~poisson3d_2_form_1();
+  ~poisson3d_2_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -516,14 +751,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson3D_2
 {
@@ -532,43 +773,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -579,43 +797,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -626,63 +821,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_2_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -690,7 +892,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_2_form_0());
+    _ufc_form = std::make_shared<const poisson3d_2_form_0>();
   }
 
   // Destructor
@@ -720,57 +922,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_2_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_2_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_2_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_2_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -778,69 +1035,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_2_form_1());
+    _ufc_form = std::make_shared<const poisson3d_2_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_2_form_1());
+    _ufc_form = std::make_shared<const poisson3d_2_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_2_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_2_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_2_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->f = *f;
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_2_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -872,18 +1170,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/convergence/cpp/Poisson3D_3.cpp b/bench/fem/convergence/cpp/Poisson3D_3.cpp
index 0e99cb0..74d3f42 100644
--- a/bench/fem/convergence/cpp/Poisson3D_3.cpp
+++ b/bench/fem/convergence/cpp/Poisson3D_3.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,81 +13,99 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "Poisson3D_3.h"
 
-/// Constructor
 poisson3d_3_finite_element_0::poisson3d_3_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_3_finite_element_0::~poisson3d_3_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* poisson3d_3_finite_element_0::signature() const
+const char * poisson3d_3_finite_element_0::signature() const
 {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 3, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
 }
 
-/// Return the cell shape
 ufc::shape poisson3d_3_finite_element_0::cell_shape() const
 {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t poisson3d_3_finite_element_0::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t poisson3d_3_finite_element_0::geometric_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t poisson3d_3_finite_element_0::space_dimension() const
 {
-    return 20;
+    return 4;
 }
 
-/// Return the rank of the value space
 std::size_t poisson3d_3_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t poisson3d_3_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
+std::size_t poisson3d_3_finite_element_0::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_3_finite_element_0::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_3_finite_element_0::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_3_finite_element_0::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_3_finite_element_0::degree() const
+{
+    return 1;
+}
+
+const char * poisson3d_3_finite_element_0::family() const
+{
+    return "Lagrange";
+}
+
 void poisson3d_3_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -96,9 +114,9 @@ void poisson3d_3_finite_element_0::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -125,63 +143,27 @@ void poisson3d_3_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0288675134594814, 0.0130410132739326, 0.00752923252421043, 0.00532397137499948, 0.018298126367785, 0.014173667737846, 0.0115727512471569, 0.00818317088384972, 0.00668153104781059, 0.00472455591261533, -0.028347335475692, -0.0239578711874978, -0.0207481250689683, -0.0185576872239523, -0.0160714285714286, -0.0131222664791956, -0.0107142857142857, -0.00927884361197611, -0.00757614408414157, -0.00535714285714285};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -191,63 +173,27 @@ void poisson3d_3_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0288675134594813, -0.0130410132739325, 0.0075292325242104, 0.0053239713749995, 0.018298126367785, -0.014173667737846, -0.0115727512471569, 0.0081831708838497, 0.00668153104781062, 0.00472455591261534, 0.028347335475692, -0.0239578711874977, -0.0207481250689683, 0.0185576872239522, 0.0160714285714286, 0.0131222664791956, -0.0107142857142857, -0.00927884361197613, -0.00757614408414159, -0.00535714285714286};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -257,63 +203,27 @@ void poisson3d_3_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0288675134594812, 0.0, -0.0150584650484209, 0.00532397137499952, 0.0, 0.0, 0.0, 0.0245495126515492, -0.0133630620956212, 0.00472455591261537, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0428571428571429, -0.0278365308359284, 0.0151522881682832, -0.00535714285714288};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -323,620 +233,4792 @@ void poisson3d_3_finite_element_0::_evaluate_basis(std::size_t i,
       {
         
       // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0288675134594813, 0.0, 0.0, -0.0159719141249985, 0.0, 0.0, 0.0, 0.0, 0.0, 0.028347335475692, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0535714285714286};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0, 0.0, 0.112938487863156, -0.063887656499994, 0.0, 0.0, 0.0, 0.0736485379546474, 0.0267261241912424, -0.0236227795630767, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0649519052838329, -0.0606091526731326, 0.0267857142857143};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
+    }
+    
+}
+
+void poisson3d_3_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0, 0.0, -0.0225876975726313, 0.127775312999988, 0.0, 0.0, 0.0, 0.0, 0.0668153104781061, 0.0472455591261534, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0757614408414158, -0.0535714285714286};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0, 0.097807599554494, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0231455024943138, 0.0245495126515491, -0.0133630620956212, -0.0236227795630767, 0.0, 0.0, 0.0484122918275927, 0.0, -0.0375, -0.0524890659167824, 0.0, 0.0216506350946109, 0.0303045763365663, 0.0267857142857143};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0, -0.0195615199108988, 0.0112938487863157, 0.127775312999988, 0.0, 0.0, 0.0578637562357844, 0.0, -0.033407655239053, 0.0472455591261534, 0.0, 0.0, 0.0, 0.0, 0.0, 0.065611332395978, 0.0, 0.0, -0.0378807204207079, -0.0535714285714286};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0, 0.097807599554494, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0462910049886276, -0.0245495126515492, 0.0133630620956212, 0.0236227795630767, 0.0, 0.0479157423749955, -0.00691604168965609, -0.0618589574131742, -0.0160714285714286, 0.00874817765279706, 0.0428571428571429, 0.0154647393532935, 0.0, -0.00535714285714286};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0.0, 0.0566946709513841, -0.0115727512471569, 0.0245495126515492, -0.0467707173346743, 0.0236227795630767, 0.0, 0.0, 0.0, 0.0618589574131742, -0.0214285714285714, 0.00437408882639853, -0.0642857142857143, 0.00927884361197613, 0.00757614408414158, -0.00535714285714285};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, -0.0231455024943137, 0.0245495126515491, -0.0133630620956212, -0.0236227795630767, 0.0, 0.0, 0.0484122918275927, 0.0, 0.0375, 0.0524890659167824, 0.0, 0.021650635094611, 0.0303045763365663, 0.0267857142857143};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
-      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
-      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
-      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[19] *= std::sqrt(2.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[18] *= std::sqrt(4.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[17] *= std::sqrt(6.75);
-      basisvalues[16] *= std::sqrt(9.0);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[15] *= std::sqrt(13.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[14] *= std::sqrt(20.25);
-      basisvalues[13] *= std::sqrt(27.0);
-      basisvalues[4] *= std::sqrt(26.25);
-      basisvalues[12] *= std::sqrt(33.75);
-      basisvalues[11] *= std::sqrt(45.0);
-      basisvalues[10] *= std::sqrt(63.0);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[20] = \
-      {0.0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0.0, 0.0, -0.0578637562357845, 0.0, -0.033407655239053, 0.0472455591261534, 0.0, 0.0, 0.0, 0.0, 0.0, -0.065611332395978, 0.0, 0.0, -0.0378807204207079, -0.0535714285714286};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 20; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 12:
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
         
-      // Array of basisvalues
-      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
-      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_3_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson3d_3_finite_element_0::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson3d_3_finite_element_0::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+}
+
+void poisson3d_3_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+}
+
+void poisson3d_3_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+}
+
+std::size_t poisson3d_3_finite_element_0::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_3_finite_element_0::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_3_finite_element_0::create() const
+{
+    return new poisson3d_3_finite_element_0();
+}
+
+
+poisson3d_3_finite_element_1::poisson3d_3_finite_element_1() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson3d_3_finite_element_1::~poisson3d_3_finite_element_1()
+{
+    // Do nothing
+}
+
+const char * poisson3d_3_finite_element_1::signature() const
+{
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+}
+
+ufc::shape poisson3d_3_finite_element_1::cell_shape() const
+{
+    return ufc::shape::tetrahedron;
+}
+
+std::size_t poisson3d_3_finite_element_1::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_3_finite_element_1::geometric_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_3_finite_element_1::space_dimension() const
+{
+    return 12;
+}
+
+std::size_t poisson3d_3_finite_element_1::value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_3_finite_element_1::value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson3d_3_finite_element_1::value_size() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_3_finite_element_1::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_3_finite_element_1::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t poisson3d_3_finite_element_1::reference_value_size() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_3_finite_element_1::degree() const
+{
+    return 1;
+}
+
+const char * poisson3d_3_finite_element_1::family() const
+{
+    return "Lagrange";
+}
+
+void poisson3d_3_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_3_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void poisson3d_3_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_3_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson3d_3_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson3d_3_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+}
+
+void poisson3d_3_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+}
+
+void poisson3d_3_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+}
+
+std::size_t poisson3d_3_finite_element_1::num_sub_elements() const
+{
+    return 3;
+}
+
+ufc::finite_element * poisson3d_3_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson3d_3_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson3d_3_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson3d_3_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * poisson3d_3_finite_element_1::create() const
+{
+    return new poisson3d_3_finite_element_1();
+}
+
+
+poisson3d_3_finite_element_2::poisson3d_3_finite_element_2() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson3d_3_finite_element_2::~poisson3d_3_finite_element_2()
+{
+    // Do nothing
+}
+
+const char * poisson3d_3_finite_element_2::signature() const
+{
+    return "FiniteElement('Lagrange', tetrahedron, 3)";
+}
+
+ufc::shape poisson3d_3_finite_element_2::cell_shape() const
+{
+    return ufc::shape::tetrahedron;
+}
+
+std::size_t poisson3d_3_finite_element_2::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_3_finite_element_2::geometric_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_3_finite_element_2::space_dimension() const
+{
+    return 20;
+}
+
+std::size_t poisson3d_3_finite_element_2::value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_3_finite_element_2::value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_3_finite_element_2::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_3_finite_element_2::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_3_finite_element_2::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_3_finite_element_2::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_3_finite_element_2::degree() const
+{
+    return 3;
+}
+
+const char * poisson3d_3_finite_element_2::family() const
+{
+    return "Lagrange";
+}
+
+void poisson3d_3_finite_element_2::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0288675134594814, 0.0130410132739326, 0.00752923252421043, 0.00532397137499948, 0.018298126367785, 0.014173667737846, 0.0115727512471569, 0.00818317088384972, 0.00668153104781059, 0.00472455591261533, -0.028347335475692, -0.0239578711874978, -0.0207481250689683, -0.0185576872239523, -0.0160714285714286, -0.0131222664791956, -0.0107142857142857, -0.00927884361197611, -0.00757614408414157, -0.00535714285714285};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0288675134594813, -0.0130410132739325, 0.0075292325242104, 0.0053239713749995, 0.018298126367785, -0.014173667737846, -0.0115727512471569, 0.0081831708838497, 0.00668153104781062, 0.00472455591261534, 0.028347335475692, -0.0239578711874977, -0.0207481250689683, 0.0185576872239522, 0.0160714285714286, 0.0131222664791956, -0.0107142857142857, -0.00927884361197613, -0.00757614408414159, -0.00535714285714286};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0288675134594812, 0.0, -0.0150584650484209, 0.00532397137499952, 0.0, 0.0, 0.0, 0.0245495126515492, -0.0133630620956212, 0.00472455591261537, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0428571428571429, -0.0278365308359284, 0.0151522881682832, -0.00535714285714288};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0288675134594813, 0.0, 0.0, -0.0159719141249985, 0.0, 0.0, 0.0, 0.0, 0.0, 0.028347335475692, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0535714285714286};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0, 0.0, 0.112938487863156, -0.063887656499994, 0.0, 0.0, 0.0, 0.0736485379546474, 0.0267261241912424, -0.0236227795630767, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0649519052838329, -0.0606091526731326, 0.0267857142857143};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0, 0.0, -0.0225876975726313, 0.127775312999988, 0.0, 0.0, 0.0, 0.0, 0.0668153104781061, 0.0472455591261534, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0757614408414158, -0.0535714285714286};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0, 0.097807599554494, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0231455024943138, 0.0245495126515491, -0.0133630620956212, -0.0236227795630767, 0.0, 0.0, 0.0484122918275927, 0.0, -0.0375, -0.0524890659167824, 0.0, 0.0216506350946109, 0.0303045763365663, 0.0267857142857143};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0, -0.0195615199108988, 0.0112938487863157, 0.127775312999988, 0.0, 0.0, 0.0578637562357844, 0.0, -0.033407655239053, 0.0472455591261534, 0.0, 0.0, 0.0, 0.0, 0.0, 0.065611332395978, 0.0, 0.0, -0.0378807204207079, -0.0535714285714286};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0, 0.097807599554494, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0462910049886276, -0.0245495126515492, 0.0133630620956212, 0.0236227795630767, 0.0, 0.0479157423749955, -0.00691604168965609, -0.0618589574131742, -0.0160714285714286, 0.00874817765279706, 0.0428571428571429, 0.0154647393532935, 0.0, -0.00535714285714286};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0.0, 0.0566946709513841, -0.0115727512471569, 0.0245495126515492, -0.0467707173346743, 0.0236227795630767, 0.0, 0.0, 0.0, 0.0618589574131742, -0.0214285714285714, 0.00437408882639853, -0.0642857142857143, 0.00927884361197613, 0.00757614408414158, -0.00535714285714285};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, -0.0231455024943137, 0.0245495126515491, -0.0133630620956212, -0.0236227795630767, 0.0, 0.0, 0.0484122918275927, 0.0, 0.0375, 0.0524890659167824, 0.0, 0.021650635094611, 0.0303045763365663, 0.0267857142857143};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[14] = (4.0*Z + 3.0)*basisvalues[5];
+      basisvalues[12] = (4.0*Z + 3.0)*basisvalues[4];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[19] = basisvalues[9]*(0.155555555555556 + 1.86666666666667*Z) - 0.711111111111111*basisvalues[3];
+      basisvalues[18] = basisvalues[8]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[2];
+      basisvalues[15] = basisvalues[6]*(0.777777777777778 + 2.33333333333333*Z) - 0.555555555555556*basisvalues[1];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[19] *= std::sqrt(2.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[18] *= std::sqrt(4.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[17] *= std::sqrt(6.75);
+      basisvalues[16] *= std::sqrt(9.0);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[15] *= std::sqrt(13.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[14] *= std::sqrt(20.25);
+      basisvalues[13] *= std::sqrt(27.0);
+      basisvalues[4] *= std::sqrt(26.25);
+      basisvalues[12] *= std::sqrt(33.75);
+      basisvalues[11] *= std::sqrt(45.0);
+      basisvalues[10] *= std::sqrt(63.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[20] = \
+      {0.0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0.0, 0.0, -0.0578637562357845, 0.0, -0.033407655239053, 0.0472455591261534, 0.0, 0.0, 0.0, 0.0, 0.0, -0.065611332395978, 0.0, 0.0, -0.0378807204207079, -0.0535714285714286};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 20; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 12:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[20] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[10] = 1.66666666666667*tmp0*basisvalues[4] - 0.666666666666667*tmp1*basisvalues[1];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[11] = (0.5*(2.0 + 3.0*Y + Z) + 2.0*(1.0 + Y))*basisvalues[4];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[16] = (1.75*tmp2 + 0.05*tmp3)*basisvalues[7] - 0.7*tmp4*basisvalues[2];
+      basisvalues[13] = (2.1*tmp2 + 0.54*tmp3)*basisvalues[5] - 0.56*tmp4*basisvalues[1];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
       basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
       basisvalues[17] = (4.0*Z + 3.0)*basisvalues[7];
@@ -1445,10 +5527,9 @@ void poisson3d_3_finite_element_0::_evaluate_basis(std::size_t i,
     
 }
 
-/// Evaluate all basis functions at given point x in cell
-void poisson3d_3_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void poisson3d_3_finite_element_2::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
@@ -1457,17 +5538,16 @@ void poisson3d_3_finite_element_0::_evaluate_basis_all(double* values,
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 20; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
+void poisson3d_3_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
     
@@ -1487,7 +5567,7 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1499,7 +5579,7 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1508,9 +5588,9 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1649,12 +5729,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -1665,21 +5745,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -1687,22 +5767,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -1922,12 +6002,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -1938,21 +6018,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -1960,22 +6040,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -2195,12 +6275,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -2211,21 +6291,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -2233,22 +6313,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -2468,12 +6548,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -2484,21 +6564,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -2506,22 +6586,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -2741,12 +6821,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -2757,21 +6837,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -2779,22 +6859,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -3014,12 +7094,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -3030,21 +7110,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -3052,22 +7132,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -3287,12 +7367,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -3303,21 +7383,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -3325,22 +7405,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -3560,12 +7640,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -3576,21 +7656,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -3598,22 +7678,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -3833,12 +7913,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -3849,21 +7929,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -3871,22 +7951,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -4106,12 +8186,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4122,21 +8202,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -4144,22 +8224,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -4379,12 +8459,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4395,21 +8475,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -4417,22 +8497,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -4652,12 +8732,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4668,21 +8748,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -4690,22 +8770,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -4925,12 +9005,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4941,21 +9021,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -4963,22 +9043,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -5198,12 +9278,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5214,21 +9294,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -5236,22 +9316,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -5471,12 +9551,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5487,21 +9567,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -5509,22 +9589,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -5744,12 +9824,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5760,21 +9840,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -5782,22 +9862,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -6017,12 +10097,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6033,21 +10113,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -6055,22 +10135,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -6290,12 +10370,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6306,21 +10386,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -6328,22 +10408,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -6563,12 +10643,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6579,21 +10659,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -6601,22 +10681,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -6836,12 +10916,12 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.499090833947, -5.53813932713574e-14, -3.34664010613631, -2.36643191323986, 15.4919333848297, 0.0, 0.0, 0.69282032302755, 0.565685424949236, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.89897948556636, 0.0, 0.0, 0.0, 14.1985914794391, -0.828078671210825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.01001114482861e-14, 0.0, 0.0},
-      {0.0, 4.24264068711929, 0.0, 1.33226762955019e-14, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.60000000000003, 0.0, 8.76356092008268, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283194, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725906, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.54558441227155, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.499090833947, -7.24788278505848e-14, -3.3466401061363, -2.36643191323985, 15.4919333848297, 1.7207085272731e-14, 1.22691973515832e-14, 0.692820323027546, 0.565685424949234, 0.399999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.89897948556635, 1.04599536787902e-14, 0.0, 0.0, 14.1985914794391, -0.828078671210823, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.24264068711929, 0.0, 0.0, 0.0, 0.0, 14.3427433120127, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.60000000000003, 0.0, 8.76356092008269, -1.54919333848298, 0.0, 0.0, 0.0, 9.52470471983255, -1.48131215963608, 0.261861468283193, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.11769145362398, 0.0, 3.16227766016838, 4.91934955049954, 0.0, 0.0, 0.0, 0.0, 10.690449676497, -2.41897262725905, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.54558441227156, 0.0, 0.0, 7.66811580507229, 0.0, 0.0, 0.0, 0.0, 0.0, 10.3691851174526, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6852,21 +10932,21 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.47722557505167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063983, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106463, 0.0, 9.66091783079296, 0.683130051063984, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880669, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1.00000000000001, 9.16515138991168, 7.09929573971953, -0.414039335605413, -2.04939015319192, -0.478091443733758, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.408248290463865, 3.17542648054294, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, -5.69209978830309, 4.38178046004133, -0.774596669241492, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818041, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362952, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772444, 2.44948974278317, 2.82842712474619, -1.0, 9.16515138991168, 7.09929573971954, -0.414039335605412, -2.04939015319193, -0.478091443733757, 0.169030850945701, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355965, -0.408248290463862, 3.17542648054295, 0.0, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.80000000000001, -5.6920997883031, 4.38178046004132, -0.774596669241486, 0.0, 10.998181667894, 0.962140470884732, 4.76235235991626, -0.740656079818037, 0.130930734141594, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0.0, 0.0, 9.25820099772552, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.27279220613578, 0.0, 0.0, 3.83405790253615, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.19615242270666, 0.0, -3.16227766016841, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824853, 0.377964473009228, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721878, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.20454076850485, 0.0, 0.0, 6.64078308635358, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.19615242270666, 0.0, -3.16227766016842, -2.2360679774998, 0.0, 0.0, 0.0, 13.7477270848675, 0.534522483824856, 0.37796447300923, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-1.80000000000001, 0.0, 3.65148371670111, -2.84018778721879, 0.0, 0.0, 0.0, 0.0, 12.3442679969674, 1.39659449751035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.02140518265514e-14},
+      {2.20454076850485, 0.0, 0.0, 6.64078308635357, 0.0, 0.0, 0.0, 0.0, 0.0, 8.97997772825747, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats2[20][20] = \
@@ -6874,22 +10954,22 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.82574185835056, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494323, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016092, -1.08012344973464, -0.763762615825973, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309962, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.341565025531992, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971955, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973465, -0.763762615825974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971954, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912992, 0.0, 0.0, 8.87411967464944, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.74954541697348, 5.79655069847574, -1.67332005306814, -1.18321595661992, 7.74596669241484, -1.2, -0.979795897113266, 0.346410161513775, 0.282842712474617, 0.199999999999999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141596, 7.09929573971954, -0.414039335605412, -2.04939015319192, -0.478091443733757, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.01246117974981, 2.12132034355965, -0.40824829046387, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671766, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.80000000000001, 0.632455532033673, 4.38178046004132, -0.774596669241488, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.74065607981804, 0.130930734141597, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.55884572681199, 0.547722557505166, 1.5811388300842, 2.45967477524977, 0.0, 9.07114735222145, 1.8516401995451, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.27279220613578, -6.26099033699944, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.1845925587263, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.03923048454133, 0.0, 3.16227766016836, -0.44721359549996, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824846, 0.075592894601846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.9, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878696, -0.698297248755178, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.74954541697347, 5.79655069847574, -1.67332005306814, -1.18321595661991, 7.74596669241484, -1.19999999999999, -0.979795897113266, 0.346410161513771, 0.282842712474616, 0.199999999999997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.32379000772445, 2.44948974278318, 2.82842712474619, -0.999999999999999, 1.30930734141596, 7.09929573971954, -0.414039335605411, -2.04939015319192, -0.478091443733756, 0.169030850945702, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.01246117974981, 2.12132034355964, -0.40824829046386, 3.17542648054294, 9.07114735222145, 0.0, 7.17137165600637, 0.0, -1.38013111868471, -1.56144011671765, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.8, 0.632455532033672, 4.38178046004132, -0.774596669241485, 0.0, 3.14233761939829, -0.106904496764969, 4.76235235991626, -0.740656079818038, 0.130930734141596, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.55884572681199, 0.547722557505162, 1.58113883008419, 2.45967477524977, 0.0, 9.07114735222145, 1.85164019954511, 0.0, 5.34522483824849, -1.20948631362953, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.27279220613578, -6.26099033699945, 0.0, 3.83405790253615, 0.0, 0.0, 10.5830052442584, 0.0, 0.0, 5.18459255872629, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.03923048454133, 0.0, 3.16227766016836, -0.447213595499961, 0.0, 0.0, 0.0, 5.89188303637179, -0.534522483824845, 0.0755928946018462, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.899999999999999, 0.0, 1.46059348668037, 1.42009389360939, 0.0, 0.0, 0.0, 9.07114735222143, 4.93770719878697, -0.698297248755176, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.734846922834949, 0.0, -6.26099033699947, 2.21359436211785, 0.0, 0.0, 0.0, 0.0, 10.5830052442584, 2.99332590941915, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.71576766497728, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {5.71576766497729, 0.0, 0.0, -4.69574275274956, 0.0, 0.0, 0.0, 0.0, 0.0, 12.69960629311, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -7031,452 +11111,992 @@ void poisson3d_3_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_3_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 20; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 3)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[27];
+    for (unsigned int r = 0; r < 27; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 20; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson3d_3_finite_element_2::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[6] + 0.333333333333333*coordinate_dofs[9];
+      y[1] = 0.666666666666667*coordinate_dofs[7] + 0.333333333333333*coordinate_dofs[10];
+      y[2] = 0.666666666666667*coordinate_dofs[8] + 0.333333333333333*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[6] + 0.666666666666667*coordinate_dofs[9];
+      y[1] = 0.333333333333333*coordinate_dofs[7] + 0.666666666666667*coordinate_dofs[10];
+      y[2] = 0.333333333333333*coordinate_dofs[8] + 0.666666666666667*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[9];
+      y[1] = 0.666666666666667*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[10];
+      y[2] = 0.666666666666667*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[9];
+      y[1] = 0.333333333333333*coordinate_dofs[4] + 0.666666666666667*coordinate_dofs[10];
+      y[2] = 0.333333333333333*coordinate_dofs[5] + 0.666666666666667*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[6];
+      y[1] = 0.666666666666667*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[7];
+      y[2] = 0.666666666666667*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[6];
+      y[1] = 0.333333333333333*coordinate_dofs[4] + 0.666666666666667*coordinate_dofs[7];
+      y[2] = 0.333333333333333*coordinate_dofs[5] + 0.666666666666667*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[9];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[10];
+      y[2] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[9];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[10];
+      y[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 12:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[6];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[7];
+      y[2] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 13:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[6];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[7];
+      y[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 14:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[3];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[4];
+      y[2] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 15:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[3];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[4];
+      y[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 16:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[6] + 0.333333333333333*coordinate_dofs[9];
+      y[1] = 0.333333333333333*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[7] + 0.333333333333333*coordinate_dofs[10];
+      y[2] = 0.333333333333333*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[8] + 0.333333333333333*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 17:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[6] + 0.333333333333333*coordinate_dofs[9];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[7] + 0.333333333333333*coordinate_dofs[10];
+      y[2] = 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[8] + 0.333333333333333*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 18:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[9];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[10];
+      y[2] = 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 19:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[6];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[7];
+      y[2] = 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     }
     
+    return 0.0;
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void poisson3d_3_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
-                                                    int cell_orientation)
+void poisson3d_3_finite_element_2::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
 {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
+    // Declare variables for result of evaluation
+    double vals[1];
     
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[6] + 0.333333333333333*coordinate_dofs[9];
+    y[1] = 0.666666666666667*coordinate_dofs[7] + 0.333333333333333*coordinate_dofs[10];
+    y[2] = 0.666666666666667*coordinate_dofs[8] + 0.333333333333333*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[6] + 0.666666666666667*coordinate_dofs[9];
+    y[1] = 0.333333333333333*coordinate_dofs[7] + 0.666666666666667*coordinate_dofs[10];
+    y[2] = 0.333333333333333*coordinate_dofs[8] + 0.666666666666667*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[9];
+    y[1] = 0.666666666666667*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[10];
+    y[2] = 0.666666666666667*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[9];
+    y[1] = 0.333333333333333*coordinate_dofs[4] + 0.666666666666667*coordinate_dofs[10];
+    y[2] = 0.333333333333333*coordinate_dofs[5] + 0.666666666666667*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[6];
+    y[1] = 0.666666666666667*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[7];
+    y[2] = 0.666666666666667*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[6];
+    y[1] = 0.333333333333333*coordinate_dofs[4] + 0.666666666666667*coordinate_dofs[7];
+    y[2] = 0.333333333333333*coordinate_dofs[5] + 0.666666666666667*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[9];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[10];
+    y[2] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[10] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[9];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[10];
+    y[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[6];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[7];
+    y[2] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[12] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[6];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[7];
+    y[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[13] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[3];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[4];
+    y[2] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[14] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[3];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[4];
+    y[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[15] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[6] + 0.333333333333333*coordinate_dofs[9];
+    y[1] = 0.333333333333333*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[7] + 0.333333333333333*coordinate_dofs[10];
+    y[2] = 0.333333333333333*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[8] + 0.333333333333333*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[16] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[6] + 0.333333333333333*coordinate_dofs[9];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[7] + 0.333333333333333*coordinate_dofs[10];
+    y[2] = 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[8] + 0.333333333333333*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[17] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[9];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[10];
+    y[2] = 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[18] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[6];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[7];
+    y[2] = 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[19] = vals[0];
+}
+
+void poisson3d_3_finite_element_2::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+}
+
+void poisson3d_3_finite_element_2::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.666666666666667*coordinate_dofs[6] + 0.333333333333333*coordinate_dofs[9];
+    dof_coordinates[13] = 0.666666666666667*coordinate_dofs[7] + 0.333333333333333*coordinate_dofs[10];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[8] + 0.333333333333333*coordinate_dofs[11];
+    dof_coordinates[15] = 0.333333333333333*coordinate_dofs[6] + 0.666666666666667*coordinate_dofs[9];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[7] + 0.666666666666667*coordinate_dofs[10];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[8] + 0.666666666666667*coordinate_dofs[11];
+    dof_coordinates[18] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[9];
+    dof_coordinates[19] = 0.666666666666667*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[10];
+    dof_coordinates[20] = 0.666666666666667*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[11];
+    dof_coordinates[21] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[9];
+    dof_coordinates[22] = 0.333333333333333*coordinate_dofs[4] + 0.666666666666667*coordinate_dofs[10];
+    dof_coordinates[23] = 0.333333333333333*coordinate_dofs[5] + 0.666666666666667*coordinate_dofs[11];
+    dof_coordinates[24] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[6];
+    dof_coordinates[25] = 0.666666666666667*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[7];
+    dof_coordinates[26] = 0.666666666666667*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[8];
+    dof_coordinates[27] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[6];
+    dof_coordinates[28] = 0.333333333333333*coordinate_dofs[4] + 0.666666666666667*coordinate_dofs[7];
+    dof_coordinates[29] = 0.333333333333333*coordinate_dofs[5] + 0.666666666666667*coordinate_dofs[8];
+    dof_coordinates[30] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[9];
+    dof_coordinates[31] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[10];
+    dof_coordinates[32] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[11];
+    dof_coordinates[33] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[9];
+    dof_coordinates[34] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[10];
+    dof_coordinates[35] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[11];
+    dof_coordinates[36] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[6];
+    dof_coordinates[37] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[7];
+    dof_coordinates[38] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[8];
+    dof_coordinates[39] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[6];
+    dof_coordinates[40] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[7];
+    dof_coordinates[41] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[8];
+    dof_coordinates[42] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[43] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[44] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[45] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[46] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[47] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[48] = 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[6] + 0.333333333333333*coordinate_dofs[9];
+    dof_coordinates[49] = 0.333333333333333*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[7] + 0.333333333333333*coordinate_dofs[10];
+    dof_coordinates[50] = 0.333333333333333*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[8] + 0.333333333333333*coordinate_dofs[11];
+    dof_coordinates[51] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[6] + 0.333333333333333*coordinate_dofs[9];
+    dof_coordinates[52] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[7] + 0.333333333333333*coordinate_dofs[10];
+    dof_coordinates[53] = 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[8] + 0.333333333333333*coordinate_dofs[11];
+    dof_coordinates[54] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[9];
+    dof_coordinates[55] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[10];
+    dof_coordinates[56] = 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[11];
+    dof_coordinates[57] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[6];
+    dof_coordinates[58] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[4] + 0.333333333333333*coordinate_dofs[7];
+    dof_coordinates[59] = 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[5] + 0.333333333333333*coordinate_dofs[8];
+}
+
+std::size_t poisson3d_3_finite_element_2::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_3_finite_element_2::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_3_finite_element_2::create() const
+{
+    return new poisson3d_3_finite_element_2();
+}
+
+
+poisson3d_3_dofmap_0::poisson3d_3_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson3d_3_dofmap_0::~poisson3d_3_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * poisson3d_3_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+}
+
+bool poisson3d_3_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
     {
-      num_derivatives *= 3;
-    } // end loop over 'r'
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
     
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 20; r++)
+    return false;
+}
+
+std::size_t poisson3d_3_dofmap_0::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_3_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t poisson3d_3_dofmap_0::num_element_dofs() const
+{
+    return 4;
+}
+
+std::size_t poisson3d_3_dofmap_0::num_facet_dofs() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_3_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
+    return 0;
+}
+
+void poisson3d_3_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+}
+
+void poisson3d_3_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
     {
-      return ;
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[27];
-    for (unsigned int r = 0; r < 27; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 20; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
 }
 
-/// Evaluate linear functional for dof i on the function f
-double poisson3d_3_finite_element_0::evaluate_dof(std::size_t i,
-                                   const ufc::function& f,
-                                   const double* vertex_coordinates,
-                                   int cell_orientation,
-                                   const ufc::cell& c) const
+void poisson3d_3_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
 {
-    // Declare variables for result of evaluation
-    double vals[1];
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
     
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 4:
+    }
+    
+}
+
+std::size_t poisson3d_3_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson3d_3_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson3d_3_dofmap_0::create() const
+{
+    return new poisson3d_3_dofmap_0();
+}
+
+
+poisson3d_3_dofmap_1::poisson3d_3_dofmap_1() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson3d_3_dofmap_1::~poisson3d_3_dofmap_1()
+{
+    // Do nothing
+}
+
+const char * poisson3d_3_dofmap_1::signature() const
+{
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+}
+
+bool poisson3d_3_dofmap_1::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[6] + 0.333333333333333*vertex_coordinates[9];
-      y[1] = 0.666666666666667*vertex_coordinates[7] + 0.333333333333333*vertex_coordinates[10];
-      y[2] = 0.666666666666667*vertex_coordinates[8] + 0.333333333333333*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return true;
         break;
       }
-    case 5:
+    case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[6] + 0.666666666666667*vertex_coordinates[9];
-      y[1] = 0.333333333333333*vertex_coordinates[7] + 0.666666666666667*vertex_coordinates[10];
-      y[2] = 0.333333333333333*vertex_coordinates[8] + 0.666666666666667*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
-    case 6:
+    case 2:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[9];
-      y[1] = 0.666666666666667*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[10];
-      y[2] = 0.666666666666667*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
-    case 7:
+    case 3:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[9];
-      y[1] = 0.333333333333333*vertex_coordinates[4] + 0.666666666666667*vertex_coordinates[10];
-      y[2] = 0.333333333333333*vertex_coordinates[5] + 0.666666666666667*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
-    case 8:
+    }
+    
+    return false;
+}
+
+std::size_t poisson3d_3_dofmap_1::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_3_dofmap_1::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return 3*num_global_entities[0];
+}
+
+std::size_t poisson3d_3_dofmap_1::num_element_dofs() const
+{
+    return 12;
+}
+
+std::size_t poisson3d_3_dofmap_1::num_facet_dofs() const
+{
+    return 9;
+}
+
+std::size_t poisson3d_3_dofmap_1::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[6];
-      y[1] = 0.666666666666667*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[7];
-      y[2] = 0.666666666666667*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 3;
         break;
       }
-    case 9:
+    case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[6];
-      y[1] = 0.333333333333333*vertex_coordinates[4] + 0.666666666666667*vertex_coordinates[7];
-      y[2] = 0.333333333333333*vertex_coordinates[5] + 0.666666666666667*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 10:
+    case 2:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[9];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[10];
-      y[2] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 11:
+    case 3:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[9];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[10];
-      y[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 12:
+    }
+    
+    return 0;
+}
+
+void poisson3d_3_dofmap_1::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+}
+
+void poisson3d_3_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[6];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[7];
-      y[2] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
-    case 13:
+    case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[6];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[7];
-      y[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
-    case 14:
+    case 2:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[3];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[4];
-      y[2] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
         break;
       }
-    case 15:
+    case 3:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[3];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[4];
-      y[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
         break;
       }
-    case 16:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[6] + 0.333333333333333*vertex_coordinates[9];
-      y[1] = 0.333333333333333*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[7] + 0.333333333333333*vertex_coordinates[10];
-      y[2] = 0.333333333333333*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[8] + 0.333333333333333*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+    }
+    
+}
+
+void poisson3d_3_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
         break;
       }
-    case 17:
+    case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[6] + 0.333333333333333*vertex_coordinates[9];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[7] + 0.333333333333333*vertex_coordinates[10];
-      y[2] = 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[8] + 0.333333333333333*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 18:
+    case 2:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[9];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[10];
-      y[2] = 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 19:
+    case 3:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[6];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[7];
-      y[2] = 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-}
-
-/// Evaluate linear functionals for all dofs on the function f
-void poisson3d_3_finite_element_0::evaluate_dofs(double* values,
-                                  const ufc::function& f,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation,
-                                  const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[6] + 0.333333333333333*vertex_coordinates[9];
-    y[1] = 0.666666666666667*vertex_coordinates[7] + 0.333333333333333*vertex_coordinates[10];
-    y[2] = 0.666666666666667*vertex_coordinates[8] + 0.333333333333333*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[6] + 0.666666666666667*vertex_coordinates[9];
-    y[1] = 0.333333333333333*vertex_coordinates[7] + 0.666666666666667*vertex_coordinates[10];
-    y[2] = 0.333333333333333*vertex_coordinates[8] + 0.666666666666667*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[9];
-    y[1] = 0.666666666666667*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[10];
-    y[2] = 0.666666666666667*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[9];
-    y[1] = 0.333333333333333*vertex_coordinates[4] + 0.666666666666667*vertex_coordinates[10];
-    y[2] = 0.333333333333333*vertex_coordinates[5] + 0.666666666666667*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[6];
-    y[1] = 0.666666666666667*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[7];
-    y[2] = 0.666666666666667*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[6];
-    y[1] = 0.333333333333333*vertex_coordinates[4] + 0.666666666666667*vertex_coordinates[7];
-    y[2] = 0.333333333333333*vertex_coordinates[5] + 0.666666666666667*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[9];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[10];
-    y[2] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[10] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[9];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[10];
-    y[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[11] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[6];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[7];
-    y[2] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[12] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[6];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[7];
-    y[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[13] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[3];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[4];
-    y[2] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[14] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[3];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[4];
-    y[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[15] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[6] + 0.333333333333333*vertex_coordinates[9];
-    y[1] = 0.333333333333333*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[7] + 0.333333333333333*vertex_coordinates[10];
-    y[2] = 0.333333333333333*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[8] + 0.333333333333333*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[16] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[6] + 0.333333333333333*vertex_coordinates[9];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[7] + 0.333333333333333*vertex_coordinates[10];
-    y[2] = 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[8] + 0.333333333333333*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[17] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[9];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[10];
-    y[2] = 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[18] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[6];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[7];
-    y[2] = 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[19] = vals[0];
-}
-
-/// Interpolate vertex values from dof values
-void poisson3d_3_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation,
-                                              const ufc::cell& c) const
-{
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-}
-
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void poisson3d_3_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
 }
 
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void poisson3d_3_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+std::size_t poisson3d_3_dofmap_1::num_sub_dofmaps() const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 3;
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t poisson3d_3_finite_element_0::num_sub_elements() const
+ufc::dofmap * poisson3d_3_dofmap_1::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson3d_3_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson3d_3_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson3d_3_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* poisson3d_3_finite_element_0::create_sub_element(std::size_t i) const
+ufc::dofmap * poisson3d_3_dofmap_1::create() const
 {
-    return 0;
+    return new poisson3d_3_dofmap_1();
 }
 
-/// Create a new class instance
-ufc::finite_element* poisson3d_3_finite_element_0::create() const
-{
-    return new poisson3d_3_finite_element_0();
-}
 
-/// Constructor
-poisson3d_3_dofmap_0::poisson3d_3_dofmap_0() : ufc::dofmap()
+poisson3d_3_dofmap_2::poisson3d_3_dofmap_2() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-poisson3d_3_dofmap_0::~poisson3d_3_dofmap_0()
+poisson3d_3_dofmap_2::~poisson3d_3_dofmap_2()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* poisson3d_3_dofmap_0::signature() const
+const char * poisson3d_3_dofmap_2::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 3, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 3)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool poisson3d_3_dofmap_0::needs_mesh_entities(std::size_t d) const
+bool poisson3d_3_dofmap_2::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
@@ -7505,39 +12125,28 @@ bool poisson3d_3_dofmap_0::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t poisson3d_3_dofmap_0::topological_dimension() const
-{
-    return 3;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t poisson3d_3_dofmap_0::geometric_dimension() const
+std::size_t poisson3d_3_dofmap_2::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t poisson3d_3_dofmap_0::global_dimension(const std::vector<std::size_t>&
+std::size_t poisson3d_3_dofmap_2::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
     return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t poisson3d_3_dofmap_0::num_element_dofs() const
+std::size_t poisson3d_3_dofmap_2::num_element_dofs() const
 {
     return 20;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t poisson3d_3_dofmap_0::num_facet_dofs() const
+std::size_t poisson3d_3_dofmap_2::num_facet_dofs() const
 {
     return 10;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t poisson3d_3_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t poisson3d_3_dofmap_2::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
@@ -7566,39 +12175,37 @@ std::size_t poisson3d_3_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void poisson3d_3_dofmap_0::tabulate_dofs(std::size_t* dofs,
+void poisson3d_3_dofmap_2::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + 2*c.entity_indices[1][0];
-    dofs[5] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[6] = offset + 2*c.entity_indices[1][1];
-    dofs[7] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[8] = offset + 2*c.entity_indices[1][2];
-    dofs[9] = offset + 2*c.entity_indices[1][2] + 1;
-    dofs[10] = offset + 2*c.entity_indices[1][3];
-    dofs[11] = offset + 2*c.entity_indices[1][3] + 1;
-    dofs[12] = offset + 2*c.entity_indices[1][4];
-    dofs[13] = offset + 2*c.entity_indices[1][4] + 1;
-    dofs[14] = offset + 2*c.entity_indices[1][5];
-    dofs[15] = offset + 2*c.entity_indices[1][5] + 1;
+    dofs[4] = offset + 2*entity_indices[1][0];
+    dofs[5] = offset + 2*entity_indices[1][0] + 1;
+    dofs[6] = offset + 2*entity_indices[1][1];
+    dofs[7] = offset + 2*entity_indices[1][1] + 1;
+    dofs[8] = offset + 2*entity_indices[1][2];
+    dofs[9] = offset + 2*entity_indices[1][2] + 1;
+    dofs[10] = offset + 2*entity_indices[1][3];
+    dofs[11] = offset + 2*entity_indices[1][3] + 1;
+    dofs[12] = offset + 2*entity_indices[1][4];
+    dofs[13] = offset + 2*entity_indices[1][4] + 1;
+    dofs[14] = offset + 2*entity_indices[1][5];
+    dofs[15] = offset + 2*entity_indices[1][5] + 1;
     offset += 2*num_global_entities[1];
-    dofs[16] = offset + c.entity_indices[2][0];
-    dofs[17] = offset + c.entity_indices[2][1];
-    dofs[18] = offset + c.entity_indices[2][2];
-    dofs[19] = offset + c.entity_indices[2][3];
+    dofs[16] = offset + entity_indices[2][0];
+    dofs[17] = offset + entity_indices[2][1];
+    dofs[18] = offset + entity_indices[2][2];
+    dofs[19] = offset + entity_indices[2][3];
     offset += num_global_entities[2];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void poisson3d_3_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
+void poisson3d_3_dofmap_2::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
@@ -7663,8 +12270,7 @@ void poisson3d_3_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void poisson3d_3_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
+void poisson3d_3_dofmap_2::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 3)
@@ -7798,113 +12404,41 @@ void poisson3d_3_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void poisson3d_3_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.666666666666667*vertex_coordinates[6] + 0.333333333333333*vertex_coordinates[9];
-    dof_coordinates[13] = 0.666666666666667*vertex_coordinates[7] + 0.333333333333333*vertex_coordinates[10];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[8] + 0.333333333333333*vertex_coordinates[11];
-    dof_coordinates[15] = 0.333333333333333*vertex_coordinates[6] + 0.666666666666667*vertex_coordinates[9];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[7] + 0.666666666666667*vertex_coordinates[10];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[8] + 0.666666666666667*vertex_coordinates[11];
-    dof_coordinates[18] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[9];
-    dof_coordinates[19] = 0.666666666666667*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[10];
-    dof_coordinates[20] = 0.666666666666667*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[11];
-    dof_coordinates[21] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[9];
-    dof_coordinates[22] = 0.333333333333333*vertex_coordinates[4] + 0.666666666666667*vertex_coordinates[10];
-    dof_coordinates[23] = 0.333333333333333*vertex_coordinates[5] + 0.666666666666667*vertex_coordinates[11];
-    dof_coordinates[24] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[6];
-    dof_coordinates[25] = 0.666666666666667*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[7];
-    dof_coordinates[26] = 0.666666666666667*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[8];
-    dof_coordinates[27] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[6];
-    dof_coordinates[28] = 0.333333333333333*vertex_coordinates[4] + 0.666666666666667*vertex_coordinates[7];
-    dof_coordinates[29] = 0.333333333333333*vertex_coordinates[5] + 0.666666666666667*vertex_coordinates[8];
-    dof_coordinates[30] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[9];
-    dof_coordinates[31] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[10];
-    dof_coordinates[32] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[11];
-    dof_coordinates[33] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[9];
-    dof_coordinates[34] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[10];
-    dof_coordinates[35] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[11];
-    dof_coordinates[36] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[6];
-    dof_coordinates[37] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[7];
-    dof_coordinates[38] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[8];
-    dof_coordinates[39] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[6];
-    dof_coordinates[40] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[7];
-    dof_coordinates[41] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[8];
-    dof_coordinates[42] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[43] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[44] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[45] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[46] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[47] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[48] = 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[6] + 0.333333333333333*vertex_coordinates[9];
-    dof_coordinates[49] = 0.333333333333333*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[7] + 0.333333333333333*vertex_coordinates[10];
-    dof_coordinates[50] = 0.333333333333333*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[8] + 0.333333333333333*vertex_coordinates[11];
-    dof_coordinates[51] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[6] + 0.333333333333333*vertex_coordinates[9];
-    dof_coordinates[52] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[7] + 0.333333333333333*vertex_coordinates[10];
-    dof_coordinates[53] = 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[8] + 0.333333333333333*vertex_coordinates[11];
-    dof_coordinates[54] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[9];
-    dof_coordinates[55] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[10];
-    dof_coordinates[56] = 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[11];
-    dof_coordinates[57] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[6];
-    dof_coordinates[58] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[4] + 0.333333333333333*vertex_coordinates[7];
-    dof_coordinates[59] = 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[5] + 0.333333333333333*vertex_coordinates[8];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t poisson3d_3_dofmap_0::num_sub_dofmaps() const
+std::size_t poisson3d_3_dofmap_2::num_sub_dofmaps() const
 {
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* poisson3d_3_dofmap_0::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_3_dofmap_2::create_sub_dofmap(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* poisson3d_3_dofmap_0::create() const
+ufc::dofmap * poisson3d_3_dofmap_2::create() const
 {
-    return new poisson3d_3_dofmap_0();
+    return new poisson3d_3_dofmap_2();
 }
 
-/// Constructor
+
 poisson3d_3_cell_integral_0_otherwise::poisson3d_3_cell_integral_0_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson3d_3_cell_integral_0_otherwise::~poisson3d_3_cell_integral_0_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson3d_3_cell_integral_0_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson3d_3_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson3d_3_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -7914,7 +12448,7 @@ void poisson3d_3_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7936,67 +12470,67 @@ void poisson3d_3_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
     
     // Compute element tensor
-    A[0] = 0.0595238095238096*G0_0_0 + 0.0595238095238096*G0_0_1 + 0.0595238095238095*G0_0_2 + 0.0595238095238096*G0_1_0 + 0.0595238095238096*G0_1_1 + 0.0595238095238095*G0_1_2 + 0.0595238095238095*G0_2_0 + 0.0595238095238095*G0_2_1 + 0.0595238095238095*G0_2_2;
+    A[0] = 0.0595238095238095*G0_0_0 + 0.0595238095238096*G0_0_1 + 0.0595238095238095*G0_0_2 + 0.0595238095238096*G0_1_0 + 0.0595238095238096*G0_1_1 + 0.0595238095238095*G0_1_2 + 0.0595238095238095*G0_2_0 + 0.0595238095238095*G0_2_1 + 0.0595238095238095*G0_2_2;
     A[1] = -0.0113095238095237*G0_0_0 - 0.0113095238095237*G0_1_0 - 0.0113095238095237*G0_2_0;
-    A[2] = -0.0113095238095238*G0_0_1 - 0.0113095238095238*G0_1_1 - 0.0113095238095238*G0_2_1;
-    A[3] = -0.0113095238095238*G0_0_2 - 0.0113095238095238*G0_1_2 - 0.0113095238095237*G0_2_2;
-    A[4] = -0.0133928571428571*G0_0_1 - 0.0133928571428572*G0_0_2 - 0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_1_2 - 0.013392857142857*G0_2_1 - 0.0133928571428569*G0_2_2;
-    A[5] = -0.0133928571428571*G0_0_1 - 0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
-    A[6] = -0.0133928571428571*G0_0_0 - 0.013392857142857*G0_0_2 - 0.0133928571428571*G0_1_0 - 0.013392857142857*G0_1_2 - 0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_2;
-    A[7] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_1_0 - 0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_2;
-    A[8] = -0.0133928571428569*G0_0_0 - 0.0133928571428569*G0_0_1 - 0.0133928571428569*G0_1_0 - 0.0133928571428569*G0_1_1 - 0.013392857142857*G0_2_0 - 0.013392857142857*G0_2_1;
-    A[9] = -0.0133928571428573*G0_0_0 - 0.0133928571428572*G0_0_1 - 0.0133928571428571*G0_1_0 - 0.0133928571428572*G0_1_1 - 0.013392857142857*G0_2_0 - 0.0133928571428571*G0_2_1;
-    A[10] = -0.0348214285714285*G0_0_0 - 0.0348214285714285*G0_0_1 - 0.0964285714285715*G0_0_2 - 0.0348214285714285*G0_1_0 - 0.0348214285714285*G0_1_1 - 0.0964285714285715*G0_1_2 - 0.0348214285714284*G0_2_0 - 0.0348214285714284*G0_2_1 - 0.0964285714285714*G0_2_2;
-    A[11] = 0.0133928571428571*G0_0_0 + 0.0133928571428571*G0_0_1 + 0.0482142857142858*G0_0_2 + 0.0133928571428571*G0_1_0 + 0.0133928571428571*G0_1_1 + 0.0482142857142858*G0_1_2 + 0.0133928571428571*G0_2_0 + 0.0133928571428571*G0_2_1 + 0.0482142857142858*G0_2_2;
-    A[12] = -0.0348214285714285*G0_0_0 - 0.0964285714285716*G0_0_1 - 0.0348214285714285*G0_0_2 - 0.0348214285714285*G0_1_0 - 0.0964285714285716*G0_1_1 - 0.0348214285714285*G0_1_2 - 0.0348214285714284*G0_2_0 - 0.0964285714285715*G0_2_1 - 0.0348214285714284*G0_2_2;
-    A[13] = 0.0133928571428572*G0_0_0 + 0.0482142857142859*G0_0_1 + 0.0133928571428572*G0_0_2 + 0.0133928571428571*G0_1_0 + 0.0482142857142859*G0_1_1 + 0.0133928571428571*G0_1_2 + 0.013392857142857*G0_2_0 + 0.0482142857142858*G0_2_1 + 0.0133928571428569*G0_2_2;
-    A[14] = -0.0964285714285713*G0_0_0 - 0.0348214285714284*G0_0_1 - 0.0348214285714284*G0_0_2 - 0.0964285714285714*G0_1_0 - 0.0348214285714284*G0_1_1 - 0.0348214285714284*G0_1_2 - 0.0964285714285714*G0_2_0 - 0.0348214285714284*G0_2_1 - 0.0348214285714284*G0_2_2;
-    A[15] = 0.0482142857142855*G0_0_0 + 0.013392857142857*G0_0_1 + 0.013392857142857*G0_0_2 + 0.0482142857142856*G0_1_0 + 0.013392857142857*G0_1_1 + 0.013392857142857*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.0133928571428571*G0_2_1 + 0.0133928571428571*G0_2_2;
-    A[16] = -0.032142857142857*G0_0_0 - 0.032142857142857*G0_0_1 - 0.032142857142857*G0_0_2 - 0.0321428571428569*G0_1_0 - 0.0321428571428569*G0_1_1 - 0.0321428571428569*G0_1_2 - 0.0321428571428568*G0_2_0 - 0.032142857142857*G0_2_1 - 0.0321428571428569*G0_2_2;
-    A[17] = 0.0321428571428571*G0_0_0 + 0.0482142857142856*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.0321428571428569*G0_1_0 + 0.0482142857142855*G0_1_1 + 0.0482142857142855*G0_1_2 + 0.0321428571428568*G0_2_0 + 0.0482142857142854*G0_2_1 + 0.0482142857142855*G0_2_2;
-    A[18] = 0.0482142857142855*G0_0_0 + 0.032142857142857*G0_0_1 + 0.0482142857142854*G0_0_2 + 0.0482142857142855*G0_1_0 + 0.0321428571428569*G0_1_1 + 0.0482142857142855*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.032142857142857*G0_2_1 + 0.0482142857142855*G0_2_2;
-    A[19] = 0.0482142857142854*G0_0_0 + 0.0482142857142853*G0_0_1 + 0.032142857142857*G0_0_2 + 0.0482142857142854*G0_1_0 + 0.0482142857142854*G0_1_1 + 0.0321428571428569*G0_1_2 + 0.0482142857142854*G0_2_0 + 0.0482142857142853*G0_2_1 + 0.0321428571428568*G0_2_2;
+    A[2] = -0.0113095238095238*G0_0_1 - 0.0113095238095238*G0_1_1 - 0.0113095238095237*G0_2_1;
+    A[3] = -0.0113095238095238*G0_0_2 - 0.0113095238095237*G0_1_2 - 0.0113095238095237*G0_2_2;
+    A[4] = -0.0133928571428572*G0_0_1 - 0.0133928571428573*G0_0_2 - 0.0133928571428571*G0_1_1 - 0.013392857142857*G0_1_2 - 0.013392857142857*G0_2_1 - 0.0133928571428569*G0_2_2;
+    A[5] = -0.013392857142857*G0_0_1 - 0.013392857142857*G0_0_2 - 0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
+    A[6] = -0.013392857142857*G0_0_0 - 0.0133928571428569*G0_0_2 - 0.013392857142857*G0_1_0 - 0.0133928571428569*G0_1_2 - 0.013392857142857*G0_2_0 - 0.013392857142857*G0_2_2;
+    A[7] = -0.013392857142857*G0_0_0 - 0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_1_0 - 0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_0 - 0.0133928571428572*G0_2_2;
+    A[8] = -0.0133928571428568*G0_0_0 - 0.0133928571428568*G0_0_1 - 0.013392857142857*G0_1_0 - 0.0133928571428568*G0_1_1 - 0.013392857142857*G0_2_0 - 0.0133928571428569*G0_2_1;
+    A[9] = -0.0133928571428574*G0_0_0 - 0.0133928571428573*G0_0_1 - 0.0133928571428571*G0_1_0 - 0.0133928571428572*G0_1_1 - 0.013392857142857*G0_2_0 - 0.0133928571428571*G0_2_1;
+    A[10] = -0.0348214285714284*G0_0_0 - 0.0348214285714284*G0_0_1 - 0.0964285714285715*G0_0_2 - 0.0348214285714284*G0_1_0 - 0.0348214285714284*G0_1_1 - 0.0964285714285715*G0_1_2 - 0.0348214285714284*G0_2_0 - 0.0348214285714284*G0_2_1 - 0.0964285714285714*G0_2_2;
+    A[11] = 0.013392857142857*G0_0_0 + 0.013392857142857*G0_0_1 + 0.0482142857142858*G0_0_2 + 0.0133928571428571*G0_1_0 + 0.0133928571428571*G0_1_1 + 0.0482142857142857*G0_1_2 + 0.0133928571428571*G0_2_0 + 0.0133928571428571*G0_2_1 + 0.0482142857142857*G0_2_2;
+    A[12] = -0.0348214285714286*G0_0_0 - 0.0964285714285717*G0_0_1 - 0.0348214285714285*G0_0_2 - 0.0348214285714285*G0_1_0 - 0.0964285714285716*G0_1_1 - 0.0348214285714284*G0_1_2 - 0.0348214285714284*G0_2_0 - 0.0964285714285715*G0_2_1 - 0.0348214285714284*G0_2_2;
+    A[13] = 0.0133928571428573*G0_0_0 + 0.048214285714286*G0_0_1 + 0.0133928571428573*G0_0_2 + 0.0133928571428571*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.013392857142857*G0_1_2 + 0.013392857142857*G0_2_0 + 0.0482142857142858*G0_2_1 + 0.0133928571428569*G0_2_2;
+    A[14] = -0.0964285714285713*G0_0_0 - 0.0348214285714283*G0_0_1 - 0.0348214285714283*G0_0_2 - 0.0964285714285715*G0_1_0 - 0.0348214285714284*G0_1_1 - 0.0348214285714284*G0_1_2 - 0.0964285714285714*G0_2_0 - 0.0348214285714284*G0_2_1 - 0.0348214285714284*G0_2_2;
+    A[15] = 0.0482142857142855*G0_0_0 + 0.0133928571428568*G0_0_1 + 0.0133928571428568*G0_0_2 + 0.0482142857142856*G0_1_0 + 0.0133928571428569*G0_1_1 + 0.0133928571428569*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.0133928571428569*G0_2_1 + 0.0133928571428569*G0_2_2;
+    A[16] = -0.0321428571428571*G0_0_0 - 0.0321428571428569*G0_0_1 - 0.032142857142857*G0_0_2 - 0.0321428571428569*G0_1_0 - 0.0321428571428568*G0_1_1 - 0.0321428571428568*G0_1_2 - 0.0321428571428568*G0_2_0 - 0.0321428571428569*G0_2_1 - 0.0321428571428568*G0_2_2;
+    A[17] = 0.0321428571428571*G0_0_0 + 0.0482142857142857*G0_0_1 + 0.0482142857142855*G0_0_2 + 0.0321428571428569*G0_1_0 + 0.0482142857142855*G0_1_1 + 0.0482142857142855*G0_1_2 + 0.0321428571428568*G0_2_0 + 0.0482142857142854*G0_2_1 + 0.0482142857142855*G0_2_2;
+    A[18] = 0.0482142857142855*G0_0_0 + 0.0321428571428569*G0_0_1 + 0.0482142857142854*G0_0_2 + 0.0482142857142854*G0_1_0 + 0.0321428571428569*G0_1_1 + 0.0482142857142855*G0_1_2 + 0.0482142857142854*G0_2_0 + 0.0321428571428569*G0_2_1 + 0.0482142857142855*G0_2_2;
+    A[19] = 0.0482142857142853*G0_0_0 + 0.0482142857142855*G0_0_1 + 0.032142857142857*G0_0_2 + 0.0482142857142854*G0_1_0 + 0.0482142857142855*G0_1_1 + 0.0321428571428568*G0_1_2 + 0.0482142857142854*G0_2_0 + 0.0482142857142854*G0_2_1 + 0.0321428571428568*G0_2_2;
     A[20] = -0.0113095238095237*G0_0_0 - 0.0113095238095237*G0_0_1 - 0.0113095238095237*G0_0_2;
-    A[21] = 0.0595238095238095*G0_0_0;
+    A[21] = 0.0595238095238094*G0_0_0;
     A[22] = 0.0113095238095238*G0_0_1;
     A[23] = 0.0113095238095238*G0_0_2;
     A[24] = 0.0133928571428571*G0_0_1 + 0.0133928571428572*G0_0_2;
-    A[25] = 0.013392857142857*G0_0_1 + 0.0133928571428569*G0_0_2;
-    A[26] = -0.0348214285714287*G0_0_0 + 0.0616071428571427*G0_0_2;
-    A[27] = 0.013392857142857*G0_0_0 - 0.0348214285714287*G0_0_2;
-    A[28] = -0.0348214285714287*G0_0_0 + 0.0616071428571428*G0_0_1;
-    A[29] = 0.0133928571428573*G0_0_0 - 0.0348214285714286*G0_0_1;
+    A[25] = 0.0133928571428571*G0_0_1 + 0.013392857142857*G0_0_2;
+    A[26] = -0.0348214285714288*G0_0_0 + 0.0616071428571426*G0_0_2;
+    A[27] = 0.0133928571428571*G0_0_0 - 0.0348214285714286*G0_0_2;
+    A[28] = -0.0348214285714288*G0_0_0 + 0.0616071428571427*G0_0_1;
+    A[29] = 0.0133928571428572*G0_0_0 - 0.0348214285714286*G0_0_1;
     A[30] = -0.0133928571428574*G0_0_0 - 0.0133928571428574*G0_0_1;
-    A[31] = -0.013392857142857*G0_0_0 - 0.013392857142857*G0_0_1;
-    A[32] = -0.0133928571428572*G0_0_0 - 0.0133928571428573*G0_0_2;
-    A[33] = -0.0133928571428573*G0_0_0 - 0.0133928571428572*G0_0_2;
-    A[34] = 0.0482142857142854*G0_0_0 + 0.0348214285714282*G0_0_1 + 0.0348214285714282*G0_0_2;
-    A[35] = -0.0964285714285712*G0_0_0 - 0.0616071428571427*G0_0_1 - 0.0616071428571427*G0_0_2;
-    A[36] = 0.032142857142857*G0_0_0 - 0.0160714285714288*G0_0_1 - 0.0160714285714286*G0_0_2;
-    A[37] = -0.032142857142857*G0_0_0;
-    A[38] = 0.0482142857142861*G0_0_0 + 0.0160714285714289*G0_0_1;
-    A[39] = 0.0482142857142859*G0_0_0 + 0.0160714285714286*G0_0_2;
-    A[40] = -0.0113095238095238*G0_1_0 - 0.0113095238095238*G0_1_1 - 0.0113095238095238*G0_1_2;
+    A[31] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_0_1;
+    A[32] = -0.0133928571428573*G0_0_0 - 0.0133928571428573*G0_0_2;
+    A[33] = -0.0133928571428572*G0_0_0 - 0.0133928571428572*G0_0_2;
+    A[34] = 0.0482142857142854*G0_0_0 + 0.0348214285714281*G0_0_1 + 0.0348214285714281*G0_0_2;
+    A[35] = -0.0964285714285711*G0_0_0 - 0.0616071428571426*G0_0_1 - 0.0616071428571426*G0_0_2;
+    A[36] = 0.0321428571428571*G0_0_0 - 0.0160714285714288*G0_0_1 - 0.0160714285714286*G0_0_2;
+    A[37] = -0.0321428571428571*G0_0_0;
+    A[38] = 0.0482142857142862*G0_0_0 + 0.0160714285714289*G0_0_1;
+    A[39] = 0.048214285714286*G0_0_0 + 0.0160714285714286*G0_0_2;
+    A[40] = -0.0113095238095238*G0_1_0 - 0.0113095238095238*G0_1_1 - 0.0113095238095237*G0_1_2;
     A[41] = 0.0113095238095238*G0_1_0;
-    A[42] = 0.0595238095238095*G0_1_1;
+    A[42] = 0.0595238095238094*G0_1_1;
     A[43] = 0.0113095238095238*G0_1_2;
-    A[44] = -0.0348214285714289*G0_1_1 + 0.0616071428571426*G0_1_2;
+    A[44] = -0.0348214285714289*G0_1_1 + 0.0616071428571425*G0_1_2;
     A[45] = 0.0133928571428572*G0_1_1 - 0.0348214285714288*G0_1_2;
     A[46] = 0.0133928571428572*G0_1_0 + 0.0133928571428571*G0_1_2;
-    A[47] = 0.0133928571428571*G0_1_0 + 0.0133928571428572*G0_1_2;
-    A[48] = -0.0348214285714287*G0_1_0 + 0.0133928571428572*G0_1_1;
-    A[49] = 0.0616071428571429*G0_1_0 - 0.0348214285714286*G0_1_1;
+    A[47] = 0.0133928571428572*G0_1_0 + 0.0133928571428572*G0_1_2;
+    A[48] = -0.0348214285714286*G0_1_0 + 0.0133928571428572*G0_1_1;
+    A[49] = 0.0616071428571428*G0_1_0 - 0.0348214285714286*G0_1_1;
     A[50] = -0.0133928571428572*G0_1_0 - 0.0133928571428572*G0_1_1;
     A[51] = -0.0133928571428572*G0_1_0 - 0.0133928571428572*G0_1_1;
-    A[52] = 0.0348214285714286*G0_1_0 + 0.0482142857142857*G0_1_1 + 0.0348214285714284*G0_1_2;
-    A[53] = -0.0616071428571429*G0_1_0 - 0.0964285714285715*G0_1_1 - 0.0616071428571427*G0_1_2;
-    A[54] = -0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_1_2;
-    A[55] = -0.0133928571428572*G0_1_1 - 0.0133928571428571*G0_1_2;
-    A[56] = -0.0160714285714288*G0_1_0 + 0.0321428571428574*G0_1_1 - 0.0160714285714283*G0_1_2;
+    A[52] = 0.0348214285714286*G0_1_0 + 0.0482142857142856*G0_1_1 + 0.0348214285714284*G0_1_2;
+    A[53] = -0.0616071428571428*G0_1_0 - 0.0964285714285714*G0_1_1 - 0.0616071428571426*G0_1_2;
+    A[54] = -0.0133928571428573*G0_1_1 - 0.0133928571428573*G0_1_2;
+    A[55] = -0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_1_2;
+    A[56] = -0.0160714285714288*G0_1_0 + 0.0321428571428573*G0_1_1 - 0.0160714285714284*G0_1_2;
     A[57] = 0.0160714285714288*G0_1_0 + 0.048214285714286*G0_1_1;
     A[58] = -0.0321428571428572*G0_1_1;
-    A[59] = 0.0482142857142859*G0_1_1 + 0.0160714285714285*G0_1_2;
-    A[60] = -0.0113095238095238*G0_2_0 - 0.0113095238095238*G0_2_1 - 0.0113095238095237*G0_2_2;
+    A[59] = 0.048214285714286*G0_1_1 + 0.0160714285714285*G0_1_2;
+    A[60] = -0.0113095238095238*G0_2_0 - 0.0113095238095237*G0_2_1 - 0.0113095238095237*G0_2_2;
     A[61] = 0.0113095238095238*G0_2_0;
     A[62] = 0.0113095238095238*G0_2_1;
     A[63] = 0.0595238095238094*G0_2_2;
@@ -8004,363 +12538,360 @@ void poisson3d_3_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     A[65] = 0.0616071428571429*G0_2_1 - 0.0348214285714286*G0_2_2;
     A[66] = -0.0348214285714286*G0_2_0 + 0.013392857142857*G0_2_2;
     A[67] = 0.0616071428571428*G0_2_0 - 0.0348214285714284*G0_2_2;
-    A[68] = 0.013392857142857*G0_2_0 + 0.013392857142857*G0_2_1;
+    A[68] = 0.013392857142857*G0_2_0 + 0.0133928571428571*G0_2_1;
     A[69] = 0.0133928571428571*G0_2_0 + 0.013392857142857*G0_2_1;
     A[70] = 0.0348214285714286*G0_2_0 + 0.0348214285714287*G0_2_1 + 0.0482142857142857*G0_2_2;
-    A[71] = -0.0616071428571428*G0_2_0 - 0.0616071428571429*G0_2_1 - 0.0964285714285715*G0_2_2;
+    A[71] = -0.0616071428571429*G0_2_0 - 0.0616071428571429*G0_2_1 - 0.0964285714285714*G0_2_2;
     A[72] = -0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_2;
     A[73] = -0.0133928571428571*G0_2_0 - 0.013392857142857*G0_2_2;
-    A[74] = -0.0133928571428572*G0_2_1 - 0.0133928571428572*G0_2_2;
+    A[74] = -0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
     A[75] = -0.013392857142857*G0_2_1 - 0.013392857142857*G0_2_2;
     A[76] = -0.0160714285714289*G0_2_0 - 0.0160714285714288*G0_2_1 + 0.0321428571428567*G0_2_2;
-    A[77] = 0.0160714285714289*G0_2_0 + 0.0482142857142857*G0_2_2;
-    A[78] = 0.0160714285714289*G0_2_1 + 0.0482142857142857*G0_2_2;
+    A[77] = 0.0160714285714289*G0_2_0 + 0.0482142857142856*G0_2_2;
+    A[78] = 0.0160714285714289*G0_2_1 + 0.0482142857142856*G0_2_2;
     A[79] = -0.0321428571428566*G0_2_2;
-    A[80] = -0.0133928571428571*G0_1_0 - 0.0133928571428571*G0_1_1 - 0.013392857142857*G0_1_2 - 0.0133928571428572*G0_2_0 - 0.0133928571428571*G0_2_1 - 0.0133928571428569*G0_2_2;
+    A[80] = -0.0133928571428572*G0_1_0 - 0.013392857142857*G0_1_1 - 0.013392857142857*G0_1_2 - 0.0133928571428573*G0_2_0 - 0.013392857142857*G0_2_1 - 0.0133928571428569*G0_2_2;
     A[81] = 0.0133928571428571*G0_1_0 + 0.0133928571428572*G0_2_0;
-    A[82] = -0.0348214285714289*G0_1_1 + 0.0616071428571426*G0_2_1;
+    A[82] = -0.0348214285714288*G0_1_1 + 0.0616071428571426*G0_2_1;
     A[83] = -0.0348214285714288*G0_1_2 + 0.013392857142857*G0_2_2;
-    A[84] = 0.241071428571428*G0_1_1 + 0.0964285714285712*G0_1_2 + 0.0964285714285712*G0_2_1 + 0.192857142857143*G0_2_2;
-    A[85] = -0.0723214285714285*G0_1_1 + 0.0723214285714285*G0_1_2 - 0.0241071428571429*G0_2_1 - 0.0723214285714292*G0_2_2;
-    A[86] = -0.0482142857142858*G0_1_0 - 0.0241071428571431*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571432*G0_2_2;
-    A[87] = -0.0723214285714284*G0_1_0 - 0.0482142857142854*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571427*G0_2_2;
-    A[88] = -0.048214285714286*G0_1_0 - 0.024107142857143*G0_1_1 - 0.0723214285714289*G0_2_0 - 0.0241071428571429*G0_2_1;
-    A[89] = 0.0964285714285715*G0_1_0 + 0.120535714285714*G0_1_1 + 0.192857142857143*G0_2_0 + 0.0964285714285718*G0_2_1;
-    A[90] = 0.0482142857142859*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0241071428571425*G0_1_2 + 0.0241071428571427*G0_2_0 + 0.0241071428571428*G0_2_1;
-    A[91] = 0.0723214285714284*G0_1_0 + 0.0723214285714285*G0_1_1 + 0.024107142857143*G0_1_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_1;
-    A[92] = 0.0482142857142861*G0_1_0 + 0.0241071428571428*G0_1_1 + 0.0482142857142857*G0_1_2 + 0.0723214285714287*G0_2_0 + 0.0482142857142855*G0_2_1 + 0.0723214285714281*G0_2_2;
-    A[93] = -0.0964285714285715*G0_1_0 + 0.0241071428571429*G0_1_1 - 0.0964285714285711*G0_1_2 - 0.192857142857143*G0_2_0 - 0.0964285714285712*G0_2_1 - 0.192857142857143*G0_2_2;
-    A[94] = 0.024107142857143*G0_1_1 + 0.0241071428571432*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.024107142857143*G0_2_2;
-    A[95] = 0.0241071428571428*G0_1_1 + 0.0241071428571431*G0_1_2 + 0.0241071428571427*G0_2_1 + 0.024107142857143*G0_2_2;
-    A[96] = 0.241071428571429*G0_1_0 - 0.0482142857142856*G0_1_1 + 0.120535714285715*G0_1_2 + 0.0964285714285717*G0_2_0 - 0.0241071428571423*G0_2_1 + 0.0964285714285729*G0_2_2;
-    A[97] = -0.241071428571429*G0_1_0 - 0.289285714285714*G0_1_1 - 0.120535714285714*G0_1_2 - 0.0964285714285717*G0_2_0 - 0.120535714285714*G0_2_1;
-    A[98] = 0.0482142857142858*G0_1_1 + 0.0241071428571424*G0_1_2 + 0.0241071428571426*G0_2_1;
-    A[99] = -0.144642857142857*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.0964285714285724*G0_2_2;
-    A[100] = -0.0133928571428571*G0_1_0 - 0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
-    A[101] = 0.013392857142857*G0_1_0 + 0.0133928571428569*G0_2_0;
+    A[84] = 0.241071428571428*G0_1_1 + 0.0964285714285711*G0_1_2 + 0.0964285714285711*G0_2_1 + 0.192857142857142*G0_2_2;
+    A[85] = -0.0723214285714285*G0_1_1 + 0.0723214285714285*G0_1_2 - 0.0241071428571428*G0_2_1 - 0.0723214285714291*G0_2_2;
+    A[86] = -0.0482142857142857*G0_1_0 - 0.024107142857143*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571431*G0_2_2;
+    A[87] = -0.0723214285714284*G0_1_0 - 0.0482142857142854*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571426*G0_2_2;
+    A[88] = -0.0482142857142859*G0_1_0 - 0.0241071428571429*G0_1_1 - 0.0723214285714287*G0_2_0 - 0.0241071428571428*G0_2_1;
+    A[89] = 0.0964285714285716*G0_1_0 + 0.120535714285714*G0_1_1 + 0.192857142857143*G0_2_0 + 0.0964285714285717*G0_2_1;
+    A[90] = 0.0482142857142859*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0241071428571425*G0_1_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_1;
+    A[91] = 0.0723214285714285*G0_1_0 + 0.0723214285714285*G0_1_1 + 0.024107142857143*G0_1_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_1;
+    A[92] = 0.0482142857142862*G0_1_0 + 0.0241071428571427*G0_1_1 + 0.0482142857142856*G0_1_2 + 0.0723214285714289*G0_2_0 + 0.0482142857142853*G0_2_1 + 0.072321428571428*G0_2_2;
+    A[93] = -0.0964285714285715*G0_1_0 + 0.024107142857143*G0_1_1 - 0.0964285714285711*G0_1_2 - 0.192857142857143*G0_2_0 - 0.096428571428571*G0_2_1 - 0.192857142857143*G0_2_2;
+    A[94] = 0.0241071428571431*G0_1_1 + 0.0241071428571432*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.024107142857143*G0_2_2;
+    A[95] = 0.0241071428571427*G0_1_1 + 0.0241071428571431*G0_1_2 + 0.0241071428571426*G0_2_1 + 0.024107142857143*G0_2_2;
+    A[96] = 0.241071428571428*G0_1_0 - 0.0482142857142855*G0_1_1 + 0.120535714285714*G0_1_2 + 0.0964285714285717*G0_2_0 - 0.0241071428571422*G0_2_1 + 0.0964285714285727*G0_2_2;
+    A[97] = -0.241071428571429*G0_1_0 - 0.289285714285714*G0_1_1 - 0.120535714285714*G0_1_2 - 0.0964285714285718*G0_2_0 - 0.120535714285714*G0_2_1;
+    A[98] = 0.0482142857142857*G0_1_1 + 0.0241071428571424*G0_1_2 + 0.0241071428571425*G0_2_1;
+    A[99] = -0.144642857142857*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.0964285714285723*G0_2_2;
+    A[100] = -0.013392857142857*G0_1_0 - 0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_1_2 - 0.013392857142857*G0_2_0 - 0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
+    A[101] = 0.0133928571428571*G0_1_0 + 0.013392857142857*G0_2_0;
     A[102] = 0.0133928571428572*G0_1_1 - 0.0348214285714288*G0_2_1;
     A[103] = 0.0616071428571429*G0_1_2 - 0.0348214285714286*G0_2_2;
-    A[104] = -0.0723214285714285*G0_1_1 - 0.0241071428571429*G0_1_2 + 0.0723214285714285*G0_2_1 - 0.0723214285714292*G0_2_2;
-    A[105] = 0.192857142857143*G0_1_1 + 0.0964285714285711*G0_1_2 + 0.0964285714285711*G0_2_1 + 0.241071428571428*G0_2_2;
-    A[106] = -0.0723214285714281*G0_1_0 - 0.0241071428571428*G0_1_2 - 0.0482142857142851*G0_2_0 - 0.0241071428571424*G0_2_2;
+    A[104] = -0.0723214285714285*G0_1_1 - 0.0241071428571428*G0_1_2 + 0.0723214285714284*G0_2_1 - 0.0723214285714291*G0_2_2;
+    A[105] = 0.192857142857143*G0_1_1 + 0.0964285714285709*G0_1_2 + 0.096428571428571*G0_2_1 + 0.241071428571428*G0_2_2;
+    A[106] = -0.0723214285714282*G0_1_0 - 0.0241071428571427*G0_1_2 - 0.0482142857142851*G0_2_0 - 0.0241071428571424*G0_2_2;
     A[107] = 0.192857142857143*G0_1_0 + 0.0964285714285715*G0_1_2 + 0.0964285714285709*G0_2_0 + 0.120535714285714*G0_2_2;
-    A[108] = -0.0241071428571428*G0_1_0 - 0.0241071428571428*G0_1_1 - 0.0482142857142853*G0_2_0 - 0.0241071428571426*G0_2_1;
-    A[109] = -0.0241071428571429*G0_1_0 - 0.024107142857143*G0_1_1 - 0.0723214285714293*G0_2_0 - 0.0482142857142863*G0_2_1;
-    A[110] = 0.0723214285714285*G0_1_0 + 0.0723214285714285*G0_1_1 + 0.0482142857142857*G0_1_2 + 0.0482142857142855*G0_2_0 + 0.0482142857142855*G0_2_1 + 0.0241071428571429*G0_2_2;
-    A[111] = -0.192857142857143*G0_1_0 - 0.192857142857143*G0_1_1 - 0.0964285714285715*G0_1_2 - 0.096428571428571*G0_2_0 - 0.096428571428571*G0_2_1 + 0.0241071428571429*G0_2_2;
-    A[112] = 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.0241071428571429*G0_2_1 + 0.0482142857142857*G0_2_2;
+    A[108] = -0.0241071428571428*G0_1_0 - 0.0241071428571429*G0_1_1 - 0.0482142857142853*G0_2_0 - 0.0241071428571427*G0_2_1;
+    A[109] = -0.0241071428571429*G0_1_0 - 0.0241071428571429*G0_1_1 - 0.0723214285714293*G0_2_0 - 0.0482142857142862*G0_2_1;
+    A[110] = 0.0723214285714284*G0_1_0 + 0.0723214285714285*G0_1_1 + 0.0482142857142856*G0_1_2 + 0.0482142857142854*G0_2_0 + 0.0482142857142855*G0_2_1 + 0.0241071428571429*G0_2_2;
+    A[111] = -0.192857142857143*G0_1_0 - 0.192857142857143*G0_1_1 - 0.0964285714285714*G0_1_2 - 0.0964285714285709*G0_2_0 - 0.0964285714285709*G0_2_1 + 0.0241071428571429*G0_2_2;
+    A[112] = 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_2 + 0.0482142857142855*G0_2_0 + 0.024107142857143*G0_2_1 + 0.0482142857142857*G0_2_2;
     A[113] = 0.0241071428571429*G0_1_0 + 0.024107142857143*G0_1_2 + 0.0723214285714293*G0_2_0 + 0.024107142857143*G0_2_1 + 0.0723214285714293*G0_2_2;
-    A[114] = 0.0241071428571428*G0_1_1 + 0.0241071428571427*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0241071428571427*G0_2_2;
-    A[115] = 0.0241071428571428*G0_1_1 + 0.0241071428571427*G0_1_2 + 0.0241071428571426*G0_2_1 + 0.0241071428571424*G0_2_2;
-    A[116] = 0.0964285714285714*G0_1_0 + 0.0964285714285716*G0_1_1 - 0.0241071428571427*G0_1_2 + 0.241071428571428*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142863*G0_2_2;
-    A[117] = -0.0964285714285716*G0_1_0 - 0.120535714285714*G0_1_2 - 0.241071428571428*G0_2_0 - 0.120535714285714*G0_2_1 - 0.289285714285714*G0_2_2;
-    A[118] = -0.0964285714285716*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.144642857142856*G0_2_2;
-    A[119] = 0.0241071428571428*G0_1_2 + 0.0241071428571435*G0_2_1 + 0.0482142857142863*G0_2_2;
-    A[120] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_0_1 - 0.0133928571428571*G0_0_2 - 0.013392857142857*G0_2_0 - 0.013392857142857*G0_2_1 - 0.0133928571428571*G0_2_2;
-    A[121] = -0.0348214285714287*G0_0_0 + 0.0616071428571427*G0_2_0;
+    A[114] = 0.0241071428571429*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0241071428571427*G0_2_2;
+    A[115] = 0.0241071428571429*G0_1_1 + 0.0241071428571427*G0_1_2 + 0.0241071428571426*G0_2_1 + 0.0241071428571424*G0_2_2;
+    A[116] = 0.0964285714285715*G0_1_0 + 0.0964285714285716*G0_1_1 - 0.0241071428571427*G0_1_2 + 0.241071428571428*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142863*G0_2_2;
+    A[117] = -0.0964285714285715*G0_1_0 - 0.120535714285714*G0_1_2 - 0.241071428571428*G0_2_0 - 0.120535714285714*G0_2_1 - 0.289285714285714*G0_2_2;
+    A[118] = -0.0964285714285717*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.144642857142856*G0_2_2;
+    A[119] = 0.0241071428571428*G0_1_2 + 0.0241071428571434*G0_2_1 + 0.0482142857142862*G0_2_2;
+    A[120] = -0.013392857142857*G0_0_0 - 0.013392857142857*G0_0_1 - 0.013392857142857*G0_0_2 - 0.0133928571428569*G0_2_0 - 0.0133928571428569*G0_2_1 - 0.013392857142857*G0_2_2;
+    A[121] = -0.0348214285714288*G0_0_0 + 0.0616071428571426*G0_2_0;
     A[122] = 0.0133928571428572*G0_0_1 + 0.0133928571428571*G0_2_1;
     A[123] = -0.0348214285714286*G0_0_2 + 0.013392857142857*G0_2_2;
-    A[124] = -0.0482142857142858*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0241071428571431*G0_2_1 - 0.0241071428571432*G0_2_2;
-    A[125] = -0.0723214285714281*G0_0_1 - 0.0482142857142851*G0_0_2 - 0.0241071428571428*G0_2_1 - 0.0241071428571424*G0_2_2;
-    A[126] = 0.241071428571428*G0_0_0 + 0.096428571428572*G0_0_2 + 0.096428571428572*G0_2_0 + 0.192857142857144*G0_2_2;
-    A[127] = -0.072321428571428*G0_0_0 + 0.0723214285714286*G0_0_2 - 0.0241071428571428*G0_2_0 - 0.0723214285714286*G0_2_2;
-    A[128] = 0.120535714285714*G0_0_0 + 0.0964285714285716*G0_0_1 + 0.096428571428572*G0_2_0 + 0.192857142857144*G0_2_1;
-    A[129] = -0.024107142857143*G0_0_0 - 0.0482142857142859*G0_0_1 - 0.0241071428571432*G0_2_0 - 0.072321428571429*G0_2_1;
-    A[130] = 0.0482142857142861*G0_0_0 + 0.048214285714286*G0_0_1 + 0.0241071428571431*G0_0_2 + 0.024107142857143*G0_2_0 + 0.024107142857143*G0_2_1;
-    A[131] = 0.0723214285714281*G0_0_0 + 0.0723214285714282*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_1;
-    A[132] = 0.0241071428571431*G0_0_0 + 0.0241071428571432*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_2;
-    A[133] = 0.024107142857143*G0_0_0 + 0.024107142857143*G0_0_2 + 0.0241071428571432*G0_2_0 + 0.0241071428571432*G0_2_2;
-    A[134] = 0.0241071428571425*G0_0_0 + 0.0482142857142855*G0_0_1 + 0.0482142857142854*G0_0_2 + 0.0482142857142851*G0_2_0 + 0.0723214285714281*G0_2_1 + 0.072321428571428*G0_2_2;
-    A[135] = 0.0241071428571433*G0_0_0 - 0.0964285714285711*G0_0_1 - 0.0964285714285711*G0_0_2 - 0.0964285714285708*G0_2_0 - 0.192857142857143*G0_2_1 - 0.192857142857143*G0_2_2;
-    A[136] = -0.0482142857142851*G0_0_0 + 0.241071428571429*G0_0_1 + 0.120535714285714*G0_0_2 - 0.0241071428571425*G0_2_0 + 0.0964285714285728*G0_2_1 + 0.0964285714285721*G0_2_2;
-    A[137] = 0.0482142857142851*G0_0_0 + 0.0241071428571419*G0_0_2 + 0.0241071428571426*G0_2_0;
-    A[138] = -0.289285714285715*G0_0_0 - 0.241071428571429*G0_0_1 - 0.120535714285715*G0_0_2 - 0.120535714285715*G0_2_0 - 0.0964285714285725*G0_2_1;
-    A[139] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_2 - 0.120535714285715*G0_2_0 - 0.0964285714285721*G0_2_2;
-    A[140] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_0_1 - 0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
-    A[141] = 0.013392857142857*G0_0_0 - 0.0348214285714287*G0_2_0;
-    A[142] = 0.0133928571428571*G0_0_1 + 0.0133928571428572*G0_2_1;
+    A[124] = -0.0482142857142858*G0_0_1 - 0.0241071428571428*G0_0_2 - 0.024107142857143*G0_2_1 - 0.0241071428571431*G0_2_2;
+    A[125] = -0.0723214285714282*G0_0_1 - 0.0482142857142851*G0_0_2 - 0.0241071428571427*G0_2_1 - 0.0241071428571424*G0_2_2;
+    A[126] = 0.241071428571428*G0_0_0 + 0.0964285714285718*G0_0_2 + 0.0964285714285718*G0_2_0 + 0.192857142857144*G0_2_2;
+    A[127] = -0.0723214285714281*G0_0_0 + 0.0723214285714285*G0_0_2 - 0.0241071428571427*G0_2_0 - 0.0723214285714286*G0_2_2;
+    A[128] = 0.120535714285714*G0_0_0 + 0.0964285714285715*G0_0_1 + 0.0964285714285718*G0_2_0 + 0.192857142857143*G0_2_1;
+    A[129] = -0.0241071428571429*G0_0_0 - 0.0482142857142859*G0_0_1 - 0.0241071428571431*G0_2_0 - 0.0723214285714289*G0_2_1;
+    A[130] = 0.0482142857142859*G0_0_0 + 0.0482142857142859*G0_0_1 + 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.024107142857143*G0_2_1;
+    A[131] = 0.0723214285714282*G0_0_0 + 0.0723214285714282*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571427*G0_2_1;
+    A[132] = 0.0241071428571429*G0_0_0 + 0.0241071428571432*G0_0_2 + 0.0241071428571427*G0_2_0 + 0.0241071428571429*G0_2_2;
+    A[133] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571431*G0_2_0 + 0.0241071428571431*G0_2_2;
+    A[134] = 0.0241071428571423*G0_0_0 + 0.0482142857142853*G0_0_1 + 0.0482142857142853*G0_0_2 + 0.0482142857142849*G0_2_0 + 0.0723214285714279*G0_2_1 + 0.0723214285714279*G0_2_2;
+    A[135] = 0.0241071428571435*G0_0_0 - 0.096428571428571*G0_0_1 - 0.096428571428571*G0_0_2 - 0.0964285714285706*G0_2_0 - 0.192857142857143*G0_2_1 - 0.192857142857143*G0_2_2;
+    A[136] = -0.0482142857142852*G0_0_0 + 0.241071428571429*G0_0_1 + 0.120535714285714*G0_0_2 - 0.0241071428571424*G0_2_0 + 0.0964285714285726*G0_2_1 + 0.0964285714285721*G0_2_2;
+    A[137] = 0.0482142857142852*G0_0_0 + 0.024107142857142*G0_0_2 + 0.0241071428571424*G0_2_0;
+    A[138] = -0.289285714285714*G0_0_0 - 0.241071428571429*G0_0_1 - 0.120535714285714*G0_0_2 - 0.120535714285715*G0_2_0 - 0.0964285714285724*G0_2_1;
+    A[139] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_2 - 0.120535714285714*G0_2_0 - 0.0964285714285721*G0_2_2;
+    A[140] = -0.013392857142857*G0_0_0 - 0.0133928571428571*G0_0_1 - 0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_2_0 - 0.0133928571428572*G0_2_1 - 0.0133928571428572*G0_2_2;
+    A[141] = 0.0133928571428571*G0_0_0 - 0.0348214285714286*G0_2_0;
+    A[142] = 0.0133928571428572*G0_0_1 + 0.0133928571428572*G0_2_1;
     A[143] = 0.0616071428571428*G0_0_2 - 0.0348214285714284*G0_2_2;
-    A[144] = -0.0723214285714284*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0482142857142854*G0_2_1 - 0.0241071428571427*G0_2_2;
+    A[144] = -0.0723214285714284*G0_0_1 - 0.0241071428571428*G0_0_2 - 0.0482142857142854*G0_2_1 - 0.0241071428571426*G0_2_2;
     A[145] = 0.192857142857143*G0_0_1 + 0.0964285714285709*G0_0_2 + 0.0964285714285715*G0_2_1 + 0.120535714285714*G0_2_2;
-    A[146] = -0.072321428571428*G0_0_0 - 0.0241071428571428*G0_0_2 + 0.0723214285714286*G0_2_0 - 0.0723214285714286*G0_2_2;
+    A[146] = -0.0723214285714281*G0_0_0 - 0.0241071428571427*G0_0_2 + 0.0723214285714285*G0_2_0 - 0.0723214285714286*G0_2_2;
     A[147] = 0.192857142857142*G0_0_0 + 0.0964285714285714*G0_0_2 + 0.0964285714285714*G0_2_0 + 0.241071428571429*G0_2_2;
-    A[148] = -0.0241071428571428*G0_0_0 - 0.0241071428571428*G0_0_1 - 0.0482142857142859*G0_2_0 - 0.0723214285714289*G0_2_1;
+    A[148] = -0.0241071428571428*G0_0_0 - 0.0241071428571429*G0_0_1 - 0.0482142857142859*G0_2_0 - 0.072321428571429*G0_2_1;
     A[149] = -0.0241071428571429*G0_0_0 - 0.0241071428571429*G0_0_1 - 0.0241071428571427*G0_2_0 - 0.0482142857142855*G0_2_1;
-    A[150] = 0.0723214285714284*G0_0_0 + 0.0723214285714284*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.0482142857142854*G0_2_0 + 0.0482142857142854*G0_2_1 + 0.0241071428571425*G0_2_2;
-    A[151] = -0.192857142857142*G0_0_0 - 0.192857142857143*G0_0_1 - 0.0964285714285713*G0_0_2 - 0.0964285714285714*G0_2_0 - 0.0964285714285714*G0_2_1 + 0.0241071428571431*G0_2_2;
-    A[152] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_2;
-    A[153] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571427*G0_2_0 + 0.0241071428571428*G0_2_2;
-    A[154] = 0.0241071428571428*G0_0_1 + 0.0241071428571427*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0482142857142857*G0_2_1 + 0.0482142857142856*G0_2_2;
-    A[155] = 0.0241071428571428*G0_0_1 + 0.0241071428571427*G0_0_2 + 0.024107142857143*G0_2_0 + 0.0723214285714289*G0_2_1 + 0.0723214285714287*G0_2_2;
-    A[156] = 0.0964285714285713*G0_0_0 + 0.0964285714285715*G0_0_1 - 0.0241071428571427*G0_0_2 + 0.120535714285715*G0_2_0 + 0.241071428571429*G0_2_1 - 0.0482142857142852*G0_2_2;
+    A[150] = 0.0723214285714283*G0_0_0 + 0.0723214285714284*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.0482142857142854*G0_2_0 + 0.0482142857142853*G0_2_1 + 0.0241071428571426*G0_2_2;
+    A[151] = -0.192857142857142*G0_0_0 - 0.192857142857143*G0_0_1 - 0.0964285714285713*G0_0_2 - 0.0964285714285714*G0_2_0 - 0.0964285714285714*G0_2_1 + 0.0241071428571432*G0_2_2;
+    A[152] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.024107142857143*G0_2_2;
+    A[153] = 0.0241071428571429*G0_0_0 + 0.024107142857143*G0_0_2 + 0.0241071428571427*G0_2_0 + 0.0241071428571428*G0_2_2;
+    A[154] = 0.0241071428571429*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0482142857142857*G0_2_1 + 0.0482142857142856*G0_2_2;
+    A[155] = 0.0241071428571429*G0_0_1 + 0.0241071428571427*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0723214285714289*G0_2_1 + 0.0723214285714287*G0_2_2;
+    A[156] = 0.0964285714285713*G0_0_0 + 0.0964285714285715*G0_0_1 - 0.0241071428571428*G0_0_2 + 0.120535714285715*G0_2_0 + 0.241071428571429*G0_2_1 - 0.0482142857142853*G0_2_2;
     A[157] = -0.0964285714285714*G0_0_0 - 0.120535714285714*G0_0_2 - 0.120535714285715*G0_2_0 - 0.144642857142857*G0_2_2;
     A[158] = -0.0964285714285715*G0_0_1 - 0.120535714285714*G0_0_2 - 0.120535714285714*G0_2_0 - 0.241071428571429*G0_2_1 - 0.289285714285714*G0_2_2;
-    A[159] = 0.0241071428571428*G0_0_2 + 0.024107142857143*G0_2_0 + 0.0482142857142854*G0_2_2;
-    A[160] = -0.0133928571428569*G0_0_0 - 0.0133928571428569*G0_0_1 - 0.013392857142857*G0_0_2 - 0.0133928571428569*G0_1_0 - 0.0133928571428569*G0_1_1 - 0.013392857142857*G0_1_2;
-    A[161] = -0.0348214285714287*G0_0_0 + 0.0616071428571428*G0_1_0;
-    A[162] = -0.0348214285714287*G0_0_1 + 0.0133928571428572*G0_1_1;
-    A[163] = 0.013392857142857*G0_0_2 + 0.013392857142857*G0_1_2;
-    A[164] = -0.048214285714286*G0_0_1 - 0.0723214285714289*G0_0_2 - 0.024107142857143*G0_1_1 - 0.0241071428571429*G0_1_2;
-    A[165] = -0.0241071428571428*G0_0_1 - 0.0482142857142853*G0_0_2 - 0.0241071428571428*G0_1_1 - 0.0241071428571426*G0_1_2;
-    A[166] = 0.120535714285714*G0_0_0 + 0.096428571428572*G0_0_2 + 0.0964285714285716*G0_1_0 + 0.192857142857144*G0_1_2;
-    A[167] = -0.0241071428571428*G0_0_0 - 0.0482142857142859*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0723214285714289*G0_1_2;
-    A[168] = 0.241071428571429*G0_0_0 + 0.0964285714285716*G0_0_1 + 0.0964285714285716*G0_1_0 + 0.192857142857144*G0_1_1;
-    A[169] = -0.0723214285714292*G0_0_0 + 0.0723214285714281*G0_0_1 - 0.0241071428571429*G0_1_0 - 0.0723214285714289*G0_1_1;
-    A[170] = 0.024107142857143*G0_0_0 + 0.024107142857143*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0241071428571429*G0_1_1;
+    A[159] = 0.0241071428571428*G0_0_2 + 0.0241071428571431*G0_2_0 + 0.0482142857142854*G0_2_2;
+    A[160] = -0.0133928571428568*G0_0_0 - 0.013392857142857*G0_0_1 - 0.013392857142857*G0_0_2 - 0.0133928571428568*G0_1_0 - 0.0133928571428568*G0_1_1 - 0.0133928571428569*G0_1_2;
+    A[161] = -0.0348214285714288*G0_0_0 + 0.0616071428571427*G0_1_0;
+    A[162] = -0.0348214285714286*G0_0_1 + 0.0133928571428572*G0_1_1;
+    A[163] = 0.013392857142857*G0_0_2 + 0.0133928571428571*G0_1_2;
+    A[164] = -0.0482142857142859*G0_0_1 - 0.0723214285714287*G0_0_2 - 0.0241071428571429*G0_1_1 - 0.0241071428571428*G0_1_2;
+    A[165] = -0.0241071428571428*G0_0_1 - 0.0482142857142853*G0_0_2 - 0.0241071428571429*G0_1_1 - 0.0241071428571427*G0_1_2;
+    A[166] = 0.120535714285714*G0_0_0 + 0.0964285714285718*G0_0_2 + 0.0964285714285715*G0_1_0 + 0.192857142857143*G0_1_2;
+    A[167] = -0.0241071428571428*G0_0_0 - 0.0482142857142859*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.072321428571429*G0_1_2;
+    A[168] = 0.241071428571428*G0_0_0 + 0.0964285714285715*G0_0_1 + 0.0964285714285715*G0_1_0 + 0.192857142857143*G0_1_1;
+    A[169] = -0.0723214285714291*G0_0_0 + 0.0723214285714282*G0_0_1 - 0.0241071428571429*G0_1_0 - 0.0723214285714288*G0_1_1;
+    A[170] = 0.0241071428571429*G0_0_0 + 0.024107142857143*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0241071428571429*G0_1_1;
     A[171] = 0.0241071428571428*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_1;
-    A[172] = 0.0482142857142854*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.0241071428571427*G0_1_0 + 0.0241071428571427*G0_1_2;
-    A[173] = 0.0723214285714292*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.072321428571429*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_2;
-    A[174] = 0.0241071428571424*G0_0_0 + 0.0482142857142853*G0_0_1 + 0.0482142857142852*G0_0_2 + 0.048214285714285*G0_1_0 + 0.072321428571428*G0_1_1 + 0.0723214285714279*G0_1_2;
-    A[175] = 0.0241071428571432*G0_0_0 - 0.0964285714285713*G0_0_1 - 0.0964285714285713*G0_0_2 - 0.096428571428571*G0_1_0 - 0.192857142857143*G0_1_1 - 0.192857142857143*G0_1_2;
-    A[176] = -0.048214285714286*G0_0_0 + 0.120535714285714*G0_0_1 + 0.241071428571428*G0_0_2 - 0.0241071428571426*G0_1_0 + 0.0964285714285722*G0_1_1 + 0.0964285714285718*G0_1_2;
-    A[177] = 0.0482142857142861*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571426*G0_1_0;
-    A[178] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285715*G0_1_0 - 0.096428571428572*G0_1_1;
+    A[172] = 0.0482142857142852*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0482142857142857*G0_0_2 + 0.0241071428571425*G0_1_0 + 0.0241071428571428*G0_1_2;
+    A[173] = 0.0723214285714291*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0723214285714289*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_2;
+    A[174] = 0.0241071428571423*G0_0_0 + 0.0482142857142852*G0_0_1 + 0.0482142857142851*G0_0_2 + 0.0482142857142848*G0_1_0 + 0.0723214285714279*G0_1_1 + 0.0723214285714278*G0_1_2;
+    A[175] = 0.0241071428571433*G0_0_0 - 0.0964285714285711*G0_0_1 - 0.0964285714285711*G0_0_2 - 0.0964285714285707*G0_1_0 - 0.192857142857143*G0_1_1 - 0.192857142857143*G0_1_2;
+    A[176] = -0.048214285714286*G0_0_0 + 0.120535714285714*G0_0_1 + 0.241071428571428*G0_0_2 - 0.0241071428571426*G0_1_0 + 0.096428571428572*G0_1_1 + 0.0964285714285719*G0_1_2;
+    A[177] = 0.0482142857142861*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0241071428571426*G0_1_0;
+    A[178] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.0964285714285718*G0_1_1;
     A[179] = -0.289285714285714*G0_0_0 - 0.120535714285714*G0_0_1 - 0.241071428571428*G0_0_2 - 0.120535714285714*G0_1_0 - 0.0964285714285718*G0_1_2;
-    A[180] = -0.0133928571428573*G0_0_0 - 0.0133928571428571*G0_0_1 - 0.013392857142857*G0_0_2 - 0.0133928571428572*G0_1_0 - 0.0133928571428572*G0_1_1 - 0.0133928571428571*G0_1_2;
-    A[181] = 0.0133928571428573*G0_0_0 - 0.0348214285714286*G0_1_0;
-    A[182] = 0.0616071428571429*G0_0_1 - 0.0348214285714286*G0_1_1;
+    A[180] = -0.0133928571428574*G0_0_0 - 0.0133928571428571*G0_0_1 - 0.013392857142857*G0_0_2 - 0.0133928571428573*G0_1_0 - 0.0133928571428572*G0_1_1 - 0.0133928571428571*G0_1_2;
+    A[181] = 0.0133928571428572*G0_0_0 - 0.0348214285714286*G0_1_0;
+    A[182] = 0.0616071428571428*G0_0_1 - 0.0348214285714287*G0_1_1;
     A[183] = 0.0133928571428571*G0_0_2 + 0.013392857142857*G0_1_2;
-    A[184] = 0.0964285714285715*G0_0_1 + 0.192857142857143*G0_0_2 + 0.120535714285714*G0_1_1 + 0.0964285714285718*G0_1_2;
-    A[185] = -0.0241071428571429*G0_0_1 - 0.0723214285714293*G0_0_2 - 0.024107142857143*G0_1_1 - 0.0482142857142863*G0_1_2;
-    A[186] = -0.024107142857143*G0_0_0 - 0.0241071428571432*G0_0_2 - 0.0482142857142859*G0_1_0 - 0.072321428571429*G0_1_2;
+    A[184] = 0.0964285714285716*G0_0_1 + 0.192857142857143*G0_0_2 + 0.120535714285714*G0_1_1 + 0.0964285714285717*G0_1_2;
+    A[185] = -0.0241071428571429*G0_0_1 - 0.0723214285714293*G0_0_2 - 0.0241071428571429*G0_1_1 - 0.0482142857142862*G0_1_2;
+    A[186] = -0.0241071428571429*G0_0_0 - 0.0241071428571431*G0_0_2 - 0.0482142857142859*G0_1_0 - 0.0723214285714289*G0_1_2;
     A[187] = -0.0241071428571429*G0_0_0 - 0.0241071428571427*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.0482142857142855*G0_1_2;
-    A[188] = -0.0723214285714292*G0_0_0 - 0.0241071428571429*G0_0_1 + 0.0723214285714281*G0_1_0 - 0.0723214285714289*G0_1_1;
+    A[188] = -0.0723214285714291*G0_0_0 - 0.0241071428571429*G0_0_1 + 0.0723214285714282*G0_1_0 - 0.0723214285714288*G0_1_1;
     A[189] = 0.192857142857144*G0_0_0 + 0.096428571428572*G0_0_1 + 0.096428571428572*G0_1_0 + 0.241071428571429*G0_1_1;
-    A[190] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571431*G0_1_0 + 0.0241071428571431*G0_1_1;
-    A[191] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.024107142857143*G0_1_1;
-    A[192] = 0.072321428571429*G0_0_0 + 0.0482142857142858*G0_0_1 + 0.0723214285714284*G0_0_2 + 0.048214285714286*G0_1_0 + 0.024107142857143*G0_1_1 + 0.0482142857142858*G0_1_2;
-    A[193] = -0.192857142857144*G0_0_0 - 0.0964285714285717*G0_0_1 - 0.192857142857143*G0_0_2 - 0.0964285714285719*G0_1_0 + 0.0241071428571427*G0_1_1 - 0.0964285714285717*G0_1_2;
-    A[194] = 0.0241071428571428*G0_0_1 + 0.024107142857143*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.048214285714286*G0_1_2;
-    A[195] = 0.0241071428571427*G0_0_1 + 0.024107142857143*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0723214285714285*G0_1_1 + 0.0723214285714288*G0_1_2;
-    A[196] = 0.0964285714285722*G0_0_0 - 0.0241071428571423*G0_0_1 + 0.0964285714285731*G0_0_2 + 0.120535714285715*G0_1_0 - 0.0482142857142857*G0_1_1 + 0.241071428571429*G0_1_2;
-    A[197] = -0.0964285714285721*G0_0_0 - 0.120535714285715*G0_0_1 - 0.120535714285715*G0_1_0 - 0.144642857142858*G0_1_1;
+    A[190] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571431*G0_1_0 + 0.024107142857143*G0_1_1;
+    A[191] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_1;
+    A[192] = 0.0723214285714292*G0_0_0 + 0.0482142857142857*G0_0_1 + 0.0723214285714284*G0_0_2 + 0.0482142857142861*G0_1_0 + 0.024107142857143*G0_1_1 + 0.0482142857142856*G0_1_2;
+    A[193] = -0.192857142857144*G0_0_0 - 0.0964285714285716*G0_0_1 - 0.192857142857143*G0_0_2 - 0.0964285714285719*G0_1_0 + 0.0241071428571427*G0_1_1 - 0.0964285714285716*G0_1_2;
+    A[194] = 0.0241071428571428*G0_0_1 + 0.024107142857143*G0_0_2 + 0.0241071428571431*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.048214285714286*G0_1_2;
+    A[195] = 0.0241071428571427*G0_0_1 + 0.0241071428571431*G0_0_2 + 0.0241071428571428*G0_1_0 + 0.0723214285714286*G0_1_1 + 0.0723214285714289*G0_1_2;
+    A[196] = 0.0964285714285721*G0_0_0 - 0.0241071428571423*G0_0_1 + 0.0964285714285729*G0_0_2 + 0.120535714285715*G0_1_0 - 0.0482142857142856*G0_1_1 + 0.241071428571429*G0_1_2;
+    A[197] = -0.0964285714285722*G0_0_0 - 0.120535714285715*G0_0_1 - 0.120535714285715*G0_1_0 - 0.144642857142858*G0_1_1;
     A[198] = 0.0241071428571426*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0482142857142859*G0_1_1;
     A[199] = -0.120535714285714*G0_0_1 - 0.0964285714285726*G0_0_2 - 0.120535714285714*G0_1_0 - 0.289285714285714*G0_1_1 - 0.241071428571429*G0_1_2;
-    A[200] = -0.0348214285714285*G0_0_0 - 0.0348214285714285*G0_0_1 - 0.0348214285714284*G0_0_2 - 0.0348214285714285*G0_1_0 - 0.0348214285714285*G0_1_1 - 0.0348214285714284*G0_1_2 - 0.0964285714285715*G0_2_0 - 0.0964285714285715*G0_2_1 - 0.0964285714285714*G0_2_2;
+    A[200] = -0.0348214285714284*G0_0_0 - 0.0348214285714284*G0_0_1 - 0.0348214285714284*G0_0_2 - 0.0348214285714284*G0_1_0 - 0.0348214285714284*G0_1_1 - 0.0348214285714284*G0_1_2 - 0.0964285714285715*G0_2_0 - 0.0964285714285715*G0_2_1 - 0.0964285714285714*G0_2_2;
     A[201] = -0.0133928571428574*G0_0_0 - 0.0133928571428574*G0_1_0;
     A[202] = -0.0133928571428572*G0_0_1 - 0.0133928571428572*G0_1_1;
     A[203] = 0.0348214285714286*G0_0_2 + 0.0348214285714287*G0_1_2 + 0.0482142857142857*G0_2_2;
-    A[204] = 0.0482142857142859*G0_0_1 + 0.0241071428571427*G0_0_2 + 0.0482142857142858*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571425*G0_2_1;
-    A[205] = 0.0723214285714285*G0_0_1 + 0.0482142857142855*G0_0_2 + 0.0723214285714285*G0_1_1 + 0.0482142857142855*G0_1_2 + 0.0482142857142857*G0_2_1 + 0.0241071428571429*G0_2_2;
-    A[206] = 0.0482142857142861*G0_0_0 + 0.024107142857143*G0_0_2 + 0.048214285714286*G0_1_0 + 0.024107142857143*G0_1_2 + 0.0241071428571431*G0_2_0;
-    A[207] = 0.0723214285714284*G0_0_0 + 0.0482142857142854*G0_0_2 + 0.0723214285714284*G0_1_0 + 0.0482142857142854*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.0241071428571425*G0_2_2;
-    A[208] = 0.024107142857143*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.024107142857143*G0_1_0 + 0.0241071428571429*G0_1_1;
-    A[209] = 0.0241071428571429*G0_0_0 + 0.0241071428571431*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571431*G0_1_1;
-    A[210] = 0.241071428571429*G0_0_0 + 0.241071428571429*G0_0_1 + 0.144642857142857*G0_0_2 + 0.241071428571429*G0_1_0 + 0.241071428571429*G0_1_1 + 0.144642857142857*G0_1_2 + 0.144642857142857*G0_2_0 + 0.144642857142857*G0_2_1 + 0.241071428571429*G0_2_2;
-    A[211] = -0.0723214285714284*G0_0_0 - 0.0723214285714284*G0_0_1 - 0.144642857142857*G0_0_2 - 0.0723214285714284*G0_1_0 - 0.0723214285714285*G0_1_1 - 0.144642857142857*G0_1_2 - 0.0482142857142856*G0_2_0 - 0.0482142857142856*G0_2_1 - 0.192857142857143*G0_2_2;
-    A[212] = 0.120535714285714*G0_0_0 + 0.0241071428571427*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0241071428571427*G0_1_1 + 0.120535714285714*G0_1_2 + 0.0241071428571426*G0_2_0 + 0.120535714285714*G0_2_1 + 0.0241071428571426*G0_2_2;
-    A[213] = -0.0241071428571428*G0_0_0 + 0.0241071428571432*G0_0_1 - 0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_1_0 + 0.0241071428571431*G0_1_1 - 0.0241071428571428*G0_1_2 - 0.0241071428571429*G0_2_1;
-    A[214] = 0.0241071428571425*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.0241071428571425*G0_1_0 + 0.120535714285714*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.0241071428571426*G0_2_1 + 0.0241071428571426*G0_2_2;
-    A[215] = 0.0241071428571434*G0_0_0 - 0.0241071428571427*G0_0_1 - 0.0241071428571427*G0_0_2 + 0.0241071428571434*G0_1_0 - 0.0241071428571428*G0_1_1 - 0.0241071428571428*G0_1_2 - 0.0241071428571428*G0_2_0;
-    A[216] = 0.0482142857142855*G0_0_0 + 0.0482142857142853*G0_0_1 + 0.0241071428571432*G0_0_2 + 0.0482142857142855*G0_1_0 + 0.0482142857142853*G0_1_1 + 0.0241071428571432*G0_1_2 + 0.0241071428571423*G0_2_0 + 0.0241071428571426*G0_2_1;
-    A[217] = -0.0482142857142856*G0_0_0 - 0.289285714285714*G0_0_1 - 0.16875*G0_0_2 - 0.0482142857142856*G0_1_0 - 0.289285714285714*G0_1_1 - 0.16875*G0_1_2 - 0.0241071428571424*G0_2_0 - 0.168749999999999*G0_2_1 - 0.0482142857142854*G0_2_2;
-    A[218] = -0.289285714285715*G0_0_0 - 0.0482142857142858*G0_0_1 - 0.16875*G0_0_2 - 0.289285714285715*G0_1_0 - 0.0482142857142858*G0_1_1 - 0.16875*G0_1_2 - 0.16875*G0_2_0 - 0.0241071428571428*G0_2_1 - 0.0482142857142852*G0_2_2;
-    A[219] = -0.144642857142857*G0_0_0 - 0.144642857142857*G0_0_1 - 0.024107142857143*G0_0_2 - 0.144642857142857*G0_1_0 - 0.144642857142857*G0_1_1 - 0.024107142857143*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571422*G0_2_1;
-    A[220] = 0.0133928571428571*G0_0_0 + 0.0133928571428571*G0_0_1 + 0.0133928571428571*G0_0_2 + 0.0133928571428571*G0_1_0 + 0.0133928571428571*G0_1_1 + 0.0133928571428571*G0_1_2 + 0.0482142857142858*G0_2_0 + 0.0482142857142858*G0_2_1 + 0.0482142857142858*G0_2_2;
-    A[221] = -0.013392857142857*G0_0_0 - 0.013392857142857*G0_1_0;
+    A[204] = 0.0482142857142859*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0482142857142858*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571425*G0_2_1;
+    A[205] = 0.0723214285714284*G0_0_1 + 0.0482142857142854*G0_0_2 + 0.0723214285714285*G0_1_1 + 0.0482142857142855*G0_1_2 + 0.0482142857142857*G0_2_1 + 0.0241071428571429*G0_2_2;
+    A[206] = 0.0482142857142859*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0482142857142859*G0_1_0 + 0.024107142857143*G0_1_2 + 0.0241071428571429*G0_2_0;
+    A[207] = 0.0723214285714283*G0_0_0 + 0.0482142857142854*G0_0_2 + 0.0723214285714284*G0_1_0 + 0.0482142857142853*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.0241071428571426*G0_2_2;
+    A[208] = 0.0241071428571429*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.024107142857143*G0_1_0 + 0.0241071428571429*G0_1_1;
+    A[209] = 0.0241071428571429*G0_0_0 + 0.0241071428571431*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.024107142857143*G0_1_1;
+    A[210] = 0.241071428571429*G0_0_0 + 0.241071428571428*G0_0_1 + 0.144642857142857*G0_0_2 + 0.241071428571428*G0_1_0 + 0.241071428571429*G0_1_1 + 0.144642857142857*G0_1_2 + 0.144642857142857*G0_2_0 + 0.144642857142857*G0_2_1 + 0.241071428571428*G0_2_2;
+    A[211] = -0.0723214285714283*G0_0_0 - 0.0723214285714284*G0_0_1 - 0.144642857142857*G0_0_2 - 0.0723214285714284*G0_1_0 - 0.0723214285714284*G0_1_1 - 0.144642857142857*G0_1_2 - 0.0482142857142856*G0_2_0 - 0.0482142857142856*G0_2_1 - 0.192857142857143*G0_2_2;
+    A[212] = 0.120535714285714*G0_0_0 + 0.0241071428571426*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0241071428571426*G0_1_1 + 0.120535714285714*G0_1_2 + 0.0241071428571425*G0_2_0 + 0.120535714285714*G0_2_1 + 0.0241071428571425*G0_2_2;
+    A[213] = -0.0241071428571429*G0_0_0 + 0.0241071428571432*G0_0_1 - 0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_1_0 + 0.0241071428571432*G0_1_1 - 0.0241071428571428*G0_1_2 - 0.0241071428571429*G0_2_1;
+    A[214] = 0.0241071428571424*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.0241071428571424*G0_1_0 + 0.120535714285714*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.0241071428571425*G0_2_1 + 0.0241071428571425*G0_2_2;
+    A[215] = 0.0241071428571435*G0_0_0 - 0.0241071428571426*G0_0_1 - 0.0241071428571425*G0_0_2 + 0.0241071428571434*G0_1_0 - 0.0241071428571427*G0_1_1 - 0.0241071428571427*G0_1_2 - 0.0241071428571429*G0_2_0;
+    A[216] = 0.0482142857142854*G0_0_0 + 0.0482142857142852*G0_0_1 + 0.0241071428571429*G0_0_2 + 0.0482142857142855*G0_1_0 + 0.0482142857142853*G0_1_1 + 0.024107142857143*G0_1_2 + 0.0241071428571423*G0_2_0 + 0.0241071428571425*G0_2_1;
+    A[217] = -0.0482142857142855*G0_0_0 - 0.289285714285714*G0_0_1 - 0.16875*G0_0_2 - 0.0482142857142855*G0_1_0 - 0.289285714285714*G0_1_1 - 0.16875*G0_1_2 - 0.0241071428571424*G0_2_0 - 0.168749999999999*G0_2_1 - 0.0482142857142853*G0_2_2;
+    A[218] = -0.289285714285714*G0_0_0 - 0.0482142857142855*G0_0_1 - 0.16875*G0_0_2 - 0.289285714285714*G0_1_0 - 0.0482142857142857*G0_1_1 - 0.16875*G0_1_2 - 0.16875*G0_2_0 - 0.0241071428571427*G0_2_1 - 0.0482142857142852*G0_2_2;
+    A[219] = -0.144642857142857*G0_0_0 - 0.144642857142857*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.144642857142857*G0_1_0 - 0.144642857142857*G0_1_1 - 0.0241071428571429*G0_1_2 - 0.0241071428571426*G0_2_0 - 0.0241071428571422*G0_2_1;
+    A[220] = 0.013392857142857*G0_0_0 + 0.0133928571428571*G0_0_1 + 0.0133928571428571*G0_0_2 + 0.013392857142857*G0_1_0 + 0.0133928571428571*G0_1_1 + 0.0133928571428571*G0_1_2 + 0.0482142857142858*G0_2_0 + 0.0482142857142857*G0_2_1 + 0.0482142857142857*G0_2_2;
+    A[221] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_1_0;
     A[222] = -0.0133928571428572*G0_0_1 - 0.0133928571428572*G0_1_1;
-    A[223] = -0.0616071428571429*G0_0_2 - 0.0616071428571429*G0_1_2 - 0.0964285714285715*G0_2_2;
-    A[224] = 0.0723214285714284*G0_0_1 + 0.0241071428571429*G0_0_2 + 0.0723214285714285*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.024107142857143*G0_2_1;
-    A[225] = -0.192857142857143*G0_0_1 - 0.096428571428571*G0_0_2 - 0.192857142857143*G0_1_1 - 0.096428571428571*G0_1_2 - 0.0964285714285715*G0_2_1 + 0.0241071428571429*G0_2_2;
-    A[226] = 0.0723214285714281*G0_0_0 + 0.0241071428571428*G0_0_2 + 0.0723214285714282*G0_1_0 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_0;
-    A[227] = -0.192857142857142*G0_0_0 - 0.0964285714285714*G0_0_2 - 0.192857142857143*G0_1_0 - 0.0964285714285714*G0_1_2 - 0.0964285714285713*G0_2_0 + 0.0241071428571431*G0_2_2;
+    A[223] = -0.0616071428571429*G0_0_2 - 0.0616071428571429*G0_1_2 - 0.0964285714285714*G0_2_2;
+    A[224] = 0.0723214285714285*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0723214285714285*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.024107142857143*G0_2_1;
+    A[225] = -0.192857142857143*G0_0_1 - 0.0964285714285709*G0_0_2 - 0.192857142857143*G0_1_1 - 0.0964285714285709*G0_1_2 - 0.0964285714285714*G0_2_1 + 0.0241071428571429*G0_2_2;
+    A[226] = 0.0723214285714282*G0_0_0 + 0.0241071428571428*G0_0_2 + 0.0723214285714282*G0_1_0 + 0.0241071428571427*G0_1_2 + 0.0241071428571428*G0_2_0;
+    A[227] = -0.192857142857142*G0_0_0 - 0.0964285714285715*G0_0_2 - 0.192857142857143*G0_1_0 - 0.0964285714285714*G0_1_2 - 0.0964285714285712*G0_2_0 + 0.0241071428571432*G0_2_2;
     A[228] = 0.0241071428571428*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0241071428571429*G0_1_1;
-    A[229] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.024107142857143*G0_1_1;
-    A[230] = -0.0723214285714284*G0_0_0 - 0.0723214285714284*G0_0_1 - 0.0482142857142856*G0_0_2 - 0.0723214285714284*G0_1_0 - 0.0723214285714285*G0_1_1 - 0.0482142857142856*G0_1_2 - 0.144642857142857*G0_2_0 - 0.144642857142857*G0_2_1 - 0.192857142857143*G0_2_2;
-    A[231] = 0.192857142857142*G0_0_0 + 0.192857142857143*G0_0_1 + 0.0964285714285713*G0_0_2 + 0.192857142857143*G0_1_0 + 0.192857142857143*G0_1_1 + 0.0964285714285715*G0_1_2 + 0.0964285714285713*G0_2_0 + 0.0964285714285715*G0_2_1 + 0.241071428571429*G0_2_2;
-    A[232] = -0.0241071428571429*G0_0_0 - 0.0241071428571429*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.0241071428571429*G0_1_2 + 0.0241071428571433*G0_2_0 - 0.024107142857143*G0_2_1 + 0.0241071428571433*G0_2_2;
-    A[233] = -0.0241071428571429*G0_0_0 - 0.0241071428571429*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.024107142857143*G0_1_2 - 0.0241071428571427*G0_2_1;
-    A[234] = -0.0241071428571428*G0_0_1 - 0.0241071428571427*G0_0_2 - 0.0241071428571428*G0_1_1 - 0.0241071428571427*G0_1_2 - 0.0241071428571429*G0_2_0 + 0.0241071428571433*G0_2_1 + 0.0241071428571433*G0_2_2;
+    A[229] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_1;
+    A[230] = -0.0723214285714283*G0_0_0 - 0.0723214285714284*G0_0_1 - 0.0482142857142856*G0_0_2 - 0.0723214285714284*G0_1_0 - 0.0723214285714284*G0_1_1 - 0.0482142857142856*G0_1_2 - 0.144642857142857*G0_2_0 - 0.144642857142857*G0_2_1 - 0.192857142857143*G0_2_2;
+    A[231] = 0.192857142857142*G0_0_0 + 0.192857142857143*G0_0_1 + 0.0964285714285713*G0_0_2 + 0.192857142857143*G0_1_0 + 0.192857142857143*G0_1_1 + 0.0964285714285714*G0_1_2 + 0.0964285714285713*G0_2_0 + 0.0964285714285714*G0_2_1 + 0.241071428571428*G0_2_2;
+    A[232] = -0.0241071428571428*G0_0_0 - 0.0241071428571429*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0241071428571429*G0_1_2 + 0.0241071428571433*G0_2_0 - 0.024107142857143*G0_2_1 + 0.0241071428571433*G0_2_2;
+    A[233] = -0.0241071428571429*G0_0_0 - 0.024107142857143*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.024107142857143*G0_1_2 - 0.0241071428571427*G0_2_1;
+    A[234] = -0.0241071428571428*G0_0_1 - 0.0241071428571427*G0_0_2 - 0.0241071428571428*G0_1_1 - 0.0241071428571427*G0_1_2 - 0.0241071428571429*G0_2_0 + 0.0241071428571434*G0_2_1 + 0.0241071428571434*G0_2_2;
     A[235] = -0.0241071428571429*G0_0_1 - 0.0241071428571427*G0_0_2 - 0.0241071428571429*G0_1_1 - 0.0241071428571427*G0_1_2 - 0.0241071428571428*G0_2_0;
-    A[236] = -0.0964285714285713*G0_0_0 - 0.0964285714285715*G0_0_1 + 0.0241071428571428*G0_0_2 - 0.0964285714285713*G0_1_0 - 0.0964285714285715*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_1;
-    A[237] = 0.0964285714285714*G0_0_0 + 0.120535714285714*G0_0_2 + 0.0964285714285714*G0_1_0 + 0.120535714285714*G0_1_2 - 0.0241071428571427*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142862*G0_2_2;
-    A[238] = 0.0964285714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.0964285714285715*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 - 0.0241071428571428*G0_2_1 - 0.0482142857142864*G0_2_2;
-    A[239] = -0.0241071428571429*G0_0_2 - 0.0241071428571429*G0_1_2 - 0.0241071428571431*G0_2_0 - 0.0241071428571434*G0_2_1;
-    A[240] = -0.0348214285714285*G0_0_0 - 0.0348214285714285*G0_0_1 - 0.0348214285714284*G0_0_2 - 0.0964285714285716*G0_1_0 - 0.0964285714285716*G0_1_1 - 0.0964285714285715*G0_1_2 - 0.0348214285714285*G0_2_0 - 0.0348214285714285*G0_2_1 - 0.0348214285714284*G0_2_2;
-    A[241] = -0.0133928571428572*G0_0_0 - 0.0133928571428573*G0_2_0;
-    A[242] = 0.0348214285714286*G0_0_1 + 0.0482142857142857*G0_1_1 + 0.0348214285714284*G0_2_1;
+    A[236] = -0.0964285714285713*G0_0_0 - 0.0964285714285714*G0_0_1 + 0.0241071428571428*G0_0_2 - 0.0964285714285713*G0_1_0 - 0.0964285714285714*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571429*G0_2_1;
+    A[237] = 0.0964285714285714*G0_0_0 + 0.120535714285714*G0_0_2 + 0.0964285714285714*G0_1_0 + 0.120535714285714*G0_1_2 - 0.0241071428571428*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142861*G0_2_2;
+    A[238] = 0.0964285714285715*G0_0_1 + 0.120535714285714*G0_0_2 + 0.0964285714285716*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 - 0.0241071428571428*G0_2_1 - 0.0482142857142864*G0_2_2;
+    A[239] = -0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_1_2 - 0.0241071428571431*G0_2_0 - 0.0241071428571434*G0_2_1;
+    A[240] = -0.0348214285714286*G0_0_0 - 0.0348214285714285*G0_0_1 - 0.0348214285714284*G0_0_2 - 0.0964285714285717*G0_1_0 - 0.0964285714285716*G0_1_1 - 0.0964285714285715*G0_1_2 - 0.0348214285714285*G0_2_0 - 0.0348214285714285*G0_2_1 - 0.0348214285714284*G0_2_2;
+    A[241] = -0.0133928571428573*G0_0_0 - 0.0133928571428573*G0_2_0;
+    A[242] = 0.0348214285714286*G0_0_1 + 0.0482142857142856*G0_1_1 + 0.0348214285714284*G0_2_1;
     A[243] = -0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_2_2;
-    A[244] = 0.0482142857142861*G0_0_1 + 0.0723214285714287*G0_0_2 + 0.0241071428571428*G0_1_1 + 0.0482142857142855*G0_1_2 + 0.0482142857142857*G0_2_1 + 0.0723214285714281*G0_2_2;
-    A[245] = 0.0241071428571429*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.0241071428571429*G0_1_2 + 0.0241071428571429*G0_2_1 + 0.0482142857142857*G0_2_2;
-    A[246] = 0.0241071428571431*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571432*G0_2_0 + 0.0241071428571429*G0_2_2;
-    A[247] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_2;
-    A[248] = 0.0482142857142854*G0_0_0 + 0.0241071428571427*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0482142857142856*G0_2_0 + 0.0241071428571427*G0_2_1;
-    A[249] = 0.072321428571429*G0_0_0 + 0.048214285714286*G0_0_1 + 0.0482142857142858*G0_1_0 + 0.024107142857143*G0_1_1 + 0.0723214285714284*G0_2_0 + 0.0482142857142857*G0_2_1;
-    A[250] = 0.120535714285714*G0_0_0 + 0.120535714285714*G0_0_1 + 0.0241071428571426*G0_0_2 + 0.0241071428571427*G0_1_0 + 0.0241071428571427*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 + 0.0241071428571426*G0_2_2;
-    A[251] = -0.0241071428571429*G0_0_0 - 0.0241071428571429*G0_0_1 + 0.0241071428571433*G0_0_2 - 0.024107142857143*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571429*G0_2_1 + 0.0241071428571433*G0_2_2;
+    A[244] = 0.0482142857142862*G0_0_1 + 0.0723214285714289*G0_0_2 + 0.0241071428571427*G0_1_1 + 0.0482142857142853*G0_1_2 + 0.0482142857142856*G0_2_1 + 0.072321428571428*G0_2_2;
+    A[245] = 0.0241071428571429*G0_0_1 + 0.0482142857142855*G0_0_2 + 0.0241071428571429*G0_1_2 + 0.0241071428571429*G0_2_1 + 0.0482142857142857*G0_2_2;
+    A[246] = 0.0241071428571429*G0_0_0 + 0.0241071428571427*G0_0_2 + 0.0241071428571432*G0_2_0 + 0.0241071428571429*G0_2_2;
+    A[247] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.024107142857143*G0_2_2;
+    A[248] = 0.0482142857142852*G0_0_0 + 0.0241071428571425*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0482142857142857*G0_2_0 + 0.0241071428571428*G0_2_1;
+    A[249] = 0.0723214285714292*G0_0_0 + 0.0482142857142861*G0_0_1 + 0.0482142857142857*G0_1_0 + 0.024107142857143*G0_1_1 + 0.0723214285714283*G0_2_0 + 0.0482142857142856*G0_2_1;
+    A[250] = 0.120535714285714*G0_0_0 + 0.120535714285714*G0_0_1 + 0.0241071428571425*G0_0_2 + 0.0241071428571426*G0_1_0 + 0.0241071428571426*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 + 0.0241071428571425*G0_2_2;
+    A[251] = -0.0241071428571428*G0_0_0 - 0.0241071428571428*G0_0_1 + 0.0241071428571433*G0_0_2 - 0.024107142857143*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571429*G0_2_1 + 0.0241071428571433*G0_2_2;
     A[252] = 0.241071428571429*G0_0_0 + 0.144642857142857*G0_0_1 + 0.241071428571429*G0_0_2 + 0.144642857142857*G0_1_0 + 0.241071428571429*G0_1_1 + 0.144642857142857*G0_1_2 + 0.241071428571429*G0_2_0 + 0.144642857142857*G0_2_1 + 0.241071428571428*G0_2_2;
-    A[253] = -0.072321428571429*G0_0_0 - 0.144642857142857*G0_0_1 - 0.0723214285714288*G0_0_2 - 0.0482142857142858*G0_1_0 - 0.192857142857143*G0_1_1 - 0.0482142857142857*G0_1_2 - 0.0723214285714284*G0_2_0 - 0.144642857142857*G0_2_1 - 0.0723214285714282*G0_2_2;
-    A[254] = 0.0241071428571424*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0241071428571427*G0_1_1 + 0.0241071428571427*G0_1_2 + 0.0241071428571424*G0_2_0 + 0.120535714285714*G0_2_1 + 0.120535714285714*G0_2_2;
-    A[255] = 0.0241071428571433*G0_0_0 - 0.0241071428571427*G0_0_1 - 0.0241071428571427*G0_0_2 - 0.0241071428571428*G0_1_0 + 0.0241071428571433*G0_2_0 - 0.0241071428571428*G0_2_1 - 0.0241071428571427*G0_2_2;
-    A[256] = 0.0482142857142863*G0_0_0 + 0.0241071428571431*G0_0_1 + 0.0482142857142864*G0_0_2 + 0.0241071428571431*G0_1_0 + 0.0241071428571434*G0_1_2 + 0.0482142857142857*G0_2_0 + 0.024107142857143*G0_2_1 + 0.048214285714286*G0_2_2;
-    A[257] = -0.0482142857142863*G0_0_0 - 0.16875*G0_0_1 - 0.289285714285714*G0_0_2 - 0.0241071428571431*G0_1_0 - 0.0482142857142856*G0_1_1 - 0.16875*G0_1_2 - 0.0482142857142857*G0_2_0 - 0.16875*G0_2_1 - 0.289285714285714*G0_2_2;
-    A[258] = -0.144642857142858*G0_0_0 - 0.0241071428571434*G0_0_1 - 0.144642857142858*G0_0_2 - 0.024107142857143*G0_1_0 - 0.0241071428571428*G0_1_2 - 0.144642857142858*G0_2_0 - 0.0241071428571433*G0_2_1 - 0.144642857142858*G0_2_2;
-    A[259] = -0.289285714285714*G0_0_0 - 0.16875*G0_0_1 - 0.0482142857142861*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142854*G0_1_1 - 0.0241071428571434*G0_1_2 - 0.289285714285714*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142857*G0_2_2;
-    A[260] = 0.0133928571428572*G0_0_0 + 0.0133928571428571*G0_0_1 + 0.013392857142857*G0_0_2 + 0.0482142857142859*G0_1_0 + 0.0482142857142859*G0_1_1 + 0.0482142857142858*G0_1_2 + 0.0133928571428572*G0_2_0 + 0.0133928571428571*G0_2_1 + 0.0133928571428569*G0_2_2;
-    A[261] = -0.0133928571428573*G0_0_0 - 0.0133928571428572*G0_2_0;
-    A[262] = -0.0616071428571429*G0_0_1 - 0.0964285714285715*G0_1_1 - 0.0616071428571427*G0_2_1;
+    A[253] = -0.0723214285714292*G0_0_0 - 0.144642857142857*G0_0_1 - 0.072321428571429*G0_0_2 - 0.0482142857142857*G0_1_0 - 0.192857142857143*G0_1_1 - 0.0482142857142855*G0_1_2 - 0.0723214285714283*G0_2_0 - 0.144642857142856*G0_2_1 - 0.0723214285714281*G0_2_2;
+    A[254] = 0.0241071428571423*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0241071428571426*G0_1_1 + 0.0241071428571426*G0_1_2 + 0.0241071428571424*G0_2_0 + 0.120535714285714*G0_2_1 + 0.120535714285714*G0_2_2;
+    A[255] = 0.0241071428571434*G0_0_0 - 0.0241071428571425*G0_0_1 - 0.0241071428571425*G0_0_2 - 0.0241071428571429*G0_1_0 + 0.0241071428571434*G0_2_0 - 0.0241071428571427*G0_2_1 - 0.0241071428571427*G0_2_2;
+    A[256] = 0.0482142857142863*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0482142857142862*G0_0_2 + 0.024107142857143*G0_1_0 + 0.0241071428571432*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.0241071428571431*G0_2_1 + 0.0482142857142858*G0_2_2;
+    A[257] = -0.0482142857142863*G0_0_0 - 0.16875*G0_0_1 - 0.289285714285714*G0_0_2 - 0.024107142857143*G0_1_0 - 0.0482142857142854*G0_1_1 - 0.16875*G0_1_2 - 0.0482142857142856*G0_2_0 - 0.16875*G0_2_1 - 0.289285714285714*G0_2_2;
+    A[258] = -0.144642857142857*G0_0_0 - 0.0241071428571432*G0_0_1 - 0.144642857142858*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.0241071428571428*G0_1_2 - 0.144642857142857*G0_2_0 - 0.0241071428571433*G0_2_1 - 0.144642857142858*G0_2_2;
+    A[259] = -0.289285714285714*G0_0_0 - 0.16875*G0_0_1 - 0.048214285714286*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142854*G0_1_1 - 0.0241071428571432*G0_1_2 - 0.289285714285714*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142857*G0_2_2;
+    A[260] = 0.0133928571428573*G0_0_0 + 0.0133928571428571*G0_0_1 + 0.013392857142857*G0_0_2 + 0.048214285714286*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0482142857142858*G0_1_2 + 0.0133928571428573*G0_2_0 + 0.013392857142857*G0_2_1 + 0.0133928571428569*G0_2_2;
+    A[261] = -0.0133928571428572*G0_0_0 - 0.0133928571428572*G0_2_0;
+    A[262] = -0.0616071428571428*G0_0_1 - 0.0964285714285714*G0_1_1 - 0.0616071428571426*G0_2_1;
     A[263] = -0.0133928571428571*G0_0_2 - 0.013392857142857*G0_2_2;
-    A[264] = -0.0964285714285715*G0_0_1 - 0.192857142857143*G0_0_2 + 0.0241071428571429*G0_1_1 - 0.0964285714285713*G0_1_2 - 0.0964285714285711*G0_2_1 - 0.192857142857143*G0_2_2;
+    A[264] = -0.0964285714285715*G0_0_1 - 0.192857142857143*G0_0_2 + 0.024107142857143*G0_1_1 - 0.096428571428571*G0_1_2 - 0.0964285714285711*G0_2_1 - 0.192857142857143*G0_2_2;
     A[265] = 0.0241071428571429*G0_0_1 + 0.0723214285714293*G0_0_2 + 0.024107142857143*G0_1_2 + 0.024107142857143*G0_2_1 + 0.0723214285714293*G0_2_2;
-    A[266] = 0.024107142857143*G0_0_0 + 0.0241071428571432*G0_0_2 + 0.024107142857143*G0_2_0 + 0.0241071428571432*G0_2_2;
-    A[267] = 0.0241071428571429*G0_0_0 + 0.0241071428571427*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571428*G0_2_2;
-    A[268] = 0.0723214285714292*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.072321428571429*G0_2_0 + 0.0241071428571429*G0_2_1;
-    A[269] = -0.192857142857144*G0_0_0 - 0.0964285714285719*G0_0_1 - 0.0964285714285717*G0_1_0 + 0.0241071428571427*G0_1_1 - 0.192857142857143*G0_2_0 - 0.0964285714285717*G0_2_1;
-    A[270] = -0.0241071428571428*G0_0_0 - 0.0241071428571428*G0_0_1 + 0.0241071428571432*G0_1_0 + 0.0241071428571431*G0_1_1 - 0.0241071428571429*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571428*G0_2_1;
-    A[271] = -0.0241071428571429*G0_0_0 - 0.0241071428571429*G0_0_1 - 0.0241071428571427*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.024107142857143*G0_2_1;
-    A[272] = -0.072321428571429*G0_0_0 - 0.0482142857142858*G0_0_1 - 0.0723214285714284*G0_0_2 - 0.144642857142857*G0_1_0 - 0.192857142857143*G0_1_1 - 0.144642857142857*G0_1_2 - 0.0723214285714288*G0_2_0 - 0.0482142857142857*G0_2_1 - 0.0723214285714282*G0_2_2;
-    A[273] = 0.192857142857144*G0_0_0 + 0.0964285714285717*G0_0_1 + 0.192857142857143*G0_0_2 + 0.0964285714285717*G0_1_0 + 0.241071428571429*G0_1_1 + 0.0964285714285714*G0_1_2 + 0.192857142857143*G0_2_0 + 0.0964285714285714*G0_2_1 + 0.192857142857143*G0_2_2;
-    A[274] = -0.0241071428571428*G0_0_1 - 0.024107142857143*G0_0_2 - 0.0241071428571429*G0_1_0 + 0.0241071428571432*G0_1_1 + 0.0241071428571431*G0_1_2 - 0.0241071428571428*G0_2_1 - 0.024107142857143*G0_2_2;
-    A[275] = -0.0241071428571427*G0_0_1 - 0.024107142857143*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0241071428571427*G0_2_1 - 0.024107142857143*G0_2_2;
-    A[276] = -0.0964285714285721*G0_0_0 + 0.0241071428571423*G0_0_1 - 0.096428571428573*G0_0_2 + 0.0241071428571423*G0_1_0 + 0.0241071428571416*G0_1_2 - 0.0964285714285713*G0_2_0 + 0.0241071428571427*G0_2_1 - 0.0964285714285724*G0_2_2;
-    A[277] = 0.096428571428572*G0_0_0 + 0.120535714285715*G0_0_1 - 0.0241071428571423*G0_1_0 - 0.048214285714286*G0_1_1 + 0.120535714285713*G0_1_2 + 0.0964285714285713*G0_2_0 + 0.120535714285714*G0_2_1;
-    A[278] = -0.0241071428571426*G0_0_1 - 0.0241071428571429*G0_1_0 - 0.024107142857143*G0_1_2 - 0.024107142857143*G0_2_1;
-    A[279] = 0.120535714285714*G0_0_1 + 0.0964285714285725*G0_0_2 + 0.120535714285714*G0_1_0 - 0.0482142857142859*G0_1_1 - 0.0241071428571418*G0_1_2 + 0.120535714285714*G0_2_1 + 0.0964285714285719*G0_2_2;
-    A[280] = -0.0964285714285713*G0_0_0 - 0.0964285714285714*G0_0_1 - 0.0964285714285714*G0_0_2 - 0.0348214285714283*G0_1_0 - 0.0348214285714284*G0_1_1 - 0.0348214285714284*G0_1_2 - 0.0348214285714284*G0_2_0 - 0.0348214285714284*G0_2_1 - 0.0348214285714284*G0_2_2;
-    A[281] = 0.0482142857142854*G0_0_0 + 0.0348214285714282*G0_1_0 + 0.0348214285714282*G0_2_0;
-    A[282] = -0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_2_1;
-    A[283] = -0.0133928571428572*G0_1_2 - 0.0133928571428572*G0_2_2;
-    A[284] = 0.024107142857143*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571432*G0_2_1 + 0.024107142857143*G0_2_2;
-    A[285] = 0.0241071428571428*G0_1_1 + 0.0241071428571427*G0_1_2 + 0.0241071428571427*G0_2_1 + 0.0241071428571427*G0_2_2;
-    A[286] = 0.0241071428571425*G0_0_0 + 0.0482142857142851*G0_0_2 + 0.0482142857142855*G0_1_0 + 0.0723214285714281*G0_1_2 + 0.0482142857142854*G0_2_0 + 0.072321428571428*G0_2_2;
-    A[287] = 0.0241071428571429*G0_0_2 + 0.0241071428571428*G0_1_0 + 0.0482142857142857*G0_1_2 + 0.0241071428571427*G0_2_0 + 0.0482142857142856*G0_2_2;
-    A[288] = 0.0241071428571424*G0_0_0 + 0.048214285714285*G0_0_1 + 0.0482142857142853*G0_1_0 + 0.072321428571428*G0_1_1 + 0.0482142857142852*G0_2_0 + 0.0723214285714279*G0_2_1;
-    A[289] = 0.0241071428571429*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.024107142857143*G0_2_0 + 0.048214285714286*G0_2_1;
-    A[290] = 0.0241071428571425*G0_0_0 + 0.0241071428571425*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.120535714285714*G0_1_1 + 0.0241071428571426*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 + 0.0241071428571426*G0_2_2;
-    A[291] = -0.0241071428571429*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0241071428571428*G0_1_1 + 0.0241071428571433*G0_1_2 - 0.0241071428571427*G0_2_0 - 0.0241071428571427*G0_2_1 + 0.0241071428571433*G0_2_2;
-    A[292] = 0.0241071428571424*G0_0_0 + 0.120535714285714*G0_0_1 + 0.0241071428571424*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0241071428571427*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.0241071428571427*G0_2_1 + 0.120535714285714*G0_2_2;
-    A[293] = -0.0241071428571429*G0_0_1 - 0.0241071428571428*G0_1_0 + 0.0241071428571432*G0_1_1 - 0.0241071428571428*G0_1_2 - 0.024107142857143*G0_2_0 + 0.0241071428571431*G0_2_1 - 0.024107142857143*G0_2_2;
+    A[266] = 0.0241071428571429*G0_0_0 + 0.0241071428571431*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571431*G0_2_2;
+    A[267] = 0.0241071428571429*G0_0_0 + 0.0241071428571427*G0_0_2 + 0.024107142857143*G0_2_0 + 0.0241071428571428*G0_2_2;
+    A[268] = 0.0723214285714291*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0723214285714289*G0_2_0 + 0.0241071428571429*G0_2_1;
+    A[269] = -0.192857142857144*G0_0_0 - 0.0964285714285719*G0_0_1 - 0.0964285714285716*G0_1_0 + 0.0241071428571427*G0_1_1 - 0.192857142857143*G0_2_0 - 0.0964285714285716*G0_2_1;
+    A[270] = -0.0241071428571429*G0_0_0 - 0.0241071428571428*G0_0_1 + 0.0241071428571432*G0_1_0 + 0.0241071428571432*G0_1_1 - 0.0241071428571429*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571428*G0_2_1;
+    A[271] = -0.0241071428571429*G0_0_0 - 0.0241071428571429*G0_0_1 - 0.0241071428571427*G0_1_2 - 0.024107142857143*G0_2_0 - 0.024107142857143*G0_2_1;
+    A[272] = -0.0723214285714292*G0_0_0 - 0.0482142857142857*G0_0_1 - 0.0723214285714283*G0_0_2 - 0.144642857142857*G0_1_0 - 0.192857142857143*G0_1_1 - 0.144642857142856*G0_1_2 - 0.072321428571429*G0_2_0 - 0.0482142857142855*G0_2_1 - 0.0723214285714281*G0_2_2;
+    A[273] = 0.192857142857144*G0_0_0 + 0.0964285714285715*G0_0_1 + 0.192857142857143*G0_0_2 + 0.0964285714285715*G0_1_0 + 0.241071428571428*G0_1_1 + 0.0964285714285712*G0_1_2 + 0.192857142857143*G0_2_0 + 0.0964285714285712*G0_2_1 + 0.192857142857143*G0_2_2;
+    A[274] = -0.0241071428571428*G0_0_1 - 0.024107142857143*G0_0_2 - 0.024107142857143*G0_1_0 + 0.0241071428571433*G0_1_1 + 0.0241071428571433*G0_1_2 - 0.0241071428571428*G0_2_1 - 0.024107142857143*G0_2_2;
+    A[275] = -0.0241071428571427*G0_0_1 - 0.0241071428571431*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0241071428571427*G0_2_1 - 0.0241071428571431*G0_2_2;
+    A[276] = -0.096428571428572*G0_0_0 + 0.0241071428571424*G0_0_1 - 0.0964285714285728*G0_0_2 + 0.0241071428571423*G0_1_0 + 0.0241071428571418*G0_1_2 - 0.0964285714285712*G0_2_0 + 0.0241071428571428*G0_2_1 - 0.0964285714285723*G0_2_2;
+    A[277] = 0.0964285714285721*G0_0_0 + 0.120535714285715*G0_0_1 - 0.0241071428571424*G0_1_0 - 0.0482142857142863*G0_1_1 + 0.120535714285713*G0_1_2 + 0.0964285714285713*G0_2_0 + 0.120535714285714*G0_2_1;
+    A[278] = -0.0241071428571427*G0_0_1 - 0.0241071428571429*G0_1_0 - 0.0241071428571431*G0_1_2 - 0.0241071428571431*G0_2_1;
+    A[279] = 0.120535714285714*G0_0_1 + 0.0964285714285725*G0_0_2 + 0.120535714285714*G0_1_0 - 0.0482142857142861*G0_1_1 - 0.0241071428571419*G0_1_2 + 0.120535714285714*G0_2_1 + 0.0964285714285719*G0_2_2;
+    A[280] = -0.0964285714285713*G0_0_0 - 0.0964285714285715*G0_0_1 - 0.0964285714285714*G0_0_2 - 0.0348214285714283*G0_1_0 - 0.0348214285714284*G0_1_1 - 0.0348214285714284*G0_1_2 - 0.0348214285714283*G0_2_0 - 0.0348214285714284*G0_2_1 - 0.0348214285714284*G0_2_2;
+    A[281] = 0.0482142857142854*G0_0_0 + 0.0348214285714282*G0_1_0 + 0.0348214285714281*G0_2_0;
+    A[282] = -0.0133928571428573*G0_1_1 - 0.0133928571428573*G0_2_1;
+    A[283] = -0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_2;
+    A[284] = 0.0241071428571431*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571432*G0_2_1 + 0.024107142857143*G0_2_2;
+    A[285] = 0.0241071428571429*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0241071428571427*G0_2_2;
+    A[286] = 0.0241071428571423*G0_0_0 + 0.0482142857142849*G0_0_2 + 0.0482142857142853*G0_1_0 + 0.0723214285714279*G0_1_2 + 0.0482142857142853*G0_2_0 + 0.0723214285714279*G0_2_2;
+    A[287] = 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0482142857142857*G0_1_2 + 0.0241071428571428*G0_2_0 + 0.0482142857142856*G0_2_2;
+    A[288] = 0.0241071428571423*G0_0_0 + 0.0482142857142848*G0_0_1 + 0.0482142857142852*G0_1_0 + 0.0723214285714279*G0_1_1 + 0.0482142857142851*G0_2_0 + 0.0723214285714278*G0_2_1;
+    A[289] = 0.0241071428571431*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.024107142857143*G0_2_0 + 0.048214285714286*G0_2_1;
+    A[290] = 0.0241071428571424*G0_0_0 + 0.0241071428571424*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.120535714285714*G0_1_1 + 0.0241071428571425*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 + 0.0241071428571425*G0_2_2;
+    A[291] = -0.0241071428571429*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0241071428571428*G0_1_1 + 0.0241071428571434*G0_1_2 - 0.0241071428571427*G0_2_0 - 0.0241071428571427*G0_2_1 + 0.0241071428571434*G0_2_2;
+    A[292] = 0.0241071428571423*G0_0_0 + 0.120535714285714*G0_0_1 + 0.0241071428571424*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0241071428571426*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.0241071428571426*G0_2_1 + 0.120535714285714*G0_2_2;
+    A[293] = -0.024107142857143*G0_0_1 - 0.0241071428571428*G0_1_0 + 0.0241071428571433*G0_1_1 - 0.0241071428571428*G0_1_2 - 0.024107142857143*G0_2_0 + 0.0241071428571433*G0_2_1 - 0.024107142857143*G0_2_2;
     A[294] = 0.241071428571428*G0_0_0 + 0.144642857142856*G0_0_1 + 0.144642857142856*G0_0_2 + 0.144642857142856*G0_1_0 + 0.241071428571428*G0_1_1 + 0.241071428571428*G0_1_2 + 0.144642857142856*G0_2_0 + 0.241071428571428*G0_2_1 + 0.241071428571428*G0_2_2;
-    A[295] = -0.192857142857142*G0_0_0 - 0.0482142857142851*G0_0_1 - 0.0482142857142851*G0_0_2 - 0.144642857142856*G0_1_0 - 0.0723214285714279*G0_1_1 - 0.0723214285714278*G0_1_2 - 0.144642857142856*G0_2_0 - 0.0723214285714278*G0_2_1 - 0.0723214285714278*G0_2_2;
-    A[296] = 0.0241071428571424*G0_0_1 + 0.0241071428571423*G0_0_2 + 0.0241071428571426*G0_1_0 + 0.0482142857142849*G0_1_1 + 0.0482142857142851*G0_1_2 + 0.0241071428571427*G0_2_0 + 0.0482142857142847*G0_2_1 + 0.0482142857142852*G0_2_2;
-    A[297] = -0.0241071428571425*G0_0_1 - 0.0241071428571425*G0_0_2 - 0.0241071428571426*G0_1_0 - 0.144642857142857*G0_1_1 - 0.144642857142857*G0_1_2 - 0.0241071428571427*G0_2_0 - 0.144642857142857*G0_2_1 - 0.144642857142857*G0_2_2;
-    A[298] = -0.0482142857142849*G0_0_0 - 0.0241071428571425*G0_0_1 - 0.168749999999999*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142852*G0_1_1 - 0.289285714285715*G0_1_2 - 0.16875*G0_2_0 - 0.048214285714285*G0_2_1 - 0.289285714285715*G0_2_2;
-    A[299] = -0.0482142857142847*G0_0_0 - 0.168749999999999*G0_0_1 - 0.0241071428571423*G0_0_2 - 0.168749999999999*G0_1_0 - 0.289285714285714*G0_1_1 - 0.0482142857142849*G0_1_2 - 0.16875*G0_2_0 - 0.289285714285715*G0_2_1 - 0.048214285714285*G0_2_2;
-    A[300] = 0.0482142857142855*G0_0_0 + 0.0482142857142856*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.013392857142857*G0_1_0 + 0.013392857142857*G0_1_1 + 0.0133928571428571*G0_1_2 + 0.013392857142857*G0_2_0 + 0.013392857142857*G0_2_1 + 0.0133928571428571*G0_2_2;
-    A[301] = -0.0964285714285712*G0_0_0 - 0.0616071428571427*G0_1_0 - 0.0616071428571427*G0_2_0;
-    A[302] = -0.0133928571428572*G0_1_1 - 0.0133928571428571*G0_2_1;
+    A[295] = -0.192857142857142*G0_0_0 - 0.0482142857142848*G0_0_1 - 0.0482142857142848*G0_0_2 - 0.144642857142856*G0_1_0 - 0.0723214285714277*G0_1_1 - 0.0723214285714276*G0_1_2 - 0.144642857142856*G0_2_0 - 0.0723214285714276*G0_2_1 - 0.0723214285714276*G0_2_2;
+    A[296] = 0.0241071428571422*G0_0_1 + 0.0241071428571423*G0_0_2 + 0.0241071428571426*G0_1_0 + 0.0482142857142848*G0_1_1 + 0.0482142857142849*G0_1_2 + 0.0241071428571427*G0_2_0 + 0.0482142857142847*G0_2_1 + 0.0482142857142851*G0_2_2;
+    A[297] = -0.0241071428571425*G0_0_1 - 0.0241071428571423*G0_0_2 - 0.0241071428571427*G0_1_0 - 0.144642857142857*G0_1_1 - 0.144642857142857*G0_1_2 - 0.0241071428571427*G0_2_0 - 0.144642857142857*G0_2_1 - 0.144642857142857*G0_2_2;
+    A[298] = -0.0482142857142847*G0_0_0 - 0.0241071428571423*G0_0_1 - 0.168749999999999*G0_0_2 - 0.16875*G0_1_0 - 0.048214285714285*G0_1_1 - 0.289285714285715*G0_1_2 - 0.16875*G0_2_0 - 0.0482142857142849*G0_2_1 - 0.289285714285715*G0_2_2;
+    A[299] = -0.0482142857142845*G0_0_0 - 0.168749999999999*G0_0_1 - 0.0241071428571423*G0_0_2 - 0.168749999999999*G0_1_0 - 0.289285714285714*G0_1_1 - 0.0482142857142849*G0_1_2 - 0.168749999999999*G0_2_0 - 0.289285714285715*G0_2_1 - 0.048214285714285*G0_2_2;
+    A[300] = 0.0482142857142855*G0_0_0 + 0.0482142857142856*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.0133928571428568*G0_1_0 + 0.0133928571428569*G0_1_1 + 0.0133928571428569*G0_1_2 + 0.0133928571428568*G0_2_0 + 0.0133928571428569*G0_2_1 + 0.0133928571428569*G0_2_2;
+    A[301] = -0.0964285714285711*G0_0_0 - 0.0616071428571426*G0_1_0 - 0.0616071428571426*G0_2_0;
+    A[302] = -0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_2_1;
     A[303] = -0.013392857142857*G0_1_2 - 0.013392857142857*G0_2_2;
-    A[304] = 0.0241071428571428*G0_1_1 + 0.0241071428571427*G0_1_2 + 0.0241071428571431*G0_2_1 + 0.024107142857143*G0_2_2;
+    A[304] = 0.0241071428571427*G0_1_1 + 0.0241071428571426*G0_1_2 + 0.0241071428571431*G0_2_1 + 0.024107142857143*G0_2_2;
     A[305] = 0.0241071428571429*G0_1_1 + 0.0241071428571426*G0_1_2 + 0.0241071428571427*G0_2_1 + 0.0241071428571424*G0_2_2;
-    A[306] = 0.0241071428571433*G0_0_0 - 0.0964285714285708*G0_0_2 - 0.0964285714285711*G0_1_0 - 0.192857142857143*G0_1_2 - 0.0964285714285711*G0_2_0 - 0.192857142857143*G0_2_2;
-    A[307] = 0.024107142857143*G0_0_2 + 0.0241071428571428*G0_1_0 + 0.0723214285714289*G0_1_2 + 0.0241071428571427*G0_2_0 + 0.0723214285714287*G0_2_2;
-    A[308] = 0.0241071428571432*G0_0_0 - 0.096428571428571*G0_0_1 - 0.0964285714285713*G0_1_0 - 0.192857142857143*G0_1_1 - 0.0964285714285713*G0_2_0 - 0.192857142857143*G0_2_1;
-    A[309] = 0.0241071428571429*G0_0_1 + 0.0241071428571427*G0_1_0 + 0.0723214285714285*G0_1_1 + 0.024107142857143*G0_2_0 + 0.0723214285714288*G0_2_1;
-    A[310] = 0.0241071428571434*G0_0_0 + 0.0241071428571434*G0_0_1 - 0.0241071428571428*G0_0_2 - 0.0241071428571427*G0_1_0 - 0.0241071428571428*G0_1_1 - 0.0241071428571427*G0_2_0 - 0.0241071428571427*G0_2_1;
+    A[306] = 0.0241071428571435*G0_0_0 - 0.0964285714285706*G0_0_2 - 0.096428571428571*G0_1_0 - 0.192857142857143*G0_1_2 - 0.096428571428571*G0_2_0 - 0.192857142857143*G0_2_2;
+    A[307] = 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0723214285714289*G0_1_2 + 0.0241071428571427*G0_2_0 + 0.0723214285714287*G0_2_2;
+    A[308] = 0.0241071428571433*G0_0_0 - 0.0964285714285707*G0_0_1 - 0.0964285714285711*G0_1_0 - 0.192857142857143*G0_1_1 - 0.0964285714285711*G0_2_0 - 0.192857142857143*G0_2_1;
+    A[309] = 0.0241071428571428*G0_0_1 + 0.0241071428571427*G0_1_0 + 0.0723214285714286*G0_1_1 + 0.0241071428571431*G0_2_0 + 0.0723214285714289*G0_2_1;
+    A[310] = 0.0241071428571435*G0_0_0 + 0.0241071428571434*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0241071428571426*G0_1_0 - 0.0241071428571427*G0_1_1 - 0.0241071428571426*G0_2_0 - 0.0241071428571427*G0_2_1;
     A[311] = -0.0241071428571428*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.0241071428571429*G0_1_1 - 0.0241071428571427*G0_2_0 - 0.0241071428571427*G0_2_1;
-    A[312] = 0.0241071428571433*G0_0_0 - 0.0241071428571428*G0_0_1 + 0.0241071428571433*G0_0_2 - 0.0241071428571427*G0_1_0 - 0.0241071428571428*G0_1_2 - 0.0241071428571427*G0_2_0 - 0.0241071428571427*G0_2_2;
-    A[313] = -0.0241071428571428*G0_0_1 - 0.0241071428571427*G0_1_0 - 0.0241071428571427*G0_1_2 - 0.024107142857143*G0_2_0 - 0.024107142857143*G0_2_2;
-    A[314] = -0.192857142857142*G0_0_0 - 0.144642857142856*G0_0_1 - 0.144642857142856*G0_0_2 - 0.0482142857142851*G0_1_0 - 0.0723214285714279*G0_1_1 - 0.0723214285714278*G0_1_2 - 0.0482142857142851*G0_2_0 - 0.0723214285714278*G0_2_1 - 0.0723214285714278*G0_2_2;
-    A[315] = 0.241071428571428*G0_0_0 + 0.0964285714285709*G0_0_1 + 0.0964285714285709*G0_0_2 + 0.0964285714285709*G0_1_0 + 0.192857142857142*G0_1_1 + 0.192857142857142*G0_1_2 + 0.0964285714285709*G0_2_0 + 0.192857142857142*G0_2_1 + 0.192857142857142*G0_2_2;
-    A[316] = 0.0241071428571434*G0_0_1 + 0.0241071428571433*G0_0_2 + 0.0241071428571426*G0_1_0 - 0.0964285714285715*G0_1_1 - 0.0964285714285715*G0_1_2 + 0.0241071428571428*G0_2_0 - 0.0964285714285716*G0_2_1 - 0.0964285714285711*G0_2_2;
-    A[317] = -0.0241071428571434*G0_0_1 - 0.0241071428571435*G0_0_2 - 0.0241071428571426*G0_1_0 - 0.0241071428571428*G0_2_0;
-    A[318] = -0.0482142857142867*G0_0_0 - 0.0241071428571434*G0_0_1 + 0.120535714285713*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0964285714285713*G0_1_1 + 0.120535714285714*G0_2_0 + 0.0964285714285714*G0_2_1;
-    A[319] = -0.0482142857142865*G0_0_0 + 0.120535714285713*G0_0_1 - 0.0241071428571433*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0964285714285715*G0_1_2 + 0.120535714285714*G0_2_0 + 0.0964285714285711*G0_2_2;
-    A[320] = -0.032142857142857*G0_0_0 - 0.0321428571428569*G0_0_1 - 0.0321428571428568*G0_0_2 - 0.032142857142857*G0_1_0 - 0.0321428571428569*G0_1_1 - 0.032142857142857*G0_1_2 - 0.032142857142857*G0_2_0 - 0.0321428571428569*G0_2_1 - 0.0321428571428569*G0_2_2;
-    A[321] = 0.032142857142857*G0_0_0 - 0.0160714285714288*G0_1_0 - 0.0160714285714286*G0_2_0;
-    A[322] = -0.0160714285714287*G0_0_1 + 0.0321428571428574*G0_1_1 - 0.0160714285714283*G0_2_1;
+    A[312] = 0.0241071428571434*G0_0_0 - 0.0241071428571429*G0_0_1 + 0.0241071428571434*G0_0_2 - 0.0241071428571425*G0_1_0 - 0.0241071428571427*G0_1_2 - 0.0241071428571425*G0_2_0 - 0.0241071428571427*G0_2_2;
+    A[313] = -0.0241071428571428*G0_0_1 - 0.0241071428571427*G0_1_0 - 0.0241071428571427*G0_1_2 - 0.0241071428571431*G0_2_0 - 0.0241071428571431*G0_2_2;
+    A[314] = -0.192857142857142*G0_0_0 - 0.144642857142856*G0_0_1 - 0.144642857142856*G0_0_2 - 0.0482142857142849*G0_1_0 - 0.0723214285714277*G0_1_1 - 0.0723214285714276*G0_1_2 - 0.0482142857142848*G0_2_0 - 0.0723214285714276*G0_2_1 - 0.0723214285714276*G0_2_2;
+    A[315] = 0.241071428571428*G0_0_0 + 0.0964285714285706*G0_0_1 + 0.0964285714285706*G0_0_2 + 0.0964285714285706*G0_1_0 + 0.192857142857142*G0_1_1 + 0.192857142857142*G0_1_2 + 0.0964285714285706*G0_2_0 + 0.192857142857142*G0_2_1 + 0.192857142857142*G0_2_2;
+    A[316] = 0.0241071428571434*G0_0_1 + 0.0241071428571434*G0_0_2 + 0.0241071428571426*G0_1_0 - 0.0964285714285714*G0_1_1 - 0.0964285714285715*G0_1_2 + 0.0241071428571428*G0_2_0 - 0.0964285714285715*G0_2_1 - 0.0964285714285711*G0_2_2;
+    A[317] = -0.0241071428571434*G0_0_1 - 0.0241071428571434*G0_0_2 - 0.0241071428571426*G0_1_0 - 0.0241071428571429*G0_2_0;
+    A[318] = -0.048214285714287*G0_0_0 - 0.0241071428571435*G0_0_1 + 0.120535714285713*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0964285714285712*G0_1_1 + 0.120535714285714*G0_2_0 + 0.0964285714285713*G0_2_1;
+    A[319] = -0.0482142857142868*G0_0_0 + 0.120535714285713*G0_0_1 - 0.0241071428571433*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0964285714285715*G0_1_2 + 0.120535714285714*G0_2_0 + 0.096428571428571*G0_2_2;
+    A[320] = -0.0321428571428571*G0_0_0 - 0.0321428571428569*G0_0_1 - 0.0321428571428568*G0_0_2 - 0.0321428571428569*G0_1_0 - 0.0321428571428569*G0_1_1 - 0.0321428571428569*G0_1_2 - 0.032142857142857*G0_2_0 - 0.0321428571428568*G0_2_1 - 0.0321428571428568*G0_2_2;
+    A[321] = 0.0321428571428571*G0_0_0 - 0.0160714285714288*G0_1_0 - 0.0160714285714286*G0_2_0;
+    A[322] = -0.0160714285714288*G0_0_1 + 0.0321428571428573*G0_1_1 - 0.0160714285714284*G0_2_1;
     A[323] = -0.0160714285714289*G0_0_2 - 0.0160714285714288*G0_1_2 + 0.0321428571428567*G0_2_2;
-    A[324] = 0.241071428571429*G0_0_1 + 0.0964285714285717*G0_0_2 - 0.0482142857142856*G0_1_1 - 0.0241071428571423*G0_1_2 + 0.120535714285715*G0_2_1 + 0.0964285714285729*G0_2_2;
-    A[325] = 0.0964285714285714*G0_0_1 + 0.241071428571428*G0_0_2 + 0.0964285714285716*G0_1_1 + 0.120535714285714*G0_1_2 - 0.0241071428571427*G0_2_1 - 0.0482142857142863*G0_2_2;
-    A[326] = -0.0482142857142851*G0_0_0 - 0.0241071428571425*G0_0_2 + 0.241071428571429*G0_1_0 + 0.0964285714285728*G0_1_2 + 0.120535714285714*G0_2_0 + 0.0964285714285721*G0_2_2;
-    A[327] = 0.0964285714285713*G0_0_0 + 0.120535714285715*G0_0_2 + 0.0964285714285715*G0_1_0 + 0.241071428571429*G0_1_2 - 0.0241071428571427*G0_2_0 - 0.0482142857142852*G0_2_2;
-    A[328] = -0.048214285714286*G0_0_0 - 0.0241071428571426*G0_0_1 + 0.120535714285714*G0_1_0 + 0.0964285714285722*G0_1_1 + 0.241071428571428*G0_2_0 + 0.0964285714285718*G0_2_1;
-    A[329] = 0.0964285714285722*G0_0_0 + 0.120535714285715*G0_0_1 - 0.0241071428571423*G0_1_0 - 0.0482142857142857*G0_1_1 + 0.0964285714285731*G0_2_0 + 0.241071428571429*G0_2_1;
-    A[330] = 0.0482142857142855*G0_0_0 + 0.0482142857142855*G0_0_1 + 0.0241071428571423*G0_0_2 + 0.0482142857142854*G0_1_0 + 0.0482142857142854*G0_1_1 + 0.0241071428571426*G0_1_2 + 0.0241071428571432*G0_2_0 + 0.0241071428571432*G0_2_1;
-    A[331] = -0.0964285714285713*G0_0_0 - 0.0964285714285713*G0_0_1 + 0.0241071428571428*G0_0_2 - 0.0964285714285715*G0_1_0 - 0.0964285714285715*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_1;
-    A[332] = 0.0482142857142862*G0_0_0 + 0.0241071428571431*G0_0_1 + 0.0482142857142857*G0_0_2 + 0.0241071428571431*G0_1_0 + 0.024107142857143*G0_1_2 + 0.0482142857142864*G0_2_0 + 0.0241071428571434*G0_2_1 + 0.048214285714286*G0_2_2;
-    A[333] = -0.096428571428572*G0_0_0 + 0.0241071428571423*G0_0_1 - 0.0964285714285713*G0_0_2 + 0.0241071428571423*G0_1_0 + 0.0241071428571427*G0_1_2 - 0.096428571428573*G0_2_0 + 0.0241071428571416*G0_2_1 - 0.0964285714285724*G0_2_2;
-    A[334] = 0.0241071428571426*G0_0_1 + 0.0241071428571427*G0_0_2 + 0.0241071428571424*G0_1_0 + 0.0482142857142849*G0_1_1 + 0.0482142857142847*G0_1_2 + 0.0241071428571423*G0_2_0 + 0.0482142857142851*G0_2_1 + 0.0482142857142852*G0_2_2;
-    A[335] = 0.0241071428571426*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0241071428571434*G0_1_0 - 0.0964285714285715*G0_1_1 - 0.0964285714285716*G0_1_2 + 0.0241071428571433*G0_2_0 - 0.0964285714285715*G0_2_1 - 0.0964285714285711*G0_2_2;
-    A[336] = 0.57857142857143*G0_0_0 + 0.289285714285716*G0_0_1 + 0.289285714285717*G0_0_2 + 0.289285714285716*G0_1_0 + 0.578571428571432*G0_1_1 + 0.289285714285717*G0_1_2 + 0.289285714285717*G0_2_0 + 0.289285714285717*G0_2_1 + 0.578571428571431*G0_2_2;
-    A[337] = -0.57857142857143*G0_0_0 - 0.289285714285714*G0_0_1 - 0.289285714285714*G0_0_2 - 0.289285714285717*G0_1_0 - 0.144642857142858*G0_1_2 - 0.289285714285717*G0_2_0 - 0.144642857142858*G0_2_1;
-    A[338] = -0.289285714285716*G0_0_1 - 0.144642857142857*G0_0_2 - 0.289285714285715*G0_1_0 - 0.578571428571431*G0_1_1 - 0.289285714285713*G0_1_2 - 0.144642857142858*G0_2_0 - 0.289285714285716*G0_2_1;
-    A[339] = -0.144642857142856*G0_0_1 - 0.289285714285716*G0_0_2 - 0.144642857142857*G0_1_0 - 0.289285714285717*G0_1_2 - 0.289285714285714*G0_2_0 - 0.289285714285714*G0_2_1 - 0.578571428571431*G0_2_2;
-    A[340] = 0.0321428571428571*G0_0_0 + 0.0321428571428569*G0_0_1 + 0.0321428571428568*G0_0_2 + 0.0482142857142856*G0_1_0 + 0.0482142857142855*G0_1_1 + 0.0482142857142854*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.0482142857142855*G0_2_1 + 0.0482142857142855*G0_2_2;
-    A[341] = -0.032142857142857*G0_0_0;
+    A[324] = 0.241071428571428*G0_0_1 + 0.0964285714285717*G0_0_2 - 0.0482142857142855*G0_1_1 - 0.0241071428571422*G0_1_2 + 0.120535714285714*G0_2_1 + 0.0964285714285727*G0_2_2;
+    A[325] = 0.0964285714285715*G0_0_1 + 0.241071428571428*G0_0_2 + 0.0964285714285716*G0_1_1 + 0.120535714285714*G0_1_2 - 0.0241071428571427*G0_2_1 - 0.0482142857142863*G0_2_2;
+    A[326] = -0.0482142857142852*G0_0_0 - 0.0241071428571424*G0_0_2 + 0.241071428571429*G0_1_0 + 0.0964285714285726*G0_1_2 + 0.120535714285714*G0_2_0 + 0.0964285714285721*G0_2_2;
+    A[327] = 0.0964285714285713*G0_0_0 + 0.120535714285715*G0_0_2 + 0.0964285714285715*G0_1_0 + 0.241071428571429*G0_1_2 - 0.0241071428571427*G0_2_0 - 0.0482142857142853*G0_2_2;
+    A[328] = -0.048214285714286*G0_0_0 - 0.0241071428571426*G0_0_1 + 0.120535714285714*G0_1_0 + 0.096428571428572*G0_1_1 + 0.241071428571428*G0_2_0 + 0.0964285714285719*G0_2_1;
+    A[329] = 0.0964285714285721*G0_0_0 + 0.120535714285715*G0_0_1 - 0.0241071428571423*G0_1_0 - 0.0482142857142856*G0_1_1 + 0.0964285714285729*G0_2_0 + 0.241071428571429*G0_2_1;
+    A[330] = 0.0482142857142854*G0_0_0 + 0.0482142857142854*G0_0_1 + 0.0241071428571423*G0_0_2 + 0.0482142857142852*G0_1_0 + 0.0482142857142853*G0_1_1 + 0.0241071428571425*G0_1_2 + 0.0241071428571429*G0_2_0 + 0.024107142857143*G0_2_1;
+    A[331] = -0.0964285714285713*G0_0_0 - 0.0964285714285713*G0_0_1 + 0.0241071428571428*G0_0_2 - 0.0964285714285714*G0_1_0 - 0.0964285714285715*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_1;
+    A[332] = 0.0482142857142863*G0_0_0 + 0.024107142857143*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0241071428571431*G0_1_2 + 0.0482142857142862*G0_2_0 + 0.0241071428571432*G0_2_1 + 0.0482142857142858*G0_2_2;
+    A[333] = -0.096428571428572*G0_0_0 + 0.0241071428571424*G0_0_1 - 0.0964285714285712*G0_0_2 + 0.0241071428571424*G0_1_0 + 0.0241071428571428*G0_1_2 - 0.0964285714285728*G0_2_0 + 0.0241071428571418*G0_2_1 - 0.0964285714285723*G0_2_2;
+    A[334] = 0.0241071428571426*G0_0_1 + 0.0241071428571427*G0_0_2 + 0.0241071428571422*G0_1_0 + 0.0482142857142848*G0_1_1 + 0.0482142857142847*G0_1_2 + 0.0241071428571423*G0_2_0 + 0.0482142857142849*G0_2_1 + 0.0482142857142851*G0_2_2;
+    A[335] = 0.0241071428571426*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0241071428571434*G0_1_0 - 0.0964285714285714*G0_1_1 - 0.0964285714285715*G0_1_2 + 0.0241071428571434*G0_2_0 - 0.0964285714285715*G0_2_1 - 0.0964285714285711*G0_2_2;
+    A[336] = 0.57857142857143*G0_0_0 + 0.289285714285716*G0_0_1 + 0.289285714285716*G0_0_2 + 0.289285714285717*G0_1_0 + 0.578571428571432*G0_1_1 + 0.289285714285717*G0_1_2 + 0.289285714285716*G0_2_0 + 0.289285714285717*G0_2_1 + 0.578571428571431*G0_2_2;
+    A[337] = -0.57857142857143*G0_0_0 - 0.289285714285714*G0_0_1 - 0.289285714285714*G0_0_2 - 0.289285714285717*G0_1_0 - 0.144642857142858*G0_1_2 - 0.289285714285716*G0_2_0 - 0.144642857142858*G0_2_1;
+    A[338] = -0.289285714285716*G0_0_1 - 0.144642857142857*G0_0_2 - 0.289285714285714*G0_1_0 - 0.578571428571431*G0_1_1 - 0.289285714285713*G0_1_2 - 0.144642857142857*G0_2_0 - 0.289285714285716*G0_2_1;
+    A[339] = -0.144642857142856*G0_0_1 - 0.289285714285716*G0_0_2 - 0.144642857142857*G0_1_0 - 0.289285714285717*G0_1_2 - 0.289285714285714*G0_2_0 - 0.289285714285713*G0_2_1 - 0.578571428571431*G0_2_2;
+    A[340] = 0.0321428571428571*G0_0_0 + 0.0321428571428569*G0_0_1 + 0.0321428571428568*G0_0_2 + 0.0482142857142857*G0_1_0 + 0.0482142857142855*G0_1_1 + 0.0482142857142854*G0_1_2 + 0.0482142857142855*G0_2_0 + 0.0482142857142855*G0_2_1 + 0.0482142857142855*G0_2_2;
+    A[341] = -0.0321428571428571*G0_0_0;
     A[342] = 0.0160714285714288*G0_0_1 + 0.048214285714286*G0_1_1;
-    A[343] = 0.0160714285714289*G0_0_2 + 0.0482142857142857*G0_2_2;
-    A[344] = -0.241071428571429*G0_0_1 - 0.0964285714285717*G0_0_2 - 0.289285714285714*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1;
-    A[345] = -0.0964285714285716*G0_0_1 - 0.241071428571428*G0_0_2 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.289285714285714*G0_2_2;
-    A[346] = 0.0482142857142851*G0_0_0 + 0.0241071428571426*G0_0_2 + 0.0241071428571419*G0_2_0;
+    A[343] = 0.0160714285714289*G0_0_2 + 0.0482142857142856*G0_2_2;
+    A[344] = -0.241071428571429*G0_0_1 - 0.0964285714285718*G0_0_2 - 0.289285714285714*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1;
+    A[345] = -0.0964285714285715*G0_0_1 - 0.241071428571428*G0_0_2 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.289285714285714*G0_2_2;
+    A[346] = 0.0482142857142852*G0_0_0 + 0.0241071428571424*G0_0_2 + 0.0241071428571419*G0_2_0;
     A[347] = -0.0964285714285714*G0_0_0 - 0.120535714285715*G0_0_2 - 0.120535714285714*G0_2_0 - 0.144642857142857*G0_2_2;
-    A[348] = 0.0482142857142861*G0_0_0 + 0.0241071428571426*G0_0_1 + 0.0241071428571429*G0_1_0;
-    A[349] = -0.0964285714285722*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285715*G0_1_0 - 0.144642857142858*G0_1_1;
-    A[350] = -0.0482142857142856*G0_0_0 - 0.0482142857142856*G0_0_1 - 0.0241071428571424*G0_0_2 - 0.289285714285714*G0_1_0 - 0.289285714285714*G0_1_1 - 0.168749999999999*G0_1_2 - 0.16875*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142854*G0_2_2;
-    A[351] = 0.0964285714285714*G0_0_0 + 0.0964285714285714*G0_0_1 - 0.0241071428571427*G0_0_2 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142862*G0_2_2;
-    A[352] = -0.0482142857142863*G0_0_0 - 0.0241071428571431*G0_0_1 - 0.0482142857142857*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142855*G0_1_1 - 0.16875*G0_1_2 - 0.289285714285714*G0_2_0 - 0.16875*G0_2_1 - 0.289285714285714*G0_2_2;
-    A[353] = 0.096428571428572*G0_0_0 - 0.0241071428571423*G0_0_1 + 0.0964285714285713*G0_0_2 + 0.120535714285715*G0_1_0 - 0.048214285714286*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_1;
-    A[354] = -0.0241071428571426*G0_0_1 - 0.0241071428571427*G0_0_2 - 0.0241071428571425*G0_1_0 - 0.144642857142857*G0_1_1 - 0.144642857142857*G0_1_2 - 0.0241071428571425*G0_2_0 - 0.144642857142857*G0_2_1 - 0.144642857142857*G0_2_2;
-    A[355] = -0.0241071428571426*G0_0_1 - 0.0241071428571428*G0_0_2 - 0.0241071428571434*G0_1_0 - 0.0241071428571435*G0_2_0;
-    A[356] = -0.57857142857143*G0_0_0 - 0.289285714285717*G0_0_1 - 0.289285714285717*G0_0_2 - 0.289285714285714*G0_1_0 - 0.144642857142858*G0_1_2 - 0.289285714285714*G0_2_0 - 0.144642857142858*G0_2_1;
+    A[348] = 0.0482142857142861*G0_0_0 + 0.0241071428571426*G0_0_1 + 0.0241071428571428*G0_1_0;
+    A[349] = -0.0964285714285722*G0_0_0 - 0.120535714285715*G0_0_1 - 0.120535714285715*G0_1_0 - 0.144642857142858*G0_1_1;
+    A[350] = -0.0482142857142855*G0_0_0 - 0.0482142857142855*G0_0_1 - 0.0241071428571424*G0_0_2 - 0.289285714285714*G0_1_0 - 0.289285714285714*G0_1_1 - 0.168749999999999*G0_1_2 - 0.16875*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142853*G0_2_2;
+    A[351] = 0.0964285714285714*G0_0_0 + 0.0964285714285714*G0_0_1 - 0.0241071428571428*G0_0_2 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142861*G0_2_2;
+    A[352] = -0.0482142857142863*G0_0_0 - 0.024107142857143*G0_0_1 - 0.0482142857142856*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142854*G0_1_1 - 0.16875*G0_1_2 - 0.289285714285714*G0_2_0 - 0.16875*G0_2_1 - 0.289285714285714*G0_2_2;
+    A[353] = 0.0964285714285721*G0_0_0 - 0.0241071428571424*G0_0_1 + 0.0964285714285713*G0_0_2 + 0.120535714285715*G0_1_0 - 0.0482142857142863*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285713*G0_2_1;
+    A[354] = -0.0241071428571427*G0_0_1 - 0.0241071428571427*G0_0_2 - 0.0241071428571425*G0_1_0 - 0.144642857142857*G0_1_1 - 0.144642857142857*G0_1_2 - 0.0241071428571423*G0_2_0 - 0.144642857142857*G0_2_1 - 0.144642857142857*G0_2_2;
+    A[355] = -0.0241071428571426*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0241071428571434*G0_1_0 - 0.0241071428571434*G0_2_0;
+    A[356] = -0.57857142857143*G0_0_0 - 0.289285714285717*G0_0_1 - 0.289285714285716*G0_0_2 - 0.289285714285714*G0_1_0 - 0.144642857142858*G0_1_2 - 0.289285714285714*G0_2_0 - 0.144642857142858*G0_2_1;
     A[357] = 0.57857142857143*G0_0_0 + 0.289285714285715*G0_0_1 + 0.289285714285714*G0_0_2 + 0.289285714285715*G0_1_0 + 0.578571428571429*G0_1_1 + 0.289285714285714*G0_1_2 + 0.289285714285714*G0_2_0 + 0.289285714285714*G0_2_1 + 0.578571428571429*G0_2_2;
     A[358] = 0.289285714285716*G0_0_1 + 0.144642857142857*G0_0_2 + 0.289285714285715*G0_1_0 + 0.144642857142858*G0_1_2 + 0.144642857142858*G0_2_0 + 0.144642857142858*G0_2_1 + 0.289285714285715*G0_2_2;
     A[359] = 0.144642857142856*G0_0_1 + 0.289285714285716*G0_0_2 + 0.144642857142857*G0_1_0 + 0.289285714285714*G0_1_1 + 0.144642857142858*G0_1_2 + 0.289285714285714*G0_2_0 + 0.144642857142857*G0_2_1;
-    A[360] = 0.0482142857142855*G0_0_0 + 0.0482142857142855*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.032142857142857*G0_1_0 + 0.0321428571428569*G0_1_1 + 0.032142857142857*G0_1_2 + 0.0482142857142854*G0_2_0 + 0.0482142857142855*G0_2_1 + 0.0482142857142855*G0_2_2;
-    A[361] = 0.0482142857142861*G0_0_0 + 0.0160714285714289*G0_1_0;
+    A[360] = 0.0482142857142854*G0_0_0 + 0.0482142857142854*G0_0_1 + 0.0482142857142854*G0_0_2 + 0.0321428571428569*G0_1_0 + 0.0321428571428568*G0_1_1 + 0.0321428571428569*G0_1_2 + 0.0482142857142854*G0_2_0 + 0.0482142857142855*G0_2_1 + 0.0482142857142855*G0_2_2;
+    A[361] = 0.0482142857142862*G0_0_0 + 0.0160714285714289*G0_1_0;
     A[362] = -0.0321428571428572*G0_1_1;
-    A[363] = 0.0160714285714289*G0_1_2 + 0.0482142857142857*G0_2_2;
-    A[364] = 0.0482142857142858*G0_1_1 + 0.0241071428571426*G0_1_2 + 0.0241071428571424*G0_2_1;
-    A[365] = -0.0964285714285716*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.144642857142856*G0_2_2;
-    A[366] = -0.289285714285715*G0_0_0 - 0.120535714285715*G0_0_2 - 0.241071428571429*G0_1_0 - 0.0964285714285725*G0_1_2 - 0.120535714285715*G0_2_0;
+    A[363] = 0.0160714285714289*G0_1_2 + 0.0482142857142856*G0_2_2;
+    A[364] = 0.0482142857142857*G0_1_1 + 0.0241071428571425*G0_1_2 + 0.0241071428571424*G0_2_1;
+    A[365] = -0.0964285714285717*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.144642857142856*G0_2_2;
+    A[366] = -0.289285714285714*G0_0_0 - 0.120535714285715*G0_0_2 - 0.241071428571429*G0_1_0 - 0.0964285714285724*G0_1_2 - 0.120535714285714*G0_2_0;
     A[367] = -0.120535714285714*G0_0_2 - 0.0964285714285715*G0_1_0 - 0.241071428571429*G0_1_2 - 0.120535714285714*G0_2_0 - 0.289285714285714*G0_2_2;
-    A[368] = -0.144642857142857*G0_0_0 - 0.120535714285715*G0_0_1 - 0.120535714285714*G0_1_0 - 0.096428571428572*G0_1_1;
+    A[368] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.0964285714285718*G0_1_1;
     A[369] = 0.0241071428571428*G0_0_1 + 0.0241071428571426*G0_1_0 + 0.0482142857142859*G0_1_1;
-    A[370] = -0.289285714285715*G0_0_0 - 0.289285714285715*G0_0_1 - 0.16875*G0_0_2 - 0.0482142857142858*G0_1_0 - 0.0482142857142858*G0_1_1 - 0.0241071428571428*G0_1_2 - 0.16875*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142852*G0_2_2;
-    A[371] = 0.120535714285714*G0_0_2 + 0.0964285714285714*G0_1_0 + 0.0964285714285715*G0_1_1 - 0.0241071428571428*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142864*G0_2_2;
-    A[372] = -0.144642857142858*G0_0_0 - 0.024107142857143*G0_0_1 - 0.144642857142858*G0_0_2 - 0.0241071428571434*G0_1_0 - 0.0241071428571433*G0_1_2 - 0.144642857142858*G0_2_0 - 0.0241071428571428*G0_2_1 - 0.144642857142858*G0_2_2;
-    A[373] = -0.0241071428571429*G0_0_1 - 0.0241071428571426*G0_1_0 - 0.024107142857143*G0_1_2 - 0.024107142857143*G0_2_1;
-    A[374] = -0.048214285714285*G0_0_0 - 0.16875*G0_0_1 - 0.16875*G0_0_2 - 0.0241071428571425*G0_1_0 - 0.0482142857142852*G0_1_1 - 0.048214285714285*G0_1_2 - 0.168749999999999*G0_2_0 - 0.289285714285715*G0_2_1 - 0.289285714285715*G0_2_2;
-    A[375] = -0.0482142857142867*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 - 0.0241071428571435*G0_1_0 + 0.0964285714285713*G0_1_1 + 0.0964285714285714*G0_1_2 + 0.120535714285713*G0_2_0;
-    A[376] = -0.289285714285715*G0_0_1 - 0.144642857142858*G0_0_2 - 0.289285714285716*G0_1_0 - 0.578571428571431*G0_1_1 - 0.289285714285716*G0_1_2 - 0.144642857142857*G0_2_0 - 0.289285714285713*G0_2_1;
+    A[370] = -0.289285714285714*G0_0_0 - 0.289285714285714*G0_0_1 - 0.16875*G0_0_2 - 0.0482142857142855*G0_1_0 - 0.0482142857142857*G0_1_1 - 0.0241071428571427*G0_1_2 - 0.16875*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142852*G0_2_2;
+    A[371] = 0.120535714285714*G0_0_2 + 0.0964285714285715*G0_1_0 + 0.0964285714285716*G0_1_1 - 0.0241071428571428*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142864*G0_2_2;
+    A[372] = -0.144642857142857*G0_0_0 - 0.0241071428571429*G0_0_1 - 0.144642857142857*G0_0_2 - 0.0241071428571432*G0_1_0 - 0.0241071428571433*G0_1_2 - 0.144642857142858*G0_2_0 - 0.0241071428571428*G0_2_1 - 0.144642857142858*G0_2_2;
+    A[373] = -0.0241071428571429*G0_0_1 - 0.0241071428571427*G0_1_0 - 0.0241071428571431*G0_1_2 - 0.0241071428571431*G0_2_1;
+    A[374] = -0.0482142857142847*G0_0_0 - 0.16875*G0_0_1 - 0.16875*G0_0_2 - 0.0241071428571423*G0_1_0 - 0.048214285714285*G0_1_1 - 0.0482142857142849*G0_1_2 - 0.168749999999999*G0_2_0 - 0.289285714285715*G0_2_1 - 0.289285714285715*G0_2_2;
+    A[375] = -0.048214285714287*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 - 0.0241071428571435*G0_1_0 + 0.0964285714285712*G0_1_1 + 0.0964285714285713*G0_1_2 + 0.120535714285713*G0_2_0;
+    A[376] = -0.289285714285714*G0_0_1 - 0.144642857142857*G0_0_2 - 0.289285714285716*G0_1_0 - 0.578571428571431*G0_1_1 - 0.289285714285716*G0_1_2 - 0.144642857142857*G0_2_0 - 0.289285714285713*G0_2_1;
     A[377] = 0.289285714285715*G0_0_1 + 0.144642857142858*G0_0_2 + 0.289285714285716*G0_1_0 + 0.144642857142858*G0_1_2 + 0.144642857142857*G0_2_0 + 0.144642857142858*G0_2_1 + 0.289285714285715*G0_2_2;
-    A[378] = 0.57857142857143*G0_0_0 + 0.289285714285715*G0_0_1 + 0.289285714285715*G0_0_2 + 0.289285714285715*G0_1_0 + 0.578571428571431*G0_1_1 + 0.289285714285714*G0_1_2 + 0.289285714285715*G0_2_0 + 0.289285714285714*G0_2_1 + 0.578571428571429*G0_2_2;
-    A[379] = 0.289285714285715*G0_0_0 + 0.144642857142857*G0_0_1 + 0.144642857142857*G0_0_2 + 0.144642857142858*G0_1_0 + 0.289285714285716*G0_1_2 + 0.144642857142858*G0_2_0 + 0.289285714285715*G0_2_1;
-    A[380] = 0.0482142857142854*G0_0_0 + 0.0482142857142854*G0_0_1 + 0.0482142857142854*G0_0_2 + 0.0482142857142853*G0_1_0 + 0.0482142857142854*G0_1_1 + 0.0482142857142853*G0_1_2 + 0.032142857142857*G0_2_0 + 0.0321428571428569*G0_2_1 + 0.0321428571428568*G0_2_2;
-    A[381] = 0.0482142857142859*G0_0_0 + 0.0160714285714286*G0_2_0;
-    A[382] = 0.0482142857142859*G0_1_1 + 0.0160714285714285*G0_2_1;
+    A[378] = 0.578571428571429*G0_0_0 + 0.289285714285714*G0_0_1 + 0.289285714285715*G0_0_2 + 0.289285714285714*G0_1_0 + 0.57857142857143*G0_1_1 + 0.289285714285714*G0_1_2 + 0.289285714285715*G0_2_0 + 0.289285714285714*G0_2_1 + 0.578571428571429*G0_2_2;
+    A[379] = 0.289285714285714*G0_0_0 + 0.144642857142857*G0_0_1 + 0.144642857142857*G0_0_2 + 0.144642857142857*G0_1_0 + 0.289285714285716*G0_1_2 + 0.144642857142857*G0_2_0 + 0.289285714285715*G0_2_1;
+    A[380] = 0.0482142857142853*G0_0_0 + 0.0482142857142854*G0_0_1 + 0.0482142857142854*G0_0_2 + 0.0482142857142855*G0_1_0 + 0.0482142857142855*G0_1_1 + 0.0482142857142854*G0_1_2 + 0.032142857142857*G0_2_0 + 0.0321428571428568*G0_2_1 + 0.0321428571428568*G0_2_2;
+    A[381] = 0.048214285714286*G0_0_0 + 0.0160714285714287*G0_2_0;
+    A[382] = 0.048214285714286*G0_1_1 + 0.0160714285714285*G0_2_1;
     A[383] = -0.0321428571428566*G0_2_2;
-    A[384] = -0.144642857142857*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.0964285714285724*G0_2_2;
-    A[385] = 0.0241071428571435*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0482142857142863*G0_2_2;
-    A[386] = -0.144642857142857*G0_0_0 - 0.120535714285715*G0_0_2 - 0.120535714285714*G0_2_0 - 0.0964285714285721*G0_2_2;
-    A[387] = 0.024107142857143*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0482142857142854*G0_2_2;
+    A[384] = -0.144642857142857*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.0964285714285723*G0_2_2;
+    A[385] = 0.0241071428571434*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0482142857142862*G0_2_2;
+    A[386] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_2 - 0.120535714285714*G0_2_0 - 0.0964285714285721*G0_2_2;
+    A[387] = 0.0241071428571431*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0482142857142854*G0_2_2;
     A[388] = -0.289285714285714*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.241071428571428*G0_2_0 - 0.0964285714285718*G0_2_1;
     A[389] = -0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.289285714285714*G0_1_1 - 0.0964285714285726*G0_2_0 - 0.241071428571429*G0_2_1;
-    A[390] = -0.144642857142857*G0_0_0 - 0.144642857142857*G0_0_1 - 0.0241071428571428*G0_0_2 - 0.144642857142857*G0_1_0 - 0.144642857142857*G0_1_1 - 0.0241071428571422*G0_1_2 - 0.024107142857143*G0_2_0 - 0.024107142857143*G0_2_1;
-    A[391] = -0.0241071428571431*G0_0_2 - 0.0241071428571434*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571429*G0_2_1;
-    A[392] = -0.289285714285714*G0_0_0 - 0.16875*G0_0_1 - 0.289285714285714*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142854*G0_1_1 - 0.16875*G0_1_2 - 0.0482142857142861*G0_2_0 - 0.0241071428571434*G0_2_1 - 0.0482142857142857*G0_2_2;
-    A[393] = 0.120535714285714*G0_0_1 + 0.120535714285714*G0_1_0 - 0.0482142857142859*G0_1_1 + 0.120535714285714*G0_1_2 + 0.0964285714285725*G0_2_0 - 0.0241071428571418*G0_2_1 + 0.0964285714285719*G0_2_2;
-    A[394] = -0.0482142857142847*G0_0_0 - 0.168749999999999*G0_0_1 - 0.16875*G0_0_2 - 0.168749999999999*G0_1_0 - 0.289285714285714*G0_1_1 - 0.289285714285715*G0_1_2 - 0.0241071428571423*G0_2_0 - 0.0482142857142849*G0_2_1 - 0.048214285714285*G0_2_2;
-    A[395] = -0.0482142857142865*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285713*G0_1_0 - 0.0241071428571433*G0_2_0 + 0.0964285714285715*G0_2_1 + 0.0964285714285711*G0_2_2;
-    A[396] = -0.144642857142857*G0_0_1 - 0.289285714285714*G0_0_2 - 0.144642857142856*G0_1_0 - 0.289285714285714*G0_1_2 - 0.289285714285716*G0_2_0 - 0.289285714285717*G0_2_1 - 0.578571428571431*G0_2_2;
+    A[390] = -0.144642857142857*G0_0_0 - 0.144642857142857*G0_0_1 - 0.0241071428571426*G0_0_2 - 0.144642857142857*G0_1_0 - 0.144642857142857*G0_1_1 - 0.0241071428571422*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.024107142857143*G0_2_1;
+    A[391] = -0.0241071428571431*G0_0_2 - 0.0241071428571434*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571428*G0_2_1;
+    A[392] = -0.289285714285714*G0_0_0 - 0.16875*G0_0_1 - 0.289285714285714*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142854*G0_1_1 - 0.16875*G0_1_2 - 0.048214285714286*G0_2_0 - 0.0241071428571432*G0_2_1 - 0.0482142857142857*G0_2_2;
+    A[393] = 0.120535714285714*G0_0_1 + 0.120535714285714*G0_1_0 - 0.0482142857142861*G0_1_1 + 0.120535714285714*G0_1_2 + 0.0964285714285725*G0_2_0 - 0.0241071428571419*G0_2_1 + 0.0964285714285719*G0_2_2;
+    A[394] = -0.0482142857142846*G0_0_0 - 0.168749999999999*G0_0_1 - 0.168749999999999*G0_0_2 - 0.168749999999999*G0_1_0 - 0.289285714285714*G0_1_1 - 0.289285714285715*G0_1_2 - 0.0241071428571423*G0_2_0 - 0.0482142857142849*G0_2_1 - 0.048214285714285*G0_2_2;
+    A[395] = -0.0482142857142868*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285713*G0_1_0 - 0.0241071428571433*G0_2_0 + 0.0964285714285715*G0_2_1 + 0.096428571428571*G0_2_2;
+    A[396] = -0.144642857142857*G0_0_1 - 0.289285714285714*G0_0_2 - 0.144642857142856*G0_1_0 - 0.289285714285713*G0_1_2 - 0.289285714285716*G0_2_0 - 0.289285714285717*G0_2_1 - 0.578571428571431*G0_2_2;
     A[397] = 0.144642857142857*G0_0_1 + 0.289285714285714*G0_0_2 + 0.144642857142856*G0_1_0 + 0.289285714285714*G0_1_1 + 0.144642857142857*G0_1_2 + 0.289285714285716*G0_2_0 + 0.144642857142858*G0_2_1;
-    A[398] = 0.289285714285715*G0_0_0 + 0.144642857142858*G0_0_1 + 0.144642857142858*G0_0_2 + 0.144642857142857*G0_1_0 + 0.289285714285715*G0_1_2 + 0.144642857142857*G0_2_0 + 0.289285714285716*G0_2_1;
-    A[399] = 0.578571428571428*G0_0_0 + 0.289285714285714*G0_0_1 + 0.289285714285714*G0_0_2 + 0.289285714285714*G0_1_0 + 0.578571428571428*G0_1_1 + 0.289285714285713*G0_1_2 + 0.289285714285714*G0_2_0 + 0.289285714285713*G0_2_1 + 0.57857142857143*G0_2_2;
+    A[398] = 0.289285714285714*G0_0_0 + 0.144642857142857*G0_0_1 + 0.144642857142857*G0_0_2 + 0.144642857142857*G0_1_0 + 0.289285714285715*G0_1_2 + 0.144642857142857*G0_2_0 + 0.289285714285715*G0_2_1;
+    A[399] = 0.578571428571427*G0_0_0 + 0.289285714285714*G0_0_1 + 0.289285714285714*G0_0_2 + 0.289285714285714*G0_1_0 + 0.578571428571428*G0_1_1 + 0.289285714285713*G0_1_2 + 0.289285714285714*G0_2_0 + 0.289285714285713*G0_2_1 + 0.57857142857143*G0_2_2;
 }
 
-/// Constructor
+
 poisson3d_3_cell_integral_1_otherwise::poisson3d_3_cell_integral_1_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson3d_3_cell_integral_1_otherwise::~poisson3d_3_cell_integral_1_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson3d_3_cell_integral_1_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson3d_3_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson3d_3_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -8370,7 +12901,7 @@ void poisson3d_3_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -8425,58 +12956,65 @@ void poisson3d_3_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     A[19] = 0.000669642857142863*G0_0 + 0.000669642857142859*G0_1 + 0.000669642857142854*G0_2 + 0.00133928571428572*G0_3 - 0.00200892857142857*G0_5 - 0.00200892857142857*G0_7 - 0.00200892857142858*G0_11 + 0.00803571428571429*G0_16 + 0.00803571428571428*G0_17 + 0.0080357142857143*G0_18 + 0.0160714285714286*G0_19;
 }
 
-/// Constructor
+
 poisson3d_3_form_0::poisson3d_3_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_3_form_0::~poisson3d_3_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson3d_3_form_0::signature() const
+const char * poisson3d_3_form_0::signature() const
 {
-    return "7dacbd9923cd49b3b9396ead24d96b3eba656962a64384eb434b397e7d15de7f72c7d658dc2b80ec9469764e267bec1389c4a520ae6c29d77b20791908928d25";
+    return "32fbe2e1df38410c6b4133633394262f461a2cbb3d064726f995f987d220bd4e750b2ce171b9522d6d654823b8ae499f06d085cb5fa006d6ba33cb84ae77a589";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson3d_3_form_0::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson3d_3_form_0::num_coefficients() const
 {
     return 0;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson3d_3_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({});
     return position[i];
 }
 
+ufc::finite_element * poisson3d_3_form_0::create_coordinate_finite_element() const
+{
+    return new poisson3d_3_finite_element_1();
+}
+
+ufc::dofmap * poisson3d_3_form_0::create_coordinate_dofmap() const
+{
+    return new poisson3d_3_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson3d_3_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson3d_3_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson3d_3_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_3_finite_element_0();
+        return new poisson3d_3_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_3_finite_element_0();
+        return new poisson3d_3_finite_element_2();
         break;
       }
     }
@@ -8484,19 +13022,18 @@ ufc::finite_element* poisson3d_3_form_0::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson3d_3_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_3_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_3_dofmap_0();
+        return new poisson3d_3_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_3_dofmap_0();
+        return new poisson3d_3_dofmap_2();
         break;
       }
     }
@@ -8504,183 +13041,225 @@ ufc::dofmap* poisson3d_3_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson3d_3_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson3d_3_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson3d_3_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson3d_3_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson3d_3_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson3d_3_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_3_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_3_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson3d_3_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson3d_3_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson3d_3_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson3d_3_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson3d_3_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson3d_3_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_3_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_3_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson3d_3_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson3d_3_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson3d_3_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson3d_3_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson3d_3_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson3d_3_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson3d_3_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson3d_3_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson3d_3_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson3d_3_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson3d_3_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson3d_3_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_3_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson3d_3_form_0::create_default_cell_integral() const
+ufc::cell_integral * poisson3d_3_form_0::create_default_cell_integral() const
 {
     return new poisson3d_3_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson3d_3_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson3d_3_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson3d_3_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson3d_3_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * poisson3d_3_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson3d_3_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * poisson3d_3_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson3d_3_form_0::create_default_vertex_integral() const
+ufc::interface_integral * poisson3d_3_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson3d_3_form_0::create_default_custom_integral() const
+ufc::overlap_integral * poisson3d_3_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 poisson3d_3_form_1::poisson3d_3_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_3_form_1::~poisson3d_3_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson3d_3_form_1::signature() const
+const char * poisson3d_3_form_1::signature() const
 {
-    return "8711087d8a65a92fa366658a2558fc9425b9d6f80cca45c17142dad0f4f4f49033d83570ab36a11172687963c4464e138bf082304fdf5059f2c964aaaea933b4";
+    return "4b354a66f56215a75c862ef25b8d88eb4d950dddca6f2c6ff25c356a255a6d03ee6cbf9c0a35aee037fa312537e8ad10f172e6dbe8024fb0aeb4ba05a474e7f0";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson3d_3_form_1::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson3d_3_form_1::num_coefficients() const
 {
     return 1;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson3d_3_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0});
     return position[i];
 }
 
+ufc::finite_element * poisson3d_3_form_1::create_coordinate_finite_element() const
+{
+    return new poisson3d_3_finite_element_1();
+}
+
+ufc::dofmap * poisson3d_3_form_1::create_coordinate_dofmap() const
+{
+    return new poisson3d_3_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson3d_3_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson3d_3_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson3d_3_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_3_finite_element_0();
+        return new poisson3d_3_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_3_finite_element_0();
+        return new poisson3d_3_finite_element_2();
         break;
       }
     }
@@ -8688,19 +13267,18 @@ ufc::finite_element* poisson3d_3_form_1::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson3d_3_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_3_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_3_dofmap_0();
+        return new poisson3d_3_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_3_dofmap_0();
+        return new poisson3d_3_dofmap_2();
         break;
       }
     }
@@ -8708,128 +13286,163 @@ ufc::dofmap* poisson3d_3_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson3d_3_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson3d_3_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson3d_3_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson3d_3_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson3d_3_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson3d_3_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_3_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_3_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson3d_3_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson3d_3_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson3d_3_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson3d_3_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson3d_3_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson3d_3_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_3_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_3_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson3d_3_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson3d_3_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson3d_3_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson3d_3_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson3d_3_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson3d_3_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson3d_3_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson3d_3_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson3d_3_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson3d_3_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson3d_3_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson3d_3_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_3_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson3d_3_form_1::create_default_cell_integral() const
+ufc::cell_integral * poisson3d_3_form_1::create_default_cell_integral() const
 {
     return new poisson3d_3_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson3d_3_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson3d_3_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson3d_3_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson3d_3_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson3d_3_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * poisson3d_3_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson3d_3_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * poisson3d_3_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson3d_3_form_1::create_default_custom_integral() const
+ufc::interface_integral * poisson3d_3_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_3_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/bench/fem/convergence/cpp/Poisson3D_3.h b/bench/fem/convergence/cpp/Poisson3D_3.h
index 113474f..ad23796 100644
--- a/bench/fem/convergence/cpp/Poisson3D_3.h
+++ b/bench/fem/convergence/cpp/Poisson3D_3.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,500 +13,735 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __POISSON3D_3_H
 #define __POISSON3D_3_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson3d_3_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson3d_3_finite_element_0();
 
-  /// Destructor
-  virtual ~poisson3d_3_finite_element_0();
+  ~poisson3d_3_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t space_dimension() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson3d_3_finite_element_1: public ufc::finite_element
+{
+public:
+
+  poisson3d_3_finite_element_1();
+
+  ~poisson3d_3_finite_element_1() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson3d_3_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson3d_3_finite_element_2();
+
+  ~poisson3d_3_finite_element_2() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
+  std::size_t num_sub_elements() const final override;
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class poisson3d_3_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   poisson3d_3_dofmap_0();
 
-  /// Destructor
-  virtual ~poisson3d_3_dofmap_0();
+  ~poisson3d_3_dofmap_0() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson3d_3_dofmap_1: public ufc::dofmap
+{
+public:
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  poisson3d_3_dofmap_1();
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  ~poisson3d_3_dofmap_1() override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  const char * signature() const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson3d_3_dofmap_2: public ufc::dofmap
+{
+public:
+
+  poisson3d_3_dofmap_2();
+
+  ~poisson3d_3_dofmap_2() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
+
+  std::size_t num_facet_dofs() const final override;
+
+  std::size_t num_entity_dofs(std::size_t d) const final override;
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 poisson3d_3_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson3d_3_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~poisson3d_3_cell_integral_0_otherwise();
+  ~poisson3d_3_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 poisson3d_3_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson3d_3_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~poisson3d_3_cell_integral_1_otherwise();
+  ~poisson3d_3_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson3d_3_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson3d_3_form_0();
 
-  /// Destructor
-  virtual ~poisson3d_3_form_0();
+  ~poisson3d_3_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson3d_3_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson3d_3_form_1();
 
-  /// Destructor
-  virtual ~poisson3d_3_form_1();
+  ~poisson3d_3_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -516,14 +751,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson3D_3
 {
@@ -532,43 +773,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -579,43 +797,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -626,63 +821,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_3_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -690,7 +892,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_3_form_0());
+    _ufc_form = std::make_shared<const poisson3d_3_form_0>();
   }
 
   // Destructor
@@ -720,57 +922,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_3_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_3_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_3_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_3_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -778,69 +1035,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_3_form_1());
+    _ufc_form = std::make_shared<const poisson3d_3_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_3_form_1());
+    _ufc_form = std::make_shared<const poisson3d_3_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_3_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_3_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_3_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->f = *f;
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_3_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -872,18 +1170,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/convergence/cpp/Poisson3D_4.cpp b/bench/fem/convergence/cpp/Poisson3D_4.cpp
index 41d583c..ace4a85 100644
--- a/bench/fem/convergence/cpp/Poisson3D_4.cpp
+++ b/bench/fem/convergence/cpp/Poisson3D_4.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -15,120 +15,135 @@
 //   format:                         'dolfin'
 //   no-evaluate_basis:              True
 //   no-evaluate_basis_derivatives:  True
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "Poisson3D_4.h"
 
-/// Constructor
 poisson3d_4_finite_element_0::poisson3d_4_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_4_finite_element_0::~poisson3d_4_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* poisson3d_4_finite_element_0::signature() const
+const char * poisson3d_4_finite_element_0::signature() const
 {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 4, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
 }
 
-/// Return the cell shape
 ufc::shape poisson3d_4_finite_element_0::cell_shape() const
 {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t poisson3d_4_finite_element_0::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t poisson3d_4_finite_element_0::geometric_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t poisson3d_4_finite_element_0::space_dimension() const
 {
-    return 35;
+    return 4;
 }
 
-/// Return the rank of the value space
 std::size_t poisson3d_4_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t poisson3d_4_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
+std::size_t poisson3d_4_finite_element_0::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_4_finite_element_0::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_4_finite_element_0::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_4_finite_element_0::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_4_finite_element_0::degree() const
+{
+    return 1;
+}
+
+const char * poisson3d_4_finite_element_0::family() const
+{
+    return "Lagrange";
+}
+
 void poisson3d_4_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
 throw std::runtime_error("// Function evaluate_basis not generated (compiled with -fno-evaluate_basis)");
 }
 
-/// Evaluate all basis functions at given point x in cell
-void poisson3d_4_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void poisson3d_4_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 35; r++)
+    for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
 void poisson3d_4_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
 throw std::runtime_error("// Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)");
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
 void poisson3d_4_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
                                                     int cell_orientation)
 {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -140,7 +155,7 @@ void poisson3d_4_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 35; r++)
+    for (unsigned int r = 0; r < 4; r++)
     {
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
@@ -149,22 +164,22 @@ void poisson3d_4_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 4)
+    if (n > 1)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[81];
-    for (unsigned int r = 0; r < 81; r++)
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 35; r++)
+    for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -172,10 +187,9 @@ void poisson3d_4_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n
     } // end loop over 'r'
 }
 
-/// Evaluate linear functional for dof i on the function f
 double poisson3d_4_finite_element_0::evaluate_dof(std::size_t i,
                                    const ufc::function& f,
-                                   const double* vertex_coordinates,
+                                   const double * coordinate_dofs,
                                    int cell_orientation,
                                    const ufc::cell& c) const
 {
@@ -188,328 +202,1105 @@ double poisson3d_4_finite_element_0::evaluate_dof(std::size_t i,
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 4:
+    }
+    
+    return 0.0;
+}
+
+void poisson3d_4_finite_element_0::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+}
+
+void poisson3d_4_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+}
+
+void poisson3d_4_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+}
+
+std::size_t poisson3d_4_finite_element_0::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_4_finite_element_0::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_4_finite_element_0::create() const
+{
+    return new poisson3d_4_finite_element_0();
+}
+
+
+poisson3d_4_finite_element_1::poisson3d_4_finite_element_1() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson3d_4_finite_element_1::~poisson3d_4_finite_element_1()
+{
+    // Do nothing
+}
+
+const char * poisson3d_4_finite_element_1::signature() const
+{
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+}
+
+ufc::shape poisson3d_4_finite_element_1::cell_shape() const
+{
+    return ufc::shape::tetrahedron;
+}
+
+std::size_t poisson3d_4_finite_element_1::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_4_finite_element_1::geometric_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_4_finite_element_1::space_dimension() const
+{
+    return 12;
+}
+
+std::size_t poisson3d_4_finite_element_1::value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_4_finite_element_1::value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = 0.75*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.75*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.75*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 3;
         break;
       }
-    case 5:
+    }
+    
+    return 0;
+}
+
+std::size_t poisson3d_4_finite_element_1::value_size() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_4_finite_element_1::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_4_finite_element_1::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 3;
         break;
       }
-    case 6:
+    }
+    
+    return 0;
+}
+
+std::size_t poisson3d_4_finite_element_1::reference_value_size() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_4_finite_element_1::degree() const
+{
+    return 1;
+}
+
+const char * poisson3d_4_finite_element_1::family() const
+{
+    return "Lagrange";
+}
+
+void poisson3d_4_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+throw std::runtime_error("// Function evaluate_basis not generated (compiled with -fno-evaluate_basis)");
+}
+
+void poisson3d_4_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void poisson3d_4_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+throw std::runtime_error("// Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)");
+}
+
+void poisson3d_4_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson3d_4_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = 0.25*vertex_coordinates[6] + 0.75*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[7] + 0.75*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[8] + 0.75*vertex_coordinates[11];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 7:
+    case 1:
       {
-        y[0] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[9];
-      y[1] = 0.75*vertex_coordinates[4] + 0.25*vertex_coordinates[10];
-      y[2] = 0.75*vertex_coordinates[5] + 0.25*vertex_coordinates[11];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 8:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 9:
+    case 3:
       {
-        y[0] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[4] + 0.75*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[5] + 0.75*vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 10:
+    case 4:
       {
-        y[0] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[6];
-      y[1] = 0.75*vertex_coordinates[4] + 0.25*vertex_coordinates[7];
-      y[2] = 0.75*vertex_coordinates[5] + 0.25*vertex_coordinates[8];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
-    case 11:
+    case 5:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
-    case 12:
+    case 6:
       {
-        y[0] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[6];
-      y[1] = 0.25*vertex_coordinates[4] + 0.75*vertex_coordinates[7];
-      y[2] = 0.25*vertex_coordinates[5] + 0.75*vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
-    case 13:
+    case 7:
       {
-        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[9];
-      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[10];
-      y[2] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
-    case 14:
+    case 8:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[2];
         break;
       }
-    case 15:
+    case 9:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[11];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[2];
         break;
       }
-    case 16:
+    case 10:
       {
-        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[6];
-      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[7];
-      y[2] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[2];
         break;
       }
-    case 17:
+    case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson3d_4_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+}
+
+void poisson3d_4_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+}
+
+void poisson3d_4_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+}
+
+std::size_t poisson3d_4_finite_element_1::num_sub_elements() const
+{
+    return 3;
+}
+
+ufc::finite_element * poisson3d_4_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson3d_4_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson3d_4_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson3d_4_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * poisson3d_4_finite_element_1::create() const
+{
+    return new poisson3d_4_finite_element_1();
+}
+
+
+poisson3d_4_finite_element_2::poisson3d_4_finite_element_2() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+poisson3d_4_finite_element_2::~poisson3d_4_finite_element_2()
+{
+    // Do nothing
+}
+
+const char * poisson3d_4_finite_element_2::signature() const
+{
+    return "FiniteElement('Lagrange', tetrahedron, 4)";
+}
+
+ufc::shape poisson3d_4_finite_element_2::cell_shape() const
+{
+    return ufc::shape::tetrahedron;
+}
+
+std::size_t poisson3d_4_finite_element_2::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_4_finite_element_2::geometric_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_4_finite_element_2::space_dimension() const
+{
+    return 35;
+}
+
+std::size_t poisson3d_4_finite_element_2::value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_4_finite_element_2::value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_4_finite_element_2::value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_4_finite_element_2::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_4_finite_element_2::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t poisson3d_4_finite_element_2::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t poisson3d_4_finite_element_2::degree() const
+{
+    return 4;
+}
+
+const char * poisson3d_4_finite_element_2::family() const
+{
+    return "Lagrange";
+}
+
+void poisson3d_4_finite_element_2::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+throw std::runtime_error("// Function evaluate_basis not generated (compiled with -fno-evaluate_basis)");
+}
+
+void poisson3d_4_finite_element_2::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 35; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+}
+
+void poisson3d_4_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+throw std::runtime_error("// Function evaluate_basis_derivatives not generated (compiled with -fno-evaluate_basis_derivatives)");
+}
+
+void poisson3d_4_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 35; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 4)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[81];
+    for (unsigned int r = 0; r < 81; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 35; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double poisson3d_4_finite_element_2::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 18:
+    case 1:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[6];
-      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[7];
-      y[2] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[8];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 19:
+    case 2:
       {
-        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[3];
-      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[4];
-      y[2] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[5];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 20:
+    case 3:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 21:
+    case 4:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[3];
-      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[4];
-      y[2] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[5];
+        y[0] = 0.75*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.75*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.75*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 22:
+    case 5:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 23:
+    case 6:
       {
-        y[0] = 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[4] + 0.5*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[5] + 0.5*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+        y[0] = 0.25*coordinate_dofs[6] + 0.75*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[7] + 0.75*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[8] + 0.75*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 24:
+    case 7:
       {
-        y[0] = 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+        y[0] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[9];
+      y[1] = 0.75*coordinate_dofs[4] + 0.25*coordinate_dofs[10];
+      y[2] = 0.75*coordinate_dofs[5] + 0.25*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 25:
+    case 8:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 26:
+    case 9:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+        y[0] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[4] + 0.75*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[5] + 0.75*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 27:
+    case 10:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+        y[0] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[6];
+      y[1] = 0.75*coordinate_dofs[4] + 0.25*coordinate_dofs[7];
+      y[2] = 0.75*coordinate_dofs[5] + 0.25*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 28:
+    case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 29:
+    case 12:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[4] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[5] + 0.25*vertex_coordinates[11];
+        y[0] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[6];
+      y[1] = 0.25*coordinate_dofs[4] + 0.75*coordinate_dofs[7];
+      y[2] = 0.25*coordinate_dofs[5] + 0.75*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 30:
+    case 13:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[9];
+      y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[10];
+      y[2] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 31:
+    case 14:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 32:
+    case 15:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[6];
-      y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[4] + 0.25*vertex_coordinates[7];
-      y[2] = 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[5] + 0.25*vertex_coordinates[8];
+        y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 33:
+    case 16:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[6];
+      y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[7];
+      y[2] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 34:
+    case 17:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    }
-    
-    return 0.0;
-}
-
-/// Evaluate linear functionals for all dofs on the function f
-void poisson3d_4_finite_element_0::evaluate_dofs(double* values,
-                                  const ufc::function& f,
-                                  const double* vertex_coordinates,
+    case 18:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[6];
+      y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[7];
+      y[2] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 19:
+      {
+        y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[3];
+      y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[4];
+      y[2] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 20:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 21:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[3];
+      y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[4];
+      y[2] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 22:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 23:
+      {
+        y[0] = 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[4] + 0.5*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[5] + 0.5*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 24:
+      {
+        y[0] = 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 25:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 26:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 27:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 28:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 29:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[4] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[5] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 30:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 31:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 32:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[6];
+      y[1] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[4] + 0.25*coordinate_dofs[7];
+      y[2] = 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[5] + 0.25*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 33:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 34:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void poisson3d_4_finite_element_2::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
                                   int cell_orientation,
                                   const ufc::cell& c) const
 {
@@ -518,187 +1309,186 @@ void poisson3d_4_finite_element_0::evaluate_dofs(double* values,
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.75*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.75*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.75*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+    y[0] = 0.75*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.75*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.75*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = 0.25*vertex_coordinates[6] + 0.75*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[7] + 0.75*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[8] + 0.75*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[6] + 0.75*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[7] + 0.75*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[8] + 0.75*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[6] = vals[0];
-    y[0] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[9];
-    y[1] = 0.75*vertex_coordinates[4] + 0.25*vertex_coordinates[10];
-    y[2] = 0.75*vertex_coordinates[5] + 0.25*vertex_coordinates[11];
+    y[0] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[9];
+    y[1] = 0.75*coordinate_dofs[4] + 0.25*coordinate_dofs[10];
+    y[2] = 0.75*coordinate_dofs[5] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[8] = vals[0];
-    y[0] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[4] + 0.75*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[5] + 0.75*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[4] + 0.75*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[5] + 0.75*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[9] = vals[0];
-    y[0] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[6];
-    y[1] = 0.75*vertex_coordinates[4] + 0.25*vertex_coordinates[7];
-    y[2] = 0.75*vertex_coordinates[5] + 0.25*vertex_coordinates[8];
+    y[0] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[6];
+    y[1] = 0.75*coordinate_dofs[4] + 0.25*coordinate_dofs[7];
+    y[2] = 0.75*coordinate_dofs[5] + 0.25*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[10] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[11] = vals[0];
-    y[0] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[6];
-    y[1] = 0.25*vertex_coordinates[4] + 0.75*vertex_coordinates[7];
-    y[2] = 0.25*vertex_coordinates[5] + 0.75*vertex_coordinates[8];
+    y[0] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[6];
+    y[1] = 0.25*coordinate_dofs[4] + 0.75*coordinate_dofs[7];
+    y[2] = 0.25*coordinate_dofs[5] + 0.75*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[12] = vals[0];
-    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[9];
-    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[10];
-    y[2] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[11];
+    y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[9];
+    y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[10];
+    y[2] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[13] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[14] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[15] = vals[0];
-    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[6];
-    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[7];
-    y[2] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[8];
+    y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[6];
+    y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[7];
+    y[2] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[16] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[17] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[6];
-    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[7];
-    y[2] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[8];
+    y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[6];
+    y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[7];
+    y[2] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[18] = vals[0];
-    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[3];
-    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[4];
-    y[2] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[5];
+    y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[3];
+    y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[4];
+    y[2] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[19] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[20] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[3];
-    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[4];
-    y[2] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[5];
+    y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[3];
+    y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[4];
+    y[2] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[21] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[22] = vals[0];
-    y[0] = 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[4] + 0.5*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[5] + 0.5*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[4] + 0.5*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[5] + 0.5*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[23] = vals[0];
-    y[0] = 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[24] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[25] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[26] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[27] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[28] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[4] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[5] + 0.25*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[4] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[5] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[29] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[30] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[31] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[6];
-    y[1] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[4] + 0.25*vertex_coordinates[7];
-    y[2] = 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[5] + 0.25*vertex_coordinates[8];
+    y[0] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[6];
+    y[1] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[4] + 0.25*coordinate_dofs[7];
+    y[2] = 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[5] + 0.25*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[32] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[33] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[34] = vals[0];
 }
 
-/// Interpolate vertex values from dof values
-void poisson3d_4_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
+void poisson3d_4_finite_element_2::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
                                               int cell_orientation,
                                               const ufc::cell& c) const
 {
@@ -709,60 +1499,649 @@ void poisson3d_4_finite_element_0::interpolate_vertex_values(double* vertex_valu
     vertex_values[3] = dof_values[3];
 }
 
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void poisson3d_4_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
+void poisson3d_4_finite_element_2::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.75*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[13] = 0.75*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[14] = 0.75*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.25*coordinate_dofs[6] + 0.75*coordinate_dofs[9];
+    dof_coordinates[19] = 0.25*coordinate_dofs[7] + 0.75*coordinate_dofs[10];
+    dof_coordinates[20] = 0.25*coordinate_dofs[8] + 0.75*coordinate_dofs[11];
+    dof_coordinates[21] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[9];
+    dof_coordinates[22] = 0.75*coordinate_dofs[4] + 0.25*coordinate_dofs[10];
+    dof_coordinates[23] = 0.75*coordinate_dofs[5] + 0.25*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[25] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[26] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[27] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[9];
+    dof_coordinates[28] = 0.25*coordinate_dofs[4] + 0.75*coordinate_dofs[10];
+    dof_coordinates[29] = 0.25*coordinate_dofs[5] + 0.75*coordinate_dofs[11];
+    dof_coordinates[30] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[6];
+    dof_coordinates[31] = 0.75*coordinate_dofs[4] + 0.25*coordinate_dofs[7];
+    dof_coordinates[32] = 0.75*coordinate_dofs[5] + 0.25*coordinate_dofs[8];
+    dof_coordinates[33] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[34] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[35] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[36] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[6];
+    dof_coordinates[37] = 0.25*coordinate_dofs[4] + 0.75*coordinate_dofs[7];
+    dof_coordinates[38] = 0.25*coordinate_dofs[5] + 0.75*coordinate_dofs[8];
+    dof_coordinates[39] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[9];
+    dof_coordinates[40] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[10];
+    dof_coordinates[41] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[11];
+    dof_coordinates[42] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[43] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[44] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[45] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[9];
+    dof_coordinates[46] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[10];
+    dof_coordinates[47] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[11];
+    dof_coordinates[48] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[6];
+    dof_coordinates[49] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[7];
+    dof_coordinates[50] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[8];
+    dof_coordinates[51] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[52] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[53] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[54] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[6];
+    dof_coordinates[55] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[7];
+    dof_coordinates[56] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[8];
+    dof_coordinates[57] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[3];
+    dof_coordinates[58] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[4];
+    dof_coordinates[59] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[5];
+    dof_coordinates[60] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[61] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[62] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[63] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[3];
+    dof_coordinates[64] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[4];
+    dof_coordinates[65] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[5];
+    dof_coordinates[66] = 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[67] = 0.5*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[68] = 0.5*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[69] = 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[70] = 0.25*coordinate_dofs[4] + 0.5*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[71] = 0.25*coordinate_dofs[5] + 0.5*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[72] = 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[73] = 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[74] = 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[75] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[76] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[77] = 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[78] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[79] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[80] = 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[81] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[82] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[83] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[84] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[9];
+    dof_coordinates[85] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[10];
+    dof_coordinates[86] = 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[11];
+    dof_coordinates[87] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[9];
+    dof_coordinates[88] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[4] + 0.25*coordinate_dofs[10];
+    dof_coordinates[89] = 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[5] + 0.25*coordinate_dofs[11];
+    dof_coordinates[90] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[91] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[92] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[93] = 0.5*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6];
+    dof_coordinates[94] = 0.5*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7];
+    dof_coordinates[95] = 0.5*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8];
+    dof_coordinates[96] = 0.25*coordinate_dofs[0] + 0.5*coordinate_dofs[3] + 0.25*coordinate_dofs[6];
+    dof_coordinates[97] = 0.25*coordinate_dofs[1] + 0.5*coordinate_dofs[4] + 0.25*coordinate_dofs[7];
+    dof_coordinates[98] = 0.25*coordinate_dofs[2] + 0.5*coordinate_dofs[5] + 0.25*coordinate_dofs[8];
+    dof_coordinates[99] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[100] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[101] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[102] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[103] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[104] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+}
+
+std::size_t poisson3d_4_finite_element_2::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_4_finite_element_2::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * poisson3d_4_finite_element_2::create() const
+{
+    return new poisson3d_4_finite_element_2();
+}
+
+
+poisson3d_4_dofmap_0::poisson3d_4_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson3d_4_dofmap_0::~poisson3d_4_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * poisson3d_4_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+}
+
+bool poisson3d_4_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson3d_4_dofmap_0::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_4_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t poisson3d_4_dofmap_0::num_element_dofs() const
+{
+    return 4;
+}
+
+std::size_t poisson3d_4_dofmap_0::num_facet_dofs() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_4_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson3d_4_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+}
+
+void poisson3d_4_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_4_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+}
+
+std::size_t poisson3d_4_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson3d_4_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * poisson3d_4_dofmap_0::create() const
+{
+    return new poisson3d_4_dofmap_0();
+}
+
+
+poisson3d_4_dofmap_1::poisson3d_4_dofmap_1() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+poisson3d_4_dofmap_1::~poisson3d_4_dofmap_1()
+{
+    // Do nothing
+}
+
+const char * poisson3d_4_dofmap_1::signature() const
+{
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+}
+
+bool poisson3d_4_dofmap_1::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t poisson3d_4_dofmap_1::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t poisson3d_4_dofmap_1::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return 3*num_global_entities[0];
+}
+
+std::size_t poisson3d_4_dofmap_1::num_element_dofs() const
+{
+    return 12;
+}
+
+std::size_t poisson3d_4_dofmap_1::num_facet_dofs() const
+{
+    return 9;
+}
+
+std::size_t poisson3d_4_dofmap_1::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void poisson3d_4_dofmap_1::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+}
+
+void poisson3d_4_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
+        break;
+      }
+    }
+    
+}
+
+void poisson3d_4_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
 {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
 }
 
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void poisson3d_4_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+std::size_t poisson3d_4_dofmap_1::num_sub_dofmaps() const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 3;
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t poisson3d_4_finite_element_0::num_sub_elements() const
+ufc::dofmap * poisson3d_4_dofmap_1::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson3d_4_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson3d_4_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson3d_4_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* poisson3d_4_finite_element_0::create_sub_element(std::size_t i) const
+ufc::dofmap * poisson3d_4_dofmap_1::create() const
 {
-    return 0;
+    return new poisson3d_4_dofmap_1();
 }
 
-/// Create a new class instance
-ufc::finite_element* poisson3d_4_finite_element_0::create() const
-{
-    return new poisson3d_4_finite_element_0();
-}
 
-/// Constructor
-poisson3d_4_dofmap_0::poisson3d_4_dofmap_0() : ufc::dofmap()
+poisson3d_4_dofmap_2::poisson3d_4_dofmap_2() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-poisson3d_4_dofmap_0::~poisson3d_4_dofmap_0()
+poisson3d_4_dofmap_2::~poisson3d_4_dofmap_2()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* poisson3d_4_dofmap_0::signature() const
+const char * poisson3d_4_dofmap_2::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 4, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 4)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool poisson3d_4_dofmap_0::needs_mesh_entities(std::size_t d) const
+bool poisson3d_4_dofmap_2::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
@@ -791,39 +2170,28 @@ bool poisson3d_4_dofmap_0::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t poisson3d_4_dofmap_0::topological_dimension() const
-{
-    return 3;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t poisson3d_4_dofmap_0::geometric_dimension() const
+std::size_t poisson3d_4_dofmap_2::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t poisson3d_4_dofmap_0::global_dimension(const std::vector<std::size_t>&
+std::size_t poisson3d_4_dofmap_2::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
     return num_global_entities[0] + 3*num_global_entities[1] + 3*num_global_entities[2] + num_global_entities[3];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t poisson3d_4_dofmap_0::num_element_dofs() const
+std::size_t poisson3d_4_dofmap_2::num_element_dofs() const
 {
     return 35;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t poisson3d_4_dofmap_0::num_facet_dofs() const
+std::size_t poisson3d_4_dofmap_2::num_facet_dofs() const
 {
     return 15;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t poisson3d_4_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t poisson3d_4_dofmap_2::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
@@ -852,55 +2220,53 @@ std::size_t poisson3d_4_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void poisson3d_4_dofmap_0::tabulate_dofs(std::size_t* dofs,
+void poisson3d_4_dofmap_2::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + 3*c.entity_indices[1][0];
-    dofs[5] = offset + 3*c.entity_indices[1][0] + 1;
-    dofs[6] = offset + 3*c.entity_indices[1][0] + 2;
-    dofs[7] = offset + 3*c.entity_indices[1][1];
-    dofs[8] = offset + 3*c.entity_indices[1][1] + 1;
-    dofs[9] = offset + 3*c.entity_indices[1][1] + 2;
-    dofs[10] = offset + 3*c.entity_indices[1][2];
-    dofs[11] = offset + 3*c.entity_indices[1][2] + 1;
-    dofs[12] = offset + 3*c.entity_indices[1][2] + 2;
-    dofs[13] = offset + 3*c.entity_indices[1][3];
-    dofs[14] = offset + 3*c.entity_indices[1][3] + 1;
-    dofs[15] = offset + 3*c.entity_indices[1][3] + 2;
-    dofs[16] = offset + 3*c.entity_indices[1][4];
-    dofs[17] = offset + 3*c.entity_indices[1][4] + 1;
-    dofs[18] = offset + 3*c.entity_indices[1][4] + 2;
-    dofs[19] = offset + 3*c.entity_indices[1][5];
-    dofs[20] = offset + 3*c.entity_indices[1][5] + 1;
-    dofs[21] = offset + 3*c.entity_indices[1][5] + 2;
+    dofs[4] = offset + 3*entity_indices[1][0];
+    dofs[5] = offset + 3*entity_indices[1][0] + 1;
+    dofs[6] = offset + 3*entity_indices[1][0] + 2;
+    dofs[7] = offset + 3*entity_indices[1][1];
+    dofs[8] = offset + 3*entity_indices[1][1] + 1;
+    dofs[9] = offset + 3*entity_indices[1][1] + 2;
+    dofs[10] = offset + 3*entity_indices[1][2];
+    dofs[11] = offset + 3*entity_indices[1][2] + 1;
+    dofs[12] = offset + 3*entity_indices[1][2] + 2;
+    dofs[13] = offset + 3*entity_indices[1][3];
+    dofs[14] = offset + 3*entity_indices[1][3] + 1;
+    dofs[15] = offset + 3*entity_indices[1][3] + 2;
+    dofs[16] = offset + 3*entity_indices[1][4];
+    dofs[17] = offset + 3*entity_indices[1][4] + 1;
+    dofs[18] = offset + 3*entity_indices[1][4] + 2;
+    dofs[19] = offset + 3*entity_indices[1][5];
+    dofs[20] = offset + 3*entity_indices[1][5] + 1;
+    dofs[21] = offset + 3*entity_indices[1][5] + 2;
     offset += 3*num_global_entities[1];
-    dofs[22] = offset + 3*c.entity_indices[2][0];
-    dofs[23] = offset + 3*c.entity_indices[2][0] + 1;
-    dofs[24] = offset + 3*c.entity_indices[2][0] + 2;
-    dofs[25] = offset + 3*c.entity_indices[2][1];
-    dofs[26] = offset + 3*c.entity_indices[2][1] + 1;
-    dofs[27] = offset + 3*c.entity_indices[2][1] + 2;
-    dofs[28] = offset + 3*c.entity_indices[2][2];
-    dofs[29] = offset + 3*c.entity_indices[2][2] + 1;
-    dofs[30] = offset + 3*c.entity_indices[2][2] + 2;
-    dofs[31] = offset + 3*c.entity_indices[2][3];
-    dofs[32] = offset + 3*c.entity_indices[2][3] + 1;
-    dofs[33] = offset + 3*c.entity_indices[2][3] + 2;
+    dofs[22] = offset + 3*entity_indices[2][0];
+    dofs[23] = offset + 3*entity_indices[2][0] + 1;
+    dofs[24] = offset + 3*entity_indices[2][0] + 2;
+    dofs[25] = offset + 3*entity_indices[2][1];
+    dofs[26] = offset + 3*entity_indices[2][1] + 1;
+    dofs[27] = offset + 3*entity_indices[2][1] + 2;
+    dofs[28] = offset + 3*entity_indices[2][2];
+    dofs[29] = offset + 3*entity_indices[2][2] + 1;
+    dofs[30] = offset + 3*entity_indices[2][2] + 2;
+    dofs[31] = offset + 3*entity_indices[2][3];
+    dofs[32] = offset + 3*entity_indices[2][3] + 1;
+    dofs[33] = offset + 3*entity_indices[2][3] + 2;
     offset += 3*num_global_entities[2];
-    dofs[34] = offset + c.entity_indices[3][0];
+    dofs[34] = offset + entity_indices[3][0];
     offset += num_global_entities[3];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void poisson3d_4_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
+void poisson3d_4_dofmap_2::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
@@ -985,8 +2351,7 @@ void poisson3d_4_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void poisson3d_4_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
+void poisson3d_4_dofmap_2::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 3)
@@ -1139,158 +2504,41 @@ void poisson3d_4_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void poisson3d_4_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.75*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[13] = 0.75*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[14] = 0.75*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.25*vertex_coordinates[6] + 0.75*vertex_coordinates[9];
-    dof_coordinates[19] = 0.25*vertex_coordinates[7] + 0.75*vertex_coordinates[10];
-    dof_coordinates[20] = 0.25*vertex_coordinates[8] + 0.75*vertex_coordinates[11];
-    dof_coordinates[21] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[9];
-    dof_coordinates[22] = 0.75*vertex_coordinates[4] + 0.25*vertex_coordinates[10];
-    dof_coordinates[23] = 0.75*vertex_coordinates[5] + 0.25*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[25] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[26] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[27] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[9];
-    dof_coordinates[28] = 0.25*vertex_coordinates[4] + 0.75*vertex_coordinates[10];
-    dof_coordinates[29] = 0.25*vertex_coordinates[5] + 0.75*vertex_coordinates[11];
-    dof_coordinates[30] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[6];
-    dof_coordinates[31] = 0.75*vertex_coordinates[4] + 0.25*vertex_coordinates[7];
-    dof_coordinates[32] = 0.75*vertex_coordinates[5] + 0.25*vertex_coordinates[8];
-    dof_coordinates[33] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[34] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[35] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[36] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[6];
-    dof_coordinates[37] = 0.25*vertex_coordinates[4] + 0.75*vertex_coordinates[7];
-    dof_coordinates[38] = 0.25*vertex_coordinates[5] + 0.75*vertex_coordinates[8];
-    dof_coordinates[39] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[9];
-    dof_coordinates[40] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[10];
-    dof_coordinates[41] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[11];
-    dof_coordinates[42] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[43] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[44] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[45] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[9];
-    dof_coordinates[46] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[10];
-    dof_coordinates[47] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[11];
-    dof_coordinates[48] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[6];
-    dof_coordinates[49] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[7];
-    dof_coordinates[50] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[8];
-    dof_coordinates[51] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[52] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[53] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[54] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[6];
-    dof_coordinates[55] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[7];
-    dof_coordinates[56] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[8];
-    dof_coordinates[57] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[3];
-    dof_coordinates[58] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[4];
-    dof_coordinates[59] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[5];
-    dof_coordinates[60] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[61] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[62] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[63] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[3];
-    dof_coordinates[64] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[4];
-    dof_coordinates[65] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[5];
-    dof_coordinates[66] = 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[67] = 0.5*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[68] = 0.5*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[69] = 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[70] = 0.25*vertex_coordinates[4] + 0.5*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[71] = 0.25*vertex_coordinates[5] + 0.5*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[72] = 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[73] = 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[74] = 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[75] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[76] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[77] = 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[78] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[79] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[80] = 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[81] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[82] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[83] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[84] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[9];
-    dof_coordinates[85] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[10];
-    dof_coordinates[86] = 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[11];
-    dof_coordinates[87] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[9];
-    dof_coordinates[88] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[4] + 0.25*vertex_coordinates[10];
-    dof_coordinates[89] = 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[5] + 0.25*vertex_coordinates[11];
-    dof_coordinates[90] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[91] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[92] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[93] = 0.5*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6];
-    dof_coordinates[94] = 0.5*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7];
-    dof_coordinates[95] = 0.5*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8];
-    dof_coordinates[96] = 0.25*vertex_coordinates[0] + 0.5*vertex_coordinates[3] + 0.25*vertex_coordinates[6];
-    dof_coordinates[97] = 0.25*vertex_coordinates[1] + 0.5*vertex_coordinates[4] + 0.25*vertex_coordinates[7];
-    dof_coordinates[98] = 0.25*vertex_coordinates[2] + 0.5*vertex_coordinates[5] + 0.25*vertex_coordinates[8];
-    dof_coordinates[99] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[100] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[101] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[102] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[103] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[104] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t poisson3d_4_dofmap_0::num_sub_dofmaps() const
+std::size_t poisson3d_4_dofmap_2::num_sub_dofmaps() const
 {
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* poisson3d_4_dofmap_0::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_4_dofmap_2::create_sub_dofmap(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* poisson3d_4_dofmap_0::create() const
+ufc::dofmap * poisson3d_4_dofmap_2::create() const
 {
-    return new poisson3d_4_dofmap_0();
+    return new poisson3d_4_dofmap_2();
 }
 
-/// Constructor
+
 poisson3d_4_cell_integral_0_otherwise::poisson3d_4_cell_integral_0_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson3d_4_cell_integral_0_otherwise::~poisson3d_4_cell_integral_0_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson3d_4_cell_integral_0_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson3d_4_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson3d_4_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -1300,7 +2548,7 @@ void poisson3d_4_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1322,1256 +2570,1253 @@ void poisson3d_4_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
     
     // Compute element tensor
-    A[0] = 0.0379188712522048*G0_0_0 + 0.0379188712522048*G0_0_1 + 0.0379188712522048*G0_0_2 + 0.0379188712522048*G0_1_0 + 0.0379188712522048*G0_1_1 + 0.0379188712522048*G0_1_2 + 0.0379188712522048*G0_2_0 + 0.0379188712522048*G0_2_1 + 0.0379188712522048*G0_2_2;
-    A[1] = 0.00511463844797181*G0_0_0 + 0.00511463844797181*G0_1_0 + 0.00511463844797182*G0_2_0;
-    A[2] = 0.00511463844797183*G0_0_1 + 0.00511463844797182*G0_1_1 + 0.00511463844797184*G0_2_1;
-    A[3] = 0.00511463844797182*G0_0_2 + 0.0051146384479718*G0_1_2 + 0.00511463844797181*G0_2_2;
-    A[4] = 0.00776014109347438*G0_0_1 + 0.00776014109347441*G0_0_2 + 0.00776014109347437*G0_1_1 + 0.00776014109347441*G0_1_2 + 0.00776014109347438*G0_2_1 + 0.00776014109347445*G0_2_2;
-    A[5] = 0.00511463844797173*G0_0_1 + 0.00511463844797174*G0_0_2 + 0.00511463844797174*G0_1_1 + 0.00511463844797172*G0_1_2 + 0.00511463844797173*G0_2_1 + 0.00511463844797169*G0_2_2;
-    A[6] = 0.0077601410934745*G0_0_1 + 0.00776014109347441*G0_0_2 + 0.00776014109347447*G0_1_1 + 0.00776014109347441*G0_1_2 + 0.00776014109347445*G0_2_1 + 0.00776014109347439*G0_2_2;
-    A[7] = 0.00776014109347441*G0_0_0 + 0.00776014109347449*G0_0_2 + 0.0077601410934743*G0_1_0 + 0.00776014109347438*G0_1_2 + 0.00776014109347432*G0_2_0 + 0.00776014109347442*G0_2_2;
-    A[8] = 0.00511463844797148*G0_0_0 + 0.00511463844797145*G0_0_2 + 0.00511463844797156*G0_1_0 + 0.0051146384479715*G0_1_2 + 0.00511463844797161*G0_2_0 + 0.00511463844797155*G0_2_2;
-    A[9] = 0.00776014109347452*G0_0_0 + 0.00776014109347447*G0_0_2 + 0.00776014109347449*G0_1_0 + 0.00776014109347449*G0_1_2 + 0.00776014109347447*G0_2_0 + 0.00776014109347446*G0_2_2;
-    A[10] = 0.00776014109347445*G0_0_0 + 0.00776014109347448*G0_0_1 + 0.00776014109347434*G0_1_0 + 0.00776014109347437*G0_1_1 + 0.00776014109347437*G0_2_0 + 0.00776014109347441*G0_2_1;
-    A[11] = 0.00511463844797149*G0_0_0 + 0.00511463844797161*G0_0_1 + 0.0051146384479716*G0_1_0 + 0.00511463844797171*G0_1_1 + 0.00511463844797155*G0_2_0 + 0.00511463844797167*G0_2_1;
-    A[12] = 0.00776014109347443*G0_0_0 + 0.00776014109347429*G0_0_1 + 0.00776014109347443*G0_1_0 + 0.00776014109347431*G0_1_1 + 0.00776014109347447*G0_2_0 + 0.00776014109347433*G0_2_1;
-    A[13] = -0.024691358024691*G0_0_0 - 0.0246913580246911*G0_0_1 - 0.0705467372134042*G0_0_2 - 0.0246913580246911*G0_1_0 - 0.0246913580246911*G0_1_1 - 0.0705467372134042*G0_1_2 - 0.0246913580246911*G0_2_0 - 0.0246913580246911*G0_2_1 - 0.0705467372134042*G0_2_2;
-    A[14] = 0.0202821869488534*G0_0_0 + 0.0202821869488535*G0_0_1 + 0.0529100529100532*G0_0_2 + 0.0202821869488534*G0_1_0 + 0.0202821869488535*G0_1_1 + 0.0529100529100532*G0_1_2 + 0.0202821869488535*G0_2_0 + 0.0202821869488535*G0_2_1 + 0.0529100529100532*G0_2_2;
-    A[15] = -0.00776014109347451*G0_0_0 - 0.00776014109347451*G0_0_1 - 0.0253968253968255*G0_0_2 - 0.00776014109347448*G0_1_0 - 0.00776014109347448*G0_1_1 - 0.0253968253968254*G0_1_2 - 0.00776014109347446*G0_2_0 - 0.00776014109347447*G0_2_1 - 0.0253968253968255*G0_2_2;
-    A[16] = -0.0246913580246911*G0_0_0 - 0.0705467372134043*G0_0_1 - 0.0246913580246911*G0_0_2 - 0.0246913580246911*G0_1_0 - 0.0705467372134043*G0_1_1 - 0.0246913580246911*G0_1_2 - 0.0246913580246911*G0_2_0 - 0.0705467372134043*G0_2_1 - 0.0246913580246911*G0_2_2;
-    A[17] = 0.0202821869488534*G0_0_0 + 0.0529100529100532*G0_0_1 + 0.0202821869488533*G0_0_2 + 0.0202821869488535*G0_1_0 + 0.0529100529100532*G0_1_1 + 0.0202821869488535*G0_1_2 + 0.0202821869488535*G0_2_0 + 0.0529100529100532*G0_2_1 + 0.0202821869488535*G0_2_2;
-    A[18] = -0.00776014109347442*G0_0_0 - 0.0253968253968255*G0_0_1 - 0.0077601410934744*G0_0_2 - 0.00776014109347442*G0_1_0 - 0.0253968253968255*G0_1_1 - 0.0077601410934744*G0_1_2 - 0.00776014109347447*G0_2_0 - 0.0253968253968255*G0_2_1 - 0.00776014109347444*G0_2_2;
-    A[19] = -0.0705467372134043*G0_0_0 - 0.0246913580246911*G0_0_1 - 0.0246913580246911*G0_0_2 - 0.0705467372134043*G0_1_0 - 0.0246913580246912*G0_1_1 - 0.0246913580246911*G0_1_2 - 0.0705467372134043*G0_2_0 - 0.0246913580246912*G0_2_1 - 0.0246913580246912*G0_2_2;
-    A[20] = 0.0529100529100533*G0_0_0 + 0.0202821869488535*G0_0_1 + 0.0202821869488535*G0_0_2 + 0.0529100529100533*G0_1_0 + 0.0202821869488534*G0_1_1 + 0.0202821869488534*G0_1_2 + 0.0529100529100533*G0_2_0 + 0.0202821869488535*G0_2_1 + 0.0202821869488535*G0_2_2;
-    A[21] = -0.0253968253968256*G0_0_0 - 0.0077601410934745*G0_0_1 - 0.00776014109347449*G0_0_2 - 0.0253968253968256*G0_1_0 - 0.00776014109347439*G0_1_1 - 0.00776014109347439*G0_1_2 - 0.0253968253968256*G0_2_0 - 0.00776014109347442*G0_2_1 - 0.00776014109347442*G0_2_2;
-    A[22] = 0.0183421516754845*G0_0_0 + 0.0183421516754845*G0_0_1 + 0.0183421516754847*G0_0_2 + 0.0183421516754847*G0_1_0 + 0.0183421516754845*G0_1_1 + 0.0183421516754847*G0_1_2 + 0.0183421516754848*G0_2_0 + 0.0183421516754846*G0_2_1 + 0.0183421516754847*G0_2_2;
-    A[23] = 0.018342151675485*G0_0_0 + 0.018342151675485*G0_0_1 + 0.0183421516754847*G0_0_2 + 0.0183421516754849*G0_1_0 + 0.018342151675485*G0_1_1 + 0.0183421516754848*G0_1_2 + 0.0183421516754849*G0_2_0 + 0.018342151675485*G0_2_1 + 0.0183421516754848*G0_2_2;
-    A[24] = 0.0183421516754851*G0_0_0 + 0.0183421516754849*G0_0_1 + 0.018342151675485*G0_0_2 + 0.0183421516754851*G0_1_0 + 0.018342151675485*G0_1_1 + 0.0183421516754851*G0_1_2 + 0.0183421516754851*G0_2_0 + 0.018342151675485*G0_2_1 + 0.0183421516754851*G0_2_2;
-    A[25] = 0.0493827160493822*G0_0_0 + 0.0423280423280418*G0_0_1 + 0.0423280423280419*G0_0_2 + 0.0493827160493823*G0_1_0 + 0.0423280423280419*G0_1_1 + 0.0423280423280419*G0_1_2 + 0.0493827160493823*G0_2_0 + 0.0423280423280419*G0_2_1 + 0.0423280423280419*G0_2_2;
-    A[26] = -0.018342151675485*G0_0_0 - 0.0253968253968251*G0_0_1 - 0.0253968253968251*G0_0_2 - 0.0183421516754849*G0_1_0 - 0.0253968253968252*G0_1_1 - 0.0253968253968252*G0_1_2 - 0.0183421516754849*G0_2_0 - 0.0253968253968252*G0_2_1 - 0.0253968253968252*G0_2_2;
-    A[27] = -0.0183421516754851*G0_0_0 - 0.0253968253968251*G0_0_1 - 0.0253968253968252*G0_0_2 - 0.0183421516754851*G0_1_0 - 0.0253968253968251*G0_1_1 - 0.0253968253968252*G0_1_2 - 0.018342151675485*G0_2_0 - 0.0253968253968252*G0_2_1 - 0.0253968253968252*G0_2_2;
-    A[28] = 0.0423280423280417*G0_0_0 + 0.0493827160493822*G0_0_1 + 0.0423280423280417*G0_0_2 + 0.0423280423280416*G0_1_0 + 0.0493827160493821*G0_1_1 + 0.0423280423280418*G0_1_2 + 0.0423280423280417*G0_2_0 + 0.0493827160493822*G0_2_1 + 0.0423280423280418*G0_2_2;
-    A[29] = -0.025396825396825*G0_0_0 - 0.0183421516754846*G0_0_1 - 0.0253968253968249*G0_0_2 - 0.0253968253968248*G0_1_0 - 0.0183421516754845*G0_1_1 - 0.0253968253968248*G0_1_2 - 0.0253968253968249*G0_2_0 - 0.0183421516754846*G0_2_1 - 0.025396825396825*G0_2_2;
-    A[30] = -0.0253968253968249*G0_0_0 - 0.0183421516754849*G0_0_1 - 0.0253968253968252*G0_0_2 - 0.025396825396825*G0_1_0 - 0.018342151675485*G0_1_1 - 0.0253968253968252*G0_1_2 - 0.0253968253968251*G0_2_0 - 0.018342151675485*G0_2_1 - 0.0253968253968252*G0_2_2;
-    A[31] = 0.0423280423280419*G0_0_0 + 0.0423280423280418*G0_0_1 + 0.0493827160493822*G0_0_2 + 0.0423280423280418*G0_1_0 + 0.0423280423280421*G0_1_1 + 0.0493827160493823*G0_1_2 + 0.0423280423280419*G0_2_0 + 0.042328042328042*G0_2_1 + 0.0493827160493823*G0_2_2;
-    A[32] = -0.0253968253968253*G0_0_0 - 0.025396825396825*G0_0_1 - 0.0183421516754847*G0_0_2 - 0.0253968253968251*G0_1_0 - 0.025396825396825*G0_1_1 - 0.0183421516754848*G0_1_2 - 0.0253968253968252*G0_2_0 - 0.0253968253968251*G0_2_1 - 0.0183421516754848*G0_2_2;
-    A[33] = -0.0253968253968249*G0_0_0 - 0.0253968253968251*G0_0_1 - 0.0183421516754847*G0_0_2 - 0.0253968253968251*G0_1_0 - 0.0253968253968253*G0_1_1 - 0.0183421516754847*G0_1_2 - 0.025396825396825*G0_2_0 - 0.0253968253968253*G0_2_1 - 0.0183421516754848*G0_2_2;
-    A[34] = -0.0677248677248668*G0_0_0 - 0.0677248677248671*G0_0_1 - 0.0677248677248672*G0_0_2 - 0.067724867724867*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.0677248677248673*G0_1_2 - 0.0677248677248671*G0_2_0 - 0.0677248677248672*G0_2_1 - 0.0677248677248674*G0_2_2;
-    A[35] = 0.00511463844797181*G0_0_0 + 0.00511463844797181*G0_0_1 + 0.00511463844797182*G0_0_2;
+    A[0] = 0.0379188712522047*G0_0_0 + 0.0379188712522048*G0_0_1 + 0.0379188712522048*G0_0_2 + 0.0379188712522048*G0_1_0 + 0.0379188712522048*G0_1_1 + 0.0379188712522048*G0_1_2 + 0.0379188712522048*G0_2_0 + 0.0379188712522048*G0_2_1 + 0.0379188712522048*G0_2_2;
+    A[1] = 0.00511463844797179*G0_0_0 + 0.0051146384479718*G0_1_0 + 0.0051146384479718*G0_2_0;
+    A[2] = 0.00511463844797184*G0_0_1 + 0.00511463844797182*G0_1_1 + 0.00511463844797184*G0_2_1;
+    A[3] = 0.00511463844797182*G0_0_2 + 0.00511463844797181*G0_1_2 + 0.00511463844797181*G0_2_2;
+    A[4] = 0.00776014109347435*G0_0_1 + 0.00776014109347441*G0_0_2 + 0.00776014109347435*G0_1_1 + 0.00776014109347439*G0_1_2 + 0.00776014109347434*G0_2_1 + 0.00776014109347442*G0_2_2;
+    A[5] = 0.00511463844797178*G0_0_1 + 0.00511463844797175*G0_0_2 + 0.00511463844797176*G0_1_1 + 0.00511463844797175*G0_1_2 + 0.00511463844797176*G0_2_1 + 0.00511463844797172*G0_2_2;
+    A[6] = 0.00776014109347446*G0_0_1 + 0.0077601410934744*G0_0_2 + 0.00776014109347445*G0_1_1 + 0.00776014109347438*G0_1_2 + 0.00776014109347442*G0_2_1 + 0.00776014109347437*G0_2_2;
+    A[7] = 0.00776014109347435*G0_0_0 + 0.0077601410934744*G0_0_2 + 0.00776014109347425*G0_1_0 + 0.00776014109347432*G0_1_2 + 0.00776014109347427*G0_2_0 + 0.00776014109347435*G0_2_2;
+    A[8] = 0.00511463844797153*G0_0_0 + 0.00511463844797153*G0_0_2 + 0.00511463844797159*G0_1_0 + 0.00511463844797155*G0_1_2 + 0.00511463844797165*G0_2_0 + 0.0051146384479716*G0_2_2;
+    A[9] = 0.00776014109347449*G0_0_0 + 0.00776014109347443*G0_0_2 + 0.00776014109347447*G0_1_0 + 0.00776014109347445*G0_1_2 + 0.00776014109347445*G0_2_0 + 0.00776014109347443*G0_2_2;
+    A[10] = 0.00776014109347435*G0_0_0 + 0.00776014109347438*G0_0_1 + 0.00776014109347427*G0_1_0 + 0.0077601410934743*G0_1_1 + 0.00776014109347429*G0_2_0 + 0.00776014109347432*G0_2_1;
+    A[11] = 0.00511463844797147*G0_0_0 + 0.0051146384479716*G0_0_1 + 0.00511463844797161*G0_1_0 + 0.00511463844797172*G0_1_1 + 0.00511463844797157*G0_2_0 + 0.00511463844797169*G0_2_1;
+    A[12] = 0.00776014109347443*G0_0_0 + 0.00776014109347428*G0_0_1 + 0.00776014109347441*G0_1_0 + 0.0077601410934743*G0_1_1 + 0.00776014109347444*G0_2_0 + 0.0077601410934743*G0_2_1;
+    A[13] = -0.024691358024691*G0_0_0 - 0.024691358024691*G0_0_1 - 0.0705467372134042*G0_0_2 - 0.024691358024691*G0_1_0 - 0.0246913580246911*G0_1_1 - 0.0705467372134042*G0_1_2 - 0.024691358024691*G0_2_0 - 0.0246913580246911*G0_2_1 - 0.0705467372134042*G0_2_2;
+    A[14] = 0.0202821869488534*G0_0_0 + 0.0202821869488534*G0_0_1 + 0.0529100529100532*G0_0_2 + 0.0202821869488535*G0_1_0 + 0.0202821869488535*G0_1_1 + 0.0529100529100532*G0_1_2 + 0.0202821869488535*G0_2_0 + 0.0202821869488535*G0_2_1 + 0.0529100529100532*G0_2_2;
+    A[15] = -0.00776014109347448*G0_0_0 - 0.00776014109347447*G0_0_1 - 0.0253968253968255*G0_0_2 - 0.00776014109347447*G0_1_0 - 0.00776014109347446*G0_1_1 - 0.0253968253968254*G0_1_2 - 0.00776014109347444*G0_2_0 - 0.00776014109347443*G0_2_1 - 0.0253968253968255*G0_2_2;
+    A[16] = -0.024691358024691*G0_0_0 - 0.0705467372134043*G0_0_1 - 0.0246913580246911*G0_0_2 - 0.0246913580246911*G0_1_0 - 0.0705467372134043*G0_1_1 - 0.0246913580246911*G0_1_2 - 0.0246913580246911*G0_2_0 - 0.0705467372134043*G0_2_1 - 0.0246913580246911*G0_2_2;
+    A[17] = 0.0202821869488534*G0_0_0 + 0.0529100529100532*G0_0_1 + 0.0202821869488534*G0_0_2 + 0.0202821869488535*G0_1_0 + 0.0529100529100532*G0_1_1 + 0.0202821869488535*G0_1_2 + 0.0202821869488535*G0_2_0 + 0.0529100529100532*G0_2_1 + 0.0202821869488535*G0_2_2;
+    A[18] = -0.00776014109347443*G0_0_0 - 0.0253968253968255*G0_0_1 - 0.00776014109347441*G0_0_2 - 0.00776014109347441*G0_1_0 - 0.0253968253968255*G0_1_1 - 0.00776014109347439*G0_1_2 - 0.00776014109347444*G0_2_0 - 0.0253968253968255*G0_2_1 - 0.00776014109347442*G0_2_2;
+    A[19] = -0.0705467372134042*G0_0_0 - 0.0246913580246911*G0_0_1 - 0.024691358024691*G0_0_2 - 0.0705467372134043*G0_1_0 - 0.0246913580246911*G0_1_1 - 0.0246913580246911*G0_1_2 - 0.0705467372134043*G0_2_0 - 0.0246913580246911*G0_2_1 - 0.0246913580246911*G0_2_2;
+    A[20] = 0.0529100529100532*G0_0_0 + 0.0202821869488534*G0_0_1 + 0.0202821869488534*G0_0_2 + 0.0529100529100532*G0_1_0 + 0.0202821869488533*G0_1_1 + 0.0202821869488533*G0_1_2 + 0.0529100529100532*G0_2_0 + 0.0202821869488534*G0_2_1 + 0.0202821869488534*G0_2_2;
+    A[21] = -0.0253968253968255*G0_0_0 - 0.00776014109347441*G0_0_1 - 0.00776014109347442*G0_0_2 - 0.0253968253968255*G0_1_0 - 0.00776014109347433*G0_1_1 - 0.00776014109347433*G0_1_2 - 0.0253968253968255*G0_2_0 - 0.00776014109347435*G0_2_1 - 0.00776014109347435*G0_2_2;
+    A[22] = 0.0183421516754845*G0_0_0 + 0.0183421516754845*G0_0_1 + 0.0183421516754846*G0_0_2 + 0.0183421516754848*G0_1_0 + 0.0183421516754845*G0_1_1 + 0.0183421516754847*G0_1_2 + 0.0183421516754848*G0_2_0 + 0.0183421516754846*G0_2_1 + 0.0183421516754847*G0_2_2;
+    A[23] = 0.018342151675485*G0_0_0 + 0.018342151675485*G0_0_1 + 0.0183421516754847*G0_0_2 + 0.0183421516754849*G0_1_0 + 0.0183421516754851*G0_1_1 + 0.0183421516754849*G0_1_2 + 0.0183421516754849*G0_2_0 + 0.0183421516754851*G0_2_1 + 0.0183421516754849*G0_2_2;
+    A[24] = 0.0183421516754851*G0_0_0 + 0.0183421516754849*G0_0_1 + 0.0183421516754851*G0_0_2 + 0.0183421516754851*G0_1_0 + 0.018342151675485*G0_1_1 + 0.0183421516754851*G0_1_2 + 0.018342151675485*G0_2_0 + 0.018342151675485*G0_2_1 + 0.0183421516754851*G0_2_2;
+    A[25] = 0.0493827160493822*G0_0_0 + 0.0423280423280418*G0_0_1 + 0.0423280423280418*G0_0_2 + 0.0493827160493824*G0_1_0 + 0.0423280423280419*G0_1_1 + 0.0423280423280418*G0_1_2 + 0.0493827160493823*G0_2_0 + 0.0423280423280419*G0_2_1 + 0.0423280423280419*G0_2_2;
+    A[26] = -0.018342151675485*G0_0_0 - 0.0253968253968251*G0_0_1 - 0.0253968253968252*G0_0_2 - 0.0183421516754849*G0_1_0 - 0.0253968253968252*G0_1_1 - 0.0253968253968253*G0_1_2 - 0.0183421516754849*G0_2_0 - 0.0253968253968251*G0_2_1 - 0.0253968253968252*G0_2_2;
+    A[27] = -0.0183421516754851*G0_0_0 - 0.0253968253968252*G0_0_1 - 0.0253968253968252*G0_0_2 - 0.0183421516754851*G0_1_0 - 0.0253968253968252*G0_1_1 - 0.0253968253968252*G0_1_2 - 0.018342151675485*G0_2_0 - 0.0253968253968252*G0_2_1 - 0.0253968253968251*G0_2_2;
+    A[28] = 0.0423280423280416*G0_0_0 + 0.0493827160493821*G0_0_1 + 0.0423280423280417*G0_0_2 + 0.0423280423280415*G0_1_0 + 0.0493827160493821*G0_1_1 + 0.0423280423280418*G0_1_2 + 0.0423280423280416*G0_2_0 + 0.0493827160493822*G0_2_1 + 0.0423280423280418*G0_2_2;
+    A[29] = -0.0253968253968249*G0_0_0 - 0.0183421516754845*G0_0_1 - 0.0253968253968249*G0_0_2 - 0.0253968253968247*G0_1_0 - 0.0183421516754845*G0_1_1 - 0.0253968253968248*G0_1_2 - 0.0253968253968248*G0_2_0 - 0.0183421516754846*G0_2_1 - 0.0253968253968249*G0_2_2;
+    A[30] = -0.025396825396825*G0_0_0 - 0.018342151675485*G0_0_1 - 0.0253968253968252*G0_0_2 - 0.025396825396825*G0_1_0 - 0.018342151675485*G0_1_1 - 0.0253968253968252*G0_1_2 - 0.0253968253968251*G0_2_0 - 0.018342151675485*G0_2_1 - 0.0253968253968252*G0_2_2;
+    A[31] = 0.0423280423280417*G0_0_0 + 0.0423280423280418*G0_0_1 + 0.0493827160493822*G0_0_2 + 0.0423280423280417*G0_1_0 + 0.042328042328042*G0_1_1 + 0.0493827160493823*G0_1_2 + 0.0423280423280418*G0_2_0 + 0.042328042328042*G0_2_1 + 0.0493827160493823*G0_2_2;
+    A[32] = -0.0253968253968251*G0_0_0 - 0.0253968253968249*G0_0_1 - 0.0183421516754845*G0_0_2 - 0.0253968253968249*G0_1_0 - 0.025396825396825*G0_1_1 - 0.0183421516754847*G0_1_2 - 0.025396825396825*G0_2_0 - 0.025396825396825*G0_2_1 - 0.0183421516754847*G0_2_2;
+    A[33] = -0.0253968253968248*G0_0_0 - 0.0253968253968251*G0_0_1 - 0.0183421516754847*G0_0_2 - 0.0253968253968251*G0_1_0 - 0.0253968253968253*G0_1_1 - 0.0183421516754848*G0_1_2 - 0.025396825396825*G0_2_0 - 0.0253968253968252*G0_2_1 - 0.0183421516754848*G0_2_2;
+    A[34] = -0.0677248677248668*G0_0_0 - 0.0677248677248671*G0_0_1 - 0.0677248677248673*G0_0_2 - 0.0677248677248671*G0_1_0 - 0.0677248677248672*G0_1_1 - 0.0677248677248674*G0_1_2 - 0.0677248677248672*G0_2_0 - 0.0677248677248673*G0_2_1 - 0.0677248677248675*G0_2_2;
+    A[35] = 0.00511463844797179*G0_0_0 + 0.0051146384479718*G0_0_1 + 0.0051146384479718*G0_0_2;
     A[36] = 0.0379188712522047*G0_0_0;
     A[37] = -0.00511463844797178*G0_0_1;
     A[38] = -0.00511463844797181*G0_0_2;
-    A[39] = -0.00776014109347457*G0_0_1 - 0.00776014109347449*G0_0_2;
-    A[40] = -0.00511463844797169*G0_0_1 - 0.00511463844797175*G0_0_2;
-    A[41] = -0.00776014109347453*G0_0_1 - 0.00776014109347442*G0_0_2;
-    A[42] = -0.0246913580246915*G0_0_0 + 0.0458553791887127*G0_0_2;
-    A[43] = 0.0202821869488538*G0_0_0 - 0.0326278659611995*G0_0_2;
-    A[44] = -0.00776014109347455*G0_0_0 + 0.017636684303351*G0_0_2;
+    A[39] = -0.00776014109347454*G0_0_1 - 0.00776014109347448*G0_0_2;
+    A[40] = -0.0051146384479717*G0_0_1 - 0.00511463844797177*G0_0_2;
+    A[41] = -0.00776014109347454*G0_0_1 - 0.00776014109347443*G0_0_2;
+    A[42] = -0.0246913580246916*G0_0_0 + 0.0458553791887126*G0_0_2;
+    A[43] = 0.0202821869488538*G0_0_0 - 0.0326278659611994*G0_0_2;
+    A[44] = -0.00776014109347458*G0_0_0 + 0.017636684303351*G0_0_2;
     A[45] = -0.0246913580246915*G0_0_0 + 0.0458553791887126*G0_0_1;
     A[46] = 0.0202821869488536*G0_0_0 - 0.0326278659611995*G0_0_1;
-    A[47] = -0.00776014109347453*G0_0_0 + 0.017636684303351*G0_0_1;
-    A[48] = 0.00776014109347461*G0_0_0 + 0.0077601410934746*G0_0_1;
+    A[47] = -0.00776014109347453*G0_0_0 + 0.0176366843033509*G0_0_1;
+    A[48] = 0.00776014109347463*G0_0_0 + 0.00776014109347458*G0_0_1;
     A[49] = 0.0051146384479717*G0_0_0 + 0.0051146384479717*G0_0_1;
-    A[50] = 0.00776014109347455*G0_0_0 + 0.00776014109347454*G0_0_1;
-    A[51] = 0.00776014109347462*G0_0_0 + 0.0077601410934746*G0_0_2;
-    A[52] = 0.00511463844797157*G0_0_0 + 0.00511463844797163*G0_0_2;
-    A[53] = 0.00776014109347452*G0_0_0 + 0.00776014109347452*G0_0_2;
-    A[54] = -0.0253968253968255*G0_0_0 - 0.0176366843033509*G0_0_1 - 0.017636684303351*G0_0_2;
-    A[55] = 0.052910052910053*G0_0_0 + 0.0326278659611994*G0_0_1 + 0.0326278659611994*G0_0_2;
-    A[56] = -0.070546737213404*G0_0_0 - 0.0458553791887127*G0_0_1 - 0.0458553791887127*G0_0_2;
-    A[57] = 0.0493827160493826*G0_0_0 + 0.0070546737213402*G0_0_1 + 0.00705467372134018*G0_0_2;
-    A[58] = -0.0183421516754851*G0_0_0 + 0.00705467372134034*G0_0_1 + 0.00705467372134022*G0_0_2;
-    A[59] = -0.018342151675485*G0_0_0 + 0.00705467372134044*G0_0_1 + 0.00705467372134048*G0_0_2;
+    A[50] = 0.00776014109347457*G0_0_0 + 0.00776014109347455*G0_0_1;
+    A[51] = 0.0077601410934746*G0_0_0 + 0.00776014109347459*G0_0_2;
+    A[52] = 0.00511463844797157*G0_0_0 + 0.00511463844797162*G0_0_2;
+    A[53] = 0.00776014109347452*G0_0_0 + 0.00776014109347453*G0_0_2;
+    A[54] = -0.0253968253968254*G0_0_0 - 0.0176366843033509*G0_0_1 - 0.0176366843033509*G0_0_2;
+    A[55] = 0.0529100529100529*G0_0_0 + 0.0326278659611993*G0_0_1 + 0.0326278659611993*G0_0_2;
+    A[56] = -0.070546737213404*G0_0_0 - 0.0458553791887126*G0_0_1 - 0.0458553791887127*G0_0_2;
+    A[57] = 0.0493827160493826*G0_0_0 + 0.00705467372134017*G0_0_1 + 0.0070546737213402*G0_0_2;
+    A[58] = -0.0183421516754851*G0_0_0 + 0.00705467372134032*G0_0_1 + 0.00705467372134024*G0_0_2;
+    A[59] = -0.018342151675485*G0_0_0 + 0.00705467372134048*G0_0_1 + 0.00705467372134043*G0_0_2;
     A[60] = 0.0183421516754848*G0_0_0;
     A[61] = 0.0183421516754851*G0_0_0;
-    A[62] = 0.0183421516754849*G0_0_0;
-    A[63] = -0.0253968253968256*G0_0_0 - 0.00705467372134052*G0_0_1;
-    A[64] = 0.0423280423280425*G0_0_0 - 0.0070546737213401*G0_0_1;
-    A[65] = -0.0253968253968255*G0_0_0 - 0.00705467372134043*G0_0_1;
-    A[66] = -0.0253968253968257*G0_0_0 - 0.00705467372134064*G0_0_2;
-    A[67] = 0.0423280423280425*G0_0_0 - 0.00705467372134*G0_0_2;
-    A[68] = -0.0253968253968252*G0_0_0 - 0.00705467372134023*G0_0_2;
+    A[62] = 0.018342151675485*G0_0_0;
+    A[63] = -0.0253968253968256*G0_0_0 - 0.00705467372134057*G0_0_1;
+    A[64] = 0.0423280423280427*G0_0_0 - 0.00705467372134003*G0_0_1;
+    A[65] = -0.0253968253968255*G0_0_0 - 0.00705467372134045*G0_0_1;
+    A[66] = -0.0253968253968256*G0_0_0 - 0.00705467372134058*G0_0_2;
+    A[67] = 0.0423280423280425*G0_0_0 - 0.00705467372134005*G0_0_2;
+    A[68] = -0.0253968253968252*G0_0_0 - 0.00705467372134024*G0_0_2;
     A[69] = -0.0677248677248674*G0_0_0;
-    A[70] = 0.00511463844797183*G0_1_0 + 0.00511463844797183*G0_1_1 + 0.00511463844797184*G0_1_2;
+    A[70] = 0.00511463844797184*G0_1_0 + 0.00511463844797182*G0_1_1 + 0.00511463844797184*G0_1_2;
     A[71] = -0.00511463844797178*G0_1_0;
     A[72] = 0.0379188712522047*G0_1_1;
     A[73] = -0.00511463844797181*G0_1_2;
-    A[74] = -0.0246913580246915*G0_1_1 + 0.0458553791887124*G0_1_2;
-    A[75] = 0.0202821869488536*G0_1_1 - 0.0326278659611993*G0_1_2;
-    A[76] = -0.00776014109347463*G0_1_1 + 0.0176366843033507*G0_1_2;
-    A[77] = -0.00776014109347451*G0_1_0 - 0.0077601410934745*G0_1_2;
-    A[78] = -0.00511463844797162*G0_1_0 - 0.00511463844797175*G0_1_2;
-    A[79] = -0.00776014109347465*G0_1_0 - 0.0077601410934745*G0_1_2;
-    A[80] = 0.017636684303351*G0_1_0 - 0.00776014109347445*G0_1_1;
-    A[81] = -0.0326278659611994*G0_1_0 + 0.0202821869488538*G0_1_1;
-    A[82] = 0.0458553791887126*G0_1_0 - 0.0246913580246915*G0_1_1;
-    A[83] = 0.00776014109347454*G0_1_0 + 0.0077601410934745*G0_1_1;
-    A[84] = 0.00511463844797157*G0_1_0 + 0.00511463844797162*G0_1_1;
-    A[85] = 0.00776014109347464*G0_1_0 + 0.00776014109347464*G0_1_1;
+    A[74] = -0.0246913580246915*G0_1_1 + 0.0458553791887125*G0_1_2;
+    A[75] = 0.0202821869488537*G0_1_1 - 0.0326278659611993*G0_1_2;
+    A[76] = -0.00776014109347461*G0_1_1 + 0.0176366843033508*G0_1_2;
+    A[77] = -0.00776014109347454*G0_1_0 - 0.0077601410934745*G0_1_2;
+    A[78] = -0.00511463844797162*G0_1_0 - 0.00511463844797172*G0_1_2;
+    A[79] = -0.00776014109347464*G0_1_0 - 0.00776014109347453*G0_1_2;
+    A[80] = 0.0176366843033511*G0_1_0 - 0.00776014109347448*G0_1_1;
+    A[81] = -0.0326278659611995*G0_1_0 + 0.0202821869488538*G0_1_1;
+    A[82] = 0.0458553791887127*G0_1_0 - 0.0246913580246915*G0_1_1;
+    A[83] = 0.0077601410934745*G0_1_0 + 0.00776014109347451*G0_1_1;
+    A[84] = 0.0051146384479716*G0_1_0 + 0.00511463844797163*G0_1_1;
+    A[85] = 0.00776014109347462*G0_1_0 + 0.00776014109347462*G0_1_1;
     A[86] = -0.017636684303351*G0_1_0 - 0.0253968253968255*G0_1_1 - 0.017636684303351*G0_1_2;
     A[87] = 0.0326278659611995*G0_1_0 + 0.0529100529100532*G0_1_1 + 0.0326278659611994*G0_1_2;
-    A[88] = -0.0458553791887127*G0_1_0 - 0.0705467372134041*G0_1_1 - 0.0458553791887126*G0_1_2;
-    A[89] = 0.00776014109347447*G0_1_1 + 0.00776014109347451*G0_1_2;
-    A[90] = 0.00511463844797182*G0_1_1 + 0.00511463844797183*G0_1_2;
-    A[91] = 0.00776014109347445*G0_1_1 + 0.00776014109347452*G0_1_2;
-    A[92] = 0.00705467372134046*G0_1_0 - 0.018342151675485*G0_1_1 + 0.00705467372134054*G0_1_2;
-    A[93] = 0.00705467372134021*G0_1_0 + 0.0493827160493826*G0_1_1 + 0.00705467372134027*G0_1_2;
-    A[94] = 0.00705467372134022*G0_1_0 - 0.0183421516754851*G0_1_1 + 0.0070546737213403*G0_1_2;
-    A[95] = -0.00705467372134036*G0_1_0 - 0.0253968253968254*G0_1_1;
-    A[96] = -0.00705467372134018*G0_1_0 + 0.0423280423280424*G0_1_1;
-    A[97] = -0.00705467372134022*G0_1_0 - 0.0253968253968253*G0_1_1;
+    A[88] = -0.0458553791887127*G0_1_0 - 0.0705467372134042*G0_1_1 - 0.0458553791887127*G0_1_2;
+    A[89] = 0.00776014109347448*G0_1_1 + 0.0077601410934745*G0_1_2;
+    A[90] = 0.0051146384479718*G0_1_1 + 0.00511463844797182*G0_1_2;
+    A[91] = 0.00776014109347443*G0_1_1 + 0.00776014109347452*G0_1_2;
+    A[92] = 0.00705467372134042*G0_1_0 - 0.018342151675485*G0_1_1 + 0.00705467372134047*G0_1_2;
+    A[93] = 0.00705467372134015*G0_1_0 + 0.0493827160493826*G0_1_1 + 0.00705467372134023*G0_1_2;
+    A[94] = 0.00705467372134028*G0_1_0 - 0.0183421516754851*G0_1_1 + 0.00705467372134038*G0_1_2;
+    A[95] = -0.00705467372134042*G0_1_0 - 0.0253968253968254*G0_1_1;
+    A[96] = -0.00705467372134012*G0_1_0 + 0.0423280423280424*G0_1_1;
+    A[97] = -0.00705467372134029*G0_1_0 - 0.0253968253968253*G0_1_1;
     A[98] = 0.0183421516754851*G0_1_1;
     A[99] = 0.0183421516754849*G0_1_1;
-    A[100] = 0.0183421516754851*G0_1_1;
-    A[101] = -0.0253968253968254*G0_1_1 - 0.00705467372134026*G0_1_2;
-    A[102] = -0.0253968253968256*G0_1_1 - 0.00705467372134067*G0_1_2;
-    A[103] = 0.0423280423280425*G0_1_1 - 0.00705467372134018*G0_1_2;
-    A[104] = -0.0677248677248675*G0_1_1;
-    A[105] = 0.00511463844797182*G0_2_0 + 0.0051146384479718*G0_2_1 + 0.00511463844797181*G0_2_2;
+    A[100] = 0.018342151675485*G0_1_1;
+    A[101] = -0.0253968253968254*G0_1_1 - 0.00705467372134031*G0_1_2;
+    A[102] = -0.0253968253968255*G0_1_1 - 0.00705467372134062*G0_1_2;
+    A[103] = 0.0423280423280425*G0_1_1 - 0.00705467372134015*G0_1_2;
+    A[104] = -0.0677248677248676*G0_1_1;
+    A[105] = 0.00511463844797182*G0_2_0 + 0.00511463844797181*G0_2_1 + 0.00511463844797181*G0_2_2;
     A[106] = -0.00511463844797181*G0_2_0;
     A[107] = -0.00511463844797181*G0_2_1;
     A[108] = 0.0379188712522047*G0_2_2;
-    A[109] = 0.0176366843033511*G0_2_1 - 0.00776014109347436*G0_2_2;
-    A[110] = -0.0326278659611995*G0_2_1 + 0.0202821869488534*G0_2_2;
-    A[111] = 0.0458553791887128*G0_2_1 - 0.0246913580246912*G0_2_2;
-    A[112] = 0.0176366843033511*G0_2_0 - 0.00776014109347442*G0_2_2;
-    A[113] = -0.0326278659611998*G0_2_0 + 0.0202821869488535*G0_2_2;
-    A[114] = 0.0458553791887129*G0_2_0 - 0.0246913580246912*G0_2_2;
-    A[115] = -0.00776014109347449*G0_2_0 - 0.00776014109347447*G0_2_1;
-    A[116] = -0.00511463844797172*G0_2_0 - 0.00511463844797169*G0_2_1;
-    A[117] = -0.00776014109347452*G0_2_0 - 0.00776014109347452*G0_2_1;
+    A[109] = 0.0176366843033511*G0_2_1 - 0.00776014109347435*G0_2_2;
+    A[110] = -0.0326278659611996*G0_2_1 + 0.0202821869488534*G0_2_2;
+    A[111] = 0.0458553791887129*G0_2_1 - 0.0246913580246912*G0_2_2;
+    A[112] = 0.0176366843033511*G0_2_0 - 0.00776014109347437*G0_2_2;
+    A[113] = -0.0326278659611999*G0_2_0 + 0.0202821869488534*G0_2_2;
+    A[114] = 0.0458553791887131*G0_2_0 - 0.0246913580246912*G0_2_2;
+    A[115] = -0.00776014109347445*G0_2_0 - 0.00776014109347444*G0_2_1;
+    A[116] = -0.00511463844797171*G0_2_0 - 0.0051146384479717*G0_2_1;
+    A[117] = -0.0077601410934745*G0_2_0 - 0.0077601410934745*G0_2_1;
     A[118] = -0.0176366843033511*G0_2_0 - 0.0176366843033511*G0_2_1 - 0.0253968253968255*G0_2_2;
-    A[119] = 0.0326278659611998*G0_2_0 + 0.0326278659611997*G0_2_1 + 0.0529100529100531*G0_2_2;
-    A[120] = -0.0458553791887129*G0_2_0 - 0.0458553791887129*G0_2_1 - 0.0705467372134041*G0_2_2;
-    A[121] = 0.00776014109347446*G0_2_0 + 0.00776014109347441*G0_2_2;
-    A[122] = 0.00511463844797174*G0_2_0 + 0.00511463844797175*G0_2_2;
-    A[123] = 0.00776014109347452*G0_2_0 + 0.0077601410934745*G0_2_2;
-    A[124] = 0.00776014109347447*G0_2_1 + 0.00776014109347446*G0_2_2;
+    A[119] = 0.0326278659611998*G0_2_0 + 0.0326278659611997*G0_2_1 + 0.0529100529100532*G0_2_2;
+    A[120] = -0.045855379188713*G0_2_0 - 0.045855379188713*G0_2_1 - 0.0705467372134041*G0_2_2;
+    A[121] = 0.00776014109347446*G0_2_0 + 0.0077601410934744*G0_2_2;
+    A[122] = 0.00511463844797173*G0_2_0 + 0.00511463844797175*G0_2_2;
+    A[123] = 0.00776014109347452*G0_2_0 + 0.00776014109347449*G0_2_2;
+    A[124] = 0.00776014109347445*G0_2_1 + 0.00776014109347444*G0_2_2;
     A[125] = 0.00511463844797175*G0_2_1 + 0.00511463844797173*G0_2_2;
-    A[126] = 0.00776014109347447*G0_2_1 + 0.00776014109347445*G0_2_2;
-    A[127] = 0.00705467372134043*G0_2_0 + 0.00705467372134027*G0_2_1 - 0.018342151675485*G0_2_2;
-    A[128] = 0.00705467372134035*G0_2_0 + 0.0070546737213405*G0_2_1 - 0.018342151675485*G0_2_2;
-    A[129] = 0.0070546737213402*G0_2_0 + 0.00705467372134007*G0_2_1 + 0.0493827160493825*G0_2_2;
-    A[130] = -0.00705467372134044*G0_2_0 - 0.0253968253968253*G0_2_2;
-    A[131] = -0.00705467372134037*G0_2_0 - 0.0253968253968254*G0_2_2;
-    A[132] = -0.00705467372134019*G0_2_0 + 0.0423280423280422*G0_2_2;
-    A[133] = -0.00705467372134044*G0_2_1 - 0.0253968253968254*G0_2_2;
+    A[126] = 0.00776014109347445*G0_2_1 + 0.00776014109347441*G0_2_2;
+    A[127] = 0.00705467372134044*G0_2_0 + 0.00705467372134026*G0_2_1 - 0.0183421516754849*G0_2_2;
+    A[128] = 0.00705467372134037*G0_2_0 + 0.00705467372134053*G0_2_1 - 0.018342151675485*G0_2_2;
+    A[129] = 0.00705467372134021*G0_2_0 + 0.00705467372134008*G0_2_1 + 0.0493827160493824*G0_2_2;
+    A[130] = -0.0070546737213404*G0_2_0 - 0.0253968253968253*G0_2_2;
+    A[131] = -0.00705467372134039*G0_2_0 - 0.0253968253968254*G0_2_2;
+    A[132] = -0.00705467372134021*G0_2_0 + 0.0423280423280422*G0_2_2;
+    A[133] = -0.00705467372134049*G0_2_1 - 0.0253968253968254*G0_2_2;
     A[134] = -0.00705467372134028*G0_2_1 - 0.0253968253968252*G0_2_2;
-    A[135] = -0.0070546737213401*G0_2_1 + 0.0423280423280422*G0_2_2;
+    A[135] = -0.00705467372134011*G0_2_1 + 0.0423280423280422*G0_2_2;
     A[136] = 0.018342151675485*G0_2_2;
     A[137] = 0.0183421516754849*G0_2_2;
     A[138] = 0.018342151675485*G0_2_2;
     A[139] = -0.0677248677248675*G0_2_2;
-    A[140] = 0.00776014109347438*G0_1_0 + 0.00776014109347437*G0_1_1 + 0.00776014109347438*G0_1_2 + 0.00776014109347441*G0_2_0 + 0.00776014109347441*G0_2_1 + 0.00776014109347445*G0_2_2;
-    A[141] = -0.00776014109347457*G0_1_0 - 0.00776014109347449*G0_2_0;
-    A[142] = -0.0246913580246915*G0_1_1 + 0.0458553791887124*G0_2_1;
-    A[143] = 0.0176366843033511*G0_1_2 - 0.00776014109347436*G0_2_2;
+    A[140] = 0.00776014109347435*G0_1_0 + 0.00776014109347434*G0_1_1 + 0.00776014109347434*G0_1_2 + 0.00776014109347441*G0_2_0 + 0.00776014109347439*G0_2_1 + 0.00776014109347442*G0_2_2;
+    A[141] = -0.00776014109347454*G0_1_0 - 0.00776014109347448*G0_2_0;
+    A[142] = -0.0246913580246915*G0_1_1 + 0.0458553791887125*G0_2_1;
+    A[143] = 0.0176366843033511*G0_1_2 - 0.00776014109347435*G0_2_2;
     A[144] = 0.203174603174603*G0_1_1 + 0.079012345679012*G0_1_2 + 0.079012345679012*G0_2_1 + 0.158024691358024*G0_2_2;
-    A[145] = -0.118518518518519*G0_1_1 + 0.0423280423280418*G0_1_2 - 0.0310405643738976*G0_2_1 - 0.0902998236331564*G0_2_2;
-    A[146] = 0.0451499118165792*G0_1_1 - 0.0338624338624334*G0_1_2 + 0.0112874779541449*G0_2_1 + 0.0451499118165782*G0_2_2;
-    A[147] = 0.0225749559082898*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.011287477954145*G0_2_0 + 0.0112874779541447*G0_2_2;
-    A[148] = 0.0169312169312161*G0_1_0 + 0.0141093474426809*G0_1_2 + 0.00282186948853578*G0_2_0 + 0.002821869488536*G0_2_2;
-    A[149] = 0.0451499118165792*G0_1_0 + 0.033862433862434*G0_1_2 + 0.0112874779541449*G0_2_0 + 0.0112874779541448*G0_2_2;
-    A[150] = 0.0338624338624341*G0_1_0 + 0.0112874779541449*G0_1_1 + 0.0451499118165789*G0_2_0 + 0.0112874779541451*G0_2_1;
-    A[151] = -0.0592592592592597*G0_1_0 - 0.0423280423280428*G0_1_1 - 0.0902998236331577*G0_2_0 - 0.031040564373898*G0_2_1;
-    A[152] = 0.0790123456790129*G0_1_0 + 0.101587301587302*G0_1_1 + 0.158024691358025*G0_2_0 + 0.0790123456790123*G0_2_1;
-    A[153] = -0.0225749559082895*G0_1_0 - 0.0225749559082894*G0_1_1 - 0.0112874779541447*G0_1_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541447*G0_2_1;
-    A[154] = -0.0169312169312166*G0_1_0 - 0.0169312169312166*G0_1_1 - 0.00282186948853587*G0_1_2 - 0.00282186948853626*G0_2_0 - 0.00282186948853619*G0_2_1;
-    A[155] = -0.0451499118165792*G0_1_0 - 0.0451499118165792*G0_1_1 - 0.011287477954145*G0_1_2 - 0.0112874779541448*G0_2_0 - 0.0112874779541449*G0_2_1;
-    A[156] = -0.0338624338624338*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0338624338624336*G0_1_2 - 0.0451499118165787*G0_2_0 - 0.0338624338624338*G0_2_1 - 0.0451499118165784*G0_2_2;
-    A[157] = 0.0592592592592595*G0_1_0 + 0.0169312169312165*G0_1_1 + 0.059259259259259*G0_1_2 + 0.0902998236331576*G0_2_0 + 0.0592592592592594*G0_2_1 + 0.0902998236331571*G0_2_2;
-    A[158] = -0.0790123456790129*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.0790123456790125*G0_1_2 - 0.158024691358025*G0_2_0 - 0.0790123456790127*G0_2_1 - 0.158024691358025*G0_2_2;
-    A[159] = -0.0112874779541446*G0_1_1 - 0.0112874779541445*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0112874779541445*G0_2_2;
-    A[160] = -0.0028218694885363*G0_1_1 - 0.00282186948853619*G0_1_2 - 0.00282186948853627*G0_2_1 - 0.00282186948853612*G0_2_2;
-    A[161] = -0.0112874779541447*G0_1_1 - 0.0112874779541446*G0_1_2 - 0.0112874779541449*G0_2_1 - 0.0112874779541447*G0_2_2;
-    A[162] = -0.0677248677248682*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.0338624338624341*G0_1_2 - 0.0225749559082897*G0_2_0 + 0.0112874779541448*G0_2_1 - 0.0225749559082889*G0_2_2;
-    A[163] = 0.203174603174603*G0_1_0 - 0.067724867724868*G0_1_1 + 0.101587301587302*G0_1_2 + 0.112874779541446*G0_2_0 + 0.0112874779541444*G0_2_1 + 0.112874779541446*G0_2_2;
-    A[164] = -0.0677248677248673*G0_1_0 + 0.0677248677248677*G0_1_1 - 0.0338624338624341*G0_1_2 - 0.0225749559082884*G0_2_0 + 0.011287477954145*G0_2_1 - 0.0225749559082889*G0_2_2;
-    A[165] = 0.067724867724868*G0_1_0 + 0.090299823633157*G0_1_1 + 0.0338624338624334*G0_1_2 + 0.0225749559082894*G0_2_0 + 0.0338624338624339*G0_2_1;
-    A[166] = -0.203174603174603*G0_1_0 - 0.270899470899471*G0_1_1 - 0.1015873015873*G0_1_2 - 0.112874779541446*G0_2_0 - 0.101587301587302*G0_2_1;
-    A[167] = 0.0677248677248673*G0_1_0 + 0.135449735449735*G0_1_1 + 0.0338624338624332*G0_1_2 + 0.0225749559082885*G0_2_0 + 0.0338624338624338*G0_2_1;
-    A[168] = -0.0225749559082895*G0_1_1 - 0.0112874779541451*G0_1_2 - 0.011287477954145*G0_2_1;
+    A[145] = -0.118518518518519*G0_1_1 + 0.0423280423280419*G0_1_2 - 0.0310405643738975*G0_2_1 - 0.0902998236331564*G0_2_2;
+    A[146] = 0.045149911816579*G0_1_1 - 0.0338624338624336*G0_1_2 + 0.0112874779541449*G0_2_1 + 0.0451499118165782*G0_2_2;
+    A[147] = 0.0225749559082897*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.0112874779541448*G0_2_0 + 0.0112874779541447*G0_2_2;
+    A[148] = 0.0169312169312162*G0_1_0 + 0.0141093474426809*G0_1_2 + 0.00282186948853584*G0_2_0 + 0.00282186948853616*G0_2_2;
+    A[149] = 0.0451499118165791*G0_1_0 + 0.0338624338624338*G0_1_2 + 0.0112874779541449*G0_2_0 + 0.0112874779541445*G0_2_2;
+    A[150] = 0.033862433862434*G0_1_0 + 0.0112874779541449*G0_1_1 + 0.0451499118165789*G0_2_0 + 0.011287477954145*G0_2_1;
+    A[151] = -0.0592592592592598*G0_1_0 - 0.0423280423280428*G0_1_1 - 0.0902998236331577*G0_2_0 - 0.0310405643738979*G0_2_1;
+    A[152] = 0.0790123456790129*G0_1_0 + 0.101587301587302*G0_1_1 + 0.158024691358025*G0_2_0 + 0.0790123456790122*G0_2_1;
+    A[153] = -0.0225749559082895*G0_1_0 - 0.0225749559082894*G0_1_1 - 0.0112874779541446*G0_1_2 - 0.0112874779541448*G0_2_0 - 0.0112874779541447*G0_2_1;
+    A[154] = -0.0169312169312166*G0_1_0 - 0.0169312169312166*G0_1_1 - 0.00282186948853599*G0_1_2 - 0.00282186948853617*G0_2_0 - 0.00282186948853618*G0_2_1;
+    A[155] = -0.0451499118165791*G0_1_0 - 0.0451499118165791*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.0112874779541448*G0_2_0 - 0.0112874779541449*G0_2_1;
+    A[156] = -0.0338624338624339*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0338624338624336*G0_1_2 - 0.0451499118165788*G0_2_0 - 0.0338624338624337*G0_2_1 - 0.0451499118165785*G0_2_2;
+    A[157] = 0.0592592592592596*G0_1_0 + 0.0169312169312164*G0_1_1 + 0.0592592592592591*G0_1_2 + 0.0902998236331577*G0_2_0 + 0.0592592592592593*G0_2_1 + 0.0902998236331571*G0_2_2;
+    A[158] = -0.0790123456790129*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.0790123456790126*G0_1_2 - 0.158024691358025*G0_2_0 - 0.0790123456790126*G0_2_1 - 0.158024691358025*G0_2_2;
+    A[159] = -0.0112874779541446*G0_1_1 - 0.0112874779541445*G0_1_2 - 0.0112874779541447*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[160] = -0.00282186948853632*G0_1_1 - 0.00282186948853618*G0_1_2 - 0.00282186948853629*G0_2_1 - 0.00282186948853609*G0_2_2;
+    A[161] = -0.0112874779541448*G0_1_1 - 0.0112874779541447*G0_1_2 - 0.011287477954145*G0_2_1 - 0.0112874779541447*G0_2_2;
+    A[162] = -0.0677248677248682*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.0338624338624341*G0_1_2 - 0.0225749559082897*G0_2_0 + 0.0112874779541448*G0_2_1 - 0.022574955908289*G0_2_2;
+    A[163] = 0.203174603174603*G0_1_0 - 0.0677248677248679*G0_1_1 + 0.101587301587302*G0_1_2 + 0.112874779541446*G0_2_0 + 0.0112874779541444*G0_2_1 + 0.112874779541446*G0_2_2;
+    A[164] = -0.0677248677248674*G0_1_0 + 0.0677248677248676*G0_1_1 - 0.033862433862434*G0_1_2 - 0.0225749559082884*G0_2_0 + 0.0112874779541449*G0_2_1 - 0.0225749559082887*G0_2_2;
+    A[165] = 0.0677248677248679*G0_1_0 + 0.0902998236331571*G0_1_1 + 0.0338624338624334*G0_1_2 + 0.0225749559082891*G0_2_0 + 0.0338624338624339*G0_2_1;
+    A[166] = -0.203174603174603*G0_1_0 - 0.270899470899471*G0_1_1 - 0.101587301587301*G0_1_2 - 0.112874779541446*G0_2_0 - 0.101587301587302*G0_2_1;
+    A[167] = 0.0677248677248675*G0_1_0 + 0.135449735449735*G0_1_1 + 0.0338624338624335*G0_1_2 + 0.0225749559082884*G0_2_0 + 0.0338624338624337*G0_2_1;
+    A[168] = -0.0225749559082897*G0_1_1 - 0.0112874779541451*G0_1_2 - 0.0112874779541451*G0_2_1;
     A[169] = -0.0225749559082895*G0_1_1 - 0.0112874779541445*G0_1_2 - 0.011287477954145*G0_2_1;
-    A[170] = -0.0677248677248677*G0_1_1 - 0.0112874779541445*G0_1_2 - 0.0112874779541449*G0_2_1;
-    A[171] = 0.0451499118165787*G0_1_1 + 0.033862433862434*G0_1_2 + 0.0338624338624341*G0_2_1 + 0.0225749559082893*G0_2_2;
-    A[172] = 0.0451499118165788*G0_1_1 + 0.0338624338624337*G0_1_2 + 0.033862433862434*G0_2_1 + 0.0225749559082885*G0_2_2;
+    A[170] = -0.0677248677248676*G0_1_1 - 0.0112874779541443*G0_1_2 - 0.0112874779541449*G0_2_1;
+    A[171] = 0.0451499118165788*G0_1_1 + 0.033862433862434*G0_1_2 + 0.0338624338624341*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[172] = 0.045149911816579*G0_1_1 + 0.0338624338624337*G0_1_2 + 0.0338624338624342*G0_2_1 + 0.0225749559082885*G0_2_2;
     A[173] = -0.135449735449736*G0_1_1 - 0.101587301587302*G0_1_2 - 0.101587301587301*G0_2_1 - 0.112874779541445*G0_2_2;
-    A[174] = 0.0902998236331579*G0_1_1;
-    A[175] = 0.00511463844797173*G0_1_0 + 0.00511463844797174*G0_1_1 + 0.00511463844797173*G0_1_2 + 0.00511463844797174*G0_2_0 + 0.00511463844797172*G0_2_1 + 0.00511463844797169*G0_2_2;
-    A[176] = -0.00511463844797169*G0_1_0 - 0.00511463844797175*G0_2_0;
-    A[177] = 0.0202821869488536*G0_1_1 - 0.0326278659611993*G0_2_1;
-    A[178] = -0.0326278659611995*G0_1_2 + 0.0202821869488534*G0_2_2;
-    A[179] = -0.118518518518519*G0_1_1 - 0.0310405643738976*G0_1_2 + 0.0423280423280418*G0_2_1 - 0.0902998236331564*G0_2_2;
-    A[180] = 0.249735449735451*G0_1_1 + 0.0825396825396829*G0_1_2 + 0.0825396825396829*G0_2_1 + 0.249735449735449*G0_2_2;
-    A[181] = -0.0902998236331582*G0_1_1 + 0.0423280423280416*G0_1_2 - 0.0310405643738983*G0_2_1 - 0.118518518518518*G0_2_2;
-    A[182] = 0.0169312169312165*G0_1_0 + 0.00282186948853629*G0_1_2 + 0.0141093474426806*G0_2_0 + 0.00282186948853626*G0_2_2;
-    A[183] = -0.0211640211640202*G0_1_0 - 0.0105820105820107*G0_1_2 - 0.0105820105820103*G0_2_0 - 0.0134038800705466*G0_2_2;
-    A[184] = -0.0902998236331584*G0_1_0 - 0.0592592592592598*G0_1_2 - 0.0310405643738984*G0_2_0 - 0.0423280423280429*G0_2_2;
-    A[185] = 0.0141093474426808*G0_1_0 + 0.00282186948853616*G0_1_1 + 0.0169312169312167*G0_2_0 + 0.00282186948853603*G0_2_1;
-    A[186] = -0.0105820105820106*G0_1_0 - 0.0134038800705467*G0_1_1 - 0.0211640211640206*G0_2_0 - 0.0105820105820104*G0_2_1;
-    A[187] = -0.031040564373898*G0_1_0 - 0.0423280423280425*G0_1_1 - 0.0902998236331573*G0_2_0 - 0.0592592592592593*G0_2_1;
-    A[188] = -0.0169312169312165*G0_1_0 - 0.0169312169312165*G0_1_1 - 0.0141093474426804*G0_1_2 - 0.0141093474426806*G0_2_0 - 0.0141093474426805*G0_2_1 - 0.0112874779541443*G0_2_2;
-    A[189] = 0.0211640211640202*G0_1_0 + 0.0211640211640204*G0_1_1 + 0.0105820105820099*G0_1_2 + 0.0105820105820104*G0_2_0 + 0.0105820105820105*G0_2_1 - 0.00282186948853642*G0_2_2;
-    A[190] = 0.0902998236331583*G0_1_0 + 0.0902998236331583*G0_1_1 + 0.0310405643738984*G0_1_2 + 0.0310405643738984*G0_2_0 + 0.0310405643738984*G0_2_1 - 0.0112874779541444*G0_2_2;
-    A[191] = -0.0141093474426808*G0_1_0 - 0.0112874779541447*G0_1_1 - 0.0141093474426809*G0_1_2 - 0.0169312169312167*G0_2_0 - 0.0141093474426806*G0_2_1 - 0.0169312169312167*G0_2_2;
-    A[192] = 0.0105820105820106*G0_1_0 - 0.00282186948853602*G0_1_1 + 0.0105820105820107*G0_1_2 + 0.0211640211640207*G0_2_0 + 0.0105820105820102*G0_2_1 + 0.0211640211640207*G0_2_2;
-    A[193] = 0.031040564373898*G0_1_0 - 0.0112874779541447*G0_1_1 + 0.031040564373898*G0_1_2 + 0.0902998236331573*G0_2_0 + 0.031040564373898*G0_2_1 + 0.0902998236331573*G0_2_2;
-    A[194] = -0.00282186948853618*G0_1_1 - 0.00282186948853624*G0_1_2 - 0.00282186948853609*G0_2_1 - 0.00282186948853616*G0_2_2;
-    A[195] = -0.00917107583774259*G0_1_1 - 0.00917107583774262*G0_1_2 - 0.00917107583774252*G0_2_1 - 0.00917107583774262*G0_2_2;
-    A[196] = -0.00282186948853625*G0_1_1 - 0.00282186948853626*G0_1_2 - 0.00282186948853606*G0_2_1 - 0.00282186948853613*G0_2_2;
-    A[197] = -0.0846560846560847*G0_1_0 - 0.0169312169312171*G0_1_1 - 0.0197530864197533*G0_1_2 - 0.0846560846560841*G0_2_0 - 0.0197530864197531*G0_2_1 - 0.0169312169312172*G0_2_2;
-    A[198] = 0.0507936507936514*G0_1_0 + 0.118518518518519*G0_1_1 - 0.0423280423280425*G0_1_2 + 0.186243386243386*G0_2_0 + 0.0931216931216942*G0_2_1 - 0.084656084656084*G0_2_2;
-    A[199] = 0.186243386243386*G0_1_0 - 0.0846560846560853*G0_1_1 + 0.0931216931216936*G0_1_2 + 0.0507936507936498*G0_2_0 - 0.0423280423280435*G0_2_1 + 0.118518518518518*G0_2_2;
-    A[200] = 0.0846560846560851*G0_1_0 + 0.0677248677248678*G0_1_1 + 0.0649029982363315*G0_1_2 + 0.0846560846560849*G0_2_0 + 0.0649029982363313*G0_2_1 + 0.0677248677248675*G0_2_2;
-    A[201] = -0.0507936507936515*G0_1_0 + 0.0677248677248676*G0_1_1 - 0.0931216931216943*G0_1_2 - 0.186243386243386*G0_2_0 - 0.0931216931216924*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[202] = -0.186243386243386*G0_1_0 - 0.270899470899471*G0_1_1 - 0.0931216931216918*G0_1_2 - 0.0507936507936498*G0_2_0 - 0.0931216931216933*G0_2_1 + 0.0677248677248685*G0_2_2;
-    A[203] = 0.0169312169312173*G0_1_1 + 0.0197530864197536*G0_1_2 + 0.0197530864197536*G0_2_1 + 0.0225749559082897*G0_2_2;
-    A[204] = 0.0169312169312171*G0_1_1 + 0.0197530864197533*G0_1_2 + 0.0197530864197531*G0_2_1 + 0.0225749559082892*G0_2_2;
-    A[205] = 0.0846560846560852*G0_1_1 + 0.0423280423280422*G0_1_2 + 0.0423280423280433*G0_2_1 + 0.0225749559082892*G0_2_2;
-    A[206] = 0.0225749559082894*G0_1_1 + 0.0197530864197532*G0_1_2 + 0.019753086419753*G0_2_1 + 0.016931216931217*G0_2_2;
-    A[207] = 0.0225749559082895*G0_1_1 + 0.0197530864197532*G0_1_2 + 0.019753086419753*G0_2_1 + 0.0169312169312171*G0_2_2;
-    A[208] = 0.0225749559082893*G0_1_1 + 0.0423280423280423*G0_1_2 + 0.0423280423280423*G0_2_1 + 0.0846560846560839*G0_2_2;
+    A[174] = 0.0902998236331582*G0_1_1;
+    A[175] = 0.00511463844797179*G0_1_0 + 0.00511463844797176*G0_1_1 + 0.00511463844797176*G0_1_2 + 0.00511463844797175*G0_2_0 + 0.00511463844797175*G0_2_1 + 0.00511463844797172*G0_2_2;
+    A[176] = -0.0051146384479717*G0_1_0 - 0.00511463844797177*G0_2_0;
+    A[177] = 0.0202821869488537*G0_1_1 - 0.0326278659611993*G0_2_1;
+    A[178] = -0.0326278659611996*G0_1_2 + 0.0202821869488534*G0_2_2;
+    A[179] = -0.118518518518519*G0_1_1 - 0.0310405643738975*G0_1_2 + 0.0423280423280419*G0_2_1 - 0.0902998236331563*G0_2_2;
+    A[180] = 0.249735449735451*G0_1_1 + 0.0825396825396828*G0_1_2 + 0.0825396825396828*G0_2_1 + 0.249735449735449*G0_2_2;
+    A[181] = -0.0902998236331582*G0_1_1 + 0.0423280423280417*G0_1_2 - 0.0310405643738983*G0_2_1 - 0.118518518518518*G0_2_2;
+    A[182] = 0.0169312169312166*G0_1_0 + 0.00282186948853631*G0_1_2 + 0.0141093474426807*G0_2_0 + 0.00282186948853626*G0_2_2;
+    A[183] = -0.0211640211640202*G0_1_0 - 0.0105820105820106*G0_1_2 - 0.0105820105820104*G0_2_0 - 0.0134038800705467*G0_2_2;
+    A[184] = -0.0902998236331584*G0_1_0 - 0.0592592592592597*G0_1_2 - 0.0310405643738983*G0_2_0 - 0.0423280423280427*G0_2_2;
+    A[185] = 0.0141093474426808*G0_1_0 + 0.00282186948853619*G0_1_1 + 0.0169312169312167*G0_2_0 + 0.00282186948853605*G0_2_1;
+    A[186] = -0.0105820105820105*G0_1_0 - 0.0134038800705467*G0_1_1 - 0.0211640211640205*G0_2_0 - 0.0105820105820104*G0_2_1;
+    A[187] = -0.0310405643738979*G0_1_0 - 0.0423280423280425*G0_1_1 - 0.0902998236331573*G0_2_0 - 0.0592592592592592*G0_2_1;
+    A[188] = -0.0169312169312166*G0_1_0 - 0.0169312169312166*G0_1_1 - 0.0141093474426805*G0_1_2 - 0.0141093474426806*G0_2_0 - 0.0141093474426807*G0_2_1 - 0.0112874779541444*G0_2_2;
+    A[189] = 0.0211640211640203*G0_1_0 + 0.0211640211640204*G0_1_1 + 0.0105820105820099*G0_1_2 + 0.0105820105820104*G0_2_0 + 0.0105820105820105*G0_2_1 - 0.00282186948853625*G0_2_2;
+    A[190] = 0.0902998236331583*G0_1_0 + 0.0902998236331582*G0_1_1 + 0.0310405643738984*G0_1_2 + 0.0310405643738983*G0_2_0 + 0.0310405643738983*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[191] = -0.0141093474426808*G0_1_0 - 0.0112874779541448*G0_1_1 - 0.0141093474426809*G0_1_2 - 0.0169312169312167*G0_2_0 - 0.0141093474426807*G0_2_1 - 0.0169312169312168*G0_2_2;
+    A[192] = 0.0105820105820106*G0_1_0 - 0.00282186948853599*G0_1_1 + 0.0105820105820107*G0_1_2 + 0.0211640211640206*G0_2_0 + 0.0105820105820102*G0_2_1 + 0.0211640211640207*G0_2_2;
+    A[193] = 0.0310405643738979*G0_1_0 - 0.0112874779541447*G0_1_1 + 0.0310405643738979*G0_1_2 + 0.0902998236331573*G0_2_0 + 0.031040564373898*G0_2_1 + 0.0902998236331573*G0_2_2;
+    A[194] = -0.00282186948853627*G0_1_1 - 0.00282186948853631*G0_1_2 - 0.00282186948853613*G0_2_1 - 0.00282186948853619*G0_2_2;
+    A[195] = -0.00917107583774257*G0_1_1 - 0.0091710758377426*G0_1_2 - 0.00917107583774246*G0_2_1 - 0.00917107583774258*G0_2_2;
+    A[196] = -0.0028218694885362*G0_1_1 - 0.00282186948853622*G0_1_2 - 0.00282186948853601*G0_2_1 - 0.00282186948853613*G0_2_2;
+    A[197] = -0.0846560846560848*G0_1_0 - 0.0169312169312171*G0_1_1 - 0.0197530864197534*G0_1_2 - 0.0846560846560842*G0_2_0 - 0.0197530864197532*G0_2_1 - 0.0169312169312171*G0_2_2;
+    A[198] = 0.0507936507936515*G0_1_0 + 0.118518518518519*G0_1_1 - 0.0423280423280424*G0_1_2 + 0.186243386243387*G0_2_0 + 0.0931216931216941*G0_2_1 - 0.0846560846560839*G0_2_2;
+    A[199] = 0.186243386243386*G0_1_0 - 0.0846560846560851*G0_1_1 + 0.0931216931216936*G0_1_2 + 0.0507936507936499*G0_2_0 - 0.0423280423280434*G0_2_1 + 0.118518518518518*G0_2_2;
+    A[200] = 0.0846560846560851*G0_1_0 + 0.0677248677248679*G0_1_1 + 0.0649029982363316*G0_1_2 + 0.084656084656085*G0_2_0 + 0.0649029982363314*G0_2_1 + 0.0677248677248674*G0_2_2;
+    A[201] = -0.0507936507936515*G0_1_0 + 0.0677248677248676*G0_1_1 - 0.0931216931216941*G0_1_2 - 0.186243386243387*G0_2_0 - 0.0931216931216925*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[202] = -0.186243386243386*G0_1_0 - 0.270899470899471*G0_1_1 - 0.093121693121692*G0_1_2 - 0.0507936507936498*G0_2_0 - 0.0931216931216933*G0_2_1 + 0.0677248677248685*G0_2_2;
+    A[203] = 0.0169312169312176*G0_1_1 + 0.0197530864197538*G0_1_2 + 0.0197530864197537*G0_2_1 + 0.0225749559082898*G0_2_2;
+    A[204] = 0.016931216931217*G0_1_1 + 0.0197530864197533*G0_1_2 + 0.0197530864197531*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[205] = 0.084656084656085*G0_1_1 + 0.042328042328042*G0_1_2 + 0.0423280423280432*G0_2_1 + 0.0225749559082891*G0_2_2;
+    A[206] = 0.0225749559082895*G0_1_1 + 0.0197530864197533*G0_1_2 + 0.019753086419753*G0_2_1 + 0.0169312169312172*G0_2_2;
+    A[207] = 0.0225749559082893*G0_1_1 + 0.0197530864197531*G0_1_2 + 0.0197530864197529*G0_2_1 + 0.016931216931217*G0_2_2;
+    A[208] = 0.0225749559082893*G0_1_1 + 0.0423280423280422*G0_1_2 + 0.0423280423280424*G0_2_1 + 0.0846560846560837*G0_2_2;
     A[209] = -0.135449735449737*G0_1_1 - 0.112874779541447*G0_1_2 - 0.112874779541448*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[210] = 0.0077601410934745*G0_1_0 + 0.00776014109347447*G0_1_1 + 0.00776014109347445*G0_1_2 + 0.00776014109347441*G0_2_0 + 0.00776014109347441*G0_2_1 + 0.00776014109347439*G0_2_2;
-    A[211] = -0.00776014109347453*G0_1_0 - 0.00776014109347442*G0_2_0;
-    A[212] = -0.00776014109347463*G0_1_1 + 0.0176366843033507*G0_2_1;
-    A[213] = 0.0458553791887128*G0_1_2 - 0.0246913580246912*G0_2_2;
-    A[214] = 0.0451499118165792*G0_1_1 + 0.0112874779541449*G0_1_2 - 0.0338624338624334*G0_2_1 + 0.0451499118165783*G0_2_2;
-    A[215] = -0.0902998236331582*G0_1_1 - 0.0310405643738983*G0_1_2 + 0.0423280423280416*G0_2_1 - 0.118518518518518*G0_2_2;
-    A[216] = 0.158024691358027*G0_1_1 + 0.0790123456790133*G0_1_2 + 0.0790123456790133*G0_2_1 + 0.203174603174603*G0_2_2;
-    A[217] = 0.0451499118165794*G0_1_0 + 0.011287477954145*G0_1_2 + 0.0338624338624345*G0_2_0 + 0.011287477954145*G0_2_2;
-    A[218] = -0.0902998236331589*G0_1_0 - 0.0310405643738983*G0_1_2 - 0.0592592592592602*G0_2_0 - 0.0423280423280428*G0_2_2;
-    A[219] = 0.158024691358027*G0_1_0 + 0.0790123456790133*G0_1_2 + 0.0790123456790134*G0_2_0 + 0.101587301587302*G0_2_2;
+    A[210] = 0.00776014109347446*G0_1_0 + 0.00776014109347445*G0_1_1 + 0.00776014109347442*G0_1_2 + 0.00776014109347441*G0_2_0 + 0.00776014109347438*G0_2_1 + 0.00776014109347437*G0_2_2;
+    A[211] = -0.00776014109347454*G0_1_0 - 0.00776014109347443*G0_2_0;
+    A[212] = -0.00776014109347461*G0_1_1 + 0.0176366843033508*G0_2_1;
+    A[213] = 0.0458553791887129*G0_1_2 - 0.0246913580246912*G0_2_2;
+    A[214] = 0.045149911816579*G0_1_1 + 0.0112874779541449*G0_1_2 - 0.0338624338624336*G0_2_1 + 0.0451499118165782*G0_2_2;
+    A[215] = -0.0902998236331582*G0_1_1 - 0.0310405643738983*G0_1_2 + 0.0423280423280417*G0_2_1 - 0.118518518518518*G0_2_2;
+    A[216] = 0.158024691358027*G0_1_1 + 0.0790123456790131*G0_1_2 + 0.0790123456790131*G0_2_1 + 0.203174603174603*G0_2_2;
+    A[217] = 0.0451499118165793*G0_1_0 + 0.011287477954145*G0_1_2 + 0.0338624338624344*G0_2_0 + 0.011287477954145*G0_2_2;
+    A[218] = -0.090299823633159*G0_1_0 - 0.0310405643738983*G0_1_2 - 0.0592592592592601*G0_2_0 - 0.0423280423280427*G0_2_2;
+    A[219] = 0.158024691358027*G0_1_0 + 0.0790123456790131*G0_1_2 + 0.0790123456790133*G0_2_0 + 0.101587301587302*G0_2_2;
     A[220] = 0.0112874779541446*G0_1_0 + 0.0112874779541449*G0_1_1 + 0.0225749559082894*G0_2_0 + 0.011287477954145*G0_2_1;
-    A[221] = 0.00282186948853626*G0_1_0 + 0.00282186948853611*G0_1_1 + 0.0169312169312168*G0_2_0 + 0.0141093474426805*G0_2_1;
-    A[222] = 0.0112874779541446*G0_1_0 + 0.0112874779541447*G0_1_1 + 0.0451499118165784*G0_2_0 + 0.0338624338624339*G0_2_1;
-    A[223] = -0.0451499118165792*G0_1_0 - 0.045149911816579*G0_1_1 - 0.0338624338624341*G0_1_2 - 0.0338624338624342*G0_2_0 - 0.0338624338624342*G0_2_1 - 0.0225749559082893*G0_2_2;
-    A[224] = 0.0902998236331588*G0_1_0 + 0.0902998236331585*G0_1_1 + 0.0592592592592599*G0_1_2 + 0.0592592592592601*G0_2_0 + 0.05925925925926*G0_2_1 + 0.0169312169312171*G0_2_2;
-    A[225] = -0.158024691358027*G0_1_0 - 0.158024691358027*G0_1_1 - 0.0790123456790133*G0_1_2 - 0.0790123456790134*G0_2_0 - 0.0790123456790134*G0_2_1 + 0.0225749559082888*G0_2_2;
-    A[226] = -0.0112874779541446*G0_1_0 - 0.0112874779541446*G0_1_2 - 0.0225749559082892*G0_2_0 - 0.0112874779541444*G0_2_1 - 0.0225749559082892*G0_2_2;
-    A[227] = -0.00282186948853627*G0_1_0 - 0.00282186948853627*G0_1_2 - 0.0169312169312168*G0_2_0 - 0.00282186948853622*G0_2_1 - 0.0169312169312168*G0_2_2;
-    A[228] = -0.0112874779541446*G0_1_0 - 0.0112874779541446*G0_1_2 - 0.0451499118165784*G0_2_0 - 0.0112874779541446*G0_2_1 - 0.0451499118165784*G0_2_2;
-    A[229] = -0.0112874779541447*G0_1_1 - 0.0112874779541447*G0_1_2 - 0.0112874779541448*G0_2_1 - 0.0112874779541447*G0_2_2;
-    A[230] = -0.00282186948853623*G0_1_1 - 0.00282186948853624*G0_1_2 - 0.00282186948853631*G0_2_1 - 0.00282186948853625*G0_2_2;
-    A[231] = -0.0112874779541449*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.011287477954145*G0_2_1 - 0.011287477954145*G0_2_2;
-    A[232] = -0.0225749559082893*G0_1_0 - 0.0225749559082893*G0_1_1 + 0.011287477954145*G0_1_2 - 0.0677248677248678*G0_2_0 - 0.0338624338624335*G0_2_1 + 0.0225749559082899*G0_2_2;
-    A[233] = -0.0225749559082892*G0_1_0 - 0.0225749559082892*G0_1_1 + 0.0112874779541449*G0_1_2 - 0.0677248677248679*G0_2_0 - 0.0338624338624346*G0_2_1 + 0.0677248677248671*G0_2_2;
-    A[234] = 0.112874779541447*G0_1_0 + 0.112874779541446*G0_1_1 + 0.0112874779541442*G0_1_2 + 0.203174603174603*G0_2_0 + 0.101587301587302*G0_2_1 - 0.0677248677248679*G0_2_2;
-    A[235] = 0.0225749559082893*G0_1_0 + 0.0338624338624341*G0_1_2 + 0.0677248677248677*G0_2_0 + 0.0338624338624339*G0_2_1 + 0.0902998236331571*G0_2_2;
-    A[236] = 0.0225749559082891*G0_1_0 + 0.0338624338624342*G0_1_2 + 0.0677248677248679*G0_2_0 + 0.0338624338624336*G0_2_1 + 0.135449735449735*G0_2_2;
-    A[237] = -0.112874779541446*G0_1_0 - 0.101587301587303*G0_1_2 - 0.203174603174603*G0_2_0 - 0.101587301587301*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[238] = 0.0225749559082895*G0_1_1 + 0.0338624338624342*G0_1_2 + 0.0338624338624338*G0_2_1 + 0.0451499118165787*G0_2_2;
-    A[239] = 0.0225749559082891*G0_1_1 + 0.0338624338624344*G0_1_2 + 0.0338624338624333*G0_2_1 + 0.0451499118165789*G0_2_2;
+    A[221] = 0.00282186948853622*G0_1_0 + 0.0028218694885361*G0_1_1 + 0.0169312169312167*G0_2_0 + 0.0141093474426806*G0_2_1;
+    A[222] = 0.0112874779541446*G0_1_0 + 0.0112874779541447*G0_1_1 + 0.0451499118165784*G0_2_0 + 0.0338624338624337*G0_2_1;
+    A[223] = -0.0451499118165792*G0_1_0 - 0.045149911816579*G0_1_1 - 0.033862433862434*G0_1_2 - 0.0338624338624342*G0_2_0 - 0.033862433862434*G0_2_1 - 0.0225749559082892*G0_2_2;
+    A[224] = 0.0902998236331588*G0_1_0 + 0.0902998236331585*G0_1_1 + 0.05925925925926*G0_1_2 + 0.05925925925926*G0_2_0 + 0.0592592592592599*G0_2_1 + 0.016931216931217*G0_2_2;
+    A[225] = -0.158024691358027*G0_1_0 - 0.158024691358027*G0_1_1 - 0.0790123456790134*G0_1_2 - 0.0790123456790133*G0_2_0 - 0.0790123456790132*G0_2_1 + 0.0225749559082889*G0_2_2;
+    A[226] = -0.0112874779541446*G0_1_0 - 0.0112874779541446*G0_1_2 - 0.0225749559082892*G0_2_0 - 0.0112874779541443*G0_2_1 - 0.0225749559082891*G0_2_2;
+    A[227] = -0.00282186948853623*G0_1_0 - 0.00282186948853625*G0_1_2 - 0.0169312169312167*G0_2_0 - 0.00282186948853621*G0_2_1 - 0.0169312169312168*G0_2_2;
+    A[228] = -0.0112874779541446*G0_1_0 - 0.0112874779541446*G0_1_2 - 0.0451499118165784*G0_2_0 - 0.0112874779541447*G0_2_1 - 0.0451499118165783*G0_2_2;
+    A[229] = -0.0112874779541446*G0_1_1 - 0.0112874779541446*G0_1_2 - 0.0112874779541447*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[230] = -0.00282186948853627*G0_1_1 - 0.00282186948853628*G0_1_2 - 0.00282186948853634*G0_2_1 - 0.00282186948853627*G0_2_2;
+    A[231] = -0.0112874779541449*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.011287477954145*G0_2_1 - 0.0112874779541449*G0_2_2;
+    A[232] = -0.0225749559082892*G0_1_0 - 0.0225749559082893*G0_1_1 + 0.0112874779541451*G0_1_2 - 0.0677248677248678*G0_2_0 - 0.0338624338624334*G0_2_1 + 0.0225749559082898*G0_2_2;
+    A[233] = -0.0225749559082891*G0_1_0 - 0.022574955908289*G0_1_1 + 0.0112874779541448*G0_1_2 - 0.067724867724868*G0_2_0 - 0.0338624338624344*G0_2_1 + 0.067724867724867*G0_2_2;
+    A[234] = 0.112874779541446*G0_1_0 + 0.112874779541446*G0_1_1 + 0.0112874779541443*G0_1_2 + 0.203174603174603*G0_2_0 + 0.101587301587302*G0_2_1 - 0.0677248677248677*G0_2_2;
+    A[235] = 0.0225749559082893*G0_1_0 + 0.0338624338624341*G0_1_2 + 0.0677248677248676*G0_2_0 + 0.0338624338624338*G0_2_1 + 0.0902998236331571*G0_2_2;
+    A[236] = 0.0225749559082891*G0_1_0 + 0.0338624338624341*G0_1_2 + 0.067724867724868*G0_2_0 + 0.0338624338624337*G0_2_1 + 0.135449735449735*G0_2_2;
+    A[237] = -0.112874779541446*G0_1_0 - 0.101587301587302*G0_1_2 - 0.203174603174603*G0_2_0 - 0.101587301587301*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[238] = 0.0225749559082892*G0_1_1 + 0.0338624338624339*G0_1_2 + 0.0338624338624337*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[239] = 0.0225749559082892*G0_1_1 + 0.0338624338624345*G0_1_2 + 0.0338624338624334*G0_2_1 + 0.0451499118165789*G0_2_2;
     A[240] = -0.112874779541446*G0_1_1 - 0.101587301587302*G0_1_2 - 0.101587301587302*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[241] = -0.0112874779541446*G0_1_2 - 0.0112874779541443*G0_2_1 - 0.0225749559082894*G0_2_2;
-    A[242] = -0.0112874779541451*G0_1_2 - 0.0112874779541441*G0_2_1 - 0.02257495590829*G0_2_2;
-    A[243] = -0.0112874779541448*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.067724867724867*G0_2_2;
-    A[244] = 0.0902998236331573*G0_2_2;
-    A[245] = 0.00776014109347441*G0_0_0 + 0.0077601410934743*G0_0_1 + 0.00776014109347432*G0_0_2 + 0.00776014109347449*G0_2_0 + 0.00776014109347438*G0_2_1 + 0.00776014109347442*G0_2_2;
-    A[246] = -0.0246913580246915*G0_0_0 + 0.0458553791887127*G0_2_0;
-    A[247] = -0.00776014109347451*G0_0_1 - 0.0077601410934745*G0_2_1;
-    A[248] = 0.0176366843033511*G0_0_2 - 0.00776014109347442*G0_2_2;
-    A[249] = 0.0225749559082898*G0_0_1 + 0.011287477954145*G0_0_2 + 0.0112874779541446*G0_2_1 + 0.0112874779541447*G0_2_2;
-    A[250] = 0.0169312169312165*G0_0_1 + 0.0141093474426806*G0_0_2 + 0.00282186948853628*G0_2_1 + 0.00282186948853626*G0_2_2;
-    A[251] = 0.0451499118165794*G0_0_1 + 0.0338624338624345*G0_0_2 + 0.0112874779541449*G0_2_1 + 0.011287477954145*G0_2_2;
-    A[252] = 0.203174603174603*G0_0_0 + 0.0790123456790123*G0_0_2 + 0.0790123456790123*G0_2_0 + 0.158024691358025*G0_2_2;
-    A[253] = -0.118518518518519*G0_0_0 + 0.0423280423280418*G0_0_2 - 0.0310405643738981*G0_2_0 - 0.0902998236331577*G0_2_2;
-    A[254] = 0.0451499118165794*G0_0_0 - 0.0338624338624336*G0_0_2 + 0.0112874779541449*G0_2_0 + 0.0451499118165786*G0_2_2;
-    A[255] = 0.101587301587302*G0_0_0 + 0.0790123456790125*G0_0_1 + 0.0790123456790124*G0_2_0 + 0.158024691358025*G0_2_1;
-    A[256] = -0.0423280423280424*G0_0_0 - 0.0592592592592592*G0_0_1 - 0.0310405643738978*G0_2_0 - 0.0902998236331575*G0_2_1;
-    A[257] = 0.0112874779541449*G0_0_0 + 0.033862433862434*G0_0_1 + 0.0112874779541447*G0_2_0 + 0.0451499118165786*G0_2_1;
-    A[258] = -0.0225749559082895*G0_0_0 - 0.0225749559082894*G0_0_1 - 0.0112874779541444*G0_0_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541446*G0_2_1;
-    A[259] = -0.0169312169312164*G0_0_0 - 0.0169312169312164*G0_0_1 - 0.00282186948853598*G0_0_2 - 0.0028218694885359*G0_2_0 - 0.00282186948853587*G0_2_1;
-    A[260] = -0.0451499118165794*G0_0_0 - 0.0451499118165794*G0_0_1 - 0.0112874779541449*G0_0_2 - 0.0112874779541449*G0_2_0 - 0.011287477954145*G0_2_1;
-    A[261] = -0.0112874779541449*G0_0_0 - 0.0112874779541447*G0_0_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541445*G0_2_2;
-    A[262] = -0.00282186948853581*G0_0_0 - 0.00282186948853595*G0_0_2 - 0.00282186948853597*G0_2_0 - 0.00282186948853608*G0_2_2;
-    A[263] = -0.0112874779541449*G0_0_0 - 0.0112874779541448*G0_0_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541446*G0_2_2;
-    A[264] = -0.0225749559082888*G0_0_0 - 0.0338624338624336*G0_0_1 - 0.0338624338624336*G0_0_2 - 0.0338624338624337*G0_2_0 - 0.0451499118165784*G0_2_1 - 0.0451499118165785*G0_2_2;
-    A[265] = 0.0169312169312161*G0_0_0 + 0.0592592592592587*G0_0_1 + 0.0592592592592586*G0_0_2 + 0.0592592592592588*G0_2_0 + 0.0902998236331568*G0_2_1 + 0.0902998236331568*G0_2_2;
-    A[266] = 0.0225749559082897*G0_0_0 - 0.0790123456790125*G0_0_1 - 0.0790123456790125*G0_0_2 - 0.0790123456790122*G0_2_0 - 0.158024691358025*G0_2_1 - 0.158024691358025*G0_2_2;
-    A[267] = -0.0677248677248687*G0_0_0 + 0.203174603174602*G0_0_1 + 0.101587301587301*G0_0_2 + 0.0112874779541437*G0_2_0 + 0.112874779541446*G0_2_1 + 0.112874779541446*G0_2_2;
-    A[268] = 0.0225749559082899*G0_0_0 - 0.0677248677248676*G0_0_1 - 0.0338624338624335*G0_0_2 + 0.011287477954145*G0_2_0 - 0.0225749559082891*G0_2_1 - 0.0225749559082893*G0_2_2;
-    A[269] = 0.0677248677248683*G0_0_0 - 0.0677248677248675*G0_0_1 - 0.033862433862434*G0_0_2 + 0.0112874779541452*G0_2_0 - 0.0225749559082892*G0_2_1 - 0.0225749559082891*G0_2_2;
-    A[270] = -0.0225749559082888*G0_0_0 - 0.0112874779541445*G0_0_2 - 0.0112874779541443*G0_2_0;
-    A[271] = -0.0225749559082899*G0_0_0 - 0.0112874779541447*G0_0_2 - 0.011287477954145*G0_2_0;
-    A[272] = -0.0677248677248682*G0_0_0 - 0.0112874779541454*G0_0_2 - 0.0112874779541452*G0_2_0;
-    A[273] = 0.0902998236331563*G0_0_0 + 0.0677248677248673*G0_0_1 + 0.0338624338624333*G0_0_2 + 0.0338624338624337*G0_2_0 + 0.0225749559082891*G0_2_1;
+    A[241] = -0.0112874779541446*G0_1_2 - 0.0112874779541444*G0_2_1 - 0.0225749559082894*G0_2_2;
+    A[242] = -0.0112874779541451*G0_1_2 - 0.0112874779541441*G0_2_1 - 0.0225749559082899*G0_2_2;
+    A[243] = -0.0112874779541447*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0677248677248669*G0_2_2;
+    A[244] = 0.0902998236331571*G0_2_2;
+    A[245] = 0.00776014109347435*G0_0_0 + 0.00776014109347425*G0_0_1 + 0.00776014109347427*G0_0_2 + 0.0077601410934744*G0_2_0 + 0.00776014109347432*G0_2_1 + 0.00776014109347435*G0_2_2;
+    A[246] = -0.0246913580246916*G0_0_0 + 0.0458553791887126*G0_2_0;
+    A[247] = -0.00776014109347454*G0_0_1 - 0.00776014109347449*G0_2_1;
+    A[248] = 0.0176366843033511*G0_0_2 - 0.00776014109347437*G0_2_2;
+    A[249] = 0.0225749559082897*G0_0_1 + 0.0112874779541448*G0_0_2 + 0.0112874779541446*G0_2_1 + 0.0112874779541447*G0_2_2;
+    A[250] = 0.0169312169312166*G0_0_1 + 0.0141093474426807*G0_0_2 + 0.00282186948853631*G0_2_1 + 0.00282186948853626*G0_2_2;
+    A[251] = 0.0451499118165793*G0_0_1 + 0.0338624338624344*G0_0_2 + 0.011287477954145*G0_2_1 + 0.011287477954145*G0_2_2;
+    A[252] = 0.203174603174603*G0_0_0 + 0.0790123456790121*G0_0_2 + 0.0790123456790121*G0_2_0 + 0.158024691358025*G0_2_2;
+    A[253] = -0.11851851851852*G0_0_0 + 0.042328042328042*G0_0_2 - 0.0310405643738981*G0_2_0 - 0.0902998236331575*G0_2_2;
+    A[254] = 0.0451499118165795*G0_0_0 - 0.0338624338624336*G0_0_2 + 0.011287477954145*G0_2_0 + 0.0451499118165785*G0_2_2;
+    A[255] = 0.101587301587301*G0_0_0 + 0.0790123456790123*G0_0_1 + 0.0790123456790121*G0_2_0 + 0.158024691358025*G0_2_1;
+    A[256] = -0.0423280423280423*G0_0_0 - 0.0592592592592591*G0_0_1 - 0.0310405643738978*G0_2_0 - 0.0902998236331574*G0_2_1;
+    A[257] = 0.0112874779541448*G0_0_0 + 0.0338624338624339*G0_0_1 + 0.0112874779541446*G0_2_0 + 0.0451499118165785*G0_2_1;
+    A[258] = -0.0225749559082894*G0_0_0 - 0.0225749559082894*G0_0_1 - 0.0112874779541444*G0_0_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541446*G0_2_1;
+    A[259] = -0.0169312169312163*G0_0_0 - 0.0169312169312163*G0_0_1 - 0.00282186948853594*G0_0_2 - 0.0028218694885358*G0_2_0 - 0.00282186948853579*G0_2_1;
+    A[260] = -0.0451499118165794*G0_0_0 - 0.0451499118165794*G0_0_1 - 0.011287477954145*G0_0_2 - 0.0112874779541449*G0_2_0 - 0.011287477954145*G0_2_1;
+    A[261] = -0.0112874779541447*G0_0_0 - 0.0112874779541446*G0_0_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541445*G0_2_2;
+    A[262] = -0.002821869488536*G0_0_0 - 0.00282186948853612*G0_0_2 - 0.00282186948853599*G0_2_0 - 0.00282186948853613*G0_2_2;
+    A[263] = -0.0112874779541447*G0_0_0 - 0.0112874779541446*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.0112874779541445*G0_2_2;
+    A[264] = -0.0225749559082887*G0_0_0 - 0.0338624338624336*G0_0_1 - 0.0338624338624335*G0_0_2 - 0.0338624338624335*G0_2_0 - 0.0451499118165783*G0_2_1 - 0.0451499118165782*G0_2_2;
+    A[265] = 0.016931216931216*G0_0_0 + 0.0592592592592586*G0_0_1 + 0.0592592592592585*G0_0_2 + 0.0592592592592585*G0_2_0 + 0.0902998236331566*G0_2_1 + 0.0902998236331566*G0_2_2;
+    A[266] = 0.0225749559082899*G0_0_0 - 0.0790123456790123*G0_0_1 - 0.0790123456790123*G0_0_2 - 0.079012345679012*G0_2_0 - 0.158024691358025*G0_2_1 - 0.158024691358025*G0_2_2;
+    A[267] = -0.0677248677248688*G0_0_0 + 0.203174603174602*G0_0_1 + 0.101587301587301*G0_0_2 + 0.0112874779541435*G0_2_0 + 0.112874779541446*G0_2_1 + 0.112874779541446*G0_2_2;
+    A[268] = 0.0225749559082898*G0_0_0 - 0.0677248677248676*G0_0_1 - 0.0338624338624335*G0_0_2 + 0.0112874779541449*G0_2_0 - 0.0225749559082892*G0_2_1 - 0.0225749559082894*G0_2_2;
+    A[269] = 0.0677248677248683*G0_0_0 - 0.0677248677248676*G0_0_1 - 0.033862433862434*G0_0_2 + 0.0112874779541452*G0_2_0 - 0.0225749559082892*G0_2_1 - 0.022574955908289*G0_2_2;
+    A[270] = -0.0225749559082888*G0_0_0 - 0.0112874779541446*G0_0_2 - 0.0112874779541444*G0_2_0;
+    A[271] = -0.0225749559082899*G0_0_0 - 0.0112874779541446*G0_0_2 - 0.0112874779541449*G0_2_0;
+    A[272] = -0.0677248677248682*G0_0_0 - 0.0112874779541453*G0_0_2 - 0.0112874779541452*G0_2_0;
+    A[273] = 0.0902998236331562*G0_0_0 + 0.0677248677248672*G0_0_1 + 0.0338624338624333*G0_0_2 + 0.0338624338624334*G0_2_0 + 0.0225749559082889*G0_2_1;
     A[274] = -0.27089947089947*G0_0_0 - 0.203174603174602*G0_0_1 - 0.1015873015873*G0_0_2 - 0.101587301587301*G0_2_0 - 0.112874779541445*G0_2_1;
-    A[275] = 0.135449735449736*G0_0_0 + 0.0677248677248677*G0_0_1 + 0.0338624338624334*G0_0_2 + 0.0338624338624341*G0_2_0 + 0.0225749559082893*G0_2_1;
-    A[276] = 0.0451499118165786*G0_0_0 + 0.0338624338624342*G0_0_2 + 0.0338624338624338*G0_2_0 + 0.0225749559082894*G0_2_2;
-    A[277] = -0.135449735449735*G0_0_0 - 0.101587301587301*G0_0_2 - 0.101587301587302*G0_2_0 - 0.112874779541446*G0_2_2;
+    A[275] = 0.135449735449736*G0_0_0 + 0.0677248677248678*G0_0_1 + 0.0338624338624334*G0_0_2 + 0.033862433862434*G0_2_0 + 0.0225749559082894*G0_2_1;
+    A[276] = 0.0451499118165783*G0_0_0 + 0.0338624338624341*G0_0_2 + 0.0338624338624336*G0_2_0 + 0.0225749559082893*G0_2_2;
+    A[277] = -0.135449735449735*G0_0_0 - 0.101587301587301*G0_0_2 - 0.101587301587301*G0_2_0 - 0.112874779541446*G0_2_2;
     A[278] = 0.0451499118165783*G0_0_0 + 0.0338624338624333*G0_0_2 + 0.0338624338624338*G0_2_0 + 0.0225749559082892*G0_2_2;
-    A[279] = 0.0902998236331573*G0_0_0;
-    A[280] = 0.00511463844797148*G0_0_0 + 0.00511463844797156*G0_0_1 + 0.00511463844797161*G0_0_2 + 0.00511463844797145*G0_2_0 + 0.0051146384479715*G0_2_1 + 0.00511463844797155*G0_2_2;
-    A[281] = 0.0202821869488538*G0_0_0 - 0.0326278659611995*G0_2_0;
-    A[282] = -0.00511463844797162*G0_0_1 - 0.00511463844797176*G0_2_1;
-    A[283] = -0.0326278659611998*G0_0_2 + 0.0202821869488535*G0_2_2;
-    A[284] = 0.0169312169312161*G0_0_1 + 0.00282186948853578*G0_0_2 + 0.0141093474426809*G0_2_1 + 0.002821869488536*G0_2_2;
-    A[285] = -0.0211640211640202*G0_0_1 - 0.0105820105820103*G0_0_2 - 0.0105820105820107*G0_2_1 - 0.0134038800705466*G0_2_2;
-    A[286] = -0.0902998236331589*G0_0_1 - 0.0592592592592602*G0_0_2 - 0.0310405643738983*G0_2_1 - 0.0423280423280428*G0_2_2;
-    A[287] = -0.118518518518519*G0_0_0 - 0.0310405643738981*G0_0_2 + 0.0423280423280418*G0_2_0 - 0.0902998236331577*G0_2_2;
+    A[279] = 0.0902998236331574*G0_0_0;
+    A[280] = 0.00511463844797153*G0_0_0 + 0.00511463844797159*G0_0_1 + 0.00511463844797164*G0_0_2 + 0.00511463844797153*G0_2_0 + 0.00511463844797155*G0_2_1 + 0.0051146384479716*G0_2_2;
+    A[281] = 0.0202821869488538*G0_0_0 - 0.0326278659611994*G0_2_0;
+    A[282] = -0.00511463844797162*G0_0_1 - 0.00511463844797172*G0_2_1;
+    A[283] = -0.0326278659611999*G0_0_2 + 0.0202821869488534*G0_2_2;
+    A[284] = 0.0169312169312162*G0_0_1 + 0.00282186948853584*G0_0_2 + 0.0141093474426809*G0_2_1 + 0.00282186948853616*G0_2_2;
+    A[285] = -0.0211640211640202*G0_0_1 - 0.0105820105820104*G0_0_2 - 0.0105820105820106*G0_2_1 - 0.0134038800705467*G0_2_2;
+    A[286] = -0.090299823633159*G0_0_1 - 0.0592592592592601*G0_0_2 - 0.0310405643738983*G0_2_1 - 0.0423280423280427*G0_2_2;
+    A[287] = -0.11851851851852*G0_0_0 - 0.0310405643738981*G0_0_2 + 0.042328042328042*G0_2_0 - 0.0902998236331575*G0_2_2;
     A[288] = 0.249735449735452*G0_0_0 + 0.0825396825396833*G0_0_2 + 0.0825396825396833*G0_2_0 + 0.24973544973545*G0_2_2;
-    A[289] = -0.090299823633159*G0_0_0 + 0.0423280423280416*G0_0_2 - 0.0310405643738983*G0_2_0 - 0.118518518518519*G0_2_2;
-    A[290] = -0.0423280423280427*G0_0_0 - 0.0310405643738982*G0_0_1 - 0.0592592592592593*G0_2_0 - 0.0902998236331577*G0_2_1;
-    A[291] = -0.0134038800705468*G0_0_0 - 0.0105820105820104*G0_0_1 - 0.0105820105820107*G0_2_0 - 0.0211640211640206*G0_2_1;
-    A[292] = 0.00282186948853602*G0_0_0 + 0.0141093474426805*G0_0_1 + 0.00282186948853624*G0_2_0 + 0.0169312169312169*G0_2_1;
-    A[293] = -0.0169312169312158*G0_0_0 - 0.0169312169312161*G0_0_1 - 0.0141093474426803*G0_0_2 - 0.0141093474426802*G0_2_0 - 0.0141093474426804*G0_2_1 - 0.0112874779541442*G0_2_2;
-    A[294] = 0.0211640211640197*G0_0_0 + 0.0211640211640199*G0_0_1 + 0.01058201058201*G0_0_2 + 0.01058201058201*G0_2_0 + 0.01058201058201*G0_2_1 - 0.00282186948853647*G0_2_2;
-    A[295] = 0.090299823633159*G0_0_0 + 0.0902998236331589*G0_0_1 + 0.0310405643738987*G0_0_2 + 0.0310405643738983*G0_2_0 + 0.0310405643738983*G0_2_1 - 0.011287477954144*G0_2_2;
-    A[296] = -0.00282186948853618*G0_0_0 - 0.00282186948853612*G0_0_2 - 0.00282186948853647*G0_2_0 - 0.00282186948853643*G0_2_2;
-    A[297] = -0.00917107583774246*G0_0_0 - 0.0091710758377425*G0_0_2 - 0.00917107583774241*G0_2_0 - 0.00917107583774249*G0_2_2;
-    A[298] = -0.00282186948853608*G0_0_0 - 0.00282186948853602*G0_0_2 - 0.00282186948853627*G0_2_0 - 0.00282186948853622*G0_2_2;
-    A[299] = -0.0112874779541443*G0_0_0 - 0.0141093474426805*G0_0_1 - 0.0141093474426804*G0_0_2 - 0.0141093474426802*G0_2_0 - 0.0169312169312166*G0_2_1 - 0.0169312169312166*G0_2_2;
-    A[300] = -0.00282186948853628*G0_0_0 + 0.0105820105820107*G0_0_1 + 0.0105820105820106*G0_0_2 + 0.0105820105820101*G0_2_0 + 0.0211640211640207*G0_2_1 + 0.0211640211640207*G0_2_2;
-    A[301] = -0.0112874779541447*G0_0_0 + 0.031040564373898*G0_0_1 + 0.0310405643738979*G0_0_2 + 0.0310405643738981*G0_2_0 + 0.0902998236331575*G0_2_1 + 0.0902998236331574*G0_2_2;
-    A[302] = 0.11851851851852*G0_0_0 + 0.0507936507936515*G0_0_1 - 0.042328042328042*G0_0_2 + 0.0931216931216944*G0_2_0 + 0.186243386243387*G0_2_1 - 0.0846560846560837*G0_2_2;
-    A[303] = -0.0169312169312175*G0_0_0 - 0.0846560846560849*G0_0_1 - 0.0197530864197535*G0_0_2 - 0.0197530864197533*G0_2_0 - 0.0846560846560848*G0_2_1 - 0.0169312169312169*G0_2_2;
-    A[304] = -0.0846560846560854*G0_0_0 + 0.186243386243386*G0_0_1 + 0.0931216931216933*G0_0_2 - 0.0423280423280427*G0_2_0 + 0.0507936507936512*G0_2_1 + 0.118518518518519*G0_2_2;
-    A[305] = 0.0169312169312166*G0_0_0 + 0.0197530864197529*G0_0_2 + 0.0197530864197526*G0_2_0 + 0.0225749559082894*G0_2_2;
-    A[306] = 0.0169312169312176*G0_0_0 + 0.019753086419753*G0_0_2 + 0.0197530864197533*G0_2_0 + 0.0225749559082893*G0_2_2;
-    A[307] = 0.0846560846560854*G0_0_0 + 0.0423280423280432*G0_0_2 + 0.0423280423280427*G0_2_0 + 0.0225749559082896*G0_2_2;
-    A[308] = 0.0677248677248666*G0_0_0 + 0.0846560846560835*G0_0_1 + 0.0649029982363302*G0_0_2 + 0.06490299823633*G0_2_0 + 0.0846560846560831*G0_2_1 + 0.0677248677248665*G0_2_2;
-    A[309] = 0.0677248677248688*G0_0_0 - 0.0507936507936511*G0_0_1 - 0.0931216931216935*G0_0_2 - 0.0931216931216916*G0_2_0 - 0.186243386243387*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[310] = -0.270899470899471*G0_0_0 - 0.186243386243386*G0_0_1 - 0.0931216931216917*G0_0_2 - 0.0931216931216933*G0_2_0 - 0.0507936507936511*G0_2_1 + 0.0677248677248682*G0_2_2;
-    A[311] = 0.0225749559082893*G0_0_0 + 0.0197530864197529*G0_0_2 + 0.0197530864197534*G0_2_0 + 0.0169312169312166*G0_2_2;
-    A[312] = 0.0225749559082895*G0_0_0 + 0.0423280423280424*G0_0_2 + 0.0423280423280424*G0_2_0 + 0.084656084656084*G0_2_2;
-    A[313] = 0.0225749559082893*G0_0_0 + 0.0197530864197538*G0_0_2 + 0.0197530864197531*G0_2_0 + 0.0169312169312171*G0_2_2;
+    A[289] = -0.0902998236331592*G0_0_0 + 0.0423280423280416*G0_0_2 - 0.0310405643738983*G0_2_0 - 0.118518518518519*G0_2_2;
+    A[290] = -0.0423280423280426*G0_0_0 - 0.0310405643738982*G0_0_1 - 0.0592592592592591*G0_2_0 - 0.0902998236331576*G0_2_1;
+    A[291] = -0.0134038800705469*G0_0_0 - 0.0105820105820105*G0_0_1 - 0.0105820105820108*G0_2_0 - 0.0211640211640207*G0_2_1;
+    A[292] = 0.00282186948853608*G0_0_0 + 0.0141093474426806*G0_0_1 + 0.00282186948853642*G0_2_0 + 0.016931216931217*G0_2_1;
+    A[293] = -0.0169312169312159*G0_0_0 - 0.0169312169312161*G0_0_1 - 0.0141093474426803*G0_0_2 - 0.0141093474426803*G0_2_0 - 0.0141093474426804*G0_2_1 - 0.0112874779541442*G0_2_2;
+    A[294] = 0.0211640211640197*G0_0_0 + 0.0211640211640198*G0_0_1 + 0.0105820105820099*G0_0_2 + 0.01058201058201*G0_2_0 + 0.01058201058201*G0_2_1 - 0.00282186948853672*G0_2_2;
+    A[295] = 0.0902998236331592*G0_0_0 + 0.0902998236331591*G0_0_1 + 0.0310405643738989*G0_0_2 + 0.0310405643738983*G0_2_0 + 0.0310405643738983*G0_2_1 - 0.0112874779541438*G0_2_2;
+    A[296] = -0.0028218694885362*G0_0_0 - 0.0028218694885362*G0_0_2 - 0.00282186948853651*G0_2_0 - 0.00282186948853652*G0_2_2;
+    A[297] = -0.00917107583774239*G0_0_0 - 0.00917107583774242*G0_0_2 - 0.00917107583774232*G0_2_0 - 0.00917107583774234*G0_2_2;
+    A[298] = -0.00282186948853613*G0_0_0 - 0.00282186948853611*G0_0_2 - 0.00282186948853645*G0_2_0 - 0.00282186948853646*G0_2_2;
+    A[299] = -0.0112874779541444*G0_0_0 - 0.0141093474426806*G0_0_1 - 0.0141093474426806*G0_0_2 - 0.0141093474426804*G0_2_0 - 0.0169312169312169*G0_2_1 - 0.0169312169312169*G0_2_2;
+    A[300] = -0.00282186948853619*G0_0_0 + 0.0105820105820107*G0_0_1 + 0.0105820105820107*G0_0_2 + 0.0105820105820103*G0_2_0 + 0.0211640211640209*G0_2_1 + 0.0211640211640209*G0_2_2;
+    A[301] = -0.0112874779541448*G0_0_0 + 0.031040564373898*G0_0_1 + 0.0310405643738979*G0_0_2 + 0.031040564373898*G0_2_0 + 0.0902998236331574*G0_2_1 + 0.0902998236331574*G0_2_2;
+    A[302] = 0.11851851851852*G0_0_0 + 0.0507936507936516*G0_0_1 - 0.0423280423280421*G0_0_2 + 0.0931216931216945*G0_2_0 + 0.186243386243387*G0_2_1 - 0.0846560846560839*G0_2_2;
+    A[303] = -0.0169312169312176*G0_0_0 - 0.0846560846560851*G0_0_1 - 0.0197530864197535*G0_0_2 - 0.0197530864197533*G0_2_0 - 0.0846560846560849*G0_2_1 - 0.0169312169312168*G0_2_2;
+    A[304] = -0.0846560846560854*G0_0_0 + 0.186243386243386*G0_0_1 + 0.0931216931216934*G0_0_2 - 0.0423280423280427*G0_2_0 + 0.0507936507936513*G0_2_1 + 0.118518518518519*G0_2_2;
+    A[305] = 0.0169312169312166*G0_0_0 + 0.0197530864197529*G0_0_2 + 0.0197530864197527*G0_2_0 + 0.0225749559082894*G0_2_2;
+    A[306] = 0.0169312169312176*G0_0_0 + 0.0197530864197531*G0_0_2 + 0.0197530864197533*G0_2_0 + 0.0225749559082894*G0_2_2;
+    A[307] = 0.0846560846560854*G0_0_0 + 0.0423280423280432*G0_0_2 + 0.0423280423280427*G0_2_0 + 0.0225749559082895*G0_2_2;
+    A[308] = 0.0677248677248668*G0_0_0 + 0.0846560846560838*G0_0_1 + 0.0649029982363305*G0_0_2 + 0.0649029982363304*G0_2_0 + 0.0846560846560834*G0_2_1 + 0.067724867724867*G0_2_2;
+    A[309] = 0.0677248677248687*G0_0_0 - 0.0507936507936513*G0_0_1 - 0.0931216931216937*G0_0_2 - 0.093121693121692*G0_2_0 - 0.186243386243387*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[310] = -0.270899470899472*G0_0_0 - 0.186243386243386*G0_0_1 - 0.093121693121692*G0_0_2 - 0.0931216931216933*G0_2_0 - 0.0507936507936513*G0_2_1 + 0.0677248677248681*G0_2_2;
+    A[311] = 0.0225749559082895*G0_0_0 + 0.0197530864197531*G0_0_2 + 0.0197530864197535*G0_2_0 + 0.0169312169312167*G0_2_2;
+    A[312] = 0.0225749559082894*G0_0_0 + 0.0423280423280423*G0_0_2 + 0.0423280423280421*G0_2_0 + 0.084656084656084*G0_2_2;
+    A[313] = 0.0225749559082893*G0_0_0 + 0.0197530864197538*G0_0_2 + 0.0197530864197531*G0_2_0 + 0.016931216931217*G0_2_2;
     A[314] = -0.135449735449736*G0_0_0 - 0.112874779541447*G0_0_2 - 0.112874779541447*G0_2_0 - 0.135449735449736*G0_2_2;
-    A[315] = 0.00776014109347452*G0_0_0 + 0.00776014109347449*G0_0_1 + 0.00776014109347447*G0_0_2 + 0.00776014109347447*G0_2_0 + 0.00776014109347449*G0_2_1 + 0.00776014109347446*G0_2_2;
-    A[316] = -0.00776014109347455*G0_0_0 + 0.017636684303351*G0_2_0;
-    A[317] = -0.00776014109347465*G0_0_1 - 0.0077601410934745*G0_2_1;
-    A[318] = 0.0458553791887129*G0_0_2 - 0.0246913580246912*G0_2_2;
-    A[319] = 0.0451499118165792*G0_0_1 + 0.0112874779541449*G0_0_2 + 0.033862433862434*G0_2_1 + 0.0112874779541448*G0_2_2;
-    A[320] = -0.0902998236331584*G0_0_1 - 0.0310405643738984*G0_0_2 - 0.0592592592592598*G0_2_1 - 0.0423280423280429*G0_2_2;
-    A[321] = 0.158024691358027*G0_0_1 + 0.0790123456790134*G0_0_2 + 0.0790123456790133*G0_2_1 + 0.101587301587302*G0_2_2;
-    A[322] = 0.0451499118165794*G0_0_0 + 0.0112874779541449*G0_0_2 - 0.0338624338624336*G0_2_0 + 0.0451499118165786*G0_2_2;
-    A[323] = -0.090299823633159*G0_0_0 - 0.0310405643738983*G0_0_2 + 0.0423280423280416*G0_2_0 - 0.118518518518519*G0_2_2;
-    A[324] = 0.158024691358027*G0_0_0 + 0.0790123456790133*G0_0_2 + 0.0790123456790134*G0_2_0 + 0.203174603174604*G0_2_2;
+    A[315] = 0.00776014109347449*G0_0_0 + 0.00776014109347447*G0_0_1 + 0.00776014109347445*G0_0_2 + 0.00776014109347443*G0_2_0 + 0.00776014109347445*G0_2_1 + 0.00776014109347443*G0_2_2;
+    A[316] = -0.00776014109347458*G0_0_0 + 0.017636684303351*G0_2_0;
+    A[317] = -0.00776014109347464*G0_0_1 - 0.00776014109347453*G0_2_1;
+    A[318] = 0.0458553791887131*G0_0_2 - 0.0246913580246912*G0_2_2;
+    A[319] = 0.0451499118165792*G0_0_1 + 0.0112874779541449*G0_0_2 + 0.0338624338624338*G0_2_1 + 0.0112874779541445*G0_2_2;
+    A[320] = -0.0902998236331584*G0_0_1 - 0.0310405643738983*G0_0_2 - 0.0592592592592597*G0_2_1 - 0.0423280423280427*G0_2_2;
+    A[321] = 0.158024691358027*G0_0_1 + 0.0790123456790133*G0_0_2 + 0.0790123456790131*G0_2_1 + 0.101587301587302*G0_2_2;
+    A[322] = 0.0451499118165795*G0_0_0 + 0.011287477954145*G0_0_2 - 0.0338624338624336*G0_2_0 + 0.0451499118165785*G0_2_2;
+    A[323] = -0.0902998236331592*G0_0_0 - 0.0310405643738983*G0_0_2 + 0.0423280423280416*G0_2_0 - 0.118518518518519*G0_2_2;
+    A[324] = 0.158024691358027*G0_0_0 + 0.0790123456790133*G0_0_2 + 0.0790123456790133*G0_2_0 + 0.203174603174603*G0_2_2;
     A[325] = 0.0112874779541446*G0_0_0 + 0.0112874779541449*G0_0_1 + 0.0338624338624335*G0_2_0 + 0.0451499118165785*G0_2_1;
-    A[326] = 0.00282186948853625*G0_0_0 + 0.00282186948853609*G0_0_1 + 0.0141093474426809*G0_2_0 + 0.0169312169312168*G0_2_1;
-    A[327] = 0.0112874779541446*G0_0_0 + 0.0112874779541447*G0_0_1 + 0.0112874779541446*G0_2_0 + 0.0225749559082892*G0_2_1;
-    A[328] = -0.0451499118165793*G0_0_0 - 0.0451499118165791*G0_0_1 - 0.0338624338624342*G0_0_2 - 0.0338624338624341*G0_2_0 - 0.033862433862434*G0_2_1 - 0.0225749559082894*G0_2_2;
-    A[329] = 0.0902998236331589*G0_0_0 + 0.0902998236331586*G0_0_1 + 0.0592592592592601*G0_0_2 + 0.0592592592592601*G0_2_0 + 0.05925925925926*G0_2_1 + 0.0169312169312174*G0_2_2;
-    A[330] = -0.158024691358027*G0_0_0 - 0.158024691358027*G0_0_1 - 0.0790123456790135*G0_0_2 - 0.0790123456790133*G0_2_0 - 0.0790123456790133*G0_2_1 + 0.0225749559082886*G0_2_2;
-    A[331] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_2 - 0.0112874779541443*G0_2_0 - 0.0112874779541442*G0_2_2;
-    A[332] = -0.00282186948853628*G0_0_0 - 0.00282186948853628*G0_0_2 - 0.0028218694885363*G0_2_0 - 0.00282186948853625*G0_2_2;
-    A[333] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.0112874779541446*G0_2_2;
-    A[334] = -0.0112874779541447*G0_0_1 - 0.0112874779541447*G0_0_2 - 0.0112874779541445*G0_2_0 - 0.0225749559082891*G0_2_1 - 0.0225749559082891*G0_2_2;
-    A[335] = -0.00282186948853622*G0_0_1 - 0.00282186948853623*G0_0_2 - 0.00282186948853605*G0_2_0 - 0.0169312169312168*G0_2_1 - 0.0169312169312168*G0_2_2;
-    A[336] = -0.0112874779541449*G0_0_1 - 0.0112874779541449*G0_0_2 - 0.0112874779541448*G0_2_0 - 0.0451499118165785*G0_2_1 - 0.0451499118165785*G0_2_2;
-    A[337] = -0.0225749559082894*G0_0_0 - 0.0225749559082893*G0_0_1 + 0.0112874779541449*G0_0_2 - 0.0338624338624341*G0_2_0 - 0.067724867724868*G0_2_1 + 0.0677248677248675*G0_2_2;
-    A[338] = -0.0225749559082893*G0_0_0 - 0.0225749559082894*G0_0_1 + 0.0112874779541448*G0_0_2 - 0.0338624338624342*G0_2_0 - 0.0677248677248681*G0_2_1 + 0.0225749559082893*G0_2_2;
-    A[339] = 0.112874779541447*G0_0_0 + 0.112874779541447*G0_0_1 + 0.0112874779541442*G0_0_2 + 0.101587301587302*G0_2_0 + 0.203174603174604*G0_2_1 - 0.0677248677248677*G0_2_2;
-    A[340] = 0.0225749559082893*G0_0_0 + 0.0338624338624341*G0_0_2 + 0.033862433862434*G0_2_0 + 0.0451499118165782*G0_2_2;
-    A[341] = 0.0225749559082893*G0_0_0 + 0.0338624338624343*G0_0_2 + 0.0338624338624342*G0_2_0 + 0.0451499118165789*G0_2_2;
+    A[326] = 0.00282186948853621*G0_0_0 + 0.00282186948853609*G0_0_1 + 0.0141093474426809*G0_2_0 + 0.0169312169312168*G0_2_1;
+    A[327] = 0.0112874779541446*G0_0_0 + 0.0112874779541447*G0_0_1 + 0.0112874779541444*G0_2_0 + 0.0225749559082891*G0_2_1;
+    A[328] = -0.0451499118165793*G0_0_0 - 0.0451499118165791*G0_0_1 - 0.0338624338624342*G0_0_2 - 0.033862433862434*G0_2_0 - 0.0338624338624339*G0_2_1 - 0.0225749559082894*G0_2_2;
+    A[329] = 0.090299823633159*G0_0_0 + 0.0902998236331587*G0_0_1 + 0.0592592592592602*G0_0_2 + 0.0592592592592601*G0_2_0 + 0.05925925925926*G0_2_1 + 0.0169312169312175*G0_2_2;
+    A[330] = -0.158024691358027*G0_0_0 - 0.158024691358027*G0_0_1 - 0.0790123456790137*G0_0_2 - 0.0790123456790132*G0_2_0 - 0.0790123456790132*G0_2_1 + 0.0225749559082885*G0_2_2;
+    A[331] = -0.0112874779541446*G0_0_0 - 0.0112874779541445*G0_0_2 - 0.0112874779541442*G0_2_0 - 0.0112874779541441*G0_2_2;
+    A[332] = -0.00282186948853625*G0_0_0 - 0.00282186948853626*G0_0_2 - 0.00282186948853638*G0_2_0 - 0.00282186948853636*G0_2_2;
+    A[333] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_2 - 0.0112874779541444*G0_2_0 - 0.0112874779541443*G0_2_2;
+    A[334] = -0.0112874779541446*G0_0_1 - 0.0112874779541446*G0_0_2 - 0.0112874779541444*G0_2_0 - 0.0225749559082889*G0_2_1 - 0.0225749559082889*G0_2_2;
+    A[335] = -0.00282186948853626*G0_0_1 - 0.00282186948853626*G0_0_2 - 0.00282186948853622*G0_2_0 - 0.0169312169312169*G0_2_1 - 0.0169312169312169*G0_2_2;
+    A[336] = -0.0112874779541449*G0_0_1 - 0.0112874779541449*G0_0_2 - 0.0112874779541447*G0_2_0 - 0.0451499118165786*G0_2_1 - 0.0451499118165786*G0_2_2;
+    A[337] = -0.0225749559082894*G0_0_0 - 0.0225749559082893*G0_0_1 + 0.011287477954145*G0_0_2 - 0.0338624338624342*G0_2_0 - 0.067724867724868*G0_2_1 + 0.0677248677248675*G0_2_2;
+    A[338] = -0.0225749559082893*G0_0_0 - 0.0225749559082892*G0_0_1 + 0.0112874779541447*G0_0_2 - 0.0338624338624342*G0_2_0 - 0.0677248677248679*G0_2_1 + 0.0225749559082891*G0_2_2;
+    A[339] = 0.112874779541447*G0_0_0 + 0.112874779541447*G0_0_1 + 0.0112874779541443*G0_0_2 + 0.101587301587302*G0_2_0 + 0.203174603174604*G0_2_1 - 0.0677248677248677*G0_2_2;
+    A[340] = 0.0225749559082893*G0_0_0 + 0.0338624338624341*G0_0_2 + 0.0338624338624339*G0_2_0 + 0.0451499118165781*G0_2_2;
+    A[341] = 0.0225749559082893*G0_0_0 + 0.0338624338624341*G0_0_2 + 0.0338624338624341*G0_2_0 + 0.0451499118165787*G0_2_2;
     A[342] = -0.112874779541447*G0_0_0 - 0.101587301587303*G0_0_2 - 0.101587301587302*G0_2_0 - 0.135449735449736*G0_2_2;
-    A[343] = 0.0225749559082896*G0_0_1 + 0.0338624338624342*G0_0_2 + 0.0338624338624337*G0_2_0 + 0.0677248677248682*G0_2_1 + 0.0902998236331569*G0_2_2;
-    A[344] = 0.0225749559082891*G0_0_1 + 0.0338624338624344*G0_0_2 + 0.0338624338624339*G0_2_0 + 0.0677248677248678*G0_2_1 + 0.135449735449735*G0_2_2;
-    A[345] = -0.112874779541447*G0_0_1 - 0.101587301587302*G0_0_2 - 0.101587301587302*G0_2_0 - 0.203174603174604*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[346] = -0.0112874779541445*G0_0_2 - 0.0112874779541447*G0_2_0 - 0.0225749559082889*G0_2_2;
-    A[347] = -0.0112874779541451*G0_0_2 - 0.0112874779541445*G0_2_0 - 0.0677248677248674*G0_2_2;
-    A[348] = -0.0112874779541447*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.0225749559082891*G0_2_2;
+    A[343] = 0.0225749559082893*G0_0_1 + 0.033862433862434*G0_0_2 + 0.0338624338624336*G0_2_0 + 0.067724867724868*G0_2_1 + 0.0902998236331565*G0_2_2;
+    A[344] = 0.0225749559082892*G0_0_1 + 0.0338624338624345*G0_0_2 + 0.033862433862434*G0_2_0 + 0.067724867724868*G0_2_1 + 0.135449735449736*G0_2_2;
+    A[345] = -0.112874779541446*G0_0_1 - 0.101587301587302*G0_0_2 - 0.101587301587302*G0_2_0 - 0.203174603174603*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[346] = -0.0112874779541446*G0_0_2 - 0.0112874779541448*G0_2_0 - 0.0225749559082889*G0_2_2;
+    A[347] = -0.011287477954145*G0_0_2 - 0.0112874779541445*G0_2_0 - 0.0677248677248674*G0_2_2;
+    A[348] = -0.0112874779541446*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.022574955908289*G0_2_2;
     A[349] = 0.0902998236331564*G0_2_2;
-    A[350] = 0.00776014109347445*G0_0_0 + 0.00776014109347434*G0_0_1 + 0.00776014109347437*G0_0_2 + 0.00776014109347448*G0_1_0 + 0.00776014109347437*G0_1_1 + 0.00776014109347441*G0_1_2;
+    A[350] = 0.00776014109347435*G0_0_0 + 0.00776014109347427*G0_0_1 + 0.00776014109347429*G0_0_2 + 0.00776014109347438*G0_1_0 + 0.0077601410934743*G0_1_1 + 0.00776014109347432*G0_1_2;
     A[351] = -0.0246913580246915*G0_0_0 + 0.0458553791887126*G0_1_0;
-    A[352] = 0.017636684303351*G0_0_1 - 0.00776014109347445*G0_1_1;
-    A[353] = -0.00776014109347449*G0_0_2 - 0.00776014109347447*G0_1_2;
-    A[354] = 0.0338624338624341*G0_0_1 + 0.0451499118165789*G0_0_2 + 0.0112874779541449*G0_1_1 + 0.0112874779541451*G0_1_2;
-    A[355] = 0.0141093474426808*G0_0_1 + 0.0169312169312167*G0_0_2 + 0.00282186948853616*G0_1_1 + 0.00282186948853603*G0_1_2;
+    A[352] = 0.0176366843033511*G0_0_1 - 0.00776014109347448*G0_1_1;
+    A[353] = -0.00776014109347445*G0_0_2 - 0.00776014109347444*G0_1_2;
+    A[354] = 0.033862433862434*G0_0_1 + 0.0451499118165789*G0_0_2 + 0.0112874779541449*G0_1_1 + 0.011287477954145*G0_1_2;
+    A[355] = 0.0141093474426808*G0_0_1 + 0.0169312169312167*G0_0_2 + 0.00282186948853619*G0_1_1 + 0.00282186948853605*G0_1_2;
     A[356] = 0.0112874779541446*G0_0_1 + 0.0225749559082894*G0_0_2 + 0.0112874779541449*G0_1_1 + 0.011287477954145*G0_1_2;
-    A[357] = 0.101587301587302*G0_0_0 + 0.0790123456790124*G0_0_2 + 0.0790123456790125*G0_1_0 + 0.158024691358025*G0_1_2;
-    A[358] = -0.0423280423280427*G0_0_0 - 0.0592592592592593*G0_0_2 - 0.0310405643738982*G0_1_0 - 0.0902998236331577*G0_1_2;
+    A[357] = 0.101587301587301*G0_0_0 + 0.0790123456790121*G0_0_2 + 0.0790123456790123*G0_1_0 + 0.158024691358025*G0_1_2;
+    A[358] = -0.0423280423280426*G0_0_0 - 0.0592592592592591*G0_0_2 - 0.0310405643738982*G0_1_0 - 0.0902998236331576*G0_1_2;
     A[359] = 0.0112874779541446*G0_0_0 + 0.0338624338624335*G0_0_2 + 0.0112874779541449*G0_1_0 + 0.0451499118165785*G0_1_2;
-    A[360] = 0.203174603174603*G0_0_0 + 0.0790123456790125*G0_0_1 + 0.0790123456790125*G0_1_0 + 0.158024691358026*G0_1_1;
-    A[361] = -0.118518518518518*G0_0_0 + 0.0423280423280424*G0_0_1 - 0.0310405643738977*G0_1_0 - 0.0902998236331575*G0_1_1;
-    A[362] = 0.0451499118165791*G0_0_0 - 0.0338624338624335*G0_0_1 + 0.0112874779541451*G0_1_0 + 0.045149911816579*G0_1_1;
-    A[363] = -0.0112874779541448*G0_0_0 - 0.0112874779541447*G0_0_1 - 0.0112874779541449*G0_1_0 - 0.0112874779541448*G0_1_1;
-    A[364] = -0.00282186948853631*G0_0_0 - 0.0028218694885362*G0_0_1 - 0.00282186948853607*G0_1_0 - 0.00282186948853605*G0_1_1;
+    A[360] = 0.203174603174603*G0_0_0 + 0.0790123456790122*G0_0_1 + 0.0790123456790122*G0_1_0 + 0.158024691358025*G0_1_1;
+    A[361] = -0.118518518518518*G0_0_0 + 0.0423280423280424*G0_0_1 - 0.0310405643738976*G0_1_0 - 0.0902998236331574*G0_1_1;
+    A[362] = 0.0451499118165791*G0_0_0 - 0.0338624338624336*G0_0_1 + 0.011287477954145*G0_1_0 + 0.045149911816579*G0_1_1;
+    A[363] = -0.0112874779541447*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0112874779541449*G0_1_0 - 0.0112874779541448*G0_1_1;
+    A[364] = -0.00282186948853621*G0_0_0 - 0.00282186948853614*G0_0_1 - 0.00282186948853605*G0_1_0 - 0.00282186948853604*G0_1_1;
     A[365] = -0.0112874779541446*G0_0_0 - 0.0112874779541447*G0_0_1 - 0.0112874779541448*G0_1_0 - 0.0112874779541449*G0_1_1;
-    A[366] = -0.0225749559082898*G0_0_0 - 0.0112874779541445*G0_0_1 - 0.0225749559082896*G0_0_2 - 0.011287477954145*G0_1_0 - 0.0112874779541449*G0_1_2;
-    A[367] = -0.016931216931216*G0_0_0 - 0.00282186948853615*G0_0_1 - 0.0169312169312162*G0_0_2 - 0.00282186948853559*G0_1_0 - 0.0028218694885357*G0_1_2;
-    A[368] = -0.0451499118165791*G0_0_0 - 0.0112874779541447*G0_0_1 - 0.0451499118165789*G0_0_2 - 0.011287477954145*G0_1_0 - 0.0112874779541449*G0_1_2;
-    A[369] = -0.0225749559082889*G0_0_0 - 0.0338624338624338*G0_0_1 - 0.0338624338624338*G0_0_2 - 0.0338624338624337*G0_1_0 - 0.0451499118165787*G0_1_1 - 0.0451499118165787*G0_1_2;
-    A[370] = 0.0169312169312161*G0_0_0 + 0.0592592592592587*G0_0_1 + 0.0592592592592587*G0_0_2 + 0.0592592592592588*G0_1_0 + 0.0902998236331571*G0_1_1 + 0.0902998236331571*G0_1_2;
-    A[371] = 0.0225749559082898*G0_0_0 - 0.0790123456790124*G0_0_1 - 0.0790123456790124*G0_0_2 - 0.0790123456790122*G0_1_0 - 0.158024691358026*G0_1_1 - 0.158024691358026*G0_1_2;
-    A[372] = -0.067724867724868*G0_0_0 + 0.101587301587302*G0_0_1 + 0.203174603174603*G0_0_2 + 0.0112874779541437*G0_1_0 + 0.112874779541446*G0_1_1 + 0.112874779541446*G0_1_2;
-    A[373] = 0.0677248677248685*G0_0_0 - 0.0338624338624335*G0_0_1 - 0.0677248677248669*G0_0_2 + 0.0112874779541453*G0_1_0 - 0.022574955908289*G0_1_1 - 0.0225749559082887*G0_1_2;
-    A[374] = 0.0225749559082891*G0_0_0 - 0.0338624338624344*G0_0_1 - 0.067724867724868*G0_0_2 + 0.0112874779541448*G0_1_0 - 0.0225749559082896*G0_1_1 - 0.0225749559082895*G0_1_2;
-    A[375] = -0.0225749559082886*G0_0_0 - 0.0112874779541439*G0_0_1 - 0.0112874779541443*G0_1_0;
-    A[376] = -0.0677248677248685*G0_0_0 - 0.0112874779541456*G0_0_1 - 0.0112874779541453*G0_1_0;
-    A[377] = -0.022574955908289*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0112874779541448*G0_1_0;
-    A[378] = 0.0451499118165785*G0_0_0 + 0.0338624338624336*G0_0_1 + 0.0338624338624341*G0_1_0 + 0.022574955908289*G0_1_1;
-    A[379] = -0.135449735449735*G0_0_0 - 0.101587301587302*G0_0_1 - 0.101587301587302*G0_1_0 - 0.112874779541446*G0_1_1;
-    A[380] = 0.045149911816579*G0_0_0 + 0.0338624338624345*G0_0_1 + 0.0338624338624344*G0_1_0 + 0.0225749559082897*G0_1_1;
-    A[381] = 0.0902998236331572*G0_0_0 + 0.0338624338624342*G0_0_1 + 0.0677248677248682*G0_0_2 + 0.0338624338624343*G0_1_0 + 0.0225749559082897*G0_1_2;
-    A[382] = -0.270899470899471*G0_0_0 - 0.101587301587301*G0_0_1 - 0.203174603174603*G0_0_2 - 0.101587301587302*G0_1_0 - 0.112874779541446*G0_1_2;
-    A[383] = 0.135449735449734*G0_0_0 + 0.033862433862433*G0_0_1 + 0.0677248677248667*G0_0_2 + 0.0338624338624333*G0_1_0 + 0.0225749559082885*G0_1_2;
-    A[384] = 0.0902998236331566*G0_0_0;
-    A[385] = 0.00511463844797149*G0_0_0 + 0.0051146384479716*G0_0_1 + 0.00511463844797155*G0_0_2 + 0.00511463844797161*G0_1_0 + 0.00511463844797171*G0_1_1 + 0.00511463844797167*G0_1_2;
+    A[366] = -0.0225749559082896*G0_0_0 - 0.0112874779541443*G0_0_1 - 0.0225749559082894*G0_0_2 - 0.011287477954145*G0_1_0 - 0.0112874779541449*G0_1_2;
+    A[367] = -0.016931216931216*G0_0_0 - 0.00282186948853631*G0_0_1 - 0.0169312169312163*G0_0_2 - 0.00282186948853559*G0_1_0 - 0.00282186948853573*G0_1_2;
+    A[368] = -0.045149911816579*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0451499118165789*G0_0_2 - 0.0112874779541449*G0_1_0 - 0.0112874779541448*G0_1_2;
+    A[369] = -0.0225749559082887*G0_0_0 - 0.0338624338624337*G0_0_1 - 0.0338624338624336*G0_0_2 - 0.0338624338624335*G0_1_0 - 0.0451499118165786*G0_1_1 - 0.0451499118165785*G0_1_2;
+    A[370] = 0.016931216931216*G0_0_0 + 0.0592592592592586*G0_0_1 + 0.0592592592592586*G0_0_2 + 0.0592592592592586*G0_1_0 + 0.0902998236331569*G0_1_1 + 0.0902998236331569*G0_1_2;
+    A[371] = 0.0225749559082899*G0_0_0 - 0.0790123456790124*G0_0_1 - 0.0790123456790123*G0_0_2 - 0.0790123456790121*G0_1_0 - 0.158024691358025*G0_1_1 - 0.158024691358025*G0_1_2;
+    A[372] = -0.0677248677248681*G0_0_0 + 0.101587301587301*G0_0_1 + 0.203174603174603*G0_0_2 + 0.0112874779541437*G0_1_0 + 0.112874779541446*G0_1_1 + 0.112874779541446*G0_1_2;
+    A[373] = 0.0677248677248683*G0_0_0 - 0.0338624338624335*G0_0_1 - 0.0677248677248669*G0_0_2 + 0.0112874779541453*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0225749559082886*G0_1_2;
+    A[374] = 0.0225749559082891*G0_0_0 - 0.0338624338624342*G0_0_1 - 0.0677248677248678*G0_0_2 + 0.0112874779541449*G0_1_0 - 0.0225749559082895*G0_1_1 - 0.0225749559082894*G0_1_2;
+    A[375] = -0.0225749559082888*G0_0_0 - 0.011287477954144*G0_0_1 - 0.0112874779541444*G0_1_0;
+    A[376] = -0.0677248677248683*G0_0_0 - 0.0112874779541455*G0_0_1 - 0.0112874779541453*G0_1_0;
+    A[377] = -0.022574955908289*G0_0_0 - 0.0112874779541447*G0_0_1 - 0.0112874779541448*G0_1_0;
+    A[378] = 0.0451499118165782*G0_0_0 + 0.0338624338624334*G0_0_1 + 0.0338624338624338*G0_1_0 + 0.0225749559082887*G0_1_1;
+    A[379] = -0.135449735449735*G0_0_0 - 0.101587301587301*G0_0_1 - 0.101587301587301*G0_1_0 - 0.112874779541445*G0_1_1;
+    A[380] = 0.0451499118165788*G0_0_0 + 0.0338624338624344*G0_0_1 + 0.0338624338624343*G0_1_0 + 0.0225749559082897*G0_1_1;
+    A[381] = 0.0902998236331566*G0_0_0 + 0.0338624338624339*G0_0_1 + 0.0677248677248679*G0_0_2 + 0.0338624338624341*G0_1_0 + 0.0225749559082897*G0_1_2;
+    A[382] = -0.27089947089947*G0_0_0 - 0.1015873015873*G0_0_1 - 0.203174603174603*G0_0_2 - 0.101587301587301*G0_1_0 - 0.112874779541446*G0_1_2;
+    A[383] = 0.135449735449734*G0_0_0 + 0.033862433862433*G0_0_1 + 0.0677248677248667*G0_0_2 + 0.0338624338624332*G0_1_0 + 0.0225749559082884*G0_1_2;
+    A[384] = 0.0902998236331568*G0_0_0;
+    A[385] = 0.00511463844797147*G0_0_0 + 0.00511463844797162*G0_0_1 + 0.00511463844797157*G0_0_2 + 0.0051146384479716*G0_1_0 + 0.00511463844797172*G0_1_1 + 0.00511463844797169*G0_1_2;
     A[386] = 0.0202821869488536*G0_0_0 - 0.0326278659611995*G0_1_0;
-    A[387] = -0.0326278659611994*G0_0_1 + 0.0202821869488538*G0_1_1;
-    A[388] = -0.00511463844797172*G0_0_2 - 0.0051146384479717*G0_1_2;
-    A[389] = -0.0592592592592597*G0_0_1 - 0.0902998236331577*G0_0_2 - 0.0423280423280428*G0_1_1 - 0.031040564373898*G0_1_2;
-    A[390] = -0.0105820105820106*G0_0_1 - 0.0211640211640206*G0_0_2 - 0.0134038800705467*G0_1_1 - 0.0105820105820104*G0_1_2;
-    A[391] = 0.00282186948853626*G0_0_1 + 0.0169312169312168*G0_0_2 + 0.0028218694885361*G0_1_1 + 0.0141093474426805*G0_1_2;
-    A[392] = -0.0423280423280424*G0_0_0 - 0.0310405643738978*G0_0_2 - 0.0592592592592592*G0_1_0 - 0.0902998236331575*G0_1_2;
-    A[393] = -0.0134038800705468*G0_0_0 - 0.0105820105820107*G0_0_2 - 0.0105820105820104*G0_1_0 - 0.0211640211640206*G0_1_2;
-    A[394] = 0.00282186948853625*G0_0_0 + 0.0141093474426809*G0_0_2 + 0.00282186948853609*G0_1_0 + 0.0169312169312168*G0_1_2;
-    A[395] = -0.118518518518518*G0_0_0 - 0.0310405643738977*G0_0_1 + 0.0423280423280424*G0_1_0 - 0.0902998236331575*G0_1_1;
-    A[396] = 0.249735449735449*G0_0_0 + 0.0825396825396822*G0_0_1 + 0.0825396825396822*G0_1_0 + 0.24973544973545*G0_1_1;
-    A[397] = -0.0902998236331581*G0_0_0 + 0.0423280423280415*G0_0_1 - 0.0310405643738983*G0_1_0 - 0.118518518518519*G0_1_1;
-    A[398] = -0.00282186948853602*G0_0_0 - 0.00282186948853607*G0_0_1 - 0.00282186948853593*G0_1_0 - 0.00282186948853603*G0_1_1;
-    A[399] = -0.00917107583774226*G0_0_0 - 0.00917107583774231*G0_0_1 - 0.00917107583774233*G0_1_0 - 0.00917107583774233*G0_1_1;
-    A[400] = -0.00282186948853629*G0_0_0 - 0.00282186948853624*G0_0_1 - 0.00282186948853613*G0_1_0 - 0.00282186948853609*G0_1_1;
-    A[401] = -0.0169312169312158*G0_0_0 - 0.0141093474426803*G0_0_1 - 0.0169312169312162*G0_0_2 - 0.0141093474426798*G0_1_0 - 0.0112874779541446*G0_1_1 - 0.0141093474426802*G0_1_2;
-    A[402] = 0.0211640211640193*G0_0_0 + 0.0105820105820102*G0_0_1 + 0.0211640211640199*G0_0_2 + 0.0105820105820095*G0_1_0 - 0.0028218694885359*G0_1_1 + 0.0105820105820098*G0_1_2;
-    A[403] = 0.0902998236331582*G0_0_0 + 0.0310405643738979*G0_0_1 + 0.0902998236331579*G0_0_2 + 0.0310405643738984*G0_1_0 - 0.011287477954145*G0_1_1 + 0.0310405643738981*G0_1_2;
-    A[404] = -0.0112874779541444*G0_0_0 - 0.0141093474426804*G0_0_1 - 0.0141093474426804*G0_0_2 - 0.0141093474426805*G0_1_0 - 0.0169312169312163*G0_1_1 - 0.0169312169312162*G0_1_2;
-    A[405] = -0.00282186948853589*G0_0_0 + 0.0105820105820107*G0_0_1 + 0.0105820105820107*G0_0_2 + 0.0105820105820104*G0_1_0 + 0.0211640211640206*G0_1_1 + 0.0211640211640206*G0_1_2;
-    A[406] = -0.0112874779541448*G0_0_0 + 0.0310405643738977*G0_0_1 + 0.0310405643738977*G0_0_2 + 0.031040564373898*G0_1_0 + 0.0902998236331576*G0_1_1 + 0.0902998236331575*G0_1_2;
-    A[407] = 0.118518518518518*G0_0_0 - 0.0423280423280426*G0_0_1 + 0.0507936507936507*G0_0_2 + 0.0931216931216937*G0_1_0 - 0.0846560846560841*G0_1_1 + 0.186243386243387*G0_1_2;
-    A[408] = -0.084656084656086*G0_0_0 + 0.0931216931216923*G0_0_1 + 0.186243386243384*G0_0_2 - 0.0423280423280434*G0_1_0 + 0.118518518518518*G0_1_1 + 0.0507936507936494*G0_1_2;
-    A[409] = -0.0169312169312168*G0_0_0 - 0.0197530864197531*G0_0_1 - 0.0846560846560848*G0_0_2 - 0.0197530864197532*G0_1_0 - 0.0169312169312169*G0_1_1 - 0.0846560846560846*G0_1_2;
-    A[410] = 0.0169312169312155*G0_0_0 + 0.0197530864197522*G0_0_1 + 0.0197530864197521*G0_1_0 + 0.0225749559082885*G0_1_1;
-    A[411] = 0.084656084656086*G0_0_0 + 0.0423280423280437*G0_0_1 + 0.0423280423280435*G0_1_0 + 0.0225749559082904*G0_1_1;
-    A[412] = 0.0169312169312168*G0_0_0 + 0.0197530864197528*G0_0_1 + 0.0197530864197531*G0_1_0 + 0.022574955908289*G0_1_1;
-    A[413] = 0.0225749559082892*G0_0_0 + 0.0197530864197527*G0_0_1 + 0.0197530864197529*G0_1_0 + 0.0169312169312168*G0_1_1;
-    A[414] = 0.0225749559082893*G0_0_0 + 0.0423280423280427*G0_0_1 + 0.0423280423280423*G0_1_0 + 0.0846560846560838*G0_1_1;
-    A[415] = 0.0225749559082891*G0_0_0 + 0.0197530864197531*G0_0_1 + 0.0197530864197528*G0_1_0 + 0.0169312169312168*G0_1_1;
-    A[416] = 0.067724867724866*G0_0_0 + 0.0649029982363297*G0_0_1 + 0.0846560846560822*G0_0_2 + 0.0649029982363296*G0_1_0 + 0.067724867724866*G0_1_1 + 0.0846560846560826*G0_1_2;
-    A[417] = 0.0677248677248683*G0_0_0 - 0.093121693121693*G0_0_1 - 0.0507936507936504*G0_0_2 - 0.0931216931216923*G0_1_0 - 0.270899470899471*G0_1_1 - 0.186243386243387*G0_1_2;
-    A[418] = -0.270899470899469*G0_0_0 - 0.0931216931216907*G0_0_1 - 0.186243386243384*G0_0_2 - 0.0931216931216917*G0_1_0 + 0.0677248677248699*G0_1_1 - 0.0507936507936492*G0_1_2;
+    A[387] = -0.0326278659611995*G0_0_1 + 0.0202821869488538*G0_1_1;
+    A[388] = -0.00511463844797171*G0_0_2 - 0.0051146384479717*G0_1_2;
+    A[389] = -0.0592592592592598*G0_0_1 - 0.0902998236331577*G0_0_2 - 0.0423280423280428*G0_1_1 - 0.0310405643738979*G0_1_2;
+    A[390] = -0.0105820105820105*G0_0_1 - 0.0211640211640205*G0_0_2 - 0.0134038800705467*G0_1_1 - 0.0105820105820104*G0_1_2;
+    A[391] = 0.00282186948853622*G0_0_1 + 0.0169312169312167*G0_0_2 + 0.0028218694885361*G0_1_1 + 0.0141093474426806*G0_1_2;
+    A[392] = -0.0423280423280423*G0_0_0 - 0.0310405643738978*G0_0_2 - 0.0592592592592591*G0_1_0 - 0.0902998236331574*G0_1_2;
+    A[393] = -0.0134038800705469*G0_0_0 - 0.0105820105820108*G0_0_2 - 0.0105820105820105*G0_1_0 - 0.0211640211640207*G0_1_2;
+    A[394] = 0.00282186948853621*G0_0_0 + 0.0141093474426809*G0_0_2 + 0.00282186948853609*G0_1_0 + 0.0169312169312168*G0_1_2;
+    A[395] = -0.118518518518518*G0_0_0 - 0.0310405643738976*G0_0_1 + 0.0423280423280424*G0_1_0 - 0.0902998236331574*G0_1_1;
+    A[396] = 0.24973544973545*G0_0_0 + 0.0825396825396821*G0_0_1 + 0.0825396825396821*G0_1_0 + 0.24973544973545*G0_1_1;
+    A[397] = -0.0902998236331582*G0_0_0 + 0.0423280423280416*G0_0_1 - 0.0310405643738982*G0_1_0 - 0.118518518518519*G0_1_1;
+    A[398] = -0.00282186948853596*G0_0_0 - 0.00282186948853606*G0_0_1 - 0.00282186948853583*G0_1_0 - 0.00282186948853588*G0_1_1;
+    A[399] = -0.00917107583774233*G0_0_0 - 0.00917107583774233*G0_0_1 - 0.00917107583774237*G0_1_0 - 0.00917107583774235*G0_1_1;
+    A[400] = -0.00282186948853625*G0_0_0 - 0.00282186948853619*G0_0_1 - 0.00282186948853613*G0_1_0 - 0.00282186948853608*G0_1_1;
+    A[401] = -0.0169312169312157*G0_0_0 - 0.0141093474426804*G0_0_1 - 0.0169312169312162*G0_0_2 - 0.0141093474426797*G0_1_0 - 0.0112874779541445*G0_1_1 - 0.01410934744268*G0_1_2;
+    A[402] = 0.0211640211640193*G0_0_0 + 0.0105820105820103*G0_0_1 + 0.0211640211640199*G0_0_2 + 0.0105820105820094*G0_1_0 - 0.00282186948853578*G0_1_1 + 0.0105820105820099*G0_1_2;
+    A[403] = 0.0902998236331583*G0_0_0 + 0.0310405643738979*G0_0_1 + 0.090299823633158*G0_0_2 + 0.0310405643738983*G0_1_0 - 0.0112874779541451*G0_1_1 + 0.031040564373898*G0_1_2;
+    A[404] = -0.0112874779541443*G0_0_0 - 0.0141093474426804*G0_0_1 - 0.0141093474426804*G0_0_2 - 0.0141093474426804*G0_1_0 - 0.0169312169312161*G0_1_1 - 0.0169312169312161*G0_1_2;
+    A[405] = -0.00282186948853602*G0_0_0 + 0.0105820105820107*G0_0_1 + 0.0105820105820107*G0_0_2 + 0.0105820105820105*G0_1_0 + 0.0211640211640206*G0_1_1 + 0.0211640211640206*G0_1_2;
+    A[406] = -0.0112874779541447*G0_0_0 + 0.0310405643738978*G0_0_1 + 0.0310405643738977*G0_0_2 + 0.0310405643738978*G0_1_0 + 0.0902998236331575*G0_1_1 + 0.0902998236331575*G0_1_2;
+    A[407] = 0.118518518518518*G0_0_0 - 0.0423280423280426*G0_0_1 + 0.0507936507936509*G0_0_2 + 0.0931216931216936*G0_1_0 - 0.0846560846560842*G0_1_1 + 0.186243386243387*G0_1_2;
+    A[408] = -0.0846560846560858*G0_0_0 + 0.0931216931216923*G0_0_1 + 0.186243386243384*G0_0_2 - 0.0423280423280434*G0_1_0 + 0.118518518518518*G0_1_1 + 0.0507936507936493*G0_1_2;
+    A[409] = -0.0169312169312168*G0_0_0 - 0.0197530864197532*G0_0_1 - 0.084656084656085*G0_0_2 - 0.0197530864197532*G0_1_0 - 0.016931216931217*G0_1_1 - 0.0846560846560847*G0_1_2;
+    A[410] = 0.0169312169312157*G0_0_0 + 0.0197530864197523*G0_0_1 + 0.0197530864197522*G0_1_0 + 0.0225749559082883*G0_1_1;
+    A[411] = 0.0846560846560858*G0_0_0 + 0.0423280423280437*G0_0_1 + 0.0423280423280434*G0_1_0 + 0.0225749559082905*G0_1_1;
+    A[412] = 0.0169312169312168*G0_0_0 + 0.0197530864197528*G0_0_1 + 0.0197530864197532*G0_1_0 + 0.022574955908289*G0_1_1;
+    A[413] = 0.0225749559082891*G0_0_0 + 0.0197530864197527*G0_0_1 + 0.0197530864197528*G0_1_0 + 0.0169312169312167*G0_1_1;
+    A[414] = 0.0225749559082892*G0_0_0 + 0.0423280423280426*G0_0_1 + 0.0423280423280422*G0_1_0 + 0.0846560846560838*G0_1_1;
+    A[415] = 0.0225749559082893*G0_0_0 + 0.0197530864197532*G0_0_1 + 0.0197530864197529*G0_1_0 + 0.0169312169312169*G0_1_1;
+    A[416] = 0.0677248677248662*G0_0_0 + 0.0649029982363296*G0_0_1 + 0.0846560846560823*G0_0_2 + 0.0649029982363293*G0_1_0 + 0.0677248677248654*G0_1_1 + 0.0846560846560822*G0_1_2;
+    A[417] = 0.067724867724868*G0_0_0 - 0.0931216931216931*G0_0_1 - 0.0507936507936504*G0_0_2 - 0.0931216931216921*G0_1_0 - 0.270899470899471*G0_1_1 - 0.186243386243386*G0_1_2;
+    A[418] = -0.270899470899469*G0_0_0 - 0.0931216931216906*G0_0_1 - 0.186243386243384*G0_0_2 - 0.0931216931216915*G0_1_0 + 0.0677248677248701*G0_1_1 - 0.050793650793649*G0_1_2;
     A[419] = -0.135449735449734*G0_0_0 - 0.112874779541445*G0_0_1 - 0.112874779541446*G0_1_0 - 0.135449735449735*G0_1_1;
-    A[420] = 0.00776014109347443*G0_0_0 + 0.00776014109347443*G0_0_1 + 0.00776014109347447*G0_0_2 + 0.00776014109347429*G0_1_0 + 0.00776014109347431*G0_1_1 + 0.00776014109347433*G0_1_2;
-    A[421] = -0.00776014109347453*G0_0_0 + 0.017636684303351*G0_1_0;
-    A[422] = 0.0458553791887126*G0_0_1 - 0.0246913580246915*G0_1_1;
-    A[423] = -0.00776014109347452*G0_0_2 - 0.00776014109347452*G0_1_2;
-    A[424] = 0.0790123456790129*G0_0_1 + 0.158024691358025*G0_0_2 + 0.101587301587302*G0_1_1 + 0.0790123456790123*G0_1_2;
-    A[425] = -0.031040564373898*G0_0_1 - 0.0902998236331573*G0_0_2 - 0.0423280423280425*G0_1_1 - 0.0592592592592593*G0_1_2;
-    A[426] = 0.0112874779541446*G0_0_1 + 0.0451499118165784*G0_0_2 + 0.0112874779541447*G0_1_1 + 0.0338624338624339*G0_1_2;
-    A[427] = 0.0112874779541449*G0_0_0 + 0.0112874779541447*G0_0_2 + 0.033862433862434*G0_1_0 + 0.0451499118165786*G0_1_2;
-    A[428] = 0.00282186948853602*G0_0_0 + 0.00282186948853624*G0_0_2 + 0.0141093474426805*G0_1_0 + 0.0169312169312169*G0_1_2;
-    A[429] = 0.0112874779541446*G0_0_0 + 0.0112874779541446*G0_0_2 + 0.0112874779541447*G0_1_0 + 0.0225749559082892*G0_1_2;
-    A[430] = 0.0451499118165791*G0_0_0 + 0.0112874779541451*G0_0_1 - 0.0338624338624335*G0_1_0 + 0.045149911816579*G0_1_1;
-    A[431] = -0.0902998236331581*G0_0_0 - 0.0310405643738983*G0_0_1 + 0.0423280423280415*G0_1_0 - 0.118518518518519*G0_1_1;
-    A[432] = 0.158024691358026*G0_0_0 + 0.0790123456790134*G0_0_1 + 0.0790123456790134*G0_1_0 + 0.203174603174604*G0_1_1;
-    A[433] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0112874779541446*G0_1_0 - 0.0112874779541446*G0_1_1;
-    A[434] = -0.00282186948853649*G0_0_0 - 0.00282186948853641*G0_0_1 - 0.00282186948853643*G0_1_0 - 0.00282186948853638*G0_1_1;
-    A[435] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0112874779541447*G0_1_0 - 0.0112874779541447*G0_1_1;
-    A[436] = -0.0451499118165788*G0_0_0 - 0.0338624338624339*G0_0_1 - 0.0451499118165786*G0_0_2 - 0.033862433862434*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0338624338624338*G0_1_2;
-    A[437] = 0.090299823633158*G0_0_0 + 0.0592592592592595*G0_0_1 + 0.0902998236331575*G0_0_2 + 0.0592592592592598*G0_1_0 + 0.0169312169312165*G0_1_1 + 0.0592592592592594*G0_1_2;
-    A[438] = -0.158024691358026*G0_0_0 - 0.0790123456790129*G0_0_1 - 0.158024691358026*G0_0_2 - 0.0790123456790134*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.0790123456790131*G0_1_2;
-    A[439] = -0.0112874779541446*G0_0_1 - 0.0112874779541445*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.0225749559082894*G0_1_1 - 0.0225749559082894*G0_1_2;
-    A[440] = -0.00282186948853625*G0_0_1 - 0.0028218694885361*G0_0_2 - 0.00282186948853601*G0_1_0 - 0.016931216931217*G0_1_1 - 0.0169312169312168*G0_1_2;
-    A[441] = -0.0112874779541449*G0_0_1 - 0.0112874779541447*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.0451499118165789*G0_1_1 - 0.0451499118165788*G0_1_2;
-    A[442] = -0.0225749559082899*G0_0_0 + 0.0112874779541449*G0_0_1 - 0.0225749559082894*G0_0_2 - 0.0338624338624349*G0_1_0 + 0.0677248677248677*G0_1_1 - 0.0677248677248681*G0_1_2;
-    A[443] = 0.112874779541447*G0_0_0 + 0.0112874779541444*G0_0_1 + 0.112874779541448*G0_0_2 + 0.101587301587302*G0_1_0 - 0.0677248677248682*G0_1_1 + 0.203174603174604*G0_1_2;
-    A[444] = -0.0225749559082895*G0_0_0 + 0.0112874779541446*G0_0_1 - 0.0225749559082898*G0_0_2 - 0.033862433862434*G0_1_0 + 0.0225749559082891*G0_1_1 - 0.0677248677248683*G0_1_2;
-    A[445] = 0.0225749559082895*G0_0_0 + 0.0338624338624341*G0_0_1 + 0.0338624338624341*G0_1_0 + 0.0451499118165788*G0_1_1;
-    A[446] = -0.112874779541447*G0_0_0 - 0.101587301587303*G0_0_1 - 0.101587301587302*G0_1_0 - 0.135449735449736*G0_1_1;
-    A[447] = 0.0225749559082896*G0_0_0 + 0.0338624338624344*G0_0_1 + 0.033862433862434*G0_1_0 + 0.0451499118165789*G0_1_1;
-    A[448] = -0.0112874779541451*G0_0_1 - 0.011287477954145*G0_1_0 - 0.0225749559082901*G0_1_1;
-    A[449] = -0.0112874779541451*G0_0_1 - 0.0112874779541444*G0_1_0 - 0.0677248677248675*G0_1_1;
-    A[450] = -0.0112874779541445*G0_0_1 - 0.0112874779541441*G0_1_0 - 0.0225749559082889*G0_1_1;
-    A[451] = 0.0338624338624344*G0_0_1 + 0.0225749559082897*G0_0_2 + 0.0338624338624339*G0_1_0 + 0.0902998236331574*G0_1_1 + 0.0677248677248677*G0_1_2;
-    A[452] = 0.0338624338624344*G0_0_1 + 0.022574955908289*G0_0_2 + 0.0338624338624336*G0_1_0 + 0.135449735449736*G0_1_1 + 0.067724867724868*G0_1_2;
+    A[420] = 0.00776014109347444*G0_0_0 + 0.00776014109347441*G0_0_1 + 0.00776014109347444*G0_0_2 + 0.00776014109347428*G0_1_0 + 0.00776014109347429*G0_1_1 + 0.00776014109347431*G0_1_2;
+    A[421] = -0.00776014109347453*G0_0_0 + 0.0176366843033509*G0_1_0;
+    A[422] = 0.0458553791887127*G0_0_1 - 0.0246913580246915*G0_1_1;
+    A[423] = -0.0077601410934745*G0_0_2 - 0.0077601410934745*G0_1_2;
+    A[424] = 0.0790123456790129*G0_0_1 + 0.158024691358025*G0_0_2 + 0.101587301587302*G0_1_1 + 0.0790123456790122*G0_1_2;
+    A[425] = -0.0310405643738979*G0_0_1 - 0.0902998236331573*G0_0_2 - 0.0423280423280425*G0_1_1 - 0.0592592592592592*G0_1_2;
+    A[426] = 0.0112874779541446*G0_0_1 + 0.0451499118165784*G0_0_2 + 0.0112874779541447*G0_1_1 + 0.0338624338624337*G0_1_2;
+    A[427] = 0.0112874779541448*G0_0_0 + 0.0112874779541446*G0_0_2 + 0.0338624338624339*G0_1_0 + 0.0451499118165785*G0_1_2;
+    A[428] = 0.00282186948853608*G0_0_0 + 0.00282186948853642*G0_0_2 + 0.0141093474426806*G0_1_0 + 0.016931216931217*G0_1_2;
+    A[429] = 0.0112874779541446*G0_0_0 + 0.0112874779541444*G0_0_2 + 0.0112874779541447*G0_1_0 + 0.0225749559082891*G0_1_2;
+    A[430] = 0.0451499118165791*G0_0_0 + 0.011287477954145*G0_0_1 - 0.0338624338624336*G0_1_0 + 0.045149911816579*G0_1_1;
+    A[431] = -0.0902998236331582*G0_0_0 - 0.0310405643738982*G0_0_1 + 0.0423280423280416*G0_1_0 - 0.118518518518519*G0_1_1;
+    A[432] = 0.158024691358026*G0_0_0 + 0.0790123456790133*G0_0_1 + 0.0790123456790133*G0_1_0 + 0.203174603174604*G0_1_1;
+    A[433] = -0.0112874779541447*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0112874779541447*G0_1_0 - 0.0112874779541446*G0_1_1;
+    A[434] = -0.00282186948853641*G0_0_0 - 0.00282186948853641*G0_0_1 - 0.00282186948853639*G0_1_0 - 0.00282186948853638*G0_1_1;
+    A[435] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0112874779541446*G0_1_0 - 0.0112874779541447*G0_1_1;
+    A[436] = -0.0451499118165789*G0_0_0 - 0.0338624338624339*G0_0_1 - 0.0451499118165786*G0_0_2 - 0.0338624338624341*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0338624338624338*G0_1_2;
+    A[437] = 0.0902998236331581*G0_0_0 + 0.0592592592592594*G0_0_1 + 0.0902998236331575*G0_0_2 + 0.0592592592592599*G0_1_0 + 0.0169312169312165*G0_1_1 + 0.0592592592592594*G0_1_2;
+    A[438] = -0.158024691358026*G0_0_0 - 0.0790123456790129*G0_0_1 - 0.158024691358026*G0_0_2 - 0.0790123456790133*G0_1_0 + 0.0225749559082895*G0_1_1 - 0.0790123456790129*G0_1_2;
+    A[439] = -0.0112874779541447*G0_0_1 - 0.0112874779541445*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.0225749559082895*G0_1_1 - 0.0225749559082894*G0_1_2;
+    A[440] = -0.00282186948853627*G0_0_1 - 0.00282186948853608*G0_0_2 - 0.00282186948853603*G0_1_0 - 0.016931216931217*G0_1_1 - 0.0169312169312168*G0_1_2;
+    A[441] = -0.011287477954145*G0_0_1 - 0.0112874779541447*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.0451499118165788*G0_1_1 - 0.0451499118165787*G0_1_2;
+    A[442] = -0.02257495590829*G0_0_0 + 0.0112874779541449*G0_0_1 - 0.0225749559082895*G0_0_2 - 0.0338624338624348*G0_1_0 + 0.0677248677248677*G0_1_1 - 0.0677248677248682*G0_1_2;
+    A[443] = 0.112874779541447*G0_0_0 + 0.0112874779541445*G0_0_1 + 0.112874779541448*G0_0_2 + 0.101587301587302*G0_1_0 - 0.0677248677248682*G0_1_1 + 0.203174603174604*G0_1_2;
+    A[444] = -0.0225749559082895*G0_0_0 + 0.0112874779541445*G0_0_1 - 0.0225749559082896*G0_0_2 - 0.033862433862434*G0_1_0 + 0.0225749559082891*G0_1_1 - 0.0677248677248683*G0_1_2;
+    A[445] = 0.0225749559082893*G0_0_0 + 0.0338624338624342*G0_0_1 + 0.033862433862434*G0_1_0 + 0.0451499118165789*G0_1_1;
+    A[446] = -0.112874779541447*G0_0_0 - 0.101587301587303*G0_0_1 - 0.101587301587302*G0_1_0 - 0.135449735449737*G0_1_1;
+    A[447] = 0.0225749559082896*G0_0_0 + 0.0338624338624344*G0_0_1 + 0.0338624338624341*G0_1_0 + 0.0451499118165788*G0_1_1;
+    A[448] = -0.0112874779541452*G0_0_1 - 0.011287477954145*G0_1_0 - 0.0225749559082901*G0_1_1;
+    A[449] = -0.0112874779541451*G0_0_1 - 0.0112874779541442*G0_1_0 - 0.0677248677248675*G0_1_1;
+    A[450] = -0.0112874779541444*G0_0_1 - 0.0112874779541442*G0_1_0 - 0.0225749559082889*G0_1_1;
+    A[451] = 0.0338624338624344*G0_0_1 + 0.0225749559082896*G0_0_2 + 0.033862433862434*G0_1_0 + 0.0902998236331577*G0_1_1 + 0.0677248677248677*G0_1_2;
+    A[452] = 0.0338624338624345*G0_0_1 + 0.022574955908289*G0_0_2 + 0.0338624338624336*G0_1_0 + 0.135449735449736*G0_1_1 + 0.0677248677248679*G0_1_2;
     A[453] = -0.101587301587303*G0_0_1 - 0.112874779541447*G0_0_2 - 0.101587301587301*G0_1_0 - 0.270899470899472*G0_1_1 - 0.203174603174604*G0_1_2;
-    A[454] = 0.0902998236331585*G0_1_1;
-    A[455] = -0.024691358024691*G0_0_0 - 0.0246913580246911*G0_0_1 - 0.0246913580246911*G0_0_2 - 0.0246913580246911*G0_1_0 - 0.0246913580246911*G0_1_1 - 0.0246913580246911*G0_1_2 - 0.0705467372134042*G0_2_0 - 0.0705467372134042*G0_2_1 - 0.0705467372134042*G0_2_2;
-    A[456] = 0.00776014109347461*G0_0_0 + 0.0077601410934746*G0_1_0;
-    A[457] = 0.00776014109347453*G0_0_1 + 0.0077601410934745*G0_1_1;
+    A[454] = 0.0902998236331586*G0_1_1;
+    A[455] = -0.024691358024691*G0_0_0 - 0.024691358024691*G0_0_1 - 0.024691358024691*G0_0_2 - 0.024691358024691*G0_1_0 - 0.0246913580246911*G0_1_1 - 0.0246913580246911*G0_1_2 - 0.0705467372134042*G0_2_0 - 0.0705467372134042*G0_2_1 - 0.0705467372134042*G0_2_2;
+    A[456] = 0.00776014109347463*G0_0_0 + 0.00776014109347459*G0_1_0;
+    A[457] = 0.0077601410934745*G0_0_1 + 0.00776014109347451*G0_1_1;
     A[458] = -0.0176366843033511*G0_0_2 - 0.0176366843033511*G0_1_2 - 0.0253968253968255*G0_2_2;
-    A[459] = -0.0225749559082895*G0_0_1 - 0.0112874779541447*G0_0_2 - 0.0225749559082894*G0_1_1 - 0.0112874779541447*G0_1_2 - 0.0112874779541447*G0_2_1;
-    A[460] = -0.0169312169312165*G0_0_1 - 0.0141093474426806*G0_0_2 - 0.0169312169312165*G0_1_1 - 0.0141093474426805*G0_1_2 - 0.0141093474426804*G0_2_1 - 0.0112874779541443*G0_2_2;
-    A[461] = -0.0451499118165792*G0_0_1 - 0.0338624338624342*G0_0_2 - 0.045149911816579*G0_1_1 - 0.0338624338624342*G0_1_2 - 0.033862433862434*G0_2_1 - 0.0225749559082893*G0_2_2;
-    A[462] = -0.0225749559082895*G0_0_0 - 0.0112874779541447*G0_0_2 - 0.0225749559082894*G0_1_0 - 0.0112874779541446*G0_1_2 - 0.0112874779541444*G0_2_0;
-    A[463] = -0.0169312169312158*G0_0_0 - 0.0141093474426802*G0_0_2 - 0.0169312169312161*G0_1_0 - 0.0141093474426804*G0_1_2 - 0.0141093474426803*G0_2_0 - 0.0112874779541442*G0_2_2;
-    A[464] = -0.0451499118165793*G0_0_0 - 0.0338624338624341*G0_0_2 - 0.0451499118165791*G0_1_0 - 0.033862433862434*G0_1_2 - 0.0338624338624342*G0_2_0 - 0.0225749559082894*G0_2_2;
-    A[465] = -0.0112874779541448*G0_0_0 - 0.0112874779541449*G0_0_1 - 0.0112874779541447*G0_1_0 - 0.0112874779541448*G0_1_1;
-    A[466] = -0.00282186948853603*G0_0_0 - 0.00282186948853593*G0_0_1 - 0.00282186948853607*G0_1_0 - 0.00282186948853603*G0_1_1;
-    A[467] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0112874779541446*G0_1_0 - 0.0112874779541446*G0_1_1;
-    A[468] = 0.203174603174603*G0_0_0 + 0.203174603174603*G0_0_1 + 0.124162257495591*G0_0_2 + 0.203174603174603*G0_1_0 + 0.203174603174603*G0_1_1 + 0.124162257495591*G0_1_2 + 0.124162257495591*G0_2_0 + 0.124162257495591*G0_2_1 + 0.203174603174604*G0_2_2;
-    A[469] = -0.118518518518519*G0_0_0 - 0.118518518518519*G0_0_1 - 0.160846560846561*G0_0_2 - 0.118518518518519*G0_1_0 - 0.118518518518519*G0_1_1 - 0.160846560846561*G0_1_2 - 0.0874779541446206*G0_2_0 - 0.0874779541446205*G0_2_1 - 0.220105820105821*G0_2_2;
-    A[470] = 0.0451499118165792*G0_0_0 + 0.0451499118165793*G0_0_1 + 0.0790123456790128*G0_0_2 + 0.0451499118165791*G0_1_0 + 0.0451499118165791*G0_1_1 + 0.0790123456790127*G0_1_2 + 0.0338624338624341*G0_2_0 + 0.0338624338624341*G0_2_1 + 0.112874779541446*G0_2_2;
-    A[471] = 0.101587301587301*G0_0_0 + 0.0225749559082888*G0_0_1 + 0.101587301587301*G0_0_2 + 0.101587301587302*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.101587301587301*G0_1_2 + 0.022574955908289*G0_2_0 + 0.101587301587302*G0_2_1 + 0.022574955908289*G0_2_2;
-    A[472] = -0.0423280423280422*G0_0_0 + 0.0169312169312172*G0_0_1 - 0.0423280423280422*G0_0_2 - 0.0423280423280423*G0_1_0 + 0.0169312169312171*G0_1_1 - 0.0423280423280423*G0_1_2 - 0.0112874779541445*G0_2_0 - 0.0423280423280429*G0_2_1 - 0.0112874779541445*G0_2_2;
-    A[473] = 0.0112874779541446*G0_0_0 - 0.0225749559082893*G0_0_1 + 0.0112874779541445*G0_0_2 + 0.0112874779541446*G0_1_0 - 0.0225749559082892*G0_1_1 + 0.0112874779541445*G0_1_2 + 0.0112874779541449*G0_2_1;
-    A[474] = 0.0225749559082886*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.0225749559082886*G0_1_0 + 0.101587301587301*G0_1_1 + 0.101587301587301*G0_1_2 + 0.101587301587302*G0_2_0 + 0.0225749559082891*G0_2_1 + 0.0225749559082891*G0_2_2;
-    A[475] = 0.0169312169312175*G0_0_0 - 0.0423280423280419*G0_0_1 - 0.0423280423280419*G0_0_2 + 0.0169312169312175*G0_1_0 - 0.042328042328042*G0_1_1 - 0.042328042328042*G0_1_2 - 0.0423280423280432*G0_2_0 - 0.0112874779541446*G0_2_1 - 0.0112874779541446*G0_2_2;
-    A[476] = -0.0225749559082896*G0_0_0 + 0.0112874779541446*G0_0_1 + 0.0112874779541446*G0_0_2 - 0.0225749559082896*G0_1_0 + 0.0112874779541445*G0_1_1 + 0.0112874779541445*G0_1_2 + 0.011287477954145*G0_2_0;
-    A[477] = -0.0225749559082885*G0_0_0 - 0.0225749559082882*G0_0_1 - 0.0112874779541444*G0_0_2 - 0.0225749559082889*G0_1_0 - 0.0225749559082884*G0_1_1 - 0.0112874779541446*G0_1_2 - 0.0112874779541444*G0_2_0 - 0.0112874779541436*G0_2_1;
-    A[478] = -0.0225749559082895*G0_0_0 - 0.0225749559082897*G0_0_1 - 0.0112874779541448*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.0225749559082896*G0_1_1 - 0.0112874779541447*G0_1_2 - 0.0112874779541444*G0_2_0 - 0.0112874779541449*G0_2_1;
-    A[479] = -0.0677248677248682*G0_0_0 - 0.0677248677248676*G0_0_1 - 0.056437389770723*G0_0_2 - 0.0677248677248681*G0_1_0 - 0.0677248677248678*G0_1_1 - 0.0564373897707232*G0_1_2 - 0.0564373897707231*G0_2_0 - 0.0564373897707231*G0_2_1 - 0.0451499118165785*G0_2_2;
-    A[480] = -0.0677248677248671*G0_0_0 - 0.270899470899471*G0_0_1 - 0.169312169312169*G0_0_2 - 0.0677248677248674*G0_1_0 - 0.270899470899471*G0_1_1 - 0.169312169312169*G0_1_2 - 0.0790123456790113*G0_2_0 - 0.169312169312169*G0_2_1 - 0.067724867724867*G0_2_2;
-    A[481] = 0.0225749559082895*G0_0_0 + 0.0902998236331572*G0_0_1 + 0.0564373897707232*G0_0_2 + 0.0225749559082893*G0_1_0 + 0.0902998236331573*G0_1_1 + 0.0564373897707232*G0_1_2 + 0.0112874779541444*G0_2_0 + 0.0564373897707227*G0_2_1 + 0.022574955908289*G0_2_2;
-    A[482] = 0.0677248677248681*G0_0_0 + 0.135449735449735*G0_0_1 + 0.101587301587301*G0_0_2 + 0.067724867724868*G0_1_0 + 0.135449735449735*G0_1_1 + 0.101587301587301*G0_1_2 + 0.056437389770723*G0_2_0 + 0.101587301587301*G0_2_1 + 0.0677248677248672*G0_2_2;
-    A[483] = -0.270899470899471*G0_0_0 - 0.0677248677248669*G0_0_1 - 0.169312169312169*G0_0_2 - 0.270899470899471*G0_1_0 - 0.0677248677248672*G0_1_1 - 0.169312169312169*G0_1_2 - 0.169312169312169*G0_2_0 - 0.0790123456790114*G0_2_1 - 0.067724867724867*G0_2_2;
-    A[484] = 0.0902998236331567*G0_0_0 + 0.0225749559082885*G0_0_1 + 0.0564373897707221*G0_0_2 + 0.0902998236331567*G0_1_0 + 0.0225749559082887*G0_1_1 + 0.0564373897707223*G0_1_2 + 0.0564373897707224*G0_2_0 + 0.0112874779541438*G0_2_1 + 0.0225749559082889*G0_2_2;
-    A[485] = 0.135449735449735*G0_0_0 + 0.0677248677248676*G0_0_1 + 0.101587301587301*G0_0_2 + 0.135449735449735*G0_1_0 + 0.0677248677248678*G0_1_1 + 0.101587301587301*G0_1_2 + 0.101587301587301*G0_2_0 + 0.0564373897707232*G0_2_1 + 0.0677248677248672*G0_2_2;
-    A[486] = -0.135449735449735*G0_0_0 - 0.135449735449735*G0_0_1 - 0.0338624338624334*G0_0_2 - 0.135449735449735*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0338624338624337*G0_1_2 - 0.0338624338624335*G0_2_0 - 0.0338624338624337*G0_2_1 - 0.045149911816578*G0_2_2;
-    A[487] = 0.0451499118165786*G0_0_0 + 0.0451499118165783*G0_0_1 + 0.0112874779541445*G0_0_2 + 0.0451499118165787*G0_1_0 + 0.0451499118165784*G0_1_1 + 0.0112874779541447*G0_1_2 + 0.0112874779541442*G0_2_0 + 0.0112874779541448*G0_2_1;
-    A[488] = 0.0451499118165783*G0_0_0 + 0.0451499118165782*G0_0_1 + 0.0112874779541446*G0_0_2 + 0.0451499118165784*G0_1_0 + 0.0451499118165782*G0_1_1 + 0.0112874779541445*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541445*G0_2_1;
-    A[489] = 0.0902998236331556*G0_0_0 + 0.0902998236331562*G0_0_1 + 0.0902998236331567*G0_0_2 + 0.0902998236331563*G0_1_0 + 0.0902998236331565*G0_1_1 + 0.0902998236331571*G0_1_2 + 0.0902998236331557*G0_2_0 + 0.0902998236331562*G0_2_1 + 0.0902998236331565*G0_2_2;
-    A[490] = 0.0202821869488534*G0_0_0 + 0.0202821869488534*G0_0_1 + 0.0202821869488535*G0_0_2 + 0.0202821869488535*G0_1_0 + 0.0202821869488535*G0_1_1 + 0.0202821869488535*G0_1_2 + 0.0529100529100532*G0_2_0 + 0.0529100529100532*G0_2_1 + 0.0529100529100532*G0_2_2;
+    A[459] = -0.0225749559082895*G0_0_1 - 0.0112874779541448*G0_0_2 - 0.0225749559082894*G0_1_1 - 0.0112874779541447*G0_1_2 - 0.0112874779541446*G0_2_1;
+    A[460] = -0.0169312169312166*G0_0_1 - 0.0141093474426806*G0_0_2 - 0.0169312169312166*G0_1_1 - 0.0141093474426807*G0_1_2 - 0.0141093474426805*G0_2_1 - 0.0112874779541444*G0_2_2;
+    A[461] = -0.0451499118165792*G0_0_1 - 0.0338624338624342*G0_0_2 - 0.045149911816579*G0_1_1 - 0.0338624338624341*G0_1_2 - 0.033862433862434*G0_2_1 - 0.0225749559082892*G0_2_2;
+    A[462] = -0.0225749559082894*G0_0_0 - 0.0112874779541447*G0_0_2 - 0.0225749559082894*G0_1_0 - 0.0112874779541447*G0_1_2 - 0.0112874779541444*G0_2_0;
+    A[463] = -0.0169312169312159*G0_0_0 - 0.0141093474426803*G0_0_2 - 0.0169312169312161*G0_1_0 - 0.0141093474426804*G0_1_2 - 0.0141093474426803*G0_2_0 - 0.0112874779541442*G0_2_2;
+    A[464] = -0.0451499118165793*G0_0_0 - 0.033862433862434*G0_0_2 - 0.0451499118165791*G0_1_0 - 0.0338624338624339*G0_1_2 - 0.0338624338624342*G0_2_0 - 0.0225749559082894*G0_2_2;
+    A[465] = -0.0112874779541447*G0_0_0 - 0.0112874779541449*G0_0_1 - 0.0112874779541446*G0_1_0 - 0.0112874779541448*G0_1_1;
+    A[466] = -0.00282186948853596*G0_0_0 - 0.00282186948853583*G0_0_1 - 0.00282186948853606*G0_1_0 - 0.00282186948853587*G0_1_1;
+    A[467] = -0.0112874779541447*G0_0_0 - 0.0112874779541447*G0_0_1 - 0.0112874779541446*G0_1_0 - 0.0112874779541446*G0_1_1;
+    A[468] = 0.203174603174603*G0_0_0 + 0.203174603174603*G0_0_1 + 0.12416225749559*G0_0_2 + 0.203174603174603*G0_1_0 + 0.203174603174603*G0_1_1 + 0.124162257495591*G0_1_2 + 0.12416225749559*G0_2_0 + 0.124162257495591*G0_2_1 + 0.203174603174604*G0_2_2;
+    A[469] = -0.118518518518519*G0_0_0 - 0.118518518518519*G0_0_1 - 0.160846560846561*G0_0_2 - 0.118518518518519*G0_1_0 - 0.118518518518519*G0_1_1 - 0.160846560846561*G0_1_2 - 0.0874779541446207*G0_2_0 - 0.0874779541446206*G0_2_1 - 0.220105820105821*G0_2_2;
+    A[470] = 0.0451499118165792*G0_0_0 + 0.0451499118165792*G0_0_1 + 0.0790123456790127*G0_0_2 + 0.0451499118165791*G0_1_0 + 0.0451499118165791*G0_1_1 + 0.0790123456790128*G0_1_2 + 0.0338624338624341*G0_2_0 + 0.0338624338624341*G0_2_1 + 0.112874779541446*G0_2_2;
+    A[471] = 0.101587301587302*G0_0_0 + 0.0225749559082887*G0_0_1 + 0.101587301587302*G0_0_2 + 0.101587301587302*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.101587301587302*G0_1_2 + 0.0225749559082889*G0_2_0 + 0.101587301587302*G0_2_1 + 0.022574955908289*G0_2_2;
+    A[472] = -0.0423280423280424*G0_0_0 + 0.0169312169312172*G0_0_1 - 0.0423280423280424*G0_0_2 - 0.0423280423280423*G0_1_0 + 0.0169312169312172*G0_1_1 - 0.0423280423280423*G0_1_2 - 0.0112874779541444*G0_2_0 - 0.0423280423280429*G0_2_1 - 0.0112874779541445*G0_2_2;
+    A[473] = 0.0112874779541447*G0_0_0 - 0.0225749559082892*G0_0_1 + 0.0112874779541446*G0_0_2 + 0.0112874779541446*G0_1_0 - 0.0225749559082892*G0_1_1 + 0.0112874779541445*G0_1_2 + 0.0112874779541448*G0_2_1;
+    A[474] = 0.0225749559082886*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.0225749559082886*G0_1_0 + 0.101587301587301*G0_1_1 + 0.101587301587301*G0_1_2 + 0.101587301587302*G0_2_0 + 0.0225749559082891*G0_2_1 + 0.022574955908289*G0_2_2;
+    A[475] = 0.0169312169312174*G0_0_0 - 0.0423280423280419*G0_0_1 - 0.0423280423280419*G0_0_2 + 0.0169312169312174*G0_1_0 - 0.042328042328042*G0_1_1 - 0.042328042328042*G0_1_2 - 0.0423280423280431*G0_2_0 - 0.0112874779541445*G0_2_1 - 0.0112874779541445*G0_2_2;
+    A[476] = -0.0225749559082896*G0_0_0 + 0.0112874779541446*G0_0_1 + 0.0112874779541446*G0_0_2 - 0.0225749559082895*G0_1_0 + 0.0112874779541446*G0_1_1 + 0.0112874779541446*G0_1_2 + 0.011287477954145*G0_2_0;
+    A[477] = -0.0225749559082884*G0_0_0 - 0.0225749559082883*G0_0_1 - 0.0112874779541442*G0_0_2 - 0.0225749559082888*G0_1_0 - 0.0225749559082885*G0_1_1 - 0.0112874779541443*G0_1_2 - 0.0112874779541445*G0_2_0 - 0.0112874779541436*G0_2_1;
+    A[478] = -0.0225749559082896*G0_0_0 - 0.0225749559082897*G0_0_1 - 0.0112874779541447*G0_0_2 - 0.0225749559082894*G0_1_0 - 0.0225749559082896*G0_1_1 - 0.0112874779541446*G0_1_2 - 0.0112874779541445*G0_2_0 - 0.0112874779541451*G0_2_1;
+    A[479] = -0.0677248677248683*G0_0_0 - 0.0677248677248677*G0_0_1 - 0.0564373897707233*G0_0_2 - 0.0677248677248681*G0_1_0 - 0.0677248677248677*G0_1_1 - 0.0564373897707234*G0_1_2 - 0.0564373897707231*G0_2_0 - 0.0564373897707231*G0_2_1 - 0.0451499118165785*G0_2_2;
+    A[480] = -0.0677248677248671*G0_0_0 - 0.270899470899471*G0_0_1 - 0.169312169312169*G0_0_2 - 0.0677248677248673*G0_1_0 - 0.270899470899471*G0_1_1 - 0.169312169312169*G0_1_2 - 0.0790123456790113*G0_2_0 - 0.169312169312169*G0_2_1 - 0.067724867724867*G0_2_2;
+    A[481] = 0.0225749559082896*G0_0_0 + 0.0902998236331573*G0_0_1 + 0.0564373897707234*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0902998236331572*G0_1_1 + 0.0564373897707233*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0564373897707226*G0_2_1 + 0.0225749559082891*G0_2_2;
+    A[482] = 0.0677248677248682*G0_0_0 + 0.135449735449735*G0_0_1 + 0.101587301587301*G0_0_2 + 0.067724867724868*G0_1_0 + 0.135449735449735*G0_1_1 + 0.101587301587301*G0_1_2 + 0.056437389770723*G0_2_0 + 0.101587301587301*G0_2_1 + 0.0677248677248671*G0_2_2;
+    A[483] = -0.270899470899471*G0_0_0 - 0.0677248677248669*G0_0_1 - 0.169312169312169*G0_0_2 - 0.270899470899471*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.169312169312169*G0_1_2 - 0.169312169312168*G0_2_0 - 0.0790123456790113*G0_2_1 - 0.067724867724867*G0_2_2;
+    A[484] = 0.0902998236331566*G0_0_0 + 0.0225749559082886*G0_0_1 + 0.0564373897707221*G0_0_2 + 0.0902998236331567*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0564373897707223*G0_1_2 + 0.0564373897707222*G0_2_0 + 0.0112874779541438*G0_2_1 + 0.0225749559082888*G0_2_2;
+    A[485] = 0.135449735449735*G0_0_0 + 0.0677248677248677*G0_0_1 + 0.101587301587302*G0_0_2 + 0.135449735449735*G0_1_0 + 0.0677248677248677*G0_1_1 + 0.101587301587302*G0_1_2 + 0.101587301587301*G0_2_0 + 0.0564373897707231*G0_2_1 + 0.0677248677248673*G0_2_2;
+    A[486] = -0.135449735449735*G0_0_0 - 0.135449735449735*G0_0_1 - 0.0338624338624335*G0_0_2 - 0.135449735449735*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0338624338624337*G0_1_2 - 0.0338624338624333*G0_2_0 - 0.0338624338624336*G0_2_1 - 0.0451499118165779*G0_2_2;
+    A[487] = 0.0451499118165785*G0_0_0 + 0.0451499118165782*G0_0_1 + 0.0112874779541444*G0_0_2 + 0.0451499118165785*G0_1_0 + 0.0451499118165783*G0_1_1 + 0.0112874779541445*G0_1_2 + 0.011287477954144*G0_2_0 + 0.0112874779541447*G0_2_1;
+    A[488] = 0.0451499118165783*G0_0_0 + 0.0451499118165783*G0_0_1 + 0.0112874779541446*G0_0_2 + 0.0451499118165784*G0_1_0 + 0.0451499118165782*G0_1_1 + 0.0112874779541445*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0112874779541444*G0_2_1;
+    A[489] = 0.0902998236331556*G0_0_0 + 0.0902998236331562*G0_0_1 + 0.0902998236331568*G0_0_2 + 0.0902998236331561*G0_1_0 + 0.0902998236331565*G0_1_1 + 0.0902998236331571*G0_1_2 + 0.0902998236331558*G0_2_0 + 0.0902998236331563*G0_2_1 + 0.0902998236331565*G0_2_2;
+    A[490] = 0.0202821869488534*G0_0_0 + 0.0202821869488535*G0_0_1 + 0.0202821869488535*G0_0_2 + 0.0202821869488534*G0_1_0 + 0.0202821869488535*G0_1_1 + 0.0202821869488535*G0_1_2 + 0.0529100529100532*G0_2_0 + 0.0529100529100532*G0_2_1 + 0.0529100529100532*G0_2_2;
     A[491] = 0.0051146384479717*G0_0_0 + 0.0051146384479717*G0_1_0;
-    A[492] = 0.00511463844797157*G0_0_1 + 0.00511463844797163*G0_1_1;
-    A[493] = 0.0326278659611998*G0_0_2 + 0.0326278659611997*G0_1_2 + 0.0529100529100531*G0_2_2;
-    A[494] = -0.0169312169312166*G0_0_1 - 0.00282186948853626*G0_0_2 - 0.0169312169312166*G0_1_1 - 0.00282186948853619*G0_1_2 - 0.00282186948853587*G0_2_1;
-    A[495] = 0.0211640211640202*G0_0_1 + 0.0105820105820104*G0_0_2 + 0.0211640211640204*G0_1_1 + 0.0105820105820105*G0_1_2 + 0.0105820105820099*G0_2_1 - 0.00282186948853642*G0_2_2;
-    A[496] = 0.0902998236331588*G0_0_1 + 0.0592592592592601*G0_0_2 + 0.0902998236331585*G0_1_1 + 0.05925925925926*G0_1_2 + 0.0592592592592599*G0_2_1 + 0.0169312169312171*G0_2_2;
-    A[497] = -0.0169312169312164*G0_0_0 - 0.0028218694885359*G0_0_2 - 0.0169312169312164*G0_1_0 - 0.00282186948853587*G0_1_2 - 0.00282186948853597*G0_2_0;
-    A[498] = 0.0211640211640197*G0_0_0 + 0.01058201058201*G0_0_2 + 0.0211640211640199*G0_1_0 + 0.01058201058201*G0_1_2 + 0.01058201058201*G0_2_0 - 0.00282186948853647*G0_2_2;
-    A[499] = 0.0902998236331589*G0_0_0 + 0.0592592592592601*G0_0_2 + 0.0902998236331586*G0_1_0 + 0.05925925925926*G0_1_2 + 0.0592592592592601*G0_2_0 + 0.0169312169312174*G0_2_2;
-    A[500] = -0.00282186948853631*G0_0_0 - 0.00282186948853607*G0_0_1 - 0.0028218694885362*G0_1_0 - 0.00282186948853605*G0_1_1;
-    A[501] = -0.00917107583774226*G0_0_0 - 0.00917107583774233*G0_0_1 - 0.00917107583774231*G0_1_0 - 0.00917107583774233*G0_1_1;
-    A[502] = -0.00282186948853649*G0_0_0 - 0.00282186948853643*G0_0_1 - 0.00282186948853641*G0_1_0 - 0.00282186948853639*G0_1_1;
-    A[503] = -0.118518518518519*G0_0_0 - 0.118518518518519*G0_0_1 - 0.0874779541446206*G0_0_2 - 0.118518518518519*G0_1_0 - 0.118518518518519*G0_1_1 - 0.0874779541446205*G0_1_2 - 0.160846560846561*G0_2_0 - 0.160846560846561*G0_2_1 - 0.220105820105821*G0_2_2;
-    A[504] = 0.249735449735451*G0_0_0 + 0.249735449735451*G0_0_1 + 0.167195767195768*G0_0_2 + 0.249735449735451*G0_1_0 + 0.249735449735451*G0_1_1 + 0.167195767195767*G0_1_2 + 0.167195767195767*G0_2_0 + 0.167195767195767*G0_2_1 + 0.334391534391535*G0_2_2;
-    A[505] = -0.0902998236331589*G0_0_0 - 0.0902998236331589*G0_0_1 - 0.1326278659612*G0_0_2 - 0.0902998236331586*G0_1_0 - 0.0902998236331586*G0_1_1 - 0.1326278659612*G0_1_2 - 0.05925925925926*G0_2_0 - 0.05925925925926*G0_2_1 - 0.220105820105821*G0_2_2;
-    A[506] = -0.0423280423280425*G0_0_0 - 0.0112874779541442*G0_0_1 - 0.0423280423280423*G0_0_2 - 0.0423280423280425*G0_1_0 - 0.0112874779541443*G0_1_1 - 0.0423280423280424*G0_1_2 + 0.0169312169312169*G0_2_0 - 0.0423280423280428*G0_2_1 + 0.0169312169312169*G0_2_2;
-    A[507] = -0.0134038800705469*G0_0_0 - 0.00282186948853645*G0_0_1 - 0.0134038800705469*G0_0_2 - 0.0134038800705468*G0_1_0 - 0.00282186948853639*G0_1_1 - 0.0134038800705469*G0_1_2 - 0.0028218694885361*G0_2_0 - 0.0134038800705464*G0_2_1 - 0.00282186948853614*G0_2_2;
-    A[508] = 0.00282186948853649*G0_0_0 - 0.0112874779541444*G0_0_1 + 0.00282186948853651*G0_0_2 + 0.00282186948853641*G0_1_0 - 0.0112874779541445*G0_1_1 + 0.00282186948853644*G0_1_2 + 0.00282186948853595*G0_2_1;
-    A[509] = -0.0112874779541442*G0_0_0 - 0.0423280423280425*G0_0_1 - 0.0423280423280424*G0_0_2 - 0.0112874779541442*G0_1_0 - 0.0423280423280425*G0_1_1 - 0.0423280423280424*G0_1_2 - 0.0423280423280431*G0_2_0 + 0.0169312169312167*G0_2_1 + 0.0169312169312168*G0_2_2;
-    A[510] = -0.00282186948853634*G0_0_0 - 0.013403880070547*G0_0_1 - 0.0134038800705469*G0_0_2 - 0.00282186948853631*G0_1_0 - 0.0134038800705469*G0_1_1 - 0.0134038800705469*G0_1_2 - 0.0134038800705458*G0_2_0 - 0.00282186948853595*G0_2_1 - 0.00282186948853594*G0_2_2;
-    A[511] = -0.0112874779541446*G0_0_0 + 0.00282186948853609*G0_0_1 + 0.00282186948853606*G0_0_2 - 0.0112874779541446*G0_1_0 + 0.00282186948853606*G0_1_1 + 0.00282186948853604*G0_1_2 + 0.00282186948853567*G0_2_0;
-    A[512] = 0.0169312169312176*G0_0_0 + 0.0169312169312169*G0_0_1 - 0.00282186948853564*G0_0_2 + 0.0169312169312175*G0_1_0 + 0.016931216931217*G0_1_1 - 0.00282186948853557*G0_1_2 - 0.00282186948853545*G0_2_0 - 0.00282186948853616*G0_2_1;
-    A[513] = 0.0169312169312167*G0_0_0 + 0.0169312169312175*G0_0_1 - 0.00282186948853618*G0_0_2 + 0.016931216931217*G0_1_0 + 0.0169312169312177*G0_1_1 - 0.00282186948853595*G0_1_2 - 0.00282186948853644*G0_2_0 - 0.00282186948853591*G0_2_1;
-    A[514] = 0.0846560846560858*G0_0_0 + 0.0846560846560856*G0_0_1 + 0.0423280423280431*G0_0_2 + 0.0846560846560856*G0_1_0 + 0.0846560846560854*G0_1_1 + 0.042328042328043*G0_1_2 + 0.0423280423280427*G0_2_0 + 0.042328042328043*G0_2_1 + 0.0225749559082898*G0_2_2;
-    A[515] = 0.118518518518519*G0_0_0 + 0.0677248677248676*G0_0_1 + 0.160846560846561*G0_0_2 + 0.118518518518519*G0_1_0 + 0.0677248677248675*G0_1_1 + 0.160846560846561*G0_1_2 + 0.0253968253968244*G0_2_0 + 0.16084656084656*G0_2_1 - 0.0169312169312175*G0_2_2;
-    A[516] = -0.0169312169312167*G0_0_0 + 0.0677248677248679*G0_0_1 + 0.00282186948853591*G0_0_2 - 0.0169312169312171*G0_1_0 + 0.067724867724868*G0_1_1 + 0.00282186948853579*G0_1_2 + 0.00282186948853643*G0_2_0 + 0.00282186948853656*G0_2_1 + 0.00564373897707247*G0_2_2;
-    A[517] = -0.0846560846560858*G0_0_0 - 0.270899470899471*G0_0_1 - 0.177777777777778*G0_0_2 - 0.0846560846560856*G0_1_0 - 0.270899470899471*G0_1_1 - 0.177777777777778*G0_1_2 - 0.0423280423280426*G0_2_0 - 0.177777777777777*G0_2_1 - 0.0169312169312165*G0_2_2;
-    A[518] = 0.067724867724867*G0_0_0 + 0.118518518518519*G0_0_1 + 0.160846560846561*G0_0_2 + 0.067724867724867*G0_1_0 + 0.118518518518519*G0_1_1 + 0.160846560846561*G0_1_2 + 0.16084656084656*G0_2_0 + 0.0253968253968246*G0_2_1 - 0.0169312169312172*G0_2_2;
-    A[519] = 0.0677248677248683*G0_0_0 - 0.0169312169312169*G0_0_1 + 0.00282186948853679*G0_0_2 + 0.0677248677248682*G0_1_0 - 0.016931216931217*G0_1_1 + 0.00282186948853674*G0_1_2 + 0.0028218694885367*G0_2_0 + 0.00282186948853593*G0_2_1 + 0.00564373897707206*G0_2_2;
-    A[520] = -0.270899470899471*G0_0_0 - 0.0846560846560856*G0_0_1 - 0.177777777777779*G0_0_2 - 0.270899470899471*G0_1_0 - 0.0846560846560854*G0_1_1 - 0.177777777777779*G0_1_2 - 0.177777777777777*G0_2_0 - 0.042328042328043*G0_2_1 - 0.0169312169312165*G0_2_2;
-    A[521] = 0.0225749559082894*G0_0_0 + 0.0225749559082894*G0_0_1 - 0.019753086419753*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.0197530864197529*G0_1_2 - 0.0197530864197532*G0_2_0 - 0.019753086419753*G0_2_1 + 0.0225749559082889*G0_2_2;
-    A[522] = 0.0225749559082894*G0_0_0 + 0.0225749559082894*G0_0_1 + 0.00282186948853573*G0_0_2 + 0.0225749559082893*G0_1_0 + 0.0225749559082893*G0_1_1 + 0.00282186948853567*G0_1_2 + 0.00282186948853636*G0_2_0 + 0.00282186948853564*G0_2_1;
-    A[523] = 0.0225749559082891*G0_0_0 + 0.0225749559082896*G0_0_1 + 0.00282186948853636*G0_0_2 + 0.0225749559082892*G0_1_0 + 0.0225749559082896*G0_1_1 + 0.00282186948853613*G0_1_2 + 0.00282186948853605*G0_2_0 + 0.00282186948853636*G0_2_1;
-    A[524] = -0.135449735449737*G0_0_0 - 0.135449735449737*G0_0_1 - 0.0225749559082905*G0_0_2 - 0.135449735449737*G0_1_0 - 0.135449735449737*G0_1_1 - 0.0225749559082905*G0_1_2 - 0.022574955908289*G0_2_0 - 0.0225749559082888*G0_2_1 - 0.0451499118165787*G0_2_2;
-    A[525] = -0.00776014109347451*G0_0_0 - 0.00776014109347448*G0_0_1 - 0.00776014109347446*G0_0_2 - 0.00776014109347451*G0_1_0 - 0.00776014109347448*G0_1_1 - 0.00776014109347446*G0_1_2 - 0.0253968253968255*G0_2_0 - 0.0253968253968254*G0_2_1 - 0.0253968253968255*G0_2_2;
-    A[526] = 0.00776014109347455*G0_0_0 + 0.00776014109347454*G0_1_0;
-    A[527] = 0.00776014109347464*G0_0_1 + 0.00776014109347464*G0_1_1;
-    A[528] = -0.0458553791887129*G0_0_2 - 0.0458553791887129*G0_1_2 - 0.0705467372134041*G0_2_2;
-    A[529] = -0.0451499118165792*G0_0_1 - 0.0112874779541448*G0_0_2 - 0.0451499118165792*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.011287477954145*G0_2_1;
-    A[530] = 0.0902998236331583*G0_0_1 + 0.0310405643738984*G0_0_2 + 0.0902998236331584*G0_1_1 + 0.0310405643738984*G0_1_2 + 0.0310405643738984*G0_2_1 - 0.0112874779541444*G0_2_2;
-    A[531] = -0.158024691358027*G0_0_1 - 0.0790123456790134*G0_0_2 - 0.158024691358027*G0_1_1 - 0.0790123456790134*G0_1_2 - 0.0790123456790133*G0_2_1 + 0.0225749559082889*G0_2_2;
-    A[532] = -0.0451499118165794*G0_0_0 - 0.0112874779541449*G0_0_2 - 0.0451499118165794*G0_1_0 - 0.011287477954145*G0_1_2 - 0.0112874779541449*G0_2_0;
-    A[533] = 0.090299823633159*G0_0_0 + 0.0310405643738983*G0_0_2 + 0.090299823633159*G0_1_0 + 0.0310405643738983*G0_1_2 + 0.0310405643738987*G0_2_0 - 0.011287477954144*G0_2_2;
-    A[534] = -0.158024691358027*G0_0_0 - 0.0790123456790133*G0_0_2 - 0.158024691358027*G0_1_0 - 0.0790123456790133*G0_1_2 - 0.0790123456790135*G0_2_0 + 0.0225749559082886*G0_2_2;
+    A[492] = 0.0051146384479716*G0_0_1 + 0.00511463844797163*G0_1_1;
+    A[493] = 0.0326278659611998*G0_0_2 + 0.0326278659611997*G0_1_2 + 0.0529100529100532*G0_2_2;
+    A[494] = -0.0169312169312166*G0_0_1 - 0.00282186948853617*G0_0_2 - 0.0169312169312166*G0_1_1 - 0.00282186948853618*G0_1_2 - 0.00282186948853599*G0_2_1;
+    A[495] = 0.0211640211640203*G0_0_1 + 0.0105820105820104*G0_0_2 + 0.0211640211640204*G0_1_1 + 0.0105820105820105*G0_1_2 + 0.0105820105820099*G0_2_1 - 0.00282186948853625*G0_2_2;
+    A[496] = 0.0902998236331588*G0_0_1 + 0.05925925925926*G0_0_2 + 0.0902998236331585*G0_1_1 + 0.0592592592592599*G0_1_2 + 0.05925925925926*G0_2_1 + 0.016931216931217*G0_2_2;
+    A[497] = -0.0169312169312163*G0_0_0 - 0.0028218694885358*G0_0_2 - 0.0169312169312163*G0_1_0 - 0.00282186948853579*G0_1_2 - 0.00282186948853593*G0_2_0;
+    A[498] = 0.0211640211640197*G0_0_0 + 0.01058201058201*G0_0_2 + 0.0211640211640198*G0_1_0 + 0.01058201058201*G0_1_2 + 0.0105820105820099*G0_2_0 - 0.00282186948853672*G0_2_2;
+    A[499] = 0.090299823633159*G0_0_0 + 0.0592592592592601*G0_0_2 + 0.0902998236331587*G0_1_0 + 0.05925925925926*G0_1_2 + 0.0592592592592602*G0_2_0 + 0.0169312169312175*G0_2_2;
+    A[500] = -0.00282186948853621*G0_0_0 - 0.00282186948853605*G0_0_1 - 0.00282186948853615*G0_1_0 - 0.00282186948853604*G0_1_1;
+    A[501] = -0.00917107583774233*G0_0_0 - 0.00917107583774237*G0_0_1 - 0.00917107583774233*G0_1_0 - 0.00917107583774235*G0_1_1;
+    A[502] = -0.00282186948853641*G0_0_0 - 0.00282186948853639*G0_0_1 - 0.00282186948853641*G0_1_0 - 0.00282186948853638*G0_1_1;
+    A[503] = -0.118518518518519*G0_0_0 - 0.118518518518519*G0_0_1 - 0.0874779541446206*G0_0_2 - 0.118518518518519*G0_1_0 - 0.118518518518519*G0_1_1 - 0.0874779541446206*G0_1_2 - 0.160846560846561*G0_2_0 - 0.160846560846561*G0_2_1 - 0.220105820105821*G0_2_2;
+    A[504] = 0.249735449735451*G0_0_0 + 0.249735449735451*G0_0_1 + 0.167195767195768*G0_0_2 + 0.249735449735451*G0_1_0 + 0.249735449735451*G0_1_1 + 0.167195767195767*G0_1_2 + 0.167195767195768*G0_2_0 + 0.167195767195767*G0_2_1 + 0.334391534391535*G0_2_2;
+    A[505] = -0.090299823633159*G0_0_0 - 0.0902998236331589*G0_0_1 - 0.1326278659612*G0_0_2 - 0.0902998236331587*G0_1_0 - 0.0902998236331587*G0_1_1 - 0.1326278659612*G0_1_2 - 0.0592592592592601*G0_2_0 - 0.0592592592592601*G0_2_1 - 0.220105820105821*G0_2_2;
+    A[506] = -0.0423280423280426*G0_0_0 - 0.0112874779541442*G0_0_1 - 0.0423280423280424*G0_0_2 - 0.0423280423280425*G0_1_0 - 0.0112874779541443*G0_1_1 - 0.0423280423280424*G0_1_2 + 0.0169312169312171*G0_2_0 - 0.0423280423280427*G0_2_1 + 0.016931216931217*G0_2_2;
+    A[507] = -0.0134038800705468*G0_0_0 - 0.00282186948853641*G0_0_1 - 0.0134038800705468*G0_0_2 - 0.0134038800705469*G0_1_0 - 0.00282186948853638*G0_1_1 - 0.0134038800705468*G0_1_2 - 0.00282186948853627*G0_2_0 - 0.0134038800705464*G0_2_1 - 0.00282186948853622*G0_2_2;
+    A[508] = 0.0028218694885364*G0_0_0 - 0.0112874779541446*G0_0_1 + 0.00282186948853647*G0_0_2 + 0.00282186948853641*G0_1_0 - 0.0112874779541446*G0_1_1 + 0.00282186948853647*G0_1_2 + 0.00282186948853603*G0_2_1;
+    A[509] = -0.0112874779541442*G0_0_0 - 0.0423280423280425*G0_0_1 - 0.0423280423280425*G0_0_2 - 0.0112874779541442*G0_1_0 - 0.0423280423280425*G0_1_1 - 0.0423280423280425*G0_1_2 - 0.0423280423280431*G0_2_0 + 0.0169312169312168*G0_2_1 + 0.0169312169312168*G0_2_2;
+    A[510] = -0.00282186948853637*G0_0_0 - 0.0134038800705469*G0_0_1 - 0.0134038800705469*G0_0_2 - 0.00282186948853637*G0_1_0 - 0.0134038800705469*G0_1_1 - 0.0134038800705469*G0_1_2 - 0.0134038800705459*G0_2_0 - 0.00282186948853591*G0_2_1 - 0.00282186948853591*G0_2_2;
+    A[511] = -0.0112874779541446*G0_0_0 + 0.00282186948853601*G0_0_1 + 0.00282186948853599*G0_0_2 - 0.0112874779541446*G0_1_0 + 0.00282186948853599*G0_1_1 + 0.00282186948853598*G0_1_2 + 0.00282186948853567*G0_2_0;
+    A[512] = 0.0169312169312175*G0_0_0 + 0.0169312169312169*G0_0_1 - 0.00282186948853564*G0_0_2 + 0.0169312169312175*G0_1_0 + 0.016931216931217*G0_1_1 - 0.00282186948853558*G0_1_2 - 0.00282186948853541*G0_2_0 - 0.00282186948853619*G0_2_1;
+    A[513] = 0.0169312169312168*G0_0_0 + 0.0169312169312176*G0_0_1 - 0.00282186948853623*G0_0_2 + 0.0169312169312171*G0_1_0 + 0.0169312169312178*G0_1_1 - 0.00282186948853604*G0_1_2 - 0.00282186948853641*G0_2_0 - 0.00282186948853568*G0_2_1;
+    A[514] = 0.0846560846560859*G0_0_0 + 0.0846560846560857*G0_0_1 + 0.0423280423280432*G0_0_2 + 0.0846560846560856*G0_1_0 + 0.0846560846560854*G0_1_1 + 0.042328042328043*G0_1_2 + 0.0423280423280427*G0_2_0 + 0.0423280423280429*G0_2_1 + 0.0225749559082898*G0_2_2;
+    A[515] = 0.118518518518519*G0_0_0 + 0.0677248677248676*G0_0_1 + 0.160846560846561*G0_0_2 + 0.118518518518519*G0_1_0 + 0.0677248677248673*G0_1_1 + 0.160846560846561*G0_1_2 + 0.0253968253968244*G0_2_0 + 0.16084656084656*G0_2_1 - 0.0169312169312176*G0_2_2;
+    A[516] = -0.0169312169312168*G0_0_0 + 0.0677248677248679*G0_0_1 + 0.00282186948853579*G0_0_2 - 0.0169312169312172*G0_1_0 + 0.0677248677248681*G0_1_1 + 0.00282186948853571*G0_1_2 + 0.0028218694885364*G0_2_0 + 0.00282186948853676*G0_2_1 + 0.00564373897707242*G0_2_2;
+    A[517] = -0.0846560846560859*G0_0_0 - 0.270899470899471*G0_0_1 - 0.177777777777778*G0_0_2 - 0.0846560846560856*G0_1_0 - 0.270899470899471*G0_1_1 - 0.177777777777778*G0_1_2 - 0.0423280423280427*G0_2_0 - 0.177777777777777*G0_2_1 - 0.0169312169312164*G0_2_2;
+    A[518] = 0.067724867724867*G0_0_0 + 0.118518518518519*G0_0_1 + 0.160846560846561*G0_0_2 + 0.067724867724867*G0_1_0 + 0.118518518518519*G0_1_1 + 0.160846560846561*G0_1_2 + 0.16084656084656*G0_2_0 + 0.0253968253968246*G0_2_1 - 0.0169312169312174*G0_2_2;
+    A[519] = 0.0677248677248682*G0_0_0 - 0.016931216931217*G0_0_1 + 0.00282186948853678*G0_0_2 + 0.0677248677248681*G0_1_0 - 0.016931216931217*G0_1_1 + 0.00282186948853676*G0_1_2 + 0.00282186948853671*G0_2_0 + 0.00282186948853599*G0_2_1 + 0.00564373897707232*G0_2_2;
+    A[520] = -0.270899470899471*G0_0_0 - 0.0846560846560857*G0_0_1 - 0.177777777777779*G0_0_2 - 0.270899470899471*G0_1_0 - 0.0846560846560854*G0_1_1 - 0.177777777777779*G0_1_2 - 0.177777777777777*G0_2_0 - 0.0423280423280429*G0_2_1 - 0.0169312169312166*G0_2_2;
+    A[521] = 0.0225749559082895*G0_0_0 + 0.0225749559082896*G0_0_1 - 0.0197530864197528*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.0197530864197529*G0_1_2 - 0.0197530864197534*G0_2_0 - 0.0197530864197532*G0_2_1 + 0.0225749559082888*G0_2_2;
+    A[522] = 0.0225749559082893*G0_0_0 + 0.0225749559082894*G0_0_1 + 0.00282186948853572*G0_0_2 + 0.0225749559082893*G0_1_0 + 0.0225749559082893*G0_1_1 + 0.00282186948853566*G0_1_2 + 0.00282186948853638*G0_2_0 + 0.0028218694885357*G0_2_1;
+    A[523] = 0.0225749559082892*G0_0_0 + 0.0225749559082895*G0_0_1 + 0.00282186948853635*G0_0_2 + 0.0225749559082892*G0_1_0 + 0.0225749559082896*G0_1_1 + 0.00282186948853615*G0_1_2 + 0.00282186948853608*G0_2_0 + 0.00282186948853654*G0_2_1;
+    A[524] = -0.135449735449737*G0_0_0 - 0.135449735449737*G0_0_1 - 0.0225749559082907*G0_0_2 - 0.135449735449737*G0_1_0 - 0.135449735449737*G0_1_1 - 0.0225749559082904*G0_1_2 - 0.022574955908289*G0_2_0 - 0.0225749559082889*G0_2_1 - 0.0451499118165787*G0_2_2;
+    A[525] = -0.00776014109347448*G0_0_0 - 0.00776014109347447*G0_0_1 - 0.00776014109347444*G0_0_2 - 0.00776014109347447*G0_1_0 - 0.00776014109347446*G0_1_1 - 0.00776014109347443*G0_1_2 - 0.0253968253968255*G0_2_0 - 0.0253968253968254*G0_2_1 - 0.0253968253968255*G0_2_2;
+    A[526] = 0.00776014109347457*G0_0_0 + 0.00776014109347456*G0_1_0;
+    A[527] = 0.00776014109347463*G0_0_1 + 0.00776014109347462*G0_1_1;
+    A[528] = -0.045855379188713*G0_0_2 - 0.045855379188713*G0_1_2 - 0.0705467372134041*G0_2_2;
+    A[529] = -0.0451499118165791*G0_0_1 - 0.0112874779541448*G0_0_2 - 0.0451499118165791*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.0112874779541449*G0_2_1;
+    A[530] = 0.0902998236331583*G0_0_1 + 0.0310405643738983*G0_0_2 + 0.0902998236331583*G0_1_1 + 0.0310405643738983*G0_1_2 + 0.0310405643738984*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[531] = -0.158024691358027*G0_0_1 - 0.0790123456790133*G0_0_2 - 0.158024691358027*G0_1_1 - 0.0790123456790132*G0_1_2 - 0.0790123456790134*G0_2_1 + 0.0225749559082889*G0_2_2;
+    A[532] = -0.0451499118165794*G0_0_0 - 0.0112874779541449*G0_0_2 - 0.0451499118165794*G0_1_0 - 0.011287477954145*G0_1_2 - 0.011287477954145*G0_2_0;
+    A[533] = 0.0902998236331592*G0_0_0 + 0.0310405643738983*G0_0_2 + 0.0902998236331591*G0_1_0 + 0.0310405643738983*G0_1_2 + 0.0310405643738989*G0_2_0 - 0.0112874779541438*G0_2_2;
+    A[534] = -0.158024691358027*G0_0_0 - 0.0790123456790132*G0_0_2 - 0.158024691358027*G0_1_0 - 0.0790123456790132*G0_1_2 - 0.0790123456790137*G0_2_0 + 0.0225749559082885*G0_2_2;
     A[535] = -0.0112874779541446*G0_0_0 - 0.0112874779541448*G0_0_1 - 0.0112874779541447*G0_1_0 - 0.0112874779541449*G0_1_1;
-    A[536] = -0.00282186948853629*G0_0_0 - 0.00282186948853613*G0_0_1 - 0.00282186948853624*G0_1_0 - 0.00282186948853609*G0_1_1;
-    A[537] = -0.0112874779541446*G0_0_0 - 0.0112874779541447*G0_0_1 - 0.0112874779541446*G0_1_0 - 0.0112874779541447*G0_1_1;
-    A[538] = 0.0451499118165792*G0_0_0 + 0.0451499118165791*G0_0_1 + 0.0338624338624341*G0_0_2 + 0.0451499118165793*G0_1_0 + 0.0451499118165791*G0_1_1 + 0.0338624338624341*G0_1_2 + 0.0790123456790128*G0_2_0 + 0.0790123456790127*G0_2_1 + 0.112874779541446*G0_2_2;
-    A[539] = -0.0902998236331589*G0_0_0 - 0.0902998236331586*G0_0_1 - 0.05925925925926*G0_0_2 - 0.0902998236331589*G0_1_0 - 0.0902998236331586*G0_1_1 - 0.05925925925926*G0_1_2 - 0.1326278659612*G0_2_0 - 0.1326278659612*G0_2_1 - 0.220105820105821*G0_2_2;
-    A[540] = 0.158024691358027*G0_0_0 + 0.158024691358027*G0_0_1 + 0.0790123456790135*G0_0_2 + 0.158024691358027*G0_1_0 + 0.158024691358027*G0_1_1 + 0.0790123456790135*G0_1_2 + 0.0790123456790135*G0_2_0 + 0.0790123456790134*G0_2_1 + 0.203174603174604*G0_2_2;
-    A[541] = 0.0112874779541445*G0_0_0 + 0.0112874779541445*G0_0_2 + 0.0112874779541446*G0_1_0 + 0.0112874779541446*G0_1_2 - 0.0225749559082891*G0_2_0 + 0.0112874779541446*G0_2_1 - 0.022574955908289*G0_2_2;
-    A[542] = 0.00282186948853627*G0_0_0 + 0.00282186948853627*G0_0_2 + 0.00282186948853626*G0_1_0 + 0.00282186948853626*G0_1_2 - 0.0112874779541447*G0_2_0 + 0.00282186948853604*G0_2_1 - 0.0112874779541447*G0_2_2;
-    A[543] = 0.0112874779541446*G0_0_0 + 0.0112874779541446*G0_0_2 + 0.0112874779541446*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.0112874779541447*G0_2_1;
-    A[544] = 0.0112874779541447*G0_0_1 + 0.0112874779541446*G0_0_2 + 0.0112874779541447*G0_1_1 + 0.0112874779541447*G0_1_2 + 0.0112874779541448*G0_2_0 - 0.022574955908289*G0_2_1 - 0.022574955908289*G0_2_2;
-    A[545] = 0.00282186948853625*G0_0_1 + 0.00282186948853626*G0_0_2 + 0.00282186948853622*G0_1_1 + 0.00282186948853623*G0_1_2 + 0.00282186948853573*G0_2_0 - 0.0112874779541446*G0_2_1 - 0.0112874779541446*G0_2_2;
-    A[546] = 0.0112874779541448*G0_0_1 + 0.0112874779541448*G0_0_2 + 0.0112874779541449*G0_1_1 + 0.0112874779541449*G0_1_2 + 0.0112874779541449*G0_2_0;
-    A[547] = 0.0225749559082894*G0_0_0 + 0.0225749559082894*G0_0_1 - 0.0112874779541449*G0_0_2 + 0.0225749559082893*G0_1_0 + 0.0225749559082892*G0_1_1 - 0.011287477954145*G0_1_2 - 0.0112874779541449*G0_2_0 - 0.0112874779541445*G0_2_1;
-    A[548] = 0.0225749559082894*G0_0_0 + 0.0225749559082894*G0_0_1 - 0.0112874779541448*G0_0_2 + 0.0225749559082892*G0_1_0 + 0.0225749559082893*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.0112874779541446*G0_2_0 - 0.011287477954145*G0_2_1;
-    A[549] = -0.112874779541447*G0_0_0 - 0.112874779541446*G0_0_1 - 0.0112874779541442*G0_0_2 - 0.112874779541447*G0_1_0 - 0.112874779541447*G0_1_1 - 0.0112874779541442*G0_1_2 - 0.0112874779541449*G0_2_0 - 0.0112874779541449*G0_2_1 - 0.0451499118165785*G0_2_2;
-    A[550] = -0.0225749559082894*G0_0_0 - 0.0338624338624341*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.0338624338624342*G0_1_2 + 0.0112874779541455*G0_2_0 - 0.0338624338624336*G0_2_1 + 0.0677248677248678*G0_2_2;
-    A[551] = -0.0225749559082893*G0_0_0 - 0.0338624338624343*G0_0_2 - 0.0225749559082892*G0_1_0 - 0.0338624338624342*G0_1_2 + 0.0112874779541447*G0_2_0 - 0.0338624338624342*G0_2_1 + 0.0225749559082892*G0_2_2;
-    A[552] = 0.112874779541447*G0_0_0 + 0.101587301587303*G0_0_2 + 0.112874779541447*G0_1_0 + 0.101587301587303*G0_1_2 + 0.0112874779541449*G0_2_0 + 0.101587301587301*G0_2_1 - 0.0677248677248676*G0_2_2;
-    A[553] = -0.0225749559082895*G0_0_1 - 0.0338624338624342*G0_0_2 - 0.0225749559082895*G0_1_1 - 0.0338624338624343*G0_1_2 - 0.0338624338624334*G0_2_0 + 0.0112874779541456*G0_2_1 + 0.0677248677248678*G0_2_2;
-    A[554] = -0.0225749559082892*G0_0_1 - 0.0338624338624344*G0_0_2 - 0.022574955908289*G0_1_1 - 0.0338624338624344*G0_1_2 - 0.0338624338624345*G0_2_0 + 0.0112874779541446*G0_2_1 + 0.0225749559082888*G0_2_2;
-    A[555] = 0.112874779541446*G0_0_1 + 0.101587301587302*G0_0_2 + 0.112874779541446*G0_1_1 + 0.101587301587302*G0_1_2 + 0.101587301587301*G0_2_0 + 0.0112874779541449*G0_2_1 - 0.0677248677248676*G0_2_2;
-    A[556] = 0.0112874779541445*G0_0_2 + 0.0112874779541446*G0_1_2 + 0.0112874779541448*G0_2_0 + 0.0112874779541446*G0_2_1 - 0.0451499118165776*G0_2_2;
+    A[536] = -0.00282186948853625*G0_0_0 - 0.00282186948853613*G0_0_1 - 0.00282186948853619*G0_1_0 - 0.00282186948853608*G0_1_1;
+    A[537] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0112874779541446*G0_1_0 - 0.0112874779541447*G0_1_1;
+    A[538] = 0.0451499118165792*G0_0_0 + 0.0451499118165791*G0_0_1 + 0.0338624338624341*G0_0_2 + 0.0451499118165792*G0_1_0 + 0.0451499118165791*G0_1_1 + 0.0338624338624341*G0_1_2 + 0.0790123456790127*G0_2_0 + 0.0790123456790128*G0_2_1 + 0.112874779541446*G0_2_2;
+    A[539] = -0.090299823633159*G0_0_0 - 0.0902998236331587*G0_0_1 - 0.0592592592592601*G0_0_2 - 0.0902998236331589*G0_1_0 - 0.0902998236331587*G0_1_1 - 0.0592592592592601*G0_1_2 - 0.1326278659612*G0_2_0 - 0.1326278659612*G0_2_1 - 0.220105820105821*G0_2_2;
+    A[540] = 0.158024691358027*G0_0_0 + 0.158024691358027*G0_0_1 + 0.0790123456790136*G0_0_2 + 0.158024691358027*G0_1_0 + 0.158024691358027*G0_1_1 + 0.0790123456790136*G0_1_2 + 0.0790123456790137*G0_2_0 + 0.0790123456790136*G0_2_1 + 0.203174603174604*G0_2_2;
+    A[541] = 0.0112874779541446*G0_0_0 + 0.0112874779541445*G0_0_2 + 0.0112874779541446*G0_1_0 + 0.0112874779541446*G0_1_2 - 0.0225749559082892*G0_2_0 + 0.0112874779541446*G0_2_1 - 0.0225749559082891*G0_2_2;
+    A[542] = 0.00282186948853624*G0_0_0 + 0.00282186948853625*G0_0_2 + 0.00282186948853623*G0_1_0 + 0.00282186948853624*G0_1_2 - 0.0112874779541445*G0_2_0 + 0.00282186948853607*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[543] = 0.0112874779541446*G0_0_0 + 0.0112874779541445*G0_0_2 + 0.0112874779541446*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.0112874779541446*G0_2_1;
+    A[544] = 0.0112874779541446*G0_0_1 + 0.0112874779541446*G0_0_2 + 0.0112874779541446*G0_1_1 + 0.0112874779541446*G0_1_2 + 0.0112874779541448*G0_2_0 - 0.022574955908289*G0_2_1 - 0.0225749559082891*G0_2_2;
+    A[545] = 0.00282186948853629*G0_0_1 + 0.00282186948853629*G0_0_2 + 0.00282186948853626*G0_1_1 + 0.00282186948853627*G0_1_2 + 0.00282186948853579*G0_2_0 - 0.0112874779541446*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[546] = 0.0112874779541449*G0_0_1 + 0.0112874779541449*G0_0_2 + 0.0112874779541449*G0_1_1 + 0.0112874779541449*G0_1_2 + 0.0112874779541448*G0_2_0;
+    A[547] = 0.0225749559082894*G0_0_0 + 0.0225749559082894*G0_0_1 - 0.011287477954145*G0_0_2 + 0.0225749559082893*G0_1_0 + 0.0225749559082892*G0_1_1 - 0.0112874779541451*G0_1_2 - 0.011287477954145*G0_2_0 - 0.0112874779541445*G0_2_1;
+    A[548] = 0.0225749559082894*G0_0_0 + 0.0225749559082892*G0_0_1 - 0.0112874779541447*G0_0_2 + 0.0225749559082892*G0_1_0 + 0.0225749559082891*G0_1_1 - 0.0112874779541448*G0_1_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541451*G0_2_1;
+    A[549] = -0.112874779541447*G0_0_0 - 0.112874779541446*G0_0_1 - 0.0112874779541442*G0_0_2 - 0.112874779541447*G0_1_0 - 0.112874779541446*G0_1_1 - 0.0112874779541443*G0_1_2 - 0.0112874779541449*G0_2_0 - 0.0112874779541448*G0_2_1 - 0.0451499118165784*G0_2_2;
+    A[550] = -0.0225749559082894*G0_0_0 - 0.0338624338624341*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.0338624338624341*G0_1_2 + 0.0112874779541455*G0_2_0 - 0.0338624338624335*G0_2_1 + 0.0677248677248678*G0_2_2;
+    A[551] = -0.0225749559082893*G0_0_0 - 0.0338624338624341*G0_0_2 - 0.0225749559082892*G0_1_0 - 0.0338624338624341*G0_1_2 + 0.0112874779541447*G0_2_0 - 0.0338624338624344*G0_2_1 + 0.0225749559082893*G0_2_2;
+    A[552] = 0.112874779541446*G0_0_0 + 0.101587301587303*G0_0_2 + 0.112874779541446*G0_1_0 + 0.101587301587303*G0_1_2 + 0.0112874779541449*G0_2_0 + 0.101587301587302*G0_2_1 - 0.0677248677248677*G0_2_2;
+    A[553] = -0.0225749559082893*G0_0_1 - 0.033862433862434*G0_0_2 - 0.0225749559082892*G0_1_1 - 0.033862433862434*G0_1_2 - 0.0338624338624333*G0_2_0 + 0.0112874779541456*G0_2_1 + 0.0677248677248679*G0_2_2;
+    A[554] = -0.0225749559082893*G0_0_1 - 0.0338624338624346*G0_0_2 - 0.0225749559082891*G0_1_1 - 0.0338624338624345*G0_1_2 - 0.0338624338624345*G0_2_0 + 0.0112874779541446*G0_2_1 + 0.0225749559082886*G0_2_2;
+    A[555] = 0.112874779541446*G0_0_1 + 0.101587301587302*G0_0_2 + 0.112874779541446*G0_1_1 + 0.101587301587302*G0_1_2 + 0.101587301587301*G0_2_0 + 0.0112874779541447*G0_2_1 - 0.0677248677248675*G0_2_2;
+    A[556] = 0.0112874779541445*G0_0_2 + 0.0112874779541446*G0_1_2 + 0.011287477954145*G0_2_0 + 0.0112874779541448*G0_2_1 - 0.0451499118165775*G0_2_2;
     A[557] = 0.011287477954145*G0_0_2 + 0.0112874779541451*G0_1_2 + 0.0112874779541443*G0_2_0 + 0.0112874779541448*G0_2_1;
-    A[558] = 0.0112874779541446*G0_0_2 + 0.0112874779541447*G0_1_2 + 0.0112874779541447*G0_2_0 + 0.0112874779541443*G0_2_1;
-    A[559] = 0.0902998236331563*G0_2_2;
-    A[560] = -0.0246913580246911*G0_0_0 - 0.0246913580246911*G0_0_1 - 0.0246913580246911*G0_0_2 - 0.0705467372134043*G0_1_0 - 0.0705467372134043*G0_1_1 - 0.0705467372134043*G0_1_2 - 0.0246913580246911*G0_2_0 - 0.0246913580246911*G0_2_1 - 0.0246913580246911*G0_2_2;
-    A[561] = 0.00776014109347462*G0_0_0 + 0.0077601410934746*G0_2_0;
+    A[558] = 0.0112874779541446*G0_0_2 + 0.0112874779541447*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541442*G0_2_1;
+    A[559] = 0.0902998236331561*G0_2_2;
+    A[560] = -0.024691358024691*G0_0_0 - 0.0246913580246911*G0_0_1 - 0.0246913580246911*G0_0_2 - 0.0705467372134043*G0_1_0 - 0.0705467372134043*G0_1_1 - 0.0705467372134043*G0_1_2 - 0.0246913580246911*G0_2_0 - 0.0246913580246911*G0_2_1 - 0.0246913580246911*G0_2_2;
+    A[561] = 0.0077601410934746*G0_0_0 + 0.00776014109347459*G0_2_0;
     A[562] = -0.017636684303351*G0_0_1 - 0.0253968253968255*G0_1_1 - 0.017636684303351*G0_2_1;
-    A[563] = 0.00776014109347446*G0_0_2 + 0.00776014109347441*G0_2_2;
-    A[564] = -0.0338624338624338*G0_0_1 - 0.0451499118165787*G0_0_2 - 0.0225749559082889*G0_1_1 - 0.0338624338624338*G0_1_2 - 0.0338624338624336*G0_2_1 - 0.0451499118165784*G0_2_2;
-    A[565] = -0.0141093474426808*G0_0_1 - 0.0169312169312167*G0_0_2 - 0.0112874779541447*G0_1_1 - 0.0141093474426806*G0_1_2 - 0.0141093474426809*G0_2_1 - 0.0169312169312167*G0_2_2;
-    A[566] = -0.0112874779541446*G0_0_1 - 0.0225749559082892*G0_0_2 - 0.0112874779541444*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0225749559082892*G0_2_2;
-    A[567] = -0.0112874779541449*G0_0_0 - 0.0112874779541447*G0_0_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541445*G0_2_2;
-    A[568] = -0.00282186948853618*G0_0_0 - 0.00282186948853647*G0_0_2 - 0.00282186948853612*G0_2_0 - 0.00282186948853643*G0_2_2;
-    A[569] = -0.0112874779541446*G0_0_0 - 0.0112874779541443*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.0112874779541442*G0_2_2;
-    A[570] = -0.0225749559082898*G0_0_0 - 0.011287477954145*G0_0_1 - 0.0112874779541445*G0_1_0 - 0.0225749559082896*G0_2_0 - 0.0112874779541449*G0_2_1;
-    A[571] = -0.0169312169312158*G0_0_0 - 0.0141093474426798*G0_0_1 - 0.0141093474426803*G0_1_0 - 0.0112874779541446*G0_1_1 - 0.0169312169312162*G0_2_0 - 0.0141093474426802*G0_2_1;
-    A[572] = -0.0451499118165788*G0_0_0 - 0.033862433862434*G0_0_1 - 0.0338624338624339*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0451499118165786*G0_2_0 - 0.0338624338624338*G0_2_1;
-    A[573] = 0.101587301587302*G0_0_0 + 0.101587301587302*G0_0_1 + 0.022574955908289*G0_0_2 + 0.0225749559082888*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.101587301587302*G0_1_2 + 0.101587301587302*G0_2_0 + 0.101587301587301*G0_2_1 + 0.022574955908289*G0_2_2;
-    A[574] = -0.0423280423280425*G0_0_0 - 0.0423280423280425*G0_0_1 + 0.016931216931217*G0_0_2 - 0.0112874779541442*G0_1_0 - 0.0112874779541443*G0_1_1 - 0.0423280423280428*G0_1_2 - 0.0423280423280423*G0_2_0 - 0.0423280423280424*G0_2_1 + 0.0169312169312169*G0_2_2;
-    A[575] = 0.0112874779541445*G0_0_0 + 0.0112874779541446*G0_0_1 - 0.0225749559082891*G0_0_2 + 0.0112874779541446*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0112874779541446*G0_2_1 - 0.022574955908289*G0_2_2;
+    A[563] = 0.00776014109347445*G0_0_2 + 0.00776014109347441*G0_2_2;
+    A[564] = -0.0338624338624339*G0_0_1 - 0.0451499118165788*G0_0_2 - 0.0225749559082889*G0_1_1 - 0.0338624338624337*G0_1_2 - 0.0338624338624336*G0_2_1 - 0.0451499118165785*G0_2_2;
+    A[565] = -0.0141093474426808*G0_0_1 - 0.0169312169312167*G0_0_2 - 0.0112874779541448*G0_1_1 - 0.0141093474426807*G0_1_2 - 0.0141093474426809*G0_2_1 - 0.0169312169312168*G0_2_2;
+    A[566] = -0.0112874779541446*G0_0_1 - 0.0225749559082892*G0_0_2 - 0.0112874779541443*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0225749559082891*G0_2_2;
+    A[567] = -0.0112874779541447*G0_0_0 - 0.0112874779541447*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.0112874779541445*G0_2_2;
+    A[568] = -0.0028218694885362*G0_0_0 - 0.00282186948853651*G0_0_2 - 0.0028218694885362*G0_2_0 - 0.00282186948853652*G0_2_2;
+    A[569] = -0.0112874779541446*G0_0_0 - 0.0112874779541442*G0_0_2 - 0.0112874779541445*G0_2_0 - 0.0112874779541441*G0_2_2;
+    A[570] = -0.0225749559082896*G0_0_0 - 0.011287477954145*G0_0_1 - 0.0112874779541443*G0_1_0 - 0.0225749559082894*G0_2_0 - 0.0112874779541449*G0_2_1;
+    A[571] = -0.0169312169312157*G0_0_0 - 0.0141093474426797*G0_0_1 - 0.0141093474426804*G0_1_0 - 0.0112874779541445*G0_1_1 - 0.0169312169312162*G0_2_0 - 0.01410934744268*G0_2_1;
+    A[572] = -0.0451499118165789*G0_0_0 - 0.0338624338624341*G0_0_1 - 0.0338624338624339*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0451499118165786*G0_2_0 - 0.0338624338624338*G0_2_1;
+    A[573] = 0.101587301587302*G0_0_0 + 0.101587301587302*G0_0_1 + 0.0225749559082889*G0_0_2 + 0.0225749559082887*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.101587301587302*G0_1_2 + 0.101587301587302*G0_2_0 + 0.101587301587302*G0_2_1 + 0.022574955908289*G0_2_2;
+    A[574] = -0.0423280423280425*G0_0_0 - 0.0423280423280425*G0_0_1 + 0.0169312169312171*G0_0_2 - 0.0112874779541442*G0_1_0 - 0.0112874779541443*G0_1_1 - 0.0423280423280427*G0_1_2 - 0.0423280423280424*G0_2_0 - 0.0423280423280424*G0_2_1 + 0.016931216931217*G0_2_2;
+    A[575] = 0.0112874779541446*G0_0_0 + 0.0112874779541446*G0_0_1 - 0.0225749559082892*G0_0_2 + 0.0112874779541446*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0112874779541446*G0_2_1 - 0.0225749559082891*G0_2_2;
     A[576] = 0.203174603174603*G0_0_0 + 0.12416225749559*G0_0_1 + 0.203174603174603*G0_0_2 + 0.12416225749559*G0_1_0 + 0.203174603174604*G0_1_1 + 0.12416225749559*G0_1_2 + 0.203174603174603*G0_2_0 + 0.12416225749559*G0_2_1 + 0.203174603174603*G0_2_2;
-    A[577] = -0.118518518518518*G0_0_0 - 0.160846560846561*G0_0_1 - 0.118518518518518*G0_0_2 - 0.0874779541446206*G0_1_0 - 0.220105820105821*G0_1_1 - 0.0874779541446204*G0_1_2 - 0.118518518518518*G0_2_0 - 0.16084656084656*G0_2_1 - 0.118518518518518*G0_2_2;
-    A[578] = 0.0451499118165788*G0_0_0 + 0.0790123456790125*G0_0_1 + 0.0451499118165786*G0_0_2 + 0.0338624338624339*G0_1_0 + 0.112874779541447*G0_1_1 + 0.0338624338624339*G0_1_2 + 0.0451499118165785*G0_2_0 + 0.0790123456790125*G0_2_1 + 0.0451499118165784*G0_2_2;
-    A[579] = 0.0225749559082887*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.101587301587303*G0_1_0 + 0.0225749559082889*G0_1_1 + 0.0225749559082889*G0_1_2 + 0.0225749559082887*G0_2_0 + 0.101587301587301*G0_2_1 + 0.101587301587301*G0_2_2;
-    A[580] = 0.0169312169312176*G0_0_0 - 0.0423280423280419*G0_0_1 - 0.0423280423280419*G0_0_2 - 0.0423280423280431*G0_1_0 - 0.0112874779541443*G0_1_1 - 0.0112874779541442*G0_1_2 + 0.0169312169312175*G0_2_0 - 0.0423280423280419*G0_2_1 - 0.0423280423280419*G0_2_2;
-    A[581] = -0.0225749559082898*G0_0_0 + 0.0112874779541447*G0_0_1 + 0.0112874779541447*G0_0_2 + 0.0112874779541448*G0_1_0 - 0.0225749559082898*G0_2_0 + 0.0112874779541445*G0_2_1 + 0.0112874779541445*G0_2_2;
-    A[582] = -0.0225749559082885*G0_0_0 - 0.0112874779541448*G0_0_1 - 0.0225749559082885*G0_0_2 - 0.0112874779541441*G0_1_0 - 0.0112874779541437*G0_1_2 - 0.0225749559082887*G0_2_0 - 0.0112874779541445*G0_2_1 - 0.0225749559082887*G0_2_2;
-    A[583] = -0.0677248677248681*G0_0_0 - 0.0564373897707228*G0_0_1 - 0.0677248677248673*G0_0_2 - 0.0564373897707228*G0_1_0 - 0.0451499118165783*G0_1_1 - 0.0564373897707226*G0_1_2 - 0.0677248677248675*G0_2_0 - 0.0564373897707229*G0_2_1 - 0.0677248677248671*G0_2_2;
-    A[584] = -0.0225749559082891*G0_0_0 - 0.0112874779541445*G0_0_1 - 0.0225749559082896*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.0112874779541449*G0_1_2 - 0.0225749559082893*G0_2_0 - 0.0112874779541446*G0_2_1 - 0.0225749559082897*G0_2_2;
-    A[585] = -0.0677248677248675*G0_0_0 - 0.169312169312169*G0_0_1 - 0.270899470899471*G0_0_2 - 0.0790123456790119*G0_1_0 - 0.0677248677248672*G0_1_1 - 0.169312169312169*G0_1_2 - 0.067724867724868*G0_2_0 - 0.169312169312169*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[586] = 0.067724867724868*G0_0_0 + 0.101587301587301*G0_0_1 + 0.135449735449735*G0_0_2 + 0.0564373897707227*G0_1_0 + 0.0677248677248673*G0_1_1 + 0.101587301587301*G0_1_2 + 0.0677248677248675*G0_2_0 + 0.101587301587302*G0_2_1 + 0.135449735449735*G0_2_2;
-    A[587] = 0.0225749559082891*G0_0_0 + 0.0564373897707232*G0_0_1 + 0.0902998236331569*G0_0_2 + 0.0112874779541445*G0_1_0 + 0.0225749559082889*G0_1_1 + 0.0564373897707228*G0_1_2 + 0.0225749559082893*G0_2_0 + 0.0564373897707231*G0_2_1 + 0.0902998236331568*G0_2_2;
-    A[588] = -0.135449735449735*G0_0_0 - 0.0338624338624338*G0_0_1 - 0.135449735449736*G0_0_2 - 0.0338624338624332*G0_1_0 - 0.045149911816578*G0_1_1 - 0.0338624338624334*G0_1_2 - 0.135449735449736*G0_2_0 - 0.033862433862434*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[589] = 0.0451499118165787*G0_0_0 + 0.0112874779541449*G0_0_1 + 0.0451499118165782*G0_0_2 + 0.011287477954144*G0_1_0 + 0.0112874779541443*G0_1_2 + 0.0451499118165787*G0_2_0 + 0.0112874779541447*G0_2_1 + 0.0451499118165782*G0_2_2;
-    A[590] = 0.0451499118165787*G0_0_0 + 0.0112874779541445*G0_0_1 + 0.0451499118165786*G0_0_2 + 0.0112874779541443*G0_1_0 + 0.0112874779541443*G0_1_2 + 0.0451499118165785*G0_2_0 + 0.0112874779541446*G0_2_1 + 0.0451499118165784*G0_2_2;
-    A[591] = -0.270899470899471*G0_0_0 - 0.169312169312169*G0_0_1 - 0.067724867724867*G0_0_2 - 0.169312169312169*G0_1_0 - 0.0677248677248675*G0_1_1 - 0.079012345679012*G0_1_2 - 0.270899470899471*G0_2_0 - 0.169312169312169*G0_2_1 - 0.0677248677248677*G0_2_2;
-    A[592] = 0.0902998236331577*G0_0_0 + 0.0564373897707222*G0_0_1 + 0.0225749559082889*G0_0_2 + 0.0564373897707229*G0_1_0 + 0.0225749559082889*G0_1_1 + 0.011287477954144*G0_1_2 + 0.0902998236331576*G0_2_0 + 0.0564373897707226*G0_2_1 + 0.022574955908289*G0_2_2;
-    A[593] = 0.135449735449734*G0_0_0 + 0.101587301587301*G0_0_1 + 0.0677248677248669*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0677248677248675*G0_1_1 + 0.0564373897707225*G0_1_2 + 0.135449735449734*G0_2_0 + 0.101587301587301*G0_2_1 + 0.0677248677248668*G0_2_2;
-    A[594] = 0.090299823633156*G0_0_0 + 0.0902998236331563*G0_0_1 + 0.0902998236331565*G0_0_2 + 0.090299823633156*G0_1_0 + 0.0902998236331561*G0_1_1 + 0.0902998236331565*G0_1_2 + 0.0902998236331567*G0_2_0 + 0.0902998236331565*G0_2_1 + 0.0902998236331573*G0_2_2;
-    A[595] = 0.0202821869488534*G0_0_0 + 0.0202821869488535*G0_0_1 + 0.0202821869488535*G0_0_2 + 0.0529100529100532*G0_1_0 + 0.0529100529100532*G0_1_1 + 0.0529100529100532*G0_1_2 + 0.0202821869488533*G0_2_0 + 0.0202821869488535*G0_2_1 + 0.0202821869488535*G0_2_2;
-    A[596] = 0.00511463844797157*G0_0_0 + 0.00511463844797163*G0_2_0;
+    A[577] = -0.118518518518518*G0_0_0 - 0.160846560846561*G0_0_1 - 0.118518518518518*G0_0_2 - 0.0874779541446206*G0_1_0 - 0.220105820105821*G0_1_1 - 0.0874779541446205*G0_1_2 - 0.118518518518518*G0_2_0 - 0.160846560846561*G0_2_1 - 0.118518518518518*G0_2_2;
+    A[578] = 0.0451499118165789*G0_0_0 + 0.0790123456790126*G0_0_1 + 0.0451499118165788*G0_0_2 + 0.0338624338624339*G0_1_0 + 0.112874779541447*G0_1_1 + 0.0338624338624338*G0_1_2 + 0.0451499118165786*G0_2_0 + 0.0790123456790126*G0_2_1 + 0.0451499118165784*G0_2_2;
+    A[579] = 0.0225749559082887*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.101587301587302*G0_1_0 + 0.0225749559082889*G0_1_1 + 0.0225749559082889*G0_1_2 + 0.0225749559082887*G0_2_0 + 0.101587301587301*G0_2_1 + 0.101587301587301*G0_2_2;
+    A[580] = 0.0169312169312175*G0_0_0 - 0.0423280423280419*G0_0_1 - 0.0423280423280419*G0_0_2 - 0.042328042328043*G0_1_0 - 0.0112874779541442*G0_1_1 - 0.0112874779541442*G0_1_2 + 0.0169312169312175*G0_2_0 - 0.0423280423280419*G0_2_1 - 0.0423280423280419*G0_2_2;
+    A[581] = -0.0225749559082897*G0_0_0 + 0.0112874779541447*G0_0_1 + 0.0112874779541447*G0_0_2 + 0.0112874779541448*G0_1_0 - 0.0225749559082897*G0_2_0 + 0.0112874779541446*G0_2_1 + 0.0112874779541445*G0_2_2;
+    A[582] = -0.0225749559082884*G0_0_0 - 0.0112874779541447*G0_0_1 - 0.0225749559082883*G0_0_2 - 0.0112874779541441*G0_1_0 - 0.0112874779541436*G0_1_2 - 0.0225749559082887*G0_2_0 - 0.0112874779541445*G0_2_1 - 0.0225749559082884*G0_2_2;
+    A[583] = -0.0677248677248681*G0_0_0 - 0.0564373897707229*G0_0_1 - 0.0677248677248673*G0_0_2 - 0.0564373897707228*G0_1_0 - 0.0451499118165785*G0_1_1 - 0.0564373897707227*G0_1_2 - 0.0677248677248675*G0_2_0 - 0.0564373897707228*G0_2_1 - 0.0677248677248671*G0_2_2;
+    A[584] = -0.0225749559082892*G0_0_0 - 0.0112874779541445*G0_0_1 - 0.0225749559082898*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.011287477954145*G0_1_2 - 0.0225749559082893*G0_2_0 - 0.0112874779541446*G0_2_1 - 0.0225749559082898*G0_2_2;
+    A[585] = -0.0677248677248674*G0_0_0 - 0.169312169312169*G0_0_1 - 0.270899470899471*G0_0_2 - 0.0790123456790119*G0_1_0 - 0.0677248677248672*G0_1_1 - 0.169312169312169*G0_1_2 - 0.0677248677248677*G0_2_0 - 0.169312169312169*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[586] = 0.067724867724868*G0_0_0 + 0.101587301587302*G0_0_1 + 0.135449735449735*G0_0_2 + 0.0564373897707228*G0_1_0 + 0.0677248677248673*G0_1_1 + 0.101587301587301*G0_1_2 + 0.0677248677248674*G0_2_0 + 0.101587301587302*G0_2_1 + 0.135449735449735*G0_2_2;
+    A[587] = 0.0225749559082892*G0_0_0 + 0.0564373897707233*G0_0_1 + 0.090299823633157*G0_0_2 + 0.0112874779541445*G0_1_0 + 0.022574955908289*G0_1_1 + 0.0564373897707226*G0_1_2 + 0.0225749559082893*G0_2_0 + 0.0564373897707232*G0_2_1 + 0.0902998236331568*G0_2_2;
+    A[588] = -0.135449735449736*G0_0_0 - 0.0338624338624338*G0_0_1 - 0.135449735449736*G0_0_2 - 0.033862433862433*G0_1_0 - 0.045149911816578*G0_1_1 - 0.0338624338624334*G0_1_2 - 0.135449735449736*G0_2_0 - 0.033862433862434*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[589] = 0.0451499118165786*G0_0_0 + 0.0112874779541449*G0_0_1 + 0.0451499118165782*G0_0_2 + 0.0112874779541437*G0_1_0 + 0.0112874779541443*G0_1_2 + 0.0451499118165786*G0_2_0 + 0.0112874779541447*G0_2_1 + 0.0451499118165782*G0_2_2;
+    A[590] = 0.0451499118165788*G0_0_0 + 0.0112874779541445*G0_0_1 + 0.0451499118165786*G0_0_2 + 0.0112874779541444*G0_1_0 + 0.0112874779541444*G0_1_2 + 0.0451499118165786*G0_2_0 + 0.0112874779541446*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[591] = -0.270899470899471*G0_0_0 - 0.169312169312169*G0_0_1 - 0.067724867724867*G0_0_2 - 0.169312169312169*G0_1_0 - 0.0677248677248674*G0_1_1 - 0.0790123456790119*G0_1_2 - 0.270899470899471*G0_2_0 - 0.169312169312169*G0_2_1 - 0.0677248677248677*G0_2_2;
+    A[592] = 0.0902998236331573*G0_0_0 + 0.0564373897707221*G0_0_1 + 0.0225749559082887*G0_0_2 + 0.0564373897707226*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0112874779541438*G0_1_2 + 0.0902998236331573*G0_2_0 + 0.0564373897707224*G0_2_1 + 0.0225749559082889*G0_2_2;
+    A[593] = 0.135449735449734*G0_0_0 + 0.101587301587301*G0_0_1 + 0.067724867724867*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0677248677248674*G0_1_1 + 0.0564373897707225*G0_1_2 + 0.135449735449734*G0_2_0 + 0.101587301587301*G0_2_1 + 0.0677248677248668*G0_2_2;
+    A[594] = 0.0902998236331558*G0_0_0 + 0.0902998236331562*G0_0_1 + 0.0902998236331566*G0_0_2 + 0.090299823633156*G0_1_0 + 0.0902998236331562*G0_1_1 + 0.0902998236331566*G0_1_2 + 0.0902998236331564*G0_2_0 + 0.0902998236331564*G0_2_1 + 0.0902998236331573*G0_2_2;
+    A[595] = 0.0202821869488534*G0_0_0 + 0.0202821869488535*G0_0_1 + 0.0202821869488535*G0_0_2 + 0.0529100529100532*G0_1_0 + 0.0529100529100532*G0_1_1 + 0.0529100529100532*G0_1_2 + 0.0202821869488534*G0_2_0 + 0.0202821869488535*G0_2_1 + 0.0202821869488535*G0_2_2;
+    A[596] = 0.00511463844797157*G0_0_0 + 0.00511463844797162*G0_2_0;
     A[597] = 0.0326278659611995*G0_0_1 + 0.0529100529100532*G0_1_1 + 0.0326278659611994*G0_2_1;
-    A[598] = 0.00511463844797174*G0_0_2 + 0.00511463844797175*G0_2_2;
-    A[599] = 0.0592592592592595*G0_0_1 + 0.0902998236331576*G0_0_2 + 0.0169312169312165*G0_1_1 + 0.0592592592592594*G0_1_2 + 0.0592592592592591*G0_2_1 + 0.0902998236331571*G0_2_2;
-    A[600] = 0.0105820105820106*G0_0_1 + 0.0211640211640207*G0_0_2 - 0.00282186948853602*G0_1_1 + 0.0105820105820102*G0_1_2 + 0.0105820105820107*G0_2_1 + 0.0211640211640207*G0_2_2;
-    A[601] = -0.00282186948853627*G0_0_1 - 0.0169312169312168*G0_0_2 - 0.00282186948853622*G0_1_2 - 0.00282186948853627*G0_2_1 - 0.0169312169312168*G0_2_2;
-    A[602] = -0.00282186948853581*G0_0_0 - 0.00282186948853597*G0_0_2 - 0.00282186948853595*G0_2_0 - 0.00282186948853608*G0_2_2;
-    A[603] = -0.00917107583774246*G0_0_0 - 0.00917107583774241*G0_0_2 - 0.0091710758377425*G0_2_0 - 0.00917107583774248*G0_2_2;
-    A[604] = -0.00282186948853628*G0_0_0 - 0.00282186948853631*G0_0_2 - 0.00282186948853628*G0_2_0 - 0.00282186948853625*G0_2_2;
-    A[605] = -0.0169312169312159*G0_0_0 - 0.00282186948853559*G0_0_1 - 0.00282186948853615*G0_1_0 - 0.0169312169312162*G0_2_0 - 0.0028218694885357*G0_2_1;
-    A[606] = 0.0211640211640193*G0_0_0 + 0.0105820105820095*G0_0_1 + 0.0105820105820102*G0_1_0 - 0.0028218694885359*G0_1_1 + 0.0211640211640199*G0_2_0 + 0.0105820105820098*G0_2_1;
-    A[607] = 0.090299823633158*G0_0_0 + 0.0592592592592598*G0_0_1 + 0.0592592592592595*G0_1_0 + 0.0169312169312165*G0_1_1 + 0.0902998236331575*G0_2_0 + 0.0592592592592594*G0_2_1;
-    A[608] = -0.0423280423280422*G0_0_0 - 0.0423280423280423*G0_0_1 - 0.0112874779541445*G0_0_2 + 0.0169312169312172*G0_1_0 + 0.0169312169312171*G0_1_1 - 0.0423280423280429*G0_1_2 - 0.0423280423280422*G0_2_0 - 0.0423280423280423*G0_2_1 - 0.0112874779541445*G0_2_2;
-    A[609] = -0.0134038800705468*G0_0_0 - 0.0134038800705468*G0_0_1 - 0.0028218694885361*G0_0_2 - 0.00282186948853645*G0_1_0 - 0.00282186948853639*G0_1_1 - 0.0134038800705464*G0_1_2 - 0.0134038800705469*G0_2_0 - 0.0134038800705469*G0_2_1 - 0.00282186948853614*G0_2_2;
-    A[610] = 0.00282186948853627*G0_0_0 + 0.00282186948853626*G0_0_1 - 0.0112874779541447*G0_0_2 + 0.00282186948853604*G0_1_2 + 0.00282186948853628*G0_2_0 + 0.00282186948853626*G0_2_1 - 0.0112874779541447*G0_2_2;
-    A[611] = -0.118518518518518*G0_0_0 - 0.0874779541446206*G0_0_1 - 0.118518518518518*G0_0_2 - 0.160846560846561*G0_1_0 - 0.220105820105821*G0_1_1 - 0.16084656084656*G0_1_2 - 0.118518518518518*G0_2_0 - 0.0874779541446204*G0_2_1 - 0.118518518518518*G0_2_2;
+    A[598] = 0.00511463844797172*G0_0_2 + 0.00511463844797175*G0_2_2;
+    A[599] = 0.0592592592592596*G0_0_1 + 0.0902998236331577*G0_0_2 + 0.0169312169312164*G0_1_1 + 0.0592592592592593*G0_1_2 + 0.0592592592592591*G0_2_1 + 0.0902998236331571*G0_2_2;
+    A[600] = 0.0105820105820106*G0_0_1 + 0.0211640211640206*G0_0_2 - 0.00282186948853599*G0_1_1 + 0.0105820105820102*G0_1_2 + 0.0105820105820107*G0_2_1 + 0.0211640211640207*G0_2_2;
+    A[601] = -0.00282186948853623*G0_0_1 - 0.0169312169312167*G0_0_2 - 0.00282186948853622*G0_1_2 - 0.00282186948853625*G0_2_1 - 0.0169312169312168*G0_2_2;
+    A[602] = -0.002821869488536*G0_0_0 - 0.00282186948853599*G0_0_2 - 0.00282186948853612*G0_2_0 - 0.00282186948853613*G0_2_2;
+    A[603] = -0.00917107583774239*G0_0_0 - 0.00917107583774232*G0_0_2 - 0.00917107583774242*G0_2_0 - 0.00917107583774234*G0_2_2;
+    A[604] = -0.00282186948853625*G0_0_0 - 0.00282186948853638*G0_0_2 - 0.00282186948853626*G0_2_0 - 0.00282186948853636*G0_2_2;
+    A[605] = -0.016931216931216*G0_0_0 - 0.00282186948853559*G0_0_1 - 0.00282186948853631*G0_1_0 - 0.0169312169312163*G0_2_0 - 0.00282186948853573*G0_2_1;
+    A[606] = 0.0211640211640193*G0_0_0 + 0.0105820105820094*G0_0_1 + 0.0105820105820103*G0_1_0 - 0.00282186948853578*G0_1_1 + 0.0211640211640199*G0_2_0 + 0.0105820105820099*G0_2_1;
+    A[607] = 0.0902998236331581*G0_0_0 + 0.0592592592592598*G0_0_1 + 0.0592592592592594*G0_1_0 + 0.0169312169312165*G0_1_1 + 0.0902998236331575*G0_2_0 + 0.0592592592592594*G0_2_1;
+    A[608] = -0.0423280423280424*G0_0_0 - 0.0423280423280423*G0_0_1 - 0.0112874779541444*G0_0_2 + 0.0169312169312172*G0_1_0 + 0.0169312169312172*G0_1_1 - 0.0423280423280429*G0_1_2 - 0.0423280423280424*G0_2_0 - 0.0423280423280423*G0_2_1 - 0.0112874779541445*G0_2_2;
+    A[609] = -0.0134038800705468*G0_0_0 - 0.0134038800705469*G0_0_1 - 0.00282186948853627*G0_0_2 - 0.00282186948853641*G0_1_0 - 0.00282186948853638*G0_1_1 - 0.0134038800705464*G0_1_2 - 0.0134038800705468*G0_2_0 - 0.0134038800705468*G0_2_1 - 0.00282186948853622*G0_2_2;
+    A[610] = 0.00282186948853624*G0_0_0 + 0.00282186948853623*G0_0_1 - 0.0112874779541445*G0_0_2 + 0.00282186948853607*G0_1_2 + 0.00282186948853625*G0_2_0 + 0.00282186948853624*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[611] = -0.118518518518518*G0_0_0 - 0.0874779541446206*G0_0_1 - 0.118518518518518*G0_0_2 - 0.160846560846561*G0_1_0 - 0.220105820105821*G0_1_1 - 0.160846560846561*G0_1_2 - 0.118518518518518*G0_2_0 - 0.0874779541446205*G0_2_1 - 0.118518518518518*G0_2_2;
     A[612] = 0.24973544973545*G0_0_0 + 0.167195767195767*G0_0_1 + 0.24973544973545*G0_0_2 + 0.167195767195767*G0_1_0 + 0.334391534391535*G0_1_1 + 0.167195767195767*G0_1_2 + 0.24973544973545*G0_2_0 + 0.167195767195767*G0_2_1 + 0.24973544973545*G0_2_2;
-    A[613] = -0.090299823633158*G0_0_0 - 0.1326278659612*G0_0_1 - 0.0902998236331578*G0_0_2 - 0.0592592592592595*G0_1_0 - 0.220105820105821*G0_1_1 - 0.0592592592592594*G0_1_2 - 0.0902998236331575*G0_2_0 - 0.1326278659612*G0_2_1 - 0.0902998236331573*G0_2_2;
-    A[614] = -0.0112874779541443*G0_0_0 - 0.0423280423280422*G0_0_1 - 0.0423280423280422*G0_0_2 - 0.0423280423280431*G0_1_0 + 0.0169312169312171*G0_1_1 + 0.0169312169312171*G0_1_2 - 0.0112874779541443*G0_2_0 - 0.0423280423280422*G0_2_1 - 0.0423280423280422*G0_2_2;
-    A[615] = -0.00282186948853618*G0_0_0 - 0.0134038800705468*G0_0_1 - 0.0134038800705468*G0_0_2 - 0.0134038800705461*G0_1_0 - 0.0028218694885363*G0_1_1 - 0.00282186948853636*G0_1_2 - 0.00282186948853616*G0_2_0 - 0.0134038800705469*G0_2_1 - 0.0134038800705469*G0_2_2;
-    A[616] = -0.0112874779541444*G0_0_0 + 0.00282186948853593*G0_0_1 + 0.00282186948853594*G0_0_2 + 0.00282186948853602*G0_1_0 - 0.0112874779541444*G0_2_0 + 0.00282186948853605*G0_2_1 + 0.00282186948853605*G0_2_2;
-    A[617] = 0.0169312169312161*G0_0_0 - 0.00282186948853597*G0_0_1 + 0.0169312169312165*G0_0_2 - 0.00282186948853624*G0_1_0 - 0.00282186948853659*G0_1_2 + 0.0169312169312166*G0_2_0 - 0.002821869488536*G0_2_1 + 0.0169312169312169*G0_2_2;
-    A[618] = 0.0846560846560856*G0_0_0 + 0.0423280423280422*G0_0_1 + 0.0846560846560847*G0_0_2 + 0.0423280423280419*G0_1_0 + 0.0225749559082892*G0_1_1 + 0.042328042328042*G0_1_2 + 0.0846560846560846*G0_2_0 + 0.042328042328042*G0_2_1 + 0.0846560846560842*G0_2_2;
-    A[619] = 0.0169312169312168*G0_0_0 - 0.00282186948853624*G0_0_1 + 0.0169312169312171*G0_0_2 - 0.00282186948853612*G0_1_0 - 0.00282186948853585*G0_1_2 + 0.016931216931217*G0_2_0 - 0.00282186948853623*G0_2_1 + 0.0169312169312171*G0_2_2;
-    A[620] = 0.118518518518518*G0_0_0 + 0.160846560846561*G0_0_1 + 0.067724867724867*G0_0_2 + 0.0253968253968253*G0_1_0 - 0.0169312169312171*G0_1_1 + 0.16084656084656*G0_1_2 + 0.118518518518519*G0_2_0 + 0.160846560846561*G0_2_1 + 0.067724867724867*G0_2_2;
-    A[621] = -0.0846560846560856*G0_0_0 - 0.177777777777778*G0_0_1 - 0.27089947089947*G0_0_2 - 0.0423280423280418*G0_1_0 - 0.0169312169312165*G0_1_1 - 0.177777777777778*G0_1_2 - 0.0846560846560846*G0_2_0 - 0.177777777777778*G0_2_1 - 0.27089947089947*G0_2_2;
-    A[622] = -0.0169312169312168*G0_0_0 + 0.00282186948853628*G0_0_1 + 0.0677248677248682*G0_0_2 + 0.00282186948853614*G0_1_0 + 0.00564373897707244*G0_1_1 + 0.00282186948853656*G0_1_2 - 0.0169312169312169*G0_2_0 + 0.00282186948853622*G0_2_1 + 0.0677248677248681*G0_2_2;
-    A[623] = 0.0225749559082892*G0_0_0 - 0.0197530864197533*G0_0_1 + 0.0225749559082892*G0_0_2 - 0.0197530864197534*G0_1_0 + 0.022574955908289*G0_1_1 - 0.0197530864197534*G0_1_2 + 0.0225749559082892*G0_2_0 - 0.0197530864197532*G0_2_1 + 0.0225749559082892*G0_2_2;
-    A[624] = 0.022574955908289*G0_0_0 + 0.00282186948853581*G0_0_1 + 0.0225749559082894*G0_0_2 + 0.0028218694885367*G0_1_0 + 0.00282186948853625*G0_1_2 + 0.0225749559082891*G0_2_0 + 0.00282186948853584*G0_2_1 + 0.0225749559082895*G0_2_2;
-    A[625] = 0.0225749559082893*G0_0_0 + 0.00282186948853616*G0_0_1 + 0.0225749559082894*G0_0_2 + 0.00282186948853625*G0_1_0 + 0.00282186948853642*G0_1_2 + 0.0225749559082894*G0_2_0 + 0.00282186948853615*G0_2_1 + 0.0225749559082892*G0_2_2;
-    A[626] = 0.0677248677248667*G0_0_0 + 0.16084656084656*G0_0_1 + 0.118518518518518*G0_0_2 + 0.160846560846561*G0_1_0 - 0.0169312169312168*G0_1_1 + 0.0253968253968256*G0_1_2 + 0.0677248677248667*G0_2_0 + 0.160846560846561*G0_2_1 + 0.118518518518518*G0_2_2;
-    A[627] = 0.0677248677248671*G0_0_0 + 0.00282186948853679*G0_0_1 - 0.0169312169312167*G0_0_2 + 0.002821869488536*G0_1_0 + 0.00564373897707211*G0_1_1 + 0.00282186948853627*G0_1_2 + 0.0677248677248672*G0_2_0 + 0.00282186948853645*G0_2_1 - 0.0169312169312171*G0_2_2;
-    A[628] = -0.270899470899469*G0_0_0 - 0.177777777777777*G0_0_1 - 0.0846560846560842*G0_0_2 - 0.177777777777777*G0_1_0 - 0.0169312169312167*G0_1_1 - 0.0423280423280419*G0_1_2 - 0.27089947089947*G0_2_0 - 0.177777777777777*G0_2_1 - 0.0846560846560837*G0_2_2;
-    A[629] = -0.135449735449735*G0_0_0 - 0.0225749559082884*G0_0_1 - 0.135449735449735*G0_0_2 - 0.0225749559082891*G0_1_0 - 0.045149911816578*G0_1_1 - 0.0225749559082895*G0_1_2 - 0.135449735449735*G0_2_0 - 0.0225749559082884*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[630] = -0.00776014109347442*G0_0_0 - 0.00776014109347442*G0_0_1 - 0.00776014109347446*G0_0_2 - 0.0253968253968255*G0_1_0 - 0.0253968253968255*G0_1_1 - 0.0253968253968255*G0_1_2 - 0.0077601410934744*G0_2_0 - 0.0077601410934744*G0_2_1 - 0.00776014109347444*G0_2_2;
-    A[631] = 0.00776014109347452*G0_0_0 + 0.00776014109347451*G0_2_0;
-    A[632] = -0.0458553791887127*G0_0_1 - 0.0705467372134041*G0_1_1 - 0.0458553791887126*G0_2_1;
-    A[633] = 0.00776014109347452*G0_0_2 + 0.0077601410934745*G0_2_2;
-    A[634] = -0.0790123456790129*G0_0_1 - 0.158024691358025*G0_0_2 + 0.0225749559082894*G0_1_1 - 0.0790123456790127*G0_1_2 - 0.0790123456790125*G0_2_1 - 0.158024691358025*G0_2_2;
-    A[635] = 0.031040564373898*G0_0_1 + 0.0902998236331573*G0_0_2 - 0.0112874779541447*G0_1_1 + 0.031040564373898*G0_1_2 + 0.0310405643738979*G0_2_1 + 0.0902998236331573*G0_2_2;
-    A[636] = -0.0112874779541446*G0_0_1 - 0.0451499118165784*G0_0_2 - 0.0112874779541446*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0451499118165784*G0_2_2;
-    A[637] = -0.0112874779541449*G0_0_0 - 0.0112874779541447*G0_0_2 - 0.0112874779541448*G0_2_0 - 0.0112874779541446*G0_2_2;
-    A[638] = -0.00282186948853608*G0_0_0 - 0.00282186948853627*G0_0_2 - 0.00282186948853602*G0_2_0 - 0.00282186948853622*G0_2_2;
-    A[639] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.0112874779541446*G0_2_2;
-    A[640] = -0.0451499118165791*G0_0_0 - 0.011287477954145*G0_0_1 - 0.0112874779541447*G0_1_0 - 0.0451499118165789*G0_2_0 - 0.0112874779541449*G0_2_1;
-    A[641] = 0.0902998236331582*G0_0_0 + 0.0310405643738984*G0_0_1 + 0.0310405643738979*G0_1_0 - 0.011287477954145*G0_1_1 + 0.0902998236331579*G0_2_0 + 0.0310405643738982*G0_2_1;
-    A[642] = -0.158024691358026*G0_0_0 - 0.0790123456790134*G0_0_1 - 0.0790123456790129*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.158024691358026*G0_2_0 - 0.0790123456790131*G0_2_1;
-    A[643] = 0.0112874779541446*G0_0_0 + 0.0112874779541446*G0_0_1 - 0.0225749559082893*G0_1_0 - 0.0225749559082892*G0_1_1 + 0.0112874779541449*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0112874779541445*G0_2_1;
-    A[644] = 0.00282186948853649*G0_0_0 + 0.00282186948853641*G0_0_1 - 0.0112874779541444*G0_1_0 - 0.0112874779541445*G0_1_1 + 0.00282186948853595*G0_1_2 + 0.00282186948853651*G0_2_0 + 0.00282186948853644*G0_2_1;
-    A[645] = 0.0112874779541446*G0_0_0 + 0.0112874779541446*G0_0_1 + 0.0112874779541447*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541446*G0_2_1;
-    A[646] = 0.0451499118165788*G0_0_0 + 0.0338624338624339*G0_0_1 + 0.0451499118165785*G0_0_2 + 0.0790123456790125*G0_1_0 + 0.112874779541447*G0_1_1 + 0.0790123456790125*G0_1_2 + 0.0451499118165786*G0_2_0 + 0.0338624338624339*G0_2_1 + 0.0451499118165784*G0_2_2;
-    A[647] = -0.090299823633158*G0_0_0 - 0.0592592592592595*G0_0_1 - 0.0902998236331575*G0_0_2 - 0.1326278659612*G0_1_0 - 0.220105820105821*G0_1_1 - 0.1326278659612*G0_1_2 - 0.0902998236331578*G0_2_0 - 0.0592592592592594*G0_2_1 - 0.0902998236331573*G0_2_2;
+    A[613] = -0.0902998236331581*G0_0_0 - 0.1326278659612*G0_0_1 - 0.090299823633158*G0_0_2 - 0.0592592592592594*G0_1_0 - 0.220105820105821*G0_1_1 - 0.0592592592592593*G0_1_2 - 0.0902998236331575*G0_2_0 - 0.1326278659612*G0_2_1 - 0.0902998236331573*G0_2_2;
+    A[614] = -0.0112874779541444*G0_0_0 - 0.0423280423280422*G0_0_1 - 0.0423280423280422*G0_0_2 - 0.0423280423280431*G0_1_0 + 0.0169312169312171*G0_1_1 + 0.0169312169312171*G0_1_2 - 0.0112874779541444*G0_2_0 - 0.0423280423280422*G0_2_1 - 0.0423280423280422*G0_2_2;
+    A[615] = -0.00282186948853597*G0_0_0 - 0.0134038800705469*G0_0_1 - 0.0134038800705469*G0_0_2 - 0.0134038800705461*G0_1_0 - 0.00282186948853631*G0_1_1 - 0.00282186948853635*G0_1_2 - 0.00282186948853596*G0_2_0 - 0.013403880070547*G0_2_1 - 0.0134038800705469*G0_2_2;
+    A[616] = -0.0112874779541445*G0_0_0 + 0.00282186948853597*G0_0_1 + 0.002821869488536*G0_0_2 + 0.002821869488536*G0_1_0 - 0.0112874779541446*G0_2_0 + 0.00282186948853611*G0_2_1 + 0.00282186948853614*G0_2_2;
+    A[617] = 0.016931216931216*G0_0_0 - 0.00282186948853599*G0_0_1 + 0.0169312169312164*G0_0_2 - 0.00282186948853617*G0_1_0 - 0.00282186948853669*G0_1_2 + 0.0169312169312165*G0_2_0 - 0.00282186948853595*G0_2_1 + 0.0169312169312169*G0_2_2;
+    A[618] = 0.0846560846560854*G0_0_0 + 0.0423280423280421*G0_0_1 + 0.0846560846560847*G0_0_2 + 0.0423280423280417*G0_1_0 + 0.0225749559082894*G0_1_1 + 0.042328042328042*G0_1_2 + 0.0846560846560844*G0_2_0 + 0.0423280423280419*G0_2_1 + 0.084656084656084*G0_2_2;
+    A[619] = 0.0169312169312169*G0_0_0 - 0.00282186948853619*G0_0_1 + 0.0169312169312172*G0_0_2 - 0.0028218694885361*G0_1_0 - 0.00282186948853582*G0_1_2 + 0.016931216931217*G0_2_0 - 0.00282186948853618*G0_2_1 + 0.0169312169312172*G0_2_2;
+    A[620] = 0.118518518518518*G0_0_0 + 0.160846560846561*G0_0_1 + 0.0677248677248672*G0_0_2 + 0.0253968253968252*G0_1_0 - 0.0169312169312171*G0_1_1 + 0.16084656084656*G0_1_2 + 0.118518518518518*G0_2_0 + 0.160846560846561*G0_2_1 + 0.0677248677248672*G0_2_2;
+    A[621] = -0.0846560846560854*G0_0_0 - 0.177777777777778*G0_0_1 - 0.27089947089947*G0_0_2 - 0.0423280423280417*G0_1_0 - 0.0169312169312165*G0_1_1 - 0.177777777777778*G0_1_2 - 0.0846560846560844*G0_2_0 - 0.177777777777778*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[622] = -0.0169312169312168*G0_0_0 + 0.00282186948853637*G0_0_1 + 0.0677248677248682*G0_0_2 + 0.00282186948853613*G0_1_0 + 0.0056437389770724*G0_1_1 + 0.00282186948853658*G0_1_2 - 0.0169312169312169*G0_2_0 + 0.00282186948853623*G0_2_1 + 0.0677248677248681*G0_2_2;
+    A[623] = 0.0225749559082894*G0_0_0 - 0.0197530864197534*G0_0_1 + 0.0225749559082892*G0_0_2 - 0.0197530864197535*G0_1_0 + 0.022574955908289*G0_1_1 - 0.0197530864197534*G0_1_2 + 0.0225749559082893*G0_2_0 - 0.0197530864197533*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[624] = 0.0225749559082891*G0_0_0 + 0.00282186948853583*G0_0_1 + 0.0225749559082894*G0_0_2 + 0.0028218694885369*G0_1_0 + 0.00282186948853623*G0_1_2 + 0.0225749559082892*G0_2_0 + 0.00282186948853579*G0_2_1 + 0.0225749559082895*G0_2_2;
+    A[625] = 0.0225749559082892*G0_0_0 + 0.00282186948853611*G0_0_1 + 0.0225749559082893*G0_0_2 + 0.00282186948853617*G0_1_0 + 0.00282186948853636*G0_1_2 + 0.0225749559082892*G0_2_0 + 0.0028218694885361*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[626] = 0.0677248677248668*G0_0_0 + 0.160846560846561*G0_0_1 + 0.118518518518518*G0_0_2 + 0.160846560846561*G0_1_0 - 0.0169312169312168*G0_1_1 + 0.0253968253968257*G0_1_2 + 0.0677248677248667*G0_2_0 + 0.160846560846561*G0_2_1 + 0.118518518518518*G0_2_2;
+    A[627] = 0.0677248677248672*G0_0_0 + 0.00282186948853685*G0_0_1 - 0.0169312169312167*G0_0_2 + 0.0028218694885363*G0_1_0 + 0.00564373897707202*G0_1_1 + 0.00282186948853635*G0_1_2 + 0.0677248677248674*G0_2_0 + 0.00282186948853649*G0_2_1 - 0.0169312169312172*G0_2_2;
+    A[628] = -0.270899470899469*G0_0_0 - 0.177777777777778*G0_0_1 - 0.0846560846560842*G0_0_2 - 0.177777777777778*G0_1_0 - 0.0169312169312167*G0_1_1 - 0.0423280423280419*G0_1_2 - 0.27089947089947*G0_2_0 - 0.177777777777777*G0_2_1 - 0.0846560846560836*G0_2_2;
+    A[629] = -0.135449735449734*G0_0_0 - 0.0225749559082884*G0_0_1 - 0.135449735449735*G0_0_2 - 0.022574955908289*G0_1_0 - 0.0451499118165783*G0_1_1 - 0.0225749559082896*G0_1_2 - 0.135449735449735*G0_2_0 - 0.0225749559082883*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[630] = -0.00776014109347443*G0_0_0 - 0.00776014109347441*G0_0_1 - 0.00776014109347444*G0_0_2 - 0.0253968253968255*G0_1_0 - 0.0253968253968255*G0_1_1 - 0.0253968253968255*G0_1_2 - 0.00776014109347441*G0_2_0 - 0.00776014109347439*G0_2_1 - 0.00776014109347442*G0_2_2;
+    A[631] = 0.00776014109347452*G0_0_0 + 0.00776014109347453*G0_2_0;
+    A[632] = -0.0458553791887127*G0_0_1 - 0.0705467372134042*G0_1_1 - 0.0458553791887127*G0_2_1;
+    A[633] = 0.00776014109347451*G0_0_2 + 0.00776014109347449*G0_2_2;
+    A[634] = -0.0790123456790129*G0_0_1 - 0.158024691358025*G0_0_2 + 0.0225749559082894*G0_1_1 - 0.0790123456790126*G0_1_2 - 0.0790123456790126*G0_2_1 - 0.158024691358025*G0_2_2;
+    A[635] = 0.0310405643738979*G0_0_1 + 0.0902998236331573*G0_0_2 - 0.0112874779541447*G0_1_1 + 0.031040564373898*G0_1_2 + 0.0310405643738979*G0_2_1 + 0.0902998236331573*G0_2_2;
+    A[636] = -0.0112874779541446*G0_0_1 - 0.0451499118165784*G0_0_2 - 0.0112874779541447*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0451499118165783*G0_2_2;
+    A[637] = -0.0112874779541447*G0_0_0 - 0.0112874779541446*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.0112874779541445*G0_2_2;
+    A[638] = -0.00282186948853613*G0_0_0 - 0.00282186948853645*G0_0_2 - 0.00282186948853611*G0_2_0 - 0.00282186948853646*G0_2_2;
+    A[639] = -0.0112874779541446*G0_0_0 - 0.0112874779541444*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.0112874779541443*G0_2_2;
+    A[640] = -0.045149911816579*G0_0_0 - 0.0112874779541449*G0_0_1 - 0.0112874779541446*G0_1_0 - 0.0451499118165789*G0_2_0 - 0.0112874779541448*G0_2_1;
+    A[641] = 0.0902998236331583*G0_0_0 + 0.0310405643738983*G0_0_1 + 0.0310405643738979*G0_1_0 - 0.0112874779541451*G0_1_1 + 0.090299823633158*G0_2_0 + 0.031040564373898*G0_2_1;
+    A[642] = -0.158024691358026*G0_0_0 - 0.0790123456790133*G0_0_1 - 0.0790123456790129*G0_1_0 + 0.0225749559082895*G0_1_1 - 0.158024691358026*G0_2_0 - 0.0790123456790129*G0_2_1;
+    A[643] = 0.0112874779541447*G0_0_0 + 0.0112874779541446*G0_0_1 - 0.0225749559082892*G0_1_0 - 0.0225749559082892*G0_1_1 + 0.0112874779541448*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541445*G0_2_1;
+    A[644] = 0.0028218694885364*G0_0_0 + 0.00282186948853641*G0_0_1 - 0.0112874779541446*G0_1_0 - 0.0112874779541446*G0_1_1 + 0.00282186948853602*G0_1_2 + 0.00282186948853647*G0_2_0 + 0.00282186948853647*G0_2_1;
+    A[645] = 0.0112874779541446*G0_0_0 + 0.0112874779541446*G0_0_1 + 0.0112874779541446*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0112874779541446*G0_2_1;
+    A[646] = 0.0451499118165789*G0_0_0 + 0.0338624338624339*G0_0_1 + 0.0451499118165786*G0_0_2 + 0.0790123456790126*G0_1_0 + 0.112874779541447*G0_1_1 + 0.0790123456790126*G0_1_2 + 0.0451499118165788*G0_2_0 + 0.0338624338624338*G0_2_1 + 0.0451499118165784*G0_2_2;
+    A[647] = -0.0902998236331581*G0_0_0 - 0.0592592592592594*G0_0_1 - 0.0902998236331575*G0_0_2 - 0.1326278659612*G0_1_0 - 0.220105820105821*G0_1_1 - 0.1326278659612*G0_1_2 - 0.090299823633158*G0_2_0 - 0.0592592592592593*G0_2_1 - 0.0902998236331573*G0_2_2;
     A[648] = 0.158024691358026*G0_0_0 + 0.0790123456790129*G0_0_1 + 0.158024691358026*G0_0_2 + 0.0790123456790129*G0_1_0 + 0.203174603174604*G0_1_1 + 0.0790123456790128*G0_1_2 + 0.158024691358026*G0_2_0 + 0.0790123456790128*G0_2_1 + 0.158024691358026*G0_2_2;
     A[649] = 0.0112874779541446*G0_0_1 + 0.0112874779541445*G0_0_2 + 0.0112874779541449*G0_1_0 - 0.0225749559082892*G0_1_1 - 0.0225749559082893*G0_1_2 + 0.0112874779541446*G0_2_1 + 0.0112874779541445*G0_2_2;
-    A[650] = 0.00282186948853629*G0_0_1 + 0.00282186948853614*G0_0_2 + 0.00282186948853592*G0_1_0 - 0.0112874779541447*G0_1_1 - 0.0112874779541447*G0_1_2 + 0.00282186948853628*G0_2_1 + 0.00282186948853613*G0_2_2;
-    A[651] = 0.0112874779541449*G0_0_1 + 0.0112874779541447*G0_0_2 + 0.0112874779541447*G0_1_0 + 0.0112874779541448*G0_2_1 + 0.0112874779541446*G0_2_2;
-    A[652] = 0.0225749559082899*G0_0_0 - 0.0112874779541449*G0_0_1 + 0.0225749559082895*G0_0_2 - 0.0112874779541449*G0_1_0 - 0.0112874779541448*G0_1_2 + 0.0225749559082899*G0_2_0 - 0.0112874779541447*G0_2_1 + 0.0225749559082894*G0_2_2;
-    A[653] = -0.112874779541447*G0_0_0 - 0.0112874779541444*G0_0_1 - 0.112874779541448*G0_0_2 - 0.0112874779541447*G0_1_0 - 0.0451499118165789*G0_1_1 - 0.011287477954145*G0_1_2 - 0.112874779541447*G0_2_0 - 0.0112874779541443*G0_2_1 - 0.112874779541447*G0_2_2;
-    A[654] = 0.0225749559082895*G0_0_0 - 0.0112874779541446*G0_0_1 + 0.0225749559082897*G0_0_2 - 0.0112874779541447*G0_1_0 - 0.0112874779541448*G0_1_2 + 0.0225749559082895*G0_2_0 - 0.0112874779541445*G0_2_1 + 0.0225749559082898*G0_2_2;
-    A[655] = -0.0225749559082896*G0_0_0 - 0.0338624338624342*G0_0_1 + 0.0112874779541446*G0_1_0 + 0.0677248677248676*G0_1_1 - 0.0338624338624336*G0_1_2 - 0.0225749559082895*G0_2_0 - 0.033862433862434*G0_2_1;
-    A[656] = 0.112874779541447*G0_0_0 + 0.101587301587303*G0_0_1 + 0.0112874779541446*G0_1_0 - 0.0677248677248677*G0_1_1 + 0.101587301587302*G0_1_2 + 0.112874779541447*G0_2_0 + 0.101587301587302*G0_2_1;
-    A[657] = -0.0225749559082896*G0_0_0 - 0.0338624338624344*G0_0_1 + 0.0112874779541447*G0_1_0 + 0.0225749559082892*G0_1_1 - 0.0338624338624342*G0_1_2 - 0.0225749559082895*G0_2_0 - 0.0338624338624344*G0_2_1;
-    A[658] = 0.0112874779541452*G0_0_1 + 0.0112874779541447*G0_1_0 - 0.0451499118165783*G0_1_1 + 0.011287477954145*G0_1_2 + 0.011287477954145*G0_2_1;
-    A[659] = 0.0112874779541451*G0_0_1 + 0.0112874779541442*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.0112874779541449*G0_2_1;
-    A[660] = 0.0112874779541445*G0_0_1 + 0.0112874779541446*G0_1_0 + 0.0112874779541443*G0_1_2 + 0.0112874779541444*G0_2_1;
-    A[661] = -0.0338624338624343*G0_0_1 - 0.0225749559082896*G0_0_2 - 0.033862433862434*G0_1_0 + 0.0677248677248674*G0_1_1 + 0.0112874779541442*G0_1_2 - 0.0338624338624343*G0_2_1 - 0.0225749559082897*G0_2_2;
-    A[662] = -0.0338624338624344*G0_0_1 - 0.0225749559082891*G0_0_2 - 0.0338624338624337*G0_1_0 + 0.0225749559082897*G0_1_1 + 0.011287477954145*G0_1_2 - 0.0338624338624342*G0_2_1 - 0.022574955908289*G0_2_2;
+    A[650] = 0.00282186948853631*G0_0_1 + 0.00282186948853612*G0_0_2 + 0.00282186948853587*G0_1_0 - 0.0112874779541447*G0_1_1 - 0.0112874779541446*G0_1_2 + 0.00282186948853627*G0_2_1 + 0.00282186948853608*G0_2_2;
+    A[651] = 0.0112874779541449*G0_0_1 + 0.0112874779541447*G0_0_2 + 0.0112874779541447*G0_1_0 + 0.0112874779541448*G0_2_1 + 0.0112874779541445*G0_2_2;
+    A[652] = 0.02257495590829*G0_0_0 - 0.0112874779541449*G0_0_1 + 0.0225749559082896*G0_0_2 - 0.0112874779541449*G0_1_0 - 0.0112874779541447*G0_1_2 + 0.0225749559082899*G0_2_0 - 0.0112874779541448*G0_2_1 + 0.0225749559082895*G0_2_2;
+    A[653] = -0.112874779541447*G0_0_0 - 0.0112874779541444*G0_0_1 - 0.112874779541447*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.045149911816579*G0_1_1 - 0.011287477954145*G0_1_2 - 0.112874779541447*G0_2_0 - 0.0112874779541443*G0_2_1 - 0.112874779541447*G0_2_2;
+    A[654] = 0.0225749559082895*G0_0_0 - 0.0112874779541445*G0_0_1 + 0.0225749559082895*G0_0_2 - 0.0112874779541448*G0_1_0 - 0.0112874779541449*G0_1_2 + 0.0225749559082895*G0_2_0 - 0.0112874779541445*G0_2_1 + 0.0225749559082896*G0_2_2;
+    A[655] = -0.0225749559082893*G0_0_0 - 0.0338624338624342*G0_0_1 + 0.0112874779541447*G0_1_0 + 0.0677248677248675*G0_1_1 - 0.0338624338624338*G0_1_2 - 0.0225749559082892*G0_2_0 - 0.0338624338624341*G0_2_1;
+    A[656] = 0.112874779541447*G0_0_0 + 0.101587301587303*G0_0_1 + 0.0112874779541445*G0_1_0 - 0.0677248677248677*G0_1_1 + 0.101587301587302*G0_1_2 + 0.112874779541447*G0_2_0 + 0.101587301587302*G0_2_1;
+    A[657] = -0.0225749559082896*G0_0_0 - 0.0338624338624344*G0_0_1 + 0.0112874779541448*G0_1_0 + 0.0225749559082893*G0_1_1 - 0.033862433862434*G0_1_2 - 0.0225749559082896*G0_2_0 - 0.0338624338624344*G0_2_1;
+    A[658] = 0.0112874779541452*G0_0_1 + 0.0112874779541447*G0_1_0 - 0.0451499118165783*G0_1_1 + 0.0112874779541449*G0_1_2 + 0.0112874779541451*G0_2_1;
+    A[659] = 0.011287477954145*G0_0_1 + 0.011287477954144*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.0112874779541449*G0_2_1;
+    A[660] = 0.0112874779541444*G0_0_1 + 0.0112874779541447*G0_1_0 + 0.0112874779541444*G0_1_2 + 0.0112874779541444*G0_2_1;
+    A[661] = -0.0338624338624344*G0_0_1 - 0.0225749559082895*G0_0_2 - 0.0338624338624339*G0_1_0 + 0.0677248677248675*G0_1_1 + 0.0112874779541442*G0_1_2 - 0.0338624338624343*G0_2_1 - 0.0225749559082896*G0_2_2;
+    A[662] = -0.0338624338624346*G0_0_1 - 0.0225749559082891*G0_0_2 - 0.033862433862434*G0_1_0 + 0.0225749559082897*G0_1_1 + 0.0112874779541449*G0_1_2 - 0.0338624338624343*G0_2_1 - 0.022574955908289*G0_2_2;
     A[663] = 0.101587301587303*G0_0_1 + 0.112874779541447*G0_0_2 + 0.101587301587302*G0_1_0 - 0.0677248677248677*G0_1_1 + 0.0112874779541448*G0_1_2 + 0.101587301587302*G0_2_1 + 0.112874779541447*G0_2_2;
-    A[664] = 0.090299823633157*G0_1_1;
-    A[665] = -0.0705467372134043*G0_0_0 - 0.0705467372134043*G0_0_1 - 0.0705467372134043*G0_0_2 - 0.0246913580246911*G0_1_0 - 0.0246913580246912*G0_1_1 - 0.0246913580246912*G0_1_2 - 0.0246913580246911*G0_2_0 - 0.0246913580246911*G0_2_1 - 0.0246913580246912*G0_2_2;
-    A[666] = -0.0253968253968255*G0_0_0 - 0.0176366843033509*G0_1_0 - 0.017636684303351*G0_2_0;
-    A[667] = 0.00776014109347448*G0_1_1 + 0.00776014109347451*G0_2_1;
-    A[668] = 0.00776014109347447*G0_1_2 + 0.00776014109347446*G0_2_2;
-    A[669] = -0.0112874779541446*G0_1_1 - 0.0112874779541446*G0_1_2 - 0.0112874779541445*G0_2_1 - 0.0112874779541445*G0_2_2;
-    A[670] = -0.00282186948853618*G0_1_1 - 0.00282186948853609*G0_1_2 - 0.00282186948853624*G0_2_1 - 0.00282186948853616*G0_2_2;
-    A[671] = -0.0112874779541447*G0_1_1 - 0.0112874779541448*G0_1_2 - 0.0112874779541447*G0_2_1 - 0.0112874779541447*G0_2_2;
-    A[672] = -0.0225749559082888*G0_0_0 - 0.0338624338624337*G0_0_2 - 0.0338624338624336*G0_1_0 - 0.0451499118165784*G0_1_2 - 0.0338624338624336*G0_2_0 - 0.0451499118165784*G0_2_2;
-    A[673] = -0.0112874779541443*G0_0_0 - 0.0141093474426802*G0_0_2 - 0.0141093474426805*G0_1_0 - 0.0169312169312166*G0_1_2 - 0.0141093474426805*G0_2_0 - 0.0169312169312166*G0_2_2;
-    A[674] = -0.0112874779541445*G0_0_2 - 0.0112874779541447*G0_1_0 - 0.0225749559082891*G0_1_2 - 0.0112874779541447*G0_2_0 - 0.0225749559082891*G0_2_2;
-    A[675] = -0.0225749559082889*G0_0_0 - 0.0338624338624337*G0_0_1 - 0.0338624338624338*G0_1_0 - 0.0451499118165787*G0_1_1 - 0.0338624338624338*G0_2_0 - 0.0451499118165787*G0_2_1;
-    A[676] = -0.0112874779541444*G0_0_0 - 0.0141093474426805*G0_0_1 - 0.0141093474426804*G0_1_0 - 0.0169312169312163*G0_1_1 - 0.0141093474426804*G0_2_0 - 0.0169312169312162*G0_2_1;
-    A[677] = -0.0112874779541446*G0_0_1 - 0.0112874779541447*G0_1_0 - 0.0225749559082894*G0_1_1 - 0.0112874779541445*G0_2_0 - 0.0225749559082894*G0_2_1;
-    A[678] = 0.0225749559082886*G0_0_0 + 0.0225749559082886*G0_0_1 + 0.101587301587302*G0_0_2 + 0.101587301587301*G0_1_0 + 0.101587301587301*G0_1_1 + 0.0225749559082891*G0_1_2 + 0.101587301587301*G0_2_0 + 0.101587301587301*G0_2_1 + 0.0225749559082891*G0_2_2;
-    A[679] = -0.0112874779541442*G0_0_0 - 0.0112874779541442*G0_0_1 - 0.0423280423280431*G0_0_2 - 0.0423280423280425*G0_1_0 - 0.0423280423280425*G0_1_1 + 0.0169312169312167*G0_1_2 - 0.0423280423280424*G0_2_0 - 0.0423280423280424*G0_2_1 + 0.0169312169312168*G0_2_2;
-    A[680] = 0.0112874779541448*G0_0_2 + 0.0112874779541447*G0_1_0 + 0.0112874779541447*G0_1_1 - 0.022574955908289*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541447*G0_2_1 - 0.022574955908289*G0_2_2;
-    A[681] = 0.0225749559082887*G0_0_0 + 0.101587301587303*G0_0_1 + 0.0225749559082887*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0225749559082889*G0_1_1 + 0.101587301587301*G0_1_2 + 0.101587301587301*G0_2_0 + 0.0225749559082889*G0_2_1 + 0.101587301587301*G0_2_2;
-    A[682] = -0.0112874779541443*G0_0_0 - 0.0423280423280431*G0_0_1 - 0.0112874779541443*G0_0_2 - 0.0423280423280422*G0_1_0 + 0.0169312169312171*G0_1_1 - 0.0423280423280422*G0_1_2 - 0.0423280423280422*G0_2_0 + 0.0169312169312171*G0_2_1 - 0.0423280423280422*G0_2_2;
+    A[664] = 0.0902998236331572*G0_1_1;
+    A[665] = -0.0705467372134042*G0_0_0 - 0.0705467372134043*G0_0_1 - 0.0705467372134043*G0_0_2 - 0.0246913580246911*G0_1_0 - 0.0246913580246911*G0_1_1 - 0.0246913580246911*G0_1_2 - 0.024691358024691*G0_2_0 - 0.0246913580246911*G0_2_1 - 0.0246913580246911*G0_2_2;
+    A[666] = -0.0253968253968254*G0_0_0 - 0.0176366843033509*G0_1_0 - 0.0176366843033509*G0_2_0;
+    A[667] = 0.00776014109347447*G0_1_1 + 0.0077601410934745*G0_2_1;
+    A[668] = 0.00776014109347445*G0_1_2 + 0.00776014109347444*G0_2_2;
+    A[669] = -0.0112874779541446*G0_1_1 - 0.0112874779541447*G0_1_2 - 0.0112874779541445*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[670] = -0.00282186948853626*G0_1_1 - 0.00282186948853613*G0_1_2 - 0.00282186948853631*G0_2_1 - 0.00282186948853619*G0_2_2;
+    A[671] = -0.0112874779541446*G0_1_1 - 0.0112874779541447*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[672] = -0.0225749559082887*G0_0_0 - 0.0338624338624335*G0_0_2 - 0.0338624338624336*G0_1_0 - 0.0451499118165783*G0_1_2 - 0.0338624338624335*G0_2_0 - 0.0451499118165782*G0_2_2;
+    A[673] = -0.0112874779541444*G0_0_0 - 0.0141093474426804*G0_0_2 - 0.0141093474426806*G0_1_0 - 0.0169312169312169*G0_1_2 - 0.0141093474426806*G0_2_0 - 0.0169312169312169*G0_2_2;
+    A[674] = -0.0112874779541444*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.0225749559082889*G0_1_2 - 0.0112874779541446*G0_2_0 - 0.0225749559082889*G0_2_2;
+    A[675] = -0.0225749559082887*G0_0_0 - 0.0338624338624335*G0_0_1 - 0.0338624338624337*G0_1_0 - 0.0451499118165786*G0_1_1 - 0.0338624338624336*G0_2_0 - 0.0451499118165785*G0_2_1;
+    A[676] = -0.0112874779541443*G0_0_0 - 0.0141093474426805*G0_0_1 - 0.0141093474426804*G0_1_0 - 0.0169312169312161*G0_1_1 - 0.0141093474426804*G0_2_0 - 0.0169312169312161*G0_2_1;
+    A[677] = -0.0112874779541446*G0_0_1 - 0.0112874779541447*G0_1_0 - 0.0225749559082895*G0_1_1 - 0.0112874779541445*G0_2_0 - 0.0225749559082894*G0_2_1;
+    A[678] = 0.0225749559082886*G0_0_0 + 0.0225749559082886*G0_0_1 + 0.101587301587302*G0_0_2 + 0.101587301587301*G0_1_0 + 0.101587301587301*G0_1_1 + 0.0225749559082891*G0_1_2 + 0.101587301587301*G0_2_0 + 0.101587301587301*G0_2_1 + 0.022574955908289*G0_2_2;
+    A[679] = -0.0112874779541442*G0_0_0 - 0.0112874779541442*G0_0_1 - 0.0423280423280431*G0_0_2 - 0.0423280423280425*G0_1_0 - 0.0423280423280425*G0_1_1 + 0.0169312169312168*G0_1_2 - 0.0423280423280425*G0_2_0 - 0.0423280423280424*G0_2_1 + 0.0169312169312168*G0_2_2;
+    A[680] = 0.0112874779541448*G0_0_2 + 0.0112874779541446*G0_1_0 + 0.0112874779541446*G0_1_1 - 0.022574955908289*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541446*G0_2_1 - 0.0225749559082891*G0_2_2;
+    A[681] = 0.0225749559082887*G0_0_0 + 0.101587301587302*G0_0_1 + 0.0225749559082887*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0225749559082889*G0_1_1 + 0.101587301587301*G0_1_2 + 0.101587301587301*G0_2_0 + 0.0225749559082889*G0_2_1 + 0.101587301587301*G0_2_2;
+    A[682] = -0.0112874779541444*G0_0_0 - 0.042328042328043*G0_0_1 - 0.0112874779541444*G0_0_2 - 0.0423280423280422*G0_1_0 + 0.0169312169312171*G0_1_1 - 0.0423280423280422*G0_1_2 - 0.0423280423280422*G0_2_0 + 0.0169312169312171*G0_2_1 - 0.0423280423280422*G0_2_2;
     A[683] = 0.0112874779541449*G0_0_1 + 0.0112874779541446*G0_1_0 - 0.0225749559082892*G0_1_1 + 0.0112874779541446*G0_1_2 + 0.0112874779541445*G0_2_0 - 0.0225749559082893*G0_2_1 + 0.0112874779541445*G0_2_2;
     A[684] = 0.203174603174604*G0_0_0 + 0.12416225749559*G0_0_1 + 0.12416225749559*G0_0_2 + 0.12416225749559*G0_1_0 + 0.203174603174603*G0_1_1 + 0.203174603174603*G0_1_2 + 0.12416225749559*G0_2_0 + 0.203174603174603*G0_2_1 + 0.203174603174603*G0_2_2;
-    A[685] = -0.220105820105821*G0_0_0 - 0.0874779541446203*G0_0_1 - 0.0874779541446203*G0_0_2 - 0.16084656084656*G0_1_0 - 0.118518518518518*G0_1_1 - 0.118518518518518*G0_1_2 - 0.16084656084656*G0_2_0 - 0.118518518518518*G0_2_1 - 0.118518518518518*G0_2_2;
-    A[686] = 0.112874779541447*G0_0_0 + 0.0338624338624338*G0_0_1 + 0.0338624338624338*G0_0_2 + 0.079012345679012*G0_1_0 + 0.0451499118165785*G0_1_1 + 0.0451499118165785*G0_1_2 + 0.079012345679012*G0_2_0 + 0.0451499118165786*G0_2_1 + 0.0451499118165786*G0_2_2;
-    A[687] = -0.0451499118165776*G0_0_0 - 0.0564373897707218*G0_0_1 - 0.056437389770722*G0_0_2 - 0.0564373897707226*G0_1_0 - 0.067724867724867*G0_1_1 - 0.0677248677248672*G0_1_2 - 0.0564373897707225*G0_2_0 - 0.067724867724867*G0_2_1 - 0.0677248677248671*G0_2_2;
-    A[688] = -0.0112874779541447*G0_0_1 - 0.0112874779541445*G0_0_2 - 0.0112874779541447*G0_1_0 - 0.0225749559082894*G0_1_1 - 0.0225749559082892*G0_1_2 - 0.0112874779541445*G0_2_0 - 0.0225749559082892*G0_2_1 - 0.0225749559082889*G0_2_2;
-    A[689] = -0.0112874779541442*G0_0_1 - 0.0112874779541444*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0225749559082891*G0_1_2 - 0.0112874779541447*G0_2_0 - 0.0225749559082889*G0_2_1 - 0.0225749559082893*G0_2_2;
-    A[690] = -0.0451499118165779*G0_0_0 - 0.0338624338624332*G0_0_1 - 0.0338624338624331*G0_0_2 - 0.0338624338624341*G0_1_0 - 0.135449735449736*G0_1_1 - 0.135449735449735*G0_1_2 - 0.0338624338624339*G0_2_0 - 0.135449735449736*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[691] = 0.0112874779541444*G0_0_1 + 0.0112874779541442*G0_0_2 + 0.0112874779541447*G0_1_0 + 0.0451499118165789*G0_1_1 + 0.0451499118165784*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0451499118165788*G0_2_1 + 0.0451499118165785*G0_2_2;
-    A[692] = 0.0112874779541442*G0_0_1 + 0.0112874779541443*G0_0_2 + 0.0112874779541446*G0_1_0 + 0.0451499118165786*G0_1_1 + 0.0451499118165786*G0_1_2 + 0.0112874779541447*G0_2_0 + 0.0451499118165785*G0_2_1 + 0.0451499118165785*G0_2_2;
-    A[693] = -0.0677248677248665*G0_0_0 - 0.0790123456790113*G0_0_1 - 0.169312169312168*G0_0_2 - 0.169312169312169*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.270899470899471*G0_1_2 - 0.169312169312169*G0_2_0 - 0.0677248677248669*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[694] = 0.0677248677248667*G0_0_0 + 0.0564373897707217*G0_0_1 + 0.1015873015873*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0677248677248671*G0_1_1 + 0.135449735449734*G0_1_2 + 0.101587301587301*G0_2_0 + 0.067724867724867*G0_2_1 + 0.135449735449734*G0_2_2;
-    A[695] = 0.0225749559082885*G0_0_0 + 0.0112874779541442*G0_0_1 + 0.0564373897707227*G0_0_2 + 0.0564373897707229*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0902998236331572*G0_1_2 + 0.0564373897707228*G0_2_0 + 0.0225749559082888*G0_2_1 + 0.0902998236331571*G0_2_2;
-    A[696] = -0.0677248677248667*G0_0_0 - 0.169312169312168*G0_0_1 - 0.0790123456790116*G0_0_2 - 0.169312169312168*G0_1_0 - 0.270899470899471*G0_1_1 - 0.067724867724867*G0_1_2 - 0.169312169312169*G0_2_0 - 0.270899470899471*G0_2_1 - 0.0677248677248668*G0_2_2;
-    A[697] = 0.0677248677248669*G0_0_0 + 0.101587301587301*G0_0_1 + 0.056437389770722*G0_0_2 + 0.101587301587301*G0_1_0 + 0.135449735449734*G0_1_1 + 0.0677248677248672*G0_1_2 + 0.101587301587301*G0_2_0 + 0.135449735449734*G0_2_1 + 0.0677248677248671*G0_2_2;
-    A[698] = 0.0225749559082886*G0_0_0 + 0.056437389770723*G0_0_1 + 0.0112874779541445*G0_0_2 + 0.0564373897707226*G0_1_0 + 0.0902998236331568*G0_1_1 + 0.0225749559082889*G0_1_2 + 0.0564373897707226*G0_2_0 + 0.0902998236331568*G0_2_1 + 0.0225749559082886*G0_2_2;
-    A[699] = 0.0902998236331555*G0_0_0 + 0.0902998236331561*G0_0_1 + 0.090299823633156*G0_0_2 + 0.0902998236331567*G0_1_0 + 0.0902998236331563*G0_1_1 + 0.0902998236331564*G0_1_2 + 0.0902998236331565*G0_2_0 + 0.0902998236331559*G0_2_1 + 0.0902998236331564*G0_2_2;
-    A[700] = 0.0529100529100533*G0_0_0 + 0.0529100529100533*G0_0_1 + 0.0529100529100533*G0_0_2 + 0.0202821869488535*G0_1_0 + 0.0202821869488534*G0_1_1 + 0.0202821869488535*G0_1_2 + 0.0202821869488535*G0_2_0 + 0.0202821869488534*G0_2_1 + 0.0202821869488535*G0_2_2;
-    A[701] = 0.052910052910053*G0_0_0 + 0.0326278659611994*G0_1_0 + 0.0326278659611994*G0_2_0;
-    A[702] = 0.00511463844797182*G0_1_1 + 0.00511463844797184*G0_2_1;
-    A[703] = 0.00511463844797175*G0_1_2 + 0.00511463844797172*G0_2_2;
-    A[704] = -0.0028218694885363*G0_1_1 - 0.00282186948853627*G0_1_2 - 0.00282186948853619*G0_2_1 - 0.00282186948853612*G0_2_2;
-    A[705] = -0.00917107583774259*G0_1_1 - 0.00917107583774252*G0_1_2 - 0.00917107583774262*G0_2_1 - 0.00917107583774262*G0_2_2;
-    A[706] = -0.00282186948853623*G0_1_1 - 0.0028218694885363*G0_1_2 - 0.00282186948853624*G0_2_1 - 0.00282186948853624*G0_2_2;
-    A[707] = 0.0169312169312161*G0_0_0 + 0.0592592592592587*G0_0_2 + 0.0592592592592587*G0_1_0 + 0.0902998236331568*G0_1_2 + 0.0592592592592586*G0_2_0 + 0.0902998236331568*G0_2_2;
-    A[708] = -0.00282186948853628*G0_0_0 + 0.0105820105820101*G0_0_2 + 0.0105820105820106*G0_1_0 + 0.0211640211640207*G0_1_2 + 0.0105820105820106*G0_2_0 + 0.0211640211640207*G0_2_2;
-    A[709] = -0.00282186948853606*G0_0_2 - 0.00282186948853622*G0_1_0 - 0.0169312169312168*G0_1_2 - 0.00282186948853623*G0_2_0 - 0.0169312169312168*G0_2_2;
-    A[710] = 0.0169312169312161*G0_0_0 + 0.0592592592592587*G0_0_1 + 0.0592592592592587*G0_1_0 + 0.0902998236331571*G0_1_1 + 0.0592592592592587*G0_2_0 + 0.0902998236331571*G0_2_1;
-    A[711] = -0.00282186948853589*G0_0_0 + 0.0105820105820104*G0_0_1 + 0.0105820105820107*G0_1_0 + 0.0211640211640206*G0_1_1 + 0.0105820105820107*G0_2_0 + 0.0211640211640206*G0_2_1;
-    A[712] = -0.00282186948853601*G0_0_1 - 0.00282186948853625*G0_1_0 - 0.016931216931217*G0_1_1 - 0.0028218694885361*G0_2_0 - 0.0169312169312168*G0_2_1;
-    A[713] = 0.0169312169312175*G0_0_0 + 0.0169312169312175*G0_0_1 - 0.0423280423280432*G0_0_2 - 0.0423280423280419*G0_1_0 - 0.042328042328042*G0_1_1 - 0.0112874779541446*G0_1_2 - 0.0423280423280419*G0_2_0 - 0.042328042328042*G0_2_1 - 0.0112874779541446*G0_2_2;
-    A[714] = -0.00282186948853634*G0_0_0 - 0.00282186948853631*G0_0_1 - 0.0134038800705458*G0_0_2 - 0.013403880070547*G0_1_0 - 0.0134038800705469*G0_1_1 - 0.00282186948853595*G0_1_2 - 0.0134038800705469*G0_2_0 - 0.0134038800705469*G0_2_1 - 0.00282186948853594*G0_2_2;
-    A[715] = 0.00282186948853573*G0_0_2 + 0.00282186948853625*G0_1_0 + 0.00282186948853622*G0_1_1 - 0.0112874779541446*G0_1_2 + 0.00282186948853625*G0_2_0 + 0.00282186948853623*G0_2_1 - 0.0112874779541446*G0_2_2;
-    A[716] = 0.0169312169312176*G0_0_0 - 0.0423280423280431*G0_0_1 + 0.0169312169312175*G0_0_2 - 0.0423280423280419*G0_1_0 - 0.0112874779541443*G0_1_1 - 0.0423280423280419*G0_1_2 - 0.0423280423280419*G0_2_0 - 0.0112874779541442*G0_2_1 - 0.0423280423280419*G0_2_2;
-    A[717] = -0.00282186948853618*G0_0_0 - 0.0134038800705461*G0_0_1 - 0.00282186948853616*G0_0_2 - 0.0134038800705468*G0_1_0 - 0.00282186948853631*G0_1_1 - 0.0134038800705469*G0_1_2 - 0.0134038800705468*G0_2_0 - 0.00282186948853636*G0_2_1 - 0.0134038800705469*G0_2_2;
-    A[718] = 0.00282186948853592*G0_0_1 + 0.00282186948853629*G0_1_0 - 0.0112874779541447*G0_1_1 + 0.00282186948853628*G0_1_2 + 0.00282186948853614*G0_2_0 - 0.0112874779541447*G0_2_1 + 0.00282186948853613*G0_2_2;
-    A[719] = -0.220105820105821*G0_0_0 - 0.16084656084656*G0_0_1 - 0.16084656084656*G0_0_2 - 0.0874779541446203*G0_1_0 - 0.118518518518518*G0_1_1 - 0.118518518518518*G0_1_2 - 0.0874779541446203*G0_2_0 - 0.118518518518518*G0_2_1 - 0.118518518518518*G0_2_2;
-    A[720] = 0.334391534391535*G0_0_0 + 0.167195767195767*G0_0_1 + 0.167195767195767*G0_0_2 + 0.167195767195767*G0_1_0 + 0.24973544973545*G0_1_1 + 0.24973544973545*G0_1_2 + 0.167195767195767*G0_2_0 + 0.24973544973545*G0_2_1 + 0.24973544973545*G0_2_2;
-    A[721] = -0.22010582010582*G0_0_0 - 0.0592592592592589*G0_0_1 - 0.059259259259259*G0_0_2 - 0.132627865961199*G0_1_0 - 0.0902998236331571*G0_1_1 - 0.0902998236331571*G0_1_2 - 0.132627865961199*G0_2_0 - 0.0902998236331571*G0_2_1 - 0.0902998236331571*G0_2_2;
-    A[722] = 0.0225749559082887*G0_0_0 + 0.0423280423280405*G0_0_1 + 0.0423280423280409*G0_0_2 + 0.0423280423280418*G0_1_0 + 0.0846560846560835*G0_1_1 + 0.0846560846560838*G0_1_2 + 0.0423280423280419*G0_2_0 + 0.0846560846560835*G0_2_1 + 0.0846560846560838*G0_2_2;
-    A[723] = -0.00282186948853571*G0_0_1 - 0.00282186948853566*G0_0_2 - 0.00282186948853646*G0_1_0 + 0.0169312169312169*G0_1_1 + 0.0169312169312169*G0_1_2 - 0.00282186948853619*G0_2_0 + 0.0169312169312171*G0_2_1 + 0.0169312169312173*G0_2_2;
-    A[724] = -0.002821869488536*G0_0_1 - 0.00282186948853604*G0_0_2 - 0.00282186948853602*G0_1_0 + 0.0169312169312172*G0_1_1 + 0.0169312169312169*G0_1_2 - 0.00282186948853613*G0_2_0 + 0.0169312169312171*G0_2_1 + 0.0169312169312168*G0_2_2;
-    A[725] = 0.0225749559082893*G0_0_0 - 0.0197530864197536*G0_0_1 - 0.019753086419754*G0_0_2 - 0.0197530864197533*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0225749559082888*G0_1_2 - 0.0197530864197533*G0_2_0 + 0.0225749559082888*G0_2_1 + 0.0225749559082887*G0_2_2;
-    A[726] = 0.00282186948853612*G0_0_1 + 0.00282186948853634*G0_0_2 + 0.00282186948853649*G0_1_0 + 0.0225749559082894*G0_1_1 + 0.0225749559082895*G0_1_2 + 0.00282186948853622*G0_2_0 + 0.0225749559082893*G0_2_1 + 0.0225749559082896*G0_2_2;
-    A[727] = 0.00282186948853645*G0_0_1 + 0.00282186948853636*G0_0_2 + 0.00282186948853606*G0_1_0 + 0.0225749559082896*G0_1_1 + 0.0225749559082894*G0_1_2 + 0.00282186948853617*G0_2_0 + 0.0225749559082896*G0_2_1 + 0.0225749559082893*G0_2_2;
-    A[728] = -0.0169312169312181*G0_0_0 + 0.0253968253968246*G0_0_1 + 0.16084656084656*G0_0_2 + 0.16084656084656*G0_1_0 + 0.118518518518518*G0_1_1 + 0.0677248677248662*G0_1_2 + 0.16084656084656*G0_2_0 + 0.118518518518518*G0_2_1 + 0.0677248677248662*G0_2_2;
-    A[729] = -0.0169312169312154*G0_0_0 - 0.0423280423280405*G0_0_1 - 0.177777777777776*G0_0_2 - 0.177777777777777*G0_1_0 - 0.0846560846560836*G0_1_1 - 0.27089947089947*G0_1_2 - 0.177777777777777*G0_2_0 - 0.0846560846560836*G0_2_1 - 0.27089947089947*G0_2_2;
-    A[730] = 0.00564373897707262*G0_0_0 + 0.002821869488536*G0_0_1 + 0.00282186948853627*G0_0_2 + 0.00282186948853636*G0_1_0 - 0.0169312169312172*G0_1_1 + 0.067724867724868*G0_1_2 + 0.00282186948853635*G0_2_0 - 0.0169312169312171*G0_2_1 + 0.067724867724868*G0_2_2;
-    A[731] = -0.0169312169312182*G0_0_0 + 0.16084656084656*G0_0_1 + 0.0253968253968249*G0_0_2 + 0.16084656084656*G0_1_0 + 0.0677248677248662*G0_1_1 + 0.118518518518518*G0_1_2 + 0.16084656084656*G0_2_0 + 0.0677248677248663*G0_2_1 + 0.118518518518518*G0_2_2;
-    A[732] = -0.0169312169312154*G0_0_0 - 0.177777777777777*G0_0_1 - 0.0423280423280407*G0_0_2 - 0.177777777777777*G0_1_0 - 0.27089947089947*G0_1_1 - 0.0846560846560837*G0_1_2 - 0.177777777777777*G0_2_0 - 0.27089947089947*G0_2_1 - 0.0846560846560837*G0_2_2;
-    A[733] = 0.00564373897707208*G0_0_0 + 0.00282186948853586*G0_0_1 + 0.00282186948853573*G0_0_2 + 0.00282186948853619*G0_1_0 + 0.0677248677248685*G0_1_1 - 0.0169312169312167*G0_1_2 + 0.00282186948853614*G0_2_0 + 0.0677248677248683*G0_2_1 - 0.0169312169312171*G0_2_2;
-    A[734] = -0.045149911816578*G0_0_0 - 0.0225749559082889*G0_0_1 - 0.0225749559082889*G0_0_2 - 0.0225749559082886*G0_1_0 - 0.135449735449735*G0_1_1 - 0.135449735449735*G0_1_2 - 0.0225749559082887*G0_2_0 - 0.135449735449735*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[735] = -0.0253968253968256*G0_0_0 - 0.0253968253968256*G0_0_1 - 0.0253968253968256*G0_0_2 - 0.00776014109347449*G0_1_0 - 0.00776014109347439*G0_1_1 - 0.00776014109347442*G0_1_2 - 0.00776014109347449*G0_2_0 - 0.00776014109347439*G0_2_1 - 0.00776014109347442*G0_2_2;
-    A[736] = -0.070546737213404*G0_0_0 - 0.0458553791887127*G0_1_0 - 0.0458553791887127*G0_2_0;
-    A[737] = 0.00776014109347445*G0_1_1 + 0.00776014109347452*G0_2_1;
-    A[738] = 0.00776014109347447*G0_1_2 + 0.00776014109347445*G0_2_2;
-    A[739] = -0.0112874779541447*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0112874779541447*G0_2_2;
-    A[740] = -0.00282186948853624*G0_1_1 - 0.00282186948853606*G0_1_2 - 0.00282186948853626*G0_2_1 - 0.00282186948853613*G0_2_2;
-    A[741] = -0.0112874779541449*G0_1_1 - 0.011287477954145*G0_1_2 - 0.0112874779541449*G0_2_1 - 0.011287477954145*G0_2_2;
-    A[742] = 0.0225749559082897*G0_0_0 - 0.0790123456790122*G0_0_2 - 0.0790123456790125*G0_1_0 - 0.158024691358025*G0_1_2 - 0.0790123456790125*G0_2_0 - 0.158024691358025*G0_2_2;
-    A[743] = -0.0112874779541447*G0_0_0 + 0.0310405643738981*G0_0_2 + 0.031040564373898*G0_1_0 + 0.0902998236331575*G0_1_2 + 0.0310405643738979*G0_2_0 + 0.0902998236331574*G0_2_2;
-    A[744] = -0.0112874779541448*G0_0_2 - 0.0112874779541449*G0_1_0 - 0.0451499118165785*G0_1_2 - 0.0112874779541449*G0_2_0 - 0.0451499118165785*G0_2_2;
-    A[745] = 0.0225749559082898*G0_0_0 - 0.0790123456790122*G0_0_1 - 0.0790123456790124*G0_1_0 - 0.158024691358026*G0_1_1 - 0.0790123456790124*G0_2_0 - 0.158024691358026*G0_2_1;
-    A[746] = -0.0112874779541448*G0_0_0 + 0.031040564373898*G0_0_1 + 0.0310405643738977*G0_1_0 + 0.0902998236331575*G0_1_1 + 0.0310405643738977*G0_2_0 + 0.0902998236331575*G0_2_1;
-    A[747] = -0.0112874779541446*G0_0_1 - 0.0112874779541449*G0_1_0 - 0.0451499118165789*G0_1_1 - 0.0112874779541447*G0_2_0 - 0.0451499118165787*G0_2_1;
-    A[748] = -0.0225749559082896*G0_0_0 - 0.0225749559082896*G0_0_1 + 0.011287477954145*G0_0_2 + 0.0112874779541446*G0_1_0 + 0.0112874779541445*G0_1_1 + 0.0112874779541446*G0_2_0 + 0.0112874779541445*G0_2_1;
-    A[749] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_1 + 0.00282186948853567*G0_0_2 + 0.00282186948853609*G0_1_0 + 0.00282186948853606*G0_1_1 + 0.00282186948853606*G0_2_0 + 0.00282186948853604*G0_2_1;
-    A[750] = 0.0112874779541449*G0_0_2 + 0.0112874779541448*G0_1_0 + 0.0112874779541449*G0_1_1 + 0.0112874779541448*G0_2_0 + 0.0112874779541449*G0_2_1;
-    A[751] = -0.0225749559082898*G0_0_0 + 0.0112874779541448*G0_0_1 - 0.0225749559082898*G0_0_2 + 0.0112874779541447*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.0112874779541447*G0_2_0 + 0.0112874779541445*G0_2_2;
-    A[752] = -0.0112874779541444*G0_0_0 + 0.00282186948853602*G0_0_1 - 0.0112874779541444*G0_0_2 + 0.00282186948853593*G0_1_0 + 0.00282186948853604*G0_1_2 + 0.00282186948853594*G0_2_0 + 0.00282186948853605*G0_2_2;
-    A[753] = 0.0112874779541447*G0_0_1 + 0.0112874779541449*G0_1_0 + 0.0112874779541448*G0_1_2 + 0.0112874779541447*G0_2_0 + 0.0112874779541446*G0_2_2;
-    A[754] = 0.112874779541447*G0_0_0 + 0.079012345679012*G0_0_1 + 0.079012345679012*G0_0_2 + 0.0338624338624338*G0_1_0 + 0.0451499118165785*G0_1_1 + 0.0451499118165786*G0_1_2 + 0.0338624338624338*G0_2_0 + 0.0451499118165785*G0_2_1 + 0.0451499118165786*G0_2_2;
-    A[755] = -0.22010582010582*G0_0_0 - 0.132627865961199*G0_0_1 - 0.132627865961199*G0_0_2 - 0.0592592592592589*G0_1_0 - 0.0902998236331571*G0_1_1 - 0.0902998236331571*G0_1_2 - 0.059259259259259*G0_2_0 - 0.0902998236331571*G0_2_1 - 0.0902998236331571*G0_2_2;
-    A[756] = 0.203174603174604*G0_0_0 + 0.0790123456790124*G0_0_1 + 0.0790123456790124*G0_0_2 + 0.0790123456790124*G0_1_0 + 0.158024691358026*G0_1_1 + 0.158024691358026*G0_1_2 + 0.0790123456790124*G0_2_0 + 0.158024691358026*G0_2_1 + 0.158024691358026*G0_2_2;
-    A[757] = -0.0451499118165783*G0_0_0 - 0.0112874779541436*G0_0_1 - 0.0112874779541438*G0_0_2 - 0.0112874779541444*G0_1_0 - 0.112874779541446*G0_1_1 - 0.112874779541446*G0_1_2 - 0.0112874779541444*G0_2_0 - 0.112874779541446*G0_2_1 - 0.112874779541446*G0_2_2;
-    A[758] = -0.0112874779541448*G0_0_1 - 0.0112874779541447*G0_0_2 - 0.0112874779541453*G0_1_0 + 0.0225749559082887*G0_1_1 + 0.0225749559082887*G0_1_2 - 0.0112874779541449*G0_2_0 + 0.0225749559082891*G0_2_1 + 0.0225749559082891*G0_2_2;
-    A[759] = -0.011287477954145*G0_0_1 - 0.0112874779541449*G0_0_2 - 0.0112874779541452*G0_1_0 + 0.0225749559082891*G0_1_1 + 0.0225749559082888*G0_1_2 - 0.0112874779541453*G0_2_0 + 0.022574955908289*G0_2_1 + 0.0225749559082887*G0_2_2;
-    A[760] = -0.0451499118165783*G0_0_0 + 0.0112874779541452*G0_0_1 + 0.0112874779541454*G0_0_2 + 0.0112874779541446*G0_1_0 + 0.0112874779541444*G0_2_0;
-    A[761] = 0.0112874779541442*G0_0_1 + 0.0112874779541444*G0_0_2 + 0.0112874779541453*G0_1_0 + 0.0112874779541449*G0_2_0;
-    A[762] = 0.0112874779541445*G0_0_1 + 0.0112874779541444*G0_0_2 + 0.0112874779541451*G0_1_0 + 0.0112874779541452*G0_2_0;
-    A[763] = 0.0677248677248684*G0_0_0 + 0.011287477954145*G0_0_1 - 0.0338624338624331*G0_0_2 - 0.0338624338624336*G0_1_0 - 0.022574955908289*G0_1_1 - 0.0338624338624336*G0_2_0 - 0.0225749559082891*G0_2_1;
-    A[764] = -0.0677248677248685*G0_0_0 + 0.0112874779541435*G0_0_1 + 0.101587301587301*G0_0_2 + 0.101587301587302*G0_1_0 + 0.112874779541446*G0_1_1 + 0.101587301587302*G0_2_0 + 0.112874779541446*G0_2_1;
-    A[765] = 0.0225749559082893*G0_0_0 + 0.0112874779541451*G0_0_1 - 0.0338624338624338*G0_0_2 - 0.0338624338624341*G0_1_0 - 0.0225749559082893*G0_1_1 - 0.0338624338624341*G0_2_0 - 0.0225749559082891*G0_2_1;
-    A[766] = 0.0677248677248685*G0_0_0 - 0.033862433862433*G0_0_1 + 0.011287477954145*G0_0_2 - 0.0338624338624337*G0_1_0 - 0.0225749559082893*G0_1_2 - 0.0338624338624338*G0_2_0 - 0.0225749559082894*G0_2_2;
-    A[767] = -0.0677248677248686*G0_0_0 + 0.101587301587301*G0_0_1 + 0.0112874779541436*G0_0_2 + 0.101587301587301*G0_1_0 + 0.112874779541446*G0_1_2 + 0.101587301587302*G0_2_0 + 0.112874779541446*G0_2_2;
-    A[768] = 0.0225749559082893*G0_0_0 - 0.0338624338624341*G0_0_1 + 0.0112874779541446*G0_0_2 - 0.0338624338624337*G0_1_0 - 0.0225749559082885*G0_1_2 - 0.0338624338624336*G0_2_0 - 0.022574955908289*G0_2_2;
+    A[685] = -0.22010582010582*G0_0_0 - 0.0874779541446201*G0_0_1 - 0.0874779541446201*G0_0_2 - 0.16084656084656*G0_1_0 - 0.118518518518518*G0_1_1 - 0.118518518518518*G0_1_2 - 0.16084656084656*G0_2_0 - 0.118518518518517*G0_2_1 - 0.118518518518518*G0_2_2;
+    A[686] = 0.112874779541446*G0_0_0 + 0.0338624338624336*G0_0_1 + 0.0338624338624336*G0_0_2 + 0.0790123456790118*G0_1_0 + 0.0451499118165784*G0_1_1 + 0.0451499118165785*G0_1_2 + 0.0790123456790118*G0_2_0 + 0.0451499118165784*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[687] = -0.0451499118165775*G0_0_0 - 0.0564373897707217*G0_0_1 - 0.0564373897707218*G0_0_2 - 0.0564373897707225*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.0677248677248669*G0_1_2 - 0.0564373897707224*G0_2_0 - 0.0677248677248671*G0_2_1 - 0.0677248677248668*G0_2_2;
+    A[688] = -0.0112874779541448*G0_0_1 - 0.0112874779541445*G0_0_2 - 0.0112874779541448*G0_1_0 - 0.0225749559082893*G0_1_1 - 0.0225749559082891*G0_1_2 - 0.0112874779541446*G0_2_0 - 0.0225749559082891*G0_2_1 - 0.0225749559082888*G0_2_2;
+    A[689] = -0.0112874779541442*G0_0_1 - 0.0112874779541445*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0225749559082893*G0_1_2 - 0.0112874779541446*G0_2_0 - 0.0225749559082889*G0_2_1 - 0.0225749559082894*G0_2_2;
+    A[690] = -0.045149911816578*G0_0_0 - 0.0338624338624333*G0_0_1 - 0.033862433862433*G0_0_2 - 0.033862433862434*G0_1_0 - 0.135449735449736*G0_1_1 - 0.135449735449736*G0_1_2 - 0.0338624338624339*G0_2_0 - 0.135449735449736*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[691] = 0.0112874779541445*G0_0_1 + 0.0112874779541444*G0_0_2 + 0.0112874779541448*G0_1_0 + 0.0451499118165789*G0_1_1 + 0.0451499118165785*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0451499118165788*G0_2_1 + 0.0451499118165786*G0_2_2;
+    A[692] = 0.0112874779541443*G0_0_1 + 0.0112874779541442*G0_0_2 + 0.0112874779541445*G0_1_0 + 0.0451499118165787*G0_1_1 + 0.0451499118165785*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0451499118165787*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[693] = -0.0677248677248664*G0_0_0 - 0.0790123456790112*G0_0_1 - 0.169312169312168*G0_0_2 - 0.169312169312169*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.270899470899471*G0_1_2 - 0.169312169312169*G0_2_0 - 0.0677248677248669*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[694] = 0.0677248677248665*G0_0_0 + 0.0564373897707216*G0_0_1 + 0.1015873015873*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0677248677248672*G0_1_1 + 0.135449735449734*G0_1_2 + 0.101587301587301*G0_2_0 + 0.0677248677248671*G0_2_1 + 0.135449735449734*G0_2_2;
+    A[695] = 0.0225749559082886*G0_0_0 + 0.0112874779541442*G0_0_1 + 0.0564373897707227*G0_0_2 + 0.056437389770723*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0902998236331572*G0_1_2 + 0.056437389770723*G0_2_0 + 0.0225749559082888*G0_2_1 + 0.0902998236331571*G0_2_2;
+    A[696] = -0.0677248677248664*G0_0_0 - 0.169312169312168*G0_0_1 - 0.0790123456790114*G0_0_2 - 0.169312169312169*G0_1_0 - 0.27089947089947*G0_1_1 - 0.067724867724867*G0_1_2 - 0.169312169312169*G0_2_0 - 0.270899470899471*G0_2_1 - 0.0677248677248669*G0_2_2;
+    A[697] = 0.0677248677248665*G0_0_0 + 0.1015873015873*G0_0_1 + 0.0564373897707216*G0_0_2 + 0.101587301587301*G0_1_0 + 0.135449735449734*G0_1_1 + 0.067724867724867*G0_1_2 + 0.101587301587301*G0_2_0 + 0.135449735449734*G0_2_1 + 0.0677248677248669*G0_2_2;
+    A[698] = 0.0225749559082887*G0_0_0 + 0.0564373897707231*G0_0_1 + 0.0112874779541444*G0_0_2 + 0.0564373897707226*G0_1_0 + 0.0902998236331569*G0_1_1 + 0.022574955908289*G0_1_2 + 0.0564373897707226*G0_2_0 + 0.0902998236331568*G0_2_1 + 0.0225749559082886*G0_2_2;
+    A[699] = 0.0902998236331556*G0_0_0 + 0.0902998236331561*G0_0_1 + 0.090299823633156*G0_0_2 + 0.0902998236331565*G0_1_0 + 0.0902998236331562*G0_1_1 + 0.0902998236331564*G0_1_2 + 0.0902998236331563*G0_2_0 + 0.0902998236331558*G0_2_1 + 0.0902998236331564*G0_2_2;
+    A[700] = 0.0529100529100532*G0_0_0 + 0.0529100529100532*G0_0_1 + 0.0529100529100532*G0_0_2 + 0.0202821869488534*G0_1_0 + 0.0202821869488533*G0_1_1 + 0.0202821869488534*G0_1_2 + 0.0202821869488534*G0_2_0 + 0.0202821869488533*G0_2_1 + 0.0202821869488534*G0_2_2;
+    A[701] = 0.0529100529100529*G0_0_0 + 0.0326278659611993*G0_1_0 + 0.0326278659611993*G0_2_0;
+    A[702] = 0.0051146384479718*G0_1_1 + 0.00511463844797182*G0_2_1;
+    A[703] = 0.00511463844797176*G0_1_2 + 0.00511463844797173*G0_2_2;
+    A[704] = -0.00282186948853632*G0_1_1 - 0.00282186948853629*G0_1_2 - 0.00282186948853618*G0_2_1 - 0.0028218694885361*G0_2_2;
+    A[705] = -0.00917107583774257*G0_1_1 - 0.00917107583774246*G0_1_2 - 0.0091710758377426*G0_2_1 - 0.00917107583774258*G0_2_2;
+    A[706] = -0.00282186948853627*G0_1_1 - 0.00282186948853634*G0_1_2 - 0.00282186948853628*G0_2_1 - 0.00282186948853627*G0_2_2;
+    A[707] = 0.016931216931216*G0_0_0 + 0.0592592592592585*G0_0_2 + 0.0592592592592585*G0_1_0 + 0.0902998236331566*G0_1_2 + 0.0592592592592585*G0_2_0 + 0.0902998236331566*G0_2_2;
+    A[708] = -0.0028218694885362*G0_0_0 + 0.0105820105820103*G0_0_2 + 0.0105820105820107*G0_1_0 + 0.0211640211640209*G0_1_2 + 0.0105820105820107*G0_2_0 + 0.0211640211640209*G0_2_2;
+    A[709] = -0.00282186948853622*G0_0_2 - 0.00282186948853626*G0_1_0 - 0.0169312169312169*G0_1_2 - 0.00282186948853626*G0_2_0 - 0.0169312169312169*G0_2_2;
+    A[710] = 0.016931216931216*G0_0_0 + 0.0592592592592586*G0_0_1 + 0.0592592592592586*G0_1_0 + 0.0902998236331569*G0_1_1 + 0.0592592592592586*G0_2_0 + 0.0902998236331569*G0_2_1;
+    A[711] = -0.00282186948853602*G0_0_0 + 0.0105820105820105*G0_0_1 + 0.0105820105820107*G0_1_0 + 0.0211640211640206*G0_1_1 + 0.0105820105820107*G0_2_0 + 0.0211640211640206*G0_2_1;
+    A[712] = -0.00282186948853603*G0_0_1 - 0.00282186948853628*G0_1_0 - 0.016931216931217*G0_1_1 - 0.00282186948853608*G0_2_0 - 0.0169312169312168*G0_2_1;
+    A[713] = 0.0169312169312174*G0_0_0 + 0.0169312169312174*G0_0_1 - 0.0423280423280431*G0_0_2 - 0.0423280423280419*G0_1_0 - 0.042328042328042*G0_1_1 - 0.0112874779541445*G0_1_2 - 0.0423280423280419*G0_2_0 - 0.042328042328042*G0_2_1 - 0.0112874779541445*G0_2_2;
+    A[714] = -0.00282186948853638*G0_0_0 - 0.00282186948853637*G0_0_1 - 0.0134038800705459*G0_0_2 - 0.0134038800705469*G0_1_0 - 0.0134038800705469*G0_1_1 - 0.00282186948853591*G0_1_2 - 0.0134038800705469*G0_2_0 - 0.0134038800705469*G0_2_1 - 0.00282186948853591*G0_2_2;
+    A[715] = 0.00282186948853579*G0_0_2 + 0.00282186948853629*G0_1_0 + 0.00282186948853626*G0_1_1 - 0.0112874779541446*G0_1_2 + 0.00282186948853629*G0_2_0 + 0.00282186948853627*G0_2_1 - 0.0112874779541446*G0_2_2;
+    A[716] = 0.0169312169312175*G0_0_0 - 0.042328042328043*G0_0_1 + 0.0169312169312175*G0_0_2 - 0.0423280423280419*G0_1_0 - 0.0112874779541442*G0_1_1 - 0.0423280423280419*G0_1_2 - 0.0423280423280419*G0_2_0 - 0.0112874779541442*G0_2_1 - 0.0423280423280419*G0_2_2;
+    A[717] = -0.00282186948853597*G0_0_0 - 0.0134038800705461*G0_0_1 - 0.00282186948853595*G0_0_2 - 0.0134038800705469*G0_1_0 - 0.00282186948853631*G0_1_1 - 0.013403880070547*G0_1_2 - 0.0134038800705469*G0_2_0 - 0.00282186948853634*G0_2_1 - 0.0134038800705469*G0_2_2;
+    A[718] = 0.00282186948853588*G0_0_1 + 0.00282186948853631*G0_1_0 - 0.0112874779541447*G0_1_1 + 0.00282186948853627*G0_1_2 + 0.00282186948853612*G0_2_0 - 0.0112874779541446*G0_2_1 + 0.00282186948853608*G0_2_2;
+    A[719] = -0.22010582010582*G0_0_0 - 0.16084656084656*G0_0_1 - 0.16084656084656*G0_0_2 - 0.0874779541446201*G0_1_0 - 0.118518518518518*G0_1_1 - 0.118518518518517*G0_1_2 - 0.0874779541446201*G0_2_0 - 0.118518518518518*G0_2_1 - 0.118518518518518*G0_2_2;
+    A[720] = 0.334391534391534*G0_0_0 + 0.167195767195766*G0_0_1 + 0.167195767195766*G0_0_2 + 0.167195767195766*G0_1_0 + 0.249735449735449*G0_1_1 + 0.249735449735449*G0_1_2 + 0.167195767195766*G0_2_0 + 0.249735449735449*G0_2_1 + 0.249735449735449*G0_2_2;
+    A[721] = -0.22010582010582*G0_0_0 - 0.0592592592592587*G0_0_1 - 0.0592592592592588*G0_0_2 - 0.132627865961199*G0_1_0 - 0.0902998236331569*G0_1_1 - 0.0902998236331569*G0_1_2 - 0.132627865961199*G0_2_0 - 0.0902998236331569*G0_2_1 - 0.090299823633157*G0_2_2;
+    A[722] = 0.0225749559082887*G0_0_0 + 0.0423280423280405*G0_0_1 + 0.0423280423280408*G0_0_2 + 0.0423280423280417*G0_1_0 + 0.0846560846560835*G0_1_1 + 0.0846560846560837*G0_1_2 + 0.0423280423280418*G0_2_0 + 0.0846560846560835*G0_2_1 + 0.0846560846560837*G0_2_2;
+    A[723] = -0.0028218694885357*G0_0_1 - 0.00282186948853564*G0_0_2 - 0.0028218694885364*G0_1_0 + 0.0169312169312169*G0_1_1 + 0.0169312169312169*G0_1_2 - 0.0028218694885361*G0_2_0 + 0.0169312169312171*G0_2_1 + 0.0169312169312173*G0_2_2;
+    A[724] = -0.00282186948853607*G0_0_1 - 0.00282186948853603*G0_0_2 - 0.00282186948853611*G0_1_0 + 0.0169312169312171*G0_1_1 + 0.016931216931217*G0_1_2 - 0.00282186948853622*G0_2_0 + 0.016931216931217*G0_2_1 + 0.0169312169312168*G0_2_2;
+    A[725] = 0.0225749559082893*G0_0_0 - 0.0197530864197533*G0_0_1 - 0.0197530864197539*G0_0_2 - 0.0197530864197534*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0225749559082888*G0_1_2 - 0.0197530864197534*G0_2_0 + 0.0225749559082888*G0_2_1 + 0.0225749559082888*G0_2_2;
+    A[726] = 0.0028218694885359*G0_0_1 + 0.00282186948853615*G0_0_2 + 0.00282186948853643*G0_1_0 + 0.0225749559082895*G0_1_1 + 0.0225749559082895*G0_1_2 + 0.00282186948853613*G0_2_0 + 0.0225749559082893*G0_2_1 + 0.0225749559082896*G0_2_2;
+    A[727] = 0.00282186948853641*G0_0_1 + 0.00282186948853644*G0_0_2 + 0.00282186948853616*G0_1_0 + 0.0225749559082895*G0_1_1 + 0.0225749559082893*G0_1_2 + 0.00282186948853627*G0_2_0 + 0.0225749559082895*G0_2_1 + 0.0225749559082893*G0_2_2;
+    A[728] = -0.0169312169312182*G0_0_0 + 0.0253968253968244*G0_0_1 + 0.160846560846559*G0_0_2 + 0.16084656084656*G0_1_0 + 0.118518518518518*G0_1_1 + 0.0677248677248662*G0_1_2 + 0.16084656084656*G0_2_0 + 0.118518518518518*G0_2_1 + 0.0677248677248661*G0_2_2;
+    A[729] = -0.0169312169312152*G0_0_0 - 0.0423280423280404*G0_0_1 - 0.177777777777776*G0_0_2 - 0.177777777777777*G0_1_0 - 0.0846560846560835*G0_1_1 - 0.27089947089947*G0_1_2 - 0.177777777777777*G0_2_0 - 0.0846560846560835*G0_2_1 - 0.27089947089947*G0_2_2;
+    A[730] = 0.00564373897707258*G0_0_0 + 0.00282186948853609*G0_0_1 + 0.00282186948853639*G0_0_2 + 0.00282186948853624*G0_1_0 - 0.0169312169312171*G0_1_1 + 0.067724867724868*G0_1_2 + 0.00282186948853624*G0_2_0 - 0.016931216931217*G0_2_1 + 0.067724867724868*G0_2_2;
+    A[731] = -0.0169312169312183*G0_0_0 + 0.16084656084656*G0_0_1 + 0.0253968253968248*G0_0_2 + 0.16084656084656*G0_1_0 + 0.0677248677248661*G0_1_1 + 0.118518518518518*G0_1_2 + 0.16084656084656*G0_2_0 + 0.0677248677248661*G0_2_1 + 0.118518518518518*G0_2_2;
+    A[732] = -0.0169312169312152*G0_0_0 - 0.177777777777777*G0_0_1 - 0.0423280423280406*G0_0_2 - 0.177777777777777*G0_1_0 - 0.27089947089947*G0_1_1 - 0.0846560846560836*G0_1_2 - 0.177777777777777*G0_2_0 - 0.27089947089947*G0_2_1 - 0.0846560846560836*G0_2_2;
+    A[733] = 0.00564373897707199*G0_0_0 + 0.00282186948853582*G0_0_1 + 0.00282186948853569*G0_0_2 + 0.00282186948853629*G0_1_0 + 0.0677248677248686*G0_1_1 - 0.0169312169312167*G0_1_2 + 0.00282186948853624*G0_2_0 + 0.0677248677248683*G0_2_1 - 0.0169312169312171*G0_2_2;
+    A[734] = -0.045149911816578*G0_0_0 - 0.0225749559082888*G0_0_1 - 0.022574955908289*G0_0_2 - 0.0225749559082884*G0_1_0 - 0.135449735449735*G0_1_1 - 0.135449735449735*G0_1_2 - 0.0225749559082885*G0_2_0 - 0.135449735449735*G0_2_1 - 0.135449735449735*G0_2_2;
+    A[735] = -0.0253968253968255*G0_0_0 - 0.0253968253968255*G0_0_1 - 0.0253968253968255*G0_0_2 - 0.00776014109347441*G0_1_0 - 0.00776014109347433*G0_1_1 - 0.00776014109347435*G0_1_2 - 0.00776014109347441*G0_2_0 - 0.00776014109347433*G0_2_1 - 0.00776014109347435*G0_2_2;
+    A[736] = -0.070546737213404*G0_0_0 - 0.0458553791887126*G0_1_0 - 0.0458553791887127*G0_2_0;
+    A[737] = 0.00776014109347443*G0_1_1 + 0.00776014109347452*G0_2_1;
+    A[738] = 0.00776014109347445*G0_1_2 + 0.0077601410934744*G0_2_2;
+    A[739] = -0.0112874779541448*G0_1_1 - 0.011287477954145*G0_1_2 - 0.0112874779541447*G0_2_1 - 0.0112874779541447*G0_2_2;
+    A[740] = -0.0028218694885362*G0_1_1 - 0.00282186948853601*G0_1_2 - 0.00282186948853622*G0_2_1 - 0.00282186948853613*G0_2_2;
+    A[741] = -0.0112874779541449*G0_1_1 - 0.011287477954145*G0_1_2 - 0.0112874779541449*G0_2_1 - 0.0112874779541449*G0_2_2;
+    A[742] = 0.0225749559082899*G0_0_0 - 0.079012345679012*G0_0_2 - 0.0790123456790123*G0_1_0 - 0.158024691358025*G0_1_2 - 0.0790123456790123*G0_2_0 - 0.158024691358025*G0_2_2;
+    A[743] = -0.0112874779541448*G0_0_0 + 0.031040564373898*G0_0_2 + 0.031040564373898*G0_1_0 + 0.0902998236331574*G0_1_2 + 0.0310405643738979*G0_2_0 + 0.0902998236331574*G0_2_2;
+    A[744] = -0.0112874779541447*G0_0_2 - 0.0112874779541449*G0_1_0 - 0.0451499118165786*G0_1_2 - 0.0112874779541449*G0_2_0 - 0.0451499118165786*G0_2_2;
+    A[745] = 0.0225749559082899*G0_0_0 - 0.0790123456790121*G0_0_1 - 0.0790123456790124*G0_1_0 - 0.158024691358025*G0_1_1 - 0.0790123456790123*G0_2_0 - 0.158024691358025*G0_2_1;
+    A[746] = -0.0112874779541447*G0_0_0 + 0.0310405643738979*G0_0_1 + 0.0310405643738978*G0_1_0 + 0.0902998236331575*G0_1_1 + 0.0310405643738977*G0_2_0 + 0.0902998236331575*G0_2_1;
+    A[747] = -0.0112874779541446*G0_0_1 - 0.011287477954145*G0_1_0 - 0.0451499118165788*G0_1_1 - 0.0112874779541447*G0_2_0 - 0.0451499118165787*G0_2_1;
+    A[748] = -0.0225749559082896*G0_0_0 - 0.0225749559082895*G0_0_1 + 0.011287477954145*G0_0_2 + 0.0112874779541446*G0_1_0 + 0.0112874779541446*G0_1_1 + 0.0112874779541446*G0_2_0 + 0.0112874779541446*G0_2_1;
+    A[749] = -0.0112874779541446*G0_0_0 - 0.0112874779541446*G0_0_1 + 0.00282186948853567*G0_0_2 + 0.00282186948853601*G0_1_0 + 0.00282186948853599*G0_1_1 + 0.00282186948853599*G0_2_0 + 0.00282186948853598*G0_2_1;
+    A[750] = 0.0112874779541448*G0_0_2 + 0.0112874779541449*G0_1_0 + 0.0112874779541449*G0_1_1 + 0.0112874779541449*G0_2_0 + 0.0112874779541449*G0_2_1;
+    A[751] = -0.0225749559082897*G0_0_0 + 0.0112874779541448*G0_0_1 - 0.0225749559082897*G0_0_2 + 0.0112874779541447*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.0112874779541447*G0_2_0 + 0.0112874779541445*G0_2_2;
+    A[752] = -0.0112874779541445*G0_0_0 + 0.00282186948853601*G0_0_1 - 0.0112874779541445*G0_0_2 + 0.00282186948853597*G0_1_0 + 0.00282186948853611*G0_1_2 + 0.002821869488536*G0_2_0 + 0.00282186948853614*G0_2_2;
+    A[753] = 0.0112874779541447*G0_0_1 + 0.0112874779541449*G0_1_0 + 0.0112874779541448*G0_1_2 + 0.0112874779541447*G0_2_0 + 0.0112874779541445*G0_2_2;
+    A[754] = 0.112874779541446*G0_0_0 + 0.0790123456790118*G0_0_1 + 0.0790123456790118*G0_0_2 + 0.0338624338624336*G0_1_0 + 0.0451499118165784*G0_1_1 + 0.0451499118165784*G0_1_2 + 0.0338624338624336*G0_2_0 + 0.0451499118165785*G0_2_1 + 0.0451499118165784*G0_2_2;
+    A[755] = -0.22010582010582*G0_0_0 - 0.132627865961199*G0_0_1 - 0.132627865961199*G0_0_2 - 0.0592592592592587*G0_1_0 - 0.0902998236331569*G0_1_1 - 0.0902998236331569*G0_1_2 - 0.0592592592592588*G0_2_0 - 0.0902998236331569*G0_2_1 - 0.090299823633157*G0_2_2;
+    A[756] = 0.203174603174603*G0_0_0 + 0.0790123456790122*G0_0_1 + 0.0790123456790122*G0_0_2 + 0.0790123456790122*G0_1_0 + 0.158024691358025*G0_1_1 + 0.158024691358026*G0_1_2 + 0.0790123456790122*G0_2_0 + 0.158024691358026*G0_2_1 + 0.158024691358026*G0_2_2;
+    A[757] = -0.0451499118165782*G0_0_0 - 0.0112874779541436*G0_0_1 - 0.0112874779541438*G0_0_2 - 0.0112874779541442*G0_1_0 - 0.112874779541446*G0_1_1 - 0.112874779541446*G0_1_2 - 0.0112874779541443*G0_2_0 - 0.112874779541446*G0_2_1 - 0.112874779541446*G0_2_2;
+    A[758] = -0.0112874779541448*G0_0_1 - 0.0112874779541447*G0_0_2 - 0.0112874779541454*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0225749559082887*G0_1_2 - 0.0112874779541449*G0_2_0 + 0.0225749559082891*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[759] = -0.011287477954145*G0_0_1 - 0.0112874779541449*G0_0_2 - 0.0112874779541451*G0_1_0 + 0.0225749559082891*G0_1_1 + 0.0225749559082889*G0_1_2 - 0.0112874779541452*G0_2_0 + 0.0225749559082889*G0_2_1 + 0.0225749559082888*G0_2_2;
+    A[760] = -0.0451499118165784*G0_0_0 + 0.011287477954145*G0_0_1 + 0.0112874779541453*G0_0_2 + 0.0112874779541447*G0_1_0 + 0.0112874779541446*G0_2_0;
+    A[761] = 0.0112874779541444*G0_0_1 + 0.0112874779541445*G0_0_2 + 0.0112874779541454*G0_1_0 + 0.0112874779541449*G0_2_0;
+    A[762] = 0.0112874779541445*G0_0_1 + 0.0112874779541443*G0_0_2 + 0.011287477954145*G0_1_0 + 0.0112874779541452*G0_2_0;
+    A[763] = 0.0677248677248685*G0_0_0 + 0.0112874779541451*G0_0_1 - 0.0338624338624329*G0_0_2 - 0.0338624338624333*G0_1_0 - 0.0225749559082888*G0_1_1 - 0.0338624338624334*G0_2_0 - 0.0225749559082889*G0_2_1;
+    A[764] = -0.0677248677248689*G0_0_0 + 0.0112874779541434*G0_0_1 + 0.101587301587301*G0_0_2 + 0.101587301587301*G0_1_0 + 0.112874779541446*G0_1_1 + 0.101587301587301*G0_2_0 + 0.112874779541446*G0_2_1;
+    A[765] = 0.0225749559082893*G0_0_0 + 0.011287477954145*G0_0_1 - 0.0338624338624339*G0_0_2 - 0.0338624338624341*G0_1_0 - 0.0225749559082893*G0_1_1 - 0.033862433862434*G0_2_0 - 0.0225749559082891*G0_2_1;
+    A[766] = 0.0677248677248685*G0_0_0 - 0.0338624338624331*G0_0_1 + 0.0112874779541449*G0_0_2 - 0.0338624338624336*G0_1_0 - 0.0225749559082892*G0_1_2 - 0.0338624338624337*G0_2_0 - 0.0225749559082895*G0_2_2;
+    A[767] = -0.0677248677248687*G0_0_0 + 0.101587301587301*G0_0_1 + 0.0112874779541436*G0_0_2 + 0.101587301587301*G0_1_0 + 0.112874779541446*G0_1_2 + 0.101587301587301*G0_2_0 + 0.112874779541446*G0_2_2;
+    A[768] = 0.0225749559082893*G0_0_0 - 0.033862433862434*G0_0_1 + 0.0112874779541447*G0_0_2 - 0.0338624338624338*G0_1_0 - 0.0225749559082885*G0_1_2 - 0.0338624338624337*G0_2_0 - 0.022574955908289*G0_2_2;
     A[769] = 0.0902998236331565*G0_0_0;
-    A[770] = 0.0183421516754845*G0_0_0 + 0.0183421516754847*G0_0_1 + 0.0183421516754848*G0_0_2 + 0.0183421516754845*G0_1_0 + 0.0183421516754845*G0_1_1 + 0.0183421516754846*G0_1_2 + 0.0183421516754847*G0_2_0 + 0.0183421516754847*G0_2_1 + 0.0183421516754847*G0_2_2;
-    A[771] = 0.0493827160493826*G0_0_0 + 0.0070546737213402*G0_1_0 + 0.00705467372134018*G0_2_0;
-    A[772] = 0.00705467372134045*G0_0_1 - 0.018342151675485*G0_1_1 + 0.00705467372134054*G0_2_1;
-    A[773] = 0.00705467372134042*G0_0_2 + 0.00705467372134027*G0_1_2 - 0.018342151675485*G0_2_2;
-    A[774] = -0.0677248677248682*G0_0_1 - 0.0225749559082897*G0_0_2 + 0.0225749559082894*G0_1_1 + 0.0112874779541448*G0_1_2 - 0.0338624338624341*G0_2_1 - 0.0225749559082889*G0_2_2;
-    A[775] = -0.0846560846560847*G0_0_1 - 0.0846560846560841*G0_0_2 - 0.0169312169312171*G0_1_1 - 0.0197530864197531*G0_1_2 - 0.0197530864197533*G0_2_1 - 0.0169312169312172*G0_2_2;
-    A[776] = -0.0225749559082893*G0_0_1 - 0.0677248677248678*G0_0_2 - 0.0225749559082893*G0_1_1 - 0.0338624338624335*G0_1_2 + 0.011287477954145*G0_2_1 + 0.0225749559082899*G0_2_2;
-    A[777] = -0.0677248677248687*G0_0_0 + 0.0112874779541436*G0_0_2 + 0.203174603174602*G0_1_0 + 0.112874779541446*G0_1_2 + 0.101587301587301*G0_2_0 + 0.112874779541446*G0_2_2;
-    A[778] = 0.11851851851852*G0_0_0 + 0.0931216931216943*G0_0_2 + 0.0507936507936515*G0_1_0 + 0.186243386243387*G0_1_2 - 0.042328042328042*G0_2_0 - 0.0846560846560838*G0_2_2;
-    A[779] = -0.0225749559082894*G0_0_0 - 0.0338624338624341*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.067724867724868*G0_1_2 + 0.0112874779541449*G0_2_0 + 0.0677248677248675*G0_2_2;
-    A[780] = -0.067724867724868*G0_0_0 + 0.0112874779541437*G0_0_1 + 0.101587301587302*G0_1_0 + 0.112874779541446*G0_1_1 + 0.203174603174603*G0_2_0 + 0.112874779541446*G0_2_1;
-    A[781] = 0.118518518518518*G0_0_0 + 0.0931216931216937*G0_0_1 - 0.0423280423280426*G0_1_0 - 0.0846560846560841*G0_1_1 + 0.0507936507936507*G0_2_0 + 0.186243386243387*G0_2_1;
-    A[782] = -0.0225749559082899*G0_0_0 - 0.0338624338624348*G0_0_1 + 0.0112874779541449*G0_1_0 + 0.0677248677248677*G0_1_1 - 0.0225749559082894*G0_2_0 - 0.0677248677248681*G0_2_1;
-    A[783] = -0.0225749559082885*G0_0_0 - 0.0225749559082889*G0_0_1 - 0.0112874779541444*G0_0_2 - 0.0225749559082882*G0_1_0 - 0.0225749559082884*G0_1_1 - 0.0112874779541436*G0_1_2 - 0.0112874779541444*G0_2_0 - 0.0112874779541446*G0_2_1;
-    A[784] = 0.0169312169312176*G0_0_0 + 0.0169312169312175*G0_0_1 - 0.00282186948853545*G0_0_2 + 0.0169312169312169*G0_1_0 + 0.016931216931217*G0_1_1 - 0.00282186948853616*G0_1_2 - 0.00282186948853564*G0_2_0 - 0.00282186948853557*G0_2_1;
-    A[785] = 0.0225749559082894*G0_0_0 + 0.0225749559082893*G0_0_1 - 0.0112874779541449*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0225749559082892*G0_1_1 - 0.0112874779541445*G0_1_2 - 0.0112874779541449*G0_2_0 - 0.011287477954145*G0_2_1;
-    A[786] = -0.0225749559082885*G0_0_0 - 0.0112874779541441*G0_0_1 - 0.0225749559082887*G0_0_2 - 0.0112874779541448*G0_1_0 - 0.0112874779541445*G0_1_2 - 0.0225749559082885*G0_2_0 - 0.0112874779541437*G0_2_1 - 0.0225749559082887*G0_2_2;
-    A[787] = 0.0169312169312161*G0_0_0 - 0.00282186948853624*G0_0_1 + 0.0169312169312166*G0_0_2 - 0.00282186948853597*G0_1_0 - 0.002821869488536*G0_1_2 + 0.0169312169312165*G0_2_0 - 0.00282186948853659*G0_2_1 + 0.0169312169312169*G0_2_2;
-    A[788] = 0.0225749559082899*G0_0_0 - 0.0112874779541449*G0_0_1 + 0.0225749559082899*G0_0_2 - 0.0112874779541449*G0_1_0 - 0.0112874779541447*G0_1_2 + 0.0225749559082895*G0_2_0 - 0.0112874779541448*G0_2_1 + 0.0225749559082894*G0_2_2;
-    A[789] = -0.0451499118165776*G0_0_0 - 0.0564373897707226*G0_0_1 - 0.0564373897707225*G0_0_2 - 0.0564373897707218*G0_1_0 - 0.067724867724867*G0_1_1 - 0.067724867724867*G0_1_2 - 0.056437389770722*G0_2_0 - 0.0677248677248672*G0_2_1 - 0.0677248677248671*G0_2_2;
-    A[790] = 0.0225749559082887*G0_0_0 + 0.0423280423280418*G0_0_1 + 0.0423280423280419*G0_0_2 + 0.0423280423280405*G0_1_0 + 0.0846560846560835*G0_1_1 + 0.0846560846560835*G0_1_2 + 0.0423280423280409*G0_2_0 + 0.0846560846560838*G0_2_1 + 0.0846560846560838*G0_2_2;
-    A[791] = -0.0451499118165783*G0_0_0 - 0.0112874779541444*G0_0_1 - 0.0112874779541444*G0_0_2 - 0.0112874779541436*G0_1_0 - 0.112874779541446*G0_1_1 - 0.112874779541446*G0_1_2 - 0.0112874779541438*G0_2_0 - 0.112874779541446*G0_2_1 - 0.112874779541446*G0_2_2;
+    A[770] = 0.0183421516754845*G0_0_0 + 0.0183421516754848*G0_0_1 + 0.0183421516754848*G0_0_2 + 0.0183421516754845*G0_1_0 + 0.0183421516754845*G0_1_1 + 0.0183421516754846*G0_1_2 + 0.0183421516754846*G0_2_0 + 0.0183421516754847*G0_2_1 + 0.0183421516754847*G0_2_2;
+    A[771] = 0.0493827160493826*G0_0_0 + 0.00705467372134017*G0_1_0 + 0.0070546737213402*G0_2_0;
+    A[772] = 0.00705467372134042*G0_0_1 - 0.018342151675485*G0_1_1 + 0.00705467372134047*G0_2_1;
+    A[773] = 0.00705467372134044*G0_0_2 + 0.00705467372134026*G0_1_2 - 0.0183421516754849*G0_2_2;
+    A[774] = -0.0677248677248682*G0_0_1 - 0.0225749559082897*G0_0_2 + 0.0225749559082894*G0_1_1 + 0.0112874779541448*G0_1_2 - 0.0338624338624341*G0_2_1 - 0.022574955908289*G0_2_2;
+    A[775] = -0.0846560846560848*G0_0_1 - 0.0846560846560842*G0_0_2 - 0.0169312169312171*G0_1_1 - 0.0197530864197532*G0_1_2 - 0.0197530864197534*G0_2_1 - 0.0169312169312171*G0_2_2;
+    A[776] = -0.0225749559082892*G0_0_1 - 0.0677248677248678*G0_0_2 - 0.0225749559082893*G0_1_1 - 0.0338624338624334*G0_1_2 + 0.0112874779541451*G0_2_1 + 0.0225749559082898*G0_2_2;
+    A[777] = -0.0677248677248688*G0_0_0 + 0.0112874779541435*G0_0_2 + 0.203174603174602*G0_1_0 + 0.112874779541446*G0_1_2 + 0.101587301587301*G0_2_0 + 0.112874779541446*G0_2_2;
+    A[778] = 0.11851851851852*G0_0_0 + 0.0931216931216945*G0_0_2 + 0.0507936507936516*G0_1_0 + 0.186243386243387*G0_1_2 - 0.0423280423280421*G0_2_0 - 0.0846560846560839*G0_2_2;
+    A[779] = -0.0225749559082894*G0_0_0 - 0.0338624338624342*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.067724867724868*G0_1_2 + 0.011287477954145*G0_2_0 + 0.0677248677248675*G0_2_2;
+    A[780] = -0.0677248677248681*G0_0_0 + 0.0112874779541437*G0_0_1 + 0.101587301587301*G0_1_0 + 0.112874779541446*G0_1_1 + 0.203174603174603*G0_2_0 + 0.112874779541446*G0_2_1;
+    A[781] = 0.118518518518518*G0_0_0 + 0.0931216931216936*G0_0_1 - 0.0423280423280426*G0_1_0 - 0.0846560846560841*G0_1_1 + 0.0507936507936509*G0_2_0 + 0.186243386243387*G0_2_1;
+    A[782] = -0.02257495590829*G0_0_0 - 0.0338624338624348*G0_0_1 + 0.0112874779541449*G0_1_0 + 0.0677248677248677*G0_1_1 - 0.0225749559082895*G0_2_0 - 0.0677248677248681*G0_2_1;
+    A[783] = -0.0225749559082884*G0_0_0 - 0.0225749559082888*G0_0_1 - 0.0112874779541445*G0_0_2 - 0.0225749559082883*G0_1_0 - 0.0225749559082885*G0_1_1 - 0.0112874779541436*G0_1_2 - 0.0112874779541442*G0_2_0 - 0.0112874779541443*G0_2_1;
+    A[784] = 0.0169312169312175*G0_0_0 + 0.0169312169312175*G0_0_1 - 0.00282186948853542*G0_0_2 + 0.0169312169312169*G0_1_0 + 0.016931216931217*G0_1_1 - 0.00282186948853619*G0_1_2 - 0.00282186948853564*G0_2_0 - 0.00282186948853558*G0_2_1;
+    A[785] = 0.0225749559082894*G0_0_0 + 0.0225749559082893*G0_0_1 - 0.011287477954145*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0225749559082892*G0_1_1 - 0.0112874779541445*G0_1_2 - 0.011287477954145*G0_2_0 - 0.0112874779541451*G0_2_1;
+    A[786] = -0.0225749559082884*G0_0_0 - 0.0112874779541441*G0_0_1 - 0.0225749559082887*G0_0_2 - 0.0112874779541447*G0_1_0 - 0.0112874779541445*G0_1_2 - 0.0225749559082883*G0_2_0 - 0.0112874779541436*G0_2_1 - 0.0225749559082884*G0_2_2;
+    A[787] = 0.016931216931216*G0_0_0 - 0.00282186948853618*G0_0_1 + 0.0169312169312165*G0_0_2 - 0.00282186948853599*G0_1_0 - 0.00282186948853595*G0_1_2 + 0.0169312169312164*G0_2_0 - 0.00282186948853669*G0_2_1 + 0.0169312169312169*G0_2_2;
+    A[788] = 0.02257495590829*G0_0_0 - 0.0112874779541449*G0_0_1 + 0.0225749559082899*G0_0_2 - 0.0112874779541449*G0_1_0 - 0.0112874779541448*G0_1_2 + 0.0225749559082896*G0_2_0 - 0.0112874779541447*G0_2_1 + 0.0225749559082895*G0_2_2;
+    A[789] = -0.0451499118165776*G0_0_0 - 0.0564373897707225*G0_0_1 - 0.0564373897707225*G0_0_2 - 0.0564373897707217*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.0677248677248671*G0_1_2 - 0.0564373897707218*G0_2_0 - 0.0677248677248669*G0_2_1 - 0.0677248677248668*G0_2_2;
+    A[790] = 0.0225749559082887*G0_0_0 + 0.0423280423280417*G0_0_1 + 0.0423280423280418*G0_0_2 + 0.0423280423280405*G0_1_0 + 0.0846560846560835*G0_1_1 + 0.0846560846560835*G0_1_2 + 0.0423280423280408*G0_2_0 + 0.0846560846560837*G0_2_1 + 0.0846560846560837*G0_2_2;
+    A[791] = -0.0451499118165782*G0_0_0 - 0.0112874779541442*G0_0_1 - 0.0112874779541442*G0_0_2 - 0.0112874779541436*G0_1_0 - 0.112874779541446*G0_1_1 - 0.112874779541446*G0_1_2 - 0.0112874779541438*G0_2_0 - 0.112874779541446*G0_2_1 - 0.112874779541446*G0_2_2;
     A[792] = 0.6320987654321*G0_0_0 + 0.270899470899472*G0_0_1 + 0.270899470899472*G0_0_2 + 0.270899470899472*G0_1_0 + 0.541798941798943*G0_1_1 + 0.270899470899472*G0_1_2 + 0.270899470899472*G0_2_0 + 0.270899470899472*G0_2_1 + 0.541798941798944*G0_2_2;
-    A[793] = -0.135449735449737*G0_0_0 + 0.225749559082891*G0_0_1 + 0.0677248677248658*G0_0_2 - 0.0451499118165788*G0_1_0 - 0.135449735449736*G0_1_1 - 0.067724867724868*G0_1_2 - 0.0677248677248687*G0_2_0 + 0.0677248677248671*G0_2_1;
-    A[794] = -0.135449735449735*G0_0_0 + 0.0677248677248694*G0_0_1 + 0.225749559082893*G0_0_2 - 0.0677248677248671*G0_1_0 + 0.0677248677248681*G0_1_2 - 0.0451499118165778*G0_2_0 - 0.0677248677248666*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[795] = 0.0902998236331571*G0_0_0 + 0.0451499118165788*G0_0_1 + 0.0451499118165791*G0_0_2 + 0.0451499118165788*G0_1_0 + 0.0225749559082891*G0_1_2 + 0.0451499118165788*G0_2_0 + 0.0225749559082896*G0_2_1;
-    A[796] = 0.135449735449737*G0_0_0 + 0.0451499118165786*G0_0_1 + 0.0677248677248678*G0_0_2 + 0.0451499118165788*G0_1_0 + 0.0225749559082895*G0_1_2 + 0.0677248677248687*G0_2_0 + 0.0225749559082891*G0_2_1;
-    A[797] = 0.135449735449735*G0_0_0 + 0.0677248677248672*G0_0_1 + 0.0451499118165776*G0_0_2 + 0.0677248677248672*G0_1_0 + 0.0225749559082887*G0_1_2 + 0.0451499118165779*G0_2_0 + 0.0225749559082887*G0_2_1;
-    A[798] = 0.0451499118165768*G0_0_0 + 0.0902998236331558*G0_0_1 + 0.0451499118165772*G0_0_2 + 0.090299823633154*G0_1_0 + 0.135449735449733*G0_1_1 + 0.0677248677248651*G0_1_2 + 0.0451499118165778*G0_2_0 + 0.0677248677248673*G0_2_1;
-    A[799] = 0.0451499118165806*G0_0_0 - 0.270899470899471*G0_0_1 - 0.135449735449734*G0_0_2 - 0.270899470899468*G0_1_0 - 0.541798941798942*G0_1_1 - 0.270899470899468*G0_1_2 - 0.135449735449735*G0_2_0 - 0.270899470899472*G0_2_1;
-    A[800] = -0.135449735449737*G0_0_0 - 0.0677248677248691*G0_0_1 + 0.0451499118165782*G0_0_2 - 0.0677248677248682*G0_1_0 + 0.067724867724868*G0_1_2 + 0.0451499118165778*G0_2_0 + 0.067724867724867*G0_2_1;
-    A[801] = 0.045149911816577*G0_0_0 + 0.0451499118165772*G0_0_1 + 0.0902998236331556*G0_0_2 + 0.0451499118165779*G0_1_0 + 0.0677248677248673*G0_1_2 + 0.0902998236331549*G0_2_0 + 0.0677248677248659*G0_2_1 + 0.135449735449734*G0_2_2;
-    A[802] = 0.0451499118165793*G0_0_0 - 0.135449735449735*G0_0_1 - 0.270899470899471*G0_0_2 - 0.135449735449735*G0_1_0 - 0.270899470899471*G0_1_2 - 0.27089947089947*G0_2_0 - 0.27089947089947*G0_2_1 - 0.541798941798943*G0_2_2;
-    A[803] = -0.135449735449734*G0_0_0 + 0.04514991181658*G0_0_1 - 0.0677248677248653*G0_0_2 + 0.0451499118165787*G0_1_0 + 0.067724867724868*G0_1_2 - 0.0677248677248672*G0_2_0 + 0.0677248677248688*G0_2_1;
-    A[804] = -0.722398589065256*G0_0_0 - 0.316049382716047*G0_0_1 - 0.316049382716049*G0_0_2 - 0.31604938271605*G0_1_0 - 0.135449735449735*G0_1_2 - 0.316049382716051*G0_2_0 - 0.135449735449734*G0_2_1;
-    A[805] = 0.018342151675485*G0_0_0 + 0.0183421516754849*G0_0_1 + 0.0183421516754849*G0_0_2 + 0.018342151675485*G0_1_0 + 0.018342151675485*G0_1_1 + 0.018342151675485*G0_1_2 + 0.0183421516754847*G0_2_0 + 0.0183421516754848*G0_2_1 + 0.0183421516754848*G0_2_2;
-    A[806] = -0.0183421516754851*G0_0_0 + 0.00705467372134034*G0_1_0 + 0.00705467372134022*G0_2_0;
-    A[807] = 0.00705467372134021*G0_0_1 + 0.0493827160493826*G0_1_1 + 0.00705467372134027*G0_2_1;
-    A[808] = 0.00705467372134035*G0_0_2 + 0.0070546737213405*G0_1_2 - 0.018342151675485*G0_2_2;
-    A[809] = 0.203174603174603*G0_0_1 + 0.112874779541446*G0_0_2 - 0.067724867724868*G0_1_1 + 0.0112874779541444*G0_1_2 + 0.101587301587302*G0_2_1 + 0.112874779541446*G0_2_2;
-    A[810] = 0.0507936507936514*G0_0_1 + 0.186243386243386*G0_0_2 + 0.118518518518519*G0_1_1 + 0.0931216931216942*G0_1_2 - 0.0423280423280425*G0_2_1 - 0.084656084656084*G0_2_2;
-    A[811] = -0.0225749559082892*G0_0_1 - 0.0677248677248679*G0_0_2 - 0.0225749559082892*G0_1_1 - 0.0338624338624346*G0_1_2 + 0.0112874779541449*G0_2_1 + 0.0677248677248671*G0_2_2;
-    A[812] = 0.0225749559082899*G0_0_0 + 0.011287477954145*G0_0_2 - 0.0677248677248676*G0_1_0 - 0.0225749559082891*G0_1_2 - 0.0338624338624335*G0_2_0 - 0.0225749559082893*G0_2_2;
-    A[813] = -0.0169312169312175*G0_0_0 - 0.0197530864197533*G0_0_2 - 0.0846560846560849*G0_1_0 - 0.0846560846560848*G0_1_2 - 0.0197530864197535*G0_2_0 - 0.0169312169312169*G0_2_2;
-    A[814] = -0.0225749559082893*G0_0_0 - 0.0338624338624342*G0_0_2 - 0.0225749559082894*G0_1_0 - 0.067724867724868*G0_1_2 + 0.0112874779541448*G0_2_0 + 0.0225749559082893*G0_2_2;
-    A[815] = 0.0677248677248685*G0_0_0 + 0.0112874779541453*G0_0_1 - 0.0338624338624335*G0_1_0 - 0.022574955908289*G0_1_1 - 0.0677248677248668*G0_2_0 - 0.0225749559082887*G0_2_1;
-    A[816] = -0.084656084656086*G0_0_0 - 0.0423280423280434*G0_0_1 + 0.0931216931216923*G0_1_0 + 0.118518518518518*G0_1_1 + 0.186243386243384*G0_2_0 + 0.0507936507936494*G0_2_1;
-    A[817] = 0.112874779541447*G0_0_0 + 0.101587301587302*G0_0_1 + 0.0112874779541444*G0_1_0 - 0.0677248677248682*G0_1_1 + 0.112874779541448*G0_2_0 + 0.203174603174604*G0_2_1;
-    A[818] = -0.0225749559082895*G0_0_0 - 0.0225749559082893*G0_0_1 - 0.0112874779541444*G0_0_2 - 0.0225749559082897*G0_1_0 - 0.0225749559082896*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.0112874779541448*G0_2_0 - 0.0112874779541447*G0_2_1;
-    A[819] = 0.0169312169312167*G0_0_0 + 0.016931216931217*G0_0_1 - 0.00282186948853643*G0_0_2 + 0.0169312169312175*G0_1_0 + 0.0169312169312177*G0_1_1 - 0.0028218694885359*G0_1_2 - 0.00282186948853618*G0_2_0 - 0.00282186948853595*G0_2_1;
-    A[820] = 0.0225749559082894*G0_0_0 + 0.0225749559082892*G0_0_1 - 0.0112874779541446*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0225749559082893*G0_1_1 - 0.011287477954145*G0_1_2 - 0.0112874779541448*G0_2_0 - 0.0112874779541449*G0_2_1;
-    A[821] = -0.067724867724868*G0_0_0 - 0.0564373897707228*G0_0_1 - 0.0677248677248675*G0_0_2 - 0.0564373897707229*G0_1_0 - 0.0451499118165783*G0_1_1 - 0.0564373897707228*G0_1_2 - 0.0677248677248673*G0_2_0 - 0.0564373897707226*G0_2_1 - 0.0677248677248671*G0_2_2;
-    A[822] = 0.0846560846560855*G0_0_0 + 0.0423280423280419*G0_0_1 + 0.0846560846560846*G0_0_2 + 0.0423280423280422*G0_1_0 + 0.0225749559082892*G0_1_1 + 0.042328042328042*G0_1_2 + 0.0846560846560847*G0_2_0 + 0.042328042328042*G0_2_1 + 0.0846560846560842*G0_2_2;
-    A[823] = -0.112874779541447*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.112874779541447*G0_0_2 - 0.0112874779541444*G0_1_0 - 0.0451499118165789*G0_1_1 - 0.0112874779541443*G0_1_2 - 0.112874779541448*G0_2_0 - 0.011287477954145*G0_2_1 - 0.112874779541447*G0_2_2;
-    A[824] = -0.0112874779541447*G0_0_1 - 0.0112874779541445*G0_0_2 - 0.0112874779541447*G0_1_0 - 0.0225749559082894*G0_1_1 - 0.0225749559082893*G0_1_2 - 0.0112874779541445*G0_2_0 - 0.0225749559082892*G0_2_1 - 0.0225749559082889*G0_2_2;
-    A[825] = -0.00282186948853645*G0_0_1 - 0.00282186948853619*G0_0_2 - 0.0028218694885357*G0_1_0 + 0.0169312169312169*G0_1_1 + 0.0169312169312171*G0_1_2 - 0.00282186948853567*G0_2_0 + 0.0169312169312169*G0_2_1 + 0.0169312169312173*G0_2_2;
-    A[826] = -0.0112874779541453*G0_0_1 - 0.0112874779541449*G0_0_2 - 0.0112874779541448*G0_1_0 + 0.0225749559082887*G0_1_1 + 0.0225749559082891*G0_1_2 - 0.0112874779541447*G0_2_0 + 0.0225749559082887*G0_2_1 + 0.0225749559082891*G0_2_2;
-    A[827] = -0.135449735449737*G0_0_0 - 0.0451499118165788*G0_0_1 - 0.0677248677248687*G0_0_2 + 0.225749559082891*G0_1_0 - 0.135449735449736*G0_1_1 + 0.0677248677248671*G0_1_2 + 0.0677248677248658*G0_2_0 - 0.067724867724868*G0_2_1;
+    A[793] = -0.135449735449737*G0_0_0 + 0.225749559082891*G0_0_1 + 0.0677248677248657*G0_0_2 - 0.0451499118165789*G0_1_0 - 0.135449735449737*G0_1_1 - 0.067724867724868*G0_1_2 - 0.0677248677248688*G0_2_0 + 0.067724867724867*G0_2_1;
+    A[794] = -0.135449735449735*G0_0_0 + 0.0677248677248694*G0_0_1 + 0.225749559082893*G0_0_2 - 0.0677248677248671*G0_1_0 + 0.0677248677248682*G0_1_2 - 0.0451499118165779*G0_2_0 - 0.0677248677248666*G0_2_1 - 0.135449735449735*G0_2_2;
+    A[795] = 0.090299823633157*G0_0_0 + 0.0451499118165786*G0_0_1 + 0.045149911816579*G0_0_2 + 0.0451499118165788*G0_1_0 + 0.0225749559082892*G0_1_2 + 0.0451499118165787*G0_2_0 + 0.0225749559082894*G0_2_1;
+    A[796] = 0.135449735449737*G0_0_0 + 0.0451499118165788*G0_0_1 + 0.067724867724868*G0_0_2 + 0.0451499118165789*G0_1_0 + 0.0225749559082896*G0_1_2 + 0.0677248677248688*G0_2_0 + 0.0225749559082892*G0_2_1;
+    A[797] = 0.135449735449735*G0_0_0 + 0.0677248677248672*G0_0_1 + 0.0451499118165775*G0_0_2 + 0.0677248677248672*G0_1_0 + 0.0225749559082887*G0_1_2 + 0.0451499118165779*G0_2_0 + 0.0225749559082888*G0_2_1;
+    A[798] = 0.0451499118165768*G0_0_0 + 0.0902998236331558*G0_0_1 + 0.0451499118165771*G0_0_2 + 0.090299823633154*G0_1_0 + 0.135449735449733*G0_1_1 + 0.0677248677248653*G0_1_2 + 0.0451499118165772*G0_2_0 + 0.0677248677248669*G0_2_1;
+    A[799] = 0.0451499118165806*G0_0_0 - 0.270899470899471*G0_0_1 - 0.135449735449734*G0_0_2 - 0.270899470899468*G0_1_0 - 0.541798941798942*G0_1_1 - 0.270899470899468*G0_1_2 - 0.135449735449734*G0_2_0 - 0.270899470899472*G0_2_1;
+    A[800] = -0.135449735449737*G0_0_0 - 0.0677248677248691*G0_0_1 + 0.0451499118165783*G0_0_2 - 0.0677248677248683*G0_1_0 + 0.0677248677248679*G0_1_2 + 0.0451499118165779*G0_2_0 + 0.0677248677248671*G0_2_1;
+    A[801] = 0.0451499118165768*G0_0_0 + 0.045149911816577*G0_0_1 + 0.0902998236331555*G0_0_2 + 0.0451499118165777*G0_1_0 + 0.0677248677248674*G0_1_2 + 0.0902998236331542*G0_2_0 + 0.0677248677248654*G0_2_1 + 0.135449735449734*G0_2_2;
+    A[802] = 0.0451499118165795*G0_0_0 - 0.135449735449735*G0_0_1 - 0.270899470899471*G0_0_2 - 0.135449735449735*G0_1_0 - 0.270899470899471*G0_1_2 - 0.270899470899469*G0_2_0 - 0.270899470899469*G0_2_1 - 0.541798941798943*G0_2_2;
+    A[803] = -0.135449735449734*G0_0_0 + 0.0451499118165801*G0_0_1 - 0.0677248677248653*G0_0_2 + 0.0451499118165787*G0_1_0 + 0.0677248677248679*G0_1_2 - 0.0677248677248672*G0_2_0 + 0.067724867724869*G0_2_1;
+    A[804] = -0.722398589065256*G0_0_0 - 0.316049382716047*G0_0_1 - 0.316049382716049*G0_0_2 - 0.316049382716051*G0_1_0 - 0.135449735449735*G0_1_2 - 0.316049382716051*G0_2_0 - 0.135449735449734*G0_2_1;
+    A[805] = 0.018342151675485*G0_0_0 + 0.0183421516754849*G0_0_1 + 0.0183421516754849*G0_0_2 + 0.018342151675485*G0_1_0 + 0.0183421516754851*G0_1_1 + 0.0183421516754851*G0_1_2 + 0.0183421516754848*G0_2_0 + 0.0183421516754849*G0_2_1 + 0.0183421516754849*G0_2_2;
+    A[806] = -0.0183421516754851*G0_0_0 + 0.00705467372134031*G0_1_0 + 0.00705467372134024*G0_2_0;
+    A[807] = 0.00705467372134014*G0_0_1 + 0.0493827160493826*G0_1_1 + 0.00705467372134023*G0_2_1;
+    A[808] = 0.00705467372134037*G0_0_2 + 0.00705467372134054*G0_1_2 - 0.018342151675485*G0_2_2;
+    A[809] = 0.203174603174603*G0_0_1 + 0.112874779541446*G0_0_2 - 0.0677248677248679*G0_1_1 + 0.0112874779541444*G0_1_2 + 0.101587301587302*G0_2_1 + 0.112874779541446*G0_2_2;
+    A[810] = 0.0507936507936515*G0_0_1 + 0.186243386243386*G0_0_2 + 0.118518518518519*G0_1_1 + 0.0931216931216941*G0_1_2 - 0.0423280423280424*G0_2_1 - 0.0846560846560839*G0_2_2;
+    A[811] = -0.0225749559082891*G0_0_1 - 0.067724867724868*G0_0_2 - 0.022574955908289*G0_1_1 - 0.0338624338624343*G0_1_2 + 0.0112874779541448*G0_2_1 + 0.067724867724867*G0_2_2;
+    A[812] = 0.0225749559082898*G0_0_0 + 0.0112874779541449*G0_0_2 - 0.0677248677248676*G0_1_0 - 0.0225749559082892*G0_1_2 - 0.0338624338624335*G0_2_0 - 0.0225749559082894*G0_2_2;
+    A[813] = -0.0169312169312176*G0_0_0 - 0.0197530864197533*G0_0_2 - 0.0846560846560851*G0_1_0 - 0.0846560846560849*G0_1_2 - 0.0197530864197535*G0_2_0 - 0.0169312169312168*G0_2_2;
+    A[814] = -0.0225749559082893*G0_0_0 - 0.0338624338624342*G0_0_2 - 0.0225749559082892*G0_1_0 - 0.0677248677248679*G0_1_2 + 0.0112874779541447*G0_2_0 + 0.0225749559082891*G0_2_2;
+    A[815] = 0.0677248677248683*G0_0_0 + 0.0112874779541453*G0_0_1 - 0.0338624338624335*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0677248677248669*G0_2_0 - 0.0225749559082886*G0_2_1;
+    A[816] = -0.0846560846560858*G0_0_0 - 0.0423280423280434*G0_0_1 + 0.0931216931216923*G0_1_0 + 0.118518518518518*G0_1_1 + 0.186243386243384*G0_2_0 + 0.0507936507936493*G0_2_1;
+    A[817] = 0.112874779541447*G0_0_0 + 0.101587301587302*G0_0_1 + 0.0112874779541445*G0_1_0 - 0.0677248677248682*G0_1_1 + 0.112874779541448*G0_2_0 + 0.203174603174604*G0_2_1;
+    A[818] = -0.0225749559082896*G0_0_0 - 0.0225749559082894*G0_0_1 - 0.0112874779541444*G0_0_2 - 0.0225749559082897*G0_1_0 - 0.0225749559082896*G0_1_1 - 0.0112874779541451*G0_1_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541446*G0_2_1;
+    A[819] = 0.0169312169312168*G0_0_0 + 0.0169312169312171*G0_0_1 - 0.00282186948853641*G0_0_2 + 0.0169312169312176*G0_1_0 + 0.0169312169312178*G0_1_1 - 0.00282186948853568*G0_1_2 - 0.00282186948853624*G0_2_0 - 0.00282186948853604*G0_2_1;
+    A[820] = 0.0225749559082894*G0_0_0 + 0.0225749559082892*G0_0_1 - 0.0112874779541447*G0_0_2 + 0.0225749559082892*G0_1_0 + 0.0225749559082891*G0_1_1 - 0.0112874779541451*G0_1_2 - 0.0112874779541447*G0_2_0 - 0.0112874779541448*G0_2_1;
+    A[821] = -0.0677248677248681*G0_0_0 - 0.0564373897707228*G0_0_1 - 0.0677248677248675*G0_0_2 - 0.0564373897707229*G0_1_0 - 0.0451499118165785*G0_1_1 - 0.0564373897707228*G0_1_2 - 0.0677248677248673*G0_2_0 - 0.0564373897707227*G0_2_1 - 0.0677248677248671*G0_2_2;
+    A[822] = 0.0846560846560854*G0_0_0 + 0.0423280423280417*G0_0_1 + 0.0846560846560844*G0_0_2 + 0.0423280423280421*G0_1_0 + 0.0225749559082894*G0_1_1 + 0.0423280423280419*G0_1_2 + 0.0846560846560847*G0_2_0 + 0.042328042328042*G0_2_1 + 0.084656084656084*G0_2_2;
+    A[823] = -0.112874779541447*G0_0_0 - 0.0112874779541445*G0_0_1 - 0.112874779541447*G0_0_2 - 0.0112874779541444*G0_1_0 - 0.045149911816579*G0_1_1 - 0.0112874779541443*G0_1_2 - 0.112874779541447*G0_2_0 - 0.011287477954145*G0_2_1 - 0.112874779541447*G0_2_2;
+    A[824] = -0.0112874779541448*G0_0_1 - 0.0112874779541446*G0_0_2 - 0.0112874779541447*G0_1_0 - 0.0225749559082893*G0_1_1 - 0.0225749559082891*G0_1_2 - 0.0112874779541445*G0_2_0 - 0.0225749559082891*G0_2_1 - 0.0225749559082888*G0_2_2;
+    A[825] = -0.0028218694885364*G0_0_1 - 0.0028218694885361*G0_0_2 - 0.0028218694885357*G0_1_0 + 0.0169312169312169*G0_1_1 + 0.0169312169312171*G0_1_2 - 0.00282186948853564*G0_2_0 + 0.0169312169312169*G0_2_1 + 0.0169312169312173*G0_2_2;
+    A[826] = -0.0112874779541454*G0_0_1 - 0.0112874779541449*G0_0_2 - 0.0112874779541448*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0225749559082891*G0_1_2 - 0.0112874779541447*G0_2_0 + 0.0225749559082887*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[827] = -0.135449735449737*G0_0_0 - 0.0451499118165789*G0_0_1 - 0.0677248677248687*G0_0_2 + 0.225749559082891*G0_1_0 - 0.135449735449737*G0_1_1 + 0.0677248677248671*G0_1_2 + 0.0677248677248657*G0_2_0 - 0.067724867724868*G0_2_1;
     A[828] = 0.541798941798944*G0_0_0 + 0.270899470899472*G0_0_1 + 0.270899470899473*G0_0_2 + 0.270899470899472*G0_1_0 + 0.6320987654321*G0_1_1 + 0.270899470899471*G0_1_2 + 0.270899470899473*G0_2_0 + 0.270899470899471*G0_2_1 + 0.541798941798943*G0_2_2;
-    A[829] = -0.0677248677248683*G0_0_1 + 0.0677248677248685*G0_0_2 + 0.0677248677248687*G0_1_0 - 0.135449735449736*G0_1_1 + 0.225749559082894*G0_1_2 - 0.0677248677248675*G0_2_0 - 0.0451499118165786*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[830] = 0.135449735449737*G0_0_0 + 0.0902998236331574*G0_0_1 + 0.0677248677248671*G0_0_2 + 0.0902998236331581*G0_1_0 + 0.0451499118165791*G0_1_1 + 0.0451499118165791*G0_1_2 + 0.0677248677248679*G0_2_0 + 0.0451499118165787*G0_2_1;
-    A[831] = -0.541798941798944*G0_0_0 - 0.270899470899471*G0_0_1 - 0.27089947089947*G0_0_2 - 0.270899470899472*G0_1_0 + 0.0451499118165784*G0_1_1 - 0.135449735449736*G0_1_2 - 0.270899470899473*G0_2_0 - 0.135449735449736*G0_2_1;
-    A[832] = -0.0677248677248684*G0_0_1 + 0.067724867724868*G0_0_2 - 0.0677248677248685*G0_1_0 - 0.135449735449737*G0_1_1 + 0.0451499118165785*G0_1_2 + 0.0677248677248677*G0_2_0 + 0.0451499118165784*G0_2_1;
-    A[833] = 0.0451499118165786*G0_0_1 + 0.0225749559082892*G0_0_2 + 0.0451499118165795*G0_1_0 + 0.0902998236331578*G0_1_1 + 0.0451499118165796*G0_1_2 + 0.0225749559082892*G0_2_0 + 0.0451499118165778*G0_2_1;
-    A[834] = 0.0451499118165785*G0_0_1 + 0.0225749559082899*G0_0_2 + 0.0451499118165778*G0_1_0 + 0.135449735449736*G0_1_1 + 0.0677248677248683*G0_1_2 + 0.0225749559082891*G0_2_0 + 0.0677248677248677*G0_2_1;
-    A[835] = 0.0677248677248682*G0_0_1 + 0.0225749559082892*G0_0_2 + 0.0677248677248675*G0_1_0 + 0.135449735449736*G0_1_1 + 0.0451499118165778*G0_1_2 + 0.0225749559082896*G0_2_0 + 0.0451499118165787*G0_2_1;
-    A[836] = 0.0451499118165789*G0_0_1 + 0.0677248677248677*G0_0_2 + 0.0451499118165776*G0_1_0 + 0.0451499118165781*G0_1_1 + 0.0902998236331559*G0_1_2 + 0.0677248677248664*G0_2_0 + 0.0902998236331562*G0_2_1 + 0.135449735449734*G0_2_2;
-    A[837] = 0.0451499118165798*G0_0_1 + 0.0677248677248677*G0_0_2 + 0.0451499118165786*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0677248677248677*G0_1_2 + 0.0677248677248675*G0_2_0 - 0.0677248677248665*G0_2_1;
-    A[838] = -0.135449735449736*G0_0_1 - 0.270899470899472*G0_0_2 - 0.135449735449735*G0_1_0 + 0.0451499118165799*G0_1_1 - 0.27089947089947*G0_1_2 - 0.270899470899469*G0_2_0 - 0.27089947089947*G0_2_1 - 0.541798941798942*G0_2_2;
-    A[839] = -0.31604938271605*G0_0_1 - 0.135449735449735*G0_0_2 - 0.316049382716049*G0_1_0 - 0.722398589065257*G0_1_1 - 0.316049382716049*G0_1_2 - 0.135449735449734*G0_2_0 - 0.316049382716048*G0_2_1;
-    A[840] = 0.0183421516754851*G0_0_0 + 0.0183421516754851*G0_0_1 + 0.0183421516754851*G0_0_2 + 0.0183421516754849*G0_1_0 + 0.018342151675485*G0_1_1 + 0.018342151675485*G0_1_2 + 0.018342151675485*G0_2_0 + 0.0183421516754851*G0_2_1 + 0.0183421516754851*G0_2_2;
-    A[841] = -0.018342151675485*G0_0_0 + 0.00705467372134044*G0_1_0 + 0.00705467372134048*G0_2_0;
-    A[842] = 0.00705467372134023*G0_0_1 - 0.0183421516754851*G0_1_1 + 0.0070546737213403*G0_2_1;
-    A[843] = 0.00705467372134019*G0_0_2 + 0.00705467372134007*G0_1_2 + 0.0493827160493825*G0_2_2;
-    A[844] = -0.0677248677248673*G0_0_1 - 0.0225749559082884*G0_0_2 + 0.0677248677248677*G0_1_1 + 0.011287477954145*G0_1_2 - 0.0338624338624341*G0_2_1 - 0.0225749559082889*G0_2_2;
-    A[845] = 0.186243386243386*G0_0_1 + 0.0507936507936498*G0_0_2 - 0.0846560846560853*G0_1_1 - 0.0423280423280435*G0_1_2 + 0.0931216931216936*G0_2_1 + 0.118518518518518*G0_2_2;
-    A[846] = 0.112874779541447*G0_0_1 + 0.203174603174603*G0_0_2 + 0.112874779541446*G0_1_1 + 0.101587301587302*G0_1_2 + 0.0112874779541442*G0_2_1 - 0.0677248677248679*G0_2_2;
-    A[847] = 0.0677248677248683*G0_0_0 + 0.0112874779541452*G0_0_2 - 0.0677248677248675*G0_1_0 - 0.0225749559082892*G0_1_2 - 0.033862433862434*G0_2_0 - 0.0225749559082891*G0_2_2;
-    A[848] = -0.0846560846560854*G0_0_0 - 0.0423280423280427*G0_0_2 + 0.186243386243386*G0_1_0 + 0.0507936507936512*G0_1_2 + 0.0931216931216933*G0_2_0 + 0.118518518518519*G0_2_2;
-    A[849] = 0.112874779541447*G0_0_0 + 0.101587301587302*G0_0_2 + 0.112874779541447*G0_1_0 + 0.203174603174604*G0_1_2 + 0.0112874779541442*G0_2_0 - 0.0677248677248677*G0_2_2;
-    A[850] = 0.0225749559082891*G0_0_0 + 0.0112874779541448*G0_0_1 - 0.0338624338624344*G0_1_0 - 0.0225749559082896*G0_1_1 - 0.067724867724868*G0_2_0 - 0.0225749559082895*G0_2_1;
-    A[851] = -0.0169312169312168*G0_0_0 - 0.0197530864197532*G0_0_1 - 0.0197530864197531*G0_1_0 - 0.0169312169312169*G0_1_1 - 0.0846560846560848*G0_2_0 - 0.0846560846560846*G0_2_1;
-    A[852] = -0.0225749559082895*G0_0_0 - 0.033862433862434*G0_0_1 + 0.0112874779541446*G0_1_0 + 0.0225749559082891*G0_1_1 - 0.0225749559082898*G0_2_0 - 0.0677248677248683*G0_2_1;
-    A[853] = -0.0677248677248681*G0_0_0 - 0.0677248677248681*G0_0_1 - 0.0564373897707231*G0_0_2 - 0.0677248677248676*G0_1_0 - 0.0677248677248678*G0_1_1 - 0.0564373897707231*G0_1_2 - 0.056437389770723*G0_2_0 - 0.0564373897707232*G0_2_1 - 0.0451499118165785*G0_2_2;
-    A[854] = 0.0846560846560858*G0_0_0 + 0.0846560846560856*G0_0_1 + 0.0423280423280427*G0_0_2 + 0.0846560846560856*G0_1_0 + 0.0846560846560854*G0_1_1 + 0.042328042328043*G0_1_2 + 0.042328042328043*G0_2_0 + 0.042328042328043*G0_2_1 + 0.0225749559082898*G0_2_2;
-    A[855] = -0.112874779541447*G0_0_0 - 0.112874779541447*G0_0_1 - 0.0112874779541449*G0_0_2 - 0.112874779541446*G0_1_0 - 0.112874779541446*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.0112874779541442*G0_2_0 - 0.0112874779541442*G0_2_1 - 0.0451499118165785*G0_2_2;
-    A[856] = -0.0225749559082891*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0225749559082893*G0_0_2 - 0.0112874779541445*G0_1_0 - 0.0112874779541446*G0_1_2 - 0.0225749559082896*G0_2_0 - 0.0112874779541449*G0_2_1 - 0.0225749559082897*G0_2_2;
-    A[857] = 0.0169312169312168*G0_0_0 - 0.00282186948853612*G0_0_1 + 0.016931216931217*G0_0_2 - 0.00282186948853624*G0_1_0 - 0.00282186948853623*G0_1_2 + 0.0169312169312171*G0_2_0 - 0.00282186948853584*G0_2_1 + 0.0169312169312171*G0_2_2;
-    A[858] = 0.0225749559082895*G0_0_0 - 0.0112874779541447*G0_0_1 + 0.0225749559082895*G0_0_2 - 0.0112874779541446*G0_1_0 - 0.0112874779541445*G0_1_2 + 0.0225749559082897*G0_2_0 - 0.0112874779541448*G0_2_1 + 0.0225749559082898*G0_2_2;
-    A[859] = -0.0112874779541446*G0_0_1 - 0.0112874779541447*G0_0_2 - 0.0112874779541442*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0225749559082889*G0_1_2 - 0.0112874779541444*G0_2_0 - 0.0225749559082891*G0_2_1 - 0.0225749559082893*G0_2_2;
-    A[860] = -0.00282186948853602*G0_0_1 - 0.00282186948853613*G0_0_2 - 0.002821869488536*G0_1_0 + 0.0169312169312172*G0_1_1 + 0.0169312169312171*G0_1_2 - 0.00282186948853604*G0_2_0 + 0.0169312169312169*G0_2_1 + 0.0169312169312168*G0_2_2;
-    A[861] = -0.0112874779541452*G0_0_1 - 0.0112874779541453*G0_0_2 - 0.011287477954145*G0_1_0 + 0.0225749559082891*G0_1_1 + 0.022574955908289*G0_1_2 - 0.0112874779541449*G0_2_0 + 0.0225749559082888*G0_2_1 + 0.0225749559082887*G0_2_2;
-    A[862] = -0.135449735449735*G0_0_0 - 0.0677248677248671*G0_0_1 - 0.0451499118165778*G0_0_2 + 0.0677248677248694*G0_1_0 - 0.0677248677248666*G0_1_2 + 0.225749559082893*G0_2_0 + 0.0677248677248681*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[863] = 0.0677248677248687*G0_0_1 - 0.0677248677248675*G0_0_2 - 0.0677248677248683*G0_1_0 - 0.135449735449736*G0_1_1 - 0.0451499118165786*G0_1_2 + 0.0677248677248685*G0_2_0 + 0.225749559082894*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[864] = 0.541798941798941*G0_0_0 + 0.27089947089947*G0_0_1 + 0.270899470899471*G0_0_2 + 0.27089947089947*G0_1_0 + 0.541798941798942*G0_1_1 + 0.27089947089947*G0_1_2 + 0.270899470899471*G0_2_0 + 0.27089947089947*G0_2_1 + 0.6320987654321*G0_2_2;
-    A[865] = 0.135449735449735*G0_0_0 + 0.0677248677248675*G0_0_1 + 0.090299823633157*G0_0_2 + 0.067724867724867*G0_1_0 + 0.0451499118165784*G0_1_2 + 0.0902998236331574*G0_2_0 + 0.0451499118165789*G0_2_1 + 0.0451499118165793*G0_2_2;
-    A[866] = 0.0677248677248678*G0_0_1 - 0.0677248677248685*G0_0_2 + 0.0677248677248683*G0_1_0 + 0.0451499118165789*G0_1_2 - 0.0677248677248685*G0_2_0 + 0.0451499118165785*G0_2_1 - 0.135449735449737*G0_2_2;
-    A[867] = -0.54179894179894*G0_0_0 - 0.270899470899471*G0_0_1 - 0.27089947089947*G0_0_2 - 0.27089947089947*G0_1_0 - 0.135449735449736*G0_1_2 - 0.270899470899471*G0_2_0 - 0.135449735449736*G0_2_1 + 0.0451499118165786*G0_2_2;
-    A[868] = 0.067724867724868*G0_0_1 + 0.0451499118165789*G0_0_2 + 0.0677248677248661*G0_1_0 + 0.135449735449734*G0_1_1 + 0.0902998236331557*G0_1_2 + 0.0451499118165775*G0_2_0 + 0.0902998236331563*G0_2_1 + 0.0451499118165784*G0_2_2;
-    A[869] = 0.0677248677248672*G0_0_1 + 0.0451499118165791*G0_0_2 + 0.067724867724869*G0_1_0 - 0.0677248677248677*G0_1_2 + 0.0451499118165796*G0_2_0 - 0.0677248677248675*G0_2_1 - 0.135449735449734*G0_2_2;
+    A[829] = -0.0677248677248683*G0_0_1 + 0.0677248677248684*G0_0_2 + 0.0677248677248689*G0_1_0 - 0.135449735449736*G0_1_1 + 0.225749559082893*G0_1_2 - 0.0677248677248675*G0_2_0 - 0.0451499118165788*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[830] = 0.135449735449737*G0_0_0 + 0.0902998236331575*G0_0_1 + 0.0677248677248673*G0_0_2 + 0.0902998236331581*G0_1_0 + 0.0451499118165792*G0_1_1 + 0.0451499118165791*G0_1_2 + 0.0677248677248679*G0_2_0 + 0.0451499118165786*G0_2_1;
+    A[831] = -0.541798941798944*G0_0_0 - 0.270899470899471*G0_0_1 - 0.270899470899471*G0_0_2 - 0.270899470899472*G0_1_0 + 0.0451499118165785*G0_1_1 - 0.135449735449736*G0_1_2 - 0.270899470899473*G0_2_0 - 0.135449735449736*G0_2_1;
+    A[832] = -0.0677248677248687*G0_0_1 + 0.0677248677248679*G0_0_2 - 0.0677248677248687*G0_1_0 - 0.135449735449737*G0_1_1 + 0.0451499118165782*G0_1_2 + 0.0677248677248677*G0_2_0 + 0.0451499118165783*G0_2_1;
+    A[833] = 0.0451499118165787*G0_0_1 + 0.0225749559082893*G0_0_2 + 0.0451499118165795*G0_1_0 + 0.0902998236331578*G0_1_1 + 0.0451499118165795*G0_1_2 + 0.0225749559082893*G0_2_0 + 0.0451499118165779*G0_2_1;
+    A[834] = 0.0451499118165785*G0_0_1 + 0.0225749559082899*G0_0_2 + 0.0451499118165778*G0_1_0 + 0.135449735449736*G0_1_1 + 0.0677248677248684*G0_1_2 + 0.0225749559082891*G0_2_0 + 0.0677248677248677*G0_2_1;
+    A[835] = 0.0677248677248682*G0_0_1 + 0.0225749559082892*G0_0_2 + 0.0677248677248675*G0_1_0 + 0.135449735449736*G0_1_1 + 0.0451499118165776*G0_1_2 + 0.0225749559082897*G0_2_0 + 0.0451499118165789*G0_2_1;
+    A[836] = 0.0451499118165791*G0_0_1 + 0.0677248677248677*G0_0_2 + 0.0451499118165776*G0_1_0 + 0.045149911816578*G0_1_1 + 0.0902998236331559*G0_1_2 + 0.0677248677248665*G0_2_0 + 0.0902998236331562*G0_2_1 + 0.135449735449734*G0_2_2;
+    A[837] = 0.0451499118165798*G0_0_1 + 0.0677248677248677*G0_0_2 + 0.0451499118165786*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0677248677248675*G0_1_2 + 0.0677248677248676*G0_2_0 - 0.0677248677248666*G0_2_1;
+    A[838] = -0.135449735449736*G0_0_1 - 0.270899470899472*G0_0_2 - 0.135449735449734*G0_1_0 + 0.0451499118165799*G0_1_1 - 0.27089947089947*G0_1_2 - 0.270899470899469*G0_2_0 - 0.27089947089947*G0_2_1 - 0.541798941798942*G0_2_2;
+    A[839] = -0.31604938271605*G0_0_1 - 0.135449735449735*G0_0_2 - 0.316049382716048*G0_1_0 - 0.722398589065257*G0_1_1 - 0.316049382716049*G0_1_2 - 0.135449735449734*G0_2_0 - 0.316049382716048*G0_2_1;
+    A[840] = 0.0183421516754851*G0_0_0 + 0.0183421516754851*G0_0_1 + 0.018342151675485*G0_0_2 + 0.0183421516754849*G0_1_0 + 0.018342151675485*G0_1_1 + 0.018342151675485*G0_1_2 + 0.0183421516754851*G0_2_0 + 0.0183421516754851*G0_2_1 + 0.0183421516754851*G0_2_2;
+    A[841] = -0.018342151675485*G0_0_0 + 0.00705467372134048*G0_1_0 + 0.00705467372134043*G0_2_0;
+    A[842] = 0.00705467372134028*G0_0_1 - 0.0183421516754851*G0_1_1 + 0.00705467372134037*G0_2_1;
+    A[843] = 0.00705467372134021*G0_0_2 + 0.00705467372134008*G0_1_2 + 0.0493827160493824*G0_2_2;
+    A[844] = -0.0677248677248674*G0_0_1 - 0.0225749559082884*G0_0_2 + 0.0677248677248676*G0_1_1 + 0.0112874779541449*G0_1_2 - 0.033862433862434*G0_2_1 - 0.0225749559082887*G0_2_2;
+    A[845] = 0.186243386243386*G0_0_1 + 0.0507936507936499*G0_0_2 - 0.0846560846560851*G0_1_1 - 0.0423280423280434*G0_1_2 + 0.0931216931216936*G0_2_1 + 0.118518518518518*G0_2_2;
+    A[846] = 0.112874779541446*G0_0_1 + 0.203174603174603*G0_0_2 + 0.112874779541446*G0_1_1 + 0.101587301587302*G0_1_2 + 0.0112874779541443*G0_2_1 - 0.0677248677248677*G0_2_2;
+    A[847] = 0.0677248677248683*G0_0_0 + 0.0112874779541452*G0_0_2 - 0.0677248677248675*G0_1_0 - 0.0225749559082892*G0_1_2 - 0.033862433862434*G0_2_0 - 0.022574955908289*G0_2_2;
+    A[848] = -0.0846560846560854*G0_0_0 - 0.0423280423280427*G0_0_2 + 0.186243386243386*G0_1_0 + 0.0507936507936513*G0_1_2 + 0.0931216931216934*G0_2_0 + 0.118518518518519*G0_2_2;
+    A[849] = 0.112874779541447*G0_0_0 + 0.101587301587302*G0_0_2 + 0.112874779541447*G0_1_0 + 0.203174603174604*G0_1_2 + 0.0112874779541443*G0_2_0 - 0.0677248677248677*G0_2_2;
+    A[850] = 0.0225749559082891*G0_0_0 + 0.0112874779541449*G0_0_1 - 0.0338624338624342*G0_1_0 - 0.0225749559082895*G0_1_1 - 0.0677248677248678*G0_2_0 - 0.0225749559082894*G0_2_1;
+    A[851] = -0.0169312169312168*G0_0_0 - 0.0197530864197532*G0_0_1 - 0.0197530864197532*G0_1_0 - 0.016931216931217*G0_1_1 - 0.084656084656085*G0_2_0 - 0.0846560846560847*G0_2_1;
+    A[852] = -0.0225749559082895*G0_0_0 - 0.033862433862434*G0_0_1 + 0.0112874779541445*G0_1_0 + 0.0225749559082891*G0_1_1 - 0.0225749559082896*G0_2_0 - 0.0677248677248682*G0_2_1;
+    A[853] = -0.0677248677248683*G0_0_0 - 0.067724867724868*G0_0_1 - 0.0564373897707231*G0_0_2 - 0.0677248677248677*G0_1_0 - 0.0677248677248677*G0_1_1 - 0.0564373897707231*G0_1_2 - 0.0564373897707233*G0_2_0 - 0.0564373897707234*G0_2_1 - 0.0451499118165786*G0_2_2;
+    A[854] = 0.0846560846560859*G0_0_0 + 0.0846560846560856*G0_0_1 + 0.0423280423280427*G0_0_2 + 0.0846560846560857*G0_1_0 + 0.0846560846560854*G0_1_1 + 0.0423280423280429*G0_1_2 + 0.0423280423280432*G0_2_0 + 0.042328042328043*G0_2_1 + 0.0225749559082898*G0_2_2;
+    A[855] = -0.112874779541447*G0_0_0 - 0.112874779541447*G0_0_1 - 0.0112874779541449*G0_0_2 - 0.112874779541446*G0_1_0 - 0.112874779541446*G0_1_1 - 0.0112874779541448*G0_1_2 - 0.0112874779541442*G0_2_0 - 0.0112874779541443*G0_2_1 - 0.0451499118165784*G0_2_2;
+    A[856] = -0.0225749559082892*G0_0_0 - 0.0112874779541446*G0_0_1 - 0.0225749559082893*G0_0_2 - 0.0112874779541445*G0_1_0 - 0.0112874779541446*G0_1_2 - 0.0225749559082898*G0_2_0 - 0.011287477954145*G0_2_1 - 0.0225749559082899*G0_2_2;
+    A[857] = 0.0169312169312169*G0_0_0 - 0.0028218694885361*G0_0_1 + 0.016931216931217*G0_0_2 - 0.00282186948853619*G0_1_0 - 0.00282186948853618*G0_1_2 + 0.0169312169312172*G0_2_0 - 0.00282186948853581*G0_2_1 + 0.0169312169312172*G0_2_2;
+    A[858] = 0.0225749559082895*G0_0_0 - 0.0112874779541448*G0_0_1 + 0.0225749559082895*G0_0_2 - 0.0112874779541445*G0_1_0 - 0.0112874779541445*G0_1_2 + 0.0225749559082895*G0_2_0 - 0.0112874779541449*G0_2_1 + 0.0225749559082896*G0_2_2;
+    A[859] = -0.0112874779541446*G0_0_1 - 0.0112874779541446*G0_0_2 - 0.0112874779541442*G0_1_0 - 0.0225749559082889*G0_1_1 - 0.0225749559082889*G0_1_2 - 0.0112874779541445*G0_2_0 - 0.0225749559082893*G0_2_1 - 0.0225749559082895*G0_2_2;
+    A[860] = -0.00282186948853611*G0_0_1 - 0.00282186948853622*G0_0_2 - 0.00282186948853607*G0_1_0 + 0.0169312169312171*G0_1_1 + 0.016931216931217*G0_1_2 - 0.00282186948853603*G0_2_0 + 0.016931216931217*G0_2_1 + 0.0169312169312168*G0_2_2;
+    A[861] = -0.0112874779541451*G0_0_1 - 0.0112874779541452*G0_0_2 - 0.011287477954145*G0_1_0 + 0.0225749559082891*G0_1_1 + 0.0225749559082889*G0_1_2 - 0.0112874779541449*G0_2_0 + 0.0225749559082889*G0_2_1 + 0.0225749559082888*G0_2_2;
+    A[862] = -0.135449735449735*G0_0_0 - 0.0677248677248671*G0_0_1 - 0.0451499118165779*G0_0_2 + 0.0677248677248694*G0_1_0 - 0.0677248677248666*G0_1_2 + 0.225749559082893*G0_2_0 + 0.0677248677248682*G0_2_1 - 0.135449735449735*G0_2_2;
+    A[863] = 0.0677248677248689*G0_0_1 - 0.0677248677248675*G0_0_2 - 0.0677248677248683*G0_1_0 - 0.135449735449736*G0_1_1 - 0.0451499118165788*G0_1_2 + 0.0677248677248684*G0_2_0 + 0.225749559082893*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[864] = 0.541798941798941*G0_0_0 + 0.27089947089947*G0_0_1 + 0.270899470899471*G0_0_2 + 0.27089947089947*G0_1_0 + 0.541798941798942*G0_1_1 + 0.270899470899471*G0_1_2 + 0.270899470899471*G0_2_0 + 0.270899470899471*G0_2_1 + 0.632098765432099*G0_2_2;
+    A[865] = 0.135449735449735*G0_0_0 + 0.0677248677248675*G0_0_1 + 0.090299823633157*G0_0_2 + 0.067724867724867*G0_1_0 + 0.0451499118165784*G0_1_2 + 0.0902998236331574*G0_2_0 + 0.0451499118165791*G0_2_1 + 0.0451499118165794*G0_2_2;
+    A[866] = 0.0677248677248679*G0_0_1 - 0.0677248677248686*G0_0_2 + 0.0677248677248683*G0_1_0 + 0.0451499118165788*G0_1_2 - 0.0677248677248684*G0_2_0 + 0.0451499118165785*G0_2_1 - 0.135449735449737*G0_2_2;
+    A[867] = -0.541798941798941*G0_0_0 - 0.270899470899471*G0_0_1 - 0.27089947089947*G0_0_2 - 0.27089947089947*G0_1_0 - 0.135449735449736*G0_1_2 - 0.270899470899471*G0_2_0 - 0.135449735449736*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[868] = 0.0677248677248678*G0_0_1 + 0.0451499118165787*G0_0_2 + 0.0677248677248662*G0_1_0 + 0.135449735449734*G0_1_1 + 0.0902998236331556*G0_1_2 + 0.0451499118165779*G0_2_0 + 0.0902998236331565*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[869] = 0.0677248677248672*G0_0_1 + 0.0451499118165793*G0_0_2 + 0.067724867724869*G0_1_0 - 0.0677248677248676*G0_1_2 + 0.0451499118165794*G0_2_0 - 0.0677248677248677*G0_2_1 - 0.135449735449734*G0_2_2;
     A[870] = -0.27089947089947*G0_0_1 - 0.135449735449736*G0_0_2 - 0.270899470899472*G0_1_0 - 0.541798941798942*G0_1_1 - 0.27089947089947*G0_1_2 - 0.135449735449736*G0_2_0 - 0.270899470899471*G0_2_1 + 0.0451499118165779*G0_2_2;
-    A[871] = 0.0225749559082897*G0_0_1 + 0.0451499118165789*G0_0_2 + 0.0225749559082898*G0_1_0 + 0.0451499118165787*G0_1_2 + 0.0451499118165794*G0_2_0 + 0.0451499118165792*G0_2_1 + 0.0902998236331574*G0_2_2;
-    A[872] = 0.0225749559082897*G0_0_1 + 0.0451499118165776*G0_0_2 + 0.022574955908289*G0_1_0 + 0.0677248677248668*G0_1_2 + 0.0451499118165782*G0_2_0 + 0.0677248677248685*G0_2_1 + 0.135449735449735*G0_2_2;
-    A[873] = 0.022574955908289*G0_0_1 + 0.0677248677248677*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0451499118165793*G0_1_2 + 0.0677248677248678*G0_2_0 + 0.0451499118165784*G0_2_1 + 0.135449735449736*G0_2_2;
+    A[871] = 0.0225749559082897*G0_0_1 + 0.045149911816579*G0_0_2 + 0.0225749559082899*G0_1_0 + 0.0451499118165787*G0_1_2 + 0.0451499118165798*G0_2_0 + 0.0451499118165796*G0_2_1 + 0.0902998236331577*G0_2_2;
+    A[872] = 0.0225749559082896*G0_0_1 + 0.0451499118165775*G0_0_2 + 0.0225749559082889*G0_1_0 + 0.0677248677248667*G0_1_2 + 0.0451499118165778*G0_2_0 + 0.0677248677248681*G0_2_1 + 0.135449735449735*G0_2_2;
+    A[873] = 0.0225749559082891*G0_0_1 + 0.0677248677248677*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0451499118165794*G0_1_2 + 0.0677248677248678*G0_2_0 + 0.0451499118165784*G0_2_1 + 0.135449735449736*G0_2_2;
     A[874] = -0.135449735449737*G0_0_1 - 0.31604938271605*G0_0_2 - 0.135449735449736*G0_1_0 - 0.31604938271605*G0_1_2 - 0.31604938271605*G0_2_0 - 0.31604938271605*G0_2_1 - 0.722398589065257*G0_2_2;
-    A[875] = 0.0493827160493822*G0_0_0 + 0.0493827160493823*G0_0_1 + 0.0493827160493823*G0_0_2 + 0.0423280423280418*G0_1_0 + 0.0423280423280419*G0_1_1 + 0.0423280423280419*G0_1_2 + 0.0423280423280419*G0_2_0 + 0.0423280423280419*G0_2_1 + 0.0423280423280419*G0_2_2;
+    A[875] = 0.0493827160493822*G0_0_0 + 0.0493827160493824*G0_0_1 + 0.0493827160493823*G0_0_2 + 0.0423280423280418*G0_1_0 + 0.0423280423280419*G0_1_1 + 0.0423280423280419*G0_1_2 + 0.0423280423280418*G0_2_0 + 0.0423280423280418*G0_2_1 + 0.0423280423280419*G0_2_2;
     A[876] = 0.0183421516754848*G0_0_0;
-    A[877] = -0.00705467372134036*G0_0_1 - 0.0253968253968254*G0_1_1;
-    A[878] = -0.00705467372134045*G0_0_2 - 0.0253968253968253*G0_2_2;
-    A[879] = 0.067724867724868*G0_0_1 + 0.0225749559082894*G0_0_2 + 0.0902998236331571*G0_1_1 + 0.0338624338624339*G0_1_2 + 0.0338624338624334*G0_2_1;
-    A[880] = 0.0846560846560851*G0_0_1 + 0.0846560846560849*G0_0_2 + 0.0677248677248678*G0_1_1 + 0.0649029982363313*G0_1_2 + 0.0649029982363315*G0_2_1 + 0.0677248677248675*G0_2_2;
-    A[881] = 0.0225749559082892*G0_0_1 + 0.0677248677248677*G0_0_2 + 0.0338624338624339*G0_1_2 + 0.0338624338624341*G0_2_1 + 0.0902998236331571*G0_2_2;
-    A[882] = -0.0225749559082888*G0_0_0 - 0.0112874779541443*G0_0_2 - 0.0112874779541445*G0_2_0;
-    A[883] = 0.0169312169312166*G0_0_0 + 0.0197530864197526*G0_0_2 + 0.0197530864197529*G0_2_0 + 0.0225749559082894*G0_2_2;
-    A[884] = 0.0225749559082893*G0_0_0 + 0.033862433862434*G0_0_2 + 0.0338624338624341*G0_2_0 + 0.0451499118165782*G0_2_2;
-    A[885] = -0.0225749559082886*G0_0_0 - 0.0112874779541443*G0_0_1 - 0.0112874779541439*G0_1_0;
-    A[886] = 0.0169312169312155*G0_0_0 + 0.0197530864197521*G0_0_1 + 0.0197530864197522*G0_1_0 + 0.0225749559082885*G0_1_1;
-    A[887] = 0.0225749559082896*G0_0_0 + 0.0338624338624341*G0_0_1 + 0.0338624338624342*G0_1_0 + 0.0451499118165788*G0_1_1;
-    A[888] = -0.0677248677248671*G0_0_0 - 0.0677248677248674*G0_0_1 - 0.0790123456790113*G0_0_2 - 0.270899470899471*G0_1_0 - 0.270899470899471*G0_1_1 - 0.169312169312169*G0_1_2 - 0.169312169312169*G0_2_0 - 0.169312169312169*G0_2_1 - 0.067724867724867*G0_2_2;
-    A[889] = 0.118518518518519*G0_0_0 + 0.118518518518519*G0_0_1 + 0.0253968253968244*G0_0_2 + 0.0677248677248676*G0_1_0 + 0.0677248677248675*G0_1_1 + 0.16084656084656*G0_1_2 + 0.160846560846561*G0_2_0 + 0.160846560846561*G0_2_1 - 0.0169312169312175*G0_2_2;
-    A[890] = -0.0225749559082894*G0_0_0 - 0.0225749559082893*G0_0_1 + 0.0112874779541455*G0_0_2 - 0.0338624338624336*G0_1_2 - 0.0338624338624341*G0_2_0 - 0.0338624338624342*G0_2_1 + 0.0677248677248678*G0_2_2;
-    A[891] = -0.0677248677248675*G0_0_0 - 0.0790123456790119*G0_0_1 - 0.067724867724868*G0_0_2 - 0.169312169312169*G0_1_0 - 0.0677248677248672*G0_1_1 - 0.169312169312169*G0_1_2 - 0.270899470899471*G0_2_0 - 0.169312169312169*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[892] = 0.118518518518518*G0_0_0 + 0.0253968253968253*G0_0_1 + 0.118518518518519*G0_0_2 + 0.160846560846561*G0_1_0 - 0.0169312169312171*G0_1_1 + 0.160846560846561*G0_1_2 + 0.067724867724867*G0_2_0 + 0.16084656084656*G0_2_1 + 0.067724867724867*G0_2_2;
-    A[893] = -0.0225749559082896*G0_0_0 + 0.0112874779541446*G0_0_1 - 0.0225749559082895*G0_0_2 - 0.0338624338624342*G0_1_0 + 0.0677248677248676*G0_1_1 - 0.033862433862434*G0_1_2 - 0.0338624338624336*G0_2_1;
-    A[894] = -0.0451499118165779*G0_0_0 - 0.0338624338624341*G0_0_1 - 0.0338624338624339*G0_0_2 - 0.0338624338624332*G0_1_0 - 0.135449735449736*G0_1_1 - 0.135449735449736*G0_1_2 - 0.0338624338624331*G0_2_0 - 0.135449735449735*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[895] = 0.0225749559082893*G0_0_0 - 0.0197530864197533*G0_0_1 - 0.0197530864197533*G0_0_2 - 0.0197530864197536*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0225749559082888*G0_1_2 - 0.019753086419754*G0_2_0 + 0.0225749559082888*G0_2_1 + 0.0225749559082887*G0_2_2;
-    A[896] = -0.0451499118165783*G0_0_0 + 0.0112874779541446*G0_0_1 + 0.0112874779541444*G0_0_2 + 0.0112874779541452*G0_1_0 + 0.0112874779541454*G0_2_0;
-    A[897] = 0.0902998236331572*G0_0_0 + 0.0451499118165788*G0_0_1 + 0.0451499118165788*G0_0_2 + 0.0451499118165788*G0_1_0 + 0.0225749559082896*G0_1_2 + 0.0451499118165791*G0_2_0 + 0.0225749559082891*G0_2_1;
-    A[898] = 0.135449735449737*G0_0_0 + 0.0902998236331581*G0_0_1 + 0.0677248677248679*G0_0_2 + 0.0902998236331574*G0_1_0 + 0.0451499118165791*G0_1_1 + 0.0451499118165787*G0_1_2 + 0.0677248677248671*G0_2_0 + 0.0451499118165791*G0_2_1;
-    A[899] = 0.135449735449735*G0_0_0 + 0.0677248677248669*G0_0_1 + 0.0902998236331574*G0_0_2 + 0.0677248677248675*G0_1_0 + 0.0451499118165789*G0_1_2 + 0.090299823633157*G0_2_0 + 0.0451499118165784*G0_2_1 + 0.0451499118165792*G0_2_2;
-    A[900] = 0.6320987654321*G0_0_0 + 0.361199294532628*G0_0_1 + 0.361199294532629*G0_0_2 + 0.361199294532628*G0_1_0 + 0.632098765432099*G0_1_1 + 0.361199294532628*G0_1_2 + 0.361199294532629*G0_2_0 + 0.361199294532628*G0_2_1 + 0.632098765432099*G0_2_2;
-    A[901] = -0.135449735449737*G0_0_0 - 0.361199294532628*G0_0_1 - 0.203174603174604*G0_0_2 - 0.0902998236331574*G0_1_0 - 0.451499118165785*G0_1_1 - 0.225749559082893*G0_1_2 - 0.0677248677248671*G0_2_0 - 0.225749559082892*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[902] = -0.135449735449735*G0_0_0 - 0.203174603174604*G0_0_1 - 0.361199294532628*G0_0_2 - 0.0677248677248675*G0_1_0 - 0.135449735449735*G0_1_1 - 0.225749559082891*G0_1_2 - 0.090299823633157*G0_2_0 - 0.225749559082892*G0_2_1 - 0.451499118165784*G0_2_2;
-    A[903] = 0.0451499118165773*G0_0_0 + 0.31604938271605*G0_0_1 + 0.180599647266315*G0_0_2 + 0.31604938271605*G0_1_0 + 0.0451499118165783*G0_1_1 + 0.180599647266315*G0_1_2 + 0.180599647266314*G0_2_0 + 0.180599647266315*G0_2_1 + 0.31604938271605*G0_2_2;
-    A[904] = 0.0451499118165791*G0_0_0 - 0.0451499118165789*G0_0_1 - 0.0451499118165788*G0_1_0 - 0.0225749559082892*G0_1_2 - 0.0225749559082893*G0_2_1 - 0.0451499118165784*G0_2_2;
-    A[905] = -0.135449735449736*G0_0_0 - 0.0677248677248675*G0_0_1 - 0.180599647266315*G0_0_2 - 0.0677248677248676*G0_1_0 - 0.0451499118165786*G0_1_2 - 0.180599647266314*G0_2_0 - 0.0451499118165787*G0_2_1 - 0.225749559082893*G0_2_2;
-    A[906] = 0.0451499118165773*G0_0_0 + 0.180599647266314*G0_0_1 + 0.316049382716049*G0_0_2 + 0.180599647266313*G0_1_0 + 0.316049382716049*G0_1_1 + 0.180599647266313*G0_1_2 + 0.31604938271605*G0_2_0 + 0.180599647266314*G0_2_1 + 0.0451499118165788*G0_2_2;
-    A[907] = 0.0451499118165788*G0_0_0 - 0.0451499118165785*G0_0_2 - 0.0451499118165785*G0_1_1 - 0.0225749559082898*G0_1_2 - 0.0451499118165791*G0_2_0 - 0.0225749559082894*G0_2_1;
-    A[908] = -0.135449735449734*G0_0_0 - 0.180599647266313*G0_0_1 - 0.067724867724867*G0_0_2 - 0.180599647266313*G0_1_0 - 0.225749559082892*G0_1_1 - 0.0451499118165781*G0_1_2 - 0.0677248677248671*G0_2_0 - 0.0451499118165775*G0_2_1;
-    A[909] = -0.722398589065257*G0_0_0 - 0.406349206349209*G0_0_1 - 0.406349206349207*G0_0_2 - 0.406349206349206*G0_1_0 - 0.0902998236331569*G0_1_1 - 0.225749559082893*G0_1_2 - 0.406349206349208*G0_2_0 - 0.225749559082894*G0_2_1 - 0.0902998236331584*G0_2_2;
-    A[910] = -0.018342151675485*G0_0_0 - 0.0183421516754849*G0_0_1 - 0.0183421516754849*G0_0_2 - 0.0253968253968251*G0_1_0 - 0.0253968253968252*G0_1_1 - 0.0253968253968252*G0_1_2 - 0.0253968253968251*G0_2_0 - 0.0253968253968252*G0_2_1 - 0.0253968253968252*G0_2_2;
+    A[877] = -0.00705467372134043*G0_0_1 - 0.0253968253968254*G0_1_1;
+    A[878] = -0.0070546737213404*G0_0_2 - 0.0253968253968253*G0_2_2;
+    A[879] = 0.0677248677248679*G0_0_1 + 0.0225749559082891*G0_0_2 + 0.0902998236331571*G0_1_1 + 0.0338624338624339*G0_1_2 + 0.0338624338624334*G0_2_1;
+    A[880] = 0.0846560846560851*G0_0_1 + 0.084656084656085*G0_0_2 + 0.0677248677248679*G0_1_1 + 0.0649029982363314*G0_1_2 + 0.0649029982363316*G0_2_1 + 0.0677248677248674*G0_2_2;
+    A[881] = 0.0225749559082893*G0_0_1 + 0.0677248677248676*G0_0_2 + 0.0338624338624338*G0_1_2 + 0.0338624338624341*G0_2_1 + 0.0902998236331571*G0_2_2;
+    A[882] = -0.0225749559082888*G0_0_0 - 0.0112874779541444*G0_0_2 - 0.0112874779541446*G0_2_0;
+    A[883] = 0.0169312169312166*G0_0_0 + 0.0197530864197527*G0_0_2 + 0.0197530864197529*G0_2_0 + 0.0225749559082894*G0_2_2;
+    A[884] = 0.0225749559082893*G0_0_0 + 0.033862433862434*G0_0_2 + 0.0338624338624341*G0_2_0 + 0.0451499118165781*G0_2_2;
+    A[885] = -0.0225749559082888*G0_0_0 - 0.0112874779541444*G0_0_1 - 0.011287477954144*G0_1_0;
+    A[886] = 0.0169312169312157*G0_0_0 + 0.0197530864197522*G0_0_1 + 0.0197530864197523*G0_1_0 + 0.0225749559082883*G0_1_1;
+    A[887] = 0.0225749559082893*G0_0_0 + 0.033862433862434*G0_0_1 + 0.0338624338624342*G0_1_0 + 0.0451499118165789*G0_1_1;
+    A[888] = -0.0677248677248671*G0_0_0 - 0.0677248677248673*G0_0_1 - 0.0790123456790113*G0_0_2 - 0.270899470899471*G0_1_0 - 0.270899470899471*G0_1_1 - 0.169312169312169*G0_1_2 - 0.169312169312169*G0_2_0 - 0.169312169312169*G0_2_1 - 0.0677248677248669*G0_2_2;
+    A[889] = 0.118518518518519*G0_0_0 + 0.118518518518519*G0_0_1 + 0.0253968253968244*G0_0_2 + 0.0677248677248676*G0_1_0 + 0.0677248677248673*G0_1_1 + 0.16084656084656*G0_1_2 + 0.160846560846561*G0_2_0 + 0.160846560846561*G0_2_1 - 0.0169312169312176*G0_2_2;
+    A[890] = -0.0225749559082894*G0_0_0 - 0.0225749559082893*G0_0_1 + 0.0112874779541455*G0_0_2 - 0.0338624338624335*G0_1_2 - 0.0338624338624341*G0_2_0 - 0.0338624338624341*G0_2_1 + 0.0677248677248678*G0_2_2;
+    A[891] = -0.0677248677248674*G0_0_0 - 0.0790123456790119*G0_0_1 - 0.0677248677248677*G0_0_2 - 0.169312169312169*G0_1_0 - 0.0677248677248672*G0_1_1 - 0.169312169312169*G0_1_2 - 0.270899470899471*G0_2_0 - 0.169312169312169*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[892] = 0.118518518518518*G0_0_0 + 0.0253968253968252*G0_0_1 + 0.118518518518518*G0_0_2 + 0.160846560846561*G0_1_0 - 0.0169312169312171*G0_1_1 + 0.160846560846561*G0_1_2 + 0.0677248677248672*G0_2_0 + 0.16084656084656*G0_2_1 + 0.0677248677248672*G0_2_2;
+    A[893] = -0.0225749559082893*G0_0_0 + 0.0112874779541447*G0_0_1 - 0.0225749559082892*G0_0_2 - 0.0338624338624342*G0_1_0 + 0.0677248677248675*G0_1_1 - 0.033862433862434*G0_1_2 - 0.0338624338624338*G0_2_1;
+    A[894] = -0.045149911816578*G0_0_0 - 0.033862433862434*G0_0_1 - 0.0338624338624338*G0_0_2 - 0.0338624338624333*G0_1_0 - 0.135449735449736*G0_1_1 - 0.135449735449736*G0_1_2 - 0.033862433862433*G0_2_0 - 0.135449735449736*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[895] = 0.0225749559082894*G0_0_0 - 0.0197530864197534*G0_0_1 - 0.0197530864197534*G0_0_2 - 0.0197530864197533*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0225749559082888*G0_1_2 - 0.0197530864197539*G0_2_0 + 0.0225749559082888*G0_2_1 + 0.0225749559082888*G0_2_2;
+    A[896] = -0.0451499118165784*G0_0_0 + 0.0112874779541447*G0_0_1 + 0.0112874779541446*G0_0_2 + 0.011287477954145*G0_1_0 + 0.0112874779541453*G0_2_0;
+    A[897] = 0.090299823633157*G0_0_0 + 0.0451499118165788*G0_0_1 + 0.0451499118165787*G0_0_2 + 0.0451499118165786*G0_1_0 + 0.0225749559082894*G0_1_2 + 0.045149911816579*G0_2_0 + 0.0225749559082892*G0_2_1;
+    A[898] = 0.135449735449737*G0_0_0 + 0.0902998236331581*G0_0_1 + 0.0677248677248679*G0_0_2 + 0.0902998236331575*G0_1_0 + 0.0451499118165792*G0_1_1 + 0.0451499118165786*G0_1_2 + 0.0677248677248673*G0_2_0 + 0.0451499118165791*G0_2_1;
+    A[899] = 0.135449735449735*G0_0_0 + 0.067724867724867*G0_0_1 + 0.0902998236331574*G0_0_2 + 0.0677248677248675*G0_1_0 + 0.0451499118165791*G0_1_2 + 0.090299823633157*G0_2_0 + 0.0451499118165784*G0_2_1 + 0.0451499118165793*G0_2_2;
+    A[900] = 0.6320987654321*G0_0_0 + 0.361199294532627*G0_0_1 + 0.361199294532629*G0_0_2 + 0.361199294532627*G0_1_0 + 0.632098765432099*G0_1_1 + 0.361199294532628*G0_1_2 + 0.361199294532629*G0_2_0 + 0.361199294532628*G0_2_1 + 0.632098765432099*G0_2_2;
+    A[901] = -0.135449735449737*G0_0_0 - 0.361199294532628*G0_0_1 - 0.203174603174604*G0_0_2 - 0.0902998236331575*G0_1_0 - 0.451499118165785*G0_1_1 - 0.225749559082893*G0_1_2 - 0.0677248677248673*G0_2_0 - 0.225749559082892*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[902] = -0.135449735449735*G0_0_0 - 0.203174603174604*G0_0_1 - 0.361199294532628*G0_0_2 - 0.0677248677248675*G0_1_0 - 0.135449735449735*G0_1_1 - 0.225749559082891*G0_1_2 - 0.090299823633157*G0_2_0 - 0.225749559082893*G0_2_1 - 0.451499118165784*G0_2_2;
+    A[903] = 0.0451499118165772*G0_0_0 + 0.31604938271605*G0_0_1 + 0.180599647266315*G0_0_2 + 0.31604938271605*G0_1_0 + 0.0451499118165782*G0_1_1 + 0.180599647266315*G0_1_2 + 0.180599647266314*G0_2_0 + 0.180599647266315*G0_2_1 + 0.31604938271605*G0_2_2;
+    A[904] = 0.0451499118165791*G0_0_0 - 0.0451499118165789*G0_0_1 - 0.0451499118165787*G0_1_0 - 0.0225749559082891*G0_1_2 - 0.0225749559082894*G0_2_1 - 0.0451499118165784*G0_2_2;
+    A[905] = -0.135449735449736*G0_0_0 - 0.0677248677248674*G0_0_1 - 0.180599647266315*G0_0_2 - 0.0677248677248675*G0_1_0 - 0.0451499118165785*G0_1_2 - 0.180599647266314*G0_2_0 - 0.0451499118165787*G0_2_1 - 0.225749559082893*G0_2_2;
+    A[906] = 0.0451499118165773*G0_0_0 + 0.180599647266314*G0_0_1 + 0.316049382716049*G0_0_2 + 0.180599647266313*G0_1_0 + 0.316049382716049*G0_1_1 + 0.180599647266313*G0_1_2 + 0.31604938271605*G0_2_0 + 0.180599647266314*G0_2_1 + 0.0451499118165789*G0_2_2;
+    A[907] = 0.0451499118165787*G0_0_0 - 0.0451499118165784*G0_0_2 - 0.0451499118165784*G0_1_1 - 0.0225749559082897*G0_1_2 - 0.0451499118165789*G0_2_0 - 0.0225749559082894*G0_2_1;
+    A[908] = -0.135449735449734*G0_0_0 - 0.180599647266313*G0_0_1 - 0.0677248677248669*G0_0_2 - 0.180599647266313*G0_1_0 - 0.225749559082892*G0_1_1 - 0.0451499118165782*G0_1_2 - 0.0677248677248672*G0_2_0 - 0.0451499118165776*G0_2_1;
+    A[909] = -0.722398589065257*G0_0_0 - 0.406349206349209*G0_0_1 - 0.406349206349207*G0_0_2 - 0.406349206349206*G0_1_0 - 0.0902998236331568*G0_1_1 - 0.225749559082893*G0_1_2 - 0.406349206349208*G0_2_0 - 0.225749559082894*G0_2_1 - 0.0902998236331584*G0_2_2;
+    A[910] = -0.018342151675485*G0_0_0 - 0.0183421516754849*G0_0_1 - 0.0183421516754849*G0_0_2 - 0.0253968253968251*G0_1_0 - 0.0253968253968252*G0_1_1 - 0.0253968253968251*G0_1_2 - 0.0253968253968252*G0_2_0 - 0.0253968253968253*G0_2_1 - 0.0253968253968252*G0_2_2;
     A[911] = 0.0183421516754851*G0_0_0;
-    A[912] = -0.00705467372134017*G0_0_1 + 0.0423280423280424*G0_1_1;
-    A[913] = -0.00705467372134037*G0_0_2 - 0.0253968253968254*G0_2_2;
-    A[914] = -0.203174603174603*G0_0_1 - 0.112874779541446*G0_0_2 - 0.270899470899471*G0_1_1 - 0.101587301587302*G0_1_2 - 0.1015873015873*G0_2_1;
-    A[915] = -0.0507936507936514*G0_0_1 - 0.186243386243386*G0_0_2 + 0.0677248677248676*G0_1_1 - 0.0931216931216924*G0_1_2 - 0.0931216931216943*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[916] = 0.0225749559082891*G0_0_1 + 0.0677248677248679*G0_0_2 + 0.0338624338624336*G0_1_2 + 0.0338624338624342*G0_2_1 + 0.135449735449735*G0_2_2;
-    A[917] = -0.0225749559082899*G0_0_0 - 0.011287477954145*G0_0_2 - 0.0112874779541447*G0_2_0;
-    A[918] = 0.0169312169312176*G0_0_0 + 0.0197530864197533*G0_0_2 + 0.019753086419753*G0_2_0 + 0.0225749559082893*G0_2_2;
-    A[919] = 0.0225749559082893*G0_0_0 + 0.0338624338624342*G0_0_2 + 0.0338624338624343*G0_2_0 + 0.0451499118165789*G0_2_2;
-    A[920] = -0.0677248677248685*G0_0_0 - 0.0112874779541453*G0_0_1 - 0.0112874779541456*G0_1_0;
-    A[921] = 0.084656084656086*G0_0_0 + 0.0423280423280435*G0_0_1 + 0.0423280423280437*G0_1_0 + 0.0225749559082904*G0_1_1;
+    A[912] = -0.00705467372134012*G0_0_1 + 0.0423280423280424*G0_1_1;
+    A[913] = -0.00705467372134039*G0_0_2 - 0.0253968253968254*G0_2_2;
+    A[914] = -0.203174603174603*G0_0_1 - 0.112874779541446*G0_0_2 - 0.270899470899471*G0_1_1 - 0.101587301587302*G0_1_2 - 0.101587301587301*G0_2_1;
+    A[915] = -0.0507936507936515*G0_0_1 - 0.186243386243387*G0_0_2 + 0.0677248677248676*G0_1_1 - 0.0931216931216924*G0_1_2 - 0.0931216931216941*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[916] = 0.0225749559082891*G0_0_1 + 0.067724867724868*G0_0_2 + 0.0338624338624337*G0_1_2 + 0.033862433862434*G0_2_1 + 0.135449735449735*G0_2_2;
+    A[917] = -0.0225749559082898*G0_0_0 - 0.0112874779541449*G0_0_2 - 0.0112874779541446*G0_2_0;
+    A[918] = 0.0169312169312176*G0_0_0 + 0.0197530864197533*G0_0_2 + 0.0197530864197531*G0_2_0 + 0.0225749559082894*G0_2_2;
+    A[919] = 0.0225749559082893*G0_0_0 + 0.0338624338624341*G0_0_2 + 0.0338624338624341*G0_2_0 + 0.0451499118165787*G0_2_2;
+    A[920] = -0.0677248677248683*G0_0_0 - 0.0112874779541453*G0_0_1 - 0.0112874779541455*G0_1_0;
+    A[921] = 0.0846560846560858*G0_0_0 + 0.0423280423280434*G0_0_1 + 0.0423280423280437*G0_1_0 + 0.0225749559082905*G0_1_1;
     A[922] = -0.112874779541447*G0_0_0 - 0.101587301587302*G0_0_1 - 0.101587301587303*G0_1_0 - 0.135449735449737*G0_1_1;
-    A[923] = 0.0225749559082895*G0_0_0 + 0.0225749559082893*G0_0_1 + 0.0112874779541444*G0_0_2 + 0.0902998236331572*G0_1_0 + 0.0902998236331573*G0_1_1 + 0.0564373897707227*G0_1_2 + 0.0564373897707232*G0_2_0 + 0.0564373897707232*G0_2_1 + 0.022574955908289*G0_2_2;
-    A[924] = -0.0169312169312167*G0_0_0 - 0.0169312169312171*G0_0_1 + 0.00282186948853643*G0_0_2 + 0.0677248677248679*G0_1_0 + 0.067724867724868*G0_1_1 + 0.00282186948853658*G0_1_2 + 0.00282186948853591*G0_2_0 + 0.00282186948853579*G0_2_1 + 0.00564373897707248*G0_2_2;
-    A[925] = -0.0225749559082893*G0_0_0 - 0.0225749559082892*G0_0_1 + 0.0112874779541447*G0_0_2 - 0.0338624338624342*G0_1_2 - 0.0338624338624343*G0_2_0 - 0.0338624338624342*G0_2_1 + 0.0225749559082892*G0_2_2;
-    A[926] = 0.067724867724868*G0_0_0 + 0.0564373897707227*G0_0_1 + 0.0677248677248675*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0677248677248673*G0_1_1 + 0.101587301587302*G0_1_2 + 0.135449735449735*G0_2_0 + 0.101587301587301*G0_2_1 + 0.135449735449735*G0_2_2;
-    A[927] = -0.0846560846560856*G0_0_0 - 0.0423280423280418*G0_0_1 - 0.0846560846560846*G0_0_2 - 0.177777777777778*G0_1_0 - 0.0169312169312166*G0_1_1 - 0.177777777777778*G0_1_2 - 0.27089947089947*G0_2_0 - 0.177777777777778*G0_2_1 - 0.27089947089947*G0_2_2;
-    A[928] = 0.112874779541447*G0_0_0 + 0.0112874779541446*G0_0_1 + 0.112874779541447*G0_0_2 + 0.101587301587303*G0_1_0 - 0.0677248677248677*G0_1_1 + 0.101587301587302*G0_1_2 + 0.101587301587302*G0_2_1;
-    A[929] = 0.0112874779541447*G0_0_1 + 0.0112874779541445*G0_0_2 + 0.0112874779541444*G0_1_0 + 0.0451499118165789*G0_1_1 + 0.0451499118165788*G0_1_2 + 0.0112874779541442*G0_2_0 + 0.0451499118165784*G0_2_1 + 0.0451499118165785*G0_2_2;
-    A[930] = 0.00282186948853649*G0_0_1 + 0.00282186948853623*G0_0_2 + 0.00282186948853612*G0_1_0 + 0.0225749559082894*G0_1_1 + 0.0225749559082893*G0_1_2 + 0.00282186948853634*G0_2_0 + 0.0225749559082895*G0_2_1 + 0.0225749559082895*G0_2_2;
-    A[931] = 0.0112874779541453*G0_0_1 + 0.0112874779541449*G0_0_2 + 0.0112874779541442*G0_1_0 + 0.0112874779541444*G0_2_0;
-    A[932] = 0.135449735449737*G0_0_0 + 0.0451499118165788*G0_0_1 + 0.0677248677248687*G0_0_2 + 0.0451499118165786*G0_1_0 + 0.0225749559082891*G0_1_2 + 0.0677248677248678*G0_2_0 + 0.0225749559082895*G0_2_1;
-    A[933] = -0.541798941798944*G0_0_0 - 0.270899470899472*G0_0_1 - 0.270899470899473*G0_0_2 - 0.270899470899472*G0_1_0 + 0.0451499118165784*G0_1_1 - 0.135449735449736*G0_1_2 - 0.27089947089947*G0_2_0 - 0.135449735449736*G0_2_1;
-    A[934] = 0.0677248677248683*G0_0_1 - 0.0677248677248684*G0_0_2 + 0.0677248677248678*G0_1_0 + 0.0451499118165785*G0_1_2 - 0.0677248677248685*G0_2_0 + 0.0451499118165789*G0_2_1 - 0.135449735449737*G0_2_2;
-    A[935] = -0.135449735449737*G0_0_0 - 0.0902998236331574*G0_0_1 - 0.0677248677248671*G0_0_2 - 0.361199294532628*G0_1_0 - 0.451499118165785*G0_1_1 - 0.225749559082892*G0_1_2 - 0.203174603174604*G0_2_0 - 0.225749559082893*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[936] = 0.541798941798944*G0_0_0 + 0.270899470899472*G0_0_1 + 0.27089947089947*G0_0_2 + 0.270899470899472*G0_1_0 + 0.632098765432099*G0_1_1 + 0.27089947089947*G0_1_2 + 0.27089947089947*G0_2_0 + 0.27089947089947*G0_2_1 + 0.541798941798942*G0_2_2;
-    A[937] = 0.0677248677248685*G0_0_1 - 0.067724867724868*G0_0_2 - 0.0677248677248679*G0_1_0 - 0.135449735449736*G0_1_1 + 0.0902998236331568*G0_1_2 + 0.0677248677248683*G0_2_0 + 0.0902998236331583*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[938] = -0.0451499118165786*G0_0_1 - 0.0225749559082892*G0_0_2 - 0.0451499118165788*G0_1_0 + 0.045149911816579*G0_1_1 - 0.0225749559082897*G0_2_0 - 0.0451499118165797*G0_2_2;
-    A[939] = -0.0451499118165785*G0_0_1 - 0.0225749559082899*G0_0_2 - 0.0451499118165778*G0_1_0 - 0.0225749559082888*G0_1_2 - 0.0225749559082889*G0_2_0 - 0.0225749559082893*G0_2_1 - 0.045149911816579*G0_2_2;
-    A[940] = -0.0677248677248681*G0_0_1 - 0.0225749559082892*G0_0_2 - 0.0677248677248679*G0_1_0 - 0.0451499118165787*G0_1_2 - 0.0225749559082888*G0_2_0 - 0.0451499118165786*G0_2_1 - 0.0451499118165776*G0_2_2;
-    A[941] = -0.0451499118165789*G0_0_1 - 0.0677248677248677*G0_0_2 - 0.0451499118165781*G0_1_0 - 0.225749559082893*G0_1_1 - 0.180599647266313*G0_1_2 - 0.0677248677248669*G0_2_0 - 0.180599647266314*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[942] = -0.0451499118165799*G0_0_1 - 0.0677248677248678*G0_0_2 - 0.0451499118165777*G0_1_0 - 0.0451499118165787*G0_1_1 - 0.0225749559082887*G0_1_2 - 0.0677248677248675*G0_2_0 - 0.0225749559082894*G0_2_1;
-    A[943] = 0.135449735449736*G0_0_1 + 0.270899470899472*G0_0_2 + 0.135449735449734*G0_1_0 + 0.31604938271605*G0_1_1 + 0.135449735449736*G0_1_2 + 0.27089947089947*G0_2_0 + 0.135449735449734*G0_2_1;
-    A[944] = 0.31604938271605*G0_0_1 + 0.135449735449735*G0_0_2 + 0.316049382716049*G0_1_0 - 0.0902998236331581*G0_1_1 + 0.135449735449735*G0_1_2 + 0.135449735449736*G0_2_0 + 0.135449735449737*G0_2_1 + 0.270899470899472*G0_2_2;
-    A[945] = -0.0183421516754851*G0_0_0 - 0.0183421516754851*G0_0_1 - 0.018342151675485*G0_0_2 - 0.0253968253968251*G0_1_0 - 0.0253968253968251*G0_1_1 - 0.0253968253968252*G0_1_2 - 0.0253968253968252*G0_2_0 - 0.0253968253968252*G0_2_1 - 0.0253968253968252*G0_2_2;
-    A[946] = 0.0183421516754849*G0_0_0;
-    A[947] = -0.00705467372134022*G0_0_1 - 0.0253968253968253*G0_1_1;
-    A[948] = -0.00705467372134019*G0_0_2 + 0.0423280423280422*G0_2_2;
-    A[949] = 0.0677248677248673*G0_0_1 + 0.0225749559082885*G0_0_2 + 0.135449735449735*G0_1_1 + 0.0338624338624338*G0_1_2 + 0.0338624338624332*G0_2_1;
-    A[950] = -0.186243386243386*G0_0_1 - 0.0507936507936498*G0_0_2 - 0.270899470899471*G0_1_1 - 0.0931216931216933*G0_1_2 - 0.0931216931216918*G0_2_1 + 0.0677248677248684*G0_2_2;
-    A[951] = -0.112874779541446*G0_0_1 - 0.203174603174603*G0_0_2 - 0.101587301587301*G0_1_2 - 0.101587301587303*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[952] = -0.0677248677248682*G0_0_0 - 0.0112874779541452*G0_0_2 - 0.0112874779541454*G0_2_0;
-    A[953] = 0.0846560846560854*G0_0_0 + 0.0423280423280427*G0_0_2 + 0.0423280423280432*G0_2_0 + 0.0225749559082896*G0_2_2;
+    A[923] = 0.0225749559082896*G0_0_0 + 0.0225749559082894*G0_0_1 + 0.0112874779541445*G0_0_2 + 0.0902998236331573*G0_1_0 + 0.0902998236331572*G0_1_1 + 0.0564373897707226*G0_1_2 + 0.0564373897707234*G0_2_0 + 0.0564373897707233*G0_2_1 + 0.0225749559082891*G0_2_2;
+    A[924] = -0.0169312169312168*G0_0_0 - 0.0169312169312172*G0_0_1 + 0.0028218694885364*G0_0_2 + 0.0677248677248679*G0_1_0 + 0.0677248677248681*G0_1_1 + 0.00282186948853676*G0_1_2 + 0.00282186948853579*G0_2_0 + 0.00282186948853571*G0_2_1 + 0.00564373897707242*G0_2_2;
+    A[925] = -0.0225749559082893*G0_0_0 - 0.0225749559082892*G0_0_1 + 0.0112874779541447*G0_0_2 - 0.0338624338624344*G0_1_2 - 0.0338624338624341*G0_2_0 - 0.0338624338624341*G0_2_1 + 0.0225749559082893*G0_2_2;
+    A[926] = 0.067724867724868*G0_0_0 + 0.0564373897707227*G0_0_1 + 0.0677248677248674*G0_0_2 + 0.101587301587302*G0_1_0 + 0.0677248677248673*G0_1_1 + 0.101587301587302*G0_1_2 + 0.135449735449735*G0_2_0 + 0.101587301587301*G0_2_1 + 0.135449735449735*G0_2_2;
+    A[927] = -0.0846560846560854*G0_0_0 - 0.0423280423280417*G0_0_1 - 0.0846560846560844*G0_0_2 - 0.177777777777778*G0_1_0 - 0.0169312169312165*G0_1_1 - 0.177777777777778*G0_1_2 - 0.27089947089947*G0_2_0 - 0.177777777777778*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[928] = 0.112874779541447*G0_0_0 + 0.0112874779541445*G0_0_1 + 0.112874779541447*G0_0_2 + 0.101587301587303*G0_1_0 - 0.0677248677248677*G0_1_1 + 0.101587301587302*G0_1_2 + 0.101587301587302*G0_2_1;
+    A[929] = 0.0112874779541448*G0_0_1 + 0.0112874779541445*G0_0_2 + 0.0112874779541445*G0_1_0 + 0.0451499118165789*G0_1_1 + 0.0451499118165788*G0_1_2 + 0.0112874779541444*G0_2_0 + 0.0451499118165785*G0_2_1 + 0.0451499118165786*G0_2_2;
+    A[930] = 0.00282186948853643*G0_0_1 + 0.00282186948853613*G0_0_2 + 0.0028218694885359*G0_1_0 + 0.0225749559082895*G0_1_1 + 0.0225749559082893*G0_1_2 + 0.00282186948853615*G0_2_0 + 0.0225749559082895*G0_2_1 + 0.0225749559082896*G0_2_2;
+    A[931] = 0.0112874779541454*G0_0_1 + 0.0112874779541449*G0_0_2 + 0.0112874779541444*G0_1_0 + 0.0112874779541445*G0_2_0;
+    A[932] = 0.135449735449737*G0_0_0 + 0.0451499118165789*G0_0_1 + 0.0677248677248688*G0_0_2 + 0.0451499118165788*G0_1_0 + 0.0225749559082892*G0_1_2 + 0.067724867724868*G0_2_0 + 0.0225749559082896*G0_2_1;
+    A[933] = -0.541798941798944*G0_0_0 - 0.270899470899472*G0_0_1 - 0.270899470899473*G0_0_2 - 0.270899470899471*G0_1_0 + 0.0451499118165785*G0_1_1 - 0.135449735449736*G0_1_2 - 0.270899470899471*G0_2_0 - 0.135449735449736*G0_2_1;
+    A[934] = 0.0677248677248683*G0_0_1 - 0.0677248677248684*G0_0_2 + 0.067724867724868*G0_1_0 + 0.0451499118165785*G0_1_2 - 0.0677248677248686*G0_2_0 + 0.0451499118165788*G0_2_1 - 0.135449735449737*G0_2_2;
+    A[935] = -0.135449735449737*G0_0_0 - 0.0902998236331575*G0_0_1 - 0.0677248677248673*G0_0_2 - 0.361199294532628*G0_1_0 - 0.451499118165785*G0_1_1 - 0.225749559082892*G0_1_2 - 0.203174603174604*G0_2_0 - 0.225749559082893*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[936] = 0.541798941798944*G0_0_0 + 0.270899470899471*G0_0_1 + 0.270899470899471*G0_0_2 + 0.270899470899472*G0_1_0 + 0.632098765432099*G0_1_1 + 0.27089947089947*G0_1_2 + 0.270899470899471*G0_2_0 + 0.27089947089947*G0_2_1 + 0.541798941798943*G0_2_2;
+    A[937] = 0.0677248677248687*G0_0_1 - 0.0677248677248678*G0_0_2 - 0.067724867724868*G0_1_0 - 0.135449735449736*G0_1_1 + 0.0902998236331567*G0_1_2 + 0.0677248677248684*G0_2_0 + 0.0902998236331583*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[938] = -0.0451499118165787*G0_0_1 - 0.0225749559082893*G0_0_2 - 0.0451499118165788*G0_1_0 + 0.0451499118165791*G0_1_1 - 0.0225749559082899*G0_2_0 - 0.0451499118165798*G0_2_2;
+    A[939] = -0.0451499118165784*G0_0_1 - 0.0225749559082899*G0_0_2 - 0.0451499118165781*G0_1_0 - 0.0225749559082889*G0_1_2 - 0.0225749559082889*G0_2_0 - 0.0225749559082893*G0_2_1 - 0.0451499118165791*G0_2_2;
+    A[940] = -0.0677248677248682*G0_0_1 - 0.0225749559082892*G0_0_2 - 0.0677248677248679*G0_1_0 - 0.0451499118165787*G0_1_2 - 0.0225749559082887*G0_2_0 - 0.0451499118165786*G0_2_1 - 0.0451499118165774*G0_2_2;
+    A[941] = -0.0451499118165791*G0_0_1 - 0.0677248677248677*G0_0_2 - 0.045149911816578*G0_1_0 - 0.225749559082893*G0_1_1 - 0.180599647266313*G0_1_2 - 0.0677248677248672*G0_2_0 - 0.180599647266314*G0_2_1 - 0.135449735449735*G0_2_2;
+    A[942] = -0.0451499118165799*G0_0_1 - 0.0677248677248677*G0_0_2 - 0.045149911816578*G0_1_0 - 0.045149911816579*G0_1_1 - 0.0225749559082888*G0_1_2 - 0.0677248677248675*G0_2_0 - 0.0225749559082894*G0_2_1;
+    A[943] = 0.135449735449736*G0_0_1 + 0.270899470899472*G0_0_2 + 0.135449735449735*G0_1_0 + 0.31604938271605*G0_1_1 + 0.135449735449736*G0_1_2 + 0.27089947089947*G0_2_0 + 0.135449735449734*G0_2_1;
+    A[944] = 0.31604938271605*G0_0_1 + 0.135449735449735*G0_0_2 + 0.316049382716049*G0_1_0 - 0.0902998236331584*G0_1_1 + 0.135449735449735*G0_1_2 + 0.135449735449736*G0_2_0 + 0.135449735449737*G0_2_1 + 0.270899470899472*G0_2_2;
+    A[945] = -0.0183421516754851*G0_0_0 - 0.0183421516754851*G0_0_1 - 0.018342151675485*G0_0_2 - 0.0253968253968252*G0_1_0 - 0.0253968253968252*G0_1_1 - 0.0253968253968252*G0_1_2 - 0.0253968253968252*G0_2_0 - 0.0253968253968252*G0_2_1 - 0.0253968253968251*G0_2_2;
+    A[946] = 0.018342151675485*G0_0_0;
+    A[947] = -0.00705467372134028*G0_0_1 - 0.0253968253968253*G0_1_1;
+    A[948] = -0.00705467372134021*G0_0_2 + 0.0423280423280422*G0_2_2;
+    A[949] = 0.0677248677248675*G0_0_1 + 0.0225749559082884*G0_0_2 + 0.135449735449735*G0_1_1 + 0.0338624338624337*G0_1_2 + 0.0338624338624334*G0_2_1;
+    A[950] = -0.186243386243386*G0_0_1 - 0.0507936507936498*G0_0_2 - 0.270899470899471*G0_1_1 - 0.0931216931216933*G0_1_2 - 0.093121693121692*G0_2_1 + 0.0677248677248685*G0_2_2;
+    A[951] = -0.112874779541446*G0_0_1 - 0.203174603174603*G0_0_2 - 0.101587301587301*G0_1_2 - 0.101587301587302*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[952] = -0.0677248677248682*G0_0_0 - 0.0112874779541452*G0_0_2 - 0.0112874779541453*G0_2_0;
+    A[953] = 0.0846560846560854*G0_0_0 + 0.0423280423280427*G0_0_2 + 0.0423280423280432*G0_2_0 + 0.0225749559082895*G0_2_2;
     A[954] = -0.112874779541447*G0_0_0 - 0.101587301587302*G0_0_2 - 0.101587301587303*G0_2_0 - 0.135449735449736*G0_2_2;
-    A[955] = -0.022574955908289*G0_0_0 - 0.0112874779541448*G0_0_1 - 0.0112874779541446*G0_1_0;
-    A[956] = 0.0169312169312168*G0_0_0 + 0.0197530864197531*G0_0_1 + 0.0197530864197528*G0_1_0 + 0.022574955908289*G0_1_1;
-    A[957] = 0.0225749559082896*G0_0_0 + 0.033862433862434*G0_0_1 + 0.0338624338624344*G0_1_0 + 0.0451499118165789*G0_1_1;
-    A[958] = 0.0677248677248681*G0_0_0 + 0.067724867724868*G0_0_1 + 0.056437389770723*G0_0_2 + 0.135449735449735*G0_1_0 + 0.135449735449735*G0_1_1 + 0.101587301587301*G0_1_2 + 0.101587301587301*G0_2_0 + 0.101587301587301*G0_2_1 + 0.0677248677248672*G0_2_2;
-    A[959] = -0.0846560846560858*G0_0_0 - 0.0846560846560856*G0_0_1 - 0.0423280423280426*G0_0_2 - 0.270899470899471*G0_1_0 - 0.270899470899471*G0_1_1 - 0.177777777777777*G0_1_2 - 0.177777777777778*G0_2_0 - 0.177777777777778*G0_2_1 - 0.0169312169312166*G0_2_2;
-    A[960] = 0.112874779541447*G0_0_0 + 0.112874779541447*G0_0_1 + 0.0112874779541449*G0_0_2 + 0.101587301587301*G0_1_2 + 0.101587301587303*G0_2_0 + 0.101587301587303*G0_2_1 - 0.0677248677248676*G0_2_2;
-    A[961] = 0.0225749559082891*G0_0_0 + 0.0112874779541445*G0_0_1 + 0.0225749559082893*G0_0_2 + 0.0564373897707232*G0_1_0 + 0.0225749559082889*G0_1_1 + 0.0564373897707231*G0_1_2 + 0.0902998236331569*G0_2_0 + 0.0564373897707228*G0_2_1 + 0.0902998236331568*G0_2_2;
-    A[962] = -0.0169312169312168*G0_0_0 + 0.00282186948853614*G0_0_1 - 0.0169312169312169*G0_0_2 + 0.00282186948853628*G0_1_0 + 0.00564373897707244*G0_1_1 + 0.00282186948853622*G0_1_2 + 0.0677248677248682*G0_2_0 + 0.00282186948853656*G0_2_1 + 0.0677248677248681*G0_2_2;
-    A[963] = -0.0225749559082896*G0_0_0 + 0.0112874779541447*G0_0_1 - 0.0225749559082895*G0_0_2 - 0.0338624338624344*G0_1_0 + 0.0225749559082892*G0_1_1 - 0.0338624338624344*G0_1_2 - 0.0338624338624342*G0_2_1;
-    A[964] = 0.0112874779541446*G0_0_1 + 0.0112874779541447*G0_0_2 + 0.0112874779541442*G0_1_0 + 0.0451499118165786*G0_1_1 + 0.0451499118165786*G0_1_2 + 0.0112874779541443*G0_2_0 + 0.0451499118165786*G0_2_1 + 0.0451499118165785*G0_2_2;
-    A[965] = 0.00282186948853606*G0_0_1 + 0.00282186948853617*G0_0_2 + 0.00282186948853645*G0_1_0 + 0.0225749559082896*G0_1_1 + 0.0225749559082896*G0_1_2 + 0.00282186948853636*G0_2_0 + 0.0225749559082894*G0_2_1 + 0.0225749559082893*G0_2_2;
-    A[966] = 0.0112874779541451*G0_0_1 + 0.0112874779541452*G0_0_2 + 0.0112874779541445*G0_1_0 + 0.0112874779541444*G0_2_0;
-    A[967] = 0.135449735449735*G0_0_0 + 0.0677248677248672*G0_0_1 + 0.0451499118165779*G0_0_2 + 0.0677248677248671*G0_1_0 + 0.0225749559082887*G0_1_2 + 0.0451499118165776*G0_2_0 + 0.0225749559082887*G0_2_1;
-    A[968] = -0.0677248677248685*G0_0_1 + 0.0677248677248677*G0_0_2 - 0.0677248677248684*G0_1_0 - 0.135449735449737*G0_1_1 + 0.0451499118165784*G0_1_2 + 0.067724867724868*G0_2_0 + 0.0451499118165785*G0_2_1;
-    A[969] = -0.54179894179894*G0_0_0 - 0.27089947089947*G0_0_1 - 0.270899470899471*G0_0_2 - 0.270899470899471*G0_1_0 - 0.135449735449736*G0_1_2 - 0.27089947089947*G0_2_0 - 0.135449735449736*G0_2_1 + 0.0451499118165786*G0_2_2;
-    A[970] = -0.135449735449735*G0_0_0 - 0.0677248677248675*G0_0_1 - 0.090299823633157*G0_0_2 - 0.203174603174604*G0_1_0 - 0.135449735449735*G0_1_1 - 0.225749559082892*G0_1_2 - 0.361199294532628*G0_2_0 - 0.225749559082891*G0_2_1 - 0.451499118165784*G0_2_2;
-    A[971] = -0.0677248677248679*G0_0_1 + 0.0677248677248683*G0_0_2 + 0.0677248677248685*G0_1_0 - 0.135449735449736*G0_1_1 + 0.0902998236331583*G0_1_2 - 0.067724867724868*G0_2_0 + 0.0902998236331568*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[955] = -0.022574955908289*G0_0_0 - 0.0112874779541448*G0_0_1 - 0.0112874779541447*G0_1_0;
+    A[956] = 0.0169312169312168*G0_0_0 + 0.0197530864197532*G0_0_1 + 0.0197530864197528*G0_1_0 + 0.022574955908289*G0_1_1;
+    A[957] = 0.0225749559082896*G0_0_0 + 0.0338624338624341*G0_0_1 + 0.0338624338624344*G0_1_0 + 0.0451499118165788*G0_1_1;
+    A[958] = 0.0677248677248682*G0_0_0 + 0.067724867724868*G0_0_1 + 0.056437389770723*G0_0_2 + 0.135449735449735*G0_1_0 + 0.135449735449735*G0_1_1 + 0.101587301587301*G0_1_2 + 0.101587301587301*G0_2_0 + 0.101587301587301*G0_2_1 + 0.0677248677248671*G0_2_2;
+    A[959] = -0.0846560846560859*G0_0_0 - 0.0846560846560856*G0_0_1 - 0.0423280423280427*G0_0_2 - 0.270899470899471*G0_1_0 - 0.270899470899471*G0_1_1 - 0.177777777777777*G0_1_2 - 0.177777777777778*G0_2_0 - 0.177777777777778*G0_2_1 - 0.0169312169312164*G0_2_2;
+    A[960] = 0.112874779541447*G0_0_0 + 0.112874779541446*G0_0_1 + 0.0112874779541449*G0_0_2 + 0.101587301587302*G0_1_2 + 0.101587301587303*G0_2_0 + 0.101587301587303*G0_2_1 - 0.0677248677248677*G0_2_2;
+    A[961] = 0.0225749559082892*G0_0_0 + 0.0112874779541445*G0_0_1 + 0.0225749559082893*G0_0_2 + 0.0564373897707233*G0_1_0 + 0.022574955908289*G0_1_1 + 0.0564373897707232*G0_1_2 + 0.090299823633157*G0_2_0 + 0.0564373897707227*G0_2_1 + 0.0902998236331568*G0_2_2;
+    A[962] = -0.0169312169312168*G0_0_0 + 0.00282186948853613*G0_0_1 - 0.0169312169312169*G0_0_2 + 0.00282186948853637*G0_1_0 + 0.0056437389770724*G0_1_1 + 0.00282186948853623*G0_1_2 + 0.0677248677248682*G0_2_0 + 0.00282186948853656*G0_2_1 + 0.0677248677248681*G0_2_2;
+    A[963] = -0.0225749559082896*G0_0_0 + 0.0112874779541448*G0_0_1 - 0.0225749559082896*G0_0_2 - 0.0338624338624344*G0_1_0 + 0.0225749559082893*G0_1_1 - 0.0338624338624344*G0_1_2 - 0.033862433862434*G0_2_1;
+    A[964] = 0.0112874779541445*G0_0_1 + 0.0112874779541446*G0_0_2 + 0.0112874779541443*G0_1_0 + 0.0451499118165787*G0_1_1 + 0.0451499118165787*G0_1_2 + 0.0112874779541442*G0_2_0 + 0.0451499118165785*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[965] = 0.00282186948853616*G0_0_1 + 0.00282186948853627*G0_0_2 + 0.00282186948853642*G0_1_0 + 0.0225749559082895*G0_1_1 + 0.0225749559082895*G0_1_2 + 0.00282186948853644*G0_2_0 + 0.0225749559082893*G0_2_1 + 0.0225749559082893*G0_2_2;
+    A[966] = 0.011287477954145*G0_0_1 + 0.0112874779541452*G0_0_2 + 0.0112874779541445*G0_1_0 + 0.0112874779541443*G0_2_0;
+    A[967] = 0.135449735449735*G0_0_0 + 0.0677248677248672*G0_0_1 + 0.0451499118165779*G0_0_2 + 0.0677248677248672*G0_1_0 + 0.0225749559082888*G0_1_2 + 0.0451499118165775*G0_2_0 + 0.0225749559082887*G0_2_1;
+    A[968] = -0.0677248677248687*G0_0_1 + 0.0677248677248677*G0_0_2 - 0.0677248677248687*G0_1_0 - 0.135449735449737*G0_1_1 + 0.0451499118165783*G0_1_2 + 0.0677248677248679*G0_2_0 + 0.0451499118165782*G0_2_1;
+    A[969] = -0.541798941798941*G0_0_0 - 0.27089947089947*G0_0_1 - 0.270899470899471*G0_0_2 - 0.270899470899471*G0_1_0 - 0.135449735449736*G0_1_2 - 0.27089947089947*G0_2_0 - 0.135449735449736*G0_2_1 + 0.0451499118165784*G0_2_2;
+    A[970] = -0.135449735449735*G0_0_0 - 0.0677248677248675*G0_0_1 - 0.090299823633157*G0_0_2 - 0.203174603174604*G0_1_0 - 0.135449735449735*G0_1_1 - 0.225749559082893*G0_1_2 - 0.361199294532628*G0_2_0 - 0.225749559082891*G0_2_1 - 0.451499118165784*G0_2_2;
+    A[971] = -0.067724867724868*G0_0_1 + 0.0677248677248684*G0_0_2 + 0.0677248677248687*G0_1_0 - 0.135449735449736*G0_1_1 + 0.0902998236331583*G0_1_2 - 0.0677248677248678*G0_2_0 + 0.0902998236331567*G0_2_1 - 0.135449735449736*G0_2_2;
     A[972] = 0.54179894179894*G0_0_0 + 0.270899470899471*G0_0_1 + 0.27089947089947*G0_0_2 + 0.270899470899471*G0_1_0 + 0.541798941798942*G0_1_1 + 0.27089947089947*G0_1_2 + 0.27089947089947*G0_2_0 + 0.27089947089947*G0_2_1 + 0.632098765432098*G0_2_2;
-    A[973] = -0.0677248677248679*G0_0_1 - 0.0451499118165789*G0_0_2 - 0.067724867724867*G0_1_0 - 0.135449735449736*G0_1_1 - 0.180599647266315*G0_1_2 - 0.0451499118165778*G0_2_0 - 0.180599647266314*G0_2_1 - 0.225749559082892*G0_2_2;
-    A[974] = -0.0677248677248673*G0_0_1 - 0.0451499118165791*G0_0_2 - 0.067724867724868*G0_1_0 - 0.0225749559082902*G0_1_2 - 0.0451499118165783*G0_2_0 - 0.0225749559082886*G0_2_1 - 0.0451499118165784*G0_2_2;
+    A[973] = -0.0677248677248678*G0_0_1 - 0.0451499118165787*G0_0_2 - 0.0677248677248672*G0_1_0 - 0.135449735449736*G0_1_1 - 0.180599647266315*G0_1_2 - 0.0451499118165779*G0_2_0 - 0.180599647266314*G0_2_1 - 0.225749559082892*G0_2_2;
+    A[974] = -0.0677248677248673*G0_0_1 - 0.0451499118165793*G0_0_2 - 0.0677248677248678*G0_1_0 - 0.0225749559082901*G0_1_2 - 0.0451499118165783*G0_2_0 - 0.0225749559082886*G0_2_1 - 0.0451499118165783*G0_2_2;
     A[975] = 0.27089947089947*G0_0_1 + 0.135449735449736*G0_0_2 + 0.270899470899471*G0_1_0 + 0.135449735449736*G0_1_2 + 0.135449735449735*G0_2_0 + 0.135449735449736*G0_2_1 + 0.31604938271605*G0_2_2;
-    A[976] = -0.0225749559082896*G0_0_1 - 0.0451499118165788*G0_0_2 - 0.0225749559082892*G0_1_0 - 0.0451499118165786*G0_1_1 - 0.045149911816579*G0_2_0 + 0.0451499118165783*G0_2_2;
-    A[977] = -0.0225749559082897*G0_0_1 - 0.0451499118165777*G0_0_2 - 0.0225749559082894*G0_1_0 - 0.0451499118165788*G0_1_1 - 0.0225749559082888*G0_1_2 - 0.0451499118165779*G0_2_0 - 0.0225749559082892*G0_2_1;
-    A[978] = -0.0225749559082891*G0_0_1 - 0.0677248677248678*G0_0_2 - 0.0225749559082891*G0_1_0 - 0.0451499118165789*G0_1_1 - 0.0451499118165784*G0_1_2 - 0.067724867724868*G0_2_0 - 0.0451499118165785*G0_2_1;
-    A[979] = 0.135449735449737*G0_0_1 + 0.316049382716049*G0_0_2 + 0.135449735449737*G0_1_0 + 0.270899470899474*G0_1_1 + 0.135449735449737*G0_1_2 + 0.31604938271605*G0_2_0 + 0.135449735449736*G0_2_1 - 0.0902998236331565*G0_2_2;
-    A[980] = 0.0423280423280417*G0_0_0 + 0.0423280423280416*G0_0_1 + 0.0423280423280417*G0_0_2 + 0.0493827160493822*G0_1_0 + 0.0493827160493821*G0_1_1 + 0.0493827160493822*G0_1_2 + 0.0423280423280417*G0_2_0 + 0.0423280423280418*G0_2_1 + 0.0423280423280418*G0_2_2;
-    A[981] = -0.0253968253968256*G0_0_0 - 0.00705467372134052*G0_1_0;
+    A[976] = -0.0225749559082897*G0_0_1 - 0.0451499118165789*G0_0_2 - 0.0225749559082895*G0_1_0 - 0.0451499118165788*G0_1_1 - 0.045149911816579*G0_2_0 + 0.0451499118165782*G0_2_2;
+    A[977] = -0.0225749559082896*G0_0_1 - 0.0451499118165776*G0_0_2 - 0.0225749559082892*G0_1_0 - 0.0451499118165787*G0_1_1 - 0.0225749559082887*G0_1_2 - 0.0451499118165779*G0_2_0 - 0.022574955908289*G0_2_1;
+    A[978] = -0.0225749559082891*G0_0_1 - 0.0677248677248678*G0_0_2 - 0.0225749559082892*G0_1_0 - 0.045149911816579*G0_1_1 - 0.0451499118165783*G0_1_2 - 0.0677248677248681*G0_2_0 - 0.0451499118165786*G0_2_1;
+    A[979] = 0.135449735449737*G0_0_1 + 0.316049382716049*G0_0_2 + 0.135449735449737*G0_1_0 + 0.270899470899474*G0_1_1 + 0.135449735449737*G0_1_2 + 0.31604938271605*G0_2_0 + 0.135449735449736*G0_2_1 - 0.0902998236331563*G0_2_2;
+    A[980] = 0.0423280423280416*G0_0_0 + 0.0423280423280415*G0_0_1 + 0.0423280423280417*G0_0_2 + 0.0493827160493821*G0_1_0 + 0.0493827160493821*G0_1_1 + 0.0493827160493822*G0_1_2 + 0.0423280423280417*G0_2_0 + 0.0423280423280418*G0_2_1 + 0.0423280423280418*G0_2_2;
+    A[981] = -0.0253968253968256*G0_0_0 - 0.00705467372134057*G0_1_0;
     A[982] = 0.0183421516754851*G0_1_1;
-    A[983] = -0.00705467372134044*G0_1_2 - 0.0253968253968254*G0_2_2;
-    A[984] = -0.0225749559082895*G0_1_1 - 0.011287477954145*G0_1_2 - 0.011287477954145*G0_2_1;
-    A[985] = 0.0169312169312173*G0_1_1 + 0.0197530864197536*G0_1_2 + 0.0197530864197536*G0_2_1 + 0.0225749559082897*G0_2_2;
-    A[986] = 0.0225749559082895*G0_1_1 + 0.0338624338624338*G0_1_2 + 0.0338624338624342*G0_2_1 + 0.0451499118165787*G0_2_2;
-    A[987] = 0.0902998236331563*G0_0_0 + 0.0338624338624337*G0_0_2 + 0.0677248677248673*G0_1_0 + 0.0225749559082891*G0_1_2 + 0.0338624338624333*G0_2_0;
-    A[988] = 0.0677248677248666*G0_0_0 + 0.06490299823633*G0_0_2 + 0.0846560846560835*G0_1_0 + 0.0846560846560831*G0_1_2 + 0.0649029982363303*G0_2_0 + 0.0677248677248665*G0_2_2;
-    A[989] = 0.0338624338624337*G0_0_2 + 0.0225749559082896*G0_1_0 + 0.0677248677248682*G0_1_2 + 0.0338624338624342*G0_2_0 + 0.0902998236331569*G0_2_2;
-    A[990] = 0.0451499118165785*G0_0_0 + 0.0338624338624341*G0_0_1 + 0.0338624338624336*G0_1_0 + 0.022574955908289*G0_1_1;
-    A[991] = 0.0225749559082892*G0_0_0 + 0.0197530864197529*G0_0_1 + 0.0197530864197527*G0_1_0 + 0.0169312169312168*G0_1_1;
-    A[992] = -0.011287477954145*G0_0_1 - 0.0112874779541451*G0_1_0 - 0.0225749559082901*G0_1_1;
-    A[993] = -0.270899470899471*G0_0_0 - 0.270899470899471*G0_0_1 - 0.169312169312169*G0_0_2 - 0.0677248677248669*G0_1_0 - 0.0677248677248672*G0_1_1 - 0.0790123456790114*G0_1_2 - 0.169312169312169*G0_2_0 - 0.169312169312169*G0_2_1 - 0.067724867724867*G0_2_2;
-    A[994] = 0.067724867724867*G0_0_0 + 0.067724867724867*G0_0_1 + 0.16084656084656*G0_0_2 + 0.118518518518519*G0_1_0 + 0.118518518518519*G0_1_1 + 0.0253968253968246*G0_1_2 + 0.160846560846561*G0_2_0 + 0.160846560846561*G0_2_1 - 0.0169312169312172*G0_2_2;
-    A[995] = -0.0338624338624333*G0_0_2 - 0.0225749559082895*G0_1_0 - 0.0225749559082895*G0_1_1 + 0.0112874779541456*G0_1_2 - 0.0338624338624342*G0_2_0 - 0.0338624338624343*G0_2_1 + 0.0677248677248678*G0_2_2;
-    A[996] = -0.135449735449735*G0_0_0 - 0.0338624338624332*G0_0_1 - 0.135449735449736*G0_0_2 - 0.0338624338624338*G0_1_0 - 0.045149911816578*G0_1_1 - 0.033862433862434*G0_1_2 - 0.135449735449736*G0_2_0 - 0.0338624338624334*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[997] = 0.0225749559082892*G0_0_0 - 0.0197530864197534*G0_0_1 + 0.0225749559082892*G0_0_2 - 0.0197530864197533*G0_1_0 + 0.022574955908289*G0_1_1 - 0.0197530864197532*G0_1_2 + 0.0225749559082892*G0_2_0 - 0.0197530864197534*G0_2_1 + 0.0225749559082892*G0_2_2;
-    A[998] = 0.0112874779541447*G0_0_1 + 0.0112874779541452*G0_1_0 - 0.0451499118165783*G0_1_1 + 0.011287477954145*G0_1_2 + 0.011287477954145*G0_2_1;
-    A[999] = -0.0677248677248665*G0_0_0 - 0.169312169312169*G0_0_1 - 0.169312169312169*G0_0_2 - 0.0790123456790113*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.0677248677248669*G0_1_2 - 0.169312169312168*G0_2_0 - 0.270899470899471*G0_2_1 - 0.270899470899471*G0_2_2;
-    A[1000] = -0.0169312169312181*G0_0_0 + 0.16084656084656*G0_0_1 + 0.16084656084656*G0_0_2 + 0.0253968253968246*G0_1_0 + 0.118518518518518*G0_1_1 + 0.118518518518518*G0_1_2 + 0.16084656084656*G0_2_0 + 0.0677248677248662*G0_2_1 + 0.0677248677248662*G0_2_2;
-    A[1001] = 0.0677248677248684*G0_0_0 - 0.0338624338624336*G0_0_1 - 0.0338624338624336*G0_0_2 + 0.0112874779541449*G0_1_0 - 0.022574955908289*G0_1_1 - 0.0225749559082891*G0_1_2 - 0.0338624338624331*G0_2_0;
-    A[1002] = 0.0451499118165768*G0_0_0 + 0.090299823633154*G0_0_1 + 0.0451499118165777*G0_0_2 + 0.0902998236331558*G0_1_0 + 0.135449735449733*G0_1_1 + 0.0677248677248673*G0_1_2 + 0.0451499118165772*G0_2_0 + 0.0677248677248651*G0_2_1;
-    A[1003] = 0.0451499118165795*G0_0_1 + 0.0225749559082892*G0_0_2 + 0.0451499118165786*G0_1_0 + 0.0902998236331579*G0_1_1 + 0.0451499118165778*G0_1_2 + 0.0225749559082892*G0_2_0 + 0.0451499118165796*G0_2_1;
-    A[1004] = 0.0677248677248661*G0_0_1 + 0.0451499118165775*G0_0_2 + 0.067724867724868*G0_1_0 + 0.135449735449734*G0_1_1 + 0.0902998236331563*G0_1_2 + 0.0451499118165789*G0_2_0 + 0.0902998236331557*G0_2_1 + 0.0451499118165784*G0_2_2;
-    A[1005] = 0.0451499118165773*G0_0_0 + 0.31604938271605*G0_0_1 + 0.180599647266314*G0_0_2 + 0.31604938271605*G0_1_0 + 0.0451499118165783*G0_1_1 + 0.180599647266315*G0_1_2 + 0.180599647266315*G0_2_0 + 0.180599647266315*G0_2_1 + 0.31604938271605*G0_2_2;
-    A[1006] = -0.0451499118165788*G0_0_1 - 0.0225749559082897*G0_0_2 - 0.0451499118165786*G0_1_0 + 0.045149911816579*G0_1_1 - 0.0225749559082892*G0_2_0 - 0.0451499118165797*G0_2_2;
-    A[1007] = -0.067724867724867*G0_0_1 - 0.0451499118165779*G0_0_2 - 0.0677248677248679*G0_1_0 - 0.135449735449736*G0_1_1 - 0.180599647266314*G0_1_2 - 0.0451499118165789*G0_2_0 - 0.180599647266315*G0_2_1 - 0.225749559082892*G0_2_2;
-    A[1008] = 0.632098765432098*G0_0_0 + 0.361199294532626*G0_0_1 + 0.361199294532627*G0_0_2 + 0.361199294532626*G0_1_0 + 0.632098765432099*G0_1_1 + 0.361199294532627*G0_1_2 + 0.361199294532627*G0_2_0 + 0.361199294532627*G0_2_1 + 0.632098765432099*G0_2_2;
-    A[1009] = -0.451499118165783*G0_0_0 - 0.0902998236331547*G0_0_1 - 0.22574955908289*G0_0_2 - 0.361199294532626*G0_1_0 - 0.135449735449734*G0_1_1 - 0.203174603174601*G0_1_2 - 0.225749559082891*G0_2_0 - 0.0677248677248655*G0_2_1 - 0.135449735449733*G0_2_2;
-    A[1010] = -0.135449735449734*G0_0_0 - 0.0677248677248664*G0_0_1 - 0.225749559082891*G0_0_2 - 0.203174603174603*G0_1_0 - 0.135449735449735*G0_1_1 - 0.361199294532629*G0_1_2 - 0.225749559082892*G0_2_0 - 0.0902998236331559*G0_2_1 - 0.451499118165786*G0_2_2;
-    A[1011] = 0.316049382716049*G0_0_0 + 0.180599647266313*G0_0_1 + 0.180599647266313*G0_0_2 + 0.180599647266313*G0_1_0 + 0.0451499118165775*G0_1_1 + 0.316049382716049*G0_1_2 + 0.180599647266314*G0_2_0 + 0.31604938271605*G0_2_1 + 0.0451499118165776*G0_2_2;
-    A[1012] = -0.225749559082892*G0_0_0 - 0.180599647266314*G0_0_1 - 0.0451499118165778*G0_0_2 - 0.180599647266313*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0677248677248669*G0_1_2 - 0.0451499118165776*G0_2_0 - 0.0677248677248664*G0_2_1;
-    A[1013] = -0.0451499118165783*G0_0_0 - 0.0225749559082888*G0_0_2 + 0.0451499118165798*G0_1_1 - 0.0451499118165771*G0_1_2 - 0.0225749559082891*G0_2_0 - 0.0451499118165782*G0_2_1;
-    A[1014] = -0.0902998236331542*G0_0_0 - 0.406349206349204*G0_0_1 - 0.225749559082891*G0_0_2 - 0.406349206349206*G0_1_0 - 0.722398589065256*G0_1_1 - 0.406349206349206*G0_1_2 - 0.225749559082892*G0_2_0 - 0.406349206349206*G0_2_1 - 0.0902998236331568*G0_2_2;
-    A[1015] = -0.025396825396825*G0_0_0 - 0.0253968253968249*G0_0_1 - 0.0253968253968249*G0_0_2 - 0.0183421516754846*G0_1_0 - 0.0183421516754845*G0_1_1 - 0.0183421516754846*G0_1_2 - 0.0253968253968249*G0_2_0 - 0.0253968253968248*G0_2_1 - 0.025396825396825*G0_2_2;
-    A[1016] = 0.0423280423280425*G0_0_0 - 0.0070546737213401*G0_1_0;
-    A[1017] = 0.0183421516754848*G0_1_1;
+    A[983] = -0.00705467372134049*G0_1_2 - 0.0253968253968254*G0_2_2;
+    A[984] = -0.0225749559082897*G0_1_1 - 0.0112874779541451*G0_1_2 - 0.0112874779541451*G0_2_1;
+    A[985] = 0.0169312169312176*G0_1_1 + 0.0197530864197537*G0_1_2 + 0.0197530864197538*G0_2_1 + 0.0225749559082898*G0_2_2;
+    A[986] = 0.0225749559082892*G0_1_1 + 0.0338624338624337*G0_1_2 + 0.0338624338624339*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[987] = 0.0902998236331562*G0_0_0 + 0.0338624338624334*G0_0_2 + 0.0677248677248672*G0_1_0 + 0.0225749559082889*G0_1_2 + 0.0338624338624333*G0_2_0;
+    A[988] = 0.0677248677248668*G0_0_0 + 0.0649029982363304*G0_0_2 + 0.0846560846560838*G0_1_0 + 0.0846560846560834*G0_1_2 + 0.0649029982363305*G0_2_0 + 0.067724867724867*G0_2_2;
+    A[989] = 0.0338624338624336*G0_0_2 + 0.0225749559082893*G0_1_0 + 0.067724867724868*G0_1_2 + 0.033862433862434*G0_2_0 + 0.0902998236331565*G0_2_2;
+    A[990] = 0.0451499118165782*G0_0_0 + 0.0338624338624338*G0_0_1 + 0.0338624338624334*G0_1_0 + 0.0225749559082887*G0_1_1;
+    A[991] = 0.0225749559082891*G0_0_0 + 0.0197530864197528*G0_0_1 + 0.0197530864197527*G0_1_0 + 0.0169312169312167*G0_1_1;
+    A[992] = -0.011287477954145*G0_0_1 - 0.0112874779541452*G0_1_0 - 0.0225749559082901*G0_1_1;
+    A[993] = -0.270899470899471*G0_0_0 - 0.270899470899471*G0_0_1 - 0.169312169312168*G0_0_2 - 0.0677248677248669*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.0790123456790113*G0_1_2 - 0.169312169312169*G0_2_0 - 0.169312169312169*G0_2_1 - 0.067724867724867*G0_2_2;
+    A[994] = 0.067724867724867*G0_0_0 + 0.067724867724867*G0_0_1 + 0.16084656084656*G0_0_2 + 0.118518518518519*G0_1_0 + 0.118518518518519*G0_1_1 + 0.0253968253968246*G0_1_2 + 0.160846560846561*G0_2_0 + 0.160846560846561*G0_2_1 - 0.0169312169312174*G0_2_2;
+    A[995] = -0.0338624338624332*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.0225749559082892*G0_1_1 + 0.0112874779541456*G0_1_2 - 0.033862433862434*G0_2_0 - 0.033862433862434*G0_2_1 + 0.0677248677248679*G0_2_2;
+    A[996] = -0.135449735449736*G0_0_0 - 0.033862433862433*G0_0_1 - 0.135449735449736*G0_0_2 - 0.0338624338624338*G0_1_0 - 0.0451499118165779*G0_1_1 - 0.033862433862434*G0_1_2 - 0.135449735449736*G0_2_0 - 0.0338624338624334*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[997] = 0.0225749559082894*G0_0_0 - 0.0197530864197535*G0_0_1 + 0.0225749559082893*G0_0_2 - 0.0197530864197534*G0_1_0 + 0.022574955908289*G0_1_1 - 0.0197530864197532*G0_1_2 + 0.0225749559082892*G0_2_0 - 0.0197530864197534*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[998] = 0.0112874779541447*G0_0_1 + 0.0112874779541452*G0_1_0 - 0.0451499118165783*G0_1_1 + 0.0112874779541451*G0_1_2 + 0.0112874779541449*G0_2_1;
+    A[999] = -0.0677248677248664*G0_0_0 - 0.169312169312169*G0_0_1 - 0.169312169312169*G0_0_2 - 0.0790123456790112*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.0677248677248669*G0_1_2 - 0.169312169312168*G0_2_0 - 0.270899470899471*G0_2_1 - 0.270899470899471*G0_2_2;
+    A[1000] = -0.0169312169312182*G0_0_0 + 0.16084656084656*G0_0_1 + 0.16084656084656*G0_0_2 + 0.0253968253968244*G0_1_0 + 0.118518518518518*G0_1_1 + 0.118518518518518*G0_1_2 + 0.160846560846559*G0_2_0 + 0.0677248677248662*G0_2_1 + 0.0677248677248661*G0_2_2;
+    A[1001] = 0.0677248677248685*G0_0_0 - 0.0338624338624333*G0_0_1 - 0.0338624338624334*G0_0_2 + 0.0112874779541451*G0_1_0 - 0.0225749559082887*G0_1_1 - 0.0225749559082889*G0_1_2 - 0.0338624338624329*G0_2_0;
+    A[1002] = 0.0451499118165768*G0_0_0 + 0.090299823633154*G0_0_1 + 0.0451499118165772*G0_0_2 + 0.0902998236331558*G0_1_0 + 0.135449735449733*G0_1_1 + 0.0677248677248669*G0_1_2 + 0.0451499118165771*G0_2_0 + 0.0677248677248653*G0_2_1;
+    A[1003] = 0.0451499118165795*G0_0_1 + 0.0225749559082893*G0_0_2 + 0.0451499118165787*G0_1_0 + 0.0902998236331579*G0_1_1 + 0.0451499118165779*G0_1_2 + 0.0225749559082893*G0_2_0 + 0.0451499118165795*G0_2_1;
+    A[1004] = 0.0677248677248662*G0_0_1 + 0.0451499118165779*G0_0_2 + 0.0677248677248678*G0_1_0 + 0.135449735449734*G0_1_1 + 0.0902998236331564*G0_1_2 + 0.0451499118165787*G0_2_0 + 0.0902998236331556*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[1005] = 0.0451499118165773*G0_0_0 + 0.31604938271605*G0_0_1 + 0.180599647266314*G0_0_2 + 0.31604938271605*G0_1_0 + 0.0451499118165782*G0_1_1 + 0.180599647266315*G0_1_2 + 0.180599647266315*G0_2_0 + 0.180599647266315*G0_2_1 + 0.31604938271605*G0_2_2;
+    A[1006] = -0.0451499118165788*G0_0_1 - 0.0225749559082899*G0_0_2 - 0.0451499118165787*G0_1_0 + 0.0451499118165791*G0_1_1 - 0.0225749559082893*G0_2_0 - 0.0451499118165798*G0_2_2;
+    A[1007] = -0.0677248677248672*G0_0_1 - 0.0451499118165779*G0_0_2 - 0.0677248677248678*G0_1_0 - 0.135449735449736*G0_1_1 - 0.180599647266314*G0_1_2 - 0.0451499118165787*G0_2_0 - 0.180599647266315*G0_2_1 - 0.225749559082892*G0_2_2;
+    A[1008] = 0.632098765432098*G0_0_0 + 0.361199294532626*G0_0_1 + 0.361199294532627*G0_0_2 + 0.361199294532626*G0_1_0 + 0.632098765432099*G0_1_1 + 0.361199294532627*G0_1_2 + 0.361199294532627*G0_2_0 + 0.361199294532627*G0_2_1 + 0.6320987654321*G0_2_2;
+    A[1009] = -0.451499118165783*G0_0_0 - 0.0902998236331547*G0_0_1 - 0.22574955908289*G0_0_2 - 0.361199294532626*G0_1_0 - 0.135449735449733*G0_1_1 - 0.203174603174601*G0_1_2 - 0.225749559082891*G0_2_0 - 0.0677248677248656*G0_2_1 - 0.135449735449733*G0_2_2;
+    A[1010] = -0.135449735449734*G0_0_0 - 0.0677248677248664*G0_0_1 - 0.225749559082892*G0_0_2 - 0.203174603174603*G0_1_0 - 0.135449735449735*G0_1_1 - 0.361199294532629*G0_1_2 - 0.225749559082892*G0_2_0 - 0.0902998236331558*G0_2_1 - 0.451499118165786*G0_2_2;
+    A[1011] = 0.316049382716049*G0_0_0 + 0.180599647266313*G0_0_1 + 0.180599647266313*G0_0_2 + 0.180599647266313*G0_1_0 + 0.0451499118165775*G0_1_1 + 0.316049382716049*G0_1_2 + 0.180599647266314*G0_2_0 + 0.31604938271605*G0_2_1 + 0.0451499118165777*G0_2_2;
+    A[1012] = -0.225749559082891*G0_0_0 - 0.180599647266314*G0_0_1 - 0.0451499118165774*G0_0_2 - 0.180599647266313*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0677248677248665*G0_1_2 - 0.0451499118165775*G0_2_0 - 0.0677248677248663*G0_2_1;
+    A[1013] = -0.0451499118165784*G0_0_0 - 0.022574955908289*G0_0_2 + 0.0451499118165799*G0_1_1 - 0.045149911816577*G0_1_2 - 0.0225749559082891*G0_2_0 - 0.0451499118165783*G0_2_1;
+    A[1014] = -0.0902998236331543*G0_0_0 - 0.406349206349205*G0_0_1 - 0.225749559082891*G0_0_2 - 0.406349206349206*G0_1_0 - 0.722398589065257*G0_1_1 - 0.406349206349206*G0_1_2 - 0.225749559082892*G0_2_0 - 0.406349206349206*G0_2_1 - 0.0902998236331568*G0_2_2;
+    A[1015] = -0.0253968253968249*G0_0_0 - 0.0253968253968247*G0_0_1 - 0.0253968253968248*G0_0_2 - 0.0183421516754845*G0_1_0 - 0.0183421516754845*G0_1_1 - 0.0183421516754846*G0_1_2 - 0.0253968253968249*G0_2_0 - 0.0253968253968248*G0_2_1 - 0.0253968253968249*G0_2_2;
+    A[1016] = 0.0423280423280427*G0_0_0 - 0.00705467372134003*G0_1_0;
+    A[1017] = 0.0183421516754849*G0_1_1;
     A[1018] = -0.00705467372134029*G0_1_2 - 0.0253968253968252*G0_2_2;
     A[1019] = -0.0225749559082895*G0_1_1 - 0.011287477954145*G0_1_2 - 0.0112874779541445*G0_2_1;
-    A[1020] = 0.0169312169312171*G0_1_1 + 0.0197530864197531*G0_1_2 + 0.0197530864197533*G0_2_1 + 0.0225749559082892*G0_2_2;
-    A[1021] = 0.0225749559082891*G0_1_1 + 0.0338624338624333*G0_1_2 + 0.0338624338624344*G0_2_1 + 0.0451499118165789*G0_2_2;
+    A[1020] = 0.016931216931217*G0_1_1 + 0.0197530864197531*G0_1_2 + 0.0197530864197533*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[1021] = 0.0225749559082892*G0_1_1 + 0.0338624338624334*G0_1_2 + 0.0338624338624345*G0_2_1 + 0.0451499118165789*G0_2_2;
     A[1022] = -0.27089947089947*G0_0_0 - 0.101587301587301*G0_0_2 - 0.203174603174602*G0_1_0 - 0.112874779541445*G0_1_2 - 0.1015873015873*G0_2_0;
-    A[1023] = 0.0677248677248688*G0_0_0 - 0.0931216931216916*G0_0_2 - 0.0507936507936511*G0_1_0 - 0.186243386243386*G0_1_2 - 0.0931216931216935*G0_2_0 - 0.270899470899471*G0_2_2;
-    A[1024] = 0.0338624338624339*G0_0_2 + 0.0225749559082891*G0_1_0 + 0.0677248677248678*G0_1_2 + 0.0338624338624344*G0_2_0 + 0.135449735449735*G0_2_2;
-    A[1025] = -0.135449735449735*G0_0_0 - 0.101587301587302*G0_0_1 - 0.101587301587302*G0_1_0 - 0.112874779541446*G0_1_1;
-    A[1026] = 0.0225749559082893*G0_0_0 + 0.0423280423280423*G0_0_1 + 0.0423280423280427*G0_1_0 + 0.0846560846560838*G0_1_1;
-    A[1027] = -0.0112874779541444*G0_0_1 - 0.0112874779541451*G0_1_0 - 0.0677248677248675*G0_1_1;
-    A[1028] = 0.0902998236331566*G0_0_0 + 0.0902998236331567*G0_0_1 + 0.0564373897707224*G0_0_2 + 0.0225749559082885*G0_1_0 + 0.0225749559082887*G0_1_1 + 0.0112874779541438*G0_1_2 + 0.0564373897707221*G0_2_0 + 0.0564373897707223*G0_2_1 + 0.0225749559082889*G0_2_2;
-    A[1029] = 0.0677248677248683*G0_0_0 + 0.0677248677248682*G0_0_1 + 0.00282186948853671*G0_0_2 - 0.0169312169312169*G0_1_0 - 0.016931216931217*G0_1_1 + 0.00282186948853593*G0_1_2 + 0.00282186948853679*G0_2_0 + 0.00282186948853674*G0_2_1 + 0.00564373897707206*G0_2_2;
-    A[1030] = -0.0338624338624345*G0_0_2 - 0.0225749559082892*G0_1_0 - 0.022574955908289*G0_1_1 + 0.0112874779541446*G0_1_2 - 0.0338624338624344*G0_2_0 - 0.0338624338624344*G0_2_1 + 0.0225749559082888*G0_2_2;
-    A[1031] = 0.0451499118165787*G0_0_0 + 0.011287477954144*G0_0_1 + 0.0451499118165787*G0_0_2 + 0.0112874779541449*G0_1_0 + 0.0112874779541447*G0_1_2 + 0.0451499118165782*G0_2_0 + 0.0112874779541443*G0_2_1 + 0.0451499118165782*G0_2_2;
-    A[1032] = 0.022574955908289*G0_0_0 + 0.0028218694885367*G0_0_1 + 0.0225749559082891*G0_0_2 + 0.00282186948853581*G0_1_0 + 0.00282186948853584*G0_1_2 + 0.0225749559082894*G0_2_0 + 0.00282186948853625*G0_2_1 + 0.0225749559082895*G0_2_2;
-    A[1033] = 0.0112874779541442*G0_0_1 + 0.0112874779541451*G0_1_0 + 0.0112874779541449*G0_1_2 + 0.0112874779541446*G0_2_1;
-    A[1034] = 0.0677248677248667*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.0564373897707217*G0_1_0 + 0.0677248677248671*G0_1_1 + 0.067724867724867*G0_1_2 + 0.1015873015873*G0_2_0 + 0.135449735449734*G0_2_1 + 0.135449735449734*G0_2_2;
-    A[1035] = -0.0169312169312154*G0_0_0 - 0.177777777777777*G0_0_1 - 0.177777777777777*G0_0_2 - 0.0423280423280405*G0_1_0 - 0.0846560846560836*G0_1_1 - 0.0846560846560836*G0_1_2 - 0.177777777777776*G0_2_0 - 0.27089947089947*G0_2_1 - 0.27089947089947*G0_2_2;
-    A[1036] = -0.0677248677248685*G0_0_0 + 0.101587301587302*G0_0_1 + 0.101587301587302*G0_0_2 + 0.0112874779541435*G0_1_0 + 0.112874779541446*G0_1_1 + 0.112874779541446*G0_1_2 + 0.101587301587301*G0_2_0;
-    A[1037] = 0.0451499118165806*G0_0_0 - 0.270899470899468*G0_0_1 - 0.135449735449735*G0_0_2 - 0.270899470899471*G0_1_0 - 0.541798941798942*G0_1_1 - 0.270899470899472*G0_1_2 - 0.135449735449734*G0_2_0 - 0.270899470899468*G0_2_1;
-    A[1038] = 0.0451499118165778*G0_0_1 + 0.0225749559082891*G0_0_2 + 0.0451499118165785*G0_1_0 + 0.135449735449736*G0_1_1 + 0.0677248677248677*G0_1_2 + 0.0225749559082899*G0_2_0 + 0.0677248677248683*G0_2_1;
-    A[1039] = 0.067724867724869*G0_0_1 + 0.0451499118165795*G0_0_2 + 0.0677248677248672*G0_1_0 - 0.0677248677248675*G0_1_2 + 0.0451499118165791*G0_2_0 - 0.0677248677248677*G0_2_1 - 0.135449735449734*G0_2_2;
-    A[1040] = 0.0451499118165791*G0_0_0 - 0.0451499118165788*G0_0_1 - 0.0451499118165789*G0_1_0 - 0.0225749559082893*G0_1_2 - 0.0225749559082892*G0_2_1 - 0.0451499118165784*G0_2_2;
-    A[1041] = -0.0451499118165778*G0_0_1 - 0.0225749559082889*G0_0_2 - 0.0451499118165785*G0_1_0 - 0.0225749559082893*G0_1_2 - 0.0225749559082899*G0_2_0 - 0.0225749559082888*G0_2_1 - 0.045149911816579*G0_2_2;
-    A[1042] = -0.067724867724868*G0_0_1 - 0.0451499118165783*G0_0_2 - 0.0677248677248673*G0_1_0 - 0.0225749559082886*G0_1_2 - 0.0451499118165791*G0_2_0 - 0.0225749559082902*G0_2_1 - 0.0451499118165784*G0_2_2;
-    A[1043] = -0.451499118165783*G0_0_0 - 0.361199294532626*G0_0_1 - 0.225749559082891*G0_0_2 - 0.0902998236331547*G0_1_0 - 0.135449735449734*G0_1_1 - 0.0677248677248655*G0_1_2 - 0.22574955908289*G0_2_0 - 0.203174603174601*G0_2_1 - 0.135449735449733*G0_2_2;
-    A[1044] = 0.632098765432097*G0_0_0 + 0.270899470899468*G0_0_1 + 0.270899470899468*G0_0_2 + 0.270899470899468*G0_1_0 + 0.541798941798941*G0_1_1 + 0.270899470899468*G0_1_2 + 0.270899470899468*G0_2_0 + 0.270899470899468*G0_2_1 + 0.541798941798939*G0_2_2;
-    A[1045] = -0.135449735449737*G0_0_0 - 0.0677248677248689*G0_0_1 + 0.0902998236331565*G0_0_2 + 0.0677248677248678*G0_1_0 - 0.0677248677248675*G0_1_2 + 0.0902998236331567*G0_2_0 + 0.0677248677248677*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[1046] = -0.225749559082892*G0_0_0 - 0.0451499118165778*G0_0_1 - 0.180599647266313*G0_0_2 - 0.0451499118165783*G0_1_0 - 0.0677248677248676*G0_1_2 - 0.180599647266313*G0_2_0 - 0.0677248677248665*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[1047] = 0.316049382716049*G0_0_0 + 0.135449735449735*G0_0_1 + 0.135449735449735*G0_0_2 + 0.135449735449735*G0_1_0 + 0.270899470899471*G0_1_2 + 0.135449735449734*G0_2_0 + 0.27089947089947*G0_2_1;
-    A[1048] = -0.0451499118165784*G0_0_0 - 0.0451499118165785*G0_0_1 - 0.0225749559082891*G0_0_2 - 0.0451499118165786*G0_1_0 - 0.0677248677248677*G0_1_2 - 0.0225749559082895*G0_2_0 - 0.0677248677248681*G0_2_1;
-    A[1049] = -0.0902998236331594*G0_0_0 + 0.316049382716047*G0_0_1 + 0.135449735449734*G0_0_2 + 0.31604938271605*G0_1_0 + 0.135449735449735*G0_1_2 + 0.135449735449734*G0_2_0 + 0.135449735449733*G0_2_1 + 0.270899470899469*G0_2_2;
-    A[1050] = -0.0253968253968249*G0_0_0 - 0.025396825396825*G0_0_1 - 0.0253968253968251*G0_0_2 - 0.0183421516754849*G0_1_0 - 0.018342151675485*G0_1_1 - 0.018342151675485*G0_1_2 - 0.0253968253968252*G0_2_0 - 0.0253968253968252*G0_2_1 - 0.0253968253968252*G0_2_2;
-    A[1051] = -0.0253968253968255*G0_0_0 - 0.00705467372134043*G0_1_0;
-    A[1052] = 0.0183421516754851*G0_1_1;
-    A[1053] = -0.0070546737213401*G0_1_2 + 0.0423280423280422*G0_2_2;
-    A[1054] = -0.0677248677248677*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.0112874779541444*G0_2_1;
-    A[1055] = 0.0846560846560852*G0_1_1 + 0.0423280423280433*G0_1_2 + 0.0423280423280422*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[1023] = 0.0677248677248687*G0_0_0 - 0.0931216931216921*G0_0_2 - 0.0507936507936513*G0_1_0 - 0.186243386243387*G0_1_2 - 0.0931216931216937*G0_2_0 - 0.270899470899471*G0_2_2;
+    A[1024] = 0.033862433862434*G0_0_2 + 0.0225749559082892*G0_1_0 + 0.067724867724868*G0_1_2 + 0.0338624338624345*G0_2_0 + 0.135449735449736*G0_2_2;
+    A[1025] = -0.135449735449735*G0_0_0 - 0.101587301587301*G0_0_1 - 0.101587301587301*G0_1_0 - 0.112874779541445*G0_1_1;
+    A[1026] = 0.0225749559082892*G0_0_0 + 0.0423280423280422*G0_0_1 + 0.0423280423280426*G0_1_0 + 0.0846560846560838*G0_1_1;
+    A[1027] = -0.0112874779541442*G0_0_1 - 0.0112874779541451*G0_1_0 - 0.0677248677248675*G0_1_1;
+    A[1028] = 0.0902998236331566*G0_0_0 + 0.0902998236331567*G0_0_1 + 0.0564373897707222*G0_0_2 + 0.0225749559082886*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0112874779541438*G0_1_2 + 0.0564373897707221*G0_2_0 + 0.0564373897707223*G0_2_1 + 0.0225749559082888*G0_2_2;
+    A[1029] = 0.0677248677248682*G0_0_0 + 0.0677248677248681*G0_0_1 + 0.00282186948853669*G0_0_2 - 0.016931216931217*G0_1_0 - 0.016931216931217*G0_1_1 + 0.00282186948853599*G0_1_2 + 0.00282186948853678*G0_2_0 + 0.00282186948853675*G0_2_1 + 0.00564373897707232*G0_2_2;
+    A[1030] = -0.0338624338624345*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.0225749559082891*G0_1_1 + 0.0112874779541446*G0_1_2 - 0.0338624338624346*G0_2_0 - 0.0338624338624345*G0_2_1 + 0.0225749559082886*G0_2_2;
+    A[1031] = 0.0451499118165786*G0_0_0 + 0.0112874779541438*G0_0_1 + 0.0451499118165786*G0_0_2 + 0.0112874779541449*G0_1_0 + 0.0112874779541447*G0_1_2 + 0.0451499118165782*G0_2_0 + 0.0112874779541443*G0_2_1 + 0.0451499118165782*G0_2_2;
+    A[1032] = 0.0225749559082891*G0_0_0 + 0.0028218694885369*G0_0_1 + 0.0225749559082892*G0_0_2 + 0.00282186948853583*G0_1_0 + 0.00282186948853579*G0_1_2 + 0.0225749559082894*G0_2_0 + 0.00282186948853623*G0_2_1 + 0.0225749559082895*G0_2_2;
+    A[1033] = 0.011287477954144*G0_0_1 + 0.011287477954145*G0_1_0 + 0.0112874779541449*G0_1_2 + 0.0112874779541446*G0_2_1;
+    A[1034] = 0.0677248677248665*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.0564373897707216*G0_1_0 + 0.0677248677248672*G0_1_1 + 0.0677248677248671*G0_1_2 + 0.1015873015873*G0_2_0 + 0.135449735449734*G0_2_1 + 0.135449735449734*G0_2_2;
+    A[1035] = -0.0169312169312152*G0_0_0 - 0.177777777777777*G0_0_1 - 0.177777777777777*G0_0_2 - 0.0423280423280404*G0_1_0 - 0.0846560846560835*G0_1_1 - 0.0846560846560835*G0_1_2 - 0.177777777777776*G0_2_0 - 0.27089947089947*G0_2_1 - 0.27089947089947*G0_2_2;
+    A[1036] = -0.0677248677248689*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.0112874779541434*G0_1_0 + 0.112874779541446*G0_1_1 + 0.112874779541446*G0_1_2 + 0.101587301587301*G0_2_0;
+    A[1037] = 0.0451499118165806*G0_0_0 - 0.270899470899468*G0_0_1 - 0.135449735449734*G0_0_2 - 0.270899470899471*G0_1_0 - 0.541798941798942*G0_1_1 - 0.270899470899472*G0_1_2 - 0.135449735449734*G0_2_0 - 0.270899470899468*G0_2_1;
+    A[1038] = 0.0451499118165778*G0_0_1 + 0.0225749559082891*G0_0_2 + 0.0451499118165785*G0_1_0 + 0.135449735449736*G0_1_1 + 0.0677248677248677*G0_1_2 + 0.0225749559082899*G0_2_0 + 0.0677248677248684*G0_2_1;
+    A[1039] = 0.067724867724869*G0_0_1 + 0.0451499118165794*G0_0_2 + 0.0677248677248672*G0_1_0 - 0.0677248677248677*G0_1_2 + 0.0451499118165793*G0_2_0 - 0.0677248677248676*G0_2_1 - 0.135449735449734*G0_2_2;
+    A[1040] = 0.0451499118165791*G0_0_0 - 0.0451499118165787*G0_0_1 - 0.0451499118165789*G0_1_0 - 0.0225749559082894*G0_1_2 - 0.0225749559082891*G0_2_1 - 0.0451499118165785*G0_2_2;
+    A[1041] = -0.0451499118165781*G0_0_1 - 0.0225749559082889*G0_0_2 - 0.0451499118165784*G0_1_0 - 0.0225749559082893*G0_1_2 - 0.0225749559082899*G0_2_0 - 0.0225749559082889*G0_2_1 - 0.0451499118165791*G0_2_2;
+    A[1042] = -0.0677248677248678*G0_0_1 - 0.0451499118165783*G0_0_2 - 0.0677248677248673*G0_1_0 - 0.0225749559082886*G0_1_2 - 0.0451499118165793*G0_2_0 - 0.0225749559082901*G0_2_1 - 0.0451499118165783*G0_2_2;
+    A[1043] = -0.451499118165783*G0_0_0 - 0.361199294532626*G0_0_1 - 0.225749559082891*G0_0_2 - 0.0902998236331547*G0_1_0 - 0.135449735449733*G0_1_1 - 0.0677248677248656*G0_1_2 - 0.22574955908289*G0_2_0 - 0.203174603174601*G0_2_1 - 0.135449735449733*G0_2_2;
+    A[1044] = 0.632098765432097*G0_0_0 + 0.270899470899468*G0_0_1 + 0.270899470899468*G0_0_2 + 0.270899470899468*G0_1_0 + 0.541798941798941*G0_1_1 + 0.270899470899468*G0_1_2 + 0.270899470899468*G0_2_0 + 0.270899470899468*G0_2_1 + 0.54179894179894*G0_2_2;
+    A[1045] = -0.135449735449737*G0_0_0 - 0.067724867724869*G0_0_1 + 0.0902998236331566*G0_0_2 + 0.067724867724868*G0_1_0 - 0.0677248677248676*G0_1_2 + 0.0902998236331568*G0_2_0 + 0.0677248677248676*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[1046] = -0.225749559082892*G0_0_0 - 0.0451499118165777*G0_0_1 - 0.180599647266313*G0_0_2 - 0.045149911816578*G0_1_0 - 0.0677248677248675*G0_1_2 - 0.180599647266313*G0_2_0 - 0.0677248677248664*G0_2_1 - 0.135449735449735*G0_2_2;
+    A[1047] = 0.316049382716048*G0_0_0 + 0.135449735449734*G0_0_1 + 0.135449735449734*G0_0_2 + 0.135449735449735*G0_1_0 + 0.270899470899471*G0_1_2 + 0.135449735449734*G0_2_0 + 0.27089947089947*G0_2_1;
+    A[1048] = -0.0451499118165784*G0_0_0 - 0.0451499118165787*G0_0_1 - 0.022574955908289*G0_0_2 - 0.0451499118165786*G0_1_0 - 0.0677248677248676*G0_1_2 - 0.0225749559082895*G0_2_0 - 0.0677248677248682*G0_2_1;
+    A[1049] = -0.0902998236331594*G0_0_0 + 0.316049382716048*G0_0_1 + 0.135449735449733*G0_0_2 + 0.31604938271605*G0_1_0 + 0.135449735449735*G0_1_2 + 0.135449735449734*G0_2_0 + 0.135449735449733*G0_2_1 + 0.270899470899469*G0_2_2;
+    A[1050] = -0.025396825396825*G0_0_0 - 0.025396825396825*G0_0_1 - 0.0253968253968251*G0_0_2 - 0.018342151675485*G0_1_0 - 0.018342151675485*G0_1_1 - 0.018342151675485*G0_1_2 - 0.0253968253968252*G0_2_0 - 0.0253968253968252*G0_2_1 - 0.0253968253968252*G0_2_2;
+    A[1051] = -0.0253968253968255*G0_0_0 - 0.00705467372134046*G0_1_0;
+    A[1052] = 0.018342151675485*G0_1_1;
+    A[1053] = -0.00705467372134011*G0_1_2 + 0.0423280423280422*G0_2_2;
+    A[1054] = -0.0677248677248676*G0_1_1 - 0.0112874779541449*G0_1_2 - 0.0112874779541443*G0_2_1;
+    A[1055] = 0.084656084656085*G0_1_1 + 0.0423280423280432*G0_1_2 + 0.042328042328042*G0_2_1 + 0.0225749559082891*G0_2_2;
     A[1056] = -0.112874779541446*G0_1_1 - 0.101587301587302*G0_1_2 - 0.101587301587302*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[1057] = 0.135449735449736*G0_0_0 + 0.0338624338624341*G0_0_2 + 0.0677248677248677*G0_1_0 + 0.0225749559082893*G0_1_2 + 0.0338624338624333*G0_2_0;
-    A[1058] = -0.270899470899471*G0_0_0 - 0.0931216931216933*G0_0_2 - 0.186243386243386*G0_1_0 - 0.0507936507936511*G0_1_2 - 0.0931216931216917*G0_2_0 + 0.0677248677248682*G0_2_2;
-    A[1059] = -0.101587301587302*G0_0_2 - 0.112874779541447*G0_1_0 - 0.203174603174604*G0_1_2 - 0.101587301587302*G0_2_0 - 0.270899470899471*G0_2_2;
-    A[1060] = 0.045149911816579*G0_0_0 + 0.0338624338624344*G0_0_1 + 0.0338624338624345*G0_1_0 + 0.0225749559082897*G0_1_1;
-    A[1061] = 0.0225749559082891*G0_0_0 + 0.0197530864197528*G0_0_1 + 0.0197530864197531*G0_1_0 + 0.0169312169312169*G0_1_1;
-    A[1062] = -0.0112874779541441*G0_0_1 - 0.0112874779541445*G0_1_0 - 0.0225749559082889*G0_1_1;
-    A[1063] = 0.135449735449735*G0_0_0 + 0.135449735449735*G0_0_1 + 0.101587301587301*G0_0_2 + 0.0677248677248676*G0_1_0 + 0.0677248677248678*G0_1_1 + 0.0564373897707232*G0_1_2 + 0.101587301587301*G0_2_0 + 0.101587301587302*G0_2_1 + 0.0677248677248672*G0_2_2;
-    A[1064] = -0.270899470899471*G0_0_0 - 0.270899470899471*G0_0_1 - 0.177777777777777*G0_0_2 - 0.0846560846560856*G0_1_0 - 0.0846560846560854*G0_1_1 - 0.042328042328043*G0_1_2 - 0.177777777777779*G0_2_0 - 0.177777777777779*G0_2_1 - 0.0169312169312165*G0_2_2;
-    A[1065] = 0.101587301587301*G0_0_2 + 0.112874779541446*G0_1_0 + 0.112874779541446*G0_1_1 + 0.0112874779541449*G0_1_2 + 0.101587301587302*G0_2_0 + 0.101587301587302*G0_2_1 - 0.0677248677248675*G0_2_2;
-    A[1066] = 0.0451499118165787*G0_0_0 + 0.0112874779541443*G0_0_1 + 0.0451499118165785*G0_0_2 + 0.0112874779541445*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.0451499118165786*G0_2_0 + 0.0112874779541443*G0_2_1 + 0.0451499118165784*G0_2_2;
-    A[1067] = 0.0225749559082893*G0_0_0 + 0.00282186948853625*G0_0_1 + 0.0225749559082894*G0_0_2 + 0.00282186948853616*G0_1_0 + 0.00282186948853615*G0_1_2 + 0.0225749559082894*G0_2_0 + 0.00282186948853642*G0_2_1 + 0.0225749559082892*G0_2_2;
-    A[1068] = 0.0112874779541446*G0_0_1 + 0.0112874779541445*G0_1_0 + 0.0112874779541444*G0_1_2 + 0.0112874779541443*G0_2_1;
-    A[1069] = 0.0225749559082885*G0_0_0 + 0.0564373897707229*G0_0_1 + 0.0564373897707228*G0_0_2 + 0.0112874779541442*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0225749559082888*G0_1_2 + 0.0564373897707227*G0_2_0 + 0.0902998236331572*G0_2_1 + 0.0902998236331571*G0_2_2;
-    A[1070] = 0.00564373897707262*G0_0_0 + 0.00282186948853636*G0_0_1 + 0.00282186948853635*G0_0_2 + 0.002821869488536*G0_1_0 - 0.0169312169312172*G0_1_1 - 0.0169312169312171*G0_1_2 + 0.00282186948853626*G0_2_0 + 0.067724867724868*G0_2_1 + 0.067724867724868*G0_2_2;
-    A[1071] = 0.0225749559082893*G0_0_0 - 0.0338624338624341*G0_0_1 - 0.0338624338624341*G0_0_2 + 0.0112874779541451*G0_1_0 - 0.0225749559082893*G0_1_1 - 0.0225749559082891*G0_1_2 - 0.0338624338624338*G0_2_0;
-    A[1072] = -0.135449735449737*G0_0_0 - 0.0677248677248682*G0_0_1 + 0.0451499118165778*G0_0_2 - 0.0677248677248691*G0_1_0 + 0.067724867724867*G0_1_2 + 0.0451499118165782*G0_2_0 + 0.067724867724868*G0_2_1;
-    A[1073] = 0.0677248677248675*G0_0_1 + 0.0225749559082896*G0_0_2 + 0.0677248677248682*G0_1_0 + 0.135449735449736*G0_1_1 + 0.0451499118165787*G0_1_2 + 0.0225749559082892*G0_2_0 + 0.0451499118165778*G0_2_1;
+    A[1057] = 0.135449735449736*G0_0_0 + 0.033862433862434*G0_0_2 + 0.0677248677248678*G0_1_0 + 0.0225749559082894*G0_1_2 + 0.0338624338624334*G0_2_0;
+    A[1058] = -0.270899470899472*G0_0_0 - 0.0931216931216933*G0_0_2 - 0.186243386243386*G0_1_0 - 0.0507936507936513*G0_1_2 - 0.093121693121692*G0_2_0 + 0.0677248677248681*G0_2_2;
+    A[1059] = -0.101587301587302*G0_0_2 - 0.112874779541446*G0_1_0 - 0.203174603174603*G0_1_2 - 0.101587301587302*G0_2_0 - 0.270899470899471*G0_2_2;
+    A[1060] = 0.0451499118165788*G0_0_0 + 0.0338624338624343*G0_0_1 + 0.0338624338624344*G0_1_0 + 0.0225749559082897*G0_1_1;
+    A[1061] = 0.0225749559082893*G0_0_0 + 0.0197530864197529*G0_0_1 + 0.0197530864197532*G0_1_0 + 0.0169312169312169*G0_1_1;
+    A[1062] = -0.0112874779541442*G0_0_1 - 0.0112874779541444*G0_1_0 - 0.0225749559082889*G0_1_1;
+    A[1063] = 0.135449735449735*G0_0_0 + 0.135449735449735*G0_0_1 + 0.101587301587301*G0_0_2 + 0.0677248677248677*G0_1_0 + 0.0677248677248677*G0_1_1 + 0.0564373897707231*G0_1_2 + 0.101587301587302*G0_2_0 + 0.101587301587301*G0_2_1 + 0.0677248677248673*G0_2_2;
+    A[1064] = -0.270899470899471*G0_0_0 - 0.270899470899471*G0_0_1 - 0.177777777777777*G0_0_2 - 0.0846560846560857*G0_1_0 - 0.0846560846560854*G0_1_1 - 0.0423280423280429*G0_1_2 - 0.177777777777779*G0_2_0 - 0.177777777777779*G0_2_1 - 0.0169312169312166*G0_2_2;
+    A[1065] = 0.101587301587301*G0_0_2 + 0.112874779541446*G0_1_0 + 0.112874779541446*G0_1_1 + 0.0112874779541447*G0_1_2 + 0.101587301587302*G0_2_0 + 0.101587301587302*G0_2_1 - 0.0677248677248675*G0_2_2;
+    A[1066] = 0.0451499118165788*G0_0_0 + 0.0112874779541444*G0_0_1 + 0.0451499118165786*G0_0_2 + 0.0112874779541445*G0_1_0 + 0.0112874779541446*G0_1_2 + 0.0451499118165786*G0_2_0 + 0.0112874779541444*G0_2_1 + 0.0451499118165785*G0_2_2;
+    A[1067] = 0.0225749559082892*G0_0_0 + 0.00282186948853617*G0_0_1 + 0.0225749559082892*G0_0_2 + 0.00282186948853611*G0_1_0 + 0.0028218694885361*G0_1_2 + 0.0225749559082893*G0_2_0 + 0.00282186948853636*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[1068] = 0.0112874779541447*G0_0_1 + 0.0112874779541444*G0_1_0 + 0.0112874779541444*G0_1_2 + 0.0112874779541444*G0_2_1;
+    A[1069] = 0.0225749559082885*G0_0_0 + 0.056437389770723*G0_0_1 + 0.056437389770723*G0_0_2 + 0.0112874779541442*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0225749559082888*G0_1_2 + 0.0564373897707227*G0_2_0 + 0.0902998236331572*G0_2_1 + 0.0902998236331571*G0_2_2;
+    A[1070] = 0.00564373897707258*G0_0_0 + 0.00282186948853624*G0_0_1 + 0.00282186948853624*G0_0_2 + 0.00282186948853609*G0_1_0 - 0.0169312169312171*G0_1_1 - 0.016931216931217*G0_1_2 + 0.00282186948853637*G0_2_0 + 0.067724867724868*G0_2_1 + 0.067724867724868*G0_2_2;
+    A[1071] = 0.0225749559082893*G0_0_0 - 0.0338624338624341*G0_0_1 - 0.033862433862434*G0_0_2 + 0.011287477954145*G0_1_0 - 0.0225749559082893*G0_1_1 - 0.0225749559082891*G0_1_2 - 0.0338624338624339*G0_2_0;
+    A[1072] = -0.135449735449737*G0_0_0 - 0.0677248677248683*G0_0_1 + 0.0451499118165779*G0_0_2 - 0.0677248677248691*G0_1_0 + 0.0677248677248671*G0_1_2 + 0.0451499118165782*G0_2_0 + 0.0677248677248679*G0_2_1;
+    A[1073] = 0.0677248677248675*G0_0_1 + 0.0225749559082897*G0_0_2 + 0.0677248677248682*G0_1_0 + 0.135449735449736*G0_1_1 + 0.0451499118165789*G0_1_2 + 0.0225749559082892*G0_2_0 + 0.0451499118165776*G0_2_1;
     A[1074] = -0.270899470899472*G0_0_1 - 0.135449735449736*G0_0_2 - 0.27089947089947*G0_1_0 - 0.541798941798942*G0_1_1 - 0.270899470899471*G0_1_2 - 0.135449735449736*G0_2_0 - 0.27089947089947*G0_2_1 + 0.0451499118165779*G0_2_2;
-    A[1075] = -0.135449735449736*G0_0_0 - 0.0677248677248676*G0_0_1 - 0.180599647266314*G0_0_2 - 0.0677248677248675*G0_1_0 - 0.0451499118165787*G0_1_2 - 0.180599647266315*G0_2_0 - 0.0451499118165785*G0_2_1 - 0.225749559082893*G0_2_2;
-    A[1076] = -0.0677248677248679*G0_0_1 - 0.0225749559082888*G0_0_2 - 0.0677248677248681*G0_1_0 - 0.0451499118165786*G0_1_2 - 0.0225749559082892*G0_2_0 - 0.0451499118165787*G0_2_1 - 0.0451499118165776*G0_2_2;
+    A[1075] = -0.135449735449736*G0_0_0 - 0.0677248677248675*G0_0_1 - 0.180599647266314*G0_0_2 - 0.0677248677248674*G0_1_0 - 0.0451499118165787*G0_1_2 - 0.180599647266315*G0_2_0 - 0.0451499118165785*G0_2_1 - 0.225749559082893*G0_2_2;
+    A[1076] = -0.0677248677248679*G0_0_1 - 0.0225749559082887*G0_0_2 - 0.0677248677248682*G0_1_0 - 0.0451499118165786*G0_1_2 - 0.0225749559082892*G0_2_0 - 0.0451499118165787*G0_2_1 - 0.0451499118165774*G0_2_2;
     A[1077] = 0.270899470899471*G0_0_1 + 0.135449735449735*G0_0_2 + 0.27089947089947*G0_1_0 + 0.135449735449736*G0_1_2 + 0.135449735449736*G0_2_0 + 0.135449735449736*G0_2_1 + 0.31604938271605*G0_2_2;
-    A[1078] = -0.135449735449734*G0_0_0 - 0.203174603174603*G0_0_1 - 0.225749559082892*G0_0_2 - 0.0677248677248664*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0902998236331559*G0_1_2 - 0.225749559082891*G0_2_0 - 0.361199294532629*G0_2_1 - 0.451499118165786*G0_2_2;
-    A[1079] = -0.135449735449737*G0_0_0 + 0.0677248677248678*G0_0_1 + 0.0902998236331567*G0_0_2 - 0.0677248677248689*G0_1_0 + 0.0677248677248677*G0_1_2 + 0.0902998236331565*G0_2_0 - 0.0677248677248675*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[1080] = 0.541798941798942*G0_0_0 + 0.270899470899472*G0_0_1 + 0.270899470899471*G0_0_2 + 0.270899470899471*G0_1_0 + 0.541798941798942*G0_1_1 + 0.27089947089947*G0_1_2 + 0.270899470899471*G0_2_0 + 0.27089947089947*G0_2_1 + 0.632098765432099*G0_2_2;
-    A[1081] = -0.0451499118165787*G0_0_0 - 0.0225749559082893*G0_0_1 - 0.02257495590829*G0_1_0 - 0.045149911816579*G0_1_2 - 0.0451499118165793*G0_2_1 + 0.0451499118165779*G0_2_2;
-    A[1082] = -0.045149911816579*G0_0_0 - 0.0225749559082893*G0_0_1 - 0.0451499118165783*G0_0_2 - 0.0225749559082891*G0_1_0 - 0.0677248677248673*G0_1_2 - 0.0451499118165787*G0_2_0 - 0.0677248677248683*G0_2_1;
-    A[1083] = -0.0451499118165785*G0_0_0 - 0.0225749559082898*G0_0_1 - 0.02257495590829*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.0451499118165794*G0_1_2 - 0.0225749559082892*G0_2_0 - 0.0451499118165783*G0_2_1;
-    A[1084] = 0.270899470899473*G0_0_0 + 0.135449735449736*G0_0_1 + 0.135449735449737*G0_0_2 + 0.135449735449737*G0_1_0 + 0.31604938271605*G0_1_2 + 0.135449735449737*G0_2_0 + 0.316049382716051*G0_2_1 - 0.0902998236331552*G0_2_2;
-    A[1085] = 0.0423280423280419*G0_0_0 + 0.0423280423280419*G0_0_1 + 0.0423280423280419*G0_0_2 + 0.0423280423280418*G0_1_0 + 0.042328042328042*G0_1_1 + 0.042328042328042*G0_1_2 + 0.0493827160493822*G0_2_0 + 0.0493827160493823*G0_2_1 + 0.0493827160493823*G0_2_2;
-    A[1086] = -0.0253968253968257*G0_0_0 - 0.00705467372134064*G0_2_0;
-    A[1087] = -0.0253968253968254*G0_1_1 - 0.00705467372134026*G0_2_1;
+    A[1078] = -0.135449735449734*G0_0_0 - 0.203174603174603*G0_0_1 - 0.225749559082892*G0_0_2 - 0.0677248677248664*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0902998236331558*G0_1_2 - 0.225749559082892*G0_2_0 - 0.361199294532629*G0_2_1 - 0.451499118165786*G0_2_2;
+    A[1079] = -0.135449735449737*G0_0_0 + 0.067724867724868*G0_0_1 + 0.0902998236331568*G0_0_2 - 0.067724867724869*G0_1_0 + 0.0677248677248676*G0_1_2 + 0.0902998236331566*G0_2_0 - 0.0677248677248676*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[1080] = 0.541798941798943*G0_0_0 + 0.270899470899472*G0_0_1 + 0.270899470899471*G0_0_2 + 0.270899470899472*G0_1_0 + 0.541798941798942*G0_1_1 + 0.27089947089947*G0_1_2 + 0.270899470899471*G0_2_0 + 0.27089947089947*G0_2_1 + 0.632098765432099*G0_2_2;
+    A[1081] = -0.0451499118165789*G0_0_0 - 0.0225749559082895*G0_0_1 - 0.02257495590829*G0_1_0 - 0.045149911816579*G0_1_2 - 0.0451499118165794*G0_2_1 + 0.0451499118165777*G0_2_2;
+    A[1082] = -0.0451499118165787*G0_0_0 - 0.0225749559082892*G0_0_1 - 0.0451499118165782*G0_0_2 - 0.0225749559082889*G0_1_0 - 0.0677248677248672*G0_1_2 - 0.0451499118165784*G0_2_0 - 0.0677248677248682*G0_2_1;
+    A[1083] = -0.0451499118165785*G0_0_0 - 0.0225749559082896*G0_0_1 - 0.02257495590829*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.0451499118165795*G0_1_2 - 0.0225749559082892*G0_2_0 - 0.0451499118165783*G0_2_1;
+    A[1084] = 0.270899470899473*G0_0_0 + 0.135449735449736*G0_0_1 + 0.135449735449737*G0_0_2 + 0.135449735449737*G0_1_0 + 0.31604938271605*G0_1_2 + 0.135449735449737*G0_2_0 + 0.316049382716051*G0_2_1 - 0.0902998236331549*G0_2_2;
+    A[1085] = 0.0423280423280417*G0_0_0 + 0.0423280423280417*G0_0_1 + 0.0423280423280418*G0_0_2 + 0.0423280423280418*G0_1_0 + 0.042328042328042*G0_1_1 + 0.042328042328042*G0_1_2 + 0.0493827160493822*G0_2_0 + 0.0493827160493823*G0_2_1 + 0.0493827160493823*G0_2_2;
+    A[1086] = -0.0253968253968256*G0_0_0 - 0.00705467372134058*G0_2_0;
+    A[1087] = -0.0253968253968254*G0_1_1 - 0.00705467372134031*G0_2_1;
     A[1088] = 0.018342151675485*G0_2_2;
-    A[1089] = 0.0451499118165787*G0_1_1 + 0.0338624338624341*G0_1_2 + 0.033862433862434*G0_2_1 + 0.0225749559082893*G0_2_2;
-    A[1090] = 0.0225749559082894*G0_1_1 + 0.019753086419753*G0_1_2 + 0.0197530864197532*G0_2_1 + 0.016931216931217*G0_2_2;
-    A[1091] = -0.0112874779541443*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0225749559082894*G0_2_2;
-    A[1092] = 0.0451499118165786*G0_0_0 + 0.0338624338624339*G0_0_2 + 0.0338624338624342*G0_2_0 + 0.0225749559082894*G0_2_2;
-    A[1093] = 0.0225749559082893*G0_0_0 + 0.0197530864197534*G0_0_2 + 0.0197530864197529*G0_2_0 + 0.0169312169312166*G0_2_2;
-    A[1094] = -0.0112874779541447*G0_0_2 - 0.0112874779541445*G0_2_0 - 0.0225749559082889*G0_2_2;
-    A[1095] = 0.0902998236331572*G0_0_0 + 0.0338624338624343*G0_0_1 + 0.0338624338624342*G0_1_0 + 0.0677248677248681*G0_2_0 + 0.0225749559082897*G0_2_1;
-    A[1096] = 0.067724867724866*G0_0_0 + 0.0649029982363297*G0_0_1 + 0.0649029982363297*G0_1_0 + 0.067724867724866*G0_1_1 + 0.0846560846560822*G0_2_0 + 0.0846560846560826*G0_2_1;
-    A[1097] = 0.0338624338624339*G0_0_1 + 0.0338624338624344*G0_1_0 + 0.0902998236331574*G0_1_1 + 0.0225749559082897*G0_2_0 + 0.0677248677248677*G0_2_1;
-    A[1098] = -0.135449735449735*G0_0_0 - 0.135449735449735*G0_0_1 - 0.0338624338624335*G0_0_2 - 0.135449735449735*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0338624338624337*G0_1_2 - 0.0338624338624334*G0_2_0 - 0.0338624338624337*G0_2_1 - 0.045149911816578*G0_2_2;
-    A[1099] = 0.0225749559082894*G0_0_0 + 0.0225749559082894*G0_0_1 - 0.0197530864197532*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.019753086419753*G0_1_2 - 0.019753086419753*G0_2_0 - 0.0197530864197529*G0_2_1 + 0.0225749559082889*G0_2_2;
-    A[1100] = 0.0112874779541448*G0_0_2 + 0.0112874779541446*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0112874779541446*G0_2_1 - 0.0451499118165777*G0_2_2;
-    A[1101] = -0.270899470899471*G0_0_0 - 0.169312169312169*G0_0_1 - 0.270899470899471*G0_0_2 - 0.169312169312169*G0_1_0 - 0.0677248677248675*G0_1_1 - 0.169312169312169*G0_1_2 - 0.0677248677248669*G0_2_0 - 0.079012345679012*G0_2_1 - 0.0677248677248677*G0_2_2;
-    A[1102] = 0.0677248677248667*G0_0_0 + 0.160846560846561*G0_0_1 + 0.0677248677248667*G0_0_2 + 0.16084656084656*G0_1_0 - 0.0169312169312168*G0_1_1 + 0.160846560846561*G0_1_2 + 0.118518518518518*G0_2_0 + 0.0253968253968256*G0_2_1 + 0.118518518518518*G0_2_2;
-    A[1103] = -0.0338624338624341*G0_0_1 - 0.0338624338624343*G0_1_0 + 0.0677248677248674*G0_1_1 - 0.0338624338624343*G0_1_2 - 0.0225749559082896*G0_2_0 + 0.0112874779541442*G0_2_1 - 0.0225749559082897*G0_2_2;
-    A[1104] = -0.0677248677248667*G0_0_0 - 0.169312169312168*G0_0_1 - 0.169312169312168*G0_0_2 - 0.169312169312168*G0_1_0 - 0.270899470899471*G0_1_1 - 0.270899470899471*G0_1_2 - 0.0790123456790115*G0_2_0 - 0.067724867724867*G0_2_1 - 0.0677248677248668*G0_2_2;
-    A[1105] = -0.0169312169312182*G0_0_0 + 0.16084656084656*G0_0_1 + 0.16084656084656*G0_0_2 + 0.16084656084656*G0_1_0 + 0.0677248677248662*G0_1_1 + 0.0677248677248663*G0_1_2 + 0.0253968253968249*G0_2_0 + 0.118518518518518*G0_2_1 + 0.118518518518518*G0_2_2;
-    A[1106] = 0.0677248677248685*G0_0_0 - 0.0338624338624337*G0_0_1 - 0.0338624338624338*G0_0_2 - 0.033862433862433*G0_1_0 + 0.0112874779541449*G0_2_0 - 0.0225749559082893*G0_2_1 - 0.0225749559082894*G0_2_2;
-    A[1107] = 0.0451499118165771*G0_0_0 + 0.045149911816578*G0_0_1 + 0.0902998236331549*G0_0_2 + 0.0451499118165772*G0_1_0 + 0.0677248677248659*G0_1_2 + 0.0902998236331556*G0_2_0 + 0.0677248677248673*G0_2_1 + 0.135449735449734*G0_2_2;
-    A[1108] = 0.0451499118165776*G0_0_1 + 0.0677248677248664*G0_0_2 + 0.0451499118165789*G0_1_0 + 0.0451499118165781*G0_1_1 + 0.0902998236331562*G0_1_2 + 0.0677248677248677*G0_2_0 + 0.0902998236331558*G0_2_1 + 0.135449735449734*G0_2_2;
-    A[1109] = 0.0225749559082898*G0_0_1 + 0.0451499118165794*G0_0_2 + 0.0225749559082897*G0_1_0 + 0.0451499118165792*G0_1_2 + 0.0451499118165789*G0_2_0 + 0.0451499118165787*G0_2_1 + 0.0902998236331574*G0_2_2;
-    A[1110] = 0.0451499118165773*G0_0_0 + 0.180599647266313*G0_0_1 + 0.31604938271605*G0_0_2 + 0.180599647266314*G0_1_0 + 0.316049382716049*G0_1_1 + 0.180599647266314*G0_1_2 + 0.316049382716049*G0_2_0 + 0.180599647266313*G0_2_1 + 0.0451499118165788*G0_2_2;
-    A[1111] = -0.045149911816578*G0_0_1 - 0.0677248677248669*G0_0_2 - 0.0451499118165789*G0_1_0 - 0.225749559082893*G0_1_1 - 0.180599647266314*G0_1_2 - 0.0677248677248677*G0_2_0 - 0.180599647266313*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[1112] = -0.0225749559082892*G0_0_1 - 0.045149911816579*G0_0_2 - 0.0225749559082896*G0_1_0 - 0.0451499118165786*G0_1_1 - 0.0451499118165788*G0_2_0 + 0.0451499118165783*G0_2_2;
-    A[1113] = 0.316049382716049*G0_0_0 + 0.180599647266313*G0_0_1 + 0.180599647266314*G0_0_2 + 0.180599647266313*G0_1_0 + 0.0451499118165775*G0_1_1 + 0.31604938271605*G0_1_2 + 0.180599647266313*G0_2_0 + 0.316049382716049*G0_2_1 + 0.0451499118165776*G0_2_2;
-    A[1114] = -0.225749559082892*G0_0_0 - 0.0451499118165783*G0_0_1 - 0.180599647266313*G0_0_2 - 0.0451499118165779*G0_1_0 - 0.0677248677248665*G0_1_2 - 0.180599647266313*G0_2_0 - 0.0677248677248676*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[1115] = -0.0451499118165787*G0_0_0 - 0.02257495590829*G0_0_1 - 0.0225749559082893*G0_1_0 - 0.0451499118165793*G0_1_2 - 0.045149911816579*G0_2_1 + 0.0451499118165779*G0_2_2;
-    A[1116] = 0.632098765432098*G0_0_0 + 0.361199294532626*G0_0_1 + 0.361199294532626*G0_0_2 + 0.361199294532626*G0_1_0 + 0.632098765432097*G0_1_1 + 0.361199294532626*G0_1_2 + 0.361199294532626*G0_2_0 + 0.361199294532626*G0_2_1 + 0.632098765432097*G0_2_2;
-    A[1117] = -0.451499118165785*G0_0_0 - 0.225749559082891*G0_0_1 - 0.0902998236331553*G0_0_2 - 0.225749559082891*G0_1_0 - 0.135449735449733*G0_1_1 - 0.0677248677248661*G0_1_2 - 0.361199294532627*G0_2_0 - 0.203174603174602*G0_2_1 - 0.135449735449734*G0_2_2;
-    A[1118] = -0.135449735449733*G0_0_0 - 0.22574955908289*G0_0_1 - 0.067724867724866*G0_0_2 - 0.22574955908289*G0_1_0 - 0.451499118165784*G0_1_1 - 0.0902998236331554*G0_1_2 - 0.2031746031746*G0_2_0 - 0.361199294532626*G0_2_1 - 0.135449735449733*G0_2_2;
-    A[1119] = -0.0902998236331546*G0_0_0 - 0.225749559082891*G0_0_1 - 0.406349206349205*G0_0_2 - 0.225749559082891*G0_1_0 - 0.0902998236331553*G0_1_1 - 0.406349206349206*G0_1_2 - 0.406349206349205*G0_2_0 - 0.406349206349205*G0_2_1 - 0.722398589065255*G0_2_2;
-    A[1120] = -0.0253968253968253*G0_0_0 - 0.0253968253968251*G0_0_1 - 0.0253968253968252*G0_0_2 - 0.025396825396825*G0_1_0 - 0.025396825396825*G0_1_1 - 0.0253968253968251*G0_1_2 - 0.0183421516754847*G0_2_0 - 0.0183421516754848*G0_2_1 - 0.0183421516754848*G0_2_2;
-    A[1121] = 0.0423280423280425*G0_0_0 - 0.00705467372134001*G0_2_0;
-    A[1122] = -0.0253968253968256*G0_1_1 - 0.00705467372134067*G0_2_1;
+    A[1089] = 0.0451499118165788*G0_1_1 + 0.0338624338624341*G0_1_2 + 0.033862433862434*G0_2_1 + 0.0225749559082892*G0_2_2;
+    A[1090] = 0.0225749559082895*G0_1_1 + 0.019753086419753*G0_1_2 + 0.0197530864197533*G0_2_1 + 0.0169312169312172*G0_2_2;
+    A[1091] = -0.0112874779541444*G0_1_2 - 0.0112874779541446*G0_2_1 - 0.0225749559082894*G0_2_2;
+    A[1092] = 0.0451499118165783*G0_0_0 + 0.0338624338624336*G0_0_2 + 0.0338624338624341*G0_2_0 + 0.0225749559082893*G0_2_2;
+    A[1093] = 0.0225749559082895*G0_0_0 + 0.0197530864197535*G0_0_2 + 0.0197530864197531*G0_2_0 + 0.0169312169312168*G0_2_2;
+    A[1094] = -0.0112874779541448*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.022574955908289*G0_2_2;
+    A[1095] = 0.0902998236331566*G0_0_0 + 0.0338624338624341*G0_0_1 + 0.0338624338624339*G0_1_0 + 0.0677248677248679*G0_2_0 + 0.0225749559082897*G0_2_1;
+    A[1096] = 0.0677248677248662*G0_0_0 + 0.0649029982363293*G0_0_1 + 0.0649029982363297*G0_1_0 + 0.0677248677248654*G0_1_1 + 0.0846560846560823*G0_2_0 + 0.0846560846560822*G0_2_1;
+    A[1097] = 0.033862433862434*G0_0_1 + 0.0338624338624344*G0_1_0 + 0.0902998236331577*G0_1_1 + 0.0225749559082896*G0_2_0 + 0.0677248677248677*G0_2_1;
+    A[1098] = -0.135449735449735*G0_0_0 - 0.135449735449735*G0_0_1 - 0.0338624338624333*G0_0_2 - 0.135449735449735*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0338624338624336*G0_1_2 - 0.0338624338624335*G0_2_0 - 0.0338624338624337*G0_2_1 - 0.0451499118165779*G0_2_2;
+    A[1099] = 0.0225749559082894*G0_0_0 + 0.0225749559082894*G0_0_1 - 0.0197530864197534*G0_0_2 + 0.0225749559082896*G0_1_0 + 0.0225749559082894*G0_1_1 - 0.0197530864197532*G0_1_2 - 0.0197530864197528*G0_2_0 - 0.0197530864197529*G0_2_1 + 0.0225749559082888*G0_2_2;
+    A[1100] = 0.011287477954145*G0_0_2 + 0.0112874779541448*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541446*G0_2_1 - 0.0451499118165775*G0_2_2;
+    A[1101] = -0.270899470899471*G0_0_0 - 0.169312169312169*G0_0_1 - 0.270899470899471*G0_0_2 - 0.169312169312169*G0_1_0 - 0.0677248677248674*G0_1_1 - 0.169312169312169*G0_1_2 - 0.067724867724867*G0_2_0 - 0.0790123456790119*G0_2_1 - 0.0677248677248677*G0_2_2;
+    A[1102] = 0.0677248677248668*G0_0_0 + 0.160846560846561*G0_0_1 + 0.0677248677248667*G0_0_2 + 0.160846560846561*G0_1_0 - 0.0169312169312168*G0_1_1 + 0.160846560846561*G0_1_2 + 0.118518518518518*G0_2_0 + 0.0253968253968257*G0_2_1 + 0.118518518518518*G0_2_2;
+    A[1103] = -0.0338624338624339*G0_0_1 - 0.0338624338624344*G0_1_0 + 0.0677248677248675*G0_1_1 - 0.0338624338624343*G0_1_2 - 0.0225749559082895*G0_2_0 + 0.0112874779541442*G0_2_1 - 0.0225749559082896*G0_2_2;
+    A[1104] = -0.0677248677248664*G0_0_0 - 0.169312169312169*G0_0_1 - 0.169312169312169*G0_0_2 - 0.169312169312168*G0_1_0 - 0.27089947089947*G0_1_1 - 0.270899470899471*G0_1_2 - 0.0790123456790114*G0_2_0 - 0.067724867724867*G0_2_1 - 0.0677248677248669*G0_2_2;
+    A[1105] = -0.0169312169312183*G0_0_0 + 0.16084656084656*G0_0_1 + 0.16084656084656*G0_0_2 + 0.16084656084656*G0_1_0 + 0.0677248677248661*G0_1_1 + 0.0677248677248661*G0_1_2 + 0.0253968253968248*G0_2_0 + 0.118518518518518*G0_2_1 + 0.118518518518518*G0_2_2;
+    A[1106] = 0.0677248677248685*G0_0_0 - 0.0338624338624336*G0_0_1 - 0.0338624338624337*G0_0_2 - 0.0338624338624331*G0_1_0 + 0.0112874779541449*G0_2_0 - 0.0225749559082893*G0_2_1 - 0.0225749559082895*G0_2_2;
+    A[1107] = 0.0451499118165768*G0_0_0 + 0.0451499118165777*G0_0_1 + 0.0902998236331542*G0_0_2 + 0.045149911816577*G0_1_0 + 0.0677248677248654*G0_1_2 + 0.0902998236331556*G0_2_0 + 0.0677248677248674*G0_2_1 + 0.135449735449734*G0_2_2;
+    A[1108] = 0.0451499118165776*G0_0_1 + 0.0677248677248665*G0_0_2 + 0.0451499118165791*G0_1_0 + 0.045149911816578*G0_1_1 + 0.0902998236331562*G0_1_2 + 0.0677248677248677*G0_2_0 + 0.0902998236331559*G0_2_1 + 0.135449735449734*G0_2_2;
+    A[1109] = 0.0225749559082899*G0_0_1 + 0.0451499118165797*G0_0_2 + 0.0225749559082897*G0_1_0 + 0.0451499118165796*G0_1_2 + 0.045149911816579*G0_2_0 + 0.0451499118165787*G0_2_1 + 0.0902998236331577*G0_2_2;
+    A[1110] = 0.0451499118165773*G0_0_0 + 0.180599647266313*G0_0_1 + 0.31604938271605*G0_0_2 + 0.180599647266314*G0_1_0 + 0.316049382716049*G0_1_1 + 0.180599647266314*G0_1_2 + 0.316049382716049*G0_2_0 + 0.180599647266313*G0_2_1 + 0.0451499118165789*G0_2_2;
+    A[1111] = -0.045149911816578*G0_0_1 - 0.0677248677248672*G0_0_2 - 0.0451499118165791*G0_1_0 - 0.225749559082893*G0_1_1 - 0.180599647266314*G0_1_2 - 0.0677248677248677*G0_2_0 - 0.180599647266313*G0_2_1 - 0.135449735449735*G0_2_2;
+    A[1112] = -0.0225749559082895*G0_0_1 - 0.045149911816579*G0_0_2 - 0.0225749559082897*G0_1_0 - 0.0451499118165788*G0_1_1 - 0.0451499118165789*G0_2_0 + 0.0451499118165782*G0_2_2;
+    A[1113] = 0.316049382716049*G0_0_0 + 0.180599647266313*G0_0_1 + 0.180599647266314*G0_0_2 + 0.180599647266313*G0_1_0 + 0.0451499118165775*G0_1_1 + 0.31604938271605*G0_1_2 + 0.180599647266313*G0_2_0 + 0.316049382716049*G0_2_1 + 0.0451499118165777*G0_2_2;
+    A[1114] = -0.225749559082892*G0_0_0 - 0.045149911816578*G0_0_1 - 0.180599647266313*G0_0_2 - 0.0451499118165777*G0_1_0 - 0.0677248677248664*G0_1_2 - 0.180599647266313*G0_2_0 - 0.0677248677248675*G0_2_1 - 0.135449735449735*G0_2_2;
+    A[1115] = -0.0451499118165789*G0_0_0 - 0.02257495590829*G0_0_1 - 0.0225749559082895*G0_1_0 - 0.0451499118165794*G0_1_2 - 0.045149911816579*G0_2_1 + 0.0451499118165777*G0_2_2;
+    A[1116] = 0.632098765432097*G0_0_0 + 0.361199294532626*G0_0_1 + 0.361199294532626*G0_0_2 + 0.361199294532626*G0_1_0 + 0.632098765432098*G0_1_1 + 0.361199294532625*G0_1_2 + 0.361199294532626*G0_2_0 + 0.361199294532625*G0_2_1 + 0.632098765432096*G0_2_2;
+    A[1117] = -0.451499118165784*G0_0_0 - 0.22574955908289*G0_0_1 - 0.0902998236331546*G0_0_2 - 0.225749559082891*G0_1_0 - 0.135449735449733*G0_1_1 - 0.0677248677248656*G0_1_2 - 0.361199294532627*G0_2_0 - 0.203174603174602*G0_2_1 - 0.135449735449734*G0_2_2;
+    A[1118] = -0.135449735449733*G0_0_0 - 0.22574955908289*G0_0_1 - 0.067724867724866*G0_0_2 - 0.22574955908289*G0_1_0 - 0.451499118165784*G0_1_1 - 0.0902998236331555*G0_1_2 - 0.2031746031746*G0_2_0 - 0.361199294532626*G0_2_1 - 0.135449735449733*G0_2_2;
+    A[1119] = -0.0902998236331544*G0_0_0 - 0.22574955908289*G0_0_1 - 0.406349206349205*G0_0_2 - 0.225749559082891*G0_1_0 - 0.0902998236331553*G0_1_1 - 0.406349206349205*G0_1_2 - 0.406349206349204*G0_2_0 - 0.406349206349205*G0_2_1 - 0.722398589065255*G0_2_2;
+    A[1120] = -0.0253968253968251*G0_0_0 - 0.0253968253968249*G0_0_1 - 0.025396825396825*G0_0_2 - 0.0253968253968249*G0_1_0 - 0.025396825396825*G0_1_1 - 0.025396825396825*G0_1_2 - 0.0183421516754846*G0_2_0 - 0.0183421516754847*G0_2_1 - 0.0183421516754847*G0_2_2;
+    A[1121] = 0.0423280423280425*G0_0_0 - 0.00705467372134006*G0_2_0;
+    A[1122] = -0.0253968253968255*G0_1_1 - 0.00705467372134062*G0_2_1;
     A[1123] = 0.0183421516754849*G0_2_2;
-    A[1124] = 0.0451499118165788*G0_1_1 + 0.033862433862434*G0_1_2 + 0.0338624338624337*G0_2_1 + 0.0225749559082885*G0_2_2;
-    A[1125] = 0.0225749559082895*G0_1_1 + 0.019753086419753*G0_1_2 + 0.0197530864197532*G0_2_1 + 0.0169312169312171*G0_2_2;
-    A[1126] = -0.0112874779541441*G0_1_2 - 0.0112874779541451*G0_2_1 - 0.02257495590829*G0_2_2;
-    A[1127] = -0.135449735449735*G0_0_0 - 0.101587301587302*G0_0_2 - 0.101587301587301*G0_2_0 - 0.112874779541446*G0_2_2;
-    A[1128] = 0.0225749559082895*G0_0_0 + 0.0423280423280424*G0_0_2 + 0.0423280423280424*G0_2_0 + 0.084656084656084*G0_2_2;
-    A[1129] = -0.0112874779541445*G0_0_2 - 0.0112874779541451*G0_2_0 - 0.0677248677248674*G0_2_2;
-    A[1130] = -0.270899470899471*G0_0_0 - 0.101587301587302*G0_0_1 - 0.101587301587301*G0_1_0 - 0.203174603174603*G0_2_0 - 0.112874779541446*G0_2_1;
-    A[1131] = 0.0677248677248683*G0_0_0 - 0.0931216931216923*G0_0_1 - 0.093121693121693*G0_1_0 - 0.270899470899471*G0_1_1 - 0.0507936507936504*G0_2_0 - 0.186243386243387*G0_2_1;
-    A[1132] = 0.0338624338624335*G0_0_1 + 0.0338624338624344*G0_1_0 + 0.135449735449736*G0_1_1 + 0.022574955908289*G0_2_0 + 0.067724867724868*G0_2_1;
-    A[1133] = 0.0451499118165786*G0_0_0 + 0.0451499118165787*G0_0_1 + 0.0112874779541443*G0_0_2 + 0.0451499118165783*G0_1_0 + 0.0451499118165784*G0_1_1 + 0.0112874779541448*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0112874779541447*G0_2_1;
-    A[1134] = 0.0225749559082894*G0_0_0 + 0.0225749559082893*G0_0_1 + 0.00282186948853635*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0225749559082893*G0_1_1 + 0.00282186948853564*G0_1_2 + 0.00282186948853573*G0_2_0 + 0.00282186948853567*G0_2_1;
+    A[1124] = 0.045149911816579*G0_1_1 + 0.0338624338624342*G0_1_2 + 0.0338624338624337*G0_2_1 + 0.0225749559082885*G0_2_2;
+    A[1125] = 0.0225749559082893*G0_1_1 + 0.0197530864197529*G0_1_2 + 0.0197530864197531*G0_2_1 + 0.016931216931217*G0_2_2;
+    A[1126] = -0.0112874779541441*G0_1_2 - 0.0112874779541451*G0_2_1 - 0.0225749559082899*G0_2_2;
+    A[1127] = -0.135449735449735*G0_0_0 - 0.101587301587301*G0_0_2 - 0.101587301587301*G0_2_0 - 0.112874779541446*G0_2_2;
+    A[1128] = 0.0225749559082894*G0_0_0 + 0.0423280423280421*G0_0_2 + 0.0423280423280423*G0_2_0 + 0.084656084656084*G0_2_2;
+    A[1129] = -0.0112874779541445*G0_0_2 - 0.011287477954145*G0_2_0 - 0.0677248677248674*G0_2_2;
+    A[1130] = -0.27089947089947*G0_0_0 - 0.101587301587301*G0_0_1 - 0.1015873015873*G0_1_0 - 0.203174603174603*G0_2_0 - 0.112874779541446*G0_2_1;
+    A[1131] = 0.067724867724868*G0_0_0 - 0.0931216931216921*G0_0_1 - 0.0931216931216931*G0_1_0 - 0.270899470899471*G0_1_1 - 0.0507936507936504*G0_2_0 - 0.186243386243386*G0_2_1;
+    A[1132] = 0.0338624338624336*G0_0_1 + 0.0338624338624345*G0_1_0 + 0.135449735449736*G0_1_1 + 0.022574955908289*G0_2_0 + 0.0677248677248679*G0_2_1;
+    A[1133] = 0.0451499118165785*G0_0_0 + 0.0451499118165785*G0_0_1 + 0.011287477954144*G0_0_2 + 0.0451499118165782*G0_1_0 + 0.0451499118165783*G0_1_1 + 0.0112874779541447*G0_1_2 + 0.0112874779541444*G0_2_0 + 0.0112874779541445*G0_2_1;
+    A[1134] = 0.0225749559082893*G0_0_0 + 0.0225749559082893*G0_0_1 + 0.00282186948853638*G0_0_2 + 0.0225749559082894*G0_1_0 + 0.0225749559082893*G0_1_1 + 0.0028218694885357*G0_1_2 + 0.00282186948853572*G0_2_0 + 0.00282186948853566*G0_2_1;
     A[1135] = 0.0112874779541443*G0_0_2 + 0.0112874779541448*G0_1_2 + 0.011287477954145*G0_2_0 + 0.0112874779541451*G0_2_1;
-    A[1136] = 0.0902998236331577*G0_0_0 + 0.0564373897707229*G0_0_1 + 0.0902998236331576*G0_0_2 + 0.0564373897707222*G0_1_0 + 0.0225749559082889*G0_1_1 + 0.0564373897707226*G0_1_2 + 0.0225749559082889*G0_2_0 + 0.011287477954144*G0_2_1 + 0.022574955908289*G0_2_2;
-    A[1137] = 0.0677248677248671*G0_0_0 + 0.002821869488536*G0_0_1 + 0.0677248677248672*G0_0_2 + 0.00282186948853679*G0_1_0 + 0.00564373897707211*G0_1_1 + 0.00282186948853646*G0_1_2 - 0.0169312169312167*G0_2_0 + 0.00282186948853627*G0_2_1 - 0.0169312169312171*G0_2_2;
-    A[1138] = -0.0338624338624337*G0_0_1 - 0.0338624338624344*G0_1_0 + 0.0225749559082897*G0_1_1 - 0.0338624338624342*G0_1_2 - 0.0225749559082891*G0_2_0 + 0.011287477954145*G0_2_1 - 0.022574955908289*G0_2_2;
-    A[1139] = 0.0677248677248669*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.101587301587301*G0_1_0 + 0.135449735449734*G0_1_1 + 0.135449735449734*G0_1_2 + 0.056437389770722*G0_2_0 + 0.0677248677248672*G0_2_1 + 0.0677248677248671*G0_2_2;
-    A[1140] = -0.0169312169312154*G0_0_0 - 0.177777777777777*G0_0_1 - 0.177777777777777*G0_0_2 - 0.177777777777777*G0_1_0 - 0.27089947089947*G0_1_1 - 0.27089947089947*G0_1_2 - 0.0423280423280407*G0_2_0 - 0.0846560846560837*G0_2_1 - 0.0846560846560837*G0_2_2;
-    A[1141] = -0.0677248677248686*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587302*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0112874779541436*G0_2_0 + 0.112874779541446*G0_2_1 + 0.112874779541446*G0_2_2;
-    A[1142] = 0.0451499118165794*G0_0_0 - 0.135449735449735*G0_0_1 - 0.27089947089947*G0_0_2 - 0.135449735449735*G0_1_0 - 0.27089947089947*G0_1_2 - 0.270899470899471*G0_2_0 - 0.270899470899471*G0_2_1 - 0.541798941798943*G0_2_2;
-    A[1143] = 0.0451499118165786*G0_0_1 + 0.0677248677248675*G0_0_2 + 0.0451499118165798*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0677248677248665*G0_1_2 + 0.0677248677248677*G0_2_0 - 0.0677248677248677*G0_2_1;
-    A[1144] = 0.022574955908289*G0_0_1 + 0.0451499118165782*G0_0_2 + 0.0225749559082897*G0_1_0 + 0.0677248677248685*G0_1_2 + 0.0451499118165776*G0_2_0 + 0.0677248677248668*G0_2_1 + 0.135449735449735*G0_2_2;
-    A[1145] = 0.0451499118165788*G0_0_0 - 0.0451499118165791*G0_0_2 - 0.0451499118165785*G0_1_1 - 0.0225749559082894*G0_1_2 - 0.0451499118165785*G0_2_0 - 0.0225749559082898*G0_2_1;
-    A[1146] = -0.0451499118165778*G0_0_1 - 0.0677248677248675*G0_0_2 - 0.0451499118165799*G0_1_0 - 0.0451499118165787*G0_1_1 - 0.0225749559082894*G0_1_2 - 0.0677248677248678*G0_2_0 - 0.0225749559082887*G0_2_1;
-    A[1147] = -0.0225749559082894*G0_0_1 - 0.0451499118165779*G0_0_2 - 0.0225749559082897*G0_1_0 - 0.0451499118165788*G0_1_1 - 0.0225749559082892*G0_1_2 - 0.0451499118165777*G0_2_0 - 0.0225749559082888*G0_2_1;
-    A[1148] = -0.225749559082892*G0_0_0 - 0.180599647266313*G0_0_1 - 0.0451499118165776*G0_0_2 - 0.180599647266314*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0677248677248664*G0_1_2 - 0.0451499118165778*G0_2_0 - 0.0677248677248669*G0_2_1;
-    A[1149] = 0.316049382716049*G0_0_0 + 0.135449735449735*G0_0_1 + 0.135449735449734*G0_0_2 + 0.135449735449735*G0_1_0 + 0.27089947089947*G0_1_2 + 0.135449735449735*G0_2_0 + 0.270899470899471*G0_2_1;
-    A[1150] = -0.045149911816579*G0_0_0 - 0.0225749559082891*G0_0_1 - 0.0451499118165787*G0_0_2 - 0.0225749559082893*G0_1_0 - 0.0677248677248683*G0_1_2 - 0.0451499118165783*G0_2_0 - 0.0677248677248673*G0_2_1;
-    A[1151] = -0.451499118165785*G0_0_0 - 0.225749559082891*G0_0_1 - 0.361199294532627*G0_0_2 - 0.225749559082891*G0_1_0 - 0.135449735449733*G0_1_1 - 0.203174603174602*G0_1_2 - 0.0902998236331553*G0_2_0 - 0.0677248677248661*G0_2_1 - 0.135449735449734*G0_2_2;
-    A[1152] = 0.632098765432098*G0_0_0 + 0.27089947089947*G0_0_1 + 0.27089947089947*G0_0_2 + 0.27089947089947*G0_1_0 + 0.541798941798942*G0_1_1 + 0.27089947089947*G0_1_2 + 0.27089947089947*G0_2_0 + 0.27089947089947*G0_2_1 + 0.541798941798942*G0_2_2;
-    A[1153] = -0.135449735449736*G0_0_0 + 0.0902998236331567*G0_0_1 - 0.0677248677248676*G0_0_2 + 0.0902998236331562*G0_1_0 - 0.135449735449737*G0_1_1 + 0.0677248677248661*G0_1_2 + 0.067724867724867*G0_2_0 - 0.0677248677248685*G0_2_1;
-    A[1154] = -0.0902998236331579*G0_0_0 + 0.135449735449734*G0_0_1 + 0.316049382716048*G0_0_2 + 0.135449735449734*G0_1_0 + 0.270899470899469*G0_1_1 + 0.135449735449734*G0_1_2 + 0.31604938271605*G0_2_0 + 0.135449735449734*G0_2_1;
-    A[1155] = -0.0253968253968248*G0_0_0 - 0.0253968253968251*G0_0_1 - 0.025396825396825*G0_0_2 - 0.0253968253968251*G0_1_0 - 0.0253968253968253*G0_1_1 - 0.0253968253968253*G0_1_2 - 0.0183421516754847*G0_2_0 - 0.0183421516754848*G0_2_1 - 0.0183421516754848*G0_2_2;
-    A[1156] = -0.0253968253968252*G0_0_0 - 0.00705467372134023*G0_2_0;
-    A[1157] = 0.0423280423280425*G0_1_1 - 0.00705467372134018*G0_2_1;
+    A[1136] = 0.0902998236331573*G0_0_0 + 0.0564373897707226*G0_0_1 + 0.0902998236331573*G0_0_2 + 0.0564373897707221*G0_1_0 + 0.0225749559082888*G0_1_1 + 0.0564373897707224*G0_1_2 + 0.0225749559082887*G0_2_0 + 0.0112874779541438*G0_2_1 + 0.0225749559082889*G0_2_2;
+    A[1137] = 0.0677248677248672*G0_0_0 + 0.0028218694885363*G0_0_1 + 0.0677248677248674*G0_0_2 + 0.00282186948853685*G0_1_0 + 0.00564373897707202*G0_1_1 + 0.00282186948853649*G0_1_2 - 0.0169312169312167*G0_2_0 + 0.00282186948853636*G0_2_1 - 0.0169312169312172*G0_2_2;
+    A[1138] = -0.033862433862434*G0_0_1 - 0.0338624338624346*G0_1_0 + 0.0225749559082897*G0_1_1 - 0.0338624338624343*G0_1_2 - 0.0225749559082891*G0_2_0 + 0.0112874779541449*G0_2_1 - 0.022574955908289*G0_2_2;
+    A[1139] = 0.0677248677248665*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.1015873015873*G0_1_0 + 0.135449735449734*G0_1_1 + 0.135449735449734*G0_1_2 + 0.0564373897707216*G0_2_0 + 0.067724867724867*G0_2_1 + 0.0677248677248669*G0_2_2;
+    A[1140] = -0.0169312169312152*G0_0_0 - 0.177777777777777*G0_0_1 - 0.177777777777777*G0_0_2 - 0.177777777777777*G0_1_0 - 0.27089947089947*G0_1_1 - 0.27089947089947*G0_1_2 - 0.0423280423280406*G0_2_0 - 0.0846560846560836*G0_2_1 - 0.0846560846560836*G0_2_2;
+    A[1141] = -0.0677248677248687*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587301*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0112874779541436*G0_2_0 + 0.112874779541446*G0_2_1 + 0.112874779541446*G0_2_2;
+    A[1142] = 0.0451499118165795*G0_0_0 - 0.135449735449735*G0_0_1 - 0.270899470899469*G0_0_2 - 0.135449735449735*G0_1_0 - 0.270899470899469*G0_1_2 - 0.270899470899471*G0_2_0 - 0.270899470899471*G0_2_1 - 0.541798941798943*G0_2_2;
+    A[1143] = 0.0451499118165786*G0_0_1 + 0.0677248677248676*G0_0_2 + 0.0451499118165798*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0677248677248666*G0_1_2 + 0.0677248677248677*G0_2_0 - 0.0677248677248675*G0_2_1;
+    A[1144] = 0.0225749559082889*G0_0_1 + 0.0451499118165778*G0_0_2 + 0.0225749559082896*G0_1_0 + 0.0677248677248681*G0_1_2 + 0.0451499118165775*G0_2_0 + 0.0677248677248667*G0_2_1 + 0.135449735449735*G0_2_2;
+    A[1145] = 0.0451499118165787*G0_0_0 - 0.0451499118165789*G0_0_2 - 0.0451499118165784*G0_1_1 - 0.0225749559082894*G0_1_2 - 0.0451499118165784*G0_2_0 - 0.0225749559082897*G0_2_1;
+    A[1146] = -0.045149911816578*G0_0_1 - 0.0677248677248674*G0_0_2 - 0.0451499118165799*G0_1_0 - 0.045149911816579*G0_1_1 - 0.0225749559082894*G0_1_2 - 0.0677248677248677*G0_2_0 - 0.0225749559082888*G0_2_1;
+    A[1147] = -0.0225749559082892*G0_0_1 - 0.0451499118165779*G0_0_2 - 0.0225749559082896*G0_1_0 - 0.0451499118165787*G0_1_1 - 0.022574955908289*G0_1_2 - 0.0451499118165776*G0_2_0 - 0.0225749559082887*G0_2_1;
+    A[1148] = -0.225749559082891*G0_0_0 - 0.180599647266313*G0_0_1 - 0.0451499118165775*G0_0_2 - 0.180599647266314*G0_1_0 - 0.135449735449735*G0_1_1 - 0.0677248677248663*G0_1_2 - 0.0451499118165774*G0_2_0 - 0.0677248677248665*G0_2_1;
+    A[1149] = 0.316049382716048*G0_0_0 + 0.135449735449735*G0_0_1 + 0.135449735449734*G0_0_2 + 0.135449735449734*G0_1_0 + 0.27089947089947*G0_1_2 + 0.135449735449734*G0_2_0 + 0.270899470899471*G0_2_1;
+    A[1150] = -0.0451499118165787*G0_0_0 - 0.0225749559082889*G0_0_1 - 0.0451499118165784*G0_0_2 - 0.0225749559082892*G0_1_0 - 0.0677248677248682*G0_1_2 - 0.0451499118165782*G0_2_0 - 0.0677248677248672*G0_2_1;
+    A[1151] = -0.451499118165784*G0_0_0 - 0.225749559082891*G0_0_1 - 0.361199294532627*G0_0_2 - 0.22574955908289*G0_1_0 - 0.135449735449733*G0_1_1 - 0.203174603174602*G0_1_2 - 0.0902998236331546*G0_2_0 - 0.0677248677248656*G0_2_1 - 0.135449735449734*G0_2_2;
+    A[1152] = 0.632098765432097*G0_0_0 + 0.270899470899469*G0_0_1 + 0.270899470899469*G0_0_2 + 0.270899470899469*G0_1_0 + 0.541798941798941*G0_1_1 + 0.270899470899469*G0_1_2 + 0.270899470899469*G0_2_0 + 0.270899470899469*G0_2_1 + 0.541798941798942*G0_2_2;
+    A[1153] = -0.135449735449735*G0_0_0 + 0.0902998236331567*G0_0_1 - 0.0677248677248676*G0_0_2 + 0.0902998236331563*G0_1_0 - 0.135449735449738*G0_1_1 + 0.0677248677248661*G0_1_2 + 0.067724867724867*G0_2_0 - 0.0677248677248685*G0_2_1;
+    A[1154] = -0.090299823633158*G0_0_0 + 0.135449735449734*G0_0_1 + 0.316049382716048*G0_0_2 + 0.135449735449734*G0_1_0 + 0.27089947089947*G0_1_1 + 0.135449735449734*G0_1_2 + 0.316049382716049*G0_2_0 + 0.135449735449734*G0_2_1;
+    A[1155] = -0.0253968253968248*G0_0_0 - 0.0253968253968251*G0_0_1 - 0.025396825396825*G0_0_2 - 0.0253968253968251*G0_1_0 - 0.0253968253968253*G0_1_1 - 0.0253968253968252*G0_1_2 - 0.0183421516754847*G0_2_0 - 0.0183421516754848*G0_2_1 - 0.0183421516754848*G0_2_2;
+    A[1156] = -0.0253968253968252*G0_0_0 - 0.00705467372134024*G0_2_0;
+    A[1157] = 0.0423280423280425*G0_1_1 - 0.00705467372134016*G0_2_1;
     A[1158] = 0.018342151675485*G0_2_2;
     A[1159] = -0.135449735449736*G0_1_1 - 0.101587301587301*G0_1_2 - 0.101587301587302*G0_2_1 - 0.112874779541445*G0_2_2;
-    A[1160] = 0.0225749559082893*G0_1_1 + 0.0423280423280423*G0_1_2 + 0.0423280423280423*G0_2_1 + 0.0846560846560838*G0_2_2;
-    A[1161] = -0.0112874779541446*G0_1_2 - 0.0112874779541448*G0_2_1 - 0.067724867724867*G0_2_2;
+    A[1160] = 0.0225749559082893*G0_1_1 + 0.0423280423280424*G0_1_2 + 0.0423280423280422*G0_2_1 + 0.0846560846560837*G0_2_2;
+    A[1161] = -0.0112874779541446*G0_1_2 - 0.0112874779541447*G0_2_1 - 0.0677248677248669*G0_2_2;
     A[1162] = 0.0451499118165783*G0_0_0 + 0.0338624338624338*G0_0_2 + 0.0338624338624333*G0_2_0 + 0.0225749559082892*G0_2_2;
-    A[1163] = 0.0225749559082893*G0_0_0 + 0.0197530864197531*G0_0_2 + 0.0197530864197538*G0_2_0 + 0.0169312169312171*G0_2_2;
-    A[1164] = -0.0112874779541446*G0_0_2 - 0.0112874779541447*G0_2_0 - 0.0225749559082891*G0_2_2;
-    A[1165] = 0.135449735449734*G0_0_0 + 0.0338624338624333*G0_0_1 + 0.033862433862433*G0_1_0 + 0.0677248677248668*G0_2_0 + 0.0225749559082885*G0_2_1;
-    A[1166] = -0.270899470899469*G0_0_0 - 0.0931216931216917*G0_0_1 - 0.0931216931216907*G0_1_0 + 0.0677248677248699*G0_1_1 - 0.186243386243384*G0_2_0 - 0.0507936507936492*G0_2_1;
+    A[1163] = 0.0225749559082893*G0_0_0 + 0.0197530864197532*G0_0_2 + 0.0197530864197538*G0_2_0 + 0.016931216931217*G0_2_2;
+    A[1164] = -0.0112874779541446*G0_0_2 - 0.0112874779541446*G0_2_0 - 0.022574955908289*G0_2_2;
+    A[1165] = 0.135449735449734*G0_0_0 + 0.0338624338624332*G0_0_1 + 0.033862433862433*G0_1_0 + 0.0677248677248667*G0_2_0 + 0.0225749559082884*G0_2_1;
+    A[1166] = -0.270899470899469*G0_0_0 - 0.0931216931216915*G0_0_1 - 0.0931216931216906*G0_1_0 + 0.0677248677248701*G0_1_1 - 0.186243386243384*G0_2_0 - 0.050793650793649*G0_2_1;
     A[1167] = -0.101587301587301*G0_0_1 - 0.101587301587303*G0_1_0 - 0.270899470899472*G0_1_1 - 0.112874779541447*G0_2_0 - 0.203174603174604*G0_2_1;
-    A[1168] = 0.0451499118165783*G0_0_0 + 0.0451499118165784*G0_0_1 + 0.0112874779541446*G0_0_2 + 0.0451499118165782*G0_1_0 + 0.0451499118165782*G0_1_1 + 0.0112874779541445*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541445*G0_2_1;
-    A[1169] = 0.0225749559082891*G0_0_0 + 0.0225749559082892*G0_0_1 + 0.00282186948853605*G0_0_2 + 0.0225749559082896*G0_1_0 + 0.0225749559082896*G0_1_1 + 0.00282186948853637*G0_1_2 + 0.00282186948853636*G0_2_0 + 0.00282186948853613*G0_2_1;
-    A[1170] = 0.0112874779541447*G0_0_2 + 0.0112874779541443*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541447*G0_2_1;
-    A[1171] = 0.135449735449734*G0_0_0 + 0.101587301587301*G0_0_1 + 0.135449735449734*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0677248677248675*G0_1_1 + 0.101587301587301*G0_1_2 + 0.0677248677248669*G0_2_0 + 0.0564373897707225*G0_2_1 + 0.0677248677248668*G0_2_2;
-    A[1172] = -0.270899470899469*G0_0_0 - 0.177777777777777*G0_0_1 - 0.27089947089947*G0_0_2 - 0.177777777777777*G0_1_0 - 0.0169312169312167*G0_1_1 - 0.177777777777777*G0_1_2 - 0.0846560846560842*G0_2_0 - 0.0423280423280419*G0_2_1 - 0.0846560846560837*G0_2_2;
+    A[1168] = 0.0451499118165783*G0_0_0 + 0.0451499118165784*G0_0_1 + 0.0112874779541446*G0_0_2 + 0.0451499118165783*G0_1_0 + 0.0451499118165782*G0_1_1 + 0.0112874779541444*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541445*G0_2_1;
+    A[1169] = 0.0225749559082892*G0_0_0 + 0.0225749559082892*G0_0_1 + 0.00282186948853608*G0_0_2 + 0.0225749559082895*G0_1_0 + 0.0225749559082896*G0_1_1 + 0.00282186948853655*G0_1_2 + 0.00282186948853635*G0_2_0 + 0.00282186948853615*G0_2_1;
+    A[1170] = 0.0112874779541446*G0_0_2 + 0.0112874779541442*G0_1_2 + 0.0112874779541446*G0_2_0 + 0.0112874779541447*G0_2_1;
+    A[1171] = 0.135449735449734*G0_0_0 + 0.101587301587301*G0_0_1 + 0.135449735449734*G0_0_2 + 0.101587301587301*G0_1_0 + 0.0677248677248674*G0_1_1 + 0.101587301587301*G0_1_2 + 0.067724867724867*G0_2_0 + 0.0564373897707225*G0_2_1 + 0.0677248677248668*G0_2_2;
+    A[1172] = -0.270899470899469*G0_0_0 - 0.177777777777778*G0_0_1 - 0.27089947089947*G0_0_2 - 0.177777777777778*G0_1_0 - 0.0169312169312167*G0_1_1 - 0.177777777777777*G0_1_2 - 0.0846560846560842*G0_2_0 - 0.0423280423280419*G0_2_1 - 0.0846560846560836*G0_2_2;
     A[1173] = 0.101587301587302*G0_0_1 + 0.101587301587303*G0_1_0 - 0.0677248677248677*G0_1_1 + 0.101587301587302*G0_1_2 + 0.112874779541447*G0_2_0 + 0.0112874779541448*G0_2_1 + 0.112874779541447*G0_2_2;
-    A[1174] = 0.0225749559082886*G0_0_0 + 0.0564373897707226*G0_0_1 + 0.0564373897707226*G0_0_2 + 0.056437389770723*G0_1_0 + 0.0902998236331568*G0_1_1 + 0.0902998236331568*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0225749559082889*G0_2_1 + 0.0225749559082886*G0_2_2;
-    A[1175] = 0.00564373897707208*G0_0_0 + 0.00282186948853619*G0_0_1 + 0.00282186948853614*G0_0_2 + 0.00282186948853585*G0_1_0 + 0.0677248677248684*G0_1_1 + 0.0677248677248683*G0_1_2 + 0.00282186948853573*G0_2_0 - 0.0169312169312167*G0_2_1 - 0.0169312169312171*G0_2_2;
-    A[1176] = 0.0225749559082893*G0_0_0 - 0.0338624338624337*G0_0_1 - 0.0338624338624336*G0_0_2 - 0.0338624338624341*G0_1_0 + 0.0112874779541446*G0_2_0 - 0.0225749559082885*G0_2_1 - 0.022574955908289*G0_2_2;
-    A[1177] = -0.135449735449734*G0_0_0 + 0.0451499118165787*G0_0_1 - 0.0677248677248672*G0_0_2 + 0.04514991181658*G0_1_0 + 0.0677248677248689*G0_1_2 - 0.0677248677248653*G0_2_0 + 0.067724867724868*G0_2_1;
-    A[1178] = -0.135449735449735*G0_0_1 - 0.270899470899469*G0_0_2 - 0.135449735449736*G0_1_0 + 0.0451499118165798*G0_1_1 - 0.27089947089947*G0_1_2 - 0.270899470899472*G0_2_0 - 0.27089947089947*G0_2_1 - 0.541798941798942*G0_2_2;
-    A[1179] = 0.0225749559082894*G0_0_1 + 0.0677248677248677*G0_0_2 + 0.022574955908289*G0_1_0 + 0.0451499118165785*G0_1_2 + 0.0677248677248677*G0_2_0 + 0.0451499118165793*G0_2_1 + 0.135449735449736*G0_2_2;
-    A[1180] = -0.135449735449734*G0_0_0 - 0.180599647266313*G0_0_1 - 0.0677248677248671*G0_0_2 - 0.180599647266313*G0_1_0 - 0.225749559082892*G0_1_1 - 0.0451499118165775*G0_1_2 - 0.067724867724867*G0_2_0 - 0.0451499118165781*G0_2_1;
+    A[1174] = 0.0225749559082887*G0_0_0 + 0.0564373897707226*G0_0_1 + 0.0564373897707226*G0_0_2 + 0.0564373897707231*G0_1_0 + 0.0902998236331569*G0_1_1 + 0.0902998236331568*G0_1_2 + 0.0112874779541445*G0_2_0 + 0.0225749559082889*G0_2_1 + 0.0225749559082886*G0_2_2;
+    A[1175] = 0.00564373897707198*G0_0_0 + 0.0028218694885363*G0_0_1 + 0.00282186948853624*G0_0_2 + 0.00282186948853583*G0_1_0 + 0.0677248677248686*G0_1_1 + 0.0677248677248683*G0_1_2 + 0.00282186948853569*G0_2_0 - 0.0169312169312167*G0_2_1 - 0.0169312169312171*G0_2_2;
+    A[1176] = 0.0225749559082893*G0_0_0 - 0.0338624338624338*G0_0_1 - 0.0338624338624337*G0_0_2 - 0.033862433862434*G0_1_0 + 0.0112874779541447*G0_2_0 - 0.0225749559082885*G0_2_1 - 0.022574955908289*G0_2_2;
+    A[1177] = -0.135449735449734*G0_0_0 + 0.0451499118165787*G0_0_1 - 0.0677248677248672*G0_0_2 + 0.0451499118165801*G0_1_0 + 0.067724867724869*G0_1_2 - 0.0677248677248653*G0_2_0 + 0.0677248677248679*G0_2_1;
+    A[1178] = -0.135449735449734*G0_0_1 - 0.270899470899469*G0_0_2 - 0.135449735449736*G0_1_0 + 0.0451499118165799*G0_1_1 - 0.27089947089947*G0_1_2 - 0.270899470899472*G0_2_0 - 0.27089947089947*G0_2_1 - 0.541798941798942*G0_2_2;
+    A[1179] = 0.0225749559082894*G0_0_1 + 0.0677248677248678*G0_0_2 + 0.0225749559082891*G0_1_0 + 0.0451499118165784*G0_1_2 + 0.0677248677248677*G0_2_0 + 0.0451499118165794*G0_2_1 + 0.135449735449736*G0_2_2;
+    A[1180] = -0.135449735449734*G0_0_0 - 0.180599647266313*G0_0_1 - 0.0677248677248672*G0_0_2 - 0.180599647266313*G0_1_0 - 0.225749559082892*G0_1_1 - 0.0451499118165776*G0_1_2 - 0.067724867724867*G0_2_0 - 0.0451499118165782*G0_2_1;
     A[1181] = 0.135449735449734*G0_0_1 + 0.27089947089947*G0_0_2 + 0.135449735449736*G0_1_0 + 0.31604938271605*G0_1_1 + 0.135449735449734*G0_1_2 + 0.270899470899472*G0_2_0 + 0.135449735449736*G0_2_1;
-    A[1182] = -0.0225749559082891*G0_0_1 - 0.0677248677248681*G0_0_2 - 0.0225749559082891*G0_1_0 - 0.0451499118165789*G0_1_1 - 0.0451499118165785*G0_1_2 - 0.0677248677248678*G0_2_0 - 0.0451499118165784*G0_2_1;
-    A[1183] = -0.0451499118165783*G0_0_0 - 0.0225749559082891*G0_0_2 + 0.0451499118165798*G0_1_1 - 0.0451499118165782*G0_1_2 - 0.0225749559082889*G0_2_0 - 0.0451499118165771*G0_2_1;
-    A[1184] = -0.0451499118165784*G0_0_0 - 0.0451499118165786*G0_0_1 - 0.0225749559082895*G0_0_2 - 0.0451499118165785*G0_1_0 - 0.0677248677248681*G0_1_2 - 0.0225749559082891*G0_2_0 - 0.0677248677248677*G0_2_1;
-    A[1185] = -0.0451499118165785*G0_0_0 - 0.0225749559082893*G0_0_1 - 0.0225749559082892*G0_0_2 - 0.0225749559082898*G0_1_0 - 0.0451499118165783*G0_1_2 - 0.02257495590829*G0_2_0 - 0.0451499118165794*G0_2_1;
-    A[1186] = -0.135449735449733*G0_0_0 - 0.22574955908289*G0_0_1 - 0.2031746031746*G0_0_2 - 0.22574955908289*G0_1_0 - 0.451499118165784*G0_1_1 - 0.361199294532626*G0_1_2 - 0.067724867724866*G0_2_0 - 0.0902998236331554*G0_2_1 - 0.135449735449733*G0_2_2;
-    A[1187] = -0.135449735449735*G0_0_0 + 0.0902998236331562*G0_0_1 + 0.067724867724867*G0_0_2 + 0.0902998236331567*G0_1_0 - 0.135449735449737*G0_1_1 - 0.0677248677248686*G0_1_2 - 0.0677248677248676*G0_2_0 + 0.0677248677248661*G0_2_1;
-    A[1188] = 0.541798941798938*G0_0_0 + 0.270899470899468*G0_0_1 + 0.270899470899468*G0_0_2 + 0.270899470899468*G0_1_0 + 0.632098765432098*G0_1_1 + 0.27089947089947*G0_1_2 + 0.270899470899468*G0_2_0 + 0.27089947089947*G0_2_1 + 0.541798941798941*G0_2_2;
-    A[1189] = 0.270899470899468*G0_0_0 + 0.135449735449734*G0_0_1 + 0.135449735449733*G0_0_2 + 0.135449735449733*G0_1_0 - 0.0902998236331599*G0_1_1 + 0.316049382716047*G0_1_2 + 0.135449735449732*G0_2_0 + 0.316049382716046*G0_2_1;
-    A[1190] = -0.0677248677248667*G0_0_0 - 0.067724867724867*G0_0_1 - 0.0677248677248671*G0_0_2 - 0.0677248677248671*G0_1_0 - 0.0677248677248671*G0_1_1 - 0.0677248677248672*G0_1_2 - 0.0677248677248672*G0_2_0 - 0.0677248677248673*G0_2_1 - 0.0677248677248674*G0_2_2;
+    A[1182] = -0.0225749559082891*G0_0_1 - 0.0677248677248681*G0_0_2 - 0.0225749559082891*G0_1_0 - 0.045149911816579*G0_1_1 - 0.0451499118165786*G0_1_2 - 0.0677248677248678*G0_2_0 - 0.0451499118165783*G0_2_1;
+    A[1183] = -0.0451499118165784*G0_0_0 - 0.0225749559082891*G0_0_2 + 0.0451499118165799*G0_1_1 - 0.0451499118165784*G0_1_2 - 0.022574955908289*G0_2_0 - 0.045149911816577*G0_2_1;
+    A[1184] = -0.0451499118165784*G0_0_0 - 0.0451499118165786*G0_0_1 - 0.0225749559082895*G0_0_2 - 0.0451499118165787*G0_1_0 - 0.0677248677248682*G0_1_2 - 0.022574955908289*G0_2_0 - 0.0677248677248676*G0_2_1;
+    A[1185] = -0.0451499118165785*G0_0_0 - 0.0225749559082893*G0_0_1 - 0.0225749559082892*G0_0_2 - 0.0225749559082896*G0_1_0 - 0.0451499118165783*G0_1_2 - 0.02257495590829*G0_2_0 - 0.0451499118165795*G0_2_1;
+    A[1186] = -0.135449735449733*G0_0_0 - 0.22574955908289*G0_0_1 - 0.2031746031746*G0_0_2 - 0.22574955908289*G0_1_0 - 0.451499118165784*G0_1_1 - 0.361199294532626*G0_1_2 - 0.067724867724866*G0_2_0 - 0.0902998236331555*G0_2_1 - 0.135449735449733*G0_2_2;
+    A[1187] = -0.135449735449735*G0_0_0 + 0.0902998236331563*G0_0_1 + 0.067724867724867*G0_0_2 + 0.0902998236331567*G0_1_0 - 0.135449735449738*G0_1_1 - 0.0677248677248685*G0_1_2 - 0.0677248677248676*G0_2_0 + 0.0677248677248661*G0_2_1;
+    A[1188] = 0.541798941798938*G0_0_0 + 0.270899470899468*G0_0_1 + 0.270899470899468*G0_0_2 + 0.270899470899468*G0_1_0 + 0.632098765432099*G0_1_1 + 0.27089947089947*G0_1_2 + 0.270899470899468*G0_2_0 + 0.27089947089947*G0_2_1 + 0.541798941798941*G0_2_2;
+    A[1189] = 0.270899470899468*G0_0_0 + 0.135449735449734*G0_0_1 + 0.135449735449734*G0_0_2 + 0.135449735449733*G0_1_0 - 0.0902998236331602*G0_1_1 + 0.316049382716048*G0_1_2 + 0.135449735449732*G0_2_0 + 0.316049382716046*G0_2_1;
+    A[1190] = -0.0677248677248668*G0_0_0 - 0.0677248677248671*G0_0_1 - 0.0677248677248672*G0_0_2 - 0.0677248677248671*G0_1_0 - 0.0677248677248672*G0_1_1 - 0.0677248677248673*G0_1_2 - 0.0677248677248673*G0_2_0 - 0.0677248677248674*G0_2_1 - 0.0677248677248674*G0_2_2;
     A[1191] = -0.0677248677248674*G0_0_0;
-    A[1192] = -0.0677248677248675*G0_1_1;
+    A[1192] = -0.0677248677248676*G0_1_1;
     A[1193] = -0.0677248677248675*G0_2_2;
-    A[1194] = 0.0902998236331579*G0_1_1;
+    A[1194] = 0.0902998236331581*G0_1_1;
     A[1195] = -0.135449735449737*G0_1_1 - 0.112874779541448*G0_1_2 - 0.112874779541447*G0_2_1 - 0.135449735449735*G0_2_2;
-    A[1196] = 0.0902998236331573*G0_2_2;
-    A[1197] = 0.0902998236331573*G0_0_0;
+    A[1196] = 0.0902998236331571*G0_2_2;
+    A[1197] = 0.0902998236331575*G0_0_0;
     A[1198] = -0.135449735449736*G0_0_0 - 0.112874779541447*G0_0_2 - 0.112874779541447*G0_2_0 - 0.135449735449736*G0_2_2;
     A[1199] = 0.0902998236331564*G0_2_2;
-    A[1200] = 0.0902998236331566*G0_0_0;
+    A[1200] = 0.0902998236331568*G0_0_0;
     A[1201] = -0.135449735449734*G0_0_0 - 0.112874779541446*G0_0_1 - 0.112874779541445*G0_1_0 - 0.135449735449735*G0_1_1;
     A[1202] = 0.0902998236331586*G0_1_1;
-    A[1203] = 0.0902998236331557*G0_0_0 + 0.0902998236331563*G0_0_1 + 0.0902998236331557*G0_0_2 + 0.0902998236331562*G0_1_0 + 0.0902998236331565*G0_1_1 + 0.0902998236331562*G0_1_2 + 0.0902998236331567*G0_2_0 + 0.0902998236331571*G0_2_1 + 0.0902998236331564*G0_2_2;
-    A[1204] = -0.135449735449737*G0_0_0 - 0.135449735449737*G0_0_1 - 0.022574955908289*G0_0_2 - 0.135449735449737*G0_1_0 - 0.135449735449737*G0_1_1 - 0.0225749559082888*G0_1_2 - 0.0225749559082905*G0_2_0 - 0.0225749559082905*G0_2_1 - 0.0451499118165787*G0_2_2;
-    A[1205] = 0.0902998236331563*G0_2_2;
-    A[1206] = 0.0902998236331559*G0_0_0 + 0.090299823633156*G0_0_1 + 0.0902998236331567*G0_0_2 + 0.0902998236331563*G0_1_0 + 0.0902998236331561*G0_1_1 + 0.0902998236331565*G0_1_2 + 0.0902998236331565*G0_2_0 + 0.0902998236331565*G0_2_1 + 0.0902998236331573*G0_2_2;
-    A[1207] = -0.135449735449734*G0_0_0 - 0.022574955908289*G0_0_1 - 0.135449735449735*G0_0_2 - 0.0225749559082884*G0_1_0 - 0.045149911816578*G0_1_1 - 0.0225749559082884*G0_1_2 - 0.135449735449735*G0_2_0 - 0.0225749559082895*G0_2_1 - 0.135449735449736*G0_2_2;
-    A[1208] = 0.090299823633157*G0_1_1;
-    A[1209] = 0.0902998236331555*G0_0_0 + 0.0902998236331567*G0_0_1 + 0.0902998236331565*G0_0_2 + 0.0902998236331561*G0_1_0 + 0.0902998236331563*G0_1_1 + 0.0902998236331559*G0_1_2 + 0.0902998236331559*G0_2_0 + 0.0902998236331564*G0_2_1 + 0.0902998236331564*G0_2_2;
-    A[1210] = -0.045149911816578*G0_0_0 - 0.0225749559082886*G0_0_1 - 0.0225749559082887*G0_0_2 - 0.0225749559082889*G0_1_0 - 0.135449735449735*G0_1_1 - 0.135449735449735*G0_1_2 - 0.0225749559082889*G0_2_0 - 0.135449735449735*G0_2_1 - 0.135449735449735*G0_2_2;
+    A[1203] = 0.0902998236331556*G0_0_0 + 0.0902998236331561*G0_0_1 + 0.0902998236331558*G0_0_2 + 0.0902998236331562*G0_1_0 + 0.0902998236331565*G0_1_1 + 0.0902998236331563*G0_1_2 + 0.0902998236331568*G0_2_0 + 0.0902998236331571*G0_2_1 + 0.0902998236331565*G0_2_2;
+    A[1204] = -0.135449735449737*G0_0_0 - 0.135449735449737*G0_0_1 - 0.0225749559082891*G0_0_2 - 0.135449735449737*G0_1_0 - 0.135449735449737*G0_1_1 - 0.0225749559082889*G0_1_2 - 0.0225749559082907*G0_2_0 - 0.0225749559082904*G0_2_1 - 0.0451499118165787*G0_2_2;
+    A[1205] = 0.0902998236331561*G0_2_2;
+    A[1206] = 0.0902998236331558*G0_0_0 + 0.090299823633156*G0_0_1 + 0.0902998236331564*G0_0_2 + 0.0902998236331562*G0_1_0 + 0.0902998236331562*G0_1_1 + 0.0902998236331564*G0_1_2 + 0.0902998236331565*G0_2_0 + 0.0902998236331566*G0_2_1 + 0.0902998236331573*G0_2_2;
+    A[1207] = -0.135449735449734*G0_0_0 - 0.022574955908289*G0_0_1 - 0.135449735449735*G0_0_2 - 0.0225749559082884*G0_1_0 - 0.0451499118165783*G0_1_1 - 0.0225749559082883*G0_1_2 - 0.135449735449735*G0_2_0 - 0.0225749559082896*G0_2_1 - 0.135449735449736*G0_2_2;
+    A[1208] = 0.0902998236331572*G0_1_1;
+    A[1209] = 0.0902998236331556*G0_0_0 + 0.0902998236331565*G0_0_1 + 0.0902998236331563*G0_0_2 + 0.0902998236331561*G0_1_0 + 0.0902998236331562*G0_1_1 + 0.0902998236331558*G0_1_2 + 0.090299823633156*G0_2_0 + 0.0902998236331564*G0_2_1 + 0.0902998236331564*G0_2_2;
+    A[1210] = -0.045149911816578*G0_0_0 - 0.0225749559082884*G0_0_1 - 0.0225749559082885*G0_0_2 - 0.0225749559082888*G0_1_0 - 0.135449735449735*G0_1_1 - 0.135449735449735*G0_1_2 - 0.022574955908289*G0_2_0 - 0.135449735449735*G0_2_1 - 0.135449735449735*G0_2_2;
     A[1211] = 0.0902998236331565*G0_0_0;
-    A[1212] = -0.722398589065256*G0_0_0 - 0.31604938271605*G0_0_1 - 0.316049382716051*G0_0_2 - 0.316049382716047*G0_1_0 - 0.135449735449734*G0_1_2 - 0.316049382716049*G0_2_0 - 0.135449735449735*G0_2_1;
-    A[1213] = -0.316049382716049*G0_0_1 - 0.135449735449734*G0_0_2 - 0.31604938271605*G0_1_0 - 0.722398589065257*G0_1_1 - 0.316049382716048*G0_1_2 - 0.135449735449735*G0_2_0 - 0.316049382716049*G0_2_1;
+    A[1212] = -0.722398589065256*G0_0_0 - 0.316049382716051*G0_0_1 - 0.316049382716051*G0_0_2 - 0.316049382716047*G0_1_0 - 0.135449735449734*G0_1_2 - 0.316049382716049*G0_2_0 - 0.135449735449735*G0_2_1;
+    A[1213] = -0.316049382716048*G0_0_1 - 0.135449735449733*G0_0_2 - 0.31604938271605*G0_1_0 - 0.722398589065258*G0_1_1 - 0.316049382716048*G0_1_2 - 0.135449735449735*G0_2_0 - 0.316049382716049*G0_2_1;
     A[1214] = -0.135449735449736*G0_0_1 - 0.31604938271605*G0_0_2 - 0.135449735449737*G0_1_0 - 0.31604938271605*G0_1_2 - 0.31604938271605*G0_2_0 - 0.31604938271605*G0_2_1 - 0.722398589065257*G0_2_2;
-    A[1215] = -0.722398589065257*G0_0_0 - 0.406349206349207*G0_0_1 - 0.406349206349208*G0_0_2 - 0.406349206349209*G0_1_0 - 0.0902998236331569*G0_1_1 - 0.225749559082894*G0_1_2 - 0.406349206349207*G0_2_0 - 0.225749559082893*G0_2_1 - 0.0902998236331584*G0_2_2;
-    A[1216] = 0.316049382716049*G0_0_1 + 0.135449735449736*G0_0_2 + 0.31604938271605*G0_1_0 - 0.090299823633158*G0_1_1 + 0.135449735449737*G0_1_2 + 0.135449735449735*G0_2_0 + 0.135449735449735*G0_2_1 + 0.270899470899472*G0_2_2;
-    A[1217] = 0.135449735449737*G0_0_1 + 0.31604938271605*G0_0_2 + 0.135449735449737*G0_1_0 + 0.270899470899474*G0_1_1 + 0.135449735449736*G0_1_2 + 0.316049382716049*G0_2_0 + 0.135449735449737*G0_2_1 - 0.0902998236331566*G0_2_2;
-    A[1218] = -0.0902998236331542*G0_0_0 - 0.406349206349206*G0_0_1 - 0.225749559082892*G0_0_2 - 0.406349206349204*G0_1_0 - 0.722398589065256*G0_1_1 - 0.406349206349206*G0_1_2 - 0.225749559082891*G0_2_0 - 0.406349206349206*G0_2_1 - 0.0902998236331568*G0_2_2;
-    A[1219] = -0.0902998236331594*G0_0_0 + 0.31604938271605*G0_0_1 + 0.135449735449734*G0_0_2 + 0.316049382716047*G0_1_0 + 0.135449735449733*G0_1_2 + 0.135449735449734*G0_2_0 + 0.135449735449735*G0_2_1 + 0.270899470899469*G0_2_2;
-    A[1220] = 0.270899470899473*G0_0_0 + 0.135449735449737*G0_0_1 + 0.135449735449737*G0_0_2 + 0.135449735449736*G0_1_0 + 0.316049382716051*G0_1_2 + 0.135449735449737*G0_2_0 + 0.31604938271605*G0_2_1 - 0.0902998236331552*G0_2_2;
-    A[1221] = -0.0902998236331545*G0_0_0 - 0.225749559082891*G0_0_1 - 0.406349206349205*G0_0_2 - 0.225749559082891*G0_1_0 - 0.0902998236331553*G0_1_1 - 0.406349206349205*G0_1_2 - 0.406349206349205*G0_2_0 - 0.406349206349205*G0_2_1 - 0.722398589065255*G0_2_2;
-    A[1222] = -0.0902998236331579*G0_0_0 + 0.135449735449734*G0_0_1 + 0.31604938271605*G0_0_2 + 0.135449735449734*G0_1_0 + 0.270899470899469*G0_1_1 + 0.135449735449734*G0_1_2 + 0.316049382716048*G0_2_0 + 0.135449735449734*G0_2_1;
-    A[1223] = 0.270899470899468*G0_0_0 + 0.135449735449733*G0_0_1 + 0.135449735449732*G0_0_2 + 0.135449735449734*G0_1_0 - 0.0902998236331599*G0_1_1 + 0.316049382716046*G0_1_2 + 0.135449735449733*G0_2_0 + 0.316049382716048*G0_2_1;
-    A[1224] = 1.44479717813051*G0_0_0 + 0.722398589065256*G0_0_1 + 0.722398589065257*G0_0_2 + 0.722398589065256*G0_1_0 + 1.44479717813051*G0_1_1 + 0.722398589065256*G0_1_2 + 0.722398589065257*G0_2_0 + 0.722398589065256*G0_2_1 + 1.44479717813051*G0_2_2;
-}
-
-/// Constructor
+    A[1215] = -0.722398589065257*G0_0_0 - 0.406349206349206*G0_0_1 - 0.406349206349208*G0_0_2 - 0.406349206349209*G0_1_0 - 0.0902998236331568*G0_1_1 - 0.225749559082894*G0_1_2 - 0.406349206349207*G0_2_0 - 0.225749559082893*G0_2_1 - 0.0902998236331584*G0_2_2;
+    A[1216] = 0.316049382716049*G0_0_1 + 0.135449735449736*G0_0_2 + 0.31604938271605*G0_1_0 - 0.0902998236331584*G0_1_1 + 0.135449735449737*G0_1_2 + 0.135449735449735*G0_2_0 + 0.135449735449735*G0_2_1 + 0.270899470899472*G0_2_2;
+    A[1217] = 0.135449735449737*G0_0_1 + 0.31604938271605*G0_0_2 + 0.135449735449737*G0_1_0 + 0.270899470899474*G0_1_1 + 0.135449735449736*G0_1_2 + 0.316049382716049*G0_2_0 + 0.135449735449737*G0_2_1 - 0.0902998236331563*G0_2_2;
+    A[1218] = -0.0902998236331543*G0_0_0 - 0.406349206349206*G0_0_1 - 0.225749559082892*G0_0_2 - 0.406349206349205*G0_1_0 - 0.722398589065257*G0_1_1 - 0.406349206349206*G0_1_2 - 0.225749559082891*G0_2_0 - 0.406349206349206*G0_2_1 - 0.0902998236331568*G0_2_2;
+    A[1219] = -0.0902998236331594*G0_0_0 + 0.31604938271605*G0_0_1 + 0.135449735449734*G0_0_2 + 0.316049382716048*G0_1_0 + 0.135449735449733*G0_1_2 + 0.135449735449733*G0_2_0 + 0.135449735449735*G0_2_1 + 0.270899470899469*G0_2_2;
+    A[1220] = 0.270899470899473*G0_0_0 + 0.135449735449737*G0_0_1 + 0.135449735449737*G0_0_2 + 0.135449735449736*G0_1_0 + 0.316049382716051*G0_1_2 + 0.135449735449737*G0_2_0 + 0.31604938271605*G0_2_1 - 0.0902998236331548*G0_2_2;
+    A[1221] = -0.0902998236331544*G0_0_0 - 0.225749559082891*G0_0_1 - 0.406349206349205*G0_0_2 - 0.22574955908289*G0_1_0 - 0.0902998236331553*G0_1_1 - 0.406349206349205*G0_1_2 - 0.406349206349205*G0_2_0 - 0.406349206349205*G0_2_1 - 0.722398589065255*G0_2_2;
+    A[1222] = -0.090299823633158*G0_0_0 + 0.135449735449734*G0_0_1 + 0.316049382716049*G0_0_2 + 0.135449735449734*G0_1_0 + 0.27089947089947*G0_1_1 + 0.135449735449734*G0_1_2 + 0.316049382716048*G0_2_0 + 0.135449735449734*G0_2_1;
+    A[1223] = 0.270899470899468*G0_0_0 + 0.135449735449733*G0_0_1 + 0.135449735449732*G0_0_2 + 0.135449735449734*G0_1_0 - 0.0902998236331602*G0_1_1 + 0.316049382716046*G0_1_2 + 0.135449735449734*G0_2_0 + 0.316049382716048*G0_2_1;
+    A[1224] = 1.44479717813051*G0_0_0 + 0.722398589065256*G0_0_1 + 0.722398589065257*G0_0_2 + 0.722398589065256*G0_1_0 + 1.44479717813051*G0_1_1 + 0.722398589065256*G0_1_2 + 0.722398589065256*G0_2_0 + 0.722398589065256*G0_2_1 + 1.44479717813051*G0_2_2;
+}
+
+
 poisson3d_4_cell_integral_1_otherwise::poisson3d_4_cell_integral_1_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 poisson3d_4_cell_integral_1_otherwise::~poisson3d_4_cell_integral_1_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & poisson3d_4_cell_integral_1_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void poisson3d_4_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void poisson3d_4_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
@@ -2581,7 +3826,7 @@ void poisson3d_4_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -2666,58 +3911,65 @@ void poisson3d_4_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     A[34] = -0.000538720538720525*G0_0 - 0.000538720538720536*G0_1 - 0.000538720538720533*G0_2 - 0.000538720538720535*G0_3 + 0.00109454331676553*G0_4 - 0.00102613435946768*G0_5 + 0.00109454331676553*G0_6 + 0.00109454331676553*G0_7 - 0.00102613435946769*G0_8 + 0.00109454331676553*G0_9 + 0.00109454331676554*G0_10 - 0.00102613435946768*G0_11 + 0.00109454331676553*G0_12 + 0.00109454331676552*G0_13 - 0.0010261343594677*G0_14 + 0.00109454331676552*G0_15 + 0.00109454331676553*G0_16 - 0.00102613 [...]
 }
 
-/// Constructor
+
 poisson3d_4_form_0::poisson3d_4_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_4_form_0::~poisson3d_4_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson3d_4_form_0::signature() const
+const char * poisson3d_4_form_0::signature() const
 {
-    return "a6c6dc8a093e128f9a0ccaccf37da6f408af0f63bc43b50cebd6e8b16ba023bd5996435145d8a7864a3738b80496b9c66304047d188d6da69b95a776714dd0b0";
+    return "0c6ff9aa78ad4ac2466c1f2e4627e995f5fc20503363e4f15ab3d33215505b47f71a961ffa3570c8a175eeec9f15dff96fc16d22349fd2812c035438a0195537";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson3d_4_form_0::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson3d_4_form_0::num_coefficients() const
 {
     return 0;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson3d_4_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({});
     return position[i];
 }
 
+ufc::finite_element * poisson3d_4_form_0::create_coordinate_finite_element() const
+{
+    return new poisson3d_4_finite_element_1();
+}
+
+ufc::dofmap * poisson3d_4_form_0::create_coordinate_dofmap() const
+{
+    return new poisson3d_4_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson3d_4_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson3d_4_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson3d_4_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_4_finite_element_0();
+        return new poisson3d_4_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_4_finite_element_0();
+        return new poisson3d_4_finite_element_2();
         break;
       }
     }
@@ -2725,19 +3977,18 @@ ufc::finite_element* poisson3d_4_form_0::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson3d_4_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_4_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_4_dofmap_0();
+        return new poisson3d_4_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_4_dofmap_0();
+        return new poisson3d_4_dofmap_2();
         break;
       }
     }
@@ -2745,183 +3996,225 @@ ufc::dofmap* poisson3d_4_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson3d_4_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson3d_4_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson3d_4_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson3d_4_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson3d_4_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson3d_4_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_4_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_4_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson3d_4_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson3d_4_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson3d_4_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson3d_4_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson3d_4_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson3d_4_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_4_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_4_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson3d_4_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson3d_4_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson3d_4_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson3d_4_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson3d_4_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson3d_4_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson3d_4_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson3d_4_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson3d_4_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson3d_4_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson3d_4_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson3d_4_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_4_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson3d_4_form_0::create_default_cell_integral() const
+ufc::cell_integral * poisson3d_4_form_0::create_default_cell_integral() const
 {
     return new poisson3d_4_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson3d_4_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson3d_4_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson3d_4_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson3d_4_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * poisson3d_4_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson3d_4_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * poisson3d_4_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson3d_4_form_0::create_default_vertex_integral() const
+ufc::interface_integral * poisson3d_4_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson3d_4_form_0::create_default_custom_integral() const
+ufc::overlap_integral * poisson3d_4_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 poisson3d_4_form_1::poisson3d_4_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 poisson3d_4_form_1::~poisson3d_4_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* poisson3d_4_form_1::signature() const
+const char * poisson3d_4_form_1::signature() const
 {
-    return "361ea252c6a3fa0b1b675c2988553da5b5d515dc89175c5412cf8a54bfa075de723d70eabbfb6db0454ed053229ddc20710ab25fa6208ccf86d272e1c9ef7e7b";
+    return "f610698a9137b23719b4cd9f8562575da647e47828c8e8164b531cbc8c48dec6ccfe83ff1339a91fc091e024aa03eee3466f7ca19c58e1066ef81ba65b82f459";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t poisson3d_4_form_1::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t poisson3d_4_form_1::num_coefficients() const
 {
     return 1;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t poisson3d_4_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0});
     return position[i];
 }
 
+ufc::finite_element * poisson3d_4_form_1::create_coordinate_finite_element() const
+{
+    return new poisson3d_4_finite_element_1();
+}
+
+ufc::dofmap * poisson3d_4_form_1::create_coordinate_dofmap() const
+{
+    return new poisson3d_4_dofmap_1();
+}
+
+ufc::coordinate_mapping * poisson3d_4_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* poisson3d_4_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * poisson3d_4_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_4_finite_element_0();
+        return new poisson3d_4_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_4_finite_element_0();
+        return new poisson3d_4_finite_element_2();
         break;
       }
     }
@@ -2929,19 +4222,18 @@ ufc::finite_element* poisson3d_4_form_1::create_finite_element(std::size_t i) co
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* poisson3d_4_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * poisson3d_4_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new poisson3d_4_dofmap_0();
+        return new poisson3d_4_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson3d_4_dofmap_0();
+        return new poisson3d_4_dofmap_2();
         break;
       }
     }
@@ -2949,128 +4241,163 @@ ufc::dofmap* poisson3d_4_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t poisson3d_4_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t poisson3d_4_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t poisson3d_4_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t poisson3d_4_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t poisson3d_4_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t poisson3d_4_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_4_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t poisson3d_4_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool poisson3d_4_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool poisson3d_4_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool poisson3d_4_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool poisson3d_4_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool poisson3d_4_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool poisson3d_4_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_4_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool poisson3d_4_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * poisson3d_4_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * poisson3d_4_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* poisson3d_4_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * poisson3d_4_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* poisson3d_4_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * poisson3d_4_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* poisson3d_4_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * poisson3d_4_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* poisson3d_4_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * poisson3d_4_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* poisson3d_4_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * poisson3d_4_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_4_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* poisson3d_4_form_1::create_default_cell_integral() const
+ufc::cell_integral * poisson3d_4_form_1::create_default_cell_integral() const
 {
     return new poisson3d_4_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* poisson3d_4_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * poisson3d_4_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * poisson3d_4_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * poisson3d_4_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* poisson3d_4_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * poisson3d_4_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* poisson3d_4_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * poisson3d_4_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* poisson3d_4_form_1::create_default_custom_integral() const
+ufc::interface_integral * poisson3d_4_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * poisson3d_4_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/bench/fem/convergence/cpp/Poisson3D_4.h b/bench/fem/convergence/cpp/Poisson3D_4.h
index 95b7ba5..54273b9 100644
--- a/bench/fem/convergence/cpp/Poisson3D_4.h
+++ b/bench/fem/convergence/cpp/Poisson3D_4.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -15,500 +15,735 @@
 //   format:                         'dolfin'
 //   no-evaluate_basis:              True
 //   no-evaluate_basis_derivatives:  True
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __POISSON3D_4_H
 #define __POISSON3D_4_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson3d_4_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson3d_4_finite_element_0();
 
-  /// Destructor
-  virtual ~poisson3d_4_finite_element_0();
+  ~poisson3d_4_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t space_dimension() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson3d_4_finite_element_1: public ufc::finite_element
+{
+public:
+
+  poisson3d_4_finite_element_1();
+
+  ~poisson3d_4_finite_element_1() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class poisson3d_4_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson3d_4_finite_element_2();
+
+  ~poisson3d_4_finite_element_2() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
+  std::size_t num_sub_elements() const final override;
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class poisson3d_4_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   poisson3d_4_dofmap_0();
 
-  /// Destructor
-  virtual ~poisson3d_4_dofmap_0();
+  ~poisson3d_4_dofmap_0() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson3d_4_dofmap_1: public ufc::dofmap
+{
+public:
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  poisson3d_4_dofmap_1();
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  ~poisson3d_4_dofmap_1() override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  const char * signature() const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class poisson3d_4_dofmap_2: public ufc::dofmap
+{
+public:
+
+  poisson3d_4_dofmap_2();
+
+  ~poisson3d_4_dofmap_2() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
+
+  std::size_t num_facet_dofs() const final override;
+
+  std::size_t num_entity_dofs(std::size_t d) const final override;
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 poisson3d_4_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson3d_4_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~poisson3d_4_cell_integral_0_otherwise();
+  ~poisson3d_4_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 poisson3d_4_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson3d_4_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~poisson3d_4_cell_integral_1_otherwise();
+  ~poisson3d_4_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson3d_4_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson3d_4_form_0();
 
-  /// Destructor
-  virtual ~poisson3d_4_form_0();
+  ~poisson3d_4_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson3d_4_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson3d_4_form_1();
 
-  /// Destructor
-  virtual ~poisson3d_4_form_1();
+  ~poisson3d_4_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -518,14 +753,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson3D_4
 {
@@ -534,43 +775,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_4_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_4_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -581,43 +799,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_4_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_4_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -628,63 +823,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_4_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_4_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_4_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -692,7 +894,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_4_form_0());
+    _ufc_form = std::make_shared<const poisson3d_4_form_0>();
   }
 
   // Destructor
@@ -722,57 +924,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_4_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_4_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_4_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_4_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_4_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -780,69 +1037,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_4_form_1());
+    _ufc_form = std::make_shared<const poisson3d_4_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_4_form_1());
+    _ufc_form = std::make_shared<const poisson3d_4_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_4_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_4_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_4_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->f = *f;
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_4_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -874,18 +1172,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/convergence/cpp/compile.log b/bench/fem/convergence/cpp/compile.log
index 250522b..772c009 100644
--- a/bench/fem/convergence/cpp/compile.log
+++ b/bench/fem/convergence/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson3D_3
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG3(?)'
-  Unique sub elements:       'CG3(?)'
+  Unique elements:           'CG3(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG3(?), Vector<3 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -30,8 +31,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG3(?)'
-  Unique sub elements:       'CG3(?)'
+  Unique elements:           'CG3(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG3(?), Vector<3 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -39,18 +40,30 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   
-Compiler stage 1 finished in 0.622395 seconds.
+Compiler stage 1 finished in 1.28581 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -60,7 +73,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  3600 entries computed in 0.0019 seconds
+  3600 entries computed in 0.00234 seconds
   Shape of reference tensor: (20, 20, 3, 3)
   Primary multi index:   rank = 2 dims = [20, 20] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2 [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -68,6 +81,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   External multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -75,7 +89,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  400 entries computed in 0.0016 seconds
+  400 entries computed in 0.00178 seconds
   Shape of reference tensor: (20, 20)
   Primary multi index:   rank = 1 dims = [20] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]
   Secondary multi index: rank = 1 dims = [20] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]
@@ -83,280 +97,171 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [20] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00929594 seconds.
+Compiler stage 2 finished in 0.0859089 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000166893 seconds.
+Compiler stage 3 finished in 0.000232935 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 1.14338 seconds.
+Compiler stage 4 finished in 1.82624 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000548124 seconds.
+Compiler stage 4.1 finished in 0.000942945 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.004143 seconds.
+
+FFC finished in 3.20384 seconds.
 Output written to ./Poisson3D_3.h.
 Output written to ./Poisson3D_3.cpp.
-Compiler stage 5 finished in 0.00158811 seconds.
-
-FFC finished in 1.77772 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson2D_3
 
@@ -369,17 +274,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG3(?)'
-  Unique sub elements:       'CG3(?)'
+  Unique elements:           'CG3(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG3(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -387,8 +292,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG3(?)'
-  Unique sub elements:       'CG3(?)'
+  Unique elements:           'CG3(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG3(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -396,18 +301,29 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   
-Compiler stage 1 finished in 0.218036 seconds.
+Compiler stage 1 finished in 0.584481 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -417,7 +333,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  400 entries computed in 0.00109 seconds
+  400 entries computed in 0.0014 seconds
   Shape of reference tensor: (10, 10, 2, 2)
   Primary multi index:   rank = 2 dims = [10, 10] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 0], [5, 1], [5, 2], [5, 3], [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -425,6 +341,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -432,7 +349,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  100 entries computed in 0.00104 seconds
+  100 entries computed in 0.00135 seconds
   Shape of reference tensor: (10, 10)
   Primary multi index:   rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
   Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
@@ -440,160 +357,79 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00706291 seconds.
+Compiler stage 2 finished in 0.039793 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000176191 seconds.
+Compiler stage 3 finished in 0.000262976 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.190874 seconds.
+Compiler stage 4 finished in 0.377306 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000627041 seconds.
+Compiler stage 4.1 finished in 0.00116611 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.00151801 seconds.
+
+FFC finished in 1.00512 seconds.
 Output written to ./Poisson2D_3.h.
 Output written to ./Poisson2D_3.cpp.
-Compiler stage 5 finished in 0.00100303 seconds.
-
-FFC finished in 0.418181 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson2D_2
 
@@ -606,17 +442,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -624,8 +460,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -633,18 +469,29 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.0891049 seconds.
+Compiler stage 1 finished in 0.222948 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -654,7 +501,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000823 seconds
+  144 entries computed in 0.00118 seconds
   Shape of reference tensor: (6, 6, 2, 2)
   Primary multi index:   rank = 2 dims = [6, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -662,6 +509,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -669,7 +517,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000759 seconds
+  36 entries computed in 0.00105 seconds
   Shape of reference tensor: (6, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -677,112 +525,79 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00606322 seconds.
+Compiler stage 2 finished in 0.038408 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000164032 seconds.
+Compiler stage 3 finished in 0.000262022 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0839901 seconds.
+Compiler stage 4 finished in 0.234598 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000597 seconds.
+Compiler stage 4.1 finished in 0.00327706 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.00399804 seconds.
+
+FFC finished in 0.504696 seconds.
 Output written to ./Poisson2D_2.h.
 Output written to ./Poisson2D_2.cpp.
-Compiler stage 5 finished in 0.000848055 seconds.
-
-FFC finished in 0.181119 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson2D_5
 
@@ -795,17 +610,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG5(?)'
-  Unique sub elements:       'CG5(?)'
+  Unique elements:           'CG5(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG5(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 8
-  quadrature_degree: auto --> 8
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 8
+  quadrature_degree: 8
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -813,8 +628,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG5(?)'
-  Unique sub elements:       'CG5(?)'
+  Unique elements:           'CG5(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG5(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -822,18 +637,29 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 10
-  quadrature_degree: auto --> 10
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 10
+  quadrature_degree: 10
   
-Compiler stage 1 finished in 1.05052 seconds.
+Compiler stage 1 finished in 1.99673 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -843,7 +669,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  1764 entries computed in 0.00387 seconds
+  1764 entries computed in 0.00423 seconds
   Shape of reference tensor: (21, 21, 2, 2)
   Primary multi index:   rank = 2 dims = [21, 21] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [ [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -851,6 +677,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -858,7 +685,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  441 entries computed in 0.00411 seconds
+  441 entries computed in 0.00441 seconds
   Shape of reference tensor: (21, 21)
   Primary multi index:   rank = 1 dims = [21] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20]]
   Secondary multi index: rank = 1 dims = [21] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20]]
@@ -866,292 +693,79 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [21] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0136819 seconds.
+Compiler stage 2 finished in 0.0620358 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000179052 seconds.
+Compiler stage 3 finished in 0.000216007 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.924314 seconds.
+Compiler stage 4 finished in 1.34569 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000560999 seconds.
+Compiler stage 4.1 finished in 0.000727892 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.000920057 seconds.
+
+FFC finished in 3.40677 seconds.
 Output written to ./Poisson2D_5.h.
 Output written to ./Poisson2D_5.cpp.
-Compiler stage 5 finished in 0.000871897 seconds.
-
-FFC finished in 1.99049 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson3D_1
 
@@ -1164,17 +778,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<3 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -1182,8 +796,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<3 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1191,18 +805,27 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0630119 seconds.
+Compiler stage 1 finished in 0.115222 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -1212,7 +835,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000812 seconds
+  144 entries computed in 0.000928 seconds
   Shape of reference tensor: (4, 4, 3, 3)
   Primary multi index:   rank = 2 dims = [4, 4] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1220,6 +843,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   External multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1227,7 +851,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  16 entries computed in 0.000744 seconds
+  16 entries computed in 0.000785 seconds
   Shape of reference tensor: (4, 4)
   Primary multi index:   rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   Secondary multi index: rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
@@ -1235,120 +859,171 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00626707 seconds.
+Compiler stage 2 finished in 0.0124421 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000164032 seconds.
+Compiler stage 3 finished in 0.000216007 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0667078 seconds.
+Compiler stage 4 finished in 0.300008 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000537872 seconds.
+Compiler stage 4.1 finished in 0.00106478 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.00110006 seconds.
+
+FFC finished in 0.430576 seconds.
 Output written to ./Poisson3D_1.h.
 Output written to ./Poisson3D_1.cpp.
-Compiler stage 5 finished in 0.000839949 seconds.
-
-FFC finished in 0.137862 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson3D_4
 
@@ -1361,17 +1036,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG4(?)'
-  Unique sub elements:       'CG4(?)'
+  Unique elements:           'CG4(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG4(?), Vector<3 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -1379,8 +1054,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG4(?)'
-  Unique sub elements:       'CG4(?)'
+  Unique elements:           'CG4(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG4(?), Vector<3 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1388,20 +1063,32 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 8
-  quadrature_degree: auto --> 8
-  WARNING: The number of integration points for each cell will be: 125
-           Consider using the option 'quadrature_degree' to reduce the number of points
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 8
+  quadrature_degree: 8
+  WARNING: The number of integration points for each cell will be: 125
+           Consider using the option 'quadrature_degree' to reduce the number of points
   
-Compiler stage 1 finished in 1.7539 seconds.
+Compiler stage 1 finished in 3.89606 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -1411,7 +1098,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  11025 entries computed in 0.00635 seconds
+  11025 entries computed in 0.00536 seconds
   Shape of reference tensor: (35, 35, 3, 3)
   Primary multi index:   rank = 2 dims = [35, 35] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [0, 34], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1419,6 +1106,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   External multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1426,7 +1114,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  1225 entries computed in 0.00889 seconds
+  1225 entries computed in 0.0107 seconds
   Shape of reference tensor: (35, 35)
   Primary multi index:   rank = 1 dims = [35] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33], [34]]
   Secondary multi index: rank = 1 dims = [35] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33], [34]]
@@ -1434,460 +1122,171 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [35] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33], [34]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0232759 seconds.
+Compiler stage 2 finished in 0.108524 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000172138 seconds.
+Compiler stage 3 finished in 0.000377893 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 1.77959 seconds.
+Compiler stage 4 finished in 2.74697 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000601053 seconds.
+Compiler stage 4.1 finished in 0.00141311 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.00282001 seconds.
+
+FFC finished in 6.75693 seconds.
 Output written to ./Poisson3D_4.h.
 Output written to ./Poisson3D_4.cpp.
-Compiler stage 5 finished in 0.00122595 seconds.
-
-FFC finished in 3.55912 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson3D_2
 
@@ -1900,17 +1299,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<3 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -1918,8 +1317,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<3 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1927,18 +1326,30 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.176444 seconds.
+Compiler stage 1 finished in 0.427696 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -1948,7 +1359,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00104 seconds
+  900 entries computed in 0.00151 seconds
   Shape of reference tensor: (10, 10, 3, 3)
   Primary multi index:   rank = 2 dims = [10, 10] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 0], [5, 1], [5, 2], [5, 3], [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1956,6 +1367,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   External multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1963,7 +1375,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  100 entries computed in 0.00109 seconds
+  100 entries computed in 0.00145 seconds
   Shape of reference tensor: (10, 10)
   Primary multi index:   rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
   Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
@@ -1971,160 +1383,171 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00704789 seconds.
+Compiler stage 2 finished in 0.0617781 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000157118 seconds.
+Compiler stage 3 finished in 0.000257969 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.256647 seconds.
+Compiler stage 4 finished in 0.663932 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000582933 seconds.
+Compiler stage 4.1 finished in 0.000914097 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.00158215 seconds.
+
+FFC finished in 1.15671 seconds.
 Output written to ./Poisson3D_2.h.
 Output written to ./Poisson3D_2.cpp.
-Compiler stage 5 finished in 0.00100613 seconds.
-
-FFC finished in 0.442237 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson2D_1
 
@@ -2137,17 +1560,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -2155,8 +1578,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2164,18 +1587,26 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0431509 seconds.
+Compiler stage 1 finished in 0.135812 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -2185,7 +1616,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.00068 seconds
+  36 entries computed in 0.00166 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -2193,6 +1624,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2200,7 +1632,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000601 seconds
+  9 entries computed in 0.00154 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -2208,88 +1640,79 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00558305 seconds.
+Compiler stage 2 finished in 0.0217118 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000169039 seconds.
+Compiler stage 3 finished in 0.000443935 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.038511 seconds.
+Compiler stage 4 finished in 0.148445 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.00060606 seconds.
+Compiler stage 4.1 finished in 0.000921011 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.00089407 seconds.
+
+FFC finished in 0.308938 seconds.
 Output written to ./Poisson2D_1.h.
 Output written to ./Poisson2D_1.cpp.
-Compiler stage 5 finished in 0.000832796 seconds.
-
-FFC finished in 0.0892088 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson2D_4
 
@@ -2302,17 +1725,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG4(?)'
-  Unique sub elements:       'CG4(?)'
+  Unique elements:           'CG4(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG4(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -2320,8 +1743,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG4(?)'
-  Unique sub elements:       'CG4(?)'
+  Unique elements:           'CG4(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG4(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2329,18 +1752,29 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 8
-  quadrature_degree: auto --> 8
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 8
+  quadrature_degree: 8
   
-Compiler stage 1 finished in 0.456511 seconds.
+Compiler stage 1 finished in 1.11819 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -2350,7 +1784,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00136 seconds
+  900 entries computed in 0.00166 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -2358,6 +1792,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2365,7 +1800,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  225 entries computed in 0.00283 seconds
+  225 entries computed in 0.00353 seconds
   Shape of reference tensor: (15, 15)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
@@ -2373,215 +1808,73 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00903606 seconds.
+Compiler stage 2 finished in 0.0618451 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000159979 seconds.
+Compiler stage 3 finished in 0.00022912 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.401301 seconds.
+Compiler stage 4 finished in 0.682108 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000567913 seconds.
+Compiler stage 4.1 finished in 0.00090909 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.00206089 seconds.
+
+FFC finished in 1.86586 seconds.
 Output written to ./Poisson2D_4.h.
 Output written to ./Poisson2D_4.cpp.
-Compiler stage 5 finished in 0.001091 seconds.
-
-FFC finished in 0.869002 seconds.
diff --git a/bench/fem/convergence/cpp/main.cpp b/bench/fem/convergence/cpp/main.cpp
index dbd1cdf..d8b4d56 100644
--- a/bench/fem/convergence/cpp/main.cpp
+++ b/bench/fem/convergence/cpp/main.cpp
@@ -31,6 +31,10 @@ using namespace dolfin;
 // Boundary condition
 class DirichletBoundary : public SubDomain
 {
+public:
+
+  DirichletBoundary() {}
+
   bool inside(const Array<double>& x, bool on_boundary) const
   { return on_boundary; }
 };
@@ -59,48 +63,48 @@ double solve2D(int q, int n)
   printf("Solving Poisson's equation in 2D for q = %d, n = %d.\n", q, n);
 
   // Set up problem
-  UnitSquareMesh mesh(n, n);
-  Source2D f;
-  Constant zero(0.0);
+  auto mesh = std::make_shared<UnitSquareMesh>(n, n);
+  auto f = std::make_shared<Source2D>();
+  auto zero = std::make_shared<const Constant>(0.0);
 
   // Choose forms
   Form* a = 0;
   Form* L = 0;
-  FunctionSpace* V = 0;
+  std::shared_ptr<const FunctionSpace> V;
   switch (q)
   {
   case 1:
-    V = new Poisson2D_1::FunctionSpace(mesh);
-    a = new Poisson2D_1::BilinearForm(*V, *V);
-    L = new Poisson2D_1::LinearForm(*V, f);
+    V = std::make_shared<Poisson2D_1::FunctionSpace>(mesh);
+    a = new Poisson2D_1::BilinearForm(V, V);
+    L = new Poisson2D_1::LinearForm(V, f);
     break;
   case 2:
-    V = new Poisson2D_2::FunctionSpace(mesh);
-    a = new Poisson2D_2::BilinearForm(*V, *V);
-    L = new Poisson2D_2::LinearForm(*V, f);
+    V = std::make_shared<Poisson2D_2::FunctionSpace>(mesh);
+    a = new Poisson2D_2::BilinearForm(V, V);
+    L = new Poisson2D_2::LinearForm(V, f);
     break;
   case 3:
-    V = new Poisson2D_3::FunctionSpace(mesh);
-    a = new Poisson2D_3::BilinearForm(*V, *V);
-    L = new Poisson2D_3::LinearForm(*V, f);
+    V = std::make_shared<Poisson2D_3::FunctionSpace>(mesh);
+    a = new Poisson2D_3::BilinearForm(V, V);
+    L = new Poisson2D_3::LinearForm(V, f);
     break;
   case 4:
-    V = new Poisson2D_4::FunctionSpace(mesh);
-    a = new Poisson2D_4::BilinearForm(*V, *V);
-    L = new Poisson2D_4::LinearForm(*V, f);
+    V = std::make_shared<Poisson2D_4::FunctionSpace>(mesh);
+    a = new Poisson2D_4::BilinearForm(V, V);
+    L = new Poisson2D_4::LinearForm(V, f);
     break;
   case 5:
-    V = new Poisson2D_5::FunctionSpace(mesh);
-    a = new Poisson2D_5::BilinearForm(*V, *V);
-    L = new Poisson2D_5::LinearForm(*V, f);
+    V = std::make_shared<Poisson2D_5::FunctionSpace>(mesh);
+    a = new Poisson2D_5::BilinearForm(V, V);
+    L = new Poisson2D_5::LinearForm(V, f);
     break;
   default:
     error("Forms not compiled for q = %d.", q);
   }
 
   // Set up boundary conditions
-  DirichletBoundary boundary;
-  DirichletBC bc(*V, zero, boundary);
+  auto boundary = std::make_shared<const DirichletBoundary>();
+  DirichletBC bc(V, zero, boundary);
 
   // Discretize equation
   Matrix A;
@@ -118,7 +122,7 @@ double solve2D(int q, int n)
   double emax = 0.0;
   std::vector<double> U;
   x.get_local(U);
-  for (VertexIterator v(mesh); !v.end(); ++v)
+  for (VertexIterator v(*mesh); !v.end(); ++v)
   {
     const Point p = v->point();
     const double u = sin(DOLFIN_PI*p.x())*sin(DOLFIN_PI*p.y());
@@ -128,7 +132,6 @@ double solve2D(int q, int n)
 
   delete a;
   delete L;
-  delete V;
 
   return emax;
 }
@@ -139,43 +142,43 @@ double solve3D(int q, int n)
   printf("Solving Poisson's equation in 3D for q = %d, n = %d.\n", q, n);
 
   // Set up problem
-  UnitCubeMesh mesh(n, n, n);
-  Source3D f;
-  Constant zero(0.0);
+  auto mesh = std::make_shared<UnitCubeMesh>(n, n, n);
+  auto f = std::make_shared<Source3D>();
+  auto zero = std::make_shared<const Constant>(0.0);
 
   // Choose forms
   Form* a = 0;
   Form* L = 0;
-  FunctionSpace* V = 0;
+  std::shared_ptr<const FunctionSpace> V;
   switch (q)
   {
   case 1:
-    V = new Poisson3D_1::FunctionSpace(mesh);
-    a = new Poisson3D_1::BilinearForm(*V, *V);
-    L = new Poisson3D_1::LinearForm(*V, f);
+    V = std::make_shared<Poisson3D_1::FunctionSpace>(mesh);
+    a = new Poisson3D_1::BilinearForm(V, V);
+    L = new Poisson3D_1::LinearForm(V, f);
     break;
   case 2:
-    V = new Poisson3D_2::FunctionSpace(mesh);
-    a = new Poisson3D_2::BilinearForm(*V, *V);
-    L = new Poisson3D_2::LinearForm(*V, f);
+    V = std::make_shared<Poisson3D_2::FunctionSpace>(mesh);
+    a = new Poisson3D_2::BilinearForm(V, V);
+    L = new Poisson3D_2::LinearForm(V, f);
     break;
   case 3:
-    V = new Poisson3D_3::FunctionSpace(mesh);
-    a = new Poisson3D_3::BilinearForm(*V, *V);
-    L = new Poisson3D_3::LinearForm(*V, f);
+    V = std::make_shared<Poisson3D_3::FunctionSpace>(mesh);
+    a = new Poisson3D_3::BilinearForm(V, V);
+    L = new Poisson3D_3::LinearForm(V, f);
     break;
   case 4:
-    V = new Poisson3D_4::FunctionSpace(mesh);
-    a = new Poisson3D_4::BilinearForm(*V, *V);
-    L = new Poisson3D_4::LinearForm(*V, f);
+    V = std::make_shared<Poisson3D_4::FunctionSpace>(mesh);
+    a = new Poisson3D_4::BilinearForm(V, V);
+    L = new Poisson3D_4::LinearForm(V, f);
     break;
   default:
     error("Forms not compiled for q = %d.", q);
   }
 
   // Set up boundary conditions
-  DirichletBoundary boundary;
-  DirichletBC bc(*V, zero, boundary);
+  auto boundary = std::make_shared<const DirichletBoundary>();
+  DirichletBC bc(V, zero, boundary);
 
   // Discretize equation
   Matrix A;
@@ -193,7 +196,7 @@ double solve3D(int q, int n)
   double emax = 0.0;
   std::vector<double> U;
   x.get_local(U);
-  for (VertexIterator v(mesh); !v.end(); ++v)
+  for (VertexIterator v(*mesh); !v.end(); ++v)
   {
     const Point p = v->point();
     const double u = sin(DOLFIN_PI*p.x())*sin(DOLFIN_PI*p.y())*sin(DOLFIN_PI*p.z());
@@ -203,13 +206,14 @@ double solve3D(int q, int n)
 
   delete a;
   delete L;
-  delete V;
 
   return emax;
 }
 
 int main()
 {
+  info("Runtime of convergence benchmark");
+
   set_log_active(false);
 
   const int qmax_2D = 5;
diff --git a/bench/fem/multicore/cpp/CMakeLists.txt b/bench/fem/multicore/cpp/CMakeLists.txt
index 5361ad3..df18807 100644
--- a/bench/fem/multicore/cpp/CMakeLists.txt
+++ b/bench/fem/multicore/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/fem/multicore/cpp/NavierStokes.h b/bench/fem/multicore/cpp/NavierStokes.h
index b42ab3f..3ed824c 100644
--- a/bench/fem/multicore/cpp/NavierStokes.h
+++ b/bench/fem/multicore/cpp/NavierStokes.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,394 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __NAVIERSTOKES_H
 #define __NAVIERSTOKES_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class navierstokes_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   navierstokes_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~navierstokes_finite_element_0()
+  ~navierstokes_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Compute subdeterminants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-    vertex_values[3] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t value_size() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new navierstokes_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class navierstokes_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  navierstokes_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~navierstokes_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 4;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -409,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -558,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -580,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -619,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -631,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -640,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1342,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1399,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1407,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1433,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1472,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1520,98 +1222,110 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new navierstokes_finite_element_1();
+    return new navierstokes_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class navierstokes_finite_element_2: public ufc::finite_element
+class navierstokes_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  navierstokes_finite_element_2() : ufc::finite_element()
+  navierstokes_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~navierstokes_finite_element_2()
+  ~navierstokes_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1625,16 +1339,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1643,9 +1371,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -2034,20 +1762,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2056,7 +1782,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -2064,21 +1790,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2098,7 +1822,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2110,7 +1834,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -2119,9 +1843,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -4077,28 +3801,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4134,7 +3856,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -4142,22 +3864,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -4168,108 +3888,108 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 9:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 10:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 11:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -4279,86 +3999,84 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[8] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[10] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[11] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4377,46 +4095,69 @@ public:
     vertex_values[11] = dof_values[11];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 3;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new navierstokes_finite_element_1();
+        return new navierstokes_finite_element_0();
         break;
       }
     case 1:
       {
-        return new navierstokes_finite_element_1();
+        return new navierstokes_finite_element_0();
         break;
       }
     case 2:
       {
-        return new navierstokes_finite_element_1();
+        return new navierstokes_finite_element_0();
         break;
       }
     }
@@ -4424,264 +4165,333 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new navierstokes_finite_element_2();
+    return new navierstokes_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class navierstokes_dofmap_0: public ufc::dofmap
+class navierstokes_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  navierstokes_dofmap_0() : ufc::dofmap()
+  navierstokes_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~navierstokes_dofmap_0()
+  ~navierstokes_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FiniteElement('Discontinuous Lagrange', tetrahedron, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    case 3:
-      {
-        return true;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
   {
-    return num_global_entities[3];
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    case 3:
-      {
-        return 1;
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  const char * family() const final override
   {
-    dofs[0] = c.entity_indices[3][0];
+    return "Discontinuous Lagrange";
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        
-        break;
-      }
-    }
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Compute subdeterminants
+    
+    // Get coordinates and map to the reference (FIAT) element
     
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    if (d > 3)
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
     {
-    throw std::runtime_error("d is larger than dimension (3)");
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
     }
     
-    switch (d)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
     {
     case 0:
       {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     }
     
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+    vertex_values[3] = dof_values[0];
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    dof_coordinates[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+    dof_coordinates[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
   }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::finite_element * create() const final override
   {
-    return new navierstokes_dofmap_0();
+    return new navierstokes_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class navierstokes_dofmap_1: public ufc::dofmap
+class navierstokes_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  navierstokes_dofmap_1() : ufc::dofmap()
+  navierstokes_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~navierstokes_dofmap_1()
+  ~navierstokes_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4710,39 +4520,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4771,20 +4570,18 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4820,9 +4617,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -4883,71 +4679,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new navierstokes_dofmap_1();
+    return new navierstokes_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class navierstokes_dofmap_2: public ufc::dofmap
+class navierstokes_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  navierstokes_dofmap_2() : ufc::dofmap()
+  navierstokes_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~navierstokes_dofmap_2()
+  ~navierstokes_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4976,39 +4746,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 9;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5037,32 +4796,30 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[0][0];
-    dofs[5] = offset + c.entity_indices[0][1];
-    dofs[6] = offset + c.entity_indices[0][2];
-    dofs[7] = offset + c.entity_indices[0][3];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[8] = offset + c.entity_indices[0][0];
-    dofs[9] = offset + c.entity_indices[0][1];
-    dofs[10] = offset + c.entity_indices[0][2];
-    dofs[11] = offset + c.entity_indices[0][3];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5122,9 +4879,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -5193,72 +4949,29 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = vertex_coordinates[6];
-    dof_coordinates[19] = vertex_coordinates[7];
-    dof_coordinates[20] = vertex_coordinates[8];
-    dof_coordinates[21] = vertex_coordinates[9];
-    dof_coordinates[22] = vertex_coordinates[10];
-    dof_coordinates[23] = vertex_coordinates[11];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[6];
-    dof_coordinates[31] = vertex_coordinates[7];
-    dof_coordinates[32] = vertex_coordinates[8];
-    dof_coordinates[33] = vertex_coordinates[9];
-    dof_coordinates[34] = vertex_coordinates[10];
-    dof_coordinates[35] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new navierstokes_dofmap_1();
+        return new navierstokes_dofmap_0();
         break;
       }
     case 1:
       {
-        return new navierstokes_dofmap_1();
+        return new navierstokes_dofmap_0();
         break;
       }
     case 2:
       {
-        return new navierstokes_dofmap_1();
+        return new navierstokes_dofmap_0();
         break;
       }
     }
@@ -5266,50 +4979,234 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new navierstokes_dofmap_2();
+    return new navierstokes_dofmap_1();
   }
 
 };
 
-/// 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 navierstokes_cell_integral_0_otherwise: public ufc::cell_integral
+class navierstokes_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  navierstokes_cell_integral_0_otherwise() : ufc::cell_integral()
+  navierstokes_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~navierstokes_cell_integral_0_otherwise()
+  ~navierstokes_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', tetrahedron, 0)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return false;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return true;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[3];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 0;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 0;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 1;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[3][0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new navierstokes_dofmap_2();
+  }
+
+};
+
+
+class navierstokes_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  navierstokes_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~navierstokes_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -5861,102 +5758,94 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class navierstokes_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   navierstokes_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~navierstokes_form_0()
+  ~navierstokes_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "8799ef4e55f640d75c310a09d7eb441f747c59b91d215888a7f7f2788f84a27387ae5689316fa6d380442e10b173826476e9079fe8adb0cf674b17663c54380b";
+    return "833f5404d861543c186c5bbeb92c36fc3f1ef55331f2153da311943d9da580fc675345402784fa06e954045891d9e9d83823ceb499e45b40eb77a1cf4e32a8f3";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 5;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3, 4});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new navierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new navierstokes_dofmap_1();
+   }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new navierstokes_finite_element_2();
+        return new navierstokes_finite_element_1();
         break;
       }
     case 1:
       {
-        return new navierstokes_finite_element_2();
+        return new navierstokes_finite_element_1();
         break;
       }
     case 2:
       {
-        return new navierstokes_finite_element_2();
+        return new navierstokes_finite_element_1();
         break;
       }
     case 3:
       {
-        return new navierstokes_finite_element_0();
+        return new navierstokes_finite_element_2();
         break;
       }
     case 4:
       {
-        return new navierstokes_finite_element_0();
+        return new navierstokes_finite_element_2();
         break;
       }
     case 5:
       {
-        return new navierstokes_finite_element_0();
+        return new navierstokes_finite_element_2();
         break;
       }
     case 6:
       {
-        return new navierstokes_finite_element_0();
+        return new navierstokes_finite_element_2();
         break;
       }
     }
@@ -5964,44 +5853,43 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new navierstokes_dofmap_2();
+        return new navierstokes_dofmap_1();
         break;
       }
     case 1:
       {
-        return new navierstokes_dofmap_2();
+        return new navierstokes_dofmap_1();
         break;
       }
     case 2:
       {
-        return new navierstokes_dofmap_2();
+        return new navierstokes_dofmap_1();
         break;
       }
     case 3:
       {
-        return new navierstokes_dofmap_0();
+        return new navierstokes_dofmap_2();
         break;
       }
     case 4:
       {
-        return new navierstokes_dofmap_0();
+        return new navierstokes_dofmap_2();
         break;
       }
     case 5:
       {
-        return new navierstokes_dofmap_0();
+        return new navierstokes_dofmap_2();
         break;
       }
     case 6:
       {
-        return new navierstokes_dofmap_0();
+        return new navierstokes_dofmap_2();
         break;
       }
     }
@@ -6009,126 +5897,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new navierstokes_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -6142,14 +6066,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace NavierStokes
 {
@@ -6158,43 +6088,20 @@ class CoefficientSpace_d1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_d1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_d1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_d1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_d1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6205,43 +6112,20 @@ class CoefficientSpace_d2: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_d2(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_d2(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_d2(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_d2(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6252,43 +6136,20 @@ class CoefficientSpace_k: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6299,43 +6160,20 @@ class CoefficientSpace_nu: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_nu(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_nu(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_nu(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_nu(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6346,43 +6184,20 @@ class CoefficientSpace_w: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_w(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_w(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6393,43 +6208,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6440,45 +6232,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<navierstokes_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<navierstokes_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new navierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new navierstokes_dofmap_2()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -6498,21 +6307,21 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new navierstokes_form_0());
+    _ufc_form = std::make_shared<const navierstokes_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& d1, const dolfin::GenericFunction& d2, const dolfin::GenericFunction& k, const dolfin::GenericFunction& nu):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> d1, std::shared_ptr<const dolfin::GenericFunction> d2, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> nu):
     dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->w = w;
     this->d1 = d1;
@@ -6520,69 +6329,124 @@ public:
     this->k = k;
     this->nu = nu;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new navierstokes_form_0());
+    _ufc_form = std::make_shared<const navierstokes_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> d1, std::shared_ptr<const dolfin::GenericFunction> d2, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
+  // Destructor
+  ~Form_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    if (name == "w")
+      return 0;
+    else if (name == "d1")
+      return 1;
+    else if (name == "d2")
+      return 2;
+    else if (name == "k")
+      return 3;
+    else if (name == "nu")
+      return 4;
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
 
-    this->w = *w;
-    this->d1 = *d1;
-    this->d2 = *d2;
-    this->k = *k;
-    this->nu = *nu;
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "w";
+    case 1:
+      return "d1";
+    case 2:
+      return "d2";
+    case 3:
+      return "k";
+    case 4:
+      return "nu";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new navierstokes_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_w;
+  typedef Form_a_FunctionSpace_3 CoefficientSpace_d1;
+  typedef Form_a_FunctionSpace_4 CoefficientSpace_d2;
+  typedef Form_a_FunctionSpace_5 CoefficientSpace_k;
+  typedef Form_a_FunctionSpace_6 CoefficientSpace_nu;
+
+  // Coefficients
+  dolfin::CoefficientAssigner w;
+  dolfin::CoefficientAssigner d1;
+  dolfin::CoefficientAssigner d2;
+  dolfin::CoefficientAssigner k;
+  dolfin::CoefficientAssigner nu;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new navierstokes_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& d1, const dolfin::GenericFunction& d2, const dolfin::GenericFunction& k, const dolfin::GenericFunction& nu):
-    dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> d1, std::shared_ptr<const dolfin::GenericFunction> d2, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> nu):
+    dolfin::MultiMeshForm(V1, V0), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
+    /// Assign coefficients
     this->w = w;
     this->d1 = d1;
     this->d2 = d2;
     this->k = k;
     this->nu = nu;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new navierstokes_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> d1, std::shared_ptr<const dolfin::GenericFunction> d2, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(2, 5), w(*this, 0), d1(*this, 1), d2(*this, 2), k(*this, 3), nu(*this, 4)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->w = *w;
-    this->d1 = *d1;
-    this->d2 = *d2;
-    this->k = *k;
-    this->nu = *nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new navierstokes_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -6631,6 +6495,8 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_w;
   typedef Form_a_FunctionSpace_3 CoefficientSpace_d1;
   typedef Form_a_FunctionSpace_4 CoefficientSpace_d2;
@@ -6638,17 +6504,20 @@ public:
   typedef Form_a_FunctionSpace_6 CoefficientSpace_nu;
 
   // Coefficients
-  dolfin::CoefficientAssigner w;
-  dolfin::CoefficientAssigner d1;
-  dolfin::CoefficientAssigner d2;
-  dolfin::CoefficientAssigner k;
-  dolfin::CoefficientAssigner nu;
+  dolfin::MultiMeshCoefficientAssigner w;
+  dolfin::MultiMeshCoefficientAssigner d1;
+  dolfin::MultiMeshCoefficientAssigner d2;
+  dolfin::MultiMeshCoefficientAssigner k;
+  dolfin::MultiMeshCoefficientAssigner nu;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/multicore/cpp/Poisson.h b/bench/fem/multicore/cpp/Poisson.h
index 56dad2e..1c7d46f 100644
--- a/bench/fem/multicore/cpp/Poisson.h
+++ b/bench/fem/multicore/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -257,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -279,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -318,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -330,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -339,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1041,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1098,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1106,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1132,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1171,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1219,151 +1222,92 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    case 3:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
   {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 4;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    case 3:
-      {
-        return 0;
+        return 3;
         break;
       }
     }
@@ -1371,298 +1315,3505 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    return 3;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-        break;
-      }
-    case 3:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-        break;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 3)
-    {
-    throw std::runtime_error("d is larger than dimension (3)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        
+        return 3;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  std::size_t reference_value_size() const final override
   {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
+    return 3;
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    27
-    // Number of operations (multiply-add pairs) for tensor contraction: 28
-    // Total number of operations (multiply-add pairs):                  58
-    
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
     double detJ;
     compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
-    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
-    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
-    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
-    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
-    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
-    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
-    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
-    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
-    // Compute element tensor
-    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
-    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
-    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
-    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
-    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
-    A[5] = 0.166666666666667*G0_0_0;
-    A[6] = 0.166666666666667*G0_0_1;
-    A[7] = 0.166666666666667*G0_0_2;
-    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
-    A[9] = 0.166666666666667*G0_1_0;
-    A[10] = 0.166666666666667*G0_1_1;
-    A[11] = 0.166666666666667*G0_1_2;
-    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
-    A[13] = 0.166666666666667*G0_2_0;
-    A[14] = 0.166666666666667*G0_2_1;
-    A[15] = 0.166666666666667*G0_2_2;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class poisson_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  poisson_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "0a1c8620c3fe3a9b075cccbf6831c3b71c838dae9d8115e7ca3bceb16e94994307b7af22c58a3329d1bc1bd249fd11fd8a0f9c8d23c6d43589322d9fc76fa890";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 3*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 9;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 3;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
+  }
+
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    27
+    // Number of operations (multiply-add pairs) for tensor contraction: 28
+    // Total number of operations (multiply-add pairs):                  58
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
+    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
+    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
+    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
+    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
+    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
+    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
+    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
+    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    
+    // Compute element tensor
+    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
+    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
+    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
+    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
+    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
+    A[5] = 0.166666666666667*G0_0_0;
+    A[6] = 0.166666666666667*G0_0_1;
+    A[7] = 0.166666666666667*G0_0_2;
+    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
+    A[9] = 0.166666666666667*G0_1_0;
+    A[10] = 0.166666666666667*G0_1_1;
+    A[11] = 0.166666666666667*G0_1_2;
+    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
+    A[13] = 0.166666666666667*G0_2_0;
+    A[14] = 0.166666666666667*G0_2_1;
+    A[15] = 0.166666666666667*G0_2_2;
+  }
+
+};
+
+
+class poisson_form_0: public ufc::form
+{
+public:
+
+  poisson_form_0() : ufc::form()
+  {
+    // Do nothing
+  }
+
+  ~poisson_form_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "189addc1337507b593b83849ffa1cefea9e7ba0b840b5af3bb4ed325cf87c935ed2d337a05c0528dfbcb3e32f08357e3ecbac8667972bf14678007bdaef7655d";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 2;
+  }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1681,8 +4832,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1701,126 +4851,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1834,14 +5020,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -1850,43 +5042,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1897,63 +5066,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1961,7 +5137,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -1991,14 +5167,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/multicore/cpp/compile.log b/bench/fem/multicore/cpp/compile.log
index 056ba06..6456228 100644
--- a/bench/fem/multicore/cpp/compile.log
+++ b/bench/fem/multicore/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,26 +13,35 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<3 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.0524149 seconds.
+Compiler stage 1 finished in 0.114909 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -41,7 +51,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000778 seconds
+  144 entries computed in 0.000984 seconds
   Shape of reference tensor: (4, 4, 3, 3)
   Primary multi index:   rank = 2 dims = [4, 4] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -49,119 +59,170 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   External multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00410509 seconds.
+Compiler stage 2 finished in 0.0115879 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000149965 seconds.
+Compiler stage 3 finished in 0.000221014 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.066766 seconds.
+Compiler stage 4 finished in 0.382844 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000363111 seconds.
+Compiler stage 4.1 finished in 0.000657797 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.00057292 seconds.
+Compiler stage 5 finished in 0.00102091 seconds.
 
-FFC finished in 0.124698 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.511856 seconds.
+Output written to ./Poisson.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form NavierStokes
 
@@ -240,11 +301,11 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 6
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0732131 seconds.
+Compiler stage 1 finished in 0.148725 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -255,10 +316,15 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -269,7 +335,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {4: {VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1.],
+  {4: {FiniteElement('Discontinuous Lagrange', tetrahedron, 0): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.]])}}}, VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1.],
           [ 0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.]],
   
@@ -525,7 +591,7 @@ Compiler stage 2: Computing intermediate representation
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
           [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00]]])}}}, FiniteElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.]])}}}}}
+             1.00000000e+00]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
@@ -1013,13 +1079,13 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.112627 seconds.
+Compiler stage 2 finished in 0.171326 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.0509951 seconds.
+Compiler stage 3 finished in 0.0906041 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
@@ -1028,349 +1094,152 @@ Compiler stage 4: Generating code
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Z
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: d_22
-  Removing unused variable: d_21
-  Removing unused variable: d_20
-  Removing unused variable: d_12
-  Removing unused variable: d_11
-  Removing unused variable: d_10
-  Removing unused variable: d_02
-  Removing unused variable: d_01
-  Removing unused variable: d_00
-  Removing unused variable: C2
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Z
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: d_22
+  Removing unused variable: d_21
+  Removing unused variable: d_20
+  Removing unused variable: d_12
+  Removing unused variable: d_11
+  Removing unused variable: d_10
+  Removing unused variable: d_02
+  Removing unused variable: d_01
+  Removing unused variable: d_00
+  Removing unused variable: C2
+  Removing unused variable: C1
+  Removing unused variable: C0
   Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: area
@@ -1387,18 +1256,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.257611 seconds.
+Compiler stage 4 finished in 0.363842 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000586987 seconds.
+Compiler stage 4.1 finished in 0.000751019 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./NavierStokes.h.
-Compiler stage 5 finished in 0.000830889 seconds.
+Compiler stage 5 finished in 0.00100088 seconds.
 
-FFC finished in 0.496198 seconds.
+FFC finished in 0.776749 seconds.
+Output written to ./NavierStokes.h.
diff --git a/bench/fem/multicore/cpp/main.cpp b/bench/fem/multicore/cpp/main.cpp
index 9228475..2a1fe93 100644
--- a/bench/fem/multicore/cpp/main.cpp
+++ b/bench/fem/multicore/cpp/main.cpp
@@ -39,7 +39,7 @@ class PoissonFactory
 {
   public:
 
-  static std::shared_ptr<Form> a(const Mesh& mesh)
+  static std::shared_ptr<Form> a(std::shared_ptr<const Mesh> mesh)
   {
     // Create function space
     std::shared_ptr<FunctionSpace> _V(new Poisson::FunctionSpace(mesh));
@@ -53,7 +53,7 @@ class NavierStokesFactory
 {
   public:
 
-  static std::shared_ptr<Form> a(const Mesh& mesh)
+  static std::shared_ptr<Form> a(std::shared_ptr<const Mesh> mesh)
   {
     std::shared_ptr<FunctionSpace> _V(new NavierStokes::FunctionSpace(mesh));
 
@@ -116,13 +116,15 @@ double bench(std::string form, std::shared_ptr<const Form> a)
 
 int main(int argc, char* argv[])
 {
+  info("Runtime of threaded assembly benchmark");
+
   // Parse command-line arguments
   parameters.parse(argc, argv);
 
   // Create mesh
-  UnitCubeMesh old_mesh(SIZE, SIZE, SIZE);
-  old_mesh.color("vertex");
-  Mesh mesh = old_mesh.renumber_by_color();
+  auto old_mesh = std::make_shared<UnitCubeMesh>(SIZE, SIZE, SIZE);
+  old_mesh->color("vertex");
+  auto mesh = std::make_shared<Mesh>(old_mesh->renumber_by_color());
 
   // Test cases
   std::vector<std::pair<std::string, std::shared_ptr<const Form> > > forms;
diff --git a/bench/fem/speedup/cpp/CMakeLists.txt b/bench/fem/speedup/cpp/CMakeLists.txt
index 8ab5598..1fca8af 100644
--- a/bench/fem/speedup/cpp/CMakeLists.txt
+++ b/bench/fem/speedup/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(bench_solve-poisson solve-poisson.cpp)
 add_executable(bench_assemble-poisson assemble-poisson.cpp)
diff --git a/bench/fem/speedup/cpp/Poisson.h b/bench/fem/speedup/cpp/Poisson.h
index 0d68df6..88de2b7 100644
--- a/bench/fem/speedup/cpp/Poisson.h
+++ b/bench/fem/speedup/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -257,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -279,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -318,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -330,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -339,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1041,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1098,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1106,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1132,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1171,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1219,151 +1222,92 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    case 3:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
   {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 4;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    case 3:
-      {
-        return 0;
+        return 3;
         break;
       }
     }
@@ -1371,279 +1315,3487 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    return 3;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-        break;
-      }
-    case 3:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-        break;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 3)
-    {
-    throw std::runtime_error("d is larger than dimension (3)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        
+        return 3;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  std::size_t reference_value_size() const final override
   {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
+    return 3;
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    27
-    // Number of operations (multiply-add pairs) for tensor contraction: 28
-    // Total number of operations (multiply-add pairs):                  58
-    
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
     double detJ;
     compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
-    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
-    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
-    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
-    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
-    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
-    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
-    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
-    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
-    // Compute element tensor
-    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
-    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
-    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
-    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
-    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
-    A[5] = 0.166666666666667*G0_0_0;
-    A[6] = 0.166666666666667*G0_0_1;
-    A[7] = 0.166666666666667*G0_0_2;
-    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
-    A[9] = 0.166666666666667*G0_1_0;
-    A[10] = 0.166666666666667*G0_1_1;
-    A[11] = 0.166666666666667*G0_1_2;
-    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
-    A[13] = 0.166666666666667*G0_2_0;
-    A[14] = 0.166666666666667*G0_2_1;
-    A[15] = 0.166666666666667*G0_2_2;
-  }
-
-};
-
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 3*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 9;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 3;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
+  }
+
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    27
+    // Number of operations (multiply-add pairs) for tensor contraction: 28
+    // Total number of operations (multiply-add pairs):                  58
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
+    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
+    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
+    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
+    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
+    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
+    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
+    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
+    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    
+    // Compute element tensor
+    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
+    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
+    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
+    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
+    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
+    A[5] = 0.166666666666667*G0_0_0;
+    A[6] = 0.166666666666667*G0_0_1;
+    A[7] = 0.166666666666667*G0_0_2;
+    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
+    A[9] = 0.166666666666667*G0_1_0;
+    A[10] = 0.166666666666667*G0_1_1;
+    A[11] = 0.166666666666667*G0_1_2;
+    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
+    A[13] = 0.166666666666667*G0_2_0;
+    A[14] = 0.166666666666667*G0_2_1;
+    A[15] = 0.166666666666667*G0_2_2;
+  }
+
+};
+
+
+class poisson_cell_integral_1_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_1_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    4
     // Number of operations (multiply-add pairs) for tensor contraction: 14
     // Total number of operations (multiply-add pairs):                  21
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1668,66 +4820,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_0()
+  ~poisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "0a1c8620c3fe3a9b075cccbf6831c3b71c838dae9d8115e7ca3bceb16e94994307b7af22c58a3329d1bc1bd249fd11fd8a0f9c8d23c6d43589322d9fc76fa890";
+    return "189addc1337507b593b83849ffa1cefea9e7ba0b840b5af3bb4ed325cf87c935ed2d337a05c0528dfbcb3e32f08357e3ecbac8667972bf14678007bdaef7655d";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1746,8 +4890,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1766,192 +4909,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "053c29b0c24f1ac3175b0cd77af28e3d3f6a58a66b7f57342ffa6a931a0130fb972afdcc2cd4d374109faff5696ad57c5820a436d946dc2f1f867d42659f57a9";
+    return "470381f6c50d836d63b6912c4a746c1a99cd16761099e4c805917a5cd062fe3d5fddfc0f6f28a8c3569d0963e530883569d351198336cf8b410d96d777e71761";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1970,8 +5141,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1990,126 +5160,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -2123,14 +5329,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -2139,43 +5351,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2186,43 +5375,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2233,63 +5399,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -2297,7 +5470,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -2327,57 +5500,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -2385,69 +5613,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2479,18 +5748,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/fem/speedup/cpp/assemble-poisson.cpp b/bench/fem/speedup/cpp/assemble-poisson.cpp
index 040787e..23eb45c 100644
--- a/bench/fem/speedup/cpp/assemble-poisson.cpp
+++ b/bench/fem/speedup/cpp/assemble-poisson.cpp
@@ -37,10 +37,10 @@ int main(int argc, char* argv[])
   int n = atoi(argv[1]);
 
   // Create mesh and function space
-  UnitCubeMesh mesh(n, n, n);
-  Poisson::FunctionSpace V(mesh);
+  auto mesh = std::make_shared<UnitCubeMesh>(n, n, n);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
 
-  const MPI_Comm comm = mesh.mpi_comm();
+  const MPI_Comm comm = mesh->mpi_comm();
 
   // Assemble matrix
   Poisson::BilinearForm a(V, V);
diff --git a/bench/fem/speedup/cpp/bench_fem_speedup_cpp b/bench/fem/speedup/cpp/bench_fem_speedup_cpp
index c695fce..b134894 100755
--- a/bench/fem/speedup/cpp/bench_fem_speedup_cpp
+++ b/bench/fem/speedup/cpp/bench_fem_speedup_cpp
@@ -37,7 +37,7 @@ def get_time(output):
     timing = []
     for line in lines:
         time = float(line.split(":")[-1])
-        name = line.split(":")[-2].strip("TIME").strip(None).replace("(", "").replace(")", "")
+        name = line.split(":")[-2].strip("Process 0: ").strip("TIME").strip(None).replace("(", "").replace(")", "")
         timing.append( (name, time) )
     return timing
 
@@ -69,5 +69,8 @@ print "solve"
 for test1, test2  in zip(solve_t1, solve_t2):
     print "  ", test1[0] + ":", test1[1]/test2[1]
 
-print "BENCH assembly", assembly_t1[0][1] / assembly_t2[0][1] + assembly_t1[1][1] / assembly_t2[1][1]
-print "BENCH solve", solve_t1[0][1] / solve_t2[0][1]
+print "BENCH assembly_1st", assembly_t1[0][1] / assembly_t2[0][1]
+print "BENCH assembly_2nd", assembly_t1[1][1] / assembly_t2[1][1]
+print "BENCH solve_1st", solve_t1[0][1] / solve_t2[0][1]
+print "BENCH solve_same_pc_pattern", solve_t1[1][1] / solve_t2[2][1]
+print "BENCH solve_same_pc", solve_t1[2][1] / solve_t2[2][1]
diff --git a/bench/fem/speedup/cpp/compile.log b/bench/fem/speedup/cpp/compile.log
index 4b2b518..b4badd4 100644
--- a/bench/fem/speedup/cpp/compile.log
+++ b/bench/fem/speedup/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<3 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -30,8 +31,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<3 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -39,18 +40,27 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.057986 seconds.
+Compiler stage 1 finished in 0.110322 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -60,7 +70,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000791 seconds
+  144 entries computed in 0.000883 seconds
   Shape of reference tensor: (4, 4, 3, 3)
   Primary multi index:   rank = 2 dims = [4, 4] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -68,6 +78,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   External multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -75,7 +86,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  16 entries computed in 0.000706 seconds
+  16 entries computed in 0.000811 seconds
   Shape of reference tensor: (4, 4)
   Primary multi index:   rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   Secondary multi index: rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
@@ -83,114 +94,164 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00608206 seconds.
+Compiler stage 2 finished in 0.012223 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000159979 seconds.
+Compiler stage 3 finished in 0.000241041 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0740092 seconds.
+Compiler stage 4 finished in 0.292009 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000610113 seconds.
+Compiler stage 4.1 finished in 0.000874043 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000687122 seconds.
+Compiler stage 5 finished in 0.00111794 seconds.
 
-FFC finished in 0.139885 seconds.
+FFC finished in 0.417286 seconds.
+Output written to ./Poisson.h.
diff --git a/bench/fem/speedup/cpp/solve-poisson.cpp b/bench/fem/speedup/cpp/solve-poisson.cpp
index c7ff7dd..bbb3e3d 100644
--- a/bench/fem/speedup/cpp/solve-poisson.cpp
+++ b/bench/fem/speedup/cpp/solve-poisson.cpp
@@ -28,10 +28,8 @@ using namespace dolfin;
 
 int main(int argc, char* argv[])
 {
-
   #ifdef HAS_PETSC
 
-  //parameters["mesh_partitioner"] = "SCOTCH";
   parameters["linear_algebra_backend"] = "PETSc";
 
   // Parse command-line arguments
@@ -43,37 +41,27 @@ int main(int argc, char* argv[])
   int n = atoi(argv[1]);
 
   // Create mesh and function space
-  UnitCubeMesh mesh(n, n, n);
-  Poisson::FunctionSpace V(mesh);
+  auto mesh = std::make_shared<UnitCubeMesh>(n, n, n);
+  auto V = std::make_shared<const Poisson::FunctionSpace>(mesh);
 
   // MPI communicator
-  const MPI_Comm comm = mesh.mpi_comm();
+  const MPI_Comm comm = mesh->mpi_comm();
 
   // Define boundary condition
-  Constant u0(0.0);
-  DomainBoundary boundary;
+  auto u0 = std::make_shared<const Constant>(0.0);
+  auto boundary = std::make_shared<const DomainBoundary>();
   DirichletBC bc(V, u0, boundary);
 
   // Define variational problem
   Poisson::BilinearForm a(V, V);
   Poisson::LinearForm L(V);
-  Constant f(1.0);
+  auto f= std::make_shared<Constant>(1.0);
   L.f = f;
   Function u(V);
 
-  // Create preconditioner and linear solver
-  //TrilinosPreconditioner pc("amg_ml");
-  //PETScPreconditioner pc("amg_hypre");
-  //PETScPreconditioner pc("amg_ml");
-  //PETScKrylovSolver solver("gmres", pc);
-
-  // Pick solver; UMFPACK runs out of memory even on 24GB RAM machine
-  std::string method = "lu";
-  if (has_lu_solver_method("mumps"))
-    method = "mumps";
-  else if (has_lu_solver_method("superlu_dist"))
-    method = "superlu_dist";
-  PETScLUSolver solver(method);
+  // Prepare iterative solver
+  const auto pc = std::make_shared<PETScPreconditioner>("petsc_amg");
+  PETScKrylovSolver solver("cg", pc);
 
   // Assemble matrix and vector, and apply Dirichlet boundary conditions
   Matrix A;
@@ -81,6 +69,7 @@ int main(int argc, char* argv[])
   assemble(A, a);
   assemble(b, L);
   bc.apply(A, b);
+  bc.apply(*u.vector());
 
   // Solve linear system
   dolfin::MPI::barrier(comm);
@@ -93,7 +82,7 @@ int main(int argc, char* argv[])
 
   // Solve linear system (preconditioner assuming same non-zero pattern)
   if (solver.parameters.has_key("preconditioner"))
-      solver.parameters("preconditioner")["same_nonzero_pattern"] = true;
+    solver.parameters("preconditioner")["structure"] = "same_nonzero_pattern";
   u.vector()->zero();
   dolfin::MPI::barrier(comm);
   t = time();
@@ -105,7 +94,7 @@ int main(int argc, char* argv[])
 
   // Solve linear system (re-use preconditioner)
   if (solver.parameters.has_key("preconditioner"))
-    solver.parameters("preconditioner")["reuse"] = true;
+    solver.parameters("preconditioner")["structure"] = "same";
   u.vector()->zero();
   dolfin::MPI::barrier(comm);
   t = time();
diff --git a/bench/function/evaluation/cpp/CMakeLists.txt b/bench/function/evaluation/cpp/CMakeLists.txt
index f2bddd4..beec0d1 100644
--- a/bench/function/evaluation/cpp/CMakeLists.txt
+++ b/bench/function/evaluation/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/function/evaluation/cpp/P1.h b/bench/function/evaluation/cpp/P1.h
index 4c617f9..6cf0d1d 100644
--- a/bench/function/evaluation/cpp/P1.h
+++ b/bench/function/evaluation/cpp/P1.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __P1_H
 #define __P1_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class p1_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   p1_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_finite_element_0()
+  ~p1_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -257,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -279,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -318,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -330,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -339,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1041,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1098,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1106,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1132,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1171,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1219,69 +1222,61 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new p1_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class p1_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   p1_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_dofmap_0()
+  ~p1_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1310,39 +1305,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1371,20 +1355,18 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1420,9 +1402,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -1483,38 +1464,18 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new p1_dofmap_0();
   }
@@ -1528,14 +1489,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace P1
 {
@@ -1544,43 +1511,20 @@ class FunctionSpace: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
diff --git a/bench/function/evaluation/cpp/compile.log b/bench/function/evaluation/cpp/compile.log
index 1a5a115..ccc3567 100644
--- a/bench/function/evaluation/cpp/compile.log
+++ b/bench/function/evaluation/cpp/compile.log
@@ -1,28 +1,31 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling element P1
 
-Compiler stage 1: Analyzing form(s)
------------------------------------
+Compiler stage 1: Analyzing elements(s)
+---------------------------------------
   
-Compiler stage 1 finished in 0.00019908 seconds.
+Compiler stage 1 finished in 0.000848055 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
   Computing representation of 1 elements
   Reusing element from cache
+  Reusing element from cache
   Computing representation of 1 dofmaps
   Reusing element from cache
+  Computing representation of 0 coordinate mappings
   Computing representation of integrals
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0376699 seconds.
+Compiler stage 2 finished in 0.121559 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000133991 seconds.
+Compiler stage 3 finished in 0.000223875 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
@@ -31,98 +34,51 @@ Compiler stage 4: Generating code
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 1 dofmap(s)
+  Generating code for 0 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0641098 seconds.
+Compiler stage 4 finished in 0.110609 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000227928 seconds.
+Compiler stage 4.1 finished in 0.000612974 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./P1.h.
-Compiler stage 5 finished in 0.000528097 seconds.
+Compiler stage 5 finished in 0.000749826 seconds.
 
-FFC finished in 0.103189 seconds.
+FFC finished in 0.235322 seconds.
+Output written to ./P1.h.
diff --git a/bench/function/evaluation/cpp/main.cpp b/bench/function/evaluation/cpp/main.cpp
index a474eac..dfb9c4a 100644
--- a/bench/function/evaluation/cpp/main.cpp
+++ b/bench/function/evaluation/cpp/main.cpp
@@ -36,8 +36,6 @@ public:
 
 };
 
-#ifdef HAS_CGAL
-
 int main(int argc, char* argv[])
 {
   not_working_in_parallel("Function evalutation benchmark");
@@ -51,9 +49,9 @@ int main(int argc, char* argv[])
   tic();
   for (std::size_t N = 10; N < mesh_max_size; N += 2)
   {
-    UnitCubeMesh mesh(N, N, N);
+    const auto mesh = std::make_shared<const UnitCubeMesh>(N, N, N);
 
-    P1::FunctionSpace V0(mesh);
+    const auto V0 = std::make_shared<const P1::FunctionSpace>(mesh);
     Function f0(V0);
     F f;
     f0.interpolate(f);
@@ -80,13 +78,3 @@ int main(int argc, char* argv[])
 
   return 0;
 }
-
-#else
-
-int main()
-{
-  info("DOLFIN must be compiled with CGAL to run function eval benchmark.");
-  return 0;
-}
-
-#endif
diff --git a/bench/function/extrapolation/python/bench_function_extrapolation_python b/bench/function/extrapolation/python/bench_function_extrapolation_python
index 5414f12..0472969 100755
--- a/bench/function/extrapolation/python/bench_function_extrapolation_python
+++ b/bench/function/extrapolation/python/bench_function_extrapolation_python
@@ -26,10 +26,15 @@ from dolfin import *
 from time import time
 
 SIZE = 4
+
+info("Extrapolation from P2*dP1 to P3*dP2 on UnitCubeMesh(%d, %d, %d)"
+     % (SIZE, SIZE, SIZE))
+
 mesh = UnitCubeMesh(SIZE, SIZE, SIZE)
+cell = mesh.ufl_cell()
 
-V = VectorFunctionSpace(mesh, "CG", 2) * FunctionSpace(mesh, "DG", 1)
-W = VectorFunctionSpace(mesh, "CG", 3) * FunctionSpace(mesh, "DG", 2)
+V = FunctionSpace(mesh, VectorElement("CG", cell, 2) * FiniteElement("DG", cell, 1))
+W = FunctionSpace(mesh, VectorElement("CG", cell, 3) * FiniteElement("DG", cell, 2))
 
 u = Expression(("sin(x[0])", "1.0", "x[0]*x[1]", "0.0"), degree=3)
 u = interpolate(u, V)
diff --git a/bench/function/interpolation/python/bench_function_interpolation_python b/bench/function/interpolation/python/bench_function_interpolation_python
index 4fdb13a..132e554 100755
--- a/bench/function/interpolation/python/bench_function_interpolation_python
+++ b/bench/function/interpolation/python/bench_function_interpolation_python
@@ -25,14 +25,13 @@
 from dolfin import *
 from time import time
 
-# FIXME: Temporary testing
-import sys
-if len(sys.argv) == 2 and sys.argv[1] == "DOLFIN":
-    parameters["use_cgal_intersection"] = False
-
 SIZE_0 = 21 #71
 SIZE_1 = 23 #73
 
+info("Extrapolation from P1 on UnitCubeMesh(%d, %d, %d) to "
+     "P1 on UnitCubeMesh(%d, %d, %d)"
+     % (SIZE_0, SIZE_0, SIZE_0, SIZE_1, SIZE_1, SIZE_1))
+
 parameters["allow_extrapolation"] = True
 
 mesh_0 = UnitCubeMesh(SIZE_0, SIZE_0, SIZE_0)
@@ -47,6 +46,4 @@ tic = time()
 v1 = interpolate(v0, V1)
 t = time() - tic
 
-plot(v1, interactive=True)
-
 print "BENCH: ", t
diff --git a/bench/geometry/bounding_box_tree_build/cpp/CMakeLists.txt b/bench/geometry/bounding_box_tree_build/cpp/CMakeLists.txt
index 3622fc8..d7fb8c7 100644
--- a/bench/geometry/bounding_box_tree_build/cpp/CMakeLists.txt
+++ b/bench/geometry/bounding_box_tree_build/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/geometry/bounding_box_tree_build/cpp/main.cpp b/bench/geometry/bounding_box_tree_build/cpp/main.cpp
index 7334155..7e526a8 100644
--- a/bench/geometry/bounding_box_tree_build/cpp/main.cpp
+++ b/bench/geometry/bounding_box_tree_build/cpp/main.cpp
@@ -30,6 +30,9 @@ using namespace dolfin;
 
 int main(int argc, char* argv[])
 {
+  info("Build bounding box tree on UnitCubeMesh(%d, %d, %d)",
+       SIZE, SIZE, SIZE);
+
   // Create mesh
   UnitCubeMesh mesh(SIZE, SIZE, SIZE);
 
diff --git a/bench/geometry/bounding_box_tree_compute_closest_entity/cpp/CMakeLists.txt b/bench/geometry/bounding_box_tree_compute_closest_entity/cpp/CMakeLists.txt
index dd596fd..5663272 100644
--- a/bench/geometry/bounding_box_tree_compute_closest_entity/cpp/CMakeLists.txt
+++ b/bench/geometry/bounding_box_tree_compute_closest_entity/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/geometry/bounding_box_tree_compute_closest_entity/cpp/main.cpp b/bench/geometry/bounding_box_tree_compute_closest_entity/cpp/main.cpp
index 446db83..bd0e085 100644
--- a/bench/geometry/bounding_box_tree_compute_closest_entity/cpp/main.cpp
+++ b/bench/geometry/bounding_box_tree_compute_closest_entity/cpp/main.cpp
@@ -30,6 +30,9 @@ using namespace dolfin;
 
 int main(int argc, char* argv[])
 {
+  info("Compute closest entity on UnitCubeMesh(%d, %d, %d)",
+       SIZE, SIZE, SIZE);
+
   // Create mesh
   UnitCubeMesh mesh(SIZE, SIZE, SIZE);
 
diff --git a/bench/geometry/bounding_box_tree_compute_entity_collisions/cpp/CMakeLists.txt b/bench/geometry/bounding_box_tree_compute_entity_collisions/cpp/CMakeLists.txt
index 46ad1ba..d8defe9 100644
--- a/bench/geometry/bounding_box_tree_compute_entity_collisions/cpp/CMakeLists.txt
+++ b/bench/geometry/bounding_box_tree_compute_entity_collisions/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/geometry/bounding_box_tree_compute_entity_collisions/cpp/main.cpp b/bench/geometry/bounding_box_tree_compute_entity_collisions/cpp/main.cpp
index 3f17b14..63fc106 100644
--- a/bench/geometry/bounding_box_tree_compute_entity_collisions/cpp/main.cpp
+++ b/bench/geometry/bounding_box_tree_compute_entity_collisions/cpp/main.cpp
@@ -30,6 +30,9 @@ using namespace dolfin;
 
 int main(int argc, char* argv[])
 {
+  info("Compute entity collisions on UnitCubeMesh(%d, %d, %d)",
+       SIZE, SIZE, SIZE);
+
   // Create mesh
   UnitCubeMesh mesh(SIZE, SIZE, SIZE);
 
diff --git a/bench/la/cusp/python/bench_la_cusp_python b/bench/la/cusp/python/bench_la_cusp_python
deleted file mode 100755
index 12e739b..0000000
--- a/bench/la/cusp/python/bench_la_cusp_python
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2012 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2012-03-09
-# Last changed: 2012-04-25
-
-from dolfin import *
-from time import time
-
-SIZE = 32
-NUM_REPS = 3
-
-print "Solving the linear system for Poisson's equation using PETSc CUSP"
-
-# Check that we have the PETSc Cusp backend
-if not has_linear_algebra_backend("PETScCusp"):
-    print "Cannot run this benchmark since PETSc Cusp is not available."
-    print "BENCH: 0.0"
-    exit(0)
-
-# Function for running test
-def run_bench(linear_algebra_backend):
-
-    info("")
-    info("Linear algebra backend: %s" % linear_algebra_backend)
-
-    # Set linear algebra backend
-    parameters["linear_algebra_backend"] = linear_algebra_backend
-
-    # Create matrix and vector
-    print "Assembling matrix and vector"
-    mesh = UnitCube(SIZE, SIZE, SIZE)
-    V = FunctionSpace(mesh, "Lagrange", 1)
-    u = TrialFunction(V)
-    v = TestFunction(V)
-    f = Constant(1.0)
-    a = dot(grad(u), grad(v))*dx
-    L = f*v*dx
-    bc = DirichletBC(V, 0.0, DomainBoundary())
-    A, b = assemble_system(a, L, bc)
-
-    # Create linear solver
-    solver = KrylovSolver("cg", "jacobi")
-
-    # Use hack to get around PETSc Cusp bug
-    solver.parameters["use_petsc_cusp_hack"] = True
-
-    # Solve linear system
-    info("Solving linear system %d times" % NUM_REPS)
-    x = Vector()
-    cpu_time = time()
-    for i in range(NUM_REPS):
-        x.zero()
-        solver.solve(A, x, b)
-        print "residual =", residual(A, x, b)
-    cpu_time = (time() - cpu_time) / float(NUM_REPS)
-
-    return cpu_time
-
-# Run benchmarks
-cpu_time_petsc_cusp = run_bench("PETScCusp")
-cpu_time_petsc      = run_bench("PETSc")
-
-# Compute speedup
-speedup = cpu_time_petsc / cpu_time_petsc_cusp
-
-# Report results
-print
-print "PETSc:     ", cpu_time_petsc
-print "PETSc Cusp:", cpu_time_petsc_cusp
-print "Speedup:   ", speedup
-print
-
-print "BENCH: ", speedup
diff --git a/bench/la/vector/access/cpp/CMakeLists.txt b/bench/la/vector/access/cpp/CMakeLists.txt
index a34a941..d36466c 100644
--- a/bench/la/vector/access/cpp/CMakeLists.txt
+++ b/bench/la/vector/access/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/la/vector/assignment/cpp/CMakeLists.txt b/bench/la/vector/assignment/cpp/CMakeLists.txt
index 355f04a..f749bb2 100644
--- a/bench/la/vector/assignment/cpp/CMakeLists.txt
+++ b/bench/la/vector/assignment/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/logs/bench.log b/bench/logs/bench.log
index 16d86ce..f15b489 100644
--- a/bench/logs/bench.log
+++ b/bench/logs/bench.log
@@ -5,6 +5,7 @@
 (2008, 4, 30, 14, 13, 34) mesh-unitcube-cpp 6.08171 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
 (2008, 4, 30, 14, 14, 50) mesh-refinement-cpp 75.8 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
 (2008, 4, 30, 14, 15, 5) mesh-iteration-cpp 14.4 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2008, 4, 30, 14, 38, 58) common-progress-cpp 526.775 "Creating progress bar with 500000000 steps (5 repetitions)"
 (2008, 6, 23, 14, 18, 43) la-vector-access-cpp 15.0198 "Accessing vector of size 10000000 (100 repetitions)"
 (2008, 6, 23, 14, 19, 4) la-vector-assignment-cpp 20.8082 "Assigning to vector of size 10000000 (100 repetitions)"
 (2008, 6, 23, 14, 19, 5) fem-jit-python 5.6982e-06 "JIT compilation (in memory cache)"
@@ -13,6 +14,7 @@
 (2008, 6, 23, 14, 21, 49) mesh-unitcube-cpp 5.86431 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
 (2008, 6, 23, 14, 23, 5) mesh-refinement-cpp 75.54 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
 (2008, 6, 23, 14, 23, 20) mesh-iteration-cpp 14.43 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2008, 6, 23, 14, 25, 4) common-progress-cpp 520.776 "Creating progress bar with 500000000 steps (5 repetitions)"
 (2008, 10, 20, 14, 31, 31) la-vector-access-cpp 14.8214 "Accessing vector of size 10000000 (100 repetitions)"
 (2008, 10, 20, 14, 31, 52) la-vector-assignment-cpp 20.3453 "Assigning to vector of size 10000000 (100 repetitions)"
 (2008, 10, 20, 14, 31, 57) fem-jit-python 9.65118e-05 "JIT compilation (in memory cache)"
@@ -21,6 +23,7 @@
 (2008, 10, 20, 14, 36, 34) mesh-unitcube-cpp 6.17667 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
 (2008, 10, 20, 14, 37, 50) mesh-refinement-cpp 75.76 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
 (2008, 10, 20, 14, 38, 5) mesh-iteration-cpp 13.98 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2008, 10, 20, 14, 5, 48) common-progress-cpp 520.887 "Creating progress bar with 500000000 steps (5 repetitions)"
 (2009, 1, 5, 14, 40, 18) la-vector-access-cpp 15.5729 "Accessing vector of size 10000000 (100 repetitions)"
 (2009, 1, 5, 14, 40, 37) la-vector-assignment-cpp 19.2912 "Assigning to vector of size 10000000 (100 repetitions)"
 (2009, 1, 5, 14, 40, 42) fem-jit-python 9.86099e-05 "JIT compilation (in memory cache)"
@@ -29,6 +32,7 @@
 (2009, 1, 5, 14, 45, 52) mesh-unitcube-cpp 37.4356 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
 (2009, 1, 5, 14, 47, 14) mesh-refinement-cpp 81.26 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
 (2009, 1, 5, 14, 47, 32) mesh-iteration-cpp 13.98 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2009, 1, 5, 13, 51, 51) common-progress-cpp 511.406 "Creating progress bar with 500000000 steps (5 repetitions)"
 (2009, 2, 17, 14, 50, 21) la-vector-access-cpp 14.8237 "Accessing vector of size 10000000 (100 repetitions)"
 (2009, 2, 17, 14, 50, 41) la-vector-assignment-cpp 20.2998 "Assigning to vector of size 10000000 (100 repetitions)"
 (2009, 2, 17, 14, 50, 46) fem-jit-python 0.00846782 "JIT compilation (in memory cache)"
@@ -37,6 +41,7 @@
 (2009, 2, 17, 14, 55, 59) mesh-unitcube-cpp 38.0645 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
 (2009, 2, 17, 14, 57, 22) mesh-refinement-cpp 82.32 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
 (2009, 2, 17, 14, 57, 40) mesh-iteration-cpp 13.98 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2009, 2, 17, 13, 36, 44) common-progress-cpp 520.814 "Creating progress bar with 500000000 steps (5 repetitions)"
 (2009, 4, 7, 15, 0, 43) la-vector-access-cpp 15.8316 "Accessing vector of size 10000000 (100 repetitions)"
 (2009, 4, 7, 15, 1, 2) la-vector-assignment-cpp 19.2988 "Assigning to vector of size 10000000 (100 repetitions)"
 (2009, 4, 7, 15, 1, 7) fem-jit-python 0.00636039 "JIT compilation (in memory cache)"
@@ -45,107 +50,17343 @@
 (2009, 4, 7, 15, 12, 0) mesh-unitcube-cpp 38.1176 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
 (2009, 4, 7, 15, 13, 22) mesh-refinement-cpp 82.04 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
 (2009, 4, 7, 15, 13, 40) mesh-iteration-cpp 13.97 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
-(2009, 9, 26, 11, 43, 12) la-vector-access-cpp 46.0397 "Accessing vector of size 10000000 (100 repetitions)"
-(2009, 9, 26, 11, 43, 35) la-vector-assignment-cpp 22.3038 "Assigning to vector of size 10000000 (100 repetitions)"
-(2009, 9, 26, 11, 43, 38) fem-jit-python 0.00593891 "JIT compilation (in memory cache)"
-(2009, 9, 26, 11, 50, 46) fem-speedup-cpp 427.872 "Assembly/solve speedup running on 4 processors"
-(2009, 9, 26, 11, 50, 46) fem-speedup-cpp-assembly 2.38776 "Assembly/solve speedup running on 4 processors (assembly)"
-(2009, 9, 26, 11, 50, 46) fem-speedup-cpp-solve 1.73264 "Assembly/solve speedup running on 4 processors (solve)"
-(2009, 9, 26, 11, 51, 15) fem-convergence-cpp 28.4034 "Solving Poisson's equation in 2D for q = 1, n = 2."
-(2009, 9, 26, 11, 58, 24) fem-assembly-cpp 428.812 "Assembly for various forms and backends"
-(2009, 9, 26, 11, 59, 4) mesh-unitcube-cpp 40.7715 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
-(2009, 9, 26, 12, 0, 50) mesh-refinement-cpp 106.01 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
-(2009, 9, 26, 12, 1, 31) mesh-iteration-cpp 35.84 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
-(2009, 9, 26, 12, 1, 52) function-evaluation-cpp 21.8595 "Evaluations of functions at arbitrary points."
-(2009, 9, 26, 12, 1, 52) function-evaluation-cpp 21.74 "Evaluations of functions at arbitrary points."
-(2009, 10, 12, 13, 4, 9) la-vector-access-cpp 51.7174 "Accessing vector of size 10000000 (100 repetitions)"
-(2009, 10, 12, 13, 4, 33) la-vector-assignment-cpp 23.85 "Assigning to vector of size 10000000 (100 repetitions)"
-(2009, 10, 12, 13, 4, 37) fem-jit-python 0.0057328 "JIT compilation (in memory cache)"
-(2009, 10, 12, 13, 13, 2) fem-speedup-cpp 505.45 "Assembly/solve speedup running on 4 processors"
-(2009, 10, 12, 13, 13, 2) fem-speedup-cpp-assembly 2.48958 "Assembly/solve speedup running on 4 processors (assembly)"
-(2009, 10, 12, 13, 13, 2) fem-speedup-cpp-solve 2.27064 "Assembly/solve speedup running on 4 processors (solve)"
-(2009, 10, 12, 13, 13, 31) fem-convergence-cpp 28.1976 "Solving Poisson's equation in 2D for q = 1, n = 2."
-(2009, 10, 12, 13, 20, 34) fem-assembly-cpp 423.846 "Assembly for various forms and backends"
-(2009, 10, 12, 13, 21, 16) mesh-unitcube-cpp 41.0422 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
-(2009, 10, 12, 13, 23, 1) mesh-refinement-cpp 105.34 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
-(2009, 10, 12, 13, 23, 41) mesh-iteration-cpp 36.28 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
-(2009, 10, 12, 13, 24, 2) function-evaluation-cpp 20.9444 "Evaluations of functions at arbitrary points."
-(2009, 10, 12, 13, 24, 2) function-evaluation-cpp 20.86 "Evaluations of functions at arbitrary points."
-(2009, 12, 4, 13, 32, 55) la-vector-access-cpp 48.7269 "Accessing vector of size 10000000 (100 repetitions)"
-(2009, 12, 4, 13, 33, 17) la-vector-assignment-cpp 21.8355 "Assigning to vector of size 10000000 (100 repetitions)"
-(2009, 12, 4, 13, 33, 20) fem-jit-python 0.0060514 "JIT compilation (in memory cache)"
-(2009, 12, 4, 13, 41, 51) fem-speedup-cpp 510.404 "Assembly/solve speedup running on 4 processors"
-(2009, 12, 4, 13, 41, 51) fem-speedup-cpp-assembly 2.25234 "Assembly/solve speedup running on 4 processors (assembly)"
-(2009, 12, 4, 13, 41, 51) fem-speedup-cpp-solve 2.30526 "Assembly/solve speedup running on 4 processors (solve)"
-(2009, 12, 4, 13, 42, 19) fem-convergence-cpp 27.954 "Solving Poisson's equation in 2D for q = 1, n = 2."
-(2009, 12, 4, 13, 49, 34) fem-assembly-cpp 434.896 "Assembly for various forms and backends"
-(2009, 12, 4, 13, 50, 14) mesh-unitcube-cpp 40.4804 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
-(2009, 12, 4, 13, 52, 3) mesh-refinement-cpp 109.09 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
-(2009, 12, 4, 13, 52, 43) mesh-iteration-cpp 35.82 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
-(2009, 12, 4, 13, 53, 4) function-evaluation-cpp 20.7841 "Evaluations of functions at arbitrary points."
-(2009, 12, 4, 13, 53, 4) function-evaluation-cpp 20.7 "Evaluations of functions at arbitrary points."
-(2010, 2, 3, 14, 2, 51) la-vector-access-cpp 55.332 "Accessing vector of size 10000000 (100 repetitions)"
-(2010, 2, 3, 14, 3, 13) la-vector-assignment-cpp 21.8265 "Assigning to vector of size 10000000 (100 repetitions)"
-(2010, 2, 3, 14, 3, 17) fem-jit-python 0.0240756 "JIT compilation (in memory cache)"
-(2010, 2, 3, 14, 11, 34) fem-speedup-cpp 497.496 "Assembly/solve speedup running on 4 processors"
-(2010, 2, 3, 14, 11, 34) fem-speedup-cpp-assembly 1.95726 "Assembly/solve speedup running on 4 processors (assembly)"
-(2010, 2, 3, 14, 11, 34) fem-speedup-cpp-solve 2.28999 "Assembly/solve speedup running on 4 processors (solve)"
-(2010, 2, 3, 14, 11, 49) fem-convergence-cpp 14.6188 "Solving Poisson's equation in 2D for q = 1, n = 2."
-(2010, 2, 3, 14, 19, 12) fem-assembly-cpp 442.546 "Assembly for various forms and backends"
-(2010, 2, 3, 14, 19, 53) mesh-unitcube-cpp 40.8975 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
-(2010, 2, 3, 14, 21, 38) mesh-refinement-cpp 104.77 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
-(2010, 2, 3, 14, 22, 17) mesh-iteration-cpp 35.36 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
-(2010, 2, 3, 14, 22, 39) function-evaluation-cpp 22.0025 "Evaluations of functions at arbitrary points."
-(2010, 2, 3, 14, 22, 39) function-evaluation-cpp 21.89 "Evaluations of functions at arbitrary points."
-(2010, 2, 17, 14, 29, 56) la-vector-access-cpp 54.1729 "Accessing vector of size 10000000 (100 repetitions)"
-(2010, 2, 17, 14, 30, 18) la-vector-assignment-cpp 21.8163 "Assigning to vector of size 10000000 (100 repetitions)"
-(2010, 2, 17, 14, 30, 21) fem-jit-python 0.0254639 "JIT compilation (in memory cache)"
-(2010, 2, 17, 14, 37, 29) fem-speedup-cpp 427.685 "Assembly/solve speedup running on 4 processors"
-(2010, 2, 17, 14, 37, 29) fem-speedup-cpp-assembly 2.20183 "Assembly/solve speedup running on 4 processors (assembly)"
-(2010, 2, 17, 14, 37, 29) fem-speedup-cpp-solve 1.66403 "Assembly/solve speedup running on 4 processors (solve)"
-(2010, 2, 17, 14, 37, 44) fem-convergence-cpp 14.9222 "Solving Poisson's equation in 2D for q = 1, n = 2."
-(2010, 2, 17, 14, 45, 6) fem-assembly-cpp 441.941 "Assembly for various forms and backends"
-(2010, 2, 17, 14, 45, 47) mesh-unitcube-cpp 40.4403 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
-(2010, 2, 17, 14, 47, 30) mesh-refinement-cpp 103.46 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
-(2010, 2, 17, 14, 48, 10) mesh-iteration-cpp 35.36 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
-(2010, 2, 17, 14, 48, 32) function-evaluation-cpp 21.7258 "Evaluations of functions at arbitrary points."
-(2010, 2, 17, 14, 48, 32) function-evaluation-cpp 21.65 "Evaluations of functions at arbitrary points."
-(2010, 6, 19, 19, 52, 6) la-vector-access-cpp 48.4456 "Accessing vector of size 10000000 (100 repetitions)"
-(2010, 6, 19, 19, 52, 29) la-vector-assignment-cpp 22.5369 "Assigning to vector of size 10000000 (100 repetitions)"
-(2010, 6, 19, 19, 52, 30) fem-jit-python 0.0248256 "JIT compilation (in memory cache)"
-(2010, 6, 19, 19, 55, 12) fem-speedup-cpp 162.58 "Assembly/solve speedup running on 4 processors"
-(2010, 6, 19, 19, 55, 12) fem-speedup-cpp-assembly 2.52128 "Assembly/solve speedup running on 4 processors (assembly)"
-(2010, 6, 19, 19, 55, 12) fem-speedup-cpp-solve 1.67775 "Assembly/solve speedup running on 4 processors (solve)"
-(2010, 6, 19, 19, 55, 25) fem-convergence-cpp 13.031 "Solving Poisson's equation in 2D for q = 1, n = 2."
-(2010, 6, 19, 19, 59, 43) fem-assembly-cpp 257.852 "Assembly for various forms and backends"
-(2010, 6, 19, 20, 0, 24) mesh-unitcube-cpp 40.8275 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
-(2010, 6, 19, 20, 2, 9) mesh-refinement-cpp 105.19 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
-(2010, 6, 19, 20, 2, 49) mesh-iteration-cpp 35.39 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
-(2010, 6, 19, 20, 3, 11) function-evaluation-cpp 21.7684 "Evaluations of functions at arbitrary points."
-(2010, 6, 19, 20, 3, 11) function-evaluation-cpp 21.69 "Evaluations of functions at arbitrary points."
-(2010, 6, 20, 1, 3, 51) la-vector-access-cpp 48.4401 "Accessing vector of size 10000000 (100 repetitions)"
-(2010, 6, 20, 1, 4, 14) la-vector-assignment-cpp 23.8249 "Assigning to vector of size 10000000 (100 repetitions)"
-(2010, 6, 20, 1, 4, 16) fem-jit-python 0.024965 "JIT compilation (in memory cache)"
-(2010, 6, 20, 1, 6, 56) fem-speedup-cpp 160.021 "Assembly/solve speedup running on 4 processors"
-(2010, 6, 20, 1, 6, 56) fem-speedup-cpp-assembly 2.49474 "Assembly/solve speedup running on 4 processors (assembly)"
-(2010, 6, 20, 1, 6, 56) fem-speedup-cpp-solve 1.66284 "Assembly/solve speedup running on 4 processors (solve)"
-(2010, 6, 20, 1, 7, 8) fem-convergence-cpp 12.7508 "Solving Poisson's equation in 2D for q = 1, n = 2."
-(2010, 6, 20, 1, 11, 30) fem-assembly-cpp 261.657 "Assembly for various forms and backends"
-(2010, 6, 20, 1, 12, 11) mesh-unitcube-cpp 40.9106 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
-(2010, 6, 20, 1, 13, 56) mesh-refinement-cpp 105.5 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
-(2010, 6, 20, 1, 14, 36) mesh-iteration-cpp 35.35 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
-(2010, 6, 20, 1, 14, 58) function-evaluation-cpp 21.8163 "Evaluations of functions at arbitrary points."
-(2010, 6, 20, 1, 14, 58) function-evaluation-cpp 21.74 "Evaluations of functions at arbitrary points."
-(2010, 6, 21, 1, 4, 0) la-vector-access-cpp 48.4561 "Accessing vector of size 10000000 (100 repetitions)"
-(2010, 6, 21, 1, 4, 21) la-vector-assignment-cpp 21.824 "Assigning to vector of size 10000000 (100 repetitions)"
-(2010, 6, 21, 1, 4, 25) fem-jit-python 0.0251855 "JIT compilation (in memory cache)"
-(2010, 6, 21, 1, 7, 4) fem-speedup-cpp 159.221 "Assembly/solve speedup running on 4 processors"
-(2010, 6, 21, 1, 7, 4) fem-speedup-cpp-assembly 2.52128 "Assembly/solve speedup running on 4 processors (assembly)"
-(2010, 6, 21, 1, 7, 4) fem-speedup-cpp-solve 1.70657 "Assembly/solve speedup running on 4 processors (solve)"
-(2010, 6, 21, 1, 7, 17) fem-convergence-cpp 13.4156 "Solving Poisson's equation in 2D for q = 1, n = 2."
-(2010, 6, 21, 1, 11, 39) fem-assembly-cpp 261.596 "Assembly for various forms and backends"
-(2010, 6, 21, 1, 12, 20) mesh-unitcube-cpp 40.932 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
-(2010, 6, 21, 1, 14, 5) mesh-refinement-cpp 104.98 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
-(2010, 6, 21, 1, 14, 44) mesh-iteration-cpp 35.36 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
-(2010, 6, 21, 1, 15, 6) function-evaluation-cpp 21.8412 "Evaluations of functions at arbitrary points."
-(2010, 6, 21, 1, 15, 6) function-evaluation-cpp 21.77 "Evaluations of functions at arbitrary points."
+(2009, 4, 7, 11, 40, 54) common-progress-cpp 520.816 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2009, 9, 26, 11, 5, 0) common-progress-cpp 595.635 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2009, 9, 26, 11, 12, 6) fem-assembly-cpp 425.772 "Assembly for various forms and backends"
+(2009, 9, 26, 11, 12, 32) fem-convergence-cpp 26.3695 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2009, 9, 26, 11, 12, 40) fem-jit-python 0.0060529 "JIT compilation (in memory cache)"
+(2009, 9, 26, 11, 19, 38) fem-speedup-cpp 417.534 "Assembly/solve speedup running on 4 processors"
+(2009, 9, 26, 11, 19, 38) fem-speedup-cpp-assembly 2.56383 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2009, 9, 26, 11, 19, 38) fem-speedup-cpp-solve 1.81727 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2009, 9, 26, 11, 21, 24) mesh-refinement-cpp 105.12 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2009, 9, 26, 11, 22, 8) mesh-unitcube-cpp 44.2465 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2009, 9, 26, 11, 22, 49) mesh-iteration-cpp 36.16 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2009, 9, 26, 11, 23, 11) function-evaluation-cpp 22.0644 "Evaluations of functions at arbitrary points."
+(2009, 9, 26, 11, 23, 11) function-evaluation-cpp 21.94 "Evaluations of functions at arbitrary points."
+(2009, 9, 26, 11, 24, 2) la-vector-access-cpp 50.4373 "Accessing vector of size 10000000 (100 repetitions)"
+(2009, 9, 26, 11, 24, 24) la-vector-assignment-cpp 22.8032 "Assigning to vector of size 10000000 (100 repetitions)"
+(2009, 10, 12, 10, 7, 22) common-progress-cpp 596.983 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2009, 10, 12, 10, 14, 27) fem-assembly-cpp 425.915 "Assembly for various forms and backends"
+(2009, 10, 12, 10, 14, 54) fem-convergence-cpp 26.3268 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2009, 10, 12, 10, 15, 22) fem-jit-python 0.0067857 "JIT compilation (in memory cache)"
+(2009, 10, 12, 10, 23, 20) fem-speedup-cpp 477.349 "Assembly/solve speedup running on 4 processors"
+(2009, 10, 12, 10, 23, 20) fem-speedup-cpp-assembly 2.57143 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2009, 10, 12, 10, 23, 20) fem-speedup-cpp-solve 2.65017 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2009, 10, 12, 10, 25, 5) mesh-refinement-cpp 104.54 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2009, 10, 12, 10, 25, 49) mesh-unitcube-cpp 44.1032 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2009, 10, 12, 10, 26, 30) mesh-iteration-cpp 36.16 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2009, 10, 12, 10, 26, 51) function-evaluation-cpp 21.0695 "Evaluations of functions at arbitrary points."
+(2009, 10, 12, 10, 26, 51) function-evaluation-cpp 20.95 "Evaluations of functions at arbitrary points."
+(2009, 10, 12, 10, 27, 38) la-vector-access-cpp 46.9329 "Accessing vector of size 10000000 (100 repetitions)"
+(2009, 10, 12, 10, 28, 1) la-vector-assignment-cpp 22.8043 "Assigning to vector of size 10000000 (100 repetitions)"
+(2009, 12, 4, 9, 4, 57) common-progress-cpp 596.335 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2009, 12, 4, 9, 12, 2) fem-assembly-cpp 425.04 "Assembly for various forms and backends"
+(2009, 12, 4, 9, 12, 27) fem-convergence-cpp 25.672 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2009, 12, 4, 9, 12, 28) fem-jit-python 0.0059581 "JIT compilation (in memory cache)"
+(2009, 12, 4, 9, 20, 40) fem-speedup-cpp 491.809 "Assembly/solve speedup running on 4 processors"
+(2009, 12, 4, 9, 20, 40) fem-speedup-cpp-assembly 2.54639 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2009, 12, 4, 9, 20, 40) fem-speedup-cpp-solve 2.55689 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2009, 12, 4, 9, 22, 27) mesh-refinement-cpp 105.47 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2009, 12, 4, 9, 23, 11) mesh-unitcube-cpp 44.4285 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2009, 12, 4, 9, 23, 52) mesh-iteration-cpp 36.12 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2009, 12, 4, 9, 24, 13) function-evaluation-cpp 20.8032 "Evaluations of functions at arbitrary points."
+(2009, 12, 4, 9, 24, 13) function-evaluation-cpp 20.69 "Evaluations of functions at arbitrary points."
+(2009, 12, 4, 9, 25, 0) la-vector-access-cpp 46.9343 "Accessing vector of size 10000000 (100 repetitions)"
+(2009, 12, 4, 9, 25, 23) la-vector-assignment-cpp 23.3136 "Assigning to vector of size 10000000 (100 repetitions)"
+(2010, 2, 3, 9, 28, 57) common-progress-cpp 597.902 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2010, 2, 3, 9, 36, 18) fem-assembly-cpp 440.361 "Assembly for various forms and backends"
+(2010, 2, 3, 9, 36, 31) fem-convergence-cpp 12.7566 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2010, 2, 3, 9, 36, 33) fem-jit-python 0.0244736 "JIT compilation (in memory cache)"
+(2010, 2, 3, 9, 44, 34) fem-speedup-cpp 480.786 "Assembly/solve speedup running on 4 processors"
+(2010, 2, 3, 9, 44, 34) fem-speedup-cpp-assembly 2.50538 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2010, 2, 3, 9, 44, 34) fem-speedup-cpp-solve 2.34291 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2010, 2, 3, 9, 46, 20) mesh-refinement-cpp 105.43 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2010, 2, 3, 9, 47, 10) mesh-unitcube-cpp 49.6756 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2010, 2, 3, 9, 47, 51) mesh-iteration-cpp 36.14 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2010, 2, 3, 9, 48, 13) function-evaluation-cpp 22.2158 "Evaluations of functions at arbitrary points."
+(2010, 2, 3, 9, 48, 13) function-evaluation-cpp 22.06 "Evaluations of functions at arbitrary points."
+(2010, 2, 3, 9, 49, 4) la-vector-access-cpp 50.4234 "Accessing vector of size 10000000 (100 repetitions)"
+(2010, 2, 3, 9, 49, 28) la-vector-assignment-cpp 24.811 "Assigning to vector of size 10000000 (100 repetitions)"
+(2010, 2, 17, 10, 44, 42) common-progress-cpp 593.092 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2010, 2, 17, 10, 52, 2) fem-assembly-cpp 439.682 "Assembly for various forms and backends"
+(2010, 2, 17, 10, 52, 15) fem-convergence-cpp 12.9031 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2010, 2, 17, 10, 52, 17) fem-jit-python 0.0251185 "JIT compilation (in memory cache)"
+(2010, 2, 17, 10, 59, 34) fem-speedup-cpp 436.864 "Assembly/solve speedup running on 4 processors"
+(2010, 2, 17, 10, 59, 34) fem-speedup-cpp-assembly 2.47917 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2010, 2, 17, 10, 59, 34) fem-speedup-cpp-solve 1.4417 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2010, 2, 17, 11, 1, 32) mesh-refinement-cpp 117.03 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2010, 2, 17, 11, 2, 17) mesh-unitcube-cpp 44.5587 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2010, 2, 17, 11, 2, 58) mesh-iteration-cpp 36.21 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2010, 2, 17, 11, 3, 20) function-evaluation-cpp 22.2584 "Evaluations of functions at arbitrary points."
+(2010, 2, 17, 11, 3, 20) function-evaluation-cpp 22.14 "Evaluations of functions at arbitrary points."
+(2010, 2, 17, 11, 4, 7) la-vector-access-cpp 46.4237 "Accessing vector of size 10000000 (100 repetitions)"
+(2010, 2, 17, 11, 4, 30) la-vector-assignment-cpp 23.8103 "Assigning to vector of size 10000000 (100 repetitions)"
+(2010, 7, 1, 11, 18, 53) common-progress-cpp 33.9116 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2010, 7, 1, 11, 22, 53) fem-assembly-cpp 239.567 "Assembly for various forms and backends"
+(2010, 7, 1, 11, 23, 5) fem-convergence-cpp 12.7182 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2010, 7, 1, 11, 23, 8) fem-jit-python 0.0250931 "JIT compilation (in memory cache)"
+(2010, 7, 1, 11, 25, 42) fem-speedup-cpp 153.886 "Assembly/solve speedup running on 4 processors"
+(2010, 7, 1, 11, 25, 42) fem-speedup-cpp-assembly 2.48235 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2010, 7, 1, 11, 25, 42) fem-speedup-cpp-solve 1.5378 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2010, 7, 1, 11, 27, 22) mesh-refinement-cpp 99.99 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2010, 7, 1, 11, 27, 39) mesh-unitcube-cpp 17.167 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2010, 7, 1, 11, 28, 17) mesh-iteration-cpp 36.2 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2010, 7, 1, 11, 28, 39) function-evaluation-cpp 21.9734 "Evaluations of functions at arbitrary points."
+(2010, 7, 1, 11, 28, 39) function-evaluation-cpp 21.89 "Evaluations of functions at arbitrary points."
+(2010, 7, 1, 11, 29, 30) la-vector-access-cpp 50.9623 "Accessing vector of size 10000000 (100 repetitions)"
+(2010, 7, 1, 11, 29, 54) la-vector-assignment-cpp 23.8196 "Assigning to vector of size 10000000 (100 repetitions)"
+(2010, 9, 2, 11, 36, 6) common-progress-cpp 28.1953 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2010, 9, 2, 11, 40, 5) fem-assembly-cpp 239.167 "Assembly for various forms and backends"
+(2010, 9, 2, 11, 40, 17) fem-convergence-cpp 12.6995 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2010, 9, 2, 11, 40, 18) fem-jit-python 0.000318193 "JIT compilation (in memory cache)"
+(2010, 9, 2, 11, 42, 50) fem-speedup-cpp 151.885 "Assembly/solve speedup running on 4 processors"
+(2010, 9, 2, 11, 42, 50) fem-speedup-cpp-assembly 2.44578 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2010, 9, 2, 11, 42, 50) fem-speedup-cpp-solve 1.39037 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2010, 9, 2, 11, 44, 31) mesh-refinement-cpp 100.49 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2010, 9, 2, 11, 44, 46) mesh-unitcube-cpp 15.3218 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2010, 9, 2, 11, 45, 27) mesh-iteration-cpp 38.47 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2010, 9, 2, 11, 45, 48) function-evaluation-cpp 21.9537 "Evaluations of functions at arbitrary points."
+(2010, 9, 2, 11, 45, 48) function-evaluation-cpp 21.83 "Evaluations of functions at arbitrary points."
+(2010, 9, 2, 11, 46, 41) la-vector-access-cpp 47.9873 "Accessing vector of size 10000000 (100 repetitions)"
+(2010, 9, 2, 11, 47, 3) la-vector-assignment-cpp 21.8435 "Assigning to vector of size 10000000 (100 repetitions)"
+(2011, 2, 23, 12, 11, 27) common-progress-cpp 35.2089 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2011, 2, 23, 12, 11, 54) common-timing-cpp 26.9492 "Timing access and registration of timings (10000000 repetitions)"
+(2011, 2, 23, 12, 12, 7) fem-multicore-cpp 13.1911 "Coloring mesh."
+(2011, 2, 23, 12, 16, 32) fem-assembly-cpp 264.223 "Assembly for various forms and backends"
+(2011, 2, 23, 12, 16, 45) fem-convergence-cpp 13.6343 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2011, 2, 23, 12, 16, 46) fem-jit-python 0.000336289 "JIT compilation (in memory cache)"
+(2011, 2, 23, 12, 22, 54) fem-speedup-cpp 367.888 "Assembly/solve speedup running on 4 processors"
+(2011, 2, 23, 12, 22, 54) fem-speedup-cpp-assembly 5.58102 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2011, 2, 23, 12, 22, 54) fem-speedup-cpp-solve 1.40411 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2011, 2, 23, 12, 23, 41) mesh-refinement-cpp 45.4596 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2011, 2, 23, 12, 24, 21) mesh-topology-cpp 39.6228 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2011, 2, 23, 12, 24, 39) mesh-unitcube-cpp 18.1147 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2011, 2, 23, 12, 25, 17) mesh-iteration-cpp 36.588 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2011, 2, 23, 12, 25, 40) function-evaluation-cpp 22.5863 "Evaluations of functions at arbitrary points."
+(2011, 2, 23, 12, 25, 40) function-evaluation-cpp 22.4607 "Evaluations of functions at arbitrary points."
+(2011, 2, 23, 12, 26, 0) la-vector-access-cpp 20.5366 "Accessing vector of size 10000000 (100 repetitions)"
+(2011, 2, 23, 12, 26, 21) la-vector-assignment-cpp 20.7975 "Assigning to vector of size 10000000 (100 repetitions)"
+(2011, 5, 16, 10, 48, 7) common-progress-cpp 33.9909 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2011, 5, 16, 10, 48, 33) common-timing-cpp 26.2898 "Timing access and registration of timings (10000000 repetitions)"
+(2011, 5, 16, 10, 48, 44) fem-multicore-cpp 10.3499 "Coloring mesh."
+(2011, 5, 16, 10, 52, 42) fem-assembly-cpp 238.558 "Assembly for various forms and backends"
+(2011, 5, 16, 10, 52, 56) fem-convergence-cpp 13.8223 "*** Warning: The function 'logging' is deprecated, use 'set_log_active'."
+(2011, 5, 16, 10, 52, 59) fem-jit-python 0.000444913 "JIT compilation (in memory cache)"
+(2011, 5, 16, 10, 58, 47) fem-speedup-cpp 348.541 "Assembly/solve speedup running on 4 processors"
+(2011, 5, 16, 10, 58, 47) fem-speedup-cpp-assembly 5.41016 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2011, 5, 16, 10, 58, 47) fem-speedup-cpp-solve 1.91566 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2011, 5, 16, 10, 59, 33) mesh-refinement-cpp 45.1063 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2011, 5, 16, 11, 0, 14) mesh-topology-cpp 40.5342 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2011, 5, 16, 11, 0, 32) mesh-unitcube-cpp 18.4513 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2011, 5, 16, 11, 1, 14) mesh-iteration-cpp 39.5328 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2011, 5, 16, 11, 1, 36) function-evaluation-cpp 22.2639 "Evaluations of functions at arbitrary points."
+(2011, 5, 16, 11, 1, 36) function-evaluation-cpp 22.1138 "Evaluations of functions at arbitrary points."
+(2011, 5, 16, 11, 1, 54) la-vector-access-cpp 17.6943 "Accessing vector of size 10000000 (100 repetitions)"
+(2011, 5, 16, 11, 2, 16) la-vector-assignment-cpp 22.7888 "Assigning to vector of size 10000000 (100 repetitions)"
+(2011, 8, 11, 6, 24, 7) common-progress-cpp 27.676 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2011, 8, 11, 6, 24, 34) common-timing-cpp 27.158 "Timing access and registration of timings (10000000 repetitions)"
+(2011, 8, 11, 6, 24, 44) fem-multicore-cpp 10.3709 "Coloring mesh."
+(2011, 8, 11, 6, 28, 43) fem-assembly-cpp 239.121 "Assembly for various forms and backends"
+(2011, 8, 11, 6, 28, 57) fem-convergence-cpp 13.9848 "*** Warning: The function 'logging' is deprecated, use 'set_log_active'."
+(2011, 8, 11, 6, 29, 0) fem-jit-python 0.000418997 "JIT compilation (in memory cache)"
+(2011, 8, 11, 6, 35, 12) fem-speedup-cpp 371.482 "Assembly/solve speedup running on 4 processors"
+(2011, 8, 11, 6, 35, 12) fem-speedup-cpp-assembly 5.55195 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2011, 8, 11, 6, 35, 12) fem-speedup-cpp-solve 1.50643 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2011, 8, 11, 6, 35, 58) mesh-refinement-cpp 44.3073 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2011, 8, 11, 6, 36, 38) mesh-topology-cpp 40.0738 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2011, 8, 11, 6, 36, 56) mesh-unitcube-cpp 18.2183 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2011, 8, 11, 6, 37, 36) mesh-iteration-cpp 37.6003 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2011, 8, 11, 6, 37, 59) function-evaluation-cpp 22.8748 "Evaluations of functions at arbitrary points."
+(2011, 8, 11, 6, 37, 59) function-evaluation-cpp 22.7168 "Evaluations of functions at arbitrary points."
+(2011, 8, 11, 6, 38, 17) la-vector-access-cpp 17.9047 "Accessing vector of size 10000000 (100 repetitions)"
+(2011, 8, 11, 6, 38, 38) la-vector-assignment-cpp 21.3412 "Assigning to vector of size 10000000 (100 repetitions)"
+(2011, 12, 7, 8, 35, 11) common-progress-cpp 29.2316 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2011, 12, 7, 8, 35, 40) common-timing-cpp 29.0057 "Timing access and registration of timings (10000000 repetitions)"
+(2011, 12, 7, 8, 35, 50) fem-multicore-cpp 10.5959 "Coloring mesh."
+(2011, 12, 7, 8, 40, 4) fem-assembly-cpp 253.54 "Assembly for various forms and backends"
+(2011, 12, 7, 8, 40, 17) fem-convergence-cpp 13.6581 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2011, 12, 7, 8, 40, 18) fem-jit-python 0.000432897 "JIT compilation (in memory cache)"
+(2011, 12, 7, 8, 47, 5) fem-speedup-cpp 406.216 "Assembly/solve speedup running on 4 processors"
+(2011, 12, 7, 8, 47, 5) fem-speedup-cpp-assembly 5.71627 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2011, 12, 7, 8, 47, 5) fem-speedup-cpp-solve 1.39569 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2011, 12, 7, 8, 48, 13) mesh-refinement-cpp 66.4876 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2011, 12, 7, 8, 48, 53) mesh-topology-cpp 40.1815 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2011, 12, 7, 8, 49, 13) mesh-unitcube-cpp 20.2862 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2011, 12, 7, 8, 49, 58) mesh-iteration-cpp 42.3196 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2011, 12, 7, 8, 50, 22) la-vector-access-cpp 23.939 "Accessing vector of size 10000000 (100 repetitions)"
+(2011, 12, 7, 8, 50, 46) la-vector-assignment-cpp 24.4505 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 14, 10, 39, 5) common-progress-cpp 29.6111 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 14, 10, 39, 34) common-timing-cpp 28.8854 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 14, 10, 39, 44) fem-multicore-cpp 10.1149 "Coloring mesh."
+(2012, 2, 14, 10, 43, 1) fem-assembly-cpp 196.373 "Assembly for various forms and backends"
+(2012, 2, 14, 10, 43, 12) fem-convergence-cpp 11.7074 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 14, 10, 43, 13) fem-jit-python 0.000421596 "JIT compilation (in memory cache)"
+(2012, 2, 14, 10, 48, 31) fem-speedup-cpp 318.02 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 14, 10, 48, 31) fem-speedup-cpp-assembly 5.51232 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 14, 10, 48, 31) fem-speedup-cpp-solve 2.04125 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 14, 10, 49, 2) mesh-refinement-cpp 29.417 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 14, 10, 49, 38) mesh-topology-cpp 35.8703 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 14, 10, 50, 0) mesh-unitcube-cpp 22.188 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 14, 10, 50, 46) mesh-iteration-cpp 43.2879 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 14, 10, 50, 53) function-extrapolation-python 6.7923 "BENCH:  1.92506408691"
+(2012, 2, 14, 10, 50, 53) function-extrapolation-python 1.92506 "BENCH:  1.92506408691"
+(2012, 2, 14, 10, 51, 16) la-vector-access-cpp 23.545 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 14, 10, 51, 42) la-vector-assignment-cpp 25.4055 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 15, 2, 10, 45) common-progress-cpp 36.4267 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 15, 2, 11, 14) common-timing-cpp 28.9545 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 15, 2, 11, 24) fem-multicore-cpp 10.1293 "Coloring mesh."
+(2012, 2, 15, 2, 14, 41) fem-assembly-cpp 197.194 "Assembly for various forms and backends"
+(2012, 2, 15, 2, 14, 53) fem-convergence-cpp 11.9123 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 15, 2, 14, 54) fem-jit-python 0.000424099 "JIT compilation (in memory cache)"
+(2012, 2, 15, 2, 20, 42) fem-speedup-cpp 348.098 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 15, 2, 20, 42) fem-speedup-cpp-assembly 5.49244 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 15, 2, 20, 42) fem-speedup-cpp-solve 1.48337 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 15, 2, 21, 13) mesh-refinement-cpp 29.2876 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 15, 2, 21, 49) mesh-topology-cpp 35.7988 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 15, 2, 22, 11) mesh-unitcube-cpp 22.0805 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 15, 2, 22, 56) mesh-iteration-cpp 42.3068 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 15, 2, 23, 3) function-extrapolation-python 6.6989 "BENCH:  1.95823812485"
+(2012, 2, 15, 2, 23, 3) function-extrapolation-python 1.95824 "BENCH:  1.95823812485"
+(2012, 2, 15, 2, 23, 28) la-vector-access-cpp 24.7837 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 15, 2, 23, 53) la-vector-assignment-cpp 25.4381 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 16, 2, 11, 13) common-progress-cpp 29.7211 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 16, 2, 11, 41) common-timing-cpp 27.9184 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 16, 2, 11, 51) fem-multicore-cpp 10.0904 "Coloring mesh."
+(2012, 2, 16, 2, 15, 8) fem-assembly-cpp 197.416 "Assembly for various forms and backends"
+(2012, 2, 16, 2, 15, 20) fem-convergence-cpp 11.7719 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 16, 2, 15, 23) fem-jit-python 0.000430512 "JIT compilation (in memory cache)"
+(2012, 2, 16, 2, 21, 0) fem-speedup-cpp 337.021 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 16, 2, 21, 0) fem-speedup-cpp-assembly 5.41916 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 16, 2, 21, 0) fem-speedup-cpp-solve 1.57975 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 16, 2, 21, 24) mesh-refinement-cpp 22.9859 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 16, 2, 21, 46) mesh-topology-cpp 21.6153 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 16, 2, 22, 12) mesh-unitcube-cpp 25.9115 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 16, 2, 23, 6) mesh-iteration-cpp 51.0314 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 16, 2, 23, 13) function-extrapolation-python 6.67041 "BENCH:  1.85507106781"
+(2012, 2, 16, 2, 23, 13) function-extrapolation-python 1.85507 "BENCH:  1.85507106781"
+(2012, 2, 16, 2, 23, 35) la-vector-access-cpp 22.4256 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 16, 2, 24, 1) la-vector-assignment-cpp 25.3903 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 17, 2, 11, 2) common-progress-cpp 29.5262 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 17, 2, 11, 29) common-timing-cpp 27.0658 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 17, 2, 11, 39) fem-multicore-cpp 10.0568 "Coloring mesh."
+(2012, 2, 17, 2, 14, 55) fem-assembly-cpp 196.196 "Assembly for various forms and backends"
+(2012, 2, 17, 2, 15, 7) fem-convergence-cpp 11.6798 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 17, 2, 15, 8) fem-jit-python 0.000422406 "JIT compilation (in memory cache)"
+(2012, 2, 17, 2, 20, 18) fem-speedup-cpp 310.227 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 17, 2, 20, 18) fem-speedup-cpp-assembly 5.45884 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 17, 2, 20, 18) fem-speedup-cpp-solve 2.02068 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 17, 2, 20, 42) mesh-refinement-cpp 22.2379 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 17, 2, 21, 3) mesh-topology-cpp 21.1826 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 17, 2, 21, 24) mesh-unitcube-cpp 20.9564 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 17, 2, 22, 7) mesh-iteration-cpp 41.0497 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 17, 2, 22, 14) function-extrapolation-python 6.83684 "BENCH:  1.89804196358"
+(2012, 2, 17, 2, 22, 14) function-extrapolation-python 1.89804 "BENCH:  1.89804196358"
+(2012, 2, 17, 2, 22, 37) la-vector-access-cpp 22.4288 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 17, 2, 23, 2) la-vector-assignment-cpp 25.3919 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 18, 2, 11, 9) common-progress-cpp 29.3891 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 18, 2, 11, 36) common-timing-cpp 27.1296 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 18, 2, 11, 46) fem-multicore-cpp 10.0048 "Coloring mesh."
+(2012, 2, 18, 2, 15, 1) fem-assembly-cpp 195.306 "Assembly for various forms and backends"
+(2012, 2, 18, 2, 15, 13) fem-convergence-cpp 11.5941 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 18, 2, 15, 14) fem-jit-python 0.000431204 "JIT compilation (in memory cache)"
+(2012, 2, 18, 2, 20, 39) fem-speedup-cpp 324.538 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 18, 2, 20, 39) fem-speedup-cpp-assembly 5.52437 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 18, 2, 20, 39) fem-speedup-cpp-solve 1.74741 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 18, 2, 21, 2) mesh-refinement-cpp 22.3391 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 18, 2, 21, 24) mesh-topology-cpp 21.1066 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 18, 2, 21, 45) mesh-unitcube-cpp 21.0726 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 18, 2, 22, 29) mesh-iteration-cpp 41.6188 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 18, 2, 22, 36) function-extrapolation-python 6.7424 "BENCH:  1.93186807632"
+(2012, 2, 18, 2, 22, 36) function-extrapolation-python 1.93187 "BENCH:  1.93186807632"
+(2012, 2, 18, 2, 23, 0) la-vector-access-cpp 23.8191 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 18, 2, 23, 25) la-vector-assignment-cpp 25.388 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 19, 2, 11, 3) common-progress-cpp 29.4786 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 19, 2, 11, 31) common-timing-cpp 28.1226 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 19, 2, 11, 41) fem-multicore-cpp 10.0208 "Coloring mesh."
+(2012, 2, 19, 2, 14, 56) fem-assembly-cpp 195.034 "Assembly for various forms and backends"
+(2012, 2, 19, 2, 15, 8) fem-convergence-cpp 11.6263 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 19, 2, 15, 9) fem-jit-python 0.000423598 "JIT compilation (in memory cache)"
+(2012, 2, 19, 2, 20, 29) fem-speedup-cpp 319.491 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 19, 2, 20, 29) fem-speedup-cpp-assembly 5.5499 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 19, 2, 20, 29) fem-speedup-cpp-solve 1.87927 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 19, 2, 20, 52) mesh-refinement-cpp 22.2182 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 19, 2, 21, 14) mesh-topology-cpp 21.1064 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 19, 2, 21, 35) mesh-unitcube-cpp 20.9159 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 19, 2, 22, 19) mesh-iteration-cpp 42.1144 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 19, 2, 22, 26) function-extrapolation-python 6.7728 "BENCH:  1.94360399246"
+(2012, 2, 19, 2, 22, 26) function-extrapolation-python 1.9436 "BENCH:  1.94360399246"
+(2012, 2, 19, 2, 22, 49) la-vector-access-cpp 22.4431 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 19, 2, 23, 14) la-vector-assignment-cpp 25.3972 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 20, 2, 11, 1) common-progress-cpp 37.7044 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 20, 2, 11, 29) common-timing-cpp 27.8028 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 20, 2, 11, 39) fem-multicore-cpp 10.0327 "Coloring mesh."
+(2012, 2, 20, 2, 14, 54) fem-assembly-cpp 195.107 "Assembly for various forms and backends"
+(2012, 2, 20, 2, 15, 6) fem-convergence-cpp 11.5751 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 20, 2, 15, 7) fem-jit-python 0.000422311 "JIT compilation (in memory cache)"
+(2012, 2, 20, 2, 20, 32) fem-speedup-cpp 324.725 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 20, 2, 20, 32) fem-speedup-cpp-assembly 5.53876 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 20, 2, 20, 32) fem-speedup-cpp-solve 1.73764 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 20, 2, 20, 56) mesh-refinement-cpp 22.2203 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 20, 2, 21, 17) mesh-topology-cpp 21.1084 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 20, 2, 21, 38) mesh-unitcube-cpp 21.0358 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 20, 2, 22, 22) mesh-iteration-cpp 41.62 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 20, 2, 22, 29) function-extrapolation-python 6.77272 "BENCH:  1.94126605988"
+(2012, 2, 20, 2, 22, 29) function-extrapolation-python 1.94127 "BENCH:  1.94126605988"
+(2012, 2, 20, 2, 22, 53) la-vector-access-cpp 24.4551 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 20, 2, 23, 19) la-vector-assignment-cpp 25.3988 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 21, 2, 10, 52) common-progress-cpp 29.4553 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 21, 2, 11, 19) common-timing-cpp 27.1758 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 21, 2, 11, 29) fem-multicore-cpp 10.0762 "Coloring mesh."
+(2012, 2, 21, 2, 14, 45) fem-assembly-cpp 195.472 "Assembly for various forms and backends"
+(2012, 2, 21, 2, 14, 56) fem-convergence-cpp 11.5682 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 21, 2, 14, 57) fem-jit-python 0.000425005 "JIT compilation (in memory cache)"
+(2012, 2, 21, 2, 20, 15) fem-speedup-cpp 317.829 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 21, 2, 20, 15) fem-speedup-cpp-assembly 5.49712 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 21, 2, 20, 15) fem-speedup-cpp-solve 1.88517 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 21, 2, 20, 39) mesh-refinement-cpp 22.2217 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 21, 2, 21, 0) mesh-topology-cpp 21.1646 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 21, 2, 21, 21) mesh-unitcube-cpp 21.0428 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 21, 2, 22, 5) mesh-iteration-cpp 41.6181 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 21, 2, 22, 12) function-extrapolation-python 6.78422 "BENCH:  1.94494700432"
+(2012, 2, 21, 2, 22, 12) function-extrapolation-python 1.94495 "BENCH:  1.94494700432"
+(2012, 2, 21, 2, 22, 37) la-vector-access-cpp 24.4507 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 21, 2, 23, 2) la-vector-assignment-cpp 25.4279 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 22, 2, 11, 9) common-progress-cpp 29.6217 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 22, 2, 11, 35) common-timing-cpp 26.1961 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 22, 2, 11, 45) fem-multicore-cpp 10.0101 "Coloring mesh."
+(2012, 2, 22, 2, 15, 1) fem-assembly-cpp 196.141 "Assembly for various forms and backends"
+(2012, 2, 22, 2, 15, 12) fem-convergence-cpp 11.6069 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 22, 2, 15, 14) fem-jit-python 0.000419712 "JIT compilation (in memory cache)"
+(2012, 2, 22, 2, 20, 37) fem-speedup-cpp 323.285 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 22, 2, 20, 37) fem-speedup-cpp-assembly 5.53815 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 22, 2, 20, 37) fem-speedup-cpp-solve 1.79809 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 22, 2, 21, 1) mesh-refinement-cpp 22.2328 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 22, 2, 21, 22) mesh-topology-cpp 21.2685 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 22, 2, 21, 43) mesh-unitcube-cpp 21.0014 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 22, 2, 22, 28) mesh-iteration-cpp 42.3159 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 22, 2, 22, 35) function-extrapolation-python 6.66545 "BENCH:  1.88887500763"
+(2012, 2, 22, 2, 22, 35) function-extrapolation-python 1.88888 "BENCH:  1.88887500763"
+(2012, 2, 22, 2, 22, 57) la-vector-access-cpp 22.439 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 22, 2, 23, 22) la-vector-assignment-cpp 24.9489 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 23, 2, 11, 29) common-progress-cpp 29.6307 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 23, 2, 11, 57) common-timing-cpp 27.7839 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 23, 2, 12, 7) fem-multicore-cpp 10.0873 "Coloring mesh."
+(2012, 2, 23, 2, 15, 47) fem-assembly-cpp 219.493 "Assembly for various forms and backends"
+(2012, 2, 23, 2, 15, 58) fem-convergence-cpp 11.584 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 23, 2, 15, 59) fem-jit-python 0.000422287 "JIT compilation (in memory cache)"
+(2012, 2, 23, 2, 21, 21) fem-speedup-cpp 322.164 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 23, 2, 21, 21) fem-speedup-cpp-assembly 5.50432 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 23, 2, 21, 21) fem-speedup-cpp-solve 1.81969 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 23, 2, 21, 45) mesh-refinement-cpp 22.2776 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 23, 2, 22, 7) mesh-topology-cpp 21.2501 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 23, 2, 22, 28) mesh-unitcube-cpp 20.993 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 23, 2, 23, 12) mesh-iteration-cpp 41.6129 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 23, 2, 23, 19) function-extrapolation-python 6.73588 "BENCH:  1.9055120945"
+(2012, 2, 23, 2, 23, 19) function-extrapolation-python 1.90551 "BENCH:  1.9055120945"
+(2012, 2, 23, 2, 23, 41) la-vector-access-cpp 22.4054 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 23, 2, 24, 9) la-vector-assignment-cpp 27.9088 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 25, 2, 10, 48) common-progress-cpp 29.7488 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 25, 2, 11, 16) common-timing-cpp 27.6256 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 25, 2, 11, 26) fem-multicore-cpp 10.0566 "Coloring mesh."
+(2012, 2, 25, 2, 15, 6) fem-assembly-cpp 219.736 "Assembly for various forms and backends"
+(2012, 2, 25, 2, 15, 17) fem-convergence-cpp 11.7109 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 25, 2, 15, 20) fem-jit-python 0.000421286 "JIT compilation (in memory cache)"
+(2012, 2, 25, 2, 20, 54) fem-speedup-cpp 333.872 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 25, 2, 20, 54) fem-speedup-cpp-assembly 5.41226 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 25, 2, 20, 54) fem-speedup-cpp-solve 1.6144 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 25, 2, 21, 18) mesh-refinement-cpp 22.2431 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 25, 2, 21, 39) mesh-topology-cpp 21.2707 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 25, 2, 22, 0) mesh-unitcube-cpp 20.9687 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 25, 2, 22, 45) mesh-iteration-cpp 42.4139 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 25, 2, 22, 52) function-extrapolation-python 6.61425 "BENCH:  1.86223196983"
+(2012, 2, 25, 2, 22, 52) function-extrapolation-python 1.86223 "BENCH:  1.86223196983"
+(2012, 2, 25, 2, 23, 14) la-vector-access-cpp 22.4096 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 25, 2, 23, 39) la-vector-assignment-cpp 24.938 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 26, 2, 10, 39) common-progress-cpp 29.6827 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 26, 2, 11, 7) common-timing-cpp 27.5193 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 26, 2, 11, 17) fem-multicore-cpp 10.0022 "Coloring mesh."
+(2012, 2, 26, 2, 14, 57) fem-assembly-cpp 220.613 "Assembly for various forms and backends"
+(2012, 2, 26, 2, 15, 9) fem-convergence-cpp 11.6063 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 26, 2, 15, 10) fem-jit-python 0.000416684 "JIT compilation (in memory cache)"
+(2012, 2, 26, 2, 20, 26) fem-speedup-cpp 316.075 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 26, 2, 20, 26) fem-speedup-cpp-assembly 5.48959 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 26, 2, 20, 26) fem-speedup-cpp-solve 1.94827 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 26, 2, 20, 50) mesh-refinement-cpp 22.2992 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 26, 2, 21, 11) mesh-topology-cpp 21.2619 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 26, 2, 21, 32) mesh-unitcube-cpp 21.0136 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 26, 2, 22, 17) mesh-iteration-cpp 42.2499 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 26, 2, 22, 24) function-extrapolation-python 6.62892 "BENCH:  1.87784814835"
+(2012, 2, 26, 2, 22, 24) function-extrapolation-python 1.87785 "BENCH:  1.87784814835"
+(2012, 2, 26, 2, 22, 46) la-vector-access-cpp 22.4038 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 26, 2, 23, 11) la-vector-assignment-cpp 24.9438 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 27, 2, 10, 49) common-progress-cpp 38.9561 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 27, 2, 11, 16) common-timing-cpp 26.7055 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 27, 2, 11, 26) fem-multicore-cpp 10.0724 "Coloring mesh."
+(2012, 2, 27, 2, 15, 6) fem-assembly-cpp 220.394 "Assembly for various forms and backends"
+(2012, 2, 27, 2, 15, 18) fem-convergence-cpp 11.5158 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 27, 2, 15, 19) fem-jit-python 0.000419307 "JIT compilation (in memory cache)"
+(2012, 2, 27, 2, 20, 44) fem-speedup-cpp 325.516 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 27, 2, 20, 44) fem-speedup-cpp-assembly 5.53022 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 27, 2, 20, 44) fem-speedup-cpp-solve 1.76675 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 27, 2, 21, 8) mesh-refinement-cpp 22.2457 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 27, 2, 21, 30) mesh-topology-cpp 21.3388 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 27, 2, 21, 51) mesh-unitcube-cpp 21.0537 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 27, 2, 22, 39) mesh-iteration-cpp 46.0111 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 27, 2, 22, 46) function-extrapolation-python 6.71978 "BENCH:  1.99281311035"
+(2012, 2, 27, 2, 22, 46) function-extrapolation-python 1.99281 "BENCH:  1.99281311035"
+(2012, 2, 27, 2, 23, 10) la-vector-access-cpp 23.6024 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 27, 2, 23, 35) la-vector-assignment-cpp 24.9446 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 28, 2, 11, 26) common-progress-cpp 29.7783 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 28, 2, 11, 53) common-timing-cpp 26.5032 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 28, 2, 12, 3) fem-multicore-cpp 9.99451 "Coloring mesh."
+(2012, 2, 28, 2, 12, 15) fem-convergence-cpp 11.6563 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 28, 2, 12, 17) fem-jit-python 0.000420713 "JIT compilation (in memory cache)"
+(2012, 2, 28, 2, 17, 44) fem-speedup-cpp 326.469 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 28, 2, 17, 44) fem-speedup-cpp-assembly 5.4348 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 28, 2, 17, 44) fem-speedup-cpp-solve 1.73334 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 28, 2, 18, 8) mesh-refinement-cpp 22.2341 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 28, 2, 18, 29) mesh-topology-cpp 21.111 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 28, 2, 18, 50) mesh-unitcube-cpp 21.0633 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 28, 2, 19, 34) mesh-iteration-cpp 41.6393 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 28, 2, 19, 41) function-extrapolation-python 6.56976 "BENCH:  1.87061309814"
+(2012, 2, 28, 2, 19, 41) function-extrapolation-python 1.87061 "BENCH:  1.87061309814"
+(2012, 2, 28, 2, 20, 7) la-vector-access-cpp 25.7875 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 28, 2, 20, 32) la-vector-assignment-cpp 25.4388 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 2, 29, 2, 11, 15) common-progress-cpp 29.6144 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 2, 29, 2, 11, 43) common-timing-cpp 27.9701 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 2, 29, 2, 11, 53) fem-multicore-cpp 10.097 "Coloring mesh."
+(2012, 2, 29, 2, 12, 5) fem-convergence-cpp 11.5951 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 2, 29, 2, 12, 6) fem-jit-python 0.0004251 "JIT compilation (in memory cache)"
+(2012, 2, 29, 2, 17, 17) fem-speedup-cpp 311.177 "Assembly/solve speedup running on 4 processors"
+(2012, 2, 29, 2, 17, 17) fem-speedup-cpp-assembly 5.52424 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 2, 29, 2, 17, 17) fem-speedup-cpp-solve 2.03784 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 2, 29, 2, 17, 41) mesh-refinement-cpp 22.2815 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 2, 29, 2, 18, 2) mesh-topology-cpp 21.1173 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 2, 29, 2, 18, 23) mesh-unitcube-cpp 21.269 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 2, 29, 2, 19, 7) mesh-iteration-cpp 41.7044 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 2, 29, 2, 19, 14) function-extrapolation-python 6.58109 "BENCH:  1.89537906647"
+(2012, 2, 29, 2, 19, 14) function-extrapolation-python 1.89538 "BENCH:  1.89537906647"
+(2012, 2, 29, 2, 19, 37) la-vector-access-cpp 22.4255 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 2, 29, 2, 20, 2) la-vector-assignment-cpp 25.4497 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 2, 2, 11, 11) common-progress-cpp 37.7166 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 2, 2, 11, 38) common-timing-cpp 27.1555 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 2, 2, 11, 48) fem-multicore-cpp 10.0269 "Coloring mesh."
+(2012, 3, 2, 2, 12, 0) fem-convergence-cpp 11.6895 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 2, 2, 12, 1) fem-jit-python 0.000437784 "JIT compilation (in memory cache)"
+(2012, 3, 2, 2, 17, 23) fem-speedup-cpp 321.856 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 2, 2, 17, 23) fem-speedup-cpp-assembly 5.45692 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 2, 2, 17, 23) fem-speedup-cpp-solve 1.80895 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 2, 2, 17, 46) mesh-refinement-cpp 22.2671 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 2, 2, 18, 8) mesh-topology-cpp 21.1164 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 2, 2, 18, 29) mesh-unitcube-cpp 21.1234 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 2, 2, 19, 13) mesh-iteration-cpp 41.9632 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 2, 2, 19, 20) function-extrapolation-python 6.54491 "BENCH:  1.88551902771"
+(2012, 3, 2, 2, 19, 20) function-extrapolation-python 1.88552 "BENCH:  1.88551902771"
+(2012, 3, 2, 2, 19, 43) la-vector-access-cpp 22.4787 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 2, 2, 20, 10) la-vector-assignment-cpp 27.899 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 3, 2, 11, 35) common-progress-cpp 47.7445 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 3, 2, 12, 2) common-timing-cpp 27.0265 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 3, 2, 12, 12) fem-multicore-cpp 10.0606 "Coloring mesh."
+(2012, 3, 3, 2, 15, 22) fem-assembly-cpp 190.543 "Assembly for various forms and backends"
+(2012, 3, 3, 2, 15, 34) fem-convergence-cpp 11.6461 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 3, 2, 15, 35) fem-jit-python 0.000424099 "JIT compilation (in memory cache)"
+(2012, 3, 3, 2, 21, 15) fem-speedup-cpp 340.129 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 3, 2, 21, 15) fem-speedup-cpp-assembly 5.55108 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 3, 2, 21, 15) fem-speedup-cpp-solve 1.49924 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 3, 2, 21, 39) mesh-refinement-cpp 22.2783 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 3, 2, 22, 0) mesh-topology-cpp 21.0959 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 3, 2, 22, 22) mesh-unitcube-cpp 21.5152 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 3, 2, 23, 6) mesh-iteration-cpp 41.9603 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 3, 2, 23, 13) function-extrapolation-python 6.71577 "BENCH:  1.8930618763"
+(2012, 3, 3, 2, 23, 13) function-extrapolation-python 1.89306 "BENCH:  1.8930618763"
+(2012, 3, 3, 2, 23, 35) la-vector-access-cpp 22.412 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 3, 2, 24, 3) la-vector-assignment-cpp 27.8896 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 4, 2, 11, 22) common-progress-cpp 29.5126 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 4, 2, 11, 50) common-timing-cpp 28.1364 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 4, 2, 12, 1) fem-multicore-cpp 10.3041 "Coloring mesh."
+(2012, 3, 4, 2, 15, 8) fem-assembly-cpp 186.78 "Assembly for various forms and backends"
+(2012, 3, 4, 2, 15, 19) fem-convergence-cpp 11.6616 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 4, 2, 15, 20) fem-jit-python 0.000426793 "JIT compilation (in memory cache)"
+(2012, 3, 4, 2, 20, 32) fem-speedup-cpp 311.883 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 4, 2, 20, 32) fem-speedup-cpp-assembly 5.39823 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 4, 2, 20, 32) fem-speedup-cpp-solve 2.01846 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 4, 2, 20, 56) mesh-refinement-cpp 22.2624 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 4, 2, 21, 17) mesh-topology-cpp 21.2362 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 4, 2, 21, 39) mesh-unitcube-cpp 21.3107 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 4, 2, 22, 26) mesh-iteration-cpp 44.5811 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 4, 2, 22, 33) function-extrapolation-python 6.90531 "BENCH:  1.89593982697"
+(2012, 3, 4, 2, 22, 33) function-extrapolation-python 1.89594 "BENCH:  1.89593982697"
+(2012, 3, 4, 2, 22, 57) la-vector-access-cpp 23.9349 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 4, 2, 23, 25) la-vector-assignment-cpp 27.8937 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 5, 2, 10, 59) common-progress-cpp 29.584 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 5, 2, 11, 27) common-timing-cpp 27.7145 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 5, 2, 11, 37) fem-multicore-cpp 10.082 "Coloring mesh."
+(2012, 3, 5, 2, 14, 44) fem-assembly-cpp 186.607 "Assembly for various forms and backends"
+(2012, 3, 5, 2, 14, 55) fem-convergence-cpp 11.6288 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 5, 2, 14, 56) fem-jit-python 0.000422382 "JIT compilation (in memory cache)"
+(2012, 3, 5, 2, 20, 25) fem-speedup-cpp 328.423 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 5, 2, 20, 25) fem-speedup-cpp-assembly 5.54144 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 5, 2, 20, 25) fem-speedup-cpp-solve 1.67243 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 5, 2, 20, 49) mesh-refinement-cpp 22.3152 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 5, 2, 21, 10) mesh-topology-cpp 21.2385 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 5, 2, 21, 31) mesh-unitcube-cpp 21.0795 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 5, 2, 22, 15) mesh-iteration-cpp 41.964 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 5, 2, 22, 22) function-extrapolation-python 6.66317 "BENCH:  1.8630437851"
+(2012, 3, 5, 2, 22, 22) function-extrapolation-python 1.86304 "BENCH:  1.8630437851"
+(2012, 3, 5, 2, 22, 45) la-vector-access-cpp 23.0149 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 5, 2, 23, 13) la-vector-assignment-cpp 27.8911 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 6, 2, 11, 0) common-progress-cpp 29.6071 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 6, 2, 11, 28) common-timing-cpp 27.6214 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 6, 2, 11, 38) fem-multicore-cpp 10.1785 "Coloring mesh."
+(2012, 3, 6, 2, 14, 45) fem-assembly-cpp 186.838 "Assembly for various forms and backends"
+(2012, 3, 6, 2, 14, 57) fem-convergence-cpp 11.6171 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 6, 2, 14, 58) fem-jit-python 0.000423288 "JIT compilation (in memory cache)"
+(2012, 3, 6, 2, 20, 13) fem-speedup-cpp 315.16 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 6, 2, 20, 13) fem-speedup-cpp-assembly 5.44692 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 6, 2, 20, 13) fem-speedup-cpp-solve 1.92397 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 6, 2, 20, 37) mesh-refinement-cpp 22.3169 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 6, 2, 20, 58) mesh-topology-cpp 21.2779 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 6, 2, 21, 19) mesh-unitcube-cpp 21.0917 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 6, 2, 22, 4) mesh-iteration-cpp 41.9681 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 6, 2, 22, 11) function-extrapolation-python 6.67543 "BENCH:  1.88750600815"
+(2012, 3, 6, 2, 22, 11) function-extrapolation-python 1.88751 "BENCH:  1.88750600815"
+(2012, 3, 6, 2, 22, 33) la-vector-access-cpp 22.4076 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 6, 2, 23, 1) la-vector-assignment-cpp 27.8987 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 7, 2, 11, 12) common-progress-cpp 30.0316 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 7, 2, 11, 40) common-timing-cpp 28.4918 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 7, 2, 11, 51) fem-multicore-cpp 10.0993 "Coloring mesh."
+(2012, 3, 7, 2, 15, 0) fem-assembly-cpp 189.731 "Assembly for various forms and backends"
+(2012, 3, 7, 2, 15, 12) fem-convergence-cpp 11.9791 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 7, 2, 15, 13) fem-jit-python 0.000421 "JIT compilation (in memory cache)"
+(2012, 3, 7, 2, 20, 26) fem-speedup-cpp 312.125 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 7, 2, 20, 26) fem-speedup-cpp-assembly 5.53894 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 7, 2, 20, 26) fem-speedup-cpp-solve 2.03647 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 7, 2, 20, 49) mesh-refinement-cpp 22.458 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 7, 2, 21, 11) mesh-topology-cpp 21.2026 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 7, 2, 21, 33) mesh-unitcube-cpp 21.8754 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 7, 2, 22, 17) mesh-iteration-cpp 41.9637 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 7, 2, 22, 24) function-extrapolation-python 6.59471 "BENCH:  1.89239001274"
+(2012, 3, 7, 2, 22, 24) function-extrapolation-python 1.89239 "BENCH:  1.89239001274"
+(2012, 3, 7, 2, 22, 48) la-vector-access-cpp 23.9145 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 7, 2, 23, 16) la-vector-assignment-cpp 27.8893 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 8, 2, 11, 19) common-progress-cpp 29.6021 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 8, 2, 11, 46) common-timing-cpp 27.6614 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 8, 2, 11, 57) fem-multicore-cpp 10.2437 "Coloring mesh."
+(2012, 3, 8, 2, 15, 5) fem-assembly-cpp 188.78 "Assembly for various forms and backends"
+(2012, 3, 8, 2, 15, 17) fem-convergence-cpp 11.9243 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 8, 2, 15, 18) fem-jit-python 0.000425601 "JIT compilation (in memory cache)"
+(2012, 3, 8, 2, 20, 40) fem-speedup-cpp 322.013 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 8, 2, 20, 40) fem-speedup-cpp-assembly 5.52599 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 8, 2, 20, 40) fem-speedup-cpp-solve 1.84482 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 8, 2, 21, 4) mesh-refinement-cpp 22.3857 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 8, 2, 21, 26) mesh-topology-cpp 21.3154 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 8, 2, 21, 48) mesh-unitcube-cpp 21.7511 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 8, 2, 22, 33) mesh-iteration-cpp 42.9272 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 8, 2, 22, 40) function-extrapolation-python 6.65543 "BENCH:  1.8642950058"
+(2012, 3, 8, 2, 22, 40) function-extrapolation-python 1.8643 "BENCH:  1.8642950058"
+(2012, 3, 8, 2, 23, 2) la-vector-access-cpp 22.4013 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 8, 2, 23, 30) la-vector-assignment-cpp 27.8904 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 9, 2, 11, 18) common-progress-cpp 29.6102 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 9, 2, 11, 45) common-timing-cpp 27.094 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 9, 2, 11, 56) fem-multicore-cpp 10.1509 "Coloring mesh."
+(2012, 3, 9, 2, 15, 11) fem-assembly-cpp 194.975 "Assembly for various forms and backends"
+(2012, 3, 9, 2, 15, 22) fem-convergence-cpp 11.9128 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 9, 2, 15, 24) fem-jit-python 0.000434899 "JIT compilation (in memory cache)"
+(2012, 3, 9, 2, 20, 49) fem-speedup-cpp 325.179 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 9, 2, 20, 49) fem-speedup-cpp-assembly 5.54605 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 9, 2, 20, 49) fem-speedup-cpp-solve 1.76131 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 9, 2, 21, 13) mesh-refinement-cpp 22.4204 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 9, 2, 21, 34) mesh-topology-cpp 21.1347 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 9, 2, 21, 56) mesh-unitcube-cpp 22.103 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 9, 2, 22, 40) mesh-iteration-cpp 41.956 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 9, 2, 23, 10) function-extrapolation-python 29.4167 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2012, 3, 9, 2, 23, 10) function-extrapolation-python 1.88691 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2012, 3, 9, 2, 23, 33) la-vector-access-cpp 22.4162 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 9, 2, 24, 0) la-vector-assignment-cpp 27.8992 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 10, 2, 11, 12) common-progress-cpp 29.6533 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 10, 2, 11, 40) common-timing-cpp 27.756 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 10, 2, 11, 50) fem-multicore-cpp 10.1681 "Coloring mesh."
+(2012, 3, 10, 2, 15, 2) fem-assembly-cpp 192.075 "Assembly for various forms and backends"
+(2012, 3, 10, 2, 15, 14) fem-convergence-cpp 11.9193 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 10, 2, 15, 15) fem-jit-python 0.000426817 "JIT compilation (in memory cache)"
+(2012, 3, 10, 2, 20, 39) fem-speedup-cpp 323.822 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 10, 2, 20, 39) fem-speedup-cpp-assembly 5.53006 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 10, 2, 20, 39) fem-speedup-cpp-solve 1.756 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 10, 2, 21, 3) mesh-refinement-cpp 22.4384 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 10, 2, 21, 25) mesh-topology-cpp 21.1909 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 10, 2, 21, 47) mesh-unitcube-cpp 21.9534 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 10, 2, 22, 34) mesh-iteration-cpp 44.8074 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 10, 2, 22, 41) function-extrapolation-python 6.84385 "BENCH:  1.87336993217"
+(2012, 3, 10, 2, 22, 41) function-extrapolation-python 1.87337 "BENCH:  1.87336993217"
+(2012, 3, 10, 2, 23, 4) la-vector-access-cpp 22.4098 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 10, 2, 23, 29) la-vector-assignment-cpp 25.0954 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 11, 2, 11, 14) common-progress-cpp 38.9438 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 11, 2, 11, 44) common-timing-cpp 29.2966 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 11, 2, 11, 54) fem-multicore-cpp 10.2232 "Coloring mesh."
+(2012, 3, 11, 2, 15, 7) fem-assembly-cpp 192.633 "Assembly for various forms and backends"
+(2012, 3, 11, 2, 15, 19) fem-convergence-cpp 11.8992 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 11, 2, 15, 20) fem-jit-python 0.000436997 "JIT compilation (in memory cache)"
+(2012, 3, 11, 2, 20, 32) fem-speedup-cpp 312.868 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 11, 2, 20, 32) fem-speedup-cpp-assembly 5.49065 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 11, 2, 20, 32) fem-speedup-cpp-solve 2.00588 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 11, 2, 20, 57) mesh-refinement-cpp 22.7526 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 11, 2, 21, 18) mesh-topology-cpp 21.2829 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 11, 2, 21, 41) mesh-unitcube-cpp 23.1452 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 11, 2, 22, 27) mesh-iteration-cpp 42.9893 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 11, 2, 22, 34) function-extrapolation-python 6.74763 "BENCH:  1.89597916603"
+(2012, 3, 11, 2, 22, 34) function-extrapolation-python 1.89598 "BENCH:  1.89597916603"
+(2012, 3, 11, 2, 22, 56) la-vector-access-cpp 22.4736 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 11, 2, 23, 24) la-vector-assignment-cpp 27.89 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 12, 2, 10, 56) common-progress-cpp 29.2054 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 12, 2, 11, 25) common-timing-cpp 29.0935 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 12, 2, 11, 35) fem-multicore-cpp 10.2215 "Coloring mesh."
+(2012, 3, 12, 2, 14, 47) fem-assembly-cpp 192.444 "Assembly for various forms and backends"
+(2012, 3, 12, 2, 14, 59) fem-convergence-cpp 11.9014 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 12, 2, 15, 0) fem-jit-python 0.000441289 "JIT compilation (in memory cache)"
+(2012, 3, 12, 2, 20, 32) fem-speedup-cpp 331.154 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 12, 2, 20, 32) fem-speedup-cpp-assembly 5.47798 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 12, 2, 20, 32) fem-speedup-cpp-solve 1.65601 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 12, 2, 20, 56) mesh-refinement-cpp 22.7983 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 12, 2, 21, 17) mesh-topology-cpp 21.3877 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 12, 2, 21, 41) mesh-unitcube-cpp 23.618 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 12, 2, 22, 27) mesh-iteration-cpp 42.9459 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 12, 2, 22, 33) function-extrapolation-python 6.70933 "BENCH:  1.89374995232"
+(2012, 3, 12, 2, 22, 33) function-extrapolation-python 1.89375 "BENCH:  1.89374995232"
+(2012, 3, 12, 2, 22, 58) la-vector-access-cpp 24.453 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 12, 2, 23, 26) la-vector-assignment-cpp 27.8885 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 13, 2, 11, 12) common-progress-cpp 29.5275 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 13, 2, 11, 40) common-timing-cpp 27.9414 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 13, 2, 11, 50) fem-multicore-cpp 10.0836 "Coloring mesh."
+(2012, 3, 13, 2, 15, 2) fem-assembly-cpp 191.731 "Assembly for various forms and backends"
+(2012, 3, 13, 2, 15, 14) fem-convergence-cpp 11.8683 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 13, 2, 15, 15) fem-jit-python 0.000435519 "JIT compilation (in memory cache)"
+(2012, 3, 13, 2, 20, 37) fem-speedup-cpp 321.986 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 13, 2, 20, 37) fem-speedup-cpp-assembly 5.51489 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 13, 2, 20, 37) fem-speedup-cpp-solve 1.80728 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 13, 2, 21, 1) mesh-refinement-cpp 22.6107 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 13, 2, 21, 23) mesh-topology-cpp 21.2844 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 13, 2, 21, 45) mesh-unitcube-cpp 22.1244 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 13, 2, 22, 30) mesh-iteration-cpp 42.9091 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 13, 2, 22, 58) la-vector-access-cpp 22.6403 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 13, 2, 23, 26) la-vector-assignment-cpp 27.8896 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 14, 2, 11, 8) common-progress-cpp 29.1833 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 14, 2, 11, 37) common-timing-cpp 28.0877 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 14, 2, 11, 47) fem-multicore-cpp 10.1264 "Coloring mesh."
+(2012, 3, 14, 2, 14, 58) fem-assembly-cpp 191.468 "Assembly for various forms and backends"
+(2012, 3, 14, 2, 15, 10) fem-convergence-cpp 11.8851 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 14, 2, 15, 11) fem-jit-python 0.000440598 "JIT compilation (in memory cache)"
+(2012, 3, 14, 2, 20, 22) fem-speedup-cpp 311.137 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 14, 2, 20, 22) fem-speedup-cpp-assembly 5.54597 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 14, 2, 20, 22) fem-speedup-cpp-solve 2.02177 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 14, 2, 20, 46) mesh-refinement-cpp 22.5597 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 14, 2, 21, 8) mesh-topology-cpp 21.1568 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 14, 2, 21, 30) mesh-unitcube-cpp 22.1763 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 14, 2, 22, 15) mesh-iteration-cpp 42.9753 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 14, 2, 22, 45) la-vector-access-cpp 24.9016 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 14, 2, 23, 13) la-vector-assignment-cpp 27.8919 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 15, 2, 10, 55) common-progress-cpp 29.7919 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 15, 2, 11, 25) common-timing-cpp 29.2994 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 15, 2, 11, 35) fem-multicore-cpp 10.176 "Coloring mesh."
+(2012, 3, 15, 2, 14, 46) fem-assembly-cpp 191.525 "Assembly for various forms and backends"
+(2012, 3, 15, 2, 14, 58) fem-convergence-cpp 11.9635 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 15, 2, 14, 59) fem-jit-python 0.000433612 "JIT compilation (in memory cache)"
+(2012, 3, 15, 2, 20, 29) fem-speedup-cpp 329.9 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 15, 2, 20, 29) fem-speedup-cpp-assembly 5.53121 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 15, 2, 20, 29) fem-speedup-cpp-solve 1.67331 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 15, 2, 20, 53) mesh-refinement-cpp 22.4721 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 15, 2, 21, 15) mesh-topology-cpp 21.0975 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 15, 2, 21, 38) mesh-unitcube-cpp 23.535 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 15, 2, 22, 24) mesh-iteration-cpp 42.9694 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 15, 2, 22, 51) la-vector-access-cpp 22.624 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 15, 2, 23, 23) la-vector-assignment-cpp 31.8963 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 16, 2, 11, 20) common-progress-cpp 29.1769 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 16, 2, 11, 49) common-timing-cpp 29.4311 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 16, 2, 11, 59) fem-multicore-cpp 10.1385 "Coloring mesh."
+(2012, 3, 16, 2, 15, 9) fem-assembly-cpp 189.965 "Assembly for various forms and backends"
+(2012, 3, 16, 2, 15, 21) fem-convergence-cpp 11.587 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 16, 2, 15, 22) fem-jit-python 0.000426602 "JIT compilation (in memory cache)"
+(2012, 3, 16, 2, 20, 38) fem-speedup-cpp 316.379 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 16, 2, 20, 38) fem-speedup-cpp-assembly 5.57773 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 16, 2, 20, 38) fem-speedup-cpp-solve 1.93243 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 16, 2, 21, 2) mesh-refinement-cpp 22.4445 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 16, 2, 21, 23) mesh-topology-cpp 21.0381 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 16, 2, 21, 47) mesh-unitcube-cpp 23.7185 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 16, 2, 22, 31) mesh-iteration-cpp 41.9583 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 16, 2, 23, 0) la-vector-access-cpp 23.7331 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 16, 2, 23, 28) la-vector-assignment-cpp 27.9023 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 17, 2, 11, 3) common-progress-cpp 29.6218 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 17, 2, 11, 33) common-timing-cpp 30.1059 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 17, 2, 11, 43) fem-multicore-cpp 10.2326 "Coloring mesh."
+(2012, 3, 17, 2, 14, 56) fem-assembly-cpp 193.14 "Assembly for various forms and backends"
+(2012, 3, 17, 2, 15, 8) fem-convergence-cpp 11.8484 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 17, 2, 15, 9) fem-jit-python 0.000442004 "JIT compilation (in memory cache)"
+(2012, 3, 17, 2, 20, 21) fem-speedup-cpp 311.462 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 17, 2, 20, 21) fem-speedup-cpp-assembly 5.47218 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 17, 2, 20, 21) fem-speedup-cpp-solve 2.02193 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 17, 2, 20, 44) mesh-refinement-cpp 22.4131 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 17, 2, 21, 6) mesh-topology-cpp 21.1438 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 17, 2, 21, 27) mesh-unitcube-cpp 21.165 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 17, 2, 22, 12) mesh-iteration-cpp 42.9161 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 17, 2, 22, 40) la-vector-access-cpp 22.6284 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 17, 2, 23, 8) la-vector-assignment-cpp 27.9458 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 18, 2, 11, 14) common-progress-cpp 29.7763 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 18, 2, 11, 43) common-timing-cpp 29.1075 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 18, 2, 11, 53) fem-multicore-cpp 10.0955 "Coloring mesh."
+(2012, 3, 18, 2, 14, 59) fem-assembly-cpp 186.284 "Assembly for various forms and backends"
+(2012, 3, 18, 2, 15, 11) fem-convergence-cpp 11.8973 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 18, 2, 15, 12) fem-jit-python 0.000438499 "JIT compilation (in memory cache)"
+(2012, 3, 18, 2, 20, 29) fem-speedup-cpp 316.308 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 18, 2, 20, 29) fem-speedup-cpp-assembly 5.50749 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 18, 2, 20, 29) fem-speedup-cpp-solve 1.93064 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 18, 2, 20, 53) mesh-refinement-cpp 22.4646 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 18, 2, 21, 14) mesh-topology-cpp 21.1607 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 18, 2, 21, 36) mesh-unitcube-cpp 21.9807 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 18, 2, 22, 24) mesh-iteration-cpp 45.6159 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 18, 2, 22, 52) la-vector-access-cpp 22.6539 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 18, 2, 23, 20) la-vector-assignment-cpp 27.9433 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 19, 2, 10, 59) common-progress-cpp 29.7581 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 19, 2, 11, 29) common-timing-cpp 29.3136 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 19, 2, 11, 39) fem-multicore-cpp 10.1749 "Coloring mesh."
+(2012, 3, 19, 2, 14, 46) fem-assembly-cpp 186.641 "Assembly for various forms and backends"
+(2012, 3, 19, 2, 14, 57) fem-convergence-cpp 11.8723 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 19, 2, 14, 58) fem-jit-python 0.000418305 "JIT compilation (in memory cache)"
+(2012, 3, 19, 2, 20, 22) fem-speedup-cpp 323.96 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 19, 2, 20, 22) fem-speedup-cpp-assembly 5.52268 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 19, 2, 20, 22) fem-speedup-cpp-solve 1.77541 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 19, 2, 20, 46) mesh-refinement-cpp 22.3813 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 19, 2, 21, 8) mesh-topology-cpp 21.1015 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 19, 2, 21, 30) mesh-unitcube-cpp 21.9139 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 19, 2, 22, 23) mesh-iteration-cpp 51.0405 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 19, 2, 22, 53) la-vector-access-cpp 24.595 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 19, 2, 23, 23) la-vector-assignment-cpp 29.8894 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 20, 2, 11, 0) common-progress-cpp 29.6163 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 20, 2, 11, 30) common-timing-cpp 29.1732 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 20, 2, 11, 40) fem-multicore-cpp 10.1176 "Coloring mesh."
+(2012, 3, 20, 2, 14, 46) fem-assembly-cpp 186.541 "Assembly for various forms and backends"
+(2012, 3, 20, 2, 14, 58) fem-convergence-cpp 11.8774 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 20, 2, 14, 59) fem-jit-python 0.000426602 "JIT compilation (in memory cache)"
+(2012, 3, 20, 2, 20, 11) fem-speedup-cpp 312.039 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 20, 2, 20, 11) fem-speedup-cpp-assembly 5.47704 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 20, 2, 20, 11) fem-speedup-cpp-solve 2.00028 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 20, 2, 20, 35) mesh-refinement-cpp 22.3899 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 20, 2, 20, 57) mesh-topology-cpp 21.1438 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 20, 2, 21, 19) mesh-unitcube-cpp 21.9657 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 20, 2, 22, 3) mesh-iteration-cpp 41.9575 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 20, 2, 22, 33) la-vector-access-cpp 24.7075 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 20, 2, 23, 1) la-vector-assignment-cpp 27.9425 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 21, 2, 11, 20) common-progress-cpp 29.6446 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 21, 2, 11, 50) common-timing-cpp 29.5241 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 21, 2, 12, 0) fem-multicore-cpp 10.0781 "Coloring mesh."
+(2012, 3, 21, 2, 15, 6) fem-assembly-cpp 186.525 "Assembly for various forms and backends"
+(2012, 3, 21, 2, 15, 18) fem-convergence-cpp 11.5829 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 21, 2, 15, 19) fem-jit-python 0.000426292 "JIT compilation (in memory cache)"
+(2012, 3, 21, 2, 20, 30) fem-speedup-cpp 311.429 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 21, 2, 20, 30) fem-speedup-cpp-assembly 5.50763 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 21, 2, 20, 30) fem-speedup-cpp-solve 2.02043 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 21, 2, 20, 54) mesh-refinement-cpp 22.4093 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 21, 2, 21, 16) mesh-topology-cpp 21.1356 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 21, 2, 21, 38) mesh-unitcube-cpp 21.942 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 21, 2, 22, 22) mesh-iteration-cpp 41.9617 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 21, 2, 22, 49) la-vector-access-cpp 22.6346 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 21, 2, 23, 17) la-vector-assignment-cpp 27.9443 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 22, 2, 11, 6) common-progress-cpp 29.6124 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 22, 2, 11, 36) common-timing-cpp 29.527 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 22, 2, 11, 46) fem-multicore-cpp 10.0475 "Coloring mesh."
+(2012, 3, 22, 2, 14, 53) fem-assembly-cpp 186.811 "Assembly for various forms and backends"
+(2012, 3, 22, 2, 15, 5) fem-convergence-cpp 11.8756 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 22, 2, 15, 6) fem-jit-python 0.000440311 "JIT compilation (in memory cache)"
+(2012, 3, 22, 2, 20, 32) fem-speedup-cpp 325.998 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 22, 2, 20, 32) fem-speedup-cpp-assembly 5.49121 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 22, 2, 20, 32) fem-speedup-cpp-solve 1.7379 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 22, 2, 20, 56) mesh-refinement-cpp 22.5104 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 22, 2, 21, 17) mesh-topology-cpp 21.1518 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 22, 2, 21, 39) mesh-unitcube-cpp 21.9391 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 22, 2, 22, 24) mesh-iteration-cpp 41.9631 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 22, 2, 22, 51) la-vector-access-cpp 22.6449 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 22, 2, 23, 20) la-vector-assignment-cpp 27.9458 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 23, 10, 18, 15) common-progress-cpp 29.2502 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 23, 10, 18, 44) common-timing-cpp 28.9173 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 23, 10, 18, 54) fem-multicore-cpp 10.1337 "Coloring mesh."
+(2012, 3, 23, 10, 22, 2) fem-assembly-cpp 187.907 "Assembly for various forms and backends"
+(2012, 3, 23, 10, 22, 14) fem-convergence-cpp 11.855 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 23, 10, 22, 15) fem-jit-python 0.000434303 "JIT compilation (in memory cache)"
+(2012, 3, 23, 10, 28, 3) fem-speedup-cpp 347.987 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 23, 10, 28, 3) fem-speedup-cpp-assembly 5.52104 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 23, 10, 28, 3) fem-speedup-cpp-solve 1.40722 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 23, 10, 28, 27) mesh-refinement-cpp 22.7465 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 23, 10, 28, 48) mesh-topology-cpp 21.129 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 23, 10, 29, 10) mesh-unitcube-cpp 21.2977 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 23, 10, 29, 55) mesh-iteration-cpp 42.8558 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 23, 10, 30, 16) function-evaluation-cpp 21.3397 "Evaluations of functions at arbitrary points."
+(2012, 3, 23, 10, 30, 16) function-evaluation-cpp 21.2454 "Evaluations of functions at arbitrary points."
+(2012, 3, 23, 10, 30, 23) function-extrapolation-python 7.08951 "BENCH:  1.91053199768"
+(2012, 3, 23, 10, 30, 23) function-extrapolation-python 1.91053 "BENCH:  1.91053199768"
+(2012, 3, 23, 10, 30, 46) la-vector-access-cpp 22.4567 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 23, 10, 31, 14) la-vector-assignment-cpp 27.9451 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 24, 2, 11, 35) common-progress-cpp 29.8481 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 24, 2, 12, 6) common-timing-cpp 30.0109 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 24, 2, 12, 16) fem-multicore-cpp 10.011 "Coloring mesh."
+(2012, 3, 24, 2, 15, 24) fem-assembly-cpp 188.197 "Assembly for various forms and backends"
+(2012, 3, 24, 2, 15, 36) fem-convergence-cpp 11.9155 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 24, 2, 15, 48) fem-jit-python 0.000569606 "JIT compilation (in memory cache)"
+(2012, 3, 24, 2, 21, 35) fem-speedup-cpp 346.566 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 24, 2, 21, 35) fem-speedup-cpp-assembly 5.51891 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 24, 2, 21, 35) fem-speedup-cpp-solve 1.43412 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 24, 2, 21, 59) mesh-refinement-cpp 22.7388 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 24, 2, 22, 20) mesh-topology-cpp 21.1862 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 24, 2, 22, 42) mesh-unitcube-cpp 21.3518 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 24, 2, 23, 27) mesh-iteration-cpp 42.6707 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 24, 2, 23, 48) function-evaluation-cpp 21.3317 "Evaluations of functions at arbitrary points."
+(2012, 3, 24, 2, 23, 48) function-evaluation-cpp 21.2392 "Evaluations of functions at arbitrary points."
+(2012, 3, 24, 2, 24, 39) function-extrapolation-python 50.6951 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2012, 3, 24, 2, 24, 39) function-extrapolation-python 1.89467 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2012, 3, 24, 2, 25, 3) la-vector-access-cpp 23.8564 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 24, 2, 25, 35) la-vector-assignment-cpp 31.9083 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 25, 1, 11, 12) common-progress-cpp 29.5972 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 25, 1, 11, 42) common-timing-cpp 29.5222 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 25, 1, 11, 52) fem-multicore-cpp 10.0221 "Coloring mesh."
+(2012, 3, 25, 1, 15, 0) fem-assembly-cpp 188.188 "Assembly for various forms and backends"
+(2012, 3, 25, 1, 15, 12) fem-convergence-cpp 11.8477 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 25, 1, 15, 13) fem-jit-python 0.000525594 "JIT compilation (in memory cache)"
+(2012, 3, 25, 1, 20, 24) fem-speedup-cpp 311.519 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 25, 1, 20, 24) fem-speedup-cpp-assembly 5.53704 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 25, 1, 20, 24) fem-speedup-cpp-solve 2.03861 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 25, 1, 20, 49) mesh-refinement-cpp 22.7542 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 25, 1, 21, 10) mesh-topology-cpp 21.1512 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 25, 1, 21, 31) mesh-unitcube-cpp 21.3332 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 25, 1, 22, 17) mesh-iteration-cpp 42.8488 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 25, 1, 22, 38) function-evaluation-cpp 21.385 "Evaluations of functions at arbitrary points."
+(2012, 3, 25, 1, 22, 38) function-evaluation-cpp 21.3041 "Evaluations of functions at arbitrary points."
+(2012, 3, 25, 1, 22, 45) function-extrapolation-python 6.80304 "BENCH:  1.9065849781"
+(2012, 3, 25, 1, 22, 45) function-extrapolation-python 1.90658 "BENCH:  1.9065849781"
+(2012, 3, 25, 1, 23, 9) la-vector-access-cpp 23.8583 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 25, 1, 23, 37) la-vector-assignment-cpp 27.9519 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 26, 1, 11, 12) common-progress-cpp 29.6833 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 26, 1, 11, 41) common-timing-cpp 29.1034 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 26, 1, 11, 51) fem-multicore-cpp 9.94161 "Coloring mesh."
+(2012, 3, 26, 1, 14, 58) fem-assembly-cpp 187.507 "Assembly for various forms and backends"
+(2012, 3, 26, 1, 15, 10) fem-convergence-cpp 11.8326 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 26, 1, 15, 11) fem-jit-python 0.000517201 "JIT compilation (in memory cache)"
+(2012, 3, 26, 1, 20, 27) fem-speedup-cpp 316.115 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 26, 1, 20, 27) fem-speedup-cpp-assembly 5.53409 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 26, 1, 20, 27) fem-speedup-cpp-solve 1.92683 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 26, 1, 20, 51) mesh-refinement-cpp 22.7083 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 26, 1, 21, 13) mesh-topology-cpp 21.2153 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 26, 1, 21, 34) mesh-unitcube-cpp 21.2683 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 26, 1, 22, 19) mesh-iteration-cpp 42.8333 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 26, 1, 22, 41) function-evaluation-cpp 21.5819 "Evaluations of functions at arbitrary points."
+(2012, 3, 26, 1, 22, 41) function-evaluation-cpp 21.4958 "Evaluations of functions at arbitrary points."
+(2012, 3, 26, 1, 22, 48) function-extrapolation-python 6.67678 "BENCH:  1.91194415092"
+(2012, 3, 26, 1, 22, 48) function-extrapolation-python 1.91194 "BENCH:  1.91194415092"
+(2012, 3, 26, 1, 23, 10) la-vector-access-cpp 22.447 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 26, 1, 23, 38) la-vector-assignment-cpp 27.9534 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 27, 1, 11, 10) common-progress-cpp 29.8119 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 27, 1, 11, 40) common-timing-cpp 29.6736 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 27, 1, 11, 50) fem-multicore-cpp 10.1445 "Coloring mesh."
+(2012, 3, 27, 1, 14, 57) fem-assembly-cpp 187.423 "Assembly for various forms and backends"
+(2012, 3, 27, 1, 15, 9) fem-convergence-cpp 11.8745 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 27, 1, 15, 10) fem-jit-python 0.000532913 "JIT compilation (in memory cache)"
+(2012, 3, 27, 1, 20, 31) fem-speedup-cpp 320.54 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 27, 1, 20, 31) fem-speedup-cpp-assembly 5.54247 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 27, 1, 20, 31) fem-speedup-cpp-solve 1.83288 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 27, 1, 20, 55) mesh-refinement-cpp 22.6726 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 27, 1, 21, 16) mesh-topology-cpp 21.0875 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 27, 1, 21, 37) mesh-unitcube-cpp 21.2453 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 27, 1, 22, 23) mesh-iteration-cpp 42.867 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 27, 1, 22, 44) function-evaluation-cpp 21.3268 "Evaluations of functions at arbitrary points."
+(2012, 3, 27, 1, 22, 44) function-evaluation-cpp 21.246 "Evaluations of functions at arbitrary points."
+(2012, 3, 27, 1, 22, 51) function-extrapolation-python 6.80449 "BENCH:  1.96759700775"
+(2012, 3, 27, 1, 22, 51) function-extrapolation-python 1.9676 "BENCH:  1.96759700775"
+(2012, 3, 27, 1, 23, 13) la-vector-access-cpp 22.4477 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 27, 1, 23, 41) la-vector-assignment-cpp 27.9519 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 28, 1, 11, 35) common-progress-cpp 36.4359 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 28, 1, 12, 5) common-timing-cpp 29.7557 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 28, 1, 12, 15) fem-multicore-cpp 10.0797 "Coloring mesh."
+(2012, 3, 28, 1, 15, 28) fem-assembly-cpp 193.158 "Assembly for various forms and backends"
+(2012, 3, 28, 1, 15, 40) fem-convergence-cpp 11.8458 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 28, 1, 15, 41) fem-jit-python 0.000517321 "JIT compilation (in memory cache)"
+(2012, 3, 28, 1, 20, 53) fem-speedup-cpp 311.816 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 28, 1, 20, 53) fem-speedup-cpp-assembly 5.35381 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 28, 1, 20, 53) fem-speedup-cpp-solve 2 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 28, 1, 21, 17) mesh-refinement-cpp 22.5773 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 28, 1, 21, 39) mesh-topology-cpp 21.4724 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 28, 1, 22, 0) mesh-unitcube-cpp 21.5984 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 28, 1, 22, 46) mesh-iteration-cpp 42.9169 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 28, 1, 23, 7) function-evaluation-cpp 21.2531 "Evaluations of functions at arbitrary points."
+(2012, 3, 28, 1, 23, 7) function-evaluation-cpp 21.1721 "Evaluations of functions at arbitrary points."
+(2012, 3, 28, 1, 23, 14) function-extrapolation-python 6.65458 "BENCH:  1.91735506058"
+(2012, 3, 28, 1, 23, 14) function-extrapolation-python 1.91736 "BENCH:  1.91735506058"
+(2012, 3, 28, 1, 23, 36) la-vector-access-cpp 22.4146 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 28, 1, 24, 4) la-vector-assignment-cpp 27.9528 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 29, 1, 11, 44) common-progress-cpp 47.7206 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 29, 1, 12, 13) common-timing-cpp 29.4658 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 29, 1, 12, 23) fem-multicore-cpp 10.1128 "Coloring mesh."
+(2012, 3, 29, 1, 15, 36) fem-assembly-cpp 192.811 "Assembly for various forms and backends"
+(2012, 3, 29, 1, 15, 48) fem-convergence-cpp 11.8379 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 29, 1, 15, 49) fem-jit-python 0.000525403 "JIT compilation (in memory cache)"
+(2012, 3, 29, 1, 21, 2) fem-speedup-cpp 313.254 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 29, 1, 21, 2) fem-speedup-cpp-assembly 5.33967 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 29, 1, 21, 2) fem-speedup-cpp-solve 1.9766 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 29, 1, 21, 26) mesh-refinement-cpp 22.5234 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 29, 1, 21, 48) mesh-topology-cpp 21.3866 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 29, 1, 22, 10) mesh-unitcube-cpp 21.6283 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 29, 1, 22, 55) mesh-iteration-cpp 42.9465 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 29, 1, 23, 16) function-evaluation-cpp 21.3256 "Evaluations of functions at arbitrary points."
+(2012, 3, 29, 1, 23, 16) function-evaluation-cpp 21.2446 "Evaluations of functions at arbitrary points."
+(2012, 3, 29, 1, 23, 23) function-extrapolation-python 6.77774 "BENCH:  1.9107670784"
+(2012, 3, 29, 1, 23, 23) function-extrapolation-python 1.91077 "BENCH:  1.9107670784"
+(2012, 3, 29, 1, 23, 47) la-vector-access-cpp 23.8877 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 29, 1, 24, 15) la-vector-assignment-cpp 27.951 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 30, 1, 11, 13) common-progress-cpp 29.1799 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 30, 1, 11, 43) common-timing-cpp 30.3009 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 30, 1, 11, 53) fem-multicore-cpp 9.98761 "Coloring mesh."
+(2012, 3, 30, 1, 15, 6) fem-assembly-cpp 193.031 "Assembly for various forms and backends"
+(2012, 3, 30, 1, 15, 18) fem-convergence-cpp 11.8157 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 30, 1, 15, 19) fem-jit-python 0.0011179 "JIT compilation (in memory cache)"
+(2012, 3, 30, 1, 20, 31) fem-speedup-cpp 312.07 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 30, 1, 20, 31) fem-speedup-cpp-assembly 5.35266 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 30, 1, 20, 31) fem-speedup-cpp-solve 2.00995 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 30, 1, 20, 55) mesh-refinement-cpp 22.5618 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 30, 1, 21, 17) mesh-topology-cpp 21.4106 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 30, 1, 21, 39) mesh-unitcube-cpp 21.6636 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 30, 1, 22, 24) mesh-iteration-cpp 42.9289 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 30, 1, 22, 45) function-evaluation-cpp 21.312 "Evaluations of functions at arbitrary points."
+(2012, 3, 30, 1, 22, 45) function-evaluation-cpp 21.231 "Evaluations of functions at arbitrary points."
+(2012, 3, 30, 1, 22, 52) function-extrapolation-python 6.82452 "BENCH:  1.90303897858"
+(2012, 3, 30, 1, 22, 52) function-extrapolation-python 1.90304 "BENCH:  1.90303897858"
+(2012, 3, 30, 1, 23, 18) la-vector-access-cpp 25.4073 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 30, 1, 23, 46) la-vector-assignment-cpp 27.9508 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 3, 31, 1, 11, 16) common-progress-cpp 29.9434 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 3, 31, 1, 11, 46) common-timing-cpp 29.9282 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 3, 31, 1, 11, 56) fem-multicore-cpp 10.0462 "Coloring mesh."
+(2012, 3, 31, 1, 15, 9) fem-assembly-cpp 192.654 "Assembly for various forms and backends"
+(2012, 3, 31, 1, 15, 21) fem-convergence-cpp 11.8577 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 3, 31, 1, 15, 22) fem-jit-python 0.000411105 "JIT compilation (in memory cache)"
+(2012, 3, 31, 1, 20, 40) fem-speedup-cpp 317.603 "Assembly/solve speedup running on 4 processors"
+(2012, 3, 31, 1, 20, 40) fem-speedup-cpp-assembly 5.33456 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 3, 31, 1, 20, 40) fem-speedup-cpp-solve 1.91342 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 3, 31, 1, 21, 4) mesh-refinement-cpp 22.5222 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 3, 31, 1, 21, 25) mesh-topology-cpp 21.3206 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 3, 31, 1, 21, 47) mesh-unitcube-cpp 21.6934 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 3, 31, 1, 22, 36) mesh-iteration-cpp 46.0533 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 3, 31, 1, 22, 57) function-evaluation-cpp 21.3194 "Evaluations of functions at arbitrary points."
+(2012, 3, 31, 1, 22, 57) function-evaluation-cpp 21.2383 "Evaluations of functions at arbitrary points."
+(2012, 3, 31, 1, 23, 4) function-extrapolation-python 6.69082 "BENCH:  1.8820579052"
+(2012, 3, 31, 1, 23, 4) function-extrapolation-python 1.88206 "BENCH:  1.8820579052"
+(2012, 3, 31, 1, 23, 26) la-vector-access-cpp 22.4411 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 3, 31, 1, 23, 54) la-vector-assignment-cpp 27.9711 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 1, 1, 11, 29) common-progress-cpp 29.6234 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 1, 1, 11, 57) common-timing-cpp 28.0265 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 1, 1, 12, 7) fem-multicore-cpp 10.0726 "Coloring mesh."
+(2012, 4, 1, 1, 15, 20) fem-assembly-cpp 193.379 "Assembly for various forms and backends"
+(2012, 4, 1, 1, 15, 32) fem-convergence-cpp 11.5822 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 1, 1, 15, 33) fem-jit-python 0.000422621 "JIT compilation (in memory cache)"
+(2012, 4, 1, 1, 20, 43) fem-speedup-cpp 310.266 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 1, 1, 20, 43) fem-speedup-cpp-assembly 5.57014 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 1, 1, 20, 43) fem-speedup-cpp-solve 2.03339 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 1, 1, 21, 7) mesh-refinement-cpp 22.6896 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 1, 1, 21, 29) mesh-topology-cpp 21.5138 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 1, 1, 21, 52) mesh-unitcube-cpp 22.3731 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 1, 1, 22, 37) mesh-iteration-cpp 42.9926 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 1, 1, 22, 58) function-evaluation-cpp 21.3313 "Evaluations of functions at arbitrary points."
+(2012, 4, 1, 1, 22, 58) function-evaluation-cpp 21.2499 "Evaluations of functions at arbitrary points."
+(2012, 4, 1, 1, 23, 5) function-extrapolation-python 6.78079 "BENCH:  1.89290785789"
+(2012, 4, 1, 1, 23, 5) function-extrapolation-python 1.89291 "BENCH:  1.89290785789"
+(2012, 4, 1, 1, 23, 28) la-vector-access-cpp 22.8901 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 1, 1, 23, 56) la-vector-assignment-cpp 27.955 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 2, 1, 11, 27) common-progress-cpp 29.5912 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 2, 1, 11, 55) common-timing-cpp 27.9926 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 2, 1, 12, 5) fem-multicore-cpp 9.94763 "Coloring mesh."
+(2012, 4, 2, 1, 15, 17) fem-assembly-cpp 192.68 "Assembly for various forms and backends"
+(2012, 4, 2, 1, 15, 29) fem-convergence-cpp 11.839 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 2, 1, 15, 30) fem-jit-python 0.000409603 "JIT compilation (in memory cache)"
+(2012, 4, 2, 1, 20, 54) fem-speedup-cpp 323.953 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 2, 1, 20, 54) fem-speedup-cpp-assembly 5.57919 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 2, 1, 20, 54) fem-speedup-cpp-solve 1.78626 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 2, 1, 21, 19) mesh-refinement-cpp 22.7456 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 2, 1, 21, 40) mesh-topology-cpp 21.3414 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 2, 1, 22, 3) mesh-unitcube-cpp 22.3971 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 2, 1, 22, 53) mesh-iteration-cpp 48.5393 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 2, 1, 23, 14) function-evaluation-cpp 20.8662 "Evaluations of functions at arbitrary points."
+(2012, 4, 2, 1, 23, 14) function-evaluation-cpp 20.7852 "Evaluations of functions at arbitrary points."
+(2012, 4, 2, 1, 23, 21) function-extrapolation-python 6.82069 "BENCH:  1.89127898216"
+(2012, 4, 2, 1, 23, 21) function-extrapolation-python 1.89128 "BENCH:  1.89127898216"
+(2012, 4, 2, 1, 23, 44) la-vector-access-cpp 22.9127 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 2, 1, 24, 12) la-vector-assignment-cpp 27.9095 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 3, 1, 11, 30) common-progress-cpp 29.6125 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 3, 1, 12, 0) common-timing-cpp 29.2451 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 3, 1, 12, 10) fem-multicore-cpp 10.0172 "Coloring mesh."
+(2012, 4, 3, 1, 15, 23) fem-assembly-cpp 192.942 "Assembly for various forms and backends"
+(2012, 4, 3, 1, 15, 34) fem-convergence-cpp 11.8779 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 3, 1, 15, 36) fem-jit-python 0.000404787 "JIT compilation (in memory cache)"
+(2012, 4, 3, 1, 20, 48) fem-speedup-cpp 311.927 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 3, 1, 20, 48) fem-speedup-cpp-assembly 5.57805 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 3, 1, 20, 48) fem-speedup-cpp-solve 2.03223 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 3, 1, 21, 12) mesh-refinement-cpp 22.7041 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 3, 1, 21, 33) mesh-topology-cpp 21.4215 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 3, 1, 21, 56) mesh-unitcube-cpp 22.4044 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 3, 1, 22, 41) mesh-iteration-cpp 42.9646 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 3, 1, 23, 2) function-evaluation-cpp 21.3042 "Evaluations of functions at arbitrary points."
+(2012, 4, 3, 1, 23, 2) function-evaluation-cpp 21.2234 "Evaluations of functions at arbitrary points."
+(2012, 4, 3, 1, 23, 9) function-extrapolation-python 6.59291 "BENCH:  1.90084600449"
+(2012, 4, 3, 1, 23, 9) function-extrapolation-python 1.90085 "BENCH:  1.90084600449"
+(2012, 4, 3, 1, 23, 33) la-vector-access-cpp 23.9183 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 3, 1, 24, 3) la-vector-assignment-cpp 29.9047 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 4, 1, 11, 33) common-progress-cpp 29.801 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 4, 1, 12, 1) common-timing-cpp 28.113 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 4, 1, 12, 11) fem-multicore-cpp 10.1021 "Coloring mesh."
+(2012, 4, 4, 1, 15, 25) fem-assembly-cpp 193.557 "Assembly for various forms and backends"
+(2012, 4, 4, 1, 15, 37) fem-convergence-cpp 11.8598 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 4, 1, 15, 38) fem-jit-python 0.000418305 "JIT compilation (in memory cache)"
+(2012, 4, 4, 1, 20, 53) fem-speedup-cpp 315.101 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 4, 1, 20, 53) fem-speedup-cpp-assembly 5.39718 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 4, 1, 20, 53) fem-speedup-cpp-solve 1.93364 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 4, 1, 21, 17) mesh-refinement-cpp 22.7536 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 4, 1, 21, 39) mesh-topology-cpp 21.3588 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 4, 1, 22, 1) mesh-unitcube-cpp 22.1709 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 4, 1, 22, 47) mesh-iteration-cpp 43.03 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 4, 1, 23, 8) function-evaluation-cpp 21.5658 "Evaluations of functions at arbitrary points."
+(2012, 4, 4, 1, 23, 8) function-evaluation-cpp 21.4845 "Evaluations of functions at arbitrary points."
+(2012, 4, 4, 1, 23, 15) function-extrapolation-python 6.80863 "BENCH:  1.88338589668"
+(2012, 4, 4, 1, 23, 15) function-extrapolation-python 1.88339 "BENCH:  1.88338589668"
+(2012, 4, 4, 1, 23, 39) la-vector-access-cpp 23.9452 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 4, 1, 24, 4) la-vector-assignment-cpp 24.9566 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 5, 1, 11, 24) common-progress-cpp 29.8204 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 5, 1, 11, 53) common-timing-cpp 29.478 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 5, 1, 12, 3) fem-multicore-cpp 9.97172 "Coloring mesh."
+(2012, 4, 5, 1, 15, 15) fem-assembly-cpp 191.927 "Assembly for various forms and backends"
+(2012, 4, 5, 1, 15, 27) fem-convergence-cpp 11.8568 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 5, 1, 15, 28) fem-jit-python 0.000405502 "JIT compilation (in memory cache)"
+(2012, 4, 5, 1, 20, 50) fem-speedup-cpp 322.331 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 5, 1, 20, 50) fem-speedup-cpp-assembly 5.60304 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 5, 1, 20, 50) fem-speedup-cpp-solve 1.8112 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 5, 1, 21, 15) mesh-refinement-cpp 22.9131 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 5, 1, 21, 36) mesh-topology-cpp 21.2879 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 5, 1, 21, 59) mesh-unitcube-cpp 22.1745 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 5, 1, 22, 44) mesh-iteration-cpp 43.0736 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 5, 1, 23, 6) function-evaluation-cpp 21.3185 "Evaluations of functions at arbitrary points."
+(2012, 4, 5, 1, 23, 6) function-evaluation-cpp 21.2377 "Evaluations of functions at arbitrary points."
+(2012, 4, 5, 1, 23, 12) function-extrapolation-python 6.78808 "BENCH:  1.92564797401"
+(2012, 4, 5, 1, 23, 12) function-extrapolation-python 1.92565 "BENCH:  1.92564797401"
+(2012, 4, 5, 1, 23, 35) la-vector-access-cpp 22.4427 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 5, 1, 24, 0) la-vector-assignment-cpp 24.9598 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 6, 1, 11, 24) common-progress-cpp 29.5914 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 6, 1, 11, 54) common-timing-cpp 30.9051 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 6, 1, 12, 4) fem-multicore-cpp 10.0022 "Coloring mesh."
+(2012, 4, 6, 1, 15, 19) fem-assembly-cpp 194.833 "Assembly for various forms and backends"
+(2012, 4, 6, 1, 15, 31) fem-convergence-cpp 11.8686 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 6, 1, 15, 32) fem-jit-python 0.000404692 "JIT compilation (in memory cache)"
+(2012, 4, 6, 1, 20, 45) fem-speedup-cpp 312.888 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 6, 1, 20, 45) fem-speedup-cpp-assembly 5.51397 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 6, 1, 20, 45) fem-speedup-cpp-solve 1.96147 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 6, 1, 21, 9) mesh-refinement-cpp 22.655 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 6, 1, 21, 31) mesh-topology-cpp 21.3078 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 6, 1, 21, 52) mesh-unitcube-cpp 21.6501 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 6, 1, 22, 37) mesh-iteration-cpp 41.9631 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 6, 1, 22, 59) function-evaluation-cpp 21.9918 "Evaluations of functions at arbitrary points."
+(2012, 4, 6, 1, 22, 59) function-evaluation-cpp 21.9108 "Evaluations of functions at arbitrary points."
+(2012, 4, 6, 1, 23, 6) function-extrapolation-python 6.64582 "BENCH:  1.92029690742"
+(2012, 4, 6, 1, 23, 6) function-extrapolation-python 1.9203 "BENCH:  1.92029690742"
+(2012, 4, 6, 1, 23, 29) la-vector-access-cpp 23.4188 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 6, 1, 23, 54) la-vector-assignment-cpp 25.1107 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 7, 1, 11, 8) common-progress-cpp 29.6045 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 7, 1, 11, 37) common-timing-cpp 29.2484 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 7, 1, 11, 47) fem-multicore-cpp 10.1002 "Coloring mesh."
+(2012, 4, 7, 1, 15, 2) fem-assembly-cpp 194.759 "Assembly for various forms and backends"
+(2012, 4, 7, 1, 15, 14) fem-convergence-cpp 11.8038 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 7, 1, 15, 15) fem-jit-python 0.00042491 "JIT compilation (in memory cache)"
+(2012, 4, 7, 1, 20, 26) fem-speedup-cpp 310.96 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 7, 1, 20, 26) fem-speedup-cpp-assembly 5.5059 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 7, 1, 20, 26) fem-speedup-cpp-solve 2.03805 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 7, 1, 20, 50) mesh-refinement-cpp 22.6697 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 7, 1, 21, 12) mesh-topology-cpp 21.3257 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 7, 1, 21, 33) mesh-unitcube-cpp 21.5497 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 7, 1, 22, 18) mesh-iteration-cpp 41.9542 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 7, 1, 22, 39) function-evaluation-cpp 21.3445 "Evaluations of functions at arbitrary points."
+(2012, 4, 7, 1, 22, 39) function-evaluation-cpp 21.2634 "Evaluations of functions at arbitrary points."
+(2012, 4, 7, 1, 22, 46) function-extrapolation-python 6.7778 "BENCH:  1.91542887688"
+(2012, 4, 7, 1, 22, 46) function-extrapolation-python 1.91543 "BENCH:  1.91542887688"
+(2012, 4, 7, 1, 23, 10) la-vector-access-cpp 23.8879 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 7, 1, 23, 35) la-vector-assignment-cpp 24.9626 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 8, 1, 11, 10) common-progress-cpp 29.6068 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 8, 1, 11, 40) common-timing-cpp 29.3383 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 8, 1, 11, 50) fem-multicore-cpp 10.0317 "Coloring mesh."
+(2012, 4, 8, 1, 15, 4) fem-assembly-cpp 193.816 "Assembly for various forms and backends"
+(2012, 4, 8, 1, 15, 15) fem-convergence-cpp 11.9014 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 8, 1, 15, 17) fem-jit-python 0.000415492 "JIT compilation (in memory cache)"
+(2012, 4, 8, 1, 20, 36) fem-speedup-cpp 319.491 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 8, 1, 20, 36) fem-speedup-cpp-assembly 5.53892 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 8, 1, 20, 36) fem-speedup-cpp-solve 1.83568 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 8, 1, 21, 0) mesh-refinement-cpp 22.6556 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 8, 1, 21, 22) mesh-topology-cpp 21.2851 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 8, 1, 21, 43) mesh-unitcube-cpp 21.5829 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 8, 1, 22, 28) mesh-iteration-cpp 41.959 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 8, 1, 22, 49) function-evaluation-cpp 21.2914 "Evaluations of functions at arbitrary points."
+(2012, 4, 8, 1, 22, 49) function-evaluation-cpp 21.2098 "Evaluations of functions at arbitrary points."
+(2012, 4, 8, 1, 22, 56) function-extrapolation-python 6.80206 "BENCH:  1.91059112549"
+(2012, 4, 8, 1, 22, 56) function-extrapolation-python 1.91059 "BENCH:  1.91059112549"
+(2012, 4, 8, 1, 23, 21) la-vector-access-cpp 24.7488 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 8, 1, 23, 46) la-vector-assignment-cpp 24.9565 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 9, 1, 11, 10) common-progress-cpp 29.6139 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 9, 1, 11, 40) common-timing-cpp 29.3154 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 9, 1, 11, 50) fem-multicore-cpp 10.1391 "Coloring mesh."
+(2012, 4, 9, 1, 15, 5) fem-assembly-cpp 195.676 "Assembly for various forms and backends"
+(2012, 4, 9, 1, 15, 17) fem-convergence-cpp 11.8654 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 9, 1, 15, 18) fem-jit-python 0.000416708 "JIT compilation (in memory cache)"
+(2012, 4, 9, 1, 20, 46) fem-speedup-cpp 327.076 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 9, 1, 20, 46) fem-speedup-cpp-assembly 5.38924 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 9, 1, 20, 46) fem-speedup-cpp-solve 1.72854 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 9, 1, 21, 10) mesh-refinement-cpp 22.6798 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 9, 1, 21, 31) mesh-topology-cpp 21.3687 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 9, 1, 21, 53) mesh-unitcube-cpp 21.5628 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 9, 1, 22, 41) mesh-iteration-cpp 45.5416 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 9, 1, 23, 2) function-evaluation-cpp 21.3215 "Evaluations of functions at arbitrary points."
+(2012, 4, 9, 1, 23, 2) function-evaluation-cpp 21.2402 "Evaluations of functions at arbitrary points."
+(2012, 4, 9, 1, 23, 9) function-extrapolation-python 6.67455 "BENCH:  1.87760996819"
+(2012, 4, 9, 1, 23, 9) function-extrapolation-python 1.87761 "BENCH:  1.87760996819"
+(2012, 4, 9, 1, 23, 32) la-vector-access-cpp 22.8976 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 9, 1, 24, 0) la-vector-assignment-cpp 27.909 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 10, 1, 11, 11) common-progress-cpp 29.6185 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 10, 1, 11, 41) common-timing-cpp 30.2668 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 10, 1, 11, 51) fem-multicore-cpp 10.051 "Coloring mesh."
+(2012, 4, 10, 1, 15, 6) fem-assembly-cpp 194.713 "Assembly for various forms and backends"
+(2012, 4, 10, 1, 15, 18) fem-convergence-cpp 11.8898 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 10, 1, 15, 19) fem-jit-python 0.000405598 "JIT compilation (in memory cache)"
+(2012, 4, 10, 1, 20, 31) fem-speedup-cpp 312.221 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 10, 1, 20, 31) fem-speedup-cpp-assembly 5.50767 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 10, 1, 20, 31) fem-speedup-cpp-solve 2.00828 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 10, 1, 20, 55) mesh-refinement-cpp 22.6637 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 10, 1, 21, 16) mesh-topology-cpp 21.2887 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 10, 1, 21, 38) mesh-unitcube-cpp 21.5207 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 10, 1, 22, 22) mesh-iteration-cpp 41.9577 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 10, 1, 22, 44) function-evaluation-cpp 21.2886 "Evaluations of functions at arbitrary points."
+(2012, 4, 10, 1, 22, 44) function-evaluation-cpp 21.2079 "Evaluations of functions at arbitrary points."
+(2012, 4, 10, 1, 22, 51) function-extrapolation-python 6.71729 "BENCH:  1.90854501724"
+(2012, 4, 10, 1, 22, 51) function-extrapolation-python 1.90855 "BENCH:  1.90854501724"
+(2012, 4, 10, 1, 23, 13) la-vector-access-cpp 22.8883 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 10, 1, 23, 38) la-vector-assignment-cpp 24.8592 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 11, 1, 11, 39) common-progress-cpp 37.6901 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 11, 1, 12, 9) common-timing-cpp 30.061 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 11, 1, 12, 19) fem-multicore-cpp 10.031 "Coloring mesh."
+(2012, 4, 11, 1, 15, 34) fem-assembly-cpp 195.459 "Assembly for various forms and backends"
+(2012, 4, 11, 1, 15, 46) fem-convergence-cpp 11.8761 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 11, 1, 15, 59) fem-jit-python 0.000437808 "JIT compilation (in memory cache)"
+(2012, 4, 11, 1, 21, 24) fem-speedup-cpp 325.611 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 11, 1, 21, 24) fem-speedup-cpp-assembly 5.53267 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 11, 1, 21, 24) fem-speedup-cpp-solve 1.75802 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 11, 1, 21, 49) mesh-refinement-cpp 22.7249 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 11, 1, 22, 10) mesh-topology-cpp 21.2921 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 11, 1, 22, 32) mesh-unitcube-cpp 21.554 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 11, 1, 23, 16) mesh-iteration-cpp 41.9561 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 11, 1, 23, 38) function-evaluation-cpp 21.3437 "Evaluations of functions at arbitrary points."
+(2012, 4, 11, 1, 23, 38) function-evaluation-cpp 21.2627 "Evaluations of functions at arbitrary points."
+(2012, 4, 11, 1, 24, 28) function-extrapolation-python 50.3287 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2012, 4, 11, 1, 24, 28) function-extrapolation-python 1.87041 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2012, 4, 11, 1, 24, 52) la-vector-access-cpp 23.9218 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 11, 1, 25, 17) la-vector-assignment-cpp 24.958 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 12, 1, 11, 28) common-progress-cpp 29.5758 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 12, 1, 11, 58) common-timing-cpp 29.4504 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 12, 1, 12, 8) fem-multicore-cpp 10.0968 "Coloring mesh."
+(2012, 4, 12, 1, 15, 23) fem-assembly-cpp 195.389 "Assembly for various forms and backends"
+(2012, 4, 12, 1, 15, 35) fem-convergence-cpp 11.9012 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 12, 1, 15, 36) fem-jit-python 0.000413799 "JIT compilation (in memory cache)"
+(2012, 4, 12, 1, 20, 51) fem-speedup-cpp 314.38 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 12, 1, 20, 51) fem-speedup-cpp-assembly 5.49665 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 12, 1, 20, 51) fem-speedup-cpp-solve 1.96089 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 12, 1, 21, 15) mesh-refinement-cpp 22.6922 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 12, 1, 21, 36) mesh-topology-cpp 21.328 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 12, 1, 21, 58) mesh-unitcube-cpp 21.5581 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 12, 1, 22, 42) mesh-iteration-cpp 41.9564 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 12, 1, 23, 3) function-evaluation-cpp 21.3275 "Evaluations of functions at arbitrary points."
+(2012, 4, 12, 1, 23, 3) function-evaluation-cpp 21.2465 "Evaluations of functions at arbitrary points."
+(2012, 4, 12, 1, 23, 10) function-extrapolation-python 6.86228 "BENCH:  1.91826319695"
+(2012, 4, 12, 1, 23, 10) function-extrapolation-python 1.91826 "BENCH:  1.91826319695"
+(2012, 4, 12, 1, 23, 33) la-vector-access-cpp 22.8895 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 12, 1, 23, 58) la-vector-assignment-cpp 24.947 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 13, 1, 11, 5) common-progress-cpp 29.7275 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 13, 1, 11, 35) common-timing-cpp 29.3219 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 13, 1, 11, 45) fem-multicore-cpp 10.0317 "Coloring mesh."
+(2012, 4, 13, 1, 15, 0) fem-assembly-cpp 195.012 "Assembly for various forms and backends"
+(2012, 4, 13, 1, 15, 12) fem-convergence-cpp 11.8576 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 13, 1, 15, 13) fem-jit-python 0.000402689 "JIT compilation (in memory cache)"
+(2012, 4, 13, 1, 20, 23) fem-speedup-cpp 309.903 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 13, 1, 20, 23) fem-speedup-cpp-assembly 5.44764 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 13, 1, 20, 23) fem-speedup-cpp-solve 2.00791 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 13, 1, 20, 47) mesh-refinement-cpp 22.6317 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 13, 1, 21, 8) mesh-topology-cpp 21.2982 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 13, 1, 21, 30) mesh-unitcube-cpp 21.5571 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 13, 1, 22, 14) mesh-iteration-cpp 41.9579 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 13, 1, 22, 35) function-evaluation-cpp 20.895 "Evaluations of functions at arbitrary points."
+(2012, 4, 13, 1, 22, 35) function-evaluation-cpp 20.8135 "Evaluations of functions at arbitrary points."
+(2012, 4, 13, 1, 22, 42) function-extrapolation-python 6.69723 "BENCH:  1.91965317726"
+(2012, 4, 13, 1, 22, 42) function-extrapolation-python 1.91965 "BENCH:  1.91965317726"
+(2012, 4, 13, 1, 23, 5) la-vector-access-cpp 22.8961 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 13, 1, 23, 30) la-vector-assignment-cpp 24.9554 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 14, 1, 11, 13) common-progress-cpp 29.5913 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 14, 1, 11, 42) common-timing-cpp 29.3513 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 14, 1, 11, 52) fem-multicore-cpp 9.95149 "Coloring mesh."
+(2012, 4, 14, 1, 15, 7) fem-assembly-cpp 194.398 "Assembly for various forms and backends"
+(2012, 4, 14, 1, 15, 19) fem-convergence-cpp 11.9192 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 14, 1, 15, 20) fem-jit-python 0.000419497 "JIT compilation (in memory cache)"
+(2012, 4, 14, 1, 20, 37) fem-speedup-cpp 317.428 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 14, 1, 20, 37) fem-speedup-cpp-assembly 5.50765 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 14, 1, 20, 37) fem-speedup-cpp-solve 1.88947 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 14, 1, 21, 1) mesh-refinement-cpp 22.6315 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 14, 1, 21, 23) mesh-topology-cpp 21.315 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 14, 1, 21, 44) mesh-unitcube-cpp 21.5444 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 14, 1, 22, 29) mesh-iteration-cpp 41.9574 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 14, 1, 22, 50) function-evaluation-cpp 21.312 "Evaluations of functions at arbitrary points."
+(2012, 4, 14, 1, 22, 50) function-evaluation-cpp 21.2305 "Evaluations of functions at arbitrary points."
+(2012, 4, 14, 1, 22, 57) function-extrapolation-python 6.84253 "BENCH:  1.91713786125"
+(2012, 4, 14, 1, 22, 57) function-extrapolation-python 1.91714 "BENCH:  1.91713786125"
+(2012, 4, 14, 1, 23, 20) la-vector-access-cpp 23.4699 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 14, 1, 23, 49) la-vector-assignment-cpp 28.4046 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 15, 1, 11, 1) common-progress-cpp 29.6471 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 15, 1, 11, 30) common-timing-cpp 29.3415 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 15, 1, 11, 40) fem-multicore-cpp 10.0903 "Coloring mesh."
+(2012, 4, 15, 1, 14, 55) fem-assembly-cpp 195.025 "Assembly for various forms and backends"
+(2012, 4, 15, 1, 15, 7) fem-convergence-cpp 11.9013 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 15, 1, 15, 8) fem-jit-python 0.000399303 "JIT compilation (in memory cache)"
+(2012, 4, 15, 1, 20, 30) fem-speedup-cpp 321.279 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 15, 1, 20, 30) fem-speedup-cpp-assembly 5.52572 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 15, 1, 20, 30) fem-speedup-cpp-solve 1.79201 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 15, 1, 20, 54) mesh-refinement-cpp 22.6588 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 15, 1, 21, 15) mesh-topology-cpp 21.3575 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 15, 1, 21, 37) mesh-unitcube-cpp 21.5732 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 15, 1, 22, 21) mesh-iteration-cpp 41.9679 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 15, 1, 22, 43) function-evaluation-cpp 21.4094 "Evaluations of functions at arbitrary points."
+(2012, 4, 15, 1, 22, 43) function-evaluation-cpp 21.3282 "Evaluations of functions at arbitrary points."
+(2012, 4, 15, 1, 22, 50) function-extrapolation-python 6.84848 "BENCH:  1.93561601639"
+(2012, 4, 15, 1, 22, 50) function-extrapolation-python 1.93562 "BENCH:  1.93561601639"
+(2012, 4, 15, 1, 23, 15) la-vector-access-cpp 25.3845 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 15, 1, 23, 40) la-vector-assignment-cpp 24.9474 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 16, 1, 11, 8) common-progress-cpp 29.8776 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 16, 1, 11, 37) common-timing-cpp 29.6351 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 16, 1, 11, 47) fem-multicore-cpp 10.0687 "Coloring mesh."
+(2012, 4, 16, 1, 15, 2) fem-assembly-cpp 195.05 "Assembly for various forms and backends"
+(2012, 4, 16, 1, 15, 14) fem-convergence-cpp 11.8756 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 16, 1, 15, 15) fem-jit-python 0.000411296 "JIT compilation (in memory cache)"
+(2012, 4, 16, 1, 20, 33) fem-speedup-cpp 317.598 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 16, 1, 20, 33) fem-speedup-cpp-assembly 5.48247 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 16, 1, 20, 33) fem-speedup-cpp-solve 1.8917 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 16, 1, 20, 57) mesh-refinement-cpp 22.6601 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 16, 1, 21, 19) mesh-topology-cpp 21.3013 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 16, 1, 21, 40) mesh-unitcube-cpp 21.5678 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 16, 1, 22, 25) mesh-iteration-cpp 41.9616 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 16, 1, 22, 46) function-evaluation-cpp 21.2234 "Evaluations of functions at arbitrary points."
+(2012, 4, 16, 1, 22, 46) function-evaluation-cpp 21.1426 "Evaluations of functions at arbitrary points."
+(2012, 4, 16, 1, 22, 53) function-extrapolation-python 6.62327 "BENCH:  1.9081389904"
+(2012, 4, 16, 1, 22, 53) function-extrapolation-python 1.90814 "BENCH:  1.9081389904"
+(2012, 4, 16, 1, 23, 16) la-vector-access-cpp 22.8958 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 16, 1, 23, 41) la-vector-assignment-cpp 25.3182 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 17, 1, 11, 24) common-progress-cpp 29.5943 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 17, 1, 11, 53) common-timing-cpp 29.3269 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 17, 1, 12, 3) fem-multicore-cpp 10.0395 "Coloring mesh."
+(2012, 4, 17, 1, 15, 18) fem-assembly-cpp 195.046 "Assembly for various forms and backends"
+(2012, 4, 17, 1, 15, 30) fem-convergence-cpp 11.8156 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 17, 1, 15, 31) fem-jit-python 0.000405502 "JIT compilation (in memory cache)"
+(2012, 4, 17, 1, 20, 52) fem-speedup-cpp 321.085 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 17, 1, 20, 52) fem-speedup-cpp-assembly 5.49989 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 17, 1, 20, 52) fem-speedup-cpp-solve 1.80138 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 17, 1, 21, 17) mesh-refinement-cpp 22.6523 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 17, 1, 21, 38) mesh-topology-cpp 21.3286 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 17, 1, 22, 0) mesh-unitcube-cpp 21.538 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 17, 1, 22, 45) mesh-iteration-cpp 42.9854 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 17, 1, 23, 7) function-evaluation-cpp 21.5716 "Evaluations of functions at arbitrary points."
+(2012, 4, 17, 1, 23, 7) function-evaluation-cpp 21.491 "Evaluations of functions at arbitrary points."
+(2012, 4, 17, 1, 23, 13) function-extrapolation-python 6.70889 "BENCH:  1.91690993309"
+(2012, 4, 17, 1, 23, 13) function-extrapolation-python 1.91691 "BENCH:  1.91690993309"
+(2012, 4, 17, 1, 23, 38) la-vector-access-cpp 24.7413 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 17, 1, 24, 6) la-vector-assignment-cpp 27.898 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 18, 1, 11, 18) common-progress-cpp 29.5696 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 18, 1, 11, 49) common-timing-cpp 31.2141 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 18, 1, 11, 59) fem-multicore-cpp 10.0536 "Coloring mesh."
+(2012, 4, 18, 1, 15, 14) fem-assembly-cpp 195.05 "Assembly for various forms and backends"
+(2012, 4, 18, 1, 15, 26) fem-convergence-cpp 11.9287 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 18, 1, 15, 27) fem-jit-python 0.000406384 "JIT compilation (in memory cache)"
+(2012, 4, 18, 1, 20, 38) fem-speedup-cpp 310.697 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 18, 1, 20, 38) fem-speedup-cpp-assembly 5.44698 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 18, 1, 20, 38) fem-speedup-cpp-solve 2.02891 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 18, 1, 21, 2) mesh-refinement-cpp 22.6653 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 18, 1, 21, 24) mesh-topology-cpp 21.3476 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 18, 1, 21, 46) mesh-unitcube-cpp 22.4067 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 18, 1, 22, 31) mesh-iteration-cpp 41.9577 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 18, 1, 22, 52) function-evaluation-cpp 21.3133 "Evaluations of functions at arbitrary points."
+(2012, 4, 18, 1, 22, 52) function-evaluation-cpp 21.2324 "Evaluations of functions at arbitrary points."
+(2012, 4, 18, 1, 22, 59) function-extrapolation-python 6.75713 "BENCH:  1.90683197975"
+(2012, 4, 18, 1, 22, 59) function-extrapolation-python 1.90683 "BENCH:  1.90683197975"
+(2012, 4, 18, 1, 23, 22) la-vector-access-cpp 23.4111 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 18, 1, 23, 47) la-vector-assignment-cpp 24.9726 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 19, 1, 11, 3) common-progress-cpp 29.6664 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 19, 1, 11, 34) common-timing-cpp 31.1433 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 19, 1, 11, 44) fem-multicore-cpp 10.2088 "Coloring mesh."
+(2012, 4, 19, 1, 14, 58) fem-assembly-cpp 194.265 "Assembly for various forms and backends"
+(2012, 4, 19, 1, 15, 10) fem-convergence-cpp 11.5099 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 19, 1, 15, 11) fem-jit-python 0.000402379 "JIT compilation (in memory cache)"
+(2012, 4, 19, 1, 20, 31) fem-speedup-cpp 320.158 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 19, 1, 20, 31) fem-speedup-cpp-assembly 5.41944 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 19, 1, 20, 31) fem-speedup-cpp-solve 1.86275 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 19, 1, 20, 55) mesh-refinement-cpp 22.646 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 19, 1, 21, 17) mesh-topology-cpp 21.4082 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 19, 1, 21, 39) mesh-unitcube-cpp 22.4364 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 19, 1, 22, 24) mesh-iteration-cpp 41.9751 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 19, 1, 22, 46) function-evaluation-cpp 22.0381 "Evaluations of functions at arbitrary points."
+(2012, 4, 19, 1, 22, 46) function-evaluation-cpp 21.947 "Evaluations of functions at arbitrary points."
+(2012, 4, 19, 1, 22, 53) function-extrapolation-python 6.80468 "BENCH:  1.90234613419"
+(2012, 4, 19, 1, 22, 53) function-extrapolation-python 1.90235 "BENCH:  1.90234613419"
+(2012, 4, 19, 1, 23, 15) la-vector-access-cpp 22.4238 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 19, 1, 23, 43) la-vector-assignment-cpp 27.8512 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 20, 1, 11, 2) common-progress-cpp 29.7221 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 20, 1, 11, 33) common-timing-cpp 30.9285 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 20, 1, 11, 43) fem-multicore-cpp 10.0384 "Coloring mesh."
+(2012, 4, 20, 1, 14, 57) fem-assembly-cpp 194.188 "Assembly for various forms and backends"
+(2012, 4, 20, 1, 15, 9) fem-convergence-cpp 11.8689 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 20, 1, 15, 10) fem-jit-python 0.000417686 "JIT compilation (in memory cache)"
+(2012, 4, 20, 1, 20, 29) fem-speedup-cpp 318.508 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 20, 1, 20, 29) fem-speedup-cpp-assembly 5.40301 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 20, 1, 20, 29) fem-speedup-cpp-solve 1.8532 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 20, 1, 20, 53) mesh-refinement-cpp 22.6916 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 20, 1, 21, 14) mesh-topology-cpp 21.3408 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 20, 1, 21, 37) mesh-unitcube-cpp 22.4068 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 20, 1, 22, 21) mesh-iteration-cpp 41.9578 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 20, 1, 22, 43) function-evaluation-cpp 21.3187 "Evaluations of functions at arbitrary points."
+(2012, 4, 20, 1, 22, 43) function-evaluation-cpp 21.237 "Evaluations of functions at arbitrary points."
+(2012, 4, 20, 1, 22, 49) function-extrapolation-python 6.67374 "BENCH:  1.90048503876"
+(2012, 4, 20, 1, 22, 49) function-extrapolation-python 1.90049 "BENCH:  1.90048503876"
+(2012, 4, 20, 1, 23, 13) la-vector-access-cpp 23.6049 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 20, 1, 23, 41) la-vector-assignment-cpp 27.8924 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 21, 1, 11, 12) common-progress-cpp 29.9227 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 21, 1, 11, 42) common-timing-cpp 30.6816 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 21, 1, 11, 53) fem-multicore-cpp 10.1222 "Coloring mesh."
+(2012, 4, 21, 1, 15, 7) fem-assembly-cpp 194.172 "Assembly for various forms and backends"
+(2012, 4, 21, 1, 15, 19) fem-convergence-cpp 11.8828 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 21, 1, 15, 20) fem-jit-python 0.000417018 "JIT compilation (in memory cache)"
+(2012, 4, 21, 1, 20, 32) fem-speedup-cpp 312.361 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 21, 1, 20, 32) fem-speedup-cpp-assembly 5.44887 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 21, 1, 20, 32) fem-speedup-cpp-solve 1.98505 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 21, 1, 20, 56) mesh-refinement-cpp 22.7131 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 21, 1, 21, 18) mesh-topology-cpp 21.5561 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 21, 1, 21, 40) mesh-unitcube-cpp 22.4071 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 21, 1, 22, 31) mesh-iteration-cpp 47.9581 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 21, 1, 22, 52) function-evaluation-cpp 21.2446 "Evaluations of functions at arbitrary points."
+(2012, 4, 21, 1, 22, 52) function-evaluation-cpp 21.1633 "Evaluations of functions at arbitrary points."
+(2012, 4, 21, 1, 22, 59) function-extrapolation-python 6.72554 "BENCH:  1.90550684929"
+(2012, 4, 21, 1, 22, 59) function-extrapolation-python 1.90551 "BENCH:  1.90550684929"
+(2012, 4, 21, 1, 23, 21) la-vector-access-cpp 22.4383 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 21, 1, 23, 46) la-vector-assignment-cpp 24.9547 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 22, 1, 11, 1) common-progress-cpp 29.5646 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 22, 1, 11, 33) common-timing-cpp 31.3225 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 22, 1, 11, 43) fem-multicore-cpp 9.93637 "Coloring mesh."
+(2012, 4, 22, 1, 14, 57) fem-assembly-cpp 193.893 "Assembly for various forms and backends"
+(2012, 4, 22, 1, 15, 8) fem-convergence-cpp 11.8767 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 22, 1, 15, 10) fem-jit-python 0.000411415 "JIT compilation (in memory cache)"
+(2012, 4, 22, 1, 20, 23) fem-speedup-cpp 313.282 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 22, 1, 20, 23) fem-speedup-cpp-assembly 5.428 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 22, 1, 20, 23) fem-speedup-cpp-solve 1.98766 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 22, 1, 20, 47) mesh-refinement-cpp 22.6643 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 22, 1, 21, 8) mesh-topology-cpp 21.3226 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 22, 1, 21, 31) mesh-unitcube-cpp 22.4335 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 22, 1, 22, 15) mesh-iteration-cpp 41.9536 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 22, 1, 22, 37) function-evaluation-cpp 21.3033 "Evaluations of functions at arbitrary points."
+(2012, 4, 22, 1, 22, 37) function-evaluation-cpp 21.222 "Evaluations of functions at arbitrary points."
+(2012, 4, 22, 1, 22, 44) function-extrapolation-python 6.77616 "BENCH:  1.90428900719"
+(2012, 4, 22, 1, 22, 44) function-extrapolation-python 1.90429 "BENCH:  1.90428900719"
+(2012, 4, 22, 1, 23, 6) la-vector-access-cpp 22.4397 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 22, 1, 23, 31) la-vector-assignment-cpp 24.9604 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 23, 1, 11, 4) common-progress-cpp 29.5794 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 23, 1, 11, 35) common-timing-cpp 30.9283 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 23, 1, 11, 45) fem-multicore-cpp 10.087 "Coloring mesh."
+(2012, 4, 23, 1, 14, 59) fem-assembly-cpp 193.737 "Assembly for various forms and backends"
+(2012, 4, 23, 1, 15, 11) fem-convergence-cpp 11.9053 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 23, 1, 15, 12) fem-jit-python 0.000401783 "JIT compilation (in memory cache)"
+(2012, 4, 23, 1, 20, 29) fem-speedup-cpp 317.045 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 23, 1, 20, 29) fem-speedup-cpp-assembly 5.43166 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 23, 1, 20, 29) fem-speedup-cpp-solve 1.91184 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 23, 1, 20, 53) mesh-refinement-cpp 22.6769 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 23, 1, 21, 15) mesh-topology-cpp 21.3928 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 23, 1, 21, 37) mesh-unitcube-cpp 22.3844 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 23, 1, 22, 23) mesh-iteration-cpp 42.7467 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 23, 1, 22, 44) function-evaluation-cpp 21.368 "Evaluations of functions at arbitrary points."
+(2012, 4, 23, 1, 22, 44) function-evaluation-cpp 21.2797 "Evaluations of functions at arbitrary points."
+(2012, 4, 23, 1, 22, 51) function-extrapolation-python 6.57987 "BENCH:  1.87099385262"
+(2012, 4, 23, 1, 22, 51) function-extrapolation-python 1.87099 "BENCH:  1.87099385262"
+(2012, 4, 23, 1, 23, 14) la-vector-access-cpp 23.0003 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 23, 1, 23, 39) la-vector-assignment-cpp 25.0918 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 24, 1, 11, 24) common-progress-cpp 29.8705 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 24, 1, 11, 55) common-timing-cpp 30.5995 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 24, 1, 12, 5) fem-multicore-cpp 10.0213 "Coloring mesh."
+(2012, 4, 24, 1, 15, 19) fem-assembly-cpp 194.317 "Assembly for various forms and backends"
+(2012, 4, 24, 1, 15, 31) fem-convergence-cpp 11.8945 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 24, 1, 15, 32) fem-jit-python 0.000413299 "JIT compilation (in memory cache)"
+(2012, 4, 24, 1, 20, 45) fem-speedup-cpp 312.664 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 24, 1, 20, 45) fem-speedup-cpp-assembly 5.43314 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 24, 1, 20, 45) fem-speedup-cpp-solve 1.9839 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 24, 1, 21, 9) mesh-refinement-cpp 22.6099 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 24, 1, 21, 31) mesh-topology-cpp 21.3277 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 24, 1, 21, 53) mesh-unitcube-cpp 22.4734 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 24, 1, 22, 38) mesh-iteration-cpp 41.9552 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 24, 1, 22, 59) function-evaluation-cpp 21.2943 "Evaluations of functions at arbitrary points."
+(2012, 4, 24, 1, 22, 59) function-evaluation-cpp 21.213 "Evaluations of functions at arbitrary points."
+(2012, 4, 24, 1, 23, 6) function-extrapolation-python 6.79949 "BENCH:  1.90289306641"
+(2012, 4, 24, 1, 23, 6) function-extrapolation-python 1.90289 "BENCH:  1.90289306641"
+(2012, 4, 24, 1, 23, 28) la-vector-access-cpp 22.4134 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 24, 1, 23, 53) la-vector-assignment-cpp 24.9436 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 25, 1, 11, 20) common-progress-cpp 29.6066 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 25, 1, 11, 51) common-timing-cpp 30.8745 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 25, 1, 12, 1) fem-multicore-cpp 10.0471 "Coloring mesh."
+(2012, 4, 25, 1, 15, 15) fem-assembly-cpp 194.202 "Assembly for various forms and backends"
+(2012, 4, 25, 1, 15, 27) fem-convergence-cpp 11.8709 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 25, 1, 15, 28) fem-jit-python 0.000406599 "JIT compilation (in memory cache)"
+(2012, 4, 25, 1, 20, 37) fem-speedup-cpp 309.563 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 25, 1, 20, 37) fem-speedup-cpp-assembly 5.05148 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 25, 1, 20, 37) fem-speedup-cpp-solve 2.0173 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 25, 1, 21, 2) mesh-refinement-cpp 22.8024 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 25, 1, 21, 23) mesh-topology-cpp 21.2844 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 25, 1, 21, 46) mesh-unitcube-cpp 22.8737 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 25, 1, 22, 30) mesh-iteration-cpp 41.963 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 25, 1, 22, 52) function-evaluation-cpp 21.3133 "Evaluations of functions at arbitrary points."
+(2012, 4, 25, 1, 22, 52) function-evaluation-cpp 21.2323 "Evaluations of functions at arbitrary points."
+(2012, 4, 25, 1, 22, 59) function-extrapolation-python 6.72501 "BENCH:  1.9053709507"
+(2012, 4, 25, 1, 22, 59) function-extrapolation-python 1.90537 "BENCH:  1.9053709507"
+(2012, 4, 25, 1, 23, 22) la-vector-access-cpp 22.8958 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 25, 1, 23, 47) la-vector-assignment-cpp 24.9489 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 26, 1, 11, 3) common-progress-cpp 29.578 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 26, 1, 11, 33) common-timing-cpp 30.2781 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 26, 1, 11, 43) fem-multicore-cpp 10.0408 "Coloring mesh."
+(2012, 4, 26, 1, 14, 56) fem-assembly-cpp 192.944 "Assembly for various forms and backends"
+(2012, 4, 26, 1, 15, 8) fem-convergence-cpp 11.8974 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 26, 1, 15, 9) fem-jit-python 0.000407696 "JIT compilation (in memory cache)"
+(2012, 4, 26, 1, 20, 20) fem-speedup-cpp 311.103 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 26, 1, 20, 20) fem-speedup-cpp-assembly 5.50609 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 26, 1, 20, 20) fem-speedup-cpp-solve 2.01727 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 26, 1, 20, 44) mesh-refinement-cpp 22.8465 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 26, 1, 21, 6) mesh-topology-cpp 21.1994 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 26, 1, 21, 29) mesh-unitcube-cpp 22.9647 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 26, 1, 22, 13) mesh-iteration-cpp 41.9606 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 26, 1, 22, 34) function-evaluation-cpp 21.1027 "Evaluations of functions at arbitrary points."
+(2012, 4, 26, 1, 22, 34) function-evaluation-cpp 21.0216 "Evaluations of functions at arbitrary points."
+(2012, 4, 26, 1, 22, 41) function-extrapolation-python 6.72148 "BENCH:  1.90126991272"
+(2012, 4, 26, 1, 22, 41) function-extrapolation-python 1.90127 "BENCH:  1.90126991272"
+(2012, 4, 26, 1, 23, 4) la-vector-access-cpp 22.8984 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 26, 1, 23, 32) la-vector-assignment-cpp 27.8939 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 27, 1, 11, 33) common-progress-cpp 29.6143 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 27, 1, 12, 3) common-timing-cpp 30.0286 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 27, 1, 12, 13) fem-multicore-cpp 9.96386 "Coloring mesh."
+(2012, 4, 27, 1, 15, 27) fem-assembly-cpp 193.596 "Assembly for various forms and backends"
+(2012, 4, 27, 1, 15, 39) fem-convergence-cpp 11.8802 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 27, 1, 15, 40) fem-jit-python 0.000405693 "JIT compilation (in memory cache)"
+(2012, 4, 27, 1, 20, 51) fem-speedup-cpp 310.826 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 27, 1, 20, 51) fem-speedup-cpp-assembly 5.3286 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 27, 1, 20, 51) fem-speedup-cpp-solve 2.01275 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 27, 1, 21, 15) mesh-refinement-cpp 22.5063 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 27, 1, 21, 36) mesh-topology-cpp 21.3384 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 27, 1, 22, 0) mesh-unitcube-cpp 23.3504 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 27, 1, 22, 47) mesh-iteration-cpp 44.7476 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 27, 1, 23, 8) function-evaluation-cpp 21.3546 "Evaluations of functions at arbitrary points."
+(2012, 4, 27, 1, 23, 8) function-evaluation-cpp 21.2732 "Evaluations of functions at arbitrary points."
+(2012, 4, 27, 1, 23, 15) function-extrapolation-python 6.73874 "BENCH:  1.90335917473"
+(2012, 4, 27, 1, 23, 15) function-extrapolation-python 1.90336 "BENCH:  1.90335917473"
+(2012, 4, 27, 1, 23, 38) la-vector-access-cpp 22.9011 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 27, 1, 24, 3) la-vector-assignment-cpp 24.9626 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 28, 1, 11, 3) common-progress-cpp 29.5722 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 28, 1, 11, 34) common-timing-cpp 30.8464 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 28, 1, 11, 44) fem-multicore-cpp 9.97898 "Coloring mesh."
+(2012, 4, 28, 1, 14, 56) fem-assembly-cpp 191.886 "Assembly for various forms and backends"
+(2012, 4, 28, 1, 15, 8) fem-convergence-cpp 11.9076 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 28, 1, 15, 9) fem-jit-python 0.000423503 "JIT compilation (in memory cache)"
+(2012, 4, 28, 1, 20, 20) fem-speedup-cpp 311.399 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 28, 1, 20, 20) fem-speedup-cpp-assembly 5.43823 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 28, 1, 20, 20) fem-speedup-cpp-solve 2.03134 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 28, 1, 20, 44) mesh-refinement-cpp 22.5445 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 28, 1, 21, 5) mesh-topology-cpp 21.164 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 28, 1, 21, 28) mesh-unitcube-cpp 22.9426 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 28, 1, 22, 16) mesh-iteration-cpp 45.5473 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 28, 1, 22, 38) function-evaluation-cpp 21.3854 "Evaluations of functions at arbitrary points."
+(2012, 4, 28, 1, 22, 38) function-evaluation-cpp 21.3044 "Evaluations of functions at arbitrary points."
+(2012, 4, 28, 1, 22, 45) function-extrapolation-python 6.73951 "BENCH:  1.89307403564"
+(2012, 4, 28, 1, 22, 45) function-extrapolation-python 1.89307 "BENCH:  1.89307403564"
+(2012, 4, 28, 1, 23, 9) la-vector-access-cpp 24.3891 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 28, 1, 23, 34) la-vector-assignment-cpp 24.9493 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 29, 1, 11, 9) common-progress-cpp 36.4359 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 29, 1, 11, 40) common-timing-cpp 31.5174 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 29, 1, 11, 50) fem-multicore-cpp 10.0968 "Coloring mesh."
+(2012, 4, 29, 1, 15, 4) fem-assembly-cpp 193.244 "Assembly for various forms and backends"
+(2012, 4, 29, 1, 15, 15) fem-convergence-cpp 11.8429 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 29, 1, 15, 17) fem-jit-python 0.000413609 "JIT compilation (in memory cache)"
+(2012, 4, 29, 1, 20, 30) fem-speedup-cpp 313.846 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 29, 1, 20, 30) fem-speedup-cpp-assembly 5.43797 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 29, 1, 20, 30) fem-speedup-cpp-solve 1.98952 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 29, 1, 20, 55) mesh-refinement-cpp 22.6393 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 29, 1, 21, 16) mesh-topology-cpp 21.2768 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 29, 1, 21, 39) mesh-unitcube-cpp 23.0451 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 29, 1, 22, 24) mesh-iteration-cpp 42.5439 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 29, 1, 22, 46) function-evaluation-cpp 21.2636 "Evaluations of functions at arbitrary points."
+(2012, 4, 29, 1, 22, 46) function-evaluation-cpp 21.1828 "Evaluations of functions at arbitrary points."
+(2012, 4, 29, 1, 22, 52) function-extrapolation-python 6.72058 "BENCH:  1.91814398766"
+(2012, 4, 29, 1, 22, 52) function-extrapolation-python 1.91814 "BENCH:  1.91814398766"
+(2012, 4, 29, 1, 23, 15) la-vector-access-cpp 22.8914 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 29, 1, 23, 40) la-vector-assignment-cpp 24.9444 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 4, 30, 1, 11, 6) common-progress-cpp 37.6897 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 4, 30, 1, 11, 38) common-timing-cpp 31.2945 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 4, 30, 1, 11, 48) fem-multicore-cpp 10.0715 "Coloring mesh."
+(2012, 4, 30, 1, 15, 0) fem-assembly-cpp 192.317 "Assembly for various forms and backends"
+(2012, 4, 30, 1, 15, 12) fem-convergence-cpp 11.8947 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 4, 30, 1, 15, 13) fem-jit-python 0.000404596 "JIT compilation (in memory cache)"
+(2012, 4, 30, 1, 20, 24) fem-speedup-cpp 311.524 "Assembly/solve speedup running on 4 processors"
+(2012, 4, 30, 1, 20, 24) fem-speedup-cpp-assembly 5.43241 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 4, 30, 1, 20, 24) fem-speedup-cpp-solve 2.01566 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 4, 30, 1, 20, 48) mesh-refinement-cpp 22.4807 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 4, 30, 1, 21, 10) mesh-topology-cpp 21.147 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 4, 30, 1, 21, 33) mesh-unitcube-cpp 23.0136 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 4, 30, 1, 22, 17) mesh-iteration-cpp 41.9589 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 4, 30, 1, 22, 39) function-evaluation-cpp 21.2606 "Evaluations of functions at arbitrary points."
+(2012, 4, 30, 1, 22, 39) function-evaluation-cpp 21.1795 "Evaluations of functions at arbitrary points."
+(2012, 4, 30, 1, 22, 45) function-extrapolation-python 6.77603 "BENCH:  1.95966100693"
+(2012, 4, 30, 1, 22, 45) function-extrapolation-python 1.95966 "BENCH:  1.95966100693"
+(2012, 4, 30, 1, 23, 8) la-vector-access-cpp 22.8911 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 4, 30, 1, 23, 33) la-vector-assignment-cpp 24.9481 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 1, 1, 11, 14) common-progress-cpp 29.6728 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 1, 1, 11, 45) common-timing-cpp 30.7784 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 1, 1, 11, 55) fem-multicore-cpp 10.0783 "Coloring mesh."
+(2012, 5, 1, 1, 15, 8) fem-assembly-cpp 192.609 "Assembly for various forms and backends"
+(2012, 5, 1, 1, 15, 20) fem-convergence-cpp 11.9016 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 1, 1, 15, 21) fem-jit-python 0.000410104 "JIT compilation (in memory cache)"
+(2012, 5, 1, 1, 20, 31) fem-speedup-cpp 309.921 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 1, 1, 20, 31) fem-speedup-cpp-assembly 5.45925 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 1, 1, 20, 31) fem-speedup-cpp-solve 2.01244 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 1, 1, 20, 55) mesh-refinement-cpp 22.5479 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 1, 1, 21, 16) mesh-topology-cpp 21.1494 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 1, 1, 21, 39) mesh-unitcube-cpp 23.0437 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 1, 1, 22, 24) mesh-iteration-cpp 41.9561 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 1, 1, 22, 45) function-evaluation-cpp 20.9268 "Evaluations of functions at arbitrary points."
+(2012, 5, 1, 1, 22, 45) function-evaluation-cpp 20.8392 "Evaluations of functions at arbitrary points."
+(2012, 5, 1, 1, 22, 52) function-extrapolation-python 6.90457 "BENCH:  1.95063400269"
+(2012, 5, 1, 1, 22, 52) function-extrapolation-python 1.95063 "BENCH:  1.95063400269"
+(2012, 5, 1, 1, 23, 14) la-vector-access-cpp 22.8938 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 1, 1, 23, 39) la-vector-assignment-cpp 24.9443 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 2, 1, 11, 2) common-progress-cpp 29.5664 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 2, 1, 11, 32) common-timing-cpp 30.7228 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 2, 1, 11, 42) fem-multicore-cpp 10.0352 "Coloring mesh."
+(2012, 5, 2, 1, 14, 55) fem-assembly-cpp 192.826 "Assembly for various forms and backends"
+(2012, 5, 2, 1, 15, 7) fem-convergence-cpp 11.916 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 2, 1, 15, 8) fem-jit-python 0.000402808 "JIT compilation (in memory cache)"
+(2012, 5, 2, 1, 20, 20) fem-speedup-cpp 311.846 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 2, 1, 20, 20) fem-speedup-cpp-assembly 5.34273 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 2, 1, 20, 20) fem-speedup-cpp-solve 1.99734 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 2, 1, 20, 44) mesh-refinement-cpp 22.5059 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 2, 1, 21, 5) mesh-topology-cpp 21.2231 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 2, 1, 21, 29) mesh-unitcube-cpp 23.0814 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 2, 1, 22, 13) mesh-iteration-cpp 41.9839 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 2, 1, 22, 35) function-evaluation-cpp 22.006 "Evaluations of functions at arbitrary points."
+(2012, 5, 2, 1, 22, 35) function-evaluation-cpp 21.9155 "Evaluations of functions at arbitrary points."
+(2012, 5, 2, 1, 22, 42) function-extrapolation-python 6.72567 "BENCH:  1.94297981262"
+(2012, 5, 2, 1, 22, 42) function-extrapolation-python 1.94298 "BENCH:  1.94297981262"
+(2012, 5, 2, 1, 23, 5) la-vector-access-cpp 22.8918 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 2, 1, 23, 30) la-vector-assignment-cpp 24.947 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 3, 1, 11, 0) common-progress-cpp 29.6279 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 3, 1, 11, 32) common-timing-cpp 31.5957 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 3, 1, 11, 42) fem-multicore-cpp 10.0787 "Coloring mesh."
+(2012, 5, 3, 1, 14, 55) fem-assembly-cpp 193.423 "Assembly for various forms and backends"
+(2012, 5, 3, 1, 15, 7) fem-convergence-cpp 11.8753 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 3, 1, 15, 8) fem-jit-python 0.000418901 "JIT compilation (in memory cache)"
+(2012, 5, 3, 1, 20, 20) fem-speedup-cpp 311.621 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 3, 1, 20, 20) fem-speedup-cpp-assembly 5.45161 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 3, 1, 20, 20) fem-speedup-cpp-solve 2.00328 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 3, 1, 20, 44) mesh-refinement-cpp 22.5706 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 3, 1, 21, 5) mesh-topology-cpp 21.1757 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 3, 1, 21, 28) mesh-unitcube-cpp 22.97 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 3, 1, 22, 17) mesh-iteration-cpp 46.5573 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 3, 1, 22, 39) function-evaluation-cpp 21.341 "Evaluations of functions at arbitrary points."
+(2012, 5, 3, 1, 22, 39) function-evaluation-cpp 21.2462 "Evaluations of functions at arbitrary points."
+(2012, 5, 3, 1, 22, 45) function-extrapolation-python 6.77149 "BENCH:  1.94217681885"
+(2012, 5, 3, 1, 22, 45) function-extrapolation-python 1.94218 "BENCH:  1.94217681885"
+(2012, 5, 3, 1, 23, 8) la-vector-access-cpp 22.8919 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 3, 1, 23, 33) la-vector-assignment-cpp 24.9502 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 4, 1, 11, 11) common-progress-cpp 37.69 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 4, 1, 11, 42) common-timing-cpp 31.0577 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 4, 1, 11, 52) fem-multicore-cpp 10.1671 "Coloring mesh."
+(2012, 5, 4, 1, 15, 4) fem-assembly-cpp 192.233 "Assembly for various forms and backends"
+(2012, 5, 4, 1, 15, 16) fem-convergence-cpp 11.8399 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 4, 1, 15, 17) fem-jit-python 0.000430417 "JIT compilation (in memory cache)"
+(2012, 5, 4, 1, 20, 28) fem-speedup-cpp 310.953 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 4, 1, 20, 28) fem-speedup-cpp-assembly 5.45039 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 4, 1, 20, 28) fem-speedup-cpp-solve 2.03963 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 4, 1, 20, 52) mesh-refinement-cpp 22.5244 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 4, 1, 21, 14) mesh-topology-cpp 21.281 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 4, 1, 21, 37) mesh-unitcube-cpp 22.9758 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 4, 1, 22, 22) mesh-iteration-cpp 42.2445 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 4, 1, 22, 43) function-evaluation-cpp 21.338 "Evaluations of functions at arbitrary points."
+(2012, 5, 4, 1, 22, 43) function-evaluation-cpp 21.2268 "Evaluations of functions at arbitrary points."
+(2012, 5, 4, 1, 22, 50) function-extrapolation-python 6.82877 "BENCH:  1.91648793221"
+(2012, 5, 4, 1, 22, 50) function-extrapolation-python 1.91649 "BENCH:  1.91648793221"
+(2012, 5, 4, 1, 23, 13) la-vector-access-cpp 22.9364 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 4, 1, 23, 38) la-vector-assignment-cpp 24.9838 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 5, 1, 11, 11) common-progress-cpp 29.1965 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 5, 1, 11, 42) common-timing-cpp 30.9071 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 5, 1, 11, 52) fem-multicore-cpp 10.0601 "Coloring mesh."
+(2012, 5, 5, 1, 15, 5) fem-assembly-cpp 192.683 "Assembly for various forms and backends"
+(2012, 5, 5, 1, 15, 17) fem-convergence-cpp 11.8871 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 5, 1, 15, 18) fem-jit-python 0.000421309 "JIT compilation (in memory cache)"
+(2012, 5, 5, 1, 20, 29) fem-speedup-cpp 310.873 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 5, 1, 20, 29) fem-speedup-cpp-assembly 5.45015 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 5, 1, 20, 29) fem-speedup-cpp-solve 2.01026 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 5, 1, 20, 53) mesh-refinement-cpp 22.5522 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 5, 1, 21, 14) mesh-topology-cpp 21.1878 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 5, 1, 21, 37) mesh-unitcube-cpp 23.0094 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 5, 1, 22, 25) mesh-iteration-cpp 45.3021 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 5, 1, 22, 47) function-evaluation-cpp 21.413 "Evaluations of functions at arbitrary points."
+(2012, 5, 5, 1, 22, 47) function-evaluation-cpp 21.3094 "Evaluations of functions at arbitrary points."
+(2012, 5, 5, 1, 22, 54) function-extrapolation-python 6.90105 "BENCH:  1.92252421379"
+(2012, 5, 5, 1, 22, 54) function-extrapolation-python 1.92252 "BENCH:  1.92252421379"
+(2012, 5, 5, 1, 23, 18) la-vector-access-cpp 23.9142 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 5, 1, 23, 46) la-vector-assignment-cpp 28.3928 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 6, 1, 11, 2) common-progress-cpp 29.6295 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 6, 1, 11, 33) common-timing-cpp 31.2813 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 6, 1, 11, 44) fem-multicore-cpp 10.0412 "Coloring mesh."
+(2012, 5, 6, 1, 14, 56) fem-assembly-cpp 192.481 "Assembly for various forms and backends"
+(2012, 5, 6, 1, 15, 8) fem-convergence-cpp 11.9005 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 6, 1, 15, 9) fem-jit-python 0.000402188 "JIT compilation (in memory cache)"
+(2012, 5, 6, 1, 20, 19) fem-speedup-cpp 309.897 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 6, 1, 20, 19) fem-speedup-cpp-assembly 5.44467 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 6, 1, 20, 19) fem-speedup-cpp-solve 2.01761 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 6, 1, 20, 43) mesh-refinement-cpp 22.5436 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 6, 1, 21, 4) mesh-topology-cpp 21.1975 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 6, 1, 21, 27) mesh-unitcube-cpp 22.9573 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 6, 1, 22, 12) mesh-iteration-cpp 41.9624 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 6, 1, 22, 33) function-evaluation-cpp 21.2298 "Evaluations of functions at arbitrary points."
+(2012, 5, 6, 1, 22, 33) function-evaluation-cpp 21.1328 "Evaluations of functions at arbitrary points."
+(2012, 5, 6, 1, 22, 40) function-extrapolation-python 6.71783 "BENCH:  1.91616392136"
+(2012, 5, 6, 1, 22, 40) function-extrapolation-python 1.91616 "BENCH:  1.91616392136"
+(2012, 5, 6, 1, 23, 3) la-vector-access-cpp 23.4161 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 6, 1, 23, 28) la-vector-assignment-cpp 24.9585 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 7, 1, 11, 0) common-progress-cpp 29.6013 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 7, 1, 11, 30) common-timing-cpp 30.0344 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 7, 1, 11, 40) fem-multicore-cpp 9.99313 "Coloring mesh."
+(2012, 5, 7, 1, 14, 53) fem-assembly-cpp 192.48 "Assembly for various forms and backends"
+(2012, 5, 7, 1, 15, 5) fem-convergence-cpp 11.8372 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 7, 1, 15, 6) fem-jit-python 0.000398088 "JIT compilation (in memory cache)"
+(2012, 5, 7, 1, 20, 17) fem-speedup-cpp 311.283 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 7, 1, 20, 17) fem-speedup-cpp-assembly 5.43498 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 7, 1, 20, 17) fem-speedup-cpp-solve 2.01416 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 7, 1, 20, 41) mesh-refinement-cpp 22.5004 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 7, 1, 21, 2) mesh-topology-cpp 21.2803 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 7, 1, 21, 26) mesh-unitcube-cpp 22.9786 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 7, 1, 22, 10) mesh-iteration-cpp 41.9612 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 7, 1, 22, 31) function-evaluation-cpp 21.3234 "Evaluations of functions at arbitrary points."
+(2012, 5, 7, 1, 22, 31) function-evaluation-cpp 21.2195 "Evaluations of functions at arbitrary points."
+(2012, 5, 7, 1, 22, 38) function-extrapolation-python 6.7076 "BENCH:  1.92141985893"
+(2012, 5, 7, 1, 22, 38) function-extrapolation-python 1.92142 "BENCH:  1.92141985893"
+(2012, 5, 7, 1, 23, 2) la-vector-access-cpp 23.8888 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 7, 1, 23, 31) la-vector-assignment-cpp 28.3937 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 8, 1, 11, 26) common-progress-cpp 36.4364 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 8, 1, 11, 57) common-timing-cpp 30.5164 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 8, 1, 12, 7) fem-multicore-cpp 9.97117 "Coloring mesh."
+(2012, 5, 8, 1, 15, 20) fem-assembly-cpp 193.292 "Assembly for various forms and backends"
+(2012, 5, 8, 1, 15, 32) fem-convergence-cpp 11.8957 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 8, 1, 15, 33) fem-jit-python 0.000415802 "JIT compilation (in memory cache)"
+(2012, 5, 8, 1, 20, 42) fem-speedup-cpp 309.092 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 8, 1, 20, 42) fem-speedup-cpp-assembly 5.43502 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 8, 1, 20, 42) fem-speedup-cpp-solve 2.03607 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 8, 1, 21, 6) mesh-refinement-cpp 22.6704 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 8, 1, 21, 28) mesh-topology-cpp 21.2208 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 8, 1, 21, 51) mesh-unitcube-cpp 22.9858 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 8, 1, 22, 36) mesh-iteration-cpp 42.8899 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 8, 1, 22, 57) function-evaluation-cpp 21.2983 "Evaluations of functions at arbitrary points."
+(2012, 5, 8, 1, 22, 57) function-evaluation-cpp 21.2043 "Evaluations of functions at arbitrary points."
+(2012, 5, 8, 1, 23, 4) function-extrapolation-python 6.8849 "BENCH:  1.92250800133"
+(2012, 5, 8, 1, 23, 4) function-extrapolation-python 1.92251 "BENCH:  1.92250800133"
+(2012, 5, 8, 1, 23, 27) la-vector-access-cpp 22.8915 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 8, 1, 23, 52) la-vector-assignment-cpp 25.0577 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 9, 1, 11, 1) common-progress-cpp 29.6455 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 9, 1, 11, 30) common-timing-cpp 29.4995 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 9, 1, 11, 40) fem-multicore-cpp 10.0212 "Coloring mesh."
+(2012, 5, 9, 1, 14, 54) fem-assembly-cpp 193.563 "Assembly for various forms and backends"
+(2012, 5, 9, 1, 15, 6) fem-convergence-cpp 11.8537 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 9, 1, 15, 7) fem-jit-python 0.000412583 "JIT compilation (in memory cache)"
+(2012, 5, 9, 1, 20, 18) fem-speedup-cpp 311.161 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 9, 1, 20, 18) fem-speedup-cpp-assembly 5.46736 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 9, 1, 20, 18) fem-speedup-cpp-solve 1.99382 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 9, 1, 20, 42) mesh-refinement-cpp 22.5486 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 9, 1, 21, 4) mesh-topology-cpp 21.1867 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 9, 1, 21, 27) mesh-unitcube-cpp 22.9638 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 9, 1, 22, 12) mesh-iteration-cpp 42.8809 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 9, 1, 22, 33) function-evaluation-cpp 20.8885 "Evaluations of functions at arbitrary points."
+(2012, 5, 9, 1, 22, 33) function-evaluation-cpp 20.7947 "Evaluations of functions at arbitrary points."
+(2012, 5, 9, 1, 22, 40) function-extrapolation-python 6.70674 "BENCH:  1.90486907959"
+(2012, 5, 9, 1, 22, 40) function-extrapolation-python 1.90487 "BENCH:  1.90486907959"
+(2012, 5, 9, 1, 23, 3) la-vector-access-cpp 22.8905 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 9, 1, 23, 28) la-vector-assignment-cpp 24.8887 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 10, 1, 11, 28) common-progress-cpp 29.6713 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 10, 1, 11, 58) common-timing-cpp 30.5341 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 10, 1, 12, 8) fem-multicore-cpp 10.0569 "Coloring mesh."
+(2012, 5, 10, 1, 15, 21) fem-assembly-cpp 192.536 "Assembly for various forms and backends"
+(2012, 5, 10, 1, 15, 33) fem-convergence-cpp 11.8702 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 10, 1, 15, 34) fem-jit-python 0.000415206 "JIT compilation (in memory cache)"
+(2012, 5, 10, 1, 20, 44) fem-speedup-cpp 310.053 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 10, 1, 20, 44) fem-speedup-cpp-assembly 5.39773 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 10, 1, 20, 44) fem-speedup-cpp-solve 2.0472 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 10, 1, 21, 8) mesh-refinement-cpp 22.5867 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 10, 1, 21, 29) mesh-topology-cpp 21.0902 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 10, 1, 21, 53) mesh-unitcube-cpp 23.345 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 10, 1, 22, 37) mesh-iteration-cpp 41.9572 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 10, 1, 22, 59) function-evaluation-cpp 21.3066 "Evaluations of functions at arbitrary points."
+(2012, 5, 10, 1, 22, 59) function-evaluation-cpp 21.214 "Evaluations of functions at arbitrary points."
+(2012, 5, 10, 1, 23, 5) function-extrapolation-python 6.62941 "BENCH:  1.90426087379"
+(2012, 5, 10, 1, 23, 5) function-extrapolation-python 1.90426 "BENCH:  1.90426087379"
+(2012, 5, 10, 1, 23, 28) la-vector-access-cpp 22.889 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 10, 1, 23, 56) la-vector-assignment-cpp 27.8939 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 11, 1, 11, 14) common-progress-cpp 29.5793 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 11, 1, 11, 44) common-timing-cpp 29.4822 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 11, 1, 11, 54) fem-multicore-cpp 10.091 "Coloring mesh."
+(2012, 5, 11, 1, 15, 6) fem-assembly-cpp 192.076 "Assembly for various forms and backends"
+(2012, 5, 11, 1, 15, 18) fem-convergence-cpp 11.8655 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 11, 1, 15, 19) fem-jit-python 0.000414896 "JIT compilation (in memory cache)"
+(2012, 5, 11, 1, 20, 29) fem-speedup-cpp 310.324 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 11, 1, 20, 29) fem-speedup-cpp-assembly 5.39041 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 11, 1, 20, 29) fem-speedup-cpp-solve 1.99685 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 11, 1, 20, 53) mesh-refinement-cpp 22.4623 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 11, 1, 21, 15) mesh-topology-cpp 21.4203 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 11, 1, 21, 38) mesh-unitcube-cpp 22.959 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 11, 1, 22, 27) mesh-iteration-cpp 46.0242 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 11, 1, 22, 48) function-evaluation-cpp 21.1649 "Evaluations of functions at arbitrary points."
+(2012, 5, 11, 1, 22, 48) function-evaluation-cpp 21.0715 "Evaluations of functions at arbitrary points."
+(2012, 5, 11, 1, 22, 55) function-extrapolation-python 6.70405 "BENCH:  1.9132399559"
+(2012, 5, 11, 1, 22, 55) function-extrapolation-python 1.91324 "BENCH:  1.9132399559"
+(2012, 5, 11, 1, 23, 18) la-vector-access-cpp 22.8891 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 11, 1, 23, 45) la-vector-assignment-cpp 27.8901 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 12, 1, 11, 38) common-progress-cpp 29.1726 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 12, 1, 12, 8) common-timing-cpp 29.1381 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 12, 1, 12, 18) fem-multicore-cpp 10.2136 "Coloring mesh."
+(2012, 5, 12, 1, 15, 31) fem-assembly-cpp 192.958 "Assembly for various forms and backends"
+(2012, 5, 12, 1, 15, 43) fem-convergence-cpp 11.9306 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 12, 1, 15, 44) fem-jit-python 0.000427794 "JIT compilation (in memory cache)"
+(2012, 5, 12, 1, 20, 56) fem-speedup-cpp 312.037 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 12, 1, 20, 56) fem-speedup-cpp-assembly 5.52015 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 12, 1, 20, 56) fem-speedup-cpp-solve 1.99804 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 12, 1, 21, 20) mesh-refinement-cpp 22.8419 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 12, 1, 21, 42) mesh-topology-cpp 21.3096 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 12, 1, 22, 5) mesh-unitcube-cpp 22.934 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 12, 1, 22, 48) mesh-iteration-cpp 40.3834 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 12, 1, 23, 9) function-evaluation-cpp 21.1984 "Evaluations of functions at arbitrary points."
+(2012, 5, 12, 1, 23, 9) function-evaluation-cpp 21.1019 "Evaluations of functions at arbitrary points."
+(2012, 5, 12, 1, 23, 16) function-extrapolation-python 6.95653 "BENCH:  1.93875288963"
+(2012, 5, 12, 1, 23, 16) function-extrapolation-python 1.93875 "BENCH:  1.93875288963"
+(2012, 5, 12, 1, 23, 39) la-vector-access-cpp 22.6201 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 12, 1, 24, 4) la-vector-assignment-cpp 24.9544 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 13, 1, 11, 5) common-progress-cpp 29.6152 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 13, 1, 11, 34) common-timing-cpp 29.6787 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 13, 1, 11, 44) fem-multicore-cpp 10.0758 "Coloring mesh."
+(2012, 5, 13, 1, 14, 59) fem-assembly-cpp 194.653 "Assembly for various forms and backends"
+(2012, 5, 13, 1, 15, 11) fem-convergence-cpp 11.8781 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 13, 1, 15, 12) fem-jit-python 0.000433397 "JIT compilation (in memory cache)"
+(2012, 5, 13, 1, 20, 24) fem-speedup-cpp 311.862 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 13, 1, 20, 24) fem-speedup-cpp-assembly 5.53048 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 13, 1, 20, 24) fem-speedup-cpp-solve 1.97858 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 13, 1, 20, 48) mesh-refinement-cpp 22.8472 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 13, 1, 21, 10) mesh-topology-cpp 21.4051 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 13, 1, 21, 33) mesh-unitcube-cpp 22.8578 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 13, 1, 22, 16) mesh-iteration-cpp 40.3815 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 13, 1, 22, 37) function-evaluation-cpp 21.3066 "Evaluations of functions at arbitrary points."
+(2012, 5, 13, 1, 22, 37) function-evaluation-cpp 21.2131 "Evaluations of functions at arbitrary points."
+(2012, 5, 13, 1, 22, 44) function-extrapolation-python 6.69725 "BENCH:  1.91420412064"
+(2012, 5, 13, 1, 22, 44) function-extrapolation-python 1.9142 "BENCH:  1.91420412064"
+(2012, 5, 13, 1, 23, 6) la-vector-access-cpp 22.4094 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 13, 1, 23, 31) la-vector-assignment-cpp 24.947 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 14, 1, 11, 0) common-progress-cpp 29.7758 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 14, 1, 11, 29) common-timing-cpp 29.1657 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 14, 1, 11, 39) fem-multicore-cpp 10.0339 "Coloring mesh."
+(2012, 5, 14, 1, 14, 53) fem-assembly-cpp 193.756 "Assembly for various forms and backends"
+(2012, 5, 14, 1, 15, 5) fem-convergence-cpp 11.8774 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 14, 1, 15, 6) fem-jit-python 0.000419116 "JIT compilation (in memory cache)"
+(2012, 5, 14, 1, 20, 20) fem-speedup-cpp 313.853 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 14, 1, 20, 20) fem-speedup-cpp-assembly 5.50463 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 14, 1, 20, 20) fem-speedup-cpp-solve 1.99162 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 14, 1, 20, 44) mesh-refinement-cpp 22.8547 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 14, 1, 21, 6) mesh-topology-cpp 21.2888 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 14, 1, 21, 29) mesh-unitcube-cpp 23.0275 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 14, 1, 22, 12) mesh-iteration-cpp 40.3848 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 14, 1, 22, 33) function-evaluation-cpp 21.3024 "Evaluations of functions at arbitrary points."
+(2012, 5, 14, 1, 22, 33) function-evaluation-cpp 21.2207 "Evaluations of functions at arbitrary points."
+(2012, 5, 14, 1, 22, 40) function-extrapolation-python 6.68933 "BENCH:  1.89248800278"
+(2012, 5, 14, 1, 22, 40) function-extrapolation-python 1.89249 "BENCH:  1.89248800278"
+(2012, 5, 14, 1, 23, 5) la-vector-access-cpp 24.754 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 14, 1, 23, 33) la-vector-assignment-cpp 27.9046 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 15, 1, 11, 24) common-progress-cpp 29.595 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 15, 1, 11, 54) common-timing-cpp 30.1962 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 15, 1, 12, 4) fem-multicore-cpp 10.0939 "Coloring mesh."
+(2012, 5, 15, 1, 15, 17) fem-assembly-cpp 192.951 "Assembly for various forms and backends"
+(2012, 5, 15, 1, 15, 29) fem-convergence-cpp 11.9242 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 15, 1, 15, 30) fem-jit-python 0.000412488 "JIT compilation (in memory cache)"
+(2012, 5, 15, 1, 20, 42) fem-speedup-cpp 311.361 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 15, 1, 20, 42) fem-speedup-cpp-assembly 5.52625 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 15, 1, 20, 42) fem-speedup-cpp-solve 2.03731 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 15, 1, 21, 6) mesh-refinement-cpp 22.8064 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 15, 1, 21, 28) mesh-topology-cpp 21.3559 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 15, 1, 21, 51) mesh-unitcube-cpp 22.8974 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 15, 1, 22, 34) mesh-iteration-cpp 40.4361 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 15, 1, 22, 55) function-evaluation-cpp 21.0107 "Evaluations of functions at arbitrary points."
+(2012, 5, 15, 1, 22, 55) function-evaluation-cpp 20.9296 "Evaluations of functions at arbitrary points."
+(2012, 5, 15, 1, 23, 2) function-extrapolation-python 6.73524 "BENCH:  1.90603494644"
+(2012, 5, 15, 1, 23, 2) function-extrapolation-python 1.90603 "BENCH:  1.90603494644"
+(2012, 5, 15, 1, 23, 24) la-vector-access-cpp 22.4213 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 15, 1, 23, 49) la-vector-assignment-cpp 24.9484 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 16, 1, 11, 13) common-progress-cpp 29.1853 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 16, 1, 11, 42) common-timing-cpp 29.18 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 16, 1, 11, 52) fem-multicore-cpp 10.1642 "Coloring mesh."
+(2012, 5, 16, 1, 15, 6) fem-assembly-cpp 193.686 "Assembly for various forms and backends"
+(2012, 5, 16, 1, 15, 18) fem-convergence-cpp 11.903 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 16, 1, 15, 19) fem-jit-python 0.000425601 "JIT compilation (in memory cache)"
+(2012, 5, 16, 1, 20, 33) fem-speedup-cpp 313.797 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 16, 1, 20, 33) fem-speedup-cpp-assembly 5.51376 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 16, 1, 20, 33) fem-speedup-cpp-solve 1.97963 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 16, 1, 20, 57) mesh-refinement-cpp 22.8326 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 16, 1, 21, 19) mesh-topology-cpp 21.3055 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 16, 1, 21, 42) mesh-unitcube-cpp 22.8758 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 16, 1, 22, 27) mesh-iteration-cpp 42.8695 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 16, 1, 22, 48) function-evaluation-cpp 20.8951 "Evaluations of functions at arbitrary points."
+(2012, 5, 16, 1, 22, 48) function-evaluation-cpp 20.814 "Evaluations of functions at arbitrary points."
+(2012, 5, 16, 1, 22, 55) function-extrapolation-python 6.72322 "BENCH:  1.92462015152"
+(2012, 5, 16, 1, 22, 55) function-extrapolation-python 1.92462 "BENCH:  1.92462015152"
+(2012, 5, 16, 1, 23, 17) la-vector-access-cpp 22.4294 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 16, 1, 23, 42) la-vector-assignment-cpp 24.945 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 17, 1, 11, 6) common-progress-cpp 29.5754 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 17, 1, 11, 35) common-timing-cpp 29.1286 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 17, 1, 11, 45) fem-multicore-cpp 10.0872 "Coloring mesh."
+(2012, 5, 17, 1, 14, 59) fem-assembly-cpp 193.744 "Assembly for various forms and backends"
+(2012, 5, 17, 1, 15, 11) fem-convergence-cpp 11.8708 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 17, 1, 15, 12) fem-jit-python 0.000419092 "JIT compilation (in memory cache)"
+(2012, 5, 17, 1, 20, 22) fem-speedup-cpp 309.934 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 17, 1, 20, 22) fem-speedup-cpp-assembly 5.42661 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 17, 1, 20, 22) fem-speedup-cpp-solve 2.0576 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 17, 1, 20, 46) mesh-refinement-cpp 22.8354 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 17, 1, 21, 7) mesh-topology-cpp 21.3649 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 17, 1, 21, 30) mesh-unitcube-cpp 22.9045 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 17, 1, 22, 14) mesh-iteration-cpp 41.6378 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 17, 1, 22, 36) function-evaluation-cpp 21.3132 "Evaluations of functions at arbitrary points."
+(2012, 5, 17, 1, 22, 36) function-evaluation-cpp 21.204 "Evaluations of functions at arbitrary points."
+(2012, 5, 17, 1, 22, 42) function-extrapolation-python 6.10387 "BENCH:  1.83741283417"
+(2012, 5, 17, 1, 22, 42) function-extrapolation-python 1.83741 "BENCH:  1.83741283417"
+(2012, 5, 17, 1, 23, 4) la-vector-access-cpp 22.4361 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 17, 1, 23, 29) la-vector-assignment-cpp 24.9543 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 18, 1, 11, 2) common-progress-cpp 29.185 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 18, 1, 11, 32) common-timing-cpp 29.8661 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 18, 1, 11, 42) fem-multicore-cpp 10.0076 "Coloring mesh."
+(2012, 5, 18, 1, 14, 56) fem-assembly-cpp 193.839 "Assembly for various forms and backends"
+(2012, 5, 18, 1, 15, 7) fem-convergence-cpp 11.4298 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 18, 1, 15, 9) fem-jit-python 0.000420213 "JIT compilation (in memory cache)"
+(2012, 5, 18, 1, 20, 19) fem-speedup-cpp 310.263 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 18, 1, 20, 19) fem-speedup-cpp-assembly 5.51431 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 18, 1, 20, 19) fem-speedup-cpp-solve 2.02309 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 18, 1, 20, 43) mesh-refinement-cpp 22.8483 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 18, 1, 21, 5) mesh-topology-cpp 21.3057 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 18, 1, 21, 28) mesh-unitcube-cpp 22.9116 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 18, 1, 22, 10) mesh-iteration-cpp 40.376 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 18, 1, 22, 32) function-evaluation-cpp 21.338 "Evaluations of functions at arbitrary points."
+(2012, 5, 18, 1, 22, 32) function-evaluation-cpp 21.2566 "Evaluations of functions at arbitrary points."
+(2012, 5, 18, 1, 22, 39) function-extrapolation-python 6.72392 "BENCH:  1.90056300163"
+(2012, 5, 18, 1, 22, 39) function-extrapolation-python 1.90056 "BENCH:  1.90056300163"
+(2012, 5, 18, 1, 23, 1) la-vector-access-cpp 22.4229 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 18, 1, 23, 30) la-vector-assignment-cpp 28.3925 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 19, 1, 11, 23) common-progress-cpp 29.5897 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 19, 1, 11, 52) common-timing-cpp 29.5265 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 19, 1, 12, 2) fem-multicore-cpp 10.1856 "Coloring mesh."
+(2012, 5, 19, 1, 15, 15) fem-assembly-cpp 192.455 "Assembly for various forms and backends"
+(2012, 5, 19, 1, 15, 27) fem-convergence-cpp 11.9157 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 19, 1, 15, 28) fem-jit-python 0.000427103 "JIT compilation (in memory cache)"
+(2012, 5, 19, 1, 20, 40) fem-speedup-cpp 312.269 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 19, 1, 20, 40) fem-speedup-cpp-assembly 5.27967 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 19, 1, 20, 40) fem-speedup-cpp-solve 2.02355 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 19, 1, 21, 4) mesh-refinement-cpp 22.8047 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 19, 1, 21, 26) mesh-topology-cpp 21.5603 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 19, 1, 21, 48) mesh-unitcube-cpp 21.9737 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 19, 1, 22, 33) mesh-iteration-cpp 42.2436 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 19, 1, 22, 54) function-evaluation-cpp 21.3128 "Evaluations of functions at arbitrary points."
+(2012, 5, 19, 1, 22, 54) function-evaluation-cpp 21.2252 "Evaluations of functions at arbitrary points."
+(2012, 5, 19, 1, 23, 1) function-extrapolation-python 6.93798 "BENCH:  1.97170209885"
+(2012, 5, 19, 1, 23, 1) function-extrapolation-python 1.9717 "BENCH:  1.97170209885"
+(2012, 5, 19, 1, 23, 24) la-vector-access-cpp 22.8908 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 19, 1, 23, 49) la-vector-assignment-cpp 24.9476 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 20, 1, 11, 4) common-progress-cpp 29.0307 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 20, 1, 11, 35) common-timing-cpp 30.4833 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 20, 1, 11, 45) fem-multicore-cpp 10.1456 "Coloring mesh."
+(2012, 5, 20, 1, 14, 56) fem-assembly-cpp 191.331 "Assembly for various forms and backends"
+(2012, 5, 20, 1, 15, 8) fem-convergence-cpp 11.8639 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 20, 1, 15, 9) fem-jit-python 0.000417089 "JIT compilation (in memory cache)"
+(2012, 5, 20, 1, 20, 20) fem-speedup-cpp 310.484 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 20, 1, 20, 20) fem-speedup-cpp-assembly 5.29232 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 20, 1, 20, 20) fem-speedup-cpp-solve 2.04355 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 20, 1, 20, 44) mesh-refinement-cpp 22.8065 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 20, 1, 21, 6) mesh-topology-cpp 21.6726 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 20, 1, 21, 28) mesh-unitcube-cpp 22.0115 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 20, 1, 22, 11) mesh-iteration-cpp 40.402 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 20, 1, 22, 32) function-evaluation-cpp 21.3065 "Evaluations of functions at arbitrary points."
+(2012, 5, 20, 1, 22, 32) function-evaluation-cpp 21.2248 "Evaluations of functions at arbitrary points."
+(2012, 5, 20, 1, 22, 39) function-extrapolation-python 6.85689 "BENCH:  1.93156290054"
+(2012, 5, 20, 1, 22, 39) function-extrapolation-python 1.93156 "BENCH:  1.93156290054"
+(2012, 5, 20, 1, 23, 2) la-vector-access-cpp 22.8902 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 20, 1, 23, 31) la-vector-assignment-cpp 28.3952 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 21, 1, 11, 19) common-progress-cpp 37.6875 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 21, 1, 11, 49) common-timing-cpp 29.6896 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 21, 1, 11, 59) fem-multicore-cpp 10.1579 "Coloring mesh."
+(2012, 5, 21, 1, 15, 10) fem-assembly-cpp 191.493 "Assembly for various forms and backends"
+(2012, 5, 21, 1, 15, 22) fem-convergence-cpp 11.8256 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 21, 1, 15, 23) fem-jit-python 0.000413799 "JIT compilation (in memory cache)"
+(2012, 5, 21, 1, 20, 37) fem-speedup-cpp 313.637 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 21, 1, 20, 37) fem-speedup-cpp-assembly 5.26765 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 21, 1, 20, 37) fem-speedup-cpp-solve 2.00019 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 21, 1, 21, 1) mesh-refinement-cpp 22.7476 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 21, 1, 21, 23) mesh-topology-cpp 21.5406 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 21, 1, 21, 45) mesh-unitcube-cpp 22.0132 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 21, 1, 22, 28) mesh-iteration-cpp 40.3793 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 21, 1, 22, 49) function-evaluation-cpp 21.3211 "Evaluations of functions at arbitrary points."
+(2012, 5, 21, 1, 22, 49) function-evaluation-cpp 21.2394 "Evaluations of functions at arbitrary points."
+(2012, 5, 21, 1, 22, 56) function-extrapolation-python 6.86756 "BENCH:  1.92921495438"
+(2012, 5, 21, 1, 22, 56) function-extrapolation-python 1.92921 "BENCH:  1.92921495438"
+(2012, 5, 21, 1, 23, 19) la-vector-access-cpp 22.8928 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 21, 1, 23, 47) la-vector-assignment-cpp 28.4031 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 22, 1, 11, 8) common-progress-cpp 29.8733 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 22, 1, 11, 38) common-timing-cpp 29.5155 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 22, 1, 11, 48) fem-multicore-cpp 10.073 "Coloring mesh."
+(2012, 5, 22, 1, 14, 59) fem-assembly-cpp 191.628 "Assembly for various forms and backends"
+(2012, 5, 22, 1, 15, 11) fem-convergence-cpp 11.6046 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 22, 1, 15, 12) fem-jit-python 0.000409889 "JIT compilation (in memory cache)"
+(2012, 5, 22, 1, 20, 23) fem-speedup-cpp 311.306 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 22, 1, 20, 23) fem-speedup-cpp-assembly 5.25755 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 22, 1, 20, 23) fem-speedup-cpp-solve 2.03365 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 22, 1, 20, 48) mesh-refinement-cpp 22.7463 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 22, 1, 21, 9) mesh-topology-cpp 21.5485 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 22, 1, 21, 31) mesh-unitcube-cpp 21.921 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 22, 1, 22, 15) mesh-iteration-cpp 41.64 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 22, 1, 22, 38) function-evaluation-cpp 22.0231 "Evaluations of functions at arbitrary points."
+(2012, 5, 22, 1, 22, 38) function-evaluation-cpp 21.9416 "Evaluations of functions at arbitrary points."
+(2012, 5, 22, 1, 22, 45) function-extrapolation-python 6.91431 "BENCH:  1.91852498055"
+(2012, 5, 22, 1, 22, 45) function-extrapolation-python 1.91852 "BENCH:  1.91852498055"
+(2012, 5, 22, 1, 23, 10) la-vector-access-cpp 25.397 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 22, 1, 23, 35) la-vector-assignment-cpp 24.948 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 23, 1, 11, 24) common-progress-cpp 29.6142 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 23, 1, 11, 53) common-timing-cpp 29.3618 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 23, 1, 12, 3) fem-multicore-cpp 10.1015 "Coloring mesh."
+(2012, 5, 23, 1, 15, 15) fem-assembly-cpp 191.992 "Assembly for various forms and backends"
+(2012, 5, 23, 1, 15, 27) fem-convergence-cpp 11.895 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 23, 1, 15, 28) fem-jit-python 0.000430393 "JIT compilation (in memory cache)"
+(2012, 5, 23, 1, 20, 44) fem-speedup-cpp 316.339 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 23, 1, 20, 44) fem-speedup-cpp-assembly 5.27512 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 23, 1, 20, 44) fem-speedup-cpp-solve 1.8932 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 23, 1, 21, 9) mesh-refinement-cpp 22.7397 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 23, 1, 21, 30) mesh-topology-cpp 21.5146 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 23, 1, 21, 52) mesh-unitcube-cpp 22.0919 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 23, 1, 22, 35) mesh-iteration-cpp 40.3782 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 23, 1, 22, 56) function-evaluation-cpp 21.3599 "Evaluations of functions at arbitrary points."
+(2012, 5, 23, 1, 22, 56) function-evaluation-cpp 21.278 "Evaluations of functions at arbitrary points."
+(2012, 5, 23, 1, 23, 3) function-extrapolation-python 6.84355 "BENCH:  1.92967581749"
+(2012, 5, 23, 1, 23, 3) function-extrapolation-python 1.92968 "BENCH:  1.92967581749"
+(2012, 5, 23, 1, 23, 27) la-vector-access-cpp 23.89 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 23, 1, 23, 52) la-vector-assignment-cpp 24.9497 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 24, 1, 11, 33) common-progress-cpp 36.4364 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 24, 1, 12, 3) common-timing-cpp 29.917 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 24, 1, 12, 13) fem-multicore-cpp 10.0968 "Coloring mesh."
+(2012, 5, 24, 1, 15, 24) fem-assembly-cpp 191.1 "Assembly for various forms and backends"
+(2012, 5, 24, 1, 15, 36) fem-convergence-cpp 11.8609 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 24, 1, 15, 37) fem-jit-python 0.000411296 "JIT compilation (in memory cache)"
+(2012, 5, 24, 1, 20, 48) fem-speedup-cpp 310.716 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 24, 1, 20, 48) fem-speedup-cpp-assembly 5.25731 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 24, 1, 20, 48) fem-speedup-cpp-solve 2.03826 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 24, 1, 21, 12) mesh-refinement-cpp 22.8164 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 24, 1, 21, 34) mesh-topology-cpp 21.4963 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 24, 1, 21, 56) mesh-unitcube-cpp 21.9298 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 24, 1, 22, 39) mesh-iteration-cpp 40.3869 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 24, 1, 23, 0) function-evaluation-cpp 21.1227 "Evaluations of functions at arbitrary points."
+(2012, 5, 24, 1, 23, 0) function-evaluation-cpp 21.0415 "Evaluations of functions at arbitrary points."
+(2012, 5, 24, 1, 23, 7) function-extrapolation-python 6.83394 "BENCH:  1.90448999405"
+(2012, 5, 24, 1, 23, 7) function-extrapolation-python 1.90449 "BENCH:  1.90448999405"
+(2012, 5, 24, 1, 23, 30) la-vector-access-cpp 23.1083 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 24, 1, 23, 55) la-vector-assignment-cpp 24.949 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 25, 1, 11, 20) common-progress-cpp 29.8839 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 25, 1, 11, 49) common-timing-cpp 28.9127 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 25, 1, 11, 59) fem-multicore-cpp 10.1458 "Coloring mesh."
+(2012, 5, 25, 1, 15, 11) fem-assembly-cpp 191.513 "Assembly for various forms and backends"
+(2012, 5, 25, 1, 15, 23) fem-convergence-cpp 11.9113 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 25, 1, 15, 24) fem-jit-python 0.000434804 "JIT compilation (in memory cache)"
+(2012, 5, 25, 1, 20, 37) fem-speedup-cpp 312.898 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 25, 1, 20, 37) fem-speedup-cpp-assembly 5.34011 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 25, 1, 20, 37) fem-speedup-cpp-solve 2.00523 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 25, 1, 21, 1) mesh-refinement-cpp 22.6056 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 25, 1, 21, 23) mesh-topology-cpp 21.546 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 25, 1, 21, 45) mesh-unitcube-cpp 21.8756 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 25, 1, 22, 30) mesh-iteration-cpp 43.465 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 25, 1, 22, 52) function-evaluation-cpp 21.331 "Evaluations of functions at arbitrary points."
+(2012, 5, 25, 1, 22, 52) function-evaluation-cpp 21.2401 "Evaluations of functions at arbitrary points."
+(2012, 5, 25, 1, 22, 59) function-extrapolation-python 6.76543 "BENCH:  1.93370103836"
+(2012, 5, 25, 1, 22, 59) function-extrapolation-python 1.9337 "BENCH:  1.93370103836"
+(2012, 5, 25, 1, 23, 22) la-vector-access-cpp 23.4113 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 25, 1, 23, 51) la-vector-assignment-cpp 28.3577 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 26, 1, 11, 10) common-progress-cpp 29.7607 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 26, 1, 11, 40) common-timing-cpp 30.4693 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 26, 1, 11, 50) fem-multicore-cpp 10.0649 "Coloring mesh."
+(2012, 5, 26, 1, 15, 2) fem-assembly-cpp 192.302 "Assembly for various forms and backends"
+(2012, 5, 26, 1, 15, 14) fem-convergence-cpp 11.5876 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 26, 1, 15, 15) fem-jit-python 0.000417519 "JIT compilation (in memory cache)"
+(2012, 5, 26, 1, 20, 28) fem-speedup-cpp 312.653 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 26, 1, 20, 28) fem-speedup-cpp-assembly 5.34531 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 26, 1, 20, 28) fem-speedup-cpp-solve 2.02419 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 26, 1, 20, 52) mesh-refinement-cpp 22.7937 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 26, 1, 21, 14) mesh-topology-cpp 21.4674 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 26, 1, 21, 36) mesh-unitcube-cpp 21.8767 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 26, 1, 22, 19) mesh-iteration-cpp 40.3903 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 26, 1, 22, 40) function-evaluation-cpp 21.2679 "Evaluations of functions at arbitrary points."
+(2012, 5, 26, 1, 22, 40) function-evaluation-cpp 21.1869 "Evaluations of functions at arbitrary points."
+(2012, 5, 26, 1, 22, 47) function-extrapolation-python 6.68463 "BENCH:  1.87658405304"
+(2012, 5, 26, 1, 22, 47) function-extrapolation-python 1.87658 "BENCH:  1.87658405304"
+(2012, 5, 26, 1, 23, 9) la-vector-access-cpp 22.4248 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 26, 1, 23, 34) la-vector-assignment-cpp 24.9583 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 27, 1, 11, 6) common-progress-cpp 29.6723 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 27, 1, 11, 36) common-timing-cpp 30.183 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 27, 1, 11, 46) fem-multicore-cpp 10.001 "Coloring mesh."
+(2012, 5, 27, 1, 14, 58) fem-assembly-cpp 192.08 "Assembly for various forms and backends"
+(2012, 5, 27, 1, 15, 10) fem-convergence-cpp 11.8371 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 27, 1, 15, 11) fem-jit-python 0.00042069 "JIT compilation (in memory cache)"
+(2012, 5, 27, 1, 20, 23) fem-speedup-cpp 312.003 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 27, 1, 20, 23) fem-speedup-cpp-assembly 5.30995 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 27, 1, 20, 23) fem-speedup-cpp-solve 2.02653 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 27, 1, 20, 47) mesh-refinement-cpp 22.6896 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 27, 1, 21, 9) mesh-topology-cpp 21.5698 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 27, 1, 21, 31) mesh-unitcube-cpp 21.9092 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 27, 1, 22, 16) mesh-iteration-cpp 42.8681 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 27, 1, 22, 37) function-evaluation-cpp 21.3879 "Evaluations of functions at arbitrary points."
+(2012, 5, 27, 1, 22, 37) function-evaluation-cpp 21.3012 "Evaluations of functions at arbitrary points."
+(2012, 5, 27, 1, 22, 44) function-extrapolation-python 6.88474 "BENCH:  1.92811703682"
+(2012, 5, 27, 1, 22, 44) function-extrapolation-python 1.92812 "BENCH:  1.92811703682"
+(2012, 5, 27, 1, 23, 7) la-vector-access-cpp 22.468 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 27, 1, 23, 32) la-vector-assignment-cpp 24.9473 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 28, 1, 11, 13) common-progress-cpp 36.4364 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 28, 1, 11, 43) common-timing-cpp 30.0805 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 28, 1, 11, 53) fem-multicore-cpp 10.1594 "Coloring mesh."
+(2012, 5, 28, 1, 15, 5) fem-assembly-cpp 191.795 "Assembly for various forms and backends"
+(2012, 5, 28, 1, 15, 17) fem-convergence-cpp 11.8942 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 28, 1, 15, 18) fem-jit-python 0.00044589 "JIT compilation (in memory cache)"
+(2012, 5, 28, 1, 20, 29) fem-speedup-cpp 310.854 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 28, 1, 20, 29) fem-speedup-cpp-assembly 5.31187 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 28, 1, 20, 29) fem-speedup-cpp-solve 2.01725 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 28, 1, 20, 53) mesh-refinement-cpp 22.8342 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 28, 1, 21, 15) mesh-topology-cpp 21.5352 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 28, 1, 21, 37) mesh-unitcube-cpp 22.2483 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 28, 1, 22, 20) mesh-iteration-cpp 40.3942 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 28, 1, 22, 42) function-evaluation-cpp 21.3141 "Evaluations of functions at arbitrary points."
+(2012, 5, 28, 1, 22, 42) function-evaluation-cpp 21.233 "Evaluations of functions at arbitrary points."
+(2012, 5, 28, 1, 22, 48) function-extrapolation-python 6.79742 "BENCH:  1.92716479301"
+(2012, 5, 28, 1, 22, 48) function-extrapolation-python 1.92716 "BENCH:  1.92716479301"
+(2012, 5, 28, 1, 23, 13) la-vector-access-cpp 24.4848 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 28, 1, 23, 38) la-vector-assignment-cpp 24.9579 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 29, 1, 11, 22) common-progress-cpp 29.5721 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 29, 1, 11, 51) common-timing-cpp 29.353 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 29, 1, 12, 1) fem-multicore-cpp 10.024 "Coloring mesh."
+(2012, 5, 29, 1, 15, 15) fem-assembly-cpp 194.214 "Assembly for various forms and backends"
+(2012, 5, 29, 1, 15, 27) fem-convergence-cpp 11.8917 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 29, 1, 15, 28) fem-jit-python 0.000406408 "JIT compilation (in memory cache)"
+(2012, 5, 29, 1, 20, 41) fem-speedup-cpp 312.617 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 29, 1, 20, 41) fem-speedup-cpp-assembly 5.34119 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 29, 1, 20, 41) fem-speedup-cpp-solve 2.02083 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 29, 1, 21, 5) mesh-refinement-cpp 22.7366 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 29, 1, 21, 27) mesh-topology-cpp 21.5695 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 29, 1, 21, 48) mesh-unitcube-cpp 21.5538 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 29, 1, 22, 31) mesh-iteration-cpp 40.3848 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 29, 1, 22, 52) function-evaluation-cpp 21.2794 "Evaluations of functions at arbitrary points."
+(2012, 5, 29, 1, 22, 52) function-evaluation-cpp 21.1984 "Evaluations of functions at arbitrary points."
+(2012, 5, 29, 1, 22, 59) function-extrapolation-python 6.82393 "BENCH:  1.9122531414"
+(2012, 5, 29, 1, 22, 59) function-extrapolation-python 1.91225 "BENCH:  1.9122531414"
+(2012, 5, 29, 1, 23, 22) la-vector-access-cpp 22.9087 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 29, 1, 23, 47) la-vector-assignment-cpp 25.0548 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 30, 1, 11, 7) common-progress-cpp 29.5942 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 30, 1, 11, 36) common-timing-cpp 29.3557 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 30, 1, 11, 46) fem-multicore-cpp 10.0285 "Coloring mesh."
+(2012, 5, 30, 1, 15, 2) fem-assembly-cpp 195.489 "Assembly for various forms and backends"
+(2012, 5, 30, 1, 15, 13) fem-convergence-cpp 11.8672 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 30, 1, 15, 15) fem-jit-python 0.000409794 "JIT compilation (in memory cache)"
+(2012, 5, 30, 1, 20, 25) fem-speedup-cpp 310.344 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 30, 1, 20, 25) fem-speedup-cpp-assembly 5.31013 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 30, 1, 20, 25) fem-speedup-cpp-solve 2.02744 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 30, 1, 20, 49) mesh-refinement-cpp 22.7933 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 30, 1, 21, 11) mesh-topology-cpp 21.5537 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 30, 1, 21, 33) mesh-unitcube-cpp 21.4803 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 30, 1, 22, 25) mesh-iteration-cpp 50.3892 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 30, 1, 22, 47) function-evaluation-cpp 21.3679 "Evaluations of functions at arbitrary points."
+(2012, 5, 30, 1, 22, 47) function-evaluation-cpp 21.2867 "Evaluations of functions at arbitrary points."
+(2012, 5, 30, 1, 22, 54) function-extrapolation-python 6.75319 "BENCH:  1.91392302513"
+(2012, 5, 30, 1, 22, 54) function-extrapolation-python 1.91392 "BENCH:  1.91392302513"
+(2012, 5, 30, 1, 23, 16) la-vector-access-cpp 22.8961 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 30, 1, 23, 42) la-vector-assignment-cpp 24.9622 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 5, 31, 1, 11, 15) common-progress-cpp 30.2434 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 5, 31, 1, 11, 45) common-timing-cpp 29.95 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 5, 31, 1, 11, 56) fem-multicore-cpp 10.1539 "Coloring mesh."
+(2012, 5, 31, 1, 15, 11) fem-assembly-cpp 195.619 "Assembly for various forms and backends"
+(2012, 5, 31, 1, 15, 23) fem-convergence-cpp 11.9067 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 5, 31, 1, 15, 24) fem-jit-python 0.000415277 "JIT compilation (in memory cache)"
+(2012, 5, 31, 1, 20, 35) fem-speedup-cpp 310.523 "Assembly/solve speedup running on 4 processors"
+(2012, 5, 31, 1, 20, 35) fem-speedup-cpp-assembly 5.35221 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 5, 31, 1, 20, 35) fem-speedup-cpp-solve 2.00606 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 5, 31, 1, 20, 59) mesh-refinement-cpp 22.7502 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 5, 31, 1, 21, 21) mesh-topology-cpp 21.605 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 5, 31, 1, 21, 42) mesh-unitcube-cpp 21.5397 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 5, 31, 1, 22, 25) mesh-iteration-cpp 40.3962 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 5, 31, 1, 22, 47) function-evaluation-cpp 21.3396 "Evaluations of functions at arbitrary points."
+(2012, 5, 31, 1, 22, 47) function-evaluation-cpp 21.2581 "Evaluations of functions at arbitrary points."
+(2012, 5, 31, 1, 22, 53) function-extrapolation-python 6.68259 "BENCH:  1.91393995285"
+(2012, 5, 31, 1, 22, 53) function-extrapolation-python 1.91394 "BENCH:  1.91393995285"
+(2012, 5, 31, 1, 23, 17) la-vector-access-cpp 23.7996 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 5, 31, 1, 23, 42) la-vector-assignment-cpp 25.0495 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 1, 1, 11, 8) common-progress-cpp 29.892 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 1, 1, 11, 38) common-timing-cpp 29.2017 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 1, 1, 11, 48) fem-multicore-cpp 10.0623 "Coloring mesh."
+(2012, 6, 1, 1, 15, 1) fem-assembly-cpp 193.849 "Assembly for various forms and backends"
+(2012, 6, 1, 1, 15, 13) fem-convergence-cpp 11.8302 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 1, 1, 15, 14) fem-jit-python 0.000411201 "JIT compilation (in memory cache)"
+(2012, 6, 1, 1, 20, 26) fem-speedup-cpp 311.968 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 1, 1, 20, 26) fem-speedup-cpp-assembly 5.33225 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 1, 1, 20, 26) fem-speedup-cpp-solve 1.98457 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 1, 1, 20, 51) mesh-refinement-cpp 22.6667 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 1, 1, 21, 12) mesh-topology-cpp 21.5592 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 1, 1, 21, 34) mesh-unitcube-cpp 21.5331 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 1, 1, 22, 17) mesh-iteration-cpp 40.3761 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 1, 1, 22, 38) function-evaluation-cpp 21.3813 "Evaluations of functions at arbitrary points."
+(2012, 6, 1, 1, 22, 38) function-evaluation-cpp 21.2632 "Evaluations of functions at arbitrary points."
+(2012, 6, 1, 1, 22, 45) function-extrapolation-python 6.84335 "BENCH:  1.92669606209"
+(2012, 6, 1, 1, 22, 45) function-extrapolation-python 1.9267 "BENCH:  1.92669606209"
+(2012, 6, 1, 1, 23, 8) la-vector-access-cpp 22.8918 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 1, 1, 23, 33) la-vector-assignment-cpp 24.9478 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 2, 1, 11, 26) common-progress-cpp 29.5682 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 2, 1, 11, 55) common-timing-cpp 29.4358 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 2, 1, 12, 6) fem-multicore-cpp 10.1176 "Coloring mesh."
+(2012, 6, 2, 1, 15, 20) fem-assembly-cpp 194.888 "Assembly for various forms and backends"
+(2012, 6, 2, 1, 15, 32) fem-convergence-cpp 11.8629 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 2, 1, 15, 33) fem-jit-python 0.000422287 "JIT compilation (in memory cache)"
+(2012, 6, 2, 1, 20, 46) fem-speedup-cpp 312.141 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 2, 1, 20, 46) fem-speedup-cpp-assembly 5.42749 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 2, 1, 20, 46) fem-speedup-cpp-solve 2.03296 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 2, 1, 21, 10) mesh-refinement-cpp 22.6487 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 2, 1, 21, 32) mesh-topology-cpp 21.5539 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 2, 1, 21, 53) mesh-unitcube-cpp 21.5304 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 2, 1, 22, 36) mesh-iteration-cpp 40.3734 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 2, 1, 22, 57) function-evaluation-cpp 20.9285 "Evaluations of functions at arbitrary points."
+(2012, 6, 2, 1, 22, 57) function-evaluation-cpp 20.8105 "Evaluations of functions at arbitrary points."
+(2012, 6, 2, 1, 23, 4) function-extrapolation-python 6.91056 "BENCH:  1.89626288414"
+(2012, 6, 2, 1, 23, 4) function-extrapolation-python 1.89626 "BENCH:  1.89626288414"
+(2012, 6, 2, 1, 23, 27) la-vector-access-cpp 22.8956 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 2, 1, 23, 52) la-vector-assignment-cpp 24.9617 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 3, 1, 11, 6) common-progress-cpp 29.7073 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 3, 1, 11, 36) common-timing-cpp 29.6492 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 3, 1, 11, 46) fem-multicore-cpp 10.1124 "Coloring mesh."
+(2012, 6, 3, 1, 15, 0) fem-assembly-cpp 193.997 "Assembly for various forms and backends"
+(2012, 6, 3, 1, 15, 12) fem-convergence-cpp 11.5825 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 3, 1, 15, 13) fem-jit-python 0.000427794 "JIT compilation (in memory cache)"
+(2012, 6, 3, 1, 20, 30) fem-speedup-cpp 317.088 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 3, 1, 20, 30) fem-speedup-cpp-assembly 5.36035 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 3, 1, 20, 30) fem-speedup-cpp-solve 1.90454 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 3, 1, 20, 54) mesh-refinement-cpp 22.662 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 3, 1, 21, 16) mesh-topology-cpp 21.5826 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 3, 1, 21, 37) mesh-unitcube-cpp 21.5292 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 3, 1, 22, 20) mesh-iteration-cpp 40.3793 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 3, 1, 22, 41) function-evaluation-cpp 21.331 "Evaluations of functions at arbitrary points."
+(2012, 6, 3, 1, 22, 41) function-evaluation-cpp 21.2363 "Evaluations of functions at arbitrary points."
+(2012, 6, 3, 1, 22, 49) function-extrapolation-python 6.98481 "BENCH:  1.92869877815"
+(2012, 6, 3, 1, 22, 49) function-extrapolation-python 1.9287 "BENCH:  1.92869877815"
+(2012, 6, 3, 1, 23, 11) la-vector-access-cpp 22.8882 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 3, 1, 23, 43) la-vector-assignment-cpp 31.8781 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 4, 1, 11, 9) common-progress-cpp 29.607 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 4, 1, 11, 40) common-timing-cpp 30.8566 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 4, 1, 11, 50) fem-multicore-cpp 10.1028 "Coloring mesh."
+(2012, 6, 4, 1, 15, 3) fem-assembly-cpp 193.564 "Assembly for various forms and backends"
+(2012, 6, 4, 1, 15, 15) fem-convergence-cpp 11.8916 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 4, 1, 15, 16) fem-jit-python 0.000420904 "JIT compilation (in memory cache)"
+(2012, 6, 4, 1, 20, 28) fem-speedup-cpp 311.697 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 4, 1, 20, 28) fem-speedup-cpp-assembly 5.3027 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 4, 1, 20, 28) fem-speedup-cpp-solve 2.03463 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 4, 1, 20, 52) mesh-refinement-cpp 22.7172 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 4, 1, 21, 14) mesh-topology-cpp 21.6336 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 4, 1, 21, 35) mesh-unitcube-cpp 21.6053 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 4, 1, 22, 18) mesh-iteration-cpp 40.3822 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 4, 1, 22, 39) function-evaluation-cpp 21.3066 "Evaluations of functions at arbitrary points."
+(2012, 6, 4, 1, 22, 39) function-evaluation-cpp 21.213 "Evaluations of functions at arbitrary points."
+(2012, 6, 4, 1, 22, 46) function-extrapolation-python 6.67891 "BENCH:  1.90621995926"
+(2012, 6, 4, 1, 22, 46) function-extrapolation-python 1.90622 "BENCH:  1.90621995926"
+(2012, 6, 4, 1, 23, 9) la-vector-access-cpp 22.9162 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 4, 1, 23, 34) la-vector-assignment-cpp 24.9555 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 5, 1, 11, 3) common-progress-cpp 29.6767 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 5, 1, 11, 32) common-timing-cpp 29.4671 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 5, 1, 11, 42) fem-multicore-cpp 10.015 "Coloring mesh."
+(2012, 6, 5, 1, 14, 56) fem-assembly-cpp 194.016 "Assembly for various forms and backends"
+(2012, 6, 5, 1, 15, 8) fem-convergence-cpp 11.8499 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 5, 1, 15, 9) fem-jit-python 0.000432396 "JIT compilation (in memory cache)"
+(2012, 6, 5, 1, 20, 20) fem-speedup-cpp 310.625 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 5, 1, 20, 20) fem-speedup-cpp-assembly 5.39826 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 5, 1, 20, 20) fem-speedup-cpp-solve 2.0291 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 5, 1, 20, 44) mesh-refinement-cpp 22.6605 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 5, 1, 21, 6) mesh-topology-cpp 21.5928 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 5, 1, 21, 27) mesh-unitcube-cpp 21.5892 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 5, 1, 22, 10) mesh-iteration-cpp 40.3749 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 5, 1, 22, 31) function-evaluation-cpp 21.2994 "Evaluations of functions at arbitrary points."
+(2012, 6, 5, 1, 22, 31) function-evaluation-cpp 21.1948 "Evaluations of functions at arbitrary points."
+(2012, 6, 5, 1, 22, 38) function-extrapolation-python 6.72049 "BENCH:  1.9154291153"
+(2012, 6, 5, 1, 22, 38) function-extrapolation-python 1.91543 "BENCH:  1.9154291153"
+(2012, 6, 5, 1, 23, 1) la-vector-access-cpp 22.8892 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 5, 1, 23, 26) la-vector-assignment-cpp 24.9787 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 6, 1, 11, 11) common-progress-cpp 36.4362 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 6, 1, 11, 40) common-timing-cpp 29.0998 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 6, 1, 11, 50) fem-multicore-cpp 10.0637 "Coloring mesh."
+(2012, 6, 6, 1, 15, 4) fem-assembly-cpp 194.366 "Assembly for various forms and backends"
+(2012, 6, 6, 1, 15, 16) fem-convergence-cpp 11.8895 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 6, 1, 15, 17) fem-jit-python 0.000433302 "JIT compilation (in memory cache)"
+(2012, 6, 6, 1, 20, 31) fem-speedup-cpp 313.468 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 6, 1, 20, 31) fem-speedup-cpp-assembly 5.27284 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 6, 1, 20, 31) fem-speedup-cpp-solve 1.99439 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 6, 1, 20, 55) mesh-refinement-cpp 22.7055 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 6, 1, 21, 17) mesh-topology-cpp 21.6391 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 6, 1, 21, 38) mesh-unitcube-cpp 21.5574 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 6, 1, 22, 21) mesh-iteration-cpp 40.3823 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 6, 1, 22, 42) function-evaluation-cpp 21.3322 "Evaluations of functions at arbitrary points."
+(2012, 6, 6, 1, 22, 42) function-evaluation-cpp 21.2309 "Evaluations of functions at arbitrary points."
+(2012, 6, 6, 1, 22, 49) function-extrapolation-python 6.88828 "BENCH:  1.94164609909"
+(2012, 6, 6, 1, 22, 49) function-extrapolation-python 1.94165 "BENCH:  1.94164609909"
+(2012, 6, 6, 1, 23, 14) la-vector-access-cpp 24.7008 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 6, 1, 23, 42) la-vector-assignment-cpp 27.9355 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 7, 1, 11, 39) common-progress-cpp 29.907 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 7, 1, 12, 9) common-timing-cpp 29.8448 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 7, 1, 12, 19) fem-multicore-cpp 10.1124 "Coloring mesh."
+(2012, 6, 7, 1, 15, 32) fem-assembly-cpp 192.956 "Assembly for various forms and backends"
+(2012, 6, 7, 1, 15, 44) fem-convergence-cpp 11.8814 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 7, 1, 15, 45) fem-jit-python 0.000419784 "JIT compilation (in memory cache)"
+(2012, 6, 7, 1, 20, 54) fem-speedup-cpp 309.291 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 7, 1, 20, 54) fem-speedup-cpp-assembly 5.55141 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 7, 1, 20, 54) fem-speedup-cpp-solve 2.02218 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 7, 1, 21, 18) mesh-refinement-cpp 22.4169 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 7, 1, 21, 40) mesh-topology-cpp 21.1113 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 7, 1, 22, 1) mesh-unitcube-cpp 21.4645 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 7, 1, 22, 44) mesh-iteration-cpp 40.3754 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 7, 1, 23, 5) function-evaluation-cpp 21.3316 "Evaluations of functions at arbitrary points."
+(2012, 6, 7, 1, 23, 5) function-evaluation-cpp 21.2343 "Evaluations of functions at arbitrary points."
+(2012, 6, 7, 1, 23, 12) function-extrapolation-python 6.72874 "BENCH:  1.91428589821"
+(2012, 6, 7, 1, 23, 12) function-extrapolation-python 1.91429 "BENCH:  1.91428589821"
+(2012, 6, 7, 1, 23, 34) la-vector-access-cpp 22.4149 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 7, 1, 24, 0) la-vector-assignment-cpp 25.0207 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 8, 1, 11, 6) common-progress-cpp 29.8863 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 8, 1, 11, 36) common-timing-cpp 29.9752 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 8, 1, 11, 46) fem-multicore-cpp 10.1752 "Coloring mesh."
+(2012, 6, 8, 1, 14, 59) fem-assembly-cpp 192.827 "Assembly for various forms and backends"
+(2012, 6, 8, 1, 15, 11) fem-convergence-cpp 11.8781 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 8, 1, 15, 12) fem-jit-python 0.000407004 "JIT compilation (in memory cache)"
+(2012, 6, 8, 1, 20, 25) fem-speedup-cpp 312.744 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 8, 1, 20, 25) fem-speedup-cpp-assembly 5.51927 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 8, 1, 20, 25) fem-speedup-cpp-solve 1.98713 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 8, 1, 20, 49) mesh-refinement-cpp 22.4902 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 8, 1, 21, 10) mesh-topology-cpp 21.227 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 8, 1, 21, 32) mesh-unitcube-cpp 21.5297 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 8, 1, 22, 14) mesh-iteration-cpp 40.3794 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 8, 1, 22, 36) function-evaluation-cpp 21.3448 "Evaluations of functions at arbitrary points."
+(2012, 6, 8, 1, 22, 36) function-evaluation-cpp 21.2269 "Evaluations of functions at arbitrary points."
+(2012, 6, 8, 1, 22, 42) function-extrapolation-python 6.74054 "BENCH:  1.90929389"
+(2012, 6, 8, 1, 22, 42) function-extrapolation-python 1.90929 "BENCH:  1.90929389"
+(2012, 6, 8, 1, 23, 5) la-vector-access-cpp 22.414 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 8, 1, 23, 30) la-vector-assignment-cpp 25.1507 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 9, 1, 11, 11) common-progress-cpp 29.6083 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 9, 1, 11, 41) common-timing-cpp 29.9019 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 9, 1, 11, 51) fem-multicore-cpp 10.292 "Coloring mesh."
+(2012, 6, 9, 1, 15, 4) fem-assembly-cpp 192.929 "Assembly for various forms and backends"
+(2012, 6, 9, 1, 15, 16) fem-convergence-cpp 11.8579 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 9, 1, 15, 17) fem-jit-python 0.000409293 "JIT compilation (in memory cache)"
+(2012, 6, 9, 1, 20, 27) fem-speedup-cpp 310.53 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 9, 1, 20, 27) fem-speedup-cpp-assembly 5.50762 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 9, 1, 20, 27) fem-speedup-cpp-solve 2.02045 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 9, 1, 20, 51) mesh-refinement-cpp 22.3945 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 9, 1, 21, 13) mesh-topology-cpp 21.4554 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 9, 1, 21, 35) mesh-unitcube-cpp 21.5144 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 9, 1, 22, 17) mesh-iteration-cpp 40.3748 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 9, 1, 22, 39) function-evaluation-cpp 21.2983 "Evaluations of functions at arbitrary points."
+(2012, 6, 9, 1, 22, 39) function-evaluation-cpp 21.1995 "Evaluations of functions at arbitrary points."
+(2012, 6, 9, 1, 22, 46) function-extrapolation-python 6.91573 "BENCH:  1.91140294075"
+(2012, 6, 9, 1, 22, 46) function-extrapolation-python 1.9114 "BENCH:  1.91140294075"
+(2012, 6, 9, 1, 23, 8) la-vector-access-cpp 22.4171 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 9, 1, 23, 33) la-vector-assignment-cpp 24.9578 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 10, 1, 11, 8) common-progress-cpp 29.6028 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 10, 1, 11, 37) common-timing-cpp 29.241 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 10, 1, 11, 47) fem-multicore-cpp 10.2085 "Coloring mesh."
+(2012, 6, 10, 1, 15, 1) fem-assembly-cpp 193.99 "Assembly for various forms and backends"
+(2012, 6, 10, 1, 15, 13) fem-convergence-cpp 11.9072 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 10, 1, 15, 14) fem-jit-python 0.000418711 "JIT compilation (in memory cache)"
+(2012, 6, 10, 1, 20, 30) fem-speedup-cpp 315.755 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 10, 1, 20, 30) fem-speedup-cpp-assembly 5.5264 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 10, 1, 20, 30) fem-speedup-cpp-solve 1.92734 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 10, 1, 20, 54) mesh-refinement-cpp 22.402 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 10, 1, 21, 15) mesh-topology-cpp 21.1577 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 10, 1, 21, 37) mesh-unitcube-cpp 21.4241 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 10, 1, 22, 19) mesh-iteration-cpp 40.3732 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 10, 1, 22, 41) function-evaluation-cpp 21.5731 "Evaluations of functions at arbitrary points."
+(2012, 6, 10, 1, 22, 41) function-evaluation-cpp 21.4726 "Evaluations of functions at arbitrary points."
+(2012, 6, 10, 1, 22, 48) function-extrapolation-python 6.99914 "BENCH:  1.92446279526"
+(2012, 6, 10, 1, 22, 48) function-extrapolation-python 1.92446 "BENCH:  1.92446279526"
+(2012, 6, 10, 1, 23, 12) la-vector-access-cpp 23.4081 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 10, 1, 23, 40) la-vector-assignment-cpp 27.8949 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 11, 1, 11, 16) common-progress-cpp 30.1849 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 11, 1, 11, 46) common-timing-cpp 29.6861 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 11, 1, 11, 56) fem-multicore-cpp 10.1629 "Coloring mesh."
+(2012, 6, 11, 1, 15, 9) fem-assembly-cpp 192.913 "Assembly for various forms and backends"
+(2012, 6, 11, 1, 15, 21) fem-convergence-cpp 11.8951 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 11, 1, 15, 22) fem-jit-python 0.000427198 "JIT compilation (in memory cache)"
+(2012, 6, 11, 1, 20, 34) fem-speedup-cpp 311.439 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 11, 1, 20, 34) fem-speedup-cpp-assembly 5.52724 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 11, 1, 20, 34) fem-speedup-cpp-solve 2.0019 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 11, 1, 20, 58) mesh-refinement-cpp 22.4489 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 11, 1, 21, 19) mesh-topology-cpp 21.1194 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 11, 1, 21, 40) mesh-unitcube-cpp 21.4372 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 11, 1, 22, 23) mesh-iteration-cpp 40.3721 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 11, 1, 22, 45) function-evaluation-cpp 21.3233 "Evaluations of functions at arbitrary points."
+(2012, 6, 11, 1, 22, 45) function-evaluation-cpp 21.2205 "Evaluations of functions at arbitrary points."
+(2012, 6, 11, 1, 22, 51) function-extrapolation-python 6.7301 "BENCH:  1.91325688362"
+(2012, 6, 11, 1, 22, 51) function-extrapolation-python 1.91326 "BENCH:  1.91325688362"
+(2012, 6, 11, 1, 23, 15) la-vector-access-cpp 23.7871 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 11, 1, 23, 40) la-vector-assignment-cpp 24.9551 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 12, 1, 11, 12) common-progress-cpp 29.6005 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 12, 1, 11, 41) common-timing-cpp 29.3649 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 12, 1, 11, 52) fem-multicore-cpp 10.2365 "Coloring mesh."
+(2012, 6, 12, 1, 15, 4) fem-assembly-cpp 192.809 "Assembly for various forms and backends"
+(2012, 6, 12, 1, 15, 16) fem-convergence-cpp 11.902 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 12, 1, 15, 17) fem-jit-python 0.000407386 "JIT compilation (in memory cache)"
+(2012, 6, 12, 1, 20, 30) fem-speedup-cpp 312.619 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 12, 1, 20, 30) fem-speedup-cpp-assembly 5.52872 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 12, 1, 20, 30) fem-speedup-cpp-solve 2.00459 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 12, 1, 20, 54) mesh-refinement-cpp 22.4309 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 12, 1, 21, 15) mesh-topology-cpp 21.147 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 12, 1, 21, 37) mesh-unitcube-cpp 21.552 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 12, 1, 22, 20) mesh-iteration-cpp 40.3784 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 12, 1, 22, 41) function-evaluation-cpp 21.3816 "Evaluations of functions at arbitrary points."
+(2012, 6, 12, 1, 22, 41) function-evaluation-cpp 21.2866 "Evaluations of functions at arbitrary points."
+(2012, 6, 12, 1, 22, 48) function-extrapolation-python 6.75649 "BENCH:  1.92233991623"
+(2012, 6, 12, 1, 22, 48) function-extrapolation-python 1.92234 "BENCH:  1.92233991623"
+(2012, 6, 12, 1, 23, 10) la-vector-access-cpp 22.4226 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 12, 1, 23, 35) la-vector-assignment-cpp 24.9146 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 13, 1, 11, 4) common-progress-cpp 29.8758 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 13, 1, 11, 33) common-timing-cpp 28.8893 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 13, 1, 11, 43) fem-multicore-cpp 10.1614 "Coloring mesh."
+(2012, 6, 13, 1, 14, 56) fem-assembly-cpp 193.134 "Assembly for various forms and backends"
+(2012, 6, 13, 1, 15, 8) fem-convergence-cpp 11.8836 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 13, 1, 15, 9) fem-jit-python 0.000417399 "JIT compilation (in memory cache)"
+(2012, 6, 13, 1, 20, 19) fem-speedup-cpp 309.8 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 13, 1, 20, 19) fem-speedup-cpp-assembly 5.54182 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 13, 1, 20, 19) fem-speedup-cpp-solve 2.05001 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 13, 1, 20, 43) mesh-refinement-cpp 22.4349 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 13, 1, 21, 4) mesh-topology-cpp 21.1341 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 13, 1, 21, 26) mesh-unitcube-cpp 21.4753 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 13, 1, 22, 9) mesh-iteration-cpp 40.3903 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 13, 1, 22, 30) function-evaluation-cpp 21.3232 "Evaluations of functions at arbitrary points."
+(2012, 6, 13, 1, 22, 30) function-evaluation-cpp 21.2204 "Evaluations of functions at arbitrary points."
+(2012, 6, 13, 1, 22, 37) function-extrapolation-python 6.83525 "BENCH:  1.92004990578"
+(2012, 6, 13, 1, 22, 37) function-extrapolation-python 1.92005 "BENCH:  1.92004990578"
+(2012, 6, 13, 1, 23, 1) la-vector-access-cpp 24.3973 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 13, 1, 23, 27) la-vector-assignment-cpp 24.9728 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 14, 1, 11, 29) common-progress-cpp 30.4164 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 14, 1, 11, 59) common-timing-cpp 29.5554 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 14, 1, 12, 9) fem-multicore-cpp 10.1626 "Coloring mesh."
+(2012, 6, 14, 1, 15, 22) fem-assembly-cpp 193.395 "Assembly for various forms and backends"
+(2012, 6, 14, 1, 15, 34) fem-convergence-cpp 11.9002 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 14, 1, 15, 36) fem-jit-python 0.00041461 "JIT compilation (in memory cache)"
+(2012, 6, 14, 1, 20, 47) fem-speedup-cpp 310.316 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 14, 1, 20, 47) fem-speedup-cpp-assembly 5.52806 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 14, 1, 20, 47) fem-speedup-cpp-solve 2.05104 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 14, 1, 21, 10) mesh-refinement-cpp 22.4071 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 14, 1, 21, 31) mesh-topology-cpp 21.2934 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 14, 1, 21, 53) mesh-unitcube-cpp 21.6732 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 14, 1, 22, 36) mesh-iteration-cpp 40.3907 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 14, 1, 22, 57) function-evaluation-cpp 21.1068 "Evaluations of functions at arbitrary points."
+(2012, 6, 14, 1, 22, 57) function-evaluation-cpp 20.9887 "Evaluations of functions at arbitrary points."
+(2012, 6, 14, 1, 23, 26) function-extrapolation-python 29.0757 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2012, 6, 14, 1, 23, 26) function-extrapolation-python 1.91098 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2012, 6, 14, 1, 23, 50) la-vector-access-cpp 23.8802 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 14, 1, 24, 15) la-vector-assignment-cpp 24.962 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 15, 1, 11, 19) common-progress-cpp 29.5797 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 15, 1, 11, 49) common-timing-cpp 30.5908 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 15, 1, 12, 0) fem-multicore-cpp 10.1569 "Coloring mesh."
+(2012, 6, 15, 1, 15, 16) fem-assembly-cpp 196.654 "Assembly for various forms and backends"
+(2012, 6, 15, 1, 15, 28) fem-convergence-cpp 11.9271 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 15, 1, 15, 29) fem-jit-python 0.000416589 "JIT compilation (in memory cache)"
+(2012, 6, 15, 1, 20, 40) fem-speedup-cpp 310.93 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 15, 1, 20, 40) fem-speedup-cpp-assembly 5.49874 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 15, 1, 20, 40) fem-speedup-cpp-solve 2.00135 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 15, 1, 21, 4) mesh-refinement-cpp 22.0645 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 15, 1, 21, 25) mesh-topology-cpp 20.6735 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 15, 1, 21, 46) mesh-unitcube-cpp 21.0208 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 15, 1, 22, 29) mesh-iteration-cpp 40.3737 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 15, 1, 22, 50) function-evaluation-cpp 21.34 "Evaluations of functions at arbitrary points."
+(2012, 6, 15, 1, 22, 50) function-evaluation-cpp 21.2363 "Evaluations of functions at arbitrary points."
+(2012, 6, 15, 1, 22, 57) function-extrapolation-python 6.81551 "BENCH:  1.96959495544"
+(2012, 6, 15, 1, 22, 57) function-extrapolation-python 1.96959 "BENCH:  1.96959495544"
+(2012, 6, 15, 1, 23, 22) la-vector-access-cpp 25.389 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 15, 1, 23, 47) la-vector-assignment-cpp 24.9487 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 16, 1, 11, 8) common-progress-cpp 29.5048 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 16, 1, 11, 39) common-timing-cpp 30.7238 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 16, 1, 11, 49) fem-multicore-cpp 10.0559 "Coloring mesh."
+(2012, 6, 16, 1, 15, 6) fem-assembly-cpp 197.068 "Assembly for various forms and backends"
+(2012, 6, 16, 1, 15, 18) fem-convergence-cpp 11.9068 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 16, 1, 15, 19) fem-jit-python 0.000429916 "JIT compilation (in memory cache)"
+(2012, 6, 16, 1, 20, 29) fem-speedup-cpp 309.285 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 16, 1, 20, 29) fem-speedup-cpp-assembly 5.59151 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 16, 1, 20, 29) fem-speedup-cpp-solve 2.0454 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 16, 1, 20, 52) mesh-refinement-cpp 22.1236 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 16, 1, 21, 13) mesh-topology-cpp 20.6117 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 16, 1, 21, 34) mesh-unitcube-cpp 21.0168 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 16, 1, 22, 19) mesh-iteration-cpp 42.8725 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 16, 1, 22, 40) function-evaluation-cpp 20.807 "Evaluations of functions at arbitrary points."
+(2012, 6, 16, 1, 22, 40) function-evaluation-cpp 20.7038 "Evaluations of functions at arbitrary points."
+(2012, 6, 16, 1, 22, 47) function-extrapolation-python 6.6858 "BENCH:  1.96168613434"
+(2012, 6, 16, 1, 22, 47) function-extrapolation-python 1.96169 "BENCH:  1.96168613434"
+(2012, 6, 16, 1, 23, 12) la-vector-access-cpp 25.3891 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 16, 1, 23, 40) la-vector-assignment-cpp 27.8951 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 17, 1, 11, 9) common-progress-cpp 29.6113 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 17, 1, 11, 40) common-timing-cpp 30.2551 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 17, 1, 11, 50) fem-multicore-cpp 10.1262 "Coloring mesh."
+(2012, 6, 17, 1, 15, 7) fem-assembly-cpp 197.233 "Assembly for various forms and backends"
+(2012, 6, 17, 1, 15, 19) fem-convergence-cpp 11.8976 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 17, 1, 15, 20) fem-jit-python 0.000421381 "JIT compilation (in memory cache)"
+(2012, 6, 17, 1, 20, 30) fem-speedup-cpp 309.934 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 17, 1, 20, 30) fem-speedup-cpp-assembly 5.59283 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 17, 1, 20, 30) fem-speedup-cpp-solve 2.03595 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 17, 1, 20, 54) mesh-refinement-cpp 22.1048 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 17, 1, 21, 15) mesh-topology-cpp 20.6635 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 17, 1, 21, 36) mesh-unitcube-cpp 20.9857 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 17, 1, 22, 18) mesh-iteration-cpp 40.3724 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 17, 1, 22, 39) function-evaluation-cpp 20.9905 "Evaluations of functions at arbitrary points."
+(2012, 6, 17, 1, 22, 39) function-evaluation-cpp 20.9089 "Evaluations of functions at arbitrary points."
+(2012, 6, 17, 1, 22, 46) function-extrapolation-python 6.7089 "BENCH:  1.91786503792"
+(2012, 6, 17, 1, 22, 46) function-extrapolation-python 1.91787 "BENCH:  1.91786503792"
+(2012, 6, 17, 1, 23, 12) la-vector-access-cpp 25.3986 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 17, 1, 23, 40) la-vector-assignment-cpp 27.8999 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 18, 1, 11, 4) common-progress-cpp 29.6312 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 18, 1, 11, 34) common-timing-cpp 30.4561 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 18, 1, 11, 44) fem-multicore-cpp 10.1147 "Coloring mesh."
+(2012, 6, 18, 1, 15, 0) fem-assembly-cpp 196.29 "Assembly for various forms and backends"
+(2012, 6, 18, 1, 15, 12) fem-convergence-cpp 11.9254 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 18, 1, 15, 13) fem-jit-python 0.000420594 "JIT compilation (in memory cache)"
+(2012, 6, 18, 1, 20, 26) fem-speedup-cpp 312.323 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 18, 1, 20, 26) fem-speedup-cpp-assembly 5.57966 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 18, 1, 20, 26) fem-speedup-cpp-solve 2.00593 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 18, 1, 20, 49) mesh-refinement-cpp 22.0531 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 18, 1, 21, 10) mesh-topology-cpp 20.5799 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 18, 1, 21, 31) mesh-unitcube-cpp 20.9718 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 18, 1, 22, 14) mesh-iteration-cpp 40.3808 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 18, 1, 22, 35) function-evaluation-cpp 21.2974 "Evaluations of functions at arbitrary points."
+(2012, 6, 18, 1, 22, 35) function-evaluation-cpp 21.2158 "Evaluations of functions at arbitrary points."
+(2012, 6, 18, 1, 22, 42) function-extrapolation-python 6.77056 "BENCH:  1.96496796608"
+(2012, 6, 18, 1, 22, 42) function-extrapolation-python 1.96497 "BENCH:  1.96496796608"
+(2012, 6, 18, 1, 23, 8) la-vector-access-cpp 25.3872 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 18, 1, 23, 33) la-vector-assignment-cpp 24.9484 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 19, 1, 11, 21) common-progress-cpp 29.5791 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 19, 1, 11, 51) common-timing-cpp 30.5005 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 19, 1, 12, 1) fem-multicore-cpp 10.062 "Coloring mesh."
+(2012, 6, 19, 1, 15, 18) fem-assembly-cpp 196.873 "Assembly for various forms and backends"
+(2012, 6, 19, 1, 15, 30) fem-convergence-cpp 11.905 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 19, 1, 15, 31) fem-jit-python 0.000429606 "JIT compilation (in memory cache)"
+(2012, 6, 19, 1, 20, 42) fem-speedup-cpp 310.724 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 19, 1, 20, 42) fem-speedup-cpp-assembly 5.56819 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 19, 1, 20, 42) fem-speedup-cpp-solve 2.00762 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 19, 1, 21, 6) mesh-refinement-cpp 22.0974 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 19, 1, 21, 27) mesh-topology-cpp 20.63 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 19, 1, 21, 48) mesh-unitcube-cpp 20.9931 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 19, 1, 22, 36) mesh-iteration-cpp 46.0181 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 19, 1, 22, 57) function-evaluation-cpp 21.3652 "Evaluations of functions at arbitrary points."
+(2012, 6, 19, 1, 22, 57) function-evaluation-cpp 21.2063 "Evaluations of functions at arbitrary points."
+(2012, 6, 19, 1, 23, 4) function-extrapolation-python 6.85452 "BENCH:  1.94724607468"
+(2012, 6, 19, 1, 23, 4) function-extrapolation-python 1.94725 "BENCH:  1.94724607468"
+(2012, 6, 19, 1, 23, 30) la-vector-access-cpp 25.3918 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 19, 1, 23, 55) la-vector-assignment-cpp 24.9583 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 20, 1, 11, 32) common-progress-cpp 29.6165 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 20, 1, 12, 2) common-timing-cpp 29.7392 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 20, 1, 12, 12) fem-multicore-cpp 10.2458 "Coloring mesh."
+(2012, 6, 20, 1, 15, 31) fem-assembly-cpp 198.543 "Assembly for various forms and backends"
+(2012, 6, 20, 1, 15, 42) fem-convergence-cpp 11.7064 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 20, 1, 15, 44) fem-jit-python 0.000405312 "JIT compilation (in memory cache)"
+(2012, 6, 20, 1, 20, 55) fem-speedup-cpp 311.85 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 20, 1, 20, 55) fem-speedup-cpp-assembly 5.48203 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 20, 1, 20, 55) fem-speedup-cpp-solve 2.02044 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 20, 1, 21, 19) mesh-refinement-cpp 22.0618 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 20, 1, 21, 40) mesh-topology-cpp 20.5839 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 20, 1, 22, 1) mesh-unitcube-cpp 21.1712 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 20, 1, 22, 45) mesh-iteration-cpp 41.6332 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 20, 1, 23, 6) function-evaluation-cpp 21.3149 "Evaluations of functions at arbitrary points."
+(2012, 6, 20, 1, 23, 6) function-evaluation-cpp 21.2203 "Evaluations of functions at arbitrary points."
+(2012, 6, 20, 1, 23, 13) function-extrapolation-python 6.63328 "BENCH:  1.91113209724"
+(2012, 6, 20, 1, 23, 13) function-extrapolation-python 1.91113 "BENCH:  1.91113209724"
+(2012, 6, 20, 1, 23, 38) la-vector-access-cpp 25.3921 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 20, 1, 24, 4) la-vector-assignment-cpp 24.9485 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 21, 1, 11, 9) common-progress-cpp 29.5482 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 21, 1, 11, 39) common-timing-cpp 30.4116 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 21, 1, 11, 49) fem-multicore-cpp 10.2049 "Coloring mesh."
+(2012, 6, 21, 1, 15, 8) fem-assembly-cpp 198.816 "Assembly for various forms and backends"
+(2012, 6, 21, 1, 15, 20) fem-convergence-cpp 11.9213 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 21, 1, 15, 21) fem-jit-python 0.000418019 "JIT compilation (in memory cache)"
+(2012, 6, 21, 1, 20, 34) fem-speedup-cpp 312.465 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 21, 1, 20, 34) fem-speedup-cpp-assembly 5.50722 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 21, 1, 20, 34) fem-speedup-cpp-solve 2.02664 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 21, 1, 20, 57) mesh-refinement-cpp 22.11 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 21, 1, 21, 18) mesh-topology-cpp 20.644 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 21, 1, 21, 39) mesh-unitcube-cpp 21.0374 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 21, 1, 22, 22) mesh-iteration-cpp 40.3875 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 21, 1, 22, 43) function-evaluation-cpp 21.0824 "Evaluations of functions at arbitrary points."
+(2012, 6, 21, 1, 22, 43) function-evaluation-cpp 20.9891 "Evaluations of functions at arbitrary points."
+(2012, 6, 21, 1, 22, 50) function-extrapolation-python 6.75934 "BENCH:  1.9227771759"
+(2012, 6, 21, 1, 22, 50) function-extrapolation-python 1.92278 "BENCH:  1.9227771759"
+(2012, 6, 21, 1, 23, 15) la-vector-access-cpp 25.3927 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 21, 1, 23, 40) la-vector-assignment-cpp 24.9591 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 22, 1, 11, 10) common-progress-cpp 29.5883 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 22, 1, 11, 41) common-timing-cpp 30.5781 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 22, 1, 11, 51) fem-multicore-cpp 10.1749 "Coloring mesh."
+(2012, 6, 22, 1, 15, 10) fem-assembly-cpp 199.092 "Assembly for various forms and backends"
+(2012, 6, 22, 1, 15, 22) fem-convergence-cpp 11.9102 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 22, 1, 15, 23) fem-jit-python 0.000406694 "JIT compilation (in memory cache)"
+(2012, 6, 22, 1, 20, 36) fem-speedup-cpp 312.915 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 22, 1, 20, 36) fem-speedup-cpp-assembly 5.51407 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 22, 1, 20, 36) fem-speedup-cpp-solve 2.01124 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 22, 1, 21, 0) mesh-refinement-cpp 22.0415 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 22, 1, 21, 21) mesh-topology-cpp 20.579 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 22, 1, 21, 42) mesh-unitcube-cpp 21.3379 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 22, 1, 22, 25) mesh-iteration-cpp 40.3935 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 22, 1, 22, 46) function-evaluation-cpp 21.3151 "Evaluations of functions at arbitrary points."
+(2012, 6, 22, 1, 22, 46) function-evaluation-cpp 21.2194 "Evaluations of functions at arbitrary points."
+(2012, 6, 22, 1, 22, 53) function-extrapolation-python 6.88405 "BENCH:  1.93112683296"
+(2012, 6, 22, 1, 22, 53) function-extrapolation-python 1.93113 "BENCH:  1.93112683296"
+(2012, 6, 22, 1, 23, 18) la-vector-access-cpp 25.3934 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 22, 1, 23, 43) la-vector-assignment-cpp 24.9475 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 23, 1, 11, 28) common-progress-cpp 29.6063 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 23, 1, 11, 58) common-timing-cpp 30.446 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 23, 1, 12, 8) fem-multicore-cpp 10.1256 "Coloring mesh."
+(2012, 6, 23, 1, 15, 27) fem-assembly-cpp 198.646 "Assembly for various forms and backends"
+(2012, 6, 23, 1, 15, 39) fem-convergence-cpp 11.9411 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 23, 1, 15, 40) fem-jit-python 0.000417185 "JIT compilation (in memory cache)"
+(2012, 6, 23, 1, 20, 52) fem-speedup-cpp 311.882 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 23, 1, 20, 52) fem-speedup-cpp-assembly 5.4743 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 23, 1, 20, 52) fem-speedup-cpp-solve 2.01504 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 23, 1, 21, 16) mesh-refinement-cpp 22.124 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 23, 1, 21, 37) mesh-topology-cpp 20.568 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 23, 1, 21, 58) mesh-unitcube-cpp 21.01 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 23, 1, 22, 42) mesh-iteration-cpp 41.6568 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 23, 1, 23, 3) function-evaluation-cpp 21.5815 "Evaluations of functions at arbitrary points."
+(2012, 6, 23, 1, 23, 3) function-evaluation-cpp 21.4783 "Evaluations of functions at arbitrary points."
+(2012, 6, 23, 1, 23, 10) function-extrapolation-python 6.82318 "BENCH:  1.92148900032"
+(2012, 6, 23, 1, 23, 10) function-extrapolation-python 1.92149 "BENCH:  1.92148900032"
+(2012, 6, 23, 1, 23, 36) la-vector-access-cpp 25.3911 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 23, 1, 24, 4) la-vector-assignment-cpp 27.8442 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 24, 1, 11, 12) common-progress-cpp 29.573 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 24, 1, 11, 42) common-timing-cpp 30.3033 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 24, 1, 11, 52) fem-multicore-cpp 10.1529 "Coloring mesh."
+(2012, 6, 24, 1, 15, 12) fem-assembly-cpp 199.243 "Assembly for various forms and backends"
+(2012, 6, 24, 1, 15, 24) fem-convergence-cpp 11.9021 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 24, 1, 15, 25) fem-jit-python 0.000401711 "JIT compilation (in memory cache)"
+(2012, 6, 24, 1, 20, 38) fem-speedup-cpp 312.978 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 24, 1, 20, 38) fem-speedup-cpp-assembly 5.55022 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 24, 1, 20, 38) fem-speedup-cpp-solve 2.03781 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 24, 1, 21, 1) mesh-refinement-cpp 22.1779 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 24, 1, 21, 22) mesh-topology-cpp 20.5895 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 24, 1, 21, 43) mesh-unitcube-cpp 21.0479 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 24, 1, 22, 26) mesh-iteration-cpp 40.3746 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 24, 1, 22, 48) function-evaluation-cpp 22.3893 "Evaluations of functions at arbitrary points."
+(2012, 6, 24, 1, 22, 48) function-evaluation-cpp 22.2908 "Evaluations of functions at arbitrary points."
+(2012, 6, 24, 1, 22, 55) function-extrapolation-python 6.85051 "BENCH:  1.9329020977"
+(2012, 6, 24, 1, 22, 55) function-extrapolation-python 1.9329 "BENCH:  1.9329020977"
+(2012, 6, 24, 1, 23, 21) la-vector-access-cpp 25.3882 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 24, 1, 23, 46) la-vector-assignment-cpp 24.9473 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 25, 1, 11, 10) common-progress-cpp 29.5366 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 25, 1, 11, 41) common-timing-cpp 31.157 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 25, 1, 11, 51) fem-multicore-cpp 10.1419 "Coloring mesh."
+(2012, 6, 25, 1, 15, 10) fem-assembly-cpp 198.689 "Assembly for various forms and backends"
+(2012, 6, 25, 1, 15, 22) fem-convergence-cpp 11.8499 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 25, 1, 15, 23) fem-jit-python 0.0004251 "JIT compilation (in memory cache)"
+(2012, 6, 25, 1, 20, 36) fem-speedup-cpp 313.241 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 25, 1, 20, 36) fem-speedup-cpp-assembly 5.59466 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 25, 1, 20, 36) fem-speedup-cpp-solve 2.00567 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 25, 1, 21, 0) mesh-refinement-cpp 22.0802 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 25, 1, 21, 20) mesh-topology-cpp 20.597 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 25, 1, 21, 41) mesh-unitcube-cpp 21.0991 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 25, 1, 22, 24) mesh-iteration-cpp 40.3755 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 25, 1, 22, 45) function-evaluation-cpp 21.3401 "Evaluations of functions at arbitrary points."
+(2012, 6, 25, 1, 22, 45) function-evaluation-cpp 21.2445 "Evaluations of functions at arbitrary points."
+(2012, 6, 25, 1, 22, 52) function-extrapolation-python 6.74911 "BENCH:  1.9215118885"
+(2012, 6, 25, 1, 22, 52) function-extrapolation-python 1.92151 "BENCH:  1.9215118885"
+(2012, 6, 25, 1, 23, 17) la-vector-access-cpp 25.3874 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 25, 1, 23, 42) la-vector-assignment-cpp 24.9493 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 26, 1, 11, 28) common-progress-cpp 29.6136 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 26, 1, 11, 59) common-timing-cpp 30.5872 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 26, 1, 12, 9) fem-multicore-cpp 10.0909 "Coloring mesh."
+(2012, 6, 26, 1, 15, 25) fem-assembly-cpp 195.933 "Assembly for various forms and backends"
+(2012, 6, 26, 1, 15, 37) fem-convergence-cpp 11.9398 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 26, 1, 15, 38) fem-jit-python 0.000399804 "JIT compilation (in memory cache)"
+(2012, 6, 26, 1, 20, 49) fem-speedup-cpp 310.914 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 26, 1, 20, 49) fem-speedup-cpp-assembly 5.58617 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 26, 1, 20, 49) fem-speedup-cpp-solve 2.03649 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 26, 1, 21, 12) mesh-refinement-cpp 22.1508 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 26, 1, 21, 33) mesh-topology-cpp 20.5792 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 26, 1, 21, 54) mesh-unitcube-cpp 21.0742 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 26, 1, 22, 38) mesh-iteration-cpp 41.0163 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 26, 1, 22, 59) function-evaluation-cpp 21.315 "Evaluations of functions at arbitrary points."
+(2012, 6, 26, 1, 22, 59) function-evaluation-cpp 21.219 "Evaluations of functions at arbitrary points."
+(2012, 6, 26, 1, 23, 6) function-extrapolation-python 6.60352 "BENCH:  1.92566514015"
+(2012, 6, 26, 1, 23, 6) function-extrapolation-python 1.92567 "BENCH:  1.92566514015"
+(2012, 6, 26, 1, 23, 31) la-vector-access-cpp 25.3865 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 26, 1, 23, 56) la-vector-assignment-cpp 24.9464 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 27, 1, 11, 25) common-progress-cpp 29.8897 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 27, 1, 11, 56) common-timing-cpp 30.6465 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 27, 1, 12, 6) fem-multicore-cpp 10.2003 "Coloring mesh."
+(2012, 6, 27, 1, 15, 18) fem-assembly-cpp 191.976 "Assembly for various forms and backends"
+(2012, 6, 27, 1, 15, 30) fem-convergence-cpp 11.9411 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 27, 1, 15, 31) fem-jit-python 0.000414991 "JIT compilation (in memory cache)"
+(2012, 6, 27, 1, 20, 43) fem-speedup-cpp 311.98 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 27, 1, 20, 43) fem-speedup-cpp-assembly 5.60493 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 27, 1, 20, 43) fem-speedup-cpp-solve 1.99835 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 27, 1, 21, 7) mesh-refinement-cpp 22.0564 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 27, 1, 21, 28) mesh-topology-cpp 20.6054 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 27, 1, 21, 50) mesh-unitcube-cpp 21.7215 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 27, 1, 22, 32) mesh-iteration-cpp 40.3773 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 27, 1, 22, 53) function-evaluation-cpp 21.2317 "Evaluations of functions at arbitrary points."
+(2012, 6, 27, 1, 22, 53) function-evaluation-cpp 21.134 "Evaluations of functions at arbitrary points."
+(2012, 6, 27, 1, 23, 0) function-extrapolation-python 6.7933 "BENCH:  1.95113587379"
+(2012, 6, 27, 1, 23, 0) function-extrapolation-python 1.95114 "BENCH:  1.95113587379"
+(2012, 6, 27, 1, 23, 26) la-vector-access-cpp 25.3915 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 27, 1, 23, 54) la-vector-assignment-cpp 27.8938 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 28, 1, 11, 51) common-progress-cpp 36.4371 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 28, 1, 12, 20) common-timing-cpp 28.9524 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 28, 1, 12, 30) fem-multicore-cpp 10.0163 "Coloring mesh."
+(2012, 6, 28, 1, 15, 42) fem-assembly-cpp 191.767 "Assembly for various forms and backends"
+(2012, 6, 28, 1, 15, 54) fem-convergence-cpp 11.9488 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 28, 1, 15, 55) fem-jit-python 0.000433707 "JIT compilation (in memory cache)"
+(2012, 6, 28, 1, 21, 5) fem-speedup-cpp 310.174 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 28, 1, 21, 5) fem-speedup-cpp-assembly 5.57693 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 28, 1, 21, 5) fem-speedup-cpp-solve 2.03365 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 28, 1, 21, 29) mesh-refinement-cpp 22.0733 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 28, 1, 21, 49) mesh-topology-cpp 20.4687 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 28, 1, 22, 11) mesh-unitcube-cpp 21.6383 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 28, 1, 22, 54) mesh-iteration-cpp 40.3758 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 28, 1, 23, 15) function-evaluation-cpp 21.3317 "Evaluations of functions at arbitrary points."
+(2012, 6, 28, 1, 23, 15) function-evaluation-cpp 21.2295 "Evaluations of functions at arbitrary points."
+(2012, 6, 28, 1, 23, 22) function-extrapolation-python 6.76363 "BENCH:  1.91172289848"
+(2012, 6, 28, 1, 23, 22) function-extrapolation-python 1.91172 "BENCH:  1.91172289848"
+(2012, 6, 28, 1, 23, 45) la-vector-access-cpp 22.8985 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 28, 1, 24, 10) la-vector-assignment-cpp 24.9467 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 29, 1, 16, 32) common-progress-cpp 29.6195 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 29, 1, 17, 1) common-timing-cpp 29.1329 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 29, 1, 17, 11) fem-multicore-cpp 10.0964 "Coloring mesh."
+(2012, 6, 29, 1, 20, 24) fem-assembly-cpp 192.598 "Assembly for various forms and backends"
+(2012, 6, 29, 1, 20, 36) fem-convergence-cpp 11.9221 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 29, 1, 20, 37) fem-jit-python 0.00043602 "JIT compilation (in memory cache)"
+(2012, 6, 29, 1, 25, 46) fem-speedup-cpp 308.68 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 29, 1, 25, 46) fem-speedup-cpp-assembly 5.58399 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 29, 1, 25, 46) fem-speedup-cpp-solve 2.05438 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 29, 1, 26, 9) mesh-refinement-cpp 22.081 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 29, 1, 26, 30) mesh-topology-cpp 20.434 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 29, 1, 26, 52) mesh-unitcube-cpp 21.4899 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 29, 1, 27, 34) mesh-iteration-cpp 40.5043 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 29, 1, 27, 55) function-evaluation-cpp 21.1883 "Evaluations of functions at arbitrary points."
+(2012, 6, 29, 1, 27, 55) function-evaluation-cpp 21.0855 "Evaluations of functions at arbitrary points."
+(2012, 6, 29, 1, 28, 2) function-extrapolation-python 6.68353 "BENCH:  1.91109395027"
+(2012, 6, 29, 1, 28, 2) function-extrapolation-python 1.91109 "BENCH:  1.91109395027"
+(2012, 6, 29, 1, 28, 25) la-vector-access-cpp 22.8937 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 29, 1, 28, 50) la-vector-assignment-cpp 24.9483 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 6, 30, 1, 15, 40) common-progress-cpp 29.6137 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 6, 30, 1, 16, 9) common-timing-cpp 29.4747 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 6, 30, 1, 16, 19) fem-multicore-cpp 10.049 "Coloring mesh."
+(2012, 6, 30, 1, 19, 32) fem-assembly-cpp 193.023 "Assembly for various forms and backends"
+(2012, 6, 30, 1, 19, 44) fem-convergence-cpp 11.9579 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 6, 30, 1, 19, 45) fem-jit-python 0.000429201 "JIT compilation (in memory cache)"
+(2012, 6, 30, 1, 25, 11) fem-speedup-cpp 326.068 "Assembly/solve speedup running on 4 processors"
+(2012, 6, 30, 1, 25, 11) fem-speedup-cpp-assembly 5.60321 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 6, 30, 1, 25, 11) fem-speedup-cpp-solve 1.69883 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 6, 30, 1, 25, 35) mesh-refinement-cpp 22.0917 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 6, 30, 1, 25, 55) mesh-topology-cpp 20.4268 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 6, 30, 1, 26, 17) mesh-unitcube-cpp 21.573 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 6, 30, 1, 27, 0) mesh-iteration-cpp 40.3727 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 6, 30, 1, 27, 21) function-evaluation-cpp 21.3041 "Evaluations of functions at arbitrary points."
+(2012, 6, 30, 1, 27, 21) function-evaluation-cpp 21.2163 "Evaluations of functions at arbitrary points."
+(2012, 6, 30, 1, 27, 28) function-extrapolation-python 6.70274 "BENCH:  1.90698099136"
+(2012, 6, 30, 1, 27, 28) function-extrapolation-python 1.90698 "BENCH:  1.90698099136"
+(2012, 6, 30, 1, 27, 51) la-vector-access-cpp 22.8911 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 6, 30, 1, 28, 16) la-vector-assignment-cpp 24.9591 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 1, 1, 15, 39) common-progress-cpp 29.6486 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 1, 1, 16, 8) common-timing-cpp 29.0547 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 1, 1, 16, 18) fem-multicore-cpp 10.2782 "Coloring mesh."
+(2012, 7, 1, 1, 19, 29) fem-assembly-cpp 191.057 "Assembly for various forms and backends"
+(2012, 7, 1, 1, 19, 41) fem-convergence-cpp 11.9412 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 1, 1, 19, 42) fem-jit-python 0.000424194 "JIT compilation (in memory cache)"
+(2012, 7, 1, 1, 24, 52) fem-speedup-cpp 309.605 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 1, 1, 24, 52) fem-speedup-cpp-assembly 5.59463 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 1, 1, 24, 52) fem-speedup-cpp-solve 2.02099 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 1, 1, 25, 16) mesh-refinement-cpp 22.058 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 1, 1, 25, 36) mesh-topology-cpp 20.4891 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 1, 1, 25, 58) mesh-unitcube-cpp 21.4736 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 1, 1, 26, 40) mesh-iteration-cpp 40.3786 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 1, 1, 27, 2) function-evaluation-cpp 21.3167 "Evaluations of functions at arbitrary points."
+(2012, 7, 1, 1, 27, 2) function-evaluation-cpp 21.2348 "Evaluations of functions at arbitrary points."
+(2012, 7, 1, 1, 27, 8) function-extrapolation-python 6.6622 "BENCH:  1.90865588188"
+(2012, 7, 1, 1, 27, 8) function-extrapolation-python 1.90866 "BENCH:  1.90865588188"
+(2012, 7, 1, 1, 27, 33) la-vector-access-cpp 24.7514 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 1, 1, 27, 58) la-vector-assignment-cpp 25.0286 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 2, 1, 15, 45) common-progress-cpp 29.6133 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 2, 1, 16, 14) common-timing-cpp 29.0894 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 2, 1, 16, 24) fem-multicore-cpp 10.2739 "Coloring mesh."
+(2012, 7, 2, 1, 19, 37) fem-assembly-cpp 192.367 "Assembly for various forms and backends"
+(2012, 7, 2, 1, 19, 48) fem-convergence-cpp 11.6683 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 2, 1, 19, 49) fem-jit-python 0.000405407 "JIT compilation (in memory cache)"
+(2012, 7, 2, 1, 25, 4) fem-speedup-cpp 314.726 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 2, 1, 25, 4) fem-speedup-cpp-assembly 5.63825 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 2, 1, 25, 4) fem-speedup-cpp-solve 1.95124 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 2, 1, 25, 28) mesh-refinement-cpp 22.0579 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 2, 1, 25, 48) mesh-topology-cpp 20.4115 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 2, 1, 26, 10) mesh-unitcube-cpp 21.5577 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 2, 1, 26, 55) mesh-iteration-cpp 42.8509 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 2, 1, 27, 16) function-evaluation-cpp 21.2894 "Evaluations of functions at arbitrary points."
+(2012, 7, 2, 1, 27, 16) function-evaluation-cpp 21.1915 "Evaluations of functions at arbitrary points."
+(2012, 7, 2, 1, 27, 23) function-extrapolation-python 6.6945 "BENCH:  1.90479803085"
+(2012, 7, 2, 1, 27, 23) function-extrapolation-python 1.9048 "BENCH:  1.90479803085"
+(2012, 7, 2, 1, 27, 46) la-vector-access-cpp 22.8879 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 2, 1, 28, 11) la-vector-assignment-cpp 24.9607 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 3, 1, 11, 26) common-progress-cpp 29.628 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 3, 1, 11, 55) common-timing-cpp 28.1257 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 3, 1, 15, 9) fem-assembly-cpp 194.238 "Assembly for various forms and backends"
+(2012, 7, 3, 1, 15, 21) fem-convergence-cpp 11.9512 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 3, 1, 15, 22) fem-jit-python 0.000419402 "JIT compilation (in memory cache)"
+(2012, 7, 3, 1, 20, 40) fem-speedup-cpp 317.628 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 3, 1, 20, 40) fem-speedup-cpp-assembly 5.6005 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 3, 1, 20, 40) fem-speedup-cpp-solve 1.88693 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 3, 1, 21, 3) mesh-refinement-cpp 22.1633 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 3, 1, 21, 24) mesh-topology-cpp 20.7193 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 3, 1, 21, 46) mesh-unitcube-cpp 21.4555 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 3, 1, 22, 30) mesh-iteration-cpp 41.636 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 3, 1, 22, 51) function-evaluation-cpp 20.8499 "Evaluations of functions at arbitrary points."
+(2012, 7, 3, 1, 22, 51) function-evaluation-cpp 20.7684 "Evaluations of functions at arbitrary points."
+(2012, 7, 3, 1, 22, 58) function-extrapolation-python 6.85095 "BENCH:  1.90791702271"
+(2012, 7, 3, 1, 22, 58) function-extrapolation-python 1.90792 "BENCH:  1.90791702271"
+(2012, 7, 3, 1, 23, 20) la-vector-access-cpp 22.4229 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 3, 1, 23, 46) la-vector-assignment-cpp 25.3976 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 4, 1, 11, 30) common-progress-cpp 36.4368 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 4, 1, 11, 58) common-timing-cpp 27.9784 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 4, 1, 15, 12) fem-assembly-cpp 193.354 "Assembly for various forms and backends"
+(2012, 7, 4, 1, 15, 23) fem-convergence-cpp 11.9229 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 4, 1, 15, 25) fem-jit-python 0.00042851 "JIT compilation (in memory cache)"
+(2012, 7, 4, 1, 20, 35) fem-speedup-cpp 310.733 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 4, 1, 20, 35) fem-speedup-cpp-assembly 5.5576 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 4, 1, 20, 35) fem-speedup-cpp-solve 2.02502 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 4, 1, 20, 59) mesh-refinement-cpp 22.0479 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 4, 1, 21, 20) mesh-topology-cpp 20.5564 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 4, 1, 21, 41) mesh-unitcube-cpp 21.4302 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 4, 1, 22, 24) mesh-iteration-cpp 40.3744 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 4, 1, 22, 45) function-evaluation-cpp 21.379 "Evaluations of functions at arbitrary points."
+(2012, 7, 4, 1, 22, 45) function-evaluation-cpp 21.2979 "Evaluations of functions at arbitrary points."
+(2012, 7, 4, 1, 22, 52) function-extrapolation-python 6.58007 "BENCH:  1.86557984352"
+(2012, 7, 4, 1, 22, 52) function-extrapolation-python 1.86558 "BENCH:  1.86557984352"
+(2012, 7, 4, 1, 23, 14) la-vector-access-cpp 22.4098 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 4, 1, 23, 40) la-vector-assignment-cpp 25.4512 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 5, 1, 11, 10) common-progress-cpp 29.7995 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 5, 1, 11, 38) common-timing-cpp 28.1751 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 5, 1, 14, 53) fem-assembly-cpp 194.588 "Assembly for various forms and backends"
+(2012, 7, 5, 1, 15, 5) fem-convergence-cpp 11.9151 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 5, 1, 15, 6) fem-jit-python 0.000421095 "JIT compilation (in memory cache)"
+(2012, 7, 5, 1, 20, 17) fem-speedup-cpp 310.645 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 5, 1, 20, 17) fem-speedup-cpp-assembly 5.5981 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 5, 1, 20, 17) fem-speedup-cpp-solve 2.03443 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 5, 1, 20, 41) mesh-refinement-cpp 22.1465 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 5, 1, 21, 2) mesh-topology-cpp 20.6106 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 5, 1, 21, 23) mesh-unitcube-cpp 21.5178 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 5, 1, 22, 6) mesh-iteration-cpp 40.3804 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 5, 1, 22, 27) function-evaluation-cpp 21.0924 "Evaluations of functions at arbitrary points."
+(2012, 7, 5, 1, 22, 27) function-evaluation-cpp 21.0063 "Evaluations of functions at arbitrary points."
+(2012, 7, 5, 1, 22, 34) function-extrapolation-python 6.72323 "BENCH:  1.92064619064"
+(2012, 7, 5, 1, 22, 34) function-extrapolation-python 1.92065 "BENCH:  1.92064619064"
+(2012, 7, 5, 1, 22, 56) la-vector-access-cpp 22.4236 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 5, 1, 23, 22) la-vector-assignment-cpp 25.4492 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 6, 1, 11, 24) common-progress-cpp 29.6113 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 6, 1, 11, 51) common-timing-cpp 27.6632 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 6, 1, 15, 5) fem-assembly-cpp 193.551 "Assembly for various forms and backends"
+(2012, 7, 6, 1, 15, 17) fem-convergence-cpp 11.4544 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 6, 1, 15, 18) fem-jit-python 0.000411701 "JIT compilation (in memory cache)"
+(2012, 7, 6, 1, 20, 28) fem-speedup-cpp 309.882 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 6, 1, 20, 28) fem-speedup-cpp-assembly 5.58177 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 6, 1, 20, 28) fem-speedup-cpp-solve 1.99716 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 6, 1, 20, 51) mesh-refinement-cpp 22.2273 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 6, 1, 21, 12) mesh-topology-cpp 20.6234 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 6, 1, 21, 34) mesh-unitcube-cpp 21.4828 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 6, 1, 22, 17) mesh-iteration-cpp 40.3755 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 6, 1, 22, 38) function-evaluation-cpp 20.9144 "Evaluations of functions at arbitrary points."
+(2012, 7, 6, 1, 22, 38) function-evaluation-cpp 20.8334 "Evaluations of functions at arbitrary points."
+(2012, 7, 6, 1, 22, 44) function-extrapolation-python 6.73101 "BENCH:  1.90335488319"
+(2012, 7, 6, 1, 22, 44) function-extrapolation-python 1.90335 "BENCH:  1.90335488319"
+(2012, 7, 6, 1, 23, 10) la-vector-access-cpp 25.4003 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 6, 1, 23, 35) la-vector-assignment-cpp 25.4528 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 7, 1, 14, 24) common-progress-cpp 36.4364 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 7, 1, 14, 53) common-timing-cpp 28.9885 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 7, 1, 18, 7) fem-assembly-cpp 193.739 "Assembly for various forms and backends"
+(2012, 7, 7, 1, 18, 19) fem-convergence-cpp 11.9366 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 7, 1, 18, 20) fem-jit-python 0.000412583 "JIT compilation (in memory cache)"
+(2012, 7, 7, 1, 23, 30) fem-speedup-cpp 310.244 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 7, 1, 23, 30) fem-speedup-cpp-assembly 5.5773 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 7, 1, 23, 30) fem-speedup-cpp-solve 2.02537 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 7, 1, 23, 54) mesh-refinement-cpp 22.1877 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 7, 1, 24, 15) mesh-topology-cpp 20.5021 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 7, 1, 24, 36) mesh-unitcube-cpp 21.2574 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 7, 1, 25, 25) mesh-iteration-cpp 46.0096 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 7, 1, 25, 49) function-evaluation-cpp 24.1302 "Evaluations of functions at arbitrary points."
+(2012, 7, 7, 1, 25, 49) function-evaluation-cpp 24.0496 "Evaluations of functions at arbitrary points."
+(2012, 7, 7, 1, 25, 56) function-extrapolation-python 6.88995 "BENCH:  1.90162992477"
+(2012, 7, 7, 1, 25, 56) function-extrapolation-python 1.90163 "BENCH:  1.90162992477"
+(2012, 7, 7, 1, 26, 20) la-vector-access-cpp 24.4814 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 7, 1, 26, 46) la-vector-assignment-cpp 25.4047 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 8, 1, 13, 15) common-progress-cpp 29.6378 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 8, 1, 13, 44) common-timing-cpp 28.9003 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 8, 1, 16, 57) fem-assembly-cpp 192.965 "Assembly for various forms and backends"
+(2012, 7, 8, 1, 17, 8) fem-convergence-cpp 11.4697 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 8, 1, 17, 9) fem-jit-python 0.000409007 "JIT compilation (in memory cache)"
+(2012, 7, 8, 1, 22, 21) fem-speedup-cpp 311.156 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 8, 1, 22, 21) fem-speedup-cpp-assembly 5.57145 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 8, 1, 22, 21) fem-speedup-cpp-solve 1.99761 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 8, 1, 22, 44) mesh-refinement-cpp 22.0935 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 8, 1, 23, 5) mesh-topology-cpp 20.5707 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 8, 1, 23, 26) mesh-unitcube-cpp 21.279 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 8, 1, 24, 9) mesh-iteration-cpp 40.376 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 8, 1, 24, 30) function-evaluation-cpp 21.2841 "Evaluations of functions at arbitrary points."
+(2012, 7, 8, 1, 24, 30) function-evaluation-cpp 21.2034 "Evaluations of functions at arbitrary points."
+(2012, 7, 8, 1, 24, 37) function-extrapolation-python 6.76327 "BENCH:  1.9202029705"
+(2012, 7, 8, 1, 24, 37) function-extrapolation-python 1.9202 "BENCH:  1.9202029705"
+(2012, 7, 8, 1, 25, 0) la-vector-access-cpp 22.42 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 8, 1, 25, 25) la-vector-assignment-cpp 25.4584 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 9, 1, 13, 19) common-progress-cpp 29.5748 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 9, 1, 13, 48) common-timing-cpp 28.6257 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 9, 1, 17, 1) fem-assembly-cpp 192.955 "Assembly for various forms and backends"
+(2012, 7, 9, 1, 17, 13) fem-convergence-cpp 11.9453 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 9, 1, 17, 14) fem-jit-python 0.00041399 "JIT compilation (in memory cache)"
+(2012, 7, 9, 1, 22, 26) fem-speedup-cpp 311.295 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 9, 1, 22, 26) fem-speedup-cpp-assembly 5.58353 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 9, 1, 22, 26) fem-speedup-cpp-solve 2.02437 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 9, 1, 22, 49) mesh-refinement-cpp 22.1555 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 9, 1, 23, 10) mesh-topology-cpp 20.5953 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 9, 1, 23, 32) mesh-unitcube-cpp 21.3128 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 9, 1, 24, 14) mesh-iteration-cpp 40.4215 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 9, 1, 24, 36) function-evaluation-cpp 21.5272 "Evaluations of functions at arbitrary points."
+(2012, 7, 9, 1, 24, 36) function-evaluation-cpp 21.4467 "Evaluations of functions at arbitrary points."
+(2012, 7, 9, 1, 24, 43) function-extrapolation-python 6.78775 "BENCH:  1.91103196144"
+(2012, 7, 9, 1, 24, 43) function-extrapolation-python 1.91103 "BENCH:  1.91103196144"
+(2012, 7, 9, 1, 25, 6) la-vector-access-cpp 23.6291 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 9, 1, 25, 34) la-vector-assignment-cpp 27.892 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 10, 1, 14, 38) common-progress-cpp 29.5893 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 10, 1, 15, 7) common-timing-cpp 29.1217 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 10, 1, 18, 22) fem-assembly-cpp 194.469 "Assembly for various forms and backends"
+(2012, 7, 10, 1, 18, 34) fem-convergence-cpp 11.9089 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 10, 1, 18, 35) fem-jit-python 0.000415802 "JIT compilation (in memory cache)"
+(2012, 7, 10, 1, 23, 44) fem-speedup-cpp 309.423 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 10, 1, 23, 44) fem-speedup-cpp-assembly 5.66613 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 10, 1, 23, 44) fem-speedup-cpp-solve 2.03236 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 10, 1, 24, 8) mesh-refinement-cpp 22.3689 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 10, 1, 24, 29) mesh-topology-cpp 20.554 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 10, 1, 24, 50) mesh-unitcube-cpp 20.9391 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 10, 1, 25, 33) mesh-iteration-cpp 40.3767 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 10, 1, 25, 54) function-evaluation-cpp 21.2844 "Evaluations of functions at arbitrary points."
+(2012, 7, 10, 1, 25, 54) function-evaluation-cpp 21.2033 "Evaluations of functions at arbitrary points."
+(2012, 7, 10, 1, 26, 1) function-extrapolation-python 6.67263 "BENCH:  1.9172949791"
+(2012, 7, 10, 1, 26, 1) function-extrapolation-python 1.91729 "BENCH:  1.9172949791"
+(2012, 7, 10, 1, 26, 23) la-vector-access-cpp 22.427 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 10, 1, 26, 51) la-vector-assignment-cpp 27.9069 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 11, 1, 11, 47) common-progress-cpp 29.8045 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 11, 1, 12, 17) common-timing-cpp 30.0524 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 11, 1, 15, 31) fem-assembly-cpp 194.012 "Assembly for various forms and backends"
+(2012, 7, 11, 1, 15, 43) fem-convergence-cpp 11.9505 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 11, 1, 15, 44) fem-jit-python 0.000429821 "JIT compilation (in memory cache)"
+(2012, 7, 11, 1, 20, 56) fem-speedup-cpp 311.849 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 11, 1, 20, 56) fem-speedup-cpp-assembly 5.6531 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 11, 1, 20, 56) fem-speedup-cpp-solve 2.00829 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 11, 1, 21, 20) mesh-refinement-cpp 22.3421 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 11, 1, 21, 41) mesh-topology-cpp 20.6441 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 11, 1, 22, 2) mesh-unitcube-cpp 20.9552 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 11, 1, 22, 44) mesh-iteration-cpp 40.3828 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 11, 1, 23, 6) function-evaluation-cpp 21.9723 "Evaluations of functions at arbitrary points."
+(2012, 7, 11, 1, 23, 6) function-evaluation-cpp 21.8829 "Evaluations of functions at arbitrary points."
+(2012, 7, 11, 1, 23, 13) function-extrapolation-python 6.75829 "BENCH:  1.90943789482"
+(2012, 7, 11, 1, 23, 13) function-extrapolation-python 1.90944 "BENCH:  1.90943789482"
+(2012, 7, 11, 1, 23, 38) la-vector-access-cpp 24.7412 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 11, 1, 24, 3) la-vector-assignment-cpp 25.4111 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 12, 1, 11, 53) common-progress-cpp 36.4373 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 12, 1, 12, 21) common-timing-cpp 28.5086 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 12, 1, 15, 36) fem-assembly-cpp 194.434 "Assembly for various forms and backends"
+(2012, 7, 12, 1, 15, 48) fem-convergence-cpp 11.5306 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 12, 1, 15, 49) fem-jit-python 0.000412893 "JIT compilation (in memory cache)"
+(2012, 7, 12, 1, 20, 57) fem-speedup-cpp 308.792 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 12, 1, 20, 57) fem-speedup-cpp-assembly 5.60959 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 12, 1, 20, 57) fem-speedup-cpp-solve 2.0193 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 12, 1, 21, 21) mesh-refinement-cpp 22.4121 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 12, 1, 21, 42) mesh-topology-cpp 20.5736 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 12, 1, 22, 3) mesh-unitcube-cpp 20.93 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 12, 1, 22, 46) mesh-iteration-cpp 40.3743 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 12, 1, 23, 7) function-evaluation-cpp 21.2894 "Evaluations of functions at arbitrary points."
+(2012, 7, 12, 1, 23, 7) function-evaluation-cpp 21.2081 "Evaluations of functions at arbitrary points."
+(2012, 7, 12, 1, 23, 14) function-extrapolation-python 6.67532 "BENCH:  1.91668891907"
+(2012, 7, 12, 1, 23, 14) function-extrapolation-python 1.91669 "BENCH:  1.91668891907"
+(2012, 7, 12, 1, 23, 38) la-vector-access-cpp 23.6359 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 12, 1, 24, 3) la-vector-assignment-cpp 25.4436 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 13, 1, 11, 28) common-progress-cpp 29.6488 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 13, 1, 11, 59) common-timing-cpp 30.083 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 13, 1, 12, 9) fem-multicore-cpp 10.0839 "Coloring mesh."
+(2012, 7, 13, 1, 15, 22) fem-assembly-cpp 193.626 "Assembly for various forms and backends"
+(2012, 7, 13, 1, 15, 34) fem-convergence-cpp 11.9086 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 13, 1, 15, 35) fem-jit-python 0.000427198 "JIT compilation (in memory cache)"
+(2012, 7, 13, 1, 20, 45) fem-speedup-cpp 309.717 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 13, 1, 20, 45) fem-speedup-cpp-assembly 5.63184 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 13, 1, 20, 45) fem-speedup-cpp-solve 2.04214 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 13, 1, 21, 9) mesh-refinement-cpp 22.153 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 13, 1, 21, 30) mesh-topology-cpp 20.7313 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 13, 1, 21, 51) mesh-unitcube-cpp 21.4905 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 13, 1, 22, 35) mesh-iteration-cpp 41.634 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 13, 1, 22, 56) function-evaluation-cpp 21.2933 "Evaluations of functions at arbitrary points."
+(2012, 7, 13, 1, 22, 56) function-evaluation-cpp 21.2119 "Evaluations of functions at arbitrary points."
+(2012, 7, 13, 1, 23, 3) function-extrapolation-python 6.8248 "BENCH:  1.9243979454"
+(2012, 7, 13, 1, 23, 3) function-extrapolation-python 1.9244 "BENCH:  1.9243979454"
+(2012, 7, 13, 1, 23, 26) la-vector-access-cpp 22.4081 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 13, 1, 23, 51) la-vector-assignment-cpp 25.4809 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 14, 1, 11, 14) common-progress-cpp 38.9434 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 14, 1, 11, 43) common-timing-cpp 29.3379 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 14, 1, 11, 53) fem-multicore-cpp 10.0772 "Coloring mesh."
+(2012, 7, 14, 1, 15, 6) fem-assembly-cpp 193.142 "Assembly for various forms and backends"
+(2012, 7, 14, 1, 15, 18) fem-convergence-cpp 11.8946 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 14, 1, 15, 19) fem-jit-python 0.000407195 "JIT compilation (in memory cache)"
+(2012, 7, 14, 1, 20, 29) fem-speedup-cpp 310.363 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 14, 1, 20, 29) fem-speedup-cpp-assembly 5.55063 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 14, 1, 20, 29) fem-speedup-cpp-solve 2.02214 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 14, 1, 20, 53) mesh-refinement-cpp 22.1168 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 14, 1, 21, 14) mesh-topology-cpp 20.7844 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 14, 1, 21, 36) mesh-unitcube-cpp 21.3481 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 14, 1, 22, 18) mesh-iteration-cpp 40.3815 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 14, 1, 22, 40) function-evaluation-cpp 21.9608 "Evaluations of functions at arbitrary points."
+(2012, 7, 14, 1, 22, 40) function-evaluation-cpp 21.8798 "Evaluations of functions at arbitrary points."
+(2012, 7, 14, 1, 22, 47) function-extrapolation-python 6.8243 "BENCH:  1.92809700966"
+(2012, 7, 14, 1, 22, 47) function-extrapolation-python 1.9281 "BENCH:  1.92809700966"
+(2012, 7, 14, 1, 23, 10) la-vector-access-cpp 22.4038 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 14, 1, 23, 35) la-vector-assignment-cpp 25.5905 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 15, 1, 11, 14) common-progress-cpp 38.9439 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 15, 1, 11, 45) common-timing-cpp 30.8212 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 15, 1, 11, 55) fem-multicore-cpp 10.1311 "Coloring mesh."
+(2012, 7, 15, 1, 15, 10) fem-assembly-cpp 194.769 "Assembly for various forms and backends"
+(2012, 7, 15, 1, 15, 21) fem-convergence-cpp 11.8522 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 15, 1, 15, 22) fem-jit-python 0.000414014 "JIT compilation (in memory cache)"
+(2012, 7, 15, 1, 20, 34) fem-speedup-cpp 311.408 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 15, 1, 20, 34) fem-speedup-cpp-assembly 5.62431 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 15, 1, 20, 34) fem-speedup-cpp-solve 2.02487 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 15, 1, 20, 58) mesh-refinement-cpp 22.0856 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 15, 1, 21, 18) mesh-topology-cpp 20.6847 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 15, 1, 21, 40) mesh-unitcube-cpp 21.4524 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 15, 1, 22, 29) mesh-iteration-cpp 46.2753 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 15, 1, 22, 50) function-evaluation-cpp 21.2861 "Evaluations of functions at arbitrary points."
+(2012, 7, 15, 1, 22, 50) function-evaluation-cpp 21.2044 "Evaluations of functions at arbitrary points."
+(2012, 7, 15, 1, 22, 57) function-extrapolation-python 6.77093 "BENCH:  1.92303419113"
+(2012, 7, 15, 1, 22, 57) function-extrapolation-python 1.92303 "BENCH:  1.92303419113"
+(2012, 7, 15, 1, 23, 22) la-vector-access-cpp 25.3831 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 15, 1, 23, 48) la-vector-assignment-cpp 25.4531 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 16, 1, 11, 11) common-progress-cpp 29.5795 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 16, 1, 11, 41) common-timing-cpp 29.7445 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 16, 1, 11, 51) fem-multicore-cpp 9.94738 "Coloring mesh."
+(2012, 7, 16, 1, 15, 5) fem-assembly-cpp 194.098 "Assembly for various forms and backends"
+(2012, 7, 16, 1, 15, 17) fem-convergence-cpp 11.9348 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 16, 1, 15, 18) fem-jit-python 0.000427079 "JIT compilation (in memory cache)"
+(2012, 7, 16, 1, 20, 27) fem-speedup-cpp 308.865 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 16, 1, 20, 27) fem-speedup-cpp-assembly 5.60095 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 16, 1, 20, 27) fem-speedup-cpp-solve 2.02497 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 16, 1, 20, 50) mesh-refinement-cpp 22.1093 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 16, 1, 21, 11) mesh-topology-cpp 20.8478 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 16, 1, 21, 33) mesh-unitcube-cpp 21.4882 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 16, 1, 22, 16) mesh-iteration-cpp 40.3822 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 16, 1, 22, 37) function-evaluation-cpp 20.9776 "Evaluations of functions at arbitrary points."
+(2012, 7, 16, 1, 22, 37) function-evaluation-cpp 20.8962 "Evaluations of functions at arbitrary points."
+(2012, 7, 16, 1, 22, 43) function-extrapolation-python 6.72694 "BENCH:  1.93575787544"
+(2012, 7, 16, 1, 22, 43) function-extrapolation-python 1.93576 "BENCH:  1.93575787544"
+(2012, 7, 16, 1, 23, 6) la-vector-access-cpp 22.409 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 16, 1, 23, 31) la-vector-assignment-cpp 25.4432 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 17, 1, 11, 31) common-progress-cpp 29.6357 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 17, 1, 12, 2) common-timing-cpp 30.6584 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 17, 1, 12, 12) fem-multicore-cpp 10.0469 "Coloring mesh."
+(2012, 7, 17, 1, 15, 26) fem-assembly-cpp 194.112 "Assembly for various forms and backends"
+(2012, 7, 17, 1, 15, 38) fem-convergence-cpp 11.9217 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 17, 1, 15, 39) fem-jit-python 0.000420213 "JIT compilation (in memory cache)"
+(2012, 7, 17, 1, 20, 50) fem-speedup-cpp 310.945 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 17, 1, 20, 50) fem-speedup-cpp-assembly 5.57088 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 17, 1, 20, 50) fem-speedup-cpp-solve 2.03844 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 17, 1, 21, 14) mesh-refinement-cpp 22.1577 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 17, 1, 21, 35) mesh-topology-cpp 20.764 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 17, 1, 21, 56) mesh-unitcube-cpp 21.3822 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 17, 1, 22, 39) mesh-iteration-cpp 40.3758 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 17, 1, 23, 1) function-evaluation-cpp 21.2812 "Evaluations of functions at arbitrary points."
+(2012, 7, 17, 1, 23, 1) function-evaluation-cpp 21.2001 "Evaluations of functions at arbitrary points."
+(2012, 7, 17, 1, 23, 7) function-extrapolation-python 6.7999 "BENCH:  1.92372608185"
+(2012, 7, 17, 1, 23, 7) function-extrapolation-python 1.92373 "BENCH:  1.92372608185"
+(2012, 7, 17, 1, 23, 32) la-vector-access-cpp 24.7897 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 17, 1, 23, 58) la-vector-assignment-cpp 25.4068 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 19, 1, 11, 9) common-progress-cpp 29.7868 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 19, 1, 11, 38) common-timing-cpp 28.8395 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 19, 1, 11, 48) fem-multicore-cpp 10.2752 "Coloring mesh."
+(2012, 7, 19, 1, 15, 3) fem-assembly-cpp 194.947 "Assembly for various forms and backends"
+(2012, 7, 19, 1, 15, 15) fem-convergence-cpp 11.8983 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 19, 1, 15, 16) fem-jit-python 0.000419402 "JIT compilation (in memory cache)"
+(2012, 7, 19, 1, 20, 25) fem-speedup-cpp 308.963 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 19, 1, 20, 25) fem-speedup-cpp-assembly 5.60969 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 19, 1, 20, 25) fem-speedup-cpp-solve 2.03868 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 19, 1, 20, 49) mesh-refinement-cpp 22.4129 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 19, 1, 21, 10) mesh-topology-cpp 20.761 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 19, 1, 21, 32) mesh-unitcube-cpp 21.5611 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 19, 1, 22, 25) mesh-iteration-cpp 51.0275 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 19, 1, 22, 47) function-evaluation-cpp 21.5729 "Evaluations of functions at arbitrary points."
+(2012, 7, 19, 1, 22, 47) function-evaluation-cpp 21.4917 "Evaluations of functions at arbitrary points."
+(2012, 7, 19, 1, 22, 54) function-extrapolation-python 6.68494 "BENCH:  1.89506697655"
+(2012, 7, 19, 1, 22, 54) function-extrapolation-python 1.89507 "BENCH:  1.89506697655"
+(2012, 7, 19, 1, 23, 16) la-vector-access-cpp 22.4159 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 19, 1, 23, 41) la-vector-assignment-cpp 25.399 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 20, 1, 11, 8) common-progress-cpp 29.0914 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 20, 1, 11, 37) common-timing-cpp 29.2537 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 20, 1, 11, 47) fem-multicore-cpp 10.1507 "Coloring mesh."
+(2012, 7, 20, 1, 15, 4) fem-assembly-cpp 196.471 "Assembly for various forms and backends"
+(2012, 7, 20, 1, 15, 16) fem-convergence-cpp 11.8827 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 20, 1, 15, 17) fem-jit-python 0.000411892 "JIT compilation (in memory cache)"
+(2012, 7, 20, 1, 20, 29) fem-speedup-cpp 312.336 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 20, 1, 20, 29) fem-speedup-cpp-assembly 5.58828 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 20, 1, 20, 29) fem-speedup-cpp-solve 2.0176 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 20, 1, 20, 53) mesh-refinement-cpp 22.4186 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 20, 1, 21, 14) mesh-topology-cpp 20.6485 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 20, 1, 21, 36) mesh-unitcube-cpp 21.7139 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 20, 1, 22, 18) mesh-iteration-cpp 40.3752 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 20, 1, 22, 40) function-evaluation-cpp 21.2835 "Evaluations of functions at arbitrary points."
+(2012, 7, 20, 1, 22, 40) function-evaluation-cpp 21.2025 "Evaluations of functions at arbitrary points."
+(2012, 7, 20, 1, 22, 47) function-extrapolation-python 6.79721 "BENCH:  1.89754605293"
+(2012, 7, 20, 1, 22, 47) function-extrapolation-python 1.89755 "BENCH:  1.89754605293"
+(2012, 7, 20, 1, 23, 11) la-vector-access-cpp 23.9353 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 20, 1, 23, 36) la-vector-assignment-cpp 25.3965 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 21, 1, 11, 32) common-progress-cpp 29.6363 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 21, 1, 12, 2) common-timing-cpp 29.8686 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 21, 1, 12, 12) fem-multicore-cpp 9.95786 "Coloring mesh."
+(2012, 7, 21, 1, 15, 26) fem-assembly-cpp 193.425 "Assembly for various forms and backends"
+(2012, 7, 21, 1, 15, 37) fem-convergence-cpp 11.9171 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 21, 1, 15, 39) fem-jit-python 0.000430417 "JIT compilation (in memory cache)"
+(2012, 7, 21, 1, 20, 48) fem-speedup-cpp 308.931 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 21, 1, 20, 48) fem-speedup-cpp-assembly 5.5555 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 21, 1, 20, 48) fem-speedup-cpp-solve 2.05058 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 21, 1, 21, 11) mesh-refinement-cpp 22.3758 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 21, 1, 21, 32) mesh-topology-cpp 20.6305 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 21, 1, 21, 55) mesh-unitcube-cpp 22.3498 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 21, 1, 22, 41) mesh-iteration-cpp 43.5146 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 21, 1, 23, 2) function-evaluation-cpp 20.8254 "Evaluations of functions at arbitrary points."
+(2012, 7, 21, 1, 23, 2) function-evaluation-cpp 20.7446 "Evaluations of functions at arbitrary points."
+(2012, 7, 21, 1, 23, 8) function-extrapolation-python 6.78721 "BENCH:  1.91753196716"
+(2012, 7, 21, 1, 23, 8) function-extrapolation-python 1.91753 "BENCH:  1.91753196716"
+(2012, 7, 21, 1, 23, 31) la-vector-access-cpp 22.4287 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 21, 1, 23, 56) la-vector-assignment-cpp 25.4559 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 22, 1, 11, 31) common-progress-cpp 47.72 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 22, 1, 12, 1) common-timing-cpp 29.4317 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 22, 1, 12, 11) fem-multicore-cpp 9.94623 "Coloring mesh."
+(2012, 7, 22, 1, 15, 26) fem-assembly-cpp 194.897 "Assembly for various forms and backends"
+(2012, 7, 22, 1, 15, 37) fem-convergence-cpp 11.8542 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 22, 1, 15, 39) fem-jit-python 0.000412416 "JIT compilation (in memory cache)"
+(2012, 7, 22, 1, 20, 49) fem-speedup-cpp 310.132 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 22, 1, 20, 49) fem-speedup-cpp-assembly 5.54072 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 22, 1, 20, 49) fem-speedup-cpp-solve 2.03657 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 22, 1, 21, 13) mesh-refinement-cpp 22.4339 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 22, 1, 21, 34) mesh-topology-cpp 20.6921 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 22, 1, 21, 56) mesh-unitcube-cpp 22.3722 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 22, 1, 22, 40) mesh-iteration-cpp 41.7626 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 22, 1, 23, 1) function-evaluation-cpp 20.7944 "Evaluations of functions at arbitrary points."
+(2012, 7, 22, 1, 23, 1) function-evaluation-cpp 20.7068 "Evaluations of functions at arbitrary points."
+(2012, 7, 22, 1, 23, 8) function-extrapolation-python 6.84596 "BENCH:  1.90588784218"
+(2012, 7, 22, 1, 23, 8) function-extrapolation-python 1.90589 "BENCH:  1.90588784218"
+(2012, 7, 22, 1, 23, 33) la-vector-access-cpp 25.41 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 22, 1, 23, 59) la-vector-assignment-cpp 25.4635 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 23, 1, 11, 6) common-progress-cpp 29.6032 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 23, 1, 11, 36) common-timing-cpp 29.9432 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 23, 1, 11, 46) fem-multicore-cpp 9.90192 "Coloring mesh."
+(2012, 7, 23, 1, 14, 59) fem-assembly-cpp 193.564 "Assembly for various forms and backends"
+(2012, 7, 23, 1, 15, 11) fem-convergence-cpp 11.9282 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 23, 1, 15, 12) fem-jit-python 0.000425696 "JIT compilation (in memory cache)"
+(2012, 7, 23, 1, 20, 23) fem-speedup-cpp 310.915 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 23, 1, 20, 23) fem-speedup-cpp-assembly 5.57585 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 23, 1, 20, 23) fem-speedup-cpp-solve 2.00888 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 23, 1, 20, 47) mesh-refinement-cpp 22.3715 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 23, 1, 21, 8) mesh-topology-cpp 20.6325 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 23, 1, 21, 31) mesh-unitcube-cpp 22.4316 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 23, 1, 22, 14) mesh-iteration-cpp 41.0185 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 23, 1, 22, 35) function-evaluation-cpp 21.3319 "Evaluations of functions at arbitrary points."
+(2012, 7, 23, 1, 22, 35) function-evaluation-cpp 21.2447 "Evaluations of functions at arbitrary points."
+(2012, 7, 23, 1, 22, 42) function-extrapolation-python 6.82343 "BENCH:  1.93197798729"
+(2012, 7, 23, 1, 22, 42) function-extrapolation-python 1.93198 "BENCH:  1.93197798729"
+(2012, 7, 23, 1, 23, 8) la-vector-access-cpp 25.3912 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 23, 1, 23, 36) la-vector-assignment-cpp 27.9007 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 24, 1, 11, 11) common-progress-cpp 29.0819 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 24, 1, 11, 41) common-timing-cpp 29.3601 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 24, 1, 11, 51) fem-multicore-cpp 9.95028 "Coloring mesh."
+(2012, 7, 24, 1, 15, 5) fem-assembly-cpp 194.265 "Assembly for various forms and backends"
+(2012, 7, 24, 1, 15, 17) fem-convergence-cpp 11.9279 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 24, 1, 15, 18) fem-jit-python 0.000419378 "JIT compilation (in memory cache)"
+(2012, 7, 24, 1, 20, 30) fem-speedup-cpp 311.658 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 24, 1, 20, 30) fem-speedup-cpp-assembly 5.49909 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 24, 1, 20, 30) fem-speedup-cpp-solve 2.05009 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 24, 1, 20, 54) mesh-refinement-cpp 22.4222 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 24, 1, 21, 15) mesh-topology-cpp 20.6787 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 24, 1, 21, 37) mesh-unitcube-cpp 22.4159 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 24, 1, 22, 25) mesh-iteration-cpp 46.0234 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 24, 1, 22, 47) function-evaluation-cpp 21.2977 "Evaluations of functions at arbitrary points."
+(2012, 7, 24, 1, 22, 47) function-evaluation-cpp 21.2007 "Evaluations of functions at arbitrary points."
+(2012, 7, 24, 1, 22, 53) function-extrapolation-python 6.86221 "BENCH:  1.92128801346"
+(2012, 7, 24, 1, 22, 53) function-extrapolation-python 1.92129 "BENCH:  1.92128801346"
+(2012, 7, 24, 1, 23, 18) la-vector-access-cpp 24.7522 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 24, 1, 23, 46) la-vector-assignment-cpp 27.8409 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 25, 1, 11, 14) common-progress-cpp 36.4356 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 25, 1, 11, 43) common-timing-cpp 29.6528 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 25, 1, 11, 53) fem-multicore-cpp 9.98029 "Coloring mesh."
+(2012, 7, 25, 1, 15, 7) fem-assembly-cpp 193.57 "Assembly for various forms and backends"
+(2012, 7, 25, 1, 15, 19) fem-convergence-cpp 11.9259 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 25, 1, 15, 20) fem-jit-python 0.000426006 "JIT compilation (in memory cache)"
+(2012, 7, 25, 1, 20, 31) fem-speedup-cpp 310.625 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 25, 1, 20, 31) fem-speedup-cpp-assembly 5.55859 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 25, 1, 20, 31) fem-speedup-cpp-solve 1.99905 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 25, 1, 20, 55) mesh-refinement-cpp 22.4398 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 25, 1, 21, 15) mesh-topology-cpp 20.6706 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 25, 1, 21, 38) mesh-unitcube-cpp 22.3091 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 25, 1, 22, 22) mesh-iteration-cpp 41.6074 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 25, 1, 22, 43) function-evaluation-cpp 21.2907 "Evaluations of functions at arbitrary points."
+(2012, 7, 25, 1, 22, 43) function-evaluation-cpp 21.2097 "Evaluations of functions at arbitrary points."
+(2012, 7, 25, 1, 22, 50) function-extrapolation-python 6.70363 "BENCH:  1.9204351902"
+(2012, 7, 25, 1, 22, 50) function-extrapolation-python 1.92044 "BENCH:  1.9204351902"
+(2012, 7, 25, 1, 23, 12) la-vector-access-cpp 22.4167 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 25, 1, 23, 38) la-vector-assignment-cpp 25.3947 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 27, 1, 11, 26) common-progress-cpp 37.6901 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 27, 1, 11, 56) common-timing-cpp 30.1764 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 27, 1, 12, 6) fem-multicore-cpp 9.98826 "Coloring mesh."
+(2012, 7, 27, 1, 15, 19) fem-assembly-cpp 193.644 "Assembly for various forms and backends"
+(2012, 7, 27, 1, 15, 31) fem-convergence-cpp 11.8717 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 27, 1, 15, 32) fem-jit-python 0.00041101 "JIT compilation (in memory cache)"
+(2012, 7, 27, 1, 20, 42) fem-speedup-cpp 309.846 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 27, 1, 20, 42) fem-speedup-cpp-assembly 5.65637 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 27, 1, 20, 42) fem-speedup-cpp-solve 2.04842 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 27, 1, 21, 6) mesh-refinement-cpp 22.3369 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 27, 1, 21, 27) mesh-topology-cpp 20.7088 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 27, 1, 21, 50) mesh-unitcube-cpp 22.4545 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 27, 1, 22, 32) mesh-iteration-cpp 40.3789 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 27, 1, 22, 54) function-evaluation-cpp 21.9869 "Evaluations of functions at arbitrary points."
+(2012, 7, 27, 1, 22, 54) function-evaluation-cpp 21.8999 "Evaluations of functions at arbitrary points."
+(2012, 7, 27, 1, 23, 1) function-extrapolation-python 6.73873 "BENCH:  1.90853095055"
+(2012, 7, 27, 1, 23, 1) function-extrapolation-python 1.90853 "BENCH:  1.90853095055"
+(2012, 7, 27, 1, 23, 24) la-vector-access-cpp 22.4537 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 27, 1, 23, 49) la-vector-assignment-cpp 24.9493 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 29, 1, 11, 13) common-progress-cpp 29.7298 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 29, 1, 11, 44) common-timing-cpp 30.7616 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 29, 1, 11, 54) fem-multicore-cpp 10.0131 "Coloring mesh."
+(2012, 7, 29, 1, 15, 7) fem-assembly-cpp 193.53 "Assembly for various forms and backends"
+(2012, 7, 29, 1, 15, 19) fem-convergence-cpp 11.426 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 29, 1, 15, 20) fem-jit-python 0.000416112 "JIT compilation (in memory cache)"
+(2012, 7, 29, 1, 20, 31) fem-speedup-cpp 311.399 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 29, 1, 20, 31) fem-speedup-cpp-assembly 5.64124 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 29, 1, 20, 31) fem-speedup-cpp-solve 2.00606 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 29, 1, 20, 55) mesh-refinement-cpp 22.3373 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 29, 1, 21, 16) mesh-topology-cpp 20.6986 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 29, 1, 21, 38) mesh-unitcube-cpp 21.8388 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 29, 1, 22, 21) mesh-iteration-cpp 40.3855 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 29, 1, 22, 42) function-evaluation-cpp 21.3017 "Evaluations of functions at arbitrary points."
+(2012, 7, 29, 1, 22, 42) function-evaluation-cpp 21.2214 "Evaluations of functions at arbitrary points."
+(2012, 7, 29, 1, 22, 49) function-extrapolation-python 6.69555 "BENCH:  1.89014196396"
+(2012, 7, 29, 1, 22, 49) function-extrapolation-python 1.89014 "BENCH:  1.89014196396"
+(2012, 7, 29, 1, 23, 12) la-vector-access-cpp 22.4472 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 29, 1, 23, 40) la-vector-assignment-cpp 27.9015 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 30, 1, 11, 16) common-progress-cpp 29.6569 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 30, 1, 11, 47) common-timing-cpp 30.2102 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 30, 1, 11, 57) fem-multicore-cpp 9.89728 "Coloring mesh."
+(2012, 7, 30, 1, 15, 10) fem-assembly-cpp 193.385 "Assembly for various forms and backends"
+(2012, 7, 30, 1, 15, 22) fem-convergence-cpp 11.9149 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 30, 1, 15, 23) fem-jit-python 0.000411415 "JIT compilation (in memory cache)"
+(2012, 7, 30, 1, 20, 34) fem-speedup-cpp 310.68 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 30, 1, 20, 34) fem-speedup-cpp-assembly 5.68593 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 30, 1, 20, 34) fem-speedup-cpp-solve 2.04506 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 30, 1, 20, 58) mesh-refinement-cpp 22.3722 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 30, 1, 21, 19) mesh-topology-cpp 20.7445 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 30, 1, 21, 40) mesh-unitcube-cpp 21.8393 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 30, 1, 22, 23) mesh-iteration-cpp 40.3795 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 30, 1, 22, 45) function-evaluation-cpp 21.3273 "Evaluations of functions at arbitrary points."
+(2012, 7, 30, 1, 22, 45) function-evaluation-cpp 21.2424 "Evaluations of functions at arbitrary points."
+(2012, 7, 30, 1, 22, 51) function-extrapolation-python 6.76534 "BENCH:  1.95725488663"
+(2012, 7, 30, 1, 22, 51) function-extrapolation-python 1.95725 "BENCH:  1.95725488663"
+(2012, 7, 30, 1, 23, 17) la-vector-access-cpp 25.4715 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 30, 1, 23, 42) la-vector-assignment-cpp 24.9598 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 7, 31, 1, 11, 28) common-progress-cpp 29.5893 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 7, 31, 1, 11, 58) common-timing-cpp 30.1016 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 7, 31, 1, 12, 8) fem-multicore-cpp 9.93331 "Coloring mesh."
+(2012, 7, 31, 1, 15, 19) fem-assembly-cpp 190.548 "Assembly for various forms and backends"
+(2012, 7, 31, 1, 15, 31) fem-convergence-cpp 11.9473 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 7, 31, 1, 15, 32) fem-jit-python 0.000434399 "JIT compilation (in memory cache)"
+(2012, 7, 31, 1, 20, 42) fem-speedup-cpp 310.112 "Assembly/solve speedup running on 4 processors"
+(2012, 7, 31, 1, 20, 42) fem-speedup-cpp-assembly 5.56953 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 7, 31, 1, 20, 42) fem-speedup-cpp-solve 2.02464 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 7, 31, 1, 21, 6) mesh-refinement-cpp 22.5539 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 7, 31, 1, 21, 27) mesh-topology-cpp 20.7692 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 7, 31, 1, 21, 51) mesh-unitcube-cpp 23.7833 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 7, 31, 1, 22, 40) mesh-iteration-cpp 46.0126 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 7, 31, 1, 23, 1) function-evaluation-cpp 21.3054 "Evaluations of functions at arbitrary points."
+(2012, 7, 31, 1, 23, 1) function-evaluation-cpp 21.2248 "Evaluations of functions at arbitrary points."
+(2012, 7, 31, 1, 23, 8) function-extrapolation-python 6.78106 "BENCH:  1.90696597099"
+(2012, 7, 31, 1, 23, 8) function-extrapolation-python 1.90697 "BENCH:  1.90696597099"
+(2012, 7, 31, 1, 23, 37) la-vector-access-cpp 29.4313 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 7, 31, 1, 24, 2) la-vector-assignment-cpp 24.955 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 1, 1, 11, 17) common-progress-cpp 29.5766 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 1, 1, 11, 47) common-timing-cpp 30.4901 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 1, 1, 11, 57) fem-multicore-cpp 9.94622 "Coloring mesh."
+(2012, 8, 1, 1, 15, 8) fem-assembly-cpp 190.876 "Assembly for various forms and backends"
+(2012, 8, 1, 1, 15, 20) fem-convergence-cpp 11.8958 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 1, 1, 15, 21) fem-jit-python 0.000432014 "JIT compilation (in memory cache)"
+(2012, 8, 1, 1, 20, 32) fem-speedup-cpp 311.034 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 1, 1, 20, 32) fem-speedup-cpp-assembly 5.59269 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 1, 1, 20, 32) fem-speedup-cpp-solve 2.03693 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 1, 1, 20, 56) mesh-refinement-cpp 22.598 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 1, 1, 21, 18) mesh-topology-cpp 20.8268 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 1, 1, 21, 41) mesh-unitcube-cpp 23.7219 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 1, 1, 22, 26) mesh-iteration-cpp 41.6373 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 1, 1, 22, 47) function-evaluation-cpp 21.3215 "Evaluations of functions at arbitrary points."
+(2012, 8, 1, 1, 22, 47) function-evaluation-cpp 21.2352 "Evaluations of functions at arbitrary points."
+(2012, 8, 1, 1, 22, 54) function-extrapolation-python 6.78113 "BENCH:  1.93070411682"
+(2012, 8, 1, 1, 22, 54) function-extrapolation-python 1.9307 "BENCH:  1.93070411682"
+(2012, 8, 1, 1, 23, 19) la-vector-access-cpp 25.4321 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 1, 1, 23, 47) la-vector-assignment-cpp 27.9015 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 4, 1, 11, 8) common-progress-cpp 29.5677 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 4, 1, 11, 39) common-timing-cpp 30.7567 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 4, 1, 11, 49) fem-multicore-cpp 10.0697 "Coloring mesh."
+(2012, 8, 4, 1, 15, 3) fem-assembly-cpp 194.446 "Assembly for various forms and backends"
+(2012, 8, 4, 1, 15, 15) fem-convergence-cpp 11.6303 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 4, 1, 15, 16) fem-jit-python 0.0004107 "JIT compilation (in memory cache)"
+(2012, 8, 4, 1, 20, 26) fem-speedup-cpp 310.251 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 4, 1, 20, 26) fem-speedup-cpp-assembly 5.47256 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 4, 1, 20, 26) fem-speedup-cpp-solve 2.01621 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 4, 1, 20, 50) mesh-refinement-cpp 22.653 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 4, 1, 21, 11) mesh-topology-cpp 20.7198 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 4, 1, 21, 34) mesh-unitcube-cpp 22.6232 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 4, 1, 22, 17) mesh-iteration-cpp 40.3965 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 4, 1, 22, 38) function-evaluation-cpp 21.2694 "Evaluations of functions at arbitrary points."
+(2012, 8, 4, 1, 22, 38) function-evaluation-cpp 21.1881 "Evaluations of functions at arbitrary points."
+(2012, 8, 4, 1, 22, 45) function-extrapolation-python 6.82189 "BENCH:  1.91672205925"
+(2012, 8, 4, 1, 22, 45) function-extrapolation-python 1.91672 "BENCH:  1.91672205925"
+(2012, 8, 4, 1, 23, 11) la-vector-access-cpp 25.5452 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 4, 1, 23, 39) la-vector-assignment-cpp 27.9509 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 5, 1, 11, 18) common-progress-cpp 29.6033 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 5, 1, 11, 48) common-timing-cpp 30.2034 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 5, 1, 11, 58) fem-multicore-cpp 9.93131 "Coloring mesh."
+(2012, 8, 5, 1, 15, 12) fem-assembly-cpp 193.977 "Assembly for various forms and backends"
+(2012, 8, 5, 1, 15, 24) fem-convergence-cpp 11.9058 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 5, 1, 15, 25) fem-jit-python 0.000437999 "JIT compilation (in memory cache)"
+(2012, 8, 5, 1, 20, 36) fem-speedup-cpp 311.152 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 5, 1, 20, 36) fem-speedup-cpp-assembly 5.60511 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 5, 1, 20, 36) fem-speedup-cpp-solve 2.02208 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 5, 1, 21, 1) mesh-refinement-cpp 22.6587 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 5, 1, 21, 22) mesh-topology-cpp 20.7138 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 5, 1, 21, 44) mesh-unitcube-cpp 22.6397 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 5, 1, 22, 27) mesh-iteration-cpp 40.3847 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 5, 1, 22, 48) function-evaluation-cpp 21.3067 "Evaluations of functions at arbitrary points."
+(2012, 8, 5, 1, 22, 48) function-evaluation-cpp 21.2124 "Evaluations of functions at arbitrary points."
+(2012, 8, 5, 1, 22, 55) function-extrapolation-python 6.80332 "BENCH:  1.91370081902"
+(2012, 8, 5, 1, 22, 55) function-extrapolation-python 1.9137 "BENCH:  1.91370081902"
+(2012, 8, 5, 1, 23, 21) la-vector-access-cpp 25.4307 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 5, 1, 23, 49) la-vector-assignment-cpp 27.9586 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 6, 1, 11, 17) common-progress-cpp 29.5685 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 6, 1, 11, 47) common-timing-cpp 29.9062 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 6, 1, 11, 57) fem-multicore-cpp 9.99407 "Coloring mesh."
+(2012, 8, 6, 1, 15, 10) fem-assembly-cpp 193.681 "Assembly for various forms and backends"
+(2012, 8, 6, 1, 15, 22) fem-convergence-cpp 11.9636 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 6, 1, 15, 24) fem-jit-python 0.000430202 "JIT compilation (in memory cache)"
+(2012, 8, 6, 1, 20, 34) fem-speedup-cpp 310.882 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 6, 1, 20, 34) fem-speedup-cpp-assembly 5.53369 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 6, 1, 20, 34) fem-speedup-cpp-solve 2.02864 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 6, 1, 20, 59) mesh-refinement-cpp 22.7181 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 6, 1, 21, 20) mesh-topology-cpp 20.722 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 6, 1, 21, 42) mesh-unitcube-cpp 22.6194 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 6, 1, 22, 25) mesh-iteration-cpp 40.3834 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 6, 1, 22, 46) function-evaluation-cpp 21.0041 "Evaluations of functions at arbitrary points."
+(2012, 8, 6, 1, 22, 46) function-evaluation-cpp 20.9226 "Evaluations of functions at arbitrary points."
+(2012, 8, 6, 1, 22, 53) function-extrapolation-python 6.84373 "BENCH:  1.9204390049"
+(2012, 8, 6, 1, 22, 53) function-extrapolation-python 1.92044 "BENCH:  1.9204390049"
+(2012, 8, 6, 1, 23, 20) la-vector-access-cpp 27.4338 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 6, 1, 23, 48) la-vector-assignment-cpp 27.9573 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 7, 1, 11, 34) common-progress-cpp 29.6532 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 7, 1, 12, 4) common-timing-cpp 30.5249 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 7, 1, 12, 14) fem-multicore-cpp 10.0167 "Coloring mesh."
+(2012, 8, 7, 1, 15, 29) fem-assembly-cpp 194.051 "Assembly for various forms and backends"
+(2012, 8, 7, 1, 15, 40) fem-convergence-cpp 11.9458 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 7, 1, 15, 42) fem-jit-python 0.000429392 "JIT compilation (in memory cache)"
+(2012, 8, 7, 1, 20, 51) fem-speedup-cpp 309.81 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 7, 1, 20, 51) fem-speedup-cpp-assembly 5.52202 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 7, 1, 20, 51) fem-speedup-cpp-solve 2.03811 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 7, 1, 21, 16) mesh-refinement-cpp 22.5951 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 7, 1, 21, 36) mesh-topology-cpp 20.7318 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 7, 1, 21, 59) mesh-unitcube-cpp 22.6861 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 7, 1, 22, 42) mesh-iteration-cpp 40.3973 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 7, 1, 23, 3) function-evaluation-cpp 20.9564 "Evaluations of functions at arbitrary points."
+(2012, 8, 7, 1, 23, 3) function-evaluation-cpp 20.8654 "Evaluations of functions at arbitrary points."
+(2012, 8, 7, 1, 23, 10) function-extrapolation-python 6.78835 "BENCH:  1.91855502129"
+(2012, 8, 7, 1, 23, 10) function-extrapolation-python 1.91856 "BENCH:  1.91855502129"
+(2012, 8, 7, 1, 23, 38) la-vector-access-cpp 28.4729 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 7, 1, 24, 6) la-vector-assignment-cpp 27.9488 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 8, 1, 11, 18) common-progress-cpp 29.6504 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 8, 1, 11, 48) common-timing-cpp 29.8586 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 8, 1, 11, 58) fem-multicore-cpp 9.92846 "Coloring mesh."
+(2012, 8, 8, 1, 15, 12) fem-assembly-cpp 194.148 "Assembly for various forms and backends"
+(2012, 8, 8, 1, 15, 24) fem-convergence-cpp 11.9317 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 8, 1, 15, 25) fem-jit-python 0.000427699 "JIT compilation (in memory cache)"
+(2012, 8, 8, 1, 20, 36) fem-speedup-cpp 311.619 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 8, 1, 20, 36) fem-speedup-cpp-assembly 5.56895 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 8, 1, 20, 36) fem-speedup-cpp-solve 2.01393 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 8, 1, 21, 1) mesh-refinement-cpp 22.6399 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 8, 1, 21, 22) mesh-topology-cpp 20.7521 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 8, 1, 21, 44) mesh-unitcube-cpp 22.5742 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 8, 1, 22, 27) mesh-iteration-cpp 40.3871 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 8, 1, 22, 48) function-evaluation-cpp 21.1572 "Evaluations of functions at arbitrary points."
+(2012, 8, 8, 1, 22, 48) function-evaluation-cpp 21.0703 "Evaluations of functions at arbitrary points."
+(2012, 8, 8, 1, 22, 55) function-extrapolation-python 6.75318 "BENCH:  1.91586899757"
+(2012, 8, 8, 1, 22, 55) function-extrapolation-python 1.91587 "BENCH:  1.91586899757"
+(2012, 8, 8, 1, 23, 23) la-vector-access-cpp 27.4304 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 8, 1, 23, 51) la-vector-assignment-cpp 28.0375 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 9, 1, 11, 32) common-progress-cpp 29.1688 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 9, 1, 12, 1) common-timing-cpp 29.1207 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 9, 1, 12, 11) fem-multicore-cpp 10.0195 "Coloring mesh."
+(2012, 8, 9, 1, 15, 24) fem-assembly-cpp 192.693 "Assembly for various forms and backends"
+(2012, 8, 9, 1, 15, 36) fem-convergence-cpp 11.9155 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 9, 1, 15, 37) fem-jit-python 0.000408816 "JIT compilation (in memory cache)"
+(2012, 8, 9, 1, 20, 47) fem-speedup-cpp 310.15 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 9, 1, 20, 47) fem-speedup-cpp-assembly 5.67568 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 9, 1, 20, 47) fem-speedup-cpp-solve 2.03949 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 9, 1, 21, 11) mesh-refinement-cpp 22.3792 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 9, 1, 21, 32) mesh-topology-cpp 20.7918 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 9, 1, 21, 54) mesh-unitcube-cpp 21.6439 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 9, 1, 22, 36) mesh-iteration-cpp 40.4397 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 9, 1, 22, 58) function-evaluation-cpp 21.4014 "Evaluations of functions at arbitrary points."
+(2012, 8, 9, 1, 22, 58) function-evaluation-cpp 21.3149 "Evaluations of functions at arbitrary points."
+(2012, 8, 9, 1, 23, 5) function-extrapolation-python 6.76052 "BENCH:  1.9006588459"
+(2012, 8, 9, 1, 23, 5) function-extrapolation-python 1.90066 "BENCH:  1.9006588459"
+(2012, 8, 9, 1, 23, 29) la-vector-access-cpp 23.8692 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 9, 1, 23, 54) la-vector-assignment-cpp 24.9677 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 10, 1, 11, 18) common-progress-cpp 29.5915 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 10, 1, 11, 45) common-timing-cpp 27.8588 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 10, 1, 11, 55) fem-multicore-cpp 9.97277 "Coloring mesh."
+(2012, 8, 10, 1, 15, 9) fem-assembly-cpp 193.462 "Assembly for various forms and backends"
+(2012, 8, 10, 1, 15, 21) fem-convergence-cpp 11.9182 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 10, 1, 15, 22) fem-jit-python 0.000425386 "JIT compilation (in memory cache)"
+(2012, 8, 10, 1, 20, 33) fem-speedup-cpp 311.223 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 10, 1, 20, 33) fem-speedup-cpp-assembly 5.55217 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 10, 1, 20, 33) fem-speedup-cpp-solve 2.00544 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 10, 1, 20, 57) mesh-refinement-cpp 22.3538 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 10, 1, 21, 18) mesh-topology-cpp 20.7157 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 10, 1, 21, 40) mesh-unitcube-cpp 21.6796 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 10, 1, 22, 22) mesh-iteration-cpp 40.4225 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 10, 1, 22, 44) function-evaluation-cpp 21.3058 "Evaluations of functions at arbitrary points."
+(2012, 8, 10, 1, 22, 44) function-evaluation-cpp 21.2198 "Evaluations of functions at arbitrary points."
+(2012, 8, 10, 1, 22, 51) function-extrapolation-python 6.70799 "BENCH:  1.86585593224"
+(2012, 8, 10, 1, 22, 51) function-extrapolation-python 1.86586 "BENCH:  1.86585593224"
+(2012, 8, 10, 1, 23, 15) la-vector-access-cpp 24.0826 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 10, 1, 23, 43) la-vector-assignment-cpp 27.9036 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 11, 1, 11, 37) common-progress-cpp 29.6069 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 11, 1, 12, 7) common-timing-cpp 29.5002 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 11, 1, 12, 17) fem-multicore-cpp 9.94934 "Coloring mesh."
+(2012, 8, 11, 1, 15, 29) fem-assembly-cpp 192.373 "Assembly for various forms and backends"
+(2012, 8, 11, 1, 15, 41) fem-convergence-cpp 11.8973 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 11, 1, 15, 42) fem-jit-python 0.000414801 "JIT compilation (in memory cache)"
+(2012, 8, 11, 1, 20, 54) fem-speedup-cpp 311.356 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 11, 1, 20, 54) fem-speedup-cpp-assembly 5.59887 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 11, 1, 20, 54) fem-speedup-cpp-solve 2.00801 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 11, 1, 21, 17) mesh-refinement-cpp 22.2398 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 11, 1, 21, 38) mesh-topology-cpp 20.7689 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 11, 1, 22, 0) mesh-unitcube-cpp 21.4631 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 11, 1, 22, 43) mesh-iteration-cpp 40.371 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 11, 1, 23, 4) function-evaluation-cpp 21.3375 "Evaluations of functions at arbitrary points."
+(2012, 8, 11, 1, 23, 4) function-evaluation-cpp 21.2513 "Evaluations of functions at arbitrary points."
+(2012, 8, 11, 1, 23, 11) function-extrapolation-python 6.60068 "BENCH:  1.86741900444"
+(2012, 8, 11, 1, 23, 11) function-extrapolation-python 1.86742 "BENCH:  1.86741900444"
+(2012, 8, 11, 1, 23, 33) la-vector-access-cpp 22.4522 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 11, 1, 23, 58) la-vector-assignment-cpp 24.9455 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 12, 1, 11, 24) common-progress-cpp 36.4359 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 12, 1, 11, 53) common-timing-cpp 29.4811 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 12, 1, 12, 3) fem-multicore-cpp 10.004 "Coloring mesh."
+(2012, 8, 12, 1, 15, 16) fem-assembly-cpp 192.329 "Assembly for various forms and backends"
+(2012, 8, 12, 1, 15, 28) fem-convergence-cpp 11.9107 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 12, 1, 15, 29) fem-jit-python 0.000414395 "JIT compilation (in memory cache)"
+(2012, 8, 12, 1, 20, 39) fem-speedup-cpp 310.181 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 12, 1, 20, 39) fem-speedup-cpp-assembly 5.57826 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 12, 1, 20, 39) fem-speedup-cpp-solve 2.04047 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 12, 1, 21, 3) mesh-refinement-cpp 22.2584 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 12, 1, 21, 24) mesh-topology-cpp 20.7387 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 12, 1, 21, 45) mesh-unitcube-cpp 21.4504 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 12, 1, 22, 28) mesh-iteration-cpp 40.3731 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 12, 1, 22, 49) function-evaluation-cpp 21.3378 "Evaluations of functions at arbitrary points."
+(2012, 8, 12, 1, 22, 49) function-evaluation-cpp 21.2573 "Evaluations of functions at arbitrary points."
+(2012, 8, 12, 1, 22, 56) function-extrapolation-python 6.74439 "BENCH:  1.90518307686"
+(2012, 8, 12, 1, 22, 56) function-extrapolation-python 1.90518 "BENCH:  1.90518307686"
+(2012, 8, 12, 1, 23, 21) la-vector-access-cpp 25.4743 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 12, 1, 23, 46) la-vector-assignment-cpp 24.9611 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 13, 1, 11, 21) common-progress-cpp 29.6003 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 13, 1, 11, 50) common-timing-cpp 29.0404 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 13, 1, 12, 0) fem-multicore-cpp 9.9726 "Coloring mesh."
+(2012, 8, 13, 1, 15, 13) fem-assembly-cpp 192.972 "Assembly for various forms and backends"
+(2012, 8, 13, 1, 15, 25) fem-convergence-cpp 11.92 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 13, 1, 15, 26) fem-jit-python 0.000420594 "JIT compilation (in memory cache)"
+(2012, 8, 13, 1, 20, 36) fem-speedup-cpp 309.958 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 13, 1, 20, 36) fem-speedup-cpp-assembly 5.61779 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 13, 1, 20, 36) fem-speedup-cpp-solve 2.0242 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 13, 1, 21, 0) mesh-refinement-cpp 22.2323 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 13, 1, 21, 21) mesh-topology-cpp 20.7578 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 13, 1, 21, 43) mesh-unitcube-cpp 21.5205 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 13, 1, 22, 34) mesh-iteration-cpp 48.5982 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 13, 1, 22, 55) function-evaluation-cpp 21.3066 "Evaluations of functions at arbitrary points."
+(2012, 8, 13, 1, 22, 55) function-evaluation-cpp 21.2036 "Evaluations of functions at arbitrary points."
+(2012, 8, 13, 1, 23, 2) function-extrapolation-python 6.74164 "BENCH:  1.91136407852"
+(2012, 8, 13, 1, 23, 2) function-extrapolation-python 1.91136 "BENCH:  1.91136407852"
+(2012, 8, 13, 1, 23, 24) la-vector-access-cpp 22.4569 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 13, 1, 23, 52) la-vector-assignment-cpp 27.8951 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 14, 1, 11, 22) common-progress-cpp 29.8172 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 14, 1, 11, 51) common-timing-cpp 29.0471 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 14, 1, 12, 1) fem-multicore-cpp 10.0125 "Coloring mesh."
+(2012, 8, 14, 1, 15, 13) fem-assembly-cpp 192.687 "Assembly for various forms and backends"
+(2012, 8, 14, 1, 15, 25) fem-convergence-cpp 11.8924 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 14, 1, 15, 26) fem-jit-python 0.000396609 "JIT compilation (in memory cache)"
+(2012, 8, 14, 1, 20, 35) fem-speedup-cpp 308.327 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 14, 1, 20, 35) fem-speedup-cpp-assembly 5.6104 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 14, 1, 20, 35) fem-speedup-cpp-solve 2.04878 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 14, 1, 20, 59) mesh-refinement-cpp 22.2217 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 14, 1, 21, 19) mesh-topology-cpp 20.5416 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 14, 1, 21, 41) mesh-unitcube-cpp 21.506 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 14, 1, 22, 26) mesh-iteration-cpp 42.5484 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 14, 1, 22, 47) function-evaluation-cpp 21.3132 "Evaluations of functions at arbitrary points."
+(2012, 8, 14, 1, 22, 47) function-evaluation-cpp 21.2102 "Evaluations of functions at arbitrary points."
+(2012, 8, 14, 1, 23, 2) function-extrapolation-python 15.1869 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2012, 8, 14, 1, 23, 2) function-extrapolation-python 1.92276 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2012, 8, 14, 1, 23, 25) la-vector-access-cpp 22.4531 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 14, 1, 23, 50) la-vector-assignment-cpp 24.8936 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 15, 1, 11, 11) common-progress-cpp 29.8187 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 15, 1, 11, 39) common-timing-cpp 27.9404 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 15, 1, 11, 49) fem-multicore-cpp 9.91794 "Coloring mesh."
+(2012, 8, 15, 1, 15, 1) fem-assembly-cpp 192.054 "Assembly for various forms and backends"
+(2012, 8, 15, 1, 15, 13) fem-convergence-cpp 11.9179 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 15, 1, 15, 14) fem-jit-python 0.000404501 "JIT compilation (in memory cache)"
+(2012, 8, 15, 1, 20, 35) fem-speedup-cpp 320.661 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 15, 1, 20, 35) fem-speedup-cpp-assembly 5.64051 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 15, 1, 20, 35) fem-speedup-cpp-solve 1.80935 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 15, 1, 20, 59) mesh-refinement-cpp 22.2428 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 15, 1, 21, 20) mesh-topology-cpp 20.637 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 15, 1, 21, 41) mesh-unitcube-cpp 21.498 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 15, 1, 22, 30) mesh-iteration-cpp 46.0084 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 15, 1, 22, 51) function-evaluation-cpp 21.4559 "Evaluations of functions at arbitrary points."
+(2012, 8, 15, 1, 22, 51) function-evaluation-cpp 21.3534 "Evaluations of functions at arbitrary points."
+(2012, 8, 15, 1, 22, 58) function-extrapolation-python 6.69634 "BENCH:  1.90821099281"
+(2012, 8, 15, 1, 22, 58) function-extrapolation-python 1.90821 "BENCH:  1.90821099281"
+(2012, 8, 15, 1, 23, 20) la-vector-access-cpp 22.4478 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 15, 1, 23, 48) la-vector-assignment-cpp 27.9062 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 16, 1, 11, 13) common-progress-cpp 29.5439 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 16, 1, 11, 43) common-timing-cpp 29.4157 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 16, 1, 11, 52) fem-multicore-cpp 9.91404 "Coloring mesh."
+(2012, 8, 16, 1, 15, 5) fem-assembly-cpp 192.963 "Assembly for various forms and backends"
+(2012, 8, 16, 1, 15, 17) fem-convergence-cpp 11.895 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 16, 1, 15, 18) fem-jit-python 0.0004107 "JIT compilation (in memory cache)"
+(2012, 8, 16, 1, 20, 38) fem-speedup-cpp 319.618 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 16, 1, 20, 38) fem-speedup-cpp-assembly 5.57104 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 16, 1, 20, 38) fem-speedup-cpp-solve 1.839 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 16, 1, 21, 2) mesh-refinement-cpp 22.1943 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 16, 1, 21, 23) mesh-topology-cpp 20.5452 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 16, 1, 21, 44) mesh-unitcube-cpp 20.9311 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 16, 1, 22, 26) mesh-iteration-cpp 40.3767 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 16, 1, 22, 48) function-evaluation-cpp 21.3144 "Evaluations of functions at arbitrary points."
+(2012, 8, 16, 1, 22, 48) function-evaluation-cpp 21.2126 "Evaluations of functions at arbitrary points."
+(2012, 8, 16, 1, 22, 54) function-extrapolation-python 6.81123 "BENCH:  1.90908384323"
+(2012, 8, 16, 1, 22, 54) function-extrapolation-python 1.90908 "BENCH:  1.90908384323"
+(2012, 8, 16, 1, 23, 17) la-vector-access-cpp 22.4566 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 16, 1, 23, 42) la-vector-assignment-cpp 24.9612 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 17, 1, 11, 16) common-progress-cpp 29.6005 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 17, 1, 11, 45) common-timing-cpp 29.2083 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 17, 1, 11, 55) fem-multicore-cpp 10.0308 "Coloring mesh."
+(2012, 8, 17, 1, 15, 7) fem-assembly-cpp 191.725 "Assembly for various forms and backends"
+(2012, 8, 17, 1, 15, 19) fem-convergence-cpp 11.8967 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 17, 1, 15, 20) fem-jit-python 0.000408387 "JIT compilation (in memory cache)"
+(2012, 8, 17, 1, 20, 39) fem-speedup-cpp 319.603 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 17, 1, 20, 39) fem-speedup-cpp-assembly 5.57295 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 17, 1, 20, 39) fem-speedup-cpp-solve 1.83149 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 17, 1, 21, 3) mesh-refinement-cpp 22.1609 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 17, 1, 21, 24) mesh-topology-cpp 20.6038 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 17, 1, 21, 45) mesh-unitcube-cpp 20.8285 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 17, 1, 22, 31) mesh-iteration-cpp 43.4951 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 17, 1, 22, 52) function-evaluation-cpp 21.3142 "Evaluations of functions at arbitrary points."
+(2012, 8, 17, 1, 22, 52) function-evaluation-cpp 21.2279 "Evaluations of functions at arbitrary points."
+(2012, 8, 17, 1, 22, 59) function-extrapolation-python 6.89417 "BENCH:  1.92462897301"
+(2012, 8, 17, 1, 22, 59) function-extrapolation-python 1.92463 "BENCH:  1.92462897301"
+(2012, 8, 17, 1, 23, 24) la-vector-access-cpp 25.4594 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 17, 1, 23, 49) la-vector-assignment-cpp 24.9556 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 24, 1, 11, 1) common-progress-cpp 29.8743 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 24, 1, 11, 30) common-timing-cpp 28.658 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 24, 4, 6, 34) fem-multicore-cpp 10504.5 "Coloring mesh."
+(2012, 8, 24, 4, 9, 48) fem-assembly-cpp 193.646 "Assembly for various forms and backends"
+(2012, 8, 24, 4, 10, 0) fem-convergence-cpp 11.7719 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 24, 4, 10, 5) fem-jit-python 0.000407386 "JIT compilation (in memory cache)"
+(2012, 8, 24, 4, 15, 23) fem-speedup-cpp 317.976 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 24, 4, 15, 23) fem-speedup-cpp-assembly 5.44423 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 24, 4, 15, 23) fem-speedup-cpp-solve 1.91317 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 24, 4, 15, 47) mesh-refinement-cpp 22.2461 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 24, 4, 16, 8) mesh-topology-cpp 20.7809 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 24, 4, 16, 29) mesh-unitcube-cpp 21.0413 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 24, 4, 17, 12) mesh-iteration-cpp 41.641 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 24, 4, 17, 34) function-evaluation-cpp 21.5348 "Evaluations of functions at arbitrary points."
+(2012, 8, 24, 4, 17, 34) function-evaluation-cpp 21.4538 "Evaluations of functions at arbitrary points."
+(2012, 8, 24, 4, 17, 40) function-extrapolation-python 6.50722 "BENCH:  1.90129494667"
+(2012, 8, 24, 4, 17, 40) function-extrapolation-python 1.90129 "BENCH:  1.90129494667"
+(2012, 8, 24, 4, 18, 4) la-vector-access-cpp 23.8915 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 24, 4, 18, 32) la-vector-assignment-cpp 27.9114 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 25, 1, 11, 21) common-progress-cpp 29.5834 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 25, 1, 11, 50) common-timing-cpp 29.3365 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 25, 3, 58, 20) fem-multicore-cpp 9989.49 "Coloring mesh."
+(2012, 8, 25, 4, 1, 36) fem-assembly-cpp 195.508 "Assembly for various forms and backends"
+(2012, 8, 25, 4, 1, 48) fem-convergence-cpp 11.8139 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 25, 4, 1, 53) fem-jit-python 0.000408888 "JIT compilation (in memory cache)"
+(2012, 8, 25, 4, 7, 9) fem-speedup-cpp 316.274 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 25, 4, 7, 9) fem-speedup-cpp-assembly 5.47493 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 25, 4, 7, 9) fem-speedup-cpp-solve 1.91709 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 25, 4, 7, 33) mesh-refinement-cpp 22.4666 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 25, 4, 7, 54) mesh-topology-cpp 20.9077 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 25, 4, 8, 15) mesh-unitcube-cpp 21.3295 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 25, 4, 8, 58) mesh-iteration-cpp 40.5254 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 25, 4, 9, 20) function-evaluation-cpp 21.1887 "Evaluations of functions at arbitrary points."
+(2012, 8, 25, 4, 9, 20) function-evaluation-cpp 21.1076 "Evaluations of functions at arbitrary points."
+(2012, 8, 25, 4, 9, 26) function-extrapolation-python 6.45974 "BENCH:  1.93025588989"
+(2012, 8, 25, 4, 9, 26) function-extrapolation-python 1.93026 "BENCH:  1.93025588989"
+(2012, 8, 25, 4, 9, 49) la-vector-access-cpp 22.4612 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 25, 4, 10, 17) la-vector-assignment-cpp 27.9046 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 26, 1, 10, 58) common-progress-cpp 29.578 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 26, 1, 11, 26) common-timing-cpp 28.554 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 26, 4, 29, 28) fem-multicore-cpp 11882.1 "Coloring mesh."
+(2012, 8, 26, 4, 32, 43) fem-assembly-cpp 195.024 "Assembly for various forms and backends"
+(2012, 8, 26, 4, 32, 55) fem-convergence-cpp 11.769 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 26, 4, 33, 0) fem-jit-python 0.000400996 "JIT compilation (in memory cache)"
+(2012, 8, 26, 4, 38, 28) fem-speedup-cpp 328.448 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 26, 4, 38, 28) fem-speedup-cpp-assembly 5.46016 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 26, 4, 38, 28) fem-speedup-cpp-solve 1.67566 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 26, 4, 38, 52) mesh-refinement-cpp 22.4752 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 26, 4, 39, 13) mesh-topology-cpp 20.8396 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 26, 4, 39, 35) mesh-unitcube-cpp 21.3037 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 26, 4, 40, 17) mesh-iteration-cpp 40.3935 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 26, 4, 40, 39) function-evaluation-cpp 21.3049 "Evaluations of functions at arbitrary points."
+(2012, 8, 26, 4, 40, 39) function-evaluation-cpp 21.2185 "Evaluations of functions at arbitrary points."
+(2012, 8, 26, 4, 40, 45) function-extrapolation-python 6.57617 "BENCH:  1.90819191933"
+(2012, 8, 26, 4, 40, 45) function-extrapolation-python 1.90819 "BENCH:  1.90819191933"
+(2012, 8, 26, 4, 41, 9) la-vector-access-cpp 23.8171 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 26, 4, 41, 34) la-vector-assignment-cpp 24.9598 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 27, 1, 11, 22) common-progress-cpp 29.5425 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 27, 1, 11, 51) common-timing-cpp 28.8016 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 27, 4, 15, 43) fem-multicore-cpp 11032.2 "Coloring mesh."
+(2012, 8, 27, 4, 18, 59) fem-assembly-cpp 195.105 "Assembly for various forms and backends"
+(2012, 8, 27, 4, 19, 10) fem-convergence-cpp 11.7484 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 27, 4, 19, 15) fem-jit-python 0.000409412 "JIT compilation (in memory cache)"
+(2012, 8, 27, 4, 24, 31) fem-speedup-cpp 315.887 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 27, 4, 24, 31) fem-speedup-cpp-assembly 5.48086 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 27, 4, 24, 31) fem-speedup-cpp-solve 1.91503 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 27, 4, 24, 55) mesh-refinement-cpp 22.1121 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 27, 4, 25, 16) mesh-topology-cpp 20.5943 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 27, 4, 25, 38) mesh-unitcube-cpp 21.4914 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 27, 4, 26, 20) mesh-iteration-cpp 40.3717 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 27, 4, 26, 42) function-evaluation-cpp 21.4769 "Evaluations of functions at arbitrary points."
+(2012, 8, 27, 4, 26, 42) function-evaluation-cpp 21.3843 "Evaluations of functions at arbitrary points."
+(2012, 8, 27, 4, 26, 48) function-extrapolation-python 5.95758 "BENCH:  1.89759898186"
+(2012, 8, 27, 4, 26, 48) function-extrapolation-python 1.8976 "BENCH:  1.89759898186"
+(2012, 8, 27, 4, 27, 11) la-vector-access-cpp 23.7317 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 27, 4, 27, 36) la-vector-assignment-cpp 24.9449 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 28, 1, 11, 2) common-progress-cpp 29.1471 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 28, 1, 11, 32) common-timing-cpp 29.5819 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 28, 4, 34, 44) fem-multicore-cpp 12192.2 "Coloring mesh."
+(2012, 8, 28, 4, 37, 58) fem-assembly-cpp 193.658 "Assembly for various forms and backends"
+(2012, 8, 28, 4, 38, 9) fem-convergence-cpp 11.7615 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 28, 4, 38, 14) fem-jit-python 0.000422001 "JIT compilation (in memory cache)"
+(2012, 8, 28, 4, 43, 31) fem-speedup-cpp 316.501 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 28, 4, 43, 31) fem-speedup-cpp-assembly 5.5541 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 28, 4, 43, 31) fem-speedup-cpp-solve 1.90491 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 28, 4, 43, 54) mesh-refinement-cpp 22.0557 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 28, 4, 44, 15) mesh-topology-cpp 20.5836 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 28, 4, 44, 37) mesh-unitcube-cpp 21.3962 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 28, 4, 45, 20) mesh-iteration-cpp 40.4135 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 28, 4, 45, 41) function-evaluation-cpp 21.6928 "Evaluations of functions at arbitrary points."
+(2012, 8, 28, 4, 45, 41) function-evaluation-cpp 21.5991 "Evaluations of functions at arbitrary points."
+(2012, 8, 28, 4, 45, 52) function-extrapolation-python 11.0376 "BENCH:  2.02043700218"
+(2012, 8, 28, 4, 45, 52) function-extrapolation-python 2.02044 "BENCH:  2.02043700218"
+(2012, 8, 28, 4, 46, 16) la-vector-access-cpp 23.7492 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 28, 4, 46, 41) la-vector-assignment-cpp 24.9605 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 29, 1, 10, 56) common-progress-cpp 29.5577 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 29, 1, 11, 25) common-timing-cpp 28.878 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 29, 4, 9, 22) fem-multicore-cpp 10676.2 "Coloring mesh."
+(2012, 8, 29, 4, 12, 36) fem-assembly-cpp 193.966 "Assembly for various forms and backends"
+(2012, 8, 29, 4, 12, 48) fem-convergence-cpp 11.7888 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 29, 4, 12, 53) fem-jit-python 0.000405383 "JIT compilation (in memory cache)"
+(2012, 8, 29, 4, 18, 9) fem-speedup-cpp 316.449 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 29, 4, 18, 9) fem-speedup-cpp-assembly 5.53233 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 29, 4, 18, 9) fem-speedup-cpp-solve 1.93681 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 29, 4, 18, 33) mesh-refinement-cpp 22.1238 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 29, 4, 18, 53) mesh-topology-cpp 20.5463 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 29, 4, 19, 15) mesh-unitcube-cpp 21.4682 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 29, 4, 19, 58) mesh-iteration-cpp 40.3799 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 29, 4, 20, 19) function-evaluation-cpp 21.3564 "Evaluations of functions at arbitrary points."
+(2012, 8, 29, 4, 20, 19) function-evaluation-cpp 21.2693 "Evaluations of functions at arbitrary points."
+(2012, 8, 29, 4, 20, 26) function-extrapolation-python 6.59316 "BENCH:  1.92814803123"
+(2012, 8, 29, 4, 20, 26) function-extrapolation-python 1.92815 "BENCH:  1.92814803123"
+(2012, 8, 29, 4, 20, 48) la-vector-access-cpp 22.453 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 29, 4, 21, 13) la-vector-assignment-cpp 24.9591 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 30, 1, 11, 25) common-progress-cpp 29.6086 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 30, 1, 11, 55) common-timing-cpp 30.4986 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 30, 19, 31, 31) fem-multicore-cpp 65975.9 "Coloring mesh."
+(2012, 8, 30, 19, 37, 30) fem-assembly-cpp 358.629 "Assembly for various forms and backends"
+(2012, 8, 30, 19, 37, 43) fem-convergence-cpp 13.3816 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 30, 19, 37, 47) fem-jit-python 0.000408697 "JIT compilation (in memory cache)"
+(2012, 8, 30, 19, 42, 52) fem-speedup-cpp 305.02 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 30, 19, 42, 52) fem-speedup-cpp-assembly 5.77223 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 30, 19, 42, 52) fem-speedup-cpp-solve 1.655 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 30, 19, 43, 15) mesh-refinement-cpp 22.0642 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 30, 19, 43, 36) mesh-topology-cpp 20.6893 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 30, 19, 43, 57) mesh-unitcube-cpp 20.6617 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 30, 19, 44, 40) mesh-iteration-cpp 40.3913 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 30, 19, 45, 2) function-evaluation-cpp 21.8022 "Evaluations of functions at arbitrary points."
+(2012, 8, 30, 19, 45, 2) function-evaluation-cpp 21.7156 "Evaluations of functions at arbitrary points."
+(2012, 8, 30, 19, 45, 9) function-extrapolation-python 7.47366 "BENCH:  1.97645187378"
+(2012, 8, 30, 19, 45, 9) function-extrapolation-python 1.97645 "BENCH:  1.97645187378"
+(2012, 8, 30, 19, 45, 32) la-vector-access-cpp 22.4584 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 30, 19, 46, 0) la-vector-assignment-cpp 27.9069 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 8, 31, 1, 11, 19) common-progress-cpp 30.0397 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 8, 31, 1, 11, 49) common-timing-cpp 30.3872 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 8, 31, 19, 34, 39) fem-multicore-cpp 66170.3 "Coloring mesh."
+(2012, 8, 31, 19, 40, 32) fem-assembly-cpp 352.912 "Assembly for various forms and backends"
+(2012, 8, 31, 19, 40, 45) fem-convergence-cpp 13.1759 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 8, 31, 19, 40, 49) fem-jit-python 0.000409317 "JIT compilation (in memory cache)"
+(2012, 8, 31, 19, 45, 56) fem-speedup-cpp 306.6 "Assembly/solve speedup running on 4 processors"
+(2012, 8, 31, 19, 45, 56) fem-speedup-cpp-assembly 5.89598 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 8, 31, 19, 45, 56) fem-speedup-cpp-solve 1.62596 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 8, 31, 19, 46, 19) mesh-refinement-cpp 22.1125 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 8, 31, 19, 46, 40) mesh-topology-cpp 20.6376 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 8, 31, 19, 47, 1) mesh-unitcube-cpp 20.6487 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 8, 31, 19, 47, 43) mesh-iteration-cpp 40.3864 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 8, 31, 19, 48, 5) function-evaluation-cpp 21.5704 "Evaluations of functions at arbitrary points."
+(2012, 8, 31, 19, 48, 5) function-evaluation-cpp 21.4837 "Evaluations of functions at arbitrary points."
+(2012, 8, 31, 19, 48, 12) function-extrapolation-python 7.25649 "BENCH:  1.97002291679"
+(2012, 8, 31, 19, 48, 12) function-extrapolation-python 1.97002 "BENCH:  1.97002291679"
+(2012, 8, 31, 19, 48, 36) la-vector-access-cpp 23.3603 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 8, 31, 19, 49, 1) la-vector-assignment-cpp 24.956 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 1, 1, 11, 40) common-progress-cpp 36.435 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 1, 1, 12, 11) common-timing-cpp 30.6524 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 1, 19, 20, 50) fem-multicore-cpp 65318.7 "Coloring mesh."
+(2012, 9, 1, 19, 26, 41) fem-assembly-cpp 350.995 "Assembly for various forms and backends"
+(2012, 9, 1, 19, 26, 54) fem-convergence-cpp 13.2139 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 1, 19, 26, 58) fem-jit-python 0.000410318 "JIT compilation (in memory cache)"
+(2012, 9, 1, 19, 32, 6) fem-speedup-cpp 308.201 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 1, 19, 32, 6) fem-speedup-cpp-assembly 5.8024 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 1, 19, 32, 6) fem-speedup-cpp-solve 1.61389 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 1, 19, 32, 30) mesh-refinement-cpp 22.1571 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 1, 19, 32, 50) mesh-topology-cpp 20.6384 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 1, 19, 33, 11) mesh-unitcube-cpp 20.6526 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 1, 19, 33, 54) mesh-iteration-cpp 40.3768 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 1, 19, 34, 16) function-evaluation-cpp 21.926 "Evaluations of functions at arbitrary points."
+(2012, 9, 1, 19, 34, 16) function-evaluation-cpp 21.8449 "Evaluations of functions at arbitrary points."
+(2012, 9, 1, 19, 34, 23) function-extrapolation-python 7.32387 "BENCH:  1.97256088257"
+(2012, 9, 1, 19, 34, 23) function-extrapolation-python 1.97256 "BENCH:  1.97256088257"
+(2012, 9, 1, 19, 34, 46) la-vector-access-cpp 22.4532 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 1, 19, 35, 11) la-vector-assignment-cpp 24.9643 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 2, 1, 11, 25) common-progress-cpp 37.6895 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 2, 1, 11, 55) common-timing-cpp 30.4091 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 2, 19, 10, 21) fem-multicore-cpp 64705.6 "Coloring mesh."
+(2012, 9, 2, 19, 16, 14) fem-assembly-cpp 353.478 "Assembly for various forms and backends"
+(2012, 9, 2, 19, 16, 27) fem-convergence-cpp 13.1566 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 2, 19, 16, 30) fem-jit-python 0.000413704 "JIT compilation (in memory cache)"
+(2012, 9, 2, 19, 21, 34) fem-speedup-cpp 304.89 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 2, 19, 21, 34) fem-speedup-cpp-assembly 5.84812 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 2, 19, 21, 34) fem-speedup-cpp-solve 1.67032 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 2, 19, 21, 57) mesh-refinement-cpp 22.1585 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 2, 19, 22, 18) mesh-topology-cpp 20.6684 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 2, 19, 22, 39) mesh-unitcube-cpp 20.8423 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 2, 19, 23, 22) mesh-iteration-cpp 40.3766 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 2, 19, 23, 43) function-evaluation-cpp 21.4348 "Evaluations of functions at arbitrary points."
+(2012, 9, 2, 19, 23, 43) function-evaluation-cpp 21.3481 "Evaluations of functions at arbitrary points."
+(2012, 9, 2, 19, 23, 49) function-extrapolation-python 5.35787 "BENCH:  1.97291898727"
+(2012, 9, 2, 19, 23, 49) function-extrapolation-python 1.97292 "BENCH:  1.97291898727"
+(2012, 9, 2, 19, 24, 13) la-vector-access-cpp 23.9989 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 2, 19, 24, 38) la-vector-assignment-cpp 24.9542 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 3, 1, 11, 1) common-progress-cpp 29.6154 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 3, 1, 11, 32) common-timing-cpp 30.8066 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 3, 19, 37, 53) fem-multicore-cpp 66381.2 "Coloring mesh."
+(2012, 9, 3, 19, 43, 47) fem-assembly-cpp 353.906 "Assembly for various forms and backends"
+(2012, 9, 3, 19, 44, 0) fem-convergence-cpp 13.204 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 3, 19, 44, 3) fem-jit-python 0.000414205 "JIT compilation (in memory cache)"
+(2012, 9, 3, 19, 49, 9) fem-speedup-cpp 306.308 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 3, 19, 49, 9) fem-speedup-cpp-assembly 5.77531 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 3, 19, 49, 9) fem-speedup-cpp-solve 1.63016 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 3, 19, 49, 32) mesh-refinement-cpp 22.1092 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 3, 19, 49, 54) mesh-topology-cpp 21.4351 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 3, 19, 50, 14) mesh-unitcube-cpp 20.7103 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 3, 19, 50, 57) mesh-iteration-cpp 40.3736 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 3, 19, 51, 19) function-evaluation-cpp 21.6735 "Evaluations of functions at arbitrary points."
+(2012, 9, 3, 19, 51, 19) function-evaluation-cpp 21.5859 "Evaluations of functions at arbitrary points."
+(2012, 9, 3, 19, 51, 24) function-extrapolation-python 5.38296 "BENCH:  1.98295307159"
+(2012, 9, 3, 19, 51, 24) function-extrapolation-python 1.98295 "BENCH:  1.98295307159"
+(2012, 9, 3, 19, 51, 47) la-vector-access-cpp 22.4489 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 3, 19, 52, 12) la-vector-assignment-cpp 24.9559 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 4, 1, 11, 18) common-progress-cpp 29.555 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 4, 1, 11, 48) common-timing-cpp 30.352 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 4, 19, 40, 57) fem-multicore-cpp 66549.2 "Coloring mesh."
+(2012, 9, 4, 19, 47, 9) fem-assembly-cpp 371.179 "Assembly for various forms and backends"
+(2012, 9, 4, 19, 47, 22) fem-convergence-cpp 13.4013 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 4, 19, 47, 24) fem-jit-python 0.000415802 "JIT compilation (in memory cache)"
+(2012, 9, 4, 19, 52, 31) fem-speedup-cpp 306.795 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 4, 19, 52, 31) fem-speedup-cpp-assembly 5.91365 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 4, 19, 52, 31) fem-speedup-cpp-solve 1.64665 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 4, 19, 52, 54) mesh-refinement-cpp 22.3169 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 4, 19, 53, 15) mesh-topology-cpp 21.0624 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 4, 19, 53, 37) mesh-unitcube-cpp 21.0063 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 4, 19, 54, 19) mesh-iteration-cpp 40.3747 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 4, 19, 54, 41) function-evaluation-cpp 21.9393 "Evaluations of functions at arbitrary points."
+(2012, 9, 4, 19, 54, 41) function-evaluation-cpp 21.8525 "Evaluations of functions at arbitrary points."
+(2012, 9, 4, 19, 54, 47) function-extrapolation-python 5.19274 "BENCH:  1.96293091774"
+(2012, 9, 4, 19, 54, 47) function-extrapolation-python 1.96293 "BENCH:  1.96293091774"
+(2012, 9, 4, 19, 55, 10) la-vector-access-cpp 23.5033 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 4, 19, 55, 38) la-vector-assignment-cpp 27.9047 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 5, 1, 11, 23) common-progress-cpp 29.5939 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 5, 1, 11, 55) common-timing-cpp 31.1492 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 5, 19, 48, 33) fem-multicore-cpp 66998.1 "Coloring mesh."
+(2012, 9, 5, 19, 54, 42) fem-assembly-cpp 369.477 "Assembly for various forms and backends"
+(2012, 9, 5, 19, 54, 56) fem-convergence-cpp 13.4173 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 5, 19, 54, 58) fem-jit-python 0.000405693 "JIT compilation (in memory cache)"
+(2012, 9, 5, 20, 0, 11) fem-speedup-cpp 313.094 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 5, 20, 0, 11) fem-speedup-cpp-assembly 5.76646 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 5, 20, 0, 11) fem-speedup-cpp-solve 1.55733 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 5, 20, 0, 34) mesh-refinement-cpp 22.3776 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 5, 20, 0, 55) mesh-topology-cpp 21.028 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 5, 20, 1, 17) mesh-unitcube-cpp 20.9815 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 5, 20, 1, 59) mesh-iteration-cpp 40.3801 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 5, 20, 2, 21) function-evaluation-cpp 21.9014 "Evaluations of functions at arbitrary points."
+(2012, 9, 5, 20, 2, 21) function-evaluation-cpp 21.8147 "Evaluations of functions at arbitrary points."
+(2012, 9, 5, 20, 2, 27) function-extrapolation-python 5.39935 "BENCH:  1.95831203461"
+(2012, 9, 5, 20, 2, 27) function-extrapolation-python 1.95831 "BENCH:  1.95831203461"
+(2012, 9, 5, 20, 2, 51) la-vector-access-cpp 24.4459 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 5, 20, 3, 23) la-vector-assignment-cpp 31.8966 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 6, 1, 11, 24) common-progress-cpp 29.5608 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 6, 1, 11, 53) common-timing-cpp 29.7331 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 6, 19, 48, 58) fem-multicore-cpp 67024.4 "Coloring mesh."
+(2012, 9, 6, 19, 55, 8) fem-assembly-cpp 370.287 "Assembly for various forms and backends"
+(2012, 9, 6, 19, 55, 22) fem-convergence-cpp 13.4429 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 6, 19, 55, 24) fem-jit-python 0.000417709 "JIT compilation (in memory cache)"
+(2012, 9, 6, 20, 0, 31) fem-speedup-cpp 307.13 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 6, 20, 0, 31) fem-speedup-cpp-assembly 5.86936 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 6, 20, 0, 31) fem-speedup-cpp-solve 1.63583 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 6, 20, 0, 54) mesh-refinement-cpp 22.3903 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 6, 20, 1, 15) mesh-topology-cpp 20.8413 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 6, 20, 1, 37) mesh-unitcube-cpp 21.2655 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 6, 20, 2, 22) mesh-iteration-cpp 42.5653 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 6, 20, 2, 44) function-evaluation-cpp 21.9231 "Evaluations of functions at arbitrary points."
+(2012, 9, 6, 20, 2, 44) function-evaluation-cpp 21.8363 "Evaluations of functions at arbitrary points."
+(2012, 9, 6, 20, 2, 49) function-extrapolation-python 5.36616 "BENCH:  1.96219110489"
+(2012, 9, 6, 20, 2, 49) function-extrapolation-python 1.96219 "BENCH:  1.96219110489"
+(2012, 9, 6, 20, 3, 12) la-vector-access-cpp 22.4555 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 6, 20, 3, 40) la-vector-assignment-cpp 27.9026 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 7, 1, 11, 23) common-progress-cpp 29.1164 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 7, 1, 11, 53) common-timing-cpp 29.8478 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 7, 12, 55, 46) fem-multicore-cpp 42233.4 "Coloring mesh."
+(2012, 9, 7, 13, 1, 36) fem-assembly-cpp 349.136 "Assembly for various forms and backends"
+(2012, 9, 7, 13, 1, 49) fem-convergence-cpp 13.2804 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 7, 13, 1, 51) fem-jit-python 0.0004035 "JIT compilation (in memory cache)"
+(2012, 9, 7, 13, 8, 13) fem-speedup-cpp 381.55 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 7, 13, 8, 13) fem-speedup-cpp-assembly 6.10032 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 7, 13, 8, 13) fem-speedup-cpp-solve 1.57736 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 7, 13, 8, 36) mesh-refinement-cpp 22.1586 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 7, 13, 8, 57) mesh-topology-cpp 20.6734 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 7, 13, 9, 18) mesh-unitcube-cpp 21.2095 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 7, 13, 10, 7) mesh-iteration-cpp 46.0039 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 7, 13, 10, 29) function-evaluation-cpp 21.8716 "Evaluations of functions at arbitrary points."
+(2012, 9, 7, 13, 10, 29) function-evaluation-cpp 21.7906 "Evaluations of functions at arbitrary points."
+(2012, 9, 7, 13, 10, 34) function-extrapolation-python 5.39313 "BENCH:  1.92531085014"
+(2012, 9, 7, 13, 10, 34) function-extrapolation-python 1.92531 "BENCH:  1.92531085014"
+(2012, 9, 7, 13, 10, 57) la-vector-access-cpp 22.4554 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 7, 13, 11, 22) la-vector-assignment-cpp 24.9557 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 8, 1, 11, 24) common-progress-cpp 29.648 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 8, 1, 11, 55) common-timing-cpp 30.8156 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 8, 13, 7, 35) fem-multicore-cpp 42940.6 "Coloring mesh."
+(2012, 9, 8, 13, 13, 24) fem-assembly-cpp 348.849 "Assembly for various forms and backends"
+(2012, 9, 8, 13, 13, 37) fem-convergence-cpp 13.1329 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 8, 13, 13, 40) fem-jit-python 0.000404501 "JIT compilation (in memory cache)"
+(2012, 9, 8, 13, 20, 2) fem-speedup-cpp 382.047 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 8, 13, 20, 2) fem-speedup-cpp-assembly 6.08771 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 8, 13, 20, 2) fem-speedup-cpp-solve 1.60074 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 8, 13, 20, 25) mesh-refinement-cpp 22.0717 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 8, 13, 20, 46) mesh-topology-cpp 20.7544 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 8, 13, 21, 7) mesh-unitcube-cpp 21.4244 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 8, 13, 21, 50) mesh-iteration-cpp 40.3868 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 8, 13, 22, 12) function-evaluation-cpp 21.8589 "Evaluations of functions at arbitrary points."
+(2012, 9, 8, 13, 22, 12) function-evaluation-cpp 21.7517 "Evaluations of functions at arbitrary points."
+(2012, 9, 8, 13, 22, 27) function-extrapolation-python 14.4207 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2012, 9, 8, 13, 22, 27) function-extrapolation-python 1.96067 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2012, 9, 8, 13, 22, 49) la-vector-access-cpp 22.8787 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 8, 13, 23, 15) la-vector-assignment-cpp 24.9518 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 9, 1, 11, 37) common-progress-cpp 29.8691 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 9, 1, 12, 7) common-timing-cpp 30.3262 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 9, 12, 47, 13) fem-assembly-cpp 349.715 "Assembly for various forms and backends"
+(2012, 9, 9, 12, 47, 26) fem-convergence-cpp 13.2086 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 9, 12, 47, 28) fem-jit-python 0.000411987 "JIT compilation (in memory cache)"
+(2012, 9, 9, 12, 53, 53) fem-speedup-cpp 384.017 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 9, 12, 53, 53) fem-speedup-cpp-assembly 6.05459 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 9, 12, 53, 53) fem-speedup-cpp-solve 1.55812 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 9, 12, 54, 16) mesh-refinement-cpp 22.1192 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 9, 12, 54, 37) mesh-topology-cpp 20.8795 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 9, 12, 54, 59) mesh-unitcube-cpp 21.2642 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 9, 12, 55, 41) mesh-iteration-cpp 40.3734 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 9, 12, 56, 3) function-evaluation-cpp 21.8774 "Evaluations of functions at arbitrary points."
+(2012, 9, 9, 12, 56, 3) function-evaluation-cpp 21.7966 "Evaluations of functions at arbitrary points."
+(2012, 9, 9, 12, 56, 9) function-extrapolation-python 5.29122 "BENCH:  1.87799406052"
+(2012, 9, 9, 12, 56, 9) function-extrapolation-python 1.87799 "BENCH:  1.87799406052"
+(2012, 9, 9, 12, 56, 31) la-vector-access-cpp 22.4534 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 9, 12, 56, 56) la-vector-assignment-cpp 24.9631 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 10, 1, 11, 41) common-progress-cpp 29.5617 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 10, 1, 12, 10) common-timing-cpp 29.8504 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 10, 12, 45, 4) fem-assembly-cpp 347.319 "Assembly for various forms and backends"
+(2012, 9, 10, 12, 45, 18) fem-convergence-cpp 13.2249 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 10, 12, 45, 20) fem-jit-python 0.000414491 "JIT compilation (in memory cache)"
+(2012, 9, 10, 12, 51, 42) fem-speedup-cpp 382.666 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 10, 12, 51, 42) fem-speedup-cpp-assembly 6.10554 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 10, 12, 51, 42) fem-speedup-cpp-solve 1.57108 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 10, 12, 52, 6) mesh-refinement-cpp 22.0961 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 10, 12, 52, 27) mesh-topology-cpp 20.7155 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 10, 12, 52, 48) mesh-unitcube-cpp 21.1334 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 10, 12, 53, 31) mesh-iteration-cpp 40.3921 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 10, 12, 53, 53) function-evaluation-cpp 21.878 "Evaluations of functions at arbitrary points."
+(2012, 9, 10, 12, 53, 53) function-evaluation-cpp 21.7911 "Evaluations of functions at arbitrary points."
+(2012, 9, 10, 12, 53, 58) function-extrapolation-python 5.31745 "BENCH:  1.89025998116"
+(2012, 9, 10, 12, 53, 58) function-extrapolation-python 1.89026 "BENCH:  1.89025998116"
+(2012, 9, 10, 12, 54, 21) la-vector-access-cpp 22.4589 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 10, 12, 54, 46) la-vector-assignment-cpp 25.1076 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 11, 1, 11, 55) common-progress-cpp 29.6292 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 11, 1, 12, 25) common-timing-cpp 30.1381 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 11, 12, 43, 19) fem-assembly-cpp 347.635 "Assembly for various forms and backends"
+(2012, 9, 11, 12, 43, 32) fem-convergence-cpp 13.3449 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 11, 12, 43, 34) fem-jit-python 0.000408792 "JIT compilation (in memory cache)"
+(2012, 9, 11, 12, 50, 5) fem-speedup-cpp 390.856 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 11, 12, 50, 5) fem-speedup-cpp-assembly 6.11155 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 11, 12, 50, 5) fem-speedup-cpp-solve 1.48925 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 11, 12, 50, 29) mesh-refinement-cpp 22.1867 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 11, 12, 50, 50) mesh-topology-cpp 20.8785 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 11, 12, 51, 11) mesh-unitcube-cpp 21.1004 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 11, 12, 51, 54) mesh-iteration-cpp 40.3758 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 11, 12, 52, 16) function-evaluation-cpp 21.6863 "Evaluations of functions at arbitrary points."
+(2012, 9, 11, 12, 52, 16) function-evaluation-cpp 21.6053 "Evaluations of functions at arbitrary points."
+(2012, 9, 11, 12, 52, 21) function-extrapolation-python 5.38411 "BENCH:  1.94400215149"
+(2012, 9, 11, 12, 52, 21) function-extrapolation-python 1.944 "BENCH:  1.94400215149"
+(2012, 9, 11, 12, 52, 44) la-vector-access-cpp 22.4543 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 11, 12, 53, 9) la-vector-assignment-cpp 24.9595 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 12, 1, 11, 32) common-progress-cpp 36.4371 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 12, 1, 12, 1) common-timing-cpp 29.5084 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 12, 12, 41, 1) fem-assembly-cpp 347.333 "Assembly for various forms and backends"
+(2012, 9, 12, 12, 41, 14) fem-convergence-cpp 13.3065 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 12, 12, 41, 17) fem-jit-python 0.000404406 "JIT compilation (in memory cache)"
+(2012, 9, 12, 12, 47, 39) fem-speedup-cpp 382.711 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 12, 12, 47, 39) fem-speedup-cpp-assembly 6.07984 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 12, 12, 47, 39) fem-speedup-cpp-solve 1.58246 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 12, 12, 48, 3) mesh-refinement-cpp 22.185 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 12, 12, 48, 24) mesh-topology-cpp 20.8243 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 12, 12, 48, 45) mesh-unitcube-cpp 21.0921 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 12, 12, 49, 28) mesh-iteration-cpp 40.3826 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 12, 12, 49, 50) function-evaluation-cpp 21.9126 "Evaluations of functions at arbitrary points."
+(2012, 9, 12, 12, 49, 50) function-evaluation-cpp 21.8315 "Evaluations of functions at arbitrary points."
+(2012, 9, 12, 12, 49, 55) function-extrapolation-python 5.56267 "BENCH:  1.95282721519"
+(2012, 9, 12, 12, 49, 55) function-extrapolation-python 1.95283 "BENCH:  1.95282721519"
+(2012, 9, 12, 12, 50, 18) la-vector-access-cpp 22.518 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 12, 12, 50, 43) la-vector-assignment-cpp 24.8598 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 13, 1, 11, 23) common-progress-cpp 29.5793 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 13, 1, 11, 53) common-timing-cpp 29.8039 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 13, 12, 48, 27) fem-assembly-cpp 346.829 "Assembly for various forms and backends"
+(2012, 9, 13, 12, 48, 40) fem-convergence-cpp 13.3287 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 13, 12, 48, 43) fem-jit-python 0.000405312 "JIT compilation (in memory cache)"
+(2012, 9, 13, 12, 55, 12) fem-speedup-cpp 389.505 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 13, 12, 55, 12) fem-speedup-cpp-assembly 6.06103 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 13, 12, 55, 12) fem-speedup-cpp-solve 1.51599 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 13, 12, 55, 36) mesh-refinement-cpp 22.166 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 13, 12, 55, 57) mesh-topology-cpp 20.8705 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 13, 12, 56, 18) mesh-unitcube-cpp 21.0782 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 13, 12, 57, 1) mesh-iteration-cpp 40.3775 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 13, 12, 57, 23) function-evaluation-cpp 21.8964 "Evaluations of functions at arbitrary points."
+(2012, 9, 13, 12, 57, 23) function-evaluation-cpp 21.815 "Evaluations of functions at arbitrary points."
+(2012, 9, 13, 12, 57, 29) function-extrapolation-python 5.50112 "BENCH:  1.9168510437"
+(2012, 9, 13, 12, 57, 29) function-extrapolation-python 1.91685 "BENCH:  1.9168510437"
+(2012, 9, 13, 12, 57, 51) la-vector-access-cpp 22.4541 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 13, 12, 58, 16) la-vector-assignment-cpp 24.9638 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 14, 1, 11, 39) common-progress-cpp 36.4364 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 14, 1, 12, 10) common-timing-cpp 30.2412 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 14, 12, 25, 43) fem-assembly-cpp 347.315 "Assembly for various forms and backends"
+(2012, 9, 14, 12, 25, 56) fem-convergence-cpp 13.3531 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 14, 12, 25, 58) fem-jit-python 0.000406313 "JIT compilation (in memory cache)"
+(2012, 9, 14, 12, 32, 29) fem-speedup-cpp 390.186 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 14, 12, 32, 29) fem-speedup-cpp-assembly 6.10476 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 14, 12, 32, 29) fem-speedup-cpp-solve 1.49782 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 14, 12, 32, 52) mesh-refinement-cpp 22.1111 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 14, 12, 33, 13) mesh-topology-cpp 20.6805 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 14, 12, 33, 34) mesh-unitcube-cpp 21.0993 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 14, 12, 34, 17) mesh-iteration-cpp 40.3802 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 14, 12, 34, 39) function-evaluation-cpp 21.9003 "Evaluations of functions at arbitrary points."
+(2012, 9, 14, 12, 34, 39) function-evaluation-cpp 21.8196 "Evaluations of functions at arbitrary points."
+(2012, 9, 14, 12, 34, 45) function-extrapolation-python 5.40911 "BENCH:  1.89039516449"
+(2012, 9, 14, 12, 34, 45) function-extrapolation-python 1.8904 "BENCH:  1.89039516449"
+(2012, 9, 14, 12, 35, 9) la-vector-access-cpp 23.8229 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 14, 12, 35, 34) la-vector-assignment-cpp 24.962 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 15, 1, 11, 28) common-progress-cpp 29.5854 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 15, 1, 11, 57) common-timing-cpp 28.7927 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 15, 12, 28, 50) fem-convergence-cpp 13.0818 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 15, 12, 28, 52) fem-jit-python 0.000412393 "JIT compilation (in memory cache)"
+(2012, 9, 15, 12, 35, 27) fem-speedup-cpp 394.561 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 15, 12, 35, 27) fem-speedup-cpp-assembly 6.09929 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 15, 12, 35, 27) fem-speedup-cpp-solve 1.44758 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 15, 12, 35, 51) mesh-refinement-cpp 22.4542 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 15, 12, 36, 12) mesh-topology-cpp 20.901 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 15, 12, 36, 36) mesh-unitcube-cpp 23.5594 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 15, 12, 37, 18) mesh-iteration-cpp 40.3736 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 15, 12, 37, 40) function-evaluation-cpp 21.815 "Evaluations of functions at arbitrary points."
+(2012, 9, 15, 12, 37, 40) function-evaluation-cpp 21.7257 "Evaluations of functions at arbitrary points."
+(2012, 9, 15, 12, 37, 46) function-extrapolation-python 5.43882 "BENCH:  1.89907884598"
+(2012, 9, 15, 12, 37, 46) function-extrapolation-python 1.89908 "BENCH:  1.89907884598"
+(2012, 9, 15, 12, 38, 9) la-vector-access-cpp 23.3205 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 15, 12, 38, 35) la-vector-assignment-cpp 25.5206 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 16, 1, 11, 16) common-progress-cpp 38.9439 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 16, 1, 11, 45) common-timing-cpp 28.9383 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 16, 13, 9, 30) fem-multicore-cpp 43065.4 "Coloring mesh."
+(2012, 9, 16, 13, 9, 45) fem-convergence-cpp 13.0918 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 16, 13, 9, 48) fem-jit-python 0.000410509 "JIT compilation (in memory cache)"
+(2012, 9, 16, 13, 16, 19) fem-speedup-cpp 391.508 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 16, 13, 16, 19) fem-speedup-cpp-assembly 6.06307 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 16, 13, 16, 19) fem-speedup-cpp-solve 1.47197 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 16, 13, 16, 43) mesh-refinement-cpp 22.49 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 16, 13, 17, 4) mesh-topology-cpp 20.86 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 16, 13, 17, 28) mesh-unitcube-cpp 23.5676 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 16, 13, 18, 11) mesh-iteration-cpp 40.3725 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 16, 13, 18, 33) function-evaluation-cpp 21.8604 "Evaluations of functions at arbitrary points."
+(2012, 9, 16, 13, 18, 33) function-evaluation-cpp 21.7796 "Evaluations of functions at arbitrary points."
+(2012, 9, 16, 13, 18, 38) function-extrapolation-python 5.20525 "BENCH:  1.89735102654"
+(2012, 9, 16, 13, 18, 38) function-extrapolation-python 1.89735 "BENCH:  1.89735102654"
+(2012, 9, 16, 13, 19, 1) la-vector-access-cpp 22.3997 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 16, 13, 19, 26) la-vector-assignment-cpp 25.5192 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 17, 1, 10, 46) common-progress-cpp 29.612 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 17, 1, 11, 15) common-timing-cpp 28.7437 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 17, 13, 24, 34) fem-multicore-cpp 43998.9 "Coloring mesh."
+(2012, 9, 17, 13, 24, 49) fem-convergence-cpp 13.1166 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 17, 13, 24, 52) fem-jit-python 0.000408792 "JIT compilation (in memory cache)"
+(2012, 9, 17, 13, 31, 26) fem-speedup-cpp 394.534 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 17, 13, 31, 26) fem-speedup-cpp-assembly 6.11943 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 17, 13, 31, 26) fem-speedup-cpp-solve 1.45052 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 17, 13, 31, 50) mesh-refinement-cpp 22.5091 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 17, 13, 32, 11) mesh-topology-cpp 20.8864 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 17, 13, 32, 35) mesh-unitcube-cpp 23.6286 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 17, 13, 33, 18) mesh-iteration-cpp 40.3785 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 17, 13, 33, 41) function-evaluation-cpp 22.9586 "Evaluations of functions at arbitrary points."
+(2012, 9, 17, 13, 33, 41) function-evaluation-cpp 22.8698 "Evaluations of functions at arbitrary points."
+(2012, 9, 17, 13, 33, 47) function-extrapolation-python 5.3996 "BENCH:  1.89168787003"
+(2012, 9, 17, 13, 33, 47) function-extrapolation-python 1.89169 "BENCH:  1.89168787003"
+(2012, 9, 17, 13, 34, 15) la-vector-access-cpp 27.8828 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 17, 13, 34, 40) la-vector-assignment-cpp 25.5082 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 18, 1, 10, 49) common-progress-cpp 29.5931 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 18, 1, 11, 17) common-timing-cpp 28.1017 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 18, 12, 49, 11) fem-multicore-cpp 41874.5 "Coloring mesh."
+(2012, 9, 18, 12, 49, 26) fem-convergence-cpp 13.1149 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 18, 12, 49, 28) fem-jit-python 0.000406289 "JIT compilation (in memory cache)"
+(2012, 9, 18, 12, 56, 1) fem-speedup-cpp 392.847 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 18, 12, 56, 1) fem-speedup-cpp-assembly 6.04611 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 18, 12, 56, 1) fem-speedup-cpp-solve 1.48035 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 18, 12, 56, 26) mesh-refinement-cpp 22.5223 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 18, 12, 56, 47) mesh-topology-cpp 20.8932 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 18, 12, 57, 10) mesh-unitcube-cpp 23.5504 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 18, 12, 57, 53) mesh-iteration-cpp 40.3742 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 18, 12, 58, 15) function-evaluation-cpp 21.881 "Evaluations of functions at arbitrary points."
+(2012, 9, 18, 12, 58, 15) function-evaluation-cpp 21.7839 "Evaluations of functions at arbitrary points."
+(2012, 9, 18, 12, 58, 21) function-extrapolation-python 5.30175 "BENCH:  1.90063285828"
+(2012, 9, 18, 12, 58, 21) function-extrapolation-python 1.90063 "BENCH:  1.90063285828"
+(2012, 9, 18, 12, 58, 45) la-vector-access-cpp 24.4174 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 18, 12, 59, 13) la-vector-assignment-cpp 27.8988 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 19, 1, 11, 8) common-progress-cpp 29.8735 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 19, 1, 11, 37) common-timing-cpp 29.1151 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 19, 13, 25, 15) fem-multicore-cpp 44018.3 "Coloring mesh."
+(2012, 9, 19, 13, 25, 30) fem-convergence-cpp 13.2066 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 19, 13, 25, 32) fem-jit-python 0.000416398 "JIT compilation (in memory cache)"
+(2012, 9, 19, 13, 31, 56) fem-speedup-cpp 383.872 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 19, 13, 31, 56) fem-speedup-cpp-assembly 6.10301 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 19, 13, 31, 56) fem-speedup-cpp-solve 1.56911 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 19, 13, 32, 20) mesh-refinement-cpp 22.3385 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 19, 13, 32, 41) mesh-topology-cpp 20.4917 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 19, 13, 33, 4) mesh-unitcube-cpp 22.4845 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 19, 13, 33, 48) mesh-iteration-cpp 41.6145 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 19, 13, 34, 10) function-evaluation-cpp 21.9973 "Evaluations of functions at arbitrary points."
+(2012, 9, 19, 13, 34, 10) function-evaluation-cpp 21.9161 "Evaluations of functions at arbitrary points."
+(2012, 9, 19, 13, 34, 15) function-extrapolation-python 5.26828 "BENCH:  1.89837098122"
+(2012, 9, 19, 13, 34, 15) function-extrapolation-python 1.89837 "BENCH:  1.89837098122"
+(2012, 9, 19, 13, 34, 38) la-vector-access-cpp 22.4024 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 19, 13, 35, 3) la-vector-assignment-cpp 25.514 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 20, 1, 11, 5) common-progress-cpp 29.7306 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 20, 1, 11, 34) common-timing-cpp 29.1986 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 20, 13, 20, 37) fem-multicore-cpp 43742.7 "Coloring mesh."
+(2012, 9, 20, 13, 20, 52) fem-convergence-cpp 13.2042 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 20, 13, 20, 54) fem-jit-python 0.000415611 "JIT compilation (in memory cache)"
+(2012, 9, 20, 13, 27, 17) fem-speedup-cpp 382.221 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 20, 13, 27, 17) fem-speedup-cpp-assembly 6.11515 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 20, 13, 27, 17) fem-speedup-cpp-solve 1.59161 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 20, 13, 27, 41) mesh-refinement-cpp 22.3458 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 20, 13, 28, 1) mesh-topology-cpp 20.4703 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 20, 13, 28, 24) mesh-unitcube-cpp 22.5939 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 20, 13, 29, 7) mesh-iteration-cpp 40.377 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 20, 13, 29, 29) function-evaluation-cpp 21.8748 "Evaluations of functions at arbitrary points."
+(2012, 9, 20, 13, 29, 29) function-evaluation-cpp 21.7941 "Evaluations of functions at arbitrary points."
+(2012, 9, 20, 13, 29, 34) function-extrapolation-python 5.24601 "BENCH:  1.89654994011"
+(2012, 9, 20, 13, 29, 34) function-extrapolation-python 1.89655 "BENCH:  1.89654994011"
+(2012, 9, 20, 13, 29, 56) la-vector-access-cpp 22.4008 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 20, 13, 30, 22) la-vector-assignment-cpp 25.5189 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 21, 1, 11, 12) common-progress-cpp 29.6577 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 21, 1, 11, 41) common-timing-cpp 29.1631 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 21, 9, 7, 39) common-progress-cpp 29.6845 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 21, 9, 8, 8) common-timing-cpp 29.4578 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 21, 10, 24, 25) fem-jit-python 0.000410795 "JIT compilation (in memory cache)"
+(2012, 9, 21, 10, 27, 13) function-extrapolation-python 3.39918 "BENCH:  1.87466597557"
+(2012, 9, 21, 10, 27, 13) function-extrapolation-python 1.87467 "BENCH:  1.87466597557"
+(2012, 9, 22, 1, 11, 19) common-progress-cpp 29.1781 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 22, 1, 11, 48) common-timing-cpp 29.5232 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 22, 1, 13, 36) fem-multicore-cpp 107.78 "Coloring mesh."
+(2012, 9, 22, 1, 13, 51) fem-convergence-cpp 13.1441 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 22, 1, 13, 51) fem-jit-python 0.000403094 "JIT compilation (in memory cache)"
+(2012, 9, 22, 1, 20, 27) fem-speedup-cpp 395.787 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 22, 1, 20, 27) fem-speedup-cpp-assembly 6.05911 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 22, 1, 20, 27) fem-speedup-cpp-solve 1.44451 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 22, 1, 21, 1) mesh-refinement-cpp 31.5896 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 22, 1, 21, 22) mesh-topology-cpp 20.8219 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 22, 1, 21, 43) mesh-unitcube-cpp 21.7527 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 22, 1, 22, 47) mesh-iteration-cpp 61.0734 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 22, 1, 23, 9) function-evaluation-cpp 21.8743 "Evaluations of functions at arbitrary points."
+(2012, 9, 22, 1, 23, 9) function-evaluation-cpp 21.7859 "Evaluations of functions at arbitrary points."
+(2012, 9, 22, 1, 23, 15) function-extrapolation-python 5.58182 "BENCH:  1.90315103531"
+(2012, 9, 22, 1, 23, 15) function-extrapolation-python 1.90315 "BENCH:  1.90315103531"
+(2012, 9, 22, 1, 23, 40) la-vector-access-cpp 24.9702 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 22, 1, 24, 5) la-vector-assignment-cpp 25.5096 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 23, 1, 11, 0) common-progress-cpp 30.7373 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 23, 1, 11, 28) common-timing-cpp 28.1362 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 23, 1, 13, 15) fem-multicore-cpp 107.745 "Coloring mesh."
+(2012, 9, 23, 1, 13, 30) fem-convergence-cpp 13.3992 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 23, 1, 13, 31) fem-jit-python 0.000411797 "JIT compilation (in memory cache)"
+(2012, 9, 23, 1, 20, 9) fem-speedup-cpp 398.523 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 23, 1, 20, 9) fem-speedup-cpp-assembly 6.18453 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 23, 1, 20, 9) fem-speedup-cpp-solve 1.39178 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 23, 1, 20, 43) mesh-refinement-cpp 31.5799 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 23, 1, 21, 4) mesh-topology-cpp 20.8693 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 23, 1, 21, 26) mesh-unitcube-cpp 21.8442 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 23, 1, 22, 10) mesh-iteration-cpp 41.6302 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 23, 1, 22, 32) function-evaluation-cpp 21.8793 "Evaluations of functions at arbitrary points."
+(2012, 9, 23, 1, 22, 32) function-evaluation-cpp 21.7983 "Evaluations of functions at arbitrary points."
+(2012, 9, 23, 1, 22, 37) function-extrapolation-python 5.56562 "BENCH:  1.9037539959"
+(2012, 9, 23, 1, 22, 37) function-extrapolation-python 1.90375 "BENCH:  1.9037539959"
+(2012, 9, 23, 1, 23, 0) la-vector-access-cpp 22.3991 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 23, 1, 23, 28) la-vector-assignment-cpp 28.3515 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 24, 1, 11, 1) common-progress-cpp 29.5841 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 24, 1, 11, 30) common-timing-cpp 29.0484 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 24, 1, 13, 19) fem-multicore-cpp 108.684 "Coloring mesh."
+(2012, 9, 24, 1, 13, 33) fem-convergence-cpp 13.4175 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 24, 1, 13, 34) fem-jit-python 0.000411797 "JIT compilation (in memory cache)"
+(2012, 9, 24, 1, 19, 42) fem-speedup-cpp 367.845 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 24, 1, 19, 42) fem-speedup-cpp-assembly 6.07892 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 24, 1, 19, 42) fem-speedup-cpp-solve 1.80876 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 24, 1, 20, 15) mesh-refinement-cpp 31.6335 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 24, 1, 20, 36) mesh-topology-cpp 20.9318 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 24, 1, 20, 58) mesh-unitcube-cpp 21.8601 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 24, 1, 21, 42) mesh-iteration-cpp 41.5928 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 24, 1, 22, 4) function-evaluation-cpp 21.9059 "Evaluations of functions at arbitrary points."
+(2012, 9, 24, 1, 22, 4) function-evaluation-cpp 21.8099 "Evaluations of functions at arbitrary points."
+(2012, 9, 24, 1, 22, 10) function-extrapolation-python 5.5134 "BENCH:  1.92673611641"
+(2012, 9, 24, 1, 22, 10) function-extrapolation-python 1.92674 "BENCH:  1.92673611641"
+(2012, 9, 24, 1, 22, 32) la-vector-access-cpp 22.3992 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 24, 1, 22, 58) la-vector-assignment-cpp 25.4026 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 25, 1, 11, 24) common-progress-cpp 48.2572 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 25, 1, 11, 54) common-timing-cpp 29.7911 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 25, 1, 13, 42) fem-multicore-cpp 108.482 "Coloring mesh."
+(2012, 9, 25, 1, 16, 6) fem-assembly-cpp 143.666 "Assembly for various forms and backends"
+(2012, 9, 25, 1, 16, 19) fem-convergence-cpp 13.3206 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 25, 1, 16, 20) fem-jit-python 0.000407314 "JIT compilation (in memory cache)"
+(2012, 9, 25, 1, 23, 0) fem-speedup-cpp 400.125 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 25, 1, 23, 0) fem-speedup-cpp-assembly 6.09379 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 25, 1, 23, 0) fem-speedup-cpp-solve 1.36736 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 25, 1, 23, 25) mesh-refinement-cpp 23.5491 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 25, 1, 23, 46) mesh-topology-cpp 20.5739 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 25, 1, 24, 8) mesh-unitcube-cpp 21.9915 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 25, 1, 24, 51) mesh-iteration-cpp 41.0121 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 25, 1, 25, 13) function-evaluation-cpp 21.8873 "Evaluations of functions at arbitrary points."
+(2012, 9, 25, 1, 25, 13) function-evaluation-cpp 21.806 "Evaluations of functions at arbitrary points."
+(2012, 9, 25, 1, 25, 19) function-extrapolation-python 5.54546 "BENCH:  1.89376592636"
+(2012, 9, 25, 1, 25, 19) function-extrapolation-python 1.89377 "BENCH:  1.89376592636"
+(2012, 9, 25, 1, 25, 41) la-vector-access-cpp 22.4 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 25, 1, 26, 7) la-vector-assignment-cpp 25.5236 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 26, 1, 11, 38) common-progress-cpp 29.6016 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 26, 1, 12, 8) common-timing-cpp 29.4257 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 26, 1, 13, 56) fem-multicore-cpp 108.321 "Coloring mesh."
+(2012, 9, 26, 1, 16, 22) fem-assembly-cpp 145.668 "Assembly for various forms and backends"
+(2012, 9, 26, 1, 16, 35) fem-convergence-cpp 13.4098 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 26, 1, 16, 36) fem-jit-python 0.000411701 "JIT compilation (in memory cache)"
+(2012, 9, 26, 1, 22, 47) fem-speedup-cpp 370.705 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 26, 1, 22, 47) fem-speedup-cpp-assembly 6.08716 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 26, 1, 22, 47) fem-speedup-cpp-solve 1.7315 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 26, 1, 23, 11) mesh-refinement-cpp 23.4647 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 26, 1, 23, 32) mesh-topology-cpp 20.6221 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 26, 1, 23, 54) mesh-unitcube-cpp 21.877 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 26, 1, 24, 40) mesh-iteration-cpp 43.5017 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 26, 1, 25, 2) function-evaluation-cpp 21.5565 "Evaluations of functions at arbitrary points."
+(2012, 9, 26, 1, 25, 2) function-evaluation-cpp 21.4753 "Evaluations of functions at arbitrary points."
+(2012, 9, 26, 1, 25, 7) function-extrapolation-python 5.58725 "BENCH:  1.94169616699"
+(2012, 9, 26, 1, 25, 7) function-extrapolation-python 1.9417 "BENCH:  1.94169616699"
+(2012, 9, 26, 1, 25, 33) la-vector-access-cpp 25.1789 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 26, 1, 25, 58) la-vector-assignment-cpp 25.518 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 27, 1, 10, 49) common-progress-cpp 29.0637 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 27, 1, 11, 19) common-timing-cpp 29.6664 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 27, 1, 13, 8) fem-multicore-cpp 109.065 "Coloring mesh."
+(2012, 9, 27, 1, 15, 34) fem-assembly-cpp 146.163 "Assembly for various forms and backends"
+(2012, 9, 27, 1, 15, 48) fem-convergence-cpp 13.3473 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 27, 1, 15, 48) fem-jit-python 0.000416493 "JIT compilation (in memory cache)"
+(2012, 9, 27, 1, 22, 5) fem-speedup-cpp 376.931 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 27, 1, 22, 5) fem-speedup-cpp-assembly 6.25234 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 27, 1, 22, 5) fem-speedup-cpp-solve 1.65077 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 27, 1, 22, 30) mesh-refinement-cpp 23.6467 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 27, 1, 22, 51) mesh-topology-cpp 20.5443 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 27, 1, 23, 13) mesh-unitcube-cpp 21.8913 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 27, 1, 23, 57) mesh-iteration-cpp 41.0244 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 27, 1, 24, 19) function-evaluation-cpp 21.9048 "Evaluations of functions at arbitrary points."
+(2012, 9, 27, 1, 24, 19) function-evaluation-cpp 21.8233 "Evaluations of functions at arbitrary points."
+(2012, 9, 27, 1, 24, 24) function-extrapolation-python 5.54644 "BENCH:  1.94915890694"
+(2012, 9, 27, 1, 24, 24) function-extrapolation-python 1.94916 "BENCH:  1.94915890694"
+(2012, 9, 27, 1, 24, 47) la-vector-access-cpp 22.5069 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 27, 1, 25, 12) la-vector-assignment-cpp 25.5253 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 28, 1, 11, 13) common-progress-cpp 29.6133 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 28, 1, 11, 42) common-timing-cpp 29.0405 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 28, 1, 13, 30) fem-multicore-cpp 107.814 "Coloring mesh."
+(2012, 9, 28, 1, 15, 52) fem-assembly-cpp 142.62 "Assembly for various forms and backends"
+(2012, 9, 28, 1, 16, 6) fem-convergence-cpp 13.3901 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 28, 1, 16, 6) fem-jit-python 0.000418305 "JIT compilation (in memory cache)"
+(2012, 9, 28, 1, 22, 26) fem-speedup-cpp 379.907 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 28, 1, 22, 26) fem-speedup-cpp-assembly 6.04427 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 28, 1, 22, 26) fem-speedup-cpp-solve 1.61463 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 28, 1, 22, 52) mesh-refinement-cpp 24.0284 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 28, 1, 23, 13) mesh-topology-cpp 20.7403 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 28, 1, 23, 36) mesh-unitcube-cpp 22.8326 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 28, 1, 24, 19) mesh-iteration-cpp 41.0062 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 28, 1, 24, 42) function-evaluation-cpp 21.9311 "Evaluations of functions at arbitrary points."
+(2012, 9, 28, 1, 24, 42) function-evaluation-cpp 21.8367 "Evaluations of functions at arbitrary points."
+(2012, 9, 28, 1, 24, 47) function-extrapolation-python 5.49925 "BENCH:  1.93289494514"
+(2012, 9, 28, 1, 24, 47) function-extrapolation-python 1.93289 "BENCH:  1.93289494514"
+(2012, 9, 28, 1, 25, 12) la-vector-access-cpp 24.8691 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 28, 1, 25, 40) la-vector-assignment-cpp 27.9045 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 29, 1, 11, 31) common-progress-cpp 47.7193 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 29, 1, 12, 0) common-timing-cpp 28.5082 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 29, 1, 13, 48) fem-multicore-cpp 107.933 "Coloring mesh."
+(2012, 9, 29, 1, 16, 11) fem-assembly-cpp 143.145 "Assembly for various forms and backends"
+(2012, 9, 29, 1, 16, 24) fem-convergence-cpp 13.3756 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 29, 1, 16, 25) fem-jit-python 0.000413704 "JIT compilation (in memory cache)"
+(2012, 9, 29, 1, 22, 42) fem-speedup-cpp 376.965 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 29, 1, 22, 42) fem-speedup-cpp-assembly 6.23284 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 29, 1, 22, 42) fem-speedup-cpp-solve 1.65074 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 29, 1, 23, 8) mesh-refinement-cpp 24.0957 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 29, 1, 23, 29) mesh-topology-cpp 20.771 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 29, 1, 23, 52) mesh-unitcube-cpp 22.8637 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 29, 1, 24, 42) mesh-iteration-cpp 47.9873 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 29, 1, 25, 4) function-evaluation-cpp 21.9068 "Evaluations of functions at arbitrary points."
+(2012, 9, 29, 1, 25, 4) function-evaluation-cpp 21.8096 "Evaluations of functions at arbitrary points."
+(2012, 9, 29, 1, 25, 10) function-extrapolation-python 5.53809 "BENCH:  1.93129992485"
+(2012, 9, 29, 1, 25, 10) function-extrapolation-python 1.9313 "BENCH:  1.93129992485"
+(2012, 9, 29, 1, 25, 33) la-vector-access-cpp 23.0662 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 29, 1, 25, 58) la-vector-assignment-cpp 25.5173 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 9, 30, 1, 11, 8) common-progress-cpp 29.5861 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 9, 30, 1, 11, 37) common-timing-cpp 28.4111 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 9, 30, 1, 13, 25) fem-multicore-cpp 108.645 "Coloring mesh."
+(2012, 9, 30, 1, 15, 48) fem-assembly-cpp 142.402 "Assembly for various forms and backends"
+(2012, 9, 30, 1, 16, 1) fem-convergence-cpp 13.3853 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 9, 30, 1, 16, 2) fem-jit-python 0.000404596 "JIT compilation (in memory cache)"
+(2012, 9, 30, 1, 22, 5) fem-speedup-cpp 362.844 "Assembly/solve speedup running on 4 processors"
+(2012, 9, 30, 1, 22, 5) fem-speedup-cpp-assembly 5.97461 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 9, 30, 1, 22, 5) fem-speedup-cpp-solve 1.88495 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 9, 30, 1, 22, 30) mesh-refinement-cpp 23.9759 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 9, 30, 1, 22, 52) mesh-topology-cpp 20.7914 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 9, 30, 1, 23, 14) mesh-unitcube-cpp 22.8583 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 9, 30, 1, 23, 58) mesh-iteration-cpp 41.0752 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 9, 30, 1, 24, 20) function-evaluation-cpp 21.881 "Evaluations of functions at arbitrary points."
+(2012, 9, 30, 1, 24, 20) function-evaluation-cpp 21.8001 "Evaluations of functions at arbitrary points."
+(2012, 9, 30, 1, 24, 25) function-extrapolation-python 5.35302 "BENCH:  1.89962601662"
+(2012, 9, 30, 1, 24, 25) function-extrapolation-python 1.89963 "BENCH:  1.89962601662"
+(2012, 9, 30, 1, 24, 49) la-vector-access-cpp 23.6877 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 9, 30, 1, 25, 15) la-vector-assignment-cpp 25.5145 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 1, 1, 14, 26) common-progress-cpp 29.7977 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 1, 1, 14, 55) common-timing-cpp 28.9869 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 1, 1, 16, 43) fem-multicore-cpp 107.883 "Coloring mesh."
+(2012, 10, 1, 1, 19, 6) fem-assembly-cpp 142.334 "Assembly for various forms and backends"
+(2012, 10, 1, 1, 19, 19) fem-convergence-cpp 13.3669 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 1, 1, 19, 20) fem-jit-python 0.000411797 "JIT compilation (in memory cache)"
+(2012, 10, 1, 1, 25, 44) fem-speedup-cpp 384.676 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 1, 1, 25, 44) fem-speedup-cpp-assembly 6.21876 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 1, 1, 25, 44) fem-speedup-cpp-solve 1.55803 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 1, 1, 26, 10) mesh-refinement-cpp 24.001 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 1, 1, 26, 31) mesh-topology-cpp 20.7638 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 1, 1, 26, 54) mesh-unitcube-cpp 22.8602 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 1, 1, 27, 37) mesh-iteration-cpp 41.0101 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 1, 1, 27, 59) function-evaluation-cpp 21.5396 "Evaluations of functions at arbitrary points."
+(2012, 10, 1, 1, 27, 59) function-evaluation-cpp 21.4428 "Evaluations of functions at arbitrary points."
+(2012, 10, 1, 1, 28, 4) function-extrapolation-python 5.29918 "BENCH:  1.90193295479"
+(2012, 10, 1, 1, 28, 4) function-extrapolation-python 1.90193 "BENCH:  1.90193295479"
+(2012, 10, 1, 1, 28, 26) la-vector-access-cpp 22.248 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 1, 1, 28, 52) la-vector-assignment-cpp 25.519 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 2, 1, 11, 10) common-progress-cpp 29.6006 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 2, 1, 11, 39) common-timing-cpp 28.3973 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 2, 1, 13, 28) fem-multicore-cpp 108.952 "Coloring mesh."
+(2012, 10, 2, 1, 15, 52) fem-assembly-cpp 143.9 "Assembly for various forms and backends"
+(2012, 10, 2, 1, 16, 5) fem-convergence-cpp 13.3715 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 2, 1, 16, 6) fem-jit-python 0.000425506 "JIT compilation (in memory cache)"
+(2012, 10, 2, 1, 22, 32) fem-speedup-cpp 386.403 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 2, 1, 22, 32) fem-speedup-cpp-assembly 6.12962 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 2, 1, 22, 32) fem-speedup-cpp-solve 1.53724 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 2, 1, 22, 58) mesh-refinement-cpp 24.0623 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 2, 1, 23, 19) mesh-topology-cpp 20.7278 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 2, 1, 23, 42) mesh-unitcube-cpp 22.8369 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 2, 1, 24, 25) mesh-iteration-cpp 41.0071 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 2, 1, 24, 47) function-evaluation-cpp 21.8894 "Evaluations of functions at arbitrary points."
+(2012, 10, 2, 1, 24, 47) function-evaluation-cpp 21.794 "Evaluations of functions at arbitrary points."
+(2012, 10, 2, 1, 24, 53) function-extrapolation-python 5.35678 "BENCH:  1.90628290176"
+(2012, 10, 2, 1, 24, 53) function-extrapolation-python 1.90628 "BENCH:  1.90628290176"
+(2012, 10, 2, 1, 25, 15) la-vector-access-cpp 22.2436 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 2, 1, 25, 41) la-vector-assignment-cpp 25.5693 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 3, 1, 11, 17) common-progress-cpp 29.569 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 3, 1, 11, 45) common-timing-cpp 28.3248 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 3, 1, 13, 34) fem-multicore-cpp 109.109 "Coloring mesh."
+(2012, 10, 3, 1, 15, 57) fem-assembly-cpp 142.903 "Assembly for various forms and backends"
+(2012, 10, 3, 1, 16, 10) fem-convergence-cpp 13.384 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 3, 1, 16, 11) fem-jit-python 0.000418591 "JIT compilation (in memory cache)"
+(2012, 10, 3, 1, 22, 26) fem-speedup-cpp 374.484 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 3, 1, 22, 26) fem-speedup-cpp-assembly 6.09382 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 3, 1, 22, 26) fem-speedup-cpp-solve 1.70573 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 3, 1, 22, 51) mesh-refinement-cpp 23.7131 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 3, 1, 23, 12) mesh-topology-cpp 20.7221 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 3, 1, 23, 34) mesh-unitcube-cpp 21.9531 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 3, 1, 24, 21) mesh-iteration-cpp 44.4199 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 3, 1, 24, 43) function-evaluation-cpp 21.82 "Evaluations of functions at arbitrary points."
+(2012, 10, 3, 1, 24, 43) function-evaluation-cpp 21.7338 "Evaluations of functions at arbitrary points."
+(2012, 10, 3, 1, 24, 48) function-extrapolation-python 5.53245 "BENCH:  1.93266105652"
+(2012, 10, 3, 1, 24, 48) function-extrapolation-python 1.93266 "BENCH:  1.93266105652"
+(2012, 10, 3, 1, 25, 13) la-vector-access-cpp 24.8894 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 3, 1, 25, 39) la-vector-assignment-cpp 25.5064 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 4, 1, 11, 11) common-progress-cpp 36.4362 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 4, 1, 11, 41) common-timing-cpp 29.8187 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 4, 1, 13, 29) fem-multicore-cpp 108.076 "Coloring mesh."
+(2012, 10, 4, 1, 15, 52) fem-assembly-cpp 143.135 "Assembly for various forms and backends"
+(2012, 10, 4, 1, 16, 6) fem-convergence-cpp 13.3825 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 4, 1, 16, 7) fem-jit-python 0.000425911 "JIT compilation (in memory cache)"
+(2012, 10, 4, 1, 22, 14) fem-speedup-cpp 367.408 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 4, 1, 22, 14) fem-speedup-cpp-assembly 6.25707 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 4, 1, 22, 14) fem-speedup-cpp-solve 1.82569 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 4, 1, 22, 39) mesh-refinement-cpp 23.6219 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 4, 1, 23, 0) mesh-topology-cpp 20.9927 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 4, 1, 23, 22) mesh-unitcube-cpp 21.5831 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 4, 1, 24, 4) mesh-iteration-cpp 39.8708 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 4, 1, 24, 26) function-evaluation-cpp 21.9227 "Evaluations of functions at arbitrary points."
+(2012, 10, 4, 1, 24, 26) function-evaluation-cpp 21.8203 "Evaluations of functions at arbitrary points."
+(2012, 10, 4, 1, 24, 32) function-extrapolation-python 5.44318 "BENCH:  1.94250607491"
+(2012, 10, 4, 1, 24, 32) function-extrapolation-python 1.94251 "BENCH:  1.94250607491"
+(2012, 10, 4, 1, 24, 57) la-vector-access-cpp 24.9693 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 4, 1, 25, 25) la-vector-assignment-cpp 28.3925 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 5, 1, 10, 47) common-progress-cpp 29.6076 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 5, 1, 11, 17) common-timing-cpp 29.8419 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 5, 1, 13, 5) fem-multicore-cpp 108.098 "Coloring mesh."
+(2012, 10, 5, 1, 15, 29) fem-assembly-cpp 143.573 "Assembly for various forms and backends"
+(2012, 10, 5, 1, 15, 42) fem-convergence-cpp 13.3563 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 5, 1, 15, 43) fem-jit-python 0.000414705 "JIT compilation (in memory cache)"
+(2012, 10, 5, 1, 22, 10) fem-speedup-cpp 386.838 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 5, 1, 22, 10) fem-speedup-cpp-assembly 6.18296 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 5, 1, 22, 10) fem-speedup-cpp-solve 1.55 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 5, 1, 22, 35) mesh-refinement-cpp 23.6266 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 5, 1, 22, 56) mesh-topology-cpp 21.036 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 5, 1, 23, 18) mesh-unitcube-cpp 21.9407 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 5, 1, 24, 0) mesh-iteration-cpp 39.8735 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 5, 1, 24, 22) function-evaluation-cpp 21.9317 "Evaluations of functions at arbitrary points."
+(2012, 10, 5, 1, 24, 22) function-evaluation-cpp 21.8358 "Evaluations of functions at arbitrary points."
+(2012, 10, 5, 1, 24, 28) function-extrapolation-python 5.52398 "BENCH:  1.90278792381"
+(2012, 10, 5, 1, 24, 28) function-extrapolation-python 1.90279 "BENCH:  1.90278792381"
+(2012, 10, 5, 1, 24, 56) la-vector-access-cpp 27.8847 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 5, 1, 25, 21) la-vector-assignment-cpp 25.5232 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 6, 1, 11, 4) common-progress-cpp 29.5893 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 6, 1, 11, 33) common-timing-cpp 29.3947 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 6, 1, 13, 48) fem-multicore-cpp 134.171 "Coloring mesh."
+(2012, 10, 6, 1, 20, 49) fem-assembly-cpp 421.039 "Assembly for various forms and backends"
+(2012, 10, 6, 1, 21, 2) fem-convergence-cpp 13.0996 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 6, 1, 21, 2) fem-jit-python 0.000415993 "JIT compilation (in memory cache)"
+(2012, 10, 6, 2, 16, 7) fem-speedup-cpp 3304.04 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 6, 2, 16, 7) fem-speedup-cpp-assembly 6.22398 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 6, 2, 16, 7) fem-speedup-cpp-solve 1.92808 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 6, 2, 16, 32) mesh-refinement-cpp 23.9863 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 6, 2, 16, 53) mesh-topology-cpp 20.7132 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 6, 2, 17, 17) mesh-unitcube-cpp 24.2534 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 6, 2, 18, 0) mesh-iteration-cpp 39.8714 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 6, 2, 18, 28) function-evaluation-cpp 28.4574 "Evaluations of functions at arbitrary points."
+(2012, 10, 6, 2, 18, 28) function-evaluation-cpp 28.3718 "Evaluations of functions at arbitrary points."
+(2012, 10, 6, 2, 18, 34) function-extrapolation-python 5.49477 "BENCH:  1.94015908241"
+(2012, 10, 6, 2, 18, 34) function-extrapolation-python 1.94016 "BENCH:  1.94015908241"
+(2012, 10, 6, 2, 18, 59) la-vector-access-cpp 24.8462 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 6, 2, 19, 24) la-vector-assignment-cpp 25.5061 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 7, 1, 11, 3) common-progress-cpp 29.8116 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 7, 1, 11, 31) common-timing-cpp 28.1932 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 7, 1, 13, 47) fem-multicore-cpp 135.999 "Coloring mesh."
+(2012, 10, 7, 1, 20, 51) fem-assembly-cpp 424.349 "Assembly for various forms and backends"
+(2012, 10, 7, 1, 21, 4) fem-convergence-cpp 13.2273 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 7, 1, 21, 5) fem-jit-python 0.00043571 "JIT compilation (in memory cache)"
+(2012, 10, 7, 2, 16, 28) fem-speedup-cpp 3323.09 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 7, 2, 16, 28) fem-speedup-cpp-assembly 6.27355 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 7, 2, 16, 28) fem-speedup-cpp-solve 1.53843 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 7, 2, 16, 54) mesh-refinement-cpp 23.8286 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 7, 2, 17, 15) mesh-topology-cpp 20.826 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 7, 2, 17, 39) mesh-unitcube-cpp 23.9602 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 7, 2, 18, 27) mesh-iteration-cpp 46.0029 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 7, 2, 18, 56) function-evaluation-cpp 28.4519 "Evaluations of functions at arbitrary points."
+(2012, 10, 7, 2, 18, 56) function-evaluation-cpp 28.3571 "Evaluations of functions at arbitrary points."
+(2012, 10, 7, 2, 19, 2) function-extrapolation-python 5.54058 "BENCH:  1.9537229538"
+(2012, 10, 7, 2, 19, 2) function-extrapolation-python 1.95372 "BENCH:  1.9537229538"
+(2012, 10, 7, 2, 19, 24) la-vector-access-cpp 22.4965 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 7, 2, 19, 50) la-vector-assignment-cpp 25.4159 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 8, 1, 11, 7) common-progress-cpp 36.4363 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 8, 1, 11, 35) common-timing-cpp 28.1186 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 8, 1, 13, 50) fem-multicore-cpp 134.317 "Coloring mesh."
+(2012, 10, 8, 1, 20, 57) fem-assembly-cpp 426.917 "Assembly for various forms and backends"
+(2012, 10, 8, 1, 21, 10) fem-convergence-cpp 13.2095 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 8, 1, 21, 11) fem-jit-python 0.000414491 "JIT compilation (in memory cache)"
+(2012, 10, 8, 2, 16, 35) fem-speedup-cpp 3324.54 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 8, 2, 16, 35) fem-speedup-cpp-assembly 6.07838 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 8, 2, 16, 35) fem-speedup-cpp-solve 1.86639 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 8, 2, 17, 0) mesh-refinement-cpp 23.8644 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 8, 2, 17, 21) mesh-topology-cpp 20.7884 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 8, 2, 17, 46) mesh-unitcube-cpp 24.7006 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 8, 2, 18, 28) mesh-iteration-cpp 39.877 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 8, 2, 18, 57) function-evaluation-cpp 28.4609 "Evaluations of functions at arbitrary points."
+(2012, 10, 8, 2, 18, 57) function-evaluation-cpp 28.3395 "Evaluations of functions at arbitrary points."
+(2012, 10, 8, 2, 19, 2) function-extrapolation-python 4.85098 "BENCH:  1.88601994514"
+(2012, 10, 8, 2, 19, 2) function-extrapolation-python 1.88602 "BENCH:  1.88601994514"
+(2012, 10, 8, 2, 19, 27) la-vector-access-cpp 24.9781 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 8, 2, 19, 52) la-vector-assignment-cpp 25.5121 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 10, 1, 10, 55) common-progress-cpp 29.6756 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 10, 1, 11, 26) common-timing-cpp 31.2842 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 10, 1, 13, 15) fem-multicore-cpp 108.393 "Coloring mesh."
+(2012, 10, 10, 1, 15, 40) fem-assembly-cpp 145.062 "Assembly for various forms and backends"
+(2012, 10, 10, 1, 15, 53) fem-convergence-cpp 12.8455 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 10, 1, 15, 53) fem-jit-python 0.000422287 "JIT compilation (in memory cache)"
+(2012, 10, 10, 1, 22, 16) fem-speedup-cpp 382.598 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 10, 1, 22, 16) fem-speedup-cpp-assembly 6.27907 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 10, 1, 22, 16) fem-speedup-cpp-solve 1.60051 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 10, 1, 22, 42) mesh-refinement-cpp 23.8081 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 10, 1, 23, 2) mesh-topology-cpp 20.4471 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 10, 1, 23, 28) mesh-unitcube-cpp 25.2329 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 10, 1, 24, 10) mesh-iteration-cpp 39.8649 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 10, 1, 24, 32) function-evaluation-cpp 21.9984 "Evaluations of functions at arbitrary points."
+(2012, 10, 10, 1, 24, 32) function-evaluation-cpp 21.8963 "Evaluations of functions at arbitrary points."
+(2012, 10, 10, 1, 24, 38) function-extrapolation-python 5.44042 "BENCH:  1.89774489403"
+(2012, 10, 10, 1, 24, 38) function-extrapolation-python 1.89774 "BENCH:  1.89774489403"
+(2012, 10, 10, 1, 25, 3) la-vector-access-cpp 24.9716 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 10, 1, 25, 31) la-vector-assignment-cpp 27.8934 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 11, 1, 11, 9) common-progress-cpp 29.7959 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 11, 1, 11, 38) common-timing-cpp 29.7389 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 11, 1, 13, 26) fem-multicore-cpp 107.618 "Coloring mesh."
+(2012, 10, 11, 1, 15, 50) fem-assembly-cpp 143.99 "Assembly for various forms and backends"
+(2012, 10, 11, 1, 16, 3) fem-convergence-cpp 13.283 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 11, 1, 16, 4) fem-jit-python 0.000419879 "JIT compilation (in memory cache)"
+(2012, 10, 11, 1, 22, 10) fem-speedup-cpp 366.102 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 11, 1, 22, 10) fem-speedup-cpp-assembly 6.16601 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 11, 1, 22, 10) fem-speedup-cpp-solve 1.88006 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 11, 1, 22, 36) mesh-refinement-cpp 23.9996 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 11, 1, 22, 57) mesh-topology-cpp 20.6914 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 11, 1, 23, 22) mesh-unitcube-cpp 25.1739 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 11, 1, 24, 7) mesh-iteration-cpp 41.7616 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 11, 1, 24, 28) function-evaluation-cpp 21.7646 "Evaluations of functions at arbitrary points."
+(2012, 10, 11, 1, 24, 28) function-evaluation-cpp 21.6625 "Evaluations of functions at arbitrary points."
+(2012, 10, 11, 1, 24, 34) function-extrapolation-python 5.38501 "BENCH:  1.8960211277"
+(2012, 10, 11, 1, 24, 34) function-extrapolation-python 1.89602 "BENCH:  1.8960211277"
+(2012, 10, 11, 1, 24, 59) la-vector-access-cpp 24.997 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 11, 1, 25, 27) la-vector-assignment-cpp 27.8964 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 12, 1, 11, 4) common-progress-cpp 29.6314 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 12, 1, 11, 34) common-timing-cpp 30.112 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 12, 1, 13, 21) fem-multicore-cpp 107.016 "Coloring mesh."
+(2012, 10, 12, 1, 15, 44) fem-assembly-cpp 143.37 "Assembly for various forms and backends"
+(2012, 10, 12, 1, 15, 57) fem-convergence-cpp 13.0292 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 12, 1, 15, 58) fem-jit-python 0.000414109 "JIT compilation (in memory cache)"
+(2012, 10, 12, 1, 22, 28) fem-speedup-cpp 389.83 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 12, 1, 22, 28) fem-speedup-cpp-assembly 6.15052 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 12, 1, 22, 28) fem-speedup-cpp-solve 1.51194 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 12, 1, 22, 53) mesh-refinement-cpp 23.8275 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 12, 1, 23, 14) mesh-topology-cpp 20.6546 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 12, 1, 23, 39) mesh-unitcube-cpp 25.149 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 12, 1, 24, 22) mesh-iteration-cpp 39.8918 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 12, 1, 24, 44) function-evaluation-cpp 21.8857 "Evaluations of functions at arbitrary points."
+(2012, 10, 12, 1, 24, 44) function-evaluation-cpp 21.7849 "Evaluations of functions at arbitrary points."
+(2012, 10, 12, 1, 24, 50) function-extrapolation-python 5.70246 "BENCH:  1.89557099342"
+(2012, 10, 12, 1, 24, 50) function-extrapolation-python 1.89557 "BENCH:  1.89557099342"
+(2012, 10, 12, 1, 25, 18) la-vector-access-cpp 27.885 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 12, 1, 25, 50) la-vector-assignment-cpp 31.9626 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 13, 1, 11, 6) common-progress-cpp 29.7911 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 13, 1, 11, 34) common-timing-cpp 28.1414 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 13, 1, 13, 21) fem-multicore-cpp 107.134 "Coloring mesh."
+(2012, 10, 13, 1, 15, 46) fem-assembly-cpp 145.19 "Assembly for various forms and backends"
+(2012, 10, 13, 1, 16, 0) fem-convergence-cpp 13.1017 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 13, 1, 16, 0) fem-jit-python 0.000406003 "JIT compilation (in memory cache)"
+(2012, 10, 13, 1, 22, 4) fem-speedup-cpp 363.206 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 13, 1, 22, 4) fem-speedup-cpp-assembly 6.16716 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 13, 1, 22, 4) fem-speedup-cpp-solve 1.89728 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 13, 1, 22, 29) mesh-refinement-cpp 23.6697 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 13, 1, 22, 49) mesh-topology-cpp 20.3828 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 13, 1, 23, 15) mesh-unitcube-cpp 25.1925 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 13, 1, 23, 59) mesh-iteration-cpp 42.1989 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 13, 1, 24, 21) function-evaluation-cpp 21.8454 "Evaluations of functions at arbitrary points."
+(2012, 10, 13, 1, 24, 21) function-evaluation-cpp 21.7607 "Evaluations of functions at arbitrary points."
+(2012, 10, 13, 1, 24, 27) function-extrapolation-python 5.42938 "BENCH:  1.89672780037"
+(2012, 10, 13, 1, 24, 27) function-extrapolation-python 1.89673 "BENCH:  1.89672780037"
+(2012, 10, 13, 1, 24, 52) la-vector-access-cpp 25.0082 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 13, 1, 25, 20) la-vector-assignment-cpp 27.8997 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 14, 1, 10, 59) common-progress-cpp 29.6104 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 14, 1, 11, 28) common-timing-cpp 29.303 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 14, 1, 13, 17) fem-multicore-cpp 108.286 "Coloring mesh."
+(2012, 10, 14, 1, 15, 42) fem-assembly-cpp 145.013 "Assembly for various forms and backends"
+(2012, 10, 14, 1, 15, 55) fem-convergence-cpp 13.1318 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 14, 1, 15, 56) fem-jit-python 0.000409698 "JIT compilation (in memory cache)"
+(2012, 10, 14, 1, 22, 5) fem-speedup-cpp 369.518 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 14, 1, 22, 5) fem-speedup-cpp-assembly 6.18168 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 14, 1, 22, 5) fem-speedup-cpp-solve 1.78852 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 14, 1, 22, 30) mesh-refinement-cpp 23.6548 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 14, 1, 22, 51) mesh-topology-cpp 20.4598 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 14, 1, 23, 16) mesh-unitcube-cpp 25.1253 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 14, 1, 23, 59) mesh-iteration-cpp 39.8827 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 14, 1, 24, 21) function-evaluation-cpp 21.9072 "Evaluations of functions at arbitrary points."
+(2012, 10, 14, 1, 24, 21) function-evaluation-cpp 21.8176 "Evaluations of functions at arbitrary points."
+(2012, 10, 14, 1, 24, 26) function-extrapolation-python 5.48543 "BENCH:  1.89035010338"
+(2012, 10, 14, 1, 24, 26) function-extrapolation-python 1.89035 "BENCH:  1.89035010338"
+(2012, 10, 14, 1, 24, 54) la-vector-access-cpp 27.896 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 14, 1, 25, 22) la-vector-assignment-cpp 27.9296 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 15, 1, 11, 3) common-progress-cpp 29.6303 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 15, 1, 11, 31) common-timing-cpp 28.7557 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 15, 1, 13, 18) fem-multicore-cpp 106.775 "Coloring mesh."
+(2012, 10, 15, 1, 15, 42) fem-assembly-cpp 143.434 "Assembly for various forms and backends"
+(2012, 10, 15, 1, 15, 55) fem-convergence-cpp 13.1809 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 15, 1, 15, 56) fem-jit-python 0.000412297 "JIT compilation (in memory cache)"
+(2012, 10, 15, 1, 22, 2) fem-speedup-cpp 365.924 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 15, 1, 22, 2) fem-speedup-cpp-assembly 6.21584 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 15, 1, 22, 2) fem-speedup-cpp-solve 1.84441 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 15, 1, 22, 27) mesh-refinement-cpp 23.7086 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 15, 1, 22, 48) mesh-topology-cpp 20.4438 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 15, 1, 23, 13) mesh-unitcube-cpp 24.9571 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 15, 1, 23, 55) mesh-iteration-cpp 39.8855 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 15, 1, 24, 17) function-evaluation-cpp 22.0873 "Evaluations of functions at arbitrary points."
+(2012, 10, 15, 1, 24, 17) function-evaluation-cpp 21.9876 "Evaluations of functions at arbitrary points."
+(2012, 10, 15, 1, 24, 23) function-extrapolation-python 5.46758 "BENCH:  1.88941311836"
+(2012, 10, 15, 1, 24, 23) function-extrapolation-python 1.88941 "BENCH:  1.88941311836"
+(2012, 10, 15, 1, 24, 48) la-vector-access-cpp 25.0158 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 15, 1, 25, 18) la-vector-assignment-cpp 29.8982 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 16, 1, 11, 2) common-progress-cpp 29.6326 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 16, 1, 11, 31) common-timing-cpp 28.9816 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 16, 1, 13, 18) fem-multicore-cpp 107.339 "Coloring mesh."
+(2012, 10, 16, 1, 15, 42) fem-assembly-cpp 144.256 "Assembly for various forms and backends"
+(2012, 10, 16, 1, 15, 56) fem-convergence-cpp 13.0873 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 16, 1, 15, 56) fem-jit-python 0.00041759 "JIT compilation (in memory cache)"
+(2012, 10, 16, 1, 22, 20) fem-speedup-cpp 383.173 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 16, 1, 22, 20) fem-speedup-cpp-assembly 6.16102 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 16, 1, 22, 20) fem-speedup-cpp-solve 1.58601 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 16, 1, 22, 45) mesh-refinement-cpp 23.7392 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 16, 1, 23, 6) mesh-topology-cpp 20.4203 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 16, 1, 23, 31) mesh-unitcube-cpp 24.9546 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 16, 1, 24, 13) mesh-iteration-cpp 39.8789 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 16, 1, 24, 35) function-evaluation-cpp 21.9034 "Evaluations of functions at arbitrary points."
+(2012, 10, 16, 1, 24, 35) function-evaluation-cpp 21.8018 "Evaluations of functions at arbitrary points."
+(2012, 10, 16, 1, 24, 41) function-extrapolation-python 5.57063 "BENCH:  1.88705778122"
+(2012, 10, 16, 1, 24, 41) function-extrapolation-python 1.88706 "BENCH:  1.88705778122"
+(2012, 10, 16, 1, 25, 9) la-vector-access-cpp 27.881 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 16, 1, 25, 37) la-vector-assignment-cpp 27.8991 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 17, 1, 11, 23) common-progress-cpp 47.7146 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 17, 1, 11, 53) common-timing-cpp 29.3424 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 17, 1, 13, 40) fem-multicore-cpp 107.024 "Coloring mesh."
+(2012, 10, 17, 1, 16, 3) fem-assembly-cpp 143.514 "Assembly for various forms and backends"
+(2012, 10, 17, 1, 16, 16) fem-convergence-cpp 13.2208 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 17, 1, 16, 17) fem-jit-python 0.000418711 "JIT compilation (in memory cache)"
+(2012, 10, 17, 1, 22, 20) fem-speedup-cpp 362.632 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 17, 1, 22, 20) fem-speedup-cpp-assembly 6.15154 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 17, 1, 22, 20) fem-speedup-cpp-solve 1.88051 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 17, 1, 22, 45) mesh-refinement-cpp 23.7093 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 17, 1, 23, 6) mesh-topology-cpp 20.4665 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 17, 1, 23, 31) mesh-unitcube-cpp 24.9678 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 17, 1, 24, 13) mesh-iteration-cpp 39.8805 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 17, 1, 24, 35) function-evaluation-cpp 21.9202 "Evaluations of functions at arbitrary points."
+(2012, 10, 17, 1, 24, 35) function-evaluation-cpp 21.8163 "Evaluations of functions at arbitrary points."
+(2012, 10, 17, 1, 24, 41) function-extrapolation-python 5.50883 "BENCH:  1.90085911751"
+(2012, 10, 17, 1, 24, 41) function-extrapolation-python 1.90086 "BENCH:  1.90085911751"
+(2012, 10, 17, 1, 25, 9) la-vector-access-cpp 27.9921 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 17, 1, 25, 37) la-vector-assignment-cpp 27.9122 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 18, 1, 10, 57) common-progress-cpp 37.6863 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 18, 1, 11, 26) common-timing-cpp 28.8341 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 18, 1, 13, 13) fem-multicore-cpp 106.985 "Coloring mesh."
+(2012, 10, 18, 1, 15, 36) fem-assembly-cpp 143.382 "Assembly for various forms and backends"
+(2012, 10, 18, 1, 15, 49) fem-convergence-cpp 13.1261 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 18, 1, 15, 50) fem-jit-python 0.000414801 "JIT compilation (in memory cache)"
+(2012, 10, 18, 1, 22, 4) fem-speedup-cpp 373.573 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 18, 1, 22, 4) fem-speedup-cpp-assembly 6.39121 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 18, 1, 22, 4) fem-speedup-cpp-solve 1.705 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 18, 1, 22, 29) mesh-refinement-cpp 23.7853 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 18, 1, 22, 50) mesh-topology-cpp 20.4528 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 18, 1, 23, 15) mesh-unitcube-cpp 24.9561 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 18, 1, 23, 59) mesh-iteration-cpp 41.6841 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 18, 1, 24, 21) function-evaluation-cpp 21.9286 "Evaluations of functions at arbitrary points."
+(2012, 10, 18, 1, 24, 21) function-evaluation-cpp 21.8291 "Evaluations of functions at arbitrary points."
+(2012, 10, 18, 1, 24, 27) function-extrapolation-python 5.50077 "BENCH:  1.90567708015"
+(2012, 10, 18, 1, 24, 27) function-extrapolation-python 1.90568 "BENCH:  1.90567708015"
+(2012, 10, 18, 1, 24, 52) la-vector-access-cpp 25.0288 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 18, 1, 25, 24) la-vector-assignment-cpp 31.9189 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 10, 19, 1, 11, 9) common-progress-cpp 29.7909 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 10, 19, 1, 11, 39) common-timing-cpp 29.2514 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 10, 19, 1, 13, 28) fem-multicore-cpp 109.284 "Coloring mesh."
+(2012, 10, 19, 1, 15, 51) fem-assembly-cpp 143.255 "Assembly for various forms and backends"
+(2012, 10, 19, 1, 16, 4) fem-convergence-cpp 13.1273 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 10, 19, 1, 16, 5) fem-jit-python 0.000416088 "JIT compilation (in memory cache)"
+(2012, 10, 19, 1, 22, 28) fem-speedup-cpp 383.027 "Assembly/solve speedup running on 4 processors"
+(2012, 10, 19, 1, 22, 28) fem-speedup-cpp-assembly 6.22418 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 10, 19, 1, 22, 28) fem-speedup-cpp-solve 1.57998 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 10, 19, 1, 22, 53) mesh-refinement-cpp 23.7088 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 10, 19, 1, 23, 14) mesh-topology-cpp 20.4493 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 10, 19, 1, 23, 39) mesh-unitcube-cpp 25.0553 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 10, 19, 1, 24, 28) mesh-iteration-cpp 46.0101 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 10, 19, 1, 24, 50) function-evaluation-cpp 21.9119 "Evaluations of functions at arbitrary points."
+(2012, 10, 19, 1, 24, 50) function-evaluation-cpp 21.8117 "Evaluations of functions at arbitrary points."
+(2012, 10, 19, 1, 24, 56) function-extrapolation-python 5.75036 "BENCH:  1.90998411179"
+(2012, 10, 19, 1, 24, 56) function-extrapolation-python 1.90998 "BENCH:  1.90998411179"
+(2012, 10, 19, 1, 25, 21) la-vector-access-cpp 24.9921 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 10, 19, 1, 25, 49) la-vector-assignment-cpp 27.8993 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 1, 15, 5, 58) common-progress-cpp 36.4445 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 1, 15, 6, 26) common-timing-cpp 27.9173 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 1, 15, 8, 14) fem-multicore-cpp 107.797 "Coloring mesh."
+(2012, 11, 1, 15, 10, 38) fem-assembly-cpp 144.005 "Assembly for various forms and backends"
+(2012, 11, 1, 15, 10, 49) fem-convergence-cpp 11.4147 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 1, 15, 10, 50) fem-jit-python 0.000419116 "JIT compilation (in memory cache)"
+(2012, 11, 1, 15, 16, 13) fem-speedup-cpp 322.674 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 1, 15, 16, 13) fem-speedup-cpp-assembly 6.36108 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 1, 15, 16, 13) fem-speedup-cpp-solve 2.18473 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 1, 15, 16, 39) mesh-refinement-cpp 24.2369 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 1, 15, 17, 0) mesh-topology-cpp 20.8887 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 1, 15, 17, 28) mesh-unitcube-cpp 27.4108 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 1, 15, 18, 11) mesh-iteration-cpp 39.8901 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 1, 15, 18, 32) function-evaluation-cpp 21.7326 "Evaluations of functions at arbitrary points."
+(2012, 11, 1, 15, 18, 32) function-evaluation-cpp 21.6272 "Evaluations of functions at arbitrary points."
+(2012, 11, 1, 15, 18, 38) function-extrapolation-python 5.16388 "BENCH:  1.91285610199"
+(2012, 11, 1, 15, 18, 38) function-extrapolation-python 1.91286 "BENCH:  1.91285610199"
+(2012, 11, 1, 15, 19, 2) la-vector-access-cpp 24.0428 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 1, 15, 19, 29) la-vector-assignment-cpp 27.5389 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 2, 2, 11, 51) common-progress-cpp 29.6003 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 2, 2, 12, 17) common-timing-cpp 26.192 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 2, 2, 14, 5) fem-multicore-cpp 107.897 "Coloring mesh."
+(2012, 11, 2, 2, 16, 27) fem-assembly-cpp 142.676 "Assembly for various forms and backends"
+(2012, 11, 2, 2, 16, 39) fem-convergence-cpp 11.4203 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 2, 2, 16, 40) fem-jit-python 0.000414681 "JIT compilation (in memory cache)"
+(2012, 11, 2, 2, 22, 34) fem-speedup-cpp 354.373 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 2, 2, 22, 34) fem-speedup-cpp-assembly 6.4215 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 2, 2, 22, 34) fem-speedup-cpp-solve 1.55178 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 2, 2, 23, 0) mesh-refinement-cpp 23.9968 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 2, 2, 23, 21) mesh-topology-cpp 20.6611 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 2, 2, 23, 48) mesh-unitcube-cpp 27.3273 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 2, 2, 24, 31) mesh-iteration-cpp 39.8803 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 2, 2, 24, 52) function-evaluation-cpp 21.2047 "Evaluations of functions at arbitrary points."
+(2012, 11, 2, 2, 24, 52) function-evaluation-cpp 21.1056 "Evaluations of functions at arbitrary points."
+(2012, 11, 2, 2, 24, 58) function-extrapolation-python 5.29053 "BENCH:  1.87143492699"
+(2012, 11, 2, 2, 24, 58) function-extrapolation-python 1.87143 "BENCH:  1.87143492699"
+(2012, 11, 2, 2, 25, 21) la-vector-access-cpp 23.2768 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 2, 2, 25, 49) la-vector-assignment-cpp 27.4323 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 3, 2, 11, 42) common-progress-cpp 28.9295 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 3, 2, 12, 10) common-timing-cpp 27.4472 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 3, 2, 13, 58) fem-multicore-cpp 108.795 "Coloring mesh."
+(2012, 11, 3, 2, 16, 22) fem-assembly-cpp 143.373 "Assembly for various forms and backends"
+(2012, 11, 3, 2, 16, 33) fem-convergence-cpp 11.4252 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 3, 2, 16, 34) fem-jit-python 0.00041132 "JIT compilation (in memory cache)"
+(2012, 11, 3, 2, 21, 50) fem-speedup-cpp 315.672 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 3, 2, 21, 50) fem-speedup-cpp-assembly 6.45748 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 3, 2, 21, 50) fem-speedup-cpp-solve 2.37984 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 3, 2, 22, 16) mesh-refinement-cpp 24.1271 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 3, 2, 22, 37) mesh-topology-cpp 20.7534 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 3, 2, 23, 4) mesh-unitcube-cpp 27.6688 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 3, 2, 23, 53) mesh-iteration-cpp 46.1058 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 3, 2, 24, 15) function-evaluation-cpp 21.681 "Evaluations of functions at arbitrary points."
+(2012, 11, 3, 2, 24, 15) function-evaluation-cpp 21.5906 "Evaluations of functions at arbitrary points."
+(2012, 11, 3, 2, 24, 20) function-extrapolation-python 5.27907 "BENCH:  1.85399603844"
+(2012, 11, 3, 2, 24, 20) function-extrapolation-python 1.854 "BENCH:  1.85399603844"
+(2012, 11, 3, 2, 24, 46) la-vector-access-cpp 25.4366 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 3, 2, 25, 13) la-vector-assignment-cpp 27.4319 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 4, 2, 11, 32) common-progress-cpp 28.9459 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 4, 2, 11, 59) common-timing-cpp 26.7289 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 4, 2, 13, 48) fem-multicore-cpp 109.168 "Coloring mesh."
+(2012, 11, 4, 2, 16, 12) fem-assembly-cpp 143.575 "Assembly for various forms and backends"
+(2012, 11, 4, 2, 16, 23) fem-convergence-cpp 11.3999 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 4, 2, 16, 24) fem-jit-python 0.000411105 "JIT compilation (in memory cache)"
+(2012, 11, 4, 2, 21, 41) fem-speedup-cpp 317.117 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 4, 2, 21, 41) fem-speedup-cpp-assembly 6.4321 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 4, 2, 21, 41) fem-speedup-cpp-solve 2.33182 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 4, 2, 22, 7) mesh-refinement-cpp 24.173 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 4, 2, 22, 28) mesh-topology-cpp 20.6735 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 4, 2, 22, 56) mesh-unitcube-cpp 27.6971 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 4, 2, 23, 38) mesh-iteration-cpp 39.883 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 4, 2, 24, 0) function-evaluation-cpp 21.6981 "Evaluations of functions at arbitrary points."
+(2012, 11, 4, 2, 24, 0) function-evaluation-cpp 21.6002 "Evaluations of functions at arbitrary points."
+(2012, 11, 4, 2, 24, 6) function-extrapolation-python 5.19064 "BENCH:  1.86858487129"
+(2012, 11, 4, 2, 24, 6) function-extrapolation-python 1.86858 "BENCH:  1.86858487129"
+(2012, 11, 4, 2, 24, 31) la-vector-access-cpp 25.412 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 4, 2, 24, 59) la-vector-assignment-cpp 27.922 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 5, 2, 16, 33) common-progress-cpp 28.9358 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 5, 2, 17, 0) common-timing-cpp 26.9958 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 5, 2, 18, 49) fem-multicore-cpp 108.871 "Coloring mesh."
+(2012, 11, 5, 2, 21, 13) fem-assembly-cpp 143.36 "Assembly for various forms and backends"
+(2012, 11, 5, 2, 21, 24) fem-convergence-cpp 11.4351 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 5, 2, 21, 25) fem-jit-python 0.000419998 "JIT compilation (in memory cache)"
+(2012, 11, 5, 2, 26, 43) fem-speedup-cpp 318.145 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 5, 2, 26, 43) fem-speedup-cpp-assembly 6.43513 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 5, 2, 26, 43) fem-speedup-cpp-solve 2.31065 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 5, 2, 27, 9) mesh-refinement-cpp 24.1595 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 5, 2, 27, 30) mesh-topology-cpp 20.6874 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 5, 2, 27, 58) mesh-unitcube-cpp 27.6708 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 5, 2, 28, 47) mesh-iteration-cpp 46.1245 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 5, 2, 29, 9) function-evaluation-cpp 21.7343 "Evaluations of functions at arbitrary points."
+(2012, 11, 5, 2, 29, 9) function-evaluation-cpp 21.6329 "Evaluations of functions at arbitrary points."
+(2012, 11, 5, 2, 29, 14) function-extrapolation-python 5.40821 "BENCH:  1.85706400871"
+(2012, 11, 5, 2, 29, 14) function-extrapolation-python 1.85706 "BENCH:  1.85706400871"
+(2012, 11, 5, 2, 29, 40) la-vector-access-cpp 25.4278 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 5, 2, 30, 7) la-vector-assignment-cpp 27.5069 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 6, 2, 11, 54) common-progress-cpp 28.9825 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 6, 2, 12, 21) common-timing-cpp 26.9318 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 6, 2, 14, 5) fem-multicore-cpp 104.376 "Coloring mesh."
+(2012, 11, 6, 2, 16, 29) fem-assembly-cpp 143.59 "Assembly for various forms and backends"
+(2012, 11, 6, 2, 16, 40) fem-convergence-cpp 11.428 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 6, 2, 16, 41) fem-jit-python 0.000420594 "JIT compilation (in memory cache)"
+(2012, 11, 6, 2, 21, 58) fem-speedup-cpp 316.873 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 6, 2, 21, 58) fem-speedup-cpp-assembly 6.44359 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 6, 2, 21, 58) fem-speedup-cpp-solve 2.33874 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 6, 2, 22, 24) mesh-refinement-cpp 24.095 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 6, 2, 22, 45) mesh-topology-cpp 20.7545 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 6, 2, 23, 13) mesh-unitcube-cpp 27.4974 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 6, 2, 24, 7) mesh-iteration-cpp 51.0524 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 6, 2, 24, 29) function-evaluation-cpp 21.704 "Evaluations of functions at arbitrary points."
+(2012, 11, 6, 2, 24, 29) function-evaluation-cpp 21.6003 "Evaluations of functions at arbitrary points."
+(2012, 11, 6, 2, 24, 34) function-extrapolation-python 5.48166 "BENCH:  1.91927194595"
+(2012, 11, 6, 2, 24, 34) function-extrapolation-python 1.91927 "BENCH:  1.91927194595"
+(2012, 11, 6, 2, 24, 58) la-vector-access-cpp 24.0551 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 6, 2, 25, 24) la-vector-assignment-cpp 26.0356 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 7, 2, 11, 45) common-progress-cpp 28.9308 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 7, 2, 12, 11) common-timing-cpp 26.381 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 7, 2, 13, 55) fem-multicore-cpp 104.198 "Coloring mesh."
+(2012, 11, 7, 2, 16, 19) fem-assembly-cpp 144.06 "Assembly for various forms and backends"
+(2012, 11, 7, 2, 16, 31) fem-convergence-cpp 11.4373 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 7, 2, 16, 32) fem-jit-python 0.000416589 "JIT compilation (in memory cache)"
+(2012, 11, 7, 2, 21, 48) fem-speedup-cpp 316.653 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 7, 2, 21, 48) fem-speedup-cpp-assembly 6.38083 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 7, 2, 21, 48) fem-speedup-cpp-solve 2.3388 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 7, 2, 22, 14) mesh-refinement-cpp 24.0422 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 7, 2, 22, 35) mesh-topology-cpp 20.8434 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 7, 2, 23, 3) mesh-unitcube-cpp 27.504 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 7, 2, 23, 49) mesh-iteration-cpp 43.097 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 7, 2, 24, 11) function-evaluation-cpp 21.7229 "Evaluations of functions at arbitrary points."
+(2012, 11, 7, 2, 24, 11) function-evaluation-cpp 21.6206 "Evaluations of functions at arbitrary points."
+(2012, 11, 7, 2, 24, 16) function-extrapolation-python 5.34945 "BENCH:  1.92649912834"
+(2012, 11, 7, 2, 24, 16) function-extrapolation-python 1.9265 "BENCH:  1.92649912834"
+(2012, 11, 7, 2, 24, 41) la-vector-access-cpp 25.4098 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 7, 2, 25, 8) la-vector-assignment-cpp 26.0462 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 8, 2, 11, 43) common-progress-cpp 29.0081 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 8, 2, 12, 10) common-timing-cpp 27.3438 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 8, 2, 13, 56) fem-multicore-cpp 105.21 "Coloring mesh."
+(2012, 11, 8, 2, 16, 21) fem-assembly-cpp 144.998 "Assembly for various forms and backends"
+(2012, 11, 8, 2, 16, 32) fem-convergence-cpp 11.3915 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 8, 2, 16, 33) fem-jit-python 0.000414896 "JIT compilation (in memory cache)"
+(2012, 11, 8, 2, 21, 48) fem-speedup-cpp 314.792 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 8, 2, 21, 48) fem-speedup-cpp-assembly 6.32696 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 8, 2, 21, 48) fem-speedup-cpp-solve 2.39419 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 8, 2, 22, 14) mesh-refinement-cpp 24.1881 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 8, 2, 22, 35) mesh-topology-cpp 20.9319 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 8, 2, 23, 1) mesh-unitcube-cpp 26.4599 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 8, 2, 23, 47) mesh-iteration-cpp 42.6353 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 8, 2, 24, 9) function-evaluation-cpp 21.5761 "Evaluations of functions at arbitrary points."
+(2012, 11, 8, 2, 24, 9) function-evaluation-cpp 21.4752 "Evaluations of functions at arbitrary points."
+(2012, 11, 8, 2, 24, 14) function-extrapolation-python 5.40031 "BENCH:  1.85234689713"
+(2012, 11, 8, 2, 24, 14) function-extrapolation-python 1.85235 "BENCH:  1.85234689713"
+(2012, 11, 8, 2, 24, 37) la-vector-access-cpp 23.4463 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 8, 2, 25, 5) la-vector-assignment-cpp 27.4914 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 10, 2, 11, 56) common-progress-cpp 28.9608 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 10, 2, 12, 23) common-timing-cpp 27.3722 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 10, 2, 14, 7) fem-multicore-cpp 104.169 "Coloring mesh."
+(2012, 11, 10, 2, 16, 33) fem-assembly-cpp 145.387 "Assembly for various forms and backends"
+(2012, 11, 10, 2, 16, 44) fem-convergence-cpp 11.493 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 10, 2, 16, 45) fem-jit-python 0.000420904 "JIT compilation (in memory cache)"
+(2012, 11, 10, 2, 22, 2) fem-speedup-cpp 317.019 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 10, 2, 22, 2) fem-speedup-cpp-assembly 6.41965 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 10, 2, 22, 2) fem-speedup-cpp-solve 2.29975 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 10, 2, 22, 28) mesh-refinement-cpp 24.1195 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 10, 2, 22, 49) mesh-topology-cpp 20.697 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 10, 2, 23, 17) mesh-unitcube-cpp 27.503 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 10, 2, 24, 5) mesh-iteration-cpp 45.5578 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 10, 2, 24, 27) function-evaluation-cpp 21.7149 "Evaluations of functions at arbitrary points."
+(2012, 11, 10, 2, 24, 27) function-evaluation-cpp 21.6137 "Evaluations of functions at arbitrary points."
+(2012, 11, 10, 2, 24, 32) function-extrapolation-python 5.16611 "BENCH:  1.83399105072"
+(2012, 11, 10, 2, 24, 32) function-extrapolation-python 1.83399 "BENCH:  1.83399105072"
+(2012, 11, 10, 2, 24, 56) la-vector-access-cpp 23.9919 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 10, 2, 25, 24) la-vector-assignment-cpp 27.9097 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 11, 2, 12, 32) common-progress-cpp 28.9619 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 11, 2, 13, 0) common-timing-cpp 27.348 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 11, 2, 14, 45) fem-multicore-cpp 105.465 "Coloring mesh."
+(2012, 11, 11, 2, 17, 11) fem-assembly-cpp 146.202 "Assembly for various forms and backends"
+(2012, 11, 11, 2, 17, 23) fem-convergence-cpp 11.4787 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 11, 2, 17, 24) fem-jit-python 0.000419784 "JIT compilation (in memory cache)"
+(2012, 11, 11, 2, 22, 40) fem-speedup-cpp 316.689 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 11, 2, 22, 40) fem-speedup-cpp-assembly 6.39714 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 11, 2, 22, 40) fem-speedup-cpp-solve 2.36122 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 11, 2, 23, 7) mesh-refinement-cpp 24.9192 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 11, 2, 23, 28) mesh-topology-cpp 20.9472 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 11, 2, 24, 0) mesh-unitcube-cpp 31.6438 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 11, 2, 24, 43) mesh-iteration-cpp 39.882 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 11, 2, 25, 5) function-evaluation-cpp 21.7498 "Evaluations of functions at arbitrary points."
+(2012, 11, 11, 2, 25, 5) function-evaluation-cpp 21.6475 "Evaluations of functions at arbitrary points."
+(2012, 11, 11, 2, 25, 10) function-extrapolation-python 5.22367 "BENCH:  1.87814593315"
+(2012, 11, 11, 2, 25, 10) function-extrapolation-python 1.87815 "BENCH:  1.87814593315"
+(2012, 11, 11, 2, 25, 35) la-vector-access-cpp 24.9081 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 11, 2, 26, 3) la-vector-assignment-cpp 27.4879 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 12, 2, 11, 58) common-progress-cpp 28.9458 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 12, 2, 12, 26) common-timing-cpp 28.0505 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 12, 2, 14, 12) fem-multicore-cpp 105.863 "Coloring mesh."
+(2012, 11, 12, 2, 16, 38) fem-assembly-cpp 146.921 "Assembly for various forms and backends"
+(2012, 11, 12, 2, 16, 50) fem-convergence-cpp 11.5374 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 12, 2, 16, 51) fem-jit-python 0.000414801 "JIT compilation (in memory cache)"
+(2012, 11, 12, 2, 22, 8) fem-speedup-cpp 317.01 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 12, 2, 22, 8) fem-speedup-cpp-assembly 6.30255 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 12, 2, 22, 8) fem-speedup-cpp-solve 2.35125 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 12, 2, 22, 35) mesh-refinement-cpp 24.8949 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 12, 2, 22, 56) mesh-topology-cpp 20.9926 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 12, 2, 23, 28) mesh-unitcube-cpp 31.5892 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 12, 2, 24, 11) mesh-iteration-cpp 39.9205 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 12, 2, 24, 33) function-evaluation-cpp 21.7417 "Evaluations of functions at arbitrary points."
+(2012, 11, 12, 2, 24, 33) function-evaluation-cpp 21.6408 "Evaluations of functions at arbitrary points."
+(2012, 11, 12, 2, 24, 38) function-extrapolation-python 5.37756 "BENCH:  1.92436099052"
+(2012, 11, 12, 2, 24, 38) function-extrapolation-python 1.92436 "BENCH:  1.92436099052"
+(2012, 11, 12, 2, 25, 1) la-vector-access-cpp 23.253 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 12, 2, 25, 27) la-vector-assignment-cpp 26.0218 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 13, 2, 12, 31) common-progress-cpp 28.9718 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 13, 2, 12, 59) common-timing-cpp 28.1378 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 13, 2, 14, 44) fem-multicore-cpp 104.446 "Coloring mesh."
+(2012, 11, 13, 2, 17, 8) fem-assembly-cpp 144.153 "Assembly for various forms and backends"
+(2012, 11, 13, 2, 17, 20) fem-convergence-cpp 11.4939 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 13, 2, 17, 20) fem-jit-python 0.000418997 "JIT compilation (in memory cache)"
+(2012, 11, 13, 2, 22, 38) fem-speedup-cpp 317.377 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 13, 2, 22, 38) fem-speedup-cpp-assembly 6.32971 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 13, 2, 22, 38) fem-speedup-cpp-solve 2.35113 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 13, 2, 23, 5) mesh-refinement-cpp 24.855 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 13, 2, 23, 26) mesh-topology-cpp 20.9461 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 13, 2, 23, 57) mesh-unitcube-cpp 31.4813 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 13, 2, 24, 40) mesh-iteration-cpp 39.8781 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 13, 2, 25, 2) function-evaluation-cpp 21.7166 "Evaluations of functions at arbitrary points."
+(2012, 11, 13, 2, 25, 2) function-evaluation-cpp 21.6188 "Evaluations of functions at arbitrary points."
+(2012, 11, 13, 2, 25, 7) function-extrapolation-python 5.29317 "BENCH:  1.90870881081"
+(2012, 11, 13, 2, 25, 7) function-extrapolation-python 1.90871 "BENCH:  1.90870881081"
+(2012, 11, 13, 2, 25, 31) la-vector-access-cpp 23.6758 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 13, 2, 25, 57) la-vector-assignment-cpp 26.014 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 14, 2, 11, 44) common-progress-cpp 29.0845 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 14, 2, 12, 12) common-timing-cpp 28.0741 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 14, 2, 13, 57) fem-multicore-cpp 104.757 "Coloring mesh."
+(2012, 11, 14, 2, 16, 21) fem-assembly-cpp 143.982 "Assembly for various forms and backends"
+(2012, 11, 14, 2, 16, 32) fem-convergence-cpp 11.4462 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 14, 2, 16, 33) fem-jit-python 0.000419021 "JIT compilation (in memory cache)"
+(2012, 11, 14, 2, 22, 14) fem-speedup-cpp 340.992 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 14, 2, 22, 14) fem-speedup-cpp-assembly 6.07228 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 14, 2, 22, 14) fem-speedup-cpp-solve 1.7922 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 14, 2, 22, 41) mesh-refinement-cpp 24.7302 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 14, 2, 23, 2) mesh-topology-cpp 21.0199 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 14, 2, 23, 34) mesh-unitcube-cpp 31.4853 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 14, 2, 24, 17) mesh-iteration-cpp 39.8702 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 14, 2, 24, 39) function-evaluation-cpp 21.7129 "Evaluations of functions at arbitrary points."
+(2012, 11, 14, 2, 24, 39) function-evaluation-cpp 21.6124 "Evaluations of functions at arbitrary points."
+(2012, 11, 14, 2, 24, 44) function-extrapolation-python 5.33034 "BENCH:  1.8638241291"
+(2012, 11, 14, 2, 24, 44) function-extrapolation-python 1.86382 "BENCH:  1.8638241291"
+(2012, 11, 14, 2, 25, 9) la-vector-access-cpp 24.9088 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 14, 2, 25, 35) la-vector-assignment-cpp 26.0161 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 28, 10, 45, 39) common-progress-cpp 29.8699 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 28, 10, 46, 6) common-timing-cpp 27.3613 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 28, 10, 47, 55) fem-multicore-cpp 109.027 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 11, 28, 10, 50, 25) fem-assembly-cpp 149.446 "Assembly for various forms and backends"
+(2012, 11, 28, 10, 50, 36) fem-convergence-cpp 11.6192 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 28, 10, 50, 37) fem-jit-python 0.000410485 "JIT compilation (in memory cache)"
+(2012, 11, 28, 10, 56, 1) fem-speedup-cpp 324.372 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 28, 10, 56, 1) fem-speedup-cpp-assembly 6.36426 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 28, 10, 56, 1) fem-speedup-cpp-solve 2.21717 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 28, 10, 56, 29) mesh-refinement-cpp 24.9411 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 28, 10, 56, 50) mesh-topology-cpp 21.5957 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 28, 10, 57, 17) mesh-unitcube-cpp 27.1692 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 28, 10, 58, 6) mesh-iteration-cpp 46.0245 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 28, 10, 58, 28) function-evaluation-cpp 21.7517 "Evaluations of functions at arbitrary points."
+(2012, 11, 28, 10, 58, 28) function-evaluation-cpp 21.6487 "Evaluations of functions at arbitrary points."
+(2012, 11, 28, 10, 58, 33) function-extrapolation-python 5.11629 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 11, 28, 10, 58, 33) function-extrapolation-python 1.85061 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 11, 28, 10, 58, 57) la-vector-access-cpp 23.6232 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 28, 10, 59, 32) la-vector-assignment-cpp 35.5079 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 29, 2, 13, 32) common-progress-cpp 30.9797 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 29, 2, 14, 0) common-timing-cpp 27.3327 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 29, 2, 15, 48) fem-multicore-cpp 108.347 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 11, 29, 2, 18, 15) fem-assembly-cpp 146.68 "Assembly for various forms and backends"
+(2012, 11, 29, 2, 18, 27) fem-convergence-cpp 11.6503 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 29, 2, 18, 28) fem-jit-python 0.000407696 "JIT compilation (in memory cache)"
+(2012, 11, 29, 2, 23, 51) fem-speedup-cpp 322.737 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 29, 2, 23, 51) fem-speedup-cpp-assembly 6.2628 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 29, 2, 23, 51) fem-speedup-cpp-solve 2.21315 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 29, 2, 24, 18) mesh-refinement-cpp 25.1911 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 29, 2, 24, 40) mesh-topology-cpp 21.7557 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 29, 2, 25, 8) mesh-unitcube-cpp 27.827 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 29, 2, 25, 56) mesh-iteration-cpp 44.6855 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 29, 2, 26, 17) function-evaluation-cpp 21.2149 "Evaluations of functions at arbitrary points."
+(2012, 11, 29, 2, 26, 17) function-evaluation-cpp 21.1175 "Evaluations of functions at arbitrary points."
+(2012, 11, 29, 2, 26, 22) function-extrapolation-python 4.89231 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 11, 29, 2, 26, 22) function-extrapolation-python 1.85643 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 11, 29, 2, 26, 45) la-vector-access-cpp 23.0024 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 29, 2, 27, 16) la-vector-assignment-cpp 31.4937 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 11, 30, 2, 13, 28) common-progress-cpp 31.0549 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 11, 30, 2, 13, 56) common-timing-cpp 27.8077 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 11, 30, 2, 15, 45) fem-multicore-cpp 108.963 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 11, 30, 2, 18, 13) fem-assembly-cpp 147.799 "Assembly for various forms and backends"
+(2012, 11, 30, 2, 18, 24) fem-convergence-cpp 11.6782 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 11, 30, 2, 18, 26) fem-jit-python 0.000415087 "JIT compilation (in memory cache)"
+(2012, 11, 30, 2, 23, 48) fem-speedup-cpp 322.268 "Assembly/solve speedup running on 4 processors"
+(2012, 11, 30, 2, 23, 48) fem-speedup-cpp-assembly 6.17554 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 11, 30, 2, 23, 48) fem-speedup-cpp-solve 2.23146 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 11, 30, 2, 24, 16) mesh-refinement-cpp 25.1416 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 11, 30, 2, 24, 38) mesh-topology-cpp 21.799 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 11, 30, 2, 25, 5) mesh-unitcube-cpp 27.8141 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 11, 30, 2, 25, 53) mesh-iteration-cpp 44.677 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 11, 30, 2, 26, 15) function-evaluation-cpp 21.7458 "Evaluations of functions at arbitrary points."
+(2012, 11, 30, 2, 26, 15) function-evaluation-cpp 21.6485 "Evaluations of functions at arbitrary points."
+(2012, 11, 30, 2, 26, 20) function-extrapolation-python 5.01753 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 11, 30, 2, 26, 20) function-extrapolation-python 1.85042 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 11, 30, 2, 26, 43) la-vector-access-cpp 23.0474 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 11, 30, 2, 27, 10) la-vector-assignment-cpp 26.9439 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 1, 2, 13, 24) common-progress-cpp 30.8381 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 1, 2, 13, 51) common-timing-cpp 27.3641 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 1, 2, 15, 40) fem-multicore-cpp 108.48 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 1, 2, 18, 7) fem-assembly-cpp 147.143 "Assembly for various forms and backends"
+(2012, 12, 1, 2, 18, 19) fem-convergence-cpp 11.6838 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 1, 2, 18, 20) fem-jit-python 0.000421095 "JIT compilation (in memory cache)"
+(2012, 12, 1, 2, 23, 41) fem-speedup-cpp 320.362 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 1, 2, 23, 41) fem-speedup-cpp-assembly 6.07905 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 1, 2, 23, 41) fem-speedup-cpp-solve 2.28325 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 1, 2, 24, 8) mesh-refinement-cpp 25.2071 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 1, 2, 24, 30) mesh-topology-cpp 21.8705 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 1, 2, 24, 58) mesh-unitcube-cpp 27.8679 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 1, 2, 25, 45) mesh-iteration-cpp 44.1876 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 1, 2, 26, 7) function-evaluation-cpp 21.7473 "Evaluations of functions at arbitrary points."
+(2012, 12, 1, 2, 26, 7) function-evaluation-cpp 21.6479 "Evaluations of functions at arbitrary points."
+(2012, 12, 1, 2, 26, 12) function-extrapolation-python 4.98174 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 1, 2, 26, 12) function-extrapolation-python 1.92596 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 1, 2, 26, 36) la-vector-access-cpp 23.6385 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 1, 2, 27, 3) la-vector-assignment-cpp 26.9472 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 2, 2, 13, 37) common-progress-cpp 31.0547 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 2, 2, 14, 5) common-timing-cpp 27.2938 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 2, 2, 15, 53) fem-multicore-cpp 108.191 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 2, 2, 18, 21) fem-assembly-cpp 148.078 "Assembly for various forms and backends"
+(2012, 12, 2, 2, 18, 33) fem-convergence-cpp 11.6612 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 2, 2, 18, 35) fem-jit-python 0.000414801 "JIT compilation (in memory cache)"
+(2012, 12, 2, 2, 23, 57) fem-speedup-cpp 321.856 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 2, 2, 23, 57) fem-speedup-cpp-assembly 6.21593 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 2, 2, 23, 57) fem-speedup-cpp-solve 2.25051 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 2, 2, 24, 24) mesh-refinement-cpp 25.0493 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 2, 2, 24, 46) mesh-topology-cpp 21.7952 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 2, 2, 25, 14) mesh-unitcube-cpp 27.9996 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 2, 2, 26, 1) mesh-iteration-cpp 44.6613 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 2, 2, 26, 23) function-evaluation-cpp 21.8016 "Evaluations of functions at arbitrary points."
+(2012, 12, 2, 2, 26, 23) function-evaluation-cpp 21.6906 "Evaluations of functions at arbitrary points."
+(2012, 12, 2, 2, 26, 28) function-extrapolation-python 5.11694 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 2, 2, 26, 28) function-extrapolation-python 1.88872 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 2, 2, 26, 54) la-vector-access-cpp 25.5805 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 2, 2, 27, 21) la-vector-assignment-cpp 26.9355 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 3, 2, 13, 28) common-progress-cpp 37.6836 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 3, 2, 13, 57) common-timing-cpp 28.5344 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 3, 2, 15, 46) fem-multicore-cpp 109.156 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 3, 2, 18, 15) fem-assembly-cpp 149.058 "Assembly for various forms and backends"
+(2012, 12, 3, 2, 18, 27) fem-convergence-cpp 11.6717 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 3, 2, 18, 29) fem-jit-python 0.000430393 "JIT compilation (in memory cache)"
+(2012, 12, 3, 2, 23, 57) fem-speedup-cpp 328.098 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 3, 2, 23, 57) fem-speedup-cpp-assembly 6.24401 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 3, 2, 23, 57) fem-speedup-cpp-solve 2.0813 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 3, 2, 24, 24) mesh-refinement-cpp 25.0092 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 3, 2, 24, 46) mesh-topology-cpp 21.983 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 3, 2, 25, 14) mesh-unitcube-cpp 28.0109 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 3, 2, 26, 2) mesh-iteration-cpp 44.6116 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 3, 2, 26, 23) function-evaluation-cpp 21.4359 "Evaluations of functions at arbitrary points."
+(2012, 12, 3, 2, 26, 23) function-evaluation-cpp 21.3245 "Evaluations of functions at arbitrary points."
+(2012, 12, 3, 2, 26, 28) function-extrapolation-python 5.03537 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 3, 2, 26, 28) function-extrapolation-python 1.89278 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 3, 2, 26, 51) la-vector-access-cpp 23.0156 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 3, 2, 27, 24) la-vector-assignment-cpp 32.9353 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 4, 2, 13, 35) common-progress-cpp 37.6919 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 4, 2, 14, 2) common-timing-cpp 26.6364 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 4, 2, 15, 50) fem-multicore-cpp 107.982 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 4, 2, 18, 18) fem-assembly-cpp 148.019 "Assembly for various forms and backends"
+(2012, 12, 4, 2, 18, 30) fem-convergence-cpp 11.6783 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 4, 2, 18, 32) fem-jit-python 0.000423789 "JIT compilation (in memory cache)"
+(2012, 12, 4, 2, 23, 54) fem-speedup-cpp 322.32 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 4, 2, 23, 54) fem-speedup-cpp-assembly 6.20075 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 4, 2, 23, 54) fem-speedup-cpp-solve 2.26538 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 4, 2, 24, 22) mesh-refinement-cpp 25.6088 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 4, 2, 24, 44) mesh-topology-cpp 21.6699 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 4, 2, 25, 17) mesh-unitcube-cpp 33.442 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 4, 2, 26, 5) mesh-iteration-cpp 44.6827 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 4, 2, 26, 27) function-evaluation-cpp 21.7768 "Evaluations of functions at arbitrary points."
+(2012, 12, 4, 2, 26, 27) function-evaluation-cpp 21.6651 "Evaluations of functions at arbitrary points."
+(2012, 12, 4, 2, 26, 32) function-extrapolation-python 4.97931 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 4, 2, 26, 32) function-extrapolation-python 1.9061 "*** Warning: UnitCube is deprecated. Use UnitCubeMesh"
+(2012, 12, 4, 2, 26, 56) la-vector-access-cpp 24.3218 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 4, 2, 27, 22) la-vector-assignment-cpp 26.0215 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 5, 2, 14, 4) common-progress-cpp 29.1975 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 5, 2, 14, 32) common-timing-cpp 27.6865 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 5, 2, 16, 59) fem-assembly-cpp 146.982 "Assembly for various forms and backends"
+(2012, 12, 5, 2, 17, 11) fem-convergence-cpp 11.6838 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 5, 2, 17, 12) fem-jit-python 0.000422406 "JIT compilation (in memory cache)"
+(2012, 12, 5, 2, 22, 37) fem-speedup-cpp 324.082 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 5, 2, 22, 37) fem-speedup-cpp-assembly 6.20012 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 5, 2, 22, 37) fem-speedup-cpp-solve 2.18646 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 5, 2, 23, 3) mesh-refinement-cpp 24.9222 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 5, 2, 23, 26) mesh-topology-cpp 21.9294 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 5, 2, 23, 53) mesh-unitcube-cpp 27.0426 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 5, 2, 24, 38) mesh-iteration-cpp 42.5934 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 5, 2, 25, 6) la-vector-access-cpp 24.3764 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 5, 2, 25, 32) la-vector-assignment-cpp 26.0256 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 6, 2, 13, 33) common-progress-cpp 28.9727 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 6, 2, 14, 0) common-timing-cpp 26.922 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 6, 2, 15, 48) fem-multicore-cpp 107.778 "Coloring mesh."
+(2012, 12, 6, 2, 18, 15) fem-assembly-cpp 147.517 "Assembly for various forms and backends"
+(2012, 12, 6, 2, 18, 27) fem-convergence-cpp 11.6778 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 6, 2, 18, 29) fem-jit-python 0.000414801 "JIT compilation (in memory cache)"
+(2012, 12, 6, 2, 23, 52) fem-speedup-cpp 323.501 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 6, 2, 23, 52) fem-speedup-cpp-assembly 6.13647 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 6, 2, 23, 52) fem-speedup-cpp-solve 2.21196 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 6, 2, 24, 20) mesh-refinement-cpp 25.2882 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 6, 2, 24, 41) mesh-topology-cpp 21.5749 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 6, 2, 25, 8) mesh-unitcube-cpp 26.4855 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 6, 2, 25, 53) mesh-iteration-cpp 41.876 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 6, 2, 26, 14) function-evaluation-cpp 21.6652 "Evaluations of functions at arbitrary points."
+(2012, 12, 6, 2, 26, 14) function-evaluation-cpp 21.5614 "Evaluations of functions at arbitrary points."
+(2012, 12, 6, 2, 26, 40) la-vector-access-cpp 23.0849 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 6, 2, 27, 6) la-vector-assignment-cpp 26.0251 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 7, 2, 13, 29) common-progress-cpp 28.9728 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 7, 2, 13, 56) common-timing-cpp 26.7469 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 7, 2, 15, 44) fem-multicore-cpp 107.907 "Coloring mesh."
+(2012, 12, 7, 2, 18, 11) fem-assembly-cpp 147.177 "Assembly for various forms and backends"
+(2012, 12, 7, 2, 18, 22) fem-convergence-cpp 11.6811 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 7, 2, 18, 24) fem-jit-python 0.00041101 "JIT compilation (in memory cache)"
+(2012, 12, 7, 2, 23, 47) fem-speedup-cpp 322.171 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 7, 2, 23, 47) fem-speedup-cpp-assembly 6.20805 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 7, 2, 23, 47) fem-speedup-cpp-solve 2.23711 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 7, 2, 24, 14) mesh-refinement-cpp 25.431 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 7, 2, 24, 36) mesh-topology-cpp 21.5766 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 7, 2, 25, 2) mesh-unitcube-cpp 26.4238 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 7, 2, 25, 45) mesh-iteration-cpp 40.3383 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 7, 2, 26, 7) function-evaluation-cpp 21.6979 "Evaluations of functions at arbitrary points."
+(2012, 12, 7, 2, 26, 7) function-evaluation-cpp 21.5938 "Evaluations of functions at arbitrary points."
+(2012, 12, 7, 2, 26, 35) la-vector-access-cpp 24.3346 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 7, 2, 27, 1) la-vector-assignment-cpp 26.0214 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 8, 2, 13, 21) common-progress-cpp 28.9727 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 8, 2, 13, 48) common-timing-cpp 26.9482 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 8, 2, 15, 36) fem-multicore-cpp 108.174 "Coloring mesh."
+(2012, 12, 8, 2, 18, 3) fem-assembly-cpp 146.566 "Assembly for various forms and backends"
+(2012, 12, 8, 2, 18, 15) fem-convergence-cpp 11.7335 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 8, 2, 18, 17) fem-jit-python 0.000417399 "JIT compilation (in memory cache)"
+(2012, 12, 8, 2, 23, 45) fem-speedup-cpp 328.415 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 8, 2, 23, 45) fem-speedup-cpp-assembly 6.2053 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 8, 2, 23, 45) fem-speedup-cpp-solve 2.07078 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 8, 2, 24, 12) mesh-refinement-cpp 24.8384 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 8, 2, 24, 34) mesh-topology-cpp 21.7294 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 8, 2, 25, 1) mesh-unitcube-cpp 27.6182 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 8, 2, 25, 45) mesh-iteration-cpp 40.2858 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 8, 2, 26, 6) function-evaluation-cpp 21.6586 "Evaluations of functions at arbitrary points."
+(2012, 12, 8, 2, 26, 6) function-evaluation-cpp 21.556 "Evaluations of functions at arbitrary points."
+(2012, 12, 8, 2, 26, 34) la-vector-access-cpp 24.3336 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 8, 2, 27, 0) la-vector-assignment-cpp 25.9746 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 9, 2, 13, 27) common-progress-cpp 29.0143 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 9, 2, 13, 55) common-timing-cpp 28.2108 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 9, 2, 15, 44) fem-multicore-cpp 108.241 "Coloring mesh."
+(2012, 12, 9, 2, 18, 10) fem-assembly-cpp 146.471 "Assembly for various forms and backends"
+(2012, 12, 9, 2, 18, 22) fem-convergence-cpp 11.715 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 9, 2, 18, 24) fem-jit-python 0.000421 "JIT compilation (in memory cache)"
+(2012, 12, 9, 2, 23, 48) fem-speedup-cpp 324.711 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 9, 2, 23, 48) fem-speedup-cpp-assembly 6.31489 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 9, 2, 23, 48) fem-speedup-cpp-solve 2.08223 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 9, 2, 24, 15) mesh-refinement-cpp 24.9089 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 9, 2, 24, 37) mesh-topology-cpp 21.8068 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 9, 2, 25, 4) mesh-unitcube-cpp 27.4638 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 9, 2, 25, 54) mesh-iteration-cpp 46.2157 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 9, 2, 26, 15) function-evaluation-cpp 21.6875 "Evaluations of functions at arbitrary points."
+(2012, 12, 9, 2, 26, 15) function-evaluation-cpp 21.5542 "Evaluations of functions at arbitrary points."
+(2012, 12, 9, 2, 26, 43) la-vector-access-cpp 24.0787 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 9, 2, 27, 11) la-vector-assignment-cpp 28.0499 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 10, 2, 13, 22) common-progress-cpp 29.1393 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 10, 2, 13, 50) common-timing-cpp 27.2842 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 10, 2, 15, 37) fem-multicore-cpp 107.596 "Coloring mesh."
+(2012, 12, 10, 2, 18, 6) fem-assembly-cpp 148.379 "Assembly for various forms and backends"
+(2012, 12, 10, 2, 18, 17) fem-convergence-cpp 11.6703 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 10, 2, 18, 19) fem-jit-python 0.000418091 "JIT compilation (in memory cache)"
+(2012, 12, 10, 2, 23, 49) fem-speedup-cpp 330.092 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 10, 2, 23, 49) fem-speedup-cpp-assembly 6.29587 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 10, 2, 23, 49) fem-speedup-cpp-solve 1.95925 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 10, 2, 24, 16) mesh-refinement-cpp 24.8545 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 10, 2, 24, 38) mesh-topology-cpp 21.664 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 10, 2, 25, 6) mesh-unitcube-cpp 27.6158 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 10, 2, 25, 49) mesh-iteration-cpp 40.2808 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 10, 2, 26, 11) function-evaluation-cpp 21.6777 "Evaluations of functions at arbitrary points."
+(2012, 12, 10, 2, 26, 11) function-evaluation-cpp 21.5682 "Evaluations of functions at arbitrary points."
+(2012, 12, 10, 2, 26, 39) la-vector-access-cpp 24.9206 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 10, 2, 27, 5) la-vector-assignment-cpp 26.0242 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 11, 2, 13, 13) common-progress-cpp 29.0144 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 11, 2, 13, 40) common-timing-cpp 26.8327 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 11, 2, 15, 28) fem-multicore-cpp 107.576 "Coloring mesh."
+(2012, 12, 11, 2, 17, 56) fem-assembly-cpp 147.83 "Assembly for various forms and backends"
+(2012, 12, 11, 2, 18, 7) fem-convergence-cpp 11.6604 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 11, 2, 18, 9) fem-jit-python 0.000420809 "JIT compilation (in memory cache)"
+(2012, 12, 11, 2, 23, 35) fem-speedup-cpp 325.251 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 11, 2, 23, 35) fem-speedup-cpp-assembly 6.23278 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 11, 2, 23, 35) fem-speedup-cpp-solve 2.07781 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 11, 2, 24, 1) mesh-refinement-cpp 24.853 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 11, 2, 24, 23) mesh-topology-cpp 21.6676 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 11, 2, 24, 51) mesh-unitcube-cpp 27.6461 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 11, 2, 25, 34) mesh-iteration-cpp 40.3338 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 11, 2, 25, 56) function-evaluation-cpp 21.6709 "Evaluations of functions at arbitrary points."
+(2012, 12, 11, 2, 25, 56) function-evaluation-cpp 21.524 "Evaluations of functions at arbitrary points."
+(2012, 12, 11, 2, 26, 23) la-vector-access-cpp 24.34 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 11, 2, 26, 49) la-vector-assignment-cpp 25.9889 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 12, 2, 13, 39) common-progress-cpp 36.5011 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 12, 2, 14, 6) common-timing-cpp 26.6948 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 12, 2, 15, 55) fem-multicore-cpp 108.8 "Coloring mesh."
+(2012, 12, 12, 2, 18, 22) fem-assembly-cpp 146.779 "Assembly for various forms and backends"
+(2012, 12, 12, 2, 18, 33) fem-convergence-cpp 11.7195 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 12, 2, 18, 35) fem-jit-python 0.000428104 "JIT compilation (in memory cache)"
+(2012, 12, 12, 2, 23, 57) fem-speedup-cpp 322.113 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 12, 2, 23, 57) fem-speedup-cpp-assembly 6.1429 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 12, 2, 23, 57) fem-speedup-cpp-solve 2.11719 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 12, 2, 24, 24) mesh-refinement-cpp 24.8416 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 12, 2, 24, 45) mesh-topology-cpp 21.5376 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 12, 2, 25, 13) mesh-unitcube-cpp 27.4487 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 12, 2, 25, 56) mesh-iteration-cpp 40.3285 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 12, 2, 26, 18) function-evaluation-cpp 21.7355 "Evaluations of functions at arbitrary points."
+(2012, 12, 12, 2, 26, 18) function-evaluation-cpp 21.5837 "Evaluations of functions at arbitrary points."
+(2012, 12, 12, 2, 26, 45) la-vector-access-cpp 24.3411 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 12, 2, 27, 12) la-vector-assignment-cpp 26.9404 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 13, 2, 13, 36) common-progress-cpp 28.9477 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 13, 2, 14, 3) common-timing-cpp 27.2035 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 13, 2, 15, 52) fem-multicore-cpp 109.355 "Coloring mesh."
+(2012, 12, 13, 2, 18, 20) fem-assembly-cpp 147.36 "Assembly for various forms and backends"
+(2012, 12, 13, 2, 18, 31) fem-convergence-cpp 11.6826 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 13, 2, 18, 33) fem-jit-python 0.000417089 "JIT compilation (in memory cache)"
+(2012, 12, 13, 2, 23, 57) fem-speedup-cpp 323.46 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 13, 2, 23, 57) fem-speedup-cpp-assembly 6.31413 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 13, 2, 23, 57) fem-speedup-cpp-solve 2.10175 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 13, 2, 24, 23) mesh-refinement-cpp 24.8889 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 13, 2, 24, 45) mesh-topology-cpp 21.9512 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 13, 2, 25, 13) mesh-unitcube-cpp 27.7404 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 13, 2, 25, 59) mesh-iteration-cpp 43.2183 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 13, 2, 26, 21) function-evaluation-cpp 21.7209 "Evaluations of functions at arbitrary points."
+(2012, 12, 13, 2, 26, 21) function-evaluation-cpp 21.5806 "Evaluations of functions at arbitrary points."
+(2012, 12, 13, 2, 26, 49) la-vector-access-cpp 24.3415 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 13, 2, 27, 15) la-vector-assignment-cpp 26.0252 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 14, 2, 13, 30) common-progress-cpp 29.0323 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 14, 2, 13, 58) common-timing-cpp 27.2585 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 14, 2, 15, 47) fem-multicore-cpp 109.32 "Coloring mesh."
+(2012, 12, 14, 2, 18, 16) fem-assembly-cpp 148.463 "Assembly for various forms and backends"
+(2012, 12, 14, 2, 18, 27) fem-convergence-cpp 11.6121 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 14, 2, 18, 29) fem-jit-python 0.000419402 "JIT compilation (in memory cache)"
+(2012, 12, 14, 2, 23, 52) fem-speedup-cpp 322.701 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 14, 2, 23, 52) fem-speedup-cpp-assembly 6.24069 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 14, 2, 23, 52) fem-speedup-cpp-solve 2.12094 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 14, 2, 24, 18) mesh-refinement-cpp 24.8999 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 14, 2, 24, 40) mesh-topology-cpp 21.9843 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 14, 2, 25, 8) mesh-unitcube-cpp 27.8451 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 14, 2, 25, 56) mesh-iteration-cpp 45.2509 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 14, 2, 26, 18) function-evaluation-cpp 21.7323 "Evaluations of functions at arbitrary points."
+(2012, 12, 14, 2, 26, 18) function-evaluation-cpp 21.5954 "Evaluations of functions at arbitrary points."
+(2012, 12, 14, 2, 26, 46) la-vector-access-cpp 24.0774 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 14, 2, 27, 12) la-vector-assignment-cpp 26.0304 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 15, 2, 13, 28) common-progress-cpp 29.2071 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 15, 2, 13, 55) common-timing-cpp 26.9454 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 15, 2, 15, 44) fem-multicore-cpp 109.106 "Coloring mesh."
+(2012, 12, 15, 2, 18, 13) fem-assembly-cpp 149.112 "Assembly for various forms and backends"
+(2012, 12, 15, 2, 18, 25) fem-convergence-cpp 11.6841 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 15, 2, 18, 27) fem-jit-python 0.000422287 "JIT compilation (in memory cache)"
+(2012, 12, 15, 2, 23, 50) fem-speedup-cpp 322.967 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 15, 2, 23, 50) fem-speedup-cpp-assembly 6.32278 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 15, 2, 23, 50) fem-speedup-cpp-solve 2.1039 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 15, 2, 24, 16) mesh-refinement-cpp 24.8879 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 15, 2, 24, 38) mesh-topology-cpp 22.0019 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 15, 2, 25, 6) mesh-unitcube-cpp 27.9895 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 15, 2, 25, 52) mesh-iteration-cpp 43.1356 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 15, 2, 26, 14) function-evaluation-cpp 21.7075 "Evaluations of functions at arbitrary points."
+(2012, 12, 15, 2, 26, 14) function-evaluation-cpp 21.5679 "Evaluations of functions at arbitrary points."
+(2012, 12, 15, 2, 26, 42) la-vector-access-cpp 24.3325 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 15, 2, 27, 9) la-vector-assignment-cpp 27.4288 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 16, 2, 13, 6) common-progress-cpp 29.0322 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 16, 2, 13, 33) common-timing-cpp 26.9458 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 16, 2, 15, 22) fem-multicore-cpp 109.062 "Coloring mesh."
+(2012, 12, 16, 2, 17, 51) fem-assembly-cpp 149.133 "Assembly for various forms and backends"
+(2012, 12, 16, 2, 18, 3) fem-convergence-cpp 11.6778 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 16, 2, 18, 5) fem-jit-python 0.000422001 "JIT compilation (in memory cache)"
+(2012, 12, 16, 2, 23, 34) fem-speedup-cpp 329.319 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 16, 2, 23, 34) fem-speedup-cpp-assembly 6.29477 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 16, 2, 23, 34) fem-speedup-cpp-solve 1.9898 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 16, 2, 24, 1) mesh-refinement-cpp 24.8575 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 16, 2, 24, 23) mesh-topology-cpp 22.0094 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 16, 2, 24, 51) mesh-unitcube-cpp 27.7353 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 16, 2, 25, 40) mesh-iteration-cpp 45.9221 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 16, 2, 26, 1) function-evaluation-cpp 21.7257 "Evaluations of functions at arbitrary points."
+(2012, 12, 16, 2, 26, 1) function-evaluation-cpp 21.6219 "Evaluations of functions at arbitrary points."
+(2012, 12, 16, 2, 26, 29) la-vector-access-cpp 24.3184 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 16, 2, 26, 55) la-vector-assignment-cpp 25.8787 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 17, 2, 13, 4) common-progress-cpp 29.0322 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 17, 2, 13, 31) common-timing-cpp 26.6655 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 17, 2, 15, 20) fem-multicore-cpp 109.022 "Coloring mesh."
+(2012, 12, 17, 2, 17, 49) fem-assembly-cpp 148.84 "Assembly for various forms and backends"
+(2012, 12, 17, 2, 18, 1) fem-convergence-cpp 11.6696 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 17, 2, 18, 3) fem-jit-python 0.000425291 "JIT compilation (in memory cache)"
+(2012, 12, 17, 2, 23, 27) fem-speedup-cpp 324.706 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 17, 2, 23, 27) fem-speedup-cpp-assembly 6.24436 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 17, 2, 23, 27) fem-speedup-cpp-solve 2.08727 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 17, 2, 23, 54) mesh-refinement-cpp 24.9221 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 17, 2, 24, 17) mesh-topology-cpp 22.1276 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 17, 2, 24, 44) mesh-unitcube-cpp 27.7595 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 17, 2, 25, 30) mesh-iteration-cpp 42.8699 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 17, 2, 25, 52) function-evaluation-cpp 21.7213 "Evaluations of functions at arbitrary points."
+(2012, 12, 17, 2, 25, 52) function-evaluation-cpp 21.6154 "Evaluations of functions at arbitrary points."
+(2012, 12, 17, 2, 26, 19) la-vector-access-cpp 24.3298 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 17, 2, 26, 45) la-vector-assignment-cpp 26.0138 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 18, 2, 13, 31) common-progress-cpp 29.0239 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 18, 2, 13, 58) common-timing-cpp 27.1075 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 18, 2, 15, 48) fem-multicore-cpp 109.763 "Coloring mesh."
+(2012, 12, 18, 2, 18, 13) fem-assembly-cpp 145.7 "Assembly for various forms and backends"
+(2012, 12, 18, 2, 18, 25) fem-convergence-cpp 11.6877 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 18, 2, 18, 27) fem-jit-python 0.000414085 "JIT compilation (in memory cache)"
+(2012, 12, 18, 2, 23, 51) fem-speedup-cpp 323.823 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 18, 2, 23, 51) fem-speedup-cpp-assembly 6.16698 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 18, 2, 23, 51) fem-speedup-cpp-solve 2.08549 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 18, 2, 24, 17) mesh-refinement-cpp 24.8653 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 18, 2, 24, 39) mesh-topology-cpp 22.0175 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 18, 2, 25, 7) mesh-unitcube-cpp 27.8598 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 18, 2, 25, 53) mesh-iteration-cpp 42.878 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 18, 2, 26, 15) function-evaluation-cpp 21.7492 "Evaluations of functions at arbitrary points."
+(2012, 12, 18, 2, 26, 15) function-evaluation-cpp 21.6077 "Evaluations of functions at arbitrary points."
+(2012, 12, 18, 2, 26, 43) la-vector-access-cpp 25.4171 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 18, 2, 27, 11) la-vector-assignment-cpp 27.4802 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 19, 2, 13, 32) common-progress-cpp 29.0489 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 19, 2, 14, 0) common-timing-cpp 27.1396 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 19, 2, 15, 49) fem-multicore-cpp 109.052 "Coloring mesh."
+(2012, 12, 19, 2, 18, 14) fem-assembly-cpp 145.112 "Assembly for various forms and backends"
+(2012, 12, 19, 2, 18, 25) fem-convergence-cpp 11.6985 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 19, 2, 18, 27) fem-jit-python 0.000419688 "JIT compilation (in memory cache)"
+(2012, 12, 19, 2, 23, 52) fem-speedup-cpp 324.61 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 19, 2, 23, 52) fem-speedup-cpp-assembly 6.23634 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 19, 2, 23, 52) fem-speedup-cpp-solve 2.06688 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 19, 2, 24, 18) mesh-refinement-cpp 24.8315 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 19, 2, 24, 41) mesh-topology-cpp 22.0915 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 19, 2, 25, 9) mesh-unitcube-cpp 27.7826 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 19, 2, 25, 55) mesh-iteration-cpp 43.0979 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 19, 2, 26, 19) function-evaluation-cpp 24.1554 "Evaluations of functions at arbitrary points."
+(2012, 12, 19, 2, 26, 19) function-evaluation-cpp 24.0283 "Evaluations of functions at arbitrary points."
+(2012, 12, 19, 2, 26, 46) la-vector-access-cpp 24.3283 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 19, 2, 27, 12) la-vector-assignment-cpp 26.0187 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 20, 2, 13, 57) common-progress-cpp 29.1488 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 20, 2, 14, 25) common-timing-cpp 27.6833 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 20, 2, 16, 13) fem-multicore-cpp 108.924 "Coloring mesh."
+(2012, 12, 20, 2, 18, 41) fem-assembly-cpp 147.147 "Assembly for various forms and backends"
+(2012, 12, 20, 2, 18, 52) fem-convergence-cpp 11.6702 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 20, 2, 18, 54) fem-jit-python 0.000423098 "JIT compilation (in memory cache)"
+(2012, 12, 20, 2, 24, 18) fem-speedup-cpp 323.5 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 20, 2, 24, 18) fem-speedup-cpp-assembly 6.22749 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 20, 2, 24, 18) fem-speedup-cpp-solve 2.08634 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 20, 2, 24, 45) mesh-refinement-cpp 25.1577 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 20, 2, 25, 7) mesh-topology-cpp 22.0001 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 20, 2, 25, 34) mesh-unitcube-cpp 27.1674 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 20, 2, 26, 20) mesh-iteration-cpp 43.7318 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 20, 2, 26, 42) function-evaluation-cpp 21.7056 "Evaluations of functions at arbitrary points."
+(2012, 12, 20, 2, 26, 42) function-evaluation-cpp 21.5613 "Evaluations of functions at arbitrary points."
+(2012, 12, 20, 2, 27, 8) la-vector-access-cpp 23.0751 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 20, 2, 27, 34) la-vector-assignment-cpp 26.0183 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 21, 2, 13, 27) common-progress-cpp 29.0239 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 21, 2, 13, 53) common-timing-cpp 26.1405 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 21, 2, 15, 41) fem-multicore-cpp 108.325 "Coloring mesh."
+(2012, 12, 21, 2, 18, 10) fem-assembly-cpp 148.394 "Assembly for various forms and backends"
+(2012, 12, 21, 2, 18, 21) fem-convergence-cpp 11.6802 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 21, 2, 18, 23) fem-jit-python 0.000420713 "JIT compilation (in memory cache)"
+(2012, 12, 21, 2, 23, 45) fem-speedup-cpp 321.903 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 21, 2, 23, 45) fem-speedup-cpp-assembly 6.32324 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 21, 2, 23, 45) fem-speedup-cpp-solve 2.12434 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 21, 2, 24, 12) mesh-refinement-cpp 24.8268 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 21, 2, 24, 33) mesh-topology-cpp 21.785 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 21, 2, 25, 1) mesh-unitcube-cpp 27.2246 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 21, 2, 25, 44) mesh-iteration-cpp 40.2766 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 21, 2, 26, 6) function-evaluation-cpp 21.725 "Evaluations of functions at arbitrary points."
+(2012, 12, 21, 2, 26, 6) function-evaluation-cpp 21.5773 "Evaluations of functions at arbitrary points."
+(2012, 12, 21, 2, 26, 32) la-vector-access-cpp 23.4319 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 21, 2, 26, 58) la-vector-assignment-cpp 26.0252 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 22, 2, 13, 13) common-progress-cpp 28.9739 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 22, 2, 13, 39) common-timing-cpp 26.0747 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 22, 2, 15, 26) fem-multicore-cpp 107.704 "Coloring mesh."
+(2012, 12, 22, 2, 17, 55) fem-assembly-cpp 148.472 "Assembly for various forms and backends"
+(2012, 12, 22, 2, 18, 7) fem-convergence-cpp 11.7415 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 22, 2, 18, 9) fem-jit-python 0.000417686 "JIT compilation (in memory cache)"
+(2012, 12, 22, 2, 23, 35) fem-speedup-cpp 326.017 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 22, 2, 23, 35) fem-speedup-cpp-assembly 6.29701 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 22, 2, 23, 35) fem-speedup-cpp-solve 2.0374 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 22, 2, 24, 2) mesh-refinement-cpp 24.9012 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 22, 2, 24, 23) mesh-topology-cpp 21.7896 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 22, 2, 24, 51) mesh-unitcube-cpp 27.1716 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 22, 2, 25, 40) mesh-iteration-cpp 46.0368 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 22, 2, 26, 1) function-evaluation-cpp 21.752 "Evaluations of functions at arbitrary points."
+(2012, 12, 22, 2, 26, 1) function-evaluation-cpp 21.6145 "Evaluations of functions at arbitrary points."
+(2012, 12, 22, 2, 26, 28) la-vector-access-cpp 23.0926 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 22, 2, 26, 54) la-vector-assignment-cpp 26.0175 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 23, 2, 13, 21) common-progress-cpp 29.0822 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 23, 2, 13, 46) common-timing-cpp 25.7393 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 23, 2, 15, 35) fem-multicore-cpp 108.785 "Coloring mesh."
+(2012, 12, 23, 2, 18, 4) fem-assembly-cpp 148.926 "Assembly for various forms and backends"
+(2012, 12, 23, 2, 18, 16) fem-convergence-cpp 11.7111 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 23, 2, 18, 18) fem-jit-python 0.000428796 "JIT compilation (in memory cache)"
+(2012, 12, 23, 2, 23, 47) fem-speedup-cpp 329.65 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 23, 2, 23, 47) fem-speedup-cpp-assembly 6.28928 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 23, 2, 23, 47) fem-speedup-cpp-solve 1.96131 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 23, 2, 24, 14) mesh-refinement-cpp 24.8607 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 23, 2, 24, 36) mesh-topology-cpp 21.801 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 23, 2, 25, 3) mesh-unitcube-cpp 27.0871 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 23, 2, 25, 47) mesh-iteration-cpp 40.2912 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 23, 2, 26, 8) function-evaluation-cpp 21.7183 "Evaluations of functions at arbitrary points."
+(2012, 12, 23, 2, 26, 8) function-evaluation-cpp 21.6116 "Evaluations of functions at arbitrary points."
+(2012, 12, 23, 2, 26, 36) la-vector-access-cpp 24.8538 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 23, 2, 27, 2) la-vector-assignment-cpp 26.023 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 24, 2, 13, 39) common-progress-cpp 28.9573 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 24, 2, 14, 5) common-timing-cpp 26.8616 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 24, 2, 15, 54) fem-multicore-cpp 108.985 "Coloring mesh."
+(2012, 12, 24, 2, 18, 23) fem-assembly-cpp 148.074 "Assembly for various forms and backends"
+(2012, 12, 24, 2, 18, 34) fem-convergence-cpp 11.6873 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 24, 2, 18, 36) fem-jit-python 0.000423598 "JIT compilation (in memory cache)"
+(2012, 12, 24, 2, 24, 7) fem-speedup-cpp 330.902 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 24, 2, 24, 7) fem-speedup-cpp-assembly 6.21077 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 24, 2, 24, 7) fem-speedup-cpp-solve 1.97674 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 24, 2, 24, 34) mesh-refinement-cpp 25.236 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 24, 2, 24, 56) mesh-topology-cpp 21.7018 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 24, 2, 25, 24) mesh-unitcube-cpp 27.4367 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 24, 2, 26, 7) mesh-iteration-cpp 40.2467 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 24, 2, 26, 29) function-evaluation-cpp 21.7405 "Evaluations of functions at arbitrary points."
+(2012, 12, 24, 2, 26, 29) function-evaluation-cpp 21.628 "Evaluations of functions at arbitrary points."
+(2012, 12, 24, 2, 26, 55) la-vector-access-cpp 22.9861 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 24, 2, 27, 21) la-vector-assignment-cpp 26.0143 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 25, 2, 13, 30) common-progress-cpp 29.0073 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 25, 2, 13, 57) common-timing-cpp 26.8355 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 25, 2, 15, 45) fem-multicore-cpp 108.254 "Coloring mesh."
+(2012, 12, 25, 2, 18, 13) fem-assembly-cpp 148.426 "Assembly for various forms and backends"
+(2012, 12, 25, 2, 18, 25) fem-convergence-cpp 11.6963 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 25, 2, 18, 27) fem-jit-python 0.000414491 "JIT compilation (in memory cache)"
+(2012, 12, 25, 2, 23, 52) fem-speedup-cpp 324.822 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 25, 2, 23, 52) fem-speedup-cpp-assembly 6.3266 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 25, 2, 23, 52) fem-speedup-cpp-solve 2.10992 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 25, 2, 24, 19) mesh-refinement-cpp 25.318 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 25, 2, 24, 41) mesh-topology-cpp 21.6827 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 25, 2, 25, 8) mesh-unitcube-cpp 27.4621 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 25, 2, 25, 51) mesh-iteration-cpp 40.2768 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 25, 2, 26, 13) function-evaluation-cpp 21.7806 "Evaluations of functions at arbitrary points."
+(2012, 12, 25, 2, 26, 13) function-evaluation-cpp 21.5986 "Evaluations of functions at arbitrary points."
+(2012, 12, 25, 2, 26, 39) la-vector-access-cpp 23.0233 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 25, 2, 27, 8) la-vector-assignment-cpp 28.0347 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 26, 2, 13, 9) common-progress-cpp 29.0405 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 26, 2, 13, 36) common-timing-cpp 26.9821 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 26, 2, 15, 24) fem-multicore-cpp 108.168 "Coloring mesh."
+(2012, 12, 26, 2, 17, 52) fem-assembly-cpp 148.114 "Assembly for various forms and backends"
+(2012, 12, 26, 2, 18, 4) fem-convergence-cpp 11.6671 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 26, 2, 18, 6) fem-jit-python 0.000422621 "JIT compilation (in memory cache)"
+(2012, 12, 26, 2, 23, 39) fem-speedup-cpp 333.372 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 26, 2, 23, 39) fem-speedup-cpp-assembly 6.29044 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 26, 2, 23, 39) fem-speedup-cpp-solve 1.92494 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 26, 2, 24, 6) mesh-refinement-cpp 25.1923 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 26, 2, 24, 28) mesh-topology-cpp 21.6682 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 26, 2, 24, 55) mesh-unitcube-cpp 27.5047 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 26, 2, 25, 39) mesh-iteration-cpp 40.3036 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 26, 2, 26, 0) function-evaluation-cpp 21.7269 "Evaluations of functions at arbitrary points."
+(2012, 12, 26, 2, 26, 0) function-evaluation-cpp 21.6199 "Evaluations of functions at arbitrary points."
+(2012, 12, 26, 2, 26, 27) la-vector-access-cpp 22.9979 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 26, 2, 26, 54) la-vector-assignment-cpp 27.4878 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 27, 2, 13, 27) common-progress-cpp 28.9991 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 27, 2, 13, 55) common-timing-cpp 27.1153 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 27, 2, 15, 43) fem-multicore-cpp 108.197 "Coloring mesh."
+(2012, 12, 27, 2, 18, 10) fem-assembly-cpp 147.47 "Assembly for various forms and backends"
+(2012, 12, 27, 2, 18, 22) fem-convergence-cpp 11.7034 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 27, 2, 18, 24) fem-jit-python 0.000424385 "JIT compilation (in memory cache)"
+(2012, 12, 27, 2, 23, 50) fem-speedup-cpp 326.475 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 27, 2, 23, 50) fem-speedup-cpp-assembly 6.3998 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 27, 2, 23, 50) fem-speedup-cpp-solve 2.07613 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 27, 2, 24, 17) mesh-refinement-cpp 25.2119 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 27, 2, 24, 39) mesh-topology-cpp 21.6611 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 27, 2, 25, 7) mesh-unitcube-cpp 27.6063 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 27, 2, 25, 50) mesh-iteration-cpp 40.2987 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 27, 2, 26, 12) function-evaluation-cpp 21.9805 "Evaluations of functions at arbitrary points."
+(2012, 12, 27, 2, 26, 12) function-evaluation-cpp 21.8329 "Evaluations of functions at arbitrary points."
+(2012, 12, 27, 2, 26, 41) la-vector-access-cpp 25.4526 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 27, 2, 27, 7) la-vector-assignment-cpp 26.0238 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 28, 2, 13, 32) common-progress-cpp 29.0655 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 28, 2, 13, 58) common-timing-cpp 26.238 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 28, 2, 15, 48) fem-multicore-cpp 109.167 "Coloring mesh."
+(2012, 12, 28, 2, 18, 15) fem-assembly-cpp 147.683 "Assembly for various forms and backends"
+(2012, 12, 28, 2, 18, 27) fem-convergence-cpp 11.7358 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 28, 2, 18, 29) fem-jit-python 0.000418305 "JIT compilation (in memory cache)"
+(2012, 12, 28, 2, 24, 1) fem-speedup-cpp 332.376 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 28, 2, 24, 1) fem-speedup-cpp-assembly 6.24272 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 28, 2, 24, 1) fem-speedup-cpp-solve 1.95932 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 28, 2, 24, 29) mesh-refinement-cpp 24.9065 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 28, 2, 24, 51) mesh-topology-cpp 21.8203 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 28, 2, 25, 20) mesh-unitcube-cpp 28.6299 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 28, 2, 26, 3) mesh-iteration-cpp 40.2737 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 28, 2, 26, 24) function-evaluation-cpp 21.1953 "Evaluations of functions at arbitrary points."
+(2012, 12, 28, 2, 26, 24) function-evaluation-cpp 21.0886 "Evaluations of functions at arbitrary points."
+(2012, 12, 28, 2, 26, 52) la-vector-access-cpp 24.3344 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 28, 2, 27, 18) la-vector-assignment-cpp 26.0212 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 30, 2, 13, 50) common-progress-cpp 46.6583 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 30, 2, 14, 17) common-timing-cpp 26.896 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 30, 2, 16, 6) fem-multicore-cpp 108.83 "Coloring mesh."
+(2012, 12, 30, 2, 18, 34) fem-assembly-cpp 147.589 "Assembly for various forms and backends"
+(2012, 12, 30, 2, 18, 46) fem-convergence-cpp 11.7084 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 30, 2, 18, 48) fem-jit-python 0.000419688 "JIT compilation (in memory cache)"
+(2012, 12, 30, 2, 24, 10) fem-speedup-cpp 322.443 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 30, 2, 24, 10) fem-speedup-cpp-assembly 6.32365 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 30, 2, 24, 10) fem-speedup-cpp-solve 2.08285 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 30, 2, 24, 37) mesh-refinement-cpp 24.9664 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 30, 2, 24, 59) mesh-topology-cpp 21.7461 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 30, 2, 25, 26) mesh-unitcube-cpp 27.4331 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 30, 2, 26, 9) mesh-iteration-cpp 40.2772 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 30, 2, 26, 31) function-evaluation-cpp 21.6977 "Evaluations of functions at arbitrary points."
+(2012, 12, 30, 2, 26, 31) function-evaluation-cpp 21.5547 "Evaluations of functions at arbitrary points."
+(2012, 12, 30, 2, 26, 58) la-vector-access-cpp 24.3215 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 30, 2, 27, 25) la-vector-assignment-cpp 26.9333 "Assigning to vector of size 10000000 (100 repetitions)"
+(2012, 12, 31, 2, 13, 28) common-progress-cpp 29.1655 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2012, 12, 31, 2, 13, 56) common-timing-cpp 28.0255 "Timing access and registration of timings (10000000 repetitions)"
+(2012, 12, 31, 2, 15, 45) fem-multicore-cpp 108.873 "Coloring mesh."
+(2012, 12, 31, 2, 18, 12) fem-assembly-cpp 147.631 "Assembly for various forms and backends"
+(2012, 12, 31, 2, 18, 24) fem-convergence-cpp 11.6496 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2012, 12, 31, 2, 18, 26) fem-jit-python 0.000419092 "JIT compilation (in memory cache)"
+(2012, 12, 31, 2, 23, 48) fem-speedup-cpp 322.078 "Assembly/solve speedup running on 4 processors"
+(2012, 12, 31, 2, 23, 48) fem-speedup-cpp-assembly 6.31242 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2012, 12, 31, 2, 23, 48) fem-speedup-cpp-solve 2.10099 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2012, 12, 31, 2, 24, 15) mesh-refinement-cpp 24.9202 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2012, 12, 31, 2, 24, 37) mesh-topology-cpp 21.7964 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2012, 12, 31, 2, 25, 4) mesh-unitcube-cpp 27.3034 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2012, 12, 31, 2, 25, 47) mesh-iteration-cpp 40.2757 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2012, 12, 31, 2, 26, 9) function-evaluation-cpp 21.5395 "Evaluations of functions at arbitrary points."
+(2012, 12, 31, 2, 26, 9) function-evaluation-cpp 21.376 "Evaluations of functions at arbitrary points."
+(2012, 12, 31, 2, 26, 36) la-vector-access-cpp 24.3255 "Accessing vector of size 10000000 (100 repetitions)"
+(2012, 12, 31, 2, 27, 3) la-vector-assignment-cpp 26.9392 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 1, 2, 13, 38) common-progress-cpp 29.1904 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 1, 2, 14, 6) common-timing-cpp 27.4852 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 1, 2, 15, 54) fem-multicore-cpp 108.066 "Coloring mesh."
+(2013, 1, 1, 2, 18, 21) fem-assembly-cpp 147.773 "Assembly for various forms and backends"
+(2013, 1, 1, 2, 18, 33) fem-convergence-cpp 11.6448 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 1, 2, 18, 35) fem-jit-python 0.000428605 "JIT compilation (in memory cache)"
+(2013, 1, 1, 2, 23, 55) fem-speedup-cpp 320.02 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 1, 2, 23, 55) fem-speedup-cpp-assembly 6.30526 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 1, 2, 23, 55) fem-speedup-cpp-solve 2.14649 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 1, 2, 24, 22) mesh-refinement-cpp 25.0549 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 1, 2, 24, 44) mesh-topology-cpp 21.9906 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 1, 2, 25, 14) mesh-unitcube-cpp 29.9711 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 1, 2, 25, 57) mesh-iteration-cpp 40.2668 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 1, 2, 26, 19) function-evaluation-cpp 21.7586 "Evaluations of functions at arbitrary points."
+(2013, 1, 1, 2, 26, 19) function-evaluation-cpp 21.6251 "Evaluations of functions at arbitrary points."
+(2013, 1, 1, 2, 26, 47) la-vector-access-cpp 24.3313 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 1, 2, 27, 13) la-vector-assignment-cpp 26.0209 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 2, 2, 13, 22) common-progress-cpp 29.0827 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 2, 2, 13, 51) common-timing-cpp 28.3639 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 2, 2, 15, 39) fem-multicore-cpp 108.285 "Coloring mesh."
+(2013, 1, 2, 2, 18, 7) fem-assembly-cpp 147.852 "Assembly for various forms and backends"
+(2013, 1, 2, 2, 18, 19) fem-convergence-cpp 11.6661 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 2, 2, 18, 20) fem-jit-python 0.000412893 "JIT compilation (in memory cache)"
+(2013, 1, 2, 2, 23, 44) fem-speedup-cpp 323.195 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 2, 2, 23, 44) fem-speedup-cpp-assembly 6.31078 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 2, 2, 23, 44) fem-speedup-cpp-solve 2.07754 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 2, 2, 24, 11) mesh-refinement-cpp 25.0994 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 2, 2, 24, 33) mesh-topology-cpp 22.0951 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 2, 2, 25, 3) mesh-unitcube-cpp 29.9758 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 2, 2, 25, 50) mesh-iteration-cpp 43.6582 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 2, 2, 26, 12) function-evaluation-cpp 21.983 "Evaluations of functions at arbitrary points."
+(2013, 1, 2, 2, 26, 12) function-evaluation-cpp 21.8297 "Evaluations of functions at arbitrary points."
+(2013, 1, 2, 2, 26, 39) la-vector-access-cpp 24.3228 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 2, 2, 27, 5) la-vector-assignment-cpp 26.0199 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 3, 2, 13, 20) common-progress-cpp 29.0572 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 3, 2, 13, 48) common-timing-cpp 27.4562 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 3, 2, 15, 36) fem-multicore-cpp 108.144 "Coloring mesh."
+(2013, 1, 3, 2, 18, 4) fem-assembly-cpp 148.32 "Assembly for various forms and backends"
+(2013, 1, 3, 2, 18, 16) fem-convergence-cpp 11.6262 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 3, 2, 18, 18) fem-jit-python 0.000415707 "JIT compilation (in memory cache)"
+(2013, 1, 3, 2, 23, 37) fem-speedup-cpp 319.496 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 3, 2, 23, 37) fem-speedup-cpp-assembly 6.27728 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 3, 2, 23, 37) fem-speedup-cpp-solve 2.15972 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 3, 2, 24, 4) mesh-refinement-cpp 25.0932 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 3, 2, 24, 26) mesh-topology-cpp 22.0119 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 3, 2, 24, 56) mesh-unitcube-cpp 29.9568 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 3, 2, 25, 50) mesh-iteration-cpp 50.8641 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 3, 2, 26, 12) function-evaluation-cpp 21.7498 "Evaluations of functions at arbitrary points."
+(2013, 1, 3, 2, 26, 12) function-evaluation-cpp 21.5963 "Evaluations of functions at arbitrary points."
+(2013, 1, 3, 2, 26, 39) la-vector-access-cpp 24.33 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 3, 2, 27, 5) la-vector-assignment-cpp 26.0178 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 4, 2, 14, 3) common-progress-cpp 29.0405 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 4, 2, 14, 29) common-timing-cpp 25.7598 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 4, 2, 16, 17) fem-multicore-cpp 108.493 "Coloring mesh."
+(2013, 1, 4, 2, 18, 46) fem-assembly-cpp 148.97 "Assembly for various forms and backends"
+(2013, 1, 4, 2, 18, 58) fem-convergence-cpp 11.6567 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 4, 2, 19, 0) fem-jit-python 0.000427198 "JIT compilation (in memory cache)"
+(2013, 1, 4, 2, 24, 28) fem-speedup-cpp 328.273 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 4, 2, 24, 28) fem-speedup-cpp-assembly 6.24089 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 4, 2, 24, 28) fem-speedup-cpp-solve 2.06369 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 4, 2, 24, 56) mesh-refinement-cpp 25.7528 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 4, 2, 25, 19) mesh-topology-cpp 22.8493 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 4, 2, 25, 48) mesh-unitcube-cpp 29.8246 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 4, 2, 26, 32) mesh-iteration-cpp 40.266 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 4, 2, 26, 53) function-evaluation-cpp 21.5245 "Evaluations of functions at arbitrary points."
+(2013, 1, 4, 2, 26, 53) function-evaluation-cpp 21.4111 "Evaluations of functions at arbitrary points."
+(2013, 1, 4, 2, 27, 22) la-vector-access-cpp 25.408 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 4, 2, 27, 53) la-vector-assignment-cpp 31.488 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 5, 2, 13, 47) common-progress-cpp 28.974 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 5, 2, 14, 14) common-timing-cpp 26.2999 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 5, 2, 16, 2) fem-multicore-cpp 107.946 "Coloring mesh."
+(2013, 1, 5, 2, 18, 30) fem-assembly-cpp 147.991 "Assembly for various forms and backends"
+(2013, 1, 5, 2, 18, 41) fem-convergence-cpp 11.6166 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 5, 2, 18, 43) fem-jit-python 0.000426292 "JIT compilation (in memory cache)"
+(2013, 1, 5, 2, 24, 12) fem-speedup-cpp 328.557 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 5, 2, 24, 12) fem-speedup-cpp-assembly 6.22563 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 5, 2, 24, 12) fem-speedup-cpp-solve 2.03482 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 5, 2, 24, 39) mesh-refinement-cpp 25.4168 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 5, 2, 25, 2) mesh-topology-cpp 22.3457 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 5, 2, 25, 32) mesh-unitcube-cpp 29.7962 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 5, 2, 26, 15) mesh-iteration-cpp 40.2716 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 5, 2, 26, 37) function-evaluation-cpp 21.5918 "Evaluations of functions at arbitrary points."
+(2013, 1, 5, 2, 26, 37) function-evaluation-cpp 21.4536 "Evaluations of functions at arbitrary points."
+(2013, 1, 5, 2, 27, 3) la-vector-access-cpp 23.0904 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 5, 2, 27, 29) la-vector-assignment-cpp 26.0253 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 6, 2, 13, 46) common-progress-cpp 29.0073 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 6, 2, 14, 12) common-timing-cpp 25.9913 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 6, 2, 16, 0) fem-multicore-cpp 107.69 "Coloring mesh."
+(2013, 1, 6, 2, 18, 26) fem-assembly-cpp 146.227 "Assembly for various forms and backends"
+(2013, 1, 6, 2, 18, 38) fem-convergence-cpp 11.6923 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 6, 2, 18, 40) fem-jit-python 0.000419903 "JIT compilation (in memory cache)"
+(2013, 1, 6, 2, 24, 5) fem-speedup-cpp 325.15 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 6, 2, 24, 5) fem-speedup-cpp-assembly 6.2811 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 6, 2, 24, 5) fem-speedup-cpp-solve 2.10139 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 6, 2, 24, 32) mesh-refinement-cpp 25.5182 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 6, 2, 24, 55) mesh-topology-cpp 22.5053 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 6, 2, 25, 25) mesh-unitcube-cpp 29.8467 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 6, 2, 26, 10) mesh-iteration-cpp 41.4966 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 6, 2, 26, 31) function-evaluation-cpp 21.6417 "Evaluations of functions at arbitrary points."
+(2013, 1, 6, 2, 26, 31) function-evaluation-cpp 21.4913 "Evaluations of functions at arbitrary points."
+(2013, 1, 6, 2, 26, 58) la-vector-access-cpp 23.422 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 6, 2, 27, 26) la-vector-assignment-cpp 28.0429 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 7, 2, 13, 26) common-progress-cpp 29.064 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 7, 2, 13, 52) common-timing-cpp 26.4392 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 7, 2, 15, 40) fem-multicore-cpp 107.793 "Coloring mesh."
+(2013, 1, 7, 2, 18, 6) fem-assembly-cpp 145.698 "Assembly for various forms and backends"
+(2013, 1, 7, 2, 18, 17) fem-convergence-cpp 11.6308 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 7, 2, 18, 20) fem-jit-python 0.000425911 "JIT compilation (in memory cache)"
+(2013, 1, 7, 2, 23, 53) fem-speedup-cpp 333.605 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 7, 2, 23, 53) fem-speedup-cpp-assembly 6.32009 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 7, 2, 23, 53) fem-speedup-cpp-solve 1.94115 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 7, 2, 24, 21) mesh-refinement-cpp 25.4597 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 7, 2, 24, 43) mesh-topology-cpp 22.3211 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 7, 2, 25, 13) mesh-unitcube-cpp 29.8543 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 7, 2, 25, 56) mesh-iteration-cpp 40.304 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 7, 2, 26, 18) function-evaluation-cpp 21.6466 "Evaluations of functions at arbitrary points."
+(2013, 1, 7, 2, 26, 18) function-evaluation-cpp 21.5327 "Evaluations of functions at arbitrary points."
+(2013, 1, 7, 2, 26, 45) la-vector-access-cpp 23.2755 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 7, 2, 27, 11) la-vector-assignment-cpp 26.0323 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 8, 9, 30, 3) common-progress-cpp 27.6769 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 8, 9, 30, 31) common-timing-cpp 27.89 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 8, 9, 32, 19) fem-multicore-cpp 108.086 "Coloring mesh."
+(2013, 1, 8, 9, 34, 48) fem-assembly-cpp 148.336 "Assembly for various forms and backends"
+(2013, 1, 8, 9, 34, 59) fem-convergence-cpp 11.5748 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 8, 9, 35, 0) fem-jit-python 0.000421596 "JIT compilation (in memory cache)"
+(2013, 1, 8, 9, 40, 29) fem-speedup-cpp 329.284 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 8, 9, 40, 29) fem-speedup-cpp-assembly 6.44639 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 8, 9, 40, 29) fem-speedup-cpp-solve 2.04301 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 8, 9, 40, 57) mesh-refinement-cpp 25.4305 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 8, 9, 41, 20) mesh-topology-cpp 22.7566 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 8, 9, 41, 50) mesh-unitcube-cpp 30.018 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 8, 9, 42, 39) mesh-iteration-cpp 45.9287 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 8, 9, 43, 3) function-evaluation-cpp 24.6349 "Evaluations of functions at arbitrary points."
+(2013, 1, 8, 9, 43, 3) function-evaluation-cpp 24.4969 "Evaluations of functions at arbitrary points."
+(2013, 1, 8, 9, 43, 9) function-extrapolation-python 5.06534 "*** -------------------------------------------------------------------------"
+(2013, 1, 8, 9, 43, 9) function-extrapolation-python 1.89934 "*** -------------------------------------------------------------------------"
+(2013, 1, 8, 9, 43, 34) la-vector-access-cpp 25.4216 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 8, 9, 44, 0) la-vector-assignment-cpp 26.0434 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 10, 2, 14, 15) common-progress-cpp 46.5251 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 10, 2, 14, 41) common-timing-cpp 26.03 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 10, 2, 17, 38) fem-multicore-cpp 176.271 "Coloring mesh."
+(2013, 1, 10, 2, 21, 8) fem-assembly-cpp 210.527 "Assembly for various forms and backends"
+(2013, 1, 10, 2, 21, 21) fem-convergence-cpp 13.1854 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 10, 2, 26, 53) fem-speedup-cpp 329.794 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 10, 2, 26, 53) fem-speedup-cpp-assembly 6.65393 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 10, 2, 26, 53) fem-speedup-cpp-solve 2.10296 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 10, 2, 27, 20) mesh-refinement-cpp 25.0142 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 10, 2, 27, 42) mesh-topology-cpp 21.9036 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 10, 2, 28, 10) mesh-unitcube-cpp 27.6654 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 10, 2, 28, 58) mesh-iteration-cpp 45.2356 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 10, 2, 29, 19) function-evaluation-cpp 21.6253 "Evaluations of functions at arbitrary points."
+(2013, 1, 10, 2, 29, 19) function-evaluation-cpp 21.4886 "Evaluations of functions at arbitrary points."
+(2013, 1, 10, 2, 29, 47) la-vector-access-cpp 25.4046 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 10, 2, 30, 13) la-vector-assignment-cpp 26.0207 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 11, 2, 14, 1) common-progress-cpp 28.9075 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 11, 2, 14, 29) common-timing-cpp 27.7615 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 11, 2, 17, 25) fem-multicore-cpp 176.202 "Coloring mesh."
+(2013, 1, 11, 2, 20, 53) fem-assembly-cpp 207.36 "Assembly for various forms and backends"
+(2013, 1, 11, 2, 21, 5) fem-convergence-cpp 12.9138 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 11, 2, 26, 43) fem-speedup-cpp 327.716 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 11, 2, 26, 43) fem-speedup-cpp-assembly 6.74337 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 11, 2, 26, 43) fem-speedup-cpp-solve 2.13362 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 11, 2, 27, 10) mesh-refinement-cpp 25.579 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 11, 2, 27, 33) mesh-topology-cpp 22.4433 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 11, 2, 28, 3) mesh-unitcube-cpp 29.9766 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 11, 2, 28, 48) mesh-iteration-cpp 41.9984 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 11, 2, 29, 9) function-evaluation-cpp 21.6899 "Evaluations of functions at arbitrary points."
+(2013, 1, 11, 2, 29, 9) function-evaluation-cpp 21.5237 "Evaluations of functions at arbitrary points."
+(2013, 1, 11, 2, 30, 0) function-extrapolation-python 50.6551 "*** -------------------------------------------------------------------------"
+(2013, 1, 11, 2, 30, 0) function-extrapolation-python 1.88481 "*** -------------------------------------------------------------------------"
+(2013, 1, 11, 2, 30, 26) la-vector-access-cpp 25.9293 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 11, 2, 30, 54) la-vector-assignment-cpp 27.4855 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 12, 2, 13, 45) common-progress-cpp 29.0638 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 12, 2, 14, 13) common-timing-cpp 28.4146 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 12, 2, 17, 9) fem-multicore-cpp 175.394 "Coloring mesh."
+(2013, 1, 12, 2, 17, 23) fem-convergence-cpp 12.8391 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 12, 2, 17, 36) fem-jit-python 0.000464296 "JIT compilation (in memory cache)"
+(2013, 1, 12, 2, 22, 55) fem-speedup-cpp 319.498 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 12, 2, 22, 55) fem-speedup-cpp-assembly 6.66774 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 12, 2, 22, 55) fem-speedup-cpp-solve 2.33399 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 12, 2, 23, 22) mesh-refinement-cpp 25.0449 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 12, 2, 23, 44) mesh-topology-cpp 22.1335 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 12, 2, 24, 12) mesh-unitcube-cpp 27.9635 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 12, 2, 24, 55) mesh-iteration-cpp 40.2816 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 12, 2, 25, 17) function-evaluation-cpp 21.6981 "Evaluations of functions at arbitrary points."
+(2013, 1, 12, 2, 25, 17) function-evaluation-cpp 21.5212 "Evaluations of functions at arbitrary points."
+(2013, 1, 12, 2, 26, 2) function-extrapolation-python 44.8762 "*** -------------------------------------------------------------------------"
+(2013, 1, 12, 2, 26, 2) function-extrapolation-python 1.88083 "*** -------------------------------------------------------------------------"
+(2013, 1, 12, 2, 26, 25) la-vector-access-cpp 23.0557 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 12, 2, 26, 53) la-vector-assignment-cpp 28.1005 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 13, 2, 13, 29) common-progress-cpp 29.1072 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 13, 2, 13, 55) common-timing-cpp 26.8199 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 13, 2, 16, 51) fem-multicore-cpp 175.762 "Coloring mesh."
+(2013, 1, 13, 2, 17, 5) fem-convergence-cpp 12.8878 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 13, 2, 17, 7) fem-jit-python 0.000425696 "JIT compilation (in memory cache)"
+(2013, 1, 13, 2, 22, 27) fem-speedup-cpp 319.732 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 13, 2, 22, 27) fem-speedup-cpp-assembly 6.59921 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 13, 2, 22, 27) fem-speedup-cpp-solve 2.32908 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 13, 2, 22, 54) mesh-refinement-cpp 25.1064 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 13, 2, 23, 16) mesh-topology-cpp 22.0354 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 13, 2, 23, 45) mesh-unitcube-cpp 28.7885 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 13, 2, 24, 28) mesh-iteration-cpp 40.2882 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 13, 2, 24, 49) function-evaluation-cpp 21.4172 "Evaluations of functions at arbitrary points."
+(2013, 1, 13, 2, 24, 49) function-evaluation-cpp 21.2329 "Evaluations of functions at arbitrary points."
+(2013, 1, 13, 2, 24, 55) function-extrapolation-python 5.10637 "*** -------------------------------------------------------------------------"
+(2013, 1, 13, 2, 24, 55) function-extrapolation-python 1.87679 "*** -------------------------------------------------------------------------"
+(2013, 1, 13, 2, 25, 20) la-vector-access-cpp 24.9473 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 13, 2, 25, 46) la-vector-assignment-cpp 26.0215 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 14, 2, 13, 40) common-progress-cpp 29.1072 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 14, 2, 14, 8) common-timing-cpp 28.3639 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 14, 2, 17, 4) fem-multicore-cpp 175.802 "Coloring mesh."
+(2013, 1, 14, 2, 17, 18) fem-convergence-cpp 12.7995 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 14, 2, 17, 28) fem-jit-python 0.000466394 "JIT compilation (in memory cache)"
+(2013, 1, 14, 2, 22, 48) fem-speedup-cpp 320.547 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 14, 2, 22, 48) fem-speedup-cpp-assembly 6.57529 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 14, 2, 22, 48) fem-speedup-cpp-solve 2.30587 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 14, 2, 23, 15) mesh-refinement-cpp 25.1114 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 14, 2, 23, 37) mesh-topology-cpp 22.037 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 14, 2, 24, 6) mesh-unitcube-cpp 28.7315 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 14, 2, 24, 49) mesh-iteration-cpp 40.2851 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 14, 2, 25, 10) function-evaluation-cpp 21.1488 "Evaluations of functions at arbitrary points."
+(2013, 1, 14, 2, 25, 10) function-evaluation-cpp 20.9846 "Evaluations of functions at arbitrary points."
+(2013, 1, 14, 2, 25, 51) function-extrapolation-python 40.5416 "*** -------------------------------------------------------------------------"
+(2013, 1, 14, 2, 25, 51) function-extrapolation-python 1.85788 "*** -------------------------------------------------------------------------"
+(2013, 1, 14, 2, 26, 15) la-vector-access-cpp 24.3184 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 14, 2, 26, 43) la-vector-assignment-cpp 27.4852 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 15, 2, 13, 27) common-progress-cpp 29.332 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 15, 2, 13, 55) common-timing-cpp 27.2501 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 15, 2, 16, 51) fem-multicore-cpp 176.051 "Coloring mesh."
+(2013, 1, 15, 2, 17, 5) fem-convergence-cpp 12.8666 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 15, 2, 17, 7) fem-jit-python 0.000440693 "JIT compilation (in memory cache)"
+(2013, 1, 15, 2, 22, 28) fem-speedup-cpp 321.63 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 15, 2, 22, 28) fem-speedup-cpp-assembly 6.58088 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 15, 2, 22, 28) fem-speedup-cpp-solve 2.27925 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 15, 2, 22, 55) mesh-refinement-cpp 25.2067 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 15, 2, 23, 17) mesh-topology-cpp 21.9983 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 15, 2, 23, 46) mesh-unitcube-cpp 28.6831 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 15, 2, 24, 29) mesh-iteration-cpp 40.2741 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 15, 2, 24, 51) function-evaluation-cpp 21.7253 "Evaluations of functions at arbitrary points."
+(2013, 1, 15, 2, 24, 51) function-evaluation-cpp 21.5417 "Evaluations of functions at arbitrary points."
+(2013, 1, 15, 2, 24, 56) function-extrapolation-python 5.14986 "*** -------------------------------------------------------------------------"
+(2013, 1, 15, 2, 24, 56) function-extrapolation-python 1.87687 "*** -------------------------------------------------------------------------"
+(2013, 1, 15, 2, 25, 21) la-vector-access-cpp 24.3784 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 15, 2, 25, 47) la-vector-assignment-cpp 26.0258 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 16, 2, 13, 30) common-progress-cpp 29.0156 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 16, 2, 13, 57) common-timing-cpp 27.5074 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 16, 2, 16, 53) fem-multicore-cpp 175.747 "Coloring mesh."
+(2013, 1, 16, 2, 17, 7) fem-convergence-cpp 12.7917 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 16, 2, 17, 13) fem-jit-python 0.000468087 "JIT compilation (in memory cache)"
+(2013, 1, 16, 2, 22, 35) fem-speedup-cpp 321.892 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 16, 2, 22, 35) fem-speedup-cpp-assembly 6.62603 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 16, 2, 22, 35) fem-speedup-cpp-solve 2.26544 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 16, 2, 23, 2) mesh-refinement-cpp 25.1595 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 16, 2, 23, 24) mesh-topology-cpp 22.1158 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 16, 2, 23, 53) mesh-unitcube-cpp 28.6837 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 16, 2, 24, 36) mesh-iteration-cpp 40.2749 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 16, 2, 24, 58) function-evaluation-cpp 21.5979 "Evaluations of functions at arbitrary points."
+(2013, 1, 16, 2, 24, 58) function-evaluation-cpp 21.4564 "Evaluations of functions at arbitrary points."
+(2013, 1, 16, 2, 25, 3) function-extrapolation-python 5.07854 "*** -------------------------------------------------------------------------"
+(2013, 1, 16, 2, 25, 3) function-extrapolation-python 1.85513 "*** -------------------------------------------------------------------------"
+(2013, 1, 16, 2, 25, 27) la-vector-access-cpp 23.8834 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 16, 2, 25, 53) la-vector-assignment-cpp 26.0283 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 17, 2, 13, 41) common-progress-cpp 29.0073 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 17, 2, 14, 9) common-timing-cpp 27.9297 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 17, 2, 17, 5) fem-multicore-cpp 175.821 "Coloring mesh."
+(2013, 1, 17, 2, 17, 19) fem-convergence-cpp 12.8058 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 17, 2, 17, 21) fem-jit-python 0.000441289 "JIT compilation (in memory cache)"
+(2013, 1, 17, 2, 22, 41) fem-speedup-cpp 320.424 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 17, 2, 22, 41) fem-speedup-cpp-assembly 6.58347 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 17, 2, 22, 41) fem-speedup-cpp-solve 2.31455 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 17, 2, 23, 8) mesh-refinement-cpp 25.1426 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 17, 2, 23, 30) mesh-topology-cpp 22.0589 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 17, 2, 23, 59) mesh-unitcube-cpp 28.5793 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 17, 2, 24, 44) mesh-iteration-cpp 42.7842 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 17, 2, 25, 6) function-evaluation-cpp 21.6734 "Evaluations of functions at arbitrary points."
+(2013, 1, 17, 2, 25, 6) function-evaluation-cpp 21.4883 "Evaluations of functions at arbitrary points."
+(2013, 1, 17, 2, 25, 11) function-extrapolation-python 5.18334 "*** -------------------------------------------------------------------------"
+(2013, 1, 17, 2, 25, 11) function-extrapolation-python 1.85616 "*** -------------------------------------------------------------------------"
+(2013, 1, 17, 2, 25, 36) la-vector-access-cpp 24.3091 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 17, 2, 26, 2) la-vector-assignment-cpp 26.1076 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 18, 2, 13, 38) common-progress-cpp 28.9989 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 18, 2, 14, 8) common-timing-cpp 29.693 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 18, 2, 17, 4) fem-multicore-cpp 175.731 "Coloring mesh."
+(2013, 1, 18, 2, 17, 18) fem-convergence-cpp 12.9016 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 18, 2, 17, 20) fem-jit-python 0.000437999 "JIT compilation (in memory cache)"
+(2013, 1, 18, 2, 22, 43) fem-speedup-cpp 323.569 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 18, 2, 22, 43) fem-speedup-cpp-assembly 6.5989 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 18, 2, 22, 43) fem-speedup-cpp-solve 2.26139 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 18, 2, 23, 10) mesh-refinement-cpp 24.8542 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 18, 2, 23, 32) mesh-topology-cpp 21.9163 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 18, 2, 23, 59) mesh-unitcube-cpp 27.4605 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 18, 2, 24, 43) mesh-iteration-cpp 40.3387 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 18, 2, 25, 4) function-evaluation-cpp 21.6172 "Evaluations of functions at arbitrary points."
+(2013, 1, 18, 2, 25, 4) function-evaluation-cpp 21.4665 "Evaluations of functions at arbitrary points."
+(2013, 1, 18, 2, 25, 10) function-extrapolation-python 5.15149 "*** -------------------------------------------------------------------------"
+(2013, 1, 18, 2, 25, 10) function-extrapolation-python 1.85093 "*** -------------------------------------------------------------------------"
+(2013, 1, 18, 2, 25, 35) la-vector-access-cpp 25.7341 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 18, 2, 26, 3) la-vector-assignment-cpp 27.9165 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 19, 2, 13, 33) common-progress-cpp 29.0406 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 19, 2, 14, 2) common-timing-cpp 28.4299 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 19, 2, 16, 57) fem-multicore-cpp 175.758 "Coloring mesh."
+(2013, 1, 19, 2, 17, 11) fem-convergence-cpp 12.8436 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 19, 2, 17, 13) fem-jit-python 0.000450706 "JIT compilation (in memory cache)"
+(2013, 1, 19, 2, 22, 34) fem-speedup-cpp 320.408 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 19, 2, 22, 34) fem-speedup-cpp-assembly 6.61059 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 19, 2, 22, 34) fem-speedup-cpp-solve 2.34127 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 19, 2, 23, 0) mesh-refinement-cpp 24.8787 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 19, 2, 23, 22) mesh-topology-cpp 22.0097 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 19, 2, 23, 50) mesh-unitcube-cpp 27.3828 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 19, 2, 24, 33) mesh-iteration-cpp 40.2712 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 19, 2, 24, 57) function-evaluation-cpp 24.4473 "Evaluations of functions at arbitrary points."
+(2013, 1, 19, 2, 24, 57) function-evaluation-cpp 24.2817 "Evaluations of functions at arbitrary points."
+(2013, 1, 19, 2, 25, 3) function-extrapolation-python 5.02378 "*** -------------------------------------------------------------------------"
+(2013, 1, 19, 2, 25, 3) function-extrapolation-python 1.883 "*** -------------------------------------------------------------------------"
+(2013, 1, 19, 2, 25, 29) la-vector-access-cpp 25.9917 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 19, 2, 25, 55) la-vector-assignment-cpp 26.0252 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 20, 2, 13, 42) common-progress-cpp 28.9823 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 20, 2, 14, 11) common-timing-cpp 28.42 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 20, 2, 17, 8) fem-multicore-cpp 176.585 "Coloring mesh."
+(2013, 1, 20, 2, 17, 22) fem-convergence-cpp 12.9216 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 20, 2, 17, 24) fem-jit-python 0.00043211 "JIT compilation (in memory cache)"
+(2013, 1, 20, 2, 22, 45) fem-speedup-cpp 321.325 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 20, 2, 22, 45) fem-speedup-cpp-assembly 6.59784 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 20, 2, 22, 45) fem-speedup-cpp-solve 2.32001 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 20, 2, 23, 12) mesh-refinement-cpp 24.974 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 20, 2, 23, 34) mesh-topology-cpp 22.0486 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 20, 2, 24, 2) mesh-unitcube-cpp 27.9062 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 20, 2, 24, 45) mesh-iteration-cpp 40.265 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 20, 2, 25, 6) function-evaluation-cpp 21.509 "Evaluations of functions at arbitrary points."
+(2013, 1, 20, 2, 25, 6) function-evaluation-cpp 21.338 "Evaluations of functions at arbitrary points."
+(2013, 1, 20, 2, 25, 12) function-extrapolation-python 5.12828 "*** -------------------------------------------------------------------------"
+(2013, 1, 20, 2, 25, 12) function-extrapolation-python 1.88845 "*** -------------------------------------------------------------------------"
+(2013, 1, 20, 2, 25, 38) la-vector-access-cpp 25.9707 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 20, 2, 26, 4) la-vector-assignment-cpp 26.0248 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 21, 2, 13, 50) common-progress-cpp 36.6006 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 21, 2, 14, 19) common-timing-cpp 28.448 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 21, 2, 17, 15) fem-multicore-cpp 176.479 "Coloring mesh."
+(2013, 1, 21, 2, 17, 29) fem-convergence-cpp 12.9281 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 21, 2, 17, 35) fem-jit-python 0.000461888 "JIT compilation (in memory cache)"
+(2013, 1, 21, 2, 22, 56) fem-speedup-cpp 321.418 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 21, 2, 22, 56) fem-speedup-cpp-assembly 6.60954 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 21, 2, 22, 56) fem-speedup-cpp-solve 2.30787 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 21, 2, 23, 23) mesh-refinement-cpp 24.8547 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 21, 2, 23, 45) mesh-topology-cpp 21.9757 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 21, 2, 24, 13) mesh-unitcube-cpp 27.8767 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 21, 2, 24, 56) mesh-iteration-cpp 40.3027 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 21, 2, 25, 18) function-evaluation-cpp 21.6614 "Evaluations of functions at arbitrary points."
+(2013, 1, 21, 2, 25, 18) function-evaluation-cpp 21.5169 "Evaluations of functions at arbitrary points."
+(2013, 1, 21, 2, 25, 23) function-extrapolation-python 4.94182 "*** -------------------------------------------------------------------------"
+(2013, 1, 21, 2, 25, 23) function-extrapolation-python 1.84695 "*** -------------------------------------------------------------------------"
+(2013, 1, 21, 2, 25, 49) la-vector-access-cpp 25.9738 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 21, 2, 26, 15) la-vector-assignment-cpp 26.0201 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 22, 2, 13, 48) common-progress-cpp 28.9574 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 22, 2, 14, 16) common-timing-cpp 28.3909 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 22, 2, 17, 14) fem-multicore-cpp 177.196 "Coloring mesh."
+(2013, 1, 22, 2, 17, 28) fem-convergence-cpp 12.9342 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 22, 2, 17, 30) fem-jit-python 0.000439119 "JIT compilation (in memory cache)"
+(2013, 1, 22, 2, 22, 52) fem-speedup-cpp 321.926 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 22, 2, 22, 52) fem-speedup-cpp-assembly 6.58873 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 22, 2, 22, 52) fem-speedup-cpp-solve 2.29602 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 22, 2, 23, 18) mesh-refinement-cpp 24.9235 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 22, 2, 23, 40) mesh-topology-cpp 21.9956 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 22, 2, 24, 8) mesh-unitcube-cpp 27.9028 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 22, 2, 24, 52) mesh-iteration-cpp 40.3414 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 22, 2, 25, 13) function-evaluation-cpp 21.607 "Evaluations of functions at arbitrary points."
+(2013, 1, 22, 2, 25, 13) function-evaluation-cpp 21.4252 "Evaluations of functions at arbitrary points."
+(2013, 1, 22, 2, 25, 18) function-extrapolation-python 5.16426 "*** -------------------------------------------------------------------------"
+(2013, 1, 22, 2, 25, 18) function-extrapolation-python 1.8926 "*** -------------------------------------------------------------------------"
+(2013, 1, 22, 2, 25, 44) la-vector-access-cpp 25.407 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 22, 2, 26, 10) la-vector-assignment-cpp 26.0217 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 23, 2, 14, 1) common-progress-cpp 29.0323 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 23, 2, 14, 32) common-timing-cpp 30.8028 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 23, 2, 17, 28) fem-multicore-cpp 176.407 "Coloring mesh."
+(2013, 1, 23, 2, 17, 42) fem-convergence-cpp 12.7902 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 23, 2, 17, 55) fem-jit-python 0.000463915 "JIT compilation (in memory cache)"
+(2013, 1, 23, 2, 23, 22) fem-speedup-cpp 326.326 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 23, 2, 23, 22) fem-speedup-cpp-assembly 6.46845 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 23, 2, 23, 22) fem-speedup-cpp-solve 2.18454 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 23, 2, 23, 49) mesh-refinement-cpp 24.895 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 23, 2, 24, 11) mesh-topology-cpp 21.9758 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 23, 2, 24, 39) mesh-unitcube-cpp 27.8992 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 23, 2, 25, 24) mesh-iteration-cpp 42.8175 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 23, 2, 25, 46) function-evaluation-cpp 21.6573 "Evaluations of functions at arbitrary points."
+(2013, 1, 23, 2, 25, 46) function-evaluation-cpp 21.5382 "Evaluations of functions at arbitrary points."
+(2013, 1, 23, 2, 26, 30) function-extrapolation-python 44.3454 "*** -------------------------------------------------------------------------"
+(2013, 1, 23, 2, 26, 30) function-extrapolation-python 1.89657 "*** -------------------------------------------------------------------------"
+(2013, 1, 23, 2, 26, 56) la-vector-access-cpp 25.9762 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 23, 2, 27, 22) la-vector-assignment-cpp 26.0193 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 24, 2, 14, 9) common-progress-cpp 28.974 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 24, 2, 14, 37) common-timing-cpp 27.2276 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 24, 2, 17, 33) fem-multicore-cpp 175.999 "Coloring mesh."
+(2013, 1, 24, 2, 17, 47) fem-convergence-cpp 12.7795 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 24, 2, 17, 49) fem-jit-python 0.00043149 "JIT compilation (in memory cache)"
+(2013, 1, 24, 2, 23, 9) fem-speedup-cpp 320.158 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 24, 2, 23, 9) fem-speedup-cpp-assembly 6.61103 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 24, 2, 23, 9) fem-speedup-cpp-solve 2.31415 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 24, 2, 23, 35) mesh-refinement-cpp 24.7524 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 24, 2, 23, 57) mesh-topology-cpp 21.7797 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 24, 2, 24, 25) mesh-unitcube-cpp 27.6775 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 24, 2, 25, 8) mesh-iteration-cpp 40.2959 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 24, 2, 25, 30) function-evaluation-cpp 21.7424 "Evaluations of functions at arbitrary points."
+(2013, 1, 24, 2, 25, 30) function-evaluation-cpp 21.586 "Evaluations of functions at arbitrary points."
+(2013, 1, 24, 2, 25, 35) function-extrapolation-python 5.09456 "*** -------------------------------------------------------------------------"
+(2013, 1, 24, 2, 25, 35) function-extrapolation-python 1.89557 "*** -------------------------------------------------------------------------"
+(2013, 1, 24, 2, 25, 59) la-vector-access-cpp 24.3083 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 24, 2, 26, 25) la-vector-assignment-cpp 25.9697 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 25, 2, 13, 36) common-progress-cpp 46.6334 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 25, 2, 14, 3) common-timing-cpp 27.5028 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 25, 2, 17, 0) fem-multicore-cpp 176.666 "Coloring mesh."
+(2013, 1, 25, 2, 17, 14) fem-convergence-cpp 12.8285 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 25, 2, 17, 27) fem-jit-python 0.00124471 "JIT compilation (in memory cache)"
+(2013, 1, 25, 2, 22, 53) fem-speedup-cpp 326.365 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 25, 2, 22, 53) fem-speedup-cpp-assembly 6.65954 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 25, 2, 22, 53) fem-speedup-cpp-solve 2.1487 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 25, 2, 23, 20) mesh-refinement-cpp 24.732 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 25, 2, 23, 42) mesh-topology-cpp 21.7758 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 25, 2, 24, 10) mesh-unitcube-cpp 27.5992 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 25, 2, 24, 54) mesh-iteration-cpp 41.6061 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 25, 2, 25, 16) function-evaluation-cpp 21.7214 "Evaluations of functions at arbitrary points."
+(2013, 1, 25, 2, 25, 16) function-evaluation-cpp 21.5959 "Evaluations of functions at arbitrary points."
+(2013, 1, 25, 2, 26, 0) function-extrapolation-python 44.2916 "*** -------------------------------------------------------------------------"
+(2013, 1, 25, 2, 26, 0) function-extrapolation-python 1.8612 "*** -------------------------------------------------------------------------"
+(2013, 1, 25, 2, 26, 25) la-vector-access-cpp 24.3241 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 25, 2, 26, 51) la-vector-assignment-cpp 26.0231 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 26, 2, 13, 41) common-progress-cpp 29.0572 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 26, 2, 14, 9) common-timing-cpp 27.3754 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 26, 2, 17, 4) fem-multicore-cpp 175.443 "Coloring mesh."
+(2013, 1, 26, 2, 17, 18) fem-convergence-cpp 12.8325 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 26, 2, 17, 20) fem-jit-python 0.0011827 "JIT compilation (in memory cache)"
+(2013, 1, 26, 2, 22, 42) fem-speedup-cpp 322.163 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 26, 2, 22, 42) fem-speedup-cpp-assembly 6.68567 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 26, 2, 22, 42) fem-speedup-cpp-solve 2.26771 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 26, 2, 23, 9) mesh-refinement-cpp 24.8247 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 26, 2, 23, 31) mesh-topology-cpp 21.8361 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 26, 2, 23, 59) mesh-unitcube-cpp 27.6278 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 26, 2, 24, 42) mesh-iteration-cpp 40.2689 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 26, 2, 25, 3) function-evaluation-cpp 21.4792 "Evaluations of functions at arbitrary points."
+(2013, 1, 26, 2, 25, 3) function-evaluation-cpp 21.3553 "Evaluations of functions at arbitrary points."
+(2013, 1, 26, 2, 25, 8) function-extrapolation-python 4.92343 "*** -------------------------------------------------------------------------"
+(2013, 1, 26, 2, 25, 8) function-extrapolation-python 1.85815 "*** -------------------------------------------------------------------------"
+(2013, 1, 26, 2, 25, 32) la-vector-access-cpp 23.4097 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 26, 2, 25, 58) la-vector-assignment-cpp 26.0248 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 27, 2, 13, 45) common-progress-cpp 36.5507 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 27, 2, 14, 12) common-timing-cpp 27.355 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 27, 2, 17, 8) fem-multicore-cpp 175.584 "Coloring mesh."
+(2013, 1, 27, 2, 17, 22) fem-convergence-cpp 12.8384 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 27, 2, 17, 24) fem-jit-python 0.0011826 "JIT compilation (in memory cache)"
+(2013, 1, 27, 2, 22, 46) fem-speedup-cpp 321.761 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 27, 2, 22, 46) fem-speedup-cpp-assembly 6.61098 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 27, 2, 22, 46) fem-speedup-cpp-solve 2.27064 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 27, 2, 23, 12) mesh-refinement-cpp 24.7441 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 27, 2, 23, 34) mesh-topology-cpp 21.7775 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 27, 2, 24, 2) mesh-unitcube-cpp 27.6418 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 27, 2, 24, 45) mesh-iteration-cpp 40.272 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 27, 2, 25, 7) function-evaluation-cpp 21.7653 "Evaluations of functions at arbitrary points."
+(2013, 1, 27, 2, 25, 7) function-evaluation-cpp 21.5784 "Evaluations of functions at arbitrary points."
+(2013, 1, 27, 2, 25, 12) function-extrapolation-python 5.04005 "*** -------------------------------------------------------------------------"
+(2013, 1, 27, 2, 25, 12) function-extrapolation-python 1.84921 "*** -------------------------------------------------------------------------"
+(2013, 1, 27, 2, 25, 36) la-vector-access-cpp 24.3332 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 27, 2, 26, 2) la-vector-assignment-cpp 26.0227 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 28, 2, 13, 31) common-progress-cpp 29.0906 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 28, 2, 13, 59) common-timing-cpp 27.7402 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 28, 2, 16, 56) fem-multicore-cpp 176.709 "Coloring mesh."
+(2013, 1, 28, 2, 17, 10) fem-convergence-cpp 12.8045 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 28, 2, 17, 12) fem-jit-python 0.00118959 "JIT compilation (in memory cache)"
+(2013, 1, 28, 2, 22, 31) fem-speedup-cpp 319.714 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 28, 2, 22, 31) fem-speedup-cpp-assembly 6.63927 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 28, 2, 22, 31) fem-speedup-cpp-solve 2.33265 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 28, 2, 22, 58) mesh-refinement-cpp 24.7539 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 28, 2, 23, 20) mesh-topology-cpp 21.7714 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 28, 2, 23, 47) mesh-unitcube-cpp 27.6728 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 28, 2, 24, 30) mesh-iteration-cpp 40.2776 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 28, 2, 24, 52) function-evaluation-cpp 21.7903 "Evaluations of functions at arbitrary points."
+(2013, 1, 28, 2, 24, 52) function-evaluation-cpp 21.609 "Evaluations of functions at arbitrary points."
+(2013, 1, 28, 2, 24, 57) function-extrapolation-python 5.11035 "*** -------------------------------------------------------------------------"
+(2013, 1, 28, 2, 24, 57) function-extrapolation-python 1.8778 "*** -------------------------------------------------------------------------"
+(2013, 1, 28, 2, 25, 22) la-vector-access-cpp 24.3376 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 28, 2, 25, 49) la-vector-assignment-cpp 27.4268 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 29, 2, 13, 43) common-progress-cpp 29.2905 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 29, 2, 14, 10) common-timing-cpp 27.4955 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 29, 2, 17, 7) fem-multicore-cpp 176.159 "Coloring mesh."
+(2013, 1, 29, 2, 17, 20) fem-convergence-cpp 12.8013 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 29, 2, 17, 23) fem-jit-python 0.0011946 "JIT compilation (in memory cache)"
+(2013, 1, 29, 2, 22, 47) fem-speedup-cpp 324.311 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 29, 2, 22, 47) fem-speedup-cpp-assembly 6.59535 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 29, 2, 22, 47) fem-speedup-cpp-solve 2.20879 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 29, 2, 23, 14) mesh-refinement-cpp 24.6256 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 29, 2, 23, 35) mesh-topology-cpp 21.7591 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 29, 2, 24, 3) mesh-unitcube-cpp 27.8751 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 29, 2, 24, 47) mesh-iteration-cpp 40.2807 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 29, 2, 25, 9) function-evaluation-cpp 22.4213 "Evaluations of functions at arbitrary points."
+(2013, 1, 29, 2, 25, 9) function-evaluation-cpp 22.3029 "Evaluations of functions at arbitrary points."
+(2013, 1, 29, 2, 25, 14) function-extrapolation-python 5.16509 "*** -------------------------------------------------------------------------"
+(2013, 1, 29, 2, 25, 14) function-extrapolation-python 1.8694 "*** -------------------------------------------------------------------------"
+(2013, 1, 29, 2, 25, 38) la-vector-access-cpp 24.326 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 29, 2, 26, 5) la-vector-assignment-cpp 26.0185 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 30, 2, 14, 30) common-progress-cpp 28.9739 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 30, 2, 14, 58) common-timing-cpp 27.7129 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 30, 2, 17, 54) fem-multicore-cpp 175.873 "Coloring mesh."
+(2013, 1, 30, 2, 18, 8) fem-convergence-cpp 12.7941 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 30, 2, 18, 21) fem-jit-python 0.00127661 "JIT compilation (in memory cache)"
+(2013, 1, 30, 2, 23, 42) fem-speedup-cpp 321.313 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 30, 2, 23, 42) fem-speedup-cpp-assembly 6.65346 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 30, 2, 23, 42) fem-speedup-cpp-solve 2.28961 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 30, 2, 24, 9) mesh-refinement-cpp 24.7683 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 30, 2, 24, 31) mesh-topology-cpp 21.7878 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 30, 2, 24, 58) mesh-unitcube-cpp 27.3436 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 30, 2, 25, 41) mesh-iteration-cpp 40.2682 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 30, 2, 26, 3) function-evaluation-cpp 21.6926 "Evaluations of functions at arbitrary points."
+(2013, 1, 30, 2, 26, 3) function-evaluation-cpp 21.5498 "Evaluations of functions at arbitrary points."
+(2013, 1, 30, 2, 26, 48) function-extrapolation-python 44.675 "*** -------------------------------------------------------------------------"
+(2013, 1, 30, 2, 26, 48) function-extrapolation-python 1.85632 "*** -------------------------------------------------------------------------"
+(2013, 1, 30, 2, 27, 11) la-vector-access-cpp 23.0839 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 30, 2, 27, 37) la-vector-assignment-cpp 26.0244 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 1, 31, 2, 13, 43) common-progress-cpp 29.0323 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 1, 31, 2, 14, 11) common-timing-cpp 28.0397 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 1, 31, 2, 17, 6) fem-multicore-cpp 175.468 "Coloring mesh."
+(2013, 1, 31, 2, 17, 20) fem-convergence-cpp 12.8566 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 1, 31, 2, 17, 22) fem-jit-python 0.0012038 "JIT compilation (in memory cache)"
+(2013, 1, 31, 2, 22, 42) fem-speedup-cpp 319.394 "Assembly/solve speedup running on 4 processors"
+(2013, 1, 31, 2, 22, 42) fem-speedup-cpp-assembly 6.78627 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 1, 31, 2, 22, 42) fem-speedup-cpp-solve 2.21678 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 1, 31, 2, 23, 8) mesh-refinement-cpp 24.7231 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 1, 31, 2, 23, 30) mesh-topology-cpp 21.8377 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 1, 31, 2, 23, 58) mesh-unitcube-cpp 27.4743 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 1, 31, 2, 24, 42) mesh-iteration-cpp 40.9686 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 1, 31, 2, 25, 3) function-evaluation-cpp 21.6549 "Evaluations of functions at arbitrary points."
+(2013, 1, 31, 2, 25, 3) function-evaluation-cpp 21.5415 "Evaluations of functions at arbitrary points."
+(2013, 1, 31, 2, 25, 8) function-extrapolation-python 5.02747 "*** -------------------------------------------------------------------------"
+(2013, 1, 31, 2, 25, 8) function-extrapolation-python 1.85629 "*** -------------------------------------------------------------------------"
+(2013, 1, 31, 2, 25, 32) la-vector-access-cpp 23.0452 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 1, 31, 2, 25, 59) la-vector-assignment-cpp 27.3739 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 1, 2, 13, 38) common-progress-cpp 28.949 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 1, 2, 14, 7) common-timing-cpp 28.6266 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 1, 2, 17, 3) fem-multicore-cpp 175.707 "Coloring mesh."
+(2013, 2, 1, 2, 17, 17) fem-convergence-cpp 12.9295 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 1, 2, 17, 19) fem-jit-python 0.00121191 "JIT compilation (in memory cache)"
+(2013, 2, 1, 2, 22, 35) fem-speedup-cpp 316.106 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 1, 2, 22, 35) fem-speedup-cpp-assembly 6.79646 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 1, 2, 22, 35) fem-speedup-cpp-solve 2.331 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 1, 2, 23, 2) mesh-refinement-cpp 24.7623 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 1, 2, 23, 24) mesh-topology-cpp 21.9673 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 1, 2, 23, 52) mesh-unitcube-cpp 28.0743 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 1, 2, 24, 38) mesh-iteration-cpp 42.8807 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 1, 2, 24, 59) function-evaluation-cpp 21.7134 "Evaluations of functions at arbitrary points."
+(2013, 2, 1, 2, 24, 59) function-evaluation-cpp 21.5891 "Evaluations of functions at arbitrary points."
+(2013, 2, 1, 2, 25, 5) function-extrapolation-python 5.04747 "*** -------------------------------------------------------------------------"
+(2013, 2, 1, 2, 25, 5) function-extrapolation-python 1.84771 "*** -------------------------------------------------------------------------"
+(2013, 2, 1, 2, 25, 29) la-vector-access-cpp 24.3275 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 1, 2, 25, 55) la-vector-assignment-cpp 26.0251 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 2, 2, 14, 5) common-progress-cpp 29.0558 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 2, 2, 14, 33) common-timing-cpp 27.8623 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 2, 2, 16, 20) fem-multicore-cpp 107.325 "Coloring mesh."
+(2013, 2, 2, 2, 16, 33) fem-convergence-cpp 11.6857 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 2, 2, 16, 35) fem-jit-python 0.00123742 "JIT compilation (in memory cache)"
+(2013, 2, 2, 2, 21, 46) fem-speedup-cpp 311.211 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 2, 2, 21, 46) fem-speedup-cpp-assembly 6.47385 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 2, 2, 21, 46) fem-speedup-cpp-solve 2.35899 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 2, 2, 22, 13) mesh-refinement-cpp 24.7819 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 2, 2, 22, 35) mesh-topology-cpp 22.058 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 2, 2, 23, 2) mesh-unitcube-cpp 27.4631 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 2, 2, 23, 45) mesh-iteration-cpp 40.2504 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 2, 2, 24, 7) function-evaluation-cpp 21.6428 "Evaluations of functions at arbitrary points."
+(2013, 2, 2, 2, 24, 7) function-evaluation-cpp 21.5019 "Evaluations of functions at arbitrary points."
+(2013, 2, 2, 2, 24, 12) function-extrapolation-python 5.03068 "*** -------------------------------------------------------------------------"
+(2013, 2, 2, 2, 24, 12) function-extrapolation-python 1.85362 "*** -------------------------------------------------------------------------"
+(2013, 2, 2, 2, 24, 37) la-vector-access-cpp 24.3377 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 2, 2, 25, 3) la-vector-assignment-cpp 26.024 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 3, 2, 13, 47) common-progress-cpp 29.0573 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 3, 2, 14, 16) common-timing-cpp 28.2761 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 3, 2, 16, 4) fem-multicore-cpp 108.034 "Coloring mesh."
+(2013, 2, 3, 2, 16, 16) fem-convergence-cpp 11.7451 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 3, 2, 16, 18) fem-jit-python 0.00121939 "JIT compilation (in memory cache)"
+(2013, 2, 3, 2, 21, 23) fem-speedup-cpp 304.801 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 3, 2, 21, 23) fem-speedup-cpp-assembly 6.5549 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 3, 2, 21, 23) fem-speedup-cpp-solve 2.47267 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 3, 2, 21, 50) mesh-refinement-cpp 25.2302 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 3, 2, 22, 12) mesh-topology-cpp 21.9697 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 3, 2, 22, 40) mesh-unitcube-cpp 27.522 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 3, 2, 23, 23) mesh-iteration-cpp 40.2736 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 3, 2, 23, 45) function-evaluation-cpp 21.7926 "Evaluations of functions at arbitrary points."
+(2013, 2, 3, 2, 23, 45) function-evaluation-cpp 21.6351 "Evaluations of functions at arbitrary points."
+(2013, 2, 3, 2, 23, 50) function-extrapolation-python 5.20108 "*** -------------------------------------------------------------------------"
+(2013, 2, 3, 2, 23, 50) function-extrapolation-python 1.90171 "*** -------------------------------------------------------------------------"
+(2013, 2, 3, 2, 24, 13) la-vector-access-cpp 23.0619 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 3, 2, 24, 41) la-vector-assignment-cpp 27.6175 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 4, 2, 13, 43) common-progress-cpp 29.0656 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 4, 2, 14, 12) common-timing-cpp 28.9802 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 4, 2, 16, 0) fem-multicore-cpp 108.145 "Coloring mesh."
+(2013, 2, 4, 2, 16, 13) fem-convergence-cpp 11.8229 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 4, 2, 16, 15) fem-jit-python 0.00121241 "JIT compilation (in memory cache)"
+(2013, 2, 4, 2, 21, 22) fem-speedup-cpp 307.635 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 4, 2, 21, 22) fem-speedup-cpp-assembly 6.43624 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 4, 2, 21, 22) fem-speedup-cpp-solve 2.40658 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 4, 2, 21, 49) mesh-refinement-cpp 24.9727 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 4, 2, 22, 11) mesh-topology-cpp 21.8537 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 4, 2, 22, 38) mesh-unitcube-cpp 27.0644 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 4, 2, 23, 23) mesh-iteration-cpp 41.8261 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 4, 2, 23, 45) function-evaluation-cpp 21.7448 "Evaluations of functions at arbitrary points."
+(2013, 2, 4, 2, 23, 45) function-evaluation-cpp 21.6173 "Evaluations of functions at arbitrary points."
+(2013, 2, 4, 2, 23, 50) function-extrapolation-python 4.96734 "*** -------------------------------------------------------------------------"
+(2013, 2, 4, 2, 23, 50) function-extrapolation-python 1.86512 "*** -------------------------------------------------------------------------"
+(2013, 2, 4, 2, 24, 14) la-vector-access-cpp 24.3338 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 4, 2, 24, 40) la-vector-assignment-cpp 26.0144 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 5, 2, 14, 46) common-progress-cpp 28.9574 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 5, 2, 15, 15) common-timing-cpp 28.4751 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 5, 2, 17, 4) fem-multicore-cpp 109.332 "Coloring mesh."
+(2013, 2, 5, 2, 17, 17) fem-convergence-cpp 11.8202 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 5, 2, 17, 34) fem-jit-python 0.00128171 "JIT compilation (in memory cache)"
+(2013, 2, 5, 2, 22, 39) fem-speedup-cpp 305.471 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 5, 2, 22, 39) fem-speedup-cpp-assembly 6.4724 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 5, 2, 22, 39) fem-speedup-cpp-solve 2.43799 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 5, 2, 23, 6) mesh-refinement-cpp 25.0061 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 5, 2, 23, 28) mesh-topology-cpp 21.9141 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 5, 2, 23, 55) mesh-unitcube-cpp 27.1391 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 5, 2, 24, 38) mesh-iteration-cpp 40.3617 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 5, 2, 25, 0) function-evaluation-cpp 21.7322 "Evaluations of functions at arbitrary points."
+(2013, 2, 5, 2, 25, 0) function-evaluation-cpp 21.5795 "Evaluations of functions at arbitrary points."
+(2013, 2, 5, 2, 25, 49) function-extrapolation-python 49.0225 "*** -------------------------------------------------------------------------"
+(2013, 2, 5, 2, 25, 49) function-extrapolation-python 1.87354 "*** -------------------------------------------------------------------------"
+(2013, 2, 5, 2, 26, 14) la-vector-access-cpp 24.9135 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 5, 2, 26, 40) la-vector-assignment-cpp 26.0214 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 6, 2, 14, 3) common-progress-cpp 29.024 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 6, 2, 14, 32) common-timing-cpp 28.1353 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 6, 2, 16, 20) fem-multicore-cpp 108.128 "Coloring mesh."
+(2013, 2, 6, 2, 16, 32) fem-convergence-cpp 11.8088 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 6, 2, 16, 49) fem-jit-python 0.00132279 "JIT compilation (in memory cache)"
+(2013, 2, 6, 2, 21, 55) fem-speedup-cpp 305.848 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 6, 2, 21, 55) fem-speedup-cpp-assembly 6.32375 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 6, 2, 21, 55) fem-speedup-cpp-solve 2.42394 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 6, 2, 22, 22) mesh-refinement-cpp 25.0894 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 6, 2, 22, 44) mesh-topology-cpp 21.8889 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 6, 2, 23, 11) mesh-unitcube-cpp 27.1583 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 6, 2, 23, 54) mesh-iteration-cpp 40.3066 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 6, 2, 24, 16) function-evaluation-cpp 21.7427 "Evaluations of functions at arbitrary points."
+(2013, 2, 6, 2, 24, 16) function-evaluation-cpp 21.5884 "Evaluations of functions at arbitrary points."
+(2013, 2, 6, 2, 25, 5) function-extrapolation-python 49.2393 "*** -------------------------------------------------------------------------"
+(2013, 2, 6, 2, 25, 5) function-extrapolation-python 1.88775 "*** -------------------------------------------------------------------------"
+(2013, 2, 6, 2, 25, 31) la-vector-access-cpp 25.9241 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 6, 2, 25, 59) la-vector-assignment-cpp 28.0415 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 7, 2, 14, 24) common-progress-cpp 28.9074 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 7, 2, 14, 53) common-timing-cpp 29.0648 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 7, 2, 16, 41) fem-multicore-cpp 108.198 "Coloring mesh."
+(2013, 2, 7, 2, 16, 54) fem-convergence-cpp 11.7889 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 7, 2, 16, 56) fem-jit-python 0.00122221 "JIT compilation (in memory cache)"
+(2013, 2, 7, 2, 22, 4) fem-speedup-cpp 307.608 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 7, 2, 22, 4) fem-speedup-cpp-assembly 6.43816 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 7, 2, 22, 4) fem-speedup-cpp-solve 2.36678 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 7, 2, 22, 30) mesh-refinement-cpp 25.0651 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 7, 2, 22, 52) mesh-topology-cpp 22.0341 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 7, 2, 23, 21) mesh-unitcube-cpp 28.1955 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 7, 2, 24, 4) mesh-iteration-cpp 40.2668 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 7, 2, 24, 25) function-evaluation-cpp 21.3928 "Evaluations of functions at arbitrary points."
+(2013, 2, 7, 2, 24, 25) function-evaluation-cpp 21.2568 "Evaluations of functions at arbitrary points."
+(2013, 2, 7, 2, 24, 30) function-extrapolation-python 4.94471 "*** -------------------------------------------------------------------------"
+(2013, 2, 7, 2, 24, 30) function-extrapolation-python 1.86673 "*** -------------------------------------------------------------------------"
+(2013, 2, 7, 2, 24, 53) la-vector-access-cpp 23.0027 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 7, 2, 25, 19) la-vector-assignment-cpp 26.0184 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 8, 2, 13, 38) common-progress-cpp 28.9574 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 8, 2, 14, 6) common-timing-cpp 28.3846 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 8, 2, 15, 54) fem-multicore-cpp 107.901 "Coloring mesh."
+(2013, 2, 8, 2, 18, 24) fem-assembly-cpp 150.086 "Assembly for various forms and backends"
+(2013, 2, 8, 2, 18, 36) fem-convergence-cpp 11.6963 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 8, 2, 18, 38) fem-jit-python 0.00120771 "JIT compilation (in memory cache)"
+(2013, 2, 8, 2, 23, 46) fem-speedup-cpp 308.366 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 8, 2, 23, 46) fem-speedup-cpp-assembly 6.48082 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 8, 2, 23, 46) fem-speedup-cpp-solve 2.34454 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 8, 2, 24, 13) mesh-refinement-cpp 25.0465 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 8, 2, 24, 35) mesh-topology-cpp 22.0649 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 8, 2, 25, 3) mesh-unitcube-cpp 28.1039 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 8, 2, 25, 47) mesh-iteration-cpp 40.2657 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 8, 2, 26, 9) function-evaluation-cpp 22.3809 "Evaluations of functions at arbitrary points."
+(2013, 2, 8, 2, 26, 9) function-evaluation-cpp 22.2596 "Evaluations of functions at arbitrary points."
+(2013, 2, 8, 2, 26, 14) function-extrapolation-python 5.15655 "*** -------------------------------------------------------------------------"
+(2013, 2, 8, 2, 26, 14) function-extrapolation-python 1.90242 "*** -------------------------------------------------------------------------"
+(2013, 2, 8, 2, 26, 37) la-vector-access-cpp 22.9383 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 8, 2, 27, 3) la-vector-assignment-cpp 26.0266 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 9, 2, 13, 33) common-progress-cpp 28.9655 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 9, 2, 14, 2) common-timing-cpp 28.9988 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 9, 2, 15, 51) fem-multicore-cpp 108.211 "Coloring mesh."
+(2013, 2, 9, 2, 18, 20) fem-assembly-cpp 149.044 "Assembly for various forms and backends"
+(2013, 2, 9, 2, 18, 31) fem-convergence-cpp 11.658 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 9, 2, 18, 33) fem-jit-python 0.00125461 "JIT compilation (in memory cache)"
+(2013, 2, 9, 2, 23, 37) fem-speedup-cpp 303.356 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 9, 2, 23, 37) fem-speedup-cpp-assembly 6.47674 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 9, 2, 23, 37) fem-speedup-cpp-solve 2.47292 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 9, 2, 24, 3) mesh-refinement-cpp 24.9881 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 9, 2, 24, 25) mesh-topology-cpp 22.0403 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 9, 2, 24, 54) mesh-unitcube-cpp 28.2083 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 9, 2, 25, 38) mesh-iteration-cpp 40.9762 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 9, 2, 26, 0) function-evaluation-cpp 22.7584 "Evaluations of functions at arbitrary points."
+(2013, 2, 9, 2, 26, 0) function-evaluation-cpp 22.6253 "Evaluations of functions at arbitrary points."
+(2013, 2, 9, 2, 26, 6) function-extrapolation-python 5.27845 "*** -------------------------------------------------------------------------"
+(2013, 2, 9, 2, 26, 6) function-extrapolation-python 1.92038 "*** -------------------------------------------------------------------------"
+(2013, 2, 9, 2, 26, 29) la-vector-access-cpp 23.0386 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 9, 2, 26, 55) la-vector-assignment-cpp 26.0226 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 10, 2, 13, 12) common-progress-cpp 28.9739 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 10, 2, 13, 41) common-timing-cpp 28.7327 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 10, 2, 15, 29) fem-multicore-cpp 108.072 "Coloring mesh."
+(2013, 2, 10, 2, 17, 58) fem-assembly-cpp 149.41 "Assembly for various forms and backends"
+(2013, 2, 10, 2, 18, 10) fem-convergence-cpp 11.7535 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 10, 2, 18, 12) fem-jit-python 0.00121648 "JIT compilation (in memory cache)"
+(2013, 2, 10, 2, 23, 18) fem-speedup-cpp 305.659 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 10, 2, 23, 18) fem-speedup-cpp-assembly 6.35544 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 10, 2, 23, 18) fem-speedup-cpp-solve 2.41892 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 10, 2, 23, 44) mesh-refinement-cpp 25.0709 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 10, 2, 24, 7) mesh-topology-cpp 22.0626 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 10, 2, 24, 35) mesh-unitcube-cpp 28.122 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 10, 2, 25, 19) mesh-iteration-cpp 41.6044 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 10, 2, 25, 41) function-evaluation-cpp 21.7655 "Evaluations of functions at arbitrary points."
+(2013, 2, 10, 2, 25, 41) function-evaluation-cpp 21.6049 "Evaluations of functions at arbitrary points."
+(2013, 2, 10, 2, 25, 46) function-extrapolation-python 5.34174 "*** -------------------------------------------------------------------------"
+(2013, 2, 10, 2, 25, 46) function-extrapolation-python 1.90602 "*** -------------------------------------------------------------------------"
+(2013, 2, 10, 2, 26, 10) la-vector-access-cpp 23.9848 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 10, 2, 26, 36) la-vector-assignment-cpp 25.9775 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 11, 2, 13, 16) common-progress-cpp 29.1488 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 11, 2, 13, 44) common-timing-cpp 28.7064 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 11, 2, 15, 33) fem-multicore-cpp 108.558 "Coloring mesh."
+(2013, 2, 11, 2, 18, 3) fem-assembly-cpp 150.23 "Assembly for various forms and backends"
+(2013, 2, 11, 2, 18, 15) fem-convergence-cpp 11.7624 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 11, 2, 18, 17) fem-jit-python 0.00121739 "JIT compilation (in memory cache)"
+(2013, 2, 11, 2, 23, 29) fem-speedup-cpp 312.283 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 11, 2, 23, 29) fem-speedup-cpp-assembly 6.48718 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 11, 2, 23, 29) fem-speedup-cpp-solve 2.24288 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 11, 2, 23, 56) mesh-refinement-cpp 25.0178 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 11, 2, 24, 19) mesh-topology-cpp 22.0694 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 11, 2, 24, 47) mesh-unitcube-cpp 28.1513 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 11, 2, 25, 30) mesh-iteration-cpp 40.2508 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 11, 2, 25, 51) function-evaluation-cpp 21.2304 "Evaluations of functions at arbitrary points."
+(2013, 2, 11, 2, 25, 51) function-evaluation-cpp 21.127 "Evaluations of functions at arbitrary points."
+(2013, 2, 11, 2, 25, 56) function-extrapolation-python 5.16633 "*** -------------------------------------------------------------------------"
+(2013, 2, 11, 2, 25, 56) function-extrapolation-python 1.89689 "*** -------------------------------------------------------------------------"
+(2013, 2, 11, 2, 26, 19) la-vector-access-cpp 22.9786 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 11, 2, 26, 45) la-vector-assignment-cpp 26.0351 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 13, 2, 13, 23) common-progress-cpp 37.991 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 13, 2, 13, 52) common-timing-cpp 29.257 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 13, 2, 15, 40) fem-multicore-cpp 107.9 "Coloring mesh."
+(2013, 2, 13, 2, 18, 10) fem-assembly-cpp 149.526 "Assembly for various forms and backends"
+(2013, 2, 13, 2, 18, 21) fem-convergence-cpp 11.7732 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 13, 2, 18, 23) fem-jit-python 0.0012167 "JIT compilation (in memory cache)"
+(2013, 2, 13, 2, 23, 34) fem-speedup-cpp 310.742 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 13, 2, 23, 34) fem-speedup-cpp-assembly 6.40043 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 13, 2, 23, 34) fem-speedup-cpp-solve 2.27336 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 13, 2, 24, 1) mesh-refinement-cpp 25.0649 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 13, 2, 24, 23) mesh-topology-cpp 22.0066 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 13, 2, 24, 51) mesh-unitcube-cpp 27.4921 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 13, 2, 25, 37) mesh-iteration-cpp 43.3767 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 13, 2, 25, 59) function-evaluation-cpp 21.7028 "Evaluations of functions at arbitrary points."
+(2013, 2, 13, 2, 25, 59) function-evaluation-cpp 21.5992 "Evaluations of functions at arbitrary points."
+(2013, 2, 13, 2, 26, 4) function-extrapolation-python 5.17176 "*** -------------------------------------------------------------------------"
+(2013, 2, 13, 2, 26, 4) function-extrapolation-python 1.88215 "*** -------------------------------------------------------------------------"
+(2013, 2, 13, 2, 26, 29) la-vector-access-cpp 24.9309 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 13, 2, 26, 55) la-vector-assignment-cpp 26.0104 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 14, 12, 55, 19) common-progress-cpp 28.7135 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 14, 12, 55, 48) common-timing-cpp 28.8756 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 14, 12, 57, 36) fem-multicore-cpp 107.991 "Coloring mesh."
+(2013, 2, 14, 13, 0, 6) fem-assembly-cpp 150.234 "Assembly for various forms and backends"
+(2013, 2, 14, 13, 0, 18) fem-convergence-cpp 11.7666 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 14, 13, 0, 20) fem-jit-python 0.00122778 "JIT compilation (in memory cache)"
+(2013, 2, 14, 13, 5, 27) fem-speedup-cpp 307.219 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 14, 13, 5, 27) fem-speedup-cpp-assembly 6.54057 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 14, 13, 5, 27) fem-speedup-cpp-solve 2.38725 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 14, 13, 5, 54) mesh-refinement-cpp 25.2902 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 14, 13, 6, 16) mesh-topology-cpp 22.0283 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 14, 13, 6, 44) mesh-unitcube-cpp 27.2148 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 14, 13, 7, 32) mesh-iteration-cpp 46.0374 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 14, 13, 7, 54) function-evaluation-cpp 21.5406 "Evaluations of functions at arbitrary points."
+(2013, 2, 14, 13, 7, 54) function-evaluation-cpp 21.4457 "Evaluations of functions at arbitrary points."
+(2013, 2, 14, 13, 8, 23) la-vector-access-cpp 25.6993 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 14, 13, 8, 55) la-vector-assignment-cpp 31.5685 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 15, 2, 13, 24) common-progress-cpp 28.8301 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 15, 2, 13, 55) common-timing-cpp 30.0053 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 15, 2, 15, 43) fem-multicore-cpp 108.608 "Coloring mesh."
+(2013, 2, 15, 2, 18, 16) fem-assembly-cpp 152.935 "Assembly for various forms and backends"
+(2013, 2, 15, 2, 18, 28) fem-convergence-cpp 11.7358 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 15, 2, 18, 30) fem-jit-python 0.00121601 "JIT compilation (in memory cache)"
+(2013, 2, 15, 2, 23, 36) fem-speedup-cpp 306.106 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 15, 2, 23, 36) fem-speedup-cpp-assembly 6.4591 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 15, 2, 23, 36) fem-speedup-cpp-solve 2.42291 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 15, 2, 24, 3) mesh-refinement-cpp 25.5327 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 15, 2, 24, 26) mesh-topology-cpp 22.1235 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 15, 2, 24, 53) mesh-unitcube-cpp 27.2293 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 15, 2, 25, 36) mesh-iteration-cpp 40.2672 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 15, 2, 25, 58) function-evaluation-cpp 22.2663 "Evaluations of functions at arbitrary points."
+(2013, 2, 15, 2, 25, 58) function-evaluation-cpp 22.1668 "Evaluations of functions at arbitrary points."
+(2013, 2, 15, 2, 26, 3) function-extrapolation-python 4.78032 "*** -------------------------------------------------------------------------"
+(2013, 2, 15, 2, 26, 3) function-extrapolation-python 1.95565 "*** -------------------------------------------------------------------------"
+(2013, 2, 15, 2, 26, 26) la-vector-access-cpp 22.9809 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 15, 2, 26, 54) la-vector-assignment-cpp 28.0228 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 2, 16, 2, 13, 48) common-progress-cpp 28.8133 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 2, 16, 2, 14, 17) common-timing-cpp 29.3088 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 2, 16, 2, 16, 7) fem-multicore-cpp 109.268 "Coloring mesh."
+(2013, 2, 16, 2, 18, 40) fem-assembly-cpp 152.789 "Assembly for various forms and backends"
+(2013, 2, 16, 2, 18, 51) fem-convergence-cpp 11.7382 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 2, 16, 2, 18, 53) fem-jit-python 0.00122449 "JIT compilation (in memory cache)"
+(2013, 2, 16, 2, 24, 1) fem-speedup-cpp 307.572 "Assembly/solve speedup running on 4 processors"
+(2013, 2, 16, 2, 24, 1) fem-speedup-cpp-assembly 6.4494 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 2, 16, 2, 24, 1) fem-speedup-cpp-solve 2.36775 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 2, 16, 2, 24, 28) mesh-refinement-cpp 25.528 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 2, 16, 2, 24, 51) mesh-topology-cpp 22.094 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 2, 16, 2, 25, 18) mesh-unitcube-cpp 27.1552 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 2, 16, 2, 26, 1) mesh-iteration-cpp 40.2643 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 2, 16, 2, 26, 23) function-evaluation-cpp 21.6683 "Evaluations of functions at arbitrary points."
+(2013, 2, 16, 2, 26, 23) function-evaluation-cpp 21.5472 "Evaluations of functions at arbitrary points."
+(2013, 2, 16, 2, 26, 38) function-extrapolation-python 15.0923 "*** -------------------------------------------------------------------------"
+(2013, 2, 16, 2, 26, 38) function-extrapolation-python 1.95866 "*** -------------------------------------------------------------------------"
+(2013, 2, 16, 2, 27, 1) la-vector-access-cpp 23.4226 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 2, 16, 2, 27, 31) la-vector-assignment-cpp 29.5305 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 3, 13, 7, 16) common-progress-cpp 28.7683 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 3, 13, 7, 47) common-timing-cpp 31.3816 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 3, 13, 9, 35) fem-multicore-cpp 107.387 "Coloring mesh."
+(2013, 3, 3, 13, 12, 3) fem-assembly-cpp 148.528 "Assembly for various forms and backends"
+(2013, 3, 3, 13, 12, 15) fem-convergence-cpp 11.893 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 3, 13, 12, 17) fem-jit-python 0.0012048 "JIT compilation (in memory cache)"
+(2013, 3, 3, 13, 17, 26) fem-speedup-cpp 308.684 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 3, 13, 17, 26) fem-speedup-cpp-assembly 6.48294 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 3, 13, 17, 26) fem-speedup-cpp-solve 2.31179 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 3, 13, 17, 52) mesh-refinement-cpp 24.1048 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 3, 13, 18, 14) mesh-topology-cpp 22.1031 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 3, 13, 18, 37) mesh-unitcube-cpp 23.584 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 3, 13, 19, 18) mesh-iteration-cpp 38.4754 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 3, 13, 19, 40) function-evaluation-cpp 21.6033 "Evaluations of functions at arbitrary points."
+(2013, 3, 3, 13, 19, 40) function-evaluation-cpp 21.4773 "Evaluations of functions at arbitrary points."
+(2013, 3, 3, 13, 19, 45) function-extrapolation-python 5.35753 "*** -------------------------------------------------------------------------"
+(2013, 3, 3, 13, 19, 45) function-extrapolation-python 1.97276 "*** -------------------------------------------------------------------------"
+(2013, 3, 3, 13, 20, 8) la-vector-access-cpp 22.8951 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 3, 13, 20, 34) la-vector-assignment-cpp 25.9654 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 4, 2, 13, 58) common-progress-cpp 28.8767 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 4, 2, 14, 29) common-timing-cpp 30.6059 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 4, 2, 16, 16) fem-multicore-cpp 107.368 "Coloring mesh."
+(2013, 3, 4, 2, 18, 45) fem-assembly-cpp 149.109 "Assembly for various forms and backends"
+(2013, 3, 4, 2, 18, 57) fem-convergence-cpp 11.5695 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 4, 2, 18, 59) fem-jit-python 0.0012198 "JIT compilation (in memory cache)"
+(2013, 3, 4, 2, 24, 7) fem-speedup-cpp 308.564 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 4, 2, 24, 7) fem-speedup-cpp-assembly 6.49526 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 4, 2, 24, 7) fem-speedup-cpp-solve 2.3264 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 4, 2, 24, 33) mesh-refinement-cpp 24.0848 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 4, 2, 24, 55) mesh-topology-cpp 22.372 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 4, 2, 25, 19) mesh-unitcube-cpp 23.8255 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 4, 2, 25, 59) mesh-iteration-cpp 37.3498 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 4, 2, 26, 21) function-evaluation-cpp 21.5945 "Evaluations of functions at arbitrary points."
+(2013, 3, 4, 2, 26, 21) function-evaluation-cpp 21.4631 "Evaluations of functions at arbitrary points."
+(2013, 3, 4, 2, 26, 36) function-extrapolation-python 14.8548 "*** -------------------------------------------------------------------------"
+(2013, 3, 4, 2, 26, 36) function-extrapolation-python 2.01239 "*** -------------------------------------------------------------------------"
+(2013, 3, 4, 2, 26, 58) la-vector-access-cpp 22.5985 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 4, 2, 27, 24) la-vector-assignment-cpp 25.9598 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 5, 2, 14, 33) common-progress-cpp 37.5771 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 5, 2, 15, 4) common-timing-cpp 30.5963 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 5, 2, 16, 52) fem-multicore-cpp 107.857 "Coloring mesh."
+(2013, 3, 5, 2, 19, 22) fem-assembly-cpp 150.47 "Assembly for various forms and backends"
+(2013, 3, 5, 2, 19, 34) fem-convergence-cpp 11.6881 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 5, 2, 19, 50) fem-jit-python 0.00128992 "JIT compilation (in memory cache)"
+(2013, 3, 5, 2, 24, 59) fem-speedup-cpp 308.883 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 5, 2, 24, 59) fem-speedup-cpp-assembly 6.60461 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 5, 2, 24, 59) fem-speedup-cpp-solve 2.30416 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 5, 2, 25, 25) mesh-refinement-cpp 24.162 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 5, 2, 25, 47) mesh-topology-cpp 22.2656 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 5, 2, 26, 11) mesh-unitcube-cpp 23.8759 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 5, 2, 26, 51) mesh-iteration-cpp 37.2091 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 5, 2, 27, 12) function-evaluation-cpp 21.6553 "Evaluations of functions at arbitrary points."
+(2013, 3, 5, 2, 27, 12) function-evaluation-cpp 21.5275 "Evaluations of functions at arbitrary points."
+(2013, 3, 5, 2, 28, 0) function-extrapolation-python 47.2473 "*** -------------------------------------------------------------------------"
+(2013, 3, 5, 2, 28, 0) function-extrapolation-python 2.15593 "*** -------------------------------------------------------------------------"
+(2013, 3, 5, 2, 28, 25) la-vector-access-cpp 25.4 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 5, 2, 28, 53) la-vector-assignment-cpp 27.4834 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 6, 2, 13, 48) common-progress-cpp 37.7604 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 6, 2, 14, 18) common-timing-cpp 30.5238 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 6, 2, 16, 6) fem-multicore-cpp 107.718 "Coloring mesh."
+(2013, 3, 6, 2, 18, 36) fem-assembly-cpp 150.135 "Assembly for various forms and backends"
+(2013, 3, 6, 2, 18, 48) fem-convergence-cpp 11.6943 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 6, 2, 18, 50) fem-jit-python 0.0012342 "JIT compilation (in memory cache)"
+(2013, 3, 6, 2, 23, 59) fem-speedup-cpp 309.399 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 6, 2, 23, 59) fem-speedup-cpp-assembly 6.56379 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 6, 2, 23, 59) fem-speedup-cpp-solve 2.29875 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 6, 2, 24, 25) mesh-refinement-cpp 24.1371 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 6, 2, 24, 47) mesh-topology-cpp 22.0929 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 6, 2, 25, 11) mesh-unitcube-cpp 23.7726 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 6, 2, 25, 50) mesh-iteration-cpp 37.2055 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 6, 2, 26, 12) function-evaluation-cpp 21.5366 "Evaluations of functions at arbitrary points."
+(2013, 3, 6, 2, 26, 12) function-evaluation-cpp 21.4162 "Evaluations of functions at arbitrary points."
+(2013, 3, 6, 2, 26, 17) function-extrapolation-python 5.30403 "*** -------------------------------------------------------------------------"
+(2013, 3, 6, 2, 26, 17) function-extrapolation-python 2.14405 "*** -------------------------------------------------------------------------"
+(2013, 3, 6, 2, 26, 40) la-vector-access-cpp 22.8846 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 6, 2, 27, 6) la-vector-assignment-cpp 25.9638 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 7, 2, 14, 0) common-progress-cpp 28.8432 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 7, 2, 14, 33) common-timing-cpp 32.5581 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 7, 2, 16, 20) fem-multicore-cpp 107.121 "Coloring mesh."
+(2013, 3, 7, 2, 18, 50) fem-assembly-cpp 150.293 "Assembly for various forms and backends"
+(2013, 3, 7, 2, 19, 2) fem-convergence-cpp 11.7221 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 7, 2, 19, 4) fem-jit-python 0.00121648 "JIT compilation (in memory cache)"
+(2013, 3, 7, 2, 24, 14) fem-speedup-cpp 309.767 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 7, 2, 24, 14) fem-speedup-cpp-assembly 6.61758 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 7, 2, 24, 14) fem-speedup-cpp-solve 2.30439 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 7, 2, 24, 39) mesh-refinement-cpp 24.4643 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 7, 2, 25, 2) mesh-topology-cpp 22.5519 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 7, 2, 25, 26) mesh-unitcube-cpp 23.6465 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 7, 2, 26, 10) mesh-iteration-cpp 41.3081 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 7, 2, 26, 31) function-evaluation-cpp 21.3388 "Evaluations of functions at arbitrary points."
+(2013, 3, 7, 2, 26, 31) function-evaluation-cpp 21.2109 "Evaluations of functions at arbitrary points."
+(2013, 3, 7, 2, 26, 36) function-extrapolation-python 5.38117 "*** -------------------------------------------------------------------------"
+(2013, 3, 7, 2, 26, 36) function-extrapolation-python 2.14497 "*** -------------------------------------------------------------------------"
+(2013, 3, 7, 2, 27, 2) la-vector-access-cpp 25.4054 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 7, 2, 27, 29) la-vector-assignment-cpp 27.5381 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 8, 2, 14, 19) common-progress-cpp 47.56 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 8, 2, 14, 52) common-timing-cpp 32.3784 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 8, 2, 16, 39) fem-multicore-cpp 107.116 "Coloring mesh."
+(2013, 3, 8, 2, 19, 9) fem-assembly-cpp 149.545 "Assembly for various forms and backends"
+(2013, 3, 8, 2, 19, 20) fem-convergence-cpp 11.7503 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 8, 2, 19, 22) fem-jit-python 0.0012197 "JIT compilation (in memory cache)"
+(2013, 3, 8, 2, 24, 30) fem-speedup-cpp 307.962 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 8, 2, 24, 30) fem-speedup-cpp-assembly 6.61209 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 8, 2, 24, 30) fem-speedup-cpp-solve 2.34787 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 8, 2, 24, 56) mesh-refinement-cpp 24.3243 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 8, 2, 25, 19) mesh-topology-cpp 22.6476 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 8, 2, 25, 43) mesh-unitcube-cpp 24.2202 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 8, 2, 26, 29) mesh-iteration-cpp 43.6634 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 8, 2, 26, 51) function-evaluation-cpp 21.6032 "Evaluations of functions at arbitrary points."
+(2013, 3, 8, 2, 26, 51) function-evaluation-cpp 21.4784 "Evaluations of functions at arbitrary points."
+(2013, 3, 8, 2, 26, 56) function-extrapolation-python 5.2382 "*** -------------------------------------------------------------------------"
+(2013, 3, 8, 2, 26, 56) function-extrapolation-python 2.14476 "*** -------------------------------------------------------------------------"
+(2013, 3, 8, 2, 27, 20) la-vector-access-cpp 23.3109 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 8, 2, 27, 46) la-vector-assignment-cpp 25.9593 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 9, 2, 13, 56) common-progress-cpp 28.8184 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 9, 2, 14, 28) common-timing-cpp 32.053 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 9, 2, 16, 15) fem-multicore-cpp 107.571 "Coloring mesh."
+(2013, 3, 9, 2, 18, 44) fem-assembly-cpp 149.283 "Assembly for various forms and backends"
+(2013, 3, 9, 2, 18, 57) fem-convergence-cpp 12.2405 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 9, 2, 18, 59) fem-jit-python 0.00121739 "JIT compilation (in memory cache)"
+(2013, 3, 9, 2, 24, 7) fem-speedup-cpp 308.411 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 9, 2, 24, 7) fem-speedup-cpp-assembly 6.57784 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 9, 2, 24, 7) fem-speedup-cpp-solve 2.34974 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 9, 2, 24, 33) mesh-refinement-cpp 24.3245 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 9, 2, 24, 55) mesh-topology-cpp 22.4345 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 9, 2, 25, 19) mesh-unitcube-cpp 23.7048 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 9, 2, 26, 3) mesh-iteration-cpp 41.2939 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 9, 2, 26, 25) function-evaluation-cpp 21.853 "Evaluations of functions at arbitrary points."
+(2013, 3, 9, 2, 26, 25) function-evaluation-cpp 21.7216 "Evaluations of functions at arbitrary points."
+(2013, 3, 9, 2, 26, 30) function-extrapolation-python 5.3218 "*** -------------------------------------------------------------------------"
+(2013, 3, 9, 2, 26, 30) function-extrapolation-python 2.15123 "*** -------------------------------------------------------------------------"
+(2013, 3, 9, 2, 26, 56) la-vector-access-cpp 25.4647 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 9, 2, 27, 22) la-vector-assignment-cpp 25.9641 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 10, 2, 13, 37) common-progress-cpp 28.8017 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 10, 2, 14, 10) common-timing-cpp 33.037 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 10, 2, 15, 57) fem-multicore-cpp 106.971 "Coloring mesh."
+(2013, 3, 10, 2, 18, 26) fem-assembly-cpp 149.295 "Assembly for various forms and backends"
+(2013, 3, 10, 2, 18, 38) fem-convergence-cpp 12.2664 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 10, 2, 18, 40) fem-jit-python 0.00122659 "JIT compilation (in memory cache)"
+(2013, 3, 10, 2, 23, 49) fem-speedup-cpp 308.88 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 10, 2, 23, 49) fem-speedup-cpp-assembly 6.52528 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 10, 2, 23, 49) fem-speedup-cpp-solve 2.3563 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 10, 2, 24, 15) mesh-refinement-cpp 24.3412 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 10, 2, 24, 37) mesh-topology-cpp 22.3231 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 10, 2, 25, 1) mesh-unitcube-cpp 23.6815 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 10, 2, 25, 45) mesh-iteration-cpp 41.182 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 10, 2, 26, 6) function-evaluation-cpp 21.6225 "Evaluations of functions at arbitrary points."
+(2013, 3, 10, 2, 26, 6) function-evaluation-cpp 21.4896 "Evaluations of functions at arbitrary points."
+(2013, 3, 10, 2, 26, 12) function-extrapolation-python 5.10432 "*** -------------------------------------------------------------------------"
+(2013, 3, 10, 2, 26, 12) function-extrapolation-python 2.15485 "*** -------------------------------------------------------------------------"
+(2013, 3, 10, 2, 26, 35) la-vector-access-cpp 23.0955 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 10, 2, 27, 1) la-vector-assignment-cpp 25.9728 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 11, 2, 13, 43) common-progress-cpp 37.5522 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 11, 2, 14, 14) common-timing-cpp 31.7833 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 11, 2, 16, 2) fem-multicore-cpp 107.314 "Coloring mesh."
+(2013, 3, 11, 2, 18, 31) fem-assembly-cpp 149.155 "Assembly for various forms and backends"
+(2013, 3, 11, 2, 18, 43) fem-convergence-cpp 12.196 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 11, 2, 18, 45) fem-jit-python 0.00122781 "JIT compilation (in memory cache)"
+(2013, 3, 11, 2, 23, 54) fem-speedup-cpp 309.246 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 11, 2, 23, 54) fem-speedup-cpp-assembly 6.50769 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 11, 2, 23, 54) fem-speedup-cpp-solve 2.34776 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 11, 2, 24, 20) mesh-refinement-cpp 24.3332 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 11, 2, 24, 43) mesh-topology-cpp 22.2754 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 11, 2, 25, 6) mesh-unitcube-cpp 23.6453 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 11, 2, 25, 50) mesh-iteration-cpp 41.2463 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 11, 2, 26, 12) function-evaluation-cpp 21.8302 "Evaluations of functions at arbitrary points."
+(2013, 3, 11, 2, 26, 12) function-evaluation-cpp 21.6935 "Evaluations of functions at arbitrary points."
+(2013, 3, 11, 2, 26, 17) function-extrapolation-python 5.2171 "*** -------------------------------------------------------------------------"
+(2013, 3, 11, 2, 26, 17) function-extrapolation-python 2.16002 "*** -------------------------------------------------------------------------"
+(2013, 3, 11, 2, 26, 40) la-vector-access-cpp 22.9469 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 11, 2, 27, 6) la-vector-assignment-cpp 25.9677 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 12, 2, 14, 14) common-progress-cpp 28.8084 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 12, 2, 14, 46) common-timing-cpp 32.5913 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 12, 2, 16, 34) fem-multicore-cpp 107.404 "Coloring mesh."
+(2013, 3, 12, 2, 19, 1) fem-assembly-cpp 147.424 "Assembly for various forms and backends"
+(2013, 3, 12, 2, 19, 13) fem-convergence-cpp 12.2643 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 12, 2, 19, 15) fem-jit-python 0.00121729 "JIT compilation (in memory cache)"
+(2013, 3, 12, 2, 24, 26) fem-speedup-cpp 310.399 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 12, 2, 24, 26) fem-speedup-cpp-assembly 6.47694 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 12, 2, 24, 26) fem-speedup-cpp-solve 2.32033 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 12, 2, 24, 52) mesh-refinement-cpp 24.4576 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 12, 2, 25, 14) mesh-topology-cpp 22.2033 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 12, 2, 25, 38) mesh-unitcube-cpp 23.5273 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 12, 2, 26, 19) mesh-iteration-cpp 39.4213 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 12, 2, 26, 41) function-evaluation-cpp 21.8973 "Evaluations of functions at arbitrary points."
+(2013, 3, 12, 2, 26, 41) function-evaluation-cpp 21.7654 "Evaluations of functions at arbitrary points."
+(2013, 3, 12, 2, 26, 47) function-extrapolation-python 5.11899 "*** -------------------------------------------------------------------------"
+(2013, 3, 12, 2, 26, 47) function-extrapolation-python 2.15039 "*** -------------------------------------------------------------------------"
+(2013, 3, 12, 2, 27, 9) la-vector-access-cpp 22.9179 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 12, 2, 27, 35) la-vector-assignment-cpp 25.966 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 13, 2, 14, 29) common-progress-cpp 37.6021 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 13, 2, 15, 2) common-timing-cpp 32.7789 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 13, 2, 16, 49) fem-multicore-cpp 107.121 "Coloring mesh."
+(2013, 3, 13, 2, 19, 17) fem-assembly-cpp 148.339 "Assembly for various forms and backends"
+(2013, 3, 13, 2, 19, 30) fem-convergence-cpp 12.3528 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 13, 2, 19, 46) fem-jit-python 0.00127511 "JIT compilation (in memory cache)"
+(2013, 3, 13, 2, 24, 55) fem-speedup-cpp 308.687 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 13, 2, 24, 55) fem-speedup-cpp-assembly 6.56106 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 13, 2, 24, 55) fem-speedup-cpp-solve 2.37074 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 13, 2, 25, 21) mesh-refinement-cpp 24.2996 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 13, 2, 25, 43) mesh-topology-cpp 22.4627 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 13, 2, 26, 7) mesh-unitcube-cpp 23.8317 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 13, 2, 26, 47) mesh-iteration-cpp 37.2392 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 13, 2, 27, 8) function-evaluation-cpp 21.6867 "Evaluations of functions at arbitrary points."
+(2013, 3, 13, 2, 27, 8) function-evaluation-cpp 21.5673 "Evaluations of functions at arbitrary points."
+(2013, 3, 13, 2, 27, 55) function-extrapolation-python 46.914 "*** -------------------------------------------------------------------------"
+(2013, 3, 13, 2, 27, 55) function-extrapolation-python 2.17642 "*** -------------------------------------------------------------------------"
+(2013, 3, 13, 2, 28, 18) la-vector-access-cpp 22.6385 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 13, 2, 28, 45) la-vector-assignment-cpp 27.4089 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 14, 2, 14, 9) common-progress-cpp 28.7684 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 14, 2, 14, 42) common-timing-cpp 32.9984 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 14, 2, 16, 29) fem-multicore-cpp 107.233 "Coloring mesh."
+(2013, 3, 14, 2, 19, 0) fem-assembly-cpp 150.523 "Assembly for various forms and backends"
+(2013, 3, 14, 2, 19, 12) fem-convergence-cpp 12.2397 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 14, 2, 19, 14) fem-jit-python 0.00122569 "JIT compilation (in memory cache)"
+(2013, 3, 14, 2, 24, 26) fem-speedup-cpp 311.559 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 14, 2, 24, 26) fem-speedup-cpp-assembly 6.58504 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 14, 2, 24, 26) fem-speedup-cpp-solve 2.30054 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 14, 2, 24, 52) mesh-refinement-cpp 24.3645 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 14, 2, 25, 14) mesh-topology-cpp 22.3912 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 14, 2, 25, 37) mesh-unitcube-cpp 23.0243 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 14, 2, 26, 17) mesh-iteration-cpp 37.5232 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 14, 2, 26, 39) function-evaluation-cpp 21.9613 "Evaluations of functions at arbitrary points."
+(2013, 3, 14, 2, 26, 39) function-evaluation-cpp 21.8542 "Evaluations of functions at arbitrary points."
+(2013, 3, 14, 2, 26, 45) function-extrapolation-python 5.24009 "*** -------------------------------------------------------------------------"
+(2013, 3, 14, 2, 26, 45) function-extrapolation-python 2.10843 "*** -------------------------------------------------------------------------"
+(2013, 3, 14, 2, 27, 8) la-vector-access-cpp 22.9719 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 14, 2, 27, 34) la-vector-assignment-cpp 25.9694 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 15, 2, 13, 32) common-progress-cpp 28.8016 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 15, 2, 14, 5) common-timing-cpp 32.0957 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 15, 2, 15, 52) fem-multicore-cpp 107.226 "Coloring mesh."
+(2013, 3, 15, 2, 18, 20) fem-assembly-cpp 148.401 "Assembly for various forms and backends"
+(2013, 3, 15, 2, 18, 32) fem-convergence-cpp 12.2013 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 15, 2, 18, 34) fem-jit-python 0.0012234 "JIT compilation (in memory cache)"
+(2013, 3, 15, 2, 23, 45) fem-speedup-cpp 310.362 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 15, 2, 23, 45) fem-speedup-cpp-assembly 6.47895 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 15, 2, 23, 45) fem-speedup-cpp-solve 2.31461 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 15, 2, 24, 11) mesh-refinement-cpp 24.3441 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 15, 2, 24, 33) mesh-topology-cpp 22.3299 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 15, 2, 24, 56) mesh-unitcube-cpp 22.9755 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 15, 2, 25, 37) mesh-iteration-cpp 39.0737 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 15, 2, 25, 59) function-evaluation-cpp 21.8787 "Evaluations of functions at arbitrary points."
+(2013, 3, 15, 2, 25, 59) function-evaluation-cpp 21.7553 "Evaluations of functions at arbitrary points."
+(2013, 3, 15, 2, 26, 5) function-extrapolation-python 5.21209 "*** -------------------------------------------------------------------------"
+(2013, 3, 15, 2, 26, 5) function-extrapolation-python 2.15956 "*** -------------------------------------------------------------------------"
+(2013, 3, 15, 2, 26, 28) la-vector-access-cpp 22.9567 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 15, 2, 26, 55) la-vector-assignment-cpp 27.4805 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 16, 2, 14, 11) common-progress-cpp 28.8684 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 16, 2, 14, 43) common-timing-cpp 31.3065 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 16, 2, 16, 30) fem-multicore-cpp 107.333 "Coloring mesh."
+(2013, 3, 16, 2, 19, 0) fem-assembly-cpp 149.993 "Assembly for various forms and backends"
+(2013, 3, 16, 2, 19, 12) fem-convergence-cpp 12.2928 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 16, 2, 19, 14) fem-jit-python 0.00123 "JIT compilation (in memory cache)"
+(2013, 3, 16, 2, 24, 26) fem-speedup-cpp 312.124 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 16, 2, 24, 26) fem-speedup-cpp-assembly 6.46337 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 16, 2, 24, 26) fem-speedup-cpp-solve 2.30694 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 16, 2, 24, 53) mesh-refinement-cpp 24.9901 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 16, 2, 25, 16) mesh-topology-cpp 22.5543 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 16, 2, 25, 42) mesh-unitcube-cpp 26.5926 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 16, 2, 26, 25) mesh-iteration-cpp 40.4265 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 16, 2, 26, 47) function-evaluation-cpp 21.8843 "Evaluations of functions at arbitrary points."
+(2013, 3, 16, 2, 26, 47) function-evaluation-cpp 21.7497 "Evaluations of functions at arbitrary points."
+(2013, 3, 16, 2, 26, 52) function-extrapolation-python 5.09462 "*** -------------------------------------------------------------------------"
+(2013, 3, 16, 2, 26, 52) function-extrapolation-python 2.10553 "*** -------------------------------------------------------------------------"
+(2013, 3, 16, 2, 27, 15) la-vector-access-cpp 22.4321 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 16, 2, 27, 42) la-vector-assignment-cpp 27.4719 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 17, 2, 29, 42) common-progress-cpp 28.9765 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 17, 2, 30, 13) common-timing-cpp 31.3009 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 17, 2, 32, 0) fem-multicore-cpp 107.195 "Coloring mesh."
+(2013, 3, 17, 2, 34, 30) fem-assembly-cpp 149.737 "Assembly for various forms and backends"
+(2013, 3, 17, 2, 34, 42) fem-convergence-cpp 12.3258 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 17, 2, 34, 44) fem-jit-python 0.00122299 "JIT compilation (in memory cache)"
+(2013, 3, 17, 2, 39, 54) fem-speedup-cpp 310.183 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 17, 2, 39, 54) fem-speedup-cpp-assembly 6.51568 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 17, 2, 39, 54) fem-speedup-cpp-solve 2.35324 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 17, 2, 40, 21) mesh-refinement-cpp 25.0468 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 17, 2, 40, 43) mesh-topology-cpp 22.547 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 17, 2, 41, 10) mesh-unitcube-cpp 26.493 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 17, 2, 41, 50) mesh-iteration-cpp 37.4055 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 17, 2, 42, 12) function-evaluation-cpp 21.5286 "Evaluations of functions at arbitrary points."
+(2013, 3, 17, 2, 42, 12) function-evaluation-cpp 21.4091 "Evaluations of functions at arbitrary points."
+(2013, 3, 17, 2, 42, 17) function-extrapolation-python 5.24485 "*** -------------------------------------------------------------------------"
+(2013, 3, 17, 2, 42, 17) function-extrapolation-python 2.16948 "*** -------------------------------------------------------------------------"
+(2013, 3, 17, 2, 42, 45) la-vector-access-cpp 27.9113 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 17, 2, 43, 13) la-vector-assignment-cpp 27.9133 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 18, 2, 13, 58) common-progress-cpp 37.7687 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 18, 2, 14, 31) common-timing-cpp 32.4334 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 18, 2, 16, 18) fem-multicore-cpp 107.27 "Coloring mesh."
+(2013, 3, 18, 2, 18, 48) fem-assembly-cpp 149.848 "Assembly for various forms and backends"
+(2013, 3, 18, 2, 19, 0) fem-convergence-cpp 12.3602 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 18, 2, 19, 2) fem-jit-python 0.00122349 "JIT compilation (in memory cache)"
+(2013, 3, 18, 2, 24, 14) fem-speedup-cpp 311.341 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 18, 2, 24, 14) fem-speedup-cpp-assembly 6.5241 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 18, 2, 24, 14) fem-speedup-cpp-solve 2.31743 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 18, 2, 24, 40) mesh-refinement-cpp 25.0306 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 18, 2, 25, 3) mesh-topology-cpp 22.5197 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 18, 2, 25, 29) mesh-unitcube-cpp 26.524 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 18, 2, 26, 9) mesh-iteration-cpp 37.4762 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 18, 2, 26, 31) function-evaluation-cpp 21.9725 "Evaluations of functions at arbitrary points."
+(2013, 3, 18, 2, 26, 31) function-evaluation-cpp 21.8378 "Evaluations of functions at arbitrary points."
+(2013, 3, 18, 2, 26, 37) function-extrapolation-python 5.22097 "*** -------------------------------------------------------------------------"
+(2013, 3, 18, 2, 26, 37) function-extrapolation-python 2.15231 "*** -------------------------------------------------------------------------"
+(2013, 3, 18, 2, 26, 59) la-vector-access-cpp 22.6207 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 18, 2, 27, 25) la-vector-assignment-cpp 25.9718 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 19, 2, 13, 51) common-progress-cpp 28.8619 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 19, 2, 14, 22) common-timing-cpp 31.2971 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 19, 2, 16, 10) fem-multicore-cpp 107.35 "Coloring mesh."
+(2013, 3, 19, 2, 18, 39) fem-assembly-cpp 148.884 "Assembly for various forms and backends"
+(2013, 3, 19, 2, 18, 51) fem-convergence-cpp 12.375 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 19, 2, 18, 53) fem-jit-python 0.00122199 "JIT compilation (in memory cache)"
+(2013, 3, 19, 2, 24, 3) fem-speedup-cpp 309.909 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 19, 2, 24, 3) fem-speedup-cpp-assembly 6.50401 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 19, 2, 24, 3) fem-speedup-cpp-solve 2.34787 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 19, 2, 24, 29) mesh-refinement-cpp 24.9867 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 19, 2, 24, 52) mesh-topology-cpp 22.3912 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 19, 2, 25, 19) mesh-unitcube-cpp 27.1669 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 19, 2, 25, 59) mesh-iteration-cpp 37.195 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 19, 2, 26, 21) function-evaluation-cpp 21.845 "Evaluations of functions at arbitrary points."
+(2013, 3, 19, 2, 26, 21) function-evaluation-cpp 21.7126 "Evaluations of functions at arbitrary points."
+(2013, 3, 19, 2, 26, 26) function-extrapolation-python 5.39671 "*** -------------------------------------------------------------------------"
+(2013, 3, 19, 2, 26, 26) function-extrapolation-python 2.17694 "*** -------------------------------------------------------------------------"
+(2013, 3, 19, 2, 26, 49) la-vector-access-cpp 23.0423 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 19, 2, 27, 15) la-vector-assignment-cpp 25.9685 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 20, 2, 13, 30) common-progress-cpp 28.8516 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 20, 2, 14, 1) common-timing-cpp 31.3052 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 20, 2, 15, 49) fem-multicore-cpp 107.1 "Coloring mesh."
+(2013, 3, 20, 2, 18, 18) fem-assembly-cpp 149.056 "Assembly for various forms and backends"
+(2013, 3, 20, 2, 18, 30) fem-convergence-cpp 12.2928 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 20, 2, 18, 32) fem-jit-python 0.00124729 "JIT compilation (in memory cache)"
+(2013, 3, 20, 2, 23, 42) fem-speedup-cpp 309.893 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 20, 2, 23, 42) fem-speedup-cpp-assembly 6.50628 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 20, 2, 23, 42) fem-speedup-cpp-solve 2.34703 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 20, 2, 24, 8) mesh-refinement-cpp 24.9927 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 20, 2, 24, 31) mesh-topology-cpp 22.528 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 20, 2, 24, 58) mesh-unitcube-cpp 27.1177 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 20, 2, 25, 38) mesh-iteration-cpp 37.2224 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 20, 2, 26, 0) function-evaluation-cpp 21.8283 "Evaluations of functions at arbitrary points."
+(2013, 3, 20, 2, 26, 0) function-evaluation-cpp 21.7086 "Evaluations of functions at arbitrary points."
+(2013, 3, 20, 2, 26, 5) function-extrapolation-python 5.31842 "*** -------------------------------------------------------------------------"
+(2013, 3, 20, 2, 26, 5) function-extrapolation-python 2.18448 "*** -------------------------------------------------------------------------"
+(2013, 3, 20, 2, 26, 31) la-vector-access-cpp 25.4125 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 20, 2, 26, 58) la-vector-assignment-cpp 27.5367 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 21, 2, 13, 45) common-progress-cpp 37.6687 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 21, 2, 14, 16) common-timing-cpp 31.3976 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 21, 2, 16, 5) fem-multicore-cpp 108.533 "Coloring mesh."
+(2013, 3, 21, 2, 18, 34) fem-assembly-cpp 148.958 "Assembly for various forms and backends"
+(2013, 3, 21, 2, 18, 46) fem-convergence-cpp 12.3336 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 21, 2, 18, 48) fem-jit-python 0.0012275 "JIT compilation (in memory cache)"
+(2013, 3, 21, 2, 23, 58) fem-speedup-cpp 309.647 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 21, 2, 23, 58) fem-speedup-cpp-assembly 6.58366 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 21, 2, 23, 58) fem-speedup-cpp-solve 2.33447 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 21, 2, 24, 24) mesh-refinement-cpp 24.9678 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 21, 2, 24, 47) mesh-topology-cpp 22.419 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 21, 2, 25, 14) mesh-unitcube-cpp 27.2319 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 21, 2, 25, 54) mesh-iteration-cpp 37.2007 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 21, 2, 26, 16) function-evaluation-cpp 21.82 "Evaluations of functions at arbitrary points."
+(2013, 3, 21, 2, 26, 16) function-evaluation-cpp 21.6916 "Evaluations of functions at arbitrary points."
+(2013, 3, 21, 2, 26, 21) function-extrapolation-python 5.29022 "*** -------------------------------------------------------------------------"
+(2013, 3, 21, 2, 26, 21) function-extrapolation-python 2.18094 "*** -------------------------------------------------------------------------"
+(2013, 3, 21, 2, 26, 44) la-vector-access-cpp 22.9142 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 21, 2, 27, 12) la-vector-assignment-cpp 27.486 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 3, 24, 6, 22, 37) common-progress-cpp 27.6739 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 3, 24, 6, 23, 9) common-timing-cpp 32.9443 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 3, 24, 6, 24, 57) fem-multicore-cpp 107.69 "Coloring mesh."
+(2013, 3, 24, 6, 27, 27) fem-assembly-cpp 150.216 "Assembly for various forms and backends"
+(2013, 3, 24, 6, 27, 39) fem-convergence-cpp 11.6622 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 3, 24, 6, 27, 40) fem-jit-python 0.001227 "JIT compilation (in memory cache)"
+(2013, 3, 24, 6, 32, 51) fem-speedup-cpp 311.42 "Assembly/solve speedup running on 4 processors"
+(2013, 3, 24, 6, 32, 51) fem-speedup-cpp-assembly 6.65614 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 3, 24, 6, 32, 51) fem-speedup-cpp-solve 2.25599 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 3, 24, 6, 33, 17) mesh-refinement-cpp 24.3632 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 3, 24, 6, 33, 40) mesh-topology-cpp 22.3285 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 3, 24, 6, 34, 3) mesh-unitcube-cpp 23.0828 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 3, 24, 6, 34, 43) mesh-iteration-cpp 37.7172 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 3, 24, 6, 35, 5) function-evaluation-cpp 21.6222 "Evaluations of functions at arbitrary points."
+(2013, 3, 24, 6, 35, 5) function-evaluation-cpp 21.4611 "Evaluations of functions at arbitrary points."
+(2013, 3, 24, 6, 35, 10) function-extrapolation-python 5.17026 "*** -------------------------------------------------------------------------"
+(2013, 3, 24, 6, 35, 10) function-extrapolation-python 2.13267 "*** -------------------------------------------------------------------------"
+(2013, 3, 24, 6, 35, 35) la-vector-access-cpp 22.9433 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 3, 24, 6, 36, 1) la-vector-assignment-cpp 25.9617 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 3, 10, 37, 41) common-progress-cpp 28.6709 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 3, 10, 38, 12) common-timing-cpp 31.0144 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 3, 10, 39, 59) fem-multicore-cpp 107.346 "Coloring mesh."
+(2013, 4, 3, 10, 42, 31) fem-assembly-cpp 151.204 "Assembly for various forms and backends"
+(2013, 4, 3, 10, 42, 43) fem-convergence-cpp 12.2534 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 3, 10, 43, 0) fem-jit-python 0.001281 "JIT compilation (in memory cache)"
+(2013, 4, 3, 10, 48, 10) fem-speedup-cpp 309.873 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 3, 10, 48, 10) fem-speedup-cpp-assembly 6.69817 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 3, 10, 48, 10) fem-speedup-cpp-solve 2.33368 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 3, 10, 48, 36) mesh-refinement-cpp 24.3806 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 3, 10, 48, 58) mesh-topology-cpp 22.284 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 3, 10, 49, 22) mesh-unitcube-cpp 23.9109 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 3, 10, 50, 2) mesh-iteration-cpp 37.2358 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 3, 10, 50, 24) function-evaluation-cpp 21.6453 "Evaluations of functions at arbitrary points."
+(2013, 4, 3, 10, 50, 24) function-evaluation-cpp 21.5208 "Evaluations of functions at arbitrary points."
+(2013, 4, 3, 10, 51, 21) function-extrapolation-python 57.1881 "*** -------------------------------------------------------------------------"
+(2013, 4, 3, 10, 51, 21) function-extrapolation-python 2.1405 "*** -------------------------------------------------------------------------"
+(2013, 4, 3, 10, 51, 44) la-vector-access-cpp 22.7763 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 3, 10, 52, 10) la-vector-assignment-cpp 26.174 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 4, 1, 16, 22) common-progress-cpp 28.8295 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 4, 1, 16, 53) common-timing-cpp 31.1556 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 4, 1, 18, 41) fem-multicore-cpp 107.981 "Coloring mesh."
+(2013, 4, 4, 1, 21, 9) fem-assembly-cpp 148.047 "Assembly for various forms and backends"
+(2013, 4, 4, 1, 21, 21) fem-convergence-cpp 12.2995 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 4, 1, 21, 23) fem-jit-python 0.00122399 "JIT compilation (in memory cache)"
+(2013, 4, 4, 1, 26, 34) fem-speedup-cpp 310.941 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 4, 1, 26, 34) fem-speedup-cpp-assembly 6.66642 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 4, 1, 26, 34) fem-speedup-cpp-solve 2.34365 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 4, 1, 27, 0) mesh-refinement-cpp 24.3782 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 4, 1, 27, 22) mesh-topology-cpp 22.2689 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 4, 1, 27, 46) mesh-unitcube-cpp 23.9058 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 4, 1, 28, 29) mesh-iteration-cpp 40.411 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 4, 1, 28, 51) function-evaluation-cpp 21.7702 "Evaluations of functions at arbitrary points."
+(2013, 4, 4, 1, 28, 51) function-evaluation-cpp 21.6467 "Evaluations of functions at arbitrary points."
+(2013, 4, 4, 1, 28, 56) function-extrapolation-python 4.99667 "*** -------------------------------------------------------------------------"
+(2013, 4, 4, 1, 28, 56) function-extrapolation-python 2.11086 "*** -------------------------------------------------------------------------"
+(2013, 4, 4, 1, 29, 19) la-vector-access-cpp 22.656 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 4, 1, 29, 50) la-vector-assignment-cpp 31.4756 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 5, 1, 16, 37) common-progress-cpp 28.8126 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 5, 1, 17, 8) common-timing-cpp 31.1561 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 5, 1, 18, 56) fem-multicore-cpp 107.415 "Coloring mesh."
+(2013, 4, 5, 1, 21, 24) fem-assembly-cpp 148.539 "Assembly for various forms and backends"
+(2013, 4, 5, 1, 21, 36) fem-convergence-cpp 12.2717 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 5, 1, 21, 39) fem-jit-python 0.00122499 "JIT compilation (in memory cache)"
+(2013, 4, 5, 1, 26, 48) fem-speedup-cpp 309.227 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 5, 1, 26, 48) fem-speedup-cpp-assembly 6.61499 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 5, 1, 26, 48) fem-speedup-cpp-solve 2.3687 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 5, 1, 27, 14) mesh-refinement-cpp 24.3807 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 5, 1, 27, 36) mesh-topology-cpp 22.3226 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 5, 1, 28, 0) mesh-unitcube-cpp 23.931 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 5, 1, 28, 42) mesh-iteration-cpp 39.0971 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 5, 1, 29, 3) function-evaluation-cpp 21.8304 "Evaluations of functions at arbitrary points."
+(2013, 4, 5, 1, 29, 3) function-evaluation-cpp 21.6999 "Evaluations of functions at arbitrary points."
+(2013, 4, 5, 1, 29, 8) function-extrapolation-python 5.08045 "*** -------------------------------------------------------------------------"
+(2013, 4, 5, 1, 29, 8) function-extrapolation-python 2.13236 "*** -------------------------------------------------------------------------"
+(2013, 4, 5, 1, 29, 31) la-vector-access-cpp 22.4153 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 5, 1, 29, 58) la-vector-assignment-cpp 26.9331 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 6, 1, 17, 12) common-progress-cpp 30.0282 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 6, 1, 17, 42) common-timing-cpp 30.0913 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 6, 1, 19, 29) fem-multicore-cpp 107.415 "Coloring mesh."
+(2013, 4, 6, 1, 21, 59) fem-assembly-cpp 149.664 "Assembly for various forms and backends"
+(2013, 4, 6, 1, 22, 11) fem-convergence-cpp 12.3273 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 6, 1, 22, 14) fem-jit-python 0.00123191 "JIT compilation (in memory cache)"
+(2013, 4, 6, 1, 27, 24) fem-speedup-cpp 310.03 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 6, 1, 27, 24) fem-speedup-cpp-assembly 6.51814 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 6, 1, 27, 24) fem-speedup-cpp-solve 2.31374 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 6, 1, 27, 49) mesh-refinement-cpp 24.0426 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 6, 1, 28, 11) mesh-topology-cpp 22.0998 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 6, 1, 28, 35) mesh-unitcube-cpp 23.5254 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 6, 1, 29, 15) mesh-iteration-cpp 37.2303 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 6, 1, 29, 36) function-evaluation-cpp 21.7618 "Evaluations of functions at arbitrary points."
+(2013, 4, 6, 1, 29, 36) function-evaluation-cpp 21.6373 "Evaluations of functions at arbitrary points."
+(2013, 4, 6, 1, 29, 41) function-extrapolation-python 5.1518 "*** -------------------------------------------------------------------------"
+(2013, 4, 6, 1, 29, 41) function-extrapolation-python 2.11751 "*** -------------------------------------------------------------------------"
+(2013, 4, 6, 1, 30, 9) la-vector-access-cpp 27.9036 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 6, 1, 30, 37) la-vector-assignment-cpp 27.5259 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 7, 1, 16, 29) common-progress-cpp 29.9531 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 7, 1, 16, 59) common-timing-cpp 30.0019 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 7, 1, 18, 47) fem-multicore-cpp 107.778 "Coloring mesh."
+(2013, 4, 7, 1, 21, 17) fem-assembly-cpp 149.832 "Assembly for various forms and backends"
+(2013, 4, 7, 1, 21, 29) fem-convergence-cpp 12.2765 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 7, 1, 21, 31) fem-jit-python 0.00122931 "JIT compilation (in memory cache)"
+(2013, 4, 7, 1, 26, 40) fem-speedup-cpp 308.661 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 7, 1, 26, 40) fem-speedup-cpp-assembly 6.43973 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 7, 1, 26, 40) fem-speedup-cpp-solve 2.3552 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 7, 1, 27, 5) mesh-refinement-cpp 24.0794 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 7, 1, 27, 27) mesh-topology-cpp 22.0646 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 7, 1, 27, 51) mesh-unitcube-cpp 23.4444 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 7, 1, 28, 31) mesh-iteration-cpp 37.3231 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 7, 1, 28, 52) function-evaluation-cpp 21.9451 "Evaluations of functions at arbitrary points."
+(2013, 4, 7, 1, 28, 52) function-evaluation-cpp 21.8204 "Evaluations of functions at arbitrary points."
+(2013, 4, 7, 1, 28, 58) function-extrapolation-python 5.31725 "*** -------------------------------------------------------------------------"
+(2013, 4, 7, 1, 28, 58) function-extrapolation-python 2.11719 "*** -------------------------------------------------------------------------"
+(2013, 4, 7, 1, 29, 26) la-vector-access-cpp 28.3989 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 7, 1, 29, 54) la-vector-assignment-cpp 27.5348 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 8, 1, 16, 28) common-progress-cpp 37.7627 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 8, 1, 16, 58) common-timing-cpp 29.9162 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 8, 1, 18, 46) fem-multicore-cpp 107.609 "Coloring mesh."
+(2013, 4, 8, 1, 21, 14) fem-assembly-cpp 148.673 "Assembly for various forms and backends"
+(2013, 4, 8, 1, 21, 26) fem-convergence-cpp 12.2434 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 8, 1, 21, 29) fem-jit-python 0.00123191 "JIT compilation (in memory cache)"
+(2013, 4, 8, 1, 26, 37) fem-speedup-cpp 308.861 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 8, 1, 26, 37) fem-speedup-cpp-assembly 6.45204 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 8, 1, 26, 37) fem-speedup-cpp-solve 2.35208 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 8, 1, 27, 3) mesh-refinement-cpp 24.0579 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 8, 1, 27, 25) mesh-topology-cpp 22.104 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 8, 1, 27, 49) mesh-unitcube-cpp 23.4969 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 8, 1, 28, 30) mesh-iteration-cpp 38.4778 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 8, 1, 28, 51) function-evaluation-cpp 21.9117 "Evaluations of functions at arbitrary points."
+(2013, 4, 8, 1, 28, 51) function-evaluation-cpp 21.7856 "Evaluations of functions at arbitrary points."
+(2013, 4, 8, 1, 28, 57) function-extrapolation-python 5.14718 "*** -------------------------------------------------------------------------"
+(2013, 4, 8, 1, 28, 57) function-extrapolation-python 2.12018 "*** -------------------------------------------------------------------------"
+(2013, 4, 8, 1, 29, 25) la-vector-access-cpp 28.3954 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 8, 1, 29, 53) la-vector-assignment-cpp 27.6135 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 9, 1, 16, 31) common-progress-cpp 30.0448 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 9, 1, 17, 1) common-timing-cpp 29.8397 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 9, 1, 18, 48) fem-multicore-cpp 107.257 "Coloring mesh."
+(2013, 4, 9, 1, 21, 18) fem-assembly-cpp 149.894 "Assembly for various forms and backends"
+(2013, 4, 9, 1, 21, 30) fem-convergence-cpp 12.2793 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 9, 1, 21, 32) fem-jit-python 0.0012243 "JIT compilation (in memory cache)"
+(2013, 4, 9, 1, 26, 41) fem-speedup-cpp 309.246 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 9, 1, 26, 41) fem-speedup-cpp-assembly 6.44508 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 9, 1, 26, 41) fem-speedup-cpp-solve 2.35306 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 9, 1, 27, 7) mesh-refinement-cpp 24.0455 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 9, 1, 27, 29) mesh-topology-cpp 22.0375 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 9, 1, 27, 52) mesh-unitcube-cpp 23.4152 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 9, 1, 28, 33) mesh-iteration-cpp 37.7987 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 9, 1, 28, 55) function-evaluation-cpp 22.0637 "Evaluations of functions at arbitrary points."
+(2013, 4, 9, 1, 28, 55) function-evaluation-cpp 21.9178 "Evaluations of functions at arbitrary points."
+(2013, 4, 9, 1, 29, 0) function-extrapolation-python 5.28518 "*** -------------------------------------------------------------------------"
+(2013, 4, 9, 1, 29, 0) function-extrapolation-python 2.12131 "*** -------------------------------------------------------------------------"
+(2013, 4, 9, 1, 29, 26) la-vector-access-cpp 25.4006 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 9, 1, 29, 53) la-vector-assignment-cpp 27.5325 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 10, 1, 16, 22) common-progress-cpp 30.4026 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 10, 1, 16, 52) common-timing-cpp 29.8269 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 10, 1, 18, 39) fem-multicore-cpp 107.227 "Coloring mesh."
+(2013, 4, 10, 1, 21, 8) fem-assembly-cpp 149.014 "Assembly for various forms and backends"
+(2013, 4, 10, 1, 21, 20) fem-convergence-cpp 12.2822 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 10, 1, 21, 22) fem-jit-python 0.00123022 "JIT compilation (in memory cache)"
+(2013, 4, 10, 1, 26, 33) fem-speedup-cpp 310.705 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 10, 1, 26, 33) fem-speedup-cpp-assembly 6.52232 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 10, 1, 26, 33) fem-speedup-cpp-solve 2.31407 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 10, 1, 26, 58) mesh-refinement-cpp 24.0041 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 10, 1, 27, 21) mesh-topology-cpp 22.1267 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 10, 1, 27, 44) mesh-unitcube-cpp 23.4961 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 10, 1, 28, 24) mesh-iteration-cpp 37.2778 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 10, 1, 28, 46) function-evaluation-cpp 21.8222 "Evaluations of functions at arbitrary points."
+(2013, 4, 10, 1, 28, 46) function-evaluation-cpp 21.6903 "Evaluations of functions at arbitrary points."
+(2013, 4, 10, 1, 28, 51) function-extrapolation-python 5.24485 "*** -------------------------------------------------------------------------"
+(2013, 4, 10, 1, 28, 51) function-extrapolation-python 2.14506 "*** -------------------------------------------------------------------------"
+(2013, 4, 10, 1, 29, 19) la-vector-access-cpp 27.9033 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 10, 1, 29, 47) la-vector-assignment-cpp 27.5347 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 11, 1, 16, 36) common-progress-cpp 30.0364 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 11, 1, 17, 6) common-timing-cpp 30.624 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 11, 1, 18, 54) fem-multicore-cpp 107.282 "Coloring mesh."
+(2013, 4, 11, 1, 21, 23) fem-assembly-cpp 149.614 "Assembly for various forms and backends"
+(2013, 4, 11, 1, 21, 36) fem-convergence-cpp 12.2424 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 11, 1, 21, 38) fem-jit-python 0.0012377 "JIT compilation (in memory cache)"
+(2013, 4, 11, 1, 26, 46) fem-speedup-cpp 308.627 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 11, 1, 26, 46) fem-speedup-cpp-assembly 6.57084 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 11, 1, 26, 46) fem-speedup-cpp-solve 2.37068 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 11, 1, 27, 12) mesh-refinement-cpp 24.0488 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 11, 1, 27, 34) mesh-topology-cpp 22.1544 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 11, 1, 27, 58) mesh-unitcube-cpp 23.5401 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 11, 1, 28, 38) mesh-iteration-cpp 37.6379 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 11, 1, 29, 0) function-evaluation-cpp 21.8286 "Evaluations of functions at arbitrary points."
+(2013, 4, 11, 1, 29, 0) function-evaluation-cpp 21.7027 "Evaluations of functions at arbitrary points."
+(2013, 4, 11, 1, 29, 5) function-extrapolation-python 5.35448 "*** -------------------------------------------------------------------------"
+(2013, 4, 11, 1, 29, 5) function-extrapolation-python 2.12137 "*** -------------------------------------------------------------------------"
+(2013, 4, 11, 1, 29, 30) la-vector-access-cpp 25.4105 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 11, 1, 29, 58) la-vector-assignment-cpp 27.4704 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 12, 1, 16, 26) common-progress-cpp 30.0612 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 12, 1, 16, 57) common-timing-cpp 30.9756 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 12, 1, 18, 44) fem-multicore-cpp 107.025 "Coloring mesh."
+(2013, 4, 12, 1, 21, 13) fem-assembly-cpp 149.179 "Assembly for various forms and backends"
+(2013, 4, 12, 1, 21, 26) fem-convergence-cpp 12.2428 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 12, 1, 21, 28) fem-jit-python 0.00122929 "JIT compilation (in memory cache)"
+(2013, 4, 12, 1, 26, 38) fem-speedup-cpp 310.413 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 12, 1, 26, 38) fem-speedup-cpp-assembly 6.49091 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 12, 1, 26, 38) fem-speedup-cpp-solve 2.32624 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 12, 1, 27, 4) mesh-refinement-cpp 24.0474 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 12, 1, 27, 26) mesh-topology-cpp 22.0204 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 12, 1, 27, 49) mesh-unitcube-cpp 23.5027 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 12, 1, 28, 29) mesh-iteration-cpp 37.2771 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 12, 1, 28, 51) function-evaluation-cpp 21.8202 "Evaluations of functions at arbitrary points."
+(2013, 4, 12, 1, 28, 51) function-evaluation-cpp 21.6921 "Evaluations of functions at arbitrary points."
+(2013, 4, 12, 1, 28, 56) function-extrapolation-python 5.23324 "*** -------------------------------------------------------------------------"
+(2013, 4, 12, 1, 28, 56) function-extrapolation-python 2.1324 "*** -------------------------------------------------------------------------"
+(2013, 4, 12, 1, 29, 25) la-vector-access-cpp 28.4149 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 12, 1, 29, 56) la-vector-assignment-cpp 31.4842 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 13, 1, 16, 25) common-progress-cpp 30.078 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 13, 1, 16, 56) common-timing-cpp 30.8103 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 13, 1, 18, 43) fem-multicore-cpp 107.104 "Coloring mesh."
+(2013, 4, 13, 1, 21, 12) fem-assembly-cpp 149.179 "Assembly for various forms and backends"
+(2013, 4, 13, 1, 21, 24) fem-convergence-cpp 12.3201 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 13, 1, 21, 26) fem-jit-python 0.00122671 "JIT compilation (in memory cache)"
+(2013, 4, 13, 1, 26, 37) fem-speedup-cpp 310.668 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 13, 1, 26, 37) fem-speedup-cpp-assembly 6.48678 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 13, 1, 26, 37) fem-speedup-cpp-solve 2.3043 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 13, 1, 27, 2) mesh-refinement-cpp 24.0435 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 13, 1, 27, 25) mesh-topology-cpp 22.0711 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 13, 1, 27, 48) mesh-unitcube-cpp 23.5141 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 13, 1, 28, 28) mesh-iteration-cpp 37.2366 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 13, 1, 28, 50) function-evaluation-cpp 21.9283 "Evaluations of functions at arbitrary points."
+(2013, 4, 13, 1, 28, 50) function-evaluation-cpp 21.8007 "Evaluations of functions at arbitrary points."
+(2013, 4, 13, 1, 28, 55) function-extrapolation-python 5.2738 "*** -------------------------------------------------------------------------"
+(2013, 4, 13, 1, 28, 55) function-extrapolation-python 2.12933 "*** -------------------------------------------------------------------------"
+(2013, 4, 13, 1, 29, 21) la-vector-access-cpp 25.4122 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 13, 1, 29, 50) la-vector-assignment-cpp 29.5329 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 14, 1, 16, 22) common-progress-cpp 30.0946 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 14, 1, 16, 52) common-timing-cpp 30.4087 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 14, 1, 18, 40) fem-multicore-cpp 107.529 "Coloring mesh."
+(2013, 4, 14, 1, 21, 9) fem-assembly-cpp 149.576 "Assembly for various forms and backends"
+(2013, 4, 14, 1, 21, 21) fem-convergence-cpp 12.2776 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 14, 1, 21, 24) fem-jit-python 0.0012233 "JIT compilation (in memory cache)"
+(2013, 4, 14, 1, 26, 33) fem-speedup-cpp 309.251 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 14, 1, 26, 33) fem-speedup-cpp-assembly 6.57893 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 14, 1, 26, 33) fem-speedup-cpp-solve 2.34953 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 14, 1, 26, 58) mesh-refinement-cpp 24.0256 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 14, 1, 27, 20) mesh-topology-cpp 22.0164 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 14, 1, 27, 44) mesh-unitcube-cpp 23.4539 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 14, 1, 28, 24) mesh-iteration-cpp 37.2981 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 14, 1, 28, 45) function-evaluation-cpp 21.4629 "Evaluations of functions at arbitrary points."
+(2013, 4, 14, 1, 28, 45) function-evaluation-cpp 21.3353 "Evaluations of functions at arbitrary points."
+(2013, 4, 14, 1, 28, 50) function-extrapolation-python 5.19524 "*** -------------------------------------------------------------------------"
+(2013, 4, 14, 1, 28, 50) function-extrapolation-python 2.11549 "*** -------------------------------------------------------------------------"
+(2013, 4, 14, 1, 29, 21) la-vector-access-cpp 30.8065 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 14, 1, 29, 49) la-vector-assignment-cpp 27.538 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 15, 1, 16, 34) common-progress-cpp 30.0689 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 15, 1, 17, 5) common-timing-cpp 30.4732 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 15, 1, 18, 52) fem-multicore-cpp 106.941 "Coloring mesh."
+(2013, 4, 15, 1, 21, 21) fem-assembly-cpp 149.51 "Assembly for various forms and backends"
+(2013, 4, 15, 1, 21, 33) fem-convergence-cpp 12.2485 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 15, 1, 21, 36) fem-jit-python 0.0012269 "JIT compilation (in memory cache)"
+(2013, 4, 15, 1, 26, 45) fem-speedup-cpp 309.596 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 15, 1, 26, 45) fem-speedup-cpp-assembly 6.53485 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 15, 1, 26, 45) fem-speedup-cpp-solve 2.33955 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 15, 1, 27, 11) mesh-refinement-cpp 24.0765 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 15, 1, 27, 33) mesh-topology-cpp 22.0727 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 15, 1, 27, 56) mesh-unitcube-cpp 23.4702 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 15, 1, 28, 37) mesh-iteration-cpp 38.5673 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 15, 1, 28, 59) function-evaluation-cpp 21.7059 "Evaluations of functions at arbitrary points."
+(2013, 4, 15, 1, 28, 59) function-evaluation-cpp 21.5747 "Evaluations of functions at arbitrary points."
+(2013, 4, 15, 1, 29, 4) function-extrapolation-python 5.17164 "*** -------------------------------------------------------------------------"
+(2013, 4, 15, 1, 29, 4) function-extrapolation-python 2.12217 "*** -------------------------------------------------------------------------"
+(2013, 4, 15, 1, 29, 30) la-vector-access-cpp 25.4026 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 15, 1, 29, 57) la-vector-assignment-cpp 27.5354 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 16, 1, 16, 41) common-progress-cpp 37.6048 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 16, 1, 17, 12) common-timing-cpp 30.3956 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 16, 1, 18, 59) fem-multicore-cpp 107.191 "Coloring mesh."
+(2013, 4, 16, 1, 21, 28) fem-assembly-cpp 149.562 "Assembly for various forms and backends"
+(2013, 4, 16, 1, 21, 41) fem-convergence-cpp 12.2565 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 16, 1, 21, 43) fem-jit-python 0.0012275 "JIT compilation (in memory cache)"
+(2013, 4, 16, 1, 26, 53) fem-speedup-cpp 310.21 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 16, 1, 26, 53) fem-speedup-cpp-assembly 6.50801 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 16, 1, 26, 53) fem-speedup-cpp-solve 2.32547 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 16, 1, 27, 18) mesh-refinement-cpp 24.0031 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 16, 1, 27, 41) mesh-topology-cpp 22.0714 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 16, 1, 28, 4) mesh-unitcube-cpp 23.5169 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 16, 1, 28, 44) mesh-iteration-cpp 37.3408 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 16, 1, 29, 6) function-evaluation-cpp 21.9287 "Evaluations of functions at arbitrary points."
+(2013, 4, 16, 1, 29, 6) function-evaluation-cpp 21.8047 "Evaluations of functions at arbitrary points."
+(2013, 4, 16, 1, 29, 11) function-extrapolation-python 5.18916 "*** -------------------------------------------------------------------------"
+(2013, 4, 16, 1, 29, 11) function-extrapolation-python 2.11961 "*** -------------------------------------------------------------------------"
+(2013, 4, 16, 1, 29, 37) la-vector-access-cpp 25.4169 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 16, 1, 30, 4) la-vector-assignment-cpp 27.5381 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 17, 1, 16, 41) common-progress-cpp 30.0281 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 17, 1, 17, 11) common-timing-cpp 30.3992 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 17, 1, 18, 58) fem-multicore-cpp 107.095 "Coloring mesh."
+(2013, 4, 17, 1, 21, 28) fem-assembly-cpp 149.916 "Assembly for various forms and backends"
+(2013, 4, 17, 1, 21, 40) fem-convergence-cpp 12.291 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 17, 1, 21, 42) fem-jit-python 0.00123098 "JIT compilation (in memory cache)"
+(2013, 4, 17, 1, 26, 52) fem-speedup-cpp 309.229 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 17, 1, 26, 52) fem-speedup-cpp-assembly 6.50473 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 17, 1, 26, 52) fem-speedup-cpp-solve 2.35744 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 17, 1, 27, 17) mesh-refinement-cpp 24.0897 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 17, 1, 27, 39) mesh-topology-cpp 22.1139 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 17, 1, 28, 3) mesh-unitcube-cpp 23.4394 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 17, 1, 28, 43) mesh-iteration-cpp 37.3842 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 17, 1, 29, 5) function-evaluation-cpp 21.7642 "Evaluations of functions at arbitrary points."
+(2013, 4, 17, 1, 29, 5) function-evaluation-cpp 21.6307 "Evaluations of functions at arbitrary points."
+(2013, 4, 17, 1, 29, 10) function-extrapolation-python 5.09776 "*** -------------------------------------------------------------------------"
+(2013, 4, 17, 1, 29, 10) function-extrapolation-python 2.12191 "*** -------------------------------------------------------------------------"
+(2013, 4, 17, 1, 29, 41) la-vector-access-cpp 30.8804 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 17, 1, 30, 8) la-vector-assignment-cpp 27.5269 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 18, 1, 16, 43) common-progress-cpp 30.0864 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 18, 1, 17, 13) common-timing-cpp 30.6651 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 18, 1, 19, 1) fem-multicore-cpp 107.203 "Coloring mesh."
+(2013, 4, 18, 1, 21, 30) fem-assembly-cpp 148.897 "Assembly for various forms and backends"
+(2013, 4, 18, 1, 21, 42) fem-convergence-cpp 12.2786 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 18, 1, 21, 44) fem-jit-python 0.00123661 "JIT compilation (in memory cache)"
+(2013, 4, 18, 1, 26, 54) fem-speedup-cpp 310.546 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 18, 1, 26, 54) fem-speedup-cpp-assembly 6.5257 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 18, 1, 26, 54) fem-speedup-cpp-solve 2.30883 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 18, 1, 27, 20) mesh-refinement-cpp 24.0494 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 18, 1, 27, 42) mesh-topology-cpp 22.0448 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 18, 1, 28, 6) mesh-unitcube-cpp 23.5334 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 18, 1, 28, 46) mesh-iteration-cpp 37.844 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 18, 1, 29, 8) function-evaluation-cpp 21.7619 "Evaluations of functions at arbitrary points."
+(2013, 4, 18, 1, 29, 8) function-evaluation-cpp 21.6312 "Evaluations of functions at arbitrary points."
+(2013, 4, 18, 1, 29, 13) function-extrapolation-python 5.16996 "*** -------------------------------------------------------------------------"
+(2013, 4, 18, 1, 29, 13) function-extrapolation-python 2.11797 "*** -------------------------------------------------------------------------"
+(2013, 4, 18, 1, 29, 39) la-vector-access-cpp 25.4085 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 18, 1, 30, 6) la-vector-assignment-cpp 27.4324 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 19, 1, 16, 25) common-progress-cpp 30.0612 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 19, 1, 16, 55) common-timing-cpp 30.163 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 19, 1, 18, 42) fem-multicore-cpp 107.24 "Coloring mesh."
+(2013, 4, 19, 1, 21, 12) fem-assembly-cpp 149.212 "Assembly for various forms and backends"
+(2013, 4, 19, 1, 21, 24) fem-convergence-cpp 12.2827 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 19, 1, 21, 26) fem-jit-python 0.00122929 "JIT compilation (in memory cache)"
+(2013, 4, 19, 1, 26, 35) fem-speedup-cpp 309.438 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 19, 1, 26, 35) fem-speedup-cpp-assembly 6.47643 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 19, 1, 26, 35) fem-speedup-cpp-solve 2.33866 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 19, 1, 27, 1) mesh-refinement-cpp 24.0889 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 19, 1, 27, 23) mesh-topology-cpp 22.0827 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 19, 1, 27, 47) mesh-unitcube-cpp 23.48 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 19, 1, 28, 26) mesh-iteration-cpp 37.2363 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 19, 1, 28, 48) function-evaluation-cpp 21.7474 "Evaluations of functions at arbitrary points."
+(2013, 4, 19, 1, 28, 48) function-evaluation-cpp 21.6206 "Evaluations of functions at arbitrary points."
+(2013, 4, 19, 1, 28, 53) function-extrapolation-python 5.12529 "*** -------------------------------------------------------------------------"
+(2013, 4, 19, 1, 28, 53) function-extrapolation-python 2.12127 "*** -------------------------------------------------------------------------"
+(2013, 4, 19, 1, 29, 19) la-vector-access-cpp 25.4028 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 19, 1, 29, 46) la-vector-assignment-cpp 27.5266 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 20, 1, 16, 27) common-progress-cpp 30.0697 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 20, 1, 16, 56) common-timing-cpp 29.4944 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 20, 1, 18, 44) fem-multicore-cpp 107.152 "Coloring mesh."
+(2013, 4, 20, 1, 21, 13) fem-assembly-cpp 149.299 "Assembly for various forms and backends"
+(2013, 4, 20, 1, 21, 25) fem-convergence-cpp 12.1712 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 20, 1, 21, 27) fem-jit-python 0.00123081 "JIT compilation (in memory cache)"
+(2013, 4, 20, 1, 26, 36) fem-speedup-cpp 308.726 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 20, 1, 26, 36) fem-speedup-cpp-assembly 6.57181 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 20, 1, 26, 36) fem-speedup-cpp-solve 2.36212 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 20, 1, 27, 1) mesh-refinement-cpp 24.0528 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 20, 1, 27, 24) mesh-topology-cpp 22.3305 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 20, 1, 27, 47) mesh-unitcube-cpp 23.5215 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 20, 1, 28, 27) mesh-iteration-cpp 37.2495 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 20, 1, 28, 49) function-evaluation-cpp 21.8205 "Evaluations of functions at arbitrary points."
+(2013, 4, 20, 1, 28, 49) function-evaluation-cpp 21.6922 "Evaluations of functions at arbitrary points."
+(2013, 4, 20, 1, 28, 54) function-extrapolation-python 5.1729 "*** -------------------------------------------------------------------------"
+(2013, 4, 20, 1, 28, 54) function-extrapolation-python 2.12485 "*** -------------------------------------------------------------------------"
+(2013, 4, 20, 1, 29, 23) la-vector-access-cpp 29.0416 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 20, 1, 30, 24) la-vector-assignment-cpp 61.0233 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 21, 1, 16, 29) common-progress-cpp 30.1195 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 21, 1, 16, 59) common-timing-cpp 30.4108 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 21, 1, 18, 46) fem-multicore-cpp 107.171 "Coloring mesh."
+(2013, 4, 21, 1, 21, 16) fem-assembly-cpp 149.312 "Assembly for various forms and backends"
+(2013, 4, 21, 1, 21, 28) fem-convergence-cpp 12.2573 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 21, 1, 21, 30) fem-jit-python 0.00121622 "JIT compilation (in memory cache)"
+(2013, 4, 21, 1, 26, 41) fem-speedup-cpp 310.378 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 21, 1, 26, 41) fem-speedup-cpp-assembly 6.44424 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 21, 1, 26, 41) fem-speedup-cpp-solve 2.31931 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 21, 1, 27, 6) mesh-refinement-cpp 24.014 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 21, 1, 27, 28) mesh-topology-cpp 22.0332 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 21, 1, 27, 52) mesh-unitcube-cpp 23.4614 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 21, 1, 28, 31) mesh-iteration-cpp 37.2483 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 21, 1, 28, 53) function-evaluation-cpp 21.8204 "Evaluations of functions at arbitrary points."
+(2013, 4, 21, 1, 28, 53) function-evaluation-cpp 21.6965 "Evaluations of functions at arbitrary points."
+(2013, 4, 21, 1, 28, 59) function-extrapolation-python 5.26024 "*** -------------------------------------------------------------------------"
+(2013, 4, 21, 1, 28, 59) function-extrapolation-python 2.1406 "*** -------------------------------------------------------------------------"
+(2013, 4, 21, 1, 29, 24) la-vector-access-cpp 25.3963 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 21, 1, 29, 51) la-vector-assignment-cpp 27.5293 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 22, 1, 16, 28) common-progress-cpp 30.0779 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 22, 1, 16, 58) common-timing-cpp 30.3436 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 22, 1, 18, 45) fem-multicore-cpp 107.127 "Coloring mesh."
+(2013, 4, 22, 1, 21, 15) fem-assembly-cpp 149.673 "Assembly for various forms and backends"
+(2013, 4, 22, 1, 21, 27) fem-convergence-cpp 12.2513 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 22, 1, 21, 29) fem-jit-python 0.00122828 "JIT compilation (in memory cache)"
+(2013, 4, 22, 1, 26, 41) fem-speedup-cpp 311.468 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 22, 1, 26, 41) fem-speedup-cpp-assembly 6.5123 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 22, 1, 26, 41) fem-speedup-cpp-solve 2.29889 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 22, 1, 27, 7) mesh-refinement-cpp 24.055 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 22, 1, 27, 29) mesh-topology-cpp 22.1764 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 22, 1, 27, 52) mesh-unitcube-cpp 23.4557 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 22, 1, 28, 32) mesh-iteration-cpp 37.2372 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 22, 1, 28, 54) function-evaluation-cpp 21.8006 "Evaluations of functions at arbitrary points."
+(2013, 4, 22, 1, 28, 54) function-evaluation-cpp 21.7006 "Evaluations of functions at arbitrary points."
+(2013, 4, 22, 1, 28, 59) function-extrapolation-python 5.0892 "*** -------------------------------------------------------------------------"
+(2013, 4, 22, 1, 28, 59) function-extrapolation-python 2.09897 "*** -------------------------------------------------------------------------"
+(2013, 4, 22, 1, 29, 27) la-vector-access-cpp 28.411 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 22, 1, 29, 59) la-vector-assignment-cpp 31.4175 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 23, 1, 16, 32) common-progress-cpp 37.5714 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 23, 1, 17, 2) common-timing-cpp 29.992 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 23, 1, 18, 49) fem-multicore-cpp 107.08 "Coloring mesh."
+(2013, 4, 23, 1, 21, 18) fem-assembly-cpp 148.779 "Assembly for various forms and backends"
+(2013, 4, 23, 1, 21, 30) fem-convergence-cpp 12.2415 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 23, 1, 21, 32) fem-jit-python 0.00122111 "JIT compilation (in memory cache)"
+(2013, 4, 23, 1, 26, 42) fem-speedup-cpp 309.393 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 23, 1, 26, 42) fem-speedup-cpp-assembly 6.58957 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 23, 1, 26, 42) fem-speedup-cpp-solve 2.34169 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 23, 1, 27, 7) mesh-refinement-cpp 24.0729 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 23, 1, 27, 30) mesh-topology-cpp 22.0567 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 23, 1, 27, 53) mesh-unitcube-cpp 23.5832 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 23, 1, 28, 35) mesh-iteration-cpp 39.1265 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 23, 1, 28, 57) function-evaluation-cpp 21.7725 "Evaluations of functions at arbitrary points."
+(2013, 4, 23, 1, 28, 57) function-evaluation-cpp 21.6337 "Evaluations of functions at arbitrary points."
+(2013, 4, 23, 1, 29, 2) function-extrapolation-python 5.11435 "*** -------------------------------------------------------------------------"
+(2013, 4, 23, 1, 29, 2) function-extrapolation-python 2.13043 "*** -------------------------------------------------------------------------"
+(2013, 4, 23, 1, 29, 27) la-vector-access-cpp 25.4071 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 23, 1, 29, 55) la-vector-assignment-cpp 27.5341 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 26, 12, 47, 40) common-progress-cpp 27.6499 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 26, 12, 48, 10) common-timing-cpp 30.1125 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 26, 12, 49, 57) fem-multicore-cpp 106.995 "Coloring mesh."
+(2013, 4, 26, 12, 52, 29) fem-assembly-cpp 152.106 "Assembly for various forms and backends"
+(2013, 4, 26, 12, 52, 41) fem-convergence-cpp 12.1343 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 26, 12, 52, 42) fem-jit-python 0.00104089 "JIT compilation (in memory cache)"
+(2013, 4, 26, 12, 57, 52) fem-speedup-cpp 309.935 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 26, 12, 57, 52) fem-speedup-cpp-assembly 6.77273 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 26, 12, 57, 52) fem-speedup-cpp-solve 2.22318 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 26, 12, 58, 14) mesh-refinement-cpp 19.9167 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 26, 12, 58, 33) mesh-topology-cpp 19.4751 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 26, 12, 58, 58) mesh-unitcube-cpp 24.414 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 26, 12, 59, 39) mesh-iteration-cpp 39.2249 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 26, 13, 0, 1) function-evaluation-cpp 21.2531 "Evaluations of functions at arbitrary points."
+(2013, 4, 26, 13, 0, 1) function-evaluation-cpp 21.1609 "Evaluations of functions at arbitrary points."
+(2013, 4, 26, 13, 0, 5) function-extrapolation-python 4.73804 "*** -------------------------------------------------------------------------"
+(2013, 4, 26, 13, 0, 5) function-extrapolation-python 2.0828 "*** -------------------------------------------------------------------------"
+(2013, 4, 26, 13, 0, 28) la-vector-access-cpp 22.9922 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 26, 13, 0, 56) la-vector-assignment-cpp 27.1467 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 27, 1, 22, 13) common-progress-cpp 28.7031 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 27, 1, 22, 43) common-timing-cpp 29.6109 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 27, 1, 24, 29) fem-multicore-cpp 106.523 "Coloring mesh."
+(2013, 4, 27, 1, 27, 1) fem-assembly-cpp 152.207 "Assembly for various forms and backends"
+(2013, 4, 27, 1, 27, 13) fem-convergence-cpp 12.088 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 27, 1, 27, 15) fem-jit-python 0.0010329 "JIT compilation (in memory cache)"
+(2013, 4, 27, 1, 32, 18) fem-speedup-cpp 302.445 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 27, 1, 32, 18) fem-speedup-cpp-assembly 6.5291 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 27, 1, 32, 18) fem-speedup-cpp-solve 2.37791 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 27, 1, 32, 38) mesh-refinement-cpp 19.8266 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 27, 1, 32, 58) mesh-topology-cpp 19.5002 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 27, 1, 33, 22) mesh-unitcube-cpp 24.3913 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 27, 1, 34, 4) mesh-iteration-cpp 39.1551 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 27, 1, 34, 25) function-evaluation-cpp 21.1631 "Evaluations of functions at arbitrary points."
+(2013, 4, 27, 1, 34, 25) function-evaluation-cpp 21.0797 "Evaluations of functions at arbitrary points."
+(2013, 4, 27, 1, 34, 30) function-extrapolation-python 4.5029 "*** -------------------------------------------------------------------------"
+(2013, 4, 27, 1, 34, 30) function-extrapolation-python 2.10061 "*** -------------------------------------------------------------------------"
+(2013, 4, 27, 1, 34, 53) la-vector-access-cpp 23.6455 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 27, 1, 35, 18) la-vector-assignment-cpp 25.0595 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 28, 1, 19, 43) common-progress-cpp 28.728 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 28, 1, 20, 13) common-timing-cpp 30.2908 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 28, 1, 22, 0) fem-multicore-cpp 106.645 "Coloring mesh."
+(2013, 4, 28, 1, 24, 32) fem-assembly-cpp 151.774 "Assembly for various forms and backends"
+(2013, 4, 28, 1, 24, 44) fem-convergence-cpp 12.1097 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 28, 1, 24, 46) fem-jit-python 0.00103259 "JIT compilation (in memory cache)"
+(2013, 4, 28, 1, 29, 50) fem-speedup-cpp 304.72 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 28, 1, 29, 50) fem-speedup-cpp-assembly 6.41555 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 28, 1, 29, 50) fem-speedup-cpp-solve 2.34267 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 28, 1, 30, 12) mesh-refinement-cpp 19.8524 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 28, 1, 30, 31) mesh-topology-cpp 19.5594 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 28, 1, 30, 56) mesh-unitcube-cpp 24.3569 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 28, 1, 31, 37) mesh-iteration-cpp 39.1565 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 28, 1, 31, 59) function-evaluation-cpp 21.1951 "Evaluations of functions at arbitrary points."
+(2013, 4, 28, 1, 31, 59) function-evaluation-cpp 21.0698 "Evaluations of functions at arbitrary points."
+(2013, 4, 28, 1, 32, 3) function-extrapolation-python 4.68604 "*** -------------------------------------------------------------------------"
+(2013, 4, 28, 1, 32, 3) function-extrapolation-python 2.1135 "*** -------------------------------------------------------------------------"
+(2013, 4, 28, 1, 32, 27) la-vector-access-cpp 23.447 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 28, 1, 32, 52) la-vector-assignment-cpp 25.0858 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 29, 1, 21, 46) common-progress-cpp 28.6946 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 29, 1, 22, 16) common-timing-cpp 30.0305 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 29, 1, 24, 2) fem-multicore-cpp 106.72 "Coloring mesh."
+(2013, 4, 29, 1, 26, 35) fem-assembly-cpp 152.258 "Assembly for various forms and backends"
+(2013, 4, 29, 1, 26, 47) fem-convergence-cpp 12.114 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 29, 1, 26, 49) fem-jit-python 0.00103331 "JIT compilation (in memory cache)"
+(2013, 4, 29, 1, 31, 55) fem-speedup-cpp 306.045 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 29, 1, 31, 55) fem-speedup-cpp-assembly 6.5082 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 29, 1, 31, 55) fem-speedup-cpp-solve 2.27672 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 29, 1, 32, 16) mesh-refinement-cpp 19.8818 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 29, 1, 32, 35) mesh-topology-cpp 19.5351 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 29, 1, 33, 0) mesh-unitcube-cpp 24.4207 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 29, 1, 33, 42) mesh-iteration-cpp 39.1558 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 29, 1, 34, 3) function-evaluation-cpp 21.1693 "Evaluations of functions at arbitrary points."
+(2013, 4, 29, 1, 34, 3) function-evaluation-cpp 21.0766 "Evaluations of functions at arbitrary points."
+(2013, 4, 29, 1, 34, 7) function-extrapolation-python 4.54451 "*** -------------------------------------------------------------------------"
+(2013, 4, 29, 1, 34, 7) function-extrapolation-python 2.10333 "*** -------------------------------------------------------------------------"
+(2013, 4, 29, 1, 34, 31) la-vector-access-cpp 23.4516 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 29, 1, 34, 56) la-vector-assignment-cpp 25.0252 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 4, 30, 1, 25, 46) common-progress-cpp 28.6698 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 4, 30, 1, 26, 17) common-timing-cpp 31.0393 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 4, 30, 1, 28, 4) fem-multicore-cpp 106.913 "Coloring mesh."
+(2013, 4, 30, 1, 30, 36) fem-assembly-cpp 152.33 "Assembly for various forms and backends"
+(2013, 4, 30, 1, 30, 48) fem-convergence-cpp 12.1062 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 4, 30, 1, 30, 54) fem-jit-python 0.00108891 "JIT compilation (in memory cache)"
+(2013, 4, 30, 1, 36, 2) fem-speedup-cpp 307.453 "Assembly/solve speedup running on 4 processors"
+(2013, 4, 30, 1, 36, 2) fem-speedup-cpp-assembly 6.53321 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 4, 30, 1, 36, 2) fem-speedup-cpp-solve 2.27357 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 4, 30, 1, 36, 24) mesh-refinement-cpp 19.8983 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 4, 30, 1, 36, 43) mesh-topology-cpp 19.5177 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 4, 30, 1, 37, 8) mesh-unitcube-cpp 24.3351 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 4, 30, 1, 37, 49) mesh-iteration-cpp 39.1636 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 4, 30, 1, 38, 11) function-evaluation-cpp 21.4616 "Evaluations of functions at arbitrary points."
+(2013, 4, 30, 1, 38, 11) function-evaluation-cpp 21.3271 "Evaluations of functions at arbitrary points."
+(2013, 4, 30, 1, 38, 16) function-extrapolation-python 4.68595 "*** -------------------------------------------------------------------------"
+(2013, 4, 30, 1, 38, 16) function-extrapolation-python 2.10592 "*** -------------------------------------------------------------------------"
+(2013, 4, 30, 1, 38, 39) la-vector-access-cpp 23.4471 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 4, 30, 1, 39, 4) la-vector-assignment-cpp 25.0839 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 1, 1, 21, 37) common-progress-cpp 28.7197 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 1, 1, 22, 7) common-timing-cpp 30.488 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 1, 1, 23, 54) fem-multicore-cpp 106.667 "Coloring mesh."
+(2013, 5, 1, 1, 26, 26) fem-assembly-cpp 152 "Assembly for various forms and backends"
+(2013, 5, 1, 1, 26, 38) fem-convergence-cpp 12.1005 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 1, 1, 26, 40) fem-jit-python 0.00103481 "JIT compilation (in memory cache)"
+(2013, 5, 1, 1, 31, 43) fem-speedup-cpp 302.781 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 1, 1, 31, 43) fem-speedup-cpp-assembly 6.54239 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 1, 1, 31, 43) fem-speedup-cpp-solve 2.35936 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 1, 1, 32, 4) mesh-refinement-cpp 19.8865 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 1, 1, 32, 23) mesh-topology-cpp 19.5457 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 1, 1, 32, 47) mesh-unitcube-cpp 24.4115 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 1, 1, 33, 29) mesh-iteration-cpp 39.1655 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 1, 1, 33, 50) function-evaluation-cpp 21.2094 "Evaluations of functions at arbitrary points."
+(2013, 5, 1, 1, 33, 50) function-evaluation-cpp 21.1268 "Evaluations of functions at arbitrary points."
+(2013, 5, 1, 1, 33, 55) function-extrapolation-python 4.33048 "*** -------------------------------------------------------------------------"
+(2013, 5, 1, 1, 33, 55) function-extrapolation-python 2.11074 "*** -------------------------------------------------------------------------"
+(2013, 5, 1, 1, 34, 18) la-vector-access-cpp 23.4327 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 1, 1, 34, 44) la-vector-assignment-cpp 25.3839 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 2, 1, 19, 40) common-progress-cpp 28.703 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 2, 1, 20, 10) common-timing-cpp 30.3627 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 2, 1, 21, 57) fem-multicore-cpp 107.058 "Coloring mesh."
+(2013, 5, 2, 1, 24, 30) fem-assembly-cpp 152.541 "Assembly for various forms and backends"
+(2013, 5, 2, 1, 24, 42) fem-convergence-cpp 12.1145 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 2, 1, 24, 44) fem-jit-python 0.0010366 "JIT compilation (in memory cache)"
+(2013, 5, 2, 1, 29, 50) fem-speedup-cpp 305.85 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 2, 1, 29, 50) fem-speedup-cpp-assembly 6.4985 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 2, 1, 29, 50) fem-speedup-cpp-solve 2.30241 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 2, 1, 30, 12) mesh-refinement-cpp 19.9071 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 2, 1, 30, 32) mesh-topology-cpp 19.6088 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 2, 1, 30, 56) mesh-unitcube-cpp 24.332 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 2, 1, 31, 43) mesh-iteration-cpp 44.1971 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 2, 1, 32, 4) function-evaluation-cpp 21.1703 "Evaluations of functions at arbitrary points."
+(2013, 5, 2, 1, 32, 4) function-evaluation-cpp 21.0478 "Evaluations of functions at arbitrary points."
+(2013, 5, 2, 1, 32, 9) function-extrapolation-python 4.57198 "*** -------------------------------------------------------------------------"
+(2013, 5, 2, 1, 32, 9) function-extrapolation-python 2.10814 "*** -------------------------------------------------------------------------"
+(2013, 5, 2, 1, 32, 32) la-vector-access-cpp 23.462 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 2, 1, 32, 57) la-vector-assignment-cpp 25.0895 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 3, 1, 21, 2) common-progress-cpp 28.703 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 3, 1, 21, 32) common-timing-cpp 29.5902 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 3, 1, 23, 19) fem-multicore-cpp 106.725 "Coloring mesh."
+(2013, 5, 3, 1, 25, 51) fem-assembly-cpp 152.213 "Assembly for various forms and backends"
+(2013, 5, 3, 1, 26, 3) fem-convergence-cpp 12.0994 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 3, 1, 26, 5) fem-jit-python 0.0010428 "JIT compilation (in memory cache)"
+(2013, 5, 3, 1, 31, 8) fem-speedup-cpp 303.394 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 3, 1, 31, 8) fem-speedup-cpp-assembly 6.57193 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 3, 1, 31, 8) fem-speedup-cpp-solve 2.22086 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 3, 1, 31, 30) mesh-refinement-cpp 19.8577 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 3, 1, 31, 50) mesh-topology-cpp 19.5836 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 3, 1, 32, 14) mesh-unitcube-cpp 24.3928 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 3, 1, 32, 56) mesh-iteration-cpp 39.1616 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 3, 1, 33, 18) function-evaluation-cpp 21.8032 "Evaluations of functions at arbitrary points."
+(2013, 5, 3, 1, 33, 18) function-evaluation-cpp 21.6738 "Evaluations of functions at arbitrary points."
+(2013, 5, 3, 1, 33, 23) function-extrapolation-python 4.70257 "*** -------------------------------------------------------------------------"
+(2013, 5, 3, 1, 33, 23) function-extrapolation-python 2.11634 "*** -------------------------------------------------------------------------"
+(2013, 5, 3, 1, 33, 46) la-vector-access-cpp 23.6619 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 3, 1, 34, 11) la-vector-assignment-cpp 25.0234 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 4, 1, 19, 17) common-progress-cpp 28.703 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 4, 1, 19, 48) common-timing-cpp 31.7999 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 4, 1, 21, 35) fem-multicore-cpp 106.937 "Coloring mesh."
+(2013, 5, 4, 1, 24, 7) fem-assembly-cpp 151.884 "Assembly for various forms and backends"
+(2013, 5, 4, 1, 24, 19) fem-convergence-cpp 12.0982 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 4, 1, 24, 21) fem-jit-python 0.0010298 "JIT compilation (in memory cache)"
+(2013, 5, 4, 1, 29, 24) fem-speedup-cpp 302.639 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 4, 1, 29, 24) fem-speedup-cpp-assembly 6.4109 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 4, 1, 29, 24) fem-speedup-cpp-solve 2.37475 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 4, 1, 29, 45) mesh-refinement-cpp 19.9123 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 4, 1, 30, 5) mesh-topology-cpp 19.6394 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 4, 1, 30, 29) mesh-unitcube-cpp 24.4061 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 4, 1, 31, 18) mesh-iteration-cpp 46.0641 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 4, 1, 31, 39) function-evaluation-cpp 21.1095 "Evaluations of functions at arbitrary points."
+(2013, 5, 4, 1, 31, 39) function-evaluation-cpp 21.0277 "Evaluations of functions at arbitrary points."
+(2013, 5, 4, 1, 31, 43) function-extrapolation-python 4.42952 "*** -------------------------------------------------------------------------"
+(2013, 5, 4, 1, 31, 43) function-extrapolation-python 2.1133 "*** -------------------------------------------------------------------------"
+(2013, 5, 4, 1, 32, 7) la-vector-access-cpp 23.3996 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 4, 1, 32, 34) la-vector-assignment-cpp 27.5743 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 5, 1, 21, 54) common-progress-cpp 28.6863 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 5, 1, 22, 24) common-timing-cpp 30.3428 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 5, 1, 24, 11) fem-multicore-cpp 106.663 "Coloring mesh."
+(2013, 5, 5, 1, 26, 44) fem-assembly-cpp 153.035 "Assembly for various forms and backends"
+(2013, 5, 5, 1, 26, 56) fem-convergence-cpp 12.0975 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 5, 1, 26, 58) fem-jit-python 0.00102999 "JIT compilation (in memory cache)"
+(2013, 5, 5, 1, 32, 4) fem-speedup-cpp 305.597 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 5, 1, 32, 4) fem-speedup-cpp-assembly 6.56843 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 5, 1, 32, 4) fem-speedup-cpp-solve 2.31122 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 5, 1, 32, 24) mesh-refinement-cpp 19.8644 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 5, 1, 32, 44) mesh-topology-cpp 19.553 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 5, 1, 33, 8) mesh-unitcube-cpp 24.3934 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 5, 1, 33, 50) mesh-iteration-cpp 39.1597 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 5, 1, 34, 11) function-evaluation-cpp 21.1446 "Evaluations of functions at arbitrary points."
+(2013, 5, 5, 1, 34, 11) function-evaluation-cpp 21.0471 "Evaluations of functions at arbitrary points."
+(2013, 5, 5, 1, 34, 16) function-extrapolation-python 4.55283 "*** -------------------------------------------------------------------------"
+(2013, 5, 5, 1, 34, 16) function-extrapolation-python 2.12224 "*** -------------------------------------------------------------------------"
+(2013, 5, 5, 1, 34, 39) la-vector-access-cpp 23.4574 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 5, 1, 35, 4) la-vector-assignment-cpp 25.087 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 6, 1, 20, 4) common-progress-cpp 28.703 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 6, 1, 20, 35) common-timing-cpp 30.3224 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 6, 1, 22, 22) fem-multicore-cpp 106.92 "Coloring mesh."
+(2013, 5, 6, 1, 24, 53) fem-assembly-cpp 151.941 "Assembly for various forms and backends"
+(2013, 5, 6, 1, 25, 6) fem-convergence-cpp 12.0977 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 6, 1, 25, 7) fem-jit-python 0.00104599 "JIT compilation (in memory cache)"
+(2013, 5, 6, 1, 30, 13) fem-speedup-cpp 306.103 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 6, 1, 30, 13) fem-speedup-cpp-assembly 6.455 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 6, 1, 30, 13) fem-speedup-cpp-solve 2.3164 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 6, 1, 30, 35) mesh-refinement-cpp 19.8456 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 6, 1, 30, 55) mesh-topology-cpp 19.601 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 6, 1, 31, 19) mesh-unitcube-cpp 24.4714 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 6, 1, 32, 1) mesh-iteration-cpp 39.1292 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 6, 1, 32, 22) function-evaluation-cpp 21.1705 "Evaluations of functions at arbitrary points."
+(2013, 5, 6, 1, 32, 22) function-evaluation-cpp 21.0599 "Evaluations of functions at arbitrary points."
+(2013, 5, 6, 1, 32, 27) function-extrapolation-python 4.59439 "*** -------------------------------------------------------------------------"
+(2013, 5, 6, 1, 32, 27) function-extrapolation-python 2.08691 "*** -------------------------------------------------------------------------"
+(2013, 5, 6, 1, 32, 50) la-vector-access-cpp 23.4394 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 6, 1, 33, 15) la-vector-assignment-cpp 25.0899 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 7, 1, 18, 16) common-progress-cpp 28.6531 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 7, 1, 18, 46) common-timing-cpp 29.9226 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 7, 1, 20, 33) fem-multicore-cpp 106.748 "Coloring mesh."
+(2013, 5, 7, 1, 23, 5) fem-assembly-cpp 152.267 "Assembly for various forms and backends"
+(2013, 5, 7, 1, 23, 17) fem-convergence-cpp 12.1049 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 7, 1, 23, 19) fem-jit-python 0.00104439 "JIT compilation (in memory cache)"
+(2013, 5, 7, 1, 28, 24) fem-speedup-cpp 305.046 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 7, 1, 28, 24) fem-speedup-cpp-assembly 6.45969 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 7, 1, 28, 24) fem-speedup-cpp-solve 2.23675 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 7, 1, 28, 46) mesh-refinement-cpp 19.876 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 7, 1, 29, 6) mesh-topology-cpp 19.5867 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 7, 1, 29, 30) mesh-unitcube-cpp 24.3237 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 7, 1, 30, 12) mesh-iteration-cpp 39.1545 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 7, 1, 30, 33) function-evaluation-cpp 21.2371 "Evaluations of functions at arbitrary points."
+(2013, 5, 7, 1, 30, 33) function-evaluation-cpp 21.1068 "Evaluations of functions at arbitrary points."
+(2013, 5, 7, 1, 30, 38) function-extrapolation-python 4.56615 "*** -------------------------------------------------------------------------"
+(2013, 5, 7, 1, 30, 38) function-extrapolation-python 2.11616 "*** -------------------------------------------------------------------------"
+(2013, 5, 7, 1, 31, 1) la-vector-access-cpp 23.4819 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 7, 1, 31, 26) la-vector-assignment-cpp 25.0778 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 8, 1, 18, 44) common-progress-cpp 28.6864 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 8, 1, 19, 14) common-timing-cpp 29.8535 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 8, 1, 21, 1) fem-multicore-cpp 107.235 "Coloring mesh."
+(2013, 5, 8, 1, 23, 33) fem-assembly-cpp 152.249 "Assembly for various forms and backends"
+(2013, 5, 8, 1, 23, 45) fem-convergence-cpp 12.1019 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 8, 1, 23, 47) fem-jit-python 0.00104451 "JIT compilation (in memory cache)"
+(2013, 5, 8, 1, 28, 51) fem-speedup-cpp 304.416 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 8, 1, 28, 51) fem-speedup-cpp-assembly 6.5183 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 8, 1, 28, 51) fem-speedup-cpp-solve 2.31567 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 8, 1, 29, 12) mesh-refinement-cpp 19.8711 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 8, 1, 29, 32) mesh-topology-cpp 19.499 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 8, 1, 29, 56) mesh-unitcube-cpp 24.5936 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 8, 1, 30, 38) mesh-iteration-cpp 39.1602 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 8, 1, 30, 59) function-evaluation-cpp 21.3978 "Evaluations of functions at arbitrary points."
+(2013, 5, 8, 1, 30, 59) function-evaluation-cpp 21.2933 "Evaluations of functions at arbitrary points."
+(2013, 5, 8, 1, 31, 16) function-extrapolation-python 16.7852 "*** -------------------------------------------------------------------------"
+(2013, 5, 8, 1, 31, 16) function-extrapolation-python 2.13427 "*** -------------------------------------------------------------------------"
+(2013, 5, 8, 1, 31, 41) la-vector-access-cpp 24.9319 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 8, 1, 32, 6) la-vector-assignment-cpp 25.066 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 9, 1, 21, 1) common-progress-cpp 28.7281 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 9, 1, 21, 31) common-timing-cpp 30.2288 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 9, 1, 23, 18) fem-multicore-cpp 106.799 "Coloring mesh."
+(2013, 5, 9, 1, 25, 46) fem-assembly-cpp 147.739 "Assembly for various forms and backends"
+(2013, 5, 9, 1, 25, 58) fem-convergence-cpp 12.1154 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 9, 1, 26, 0) fem-jit-python 0.00103281 "JIT compilation (in memory cache)"
+(2013, 5, 9, 1, 31, 4) fem-speedup-cpp 303.736 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 9, 1, 31, 4) fem-speedup-cpp-assembly 6.43074 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 9, 1, 31, 4) fem-speedup-cpp-solve 2.33124 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 9, 1, 31, 24) mesh-refinement-cpp 19.8871 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 9, 1, 31, 44) mesh-topology-cpp 19.3851 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 9, 1, 32, 8) mesh-unitcube-cpp 24.3987 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 9, 1, 32, 57) mesh-iteration-cpp 46.0594 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 9, 1, 33, 18) function-evaluation-cpp 21.1426 "Evaluations of functions at arbitrary points."
+(2013, 5, 9, 1, 33, 18) function-evaluation-cpp 21.0643 "Evaluations of functions at arbitrary points."
+(2013, 5, 9, 1, 33, 22) function-extrapolation-python 4.54238 "*** -------------------------------------------------------------------------"
+(2013, 5, 9, 1, 33, 22) function-extrapolation-python 2.11416 "*** -------------------------------------------------------------------------"
+(2013, 5, 9, 1, 33, 46) la-vector-access-cpp 23.4261 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 9, 1, 34, 12) la-vector-assignment-cpp 26.4632 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 10, 1, 20, 11) common-progress-cpp 29.0283 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 10, 1, 20, 43) common-timing-cpp 31.4199 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 10, 1, 22, 30) fem-multicore-cpp 107.097 "Coloring mesh."
+(2013, 5, 10, 1, 24, 57) fem-assembly-cpp 147.533 "Assembly for various forms and backends"
+(2013, 5, 10, 1, 25, 9) fem-convergence-cpp 12.1081 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 10, 1, 25, 11) fem-jit-python 0.0010258 "JIT compilation (in memory cache)"
+(2013, 5, 10, 1, 30, 16) fem-speedup-cpp 304.707 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 10, 1, 30, 16) fem-speedup-cpp-assembly 6.50599 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 10, 1, 30, 16) fem-speedup-cpp-solve 2.33266 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 10, 1, 30, 37) mesh-refinement-cpp 19.8851 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 10, 1, 30, 56) mesh-topology-cpp 19.4559 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 10, 1, 31, 21) mesh-unitcube-cpp 24.3756 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 10, 1, 32, 3) mesh-iteration-cpp 39.1606 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 10, 1, 32, 24) function-evaluation-cpp 21.1395 "Evaluations of functions at arbitrary points."
+(2013, 5, 10, 1, 32, 24) function-evaluation-cpp 21.0513 "Evaluations of functions at arbitrary points."
+(2013, 5, 10, 1, 32, 28) function-extrapolation-python 4.56953 "*** -------------------------------------------------------------------------"
+(2013, 5, 10, 1, 32, 28) function-extrapolation-python 2.10541 "*** -------------------------------------------------------------------------"
+(2013, 5, 10, 1, 32, 53) la-vector-access-cpp 24.9269 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 10, 1, 33, 18) la-vector-assignment-cpp 25.0606 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 11, 1, 21, 30) common-progress-cpp 28.7779 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 11, 1, 22, 1) common-timing-cpp 30.3501 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 11, 1, 23, 48) fem-multicore-cpp 107.454 "Coloring mesh."
+(2013, 5, 11, 1, 26, 18) fem-assembly-cpp 150.228 "Assembly for various forms and backends"
+(2013, 5, 11, 1, 26, 30) fem-convergence-cpp 12.1122 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 11, 1, 26, 32) fem-jit-python 0.00103781 "JIT compilation (in memory cache)"
+(2013, 5, 11, 1, 31, 39) fem-speedup-cpp 306.255 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 11, 1, 31, 39) fem-speedup-cpp-assembly 6.66266 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 11, 1, 31, 39) fem-speedup-cpp-solve 2.318 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 11, 1, 32, 0) mesh-refinement-cpp 19.8429 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 11, 1, 32, 20) mesh-topology-cpp 19.2927 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 11, 1, 32, 44) mesh-unitcube-cpp 24.5239 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 11, 1, 33, 22) mesh-iteration-cpp 35.48 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 11, 1, 33, 44) function-evaluation-cpp 21.2372 "Evaluations of functions at arbitrary points."
+(2013, 5, 11, 1, 33, 44) function-evaluation-cpp 21.1171 "Evaluations of functions at arbitrary points."
+(2013, 5, 11, 1, 33, 48) function-extrapolation-python 4.48031 "*** -------------------------------------------------------------------------"
+(2013, 5, 11, 1, 33, 48) function-extrapolation-python 2.09146 "*** -------------------------------------------------------------------------"
+(2013, 5, 11, 1, 34, 13) la-vector-access-cpp 24.9474 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 11, 1, 34, 38) la-vector-assignment-cpp 25.0796 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 12, 1, 20, 34) common-progress-cpp 28.728 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 12, 1, 21, 5) common-timing-cpp 31.223 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 12, 1, 22, 53) fem-multicore-cpp 108.313 "Coloring mesh."
+(2013, 5, 12, 1, 25, 24) fem-assembly-cpp 151.04 "Assembly for various forms and backends"
+(2013, 5, 12, 1, 25, 37) fem-convergence-cpp 12.1588 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 12, 1, 25, 38) fem-jit-python 0.00104308 "JIT compilation (in memory cache)"
+(2013, 5, 12, 1, 30, 45) fem-speedup-cpp 306.497 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 12, 1, 30, 45) fem-speedup-cpp-assembly 6.58497 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 12, 1, 30, 45) fem-speedup-cpp-solve 2.32124 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 12, 1, 31, 7) mesh-refinement-cpp 19.967 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 12, 1, 31, 27) mesh-topology-cpp 19.464 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 12, 1, 31, 51) mesh-unitcube-cpp 24.2139 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 12, 1, 32, 33) mesh-iteration-cpp 39.1528 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 12, 1, 32, 55) function-evaluation-cpp 22.6945 "Evaluations of functions at arbitrary points."
+(2013, 5, 12, 1, 32, 55) function-evaluation-cpp 22.568 "Evaluations of functions at arbitrary points."
+(2013, 5, 12, 1, 33, 0) function-extrapolation-python 4.52773 "*** -------------------------------------------------------------------------"
+(2013, 5, 12, 1, 33, 0) function-extrapolation-python 2.10171 "*** -------------------------------------------------------------------------"
+(2013, 5, 12, 1, 33, 25) la-vector-access-cpp 24.9897 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 12, 1, 33, 50) la-vector-assignment-cpp 25.0889 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 13, 1, 20, 41) common-progress-cpp 28.7446 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 13, 1, 21, 12) common-timing-cpp 30.9912 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 13, 1, 23, 0) fem-multicore-cpp 108.233 "Coloring mesh."
+(2013, 5, 13, 1, 25, 31) fem-assembly-cpp 151.069 "Assembly for various forms and backends"
+(2013, 5, 13, 1, 25, 43) fem-convergence-cpp 12.1688 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 13, 1, 25, 45) fem-jit-python 0.00102742 "JIT compilation (in memory cache)"
+(2013, 5, 13, 1, 30, 49) fem-speedup-cpp 304.105 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 13, 1, 30, 49) fem-speedup-cpp-assembly 6.54235 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 13, 1, 30, 49) fem-speedup-cpp-solve 2.33474 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 13, 1, 31, 10) mesh-refinement-cpp 19.9462 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 13, 1, 31, 30) mesh-topology-cpp 19.4084 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 13, 1, 31, 54) mesh-unitcube-cpp 24.257 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 13, 1, 32, 36) mesh-iteration-cpp 39.1609 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 13, 1, 32, 57) function-evaluation-cpp 21.1819 "Evaluations of functions at arbitrary points."
+(2013, 5, 13, 1, 32, 57) function-evaluation-cpp 21.1019 "Evaluations of functions at arbitrary points."
+(2013, 5, 13, 1, 33, 1) function-extrapolation-python 4.42833 "*** -------------------------------------------------------------------------"
+(2013, 5, 13, 1, 33, 1) function-extrapolation-python 2.09207 "*** -------------------------------------------------------------------------"
+(2013, 5, 13, 1, 33, 24) la-vector-access-cpp 22.9352 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 13, 1, 33, 52) la-vector-assignment-cpp 27.5797 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 14, 1, 24, 29) common-progress-cpp 32.7661 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 14, 1, 24, 58) common-timing-cpp 29.1928 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 14, 1, 26, 46) fem-multicore-cpp 107.239 "Coloring mesh."
+(2013, 5, 14, 1, 29, 16) fem-assembly-cpp 149.901 "Assembly for various forms and backends"
+(2013, 5, 14, 1, 29, 28) fem-convergence-cpp 12.0958 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 14, 1, 29, 30) fem-jit-python 0.00102239 "JIT compilation (in memory cache)"
+(2013, 5, 14, 1, 34, 36) fem-speedup-cpp 306.824 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 14, 1, 34, 36) fem-speedup-cpp-assembly 6.60443 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 14, 1, 34, 36) fem-speedup-cpp-solve 2.29173 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 14, 1, 34, 59) mesh-refinement-cpp 20.0175 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 14, 1, 35, 18) mesh-topology-cpp 19.3419 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 14, 1, 35, 42) mesh-unitcube-cpp 24.0576 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 14, 1, 36, 24) mesh-iteration-cpp 39.1568 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 14, 1, 36, 45) function-evaluation-cpp 21.3955 "Evaluations of functions at arbitrary points."
+(2013, 5, 14, 1, 36, 45) function-evaluation-cpp 21.2643 "Evaluations of functions at arbitrary points."
+(2013, 5, 14, 1, 36, 50) function-extrapolation-python 4.50211 "*** -------------------------------------------------------------------------"
+(2013, 5, 14, 1, 36, 50) function-extrapolation-python 2.11037 "*** -------------------------------------------------------------------------"
+(2013, 5, 14, 1, 37, 13) la-vector-access-cpp 22.9491 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 14, 1, 37, 38) la-vector-assignment-cpp 25.0906 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 15, 1, 19, 10) common-progress-cpp 29.1026 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 15, 1, 19, 41) common-timing-cpp 30.4436 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 15, 1, 21, 28) fem-multicore-cpp 106.814 "Coloring mesh."
+(2013, 5, 15, 1, 23, 59) fem-assembly-cpp 150.894 "Assembly for various forms and backends"
+(2013, 5, 15, 1, 24, 11) fem-convergence-cpp 12.0981 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 15, 1, 24, 12) fem-jit-python 0.00103028 "JIT compilation (in memory cache)"
+(2013, 5, 15, 1, 29, 21) fem-speedup-cpp 308.904 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 15, 1, 29, 21) fem-speedup-cpp-assembly 6.5603 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 15, 1, 29, 21) fem-speedup-cpp-solve 2.24798 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 15, 1, 29, 43) mesh-refinement-cpp 19.894 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 15, 1, 30, 3) mesh-topology-cpp 19.3737 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 15, 1, 30, 27) mesh-unitcube-cpp 24.0552 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 15, 1, 31, 9) mesh-iteration-cpp 39.1598 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 15, 1, 31, 30) function-evaluation-cpp 21.2177 "Evaluations of functions at arbitrary points."
+(2013, 5, 15, 1, 31, 30) function-evaluation-cpp 21.1229 "Evaluations of functions at arbitrary points."
+(2013, 5, 15, 1, 31, 34) function-extrapolation-python 4.52671 "*** -------------------------------------------------------------------------"
+(2013, 5, 15, 1, 31, 34) function-extrapolation-python 2.10369 "*** -------------------------------------------------------------------------"
+(2013, 5, 15, 1, 31, 59) la-vector-access-cpp 24.9479 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 15, 1, 32, 25) la-vector-assignment-cpp 25.3165 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 16, 1, 20, 51) common-progress-cpp 28.8445 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 16, 1, 21, 22) common-timing-cpp 30.1864 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 16, 1, 23, 9) fem-multicore-cpp 106.955 "Coloring mesh."
+(2013, 5, 16, 1, 25, 40) fem-assembly-cpp 151.816 "Assembly for various forms and backends"
+(2013, 5, 16, 1, 25, 53) fem-convergence-cpp 12.1272 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 16, 1, 25, 54) fem-jit-python 0.00103111 "JIT compilation (in memory cache)"
+(2013, 5, 16, 1, 30, 58) fem-speedup-cpp 304.063 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 16, 1, 30, 58) fem-speedup-cpp-assembly 6.52952 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 16, 1, 30, 58) fem-speedup-cpp-solve 2.33616 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 16, 1, 31, 21) mesh-refinement-cpp 20.122 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 16, 1, 31, 40) mesh-topology-cpp 19.4495 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 16, 1, 32, 4) mesh-unitcube-cpp 23.958 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 16, 1, 32, 46) mesh-iteration-cpp 39.1588 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 16, 1, 33, 7) function-evaluation-cpp 21.1297 "Evaluations of functions at arbitrary points."
+(2013, 5, 16, 1, 33, 7) function-evaluation-cpp 21.0501 "Evaluations of functions at arbitrary points."
+(2013, 5, 16, 1, 33, 11) function-extrapolation-python 4.57905 "*** -------------------------------------------------------------------------"
+(2013, 5, 16, 1, 33, 11) function-extrapolation-python 2.14267 "*** -------------------------------------------------------------------------"
+(2013, 5, 16, 1, 33, 35) la-vector-access-cpp 23.4297 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 16, 1, 34, 0) la-vector-assignment-cpp 25.0683 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 17, 1, 19, 35) common-progress-cpp 28.9361 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 17, 1, 20, 6) common-timing-cpp 30.6966 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 17, 1, 21, 53) fem-multicore-cpp 107.309 "Coloring mesh."
+(2013, 5, 17, 1, 24, 25) fem-assembly-cpp 151.509 "Assembly for various forms and backends"
+(2013, 5, 17, 1, 24, 37) fem-convergence-cpp 12.1082 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 17, 1, 24, 39) fem-jit-python 0.00105009 "JIT compilation (in memory cache)"
+(2013, 5, 17, 1, 29, 47) fem-speedup-cpp 307.57 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 17, 1, 29, 47) fem-speedup-cpp-assembly 6.55186 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 17, 1, 29, 47) fem-speedup-cpp-solve 2.29484 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 17, 1, 30, 9) mesh-refinement-cpp 20.0431 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 17, 1, 30, 28) mesh-topology-cpp 19.4711 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 17, 1, 30, 52) mesh-unitcube-cpp 24.0535 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 17, 1, 31, 34) mesh-iteration-cpp 39.1519 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 17, 1, 31, 55) function-evaluation-cpp 21.2443 "Evaluations of functions at arbitrary points."
+(2013, 5, 17, 1, 31, 55) function-evaluation-cpp 21.1529 "Evaluations of functions at arbitrary points."
+(2013, 5, 17, 1, 32, 0) function-extrapolation-python 4.52667 "*** -------------------------------------------------------------------------"
+(2013, 5, 17, 1, 32, 0) function-extrapolation-python 2.09405 "*** -------------------------------------------------------------------------"
+(2013, 5, 17, 1, 32, 25) la-vector-access-cpp 24.9493 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 17, 1, 32, 51) la-vector-assignment-cpp 26.5935 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 18, 1, 21, 52) common-progress-cpp 28.8361 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 18, 1, 22, 22) common-timing-cpp 29.8164 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 18, 1, 24, 8) fem-multicore-cpp 106.682 "Coloring mesh."
+(2013, 5, 18, 1, 26, 38) fem-assembly-cpp 150.036 "Assembly for various forms and backends"
+(2013, 5, 18, 1, 26, 50) fem-convergence-cpp 12.1088 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 18, 1, 26, 52) fem-jit-python 0.00104172 "JIT compilation (in memory cache)"
+(2013, 5, 18, 1, 31, 57) fem-speedup-cpp 304.491 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 18, 1, 31, 57) fem-speedup-cpp-assembly 6.5882 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 18, 1, 31, 57) fem-speedup-cpp-solve 2.32749 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 18, 1, 32, 18) mesh-refinement-cpp 20.0809 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 18, 1, 32, 37) mesh-topology-cpp 19.4287 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 18, 1, 33, 1) mesh-unitcube-cpp 23.9386 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 18, 1, 33, 43) mesh-iteration-cpp 39.1571 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 18, 1, 34, 4) function-evaluation-cpp 21.4158 "Evaluations of functions at arbitrary points."
+(2013, 5, 18, 1, 34, 4) function-evaluation-cpp 21.3358 "Evaluations of functions at arbitrary points."
+(2013, 5, 18, 1, 34, 9) function-extrapolation-python 4.44161 "*** -------------------------------------------------------------------------"
+(2013, 5, 18, 1, 34, 9) function-extrapolation-python 2.12951 "*** -------------------------------------------------------------------------"
+(2013, 5, 18, 1, 34, 33) la-vector-access-cpp 24.9375 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 18, 1, 34, 59) la-vector-assignment-cpp 25.0731 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 19, 1, 18, 39) common-progress-cpp 28.8946 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 19, 1, 19, 9) common-timing-cpp 30.0161 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 19, 1, 20, 56) fem-multicore-cpp 106.846 "Coloring mesh."
+(2013, 5, 19, 1, 23, 26) fem-assembly-cpp 149.82 "Assembly for various forms and backends"
+(2013, 5, 19, 1, 23, 38) fem-convergence-cpp 12.1073 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 19, 1, 23, 40) fem-jit-python 0.00102971 "JIT compilation (in memory cache)"
+(2013, 5, 19, 1, 28, 44) fem-speedup-cpp 304.363 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 19, 1, 28, 44) fem-speedup-cpp-assembly 6.41508 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 19, 1, 28, 44) fem-speedup-cpp-solve 2.34097 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 19, 1, 29, 5) mesh-refinement-cpp 20.1861 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 19, 1, 29, 25) mesh-topology-cpp 19.5613 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 19, 1, 29, 49) mesh-unitcube-cpp 23.9706 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 19, 1, 30, 30) mesh-iteration-cpp 39.1538 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 19, 1, 30, 52) function-evaluation-cpp 21.2196 "Evaluations of functions at arbitrary points."
+(2013, 5, 19, 1, 30, 52) function-evaluation-cpp 21.0766 "Evaluations of functions at arbitrary points."
+(2013, 5, 19, 1, 30, 56) function-extrapolation-python 4.52784 "*** -------------------------------------------------------------------------"
+(2013, 5, 19, 1, 30, 56) function-extrapolation-python 2.14135 "*** -------------------------------------------------------------------------"
+(2013, 5, 19, 1, 31, 20) la-vector-access-cpp 23.4278 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 19, 1, 31, 47) la-vector-assignment-cpp 27.0797 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 20, 1, 22, 21) common-progress-cpp 32.6912 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 20, 1, 22, 52) common-timing-cpp 30.752 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 20, 1, 24, 39) fem-multicore-cpp 106.931 "Coloring mesh."
+(2013, 5, 20, 1, 27, 9) fem-assembly-cpp 150.006 "Assembly for various forms and backends"
+(2013, 5, 20, 1, 27, 21) fem-convergence-cpp 12.0994 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 20, 1, 27, 23) fem-jit-python 0.0010319 "JIT compilation (in memory cache)"
+(2013, 5, 20, 1, 32, 28) fem-speedup-cpp 305.075 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 20, 1, 32, 28) fem-speedup-cpp-assembly 6.53101 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 20, 1, 32, 28) fem-speedup-cpp-solve 2.31491 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 20, 1, 32, 50) mesh-refinement-cpp 20.094 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 20, 1, 33, 9) mesh-topology-cpp 19.4123 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 20, 1, 33, 33) mesh-unitcube-cpp 23.9109 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 20, 1, 34, 15) mesh-iteration-cpp 39.1567 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 20, 1, 34, 36) function-evaluation-cpp 21.1334 "Evaluations of functions at arbitrary points."
+(2013, 5, 20, 1, 34, 36) function-evaluation-cpp 21.051 "Evaluations of functions at arbitrary points."
+(2013, 5, 20, 1, 34, 40) function-extrapolation-python 4.57326 "*** -------------------------------------------------------------------------"
+(2013, 5, 20, 1, 34, 40) function-extrapolation-python 2.13656 "*** -------------------------------------------------------------------------"
+(2013, 5, 20, 1, 35, 5) la-vector-access-cpp 24.946 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 20, 1, 35, 30) la-vector-assignment-cpp 25.0624 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 21, 1, 20, 10) common-progress-cpp 28.8362 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 21, 1, 20, 40) common-timing-cpp 29.9423 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 21, 1, 22, 27) fem-multicore-cpp 107.041 "Coloring mesh."
+(2013, 5, 21, 1, 24, 57) fem-assembly-cpp 150.408 "Assembly for various forms and backends"
+(2013, 5, 21, 1, 25, 9) fem-convergence-cpp 12.157 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 21, 1, 25, 11) fem-jit-python 0.00105901 "JIT compilation (in memory cache)"
+(2013, 5, 21, 1, 30, 18) fem-speedup-cpp 306.65 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 21, 1, 30, 18) fem-speedup-cpp-assembly 6.57408 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 21, 1, 30, 18) fem-speedup-cpp-solve 2.29544 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 21, 1, 30, 39) mesh-refinement-cpp 20.0847 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 21, 1, 30, 59) mesh-topology-cpp 19.4154 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 21, 1, 31, 23) mesh-unitcube-cpp 23.9815 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 21, 1, 32, 4) mesh-iteration-cpp 39.1527 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 21, 1, 32, 26) function-evaluation-cpp 21.1544 "Evaluations of functions at arbitrary points."
+(2013, 5, 21, 1, 32, 26) function-evaluation-cpp 21.0314 "Evaluations of functions at arbitrary points."
+(2013, 5, 21, 1, 32, 30) function-extrapolation-python 4.61956 "*** -------------------------------------------------------------------------"
+(2013, 5, 21, 1, 32, 30) function-extrapolation-python 2.11824 "*** -------------------------------------------------------------------------"
+(2013, 5, 21, 1, 32, 55) la-vector-access-cpp 24.9548 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 21, 1, 33, 20) la-vector-assignment-cpp 25.089 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 22, 1, 20, 42) common-progress-cpp 28.7197 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 22, 1, 21, 12) common-timing-cpp 29.7857 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 22, 1, 22, 59) fem-multicore-cpp 106.819 "Coloring mesh."
+(2013, 5, 22, 1, 25, 30) fem-assembly-cpp 150.91 "Assembly for various forms and backends"
+(2013, 5, 22, 1, 25, 42) fem-convergence-cpp 12.1158 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 22, 1, 25, 44) fem-jit-python 0.00103281 "JIT compilation (in memory cache)"
+(2013, 5, 22, 1, 30, 49) fem-speedup-cpp 304.746 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 22, 1, 30, 49) fem-speedup-cpp-assembly 6.6097 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 22, 1, 30, 49) fem-speedup-cpp-solve 2.32667 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 22, 1, 31, 9) mesh-refinement-cpp 20.0798 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 22, 1, 31, 29) mesh-topology-cpp 19.4705 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 22, 1, 31, 53) mesh-unitcube-cpp 24.0869 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 22, 1, 32, 35) mesh-iteration-cpp 39.1569 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 22, 1, 32, 56) function-evaluation-cpp 21.1544 "Evaluations of functions at arbitrary points."
+(2013, 5, 22, 1, 32, 56) function-evaluation-cpp 21.0712 "Evaluations of functions at arbitrary points."
+(2013, 5, 22, 1, 33, 0) function-extrapolation-python 4.51483 "*** -------------------------------------------------------------------------"
+(2013, 5, 22, 1, 33, 0) function-extrapolation-python 2.12681 "*** -------------------------------------------------------------------------"
+(2013, 5, 22, 1, 33, 24) la-vector-access-cpp 23.4383 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 22, 1, 33, 51) la-vector-assignment-cpp 27.1967 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 23, 1, 22, 18) common-progress-cpp 28.9694 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 23, 1, 22, 48) common-timing-cpp 30.7527 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 23, 1, 24, 36) fem-multicore-cpp 107.227 "Coloring mesh."
+(2013, 5, 23, 1, 27, 6) fem-assembly-cpp 150.524 "Assembly for various forms and backends"
+(2013, 5, 23, 1, 27, 18) fem-convergence-cpp 12.1274 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 23, 1, 27, 20) fem-jit-python 0.00103579 "JIT compilation (in memory cache)"
+(2013, 5, 23, 1, 32, 29) fem-speedup-cpp 309.053 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 23, 1, 32, 29) fem-speedup-cpp-assembly 6.51775 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 23, 1, 32, 29) fem-speedup-cpp-solve 2.23861 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 23, 1, 32, 51) mesh-refinement-cpp 20.1012 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 23, 1, 33, 11) mesh-topology-cpp 19.4229 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 23, 1, 33, 35) mesh-unitcube-cpp 23.9371 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 23, 1, 34, 26) mesh-iteration-cpp 49.2226 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 23, 1, 34, 48) function-evaluation-cpp 21.3877 "Evaluations of functions at arbitrary points."
+(2013, 5, 23, 1, 34, 48) function-evaluation-cpp 21.2816 "Evaluations of functions at arbitrary points."
+(2013, 5, 23, 1, 34, 52) function-extrapolation-python 4.51764 "*** -------------------------------------------------------------------------"
+(2013, 5, 23, 1, 34, 52) function-extrapolation-python 2.08921 "*** -------------------------------------------------------------------------"
+(2013, 5, 23, 1, 35, 16) la-vector-access-cpp 23.4442 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 23, 1, 35, 41) la-vector-assignment-cpp 25.036 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 24, 1, 21, 35) common-progress-cpp 28.9109 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 24, 1, 22, 6) common-timing-cpp 30.8263 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 24, 1, 23, 52) fem-multicore-cpp 106.961 "Coloring mesh."
+(2013, 5, 24, 1, 26, 22) fem-assembly-cpp 149.883 "Assembly for various forms and backends"
+(2013, 5, 24, 1, 26, 34) fem-convergence-cpp 12.1327 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 24, 1, 26, 36) fem-jit-python 0.00103981 "JIT compilation (in memory cache)"
+(2013, 5, 24, 1, 31, 40) fem-speedup-cpp 304.123 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 24, 1, 31, 40) fem-speedup-cpp-assembly 6.52779 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 24, 1, 31, 40) fem-speedup-cpp-solve 2.34078 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 24, 1, 32, 2) mesh-refinement-cpp 20.1018 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 24, 1, 32, 21) mesh-topology-cpp 19.3792 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 24, 1, 32, 45) mesh-unitcube-cpp 23.9445 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 24, 1, 33, 27) mesh-iteration-cpp 39.1624 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 24, 1, 33, 48) function-evaluation-cpp 21.1176 "Evaluations of functions at arbitrary points."
+(2013, 5, 24, 1, 33, 48) function-evaluation-cpp 21.0336 "Evaluations of functions at arbitrary points."
+(2013, 5, 24, 1, 33, 52) function-extrapolation-python 4.62782 "*** -------------------------------------------------------------------------"
+(2013, 5, 24, 1, 33, 52) function-extrapolation-python 2.16172 "*** -------------------------------------------------------------------------"
+(2013, 5, 24, 1, 34, 17) la-vector-access-cpp 24.9448 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 24, 1, 34, 42) la-vector-assignment-cpp 24.9165 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 25, 1, 20, 41) common-progress-cpp 28.7695 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 25, 1, 21, 12) common-timing-cpp 30.9639 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 25, 1, 22, 59) fem-multicore-cpp 107.133 "Coloring mesh."
+(2013, 5, 25, 1, 25, 30) fem-assembly-cpp 150.222 "Assembly for various forms and backends"
+(2013, 5, 25, 1, 25, 42) fem-convergence-cpp 12.128 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 25, 1, 25, 44) fem-jit-python 0.0010354 "JIT compilation (in memory cache)"
+(2013, 5, 25, 1, 30, 51) fem-speedup-cpp 307.203 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 25, 1, 30, 51) fem-speedup-cpp-assembly 6.57998 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 25, 1, 30, 51) fem-speedup-cpp-solve 2.26721 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 25, 1, 31, 13) mesh-refinement-cpp 19.9634 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 25, 1, 31, 32) mesh-topology-cpp 19.3921 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 25, 1, 31, 56) mesh-unitcube-cpp 23.9344 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 25, 1, 32, 38) mesh-iteration-cpp 39.1571 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 25, 1, 32, 59) function-evaluation-cpp 21.2128 "Evaluations of functions at arbitrary points."
+(2013, 5, 25, 1, 32, 59) function-evaluation-cpp 21.0869 "Evaluations of functions at arbitrary points."
+(2013, 5, 25, 1, 33, 4) function-extrapolation-python 4.59302 "*** -------------------------------------------------------------------------"
+(2013, 5, 25, 1, 33, 4) function-extrapolation-python 2.09164 "*** -------------------------------------------------------------------------"
+(2013, 5, 25, 1, 33, 27) la-vector-access-cpp 23.444 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 25, 1, 33, 55) la-vector-assignment-cpp 27.5433 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 26, 1, 20, 12) common-progress-cpp 32.5165 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 26, 1, 20, 43) common-timing-cpp 31.43 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 26, 1, 22, 31) fem-multicore-cpp 107.112 "Coloring mesh."
+(2013, 5, 26, 1, 25, 0) fem-assembly-cpp 149.708 "Assembly for various forms and backends"
+(2013, 5, 26, 1, 25, 12) fem-convergence-cpp 12.1366 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 26, 1, 25, 14) fem-jit-python 0.00103519 "JIT compilation (in memory cache)"
+(2013, 5, 26, 1, 30, 21) fem-speedup-cpp 306.286 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 26, 1, 30, 21) fem-speedup-cpp-assembly 6.60275 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 26, 1, 30, 21) fem-speedup-cpp-solve 2.28959 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 26, 1, 30, 41) mesh-refinement-cpp 19.9603 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 26, 1, 31, 1) mesh-topology-cpp 19.4221 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 26, 1, 31, 25) mesh-unitcube-cpp 23.9701 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 26, 1, 32, 7) mesh-iteration-cpp 39.1547 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 26, 1, 32, 28) function-evaluation-cpp 21.1501 "Evaluations of functions at arbitrary points."
+(2013, 5, 26, 1, 32, 28) function-evaluation-cpp 21.0719 "Evaluations of functions at arbitrary points."
+(2013, 5, 26, 1, 32, 32) function-extrapolation-python 4.58616 "*** -------------------------------------------------------------------------"
+(2013, 5, 26, 1, 32, 32) function-extrapolation-python 2.13118 "*** -------------------------------------------------------------------------"
+(2013, 5, 26, 1, 32, 56) la-vector-access-cpp 23.4307 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 26, 1, 33, 53) la-vector-assignment-cpp 57.0087 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 27, 1, 20, 55) common-progress-cpp 28.6947 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 27, 1, 21, 25) common-timing-cpp 30.2411 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 27, 1, 23, 12) fem-multicore-cpp 106.289 "Coloring mesh."
+(2013, 5, 27, 1, 25, 42) fem-assembly-cpp 150.881 "Assembly for various forms and backends"
+(2013, 5, 27, 1, 25, 54) fem-convergence-cpp 12.0935 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 27, 1, 25, 56) fem-jit-python 0.0010488 "JIT compilation (in memory cache)"
+(2013, 5, 27, 1, 31, 0) fem-speedup-cpp 303.779 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 27, 1, 31, 0) fem-speedup-cpp-assembly 6.69875 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 27, 1, 31, 0) fem-speedup-cpp-solve 2.34753 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 27, 1, 31, 21) mesh-refinement-cpp 19.9028 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 27, 1, 31, 40) mesh-topology-cpp 19.4461 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 27, 1, 32, 5) mesh-unitcube-cpp 24.131 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 27, 1, 32, 46) mesh-iteration-cpp 39.1556 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 27, 1, 33, 7) function-evaluation-cpp 21.1814 "Evaluations of functions at arbitrary points."
+(2013, 5, 27, 1, 33, 7) function-evaluation-cpp 21.1019 "Evaluations of functions at arbitrary points."
+(2013, 5, 27, 1, 33, 12) function-extrapolation-python 4.51966 "*** -------------------------------------------------------------------------"
+(2013, 5, 27, 1, 33, 12) function-extrapolation-python 2.12959 "*** -------------------------------------------------------------------------"
+(2013, 5, 27, 1, 33, 35) la-vector-access-cpp 22.9838 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 27, 1, 34, 0) la-vector-assignment-cpp 25.0716 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 28, 1, 19, 5) common-progress-cpp 29.011 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 28, 1, 19, 37) common-timing-cpp 31.242 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 28, 1, 21, 24) fem-multicore-cpp 107.088 "Coloring mesh."
+(2013, 5, 28, 1, 23, 55) fem-assembly-cpp 151.585 "Assembly for various forms and backends"
+(2013, 5, 28, 1, 24, 7) fem-convergence-cpp 12.0813 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 28, 1, 24, 9) fem-jit-python 0.0010371 "JIT compilation (in memory cache)"
+(2013, 5, 28, 1, 29, 16) fem-speedup-cpp 307.109 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 28, 1, 29, 16) fem-speedup-cpp-assembly 6.62981 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 28, 1, 29, 16) fem-speedup-cpp-solve 2.28976 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 28, 1, 29, 39) mesh-refinement-cpp 19.8446 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 28, 1, 29, 59) mesh-topology-cpp 19.4459 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 28, 1, 30, 23) mesh-unitcube-cpp 24.1726 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 28, 1, 31, 5) mesh-iteration-cpp 39.162 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 28, 1, 31, 26) function-evaluation-cpp 21.2293 "Evaluations of functions at arbitrary points."
+(2013, 5, 28, 1, 31, 26) function-evaluation-cpp 21.0526 "Evaluations of functions at arbitrary points."
+(2013, 5, 28, 1, 31, 31) function-extrapolation-python 4.57018 "*** -------------------------------------------------------------------------"
+(2013, 5, 28, 1, 31, 31) function-extrapolation-python 2.11285 "*** -------------------------------------------------------------------------"
+(2013, 5, 28, 1, 31, 54) la-vector-access-cpp 23.0034 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 28, 1, 32, 19) la-vector-assignment-cpp 25.083 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 29, 1, 18, 58) common-progress-cpp 28.9861 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 29, 1, 19, 28) common-timing-cpp 30.5528 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 29, 1, 21, 14) fem-multicore-cpp 106.3 "Coloring mesh."
+(2013, 5, 29, 1, 23, 46) fem-assembly-cpp 151.697 "Assembly for various forms and backends"
+(2013, 5, 29, 1, 23, 58) fem-convergence-cpp 12.0829 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 29, 1, 24, 0) fem-jit-python 0.0010299 "JIT compilation (in memory cache)"
+(2013, 5, 29, 1, 29, 3) fem-speedup-cpp 303.439 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 29, 1, 29, 3) fem-speedup-cpp-assembly 6.65012 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 29, 1, 29, 3) fem-speedup-cpp-solve 2.35138 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 29, 1, 29, 24) mesh-refinement-cpp 19.8514 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 29, 1, 29, 44) mesh-topology-cpp 19.4783 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 29, 1, 30, 8) mesh-unitcube-cpp 24.1873 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 29, 1, 30, 50) mesh-iteration-cpp 39.1601 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 29, 1, 31, 11) function-evaluation-cpp 21.148 "Evaluations of functions at arbitrary points."
+(2013, 5, 29, 1, 31, 11) function-evaluation-cpp 21.0599 "Evaluations of functions at arbitrary points."
+(2013, 5, 29, 1, 31, 15) function-extrapolation-python 4.58603 "*** -------------------------------------------------------------------------"
+(2013, 5, 29, 1, 31, 15) function-extrapolation-python 2.11564 "*** -------------------------------------------------------------------------"
+(2013, 5, 29, 1, 31, 38) la-vector-access-cpp 23.171 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 29, 1, 32, 4) la-vector-assignment-cpp 25.119 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 30, 1, 18, 25) common-progress-cpp 29.0192 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 30, 1, 18, 56) common-timing-cpp 30.4525 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 30, 1, 20, 43) fem-multicore-cpp 107.009 "Coloring mesh."
+(2013, 5, 30, 1, 23, 14) fem-assembly-cpp 151.376 "Assembly for various forms and backends"
+(2013, 5, 30, 1, 23, 26) fem-convergence-cpp 12.0844 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 30, 1, 23, 28) fem-jit-python 0.00106471 "JIT compilation (in memory cache)"
+(2013, 5, 30, 1, 28, 32) fem-speedup-cpp 303.388 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 30, 1, 28, 32) fem-speedup-cpp-assembly 6.58356 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 30, 1, 28, 32) fem-speedup-cpp-solve 2.35103 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 30, 1, 28, 52) mesh-refinement-cpp 19.876 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 30, 1, 29, 12) mesh-topology-cpp 19.6286 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 30, 1, 29, 36) mesh-unitcube-cpp 24.2816 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 30, 1, 30, 18) mesh-iteration-cpp 39.1608 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 30, 1, 30, 39) function-evaluation-cpp 21.1254 "Evaluations of functions at arbitrary points."
+(2013, 5, 30, 1, 30, 39) function-evaluation-cpp 21.0471 "Evaluations of functions at arbitrary points."
+(2013, 5, 30, 1, 30, 43) function-extrapolation-python 4.42653 "*** -------------------------------------------------------------------------"
+(2013, 5, 30, 1, 30, 43) function-extrapolation-python 2.13002 "*** -------------------------------------------------------------------------"
+(2013, 5, 30, 1, 31, 6) la-vector-access-cpp 22.9348 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 30, 1, 31, 33) la-vector-assignment-cpp 27.0872 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 5, 31, 1, 20, 38) common-progress-cpp 28.7612 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 5, 31, 1, 21, 9) common-timing-cpp 30.7114 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 5, 31, 1, 22, 56) fem-multicore-cpp 106.856 "Coloring mesh."
+(2013, 5, 31, 1, 25, 26) fem-assembly-cpp 150.784 "Assembly for various forms and backends"
+(2013, 5, 31, 1, 25, 38) fem-convergence-cpp 12.1384 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 5, 31, 1, 25, 40) fem-jit-python 0.0010422 "JIT compilation (in memory cache)"
+(2013, 5, 31, 1, 30, 44) fem-speedup-cpp 303.213 "Assembly/solve speedup running on 4 processors"
+(2013, 5, 31, 1, 30, 44) fem-speedup-cpp-assembly 6.56542 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 5, 31, 1, 30, 44) fem-speedup-cpp-solve 2.36584 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 5, 31, 1, 31, 4) mesh-refinement-cpp 19.843 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 5, 31, 1, 31, 24) mesh-topology-cpp 19.2905 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 5, 31, 1, 31, 47) mesh-unitcube-cpp 23.8696 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 5, 31, 1, 32, 25) mesh-iteration-cpp 35.5184 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 5, 31, 1, 32, 47) function-evaluation-cpp 21.1315 "Evaluations of functions at arbitrary points."
+(2013, 5, 31, 1, 32, 47) function-evaluation-cpp 21.0523 "Evaluations of functions at arbitrary points."
+(2013, 5, 31, 1, 32, 51) function-extrapolation-python 4.50307 "*** -------------------------------------------------------------------------"
+(2013, 5, 31, 1, 32, 51) function-extrapolation-python 2.11167 "*** -------------------------------------------------------------------------"
+(2013, 5, 31, 1, 33, 15) la-vector-access-cpp 23.4316 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 5, 31, 1, 33, 40) la-vector-assignment-cpp 25.0665 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 1, 1, 20, 10) common-progress-cpp 28.9527 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 1, 1, 20, 40) common-timing-cpp 29.7848 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 1, 1, 22, 26) fem-multicore-cpp 106.183 "Coloring mesh."
+(2013, 6, 1, 1, 24, 56) fem-assembly-cpp 150.162 "Assembly for various forms and backends"
+(2013, 6, 1, 1, 25, 8) fem-convergence-cpp 12.0929 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 1, 1, 25, 10) fem-jit-python 0.00105009 "JIT compilation (in memory cache)"
+(2013, 6, 1, 1, 30, 15) fem-speedup-cpp 304.325 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 1, 1, 30, 15) fem-speedup-cpp-assembly 6.56287 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 1, 1, 30, 15) fem-speedup-cpp-solve 2.3471 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 1, 1, 30, 35) mesh-refinement-cpp 19.8949 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 1, 1, 30, 55) mesh-topology-cpp 19.5427 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 1, 1, 31, 19) mesh-unitcube-cpp 24.1476 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 1, 1, 32, 1) mesh-iteration-cpp 39.1554 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 1, 1, 32, 22) function-evaluation-cpp 21.2354 "Evaluations of functions at arbitrary points."
+(2013, 6, 1, 1, 32, 22) function-evaluation-cpp 21.1289 "Evaluations of functions at arbitrary points."
+(2013, 6, 1, 1, 32, 27) function-extrapolation-python 4.51113 "*** -------------------------------------------------------------------------"
+(2013, 6, 1, 1, 32, 27) function-extrapolation-python 2.11699 "*** -------------------------------------------------------------------------"
+(2013, 6, 1, 1, 32, 52) la-vector-access-cpp 24.925 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 1, 1, 33, 19) la-vector-assignment-cpp 27.0494 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 2, 1, 21, 33) common-progress-cpp 29.0277 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 2, 1, 22, 3) common-timing-cpp 30.1406 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 2, 1, 23, 49) fem-multicore-cpp 106.31 "Coloring mesh."
+(2013, 6, 2, 1, 26, 19) fem-assembly-cpp 150.112 "Assembly for various forms and backends"
+(2013, 6, 2, 1, 26, 32) fem-convergence-cpp 12.0952 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 2, 1, 26, 33) fem-jit-python 0.0010268 "JIT compilation (in memory cache)"
+(2013, 6, 2, 1, 31, 37) fem-speedup-cpp 303.771 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 2, 1, 31, 37) fem-speedup-cpp-assembly 6.60848 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 2, 1, 31, 37) fem-speedup-cpp-solve 2.34083 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 2, 1, 31, 58) mesh-refinement-cpp 19.878 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 2, 1, 32, 17) mesh-topology-cpp 19.5544 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 2, 1, 32, 42) mesh-unitcube-cpp 24.1094 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 2, 1, 33, 23) mesh-iteration-cpp 39.1558 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 2, 1, 33, 44) function-evaluation-cpp 21.1284 "Evaluations of functions at arbitrary points."
+(2013, 6, 2, 1, 33, 44) function-evaluation-cpp 21.0596 "Evaluations of functions at arbitrary points."
+(2013, 6, 2, 1, 33, 49) function-extrapolation-python 4.57792 "*** -------------------------------------------------------------------------"
+(2013, 6, 2, 1, 33, 49) function-extrapolation-python 2.13477 "*** -------------------------------------------------------------------------"
+(2013, 6, 2, 1, 34, 12) la-vector-access-cpp 22.9349 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 2, 1, 34, 37) la-vector-assignment-cpp 25.0653 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 3, 1, 18, 31) common-progress-cpp 28.9318 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 3, 1, 19, 2) common-timing-cpp 30.5338 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 3, 1, 20, 49) fem-multicore-cpp 107.012 "Coloring mesh."
+(2013, 6, 3, 1, 23, 19) fem-assembly-cpp 149.945 "Assembly for various forms and backends"
+(2013, 6, 3, 1, 23, 31) fem-convergence-cpp 12.0869 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 3, 1, 23, 33) fem-jit-python 0.001033 "JIT compilation (in memory cache)"
+(2013, 6, 3, 1, 28, 38) fem-speedup-cpp 305.454 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 3, 1, 28, 38) fem-speedup-cpp-assembly 6.66777 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 3, 1, 28, 38) fem-speedup-cpp-solve 2.29007 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 3, 1, 28, 59) mesh-refinement-cpp 19.8768 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 3, 1, 29, 19) mesh-topology-cpp 19.5038 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 3, 1, 29, 43) mesh-unitcube-cpp 24.1324 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 3, 1, 30, 24) mesh-iteration-cpp 39.1625 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 3, 1, 30, 46) function-evaluation-cpp 21.3895 "Evaluations of functions at arbitrary points."
+(2013, 6, 3, 1, 30, 46) function-evaluation-cpp 21.3203 "Evaluations of functions at arbitrary points."
+(2013, 6, 3, 1, 30, 50) function-extrapolation-python 4.54526 "*** -------------------------------------------------------------------------"
+(2013, 6, 3, 1, 30, 50) function-extrapolation-python 2.13303 "*** -------------------------------------------------------------------------"
+(2013, 6, 3, 1, 31, 15) la-vector-access-cpp 24.9275 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 3, 1, 31, 42) la-vector-assignment-cpp 26.4625 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 4, 1, 19, 24) common-progress-cpp 28.8704 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 4, 1, 19, 54) common-timing-cpp 29.7689 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 4, 1, 21, 43) fem-multicore-cpp 109.287 "Coloring mesh."
+(2013, 6, 4, 1, 24, 17) fem-assembly-cpp 154.155 "Assembly for various forms and backends"
+(2013, 6, 4, 1, 24, 29) fem-convergence-cpp 12.1457 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 4, 1, 24, 31) fem-jit-python 0.0010354 "JIT compilation (in memory cache)"
+(2013, 6, 4, 1, 29, 35) fem-speedup-cpp 304.081 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 4, 1, 29, 35) fem-speedup-cpp-assembly 6.55852 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 4, 1, 29, 35) fem-speedup-cpp-solve 2.33502 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 4, 1, 29, 56) mesh-refinement-cpp 19.7441 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 4, 1, 30, 15) mesh-topology-cpp 19.4309 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 4, 1, 30, 39) mesh-unitcube-cpp 24.1853 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 4, 1, 31, 18) mesh-iteration-cpp 35.6294 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 4, 1, 31, 39) function-evaluation-cpp 21.1423 "Evaluations of functions at arbitrary points."
+(2013, 6, 4, 1, 31, 39) function-evaluation-cpp 21.0674 "Evaluations of functions at arbitrary points."
+(2013, 6, 4, 1, 31, 43) function-extrapolation-python 4.45936 "*** -------------------------------------------------------------------------"
+(2013, 6, 4, 1, 31, 43) function-extrapolation-python 2.12229 "*** -------------------------------------------------------------------------"
+(2013, 6, 4, 1, 32, 8) la-vector-access-cpp 24.9485 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 4, 1, 32, 33) la-vector-assignment-cpp 25.0679 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 5, 1, 18, 46) common-progress-cpp 28.9092 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 5, 1, 19, 16) common-timing-cpp 29.9818 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 5, 1, 21, 6) fem-multicore-cpp 109.886 "Coloring mesh."
+(2013, 6, 5, 1, 23, 39) fem-assembly-cpp 153.32 "Assembly for various forms and backends"
+(2013, 6, 5, 1, 23, 51) fem-convergence-cpp 12.1586 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 5, 1, 23, 53) fem-jit-python 0.001039 "JIT compilation (in memory cache)"
+(2013, 6, 5, 1, 28, 59) fem-speedup-cpp 306.246 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 5, 1, 28, 59) fem-speedup-cpp-assembly 6.5046 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 5, 1, 28, 59) fem-speedup-cpp-solve 2.30423 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 5, 1, 29, 20) mesh-refinement-cpp 19.7301 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 5, 1, 29, 40) mesh-topology-cpp 19.5537 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 5, 1, 30, 4) mesh-unitcube-cpp 24.5751 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 5, 1, 30, 42) mesh-iteration-cpp 35.492 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 5, 1, 31, 3) function-evaluation-cpp 21.1502 "Evaluations of functions at arbitrary points."
+(2013, 6, 5, 1, 31, 3) function-evaluation-cpp 21.0668 "Evaluations of functions at arbitrary points."
+(2013, 6, 5, 1, 31, 8) function-extrapolation-python 4.49461 "*** -------------------------------------------------------------------------"
+(2013, 6, 5, 1, 31, 8) function-extrapolation-python 2.15063 "*** -------------------------------------------------------------------------"
+(2013, 6, 5, 1, 31, 33) la-vector-access-cpp 25.0229 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 5, 1, 31, 58) la-vector-assignment-cpp 25.0633 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 6, 1, 20, 25) common-progress-cpp 28.628 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 6, 1, 20, 56) common-timing-cpp 30.264 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 6, 1, 22, 45) fem-multicore-cpp 109.217 "Coloring mesh."
+(2013, 6, 6, 1, 25, 18) fem-assembly-cpp 153.592 "Assembly for various forms and backends"
+(2013, 6, 6, 1, 25, 31) fem-convergence-cpp 12.135 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 6, 1, 25, 32) fem-jit-python 0.0010386 "JIT compilation (in memory cache)"
+(2013, 6, 6, 1, 30, 42) fem-speedup-cpp 309.396 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 6, 1, 30, 42) fem-speedup-cpp-assembly 6.44119 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 6, 1, 30, 42) fem-speedup-cpp-solve 2.2324 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 6, 1, 31, 3) mesh-refinement-cpp 19.7073 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 6, 1, 31, 23) mesh-topology-cpp 19.5126 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 6, 1, 31, 47) mesh-unitcube-cpp 24.1189 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 6, 1, 32, 34) mesh-iteration-cpp 44.1734 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 6, 1, 32, 55) function-evaluation-cpp 21.205 "Evaluations of functions at arbitrary points."
+(2013, 6, 6, 1, 32, 55) function-evaluation-cpp 21.0518 "Evaluations of functions at arbitrary points."
+(2013, 6, 6, 1, 33, 0) function-extrapolation-python 4.59656 "*** -------------------------------------------------------------------------"
+(2013, 6, 6, 1, 33, 0) function-extrapolation-python 2.13076 "*** -------------------------------------------------------------------------"
+(2013, 6, 6, 1, 33, 23) la-vector-access-cpp 23.4494 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 6, 1, 33, 48) la-vector-assignment-cpp 25.0937 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 7, 1, 21, 5) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.01301 "Running DOLFIN bench"
+(2013, 6, 7, 1, 21, 6) geometry-bounding_box_tree_compute_closest_entity-cpp 0.249131 "Running DOLFIN bench"
+(2013, 6, 7, 1, 21, 15) geometry-bounding_box_tree_build-cpp 8.95832 "Running DOLFIN bench"
+(2013, 6, 7, 1, 21, 43) common-progress-cpp 27.6497 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 7, 1, 22, 12) common-timing-cpp 29.3385 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 7, 1, 23, 59) fem-multicore-cpp 106.492 "Coloring mesh."
+(2013, 6, 7, 1, 26, 28) fem-assembly-cpp 148.787 "Assembly for various forms and backends"
+(2013, 6, 7, 1, 26, 40) fem-convergence-cpp 12.124 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 7, 1, 26, 41) fem-jit-python 0.00103331 "JIT compilation (in memory cache)"
+(2013, 6, 7, 1, 31, 47) fem-speedup-cpp 305.662 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 7, 1, 31, 47) fem-speedup-cpp-assembly 6.5561 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 7, 1, 31, 47) fem-speedup-cpp-solve 2.22155 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 7, 1, 32, 9) mesh-refinement-cpp 19.831 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 7, 1, 32, 28) mesh-topology-cpp 19.4082 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 7, 1, 32, 52) mesh-unitcube-cpp 23.9951 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 7, 1, 33, 38) mesh-iteration-cpp 43.4799 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 7, 1, 34, 0) function-evaluation-cpp 21.2135 "Evaluations of functions at arbitrary points."
+(2013, 6, 7, 1, 34, 0) function-evaluation-cpp 21.0912 "Evaluations of functions at arbitrary points."
+(2013, 6, 7, 1, 34, 4) function-extrapolation-python 4.5052 "*** -------------------------------------------------------------------------"
+(2013, 6, 7, 1, 34, 4) function-extrapolation-python 2.11318 "*** -------------------------------------------------------------------------"
+(2013, 6, 7, 1, 34, 31) la-vector-access-cpp 26.7159 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 7, 1, 34, 58) la-vector-assignment-cpp 26.6114 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 8, 1, 20, 22) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.05756 "Running DOLFIN bench"
+(2013, 6, 8, 1, 20, 23) geometry-bounding_box_tree_compute_closest_entity-cpp 0.245334 "Running DOLFIN bench"
+(2013, 6, 8, 1, 20, 32) geometry-bounding_box_tree_build-cpp 8.98392 "Running DOLFIN bench"
+(2013, 6, 8, 1, 21, 0) common-progress-cpp 27.6508 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 8, 1, 21, 30) common-timing-cpp 29.5223 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 8, 1, 23, 16) fem-multicore-cpp 106.322 "Coloring mesh."
+(2013, 6, 8, 1, 25, 44) fem-assembly-cpp 147.95 "Assembly for various forms and backends"
+(2013, 6, 8, 1, 25, 56) fem-convergence-cpp 12.1327 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 8, 1, 25, 58) fem-jit-python 0.0010324 "JIT compilation (in memory cache)"
+(2013, 6, 8, 1, 31, 2) fem-speedup-cpp 304.169 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 8, 1, 31, 2) fem-speedup-cpp-assembly 6.56678 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 8, 1, 31, 2) fem-speedup-cpp-solve 2.25447 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 8, 1, 31, 24) mesh-refinement-cpp 19.856 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 8, 1, 31, 43) mesh-topology-cpp 19.3393 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 8, 1, 32, 7) mesh-unitcube-cpp 23.9121 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 8, 1, 32, 49) mesh-iteration-cpp 39.1578 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 8, 1, 33, 10) function-evaluation-cpp 21.5966 "Evaluations of functions at arbitrary points."
+(2013, 6, 8, 1, 33, 10) function-evaluation-cpp 21.4718 "Evaluations of functions at arbitrary points."
+(2013, 6, 8, 1, 33, 15) function-extrapolation-python 4.53625 "*** -------------------------------------------------------------------------"
+(2013, 6, 8, 1, 33, 15) function-extrapolation-python 2.13548 "*** -------------------------------------------------------------------------"
+(2013, 6, 8, 1, 33, 42) la-vector-access-cpp 27.0107 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 8, 1, 34, 7) la-vector-assignment-cpp 25.085 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 9, 1, 22, 31) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.02184 "Running DOLFIN bench"
+(2013, 6, 9, 1, 22, 32) geometry-bounding_box_tree_compute_closest_entity-cpp 0.244613 "Running DOLFIN bench"
+(2013, 6, 9, 1, 22, 41) geometry-bounding_box_tree_build-cpp 8.95586 "Running DOLFIN bench"
+(2013, 6, 9, 1, 23, 9) common-progress-cpp 27.6507 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 9, 1, 23, 37) common-timing-cpp 28.906 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 9, 1, 25, 24) fem-multicore-cpp 106.276 "Coloring mesh."
+(2013, 6, 9, 1, 27, 53) fem-assembly-cpp 148.887 "Assembly for various forms and backends"
+(2013, 6, 9, 1, 28, 5) fem-convergence-cpp 12.1382 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 9, 1, 28, 7) fem-jit-python 0.00104301 "JIT compilation (in memory cache)"
+(2013, 6, 9, 1, 33, 17) fem-speedup-cpp 310.704 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 9, 1, 33, 17) fem-speedup-cpp-assembly 6.53361 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 9, 1, 33, 17) fem-speedup-cpp-solve 2.23057 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 9, 1, 33, 39) mesh-refinement-cpp 19.888 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 9, 1, 33, 59) mesh-topology-cpp 19.5623 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 9, 1, 34, 23) mesh-unitcube-cpp 23.926 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 9, 1, 35, 1) mesh-iteration-cpp 35.4889 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 9, 1, 35, 22) function-evaluation-cpp 21.3549 "Evaluations of functions at arbitrary points."
+(2013, 6, 9, 1, 35, 22) function-evaluation-cpp 21.2372 "Evaluations of functions at arbitrary points."
+(2013, 6, 9, 1, 35, 27) function-extrapolation-python 4.56941 "*** -------------------------------------------------------------------------"
+(2013, 6, 9, 1, 35, 27) function-extrapolation-python 2.10789 "*** -------------------------------------------------------------------------"
+(2013, 6, 9, 1, 35, 53) la-vector-access-cpp 26.7159 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 9, 1, 36, 19) la-vector-assignment-cpp 25.0904 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 10, 1, 20, 3) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.0468 "Running DOLFIN bench"
+(2013, 6, 10, 1, 20, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 0.24488 "Running DOLFIN bench"
+(2013, 6, 10, 1, 20, 13) geometry-bounding_box_tree_build-cpp 8.95046 "Running DOLFIN bench"
+(2013, 6, 10, 1, 20, 40) common-progress-cpp 27.6524 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 10, 1, 21, 10) common-timing-cpp 29.6591 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 10, 1, 22, 57) fem-multicore-cpp 107.124 "Coloring mesh."
+(2013, 6, 10, 1, 25, 26) fem-assembly-cpp 148.408 "Assembly for various forms and backends"
+(2013, 6, 10, 1, 25, 38) fem-convergence-cpp 12.1444 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 10, 1, 25, 40) fem-jit-python 0.00103419 "JIT compilation (in memory cache)"
+(2013, 6, 10, 1, 30, 44) fem-speedup-cpp 304.582 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 10, 1, 30, 44) fem-speedup-cpp-assembly 6.54888 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 10, 1, 30, 44) fem-speedup-cpp-solve 2.2433 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 10, 1, 31, 6) mesh-refinement-cpp 19.8181 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 10, 1, 31, 25) mesh-topology-cpp 19.3632 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 10, 1, 31, 49) mesh-unitcube-cpp 23.8818 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 10, 1, 32, 27) mesh-iteration-cpp 35.4235 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 10, 1, 32, 49) function-evaluation-cpp 21.4318 "Evaluations of functions at arbitrary points."
+(2013, 6, 10, 1, 32, 49) function-evaluation-cpp 21.3466 "Evaluations of functions at arbitrary points."
+(2013, 6, 10, 1, 32, 53) function-extrapolation-python 4.49854 "*** -------------------------------------------------------------------------"
+(2013, 6, 10, 1, 32, 53) function-extrapolation-python 2.10525 "*** -------------------------------------------------------------------------"
+(2013, 6, 10, 1, 33, 20) la-vector-access-cpp 26.6579 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 10, 1, 33, 45) la-vector-assignment-cpp 25.0978 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 11, 1, 19, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.0324 "Running DOLFIN bench"
+(2013, 6, 11, 1, 19, 44) geometry-bounding_box_tree_compute_closest_entity-cpp 0.246274 "Running DOLFIN bench"
+(2013, 6, 11, 1, 19, 53) geometry-bounding_box_tree_build-cpp 8.97825 "Running DOLFIN bench"
+(2013, 6, 11, 1, 20, 21) common-progress-cpp 27.6511 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 11, 1, 20, 50) common-timing-cpp 29.1142 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 11, 1, 22, 36) fem-multicore-cpp 106.106 "Coloring mesh."
+(2013, 6, 11, 1, 25, 6) fem-assembly-cpp 149.317 "Assembly for various forms and backends"
+(2013, 6, 11, 1, 25, 18) fem-convergence-cpp 12.1185 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 11, 1, 25, 20) fem-jit-python 0.00104868 "JIT compilation (in memory cache)"
+(2013, 6, 11, 1, 30, 25) fem-speedup-cpp 305.527 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 11, 1, 30, 25) fem-speedup-cpp-assembly 6.51268 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 11, 1, 30, 25) fem-speedup-cpp-solve 2.32068 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 11, 1, 30, 46) mesh-refinement-cpp 19.8779 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 11, 1, 31, 5) mesh-topology-cpp 19.3061 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 11, 1, 31, 29) mesh-unitcube-cpp 23.9519 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 11, 1, 32, 7) mesh-iteration-cpp 35.4795 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 11, 1, 32, 28) function-evaluation-cpp 21.1894 "Evaluations of functions at arbitrary points."
+(2013, 6, 11, 1, 32, 28) function-evaluation-cpp 21.0572 "Evaluations of functions at arbitrary points."
+(2013, 6, 11, 1, 32, 33) function-extrapolation-python 4.55296 "*** -------------------------------------------------------------------------"
+(2013, 6, 11, 1, 32, 33) function-extrapolation-python 2.12619 "*** -------------------------------------------------------------------------"
+(2013, 6, 11, 1, 33, 0) la-vector-access-cpp 26.7174 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 11, 1, 33, 25) la-vector-assignment-cpp 25.0665 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 12, 1, 20, 58) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.0526 "Running DOLFIN bench"
+(2013, 6, 12, 1, 20, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 0.247519 "Running DOLFIN bench"
+(2013, 6, 12, 1, 21, 8) geometry-bounding_box_tree_build-cpp 8.97001 "Running DOLFIN bench"
+(2013, 6, 12, 1, 21, 36) common-progress-cpp 27.6509 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 12, 1, 22, 5) common-timing-cpp 29.1896 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 12, 1, 23, 52) fem-multicore-cpp 106.902 "Coloring mesh."
+(2013, 6, 12, 1, 26, 21) fem-assembly-cpp 149.272 "Assembly for various forms and backends"
+(2013, 6, 12, 1, 26, 33) fem-convergence-cpp 12.1211 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 12, 1, 26, 35) fem-jit-python 0.00102742 "JIT compilation (in memory cache)"
+(2013, 6, 12, 1, 31, 39) fem-speedup-cpp 303.354 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 12, 1, 31, 39) fem-speedup-cpp-assembly 6.51311 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 12, 1, 31, 39) fem-speedup-cpp-solve 2.35757 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 12, 1, 32, 0) mesh-refinement-cpp 19.9212 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 12, 1, 32, 19) mesh-topology-cpp 19.3652 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 12, 1, 32, 43) mesh-unitcube-cpp 23.9507 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 12, 1, 33, 21) mesh-iteration-cpp 35.4818 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 12, 1, 33, 42) function-evaluation-cpp 21.2842 "Evaluations of functions at arbitrary points."
+(2013, 6, 12, 1, 33, 42) function-evaluation-cpp 21.2095 "Evaluations of functions at arbitrary points."
+(2013, 6, 12, 1, 33, 47) function-extrapolation-python 4.43415 "*** -------------------------------------------------------------------------"
+(2013, 6, 12, 1, 33, 47) function-extrapolation-python 2.10769 "*** -------------------------------------------------------------------------"
+(2013, 6, 12, 1, 34, 13) la-vector-access-cpp 26.6957 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 12, 1, 34, 38) la-vector-assignment-cpp 25.0686 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 13, 1, 19, 34) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.00226 "Running DOLFIN bench"
+(2013, 6, 13, 1, 19, 35) geometry-bounding_box_tree_compute_closest_entity-cpp 0.245903 "Running DOLFIN bench"
+(2013, 6, 13, 1, 19, 44) geometry-bounding_box_tree_build-cpp 8.97117 "Running DOLFIN bench"
+(2013, 6, 13, 1, 20, 12) common-progress-cpp 27.6528 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 13, 1, 20, 41) common-timing-cpp 28.9743 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 13, 1, 22, 27) fem-multicore-cpp 106.276 "Coloring mesh."
+(2013, 6, 13, 1, 24, 55) fem-assembly-cpp 148.083 "Assembly for various forms and backends"
+(2013, 6, 13, 1, 25, 7) fem-convergence-cpp 12.1385 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 13, 1, 25, 26) fem-jit-python 0.0011157 "JIT compilation (in memory cache)"
+(2013, 6, 13, 1, 30, 32) fem-speedup-cpp 305.62 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 13, 1, 30, 32) fem-speedup-cpp-assembly 6.54277 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 13, 1, 30, 32) fem-speedup-cpp-solve 2.31912 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 13, 1, 30, 53) mesh-refinement-cpp 19.8245 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 13, 1, 31, 12) mesh-topology-cpp 19.2943 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 13, 1, 31, 36) mesh-unitcube-cpp 23.908 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 13, 1, 32, 14) mesh-iteration-cpp 35.4946 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 13, 1, 32, 36) function-evaluation-cpp 21.1554 "Evaluations of functions at arbitrary points."
+(2013, 6, 13, 1, 32, 36) function-evaluation-cpp 21.0298 "Evaluations of functions at arbitrary points."
+(2013, 6, 13, 1, 33, 32) function-extrapolation-python 56.0351 "*** -------------------------------------------------------------------------"
+(2013, 6, 13, 1, 33, 32) function-extrapolation-python 1.09231 "*** -------------------------------------------------------------------------"
+(2013, 6, 13, 1, 33, 58) la-vector-access-cpp 26.6967 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 13, 1, 34, 23) la-vector-assignment-cpp 25.1072 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 14, 1, 21, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.02256 "Running DOLFIN bench"
+(2013, 6, 14, 1, 21, 38) geometry-bounding_box_tree_compute_closest_entity-cpp 0.243262 "Running DOLFIN bench"
+(2013, 6, 14, 1, 21, 47) geometry-bounding_box_tree_build-cpp 8.96069 "Running DOLFIN bench"
+(2013, 6, 14, 1, 22, 14) common-progress-cpp 27.65 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 14, 1, 22, 44) common-timing-cpp 29.3873 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 14, 1, 24, 30) fem-multicore-cpp 106.398 "Coloring mesh."
+(2013, 6, 14, 1, 27, 0) fem-assembly-cpp 149.471 "Assembly for various forms and backends"
+(2013, 6, 14, 1, 27, 12) fem-convergence-cpp 12.1346 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 14, 1, 27, 14) fem-jit-python 0.0010407 "JIT compilation (in memory cache)"
+(2013, 6, 14, 1, 32, 17) fem-speedup-cpp 303.655 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 14, 1, 32, 17) fem-speedup-cpp-assembly 6.52897 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 14, 1, 32, 17) fem-speedup-cpp-solve 2.34996 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 14, 1, 32, 38) mesh-refinement-cpp 19.8584 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 14, 1, 32, 57) mesh-topology-cpp 19.3516 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 14, 1, 33, 21) mesh-unitcube-cpp 24.0054 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 14, 1, 33, 59) mesh-iteration-cpp 35.495 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 14, 1, 34, 21) function-evaluation-cpp 21.1744 "Evaluations of functions at arbitrary points."
+(2013, 6, 14, 1, 34, 21) function-evaluation-cpp 21.1004 "Evaluations of functions at arbitrary points."
+(2013, 6, 14, 1, 34, 24) function-extrapolation-python 3.32842 "*** -------------------------------------------------------------------------"
+(2013, 6, 14, 1, 34, 24) function-extrapolation-python 1.0946 "*** -------------------------------------------------------------------------"
+(2013, 6, 14, 1, 34, 52) la-vector-access-cpp 28.6016 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 14, 1, 35, 20) la-vector-assignment-cpp 27.0824 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 15, 1, 24, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.00732 "Running DOLFIN bench"
+(2013, 6, 15, 1, 24, 43) geometry-bounding_box_tree_compute_closest_entity-cpp 0.245619 "Running DOLFIN bench"
+(2013, 6, 15, 1, 24, 52) geometry-bounding_box_tree_build-cpp 8.95958 "Running DOLFIN bench"
+(2013, 6, 15, 1, 25, 20) common-progress-cpp 27.6515 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 15, 1, 25, 49) common-timing-cpp 29.1221 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 15, 1, 27, 36) fem-multicore-cpp 106.553 "Coloring mesh."
+(2013, 6, 15, 1, 30, 4) fem-assembly-cpp 148.474 "Assembly for various forms and backends"
+(2013, 6, 15, 1, 30, 16) fem-convergence-cpp 12.1375 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 15, 1, 30, 18) fem-jit-python 0.00101709 "JIT compilation (in memory cache)"
+(2013, 6, 15, 1, 35, 21) fem-speedup-cpp 302.668 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 15, 1, 35, 21) fem-speedup-cpp-assembly 6.54733 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 15, 1, 35, 21) fem-speedup-cpp-solve 2.38717 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 15, 1, 35, 42) mesh-refinement-cpp 19.8638 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 15, 1, 36, 1) mesh-topology-cpp 19.2633 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 15, 1, 36, 25) mesh-unitcube-cpp 24.0531 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 15, 1, 37, 3) mesh-iteration-cpp 35.4788 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 15, 1, 37, 24) function-evaluation-cpp 21.1652 "Evaluations of functions at arbitrary points."
+(2013, 6, 15, 1, 37, 24) function-evaluation-cpp 21.0717 "Evaluations of functions at arbitrary points."
+(2013, 6, 15, 1, 37, 28) function-extrapolation-python 3.41584 "*** -------------------------------------------------------------------------"
+(2013, 6, 15, 1, 37, 28) function-extrapolation-python 1.08063 "*** -------------------------------------------------------------------------"
+(2013, 6, 15, 1, 37, 54) la-vector-access-cpp 26.699 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 15, 1, 38, 19) la-vector-assignment-cpp 25.0603 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 16, 1, 21, 3) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.00694 "Running DOLFIN bench"
+(2013, 6, 16, 1, 21, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 0.244941 "Running DOLFIN bench"
+(2013, 6, 16, 1, 21, 14) geometry-bounding_box_tree_build-cpp 8.95179 "Running DOLFIN bench"
+(2013, 6, 16, 1, 21, 41) common-progress-cpp 27.7328 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 16, 1, 22, 11) common-timing-cpp 29.8826 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 16, 1, 23, 58) fem-multicore-cpp 106.802 "Coloring mesh."
+(2013, 6, 16, 1, 26, 27) fem-assembly-cpp 149.307 "Assembly for various forms and backends"
+(2013, 6, 16, 1, 26, 39) fem-convergence-cpp 12.1309 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 16, 1, 26, 41) fem-jit-python 0.00104001 "JIT compilation (in memory cache)"
+(2013, 6, 16, 1, 31, 46) fem-speedup-cpp 304.33 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 16, 1, 31, 46) fem-speedup-cpp-assembly 6.56543 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 16, 1, 31, 46) fem-speedup-cpp-solve 2.32645 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 16, 1, 32, 6) mesh-refinement-cpp 19.8714 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 16, 1, 32, 26) mesh-topology-cpp 19.1904 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 16, 1, 32, 50) mesh-unitcube-cpp 24.0324 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 16, 1, 33, 28) mesh-iteration-cpp 35.4825 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 16, 1, 33, 49) function-evaluation-cpp 21.1587 "Evaluations of functions at arbitrary points."
+(2013, 6, 16, 1, 33, 49) function-evaluation-cpp 21.0778 "Evaluations of functions at arbitrary points."
+(2013, 6, 16, 1, 33, 52) function-extrapolation-python 3.47736 "*** -------------------------------------------------------------------------"
+(2013, 6, 16, 1, 33, 52) function-extrapolation-python 1.09515 "*** -------------------------------------------------------------------------"
+(2013, 6, 16, 1, 34, 18) la-vector-access-cpp 26.1826 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 16, 1, 34, 46) la-vector-assignment-cpp 27.1088 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 17, 1, 20, 11) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.01547 "Running DOLFIN bench"
+(2013, 6, 17, 1, 20, 13) geometry-bounding_box_tree_compute_closest_entity-cpp 0.244685 "Running DOLFIN bench"
+(2013, 6, 17, 1, 20, 21) geometry-bounding_box_tree_build-cpp 8.93985 "Running DOLFIN bench"
+(2013, 6, 17, 1, 20, 49) common-progress-cpp 27.6513 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 17, 1, 21, 18) common-timing-cpp 29.1432 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 17, 1, 23, 4) fem-multicore-cpp 106.193 "Coloring mesh."
+(2013, 6, 17, 1, 25, 34) fem-assembly-cpp 149.157 "Assembly for various forms and backends"
+(2013, 6, 17, 1, 25, 46) fem-convergence-cpp 12.1364 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 17, 1, 25, 48) fem-jit-python 0.0010232 "JIT compilation (in memory cache)"
+(2013, 6, 17, 1, 30, 51) fem-speedup-cpp 303.697 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 17, 1, 30, 51) fem-speedup-cpp-assembly 6.5317 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 17, 1, 30, 51) fem-speedup-cpp-solve 2.3499 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 17, 1, 31, 12) mesh-refinement-cpp 19.8781 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 17, 1, 31, 31) mesh-topology-cpp 19.2823 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 17, 1, 31, 55) mesh-unitcube-cpp 23.9485 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 17, 1, 32, 33) mesh-iteration-cpp 35.4873 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 17, 1, 32, 55) function-evaluation-cpp 21.1531 "Evaluations of functions at arbitrary points."
+(2013, 6, 17, 1, 32, 55) function-evaluation-cpp 21.0757 "Evaluations of functions at arbitrary points."
+(2013, 6, 17, 1, 32, 58) function-extrapolation-python 3.47327 "*** -------------------------------------------------------------------------"
+(2013, 6, 17, 1, 32, 58) function-extrapolation-python 1.06724 "*** -------------------------------------------------------------------------"
+(2013, 6, 17, 1, 33, 24) la-vector-access-cpp 26.1886 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 17, 1, 33, 52) la-vector-assignment-cpp 27.5728 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 18, 1, 20, 2) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.03107 "Running DOLFIN bench"
+(2013, 6, 18, 1, 20, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 0.246672 "Running DOLFIN bench"
+(2013, 6, 18, 1, 20, 12) geometry-bounding_box_tree_build-cpp 8.94435 "Running DOLFIN bench"
+(2013, 6, 18, 1, 20, 40) common-progress-cpp 27.6514 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 18, 1, 21, 9) common-timing-cpp 29.2873 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 18, 1, 22, 56) fem-multicore-cpp 106.936 "Coloring mesh."
+(2013, 6, 18, 1, 25, 25) fem-assembly-cpp 149.183 "Assembly for various forms and backends"
+(2013, 6, 18, 1, 25, 37) fem-convergence-cpp 12.1295 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 18, 1, 25, 39) fem-jit-python 0.00102999 "JIT compilation (in memory cache)"
+(2013, 6, 18, 1, 30, 43) fem-speedup-cpp 304.447 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 18, 1, 30, 43) fem-speedup-cpp-assembly 6.55596 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 18, 1, 30, 43) fem-speedup-cpp-solve 2.32533 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 18, 1, 31, 4) mesh-refinement-cpp 19.8619 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 18, 1, 31, 24) mesh-topology-cpp 19.3972 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 18, 1, 31, 48) mesh-unitcube-cpp 23.9717 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 18, 1, 32, 26) mesh-iteration-cpp 35.4805 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 18, 1, 32, 47) function-evaluation-cpp 21.1808 "Evaluations of functions at arbitrary points."
+(2013, 6, 18, 1, 32, 47) function-evaluation-cpp 21.075 "Evaluations of functions at arbitrary points."
+(2013, 6, 18, 1, 32, 50) function-extrapolation-python 3.52044 "*** -------------------------------------------------------------------------"
+(2013, 6, 18, 1, 32, 50) function-extrapolation-python 1.07925 "*** -------------------------------------------------------------------------"
+(2013, 6, 18, 1, 33, 17) la-vector-access-cpp 26.7025 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 18, 1, 33, 44) la-vector-assignment-cpp 27.0588 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 19, 1, 22, 58) geometry-bounding_box_tree_compute_entity_collisions-cpp 1.9954 "Running DOLFIN bench"
+(2013, 6, 19, 1, 22, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 0.245347 "Running DOLFIN bench"
+(2013, 6, 19, 1, 23, 8) geometry-bounding_box_tree_build-cpp 8.94959 "Running DOLFIN bench"
+(2013, 6, 19, 1, 23, 35) common-progress-cpp 27.6504 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 19, 1, 24, 6) common-timing-cpp 30.2021 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 19, 1, 25, 52) fem-multicore-cpp 106.283 "Coloring mesh."
+(2013, 6, 19, 1, 28, 21) fem-assembly-cpp 148.838 "Assembly for various forms and backends"
+(2013, 6, 19, 1, 28, 33) fem-convergence-cpp 12.1174 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 19, 1, 28, 35) fem-jit-python 0.00101779 "JIT compilation (in memory cache)"
+(2013, 6, 19, 1, 33, 41) fem-speedup-cpp 306.198 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 19, 1, 33, 41) fem-speedup-cpp-assembly 6.49712 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 19, 1, 33, 41) fem-speedup-cpp-solve 2.24618 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 19, 1, 34, 3) mesh-refinement-cpp 19.8246 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 19, 1, 34, 22) mesh-topology-cpp 19.2895 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 19, 1, 34, 46) mesh-unitcube-cpp 23.931 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 19, 1, 35, 24) mesh-iteration-cpp 35.463 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 19, 1, 35, 46) function-evaluation-cpp 21.6718 "Evaluations of functions at arbitrary points."
+(2013, 6, 19, 1, 35, 46) function-evaluation-cpp 21.5515 "Evaluations of functions at arbitrary points."
+(2013, 6, 19, 1, 35, 49) function-extrapolation-python 3.42869 "*** -------------------------------------------------------------------------"
+(2013, 6, 19, 1, 35, 49) function-extrapolation-python 1.072 "*** -------------------------------------------------------------------------"
+(2013, 6, 19, 1, 36, 18) la-vector-access-cpp 28.5933 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 19, 1, 36, 43) la-vector-assignment-cpp 25.0884 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 20, 1, 19, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.04821 "Running DOLFIN bench"
+(2013, 6, 20, 1, 19, 34) geometry-bounding_box_tree_compute_closest_entity-cpp 0.247757 "Running DOLFIN bench"
+(2013, 6, 20, 1, 19, 43) geometry-bounding_box_tree_build-cpp 8.94202 "Running DOLFIN bench"
+(2013, 6, 20, 1, 20, 10) common-progress-cpp 27.6682 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 20, 1, 20, 39) common-timing-cpp 29.0679 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 20, 1, 22, 26) fem-multicore-cpp 106.75 "Coloring mesh."
+(2013, 6, 20, 1, 24, 56) fem-assembly-cpp 150.162 "Assembly for various forms and backends"
+(2013, 6, 20, 1, 25, 8) fem-convergence-cpp 12.1359 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 20, 1, 25, 10) fem-jit-python 0.00104589 "JIT compilation (in memory cache)"
+(2013, 6, 20, 1, 30, 16) fem-speedup-cpp 305.57 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 20, 1, 30, 16) fem-speedup-cpp-assembly 6.59022 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 20, 1, 30, 16) fem-speedup-cpp-solve 2.30706 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 20, 1, 30, 37) mesh-refinement-cpp 19.9497 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 20, 1, 30, 56) mesh-topology-cpp 19.2791 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 20, 1, 31, 20) mesh-unitcube-cpp 23.703 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 20, 1, 31, 58) mesh-iteration-cpp 35.6198 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 20, 1, 32, 19) function-evaluation-cpp 21.1828 "Evaluations of functions at arbitrary points."
+(2013, 6, 20, 1, 32, 19) function-evaluation-cpp 21.0847 "Evaluations of functions at arbitrary points."
+(2013, 6, 20, 1, 32, 23) function-extrapolation-python 3.48642 "*** -------------------------------------------------------------------------"
+(2013, 6, 20, 1, 32, 23) function-extrapolation-python 1.07007 "*** -------------------------------------------------------------------------"
+(2013, 6, 20, 1, 32, 49) la-vector-access-cpp 26.6633 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 20, 1, 33, 14) la-vector-assignment-cpp 25.0629 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 21, 1, 20, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.00255 "Running DOLFIN bench"
+(2013, 6, 21, 1, 20, 33) geometry-bounding_box_tree_compute_closest_entity-cpp 0.241965 "Running DOLFIN bench"
+(2013, 6, 21, 1, 20, 42) geometry-bounding_box_tree_build-cpp 8.91783 "Running DOLFIN bench"
+(2013, 6, 21, 1, 21, 10) common-progress-cpp 27.6518 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 21, 1, 21, 39) common-timing-cpp 29.6996 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 21, 1, 23, 26) fem-multicore-cpp 106.675 "Coloring mesh."
+(2013, 6, 21, 1, 25, 56) fem-assembly-cpp 149.796 "Assembly for various forms and backends"
+(2013, 6, 21, 1, 26, 8) fem-convergence-cpp 12.1228 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 21, 1, 26, 10) fem-jit-python 0.00104182 "JIT compilation (in memory cache)"
+(2013, 6, 21, 1, 31, 14) fem-speedup-cpp 304.175 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 21, 1, 31, 14) fem-speedup-cpp-assembly 6.52679 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 21, 1, 31, 14) fem-speedup-cpp-solve 2.35608 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 21, 1, 31, 35) mesh-refinement-cpp 19.9568 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 21, 1, 31, 54) mesh-topology-cpp 19.2496 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 21, 1, 32, 18) mesh-unitcube-cpp 23.7255 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 21, 1, 32, 56) mesh-iteration-cpp 35.5501 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 21, 1, 33, 17) function-evaluation-cpp 21.2465 "Evaluations of functions at arbitrary points."
+(2013, 6, 21, 1, 33, 17) function-evaluation-cpp 21.0945 "Evaluations of functions at arbitrary points."
+(2013, 6, 21, 1, 33, 20) function-extrapolation-python 3.34933 "*** -------------------------------------------------------------------------"
+(2013, 6, 21, 1, 33, 20) function-extrapolation-python 1.07003 "*** -------------------------------------------------------------------------"
+(2013, 6, 21, 1, 33, 47) la-vector-access-cpp 26.6105 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 21, 1, 34, 12) la-vector-assignment-cpp 25.0683 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 22, 1, 19, 31) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.0347 "Running DOLFIN bench"
+(2013, 6, 22, 1, 19, 32) geometry-bounding_box_tree_compute_closest_entity-cpp 0.247956 "Running DOLFIN bench"
+(2013, 6, 22, 1, 19, 41) geometry-bounding_box_tree_build-cpp 8.91841 "Running DOLFIN bench"
+(2013, 6, 22, 1, 20, 8) common-progress-cpp 27.6515 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 22, 1, 20, 38) common-timing-cpp 29.363 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 22, 1, 22, 24) fem-multicore-cpp 106.15 "Coloring mesh."
+(2013, 6, 22, 1, 24, 54) fem-assembly-cpp 150.281 "Assembly for various forms and backends"
+(2013, 6, 22, 1, 25, 6) fem-convergence-cpp 12.1131 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 22, 1, 25, 8) fem-jit-python 0.0010313 "JIT compilation (in memory cache)"
+(2013, 6, 22, 1, 30, 12) fem-speedup-cpp 304.27 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 22, 1, 30, 12) fem-speedup-cpp-assembly 6.65971 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 22, 1, 30, 12) fem-speedup-cpp-solve 2.34752 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 22, 1, 30, 33) mesh-refinement-cpp 19.977 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 22, 1, 30, 53) mesh-topology-cpp 19.3671 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 22, 1, 31, 16) mesh-unitcube-cpp 23.7933 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 22, 1, 31, 54) mesh-iteration-cpp 35.5379 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 22, 1, 32, 16) function-evaluation-cpp 21.1421 "Evaluations of functions at arbitrary points."
+(2013, 6, 22, 1, 32, 16) function-evaluation-cpp 21.0617 "Evaluations of functions at arbitrary points."
+(2013, 6, 22, 1, 32, 19) function-extrapolation-python 3.48722 "*** -------------------------------------------------------------------------"
+(2013, 6, 22, 1, 32, 19) function-extrapolation-python 1.06074 "*** -------------------------------------------------------------------------"
+(2013, 6, 22, 1, 32, 46) la-vector-access-cpp 26.6689 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 22, 1, 33, 11) la-vector-assignment-cpp 25.0185 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 23, 1, 20, 24) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.04981 "Running DOLFIN bench"
+(2013, 6, 23, 1, 20, 25) geometry-bounding_box_tree_compute_closest_entity-cpp 0.251087 "Running DOLFIN bench"
+(2013, 6, 23, 1, 20, 34) geometry-bounding_box_tree_build-cpp 8.91578 "Running DOLFIN bench"
+(2013, 6, 23, 1, 21, 1) common-progress-cpp 27.6709 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 23, 1, 21, 30) common-timing-cpp 29.0022 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 23, 1, 23, 18) fem-multicore-cpp 107.152 "Coloring mesh."
+(2013, 6, 23, 1, 25, 48) fem-assembly-cpp 150.594 "Assembly for various forms and backends"
+(2013, 6, 23, 1, 26, 0) fem-convergence-cpp 12.1143 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 23, 1, 26, 2) fem-jit-python 0.00102971 "JIT compilation (in memory cache)"
+(2013, 6, 23, 1, 31, 9) fem-speedup-cpp 306.745 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 23, 1, 31, 9) fem-speedup-cpp-assembly 6.60189 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 23, 1, 31, 9) fem-speedup-cpp-solve 2.2781 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 23, 1, 31, 30) mesh-refinement-cpp 19.9 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 23, 1, 31, 49) mesh-topology-cpp 19.3828 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 23, 1, 32, 13) mesh-unitcube-cpp 23.6912 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 23, 1, 32, 51) mesh-iteration-cpp 35.542 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 23, 1, 33, 12) function-evaluation-cpp 21.392 "Evaluations of functions at arbitrary points."
+(2013, 6, 23, 1, 33, 12) function-evaluation-cpp 21.2975 "Evaluations of functions at arbitrary points."
+(2013, 6, 23, 1, 33, 16) function-extrapolation-python 3.52865 "*** -------------------------------------------------------------------------"
+(2013, 6, 23, 1, 33, 16) function-extrapolation-python 1.06646 "*** -------------------------------------------------------------------------"
+(2013, 6, 23, 1, 33, 43) la-vector-access-cpp 26.6464 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 23, 1, 34, 8) la-vector-assignment-cpp 25.0864 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 24, 1, 22, 5) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.02357 "Running DOLFIN bench"
+(2013, 6, 24, 1, 22, 6) geometry-bounding_box_tree_compute_closest_entity-cpp 0.252157 "Running DOLFIN bench"
+(2013, 6, 24, 1, 22, 15) geometry-bounding_box_tree_build-cpp 8.92266 "Running DOLFIN bench"
+(2013, 6, 24, 1, 22, 43) common-progress-cpp 27.6514 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 24, 1, 23, 12) common-timing-cpp 29.4971 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 24, 1, 24, 59) fem-multicore-cpp 106.448 "Coloring mesh."
+(2013, 6, 24, 1, 27, 28) fem-assembly-cpp 149.021 "Assembly for various forms and backends"
+(2013, 6, 24, 1, 27, 40) fem-convergence-cpp 12.0973 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 24, 1, 27, 42) fem-jit-python 0.0010267 "JIT compilation (in memory cache)"
+(2013, 6, 24, 1, 32, 47) fem-speedup-cpp 305.462 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 24, 1, 32, 47) fem-speedup-cpp-assembly 6.57214 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 24, 1, 32, 47) fem-speedup-cpp-solve 2.30769 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 24, 1, 33, 8) mesh-refinement-cpp 19.841 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 24, 1, 33, 27) mesh-topology-cpp 19.2275 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 24, 1, 33, 51) mesh-unitcube-cpp 23.7731 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 24, 1, 34, 38) mesh-iteration-cpp 44.1729 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 24, 1, 34, 59) function-evaluation-cpp 21.1377 "Evaluations of functions at arbitrary points."
+(2013, 6, 24, 1, 34, 59) function-evaluation-cpp 21.0585 "Evaluations of functions at arbitrary points."
+(2013, 6, 24, 1, 35, 3) function-extrapolation-python 3.44717 "*** -------------------------------------------------------------------------"
+(2013, 6, 24, 1, 35, 3) function-extrapolation-python 1.06254 "*** -------------------------------------------------------------------------"
+(2013, 6, 24, 1, 35, 29) la-vector-access-cpp 26.6648 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 24, 1, 36, 21) la-vector-assignment-cpp 51.9926 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 25, 1, 24, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 2.01368 "Running DOLFIN bench"
+(2013, 6, 25, 1, 24, 37) geometry-bounding_box_tree_compute_closest_entity-cpp 0.249098 "Running DOLFIN bench"
+(2013, 6, 25, 1, 24, 46) geometry-bounding_box_tree_build-cpp 8.94414 "Running DOLFIN bench"
+(2013, 6, 25, 1, 25, 13) common-progress-cpp 27.6515 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 25, 1, 25, 43) common-timing-cpp 29.6993 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 25, 1, 27, 29) fem-multicore-cpp 106.12 "Coloring mesh."
+(2013, 6, 25, 1, 29, 58) fem-assembly-cpp 148.979 "Assembly for various forms and backends"
+(2013, 6, 25, 1, 30, 10) fem-convergence-cpp 12.1281 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 25, 1, 30, 12) fem-jit-python 0.00102642 "JIT compilation (in memory cache)"
+(2013, 6, 25, 1, 35, 17) fem-speedup-cpp 304.555 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 25, 1, 35, 17) fem-speedup-cpp-assembly 6.56854 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 25, 1, 35, 17) fem-speedup-cpp-solve 2.3434 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 25, 1, 35, 38) mesh-refinement-cpp 19.9316 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 25, 1, 35, 57) mesh-topology-cpp 19.2516 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 25, 1, 36, 21) mesh-unitcube-cpp 23.7794 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 25, 1, 36, 59) mesh-iteration-cpp 35.482 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 25, 1, 37, 23) function-evaluation-cpp 23.8374 "Evaluations of functions at arbitrary points."
+(2013, 6, 25, 1, 37, 23) function-evaluation-cpp 23.7472 "Evaluations of functions at arbitrary points."
+(2013, 6, 25, 1, 37, 26) function-extrapolation-python 3.43714 "*** -------------------------------------------------------------------------"
+(2013, 6, 25, 1, 37, 26) function-extrapolation-python 1.06803 "*** -------------------------------------------------------------------------"
+(2013, 6, 25, 1, 37, 53) la-vector-access-cpp 26.6494 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 25, 1, 38, 18) la-vector-assignment-cpp 25.0626 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 26, 1, 19, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.052 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 26, 1, 19, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9759 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 26, 1, 20, 13) geometry-bounding_box_tree_build-cpp 13.9509 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 6, 26, 1, 20, 41) common-progress-cpp 27.6734 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 26, 1, 21, 10) common-timing-cpp 29.6124 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 26, 1, 22, 57) fem-multicore-cpp 106.824 "Coloring mesh."
+(2013, 6, 26, 1, 25, 26) fem-assembly-cpp 148.913 "Assembly for various forms and backends"
+(2013, 6, 26, 1, 25, 38) fem-convergence-cpp 12.0976 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 26, 1, 25, 40) fem-jit-python 0.0010273 "JIT compilation (in memory cache)"
+(2013, 6, 26, 1, 30, 45) fem-speedup-cpp 304.521 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 26, 1, 30, 45) fem-speedup-cpp-assembly 6.56625 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 26, 1, 30, 45) fem-speedup-cpp-solve 2.3378 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 26, 1, 31, 6) mesh-refinement-cpp 20.2577 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 26, 1, 31, 25) mesh-topology-cpp 19.1865 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 26, 1, 31, 49) mesh-unitcube-cpp 24.2101 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 26, 1, 32, 27) mesh-iteration-cpp 35.4874 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 26, 1, 32, 48) function-evaluation-cpp 21.142 "Evaluations of functions at arbitrary points."
+(2013, 6, 26, 1, 32, 48) function-evaluation-cpp 21.0654 "Evaluations of functions at arbitrary points."
+(2013, 6, 26, 1, 32, 52) function-extrapolation-python 3.32757 "BENCH:  1.07621788979"
+(2013, 6, 26, 1, 32, 52) function-extrapolation-python 1.07622 "BENCH:  1.07621788979"
+(2013, 6, 26, 1, 33, 5) function-interpolation-python 13.677 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2013, 6, 26, 1, 33, 5) function-interpolation-python 1.01533 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2013, 6, 26, 1, 33, 29) la-vector-access-cpp 23.4307 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 26, 1, 33, 54) la-vector-assignment-cpp 25.2351 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 27, 1, 18, 26) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1635 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 27, 1, 18, 45) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5452 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 27, 1, 19, 2) geometry-bounding_box_tree_build-cpp 13.9163 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 6, 27, 1, 19, 29) common-progress-cpp 27.6513 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 27, 1, 19, 59) common-timing-cpp 29.4253 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 27, 1, 21, 46) fem-multicore-cpp 107.207 "Coloring mesh."
+(2013, 6, 27, 1, 24, 16) fem-assembly-cpp 150.237 "Assembly for various forms and backends"
+(2013, 6, 27, 1, 24, 28) fem-convergence-cpp 12.0987 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 27, 1, 24, 30) fem-jit-python 0.00102119 "JIT compilation (in memory cache)"
+(2013, 6, 27, 1, 29, 37) fem-speedup-cpp 306.713 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 27, 1, 29, 37) fem-speedup-cpp-assembly 6.43291 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 27, 1, 29, 37) fem-speedup-cpp-solve 2.20448 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 27, 1, 29, 59) mesh-refinement-cpp 20.3919 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 27, 1, 30, 19) mesh-topology-cpp 19.2391 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 27, 1, 30, 43) mesh-unitcube-cpp 23.9996 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 27, 1, 31, 21) mesh-iteration-cpp 35.4696 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 27, 1, 31, 42) function-evaluation-cpp 21.2065 "Evaluations of functions at arbitrary points."
+(2013, 6, 27, 1, 31, 42) function-evaluation-cpp 21.109 "Evaluations of functions at arbitrary points."
+(2013, 6, 27, 1, 31, 46) function-extrapolation-python 3.39981 "BENCH:  1.04391694069"
+(2013, 6, 27, 1, 31, 46) function-extrapolation-python 1.04392 "BENCH:  1.04391694069"
+(2013, 6, 27, 1, 31, 47) function-interpolation-python 1.70294 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 6, 27, 1, 31, 47) function-interpolation-python 1.01541 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 6, 27, 1, 32, 11) la-vector-access-cpp 23.466 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 27, 1, 32, 36) la-vector-assignment-cpp 25.0813 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 28, 1, 21, 59) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.233 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 28, 1, 22, 18) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4551 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 28, 1, 22, 35) geometry-bounding_box_tree_build-cpp 13.9201 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 6, 28, 1, 23, 2) common-progress-cpp 27.6522 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 28, 1, 23, 32) common-timing-cpp 29.6371 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 28, 1, 25, 19) fem-multicore-cpp 107.22 "Coloring mesh."
+(2013, 6, 28, 1, 27, 50) fem-assembly-cpp 150.501 "Assembly for various forms and backends"
+(2013, 6, 28, 1, 28, 2) fem-convergence-cpp 12.1224 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 28, 1, 28, 4) fem-jit-python 0.0010252 "JIT compilation (in memory cache)"
+(2013, 6, 28, 1, 33, 8) fem-speedup-cpp 304.421 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 28, 1, 33, 8) fem-speedup-cpp-assembly 6.42501 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 28, 1, 33, 8) fem-speedup-cpp-solve 2.33589 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 28, 1, 33, 29) mesh-refinement-cpp 20.4394 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 28, 1, 33, 49) mesh-topology-cpp 19.1051 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 28, 1, 34, 13) mesh-unitcube-cpp 24.1013 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 28, 1, 34, 51) mesh-iteration-cpp 35.4871 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 28, 1, 35, 12) function-evaluation-cpp 21.1355 "Evaluations of functions at arbitrary points."
+(2013, 6, 28, 1, 35, 12) function-evaluation-cpp 21.0556 "Evaluations of functions at arbitrary points."
+(2013, 6, 28, 1, 35, 15) function-extrapolation-python 3.47554 "BENCH:  1.08120799065"
+(2013, 6, 28, 1, 35, 15) function-extrapolation-python 1.08121 "BENCH:  1.08120799065"
+(2013, 6, 28, 1, 35, 17) function-interpolation-python 1.73452 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 6, 28, 1, 35, 17) function-interpolation-python 1.02952 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 6, 28, 1, 35, 42) la-vector-access-cpp 24.9347 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 28, 1, 36, 7) la-vector-assignment-cpp 25.0677 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 29, 1, 20, 7) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.98778 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 29, 1, 20, 26) geometry-bounding_box_tree_compute_closest_entity-cpp 15.956 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 29, 1, 20, 42) geometry-bounding_box_tree_build-cpp 13.946 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 6, 29, 1, 21, 10) common-progress-cpp 27.6508 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 29, 1, 21, 40) common-timing-cpp 29.626 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 29, 1, 23, 26) fem-multicore-cpp 106.519 "Coloring mesh."
+(2013, 6, 29, 1, 25, 58) fem-assembly-cpp 151.622 "Assembly for various forms and backends"
+(2013, 6, 29, 1, 26, 10) fem-convergence-cpp 12.14 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 29, 1, 26, 12) fem-jit-python 0.00102689 "JIT compilation (in memory cache)"
+(2013, 6, 29, 1, 31, 17) fem-speedup-cpp 305.375 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 29, 1, 31, 17) fem-speedup-cpp-assembly 6.53872 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 29, 1, 31, 17) fem-speedup-cpp-solve 2.30211 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 29, 1, 31, 39) mesh-refinement-cpp 19.8389 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 29, 1, 31, 58) mesh-topology-cpp 19.189 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 29, 1, 32, 22) mesh-unitcube-cpp 23.8037 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 29, 1, 33, 0) mesh-iteration-cpp 35.5468 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 29, 1, 33, 21) function-evaluation-cpp 21.2393 "Evaluations of functions at arbitrary points."
+(2013, 6, 29, 1, 33, 21) function-evaluation-cpp 21.1169 "Evaluations of functions at arbitrary points."
+(2013, 6, 29, 1, 33, 25) function-extrapolation-python 3.48692 "BENCH:  1.05940794945"
+(2013, 6, 29, 1, 33, 25) function-extrapolation-python 1.05941 "BENCH:  1.05940794945"
+(2013, 6, 29, 1, 33, 27) function-interpolation-python 1.70543 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 6, 29, 1, 33, 27) function-interpolation-python 0.989151 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 6, 29, 1, 33, 50) la-vector-access-cpp 22.9622 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 29, 1, 34, 16) la-vector-assignment-cpp 26.5791 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 6, 30, 1, 18, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.94825 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 30, 1, 19, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6785 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 6, 30, 1, 19, 17) geometry-bounding_box_tree_build-cpp 13.9037 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 6, 30, 1, 19, 44) common-progress-cpp 27.6507 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 6, 30, 1, 20, 13) common-timing-cpp 29.2491 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 6, 30, 1, 22, 1) fem-multicore-cpp 107.062 "Coloring mesh."
+(2013, 6, 30, 1, 24, 32) fem-assembly-cpp 151.972 "Assembly for various forms and backends"
+(2013, 6, 30, 1, 24, 45) fem-convergence-cpp 12.1418 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 6, 30, 1, 24, 46) fem-jit-python 0.00101938 "JIT compilation (in memory cache)"
+(2013, 6, 30, 1, 29, 51) fem-speedup-cpp 304.355 "Assembly/solve speedup running on 4 processors"
+(2013, 6, 30, 1, 29, 51) fem-speedup-cpp-assembly 6.46667 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 6, 30, 1, 29, 51) fem-speedup-cpp-solve 2.29099 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 6, 30, 1, 30, 11) mesh-refinement-cpp 19.8138 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 6, 30, 1, 30, 31) mesh-topology-cpp 19.0801 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 6, 30, 1, 30, 54) mesh-unitcube-cpp 23.7084 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 6, 30, 1, 31, 32) mesh-iteration-cpp 35.5482 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 6, 30, 1, 31, 54) function-evaluation-cpp 21.3393 "Evaluations of functions at arbitrary points."
+(2013, 6, 30, 1, 31, 54) function-evaluation-cpp 21.2598 "Evaluations of functions at arbitrary points."
+(2013, 6, 30, 1, 31, 57) function-extrapolation-python 3.43798 "BENCH:  1.06357097626"
+(2013, 6, 30, 1, 31, 57) function-extrapolation-python 1.06357 "BENCH:  1.06357097626"
+(2013, 6, 30, 1, 31, 59) function-interpolation-python 1.71728 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 6, 30, 1, 31, 59) function-interpolation-python 0.988438 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 6, 30, 1, 32, 22) la-vector-access-cpp 22.9315 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 6, 30, 1, 32, 47) la-vector-assignment-cpp 25.0601 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 1, 1, 19, 29) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.94445 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 1, 1, 19, 48) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5602 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 1, 1, 20, 5) geometry-bounding_box_tree_build-cpp 13.9307 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 1, 1, 20, 32) common-progress-cpp 27.6927 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 1, 1, 21, 2) common-timing-cpp 30.2776 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 1, 1, 22, 49) fem-multicore-cpp 106.882 "Coloring mesh."
+(2013, 7, 1, 1, 25, 21) fem-assembly-cpp 151.188 "Assembly for various forms and backends"
+(2013, 7, 1, 1, 25, 33) fem-convergence-cpp 12.1325 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 1, 1, 25, 35) fem-jit-python 0.00104339 "JIT compilation (in memory cache)"
+(2013, 7, 1, 1, 30, 43) fem-speedup-cpp 308.667 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 1, 1, 30, 43) fem-speedup-cpp-assembly 6.54876 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 1, 1, 30, 43) fem-speedup-cpp-solve 2.24878 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 1, 1, 31, 5) mesh-refinement-cpp 19.8094 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 1, 1, 31, 24) mesh-topology-cpp 19.1102 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 1, 1, 31, 48) mesh-unitcube-cpp 23.6569 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 1, 1, 32, 26) mesh-iteration-cpp 35.5557 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 1, 1, 32, 48) function-evaluation-cpp 21.7388 "Evaluations of functions at arbitrary points."
+(2013, 7, 1, 1, 32, 48) function-evaluation-cpp 21.5251 "Evaluations of functions at arbitrary points."
+(2013, 7, 1, 1, 32, 51) function-extrapolation-python 3.48752 "BENCH:  1.04092788696"
+(2013, 7, 1, 1, 32, 51) function-extrapolation-python 1.04093 "BENCH:  1.04092788696"
+(2013, 7, 1, 1, 32, 53) function-interpolation-python 1.67918 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 1, 1, 32, 53) function-interpolation-python 0.988947 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 1, 1, 33, 16) la-vector-access-cpp 22.9659 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 1, 1, 33, 47) la-vector-assignment-cpp 31.0876 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 2, 1, 18, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.95872 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 2, 1, 18, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8588 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 2, 1, 19, 13) geometry-bounding_box_tree_build-cpp 13.9414 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 2, 1, 19, 41) common-progress-cpp 27.6939 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 2, 1, 20, 11) common-timing-cpp 30.0686 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 2, 1, 21, 58) fem-multicore-cpp 106.887 "Coloring mesh."
+(2013, 7, 2, 1, 24, 29) fem-assembly-cpp 150.977 "Assembly for various forms and backends"
+(2013, 7, 2, 1, 24, 41) fem-convergence-cpp 12.1506 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 2, 1, 24, 43) fem-jit-python 0.0010335 "JIT compilation (in memory cache)"
+(2013, 7, 2, 1, 29, 49) fem-speedup-cpp 305.941 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 2, 1, 29, 49) fem-speedup-cpp-assembly 6.55237 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 2, 1, 29, 49) fem-speedup-cpp-solve 2.32496 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 2, 1, 30, 10) mesh-refinement-cpp 19.8874 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 2, 1, 30, 29) mesh-topology-cpp 19.1405 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 2, 1, 30, 53) mesh-unitcube-cpp 23.6454 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 2, 1, 31, 39) mesh-iteration-cpp 43.488 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 2, 1, 32, 0) function-evaluation-cpp 21.2226 "Evaluations of functions at arbitrary points."
+(2013, 7, 2, 1, 32, 0) function-evaluation-cpp 21.0906 "Evaluations of functions at arbitrary points."
+(2013, 7, 2, 1, 32, 4) function-extrapolation-python 3.43693 "BENCH:  1.08355903625"
+(2013, 7, 2, 1, 32, 4) function-extrapolation-python 1.08356 "BENCH:  1.08355903625"
+(2013, 7, 2, 1, 32, 5) function-interpolation-python 1.68331 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 2, 1, 32, 5) function-interpolation-python 0.983895 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 2, 1, 32, 28) la-vector-access-cpp 22.9534 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 2, 1, 32, 54) la-vector-assignment-cpp 25.1391 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 3, 1, 20, 15) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0174 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 3, 1, 20, 34) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8954 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 3, 1, 20, 51) geometry-bounding_box_tree_build-cpp 13.922 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 3, 1, 21, 19) common-progress-cpp 27.6511 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 3, 1, 21, 48) common-timing-cpp 29.2757 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 3, 1, 23, 35) fem-multicore-cpp 106.784 "Coloring mesh."
+(2013, 7, 3, 1, 26, 5) fem-assembly-cpp 150.519 "Assembly for various forms and backends"
+(2013, 7, 3, 1, 26, 17) fem-convergence-cpp 12.1423 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 3, 1, 26, 19) fem-jit-python 0.00102601 "JIT compilation (in memory cache)"
+(2013, 7, 3, 1, 31, 24) fem-speedup-cpp 304.578 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 3, 1, 31, 24) fem-speedup-cpp-assembly 6.55427 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 3, 1, 31, 24) fem-speedup-cpp-solve 2.32802 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 3, 1, 31, 45) mesh-refinement-cpp 19.9214 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 3, 1, 32, 4) mesh-topology-cpp 19.0688 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 3, 1, 32, 27) mesh-unitcube-cpp 23.6578 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 3, 1, 33, 5) mesh-iteration-cpp 35.5686 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 3, 1, 33, 27) function-evaluation-cpp 21.5741 "Evaluations of functions at arbitrary points."
+(2013, 7, 3, 1, 33, 27) function-evaluation-cpp 21.4359 "Evaluations of functions at arbitrary points."
+(2013, 7, 3, 1, 33, 30) function-extrapolation-python 3.41227 "BENCH:  1.06535696983"
+(2013, 7, 3, 1, 33, 30) function-extrapolation-python 1.06536 "BENCH:  1.06535696983"
+(2013, 7, 3, 1, 33, 32) function-interpolation-python 1.69855 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 3, 1, 33, 32) function-interpolation-python 0.986731 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 3, 1, 33, 55) la-vector-access-cpp 22.9329 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 3, 1, 34, 20) la-vector-assignment-cpp 25.0666 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 4, 1, 19, 1) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.98408 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 4, 1, 19, 20) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8282 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 4, 1, 19, 37) geometry-bounding_box_tree_build-cpp 13.9292 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 4, 1, 20, 4) common-progress-cpp 27.6884 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 4, 1, 20, 33) common-timing-cpp 28.9368 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 4, 1, 22, 20) fem-multicore-cpp 107.197 "Coloring mesh."
+(2013, 7, 4, 1, 24, 51) fem-assembly-cpp 150.949 "Assembly for various forms and backends"
+(2013, 7, 4, 1, 25, 3) fem-convergence-cpp 12.1425 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 4, 1, 25, 5) fem-jit-python 0.0010258 "JIT compilation (in memory cache)"
+(2013, 7, 4, 1, 30, 10) fem-speedup-cpp 304.242 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 4, 1, 30, 10) fem-speedup-cpp-assembly 6.5339 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 4, 1, 30, 10) fem-speedup-cpp-solve 2.32998 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 4, 1, 30, 30) mesh-refinement-cpp 19.8843 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 4, 1, 30, 49) mesh-topology-cpp 19.0281 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 4, 1, 31, 13) mesh-unitcube-cpp 23.6529 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 4, 1, 32, 0) mesh-iteration-cpp 44.1699 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 4, 1, 32, 21) function-evaluation-cpp 21.2045 "Evaluations of functions at arbitrary points."
+(2013, 7, 4, 1, 32, 21) function-evaluation-cpp 21.1103 "Evaluations of functions at arbitrary points."
+(2013, 7, 4, 1, 32, 24) function-extrapolation-python 3.42298 "BENCH:  1.05984997749"
+(2013, 7, 4, 1, 32, 24) function-extrapolation-python 1.05985 "BENCH:  1.05984997749"
+(2013, 7, 4, 1, 32, 26) function-interpolation-python 1.72571 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 4, 1, 32, 26) function-interpolation-python 1.00254 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 4, 1, 32, 49) la-vector-access-cpp 22.9283 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 4, 1, 33, 16) la-vector-assignment-cpp 27.0832 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 5, 1, 22, 25) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.98344 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 5, 1, 22, 44) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7737 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 5, 1, 23, 0) geometry-bounding_box_tree_build-cpp 13.9459 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 5, 1, 23, 28) common-progress-cpp 27.6494 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 5, 1, 23, 57) common-timing-cpp 29.3252 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 5, 1, 25, 44) fem-multicore-cpp 107.175 "Coloring mesh."
+(2013, 7, 5, 1, 28, 15) fem-assembly-cpp 150.562 "Assembly for various forms and backends"
+(2013, 7, 5, 1, 28, 27) fem-convergence-cpp 12.1569 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 5, 1, 28, 29) fem-jit-python 0.00102131 "JIT compilation (in memory cache)"
+(2013, 7, 5, 1, 33, 35) fem-speedup-cpp 305.534 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 5, 1, 33, 35) fem-speedup-cpp-assembly 6.42825 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 5, 1, 33, 35) fem-speedup-cpp-solve 2.3151 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 5, 1, 33, 56) mesh-refinement-cpp 19.859 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 5, 1, 34, 15) mesh-topology-cpp 19.0733 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 5, 1, 34, 38) mesh-unitcube-cpp 23.6133 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 5, 1, 35, 17) mesh-iteration-cpp 35.9329 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 5, 1, 35, 38) function-evaluation-cpp 21.2105 "Evaluations of functions at arbitrary points."
+(2013, 7, 5, 1, 35, 38) function-evaluation-cpp 21.1304 "Evaluations of functions at arbitrary points."
+(2013, 7, 5, 1, 35, 41) function-extrapolation-python 3.40392 "BENCH:  1.05796909332"
+(2013, 7, 5, 1, 35, 41) function-extrapolation-python 1.05797 "BENCH:  1.05796909332"
+(2013, 7, 5, 1, 35, 43) function-interpolation-python 1.69202 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 5, 1, 35, 43) function-interpolation-python 0.983444 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 5, 1, 36, 6) la-vector-access-cpp 22.927 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 5, 1, 36, 34) la-vector-assignment-cpp 27.5813 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 6, 1, 21, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0943 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 6, 1, 21, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9917 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 6, 1, 22, 15) geometry-bounding_box_tree_build-cpp 13.9244 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 6, 1, 22, 42) common-progress-cpp 27.6511 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 6, 1, 23, 12) common-timing-cpp 29.9151 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 6, 1, 24, 59) fem-multicore-cpp 106.766 "Coloring mesh."
+(2013, 7, 6, 1, 27, 30) fem-assembly-cpp 151.133 "Assembly for various forms and backends"
+(2013, 7, 6, 1, 27, 42) fem-convergence-cpp 12.1484 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 6, 1, 27, 44) fem-jit-python 0.00102439 "JIT compilation (in memory cache)"
+(2013, 7, 6, 1, 32, 52) fem-speedup-cpp 307.635 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 6, 1, 32, 52) fem-speedup-cpp-assembly 6.56845 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 6, 1, 32, 52) fem-speedup-cpp-solve 2.31764 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 6, 1, 33, 14) mesh-refinement-cpp 19.841 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 6, 1, 33, 33) mesh-topology-cpp 19.0317 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 6, 1, 33, 56) mesh-unitcube-cpp 23.6101 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 6, 1, 34, 34) mesh-iteration-cpp 35.543 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 6, 1, 34, 56) function-evaluation-cpp 21.1976 "Evaluations of functions at arbitrary points."
+(2013, 7, 6, 1, 34, 56) function-evaluation-cpp 21.0719 "Evaluations of functions at arbitrary points."
+(2013, 7, 6, 1, 34, 59) function-extrapolation-python 3.4121 "BENCH:  1.06983804703"
+(2013, 7, 6, 1, 34, 59) function-extrapolation-python 1.06984 "BENCH:  1.06983804703"
+(2013, 7, 6, 1, 35, 1) function-interpolation-python 1.68892 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 6, 1, 35, 1) function-interpolation-python 0.990675 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 6, 1, 35, 29) la-vector-access-cpp 28.4662 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 6, 1, 36, 0) la-vector-assignment-cpp 31.1232 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 7, 1, 18, 49) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1408 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 7, 1, 19, 9) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8396 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 7, 1, 19, 25) geometry-bounding_box_tree_build-cpp 13.9329 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 7, 1, 19, 53) common-progress-cpp 27.6509 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 7, 1, 20, 23) common-timing-cpp 29.6991 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 7, 1, 22, 9) fem-multicore-cpp 106.778 "Coloring mesh."
+(2013, 7, 7, 1, 24, 41) fem-assembly-cpp 151.93 "Assembly for various forms and backends"
+(2013, 7, 7, 1, 24, 53) fem-convergence-cpp 12.1423 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 7, 1, 24, 55) fem-jit-python 0.00102012 "JIT compilation (in memory cache)"
+(2013, 7, 7, 1, 30, 2) fem-speedup-cpp 306.449 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 7, 1, 30, 2) fem-speedup-cpp-assembly 6.51973 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 7, 1, 30, 2) fem-speedup-cpp-solve 2.30563 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 7, 1, 30, 23) mesh-refinement-cpp 19.8291 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 7, 1, 30, 44) mesh-topology-cpp 20.1929 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 7, 1, 31, 7) mesh-unitcube-cpp 23.7033 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 7, 1, 31, 46) mesh-iteration-cpp 35.7503 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 7, 1, 32, 7) function-evaluation-cpp 21.2559 "Evaluations of functions at arbitrary points."
+(2013, 7, 7, 1, 32, 7) function-evaluation-cpp 21.1299 "Evaluations of functions at arbitrary points."
+(2013, 7, 7, 1, 32, 10) function-extrapolation-python 3.44534 "BENCH:  1.04738879204"
+(2013, 7, 7, 1, 32, 10) function-extrapolation-python 1.04739 "BENCH:  1.04738879204"
+(2013, 7, 7, 1, 32, 12) function-interpolation-python 1.70355 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 7, 1, 32, 12) function-interpolation-python 0.98673 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 7, 1, 32, 35) la-vector-access-cpp 23.1092 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 7, 1, 33, 0) la-vector-assignment-cpp 25.0661 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 8, 1, 18, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0342 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 8, 1, 19, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6658 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 8, 1, 19, 22) geometry-bounding_box_tree_build-cpp 13.9396 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 8, 1, 19, 50) common-progress-cpp 27.6501 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 8, 1, 20, 18) common-timing-cpp 28.8151 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 8, 1, 22, 5) fem-multicore-cpp 106.787 "Coloring mesh."
+(2013, 7, 8, 1, 24, 36) fem-assembly-cpp 150.746 "Assembly for various forms and backends"
+(2013, 7, 8, 1, 24, 48) fem-convergence-cpp 12.1321 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 8, 1, 24, 50) fem-jit-python 0.00102851 "JIT compilation (in memory cache)"
+(2013, 7, 8, 1, 29, 59) fem-speedup-cpp 308.532 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 8, 1, 29, 59) fem-speedup-cpp-assembly 6.5338 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 8, 1, 29, 59) fem-speedup-cpp-solve 2.24668 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 8, 1, 30, 20) mesh-refinement-cpp 19.8252 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 8, 1, 30, 39) mesh-topology-cpp 19.0122 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 8, 1, 31, 3) mesh-unitcube-cpp 23.6488 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 8, 1, 31, 41) mesh-iteration-cpp 35.5809 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 8, 1, 32, 2) function-evaluation-cpp 21.2309 "Evaluations of functions at arbitrary points."
+(2013, 7, 8, 1, 32, 2) function-evaluation-cpp 21.1236 "Evaluations of functions at arbitrary points."
+(2013, 7, 8, 1, 32, 6) function-extrapolation-python 3.32295 "BENCH:  1.05665493011"
+(2013, 7, 8, 1, 32, 6) function-extrapolation-python 1.05665 "BENCH:  1.05665493011"
+(2013, 7, 8, 1, 32, 8) function-interpolation-python 1.75593 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 8, 1, 32, 8) function-interpolation-python 1.00926 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 8, 1, 32, 31) la-vector-access-cpp 22.9717 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 8, 1, 32, 56) la-vector-assignment-cpp 25.084 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 9, 1, 18, 31) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.91525 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 9, 1, 18, 50) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7343 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 9, 1, 19, 7) geometry-bounding_box_tree_build-cpp 13.928 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 9, 1, 19, 35) common-progress-cpp 27.6506 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 9, 1, 20, 4) common-timing-cpp 29.6309 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 9, 1, 21, 51) fem-multicore-cpp 107.104 "Coloring mesh."
+(2013, 7, 9, 1, 24, 22) fem-assembly-cpp 150.474 "Assembly for various forms and backends"
+(2013, 7, 9, 1, 24, 34) fem-convergence-cpp 12.1342 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 9, 1, 24, 36) fem-jit-python 0.00103209 "JIT compilation (in memory cache)"
+(2013, 7, 9, 1, 29, 45) fem-speedup-cpp 309.241 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 9, 1, 29, 45) fem-speedup-cpp-assembly 6.45651 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 9, 1, 29, 45) fem-speedup-cpp-solve 2.26068 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 9, 1, 30, 8) mesh-refinement-cpp 19.8057 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 9, 1, 30, 27) mesh-topology-cpp 19.076 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 9, 1, 30, 50) mesh-unitcube-cpp 23.6881 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 9, 1, 31, 29) mesh-iteration-cpp 35.5806 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 9, 1, 31, 50) function-evaluation-cpp 21.2677 "Evaluations of functions at arbitrary points."
+(2013, 7, 9, 1, 31, 50) function-evaluation-cpp 21.1783 "Evaluations of functions at arbitrary points."
+(2013, 7, 9, 1, 31, 53) function-extrapolation-python 3.29906 "BENCH:  1.05690097809"
+(2013, 7, 9, 1, 31, 53) function-extrapolation-python 1.0569 "BENCH:  1.05690097809"
+(2013, 7, 9, 1, 31, 55) function-interpolation-python 1.6841 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 9, 1, 31, 55) function-interpolation-python 0.987605 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 9, 1, 32, 18) la-vector-access-cpp 22.9736 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 9, 1, 32, 44) la-vector-assignment-cpp 26.4678 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 10, 1, 19, 54) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0287 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 10, 1, 20, 13) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9357 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 10, 1, 20, 30) geometry-bounding_box_tree_build-cpp 14.0298 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 10, 1, 20, 57) common-progress-cpp 27.6509 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 10, 1, 21, 26) common-timing-cpp 28.9474 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 10, 1, 23, 12) fem-multicore-cpp 106.343 "Coloring mesh."
+(2013, 7, 10, 1, 25, 44) fem-assembly-cpp 151.815 "Assembly for various forms and backends"
+(2013, 7, 10, 1, 25, 56) fem-convergence-cpp 12.1328 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 10, 1, 25, 58) fem-jit-python 0.00103672 "JIT compilation (in memory cache)"
+(2013, 7, 10, 1, 31, 3) fem-speedup-cpp 304.755 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 10, 1, 31, 3) fem-speedup-cpp-assembly 6.54785 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 10, 1, 31, 3) fem-speedup-cpp-solve 2.30383 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 10, 1, 31, 24) mesh-refinement-cpp 19.8678 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 10, 1, 31, 43) mesh-topology-cpp 19.0905 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 10, 1, 32, 7) mesh-unitcube-cpp 23.6286 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 10, 1, 32, 53) mesh-iteration-cpp 44.1694 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 10, 1, 33, 15) function-evaluation-cpp 21.1804 "Evaluations of functions at arbitrary points."
+(2013, 7, 10, 1, 33, 15) function-evaluation-cpp 21.0951 "Evaluations of functions at arbitrary points."
+(2013, 7, 10, 1, 33, 18) function-extrapolation-python 3.39606 "BENCH:  1.05440497398"
+(2013, 7, 10, 1, 33, 18) function-extrapolation-python 1.0544 "BENCH:  1.05440497398"
+(2013, 7, 10, 1, 33, 20) function-interpolation-python 1.72841 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 10, 1, 33, 20) function-interpolation-python 1.01078 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 10, 1, 33, 45) la-vector-access-cpp 24.9499 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 10, 1, 34, 12) la-vector-assignment-cpp 27.5975 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 11, 1, 18, 13) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.99981 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 11, 1, 18, 33) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8902 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 11, 1, 18, 49) geometry-bounding_box_tree_build-cpp 13.9417 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 11, 1, 19, 17) common-progress-cpp 27.6512 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 11, 1, 19, 46) common-timing-cpp 29.5256 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 11, 1, 21, 33) fem-multicore-cpp 106.466 "Coloring mesh."
+(2013, 7, 11, 1, 24, 4) fem-assembly-cpp 151.071 "Assembly for various forms and backends"
+(2013, 7, 11, 1, 24, 16) fem-convergence-cpp 12.1399 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 11, 1, 24, 18) fem-jit-python 0.00102508 "JIT compilation (in memory cache)"
+(2013, 7, 11, 1, 29, 25) fem-speedup-cpp 307.202 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 11, 1, 29, 25) fem-speedup-cpp-assembly 6.49706 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 11, 1, 29, 25) fem-speedup-cpp-solve 2.2824 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 11, 1, 29, 47) mesh-refinement-cpp 19.9043 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 11, 1, 30, 6) mesh-topology-cpp 19.0098 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 11, 1, 30, 30) mesh-unitcube-cpp 23.5735 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 11, 1, 31, 8) mesh-iteration-cpp 35.5772 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 11, 1, 31, 29) function-evaluation-cpp 21.2811 "Evaluations of functions at arbitrary points."
+(2013, 7, 11, 1, 31, 29) function-evaluation-cpp 21.1039 "Evaluations of functions at arbitrary points."
+(2013, 7, 11, 1, 31, 33) function-extrapolation-python 3.48712 "BENCH:  1.04549098015"
+(2013, 7, 11, 1, 31, 33) function-extrapolation-python 1.04549 "BENCH:  1.04549098015"
+(2013, 7, 11, 1, 31, 34) function-interpolation-python 1.68644 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 11, 1, 31, 34) function-interpolation-python 0.987597 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 11, 1, 31, 57) la-vector-access-cpp 22.9651 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 11, 1, 32, 22) la-vector-assignment-cpp 24.9 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 12, 1, 18, 21) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.064 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 12, 1, 18, 40) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5812 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 12, 1, 18, 57) geometry-bounding_box_tree_build-cpp 13.9269 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 12, 1, 19, 24) common-progress-cpp 27.6515 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 12, 1, 19, 54) common-timing-cpp 29.5787 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 12, 1, 21, 40) fem-multicore-cpp 106.595 "Coloring mesh."
+(2013, 7, 12, 1, 24, 12) fem-assembly-cpp 151.348 "Assembly for various forms and backends"
+(2013, 7, 12, 1, 24, 24) fem-convergence-cpp 12.1808 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 12, 1, 24, 26) fem-jit-python 0.0010334 "JIT compilation (in memory cache)"
+(2013, 7, 12, 1, 29, 33) fem-speedup-cpp 307.086 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 12, 1, 29, 33) fem-speedup-cpp-assembly 6.53124 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 12, 1, 29, 33) fem-speedup-cpp-solve 2.25542 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 12, 1, 29, 53) mesh-refinement-cpp 19.8769 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 12, 1, 30, 13) mesh-topology-cpp 19.0599 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 12, 1, 30, 36) mesh-unitcube-cpp 23.6652 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 12, 1, 31, 18) mesh-iteration-cpp 39.1563 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 12, 1, 31, 39) function-evaluation-cpp 21.624 "Evaluations of functions at arbitrary points."
+(2013, 7, 12, 1, 31, 39) function-evaluation-cpp 21.5489 "Evaluations of functions at arbitrary points."
+(2013, 7, 12, 1, 31, 43) function-extrapolation-python 3.36171 "BENCH:  1.06769394875"
+(2013, 7, 12, 1, 31, 43) function-extrapolation-python 1.06769 "BENCH:  1.06769394875"
+(2013, 7, 12, 1, 31, 45) function-interpolation-python 1.74685 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 12, 1, 31, 45) function-interpolation-python 0.990435 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 12, 1, 32, 8) la-vector-access-cpp 22.9349 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 12, 1, 32, 33) la-vector-assignment-cpp 25.0589 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 13, 1, 18, 51) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.92917 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 13, 1, 19, 10) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8593 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 13, 1, 19, 26) geometry-bounding_box_tree_build-cpp 13.9087 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 13, 1, 19, 54) common-progress-cpp 27.6511 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 13, 1, 20, 24) common-timing-cpp 29.876 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 13, 1, 22, 11) fem-multicore-cpp 106.654 "Coloring mesh."
+(2013, 7, 13, 1, 24, 41) fem-assembly-cpp 150.641 "Assembly for various forms and backends"
+(2013, 7, 13, 1, 24, 53) fem-convergence-cpp 12.1345 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 13, 1, 24, 55) fem-jit-python 0.00101712 "JIT compilation (in memory cache)"
+(2013, 7, 13, 1, 30, 0) fem-speedup-cpp 304.499 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 13, 1, 30, 0) fem-speedup-cpp-assembly 6.53773 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 13, 1, 30, 0) fem-speedup-cpp-solve 2.34874 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 13, 1, 30, 20) mesh-refinement-cpp 19.8643 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 13, 1, 30, 40) mesh-topology-cpp 19.0804 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 13, 1, 31, 3) mesh-unitcube-cpp 23.6499 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 13, 1, 31, 41) mesh-iteration-cpp 35.5453 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 13, 1, 32, 3) function-evaluation-cpp 21.1705 "Evaluations of functions at arbitrary points."
+(2013, 7, 13, 1, 32, 3) function-evaluation-cpp 21.0901 "Evaluations of functions at arbitrary points."
+(2013, 7, 13, 1, 32, 6) function-extrapolation-python 3.37889 "BENCH:  1.05212593079"
+(2013, 7, 13, 1, 32, 6) function-extrapolation-python 1.05213 "BENCH:  1.05212593079"
+(2013, 7, 13, 1, 32, 8) function-interpolation-python 1.71661 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 13, 1, 32, 8) function-interpolation-python 0.988547 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 13, 1, 32, 31) la-vector-access-cpp 22.9248 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 13, 1, 33, 26) la-vector-assignment-cpp 55.4213 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 14, 1, 18, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.97594 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 14, 1, 18, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7256 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 14, 1, 18, 58) geometry-bounding_box_tree_build-cpp 13.9138 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 14, 1, 19, 26) common-progress-cpp 27.6515 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 14, 1, 19, 56) common-timing-cpp 29.5342 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 14, 1, 21, 42) fem-multicore-cpp 106.856 "Coloring mesh."
+(2013, 7, 14, 1, 24, 13) fem-assembly-cpp 150.357 "Assembly for various forms and backends"
+(2013, 7, 14, 1, 24, 25) fem-convergence-cpp 12.1437 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 14, 1, 24, 27) fem-jit-python 0.00100989 "JIT compilation (in memory cache)"
+(2013, 7, 14, 1, 29, 31) fem-speedup-cpp 304.247 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 14, 1, 29, 31) fem-speedup-cpp-assembly 6.58345 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 14, 1, 29, 31) fem-speedup-cpp-solve 2.33907 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 14, 1, 29, 52) mesh-refinement-cpp 19.8696 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 14, 1, 30, 11) mesh-topology-cpp 19.0261 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 14, 1, 30, 34) mesh-unitcube-cpp 23.6569 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 14, 1, 31, 13) mesh-iteration-cpp 35.729 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 14, 1, 31, 34) function-evaluation-cpp 21.4095 "Evaluations of functions at arbitrary points."
+(2013, 7, 14, 1, 31, 34) function-evaluation-cpp 21.3343 "Evaluations of functions at arbitrary points."
+(2013, 7, 14, 1, 31, 37) function-extrapolation-python 3.4012 "BENCH:  1.05881810188"
+(2013, 7, 14, 1, 31, 37) function-extrapolation-python 1.05882 "BENCH:  1.05881810188"
+(2013, 7, 14, 1, 31, 39) function-interpolation-python 1.72811 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 14, 1, 31, 39) function-interpolation-python 1.00277 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 14, 1, 32, 5) la-vector-access-cpp 25.4835 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 14, 1, 32, 30) la-vector-assignment-cpp 25.0565 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 15, 1, 17, 48) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.97036 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 15, 1, 18, 7) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8873 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 15, 1, 18, 24) geometry-bounding_box_tree_build-cpp 14.0707 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 15, 1, 18, 51) common-progress-cpp 27.6519 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 15, 1, 19, 20) common-timing-cpp 28.9185 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 15, 1, 21, 7) fem-multicore-cpp 106.52 "Coloring mesh."
+(2013, 7, 15, 1, 23, 38) fem-assembly-cpp 151.459 "Assembly for various forms and backends"
+(2013, 7, 15, 1, 23, 50) fem-convergence-cpp 12.131 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 15, 1, 23, 52) fem-jit-python 0.00102201 "JIT compilation (in memory cache)"
+(2013, 7, 15, 1, 28, 57) fem-speedup-cpp 304.422 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 15, 1, 28, 57) fem-speedup-cpp-assembly 6.48505 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 15, 1, 28, 57) fem-speedup-cpp-solve 2.23534 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 15, 1, 29, 19) mesh-refinement-cpp 19.7811 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 15, 1, 29, 38) mesh-topology-cpp 19.0518 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 15, 1, 30, 2) mesh-unitcube-cpp 23.696 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 15, 1, 30, 40) mesh-iteration-cpp 35.5452 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 15, 1, 31, 1) function-evaluation-cpp 21.2729 "Evaluations of functions at arbitrary points."
+(2013, 7, 15, 1, 31, 1) function-evaluation-cpp 21.1645 "Evaluations of functions at arbitrary points."
+(2013, 7, 15, 1, 31, 4) function-extrapolation-python 3.43764 "BENCH:  1.04265785217"
+(2013, 7, 15, 1, 31, 4) function-extrapolation-python 1.04266 "BENCH:  1.04265785217"
+(2013, 7, 15, 1, 31, 6) function-interpolation-python 1.67503 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 15, 1, 31, 6) function-interpolation-python 0.986848 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 15, 1, 31, 29) la-vector-access-cpp 22.951 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 15, 1, 32, 0) la-vector-assignment-cpp 31.0985 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 16, 1, 18, 4) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.97083 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 16, 1, 18, 23) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6486 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 16, 1, 18, 39) geometry-bounding_box_tree_build-cpp 13.9228 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 16, 1, 19, 7) common-progress-cpp 27.651 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 16, 1, 19, 36) common-timing-cpp 28.8434 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 16, 1, 21, 23) fem-multicore-cpp 106.965 "Coloring mesh."
+(2013, 7, 16, 1, 23, 54) fem-assembly-cpp 151.016 "Assembly for various forms and backends"
+(2013, 7, 16, 1, 24, 6) fem-convergence-cpp 12.1383 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 16, 1, 24, 8) fem-jit-python 0.00102201 "JIT compilation (in memory cache)"
+(2013, 7, 16, 1, 29, 14) fem-speedup-cpp 306.193 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 16, 1, 29, 14) fem-speedup-cpp-assembly 6.57166 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 16, 1, 29, 14) fem-speedup-cpp-solve 2.31181 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 16, 1, 29, 36) mesh-refinement-cpp 19.8503 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 16, 1, 29, 55) mesh-topology-cpp 19.0814 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 16, 1, 30, 19) mesh-unitcube-cpp 23.6384 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 16, 1, 30, 57) mesh-iteration-cpp 35.5524 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 16, 1, 31, 18) function-evaluation-cpp 21.2645 "Evaluations of functions at arbitrary points."
+(2013, 7, 16, 1, 31, 18) function-evaluation-cpp 21.1568 "Evaluations of functions at arbitrary points."
+(2013, 7, 16, 1, 31, 22) function-extrapolation-python 3.49521 "BENCH:  1.05919599533"
+(2013, 7, 16, 1, 31, 22) function-extrapolation-python 1.0592 "BENCH:  1.05919599533"
+(2013, 7, 16, 1, 31, 23) function-interpolation-python 1.68954 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 16, 1, 31, 23) function-interpolation-python 0.989933 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 16, 1, 31, 46) la-vector-access-cpp 22.9565 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 16, 1, 32, 12) la-vector-assignment-cpp 25.0814 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 17, 1, 20, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.99746 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 17, 1, 21, 6) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6891 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 17, 1, 21, 23) geometry-bounding_box_tree_build-cpp 13.9412 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 17, 1, 21, 54) common-progress-cpp 31.4126 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 17, 1, 22, 23) common-timing-cpp 29.3737 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 17, 1, 24, 10) fem-multicore-cpp 106.781 "Coloring mesh."
+(2013, 7, 17, 1, 26, 41) fem-assembly-cpp 151.302 "Assembly for various forms and backends"
+(2013, 7, 17, 1, 26, 54) fem-convergence-cpp 12.1408 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 17, 1, 26, 55) fem-jit-python 0.00103559 "JIT compilation (in memory cache)"
+(2013, 7, 17, 1, 32, 1) fem-speedup-cpp 305.248 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 17, 1, 32, 1) fem-speedup-cpp-assembly 6.59119 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 17, 1, 32, 1) fem-speedup-cpp-solve 2.27285 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 17, 1, 32, 23) mesh-refinement-cpp 19.8289 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 17, 1, 32, 42) mesh-topology-cpp 19.1244 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 17, 1, 33, 5) mesh-unitcube-cpp 23.6103 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 17, 1, 33, 43) mesh-iteration-cpp 35.5332 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 17, 1, 34, 5) function-evaluation-cpp 21.2646 "Evaluations of functions at arbitrary points."
+(2013, 7, 17, 1, 34, 5) function-evaluation-cpp 21.1484 "Evaluations of functions at arbitrary points."
+(2013, 7, 17, 1, 34, 8) function-extrapolation-python 3.4538 "BENCH:  1.05830597878"
+(2013, 7, 17, 1, 34, 8) function-extrapolation-python 1.05831 "BENCH:  1.05830597878"
+(2013, 7, 17, 1, 34, 10) function-interpolation-python 1.72793 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 17, 1, 34, 10) function-interpolation-python 1.00475 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 17, 1, 34, 33) la-vector-access-cpp 22.9513 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 17, 1, 34, 58) la-vector-assignment-cpp 25.0889 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 18, 1, 18, 4) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.93762 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 18, 1, 18, 23) geometry-bounding_box_tree_compute_closest_entity-cpp 15.797 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 18, 1, 18, 39) geometry-bounding_box_tree_build-cpp 13.9475 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 18, 1, 19, 7) common-progress-cpp 27.6516 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 18, 1, 19, 36) common-timing-cpp 29.2863 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 18, 1, 21, 24) fem-multicore-cpp 107.129 "Coloring mesh."
+(2013, 7, 18, 1, 23, 54) fem-assembly-cpp 150.605 "Assembly for various forms and backends"
+(2013, 7, 18, 1, 24, 6) fem-convergence-cpp 12.1504 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 18, 1, 24, 8) fem-jit-python 0.0010257 "JIT compilation (in memory cache)"
+(2013, 7, 18, 1, 29, 17) fem-speedup-cpp 308.591 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 18, 1, 29, 17) fem-speedup-cpp-assembly 6.51866 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 18, 1, 29, 17) fem-speedup-cpp-solve 2.28439 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 18, 1, 29, 39) mesh-refinement-cpp 19.8179 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 18, 1, 29, 58) mesh-topology-cpp 19.1706 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 18, 1, 30, 22) mesh-unitcube-cpp 23.6178 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 18, 1, 31, 0) mesh-iteration-cpp 35.5583 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 18, 1, 31, 21) function-evaluation-cpp 21.3794 "Evaluations of functions at arbitrary points."
+(2013, 7, 18, 1, 31, 21) function-evaluation-cpp 21.2301 "Evaluations of functions at arbitrary points."
+(2013, 7, 18, 1, 31, 25) function-extrapolation-python 3.53282 "BENCH:  1.06168103218"
+(2013, 7, 18, 1, 31, 25) function-extrapolation-python 1.06168 "BENCH:  1.06168103218"
+(2013, 7, 18, 1, 31, 26) function-interpolation-python 1.69614 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 18, 1, 31, 26) function-interpolation-python 1.00782 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 18, 1, 31, 51) la-vector-access-cpp 24.9473 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 18, 1, 32, 16) la-vector-assignment-cpp 25.031 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 19, 1, 18, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0751 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 19, 1, 18, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8084 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 19, 1, 19, 8) geometry-bounding_box_tree_build-cpp 14.0056 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 19, 1, 19, 35) common-progress-cpp 27.6514 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 19, 1, 20, 6) common-timing-cpp 31.0301 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 19, 1, 21, 53) fem-multicore-cpp 106.616 "Coloring mesh."
+(2013, 7, 19, 1, 24, 24) fem-assembly-cpp 151.515 "Assembly for various forms and backends"
+(2013, 7, 19, 1, 24, 37) fem-convergence-cpp 12.1277 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 19, 1, 24, 38) fem-jit-python 0.00102739 "JIT compilation (in memory cache)"
+(2013, 7, 19, 1, 29, 45) fem-speedup-cpp 306.558 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 19, 1, 29, 45) fem-speedup-cpp-assembly 6.46923 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 19, 1, 29, 45) fem-speedup-cpp-solve 2.26993 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 19, 1, 30, 7) mesh-refinement-cpp 19.838 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 19, 1, 30, 26) mesh-topology-cpp 19.0439 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 19, 1, 30, 49) mesh-unitcube-cpp 23.6054 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 19, 1, 31, 27) mesh-iteration-cpp 35.5374 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 19, 1, 31, 49) function-evaluation-cpp 21.939 "Evaluations of functions at arbitrary points."
+(2013, 7, 19, 1, 31, 49) function-evaluation-cpp 21.7642 "Evaluations of functions at arbitrary points."
+(2013, 7, 19, 1, 31, 53) function-extrapolation-python 3.58701 "BENCH:  1.03702187538"
+(2013, 7, 19, 1, 31, 53) function-extrapolation-python 1.03702 "BENCH:  1.03702187538"
+(2013, 7, 19, 1, 31, 55) function-interpolation-python 1.70192 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 19, 1, 31, 55) function-interpolation-python 0.996866 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 19, 1, 32, 18) la-vector-access-cpp 22.958 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 19, 1, 32, 45) la-vector-assignment-cpp 27.1062 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 20, 1, 17, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2128 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 20, 1, 17, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7231 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 20, 1, 18, 13) geometry-bounding_box_tree_build-cpp 13.9218 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 20, 1, 18, 40) common-progress-cpp 27.6883 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 20, 1, 19, 10) common-timing-cpp 29.6875 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 20, 1, 20, 57) fem-multicore-cpp 106.824 "Coloring mesh."
+(2013, 7, 20, 1, 23, 28) fem-assembly-cpp 151.614 "Assembly for various forms and backends"
+(2013, 7, 20, 1, 23, 41) fem-convergence-cpp 12.1907 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 20, 1, 23, 42) fem-jit-python 0.00103128 "JIT compilation (in memory cache)"
+(2013, 7, 20, 1, 28, 50) fem-speedup-cpp 307.719 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 20, 1, 28, 50) fem-speedup-cpp-assembly 6.52763 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 20, 1, 28, 50) fem-speedup-cpp-solve 2.29249 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 20, 1, 29, 12) mesh-refinement-cpp 19.8286 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 20, 1, 29, 31) mesh-topology-cpp 19.1506 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 20, 1, 29, 55) mesh-unitcube-cpp 23.6698 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 20, 1, 30, 41) mesh-iteration-cpp 44.1741 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 20, 1, 31, 5) function-evaluation-cpp 23.9123 "Evaluations of functions at arbitrary points."
+(2013, 7, 20, 1, 31, 5) function-evaluation-cpp 23.7863 "Evaluations of functions at arbitrary points."
+(2013, 7, 20, 1, 31, 9) function-extrapolation-python 3.49244 "BENCH:  1.07639193535"
+(2013, 7, 20, 1, 31, 9) function-extrapolation-python 1.07639 "BENCH:  1.07639193535"
+(2013, 7, 20, 1, 31, 11) function-interpolation-python 1.69812 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 20, 1, 31, 11) function-interpolation-python 1.01782 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 20, 1, 31, 34) la-vector-access-cpp 22.9654 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 20, 1, 32, 1) la-vector-assignment-cpp 27.2714 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 21, 1, 19, 8) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0012 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 21, 1, 19, 27) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6464 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 21, 1, 19, 43) geometry-bounding_box_tree_build-cpp 13.928 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 21, 1, 20, 11) common-progress-cpp 27.652 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 21, 1, 20, 40) common-timing-cpp 29.5734 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 21, 1, 22, 27) fem-multicore-cpp 106.923 "Coloring mesh."
+(2013, 7, 21, 1, 24, 59) fem-assembly-cpp 151.808 "Assembly for various forms and backends"
+(2013, 7, 21, 1, 25, 11) fem-convergence-cpp 12.1731 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 21, 1, 25, 13) fem-jit-python 0.0010319 "JIT compilation (in memory cache)"
+(2013, 7, 21, 1, 30, 18) fem-speedup-cpp 304.669 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 21, 1, 30, 18) fem-speedup-cpp-assembly 6.52735 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 21, 1, 30, 18) fem-speedup-cpp-solve 2.30222 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 21, 1, 30, 39) mesh-refinement-cpp 19.9697 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 21, 1, 30, 58) mesh-topology-cpp 19.106 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 21, 1, 31, 22) mesh-unitcube-cpp 23.7362 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 21, 1, 32, 3) mesh-iteration-cpp 39.1036 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 21, 1, 32, 24) function-evaluation-cpp 21.217 "Evaluations of functions at arbitrary points."
+(2013, 7, 21, 1, 32, 24) function-evaluation-cpp 21.075 "Evaluations of functions at arbitrary points."
+(2013, 7, 21, 1, 32, 28) function-extrapolation-python 3.47906 "BENCH:  1.05915498734"
+(2013, 7, 21, 1, 32, 28) function-extrapolation-python 1.05915 "BENCH:  1.05915498734"
+(2013, 7, 21, 1, 32, 30) function-interpolation-python 1.75239 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 21, 1, 32, 30) function-interpolation-python 1.01089 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 21, 1, 32, 53) la-vector-access-cpp 22.9286 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 21, 1, 33, 24) la-vector-assignment-cpp 31.0843 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 22, 1, 17, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.92627 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 22, 1, 17, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 15.914 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 22, 1, 18, 8) geometry-bounding_box_tree_build-cpp 13.9849 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 22, 1, 18, 35) common-progress-cpp 27.6508 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 22, 1, 19, 5) common-timing-cpp 29.6839 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 22, 1, 20, 52) fem-multicore-cpp 106.671 "Coloring mesh."
+(2013, 7, 22, 1, 23, 23) fem-assembly-cpp 151.214 "Assembly for various forms and backends"
+(2013, 7, 22, 1, 23, 35) fem-convergence-cpp 12.149 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 22, 1, 23, 37) fem-jit-python 0.00104589 "JIT compilation (in memory cache)"
+(2013, 7, 22, 1, 28, 48) fem-speedup-cpp 310.936 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 22, 1, 28, 48) fem-speedup-cpp-assembly 6.46761 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 22, 1, 28, 48) fem-speedup-cpp-solve 2.23589 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 22, 1, 29, 9) mesh-refinement-cpp 19.884 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 22, 1, 29, 29) mesh-topology-cpp 19.0747 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 22, 1, 29, 52) mesh-unitcube-cpp 23.5547 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 22, 1, 30, 30) mesh-iteration-cpp 35.5506 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 22, 1, 30, 52) function-evaluation-cpp 21.4473 "Evaluations of functions at arbitrary points."
+(2013, 7, 22, 1, 30, 52) function-evaluation-cpp 21.3504 "Evaluations of functions at arbitrary points."
+(2013, 7, 22, 1, 30, 55) function-extrapolation-python 3.38351 "BENCH:  1.05044412613"
+(2013, 7, 22, 1, 30, 55) function-extrapolation-python 1.05044 "BENCH:  1.05044412613"
+(2013, 7, 22, 1, 30, 57) function-interpolation-python 1.7139 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 22, 1, 30, 57) function-interpolation-python 1.01586 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 22, 1, 31, 20) la-vector-access-cpp 22.9637 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 22, 1, 31, 47) la-vector-assignment-cpp 27.0995 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 23, 1, 19, 15) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0312 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 23, 1, 19, 35) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9057 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 23, 1, 19, 51) geometry-bounding_box_tree_build-cpp 13.9175 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 23, 1, 20, 19) common-progress-cpp 27.6897 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 23, 1, 20, 49) common-timing-cpp 29.7265 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 23, 1, 22, 35) fem-multicore-cpp 106.683 "Coloring mesh."
+(2013, 7, 23, 1, 25, 7) fem-assembly-cpp 151.484 "Assembly for various forms and backends"
+(2013, 7, 23, 1, 25, 19) fem-convergence-cpp 12.1302 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 23, 1, 25, 21) fem-jit-python 0.00102 "JIT compilation (in memory cache)"
+(2013, 7, 23, 1, 30, 26) fem-speedup-cpp 305.004 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 23, 1, 30, 26) fem-speedup-cpp-assembly 6.48651 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 23, 1, 30, 26) fem-speedup-cpp-solve 2.32136 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 23, 1, 30, 46) mesh-refinement-cpp 19.8748 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 23, 1, 31, 5) mesh-topology-cpp 19.0003 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 23, 1, 31, 29) mesh-unitcube-cpp 23.7693 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 23, 1, 32, 11) mesh-iteration-cpp 39.1538 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 23, 1, 32, 32) function-evaluation-cpp 21.3518 "Evaluations of functions at arbitrary points."
+(2013, 7, 23, 1, 32, 32) function-evaluation-cpp 21.266 "Evaluations of functions at arbitrary points."
+(2013, 7, 23, 1, 32, 35) function-extrapolation-python 3.33282 "BENCH:  1.06447482109"
+(2013, 7, 23, 1, 32, 35) function-extrapolation-python 1.06447 "BENCH:  1.06447482109"
+(2013, 7, 23, 1, 32, 37) function-interpolation-python 1.71955 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 23, 1, 32, 37) function-interpolation-python 1.01365 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 23, 1, 33, 0) la-vector-access-cpp 22.9004 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 23, 1, 33, 31) la-vector-assignment-cpp 31.0893 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 24, 1, 18, 8) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0569 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 24, 1, 18, 27) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6179 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 24, 1, 18, 43) geometry-bounding_box_tree_build-cpp 13.9532 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 24, 1, 19, 11) common-progress-cpp 27.6516 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 24, 1, 19, 41) common-timing-cpp 29.4583 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 24, 1, 21, 27) fem-multicore-cpp 106.546 "Coloring mesh."
+(2013, 7, 24, 1, 23, 59) fem-assembly-cpp 151.764 "Assembly for various forms and backends"
+(2013, 7, 24, 1, 24, 11) fem-convergence-cpp 12.1404 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 24, 1, 24, 13) fem-jit-python 0.0010278 "JIT compilation (in memory cache)"
+(2013, 7, 24, 1, 29, 18) fem-speedup-cpp 305.064 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 24, 1, 29, 18) fem-speedup-cpp-assembly 6.52501 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 24, 1, 29, 18) fem-speedup-cpp-solve 2.27892 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 24, 1, 29, 39) mesh-refinement-cpp 19.8261 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 24, 1, 29, 59) mesh-topology-cpp 19.1535 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 24, 1, 30, 22) mesh-unitcube-cpp 23.6353 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 24, 1, 31, 0) mesh-iteration-cpp 35.5519 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 24, 1, 31, 22) function-evaluation-cpp 21.248 "Evaluations of functions at arbitrary points."
+(2013, 7, 24, 1, 31, 22) function-evaluation-cpp 21.1217 "Evaluations of functions at arbitrary points."
+(2013, 7, 24, 1, 31, 25) function-extrapolation-python 3.48699 "BENCH:  1.04801487923"
+(2013, 7, 24, 1, 31, 25) function-extrapolation-python 1.04801 "BENCH:  1.04801487923"
+(2013, 7, 24, 1, 31, 27) function-interpolation-python 1.72332 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 24, 1, 31, 27) function-interpolation-python 1.01363 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 24, 1, 31, 50) la-vector-access-cpp 22.9582 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 24, 1, 32, 17) la-vector-assignment-cpp 27.1103 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 25, 1, 18, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.91429 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 25, 1, 18, 52) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7018 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 25, 1, 19, 9) geometry-bounding_box_tree_build-cpp 13.9045 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 25, 1, 19, 37) common-progress-cpp 27.6518 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 25, 1, 20, 6) common-timing-cpp 29.0688 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 25, 1, 21, 52) fem-multicore-cpp 106.354 "Coloring mesh."
+(2013, 7, 25, 1, 24, 23) fem-assembly-cpp 151.178 "Assembly for various forms and backends"
+(2013, 7, 25, 1, 24, 35) fem-convergence-cpp 12.1495 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 25, 1, 24, 37) fem-jit-python 0.0010262 "JIT compilation (in memory cache)"
+(2013, 7, 25, 1, 29, 42) fem-speedup-cpp 305.293 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 25, 1, 29, 42) fem-speedup-cpp-assembly 6.53432 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 25, 1, 29, 42) fem-speedup-cpp-solve 2.26699 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 25, 1, 30, 3) mesh-refinement-cpp 19.8821 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 25, 1, 30, 22) mesh-topology-cpp 19.074 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 25, 1, 30, 46) mesh-unitcube-cpp 23.7186 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 25, 1, 31, 28) mesh-iteration-cpp 39.1559 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 25, 1, 31, 50) function-evaluation-cpp 22.0183 "Evaluations of functions at arbitrary points."
+(2013, 7, 25, 1, 31, 50) function-evaluation-cpp 21.9331 "Evaluations of functions at arbitrary points."
+(2013, 7, 25, 1, 31, 53) function-extrapolation-python 3.52895 "BENCH:  1.08823299408"
+(2013, 7, 25, 1, 31, 53) function-extrapolation-python 1.08823 "BENCH:  1.08823299408"
+(2013, 7, 25, 1, 31, 55) function-interpolation-python 1.7827 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 25, 1, 31, 55) function-interpolation-python 1.01551 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 25, 1, 32, 20) la-vector-access-cpp 24.9518 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 25, 1, 32, 47) la-vector-assignment-cpp 27.0816 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 26, 1, 32, 57) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8357 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 26, 1, 33, 16) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4289 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 26, 1, 33, 32) geometry-bounding_box_tree_build-cpp 13.9295 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 26, 1, 34, 0) common-progress-cpp 27.6522 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 26, 1, 34, 29) common-timing-cpp 29.3048 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 26, 1, 36, 16) fem-multicore-cpp 106.808 "Coloring mesh."
+(2013, 7, 26, 1, 38, 45) fem-assembly-cpp 149.245 "Assembly for various forms and backends"
+(2013, 7, 26, 1, 38, 57) fem-convergence-cpp 12.0954 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 26, 1, 38, 59) fem-jit-python 0.0010324 "JIT compilation (in memory cache)"
+(2013, 7, 26, 1, 44, 6) fem-speedup-cpp 306.664 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 26, 1, 44, 6) fem-speedup-cpp-assembly 6.46767 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 26, 1, 44, 6) fem-speedup-cpp-solve 2.28157 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 26, 1, 44, 27) mesh-refinement-cpp 19.9331 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 26, 1, 44, 46) mesh-topology-cpp 19.2752 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 26, 1, 45, 10) mesh-unitcube-cpp 23.9851 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 26, 1, 45, 48) mesh-iteration-cpp 35.5488 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 26, 1, 46, 9) function-evaluation-cpp 21.1529 "Evaluations of functions at arbitrary points."
+(2013, 7, 26, 1, 46, 9) function-evaluation-cpp 21.0716 "Evaluations of functions at arbitrary points."
+(2013, 7, 26, 1, 46, 13) function-extrapolation-python 3.41242 "BENCH:  1.06968593597"
+(2013, 7, 26, 1, 46, 13) function-extrapolation-python 1.06969 "BENCH:  1.06968593597"
+(2013, 7, 26, 1, 46, 15) function-interpolation-python 1.7068 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 26, 1, 46, 15) function-interpolation-python 0.974432 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 26, 1, 46, 39) la-vector-access-cpp 24.9422 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 26, 1, 47, 5) la-vector-assignment-cpp 25.0615 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 27, 1, 25, 25) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.648 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 27, 1, 25, 43) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1914 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 27, 1, 26, 0) geometry-bounding_box_tree_build-cpp 13.8779 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 27, 1, 26, 27) common-progress-cpp 27.6531 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 27, 1, 26, 57) common-timing-cpp 29.1611 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 27, 1, 28, 43) fem-multicore-cpp 106.705 "Coloring mesh."
+(2013, 7, 27, 1, 31, 12) fem-assembly-cpp 148.199 "Assembly for various forms and backends"
+(2013, 7, 27, 1, 31, 24) fem-convergence-cpp 12.1193 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 27, 1, 31, 26) fem-jit-python 0.0010288 "JIT compilation (in memory cache)"
+(2013, 7, 27, 1, 36, 33) fem-speedup-cpp 307.907 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 27, 1, 36, 33) fem-speedup-cpp-assembly 6.7843 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 27, 1, 36, 33) fem-speedup-cpp-solve 2.21279 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 27, 1, 36, 54) mesh-refinement-cpp 19.8739 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 27, 1, 37, 13) mesh-topology-cpp 19.1819 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 27, 1, 37, 37) mesh-unitcube-cpp 23.8984 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 27, 1, 38, 23) mesh-iteration-cpp 43.4933 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 27, 1, 38, 44) function-evaluation-cpp 21.1308 "Evaluations of functions at arbitrary points."
+(2013, 7, 27, 1, 38, 44) function-evaluation-cpp 21.0487 "Evaluations of functions at arbitrary points."
+(2013, 7, 27, 1, 38, 48) function-extrapolation-python 3.39592 "BENCH:  1.06241202354"
+(2013, 7, 27, 1, 38, 48) function-extrapolation-python 1.06241 "BENCH:  1.06241202354"
+(2013, 7, 27, 1, 38, 50) function-interpolation-python 1.71973 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 27, 1, 38, 50) function-interpolation-python 0.983558 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 27, 1, 39, 15) la-vector-access-cpp 24.9409 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 27, 1, 39, 40) la-vector-assignment-cpp 25.0484 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 28, 1, 39, 11) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.4281 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 28, 1, 39, 29) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3285 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 28, 1, 39, 46) geometry-bounding_box_tree_build-cpp 13.8874 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 28, 1, 40, 13) common-progress-cpp 27.6524 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 28, 1, 40, 42) common-timing-cpp 28.2414 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 28, 1, 42, 28) fem-multicore-cpp 106.675 "Coloring mesh."
+(2013, 7, 28, 1, 44, 57) fem-assembly-cpp 148.21 "Assembly for various forms and backends"
+(2013, 7, 28, 1, 45, 9) fem-convergence-cpp 12.1267 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 28, 1, 45, 11) fem-jit-python 0.00103991 "JIT compilation (in memory cache)"
+(2013, 7, 28, 1, 50, 17) fem-speedup-cpp 306.216 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 28, 1, 50, 17) fem-speedup-cpp-assembly 6.42771 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 28, 1, 50, 17) fem-speedup-cpp-solve 2.28056 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 28, 1, 50, 38) mesh-refinement-cpp 19.9213 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 28, 1, 50, 57) mesh-topology-cpp 19.1526 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 28, 1, 51, 21) mesh-unitcube-cpp 23.9458 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 28, 1, 52, 7) mesh-iteration-cpp 43.5389 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 28, 1, 52, 28) function-evaluation-cpp 21.1276 "Evaluations of functions at arbitrary points."
+(2013, 7, 28, 1, 52, 28) function-evaluation-cpp 21.0374 "Evaluations of functions at arbitrary points."
+(2013, 7, 28, 1, 52, 31) function-extrapolation-python 3.34089 "BENCH:  1.0704369545"
+(2013, 7, 28, 1, 52, 31) function-extrapolation-python 1.07044 "BENCH:  1.0704369545"
+(2013, 7, 28, 1, 52, 33) function-interpolation-python 1.69298 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 28, 1, 52, 33) function-interpolation-python 0.974667 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 28, 1, 52, 58) la-vector-access-cpp 24.9371 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 28, 1, 53, 25) la-vector-assignment-cpp 27.5753 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 29, 1, 33, 16) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.86 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 29, 1, 33, 35) geometry-bounding_box_tree_compute_closest_entity-cpp 15.404 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 29, 1, 33, 51) geometry-bounding_box_tree_build-cpp 13.9519 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 29, 1, 34, 19) common-progress-cpp 27.6526 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 29, 1, 34, 48) common-timing-cpp 28.8879 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 29, 1, 36, 35) fem-multicore-cpp 106.715 "Coloring mesh."
+(2013, 7, 29, 1, 39, 3) fem-assembly-cpp 148.025 "Assembly for various forms and backends"
+(2013, 7, 29, 1, 39, 15) fem-convergence-cpp 12.1061 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 29, 1, 39, 17) fem-jit-python 0.0010309 "JIT compilation (in memory cache)"
+(2013, 7, 29, 1, 44, 22) fem-speedup-cpp 305.176 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 29, 1, 44, 22) fem-speedup-cpp-assembly 6.48856 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 29, 1, 44, 22) fem-speedup-cpp-solve 2.26292 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 29, 1, 44, 42) mesh-refinement-cpp 19.8754 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 29, 1, 45, 2) mesh-topology-cpp 19.1465 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 29, 1, 45, 25) mesh-unitcube-cpp 23.8806 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 29, 1, 46, 3) mesh-iteration-cpp 35.4578 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 29, 1, 46, 25) function-evaluation-cpp 21.6172 "Evaluations of functions at arbitrary points."
+(2013, 7, 29, 1, 46, 25) function-evaluation-cpp 21.5314 "Evaluations of functions at arbitrary points."
+(2013, 7, 29, 1, 46, 28) function-extrapolation-python 3.38748 "BENCH:  1.08705210686"
+(2013, 7, 29, 1, 46, 28) function-extrapolation-python 1.08705 "BENCH:  1.08705210686"
+(2013, 7, 29, 1, 46, 30) function-interpolation-python 1.68298 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 29, 1, 46, 30) function-interpolation-python 0.977137 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 29, 1, 46, 58) la-vector-access-cpp 27.9328 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 29, 1, 47, 23) la-vector-assignment-cpp 25.1531 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 7, 31, 1, 26, 49) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9718 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 31, 1, 27, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5362 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 7, 31, 1, 27, 25) geometry-bounding_box_tree_build-cpp 13.8878 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 7, 31, 1, 27, 52) common-progress-cpp 27.652 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 7, 31, 1, 28, 21) common-timing-cpp 29.0704 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 7, 31, 1, 30, 9) fem-multicore-cpp 107.287 "Coloring mesh."
+(2013, 7, 31, 1, 32, 36) fem-assembly-cpp 147.742 "Assembly for various forms and backends"
+(2013, 7, 31, 1, 32, 49) fem-convergence-cpp 12.1113 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 7, 31, 1, 32, 50) fem-jit-python 0.00104589 "JIT compilation (in memory cache)"
+(2013, 7, 31, 1, 37, 58) fem-speedup-cpp 307.615 "Assembly/solve speedup running on 4 processors"
+(2013, 7, 31, 1, 37, 58) fem-speedup-cpp-assembly 6.55567 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 7, 31, 1, 37, 58) fem-speedup-cpp-solve 2.22618 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 7, 31, 1, 38, 19) mesh-refinement-cpp 19.8377 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 7, 31, 1, 38, 39) mesh-topology-cpp 19.1642 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 7, 31, 1, 39, 2) mesh-unitcube-cpp 23.8466 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 7, 31, 1, 39, 40) mesh-iteration-cpp 35.4885 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 7, 31, 1, 40, 2) function-evaluation-cpp 21.3148 "Evaluations of functions at arbitrary points."
+(2013, 7, 31, 1, 40, 2) function-evaluation-cpp 21.196 "Evaluations of functions at arbitrary points."
+(2013, 7, 31, 1, 40, 5) function-extrapolation-python 3.59531 "BENCH:  1.07835102081"
+(2013, 7, 31, 1, 40, 5) function-extrapolation-python 1.07835 "BENCH:  1.07835102081"
+(2013, 7, 31, 1, 40, 7) function-interpolation-python 1.66624 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 31, 1, 40, 7) function-interpolation-python 0.979514 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 7, 31, 1, 40, 35) la-vector-access-cpp 27.9492 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 7, 31, 1, 41, 0) la-vector-assignment-cpp 25.0869 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 1, 1, 39, 13) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.4727 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 1, 1, 39, 32) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3798 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 1, 1, 39, 48) geometry-bounding_box_tree_build-cpp 13.9167 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 1, 1, 40, 16) common-progress-cpp 27.6525 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 1, 1, 40, 45) common-timing-cpp 29.2722 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 1, 1, 42, 32) fem-multicore-cpp 106.555 "Coloring mesh."
+(2013, 8, 1, 1, 45, 0) fem-assembly-cpp 147.688 "Assembly for various forms and backends"
+(2013, 8, 1, 1, 45, 12) fem-convergence-cpp 12.0977 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 1, 1, 45, 14) fem-jit-python 0.0010354 "JIT compilation (in memory cache)"
+(2013, 8, 1, 1, 50, 19) fem-speedup-cpp 305.365 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 1, 1, 50, 19) fem-speedup-cpp-assembly 6.74386 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 1, 1, 50, 19) fem-speedup-cpp-solve 2.2743 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 1, 1, 50, 40) mesh-refinement-cpp 19.8651 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 1, 1, 50, 59) mesh-topology-cpp 19.1834 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 1, 1, 51, 23) mesh-unitcube-cpp 23.8155 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 1, 1, 52, 5) mesh-iteration-cpp 39.1078 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 1, 1, 52, 26) function-evaluation-cpp 21.4897 "Evaluations of functions at arbitrary points."
+(2013, 8, 1, 1, 52, 26) function-evaluation-cpp 21.3422 "Evaluations of functions at arbitrary points."
+(2013, 8, 1, 1, 52, 30) function-extrapolation-python 3.5455 "BENCH:  1.09359121323"
+(2013, 8, 1, 1, 52, 30) function-extrapolation-python 1.09359 "BENCH:  1.09359121323"
+(2013, 8, 1, 1, 52, 32) function-interpolation-python 1.70183 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 1, 1, 52, 32) function-interpolation-python 0.976344 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 1, 1, 52, 57) la-vector-access-cpp 24.974 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 1, 1, 53, 22) la-vector-assignment-cpp 25.3144 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 2, 1, 28, 52) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.3877 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 2, 1, 29, 11) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3117 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 2, 1, 29, 27) geometry-bounding_box_tree_build-cpp 13.8861 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 2, 1, 29, 55) common-progress-cpp 27.6521 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 2, 1, 30, 24) common-timing-cpp 28.4944 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 2, 1, 32, 10) fem-multicore-cpp 106.684 "Coloring mesh."
+(2013, 8, 2, 1, 34, 38) fem-assembly-cpp 147.827 "Assembly for various forms and backends"
+(2013, 8, 2, 1, 34, 50) fem-convergence-cpp 12.1092 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 2, 1, 34, 52) fem-jit-python 0.00102439 "JIT compilation (in memory cache)"
+(2013, 8, 2, 1, 39, 58) fem-speedup-cpp 305.712 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 2, 1, 39, 58) fem-speedup-cpp-assembly 6.49978 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 2, 1, 39, 58) fem-speedup-cpp-solve 2.29703 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 2, 1, 40, 18) mesh-refinement-cpp 19.8816 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 2, 1, 40, 38) mesh-topology-cpp 19.2233 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 2, 1, 41, 2) mesh-unitcube-cpp 23.926 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 2, 1, 41, 48) mesh-iteration-cpp 44.1865 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 2, 1, 42, 10) function-evaluation-cpp 21.2475 "Evaluations of functions at arbitrary points."
+(2013, 8, 2, 1, 42, 10) function-evaluation-cpp 21.1655 "Evaluations of functions at arbitrary points."
+(2013, 8, 2, 1, 42, 13) function-extrapolation-python 3.45499 "BENCH:  1.0774269104"
+(2013, 8, 2, 1, 42, 13) function-extrapolation-python 1.07743 "BENCH:  1.0774269104"
+(2013, 8, 2, 1, 42, 15) function-interpolation-python 1.70972 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 2, 1, 42, 15) function-interpolation-python 0.992673 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 2, 1, 42, 40) la-vector-access-cpp 24.9398 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 2, 1, 43, 5) la-vector-assignment-cpp 25.0641 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 3, 1, 31, 14) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.4989 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 3, 1, 31, 32) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4774 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 3, 1, 31, 49) geometry-bounding_box_tree_build-cpp 13.9001 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 3, 1, 32, 17) common-progress-cpp 27.6714 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 3, 1, 32, 45) common-timing-cpp 28.8472 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 3, 1, 34, 32) fem-multicore-cpp 107.079 "Coloring mesh."
+(2013, 8, 3, 1, 37, 1) fem-assembly-cpp 148.654 "Assembly for various forms and backends"
+(2013, 8, 3, 1, 37, 13) fem-convergence-cpp 12.1355 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 3, 1, 37, 15) fem-jit-python 0.00103362 "JIT compilation (in memory cache)"
+(2013, 8, 3, 1, 42, 22) fem-speedup-cpp 306.73 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 3, 1, 42, 22) fem-speedup-cpp-assembly 6.56741 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 3, 1, 42, 22) fem-speedup-cpp-solve 2.28335 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 3, 1, 42, 43) mesh-refinement-cpp 19.8179 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 3, 1, 43, 3) mesh-topology-cpp 19.1521 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 3, 1, 43, 26) mesh-unitcube-cpp 23.881 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 3, 1, 44, 13) mesh-iteration-cpp 44.185 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 3, 1, 44, 35) function-evaluation-cpp 21.8312 "Evaluations of functions at arbitrary points."
+(2013, 8, 3, 1, 44, 35) function-evaluation-cpp 21.6971 "Evaluations of functions at arbitrary points."
+(2013, 8, 3, 1, 44, 38) function-extrapolation-python 3.52665 "BENCH:  1.07765603065"
+(2013, 8, 3, 1, 44, 38) function-extrapolation-python 1.07766 "BENCH:  1.07765603065"
+(2013, 8, 3, 1, 44, 40) function-interpolation-python 1.67445 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 3, 1, 44, 40) function-interpolation-python 0.969365 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 3, 1, 45, 5) la-vector-access-cpp 24.971 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 3, 1, 46, 1) la-vector-assignment-cpp 55.5208 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 4, 1, 41, 25) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.6843 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 4, 1, 41, 44) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3567 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 4, 1, 42, 0) geometry-bounding_box_tree_build-cpp 13.9098 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 4, 1, 42, 28) common-progress-cpp 27.6529 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 4, 1, 42, 57) common-timing-cpp 28.8279 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 4, 1, 44, 44) fem-multicore-cpp 106.909 "Coloring mesh."
+(2013, 8, 4, 1, 47, 12) fem-assembly-cpp 148.587 "Assembly for various forms and backends"
+(2013, 8, 4, 1, 47, 24) fem-convergence-cpp 12.1192 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 4, 1, 47, 26) fem-jit-python 0.00103061 "JIT compilation (in memory cache)"
+(2013, 8, 4, 1, 52, 34) fem-speedup-cpp 307.233 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 4, 1, 52, 34) fem-speedup-cpp-assembly 6.56102 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 4, 1, 52, 34) fem-speedup-cpp-solve 2.22183 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 4, 1, 52, 54) mesh-refinement-cpp 19.835 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 4, 1, 53, 13) mesh-topology-cpp 19.1706 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 4, 1, 53, 38) mesh-unitcube-cpp 24.1551 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 4, 1, 54, 24) mesh-iteration-cpp 43.553 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 4, 1, 54, 45) function-evaluation-cpp 21.1334 "Evaluations of functions at arbitrary points."
+(2013, 8, 4, 1, 54, 45) function-evaluation-cpp 21.0477 "Evaluations of functions at arbitrary points."
+(2013, 8, 4, 1, 54, 48) function-extrapolation-python 3.39345 "BENCH:  1.08501887321"
+(2013, 8, 4, 1, 54, 48) function-extrapolation-python 1.08502 "BENCH:  1.08501887321"
+(2013, 8, 4, 1, 54, 50) function-interpolation-python 1.67907 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 4, 1, 54, 50) function-interpolation-python 0.961259 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 4, 1, 55, 15) la-vector-access-cpp 24.9584 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 4, 1, 55, 40) la-vector-assignment-cpp 25.0679 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 5, 1, 25, 48) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.7885 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 5, 1, 26, 7) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4096 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 5, 1, 26, 23) geometry-bounding_box_tree_build-cpp 13.8964 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 5, 1, 26, 51) common-progress-cpp 27.6527 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 5, 1, 27, 20) common-timing-cpp 28.7543 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 5, 1, 29, 7) fem-multicore-cpp 106.983 "Coloring mesh."
+(2013, 8, 5, 1, 31, 35) fem-assembly-cpp 147.844 "Assembly for various forms and backends"
+(2013, 8, 5, 1, 31, 47) fem-convergence-cpp 12.1354 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 5, 1, 31, 49) fem-jit-python 0.00102918 "JIT compilation (in memory cache)"
+(2013, 8, 5, 1, 36, 55) fem-speedup-cpp 305.959 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 5, 1, 36, 55) fem-speedup-cpp-assembly 6.53383 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 5, 1, 36, 55) fem-speedup-cpp-solve 2.27532 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 5, 1, 37, 15) mesh-refinement-cpp 19.8757 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 5, 1, 37, 34) mesh-topology-cpp 19.1757 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 5, 1, 37, 58) mesh-unitcube-cpp 23.9099 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 5, 1, 38, 36) mesh-iteration-cpp 35.4793 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 5, 1, 38, 58) function-evaluation-cpp 21.263 "Evaluations of functions at arbitrary points."
+(2013, 8, 5, 1, 38, 58) function-evaluation-cpp 21.1828 "Evaluations of functions at arbitrary points."
+(2013, 8, 5, 1, 39, 1) function-extrapolation-python 3.40403 "BENCH:  1.0744330883"
+(2013, 8, 5, 1, 39, 1) function-extrapolation-python 1.07443 "BENCH:  1.0744330883"
+(2013, 8, 5, 1, 39, 3) function-interpolation-python 1.68084 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 5, 1, 39, 3) function-interpolation-python 0.968702 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 5, 1, 39, 28) la-vector-access-cpp 24.9795 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 5, 1, 39, 53) la-vector-assignment-cpp 25.0686 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 6, 1, 35, 25) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.831 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 6, 1, 35, 44) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2973 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 6, 1, 36, 0) geometry-bounding_box_tree_build-cpp 13.8768 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 6, 1, 36, 28) common-progress-cpp 27.6525 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 6, 1, 36, 57) common-timing-cpp 28.669 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 6, 1, 38, 44) fem-multicore-cpp 107.62 "Coloring mesh."
+(2013, 8, 6, 1, 41, 13) fem-assembly-cpp 148.393 "Assembly for various forms and backends"
+(2013, 8, 6, 1, 41, 25) fem-convergence-cpp 12.1228 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 6, 1, 41, 27) fem-jit-python 0.00102811 "JIT compilation (in memory cache)"
+(2013, 8, 6, 1, 46, 35) fem-speedup-cpp 308.59 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 6, 1, 46, 35) fem-speedup-cpp-assembly 6.54911 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 6, 1, 46, 35) fem-speedup-cpp-solve 2.21345 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 6, 1, 46, 56) mesh-refinement-cpp 19.8853 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 6, 1, 47, 15) mesh-topology-cpp 19.3026 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 6, 1, 47, 39) mesh-unitcube-cpp 23.9211 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 6, 1, 48, 17) mesh-iteration-cpp 35.5593 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 6, 1, 48, 39) function-evaluation-cpp 21.3737 "Evaluations of functions at arbitrary points."
+(2013, 8, 6, 1, 48, 39) function-evaluation-cpp 21.2876 "Evaluations of functions at arbitrary points."
+(2013, 8, 6, 1, 48, 42) function-extrapolation-python 3.49559 "BENCH:  1.08021306992"
+(2013, 8, 6, 1, 48, 42) function-extrapolation-python 1.08021 "BENCH:  1.08021306992"
+(2013, 8, 6, 1, 48, 44) function-interpolation-python 1.70168 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 6, 1, 48, 44) function-interpolation-python 0.96744 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 6, 1, 49, 12) la-vector-access-cpp 27.9191 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 6, 1, 49, 37) la-vector-assignment-cpp 25.026 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 7, 1, 38, 19) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.6532 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 7, 1, 38, 38) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5974 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 7, 1, 38, 54) geometry-bounding_box_tree_build-cpp 13.9513 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 7, 1, 39, 27) common-progress-cpp 32.72 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 7, 1, 39, 56) common-timing-cpp 29.6147 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 7, 1, 41, 44) fem-multicore-cpp 107.075 "Coloring mesh."
+(2013, 8, 7, 1, 44, 12) fem-assembly-cpp 148.323 "Assembly for various forms and backends"
+(2013, 8, 7, 1, 44, 24) fem-convergence-cpp 12.128 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 7, 1, 44, 26) fem-jit-python 0.0010227 "JIT compilation (in memory cache)"
+(2013, 8, 7, 1, 49, 31) fem-speedup-cpp 305.171 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 7, 1, 49, 31) fem-speedup-cpp-assembly 6.54031 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 7, 1, 49, 31) fem-speedup-cpp-solve 2.22884 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 7, 1, 49, 53) mesh-refinement-cpp 19.859 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 7, 1, 50, 12) mesh-topology-cpp 19.145 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 7, 1, 50, 36) mesh-unitcube-cpp 23.9015 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 7, 1, 51, 14) mesh-iteration-cpp 35.4751 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 7, 1, 51, 35) function-evaluation-cpp 21.1654 "Evaluations of functions at arbitrary points."
+(2013, 8, 7, 1, 51, 35) function-evaluation-cpp 21.03 "Evaluations of functions at arbitrary points."
+(2013, 8, 7, 1, 51, 38) function-extrapolation-python 3.33722 "BENCH:  1.06779313087"
+(2013, 8, 7, 1, 51, 38) function-extrapolation-python 1.06779 "BENCH:  1.06779313087"
+(2013, 8, 7, 1, 51, 40) function-interpolation-python 1.6575 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 7, 1, 51, 40) function-interpolation-python 0.967171 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 7, 1, 52, 8) la-vector-access-cpp 27.9762 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 7, 1, 52, 33) la-vector-assignment-cpp 25.0818 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 8, 1, 39, 7) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.5775 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 8, 1, 39, 26) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4071 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 8, 1, 39, 42) geometry-bounding_box_tree_build-cpp 13.9409 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 8, 1, 40, 10) common-progress-cpp 27.6519 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 8, 1, 40, 39) common-timing-cpp 28.7396 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 8, 1, 42, 25) fem-multicore-cpp 106.911 "Coloring mesh."
+(2013, 8, 8, 1, 44, 54) fem-assembly-cpp 148.626 "Assembly for various forms and backends"
+(2013, 8, 8, 1, 45, 6) fem-convergence-cpp 12.1204 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 8, 1, 45, 8) fem-jit-python 0.0010474 "JIT compilation (in memory cache)"
+(2013, 8, 8, 1, 50, 15) fem-speedup-cpp 307.236 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 8, 1, 50, 15) fem-speedup-cpp-assembly 6.50746 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 8, 1, 50, 15) fem-speedup-cpp-solve 2.26756 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 8, 1, 50, 39) mesh-refinement-cpp 19.8766 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 8, 1, 50, 58) mesh-topology-cpp 19.1145 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 8, 1, 51, 22) mesh-unitcube-cpp 23.8653 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 8, 1, 52, 0) mesh-iteration-cpp 35.4708 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 8, 1, 52, 21) function-evaluation-cpp 21.2067 "Evaluations of functions at arbitrary points."
+(2013, 8, 8, 1, 52, 21) function-evaluation-cpp 21.0854 "Evaluations of functions at arbitrary points."
+(2013, 8, 8, 1, 52, 24) function-extrapolation-python 3.37869 "BENCH:  1.0582280159"
+(2013, 8, 8, 1, 52, 24) function-extrapolation-python 1.05823 "BENCH:  1.0582280159"
+(2013, 8, 8, 1, 52, 26) function-interpolation-python 1.66341 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 8, 1, 52, 26) function-interpolation-python 0.967375 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 8, 1, 52, 54) la-vector-access-cpp 27.9801 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 8, 1, 53, 19) la-vector-assignment-cpp 25.075 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 9, 1, 38, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.97718 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 9, 1, 38, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4435 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 9, 1, 39, 13) geometry-bounding_box_tree_build-cpp 13.959 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 9, 1, 39, 40) common-progress-cpp 27.6523 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 9, 1, 40, 10) common-timing-cpp 29.978 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 9, 1, 41, 58) fem-multicore-cpp 107.297 "Coloring mesh."
+(2013, 8, 9, 1, 44, 26) fem-assembly-cpp 148.325 "Assembly for various forms and backends"
+(2013, 8, 9, 1, 44, 38) fem-convergence-cpp 12.1115 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 9, 1, 44, 40) fem-jit-python 0.00103259 "JIT compilation (in memory cache)"
+(2013, 8, 9, 1, 49, 47) fem-speedup-cpp 307.202 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 9, 1, 49, 47) fem-speedup-cpp-assembly 6.52362 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 9, 1, 49, 47) fem-speedup-cpp-solve 2.23068 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 9, 1, 50, 9) mesh-refinement-cpp 20.0758 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 9, 1, 50, 28) mesh-topology-cpp 19.1616 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 9, 1, 50, 53) mesh-unitcube-cpp 24.3457 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 9, 1, 51, 39) mesh-iteration-cpp 44.1844 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 9, 1, 52, 1) function-evaluation-cpp 21.1735 "Evaluations of functions at arbitrary points."
+(2013, 8, 9, 1, 52, 1) function-evaluation-cpp 21.0478 "Evaluations of functions at arbitrary points."
+(2013, 8, 9, 1, 52, 4) function-extrapolation-python 3.36801 "BENCH:  1.06341600418"
+(2013, 8, 9, 1, 52, 4) function-extrapolation-python 1.06342 "BENCH:  1.06341600418"
+(2013, 8, 9, 1, 52, 6) function-interpolation-python 1.69133 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 9, 1, 52, 6) function-interpolation-python 1.00928 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 9, 1, 52, 34) la-vector-access-cpp 27.9606 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 9, 1, 52, 59) la-vector-assignment-cpp 25.0921 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 10, 1, 28, 30) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0617 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 10, 1, 28, 49) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5376 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 10, 1, 29, 6) geometry-bounding_box_tree_build-cpp 13.9398 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 10, 1, 29, 33) common-progress-cpp 27.711 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 10, 1, 30, 3) common-timing-cpp 29.5057 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 10, 1, 31, 50) fem-multicore-cpp 107.191 "Coloring mesh."
+(2013, 8, 10, 1, 34, 19) fem-assembly-cpp 148.787 "Assembly for various forms and backends"
+(2013, 8, 10, 1, 34, 31) fem-convergence-cpp 12.1214 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 10, 1, 34, 33) fem-jit-python 0.00102639 "JIT compilation (in memory cache)"
+(2013, 8, 10, 1, 39, 41) fem-speedup-cpp 308.48 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 10, 1, 39, 41) fem-speedup-cpp-assembly 6.56523 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 10, 1, 39, 41) fem-speedup-cpp-solve 2.21603 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 10, 1, 40, 3) mesh-refinement-cpp 19.9983 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 10, 1, 40, 22) mesh-topology-cpp 19.185 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 10, 1, 40, 47) mesh-unitcube-cpp 24.3062 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 10, 1, 41, 26) mesh-iteration-cpp 36.7437 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 10, 1, 41, 47) function-evaluation-cpp 21.1904 "Evaluations of functions at arbitrary points."
+(2013, 8, 10, 1, 41, 47) function-evaluation-cpp 21.0738 "Evaluations of functions at arbitrary points."
+(2013, 8, 10, 1, 41, 51) function-extrapolation-python 3.4954 "BENCH:  1.07068109512"
+(2013, 8, 10, 1, 41, 51) function-extrapolation-python 1.07068 "BENCH:  1.07068109512"
+(2013, 8, 10, 1, 41, 52) function-interpolation-python 1.68025 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 10, 1, 41, 52) function-interpolation-python 0.998028 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 10, 1, 42, 17) la-vector-access-cpp 24.9651 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 10, 1, 42, 42) la-vector-assignment-cpp 25.0923 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 11, 1, 28, 20) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1327 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 11, 1, 28, 39) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4899 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 11, 1, 28, 55) geometry-bounding_box_tree_build-cpp 13.9146 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 11, 1, 29, 23) common-progress-cpp 27.6527 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 11, 1, 29, 52) common-timing-cpp 29.3516 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 11, 1, 31, 39) fem-multicore-cpp 107.135 "Coloring mesh."
+(2013, 8, 11, 1, 34, 8) fem-assembly-cpp 148.826 "Assembly for various forms and backends"
+(2013, 8, 11, 1, 34, 20) fem-convergence-cpp 12.1183 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 11, 1, 34, 22) fem-jit-python 0.00103371 "JIT compilation (in memory cache)"
+(2013, 8, 11, 1, 39, 32) fem-speedup-cpp 309.779 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 11, 1, 39, 32) fem-speedup-cpp-assembly 6.5308 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 11, 1, 39, 32) fem-speedup-cpp-solve 2.19844 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 11, 1, 39, 54) mesh-refinement-cpp 19.9707 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 11, 1, 40, 13) mesh-topology-cpp 19.1777 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 11, 1, 40, 38) mesh-unitcube-cpp 24.3165 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 11, 1, 41, 16) mesh-iteration-cpp 36.0375 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 11, 1, 41, 38) function-evaluation-cpp 21.1652 "Evaluations of functions at arbitrary points."
+(2013, 8, 11, 1, 41, 38) function-evaluation-cpp 21.0418 "Evaluations of functions at arbitrary points."
+(2013, 8, 11, 1, 41, 41) function-extrapolation-python 3.39699 "BENCH:  1.05698800087"
+(2013, 8, 11, 1, 41, 41) function-extrapolation-python 1.05699 "BENCH:  1.05698800087"
+(2013, 8, 11, 1, 41, 43) function-interpolation-python 1.688 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 11, 1, 41, 43) function-interpolation-python 0.992373 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 11, 1, 42, 8) la-vector-access-cpp 24.9549 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 11, 1, 42, 35) la-vector-assignment-cpp 27.0904 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 12, 1, 29, 19) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2828 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 12, 1, 29, 38) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6988 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 12, 1, 29, 54) geometry-bounding_box_tree_build-cpp 13.8845 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 12, 1, 30, 22) common-progress-cpp 27.6521 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 12, 1, 30, 53) common-timing-cpp 30.9291 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 12, 1, 32, 40) fem-multicore-cpp 107.116 "Coloring mesh."
+(2013, 8, 12, 1, 35, 11) fem-assembly-cpp 150.797 "Assembly for various forms and backends"
+(2013, 8, 12, 1, 35, 23) fem-convergence-cpp 12.1069 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 12, 1, 35, 25) fem-jit-python 0.00104201 "JIT compilation (in memory cache)"
+(2013, 8, 12, 1, 40, 30) fem-speedup-cpp 305.437 "Assembly/solve speedup running on 4 processors"
+(2013, 8, 12, 1, 40, 30) fem-speedup-cpp-assembly 6.58536 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2013, 8, 12, 1, 40, 30) fem-speedup-cpp-solve 2.25804 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2013, 8, 12, 1, 40, 51) mesh-refinement-cpp 19.969 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 12, 1, 41, 10) mesh-topology-cpp 19.078 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 12, 1, 41, 34) mesh-unitcube-cpp 24.2732 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 12, 1, 42, 16) mesh-iteration-cpp 39.1608 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 12, 1, 42, 38) function-evaluation-cpp 21.5864 "Evaluations of functions at arbitrary points."
+(2013, 8, 12, 1, 42, 38) function-evaluation-cpp 21.5077 "Evaluations of functions at arbitrary points."
+(2013, 8, 12, 1, 42, 41) function-extrapolation-python 3.45743 "BENCH:  1.06352710724"
+(2013, 8, 12, 1, 42, 41) function-extrapolation-python 1.06353 "BENCH:  1.06352710724"
+(2013, 8, 12, 1, 42, 43) function-interpolation-python 1.73152 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 12, 1, 42, 43) function-interpolation-python 0.999738 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 12, 1, 43, 6) la-vector-access-cpp 23.4342 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 12, 1, 43, 31) la-vector-assignment-cpp 25.0658 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 13, 1, 30, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0241 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 13, 1, 30, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4037 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 13, 1, 31, 7) geometry-bounding_box_tree_build-cpp 13.9484 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 13, 1, 31, 35) common-progress-cpp 27.6525 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 13, 1, 32, 5) common-timing-cpp 29.6965 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 13, 1, 33, 52) fem-multicore-cpp 107.115 "Coloring mesh."
+(2013, 8, 13, 1, 36, 21) fem-assembly-cpp 149.547 "Assembly for various forms and backends"
+(2013, 8, 13, 1, 36, 34) fem-convergence-cpp 12.1174 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 13, 1, 36, 35) fem-jit-python 0.00102611 "JIT compilation (in memory cache)"
+(2013, 8, 13, 1, 42, 1) mesh-refinement-cpp 19.7741 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 13, 1, 42, 21) mesh-topology-cpp 19.069 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 13, 1, 42, 45) mesh-unitcube-cpp 23.9753 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 13, 1, 43, 23) mesh-iteration-cpp 35.5453 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 13, 1, 43, 45) function-evaluation-cpp 21.989 "Evaluations of functions at arbitrary points."
+(2013, 8, 13, 1, 43, 45) function-evaluation-cpp 21.9033 "Evaluations of functions at arbitrary points."
+(2013, 8, 13, 1, 43, 48) function-extrapolation-python 3.45407 "BENCH:  1.06975007057"
+(2013, 8, 13, 1, 43, 48) function-extrapolation-python 1.06975 "BENCH:  1.06975007057"
+(2013, 8, 13, 1, 43, 50) function-interpolation-python 1.70201 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 13, 1, 43, 50) function-interpolation-python 0.993179 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 13, 1, 44, 15) la-vector-access-cpp 25.4377 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 13, 1, 44, 44) la-vector-assignment-cpp 29.099 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 14, 1, 34, 3) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1619 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 14, 1, 34, 22) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4298 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 14, 1, 34, 38) geometry-bounding_box_tree_build-cpp 13.9632 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 14, 1, 35, 6) common-progress-cpp 27.6528 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 14, 1, 35, 36) common-timing-cpp 30.0964 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 14, 1, 37, 24) fem-multicore-cpp 107.553 "Coloring mesh."
+(2013, 8, 14, 1, 39, 53) fem-assembly-cpp 149.226 "Assembly for various forms and backends"
+(2013, 8, 14, 1, 40, 5) fem-convergence-cpp 12.119 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 14, 1, 40, 7) fem-jit-python 0.00104291 "JIT compilation (in memory cache)"
+(2013, 8, 14, 1, 45, 34) mesh-refinement-cpp 19.6692 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 14, 1, 45, 53) mesh-topology-cpp 19.0427 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 14, 1, 46, 17) mesh-unitcube-cpp 24.1043 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 14, 1, 46, 59) mesh-iteration-cpp 39.1619 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 14, 1, 47, 20) function-evaluation-cpp 21.1819 "Evaluations of functions at arbitrary points."
+(2013, 8, 14, 1, 47, 20) function-evaluation-cpp 21.0348 "Evaluations of functions at arbitrary points."
+(2013, 8, 14, 1, 47, 24) function-extrapolation-python 3.54554 "BENCH:  1.07405281067"
+(2013, 8, 14, 1, 47, 24) function-extrapolation-python 1.07405 "BENCH:  1.07405281067"
+(2013, 8, 14, 1, 47, 25) function-interpolation-python 1.68059 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 14, 1, 47, 25) function-interpolation-python 0.985128 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 14, 1, 47, 49) la-vector-access-cpp 23.4845 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 14, 1, 48, 16) la-vector-assignment-cpp 27.0837 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 15, 1, 35, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0388 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 15, 1, 35, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5463 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 15, 1, 36, 13) geometry-bounding_box_tree_build-cpp 13.949 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 15, 1, 36, 40) common-progress-cpp 27.6926 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 15, 1, 37, 10) common-timing-cpp 29.5317 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 15, 1, 38, 57) fem-multicore-cpp 107.211 "Coloring mesh."
+(2013, 8, 15, 1, 41, 26) fem-assembly-cpp 149.318 "Assembly for various forms and backends"
+(2013, 8, 15, 1, 41, 39) fem-convergence-cpp 12.1089 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 15, 1, 41, 40) fem-jit-python 0.00103989 "JIT compilation (in memory cache)"
+(2013, 8, 15, 1, 47, 7) mesh-refinement-cpp 19.6627 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 15, 1, 47, 26) mesh-topology-cpp 19.0479 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 15, 1, 47, 50) mesh-unitcube-cpp 23.9587 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 15, 1, 48, 28) mesh-iteration-cpp 35.5438 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 15, 1, 48, 50) function-evaluation-cpp 21.4899 "Evaluations of functions at arbitrary points."
+(2013, 8, 15, 1, 48, 50) function-evaluation-cpp 21.3608 "Evaluations of functions at arbitrary points."
+(2013, 8, 15, 1, 48, 53) function-extrapolation-python 3.42887 "BENCH:  1.06464219093"
+(2013, 8, 15, 1, 48, 53) function-extrapolation-python 1.06464 "BENCH:  1.06464219093"
+(2013, 8, 15, 1, 48, 55) function-interpolation-python 1.68364 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 15, 1, 48, 55) function-interpolation-python 0.987284 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 15, 1, 49, 18) la-vector-access-cpp 23.4684 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 15, 1, 49, 46) la-vector-assignment-cpp 28.1084 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 16, 1, 30, 1) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.157 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 16, 1, 30, 20) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5268 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 16, 1, 30, 37) geometry-bounding_box_tree_build-cpp 13.9169 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 16, 1, 31, 4) common-progress-cpp 27.6528 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 16, 1, 31, 34) common-timing-cpp 29.8024 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 16, 1, 33, 22) fem-multicore-cpp 107.582 "Coloring mesh."
+(2013, 8, 16, 1, 35, 51) fem-assembly-cpp 149.686 "Assembly for various forms and backends"
+(2013, 8, 16, 1, 36, 3) fem-convergence-cpp 12.1138 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 16, 1, 36, 5) fem-jit-python 0.0010246 "JIT compilation (in memory cache)"
+(2013, 8, 16, 1, 41, 32) mesh-refinement-cpp 19.7091 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 16, 1, 41, 52) mesh-topology-cpp 19.0539 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 16, 1, 42, 16) mesh-unitcube-cpp 24.0192 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 16, 1, 42, 57) mesh-iteration-cpp 39.1605 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 16, 1, 43, 19) function-evaluation-cpp 21.4923 "Evaluations of functions at arbitrary points."
+(2013, 8, 16, 1, 43, 19) function-evaluation-cpp 21.4079 "Evaluations of functions at arbitrary points."
+(2013, 8, 16, 1, 43, 22) function-extrapolation-python 3.45402 "BENCH:  1.0782160759"
+(2013, 8, 16, 1, 43, 22) function-extrapolation-python 1.07822 "BENCH:  1.0782160759"
+(2013, 8, 16, 1, 43, 24) function-interpolation-python 1.70071 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 16, 1, 43, 24) function-interpolation-python 0.980738 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 16, 1, 43, 47) la-vector-access-cpp 23.4338 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 16, 1, 44, 14) la-vector-assignment-cpp 26.9666 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 17, 1, 37, 34) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1059 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 17, 1, 37, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6572 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 17, 1, 38, 10) geometry-bounding_box_tree_build-cpp 13.9366 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 17, 1, 38, 37) common-progress-cpp 27.6529 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 17, 1, 39, 7) common-timing-cpp 29.6877 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 17, 1, 40, 54) fem-multicore-cpp 107.153 "Coloring mesh."
+(2013, 8, 17, 1, 43, 24) fem-assembly-cpp 149.321 "Assembly for various forms and backends"
+(2013, 8, 17, 1, 43, 36) fem-convergence-cpp 12.1125 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 17, 1, 43, 38) fem-jit-python 0.0010309 "JIT compilation (in memory cache)"
+(2013, 8, 17, 1, 49, 5) mesh-refinement-cpp 19.7317 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 17, 1, 49, 24) mesh-topology-cpp 19.1088 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 17, 1, 49, 48) mesh-unitcube-cpp 23.9583 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 17, 1, 50, 26) mesh-iteration-cpp 35.5424 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 17, 1, 50, 47) function-evaluation-cpp 21.1737 "Evaluations of functions at arbitrary points."
+(2013, 8, 17, 1, 50, 47) function-evaluation-cpp 21.0623 "Evaluations of functions at arbitrary points."
+(2013, 8, 17, 1, 50, 50) function-extrapolation-python 3.42052 "BENCH:  1.05454802513"
+(2013, 8, 17, 1, 50, 50) function-extrapolation-python 1.05455 "BENCH:  1.05454802513"
+(2013, 8, 17, 1, 50, 52) function-interpolation-python 1.66117 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 17, 1, 50, 52) function-interpolation-python 0.981249 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 17, 1, 51, 16) la-vector-access-cpp 23.4603 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 17, 1, 51, 43) la-vector-assignment-cpp 27.0856 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 18, 1, 34, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0011 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 18, 1, 34, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5313 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 18, 1, 35, 16) geometry-bounding_box_tree_build-cpp 13.8817 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 18, 1, 35, 43) common-progress-cpp 27.6526 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 18, 1, 36, 13) common-timing-cpp 29.8438 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 18, 1, 38, 1) fem-multicore-cpp 107.524 "Coloring mesh."
+(2013, 8, 18, 1, 40, 30) fem-assembly-cpp 149.51 "Assembly for various forms and backends"
+(2013, 8, 18, 1, 40, 42) fem-convergence-cpp 12.1168 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 18, 1, 40, 44) fem-jit-python 0.00102959 "JIT compilation (in memory cache)"
+(2013, 8, 18, 1, 46, 11) mesh-refinement-cpp 19.7557 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 18, 1, 46, 30) mesh-topology-cpp 19.0728 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 18, 1, 46, 54) mesh-unitcube-cpp 23.9239 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 18, 1, 47, 32) mesh-iteration-cpp 35.5647 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 18, 1, 47, 53) function-evaluation-cpp 21.1502 "Evaluations of functions at arbitrary points."
+(2013, 8, 18, 1, 47, 53) function-evaluation-cpp 21.0625 "Evaluations of functions at arbitrary points."
+(2013, 8, 18, 1, 47, 57) function-extrapolation-python 3.39587 "BENCH:  1.07850408554"
+(2013, 8, 18, 1, 47, 57) function-extrapolation-python 1.0785 "BENCH:  1.07850408554"
+(2013, 8, 18, 1, 47, 58) function-interpolation-python 1.71663 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 18, 1, 47, 58) function-interpolation-python 0.991286 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 18, 1, 48, 22) la-vector-access-cpp 23.4148 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 18, 1, 48, 50) la-vector-assignment-cpp 28.0935 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 19, 1, 33, 21) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0347 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 19, 1, 33, 40) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5302 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 19, 1, 33, 57) geometry-bounding_box_tree_build-cpp 13.959 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 19, 1, 34, 24) common-progress-cpp 27.6894 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 19, 1, 34, 54) common-timing-cpp 29.7698 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 19, 1, 36, 42) fem-multicore-cpp 107.61 "Coloring mesh."
+(2013, 8, 19, 1, 39, 11) fem-assembly-cpp 149.545 "Assembly for various forms and backends"
+(2013, 8, 19, 1, 39, 23) fem-convergence-cpp 12.1109 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 19, 1, 39, 25) fem-jit-python 0.0010288 "JIT compilation (in memory cache)"
+(2013, 8, 19, 1, 44, 56) mesh-refinement-cpp 19.7029 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 19, 1, 45, 15) mesh-topology-cpp 19.0506 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 19, 1, 45, 39) mesh-unitcube-cpp 23.8949 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 19, 1, 46, 17) mesh-iteration-cpp 35.5753 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 19, 1, 46, 38) function-evaluation-cpp 21.3738 "Evaluations of functions at arbitrary points."
+(2013, 8, 19, 1, 46, 38) function-evaluation-cpp 21.2511 "Evaluations of functions at arbitrary points."
+(2013, 8, 19, 1, 46, 42) function-extrapolation-python 3.36224 "BENCH:  1.0701379776"
+(2013, 8, 19, 1, 46, 42) function-extrapolation-python 1.07014 "BENCH:  1.0701379776"
+(2013, 8, 19, 1, 46, 44) function-interpolation-python 1.68547 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 19, 1, 46, 44) function-interpolation-python 0.994866 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 19, 1, 47, 9) la-vector-access-cpp 25.4601 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 19, 1, 47, 36) la-vector-assignment-cpp 27.0887 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 20, 1, 33, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2098 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 20, 1, 33, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6292 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 20, 1, 33, 59) geometry-bounding_box_tree_build-cpp 13.936 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 20, 1, 34, 26) common-progress-cpp 27.6523 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 20, 1, 34, 56) common-timing-cpp 29.9126 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 20, 1, 36, 43) fem-multicore-cpp 107.315 "Coloring mesh."
+(2013, 8, 20, 1, 39, 13) fem-assembly-cpp 149.665 "Assembly for various forms and backends"
+(2013, 8, 20, 1, 39, 25) fem-convergence-cpp 12.1433 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 20, 1, 39, 27) fem-jit-python 0.00102808 "JIT compilation (in memory cache)"
+(2013, 8, 20, 1, 44, 54) mesh-refinement-cpp 19.688 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 20, 1, 45, 13) mesh-topology-cpp 19.0522 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 20, 1, 45, 37) mesh-unitcube-cpp 24.3722 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 20, 1, 46, 15) mesh-iteration-cpp 35.5501 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 20, 1, 46, 36) function-evaluation-cpp 21.2071 "Evaluations of functions at arbitrary points."
+(2013, 8, 20, 1, 46, 36) function-evaluation-cpp 21.047 "Evaluations of functions at arbitrary points."
+(2013, 8, 20, 1, 46, 40) function-extrapolation-python 3.39304 "BENCH:  1.07953190804"
+(2013, 8, 20, 1, 46, 40) function-extrapolation-python 1.07953 "BENCH:  1.07953190804"
+(2013, 8, 20, 1, 46, 42) function-interpolation-python 1.66658 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 20, 1, 46, 42) function-interpolation-python 0.97045 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 20, 1, 47, 7) la-vector-access-cpp 25.4608 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 20, 1, 47, 34) la-vector-assignment-cpp 27.0924 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 21, 1, 34, 16) geometry-bounding_box_tree_compute_entity_collisions-cpp 9.97891 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 21, 1, 34, 35) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4209 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 21, 1, 34, 51) geometry-bounding_box_tree_build-cpp 13.9314 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 21, 1, 35, 19) common-progress-cpp 27.6531 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 21, 1, 35, 48) common-timing-cpp 29.5588 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 21, 1, 37, 36) fem-multicore-cpp 107.83 "Coloring mesh."
+(2013, 8, 21, 1, 40, 5) fem-assembly-cpp 149.148 "Assembly for various forms and backends"
+(2013, 8, 21, 1, 40, 18) fem-convergence-cpp 12.1096 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 21, 1, 40, 19) fem-jit-python 0.0010334 "JIT compilation (in memory cache)"
+(2013, 8, 21, 1, 45, 47) mesh-refinement-cpp 19.7165 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 21, 1, 46, 6) mesh-topology-cpp 19.1289 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 21, 1, 46, 30) mesh-unitcube-cpp 23.9397 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 21, 1, 47, 8) mesh-iteration-cpp 35.5482 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 21, 1, 47, 29) function-evaluation-cpp 21.152 "Evaluations of functions at arbitrary points."
+(2013, 8, 21, 1, 47, 29) function-evaluation-cpp 21.0574 "Evaluations of functions at arbitrary points."
+(2013, 8, 21, 1, 47, 33) function-extrapolation-python 3.43729 "BENCH:  1.07766795158"
+(2013, 8, 21, 1, 47, 33) function-extrapolation-python 1.07767 "BENCH:  1.07766795158"
+(2013, 8, 21, 1, 47, 34) function-interpolation-python 1.68293 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 21, 1, 47, 34) function-interpolation-python 0.98242 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 21, 1, 47, 58) la-vector-access-cpp 23.4316 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 21, 1, 48, 25) la-vector-assignment-cpp 27.0692 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 22, 1, 41, 13) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1633 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 22, 1, 41, 32) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5437 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 22, 1, 41, 48) geometry-bounding_box_tree_build-cpp 13.9018 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 22, 1, 42, 16) common-progress-cpp 27.6528 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 22, 1, 42, 45) common-timing-cpp 29.7343 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 22, 1, 44, 33) fem-multicore-cpp 107.339 "Coloring mesh."
+(2013, 8, 22, 1, 47, 1) fem-assembly-cpp 147.821 "Assembly for various forms and backends"
+(2013, 8, 22, 1, 47, 13) fem-convergence-cpp 12.1131 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 22, 1, 47, 14) fem-jit-python 0.00101988 "JIT compilation (in memory cache)"
+(2013, 8, 22, 1, 52, 42) mesh-refinement-cpp 19.8313 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 22, 1, 53, 1) mesh-topology-cpp 19.1747 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 22, 1, 53, 25) mesh-unitcube-cpp 24.0708 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 22, 1, 54, 3) mesh-iteration-cpp 35.4753 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 22, 1, 54, 24) function-evaluation-cpp 21.161 "Evaluations of functions at arbitrary points."
+(2013, 8, 22, 1, 54, 24) function-evaluation-cpp 21.0795 "Evaluations of functions at arbitrary points."
+(2013, 8, 22, 1, 54, 28) function-extrapolation-python 3.44571 "BENCH:  1.06874084473"
+(2013, 8, 22, 1, 54, 28) function-extrapolation-python 1.06874 "BENCH:  1.06874084473"
+(2013, 8, 22, 1, 54, 29) function-interpolation-python 1.71545 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 22, 1, 54, 29) function-interpolation-python 0.98559 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 22, 1, 54, 53) la-vector-access-cpp 23.4312 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 22, 1, 55, 20) la-vector-assignment-cpp 27.073 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 23, 1, 28, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.242 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 23, 1, 28, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5556 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 23, 1, 29, 15) geometry-bounding_box_tree_build-cpp 14.0003 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 23, 1, 29, 43) common-progress-cpp 27.653 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 23, 1, 30, 13) common-timing-cpp 29.5955 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 23, 1, 31, 59) fem-multicore-cpp 106.916 "Coloring mesh."
+(2013, 8, 23, 1, 34, 28) fem-assembly-cpp 148.097 "Assembly for various forms and backends"
+(2013, 8, 23, 1, 34, 40) fem-convergence-cpp 12.1088 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 23, 1, 34, 42) fem-jit-python 0.00104151 "JIT compilation (in memory cache)"
+(2013, 8, 23, 1, 40, 12) mesh-refinement-cpp 19.8325 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 23, 1, 40, 32) mesh-topology-cpp 19.0871 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 23, 1, 40, 56) mesh-unitcube-cpp 23.9952 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 23, 1, 41, 34) mesh-iteration-cpp 35.4766 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 23, 1, 41, 55) function-evaluation-cpp 21.2071 "Evaluations of functions at arbitrary points."
+(2013, 8, 23, 1, 41, 55) function-evaluation-cpp 21.0508 "Evaluations of functions at arbitrary points."
+(2013, 8, 23, 1, 41, 58) function-extrapolation-python 3.54535 "BENCH:  1.09432315826"
+(2013, 8, 23, 1, 41, 58) function-extrapolation-python 1.09432 "BENCH:  1.09432315826"
+(2013, 8, 23, 1, 42, 0) function-interpolation-python 1.70435 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 23, 1, 42, 0) function-interpolation-python 0.997619 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 23, 1, 42, 24) la-vector-access-cpp 23.4479 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 23, 1, 42, 51) la-vector-assignment-cpp 27.0923 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 24, 1, 26, 21) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2205 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 24, 1, 26, 40) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5829 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 24, 1, 26, 57) geometry-bounding_box_tree_build-cpp 13.9053 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 24, 1, 27, 24) common-progress-cpp 27.653 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 24, 1, 27, 54) common-timing-cpp 29.9517 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 24, 1, 29, 42) fem-multicore-cpp 107.16 "Coloring mesh."
+(2013, 8, 24, 1, 32, 9) fem-assembly-cpp 147.87 "Assembly for various forms and backends"
+(2013, 8, 24, 1, 32, 22) fem-convergence-cpp 12.1414 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 24, 1, 32, 23) fem-jit-python 0.00104651 "JIT compilation (in memory cache)"
+(2013, 8, 24, 1, 37, 51) mesh-refinement-cpp 19.8106 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 24, 1, 38, 10) mesh-topology-cpp 19.028 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 24, 1, 38, 34) mesh-unitcube-cpp 24.0868 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 24, 1, 39, 12) mesh-iteration-cpp 35.4311 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 24, 1, 39, 34) function-evaluation-cpp 21.9966 "Evaluations of functions at arbitrary points."
+(2013, 8, 24, 1, 39, 34) function-evaluation-cpp 21.8937 "Evaluations of functions at arbitrary points."
+(2013, 8, 24, 1, 39, 38) function-extrapolation-python 3.63718 "BENCH:  1.0871860981"
+(2013, 8, 24, 1, 39, 38) function-extrapolation-python 1.08719 "BENCH:  1.0871860981"
+(2013, 8, 24, 1, 39, 39) function-interpolation-python 1.68271 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 24, 1, 39, 39) function-interpolation-python 0.965442 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 24, 1, 40, 3) la-vector-access-cpp 23.4306 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 24, 1, 40, 30) la-vector-assignment-cpp 27.0702 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 25, 1, 27, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2155 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 25, 1, 28, 6) geometry-bounding_box_tree_compute_closest_entity-cpp 15.556 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 25, 1, 28, 23) geometry-bounding_box_tree_build-cpp 13.9012 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 25, 1, 28, 50) common-progress-cpp 27.6527 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 25, 1, 29, 20) common-timing-cpp 30.2048 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 25, 1, 31, 8) fem-multicore-cpp 107.387 "Coloring mesh."
+(2013, 8, 25, 1, 33, 34) fem-assembly-cpp 146.65 "Assembly for various forms and backends"
+(2013, 8, 25, 1, 33, 47) fem-convergence-cpp 12.1122 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 25, 1, 33, 48) fem-jit-python 0.00102611 "JIT compilation (in memory cache)"
+(2013, 8, 25, 1, 39, 18) mesh-refinement-cpp 19.7606 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 25, 1, 39, 37) mesh-topology-cpp 19.0406 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 25, 1, 40, 1) mesh-unitcube-cpp 24.0438 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 25, 1, 40, 48) mesh-iteration-cpp 44.1876 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 25, 1, 41, 10) function-evaluation-cpp 22.0397 "Evaluations of functions at arbitrary points."
+(2013, 8, 25, 1, 41, 10) function-evaluation-cpp 21.917 "Evaluations of functions at arbitrary points."
+(2013, 8, 25, 1, 41, 14) function-extrapolation-python 3.64267 "BENCH:  1.06951498985"
+(2013, 8, 25, 1, 41, 14) function-extrapolation-python 1.06951 "BENCH:  1.06951498985"
+(2013, 8, 25, 1, 41, 15) function-interpolation-python 1.68502 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 25, 1, 41, 15) function-interpolation-python 0.970874 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 25, 1, 41, 39) la-vector-access-cpp 23.4612 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 25, 1, 42, 7) la-vector-assignment-cpp 28.1235 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 26, 1, 28, 8) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.159 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 26, 1, 28, 27) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5303 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 26, 1, 28, 43) geometry-bounding_box_tree_build-cpp 13.9238 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 26, 1, 29, 11) common-progress-cpp 27.6528 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 26, 1, 29, 41) common-timing-cpp 30.3243 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 26, 1, 31, 28) fem-multicore-cpp 106.721 "Coloring mesh."
+(2013, 8, 26, 1, 33, 55) fem-assembly-cpp 147.296 "Assembly for various forms and backends"
+(2013, 8, 26, 1, 34, 8) fem-convergence-cpp 12.1133 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 26, 1, 34, 9) fem-jit-python 0.00102899 "JIT compilation (in memory cache)"
+(2013, 8, 26, 1, 39, 38) mesh-refinement-cpp 19.7435 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 26, 1, 39, 57) mesh-topology-cpp 19.0231 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 26, 1, 40, 21) mesh-unitcube-cpp 24.0455 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 26, 1, 40, 59) mesh-iteration-cpp 35.4755 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 26, 1, 41, 20) function-evaluation-cpp 21.174 "Evaluations of functions at arbitrary points."
+(2013, 8, 26, 1, 41, 20) function-evaluation-cpp 21.0568 "Evaluations of functions at arbitrary points."
+(2013, 8, 26, 1, 41, 24) function-extrapolation-python 3.3543 "BENCH:  1.06886506081"
+(2013, 8, 26, 1, 41, 24) function-extrapolation-python 1.06887 "BENCH:  1.06886506081"
+(2013, 8, 26, 1, 41, 25) function-interpolation-python 1.64721 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 26, 1, 41, 25) function-interpolation-python 0.967554 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 26, 1, 41, 51) la-vector-access-cpp 25.4723 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 26, 1, 42, 20) la-vector-assignment-cpp 29.1231 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 27, 1, 36, 48) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2084 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 27, 1, 37, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6492 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 27, 1, 37, 24) geometry-bounding_box_tree_build-cpp 13.9458 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 27, 1, 37, 52) common-progress-cpp 27.6533 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 27, 1, 38, 21) common-timing-cpp 29.6701 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 27, 1, 40, 8) fem-multicore-cpp 106.952 "Coloring mesh."
+(2013, 8, 27, 1, 42, 36) fem-assembly-cpp 147.639 "Assembly for various forms and backends"
+(2013, 8, 27, 1, 42, 48) fem-convergence-cpp 12.1161 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 27, 1, 42, 50) fem-jit-python 0.00104239 "JIT compilation (in memory cache)"
+(2013, 8, 27, 1, 48, 21) mesh-refinement-cpp 19.7705 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 27, 1, 48, 40) mesh-topology-cpp 19.0239 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 27, 1, 49, 4) mesh-unitcube-cpp 24.032 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 27, 1, 49, 42) mesh-iteration-cpp 35.4677 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 27, 1, 50, 3) function-evaluation-cpp 21.2154 "Evaluations of functions at arbitrary points."
+(2013, 8, 27, 1, 50, 3) function-evaluation-cpp 21.0981 "Evaluations of functions at arbitrary points."
+(2013, 8, 27, 1, 50, 6) function-extrapolation-python 3.34552 "BENCH:  1.05961799622"
+(2013, 8, 27, 1, 50, 6) function-extrapolation-python 1.05962 "BENCH:  1.05961799622"
+(2013, 8, 27, 1, 50, 8) function-interpolation-python 1.64476 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 27, 1, 50, 8) function-interpolation-python 0.965227 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 27, 1, 50, 34) la-vector-access-cpp 25.4667 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 27, 1, 51, 1) la-vector-assignment-cpp 27.0917 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 28, 1, 37, 9) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2287 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 28, 1, 37, 28) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6886 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 28, 1, 37, 44) geometry-bounding_box_tree_build-cpp 13.8839 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 28, 1, 38, 12) common-progress-cpp 27.6529 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 28, 1, 38, 42) common-timing-cpp 30.357 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 28, 1, 40, 30) fem-multicore-cpp 107.501 "Coloring mesh."
+(2013, 8, 28, 1, 42, 57) fem-assembly-cpp 147.489 "Assembly for various forms and backends"
+(2013, 8, 28, 1, 43, 9) fem-convergence-cpp 12.1169 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 28, 1, 43, 11) fem-jit-python 0.00102992 "JIT compilation (in memory cache)"
+(2013, 8, 28, 1, 48, 38) mesh-refinement-cpp 19.8076 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 28, 1, 48, 57) mesh-topology-cpp 19.06 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 28, 1, 49, 21) mesh-unitcube-cpp 24.056 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 28, 1, 49, 59) mesh-iteration-cpp 35.5001 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 28, 1, 50, 20) function-evaluation-cpp 21.1397 "Evaluations of functions at arbitrary points."
+(2013, 8, 28, 1, 50, 20) function-evaluation-cpp 21.0499 "Evaluations of functions at arbitrary points."
+(2013, 8, 28, 1, 50, 24) function-extrapolation-python 3.37918 "BENCH:  1.06580996513"
+(2013, 8, 28, 1, 50, 24) function-extrapolation-python 1.06581 "BENCH:  1.06580996513"
+(2013, 8, 28, 1, 50, 26) function-interpolation-python 1.68922 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 28, 1, 50, 26) function-interpolation-python 0.968645 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 28, 1, 50, 49) la-vector-access-cpp 23.4405 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 28, 1, 51, 16) la-vector-assignment-cpp 27.0238 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 29, 1, 38, 57) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2082 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 29, 1, 39, 16) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4964 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 29, 1, 39, 32) geometry-bounding_box_tree_build-cpp 13.9043 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 29, 1, 40, 0) common-progress-cpp 27.6533 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 29, 1, 40, 30) common-timing-cpp 30.0317 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 29, 1, 42, 17) fem-multicore-cpp 107.421 "Coloring mesh."
+(2013, 8, 29, 1, 44, 45) fem-assembly-cpp 147.434 "Assembly for various forms and backends"
+(2013, 8, 29, 1, 44, 57) fem-convergence-cpp 12.107 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 29, 1, 44, 58) fem-jit-python 0.0010339 "JIT compilation (in memory cache)"
+(2013, 8, 29, 1, 50, 26) mesh-refinement-cpp 19.8443 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 29, 1, 50, 45) mesh-topology-cpp 19.1561 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 29, 1, 51, 9) mesh-unitcube-cpp 24.0152 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 29, 1, 51, 47) mesh-iteration-cpp 35.4744 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 29, 1, 52, 8) function-evaluation-cpp 21.136 "Evaluations of functions at arbitrary points."
+(2013, 8, 29, 1, 52, 8) function-evaluation-cpp 21.0444 "Evaluations of functions at arbitrary points."
+(2013, 8, 29, 1, 52, 12) function-extrapolation-python 3.52903 "BENCH:  1.08780002594"
+(2013, 8, 29, 1, 52, 12) function-extrapolation-python 1.0878 "BENCH:  1.08780002594"
+(2013, 8, 29, 1, 52, 14) function-interpolation-python 1.7117 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 29, 1, 52, 14) function-interpolation-python 0.989075 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 29, 1, 52, 37) la-vector-access-cpp 23.4331 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 29, 1, 53, 4) la-vector-assignment-cpp 27.0694 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 30, 1, 35, 20) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1712 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 30, 1, 35, 39) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6562 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 30, 1, 35, 56) geometry-bounding_box_tree_build-cpp 13.8993 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 30, 1, 36, 23) common-progress-cpp 27.6536 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 30, 1, 36, 53) common-timing-cpp 29.2374 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 30, 1, 38, 40) fem-multicore-cpp 106.99 "Coloring mesh."
+(2013, 8, 30, 1, 41, 6) fem-assembly-cpp 146.731 "Assembly for various forms and backends"
+(2013, 8, 30, 1, 41, 18) fem-convergence-cpp 12.1084 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 30, 1, 41, 20) fem-jit-python 0.00102789 "JIT compilation (in memory cache)"
+(2013, 8, 30, 1, 46, 50) mesh-refinement-cpp 19.8221 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 30, 1, 47, 9) mesh-topology-cpp 19.1056 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 30, 1, 47, 33) mesh-unitcube-cpp 24.1155 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 30, 1, 48, 15) mesh-iteration-cpp 39.1589 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 30, 1, 48, 36) function-evaluation-cpp 21.1466 "Evaluations of functions at arbitrary points."
+(2013, 8, 30, 1, 48, 36) function-evaluation-cpp 21.0684 "Evaluations of functions at arbitrary points."
+(2013, 8, 30, 1, 48, 39) function-extrapolation-python 3.44779 "BENCH:  1.09775018692"
+(2013, 8, 30, 1, 48, 39) function-extrapolation-python 1.09775 "BENCH:  1.09775018692"
+(2013, 8, 30, 1, 48, 41) function-interpolation-python 1.71379 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 30, 1, 48, 41) function-interpolation-python 0.967359 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 30, 1, 49, 4) la-vector-access-cpp 23.4089 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 30, 1, 49, 31) la-vector-assignment-cpp 27.0456 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 8, 31, 1, 34, 26) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.159 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 31, 1, 34, 45) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6174 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 8, 31, 1, 35, 2) geometry-bounding_box_tree_build-cpp 13.9047 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 8, 31, 1, 35, 29) common-progress-cpp 27.6531 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 8, 31, 1, 35, 59) common-timing-cpp 29.7881 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 8, 31, 1, 37, 46) fem-multicore-cpp 107.484 "Coloring mesh."
+(2013, 8, 31, 1, 40, 14) fem-assembly-cpp 147.879 "Assembly for various forms and backends"
+(2013, 8, 31, 1, 40, 26) fem-convergence-cpp 12.1066 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 8, 31, 1, 40, 28) fem-jit-python 0.0010278 "JIT compilation (in memory cache)"
+(2013, 8, 31, 1, 45, 57) mesh-refinement-cpp 19.85 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 8, 31, 1, 46, 16) mesh-topology-cpp 19.0538 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 8, 31, 1, 46, 40) mesh-unitcube-cpp 24.3912 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 8, 31, 1, 47, 27) mesh-iteration-cpp 44.1629 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 8, 31, 1, 47, 49) function-evaluation-cpp 21.5885 "Evaluations of functions at arbitrary points."
+(2013, 8, 31, 1, 47, 49) function-evaluation-cpp 21.5053 "Evaluations of functions at arbitrary points."
+(2013, 8, 31, 1, 47, 52) function-extrapolation-python 3.47949 "BENCH:  1.09370994568"
+(2013, 8, 31, 1, 47, 52) function-extrapolation-python 1.09371 "BENCH:  1.09370994568"
+(2013, 8, 31, 1, 47, 54) function-interpolation-python 1.6867 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 31, 1, 47, 54) function-interpolation-python 0.966482 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 8, 31, 1, 48, 17) la-vector-access-cpp 23.4141 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 8, 31, 1, 48, 45) la-vector-assignment-cpp 28.078 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 1, 1, 32, 0) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.337 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 1, 1, 32, 19) geometry-bounding_box_tree_compute_closest_entity-cpp 15.456 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 1, 1, 32, 35) geometry-bounding_box_tree_build-cpp 13.8984 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 1, 1, 33, 3) common-progress-cpp 27.653 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 1, 1, 33, 34) common-timing-cpp 30.4644 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 1, 1, 35, 21) fem-multicore-cpp 107.359 "Coloring mesh."
+(2013, 9, 1, 1, 37, 49) fem-assembly-cpp 147.849 "Assembly for various forms and backends"
+(2013, 9, 1, 1, 38, 1) fem-convergence-cpp 12.1151 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 1, 1, 38, 3) fem-jit-python 0.00103521 "JIT compilation (in memory cache)"
+(2013, 9, 1, 1, 43, 33) mesh-refinement-cpp 19.7962 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 1, 1, 43, 52) mesh-topology-cpp 19.0728 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 1, 1, 44, 16) mesh-unitcube-cpp 24.1598 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 1, 1, 45, 3) mesh-iteration-cpp 44.1031 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 1, 1, 45, 24) function-evaluation-cpp 21.3237 "Evaluations of functions at arbitrary points."
+(2013, 9, 1, 1, 45, 24) function-evaluation-cpp 21.2078 "Evaluations of functions at arbitrary points."
+(2013, 9, 1, 1, 45, 28) function-extrapolation-python 3.45091 "BENCH:  1.05152201653"
+(2013, 9, 1, 1, 45, 28) function-extrapolation-python 1.05152 "BENCH:  1.05152201653"
+(2013, 9, 1, 1, 45, 29) function-interpolation-python 1.65548 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 1, 1, 45, 29) function-interpolation-python 0.967372 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 1, 1, 45, 53) la-vector-access-cpp 23.448 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 1, 1, 46, 20) la-vector-assignment-cpp 27.0937 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 2, 1, 35, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.4671 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 2, 1, 35, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5409 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 2, 1, 36, 13) geometry-bounding_box_tree_build-cpp 13.8917 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 2, 1, 36, 41) common-progress-cpp 27.6533 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 2, 1, 37, 10) common-timing-cpp 29.1117 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 2, 1, 38, 57) fem-multicore-cpp 106.798 "Coloring mesh."
+(2013, 9, 2, 1, 41, 23) fem-assembly-cpp 146.611 "Assembly for various forms and backends"
+(2013, 9, 2, 1, 41, 36) fem-convergence-cpp 12.1059 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 2, 1, 41, 37) fem-jit-python 0.00103259 "JIT compilation (in memory cache)"
+(2013, 9, 2, 1, 47, 5) mesh-refinement-cpp 19.7983 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 2, 1, 47, 24) mesh-topology-cpp 19.1523 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 2, 1, 47, 48) mesh-unitcube-cpp 24.0441 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 2, 1, 48, 26) mesh-iteration-cpp 35.4857 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 2, 1, 48, 47) function-evaluation-cpp 21.1558 "Evaluations of functions at arbitrary points."
+(2013, 9, 2, 1, 48, 47) function-evaluation-cpp 21.0742 "Evaluations of functions at arbitrary points."
+(2013, 9, 2, 1, 48, 51) function-extrapolation-python 3.52892 "BENCH:  1.08873105049"
+(2013, 9, 2, 1, 48, 51) function-extrapolation-python 1.08873 "BENCH:  1.08873105049"
+(2013, 9, 2, 1, 48, 53) function-interpolation-python 1.69405 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 2, 1, 48, 53) function-interpolation-python 0.981467 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 2, 1, 49, 16) la-vector-access-cpp 23.4271 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 2, 1, 49, 43) la-vector-assignment-cpp 27.0741 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 3, 1, 36, 30) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.5103 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 3, 1, 36, 49) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5622 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 3, 1, 37, 5) geometry-bounding_box_tree_build-cpp 13.9055 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 3, 1, 37, 33) common-progress-cpp 27.6518 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 3, 1, 38, 3) common-timing-cpp 29.5935 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 3, 1, 39, 49) fem-multicore-cpp 106.892 "Coloring mesh."
+(2013, 9, 3, 1, 42, 16) fem-assembly-cpp 146.958 "Assembly for various forms and backends"
+(2013, 9, 3, 1, 42, 29) fem-convergence-cpp 12.1185 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 3, 1, 42, 30) fem-jit-python 0.00103302 "JIT compilation (in memory cache)"
+(2013, 9, 3, 1, 47, 59) mesh-refinement-cpp 19.7749 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 3, 1, 48, 18) mesh-topology-cpp 19.0566 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 3, 1, 48, 43) mesh-unitcube-cpp 24.0798 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 3, 1, 49, 21) mesh-iteration-cpp 35.5072 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 3, 1, 49, 42) function-evaluation-cpp 21.1668 "Evaluations of functions at arbitrary points."
+(2013, 9, 3, 1, 49, 42) function-evaluation-cpp 21.0691 "Evaluations of functions at arbitrary points."
+(2013, 9, 3, 1, 49, 45) function-extrapolation-python 3.47091 "BENCH:  1.07803201675"
+(2013, 9, 3, 1, 49, 45) function-extrapolation-python 1.07803 "BENCH:  1.07803201675"
+(2013, 9, 3, 1, 49, 47) function-interpolation-python 1.73744 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 3, 1, 49, 47) function-interpolation-python 0.968631 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 3, 1, 50, 10) la-vector-access-cpp 23.45 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 3, 1, 50, 39) la-vector-assignment-cpp 28.1161 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 4, 1, 27, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1979 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 4, 1, 28, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5105 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 4, 1, 28, 18) geometry-bounding_box_tree_build-cpp 13.9288 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 4, 1, 28, 46) common-progress-cpp 27.6527 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 4, 1, 29, 15) common-timing-cpp 29.0341 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 4, 1, 31, 2) fem-multicore-cpp 107.006 "Coloring mesh."
+(2013, 9, 4, 1, 33, 29) fem-assembly-cpp 147.47 "Assembly for various forms and backends"
+(2013, 9, 4, 1, 33, 41) fem-convergence-cpp 12.1119 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 4, 1, 33, 54) fem-jit-python 0.00110939 "JIT compilation (in memory cache)"
+(2013, 9, 4, 1, 39, 29) mesh-refinement-cpp 19.7505 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 4, 1, 39, 48) mesh-topology-cpp 19.0354 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 4, 1, 40, 12) mesh-unitcube-cpp 24.0708 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 4, 1, 40, 50) mesh-iteration-cpp 35.4269 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 4, 1, 41, 12) function-evaluation-cpp 21.3437 "Evaluations of functions at arbitrary points."
+(2013, 9, 4, 1, 41, 12) function-evaluation-cpp 21.2508 "Evaluations of functions at arbitrary points."
+(2013, 9, 4, 1, 42, 2) function-extrapolation-python 50.223 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2013, 9, 4, 1, 42, 2) function-extrapolation-python 1.06637 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2013, 9, 4, 1, 42, 3) function-interpolation-python 1.65448 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 4, 1, 42, 3) function-interpolation-python 0.96664 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 4, 1, 42, 27) la-vector-access-cpp 23.4428 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 4, 1, 42, 54) la-vector-assignment-cpp 27.1227 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 5, 1, 40, 28) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1056 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 5, 1, 40, 47) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3015 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 5, 1, 41, 3) geometry-bounding_box_tree_build-cpp 13.8614 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 5, 1, 41, 31) common-progress-cpp 27.6526 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 5, 1, 42, 0) common-timing-cpp 29.4477 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 5, 1, 43, 48) fem-multicore-cpp 107.477 "Coloring mesh."
+(2013, 9, 5, 1, 46, 18) fem-assembly-cpp 150.269 "Assembly for various forms and backends"
+(2013, 9, 5, 1, 46, 30) fem-convergence-cpp 12.1362 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 5, 1, 46, 32) fem-jit-python 0.00103431 "JIT compilation (in memory cache)"
+(2013, 9, 5, 1, 51, 59) mesh-refinement-cpp 19.9393 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 5, 1, 52, 19) mesh-topology-cpp 19.3966 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 5, 1, 52, 43) mesh-unitcube-cpp 23.9958 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 5, 1, 53, 21) mesh-iteration-cpp 35.5334 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 5, 1, 53, 42) function-evaluation-cpp 21.1233 "Evaluations of functions at arbitrary points."
+(2013, 9, 5, 1, 53, 42) function-evaluation-cpp 21.0443 "Evaluations of functions at arbitrary points."
+(2013, 9, 5, 1, 53, 45) function-extrapolation-python 3.58762 "BENCH:  1.09185791016"
+(2013, 9, 5, 1, 53, 45) function-extrapolation-python 1.09186 "BENCH:  1.09185791016"
+(2013, 9, 5, 1, 53, 47) function-interpolation-python 1.68164 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 5, 1, 53, 47) function-interpolation-python 0.964694 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 5, 1, 54, 11) la-vector-access-cpp 23.4282 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 5, 1, 54, 38) la-vector-assignment-cpp 27.0729 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 6, 1, 35, 56) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0468 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 6, 1, 36, 15) geometry-bounding_box_tree_compute_closest_entity-cpp 15.502 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 6, 1, 36, 31) geometry-bounding_box_tree_build-cpp 13.874 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 6, 1, 36, 59) common-progress-cpp 27.6544 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 6, 1, 37, 28) common-timing-cpp 29.4024 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 6, 1, 39, 16) fem-multicore-cpp 107.387 "Coloring mesh."
+(2013, 9, 6, 1, 41, 46) fem-assembly-cpp 150.033 "Assembly for various forms and backends"
+(2013, 9, 6, 1, 41, 58) fem-convergence-cpp 12.1347 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 6, 1, 42, 0) fem-jit-python 0.00102112 "JIT compilation (in memory cache)"
+(2013, 9, 6, 1, 47, 26) mesh-refinement-cpp 19.932 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 6, 1, 47, 46) mesh-topology-cpp 19.3848 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 6, 1, 48, 10) mesh-unitcube-cpp 24.1627 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 6, 1, 48, 56) mesh-iteration-cpp 43.5492 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 6, 1, 49, 17) function-evaluation-cpp 21.1839 "Evaluations of functions at arbitrary points."
+(2013, 9, 6, 1, 49, 17) function-evaluation-cpp 21.0936 "Evaluations of functions at arbitrary points."
+(2013, 9, 6, 1, 49, 21) function-extrapolation-python 3.46722 "BENCH:  1.08668613434"
+(2013, 9, 6, 1, 49, 21) function-extrapolation-python 1.08669 "BENCH:  1.08668613434"
+(2013, 9, 6, 1, 49, 22) function-interpolation-python 1.65644 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 6, 1, 49, 22) function-interpolation-python 0.951913 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 6, 1, 49, 47) la-vector-access-cpp 24.9374 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 6, 1, 50, 16) la-vector-assignment-cpp 29.1041 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 7, 1, 31, 8) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1463 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 7, 1, 31, 27) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4807 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 7, 1, 31, 44) geometry-bounding_box_tree_build-cpp 13.8554 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 7, 1, 32, 11) common-progress-cpp 27.6525 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 7, 1, 32, 41) common-timing-cpp 29.3273 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 7, 1, 34, 29) fem-multicore-cpp 107.96 "Coloring mesh."
+(2013, 9, 7, 1, 36, 58) fem-assembly-cpp 149.216 "Assembly for various forms and backends"
+(2013, 9, 7, 1, 37, 10) fem-convergence-cpp 12.1415 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 7, 1, 37, 12) fem-jit-python 0.00102489 "JIT compilation (in memory cache)"
+(2013, 9, 7, 1, 42, 40) mesh-refinement-cpp 19.9405 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 7, 1, 42, 59) mesh-topology-cpp 19.3759 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 7, 1, 43, 23) mesh-unitcube-cpp 23.9579 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 7, 1, 44, 1) mesh-iteration-cpp 35.5765 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 7, 1, 44, 23) function-evaluation-cpp 21.1302 "Evaluations of functions at arbitrary points."
+(2013, 9, 7, 1, 44, 23) function-evaluation-cpp 21.0385 "Evaluations of functions at arbitrary points."
+(2013, 9, 7, 1, 44, 26) function-extrapolation-python 3.59679 "BENCH:  1.09853887558"
+(2013, 9, 7, 1, 44, 26) function-extrapolation-python 1.09854 "BENCH:  1.09853887558"
+(2013, 9, 7, 1, 44, 28) function-interpolation-python 1.65632 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 7, 1, 44, 28) function-interpolation-python 0.949793 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 7, 1, 44, 51) la-vector-access-cpp 23.4279 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 7, 1, 45, 18) la-vector-assignment-cpp 27.072 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 8, 1, 35, 55) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0233 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 8, 1, 36, 14) geometry-bounding_box_tree_compute_closest_entity-cpp 15.416 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 8, 1, 36, 30) geometry-bounding_box_tree_build-cpp 13.8931 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 8, 1, 36, 58) common-progress-cpp 27.6529 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 8, 1, 37, 27) common-timing-cpp 29.2261 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 8, 1, 39, 15) fem-multicore-cpp 107.691 "Coloring mesh."
+(2013, 9, 8, 1, 41, 44) fem-assembly-cpp 148.944 "Assembly for various forms and backends"
+(2013, 9, 8, 1, 41, 56) fem-convergence-cpp 12.145 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 8, 1, 41, 58) fem-jit-python 0.00103338 "JIT compilation (in memory cache)"
+(2013, 9, 8, 1, 47, 30) mesh-refinement-cpp 19.8907 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 8, 1, 47, 50) mesh-topology-cpp 19.416 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 8, 1, 48, 14) mesh-unitcube-cpp 23.911 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 8, 1, 48, 52) mesh-iteration-cpp 35.5526 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 8, 1, 49, 13) function-evaluation-cpp 21.2074 "Evaluations of functions at arbitrary points."
+(2013, 9, 8, 1, 49, 13) function-evaluation-cpp 21.0866 "Evaluations of functions at arbitrary points."
+(2013, 9, 8, 1, 49, 17) function-extrapolation-python 3.49526 "BENCH:  1.07830500603"
+(2013, 9, 8, 1, 49, 17) function-extrapolation-python 1.07831 "BENCH:  1.07830500603"
+(2013, 9, 8, 1, 49, 18) function-interpolation-python 1.64315 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 8, 1, 49, 18) function-interpolation-python 0.954983 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 8, 1, 49, 44) la-vector-access-cpp 25.9725 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 8, 1, 50, 12) la-vector-assignment-cpp 27.2369 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 9, 1, 43, 6) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.7717 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 9, 1, 43, 25) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5203 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 9, 1, 43, 41) geometry-bounding_box_tree_build-cpp 13.9121 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 9, 1, 44, 9) common-progress-cpp 27.6533 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 9, 1, 44, 39) common-timing-cpp 30.073 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 9, 1, 46, 25) fem-multicore-cpp 106.602 "Coloring mesh."
+(2013, 9, 9, 1, 48, 55) fem-assembly-cpp 149.27 "Assembly for various forms and backends"
+(2013, 9, 9, 1, 49, 7) fem-convergence-cpp 12.1329 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 9, 1, 49, 9) fem-jit-python 0.00102019 "JIT compilation (in memory cache)"
+(2013, 9, 9, 1, 54, 35) mesh-refinement-cpp 19.8754 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 9, 1, 54, 54) mesh-topology-cpp 19.5646 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 9, 1, 55, 18) mesh-unitcube-cpp 23.8683 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 9, 1, 56, 5) mesh-iteration-cpp 44.1777 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 9, 1, 56, 26) function-evaluation-cpp 21.1301 "Evaluations of functions at arbitrary points."
+(2013, 9, 9, 1, 56, 26) function-evaluation-cpp 21.0513 "Evaluations of functions at arbitrary points."
+(2013, 9, 9, 1, 56, 29) function-extrapolation-python 3.52172 "BENCH:  1.07437300682"
+(2013, 9, 9, 1, 56, 29) function-extrapolation-python 1.07437 "BENCH:  1.07437300682"
+(2013, 9, 9, 1, 56, 31) function-interpolation-python 1.70656 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 9, 1, 56, 31) function-interpolation-python 0.99112 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 9, 1, 56, 55) la-vector-access-cpp 23.407 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 9, 1, 57, 22) la-vector-assignment-cpp 27.0531 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 10, 1, 27, 20) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.4991 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 10, 1, 27, 39) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4587 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 10, 1, 27, 56) geometry-bounding_box_tree_build-cpp 13.9781 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 10, 1, 28, 24) common-progress-cpp 27.6536 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 10, 1, 28, 53) common-timing-cpp 29.768 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 10, 1, 30, 41) fem-multicore-cpp 107.737 "Coloring mesh."
+(2013, 9, 10, 1, 33, 13) fem-assembly-cpp 152.4 "Assembly for various forms and backends"
+(2013, 9, 10, 1, 33, 26) fem-convergence-cpp 12.1337 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 10, 1, 33, 28) fem-jit-python 0.00102949 "JIT compilation (in memory cache)"
+(2013, 9, 10, 1, 38, 55) mesh-refinement-cpp 19.804 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 10, 1, 39, 14) mesh-topology-cpp 19.1878 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 10, 1, 39, 38) mesh-unitcube-cpp 23.8731 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 10, 1, 40, 16) mesh-iteration-cpp 35.9371 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 10, 1, 40, 37) function-evaluation-cpp 21.1614 "Evaluations of functions at arbitrary points."
+(2013, 9, 10, 1, 40, 37) function-evaluation-cpp 21.0859 "Evaluations of functions at arbitrary points."
+(2013, 9, 10, 1, 40, 41) function-extrapolation-python 3.52456 "BENCH:  1.06768894196"
+(2013, 9, 10, 1, 40, 41) function-extrapolation-python 1.06769 "BENCH:  1.06768894196"
+(2013, 9, 10, 1, 40, 43) function-interpolation-python 1.69319 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 10, 1, 40, 43) function-interpolation-python 0.972653 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 10, 1, 41, 6) la-vector-access-cpp 23.4405 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 10, 1, 41, 33) la-vector-assignment-cpp 27.0772 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 11, 1, 32, 16) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8305 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 11, 1, 32, 36) geometry-bounding_box_tree_compute_closest_entity-cpp 16.0055 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 11, 1, 32, 52) geometry-bounding_box_tree_build-cpp 13.9812 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 11, 1, 33, 20) common-progress-cpp 27.6532 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 11, 1, 33, 49) common-timing-cpp 28.5469 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 11, 1, 35, 36) fem-multicore-cpp 107.624 "Coloring mesh."
+(2013, 9, 11, 1, 38, 7) fem-assembly-cpp 150.794 "Assembly for various forms and backends"
+(2013, 9, 11, 1, 38, 19) fem-convergence-cpp 12.0821 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 11, 1, 38, 21) fem-jit-python 0.00106239 "JIT compilation (in memory cache)"
+(2013, 9, 11, 1, 43, 50) mesh-refinement-cpp 20.1488 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 11, 1, 44, 10) mesh-topology-cpp 19.4903 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 11, 1, 44, 34) mesh-unitcube-cpp 24.4336 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 11, 1, 45, 12) mesh-iteration-cpp 35.5755 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 11, 1, 45, 33) function-evaluation-cpp 21.1335 "Evaluations of functions at arbitrary points."
+(2013, 9, 11, 1, 45, 33) function-evaluation-cpp 21.0549 "Evaluations of functions at arbitrary points."
+(2013, 9, 11, 1, 45, 37) function-extrapolation-python 3.4873 "BENCH:  1.07768201828"
+(2013, 9, 11, 1, 45, 37) function-extrapolation-python 1.07768 "BENCH:  1.07768201828"
+(2013, 9, 11, 1, 45, 39) function-interpolation-python 1.73838 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 11, 1, 45, 39) function-interpolation-python 0.998629 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 11, 1, 46, 2) la-vector-access-cpp 23.4346 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 11, 1, 46, 29) la-vector-assignment-cpp 27.0901 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 12, 1, 33, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9082 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 12, 1, 34, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6911 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 12, 1, 34, 19) geometry-bounding_box_tree_build-cpp 14.0068 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 12, 1, 34, 47) common-progress-cpp 27.6528 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 12, 1, 35, 16) common-timing-cpp 28.6927 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 12, 1, 37, 3) fem-multicore-cpp 107.704 "Coloring mesh."
+(2013, 9, 12, 1, 39, 35) fem-assembly-cpp 151.063 "Assembly for various forms and backends"
+(2013, 9, 12, 1, 39, 47) fem-convergence-cpp 12.084 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 12, 1, 39, 48) fem-jit-python 0.0010443 "JIT compilation (in memory cache)"
+(2013, 9, 12, 1, 45, 15) mesh-refinement-cpp 20.0849 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 12, 1, 45, 35) mesh-topology-cpp 19.3911 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 12, 1, 45, 59) mesh-unitcube-cpp 24.3966 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 12, 1, 46, 41) mesh-iteration-cpp 39.1688 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 12, 1, 47, 2) function-evaluation-cpp 21.1757 "Evaluations of functions at arbitrary points."
+(2013, 9, 12, 1, 47, 2) function-evaluation-cpp 21.0767 "Evaluations of functions at arbitrary points."
+(2013, 9, 12, 1, 47, 5) function-extrapolation-python 3.57691 "BENCH:  1.1063439846"
+(2013, 9, 12, 1, 47, 5) function-extrapolation-python 1.10634 "BENCH:  1.1063439846"
+(2013, 9, 12, 1, 47, 7) function-interpolation-python 1.71146 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 12, 1, 47, 7) function-interpolation-python 1.00486 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 12, 1, 47, 36) la-vector-access-cpp 28.4178 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 12, 1, 48, 3) la-vector-assignment-cpp 27.087 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 13, 1, 31, 55) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9989 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 13, 1, 32, 14) geometry-bounding_box_tree_compute_closest_entity-cpp 16.0555 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 13, 1, 32, 31) geometry-bounding_box_tree_build-cpp 14.0016 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 13, 1, 32, 59) common-progress-cpp 27.663 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 13, 1, 33, 28) common-timing-cpp 29.4416 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 13, 1, 35, 15) fem-multicore-cpp 106.7 "Coloring mesh."
+(2013, 9, 13, 1, 37, 46) fem-assembly-cpp 150.908 "Assembly for various forms and backends"
+(2013, 9, 13, 1, 37, 58) fem-convergence-cpp 12.0873 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 13, 1, 38, 0) fem-jit-python 0.0010401 "JIT compilation (in memory cache)"
+(2013, 9, 13, 1, 43, 27) mesh-refinement-cpp 20.0904 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 13, 1, 43, 46) mesh-topology-cpp 19.3394 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 13, 1, 44, 11) mesh-unitcube-cpp 24.4129 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 13, 1, 44, 49) mesh-iteration-cpp 35.4855 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 13, 1, 45, 10) function-evaluation-cpp 21.1258 "Evaluations of functions at arbitrary points."
+(2013, 9, 13, 1, 45, 10) function-evaluation-cpp 21.038 "Evaluations of functions at arbitrary points."
+(2013, 9, 13, 1, 45, 13) function-extrapolation-python 3.51222 "BENCH:  1.07154798508"
+(2013, 9, 13, 1, 45, 13) function-extrapolation-python 1.07155 "BENCH:  1.07154798508"
+(2013, 9, 13, 1, 45, 15) function-interpolation-python 1.72971 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 13, 1, 45, 15) function-interpolation-python 1.0023 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 13, 1, 45, 40) la-vector-access-cpp 24.9403 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 13, 1, 46, 8) la-vector-assignment-cpp 27.3666 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 14, 1, 30, 48) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8375 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 14, 1, 31, 7) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7463 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 14, 1, 31, 23) geometry-bounding_box_tree_build-cpp 13.9461 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 14, 1, 31, 51) common-progress-cpp 27.653 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 14, 1, 32, 20) common-timing-cpp 28.7382 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 14, 1, 34, 7) fem-multicore-cpp 107.21 "Coloring mesh."
+(2013, 9, 14, 1, 36, 38) fem-assembly-cpp 151.091 "Assembly for various forms and backends"
+(2013, 9, 14, 1, 36, 50) fem-convergence-cpp 12.0862 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 14, 1, 37, 9) fem-jit-python 0.00106699 "JIT compilation (in memory cache)"
+(2013, 9, 14, 1, 42, 36) mesh-refinement-cpp 20.0807 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 14, 1, 42, 56) mesh-topology-cpp 19.3361 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 14, 1, 43, 20) mesh-unitcube-cpp 24.4357 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 14, 1, 43, 58) mesh-iteration-cpp 35.4249 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 14, 1, 44, 19) function-evaluation-cpp 21.2198 "Evaluations of functions at arbitrary points."
+(2013, 9, 14, 1, 44, 19) function-evaluation-cpp 21.1381 "Evaluations of functions at arbitrary points."
+(2013, 9, 14, 1, 45, 24) function-extrapolation-python 64.3285 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2013, 9, 14, 1, 45, 24) function-extrapolation-python 1.08295 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2013, 9, 14, 1, 45, 31) function-interpolation-python 7.60645 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2013, 9, 14, 1, 45, 31) function-interpolation-python 0.995712 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2013, 9, 14, 1, 45, 55) la-vector-access-cpp 23.4345 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 14, 1, 46, 22) la-vector-assignment-cpp 27.0854 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 15, 1, 31, 19) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8126 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 15, 1, 31, 38) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7425 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 15, 1, 31, 55) geometry-bounding_box_tree_build-cpp 14.0139 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 15, 1, 32, 23) common-progress-cpp 27.6529 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 15, 1, 32, 52) common-timing-cpp 29.4479 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 15, 1, 34, 39) fem-multicore-cpp 106.679 "Coloring mesh."
+(2013, 9, 15, 1, 37, 10) fem-assembly-cpp 151.156 "Assembly for various forms and backends"
+(2013, 9, 15, 1, 37, 22) fem-convergence-cpp 12.0846 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 15, 1, 37, 24) fem-jit-python 0.000998187 "JIT compilation (in memory cache)"
+(2013, 9, 15, 1, 42, 54) mesh-refinement-cpp 20.0672 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 15, 1, 43, 14) mesh-topology-cpp 19.3549 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 15, 1, 43, 38) mesh-unitcube-cpp 24.3444 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 15, 1, 44, 16) mesh-iteration-cpp 35.4816 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 15, 1, 44, 37) function-evaluation-cpp 21.1492 "Evaluations of functions at arbitrary points."
+(2013, 9, 15, 1, 44, 37) function-evaluation-cpp 21.0238 "Evaluations of functions at arbitrary points."
+(2013, 9, 15, 1, 44, 41) function-extrapolation-python 3.46043 "BENCH:  1.10047793388"
+(2013, 9, 15, 1, 44, 41) function-extrapolation-python 1.10048 "BENCH:  1.10047793388"
+(2013, 9, 15, 1, 44, 43) function-interpolation-python 1.66484 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 15, 1, 44, 43) function-interpolation-python 0.991965 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 15, 1, 45, 6) la-vector-access-cpp 23.4761 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 15, 1, 45, 33) la-vector-assignment-cpp 27.0938 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 16, 1, 32, 20) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8358 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 16, 1, 32, 39) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7564 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 16, 1, 32, 56) geometry-bounding_box_tree_build-cpp 14.0046 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 16, 1, 33, 23) common-progress-cpp 27.6529 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 16, 1, 33, 52) common-timing-cpp 28.8452 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 16, 1, 35, 40) fem-multicore-cpp 107.695 "Coloring mesh."
+(2013, 9, 16, 1, 38, 10) fem-assembly-cpp 150.593 "Assembly for various forms and backends"
+(2013, 9, 16, 1, 38, 23) fem-convergence-cpp 12.0833 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 16, 1, 38, 24) fem-jit-python 0.0010113 "JIT compilation (in memory cache)"
+(2013, 9, 16, 1, 43, 51) mesh-refinement-cpp 20.0519 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 16, 1, 44, 11) mesh-topology-cpp 19.3845 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 16, 1, 44, 35) mesh-unitcube-cpp 24.3572 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 16, 1, 45, 13) mesh-iteration-cpp 35.4788 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 16, 1, 45, 35) function-evaluation-cpp 21.9118 "Evaluations of functions at arbitrary points."
+(2013, 9, 16, 1, 45, 35) function-evaluation-cpp 21.8173 "Evaluations of functions at arbitrary points."
+(2013, 9, 16, 1, 45, 39) function-extrapolation-python 3.51208 "BENCH:  1.07490205765"
+(2013, 9, 16, 1, 45, 39) function-extrapolation-python 1.0749 "BENCH:  1.07490205765"
+(2013, 9, 16, 1, 45, 41) function-interpolation-python 1.69376 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 16, 1, 45, 41) function-interpolation-python 0.99663 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 16, 1, 46, 4) la-vector-access-cpp 23.5684 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 16, 1, 46, 31) la-vector-assignment-cpp 27.0687 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 17, 1, 33, 11) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8691 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 17, 1, 33, 31) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8719 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 17, 1, 33, 47) geometry-bounding_box_tree_build-cpp 13.9539 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 17, 1, 34, 15) common-progress-cpp 27.6534 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 17, 1, 34, 45) common-timing-cpp 29.9478 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 17, 1, 36, 32) fem-multicore-cpp 107.503 "Coloring mesh."
+(2013, 9, 17, 1, 39, 3) fem-assembly-cpp 150.59 "Assembly for various forms and backends"
+(2013, 9, 17, 1, 39, 15) fem-convergence-cpp 12.1392 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 17, 1, 39, 17) fem-jit-python 0.001001 "JIT compilation (in memory cache)"
+(2013, 9, 17, 1, 44, 43) mesh-refinement-cpp 20.0807 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 17, 1, 45, 2) mesh-topology-cpp 19.3754 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 17, 1, 45, 27) mesh-unitcube-cpp 24.421 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 17, 1, 46, 5) mesh-iteration-cpp 35.4924 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 17, 1, 46, 26) function-evaluation-cpp 21.1404 "Evaluations of functions at arbitrary points."
+(2013, 9, 17, 1, 46, 26) function-evaluation-cpp 21.0562 "Evaluations of functions at arbitrary points."
+(2013, 9, 17, 1, 46, 30) function-extrapolation-python 3.54555 "BENCH:  1.07709693909"
+(2013, 9, 17, 1, 46, 30) function-extrapolation-python 1.0771 "BENCH:  1.07709693909"
+(2013, 9, 17, 1, 46, 31) function-interpolation-python 1.69311 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 17, 1, 46, 31) function-interpolation-python 0.999534 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 17, 1, 46, 55) la-vector-access-cpp 23.4384 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 17, 1, 47, 23) la-vector-assignment-cpp 28.1092 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 18, 1, 37, 24) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2919 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 18, 1, 37, 43) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8306 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 18, 1, 38, 0) geometry-bounding_box_tree_build-cpp 13.9817 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 18, 1, 38, 28) common-progress-cpp 27.6542 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 18, 1, 38, 57) common-timing-cpp 29.5945 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 18, 1, 42, 22) fem-multicore-cpp 204.88 "Coloring mesh."
+(2013, 9, 18, 1, 44, 54) fem-assembly-cpp 152.387 "Assembly for various forms and backends"
+(2013, 9, 18, 1, 45, 9) fem-convergence-cpp 14.2262 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 18, 1, 45, 10) fem-jit-python 0.00105371 "JIT compilation (in memory cache)"
+(2013, 9, 18, 1, 53, 15) mesh-refinement-cpp 20.0068 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 18, 1, 53, 35) mesh-topology-cpp 19.5757 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 18, 1, 53, 59) mesh-unitcube-cpp 24.083 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 18, 1, 54, 40) mesh-iteration-cpp 39.1739 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 18, 1, 55, 2) function-evaluation-cpp 21.0941 "Evaluations of functions at arbitrary points."
+(2013, 9, 18, 1, 55, 2) function-evaluation-cpp 20.9717 "Evaluations of functions at arbitrary points."
+(2013, 9, 18, 1, 55, 5) function-extrapolation-python 3.60408 "BENCH:  1.05839109421"
+(2013, 9, 18, 1, 55, 5) function-extrapolation-python 1.05839 "BENCH:  1.05839109421"
+(2013, 9, 18, 1, 55, 7) function-interpolation-python 1.62787 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 18, 1, 55, 7) function-interpolation-python 0.964344 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 18, 1, 55, 32) la-vector-access-cpp 25.4647 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 18, 1, 55, 59) la-vector-assignment-cpp 27.0758 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 19, 1, 24, 27) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1688 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 19, 1, 24, 46) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5593 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 19, 1, 25, 3) geometry-bounding_box_tree_build-cpp 13.9742 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 19, 1, 25, 30) common-progress-cpp 27.6526 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 19, 1, 26, 1) common-timing-cpp 30.1424 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 19, 1, 29, 26) fem-multicore-cpp 205.269 "Coloring mesh."
+(2013, 9, 19, 1, 31, 58) fem-assembly-cpp 152 "Assembly for various forms and backends"
+(2013, 9, 19, 1, 32, 12) fem-convergence-cpp 14.1866 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 19, 1, 32, 14) fem-jit-python 0.00103731 "JIT compilation (in memory cache)"
+(2013, 9, 19, 1, 40, 15) mesh-refinement-cpp 20.0784 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 19, 1, 40, 35) mesh-topology-cpp 19.5747 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 19, 1, 41, 0) mesh-unitcube-cpp 24.6586 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 19, 1, 41, 46) mesh-iteration-cpp 44.1798 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 19, 1, 42, 7) function-evaluation-cpp 21.0493 "Evaluations of functions at arbitrary points."
+(2013, 9, 19, 1, 42, 7) function-evaluation-cpp 20.9664 "Evaluations of functions at arbitrary points."
+(2013, 9, 19, 1, 42, 11) function-extrapolation-python 3.54431 "BENCH:  1.06100296974"
+(2013, 9, 19, 1, 42, 11) function-extrapolation-python 1.061 "BENCH:  1.06100296974"
+(2013, 9, 19, 1, 42, 13) function-interpolation-python 1.65769 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 19, 1, 42, 13) function-interpolation-python 0.965463 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 19, 1, 42, 38) la-vector-access-cpp 25.4484 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 19, 1, 43, 6) la-vector-assignment-cpp 28.1904 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 20, 1, 29, 58) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1764 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 20, 1, 30, 16) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4981 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 20, 1, 30, 33) geometry-bounding_box_tree_build-cpp 13.9017 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 20, 1, 31, 1) common-progress-cpp 27.6529 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 20, 1, 31, 32) common-timing-cpp 31.0592 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 20, 1, 34, 57) fem-multicore-cpp 205.494 "Coloring mesh."
+(2013, 9, 20, 1, 37, 29) fem-assembly-cpp 151.32 "Assembly for various forms and backends"
+(2013, 9, 20, 1, 37, 43) fem-convergence-cpp 14.1858 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 20, 1, 37, 45) fem-jit-python 0.001034 "JIT compilation (in memory cache)"
+(2013, 9, 20, 1, 45, 48) mesh-refinement-cpp 19.9887 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 20, 1, 46, 8) mesh-topology-cpp 19.6018 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 20, 1, 46, 32) mesh-unitcube-cpp 24.1416 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 20, 1, 47, 10) mesh-iteration-cpp 35.4887 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 20, 1, 47, 31) function-evaluation-cpp 21.1095 "Evaluations of functions at arbitrary points."
+(2013, 9, 20, 1, 47, 31) function-evaluation-cpp 21.0156 "Evaluations of functions at arbitrary points."
+(2013, 9, 20, 1, 47, 35) function-extrapolation-python 3.44591 "BENCH:  1.0674598217"
+(2013, 9, 20, 1, 47, 35) function-extrapolation-python 1.06746 "BENCH:  1.0674598217"
+(2013, 9, 20, 1, 47, 37) function-interpolation-python 1.63662 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 20, 1, 47, 37) function-interpolation-python 0.971224 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 20, 1, 48, 5) la-vector-access-cpp 28.4881 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 20, 1, 48, 32) la-vector-assignment-cpp 27.2363 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 21, 1, 27, 34) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.3061 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 21, 1, 27, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7407 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 21, 1, 28, 9) geometry-bounding_box_tree_build-cpp 13.9143 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 21, 1, 28, 42) common-progress-cpp 32.6686 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 21, 1, 29, 13) common-timing-cpp 30.6477 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 21, 1, 32, 39) fem-multicore-cpp 206.137 "Coloring mesh."
+(2013, 9, 21, 1, 35, 10) fem-assembly-cpp 151.23 "Assembly for various forms and backends"
+(2013, 9, 21, 1, 35, 24) fem-convergence-cpp 14.1815 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 21, 1, 35, 26) fem-jit-python 0.001017 "JIT compilation (in memory cache)"
+(2013, 9, 21, 1, 43, 29) mesh-refinement-cpp 20.0585 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 21, 1, 43, 48) mesh-topology-cpp 19.5444 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 21, 1, 44, 13) mesh-unitcube-cpp 24.2112 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 21, 1, 44, 51) mesh-iteration-cpp 35.4221 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 21, 1, 45, 12) function-evaluation-cpp 21.3082 "Evaluations of functions at arbitrary points."
+(2013, 9, 21, 1, 45, 12) function-evaluation-cpp 21.2201 "Evaluations of functions at arbitrary points."
+(2013, 9, 21, 1, 45, 15) function-extrapolation-python 3.43787 "BENCH:  1.0566368103"
+(2013, 9, 21, 1, 45, 15) function-extrapolation-python 1.05664 "BENCH:  1.0566368103"
+(2013, 9, 21, 1, 45, 17) function-interpolation-python 1.66554 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 21, 1, 45, 17) function-interpolation-python 0.969048 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 21, 1, 45, 46) la-vector-access-cpp 28.4473 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 21, 1, 46, 13) la-vector-assignment-cpp 27.0334 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 22, 1, 29, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2515 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 22, 1, 29, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5416 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 22, 1, 30, 13) geometry-bounding_box_tree_build-cpp 13.9462 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 22, 1, 30, 41) common-progress-cpp 27.6533 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 22, 1, 31, 12) common-timing-cpp 30.6471 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 22, 1, 34, 37) fem-multicore-cpp 205.059 "Coloring mesh."
+(2013, 9, 22, 1, 37, 8) fem-assembly-cpp 151.561 "Assembly for various forms and backends"
+(2013, 9, 22, 1, 37, 23) fem-convergence-cpp 14.2059 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 22, 1, 37, 24) fem-jit-python 0.00102489 "JIT compilation (in memory cache)"
+(2013, 9, 22, 1, 45, 25) mesh-refinement-cpp 20.0177 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 22, 1, 45, 44) mesh-topology-cpp 19.6154 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 22, 1, 46, 9) mesh-unitcube-cpp 24.2461 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 22, 1, 46, 47) mesh-iteration-cpp 35.5352 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 22, 1, 47, 8) function-evaluation-cpp 21.1677 "Evaluations of functions at arbitrary points."
+(2013, 9, 22, 1, 47, 8) function-evaluation-cpp 21.0685 "Evaluations of functions at arbitrary points."
+(2013, 9, 22, 1, 47, 11) function-extrapolation-python 3.47708 "BENCH:  1.06166815758"
+(2013, 9, 22, 1, 47, 11) function-extrapolation-python 1.06167 "BENCH:  1.06166815758"
+(2013, 9, 22, 1, 47, 13) function-interpolation-python 1.65907 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 22, 1, 47, 13) function-interpolation-python 0.970722 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 22, 1, 47, 38) la-vector-access-cpp 25.4446 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 22, 1, 48, 6) la-vector-assignment-cpp 27.0689 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 23, 1, 29, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1791 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 23, 1, 29, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6485 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 23, 1, 30, 13) geometry-bounding_box_tree_build-cpp 13.9134 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 23, 1, 30, 40) common-progress-cpp 27.6526 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 23, 1, 31, 11) common-timing-cpp 30.9794 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 23, 1, 34, 37) fem-multicore-cpp 205.36 "Coloring mesh."
+(2013, 9, 23, 1, 37, 8) fem-assembly-cpp 151.486 "Assembly for various forms and backends"
+(2013, 9, 23, 1, 37, 22) fem-convergence-cpp 14.194 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 23, 1, 37, 24) fem-jit-python 0.00102909 "JIT compilation (in memory cache)"
+(2013, 9, 23, 1, 45, 24) mesh-refinement-cpp 19.9843 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 23, 1, 45, 43) mesh-topology-cpp 19.6142 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 23, 1, 46, 8) mesh-unitcube-cpp 24.2098 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 23, 1, 46, 46) mesh-iteration-cpp 35.4938 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 23, 1, 47, 7) function-evaluation-cpp 21.1121 "Evaluations of functions at arbitrary points."
+(2013, 9, 23, 1, 47, 7) function-evaluation-cpp 21 "Evaluations of functions at arbitrary points."
+(2013, 9, 23, 1, 47, 10) function-extrapolation-python 3.52908 "BENCH:  1.06049919128"
+(2013, 9, 23, 1, 47, 10) function-extrapolation-python 1.0605 "BENCH:  1.06049919128"
+(2013, 9, 23, 1, 47, 12) function-interpolation-python 1.67787 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 23, 1, 47, 12) function-interpolation-python 0.969448 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 23, 1, 47, 37) la-vector-access-cpp 25.4436 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 23, 1, 48, 5) la-vector-assignment-cpp 27.0878 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 24, 1, 34, 17) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.3622 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 24, 1, 34, 36) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6279 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 24, 1, 34, 53) geometry-bounding_box_tree_build-cpp 13.8999 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 24, 1, 35, 20) common-progress-cpp 27.6537 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 24, 1, 35, 51) common-timing-cpp 30.2772 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 24, 1, 39, 16) fem-multicore-cpp 205.146 "Coloring mesh."
+(2013, 9, 24, 1, 41, 47) fem-assembly-cpp 151.152 "Assembly for various forms and backends"
+(2013, 9, 24, 1, 42, 1) fem-convergence-cpp 14.1983 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 24, 1, 42, 3) fem-jit-python 0.00104001 "JIT compilation (in memory cache)"
+(2013, 9, 24, 1, 50, 7) mesh-refinement-cpp 20.0585 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 24, 1, 50, 27) mesh-topology-cpp 19.5446 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 24, 1, 50, 51) mesh-unitcube-cpp 24.1553 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 24, 1, 51, 29) mesh-iteration-cpp 35.4917 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 24, 1, 51, 50) function-evaluation-cpp 21.1105 "Evaluations of functions at arbitrary points."
+(2013, 9, 24, 1, 51, 50) function-evaluation-cpp 21.0285 "Evaluations of functions at arbitrary points."
+(2013, 9, 24, 1, 51, 54) function-extrapolation-python 3.55087 "BENCH:  1.06886100769"
+(2013, 9, 24, 1, 51, 54) function-extrapolation-python 1.06886 "BENCH:  1.06886100769"
+(2013, 9, 24, 1, 51, 55) function-interpolation-python 1.67705 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 24, 1, 51, 55) function-interpolation-python 0.972507 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 24, 1, 52, 24) la-vector-access-cpp 28.4463 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 24, 1, 52, 51) la-vector-assignment-cpp 27.0973 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 25, 1, 25, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2169 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 25, 1, 26, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7394 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 25, 1, 26, 19) geometry-bounding_box_tree_build-cpp 13.9305 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 25, 1, 26, 47) common-progress-cpp 27.6555 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 25, 1, 27, 17) common-timing-cpp 30.508 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 25, 1, 30, 43) fem-multicore-cpp 205.676 "Coloring mesh."
+(2013, 9, 25, 1, 33, 16) fem-assembly-cpp 153.005 "Assembly for various forms and backends"
+(2013, 9, 25, 1, 33, 30) fem-convergence-cpp 14.2226 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 25, 1, 33, 32) fem-jit-python 0.00101972 "JIT compilation (in memory cache)"
+(2013, 9, 25, 1, 41, 31) mesh-refinement-cpp 19.9764 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 25, 1, 41, 50) mesh-topology-cpp 19.4984 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 25, 1, 42, 14) mesh-unitcube-cpp 24.0983 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 25, 1, 42, 52) mesh-iteration-cpp 35.4973 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 25, 1, 43, 13) function-evaluation-cpp 21.1453 "Evaluations of functions at arbitrary points."
+(2013, 9, 25, 1, 43, 13) function-evaluation-cpp 21.0586 "Evaluations of functions at arbitrary points."
+(2013, 9, 25, 1, 43, 17) function-extrapolation-python 3.54581 "BENCH:  1.08921313286"
+(2013, 9, 25, 1, 43, 17) function-extrapolation-python 1.08921 "BENCH:  1.08921313286"
+(2013, 9, 25, 1, 43, 19) function-interpolation-python 1.65365 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 25, 1, 43, 19) function-interpolation-python 0.953854 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 25, 1, 43, 44) la-vector-access-cpp 25.4442 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 25, 1, 44, 11) la-vector-assignment-cpp 27.0409 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 26, 1, 23, 17) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2784 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 26, 1, 23, 36) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5226 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 26, 1, 23, 52) geometry-bounding_box_tree_build-cpp 13.9074 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 26, 1, 24, 20) common-progress-cpp 27.653 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 26, 1, 24, 50) common-timing-cpp 29.8304 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 26, 1, 28, 15) fem-multicore-cpp 205.524 "Coloring mesh."
+(2013, 9, 26, 1, 30, 48) fem-assembly-cpp 152.683 "Assembly for various forms and backends"
+(2013, 9, 26, 1, 31, 2) fem-convergence-cpp 14.2046 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 26, 1, 31, 4) fem-jit-python 0.00102 "JIT compilation (in memory cache)"
+(2013, 9, 26, 1, 39, 3) mesh-refinement-cpp 19.9666 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 26, 1, 39, 22) mesh-topology-cpp 19.4873 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 26, 1, 39, 46) mesh-unitcube-cpp 24.0988 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 26, 1, 40, 28) mesh-iteration-cpp 39.1696 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 26, 1, 40, 49) function-evaluation-cpp 21.1318 "Evaluations of functions at arbitrary points."
+(2013, 9, 26, 1, 40, 49) function-evaluation-cpp 21.0351 "Evaluations of functions at arbitrary points."
+(2013, 9, 26, 1, 40, 53) function-extrapolation-python 3.70398 "BENCH:  1.08206582069"
+(2013, 9, 26, 1, 40, 53) function-extrapolation-python 1.08207 "BENCH:  1.08206582069"
+(2013, 9, 26, 1, 40, 55) function-interpolation-python 1.63508 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 26, 1, 40, 55) function-interpolation-python 0.966312 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 26, 1, 41, 20) la-vector-access-cpp 25.4728 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 26, 1, 41, 47) la-vector-assignment-cpp 27.0971 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 27, 1, 23, 2) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2051 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 27, 1, 23, 21) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7808 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 27, 1, 23, 38) geometry-bounding_box_tree_build-cpp 13.9336 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 27, 1, 24, 5) common-progress-cpp 27.6632 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 27, 1, 24, 35) common-timing-cpp 29.9394 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 27, 1, 28, 1) fem-multicore-cpp 205.8 "Coloring mesh."
+(2013, 9, 27, 1, 30, 34) fem-assembly-cpp 153.245 "Assembly for various forms and backends"
+(2013, 9, 27, 1, 30, 49) fem-convergence-cpp 14.2043 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 27, 1, 30, 50) fem-jit-python 0.0010273 "JIT compilation (in memory cache)"
+(2013, 9, 27, 1, 38, 53) mesh-refinement-cpp 19.9559 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 27, 1, 39, 13) mesh-topology-cpp 19.4859 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 27, 1, 39, 37) mesh-unitcube-cpp 24.1277 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 27, 1, 40, 15) mesh-iteration-cpp 35.4216 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 27, 1, 40, 36) function-evaluation-cpp 21.1238 "Evaluations of functions at arbitrary points."
+(2013, 9, 27, 1, 40, 36) function-evaluation-cpp 21.0154 "Evaluations of functions at arbitrary points."
+(2013, 9, 27, 1, 40, 40) function-extrapolation-python 3.47082 "BENCH:  1.06766915321"
+(2013, 9, 27, 1, 40, 40) function-extrapolation-python 1.06767 "BENCH:  1.06766915321"
+(2013, 9, 27, 1, 40, 41) function-interpolation-python 1.65261 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 27, 1, 40, 41) function-interpolation-python 0.966008 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 27, 1, 41, 7) la-vector-access-cpp 25.4445 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 27, 1, 41, 34) la-vector-assignment-cpp 27.0964 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 28, 1, 34, 5) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2037 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 28, 1, 34, 24) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6541 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 28, 1, 34, 41) geometry-bounding_box_tree_build-cpp 13.9105 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 28, 1, 35, 9) common-progress-cpp 27.6983 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 28, 1, 35, 38) common-timing-cpp 29.6619 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 28, 1, 39, 4) fem-multicore-cpp 205.708 "Coloring mesh."
+(2013, 9, 28, 1, 41, 37) fem-assembly-cpp 153.46 "Assembly for various forms and backends"
+(2013, 9, 28, 1, 41, 52) fem-convergence-cpp 14.1977 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 28, 1, 41, 54) fem-jit-python 0.0010283 "JIT compilation (in memory cache)"
+(2013, 9, 28, 1, 49, 55) mesh-refinement-cpp 19.9882 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 28, 1, 50, 14) mesh-topology-cpp 19.4742 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 28, 1, 50, 38) mesh-unitcube-cpp 24.1688 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 28, 1, 51, 25) mesh-iteration-cpp 44.1761 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 28, 1, 51, 46) function-evaluation-cpp 21.0949 "Evaluations of functions at arbitrary points."
+(2013, 9, 28, 1, 51, 46) function-evaluation-cpp 21.0094 "Evaluations of functions at arbitrary points."
+(2013, 9, 28, 1, 51, 50) function-extrapolation-python 3.57366 "BENCH:  1.08244895935"
+(2013, 9, 28, 1, 51, 50) function-extrapolation-python 1.08245 "BENCH:  1.08244895935"
+(2013, 9, 28, 1, 51, 52) function-interpolation-python 1.65361 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 28, 1, 51, 52) function-interpolation-python 0.964955 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 28, 1, 52, 17) la-vector-access-cpp 25.442 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 28, 1, 52, 44) la-vector-assignment-cpp 26.9872 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 29, 1, 30, 8) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2405 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 29, 1, 30, 27) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6477 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 29, 1, 30, 44) geometry-bounding_box_tree_build-cpp 13.9739 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 29, 1, 31, 11) common-progress-cpp 27.6535 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 29, 1, 31, 42) common-timing-cpp 30.2627 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 29, 1, 35, 8) fem-multicore-cpp 206.069 "Coloring mesh."
+(2013, 9, 29, 1, 37, 41) fem-assembly-cpp 153.107 "Assembly for various forms and backends"
+(2013, 9, 29, 1, 37, 55) fem-convergence-cpp 14.2171 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 29, 1, 37, 57) fem-jit-python 0.0010253 "JIT compilation (in memory cache)"
+(2013, 9, 29, 1, 45, 56) mesh-refinement-cpp 19.9574 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 29, 1, 46, 16) mesh-topology-cpp 19.5648 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 29, 1, 46, 40) mesh-unitcube-cpp 24.093 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 29, 1, 47, 18) mesh-iteration-cpp 35.4802 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 29, 1, 47, 39) function-evaluation-cpp 21.1159 "Evaluations of functions at arbitrary points."
+(2013, 9, 29, 1, 47, 39) function-evaluation-cpp 21.0217 "Evaluations of functions at arbitrary points."
+(2013, 9, 29, 1, 47, 43) function-extrapolation-python 3.66224 "BENCH:  1.06667804718"
+(2013, 9, 29, 1, 47, 43) function-extrapolation-python 1.06668 "BENCH:  1.06667804718"
+(2013, 9, 29, 1, 47, 45) function-interpolation-python 1.66283 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 29, 1, 47, 45) function-interpolation-python 0.964002 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 29, 1, 48, 10) la-vector-access-cpp 25.472 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 29, 1, 48, 37) la-vector-assignment-cpp 27.1015 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 9, 30, 1, 27, 28) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2359 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 30, 1, 27, 47) geometry-bounding_box_tree_compute_closest_entity-cpp 15.551 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 9, 30, 1, 28, 4) geometry-bounding_box_tree_build-cpp 13.9624 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 9, 30, 1, 28, 31) common-progress-cpp 27.6526 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 9, 30, 1, 29, 2) common-timing-cpp 30.5294 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 9, 30, 1, 32, 28) fem-multicore-cpp 205.816 "Coloring mesh."
+(2013, 9, 30, 1, 35, 1) fem-assembly-cpp 152.988 "Assembly for various forms and backends"
+(2013, 9, 30, 1, 35, 15) fem-convergence-cpp 14.2009 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 9, 30, 1, 35, 17) fem-jit-python 0.0010253 "JIT compilation (in memory cache)"
+(2013, 9, 30, 1, 43, 19) mesh-refinement-cpp 19.9378 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 9, 30, 1, 43, 38) mesh-topology-cpp 19.4735 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 9, 30, 1, 44, 3) mesh-unitcube-cpp 24.1112 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 9, 30, 1, 44, 49) mesh-iteration-cpp 44.1903 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 9, 30, 1, 45, 10) function-evaluation-cpp 21.1726 "Evaluations of functions at arbitrary points."
+(2013, 9, 30, 1, 45, 10) function-evaluation-cpp 21.0739 "Evaluations of functions at arbitrary points."
+(2013, 9, 30, 1, 45, 14) function-extrapolation-python 3.52768 "BENCH:  1.04921603203"
+(2013, 9, 30, 1, 45, 14) function-extrapolation-python 1.04922 "BENCH:  1.04921603203"
+(2013, 9, 30, 1, 45, 16) function-interpolation-python 1.65985 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 30, 1, 45, 16) function-interpolation-python 0.963018 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 9, 30, 1, 45, 44) la-vector-access-cpp 28.4764 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 9, 30, 1, 46, 11) la-vector-assignment-cpp 27.1333 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 1, 1, 36, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2179 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 1, 1, 37, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.738 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 1, 1, 37, 19) geometry-bounding_box_tree_build-cpp 13.953 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 1, 1, 37, 47) common-progress-cpp 27.6538 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 1, 1, 38, 17) common-timing-cpp 30.0495 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 1, 1, 41, 42) fem-multicore-cpp 205.832 "Coloring mesh."
+(2013, 10, 1, 1, 44, 16) fem-assembly-cpp 153.427 "Assembly for various forms and backends"
+(2013, 10, 1, 1, 44, 30) fem-convergence-cpp 14.2077 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 1, 1, 44, 32) fem-jit-python 0.00101299 "JIT compilation (in memory cache)"
+(2013, 10, 1, 1, 52, 30) mesh-refinement-cpp 19.9788 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 1, 1, 52, 50) mesh-topology-cpp 19.5295 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 1, 1, 53, 14) mesh-unitcube-cpp 24.0903 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 1, 1, 53, 52) mesh-iteration-cpp 35.4861 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 1, 1, 54, 13) function-evaluation-cpp 21.1186 "Evaluations of functions at arbitrary points."
+(2013, 10, 1, 1, 54, 13) function-evaluation-cpp 21.0132 "Evaluations of functions at arbitrary points."
+(2013, 10, 1, 1, 54, 16) function-extrapolation-python 3.67901 "BENCH:  1.07571601868"
+(2013, 10, 1, 1, 54, 16) function-extrapolation-python 1.07572 "BENCH:  1.07571601868"
+(2013, 10, 1, 1, 54, 18) function-interpolation-python 1.64451 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 1, 1, 54, 18) function-interpolation-python 0.956019 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 1, 1, 54, 47) la-vector-access-cpp 28.4633 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 1, 1, 55, 14) la-vector-assignment-cpp 27.0963 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 2, 1, 34, 12) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1837 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 2, 1, 34, 32) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8518 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 2, 1, 34, 48) geometry-bounding_box_tree_build-cpp 13.9266 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 2, 1, 35, 16) common-progress-cpp 27.7078 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 2, 1, 35, 46) common-timing-cpp 29.9973 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 2, 1, 39, 12) fem-multicore-cpp 206.46 "Coloring mesh."
+(2013, 10, 2, 1, 41, 45) fem-assembly-cpp 152.871 "Assembly for various forms and backends"
+(2013, 10, 2, 1, 42, 0) fem-convergence-cpp 14.216 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 2, 1, 42, 1) fem-jit-python 0.00103109 "JIT compilation (in memory cache)"
+(2013, 10, 2, 1, 50, 4) mesh-refinement-cpp 19.9922 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 2, 1, 50, 23) mesh-topology-cpp 19.4925 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 2, 1, 50, 47) mesh-unitcube-cpp 24.1124 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 2, 1, 51, 29) mesh-iteration-cpp 39.1661 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 2, 1, 51, 50) function-evaluation-cpp 21.0991 "Evaluations of functions at arbitrary points."
+(2013, 10, 2, 1, 51, 50) function-evaluation-cpp 21.0148 "Evaluations of functions at arbitrary points."
+(2013, 10, 2, 1, 51, 54) function-extrapolation-python 3.55264 "BENCH:  1.10233402252"
+(2013, 10, 2, 1, 51, 54) function-extrapolation-python 1.10233 "BENCH:  1.10233402252"
+(2013, 10, 2, 1, 51, 56) function-interpolation-python 1.65173 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 2, 1, 51, 56) function-interpolation-python 0.968611 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 2, 1, 52, 24) la-vector-access-cpp 28.4477 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 2, 1, 52, 51) la-vector-assignment-cpp 27.0896 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 3, 1, 24, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1769 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 3, 1, 24, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6067 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 3, 1, 24, 58) geometry-bounding_box_tree_build-cpp 13.9311 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 3, 1, 25, 26) common-progress-cpp 27.6529 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 3, 1, 25, 55) common-timing-cpp 29.261 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 3, 1, 29, 21) fem-multicore-cpp 205.745 "Coloring mesh."
+(2013, 10, 3, 1, 31, 54) fem-assembly-cpp 152.919 "Assembly for various forms and backends"
+(2013, 10, 3, 1, 32, 8) fem-convergence-cpp 14.2125 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 3, 1, 32, 10) fem-jit-python 0.0010536 "JIT compilation (in memory cache)"
+(2013, 10, 3, 1, 40, 11) mesh-refinement-cpp 19.9858 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 3, 1, 40, 30) mesh-topology-cpp 19.5508 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 3, 1, 40, 54) mesh-unitcube-cpp 24.1076 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 3, 1, 41, 32) mesh-iteration-cpp 35.492 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 3, 1, 41, 54) function-evaluation-cpp 21.08 "Evaluations of functions at arbitrary points."
+(2013, 10, 3, 1, 41, 54) function-evaluation-cpp 20.996 "Evaluations of functions at arbitrary points."
+(2013, 10, 3, 1, 41, 57) function-extrapolation-python 3.61241 "BENCH:  1.07668590546"
+(2013, 10, 3, 1, 41, 57) function-extrapolation-python 1.07669 "BENCH:  1.07668590546"
+(2013, 10, 3, 1, 41, 59) function-interpolation-python 1.68845 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 3, 1, 41, 59) function-interpolation-python 0.959476 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 3, 1, 42, 24) la-vector-access-cpp 25.4449 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 3, 1, 42, 51) la-vector-assignment-cpp 27.0841 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 4, 1, 31, 11) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2423 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 4, 1, 31, 30) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5403 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 4, 1, 31, 47) geometry-bounding_box_tree_build-cpp 13.9001 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 4, 1, 32, 15) common-progress-cpp 27.6538 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 4, 1, 32, 45) common-timing-cpp 30.4291 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 4, 1, 36, 11) fem-multicore-cpp 205.84 "Coloring mesh."
+(2013, 10, 4, 1, 38, 44) fem-assembly-cpp 153.415 "Assembly for various forms and backends"
+(2013, 10, 4, 1, 38, 58) fem-convergence-cpp 14.2057 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 4, 1, 39, 0) fem-jit-python 0.00105212 "JIT compilation (in memory cache)"
+(2013, 10, 4, 1, 47, 0) mesh-refinement-cpp 20.004 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 4, 1, 47, 20) mesh-topology-cpp 19.5044 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 4, 1, 47, 44) mesh-unitcube-cpp 24.1192 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 4, 1, 48, 22) mesh-iteration-cpp 35.4482 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 4, 1, 48, 43) function-evaluation-cpp 21.0934 "Evaluations of functions at arbitrary points."
+(2013, 10, 4, 1, 48, 43) function-evaluation-cpp 21.0024 "Evaluations of functions at arbitrary points."
+(2013, 10, 4, 1, 48, 46) function-extrapolation-python 3.55419 "BENCH:  1.08774518967"
+(2013, 10, 4, 1, 48, 46) function-extrapolation-python 1.08775 "BENCH:  1.08774518967"
+(2013, 10, 4, 1, 48, 48) function-interpolation-python 1.67038 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 4, 1, 48, 48) function-interpolation-python 0.964839 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 4, 1, 49, 14) la-vector-access-cpp 25.4455 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 4, 1, 49, 41) la-vector-assignment-cpp 27.0838 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 5, 1, 34, 21) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.172 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 5, 1, 34, 40) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5067 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 5, 1, 34, 56) geometry-bounding_box_tree_build-cpp 14.0038 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 5, 1, 35, 24) common-progress-cpp 27.6545 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 5, 1, 35, 54) common-timing-cpp 30.3125 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 5, 1, 39, 20) fem-multicore-cpp 205.686 "Coloring mesh."
+(2013, 10, 5, 1, 41, 53) fem-assembly-cpp 153.291 "Assembly for various forms and backends"
+(2013, 10, 5, 1, 42, 7) fem-convergence-cpp 14.2004 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 5, 1, 42, 9) fem-jit-python 0.00103581 "JIT compilation (in memory cache)"
+(2013, 10, 5, 1, 50, 10) mesh-refinement-cpp 20.0372 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 5, 1, 50, 30) mesh-topology-cpp 19.4921 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 5, 1, 50, 54) mesh-unitcube-cpp 24.1373 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 5, 1, 51, 32) mesh-iteration-cpp 35.4948 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 5, 1, 51, 53) function-evaluation-cpp 21.1026 "Evaluations of functions at arbitrary points."
+(2013, 10, 5, 1, 51, 53) function-evaluation-cpp 21.0112 "Evaluations of functions at arbitrary points."
+(2013, 10, 5, 1, 51, 57) function-extrapolation-python 3.52105 "BENCH:  1.07699298859"
+(2013, 10, 5, 1, 51, 57) function-extrapolation-python 1.07699 "BENCH:  1.07699298859"
+(2013, 10, 5, 1, 51, 59) function-interpolation-python 1.65767 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 5, 1, 51, 59) function-interpolation-python 0.953594 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 5, 1, 52, 24) la-vector-access-cpp 25.4458 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 5, 1, 52, 51) la-vector-assignment-cpp 27.087 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 6, 1, 31, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2236 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 6, 1, 32, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.793 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 6, 1, 32, 19) geometry-bounding_box_tree_build-cpp 13.8958 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 6, 1, 32, 47) common-progress-cpp 27.7017 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 6, 1, 33, 16) common-timing-cpp 29.3658 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 6, 1, 36, 42) fem-multicore-cpp 205.685 "Coloring mesh."
+(2013, 10, 6, 1, 39, 15) fem-assembly-cpp 152.715 "Assembly for various forms and backends"
+(2013, 10, 6, 1, 39, 29) fem-convergence-cpp 14.2049 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 6, 1, 39, 31) fem-jit-python 0.0010392 "JIT compilation (in memory cache)"
+(2013, 10, 6, 1, 47, 33) mesh-refinement-cpp 19.9816 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 6, 1, 47, 53) mesh-topology-cpp 19.5168 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 6, 1, 48, 17) mesh-unitcube-cpp 24.1788 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 6, 1, 48, 55) mesh-iteration-cpp 35.5056 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 6, 1, 49, 17) function-evaluation-cpp 21.9193 "Evaluations of functions at arbitrary points."
+(2013, 10, 6, 1, 49, 17) function-evaluation-cpp 21.8309 "Evaluations of functions at arbitrary points."
+(2013, 10, 6, 1, 49, 21) function-extrapolation-python 3.62091 "BENCH:  1.09147000313"
+(2013, 10, 6, 1, 49, 21) function-extrapolation-python 1.09147 "BENCH:  1.09147000313"
+(2013, 10, 6, 1, 49, 22) function-interpolation-python 1.64509 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 6, 1, 49, 22) function-interpolation-python 0.959383 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 6, 1, 49, 48) la-vector-access-cpp 25.4431 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 6, 1, 50, 15) la-vector-assignment-cpp 27.4613 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 7, 1, 22, 17) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1612 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 7, 1, 22, 35) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5026 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 7, 1, 22, 52) geometry-bounding_box_tree_build-cpp 13.9024 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 7, 1, 23, 20) common-progress-cpp 27.6543 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 7, 1, 23, 50) common-timing-cpp 30.4938 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 7, 1, 27, 16) fem-multicore-cpp 205.74 "Coloring mesh."
+(2013, 10, 7, 1, 29, 50) fem-assembly-cpp 153.815 "Assembly for various forms and backends"
+(2013, 10, 7, 1, 30, 4) fem-convergence-cpp 14.21 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 7, 1, 30, 6) fem-jit-python 0.0010479 "JIT compilation (in memory cache)"
+(2013, 10, 7, 1, 38, 8) mesh-refinement-cpp 20.0396 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 7, 1, 38, 28) mesh-topology-cpp 19.5117 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 7, 1, 38, 52) mesh-unitcube-cpp 24.1223 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 7, 1, 39, 30) mesh-iteration-cpp 35.498 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 7, 1, 39, 51) function-evaluation-cpp 21.0898 "Evaluations of functions at arbitrary points."
+(2013, 10, 7, 1, 39, 51) function-evaluation-cpp 21.0068 "Evaluations of functions at arbitrary points."
+(2013, 10, 7, 1, 39, 55) function-extrapolation-python 3.54647 "BENCH:  1.07335305214"
+(2013, 10, 7, 1, 39, 55) function-extrapolation-python 1.07335 "BENCH:  1.07335305214"
+(2013, 10, 7, 1, 39, 56) function-interpolation-python 1.66153 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 7, 1, 39, 56) function-interpolation-python 0.966186 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 7, 1, 40, 22) la-vector-access-cpp 25.4471 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 7, 1, 40, 49) la-vector-assignment-cpp 27.3791 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 8, 1, 27, 58) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1714 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 8, 1, 28, 17) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8123 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 8, 1, 28, 34) geometry-bounding_box_tree_build-cpp 13.8922 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 8, 1, 29, 2) common-progress-cpp 27.6544 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 8, 1, 29, 32) common-timing-cpp 30.1013 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 8, 1, 32, 57) fem-multicore-cpp 205.671 "Coloring mesh."
+(2013, 10, 8, 1, 35, 30) fem-assembly-cpp 153.068 "Assembly for various forms and backends"
+(2013, 10, 8, 1, 35, 45) fem-convergence-cpp 14.2023 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 8, 1, 35, 47) fem-jit-python 0.00103979 "JIT compilation (in memory cache)"
+(2013, 10, 8, 1, 43, 49) mesh-refinement-cpp 20.0194 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 8, 1, 44, 8) mesh-topology-cpp 19.5115 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 8, 1, 44, 32) mesh-unitcube-cpp 24.1516 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 8, 1, 45, 19) mesh-iteration-cpp 44.1916 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 8, 1, 45, 40) function-evaluation-cpp 21.248 "Evaluations of functions at arbitrary points."
+(2013, 10, 8, 1, 45, 40) function-evaluation-cpp 21.165 "Evaluations of functions at arbitrary points."
+(2013, 10, 8, 1, 45, 44) function-extrapolation-python 3.38204 "BENCH:  1.03664708138"
+(2013, 10, 8, 1, 45, 44) function-extrapolation-python 1.03665 "BENCH:  1.03664708138"
+(2013, 10, 8, 1, 45, 45) function-interpolation-python 1.65062 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 8, 1, 45, 45) function-interpolation-python 0.958467 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 8, 1, 46, 11) la-vector-access-cpp 25.4482 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 8, 1, 46, 38) la-vector-assignment-cpp 27.1013 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 9, 1, 24, 24) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1729 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 9, 1, 24, 43) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4633 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 9, 1, 25, 0) geometry-bounding_box_tree_build-cpp 13.8902 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 9, 1, 25, 27) common-progress-cpp 27.6542 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 9, 1, 25, 59) common-timing-cpp 31.2178 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 9, 1, 29, 25) fem-multicore-cpp 205.904 "Coloring mesh."
+(2013, 10, 9, 1, 31, 58) fem-assembly-cpp 153.311 "Assembly for various forms and backends"
+(2013, 10, 9, 1, 32, 12) fem-convergence-cpp 14.2161 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 9, 1, 32, 14) fem-jit-python 0.0010448 "JIT compilation (in memory cache)"
+(2013, 10, 9, 1, 40, 16) mesh-refinement-cpp 19.9798 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 9, 1, 40, 36) mesh-topology-cpp 19.4669 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 9, 1, 41, 0) mesh-unitcube-cpp 24.1202 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 9, 1, 41, 38) mesh-iteration-cpp 35.4889 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 9, 1, 41, 59) function-evaluation-cpp 21.0781 "Evaluations of functions at arbitrary points."
+(2013, 10, 9, 1, 41, 59) function-evaluation-cpp 21.0003 "Evaluations of functions at arbitrary points."
+(2013, 10, 9, 1, 42, 3) function-extrapolation-python 3.41691 "BENCH:  1.052120924"
+(2013, 10, 9, 1, 42, 3) function-extrapolation-python 1.05212 "BENCH:  1.052120924"
+(2013, 10, 9, 1, 42, 4) function-interpolation-python 1.65973 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 9, 1, 42, 4) function-interpolation-python 0.96377 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 9, 1, 42, 30) la-vector-access-cpp 25.4125 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 9, 1, 42, 59) la-vector-assignment-cpp 29.1111 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 10, 1, 29, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2728 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 10, 1, 29, 52) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4543 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 10, 1, 30, 9) geometry-bounding_box_tree_build-cpp 13.9127 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 10, 1, 30, 37) common-progress-cpp 27.654 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 10, 1, 31, 6) common-timing-cpp 29.799 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 10, 1, 34, 32) fem-multicore-cpp 205.965 "Coloring mesh."
+(2013, 10, 10, 1, 37, 6) fem-assembly-cpp 153.953 "Assembly for various forms and backends"
+(2013, 10, 10, 1, 37, 20) fem-convergence-cpp 14.2085 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 10, 1, 37, 22) fem-jit-python 0.00104251 "JIT compilation (in memory cache)"
+(2013, 10, 10, 1, 45, 22) mesh-refinement-cpp 19.9958 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 10, 1, 45, 42) mesh-topology-cpp 19.4907 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 10, 1, 46, 6) mesh-unitcube-cpp 24.1582 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 10, 1, 46, 44) mesh-iteration-cpp 35.4912 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 10, 1, 47, 5) function-evaluation-cpp 21.1344 "Evaluations of functions at arbitrary points."
+(2013, 10, 10, 1, 47, 5) function-evaluation-cpp 21.0501 "Evaluations of functions at arbitrary points."
+(2013, 10, 10, 1, 47, 8) function-extrapolation-python 3.42955 "BENCH:  1.04549312592"
+(2013, 10, 10, 1, 47, 8) function-extrapolation-python 1.04549 "BENCH:  1.04549312592"
+(2013, 10, 10, 1, 47, 10) function-interpolation-python 1.66636 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 10, 1, 47, 10) function-interpolation-python 0.963219 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 10, 1, 47, 35) la-vector-access-cpp 25.4454 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 10, 1, 48, 3) la-vector-assignment-cpp 27.0883 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 11, 1, 25, 52) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2517 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 11, 1, 26, 11) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4675 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 11, 1, 26, 28) geometry-bounding_box_tree_build-cpp 13.9087 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 11, 1, 26, 55) common-progress-cpp 27.654 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 11, 1, 27, 26) common-timing-cpp 30.3191 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 11, 1, 30, 51) fem-multicore-cpp 205.802 "Coloring mesh."
+(2013, 10, 11, 1, 33, 25) fem-assembly-cpp 153.561 "Assembly for various forms and backends"
+(2013, 10, 11, 1, 33, 39) fem-convergence-cpp 14.2147 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 11, 1, 33, 41) fem-jit-python 0.0010422 "JIT compilation (in memory cache)"
+(2013, 10, 11, 1, 41, 42) mesh-refinement-cpp 19.9884 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 11, 1, 42, 2) mesh-topology-cpp 19.4407 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 11, 1, 42, 26) mesh-unitcube-cpp 24.1511 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 11, 1, 43, 4) mesh-iteration-cpp 35.4242 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 11, 1, 43, 25) function-evaluation-cpp 21.5886 "Evaluations of functions at arbitrary points."
+(2013, 10, 11, 1, 43, 25) function-evaluation-cpp 21.4889 "Evaluations of functions at arbitrary points."
+(2013, 10, 11, 1, 43, 29) function-extrapolation-python 3.49587 "BENCH:  1.05149507523"
+(2013, 10, 11, 1, 43, 29) function-extrapolation-python 1.0515 "BENCH:  1.05149507523"
+(2013, 10, 11, 1, 43, 31) function-interpolation-python 1.66646 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 11, 1, 43, 31) function-interpolation-python 0.9587 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 11, 1, 43, 56) la-vector-access-cpp 25.4456 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 11, 1, 44, 23) la-vector-assignment-cpp 27.1223 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 12, 1, 23, 18) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.3262 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 12, 1, 23, 37) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5781 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 12, 1, 23, 54) geometry-bounding_box_tree_build-cpp 13.9129 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 12, 1, 24, 22) common-progress-cpp 27.6994 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 12, 1, 24, 51) common-timing-cpp 29.6179 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 12, 1, 28, 17) fem-multicore-cpp 206.165 "Coloring mesh."
+(2013, 10, 12, 1, 30, 51) fem-assembly-cpp 153.099 "Assembly for various forms and backends"
+(2013, 10, 12, 1, 31, 5) fem-convergence-cpp 14.1997 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 12, 1, 31, 7) fem-jit-python 0.00104721 "JIT compilation (in memory cache)"
+(2013, 10, 12, 1, 39, 8) mesh-refinement-cpp 20.0286 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 12, 1, 39, 27) mesh-topology-cpp 19.5319 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 12, 1, 39, 51) mesh-unitcube-cpp 24.1438 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 12, 1, 40, 29) mesh-iteration-cpp 35.4232 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 12, 1, 40, 50) function-evaluation-cpp 21.1512 "Evaluations of functions at arbitrary points."
+(2013, 10, 12, 1, 40, 50) function-evaluation-cpp 21.0398 "Evaluations of functions at arbitrary points."
+(2013, 10, 12, 1, 40, 54) function-extrapolation-python 3.55272 "BENCH:  1.05189394951"
+(2013, 10, 12, 1, 40, 54) function-extrapolation-python 1.05189 "BENCH:  1.05189394951"
+(2013, 10, 12, 1, 40, 56) function-interpolation-python 1.65244 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 12, 1, 40, 56) function-interpolation-python 0.959537 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 12, 1, 41, 21) la-vector-access-cpp 25.444 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 12, 1, 41, 50) la-vector-assignment-cpp 29.1551 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 13, 1, 32, 34) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.3028 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 13, 1, 32, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5486 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 13, 1, 33, 9) geometry-bounding_box_tree_build-cpp 13.8936 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 13, 1, 33, 37) common-progress-cpp 27.6534 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 13, 1, 34, 7) common-timing-cpp 29.4836 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 13, 1, 37, 32) fem-multicore-cpp 205.716 "Coloring mesh."
+(2013, 10, 13, 1, 40, 6) fem-assembly-cpp 153.832 "Assembly for various forms and backends"
+(2013, 10, 13, 1, 40, 20) fem-convergence-cpp 14.2053 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 13, 1, 40, 22) fem-jit-python 0.0010504 "JIT compilation (in memory cache)"
+(2013, 10, 13, 1, 48, 24) mesh-refinement-cpp 19.9856 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 13, 1, 48, 43) mesh-topology-cpp 19.4784 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 13, 1, 49, 7) mesh-unitcube-cpp 24.2334 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 13, 1, 49, 54) mesh-iteration-cpp 44.1901 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 13, 1, 50, 15) function-evaluation-cpp 21.1017 "Evaluations of functions at arbitrary points."
+(2013, 10, 13, 1, 50, 15) function-evaluation-cpp 21.0228 "Evaluations of functions at arbitrary points."
+(2013, 10, 13, 1, 50, 19) function-extrapolation-python 3.50942 "BENCH:  1.059237957"
+(2013, 10, 13, 1, 50, 19) function-extrapolation-python 1.05924 "BENCH:  1.059237957"
+(2013, 10, 13, 1, 50, 20) function-interpolation-python 1.64345 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 13, 1, 50, 20) function-interpolation-python 0.957713 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 13, 1, 50, 46) la-vector-access-cpp 25.4443 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 13, 1, 51, 13) la-vector-assignment-cpp 27.0373 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 14, 1, 26, 11) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.166 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 14, 1, 26, 30) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5309 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 14, 1, 26, 46) geometry-bounding_box_tree_build-cpp 13.9187 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 14, 1, 27, 14) common-progress-cpp 27.6534 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 14, 1, 27, 45) common-timing-cpp 30.4655 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 14, 1, 31, 10) fem-multicore-cpp 205.478 "Coloring mesh."
+(2013, 10, 14, 1, 33, 43) fem-assembly-cpp 153.22 "Assembly for various forms and backends"
+(2013, 10, 14, 1, 33, 57) fem-convergence-cpp 14.2167 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 14, 1, 33, 59) fem-jit-python 0.0010437 "JIT compilation (in memory cache)"
+(2013, 10, 14, 1, 42, 0) mesh-refinement-cpp 19.9629 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 14, 1, 42, 20) mesh-topology-cpp 19.4957 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 14, 1, 42, 44) mesh-unitcube-cpp 24.1358 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 14, 1, 43, 22) mesh-iteration-cpp 35.4821 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 14, 1, 43, 43) function-evaluation-cpp 21.0829 "Evaluations of functions at arbitrary points."
+(2013, 10, 14, 1, 43, 43) function-evaluation-cpp 21.0002 "Evaluations of functions at arbitrary points."
+(2013, 10, 14, 1, 43, 46) function-extrapolation-python 3.50349 "BENCH:  1.05115294456"
+(2013, 10, 14, 1, 43, 46) function-extrapolation-python 1.05115 "BENCH:  1.05115294456"
+(2013, 10, 14, 1, 43, 48) function-interpolation-python 1.70877 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 14, 1, 43, 48) function-interpolation-python 0.960066 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 14, 1, 44, 14) la-vector-access-cpp 25.4876 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 14, 1, 44, 41) la-vector-assignment-cpp 27.0381 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 15, 1, 26, 28) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2003 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 15, 1, 26, 47) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4288 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 15, 1, 27, 4) geometry-bounding_box_tree_build-cpp 13.9256 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 15, 1, 27, 32) common-progress-cpp 27.6531 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 15, 1, 28, 2) common-timing-cpp 30.2115 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 15, 1, 31, 28) fem-multicore-cpp 206.349 "Coloring mesh."
+(2013, 10, 15, 1, 34, 1) fem-assembly-cpp 152.6 "Assembly for various forms and backends"
+(2013, 10, 15, 1, 34, 15) fem-convergence-cpp 14.2011 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 15, 1, 34, 17) fem-jit-python 0.00103641 "JIT compilation (in memory cache)"
+(2013, 10, 15, 1, 42, 14) mesh-refinement-cpp 19.9771 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 15, 1, 42, 34) mesh-topology-cpp 19.4941 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 15, 1, 42, 58) mesh-unitcube-cpp 24.2276 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 15, 1, 43, 36) mesh-iteration-cpp 35.421 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 15, 1, 43, 57) function-evaluation-cpp 21.1841 "Evaluations of functions at arbitrary points."
+(2013, 10, 15, 1, 43, 57) function-evaluation-cpp 21.0839 "Evaluations of functions at arbitrary points."
+(2013, 10, 15, 1, 44, 1) function-extrapolation-python 3.70392 "BENCH:  1.0477449894"
+(2013, 10, 15, 1, 44, 1) function-extrapolation-python 1.04774 "BENCH:  1.0477449894"
+(2013, 10, 15, 1, 44, 3) function-interpolation-python 1.63328 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 15, 1, 44, 3) function-interpolation-python 0.961099 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 15, 1, 44, 28) la-vector-access-cpp 25.4821 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 15, 1, 44, 55) la-vector-assignment-cpp 27.1022 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 16, 1, 36, 25) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1894 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 16, 1, 36, 44) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4606 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 16, 1, 37, 1) geometry-bounding_box_tree_build-cpp 13.9155 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 16, 1, 37, 29) common-progress-cpp 27.6539 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 16, 1, 37, 59) common-timing-cpp 30.342 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 16, 1, 41, 23) fem-multicore-cpp 204.023 "Coloring mesh."
+(2013, 10, 16, 1, 43, 55) fem-assembly-cpp 152.257 "Assembly for various forms and backends"
+(2013, 10, 16, 1, 44, 9) fem-convergence-cpp 14.2078 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 16, 1, 44, 11) fem-jit-python 0.001055 "JIT compilation (in memory cache)"
+(2013, 10, 16, 1, 52, 14) mesh-refinement-cpp 19.9869 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 16, 1, 52, 34) mesh-topology-cpp 19.5308 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 16, 1, 52, 58) mesh-unitcube-cpp 24.2922 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 16, 1, 53, 36) mesh-iteration-cpp 35.4795 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 16, 1, 53, 57) function-evaluation-cpp 21.1449 "Evaluations of functions at arbitrary points."
+(2013, 10, 16, 1, 53, 57) function-evaluation-cpp 21.0534 "Evaluations of functions at arbitrary points."
+(2013, 10, 16, 1, 54, 1) function-extrapolation-python 3.42836 "BENCH:  1.04853320122"
+(2013, 10, 16, 1, 54, 1) function-extrapolation-python 1.04853 "BENCH:  1.04853320122"
+(2013, 10, 16, 1, 54, 2) function-interpolation-python 1.67661 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 16, 1, 54, 2) function-interpolation-python 0.962554 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 16, 1, 54, 26) la-vector-access-cpp 23.4363 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 16, 1, 54, 53) la-vector-assignment-cpp 27.0872 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 17, 1, 29, 20) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1932 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 17, 1, 29, 39) geometry-bounding_box_tree_compute_closest_entity-cpp 15.583 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 17, 1, 29, 56) geometry-bounding_box_tree_build-cpp 13.8975 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 17, 1, 30, 24) common-progress-cpp 27.6539 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 17, 1, 30, 53) common-timing-cpp 29.8792 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 17, 1, 34, 17) fem-multicore-cpp 203.882 "Coloring mesh."
+(2013, 10, 17, 1, 36, 49) fem-assembly-cpp 151.94 "Assembly for various forms and backends"
+(2013, 10, 17, 1, 37, 4) fem-convergence-cpp 14.2185 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 17, 1, 37, 5) fem-jit-python 0.0010479 "JIT compilation (in memory cache)"
+(2013, 10, 17, 1, 45, 5) mesh-refinement-cpp 19.976 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 17, 1, 45, 25) mesh-topology-cpp 19.6033 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 17, 1, 45, 49) mesh-unitcube-cpp 24.1105 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 17, 1, 46, 27) mesh-iteration-cpp 35.6844 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 17, 1, 46, 49) function-evaluation-cpp 21.1123 "Evaluations of functions at arbitrary points."
+(2013, 10, 17, 1, 46, 49) function-evaluation-cpp 21.0183 "Evaluations of functions at arbitrary points."
+(2013, 10, 17, 1, 46, 52) function-extrapolation-python 3.51254 "BENCH:  1.04783797264"
+(2013, 10, 17, 1, 46, 52) function-extrapolation-python 1.04784 "BENCH:  1.04783797264"
+(2013, 10, 17, 1, 46, 54) function-interpolation-python 1.67046 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 17, 1, 46, 54) function-interpolation-python 0.975351 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 17, 1, 47, 17) la-vector-access-cpp 23.4541 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 17, 1, 47, 44) la-vector-assignment-cpp 27.0867 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 18, 1, 25, 15) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1458 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 18, 1, 25, 34) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9294 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 18, 1, 25, 51) geometry-bounding_box_tree_build-cpp 13.905 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 18, 1, 26, 18) common-progress-cpp 27.6538 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 18, 1, 26, 49) common-timing-cpp 30.5058 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 18, 1, 30, 13) fem-multicore-cpp 204.059 "Coloring mesh."
+(2013, 10, 18, 1, 32, 44) fem-assembly-cpp 151.656 "Assembly for various forms and backends"
+(2013, 10, 18, 1, 32, 59) fem-convergence-cpp 14.2242 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 18, 1, 33, 1) fem-jit-python 0.0010509 "JIT compilation (in memory cache)"
+(2013, 10, 18, 1, 41, 0) mesh-refinement-cpp 19.9802 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 18, 1, 41, 20) mesh-topology-cpp 19.4808 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 18, 1, 41, 44) mesh-unitcube-cpp 24.0913 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 18, 1, 42, 22) mesh-iteration-cpp 35.4891 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 18, 1, 42, 43) function-evaluation-cpp 21.1065 "Evaluations of functions at arbitrary points."
+(2013, 10, 18, 1, 42, 43) function-evaluation-cpp 21.0334 "Evaluations of functions at arbitrary points."
+(2013, 10, 18, 1, 42, 46) function-extrapolation-python 3.4294 "BENCH:  1.03152608871"
+(2013, 10, 18, 1, 42, 46) function-extrapolation-python 1.03153 "BENCH:  1.03152608871"
+(2013, 10, 18, 1, 42, 48) function-interpolation-python 1.67217 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 18, 1, 42, 48) function-interpolation-python 0.966518 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 18, 1, 43, 11) la-vector-access-cpp 23.4445 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 18, 1, 43, 38) la-vector-assignment-cpp 26.9759 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 19, 1, 24, 19) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2409 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 19, 1, 24, 38) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6008 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 19, 1, 24, 54) geometry-bounding_box_tree_build-cpp 13.8931 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 19, 1, 25, 22) common-progress-cpp 27.6532 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 19, 1, 25, 53) common-timing-cpp 30.8574 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 19, 1, 29, 17) fem-multicore-cpp 203.946 "Coloring mesh."
+(2013, 10, 19, 1, 31, 49) fem-assembly-cpp 152.208 "Assembly for various forms and backends"
+(2013, 10, 19, 1, 32, 3) fem-convergence-cpp 14.235 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 19, 1, 32, 5) fem-jit-python 0.0010391 "JIT compilation (in memory cache)"
+(2013, 10, 19, 1, 40, 7) mesh-refinement-cpp 19.9542 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 19, 1, 40, 26) mesh-topology-cpp 19.5557 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 19, 1, 40, 51) mesh-unitcube-cpp 24.1495 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 19, 1, 41, 29) mesh-iteration-cpp 35.5138 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 19, 1, 41, 50) function-evaluation-cpp 21.2203 "Evaluations of functions at arbitrary points."
+(2013, 10, 19, 1, 41, 50) function-evaluation-cpp 21.1362 "Evaluations of functions at arbitrary points."
+(2013, 10, 19, 1, 41, 53) function-extrapolation-python 3.47924 "BENCH:  1.05130505562"
+(2013, 10, 19, 1, 41, 53) function-extrapolation-python 1.05131 "BENCH:  1.05130505562"
+(2013, 10, 19, 1, 41, 55) function-interpolation-python 1.66018 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 19, 1, 41, 55) function-interpolation-python 0.971152 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 19, 1, 42, 19) la-vector-access-cpp 23.4636 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 19, 1, 42, 46) la-vector-assignment-cpp 27.0826 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 20, 1, 37, 19) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2259 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 20, 1, 37, 38) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5893 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 20, 1, 37, 54) geometry-bounding_box_tree_build-cpp 13.9742 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 20, 1, 38, 26) common-progress-cpp 31.4647 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 20, 1, 38, 56) common-timing-cpp 30.7248 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 20, 1, 42, 21) fem-multicore-cpp 204.23 "Coloring mesh."
+(2013, 10, 20, 1, 44, 52) fem-assembly-cpp 151.64 "Assembly for various forms and backends"
+(2013, 10, 20, 1, 45, 7) fem-convergence-cpp 14.1961 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 20, 1, 45, 9) fem-jit-python 0.0010421 "JIT compilation (in memory cache)"
+(2013, 10, 20, 1, 53, 10) mesh-refinement-cpp 19.9724 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 20, 1, 53, 29) mesh-topology-cpp 19.5091 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 20, 1, 53, 53) mesh-unitcube-cpp 24.0889 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 20, 1, 54, 31) mesh-iteration-cpp 35.4826 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 20, 1, 54, 52) function-evaluation-cpp 21.1203 "Evaluations of functions at arbitrary points."
+(2013, 10, 20, 1, 54, 52) function-evaluation-cpp 21.0471 "Evaluations of functions at arbitrary points."
+(2013, 10, 20, 1, 54, 56) function-extrapolation-python 3.46949 "BENCH:  1.04470419884"
+(2013, 10, 20, 1, 54, 56) function-extrapolation-python 1.0447 "BENCH:  1.04470419884"
+(2013, 10, 20, 1, 54, 58) function-interpolation-python 1.66814 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 20, 1, 54, 58) function-interpolation-python 0.965249 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 20, 1, 55, 23) la-vector-access-cpp 25.4452 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 20, 1, 55, 51) la-vector-assignment-cpp 28.1963 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 22, 1, 28, 4) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1973 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 22, 1, 28, 23) geometry-bounding_box_tree_compute_closest_entity-cpp 15.882 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 22, 1, 28, 40) geometry-bounding_box_tree_build-cpp 13.9339 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 22, 1, 29, 8) common-progress-cpp 27.7007 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 22, 1, 29, 38) common-timing-cpp 30.1005 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 22, 1, 33, 2) fem-multicore-cpp 204.082 "Coloring mesh."
+(2013, 10, 22, 1, 35, 35) fem-assembly-cpp 152.746 "Assembly for various forms and backends"
+(2013, 10, 22, 1, 35, 49) fem-convergence-cpp 14.2042 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 22, 1, 35, 51) fem-jit-python 0.00104568 "JIT compilation (in memory cache)"
+(2013, 10, 22, 1, 43, 52) mesh-refinement-cpp 20.0136 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 22, 1, 44, 11) mesh-topology-cpp 19.4639 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 22, 1, 44, 35) mesh-unitcube-cpp 24.1807 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 22, 1, 45, 13) mesh-iteration-cpp 35.4833 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 22, 1, 45, 35) function-evaluation-cpp 21.3886 "Evaluations of functions at arbitrary points."
+(2013, 10, 22, 1, 45, 35) function-evaluation-cpp 21.3155 "Evaluations of functions at arbitrary points."
+(2013, 10, 22, 1, 45, 38) function-extrapolation-python 3.52108 "BENCH:  1.06083893776"
+(2013, 10, 22, 1, 45, 38) function-extrapolation-python 1.06084 "BENCH:  1.06083893776"
+(2013, 10, 22, 1, 45, 40) function-interpolation-python 1.66047 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 22, 1, 45, 40) function-interpolation-python 0.968526 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 22, 1, 46, 3) la-vector-access-cpp 23.4463 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 22, 1, 46, 31) la-vector-assignment-cpp 27.1137 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 23, 1, 26, 5) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.044 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 23, 1, 26, 25) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9257 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 23, 1, 26, 41) geometry-bounding_box_tree_build-cpp 13.9294 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 23, 1, 27, 9) common-progress-cpp 27.664 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 23, 1, 27, 40) common-timing-cpp 31.1204 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 23, 1, 31, 4) fem-multicore-cpp 204.036 "Coloring mesh."
+(2013, 10, 23, 1, 33, 36) fem-assembly-cpp 151.929 "Assembly for various forms and backends"
+(2013, 10, 23, 1, 33, 50) fem-convergence-cpp 14.2205 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 23, 1, 33, 52) fem-jit-python 0.0010458 "JIT compilation (in memory cache)"
+(2013, 10, 23, 1, 41, 54) mesh-refinement-cpp 20.0746 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 23, 1, 42, 14) mesh-topology-cpp 19.9764 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 23, 1, 42, 39) mesh-unitcube-cpp 24.2103 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 23, 1, 43, 17) mesh-iteration-cpp 35.4828 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 23, 1, 43, 38) function-evaluation-cpp 21.0654 "Evaluations of functions at arbitrary points."
+(2013, 10, 23, 1, 43, 38) function-evaluation-cpp 20.9323 "Evaluations of functions at arbitrary points."
+(2013, 10, 23, 1, 43, 41) function-extrapolation-python 3.52907 "BENCH:  1.05461382866"
+(2013, 10, 23, 1, 43, 41) function-extrapolation-python 1.05461 "BENCH:  1.05461382866"
+(2013, 10, 23, 1, 43, 43) function-interpolation-python 1.65621 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 23, 1, 43, 43) function-interpolation-python 0.968356 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 23, 1, 44, 9) la-vector-access-cpp 25.4685 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 23, 1, 44, 36) la-vector-assignment-cpp 27.2208 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 24, 1, 37, 57) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1101 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 24, 1, 38, 16) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6399 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 24, 1, 38, 33) geometry-bounding_box_tree_build-cpp 13.9122 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 24, 1, 39, 1) common-progress-cpp 27.702 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 24, 1, 39, 33) common-timing-cpp 32.0949 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 24, 1, 42, 57) fem-multicore-cpp 204.202 "Coloring mesh."
+(2013, 10, 24, 1, 45, 28) fem-assembly-cpp 151.442 "Assembly for various forms and backends"
+(2013, 10, 24, 1, 45, 43) fem-convergence-cpp 14.215 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 24, 1, 45, 44) fem-jit-python 0.001051 "JIT compilation (in memory cache)"
+(2013, 10, 24, 1, 53, 45) mesh-refinement-cpp 20.0413 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 24, 1, 54, 5) mesh-topology-cpp 19.9657 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 24, 1, 54, 29) mesh-unitcube-cpp 24.2088 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 24, 1, 55, 9) mesh-iteration-cpp 37.2989 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 24, 1, 55, 30) function-evaluation-cpp 20.998 "Evaluations of functions at arbitrary points."
+(2013, 10, 24, 1, 55, 30) function-evaluation-cpp 20.9029 "Evaluations of functions at arbitrary points."
+(2013, 10, 24, 1, 55, 34) function-extrapolation-python 3.44526 "BENCH:  1.04851603508"
+(2013, 10, 24, 1, 55, 34) function-extrapolation-python 1.04852 "BENCH:  1.04851603508"
+(2013, 10, 24, 1, 55, 35) function-interpolation-python 1.6714 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 24, 1, 55, 35) function-interpolation-python 0.961992 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 24, 1, 55, 59) la-vector-access-cpp 23.4402 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 24, 1, 56, 27) la-vector-assignment-cpp 28.1198 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 25, 1, 38, 3) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2149 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 25, 1, 38, 23) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9088 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 25, 1, 38, 39) geometry-bounding_box_tree_build-cpp 13.954 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 25, 1, 39, 7) common-progress-cpp 27.6534 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 25, 1, 39, 38) common-timing-cpp 31.2016 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 25, 1, 43, 2) fem-multicore-cpp 204.088 "Coloring mesh."
+(2013, 10, 25, 1, 45, 34) fem-assembly-cpp 151.257 "Assembly for various forms and backends"
+(2013, 10, 25, 1, 45, 48) fem-convergence-cpp 14.2057 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 25, 1, 45, 50) fem-jit-python 0.00104771 "JIT compilation (in memory cache)"
+(2013, 10, 25, 1, 53, 47) mesh-refinement-cpp 20.1168 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 25, 1, 54, 7) mesh-topology-cpp 19.8886 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 25, 1, 54, 32) mesh-unitcube-cpp 24.2103 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 25, 1, 55, 10) mesh-iteration-cpp 35.4605 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 25, 1, 55, 31) function-evaluation-cpp 21.0416 "Evaluations of functions at arbitrary points."
+(2013, 10, 25, 1, 55, 31) function-evaluation-cpp 20.9519 "Evaluations of functions at arbitrary points."
+(2013, 10, 25, 1, 55, 34) function-extrapolation-python 3.62083 "BENCH:  1.0487909317"
+(2013, 10, 25, 1, 55, 34) function-extrapolation-python 1.04879 "BENCH:  1.0487909317"
+(2013, 10, 25, 1, 55, 36) function-interpolation-python 1.64534 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 25, 1, 55, 36) function-interpolation-python 0.96404 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 25, 1, 55, 59) la-vector-access-cpp 23.4747 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 25, 1, 56, 27) la-vector-assignment-cpp 27.0934 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 26, 1, 35, 1) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0883 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 26, 1, 35, 20) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5332 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 26, 1, 35, 36) geometry-bounding_box_tree_build-cpp 13.9515 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 26, 1, 36, 4) common-progress-cpp 27.653 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 26, 1, 36, 36) common-timing-cpp 31.7032 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 26, 1, 40, 0) fem-multicore-cpp 204.038 "Coloring mesh."
+(2013, 10, 26, 1, 42, 32) fem-assembly-cpp 152.365 "Assembly for various forms and backends"
+(2013, 10, 26, 1, 42, 46) fem-convergence-cpp 14.2081 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 26, 1, 42, 59) fem-jit-python 0.00106812 "JIT compilation (in memory cache)"
+(2013, 10, 26, 1, 51, 1) mesh-refinement-cpp 19.9852 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 26, 1, 51, 21) mesh-topology-cpp 19.8565 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 26, 1, 51, 45) mesh-unitcube-cpp 24.1747 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 26, 1, 52, 31) mesh-iteration-cpp 43.5542 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 26, 1, 52, 52) function-evaluation-cpp 21.0777 "Evaluations of functions at arbitrary points."
+(2013, 10, 26, 1, 52, 52) function-evaluation-cpp 20.9776 "Evaluations of functions at arbitrary points."
+(2013, 10, 26, 1, 53, 39) function-extrapolation-python 47.5096 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2013, 10, 26, 1, 53, 39) function-extrapolation-python 1.03434 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2013, 10, 26, 1, 53, 41) function-interpolation-python 1.64401 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 26, 1, 53, 41) function-interpolation-python 0.972739 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 26, 1, 54, 5) la-vector-access-cpp 23.4653 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 26, 1, 54, 32) la-vector-assignment-cpp 27.0979 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 27, 2, 23, 48) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0541 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 27, 2, 24, 7) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6206 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 27, 2, 24, 24) geometry-bounding_box_tree_build-cpp 13.8988 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 27, 2, 24, 51) common-progress-cpp 27.7002 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 27, 2, 25, 23) common-timing-cpp 31.956 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 27, 2, 28, 47) fem-multicore-cpp 204.099 "Coloring mesh."
+(2013, 10, 27, 2, 31, 19) fem-assembly-cpp 151.312 "Assembly for various forms and backends"
+(2013, 10, 27, 2, 31, 33) fem-convergence-cpp 14.2159 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 27, 2, 31, 35) fem-jit-python 0.00107372 "JIT compilation (in memory cache)"
+(2013, 10, 27, 2, 39, 35) mesh-refinement-cpp 20.0151 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 27, 2, 39, 55) mesh-topology-cpp 19.8809 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 27, 2, 40, 19) mesh-unitcube-cpp 24.1813 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 27, 2, 41, 6) mesh-iteration-cpp 44.1985 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 27, 2, 41, 27) function-evaluation-cpp 21.053 "Evaluations of functions at arbitrary points."
+(2013, 10, 27, 2, 41, 27) function-evaluation-cpp 20.958 "Evaluations of functions at arbitrary points."
+(2013, 10, 27, 2, 41, 31) function-extrapolation-python 3.52044 "BENCH:  1.04091596603"
+(2013, 10, 27, 2, 41, 31) function-extrapolation-python 1.04092 "BENCH:  1.04091596603"
+(2013, 10, 27, 2, 41, 32) function-interpolation-python 1.66706 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 27, 2, 41, 32) function-interpolation-python 0.980854 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 27, 2, 41, 56) la-vector-access-cpp 23.4359 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 27, 2, 42, 23) la-vector-assignment-cpp 27.103 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 28, 2, 41, 55) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0987 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 28, 2, 42, 14) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6389 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 28, 2, 42, 31) geometry-bounding_box_tree_build-cpp 13.9527 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 28, 2, 42, 59) common-progress-cpp 27.6535 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 28, 2, 43, 30) common-timing-cpp 31.1796 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 28, 2, 46, 54) fem-multicore-cpp 203.9 "Coloring mesh."
+(2013, 10, 28, 2, 49, 25) fem-assembly-cpp 151.718 "Assembly for various forms and backends"
+(2013, 10, 28, 2, 49, 40) fem-convergence-cpp 14.2156 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 28, 2, 49, 42) fem-jit-python 0.00105221 "JIT compilation (in memory cache)"
+(2013, 10, 28, 2, 57, 44) mesh-refinement-cpp 20.0544 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 28, 2, 58, 4) mesh-topology-cpp 19.9463 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 28, 2, 58, 28) mesh-unitcube-cpp 24.1807 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 28, 2, 59, 6) mesh-iteration-cpp 35.4874 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 28, 2, 59, 27) function-evaluation-cpp 21.0705 "Evaluations of functions at arbitrary points."
+(2013, 10, 28, 2, 59, 27) function-evaluation-cpp 20.936 "Evaluations of functions at arbitrary points."
+(2013, 10, 28, 2, 59, 31) function-extrapolation-python 3.52103 "BENCH:  1.06225013733"
+(2013, 10, 28, 2, 59, 31) function-extrapolation-python 1.06225 "BENCH:  1.06225013733"
+(2013, 10, 28, 2, 59, 32) function-interpolation-python 1.67158 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 28, 2, 59, 32) function-interpolation-python 0.970899 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 28, 2, 59, 56) la-vector-access-cpp 23.4428 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 28, 3, 0, 23) la-vector-assignment-cpp 27.0818 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 29, 2, 27, 9) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2762 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 29, 2, 27, 28) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6261 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 29, 2, 27, 44) geometry-bounding_box_tree_build-cpp 13.9128 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 29, 2, 28, 12) common-progress-cpp 27.6798 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 29, 2, 28, 43) common-timing-cpp 31.4459 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 29, 2, 32, 7) fem-multicore-cpp 203.962 "Coloring mesh."
+(2013, 10, 29, 2, 34, 39) fem-assembly-cpp 151.393 "Assembly for various forms and backends"
+(2013, 10, 29, 2, 34, 53) fem-convergence-cpp 14.2518 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 29, 2, 34, 55) fem-jit-python 0.0010577 "JIT compilation (in memory cache)"
+(2013, 10, 29, 2, 42, 56) mesh-refinement-cpp 20.0375 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 29, 2, 43, 16) mesh-topology-cpp 19.9066 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 29, 2, 43, 41) mesh-unitcube-cpp 24.2292 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 29, 2, 44, 19) mesh-iteration-cpp 35.4854 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 29, 2, 44, 40) function-evaluation-cpp 21.0342 "Evaluations of functions at arbitrary points."
+(2013, 10, 29, 2, 44, 40) function-evaluation-cpp 20.9165 "Evaluations of functions at arbitrary points."
+(2013, 10, 29, 2, 44, 43) function-extrapolation-python 3.71131 "BENCH:  1.06067013741"
+(2013, 10, 29, 2, 44, 43) function-extrapolation-python 1.06067 "BENCH:  1.06067013741"
+(2013, 10, 29, 2, 44, 45) function-interpolation-python 1.69406 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 29, 2, 44, 45) function-interpolation-python 0.971827 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 29, 2, 45, 8) la-vector-access-cpp 23.47 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 29, 2, 45, 37) la-vector-assignment-cpp 28.1183 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 30, 2, 38, 0) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1028 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 30, 2, 38, 19) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8771 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 30, 2, 38, 36) geometry-bounding_box_tree_build-cpp 13.8916 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 30, 2, 39, 3) common-progress-cpp 27.6634 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 30, 2, 39, 35) common-timing-cpp 31.6893 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 30, 2, 42, 59) fem-multicore-cpp 204.479 "Coloring mesh."
+(2013, 10, 30, 2, 45, 31) fem-assembly-cpp 151.532 "Assembly for various forms and backends"
+(2013, 10, 30, 2, 45, 45) fem-convergence-cpp 14.2044 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 30, 2, 45, 47) fem-jit-python 0.0010483 "JIT compilation (in memory cache)"
+(2013, 10, 30, 2, 53, 49) mesh-refinement-cpp 20.0422 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 30, 2, 54, 9) mesh-topology-cpp 19.9478 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 30, 2, 54, 33) mesh-unitcube-cpp 24.2041 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 30, 2, 55, 11) mesh-iteration-cpp 35.4793 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 30, 2, 55, 32) function-evaluation-cpp 21.0616 "Evaluations of functions at arbitrary points."
+(2013, 10, 30, 2, 55, 32) function-evaluation-cpp 20.9657 "Evaluations of functions at arbitrary points."
+(2013, 10, 30, 2, 55, 35) function-extrapolation-python 3.49502 "BENCH:  1.05853796005"
+(2013, 10, 30, 2, 55, 35) function-extrapolation-python 1.05854 "BENCH:  1.05853796005"
+(2013, 10, 30, 2, 55, 37) function-interpolation-python 1.65206 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 30, 2, 55, 37) function-interpolation-python 0.966297 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 30, 2, 56, 1) la-vector-access-cpp 23.4415 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 30, 2, 56, 29) la-vector-assignment-cpp 28.1158 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 10, 31, 2, 36, 49) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.194 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 31, 2, 37, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4887 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 10, 31, 2, 37, 24) geometry-bounding_box_tree_build-cpp 13.9588 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 10, 31, 2, 37, 52) common-progress-cpp 27.7062 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 10, 31, 2, 38, 23) common-timing-cpp 31.2512 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 10, 31, 2, 41, 47) fem-multicore-cpp 203.962 "Coloring mesh."
+(2013, 10, 31, 2, 44, 19) fem-assembly-cpp 151.988 "Assembly for various forms and backends"
+(2013, 10, 31, 2, 44, 33) fem-convergence-cpp 14.2106 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 10, 31, 2, 44, 35) fem-jit-python 0.00105848 "JIT compilation (in memory cache)"
+(2013, 10, 31, 2, 52, 37) mesh-refinement-cpp 20.0302 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 10, 31, 2, 52, 57) mesh-topology-cpp 19.8567 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 10, 31, 2, 53, 21) mesh-unitcube-cpp 24.2175 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 10, 31, 2, 54, 0) mesh-iteration-cpp 36.0563 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 10, 31, 2, 54, 21) function-evaluation-cpp 21.0515 "Evaluations of functions at arbitrary points."
+(2013, 10, 31, 2, 54, 21) function-evaluation-cpp 20.9254 "Evaluations of functions at arbitrary points."
+(2013, 10, 31, 2, 54, 25) function-extrapolation-python 3.53652 "BENCH:  1.05553793907"
+(2013, 10, 31, 2, 54, 25) function-extrapolation-python 1.05554 "BENCH:  1.05553793907"
+(2013, 10, 31, 2, 54, 26) function-interpolation-python 1.64321 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 31, 2, 54, 26) function-interpolation-python 0.969507 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 10, 31, 2, 54, 52) la-vector-access-cpp 25.4872 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 10, 31, 2, 55, 19) la-vector-assignment-cpp 27.1019 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 1, 2, 25, 48) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.07 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 1, 2, 26, 7) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5758 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 1, 2, 26, 24) geometry-bounding_box_tree_build-cpp 13.9167 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 1, 2, 26, 52) common-progress-cpp 27.699 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 1, 2, 27, 23) common-timing-cpp 30.8096 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 1, 2, 30, 47) fem-multicore-cpp 204.623 "Coloring mesh."
+(2013, 11, 1, 2, 33, 19) fem-assembly-cpp 151.966 "Assembly for various forms and backends"
+(2013, 11, 1, 2, 33, 33) fem-convergence-cpp 14.2001 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 1, 2, 33, 35) fem-jit-python 0.0010556 "JIT compilation (in memory cache)"
+(2013, 11, 1, 2, 41, 37) mesh-refinement-cpp 20.0394 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 1, 2, 41, 57) mesh-topology-cpp 19.8387 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 1, 2, 42, 21) mesh-unitcube-cpp 24.1916 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 1, 2, 42, 59) mesh-iteration-cpp 35.4874 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 1, 2, 43, 20) function-evaluation-cpp 21.0232 "Evaluations of functions at arbitrary points."
+(2013, 11, 1, 2, 43, 20) function-evaluation-cpp 20.9106 "Evaluations of functions at arbitrary points."
+(2013, 11, 1, 2, 43, 24) function-extrapolation-python 3.49661 "BENCH:  1.05543804169"
+(2013, 11, 1, 2, 43, 24) function-extrapolation-python 1.05544 "BENCH:  1.05543804169"
+(2013, 11, 1, 2, 43, 26) function-interpolation-python 1.66051 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 1, 2, 43, 26) function-interpolation-python 0.973091 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 1, 2, 43, 49) la-vector-access-cpp 23.4363 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 1, 2, 44, 16) la-vector-assignment-cpp 27.0848 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 2, 2, 29, 9) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1275 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 2, 2, 29, 28) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8684 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 2, 2, 29, 45) geometry-bounding_box_tree_build-cpp 13.9235 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 2, 2, 30, 18) common-progress-cpp 32.7266 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 2, 2, 30, 50) common-timing-cpp 31.9902 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 2, 2, 34, 14) fem-multicore-cpp 204.147 "Coloring mesh."
+(2013, 11, 2, 2, 36, 45) fem-assembly-cpp 151.731 "Assembly for various forms and backends"
+(2013, 11, 2, 2, 37, 0) fem-convergence-cpp 14.2216 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 2, 2, 37, 2) fem-jit-python 0.00104589 "JIT compilation (in memory cache)"
+(2013, 11, 2, 2, 45, 4) mesh-refinement-cpp 20.0365 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 2, 2, 45, 24) mesh-topology-cpp 19.8177 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 2, 2, 45, 48) mesh-unitcube-cpp 24.2727 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 2, 2, 46, 26) mesh-iteration-cpp 35.4854 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 2, 2, 46, 47) function-evaluation-cpp 21.0673 "Evaluations of functions at arbitrary points."
+(2013, 11, 2, 2, 46, 47) function-evaluation-cpp 20.9723 "Evaluations of functions at arbitrary points."
+(2013, 11, 2, 2, 46, 51) function-extrapolation-python 3.47945 "BENCH:  1.04890799522"
+(2013, 11, 2, 2, 46, 51) function-extrapolation-python 1.04891 "BENCH:  1.04890799522"
+(2013, 11, 2, 2, 46, 52) function-interpolation-python 1.66781 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 2, 2, 46, 52) function-interpolation-python 0.973919 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 2, 2, 47, 21) la-vector-access-cpp 28.4543 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 2, 2, 47, 48) la-vector-assignment-cpp 27.163 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 3, 2, 24, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0751 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 3, 2, 24, 52) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5087 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 3, 2, 25, 9) geometry-bounding_box_tree_build-cpp 13.9049 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 3, 2, 25, 40) common-progress-cpp 31.4159 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 3, 2, 26, 11) common-timing-cpp 31.1207 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 3, 2, 29, 35) fem-multicore-cpp 204.213 "Coloring mesh."
+(2013, 11, 3, 2, 32, 7) fem-assembly-cpp 151.322 "Assembly for various forms and backends"
+(2013, 11, 3, 2, 32, 21) fem-convergence-cpp 14.2214 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 3, 2, 32, 23) fem-jit-python 0.0010494 "JIT compilation (in memory cache)"
+(2013, 11, 3, 2, 40, 24) mesh-refinement-cpp 20.1594 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 3, 2, 40, 44) mesh-topology-cpp 19.866 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 3, 2, 41, 8) mesh-unitcube-cpp 24.2032 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 3, 2, 41, 47) mesh-iteration-cpp 36.7267 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 3, 2, 42, 9) function-evaluation-cpp 21.0537 "Evaluations of functions at arbitrary points."
+(2013, 11, 3, 2, 42, 9) function-evaluation-cpp 20.9578 "Evaluations of functions at arbitrary points."
+(2013, 11, 3, 2, 42, 12) function-extrapolation-python 3.53771 "BENCH:  1.07924699783"
+(2013, 11, 3, 2, 42, 12) function-extrapolation-python 1.07925 "BENCH:  1.07924699783"
+(2013, 11, 3, 2, 42, 14) function-interpolation-python 1.68781 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 3, 2, 42, 14) function-interpolation-python 0.97136 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 3, 2, 42, 37) la-vector-access-cpp 23.4411 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 3, 2, 43, 5) la-vector-assignment-cpp 27.2244 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 4, 2, 32, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0128 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 4, 2, 32, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6417 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 4, 2, 33, 15) geometry-bounding_box_tree_build-cpp 13.9693 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 4, 2, 33, 42) common-progress-cpp 27.6588 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 4, 2, 34, 15) common-timing-cpp 32.4599 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 4, 2, 37, 39) fem-multicore-cpp 204.396 "Coloring mesh."
+(2013, 11, 4, 2, 40, 12) fem-assembly-cpp 152.316 "Assembly for various forms and backends"
+(2013, 11, 4, 2, 40, 26) fem-convergence-cpp 14.2039 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 4, 2, 40, 28) fem-jit-python 0.00106471 "JIT compilation (in memory cache)"
+(2013, 11, 4, 2, 48, 30) mesh-refinement-cpp 20.0573 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 4, 2, 48, 50) mesh-topology-cpp 19.9124 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 4, 2, 49, 14) mesh-unitcube-cpp 24.3509 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 4, 2, 50, 0) mesh-iteration-cpp 43.5606 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 4, 2, 50, 21) function-evaluation-cpp 21.0128 "Evaluations of functions at arbitrary points."
+(2013, 11, 4, 2, 50, 21) function-evaluation-cpp 20.9173 "Evaluations of functions at arbitrary points."
+(2013, 11, 4, 2, 50, 25) function-extrapolation-python 3.50523 "BENCH:  1.04606413841"
+(2013, 11, 4, 2, 50, 25) function-extrapolation-python 1.04606 "BENCH:  1.04606413841"
+(2013, 11, 4, 2, 50, 27) function-interpolation-python 1.69143 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 4, 2, 50, 27) function-interpolation-python 0.976129 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 4, 2, 50, 52) la-vector-access-cpp 25.4321 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 4, 2, 51, 19) la-vector-assignment-cpp 27.0416 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 5, 2, 22, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1363 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 5, 2, 22, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5872 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 5, 2, 22, 59) geometry-bounding_box_tree_build-cpp 13.9249 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 5, 2, 23, 27) common-progress-cpp 27.6552 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 5, 2, 23, 58) common-timing-cpp 31.3317 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 5, 2, 27, 22) fem-multicore-cpp 204.362 "Coloring mesh."
+(2013, 11, 5, 2, 29, 54) fem-assembly-cpp 151.695 "Assembly for various forms and backends"
+(2013, 11, 5, 2, 30, 8) fem-convergence-cpp 14.2175 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 5, 2, 30, 10) fem-jit-python 0.0010561 "JIT compilation (in memory cache)"
+(2013, 11, 5, 2, 38, 8) mesh-refinement-cpp 20.0312 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 5, 2, 38, 28) mesh-topology-cpp 19.8619 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 5, 2, 38, 52) mesh-unitcube-cpp 24.161 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 5, 2, 39, 30) mesh-iteration-cpp 35.4846 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 5, 2, 39, 51) function-evaluation-cpp 21.0648 "Evaluations of functions at arbitrary points."
+(2013, 11, 5, 2, 39, 51) function-evaluation-cpp 20.9739 "Evaluations of functions at arbitrary points."
+(2013, 11, 5, 2, 39, 55) function-extrapolation-python 3.52771 "BENCH:  1.04784202576"
+(2013, 11, 5, 2, 39, 55) function-extrapolation-python 1.04784 "BENCH:  1.04784202576"
+(2013, 11, 5, 2, 39, 57) function-interpolation-python 1.67427 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 5, 2, 39, 57) function-interpolation-python 0.967395 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 5, 2, 40, 20) la-vector-access-cpp 23.4703 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 5, 2, 40, 47) la-vector-assignment-cpp 27.096 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 6, 2, 26, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.146 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 6, 2, 27, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.85 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 6, 2, 27, 21) geometry-bounding_box_tree_build-cpp 13.9405 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 6, 2, 27, 49) common-progress-cpp 27.6666 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 6, 2, 28, 21) common-timing-cpp 31.7748 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 6, 2, 31, 44) fem-multicore-cpp 203.879 "Coloring mesh."
+(2013, 11, 6, 2, 34, 16) fem-assembly-cpp 151.773 "Assembly for various forms and backends"
+(2013, 11, 6, 2, 34, 30) fem-convergence-cpp 14.214 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 6, 2, 34, 32) fem-jit-python 0.00104961 "JIT compilation (in memory cache)"
+(2013, 11, 6, 2, 42, 35) mesh-refinement-cpp 20.0232 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 6, 2, 42, 56) mesh-topology-cpp 19.9816 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 6, 2, 43, 20) mesh-unitcube-cpp 24.2015 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 6, 2, 43, 58) mesh-iteration-cpp 35.4905 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 6, 2, 44, 19) function-evaluation-cpp 21.1803 "Evaluations of functions at arbitrary points."
+(2013, 11, 6, 2, 44, 19) function-evaluation-cpp 21.0873 "Evaluations of functions at arbitrary points."
+(2013, 11, 6, 2, 44, 23) function-extrapolation-python 3.48604 "BENCH:  1.02658700943"
+(2013, 11, 6, 2, 44, 23) function-extrapolation-python 1.02659 "BENCH:  1.02658700943"
+(2013, 11, 6, 2, 44, 24) function-interpolation-python 1.64104 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 6, 2, 44, 24) function-interpolation-python 0.969151 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 6, 2, 44, 48) la-vector-access-cpp 23.4568 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 6, 2, 45, 15) la-vector-assignment-cpp 27.1048 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 7, 2, 28, 27) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.083 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 7, 2, 28, 47) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9419 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 7, 2, 29, 3) geometry-bounding_box_tree_build-cpp 13.9396 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 7, 2, 29, 31) common-progress-cpp 27.6653 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 7, 2, 30, 2) common-timing-cpp 31.0078 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 7, 2, 33, 26) fem-multicore-cpp 204.022 "Coloring mesh."
+(2013, 11, 7, 2, 35, 58) fem-assembly-cpp 152.049 "Assembly for various forms and backends"
+(2013, 11, 7, 2, 36, 12) fem-convergence-cpp 14.2119 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 7, 2, 36, 14) fem-jit-python 0.00104651 "JIT compilation (in memory cache)"
+(2013, 11, 7, 2, 44, 14) mesh-refinement-cpp 20.0308 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 7, 2, 44, 34) mesh-topology-cpp 19.9358 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 7, 2, 44, 59) mesh-unitcube-cpp 24.3146 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 7, 2, 45, 46) mesh-iteration-cpp 44.2042 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 7, 2, 46, 7) function-evaluation-cpp 21.0613 "Evaluations of functions at arbitrary points."
+(2013, 11, 7, 2, 46, 7) function-evaluation-cpp 20.9252 "Evaluations of functions at arbitrary points."
+(2013, 11, 7, 2, 46, 10) function-extrapolation-python 3.61894 "BENCH:  1.05936098099"
+(2013, 11, 7, 2, 46, 10) function-extrapolation-python 1.05936 "BENCH:  1.05936098099"
+(2013, 11, 7, 2, 46, 12) function-interpolation-python 1.66783 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 7, 2, 46, 12) function-interpolation-python 0.970193 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 7, 2, 46, 35) la-vector-access-cpp 23.4596 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 7, 2, 47, 3) la-vector-assignment-cpp 27.0996 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 8, 2, 34, 4) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1191 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 8, 2, 34, 24) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8712 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 8, 2, 34, 40) geometry-bounding_box_tree_build-cpp 13.9123 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 8, 2, 35, 8) common-progress-cpp 27.6682 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 8, 2, 35, 39) common-timing-cpp 30.9854 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 8, 2, 39, 3) fem-multicore-cpp 204.384 "Coloring mesh."
+(2013, 11, 8, 2, 41, 35) fem-assembly-cpp 151.628 "Assembly for various forms and backends"
+(2013, 11, 8, 2, 41, 49) fem-convergence-cpp 14.2191 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 8, 2, 41, 51) fem-jit-python 0.00104909 "JIT compilation (in memory cache)"
+(2013, 11, 8, 2, 49, 51) mesh-refinement-cpp 20.0348 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 8, 2, 50, 11) mesh-topology-cpp 19.8633 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 8, 2, 50, 35) mesh-unitcube-cpp 24.2126 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 8, 2, 51, 21) mesh-iteration-cpp 43.5683 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 8, 2, 51, 42) function-evaluation-cpp 21.0023 "Evaluations of functions at arbitrary points."
+(2013, 11, 8, 2, 51, 42) function-evaluation-cpp 20.9067 "Evaluations of functions at arbitrary points."
+(2013, 11, 8, 2, 51, 46) function-extrapolation-python 3.50103 "BENCH:  1.04474496841"
+(2013, 11, 8, 2, 51, 46) function-extrapolation-python 1.04474 "BENCH:  1.04474496841"
+(2013, 11, 8, 2, 51, 48) function-interpolation-python 1.65167 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 8, 2, 51, 48) function-interpolation-python 0.971233 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 8, 2, 52, 11) la-vector-access-cpp 23.4499 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 8, 2, 52, 38) la-vector-assignment-cpp 27.4007 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 9, 2, 27, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0884 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 9, 2, 27, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5868 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 9, 2, 28, 7) geometry-bounding_box_tree_build-cpp 13.9412 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 9, 2, 28, 35) common-progress-cpp 27.6679 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 9, 2, 29, 6) common-timing-cpp 31.4171 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 9, 2, 32, 30) fem-multicore-cpp 204.112 "Coloring mesh."
+(2013, 11, 9, 2, 35, 2) fem-assembly-cpp 151.47 "Assembly for various forms and backends"
+(2013, 11, 9, 2, 35, 16) fem-convergence-cpp 14.2269 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 9, 2, 35, 18) fem-jit-python 0.00105228 "JIT compilation (in memory cache)"
+(2013, 11, 9, 2, 43, 19) mesh-refinement-cpp 20.062 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 9, 2, 43, 39) mesh-topology-cpp 19.851 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 9, 2, 44, 3) mesh-unitcube-cpp 24.2165 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 9, 2, 44, 50) mesh-iteration-cpp 44.1985 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 9, 2, 45, 11) function-evaluation-cpp 21.0408 "Evaluations of functions at arbitrary points."
+(2013, 11, 9, 2, 45, 11) function-evaluation-cpp 20.9454 "Evaluations of functions at arbitrary points."
+(2013, 11, 9, 2, 45, 14) function-extrapolation-python 3.43958 "BENCH:  1.05045986176"
+(2013, 11, 9, 2, 45, 14) function-extrapolation-python 1.05046 "BENCH:  1.05045986176"
+(2013, 11, 9, 2, 45, 16) function-interpolation-python 1.67412 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 9, 2, 45, 16) function-interpolation-python 0.969179 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 9, 2, 45, 39) la-vector-access-cpp 23.4419 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 9, 2, 46, 6) la-vector-assignment-cpp 27.086 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 10, 2, 24, 25) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0732 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 10, 2, 24, 45) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6512 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 10, 2, 25, 1) geometry-bounding_box_tree_build-cpp 13.9146 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 10, 2, 25, 29) common-progress-cpp 27.6655 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 10, 2, 26, 0) common-timing-cpp 30.7664 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 10, 2, 29, 24) fem-multicore-cpp 204.318 "Coloring mesh."
+(2013, 11, 10, 2, 31, 56) fem-assembly-cpp 152.211 "Assembly for various forms and backends"
+(2013, 11, 10, 2, 32, 10) fem-convergence-cpp 14.2278 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 10, 2, 32, 12) fem-jit-python 0.0010565 "JIT compilation (in memory cache)"
+(2013, 11, 10, 2, 40, 13) mesh-refinement-cpp 20.0813 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 10, 2, 40, 33) mesh-topology-cpp 19.865 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 10, 2, 40, 58) mesh-unitcube-cpp 24.208 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 10, 2, 41, 36) mesh-iteration-cpp 35.4223 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 10, 2, 41, 57) function-evaluation-cpp 21.1101 "Evaluations of functions at arbitrary points."
+(2013, 11, 10, 2, 41, 57) function-evaluation-cpp 21.0037 "Evaluations of functions at arbitrary points."
+(2013, 11, 10, 2, 42, 0) function-extrapolation-python 3.5694 "BENCH:  1.05070614815"
+(2013, 11, 10, 2, 42, 0) function-extrapolation-python 1.05071 "BENCH:  1.05070614815"
+(2013, 11, 10, 2, 42, 2) function-interpolation-python 1.69483 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 10, 2, 42, 2) function-interpolation-python 0.97506 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 10, 2, 42, 25) la-vector-access-cpp 23.4422 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 10, 2, 42, 53) la-vector-assignment-cpp 27.0875 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 11, 2, 42, 9) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0795 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 11, 2, 42, 28) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6182 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 11, 2, 42, 44) geometry-bounding_box_tree_build-cpp 13.89 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 11, 2, 43, 12) common-progress-cpp 27.7012 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 11, 2, 43, 43) common-timing-cpp 31.3255 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 11, 2, 47, 7) fem-multicore-cpp 203.826 "Coloring mesh."
+(2013, 11, 11, 2, 49, 39) fem-assembly-cpp 152.21 "Assembly for various forms and backends"
+(2013, 11, 11, 2, 49, 53) fem-convergence-cpp 14.2022 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 11, 2, 49, 55) fem-jit-python 0.0010504 "JIT compilation (in memory cache)"
+(2013, 11, 11, 2, 57, 55) mesh-refinement-cpp 20.054 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 11, 2, 58, 15) mesh-topology-cpp 19.8344 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 11, 2, 58, 39) mesh-unitcube-cpp 24.2141 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 11, 2, 59, 17) mesh-iteration-cpp 35.4805 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 11, 2, 59, 38) function-evaluation-cpp 21.0438 "Evaluations of functions at arbitrary points."
+(2013, 11, 11, 2, 59, 38) function-evaluation-cpp 20.9478 "Evaluations of functions at arbitrary points."
+(2013, 11, 11, 2, 59, 41) function-extrapolation-python 3.42945 "BENCH:  1.05228090286"
+(2013, 11, 11, 2, 59, 41) function-extrapolation-python 1.05228 "BENCH:  1.05228090286"
+(2013, 11, 11, 2, 59, 43) function-interpolation-python 1.65882 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 11, 2, 59, 43) function-interpolation-python 0.975693 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 11, 3, 0, 7) la-vector-access-cpp 23.4308 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 11, 3, 0, 34) la-vector-assignment-cpp 27.0493 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 12, 2, 28, 6) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1824 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 12, 2, 28, 25) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7069 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 12, 2, 28, 41) geometry-bounding_box_tree_build-cpp 13.9467 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 12, 2, 29, 9) common-progress-cpp 27.7012 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 12, 2, 29, 40) common-timing-cpp 31.0411 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 12, 2, 33, 4) fem-multicore-cpp 204.167 "Coloring mesh."
+(2013, 11, 12, 2, 35, 36) fem-assembly-cpp 151.626 "Assembly for various forms and backends"
+(2013, 11, 12, 2, 35, 50) fem-convergence-cpp 14.2098 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 12, 2, 35, 52) fem-jit-python 0.00106621 "JIT compilation (in memory cache)"
+(2013, 11, 12, 2, 43, 52) mesh-refinement-cpp 20.0192 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 12, 2, 44, 12) mesh-topology-cpp 19.8869 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 12, 2, 44, 37) mesh-unitcube-cpp 24.2521 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 12, 2, 45, 15) mesh-iteration-cpp 35.493 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 12, 2, 45, 36) function-evaluation-cpp 21.0607 "Evaluations of functions at arbitrary points."
+(2013, 11, 12, 2, 45, 36) function-evaluation-cpp 20.9563 "Evaluations of functions at arbitrary points."
+(2013, 11, 12, 2, 45, 39) function-extrapolation-python 3.52914 "BENCH:  1.04079508781"
+(2013, 11, 12, 2, 45, 39) function-extrapolation-python 1.0408 "BENCH:  1.04079508781"
+(2013, 11, 12, 2, 45, 41) function-interpolation-python 1.66768 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 12, 2, 45, 41) function-interpolation-python 0.973944 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 12, 2, 46, 5) la-vector-access-cpp 23.4468 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 12, 2, 46, 32) la-vector-assignment-cpp 27.0877 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 13, 2, 32, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1313 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 13, 2, 33, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5321 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 13, 2, 33, 21) geometry-bounding_box_tree_build-cpp 13.9165 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 13, 2, 33, 48) common-progress-cpp 27.7034 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 13, 2, 34, 20) common-timing-cpp 31.705 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 13, 2, 37, 44) fem-multicore-cpp 203.949 "Coloring mesh."
+(2013, 11, 13, 2, 40, 16) fem-assembly-cpp 151.425 "Assembly for various forms and backends"
+(2013, 11, 13, 2, 40, 30) fem-convergence-cpp 14.2117 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 13, 2, 40, 32) fem-jit-python 0.0010504 "JIT compilation (in memory cache)"
+(2013, 11, 13, 2, 48, 33) mesh-refinement-cpp 20.0361 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 13, 2, 48, 53) mesh-topology-cpp 19.8867 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 13, 2, 49, 17) mesh-unitcube-cpp 24.2487 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 13, 2, 50, 4) mesh-iteration-cpp 44.1841 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 13, 2, 50, 25) function-evaluation-cpp 21.0707 "Evaluations of functions at arbitrary points."
+(2013, 11, 13, 2, 50, 25) function-evaluation-cpp 20.9674 "Evaluations of functions at arbitrary points."
+(2013, 11, 13, 2, 50, 28) function-extrapolation-python 3.53923 "BENCH:  1.04507184029"
+(2013, 11, 13, 2, 50, 28) function-extrapolation-python 1.04507 "BENCH:  1.04507184029"
+(2013, 11, 13, 2, 50, 30) function-interpolation-python 1.70151 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 13, 2, 50, 30) function-interpolation-python 0.980131 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 13, 2, 50, 55) la-vector-access-cpp 25.4493 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 13, 2, 51, 24) la-vector-assignment-cpp 28.1173 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 14, 2, 35, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0542 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 14, 2, 35, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5163 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 14, 2, 36, 8) geometry-bounding_box_tree_build-cpp 13.9189 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 14, 2, 36, 35) common-progress-cpp 27.6665 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 14, 2, 37, 6) common-timing-cpp 30.8118 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 14, 2, 40, 30) fem-multicore-cpp 204.176 "Coloring mesh."
+(2013, 11, 14, 2, 43, 2) fem-assembly-cpp 151.949 "Assembly for various forms and backends"
+(2013, 11, 14, 2, 43, 16) fem-convergence-cpp 14.2085 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 14, 2, 43, 18) fem-jit-python 0.0010536 "JIT compilation (in memory cache)"
+(2013, 11, 14, 2, 51, 22) mesh-refinement-cpp 20.0292 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 14, 2, 51, 41) mesh-topology-cpp 19.8912 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 14, 2, 52, 6) mesh-unitcube-cpp 24.2423 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 14, 2, 52, 52) mesh-iteration-cpp 43.5676 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 14, 2, 53, 13) function-evaluation-cpp 21.1988 "Evaluations of functions at arbitrary points."
+(2013, 11, 14, 2, 53, 13) function-evaluation-cpp 21.1249 "Evaluations of functions at arbitrary points."
+(2013, 11, 14, 2, 53, 16) function-extrapolation-python 3.3364 "BENCH:  1.04505085945"
+(2013, 11, 14, 2, 53, 16) function-extrapolation-python 1.04505 "BENCH:  1.04505085945"
+(2013, 11, 14, 2, 53, 18) function-interpolation-python 1.67961 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 14, 2, 53, 18) function-interpolation-python 0.971674 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 14, 2, 53, 41) la-vector-access-cpp 23.4427 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 14, 2, 54, 9) la-vector-assignment-cpp 27.0833 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 15, 2, 26, 18) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1446 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 15, 2, 26, 37) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8595 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 15, 2, 26, 54) geometry-bounding_box_tree_build-cpp 13.9337 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 15, 2, 27, 21) common-progress-cpp 27.6656 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 15, 2, 27, 53) common-timing-cpp 31.9143 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 15, 2, 31, 18) fem-multicore-cpp 204.489 "Coloring mesh."
+(2013, 11, 15, 2, 33, 50) fem-assembly-cpp 152.038 "Assembly for various forms and backends"
+(2013, 11, 15, 2, 34, 4) fem-convergence-cpp 14.2097 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 15, 2, 34, 6) fem-jit-python 0.0010699 "JIT compilation (in memory cache)"
+(2013, 11, 15, 2, 42, 8) mesh-refinement-cpp 20.0424 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 15, 2, 42, 28) mesh-topology-cpp 19.8497 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 15, 2, 42, 52) mesh-unitcube-cpp 24.2827 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 15, 2, 43, 38) mesh-iteration-cpp 43.5616 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 15, 2, 43, 59) function-evaluation-cpp 21.0429 "Evaluations of functions at arbitrary points."
+(2013, 11, 15, 2, 43, 59) function-evaluation-cpp 20.9468 "Evaluations of functions at arbitrary points."
+(2013, 11, 15, 2, 44, 3) function-extrapolation-python 3.5061 "BENCH:  1.04563903809"
+(2013, 11, 15, 2, 44, 3) function-extrapolation-python 1.04564 "BENCH:  1.04563903809"
+(2013, 11, 15, 2, 44, 4) function-interpolation-python 1.67044 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 15, 2, 44, 4) function-interpolation-python 0.972305 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 15, 2, 44, 29) la-vector-access-cpp 24.9043 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 15, 2, 44, 58) la-vector-assignment-cpp 29.0686 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 16, 2, 32, 29) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1574 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 16, 2, 32, 48) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8384 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 16, 2, 33, 5) geometry-bounding_box_tree_build-cpp 13.9222 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 16, 2, 33, 33) common-progress-cpp 28.307 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 16, 2, 34, 4) common-timing-cpp 31.1348 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 16, 2, 37, 29) fem-multicore-cpp 204.675 "Coloring mesh."
+(2013, 11, 16, 2, 40, 0) fem-assembly-cpp 151.583 "Assembly for various forms and backends"
+(2013, 11, 16, 2, 40, 15) fem-convergence-cpp 14.2079 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 16, 2, 40, 17) fem-jit-python 0.0010488 "JIT compilation (in memory cache)"
+(2013, 11, 16, 2, 48, 17) mesh-refinement-cpp 20.1198 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 16, 2, 48, 37) mesh-topology-cpp 19.9085 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 16, 2, 49, 1) mesh-unitcube-cpp 24.2244 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 16, 2, 49, 40) mesh-iteration-cpp 35.9709 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 16, 2, 50, 1) function-evaluation-cpp 21.385 "Evaluations of functions at arbitrary points."
+(2013, 11, 16, 2, 50, 1) function-evaluation-cpp 21.2795 "Evaluations of functions at arbitrary points."
+(2013, 11, 16, 2, 50, 5) function-extrapolation-python 3.57104 "BENCH:  1.05328798294"
+(2013, 11, 16, 2, 50, 5) function-extrapolation-python 1.05329 "BENCH:  1.05328798294"
+(2013, 11, 16, 2, 50, 7) function-interpolation-python 1.66673 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 16, 2, 50, 7) function-interpolation-python 0.971936 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 16, 2, 50, 30) la-vector-access-cpp 23.4464 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 16, 2, 50, 57) la-vector-assignment-cpp 27.081 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 17, 2, 28, 18) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2376 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 17, 2, 28, 37) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7833 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 17, 2, 28, 54) geometry-bounding_box_tree_build-cpp 13.9403 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 17, 2, 29, 21) common-progress-cpp 27.6565 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 17, 2, 29, 53) common-timing-cpp 31.5266 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 17, 2, 33, 17) fem-multicore-cpp 204.333 "Coloring mesh."
+(2013, 11, 17, 2, 35, 49) fem-assembly-cpp 151.735 "Assembly for various forms and backends"
+(2013, 11, 17, 2, 36, 3) fem-convergence-cpp 14.1984 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 17, 2, 36, 5) fem-jit-python 0.00104702 "JIT compilation (in memory cache)"
+(2013, 11, 17, 2, 44, 8) mesh-refinement-cpp 20.029 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 17, 2, 44, 28) mesh-topology-cpp 19.849 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 17, 2, 44, 52) mesh-unitcube-cpp 24.1579 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 17, 2, 45, 38) mesh-iteration-cpp 43.5552 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 17, 2, 45, 59) function-evaluation-cpp 21.0365 "Evaluations of functions at arbitrary points."
+(2013, 11, 17, 2, 45, 59) function-evaluation-cpp 20.9436 "Evaluations of functions at arbitrary points."
+(2013, 11, 17, 2, 46, 3) function-extrapolation-python 3.58052 "BENCH:  1.04013609886"
+(2013, 11, 17, 2, 46, 3) function-extrapolation-python 1.04014 "BENCH:  1.04013609886"
+(2013, 11, 17, 2, 46, 5) function-interpolation-python 1.65869 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 17, 2, 46, 5) function-interpolation-python 0.972991 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 17, 2, 46, 28) la-vector-access-cpp 23.4784 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 17, 2, 46, 56) la-vector-assignment-cpp 28.2309 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 18, 2, 32, 20) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2366 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 18, 2, 32, 39) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6157 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 18, 2, 32, 55) geometry-bounding_box_tree_build-cpp 13.9411 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 18, 2, 33, 23) common-progress-cpp 27.6666 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 18, 2, 33, 54) common-timing-cpp 31.1714 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 18, 2, 37, 19) fem-multicore-cpp 204.398 "Coloring mesh."
+(2013, 11, 18, 2, 39, 50) fem-assembly-cpp 151.792 "Assembly for various forms and backends"
+(2013, 11, 18, 2, 40, 5) fem-convergence-cpp 14.2037 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 18, 2, 40, 7) fem-jit-python 0.00104761 "JIT compilation (in memory cache)"
+(2013, 11, 18, 2, 48, 8) mesh-refinement-cpp 19.9929 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 18, 2, 48, 28) mesh-topology-cpp 19.8496 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 18, 2, 48, 53) mesh-unitcube-cpp 24.1785 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 18, 2, 49, 31) mesh-iteration-cpp 35.4885 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 18, 2, 49, 52) function-evaluation-cpp 21.1433 "Evaluations of functions at arbitrary points."
+(2013, 11, 18, 2, 49, 52) function-evaluation-cpp 21.0442 "Evaluations of functions at arbitrary points."
+(2013, 11, 18, 2, 49, 55) function-extrapolation-python 3.41244 "BENCH:  1.03689599037"
+(2013, 11, 18, 2, 49, 55) function-extrapolation-python 1.0369 "BENCH:  1.03689599037"
+(2013, 11, 18, 2, 49, 57) function-interpolation-python 1.65454 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 18, 2, 49, 57) function-interpolation-python 0.978387 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 18, 2, 50, 21) la-vector-access-cpp 23.4755 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 18, 2, 50, 48) la-vector-assignment-cpp 27.0103 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 19, 2, 25, 22) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1097 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 19, 2, 25, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9976 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 19, 2, 25, 58) geometry-bounding_box_tree_build-cpp 13.9148 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 19, 2, 26, 26) common-progress-cpp 27.6649 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 19, 2, 26, 58) common-timing-cpp 31.9418 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 19, 2, 30, 22) fem-multicore-cpp 204.005 "Coloring mesh."
+(2013, 11, 19, 2, 32, 54) fem-assembly-cpp 152.073 "Assembly for various forms and backends"
+(2013, 11, 19, 2, 33, 8) fem-convergence-cpp 14.2149 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 19, 2, 33, 10) fem-jit-python 0.0010484 "JIT compilation (in memory cache)"
+(2013, 11, 19, 2, 41, 12) mesh-refinement-cpp 20.1492 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 19, 2, 41, 31) mesh-topology-cpp 19.8813 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 19, 2, 41, 56) mesh-unitcube-cpp 24.4398 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 19, 2, 42, 34) mesh-iteration-cpp 35.4931 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 19, 2, 42, 55) function-evaluation-cpp 21.0096 "Evaluations of functions at arbitrary points."
+(2013, 11, 19, 2, 42, 55) function-evaluation-cpp 20.9135 "Evaluations of functions at arbitrary points."
+(2013, 11, 19, 2, 42, 58) function-extrapolation-python 3.5092 "BENCH:  1.06636595726"
+(2013, 11, 19, 2, 42, 58) function-extrapolation-python 1.06637 "BENCH:  1.06636595726"
+(2013, 11, 19, 2, 43, 0) function-interpolation-python 1.67739 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 19, 2, 43, 0) function-interpolation-python 0.967599 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 19, 2, 43, 24) la-vector-access-cpp 23.4344 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 19, 2, 43, 51) la-vector-assignment-cpp 27.0916 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 20, 2, 40, 21) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1298 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 20, 2, 40, 40) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6133 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 20, 2, 40, 57) geometry-bounding_box_tree_build-cpp 13.9228 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 20, 2, 41, 24) common-progress-cpp 27.666 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 20, 2, 41, 56) common-timing-cpp 31.3131 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 20, 2, 45, 20) fem-multicore-cpp 204.163 "Coloring mesh."
+(2013, 11, 20, 2, 47, 52) fem-assembly-cpp 151.902 "Assembly for various forms and backends"
+(2013, 11, 20, 2, 48, 6) fem-convergence-cpp 14.1959 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 20, 2, 48, 8) fem-jit-python 0.00106039 "JIT compilation (in memory cache)"
+(2013, 11, 20, 2, 56, 11) mesh-refinement-cpp 20.0212 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 20, 2, 56, 31) mesh-topology-cpp 19.8433 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 20, 2, 56, 55) mesh-unitcube-cpp 24.2406 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 20, 2, 57, 33) mesh-iteration-cpp 35.5059 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 20, 2, 57, 54) function-evaluation-cpp 21.0478 "Evaluations of functions at arbitrary points."
+(2013, 11, 20, 2, 57, 54) function-evaluation-cpp 20.9529 "Evaluations of functions at arbitrary points."
+(2013, 11, 20, 2, 57, 57) function-extrapolation-python 3.44614 "BENCH:  1.05194282532"
+(2013, 11, 20, 2, 57, 57) function-extrapolation-python 1.05194 "BENCH:  1.05194282532"
+(2013, 11, 20, 2, 57, 59) function-interpolation-python 1.67498 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 20, 2, 57, 59) function-interpolation-python 0.973174 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 20, 2, 58, 25) la-vector-access-cpp 25.4458 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 20, 2, 58, 52) la-vector-assignment-cpp 27.2393 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 21, 2, 24, 20) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1057 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 21, 2, 24, 39) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6146 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 21, 2, 24, 56) geometry-bounding_box_tree_build-cpp 13.9242 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 21, 2, 25, 24) common-progress-cpp 27.6672 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 21, 2, 25, 55) common-timing-cpp 31.0778 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 21, 2, 29, 19) fem-multicore-cpp 204.161 "Coloring mesh."
+(2013, 11, 21, 2, 31, 51) fem-assembly-cpp 152.121 "Assembly for various forms and backends"
+(2013, 11, 21, 2, 32, 5) fem-convergence-cpp 14.22 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 21, 2, 32, 7) fem-jit-python 0.0010556 "JIT compilation (in memory cache)"
+(2013, 11, 21, 2, 40, 8) mesh-refinement-cpp 20.1132 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 21, 2, 40, 28) mesh-topology-cpp 19.8701 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 21, 2, 40, 52) mesh-unitcube-cpp 24.2193 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 21, 2, 41, 34) mesh-iteration-cpp 39.1731 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 21, 2, 41, 55) function-evaluation-cpp 21.0675 "Evaluations of functions at arbitrary points."
+(2013, 11, 21, 2, 41, 55) function-evaluation-cpp 20.9632 "Evaluations of functions at arbitrary points."
+(2013, 11, 21, 2, 41, 58) function-extrapolation-python 3.42943 "BENCH:  1.04349899292"
+(2013, 11, 21, 2, 41, 58) function-extrapolation-python 1.0435 "BENCH:  1.04349899292"
+(2013, 11, 21, 2, 42, 0) function-interpolation-python 1.68277 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 21, 2, 42, 0) function-interpolation-python 0.965812 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 21, 2, 42, 23) la-vector-access-cpp 23.4239 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 21, 2, 42, 51) la-vector-assignment-cpp 27.0914 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 22, 2, 26, 49) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1144 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 22, 2, 27, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6123 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 22, 2, 27, 24) geometry-bounding_box_tree_build-cpp 13.9129 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 22, 2, 27, 52) common-progress-cpp 27.6663 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 22, 2, 28, 24) common-timing-cpp 31.5368 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 22, 2, 31, 48) fem-multicore-cpp 204.6 "Coloring mesh."
+(2013, 11, 22, 2, 34, 20) fem-assembly-cpp 151.457 "Assembly for various forms and backends"
+(2013, 11, 22, 2, 34, 34) fem-convergence-cpp 14.2149 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 22, 2, 34, 36) fem-jit-python 0.00105669 "JIT compilation (in memory cache)"
+(2013, 11, 22, 2, 42, 38) mesh-refinement-cpp 20.0123 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 22, 2, 42, 57) mesh-topology-cpp 19.8496 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 22, 2, 43, 22) mesh-unitcube-cpp 24.2328 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 22, 2, 44, 0) mesh-iteration-cpp 35.4895 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 22, 2, 44, 21) function-evaluation-cpp 21.0271 "Evaluations of functions at arbitrary points."
+(2013, 11, 22, 2, 44, 21) function-evaluation-cpp 20.9314 "Evaluations of functions at arbitrary points."
+(2013, 11, 22, 2, 44, 24) function-extrapolation-python 3.31815 "BENCH:  1.04382109642"
+(2013, 11, 22, 2, 44, 24) function-extrapolation-python 1.04382 "BENCH:  1.04382109642"
+(2013, 11, 22, 2, 44, 26) function-interpolation-python 1.65075 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 22, 2, 44, 26) function-interpolation-python 0.958864 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 22, 2, 44, 49) la-vector-access-cpp 23.4888 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 22, 2, 45, 17) la-vector-assignment-cpp 28.1142 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 23, 2, 28, 16) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1413 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 23, 2, 28, 35) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6121 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 23, 2, 28, 52) geometry-bounding_box_tree_build-cpp 13.9208 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 23, 2, 29, 20) common-progress-cpp 27.6657 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 23, 2, 29, 51) common-timing-cpp 31.7788 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 23, 2, 33, 15) fem-multicore-cpp 203.99 "Coloring mesh."
+(2013, 11, 23, 2, 35, 47) fem-assembly-cpp 151.641 "Assembly for various forms and backends"
+(2013, 11, 23, 2, 36, 1) fem-convergence-cpp 14.1978 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 23, 2, 36, 3) fem-jit-python 0.001052 "JIT compilation (in memory cache)"
+(2013, 11, 23, 2, 44, 2) mesh-refinement-cpp 20.0403 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 23, 2, 44, 22) mesh-topology-cpp 19.8559 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 23, 2, 44, 46) mesh-unitcube-cpp 24.3186 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 23, 2, 45, 24) mesh-iteration-cpp 35.487 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 23, 2, 45, 45) function-evaluation-cpp 21.5045 "Evaluations of functions at arbitrary points."
+(2013, 11, 23, 2, 45, 45) function-evaluation-cpp 21.3998 "Evaluations of functions at arbitrary points."
+(2013, 11, 23, 2, 45, 49) function-extrapolation-python 3.47083 "BENCH:  1.06326293945"
+(2013, 11, 23, 2, 45, 49) function-extrapolation-python 1.06326 "BENCH:  1.06326293945"
+(2013, 11, 23, 2, 45, 51) function-interpolation-python 1.67477 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 23, 2, 45, 51) function-interpolation-python 0.970725 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 23, 2, 46, 16) la-vector-access-cpp 25.4465 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 23, 2, 46, 45) la-vector-assignment-cpp 29.1164 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 24, 2, 22, 2) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1417 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 24, 2, 22, 21) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9306 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 24, 2, 22, 38) geometry-bounding_box_tree_build-cpp 13.9119 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 24, 2, 23, 5) common-progress-cpp 27.6548 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 24, 2, 23, 36) common-timing-cpp 30.8113 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 24, 2, 27, 0) fem-multicore-cpp 204.032 "Coloring mesh."
+(2013, 11, 24, 2, 29, 32) fem-assembly-cpp 152.299 "Assembly for various forms and backends"
+(2013, 11, 24, 2, 29, 47) fem-convergence-cpp 14.2204 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 24, 2, 29, 49) fem-jit-python 0.00106931 "JIT compilation (in memory cache)"
+(2013, 11, 24, 2, 37, 54) mesh-refinement-cpp 20.1372 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 24, 2, 38, 14) mesh-topology-cpp 19.8709 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 24, 2, 38, 38) mesh-unitcube-cpp 24.1657 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 24, 2, 39, 16) mesh-iteration-cpp 35.4929 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 24, 2, 39, 37) function-evaluation-cpp 21.009 "Evaluations of functions at arbitrary points."
+(2013, 11, 24, 2, 39, 37) function-evaluation-cpp 20.917 "Evaluations of functions at arbitrary points."
+(2013, 11, 24, 2, 39, 41) function-extrapolation-python 3.52081 "BENCH:  1.03221297264"
+(2013, 11, 24, 2, 39, 41) function-extrapolation-python 1.03221 "BENCH:  1.03221297264"
+(2013, 11, 24, 2, 39, 42) function-interpolation-python 1.66349 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 24, 2, 39, 42) function-interpolation-python 0.970856 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 24, 2, 40, 8) la-vector-access-cpp 25.9655 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 24, 2, 40, 35) la-vector-assignment-cpp 27.1018 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 25, 2, 37, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1734 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 25, 2, 37, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6441 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 25, 2, 37, 58) geometry-bounding_box_tree_build-cpp 13.9273 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 25, 2, 38, 26) common-progress-cpp 27.6661 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 25, 2, 38, 58) common-timing-cpp 31.9567 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 25, 2, 42, 22) fem-multicore-cpp 204.425 "Coloring mesh."
+(2013, 11, 25, 2, 44, 54) fem-assembly-cpp 151.784 "Assembly for various forms and backends"
+(2013, 11, 25, 2, 45, 8) fem-convergence-cpp 14.1928 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 25, 2, 45, 10) fem-jit-python 0.001052 "JIT compilation (in memory cache)"
+(2013, 11, 25, 2, 53, 12) mesh-refinement-cpp 20.0296 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 25, 2, 53, 32) mesh-topology-cpp 19.8824 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 25, 2, 53, 56) mesh-unitcube-cpp 24.3423 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 25, 2, 54, 34) mesh-iteration-cpp 35.4888 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 25, 2, 54, 55) function-evaluation-cpp 21.0092 "Evaluations of functions at arbitrary points."
+(2013, 11, 25, 2, 54, 55) function-evaluation-cpp 20.9129 "Evaluations of functions at arbitrary points."
+(2013, 11, 25, 2, 54, 59) function-extrapolation-python 3.52712 "BENCH:  1.06823301315"
+(2013, 11, 25, 2, 54, 59) function-extrapolation-python 1.06823 "BENCH:  1.06823301315"
+(2013, 11, 25, 2, 55, 0) function-interpolation-python 1.66896 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 25, 2, 55, 0) function-interpolation-python 0.982672 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 25, 2, 55, 24) la-vector-access-cpp 23.4386 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 25, 2, 55, 53) la-vector-assignment-cpp 29.1133 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 26, 2, 34, 2) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1321 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 26, 2, 34, 21) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6575 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 26, 2, 34, 38) geometry-bounding_box_tree_build-cpp 13.9443 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 26, 2, 35, 6) common-progress-cpp 27.6658 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 26, 2, 35, 36) common-timing-cpp 30.8301 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 26, 2, 39, 1) fem-multicore-cpp 204.331 "Coloring mesh."
+(2013, 11, 26, 2, 41, 34) fem-assembly-cpp 152.692 "Assembly for various forms and backends"
+(2013, 11, 26, 2, 41, 48) fem-convergence-cpp 14.2685 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 26, 2, 41, 50) fem-jit-python 0.00109029 "JIT compilation (in memory cache)"
+(2013, 11, 26, 2, 49, 52) mesh-refinement-cpp 19.992 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 26, 2, 50, 12) mesh-topology-cpp 19.8687 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 26, 2, 50, 36) mesh-unitcube-cpp 24.195 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 26, 2, 51, 22) mesh-iteration-cpp 43.5638 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 26, 2, 51, 43) function-evaluation-cpp 21.0427 "Evaluations of functions at arbitrary points."
+(2013, 11, 26, 2, 51, 43) function-evaluation-cpp 20.9498 "Evaluations of functions at arbitrary points."
+(2013, 11, 26, 2, 51, 47) function-extrapolation-python 3.49615 "BENCH:  1.04934620857"
+(2013, 11, 26, 2, 51, 47) function-extrapolation-python 1.04935 "BENCH:  1.04934620857"
+(2013, 11, 26, 2, 51, 49) function-interpolation-python 1.64357 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 26, 2, 51, 49) function-interpolation-python 0.971371 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 26, 2, 52, 12) la-vector-access-cpp 23.46 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 26, 2, 52, 39) la-vector-assignment-cpp 27.0988 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 27, 2, 31, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1285 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 27, 2, 32, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.511 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 27, 2, 32, 17) geometry-bounding_box_tree_build-cpp 13.9401 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 27, 2, 32, 44) common-progress-cpp 27.6655 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 27, 2, 33, 16) common-timing-cpp 31.7784 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 27, 2, 36, 40) fem-multicore-cpp 204.171 "Coloring mesh."
+(2013, 11, 27, 2, 39, 13) fem-assembly-cpp 152.222 "Assembly for various forms and backends"
+(2013, 11, 27, 2, 39, 27) fem-convergence-cpp 14.267 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 27, 2, 39, 29) fem-jit-python 0.00104849 "JIT compilation (in memory cache)"
+(2013, 11, 27, 2, 47, 33) mesh-refinement-cpp 20.0079 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 27, 2, 47, 53) mesh-topology-cpp 19.8011 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 27, 2, 48, 17) mesh-unitcube-cpp 24.135 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 27, 2, 48, 55) mesh-iteration-cpp 35.4832 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 27, 2, 49, 17) function-evaluation-cpp 21.5628 "Evaluations of functions at arbitrary points."
+(2013, 11, 27, 2, 49, 17) function-evaluation-cpp 21.477 "Evaluations of functions at arbitrary points."
+(2013, 11, 27, 2, 49, 20) function-extrapolation-python 3.44595 "BENCH:  1.02978491783"
+(2013, 11, 27, 2, 49, 20) function-extrapolation-python 1.02978 "BENCH:  1.02978491783"
+(2013, 11, 27, 2, 49, 22) function-interpolation-python 1.6423 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 27, 2, 49, 22) function-interpolation-python 0.969616 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 27, 2, 49, 45) la-vector-access-cpp 23.449 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 27, 2, 50, 12) la-vector-assignment-cpp 27.0988 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 28, 2, 39, 54) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.181 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 28, 2, 40, 13) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4645 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 28, 2, 40, 30) geometry-bounding_box_tree_build-cpp 13.9943 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 28, 2, 40, 58) common-progress-cpp 27.7169 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 28, 2, 41, 30) common-timing-cpp 31.8142 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 28, 2, 44, 54) fem-multicore-cpp 204.198 "Coloring mesh."
+(2013, 11, 28, 2, 47, 25) fem-assembly-cpp 151.576 "Assembly for various forms and backends"
+(2013, 11, 28, 2, 47, 40) fem-convergence-cpp 14.207 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 28, 2, 47, 42) fem-jit-python 0.00105631 "JIT compilation (in memory cache)"
+(2013, 11, 28, 2, 55, 41) mesh-refinement-cpp 19.9669 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 28, 2, 56, 1) mesh-topology-cpp 19.841 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 28, 2, 56, 26) mesh-unitcube-cpp 24.2155 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 28, 2, 57, 4) mesh-iteration-cpp 35.4952 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 28, 2, 57, 25) function-evaluation-cpp 21.0928 "Evaluations of functions at arbitrary points."
+(2013, 11, 28, 2, 57, 25) function-evaluation-cpp 20.9608 "Evaluations of functions at arbitrary points."
+(2013, 11, 28, 2, 57, 28) function-extrapolation-python 3.49482 "BENCH:  1.03860902786"
+(2013, 11, 28, 2, 57, 28) function-extrapolation-python 1.03861 "BENCH:  1.03860902786"
+(2013, 11, 28, 2, 57, 30) function-interpolation-python 1.63964 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 28, 2, 57, 30) function-interpolation-python 0.967661 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 28, 2, 57, 53) la-vector-access-cpp 23.456 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 28, 2, 58, 21) la-vector-assignment-cpp 27.0962 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 29, 2, 41, 49) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0635 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 29, 2, 42, 9) geometry-bounding_box_tree_compute_closest_entity-cpp 16.1862 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 29, 2, 42, 26) geometry-bounding_box_tree_build-cpp 13.9665 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 29, 2, 42, 53) common-progress-cpp 27.667 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 29, 2, 43, 24) common-timing-cpp 30.9215 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 29, 2, 46, 49) fem-multicore-cpp 204.368 "Coloring mesh."
+(2013, 11, 29, 2, 49, 20) fem-assembly-cpp 151.699 "Assembly for various forms and backends"
+(2013, 11, 29, 2, 49, 35) fem-convergence-cpp 14.2139 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 29, 2, 49, 36) fem-jit-python 0.00106089 "JIT compilation (in memory cache)"
+(2013, 11, 29, 2, 57, 37) mesh-refinement-cpp 20.0503 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 29, 2, 57, 57) mesh-topology-cpp 19.9228 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 29, 2, 58, 22) mesh-unitcube-cpp 24.1819 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 29, 2, 59, 0) mesh-iteration-cpp 35.4965 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 29, 2, 59, 21) function-evaluation-cpp 21.0291 "Evaluations of functions at arbitrary points."
+(2013, 11, 29, 2, 59, 21) function-evaluation-cpp 20.8943 "Evaluations of functions at arbitrary points."
+(2013, 11, 29, 2, 59, 24) function-extrapolation-python 3.61987 "BENCH:  1.06337881088"
+(2013, 11, 29, 2, 59, 24) function-extrapolation-python 1.06338 "BENCH:  1.06337881088"
+(2013, 11, 29, 2, 59, 26) function-interpolation-python 1.66077 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 29, 2, 59, 26) function-interpolation-python 0.975817 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 29, 2, 59, 52) la-vector-access-cpp 26.0346 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 29, 3, 0, 19) la-vector-assignment-cpp 27.0896 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 11, 30, 2, 25, 16) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1443 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 30, 2, 25, 35) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5972 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 11, 30, 2, 25, 52) geometry-bounding_box_tree_build-cpp 13.9496 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 11, 30, 2, 26, 20) common-progress-cpp 27.6552 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 11, 30, 2, 26, 51) common-timing-cpp 31.5243 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 11, 30, 2, 30, 15) fem-multicore-cpp 203.822 "Coloring mesh."
+(2013, 11, 30, 2, 32, 47) fem-assembly-cpp 151.801 "Assembly for various forms and backends"
+(2013, 11, 30, 2, 33, 1) fem-convergence-cpp 14.2145 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 11, 30, 2, 33, 3) fem-jit-python 0.00107179 "JIT compilation (in memory cache)"
+(2013, 11, 30, 2, 41, 4) mesh-refinement-cpp 20.0609 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 11, 30, 2, 41, 24) mesh-topology-cpp 19.8878 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 11, 30, 2, 41, 48) mesh-unitcube-cpp 24.2146 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 11, 30, 2, 42, 26) mesh-iteration-cpp 35.4347 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 11, 30, 2, 42, 47) function-evaluation-cpp 21.0376 "Evaluations of functions at arbitrary points."
+(2013, 11, 30, 2, 42, 47) function-evaluation-cpp 20.9419 "Evaluations of functions at arbitrary points."
+(2013, 11, 30, 2, 42, 50) function-extrapolation-python 3.48769 "BENCH:  1.0535941124"
+(2013, 11, 30, 2, 42, 50) function-extrapolation-python 1.05359 "BENCH:  1.0535941124"
+(2013, 11, 30, 2, 42, 52) function-interpolation-python 1.68338 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 30, 2, 42, 52) function-interpolation-python 0.968644 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 11, 30, 2, 43, 15) la-vector-access-cpp 23.4396 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 11, 30, 2, 43, 43) la-vector-assignment-cpp 27.0843 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 1, 2, 26, 53) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1328 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 1, 2, 27, 12) geometry-bounding_box_tree_compute_closest_entity-cpp 15.915 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 1, 2, 27, 28) geometry-bounding_box_tree_build-cpp 13.9498 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 1, 2, 27, 56) common-progress-cpp 27.6654 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 1, 2, 28, 27) common-timing-cpp 31.1224 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 1, 2, 31, 52) fem-multicore-cpp 204.485 "Coloring mesh."
+(2013, 12, 1, 2, 34, 24) fem-assembly-cpp 152.044 "Assembly for various forms and backends"
+(2013, 12, 1, 2, 34, 38) fem-convergence-cpp 14.2179 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 1, 2, 34, 40) fem-jit-python 0.00106142 "JIT compilation (in memory cache)"
+(2013, 12, 1, 2, 42, 44) mesh-refinement-cpp 19.9896 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 1, 2, 43, 3) mesh-topology-cpp 19.8575 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 1, 2, 43, 28) mesh-unitcube-cpp 24.2128 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 1, 2, 44, 6) mesh-iteration-cpp 35.4886 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 1, 2, 44, 27) function-evaluation-cpp 21.0736 "Evaluations of functions at arbitrary points."
+(2013, 12, 1, 2, 44, 27) function-evaluation-cpp 20.9788 "Evaluations of functions at arbitrary points."
+(2013, 12, 1, 2, 44, 30) function-extrapolation-python 3.48758 "BENCH:  1.05216908455"
+(2013, 12, 1, 2, 44, 30) function-extrapolation-python 1.05217 "BENCH:  1.05216908455"
+(2013, 12, 1, 2, 44, 32) function-interpolation-python 1.67526 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 1, 2, 44, 32) function-interpolation-python 0.975429 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 1, 2, 44, 56) la-vector-access-cpp 23.4687 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 1, 2, 45, 23) la-vector-assignment-cpp 27.2434 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 2, 2, 30, 13) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1482 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 2, 2, 30, 32) geometry-bounding_box_tree_compute_closest_entity-cpp 15.9859 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 2, 2, 30, 49) geometry-bounding_box_tree_build-cpp 13.8983 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 2, 2, 31, 21) common-progress-cpp 32.6692 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 2, 2, 31, 53) common-timing-cpp 31.3442 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 2, 2, 35, 17) fem-multicore-cpp 204.021 "Coloring mesh."
+(2013, 12, 2, 2, 37, 49) fem-assembly-cpp 151.803 "Assembly for various forms and backends"
+(2013, 12, 2, 2, 38, 3) fem-convergence-cpp 14.2129 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 2, 2, 38, 5) fem-jit-python 0.0010571 "JIT compilation (in memory cache)"
+(2013, 12, 2, 2, 46, 6) mesh-refinement-cpp 20.0066 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 2, 2, 46, 26) mesh-topology-cpp 19.8617 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 2, 2, 46, 51) mesh-unitcube-cpp 24.2151 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 2, 2, 47, 29) mesh-iteration-cpp 35.4835 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 2, 2, 47, 50) function-evaluation-cpp 21.0606 "Evaluations of functions at arbitrary points."
+(2013, 12, 2, 2, 47, 50) function-evaluation-cpp 20.9569 "Evaluations of functions at arbitrary points."
+(2013, 12, 2, 2, 47, 53) function-extrapolation-python 3.43774 "BENCH:  1.05160403252"
+(2013, 12, 2, 2, 47, 53) function-extrapolation-python 1.0516 "BENCH:  1.05160403252"
+(2013, 12, 2, 2, 47, 55) function-interpolation-python 1.64387 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 2, 2, 47, 55) function-interpolation-python 0.967753 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 2, 2, 48, 20) la-vector-access-cpp 24.9432 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 2, 2, 48, 47) la-vector-assignment-cpp 27.0871 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 3, 2, 23, 29) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2029 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 3, 2, 23, 49) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7367 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 3, 2, 24, 5) geometry-bounding_box_tree_build-cpp 13.9455 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 3, 2, 24, 33) common-progress-cpp 27.6543 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 3, 2, 25, 4) common-timing-cpp 31.501 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 3, 2, 28, 28) fem-multicore-cpp 203.745 "Coloring mesh."
+(2013, 12, 3, 2, 31, 0) fem-assembly-cpp 152.439 "Assembly for various forms and backends"
+(2013, 12, 3, 2, 31, 15) fem-convergence-cpp 14.2129 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 3, 2, 31, 17) fem-jit-python 0.00105081 "JIT compilation (in memory cache)"
+(2013, 12, 3, 2, 39, 20) mesh-refinement-cpp 20.0186 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 3, 2, 39, 40) mesh-topology-cpp 19.843 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 3, 2, 40, 5) mesh-unitcube-cpp 24.1698 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 3, 2, 40, 43) mesh-iteration-cpp 35.5197 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 3, 2, 41, 4) function-evaluation-cpp 21.7466 "Evaluations of functions at arbitrary points."
+(2013, 12, 3, 2, 41, 4) function-evaluation-cpp 21.645 "Evaluations of functions at arbitrary points."
+(2013, 12, 3, 2, 41, 8) function-extrapolation-python 3.48739 "BENCH:  1.0320110321"
+(2013, 12, 3, 2, 41, 8) function-extrapolation-python 1.03201 "BENCH:  1.0320110321"
+(2013, 12, 3, 2, 41, 10) function-interpolation-python 1.63149 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 3, 2, 41, 10) function-interpolation-python 0.967768 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 3, 2, 41, 33) la-vector-access-cpp 23.4725 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 3, 2, 42, 0) la-vector-assignment-cpp 27.0948 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 4, 2, 29, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1006 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 4, 2, 29, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5333 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 4, 2, 29, 58) geometry-bounding_box_tree_build-cpp 13.9283 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 4, 2, 30, 26) common-progress-cpp 27.6539 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 4, 2, 30, 59) common-timing-cpp 33.1281 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 4, 2, 34, 23) fem-multicore-cpp 204.079 "Coloring mesh."
+(2013, 12, 4, 2, 36, 55) fem-assembly-cpp 151.947 "Assembly for various forms and backends"
+(2013, 12, 4, 2, 37, 9) fem-convergence-cpp 14.1854 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 4, 2, 37, 11) fem-jit-python 0.00105569 "JIT compilation (in memory cache)"
+(2013, 12, 4, 2, 45, 15) mesh-refinement-cpp 20.0768 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 4, 2, 45, 35) mesh-topology-cpp 19.7484 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 4, 2, 45, 59) mesh-unitcube-cpp 24.2013 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 4, 2, 46, 37) mesh-iteration-cpp 35.492 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 4, 2, 46, 58) function-evaluation-cpp 21.0133 "Evaluations of functions at arbitrary points."
+(2013, 12, 4, 2, 46, 58) function-evaluation-cpp 20.9169 "Evaluations of functions at arbitrary points."
+(2013, 12, 4, 2, 47, 2) function-extrapolation-python 3.41167 "BENCH:  1.05474114418"
+(2013, 12, 4, 2, 47, 2) function-extrapolation-python 1.05474 "BENCH:  1.05474114418"
+(2013, 12, 4, 2, 47, 3) function-interpolation-python 1.65855 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 4, 2, 47, 3) function-interpolation-python 0.968401 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 4, 2, 47, 27) la-vector-access-cpp 23.443 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 4, 2, 47, 54) la-vector-assignment-cpp 27.0809 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 5, 2, 24, 0) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0158 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 5, 2, 24, 19) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7188 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 5, 2, 24, 36) geometry-bounding_box_tree_build-cpp 13.9445 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 5, 2, 25, 3) common-progress-cpp 27.6672 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 5, 2, 25, 35) common-timing-cpp 31.5123 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 5, 2, 28, 59) fem-multicore-cpp 204.085 "Coloring mesh."
+(2013, 12, 5, 2, 31, 31) fem-assembly-cpp 151.978 "Assembly for various forms and backends"
+(2013, 12, 5, 2, 31, 45) fem-convergence-cpp 14.2311 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 5, 2, 31, 47) fem-jit-python 0.00104101 "JIT compilation (in memory cache)"
+(2013, 12, 5, 2, 39, 47) mesh-refinement-cpp 20.0053 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 5, 2, 40, 7) mesh-topology-cpp 19.8799 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 5, 2, 40, 31) mesh-unitcube-cpp 24.1804 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 5, 2, 41, 9) mesh-iteration-cpp 35.5044 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 5, 2, 41, 30) function-evaluation-cpp 21.0796 "Evaluations of functions at arbitrary points."
+(2013, 12, 5, 2, 41, 30) function-evaluation-cpp 20.9362 "Evaluations of functions at arbitrary points."
+(2013, 12, 5, 2, 41, 34) function-extrapolation-python 3.53757 "BENCH:  1.06758499146"
+(2013, 12, 5, 2, 41, 34) function-extrapolation-python 1.06758 "BENCH:  1.06758499146"
+(2013, 12, 5, 2, 41, 36) function-interpolation-python 1.67493 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 5, 2, 41, 36) function-interpolation-python 0.974641 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 5, 2, 41, 59) la-vector-access-cpp 23.4603 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 5, 2, 42, 26) la-vector-assignment-cpp 27.2547 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 6, 2, 26, 31) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.3322 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 6, 2, 26, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 16.2079 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 6, 2, 27, 8) geometry-bounding_box_tree_build-cpp 13.9598 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 6, 2, 27, 35) common-progress-cpp 27.6662 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 6, 2, 28, 6) common-timing-cpp 31.0271 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 6, 2, 31, 30) fem-multicore-cpp 203.899 "Coloring mesh."
+(2013, 12, 6, 2, 34, 3) fem-assembly-cpp 152.658 "Assembly for various forms and backends"
+(2013, 12, 6, 2, 34, 17) fem-convergence-cpp 14.2104 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 6, 2, 34, 19) fem-jit-python 0.0010649 "JIT compilation (in memory cache)"
+(2013, 12, 6, 2, 42, 20) mesh-refinement-cpp 20.1109 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 6, 2, 42, 40) mesh-topology-cpp 19.8517 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 6, 2, 43, 4) mesh-unitcube-cpp 24.2667 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 6, 2, 43, 46) mesh-iteration-cpp 39.1735 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 6, 2, 44, 7) function-evaluation-cpp 21.14 "Evaluations of functions at arbitrary points."
+(2013, 12, 6, 2, 44, 7) function-evaluation-cpp 21.0004 "Evaluations of functions at arbitrary points."
+(2013, 12, 6, 2, 44, 11) function-extrapolation-python 3.74559 "BENCH:  1.05666995049"
+(2013, 12, 6, 2, 44, 11) function-extrapolation-python 1.05667 "BENCH:  1.05666995049"
+(2013, 12, 6, 2, 44, 12) function-interpolation-python 1.65552 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 6, 2, 44, 12) function-interpolation-python 0.970658 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 6, 2, 44, 38) la-vector-access-cpp 25.4688 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 6, 2, 45, 5) la-vector-assignment-cpp 27.0926 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 7, 2, 28, 10) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2825 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 7, 2, 28, 29) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6001 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 7, 2, 28, 46) geometry-bounding_box_tree_build-cpp 13.9226 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 7, 2, 29, 13) common-progress-cpp 27.6643 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 7, 2, 29, 46) common-timing-cpp 32.8103 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 7, 2, 33, 10) fem-multicore-cpp 203.927 "Coloring mesh."
+(2013, 12, 7, 2, 35, 43) fem-assembly-cpp 152.414 "Assembly for various forms and backends"
+(2013, 12, 7, 2, 35, 57) fem-convergence-cpp 14.2166 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 7, 2, 35, 59) fem-jit-python 0.00105691 "JIT compilation (in memory cache)"
+(2013, 12, 7, 2, 43, 58) mesh-refinement-cpp 20.0326 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 7, 2, 44, 18) mesh-topology-cpp 19.8747 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 7, 2, 44, 42) mesh-unitcube-cpp 24.1549 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 7, 2, 45, 20) mesh-iteration-cpp 35.4851 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 7, 2, 45, 41) function-evaluation-cpp 21.0078 "Evaluations of functions at arbitrary points."
+(2013, 12, 7, 2, 45, 41) function-evaluation-cpp 20.9116 "Evaluations of functions at arbitrary points."
+(2013, 12, 7, 2, 45, 45) function-extrapolation-python 3.48746 "BENCH:  1.0745651722"
+(2013, 12, 7, 2, 45, 45) function-extrapolation-python 1.07457 "BENCH:  1.0745651722"
+(2013, 12, 7, 2, 45, 47) function-interpolation-python 1.66493 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 7, 2, 45, 47) function-interpolation-python 0.96934 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 7, 2, 46, 10) la-vector-access-cpp 23.407 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 7, 2, 46, 37) la-vector-assignment-cpp 27.0601 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 8, 2, 35, 10) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1844 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 8, 2, 35, 29) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5704 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 8, 2, 35, 46) geometry-bounding_box_tree_build-cpp 13.9216 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 8, 2, 36, 13) common-progress-cpp 27.6657 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 8, 2, 36, 44) common-timing-cpp 30.7988 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 8, 2, 40, 8) fem-multicore-cpp 204.301 "Coloring mesh."
+(2013, 12, 8, 2, 42, 40) fem-assembly-cpp 151.565 "Assembly for various forms and backends"
+(2013, 12, 8, 2, 42, 54) fem-convergence-cpp 14.2302 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 8, 2, 42, 56) fem-jit-python 0.00104921 "JIT compilation (in memory cache)"
+(2013, 12, 8, 2, 50, 57) mesh-refinement-cpp 20.0377 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 8, 2, 51, 17) mesh-topology-cpp 19.8608 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 8, 2, 51, 42) mesh-unitcube-cpp 24.266 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 8, 2, 52, 23) mesh-iteration-cpp 39.1041 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 8, 2, 52, 45) function-evaluation-cpp 21.2655 "Evaluations of functions at arbitrary points."
+(2013, 12, 8, 2, 52, 45) function-evaluation-cpp 21.1702 "Evaluations of functions at arbitrary points."
+(2013, 12, 8, 2, 52, 48) function-extrapolation-python 3.51954 "BENCH:  1.04911088943"
+(2013, 12, 8, 2, 52, 48) function-extrapolation-python 1.04911 "BENCH:  1.04911088943"
+(2013, 12, 8, 2, 52, 50) function-interpolation-python 1.65222 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 8, 2, 52, 50) function-interpolation-python 0.968558 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 8, 2, 53, 19) la-vector-access-cpp 28.9022 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 8, 2, 53, 47) la-vector-assignment-cpp 28.0837 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 9, 2, 24, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0604 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 9, 2, 24, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6247 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 9, 2, 25, 15) geometry-bounding_box_tree_build-cpp 13.9195 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 9, 2, 25, 43) common-progress-cpp 27.6656 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 9, 2, 26, 14) common-timing-cpp 31.4657 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 9, 2, 29, 38) fem-multicore-cpp 204.043 "Coloring mesh."
+(2013, 12, 9, 2, 32, 10) fem-assembly-cpp 152.053 "Assembly for various forms and backends"
+(2013, 12, 9, 2, 32, 25) fem-convergence-cpp 14.2225 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 9, 2, 32, 26) fem-jit-python 0.0010489 "JIT compilation (in memory cache)"
+(2013, 12, 9, 2, 40, 29) mesh-refinement-cpp 20.0745 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 9, 2, 40, 49) mesh-topology-cpp 19.9055 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 9, 2, 41, 13) mesh-unitcube-cpp 24.2344 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 9, 2, 41, 51) mesh-iteration-cpp 35.491 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 9, 2, 42, 12) function-evaluation-cpp 21.0556 "Evaluations of functions at arbitrary points."
+(2013, 12, 9, 2, 42, 12) function-evaluation-cpp 20.9507 "Evaluations of functions at arbitrary points."
+(2013, 12, 9, 2, 42, 15) function-extrapolation-python 3.46278 "BENCH:  1.04752492905"
+(2013, 12, 9, 2, 42, 15) function-extrapolation-python 1.04752 "BENCH:  1.04752492905"
+(2013, 12, 9, 2, 42, 17) function-interpolation-python 1.71003 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 9, 2, 42, 17) function-interpolation-python 0.969362 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 9, 2, 42, 41) la-vector-access-cpp 23.4626 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 9, 2, 43, 10) la-vector-assignment-cpp 29.1162 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 10, 2, 27, 55) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.2096 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 10, 2, 28, 15) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6607 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 10, 2, 28, 31) geometry-bounding_box_tree_build-cpp 13.9318 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 10, 2, 28, 59) common-progress-cpp 27.6663 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 10, 2, 29, 30) common-timing-cpp 31.2156 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 10, 2, 32, 54) fem-multicore-cpp 204.231 "Coloring mesh."
+(2013, 12, 10, 2, 35, 27) fem-assembly-cpp 152.315 "Assembly for various forms and backends"
+(2013, 12, 10, 2, 35, 41) fem-convergence-cpp 14.2107 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 10, 2, 35, 43) fem-jit-python 0.0010551 "JIT compilation (in memory cache)"
+(2013, 12, 10, 2, 43, 43) mesh-refinement-cpp 20.0575 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 10, 2, 44, 3) mesh-topology-cpp 19.9015 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 10, 2, 44, 27) mesh-unitcube-cpp 24.1952 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 10, 2, 45, 5) mesh-iteration-cpp 35.5027 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 10, 2, 45, 26) function-evaluation-cpp 21.067 "Evaluations of functions at arbitrary points."
+(2013, 12, 10, 2, 45, 26) function-evaluation-cpp 20.9397 "Evaluations of functions at arbitrary points."
+(2013, 12, 10, 2, 45, 30) function-extrapolation-python 3.53767 "BENCH:  1.04689908028"
+(2013, 12, 10, 2, 45, 30) function-extrapolation-python 1.0469 "BENCH:  1.04689908028"
+(2013, 12, 10, 2, 45, 32) function-interpolation-python 1.6594 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 10, 2, 45, 32) function-interpolation-python 0.960385 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 10, 2, 45, 55) la-vector-access-cpp 23.4583 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 10, 2, 46, 22) la-vector-assignment-cpp 26.9738 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 11, 2, 24, 28) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1124 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 11, 2, 24, 47) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6448 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 11, 2, 25, 3) geometry-bounding_box_tree_build-cpp 13.92 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 11, 2, 25, 31) common-progress-cpp 27.6667 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 11, 2, 26, 2) common-timing-cpp 30.7792 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 11, 2, 29, 26) fem-multicore-cpp 204.544 "Coloring mesh."
+(2013, 12, 11, 2, 31, 58) fem-assembly-cpp 151.813 "Assembly for various forms and backends"
+(2013, 12, 11, 2, 32, 13) fem-convergence-cpp 14.2103 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 11, 2, 32, 14) fem-jit-python 0.00106249 "JIT compilation (in memory cache)"
+(2013, 12, 11, 2, 40, 16) mesh-refinement-cpp 20.0299 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 11, 2, 40, 35) mesh-topology-cpp 19.8482 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 11, 2, 41, 0) mesh-unitcube-cpp 24.1965 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 11, 2, 41, 38) mesh-iteration-cpp 35.49 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 11, 2, 41, 59) function-evaluation-cpp 21.2308 "Evaluations of functions at arbitrary points."
+(2013, 12, 11, 2, 41, 59) function-evaluation-cpp 21.1259 "Evaluations of functions at arbitrary points."
+(2013, 12, 11, 2, 42, 2) function-extrapolation-python 3.52911 "BENCH:  1.06168103218"
+(2013, 12, 11, 2, 42, 2) function-extrapolation-python 1.06168 "BENCH:  1.06168103218"
+(2013, 12, 11, 2, 42, 4) function-interpolation-python 1.67578 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 11, 2, 42, 4) function-interpolation-python 0.975324 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 11, 2, 42, 29) la-vector-access-cpp 24.9438 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 11, 2, 42, 56) la-vector-assignment-cpp 27.0071 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 12, 2, 25, 19) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0962 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 12, 2, 25, 38) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6015 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 12, 2, 25, 55) geometry-bounding_box_tree_build-cpp 13.9588 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 12, 2, 26, 22) common-progress-cpp 27.6662 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 12, 2, 26, 55) common-timing-cpp 32.334 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 12, 2, 30, 19) fem-multicore-cpp 204.246 "Coloring mesh."
+(2013, 12, 12, 2, 32, 51) fem-assembly-cpp 152.168 "Assembly for various forms and backends"
+(2013, 12, 12, 2, 33, 5) fem-convergence-cpp 14.2041 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 12, 2, 33, 7) fem-jit-python 0.0010679 "JIT compilation (in memory cache)"
+(2013, 12, 12, 2, 41, 9) mesh-refinement-cpp 19.9668 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 12, 2, 41, 29) mesh-topology-cpp 19.8618 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 12, 2, 41, 53) mesh-unitcube-cpp 24.2211 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 12, 2, 42, 31) mesh-iteration-cpp 35.4919 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 12, 2, 42, 52) function-evaluation-cpp 21.0819 "Evaluations of functions at arbitrary points."
+(2013, 12, 12, 2, 42, 52) function-evaluation-cpp 20.9472 "Evaluations of functions at arbitrary points."
+(2013, 12, 12, 2, 42, 56) function-extrapolation-python 3.47083 "BENCH:  1.05420804024"
+(2013, 12, 12, 2, 42, 56) function-extrapolation-python 1.05421 "BENCH:  1.05420804024"
+(2013, 12, 12, 2, 42, 58) function-interpolation-python 1.65233 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 12, 2, 42, 58) function-interpolation-python 0.972923 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 12, 2, 43, 23) la-vector-access-cpp 25.4816 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 12, 2, 43, 50) la-vector-assignment-cpp 27.0991 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 13, 2, 26, 53) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.092 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 13, 2, 27, 12) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6894 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 13, 2, 27, 29) geometry-bounding_box_tree_build-cpp 13.9437 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 13, 2, 27, 57) common-progress-cpp 27.6664 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 13, 2, 28, 28) common-timing-cpp 31.3424 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 13, 2, 31, 52) fem-multicore-cpp 204.421 "Coloring mesh."
+(2013, 12, 13, 2, 34, 24) fem-assembly-cpp 151.759 "Assembly for various forms and backends"
+(2013, 12, 13, 2, 34, 38) fem-convergence-cpp 14.2198 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 13, 2, 34, 40) fem-jit-python 0.0010488 "JIT compilation (in memory cache)"
+(2013, 12, 13, 2, 42, 42) mesh-refinement-cpp 20.0278 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 13, 2, 43, 2) mesh-topology-cpp 19.8834 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 13, 2, 43, 26) mesh-unitcube-cpp 24.2237 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 13, 2, 44, 4) mesh-iteration-cpp 35.4878 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 13, 2, 44, 26) function-evaluation-cpp 22.167 "Evaluations of functions at arbitrary points."
+(2013, 12, 13, 2, 44, 26) function-evaluation-cpp 22.0323 "Evaluations of functions at arbitrary points."
+(2013, 12, 13, 2, 44, 30) function-extrapolation-python 3.64889 "BENCH:  1.06616711617"
+(2013, 12, 13, 2, 44, 30) function-extrapolation-python 1.06617 "BENCH:  1.06616711617"
+(2013, 12, 13, 2, 44, 32) function-interpolation-python 1.65178 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 13, 2, 44, 32) function-interpolation-python 0.968548 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 13, 2, 44, 55) la-vector-access-cpp 23.4589 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 13, 2, 45, 22) la-vector-assignment-cpp 27.0993 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 14, 2, 33, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0843 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 14, 2, 33, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4994 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 14, 2, 34, 14) geometry-bounding_box_tree_build-cpp 13.9778 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 14, 2, 34, 41) common-progress-cpp 27.6679 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 14, 2, 35, 12) common-timing-cpp 31.059 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 14, 2, 38, 37) fem-multicore-cpp 204.225 "Coloring mesh."
+(2013, 12, 14, 2, 41, 9) fem-assembly-cpp 152.584 "Assembly for various forms and backends"
+(2013, 12, 14, 2, 41, 23) fem-convergence-cpp 14.2123 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 14, 2, 41, 25) fem-jit-python 0.00104721 "JIT compilation (in memory cache)"
+(2013, 12, 14, 2, 49, 27) mesh-refinement-cpp 19.9799 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 14, 2, 49, 47) mesh-topology-cpp 19.8787 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 14, 2, 50, 11) mesh-unitcube-cpp 24.1565 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 14, 2, 50, 49) mesh-iteration-cpp 35.4932 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 14, 2, 51, 10) function-evaluation-cpp 21.1028 "Evaluations of functions at arbitrary points."
+(2013, 12, 14, 2, 51, 10) function-evaluation-cpp 21.0007 "Evaluations of functions at arbitrary points."
+(2013, 12, 14, 2, 51, 13) function-extrapolation-python 3.41264 "BENCH:  1.04101395607"
+(2013, 12, 14, 2, 51, 13) function-extrapolation-python 1.04101 "BENCH:  1.04101395607"
+(2013, 12, 14, 2, 51, 15) function-interpolation-python 1.63382 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 14, 2, 51, 15) function-interpolation-python 0.961303 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 14, 2, 51, 38) la-vector-access-cpp 23.4369 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 14, 2, 52, 8) la-vector-assignment-cpp 29.0137 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 15, 2, 30, 0) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.1239 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 15, 2, 30, 20) geometry-bounding_box_tree_compute_closest_entity-cpp 15.7447 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 15, 2, 30, 36) geometry-bounding_box_tree_build-cpp 13.9429 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 15, 2, 31, 4) common-progress-cpp 27.6675 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 15, 2, 31, 35) common-timing-cpp 31.1223 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 15, 2, 34, 59) fem-multicore-cpp 204.198 "Coloring mesh."
+(2013, 12, 15, 2, 37, 31) fem-assembly-cpp 152.254 "Assembly for various forms and backends"
+(2013, 12, 15, 2, 37, 46) fem-convergence-cpp 14.2229 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 15, 2, 37, 48) fem-jit-python 0.0010452 "JIT compilation (in memory cache)"
+(2013, 12, 15, 2, 45, 48) mesh-refinement-cpp 20.0653 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 15, 2, 46, 8) mesh-topology-cpp 19.9068 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 15, 2, 46, 32) mesh-unitcube-cpp 24.1908 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 15, 2, 47, 10) mesh-iteration-cpp 35.5202 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 15, 2, 47, 32) function-evaluation-cpp 21.3665 "Evaluations of functions at arbitrary points."
+(2013, 12, 15, 2, 47, 32) function-evaluation-cpp 21.2652 "Evaluations of functions at arbitrary points."
+(2013, 12, 15, 2, 47, 35) function-extrapolation-python 3.58744 "BENCH:  1.03307199478"
+(2013, 12, 15, 2, 47, 35) function-extrapolation-python 1.03307 "BENCH:  1.03307199478"
+(2013, 12, 15, 2, 47, 37) function-interpolation-python 1.66843 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 15, 2, 47, 37) function-interpolation-python 0.981521 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 15, 2, 48, 1) la-vector-access-cpp 23.4565 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 15, 2, 48, 28) la-vector-assignment-cpp 27.0971 "Assigning to vector of size 10000000 (100 repetitions)"
+(2013, 12, 16, 2, 27, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.0753 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 16, 2, 27, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5092 "Computed bounding box tree with 3145727 nodes for 1572864 entities."
+(2013, 12, 16, 2, 28, 8) geometry-bounding_box_tree_build-cpp 13.9193 "Computed bounding box tree with 25165823 nodes for 12582912 entities."
+(2013, 12, 16, 2, 28, 36) common-progress-cpp 27.6677 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2013, 12, 16, 2, 29, 7) common-timing-cpp 31.4475 "Timing access and registration of timings (10000000 repetitions)"
+(2013, 12, 16, 2, 32, 31) fem-multicore-cpp 203.899 "Coloring mesh."
+(2013, 12, 16, 2, 35, 3) fem-assembly-cpp 152.171 "Assembly for various forms and backends"
+(2013, 12, 16, 2, 35, 17) fem-convergence-cpp 14.1967 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2013, 12, 16, 2, 35, 19) fem-jit-python 0.0010586 "JIT compilation (in memory cache)"
+(2013, 12, 16, 2, 43, 20) mesh-refinement-cpp 20.0753 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2013, 12, 16, 2, 43, 40) mesh-topology-cpp 19.9107 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2013, 12, 16, 2, 44, 4) mesh-unitcube-cpp 24.209 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2013, 12, 16, 2, 44, 42) mesh-iteration-cpp 35.4916 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2013, 12, 16, 2, 45, 3) function-evaluation-cpp 21.0484 "Evaluations of functions at arbitrary points."
+(2013, 12, 16, 2, 45, 3) function-evaluation-cpp 20.9522 "Evaluations of functions at arbitrary points."
+(2013, 12, 16, 2, 45, 7) function-extrapolation-python 3.4461 "BENCH:  1.04169797897"
+(2013, 12, 16, 2, 45, 7) function-extrapolation-python 1.0417 "BENCH:  1.04169797897"
+(2013, 12, 16, 2, 45, 8) function-interpolation-python 1.66678 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 16, 2, 45, 8) function-interpolation-python 0.972675 "Computed bounding box tree with 111131 nodes for 55566 entities."
+(2013, 12, 16, 2, 45, 32) la-vector-access-cpp 23.4437 "Accessing vector of size 10000000 (100 repetitions)"
+(2013, 12, 16, 2, 45, 59) la-vector-assignment-cpp 27.0857 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 15, 15, 37, 58) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9512 "BENCH 10.9512"
+(2014, 1, 15, 15, 38, 17) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2343 "Building point search tree to accelerate distance queries."
+(2014, 1, 15, 15, 38, 34) geometry-bounding_box_tree_build-cpp 14.2419 "BENCH 14.2419"
+(2014, 1, 15, 15, 39, 2) common-progress-cpp 27.9688 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 15, 15, 39, 34) common-timing-cpp 32.4573 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 15, 15, 42, 57) fem-multicore-cpp 203.19 "Coloring mesh."
+(2014, 1, 15, 15, 45, 25) fem-assembly-cpp 147.176 "Assembly for various forms and backends"
+(2014, 1, 15, 15, 45, 39) fem-convergence-cpp 14.1108 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 15, 15, 45, 41) fem-jit-python 0.0010133 "JIT compilation (in memory cache)"
+(2014, 1, 15, 15, 53, 5) mesh-refinement-cpp 10.4608 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 15, 15, 53, 27) mesh-topology-cpp 21.8558 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 15, 15, 53, 51) mesh-unitcube-cpp 24.3154 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 15, 15, 54, 37) mesh-iteration-cpp 43.5951 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 15, 15, 54, 58) function-evaluation-cpp 20.9954 "Evaluations of functions at arbitrary points."
+(2014, 1, 15, 15, 54, 58) function-evaluation-cpp 20.9156 "Evaluations of functions at arbitrary points."
+(2014, 1, 15, 15, 55, 2) function-extrapolation-python 4.14469 "BENCH:  1.99085402489"
+(2014, 1, 15, 15, 55, 2) function-extrapolation-python 1.99085 "BENCH:  1.99085402489"
+(2014, 1, 15, 15, 55, 4) function-interpolation-python 1.48756 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 15, 15, 55, 4) function-interpolation-python 0.791098 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 15, 15, 55, 29) la-vector-access-cpp 25.4301 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 15, 15, 55, 57) la-vector-assignment-cpp 27.1269 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 16, 2, 25, 18) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0877 "BENCH 11.0877"
+(2014, 1, 16, 2, 25, 36) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0364 "Building point search tree to accelerate distance queries."
+(2014, 1, 16, 2, 25, 52) geometry-bounding_box_tree_build-cpp 13.9516 "BENCH 13.9516"
+(2014, 1, 16, 2, 26, 20) common-progress-cpp 27.6185 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 16, 2, 26, 52) common-timing-cpp 32.1613 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 16, 2, 30, 16) fem-multicore-cpp 203.767 "Coloring mesh."
+(2014, 1, 16, 2, 32, 46) fem-assembly-cpp 149.751 "Assembly for various forms and backends"
+(2014, 1, 16, 2, 33, 0) fem-convergence-cpp 14.1014 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 16, 2, 33, 2) fem-jit-python 0.0010288 "JIT compilation (in memory cache)"
+(2014, 1, 16, 2, 40, 39) mesh-refinement-cpp 10.2775 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 16, 2, 41, 1) mesh-topology-cpp 21.7882 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 16, 2, 41, 25) mesh-unitcube-cpp 23.5057 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 16, 2, 42, 3) mesh-iteration-cpp 35.5101 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 16, 2, 42, 24) function-evaluation-cpp 20.939 "Evaluations of functions at arbitrary points."
+(2014, 1, 16, 2, 42, 24) function-evaluation-cpp 20.8532 "Evaluations of functions at arbitrary points."
+(2014, 1, 16, 2, 42, 28) function-extrapolation-python 4.12487 "BENCH:  2.00645303726"
+(2014, 1, 16, 2, 42, 28) function-extrapolation-python 2.00645 "BENCH:  2.00645303726"
+(2014, 1, 16, 2, 42, 29) function-interpolation-python 1.53639 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 16, 2, 42, 29) function-interpolation-python 0.840103 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 16, 2, 42, 56) la-vector-access-cpp 26.4941 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 16, 2, 43, 30) la-vector-assignment-cpp 33.9831 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 17, 2, 24, 56) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.2582 "BENCH 11.2582"
+(2014, 1, 17, 2, 25, 15) geometry-bounding_box_tree_compute_closest_entity-cpp 15.107 "Building point search tree to accelerate distance queries."
+(2014, 1, 17, 2, 25, 31) geometry-bounding_box_tree_build-cpp 13.9052 "BENCH 13.9052"
+(2014, 1, 17, 2, 25, 59) common-progress-cpp 27.6181 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 17, 2, 26, 31) common-timing-cpp 31.7952 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 17, 2, 29, 54) fem-multicore-cpp 202.892 "Coloring mesh."
+(2014, 1, 17, 2, 32, 23) fem-assembly-cpp 148.945 "Assembly for various forms and backends"
+(2014, 1, 17, 2, 32, 37) fem-convergence-cpp 14.0928 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 17, 2, 32, 39) fem-jit-python 0.00102639 "JIT compilation (in memory cache)"
+(2014, 1, 17, 2, 40, 10) mesh-refinement-cpp 10.2611 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 17, 2, 40, 32) mesh-topology-cpp 21.6839 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 17, 2, 40, 55) mesh-unitcube-cpp 23.4812 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 17, 2, 41, 33) mesh-iteration-cpp 35.6531 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 17, 2, 41, 54) function-evaluation-cpp 20.9125 "Evaluations of functions at arbitrary points."
+(2014, 1, 17, 2, 41, 54) function-evaluation-cpp 20.8323 "Evaluations of functions at arbitrary points."
+(2014, 1, 17, 2, 41, 59) function-extrapolation-python 4.17272 "BENCH:  2.01546216011"
+(2014, 1, 17, 2, 41, 59) function-extrapolation-python 2.01546 "BENCH:  2.01546216011"
+(2014, 1, 17, 2, 42, 0) function-interpolation-python 1.53046 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 17, 2, 42, 0) function-interpolation-python 0.839257 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 17, 2, 42, 27) la-vector-access-cpp 26.5073 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 17, 2, 43, 0) la-vector-assignment-cpp 33.9273 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 18, 2, 39, 6) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.4363 "BENCH 11.4363"
+(2014, 1, 18, 2, 39, 25) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0315 "Building point search tree to accelerate distance queries."
+(2014, 1, 18, 2, 39, 41) geometry-bounding_box_tree_build-cpp 13.9031 "BENCH 13.9031"
+(2014, 1, 18, 2, 40, 9) common-progress-cpp 27.6186 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 18, 2, 40, 41) common-timing-cpp 32.4759 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 18, 2, 44, 4) fem-multicore-cpp 202.98 "Coloring mesh."
+(2014, 1, 18, 2, 46, 33) fem-assembly-cpp 148.112 "Assembly for various forms and backends"
+(2014, 1, 18, 2, 46, 47) fem-convergence-cpp 14.0864 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 18, 2, 46, 48) fem-jit-python 0.00102012 "JIT compilation (in memory cache)"
+(2014, 1, 18, 2, 54, 21) mesh-refinement-cpp 10.2569 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 18, 2, 54, 43) mesh-topology-cpp 21.8375 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 18, 2, 55, 7) mesh-unitcube-cpp 23.6159 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 18, 2, 55, 45) mesh-iteration-cpp 35.4824 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 18, 2, 56, 6) function-evaluation-cpp 20.9861 "Evaluations of functions at arbitrary points."
+(2014, 1, 18, 2, 56, 6) function-evaluation-cpp 20.8708 "Evaluations of functions at arbitrary points."
+(2014, 1, 18, 2, 56, 10) function-extrapolation-python 4.13156 "BENCH:  2.00491189957"
+(2014, 1, 18, 2, 56, 10) function-extrapolation-python 2.00491 "BENCH:  2.00491189957"
+(2014, 1, 18, 2, 56, 11) function-interpolation-python 1.53641 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 18, 2, 56, 11) function-interpolation-python 0.847156 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 18, 2, 56, 36) la-vector-access-cpp 24.8002 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 18, 2, 57, 10) la-vector-assignment-cpp 33.9716 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 19, 2, 37, 7) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.6788 "BENCH 11.6788"
+(2014, 1, 19, 2, 37, 26) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1043 "Building point search tree to accelerate distance queries."
+(2014, 1, 19, 2, 37, 42) geometry-bounding_box_tree_build-cpp 13.9194 "BENCH 13.9194"
+(2014, 1, 19, 2, 38, 10) common-progress-cpp 27.6183 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 19, 2, 38, 42) common-timing-cpp 31.8808 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 19, 2, 42, 5) fem-multicore-cpp 203.021 "Coloring mesh."
+(2014, 1, 19, 2, 44, 33) fem-assembly-cpp 148.626 "Assembly for various forms and backends"
+(2014, 1, 19, 2, 44, 48) fem-convergence-cpp 14.0958 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 19, 2, 44, 49) fem-jit-python 0.0010247 "JIT compilation (in memory cache)"
+(2014, 1, 19, 2, 52, 25) mesh-refinement-cpp 10.2562 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 19, 2, 52, 47) mesh-topology-cpp 21.8621 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 19, 2, 53, 10) mesh-unitcube-cpp 23.576 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 19, 2, 53, 48) mesh-iteration-cpp 35.4844 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 19, 2, 54, 9) function-evaluation-cpp 20.9459 "Evaluations of functions at arbitrary points."
+(2014, 1, 19, 2, 54, 9) function-evaluation-cpp 20.8395 "Evaluations of functions at arbitrary points."
+(2014, 1, 19, 2, 54, 13) function-extrapolation-python 4.13796 "BENCH:  2.00580501556"
+(2014, 1, 19, 2, 54, 13) function-extrapolation-python 2.00581 "BENCH:  2.00580501556"
+(2014, 1, 19, 2, 54, 15) function-interpolation-python 1.53034 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 19, 2, 54, 15) function-interpolation-python 0.839177 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 19, 2, 54, 40) la-vector-access-cpp 24.8406 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 19, 2, 55, 14) la-vector-assignment-cpp 33.9841 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 20, 2, 38, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1122 "BENCH 11.1122"
+(2014, 1, 20, 2, 39, 6) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3124 "Building point search tree to accelerate distance queries."
+(2014, 1, 20, 2, 39, 22) geometry-bounding_box_tree_build-cpp 14.0116 "BENCH 14.0116"
+(2014, 1, 20, 2, 39, 50) common-progress-cpp 27.6524 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 20, 2, 40, 19) common-timing-cpp 29.2958 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 20, 2, 43, 42) fem-multicore-cpp 202.767 "Coloring mesh."
+(2014, 1, 20, 2, 46, 11) fem-assembly-cpp 148.565 "Assembly for various forms and backends"
+(2014, 1, 20, 2, 46, 25) fem-convergence-cpp 14.0867 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 20, 2, 46, 27) fem-jit-python 0.0010318 "JIT compilation (in memory cache)"
+(2014, 1, 20, 2, 54, 0) mesh-refinement-cpp 10.2603 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 20, 2, 54, 22) mesh-topology-cpp 21.6092 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 20, 2, 54, 45) mesh-unitcube-cpp 23.594 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 20, 2, 55, 23) mesh-iteration-cpp 35.4787 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 20, 2, 55, 44) function-evaluation-cpp 20.9903 "Evaluations of functions at arbitrary points."
+(2014, 1, 20, 2, 55, 44) function-evaluation-cpp 20.8859 "Evaluations of functions at arbitrary points."
+(2014, 1, 20, 2, 55, 48) function-extrapolation-python 4.15949 "BENCH:  2.01744294167"
+(2014, 1, 20, 2, 55, 48) function-extrapolation-python 2.01744 "BENCH:  2.01744294167"
+(2014, 1, 20, 2, 55, 50) function-interpolation-python 1.50444 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 20, 2, 55, 50) function-interpolation-python 0.812313 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 20, 2, 56, 20) la-vector-access-cpp 29.9914 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 20, 2, 56, 52) la-vector-assignment-cpp 31.9187 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 21, 2, 40, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9924 "BENCH 10.9924"
+(2014, 1, 21, 2, 40, 41) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2025 "Building point search tree to accelerate distance queries."
+(2014, 1, 21, 2, 40, 58) geometry-bounding_box_tree_build-cpp 14.0279 "BENCH 14.0279"
+(2014, 1, 21, 2, 41, 26) common-progress-cpp 27.6549 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 21, 2, 41, 55) common-timing-cpp 29.7597 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 21, 2, 45, 20) fem-multicore-cpp 204.834 "Coloring mesh."
+(2014, 1, 21, 2, 47, 48) fem-assembly-cpp 147.535 "Assembly for various forms and backends"
+(2014, 1, 21, 2, 48, 2) fem-convergence-cpp 14.0709 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 21, 2, 48, 4) fem-jit-python 0.0010221 "JIT compilation (in memory cache)"
+(2014, 1, 21, 2, 55, 39) mesh-refinement-cpp 10.3604 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 21, 2, 56, 1) mesh-topology-cpp 22.1511 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 21, 2, 56, 26) mesh-unitcube-cpp 24.591 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 21, 2, 57, 13) mesh-iteration-cpp 44.1666 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 21, 2, 57, 34) function-evaluation-cpp 21.5867 "Evaluations of functions at arbitrary points."
+(2014, 1, 21, 2, 57, 34) function-evaluation-cpp 21.4917 "Evaluations of functions at arbitrary points."
+(2014, 1, 21, 2, 57, 38) function-extrapolation-python 4.29282 "BENCH:  2.00982284546"
+(2014, 1, 21, 2, 57, 38) function-extrapolation-python 2.00982 "BENCH:  2.00982284546"
+(2014, 1, 21, 2, 57, 40) function-interpolation-python 1.48564 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 21, 2, 57, 40) function-interpolation-python 0.798807 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 21, 2, 58, 7) la-vector-access-cpp 26.9942 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 21, 2, 58, 43) la-vector-assignment-cpp 35.9288 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 22, 2, 26, 10) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0606 "BENCH 11.0606"
+(2014, 1, 22, 2, 26, 29) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2837 "Building point search tree to accelerate distance queries."
+(2014, 1, 22, 2, 26, 45) geometry-bounding_box_tree_build-cpp 13.903 "BENCH 13.903"
+(2014, 1, 22, 2, 27, 13) common-progress-cpp 27.6164 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 22, 2, 27, 44) common-timing-cpp 30.884 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 22, 2, 31, 12) fem-multicore-cpp 208.191 "Coloring mesh."
+(2014, 1, 22, 2, 33, 45) fem-assembly-cpp 152.808 "Assembly for various forms and backends"
+(2014, 1, 22, 2, 33, 59) fem-convergence-cpp 14.09 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 22, 2, 34, 1) fem-jit-python 0.00102119 "JIT compilation (in memory cache)"
+(2014, 1, 22, 2, 41, 34) mesh-refinement-cpp 10.376 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 22, 2, 41, 56) mesh-topology-cpp 21.7187 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 22, 2, 42, 20) mesh-unitcube-cpp 24.4275 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 22, 2, 42, 58) mesh-iteration-cpp 35.5339 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 22, 2, 43, 20) function-evaluation-cpp 21.0845 "Evaluations of functions at arbitrary points."
+(2014, 1, 22, 2, 43, 20) function-evaluation-cpp 20.9691 "Evaluations of functions at arbitrary points."
+(2014, 1, 22, 2, 43, 24) function-extrapolation-python 4.10016 "BENCH:  2.01358008385"
+(2014, 1, 22, 2, 43, 24) function-extrapolation-python 2.01358 "BENCH:  2.01358008385"
+(2014, 1, 22, 2, 43, 25) function-interpolation-python 1.49253 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 22, 2, 43, 25) function-interpolation-python 0.809683 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 22, 2, 43, 50) la-vector-access-cpp 24.8502 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 22, 2, 44, 22) la-vector-assignment-cpp 31.9205 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 23, 2, 28, 13) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0559 "BENCH 11.0559"
+(2014, 1, 23, 2, 28, 32) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5543 "Building point search tree to accelerate distance queries."
+(2014, 1, 23, 2, 28, 48) geometry-bounding_box_tree_build-cpp 14.0371 "BENCH 14.0371"
+(2014, 1, 23, 2, 29, 16) common-progress-cpp 27.6591 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 23, 2, 29, 48) common-timing-cpp 31.5902 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 23, 2, 33, 17) fem-multicore-cpp 208.801 "Coloring mesh."
+(2014, 1, 23, 2, 35, 48) fem-assembly-cpp 151.335 "Assembly for various forms and backends"
+(2014, 1, 23, 2, 36, 2) fem-convergence-cpp 14.1213 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 23, 2, 36, 4) fem-jit-python 0.0010361 "JIT compilation (in memory cache)"
+(2014, 1, 23, 2, 43, 42) mesh-refinement-cpp 10.4052 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 23, 2, 44, 4) mesh-topology-cpp 21.9404 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 23, 2, 44, 28) mesh-unitcube-cpp 24.08 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 23, 2, 45, 6) mesh-iteration-cpp 35.4865 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 23, 2, 45, 27) function-evaluation-cpp 21.0149 "Evaluations of functions at arbitrary points."
+(2014, 1, 23, 2, 45, 27) function-evaluation-cpp 20.9051 "Evaluations of functions at arbitrary points."
+(2014, 1, 23, 2, 45, 32) function-extrapolation-python 4.14087 "BENCH:  2.01658511162"
+(2014, 1, 23, 2, 45, 32) function-extrapolation-python 2.01659 "BENCH:  2.01658511162"
+(2014, 1, 23, 2, 45, 33) function-interpolation-python 1.49715 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 23, 2, 45, 33) function-interpolation-python 0.814686 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 23, 2, 46, 0) la-vector-access-cpp 27.0048 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 23, 2, 46, 34) la-vector-assignment-cpp 33.4811 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 24, 2, 33, 11) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0937 "BENCH 11.0937"
+(2014, 1, 24, 2, 33, 29) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9468 "Building point search tree to accelerate distance queries."
+(2014, 1, 24, 2, 33, 46) geometry-bounding_box_tree_build-cpp 13.9493 "BENCH 13.9493"
+(2014, 1, 24, 2, 34, 13) common-progress-cpp 27.6856 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 24, 2, 34, 43) common-timing-cpp 29.9066 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 24, 2, 38, 11) fem-multicore-cpp 208.396 "Coloring mesh."
+(2014, 1, 24, 2, 40, 42) fem-assembly-cpp 150.226 "Assembly for various forms and backends"
+(2014, 1, 24, 2, 40, 56) fem-convergence-cpp 14.1239 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 24, 2, 40, 58) fem-jit-python 0.0010217 "JIT compilation (in memory cache)"
+(2014, 1, 24, 2, 48, 36) mesh-refinement-cpp 10.3527 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 24, 2, 48, 57) mesh-topology-cpp 21.8798 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 24, 2, 49, 21) mesh-unitcube-cpp 23.9441 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 24, 2, 49, 59) mesh-iteration-cpp 35.487 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 24, 2, 50, 20) function-evaluation-cpp 21.0412 "Evaluations of functions at arbitrary points."
+(2014, 1, 24, 2, 50, 20) function-evaluation-cpp 20.9227 "Evaluations of functions at arbitrary points."
+(2014, 1, 24, 2, 50, 25) function-extrapolation-python 4.13858 "BENCH:  2.02727198601"
+(2014, 1, 24, 2, 50, 25) function-extrapolation-python 2.02727 "BENCH:  2.02727198601"
+(2014, 1, 24, 2, 50, 26) function-interpolation-python 1.48759 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 24, 2, 50, 26) function-interpolation-python 0.796274 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 24, 2, 50, 53) la-vector-access-cpp 26.5933 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 24, 2, 51, 26) la-vector-assignment-cpp 33.5474 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 25, 2, 35, 17) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.9783 "BENCH 11.9783"
+(2014, 1, 25, 2, 35, 36) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3416 "Building point search tree to accelerate distance queries."
+(2014, 1, 25, 2, 35, 52) geometry-bounding_box_tree_build-cpp 13.8975 "BENCH 13.8975"
+(2014, 1, 25, 2, 36, 20) common-progress-cpp 27.6859 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 25, 2, 36, 51) common-timing-cpp 30.7044 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 25, 2, 40, 15) fem-multicore-cpp 204.228 "Coloring mesh."
+(2014, 1, 25, 2, 42, 41) fem-assembly-cpp 146.323 "Assembly for various forms and backends"
+(2014, 1, 25, 2, 42, 55) fem-convergence-cpp 14.0739 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 25, 2, 42, 57) fem-jit-python 0.00102668 "JIT compilation (in memory cache)"
+(2014, 1, 25, 2, 50, 29) mesh-refinement-cpp 10.5274 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 25, 2, 50, 51) mesh-topology-cpp 21.7013 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 25, 2, 51, 15) mesh-unitcube-cpp 24.4922 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 25, 2, 51, 53) mesh-iteration-cpp 35.5404 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 25, 2, 52, 14) function-evaluation-cpp 21.0292 "Evaluations of functions at arbitrary points."
+(2014, 1, 25, 2, 52, 14) function-evaluation-cpp 20.9129 "Evaluations of functions at arbitrary points."
+(2014, 1, 25, 2, 52, 19) function-extrapolation-python 4.14919 "BENCH:  2.0251019001"
+(2014, 1, 25, 2, 52, 19) function-extrapolation-python 2.0251 "BENCH:  2.0251019001"
+(2014, 1, 25, 2, 52, 20) function-interpolation-python 1.50835 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 25, 2, 52, 20) function-interpolation-python 0.823975 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 25, 2, 52, 45) la-vector-access-cpp 24.9177 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 25, 2, 53, 17) la-vector-assignment-cpp 31.951 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 26, 2, 26, 2) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.9514 "BENCH 11.9514"
+(2014, 1, 26, 2, 26, 20) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2094 "Building point search tree to accelerate distance queries."
+(2014, 1, 26, 2, 26, 37) geometry-bounding_box_tree_build-cpp 13.9236 "BENCH 13.9236"
+(2014, 1, 26, 2, 27, 4) common-progress-cpp 27.626 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 26, 2, 27, 36) common-timing-cpp 31.1299 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 26, 2, 30, 59) fem-multicore-cpp 203.438 "Coloring mesh."
+(2014, 1, 26, 2, 33, 26) fem-assembly-cpp 147.075 "Assembly for various forms and backends"
+(2014, 1, 26, 2, 33, 40) fem-convergence-cpp 14.0641 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 26, 2, 33, 42) fem-jit-python 0.00102148 "JIT compilation (in memory cache)"
+(2014, 1, 26, 2, 41, 15) mesh-refinement-cpp 10.5487 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 26, 2, 41, 36) mesh-topology-cpp 21.6187 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 26, 2, 42, 1) mesh-unitcube-cpp 24.4409 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 26, 2, 42, 47) mesh-iteration-cpp 43.5822 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 26, 2, 43, 8) function-evaluation-cpp 21.1064 "Evaluations of functions at arbitrary points."
+(2014, 1, 26, 2, 43, 8) function-evaluation-cpp 20.9909 "Evaluations of functions at arbitrary points."
+(2014, 1, 26, 2, 43, 12) function-extrapolation-python 4.14615 "BENCH:  2.01171588898"
+(2014, 1, 26, 2, 43, 12) function-extrapolation-python 2.01172 "BENCH:  2.01171588898"
+(2014, 1, 26, 2, 43, 13) function-interpolation-python 1.49893 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 26, 2, 43, 13) function-interpolation-python 0.81606 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 26, 2, 43, 38) la-vector-access-cpp 24.9007 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 26, 2, 44, 10) la-vector-assignment-cpp 31.9596 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 28, 2, 39, 49) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.96 "BENCH 11.96"
+(2014, 1, 28, 2, 40, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9661 "Building point search tree to accelerate distance queries."
+(2014, 1, 28, 2, 40, 24) geometry-bounding_box_tree_build-cpp 13.9708 "BENCH 13.9708"
+(2014, 1, 28, 2, 40, 52) common-progress-cpp 27.6867 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 28, 2, 41, 22) common-timing-cpp 29.7707 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 28, 2, 43, 30) fem-multicore-cpp 128.187 "Coloring mesh."
+(2014, 1, 28, 2, 46, 0) fem-assembly-cpp 150.539 "Assembly for various forms and backends"
+(2014, 1, 28, 2, 46, 15) fem-convergence-cpp 14.1272 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 28, 2, 46, 16) fem-jit-python 0.0010134 "JIT compilation (in memory cache)"
+(2014, 1, 28, 2, 53, 53) mesh-refinement-cpp 10.2192 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 28, 2, 54, 15) mesh-topology-cpp 21.5145 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 28, 2, 54, 38) mesh-unitcube-cpp 23.3338 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 28, 2, 55, 16) mesh-iteration-cpp 35.5276 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 28, 2, 55, 39) function-evaluation-cpp 22.5328 "Evaluations of functions at arbitrary points."
+(2014, 1, 28, 2, 55, 39) function-evaluation-cpp 22.4137 "Evaluations of functions at arbitrary points."
+(2014, 1, 28, 2, 55, 43) function-extrapolation-python 4.13268 "BENCH:  2.03891706467"
+(2014, 1, 28, 2, 55, 43) function-extrapolation-python 2.03892 "BENCH:  2.03891706467"
+(2014, 1, 28, 2, 55, 44) function-interpolation-python 1.51555 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 28, 2, 55, 44) function-interpolation-python 0.822274 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 28, 2, 56, 9) la-vector-access-cpp 24.7856 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 28, 2, 56, 42) la-vector-assignment-cpp 32.9275 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 29, 2, 26, 12) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.7165 "BENCH 11.7165"
+(2014, 1, 29, 2, 26, 31) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4288 "Building point search tree to accelerate distance queries."
+(2014, 1, 29, 2, 26, 47) geometry-bounding_box_tree_build-cpp 13.8807 "BENCH 13.8807"
+(2014, 1, 29, 2, 27, 15) common-progress-cpp 27.6539 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 29, 2, 27, 47) common-timing-cpp 32.0411 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 29, 2, 29, 55) fem-multicore-cpp 127.874 "Coloring mesh."
+(2014, 1, 29, 2, 32, 26) fem-assembly-cpp 151.082 "Assembly for various forms and backends"
+(2014, 1, 29, 2, 32, 40) fem-convergence-cpp 14.1306 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 29, 2, 32, 42) fem-jit-python 0.00102539 "JIT compilation (in memory cache)"
+(2014, 1, 29, 2, 40, 15) mesh-refinement-cpp 10.3281 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 29, 2, 40, 37) mesh-topology-cpp 21.5167 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 29, 2, 41, 1) mesh-unitcube-cpp 24.4291 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 29, 2, 41, 43) mesh-iteration-cpp 39.152 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 29, 2, 42, 4) function-evaluation-cpp 21.0387 "Evaluations of functions at arbitrary points."
+(2014, 1, 29, 2, 42, 4) function-evaluation-cpp 20.9262 "Evaluations of functions at arbitrary points."
+(2014, 1, 29, 2, 42, 8) function-extrapolation-python 4.13379 "BENCH:  2.03488993645"
+(2014, 1, 29, 2, 42, 8) function-extrapolation-python 2.03489 "BENCH:  2.03488993645"
+(2014, 1, 29, 2, 42, 10) function-interpolation-python 1.51036 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 29, 2, 42, 10) function-interpolation-python 0.824071 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 29, 2, 42, 36) la-vector-access-cpp 25.9897 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 29, 2, 43, 8) la-vector-assignment-cpp 32.2278 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 30, 2, 39, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.7523 "BENCH 11.7523"
+(2014, 1, 30, 2, 39, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9561 "Building point search tree to accelerate distance queries."
+(2014, 1, 30, 2, 40, 13) geometry-bounding_box_tree_build-cpp 13.9674 "BENCH 13.9674"
+(2014, 1, 30, 2, 40, 41) common-progress-cpp 27.6539 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 30, 2, 41, 11) common-timing-cpp 30.4635 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 30, 2, 43, 21) fem-multicore-cpp 129.713 "Coloring mesh."
+(2014, 1, 30, 2, 45, 51) fem-assembly-cpp 150.233 "Assembly for various forms and backends"
+(2014, 1, 30, 2, 46, 6) fem-convergence-cpp 14.1467 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 30, 2, 46, 7) fem-jit-python 0.0010371 "JIT compilation (in memory cache)"
+(2014, 1, 30, 2, 53, 46) mesh-refinement-cpp 10.3367 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 30, 2, 54, 7) mesh-topology-cpp 21.3854 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 30, 2, 54, 32) mesh-unitcube-cpp 24.7038 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 30, 2, 55, 10) mesh-iteration-cpp 35.5132 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 30, 2, 55, 31) function-evaluation-cpp 21.2958 "Evaluations of functions at arbitrary points."
+(2014, 1, 30, 2, 55, 31) function-evaluation-cpp 21.1892 "Evaluations of functions at arbitrary points."
+(2014, 1, 30, 2, 55, 35) function-extrapolation-python 4.21072 "BENCH:  2.02427196503"
+(2014, 1, 30, 2, 55, 35) function-extrapolation-python 2.02427 "BENCH:  2.02427196503"
+(2014, 1, 30, 2, 55, 37) function-interpolation-python 1.52789 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 30, 2, 55, 37) function-interpolation-python 0.839809 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 30, 2, 56, 2) la-vector-access-cpp 24.9087 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 30, 2, 56, 34) la-vector-assignment-cpp 31.922 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 1, 31, 2, 26, 51) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1103 "BENCH 11.1103"
+(2014, 1, 31, 2, 27, 10) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2151 "Building point search tree to accelerate distance queries."
+(2014, 1, 31, 2, 27, 26) geometry-bounding_box_tree_build-cpp 13.9359 "BENCH 13.9359"
+(2014, 1, 31, 2, 27, 54) common-progress-cpp 27.6391 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 1, 31, 2, 28, 24) common-timing-cpp 30.7703 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 1, 31, 2, 30, 32) fem-multicore-cpp 127.927 "Coloring mesh."
+(2014, 1, 31, 2, 33, 0) fem-assembly-cpp 147.253 "Assembly for various forms and backends"
+(2014, 1, 31, 2, 33, 14) fem-convergence-cpp 14.1893 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 1, 31, 2, 33, 16) fem-jit-python 0.00102489 "JIT compilation (in memory cache)"
+(2014, 1, 31, 2, 40, 44) mesh-refinement-cpp 8.63186 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 1, 31, 2, 41, 5) mesh-topology-cpp 21.6185 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 1, 31, 2, 41, 29) mesh-unitcube-cpp 23.3489 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 1, 31, 2, 42, 15) mesh-iteration-cpp 44.1695 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 1, 31, 2, 42, 36) function-evaluation-cpp 20.989 "Evaluations of functions at arbitrary points."
+(2014, 1, 31, 2, 42, 36) function-evaluation-cpp 20.8714 "Evaluations of functions at arbitrary points."
+(2014, 1, 31, 2, 42, 40) function-extrapolation-python 4.20617 "BENCH:  2.03970885277"
+(2014, 1, 31, 2, 42, 40) function-extrapolation-python 2.03971 "BENCH:  2.03970885277"
+(2014, 1, 31, 2, 42, 42) function-interpolation-python 1.4866 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 31, 2, 42, 42) function-interpolation-python 0.812988 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 1, 31, 2, 43, 8) la-vector-access-cpp 26.4921 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 1, 31, 2, 43, 42) la-vector-assignment-cpp 33.4886 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 2, 1, 2, 27, 3) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.4747 "BENCH 11.4747"
+(2014, 2, 1, 2, 27, 22) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2751 "Building point search tree to accelerate distance queries."
+(2014, 2, 1, 2, 27, 38) geometry-bounding_box_tree_build-cpp 14.0163 "BENCH 14.0163"
+(2014, 2, 1, 2, 28, 6) common-progress-cpp 27.651 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 2, 1, 2, 28, 40) common-timing-cpp 34.5283 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 2, 1, 2, 30, 48) fem-multicore-cpp 127.399 "Coloring mesh."
+(2014, 2, 1, 2, 33, 16) fem-assembly-cpp 147.874 "Assembly for various forms and backends"
+(2014, 2, 1, 2, 33, 30) fem-convergence-cpp 14.1923 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 2, 1, 2, 33, 32) fem-jit-python 0.00102789 "JIT compilation (in memory cache)"
+(2014, 2, 1, 2, 41, 6) mesh-refinement-cpp 8.55332 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 2, 1, 2, 41, 28) mesh-topology-cpp 21.6848 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 2, 1, 2, 41, 51) mesh-unitcube-cpp 23.3207 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 2, 1, 2, 42, 29) mesh-iteration-cpp 35.4651 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 2, 1, 2, 42, 50) function-evaluation-cpp 20.9784 "Evaluations of functions at arbitrary points."
+(2014, 2, 1, 2, 42, 50) function-evaluation-cpp 20.8659 "Evaluations of functions at arbitrary points."
+(2014, 2, 1, 2, 42, 54) function-extrapolation-python 4.25899 "BENCH:  2.00344491005"
+(2014, 2, 1, 2, 42, 54) function-extrapolation-python 2.00344 "BENCH:  2.00344491005"
+(2014, 2, 1, 2, 42, 56) function-interpolation-python 1.50501 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 1, 2, 42, 56) function-interpolation-python 0.824445 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 1, 2, 43, 21) la-vector-access-cpp 24.9185 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 2, 1, 2, 43, 54) la-vector-assignment-cpp 33.4806 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 2, 2, 2, 25, 5) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1557 "BENCH 11.1557"
+(2014, 2, 2, 2, 25, 24) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2377 "Building point search tree to accelerate distance queries."
+(2014, 2, 2, 2, 25, 40) geometry-bounding_box_tree_build-cpp 13.9366 "BENCH 13.9366"
+(2014, 2, 2, 2, 26, 12) common-progress-cpp 31.4097 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 2, 2, 2, 26, 42) common-timing-cpp 30.9458 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 2, 2, 2, 28, 50) fem-multicore-cpp 127.615 "Coloring mesh."
+(2014, 2, 2, 2, 31, 17) fem-assembly-cpp 146.733 "Assembly for various forms and backends"
+(2014, 2, 2, 2, 31, 31) fem-convergence-cpp 14.1744 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 2, 2, 2, 31, 33) fem-jit-python 0.00103571 "JIT compilation (in memory cache)"
+(2014, 2, 2, 2, 39, 7) mesh-refinement-cpp 8.553 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 2, 2, 2, 39, 28) mesh-topology-cpp 21.5969 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 2, 2, 2, 39, 52) mesh-unitcube-cpp 23.2511 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 2, 2, 2, 40, 29) mesh-iteration-cpp 35.563 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 2, 2, 2, 40, 50) function-evaluation-cpp 20.9805 "Evaluations of functions at arbitrary points."
+(2014, 2, 2, 2, 40, 50) function-evaluation-cpp 20.8714 "Evaluations of functions at arbitrary points."
+(2014, 2, 2, 2, 40, 55) function-extrapolation-python 4.1105 "BENCH:  2.01057386398"
+(2014, 2, 2, 2, 40, 55) function-extrapolation-python 2.01057 "BENCH:  2.01057386398"
+(2014, 2, 2, 2, 40, 56) function-interpolation-python 1.48431 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 2, 2, 40, 56) function-interpolation-python 0.808568 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 2, 2, 41, 26) la-vector-access-cpp 30.0492 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 2, 2, 2, 42, 0) la-vector-assignment-cpp 33.4829 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 2, 3, 2, 35, 57) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.2224 "BENCH 11.2224"
+(2014, 2, 3, 2, 36, 16) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2988 "Building point search tree to accelerate distance queries."
+(2014, 2, 3, 2, 36, 32) geometry-bounding_box_tree_build-cpp 13.9391 "BENCH 13.9391"
+(2014, 2, 3, 2, 37, 0) common-progress-cpp 27.6434 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 2, 3, 2, 37, 31) common-timing-cpp 31.1442 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 2, 3, 2, 39, 40) fem-multicore-cpp 128.856 "Coloring mesh."
+(2014, 2, 3, 2, 42, 7) fem-assembly-cpp 147.219 "Assembly for various forms and backends"
+(2014, 2, 3, 2, 42, 21) fem-convergence-cpp 14.2224 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 2, 3, 2, 42, 23) fem-jit-python 0.00102181 "JIT compilation (in memory cache)"
+(2014, 2, 3, 2, 49, 57) mesh-refinement-cpp 8.57177 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 2, 3, 2, 50, 18) mesh-topology-cpp 21.5131 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 2, 3, 2, 50, 42) mesh-unitcube-cpp 23.2338 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 2, 3, 2, 51, 20) mesh-iteration-cpp 35.4699 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 2, 3, 2, 51, 41) function-evaluation-cpp 21.0771 "Evaluations of functions at arbitrary points."
+(2014, 2, 3, 2, 51, 41) function-evaluation-cpp 20.9471 "Evaluations of functions at arbitrary points."
+(2014, 2, 3, 2, 51, 45) function-extrapolation-python 4.13928 "BENCH:  2.02389383316"
+(2014, 2, 3, 2, 51, 45) function-extrapolation-python 2.02389 "BENCH:  2.02389383316"
+(2014, 2, 3, 2, 51, 46) function-interpolation-python 1.49282 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 3, 2, 51, 46) function-interpolation-python 0.808365 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 3, 2, 52, 11) la-vector-access-cpp 24.8726 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 2, 3, 2, 52, 45) la-vector-assignment-cpp 33.468 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 2, 4, 2, 27, 54) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1451 "BENCH 11.1451"
+(2014, 2, 4, 2, 28, 12) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3818 "Building point search tree to accelerate distance queries."
+(2014, 2, 4, 2, 28, 29) geometry-bounding_box_tree_build-cpp 13.9423 "BENCH 13.9423"
+(2014, 2, 4, 2, 29, 0) common-progress-cpp 31.407 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 2, 4, 2, 29, 31) common-timing-cpp 30.8856 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 2, 4, 2, 31, 40) fem-multicore-cpp 128.476 "Coloring mesh."
+(2014, 2, 4, 2, 34, 4) fem-assembly-cpp 144.421 "Assembly for various forms and backends"
+(2014, 2, 4, 2, 34, 18) fem-convergence-cpp 14.194 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 2, 4, 2, 34, 20) fem-jit-python 0.0010278 "JIT compilation (in memory cache)"
+(2014, 2, 4, 2, 41, 53) mesh-refinement-cpp 8.65397 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 2, 4, 2, 42, 14) mesh-topology-cpp 21.7049 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 2, 4, 2, 42, 38) mesh-unitcube-cpp 23.2986 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 2, 4, 2, 43, 17) mesh-iteration-cpp 36.4868 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 2, 4, 2, 43, 38) function-evaluation-cpp 21.0365 "Evaluations of functions at arbitrary points."
+(2014, 2, 4, 2, 43, 38) function-evaluation-cpp 20.9242 "Evaluations of functions at arbitrary points."
+(2014, 2, 4, 2, 43, 42) function-extrapolation-python 4.1236 "BENCH:  2.01024198532"
+(2014, 2, 4, 2, 43, 42) function-extrapolation-python 2.01024 "BENCH:  2.01024198532"
+(2014, 2, 4, 2, 43, 43) function-interpolation-python 1.50191 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 4, 2, 43, 43) function-interpolation-python 0.806589 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 4, 2, 44, 7) la-vector-access-cpp 23.8154 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 2, 4, 2, 44, 41) la-vector-assignment-cpp 33.9897 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 2, 5, 2, 32, 56) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0274 "BENCH 11.0274"
+(2014, 2, 5, 2, 33, 15) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2162 "Building point search tree to accelerate distance queries."
+(2014, 2, 5, 2, 33, 31) geometry-bounding_box_tree_build-cpp 13.9636 "BENCH 13.9636"
+(2014, 2, 5, 2, 33, 59) common-progress-cpp 27.6341 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 2, 5, 2, 34, 30) common-timing-cpp 31.2916 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 2, 5, 2, 36, 38) fem-multicore-cpp 128.404 "Coloring mesh."
+(2014, 2, 5, 2, 39, 3) fem-assembly-cpp 144.391 "Assembly for various forms and backends"
+(2014, 2, 5, 2, 39, 17) fem-convergence-cpp 14.1907 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 2, 5, 2, 39, 19) fem-jit-python 0.00102279 "JIT compilation (in memory cache)"
+(2014, 2, 5, 2, 46, 49) mesh-refinement-cpp 8.53868 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 2, 5, 2, 47, 11) mesh-topology-cpp 21.6395 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 2, 5, 2, 47, 34) mesh-unitcube-cpp 23.3238 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 2, 5, 2, 48, 12) mesh-iteration-cpp 35.469 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 2, 5, 2, 48, 34) function-evaluation-cpp 22.1981 "Evaluations of functions at arbitrary points."
+(2014, 2, 5, 2, 48, 34) function-evaluation-cpp 22.0708 "Evaluations of functions at arbitrary points."
+(2014, 2, 5, 2, 48, 38) function-extrapolation-python 4.17364 "BENCH:  1.99095797539"
+(2014, 2, 5, 2, 48, 38) function-extrapolation-python 1.99096 "BENCH:  1.99095797539"
+(2014, 2, 5, 2, 48, 40) function-interpolation-python 1.48685 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 5, 2, 48, 40) function-interpolation-python 0.807773 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 5, 2, 49, 5) la-vector-access-cpp 24.973 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 2, 5, 2, 49, 39) la-vector-assignment-cpp 34.0565 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 2, 6, 2, 30, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0587 "BENCH 11.0587"
+(2014, 2, 6, 2, 30, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6703 "Building point search tree to accelerate distance queries."
+(2014, 2, 6, 2, 31, 16) geometry-bounding_box_tree_build-cpp 13.9458 "BENCH 13.9458"
+(2014, 2, 6, 2, 31, 43) common-progress-cpp 27.6536 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 2, 6, 2, 32, 14) common-timing-cpp 30.9606 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 2, 6, 2, 34, 21) fem-multicore-cpp 126.463 "Coloring mesh."
+(2014, 2, 6, 2, 36, 45) fem-assembly-cpp 144.437 "Assembly for various forms and backends"
+(2014, 2, 6, 2, 36, 59) fem-convergence-cpp 14.1005 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 2, 6, 2, 37, 1) fem-jit-python 0.00102301 "JIT compilation (in memory cache)"
+(2014, 2, 6, 2, 44, 32) mesh-refinement-cpp 8.58761 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 2, 6, 2, 44, 53) mesh-topology-cpp 21.5833 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 2, 6, 2, 45, 16) mesh-unitcube-cpp 23.3295 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 2, 6, 2, 45, 55) mesh-iteration-cpp 36.5064 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 2, 6, 2, 46, 16) function-evaluation-cpp 20.9848 "Evaluations of functions at arbitrary points."
+(2014, 2, 6, 2, 46, 16) function-evaluation-cpp 20.8777 "Evaluations of functions at arbitrary points."
+(2014, 2, 6, 2, 46, 20) function-extrapolation-python 4.1197 "BENCH:  2.01532387733"
+(2014, 2, 6, 2, 46, 20) function-extrapolation-python 2.01532 "BENCH:  2.01532387733"
+(2014, 2, 6, 2, 46, 22) function-interpolation-python 1.47883 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 6, 2, 46, 22) function-interpolation-python 0.806746 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 6, 2, 46, 48) la-vector-access-cpp 25.9954 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 2, 6, 2, 47, 22) la-vector-assignment-cpp 33.9801 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 2, 7, 2, 38, 50) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9128 "BENCH 10.9128"
+(2014, 2, 7, 2, 39, 9) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5373 "Building point search tree to accelerate distance queries."
+(2014, 2, 7, 2, 39, 26) geometry-bounding_box_tree_build-cpp 13.9607 "BENCH 13.9607"
+(2014, 2, 7, 2, 39, 53) common-progress-cpp 27.6483 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 2, 7, 2, 40, 26) common-timing-cpp 32.3849 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 2, 7, 2, 42, 33) fem-multicore-cpp 126.909 "Coloring mesh."
+(2014, 2, 7, 2, 45, 0) fem-assembly-cpp 147.615 "Assembly for various forms and backends"
+(2014, 2, 7, 2, 45, 14) fem-convergence-cpp 14.074 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 2, 7, 2, 45, 33) fem-jit-python 0.000377989 "JIT compilation (in memory cache)"
+(2014, 2, 7, 2, 53, 8) mesh-refinement-cpp 8.4859 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 2, 7, 2, 53, 29) mesh-topology-cpp 21.5361 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 2, 7, 2, 53, 52) mesh-unitcube-cpp 23.1907 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 2, 7, 2, 54, 30) mesh-iteration-cpp 35.4917 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 2, 7, 2, 54, 51) function-evaluation-cpp 20.9772 "Evaluations of functions at arbitrary points."
+(2014, 2, 7, 2, 54, 51) function-evaluation-cpp 20.8695 "Evaluations of functions at arbitrary points."
+(2014, 2, 7, 2, 55, 44) function-extrapolation-python 52.572 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2014, 2, 7, 2, 55, 44) function-extrapolation-python 2.01246 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2014, 2, 7, 2, 55, 45) function-interpolation-python 1.48531 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 7, 2, 55, 45) function-interpolation-python 0.799276 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 7, 2, 56, 10) la-vector-access-cpp 24.7867 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 2, 7, 2, 56, 42) la-vector-assignment-cpp 32.4186 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 2, 8, 2, 27, 24) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0254 "BENCH 11.0254"
+(2014, 2, 8, 2, 27, 43) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2307 "Building point search tree to accelerate distance queries."
+(2014, 2, 8, 2, 28, 0) geometry-bounding_box_tree_build-cpp 13.9672 "BENCH 13.9672"
+(2014, 2, 8, 2, 28, 27) common-progress-cpp 27.6139 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 2, 8, 2, 28, 56) common-timing-cpp 29.2142 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 2, 8, 2, 31, 2) fem-multicore-cpp 126.11 "Coloring mesh."
+(2014, 2, 8, 2, 33, 27) fem-assembly-cpp 144.201 "Assembly for various forms and backends"
+(2014, 2, 8, 2, 33, 41) fem-convergence-cpp 14.0413 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 2, 8, 2, 33, 43) fem-jit-python 0.000353193 "JIT compilation (in memory cache)"
+(2014, 2, 8, 2, 41, 18) mesh-refinement-cpp 8.50042 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 2, 8, 2, 41, 40) mesh-topology-cpp 21.9878 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 2, 8, 2, 42, 3) mesh-unitcube-cpp 23 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 2, 8, 2, 42, 45) mesh-iteration-cpp 39.119 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 2, 8, 2, 43, 6) function-evaluation-cpp 20.9739 "Evaluations of functions at arbitrary points."
+(2014, 2, 8, 2, 43, 6) function-evaluation-cpp 20.8693 "Evaluations of functions at arbitrary points."
+(2014, 2, 8, 2, 43, 10) function-extrapolation-python 4.12897 "BENCH:  2.01829910278"
+(2014, 2, 8, 2, 43, 10) function-extrapolation-python 2.0183 "BENCH:  2.01829910278"
+(2014, 2, 8, 2, 43, 11) function-interpolation-python 1.48256 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 8, 2, 43, 11) function-interpolation-python 0.79725 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 2, 8, 2, 43, 38) la-vector-access-cpp 27.0878 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 2, 8, 2, 44, 11) la-vector-assignment-cpp 32.4739 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 7, 2, 10, 18, 21) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.3047 "BENCH 11.3047"
+(2014, 7, 2, 10, 18, 39) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2294 "Building point search tree to accelerate distance queries."
+(2014, 7, 2, 10, 18, 57) geometry-bounding_box_tree_build-cpp 14.4811 "BENCH 14.4811"
+(2014, 7, 2, 10, 19, 25) common-progress-cpp 28.0973 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 7, 2, 10, 19, 56) common-timing-cpp 31.0175 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 7, 2, 10, 21, 30) fem-convergence-cpp 3.95093 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 7, 2, 10, 21, 32) fem-jit-python 0.000343704 "JIT compilation (in memory cache)"
+(2014, 7, 2, 10, 46, 4) mesh-refinement-cpp 8.59842 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 7, 2, 10, 46, 27) mesh-topology-cpp 22.6657 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 7, 2, 10, 46, 50) mesh-unitcube-cpp 23.4783 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 7, 2, 10, 47, 32) mesh-iteration-cpp 39.2779 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 7, 2, 10, 47, 55) function-evaluation-cpp 23.3481 "Evaluations of functions at arbitrary points."
+(2014, 7, 2, 10, 47, 55) function-evaluation-cpp 23.2492 "Evaluations of functions at arbitrary points."
+(2014, 7, 2, 10, 48, 0) function-extrapolation-python 4.62164 "Size of local-to-local: 10431"
+(2014, 7, 2, 10, 48, 0) function-extrapolation-python 2.0234 "Size of local-to-local: 10431"
+(2014, 7, 2, 10, 48, 2) function-interpolation-python 1.89533 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 2, 10, 48, 2) function-interpolation-python 0.907394 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 2, 10, 50, 17) la-vector-access-cpp 134.991 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 7, 2, 10, 50, 49) la-vector-assignment-cpp 32.112 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 7, 3, 1, 26, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.3127 "BENCH 11.3127"
+(2014, 7, 3, 1, 27, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0643 "Building point search tree to accelerate distance queries."
+(2014, 7, 3, 1, 27, 22) geometry-bounding_box_tree_build-cpp 13.9784 "BENCH 13.9784"
+(2014, 7, 3, 1, 27, 49) common-progress-cpp 27.6228 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 7, 3, 1, 28, 18) common-timing-cpp 28.8784 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 7, 3, 1, 29, 50) fem-convergence-cpp 3.91488 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 7, 3, 1, 29, 52) fem-jit-python 0.000348091 "JIT compilation (in memory cache)"
+(2014, 7, 3, 5, 6, 33) mesh-refinement-cpp 8.84145 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 7, 3, 5, 6, 56) mesh-topology-cpp 22.7719 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 7, 3, 5, 7, 19) mesh-unitcube-cpp 23.5724 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 7, 3, 5, 8, 1) mesh-iteration-cpp 39.1655 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 7, 3, 5, 8, 24) function-evaluation-cpp 22.8668 "Evaluations of functions at arbitrary points."
+(2014, 7, 3, 5, 8, 24) function-evaluation-cpp 22.768 "Evaluations of functions at arbitrary points."
+(2014, 7, 3, 5, 8, 29) function-extrapolation-python 4.7125 "Size of local-to-local: 10431"
+(2014, 7, 3, 5, 8, 29) function-extrapolation-python 2.04281 "Size of local-to-local: 10431"
+(2014, 7, 3, 5, 8, 31) function-interpolation-python 1.90006 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 3, 5, 8, 31) function-interpolation-python 0.899753 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 3, 5, 10, 44) la-vector-access-cpp 133.643 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 7, 3, 5, 11, 16) la-vector-assignment-cpp 32.0402 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 7, 4, 1, 29, 1) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.3187 "BENCH 11.3187"
+(2014, 7, 4, 1, 29, 20) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1377 "Building point search tree to accelerate distance queries."
+(2014, 7, 4, 1, 29, 36) geometry-bounding_box_tree_build-cpp 13.9265 "BENCH 13.9265"
+(2014, 7, 4, 1, 30, 4) common-progress-cpp 27.6636 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 7, 4, 1, 30, 32) common-timing-cpp 28.4233 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 7, 4, 1, 32, 5) fem-convergence-cpp 3.90253 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 7, 4, 1, 32, 6) fem-jit-python 0.000353599 "JIT compilation (in memory cache)"
+(2014, 7, 4, 2, 11, 56) mesh-refinement-cpp 8.58864 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 7, 4, 2, 12, 19) mesh-topology-cpp 22.5968 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 7, 4, 2, 12, 43) mesh-unitcube-cpp 23.5129 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 7, 4, 2, 13, 24) mesh-iteration-cpp 39.1708 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 7, 4, 2, 13, 47) function-evaluation-cpp 22.6914 "Evaluations of functions at arbitrary points."
+(2014, 7, 4, 2, 13, 47) function-evaluation-cpp 22.5926 "Evaluations of functions at arbitrary points."
+(2014, 7, 4, 2, 13, 52) function-extrapolation-python 4.46566 "Size of local-to-local: 10431"
+(2014, 7, 4, 2, 13, 52) function-extrapolation-python 2.04701 "Size of local-to-local: 10431"
+(2014, 7, 4, 2, 13, 53) function-interpolation-python 1.8706 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 4, 2, 13, 53) function-interpolation-python 0.90085 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 4, 2, 16, 7) la-vector-access-cpp 133.399 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 7, 4, 2, 16, 39) la-vector-assignment-cpp 32.0477 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 7, 5, 1, 26, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.6891 "BENCH 11.6891"
+(2014, 7, 5, 1, 27, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0682 "Building point search tree to accelerate distance queries."
+(2014, 7, 5, 1, 27, 21) geometry-bounding_box_tree_build-cpp 13.9382 "BENCH 13.9382"
+(2014, 7, 5, 1, 27, 49) common-progress-cpp 27.6574 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 7, 5, 1, 28, 18) common-timing-cpp 29.2292 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 7, 5, 1, 29, 50) fem-convergence-cpp 3.86247 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 7, 5, 1, 29, 52) fem-jit-python 0.000353193 "JIT compilation (in memory cache)"
+(2014, 7, 5, 5, 4, 43) mesh-refinement-cpp 8.96663 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 7, 5, 5, 5, 6) mesh-topology-cpp 22.5666 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 7, 5, 5, 5, 29) mesh-unitcube-cpp 23.4949 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 7, 5, 5, 6, 11) mesh-iteration-cpp 39.1615 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 7, 5, 5, 6, 34) function-evaluation-cpp 22.6459 "Evaluations of functions at arbitrary points."
+(2014, 7, 5, 5, 6, 34) function-evaluation-cpp 22.5423 "Evaluations of functions at arbitrary points."
+(2014, 7, 5, 5, 6, 38) function-extrapolation-python 4.68126 "Size of local-to-local: 10431"
+(2014, 7, 5, 5, 6, 38) function-extrapolation-python 2.0386 "Size of local-to-local: 10431"
+(2014, 7, 5, 5, 6, 40) function-interpolation-python 1.89517 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 5, 5, 6, 40) function-interpolation-python 0.912955 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 5, 5, 8, 56) la-vector-access-cpp 136.108 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 7, 5, 5, 9, 29) la-vector-assignment-cpp 33.067 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 7, 6, 1, 21, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.2509 "BENCH 11.2509"
+(2014, 7, 6, 1, 22, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1458 "Building point search tree to accelerate distance queries."
+(2014, 7, 6, 1, 22, 18) geometry-bounding_box_tree_build-cpp 13.9784 "BENCH 13.9784"
+(2014, 7, 6, 1, 22, 45) common-progress-cpp 27.6584 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 7, 6, 1, 23, 14) common-timing-cpp 28.7272 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 7, 6, 1, 24, 47) fem-convergence-cpp 3.92311 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 7, 6, 1, 24, 49) fem-jit-python 0.000357008 "JIT compilation (in memory cache)"
+(2014, 7, 6, 5, 9, 58) mesh-refinement-cpp 9.06574 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 7, 6, 5, 10, 22) mesh-topology-cpp 23.2399 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 7, 6, 5, 10, 46) mesh-unitcube-cpp 23.7118 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 7, 6, 5, 11, 27) mesh-iteration-cpp 39.1798 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 7, 6, 5, 11, 50) function-evaluation-cpp 22.9826 "Evaluations of functions at arbitrary points."
+(2014, 7, 6, 5, 11, 50) function-evaluation-cpp 22.879 "Evaluations of functions at arbitrary points."
+(2014, 7, 6, 5, 11, 55) function-extrapolation-python 4.77623 "Size of local-to-local: 10431"
+(2014, 7, 6, 5, 11, 55) function-extrapolation-python 2.04514 "Size of local-to-local: 10431"
+(2014, 7, 6, 5, 11, 57) function-interpolation-python 1.8745 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 6, 5, 11, 57) function-interpolation-python 0.891722 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 6, 5, 14, 11) la-vector-access-cpp 133.554 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 7, 6, 5, 14, 43) la-vector-assignment-cpp 32.0162 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 7, 7, 1, 22, 11) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0498 "BENCH 11.0498"
+(2014, 7, 7, 1, 22, 30) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1739 "Building point search tree to accelerate distance queries."
+(2014, 7, 7, 1, 22, 46) geometry-bounding_box_tree_build-cpp 13.9542 "BENCH 13.9542"
+(2014, 7, 7, 1, 23, 14) common-progress-cpp 27.6619 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 7, 7, 1, 23, 44) common-timing-cpp 29.9119 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 7, 7, 1, 25, 16) fem-convergence-cpp 3.91938 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 7, 7, 1, 25, 18) fem-jit-python 0.000354791 "JIT compilation (in memory cache)"
+(2014, 7, 7, 4, 55, 21) mesh-refinement-cpp 8.70565 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 7, 7, 4, 55, 44) mesh-topology-cpp 22.221 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 7, 7, 4, 56, 7) mesh-unitcube-cpp 23.3569 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 7, 7, 4, 56, 46) mesh-iteration-cpp 36.2743 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 7, 7, 4, 57, 9) function-evaluation-cpp 23.5237 "Evaluations of functions at arbitrary points."
+(2014, 7, 7, 4, 57, 9) function-evaluation-cpp 23.4148 "Evaluations of functions at arbitrary points."
+(2014, 7, 7, 4, 57, 14) function-extrapolation-python 4.40324 "Size of local-to-local: 10431"
+(2014, 7, 7, 4, 57, 14) function-extrapolation-python 2.01151 "Size of local-to-local: 10431"
+(2014, 7, 7, 4, 57, 16) function-interpolation-python 1.83829 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 7, 4, 57, 16) function-interpolation-python 0.872781 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 7, 7, 4, 59, 33) la-vector-access-cpp 137.597 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 7, 7, 5, 0, 5) la-vector-assignment-cpp 32.0332 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 19, 11, 48, 14) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.077 "BENCH 11.077"
+(2014, 8, 19, 11, 48, 33) geometry-bounding_box_tree_compute_closest_entity-cpp 15.285 "Building point search tree to accelerate distance queries."
+(2014, 8, 19, 11, 48, 49) geometry-bounding_box_tree_build-cpp 14.1294 "BENCH 14.1294"
+(2014, 8, 19, 11, 49, 17) common-progress-cpp 27.6725 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 19, 11, 49, 48) common-timing-cpp 31.2013 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 19, 11, 51, 22) fem-convergence-cpp 3.86397 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 19, 11, 51, 44) fem-jit-python 0.000450301 "JIT compilation (in memory cache)"
+(2014, 8, 19, 12, 8, 18) mesh-refinement-cpp 8.49906 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 19, 12, 8, 40) mesh-topology-cpp 21.5914 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 19, 12, 9, 4) mesh-unitcube-cpp 23.42 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 19, 12, 9, 50) mesh-iteration-cpp 43.7055 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 19, 12, 9, 50) function-evaluation-cpp 0.053781 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 19, 12, 11, 2) function-extrapolation-python 71.9837 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2014, 8, 19, 12, 11, 2) function-extrapolation-python 2.00071 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2014, 8, 19, 12, 11, 10) function-interpolation-python 8.03047 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2014, 8, 19, 12, 11, 10) function-interpolation-python 0.913345 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2014, 8, 19, 12, 13, 41) la-vector-access-cpp 151.196 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 19, 12, 14, 23) la-vector-assignment-cpp 42.1399 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 20, 1, 8, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8741 "BENCH 10.8741"
+(2014, 8, 20, 1, 8, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9806 "Building point search tree to accelerate distance queries."
+(2014, 8, 20, 1, 9, 13) geometry-bounding_box_tree_build-cpp 14.1011 "BENCH 14.1011"
+(2014, 8, 20, 1, 9, 40) common-progress-cpp 27.8524 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 20, 1, 10, 12) common-timing-cpp 31.1595 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 20, 1, 11, 47) fem-convergence-cpp 3.9314 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 20, 1, 11, 49) fem-jit-python 0.000422001 "JIT compilation (in memory cache)"
+(2014, 8, 20, 4, 19, 46) mesh-refinement-cpp 8.48749 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 20, 4, 20, 8) mesh-topology-cpp 21.8703 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 20, 4, 20, 31) mesh-unitcube-cpp 23.4506 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 20, 4, 21, 10) mesh-iteration-cpp 36.0472 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 20, 4, 21, 10) function-evaluation-cpp 0.0671489 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 20, 4, 21, 16) function-extrapolation-python 5.95647 "BENCH:  1.99171614647"
+(2014, 8, 20, 4, 21, 16) function-extrapolation-python 1.99172 "BENCH:  1.99171614647"
+(2014, 8, 20, 4, 21, 18) function-interpolation-python 2.22188 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 20, 4, 21, 18) function-interpolation-python 0.894065 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 20, 4, 23, 56) la-vector-access-cpp 158.179 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 20, 4, 24, 34) la-vector-assignment-cpp 38.0037 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 21, 1, 8, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0166 "BENCH 11.0166"
+(2014, 8, 21, 1, 8, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.033 "Building point search tree to accelerate distance queries."
+(2014, 8, 21, 1, 9, 13) geometry-bounding_box_tree_build-cpp 14.1668 "BENCH 14.1668"
+(2014, 8, 21, 1, 9, 41) common-progress-cpp 27.9021 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 21, 1, 10, 13) common-timing-cpp 31.4008 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 21, 1, 11, 47) fem-convergence-cpp 3.86568 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 21, 1, 11, 49) fem-jit-python 0.000415516 "JIT compilation (in memory cache)"
+(2014, 8, 21, 4, 25, 53) mesh-refinement-cpp 8.46743 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 21, 4, 26, 15) mesh-topology-cpp 21.6883 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 21, 4, 26, 38) mesh-unitcube-cpp 23.6333 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 21, 4, 27, 17) mesh-iteration-cpp 36.0312 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 21, 4, 27, 17) function-evaluation-cpp 0.07534 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 21, 4, 27, 23) function-extrapolation-python 5.86548 "BENCH:  1.98863577843"
+(2014, 8, 21, 4, 27, 23) function-extrapolation-python 1.98864 "BENCH:  1.98863577843"
+(2014, 8, 21, 4, 27, 25) function-interpolation-python 2.22035 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 21, 4, 27, 25) function-interpolation-python 0.899141 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 21, 4, 30, 3) la-vector-access-cpp 158.174 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 21, 4, 30, 41) la-vector-assignment-cpp 37.9964 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 22, 1, 8, 48) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.904 "BENCH 10.904"
+(2014, 8, 22, 1, 9, 7) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2122 "Building point search tree to accelerate distance queries."
+(2014, 8, 22, 1, 9, 24) geometry-bounding_box_tree_build-cpp 13.9089 "BENCH 13.9089"
+(2014, 8, 22, 1, 9, 51) common-progress-cpp 27.6201 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 22, 1, 10, 22) common-timing-cpp 31.2708 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 22, 1, 11, 56) fem-convergence-cpp 3.80037 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 22, 1, 11, 58) fem-jit-python 0.000435209 "JIT compilation (in memory cache)"
+(2014, 8, 22, 4, 19, 34) mesh-refinement-cpp 8.48611 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 22, 4, 19, 56) mesh-topology-cpp 21.708 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 22, 4, 20, 19) mesh-unitcube-cpp 23.3928 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 22, 4, 20, 58) mesh-iteration-cpp 36.0517 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 22, 4, 20, 58) function-evaluation-cpp 0.0837071 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 22, 4, 21, 4) function-extrapolation-python 5.68663 "BENCH:  1.99803900719"
+(2014, 8, 22, 4, 21, 4) function-extrapolation-python 1.99804 "BENCH:  1.99803900719"
+(2014, 8, 22, 4, 21, 6) function-interpolation-python 2.21084 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 22, 4, 21, 6) function-interpolation-python 0.891272 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 22, 4, 23, 44) la-vector-access-cpp 158.212 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 22, 4, 24, 22) la-vector-assignment-cpp 37.9906 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 23, 1, 8, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.929 "BENCH 10.929"
+(2014, 8, 23, 1, 8, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9172 "Building point search tree to accelerate distance queries."
+(2014, 8, 23, 1, 9, 13) geometry-bounding_box_tree_build-cpp 14.3342 "BENCH 14.3342"
+(2014, 8, 23, 1, 9, 41) common-progress-cpp 27.874 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 23, 1, 10, 12) common-timing-cpp 31.0914 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 23, 1, 11, 47) fem-convergence-cpp 3.82958 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 23, 1, 11, 48) fem-jit-python 0.000421405 "JIT compilation (in memory cache)"
+(2014, 8, 23, 4, 31, 9) mesh-refinement-cpp 8.4711 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 23, 4, 31, 31) mesh-topology-cpp 21.6672 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 23, 4, 31, 54) mesh-unitcube-cpp 23.4117 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 23, 4, 32, 33) mesh-iteration-cpp 36.0319 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 23, 4, 32, 33) function-evaluation-cpp 0.0753469 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 23, 4, 32, 39) function-extrapolation-python 5.92421 "BENCH:  2.01829004288"
+(2014, 8, 23, 4, 32, 39) function-extrapolation-python 2.01829 "BENCH:  2.01829004288"
+(2014, 8, 23, 4, 32, 41) function-interpolation-python 2.21605 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 23, 4, 32, 41) function-interpolation-python 0.896607 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 23, 4, 35, 17) la-vector-access-cpp 156.218 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 23, 4, 35, 55) la-vector-assignment-cpp 37.9969 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 24, 1, 8, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8986 "BENCH 10.8986"
+(2014, 8, 24, 1, 8, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9513 "Building point search tree to accelerate distance queries."
+(2014, 8, 24, 1, 9, 14) geometry-bounding_box_tree_build-cpp 13.973 "BENCH 13.973"
+(2014, 8, 24, 1, 9, 42) common-progress-cpp 27.9071 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 24, 1, 10, 12) common-timing-cpp 30.6658 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 24, 1, 11, 47) fem-convergence-cpp 3.88126 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 24, 1, 11, 48) fem-jit-python 0.000416899 "JIT compilation (in memory cache)"
+(2014, 8, 24, 4, 19, 1) mesh-refinement-cpp 8.43317 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 24, 4, 19, 23) mesh-topology-cpp 21.7043 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 24, 4, 19, 47) mesh-unitcube-cpp 23.4283 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 24, 4, 20, 25) mesh-iteration-cpp 36.0563 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 24, 4, 20, 25) function-evaluation-cpp 0.075469 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 24, 4, 20, 31) function-extrapolation-python 5.66587 "BENCH:  1.98955583572"
+(2014, 8, 24, 4, 20, 31) function-extrapolation-python 1.98956 "BENCH:  1.98955583572"
+(2014, 8, 24, 4, 20, 33) function-interpolation-python 2.21552 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 24, 4, 20, 33) function-interpolation-python 0.895287 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 24, 4, 23, 11) la-vector-access-cpp 158.152 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 24, 4, 23, 49) la-vector-assignment-cpp 38.0358 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 25, 1, 8, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9642 "BENCH 10.9642"
+(2014, 8, 25, 1, 8, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3169 "Building point search tree to accelerate distance queries."
+(2014, 8, 25, 1, 9, 15) geometry-bounding_box_tree_build-cpp 14.0211 "BENCH 14.0211"
+(2014, 8, 25, 1, 9, 43) common-progress-cpp 27.8728 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 25, 1, 10, 14) common-timing-cpp 31.9251 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 25, 1, 11, 49) fem-convergence-cpp 3.83493 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 25, 1, 11, 50) fem-jit-python 0.000431108 "JIT compilation (in memory cache)"
+(2014, 8, 25, 4, 23, 1) mesh-refinement-cpp 8.48825 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 25, 4, 23, 23) mesh-topology-cpp 21.6512 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 25, 4, 23, 47) mesh-unitcube-cpp 23.4021 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 25, 4, 24, 25) mesh-iteration-cpp 36.028 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 25, 4, 24, 25) function-evaluation-cpp 0.050108 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 25, 4, 24, 31) function-extrapolation-python 5.76555 "BENCH:  2.00843095779"
+(2014, 8, 25, 4, 24, 31) function-extrapolation-python 2.00843 "BENCH:  2.00843095779"
+(2014, 8, 25, 4, 24, 33) function-interpolation-python 2.22132 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 25, 4, 24, 33) function-interpolation-python 0.892987 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 25, 4, 27, 10) la-vector-access-cpp 156.214 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 25, 4, 27, 48) la-vector-assignment-cpp 37.9736 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 26, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8956 "BENCH 10.8956"
+(2014, 8, 26, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1347 "Building point search tree to accelerate distance queries."
+(2014, 8, 26, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.1684 "BENCH 14.1684"
+(2014, 8, 26, 1, 9, 46) common-progress-cpp 27.8921 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 26, 1, 10, 17) common-timing-cpp 30.9387 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 26, 1, 11, 51) fem-convergence-cpp 3.81667 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 26, 1, 11, 53) fem-jit-python 0.000411701 "JIT compilation (in memory cache)"
+(2014, 8, 26, 4, 29, 11) mesh-refinement-cpp 8.5057 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 26, 4, 29, 33) mesh-topology-cpp 21.6696 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 26, 4, 29, 57) mesh-unitcube-cpp 23.433 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 26, 4, 30, 35) mesh-iteration-cpp 36.0279 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 26, 4, 30, 35) function-evaluation-cpp 0.0584321 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 26, 4, 30, 52) function-extrapolation-python 16.6677 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2014, 8, 26, 4, 30, 52) function-extrapolation-python 2.00544 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2014, 8, 26, 4, 31, 0) function-interpolation-python 7.6663 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2014, 8, 26, 4, 31, 0) function-interpolation-python 0.905526 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2014, 8, 26, 4, 33, 34) la-vector-access-cpp 154.256 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 26, 4, 34, 16) la-vector-assignment-cpp 41.9977 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 27, 1, 8, 50) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9746 "BENCH 10.9746"
+(2014, 8, 27, 1, 9, 9) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2658 "Building point search tree to accelerate distance queries."
+(2014, 8, 27, 1, 9, 25) geometry-bounding_box_tree_build-cpp 13.9547 "BENCH 13.9547"
+(2014, 8, 27, 1, 9, 53) common-progress-cpp 27.6262 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 27, 1, 10, 24) common-timing-cpp 30.945 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 27, 1, 11, 58) fem-convergence-cpp 3.82194 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 27, 1, 12, 0) fem-jit-python 0.000418401 "JIT compilation (in memory cache)"
+(2014, 8, 27, 4, 24, 49) mesh-refinement-cpp 8.48804 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 27, 4, 25, 11) mesh-topology-cpp 21.7373 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 27, 4, 25, 34) mesh-unitcube-cpp 23.4172 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 27, 4, 26, 13) mesh-iteration-cpp 36.1167 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 27, 4, 26, 13) function-evaluation-cpp 0.0784979 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 27, 4, 26, 19) function-extrapolation-python 6.42418 "BENCH:  2.09120702744"
+(2014, 8, 27, 4, 26, 19) function-extrapolation-python 2.09121 "BENCH:  2.09120702744"
+(2014, 8, 27, 4, 26, 22) function-interpolation-python 2.31158 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 27, 4, 26, 22) function-interpolation-python 0.946009 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 27, 4, 28, 57) la-vector-access-cpp 155.509 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 27, 4, 29, 35) la-vector-assignment-cpp 37.9954 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 28, 1, 8, 50) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0549 "BENCH 11.0549"
+(2014, 8, 28, 1, 9, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1792 "Building point search tree to accelerate distance queries."
+(2014, 8, 28, 1, 9, 25) geometry-bounding_box_tree_build-cpp 14.3099 "BENCH 14.3099"
+(2014, 8, 28, 1, 9, 53) common-progress-cpp 27.888 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 28, 1, 10, 24) common-timing-cpp 31.384 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 28, 1, 11, 59) fem-convergence-cpp 3.88893 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 28, 1, 12, 0) fem-jit-python 0.000419188 "JIT compilation (in memory cache)"
+(2014, 8, 28, 4, 27, 58) mesh-refinement-cpp 8.62345 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 28, 4, 28, 20) mesh-topology-cpp 21.9155 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 28, 4, 28, 44) mesh-unitcube-cpp 23.6162 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 28, 4, 29, 22) mesh-iteration-cpp 36.2655 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 28, 4, 29, 22) function-evaluation-cpp 0.0813129 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 28, 4, 29, 29) function-extrapolation-python 6.01153 "BENCH:  2.04151010513"
+(2014, 8, 28, 4, 29, 29) function-extrapolation-python 2.04151 "BENCH:  2.04151010513"
+(2014, 8, 28, 4, 29, 31) function-interpolation-python 2.30388 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 28, 4, 29, 31) function-interpolation-python 0.919988 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 28, 4, 32, 7) la-vector-access-cpp 156.549 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 28, 4, 32, 45) la-vector-assignment-cpp 37.9682 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 29, 1, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9203 "BENCH 10.9203"
+(2014, 8, 29, 1, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8842 "Building point search tree to accelerate distance queries."
+(2014, 8, 29, 1, 9, 20) geometry-bounding_box_tree_build-cpp 13.9697 "BENCH 13.9697"
+(2014, 8, 29, 1, 9, 48) common-progress-cpp 27.8818 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 29, 1, 10, 18) common-timing-cpp 30.6499 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 29, 1, 11, 53) fem-convergence-cpp 3.85991 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 29, 1, 12, 0) fem-jit-python 0.000456786 "JIT compilation (in memory cache)"
+(2014, 8, 29, 4, 22, 45) mesh-refinement-cpp 8.51531 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 29, 4, 23, 7) mesh-topology-cpp 21.4879 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 29, 4, 23, 30) mesh-unitcube-cpp 22.6354 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 29, 4, 24, 8) mesh-iteration-cpp 35.5387 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 29, 4, 24, 8) function-evaluation-cpp 0.0533762 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 29, 4, 24, 14) function-extrapolation-python 5.93574 "BENCH:  2.02293300629"
+(2014, 8, 29, 4, 24, 14) function-extrapolation-python 2.02293 "BENCH:  2.02293300629"
+(2014, 8, 29, 4, 24, 16) function-interpolation-python 2.23636 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 29, 4, 24, 16) function-interpolation-python 0.87529 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 29, 4, 26, 58) la-vector-access-cpp 161.785 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 29, 4, 27, 40) la-vector-assignment-cpp 42.0398 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 30, 1, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9434 "BENCH 10.9434"
+(2014, 8, 30, 1, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.105 "Building point search tree to accelerate distance queries."
+(2014, 8, 30, 1, 9, 22) geometry-bounding_box_tree_build-cpp 14.0379 "BENCH 14.0379"
+(2014, 8, 30, 1, 9, 50) common-progress-cpp 27.8936 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 30, 1, 10, 20) common-timing-cpp 30.3724 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 30, 1, 11, 56) fem-convergence-cpp 3.87327 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 30, 1, 11, 58) fem-jit-python 0.000426698 "JIT compilation (in memory cache)"
+(2014, 8, 30, 4, 24, 13) mesh-refinement-cpp 8.48145 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 30, 4, 24, 35) mesh-topology-cpp 21.4934 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 30, 4, 24, 58) mesh-unitcube-cpp 22.6508 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 30, 4, 25, 36) mesh-iteration-cpp 35.5615 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 30, 4, 25, 36) function-evaluation-cpp 0.0640409 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 30, 4, 25, 42) function-extrapolation-python 5.94789 "BENCH:  2.00775980949"
+(2014, 8, 30, 4, 25, 42) function-extrapolation-python 2.00776 "BENCH:  2.00775980949"
+(2014, 8, 30, 4, 25, 44) function-interpolation-python 2.25067 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 30, 4, 25, 44) function-interpolation-python 0.904744 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 30, 4, 28, 22) la-vector-access-cpp 158.142 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 30, 4, 29, 7) la-vector-assignment-cpp 44.2976 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 8, 31, 1, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8723 "BENCH 10.8723"
+(2014, 8, 31, 1, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1068 "Building point search tree to accelerate distance queries."
+(2014, 8, 31, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.3833 "BENCH 14.3833"
+(2014, 8, 31, 1, 9, 45) common-progress-cpp 27.931 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 8, 31, 1, 10, 16) common-timing-cpp 31.0883 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 8, 31, 1, 11, 52) fem-convergence-cpp 3.86391 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 8, 31, 1, 11, 53) fem-jit-python 0.000422096 "JIT compilation (in memory cache)"
+(2014, 8, 31, 4, 30, 39) mesh-refinement-cpp 8.45525 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 8, 31, 4, 31, 1) mesh-topology-cpp 21.3585 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 8, 31, 4, 31, 24) mesh-unitcube-cpp 22.6825 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 8, 31, 4, 32, 2) mesh-iteration-cpp 35.5453 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 8, 31, 4, 32, 2) function-evaluation-cpp 0.053719 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 8, 31, 4, 32, 8) function-extrapolation-python 5.98229 "BENCH:  2.00886392593"
+(2014, 8, 31, 4, 32, 8) function-extrapolation-python 2.00886 "BENCH:  2.00886392593"
+(2014, 8, 31, 4, 32, 10) function-interpolation-python 2.21536 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 31, 4, 32, 10) function-interpolation-python 0.884962 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 8, 31, 4, 34, 47) la-vector-access-cpp 157.489 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 8, 31, 4, 35, 30) la-vector-assignment-cpp 42.0686 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 1, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9115 "BENCH 10.9115"
+(2014, 9, 1, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5028 "Building point search tree to accelerate distance queries."
+(2014, 9, 1, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.195 "BENCH 14.195"
+(2014, 9, 1, 1, 9, 45) common-progress-cpp 27.8993 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 1, 1, 10, 16) common-timing-cpp 31.0683 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 1, 1, 11, 52) fem-convergence-cpp 3.83639 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 1, 1, 11, 53) fem-jit-python 0.000415611 "JIT compilation (in memory cache)"
+(2014, 9, 1, 4, 47, 2) mesh-refinement-cpp 8.60175 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 1, 4, 47, 24) mesh-topology-cpp 21.5571 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 1, 4, 47, 47) mesh-unitcube-cpp 22.9359 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 1, 4, 48, 25) mesh-iteration-cpp 35.7878 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 1, 4, 48, 25) function-evaluation-cpp 0.078711 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 1, 4, 48, 32) function-extrapolation-python 6.07803 "BENCH:  2.1369228363"
+(2014, 9, 1, 4, 48, 32) function-extrapolation-python 2.13692 "BENCH:  2.1369228363"
+(2014, 9, 1, 4, 48, 34) function-interpolation-python 2.30394 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 1, 4, 48, 34) function-interpolation-python 0.914327 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 1, 4, 51, 8) la-vector-access-cpp 154.595 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 1, 4, 51, 50) la-vector-assignment-cpp 42.0277 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 2, 1, 8, 52) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0015 "BENCH 11.0015"
+(2014, 9, 2, 1, 9, 10) geometry-bounding_box_tree_compute_closest_entity-cpp 14.979 "Building point search tree to accelerate distance queries."
+(2014, 9, 2, 1, 9, 27) geometry-bounding_box_tree_build-cpp 14.2437 "BENCH 14.2437"
+(2014, 9, 2, 1, 9, 55) common-progress-cpp 27.917 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 2, 1, 10, 26) common-timing-cpp 31.0079 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 2, 1, 12, 1) fem-convergence-cpp 3.86938 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 2, 1, 12, 2) fem-jit-python 0.000417185 "JIT compilation (in memory cache)"
+(2014, 9, 2, 4, 28, 49) mesh-refinement-cpp 8.47656 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 2, 4, 29, 11) mesh-topology-cpp 21.4633 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 2, 4, 29, 34) mesh-unitcube-cpp 23.38 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 2, 4, 30, 12) mesh-iteration-cpp 35.5757 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 2, 4, 30, 13) function-evaluation-cpp 0.0771639 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 2, 4, 30, 18) function-extrapolation-python 5.81751 "BENCH:  2.0208530426"
+(2014, 9, 2, 4, 30, 18) function-extrapolation-python 2.02085 "BENCH:  2.0208530426"
+(2014, 9, 2, 4, 30, 21) function-interpolation-python 2.26008 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 2, 4, 30, 21) function-interpolation-python 0.913586 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 2, 4, 32, 57) la-vector-access-cpp 155.822 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 2, 4, 33, 42) la-vector-assignment-cpp 45.2544 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 3, 1, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8367 "BENCH 10.8367"
+(2014, 9, 3, 1, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3025 "Building point search tree to accelerate distance queries."
+(2014, 9, 3, 1, 9, 22) geometry-bounding_box_tree_build-cpp 14.1915 "BENCH 14.1915"
+(2014, 9, 3, 1, 9, 50) common-progress-cpp 27.8836 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 3, 1, 10, 20) common-timing-cpp 30.1277 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 3, 1, 11, 55) fem-convergence-cpp 3.88529 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 3, 1, 11, 57) fem-jit-python 0.000422812 "JIT compilation (in memory cache)"
+(2014, 9, 3, 4, 26, 13) mesh-refinement-cpp 8.47785 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 3, 4, 26, 35) mesh-topology-cpp 21.411 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 3, 4, 26, 58) mesh-unitcube-cpp 23.0924 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 3, 4, 27, 36) mesh-iteration-cpp 35.5674 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 3, 4, 27, 36) function-evaluation-cpp 0.0721509 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 3, 4, 27, 42) function-extrapolation-python 5.7285 "BENCH:  2.01886510849"
+(2014, 9, 3, 4, 27, 42) function-extrapolation-python 2.01887 "BENCH:  2.01886510849"
+(2014, 9, 3, 4, 27, 44) function-interpolation-python 2.24199 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 3, 4, 27, 44) function-interpolation-python 0.912348 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 3, 4, 30, 18) la-vector-access-cpp 154.246 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 3, 4, 31, 5) la-vector-assignment-cpp 46.0905 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 4, 1, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0112 "BENCH 11.0112"
+(2014, 9, 4, 1, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0598 "Building point search tree to accelerate distance queries."
+(2014, 9, 4, 1, 9, 16) geometry-bounding_box_tree_build-cpp 14.0399 "BENCH 14.0399"
+(2014, 9, 4, 1, 9, 44) common-progress-cpp 27.8849 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 4, 1, 10, 14) common-timing-cpp 30.5947 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 4, 1, 11, 51) fem-convergence-cpp 3.85542 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 4, 1, 11, 52) fem-jit-python 0.00042069 "JIT compilation (in memory cache)"
+(2014, 9, 4, 4, 22, 17) mesh-refinement-cpp 8.50664 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 4, 4, 22, 39) mesh-topology-cpp 21.4017 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 4, 4, 23, 2) mesh-unitcube-cpp 23.0456 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 4, 4, 23, 48) mesh-iteration-cpp 44.2171 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 4, 4, 23, 48) function-evaluation-cpp 0.0501351 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 4, 4, 23, 54) function-extrapolation-python 5.80395 "BENCH:  2.00869512558"
+(2014, 9, 4, 4, 23, 54) function-extrapolation-python 2.0087 "BENCH:  2.00869512558"
+(2014, 9, 4, 4, 23, 57) function-interpolation-python 2.25807 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 4, 4, 23, 57) function-interpolation-python 0.903686 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 4, 4, 26, 31) la-vector-access-cpp 154.298 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 4, 4, 27, 13) la-vector-assignment-cpp 42.0208 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 5, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.764 "BENCH 10.764"
+(2014, 9, 5, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2216 "Building point search tree to accelerate distance queries."
+(2014, 9, 5, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.1082 "BENCH 14.1082"
+(2014, 9, 5, 1, 9, 46) common-progress-cpp 27.8915 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 5, 1, 10, 17) common-timing-cpp 30.9337 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 5, 1, 11, 51) fem-convergence-cpp 3.85862 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 5, 1, 11, 52) fem-jit-python 0.000414109 "JIT compilation (in memory cache)"
+(2014, 9, 5, 4, 22, 23) mesh-refinement-cpp 8.46208 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 5, 4, 22, 45) mesh-topology-cpp 21.4841 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 5, 4, 23, 8) mesh-unitcube-cpp 22.9852 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 5, 4, 23, 46) mesh-iteration-cpp 36.2857 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 5, 4, 23, 46) function-evaluation-cpp 0.062017 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 5, 4, 23, 52) function-extrapolation-python 5.80298 "BENCH:  2.01900601387"
+(2014, 9, 5, 4, 23, 52) function-extrapolation-python 2.01901 "BENCH:  2.01900601387"
+(2014, 9, 5, 4, 23, 55) function-interpolation-python 2.49063 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 5, 4, 23, 55) function-interpolation-python 0.911128 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 5, 4, 26, 29) la-vector-access-cpp 154.273 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 5, 4, 27, 11) la-vector-assignment-cpp 42.0408 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 6, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8047 "BENCH 10.8047"
+(2014, 9, 6, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1886 "Building point search tree to accelerate distance queries."
+(2014, 9, 6, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.2227 "BENCH 14.2227"
+(2014, 9, 6, 1, 9, 47) common-progress-cpp 27.8941 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 6, 1, 10, 18) common-timing-cpp 31.3185 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 6, 1, 11, 53) fem-convergence-cpp 3.85491 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 6, 1, 11, 55) fem-jit-python 0.000408816 "JIT compilation (in memory cache)"
+(2014, 9, 6, 4, 31, 7) mesh-refinement-cpp 8.47211 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 6, 4, 31, 29) mesh-topology-cpp 21.5082 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 6, 4, 31, 52) mesh-unitcube-cpp 23.2232 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 6, 4, 32, 30) mesh-iteration-cpp 35.5478 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 6, 4, 32, 30) function-evaluation-cpp 0.0516791 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 6, 4, 32, 36) function-extrapolation-python 6.01284 "BENCH:  2.00429582596"
+(2014, 9, 6, 4, 32, 36) function-extrapolation-python 2.0043 "BENCH:  2.00429582596"
+(2014, 9, 6, 4, 32, 38) function-interpolation-python 2.22167 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 6, 4, 32, 38) function-interpolation-python 0.900598 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 6, 4, 35, 12) la-vector-access-cpp 153.945 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 6, 4, 35, 54) la-vector-assignment-cpp 42.0276 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 7, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8879 "BENCH 10.8879"
+(2014, 9, 7, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0942 "Building point search tree to accelerate distance queries."
+(2014, 9, 7, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.072 "BENCH 14.072"
+(2014, 9, 7, 1, 9, 46) common-progress-cpp 27.898 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 7, 1, 10, 17) common-timing-cpp 31.0605 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 7, 1, 11, 51) fem-convergence-cpp 3.84389 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 7, 1, 11, 52) fem-jit-python 0.000417495 "JIT compilation (in memory cache)"
+(2014, 9, 7, 4, 30, 50) mesh-refinement-cpp 8.46327 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 7, 4, 31, 11) mesh-topology-cpp 21.3922 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 7, 4, 31, 34) mesh-unitcube-cpp 22.9951 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 7, 4, 32, 12) mesh-iteration-cpp 35.5474 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 7, 4, 32, 13) function-evaluation-cpp 0.075016 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 7, 4, 32, 18) function-extrapolation-python 5.7426 "BENCH:  2.02323198318"
+(2014, 9, 7, 4, 32, 18) function-extrapolation-python 2.02323 "BENCH:  2.02323198318"
+(2014, 9, 7, 4, 32, 21) function-interpolation-python 2.25956 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 7, 4, 32, 21) function-interpolation-python 0.905533 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 7, 4, 34, 55) la-vector-access-cpp 154.281 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 7, 4, 35, 41) la-vector-assignment-cpp 46.0512 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 8, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9712 "BENCH 10.9712"
+(2014, 9, 8, 1, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9414 "Building point search tree to accelerate distance queries."
+(2014, 9, 8, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.1928 "BENCH 14.1928"
+(2014, 9, 8, 1, 9, 45) common-progress-cpp 27.8832 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 8, 1, 10, 17) common-timing-cpp 32.0855 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 8, 1, 11, 51) fem-convergence-cpp 3.89564 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 8, 1, 11, 52) fem-jit-python 0.000423908 "JIT compilation (in memory cache)"
+(2014, 9, 8, 4, 24, 23) mesh-refinement-cpp 8.45608 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 8, 4, 24, 45) mesh-topology-cpp 21.6336 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 8, 4, 25, 8) mesh-unitcube-cpp 23.1143 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 8, 4, 25, 46) mesh-iteration-cpp 35.5826 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 8, 4, 25, 46) function-evaluation-cpp 0.049273 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 8, 4, 25, 52) function-extrapolation-python 5.65838 "BENCH:  2.01732492447"
+(2014, 9, 8, 4, 25, 52) function-extrapolation-python 2.01732 "BENCH:  2.01732492447"
+(2014, 9, 8, 4, 25, 54) function-interpolation-python 2.23275 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 8, 4, 25, 54) function-interpolation-python 0.903293 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 8, 4, 28, 28) la-vector-access-cpp 154.207 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 8, 4, 29, 11) la-vector-assignment-cpp 42.0417 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 9, 1, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9074 "BENCH 10.9074"
+(2014, 9, 9, 1, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0337 "Building point search tree to accelerate distance queries."
+(2014, 9, 9, 1, 9, 20) geometry-bounding_box_tree_build-cpp 14.2708 "BENCH 14.2708"
+(2014, 9, 9, 1, 9, 48) common-progress-cpp 27.8971 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 9, 1, 10, 18) common-timing-cpp 29.921 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 9, 1, 11, 54) fem-convergence-cpp 3.85837 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 9, 1, 11, 55) fem-jit-python 0.000415301 "JIT compilation (in memory cache)"
+(2014, 9, 9, 4, 32, 46) mesh-refinement-cpp 8.44559 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 9, 4, 33, 7) mesh-topology-cpp 21.5361 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 9, 4, 33, 30) mesh-unitcube-cpp 23.0574 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 9, 4, 34, 11) mesh-iteration-cpp 38.5622 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 9, 4, 34, 12) function-evaluation-cpp 0.0723112 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 9, 4, 34, 17) function-extrapolation-python 5.68205 "BENCH:  2.03897309303"
+(2014, 9, 9, 4, 34, 17) function-extrapolation-python 2.03897 "BENCH:  2.03897309303"
+(2014, 9, 9, 4, 34, 20) function-interpolation-python 2.22627 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 9, 4, 34, 20) function-interpolation-python 0.905261 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 9, 4, 36, 54) la-vector-access-cpp 154.239 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 9, 4, 37, 36) la-vector-assignment-cpp 42.0299 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 10, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.087 "BENCH 11.087"
+(2014, 9, 10, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0756 "Building point search tree to accelerate distance queries."
+(2014, 9, 10, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.2406 "BENCH 14.2406"
+(2014, 9, 10, 1, 9, 46) common-progress-cpp 27.8986 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 10, 1, 10, 17) common-timing-cpp 30.6666 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 10, 1, 11, 52) fem-convergence-cpp 3.84558 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 10, 1, 11, 53) fem-jit-python 0.000425386 "JIT compilation (in memory cache)"
+(2014, 9, 10, 4, 30, 26) mesh-refinement-cpp 8.48355 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 10, 4, 30, 48) mesh-topology-cpp 21.4691 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 10, 4, 31, 11) mesh-unitcube-cpp 23.0309 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 10, 4, 31, 52) mesh-iteration-cpp 39.3577 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 10, 4, 31, 53) function-evaluation-cpp 0.0497038 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 10, 4, 31, 59) function-extrapolation-python 5.94594 "BENCH:  2.01752090454"
+(2014, 9, 10, 4, 31, 59) function-extrapolation-python 2.01752 "BENCH:  2.01752090454"
+(2014, 9, 10, 4, 32, 1) function-interpolation-python 2.27198 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 10, 4, 32, 1) function-interpolation-python 0.917033 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 10, 4, 34, 36) la-vector-access-cpp 154.723 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 10, 4, 35, 18) la-vector-assignment-cpp 42.0062 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 11, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0399 "BENCH 11.0399"
+(2014, 9, 11, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.186 "Building point search tree to accelerate distance queries."
+(2014, 9, 11, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.3375 "BENCH 14.3375"
+(2014, 9, 11, 1, 9, 46) common-progress-cpp 27.8976 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 11, 1, 10, 16) common-timing-cpp 30.7362 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 11, 1, 11, 52) fem-convergence-cpp 3.86909 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 11, 1, 11, 54) fem-jit-python 0.000418401 "JIT compilation (in memory cache)"
+(2014, 9, 11, 4, 33, 28) mesh-refinement-cpp 8.48814 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 11, 4, 33, 50) mesh-topology-cpp 21.497 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 11, 4, 34, 13) mesh-unitcube-cpp 23.1856 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 11, 4, 34, 59) mesh-iteration-cpp 43.5618 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 11, 4, 34, 59) function-evaluation-cpp 0.0638158 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 11, 4, 35, 5) function-extrapolation-python 5.85155 "BENCH:  2.01931405067"
+(2014, 9, 11, 4, 35, 5) function-extrapolation-python 2.01931 "BENCH:  2.01931405067"
+(2014, 9, 11, 4, 35, 7) function-interpolation-python 2.23355 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 11, 4, 35, 7) function-interpolation-python 0.903938 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 11, 4, 37, 42) la-vector-access-cpp 154.736 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 11, 4, 38, 24) la-vector-assignment-cpp 42.0671 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 12, 1, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8273 "BENCH 10.8273"
+(2014, 9, 12, 1, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1261 "Building point search tree to accelerate distance queries."
+(2014, 9, 12, 1, 9, 21) geometry-bounding_box_tree_build-cpp 14.2071 "BENCH 14.2071"
+(2014, 9, 12, 1, 9, 49) common-progress-cpp 27.8936 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 12, 1, 10, 20) common-timing-cpp 31.1874 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 12, 1, 11, 54) fem-convergence-cpp 3.91883 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 12, 1, 11, 55) fem-jit-python 0.000412393 "JIT compilation (in memory cache)"
+(2014, 9, 12, 4, 35, 36) mesh-refinement-cpp 8.46094 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 12, 4, 35, 58) mesh-topology-cpp 21.4469 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 12, 4, 36, 21) mesh-unitcube-cpp 23.1699 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 12, 4, 36, 59) mesh-iteration-cpp 35.5497 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 12, 4, 36, 59) function-evaluation-cpp 0.0518649 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 12, 4, 37, 5) function-extrapolation-python 5.87377 "BENCH:  2.04101991653"
+(2014, 9, 12, 4, 37, 5) function-extrapolation-python 2.04102 "BENCH:  2.04101991653"
+(2014, 9, 12, 4, 37, 7) function-interpolation-python 2.22415 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 12, 4, 37, 7) function-interpolation-python 0.90332 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 12, 4, 39, 41) la-vector-access-cpp 154.286 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 12, 4, 40, 23) la-vector-assignment-cpp 42.0293 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 13, 1, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8967 "BENCH 10.8967"
+(2014, 9, 13, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2407 "Building point search tree to accelerate distance queries."
+(2014, 9, 13, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.3111 "BENCH 14.3111"
+(2014, 9, 13, 1, 9, 47) common-progress-cpp 27.8827 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 13, 1, 10, 19) common-timing-cpp 32.1116 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 13, 1, 11, 53) fem-convergence-cpp 3.8763 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 13, 1, 11, 54) fem-jit-python 0.000419998 "JIT compilation (in memory cache)"
+(2014, 9, 13, 4, 31, 0) mesh-refinement-cpp 8.45984 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 13, 4, 31, 22) mesh-topology-cpp 21.3931 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 13, 4, 31, 45) mesh-unitcube-cpp 23.0035 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 13, 4, 32, 23) mesh-iteration-cpp 35.5684 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 13, 4, 32, 23) function-evaluation-cpp 0.070559 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 13, 4, 32, 29) function-extrapolation-python 5.71352 "BENCH:  2.0042989254"
+(2014, 9, 13, 4, 32, 29) function-extrapolation-python 2.0043 "BENCH:  2.0042989254"
+(2014, 9, 13, 4, 32, 31) function-interpolation-python 2.23088 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 13, 4, 32, 31) function-interpolation-python 0.901292 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 13, 4, 35, 5) la-vector-access-cpp 154.263 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 13, 4, 35, 47) la-vector-assignment-cpp 41.9548 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 14, 1, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.999 "BENCH 10.999"
+(2014, 9, 14, 1, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5079 "Building point search tree to accelerate distance queries."
+(2014, 9, 14, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.1384 "BENCH 14.1384"
+(2014, 9, 14, 1, 9, 47) common-progress-cpp 27.8918 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 14, 1, 10, 19) common-timing-cpp 31.4969 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 14, 1, 11, 53) fem-convergence-cpp 3.88005 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 14, 1, 11, 55) fem-jit-python 0.000421786 "JIT compilation (in memory cache)"
+(2014, 9, 14, 4, 22, 25) mesh-refinement-cpp 8.50049 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 14, 4, 22, 46) mesh-topology-cpp 21.3652 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 14, 4, 23, 10) mesh-unitcube-cpp 23.4214 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 14, 4, 23, 48) mesh-iteration-cpp 36.0728 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 14, 4, 23, 48) function-evaluation-cpp 0.064131 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 14, 4, 23, 54) function-extrapolation-python 5.73508 "BENCH:  1.99808907509"
+(2014, 9, 14, 4, 23, 54) function-extrapolation-python 1.99809 "BENCH:  1.99808907509"
+(2014, 9, 14, 4, 23, 56) function-interpolation-python 2.25231 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 14, 4, 23, 56) function-interpolation-python 0.902024 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 14, 4, 26, 32) la-vector-access-cpp 155.278 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 14, 4, 27, 14) la-vector-assignment-cpp 42.0296 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 15, 1, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.7953 "BENCH 10.7953"
+(2014, 9, 15, 1, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2086 "Building point search tree to accelerate distance queries."
+(2014, 9, 15, 1, 9, 16) geometry-bounding_box_tree_build-cpp 14.1424 "BENCH 14.1424"
+(2014, 9, 15, 1, 9, 44) common-progress-cpp 27.8856 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 15, 1, 10, 15) common-timing-cpp 31.203 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 15, 1, 11, 50) fem-convergence-cpp 3.85298 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 15, 1, 11, 51) fem-jit-python 0.000429606 "JIT compilation (in memory cache)"
+(2014, 9, 15, 4, 35, 24) mesh-refinement-cpp 8.50251 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 15, 4, 35, 45) mesh-topology-cpp 21.3698 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 15, 4, 36, 9) mesh-unitcube-cpp 23.4559 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 15, 4, 36, 47) mesh-iteration-cpp 36.0467 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 15, 4, 36, 47) function-evaluation-cpp 0.07511 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 15, 4, 36, 53) function-extrapolation-python 5.88011 "BENCH:  1.98558187485"
+(2014, 9, 15, 4, 36, 53) function-extrapolation-python 1.98558 "BENCH:  1.98558187485"
+(2014, 9, 15, 4, 36, 56) function-interpolation-python 2.24582 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 15, 4, 36, 56) function-interpolation-python 0.907002 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 15, 4, 39, 31) la-vector-access-cpp 155.798 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 15, 4, 40, 14) la-vector-assignment-cpp 42.0389 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 16, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0602 "BENCH 11.0602"
+(2014, 9, 16, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3187 "Building point search tree to accelerate distance queries."
+(2014, 9, 16, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.2834 "BENCH 14.2834"
+(2014, 9, 16, 1, 9, 47) common-progress-cpp 27.8961 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 16, 1, 10, 17) common-timing-cpp 30.8638 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 16, 1, 11, 53) fem-convergence-cpp 3.89368 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 16, 1, 11, 54) fem-jit-python 0.000425601 "JIT compilation (in memory cache)"
+(2014, 9, 16, 4, 30, 7) mesh-refinement-cpp 8.49763 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 16, 4, 30, 29) mesh-topology-cpp 21.4045 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 16, 4, 30, 53) mesh-unitcube-cpp 23.6097 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 16, 4, 31, 31) mesh-iteration-cpp 36.0477 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 16, 4, 31, 31) function-evaluation-cpp 0.053659 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 16, 4, 31, 37) function-extrapolation-python 5.71606 "BENCH:  1.99019193649"
+(2014, 9, 16, 4, 31, 37) function-extrapolation-python 1.99019 "BENCH:  1.99019193649"
+(2014, 9, 16, 4, 31, 39) function-interpolation-python 2.24231 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 16, 4, 31, 39) function-interpolation-python 0.904181 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 16, 4, 34, 15) la-vector-access-cpp 155.321 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 16, 4, 34, 57) la-vector-assignment-cpp 42.0513 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 17, 1, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9969 "BENCH 10.9969"
+(2014, 9, 17, 1, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2115 "Building point search tree to accelerate distance queries."
+(2014, 9, 17, 1, 9, 16) geometry-bounding_box_tree_build-cpp 14.0336 "BENCH 14.0336"
+(2014, 9, 17, 1, 9, 44) common-progress-cpp 27.9423 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 17, 1, 10, 15) common-timing-cpp 31.2551 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 17, 1, 11, 51) fem-convergence-cpp 3.85725 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 17, 1, 11, 52) fem-jit-python 0.000427699 "JIT compilation (in memory cache)"
+(2014, 9, 17, 4, 45, 55) mesh-refinement-cpp 8.69792 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 17, 4, 46, 17) mesh-topology-cpp 21.7025 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 17, 4, 46, 41) mesh-unitcube-cpp 23.7121 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 17, 4, 47, 22) mesh-iteration-cpp 38.7907 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 17, 4, 47, 22) function-evaluation-cpp 0.0828941 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 17, 4, 47, 28) function-extrapolation-python 5.97779 "BENCH:  2.10019922256"
+(2014, 9, 17, 4, 47, 28) function-extrapolation-python 2.1002 "BENCH:  2.10019922256"
+(2014, 9, 17, 4, 47, 31) function-interpolation-python 2.33556 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 17, 4, 47, 31) function-interpolation-python 0.942898 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 17, 4, 50, 45) la-vector-access-cpp 194.017 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 17, 4, 51, 31) la-vector-assignment-cpp 46.0424 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 18, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.101 "BENCH 11.101"
+(2014, 9, 18, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2089 "Building point search tree to accelerate distance queries."
+(2014, 9, 18, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.2114 "BENCH 14.2114"
+(2014, 9, 18, 1, 9, 46) common-progress-cpp 27.8847 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 18, 1, 10, 17) common-timing-cpp 31.1032 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 18, 1, 11, 51) fem-convergence-cpp 3.89368 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 18, 1, 11, 52) fem-jit-python 0.000413084 "JIT compilation (in memory cache)"
+(2014, 9, 18, 4, 41, 50) mesh-refinement-cpp 8.64996 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 18, 4, 42, 12) mesh-topology-cpp 21.8171 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 18, 4, 42, 37) mesh-unitcube-cpp 24.9379 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 18, 4, 43, 16) mesh-iteration-cpp 36.2505 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 18, 4, 43, 16) function-evaluation-cpp 0.089798 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 18, 4, 43, 22) function-extrapolation-python 5.71488 "BENCH:  2.1001329422"
+(2014, 9, 18, 4, 43, 22) function-extrapolation-python 2.10013 "BENCH:  2.1001329422"
+(2014, 9, 18, 4, 43, 24) function-interpolation-python 2.35624 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 18, 4, 43, 24) function-interpolation-python 0.974304 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 18, 4, 46, 1) la-vector-access-cpp 156.459 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 18, 4, 46, 43) la-vector-assignment-cpp 42.0549 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 19, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0143 "BENCH 11.0143"
+(2014, 9, 19, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0658 "Building point search tree to accelerate distance queries."
+(2014, 9, 19, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.2031 "BENCH 14.2031"
+(2014, 9, 19, 1, 9, 46) common-progress-cpp 27.8976 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 19, 1, 10, 16) common-timing-cpp 30.2126 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 19, 1, 11, 51) fem-convergence-cpp 3.91275 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 19, 1, 11, 52) fem-jit-python 0.000416279 "JIT compilation (in memory cache)"
+(2014, 9, 19, 4, 30, 3) mesh-refinement-cpp 8.49221 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 19, 4, 30, 25) mesh-topology-cpp 21.415 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 19, 4, 30, 48) mesh-unitcube-cpp 23.485 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 19, 4, 31, 29) mesh-iteration-cpp 38.5588 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 19, 4, 31, 29) function-evaluation-cpp 0.050014 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 19, 4, 31, 35) function-extrapolation-python 5.86136 "BENCH:  2.04458999634"
+(2014, 9, 19, 4, 31, 35) function-extrapolation-python 2.04459 "BENCH:  2.04458999634"
+(2014, 9, 19, 4, 31, 37) function-interpolation-python 2.25768 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 19, 4, 31, 37) function-interpolation-python 0.919307 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 19, 4, 34, 16) la-vector-access-cpp 158.013 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 19, 4, 35, 2) la-vector-assignment-cpp 46.2198 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 20, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8409 "BENCH 10.8409"
+(2014, 9, 20, 1, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0705 "Building point search tree to accelerate distance queries."
+(2014, 9, 20, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.4091 "BENCH 14.4091"
+(2014, 9, 20, 1, 9, 45) common-progress-cpp 27.8971 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 20, 1, 10, 17) common-timing-cpp 31.3716 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 20, 1, 11, 52) fem-convergence-cpp 3.88396 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 20, 1, 11, 53) fem-jit-python 0.000415111 "JIT compilation (in memory cache)"
+(2014, 9, 20, 4, 27, 53) mesh-refinement-cpp 8.55761 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 20, 4, 28, 15) mesh-topology-cpp 21.4002 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 20, 4, 28, 38) mesh-unitcube-cpp 23.459 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 20, 4, 29, 17) mesh-iteration-cpp 36.0529 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 20, 4, 29, 17) function-evaluation-cpp 0.0768311 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 20, 4, 29, 22) function-extrapolation-python 5.56265 "BENCH:  2.00479102135"
+(2014, 9, 20, 4, 29, 22) function-extrapolation-python 2.00479 "BENCH:  2.00479102135"
+(2014, 9, 20, 4, 29, 25) function-interpolation-python 2.27146 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 20, 4, 29, 25) function-interpolation-python 0.916429 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 20, 4, 32, 2) la-vector-access-cpp 156.823 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 20, 4, 32, 44) la-vector-assignment-cpp 42.0132 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 21, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9414 "BENCH 10.9414"
+(2014, 9, 21, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.348 "Building point search tree to accelerate distance queries."
+(2014, 9, 21, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.2593 "BENCH 14.2593"
+(2014, 9, 21, 1, 9, 45) common-progress-cpp 27.8775 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 21, 1, 10, 17) common-timing-cpp 31.2306 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 21, 1, 11, 53) fem-convergence-cpp 3.87029 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 21, 1, 11, 54) fem-jit-python 0.000414419 "JIT compilation (in memory cache)"
+(2014, 9, 21, 4, 26, 52) mesh-refinement-cpp 8.52229 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 21, 4, 27, 14) mesh-topology-cpp 21.4348 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 21, 4, 27, 37) mesh-unitcube-cpp 23.4083 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 21, 4, 28, 16) mesh-iteration-cpp 36.1512 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 21, 4, 28, 16) function-evaluation-cpp 0.0704591 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 21, 4, 28, 23) function-extrapolation-python 6.79436 "BENCH:  2.13737201691"
+(2014, 9, 21, 4, 28, 23) function-extrapolation-python 2.13737 "BENCH:  2.13737201691"
+(2014, 9, 21, 4, 28, 25) function-interpolation-python 2.36722 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 21, 4, 28, 25) function-interpolation-python 0.974815 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 21, 4, 31, 4) la-vector-access-cpp 158.909 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 21, 4, 31, 46) la-vector-assignment-cpp 42.0413 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 22, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.951 "BENCH 10.951"
+(2014, 9, 22, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2064 "Building point search tree to accelerate distance queries."
+(2014, 9, 22, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.2948 "BENCH 14.2948"
+(2014, 9, 22, 1, 9, 46) common-progress-cpp 27.8922 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 22, 1, 10, 17) common-timing-cpp 30.7481 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 22, 1, 11, 53) fem-convergence-cpp 3.93826 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 22, 1, 11, 55) fem-jit-python 0.000423789 "JIT compilation (in memory cache)"
+(2014, 9, 22, 4, 26, 55) mesh-refinement-cpp 8.54175 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 22, 4, 27, 17) mesh-topology-cpp 21.346 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 22, 4, 27, 41) mesh-unitcube-cpp 23.4687 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 22, 4, 28, 19) mesh-iteration-cpp 36.0898 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 22, 4, 28, 19) function-evaluation-cpp 0.0639369 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 22, 4, 28, 25) function-extrapolation-python 5.77948 "BENCH:  1.9955329895"
+(2014, 9, 22, 4, 28, 25) function-extrapolation-python 1.99553 "BENCH:  1.9955329895"
+(2014, 9, 22, 4, 28, 27) function-interpolation-python 2.25586 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 22, 4, 28, 27) function-interpolation-python 0.917332 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 22, 4, 31, 3) la-vector-access-cpp 155.302 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 22, 4, 31, 45) la-vector-assignment-cpp 42.0406 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 23, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8492 "BENCH 10.8492"
+(2014, 9, 23, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1892 "Building point search tree to accelerate distance queries."
+(2014, 9, 23, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.1414 "BENCH 14.1414"
+(2014, 9, 23, 1, 9, 46) common-progress-cpp 27.8846 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 23, 1, 10, 17) common-timing-cpp 31.7835 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 23, 1, 11, 52) fem-convergence-cpp 3.8623 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 23, 1, 11, 53) fem-jit-python 0.00042212 "JIT compilation (in memory cache)"
+(2014, 9, 23, 4, 28, 13) mesh-refinement-cpp 8.50321 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 23, 4, 28, 35) mesh-topology-cpp 21.3576 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 23, 4, 28, 58) mesh-unitcube-cpp 23.4227 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 23, 4, 29, 36) mesh-iteration-cpp 35.528 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 23, 4, 29, 36) function-evaluation-cpp 0.0537109 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 23, 4, 29, 42) function-extrapolation-python 5.93524 "BENCH:  2.01120114326"
+(2014, 9, 23, 4, 29, 42) function-extrapolation-python 2.0112 "BENCH:  2.01120114326"
+(2014, 9, 23, 4, 29, 44) function-interpolation-python 2.23306 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 23, 4, 29, 44) function-interpolation-python 0.894264 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 23, 4, 32, 19) la-vector-access-cpp 154.302 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 23, 4, 33, 1) la-vector-assignment-cpp 42.0595 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 24, 1, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1491 "BENCH 11.1491"
+(2014, 9, 24, 1, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2092 "Building point search tree to accelerate distance queries."
+(2014, 9, 24, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.3528 "BENCH 14.3528"
+(2014, 9, 24, 1, 9, 47) common-progress-cpp 27.9283 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 24, 1, 10, 19) common-timing-cpp 31.217 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 24, 1, 11, 53) fem-convergence-cpp 3.88184 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 24, 1, 11, 54) fem-jit-python 0.000418901 "JIT compilation (in memory cache)"
+(2014, 9, 24, 4, 30, 21) mesh-refinement-cpp 8.49878 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 24, 4, 30, 43) mesh-topology-cpp 21.5534 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 24, 4, 31, 6) mesh-unitcube-cpp 23.3418 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 24, 4, 31, 44) mesh-iteration-cpp 35.588 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 24, 4, 31, 45) function-evaluation-cpp 0.049747 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 24, 4, 31, 51) function-extrapolation-python 5.96101 "BENCH:  2.00972104073"
+(2014, 9, 24, 4, 31, 51) function-extrapolation-python 2.00972 "BENCH:  2.00972104073"
+(2014, 9, 24, 4, 31, 53) function-interpolation-python 2.23352 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 24, 4, 31, 53) function-interpolation-python 0.894531 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 24, 4, 34, 27) la-vector-access-cpp 154.268 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 24, 4, 35, 9) la-vector-assignment-cpp 42.0282 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 25, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.7908 "BENCH 10.7908"
+(2014, 9, 25, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1314 "Building point search tree to accelerate distance queries."
+(2014, 9, 25, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.2859 "BENCH 14.2859"
+(2014, 9, 25, 1, 9, 45) common-progress-cpp 27.883 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 25, 1, 10, 17) common-timing-cpp 31.3564 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 25, 1, 11, 52) fem-convergence-cpp 3.88491 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 25, 1, 11, 53) fem-jit-python 0.00042181 "JIT compilation (in memory cache)"
+(2014, 9, 25, 4, 25, 21) mesh-refinement-cpp 8.50017 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 25, 4, 25, 42) mesh-topology-cpp 21.4533 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 25, 4, 26, 6) mesh-unitcube-cpp 23.3197 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 25, 4, 26, 47) mesh-iteration-cpp 38.5635 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 25, 4, 26, 47) function-evaluation-cpp 0.0521839 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 25, 4, 26, 52) function-extrapolation-python 5.54495 "BENCH:  2.0075750351"
+(2014, 9, 25, 4, 26, 52) function-extrapolation-python 2.00758 "BENCH:  2.0075750351"
+(2014, 9, 25, 4, 26, 54) function-interpolation-python 2.22203 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 25, 4, 26, 54) function-interpolation-python 0.892605 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 25, 4, 29, 29) la-vector-access-cpp 154.291 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 25, 4, 30, 15) la-vector-assignment-cpp 45.9802 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 26, 1, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9056 "BENCH 10.9056"
+(2014, 9, 26, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1094 "Building point search tree to accelerate distance queries."
+(2014, 9, 26, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.3074 "BENCH 14.3074"
+(2014, 9, 26, 1, 9, 47) common-progress-cpp 27.8892 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 26, 1, 10, 18) common-timing-cpp 31.0198 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 26, 1, 11, 52) fem-convergence-cpp 3.86583 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 26, 1, 11, 53) fem-jit-python 0.000421906 "JIT compilation (in memory cache)"
+(2014, 9, 26, 4, 39, 22) mesh-refinement-cpp 8.81858 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 26, 4, 39, 44) mesh-topology-cpp 21.718 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 26, 4, 40, 8) mesh-unitcube-cpp 23.5064 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 26, 4, 40, 46) mesh-iteration-cpp 35.7745 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 26, 4, 40, 46) function-evaluation-cpp 0.0752182 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 26, 4, 40, 52) function-extrapolation-python 5.77899 "BENCH:  2.06900191307"
+(2014, 9, 26, 4, 40, 52) function-extrapolation-python 2.069 "BENCH:  2.06900191307"
+(2014, 9, 26, 4, 40, 54) function-interpolation-python 2.34204 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 26, 4, 40, 54) function-interpolation-python 0.915697 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 26, 4, 43, 30) la-vector-access-cpp 155.617 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 26, 4, 44, 12) la-vector-assignment-cpp 42.0274 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 27, 1, 8, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8425 "BENCH 10.8425"
+(2014, 9, 27, 1, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2715 "Building point search tree to accelerate distance queries."
+(2014, 9, 27, 1, 9, 16) geometry-bounding_box_tree_build-cpp 14.0672 "BENCH 14.0672"
+(2014, 9, 27, 1, 9, 47) common-progress-cpp 31.6567 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 27, 1, 10, 19) common-timing-cpp 31.3865 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 27, 1, 11, 54) fem-convergence-cpp 3.90212 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 27, 1, 11, 55) fem-jit-python 0.000434899 "JIT compilation (in memory cache)"
+(2014, 9, 27, 4, 30, 12) mesh-refinement-cpp 8.51362 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 27, 4, 30, 34) mesh-topology-cpp 21.4867 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 27, 4, 30, 58) mesh-unitcube-cpp 23.3 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 27, 4, 31, 39) mesh-iteration-cpp 39.1668 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 27, 4, 31, 39) function-evaluation-cpp 0.0582652 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 27, 4, 31, 45) function-extrapolation-python 5.73513 "BENCH:  2.00963401794"
+(2014, 9, 27, 4, 31, 45) function-extrapolation-python 2.00963 "BENCH:  2.00963401794"
+(2014, 9, 27, 4, 31, 47) function-interpolation-python 2.25838 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 27, 4, 31, 47) function-interpolation-python 0.894807 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 27, 4, 34, 22) la-vector-access-cpp 154.152 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 27, 4, 35, 4) la-vector-assignment-cpp 41.9971 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 28, 1, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0839 "BENCH 11.0839"
+(2014, 9, 28, 1, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3657 "Building point search tree to accelerate distance queries."
+(2014, 9, 28, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.3299 "BENCH 14.3299"
+(2014, 9, 28, 1, 9, 45) common-progress-cpp 27.8965 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 28, 1, 10, 16) common-timing-cpp 31.3245 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 28, 1, 11, 51) fem-convergence-cpp 3.83967 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 28, 1, 11, 52) fem-jit-python 0.000418496 "JIT compilation (in memory cache)"
+(2014, 9, 28, 4, 28, 26) mesh-refinement-cpp 8.51343 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 28, 4, 28, 48) mesh-topology-cpp 21.3599 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 28, 4, 29, 11) mesh-unitcube-cpp 23.2552 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 28, 4, 29, 49) mesh-iteration-cpp 35.5422 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 28, 4, 29, 49) function-evaluation-cpp 0.0555959 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 28, 4, 29, 55) function-extrapolation-python 5.91994 "BENCH:  2.01455712318"
+(2014, 9, 28, 4, 29, 55) function-extrapolation-python 2.01456 "BENCH:  2.01455712318"
+(2014, 9, 28, 4, 29, 57) function-interpolation-python 2.22802 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 28, 4, 29, 57) function-interpolation-python 0.897801 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 28, 4, 32, 33) la-vector-access-cpp 156.169 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 28, 4, 33, 16) la-vector-assignment-cpp 42.0193 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 29, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0543 "BENCH 11.0543"
+(2014, 9, 29, 1, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.099 "Building point search tree to accelerate distance queries."
+(2014, 9, 29, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.2272 "BENCH 14.2272"
+(2014, 9, 29, 1, 9, 45) common-progress-cpp 27.8845 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 29, 1, 10, 16) common-timing-cpp 30.8714 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 29, 1, 11, 50) fem-convergence-cpp 3.89073 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 29, 1, 11, 52) fem-jit-python 0.000421691 "JIT compilation (in memory cache)"
+(2014, 9, 29, 4, 26, 47) mesh-refinement-cpp 8.49733 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 29, 4, 27, 9) mesh-topology-cpp 21.5463 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 29, 4, 27, 32) mesh-unitcube-cpp 23.2916 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 29, 4, 28, 13) mesh-iteration-cpp 38.5636 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 29, 4, 28, 13) function-evaluation-cpp 0.076966 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 29, 4, 28, 19) function-extrapolation-python 5.60594 "BENCH:  1.99918317795"
+(2014, 9, 29, 4, 28, 19) function-extrapolation-python 1.99918 "BENCH:  1.99918317795"
+(2014, 9, 29, 4, 28, 21) function-interpolation-python 2.23976 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 29, 4, 28, 21) function-interpolation-python 0.901228 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 29, 4, 30, 56) la-vector-access-cpp 155.194 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 29, 4, 31, 38) la-vector-assignment-cpp 42.0154 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 9, 30, 1, 8, 48) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0721 "BENCH 11.0721"
+(2014, 9, 30, 1, 9, 7) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1258 "Building point search tree to accelerate distance queries."
+(2014, 9, 30, 1, 9, 24) geometry-bounding_box_tree_build-cpp 14.3291 "BENCH 14.3291"
+(2014, 9, 30, 1, 9, 52) common-progress-cpp 27.9029 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 9, 30, 1, 10, 23) common-timing-cpp 31.4779 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 9, 30, 1, 11, 57) fem-convergence-cpp 3.87395 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 9, 30, 1, 11, 58) fem-jit-python 0.000417209 "JIT compilation (in memory cache)"
+(2014, 9, 30, 4, 38, 4) mesh-refinement-cpp 8.67036 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 9, 30, 4, 38, 26) mesh-topology-cpp 21.6809 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 9, 30, 4, 38, 50) mesh-unitcube-cpp 23.5122 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 9, 30, 4, 39, 31) mesh-iteration-cpp 38.8064 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 9, 30, 4, 39, 31) function-evaluation-cpp 0.0811729 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 9, 30, 4, 39, 37) function-extrapolation-python 5.61372 "BENCH:  2.05579996109"
+(2014, 9, 30, 4, 39, 37) function-extrapolation-python 2.0558 "BENCH:  2.05579996109"
+(2014, 9, 30, 4, 39, 39) function-interpolation-python 2.30629 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 30, 4, 39, 39) function-interpolation-python 0.9172 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 9, 30, 4, 42, 14) la-vector-access-cpp 154.508 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 9, 30, 4, 42, 57) la-vector-assignment-cpp 43.4938 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 1, 1, 8, 50) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8781 "BENCH 10.8781"
+(2014, 10, 1, 1, 9, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2013 "Building point search tree to accelerate distance queries."
+(2014, 10, 1, 1, 9, 25) geometry-bounding_box_tree_build-cpp 14.3034 "BENCH 14.3034"
+(2014, 10, 1, 1, 9, 53) common-progress-cpp 27.8803 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 1, 1, 10, 24) common-timing-cpp 31.088 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 1, 1, 11, 59) fem-convergence-cpp 3.8645 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 1, 1, 12, 0) fem-jit-python 0.000415301 "JIT compilation (in memory cache)"
+(2014, 10, 1, 4, 27, 35) mesh-refinement-cpp 8.49695 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 1, 4, 27, 56) mesh-topology-cpp 21.4234 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 1, 4, 28, 19) mesh-unitcube-cpp 23.3324 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 1, 4, 29, 0) mesh-iteration-cpp 38.5604 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 1, 4, 29, 1) function-evaluation-cpp 0.0557079 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 1, 4, 29, 6) function-extrapolation-python 5.75855 "BENCH:  2.00493192673"
+(2014, 10, 1, 4, 29, 6) function-extrapolation-python 2.00493 "BENCH:  2.00493192673"
+(2014, 10, 1, 4, 29, 9) function-interpolation-python 2.23496 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 1, 4, 29, 9) function-interpolation-python 0.895412 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 1, 4, 31, 44) la-vector-access-cpp 155.219 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 1, 4, 32, 26) la-vector-assignment-cpp 42.0296 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 2, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1719 "BENCH 11.1719"
+(2014, 10, 2, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.155 "Building point search tree to accelerate distance queries."
+(2014, 10, 2, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.3138 "BENCH 14.3138"
+(2014, 10, 2, 1, 9, 46) common-progress-cpp 27.89 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 2, 1, 10, 17) common-timing-cpp 31.186 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 2, 1, 11, 52) fem-convergence-cpp 3.91019 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 2, 1, 11, 53) fem-jit-python 0.000414896 "JIT compilation (in memory cache)"
+(2014, 10, 2, 4, 26, 34) mesh-refinement-cpp 8.48326 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 2, 4, 26, 55) mesh-topology-cpp 21.384 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 2, 4, 27, 19) mesh-unitcube-cpp 23.5556 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 2, 4, 28, 0) mesh-iteration-cpp 39.1712 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 2, 4, 28, 0) function-evaluation-cpp 0.0510559 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 2, 4, 28, 6) function-extrapolation-python 5.67373 "BENCH:  2.01869916916"
+(2014, 10, 2, 4, 28, 6) function-extrapolation-python 2.0187 "BENCH:  2.01869916916"
+(2014, 10, 2, 4, 28, 8) function-interpolation-python 2.23501 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 2, 4, 28, 8) function-interpolation-python 0.896465 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 2, 4, 30, 43) la-vector-access-cpp 154.184 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 2, 4, 31, 25) la-vector-assignment-cpp 41.9595 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 3, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9665 "BENCH 10.9665"
+(2014, 10, 3, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1822 "Building point search tree to accelerate distance queries."
+(2014, 10, 3, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.3665 "BENCH 14.3665"
+(2014, 10, 3, 1, 9, 50) common-progress-cpp 31.656 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 3, 1, 10, 21) common-timing-cpp 31.0636 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 3, 1, 11, 55) fem-convergence-cpp 3.87488 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 3, 1, 11, 57) fem-jit-python 0.000423121 "JIT compilation (in memory cache)"
+(2014, 10, 3, 4, 32, 16) mesh-refinement-cpp 8.52139 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 3, 4, 32, 37) mesh-topology-cpp 21.3468 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 3, 4, 33, 0) mesh-unitcube-cpp 23.0375 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 3, 4, 33, 41) mesh-iteration-cpp 38.5625 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 3, 4, 33, 42) function-evaluation-cpp 0.055589 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 3, 4, 33, 47) function-extrapolation-python 5.70589 "BENCH:  2.01905012131"
+(2014, 10, 3, 4, 33, 47) function-extrapolation-python 2.01905 "BENCH:  2.01905012131"
+(2014, 10, 3, 4, 33, 50) function-interpolation-python 2.22781 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 3, 4, 33, 50) function-interpolation-python 0.897971 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 3, 4, 36, 24) la-vector-access-cpp 154.236 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 3, 4, 37, 6) la-vector-assignment-cpp 42.0846 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 4, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.893 "BENCH 10.893"
+(2014, 10, 4, 1, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1858 "Building point search tree to accelerate distance queries."
+(2014, 10, 4, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.4122 "BENCH 14.4122"
+(2014, 10, 4, 1, 9, 45) common-progress-cpp 27.8866 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 4, 1, 10, 16) common-timing-cpp 31.0169 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 4, 1, 11, 50) fem-convergence-cpp 3.93432 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 4, 1, 11, 51) fem-jit-python 0.000430393 "JIT compilation (in memory cache)"
+(2014, 10, 4, 4, 25, 37) mesh-refinement-cpp 8.48516 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 4, 4, 25, 59) mesh-topology-cpp 21.3893 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 4, 4, 26, 22) mesh-unitcube-cpp 23.0891 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 4, 4, 27, 0) mesh-iteration-cpp 35.5529 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 4, 4, 27, 0) function-evaluation-cpp 0.053648 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 4, 4, 27, 6) function-extrapolation-python 5.93343 "BENCH:  2.01114201546"
+(2014, 10, 4, 4, 27, 6) function-extrapolation-python 2.01114 "BENCH:  2.01114201546"
+(2014, 10, 4, 4, 27, 9) function-interpolation-python 2.59183 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 4, 4, 27, 9) function-interpolation-python 0.916569 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 4, 4, 29, 44) la-vector-access-cpp 155.226 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 4, 4, 30, 26) la-vector-assignment-cpp 42.0174 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 5, 1, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9155 "BENCH 10.9155"
+(2014, 10, 5, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0557 "Building point search tree to accelerate distance queries."
+(2014, 10, 5, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.2879 "BENCH 14.2879"
+(2014, 10, 5, 1, 9, 47) common-progress-cpp 27.8931 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 5, 1, 10, 18) common-timing-cpp 31.15 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 5, 1, 11, 52) fem-convergence-cpp 3.8545 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 5, 1, 11, 53) fem-jit-python 0.000417304 "JIT compilation (in memory cache)"
+(2014, 10, 5, 4, 40, 46) mesh-refinement-cpp 8.60625 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 5, 4, 41, 8) mesh-topology-cpp 21.6281 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 5, 4, 41, 31) mesh-unitcube-cpp 23.3003 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 5, 4, 42, 12) mesh-iteration-cpp 38.8076 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 5, 4, 42, 12) function-evaluation-cpp 0.101288 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 5, 4, 42, 18) function-extrapolation-python 5.82829 "BENCH:  2.0464630127"
+(2014, 10, 5, 4, 42, 18) function-extrapolation-python 2.04646 "BENCH:  2.0464630127"
+(2014, 10, 5, 4, 42, 20) function-interpolation-python 2.28717 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 5, 4, 42, 20) function-interpolation-python 0.912151 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 5, 4, 44, 55) la-vector-access-cpp 154.576 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 5, 4, 45, 41) la-vector-assignment-cpp 46.0407 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 6, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0669 "BENCH 11.0669"
+(2014, 10, 6, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1671 "Building point search tree to accelerate distance queries."
+(2014, 10, 6, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.3451 "BENCH 14.3451"
+(2014, 10, 6, 1, 9, 46) common-progress-cpp 27.9049 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 6, 1, 10, 18) common-timing-cpp 31.1473 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 6, 1, 11, 53) fem-convergence-cpp 3.92093 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 6, 1, 11, 54) fem-jit-python 0.000416183 "JIT compilation (in memory cache)"
+(2014, 10, 6, 4, 47, 16) mesh-refinement-cpp 8.62842 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 6, 4, 47, 39) mesh-topology-cpp 22.2265 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 6, 4, 48, 2) mesh-unitcube-cpp 23.3149 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 6, 4, 48, 40) mesh-iteration-cpp 35.7799 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 6, 4, 48, 40) function-evaluation-cpp 0.0833149 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 6, 4, 48, 46) function-extrapolation-python 5.9871 "BENCH:  2.08976006508"
+(2014, 10, 6, 4, 48, 46) function-extrapolation-python 2.08976 "BENCH:  2.08976006508"
+(2014, 10, 6, 4, 48, 49) function-interpolation-python 2.31442 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 6, 4, 48, 49) function-interpolation-python 0.920124 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 6, 4, 51, 23) la-vector-access-cpp 154.605 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 6, 4, 52, 5) la-vector-assignment-cpp 42.033 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 7, 1, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9612 "BENCH 10.9612"
+(2014, 10, 7, 1, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1082 "Building point search tree to accelerate distance queries."
+(2014, 10, 7, 1, 9, 21) geometry-bounding_box_tree_build-cpp 14.0918 "BENCH 14.0918"
+(2014, 10, 7, 1, 9, 49) common-progress-cpp 27.961 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 7, 1, 10, 21) common-timing-cpp 31.1998 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 7, 1, 11, 56) fem-convergence-cpp 3.93426 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 7, 1, 11, 57) fem-jit-python 0.000424695 "JIT compilation (in memory cache)"
+(2014, 10, 7, 4, 12, 54) mesh-refinement-cpp 8.47257 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 7, 4, 13, 16) mesh-topology-cpp 21.3798 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 7, 4, 13, 39) mesh-unitcube-cpp 23.114 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 7, 4, 14, 17) mesh-iteration-cpp 35.5535 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 7, 4, 14, 17) function-evaluation-cpp 0.0519001 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 7, 4, 14, 23) function-extrapolation-python 5.61906 "BENCH:  2.01215291023"
+(2014, 10, 7, 4, 14, 23) function-extrapolation-python 2.01215 "BENCH:  2.01215291023"
+(2014, 10, 7, 4, 14, 25) function-interpolation-python 2.20827 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 7, 4, 14, 25) function-interpolation-python 0.886221 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 7, 4, 16, 59) la-vector-access-cpp 154.18 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 7, 4, 17, 42) la-vector-assignment-cpp 42.0608 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 8, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9253 "BENCH 10.9253"
+(2014, 10, 8, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1144 "Building point search tree to accelerate distance queries."
+(2014, 10, 8, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.169 "BENCH 14.169"
+(2014, 10, 8, 1, 9, 47) common-progress-cpp 27.8872 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 8, 1, 10, 18) common-timing-cpp 31.0389 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 8, 1, 11, 52) fem-convergence-cpp 3.85443 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 8, 1, 11, 54) fem-jit-python 0.000423217 "JIT compilation (in memory cache)"
+(2014, 10, 8, 4, 24, 24) mesh-refinement-cpp 8.4788 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 8, 4, 24, 46) mesh-topology-cpp 21.5302 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 8, 4, 25, 9) mesh-unitcube-cpp 23.093 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 8, 4, 25, 50) mesh-iteration-cpp 38.5634 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 8, 4, 25, 50) function-evaluation-cpp 0.052043 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 8, 4, 25, 56) function-extrapolation-python 5.69608 "BENCH:  1.98846483231"
+(2014, 10, 8, 4, 25, 56) function-extrapolation-python 1.98846 "BENCH:  1.98846483231"
+(2014, 10, 8, 4, 25, 58) function-interpolation-python 2.21073 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 8, 4, 25, 58) function-interpolation-python 0.88885 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 8, 4, 28, 32) la-vector-access-cpp 154.193 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 8, 4, 29, 15) la-vector-assignment-cpp 42.0177 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 9, 1, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9985 "BENCH 10.9985"
+(2014, 10, 9, 1, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9919 "Building point search tree to accelerate distance queries."
+(2014, 10, 9, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.3308 "BENCH 14.3308"
+(2014, 10, 9, 1, 9, 47) common-progress-cpp 27.8888 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 9, 1, 10, 18) common-timing-cpp 31.0812 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 9, 1, 11, 53) fem-convergence-cpp 3.88196 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 9, 1, 11, 54) fem-jit-python 0.000424194 "JIT compilation (in memory cache)"
+(2014, 10, 9, 4, 37, 30) mesh-refinement-cpp 8.46553 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 9, 4, 37, 51) mesh-topology-cpp 21.469 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 9, 4, 38, 14) mesh-unitcube-cpp 23.0453 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 9, 4, 38, 52) mesh-iteration-cpp 35.5717 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 9, 4, 38, 53) function-evaluation-cpp 0.0513761 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 9, 4, 38, 58) function-extrapolation-python 5.7404 "BENCH:  2.00910282135"
+(2014, 10, 9, 4, 38, 58) function-extrapolation-python 2.0091 "BENCH:  2.00910282135"
+(2014, 10, 9, 4, 39, 1) function-interpolation-python 2.22021 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 9, 4, 39, 1) function-interpolation-python 0.890134 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 9, 4, 41, 35) la-vector-access-cpp 154.183 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 9, 4, 42, 17) la-vector-assignment-cpp 42.0269 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 10, 1, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1485 "BENCH 11.1485"
+(2014, 10, 10, 1, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2242 "Building point search tree to accelerate distance queries."
+(2014, 10, 10, 1, 9, 20) geometry-bounding_box_tree_build-cpp 14.4198 "BENCH 14.4198"
+(2014, 10, 10, 1, 9, 48) common-progress-cpp 27.9462 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 10, 1, 10, 19) common-timing-cpp 31.2092 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 10, 1, 11, 55) fem-convergence-cpp 3.98971 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 10, 1, 11, 56) fem-jit-python 0.000413895 "JIT compilation (in memory cache)"
+(2014, 10, 10, 4, 34, 21) mesh-refinement-cpp 8.63973 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 10, 4, 34, 43) mesh-topology-cpp 21.7594 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 10, 4, 35, 8) mesh-unitcube-cpp 24.1944 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 10, 4, 35, 48) mesh-iteration-cpp 36.9437 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 10, 4, 35, 48) function-evaluation-cpp 0.0942171 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 10, 4, 35, 53) function-extrapolation-python 5.71667 "BENCH:  2.08676409721"
+(2014, 10, 10, 4, 35, 53) function-extrapolation-python 2.08676 "BENCH:  2.08676409721"
+(2014, 10, 10, 4, 35, 56) function-interpolation-python 2.31748 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 10, 4, 35, 56) function-interpolation-python 0.924802 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 10, 4, 38, 32) la-vector-access-cpp 156.261 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 10, 4, 39, 18) la-vector-assignment-cpp 46.045 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 11, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0916 "BENCH 11.0916"
+(2014, 10, 11, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2207 "Building point search tree to accelerate distance queries."
+(2014, 10, 11, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.3936 "BENCH 14.3936"
+(2014, 10, 11, 1, 9, 46) common-progress-cpp 27.8975 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 11, 1, 10, 17) common-timing-cpp 31.4182 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 11, 1, 11, 52) fem-convergence-cpp 3.92906 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 11, 1, 11, 54) fem-jit-python 0.000420594 "JIT compilation (in memory cache)"
+(2014, 10, 11, 4, 36, 22) mesh-refinement-cpp 8.47047 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 11, 4, 36, 44) mesh-topology-cpp 21.365 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 11, 4, 37, 7) mesh-unitcube-cpp 23.0508 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 11, 4, 37, 45) mesh-iteration-cpp 35.5549 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 11, 4, 37, 45) function-evaluation-cpp 0.0501201 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 11, 4, 37, 51) function-extrapolation-python 5.95774 "BENCH:  2.06594109535"
+(2014, 10, 11, 4, 37, 51) function-extrapolation-python 2.06594 "BENCH:  2.06594109535"
+(2014, 10, 11, 4, 37, 53) function-interpolation-python 2.22619 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 11, 4, 37, 53) function-interpolation-python 0.887264 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 11, 4, 40, 29) la-vector-access-cpp 155.543 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 11, 4, 41, 11) la-vector-assignment-cpp 42.0037 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 12, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.932 "BENCH 10.932"
+(2014, 10, 12, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2913 "Building point search tree to accelerate distance queries."
+(2014, 10, 12, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.2362 "BENCH 14.2362"
+(2014, 10, 12, 1, 9, 47) common-progress-cpp 27.891 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 12, 1, 10, 18) common-timing-cpp 31.199 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 12, 1, 11, 53) fem-convergence-cpp 3.90146 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 12, 1, 11, 54) fem-jit-python 0.000422001 "JIT compilation (in memory cache)"
+(2014, 10, 12, 4, 33, 49) mesh-refinement-cpp 8.4891 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 12, 4, 34, 10) mesh-topology-cpp 21.4451 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 12, 4, 34, 33) mesh-unitcube-cpp 23.0461 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 12, 4, 35, 11) mesh-iteration-cpp 35.544 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 12, 4, 35, 12) function-evaluation-cpp 0.070313 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 12, 4, 35, 17) function-extrapolation-python 5.68862 "BENCH:  2.00841999054"
+(2014, 10, 12, 4, 35, 17) function-extrapolation-python 2.00842 "BENCH:  2.00841999054"
+(2014, 10, 12, 4, 35, 19) function-interpolation-python 2.224 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 12, 4, 35, 19) function-interpolation-python 0.893331 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 12, 4, 37, 54) la-vector-access-cpp 154.209 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 12, 4, 38, 36) la-vector-assignment-cpp 41.9819 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 13, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.125 "BENCH 11.125"
+(2014, 10, 13, 1, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2195 "Building point search tree to accelerate distance queries."
+(2014, 10, 13, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.1867 "BENCH 14.1867"
+(2014, 10, 13, 1, 9, 45) common-progress-cpp 27.8875 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 13, 1, 10, 16) common-timing-cpp 31.0396 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 13, 1, 11, 50) fem-convergence-cpp 3.92416 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 13, 1, 11, 51) fem-jit-python 0.00041759 "JIT compilation (in memory cache)"
+(2014, 10, 13, 4, 28, 9) mesh-refinement-cpp 8.65918 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 13, 4, 28, 32) mesh-topology-cpp 22.2379 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 13, 4, 28, 55) mesh-unitcube-cpp 23.3666 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 13, 4, 29, 33) mesh-iteration-cpp 35.7702 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 13, 4, 29, 34) function-evaluation-cpp 0.0925412 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 13, 4, 29, 40) function-extrapolation-python 5.95963 "BENCH:  2.04638409615"
+(2014, 10, 13, 4, 29, 40) function-extrapolation-python 2.04638 "BENCH:  2.04638409615"
+(2014, 10, 13, 4, 29, 42) function-interpolation-python 2.29892 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 13, 4, 29, 42) function-interpolation-python 0.914397 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 13, 4, 32, 16) la-vector-access-cpp 154.581 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 13, 4, 32, 59) la-vector-assignment-cpp 42.0291 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 14, 1, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8625 "BENCH 10.8625"
+(2014, 10, 14, 1, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2436 "Building point search tree to accelerate distance queries."
+(2014, 10, 14, 1, 9, 20) geometry-bounding_box_tree_build-cpp 14.0115 "BENCH 14.0115"
+(2014, 10, 14, 1, 9, 48) common-progress-cpp 27.9409 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 14, 1, 10, 19) common-timing-cpp 31.037 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 14, 1, 11, 52) fem-convergence-cpp 3.89751 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 14, 1, 11, 53) fem-jit-python 0.000419092 "JIT compilation (in memory cache)"
+(2014, 10, 14, 4, 35, 26) mesh-refinement-cpp 8.47226 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 14, 4, 35, 48) mesh-topology-cpp 21.3715 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 14, 4, 36, 11) mesh-unitcube-cpp 23.1417 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 14, 4, 36, 49) mesh-iteration-cpp 35.5484 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 14, 4, 36, 49) function-evaluation-cpp 0.0518708 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 14, 4, 36, 55) function-extrapolation-python 5.76596 "BENCH:  2.00197720528"
+(2014, 10, 14, 4, 36, 55) function-extrapolation-python 2.00198 "BENCH:  2.00197720528"
+(2014, 10, 14, 4, 36, 57) function-interpolation-python 2.23528 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 14, 4, 36, 57) function-interpolation-python 0.888572 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 14, 4, 39, 32) la-vector-access-cpp 155.036 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 14, 4, 40, 14) la-vector-assignment-cpp 42.0827 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 15, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9191 "BENCH 10.9191"
+(2014, 10, 15, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2391 "Building point search tree to accelerate distance queries."
+(2014, 10, 15, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.2395 "BENCH 14.2395"
+(2014, 10, 15, 1, 9, 45) common-progress-cpp 27.8935 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 15, 1, 10, 17) common-timing-cpp 31.2458 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 15, 1, 11, 51) fem-convergence-cpp 3.87559 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 15, 1, 11, 52) fem-jit-python 0.000420189 "JIT compilation (in memory cache)"
+(2014, 10, 15, 4, 30, 33) mesh-refinement-cpp 8.46886 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 15, 4, 30, 55) mesh-topology-cpp 21.517 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 15, 4, 31, 18) mesh-unitcube-cpp 23.0825 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 15, 4, 31, 56) mesh-iteration-cpp 35.5596 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 15, 4, 31, 56) function-evaluation-cpp 0.0762911 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 15, 4, 32, 2) function-extrapolation-python 5.85747 "BENCH:  1.98217606544"
+(2014, 10, 15, 4, 32, 2) function-extrapolation-python 1.98218 "BENCH:  1.98217606544"
+(2014, 10, 15, 4, 32, 4) function-interpolation-python 2.21926 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 15, 4, 32, 4) function-interpolation-python 0.888716 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 15, 4, 34, 38) la-vector-access-cpp 154.229 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 15, 4, 35, 24) la-vector-assignment-cpp 46.0459 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 16, 1, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0624 "BENCH 11.0624"
+(2014, 10, 16, 1, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9969 "Building point search tree to accelerate distance queries."
+(2014, 10, 16, 1, 9, 20) geometry-bounding_box_tree_build-cpp 14.3147 "BENCH 14.3147"
+(2014, 10, 16, 1, 9, 48) common-progress-cpp 27.8836 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 16, 1, 10, 18) common-timing-cpp 30.6228 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 16, 1, 11, 53) fem-convergence-cpp 3.89952 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 16, 1, 11, 55) fem-jit-python 0.00043571 "JIT compilation (in memory cache)"
+(2014, 10, 16, 4, 27, 5) mesh-refinement-cpp 8.49134 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 16, 4, 27, 27) mesh-topology-cpp 21.4104 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 16, 4, 27, 50) mesh-unitcube-cpp 23.1098 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 16, 4, 28, 28) mesh-iteration-cpp 35.5425 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 16, 4, 28, 28) function-evaluation-cpp 0.053473 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 16, 4, 28, 34) function-extrapolation-python 5.72271 "BENCH:  2.00569415092"
+(2014, 10, 16, 4, 28, 34) function-extrapolation-python 2.00569 "BENCH:  2.00569415092"
+(2014, 10, 16, 4, 28, 36) function-interpolation-python 2.22002 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 16, 4, 28, 36) function-interpolation-python 0.8883 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 16, 4, 31, 10) la-vector-access-cpp 154.197 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 16, 4, 31, 56) la-vector-assignment-cpp 46.0274 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 17, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9121 "BENCH 10.9121"
+(2014, 10, 17, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.137 "Building point search tree to accelerate distance queries."
+(2014, 10, 17, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.2048 "BENCH 14.2048"
+(2014, 10, 17, 1, 9, 46) common-progress-cpp 27.9011 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 17, 1, 10, 17) common-timing-cpp 31.2122 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 17, 1, 11, 51) fem-convergence-cpp 3.86669 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 17, 1, 11, 53) fem-jit-python 0.000417399 "JIT compilation (in memory cache)"
+(2014, 10, 17, 4, 32, 58) mesh-refinement-cpp 8.48145 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 17, 4, 33, 19) mesh-topology-cpp 21.5264 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 17, 4, 33, 42) mesh-unitcube-cpp 23.0192 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 17, 4, 34, 24) mesh-iteration-cpp 39.1933 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 17, 4, 34, 24) function-evaluation-cpp 0.058466 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 17, 4, 34, 30) function-extrapolation-python 5.70768 "BENCH:  1.99677300453"
+(2014, 10, 17, 4, 34, 30) function-extrapolation-python 1.99677 "BENCH:  1.99677300453"
+(2014, 10, 17, 4, 34, 32) function-interpolation-python 2.22259 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 17, 4, 34, 32) function-interpolation-python 0.891714 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 17, 4, 37, 7) la-vector-access-cpp 154.829 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 17, 4, 37, 49) la-vector-assignment-cpp 42.3622 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 18, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8581 "BENCH 10.8581"
+(2014, 10, 18, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1227 "Building point search tree to accelerate distance queries."
+(2014, 10, 18, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.3789 "BENCH 14.3789"
+(2014, 10, 18, 1, 9, 45) common-progress-cpp 27.9011 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 18, 1, 10, 17) common-timing-cpp 31.2991 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 18, 1, 11, 51) fem-convergence-cpp 3.92525 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 18, 1, 11, 53) fem-jit-python 0.000423813 "JIT compilation (in memory cache)"
+(2014, 10, 18, 4, 28, 30) mesh-refinement-cpp 8.50549 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 18, 4, 28, 51) mesh-topology-cpp 21.3034 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 18, 4, 29, 15) mesh-unitcube-cpp 23.279 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 18, 4, 29, 56) mesh-iteration-cpp 38.5593 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 18, 4, 29, 56) function-evaluation-cpp 0.058557 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 18, 4, 30, 1) function-extrapolation-python 5.6628 "BENCH:  2.01583719254"
+(2014, 10, 18, 4, 30, 1) function-extrapolation-python 2.01584 "BENCH:  2.01583719254"
+(2014, 10, 18, 4, 30, 4) function-interpolation-python 2.23246 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 18, 4, 30, 4) function-interpolation-python 0.901038 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 18, 4, 32, 38) la-vector-access-cpp 154.178 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 18, 4, 33, 24) la-vector-assignment-cpp 46.0251 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 19, 1, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9403 "BENCH 10.9403"
+(2014, 10, 19, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0535 "Building point search tree to accelerate distance queries."
+(2014, 10, 19, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.0825 "BENCH 14.0825"
+(2014, 10, 19, 1, 9, 47) common-progress-cpp 27.8804 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 19, 1, 10, 18) common-timing-cpp 31.0802 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 19, 1, 11, 52) fem-convergence-cpp 3.9351 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 19, 1, 11, 53) fem-jit-python 0.000415778 "JIT compilation (in memory cache)"
+(2014, 10, 19, 4, 32, 59) mesh-refinement-cpp 8.46614 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 19, 4, 33, 20) mesh-topology-cpp 21.4803 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 19, 4, 33, 44) mesh-unitcube-cpp 23.0745 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 19, 4, 34, 22) mesh-iteration-cpp 35.543 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 19, 4, 34, 22) function-evaluation-cpp 0.0605161 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 19, 4, 34, 27) function-extrapolation-python 5.64239 "BENCH:  1.99154186249"
+(2014, 10, 19, 4, 34, 27) function-extrapolation-python 1.99154 "BENCH:  1.99154186249"
+(2014, 10, 19, 4, 34, 30) function-interpolation-python 2.20988 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 19, 4, 34, 30) function-interpolation-python 0.887558 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 19, 4, 37, 8) la-vector-access-cpp 158.771 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 19, 4, 37, 51) la-vector-assignment-cpp 42.292 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 20, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.8894 "BENCH 10.8894"
+(2014, 10, 20, 1, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1307 "Building point search tree to accelerate distance queries."
+(2014, 10, 20, 1, 9, 17) geometry-bounding_box_tree_build-cpp 14.2916 "BENCH 14.2916"
+(2014, 10, 20, 1, 9, 45) common-progress-cpp 27.9585 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 20, 1, 10, 16) common-timing-cpp 31.3228 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 20, 1, 11, 51) fem-convergence-cpp 3.88984 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 20, 1, 11, 52) fem-jit-python 0.000408101 "JIT compilation (in memory cache)"
+(2014, 10, 20, 4, 31, 48) mesh-refinement-cpp 8.46638 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 20, 4, 32, 9) mesh-topology-cpp 21.4107 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 20, 4, 32, 32) mesh-unitcube-cpp 23.0575 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 20, 4, 33, 14) mesh-iteration-cpp 39.178 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 20, 4, 33, 14) function-evaluation-cpp 0.060257 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 20, 4, 33, 20) function-extrapolation-python 5.94623 "BENCH:  1.99621105194"
+(2014, 10, 20, 4, 33, 20) function-extrapolation-python 1.99621 "BENCH:  1.99621105194"
+(2014, 10, 20, 4, 33, 22) function-interpolation-python 2.23853 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 20, 4, 33, 22) function-interpolation-python 0.891514 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 20, 4, 35, 57) la-vector-access-cpp 154.186 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 20, 4, 36, 39) la-vector-assignment-cpp 42.0194 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 21, 1, 8, 49) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.6956 "BENCH 11.6956"
+(2014, 10, 21, 1, 9, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6925 "Building point search tree to accelerate distance queries."
+(2014, 10, 21, 1, 9, 24) geometry-bounding_box_tree_build-cpp 14.1688 "BENCH 14.1688"
+(2014, 10, 21, 1, 9, 52) common-progress-cpp 27.8783 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 21, 1, 10, 23) common-timing-cpp 30.3759 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 21, 1, 11, 57) fem-convergence-cpp 3.91842 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 21, 1, 11, 58) fem-jit-python 0.000419617 "JIT compilation (in memory cache)"
+(2014, 10, 21, 4, 21, 45) mesh-refinement-cpp 8.54341 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 21, 4, 22, 7) mesh-topology-cpp 21.7309 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 21, 4, 22, 30) mesh-unitcube-cpp 23.1977 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 21, 4, 23, 16) mesh-iteration-cpp 43.5747 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 21, 4, 23, 16) function-evaluation-cpp 0.058279 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 21, 4, 23, 22) function-extrapolation-python 5.63363 "BENCH:  2.00619387627"
+(2014, 10, 21, 4, 23, 22) function-extrapolation-python 2.00619 "BENCH:  2.00619387627"
+(2014, 10, 21, 4, 23, 24) function-interpolation-python 2.29013 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 21, 4, 23, 24) function-interpolation-python 0.934132 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 21, 4, 25, 56) la-vector-access-cpp 151.256 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 21, 4, 26, 34) la-vector-assignment-cpp 38.0545 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 22, 1, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.6706 "BENCH 11.6706"
+(2014, 10, 22, 1, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5235 "Building point search tree to accelerate distance queries."
+(2014, 10, 22, 1, 9, 21) geometry-bounding_box_tree_build-cpp 14.2244 "BENCH 14.2244"
+(2014, 10, 22, 1, 9, 48) common-progress-cpp 27.8821 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 22, 1, 10, 19) common-timing-cpp 30.1797 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 22, 1, 11, 54) fem-convergence-cpp 3.85106 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 22, 1, 11, 55) fem-jit-python 0.000421906 "JIT compilation (in memory cache)"
+(2014, 10, 22, 4, 20, 8) mesh-refinement-cpp 8.57119 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 22, 4, 20, 30) mesh-topology-cpp 21.7798 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 22, 4, 20, 53) mesh-unitcube-cpp 23.1814 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 22, 4, 21, 35) mesh-iteration-cpp 39.18 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 22, 4, 21, 35) function-evaluation-cpp 0.0869849 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 22, 4, 21, 40) function-extrapolation-python 5.656 "BENCH:  1.99994492531"
+(2014, 10, 22, 4, 21, 40) function-extrapolation-python 1.99994 "BENCH:  1.99994492531"
+(2014, 10, 22, 4, 21, 43) function-interpolation-python 2.27017 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 22, 4, 21, 43) function-interpolation-python 0.930895 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 22, 4, 24, 14) la-vector-access-cpp 151.174 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 22, 4, 24, 52) la-vector-assignment-cpp 38.0086 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 23, 1, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0354 "BENCH 11.0354"
+(2014, 10, 23, 1, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1097 "Building point search tree to accelerate distance queries."
+(2014, 10, 23, 1, 9, 21) geometry-bounding_box_tree_build-cpp 14.2176 "BENCH 14.2176"
+(2014, 10, 23, 1, 9, 49) common-progress-cpp 27.9537 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 23, 1, 10, 20) common-timing-cpp 30.4108 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 23, 1, 11, 54) fem-convergence-cpp 3.82471 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 23, 1, 11, 56) fem-jit-python 0.000419998 "JIT compilation (in memory cache)"
+(2014, 10, 23, 4, 38, 39) mesh-refinement-cpp 8.52561 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 23, 4, 39, 1) mesh-topology-cpp 21.6209 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 23, 4, 39, 24) mesh-unitcube-cpp 22.8523 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 23, 4, 40, 6) mesh-iteration-cpp 39.1798 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 23, 4, 40, 6) function-evaluation-cpp 0.0722249 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 23, 4, 40, 11) function-extrapolation-python 5.5987 "BENCH:  2.00957489014"
+(2014, 10, 23, 4, 40, 11) function-extrapolation-python 2.00957 "BENCH:  2.00957489014"
+(2014, 10, 23, 4, 40, 14) function-interpolation-python 2.24004 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 23, 4, 40, 14) function-interpolation-python 0.908606 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 23, 4, 42, 45) la-vector-access-cpp 151.594 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 23, 4, 43, 24) la-vector-assignment-cpp 38.2895 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 24, 1, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1593 "BENCH 11.1593"
+(2014, 10, 24, 1, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0552 "Building point search tree to accelerate distance queries."
+(2014, 10, 24, 1, 9, 18) geometry-bounding_box_tree_build-cpp 14.322 "BENCH 14.322"
+(2014, 10, 24, 1, 9, 45) common-progress-cpp 27.9016 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 24, 1, 10, 16) common-timing-cpp 30.8148 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 24, 1, 11, 51) fem-convergence-cpp 3.89832 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 24, 1, 11, 52) fem-jit-python 0.000407004 "JIT compilation (in memory cache)"
+(2014, 10, 24, 4, 28, 34) mesh-refinement-cpp 8.57309 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 24, 4, 28, 55) mesh-topology-cpp 21.574 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 24, 4, 29, 19) mesh-unitcube-cpp 23.7722 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 24, 4, 30, 1) mesh-iteration-cpp 39.1757 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 24, 4, 30, 1) function-evaluation-cpp 0.0622101 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 24, 4, 30, 7) function-extrapolation-python 5.99373 "BENCH:  1.99651503563"
+(2014, 10, 24, 4, 30, 7) function-extrapolation-python 1.99652 "BENCH:  1.99651503563"
+(2014, 10, 24, 4, 30, 9) function-interpolation-python 2.25934 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 24, 4, 30, 9) function-interpolation-python 0.902858 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 24, 4, 32, 41) la-vector-access-cpp 151.814 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 24, 4, 33, 19) la-vector-assignment-cpp 38.0103 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 25, 1, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.159 "BENCH 11.159"
+(2014, 10, 25, 1, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3135 "Building point search tree to accelerate distance queries."
+(2014, 10, 25, 1, 9, 19) geometry-bounding_box_tree_build-cpp 14.436 "BENCH 14.436"
+(2014, 10, 25, 1, 9, 52) common-progress-cpp 32.9022 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 25, 1, 10, 22) common-timing-cpp 30.2973 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 25, 1, 11, 58) fem-convergence-cpp 3.90044 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 25, 1, 11, 59) fem-jit-python 0.000406313 "JIT compilation (in memory cache)"
+(2014, 10, 25, 4, 29, 47) mesh-refinement-cpp 8.55928 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 25, 4, 30, 8) mesh-topology-cpp 21.55 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 25, 4, 30, 32) mesh-unitcube-cpp 23.468 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 25, 4, 31, 18) mesh-iteration-cpp 43.5757 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 25, 4, 31, 18) function-evaluation-cpp 0.0745301 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 25, 4, 31, 24) function-extrapolation-python 5.99599 "BENCH:  2.0088031292"
+(2014, 10, 25, 4, 31, 24) function-extrapolation-python 2.0088 "BENCH:  2.0088031292"
+(2014, 10, 25, 4, 31, 26) function-interpolation-python 2.24296 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 25, 4, 31, 26) function-interpolation-python 0.895253 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 25, 4, 33, 57) la-vector-access-cpp 150.731 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 25, 4, 34, 35) la-vector-assignment-cpp 38.014 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 26, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.062 "BENCH 11.062"
+(2014, 10, 26, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 14.989 "Building point search tree to accelerate distance queries."
+(2014, 10, 26, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.2302 "BENCH 14.2302"
+(2014, 10, 26, 2, 9, 46) common-progress-cpp 28.0124 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 26, 2, 10, 15) common-timing-cpp 29.7158 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 26, 2, 11, 49) fem-convergence-cpp 3.85475 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 26, 2, 11, 51) fem-jit-python 0.000421906 "JIT compilation (in memory cache)"
+(2014, 10, 26, 5, 30, 50) mesh-refinement-cpp 8.69131 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 26, 5, 31, 12) mesh-topology-cpp 21.7343 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 26, 5, 31, 36) mesh-unitcube-cpp 23.679 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 26, 5, 32, 18) mesh-iteration-cpp 39.4166 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 26, 5, 32, 18) function-evaluation-cpp 0.089154 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 26, 5, 32, 24) function-extrapolation-python 5.89083 "BENCH:  2.03053402901"
+(2014, 10, 26, 5, 32, 24) function-extrapolation-python 2.03053 "BENCH:  2.03053402901"
+(2014, 10, 26, 5, 32, 26) function-interpolation-python 2.29373 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 26, 5, 32, 26) function-interpolation-python 0.921347 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 26, 5, 34, 57) la-vector-access-cpp 150.99 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 26, 5, 35, 39) la-vector-assignment-cpp 42.0274 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 27, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0295 "BENCH 11.0295"
+(2014, 10, 27, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.12 "Building point search tree to accelerate distance queries."
+(2014, 10, 27, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.2951 "BENCH 14.2951"
+(2014, 10, 27, 2, 9, 46) common-progress-cpp 27.8832 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 27, 2, 10, 16) common-timing-cpp 29.8866 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 27, 2, 11, 49) fem-convergence-cpp 3.86232 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 27, 2, 11, 50) fem-jit-python 0.000419497 "JIT compilation (in memory cache)"
+(2014, 10, 27, 5, 25, 20) mesh-refinement-cpp 8.55113 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 27, 5, 25, 41) mesh-topology-cpp 21.5124 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 27, 5, 26, 5) mesh-unitcube-cpp 23.5818 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 27, 5, 26, 47) mesh-iteration-cpp 39.1717 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 27, 5, 26, 47) function-evaluation-cpp 0.0619938 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 27, 5, 26, 53) function-extrapolation-python 5.69118 "BENCH:  1.99518585205"
+(2014, 10, 27, 5, 26, 53) function-extrapolation-python 1.99519 "BENCH:  1.99518585205"
+(2014, 10, 27, 5, 26, 55) function-interpolation-python 2.21938 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 27, 5, 26, 55) function-interpolation-python 0.893302 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 27, 5, 29, 26) la-vector-access-cpp 150.711 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 27, 5, 30, 4) la-vector-assignment-cpp 38.0112 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 28, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9708 "BENCH 10.9708"
+(2014, 10, 28, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1407 "Building point search tree to accelerate distance queries."
+(2014, 10, 28, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.2398 "BENCH 14.2398"
+(2014, 10, 28, 2, 9, 45) common-progress-cpp 27.922 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 28, 2, 10, 15) common-timing-cpp 30.1472 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 28, 2, 11, 50) fem-convergence-cpp 3.81522 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 28, 2, 11, 51) fem-jit-python 0.000424004 "JIT compilation (in memory cache)"
+(2014, 10, 28, 5, 47, 1) mesh-refinement-cpp 8.83603 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 28, 5, 47, 23) mesh-topology-cpp 21.7899 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 28, 5, 47, 47) mesh-unitcube-cpp 23.6861 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 28, 5, 48, 33) mesh-iteration-cpp 43.5884 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 28, 5, 48, 33) function-evaluation-cpp 0.0724461 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 28, 5, 48, 39) function-extrapolation-python 5.46461 "BENCH:  1.9933218956"
+(2014, 10, 28, 5, 48, 39) function-extrapolation-python 1.99332 "BENCH:  1.9933218956"
+(2014, 10, 28, 5, 48, 41) function-interpolation-python 2.23247 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 28, 5, 48, 41) function-interpolation-python 0.891896 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 28, 5, 51, 12) la-vector-access-cpp 150.7 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 28, 5, 51, 54) la-vector-assignment-cpp 42.0218 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 29, 2, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1712 "BENCH 11.1712"
+(2014, 10, 29, 2, 9, 6) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1633 "Building point search tree to accelerate distance queries."
+(2014, 10, 29, 2, 9, 23) geometry-bounding_box_tree_build-cpp 14.0887 "BENCH 14.0887"
+(2014, 10, 29, 2, 9, 50) common-progress-cpp 27.6201 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 29, 2, 10, 20) common-timing-cpp 30.2474 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 29, 2, 11, 55) fem-convergence-cpp 3.81475 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 29, 2, 11, 56) fem-jit-python 0.000425887 "JIT compilation (in memory cache)"
+(2014, 10, 29, 5, 33, 11) mesh-refinement-cpp 8.56165 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 29, 5, 33, 33) mesh-topology-cpp 21.6458 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 29, 5, 33, 56) mesh-unitcube-cpp 23.4395 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 29, 5, 34, 38) mesh-iteration-cpp 39.1111 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 29, 5, 34, 38) function-evaluation-cpp 0.0744588 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 29, 5, 34, 44) function-extrapolation-python 5.90783 "BENCH:  2.0017850399"
+(2014, 10, 29, 5, 34, 44) function-extrapolation-python 2.00179 "BENCH:  2.0017850399"
+(2014, 10, 29, 5, 34, 46) function-interpolation-python 2.25268 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 29, 5, 34, 46) function-interpolation-python 0.904835 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 29, 5, 37, 17) la-vector-access-cpp 150.484 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 29, 5, 37, 55) la-vector-assignment-cpp 38.0123 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 30, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0848 "BENCH 11.0848"
+(2014, 10, 30, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0471 "Building point search tree to accelerate distance queries."
+(2014, 10, 30, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.207 "BENCH 14.207"
+(2014, 10, 30, 2, 9, 45) common-progress-cpp 27.8812 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 30, 2, 10, 15) common-timing-cpp 30.0858 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 30, 2, 11, 50) fem-convergence-cpp 3.85671 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 30, 2, 11, 52) fem-jit-python 0.000422883 "JIT compilation (in memory cache)"
+(2014, 10, 30, 5, 31, 26) mesh-refinement-cpp 8.57116 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 30, 5, 31, 48) mesh-topology-cpp 21.6542 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 30, 5, 32, 12) mesh-unitcube-cpp 23.4339 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 30, 5, 32, 53) mesh-iteration-cpp 39.1871 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 30, 5, 32, 53) function-evaluation-cpp 0.070245 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 30, 5, 32, 59) function-extrapolation-python 5.8043 "BENCH:  1.99066901207"
+(2014, 10, 30, 5, 32, 59) function-extrapolation-python 1.99067 "BENCH:  1.99066901207"
+(2014, 10, 30, 5, 33, 2) function-interpolation-python 2.25158 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 30, 5, 33, 2) function-interpolation-python 0.895503 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 30, 5, 35, 33) la-vector-access-cpp 151.24 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 30, 5, 36, 11) la-vector-assignment-cpp 38.0111 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 10, 31, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1768 "BENCH 11.1768"
+(2014, 10, 31, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3583 "Building point search tree to accelerate distance queries."
+(2014, 10, 31, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.343 "BENCH 14.343"
+(2014, 10, 31, 2, 9, 48) common-progress-cpp 27.8879 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 10, 31, 2, 10, 18) common-timing-cpp 30.6418 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 10, 31, 2, 11, 53) fem-convergence-cpp 3.84455 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 10, 31, 2, 11, 54) fem-jit-python 0.000427485 "JIT compilation (in memory cache)"
+(2014, 10, 31, 5, 34, 56) mesh-refinement-cpp 8.59252 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 10, 31, 5, 35, 18) mesh-topology-cpp 21.4965 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 10, 31, 5, 35, 42) mesh-unitcube-cpp 23.7136 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 10, 31, 5, 36, 23) mesh-iteration-cpp 39.1813 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 10, 31, 5, 36, 24) function-evaluation-cpp 0.063935 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 10, 31, 5, 36, 29) function-extrapolation-python 5.77328 "BENCH:  2.01375484467"
+(2014, 10, 31, 5, 36, 29) function-extrapolation-python 2.01375 "BENCH:  2.01375484467"
+(2014, 10, 31, 5, 36, 32) function-interpolation-python 2.24669 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 31, 5, 36, 32) function-interpolation-python 0.898741 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 10, 31, 5, 39, 2) la-vector-access-cpp 150.684 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 10, 31, 5, 39, 40) la-vector-assignment-cpp 38.019 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 1, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1329 "BENCH 11.1329"
+(2014, 11, 1, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1576 "Building point search tree to accelerate distance queries."
+(2014, 11, 1, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.1864 "BENCH 14.1864"
+(2014, 11, 1, 2, 9, 50) common-progress-cpp 31.6389 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 1, 2, 10, 21) common-timing-cpp 30.9122 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 1, 2, 11, 55) fem-convergence-cpp 3.86266 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 1, 2, 11, 57) fem-jit-python 0.000414205 "JIT compilation (in memory cache)"
+(2014, 11, 1, 5, 25, 19) mesh-refinement-cpp 8.61724 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 1, 5, 25, 41) mesh-topology-cpp 21.5759 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 1, 5, 26, 4) mesh-unitcube-cpp 23.4414 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 1, 5, 26, 46) mesh-iteration-cpp 39.1791 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 1, 5, 26, 46) function-evaluation-cpp 0.0769939 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 1, 5, 26, 52) function-extrapolation-python 5.64524 "BENCH:  1.99228000641"
+(2014, 11, 1, 5, 26, 52) function-extrapolation-python 1.99228 "BENCH:  1.99228000641"
+(2014, 11, 1, 5, 26, 54) function-interpolation-python 2.2298 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 1, 5, 26, 54) function-interpolation-python 0.896246 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 1, 5, 29, 25) la-vector-access-cpp 150.686 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 1, 5, 30, 3) la-vector-assignment-cpp 38.0279 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 2, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1125 "BENCH 11.1125"
+(2014, 11, 2, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0944 "Building point search tree to accelerate distance queries."
+(2014, 11, 2, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.0655 "BENCH 14.0655"
+(2014, 11, 2, 2, 9, 46) common-progress-cpp 27.8922 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 2, 2, 10, 17) common-timing-cpp 30.7812 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 2, 2, 11, 52) fem-convergence-cpp 3.83019 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 2, 2, 11, 53) fem-jit-python 0.000413513 "JIT compilation (in memory cache)"
+(2014, 11, 2, 5, 33, 54) mesh-refinement-cpp 8.73721 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 2, 5, 34, 16) mesh-topology-cpp 21.8735 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 2, 5, 34, 40) mesh-unitcube-cpp 23.6877 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 2, 5, 35, 26) mesh-iteration-cpp 43.8435 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 2, 5, 35, 26) function-evaluation-cpp 0.0747271 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 2, 5, 35, 32) function-extrapolation-python 5.68925 "BENCH:  2.06611704826"
+(2014, 11, 2, 5, 35, 32) function-extrapolation-python 2.06612 "BENCH:  2.06611704826"
+(2014, 11, 2, 5, 35, 34) function-interpolation-python 2.28669 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 2, 5, 35, 34) function-interpolation-python 0.91682 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 2, 5, 38, 5) la-vector-access-cpp 151.003 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 2, 5, 38, 43) la-vector-assignment-cpp 38.0242 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 3, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1897 "BENCH 11.1897"
+(2014, 11, 3, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2746 "Building point search tree to accelerate distance queries."
+(2014, 11, 3, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.1962 "BENCH 14.1962"
+(2014, 11, 3, 2, 9, 46) common-progress-cpp 27.8841 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 3, 2, 10, 17) common-timing-cpp 30.6664 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 3, 2, 11, 52) fem-convergence-cpp 3.8923 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 3, 2, 11, 53) fem-jit-python 0.000409484 "JIT compilation (in memory cache)"
+(2014, 11, 3, 5, 28, 4) mesh-refinement-cpp 8.57199 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 3, 5, 28, 26) mesh-topology-cpp 21.5977 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 3, 5, 28, 49) mesh-unitcube-cpp 23.4697 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 3, 5, 29, 31) mesh-iteration-cpp 39.176 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 3, 5, 29, 31) function-evaluation-cpp 0.0745251 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 3, 5, 29, 37) function-extrapolation-python 5.71608 "BENCH:  1.99472284317"
+(2014, 11, 3, 5, 29, 37) function-extrapolation-python 1.99472 "BENCH:  1.99472284317"
+(2014, 11, 3, 5, 29, 39) function-interpolation-python 2.25196 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 3, 5, 29, 39) function-interpolation-python 0.904003 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 3, 5, 32, 10) la-vector-access-cpp 150.724 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 3, 5, 32, 52) la-vector-assignment-cpp 42.2564 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 4, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.2981 "BENCH 11.2981"
+(2014, 11, 4, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.029 "Building point search tree to accelerate distance queries."
+(2014, 11, 4, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.4299 "BENCH 14.4299"
+(2014, 11, 4, 2, 9, 47) common-progress-cpp 27.9014 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 4, 2, 10, 17) common-timing-cpp 30.5036 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 4, 2, 11, 52) fem-convergence-cpp 3.86769 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 4, 2, 11, 53) fem-jit-python 0.00042119 "JIT compilation (in memory cache)"
+(2014, 11, 4, 5, 33, 14) mesh-refinement-cpp 8.83908 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 4, 5, 33, 36) mesh-topology-cpp 21.8505 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 4, 5, 33, 59) mesh-unitcube-cpp 23.6559 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 4, 5, 34, 41) mesh-iteration-cpp 39.3895 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 4, 5, 34, 41) function-evaluation-cpp 0.0769849 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 4, 5, 34, 47) function-extrapolation-python 5.87353 "BENCH:  2.0394718647"
+(2014, 11, 4, 5, 34, 47) function-extrapolation-python 2.03947 "BENCH:  2.0394718647"
+(2014, 11, 4, 5, 34, 50) function-interpolation-python 2.32688 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 4, 5, 34, 50) function-interpolation-python 0.926297 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 4, 5, 37, 22) la-vector-access-cpp 152.659 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 4, 5, 38, 0) la-vector-assignment-cpp 37.9671 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 5, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0927 "BENCH 11.0927"
+(2014, 11, 5, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1851 "Building point search tree to accelerate distance queries."
+(2014, 11, 5, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.1325 "BENCH 14.1325"
+(2014, 11, 5, 2, 9, 45) common-progress-cpp 27.8923 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 5, 2, 10, 16) common-timing-cpp 30.5506 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 5, 2, 11, 51) fem-convergence-cpp 3.84255 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 5, 2, 11, 52) fem-jit-python 0.0004143 "JIT compilation (in memory cache)"
+(2014, 11, 5, 5, 33, 27) mesh-refinement-cpp 8.57944 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 5, 5, 33, 49) mesh-topology-cpp 21.564 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 5, 5, 34, 12) mesh-unitcube-cpp 23.4395 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 5, 5, 34, 54) mesh-iteration-cpp 39.1757 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 5, 5, 34, 54) function-evaluation-cpp 0.07692 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 5, 5, 35, 0) function-extrapolation-python 5.76433 "BENCH:  2.01263093948"
+(2014, 11, 5, 5, 35, 0) function-extrapolation-python 2.01263 "BENCH:  2.01263093948"
+(2014, 11, 5, 5, 35, 2) function-interpolation-python 2.2562 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 5, 5, 35, 2) function-interpolation-python 0.916118 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 5, 5, 37, 35) la-vector-access-cpp 153.074 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 5, 5, 38, 14) la-vector-assignment-cpp 38.282 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 6, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9808 "BENCH 10.9808"
+(2014, 11, 6, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1164 "Building point search tree to accelerate distance queries."
+(2014, 11, 6, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.3504 "BENCH 14.3504"
+(2014, 11, 6, 2, 9, 46) common-progress-cpp 27.8809 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 6, 2, 10, 16) common-timing-cpp 29.8311 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 6, 2, 11, 52) fem-convergence-cpp 3.88443 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 6, 2, 11, 53) fem-jit-python 0.000427794 "JIT compilation (in memory cache)"
+(2014, 11, 6, 5, 32, 15) mesh-refinement-cpp 8.71488 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 6, 5, 32, 37) mesh-topology-cpp 21.6479 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 6, 5, 33, 1) mesh-unitcube-cpp 23.8873 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 6, 5, 33, 43) mesh-iteration-cpp 39.4135 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 6, 5, 33, 43) function-evaluation-cpp 0.079735 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 6, 5, 33, 48) function-extrapolation-python 5.52255 "BENCH:  2.04936504364"
+(2014, 11, 6, 5, 33, 48) function-extrapolation-python 2.04937 "BENCH:  2.04936504364"
+(2014, 11, 6, 5, 33, 51) function-interpolation-python 2.2765 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 6, 5, 33, 51) function-interpolation-python 0.91461 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 6, 5, 36, 22) la-vector-access-cpp 151.541 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 6, 5, 37, 4) la-vector-assignment-cpp 41.9956 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 7, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.973 "BENCH 10.973"
+(2014, 11, 7, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.6656 "Building point search tree to accelerate distance queries."
+(2014, 11, 7, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.1323 "BENCH 14.1323"
+(2014, 11, 7, 2, 9, 48) common-progress-cpp 27.9404 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 7, 2, 10, 18) common-timing-cpp 29.7348 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 7, 2, 11, 51) fem-convergence-cpp 3.8358 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 7, 2, 11, 52) fem-jit-python 0.000423598 "JIT compilation (in memory cache)"
+(2014, 11, 7, 5, 19, 5) mesh-refinement-cpp 8.55839 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 7, 5, 19, 27) mesh-topology-cpp 21.5156 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 7, 5, 19, 50) mesh-unitcube-cpp 23.4877 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 7, 5, 20, 32) mesh-iteration-cpp 39.1805 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 7, 5, 20, 32) function-evaluation-cpp 0.0762701 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 7, 5, 20, 38) function-extrapolation-python 5.73122 "BENCH:  2.02365708351"
+(2014, 11, 7, 5, 20, 38) function-extrapolation-python 2.02366 "BENCH:  2.02365708351"
+(2014, 11, 7, 5, 20, 40) function-interpolation-python 2.22803 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 7, 5, 20, 40) function-interpolation-python 0.896808 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 7, 5, 23, 12) la-vector-access-cpp 151.916 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 7, 5, 23, 50) la-vector-assignment-cpp 38.0204 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 8, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0432 "BENCH 11.0432"
+(2014, 11, 8, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9913 "Building point search tree to accelerate distance queries."
+(2014, 11, 8, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.0684 "BENCH 14.0684"
+(2014, 11, 8, 2, 9, 44) common-progress-cpp 27.8908 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 8, 2, 10, 15) common-timing-cpp 30.1833 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 8, 2, 11, 49) fem-convergence-cpp 3.83 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 8, 2, 11, 50) fem-jit-python 0.00042181 "JIT compilation (in memory cache)"
+(2014, 11, 8, 5, 28, 25) mesh-refinement-cpp 8.56076 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 8, 5, 28, 47) mesh-topology-cpp 21.6926 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 8, 5, 29, 11) mesh-unitcube-cpp 23.6028 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 8, 5, 29, 52) mesh-iteration-cpp 39.0982 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 8, 5, 29, 52) function-evaluation-cpp 0.0870249 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 8, 5, 29, 58) function-extrapolation-python 5.83516 "BENCH:  2.05952310562"
+(2014, 11, 8, 5, 29, 58) function-extrapolation-python 2.05952 "BENCH:  2.05952310562"
+(2014, 11, 8, 5, 30, 1) function-interpolation-python 2.35402 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 8, 5, 30, 1) function-interpolation-python 0.952389 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 8, 5, 32, 34) la-vector-access-cpp 153.36 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 8, 5, 33, 16) la-vector-assignment-cpp 42.0217 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 9, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1599 "BENCH 11.1599"
+(2014, 11, 9, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1473 "Building point search tree to accelerate distance queries."
+(2014, 11, 9, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.1587 "BENCH 14.1587"
+(2014, 11, 9, 2, 9, 44) common-progress-cpp 27.8856 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 9, 2, 10, 15) common-timing-cpp 30.962 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 9, 2, 11, 50) fem-convergence-cpp 3.83735 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 9, 2, 11, 51) fem-jit-python 0.000421691 "JIT compilation (in memory cache)"
+(2014, 11, 9, 5, 33, 43) mesh-refinement-cpp 8.5665 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 9, 5, 34, 4) mesh-topology-cpp 21.5765 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 9, 5, 34, 28) mesh-unitcube-cpp 23.5025 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 9, 5, 35, 10) mesh-iteration-cpp 39.1712 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 9, 5, 35, 10) function-evaluation-cpp 0.052187 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 9, 5, 35, 15) function-extrapolation-python 5.728 "BENCH:  2.00523686409"
+(2014, 11, 9, 5, 35, 15) function-extrapolation-python 2.00524 "BENCH:  2.00523686409"
+(2014, 11, 9, 5, 35, 18) function-interpolation-python 2.22628 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 9, 5, 35, 18) function-interpolation-python 0.893958 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 9, 5, 37, 48) la-vector-access-cpp 150.694 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 9, 5, 38, 26) la-vector-assignment-cpp 37.979 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 10, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.2474 "BENCH 11.2474"
+(2014, 11, 10, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1376 "Building point search tree to accelerate distance queries."
+(2014, 11, 10, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.1706 "BENCH 14.1706"
+(2014, 11, 10, 2, 9, 44) common-progress-cpp 27.8843 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 10, 2, 10, 15) common-timing-cpp 30.8137 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 10, 2, 11, 49) fem-convergence-cpp 3.86626 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 10, 2, 11, 51) fem-jit-python 0.000417185 "JIT compilation (in memory cache)"
+(2014, 11, 10, 5, 27, 31) mesh-refinement-cpp 8.56199 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 10, 5, 27, 52) mesh-topology-cpp 21.589 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 10, 5, 28, 16) mesh-unitcube-cpp 23.4664 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 10, 5, 28, 58) mesh-iteration-cpp 39.1773 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 10, 5, 28, 58) function-evaluation-cpp 0.051223 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 10, 5, 29, 3) function-extrapolation-python 5.53876 "BENCH:  1.99187994003"
+(2014, 11, 10, 5, 29, 3) function-extrapolation-python 1.99188 "BENCH:  1.99187994003"
+(2014, 11, 10, 5, 29, 6) function-interpolation-python 2.22736 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 10, 5, 29, 6) function-interpolation-python 0.896078 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 10, 5, 31, 36) la-vector-access-cpp 150.664 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 10, 5, 32, 14) la-vector-assignment-cpp 38.0202 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 11, 2, 8, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0118 "BENCH 11.0118"
+(2014, 11, 11, 2, 8, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3467 "Building point search tree to accelerate distance queries."
+(2014, 11, 11, 2, 9, 14) geometry-bounding_box_tree_build-cpp 14.2835 "BENCH 14.2835"
+(2014, 11, 11, 2, 9, 42) common-progress-cpp 27.877 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 11, 2, 10, 13) common-timing-cpp 30.5448 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 11, 2, 11, 48) fem-convergence-cpp 3.83798 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 11, 2, 11, 49) fem-jit-python 0.000419903 "JIT compilation (in memory cache)"
+(2014, 11, 11, 5, 30, 26) mesh-refinement-cpp 8.57733 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 11, 5, 30, 48) mesh-topology-cpp 21.577 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 11, 5, 31, 11) mesh-unitcube-cpp 23.6135 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 11, 5, 31, 53) mesh-iteration-cpp 39.1773 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 11, 5, 31, 53) function-evaluation-cpp 0.061244 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 11, 5, 31, 59) function-extrapolation-python 5.94534 "BENCH:  1.9957818985"
+(2014, 11, 11, 5, 31, 59) function-extrapolation-python 1.99578 "BENCH:  1.9957818985"
+(2014, 11, 11, 5, 32, 1) function-interpolation-python 2.30012 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 11, 5, 32, 1) function-interpolation-python 0.893837 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 11, 5, 34, 32) la-vector-access-cpp 150.71 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 11, 5, 35, 10) la-vector-assignment-cpp 37.955 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 12, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1893 "BENCH 11.1893"
+(2014, 11, 12, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9574 "Building point search tree to accelerate distance queries."
+(2014, 11, 12, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.2366 "BENCH 14.2366"
+(2014, 11, 12, 2, 9, 48) common-progress-cpp 27.9002 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 12, 2, 10, 18) common-timing-cpp 30.43 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 12, 2, 11, 53) fem-convergence-cpp 3.88116 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 12, 2, 11, 54) fem-jit-python 0.000415182 "JIT compilation (in memory cache)"
+(2014, 11, 12, 5, 25, 53) mesh-refinement-cpp 8.59727 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 12, 5, 26, 15) mesh-topology-cpp 21.7704 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 12, 5, 26, 38) mesh-unitcube-cpp 23.6679 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 12, 5, 27, 30) mesh-iteration-cpp 48.8458 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 12, 5, 27, 30) function-evaluation-cpp 0.0789721 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 12, 5, 27, 35) function-extrapolation-python 5.64251 "BENCH:  2.06761288643"
+(2014, 11, 12, 5, 27, 35) function-extrapolation-python 2.06761 "BENCH:  2.06761288643"
+(2014, 11, 12, 5, 27, 38) function-interpolation-python 2.34344 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 12, 5, 27, 38) function-interpolation-python 0.92622 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 12, 5, 30, 9) la-vector-access-cpp 151.144 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 12, 5, 30, 47) la-vector-assignment-cpp 38.0224 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 13, 2, 8, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0856 "BENCH 11.0856"
+(2014, 11, 13, 2, 8, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1592 "Building point search tree to accelerate distance queries."
+(2014, 11, 13, 2, 9, 14) geometry-bounding_box_tree_build-cpp 14.334 "BENCH 14.334"
+(2014, 11, 13, 2, 9, 42) common-progress-cpp 27.87 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 13, 2, 10, 13) common-timing-cpp 30.7049 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 13, 2, 11, 46) fem-convergence-cpp 3.83172 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 13, 2, 11, 48) fem-jit-python 0.000420499 "JIT compilation (in memory cache)"
+(2014, 11, 13, 5, 39, 29) mesh-refinement-cpp 8.56523 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 13, 5, 39, 51) mesh-topology-cpp 21.7378 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 13, 5, 40, 14) mesh-unitcube-cpp 23.4337 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 13, 5, 40, 56) mesh-iteration-cpp 39.1773 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 13, 5, 40, 56) function-evaluation-cpp 0.0721881 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 13, 5, 41, 2) function-extrapolation-python 5.66101 "BENCH:  2.00613808632"
+(2014, 11, 13, 5, 41, 2) function-extrapolation-python 2.00614 "BENCH:  2.00613808632"
+(2014, 11, 13, 5, 41, 4) function-interpolation-python 2.26246 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 13, 5, 41, 4) function-interpolation-python 0.914194 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 13, 5, 43, 35) la-vector-access-cpp 151.179 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 13, 5, 44, 13) la-vector-assignment-cpp 38.0234 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 14, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9115 "BENCH 10.9115"
+(2014, 11, 14, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2506 "Building point search tree to accelerate distance queries."
+(2014, 11, 14, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.293 "BENCH 14.293"
+(2014, 11, 14, 2, 9, 48) common-progress-cpp 27.8781 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 14, 2, 10, 18) common-timing-cpp 30.0494 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 14, 2, 11, 52) fem-convergence-cpp 3.93225 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 14, 2, 11, 53) fem-jit-python 0.000420403 "JIT compilation (in memory cache)"
+(2014, 11, 14, 5, 26, 7) mesh-refinement-cpp 8.58126 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 14, 5, 26, 29) mesh-topology-cpp 21.714 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 14, 5, 26, 52) mesh-unitcube-cpp 23.5037 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 14, 5, 27, 44) mesh-iteration-cpp 48.6059 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 14, 5, 27, 44) function-evaluation-cpp 0.074435 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 14, 5, 27, 49) function-extrapolation-python 5.64376 "BENCH:  2.02567696571"
+(2014, 11, 14, 5, 27, 49) function-extrapolation-python 2.02568 "BENCH:  2.02567696571"
+(2014, 11, 14, 5, 27, 52) function-interpolation-python 2.25691 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 14, 5, 27, 52) function-interpolation-python 0.916077 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 14, 5, 30, 22) la-vector-access-cpp 150.757 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 14, 5, 31, 0) la-vector-assignment-cpp 38.006 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 15, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.087 "BENCH 11.087"
+(2014, 11, 15, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0689 "Building point search tree to accelerate distance queries."
+(2014, 11, 15, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.192 "BENCH 14.192"
+(2014, 11, 15, 2, 9, 47) common-progress-cpp 27.8543 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 15, 2, 10, 18) common-timing-cpp 30.55 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 15, 2, 11, 52) fem-convergence-cpp 3.84475 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 15, 2, 11, 53) fem-jit-python 0.0004246 "JIT compilation (in memory cache)"
+(2014, 11, 15, 5, 32, 49) mesh-refinement-cpp 8.58526 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 15, 5, 33, 11) mesh-topology-cpp 21.7255 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 15, 5, 33, 34) mesh-unitcube-cpp 23.4851 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 15, 5, 34, 16) mesh-iteration-cpp 39.1772 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 15, 5, 34, 16) function-evaluation-cpp 0.074549 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 15, 5, 34, 22) function-extrapolation-python 5.69328 "BENCH:  2.02185893059"
+(2014, 11, 15, 5, 34, 22) function-extrapolation-python 2.02186 "BENCH:  2.02185893059"
+(2014, 11, 15, 5, 34, 24) function-interpolation-python 2.24235 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 15, 5, 34, 24) function-interpolation-python 0.89334 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 15, 5, 36, 55) la-vector-access-cpp 150.67 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 15, 5, 37, 33) la-vector-assignment-cpp 38.0204 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 16, 2, 8, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.004 "BENCH 11.004"
+(2014, 11, 16, 2, 8, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.123 "Building point search tree to accelerate distance queries."
+(2014, 11, 16, 2, 9, 15) geometry-bounding_box_tree_build-cpp 14.1946 "BENCH 14.1946"
+(2014, 11, 16, 2, 9, 43) common-progress-cpp 27.9543 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 16, 2, 10, 13) common-timing-cpp 30.5193 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 16, 2, 11, 48) fem-convergence-cpp 3.90808 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 16, 2, 11, 49) fem-jit-python 0.000424409 "JIT compilation (in memory cache)"
+(2014, 11, 16, 5, 25, 48) mesh-refinement-cpp 8.58584 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 16, 5, 26, 9) mesh-topology-cpp 21.6329 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 16, 5, 26, 33) mesh-unitcube-cpp 23.5097 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 16, 5, 27, 19) mesh-iteration-cpp 43.573 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 16, 5, 27, 19) function-evaluation-cpp 0.0525801 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 16, 5, 27, 25) function-extrapolation-python 5.83663 "BENCH:  1.9994969368"
+(2014, 11, 16, 5, 27, 25) function-extrapolation-python 1.9995 "BENCH:  1.9994969368"
+(2014, 11, 16, 5, 27, 27) function-interpolation-python 2.27689 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 16, 5, 27, 27) function-interpolation-python 0.890873 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 16, 5, 29, 58) la-vector-access-cpp 151.263 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 16, 5, 30, 41) la-vector-assignment-cpp 42.0294 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 17, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.036 "BENCH 11.036"
+(2014, 11, 17, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1217 "Building point search tree to accelerate distance queries."
+(2014, 11, 17, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.1482 "BENCH 14.1482"
+(2014, 11, 17, 2, 9, 45) common-progress-cpp 27.8894 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 17, 2, 10, 16) common-timing-cpp 30.9943 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 17, 2, 11, 50) fem-convergence-cpp 3.82643 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 17, 2, 11, 52) fem-jit-python 0.000437403 "JIT compilation (in memory cache)"
+(2014, 11, 17, 5, 28, 47) mesh-refinement-cpp 8.66925 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 17, 5, 29, 9) mesh-topology-cpp 22.0489 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 17, 5, 29, 33) mesh-unitcube-cpp 23.486 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 17, 5, 30, 15) mesh-iteration-cpp 39.3997 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 17, 5, 30, 15) function-evaluation-cpp 0.081877 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 17, 5, 30, 21) function-extrapolation-python 5.91871 "BENCH:  2.08673191071"
+(2014, 11, 17, 5, 30, 21) function-extrapolation-python 2.08673 "BENCH:  2.08673191071"
+(2014, 11, 17, 5, 30, 23) function-interpolation-python 2.30621 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 17, 5, 30, 23) function-interpolation-python 0.9142 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 17, 5, 32, 54) la-vector-access-cpp 151.086 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 17, 5, 33, 36) la-vector-assignment-cpp 42.0217 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 18, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1254 "BENCH 11.1254"
+(2014, 11, 18, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2841 "Building point search tree to accelerate distance queries."
+(2014, 11, 18, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.4065 "BENCH 14.4065"
+(2014, 11, 18, 2, 9, 53) common-progress-cpp 32.9163 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 18, 2, 10, 24) common-timing-cpp 31.3074 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 18, 2, 11, 58) fem-convergence-cpp 3.86259 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 18, 2, 11, 59) fem-jit-python 0.000422192 "JIT compilation (in memory cache)"
+(2014, 11, 18, 5, 27, 11) mesh-refinement-cpp 8.83404 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 18, 5, 27, 33) mesh-topology-cpp 22.1794 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 18, 5, 27, 57) mesh-unitcube-cpp 23.8075 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 18, 5, 28, 39) mesh-iteration-cpp 39.4131 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 18, 5, 28, 39) function-evaluation-cpp 0.0959661 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 18, 5, 28, 45) function-extrapolation-python 5.56272 "BENCH:  2.11515712738"
+(2014, 11, 18, 5, 28, 45) function-extrapolation-python 2.11516 "BENCH:  2.11515712738"
+(2014, 11, 18, 5, 28, 47) function-interpolation-python 2.29952 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 18, 5, 28, 47) function-interpolation-python 0.92317 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 18, 5, 31, 18) la-vector-access-cpp 151.127 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 18, 5, 31, 56) la-vector-assignment-cpp 38.0277 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 19, 2, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0342 "BENCH 11.0342"
+(2014, 11, 19, 2, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.544 "Building point search tree to accelerate distance queries."
+(2014, 11, 19, 2, 9, 21) geometry-bounding_box_tree_build-cpp 14.2308 "BENCH 14.2308"
+(2014, 11, 19, 2, 9, 49) common-progress-cpp 27.892 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 19, 2, 10, 20) common-timing-cpp 30.8986 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 19, 2, 11, 55) fem-convergence-cpp 3.83568 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 19, 2, 11, 56) fem-jit-python 0.000417686 "JIT compilation (in memory cache)"
+(2014, 11, 19, 5, 31, 54) mesh-refinement-cpp 8.57422 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 19, 5, 32, 16) mesh-topology-cpp 21.7366 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 19, 5, 32, 39) mesh-unitcube-cpp 23.4858 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 19, 5, 33, 21) mesh-iteration-cpp 39.4001 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 19, 5, 33, 21) function-evaluation-cpp 0.0863519 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 19, 5, 33, 27) function-extrapolation-python 5.98273 "BENCH:  2.08429694176"
+(2014, 11, 19, 5, 33, 27) function-extrapolation-python 2.0843 "BENCH:  2.08429694176"
+(2014, 11, 19, 5, 33, 30) function-interpolation-python 2.32928 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 19, 5, 33, 30) function-interpolation-python 0.911104 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 19, 5, 36, 1) la-vector-access-cpp 151.457 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 19, 5, 36, 39) la-vector-assignment-cpp 38.0183 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 20, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0335 "BENCH 11.0335"
+(2014, 11, 20, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1808 "Building point search tree to accelerate distance queries."
+(2014, 11, 20, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.0261 "BENCH 14.0261"
+(2014, 11, 20, 2, 9, 50) common-progress-cpp 32.9025 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 20, 2, 10, 20) common-timing-cpp 30.1239 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 20, 2, 11, 54) fem-convergence-cpp 3.84419 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 20, 2, 11, 55) fem-jit-python 0.000416613 "JIT compilation (in memory cache)"
+(2014, 11, 20, 5, 27, 21) mesh-refinement-cpp 8.45026 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 20, 5, 27, 43) mesh-topology-cpp 21.4819 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 20, 5, 28, 6) mesh-unitcube-cpp 23.1853 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 20, 5, 28, 52) mesh-iteration-cpp 43.5634 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 20, 5, 28, 52) function-evaluation-cpp 0.078639 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 20, 5, 28, 58) function-extrapolation-python 5.6746 "BENCH:  2.0331017971"
+(2014, 11, 20, 5, 28, 58) function-extrapolation-python 2.0331 "BENCH:  2.0331017971"
+(2014, 11, 20, 5, 29, 0) function-interpolation-python 2.2375 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 20, 5, 29, 0) function-interpolation-python 0.880509 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 20, 5, 31, 31) la-vector-access-cpp 151.229 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 20, 5, 32, 13) la-vector-assignment-cpp 42.001 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 21, 2, 8, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.155 "BENCH 11.155"
+(2014, 11, 21, 2, 8, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2205 "Building point search tree to accelerate distance queries."
+(2014, 11, 21, 2, 9, 14) geometry-bounding_box_tree_build-cpp 14.2611 "BENCH 14.2611"
+(2014, 11, 21, 2, 9, 42) common-progress-cpp 27.8924 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 21, 2, 10, 12) common-timing-cpp 30.5561 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 21, 2, 11, 47) fem-convergence-cpp 3.85588 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 21, 2, 11, 49) fem-jit-python 0.000424194 "JIT compilation (in memory cache)"
+(2014, 11, 21, 5, 40, 13) mesh-refinement-cpp 8.51906 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 21, 5, 40, 35) mesh-topology-cpp 21.7448 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 21, 5, 40, 59) mesh-unitcube-cpp 23.4332 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 21, 5, 41, 41) mesh-iteration-cpp 39.4074 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 21, 5, 41, 41) function-evaluation-cpp 0.109499 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 21, 5, 41, 47) function-extrapolation-python 5.69102 "BENCH:  2.08780217171"
+(2014, 11, 21, 5, 41, 47) function-extrapolation-python 2.0878 "BENCH:  2.08780217171"
+(2014, 11, 21, 5, 41, 49) function-interpolation-python 2.28101 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 21, 5, 41, 49) function-interpolation-python 0.904316 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 21, 5, 44, 20) la-vector-access-cpp 151.489 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 21, 5, 44, 58) la-vector-assignment-cpp 38.0209 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 22, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0283 "BENCH 11.0283"
+(2014, 11, 22, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0228 "Building point search tree to accelerate distance queries."
+(2014, 11, 22, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.1958 "BENCH 14.1958"
+(2014, 11, 22, 2, 9, 47) common-progress-cpp 27.8488 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 22, 2, 10, 17) common-timing-cpp 30.6715 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 22, 2, 11, 53) fem-convergence-cpp 3.9171 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 22, 2, 11, 54) fem-jit-python 0.00042448 "JIT compilation (in memory cache)"
+(2014, 11, 22, 5, 39, 43) mesh-refinement-cpp 8.59384 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 22, 5, 40, 5) mesh-topology-cpp 21.8222 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 22, 5, 40, 29) mesh-unitcube-cpp 23.8658 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 22, 5, 41, 11) mesh-iteration-cpp 39.4028 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 22, 5, 41, 11) function-evaluation-cpp 0.079587 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 22, 5, 41, 17) function-extrapolation-python 5.81155 "BENCH:  2.11507296562"
+(2014, 11, 22, 5, 41, 17) function-extrapolation-python 2.11507 "BENCH:  2.11507296562"
+(2014, 11, 22, 5, 41, 20) function-interpolation-python 2.31685 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 22, 5, 41, 20) function-interpolation-python 0.907344 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 22, 5, 43, 51) la-vector-access-cpp 151.516 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 22, 5, 44, 29) la-vector-assignment-cpp 38.0251 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 23, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9392 "BENCH 10.9392"
+(2014, 11, 23, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8783 "Building point search tree to accelerate distance queries."
+(2014, 11, 23, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.3036 "BENCH 14.3036"
+(2014, 11, 23, 2, 9, 47) common-progress-cpp 27.8971 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 23, 2, 10, 17) common-timing-cpp 30.4252 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 23, 2, 11, 52) fem-convergence-cpp 3.89475 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 23, 2, 11, 53) fem-jit-python 0.000417113 "JIT compilation (in memory cache)"
+(2014, 11, 23, 5, 36, 26) mesh-refinement-cpp 8.46508 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 23, 5, 36, 48) mesh-topology-cpp 21.4844 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 23, 5, 37, 11) mesh-unitcube-cpp 23.1917 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 23, 5, 37, 52) mesh-iteration-cpp 39.1774 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 23, 5, 37, 52) function-evaluation-cpp 0.0744219 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 23, 5, 37, 58) function-extrapolation-python 5.81166 "BENCH:  2.03416991234"
+(2014, 11, 23, 5, 37, 58) function-extrapolation-python 2.03417 "BENCH:  2.03416991234"
+(2014, 11, 23, 5, 38, 1) function-interpolation-python 2.22093 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 23, 5, 38, 1) function-interpolation-python 0.880612 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 23, 5, 40, 32) la-vector-access-cpp 151.184 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 23, 5, 41, 10) la-vector-assignment-cpp 37.9549 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 24, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9971 "BENCH 10.9971"
+(2014, 11, 24, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5678 "Building point search tree to accelerate distance queries."
+(2014, 11, 24, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.3415 "BENCH 14.3415"
+(2014, 11, 24, 2, 9, 46) common-progress-cpp 27.8817 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 24, 2, 10, 16) common-timing-cpp 30.0517 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 24, 2, 11, 50) fem-convergence-cpp 3.8862 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 24, 2, 11, 51) fem-jit-python 0.000428391 "JIT compilation (in memory cache)"
+(2014, 11, 24, 5, 28, 21) mesh-refinement-cpp 8.48427 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 24, 5, 28, 43) mesh-topology-cpp 21.462 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 24, 5, 29, 6) mesh-unitcube-cpp 23.2037 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 24, 5, 29, 48) mesh-iteration-cpp 39.1804 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 24, 5, 29, 48) function-evaluation-cpp 0.0750339 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 24, 5, 29, 54) function-extrapolation-python 5.64656 "BENCH:  2.02073216438"
+(2014, 11, 24, 5, 29, 54) function-extrapolation-python 2.02073 "BENCH:  2.02073216438"
+(2014, 11, 24, 5, 29, 56) function-interpolation-python 2.25768 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 24, 5, 29, 56) function-interpolation-python 0.884494 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 24, 5, 32, 27) la-vector-access-cpp 151.206 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 24, 5, 33, 5) la-vector-assignment-cpp 37.9962 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 25, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9472 "BENCH 10.9472"
+(2014, 11, 25, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0149 "Building point search tree to accelerate distance queries."
+(2014, 11, 25, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.2869 "BENCH 14.2869"
+(2014, 11, 25, 2, 9, 45) common-progress-cpp 27.8959 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 25, 2, 10, 16) common-timing-cpp 30.1409 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 25, 2, 11, 50) fem-convergence-cpp 3.87457 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 25, 2, 11, 52) fem-jit-python 0.000413322 "JIT compilation (in memory cache)"
+(2014, 11, 25, 5, 32, 4) mesh-refinement-cpp 8.44344 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 25, 5, 32, 26) mesh-topology-cpp 21.3319 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 25, 5, 32, 49) mesh-unitcube-cpp 23.2974 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 25, 5, 33, 30) mesh-iteration-cpp 39.1706 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 25, 5, 33, 31) function-evaluation-cpp 0.0742581 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 25, 5, 33, 36) function-extrapolation-python 5.79533 "BENCH:  2.02150583267"
+(2014, 11, 25, 5, 33, 36) function-extrapolation-python 2.02151 "BENCH:  2.02150583267"
+(2014, 11, 25, 5, 33, 39) function-interpolation-python 2.21199 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 25, 5, 33, 39) function-interpolation-python 0.879973 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 25, 5, 36, 10) la-vector-access-cpp 151.17 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 25, 5, 36, 48) la-vector-assignment-cpp 38.0043 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 26, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.2882 "BENCH 11.2882"
+(2014, 11, 26, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5724 "Building point search tree to accelerate distance queries."
+(2014, 11, 26, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.3579 "BENCH 14.3579"
+(2014, 11, 26, 2, 9, 46) common-progress-cpp 27.9743 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 26, 2, 10, 16) common-timing-cpp 30.6618 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 26, 2, 11, 52) fem-convergence-cpp 3.92183 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 26, 2, 11, 54) fem-jit-python 0.000416613 "JIT compilation (in memory cache)"
+(2014, 11, 26, 5, 27, 14) mesh-refinement-cpp 8.42394 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 26, 5, 27, 35) mesh-topology-cpp 21.4659 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 26, 5, 27, 58) mesh-unitcube-cpp 23.0631 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 26, 5, 28, 36) mesh-iteration-cpp 35.5572 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 26, 5, 28, 36) function-evaluation-cpp 0.0495212 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 26, 5, 28, 42) function-extrapolation-python 5.58798 "BENCH:  2.0147550106"
+(2014, 11, 26, 5, 28, 42) function-extrapolation-python 2.01476 "BENCH:  2.0147550106"
+(2014, 11, 26, 5, 28, 44) function-interpolation-python 2.2327 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 26, 5, 28, 44) function-interpolation-python 0.900616 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 26, 5, 31, 16) la-vector-access-cpp 151.215 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 26, 5, 31, 58) la-vector-assignment-cpp 42.0126 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 27, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.2077 "BENCH 11.2077"
+(2014, 11, 27, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0056 "Building point search tree to accelerate distance queries."
+(2014, 11, 27, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.3457 "BENCH 14.3457"
+(2014, 11, 27, 2, 9, 51) common-progress-cpp 32.9151 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 27, 2, 10, 21) common-timing-cpp 30.1639 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 27, 2, 11, 56) fem-convergence-cpp 3.88184 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 27, 2, 11, 57) fem-jit-python 0.000427699 "JIT compilation (in memory cache)"
+(2014, 11, 27, 5, 23, 30) mesh-refinement-cpp 8.55183 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 27, 5, 23, 51) mesh-topology-cpp 21.4173 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 27, 5, 24, 15) mesh-unitcube-cpp 23.5162 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 27, 5, 24, 53) mesh-iteration-cpp 36.0379 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 27, 5, 24, 54) function-evaluation-cpp 0.0579078 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 27, 5, 24, 59) function-extrapolation-python 5.73823 "BENCH:  2.04011201859"
+(2014, 11, 27, 5, 24, 59) function-extrapolation-python 2.04011 "BENCH:  2.04011201859"
+(2014, 11, 27, 5, 25, 2) function-interpolation-python 2.28077 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 27, 5, 25, 2) function-interpolation-python 0.911958 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 27, 5, 27, 33) la-vector-access-cpp 151.071 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 27, 5, 28, 11) la-vector-assignment-cpp 38.0186 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 28, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1795 "BENCH 11.1795"
+(2014, 11, 28, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3544 "Building point search tree to accelerate distance queries."
+(2014, 11, 28, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.3571 "BENCH 14.3571"
+(2014, 11, 28, 2, 9, 47) common-progress-cpp 27.8828 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 28, 2, 10, 17) common-timing-cpp 29.6392 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 28, 2, 11, 50) fem-convergence-cpp 3.82646 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 28, 2, 11, 51) fem-jit-python 0.000423193 "JIT compilation (in memory cache)"
+(2014, 11, 28, 5, 19, 11) mesh-refinement-cpp 8.44101 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 28, 5, 19, 33) mesh-topology-cpp 21.5348 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 28, 5, 19, 56) mesh-unitcube-cpp 23.4426 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 28, 5, 20, 35) mesh-iteration-cpp 36.05 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 28, 5, 20, 35) function-evaluation-cpp 0.060262 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 28, 5, 20, 41) function-extrapolation-python 5.98987 "BENCH:  2.0201189518"
+(2014, 11, 28, 5, 20, 41) function-extrapolation-python 2.02012 "BENCH:  2.0201189518"
+(2014, 11, 28, 5, 20, 43) function-interpolation-python 2.25485 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 28, 5, 20, 43) function-interpolation-python 0.889753 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 28, 5, 23, 15) la-vector-access-cpp 152.218 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 28, 5, 23, 55) la-vector-assignment-cpp 39.5606 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 29, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1398 "BENCH 11.1398"
+(2014, 11, 29, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.5481 "Building point search tree to accelerate distance queries."
+(2014, 11, 29, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.267 "BENCH 14.267"
+(2014, 11, 29, 2, 9, 47) common-progress-cpp 27.8978 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 29, 2, 10, 17) common-timing-cpp 29.9774 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 29, 2, 11, 51) fem-convergence-cpp 3.83514 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 29, 2, 11, 52) fem-jit-python 0.000418687 "JIT compilation (in memory cache)"
+(2014, 11, 29, 5, 26, 59) mesh-refinement-cpp 8.41353 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 29, 5, 27, 21) mesh-topology-cpp 21.5866 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 29, 5, 27, 44) mesh-unitcube-cpp 23.2291 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 29, 5, 28, 25) mesh-iteration-cpp 39.1754 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 29, 5, 28, 25) function-evaluation-cpp 0.0584619 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 29, 5, 28, 31) function-extrapolation-python 5.84035 "BENCH:  2.02479100227"
+(2014, 11, 29, 5, 28, 31) function-extrapolation-python 2.02479 "BENCH:  2.02479100227"
+(2014, 11, 29, 5, 28, 34) function-interpolation-python 2.23139 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 29, 5, 28, 34) function-interpolation-python 0.891395 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 29, 5, 31, 5) la-vector-access-cpp 151.218 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 29, 5, 31, 43) la-vector-assignment-cpp 38.0125 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 11, 30, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1433 "BENCH 11.1433"
+(2014, 11, 30, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9586 "Building point search tree to accelerate distance queries."
+(2014, 11, 30, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2624 "BENCH 14.2624"
+(2014, 11, 30, 2, 9, 44) common-progress-cpp 27.9769 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 11, 30, 2, 10, 14) common-timing-cpp 30.4883 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 11, 30, 2, 11, 48) fem-convergence-cpp 3.87806 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 11, 30, 2, 11, 49) fem-jit-python 0.000415802 "JIT compilation (in memory cache)"
+(2014, 11, 30, 5, 30, 9) mesh-refinement-cpp 8.42986 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 11, 30, 5, 30, 31) mesh-topology-cpp 21.5223 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 11, 30, 5, 30, 54) mesh-unitcube-cpp 23.1856 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 11, 30, 5, 31, 32) mesh-iteration-cpp 35.5686 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 11, 30, 5, 31, 32) function-evaluation-cpp 0.0887389 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 11, 30, 5, 31, 39) function-extrapolation-python 6.09071 "BENCH:  2.0510430336"
+(2014, 11, 30, 5, 31, 39) function-extrapolation-python 2.05104 "BENCH:  2.0510430336"
+(2014, 11, 30, 5, 31, 41) function-interpolation-python 2.22844 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 30, 5, 31, 41) function-interpolation-python 0.896044 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 11, 30, 5, 34, 12) la-vector-access-cpp 151.219 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 11, 30, 5, 34, 50) la-vector-assignment-cpp 38.0233 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 1, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1623 "BENCH 11.1623"
+(2014, 12, 1, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0995 "Building point search tree to accelerate distance queries."
+(2014, 12, 1, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.1981 "BENCH 14.1981"
+(2014, 12, 1, 2, 9, 44) common-progress-cpp 27.9516 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 1, 2, 10, 15) common-timing-cpp 30.7541 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 1, 2, 11, 50) fem-convergence-cpp 3.89599 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 1, 2, 11, 51) fem-jit-python 0.00042851 "JIT compilation (in memory cache)"
+(2014, 12, 1, 5, 24, 3) mesh-refinement-cpp 8.43002 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 1, 5, 24, 25) mesh-topology-cpp 21.3613 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 1, 5, 24, 48) mesh-unitcube-cpp 23.2172 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 1, 5, 25, 26) mesh-iteration-cpp 35.5725 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 1, 5, 25, 26) function-evaluation-cpp 0.072073 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 1, 5, 25, 32) function-extrapolation-python 5.53547 "BENCH:  2.01897788048"
+(2014, 12, 1, 5, 25, 32) function-extrapolation-python 2.01898 "BENCH:  2.01897788048"
+(2014, 12, 1, 5, 25, 34) function-interpolation-python 2.21438 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 1, 5, 25, 34) function-interpolation-python 0.891385 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 1, 5, 28, 7) la-vector-access-cpp 153.215 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 1, 5, 28, 49) la-vector-assignment-cpp 42.0255 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 2, 2, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1611 "BENCH 11.1611"
+(2014, 12, 2, 2, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1738 "Building point search tree to accelerate distance queries."
+(2014, 12, 2, 2, 9, 21) geometry-bounding_box_tree_build-cpp 14.2546 "BENCH 14.2546"
+(2014, 12, 2, 2, 9, 49) common-progress-cpp 27.8803 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 2, 2, 10, 20) common-timing-cpp 30.6836 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 2, 2, 11, 55) fem-convergence-cpp 3.87538 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 2, 2, 11, 56) fem-jit-python 0.000425696 "JIT compilation (in memory cache)"
+(2014, 12, 2, 5, 26, 1) mesh-refinement-cpp 8.44052 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 2, 5, 26, 23) mesh-topology-cpp 21.5855 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 2, 5, 26, 46) mesh-unitcube-cpp 23.1677 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 2, 5, 27, 24) mesh-iteration-cpp 35.5527 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 2, 5, 27, 24) function-evaluation-cpp 0.06847 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 2, 5, 27, 30) function-extrapolation-python 5.71011 "BENCH:  2.02131605148"
+(2014, 12, 2, 5, 27, 30) function-extrapolation-python 2.02132 "BENCH:  2.02131605148"
+(2014, 12, 2, 5, 27, 32) function-interpolation-python 2.24553 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 2, 5, 27, 32) function-interpolation-python 0.894265 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 2, 5, 30, 2) la-vector-access-cpp 150.528 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 2, 5, 30, 40) la-vector-assignment-cpp 38.017 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 3, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9466 "BENCH 10.9466"
+(2014, 12, 3, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0225 "Building point search tree to accelerate distance queries."
+(2014, 12, 3, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.3543 "BENCH 14.3543"
+(2014, 12, 3, 2, 9, 45) common-progress-cpp 27.8943 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 3, 2, 10, 15) common-timing-cpp 30.0983 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 3, 2, 11, 50) fem-convergence-cpp 3.83692 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 3, 2, 11, 51) fem-jit-python 0.000436497 "JIT compilation (in memory cache)"
+(2014, 12, 3, 5, 30, 45) mesh-refinement-cpp 8.57648 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 3, 5, 31, 6) mesh-topology-cpp 21.2971 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 3, 5, 31, 30) mesh-unitcube-cpp 23.8189 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 3, 5, 32, 8) mesh-iteration-cpp 35.5158 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 3, 5, 32, 8) function-evaluation-cpp 0.0638831 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 3, 5, 32, 14) function-extrapolation-python 6.07975 "BENCH:  2.04424977303"
+(2014, 12, 3, 5, 32, 14) function-extrapolation-python 2.04425 "BENCH:  2.04424977303"
+(2014, 12, 3, 5, 32, 16) function-interpolation-python 2.24729 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 3, 5, 32, 16) function-interpolation-python 0.92166 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 3, 5, 35, 5) la-vector-access-cpp 168.557 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 3, 5, 35, 43) la-vector-assignment-cpp 38.0319 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 4, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0513 "BENCH 11.0513"
+(2014, 12, 4, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2148 "Building point search tree to accelerate distance queries."
+(2014, 12, 4, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.4316 "BENCH 14.4316"
+(2014, 12, 4, 2, 9, 47) common-progress-cpp 27.8767 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 4, 2, 10, 18) common-timing-cpp 30.3181 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 4, 2, 11, 51) fem-convergence-cpp 3.83863 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 4, 2, 11, 52) fem-jit-python 0.000419307 "JIT compilation (in memory cache)"
+(2014, 12, 4, 5, 32, 28) mesh-refinement-cpp 8.53671 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 4, 5, 32, 50) mesh-topology-cpp 21.3068 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 4, 5, 33, 14) mesh-unitcube-cpp 23.9496 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 4, 5, 33, 52) mesh-iteration-cpp 35.5017 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 4, 5, 33, 52) function-evaluation-cpp 0.080543 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 4, 5, 33, 58) function-extrapolation-python 6.09157 "BENCH:  2.20002579689"
+(2014, 12, 4, 5, 33, 58) function-extrapolation-python 2.20003 "BENCH:  2.20002579689"
+(2014, 12, 4, 5, 34, 0) function-interpolation-python 2.42382 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 4, 5, 34, 0) function-interpolation-python 1.00143 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 4, 5, 36, 39) la-vector-access-cpp 158.871 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 4, 5, 37, 17) la-vector-assignment-cpp 38.028 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 5, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0552 "BENCH 11.0552"
+(2014, 12, 5, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0921 "Building point search tree to accelerate distance queries."
+(2014, 12, 5, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.2181 "BENCH 14.2181"
+(2014, 12, 5, 2, 9, 47) common-progress-cpp 27.8756 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 5, 2, 10, 18) common-timing-cpp 31.0291 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 5, 2, 11, 52) fem-convergence-cpp 3.90746 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 5, 2, 11, 54) fem-jit-python 0.000413585 "JIT compilation (in memory cache)"
+(2014, 12, 5, 5, 29, 58) mesh-refinement-cpp 8.57406 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 5, 5, 30, 19) mesh-topology-cpp 21.3319 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 5, 5, 30, 43) mesh-unitcube-cpp 23.8515 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 5, 5, 31, 25) mesh-iteration-cpp 39.1826 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 5, 5, 31, 25) function-evaluation-cpp 0.051332 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 5, 5, 31, 30) function-extrapolation-python 5.64393 "BENCH:  2.02772808075"
+(2014, 12, 5, 5, 31, 30) function-extrapolation-python 2.02773 "BENCH:  2.02772808075"
+(2014, 12, 5, 5, 31, 33) function-interpolation-python 2.26315 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 5, 5, 31, 33) function-interpolation-python 0.926614 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 5, 5, 34, 6) la-vector-access-cpp 153.202 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 5, 5, 34, 44) la-vector-assignment-cpp 38.0257 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 6, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.0331 "BENCH 11.0331"
+(2014, 12, 6, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.003 "Building point search tree to accelerate distance queries."
+(2014, 12, 6, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.2856 "BENCH 14.2856"
+(2014, 12, 6, 2, 9, 48) common-progress-cpp 27.8982 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 6, 2, 10, 19) common-timing-cpp 30.8003 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 6, 2, 11, 54) fem-convergence-cpp 3.9381 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 6, 2, 11, 55) fem-jit-python 0.000418901 "JIT compilation (in memory cache)"
+(2014, 12, 6, 5, 26, 14) mesh-refinement-cpp 8.57738 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 6, 5, 26, 36) mesh-topology-cpp 21.5417 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 6, 5, 26, 59) mesh-unitcube-cpp 23.8586 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 6, 5, 27, 37) mesh-iteration-cpp 35.4949 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 6, 5, 27, 37) function-evaluation-cpp 0.0511379 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 6, 5, 27, 43) function-extrapolation-python 5.74341 "BENCH:  2.01074385643"
+(2014, 12, 6, 5, 27, 43) function-extrapolation-python 2.01074 "BENCH:  2.01074385643"
+(2014, 12, 6, 5, 27, 46) function-interpolation-python 2.26593 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 6, 5, 27, 46) function-interpolation-python 0.921959 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 6, 5, 30, 23) la-vector-access-cpp 157.206 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 6, 5, 31, 1) la-vector-assignment-cpp 38.0292 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 7, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 10.9062 "BENCH 10.9062"
+(2014, 12, 7, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.404 "Building point search tree to accelerate distance queries."
+(2014, 12, 7, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2632 "BENCH 14.2632"
+(2014, 12, 7, 2, 9, 44) common-progress-cpp 27.8752 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 7, 2, 10, 14) common-timing-cpp 30.1152 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 7, 2, 11, 49) fem-convergence-cpp 3.83022 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 7, 2, 11, 51) fem-jit-python 0.000415301 "JIT compilation (in memory cache)"
+(2014, 12, 7, 5, 45, 30) mesh-refinement-cpp 8.76469 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 7, 5, 45, 52) mesh-topology-cpp 21.5272 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 7, 5, 46, 16) mesh-unitcube-cpp 24.0883 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 7, 5, 46, 57) mesh-iteration-cpp 38.8052 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 7, 5, 46, 57) function-evaluation-cpp 0.0768728 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 7, 5, 47, 3) function-extrapolation-python 5.75214 "BENCH:  2.06273508072"
+(2014, 12, 7, 5, 47, 3) function-extrapolation-python 2.06274 "BENCH:  2.06273508072"
+(2014, 12, 7, 5, 47, 6) function-interpolation-python 2.37832 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 7, 5, 47, 6) function-interpolation-python 0.940044 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 7, 5, 49, 39) la-vector-access-cpp 153.685 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 7, 5, 50, 21) la-vector-assignment-cpp 42.0184 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 8, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1775 "BENCH 11.1775"
+(2014, 12, 8, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4396 "Building point search tree to accelerate distance queries."
+(2014, 12, 8, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.2997 "BENCH 14.2997"
+(2014, 12, 8, 2, 9, 46) common-progress-cpp 27.8902 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 8, 2, 10, 16) common-timing-cpp 29.6516 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 8, 2, 11, 51) fem-convergence-cpp 3.8878 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 8, 2, 11, 52) fem-jit-python 0.000425696 "JIT compilation (in memory cache)"
+(2014, 12, 8, 5, 32, 5) mesh-refinement-cpp 8.59314 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 8, 5, 32, 26) mesh-topology-cpp 21.2677 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 8, 5, 32, 50) mesh-unitcube-cpp 23.8049 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 8, 5, 33, 28) mesh-iteration-cpp 35.5715 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 8, 5, 33, 28) function-evaluation-cpp 0.0513871 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 8, 5, 33, 34) function-extrapolation-python 5.79644 "BENCH:  2.00842189789"
+(2014, 12, 8, 5, 33, 34) function-extrapolation-python 2.00842 "BENCH:  2.00842189789"
+(2014, 12, 8, 5, 33, 36) function-interpolation-python 2.27048 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 8, 5, 33, 36) function-interpolation-python 0.926154 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 8, 5, 36, 14) la-vector-access-cpp 157.006 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 8, 5, 36, 52) la-vector-assignment-cpp 38.0143 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 9, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 11.1356 "BENCH 11.1356"
+(2014, 12, 9, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1201 "Building point search tree to accelerate distance queries."
+(2014, 12, 9, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.3785 "BENCH 14.3785"
+(2014, 12, 9, 2, 9, 46) common-progress-cpp 27.8935 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 9, 2, 10, 16) common-timing-cpp 30.0126 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 9, 2, 11, 51) fem-convergence-cpp 3.85427 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 9, 2, 11, 52) fem-jit-python 0.000422192 "JIT compilation (in memory cache)"
+(2014, 12, 9, 5, 33, 2) mesh-refinement-cpp 8.72281 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 9, 5, 33, 23) mesh-topology-cpp 21.5446 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 9, 5, 33, 48) mesh-unitcube-cpp 24.0808 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 9, 5, 34, 26) mesh-iteration-cpp 35.9119 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 9, 5, 34, 26) function-evaluation-cpp 0.0855582 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 9, 5, 34, 32) function-extrapolation-python 5.89859 "BENCH:  2.13737511635"
+(2014, 12, 9, 5, 34, 32) function-extrapolation-python 2.13738 "BENCH:  2.13737511635"
+(2014, 12, 9, 5, 34, 34) function-interpolation-python 2.36377 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 9, 5, 34, 34) function-interpolation-python 0.972647 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 9, 5, 37, 8) la-vector-access-cpp 153.706 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 9, 5, 37, 46) la-vector-assignment-cpp 38.0243 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 10, 2, 8, 51) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.9057 "BENCH 13.9057"
+(2014, 12, 10, 2, 9, 9) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1701 "Building point search tree to accelerate distance queries."
+(2014, 12, 10, 2, 9, 26) geometry-bounding_box_tree_build-cpp 14.2647 "BENCH 14.2647"
+(2014, 12, 10, 2, 9, 54) common-progress-cpp 27.8819 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 10, 2, 10, 23) common-timing-cpp 29.186 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 10, 2, 11, 57) fem-convergence-cpp 3.90364 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 10, 2, 11, 58) fem-jit-python 0.000419903 "JIT compilation (in memory cache)"
+(2014, 12, 10, 5, 28, 49) mesh-refinement-cpp 8.60041 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 10, 5, 29, 10) mesh-topology-cpp 21.3144 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 10, 5, 29, 34) mesh-unitcube-cpp 23.8885 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 10, 5, 30, 13) mesh-iteration-cpp 36.0084 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 10, 5, 30, 13) function-evaluation-cpp 0.051332 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 10, 5, 30, 19) function-extrapolation-python 5.83498 "BENCH:  2.05190706253"
+(2014, 12, 10, 5, 30, 19) function-extrapolation-python 2.05191 "BENCH:  2.05190706253"
+(2014, 12, 10, 5, 30, 21) function-interpolation-python 2.28131 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 10, 5, 30, 21) function-interpolation-python 0.935288 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 10, 5, 32, 56) la-vector-access-cpp 155.26 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 10, 5, 33, 34) la-vector-assignment-cpp 38.0555 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 11, 2, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8314 "BENCH 12.8314"
+(2014, 12, 11, 2, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9006 "Building point search tree to accelerate distance queries."
+(2014, 12, 11, 2, 9, 22) geometry-bounding_box_tree_build-cpp 14.2316 "BENCH 14.2316"
+(2014, 12, 11, 2, 9, 50) common-progress-cpp 27.8976 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 11, 2, 10, 20) common-timing-cpp 29.7156 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 11, 2, 11, 53) fem-convergence-cpp 3.88637 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 11, 2, 11, 55) fem-jit-python 0.000425005 "JIT compilation (in memory cache)"
+(2014, 12, 11, 5, 36, 47) mesh-refinement-cpp 8.51818 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 11, 5, 37, 8) mesh-topology-cpp 21.4174 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 11, 5, 37, 32) mesh-unitcube-cpp 23.8422 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 11, 5, 38, 23) mesh-iteration-cpp 48.5165 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 11, 5, 38, 23) function-evaluation-cpp 0.0513809 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 11, 5, 38, 29) function-extrapolation-python 5.93456 "BENCH:  1.99134087563"
+(2014, 12, 11, 5, 38, 29) function-extrapolation-python 1.99134 "BENCH:  1.99134087563"
+(2014, 12, 11, 5, 38, 31) function-interpolation-python 2.25299 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 11, 5, 38, 31) function-interpolation-python 0.910212 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 11, 5, 41, 7) la-vector-access-cpp 155.317 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 11, 5, 41, 45) la-vector-assignment-cpp 38.0423 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 12, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1017 "BENCH 13.1017"
+(2014, 12, 12, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4417 "Building point search tree to accelerate distance queries."
+(2014, 12, 12, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.2022 "BENCH 14.2022"
+(2014, 12, 12, 2, 9, 48) common-progress-cpp 27.9017 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 12, 2, 10, 19) common-timing-cpp 30.9786 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 12, 2, 11, 53) fem-convergence-cpp 3.88432 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 12, 2, 11, 54) fem-jit-python 0.000429106 "JIT compilation (in memory cache)"
+(2014, 12, 12, 5, 24, 57) mesh-refinement-cpp 8.47242 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 12, 5, 25, 19) mesh-topology-cpp 21.8559 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 12, 5, 25, 42) mesh-unitcube-cpp 22.8273 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 12, 5, 26, 28) mesh-iteration-cpp 43.5774 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 12, 5, 26, 28) function-evaluation-cpp 0.053828 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 12, 5, 26, 33) function-extrapolation-python 5.49019 "BENCH:  2.01706314087"
+(2014, 12, 12, 5, 26, 33) function-extrapolation-python 2.01706 "BENCH:  2.01706314087"
+(2014, 12, 12, 5, 26, 36) function-interpolation-python 2.27918 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 12, 5, 26, 36) function-interpolation-python 0.953322 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 12, 5, 29, 8) la-vector-access-cpp 152.701 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 12, 5, 29, 46) la-vector-assignment-cpp 38.0115 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 13, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0859 "BENCH 13.0859"
+(2014, 12, 13, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4561 "Building point search tree to accelerate distance queries."
+(2014, 12, 13, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.1995 "BENCH 14.1995"
+(2014, 12, 13, 2, 9, 48) common-progress-cpp 27.9003 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 13, 2, 10, 18) common-timing-cpp 30.6068 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 13, 2, 11, 53) fem-convergence-cpp 3.88772 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 13, 2, 11, 55) fem-jit-python 0.000417399 "JIT compilation (in memory cache)"
+(2014, 12, 13, 5, 28, 57) mesh-refinement-cpp 8.40802 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 13, 5, 29, 18) mesh-topology-cpp 21.6505 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 13, 5, 29, 41) mesh-unitcube-cpp 22.8536 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 13, 5, 30, 23) mesh-iteration-cpp 39.1799 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 13, 5, 30, 23) function-evaluation-cpp 0.0537529 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 13, 5, 30, 29) function-extrapolation-python 5.78319 "BENCH:  2.02463197708"
+(2014, 12, 13, 5, 30, 29) function-extrapolation-python 2.02463 "BENCH:  2.02463197708"
+(2014, 12, 13, 5, 30, 31) function-interpolation-python 2.27945 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 13, 5, 30, 31) function-interpolation-python 0.953687 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 13, 5, 33, 7) la-vector-access-cpp 155.699 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 13, 5, 33, 49) la-vector-assignment-cpp 42.0067 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 14, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0771 "BENCH 13.0771"
+(2014, 12, 14, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3546 "Building point search tree to accelerate distance queries."
+(2014, 12, 14, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.2997 "BENCH 14.2997"
+(2014, 12, 14, 2, 9, 48) common-progress-cpp 27.9107 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 14, 2, 10, 19) common-timing-cpp 30.9396 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 14, 2, 11, 54) fem-convergence-cpp 3.93471 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 14, 2, 11, 56) fem-jit-python 0.000420117 "JIT compilation (in memory cache)"
+(2014, 12, 14, 5, 17, 31) mesh-refinement-cpp 8.45236 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 14, 5, 17, 53) mesh-topology-cpp 21.8024 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 14, 5, 18, 16) mesh-unitcube-cpp 22.7846 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 14, 5, 18, 57) mesh-iteration-cpp 39.176 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 14, 5, 18, 58) function-evaluation-cpp 0.074486 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 14, 5, 19, 3) function-extrapolation-python 5.62811 "BENCH:  2.0052549839"
+(2014, 12, 14, 5, 19, 3) function-extrapolation-python 2.00525 "BENCH:  2.0052549839"
+(2014, 12, 14, 5, 19, 6) function-interpolation-python 2.30022 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 14, 5, 19, 6) function-interpolation-python 0.957675 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 14, 5, 21, 39) la-vector-access-cpp 153.766 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 14, 5, 22, 17) la-vector-assignment-cpp 38.01 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 15, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1915 "BENCH 13.1915"
+(2014, 12, 15, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1045 "Building point search tree to accelerate distance queries."
+(2014, 12, 15, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.2413 "BENCH 14.2413"
+(2014, 12, 15, 2, 9, 48) common-progress-cpp 27.9807 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 15, 2, 10, 18) common-timing-cpp 30.7174 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 15, 2, 11, 53) fem-convergence-cpp 3.847 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 15, 2, 11, 54) fem-jit-python 0.000411701 "JIT compilation (in memory cache)"
+(2014, 12, 15, 5, 28, 13) mesh-refinement-cpp 8.43813 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 15, 5, 28, 35) mesh-topology-cpp 21.5852 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 15, 5, 28, 58) mesh-unitcube-cpp 22.8495 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 15, 5, 29, 39) mesh-iteration-cpp 39.1754 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 15, 5, 29, 39) function-evaluation-cpp 0.053679 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 15, 5, 29, 45) function-extrapolation-python 5.98334 "BENCH:  2.00072407722"
+(2014, 12, 15, 5, 29, 45) function-extrapolation-python 2.00072 "BENCH:  2.00072407722"
+(2014, 12, 15, 5, 29, 48) function-interpolation-python 2.26344 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 15, 5, 29, 48) function-interpolation-python 0.928461 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 15, 5, 32, 20) la-vector-access-cpp 152.714 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 15, 5, 33, 2) la-vector-assignment-cpp 42.0198 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 16, 2, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1309 "BENCH 13.1309"
+(2014, 12, 16, 2, 9, 6) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0919 "Building point search tree to accelerate distance queries."
+(2014, 12, 16, 2, 9, 22) geometry-bounding_box_tree_build-cpp 14.2994 "BENCH 14.2994"
+(2014, 12, 16, 2, 9, 50) common-progress-cpp 27.8915 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 16, 2, 10, 21) common-timing-cpp 30.5716 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 16, 2, 11, 56) fem-convergence-cpp 3.87463 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 16, 2, 11, 57) fem-jit-python 0.000426102 "JIT compilation (in memory cache)"
+(2014, 12, 16, 5, 38, 39) mesh-refinement-cpp 8.57738 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 16, 5, 39, 1) mesh-topology-cpp 21.8224 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 16, 5, 39, 24) mesh-unitcube-cpp 23.0424 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 16, 5, 40, 7) mesh-iteration-cpp 40.6312 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 16, 5, 40, 7) function-evaluation-cpp 0.106404 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 16, 5, 40, 13) function-extrapolation-python 5.64746 "BENCH:  2.09751391411"
+(2014, 12, 16, 5, 40, 13) function-extrapolation-python 2.09751 "BENCH:  2.09751391411"
+(2014, 12, 16, 5, 40, 15) function-interpolation-python 2.37509 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 16, 5, 40, 15) function-interpolation-python 0.954701 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 16, 5, 42, 49) la-vector-access-cpp 154.045 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 16, 5, 43, 31) la-vector-assignment-cpp 41.9887 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 17, 2, 8, 53) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0108 "BENCH 13.0108"
+(2014, 12, 17, 2, 9, 12) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2991 "Building point search tree to accelerate distance queries."
+(2014, 12, 17, 2, 9, 29) geometry-bounding_box_tree_build-cpp 14.2865 "BENCH 14.2865"
+(2014, 12, 17, 2, 9, 57) common-progress-cpp 27.8872 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 17, 2, 10, 27) common-timing-cpp 30.4421 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 17, 2, 12, 1) fem-convergence-cpp 3.88998 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 17, 2, 12, 2) fem-jit-python 0.000418687 "JIT compilation (in memory cache)"
+(2014, 12, 17, 5, 40, 1) mesh-refinement-cpp 8.47739 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 17, 5, 40, 23) mesh-topology-cpp 21.6157 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 17, 5, 40, 47) mesh-unitcube-cpp 23.2545 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 17, 5, 41, 28) mesh-iteration-cpp 39.1765 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 17, 5, 41, 28) function-evaluation-cpp 0.049916 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 17, 5, 41, 34) function-extrapolation-python 5.80313 "BENCH:  2.00367093086"
+(2014, 12, 17, 5, 41, 34) function-extrapolation-python 2.00367 "BENCH:  2.00367093086"
+(2014, 12, 17, 5, 41, 36) function-interpolation-python 2.2558 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 17, 5, 41, 36) function-interpolation-python 0.930046 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 17, 5, 44, 10) la-vector-access-cpp 153.955 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 17, 5, 44, 48) la-vector-assignment-cpp 38.1429 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 18, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9899 "BENCH 12.9899"
+(2014, 12, 18, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3152 "Building point search tree to accelerate distance queries."
+(2014, 12, 18, 2, 9, 21) geometry-bounding_box_tree_build-cpp 14.347 "BENCH 14.347"
+(2014, 12, 18, 2, 9, 48) common-progress-cpp 27.8795 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 18, 2, 10, 19) common-timing-cpp 30.7719 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 18, 2, 11, 53) fem-convergence-cpp 3.86956 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 18, 2, 11, 54) fem-jit-python 0.000414109 "JIT compilation (in memory cache)"
+(2014, 12, 18, 5, 23, 42) mesh-refinement-cpp 8.4328 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 18, 5, 24, 5) mesh-topology-cpp 21.8284 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 18, 5, 24, 28) mesh-unitcube-cpp 23.1051 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 18, 5, 25, 9) mesh-iteration-cpp 39.1977 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 18, 5, 25, 10) function-evaluation-cpp 0.0723219 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 18, 5, 25, 15) function-extrapolation-python 5.59039 "BENCH:  2.02850008011"
+(2014, 12, 18, 5, 25, 15) function-extrapolation-python 2.0285 "BENCH:  2.02850008011"
+(2014, 12, 18, 5, 25, 17) function-interpolation-python 2.26601 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 18, 5, 25, 17) function-interpolation-python 0.923468 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 18, 5, 27, 51) la-vector-access-cpp 153.461 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 18, 5, 28, 33) la-vector-assignment-cpp 42.3102 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 19, 2, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0998 "BENCH 13.0998"
+(2014, 12, 19, 2, 9, 6) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1642 "Building point search tree to accelerate distance queries."
+(2014, 12, 19, 2, 9, 22) geometry-bounding_box_tree_build-cpp 14.1554 "BENCH 14.1554"
+(2014, 12, 19, 2, 9, 50) common-progress-cpp 27.8847 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 19, 2, 10, 21) common-timing-cpp 30.4001 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 19, 2, 11, 55) fem-convergence-cpp 3.86711 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 19, 2, 11, 56) fem-jit-python 0.000420117 "JIT compilation (in memory cache)"
+(2014, 12, 19, 5, 32, 13) mesh-refinement-cpp 8.44807 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 19, 5, 32, 35) mesh-topology-cpp 21.8598 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 19, 5, 32, 58) mesh-unitcube-cpp 23.1617 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 19, 5, 33, 40) mesh-iteration-cpp 39.1825 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 19, 5, 33, 40) function-evaluation-cpp 0.0514779 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 19, 5, 33, 46) function-extrapolation-python 5.69784 "BENCH:  2.00138998032"
+(2014, 12, 19, 5, 33, 46) function-extrapolation-python 2.00139 "BENCH:  2.00138998032"
+(2014, 12, 19, 5, 33, 48) function-interpolation-python 2.25231 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 19, 5, 33, 48) function-interpolation-python 0.925456 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 19, 5, 36, 23) la-vector-access-cpp 154.753 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 19, 5, 37, 5) la-vector-assignment-cpp 42.1489 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 23, 2, 8, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0205 "BENCH 13.0205"
+(2014, 12, 23, 2, 8, 54) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9105 "Building point search tree to accelerate distance queries."
+(2014, 12, 23, 2, 9, 11) geometry-bounding_box_tree_build-cpp 14.1741 "BENCH 14.1741"
+(2014, 12, 23, 2, 9, 38) common-progress-cpp 27.8771 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 23, 2, 10, 10) common-timing-cpp 31.1484 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 23, 2, 11, 44) fem-convergence-cpp 3.86662 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 23, 2, 11, 46) fem-jit-python 0.000421095 "JIT compilation (in memory cache)"
+(2014, 12, 23, 5, 32, 31) mesh-refinement-cpp 8.57416 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 23, 5, 32, 53) mesh-topology-cpp 21.4062 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 23, 5, 33, 16) mesh-unitcube-cpp 23.3596 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 23, 5, 33, 55) mesh-iteration-cpp 36.7639 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 23, 5, 33, 55) function-evaluation-cpp 0.0537641 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 23, 5, 34, 1) function-extrapolation-python 5.63767 "BENCH:  2.00522613525"
+(2014, 12, 23, 5, 34, 1) function-extrapolation-python 2.00523 "BENCH:  2.00522613525"
+(2014, 12, 23, 5, 34, 3) function-interpolation-python 2.2847 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 23, 5, 34, 3) function-interpolation-python 0.95027 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 23, 5, 36, 41) la-vector-access-cpp 157.199 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 23, 5, 37, 19) la-vector-assignment-cpp 38.026 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 24, 2, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.4929 "BENCH 13.4929"
+(2014, 12, 24, 2, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3121 "Building point search tree to accelerate distance queries."
+(2014, 12, 24, 2, 9, 22) geometry-bounding_box_tree_build-cpp 14.222 "BENCH 14.222"
+(2014, 12, 24, 2, 9, 50) common-progress-cpp 27.8882 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 24, 2, 10, 21) common-timing-cpp 31.0581 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 24, 2, 11, 54) fem-convergence-cpp 3.84017 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 24, 2, 11, 56) fem-jit-python 0.000421405 "JIT compilation (in memory cache)"
+(2014, 12, 24, 5, 20, 7) mesh-refinement-cpp 8.43344 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 24, 5, 20, 29) mesh-topology-cpp 21.3469 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 24, 5, 20, 52) mesh-unitcube-cpp 23.3858 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 24, 5, 21, 30) mesh-iteration-cpp 36.0824 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 24, 5, 21, 31) function-evaluation-cpp 0.0537429 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 24, 5, 21, 36) function-extrapolation-python 5.52536 "BENCH:  2.00918698311"
+(2014, 12, 24, 5, 21, 36) function-extrapolation-python 2.00919 "BENCH:  2.00918698311"
+(2014, 12, 24, 5, 21, 38) function-interpolation-python 2.25565 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 24, 5, 21, 38) function-interpolation-python 0.921512 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 24, 5, 24, 10) la-vector-access-cpp 151.65 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 24, 5, 24, 48) la-vector-assignment-cpp 38.0048 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 25, 2, 8, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0325 "BENCH 13.0325"
+(2014, 12, 25, 2, 8, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1388 "Building point search tree to accelerate distance queries."
+(2014, 12, 25, 2, 9, 15) geometry-bounding_box_tree_build-cpp 14.4462 "BENCH 14.4462"
+(2014, 12, 25, 2, 9, 43) common-progress-cpp 27.8902 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 25, 2, 10, 14) common-timing-cpp 30.8919 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 25, 2, 11, 48) fem-convergence-cpp 3.83714 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 25, 2, 11, 50) fem-jit-python 0.00042119 "JIT compilation (in memory cache)"
+(2014, 12, 25, 5, 27, 15) mesh-refinement-cpp 8.3942 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 25, 5, 27, 37) mesh-topology-cpp 21.6328 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 25, 5, 28, 0) mesh-unitcube-cpp 22.8113 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 25, 5, 28, 38) mesh-iteration-cpp 35.5434 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 25, 5, 28, 38) function-evaluation-cpp 0.0523801 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 25, 5, 28, 44) function-extrapolation-python 5.8692 "BENCH:  2.01356601715"
+(2014, 12, 25, 5, 28, 44) function-extrapolation-python 2.01357 "BENCH:  2.01356601715"
+(2014, 12, 25, 5, 28, 46) function-interpolation-python 2.27188 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 25, 5, 28, 46) function-interpolation-python 0.928945 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 25, 5, 31, 18) la-vector-access-cpp 152.156 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 25, 5, 31, 56) la-vector-assignment-cpp 38.0173 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 26, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.043 "BENCH 13.043"
+(2014, 12, 26, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1618 "Building point search tree to accelerate distance queries."
+(2014, 12, 26, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2187 "BENCH 14.2187"
+(2014, 12, 26, 2, 9, 44) common-progress-cpp 27.8859 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 26, 2, 10, 15) common-timing-cpp 30.6585 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 26, 2, 11, 50) fem-convergence-cpp 3.87689 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 26, 2, 11, 51) fem-jit-python 0.000415802 "JIT compilation (in memory cache)"
+(2014, 12, 26, 5, 14, 5) mesh-refinement-cpp 8.36464 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 26, 5, 14, 26) mesh-topology-cpp 21.3147 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 26, 5, 14, 49) mesh-unitcube-cpp 22.8014 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 26, 5, 15, 27) mesh-iteration-cpp 35.5059 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 26, 5, 15, 27) function-evaluation-cpp 0.0761781 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 26, 5, 15, 33) function-extrapolation-python 5.6102 "BENCH:  2.00827407837"
+(2014, 12, 26, 5, 15, 33) function-extrapolation-python 2.00827 "BENCH:  2.00827407837"
+(2014, 12, 26, 5, 15, 35) function-interpolation-python 2.26896 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 26, 5, 15, 35) function-interpolation-python 0.926316 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 26, 5, 18, 7) la-vector-access-cpp 152.149 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 26, 5, 18, 45) la-vector-assignment-cpp 38.0188 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 27, 2, 8, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9544 "BENCH 12.9544"
+(2014, 12, 27, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2534 "Building point search tree to accelerate distance queries."
+(2014, 12, 27, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.1478 "BENCH 14.1478"
+(2014, 12, 27, 2, 9, 43) common-progress-cpp 27.8693 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 27, 2, 10, 15) common-timing-cpp 31.483 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 27, 2, 11, 50) fem-convergence-cpp 3.84296 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 27, 2, 11, 51) fem-jit-python 0.000421095 "JIT compilation (in memory cache)"
+(2014, 12, 27, 5, 21, 10) mesh-refinement-cpp 8.37553 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 27, 5, 21, 32) mesh-topology-cpp 21.412 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 27, 5, 21, 54) mesh-unitcube-cpp 22.7872 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 27, 5, 22, 32) mesh-iteration-cpp 35.5673 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 27, 5, 22, 32) function-evaluation-cpp 0.0704529 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 27, 5, 22, 38) function-extrapolation-python 5.79081 "BENCH:  1.9982919693"
+(2014, 12, 27, 5, 22, 38) function-extrapolation-python 1.99829 "BENCH:  1.9982919693"
+(2014, 12, 27, 5, 22, 41) function-interpolation-python 2.29557 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 27, 5, 22, 41) function-interpolation-python 0.929562 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 27, 5, 25, 13) la-vector-access-cpp 152.055 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 27, 5, 25, 52) la-vector-assignment-cpp 39.5414 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 28, 2, 8, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9989 "BENCH 12.9989"
+(2014, 12, 28, 2, 8, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0488 "Building point search tree to accelerate distance queries."
+(2014, 12, 28, 2, 9, 15) geometry-bounding_box_tree_build-cpp 14.2363 "BENCH 14.2363"
+(2014, 12, 28, 2, 9, 43) common-progress-cpp 27.9004 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 28, 2, 10, 13) common-timing-cpp 30.1166 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 28, 2, 11, 47) fem-convergence-cpp 3.84924 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 28, 2, 11, 49) fem-jit-python 0.000420213 "JIT compilation (in memory cache)"
+(2014, 12, 28, 5, 21, 52) mesh-refinement-cpp 8.38026 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 28, 5, 22, 13) mesh-topology-cpp 21.3829 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 28, 5, 22, 36) mesh-unitcube-cpp 22.7971 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 28, 5, 23, 14) mesh-iteration-cpp 35.5507 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 28, 5, 23, 14) function-evaluation-cpp 0.074311 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 28, 5, 23, 20) function-extrapolation-python 5.86704 "BENCH:  2.00494098663"
+(2014, 12, 28, 5, 23, 20) function-extrapolation-python 2.00494 "BENCH:  2.00494098663"
+(2014, 12, 28, 5, 23, 22) function-interpolation-python 2.26242 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 28, 5, 23, 22) function-interpolation-python 0.936496 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 28, 5, 25, 55) la-vector-access-cpp 152.168 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 28, 5, 26, 34) la-vector-assignment-cpp 39.6396 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 29, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.7379 "BENCH 13.7379"
+(2014, 12, 29, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2807 "Building point search tree to accelerate distance queries."
+(2014, 12, 29, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.3613 "BENCH 14.3613"
+(2014, 12, 29, 2, 9, 46) common-progress-cpp 27.8795 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 29, 2, 10, 16) common-timing-cpp 30.5232 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 29, 2, 11, 53) fem-convergence-cpp 3.82216 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 29, 2, 11, 54) fem-jit-python 0.000424385 "JIT compilation (in memory cache)"
+(2014, 12, 29, 5, 30, 24) mesh-refinement-cpp 8.2567 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 29, 5, 30, 46) mesh-topology-cpp 21.6195 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 29, 5, 31, 9) mesh-unitcube-cpp 22.5672 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 29, 5, 31, 47) mesh-iteration-cpp 35.5462 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 29, 5, 31, 47) function-evaluation-cpp 0.0515208 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 29, 5, 31, 53) function-extrapolation-python 6.11285 "BENCH:  2.00217986107"
+(2014, 12, 29, 5, 31, 53) function-extrapolation-python 2.00218 "BENCH:  2.00217986107"
+(2014, 12, 29, 5, 31, 55) function-interpolation-python 2.25533 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 29, 5, 31, 55) function-interpolation-python 0.911716 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 29, 5, 34, 56) la-vector-access-cpp 180.299 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 29, 5, 35, 34) la-vector-assignment-cpp 38.0125 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 30, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1599 "BENCH 13.1599"
+(2014, 12, 30, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2722 "Building point search tree to accelerate distance queries."
+(2014, 12, 30, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.2412 "BENCH 14.2412"
+(2014, 12, 30, 2, 9, 48) common-progress-cpp 27.8842 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 30, 2, 10, 18) common-timing-cpp 29.9201 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 30, 2, 11, 54) fem-convergence-cpp 3.8754 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 30, 2, 11, 55) fem-jit-python 0.000415802 "JIT compilation (in memory cache)"
+(2014, 12, 30, 5, 23, 12) mesh-refinement-cpp 8.34546 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 30, 5, 23, 34) mesh-topology-cpp 21.6367 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 30, 5, 23, 57) mesh-unitcube-cpp 22.8416 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 30, 5, 24, 39) mesh-iteration-cpp 39.1713 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 30, 5, 24, 39) function-evaluation-cpp 0.074703 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 30, 5, 24, 44) function-extrapolation-python 5.64559 "BENCH:  2.01603007317"
+(2014, 12, 30, 5, 24, 44) function-extrapolation-python 2.01603 "BENCH:  2.01603007317"
+(2014, 12, 30, 5, 24, 47) function-interpolation-python 2.23919 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 30, 5, 24, 47) function-interpolation-python 0.904289 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 30, 5, 27, 45) la-vector-access-cpp 178.718 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 30, 5, 28, 27) la-vector-assignment-cpp 41.9852 "Assigning to vector of size 10000000 (100 repetitions)"
+(2014, 12, 31, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0906 "BENCH 13.0906"
+(2014, 12, 31, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0515 "Building point search tree to accelerate distance queries."
+(2014, 12, 31, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.1686 "BENCH 14.1686"
+(2014, 12, 31, 2, 9, 48) common-progress-cpp 27.8896 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2014, 12, 31, 2, 10, 19) common-timing-cpp 30.5862 "Timing access and registration of timings (10000000 repetitions)"
+(2014, 12, 31, 2, 11, 54) fem-convergence-cpp 3.83313 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2014, 12, 31, 2, 11, 55) fem-jit-python 0.00042758 "JIT compilation (in memory cache)"
+(2014, 12, 31, 5, 34, 16) mesh-refinement-cpp 8.3458 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2014, 12, 31, 5, 34, 37) mesh-topology-cpp 21.5631 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2014, 12, 31, 5, 35, 0) mesh-unitcube-cpp 22.5946 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2014, 12, 31, 5, 35, 38) mesh-iteration-cpp 35.5439 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2014, 12, 31, 5, 35, 38) function-evaluation-cpp 0.057802 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2014, 12, 31, 5, 35, 44) function-extrapolation-python 5.75814 "BENCH:  2.01219081879"
+(2014, 12, 31, 5, 35, 44) function-extrapolation-python 2.01219 "BENCH:  2.01219081879"
+(2014, 12, 31, 5, 35, 46) function-interpolation-python 2.24748 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 31, 5, 35, 46) function-interpolation-python 0.911566 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2014, 12, 31, 5, 38, 45) la-vector-access-cpp 178.298 "Accessing vector of size 10000000 (100 repetitions)"
+(2014, 12, 31, 5, 39, 23) la-vector-assignment-cpp 38.0089 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 1, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0587 "BENCH 13.0587"
+(2015, 1, 1, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9975 "Building point search tree to accelerate distance queries."
+(2015, 1, 1, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.3001 "BENCH 14.3001"
+(2015, 1, 1, 2, 9, 46) common-progress-cpp 27.8824 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 1, 2, 10, 15) common-timing-cpp 29.7459 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 1, 2, 11, 50) fem-convergence-cpp 3.87901 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 1, 2, 11, 51) fem-jit-python 0.000419617 "JIT compilation (in memory cache)"
+(2015, 1, 1, 5, 19, 52) mesh-refinement-cpp 8.297 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 1, 5, 20, 13) mesh-topology-cpp 21.3629 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 1, 5, 20, 36) mesh-unitcube-cpp 22.3229 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 1, 5, 21, 14) mesh-iteration-cpp 35.5587 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 1, 5, 21, 14) function-evaluation-cpp 0.055769 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 1, 5, 21, 20) function-extrapolation-python 5.90148 "BENCH:  2.0072247982"
+(2015, 1, 1, 5, 21, 20) function-extrapolation-python 2.00722 "BENCH:  2.0072247982"
+(2015, 1, 1, 5, 21, 22) function-interpolation-python 2.26069 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 1, 5, 21, 22) function-interpolation-python 0.908384 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 1, 5, 24, 22) la-vector-access-cpp 180.358 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 1, 5, 25, 0) la-vector-assignment-cpp 38.0083 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 2, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3204 "BENCH 13.3204"
+(2015, 1, 2, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1585 "Building point search tree to accelerate distance queries."
+(2015, 1, 2, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.1261 "BENCH 14.1261"
+(2015, 1, 2, 2, 9, 45) common-progress-cpp 27.9043 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 2, 2, 10, 14) common-timing-cpp 29.7639 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 2, 2, 11, 49) fem-convergence-cpp 3.84597 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 2, 2, 11, 51) fem-jit-python 0.000416017 "JIT compilation (in memory cache)"
+(2015, 1, 2, 5, 22, 36) mesh-refinement-cpp 8.2922 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 2, 5, 22, 58) mesh-topology-cpp 21.5705 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 2, 5, 23, 21) mesh-unitcube-cpp 22.5825 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 2, 5, 23, 59) mesh-iteration-cpp 35.5596 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 2, 5, 23, 59) function-evaluation-cpp 0.0744019 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 2, 5, 24, 5) function-extrapolation-python 5.96587 "BENCH:  1.99899816513"
+(2015, 1, 2, 5, 24, 5) function-extrapolation-python 1.999 "BENCH:  1.99899816513"
+(2015, 1, 2, 5, 24, 7) function-interpolation-python 2.28387 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 2, 5, 24, 7) function-interpolation-python 0.914806 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 2, 5, 27, 5) la-vector-access-cpp 177.815 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 2, 5, 27, 43) la-vector-assignment-cpp 38.024 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 3, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.5334 "BENCH 13.5334"
+(2015, 1, 3, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1997 "Building point search tree to accelerate distance queries."
+(2015, 1, 3, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2138 "BENCH 14.2138"
+(2015, 1, 3, 2, 9, 44) common-progress-cpp 27.8864 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 3, 2, 10, 13) common-timing-cpp 29.6123 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 3, 2, 11, 48) fem-convergence-cpp 3.81842 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 3, 2, 11, 50) fem-jit-python 0.000417399 "JIT compilation (in memory cache)"
+(2015, 1, 3, 5, 32, 46) mesh-refinement-cpp 8.33575 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 3, 5, 33, 7) mesh-topology-cpp 21.6951 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 3, 5, 33, 30) mesh-unitcube-cpp 22.7261 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 3, 5, 34, 16) mesh-iteration-cpp 42.928 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 3, 5, 34, 16) function-evaluation-cpp 0.0763421 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 3, 5, 34, 22) function-extrapolation-python 5.82072 "BENCH:  2.00965189934"
+(2015, 1, 3, 5, 34, 22) function-extrapolation-python 2.00965 "BENCH:  2.00965189934"
+(2015, 1, 3, 5, 34, 24) function-interpolation-python 2.24636 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 3, 5, 34, 24) function-interpolation-python 0.919411 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 3, 5, 37, 24) la-vector-access-cpp 180.672 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 3, 5, 38, 3) la-vector-assignment-cpp 38.0143 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 4, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0676 "BENCH 13.0676"
+(2015, 1, 4, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9599 "Building point search tree to accelerate distance queries."
+(2015, 1, 4, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.3822 "BENCH 14.3822"
+(2015, 1, 4, 2, 9, 44) common-progress-cpp 27.9026 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 4, 2, 10, 13) common-timing-cpp 29.3578 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 4, 2, 11, 49) fem-convergence-cpp 3.84838 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 4, 2, 11, 51) fem-jit-python 0.000413513 "JIT compilation (in memory cache)"
+(2015, 1, 4, 5, 17, 24) mesh-refinement-cpp 8.37261 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 4, 5, 17, 45) mesh-topology-cpp 21.5224 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 4, 5, 18, 8) mesh-unitcube-cpp 22.6913 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 4, 5, 18, 46) mesh-iteration-cpp 35.4926 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 4, 5, 18, 46) function-evaluation-cpp 0.0520051 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 4, 5, 18, 52) function-extrapolation-python 5.62222 "BENCH:  2.00227999687"
+(2015, 1, 4, 5, 18, 52) function-extrapolation-python 2.00228 "BENCH:  2.00227999687"
+(2015, 1, 4, 5, 18, 54) function-interpolation-python 2.25625 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 4, 5, 18, 54) function-interpolation-python 0.921135 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 4, 5, 22, 20) la-vector-access-cpp 205.464 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 4, 5, 22, 58) la-vector-assignment-cpp 38.0132 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 5, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1085 "BENCH 13.1085"
+(2015, 1, 5, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2546 "Building point search tree to accelerate distance queries."
+(2015, 1, 5, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2243 "BENCH 14.2243"
+(2015, 1, 5, 2, 9, 44) common-progress-cpp 27.884 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 5, 2, 10, 13) common-timing-cpp 29.1849 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 5, 2, 11, 49) fem-convergence-cpp 3.82368 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 5, 2, 11, 50) fem-jit-python 0.000422812 "JIT compilation (in memory cache)"
+(2015, 1, 5, 5, 23, 26) mesh-refinement-cpp 8.3452 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 5, 5, 23, 48) mesh-topology-cpp 21.6097 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 5, 5, 24, 11) mesh-unitcube-cpp 22.7151 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 5, 5, 24, 49) mesh-iteration-cpp 35.5421 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 5, 5, 24, 49) function-evaluation-cpp 0.0556581 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 5, 5, 24, 55) function-extrapolation-python 5.83613 "BENCH:  2.01349687576"
+(2015, 1, 5, 5, 24, 55) function-extrapolation-python 2.0135 "BENCH:  2.01349687576"
+(2015, 1, 5, 5, 24, 57) function-interpolation-python 2.25661 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 5, 5, 24, 57) function-interpolation-python 0.913172 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 5, 5, 27, 57) la-vector-access-cpp 180.376 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 5, 5, 28, 36) la-vector-assignment-cpp 38.0147 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 6, 2, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3748 "BENCH 13.3748"
+(2015, 1, 6, 2, 9, 6) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2036 "Building point search tree to accelerate distance queries."
+(2015, 1, 6, 2, 9, 23) geometry-bounding_box_tree_build-cpp 14.1506 "BENCH 14.1506"
+(2015, 1, 6, 2, 9, 50) common-progress-cpp 27.8925 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 6, 2, 10, 20) common-timing-cpp 29.9094 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 6, 2, 11, 56) fem-convergence-cpp 3.80816 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 6, 2, 11, 57) fem-jit-python 0.000406003 "JIT compilation (in memory cache)"
+(2015, 1, 6, 5, 27, 33) mesh-refinement-cpp 8.34632 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 6, 5, 27, 55) mesh-topology-cpp 21.7033 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 6, 5, 28, 17) mesh-unitcube-cpp 22.756 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 6, 5, 28, 55) mesh-iteration-cpp 35.489 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 6, 5, 28, 56) function-evaluation-cpp 0.072443 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 6, 5, 29, 4) function-extrapolation-python 8.38209 "BENCH:  2.16803002357"
+(2015, 1, 6, 5, 29, 4) function-extrapolation-python 2.16803 "BENCH:  2.16803002357"
+(2015, 1, 6, 5, 29, 6) function-interpolation-python 2.46719 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 6, 5, 29, 6) function-interpolation-python 0.922065 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 6, 5, 32, 11) la-vector-access-cpp 184.665 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 6, 5, 32, 49) la-vector-assignment-cpp 38.0218 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 7, 2, 8, 49) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1593 "BENCH 13.1593"
+(2015, 1, 7, 2, 9, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8902 "Building point search tree to accelerate distance queries."
+(2015, 1, 7, 2, 9, 24) geometry-bounding_box_tree_build-cpp 14.2057 "BENCH 14.2057"
+(2015, 1, 7, 2, 9, 52) common-progress-cpp 27.8808 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 7, 2, 10, 22) common-timing-cpp 29.726 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 7, 2, 11, 57) fem-convergence-cpp 3.83448 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 7, 2, 11, 59) fem-jit-python 0.000418019 "JIT compilation (in memory cache)"
+(2015, 1, 7, 5, 31, 59) mesh-refinement-cpp 8.35124 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 7, 5, 32, 21) mesh-topology-cpp 21.4891 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 7, 5, 32, 43) mesh-unitcube-cpp 22.7289 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 7, 5, 33, 24) mesh-iteration-cpp 38.5672 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 7, 5, 33, 24) function-evaluation-cpp 0.0537319 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 7, 5, 33, 30) function-extrapolation-python 5.59979 "BENCH:  2.02233314514"
+(2015, 1, 7, 5, 33, 30) function-extrapolation-python 2.02233 "BENCH:  2.02233314514"
+(2015, 1, 7, 5, 33, 32) function-interpolation-python 2.27106 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 7, 5, 33, 32) function-interpolation-python 0.919375 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 7, 5, 36, 30) la-vector-access-cpp 177.862 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 7, 5, 37, 8) la-vector-assignment-cpp 38.0527 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 8, 2, 8, 51) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1278 "BENCH 13.1278"
+(2015, 1, 8, 2, 9, 10) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1927 "Building point search tree to accelerate distance queries."
+(2015, 1, 8, 2, 9, 26) geometry-bounding_box_tree_build-cpp 14.1781 "BENCH 14.1781"
+(2015, 1, 8, 2, 9, 58) common-progress-cpp 31.6574 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 8, 2, 10, 27) common-timing-cpp 29.116 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 8, 2, 12, 3) fem-convergence-cpp 3.84759 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 8, 2, 12, 4) fem-jit-python 0.000414586 "JIT compilation (in memory cache)"
+(2015, 1, 8, 5, 40, 4) mesh-refinement-cpp 8.34765 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 8, 5, 40, 26) mesh-topology-cpp 21.5923 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 8, 5, 40, 49) mesh-unitcube-cpp 22.7214 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 8, 5, 41, 27) mesh-iteration-cpp 35.5546 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 8, 5, 41, 27) function-evaluation-cpp 0.0580332 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 8, 5, 41, 33) function-extrapolation-python 5.70398 "BENCH:  2.01378583908"
+(2015, 1, 8, 5, 41, 33) function-extrapolation-python 2.01379 "BENCH:  2.01378583908"
+(2015, 1, 8, 5, 41, 35) function-interpolation-python 2.26885 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 8, 5, 41, 35) function-interpolation-python 0.916959 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 8, 5, 44, 34) la-vector-access-cpp 178.486 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 8, 5, 45, 12) la-vector-assignment-cpp 38.3204 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 9, 2, 8, 50) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2731 "BENCH 13.2731"
+(2015, 1, 9, 2, 9, 9) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1343 "Building point search tree to accelerate distance queries."
+(2015, 1, 9, 2, 9, 25) geometry-bounding_box_tree_build-cpp 14.2723 "BENCH 14.2723"
+(2015, 1, 9, 2, 9, 53) common-progress-cpp 27.9066 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 9, 2, 10, 23) common-timing-cpp 29.8519 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 9, 2, 12, 0) fem-convergence-cpp 3.90938 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 9, 2, 12, 1) fem-jit-python 0.000414896 "JIT compilation (in memory cache)"
+(2015, 1, 9, 5, 21, 40) mesh-refinement-cpp 8.34622 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 9, 5, 22, 2) mesh-topology-cpp 21.5423 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 9, 5, 22, 25) mesh-unitcube-cpp 22.7429 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 9, 5, 23, 3) mesh-iteration-cpp 35.5506 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 9, 5, 23, 3) function-evaluation-cpp 0.0746551 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 9, 5, 23, 9) function-extrapolation-python 6.0087 "BENCH:  2.00626206398"
+(2015, 1, 9, 5, 23, 9) function-extrapolation-python 2.00626 "BENCH:  2.00626206398"
+(2015, 1, 9, 5, 23, 11) function-interpolation-python 2.28338 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 9, 5, 23, 11) function-interpolation-python 0.920552 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 9, 5, 26, 9) la-vector-access-cpp 177.845 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 9, 5, 26, 51) la-vector-assignment-cpp 42.02 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 10, 2, 8, 49) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8081 "BENCH 12.8081"
+(2015, 1, 10, 2, 9, 8) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2087 "Building point search tree to accelerate distance queries."
+(2015, 1, 10, 2, 9, 24) geometry-bounding_box_tree_build-cpp 14.3514 "BENCH 14.3514"
+(2015, 1, 10, 2, 9, 52) common-progress-cpp 27.8845 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 10, 2, 10, 23) common-timing-cpp 30.8278 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 10, 2, 11, 58) fem-convergence-cpp 3.83043 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 10, 2, 11, 59) fem-jit-python 0.000421906 "JIT compilation (in memory cache)"
+(2015, 1, 10, 5, 30, 16) mesh-refinement-cpp 8.33409 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 10, 5, 30, 37) mesh-topology-cpp 21.4447 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 10, 5, 31, 0) mesh-unitcube-cpp 22.8475 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 10, 5, 31, 38) mesh-iteration-cpp 35.4945 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 10, 5, 31, 38) function-evaluation-cpp 0.059942 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 10, 5, 31, 44) function-extrapolation-python 6.08539 "BENCH:  2.00567293167"
+(2015, 1, 10, 5, 31, 44) function-extrapolation-python 2.00567 "BENCH:  2.00567293167"
+(2015, 1, 10, 5, 31, 47) function-interpolation-python 2.29375 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 10, 5, 31, 47) function-interpolation-python 0.950035 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 10, 5, 34, 23) la-vector-access-cpp 156.687 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 10, 5, 35, 9) la-vector-assignment-cpp 46.0391 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 11, 2, 8, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8139 "BENCH 12.8139"
+(2015, 1, 11, 2, 8, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0228 "Building point search tree to accelerate distance queries."
+(2015, 1, 11, 2, 9, 15) geometry-bounding_box_tree_build-cpp 14.1776 "BENCH 14.1776"
+(2015, 1, 11, 2, 9, 43) common-progress-cpp 27.8902 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 11, 2, 10, 13) common-timing-cpp 30.2543 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 11, 2, 11, 47) fem-convergence-cpp 3.86529 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 11, 2, 11, 48) fem-jit-python 0.000416517 "JIT compilation (in memory cache)"
+(2015, 1, 11, 5, 28, 4) mesh-refinement-cpp 8.40151 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 11, 5, 28, 26) mesh-topology-cpp 21.3656 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 11, 5, 28, 49) mesh-unitcube-cpp 22.8252 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 11, 5, 29, 35) mesh-iteration-cpp 44.1914 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 11, 5, 29, 36) function-evaluation-cpp 0.0763211 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 11, 5, 29, 41) function-extrapolation-python 5.63749 "BENCH:  2.01725697517"
+(2015, 1, 11, 5, 29, 41) function-extrapolation-python 2.01726 "BENCH:  2.01725697517"
+(2015, 1, 11, 5, 29, 44) function-interpolation-python 2.28352 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 11, 5, 29, 44) function-interpolation-python 0.948207 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 11, 5, 32, 20) la-vector-access-cpp 156.743 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 11, 5, 33, 2) la-vector-assignment-cpp 42.0952 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 12, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.7947 "BENCH 12.7947"
+(2015, 1, 12, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0547 "Building point search tree to accelerate distance queries."
+(2015, 1, 12, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.0345 "BENCH 14.0345"
+(2015, 1, 12, 2, 9, 45) common-progress-cpp 27.8819 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 12, 2, 10, 15) common-timing-cpp 29.6903 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 12, 2, 11, 49) fem-convergence-cpp 3.86737 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 12, 2, 11, 50) fem-jit-python 0.00042181 "JIT compilation (in memory cache)"
+(2015, 1, 12, 5, 25, 19) mesh-refinement-cpp 8.33512 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 12, 5, 25, 41) mesh-topology-cpp 21.3879 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 12, 5, 26, 4) mesh-unitcube-cpp 22.807 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 12, 5, 26, 42) mesh-iteration-cpp 35.545 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 12, 5, 26, 42) function-evaluation-cpp 0.053803 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 12, 5, 26, 47) function-extrapolation-python 5.6395 "BENCH:  2.0159637928"
+(2015, 1, 12, 5, 26, 47) function-extrapolation-python 2.01596 "BENCH:  2.0159637928"
+(2015, 1, 12, 5, 26, 50) function-interpolation-python 2.27788 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 12, 5, 26, 50) function-interpolation-python 0.949602 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 12, 5, 29, 26) la-vector-access-cpp 155.726 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 12, 5, 30, 12) la-vector-assignment-cpp 45.9608 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 13, 2, 8, 54) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8649 "BENCH 12.8649"
+(2015, 1, 13, 2, 9, 12) geometry-bounding_box_tree_compute_closest_entity-cpp 14.7849 "Building point search tree to accelerate distance queries."
+(2015, 1, 13, 2, 9, 29) geometry-bounding_box_tree_build-cpp 14.1641 "BENCH 14.1641"
+(2015, 1, 13, 2, 9, 57) common-progress-cpp 27.8841 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 13, 2, 10, 27) common-timing-cpp 30.0876 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 13, 2, 12, 0) fem-convergence-cpp 3.85457 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 13, 2, 12, 21) fem-jit-python 0.000453305 "JIT compilation (in memory cache)"
+(2015, 1, 13, 5, 24, 2) mesh-refinement-cpp 8.39043 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 13, 5, 24, 23) mesh-topology-cpp 21.4659 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 13, 5, 24, 46) mesh-unitcube-cpp 22.8977 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 13, 5, 25, 27) mesh-iteration-cpp 38.4988 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 13, 5, 25, 27) function-evaluation-cpp 0.074666 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 13, 5, 26, 35) function-extrapolation-python 68.289 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2015, 1, 13, 5, 26, 35) function-extrapolation-python 1.99764 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2015, 1, 13, 5, 26, 43) function-interpolation-python 7.81263 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2015, 1, 13, 5, 26, 43) function-interpolation-python 0.953647 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2015, 1, 13, 5, 29, 19) la-vector-access-cpp 155.76 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 13, 5, 30, 1) la-vector-assignment-cpp 42.0151 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 14, 2, 8, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8291 "BENCH 12.8291"
+(2015, 1, 14, 2, 8, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9222 "Building point search tree to accelerate distance queries."
+(2015, 1, 14, 2, 9, 15) geometry-bounding_box_tree_build-cpp 14.2174 "BENCH 14.2174"
+(2015, 1, 14, 2, 9, 42) common-progress-cpp 27.8864 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 14, 2, 10, 12) common-timing-cpp 29.5192 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 14, 2, 11, 47) fem-convergence-cpp 3.92293 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 14, 2, 11, 48) fem-jit-python 0.000429392 "JIT compilation (in memory cache)"
+(2015, 1, 14, 5, 34, 17) mesh-refinement-cpp 8.34241 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 14, 5, 34, 39) mesh-topology-cpp 21.3381 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 14, 5, 35, 2) mesh-unitcube-cpp 22.9236 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 14, 5, 35, 40) mesh-iteration-cpp 35.569 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 14, 5, 35, 40) function-evaluation-cpp 0.0829289 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 14, 5, 35, 46) function-extrapolation-python 6.62873 "BENCH:  2.096118927"
+(2015, 1, 14, 5, 35, 46) function-extrapolation-python 2.09612 "BENCH:  2.096118927"
+(2015, 1, 14, 5, 35, 49) function-interpolation-python 2.4353 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 14, 5, 35, 49) function-interpolation-python 1.02672 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 14, 5, 38, 25) la-vector-access-cpp 156.522 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 14, 5, 39, 12) la-vector-assignment-cpp 46.0434 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 15, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9918 "BENCH 12.9918"
+(2015, 1, 15, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1896 "Building point search tree to accelerate distance queries."
+(2015, 1, 15, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.1485 "BENCH 14.1485"
+(2015, 1, 15, 2, 9, 48) common-progress-cpp 27.8825 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 15, 2, 10, 18) common-timing-cpp 29.4368 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 15, 2, 11, 52) fem-convergence-cpp 3.87741 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 15, 2, 11, 53) fem-jit-python 0.000416303 "JIT compilation (in memory cache)"
+(2015, 1, 15, 5, 23, 17) mesh-refinement-cpp 8.31426 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 15, 5, 23, 39) mesh-topology-cpp 21.4694 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 15, 5, 24, 2) mesh-unitcube-cpp 22.8877 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 15, 5, 24, 40) mesh-iteration-cpp 35.5491 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 15, 5, 24, 40) function-evaluation-cpp 0.0518129 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 15, 5, 24, 46) function-extrapolation-python 5.61356 "BENCH:  2.00211000443"
+(2015, 1, 15, 5, 24, 46) function-extrapolation-python 2.00211 "BENCH:  2.00211000443"
+(2015, 1, 15, 5, 24, 48) function-interpolation-python 2.28541 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 15, 5, 24, 48) function-interpolation-python 0.949981 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 15, 5, 27, 24) la-vector-access-cpp 155.737 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 15, 5, 28, 6) la-vector-assignment-cpp 42.0192 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 16, 2, 8, 55) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9335 "BENCH 12.9335"
+(2015, 1, 16, 2, 9, 13) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0538 "Building point search tree to accelerate distance queries."
+(2015, 1, 16, 2, 9, 29) geometry-bounding_box_tree_build-cpp 13.8976 "BENCH 13.8976"
+(2015, 1, 16, 2, 9, 57) common-progress-cpp 27.6304 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 16, 2, 10, 27) common-timing-cpp 29.9098 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 16, 2, 12, 0) fem-convergence-cpp 3.83205 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 16, 2, 12, 2) fem-jit-python 0.000410914 "JIT compilation (in memory cache)"
+(2015, 1, 16, 5, 28, 4) mesh-refinement-cpp 8.33054 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 16, 5, 28, 25) mesh-topology-cpp 21.4062 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 16, 5, 28, 48) mesh-unitcube-cpp 22.8267 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 16, 5, 29, 29) mesh-iteration-cpp 38.5419 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 16, 5, 29, 29) function-evaluation-cpp 0.0540919 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 16, 5, 29, 35) function-extrapolation-python 5.78303 "BENCH:  1.99957108498"
+(2015, 1, 16, 5, 29, 35) function-extrapolation-python 1.99957 "BENCH:  1.99957108498"
+(2015, 1, 16, 5, 29, 37) function-interpolation-python 2.28011 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 16, 5, 29, 37) function-interpolation-python 0.956341 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 16, 5, 32, 14) la-vector-access-cpp 156.984 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 16, 5, 33, 1) la-vector-assignment-cpp 46.3291 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 17, 2, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.01 "BENCH 13.01"
+(2015, 1, 17, 2, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0168 "Building point search tree to accelerate distance queries."
+(2015, 1, 17, 2, 9, 22) geometry-bounding_box_tree_build-cpp 14.3072 "BENCH 14.3072"
+(2015, 1, 17, 2, 9, 49) common-progress-cpp 27.8924 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 17, 2, 10, 19) common-timing-cpp 30.0094 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 17, 2, 11, 53) fem-convergence-cpp 3.89478 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 17, 2, 11, 54) fem-jit-python 0.000423813 "JIT compilation (in memory cache)"
+(2015, 1, 17, 5, 22, 55) mesh-refinement-cpp 8.31758 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 17, 5, 23, 17) mesh-topology-cpp 21.3774 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 17, 5, 23, 40) mesh-unitcube-cpp 22.8568 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 17, 5, 24, 18) mesh-iteration-cpp 35.5163 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 17, 5, 24, 18) function-evaluation-cpp 0.0727181 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 17, 5, 24, 24) function-extrapolation-python 5.7864 "BENCH:  1.9984459877"
+(2015, 1, 17, 5, 24, 24) function-extrapolation-python 1.99845 "BENCH:  1.9984459877"
+(2015, 1, 17, 5, 24, 26) function-interpolation-python 2.29294 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 17, 5, 24, 26) function-interpolation-python 0.953182 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 17, 5, 27, 2) la-vector-access-cpp 155.665 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 17, 5, 27, 44) la-vector-assignment-cpp 41.9984 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 18, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9547 "BENCH 12.9547"
+(2015, 1, 18, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8164 "Building point search tree to accelerate distance queries."
+(2015, 1, 18, 2, 9, 15) geometry-bounding_box_tree_build-cpp 14.1116 "BENCH 14.1116"
+(2015, 1, 18, 2, 9, 43) common-progress-cpp 27.8945 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 18, 2, 10, 14) common-timing-cpp 30.5726 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 18, 2, 11, 48) fem-convergence-cpp 3.83719 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 18, 2, 11, 49) fem-jit-python 0.000416708 "JIT compilation (in memory cache)"
+(2015, 1, 18, 5, 30, 51) mesh-refinement-cpp 8.34175 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 18, 5, 31, 13) mesh-topology-cpp 21.4229 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 18, 5, 31, 36) mesh-unitcube-cpp 22.8335 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 18, 5, 32, 13) mesh-iteration-cpp 35.5179 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 18, 5, 32, 14) function-evaluation-cpp 0.0649691 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 18, 5, 32, 19) function-extrapolation-python 5.89365 "BENCH:  1.99503993988"
+(2015, 1, 18, 5, 32, 19) function-extrapolation-python 1.99504 "BENCH:  1.99503993988"
+(2015, 1, 18, 5, 32, 22) function-interpolation-python 2.28234 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 18, 5, 32, 22) function-interpolation-python 0.950215 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 18, 5, 34, 57) la-vector-access-cpp 155.607 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 18, 5, 35, 39) la-vector-assignment-cpp 41.9789 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 19, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.957 "BENCH 12.957"
+(2015, 1, 19, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9742 "Building point search tree to accelerate distance queries."
+(2015, 1, 19, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.2274 "BENCH 14.2274"
+(2015, 1, 19, 2, 9, 48) common-progress-cpp 27.8882 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 19, 2, 10, 18) common-timing-cpp 30.0796 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 19, 2, 11, 52) fem-convergence-cpp 3.83207 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 19, 2, 11, 53) fem-jit-python 0.000418305 "JIT compilation (in memory cache)"
+(2015, 1, 19, 5, 28, 51) mesh-refinement-cpp 8.31321 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 19, 5, 29, 13) mesh-topology-cpp 21.4081 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 19, 5, 29, 36) mesh-unitcube-cpp 22.7877 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 19, 5, 30, 22) mesh-iteration-cpp 44.1636 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 19, 5, 30, 22) function-evaluation-cpp 0.054148 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 19, 5, 30, 28) function-extrapolation-python 5.68525 "BENCH:  1.99312996864"
+(2015, 1, 19, 5, 30, 28) function-extrapolation-python 1.99313 "BENCH:  1.99312996864"
+(2015, 1, 19, 5, 30, 30) function-interpolation-python 2.26295 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 19, 5, 30, 30) function-interpolation-python 0.948084 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 19, 5, 33, 7) la-vector-access-cpp 156.626 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 19, 5, 33, 53) la-vector-assignment-cpp 46.0023 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 20, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.938 "BENCH 12.938"
+(2015, 1, 20, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3592 "Building point search tree to accelerate distance queries."
+(2015, 1, 20, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.1309 "BENCH 14.1309"
+(2015, 1, 20, 2, 9, 45) common-progress-cpp 27.888 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 20, 2, 10, 15) common-timing-cpp 29.9419 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 20, 2, 11, 49) fem-convergence-cpp 3.90545 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 20, 2, 11, 51) fem-jit-python 0.000413918 "JIT compilation (in memory cache)"
+(2015, 1, 20, 5, 20, 37) mesh-refinement-cpp 8.33833 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 20, 5, 20, 59) mesh-topology-cpp 21.3345 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 20, 5, 21, 21) mesh-unitcube-cpp 22.8396 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 20, 5, 22, 8) mesh-iteration-cpp 44.1665 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 20, 5, 22, 8) function-evaluation-cpp 0.054038 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 20, 5, 22, 14) function-extrapolation-python 5.66934 "BENCH:  1.99401187897"
+(2015, 1, 20, 5, 22, 14) function-extrapolation-python 1.99401 "BENCH:  1.99401187897"
+(2015, 1, 20, 5, 22, 16) function-interpolation-python 2.29171 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 20, 5, 22, 16) function-interpolation-python 0.95182 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 20, 5, 24, 53) la-vector-access-cpp 156.635 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 20, 5, 25, 35) la-vector-assignment-cpp 42.0132 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 21, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9162 "BENCH 12.9162"
+(2015, 1, 21, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8577 "Building point search tree to accelerate distance queries."
+(2015, 1, 21, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.1069 "BENCH 14.1069"
+(2015, 1, 21, 2, 9, 45) common-progress-cpp 27.899 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 21, 2, 10, 15) common-timing-cpp 30.1389 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 21, 2, 11, 49) fem-convergence-cpp 3.85707 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 21, 2, 11, 51) fem-jit-python 0.000429916 "JIT compilation (in memory cache)"
+(2015, 1, 21, 5, 23, 27) mesh-refinement-cpp 8.3288 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 21, 5, 23, 48) mesh-topology-cpp 21.3835 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 21, 5, 24, 11) mesh-unitcube-cpp 22.7911 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 21, 5, 24, 49) mesh-iteration-cpp 35.5586 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 21, 5, 24, 49) function-evaluation-cpp 0.0538089 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 21, 5, 24, 55) function-extrapolation-python 5.68216 "BENCH:  1.99137687683"
+(2015, 1, 21, 5, 24, 55) function-extrapolation-python 1.99138 "BENCH:  1.99137687683"
+(2015, 1, 21, 5, 24, 57) function-interpolation-python 2.27558 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 21, 5, 24, 57) function-interpolation-python 0.947757 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 21, 5, 27, 33) la-vector-access-cpp 155.673 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 21, 5, 28, 15) la-vector-assignment-cpp 42.0759 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 22, 2, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0302 "BENCH 13.0302"
+(2015, 1, 22, 2, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0981 "Building point search tree to accelerate distance queries."
+(2015, 1, 22, 2, 9, 22) geometry-bounding_box_tree_build-cpp 14.2438 "BENCH 14.2438"
+(2015, 1, 22, 2, 9, 54) common-progress-cpp 31.6639 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 22, 2, 10, 23) common-timing-cpp 29.4664 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 22, 2, 11, 57) fem-convergence-cpp 3.84376 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 22, 2, 11, 59) fem-jit-python 0.000420499 "JIT compilation (in memory cache)"
+(2015, 1, 22, 5, 22, 48) mesh-refinement-cpp 8.36185 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 22, 5, 23, 10) mesh-topology-cpp 21.3294 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 22, 5, 23, 32) mesh-unitcube-cpp 22.7715 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 22, 5, 24, 10) mesh-iteration-cpp 35.5338 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 22, 5, 24, 10) function-evaluation-cpp 0.0662131 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 22, 5, 24, 16) function-extrapolation-python 5.57816 "BENCH:  2.01826906204"
+(2015, 1, 22, 5, 24, 16) function-extrapolation-python 2.01827 "BENCH:  2.01826906204"
+(2015, 1, 22, 5, 24, 18) function-interpolation-python 2.28365 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 22, 5, 24, 18) function-interpolation-python 0.951847 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 22, 5, 26, 54) la-vector-access-cpp 155.663 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 22, 5, 27, 36) la-vector-assignment-cpp 42.0044 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 23, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9662 "BENCH 12.9662"
+(2015, 1, 23, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9537 "Building point search tree to accelerate distance queries."
+(2015, 1, 23, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2481 "BENCH 14.2481"
+(2015, 1, 23, 2, 9, 44) common-progress-cpp 27.9001 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 23, 2, 10, 14) common-timing-cpp 29.8833 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 23, 2, 11, 49) fem-convergence-cpp 3.84386 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 23, 2, 11, 51) fem-jit-python 0.000425005 "JIT compilation (in memory cache)"
+(2015, 1, 23, 5, 18, 18) mesh-refinement-cpp 8.33415 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 23, 5, 18, 39) mesh-topology-cpp 21.3355 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 23, 5, 19, 2) mesh-unitcube-cpp 22.7969 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 23, 5, 19, 40) mesh-iteration-cpp 35.52 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 23, 5, 19, 40) function-evaluation-cpp 0.0749261 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 23, 5, 19, 46) function-extrapolation-python 5.81342 "BENCH:  2.0104060173"
+(2015, 1, 23, 5, 19, 46) function-extrapolation-python 2.01041 "BENCH:  2.0104060173"
+(2015, 1, 23, 5, 19, 48) function-interpolation-python 2.27555 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 23, 5, 19, 48) function-interpolation-python 0.951791 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 23, 5, 22, 24) la-vector-access-cpp 155.669 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 23, 5, 23, 6) la-vector-assignment-cpp 41.9932 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 24, 2, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0154 "BENCH 13.0154"
+(2015, 1, 24, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9741 "Building point search tree to accelerate distance queries."
+(2015, 1, 24, 2, 9, 21) geometry-bounding_box_tree_build-cpp 14.2417 "BENCH 14.2417"
+(2015, 1, 24, 2, 9, 49) common-progress-cpp 27.8892 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 24, 2, 10, 18) common-timing-cpp 29.7009 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 24, 2, 11, 53) fem-convergence-cpp 3.84152 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 24, 2, 11, 54) fem-jit-python 0.000420094 "JIT compilation (in memory cache)"
+(2015, 1, 24, 5, 35, 33) mesh-refinement-cpp 8.33555 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 24, 5, 35, 55) mesh-topology-cpp 21.4045 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 24, 5, 36, 17) mesh-unitcube-cpp 22.8117 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 24, 5, 36, 56) mesh-iteration-cpp 35.784 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 24, 5, 36, 56) function-evaluation-cpp 0.0561161 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 24, 5, 37, 1) function-extrapolation-python 5.8041 "BENCH:  2.01261305809"
+(2015, 1, 24, 5, 37, 1) function-extrapolation-python 2.01261 "BENCH:  2.01261305809"
+(2015, 1, 24, 5, 37, 4) function-interpolation-python 2.27188 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 24, 5, 37, 4) function-interpolation-python 0.948429 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 24, 5, 39, 39) la-vector-access-cpp 155.65 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 24, 5, 40, 21) la-vector-assignment-cpp 41.9903 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 25, 2, 8, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9225 "BENCH 12.9225"
+(2015, 1, 25, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0413 "Building point search tree to accelerate distance queries."
+(2015, 1, 25, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2568 "BENCH 14.2568"
+(2015, 1, 25, 2, 9, 44) common-progress-cpp 27.8962 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 25, 2, 10, 14) common-timing-cpp 30.168 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 25, 2, 11, 48) fem-convergence-cpp 3.85531 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 25, 2, 11, 49) fem-jit-python 0.000419188 "JIT compilation (in memory cache)"
+(2015, 1, 25, 5, 23, 19) mesh-refinement-cpp 8.35611 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 25, 5, 23, 40) mesh-topology-cpp 21.3933 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 25, 5, 24, 3) mesh-unitcube-cpp 22.8202 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 25, 5, 24, 41) mesh-iteration-cpp 35.5174 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 25, 5, 24, 41) function-evaluation-cpp 0.0540471 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 25, 5, 24, 47) function-extrapolation-python 5.65895 "BENCH:  1.9947681427"
+(2015, 1, 25, 5, 24, 47) function-extrapolation-python 1.99477 "BENCH:  1.9947681427"
+(2015, 1, 25, 5, 24, 49) function-interpolation-python 2.29256 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 25, 5, 24, 49) function-interpolation-python 0.953536 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 25, 5, 27, 25) la-vector-access-cpp 155.651 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 25, 5, 28, 7) la-vector-assignment-cpp 41.9976 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 26, 2, 8, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.7158 "BENCH 12.7158"
+(2015, 1, 26, 2, 8, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8494 "Building point search tree to accelerate distance queries."
+(2015, 1, 26, 2, 9, 15) geometry-bounding_box_tree_build-cpp 14.3352 "BENCH 14.3352"
+(2015, 1, 26, 2, 9, 42) common-progress-cpp 27.8912 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 26, 2, 10, 13) common-timing-cpp 30.5711 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 26, 2, 11, 47) fem-convergence-cpp 3.84786 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 26, 2, 11, 49) fem-jit-python 0.00042069 "JIT compilation (in memory cache)"
+(2015, 1, 26, 5, 26, 38) mesh-refinement-cpp 8.33337 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 26, 5, 27, 0) mesh-topology-cpp 21.4984 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 26, 5, 27, 23) mesh-unitcube-cpp 22.7893 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 26, 5, 28, 1) mesh-iteration-cpp 35.5359 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 26, 5, 28, 1) function-evaluation-cpp 0.0542519 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 26, 5, 28, 6) function-extrapolation-python 5.74605 "BENCH:  2.00397396088"
+(2015, 1, 26, 5, 28, 6) function-extrapolation-python 2.00397 "BENCH:  2.00397396088"
+(2015, 1, 26, 5, 28, 9) function-interpolation-python 2.2845 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 26, 5, 28, 9) function-interpolation-python 0.952035 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 26, 5, 30, 44) la-vector-access-cpp 155.659 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 26, 5, 31, 27) la-vector-assignment-cpp 42.1982 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 27, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9286 "BENCH 12.9286"
+(2015, 1, 27, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8295 "Building point search tree to accelerate distance queries."
+(2015, 1, 27, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.3962 "BENCH 14.3962"
+(2015, 1, 27, 2, 9, 48) common-progress-cpp 27.8978 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 27, 2, 10, 17) common-timing-cpp 29.3535 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 27, 2, 11, 54) fem-convergence-cpp 3.86384 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 27, 2, 11, 56) fem-jit-python 0.000411701 "JIT compilation (in memory cache)"
+(2015, 1, 27, 5, 29, 50) mesh-refinement-cpp 8.27834 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 27, 5, 30, 11) mesh-topology-cpp 21.4234 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 27, 5, 30, 34) mesh-unitcube-cpp 22.7617 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 27, 5, 31, 13) mesh-iteration-cpp 36.0146 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 27, 5, 31, 13) function-evaluation-cpp 0.077997 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 27, 5, 31, 18) function-extrapolation-python 5.69492 "BENCH:  1.99704194069"
+(2015, 1, 27, 5, 31, 18) function-extrapolation-python 1.99704 "BENCH:  1.99704194069"
+(2015, 1, 27, 5, 31, 21) function-interpolation-python 2.26771 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 27, 5, 31, 21) function-interpolation-python 0.898407 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 27, 5, 33, 56) la-vector-access-cpp 155.672 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 27, 5, 34, 42) la-vector-assignment-cpp 46.0215 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 28, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0188 "BENCH 13.0188"
+(2015, 1, 28, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.219 "Building point search tree to accelerate distance queries."
+(2015, 1, 28, 2, 9, 21) geometry-bounding_box_tree_build-cpp 14.2625 "BENCH 14.2625"
+(2015, 1, 28, 2, 9, 49) common-progress-cpp 27.9836 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 28, 2, 10, 18) common-timing-cpp 29.2911 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 28, 2, 11, 55) fem-convergence-cpp 3.8915 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 28, 2, 11, 56) fem-jit-python 0.000416088 "JIT compilation (in memory cache)"
+(2015, 1, 28, 5, 31, 40) mesh-refinement-cpp 8.25751 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 28, 5, 32, 1) mesh-topology-cpp 21.5208 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 28, 5, 32, 24) mesh-unitcube-cpp 22.5288 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 28, 5, 33, 2) mesh-iteration-cpp 35.5203 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 28, 5, 33, 2) function-evaluation-cpp 0.0531292 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 28, 5, 33, 7) function-extrapolation-python 5.5854 "BENCH:  1.99143505096"
+(2015, 1, 28, 5, 33, 7) function-extrapolation-python 1.99144 "BENCH:  1.99143505096"
+(2015, 1, 28, 5, 33, 10) function-interpolation-python 2.23877 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 28, 5, 33, 10) function-interpolation-python 0.897829 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 28, 5, 36, 26) la-vector-access-cpp 196.529 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 28, 5, 37, 8) la-vector-assignment-cpp 41.9942 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 29, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8724 "BENCH 12.8724"
+(2015, 1, 29, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0227 "Building point search tree to accelerate distance queries."
+(2015, 1, 29, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.1372 "BENCH 14.1372"
+(2015, 1, 29, 2, 9, 46) common-progress-cpp 27.8926 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 29, 2, 10, 17) common-timing-cpp 30.3719 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 29, 2, 11, 54) fem-convergence-cpp 3.87615 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 29, 2, 11, 55) fem-jit-python 0.000417113 "JIT compilation (in memory cache)"
+(2015, 1, 29, 5, 19, 13) mesh-refinement-cpp 8.30901 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 29, 5, 19, 35) mesh-topology-cpp 21.5235 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 29, 5, 19, 57) mesh-unitcube-cpp 22.569 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 29, 5, 20, 35) mesh-iteration-cpp 35.5451 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 29, 5, 20, 35) function-evaluation-cpp 0.052731 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 29, 5, 20, 41) function-extrapolation-python 5.7619 "BENCH:  1.98129105568"
+(2015, 1, 29, 5, 20, 41) function-extrapolation-python 1.98129 "BENCH:  1.98129105568"
+(2015, 1, 29, 5, 20, 43) function-interpolation-python 2.2345 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 29, 5, 20, 43) function-interpolation-python 0.896309 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 29, 5, 23, 19) la-vector-access-cpp 155.652 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 29, 5, 24, 5) la-vector-assignment-cpp 46.0091 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 30, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.7906 "BENCH 12.7906"
+(2015, 1, 30, 2, 8, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9329 "Building point search tree to accelerate distance queries."
+(2015, 1, 30, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2302 "BENCH 14.2302"
+(2015, 1, 30, 2, 9, 43) common-progress-cpp 27.9042 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 30, 2, 10, 15) common-timing-cpp 31.4452 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 30, 2, 11, 52) fem-convergence-cpp 3.84434 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 30, 2, 11, 53) fem-jit-python 0.000427198 "JIT compilation (in memory cache)"
+(2015, 1, 30, 5, 31, 48) mesh-refinement-cpp 8.2837 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 30, 5, 32, 10) mesh-topology-cpp 21.5219 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 30, 5, 32, 32) mesh-unitcube-cpp 22.6069 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 30, 5, 33, 10) mesh-iteration-cpp 35.5189 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 30, 5, 33, 10) function-evaluation-cpp 0.0529749 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 30, 5, 33, 16) function-extrapolation-python 5.96111 "BENCH:  2.00668096542"
+(2015, 1, 30, 5, 33, 16) function-extrapolation-python 2.00668 "BENCH:  2.00668096542"
+(2015, 1, 30, 5, 33, 19) function-interpolation-python 2.23988 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 30, 5, 33, 19) function-interpolation-python 0.900872 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 30, 5, 35, 54) la-vector-access-cpp 155.634 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 30, 5, 36, 36) la-vector-assignment-cpp 41.9938 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 1, 31, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9474 "BENCH 12.9474"
+(2015, 1, 31, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 14.932 "Building point search tree to accelerate distance queries."
+(2015, 1, 31, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.2834 "BENCH 14.2834"
+(2015, 1, 31, 2, 9, 46) common-progress-cpp 27.8964 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 1, 31, 2, 10, 17) common-timing-cpp 30.2897 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 1, 31, 2, 11, 52) fem-convergence-cpp 3.87908 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 1, 31, 2, 11, 54) fem-jit-python 0.000415897 "JIT compilation (in memory cache)"
+(2015, 1, 31, 5, 28, 12) mesh-refinement-cpp 8.22658 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 1, 31, 5, 28, 33) mesh-topology-cpp 21.5747 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 1, 31, 5, 28, 56) mesh-unitcube-cpp 22.6085 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 1, 31, 5, 29, 34) mesh-iteration-cpp 35.7343 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 1, 31, 5, 29, 34) function-evaluation-cpp 0.0932131 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 1, 31, 5, 29, 40) function-extrapolation-python 5.73736 "BENCH:  2.10626316071"
+(2015, 1, 31, 5, 29, 40) function-extrapolation-python 2.10626 "BENCH:  2.10626316071"
+(2015, 1, 31, 5, 29, 42) function-interpolation-python 2.32087 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 31, 5, 29, 42) function-interpolation-python 0.931475 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 1, 31, 5, 32, 19) la-vector-access-cpp 156.221 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 1, 31, 5, 33, 1) la-vector-assignment-cpp 42.0006 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 1, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0846 "BENCH 13.0846"
+(2015, 2, 1, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0823 "Building point search tree to accelerate distance queries."
+(2015, 2, 1, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2469 "BENCH 14.2469"
+(2015, 2, 1, 2, 9, 44) common-progress-cpp 27.8901 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 1, 2, 10, 14) common-timing-cpp 29.9912 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 1, 2, 11, 50) fem-convergence-cpp 3.87176 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 1, 2, 11, 52) fem-jit-python 0.000423312 "JIT compilation (in memory cache)"
+(2015, 2, 1, 5, 19, 54) mesh-refinement-cpp 8.2386 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 1, 5, 20, 15) mesh-topology-cpp 21.5764 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 1, 5, 20, 38) mesh-unitcube-cpp 22.5593 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 1, 5, 21, 16) mesh-iteration-cpp 35.5222 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 1, 5, 21, 16) function-evaluation-cpp 0.053803 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 1, 5, 21, 22) function-extrapolation-python 5.65852 "BENCH:  1.99313807487"
+(2015, 2, 1, 5, 21, 22) function-extrapolation-python 1.99314 "BENCH:  1.99313807487"
+(2015, 2, 1, 5, 21, 24) function-interpolation-python 2.23719 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 1, 5, 21, 24) function-interpolation-python 0.898627 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 1, 5, 24, 39) la-vector-access-cpp 194.606 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 1, 5, 25, 21) la-vector-assignment-cpp 42.0002 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 2, 2, 8, 45) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.7663 "BENCH 12.7663"
+(2015, 2, 2, 2, 9, 3) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0363 "Building point search tree to accelerate distance queries."
+(2015, 2, 2, 2, 9, 20) geometry-bounding_box_tree_build-cpp 14.0539 "BENCH 14.0539"
+(2015, 2, 2, 2, 9, 48) common-progress-cpp 27.8635 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 2, 2, 10, 18) common-timing-cpp 29.9548 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 2, 2, 11, 53) fem-convergence-cpp 3.84214 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 2, 2, 11, 54) fem-jit-python 0.000419211 "JIT compilation (in memory cache)"
+(2015, 2, 2, 5, 23, 29) mesh-refinement-cpp 8.28255 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 2, 5, 23, 51) mesh-topology-cpp 21.4119 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 2, 5, 24, 14) mesh-unitcube-cpp 22.5144 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 2, 5, 24, 51) mesh-iteration-cpp 35.5114 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 2, 5, 24, 52) function-evaluation-cpp 0.051955 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 2, 5, 24, 57) function-extrapolation-python 5.61891 "BENCH:  1.99913811684"
+(2015, 2, 2, 5, 24, 57) function-extrapolation-python 1.99914 "BENCH:  1.99913811684"
+(2015, 2, 2, 5, 24, 59) function-interpolation-python 2.22905 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 2, 5, 24, 59) function-interpolation-python 0.889984 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 2, 5, 27, 37) la-vector-access-cpp 157.171 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 2, 5, 28, 23) la-vector-assignment-cpp 46.0146 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 3, 2, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.793 "BENCH 12.793"
+(2015, 2, 3, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0672 "Building point search tree to accelerate distance queries."
+(2015, 2, 3, 2, 9, 21) geometry-bounding_box_tree_build-cpp 14.1047 "BENCH 14.1047"
+(2015, 2, 3, 2, 9, 49) common-progress-cpp 27.887 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 3, 2, 10, 19) common-timing-cpp 30.1409 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 3, 2, 11, 56) fem-convergence-cpp 3.85087 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 3, 2, 11, 58) fem-jit-python 0.000412917 "JIT compilation (in memory cache)"
+(2015, 2, 3, 5, 20, 58) mesh-refinement-cpp 8.24532 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 3, 5, 21, 19) mesh-topology-cpp 21.3599 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 3, 5, 21, 42) mesh-unitcube-cpp 22.4781 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 3, 5, 22, 20) mesh-iteration-cpp 35.5103 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 3, 5, 22, 20) function-evaluation-cpp 0.0778661 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 3, 5, 22, 26) function-extrapolation-python 5.74858 "BENCH:  2.01262307167"
+(2015, 2, 3, 5, 22, 26) function-extrapolation-python 2.01262 "BENCH:  2.01262307167"
+(2015, 2, 3, 5, 22, 28) function-interpolation-python 2.24297 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 3, 5, 22, 28) function-interpolation-python 0.892446 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 3, 5, 25, 5) la-vector-access-cpp 157.21 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 3, 5, 25, 47) la-vector-assignment-cpp 41.9989 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 4, 2, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2765 "BENCH 13.2765"
+(2015, 2, 4, 2, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1752 "Building point search tree to accelerate distance queries."
+(2015, 2, 4, 2, 9, 22) geometry-bounding_box_tree_build-cpp 14.0402 "BENCH 14.0402"
+(2015, 2, 4, 2, 9, 50) common-progress-cpp 27.8841 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 4, 2, 10, 21) common-timing-cpp 30.8417 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 4, 2, 11, 57) fem-convergence-cpp 3.83733 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 4, 2, 11, 58) fem-jit-python 0.000423002 "JIT compilation (in memory cache)"
+(2015, 2, 4, 5, 37, 8) mesh-refinement-cpp 8.47136 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 4, 5, 37, 30) mesh-topology-cpp 22.1027 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 4, 5, 37, 53) mesh-unitcube-cpp 23.1241 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 4, 5, 38, 32) mesh-iteration-cpp 36.2096 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 4, 5, 38, 32) function-evaluation-cpp 0.0746 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 4, 5, 38, 39) function-extrapolation-python 6.33811 "BENCH:  2.01691484451"
+(2015, 2, 4, 5, 38, 39) function-extrapolation-python 2.01691 "BENCH:  2.01691484451"
+(2015, 2, 4, 5, 38, 41) function-interpolation-python 2.28027 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 4, 5, 38, 41) function-interpolation-python 0.947862 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 4, 5, 41, 19) la-vector-access-cpp 157.578 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 4, 5, 42, 1) la-vector-assignment-cpp 42.0061 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 5, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9417 "BENCH 12.9417"
+(2015, 2, 5, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2308 "Building point search tree to accelerate distance queries."
+(2015, 2, 5, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.3289 "BENCH 14.3289"
+(2015, 2, 5, 2, 9, 47) common-progress-cpp 27.9223 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 5, 2, 10, 17) common-timing-cpp 30.399 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 5, 2, 11, 55) fem-convergence-cpp 3.98873 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 5, 2, 11, 56) fem-jit-python 0.000418997 "JIT compilation (in memory cache)"
+(2015, 2, 5, 5, 35, 22) mesh-refinement-cpp 8.57701 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 5, 5, 35, 43) mesh-topology-cpp 21.7172 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 5, 5, 36, 7) mesh-unitcube-cpp 23.0297 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 5, 5, 36, 45) mesh-iteration-cpp 36.392 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 5, 5, 36, 45) function-evaluation-cpp 0.098614 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 5, 5, 36, 51) function-extrapolation-python 5.47868 "BENCH:  2.08205604553"
+(2015, 2, 5, 5, 36, 51) function-extrapolation-python 2.08206 "BENCH:  2.08205604553"
+(2015, 2, 5, 5, 36, 53) function-interpolation-python 2.38113 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 5, 5, 36, 53) function-interpolation-python 0.989093 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 5, 5, 39, 47) la-vector-access-cpp 173.161 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 5, 5, 40, 29) la-vector-assignment-cpp 42.0201 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 6, 2, 10, 13) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9155 "BENCH 12.9155"
+(2015, 2, 6, 2, 10, 32) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0706 "Building point search tree to accelerate distance queries."
+(2015, 2, 6, 2, 10, 48) geometry-bounding_box_tree_build-cpp 14.1847 "BENCH 14.1847"
+(2015, 2, 6, 2, 11, 16) common-progress-cpp 27.8861 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 6, 2, 11, 47) common-timing-cpp 30.4256 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 6, 2, 13, 24) fem-convergence-cpp 3.87622 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 6, 2, 13, 25) fem-jit-python 0.000423908 "JIT compilation (in memory cache)"
+(2015, 2, 6, 5, 24, 41) mesh-refinement-cpp 8.43665 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 6, 5, 25, 3) mesh-topology-cpp 21.5684 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 6, 5, 25, 26) mesh-unitcube-cpp 23.106 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 6, 5, 26, 5) mesh-iteration-cpp 36.0361 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 6, 5, 26, 5) function-evaluation-cpp 0.0771489 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 6, 5, 26, 10) function-extrapolation-python 5.59798 "BENCH:  2.02288913727"
+(2015, 2, 6, 5, 26, 10) function-extrapolation-python 2.02289 "BENCH:  2.02288913727"
+(2015, 2, 6, 5, 26, 13) function-interpolation-python 2.28042 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 6, 5, 26, 13) function-interpolation-python 0.941998 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 6, 5, 28, 49) la-vector-access-cpp 156.672 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 6, 5, 29, 35) la-vector-assignment-cpp 46.0157 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 7, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8681 "BENCH 12.8681"
+(2015, 2, 7, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9657 "Building point search tree to accelerate distance queries."
+(2015, 2, 7, 2, 9, 18) geometry-bounding_box_tree_build-cpp 14.354 "BENCH 14.354"
+(2015, 2, 7, 2, 9, 46) common-progress-cpp 27.904 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 7, 2, 10, 16) common-timing-cpp 30.5559 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 7, 2, 11, 54) fem-convergence-cpp 3.86834 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 7, 2, 11, 55) fem-jit-python 0.000422001 "JIT compilation (in memory cache)"
+(2015, 2, 7, 5, 22, 35) mesh-refinement-cpp 8.41782 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 7, 5, 22, 57) mesh-topology-cpp 21.4043 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 7, 5, 23, 19) mesh-unitcube-cpp 22.7344 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 7, 5, 23, 58) mesh-iteration-cpp 36.0492 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 7, 5, 23, 58) function-evaluation-cpp 0.0645189 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 7, 5, 24, 4) function-extrapolation-python 5.72379 "BENCH:  2.0016849041"
+(2015, 2, 7, 5, 24, 4) function-extrapolation-python 2.00168 "BENCH:  2.0016849041"
+(2015, 2, 7, 5, 24, 6) function-interpolation-python 2.2845 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 7, 5, 24, 6) function-interpolation-python 0.944619 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 7, 5, 26, 44) la-vector-access-cpp 157.671 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 7, 5, 27, 26) la-vector-assignment-cpp 41.9998 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 8, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9149 "BENCH 12.9149"
+(2015, 2, 8, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8533 "Building point search tree to accelerate distance queries."
+(2015, 2, 8, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.2944 "BENCH 14.2944"
+(2015, 2, 8, 2, 9, 47) common-progress-cpp 27.878 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 8, 2, 10, 17) common-timing-cpp 30.3629 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 8, 2, 11, 55) fem-convergence-cpp 3.86025 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 8, 2, 11, 56) fem-jit-python 0.000429106 "JIT compilation (in memory cache)"
+(2015, 2, 8, 5, 23, 51) mesh-refinement-cpp 8.42952 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 8, 5, 24, 12) mesh-topology-cpp 21.5769 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 8, 5, 24, 35) mesh-unitcube-cpp 22.8324 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 8, 5, 25, 14) mesh-iteration-cpp 36.0491 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 8, 5, 25, 14) function-evaluation-cpp 0.072722 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 8, 5, 25, 19) function-extrapolation-python 5.56836 "BENCH:  1.99747180939"
+(2015, 2, 8, 5, 25, 19) function-extrapolation-python 1.99747 "BENCH:  1.99747180939"
+(2015, 2, 8, 5, 25, 22) function-interpolation-python 2.29429 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 8, 5, 25, 22) function-interpolation-python 0.946924 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 8, 5, 27, 57) la-vector-access-cpp 155.732 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 8, 5, 28, 39) la-vector-assignment-cpp 41.9954 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 9, 2, 8, 42) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0256 "BENCH 13.0256"
+(2015, 2, 9, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2805 "Building point search tree to accelerate distance queries."
+(2015, 2, 9, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.3428 "BENCH 14.3428"
+(2015, 2, 9, 2, 9, 45) common-progress-cpp 27.8874 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 9, 2, 10, 15) common-timing-cpp 29.6803 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 9, 2, 11, 49) fem-convergence-cpp 3.84817 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 9, 2, 11, 51) fem-jit-python 0.000415683 "JIT compilation (in memory cache)"
+(2015, 2, 9, 5, 25, 22) mesh-refinement-cpp 8.41362 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 9, 5, 25, 44) mesh-topology-cpp 21.4063 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 9, 5, 26, 7) mesh-unitcube-cpp 22.769 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 9, 5, 26, 48) mesh-iteration-cpp 38.5509 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 9, 5, 26, 48) function-evaluation-cpp 0.079474 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 9, 5, 26, 54) function-extrapolation-python 5.89367 "BENCH:  2.00670695305"
+(2015, 2, 9, 5, 26, 54) function-extrapolation-python 2.00671 "BENCH:  2.00670695305"
+(2015, 2, 9, 5, 26, 56) function-interpolation-python 2.26866 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 9, 5, 26, 56) function-interpolation-python 0.945634 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 9, 5, 29, 34) la-vector-access-cpp 157.658 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 9, 5, 30, 16) la-vector-assignment-cpp 42.0093 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 10, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9004 "BENCH 12.9004"
+(2015, 2, 10, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8766 "Building point search tree to accelerate distance queries."
+(2015, 2, 10, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.2157 "BENCH 14.2157"
+(2015, 2, 10, 2, 9, 47) common-progress-cpp 27.9047 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 10, 2, 10, 17) common-timing-cpp 30.4034 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 10, 2, 11, 52) fem-convergence-cpp 3.84225 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 10, 2, 11, 53) fem-jit-python 0.000425196 "JIT compilation (in memory cache)"
+(2015, 2, 10, 5, 24, 15) mesh-refinement-cpp 8.43726 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 10, 5, 24, 36) mesh-topology-cpp 21.4342 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 10, 5, 24, 59) mesh-unitcube-cpp 22.7271 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 10, 5, 25, 40) mesh-iteration-cpp 38.4914 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 10, 5, 25, 40) function-evaluation-cpp 0.099462 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 10, 5, 25, 46) function-extrapolation-python 5.61698 "BENCH:  2.02750897408"
+(2015, 2, 10, 5, 25, 46) function-extrapolation-python 2.02751 "BENCH:  2.02750897408"
+(2015, 2, 10, 5, 25, 48) function-interpolation-python 2.28898 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 10, 5, 25, 48) function-interpolation-python 0.959003 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 10, 5, 28, 24) la-vector-access-cpp 155.638 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 10, 5, 29, 6) la-vector-assignment-cpp 42.1738 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 11, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9498 "BENCH 12.9498"
+(2015, 2, 11, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8947 "Building point search tree to accelerate distance queries."
+(2015, 2, 11, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.0294 "BENCH 14.0294"
+(2015, 2, 11, 2, 9, 47) common-progress-cpp 28.234 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 11, 2, 10, 17) common-timing-cpp 30.0576 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 11, 2, 11, 54) fem-convergence-cpp 3.84135 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 11, 2, 11, 55) fem-jit-python 0.000418901 "JIT compilation (in memory cache)"
+(2015, 2, 11, 5, 20, 39) mesh-refinement-cpp 8.41591 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 11, 5, 21, 0) mesh-topology-cpp 21.5134 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 11, 5, 21, 23) mesh-unitcube-cpp 22.8824 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 11, 5, 22, 4) mesh-iteration-cpp 38.5528 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 11, 5, 22, 4) function-evaluation-cpp 0.0545449 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 11, 5, 22, 10) function-extrapolation-python 5.6231 "BENCH:  1.99815392494"
+(2015, 2, 11, 5, 22, 10) function-extrapolation-python 1.99815 "BENCH:  1.99815392494"
+(2015, 2, 11, 5, 22, 12) function-interpolation-python 2.29979 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 11, 5, 22, 12) function-interpolation-python 0.953307 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 11, 5, 25, 16) la-vector-access-cpp 183.397 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 11, 5, 25, 58) la-vector-assignment-cpp 42.0038 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 12, 2, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9211 "BENCH 12.9211"
+(2015, 2, 12, 2, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8819 "Building point search tree to accelerate distance queries."
+(2015, 2, 12, 2, 9, 21) geometry-bounding_box_tree_build-cpp 14.117 "BENCH 14.117"
+(2015, 2, 12, 2, 9, 49) common-progress-cpp 27.8984 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 12, 2, 10, 20) common-timing-cpp 31.0567 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 12, 2, 11, 57) fem-convergence-cpp 3.84313 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 12, 2, 11, 59) fem-jit-python 0.00041461 "JIT compilation (in memory cache)"
+(2015, 2, 12, 5, 31, 40) mesh-refinement-cpp 8.40614 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 12, 5, 32, 2) mesh-topology-cpp 21.5804 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 12, 5, 32, 25) mesh-unitcube-cpp 22.7311 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 12, 5, 33, 3) mesh-iteration-cpp 36.0717 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 12, 5, 33, 3) function-evaluation-cpp 0.072602 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 12, 5, 33, 9) function-extrapolation-python 5.54261 "BENCH:  2.005879879"
+(2015, 2, 12, 5, 33, 9) function-extrapolation-python 2.00588 "BENCH:  2.005879879"
+(2015, 2, 12, 5, 33, 11) function-interpolation-python 2.28128 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 12, 5, 33, 11) function-interpolation-python 0.943221 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 12, 5, 35, 47) la-vector-access-cpp 155.691 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 12, 5, 36, 29) la-vector-assignment-cpp 41.9873 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 13, 2, 8, 47) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8979 "BENCH 12.8979"
+(2015, 2, 13, 2, 9, 5) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9874 "Building point search tree to accelerate distance queries."
+(2015, 2, 13, 2, 9, 22) geometry-bounding_box_tree_build-cpp 14.0418 "BENCH 14.0418"
+(2015, 2, 13, 2, 9, 50) common-progress-cpp 27.8811 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 13, 2, 10, 20) common-timing-cpp 29.8306 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 13, 2, 11, 57) fem-convergence-cpp 3.88574 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 13, 2, 11, 58) fem-jit-python 0.000418305 "JIT compilation (in memory cache)"
+(2015, 2, 13, 5, 31, 47) mesh-refinement-cpp 8.56194 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 13, 5, 32, 9) mesh-topology-cpp 21.572 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 13, 5, 32, 32) mesh-unitcube-cpp 22.9348 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 13, 5, 33, 11) mesh-iteration-cpp 36.4053 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 13, 5, 33, 11) function-evaluation-cpp 0.0773149 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 13, 5, 33, 17) function-extrapolation-python 5.74959 "BENCH:  2.05807304382"
+(2015, 2, 13, 5, 33, 17) function-extrapolation-python 2.05807 "BENCH:  2.05807304382"
+(2015, 2, 13, 5, 33, 19) function-interpolation-python 2.34395 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 13, 5, 33, 19) function-interpolation-python 0.966344 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 13, 5, 35, 57) la-vector-access-cpp 157.43 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 13, 5, 36, 43) la-vector-assignment-cpp 46.0285 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 14, 2, 8, 44) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0511 "BENCH 13.0511"
+(2015, 2, 14, 2, 9, 2) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2607 "Building point search tree to accelerate distance queries."
+(2015, 2, 14, 2, 9, 19) geometry-bounding_box_tree_build-cpp 14.2074 "BENCH 14.2074"
+(2015, 2, 14, 2, 9, 47) common-progress-cpp 27.8872 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 14, 2, 10, 17) common-timing-cpp 30.4027 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 14, 2, 11, 53) fem-convergence-cpp 3.84649 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 14, 2, 11, 54) fem-jit-python 0.000420499 "JIT compilation (in memory cache)"
+(2015, 2, 14, 5, 30, 25) mesh-refinement-cpp 8.61695 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 14, 5, 30, 47) mesh-topology-cpp 21.8707 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 14, 5, 31, 10) mesh-unitcube-cpp 23.0261 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 14, 5, 31, 56) mesh-iteration-cpp 43.8163 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 14, 5, 31, 56) function-evaluation-cpp 0.112423 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 14, 5, 32, 2) function-extrapolation-python 5.47676 "BENCH:  2.07007479668"
+(2015, 2, 14, 5, 32, 2) function-extrapolation-python 2.07007 "BENCH:  2.07007479668"
+(2015, 2, 14, 5, 32, 4) function-interpolation-python 2.31784 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 14, 5, 32, 4) function-interpolation-python 0.952871 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 14, 5, 34, 41) la-vector-access-cpp 157.058 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 14, 5, 35, 23) la-vector-assignment-cpp 42.0052 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 15, 2, 8, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9295 "BENCH 12.9295"
+(2015, 2, 15, 2, 9, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8282 "Building point search tree to accelerate distance queries."
+(2015, 2, 15, 2, 9, 16) geometry-bounding_box_tree_build-cpp 14.2533 "BENCH 14.2533"
+(2015, 2, 15, 2, 9, 44) common-progress-cpp 27.8847 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 15, 2, 10, 14) common-timing-cpp 29.7358 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 15, 2, 11, 50) fem-convergence-cpp 3.86424 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 15, 2, 11, 51) fem-jit-python 0.00041852 "JIT compilation (in memory cache)"
+(2015, 2, 15, 5, 28, 1) mesh-refinement-cpp 8.42518 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 15, 5, 28, 22) mesh-topology-cpp 21.4052 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 15, 5, 28, 45) mesh-unitcube-cpp 22.7658 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 15, 5, 29, 23) mesh-iteration-cpp 36.0638 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 15, 5, 29, 23) function-evaluation-cpp 0.0539842 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 15, 5, 29, 29) function-extrapolation-python 5.72886 "BENCH:  2.00570416451"
+(2015, 2, 15, 5, 29, 29) function-extrapolation-python 2.0057 "BENCH:  2.00570416451"
+(2015, 2, 15, 5, 29, 32) function-interpolation-python 2.26687 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 15, 5, 29, 32) function-interpolation-python 0.92876 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 15, 5, 32, 7) la-vector-access-cpp 155.653 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 15, 5, 32, 49) la-vector-assignment-cpp 42.017 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 16, 2, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9412 "BENCH 12.9412"
+(2015, 2, 16, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8664 "Building point search tree to accelerate distance queries."
+(2015, 2, 16, 2, 9, 21) geometry-bounding_box_tree_build-cpp 14.1623 "BENCH 14.1623"
+(2015, 2, 16, 2, 9, 49) common-progress-cpp 28.0251 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 16, 2, 10, 19) common-timing-cpp 30.8004 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 16, 2, 11, 56) fem-convergence-cpp 3.89275 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 16, 2, 11, 59) fem-jit-python 0.000421786 "JIT compilation (in memory cache)"
+(2015, 2, 16, 5, 27, 51) mesh-refinement-cpp 8.45581 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 16, 5, 28, 13) mesh-topology-cpp 21.418 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 16, 5, 28, 36) mesh-unitcube-cpp 22.7987 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 16, 5, 29, 14) mesh-iteration-cpp 36.0286 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 16, 5, 29, 14) function-evaluation-cpp 0.0912499 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 16, 5, 29, 20) function-extrapolation-python 5.59939 "BENCH:  1.99086213112"
+(2015, 2, 16, 5, 29, 20) function-extrapolation-python 1.99086 "BENCH:  1.99086213112"
+(2015, 2, 16, 5, 29, 22) function-interpolation-python 2.274 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 16, 5, 29, 22) function-interpolation-python 0.927842 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 16, 5, 31, 59) la-vector-access-cpp 156.662 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 16, 5, 32, 41) la-vector-assignment-cpp 41.9894 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 17, 2, 8, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9363 "BENCH 12.9363"
+(2015, 2, 17, 2, 9, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 14.7393 "Building point search tree to accelerate distance queries."
+(2015, 2, 17, 2, 9, 17) geometry-bounding_box_tree_build-cpp 14.0866 "BENCH 14.0866"
+(2015, 2, 17, 2, 9, 45) common-progress-cpp 27.8845 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 17, 2, 10, 15) common-timing-cpp 30.2329 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 17, 2, 11, 53) fem-convergence-cpp 3.8627 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 17, 2, 11, 54) fem-jit-python 0.000426412 "JIT compilation (in memory cache)"
+(2015, 2, 17, 5, 26, 45) mesh-refinement-cpp 8.39926 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 17, 5, 27, 7) mesh-topology-cpp 21.5359 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 17, 5, 27, 30) mesh-unitcube-cpp 22.7673 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 17, 5, 28, 8) mesh-iteration-cpp 36.0274 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 17, 5, 28, 8) function-evaluation-cpp 0.054383 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 17, 5, 28, 14) function-extrapolation-python 5.84207 "BENCH:  2.02217888832"
+(2015, 2, 17, 5, 28, 14) function-extrapolation-python 2.02218 "BENCH:  2.02217888832"
+(2015, 2, 17, 5, 28, 16) function-interpolation-python 2.27814 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 17, 5, 28, 16) function-interpolation-python 0.932276 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 17, 5, 31, 20) la-vector-access-cpp 183.302 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 17, 5, 32, 2) la-vector-assignment-cpp 42.0414 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 18, 2, 8, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8985 "BENCH 12.8985"
+(2015, 2, 18, 2, 9, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9901 "Building point search tree to accelerate distance queries."
+(2015, 2, 18, 2, 9, 21) geometry-bounding_box_tree_build-cpp 14.2467 "BENCH 14.2467"
+(2015, 2, 18, 2, 9, 53) common-progress-cpp 31.6521 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 18, 2, 10, 23) common-timing-cpp 29.9154 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 18, 2, 11, 57) fem-convergence-cpp 3.86983 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 18, 2, 11, 59) fem-jit-python 0.0004287 "JIT compilation (in memory cache)"
+(2015, 2, 18, 5, 27, 6) mesh-refinement-cpp 8.54528 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 18, 5, 27, 29) mesh-topology-cpp 22.3321 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 18, 5, 27, 52) mesh-unitcube-cpp 23.0074 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 18, 5, 28, 31) mesh-iteration-cpp 36.2444 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 18, 5, 28, 31) function-evaluation-cpp 0.0931251 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 18, 5, 28, 37) function-extrapolation-python 5.89335 "BENCH:  2.08315205574"
+(2015, 2, 18, 5, 28, 37) function-extrapolation-python 2.08315 "BENCH:  2.08315205574"
+(2015, 2, 18, 5, 28, 39) function-interpolation-python 2.35012 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 18, 5, 28, 39) function-interpolation-python 0.950281 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 18, 5, 31, 15) la-vector-access-cpp 156.085 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 18, 5, 31, 57) la-vector-assignment-cpp 42.0192 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 2, 19, 2, 9, 3) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2872 "BENCH 13.2872"
+(2015, 2, 19, 2, 9, 22) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3014 "Building point search tree to accelerate distance queries."
+(2015, 2, 19, 2, 9, 38) geometry-bounding_box_tree_build-cpp 14.1043 "BENCH 14.1043"
+(2015, 2, 19, 2, 10, 6) common-progress-cpp 27.9106 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 2, 19, 2, 10, 36) common-timing-cpp 29.3973 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 2, 19, 2, 12, 9) fem-convergence-cpp 3.90614 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 2, 19, 2, 12, 10) fem-jit-python 0.000422001 "JIT compilation (in memory cache)"
+(2015, 2, 19, 5, 28, 51) mesh-refinement-cpp 8.24996 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 2, 19, 5, 29, 13) mesh-topology-cpp 21.786 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 2, 19, 5, 29, 36) mesh-unitcube-cpp 22.4425 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 2, 19, 5, 30, 14) mesh-iteration-cpp 35.5109 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 2, 19, 5, 30, 14) function-evaluation-cpp 0.062834 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 2, 19, 5, 30, 19) function-extrapolation-python 5.70348 "BENCH:  2.00259017944"
+(2015, 2, 19, 5, 30, 19) function-extrapolation-python 2.00259 "BENCH:  2.00259017944"
+(2015, 2, 19, 5, 30, 22) function-interpolation-python 2.30721 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 19, 5, 30, 22) function-interpolation-python 0.968658 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2015, 2, 19, 5, 32, 53) la-vector-access-cpp 151.027 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 2, 19, 5, 33, 35) la-vector-assignment-cpp 42.0061 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 20, 8, 9, 3) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9364 "BENCH 12.9364"
+(2015, 3, 20, 8, 9, 21) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9867 "Building point search tree to accelerate distance queries."
+(2015, 3, 20, 8, 9, 37) geometry-bounding_box_tree_build-cpp 14.1886 "BENCH 14.1886"
+(2015, 3, 20, 8, 10, 5) common-progress-cpp 27.7346 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 20, 8, 11, 18) common-timing-cpp 72.5637 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 20, 8, 12, 48) fem-convergence-cpp 3.64517 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 21, 2, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.982 "BENCH 12.982"
+(2015, 3, 21, 2, 9, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0123 "Building point search tree to accelerate distance queries."
+(2015, 3, 21, 2, 10, 12) geometry-bounding_box_tree_build-cpp 13.9065 "BENCH 13.9065"
+(2015, 3, 21, 2, 10, 40) common-progress-cpp 27.6032 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 21, 2, 11, 52) common-timing-cpp 72.5305 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 21, 2, 13, 21) fem-convergence-cpp 3.5965 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 21, 5, 1, 54) fem-speedup-cpp 10111.1 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 21, 5, 1, 54) fem-speedup-cpp-assembly 6.45968 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 21, 5, 1, 54) fem-speedup-cpp-solve 0.682783 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 21, 5, 2, 4) mesh-refinement-cpp 9.6983 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 21, 5, 2, 26) mesh-topology-cpp 21.4044 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 21, 5, 2, 48) mesh-unitcube-cpp 22.1685 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 21, 5, 3, 26) mesh-iteration-cpp 35.5517 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 21, 5, 3, 26) function-evaluation-cpp 0.03566 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 21, 5, 5, 22) la-vector-access-cpp 112.442 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 21, 5, 5, 59) la-vector-assignment-cpp 37.4748 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 22, 2, 9, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9707 "BENCH 12.9707"
+(2015, 3, 22, 2, 9, 50) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9672 "Building point search tree to accelerate distance queries."
+(2015, 3, 22, 2, 10, 7) geometry-bounding_box_tree_build-cpp 14.1644 "BENCH 14.1644"
+(2015, 3, 22, 2, 10, 35) common-progress-cpp 27.7926 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 22, 2, 11, 47) common-timing-cpp 72.2379 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 22, 2, 13, 16) fem-convergence-cpp 3.64729 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 22, 4, 55, 18) fem-speedup-cpp 9720.27 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 22, 4, 55, 18) fem-speedup-cpp-assembly 6.46243 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 22, 4, 55, 18) fem-speedup-cpp-solve 0.69393 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 22, 4, 55, 28) mesh-refinement-cpp 9.6657 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 22, 4, 55, 50) mesh-topology-cpp 21.33 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 22, 4, 56, 12) mesh-unitcube-cpp 22.0677 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 22, 4, 56, 50) mesh-iteration-cpp 35.5197 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 22, 4, 56, 50) function-evaluation-cpp 0.03547 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 22, 4, 58, 45) la-vector-access-cpp 111.883 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 22, 4, 59, 23) la-vector-assignment-cpp 37.4854 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 23, 2, 9, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9633 "BENCH 12.9633"
+(2015, 3, 23, 2, 9, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0446 "Building point search tree to accelerate distance queries."
+(2015, 3, 23, 2, 10, 7) geometry-bounding_box_tree_build-cpp 14.1177 "BENCH 14.1177"
+(2015, 3, 23, 2, 10, 35) common-progress-cpp 27.7901 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 23, 2, 11, 50) common-timing-cpp 74.5936 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 23, 2, 13, 19) fem-convergence-cpp 3.65482 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 23, 5, 13, 12) fem-speedup-cpp 10791.9 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 23, 5, 13, 12) fem-speedup-cpp-assembly 6.44391 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 23, 5, 13, 12) fem-speedup-cpp-solve 0.596431 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 23, 5, 13, 23) mesh-refinement-cpp 9.67308 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 23, 5, 13, 44) mesh-topology-cpp 21.3146 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 23, 5, 14, 6) mesh-unitcube-cpp 22.0786 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 23, 5, 14, 44) mesh-iteration-cpp 35.4986 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 23, 5, 14, 44) function-evaluation-cpp 0.0391459 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 23, 5, 16, 39) la-vector-access-cpp 110.934 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 23, 5, 17, 20) la-vector-assignment-cpp 40.9414 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 24, 2, 9, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0505 "BENCH 13.0505"
+(2015, 3, 24, 2, 9, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0085 "Building point search tree to accelerate distance queries."
+(2015, 3, 24, 2, 10, 13) geometry-bounding_box_tree_build-cpp 14.1158 "BENCH 14.1158"
+(2015, 3, 24, 2, 10, 41) common-progress-cpp 27.8055 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 24, 2, 11, 53) common-timing-cpp 72.2283 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 24, 2, 13, 23) fem-convergence-cpp 3.64277 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 24, 5, 2, 16) fem-speedup-cpp 10132 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 24, 5, 2, 16) fem-speedup-cpp-assembly 6.2482 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 24, 5, 2, 16) fem-speedup-cpp-solve 0.653102 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 24, 5, 2, 26) mesh-refinement-cpp 9.68068 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 24, 5, 2, 48) mesh-topology-cpp 21.3483 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 24, 5, 3, 10) mesh-unitcube-cpp 22.186 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 24, 5, 3, 48) mesh-iteration-cpp 35.5008 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 24, 5, 3, 48) function-evaluation-cpp 0.0390491 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 24, 5, 5, 44) la-vector-access-cpp 112.12 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 24, 5, 6, 21) la-vector-assignment-cpp 37.5554 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 25, 2, 9, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0383 "BENCH 13.0383"
+(2015, 3, 25, 2, 9, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1951 "Building point search tree to accelerate distance queries."
+(2015, 3, 25, 2, 10, 13) geometry-bounding_box_tree_build-cpp 14.1323 "BENCH 14.1323"
+(2015, 3, 25, 2, 10, 41) common-progress-cpp 27.8443 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 25, 2, 11, 54) common-timing-cpp 72.3458 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 25, 2, 13, 24) fem-convergence-cpp 3.62637 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 25, 5, 2, 29) fem-speedup-cpp 10143.7 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 25, 5, 2, 29) fem-speedup-cpp-assembly 6.49894 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 25, 5, 2, 29) fem-speedup-cpp-solve 0.656719 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 25, 5, 2, 39) mesh-refinement-cpp 9.65583 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 25, 5, 3, 1) mesh-topology-cpp 21.3106 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 25, 5, 3, 23) mesh-unitcube-cpp 22.151 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 25, 5, 4, 1) mesh-iteration-cpp 35.5123 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 25, 5, 4, 1) function-evaluation-cpp 0.038727 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 25, 5, 5, 57) la-vector-access-cpp 112.99 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 25, 5, 6, 39) la-vector-assignment-cpp 41.4771 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 26, 2, 9, 34) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0301 "BENCH 13.0301"
+(2015, 3, 26, 2, 9, 52) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0209 "Building point search tree to accelerate distance queries."
+(2015, 3, 26, 2, 10, 9) geometry-bounding_box_tree_build-cpp 14.1601 "BENCH 14.1601"
+(2015, 3, 26, 2, 10, 37) common-progress-cpp 27.7787 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 26, 2, 11, 50) common-timing-cpp 72.9241 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 26, 2, 13, 20) fem-convergence-cpp 3.63802 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 26, 4, 59, 31) fem-speedup-cpp 9970.21 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 26, 4, 59, 31) fem-speedup-cpp-assembly 6.36023 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 26, 4, 59, 31) fem-speedup-cpp-solve 0.664266 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 26, 4, 59, 41) mesh-refinement-cpp 9.69414 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 26, 5, 0, 3) mesh-topology-cpp 21.3054 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 26, 5, 0, 25) mesh-unitcube-cpp 22.0974 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 26, 5, 1, 3) mesh-iteration-cpp 35.5122 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 26, 5, 1, 3) function-evaluation-cpp 0.035718 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 26, 5, 2, 56) la-vector-access-cpp 109.424 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 26, 5, 3, 33) la-vector-assignment-cpp 37.4888 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 27, 2, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0322 "BENCH 13.0322"
+(2015, 3, 27, 2, 9, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1999 "Building point search tree to accelerate distance queries."
+(2015, 3, 27, 2, 10, 10) geometry-bounding_box_tree_build-cpp 14.2077 "BENCH 14.2077"
+(2015, 3, 27, 2, 10, 38) common-progress-cpp 27.7875 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 27, 2, 11, 51) common-timing-cpp 73.573 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 27, 2, 13, 20) fem-convergence-cpp 3.62865 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 27, 4, 54, 3) fem-speedup-cpp 9641.67 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 27, 4, 54, 3) fem-speedup-cpp-assembly 6.37373 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 27, 4, 54, 3) fem-speedup-cpp-solve 0.699076 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 27, 4, 54, 14) mesh-refinement-cpp 9.68937 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 27, 4, 54, 35) mesh-topology-cpp 21.3365 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 27, 4, 54, 57) mesh-unitcube-cpp 22.0976 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 27, 4, 55, 36) mesh-iteration-cpp 36.8735 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 27, 4, 55, 36) function-evaluation-cpp 0.0354409 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 27, 4, 57, 32) la-vector-access-cpp 112.453 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 27, 4, 58, 10) la-vector-assignment-cpp 37.4824 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 28, 2, 9, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1162 "BENCH 13.1162"
+(2015, 3, 28, 2, 9, 55) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0197 "Building point search tree to accelerate distance queries."
+(2015, 3, 28, 2, 10, 11) geometry-bounding_box_tree_build-cpp 14.1425 "BENCH 14.1425"
+(2015, 3, 28, 2, 10, 39) common-progress-cpp 27.7741 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 28, 2, 11, 52) common-timing-cpp 73.0875 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 28, 2, 13, 21) fem-convergence-cpp 3.64967 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 28, 5, 20, 40) fem-speedup-cpp 11237.1 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 28, 5, 20, 40) fem-speedup-cpp-assembly 6.36185 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 28, 5, 20, 40) fem-speedup-cpp-solve 0.544172 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 28, 5, 20, 50) mesh-refinement-cpp 9.67083 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 28, 5, 21, 12) mesh-topology-cpp 21.3457 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 28, 5, 21, 34) mesh-unitcube-cpp 22.3124 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 28, 5, 22, 12) mesh-iteration-cpp 35.4978 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 28, 5, 22, 12) function-evaluation-cpp 0.0353961 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 28, 5, 24, 7) la-vector-access-cpp 111.928 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 28, 5, 24, 45) la-vector-assignment-cpp 37.5116 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 29, 1, 9, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0502 "BENCH 13.0502"
+(2015, 3, 29, 1, 9, 52) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1291 "Building point search tree to accelerate distance queries."
+(2015, 3, 29, 1, 10, 8) geometry-bounding_box_tree_build-cpp 14.0597 "BENCH 14.0597"
+(2015, 3, 29, 1, 10, 36) common-progress-cpp 27.7997 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 29, 1, 11, 49) common-timing-cpp 73.0022 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 29, 1, 13, 19) fem-convergence-cpp 3.65721 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 29, 4, 8, 39) fem-speedup-cpp 10518.5 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 29, 4, 8, 39) fem-speedup-cpp-assembly 6.31959 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 29, 4, 8, 39) fem-speedup-cpp-solve 0.603944 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 29, 4, 8, 49) mesh-refinement-cpp 9.70359 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 29, 4, 9, 11) mesh-topology-cpp 21.3499 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 29, 4, 9, 33) mesh-unitcube-cpp 22.1585 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 29, 4, 10, 10) mesh-iteration-cpp 35.5036 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 29, 4, 10, 11) function-evaluation-cpp 0.0357509 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 29, 4, 12, 5) la-vector-access-cpp 110.89 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 29, 4, 12, 47) la-vector-assignment-cpp 41.4822 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 30, 1, 9, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9603 "BENCH 12.9603"
+(2015, 3, 30, 1, 9, 52) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1731 "Building point search tree to accelerate distance queries."
+(2015, 3, 30, 1, 10, 8) geometry-bounding_box_tree_build-cpp 14.1585 "BENCH 14.1585"
+(2015, 3, 30, 1, 10, 41) common-progress-cpp 32.8053 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 30, 1, 11, 54) common-timing-cpp 73.2411 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 30, 1, 13, 24) fem-convergence-cpp 3.63205 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 30, 4, 15, 54) fem-speedup-cpp 10948.6 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 30, 4, 15, 54) fem-speedup-cpp-assembly 6.36559 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 30, 4, 15, 54) fem-speedup-cpp-solve 0.589143 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 30, 4, 16, 4) mesh-refinement-cpp 9.67372 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 30, 4, 16, 26) mesh-topology-cpp 21.3859 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 30, 4, 16, 48) mesh-unitcube-cpp 22.2561 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 30, 4, 17, 26) mesh-iteration-cpp 35.5267 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 30, 4, 17, 26) function-evaluation-cpp 0.035145 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 30, 4, 19, 25) la-vector-access-cpp 115.791 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 30, 4, 20, 7) la-vector-assignment-cpp 41.4756 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 3, 31, 1, 9, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1344 "BENCH 13.1344"
+(2015, 3, 31, 1, 9, 50) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0434 "Building point search tree to accelerate distance queries."
+(2015, 3, 31, 1, 10, 7) geometry-bounding_box_tree_build-cpp 14.0284 "BENCH 14.0284"
+(2015, 3, 31, 1, 10, 38) common-progress-cpp 31.5462 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 3, 31, 1, 11, 52) common-timing-cpp 73.3037 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 3, 31, 1, 13, 21) fem-convergence-cpp 3.62996 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 3, 31, 4, 8, 44) fem-speedup-cpp 10522.2 "Assembly/solve speedup running on 4 processors"
+(2015, 3, 31, 4, 8, 44) fem-speedup-cpp-assembly 6.29657 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 3, 31, 4, 8, 44) fem-speedup-cpp-solve 0.591001 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 3, 31, 4, 8, 55) mesh-refinement-cpp 9.64323 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 3, 31, 4, 9, 16) mesh-topology-cpp 21.4307 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 3, 31, 4, 9, 38) mesh-unitcube-cpp 21.6919 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 3, 31, 4, 10, 19) mesh-iteration-cpp 39.1356 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 3, 31, 4, 10, 19) function-evaluation-cpp 0.0353961 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 3, 31, 4, 12, 14) la-vector-access-cpp 111.431 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 3, 31, 4, 12, 55) la-vector-assignment-cpp 40.9787 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 1, 1, 9, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0933 "BENCH 13.0933"
+(2015, 4, 1, 1, 9, 50) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9485 "Building point search tree to accelerate distance queries."
+(2015, 4, 1, 1, 10, 6) geometry-bounding_box_tree_build-cpp 14.091 "BENCH 14.091"
+(2015, 4, 1, 1, 10, 34) common-progress-cpp 27.7913 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 1, 1, 11, 47) common-timing-cpp 72.4916 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 1, 1, 13, 16) fem-convergence-cpp 3.63863 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 1, 3, 55, 27) fem-speedup-cpp 9729.53 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 1, 3, 55, 27) fem-speedup-cpp-assembly 6.36345 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 1, 3, 55, 27) fem-speedup-cpp-solve 0.689531 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 1, 3, 55, 37) mesh-refinement-cpp 9.63922 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 1, 3, 55, 59) mesh-topology-cpp 21.3666 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 1, 3, 56, 20) mesh-unitcube-cpp 21.6769 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 1, 3, 56, 58) mesh-iteration-cpp 35.5269 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 1, 3, 56, 58) function-evaluation-cpp 0.0354221 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 1, 3, 58, 58) la-vector-access-cpp 115.76 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 1, 3, 59, 35) la-vector-assignment-cpp 37.4821 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 2, 1, 9, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3026 "BENCH 13.3026"
+(2015, 4, 2, 1, 9, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1131 "Building point search tree to accelerate distance queries."
+(2015, 4, 2, 1, 10, 8) geometry-bounding_box_tree_build-cpp 14.1829 "BENCH 14.1829"
+(2015, 4, 2, 1, 10, 35) common-progress-cpp 27.797 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 2, 1, 11, 47) common-timing-cpp 72.0636 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 2, 1, 13, 18) fem-convergence-cpp 3.64341 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 2, 3, 59, 52) fem-speedup-cpp 9993.54 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 2, 3, 59, 52) fem-speedup-cpp-assembly 6.25165 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 2, 3, 59, 52) fem-speedup-cpp-solve 0.669682 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 2, 4, 0, 3) mesh-refinement-cpp 9.66889 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 2, 4, 0, 24) mesh-topology-cpp 21.3509 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 2, 4, 0, 46) mesh-unitcube-cpp 21.6824 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 2, 4, 1, 24) mesh-iteration-cpp 35.4969 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 2, 4, 1, 24) function-evaluation-cpp 0.035593 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 2, 4, 3, 20) la-vector-access-cpp 112.476 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 2, 4, 3, 57) la-vector-assignment-cpp 37.5137 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 3, 1, 9, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3462 "BENCH 13.3462"
+(2015, 4, 3, 1, 9, 54) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9524 "Building point search tree to accelerate distance queries."
+(2015, 4, 3, 1, 10, 10) geometry-bounding_box_tree_build-cpp 14.0217 "BENCH 14.0217"
+(2015, 4, 3, 1, 10, 38) common-progress-cpp 27.7768 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 3, 1, 11, 51) common-timing-cpp 72.7836 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 3, 1, 13, 21) fem-convergence-cpp 3.66019 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 3, 3, 56, 53) fem-speedup-cpp 9810.88 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 3, 3, 56, 53) fem-speedup-cpp-assembly 6.71282 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 3, 3, 56, 53) fem-speedup-cpp-solve 0.662128 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 3, 3, 57, 4) mesh-refinement-cpp 9.65438 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 3, 3, 57, 25) mesh-topology-cpp 21.3812 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 3, 3, 57, 47) mesh-unitcube-cpp 21.6871 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 3, 3, 58, 25) mesh-iteration-cpp 35.4898 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 3, 3, 58, 25) function-evaluation-cpp 0.035744 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 3, 4, 0, 22) la-vector-access-cpp 113.908 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 3, 4, 0, 59) la-vector-assignment-cpp 36.4831 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 4, 1, 9, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3173 "BENCH 13.3173"
+(2015, 4, 4, 1, 9, 50) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9574 "Building point search tree to accelerate distance queries."
+(2015, 4, 4, 1, 10, 7) geometry-bounding_box_tree_build-cpp 14.1174 "BENCH 14.1174"
+(2015, 4, 4, 1, 10, 35) common-progress-cpp 27.7887 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 4, 1, 11, 48) common-timing-cpp 73.3024 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 4, 1, 13, 18) fem-convergence-cpp 3.64401 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 4, 4, 17, 38) fem-speedup-cpp 11059.5 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 4, 4, 17, 38) fem-speedup-cpp-assembly 6.4694 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 4, 4, 17, 38) fem-speedup-cpp-solve 0.568368 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 4, 4, 17, 49) mesh-refinement-cpp 9.61396 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 4, 4, 18, 10) mesh-topology-cpp 21.5116 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 4, 4, 18, 32) mesh-unitcube-cpp 21.7626 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 4, 4, 19, 13) mesh-iteration-cpp 39.1351 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 4, 4, 19, 13) function-evaluation-cpp 0.039237 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 4, 4, 21, 11) la-vector-access-cpp 113.507 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 4, 4, 21, 47) la-vector-assignment-cpp 36.4969 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 5, 1, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3351 "BENCH 13.3351"
+(2015, 4, 5, 1, 9, 54) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1845 "Building point search tree to accelerate distance queries."
+(2015, 4, 5, 1, 10, 10) geometry-bounding_box_tree_build-cpp 14.1159 "BENCH 14.1159"
+(2015, 4, 5, 1, 10, 38) common-progress-cpp 27.7801 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 5, 1, 11, 51) common-timing-cpp 73.2506 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 5, 1, 13, 21) fem-convergence-cpp 3.62065 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 5, 4, 17, 9) fem-speedup-cpp 11026.8 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 5, 4, 17, 9) fem-speedup-cpp-assembly 6.48604 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 5, 4, 17, 9) fem-speedup-cpp-solve 0.6979 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 5, 4, 17, 20) mesh-refinement-cpp 9.65171 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 5, 4, 17, 41) mesh-topology-cpp 21.4417 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 5, 4, 18, 3) mesh-unitcube-cpp 21.6716 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 5, 4, 18, 41) mesh-iteration-cpp 35.8234 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 5, 4, 18, 41) function-evaluation-cpp 0.043462 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 5, 4, 20, 39) la-vector-access-cpp 114.277 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 5, 4, 21, 19) la-vector-assignment-cpp 39.4888 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 6, 1, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.7024 "BENCH 13.7024"
+(2015, 4, 6, 1, 9, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3824 "Building point search tree to accelerate distance queries."
+(2015, 4, 6, 1, 10, 12) geometry-bounding_box_tree_build-cpp 14.0984 "BENCH 14.0984"
+(2015, 4, 6, 1, 10, 40) common-progress-cpp 27.7735 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 6, 1, 11, 53) common-timing-cpp 72.94 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 6, 1, 13, 23) fem-convergence-cpp 3.63467 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 6, 4, 13, 38) fem-speedup-cpp 10813.9 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 6, 4, 13, 38) fem-speedup-cpp-assembly 6.73676 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 6, 4, 13, 38) fem-speedup-cpp-solve 0.561516 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 6, 4, 13, 48) mesh-refinement-cpp 9.6234 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 6, 4, 14, 10) mesh-topology-cpp 21.48 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 6, 4, 14, 32) mesh-unitcube-cpp 21.6753 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 6, 4, 15, 9) mesh-iteration-cpp 35.5129 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 6, 4, 15, 9) function-evaluation-cpp 0.0354102 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 6, 4, 17, 7) la-vector-access-cpp 114.335 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 6, 4, 17, 44) la-vector-assignment-cpp 36.4938 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 7, 1, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.4472 "BENCH 13.4472"
+(2015, 4, 7, 1, 9, 54) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9809 "Building point search tree to accelerate distance queries."
+(2015, 4, 7, 1, 10, 10) geometry-bounding_box_tree_build-cpp 14.0727 "BENCH 14.0727"
+(2015, 4, 7, 1, 10, 38) common-progress-cpp 27.7865 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 7, 1, 11, 51) common-timing-cpp 73.7367 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 7, 1, 13, 22) fem-convergence-cpp 3.63024 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 7, 4, 4, 0) fem-speedup-cpp 10237 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 7, 4, 4, 0) fem-speedup-cpp-assembly 6.74871 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 7, 4, 4, 0) fem-speedup-cpp-solve 0.603304 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 7, 4, 4, 10) mesh-refinement-cpp 9.62282 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 7, 4, 4, 32) mesh-topology-cpp 21.4942 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 7, 4, 4, 54) mesh-unitcube-cpp 21.7091 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 7, 4, 5, 31) mesh-iteration-cpp 35.5348 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 7, 4, 5, 31) function-evaluation-cpp 0.0389779 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 7, 4, 7, 29) la-vector-access-cpp 113.439 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 7, 4, 8, 5) la-vector-assignment-cpp 36.521 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 8, 8, 51, 32) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.4379 "BENCH 13.4379"
+(2015, 4, 8, 8, 51, 50) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0969 "Building point search tree to accelerate distance queries."
+(2015, 4, 8, 8, 52, 7) geometry-bounding_box_tree_build-cpp 14.1019 "BENCH 14.1019"
+(2015, 4, 8, 8, 52, 34) common-progress-cpp 27.8402 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 8, 8, 53, 38) common-timing-cpp 63.9655 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 8, 8, 55, 8) fem-convergence-cpp 3.62104 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 8, 10, 36, 5) mesh-refinement-cpp 9.14802 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 8, 10, 36, 26) mesh-topology-cpp 21.238 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 8, 10, 36, 48) mesh-unitcube-cpp 21.6292 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 8, 10, 37, 26) mesh-iteration-cpp 35.4998 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 8, 10, 37, 26) function-evaluation-cpp 0.0352221 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 8, 10, 39, 25) la-vector-access-cpp 116.317 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 8, 10, 40, 2) la-vector-assignment-cpp 36.5087 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 9, 1, 9, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2085 "BENCH 13.2085"
+(2015, 4, 9, 1, 9, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2299 "Building point search tree to accelerate distance queries."
+(2015, 4, 9, 1, 10, 14) geometry-bounding_box_tree_build-cpp 13.8995 "BENCH 13.8995"
+(2015, 4, 9, 1, 10, 42) common-progress-cpp 27.603 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 9, 1, 11, 46) common-timing-cpp 63.9817 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 9, 1, 13, 16) fem-convergence-cpp 3.59788 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 9, 4, 12, 15) fem-speedup-cpp 10738.2 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 9, 4, 12, 15) fem-speedup-cpp-assembly 6.57987 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 9, 4, 12, 15) fem-speedup-cpp-solve 0.684451 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 9, 4, 12, 25) mesh-refinement-cpp 9.16209 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 9, 4, 12, 46) mesh-topology-cpp 21.382 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 9, 4, 13, 8) mesh-unitcube-cpp 21.8049 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 9, 4, 13, 46) mesh-iteration-cpp 35.519 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 9, 4, 13, 46) function-evaluation-cpp 0.038352 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 9, 4, 15, 44) la-vector-access-cpp 114.303 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 9, 4, 16, 20) la-vector-assignment-cpp 36.4739 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 10, 1, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.591 "BENCH 13.591"
+(2015, 4, 10, 1, 9, 55) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0553 "Building point search tree to accelerate distance queries."
+(2015, 4, 10, 1, 10, 12) geometry-bounding_box_tree_build-cpp 14.1165 "BENCH 14.1165"
+(2015, 4, 10, 1, 10, 40) common-progress-cpp 27.8776 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 10, 1, 11, 44) common-timing-cpp 64.1436 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 10, 1, 13, 13) fem-convergence-cpp 3.62725 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 10, 4, 1, 21) fem-speedup-cpp 10086.9 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 10, 4, 1, 21) fem-speedup-cpp-assembly 6.68044 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 10, 4, 1, 21) fem-speedup-cpp-solve 0.666504 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 10, 4, 1, 31) mesh-refinement-cpp 9.17588 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 10, 4, 1, 53) mesh-topology-cpp 21.3396 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 10, 4, 2, 14) mesh-unitcube-cpp 21.653 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 10, 4, 2, 52) mesh-iteration-cpp 35.5009 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 10, 4, 2, 52) function-evaluation-cpp 0.034878 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 10, 4, 4, 54) la-vector-access-cpp 117.761 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 10, 4, 5, 30) la-vector-assignment-cpp 36.4777 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 11, 1, 9, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1601 "BENCH 13.1601"
+(2015, 4, 11, 1, 9, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0435 "Building point search tree to accelerate distance queries."
+(2015, 4, 11, 1, 10, 8) geometry-bounding_box_tree_build-cpp 14.1495 "BENCH 14.1495"
+(2015, 4, 11, 1, 10, 35) common-progress-cpp 27.794 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 11, 1, 11, 39) common-timing-cpp 63.4772 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 11, 1, 13, 8) fem-convergence-cpp 3.62251 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 11, 3, 54, 38) fem-speedup-cpp 9689.09 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 11, 3, 54, 38) fem-speedup-cpp-assembly 6.50448 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 11, 3, 54, 38) fem-speedup-cpp-solve 0.691481 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 11, 3, 54, 48) mesh-refinement-cpp 9.15763 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 11, 3, 55, 9) mesh-topology-cpp 21.2523 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 11, 3, 55, 31) mesh-unitcube-cpp 21.6626 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 11, 3, 56, 9) mesh-iteration-cpp 35.5048 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 11, 3, 56, 9) function-evaluation-cpp 0.040292 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 11, 3, 58, 7) la-vector-access-cpp 114.262 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 11, 3, 58, 43) la-vector-assignment-cpp 36.4692 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 12, 1, 9, 34) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1518 "BENCH 13.1518"
+(2015, 4, 12, 1, 9, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1155 "Building point search tree to accelerate distance queries."
+(2015, 4, 12, 1, 10, 9) geometry-bounding_box_tree_build-cpp 14.2739 "BENCH 14.2739"
+(2015, 4, 12, 1, 10, 37) common-progress-cpp 27.7924 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 12, 1, 11, 41) common-timing-cpp 63.2712 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 12, 1, 13, 11) fem-convergence-cpp 3.61227 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 12, 4, 1, 19) fem-speedup-cpp 10087.4 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 12, 4, 1, 19) fem-speedup-cpp-assembly 6.72262 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 12, 4, 1, 19) fem-speedup-cpp-solve 0.644347 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 12, 4, 1, 29) mesh-refinement-cpp 9.16893 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 12, 4, 1, 50) mesh-topology-cpp 21.2774 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 12, 4, 2, 12) mesh-unitcube-cpp 21.6701 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 12, 4, 2, 50) mesh-iteration-cpp 35.6816 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 12, 4, 2, 50) function-evaluation-cpp 0.027941 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 12, 4, 4, 49) la-vector-access-cpp 115.838 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 12, 4, 5, 26) la-vector-assignment-cpp 36.4761 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 13, 1, 9, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0692 "BENCH 13.0692"
+(2015, 4, 13, 1, 9, 55) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0913 "Building point search tree to accelerate distance queries."
+(2015, 4, 13, 1, 10, 11) geometry-bounding_box_tree_build-cpp 14.1144 "BENCH 14.1144"
+(2015, 4, 13, 1, 10, 39) common-progress-cpp 27.803 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 13, 1, 11, 44) common-timing-cpp 64.9613 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 13, 1, 13, 13) fem-convergence-cpp 3.60443 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 13, 4, 4, 55) fem-speedup-cpp 10301.4 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 13, 4, 4, 55) fem-speedup-cpp-assembly 6.76648 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 13, 4, 4, 55) fem-speedup-cpp-solve 0.604945 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 13, 4, 5, 5) mesh-refinement-cpp 9.14718 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 13, 4, 5, 27) mesh-topology-cpp 21.3448 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 13, 4, 5, 49) mesh-unitcube-cpp 21.6934 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 13, 4, 6, 26) mesh-iteration-cpp 35.4928 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 13, 4, 6, 26) function-evaluation-cpp 0.038332 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 13, 4, 8, 26) la-vector-access-cpp 115.658 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 13, 4, 9, 5) la-vector-assignment-cpp 39.4667 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 14, 1, 9, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1476 "BENCH 13.1476"
+(2015, 4, 14, 1, 9, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0144 "Building point search tree to accelerate distance queries."
+(2015, 4, 14, 1, 10, 13) geometry-bounding_box_tree_build-cpp 14.0995 "BENCH 14.0995"
+(2015, 4, 14, 1, 10, 40) common-progress-cpp 27.7907 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 14, 1, 11, 44) common-timing-cpp 63.7126 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 14, 1, 13, 14) fem-convergence-cpp 3.6255 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 14, 4, 2, 10) fem-speedup-cpp 10135.6 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 14, 4, 2, 10) fem-speedup-cpp-assembly 6.46744 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 14, 4, 2, 10) fem-speedup-cpp-solve 0.624507 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 14, 4, 2, 20) mesh-refinement-cpp 9.14568 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 14, 4, 2, 42) mesh-topology-cpp 21.2478 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 14, 4, 3, 3) mesh-unitcube-cpp 21.7618 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 14, 4, 3, 41) mesh-iteration-cpp 35.5299 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 14, 4, 3, 41) function-evaluation-cpp 0.0382171 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 14, 4, 5, 41) la-vector-access-cpp 116.271 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 14, 4, 6, 21) la-vector-assignment-cpp 39.4614 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 15, 1, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2145 "BENCH 13.2145"
+(2015, 4, 15, 1, 9, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0778 "Building point search tree to accelerate distance queries."
+(2015, 4, 15, 1, 10, 12) geometry-bounding_box_tree_build-cpp 14.203 "BENCH 14.203"
+(2015, 4, 15, 1, 10, 40) common-progress-cpp 27.8022 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 15, 1, 11, 44) common-timing-cpp 64.3117 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 15, 1, 13, 13) fem-convergence-cpp 3.6242 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 15, 4, 0, 21) fem-speedup-cpp 10026.3 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 15, 4, 0, 21) fem-speedup-cpp-assembly 6.50696 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 15, 4, 0, 21) fem-speedup-cpp-solve 0.670853 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 15, 4, 0, 31) mesh-refinement-cpp 9.14554 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 15, 4, 0, 52) mesh-topology-cpp 21.2688 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 15, 4, 1, 14) mesh-unitcube-cpp 21.909 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 15, 4, 1, 52) mesh-iteration-cpp 35.4966 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 15, 4, 1, 52) function-evaluation-cpp 0.0349629 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 15, 4, 3, 51) la-vector-access-cpp 115.73 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 15, 4, 4, 29) la-vector-assignment-cpp 37.4664 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 16, 1, 9, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1963 "BENCH 13.1963"
+(2015, 4, 16, 1, 10, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0939 "Building point search tree to accelerate distance queries."
+(2015, 4, 16, 1, 10, 16) geometry-bounding_box_tree_build-cpp 14.0298 "BENCH 14.0298"
+(2015, 4, 16, 1, 10, 44) common-progress-cpp 27.7917 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 16, 1, 11, 49) common-timing-cpp 64.7233 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 16, 1, 13, 18) fem-convergence-cpp 3.61638 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 16, 4, 4, 37) fem-speedup-cpp 10277.5 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 16, 4, 4, 37) fem-speedup-cpp-assembly 6.38835 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 16, 4, 4, 37) fem-speedup-cpp-solve 0.620408 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 16, 4, 4, 47) mesh-refinement-cpp 9.15574 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 16, 4, 5, 8) mesh-topology-cpp 21.2789 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 16, 4, 5, 30) mesh-unitcube-cpp 21.6483 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 16, 4, 6, 8) mesh-iteration-cpp 35.5066 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 16, 4, 6, 8) function-evaluation-cpp 0.036684 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 16, 4, 8, 7) la-vector-access-cpp 115.594 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 16, 4, 8, 44) la-vector-assignment-cpp 36.4722 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 17, 1, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.4965 "BENCH 13.4965"
+(2015, 4, 17, 1, 9, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9747 "Building point search tree to accelerate distance queries."
+(2015, 4, 17, 1, 10, 12) geometry-bounding_box_tree_build-cpp 14.0599 "BENCH 14.0599"
+(2015, 4, 17, 1, 10, 40) common-progress-cpp 27.8042 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 17, 1, 11, 44) common-timing-cpp 64.2935 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 17, 1, 13, 14) fem-convergence-cpp 3.61955 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 17, 4, 11, 15) fem-speedup-cpp 10680.2 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 17, 4, 11, 15) fem-speedup-cpp-assembly 6.42855 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 17, 4, 11, 15) fem-speedup-cpp-solve 0.6013 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 17, 4, 11, 25) mesh-refinement-cpp 9.15371 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 17, 4, 11, 46) mesh-topology-cpp 21.2584 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 17, 4, 12, 8) mesh-unitcube-cpp 21.6452 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 17, 4, 12, 46) mesh-iteration-cpp 35.5034 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 17, 4, 12, 46) function-evaluation-cpp 0.0376451 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 17, 4, 14, 44) la-vector-access-cpp 114.283 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 17, 4, 15, 20) la-vector-assignment-cpp 36.4755 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 18, 1, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2123 "BENCH 13.2123"
+(2015, 4, 18, 1, 9, 55) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1565 "Building point search tree to accelerate distance queries."
+(2015, 4, 18, 1, 10, 11) geometry-bounding_box_tree_build-cpp 14.0401 "BENCH 14.0401"
+(2015, 4, 18, 1, 10, 39) common-progress-cpp 27.8243 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 18, 1, 11, 43) common-timing-cpp 63.9508 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 18, 1, 13, 13) fem-convergence-cpp 3.62749 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 18, 3, 58, 53) fem-speedup-cpp 9939.21 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 18, 3, 58, 53) fem-speedup-cpp-assembly 6.47647 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 18, 3, 58, 53) fem-speedup-cpp-solve 0.644115 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 18, 3, 59, 3) mesh-refinement-cpp 9.21698 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 18, 3, 59, 24) mesh-topology-cpp 21.27 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 18, 3, 59, 46) mesh-unitcube-cpp 21.6802 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 18, 4, 0, 24) mesh-iteration-cpp 35.4939 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 18, 4, 0, 24) function-evaluation-cpp 0.0358541 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 18, 4, 2, 25) la-vector-access-cpp 117.745 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 18, 4, 3, 2) la-vector-assignment-cpp 36.4757 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 19, 1, 9, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.627 "BENCH 13.627"
+(2015, 4, 19, 1, 9, 51) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9444 "Building point search tree to accelerate distance queries."
+(2015, 4, 19, 1, 10, 7) geometry-bounding_box_tree_build-cpp 14.0878 "BENCH 14.0878"
+(2015, 4, 19, 1, 10, 35) common-progress-cpp 27.7724 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 19, 1, 11, 39) common-timing-cpp 63.8627 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 19, 1, 13, 9) fem-convergence-cpp 3.61193 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 19, 4, 3, 19) fem-speedup-cpp 10209.3 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 19, 4, 3, 19) fem-speedup-cpp-assembly 6.80954 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 19, 4, 3, 19) fem-speedup-cpp-solve 0.682124 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 19, 4, 3, 29) mesh-refinement-cpp 9.14876 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 19, 4, 3, 50) mesh-topology-cpp 21.3514 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 19, 4, 4, 12) mesh-unitcube-cpp 21.7411 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 19, 4, 4, 50) mesh-iteration-cpp 35.4968 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 19, 4, 4, 50) function-evaluation-cpp 0.0377541 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 19, 4, 6, 48) la-vector-access-cpp 114.255 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 19, 4, 7, 24) la-vector-assignment-cpp 36.4751 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 20, 1, 9, 31) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2428 "BENCH 13.2428"
+(2015, 4, 20, 1, 9, 49) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0815 "Building point search tree to accelerate distance queries."
+(2015, 4, 20, 1, 10, 6) geometry-bounding_box_tree_build-cpp 14.1582 "BENCH 14.1582"
+(2015, 4, 20, 1, 10, 33) common-progress-cpp 27.7913 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 20, 1, 11, 37) common-timing-cpp 63.8659 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 20, 1, 13, 6) fem-convergence-cpp 3.60441 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 20, 4, 7, 33) fem-speedup-cpp 10465.1 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 20, 4, 7, 33) fem-speedup-cpp-assembly 6.36324 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 20, 4, 7, 33) fem-speedup-cpp-solve 0.621485 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 20, 4, 7, 43) mesh-refinement-cpp 9.17669 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 20, 4, 8, 4) mesh-topology-cpp 21.2291 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 20, 4, 8, 26) mesh-unitcube-cpp 21.8095 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 20, 4, 9, 4) mesh-iteration-cpp 35.5152 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 20, 4, 9, 4) function-evaluation-cpp 0.03426 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 20, 4, 11, 2) la-vector-access-cpp 114.294 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 20, 4, 11, 41) la-vector-assignment-cpp 39.4686 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 21, 1, 9, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3882 "BENCH 13.3882"
+(2015, 4, 21, 1, 9, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0361 "Building point search tree to accelerate distance queries."
+(2015, 4, 21, 1, 10, 15) geometry-bounding_box_tree_build-cpp 14.076 "BENCH 14.076"
+(2015, 4, 21, 1, 10, 43) common-progress-cpp 27.7929 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 21, 1, 11, 46) common-timing-cpp 63.906 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 21, 1, 13, 16) fem-convergence-cpp 3.61848 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 21, 4, 6, 48) fem-speedup-cpp 10410.6 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 21, 4, 6, 48) fem-speedup-cpp-assembly 6.67826 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 21, 4, 6, 48) fem-speedup-cpp-solve 0.607917 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 21, 4, 6, 58) mesh-refinement-cpp 9.27125 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 21, 4, 6, 59) mesh-topology-cpp 1.33654 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 21, 4, 7, 22) mesh-unitcube-cpp 22.1842 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 21, 4, 8, 0) mesh-iteration-cpp 35.7457 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 21, 4, 8, 0) function-evaluation-cpp 0.037791 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 21, 4, 9, 59) la-vector-access-cpp 115.772 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 21, 4, 10, 35) la-vector-assignment-cpp 35.9818 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 22, 1, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1908 "BENCH 13.1908"
+(2015, 4, 22, 1, 9, 55) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1477 "Building point search tree to accelerate distance queries."
+(2015, 4, 22, 1, 10, 12) geometry-bounding_box_tree_build-cpp 14.1099 "BENCH 14.1099"
+(2015, 4, 22, 1, 10, 40) common-progress-cpp 27.7906 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 22, 1, 11, 43) common-timing-cpp 63.213 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 22, 1, 13, 13) fem-convergence-cpp 3.62069 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 22, 4, 4, 9) fem-speedup-cpp 10254.9 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 22, 4, 4, 9) fem-speedup-cpp-assembly 6.41021 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 22, 4, 4, 9) fem-speedup-cpp-solve 0.640712 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 22, 4, 4, 19) mesh-refinement-cpp 9.20264 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 22, 4, 4, 20) mesh-topology-cpp 1.33284 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 22, 4, 4, 42) mesh-unitcube-cpp 22.1166 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 22, 4, 5, 20) mesh-iteration-cpp 35.478 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 22, 4, 5, 20) function-evaluation-cpp 0.037667 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 22, 4, 7, 20) la-vector-access-cpp 116.28 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 22, 4, 7, 56) la-vector-assignment-cpp 35.9827 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 23, 1, 9, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2766 "BENCH 13.2766"
+(2015, 4, 23, 1, 9, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8697 "Building point search tree to accelerate distance queries."
+(2015, 4, 23, 1, 10, 15) geometry-bounding_box_tree_build-cpp 14.0791 "BENCH 14.0791"
+(2015, 4, 23, 1, 10, 43) common-progress-cpp 27.7834 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 23, 1, 11, 47) common-timing-cpp 63.9912 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 23, 1, 13, 17) fem-convergence-cpp 3.63087 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 23, 4, 3, 36) fem-speedup-cpp 10218.8 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 23, 4, 3, 36) fem-speedup-cpp-assembly 6.49663 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 23, 4, 3, 36) fem-speedup-cpp-solve 0.617887 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 23, 4, 3, 47) mesh-refinement-cpp 9.21024 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 23, 4, 3, 48) mesh-topology-cpp 1.33339 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 23, 4, 4, 10) mesh-unitcube-cpp 22.1295 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 23, 4, 4, 56) mesh-iteration-cpp 44.1427 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 23, 4, 4, 57) function-evaluation-cpp 0.034364 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 23, 4, 6, 54) la-vector-access-cpp 114.239 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 23, 4, 7, 30) la-vector-assignment-cpp 35.9838 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 24, 1, 9, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.127 "BENCH 13.127"
+(2015, 4, 24, 1, 9, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0772 "Building point search tree to accelerate distance queries."
+(2015, 4, 24, 1, 10, 15) geometry-bounding_box_tree_build-cpp 14.2133 "BENCH 14.2133"
+(2015, 4, 24, 1, 10, 43) common-progress-cpp 27.7949 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 24, 1, 11, 46) common-timing-cpp 63.2649 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 24, 1, 13, 15) fem-convergence-cpp 3.62138 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 24, 4, 8, 10) fem-speedup-cpp 10494.4 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 24, 4, 8, 10) fem-speedup-cpp-assembly 6.82869 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 24, 4, 8, 10) fem-speedup-cpp-solve 0.609111 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 24, 4, 8, 20) mesh-refinement-cpp 9.2111 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 24, 4, 8, 22) mesh-topology-cpp 1.33133 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 24, 4, 8, 44) mesh-unitcube-cpp 22.1796 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 24, 4, 9, 22) mesh-iteration-cpp 35.528 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 24, 4, 9, 22) function-evaluation-cpp 0.0352299 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 24, 4, 11, 20) la-vector-access-cpp 114.317 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 24, 4, 11, 56) la-vector-assignment-cpp 35.9852 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 25, 1, 9, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1298 "BENCH 13.1298"
+(2015, 4, 25, 1, 9, 52) geometry-bounding_box_tree_compute_closest_entity-cpp 14.985 "Building point search tree to accelerate distance queries."
+(2015, 4, 25, 1, 10, 8) geometry-bounding_box_tree_build-cpp 14.0954 "BENCH 14.0954"
+(2015, 4, 25, 1, 10, 36) common-progress-cpp 27.7815 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 25, 1, 11, 41) common-timing-cpp 64.7918 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 25, 1, 13, 10) fem-convergence-cpp 3.62762 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 25, 4, 5, 20) fem-speedup-cpp 10329 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 25, 4, 5, 20) fem-speedup-cpp-assembly 6.47005 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 25, 4, 5, 20) fem-speedup-cpp-solve 0.627884 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 25, 4, 5, 30) mesh-refinement-cpp 9.18892 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 25, 4, 5, 32) mesh-topology-cpp 1.33027 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 25, 4, 5, 54) mesh-unitcube-cpp 22.1017 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 25, 4, 6, 32) mesh-iteration-cpp 35.5081 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 25, 4, 6, 32) function-evaluation-cpp 0.0343881 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 25, 4, 8, 29) la-vector-access-cpp 114.288 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 25, 4, 9, 5) la-vector-assignment-cpp 35.9791 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 26, 1, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.4863 "BENCH 13.4863"
+(2015, 4, 26, 1, 9, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3225 "Building point search tree to accelerate distance queries."
+(2015, 4, 26, 1, 10, 10) geometry-bounding_box_tree_build-cpp 14.1405 "BENCH 14.1405"
+(2015, 4, 26, 1, 10, 38) common-progress-cpp 27.7882 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 26, 1, 11, 41) common-timing-cpp 63.6421 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 26, 1, 13, 11) fem-convergence-cpp 3.62832 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 26, 4, 3, 40) fem-speedup-cpp 10227.6 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 26, 4, 3, 40) fem-speedup-cpp-assembly 6.39645 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 26, 4, 3, 40) fem-speedup-cpp-solve 0.719526 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 26, 4, 3, 49) mesh-refinement-cpp 9.22817 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 26, 4, 3, 51) mesh-topology-cpp 1.33867 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 26, 4, 4, 13) mesh-unitcube-cpp 22.4204 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 26, 4, 4, 51) mesh-iteration-cpp 35.5024 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 26, 4, 4, 51) function-evaluation-cpp 0.034106 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 26, 4, 6, 51) la-vector-access-cpp 115.84 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 26, 4, 7, 27) la-vector-assignment-cpp 36.0699 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 27, 1, 9, 30) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1501 "BENCH 13.1501"
+(2015, 4, 27, 1, 9, 49) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1377 "Building point search tree to accelerate distance queries."
+(2015, 4, 27, 1, 10, 6) geometry-bounding_box_tree_build-cpp 14.2875 "BENCH 14.2875"
+(2015, 4, 27, 1, 10, 33) common-progress-cpp 27.8033 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 27, 1, 11, 39) common-timing-cpp 65.2472 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 27, 1, 13, 8) fem-convergence-cpp 3.6252 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 27, 4, 15, 43) fem-speedup-cpp 10954.2 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 27, 4, 15, 43) fem-speedup-cpp-assembly 6.44218 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 27, 4, 15, 43) fem-speedup-cpp-solve 0.601751 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 27, 4, 15, 53) mesh-refinement-cpp 9.24067 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 27, 4, 15, 55) mesh-topology-cpp 1.33275 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 27, 4, 16, 17) mesh-unitcube-cpp 22.193 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 27, 4, 16, 55) mesh-iteration-cpp 35.5279 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 27, 4, 16, 55) function-evaluation-cpp 0.034445 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 27, 4, 18, 53) la-vector-access-cpp 114.263 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 27, 4, 19, 29) la-vector-assignment-cpp 35.9776 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 28, 1, 9, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1393 "BENCH 13.1393"
+(2015, 4, 28, 1, 9, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9272 "Building point search tree to accelerate distance queries."
+(2015, 4, 28, 1, 10, 15) geometry-bounding_box_tree_build-cpp 14.1232 "BENCH 14.1232"
+(2015, 4, 28, 1, 10, 42) common-progress-cpp 27.799 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 28, 1, 11, 47) common-timing-cpp 64.3191 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 28, 1, 13, 16) fem-convergence-cpp 3.61657 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 28, 4, 10, 39) fem-speedup-cpp 10642.3 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 28, 4, 10, 39) fem-speedup-cpp-assembly 6.51455 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 28, 4, 10, 39) fem-speedup-cpp-solve 0.595347 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 28, 4, 10, 49) mesh-refinement-cpp 9.32179 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 28, 4, 10, 51) mesh-topology-cpp 1.33548 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 28, 4, 11, 13) mesh-unitcube-cpp 22.1749 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 28, 4, 11, 51) mesh-iteration-cpp 35.5042 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 28, 4, 11, 51) function-evaluation-cpp 0.0343492 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 28, 4, 13, 48) la-vector-access-cpp 114.03 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 28, 4, 14, 27) la-vector-assignment-cpp 38.9139 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 29, 1, 9, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3096 "BENCH 13.3096"
+(2015, 4, 29, 1, 9, 55) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2465 "Building point search tree to accelerate distance queries."
+(2015, 4, 29, 1, 10, 11) geometry-bounding_box_tree_build-cpp 14.0984 "BENCH 14.0984"
+(2015, 4, 29, 1, 10, 39) common-progress-cpp 27.9258 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 29, 1, 11, 45) common-timing-cpp 65.6278 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 29, 1, 13, 14) fem-convergence-cpp 3.6139 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 29, 4, 16, 38) fem-speedup-cpp 11002.8 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 29, 4, 16, 38) fem-speedup-cpp-assembly 6.41102 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 29, 4, 16, 38) fem-speedup-cpp-solve 0.601815 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 29, 4, 16, 48) mesh-refinement-cpp 9.24805 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 29, 4, 16, 49) mesh-topology-cpp 1.3351 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 29, 4, 17, 12) mesh-unitcube-cpp 22.1454 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 29, 4, 17, 49) mesh-iteration-cpp 35.5179 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 29, 4, 17, 49) function-evaluation-cpp 0.037694 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 29, 4, 19, 49) la-vector-access-cpp 115.809 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 29, 4, 20, 25) la-vector-assignment-cpp 35.9823 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 4, 30, 1, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.252 "BENCH 13.252"
+(2015, 4, 30, 1, 9, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1466 "Building point search tree to accelerate distance queries."
+(2015, 4, 30, 1, 10, 12) geometry-bounding_box_tree_build-cpp 14.1009 "BENCH 14.1009"
+(2015, 4, 30, 1, 10, 40) common-progress-cpp 27.7946 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 4, 30, 1, 11, 44) common-timing-cpp 63.8807 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 4, 30, 1, 13, 13) fem-convergence-cpp 3.62591 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 4, 30, 4, 2, 49) fem-speedup-cpp 10174.9 "Assembly/solve speedup running on 4 processors"
+(2015, 4, 30, 4, 2, 49) fem-speedup-cpp-assembly 6.70051 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 4, 30, 4, 2, 49) fem-speedup-cpp-solve 0.658303 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 4, 30, 4, 2, 59) mesh-refinement-cpp 9.26497 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 4, 30, 4, 3, 1) mesh-topology-cpp 1.33582 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 4, 30, 4, 3, 23) mesh-unitcube-cpp 22.1691 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 4, 30, 4, 4, 4) mesh-iteration-cpp 39.1205 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 4, 30, 4, 4, 4) function-evaluation-cpp 0.0377491 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 4, 30, 4, 6, 4) la-vector-access-cpp 115.655 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 4, 30, 4, 6, 40) la-vector-assignment-cpp 35.9795 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 1, 1, 9, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3916 "BENCH 13.3916"
+(2015, 5, 1, 1, 10, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1031 "Building point search tree to accelerate distance queries."
+(2015, 5, 1, 1, 10, 18) geometry-bounding_box_tree_build-cpp 14.1213 "BENCH 14.1213"
+(2015, 5, 1, 1, 10, 45) common-progress-cpp 27.7879 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 1, 1, 11, 50) common-timing-cpp 64.2198 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 1, 1, 13, 19) fem-convergence-cpp 3.60775 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 1, 4, 8, 18) fem-speedup-cpp 10497.6 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 1, 4, 8, 18) fem-speedup-cpp-assembly 6.75316 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 1, 4, 8, 18) fem-speedup-cpp-solve 0.666971 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 1, 4, 8, 28) mesh-refinement-cpp 9.23515 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 1, 4, 8, 29) mesh-topology-cpp 1.33692 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 1, 4, 8, 52) mesh-unitcube-cpp 22.2531 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 1, 4, 9, 29) mesh-iteration-cpp 35.5034 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 1, 4, 9, 29) function-evaluation-cpp 0.0350571 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 1, 4, 11, 27) la-vector-access-cpp 114.075 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 1, 4, 12, 3) la-vector-assignment-cpp 35.9778 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 2, 1, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3049 "BENCH 13.3049"
+(2015, 5, 2, 1, 9, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9532 "Building point search tree to accelerate distance queries."
+(2015, 5, 2, 1, 10, 10) geometry-bounding_box_tree_build-cpp 14.1583 "BENCH 14.1583"
+(2015, 5, 2, 1, 10, 38) common-progress-cpp 27.7897 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 2, 1, 11, 41) common-timing-cpp 63.6705 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 2, 1, 13, 11) fem-convergence-cpp 3.61901 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 2, 4, 8, 9) fem-speedup-cpp 10497.3 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 2, 4, 8, 9) fem-speedup-cpp-assembly 6.68014 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 2, 4, 8, 9) fem-speedup-cpp-solve 0.705326 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 2, 4, 8, 19) mesh-refinement-cpp 9.19727 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 2, 4, 8, 21) mesh-topology-cpp 1.33485 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 2, 4, 8, 43) mesh-unitcube-cpp 22.1784 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 2, 4, 9, 24) mesh-iteration-cpp 39.1313 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 2, 4, 9, 24) function-evaluation-cpp 0.0362399 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 2, 4, 11, 20) la-vector-access-cpp 111.887 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 2, 4, 11, 56) la-vector-assignment-cpp 35.9775 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 3, 1, 9, 31) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1809 "BENCH 13.1809"
+(2015, 5, 3, 1, 9, 50) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3801 "Building point search tree to accelerate distance queries."
+(2015, 5, 3, 1, 10, 6) geometry-bounding_box_tree_build-cpp 14.2466 "BENCH 14.2466"
+(2015, 5, 3, 1, 10, 34) common-progress-cpp 27.812 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 3, 1, 11, 38) common-timing-cpp 63.3593 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 3, 1, 13, 7) fem-convergence-cpp 3.62116 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 3, 4, 7, 44) fem-speedup-cpp 10475.5 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 3, 4, 7, 44) fem-speedup-cpp-assembly 6.44249 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 3, 4, 7, 44) fem-speedup-cpp-solve 0.638994 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 3, 4, 7, 54) mesh-refinement-cpp 9.18968 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 3, 4, 7, 55) mesh-topology-cpp 1.33324 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 3, 4, 8, 18) mesh-unitcube-cpp 22.145 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 3, 4, 8, 55) mesh-iteration-cpp 35.501 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 3, 4, 8, 55) function-evaluation-cpp 0.031553 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 3, 4, 10, 53) la-vector-access-cpp 113.882 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 3, 4, 11, 29) la-vector-assignment-cpp 35.9921 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 4, 1, 9, 34) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1769 "BENCH 13.1769"
+(2015, 5, 4, 1, 9, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3681 "Building point search tree to accelerate distance queries."
+(2015, 5, 4, 1, 10, 9) geometry-bounding_box_tree_build-cpp 14.1525 "BENCH 14.1525"
+(2015, 5, 4, 1, 10, 37) common-progress-cpp 27.8031 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 4, 1, 11, 41) common-timing-cpp 63.7817 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 4, 1, 13, 10) fem-convergence-cpp 3.61341 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 4, 4, 3, 28) fem-speedup-cpp 10217.1 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 4, 4, 3, 28) fem-speedup-cpp-assembly 6.49471 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 4, 4, 3, 28) fem-speedup-cpp-solve 0.667914 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 4, 4, 3, 38) mesh-refinement-cpp 9.19906 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 4, 4, 3, 40) mesh-topology-cpp 1.32894 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 4, 4, 4, 2) mesh-unitcube-cpp 22.1444 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 4, 4, 4, 40) mesh-iteration-cpp 35.5155 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 4, 4, 4, 40) function-evaluation-cpp 0.0600781 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 4, 4, 6, 39) la-vector-access-cpp 115.701 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 4, 4, 7, 15) la-vector-assignment-cpp 35.9845 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 5, 1, 9, 33) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2422 "BENCH 13.2422"
+(2015, 5, 5, 1, 9, 52) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3069 "Building point search tree to accelerate distance queries."
+(2015, 5, 5, 1, 10, 8) geometry-bounding_box_tree_build-cpp 14.218 "BENCH 14.218"
+(2015, 5, 5, 1, 10, 36) common-progress-cpp 27.8013 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 5, 1, 11, 39) common-timing-cpp 63.501 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 5, 1, 13, 9) fem-convergence-cpp 3.60328 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 5, 4, 11, 29) fem-speedup-cpp 10699.2 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 5, 4, 11, 29) fem-speedup-cpp-assembly 6.72412 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 5, 4, 11, 29) fem-speedup-cpp-solve 0.595569 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 5, 4, 11, 39) mesh-refinement-cpp 9.21576 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 5, 4, 11, 40) mesh-topology-cpp 1.33347 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 5, 4, 12, 3) mesh-unitcube-cpp 22.1891 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 5, 4, 12, 40) mesh-iteration-cpp 35.5179 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 5, 4, 12, 40) function-evaluation-cpp 0.026839 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 5, 4, 14, 40) la-vector-access-cpp 115.823 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 5, 4, 15, 16) la-vector-assignment-cpp 35.9849 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 6, 1, 9, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1269 "BENCH 13.1269"
+(2015, 5, 6, 1, 9, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1539 "Building point search tree to accelerate distance queries."
+(2015, 5, 6, 1, 10, 13) geometry-bounding_box_tree_build-cpp 14.1364 "BENCH 14.1364"
+(2015, 5, 6, 1, 10, 41) common-progress-cpp 27.7964 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 6, 1, 11, 46) common-timing-cpp 64.7608 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 6, 1, 13, 15) fem-convergence-cpp 3.6169 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 6, 4, 1, 22) fem-speedup-cpp 10086.1 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 6, 4, 1, 22) fem-speedup-cpp-assembly 6.7631 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 6, 4, 1, 22) fem-speedup-cpp-solve 0.651919 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 6, 4, 1, 33) mesh-refinement-cpp 9.19839 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 6, 4, 1, 34) mesh-topology-cpp 1.32919 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 6, 4, 1, 56) mesh-unitcube-cpp 22.1314 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 6, 4, 2, 38) mesh-iteration-cpp 39.1986 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 6, 4, 2, 38) function-evaluation-cpp 0.031312 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 6, 4, 4, 37) la-vector-access-cpp 115.724 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 6, 4, 5, 13) la-vector-assignment-cpp 35.978 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 7, 1, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.286 "BENCH 13.286"
+(2015, 5, 7, 1, 9, 55) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0032 "Building point search tree to accelerate distance queries."
+(2015, 5, 7, 1, 10, 12) geometry-bounding_box_tree_build-cpp 14.1178 "BENCH 14.1178"
+(2015, 5, 7, 1, 10, 39) common-progress-cpp 27.822 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 7, 1, 11, 44) common-timing-cpp 64.5017 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 7, 1, 13, 14) fem-convergence-cpp 3.62513 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 7, 4, 2, 53) fem-speedup-cpp 10178 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 7, 4, 2, 53) fem-speedup-cpp-assembly 6.3487 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 7, 4, 2, 53) fem-speedup-cpp-solve 0.640873 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 7, 4, 3, 3) mesh-refinement-cpp 9.19681 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 7, 4, 3, 4) mesh-topology-cpp 1.33526 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 7, 4, 3, 27) mesh-unitcube-cpp 22.2315 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 7, 4, 4, 5) mesh-iteration-cpp 35.4977 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 7, 4, 4, 5) function-evaluation-cpp 0.0313361 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 7, 4, 6, 4) la-vector-access-cpp 115.598 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 7, 4, 6, 40) la-vector-assignment-cpp 35.9767 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 8, 1, 9, 34) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.333 "BENCH 13.333"
+(2015, 5, 8, 1, 9, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9318 "Building point search tree to accelerate distance queries."
+(2015, 5, 8, 1, 10, 9) geometry-bounding_box_tree_build-cpp 14.1801 "BENCH 14.1801"
+(2015, 5, 8, 1, 10, 37) common-progress-cpp 27.7838 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 8, 1, 11, 41) common-timing-cpp 64.1077 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 8, 1, 13, 11) fem-convergence-cpp 3.61972 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 8, 4, 28, 53) fem-speedup-cpp 11740.7 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 8, 4, 28, 53) fem-speedup-cpp-assembly 6.38319 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 8, 4, 28, 53) fem-speedup-cpp-solve 0.643348 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 8, 4, 29, 3) mesh-refinement-cpp 9.44242 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 8, 4, 29, 5) mesh-topology-cpp 1.36346 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 8, 4, 29, 27) mesh-unitcube-cpp 22.5659 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 8, 4, 30, 7) mesh-iteration-cpp 37.1618 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 8, 4, 30, 7) function-evaluation-cpp 0.0418441 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 8, 4, 32, 9) la-vector-access-cpp 118.361 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 8, 4, 32, 45) la-vector-assignment-cpp 35.9868 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 9, 1, 9, 31) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.105 "BENCH 13.105"
+(2015, 5, 9, 1, 9, 50) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9785 "Building point search tree to accelerate distance queries."
+(2015, 5, 9, 1, 10, 6) geometry-bounding_box_tree_build-cpp 14.0586 "BENCH 14.0586"
+(2015, 5, 9, 1, 10, 34) common-progress-cpp 27.7846 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 9, 1, 11, 41) common-timing-cpp 66.9516 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 9, 1, 13, 10) fem-convergence-cpp 3.59804 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 9, 4, 26, 47) fem-speedup-cpp 11616 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 9, 4, 26, 47) fem-speedup-cpp-assembly 6.35108 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 9, 4, 26, 47) fem-speedup-cpp-solve 0.65702 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 9, 4, 26, 57) mesh-refinement-cpp 9.24196 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 9, 4, 26, 58) mesh-topology-cpp 1.33529 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 9, 4, 27, 21) mesh-unitcube-cpp 22.2079 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 9, 4, 27, 59) mesh-iteration-cpp 35.7816 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 9, 4, 27, 59) function-evaluation-cpp 0.0350521 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 9, 4, 30, 0) la-vector-access-cpp 117.742 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 9, 4, 30, 40) la-vector-assignment-cpp 39.4738 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 10, 1, 9, 31) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0942 "BENCH 13.0942"
+(2015, 5, 10, 1, 9, 49) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2329 "Building point search tree to accelerate distance queries."
+(2015, 5, 10, 1, 10, 6) geometry-bounding_box_tree_build-cpp 14.1026 "BENCH 14.1026"
+(2015, 5, 10, 1, 10, 34) common-progress-cpp 27.7957 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 10, 1, 11, 39) common-timing-cpp 65.1618 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 10, 1, 13, 8) fem-convergence-cpp 3.60671 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 10, 4, 22, 17) fem-speedup-cpp 11348.2 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 10, 4, 22, 17) fem-speedup-cpp-assembly 6.35993 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 10, 4, 22, 17) fem-speedup-cpp-solve 0.569338 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 10, 4, 22, 27) mesh-refinement-cpp 9.22262 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 10, 4, 22, 29) mesh-topology-cpp 1.34306 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 10, 4, 22, 51) mesh-unitcube-cpp 22.2386 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 10, 4, 23, 29) mesh-iteration-cpp 35.5047 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 10, 4, 23, 29) function-evaluation-cpp 0.0395811 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 10, 4, 25, 27) la-vector-access-cpp 114.359 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 10, 4, 26, 3) la-vector-assignment-cpp 35.9801 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 11, 1, 9, 31) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2812 "BENCH 13.2812"
+(2015, 5, 11, 1, 9, 50) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8705 "Building point search tree to accelerate distance queries."
+(2015, 5, 11, 1, 10, 6) geometry-bounding_box_tree_build-cpp 14.1654 "BENCH 14.1654"
+(2015, 5, 11, 1, 10, 34) common-progress-cpp 27.804 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 11, 1, 11, 37) common-timing-cpp 63.5965 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 11, 1, 13, 7) fem-convergence-cpp 3.60635 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 11, 3, 58, 6) fem-speedup-cpp 9897.63 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 11, 3, 58, 6) fem-speedup-cpp-assembly 6.65418 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 11, 3, 58, 6) fem-speedup-cpp-solve 0.658484 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 11, 3, 58, 16) mesh-refinement-cpp 9.25455 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 11, 3, 58, 17) mesh-topology-cpp 1.33601 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 11, 3, 58, 39) mesh-unitcube-cpp 22.1975 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 11, 3, 59, 17) mesh-iteration-cpp 35.5126 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 11, 3, 59, 17) function-evaluation-cpp 0.035089 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 11, 4, 1, 16) la-vector-access-cpp 115.574 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 11, 4, 1, 56) la-vector-assignment-cpp 39.4618 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 12, 1, 9, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1916 "BENCH 13.1916"
+(2015, 5, 12, 1, 9, 54) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1956 "Building point search tree to accelerate distance queries."
+(2015, 5, 12, 1, 10, 11) geometry-bounding_box_tree_build-cpp 14.1227 "BENCH 14.1227"
+(2015, 5, 12, 1, 10, 39) common-progress-cpp 27.7881 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 12, 1, 11, 42) common-timing-cpp 63.7534 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 12, 1, 13, 12) fem-convergence-cpp 3.62458 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 12, 3, 59, 17) fem-speedup-cpp 9964.21 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 12, 3, 59, 17) fem-speedup-cpp-assembly 6.47625 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 12, 3, 59, 17) fem-speedup-cpp-solve 0.674075 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 12, 3, 59, 27) mesh-refinement-cpp 9.19405 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 12, 3, 59, 29) mesh-topology-cpp 1.33516 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 12, 3, 59, 51) mesh-unitcube-cpp 22.3238 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 12, 4, 0, 29) mesh-iteration-cpp 35.4929 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 12, 4, 0, 29) function-evaluation-cpp 0.027689 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 12, 4, 2, 24) la-vector-access-cpp 111.853 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 12, 4, 3, 0) la-vector-assignment-cpp 35.9819 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 13, 1, 9, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.02 "BENCH 13.02"
+(2015, 5, 13, 1, 10, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8263 "Building point search tree to accelerate distance queries."
+(2015, 5, 13, 1, 10, 17) geometry-bounding_box_tree_build-cpp 14.1537 "BENCH 14.1537"
+(2015, 5, 13, 1, 10, 45) common-progress-cpp 27.8072 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 13, 1, 11, 49) common-timing-cpp 63.9778 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 13, 1, 13, 18) fem-convergence-cpp 3.60392 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 13, 3, 59, 56) fem-speedup-cpp 9996.21 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 13, 3, 59, 56) fem-speedup-cpp-assembly 6.56391 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 13, 3, 59, 56) fem-speedup-cpp-solve 0.656601 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 13, 4, 0, 5) mesh-refinement-cpp 9.10503 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 13, 4, 0, 7) mesh-topology-cpp 1.32504 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 13, 4, 0, 29) mesh-unitcube-cpp 21.6359 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 13, 4, 1, 6) mesh-iteration-cpp 35.4939 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 13, 4, 1, 6) function-evaluation-cpp 0.0445838 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 13, 4, 3, 6) la-vector-access-cpp 115.737 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 13, 4, 3, 42) la-vector-assignment-cpp 36.4723 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 14, 1, 9, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0821 "BENCH 13.0821"
+(2015, 5, 14, 1, 9, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2316 "Building point search tree to accelerate distance queries."
+(2015, 5, 14, 1, 10, 13) geometry-bounding_box_tree_build-cpp 14.1653 "BENCH 14.1653"
+(2015, 5, 14, 1, 10, 41) common-progress-cpp 27.7959 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 14, 1, 11, 45) common-timing-cpp 63.74 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 14, 1, 13, 15) fem-convergence-cpp 3.62163 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 14, 4, 1, 19) fem-speedup-cpp 10082.7 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 14, 4, 1, 19) fem-speedup-cpp-assembly 6.46595 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 14, 4, 1, 19) fem-speedup-cpp-solve 0.68896 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 14, 4, 1, 29) mesh-refinement-cpp 9.19429 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 14, 4, 1, 30) mesh-topology-cpp 1.3294 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 14, 4, 1, 53) mesh-unitcube-cpp 22.502 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 14, 4, 2, 39) mesh-iteration-cpp 44.1367 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 14, 4, 2, 39) function-evaluation-cpp 0.0368998 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 14, 4, 4, 39) la-vector-access-cpp 116.073 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 14, 4, 5, 15) la-vector-assignment-cpp 35.4609 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 15, 1, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0923 "BENCH 13.0923"
+(2015, 5, 15, 1, 9, 54) geometry-bounding_box_tree_compute_closest_entity-cpp 15.492 "Building point search tree to accelerate distance queries."
+(2015, 5, 15, 1, 10, 10) geometry-bounding_box_tree_build-cpp 14.1569 "BENCH 14.1569"
+(2015, 5, 15, 1, 10, 38) common-progress-cpp 27.8163 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 15, 1, 11, 41) common-timing-cpp 62.9399 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 15, 1, 13, 11) fem-convergence-cpp 3.61412 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 15, 4, 6, 19) fem-speedup-cpp 10387.3 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 15, 4, 6, 19) fem-speedup-cpp-assembly 6.58943 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 15, 4, 6, 19) fem-speedup-cpp-solve 0.649473 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 15, 4, 6, 29) mesh-refinement-cpp 9.21166 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 15, 4, 6, 31) mesh-topology-cpp 1.33391 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 15, 4, 6, 53) mesh-unitcube-cpp 22.2499 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 15, 4, 7, 31) mesh-iteration-cpp 35.5015 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 15, 4, 7, 31) function-evaluation-cpp 0.0313599 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 15, 4, 9, 33) la-vector-access-cpp 118.372 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 15, 4, 10, 8) la-vector-assignment-cpp 35.48 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 16, 1, 9, 30) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1017 "BENCH 13.1017"
+(2015, 5, 16, 1, 9, 49) geometry-bounding_box_tree_compute_closest_entity-cpp 15.422 "Building point search tree to accelerate distance queries."
+(2015, 5, 16, 1, 10, 6) geometry-bounding_box_tree_build-cpp 14.2061 "BENCH 14.2061"
+(2015, 5, 16, 1, 10, 33) common-progress-cpp 27.7992 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 16, 1, 11, 37) common-timing-cpp 63.5072 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 16, 1, 13, 6) fem-convergence-cpp 3.62827 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 16, 4, 2, 32) fem-speedup-cpp 10164.6 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 16, 4, 2, 32) fem-speedup-cpp-assembly 6.68347 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 16, 4, 2, 32) fem-speedup-cpp-solve 0.644706 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 16, 4, 2, 42) mesh-refinement-cpp 9.18675 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 16, 4, 2, 43) mesh-topology-cpp 1.33247 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 16, 4, 3, 6) mesh-unitcube-cpp 22.2515 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 16, 4, 3, 43) mesh-iteration-cpp 35.4869 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 16, 4, 3, 43) function-evaluation-cpp 0.0528982 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 16, 4, 5, 43) la-vector-access-cpp 116.065 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 16, 4, 6, 17) la-vector-assignment-cpp 33.4704 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 17, 1, 9, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0692 "BENCH 13.0692"
+(2015, 5, 17, 1, 9, 55) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2863 "Building point search tree to accelerate distance queries."
+(2015, 5, 17, 1, 10, 12) geometry-bounding_box_tree_build-cpp 14.1382 "BENCH 14.1382"
+(2015, 5, 17, 1, 10, 39) common-progress-cpp 27.792 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 17, 1, 11, 43) common-timing-cpp 63.3082 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 17, 1, 13, 12) fem-convergence-cpp 3.63546 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 17, 4, 7, 57) fem-speedup-cpp 10484.1 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 17, 4, 7, 57) fem-speedup-cpp-assembly 6.72715 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 17, 4, 7, 57) fem-speedup-cpp-solve 0.604418 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 17, 4, 8, 7) mesh-refinement-cpp 9.19743 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 17, 4, 8, 9) mesh-topology-cpp 1.33812 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 17, 4, 8, 31) mesh-unitcube-cpp 22.3097 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 17, 4, 9, 9) mesh-iteration-cpp 35.5041 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 17, 4, 9, 9) function-evaluation-cpp 0.031534 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 17, 4, 11, 9) la-vector-access-cpp 116.337 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 17, 4, 11, 42) la-vector-assignment-cpp 33.471 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 18, 1, 9, 37) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2006 "BENCH 13.2006"
+(2015, 5, 18, 1, 9, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3881 "Building point search tree to accelerate distance queries."
+(2015, 5, 18, 1, 10, 12) geometry-bounding_box_tree_build-cpp 14.1302 "BENCH 14.1302"
+(2015, 5, 18, 1, 10, 40) common-progress-cpp 27.788 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 18, 1, 11, 43) common-timing-cpp 63.1407 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 18, 1, 13, 13) fem-convergence-cpp 3.62292 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 18, 3, 52, 56) fem-speedup-cpp 9581.63 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 18, 3, 52, 56) fem-speedup-cpp-assembly 6.64952 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 18, 3, 52, 56) fem-speedup-cpp-solve 0.712101 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 18, 3, 53, 6) mesh-refinement-cpp 9.18237 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 18, 3, 53, 7) mesh-topology-cpp 1.33161 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 18, 3, 53, 29) mesh-unitcube-cpp 22.2909 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 18, 3, 54, 7) mesh-iteration-cpp 35.4651 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 18, 3, 54, 7) function-evaluation-cpp 0.044569 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 18, 3, 56, 11) la-vector-access-cpp 119.75 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 18, 3, 56, 46) la-vector-assignment-cpp 34.9184 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 19, 1, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1062 "BENCH 13.1062"
+(2015, 5, 19, 1, 9, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2652 "Building point search tree to accelerate distance queries."
+(2015, 5, 19, 1, 10, 10) geometry-bounding_box_tree_build-cpp 14.0972 "BENCH 14.0972"
+(2015, 5, 19, 1, 10, 38) common-progress-cpp 27.7832 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 19, 1, 11, 41) common-timing-cpp 63.0396 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 19, 1, 13, 10) fem-convergence-cpp 3.62534 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 19, 4, 2, 54) fem-speedup-cpp 10182.9 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 19, 4, 2, 54) fem-speedup-cpp-assembly 6.47302 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 19, 4, 2, 54) fem-speedup-cpp-solve 0.648827 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 19, 4, 3, 4) mesh-refinement-cpp 9.17086 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 19, 4, 3, 5) mesh-topology-cpp 1.33115 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 19, 4, 3, 28) mesh-unitcube-cpp 22.2405 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 19, 4, 4, 5) mesh-iteration-cpp 35.4968 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 19, 4, 4, 5) function-evaluation-cpp 0.031419 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 19, 4, 6, 7) la-vector-access-cpp 118.27 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 19, 4, 6, 41) la-vector-assignment-cpp 33.4779 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 20, 1, 9, 41) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2799 "BENCH 13.2799"
+(2015, 5, 20, 1, 10, 0) geometry-bounding_box_tree_compute_closest_entity-cpp 15.4288 "Building point search tree to accelerate distance queries."
+(2015, 5, 20, 1, 10, 16) geometry-bounding_box_tree_build-cpp 14.0988 "BENCH 14.0988"
+(2015, 5, 20, 1, 10, 44) common-progress-cpp 27.7831 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 20, 1, 11, 47) common-timing-cpp 63.5677 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 20, 1, 13, 17) fem-convergence-cpp 3.63273 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 20, 4, 16, 38) fem-speedup-cpp 10999.7 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 20, 4, 16, 38) fem-speedup-cpp-assembly 6.71979 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 20, 4, 16, 38) fem-speedup-cpp-solve 0.564518 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 20, 4, 16, 48) mesh-refinement-cpp 9.19663 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 20, 4, 16, 49) mesh-topology-cpp 1.33903 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 20, 4, 17, 11) mesh-unitcube-cpp 22.3058 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 20, 4, 17, 49) mesh-iteration-cpp 35.4981 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 20, 4, 17, 49) function-evaluation-cpp 0.0400188 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 20, 4, 19, 53) la-vector-access-cpp 119.831 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 20, 4, 20, 26) la-vector-assignment-cpp 33.4705 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 21, 1, 9, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0793 "BENCH 13.0793"
+(2015, 5, 21, 1, 9, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3295 "Building point search tree to accelerate distance queries."
+(2015, 5, 21, 1, 10, 14) geometry-bounding_box_tree_build-cpp 14.0527 "BENCH 14.0527"
+(2015, 5, 21, 1, 10, 42) common-progress-cpp 27.8197 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 21, 1, 11, 46) common-timing-cpp 63.7731 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 21, 1, 13, 15) fem-convergence-cpp 3.6158 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 21, 3, 59, 44) fem-speedup-cpp 9987.67 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 21, 3, 59, 44) fem-speedup-cpp-assembly 6.64901 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 21, 3, 59, 44) fem-speedup-cpp-solve 0.65516 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 21, 3, 59, 54) mesh-refinement-cpp 9.2202 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 21, 3, 59, 56) mesh-topology-cpp 1.33504 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 21, 4, 0, 18) mesh-unitcube-cpp 22.2203 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 21, 4, 0, 56) mesh-iteration-cpp 35.4997 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 21, 4, 0, 56) function-evaluation-cpp 0.0396161 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 21, 4, 2, 59) la-vector-access-cpp 119.638 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 21, 4, 3, 35) la-vector-assignment-cpp 35.4622 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 22, 1, 9, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.073 "BENCH 13.073"
+(2015, 5, 22, 1, 9, 58) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2407 "Building point search tree to accelerate distance queries."
+(2015, 5, 22, 1, 10, 15) geometry-bounding_box_tree_build-cpp 14.1881 "BENCH 14.1881"
+(2015, 5, 22, 1, 10, 46) common-progress-cpp 31.5631 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 22, 1, 11, 50) common-timing-cpp 63.6722 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 22, 1, 13, 19) fem-convergence-cpp 3.61861 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 22, 4, 6, 22) fem-speedup-cpp 10381.3 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 22, 4, 6, 22) fem-speedup-cpp-assembly 6.23963 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 22, 4, 6, 22) fem-speedup-cpp-solve 0.719185 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 22, 4, 6, 32) mesh-refinement-cpp 9.18518 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 22, 4, 6, 33) mesh-topology-cpp 1.32972 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 22, 4, 6, 55) mesh-unitcube-cpp 22.2147 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 22, 4, 7, 33) mesh-iteration-cpp 35.4962 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 22, 4, 7, 33) function-evaluation-cpp 0.039968 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 22, 4, 9, 33) la-vector-access-cpp 116.303 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 22, 4, 10, 7) la-vector-assignment-cpp 33.4661 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 23, 1, 9, 38) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.054 "BENCH 13.054"
+(2015, 5, 23, 1, 9, 56) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0558 "Building point search tree to accelerate distance queries."
+(2015, 5, 23, 1, 10, 13) geometry-bounding_box_tree_build-cpp 14.1691 "BENCH 14.1691"
+(2015, 5, 23, 1, 10, 41) common-progress-cpp 27.813 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 23, 1, 11, 44) common-timing-cpp 63.3912 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 23, 1, 13, 15) fem-convergence-cpp 3.63453 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 23, 4, 13, 47) fem-speedup-cpp 10830.8 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 23, 4, 13, 47) fem-speedup-cpp-assembly 6.77954 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 23, 4, 13, 47) fem-speedup-cpp-solve 0.571426 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 23, 4, 13, 57) mesh-refinement-cpp 9.18243 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 23, 4, 13, 58) mesh-topology-cpp 1.33325 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 23, 4, 14, 20) mesh-unitcube-cpp 22.1584 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 23, 4, 15, 2) mesh-iteration-cpp 39.1656 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 23, 4, 15, 2) function-evaluation-cpp 0.0401371 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 23, 4, 17, 1) la-vector-access-cpp 115.794 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 23, 4, 17, 35) la-vector-assignment-cpp 33.6034 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 24, 1, 9, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2301 "BENCH 13.2301"
+(2015, 5, 24, 1, 9, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.13 "Building point search tree to accelerate distance queries."
+(2015, 5, 24, 1, 10, 14) geometry-bounding_box_tree_build-cpp 14.115 "BENCH 14.115"
+(2015, 5, 24, 1, 10, 42) common-progress-cpp 27.79 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 24, 1, 11, 46) common-timing-cpp 64.323 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 24, 1, 13, 16) fem-convergence-cpp 3.63862 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 24, 4, 2, 25) fem-speedup-cpp 10148 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 24, 4, 2, 25) fem-speedup-cpp-assembly 6.47607 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 24, 4, 2, 25) fem-speedup-cpp-solve 0.65411 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 24, 4, 2, 35) mesh-refinement-cpp 9.1844 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 24, 4, 2, 36) mesh-topology-cpp 1.33284 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 24, 4, 2, 59) mesh-unitcube-cpp 22.1717 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 24, 4, 3, 36) mesh-iteration-cpp 35.5782 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 24, 4, 3, 37) function-evaluation-cpp 0.039763 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 24, 4, 5, 31) la-vector-access-cpp 110.339 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 24, 4, 6, 4) la-vector-assignment-cpp 33.6123 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 25, 1, 9, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1317 "BENCH 13.1317"
+(2015, 5, 25, 1, 9, 55) geometry-bounding_box_tree_compute_closest_entity-cpp 15.062 "Building point search tree to accelerate distance queries."
+(2015, 5, 25, 1, 10, 11) geometry-bounding_box_tree_build-cpp 14.131 "BENCH 14.131"
+(2015, 5, 25, 1, 10, 39) common-progress-cpp 27.7945 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 25, 1, 11, 43) common-timing-cpp 64.102 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 25, 1, 13, 13) fem-convergence-cpp 3.64034 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 25, 3, 56, 42) fem-speedup-cpp 9808.74 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 25, 3, 56, 42) fem-speedup-cpp-assembly 6.46907 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 25, 3, 56, 42) fem-speedup-cpp-solve 0.692098 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 25, 3, 56, 52) mesh-refinement-cpp 9.18119 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 25, 3, 56, 54) mesh-topology-cpp 1.33201 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 25, 3, 57, 16) mesh-unitcube-cpp 22.1656 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 25, 3, 57, 54) mesh-iteration-cpp 35.4964 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 25, 3, 57, 54) function-evaluation-cpp 0.0395319 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 25, 3, 59, 53) la-vector-access-cpp 115.678 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 25, 4, 0, 27) la-vector-assignment-cpp 33.5344 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 26, 1, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1692 "BENCH 13.1692"
+(2015, 5, 26, 1, 9, 54) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1991 "Building point search tree to accelerate distance queries."
+(2015, 5, 26, 1, 10, 10) geometry-bounding_box_tree_build-cpp 14.1592 "BENCH 14.1592"
+(2015, 5, 26, 1, 10, 38) common-progress-cpp 27.7909 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 26, 1, 11, 43) common-timing-cpp 64.5831 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 26, 1, 13, 12) fem-convergence-cpp 3.63471 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 26, 4, 5, 44) fem-speedup-cpp 10351 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 26, 4, 5, 44) fem-speedup-cpp-assembly 6.65164 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 26, 4, 5, 44) fem-speedup-cpp-solve 0.626458 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 26, 4, 5, 54) mesh-refinement-cpp 9.17867 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 26, 4, 5, 56) mesh-topology-cpp 1.33212 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 26, 4, 6, 18) mesh-unitcube-cpp 22.1565 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 26, 4, 6, 56) mesh-iteration-cpp 35.4959 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 26, 4, 6, 56) function-evaluation-cpp 0.0400879 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 26, 4, 8, 53) la-vector-access-cpp 113.925 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 26, 4, 9, 29) la-vector-assignment-cpp 35.4713 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 27, 1, 9, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1039 "BENCH 13.1039"
+(2015, 5, 27, 1, 9, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9967 "Building point search tree to accelerate distance queries."
+(2015, 5, 27, 1, 10, 14) geometry-bounding_box_tree_build-cpp 14.1639 "BENCH 14.1639"
+(2015, 5, 27, 1, 10, 41) common-progress-cpp 27.8088 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 27, 1, 11, 45) common-timing-cpp 63.7079 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 27, 1, 13, 15) fem-convergence-cpp 3.64222 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 27, 4, 11, 44) fem-speedup-cpp 10708.3 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 27, 4, 11, 44) fem-speedup-cpp-assembly 6.75209 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 27, 4, 11, 44) fem-speedup-cpp-solve 0.59584 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 27, 4, 11, 54) mesh-refinement-cpp 9.18061 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 27, 4, 11, 56) mesh-topology-cpp 1.33289 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 27, 4, 12, 18) mesh-unitcube-cpp 22.1645 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 27, 4, 12, 56) mesh-iteration-cpp 36.0776 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 27, 4, 12, 56) function-evaluation-cpp 0.034977 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 27, 4, 14, 50) la-vector-access-cpp 110.33 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 27, 4, 15, 24) la-vector-assignment-cpp 33.4631 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 28, 1, 9, 34) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1549 "BENCH 13.1549"
+(2015, 5, 28, 1, 9, 52) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2985 "Building point search tree to accelerate distance queries."
+(2015, 5, 28, 1, 10, 9) geometry-bounding_box_tree_build-cpp 14.0955 "BENCH 14.0955"
+(2015, 5, 28, 1, 10, 37) common-progress-cpp 27.7823 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 28, 1, 11, 40) common-timing-cpp 63.1981 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 28, 1, 13, 9) fem-convergence-cpp 3.62635 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 28, 4, 6, 53) fem-speedup-cpp 10422.7 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 28, 4, 6, 53) fem-speedup-cpp-assembly 6.37557 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 28, 4, 6, 53) fem-speedup-cpp-solve 0.61855 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 28, 4, 7, 3) mesh-refinement-cpp 9.17186 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 28, 4, 7, 4) mesh-topology-cpp 1.33146 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 28, 4, 7, 26) mesh-unitcube-cpp 22.1993 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 28, 4, 8, 6) mesh-iteration-cpp 37.6185 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 28, 4, 8, 6) function-evaluation-cpp 0.059747 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 28, 4, 10, 2) la-vector-access-cpp 111.832 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 28, 4, 10, 38) la-vector-assignment-cpp 35.5461 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 29, 1, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1965 "BENCH 13.1965"
+(2015, 5, 29, 1, 9, 53) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0843 "Building point search tree to accelerate distance queries."
+(2015, 5, 29, 1, 10, 10) geometry-bounding_box_tree_build-cpp 14.1967 "BENCH 14.1967"
+(2015, 5, 29, 1, 10, 38) common-progress-cpp 27.791 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 29, 1, 11, 42) common-timing-cpp 63.8591 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 29, 1, 13, 12) fem-convergence-cpp 3.62871 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 29, 4, 2, 30) fem-speedup-cpp 10157 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 29, 4, 2, 30) fem-speedup-cpp-assembly 6.54513 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 29, 4, 2, 30) fem-speedup-cpp-solve 0.644168 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 29, 4, 2, 40) mesh-refinement-cpp 9.20834 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 29, 4, 2, 41) mesh-topology-cpp 1.33024 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 29, 4, 3, 3) mesh-unitcube-cpp 22.2337 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 29, 4, 3, 41) mesh-iteration-cpp 35.4975 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 29, 4, 3, 41) function-evaluation-cpp 0.035125 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 29, 4, 5, 37) la-vector-access-cpp 111.849 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 29, 4, 6, 9) la-vector-assignment-cpp 32.4764 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 30, 1, 9, 40) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0537 "BENCH 13.0537"
+(2015, 5, 30, 1, 9, 59) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1262 "Building point search tree to accelerate distance queries."
+(2015, 5, 30, 1, 10, 15) geometry-bounding_box_tree_build-cpp 14.0357 "BENCH 14.0357"
+(2015, 5, 30, 1, 10, 43) common-progress-cpp 27.7927 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 30, 1, 11, 47) common-timing-cpp 63.96 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 30, 1, 13, 16) fem-convergence-cpp 3.62078 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 30, 4, 12, 55) fem-speedup-cpp 10777.1 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 30, 4, 12, 55) fem-speedup-cpp-assembly 6.46509 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 30, 4, 12, 55) fem-speedup-cpp-solve 0.601104 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 30, 4, 13, 52) mesh-refinement-cpp 56.5105 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 30, 4, 13, 53) mesh-topology-cpp 1.33562 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 30, 4, 14, 16) mesh-unitcube-cpp 22.2629 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 30, 4, 14, 53) mesh-iteration-cpp 35.4927 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 30, 4, 14, 53) function-evaluation-cpp 0.0350139 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 30, 4, 16, 51) la-vector-access-cpp 114.147 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 30, 4, 17, 24) la-vector-assignment-cpp 32.5975 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 5, 31, 1, 9, 35) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9543 "BENCH 12.9543"
+(2015, 5, 31, 1, 9, 54) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3911 "Building point search tree to accelerate distance queries."
+(2015, 5, 31, 1, 10, 11) geometry-bounding_box_tree_build-cpp 14.2107 "BENCH 14.2107"
+(2015, 5, 31, 1, 10, 38) common-progress-cpp 27.7872 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 5, 31, 1, 11, 42) common-timing-cpp 63.805 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 5, 31, 1, 13, 11) fem-convergence-cpp 3.63784 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 5, 31, 3, 59, 30) fem-speedup-cpp 9977.87 "Assembly/solve speedup running on 4 processors"
+(2015, 5, 31, 3, 59, 30) fem-speedup-cpp-assembly 6.60786 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 5, 31, 3, 59, 30) fem-speedup-cpp-solve 0.633574 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 5, 31, 4, 0, 28) mesh-refinement-cpp 56.5378 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 5, 31, 4, 0, 29) mesh-topology-cpp 1.33151 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 5, 31, 4, 0, 52) mesh-unitcube-cpp 22.2179 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 5, 31, 4, 1, 29) mesh-iteration-cpp 35.5112 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 5, 31, 4, 1, 29) function-evaluation-cpp 0.034982 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 5, 31, 4, 3, 29) la-vector-access-cpp 115.709 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 5, 31, 4, 4, 4) la-vector-assignment-cpp 35.4738 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 6, 1, 1, 9, 36) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9724 "BENCH 12.9724"
+(2015, 6, 1, 1, 9, 54) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0399 "Building point search tree to accelerate distance queries."
+(2015, 6, 1, 1, 10, 11) geometry-bounding_box_tree_build-cpp 14.1122 "BENCH 14.1122"
+(2015, 6, 1, 1, 10, 39) common-progress-cpp 27.7921 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 6, 1, 1, 11, 43) common-timing-cpp 64.17 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 6, 1, 1, 13, 13) fem-convergence-cpp 3.62823 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 6, 1, 4, 18, 25) fem-speedup-cpp 11110.8 "Assembly/solve speedup running on 4 processors"
+(2015, 6, 1, 4, 18, 25) fem-speedup-cpp-assembly 6.45291 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 6, 1, 4, 18, 25) fem-speedup-cpp-solve 0.653592 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 6, 1, 4, 19, 22) mesh-refinement-cpp 56.6729 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 6, 1, 4, 19, 23) mesh-topology-cpp 1.33115 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 6, 1, 4, 19, 46) mesh-unitcube-cpp 22.1575 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 6, 1, 4, 20, 23) mesh-iteration-cpp 35.5269 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 6, 1, 4, 20, 23) function-evaluation-cpp 0.0316911 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 6, 1, 4, 22, 23) la-vector-access-cpp 115.753 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 6, 1, 4, 22, 56) la-vector-assignment-cpp 32.4727 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 6, 2, 1, 9, 58) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1557 "BENCH 13.1557"
+(2015, 6, 2, 1, 10, 18) geometry-bounding_box_tree_compute_closest_entity-cpp 16.1171 "Building point search tree to accelerate distance queries."
+(2015, 6, 2, 1, 10, 34) geometry-bounding_box_tree_build-cpp 14.2383 "BENCH 14.2383"
+(2015, 6, 2, 1, 11, 2) common-progress-cpp 27.7828 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 6, 2, 1, 12, 6) common-timing-cpp 63.9632 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 6, 2, 1, 13, 36) fem-convergence-cpp 3.62058 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 6, 2, 4, 13, 18) fem-speedup-cpp 10781.5 "Assembly/solve speedup running on 4 processors"
+(2015, 6, 2, 4, 13, 18) fem-speedup-cpp-assembly 6.43249 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 6, 2, 4, 13, 18) fem-speedup-cpp-solve 0.636069 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 6, 2, 4, 14, 16) mesh-refinement-cpp 56.3707 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 6, 2, 4, 14, 17) mesh-topology-cpp 1.33689 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 6, 2, 4, 14, 39) mesh-unitcube-cpp 22.1904 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 6, 2, 4, 15, 17) mesh-iteration-cpp 35.5202 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 6, 2, 4, 15, 17) function-evaluation-cpp 0.0351071 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 6, 2, 4, 17, 15) la-vector-access-cpp 114.035 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 6, 2, 4, 17, 51) la-vector-assignment-cpp 35.9738 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 1, 8, 23, 11) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.868 "BENCH 13.868"
+(2015, 10, 1, 8, 23, 29) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8265 "Building point search tree to accelerate distance queries."
+(2015, 10, 1, 8, 23, 46) geometry-bounding_box_tree_build-cpp 14.1841 "BENCH 14.1841"
+(2015, 10, 1, 8, 24, 13) common-progress-cpp 27.6473 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 1, 8, 25, 21) common-timing-cpp 67.3676 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 1, 10, 37, 29) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8858 "BENCH 12.8858"
+(2015, 10, 1, 10, 37, 48) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9127 "Building point search tree to accelerate distance queries."
+(2015, 10, 1, 10, 38, 4) geometry-bounding_box_tree_build-cpp 14.1632 "BENCH 14.1632"
+(2015, 10, 1, 10, 38, 32) common-progress-cpp 27.8573 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 1, 10, 39, 38) common-timing-cpp 66.1329 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 1, 10, 41, 10) fem-convergence-cpp 3.65488 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 1, 14, 31, 51) fem-speedup-cpp 13838.4 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 1, 14, 31, 51) fem-speedup-cpp-assembly 6.47118 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 1, 14, 31, 51) fem-speedup-cpp-solve 1.32891 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 1, 14, 32, 43) mesh-refinement-cpp 51.0654 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 1, 14, 32, 45) mesh-topology-cpp 1.36636 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 1, 14, 33, 6) mesh-unitcube-cpp 21.6493 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 1, 14, 33, 52) mesh-iteration-cpp 43.5068 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 1, 14, 33, 52) function-evaluation-cpp 0.083353 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 1, 14, 36, 9) la-vector-access-cpp 132.079 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 1, 14, 36, 45) la-vector-assignment-cpp 35.959 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 2, 1, 10, 48) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9539 "BENCH 12.9539"
+(2015, 10, 2, 1, 11, 7) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1559 "Building point search tree to accelerate distance queries."
+(2015, 10, 2, 1, 11, 23) geometry-bounding_box_tree_build-cpp 13.9152 "BENCH 13.9152"
+(2015, 10, 2, 1, 11, 51) common-progress-cpp 27.6401 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 2, 1, 12, 57) common-timing-cpp 66.1957 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 2, 1, 14, 30) fem-convergence-cpp 3.62948 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 2, 4, 26, 53) fem-speedup-cpp 11542.3 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 2, 4, 26, 53) fem-speedup-cpp-assembly 6.73345 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 2, 4, 26, 53) fem-speedup-cpp-solve 1.04887 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 2, 4, 27, 45) mesh-refinement-cpp 50.458 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 2, 4, 27, 46) mesh-topology-cpp 1.37204 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 2, 4, 28, 8) mesh-unitcube-cpp 21.7509 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 2, 4, 28, 46) mesh-iteration-cpp 35.5101 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 2, 4, 28, 46) function-evaluation-cpp 0.0834799 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 2, 4, 31, 3) la-vector-access-cpp 132.962 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 2, 4, 31, 43) la-vector-assignment-cpp 40.0095 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 3, 1, 10, 43) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0063 "BENCH 13.0063"
+(2015, 10, 3, 1, 11, 1) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9672 "Building point search tree to accelerate distance queries."
+(2015, 10, 3, 1, 11, 18) geometry-bounding_box_tree_build-cpp 14.2761 "BENCH 14.2761"
+(2015, 10, 3, 1, 11, 46) common-progress-cpp 28.0115 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 3, 1, 12, 52) common-timing-cpp 66.4155 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 3, 1, 14, 25) fem-convergence-cpp 3.64651 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 3, 4, 22, 1) fem-speedup-cpp 11255.5 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 3, 4, 22, 1) fem-speedup-cpp-assembly 6.39372 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 3, 4, 22, 1) fem-speedup-cpp-solve 1.1077 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 3, 4, 22, 46) mesh-refinement-cpp 43.5946 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 3, 4, 22, 47) mesh-topology-cpp 1.37345 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 3, 4, 23, 9) mesh-unitcube-cpp 22.0839 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 3, 4, 23, 47) mesh-iteration-cpp 35.4531 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 3, 4, 23, 47) function-evaluation-cpp 0.0834908 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 3, 4, 26, 4) la-vector-access-cpp 133.166 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 3, 4, 26, 41) la-vector-assignment-cpp 36.5269 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 4, 1, 10, 25) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9048 "BENCH 12.9048"
+(2015, 10, 4, 1, 10, 43) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0772 "Building point search tree to accelerate distance queries."
+(2015, 10, 4, 1, 10, 59) geometry-bounding_box_tree_build-cpp 14.1211 "BENCH 14.1211"
+(2015, 10, 4, 1, 11, 27) common-progress-cpp 27.9925 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 4, 1, 12, 34) common-timing-cpp 66.6978 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 4, 1, 14, 9) fem-convergence-cpp 3.68284 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 4, 4, 58, 46) fem-speedup-cpp 13476.3 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 4, 4, 58, 46) fem-speedup-cpp-assembly 6.43066 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 4, 4, 58, 46) fem-speedup-cpp-solve 0.997223 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 4, 4, 59, 34) mesh-refinement-cpp 45.6495 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 4, 4, 59, 35) mesh-topology-cpp 1.51458 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 4, 4, 59, 59) mesh-unitcube-cpp 23.458 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 4, 5, 0, 38) mesh-iteration-cpp 36.9863 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 4, 5, 0, 39) function-evaluation-cpp 0.127343 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 4, 5, 2, 53) la-vector-access-cpp 130.734 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 4, 5, 3, 27) la-vector-assignment-cpp 33.5224 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 5, 1, 10, 25) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9663 "BENCH 12.9663"
+(2015, 10, 5, 1, 10, 44) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0519 "Building point search tree to accelerate distance queries."
+(2015, 10, 5, 1, 11, 1) geometry-bounding_box_tree_build-cpp 14.354 "BENCH 14.354"
+(2015, 10, 5, 1, 11, 28) common-progress-cpp 27.9373 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 5, 1, 12, 35) common-timing-cpp 66.2193 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 5, 1, 14, 6) fem-convergence-cpp 3.64699 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 5, 4, 36, 36) fem-speedup-cpp 12149.2 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 5, 4, 36, 36) fem-speedup-cpp-assembly 6.46818 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 5, 4, 36, 36) fem-speedup-cpp-solve 1.08054 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 5, 4, 37, 21) mesh-refinement-cpp 43.9704 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 5, 4, 37, 23) mesh-topology-cpp 1.37521 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 5, 4, 37, 45) mesh-unitcube-cpp 22.0812 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 5, 4, 38, 31) mesh-iteration-cpp 43.5028 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 5, 4, 38, 31) function-evaluation-cpp 0.083483 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 5, 4, 40, 44) la-vector-access-cpp 129.096 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 5, 4, 41, 20) la-vector-assignment-cpp 36.0117 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 6, 1, 10, 39) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8688 "BENCH 12.8688"
+(2015, 10, 6, 1, 10, 57) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0222 "Building point search tree to accelerate distance queries."
+(2015, 10, 6, 1, 11, 14) geometry-bounding_box_tree_build-cpp 14.2543 "BENCH 14.2543"
+(2015, 10, 6, 1, 11, 42) common-progress-cpp 27.9561 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 6, 1, 12, 47) common-timing-cpp 65.4735 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 6, 1, 12, 57) fem-convergence-cpp 3.66275 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 6, 4, 25, 53) fem-speedup-cpp 11575.4 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 6, 4, 25, 53) fem-speedup-cpp-assembly 6.50386 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 6, 4, 25, 53) fem-speedup-cpp-solve 1.04638 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 6, 4, 26, 38) mesh-refinement-cpp 44.2493 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 6, 4, 26, 40) mesh-topology-cpp 1.38087 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 6, 4, 27, 2) mesh-unitcube-cpp 22.1959 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 6, 4, 27, 48) mesh-iteration-cpp 43.5135 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 6, 4, 27, 48) function-evaluation-cpp 0.0779641 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 6, 4, 30, 5) la-vector-access-cpp 133.52 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 6, 4, 30, 38) la-vector-assignment-cpp 32.5162 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 7, 1, 10, 46) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.3652 "BENCH 13.3652"
+(2015, 10, 7, 1, 11, 4) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8993 "Building point search tree to accelerate distance queries."
+(2015, 10, 7, 1, 11, 21) geometry-bounding_box_tree_build-cpp 14.2974 "BENCH 14.2974"
+(2015, 10, 7, 1, 11, 48) common-progress-cpp 27.9534 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 7, 1, 12, 57) common-timing-cpp 68.9611 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 7, 1, 13, 7) fem-convergence-cpp 3.67022 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 7, 4, 30, 46) fem-speedup-cpp 11857.9 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 7, 4, 30, 46) fem-speedup-cpp-assembly 6.39553 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 7, 4, 30, 46) fem-speedup-cpp-solve 1.03566 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 7, 4, 31, 30) mesh-refinement-cpp 43.3144 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 7, 4, 31, 32) mesh-topology-cpp 1.36764 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 7, 4, 31, 53) mesh-unitcube-cpp 21.5323 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 7, 4, 32, 31) mesh-iteration-cpp 35.5022 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 7, 4, 32, 31) function-evaluation-cpp 0.0777099 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 7, 4, 35, 2) la-vector-access-cpp 146.528 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 7, 4, 35, 36) la-vector-assignment-cpp 33.7382 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 8, 1, 10, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0246 "BENCH 13.0246"
+(2015, 10, 8, 1, 10, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1043 "Building point search tree to accelerate distance queries."
+(2015, 10, 8, 1, 10, 58) geometry-bounding_box_tree_build-cpp 14.1725 "BENCH 14.1725"
+(2015, 10, 8, 1, 11, 26) common-progress-cpp 27.957 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 8, 1, 12, 33) common-timing-cpp 67.3633 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 8, 1, 12, 43) fem-convergence-cpp 3.67977 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 8, 3, 55, 4) fem-speedup-cpp 9739.89 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 8, 3, 55, 4) fem-speedup-cpp-assembly 6.41048 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 8, 3, 55, 4) fem-speedup-cpp-solve 1.06121 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 8, 3, 55, 48) mesh-refinement-cpp 43.3083 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 8, 3, 55, 50) mesh-topology-cpp 1.36514 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 8, 3, 56, 11) mesh-unitcube-cpp 21.3923 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 8, 3, 56, 57) mesh-iteration-cpp 43.505 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 8, 3, 56, 57) function-evaluation-cpp 0.077934 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 8, 3, 59, 26) la-vector-access-cpp 144.975 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 8, 4, 0, 0) la-vector-assignment-cpp 33.4515 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 9, 1, 10, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.2625 "BENCH 13.2625"
+(2015, 10, 9, 1, 10, 41) geometry-bounding_box_tree_compute_closest_entity-cpp 15.2746 "Building point search tree to accelerate distance queries."
+(2015, 10, 9, 1, 10, 58) geometry-bounding_box_tree_build-cpp 14.1672 "BENCH 14.1672"
+(2015, 10, 9, 1, 11, 26) common-progress-cpp 28.0114 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 9, 1, 12, 35) common-timing-cpp 68.7436 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 9, 1, 12, 44) fem-convergence-cpp 3.66727 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 9, 4, 6, 7) fem-speedup-cpp 10401.6 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 9, 4, 6, 7) fem-speedup-cpp-assembly 6.4454 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 9, 4, 6, 7) fem-speedup-cpp-solve 1.05344 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 9, 4, 6, 52) mesh-refinement-cpp 43.4011 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 9, 4, 6, 53) mesh-topology-cpp 1.36247 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 9, 4, 7, 15) mesh-unitcube-cpp 21.497 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 9, 4, 7, 52) mesh-iteration-cpp 35.5042 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 9, 4, 7, 52) function-evaluation-cpp 0.078007 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 9, 4, 10, 20) la-vector-access-cpp 143.893 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 9, 4, 10, 54) la-vector-assignment-cpp 33.4507 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 10, 1, 10, 57) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0096 "BENCH 13.0096"
+(2015, 10, 10, 1, 11, 16) geometry-bounding_box_tree_compute_closest_entity-cpp 14.972 "Building point search tree to accelerate distance queries."
+(2015, 10, 10, 1, 11, 32) geometry-bounding_box_tree_build-cpp 14.181 "BENCH 14.181"
+(2015, 10, 10, 1, 12, 0) common-progress-cpp 27.9524 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 10, 1, 13, 6) common-timing-cpp 65.9889 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 10, 1, 13, 16) fem-convergence-cpp 3.64206 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 10, 4, 29, 14) fem-speedup-cpp 11757.2 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 10, 4, 29, 14) fem-speedup-cpp-assembly 6.36321 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 10, 4, 29, 14) fem-speedup-cpp-solve 0.956146 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 10, 4, 29, 58) mesh-refinement-cpp 43.3836 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 10, 4, 30, 0) mesh-topology-cpp 1.36694 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 10, 4, 30, 21) mesh-unitcube-cpp 21.4641 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 10, 4, 31, 3) mesh-iteration-cpp 39.1195 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 10, 4, 31, 3) function-evaluation-cpp 0.0777721 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 10, 4, 33, 31) la-vector-access-cpp 144.298 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 10, 4, 34, 9) la-vector-assignment-cpp 37.4541 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 11, 1, 10, 22) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9928 "BENCH 12.9928"
+(2015, 10, 11, 1, 10, 41) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8762 "Building point search tree to accelerate distance queries."
+(2015, 10, 11, 1, 10, 57) geometry-bounding_box_tree_build-cpp 14.1424 "BENCH 14.1424"
+(2015, 10, 11, 1, 11, 25) common-progress-cpp 27.9932 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 11, 1, 12, 33) common-timing-cpp 68.2888 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 11, 1, 12, 43) fem-convergence-cpp 3.67741 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 11, 4, 26, 34) fem-speedup-cpp 11629.3 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 11, 4, 26, 34) fem-speedup-cpp-assembly 6.27018 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 11, 4, 26, 34) fem-speedup-cpp-solve 1.05243 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 11, 4, 27, 18) mesh-refinement-cpp 43.6719 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 11, 4, 27, 20) mesh-topology-cpp 1.37007 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 11, 4, 27, 41) mesh-unitcube-cpp 21.6116 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 11, 4, 28, 19) mesh-iteration-cpp 35.5123 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 11, 4, 28, 19) function-evaluation-cpp 0.0778549 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 11, 4, 30, 48) la-vector-access-cpp 144.523 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 11, 4, 31, 21) la-vector-assignment-cpp 33.4478 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 12, 1, 10, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.217 "BENCH 13.217"
+(2015, 10, 12, 1, 10, 41) geometry-bounding_box_tree_compute_closest_entity-cpp 15.0076 "Building point search tree to accelerate distance queries."
+(2015, 10, 12, 1, 10, 58) geometry-bounding_box_tree_build-cpp 14.2142 "BENCH 14.2142"
+(2015, 10, 12, 1, 11, 31) common-progress-cpp 32.9442 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 12, 1, 12, 38) common-timing-cpp 66.8853 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 12, 1, 12, 47) fem-convergence-cpp 3.68608 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 12, 4, 10, 57) fem-speedup-cpp 10688.6 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 12, 4, 10, 57) fem-speedup-cpp-assembly 6.31784 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 12, 4, 10, 57) fem-speedup-cpp-solve 1.08165 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 12, 4, 11, 42) mesh-refinement-cpp 43.3394 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 12, 4, 11, 43) mesh-topology-cpp 1.36363 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 12, 4, 12, 5) mesh-unitcube-cpp 21.4352 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 12, 4, 12, 42) mesh-iteration-cpp 35.5036 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 12, 4, 12, 42) function-evaluation-cpp 0.0779529 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 12, 4, 15, 9) la-vector-access-cpp 142.506 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 12, 4, 15, 43) la-vector-assignment-cpp 33.5055 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 13, 1, 10, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.0836 "BENCH 13.0836"
+(2015, 10, 13, 1, 10, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 14.7692 "Building point search tree to accelerate distance queries."
+(2015, 10, 13, 1, 10, 58) geometry-bounding_box_tree_build-cpp 14.1163 "BENCH 14.1163"
+(2015, 10, 13, 1, 11, 26) common-progress-cpp 27.9336 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 13, 1, 12, 33) common-timing-cpp 67.1536 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 13, 1, 12, 43) fem-convergence-cpp 3.66291 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 13, 4, 9, 2) fem-speedup-cpp 10578.7 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 13, 4, 9, 2) fem-speedup-cpp-assembly 6.36985 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 13, 4, 9, 2) fem-speedup-cpp-solve 1.05971 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 13, 4, 9, 47) mesh-refinement-cpp 43.3787 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 13, 4, 9, 48) mesh-topology-cpp 1.36231 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 13, 4, 10, 10) mesh-unitcube-cpp 21.329 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 13, 4, 10, 55) mesh-iteration-cpp 43.5009 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 13, 4, 10, 55) function-evaluation-cpp 0.0778451 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 13, 4, 13, 19) la-vector-access-cpp 139.006 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 13, 4, 13, 52) la-vector-assignment-cpp 33.4994 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 14, 1, 10, 57) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9036 "BENCH 12.9036"
+(2015, 10, 14, 1, 11, 16) geometry-bounding_box_tree_compute_closest_entity-cpp 15.139 "Building point search tree to accelerate distance queries."
+(2015, 10, 14, 1, 11, 32) geometry-bounding_box_tree_build-cpp 14.1545 "BENCH 14.1545"
+(2015, 10, 14, 1, 12, 0) common-progress-cpp 27.9677 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 14, 1, 13, 7) common-timing-cpp 67.2447 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 14, 1, 13, 17) fem-convergence-cpp 3.65761 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 14, 4, 15, 7) fem-speedup-cpp 10908.6 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 14, 4, 15, 7) fem-speedup-cpp-assembly 6.37425 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 14, 4, 15, 7) fem-speedup-cpp-solve 1.10867 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 14, 4, 15, 51) mesh-refinement-cpp 43.3868 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 14, 4, 15, 52) mesh-topology-cpp 1.36329 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 14, 4, 16, 14) mesh-unitcube-cpp 21.4763 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 14, 4, 17, 0) mesh-iteration-cpp 43.5014 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 14, 4, 17, 0) function-evaluation-cpp 0.0777609 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 14, 4, 19, 26) la-vector-access-cpp 141.663 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 14, 4, 19, 59) la-vector-assignment-cpp 33.449 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 15, 1, 10, 21) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1661 "BENCH 13.1661"
+(2015, 10, 15, 1, 10, 40) geometry-bounding_box_tree_compute_closest_entity-cpp 14.8812 "Building point search tree to accelerate distance queries."
+(2015, 10, 15, 1, 10, 56) geometry-bounding_box_tree_build-cpp 14.2048 "BENCH 14.2048"
+(2015, 10, 15, 1, 11, 24) common-progress-cpp 27.9823 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 15, 1, 12, 31) common-timing-cpp 67.0245 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 15, 1, 12, 41) fem-convergence-cpp 3.66993 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 15, 4, 36, 10) fem-speedup-cpp 12208.5 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 15, 4, 36, 10) fem-speedup-cpp-assembly 6.36905 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 15, 4, 36, 10) fem-speedup-cpp-solve 1.10716 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 15, 4, 36, 55) mesh-refinement-cpp 43.3009 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 15, 4, 36, 56) mesh-topology-cpp 1.36589 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 15, 4, 37, 18) mesh-unitcube-cpp 21.4298 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 15, 4, 37, 59) mesh-iteration-cpp 39.2077 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 15, 4, 37, 59) function-evaluation-cpp 0.078197 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 15, 4, 40, 24) la-vector-access-cpp 140.765 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 15, 4, 40, 58) la-vector-assignment-cpp 33.4298 "Assigning to vector of size 10000000 (100 repetitions)"
+(2015, 10, 16, 1, 10, 58) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.1583 "BENCH 13.1583"
+(2015, 10, 16, 1, 11, 17) geometry-bounding_box_tree_compute_closest_entity-cpp 14.9526 "Building point search tree to accelerate distance queries."
+(2015, 10, 16, 1, 11, 33) geometry-bounding_box_tree_build-cpp 14.1348 "BENCH 14.1348"
+(2015, 10, 16, 1, 12, 1) common-progress-cpp 27.9648 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2015, 10, 16, 1, 13, 9) common-timing-cpp 67.2636 "Timing access and registration of timings (10000000 repetitions)"
+(2015, 10, 16, 1, 13, 18) fem-convergence-cpp 3.67179 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2015, 10, 16, 4, 14, 18) fem-speedup-cpp 10858.9 "Assembly/solve speedup running on 4 processors"
+(2015, 10, 16, 4, 14, 18) fem-speedup-cpp-assembly 6.35766 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2015, 10, 16, 4, 14, 18) fem-speedup-cpp-solve 0.960496 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2015, 10, 16, 4, 15, 3) mesh-refinement-cpp 43.5144 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2015, 10, 16, 4, 15, 4) mesh-topology-cpp 1.3632 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2015, 10, 16, 4, 15, 26) mesh-unitcube-cpp 21.4539 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2015, 10, 16, 4, 16, 7) mesh-iteration-cpp 39.1171 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2015, 10, 16, 4, 16, 7) function-evaluation-cpp 0.0781951 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2015, 10, 16, 4, 18, 34) la-vector-access-cpp 142.526 "Accessing vector of size 10000000 (100 repetitions)"
+(2015, 10, 16, 4, 19, 7) la-vector-assignment-cpp 33.5249 "Assigning to vector of size 10000000 (100 repetitions)"
+(2016, 1, 13, 16, 3, 4) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.506 "BENCH 13.506"
+(2016, 1, 13, 16, 3, 22) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1554 "Building point search tree to accelerate distance queries."
+(2016, 1, 13, 16, 3, 36) geometry-bounding_box_tree_build-cpp 11.594 "BENCH 11.594"
+(2016, 1, 13, 16, 4, 7) common-progress-cpp 31.4197 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2016, 1, 13, 16, 5, 8) common-timing-cpp 60.6782 "Timing access and registration of timings (10000000 repetitions)"
+(2016, 1, 13, 16, 5, 17) fem-convergence-cpp 3.47625 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2016, 1, 13, 16, 5, 51) fem-jit-python 0.0005023 "JIT compilation (in memory cache)"
+(2016, 1, 13, 16, 10, 43) fem-speedup-cpp 292.091 "Assembly/solve speedup running on 4 processors"
+(2016, 1, 13, 16, 10, 43) fem-speedup-cpp-assembly 4.50146 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2016, 1, 13, 16, 10, 43) fem-speedup-cpp-solve 2.00072 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2016, 1, 13, 16, 11, 24) mesh-refinement-cpp 40.2751 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2016, 1, 13, 16, 11, 25) mesh-topology-cpp 1.35198 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2016, 1, 13, 16, 11, 46) mesh-unitcube-cpp 20.7443 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2016, 1, 13, 16, 12, 27) mesh-iteration-cpp 38.511 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2016, 1, 13, 16, 12, 27) function-evaluation-cpp 0.080951 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2016, 1, 13, 16, 13, 29) function-extrapolation-python 61.7874 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2016, 1, 13, 16, 13, 29) function-extrapolation-python 1.67974 "Calling FFC just-in-time (JIT) compiler, this may take some time."
+(2016, 1, 13, 16, 13, 40) function-interpolation-python 11.5981 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2016, 1, 13, 16, 13, 40) function-interpolation-python 0.940371 "Calling DOLFIN just-in-time (JIT) compiler, this may take some time."
+(2016, 1, 13, 16, 15, 44) la-vector-access-cpp 124.272 "Accessing vector of size 10000000 (100 repetitions)"
+(2016, 1, 13, 16, 16, 16) la-vector-assignment-cpp 32.0029 "Assigning to vector of size 10000000 (100 repetitions)"
+(2016, 1, 14, 2, 15, 8) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.7979 "BENCH 12.7979"
+(2016, 1, 14, 2, 15, 27) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1097 "Building point search tree to accelerate distance queries."
+(2016, 1, 14, 2, 15, 41) geometry-bounding_box_tree_build-cpp 11.9556 "BENCH 11.9556"
+(2016, 1, 14, 2, 16, 12) common-progress-cpp 31.394 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2016, 1, 14, 2, 17, 17) common-timing-cpp 64.6461 "Timing access and registration of timings (10000000 repetitions)"
+(2016, 1, 14, 2, 17, 26) fem-convergence-cpp 3.4811 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2016, 1, 14, 2, 17, 27) fem-jit-python 0.000479102 "JIT compilation (in memory cache)"
+(2016, 1, 14, 2, 22, 17) fem-speedup-cpp 290.087 "Assembly/solve speedup running on 4 processors"
+(2016, 1, 14, 2, 22, 17) fem-speedup-cpp-assembly 4.54294 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2016, 1, 14, 2, 22, 17) fem-speedup-cpp-solve 2.04486 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2016, 1, 14, 2, 22, 58) mesh-refinement-cpp 40.6016 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2016, 1, 14, 2, 23, 0) mesh-topology-cpp 1.31767 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2016, 1, 14, 2, 23, 20) mesh-unitcube-cpp 19.9415 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2016, 1, 14, 2, 24, 0) mesh-iteration-cpp 38.5566 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2016, 1, 14, 2, 24, 0) function-evaluation-cpp 0.0667651 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2016, 1, 14, 2, 24, 6) function-extrapolation-python 5.68779 "BENCH:  1.68426918983"
+(2016, 1, 14, 2, 24, 6) function-extrapolation-python 1.68427 "BENCH:  1.68426918983"
+(2016, 1, 14, 2, 24, 9) function-interpolation-python 2.49873 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 14, 2, 24, 9) function-interpolation-python 0.927591 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 14, 2, 26, 17) la-vector-access-cpp 128.29 "Accessing vector of size 10000000 (100 repetitions)"
+(2016, 1, 14, 2, 26, 51) la-vector-assignment-cpp 34.0574 "Assigning to vector of size 10000000 (100 repetitions)"
+(2016, 1, 15, 2, 15, 29) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8773 "BENCH 12.8773"
+(2016, 1, 15, 2, 15, 48) geometry-bounding_box_tree_compute_closest_entity-cpp 15.3814 "Building point search tree to accelerate distance queries."
+(2016, 1, 15, 2, 16, 3) geometry-bounding_box_tree_build-cpp 12.7854 "BENCH 12.7854"
+(2016, 1, 15, 2, 16, 34) common-progress-cpp 31.4387 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2016, 1, 15, 2, 17, 38) common-timing-cpp 63.4933 "Timing access and registration of timings (10000000 repetitions)"
+(2016, 1, 15, 2, 17, 47) fem-convergence-cpp 3.53207 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2016, 1, 15, 2, 17, 50) fem-jit-python 0.000484204 "JIT compilation (in memory cache)"
+(2016, 1, 15, 2, 22, 40) fem-speedup-cpp 290.87 "Assembly/solve speedup running on 4 processors"
+(2016, 1, 15, 2, 22, 40) fem-speedup-cpp-assembly 4.439 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2016, 1, 15, 2, 22, 40) fem-speedup-cpp-solve 2.06219 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2016, 1, 15, 2, 23, 22) mesh-refinement-cpp 40.9061 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2016, 1, 15, 2, 23, 23) mesh-topology-cpp 1.32659 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2016, 1, 15, 2, 23, 44) mesh-unitcube-cpp 20.5496 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2016, 1, 15, 2, 24, 34) mesh-iteration-cpp 47.8602 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2016, 1, 15, 2, 24, 34) function-evaluation-cpp 0.0660989 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2016, 1, 15, 2, 24, 40) function-extrapolation-python 5.93016 "BENCH:  1.66257119179"
+(2016, 1, 15, 2, 24, 40) function-extrapolation-python 1.66257 "BENCH:  1.66257119179"
+(2016, 1, 15, 2, 24, 42) function-interpolation-python 2.46605 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 15, 2, 24, 42) function-interpolation-python 0.918086 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 15, 2, 26, 48) la-vector-access-cpp 125.244 "Accessing vector of size 10000000 (100 repetitions)"
+(2016, 1, 15, 2, 27, 20) la-vector-assignment-cpp 32.0039 "Assigning to vector of size 10000000 (100 repetitions)"
+(2016, 1, 16, 2, 15, 23) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.9146 "BENCH 12.9146"
+(2016, 1, 16, 2, 15, 42) geometry-bounding_box_tree_compute_closest_entity-cpp 15.8391 "Building point search tree to accelerate distance queries."
+(2016, 1, 16, 2, 15, 56) geometry-bounding_box_tree_build-cpp 12.1027 "BENCH 12.1027"
+(2016, 1, 16, 2, 16, 28) common-progress-cpp 31.669 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2016, 1, 16, 2, 17, 31) common-timing-cpp 63.0912 "Timing access and registration of timings (10000000 repetitions)"
+(2016, 1, 16, 2, 17, 40) fem-convergence-cpp 3.50697 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2016, 1, 16, 2, 17, 42) fem-jit-python 0.000497794 "JIT compilation (in memory cache)"
+(2016, 1, 16, 2, 22, 32) fem-speedup-cpp 290.234 "Assembly/solve speedup running on 4 processors"
+(2016, 1, 16, 2, 22, 32) fem-speedup-cpp-assembly 4.52228 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2016, 1, 16, 2, 22, 32) fem-speedup-cpp-solve 2.06122 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2016, 1, 16, 2, 23, 13) mesh-refinement-cpp 40.7782 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2016, 1, 16, 2, 23, 15) mesh-topology-cpp 1.32719 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2016, 1, 16, 2, 23, 35) mesh-unitcube-cpp 20.5641 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2016, 1, 16, 2, 24, 19) mesh-iteration-cpp 40.9487 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2016, 1, 16, 2, 24, 19) function-evaluation-cpp 0.0583792 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2016, 1, 16, 2, 24, 25) function-extrapolation-python 6.04254 "BENCH:  1.66025710106"
+(2016, 1, 16, 2, 24, 25) function-extrapolation-python 1.66026 "BENCH:  1.66025710106"
+(2016, 1, 16, 2, 24, 27) function-interpolation-python 2.49797 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 16, 2, 24, 27) function-interpolation-python 0.922166 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 16, 2, 26, 32) la-vector-access-cpp 124.897 "Accessing vector of size 10000000 (100 repetitions)"
+(2016, 1, 16, 2, 27, 4) la-vector-assignment-cpp 32.0119 "Assigning to vector of size 10000000 (100 repetitions)"
+(2016, 1, 17, 2, 15, 30) geometry-bounding_box_tree_compute_entity_collisions-cpp 12.8844 "BENCH 12.8844"
+(2016, 1, 17, 2, 15, 48) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1341 "Building point search tree to accelerate distance queries."
+(2016, 1, 17, 2, 16, 2) geometry-bounding_box_tree_build-cpp 11.9931 "BENCH 11.9931"
+(2016, 1, 17, 2, 16, 34) common-progress-cpp 31.4539 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2016, 1, 17, 2, 17, 37) common-timing-cpp 63.1319 "Timing access and registration of timings (10000000 repetitions)"
+(2016, 1, 17, 2, 17, 46) fem-convergence-cpp 3.48352 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2016, 1, 17, 2, 17, 47) fem-jit-python 0.000487208 "JIT compilation (in memory cache)"
+(2016, 1, 17, 2, 22, 44) fem-speedup-cpp 297.13 "Assembly/solve speedup running on 4 processors"
+(2016, 1, 17, 2, 22, 44) fem-speedup-cpp-assembly 4.5637 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2016, 1, 17, 2, 22, 44) fem-speedup-cpp-solve 1.95258 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2016, 1, 17, 2, 23, 26) mesh-refinement-cpp 40.9425 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2016, 1, 17, 2, 23, 27) mesh-topology-cpp 1.31377 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2016, 1, 17, 2, 23, 48) mesh-unitcube-cpp 20.6877 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2016, 1, 17, 2, 24, 31) mesh-iteration-cpp 40.9479 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2016, 1, 17, 2, 24, 31) function-evaluation-cpp 0.065727 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2016, 1, 17, 2, 24, 37) function-extrapolation-python 5.7739 "BENCH:  1.66412186623"
+(2016, 1, 17, 2, 24, 37) function-extrapolation-python 1.66412 "BENCH:  1.66412186623"
+(2016, 1, 17, 2, 24, 39) function-interpolation-python 2.49006 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 17, 2, 24, 39) function-interpolation-python 0.93913 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 17, 2, 26, 45) la-vector-access-cpp 125.926 "Accessing vector of size 10000000 (100 repetitions)"
+(2016, 1, 17, 2, 27, 17) la-vector-assignment-cpp 32.0128 "Assigning to vector of size 10000000 (100 repetitions)"
+(2016, 1, 18, 2, 15, 29) geometry-bounding_box_tree_compute_entity_collisions-cpp 13.9525 "BENCH 13.9525"
+(2016, 1, 18, 2, 15, 47) geometry-bounding_box_tree_compute_closest_entity-cpp 15.1188 "Building point search tree to accelerate distance queries."
+(2016, 1, 18, 2, 16, 2) geometry-bounding_box_tree_build-cpp 12.1198 "BENCH 12.1198"
+(2016, 1, 18, 2, 16, 33) common-progress-cpp 31.4964 "Creating progress bar with 500000000 steps (5 repetitions)"
+(2016, 1, 18, 2, 17, 32) common-timing-cpp 58.8124 "Timing access and registration of timings (10000000 repetitions)"
+(2016, 1, 18, 2, 17, 41) fem-convergence-cpp 3.49213 "Solving Poisson's equation in 2D for q = 1, n = 2."
+(2016, 1, 18, 2, 17, 42) fem-jit-python 0.000485015 "JIT compilation (in memory cache)"
+(2016, 1, 18, 2, 22, 34) fem-speedup-cpp 291.706 "Assembly/solve speedup running on 4 processors"
+(2016, 1, 18, 2, 22, 34) fem-speedup-cpp-assembly 4.56212 "Assembly/solve speedup running on 4 processors ((assembly_1st+2nd))"
+(2016, 1, 18, 2, 22, 34) fem-speedup-cpp-solve 2.03206 "Assembly/solve speedup running on 4 processors ((solve_1st))"
+(2016, 1, 18, 2, 23, 15) mesh-refinement-cpp 40.5546 "Uniform refinement of unit cube of size 4 x 4 x 4 (5 refinements)"
+(2016, 1, 18, 2, 23, 17) mesh-topology-cpp 1.35012 "Creating cell-cell connectivity for unit cube of size 64 x 64 x 64 (5 repetitions)"
+(2016, 1, 18, 2, 23, 38) mesh-unitcube-cpp 21.0976 "Creating unit cube of size 128 x 128 x 128 (10 repetitions)"
+(2016, 1, 18, 2, 24, 21) mesh-iteration-cpp 40.9485 "Iteration over entities of unit cube of size 128 x 128 x 128 (100 repetitions)"
+(2016, 1, 18, 2, 24, 21) function-evaluation-cpp 0.0591931 "DOLFIN must be compiled with CGAL to run function eval benchmark."
+(2016, 1, 18, 2, 24, 27) function-extrapolation-python 5.84827 "BENCH:  1.6565310955"
+(2016, 1, 18, 2, 24, 27) function-extrapolation-python 1.65653 "BENCH:  1.6565310955"
+(2016, 1, 18, 2, 24, 29) function-interpolation-python 2.45584 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 18, 2, 24, 29) function-interpolation-python 0.916362 "*** Warning: Plotting not available. DOLFIN has been compiled without VTK support."
+(2016, 1, 18, 2, 26, 40) la-vector-access-cpp 130.74 "Accessing vector of size 10000000 (100 repetitions)"
+(2016, 1, 18, 2, 27, 12) la-vector-assignment-cpp 32.0081 "Assigning to vector of size 10000000 (100 repetitions)"
diff --git a/bench/logs/milestones.log b/bench/logs/milestones.log
index 9606f43..db5d016 100644
--- a/bench/logs/milestones.log
+++ b/bench/logs/milestones.log
@@ -1,7 +1,7 @@
-2008-02-18 DOLFIN 0.7.2 
+2008-02-18 DOLFIN 0.7.2
 2008-04-30 DOLFIN 0.7.3
 2008-06-23 DOLFIN 0.8.0
-2008-10-20 DOLFIN 0.8.1 
+2008-10-20 DOLFIN 0.8.1
 2009-01-05 DOLFIN 0.9.0
 2009-02-17 DOLFIN 0.9.1
 2009-04-07 DOLFIN 0.9.2
@@ -12,3 +12,13 @@
 2010-02-17 DOLFIN 0.9.7
 2010-07-01 DOLFIN 0.9.8
 2010-09-02 DOLFIN 0.9.9
+2011-02-23 DOLFIN 0.9.10
+2011-05-16 DOLFIN 0.9.11
+2011-08-11 DOLFIN 1.0-beta
+2011-12-06 DOLFIN 1.0.0
+2013-01-08 DOLFIN 1.1.0
+2013-03-24 DOLFIN 1.2.0
+2014-01-07 DOLFIN 1.3.0
+2014-06-02 DOLFIN 1.4.0
+2015-01-12 DOLFIN 1.5.0
+2015-07-28 DOLFIN 1.6.0
diff --git a/bench/mesh/iteration/cpp/CMakeLists.txt b/bench/mesh/iteration/cpp/CMakeLists.txt
index 0cca0c8..9244a14 100644
--- a/bench/mesh/iteration/cpp/CMakeLists.txt
+++ b/bench/mesh/iteration/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/mesh/iteration/cpp/main.cpp b/bench/mesh/iteration/cpp/main.cpp
index 8a1ecfa..d404137 100644
--- a/bench/mesh/iteration/cpp/main.cpp
+++ b/bench/mesh/iteration/cpp/main.cpp
@@ -34,7 +34,7 @@ int main(int argc, char* argv[])
 
   UnitCubeMesh mesh(SIZE, SIZE, SIZE);
 
-  int sum = 0;
+  std::size_t sum = 0;
   tic();
   for (int i = 0; i < NUM_REPS; i++)
   {
@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
   info("BENCH %g", toc());
 
   // To prevent optimizing the loop away
-  info("Sum is %d", sum);
+  info("Sum is %llu", (unsigned long long)sum);
 
   return 0;
 }
diff --git a/bench/mesh/refinement/cpp/CMakeLists.txt b/bench/mesh/refinement/cpp/CMakeLists.txt
index 5f75ce9..43be113 100644
--- a/bench/mesh/refinement/cpp/CMakeLists.txt
+++ b/bench/mesh/refinement/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/mesh/topology/cpp/CMakeLists.txt b/bench/mesh/topology/cpp/CMakeLists.txt
index 509fc27..90d1808 100644
--- a/bench/mesh/topology/cpp/CMakeLists.txt
+++ b/bench/mesh/topology/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/mesh/topology/cpp/main.cpp b/bench/mesh/topology/cpp/main.cpp
index d9cebea..455ddfb 100644
--- a/bench/mesh/topology/cpp/main.cpp
+++ b/bench/mesh/topology/cpp/main.cpp
@@ -42,6 +42,10 @@ int main(int argc, char* argv[])
   UnitCubeMesh mesh(SIZE, SIZE, SIZE);
   const int D = mesh.topology().dim();
 
+  // Clear timing (if there is some)
+  { Timer t("Compute connectivity 3-3"); }
+  timing("Compute connectivity 3-3", TimingClear::clear);
+
   for (int i = 0; i < NUM_REPS; i++)
   {
     mesh.clean();
@@ -53,5 +57,9 @@ int main(int argc, char* argv[])
   list_timings(TimingClear::keep,
                { TimingType::wall, TimingType::user, TimingType::system });
 
+  // Report timing
+  const auto t = timing("Compute connectivity 3-3", TimingClear::clear);
+  info("BENCH %g", std::get<1>(t));
+
   return 0;
 }
diff --git a/bench/mesh/unitcube/cpp/CMakeLists.txt b/bench/mesh/unitcube/cpp/CMakeLists.txt
index a35b9cf..d259435 100644
--- a/bench/mesh/unitcube/cpp/CMakeLists.txt
+++ b/bench/mesh/unitcube/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/bench/plot.py b/bench/plot.py
index b3ed810..69c2a76 100644
--- a/bench/plot.py
+++ b/bench/plot.py
@@ -73,10 +73,11 @@ for line in lines:
         description = match.group(4)
 
         if not name in benchmarks:
-            benchmarks[name] = [[date], [elapsed_time], description]
+            benchmarks[name] = [[[date], [elapsed_time], description]]
         else:
-            benchmarks[name][0].append(date)
-            benchmarks[name][1].append(elapsed_time)
+            benchmarks[name][0][0].append(date)
+            benchmarks[name][0][1].append(elapsed_time)
+            benchmarks[name][0][2] = description # take later description
 
 # Open and read in logs/milestones.log
 milestones = []
@@ -126,6 +127,7 @@ def get_maxtime(dates, min_date, max_date, run_timings):
 
 # Create normalized plots with all benchmarks in same plot for
 # last week, last month, last year, and last five years
+linetypes = {}
 print("Generating plots for all benchmarks...")
 for last, locator, date_fmt, xmin in zip(lasts, locators, date_fmts, xmins):
     fig = plt.figure()
@@ -134,12 +136,13 @@ for last, locator, date_fmt, xmin in zip(lasts, locators, date_fmts, xmins):
     ymax = 0
     for benchmark, values in benchmarks.items():
         num += 1
-        dates = values[0]
-        run_timings = values[1]/numpy.linalg.norm(values[1])
-        ax.plot(dates, run_timings,
-                marker=markers[num % len(markers)], markersize=3,
-                label=benchmark)
+        dates = values[0][0]
+        run_timings = values[0][1]/numpy.linalg.norm(values[0][1])
+        p = ax.plot(dates, run_timings,
+                    marker=markers[num % len(markers)], markersize=3,
+                    label=benchmark)
         ax.hold(True)
+        linetypes[benchmark] = p[0]
         maxtime = get_maxtime(dates, xmin, today, run_timings)
         if maxtime > ymax:
             ymax = maxtime
@@ -161,7 +164,7 @@ for last, locator, date_fmt, xmin in zip(lasts, locators, date_fmts, xmins):
                     arrowprops=dict(arrowstyle="->", alpha=0.3)
                     )
 
-    lgd = plt.legend(loc='best')
+    #lgd = plt.legend(loc='best')
     fig.autofmt_xdate()
     plt.title("All benchmarks (last %s)" % last)
     filename = "all_last_%s.png" % last.replace(' ', '_')
@@ -173,32 +176,57 @@ for last, locator, date_fmt, xmin in zip(lasts, locators, date_fmts, xmins):
     else:
         outfile.write("  <td><img src=\"%s\" /></td></tr>\n" % filename)
 
+# Separate legend
+linetypes = sorted(linetypes.items())
+handles = [p for (t, p) in linetypes]
+labels = [t for (t, p) in linetypes]
+plt.figure(figsize=(12, 4)) # twice wide the default
+plt.figlegend(handles, labels, 'center', ncol=3)
+plt.savefig('all_legend.png')
+outfile.write("  <tr><td colspan=\"2\"><img src=\"%s\" /></td></tr>\n" % 'all_legend.png')
+
 outfile.write("</table>\n")
 outfile.write("</center>\n")
 
-# Now create separate plots for every benchmark
+# Put together subtasks benchmarks which should be plotted together
+# (annotated by ((...)) in description)
 for benchmark, values in benchmarks.items():
+    postfix = values[0][2].split("((")
+    if len(postfix) == 1:
+        continue
+    assert len(postfix) == 2
+    postfix = postfix[1].strip().replace("))", "")
+    benchmarks.pop(benchmark)
+    name = "-".join(benchmark.split("-")[:3]) + "-subtasks"
+    if not name in benchmarks:
+        benchmarks[name] = []
+    benchmarks[name].append((values[0][0], values[0][1], postfix))
+
+# Now create separate plots for every benchmark
+for benchmark, values in sorted(benchmarks.items()):
     print("Generating plots for %s..." % benchmark)
 
     outfile.write("<h2>%s</h2><p>\n" % benchmark)
     outfile.write("<center>\n")
     outfile.write("<table border=\"0\">\n")
 
-    dates = values[0]
-    run_timings = values[1]
-    description = values[2]
-    # Wrap the lines in the description
-    description = textwrap.fill(description, width=30)
-
     # Create plots for last week, last month, last year, and last five years
     for last, locator, date_fmt, xmin in zip(lasts, locators, date_fmts, xmins):
         fig = plt.figure()
         ax = fig.gca()
-        ax.plot(dates, run_timings, marker='o', markersize=3)
-        ax.set_ylabel("time (seconds)")
-        maxtime = get_maxtime(dates, xmin, today, run_timings)
-        ax.set_ylim(0, maxtime + maxtime/2)
-        ax.legend((description,), loc='best')        
+        if any(s in benchmark for s in ["fem-speedup-cpp-"]):
+            ax.set_ylabel("speedup")
+        else:
+            ax.set_ylabel("time (seconds)")
+        maxtime = 0.0
+        for v in values:
+            dates = v[0]
+            run_timings = v[1]
+            description = textwrap.fill(v[2], width=30)
+            maxtime = max(maxtime, get_maxtime(dates, xmin, today, run_timings))
+            ax.set_ylim(0, maxtime + maxtime/2)
+            ax.plot(dates, run_timings, marker='o', markersize=3, label=description)
+        ax.legend(loc='best')
         ax.xaxis.set_major_locator(locator)
         ax.xaxis.set_major_formatter(mdates.DateFormatter(date_fmt))
         ax.set_xlim(xmin, today)
diff --git a/cmake/modules/FindPETSc.cmake b/cmake/modules/FindPETSc.cmake
index 8cb8cf4..2566b7b 100644
--- a/cmake/modules/FindPETSc.cmake
+++ b/cmake/modules/FindPETSc.cmake
@@ -45,8 +45,8 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #=============================================================================
 
-# NOTE: The PETSc Makefile returns a bunch of libraries with '-L' and '-l',
-# wheres we would prefer complete paths. For a discussion, see
+# NOTE: The PETSc Makefile returns a bunch of libraries with '-L' and
+# '-l', wheres we would prefer complete paths. For a discussion, see
 # http://www.cmake.org/Wiki/CMake:Improving_Find*_Modules#Current_workarounds
 
 message(STATUS "Checking for package 'PETSc'")
@@ -64,7 +64,7 @@ endforeach()
 
 # List of possible locations for PETSC_DIR
 set(petsc_dir_locations "")
-list(APPEND petsc_dir_locations "/usr/lib/petscdir/3.4.2")  # Debian location
+list(APPEND petsc_dir_locations "/usr/lib/petsc")           # Debian location
 list(APPEND petsc_dir_locations "/opt/local/lib/petsc")     # Macports location
 list(APPEND petsc_dir_locations "/usr/local/lib/petsc")     # User location
 list(APPEND petsc_dir_locations "$ENV{HOME}/petsc")         # User location
@@ -130,8 +130,7 @@ endif()
 if (FOUND_PETSC_CONF)
 
   # Find PETSc config file
-  find_file(PETSC_VARIABLES_FILE NAMES variables PATHS ${PETSC_DIR}/lib/petsc/conf
-    ${PETSC_DIR}/lib/petsc-conf ${PETSC_DIR}/conf)
+  find_file(PETSC_VARIABLES_FILE NAMES variables PATHS ${PETSC_DIR}/lib/petsc/conf)
 
   # Create a temporary Makefile to probe the PETSc configuration
   set(petsc_config_makefile ${PROJECT_BINARY_DIR}/Makefile.petsc)
@@ -153,27 +152,22 @@ show :
   endmacro()
 
   # Call macro to get the PETSc variables
-  petsc_get_variable(PETSC_INCLUDE PETSC_INCLUDE)          # 3.1
-  petsc_get_variable(PETSC_CC_INCLUDES PETSC_CC_INCLUDES)  # dev
-  set(PETSC_INCLUDE ${PETSC_INCLUDE} ${PETSC_CC_INCLUDES})
-  petsc_get_variable(PETSC_LIB_BASIC PETSC_LIB_BASIC)
+  petsc_get_variable(PETSC_CC_INCLUDES PETSC_CC_INCLUDES)
+  petsc_get_variable(PETSC_LIBS PETSC_LIB)
   petsc_get_variable(PETSC_LIB_DIR PETSC_LIB_DIR)
-  set(PETSC_LIB "-L${PETSC_LIB_DIR} ${PETSC_LIB_BASIC}")
-
-  # Call macro to get the PETSc 3rd-party libraries
-  petsc_get_variable(PETSC_EXTERNAL_LIB_BASIC PETSC_EXTERNAL_LIB_BASIC)
+  set(PETSC_LIB "-L${PETSC_LIB_DIR} ${PETSC_LIBS}")
 
   # Extract include paths and libraries from compile command line
   include(ResolveCompilerPaths)
-  resolve_includes(PETSC_INCLUDE_DIRS "${PETSC_INCLUDE}")
+  resolve_includes(PETSC_INCLUDE_DIRS "${PETSC_CC_INCLUDES}")
   resolve_libraries(PETSC_LIBRARIES "${PETSC_LIB}")
-  resolve_libraries(PETSC_EXTERNAL_LIBRARIES "${PETSC_EXTERNAL_LIB_BASIC}")
 
   # Add some extra libraries on OSX
   if (APPLE)
 
-    # CMake will have troubel finding the gfortan libraries if compiling
-    # with clang (the libs may be required by 3rd party Fortran libraries)
+    # CMake will have troubel finding the gfortan libraries if
+    # compiling with clang (the libs may be required by 3rd party
+    # Fortran libraries)
     find_program(GFORTRAN_EXECUTABLE gfortran)
     if (GFORTRAN_EXECUTABLE)
       execute_process(COMMAND ${GFORTRAN_EXECUTABLE} -print-file-name=libgfortran.dylib
@@ -191,7 +185,8 @@ show :
       list(APPEND PETSC_EXTERNAL_LIBRARIES ${X11_LIBRARIES})
     endif()
 
-    # ResolveCompilerPaths strips OSX frameworks, so add BLAS here for OSX
+    # ResolveCompilerPaths strips OSX frameworks, so add BLAS here for
+    # OSX
     petsc_get_variable(PETSC_BLASLAPACK_LIB BLASLAPACK_LIB)
     list(APPEND PETSC_EXTERNAL_LIBRARIES ${PETSC_BLASLAPACK_LIB})
 
@@ -220,9 +215,9 @@ elseif (FOUND_PETSC_CONF)
 
   # Add MPI variables if MPI has been found
   if (MPI_C_FOUND)
-    set(CMAKE_REQUIRED_INCLUDES  ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
+    set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
     set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
-    set(CMAKE_REQUIRED_FLAGS     "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
+    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
   endif()
 
   # Check PETSc version
@@ -314,60 +309,16 @@ int main()
     set(PETSC_TEST_RUNS TRUE)
   else()
     message(STATUS "Performing test PETSC_TEST_RUNS - Failed")
-
-    # Test program does not run - try adding PETSc 3rd party libs and test again
-    list(APPEND CMAKE_REQUIRED_LIBRARIES ${PETSC_EXTERNAL_LIBRARIES})
-
-    try_run(
-      PETSC_TEST_3RD_PARTY_LIBS_EXITCODE
-      PETSC_TEST_3RD_PARTY_LIBS_COMPILED
-      ${CMAKE_CURRENT_BINARY_DIR}
-      ${PETSC_TEST_LIB_CPP}
-      CMAKE_FLAGS
-        "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
-	"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
-      COMPILE_OUTPUT_VARIABLE PETSC_TEST_3RD_PARTY_LIBS_COMPILE_OUTPUT
-      RUN_OUTPUT_VARIABLE PETSC_TEST_3RD_PARTY_LIBS_OUTPUT
-      )
-
-    if (PETSC_TEST_3RD_PARTY_LIBS_COMPILED AND PETSC_TEST_3RD_PARTY_LIBS_EXITCODE EQUAL 0)
-      message(STATUS "Performing test PETSC_TEST_3RD_PARTY_LIBS_RUNS - Success")
-      set(PETSC_LIBRARIES ${PETSC_LIBRARIES} ${PETSC_EXTERNAL_LIBRARIES}
-	CACHE STRING "PETSc libraries." FORCE)
-      set(PETSC_TEST_RUNS TRUE)
-    else()
-      message(STATUS "Performing test PETSC_TEST_3RD_PARTY_LIBS_RUNS - Failed")
-    endif()
-  endif()
-
-  # Run test program to check for PETSc Cusp
-  include(CheckCXXSourceRuns)
-  check_cxx_source_runs("
-#include \"petsc.h\"
-int main()
-{
-#if PETSC_HAVE_CUSP
-  return 0;
-#else
-  return 1;
-#endif
-}
-" PETSC_CUSP_FOUND)
-
-  if (PETSC_CUSP_FOUND)
-    message(STATUS "PETSc configured with Cusp support")
-  else()
-    message(STATUS "PETSc configured without Cusp support")
   endif()
 
 endif()
 
 # Check sizeof(PetscInt)
 if (PETSC_INCLUDE_DIRS)
-   include(CheckTypeSize)
-   set(CMAKE_EXTRA_INCLUDE_FILES petsc.h)
-   check_type_size("PetscInt" PETSC_INT_SIZE)
-   set(CMAKE_EXTRA_INCLUDE_FILES)
+  include(CheckTypeSize)
+  set(CMAKE_EXTRA_INCLUDE_FILES petsc.h)
+  check_type_size("PetscInt" PETSC_INT_SIZE)
+  set(CMAKE_EXTRA_INCLUDE_FILES)
 endif()
 
 # Standard package handling
diff --git a/cmake/modules/FindPaStiX.cmake b/cmake/modules/FindPaStiX.cmake
deleted file mode 100644
index be2f60a..0000000
--- a/cmake/modules/FindPaStiX.cmake
+++ /dev/null
@@ -1,159 +0,0 @@
-# - Try to find PaStiX
-# Once done this will define
-#
-#  PASTIX_FOUND        - system has PaStiX
-#  PASTIX_INCLUDE_DIRS - include directories for PaStiX
-#  PASTIX_LIBRARIES    - libraries for PaStiX
-#  PASTIX_VERSION      - the PaStiX version string (MAJOR.MEDIUM.MINOR)
-
-# Check for PaStiX header file
-find_path(PASTIX_INCLUDE_DIR pastix.h
-  HINTS ${PASTIX_DIR}/include $ENV{PASTIX_DIR}/include ${PASTIX_DIR} $ENV{PASTIX_DIR}
-  PATH_SUFFIXES install
-  DOC "Directory where the PaStiX header is located"
- )
-
-set(PASTIX_INCLUDE_DIRS ${PASTIX_INCLUDE_DIR})
-
-# Check for PaStiX library
-find_library(PASTIX_LIBRARY pastix
-  HINTS ${PASTIX_DIR}/lib $ENV{PASTIX_DIR}/lib ${PASTIX_DIR} $ENV{PASTIX_DIR}
-  PATH_SUFFIXES install
-  DOC "The PaStiX library"
-  )
-
-set(PASTIX_LIBRARIES ${PASTIX_LIBRARY})
-
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT APPLE)
-  # Check for rt library
-  find_library(RT_LIBRARY rt
-    DOC "The RT library"
-    )
-  # Check for math library
-  find_library(M_LIBRARY m
-    DOC "The math library"
-    )
-  set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${RT_LIBRARY} ${M_LIBRARY})
-  message(STATUS "PASTIX_LIBRARIES ${PASTIX_LIBRARIES}")
-endif()
-
-# Check for hwloc header
-find_path(HWLOC_INCLUDE_DIRS hwloc.h
-  HINTS ${HWLOC_DIR} $ENV{HWLOC_DIR} ${HWLOC_DIR}/include $ENV{HWLOC_DIR}/include
-  DOC "Directory where the hwloc header is located"
- )
-
-# Check for hwloc library
-find_library(HWLOC_LIBRARY hwloc
-  HINTS ${HWLOC_DIR} $ENV{HWLOC_DIR} ${HWLOC_DIR}/lib $ENV{HWLOC_DIR}/lib
-  DOC "The hwloc library"
-  )
-
-if (HWLOC_LIBRARY)
-  set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${HWLOC_LIBRARY})
-endif()
-
-# Add BLAS libs if BLAS has been found
-set(CMAKE_LIBRARY_PATH ${BLAS_DIR}/lib $ENV{BLAS_DIR}/lib ${CMAKE_LIBRARY_PATH})
-find_package(BLAS)
-set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${BLAS_LIBRARIES})
-
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
-  find_program(GFORTRAN_EXECUTABLE gfortran)
-  if (GFORTRAN_EXECUTABLE)
-    execute_process(COMMAND ${GFORTRAN_EXECUTABLE} -print-file-name=libgfortran.so
-      OUTPUT_VARIABLE GFORTRAN_LIBRARY
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-    if (EXISTS "${GFORTRAN_LIBRARY}")
-      set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${GFORTRAN_LIBRARY})
-    endif()
-  endif()
-endif()
-
-#Find PaStiX version by looking at pastix.h
-if (EXISTS ${PASTIX_INCLUDE_DIR}/pastix.h)
-  file(STRINGS ${PASTIX_INCLUDE_DIR}/pastix.h PASTIX_VERSIONS_TMP
-    REGEX "^#define PASTIX_[A-Z]+_VERSION[ \t]+[0-9]+$")
-  if (PASTIX_VERSIONS_TMP)
-    string(REGEX REPLACE ".*#define PASTIX_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" PASTIX_MAJOR_VERSION ${PASTIX_VERSIONS_TMP})
-    string(REGEX REPLACE ".*#define PASTIX_MEDIUM_VERSION[ \t]+([0-9]+).*" "\\1" PASTIX_MEDIUM_VERSION ${PASTIX_VERSIONS_TMP})
-    string(REGEX REPLACE ".*#define PASTIX_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" PASTIX_MINOR_VERSION ${PASTIX_VERSIONS_TMP})
-    set(PASTIX_VERSION ${PASTIX_MAJOR_VERSION}.${PASTIX_MEDIUM_VERSION}.${PASTIX_MINOR_VERSION} CACHE TYPE STRING)
-  else()
-    set(PASTIX_VERSION "UNKNOWN")
-  endif()
-endif()
-
-if (PaStiX_FIND_VERSION)
-  # Check if version found is >= required version
-  if (NOT "${PASTIX_VERSION}" VERSION_LESS "${PaStiX_FIND_VERSION}")
-    set(PASTIX_VERSION_OK TRUE)
-  endif()
-else()
-  # No specific version requested
-  set(PASTIX_VERSION_OK TRUE)
-endif()
-
-mark_as_advanced(
-  PASTIX_INCLUDE_DIR
-  PASTIX_INCLUDE_DIRS
-  PASTIX_LIBRARY
-  PASTIX_LIBRARIES
-  PASTIX_VERSION
-  )
-
-# Try to run a test program that uses PaStiX
-if (DOLFIN_SKIP_BUILD_TESTS)
-  set(PASTIX_TEST_RUNS TRUE)
-elseif (PASTIX_INCLUDE_DIRS AND PASTIX_LIBRARIES)
-
-  set(CMAKE_REQUIRED_INCLUDES  ${PASTIX_INCLUDE_DIRS})
-  set(CMAKE_REQUIRED_LIBRARIES ${PASTIX_LIBRARIES})
-
- # Add SCOTCH variables if SCOTCH has been found
-  if (SCOTCH_FOUND)
-    set(CMAKE_REQUIRED_INCLUDES  ${CMAKE_REQUIRED_INCLUDES} ${SCOTCH_INCLUDE_DIRS})
-    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SCOTCH_LIBRARIES})
-  endif()
-
-  # Add MPI variables if MPI has been found
-  if (MPI_C_FOUND)
-    set(CMAKE_REQUIRED_INCLUDES  ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
-    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
-    set(CMAKE_REQUIRED_FLAGS     "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
-  endif()
-
-  # Build and run test program
-  include(CheckCSourceRuns)
-  check_c_source_runs("
-/* Test program pastix */
-
-#define MPICH_IGNORE_CXX_SEEK 1
-#include <stdint.h>
-#include <mpi.h>
-#include <pastix.h>
-
-int main()
-{
-  pastix_int_t iparm[IPARM_SIZE];
-  double       dparm[DPARM_SIZE];
-  int i = 0;
-  for (i = 0; i < IPARM_SIZE; ++i)
-    iparm[i] = 0;
-  for (i = 0; i < DPARM_SIZE; ++i)
-    dparm[i] = 0.0;
-
-  // Set default parameters
-  pastix_initParam(iparm, dparm);
-
-  return 0;
-}
-" PASTIX_TEST_RUNS)
-
-endif()
-
-# Standard package handling
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(PASTIX
-  "PaStiX could not be found. Be sure to set PASTIX_DIR."
-  PASTIX_LIBRARIES PASTIX_INCLUDE_DIRS PASTIX_TEST_RUNS PASTIX_VERSION PASTIX_VERSION_OK)
diff --git a/cmake/modules/FindSLEPc.cmake b/cmake/modules/FindSLEPc.cmake
index e8ee82b..9ea52ca 100644
--- a/cmake/modules/FindSLEPc.cmake
+++ b/cmake/modules/FindSLEPc.cmake
@@ -55,7 +55,7 @@ endforeach()
 
 # List of possible locations for SLEPC_DIR
 set(slepc_dir_locations "")
-list(APPEND slepc_dir_locations "/usr/lib/slepcdir/3.4.2")
+list(APPEND slepc_dir_locations "/usr/lib/slepc")
 list(APPEND slepc_dir_locations "/opt/local/lib/petsc")    # Macports
 list(APPEND slepc_dir_locations "/usr/local/lib/slepc")
 list(APPEND slepc_dir_locations "$ENV{HOME}/slepc")
diff --git a/cmake/modules/FindUFC.cmake b/cmake/modules/FindUFC.cmake
new file mode 100644
index 0000000..147da56
--- /dev/null
+++ b/cmake/modules/FindUFC.cmake
@@ -0,0 +1,81 @@
+# - Try to find UFC
+#
+# Once done this will define
+#
+# This module defines
+#
+#  UFC_FOUND        - system has UFC with correct version
+#  UFC_INCLUDE_DIRS - where to find ufc.h
+#  UFC_VERSION      - UFC version
+#  UFC_SIGNATURE    - UFC signature
+
+#=============================================================================
+# Copyright (C) 2010 Johannes Ring
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+execute_process(
+  COMMAND ${PYTHON_EXECUTABLE} -c "import ffc, sys; sys.stdout.write(ffc.get_ufc_include())"
+  OUTPUT_VARIABLE UFC_INCLUDE_DIR
+  )
+
+if (UFC_INCLUDE_DIR)
+  set(UFC_INCLUDE_DIRS ${UFC_INCLUDE_DIR} CACHE STRING "Where to find ufc.h")
+  mark_as_advanced(UFC_INCLUDE_DIRS)
+
+  execute_process(
+    COMMAND ${PYTHON_EXECUTABLE} -c "import ffc, sys; sys.stdout.write(ffc.__version__)"
+    OUTPUT_VARIABLE UFC_VERSION
+    )
+  mark_as_advanced(UFC_VERSION)
+
+  if (UFC_FIND_VERSION)
+    # Check if version found is >= required version
+    if (NOT "${UFC_VERSION}" VERSION_LESS "${UFC_FIND_VERSION}")
+      set(UFC_VERSION_OK TRUE)
+    endif()
+  else()
+    # No specific version requested
+    set(UFC_VERSION_OK TRUE)
+  endif()
+  mark_as_advanced(UFC_VERSION_OK)
+
+  execute_process(
+    COMMAND ${PYTHON_EXECUTABLE} -c "import ffc, sys; sys.stdout.write(ffc.ufc_signature())"
+    OUTPUT_VARIABLE UFC_SIGNATURE
+    )
+  mark_as_advanced(UFC_SIGNATURE)
+
+endif()
+
+# Standard package handling
+find_package_handle_standard_args(UFC
+                                  "UFC could not be found."
+                                  UFC_INCLUDE_DIRS
+                                  UFC_VERSION
+                                  UFC_VERSION_OK
+                                  UFC_SIGNATURE)
diff --git a/cmake/modules/ResolveCompilerPaths.cmake b/cmake/modules/ResolveCompilerPaths.cmake
index 92541e9..54787fa 100644
--- a/cmake/modules/ResolveCompilerPaths.cmake
+++ b/cmake/modules/ResolveCompilerPaths.cmake
@@ -42,8 +42,8 @@ include (CorrectWindowsPaths)
 
 macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
   string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))" _all_tokens "${LINK_LINE}")
-  set (_libs_found)
-  set (_directory_list)
+  set (_libs_found "")
+  set (_directory_list "")
   foreach (token ${_all_tokens})
     if (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
       # If it's a library path, add it to the list
@@ -58,7 +58,7 @@ macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
       else (WIN32)
         string (REGEX REPLACE "^-l" "" token ${token})
       endif (WIN32)
-      set (_root)
+      set (_root "")
       if (token MATCHES "^/")	# We have an absolute path
         #separate into a path and a library name:
         string (REGEX MATCH "[^/]*\\.(a|so|dll|lib)$" libname ${token})
@@ -68,13 +68,7 @@ macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
         set (token ${libname})
       endif (token MATCHES "^/")
       set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
-      # First search only the HINTS paths, then (if nothing was found) CMake's
-      # default paths.
-      find_library (_lib ${token}
-                    HINTS ${_directory_list}
-                    NO_DEFAULT_PATH
-                    ${_root})
-      find_library (_lib ${token} ${_root})
+      find_library (_lib ${token} HINTS ${_directory_list} ${_root})
       if (_lib)
 	string (REPLACE "//" "/" _lib ${_lib})
         list (APPEND _libs_found ${_lib})
@@ -95,7 +89,7 @@ endmacro (RESOLVE_LIBRARIES)
 
 macro (RESOLVE_INCLUDES INCS COMPILE_LINE)
   string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}")
-  set (_incs_found)
+  set (_incs_found "")
   foreach (token ${_all_tokens})
     string (REGEX REPLACE "^-I" "" token ${token})
     string (REGEX REPLACE "//" "/" token ${token})
diff --git a/cmake/scripts/copy-test-demo-data b/cmake/scripts/copy-test-demo-data
index 4054a73..a5b040d 100755
--- a/cmake/scripts/copy-test-demo-data
+++ b/cmake/scripts/copy-test-demo-data
@@ -30,7 +30,7 @@ sub_directories = ['demo', 'test', 'bench']
 
 # Copy all files with the following suffixes
 suffix_patterns = ["py", "h", "cpp", "ufl", "xml", "xml.gz", "off", "inp", \
-                   "msh", "supp", "rst", "ele", "node", "grid", "edge"]
+                   "msh", "supp", "rst", "ele", "node", "grid", "edge", "sh"]
 
 suffix_pattern = re.compile("(%s),"%("|".join("[\w-]+\.%s" % pattern \
                                              for pattern in suffix_patterns)))
diff --git a/cmake/scripts/download-demo-data b/cmake/scripts/download-demo-data
index a42872e..cf9c218 100755
--- a/cmake/scripts/download-demo-data
+++ b/cmake/scripts/download-demo-data
@@ -42,8 +42,6 @@ download_mesh demo/documented/stokes-taylor-hood             dolfin_fine_subdoma
 download_mesh demo/documented/stokes-mini                    dolfin_fine.xml.gz
 download_mesh demo/documented/stokes-mini                    dolfin_fine_subdomains.xml.gz
 download_mesh demo/documented/subdomains                     dolfin_fine.xml.gz
-download_mesh demo/documented/stokes-stabilized              dolfin_fine.xml.gz
-download_mesh demo/documented/stokes-stabilized              dolfin_fine_subdomains.xml.gz
 download_mesh demo/documented/bcs                            aneurysm.xml.gz
 download_mesh demo/documented/navier-stokes                  lshape.xml.gz
 download_mesh demo/undocumented/buckling-tao                 buckling.xml.gz
diff --git a/cmake/scripts/generate-cmakefiles b/cmake/scripts/generate-cmakefiles
index 23b209f..c991ac8 100755
--- a/cmake/scripts/generate-cmakefiles
+++ b/cmake/scripts/generate-cmakefiles
@@ -40,33 +40,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 %(executables)s
 
@@ -79,16 +78,14 @@ target_link_libraries_str = "target_link_libraries(%s "\
                             "${DOLFIN_LIBRARIES})"
 
 # Subdirectories
-sub_directories = ['demo', 'test', 'bench']
+sub_directories = ['demo', 'bench']
 
 # Prefix map for subdirectories
-executable_prefixes = dict(test="test_",
-                           demo="demo_",
+executable_prefixes = dict(demo="demo_",
                            bench="bench_")
 
 # Main file name map for subdirectories
-main_file_names = dict(test="test.cpp",
-                       demo="main.cpp",
+main_file_names = dict(demo="main.cpp",
                        bench="main.cpp")
 
 # Projects that use custom CMakeLists.txt (shouldn't overwrite)
diff --git a/cmake/scripts/generate-form-files b/cmake/scripts/generate-form-files
index ac628a9..2135f75 100755
--- a/cmake/scripts/generate-form-files
+++ b/cmake/scripts/generate-form-files
@@ -73,7 +73,7 @@ for subdir in subdirs:
             if f in skip_basis:
                 options += " -fno-evaluate_basis -fno-evaluate_basis_derivatives"
 
-            command = "ffc -v %s -f no_ferari -l dolfin %s %s >> compile.log" % (optimization, options, f)
+            command = "ffc -v %s -l dolfin %s %s >> compile.log" % (optimization, options, f)
             print("  " + command)
             ret = os.system(command)
             if not ret == 0:
diff --git a/cmake/templates/UseDOLFIN.cmake.in b/cmake/templates/UseDOLFIN.cmake.in
index 02aeb93..d4a8c10 100644
--- a/cmake/templates/UseDOLFIN.cmake.in
+++ b/cmake/templates/UseDOLFIN.cmake.in
@@ -11,7 +11,12 @@ if (NOT DOLFIN_USE_FILE_INCLUDED)
   # Need to get VTK config because VTK uses advanced VTK features
   # which mean it's not enough to just link to the DOLFIN target. See
   # http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-  find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
+  if (@VTK_FOUND@)
+    find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
+    if (VTK_FOUND)
+      include(${VTK_USE_FILE})
+    endif()
+  endif()
 
   # Add compiler definitions needed to use DOLFIN
   add_definitions(${DOLFIN_CXX_DEFINITIONS})
diff --git a/cmake/templates/dolfin.conf.in b/cmake/templates/dolfin.conf.in
index f08a0ca..da5d33f 100644
--- a/cmake/templates/dolfin.conf.in
+++ b/cmake/templates/dolfin.conf.in
@@ -7,6 +7,8 @@ export PKG_CONFIG_PATH=@CMAKE_INSTALL_PREFIX@/@DOLFIN_PKGCONFIG_DIR@:$PKG_CONFIG
 export PYTHONPATH=@DOLFIN_INSTALL_PYTHON_MODULE_DIR@:@DOLFIN_INSTALL_PYTHON_PURE_MODULE_DIR@:$PYTHONPATH
 export MANPATH=@CMAKE_INSTALL_PREFIX@/@DOLFIN_MAN_DIR@:$MANPATH
 
+# Helper to find VTK if not installed in a system path
+export @OS_LIBRARY_PATH_NAME@=@VTK_INSTALL_PREFIX@/lib:$@OS_LIBRARY_PATH_NAME@
+
 # Special Mac variables
 export DYLD_FRAMEWORK_PATH=/opt/local/Library/Frameworks:$DYLD_FRAMEWORK_PATH
-
diff --git a/demo/README b/demo/README
new file mode 100644
index 0000000..6706580
--- /dev/null
+++ b/demo/README
@@ -0,0 +1,58 @@
+Documenting DOLFIN demos
+========================
+
+The documentation for the DOLFIN demos is written by hand and located
+together with the demos in the DOLFIN source tree. To document a (new)
+DOLFIN demo located in the directory foo (for instance pde/poisson),
+follow the two steps below. In general, the simplest way is probably
+to look at one of the documented demos for instance
+(demo/pde/poisson/) and follow the same setup.
+
+1) Add these 3 files
+
+  * foo/common.txt -- containing common information such as the main
+    features the demo illustrates and, if applicable, a mathematical
+    description of the differential equation that is solved. This file
+    should then be included in the C++ and Python versions.
+
+  * foo/cpp/documentation.rst -- containing the reST source file with
+    the documentation that is specific to the C++ version of the demo.
+
+  * foo/python/documentation.rst -- containing the reST source file
+    with the documentation that is specific to the Python version of
+    the demo.
+
+   If either the C++ or the Python version of the demo does not exist,
+   feel free to add the version and continue.
+
+2) Move the directory foo from the directory undocumented/ to the
+   suitable directory (for instance pde/ or la/).
+
+
+Note
+
+   The demo documentation is automatically included in the complete
+   DOLFIN documentation when running make doc after building
+   DOLFIN. While documenting a demo, it may be handy to only run
+   make doc_demo and then make doc_html_[python|cpp].
+
+Note
+
+   Tests for the validity of the code snippets used in the demo
+   documentation are included in the standard DOLFIN tests.
+
+C++ and Python specific contents
+================================
+
+The C++ and Python documentation reST source files should
+
+* Explain each step of the solution procedure. Do this by including
+  and explaining code snippets from the demo source code.
+
+* Include links to the API documentation using the :cpp:class: and
+  :py:class: directives. Note that for the Python classes, the
+  full module path is required (for instance
+  py:class:dolfin.cpp.NewtonSolver)
+
+* Include the complete set of files needed to run the demo using the
+  include directive.
diff --git a/demo/documented/auto-adaptive-poisson/cpp/AdaptivePoisson.h b/demo/documented/auto-adaptive-poisson/cpp/AdaptivePoisson.h
index 8e63b77..ce04a6f 100644
--- a/demo/documented/auto-adaptive-poisson/cpp/AdaptivePoisson.h
+++ b/demo/documented/auto-adaptive-poisson/cpp/AdaptivePoisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,388 +13,106 @@
 //   error_control:                  True
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __ADAPTIVEPOISSON_H
 #define __ADAPTIVEPOISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class adaptivepoisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   adaptivepoisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_finite_element_0()
+  ~adaptivepoisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivepoisson_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivepoisson_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivepoisson_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivepoisson_finite_element_1()
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 6;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -403,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -418,33 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -454,33 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -490,141 +192,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -634,48 +220,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -695,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -716,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -754,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -776,81 +358,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -865,9 +427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -877,11 +439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -891,11 +453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -904,9 +466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -927,81 +489,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1016,9 +558,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1028,11 +570,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1042,11 +584,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1055,9 +597,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1078,81 +620,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1167,9 +689,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1179,11 +701,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1193,11 +715,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1206,9 +728,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1225,762 +747,561 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 4:
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivepoisson_finite_element_0();
+  }
+
+};
+
+
+class adaptivepoisson_finite_element_1: public ufc::finite_element
+{
+public:
+
+  adaptivepoisson_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivepoisson_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivepoisson_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivepoisson_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivepoisson_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_finite_element_2()
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Bubble', Domain(Cell('triangle', 2)), 3, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 1;
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
   {
-    return 0;
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    return 1;
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
   {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1989,144 +1310,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-    
-    // Declare helper variables
-    double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-    double tmp1 = (1.0 - Y)/2.0;
-    double tmp2 = tmp1*tmp1;
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    basisvalues[1] = tmp0;
-    basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-    basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-    basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-    basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-    basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-    basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-    basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-    basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-    basisvalues[0] *= std::sqrt(0.5);
-    basisvalues[2] *= std::sqrt(1.0);
-    basisvalues[5] *= std::sqrt(1.5);
-    basisvalues[9] *= std::sqrt(2.0);
-    basisvalues[1] *= std::sqrt(3.0);
-    basisvalues[4] *= std::sqrt(4.5);
-    basisvalues[8] *= std::sqrt(6.0);
-    basisvalues[3] *= std::sqrt(7.5);
-    basisvalues[7] *= std::sqrt(10.0);
-    basisvalues[6] *= std::sqrt(14.0);
-    
-    // Table(s) of coefficients
-    static const double coefficients0[10] = \
-    {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[8][3];
-    for (unsigned int row = 0; row < 8; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 3; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -2153,7 +1348,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[8][8];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -2169,395 +1364,140 @@ public:
           transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
     }
-    
-    // Array of basisvalues
-    double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-    
-    // Declare helper variables
-    double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-    double tmp1 = (1.0 - Y)/2.0;
-    double tmp2 = tmp1*tmp1;
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    basisvalues[1] = tmp0;
-    basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-    basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-    basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-    basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-    basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-    basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-    basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-    basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-    basisvalues[0] *= std::sqrt(0.5);
-    basisvalues[2] *= std::sqrt(1.0);
-    basisvalues[5] *= std::sqrt(1.5);
-    basisvalues[9] *= std::sqrt(2.0);
-    basisvalues[1] *= std::sqrt(3.0);
-    basisvalues[4] *= std::sqrt(4.5);
-    basisvalues[8] *= std::sqrt(6.0);
-    basisvalues[3] *= std::sqrt(7.5);
-    basisvalues[7] *= std::sqrt(10.0);
-    basisvalues[6] *= std::sqrt(14.0);
-    
-    // Table(s) of coefficients
-    static const double coefficients0[10] = \
-    {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-    
-    // Tables of derivatives of the polynomial base (transpose).
-    static const double dmats0[10][10] = \
-    {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-    
-    static const double dmats1[10][10] = \
-    {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-    {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-    {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-    {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-    
-    // Compute reference derivatives.
-    // Declare array of derivatives on FIAT element.
-    double derivatives[8];
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      derivatives[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Declare derivative matrix (of polynomial basis).
-    double dmats[10][10] = \
-    {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-    
-    // Declare (auxiliary) derivative matrix (of polynomial basis).
-    double dmats_old[10][10] = \
-    {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-    
-    // Loop possible derivatives.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    switch (i)
     {
-      // Resetting dmats values to compute next derivative.
-      for (unsigned int t = 0; t < 10; t++)
+    case 0:
       {
-        for (unsigned int u = 0; u < 10; u++)
-        {
-          dmats[t][u] = 0.0;
-          if (t == u)
-          {
-          dmats[t][u] = 1.0;
-          }
-          
-        } // end loop over 'u'
-      } // end loop over 't'
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Looping derivative order to generate dmats.
-      for (unsigned int s = 0; s < n; s++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        // Updating dmats_old with new values and resetting dmats.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats_old[t][u] = dmats[t][u];
-            dmats[t][u] = 0.0;
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Update dmats using an inner product.
-        if (combinations[r][s] == 0)
-        {
-        for (unsigned int t = 0; t < 10; t++)
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
-            for (unsigned int tu = 0; tu < 10; tu++)
+            dmats[t][u] = 0.0;
+            if (t == u)
             {
-              dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-            } // end loop over 'tu'
+            dmats[t][u] = 1.0;
+            }
+            
           } // end loop over 'u'
         } // end loop over 't'
-        }
         
-        if (combinations[r][s] == 1)
-        {
-        for (unsigned int t = 0; t < 10; t++)
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int tu = 0; tu < 10; tu++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-            } // end loop over 'tu'
-          } // end loop over 'u'
-        } // end loop over 't'
-        }
-        
-      } // end loop over 's'
-      for (unsigned int s = 0; s < 10; s++)
-      {
-        for (unsigned int t = 0; t < 10; t++)
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
         {
-          derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-        } // end loop over 't'
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // Transform derivatives back to physical element
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r] += transform[r][s]*derivatives[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = 0;
-    vertex_values[1] = 0;
-    vertex_values[2] = 0;
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivepoisson_finite_element_2();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivepoisson_finite_element_3: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivepoisson_finite_element_3() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivepoisson_finite_element_3()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 1:
       {
         
       // Array of basisvalues
@@ -2576,233 +1516,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[3][3] = \
@@ -2914,7 +1628,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 2:
       {
         
       // Array of basisvalues
@@ -2933,7 +1647,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[3][3] = \
@@ -3045,7 +1759,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 3:
       {
         
       // Array of basisvalues
@@ -3064,7 +1778,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[3][3] = \
@@ -3171,510 +1885,270 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivepoisson_finite_element_3();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivepoisson_finite_element_4: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivepoisson_finite_element_4() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivepoisson_finite_element_4()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 6;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
         
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
@@ -3682,50 +2156,28 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
   {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
     
     // Compute number of derivatives.
     unsigned int num_derivatives = 1;
@@ -3734,28 +2186,304 @@ public:
       num_derivatives *= 2;
     } // end loop over 'r'
     
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
     {
-      values[r] = 0.0;
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
     } // end loop over 'r'
     
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
       return ;
     }
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
     {
-    return ;
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivepoisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivepoisson_finite_element_0();
+        break;
+      }
     }
     
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+};
+
+
+class adaptivepoisson_finite_element_2: public ufc::finite_element
+{
+public:
+
+  adaptivepoisson_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivepoisson_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3764,63 +2492,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
+    // Reset values
+    *values = 0.0;
+    switch (i)
     {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
+    case 0:
       {
         
       // Array of basisvalues
@@ -3849,125 +2532,10 @@ public:
       static const double coefficients0[6] = \
       {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -4000,125 +2568,10 @@ public:
       static const double coefficients0[6] = \
       {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -4151,125 +2604,10 @@ public:
       static const double coefficients0[6] = \
       {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -4302,125 +2640,10 @@ public:
       static const double coefficients0[6] = \
       {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -4453,29 +2676,239 @@ public:
       static const double coefficients0[6] = \
       {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
@@ -4575,7 +3008,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 1:
       {
         
       // Array of basisvalues
@@ -4602,7 +3035,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -4618,7 +3051,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4726,613 +3159,85 @@ public:
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivepoisson_finite_element_4();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivepoisson_finite_element_5: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivepoisson_finite_element_5() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivepoisson_finite_element_5()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5347,9 +3252,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5359,11 +3264,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5373,11 +3278,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5386,9 +3291,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5405,65 +3310,85 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5478,9 +3403,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5490,11 +3415,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5504,11 +3429,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5517,9 +3442,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5536,65 +3461,85 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5609,9 +3554,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5621,11 +3566,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5635,268 +3580,3981 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivepoisson_finite_element_2();
+  }
+
+};
+
+
+class adaptivepoisson_finite_element_3: public ufc::finite_element
+{
+public:
+
+  adaptivepoisson_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivepoisson_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivepoisson_finite_element_3();
+  }
+
+};
+
+
+class adaptivepoisson_finite_element_4: public ufc::finite_element
+{
+public:
+
+  adaptivepoisson_finite_element_4() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivepoisson_finite_element_4() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', triangle, 1)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivepoisson_finite_element_4();
+  }
+
+};
+
+
+class adaptivepoisson_finite_element_5: public ufc::finite_element
+{
+public:
+
+  adaptivepoisson_finite_element_5() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivepoisson_finite_element_5() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', triangle, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivepoisson_finite_element_5();
+  }
+
+};
+
+
+class adaptivepoisson_finite_element_6: public ufc::finite_element
+{
+public:
+
+  adaptivepoisson_finite_element_6() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivepoisson_finite_element_6() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Bubble', triangle, 3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Bubble";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+    
+    // Declare helper variables
+    double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+    double tmp1 = (1.0 - Y)/2.0;
+    double tmp2 = tmp1*tmp1;
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    basisvalues[1] = tmp0;
+    basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+    basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+    basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+    basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+    basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+    basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+    basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+    basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+    basisvalues[0] *= std::sqrt(0.5);
+    basisvalues[2] *= std::sqrt(1.0);
+    basisvalues[5] *= std::sqrt(1.5);
+    basisvalues[9] *= std::sqrt(2.0);
+    basisvalues[1] *= std::sqrt(3.0);
+    basisvalues[4] *= std::sqrt(4.5);
+    basisvalues[8] *= std::sqrt(6.0);
+    basisvalues[3] *= std::sqrt(7.5);
+    basisvalues[7] *= std::sqrt(10.0);
+    basisvalues[6] *= std::sqrt(14.0);
+    
+    // Table(s) of coefficients
+    static const double coefficients0[10] = \
+    {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 3)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[8][3];
+    for (unsigned int row = 0; row < 8; row++)
+    {
+      for (unsigned int col = 0; col < 3; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[8][8];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    
+    // Array of basisvalues
+    double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+    
+    // Declare helper variables
+    double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+    double tmp1 = (1.0 - Y)/2.0;
+    double tmp2 = tmp1*tmp1;
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    basisvalues[1] = tmp0;
+    basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+    basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+    basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+    basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+    basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+    basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+    basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+    basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+    basisvalues[0] *= std::sqrt(0.5);
+    basisvalues[2] *= std::sqrt(1.0);
+    basisvalues[5] *= std::sqrt(1.5);
+    basisvalues[9] *= std::sqrt(2.0);
+    basisvalues[1] *= std::sqrt(3.0);
+    basisvalues[4] *= std::sqrt(4.5);
+    basisvalues[8] *= std::sqrt(6.0);
+    basisvalues[3] *= std::sqrt(7.5);
+    basisvalues[7] *= std::sqrt(10.0);
+    basisvalues[6] *= std::sqrt(14.0);
+    
+    // Table(s) of coefficients
+    static const double coefficients0[10] = \
+    {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+    
+    // Tables of derivatives of the polynomial base (transpose).
+    static const double dmats0[10][10] = \
+    {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+    
+    static const double dmats1[10][10] = \
+    {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+    {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+    {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+    {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+    
+    // Compute reference derivatives.
+    // Declare array of derivatives on FIAT element.
+    double derivatives[8];
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      derivatives[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Declare derivative matrix (of polynomial basis).
+    double dmats[10][10] = \
+    {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+    
+    // Declare (auxiliary) derivative matrix (of polynomial basis).
+    double dmats_old[10][10] = \
+    {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+    
+    // Loop possible derivatives.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      // Resetting dmats values to compute next derivative.
+      for (unsigned int t = 0; t < 10; t++)
+      {
+        for (unsigned int u = 0; u < 10; u++)
+        {
+          dmats[t][u] = 0.0;
+          if (t == u)
+          {
+          dmats[t][u] = 1.0;
+          }
+          
+        } // end loop over 'u'
+      } // end loop over 't'
+      
+      // Looping derivative order to generate dmats.
+      for (unsigned int s = 0; s < n; s++)
+      {
+        // Updating dmats_old with new values and resetting dmats.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats_old[t][u] = dmats[t][u];
+            dmats[t][u] = 0.0;
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Update dmats using an inner product.
+        if (combinations[r][s] == 0)
+        {
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int tu = 0; tu < 10; tu++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+              dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+            } // end loop over 'tu'
+          } // end loop over 'u'
+        } // end loop over 't'
+        }
+        
+        if (combinations[r][s] == 1)
         {
-          for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
           {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+            for (unsigned int tu = 0; tu < 10; tu++)
+            {
+              dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+            } // end loop over 'tu'
+          } // end loop over 'u'
+        } // end loop over 't'
+        }
+        
+      } // end loop over 's'
+      for (unsigned int s = 0; s < 10; s++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
+          derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+        } // end loop over 't'
+      } // end loop over 's'
+    } // end loop over 'r'
     
+    // Transform derivatives back to physical element
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r] += transform[r][s]*derivatives[s];
+      } // end loop over 's'
+    } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
     }
     
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
     
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = 0;
+    vertex_values[1] = 0;
+    vertex_values[2] = 0;
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivepoisson_finite_element_6();
+  }
+
+};
+
+
+class adaptivepoisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  adaptivepoisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~adaptivepoisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    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;
+      }
+    }
+    
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
     
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new adaptivepoisson_finite_element_5();
+    return new adaptivepoisson_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class adaptivepoisson_dofmap_0: public ufc::dofmap
+class adaptivepoisson_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  adaptivepoisson_dofmap_0() : ufc::dofmap()
+  adaptivepoisson_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_dofmap_0()
+  ~adaptivepoisson_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -5906,7 +7564,7 @@ public:
       }
     case 2:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -5914,45 +7572,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[2];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 2;
         break;
       }
     case 1:
@@ -5962,7 +7609,7 @@ public:
       }
     case 2:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -5970,42 +7617,56 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[2][0];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6016,7 +7677,33 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -6026,89 +7713,82 @@ public:
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivepoisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivepoisson_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new adaptivepoisson_dofmap_0();
+    return new adaptivepoisson_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class adaptivepoisson_dofmap_1: public ufc::dofmap
+class adaptivepoisson_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  adaptivepoisson_dofmap_1() : ufc::dofmap()
+  adaptivepoisson_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_dofmap_1()
+  ~adaptivepoisson_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -6116,55 +7796,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 6*num_global_entities[2];
+    return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
       {
-        return 0;
+        return 1;
         break;
       }
     case 2:
       {
-        return 6;
+        return 0;
         break;
       }
     }
@@ -6172,47 +7841,53 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 6*c.entity_indices[2][0];
-    dofs[1] = 6*c.entity_indices[2][0] + 1;
-    dofs[2] = 6*c.entity_indices[2][0] + 2;
-    dofs[3] = 6*c.entity_indices[2][0] + 3;
-    dofs[4] = 6*c.entity_indices[2][0] + 4;
-    dofs[5] = 6*c.entity_indices[2][0] + 5;
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 4;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 5;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6223,98 +7898,108 @@ public:
     {
     case 0:
       {
-        
-        break;
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
       }
-    case 1:
+      
+      switch (i)
       {
-        
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
-    case 2:
+    case 1:
       {
-        if (i > 0)
+        if (i > 2)
       {
-      throw std::runtime_error("i is larger than number of entities (0)");
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+          break;
+        }
       }
       
-      dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 3;
-      dofs[4] = 4;
-      dofs[5] = 5;
+        break;
+      }
+    case 2:
+      {
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new adaptivepoisson_dofmap_1();
+    return new adaptivepoisson_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class adaptivepoisson_dofmap_2: public ufc::dofmap
+class adaptivepoisson_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  adaptivepoisson_dofmap_2() : ufc::dofmap()
+  adaptivepoisson_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_dofmap_2()
+  ~adaptivepoisson_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Bubble', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6338,39 +8023,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[2];
+    return 6*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6386,7 +8060,7 @@ public:
       }
     case 2:
       {
-        return 1;
+        return 6;
         break;
       }
     }
@@ -6394,17 +8068,20 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[2][0];
+    dofs[0] = 6*entity_indices[2][0];
+    dofs[1] = 6*entity_indices[2][0] + 1;
+    dofs[2] = 6*entity_indices[2][0] + 2;
+    dofs[3] = 6*entity_indices[2][0] + 3;
+    dofs[4] = 6*entity_indices[2][0] + 4;
+    dofs[5] = 6*entity_indices[2][0] + 5;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6427,9 +8104,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6456,67 +8132,56 @@ public:
       }
       
       dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 3;
+      dofs[4] = 4;
+      dofs[5] = 5;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new adaptivepoisson_dofmap_2();
+    return new adaptivepoisson_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class adaptivepoisson_dofmap_3: public ufc::dofmap
+class adaptivepoisson_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  adaptivepoisson_dofmap_3() : ufc::dofmap()
+  adaptivepoisson_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_dofmap_3()
+  ~adaptivepoisson_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6540,39 +8205,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6596,19 +8250,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 3*c.entity_indices[2][0];
-    dofs[1] = 3*c.entity_indices[2][0] + 1;
-    dofs[2] = 3*c.entity_indices[2][0] + 2;
+    dofs[0] = 3*entity_indices[2][0];
+    dofs[1] = 3*entity_indices[2][0] + 1;
+    dofs[2] = 3*entity_indices[2][0] + 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6631,9 +8283,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6668,81 +8319,61 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new adaptivepoisson_dofmap_3();
+    return new adaptivepoisson_dofmap_4();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class adaptivepoisson_dofmap_4: public ufc::dofmap
+class adaptivepoisson_dofmap_5: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  adaptivepoisson_dofmap_4() : ufc::dofmap()
+  adaptivepoisson_dofmap_5() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_dofmap_4()
+  ~adaptivepoisson_dofmap_5() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -6750,55 +8381,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0] + num_global_entities[1];
+    return num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 6;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 0;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -6806,56 +8426,39 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    dofs[0] = entity_indices[2][0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 4;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 5;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6866,140 +8469,73 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new adaptivepoisson_dofmap_4();
+    return new adaptivepoisson_dofmap_5();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class adaptivepoisson_dofmap_5: public ufc::dofmap
+class adaptivepoisson_dofmap_6: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  adaptivepoisson_dofmap_5() : ufc::dofmap()
+  adaptivepoisson_dofmap_6() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_dofmap_5()
+  ~adaptivepoisson_dofmap_6() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Bubble', triangle, 3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -7009,7 +8545,7 @@ public:
       }
     case 2:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -7017,45 +8553,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
+    return num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 0;
         break;
       }
     case 1:
@@ -7065,7 +8590,7 @@ public:
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -7073,47 +8598,39 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[2][0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -7124,30 +8641,7 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -7157,77 +8651,61 @@ public:
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new adaptivepoisson_dofmap_5();
+    return new adaptivepoisson_dofmap_6();
   }
 
 };
 
-/// 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 adaptivepoisson_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_0_otherwise()
+  ~adaptivepoisson_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
@@ -7236,7 +8714,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -7266,38 +8744,31 @@ public:
 
 };
 
-/// 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 adaptivepoisson_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_1_otherwise()
+  ~adaptivepoisson_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    0
@@ -7306,7 +8777,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -7327,42 +8798,35 @@ public:
 
 };
 
-/// 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 adaptivepoisson_cell_integral_2_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_2_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_2_otherwise()
+  ~adaptivepoisson_cell_integral_2_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -7414,11 +8878,11 @@ public:
     {0.209607191730006, -0.0852599980736871, -0.124347193656319, 0.101159138711827, 0.611401985706872, 0.287438875581301}};
     
     static const double FE1_D01[6][5] = \
-    {{0.563843963708487, -0.0722665257878746, 2.63611048949635, -0.491577437920605, -2.63611048949637},
-    {0.0722665257878714, -0.563843963708491, 2.63611048949635, 0.491577437920627, -2.63611048949637},
+    {{0.563843963708487, -0.0722665257878746, 2.63611048949635, -0.491577437920606, -2.63611048949637},
+    {0.0722665257878714, -0.563843963708491, 2.63611048949635, 0.491577437920626, -2.63611048949637},
     {0.563843963708487, 1.63611048949637, 0.927733474212109, -2.19995445320485, -0.927733474212123},
     {-1.63611048949637, -0.563843963708491, 0.927733474212113, 2.19995445320487, -0.927733474212124},
-    {0.0722665257878706, 1.63611048949637, 0.436156036291493, -1.70837701528423, -0.436156036291507},
+    {0.0722665257878707, 1.63611048949637, 0.436156036291494, -1.70837701528424, -0.436156036291506},
     {-1.63611048949637, -0.0722665257878746, 0.436156036291497, 1.70837701528425, -0.436156036291507}};
     
     // Array of non-zero columns
@@ -7427,9 +8891,9 @@ public:
     static const double FE1_D10[6][5] = \
     {{0.563843963708494, 1.63611048949637, 0.927733474212122, -0.927733474212122, -2.19995445320486},
     {0.072266525787878, 1.63611048949637, 0.436156036291507, -0.436156036291507, -1.70837701528425},
-    {0.563843963708492, -0.0722665257878761, 2.63611048949636, -2.63611048949636, -0.491577437920616},
+    {0.563843963708492, -0.0722665257878757, 2.63611048949636, -2.63611048949636, -0.491577437920617},
     {-1.63611048949637, -0.0722665257878778, 0.436156036291507, -0.436156036291507, 1.70837701528425},
-    {0.0722665257878751, -0.563843963708493, 2.63611048949636, -2.63611048949636, 0.491577437920617},
+    {0.0722665257878754, -0.563843963708493, 2.63611048949636, -2.63611048949636, 0.491577437920617},
     {-1.63611048949637, -0.563843963708494, 0.927733474212122, -0.927733474212122, 2.19995445320486}};
     
     // Array of non-zero columns
@@ -7499,39 +8963,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivepoisson_exterior_facet_integral_2_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_exterior_facet_integral_2_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_exterior_facet_integral_2_otherwise()
+  ~adaptivepoisson_exterior_facet_integral_2_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    13
@@ -7540,7 +8997,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -7553,8 +9010,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -7593,38 +9050,31 @@ public:
 
 };
 
-/// 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 adaptivepoisson_cell_integral_3_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_3_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_3_otherwise()
+  ~adaptivepoisson_cell_integral_3_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    1
@@ -7633,7 +9083,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -7660,42 +9110,35 @@ public:
 
 };
 
-/// 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 adaptivepoisson_cell_integral_4_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_4_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_4_otherwise()
+  ~adaptivepoisson_cell_integral_4_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -7736,7 +9179,7 @@ public:
     
     static const double FE0_D10[7][1] = \
     {{0.0},
-    {-1.90376021590477},
+    {-1.90376021590478},
     {0.0},
     {1.90376021590477},
     {5.20988266488437},
@@ -7847,39 +9290,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivepoisson_exterior_facet_integral_4_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_exterior_facet_integral_4_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_exterior_facet_integral_4_otherwise()
+  ~adaptivepoisson_exterior_facet_integral_4_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      4
     // Number of operations (multiply-add pairs) for geometry tensor:    0
@@ -7888,7 +9324,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -7933,39 +9369,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivepoisson_exterior_facet_integral_5_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_exterior_facet_integral_5_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_exterior_facet_integral_5_otherwise()
+  ~adaptivepoisson_exterior_facet_integral_5_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    6
@@ -7974,7 +9403,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -7987,8 +9416,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -8048,42 +9477,35 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// interior facet tensor corresponding to the local contribution to
-/// a form from the integral over an interior facet.
 
 class adaptivepoisson_interior_facet_integral_5_otherwise: public ufc::interior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_interior_facet_integral_5_otherwise() : ufc::interior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_interior_facet_integral_5_otherwise()
+  ~adaptivepoisson_interior_facet_integral_5_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local interior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates_0,
-                               const double*  vertex_coordinates_1,
-                               std::size_t facet_0,
-                               std::size_t facet_1,
-                               int cell_orientation_0,
-                               int cell_orientation_1) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs_0,
+                       const double * coordinate_dofs_1,
+                       std::size_t facet_0,
+                       std::size_t facet_1,
+                       int cell_orientation_0,
+                       int cell_orientation_1) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      12
     // Number of operations (multiply-add pairs) for geometry tensor:    12
@@ -8092,7 +9514,7 @@ public:
     
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -8101,7 +9523,7 @@ public:
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -8114,8 +9536,8 @@ public:
     const unsigned int v1 = edge_vertices[facet_0][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates_0[2*v1 + 0] - vertex_coordinates_0[2*v0 + 0];
-    const double dx1 = vertex_coordinates_0[2*v1 + 1] - vertex_coordinates_0[2*v0 + 1];
+    const double dx0 = coordinate_dofs_0[2*v1 + 0] - coordinate_dofs_0[2*v0 + 0];
+    const double dx1 = coordinate_dofs_0[2*v1 + 1] - coordinate_dofs_0[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -8527,42 +9949,35 @@ public:
 
 };
 
-/// 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 adaptivepoisson_cell_integral_6_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_6_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_6_otherwise()
+  ~adaptivepoisson_cell_integral_6_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -8615,8 +10030,8 @@ public:
     
     static const double FE2_D01[6][5] = \
     {{0.633695145960915, -0.633695145960916, 3.26739029192182, 0.0, -3.26739029192184},
-    {0.633695145960915, 2.26739029192184, 0.366304854039066, -2.90108543788275, -0.366304854039082},
-    {-2.26739029192184, -0.633695145960916, 0.366304854039073, 2.90108543788276, -0.366304854039083},
+    {0.633695145960915, 2.26739029192184, 0.366304854039068, -2.90108543788275, -0.366304854039081},
+    {-2.26739029192184, -0.633695145960916, 0.366304854039074, 2.90108543788276, -0.366304854039083},
     {-0.783793963663865, 0.783793963663862, 0.432412072672267, 0.0, -0.432412072672279},
     {-0.783793963663864, -0.567587927327719, 1.78379396366385, 1.35138189099159, -1.78379396366386},
     {0.567587927327715, 0.783793963663862, 1.78379396366385, -1.35138189099157, -1.78379396366386}};
@@ -8625,8 +10040,8 @@ public:
     static const unsigned int nzc2[5] = {0, 2, 3, 4, 5};
     
     static const double FE2_D10[6][5] = \
-    {{0.633695145960923, 2.26739029192184, 0.366304854039083, -0.366304854039083, -2.90108543788276},
-    {0.633695145960919, -0.633695145960917, 3.26739029192183, -3.26739029192183, 0.0},
+    {{0.633695145960922, 2.26739029192184, 0.366304854039083, -0.366304854039083, -2.90108543788276},
+    {0.63369514596092, -0.633695145960917, 3.26739029192183, -3.26739029192183, 0.0},
     {-2.26739029192183, -0.633695145960919, 0.366304854039083, -0.366304854039083, 2.90108543788275},
     {-0.78379396366386, -0.567587927327721, 1.78379396366386, -1.78379396366386, 1.35138189099158},
     {-0.783793963663859, 0.783793963663859, 0.432412072672279, -0.432412072672279, 0.0},
@@ -8722,39 +10137,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivepoisson_exterior_facet_integral_6_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_exterior_facet_integral_6_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_exterior_facet_integral_6_otherwise()
+  ~adaptivepoisson_exterior_facet_integral_6_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true, false, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    22
@@ -8763,7 +10171,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -8776,8 +10184,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -8828,38 +10236,31 @@ public:
 
 };
 
-/// 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 adaptivepoisson_cell_integral_7_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_7_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_7_otherwise()
+  ~adaptivepoisson_cell_integral_7_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    40
@@ -8868,7 +10269,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -8913,39 +10314,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivepoisson_exterior_facet_integral_7_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_exterior_facet_integral_7_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_exterior_facet_integral_7_otherwise()
+  ~adaptivepoisson_exterior_facet_integral_7_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    27
@@ -8954,7 +10348,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -8967,8 +10361,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -9016,42 +10410,35 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// interior facet tensor corresponding to the local contribution to
-/// a form from the integral over an interior facet.
 
 class adaptivepoisson_interior_facet_integral_7_otherwise: public ufc::interior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_interior_facet_integral_7_otherwise() : ufc::interior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_interior_facet_integral_7_otherwise()
+  ~adaptivepoisson_interior_facet_integral_7_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local interior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates_0,
-                               const double*  vertex_coordinates_1,
-                               std::size_t facet_0,
-                               std::size_t facet_1,
-                               int cell_orientation_0,
-                               int cell_orientation_1) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs_0,
+                       const double * coordinate_dofs_1,
+                       std::size_t facet_0,
+                       std::size_t facet_1,
+                       int cell_orientation_0,
+                       int cell_orientation_1) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      12
     // Number of operations (multiply-add pairs) for geometry tensor:    108
@@ -9060,7 +10447,7 @@ public:
     
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -9069,7 +10456,7 @@ public:
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -9082,8 +10469,8 @@ public:
     const unsigned int v1 = edge_vertices[facet_0][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates_0[2*v1 + 0] - vertex_coordinates_0[2*v0 + 0];
-    const double dx1 = vertex_coordinates_0[2*v1 + 1] - vertex_coordinates_0[2*v0 + 1];
+    const double dx0 = coordinate_dofs_0[2*v1 + 0] - coordinate_dofs_0[2*v0 + 0];
+    const double dx1 = coordinate_dofs_0[2*v1 + 1] - coordinate_dofs_0[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -9249,38 +10636,31 @@ public:
 
 };
 
-/// 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 adaptivepoisson_cell_integral_8_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_8_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_8_otherwise()
+  ~adaptivepoisson_cell_integral_8_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
@@ -9289,7 +10669,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -9319,38 +10699,31 @@ public:
 
 };
 
-/// 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 adaptivepoisson_cell_integral_9_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_9_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_9_otherwise()
+  ~adaptivepoisson_cell_integral_9_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -9359,7 +10732,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -9382,39 +10755,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivepoisson_exterior_facet_integral_9_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_exterior_facet_integral_9_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_exterior_facet_integral_9_otherwise()
+  ~adaptivepoisson_exterior_facet_integral_9_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -9423,7 +10789,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -9436,8 +10802,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -9476,38 +10842,31 @@ public:
 
 };
 
-/// 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 adaptivepoisson_cell_integral_10_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivepoisson_cell_integral_10_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_cell_integral_10_otherwise()
+  ~adaptivepoisson_cell_integral_10_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -9516,7 +10875,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -9537,77 +10896,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_0()
+  ~adaptivepoisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "22988ca63a6060f91b7c480b8ab7bf24c51065b041f895f759d48e86dcf0f01710900a12067f5860e2f8dbc1cfb0e2d74868ae808fddd21a2dee45180a3caa5c";
+    return "19b425e17889d62d86285b64713d25de6a9d28c3bf37be81e351fd1214bae8f3ab570ea127ee8fa95c6788e1b1652bd8b1a9a91f5f2e67712064bb901dcbf177";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     }
@@ -9615,19 +10966,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     }
@@ -9635,198 +10985,226 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_1()
+  ~adaptivepoisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "7b2d6d571a3fc8096da034039e9ffc3d34896d27d81e31f6093fb3d04dde0a8718403c574d8648dee47992c1c4ba3d3e01acc0e46f30a86ee27d34cad0424b85";
+    return "02bc16ff054ec42b7e33aede0bd2b486869176764829aa02538e72a0895b2d136af0d28a10e3c8bd55af13bb7482a70a6f4af5e10dbf93059941282dfb759568";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     }
@@ -9834,14 +11212,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     }
@@ -9849,213 +11226,241 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_2: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_2() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_2()
+  ~adaptivepoisson_form_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "6a19385ca3491801257b4062377ba1d16dd50d1360c0100c4a667e23b10ece3aaf47bdbd3de4bfd0f300f7fba739515284d51087dcc6c0d7ffadc1882ab00a41";
+    return "003c517c2a9dc538ab933fb1bbef26c6adb1141704507e2470cbe6aaf20116173ad1055484f33e3770aaec8af5af68155468ce3f0bdf08c5c82de09a24bb136d";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 4;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 3:
       {
-        return new adaptivepoisson_finite_element_4();
+        return new adaptivepoisson_finite_element_2();
         break;
       }
     }
@@ -10063,29 +11468,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 3:
       {
-        return new adaptivepoisson_dofmap_4();
+        return new adaptivepoisson_dofmap_2();
         break;
       }
     }
@@ -10093,208 +11497,236 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_2_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivepoisson_exterior_facet_integral_2_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_3: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_3() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_3()
+  ~adaptivepoisson_form_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "5f715cd2b90138897df0f27340f0e3c28701f1b8f02d64d3d481872716b2894805c9334298479e7a7bc055ef21d78e745cd85e308de26b63c88e3eccff44c920";
+    return "5262e5b0fb2103d4ddbaf946276b5441abcabf81b0b0a01363c5fb8d9f97d3e7b083a38009560849cca1d3596e7837d3fc0ab0e6a6444f8b3988eeb9e47b2e3e";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_3();
+        return new adaptivepoisson_finite_element_4();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_finite_element_3();
+        return new adaptivepoisson_finite_element_4();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_finite_element_2();
+        return new adaptivepoisson_finite_element_6();
         break;
       }
     }
@@ -10302,24 +11734,23 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_3();
+        return new adaptivepoisson_dofmap_4();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_dofmap_3();
+        return new adaptivepoisson_dofmap_4();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_dofmap_2();
+        return new adaptivepoisson_dofmap_6();
         break;
       }
     }
@@ -10327,218 +11758,246 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_cell_integrals() const final override
   {
-    return 0;
+    return true;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  bool has_exterior_facet_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_vertex_integrals() const final override
   {
-    return true;
+    return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_3_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_4: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_4() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_4()
+  ~adaptivepoisson_form_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "262e1ea85696b50caeba8b8b3bf08cf748ca5a9743476e2b3d95e7b3aa93c381cda92247a47efafc36e14300ea926b70f7f42d2085571dd68cd77c4a89f2e76a";
+    return "fa048975b81c9bb048b7469d0e239109a08b00f261d03cc8ee864d973cd706f35f6083c1f1f08b4466feff2005fe8e99dce2d8ccafa5b570a8deca6082bf9c49";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 4;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_3();
+        return new adaptivepoisson_finite_element_4();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 3:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 4:
       {
-        return new adaptivepoisson_finite_element_2();
+        return new adaptivepoisson_finite_element_6();
         break;
       }
     }
@@ -10546,34 +12005,33 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_3();
+        return new adaptivepoisson_dofmap_4();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 3:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 4:
       {
-        return new adaptivepoisson_dofmap_2();
+        return new adaptivepoisson_dofmap_6();
         break;
       }
     }
@@ -10581,208 +12039,236 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_4_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivepoisson_exterior_facet_integral_4_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_5: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_5() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_5()
+  ~adaptivepoisson_form_5() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "4a86d7eeed7126320bed34f866884b960f5dd6c2bfd61cc2e4fea43cbc033cfc1333e6a3891f59cfc17152bcc46412d83bcea94f477471effa8bcd31bbfe16b1";
+    return "04086c717ea4914d5a9cfe4d17a5d10d551f86d1a0238e23a644af889f92c8ae10d06ac99222130f8f0226a41e549d46c1bc034436cdbdddc198695e2f4ad2c3";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_3();
+        return new adaptivepoisson_finite_element_4();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_finite_element_3();
+        return new adaptivepoisson_finite_element_4();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_finite_element_1();
+        return new adaptivepoisson_finite_element_3();
         break;
       }
     }
@@ -10790,24 +12276,23 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_3();
+        return new adaptivepoisson_dofmap_4();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_dofmap_3();
+        return new adaptivepoisson_dofmap_4();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_dofmap_1();
+        return new adaptivepoisson_dofmap_3();
         break;
       }
     }
@@ -10815,223 +12300,251 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivepoisson_exterior_facet_integral_5_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return new adaptivepoisson_interior_facet_integral_5_otherwise();
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_6: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_6() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_6()
+  ~adaptivepoisson_form_6() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "12ceef6afad4cbf73ce609aad5c02e99c9f5ccbefc26d8acee764fed39fe1c21d2794c886558d5a53771a56a0ad5ce206ddc01943ce89c74328159e703728894";
+    return "8dbddc016477ebaa4600985afa7048aa0abb5b8156fa9241bcd7b7ad91e5f8fffa27fcd0c0202057c764ad40f8575eb6718c28c6aa2400c1db4018478a10b6f0";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 5;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3, 4});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_3();
+        return new adaptivepoisson_finite_element_4();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 3:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 4:
       {
-        return new adaptivepoisson_finite_element_3();
+        return new adaptivepoisson_finite_element_4();
         break;
       }
     case 5:
       {
-        return new adaptivepoisson_finite_element_1();
+        return new adaptivepoisson_finite_element_3();
         break;
       }
     }
@@ -11039,39 +12552,38 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_3();
+        return new adaptivepoisson_dofmap_4();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 3:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 4:
       {
-        return new adaptivepoisson_dofmap_3();
+        return new adaptivepoisson_dofmap_4();
         break;
       }
     case 5:
       {
-        return new adaptivepoisson_dofmap_1();
+        return new adaptivepoisson_dofmap_3();
         break;
       }
     }
@@ -11079,218 +12591,246 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_6_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivepoisson_exterior_facet_integral_6_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_7: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_7() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_7()
+  ~adaptivepoisson_form_7() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "a1f0127a33da284e3775abe2c6ad402f43cb0337d29ad30eed162526b6d0a3bc658ba9e88c905a88cc4f95c8617411a0dcdf8e9bd4b283d21b623a9fb96b920d";
+    return "f6de60e88f517edad66b6202a12ed316ecc7df6fc4b69280416112a9b61e5282384effbcd415f51d7c5f0e7c2bbfa83f9e0531085eb9d6d875fd025921b1500c";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 4;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_0();
+        return new adaptivepoisson_finite_element_5();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_finite_element_4();
+        return new adaptivepoisson_finite_element_2();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_finite_element_3();
+        return new adaptivepoisson_finite_element_4();
         break;
       }
     case 3:
       {
-        return new adaptivepoisson_finite_element_3();
+        return new adaptivepoisson_finite_element_4();
         break;
       }
     case 4:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     }
@@ -11298,34 +12838,33 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_0();
+        return new adaptivepoisson_dofmap_5();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_dofmap_4();
+        return new adaptivepoisson_dofmap_2();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_dofmap_3();
+        return new adaptivepoisson_dofmap_4();
         break;
       }
     case 3:
       {
-        return new adaptivepoisson_dofmap_3();
+        return new adaptivepoisson_dofmap_4();
         break;
       }
     case 4:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     }
@@ -11333,203 +12872,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_7_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivepoisson_exterior_facet_integral_7_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return new adaptivepoisson_interior_facet_integral_7_otherwise();
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_8: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_8() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_8()
+  ~adaptivepoisson_form_8() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "a56ff760d1b2d36392fecaa89295d221b18d120e912a2917bc2e8573297855e6979ab2d877460aedf3ffaa3771279e271eabec6012cb797b652aa5da059b83ed";
+    return "327a2ebce665f0df9dcdfb386a5f82bed655eb49e6748bfe664bd49258af417c023ae55cb0509c094373c6b9856a9f7f919048c8bddfe52512e528caaee3cde4";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     }
@@ -11537,19 +13104,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     }
@@ -11557,208 +13123,236 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_8_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_9: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_9() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_9()
+  ~adaptivepoisson_form_9() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "e58507906d4ed11ee413a96a0fc6c639025a4127e4d90f9e99c7bee85f398d70855d6f5e3ae70dcc968b6b0f7967bb5fa54f876c26904fcb75b8950e4bc622c4";
+    return "4b3b1c93f282ab055c940e8938b5687d692b500d84be151f71593ae9d6ad97e0c11f287e5960fa8de2ad6025423bd6e9dc808cf75c5a18587d11a7db9b67ccf0";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     }
@@ -11766,24 +13360,23 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 1:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     case 2:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     }
@@ -11791,198 +13384,226 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_9_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivepoisson_exterior_facet_integral_9_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivepoisson_form_10: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivepoisson_form_10() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivepoisson_form_10()
+  ~adaptivepoisson_form_10() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "9993d6ca9cf99f563b68737c2940dad37c25776b1ef177bc5ac304a1d261ad85be05885c5fff342fdbe0e780f4fbcbd3e0dc9d827f9f65a235659180c08cd105";
+    return "50bbc7cf240795d58d8aa20ad76af963b7191605d923b45d4c90151a987751f8d90adee2e27ef4192932024d4e4f77a9dfe936f84a6abb2d323b1d1dbde2cc52";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivepoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivepoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_finite_element_5();
+        return new adaptivepoisson_finite_element_0();
         break;
       }
     }
@@ -11990,14 +13611,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivepoisson_dofmap_5();
+        return new adaptivepoisson_dofmap_0();
         break;
       }
     }
@@ -12005,126 +13625,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivepoisson_cell_integral_10_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -12138,59 +13794,42 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace AdaptivePoisson
 {
 
 class CoefficientSpace___cell_bubble: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_bubble(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
+{
+public:
 
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___cell_bubble(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_bubble(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_6>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_6>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___cell_bubble(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_6>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_6>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12201,43 +13840,20 @@ class CoefficientSpace___cell_cone: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_cone(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___cell_cone(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_cone(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___cell_cone(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12248,43 +13864,20 @@ class CoefficientSpace___cell_residual: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_residual(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___cell_residual(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_residual(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___cell_residual(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12295,43 +13888,20 @@ class CoefficientSpace___discrete_dual_solution: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___discrete_dual_solution(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___discrete_dual_solution(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___discrete_dual_solution(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___discrete_dual_solution(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12342,43 +13912,20 @@ class CoefficientSpace___discrete_primal_solution: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___discrete_primal_solution(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___discrete_primal_solution(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___discrete_primal_solution(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___discrete_primal_solution(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12389,43 +13936,20 @@ class CoefficientSpace___facet_residual: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___facet_residual(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___facet_residual(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___facet_residual(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___facet_residual(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12436,43 +13960,20 @@ class CoefficientSpace___improved_dual: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___improved_dual(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_4()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___improved_dual(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_4()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___improved_dual(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_4()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___improved_dual(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_4()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12483,43 +13984,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12530,43 +14008,20 @@ class CoefficientSpace_g: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12577,43 +14032,20 @@ class Form_0_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_0_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_0_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_0_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_0_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12624,43 +14056,20 @@ class Form_0_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_0_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_0_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_0_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_0_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12672,23 +14081,13 @@ class Form_0: public dolfin::Form
 public:
 
   // Constructor
-  Form_0(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_0());
-  }
-
-  // Constructor
   Form_0(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
   {
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_0());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_0>();
   }
 
   // Destructor
@@ -12722,47 +14121,25 @@ public:
   // Coefficients
 };
 
+
 class Form_1_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_1_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_1_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_1_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_1_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12774,21 +14151,12 @@ class Form_1: public dolfin::Form
 public:
 
   // Constructor
-  Form_1(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_1());
-  }
-
-  // Constructor
   Form_1(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 0)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_1());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_1>();
   }
 
   // Destructor
@@ -12821,6 +14189,7 @@ public:
   // Coefficients
 };
 
+
 typedef CoefficientSpace_f Form_2_FunctionSpace_0;
 
 typedef CoefficientSpace_g Form_2_FunctionSpace_1;
@@ -12834,49 +14203,15 @@ class Form_2: public dolfin::Form
 public:
 
   // Constructor
-  Form_2(const dolfin::Mesh& mesh):
-    dolfin::Form(0, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __improved_dual(*this, 3)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_2());
-  }
-
-  // Constructor
-  Form_2(const dolfin::Mesh& mesh, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g, const dolfin::GenericFunction& __discrete_primal_solution, const dolfin::GenericFunction& __improved_dual):
-    dolfin::Form(0, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __improved_dual(*this, 3)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->f = f;
-    this->g = g;
-    this->__discrete_primal_solution = __discrete_primal_solution;
-    this->__improved_dual = __improved_dual;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_2());
-  }
-
-  // Constructor
-  Form_2(const dolfin::Mesh& mesh, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g, std::shared_ptr<const dolfin::GenericFunction> __discrete_primal_solution, std::shared_ptr<const dolfin::GenericFunction> __improved_dual):
-    dolfin::Form(0, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __improved_dual(*this, 3)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->f = *f;
-    this->g = *g;
-    this->__discrete_primal_solution = *__discrete_primal_solution;
-    this->__improved_dual = *__improved_dual;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_2());
-  }
-
-  // Constructor
   Form_2(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::Form(0, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __improved_dual(*this, 3)
   {
     _mesh = mesh;
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_2());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_2>();
   }
 
   // Constructor
-  Form_2(std::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g, const dolfin::GenericFunction& __discrete_primal_solution, const dolfin::GenericFunction& __improved_dual):
+  Form_2(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g, std::shared_ptr<const dolfin::GenericFunction> __discrete_primal_solution, std::shared_ptr<const dolfin::GenericFunction> __improved_dual):
     dolfin::Form(0, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __improved_dual(*this, 3)
   {
     _mesh = mesh;
@@ -12885,20 +14220,7 @@ public:
     this->__discrete_primal_solution = __discrete_primal_solution;
     this->__improved_dual = __improved_dual;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_2());
-  }
-
-  // Constructor
-  Form_2(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g, std::shared_ptr<const dolfin::GenericFunction> __discrete_primal_solution, std::shared_ptr<const dolfin::GenericFunction> __improved_dual):
-    dolfin::Form(0, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __improved_dual(*this, 3)
-  {
-    _mesh = mesh;
-    this->f = *f;
-    this->g = *g;
-    this->__discrete_primal_solution = *__discrete_primal_solution;
-    this->__improved_dual = *__improved_dual;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_2());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_2>();
   }
 
   // Destructor
@@ -12957,47 +14279,25 @@ public:
   dolfin::CoefficientAssigner __improved_dual;
 };
 
+
 class Form_3_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_3_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_3_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_3_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_3_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -13008,43 +14308,20 @@ class Form_3_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_3_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_3_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_3_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_3_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -13058,59 +14335,13 @@ class Form_3: public dolfin::Form
 public:
 
   // Constructor
-  Form_3(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 1), __cell_bubble(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_3());
-  }
-
-  // Constructor
-  Form_3(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& __cell_bubble):
-    dolfin::Form(2, 1), __cell_bubble(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->__cell_bubble = __cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_3());
-  }
-
-  // Constructor
-  Form_3(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> __cell_bubble):
-    dolfin::Form(2, 1), __cell_bubble(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->__cell_bubble = *__cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_3());
-  }
-
-  // Constructor
   Form_3(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 1), __cell_bubble(*this, 0)
   {
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_3());
-  }
-
-  // Constructor
-  Form_3(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& __cell_bubble):
-    dolfin::Form(2, 1), __cell_bubble(*this, 0)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->__cell_bubble = __cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_3());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_3>();
   }
 
   // Constructor
@@ -13120,9 +14351,9 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    this->__cell_bubble = *__cell_bubble;
+    this->__cell_bubble = __cell_bubble;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_3());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_3>();
   }
 
   // Destructor
@@ -13165,47 +14396,25 @@ public:
   dolfin::CoefficientAssigner __cell_bubble;
 };
 
+
 class Form_4_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_4_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_4_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_4_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_4_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -13225,63 +14434,12 @@ class Form_4: public dolfin::Form
 public:
 
   // Constructor
-  Form_4(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_bubble(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_4());
-  }
-
-  // Constructor
-  Form_4(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g, const dolfin::GenericFunction& __discrete_primal_solution, const dolfin::GenericFunction& __cell_bubble):
-    dolfin::Form(1, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_bubble(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->f = f;
-    this->g = g;
-    this->__discrete_primal_solution = __discrete_primal_solution;
-    this->__cell_bubble = __cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_4());
-  }
-
-  // Constructor
-  Form_4(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g, std::shared_ptr<const dolfin::GenericFunction> __discrete_primal_solution, std::shared_ptr<const dolfin::GenericFunction> __cell_bubble):
-    dolfin::Form(1, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_bubble(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->f = *f;
-    this->g = *g;
-    this->__discrete_primal_solution = *__discrete_primal_solution;
-    this->__cell_bubble = *__cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_4());
-  }
-
-  // Constructor
   Form_4(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_bubble(*this, 3)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_4());
-  }
-
-  // Constructor
-  Form_4(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g, const dolfin::GenericFunction& __discrete_primal_solution, const dolfin::GenericFunction& __cell_bubble):
-    dolfin::Form(1, 4), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_bubble(*this, 3)
-  {
-    _function_spaces[0] = V0;
-
-    this->f = f;
-    this->g = g;
-    this->__discrete_primal_solution = __discrete_primal_solution;
-    this->__cell_bubble = __cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_4());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_4>();
   }
 
   // Constructor
@@ -13290,12 +14448,12 @@ public:
   {
     _function_spaces[0] = V0;
 
-    this->f = *f;
-    this->g = *g;
-    this->__discrete_primal_solution = *__discrete_primal_solution;
-    this->__cell_bubble = *__cell_bubble;
+    this->f = f;
+    this->g = g;
+    this->__discrete_primal_solution = __discrete_primal_solution;
+    this->__cell_bubble = __cell_bubble;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_4());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_4>();
   }
 
   // Destructor
@@ -13355,47 +14513,25 @@ public:
   dolfin::CoefficientAssigner __cell_bubble;
 };
 
+
 class Form_5_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_5_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_5_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_5_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_5_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -13406,43 +14542,20 @@ class Form_5_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_5_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_5_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_5_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_5_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -13456,59 +14569,13 @@ class Form_5: public dolfin::Form
 public:
 
   // Constructor
-  Form_5(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 1), __cell_cone(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_5());
-  }
-
-  // Constructor
-  Form_5(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& __cell_cone):
-    dolfin::Form(2, 1), __cell_cone(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->__cell_cone = __cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_5());
-  }
-
-  // Constructor
-  Form_5(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> __cell_cone):
-    dolfin::Form(2, 1), __cell_cone(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->__cell_cone = *__cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_5());
-  }
-
-  // Constructor
   Form_5(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 1), __cell_cone(*this, 0)
   {
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_5());
-  }
-
-  // Constructor
-  Form_5(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& __cell_cone):
-    dolfin::Form(2, 1), __cell_cone(*this, 0)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->__cell_cone = __cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_5());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_5>();
   }
 
   // Constructor
@@ -13518,9 +14585,9 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    this->__cell_cone = *__cell_cone;
+    this->__cell_cone = __cell_cone;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_5());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_5>();
   }
 
   // Destructor
@@ -13563,47 +14630,25 @@ public:
   dolfin::CoefficientAssigner __cell_cone;
 };
 
+
 class Form_6_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_6_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_6_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_6_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_6_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -13625,55 +14670,16 @@ class Form_6: public dolfin::Form
 public:
 
   // Constructor
-  Form_6(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 5), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_6());
-  }
-
-  // Constructor
-  Form_6(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g, const dolfin::GenericFunction& __discrete_primal_solution, const dolfin::GenericFunction& __cell_residual, const dolfin::GenericFunction& __cell_cone):
-    dolfin::Form(1, 5), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->f = f;
-    this->g = g;
-    this->__discrete_primal_solution = __discrete_primal_solution;
-    this->__cell_residual = __cell_residual;
-    this->__cell_cone = __cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_6());
-  }
-
-  // Constructor
-  Form_6(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g, std::shared_ptr<const dolfin::GenericFunction> __discrete_primal_solution, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __cell_cone):
-    dolfin::Form(1, 5), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->f = *f;
-    this->g = *g;
-    this->__discrete_primal_solution = *__discrete_primal_solution;
-    this->__cell_residual = *__cell_residual;
-    this->__cell_cone = *__cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_6());
-  }
-
-  // Constructor
   Form_6(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 5), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_6());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_6>();
   }
 
   // Constructor
-  Form_6(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g, const dolfin::GenericFunction& __discrete_primal_solution, const dolfin::GenericFunction& __cell_residual, const dolfin::GenericFunction& __cell_cone):
+  Form_6(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g, std::shared_ptr<const dolfin::GenericFunction> __discrete_primal_solution, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __cell_cone):
     dolfin::Form(1, 5), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
   {
     _function_spaces[0] = V0;
@@ -13684,22 +14690,7 @@ public:
     this->__cell_residual = __cell_residual;
     this->__cell_cone = __cell_cone;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_6());
-  }
-
-  // Constructor
-  Form_6(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g, std::shared_ptr<const dolfin::GenericFunction> __discrete_primal_solution, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __cell_cone):
-    dolfin::Form(1, 5), f(*this, 0), g(*this, 1), __discrete_primal_solution(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
-  {
-    _function_spaces[0] = V0;
-
-    this->f = *f;
-    this->g = *g;
-    this->__discrete_primal_solution = *__discrete_primal_solution;
-    this->__cell_residual = *__cell_residual;
-    this->__cell_cone = *__cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_6());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_6>();
   }
 
   // Destructor
@@ -13765,47 +14756,25 @@ public:
   dolfin::CoefficientAssigner __cell_cone;
 };
 
+
 class Form_7_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_7_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_7_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_7_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_5>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_7_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_5>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -13825,53 +14794,16 @@ class Form_7: public dolfin::Form
 public:
 
   // Constructor
-  Form_7(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_7());
-  }
-
-  // Constructor
-  Form_7(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& __improved_dual, const dolfin::GenericFunction& __cell_residual, const dolfin::GenericFunction& __facet_residual, const dolfin::GenericFunction& __discrete_dual_solution):
-    dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->__improved_dual = __improved_dual;
-    this->__cell_residual = __cell_residual;
-    this->__facet_residual = __facet_residual;
-    this->__discrete_dual_solution = __discrete_dual_solution;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_7());
-  }
-
-  // Constructor
-  Form_7(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> __improved_dual, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __facet_residual, std::shared_ptr<const dolfin::GenericFunction> __discrete_dual_solution):
-    dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->__improved_dual = *__improved_dual;
-    this->__cell_residual = *__cell_residual;
-    this->__facet_residual = *__facet_residual;
-    this->__discrete_dual_solution = *__discrete_dual_solution;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_7());
-  }
-
-  // Constructor
   Form_7(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_7());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_7>();
   }
 
   // Constructor
-  Form_7(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& __improved_dual, const dolfin::GenericFunction& __cell_residual, const dolfin::GenericFunction& __facet_residual, const dolfin::GenericFunction& __discrete_dual_solution):
+  Form_7(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> __improved_dual, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __facet_residual, std::shared_ptr<const dolfin::GenericFunction> __discrete_dual_solution):
     dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
   {
     _function_spaces[0] = V0;
@@ -13881,21 +14813,7 @@ public:
     this->__facet_residual = __facet_residual;
     this->__discrete_dual_solution = __discrete_dual_solution;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_7());
-  }
-
-  // Constructor
-  Form_7(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> __improved_dual, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __facet_residual, std::shared_ptr<const dolfin::GenericFunction> __discrete_dual_solution):
-    dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
-  {
-    _function_spaces[0] = V0;
-
-    this->__improved_dual = *__improved_dual;
-    this->__cell_residual = *__cell_residual;
-    this->__facet_residual = *__facet_residual;
-    this->__discrete_dual_solution = *__discrete_dual_solution;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_7());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_7>();
   }
 
   // Destructor
@@ -13955,47 +14873,25 @@ public:
   dolfin::CoefficientAssigner __discrete_dual_solution;
 };
 
+
 class Form_lhs_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_lhs_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_lhs_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_lhs_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_lhs_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -14006,43 +14902,20 @@ class Form_lhs_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_lhs_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_lhs_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_lhs_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_lhs_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -14054,23 +14927,13 @@ class Form_lhs: public dolfin::Form
 public:
 
   // Constructor
-  Form_lhs(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_8());
-  }
-
-  // Constructor
   Form_lhs(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
   {
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_8());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_8>();
   }
 
   // Destructor
@@ -14104,47 +14967,25 @@ public:
   // Coefficients
 };
 
+
 class Form_rhs_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_rhs_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_rhs_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_rhs_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_rhs_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivepoisson_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivepoisson_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivepoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivepoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -14160,49 +15001,16 @@ class Form_rhs: public dolfin::Form
 public:
 
   // Constructor
-  Form_rhs(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_9());
-  }
-
-  // Constructor
-  Form_rhs(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->f = f;
-    this->g = g;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_9());
-  }
-
-  // Constructor
-  Form_rhs(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->f = *f;
-    this->g = *g;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_9());
-  }
-
-  // Constructor
   Form_rhs(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_9());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_9>();
   }
 
   // Constructor
-  Form_rhs(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
+  Form_rhs(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
     _function_spaces[0] = V0;
@@ -14210,19 +15018,7 @@ public:
     this->f = f;
     this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_9());
-  }
-
-  // Constructor
-  Form_rhs(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = V0;
-
-    this->f = *f;
-    this->g = *g;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_9());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_9>();
   }
 
   // Destructor
@@ -14270,6 +15066,7 @@ public:
   dolfin::CoefficientAssigner g;
 };
 
+
 typedef CoefficientSpace___discrete_primal_solution Form_goal_FunctionSpace_0;
 
 class Form_goal: public dolfin::GoalFunctional
@@ -14277,49 +15074,11 @@ class Form_goal: public dolfin::GoalFunctional
 public:
 
   // Constructor
-  Form_goal(const dolfin::Mesh& mesh):
-    dolfin::GoalFunctional(0, 1), __discrete_primal_solution(*this, 0)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_10());
-  }
-
-  // Constructor
-  Form_goal(const dolfin::Mesh& mesh, const dolfin::GenericFunction& __discrete_primal_solution):
-    dolfin::GoalFunctional(0, 1), __discrete_primal_solution(*this, 0)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->__discrete_primal_solution = __discrete_primal_solution;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_10());
-  }
-
-  // Constructor
-  Form_goal(const dolfin::Mesh& mesh, std::shared_ptr<const dolfin::GenericFunction> __discrete_primal_solution):
-    dolfin::GoalFunctional(0, 1), __discrete_primal_solution(*this, 0)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->__discrete_primal_solution = *__discrete_primal_solution;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_10());
-  }
-
-  // Constructor
   Form_goal(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::GoalFunctional(0, 1), __discrete_primal_solution(*this, 0)
   {
     _mesh = mesh;
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_10());
-  }
-
-  // Constructor
-  Form_goal(std::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& __discrete_primal_solution):
-    dolfin::GoalFunctional(0, 1), __discrete_primal_solution(*this, 0)
-  {
-    _mesh = mesh;
-    this->__discrete_primal_solution = __discrete_primal_solution;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_10());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_10>();
   }
 
   // Constructor
@@ -14327,9 +15086,9 @@ public:
     dolfin::GoalFunctional(0, 1), __discrete_primal_solution(*this, 0)
   {
     _mesh = mesh;
-    this->__discrete_primal_solution = *__discrete_primal_solution;
+    this->__discrete_primal_solution = __discrete_primal_solution;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivepoisson_form_10());
+    _ufc_form = std::make_shared<const adaptivepoisson_form_10>();
   }
 
   // Destructor
@@ -14393,10 +15152,15 @@ public:
     std::shared_ptr<dolfin::Form> eta_T;            // Indicator form
 
     // Some handy views
-    const dolfin::FunctionSpace& Vhat(*(a.function_space(0))); // Primal test
-    const dolfin::FunctionSpace& V(*(a.function_space(1)));    // Primal trial
-    assert(V.mesh());
-    const dolfin::Mesh& mesh(*V.mesh());
+    assert(a.function_space(0));
+    const auto Vhat = a.function_space(0); // Primal test
+
+    assert(a.function_space(0));
+    const auto V = a.function_space(1);    // Primal trial
+
+    assert(V->mesh());
+    const auto mesh = V->mesh();
+
     std::string name;
 
     // Initialize dual forms
@@ -14630,11 +15394,11 @@ public:
     _ec.reset(new dolfin::ErrorControl(a_star, L_star, residual,
                                        a_R_T, L_R_T, a_R_dT, L_R_dT, eta_T,
                                        true));
-
   }
 
 };
 
+
 // Class typedefs
 typedef Form_lhs BilinearForm;
 typedef Form_rhs LinearForm;
diff --git a/demo/documented/auto-adaptive-poisson/cpp/CMakeLists.txt b/demo/documented/auto-adaptive-poisson/cpp/CMakeLists.txt
index b70fe96..c33c85c 100644
--- a/demo/documented/auto-adaptive-poisson/cpp/CMakeLists.txt
+++ b/demo/documented/auto-adaptive-poisson/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/auto-adaptive-poisson/cpp/compile.log b/demo/documented/auto-adaptive-poisson/cpp/compile.log
index 77126d7..86bfa17 100644
--- a/demo/documented/auto-adaptive-poisson/cpp/compile.log
+++ b/demo/documented/auto-adaptive-poisson/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form AdaptivePoisson
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -30,17 +31,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 0
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 1
-  quadrature_degree: auto --> 1
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 1
+  quadrature_degree: 1
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -49,8 +50,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '()'
   Number of coefficients:              4
   Coefficients:                        '[w_0, w_1, w_2, w_3]'
-  Unique elements:                     'CG1(?), CG2(?)'
-  Unique sub elements:                 'CG1(?), CG2(?)'
+  Unique elements:                     'CG1(?), CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG1(?), CG2(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -59,18 +60,18 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -78,17 +79,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    1
   Coefficients:              '[w_4]'
-  Unique elements:           'DG1(?), B3(?)'
-  Unique sub elements:       'DG1(?), B3(?)'
+  Unique elements:           'DG1(?), B3(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'DG1(?), B3(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -97,8 +98,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              4
   Coefficients:                        '[w_0, w_1, w_2, w_4]'
-  Unique elements:                     'DG1(?), CG1(?), B3(?)'
-  Unique sub elements:                 'DG1(?), CG1(?), B3(?)'
+  Unique elements:                     'DG1(?), CG1(?), B3(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'DG1(?), CG1(?), B3(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -113,9 +114,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -123,9 +124,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   
   Geometric dimension:                 2
   Number of exterior_facet subdomains: 0
@@ -134,8 +135,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0, v_1)'
   Number of coefficients:              1
   Coefficients:                        '[w_6]'
-  Unique elements:                     'DG1(?), DG2(?)'
-  Unique sub elements:                 'DG1(?), DG2(?)'
+  Unique elements:                     'DG1(?), DG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'DG1(?), DG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -143,9 +144,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -156,9 +157,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -167,8 +168,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              5
   Coefficients:                        '[w_0, w_1, w_2, w_5, w_6]'
-  Unique elements:                     'DG1(?), CG1(?), DG2(?)'
-  Unique sub elements:                 'DG1(?), CG1(?), DG2(?)'
+  Unique elements:                     'DG1(?), CG1(?), DG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'DG1(?), CG1(?), DG2(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -186,9 +187,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -196,9 +197,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -208,8 +209,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              4
   Coefficients:                        '[w_3, w_5, w_7, w_8]'
-  Unique elements:                     'DG0(?), CG2(?), DG1(?), CG1(?)'
-  Unique sub elements:                 'DG0(?), CG2(?), DG1(?), CG1(?)'
+  Unique elements:                     'DG0(?), CG2(?), DG1(?), CG1(?), Vector<2 x C
+                                       G1(?)>'
+  Unique sub elements:                 'DG0(?), CG2(?), DG1(?), CG1(?), Vector<2 x C
+                                       G1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -220,9 +223,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -233,9 +236,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -264,9 +267,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -274,8 +277,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -283,9 +286,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -294,8 +297,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              2
   Coefficients:                        '[w_0, w_1]'
-  Unique elements:                     'CG1(?)'
-  Unique sub elements:                 'CG1(?)'
+  Unique elements:                     'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -303,18 +306,18 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -322,23 +325,30 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '()'
   Number of coefficients:    1
   Coefficients:              '[w_2]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 1
-  quadrature_degree: auto --> 1
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 1
+  quadrature_degree: 1
   
-Compiler stage 1 finished in 0.395868 seconds.
+Compiler stage 1 finished in 0.878716 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 6 elements
+  Computing representation of 7 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -351,13 +361,19 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 6 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 7 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -366,7 +382,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.00068 seconds
+  36 entries computed in 0.000869 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -374,13 +390,14 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  3 entries computed in 0.000449 seconds
+  3 entries computed in 0.000617 seconds
   Shape of reference tensor: (3,)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -388,6 +405,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 0 dims = [] indices = [[]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
@@ -397,52 +415,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {6: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-            8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-            1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1.],
-         [ 1.,  1.,  1.,  1.,  1.,  1.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.10903901,  0.23193337,  0.10903901,  0.65902762,  0.23193337,
-           0.65902762],
-         [ 0.65902762,  0.65902762,  0.23193337,  0.23193337,  0.10903901,
-           0.10903901],
-         [ 0.23193337,  0.10903901,  0.65902762,  0.10903901,  0.65902762,
-           0.23193337]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {None: {(0, 1): array([[  5.63843964e-01,   7.22665258e-02,   5.63843964e-01,
-           -1.63611049e+00,   7.22665258e-02,  -1.63611049e+00],
-         [  8.38218384e-15,   7.93809463e-15,   8.04911693e-15,
-            6.21724894e-15,   7.71605002e-15,   6.16173779e-15],
-         [ -7.22665258e-02,  -5.63843964e-01,   1.63611049e+00,
-           -5.63843964e-01,   1.63611049e+00,  -7.22665258e-02],
-         [  2.63611049e+00,   2.63611049e+00,   9.27733474e-01,
-            9.27733474e-01,   4.36156036e-01,   4.36156036e-01],
-         [ -4.91577438e-01,   4.91577438e-01,  -2.19995445e+00,
-            2.19995445e+00,  -1.70837702e+00,   1.70837702e+00],
-         [ -2.63611049e+00,  -2.63611049e+00,  -9.27733474e-01,
-           -9.27733474e-01,  -4.36156036e-01,  -4.36156036e-01]]), (1, 0): array([[ 0.56384396,  0.07226653,  0.56384396, -1.63611049,  0.07226653,
-          -1.63611049],
-         [ 1.63611049,  1.63611049, -0.07226653, -0.07226653, -0.56384396,
-          -0.56384396],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.92773347,  0.43615604,  2.63611049,  0.43615604,  2.63611049,
-           0.92773347],
-         [-0.92773347, -0.43615604, -2.63611049, -0.43615604, -2.63611049,
-          -0.92773347],
-         [-2.19995445, -1.70837702, -0.49157744,  1.70837702,  0.49157744,
-           2.19995445]]), (0, 0): array([[-0.08526   , -0.12434719, -0.08526   ,  0.20960719, -0.12434719,
-           0.20960719],
-         [ 0.20960719,  0.20960719, -0.12434719, -0.12434719, -0.08526   ,
-          -0.08526   ],
-         [-0.12434719, -0.08526   ,  0.20960719, -0.08526   ,  0.20960719,
-          -0.12434719],
-         [ 0.61140199,  0.28743888,  0.61140199,  0.10115914,  0.28743888,
-           0.10115914],
-         [ 0.10115914,  0.10115914,  0.28743888,  0.28743888,  0.61140199,
-           0.61140199],
-         [ 0.28743888,  0.61140199,  0.10115914,  0.61140199,  0.10115914,
-           0.28743888]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+  {6: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
@@ -514,7 +487,52 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ],
           [ 0.23193337,  0.10903901,  0.65902762,  0.10903901,  0.65902762,
-            0.23193337]]])}}}}}
+            0.23193337]]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+            8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+            1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1.],
+         [ 1.,  1.,  1.,  1.,  1.,  1.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.10903901,  0.23193337,  0.10903901,  0.65902762,  0.23193337,
+           0.65902762],
+         [ 0.65902762,  0.65902762,  0.23193337,  0.23193337,  0.10903901,
+           0.10903901],
+         [ 0.23193337,  0.10903901,  0.65902762,  0.10903901,  0.65902762,
+           0.23193337]])}}}, FiniteElement('Lagrange', triangle, 2): {None: {None: {(0, 1): array([[  5.63843964e-01,   7.22665258e-02,   5.63843964e-01,
+           -1.63611049e+00,   7.22665258e-02,  -1.63611049e+00],
+         [  8.16013923e-15,   7.49400542e-15,   7.88258347e-15,
+            6.10622664e-15,   7.27196081e-15,   6.21724894e-15],
+         [ -7.22665258e-02,  -5.63843964e-01,   1.63611049e+00,
+           -5.63843964e-01,   1.63611049e+00,  -7.22665258e-02],
+         [  2.63611049e+00,   2.63611049e+00,   9.27733474e-01,
+            9.27733474e-01,   4.36156036e-01,   4.36156036e-01],
+         [ -4.91577438e-01,   4.91577438e-01,  -2.19995445e+00,
+            2.19995445e+00,  -1.70837702e+00,   1.70837702e+00],
+         [ -2.63611049e+00,  -2.63611049e+00,  -9.27733474e-01,
+           -9.27733474e-01,  -4.36156036e-01,  -4.36156036e-01]]), (1, 0): array([[ 0.56384396,  0.07226653,  0.56384396, -1.63611049,  0.07226653,
+          -1.63611049],
+         [ 1.63611049,  1.63611049, -0.07226653, -0.07226653, -0.56384396,
+          -0.56384396],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.92773347,  0.43615604,  2.63611049,  0.43615604,  2.63611049,
+           0.92773347],
+         [-0.92773347, -0.43615604, -2.63611049, -0.43615604, -2.63611049,
+          -0.92773347],
+         [-2.19995445, -1.70837702, -0.49157744,  1.70837702,  0.49157744,
+           2.19995445]]), (0, 0): array([[-0.08526   , -0.12434719, -0.08526   ,  0.20960719, -0.12434719,
+           0.20960719],
+         [ 0.20960719,  0.20960719, -0.12434719, -0.12434719, -0.08526   ,
+          -0.08526   ],
+         [-0.12434719, -0.08526   ,  0.20960719, -0.08526   ,  0.20960719,
+          -0.12434719],
+         [ 0.61140199,  0.28743888,  0.61140199,  0.10115914,  0.28743888,
+           0.10115914],
+         [ 0.10115914,  0.10115914,  0.28743888,  0.28743888,  0.61140199,
+           0.61140199],
+         [ 0.28743888,  0.61140199,  0.10115914,  0.61140199,  0.10115914,
+           0.28743888]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_D10': array([[-1.,  1.,  0.],
@@ -581,17 +599,17 @@ Compiler stage 2: Computing intermediate representation
          [ 0.23193337,  0.10903901,  0.65902762,  0.        ,  0.        ,
            0.        ],
          [ 0.65902762,  0.10903901,  0.23193337,  0.        ,  0.        ,
-           0.        ]]), 'FE1_D01': array([[  5.63843964e-01,   8.38218384e-15,  -7.22665258e-02,
+           0.        ]]), 'FE1_D01': array([[  5.63843964e-01,   8.16013923e-15,  -7.22665258e-02,
             2.63611049e+00,  -4.91577438e-01,  -2.63611049e+00],
-         [  7.22665258e-02,   7.93809463e-15,  -5.63843964e-01,
+         [  7.22665258e-02,   7.49400542e-15,  -5.63843964e-01,
             2.63611049e+00,   4.91577438e-01,  -2.63611049e+00],
-         [  5.63843964e-01,   8.04911693e-15,   1.63611049e+00,
+         [  5.63843964e-01,   7.88258347e-15,   1.63611049e+00,
             9.27733474e-01,  -2.19995445e+00,  -9.27733474e-01],
-         [ -1.63611049e+00,   6.21724894e-15,  -5.63843964e-01,
+         [ -1.63611049e+00,   6.10622664e-15,  -5.63843964e-01,
             9.27733474e-01,   2.19995445e+00,  -9.27733474e-01],
-         [  7.22665258e-02,   7.71605002e-15,   1.63611049e+00,
+         [  7.22665258e-02,   7.27196081e-15,   1.63611049e+00,
             4.36156036e-01,  -1.70837702e+00,  -4.36156036e-01],
-         [ -1.63611049e+00,   6.16173779e-15,  -7.22665258e-02,
+         [ -1.63611049e+00,   6.21724894e-15,  -7.22665258e-02,
             4.36156036e-01,   1.70837702e+00,  -4.36156036e-01]]), 'FE1_D10': array([[ 0.56384396,  1.63611049,  0.        ,  0.92773347, -0.92773347,
           -2.19995445],
          [ 0.07226653,  1.63611049,  0.        ,  0.43615604, -0.43615604,
@@ -685,17 +703,17 @@ Compiler stage 2: Computing intermediate representation
          [ 0.23193337,  0.10903901,  0.65902762,  0.        ,  0.        ,
            0.        ],
          [ 0.65902762,  0.10903901,  0.23193337,  0.        ,  0.        ,
-           0.        ]]), 'FE1_D01': array([[  5.63843964e-01,   8.38218384e-15,  -7.22665258e-02,
+           0.        ]]), 'FE1_D01': array([[  5.63843964e-01,   8.16013923e-15,  -7.22665258e-02,
             2.63611049e+00,  -4.91577438e-01,  -2.63611049e+00],
-         [  7.22665258e-02,   7.93809463e-15,  -5.63843964e-01,
+         [  7.22665258e-02,   7.49400542e-15,  -5.63843964e-01,
             2.63611049e+00,   4.91577438e-01,  -2.63611049e+00],
-         [  5.63843964e-01,   8.04911693e-15,   1.63611049e+00,
+         [  5.63843964e-01,   7.88258347e-15,   1.63611049e+00,
             9.27733474e-01,  -2.19995445e+00,  -9.27733474e-01],
-         [ -1.63611049e+00,   6.21724894e-15,  -5.63843964e-01,
+         [ -1.63611049e+00,   6.10622664e-15,  -5.63843964e-01,
             9.27733474e-01,   2.19995445e+00,  -9.27733474e-01],
-         [  7.22665258e-02,   7.71605002e-15,   1.63611049e+00,
+         [  7.22665258e-02,   7.27196081e-15,   1.63611049e+00,
             4.36156036e-01,  -1.70837702e+00,  -4.36156036e-01],
-         [ -1.63611049e+00,   6.16173779e-15,  -7.22665258e-02,
+         [ -1.63611049e+00,   6.21724894e-15,  -7.22665258e-02,
             4.36156036e-01,   1.70837702e+00,  -4.36156036e-01]]), 'FE1_D10': array([[ 0.56384396,  1.63611049,  0.        ,  0.92773347, -0.92773347,
           -2.19995445],
          [ 0.07226653,  1.63611049,  0.        ,  0.43615604, -0.43615604,
@@ -789,7 +807,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00129 seconds
+  18 entries computed in 0.00173 seconds
   Shape of reference tensor: (3, 6)
   Primary multi index:   rank = 0 dims = [] indices = [[]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -799,7 +817,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00115 seconds
+  18 entries computed in 0.00177 seconds
   Shape of reference tensor: (3, 6)
   Primary multi index:   rank = 0 dims = [] indices = [[]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -809,7 +827,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00116 seconds
+  18 entries computed in 0.00222 seconds
   Shape of reference tensor: (3, 6)
   Primary multi index:   rank = 0 dims = [] indices = [[]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -818,6 +836,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -827,7 +846,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00119 seconds
+  9 entries computed in 0.00239 seconds
   Shape of reference tensor: (3, 3, 1)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [1] indices = [[0]]
@@ -836,6 +855,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
@@ -845,39 +865,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {7: {FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-           -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-            8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-            8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-            1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-            1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1., -1.],
-         [ 1.,  1.,  1.,  1.,  1.,  1.,  1.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
-           0.47014206,  0.05971587],
-         [ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
-           0.47014206,  0.47014206],
-         [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
-           0.05971587,  0.47014206]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-           -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-            8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-            8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-            1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-            1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1., -1.],
-         [ 1.,  1.,  1.,  1.,  1.,  1.,  1.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
-           0.47014206,  0.05971587],
-         [ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
-           0.47014206,  0.47014206],
-         [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
-           0.05971587,  0.47014206]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+  {7: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -961,25 +952,55 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
           [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
-            0.05971587,  0.47014206]]])}}}, FiniteElement('Bubble', Domain(Cell('triangle', 2), label=None, data=None), 3, quad_scheme=None): {None: {None: {(0, 1): array([[ -5.55111512e-15,  -7.10542736e-15,  -1.90376022e+00,
-            1.90376022e+00,  -8.99280650e-15,   5.20988266e+00,
-           -5.20988266e+00]]), (1, 0): array([[ -9.01903556e-16,  -1.90376022e+00,  -4.91516986e-15,
-            1.90376022e+00,   5.20988266e+00,  -9.20683956e-16,
+            0.05971587,  0.47014206]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 1): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+           -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+            8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+            8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+            1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+            1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1., -1.],
+         [ 1.,  1.,  1.,  1.,  1.,  1.,  1.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
+           0.47014206,  0.05971587],
+         [ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
+           0.47014206,  0.47014206],
+         [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
+           0.05971587,  0.47014206]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+           -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+            8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+            8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+            1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+            1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1., -1.],
+         [ 1.,  1.,  1.,  1.,  1.,  1.,  1.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
+           0.47014206,  0.05971587],
+         [ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
+           0.47014206,  0.47014206],
+         [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
+           0.05971587,  0.47014206]])}}}, FiniteElement('Bubble', triangle, 3): {None: {None: {(0, 1): array([[ -6.05071548e-15,  -6.32827124e-15,  -1.90376022e+00,
+            1.90376022e+00,  -7.43849426e-15,   5.20988266e+00,
+           -5.20988266e+00]]), (1, 0): array([[ -6.77432042e-16,  -1.90376022e+00,  -3.35519822e-15,
+            1.90376022e+00,   5.20988266e+00,  -2.12974173e-15,
            -5.20988266e+00]]), (0, 0): array([[ 1.        ,  0.22088076,  0.22088076,  0.22088076,  0.35637872,
            0.35637872,  0.35637872]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_D10': array([[ -9.01903556e-16],
+  {'FE0_D10': array([[ -6.77432042e-16],
          [ -1.90376022e+00],
-         [ -4.91516986e-15],
+         [ -3.35519822e-15],
          [  1.90376022e+00],
          [  5.20988266e+00],
-         [ -9.20683956e-16],
-         [ -5.20988266e+00]]), 'FE0_D01': array([[ -5.55111512e-15],
-         [ -7.10542736e-15],
+         [ -2.12974173e-15],
+         [ -5.20988266e+00]]), 'FE0_D01': array([[ -6.05071548e-15],
+         [ -6.32827124e-15],
          [ -1.90376022e+00],
          [  1.90376022e+00],
-         [ -8.99280650e-15],
+         [ -7.43849426e-15],
          [  5.20988266e+00],
          [ -5.20988266e+00]]), 'FE3_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1089,17 +1110,17 @@ Compiler stage 2: Computing intermediate representation
          [ 0.,  0.,  0., -1.,  1.,  0.],
          [ 0.,  0.,  0., -1.,  1.,  0.]])}
   
-  tables: {'FE0_D10': array([[ -9.01903556e-16],
+  tables: {'FE0_D10': array([[ -6.77432042e-16],
          [ -1.90376022e+00],
-         [ -4.91516986e-15],
+         [ -3.35519822e-15],
          [  1.90376022e+00],
          [  5.20988266e+00],
-         [ -9.20683956e-16],
-         [ -5.20988266e+00]]), 'FE0_D01': array([[ -5.55111512e-15],
-         [ -7.10542736e-15],
+         [ -2.12974173e-15],
+         [ -5.20988266e+00]]), 'FE0_D01': array([[ -6.05071548e-15],
+         [ -6.32827124e-15],
          [ -1.90376022e+00],
          [  1.90376022e+00],
-         [ -8.99280650e-15],
+         [ -7.43849426e-15],
          [  5.20988266e+00],
          [ -5.20988266e+00]]), 'FE3_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1271,7 +1292,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00204 seconds
+  9 entries computed in 0.00502 seconds
   Shape of reference tensor: (3, 3, 1)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 2 dims = [3, 1] indices = [[0, 0], [1, 0], [2, 0]]
@@ -1282,7 +1303,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00194 seconds
+  9 entries computed in 0.00455 seconds
   Shape of reference tensor: (3, 3, 1)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 2 dims = [3, 1] indices = [[0, 0], [1, 0], [2, 0]]
@@ -1293,7 +1314,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00192 seconds
+  9 entries computed in 0.00473 seconds
   Shape of reference tensor: (3, 3, 1)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 2 dims = [3, 1] indices = [[0, 0], [1, 0], [2, 0]]
@@ -1303,6 +1324,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1312,7 +1334,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00153 seconds
+  54 entries computed in 0.00306 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1322,7 +1344,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00151 seconds
+  54 entries computed in 0.00211 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1332,7 +1354,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00151 seconds
+  54 entries computed in 0.00203 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1341,6 +1363,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1353,7 +1376,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00207 seconds
+  54 entries computed in 0.00261 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1363,7 +1386,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00208 seconds
+  54 entries computed in 0.00254 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1373,7 +1396,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00212 seconds
+  54 entries computed in 0.00244 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1383,7 +1406,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00206 seconds
+  54 entries computed in 0.00248 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1393,7 +1416,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00213 seconds
+  54 entries computed in 0.00242 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1403,7 +1426,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00208 seconds
+  54 entries computed in 0.00242 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1413,7 +1436,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00206 seconds
+  54 entries computed in 0.00466 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1423,7 +1446,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00211 seconds
+  54 entries computed in 0.00246 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1433,7 +1456,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.0021 seconds
+  54 entries computed in 0.00236 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1443,7 +1466,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00209 seconds
+  54 entries computed in 0.00276 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1453,7 +1476,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00265 seconds
+  54 entries computed in 0.00242 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1463,7 +1486,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00206 seconds
+  54 entries computed in 0.0024 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1473,7 +1496,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00201 seconds
+  54 entries computed in 0.00242 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1483,7 +1506,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00198 seconds
+  54 entries computed in 0.00253 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1493,7 +1516,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00199 seconds
+  54 entries computed in 0.00236 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1503,7 +1526,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00199 seconds
+  54 entries computed in 0.00232 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1513,7 +1536,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00198 seconds
+  54 entries computed in 0.00232 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1523,7 +1546,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00198 seconds
+  54 entries computed in 0.00238 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1532,6 +1555,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
@@ -1541,66 +1565,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {6: {FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {None: {(0, 1): array([[  6.33695146e-01,   6.33695146e-01,  -2.26739029e+00,
-           -7.83793964e-01,  -7.83793964e-01,   5.67587927e-01],
-         [  8.77076189e-15,   8.32667268e-15,   5.88418203e-15,
-            6.94583280e-15,   7.04991621e-15,   8.22952817e-15],
-         [ -6.33695146e-01,   2.26739029e+00,  -6.33695146e-01,
-            7.83793964e-01,  -5.67587927e-01,   7.83793964e-01],
-         [  3.26739029e+00,   3.66304854e-01,   3.66304854e-01,
-            4.32412073e-01,   1.78379396e+00,   1.78379396e+00],
-         [  8.43769499e-15,  -2.90108544e+00,   2.90108544e+00,
-            8.18789481e-15,   1.35138189e+00,  -1.35138189e+00],
-         [ -3.26739029e+00,  -3.66304854e-01,  -3.66304854e-01,
-           -4.32412073e-01,  -1.78379396e+00,  -1.78379396e+00]]), (1, 0): array([[  6.33695146e-01,   6.33695146e-01,  -2.26739029e+00,
-           -7.83793964e-01,  -7.83793964e-01,   5.67587927e-01],
-         [  2.26739029e+00,  -6.33695146e-01,  -6.33695146e-01,
-           -5.67587927e-01,   7.83793964e-01,   7.83793964e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.66304854e-01,   3.26739029e+00,   3.66304854e-01,
-            1.78379396e+00,   4.32412073e-01,   1.78379396e+00],
-         [ -3.66304854e-01,  -3.26739029e+00,  -3.66304854e-01,
-           -1.78379396e+00,  -4.32412073e-01,  -1.78379396e+00],
-         [ -2.90108544e+00,  -2.42787315e-15,   2.90108544e+00,
-            1.35138189e+00,   2.02557929e-16,  -1.35138189e+00]]), (0, 0): array([[-0.07480381, -0.07480381,  0.51763234, -0.04820838, -0.04820838,
-          -0.08473049],
-         [ 0.51763234, -0.07480381, -0.07480381, -0.08473049, -0.04820838,
-          -0.04820838],
-         [-0.07480381,  0.51763234, -0.07480381, -0.04820838, -0.08473049,
-          -0.04820838],
-         [ 0.29921523,  0.29921523,  0.03354481,  0.19283351,  0.19283351,
-           0.79548023],
-         [ 0.03354481,  0.29921523,  0.29921523,  0.79548023,  0.19283351,
-           0.19283351],
-         [ 0.29921523,  0.03354481,  0.29921523,  0.19283351,  0.79548023,
-           0.19283351]])}}}, FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-            8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-            1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1.],
-         [ 1.,  1.,  1.,  1.,  1.,  1.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
-           0.10810302],
-         [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
-           0.44594849],
-         [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-           0.44594849]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-            8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-            1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1.],
-         [ 1.,  1.,  1.,  1.,  1.,  1.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
-           0.10810302],
-         [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
-           0.44594849],
-         [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-           0.44594849]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+  {6: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
@@ -1672,7 +1640,64 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ],
           [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849]]])}}}}}
+            0.44594849]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 2): {None: {None: {(0, 1): array([[  6.33695146e-01,   6.33695146e-01,  -2.26739029e+00,
+           -7.83793964e-01,  -7.83793964e-01,   5.67587927e-01],
+         [  7.99360578e-15,   7.32747196e-15,   5.44009282e-15,
+            6.93195501e-15,   6.88338275e-15,   8.11850587e-15],
+         [ -6.33695146e-01,   2.26739029e+00,  -6.33695146e-01,
+            7.83793964e-01,  -5.67587927e-01,   7.83793964e-01],
+         [  3.26739029e+00,   3.66304854e-01,   3.66304854e-01,
+            4.32412073e-01,   1.78379396e+00,   1.78379396e+00],
+         [  7.10542736e-15,  -2.90108544e+00,   2.90108544e+00,
+            8.13238366e-15,   1.35138189e+00,  -1.35138189e+00],
+         [ -3.26739029e+00,  -3.66304854e-01,  -3.66304854e-01,
+           -4.32412073e-01,  -1.78379396e+00,  -1.78379396e+00]]), (1, 0): array([[  6.33695146e-01,   6.33695146e-01,  -2.26739029e+00,
+           -7.83793964e-01,  -7.83793964e-01,   5.67587927e-01],
+         [  2.26739029e+00,  -6.33695146e-01,  -6.33695146e-01,
+           -5.67587927e-01,   7.83793964e-01,   7.83793964e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.66304854e-01,   3.26739029e+00,   3.66304854e-01,
+            1.78379396e+00,   4.32412073e-01,   1.78379396e+00],
+         [ -3.66304854e-01,  -3.26739029e+00,  -3.66304854e-01,
+           -1.78379396e+00,  -4.32412073e-01,  -1.78379396e+00],
+         [ -2.90108544e+00,  -3.86532069e-15,   2.90108544e+00,
+            1.35138189e+00,  -4.32612710e-16,  -1.35138189e+00]]), (0, 0): array([[-0.07480381, -0.07480381,  0.51763234, -0.04820838, -0.04820838,
+          -0.08473049],
+         [ 0.51763234, -0.07480381, -0.07480381, -0.08473049, -0.04820838,
+          -0.04820838],
+         [-0.07480381,  0.51763234, -0.07480381, -0.04820838, -0.08473049,
+          -0.04820838],
+         [ 0.29921523,  0.29921523,  0.03354481,  0.19283351,  0.19283351,
+           0.79548023],
+         [ 0.03354481,  0.29921523,  0.29921523,  0.79548023,  0.19283351,
+           0.19283351],
+         [ 0.29921523,  0.03354481,  0.29921523,  0.19283351,  0.79548023,
+           0.19283351]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 1): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+            8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+            1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1.],
+         [ 1.,  1.,  1.,  1.,  1.,  1.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
+           0.10810302],
+         [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
+           0.44594849],
+         [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
+           0.44594849]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+           -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+            8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+            1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1., -1., -1., -1.],
+         [ 1.,  1.,  1.,  1.,  1.,  1.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.]]), (0, 0): array([[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
+           0.10810302],
+         [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
+           0.44594849],
+         [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
+           0.44594849]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_D10': array([[-1.,  1.,  0.],
@@ -1768,25 +1793,25 @@ Compiler stage 2: Computing intermediate representation
          [ 0.10810302,  0.44594849,  0.44594849]]), 'FE2_D10': array([[  6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,  -2.90108544e+00],
          [  6.33695146e-01,  -6.33695146e-01,   0.00000000e+00,
-            3.26739029e+00,  -3.26739029e+00,  -2.42787315e-15],
+            3.26739029e+00,  -3.26739029e+00,  -3.86532069e-15],
          [ -2.26739029e+00,  -6.33695146e-01,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,   2.90108544e+00],
          [ -7.83793964e-01,  -5.67587927e-01,   0.00000000e+00,
             1.78379396e+00,  -1.78379396e+00,   1.35138189e+00],
          [ -7.83793964e-01,   7.83793964e-01,   0.00000000e+00,
-            4.32412073e-01,  -4.32412073e-01,   2.02557929e-16],
+            4.32412073e-01,  -4.32412073e-01,  -4.32612710e-16],
          [  5.67587927e-01,   7.83793964e-01,   0.00000000e+00,
-            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE2_D01': array([[  6.33695146e-01,   8.77076189e-15,  -6.33695146e-01,
-            3.26739029e+00,   8.43769499e-15,  -3.26739029e+00],
-         [  6.33695146e-01,   8.32667268e-15,   2.26739029e+00,
+            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE2_D01': array([[  6.33695146e-01,   7.99360578e-15,  -6.33695146e-01,
+            3.26739029e+00,   7.10542736e-15,  -3.26739029e+00],
+         [  6.33695146e-01,   7.32747196e-15,   2.26739029e+00,
             3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01],
-         [ -2.26739029e+00,   5.88418203e-15,  -6.33695146e-01,
+         [ -2.26739029e+00,   5.44009282e-15,  -6.33695146e-01,
             3.66304854e-01,   2.90108544e+00,  -3.66304854e-01],
-         [ -7.83793964e-01,   6.94583280e-15,   7.83793964e-01,
-            4.32412073e-01,   8.18789481e-15,  -4.32412073e-01],
-         [ -7.83793964e-01,   7.04991621e-15,  -5.67587927e-01,
+         [ -7.83793964e-01,   6.93195501e-15,   7.83793964e-01,
+            4.32412073e-01,   8.13238366e-15,  -4.32412073e-01],
+         [ -7.83793964e-01,   6.88338275e-15,  -5.67587927e-01,
             1.78379396e+00,   1.35138189e+00,  -1.78379396e+00],
-         [  5.67587927e-01,   8.22952817e-15,   7.83793964e-01,
+         [  5.67587927e-01,   8.11850587e-15,   7.83793964e-01,
             1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00]]), 'FE3_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
          [ 0.,  0.,  0., -1.,  1.,  0.],
          [ 0.,  0.,  0., -1.,  1.,  0.],
@@ -1872,25 +1897,25 @@ Compiler stage 2: Computing intermediate representation
          [ 0.10810302,  0.44594849,  0.44594849]]), 'FE2_D10': array([[  6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,  -2.90108544e+00],
          [  6.33695146e-01,  -6.33695146e-01,   0.00000000e+00,
-            3.26739029e+00,  -3.26739029e+00,  -2.42787315e-15],
+            3.26739029e+00,  -3.26739029e+00,  -3.86532069e-15],
          [ -2.26739029e+00,  -6.33695146e-01,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,   2.90108544e+00],
          [ -7.83793964e-01,  -5.67587927e-01,   0.00000000e+00,
             1.78379396e+00,  -1.78379396e+00,   1.35138189e+00],
          [ -7.83793964e-01,   7.83793964e-01,   0.00000000e+00,
-            4.32412073e-01,  -4.32412073e-01,   2.02557929e-16],
+            4.32412073e-01,  -4.32412073e-01,  -4.32612710e-16],
          [  5.67587927e-01,   7.83793964e-01,   0.00000000e+00,
-            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE2_D01': array([[  6.33695146e-01,   8.77076189e-15,  -6.33695146e-01,
-            3.26739029e+00,   8.43769499e-15,  -3.26739029e+00],
-         [  6.33695146e-01,   8.32667268e-15,   2.26739029e+00,
+            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE2_D01': array([[  6.33695146e-01,   7.99360578e-15,  -6.33695146e-01,
+            3.26739029e+00,   7.10542736e-15,  -3.26739029e+00],
+         [  6.33695146e-01,   7.32747196e-15,   2.26739029e+00,
             3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01],
-         [ -2.26739029e+00,   5.88418203e-15,  -6.33695146e-01,
+         [ -2.26739029e+00,   5.44009282e-15,  -6.33695146e-01,
             3.66304854e-01,   2.90108544e+00,  -3.66304854e-01],
-         [ -7.83793964e-01,   6.94583280e-15,   7.83793964e-01,
-            4.32412073e-01,   8.18789481e-15,  -4.32412073e-01],
-         [ -7.83793964e-01,   7.04991621e-15,  -5.67587927e-01,
+         [ -7.83793964e-01,   6.93195501e-15,   7.83793964e-01,
+            4.32412073e-01,   8.13238366e-15,  -4.32412073e-01],
+         [ -7.83793964e-01,   6.88338275e-15,  -5.67587927e-01,
             1.78379396e+00,   1.35138189e+00,  -1.78379396e+00],
-         [  5.67587927e-01,   8.22952817e-15,   7.83793964e-01,
+         [  5.67587927e-01,   8.11850587e-15,   7.83793964e-01,
             1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00]]), 'FE3_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
          [ 0.,  0.,  0., -1.,  1.,  0.],
          [ 0.,  0.,  0., -1.,  1.,  0.],
@@ -1985,7 +2010,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00191 seconds
+  54 entries computed in 0.00261 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -1996,7 +2021,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00185 seconds
+  54 entries computed in 0.00297 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -2007,7 +2032,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00183 seconds
+  54 entries computed in 0.0025 seconds
   Shape of reference tensor: (3, 3, 6)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -2017,6 +2042,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2030,7 +2056,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00127 seconds
+  18 entries computed in 0.00157 seconds
   Shape of reference tensor: (1, 3, 6)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -2041,7 +2067,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00119 seconds
+  9 entries computed in 0.00142 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2052,6 +2078,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2065,7 +2092,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00156 seconds
+  18 entries computed in 0.00203 seconds
   Shape of reference tensor: (1, 3, 6)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -2076,7 +2103,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00149 seconds
+  9 entries computed in 0.00182 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2087,7 +2114,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00156 seconds
+  18 entries computed in 0.00184 seconds
   Shape of reference tensor: (1, 3, 6)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -2098,7 +2125,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00149 seconds
+  9 entries computed in 0.0018 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2109,7 +2136,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00155 seconds
+  18 entries computed in 0.00181 seconds
   Shape of reference tensor: (1, 3, 6)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5]]
@@ -2120,7 +2147,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00149 seconds
+  9 entries computed in 0.00181 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2131,6 +2158,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2162,7 +2190,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00213 seconds
+  9 entries computed in 0.00262 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2173,7 +2201,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00209 seconds
+  9 entries computed in 0.00281 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2184,7 +2212,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00216 seconds
+  18 entries computed in 0.00276 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2195,7 +2223,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00212 seconds
+  18 entries computed in 0.00259 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2206,7 +2234,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00199 seconds
+  9 entries computed in 0.00242 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2217,7 +2245,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00202 seconds
+  9 entries computed in 0.0025 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2228,7 +2256,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00212 seconds
+  18 entries computed in 0.00268 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2239,7 +2267,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00213 seconds
+  18 entries computed in 0.00277 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2250,7 +2278,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00201 seconds
+  9 entries computed in 0.00269 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2261,7 +2289,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.002 seconds
+  9 entries computed in 0.00265 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2272,7 +2300,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00212 seconds
+  18 entries computed in 0.00269 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2283,7 +2311,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00216 seconds
+  18 entries computed in 0.00262 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2294,7 +2322,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00202 seconds
+  9 entries computed in 0.00251 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2305,7 +2333,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00206 seconds
+  9 entries computed in 0.00249 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2316,7 +2344,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.0022 seconds
+  18 entries computed in 0.00265 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2327,7 +2355,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00221 seconds
+  18 entries computed in 0.00268 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2338,7 +2366,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00209 seconds
+  9 entries computed in 0.00251 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2349,7 +2377,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.0021 seconds
+  9 entries computed in 0.00262 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2360,7 +2388,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00222 seconds
+  18 entries computed in 0.00276 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2371,7 +2399,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00222 seconds
+  18 entries computed in 0.00379 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2382,7 +2410,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00211 seconds
+  9 entries computed in 0.00296 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2393,7 +2421,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00209 seconds
+  9 entries computed in 0.00257 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2404,7 +2432,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00221 seconds
+  18 entries computed in 0.0031 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2415,7 +2443,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00221 seconds
+  18 entries computed in 0.00271 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2426,7 +2454,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.0021 seconds
+  9 entries computed in 0.00252 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2437,7 +2465,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00211 seconds
+  9 entries computed in 0.00261 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2448,7 +2476,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00223 seconds
+  18 entries computed in 0.00299 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2459,7 +2487,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00221 seconds
+  18 entries computed in 0.00277 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2470,7 +2498,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00209 seconds
+  9 entries computed in 0.00261 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2481,7 +2509,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.0021 seconds
+  9 entries computed in 0.00277 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2492,7 +2520,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.0022 seconds
+  18 entries computed in 0.00266 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2503,7 +2531,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.0022 seconds
+  18 entries computed in 0.00271 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2514,7 +2542,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00211 seconds
+  9 entries computed in 0.00258 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2525,7 +2553,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.0021 seconds
+  9 entries computed in 0.00259 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2536,7 +2564,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.0022 seconds
+  18 entries computed in 0.00311 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2547,7 +2575,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.0022 seconds
+  18 entries computed in 0.00567 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2558,7 +2586,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00209 seconds
+  9 entries computed in 0.00551 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2569,7 +2597,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00199 seconds
+  9 entries computed in 0.00543 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2580,7 +2608,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00212 seconds
+  18 entries computed in 0.0042 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2591,7 +2619,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00214 seconds
+  18 entries computed in 0.00477 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2602,7 +2630,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00201 seconds
+  9 entries computed in 0.00454 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2613,7 +2641,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00201 seconds
+  9 entries computed in 0.00597 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2624,7 +2652,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00214 seconds
+  18 entries computed in 0.00659 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2635,7 +2663,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00213 seconds
+  18 entries computed in 0.00597 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2646,7 +2674,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00202 seconds
+  9 entries computed in 0.00573 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2657,7 +2685,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00202 seconds
+  9 entries computed in 0.00509 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2668,7 +2696,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00214 seconds
+  18 entries computed in 0.00476 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2679,7 +2707,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00209 seconds
+  18 entries computed in 0.00467 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2690,7 +2718,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00208 seconds
+  9 entries computed in 0.00336 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2701,7 +2729,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00204 seconds
+  9 entries computed in 0.00247 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2712,7 +2740,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00206 seconds
+  18 entries computed in 0.00268 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2723,7 +2751,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00212 seconds
+  18 entries computed in 0.00263 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2734,7 +2762,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00204 seconds
+  9 entries computed in 0.00237 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2745,7 +2773,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00203 seconds
+  9 entries computed in 0.00252 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2756,7 +2784,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00213 seconds
+  18 entries computed in 0.00282 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2767,7 +2795,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00215 seconds
+  18 entries computed in 0.00312 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2778,7 +2806,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00201 seconds
+  9 entries computed in 0.00255 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2789,7 +2817,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00202 seconds
+  9 entries computed in 0.00258 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2800,7 +2828,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00213 seconds
+  18 entries computed in 0.00262 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2811,7 +2839,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00214 seconds
+  18 entries computed in 0.00269 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2822,7 +2850,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00203 seconds
+  9 entries computed in 0.00262 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2833,7 +2861,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00201 seconds
+  9 entries computed in 0.00261 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2844,7 +2872,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00212 seconds
+  18 entries computed in 0.00279 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2855,7 +2883,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00212 seconds
+  18 entries computed in 0.00272 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2866,7 +2894,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00205 seconds
+  9 entries computed in 0.00261 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2877,7 +2905,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00211 seconds
+  9 entries computed in 0.00274 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2888,7 +2916,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00221 seconds
+  18 entries computed in 0.00303 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2899,7 +2927,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00223 seconds
+  18 entries computed in 0.00293 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2910,7 +2938,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.0021 seconds
+  9 entries computed in 0.00275 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2921,7 +2949,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.00209 seconds
+  9 entries computed in 0.00274 seconds
   Shape of reference tensor: (1, 3, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -2932,7 +2960,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00221 seconds
+  18 entries computed in 0.00486 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2943,7 +2971,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  18 entries computed in 0.00223 seconds
+  18 entries computed in 0.00345 seconds
   Shape of reference tensor: (1, 6, 3)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2]]
@@ -2954,6 +2982,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2961,7 +2990,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000647 seconds
+  36 entries computed in 0.000983 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -2969,6 +2998,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2976,7 +3006,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000589 seconds
+  9 entries computed in 0.000853 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -2984,6 +3014,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2991,7 +3022,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000883 seconds
+  9 entries computed in 0.00137 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -3000,7 +3031,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000842 seconds
+  9 entries computed in 0.00113 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -3009,7 +3040,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.00088 seconds
+  9 entries computed in 0.00116 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -3017,13 +3048,14 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  3 entries computed in 0.000458 seconds
+  3 entries computed in 0.000564 seconds
   Shape of reference tensor: (3,)
   Primary multi index:   rank = 0 dims = [] indices = [[]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -3031,9 +3063,10 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.505273 seconds.
+Compiler stage 2 finished in 0.764338 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
@@ -3041,277 +3074,68 @@ Compiler stage 3: Optimizing intermediate representation
   Optimising expressions for cell integral
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.0111051 seconds.
+Compiler stage 3 finished in 0.0154691 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 6 element(s)
+  Generating code for 7 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: C1
-  Removing unused variable: C0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 6 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp0
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: C1
+  Removing unused variable: C0
+  Generating code for 7 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -3336,18 +3160,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.313285 seconds.
+Compiler stage 4 finished in 0.482668 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.00241518 seconds.
+Compiler stage 4.1 finished in 0.00313306 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./AdaptivePoisson.h.
-Compiler stage 5 finished in 0.00157809 seconds.
+Compiler stage 5 finished in 0.00250483 seconds.
 
-FFC finished in 1.2299 seconds.
+FFC finished in 2.14745 seconds.
+Output written to ./AdaptivePoisson.h.
diff --git a/demo/documented/auto-adaptive-poisson/cpp/main.cpp b/demo/documented/auto-adaptive-poisson/cpp/main.cpp
index cf34b7b..cb5f00d 100644
--- a/demo/documented/auto-adaptive-poisson/cpp/main.cpp
+++ b/demo/documented/auto-adaptive-poisson/cpp/main.cpp
@@ -55,27 +55,27 @@ class DirichletBoundary : public SubDomain
 int main()
 {
   // Create mesh and define function space
-  UnitSquareMesh mesh(8, 8);
-  AdaptivePoisson::BilinearForm::TrialSpace V(mesh);
+  auto mesh = std::make_shared<UnitSquareMesh>(8, 8);
+  auto V = std::make_shared<AdaptivePoisson::BilinearForm::TrialSpace>(mesh);
 
   // Define boundary condition
-  Constant u0(0.0);
-  DirichletBoundary boundary;
-  DirichletBC bc(V, u0, boundary);
+  auto u0 = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
+  auto bc = std::make_shared<DirichletBC>(V, u0, boundary);
 
   // Define variational forms
-  AdaptivePoisson::BilinearForm a(V, V);
-  AdaptivePoisson::LinearForm L(V);
-  Source f;
-  dUdN g;
-  L.f = f;
-  L.g = g;
+  auto a = std::make_shared<AdaptivePoisson::BilinearForm>(V, V);
+  auto L = std::make_shared<AdaptivePoisson::LinearForm>(V);
+  auto f = std::make_shared<Source>();
+  auto g = std::make_shared<dUdN>();
+  L->f = f;
+  L->g = g;
 
   // Define Function for solution
-  Function u(V);
+  auto u = std::make_shared<Function>(V);
 
   // Define goal functional (quantity of interest)
-  AdaptivePoisson::GoalFunctional M(mesh);
+  auto M = std::make_shared<AdaptivePoisson::GoalFunctional>(mesh);
 
   // Define error tolerance
   double tol = 1.e-5;
@@ -83,17 +83,20 @@ int main()
   // Solve equation a = L with respect to u and the given boundary
   // conditions, such that the estimated error (measured in M) is less
   // than tol
-  LinearVariationalProblem problem(a, L, u, bc);
+  std::vector<std::shared_ptr<const DirichletBC>> bcs({bc});
+  auto problem = std::make_shared<LinearVariationalProblem>(a, L, u, bcs);
   AdaptiveLinearVariationalSolver solver(problem, M);
-  solver.parameters("error_control")("dual_variational_solver")["linear_solver"] = "cg";
-  solver.parameters("error_control")("dual_variational_solver")["symmetric"] = true;
+  solver.parameters("error_control")("dual_variational_solver")["linear_solver"]
+    = "cg";
+  solver.parameters("error_control")("dual_variational_solver")["symmetric"]
+    = true;
   solver.solve(tol);
 
   solver.summary();
 
   // Plot final solution
-  plot(u.root_node(), "Solution on initial mesh");
-  plot(u.leaf_node(), "Solution on final mesh");
+  plot(u->root_node(), "Solution on initial mesh");
+  plot(u->leaf_node(), "Solution on final mesh");
   interactive();
 
   return 0;
diff --git a/demo/documented/auto-adaptive-poisson/python/documentation.rst b/demo/documented/auto-adaptive-poisson/python/documentation.rst
index 70dfcbb..53f8d42 100644
--- a/demo/documented/auto-adaptive-poisson/python/documentation.rst
+++ b/demo/documented/auto-adaptive-poisson/python/documentation.rst
@@ -23,7 +23,7 @@ First, the dolfin module is imported:
 
 .. code-block:: python
 
-	from dolfin import *
+    from dolfin import *
 
 We begin by defining a mesh of the domain and a finite element
 function space V relative to this mesh. We used the built-in mesh
@@ -149,4 +149,4 @@ Complete code
 -------------
 
 .. literalinclude:: demo_auto-adaptive-poisson.py
-	:start-after: # Begin demo
+    :start-after: # Begin demo
diff --git a/demo/documented/bcs/cpp/CMakeLists.txt b/demo/documented/bcs/cpp/CMakeLists.txt
index cbe36de..6866a7a 100644
--- a/demo/documented/bcs/cpp/CMakeLists.txt
+++ b/demo/documented/bcs/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/bcs/cpp/Poisson.h b/demo/documented/bcs/cpp/Poisson.h
index 08323c2..cae5e0a 100644
--- a/demo/documented/bcs/cpp/Poisson.h
+++ b/demo/documented/bcs/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -257,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -279,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -318,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -330,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -339,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1041,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1098,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1106,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1132,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1171,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1219,151 +1222,92 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    case 3:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
   {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 4;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    case 3:
-      {
-        return 0;
+        return 3;
         break;
       }
     }
@@ -1371,279 +1315,3487 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    return 3;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-        break;
-      }
-    case 3:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-        break;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 3)
-    {
-    throw std::runtime_error("d is larger than dimension (3)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        
+        return 3;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  std::size_t reference_value_size() const final override
   {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
+    return 3;
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    27
-    // Number of operations (multiply-add pairs) for tensor contraction: 28
-    // Total number of operations (multiply-add pairs):                  58
-    
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
     double detJ;
     compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
-    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
-    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
-    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
-    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
-    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
-    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
-    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
-    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
-    // Compute element tensor
-    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
-    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
-    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
-    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
-    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
-    A[5] = 0.166666666666667*G0_0_0;
-    A[6] = 0.166666666666667*G0_0_1;
-    A[7] = 0.166666666666667*G0_0_2;
-    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
-    A[9] = 0.166666666666667*G0_1_0;
-    A[10] = 0.166666666666667*G0_1_1;
-    A[11] = 0.166666666666667*G0_1_2;
-    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
-    A[13] = 0.166666666666667*G0_2_0;
-    A[14] = 0.166666666666667*G0_2_1;
-    A[15] = 0.166666666666667*G0_2_2;
-  }
-
-};
-
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 3*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 9;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 3;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
+  }
+
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    27
+    // Number of operations (multiply-add pairs) for tensor contraction: 28
+    // Total number of operations (multiply-add pairs):                  58
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
+    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
+    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
+    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
+    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
+    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
+    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
+    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
+    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    
+    // Compute element tensor
+    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
+    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
+    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
+    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
+    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
+    A[5] = 0.166666666666667*G0_0_0;
+    A[6] = 0.166666666666667*G0_0_1;
+    A[7] = 0.166666666666667*G0_0_2;
+    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
+    A[9] = 0.166666666666667*G0_1_0;
+    A[10] = 0.166666666666667*G0_1_1;
+    A[11] = 0.166666666666667*G0_1_2;
+    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
+    A[13] = 0.166666666666667*G0_2_0;
+    A[14] = 0.166666666666667*G0_2_1;
+    A[15] = 0.166666666666667*G0_2_2;
+  }
+
+};
+
+
+class poisson_cell_integral_1_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_1_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    4
     // Number of operations (multiply-add pairs) for tensor contraction: 14
     // Total number of operations (multiply-add pairs):                  21
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1668,66 +4820,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_0()
+  ~poisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "c0818ce1aa2ed8a77073be076a17c28ea7740c12518bb8fc54089851e2e5204c44d23a64e78ed40c8033e971f5acfc59ae485d0533587661ca63f65f8adf4f58";
+    return "b067fdec5b57eb0d24160ee2ed23cc1e07dec125c2967130614394756d24f05616cdef65da45c972a75c3566205666d29389d7a989018f123e42f42efed5357f";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1746,8 +4890,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1766,192 +4909,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "053c29b0c24f1ac3175b0cd77af28e3d3f6a58a66b7f57342ffa6a931a0130fb972afdcc2cd4d374109faff5696ad57c5820a436d946dc2f1f867d42659f57a9";
+    return "470381f6c50d836d63b6912c4a746c1a99cd16761099e4c805917a5cd062fe3d5fddfc0f6f28a8c3569d0963e530883569d351198336cf8b410d96d777e71761";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1970,8 +5141,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1990,126 +5160,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -2123,14 +5329,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -2139,43 +5351,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2186,43 +5375,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2233,63 +5399,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -2297,7 +5470,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -2327,57 +5500,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -2385,69 +5613,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2479,18 +5748,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/bcs/cpp/compile.log b/demo/documented/bcs/cpp/compile.log
index bcabf54..eba68ec 100644
--- a/demo/documented/bcs/cpp/compile.log
+++ b/demo/documented/bcs/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<3 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -30,8 +31,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<3 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -39,18 +40,27 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.052 seconds.
+Compiler stage 1 finished in 0.106745 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -60,7 +70,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000788 seconds
+  144 entries computed in 0.000975 seconds
   Shape of reference tensor: (4, 4, 3, 3)
   Primary multi index:   rank = 2 dims = [4, 4] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -68,6 +78,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   External multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -75,7 +86,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  16 entries computed in 0.000709 seconds
+  16 entries computed in 0.000903 seconds
   Shape of reference tensor: (4, 4)
   Primary multi index:   rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   Secondary multi index: rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
@@ -83,114 +94,164 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.006037 seconds.
+Compiler stage 2 finished in 0.013721 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000154972 seconds.
+Compiler stage 3 finished in 0.000275135 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0698678 seconds.
+Compiler stage 4 finished in 0.301978 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000610828 seconds.
+Compiler stage 4.1 finished in 0.000897169 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000678062 seconds.
+Compiler stage 5 finished in 0.000922918 seconds.
 
-FFC finished in 0.129702 seconds.
+FFC finished in 0.425078 seconds.
+Output written to ./Poisson.h.
diff --git a/demo/documented/bcs/cpp/main.cpp b/demo/documented/bcs/cpp/main.cpp
index 397ad4b..17365da 100644
--- a/demo/documented/bcs/cpp/main.cpp
+++ b/demo/documented/bcs/cpp/main.cpp
@@ -30,20 +30,20 @@ using namespace dolfin;
 int main()
 {
   // Create mesh and finite element
-  Mesh mesh("../aneurysm.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../aneurysm.xml.gz");
 
   // Define variational problem
-  Constant f(0.0);
-  Poisson::FunctionSpace V(mesh);
+  auto f = std::make_shared<Constant>(0.0);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
   Poisson::BilinearForm a(V, V);
   Poisson::LinearForm L(V);
   L.f = f;
 
   // Define boundary condition values
-  Constant u0(0.0);
-  Constant u1(1.0);
-  Constant u2(2.0);
-  Constant u3(3.0);
+  auto u0 = std::make_shared<Constant>(0.0);
+  auto u1 = std::make_shared<Constant>(1.0);
+  auto u2 = std::make_shared<Constant>(2.0);
+  auto u3 = std::make_shared<Constant>(3.0);
 
   // Define boundary conditions
   DirichletBC bc0(V, u0, 0);
diff --git a/demo/documented/bcs/python/documentation.rst b/demo/documented/bcs/python/documentation.rst
index ba0f612..e6bed96 100644
--- a/demo/documented/bcs/python/documentation.rst
+++ b/demo/documented/bcs/python/documentation.rst
@@ -24,7 +24,7 @@ First, the :py:mod:`dolfin` module is imported:
 
 .. code-block:: python
 
-	from dolfin import *
+    from dolfin import *
 
 Then, we import the mesh and create a finite element function space
 :math:`V` relative to this mesh. In this case we create a
@@ -33,9 +33,9 @@ Then, we import the mesh and create a finite element function space
 
 .. code-block:: python
 
-	# Create mesh and define function space
-	mesh = Mesh("../aneurysm.xml.gz")
-	V = FunctionSpace(mesh, "CG", 1)
+    # Create mesh and define function space
+    mesh = Mesh("../aneurysm.xml.gz")
+    V = FunctionSpace(mesh, "CG", 1)
 
 Now, we define the trial function u and the test function v, both living in the function space ``V``. We also define our variational problem, a and L. u and v are defined using the classes
 :py:class:`TrialFunction <dolfin.functions.function.TrialFunction>` and
@@ -47,12 +47,12 @@ Thus, the definition of the variational problem reads:
 
 .. code-block:: python
 
-	# Define variational problem
-	u = TrialFunction(V)
-	v = TestFunction(V)
-	f = Constant(0.0)
-	a = dot(grad(u), grad(v))*dx
-	L = f*v*dx
+    # Define variational problem
+    u = TrialFunction(V)
+    v = TestFunction(V)
+    f = Constant(0.0)
+    a = dot(grad(u), grad(v))*dx
+    L = f*v*dx
 
 Before we can solve the problem we must specify the boundary conditions.
 We begin with specifying the values of the boundary conditions as :py:class:`Constant <dolfin.functions.constant.Constant>`s.
@@ -60,17 +60,17 @@ Then we use the class :py:class:`DirichletBC <dolfin.fem.bcs.DirichletBC>` to de
 
 .. code-block:: python
 
-	# Define boundary condition values
-	u0 = Constant(0.0)
-	u1 = Constant(1.0)
-	u2 = Constant(2.0)
-	u3 = Constant(3.0)
+    # Define boundary condition values
+    u0 = Constant(0.0)
+    u1 = Constant(1.0)
+    u2 = Constant(2.0)
+    u3 = Constant(3.0)
 
-	# Define boundary conditions
-	bc0 = DirichletBC(V, u0, 0)
-	bc1 = DirichletBC(V, u1, 1)
-	bc2 = DirichletBC(V, u2, 2)
-	bc3 = DirichletBC(V, u3, 3)
+    # Define boundary conditions
+    bc0 = DirichletBC(V, u0, 0)
+    bc1 = DirichletBC(V, u1, 1)
+    bc2 = DirichletBC(V, u2, 2)
+    bc3 = DirichletBC(V, u3, 3)
 
 :py:class:`DirichletBC <dolfin.fem.bcs.DirichletBC>` takes three arguments, the first one is our function space ``V``,
 the next is the boundary condition value and the third is the subdomain indicator which is information stored in the mesh.
@@ -80,19 +80,19 @@ At this point we are ready to create a :py:class:`Function <dolfin.cpp.function.
 
 .. code-block:: python
 
-	# Compute solution
-	u = Function(V)
-	solve(a == L, u, [bc0, bc1, bc2, bc3])
+    # Compute solution
+    u = Function(V)
+    solve(a == L, u, [bc0, bc1, bc2, bc3])
 
 When we have solved the problem, we save the solution to file and plot it.
 
 .. code-block:: python
 
-	# Write solution to file
-	File("u.pvd") << u
+    # Write solution to file
+    File("u.pvd") << u
 
-	# Plot solution
-	plot(u, interactive=True)
+    # Plot solution
+    plot(u, interactive=True)
 
 
 Complete code
diff --git a/demo/documented/biharmonic/cpp/Biharmonic.h b/demo/documented/biharmonic/cpp/Biharmonic.h
index ecf9842..6df143e 100644
--- a/demo/documented/biharmonic/cpp/Biharmonic.h
+++ b/demo/documented/biharmonic/cpp/Biharmonic.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,388 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __BIHARMONIC_H
 #define __BIHARMONIC_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class biharmonic_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   biharmonic_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~biharmonic_finite_element_0()
+  ~biharmonic_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new biharmonic_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class biharmonic_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  biharmonic_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~biharmonic_finite_element_1()
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 6;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -403,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -418,33 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -454,33 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -490,141 +192,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -634,48 +220,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -695,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -716,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -754,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -776,81 +358,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -865,9 +427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -877,11 +439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -891,11 +453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -904,9 +466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -927,81 +489,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1016,9 +558,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1028,11 +570,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1042,11 +584,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1055,9 +597,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1078,81 +620,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1167,9 +689,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1179,11 +701,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1193,11 +715,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1206,9 +728,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1225,34 +747,3040 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new biharmonic_finite_element_0();
+  }
+
+};
+
+
+class biharmonic_finite_element_1: public ufc::finite_element
+{
+public:
+
+  biharmonic_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~biharmonic_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new biharmonic_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new biharmonic_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new biharmonic_finite_element_1();
+  }
+
+};
+
+
+class biharmonic_finite_element_2: public ufc::finite_element
+{
+public:
+
+  biharmonic_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~biharmonic_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Real', triangle, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Real";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new biharmonic_finite_element_2();
+  }
+
+};
+
+
+class biharmonic_finite_element_3: public ufc::finite_element
+{
+public:
+
+  biharmonic_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~biharmonic_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -1268,7 +3796,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1376,7 +3904,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 5:
       {
         
       // Array of basisvalues
@@ -1403,7 +3931,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -1419,7 +3947,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1520,424 +4048,678 @@ public:
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new biharmonic_finite_element_3();
+  }
+
+};
+
+
+class biharmonic_dofmap_0: public ufc::dofmap
+{
+public:
+
+  biharmonic_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~biharmonic_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
         break;
       }
-    case 5:
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+        dofs[0] = 1;
+      dofs[1] = 2;
+        break;
+      }
+    case 1:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+        dofs[0] = 0;
+      dofs[1] = 2;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      switch (i)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+      case 0:
         {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
         {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
         {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+          dofs[0] = 2;
+          break;
+        }
+      }
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new biharmonic_dofmap_0();
+  }
+
+};
+
+
+class biharmonic_dofmap_1: public ufc::dofmap
+{
+public:
+
+  biharmonic_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~biharmonic_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
         break;
       }
     }
     
+    return false;
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  std::size_t topological_dimension() const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    return 2;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+    return 2*num_global_entities[0];
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  std::size_t num_element_dofs() const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    return 6;
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  std::size_t num_facet_dofs() const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 2;
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 3:
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
-    case 4:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
-    case 5:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
-    return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
     
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new biharmonic_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new biharmonic_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new biharmonic_finite_element_1();
+    return new biharmonic_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class biharmonic_dofmap_0: public ufc::dofmap
+class biharmonic_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  biharmonic_dofmap_0() : ufc::dofmap()
+  biharmonic_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~biharmonic_dofmap_0()
+  ~biharmonic_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1961,39 +4743,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2017,17 +4788,15 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     dofs[0] = 0;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2050,9 +4819,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2085,61 +4853,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new biharmonic_dofmap_0();
+    return new biharmonic_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class biharmonic_dofmap_1: public ufc::dofmap
+class biharmonic_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  biharmonic_dofmap_1() : ufc::dofmap()
+  biharmonic_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~biharmonic_dofmap_1()
+  ~biharmonic_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2163,39 +4915,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2219,25 +4960,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2266,9 +5005,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2342,80 +5080,53 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new biharmonic_dofmap_1();
+    return new biharmonic_dofmap_3();
   }
 
 };
 
-/// 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 biharmonic_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   biharmonic_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~biharmonic_cell_integral_0_otherwise()
+  ~biharmonic_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2527,46 +5238,39 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// interior facet tensor corresponding to the local contribution to
-/// a form from the integral over an interior facet.
 
 class biharmonic_interior_facet_integral_0_otherwise: public ufc::interior_facet_integral
 {
 public:
 
-  /// Constructor
   biharmonic_interior_facet_integral_0_otherwise() : ufc::interior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~biharmonic_interior_facet_integral_0_otherwise()
+  ~biharmonic_interior_facet_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local interior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates_0,
-                               const double*  vertex_coordinates_1,
-                               std::size_t facet_0,
-                               std::size_t facet_1,
-                               int cell_orientation_0,
-                               int cell_orientation_1) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs_0,
+                       const double * coordinate_dofs_1,
+                       std::size_t facet_0,
+                       std::size_t facet_1,
+                       int cell_orientation_0,
+                       int cell_orientation_1) const final override
   {
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -2575,7 +5279,7 @@ public:
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -2590,12 +5294,12 @@ public:
     const unsigned int v1 = edge_vertices[facet_0][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates_0[2*v1 + 0] - vertex_coordinates_0[2*v0 + 0];
-    const double dx1 = vertex_coordinates_0[2*v1 + 1] - vertex_coordinates_0[2*v0 + 1];
+    const double dx0 = coordinate_dofs_0[2*v1 + 0] - coordinate_dofs_0[2*v0 + 0];
+    const double dx1 = coordinate_dofs_0[2*v1 + 1] - coordinate_dofs_0[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates_0[2*facet_0] - vertex_coordinates_0[2*v0]) - dx0*(vertex_coordinates_0[2*facet_0 + 1] - vertex_coordinates_0[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs_0[2*facet_0] - coordinate_dofs_0[2*v0]) - dx0*(coordinate_dofs_0[2*facet_0 + 1] - coordinate_dofs_0[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n_00 = direction ? dx1 / det : -dx1 / det;
     const double n_01 = direction ? -dx0 / det : dx0 / det;// Compute facet normals from the facet scale factor constants
@@ -2609,12 +5313,12 @@ public:
     
     
     // Compute circumradius of triangle in 2D
-    const double v1v2_0  = std::sqrt((vertex_coordinates_0[4] - vertex_coordinates_0[2])*(vertex_coordinates_0[4] - vertex_coordinates_0[2]) + (vertex_coordinates_0[5] - vertex_coordinates_0[3])*(vertex_coordinates_0[5] - vertex_coordinates_0[3]) );
+    const double v1v2_0  = std::sqrt((coordinate_dofs_0[4] - coordinate_dofs_0[2])*(coordinate_dofs_0[4] - coordinate_dofs_0[2]) + (coordinate_dofs_0[5] - coordinate_dofs_0[3])*(coordinate_dofs_0[5] - coordinate_dofs_0[3]) );
     const double v0v2_0  = std::sqrt(J_0[3]*J_0[3] + J_0[1]*J_0[1]);
     const double v0v1_0  = std::sqrt(J_0[0]*J_0[0] + J_0[2]*J_0[2]);
     const double circumradius_0 = 0.25*(v1v2_0*v0v2_0*v0v1_0)/(volume_0);
     // Compute circumradius of triangle in 2D
-    const double v1v2_1  = std::sqrt((vertex_coordinates_1[4] - vertex_coordinates_1[2])*(vertex_coordinates_1[4] - vertex_coordinates_1[2]) + (vertex_coordinates_1[5] - vertex_coordinates_1[3])*(vertex_coordinates_1[5] - vertex_coordinates_1[3]) );
+    const double v1v2_1  = std::sqrt((coordinate_dofs_1[4] - coordinate_dofs_1[2])*(coordinate_dofs_1[4] - coordinate_dofs_1[2]) + (coordinate_dofs_1[5] - coordinate_dofs_1[3])*(coordinate_dofs_1[5] - coordinate_dofs_1[3]) );
     const double v0v2_1  = std::sqrt(J_1[3]*J_1[3] + J_1[1]*J_1[1]);
     const double v0v1_1  = std::sqrt(J_1[0]*J_1[0] + J_1[2]*J_1[2]);
     const double circumradius_1 = 0.25*(v1v2_1*v0v2_1*v0v1_1)/(volume_1);
@@ -2626,84 +5330,66 @@ public:
     
     // Values of basis functions at quadrature points.
     static const double FE0_f0_D01[2][5] = \
-    {{0.999999999999995, -0.15470053837925, 3.15470053837924, -0.845299461620737, -3.15470053837925},
-    {0.999999999999995, 2.15470053837925, 0.845299461620732, -3.15470053837924, -0.845299461620747}};
+    {{0.999999999999996, -0.15470053837925, 3.15470053837924, -0.845299461620738, -3.15470053837925},
+    {0.999999999999996, 2.15470053837925, 0.845299461620733, -3.15470053837924, -0.845299461620747}};
     
     // Array of non-zero columns
     static const unsigned int nzc1[5] = {0, 2, 3, 4, 5};
     
-    static const double FE0_f0_D02[2][4] = \
-    {{4.0, 4, 0.0, -8},
-    {4, 4, -1.19904086659517e-14, -7.99999999999999}};
+    static const double FE0_f0_D02[2][3] = \
+    {{4.0, 4, -8},
+    {4.0, 4, -7.99999999999999}};
     
     // Array of non-zero columns
-    static const unsigned int nzc2[4] = {0, 2, 3, 4};
-    
-    static const double FE0_f0_D10[2][5] = \
-    {{1, 2.15470053837925, 0.845299461620747, -0.845299461620747, -3.15470053837926},
-    {1.0, -0.154700538379252, 3.15470053837925, -3.15470053837925, -0.845299461620748}};
+    static const unsigned int nzc2[3] = {0, 2, 4};
     
     // Array of non-zero columns
-    static const unsigned int nzc3[5] = {0, 1, 3, 4, 5};
-    
-    static const double FE0_f0_D11[2][5] = \
-    {{4, 1.19904086659517e-14, 3.99999999999999, -3.99999999999999, -4.00000000000002},
-    {4, 0.0, 3.99999999999999, -3.99999999999999, -4}};
+    static const unsigned int nzc5[3] = {0, 1, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc4[5] = {0, 1, 3, 4, 5};
+    static const unsigned int nzc9[3] = {0, 1, 5};
     
-    static const double FE0_f0_D20[2][3] = \
-    {{4, 4, -8},
-    {4, 4, -8}};
+    static const double FE0_f0_D10[2][5] = \
+    {{1, 2.15470053837925, 0.845299461620747, -0.845299461620747, -3.15470053837925},
+    {1.0, -0.154700538379251, 3.15470053837925, -3.15470053837925, -0.84529946162075}};
     
     // Array of non-zero columns
-    static const unsigned int nzc5[3] = {0, 1, 5};
+    static const unsigned int nzc3[5] = {0, 1, 3, 4, 5};
+    
+    static const double FE0_f0_D11[2][4] = \
+    {{4.0, 3.99999999999999, -3.99999999999999, -4.00000000000001},
+    {4, 3.99999999999999, -3.99999999999999, -4.00000000000001}};
     
     // Array of non-zero columns
-    static const unsigned int nzc12[3] = {0, 2, 4};
+    static const unsigned int nzc4[4] = {0, 3, 4, 5};
     
     static const double FE0_f1_D01[2][4] = \
-    {{-2.15470053837926, -0.15470053837925, -1.13242748511766e-14, 2.30940107675851},
-    {0.154700538379246, 2.15470053837925, -1.64313007644523e-14, -2.30940107675849}};
+    {{-2.15470053837926, -0.15470053837925, -1.06581410364015e-14, 2.30940107675851},
+    {0.154700538379246, 2.15470053837925, -1.55431223447522e-14, -2.30940107675849}};
     
     // Array of non-zero columns
     static const unsigned int nzc7[4] = {0, 2, 3, 4};
     
     static const double FE0_f1_D10[2][5] = \
-    {{-2.15470053837925, -1, 0.845299461620747, -0.845299461620747, 3.15470053837925},
-    {0.15470053837925, -1, 3.15470053837925, -3.15470053837925, 0.845299461620751}};
+    {{-2.15470053837925, -1, 0.845299461620747, -0.845299461620747, 3.15470053837926},
+    {0.154700538379251, -1, 3.15470053837925, -3.15470053837925, 0.84529946162075}};
     
     // Array of non-zero columns
     static const unsigned int nzc8[5] = {0, 1, 3, 4, 5};
     
-    static const double FE0_f1_D20[2][3] = \
-    {{4, 4, -7.99999999999999},
-    {4, 4, -7.99999999999999}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc9[3] = {0, 1, 5};
-    
     static const double FE0_f2_D01[2][5] = \
-    {{-2.15470053837926, -1.0, 0.845299461620738, 3.15470053837926, -0.845299461620748},
-    {0.154700538379247, -1.0, 3.15470053837924, 0.84529946162076, -3.15470053837925}};
+    {{-2.15470053837926, -1.0, 0.845299461620739, 3.15470053837926, -0.845299461620748},
+    {0.154700538379247, -1.0, 3.15470053837924, 0.845299461620759, -3.15470053837925}};
     
     // Array of non-zero columns
     static const unsigned int nzc11[5] = {0, 2, 3, 4, 5};
     
     static const double FE0_f2_D10[2][3] = \
-    {{-2.15470053837925, -0.154700538379254, 2.30940107675851},
-    {0.154700538379254, 2.15470053837925, -2.3094010767585}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc13[3] = {0, 1, 5};
-    
-    static const double FE0_f2_D11[2][5] = \
-    {{4, 0.0, 4, -4, -4.00000000000001},
-    {4, 1.24344978758018e-14, 4, -4, -4.00000000000002}};
+    {{-2.15470053837925, -0.154700538379254, 2.3094010767585},
+    {0.154700538379253, 2.15470053837925, -2.3094010767585}};
     
     // Array of non-zero columns
-    static const unsigned int nzc14[5] = {0, 1, 3, 4, 5};
+    static const unsigned int nzc12[3] = {0, 1, 5};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 144; r++)
@@ -2712,40 +5398,40 @@ public:
     } // end loop over 'r'
     // Number of operations to compute geometry constants: 464.
     double G[34];
-    G[0] = 0.5*det*(K_1[2]*n_00*(K_1[0]*K_1[0] + K_1[1]*K_1[1]) + K_1[3]*n_01*(K_1[0]*K_1[0] + K_1[1]*K_1[1]));
-    G[1] = 0.5*det*(K_1[0]*K_1[0]*K_1[0]*n_00 + K_1[1]*(K_1[0]*K_1[1]*n_00 + n_01*(K_1[0]*K_1[0] + K_1[1]*K_1[1])));
-    G[2] = -0.5*det*(K_1[0]*K_1[0]*(K_0[2]*n_00 + K_0[3]*n_01) + K_1[1]*K_1[1]*(K_0[2]*n_00 + K_0[3]*n_01));
-    G[3] = -0.5*det*(K_1[0]*K_1[0]*(K_0[0]*n_00 + K_0[1]*n_01) + K_1[1]*K_1[1]*(K_0[0]*n_00 + K_0[1]*n_01));
-    G[4] = 0.5*det*(K_1[2]*n_00*(K_0[0]*K_0[0] + K_0[1]*K_0[1]) + K_1[3]*n_01*(K_0[0]*K_0[0] + K_0[1]*K_0[1]));
-    G[5] = 0.5*det*(K_1[0]*n_00*(K_0[0]*K_0[0] + K_0[1]*K_0[1]) + K_1[1]*n_01*(K_0[0]*K_0[0] + K_0[1]*K_0[1]));
-    G[6] = -0.5*det*(K_0[2]*n_00*(K_0[0]*K_0[0] + K_0[1]*K_0[1]) + K_0[3]*n_01*(K_0[0]*K_0[0] + K_0[1]*K_0[1]));
-    G[7] = -0.5*det*(K_0[0]*K_0[0]*K_0[0]*n_00 + K_0[1]*(K_0[0]*K_0[1]*n_00 + n_01*(K_0[0]*K_0[0] + K_0[1]*K_0[1])));
-    G[8] = 0.5*det*(K_1[2]*K_1[2]*K_1[2]*n_00 + K_1[3]*(K_1[2]*K_1[3]*n_00 + n_01*(K_1[2]*K_1[2] + K_1[3]*K_1[3])));
-    G[9] = 0.5*det*(K_1[2]*K_1[2]*(K_1[0]*n_00 + K_1[1]*n_01) + K_1[3]*K_1[3]*(K_1[0]*n_00 + K_1[1]*n_01));
-    G[10] = -0.5*det*(K_1[2]*K_1[2]*(K_0[2]*n_00 + K_0[3]*n_01) + K_1[3]*K_1[3]*(K_0[2]*n_00 + K_0[3]*n_01));
-    G[11] = -0.5*det*(K_1[2]*K_1[2]*(K_0[0]*n_00 + K_0[1]*n_01) + K_1[3]*K_1[3]*(K_0[0]*n_00 + K_0[1]*n_01));
-    G[12] = 0.5*det*(K_1[2]*n_00*(K_0[2]*K_0[2] + K_0[3]*K_0[3]) + K_1[3]*n_01*(K_0[2]*K_0[2] + K_0[3]*K_0[3]));
-    G[13] = 0.5*det*(K_1[0]*n_00*(K_0[2]*K_0[2] + K_0[3]*K_0[3]) + K_1[1]*n_01*(K_0[2]*K_0[2] + K_0[3]*K_0[3]));
-    G[14] = -0.5*det*(K_0[2]*K_0[2]*K_0[2]*n_00 + K_0[3]*(K_0[2]*K_0[3]*n_00 + n_01*(K_0[2]*K_0[2] + K_0[3]*K_0[3])));
-    G[15] = -0.5*det*(K_0[2]*K_0[2]*(K_0[0]*n_00 + K_0[1]*n_01) + K_0[3]*K_0[3]*(K_0[0]*n_00 + K_0[1]*n_01));
-    G[16] = det*w[0][0]*(K_1[2]*K_1[2]*n_00*n_00 + K_1[3]*n_01*(2.0*K_1[2]*n_00 + K_1[3]*n_01))/(circumradius_0 + circumradius_1);
-    G[17] = det*w[0][0]*(K_1[0]*K_1[2]*n_00*n_00 + n_01*(K_1[1]*K_1[3]*n_01 + n_00*(K_1[0]*K_1[3] + K_1[1]*K_1[2])))/(circumradius_0 + circumradius_1);
-    G[18] = det*(K_1[0]*K_1[2]*K_1[2]*n_00 + K_1[3]*(K_1[1]*K_1[2]*n_00 + n_01*(K_1[0]*K_1[2] + K_1[1]*K_1[3])));
-    G[19] =  - det*w[0][0]*(K_0[2]*K_1[2]*n_00*n_00 + n_01*(K_0[3]*K_1[3]*n_01 + n_00*(K_0[2]*K_1[3] + K_0[3]*K_1[2])))/(circumradius_0 + circumradius_1);
-    G[20] =  - det*w[0][0]*(K_0[0]*K_1[2]*n_00*n_00 + n_01*(K_0[1]*K_1[3]*n_01 + n_00*(K_0[0]*K_1[3] + K_0[1]*K_1[2])))/(circumradius_0 + circumradius_1);
-    G[21] = det*(K_1[2]*n_00*(K_0[0]*K_0[2] + K_0[1]*K_0[3]) + K_1[3]*n_01*(K_0[0]*K_0[2] + K_0[1]*K_0[3]));
-    G[22] = det*w[0][0]*(K_1[0]*K_1[0]*n_00*n_00 + K_1[1]*n_01*(2.0*K_1[0]*n_00 + K_1[1]*n_01))/(circumradius_0 + circumradius_1);
-    G[23] = det*(K_1[0]*K_1[0]*K_1[2]*n_00 + K_1[1]*(K_1[0]*K_1[3]*n_00 + n_01*(K_1[0]*K_1[2] + K_1[1]*K_1[3])));
-    G[24] =  - det*w[0][0]*(K_0[2]*K_1[0]*n_00*n_00 + n_01*(K_0[3]*K_1[1]*n_01 + n_00*(K_0[2]*K_1[1] + K_0[3]*K_1[0])))/(circumradius_0 + circumradius_1);
-    G[25] =  - det*w[0][0]*(K_0[0]*K_1[0]*n_00*n_00 + n_01*(K_0[1]*K_1[1]*n_01 + n_00*(K_0[0]*K_1[1] + K_0[1]*K_1[0])))/(circumradius_0 + circumradius_1);
-    G[26] = det*(K_1[0]*n_00*(K_0[0]*K_0[2] + K_0[1]*K_0[3]) + K_1[1]*n_01*(K_0[0]*K_0[2] + K_0[1]*K_0[3]));
-    G[27] =  - det*(K_1[0]*K_1[2]*(K_0[2]*n_00 + K_0[3]*n_01) + K_1[1]*K_1[3]*(K_0[2]*n_00 + K_0[3]*n_01));
-    G[28] =  - det*(K_1[0]*K_1[2]*(K_0[0]*n_00 + K_0[1]*n_01) + K_1[1]*K_1[3]*(K_0[0]*n_00 + K_0[1]*n_01));
-    G[29] = det*w[0][0]*(K_0[2]*K_0[2]*n_00*n_00 + K_0[3]*n_01*(2.0*K_0[2]*n_00 + K_0[3]*n_01))/(circumradius_0 + circumradius_1);
-    G[30] = det*w[0][0]*(K_0[0]*K_0[2]*n_00*n_00 + n_01*(K_0[1]*K_0[3]*n_01 + n_00*(K_0[0]*K_0[3] + K_0[1]*K_0[2])))/(circumradius_0 + circumradius_1);
-    G[31] =  - det*(K_0[0]*K_0[2]*K_0[2]*n_00 + K_0[3]*(K_0[1]*K_0[2]*n_00 + n_01*(K_0[0]*K_0[2] + K_0[1]*K_0[3])));
-    G[32] = det*w[0][0]*(K_0[0]*K_0[0]*n_00*n_00 + K_0[1]*n_01*(2.0*K_0[0]*n_00 + K_0[1]*n_01))/(circumradius_0 + circumradius_1);
-    G[33] =  - det*(K_0[0]*K_0[0]*K_0[2]*n_00 + K_0[1]*(K_0[0]*K_0[3]*n_00 + n_01*(K_0[0]*K_0[2] + K_0[1]*K_0[3])));
+    G[0] = 0.5*det*(K_1[2]*K_1[2]*K_1[2]*n_00 + K_1[3]*(K_1[2]*K_1[3]*n_00 + n_01*(K_1[2]*K_1[2] + K_1[3]*K_1[3])));
+    G[1] = 0.5*det*(K_1[2]*K_1[2]*(K_1[0]*n_00 + K_1[1]*n_01) + K_1[3]*K_1[3]*(K_1[0]*n_00 + K_1[1]*n_01));
+    G[2] = -0.5*det*(K_1[2]*K_1[2]*(K_0[2]*n_00 + K_0[3]*n_01) + K_1[3]*K_1[3]*(K_0[2]*n_00 + K_0[3]*n_01));
+    G[3] = -0.5*det*(K_1[2]*K_1[2]*(K_0[0]*n_00 + K_0[1]*n_01) + K_1[3]*K_1[3]*(K_0[0]*n_00 + K_0[1]*n_01));
+    G[4] = 0.5*det*(K_1[2]*n_00*(K_1[0]*K_1[0] + K_1[1]*K_1[1]) + K_1[3]*n_01*(K_1[0]*K_1[0] + K_1[1]*K_1[1]));
+    G[5] = 0.5*det*(K_1[0]*K_1[0]*K_1[0]*n_00 + K_1[1]*(K_1[0]*K_1[1]*n_00 + n_01*(K_1[0]*K_1[0] + K_1[1]*K_1[1])));
+    G[6] = -0.5*det*(K_1[0]*K_1[0]*(K_0[2]*n_00 + K_0[3]*n_01) + K_1[1]*K_1[1]*(K_0[2]*n_00 + K_0[3]*n_01));
+    G[7] = -0.5*det*(K_1[0]*K_1[0]*(K_0[0]*n_00 + K_0[1]*n_01) + K_1[1]*K_1[1]*(K_0[0]*n_00 + K_0[1]*n_01));
+    G[8] = 0.5*det*(K_1[2]*n_00*(K_0[2]*K_0[2] + K_0[3]*K_0[3]) + K_1[3]*n_01*(K_0[2]*K_0[2] + K_0[3]*K_0[3]));
+    G[9] = 0.5*det*(K_1[0]*n_00*(K_0[2]*K_0[2] + K_0[3]*K_0[3]) + K_1[1]*n_01*(K_0[2]*K_0[2] + K_0[3]*K_0[3]));
+    G[10] = -0.5*det*(K_0[2]*K_0[2]*K_0[2]*n_00 + K_0[3]*(K_0[2]*K_0[3]*n_00 + n_01*(K_0[2]*K_0[2] + K_0[3]*K_0[3])));
+    G[11] = -0.5*det*(K_0[2]*K_0[2]*(K_0[0]*n_00 + K_0[1]*n_01) + K_0[3]*K_0[3]*(K_0[0]*n_00 + K_0[1]*n_01));
+    G[12] = 0.5*det*(K_1[2]*n_00*(K_0[0]*K_0[0] + K_0[1]*K_0[1]) + K_1[3]*n_01*(K_0[0]*K_0[0] + K_0[1]*K_0[1]));
+    G[13] = 0.5*det*(K_1[0]*n_00*(K_0[0]*K_0[0] + K_0[1]*K_0[1]) + K_1[1]*n_01*(K_0[0]*K_0[0] + K_0[1]*K_0[1]));
+    G[14] = -0.5*det*(K_0[2]*n_00*(K_0[0]*K_0[0] + K_0[1]*K_0[1]) + K_0[3]*n_01*(K_0[0]*K_0[0] + K_0[1]*K_0[1]));
+    G[15] = -0.5*det*(K_0[0]*K_0[0]*K_0[0]*n_00 + K_0[1]*(K_0[0]*K_0[1]*n_00 + n_01*(K_0[0]*K_0[0] + K_0[1]*K_0[1])));
+    G[16] = det*(K_1[0]*K_1[2]*K_1[2]*n_00 + K_1[3]*(K_1[1]*K_1[2]*n_00 + n_01*(K_1[0]*K_1[2] + K_1[1]*K_1[3])));
+    G[17] = det*(K_1[0]*K_1[0]*K_1[2]*n_00 + K_1[1]*(K_1[0]*K_1[3]*n_00 + n_01*(K_1[0]*K_1[2] + K_1[1]*K_1[3])));
+    G[18] =  - det*(K_1[0]*K_1[2]*(K_0[2]*n_00 + K_0[3]*n_01) + K_1[1]*K_1[3]*(K_0[2]*n_00 + K_0[3]*n_01));
+    G[19] =  - det*(K_1[0]*K_1[2]*(K_0[0]*n_00 + K_0[1]*n_01) + K_1[1]*K_1[3]*(K_0[0]*n_00 + K_0[1]*n_01));
+    G[20] = det*(K_1[2]*n_00*(K_0[0]*K_0[2] + K_0[1]*K_0[3]) + K_1[3]*n_01*(K_0[0]*K_0[2] + K_0[1]*K_0[3]));
+    G[21] = det*(K_1[0]*n_00*(K_0[0]*K_0[2] + K_0[1]*K_0[3]) + K_1[1]*n_01*(K_0[0]*K_0[2] + K_0[1]*K_0[3]));
+    G[22] =  - det*(K_0[0]*K_0[2]*K_0[2]*n_00 + K_0[3]*(K_0[1]*K_0[2]*n_00 + n_01*(K_0[0]*K_0[2] + K_0[1]*K_0[3])));
+    G[23] =  - det*(K_0[0]*K_0[0]*K_0[2]*n_00 + K_0[1]*(K_0[0]*K_0[3]*n_00 + n_01*(K_0[0]*K_0[2] + K_0[1]*K_0[3])));
+    G[24] = det*w[0][0]*(K_1[2]*K_1[2]*n_00*n_00 + K_1[3]*n_01*(2.0*K_1[2]*n_00 + K_1[3]*n_01))/(circumradius_0 + circumradius_1);
+    G[25] = det*w[0][0]*(K_1[0]*K_1[2]*n_00*n_00 + n_01*(K_1[1]*K_1[3]*n_01 + n_00*(K_1[0]*K_1[3] + K_1[1]*K_1[2])))/(circumradius_0 + circumradius_1);
+    G[26] =  - det*w[0][0]*(K_0[2]*K_1[2]*n_00*n_00 + n_01*(K_0[3]*K_1[3]*n_01 + n_00*(K_0[2]*K_1[3] + K_0[3]*K_1[2])))/(circumradius_0 + circumradius_1);
+    G[27] =  - det*w[0][0]*(K_0[0]*K_1[2]*n_00*n_00 + n_01*(K_0[1]*K_1[3]*n_01 + n_00*(K_0[0]*K_1[3] + K_0[1]*K_1[2])))/(circumradius_0 + circumradius_1);
+    G[28] = det*w[0][0]*(K_1[0]*K_1[0]*n_00*n_00 + K_1[1]*n_01*(2.0*K_1[0]*n_00 + K_1[1]*n_01))/(circumradius_0 + circumradius_1);
+    G[29] =  - det*w[0][0]*(K_0[2]*K_1[0]*n_00*n_00 + n_01*(K_0[3]*K_1[1]*n_01 + n_00*(K_0[2]*K_1[1] + K_0[3]*K_1[0])))/(circumradius_0 + circumradius_1);
+    G[30] =  - det*w[0][0]*(K_0[0]*K_1[0]*n_00*n_00 + n_01*(K_0[1]*K_1[1]*n_01 + n_00*(K_0[0]*K_1[1] + K_0[1]*K_1[0])))/(circumradius_0 + circumradius_1);
+    G[31] = det*w[0][0]*(K_0[2]*K_0[2]*n_00*n_00 + K_0[3]*n_01*(2.0*K_0[2]*n_00 + K_0[3]*n_01))/(circumradius_0 + circumradius_1);
+    G[32] = det*w[0][0]*(K_0[0]*K_0[2]*n_00*n_00 + n_01*(K_0[1]*K_0[3]*n_01 + n_00*(K_0[0]*K_0[3] + K_0[1]*K_0[2])))/(circumradius_0 + circumradius_1);
+    G[33] = det*w[0][0]*(K_0[0]*K_0[0]*n_00*n_00 + K_0[1]*n_01*(2.0*K_0[0]*n_00 + K_0[1]*n_01))/(circumradius_0 + circumradius_1);
     
     // Compute element tensor using UFL quadrature representation
     // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
@@ -2757,10 +5443,10 @@ public:
       {
       case 0:
         {
-          // Total number of operations to compute element tensor (from this point): 8228
+          // Total number of operations to compute element tensor (from this point): 7268
         
         // Loop quadrature points for integral.
-        // Number of operations to compute element tensor for following IP loop = 8228
+        // Number of operations to compute element tensor for following IP loop = 7268
         for (unsigned int ip = 0; ip < 2; ip++)
         {
           
@@ -2869,27 +5555,43 @@ public:
           I[33] = G[33]*W2[ip];
           
           
-          // Number of operations for primary indices: 360
+          // Number of operations for primary indices: 720
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[0];
+              A[(nzc2[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc2[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[1];
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[1];
+              A[(nzc2[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[2];
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[2];
+              A[(nzc2[j] + 6)*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[3];
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[3];
+              A[(nzc5[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[4];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[4];
+              A[(nzc5[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[5];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[5];
+              A[(nzc5[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[6];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[6];
+              A[(nzc5[j] + 6)*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[7];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[7];
+              A[nzc2[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[8];
+              // Number of operations to compute entry: 3
+              A[nzc2[j]*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[9];
+              // Number of operations to compute entry: 3
+              A[nzc2[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[10];
+              // Number of operations to compute entry: 3
+              A[nzc2[j]*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[11];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[12];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[13];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[14];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[15];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -2899,45 +5601,61 @@ public:
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[8];
+              A[(nzc4[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[9];
+              A[(nzc4[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[17];
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[10];
+              A[(nzc4[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[18];
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[11];
+              A[(nzc4[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[12];
+              A[nzc4[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[13];
+              A[nzc4[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[21];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[14];
+              A[nzc4[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[22];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[15];
+              A[nzc4[j]*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[23];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 360
+          // Number of operations for primary indices: 720
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[0];
+              A[(nzc1[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc1[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[4];
+              // Number of operations to compute entry: 3
+              A[(nzc1[j] + 6)*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[8];
+              // Number of operations to compute entry: 3
+              A[(nzc1[j] + 6)*12 + nzc5[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[12];
+              // Number of operations to compute entry: 3
+              A[(nzc3[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[1];
+              // Number of operations to compute entry: 3
+              A[(nzc3[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[5];
+              // Number of operations to compute entry: 3
+              A[(nzc3[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[9];
+              // Number of operations to compute entry: 3
+              A[(nzc3[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[13];
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc5[k]] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[4];
+              A[nzc1[j]*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[2];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[1];
+              A[nzc1[j]*12 + (nzc5[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[6];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc5[k]] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[5];
+              A[nzc1[j]*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[10];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc5[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[2];
+              A[nzc1[j]*12 + nzc5[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[14];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc5[k]] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[6];
+              A[nzc3[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[3];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc5[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[3];
+              A[nzc3[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[7];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc5[k]] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[7];
+              A[nzc3[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[11];
+              // Number of operations to compute entry: 3
+              A[nzc3[j]*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[15];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -2947,93 +5665,61 @@ public:
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[8];
+              A[(nzc1[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[12];
+              A[(nzc1[j] + 6)*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[9];
+              A[(nzc3[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[17];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[13];
+              A[(nzc3[j] + 6)*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[21];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[10];
+              A[nzc1[j]*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[18];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[14];
+              A[nzc1[j]*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[22];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[11];
+              A[nzc3[j]*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[15];
+              A[nzc3[j]*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[23];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 2400
+          // Number of operations for primary indices: 1200
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[16];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[17];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[18];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[19];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc3[k]] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[20];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[21];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[17];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[22];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[24];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[25];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[26];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[18];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[27];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[28];
-              // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[19];
+              A[(nzc1[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc3[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[24];
+              A[(nzc1[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[25];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[27];
+              A[(nzc1[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc1[k]] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[29];
+              A[(nzc1[j] + 6)*12 + nzc3[k]] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[27];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc3[k]] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[30];
+              A[(nzc3[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[25];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[31];
+              A[(nzc3[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[28];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[20];
+              A[(nzc3[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[25];
+              A[(nzc3[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[30];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[28];
+              A[nzc1[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[30];
+              A[nzc1[j]*12 + (nzc3[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc3[k]] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[32];
+              A[nzc1[j]*12 + nzc1[k]] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[31];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[33];
+              A[nzc1[j]*12 + nzc3[k]] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[21];
+              A[nzc3[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[27];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[26];
+              A[nzc3[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[30];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[31];
+              A[nzc3[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[33];
+              A[nzc3[j]*12 + nzc3[k]] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[33];
             } // end loop over 'k'
           } // end loop over 'j'
         } // end loop over 'ip'
@@ -3041,10 +5727,10 @@ public:
         }
       case 1:
         {
-          // Total number of operations to compute element tensor (from this point): 7706
+          // Total number of operations to compute element tensor (from this point): 6794
         
         // Loop quadrature points for integral.
-        // Number of operations to compute element tensor for following IP loop = 7706
+        // Number of operations to compute element tensor for following IP loop = 6794
         for (unsigned int ip = 0; ip < 2; ip++)
         {
           
@@ -3057,85 +5743,85 @@ public:
           I[1] = G[4]*W2[ip];
           
           // Number of operations: 1
-          I[2] = G[1]*W2[ip];
+          I[2] = G[8]*W2[ip];
           
           // Number of operations: 1
-          I[3] = G[2]*W2[ip];
+          I[3] = G[12]*W2[ip];
           
           // Number of operations: 1
-          I[4] = G[3]*W2[ip];
+          I[4] = G[1]*W2[ip];
           
           // Number of operations: 1
-          I[5] = G[5]*W2[ip];
+          I[5] = G[2]*W2[ip];
           
           // Number of operations: 1
-          I[6] = G[6]*W2[ip];
+          I[6] = G[3]*W2[ip];
           
           // Number of operations: 1
-          I[7] = G[7]*W2[ip];
+          I[7] = G[5]*W2[ip];
           
           // Number of operations: 1
-          I[8] = G[8]*W2[ip];
+          I[8] = G[6]*W2[ip];
           
           // Number of operations: 1
-          I[9] = G[16]*W2[ip];
+          I[9] = G[7]*W2[ip];
           
           // Number of operations: 1
-          I[10] = G[12]*W2[ip];
+          I[10] = G[9]*W2[ip];
           
           // Number of operations: 1
-          I[11] = G[9]*W2[ip];
+          I[11] = G[10]*W2[ip];
           
           // Number of operations: 1
-          I[12] = G[10]*W2[ip];
+          I[12] = G[11]*W2[ip];
           
           // Number of operations: 1
-          I[13] = G[11]*W2[ip];
+          I[13] = G[13]*W2[ip];
           
           // Number of operations: 1
-          I[14] = G[18]*W2[ip];
+          I[14] = G[14]*W2[ip];
           
           // Number of operations: 1
-          I[15] = G[17]*W2[ip];
+          I[15] = G[15]*W2[ip];
           
           // Number of operations: 1
-          I[16] = G[19]*W2[ip];
+          I[16] = G[16]*W2[ip];
           
           // Number of operations: 1
-          I[17] = G[20]*W2[ip];
+          I[17] = G[24]*W2[ip];
           
           // Number of operations: 1
-          I[18] = G[21]*W2[ip];
+          I[18] = G[20]*W2[ip];
           
           // Number of operations: 1
-          I[19] = G[13]*W2[ip];
+          I[19] = G[17]*W2[ip];
           
           // Number of operations: 1
-          I[20] = G[14]*W2[ip];
+          I[20] = G[18]*W2[ip];
           
           // Number of operations: 1
-          I[21] = G[15]*W2[ip];
+          I[21] = G[19]*W2[ip];
           
           // Number of operations: 1
-          I[22] = G[23]*W2[ip];
+          I[22] = G[25]*W2[ip];
           
           // Number of operations: 1
-          I[23] = G[27]*W2[ip];
+          I[23] = G[26]*W2[ip];
           
           // Number of operations: 1
-          I[24] = G[28]*W2[ip];
+          I[24] = G[27]*W2[ip];
           
           // Number of operations: 1
-          I[25] = G[22]*W2[ip];
+          I[25] = G[21]*W2[ip];
           
           // Number of operations: 1
-          I[26] = G[24]*W2[ip];
+          I[26] = G[22]*W2[ip];
           
           // Number of operations: 1
-          I[27] = G[25]*W2[ip];
+          I[27] = G[23]*W2[ip];
           
           // Number of operations: 1
-          I[28] = G[26]*W2[ip];
+          I[28] = G[28]*W2[ip];
           
           // Number of operations: 1
           I[29] = G[29]*W2[ip];
@@ -3153,47 +5839,67 @@ public:
           I[33] = G[33]*W2[ip];
           
           
-          // Number of operations for primary indices: 72
+          // Number of operations for primary indices: 144
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[0];
+              A[(nzc2[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc9[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[1];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + (nzc7[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f1_D01[ip][k]*I[1];
+              A[nzc2[j]*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[2];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[3];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 270
+          // Number of operations for primary indices: 540
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[2];
+              A[(nzc2[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[4];
+              // Number of operations to compute entry: 3
+              A[(nzc2[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[5];
+              // Number of operations to compute entry: 3
+              A[(nzc2[j] + 6)*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[6];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f1_D20[ip][j]*I[3];
+              A[(nzc9[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[7];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f1_D20[ip][j]*I[4];
+              A[(nzc9[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[8];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + (nzc8[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f1_D10[ip][k]*I[5];
+              A[(nzc9[j] + 6)*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[9];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[6];
+              A[nzc2[j]*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[10];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[7];
+              A[nzc2[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[11];
+              // Number of operations to compute entry: 3
+              A[nzc2[j]*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[12];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[13];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[14];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[15];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 72
+          // Number of operations for primary indices: 144
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[0];
+              A[(nzc7[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc7[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[1];
+              // Number of operations to compute entry: 3
+              A[(nzc7[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[2];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc5[k]] += FE0_f0_D20[ip][k]*FE0_f1_D01[ip][j]*I[1];
+              A[(nzc7[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[3];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -3203,145 +5909,125 @@ public:
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[8];
+              A[(nzc4[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[8];
+              A[(nzc7[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[9];
+              A[(nzc7[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[17];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[10];
+              A[(nzc7[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[18];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[10];
+              A[nzc4[j]*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[18];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 660
+          // Number of operations for primary indices: 540
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[11];
-              // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[12];
+              A[(nzc4[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[19];
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[13];
+              A[(nzc4[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[20];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[14];
+              A[(nzc4[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[21];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[15];
+              A[(nzc7[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[22];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f1_D01[ip][j]*I[16];
+              A[(nzc7[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f1_D01[ip][j]*I[23];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f1_D01[ip][j]*I[17];
-              // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[18];
+              A[(nzc7[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f1_D01[ip][j]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[19];
+              A[nzc4[j]*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[25];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[20];
+              A[nzc4[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[21];
+              A[nzc4[j]*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[27];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 270
+          // Number of operations for primary indices: 540
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[2];
+              A[(nzc8[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[4];
+              // Number of operations to compute entry: 3
+              A[(nzc8[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[7];
+              // Number of operations to compute entry: 3
+              A[(nzc8[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[10];
+              // Number of operations to compute entry: 3
+              A[(nzc8[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[13];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc5[k]] += FE0_f0_D20[ip][k]*FE0_f1_D10[ip][j]*I[5];
+              A[nzc1[j]*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[5];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc9[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f1_D20[ip][k]*I[3];
+              A[nzc1[j]*12 + (nzc9[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[8];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc5[k]] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[6];
+              A[nzc1[j]*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[11];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc9[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f1_D20[ip][k]*I[4];
+              A[nzc1[j]*12 + nzc5[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[14];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc5[k]] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[7];
+              A[nzc3[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[6];
+              // Number of operations to compute entry: 3
+              A[nzc3[j]*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[9];
+              // Number of operations to compute entry: 3
+              A[nzc3[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[12];
+              // Number of operations to compute entry: 3
+              A[nzc3[j]*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[15];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 660
+          // Number of operations for primary indices: 540
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[14];
+              A[(nzc8[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[19];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[11];
+              A[(nzc8[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[22];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[15];
+              A[(nzc8[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[25];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[19];
+              A[nzc1[j]*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[12];
+              A[nzc1[j]*12 + (nzc7[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f1_D01[ip][k]*I[23];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc7[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f1_D01[ip][k]*I[16];
+              A[nzc1[j]*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[20];
+              A[nzc3[j]*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[21];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[13];
+              A[nzc3[j]*12 + (nzc7[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f1_D01[ip][k]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc7[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f1_D01[ip][k]*I[17];
-              // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[21];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[18];
+              A[nzc3[j]*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[27];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 1575
+          // Number of operations for primary indices: 675
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[22];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[24];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[22];
+              A[(nzc8[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[28];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[25];
+              A[(nzc8[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f1_D10[ip][j]*I[29];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f1_D10[ip][j]*I[26];
+              A[(nzc8[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f1_D10[ip][j]*I[30];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f1_D10[ip][j]*I[27];
+              A[nzc1[j]*12 + (nzc8[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f1_D10[ip][k]*I[29];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[28];
+              A[nzc1[j]*12 + nzc1[k]] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[31];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[23];
-              // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc8[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f1_D10[ip][k]*I[26];
-              // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc1[k]] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[29];
-              // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc3[k]] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[30];
-              // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[31];
-              // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[24];
-              // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc8[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f1_D10[ip][k]*I[27];
+              A[nzc1[j]*12 + nzc3[k]] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[30];
+              A[nzc3[j]*12 + (nzc8[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f1_D10[ip][k]*I[30];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc3[k]] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[32];
+              A[nzc3[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[33];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[28];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[31];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[33];
+              A[nzc3[j]*12 + nzc3[k]] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[33];
             } // end loop over 'k'
           } // end loop over 'j'
         } // end loop over 'ip'
@@ -3349,71 +6035,71 @@ public:
         }
       case 2:
         {
-          // Total number of operations to compute element tensor (from this point): 6980
+          // Total number of operations to compute element tensor (from this point): 6332
         
         // Loop quadrature points for integral.
-        // Number of operations to compute element tensor for following IP loop = 6980
+        // Number of operations to compute element tensor for following IP loop = 6332
         for (unsigned int ip = 0; ip < 2; ip++)
         {
           
           // Number of operations to compute ip constants: 34
           double I[34];
           // Number of operations: 1
-          I[0] = G[9]*W2[ip];
+          I[0] = G[28]*W2[ip];
           
           // Number of operations: 1
-          I[1] = G[22]*W2[ip];
+          I[1] = G[1]*W2[ip];
           
           // Number of operations: 1
-          I[2] = G[1]*W2[ip];
+          I[2] = G[5]*W2[ip];
           
           // Number of operations: 1
-          I[3] = G[5]*W2[ip];
+          I[3] = G[9]*W2[ip];
           
           // Number of operations: 1
           I[4] = G[13]*W2[ip];
           
           // Number of operations: 1
-          I[5] = G[8]*W2[ip];
+          I[5] = G[17]*W2[ip];
           
           // Number of operations: 1
-          I[6] = G[10]*W2[ip];
+          I[6] = G[21]*W2[ip];
           
           // Number of operations: 1
-          I[7] = G[11]*W2[ip];
+          I[7] = G[25]*W2[ip];
           
           // Number of operations: 1
-          I[8] = G[17]*W2[ip];
+          I[8] = G[29]*W2[ip];
           
           // Number of operations: 1
-          I[9] = G[23]*W2[ip];
+          I[9] = G[30]*W2[ip];
           
           // Number of operations: 1
-          I[10] = G[24]*W2[ip];
+          I[10] = G[0]*W2[ip];
           
           // Number of operations: 1
-          I[11] = G[25]*W2[ip];
+          I[11] = G[2]*W2[ip];
           
           // Number of operations: 1
-          I[12] = G[26]*W2[ip];
+          I[12] = G[3]*W2[ip];
           
           // Number of operations: 1
-          I[13] = G[0]*W2[ip];
+          I[13] = G[4]*W2[ip];
           
           // Number of operations: 1
-          I[14] = G[2]*W2[ip];
+          I[14] = G[6]*W2[ip];
           
           // Number of operations: 1
-          I[15] = G[3]*W2[ip];
+          I[15] = G[7]*W2[ip];
           
           // Number of operations: 1
-          I[16] = G[4]*W2[ip];
+          I[16] = G[8]*W2[ip];
           
           // Number of operations: 1
-          I[17] = G[6]*W2[ip];
+          I[17] = G[10]*W2[ip];
           
           // Number of operations: 1
-          I[18] = G[7]*W2[ip];
+          I[18] = G[11]*W2[ip];
           
           // Number of operations: 1
           I[19] = G[12]*W2[ip];
@@ -3437,19 +6123,19 @@ public:
           I[25] = G[20]*W2[ip];
           
           // Number of operations: 1
-          I[26] = G[21]*W2[ip];
+          I[26] = G[22]*W2[ip];
           
           // Number of operations: 1
-          I[27] = G[27]*W2[ip];
+          I[27] = G[23]*W2[ip];
           
           // Number of operations: 1
-          I[28] = G[28]*W2[ip];
+          I[28] = G[24]*W2[ip];
           
           // Number of operations: 1
-          I[29] = G[29]*W2[ip];
+          I[29] = G[26]*W2[ip];
           
           // Number of operations: 1
-          I[30] = G[30]*W2[ip];
+          I[30] = G[27]*W2[ip];
           
           // Number of operations: 1
           I[31] = G[31]*W2[ip];
@@ -3461,195 +6147,195 @@ public:
           I[33] = G[33]*W2[ip];
           
           
-          // Number of operations for primary indices: 189
+          // Number of operations for primary indices: 243
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[0];
+              A[(nzc12[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc12[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[1];
+              // Number of operations to compute entry: 3
+              A[(nzc12[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[2];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[0];
+              A[(nzc12[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[3];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[1];
+              A[(nzc12[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[4];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[2];
+              A[(nzc2[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[1];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc5[k]] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[3];
+              A[(nzc5[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[2];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[2];
+              A[nzc2[j]*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[3];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + (nzc13[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[3];
+              A[nzc5[j]*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[4];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 36
+          // Number of operations for primary indices: 72
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[4];
+              A[(nzc12[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[5];
+              // Number of operations to compute entry: 3
+              A[(nzc12[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[6];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 630
+          // Number of operations for primary indices: 675
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[5];
+              A[(nzc12[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[7];
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[6];
+              A[(nzc12[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f2_D10[ip][j]*I[8];
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[7];
+              A[(nzc12[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f2_D10[ip][j]*I[9];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[8];
+              A[(nzc2[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[10];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc14[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D11[ip][k]*I[9];
+              A[(nzc2[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[11];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f2_D10[ip][j]*I[10];
+              A[(nzc2[j] + 6)*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[12];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f2_D10[ip][j]*I[11];
+              A[(nzc5[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[13];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[12];
+              A[(nzc5[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[14];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[13];
+              A[(nzc5[j] + 6)*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[15];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f1_D20[ip][j]*I[14];
+              A[nzc2[j]*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f1_D20[ip][j]*I[15];
+              A[nzc2[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[17];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + (nzc11[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[16];
+              A[nzc2[j]*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[18];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[17];
+              A[nzc5[j]*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc5[j]*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[18];
+              A[nzc5[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[20];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[21];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 36
+          // Number of operations for primary indices: 72
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc13[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[4];
+              A[(nzc4[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[5];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + (nzc12[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[6];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 360
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[19];
+              A[(nzc4[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[22];
+              // Number of operations to compute entry: 3
+              A[(nzc4[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[23];
+              // Number of operations to compute entry: 3
+              A[(nzc4[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[24];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + (nzc11[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[25];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[20];
+              A[nzc4[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc3[k]] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[21];
+              A[nzc4[j]*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[27];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 630
+          // Number of operations for primary indices: 675
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[5];
+              A[(nzc11[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[7];
+              // Number of operations to compute entry: 3
+              A[(nzc11[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[10];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[8];
+              A[(nzc11[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[13];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[13];
+              A[(nzc11[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc5[k]] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[16];
+              A[(nzc11[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[19];
               // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f2_D10[ip][k]*FE0_f2_D11[ip][j]*I[9];
+              A[nzc1[j]*12 + (nzc12[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f2_D10[ip][k]*I[8];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc12[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[6];
+              A[nzc1[j]*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[11];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc13[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f2_D10[ip][k]*I[10];
+              A[nzc1[j]*12 + (nzc5[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[14];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc9[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f1_D20[ip][k]*I[14];
+              A[nzc1[j]*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[17];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc5[k]] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[17];
+              A[nzc1[j]*12 + nzc5[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc12[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[7];
+              A[nzc3[j]*12 + (nzc12[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f2_D10[ip][k]*I[9];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc13[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f2_D10[ip][k]*I[11];
+              A[nzc3[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[12];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc9[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f1_D20[ip][k]*I[15];
+              A[nzc3[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[15];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc5[k]] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[18];
+              A[nzc3[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[18];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc13[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[12];
+              A[nzc3[j]*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[21];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 360
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[19];
+              A[(nzc11[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[22];
+              // Number of operations to compute entry: 3
+              A[(nzc11[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[25];
+              // Number of operations to compute entry: 3
+              A[nzc1[j]*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[23];
+              // Number of operations to compute entry: 3
+              A[nzc1[j]*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[20];
+              A[nzc3[j]*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[21];
+              A[nzc3[j]*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[27];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 1575
+          // Number of operations for primary indices: 675
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[22];
-              // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc14[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D11[ip][k]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f2_D01[ip][j]*I[24];
-              // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f2_D01[ip][j]*I[25];
-              // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[26];
-              // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D11[ip][j]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f2_D11[ip][j]*I[27];
+              A[(nzc11[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[28];
               // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f2_D11[ip][j]*I[28];
+              A[(nzc11[j] + 6)*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f2_D01[ip][j]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc11[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f2_D01[ip][k]*I[24];
+              A[(nzc11[j] + 6)*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f2_D01[ip][j]*I[30];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + (nzc14[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f2_D11[ip][k]*I[27];
+              A[nzc1[j]*12 + (nzc11[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f2_D01[ip][k]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc1[k]] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[29];
+              A[nzc1[j]*12 + nzc1[k]] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[31];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc3[k]] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[30];
+              A[nzc1[j]*12 + nzc3[k]] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc1[j]*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[31];
+              A[nzc3[j]*12 + (nzc11[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f2_D01[ip][k]*I[30];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc11[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f2_D01[ip][k]*I[25];
+              A[nzc3[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + (nzc14[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f2_D11[ip][k]*I[28];
-              // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[30];
-              // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc3[k]] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[32];
-              // Number of operations to compute entry: 3
-              A[nzc3[j]*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[33];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc11[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[26];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc1[k]] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[31];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc3[k]] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[33];
+              A[nzc3[j]*12 + nzc3[k]] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[33];
             } // end loop over 'k'
           } // end loop over 'j'
         } // end loop over 'ip'
@@ -3665,10 +6351,10 @@ public:
       {
       case 0:
         {
-          // Total number of operations to compute element tensor (from this point): 7706
+          // Total number of operations to compute element tensor (from this point): 6794
         
         // Loop quadrature points for integral.
-        // Number of operations to compute element tensor for following IP loop = 7706
+        // Number of operations to compute element tensor for following IP loop = 6794
         for (unsigned int ip = 0; ip < 2; ip++)
         {
           
@@ -3681,143 +6367,163 @@ public:
           I[1] = G[6]*W2[ip];
           
           // Number of operations: 1
-          I[2] = G[0]*W2[ip];
+          I[2] = G[10]*W2[ip];
           
           // Number of operations: 1
-          I[3] = G[1]*W2[ip];
+          I[3] = G[14]*W2[ip];
           
           // Number of operations: 1
-          I[4] = G[3]*W2[ip];
+          I[4] = G[0]*W2[ip];
           
           // Number of operations: 1
-          I[5] = G[4]*W2[ip];
+          I[5] = G[1]*W2[ip];
           
           // Number of operations: 1
-          I[6] = G[5]*W2[ip];
+          I[6] = G[3]*W2[ip];
           
           // Number of operations: 1
-          I[7] = G[7]*W2[ip];
+          I[7] = G[4]*W2[ip];
           
           // Number of operations: 1
-          I[8] = G[10]*W2[ip];
+          I[8] = G[5]*W2[ip];
           
           // Number of operations: 1
-          I[9] = G[14]*W2[ip];
+          I[9] = G[7]*W2[ip];
           
           // Number of operations: 1
-          I[10] = G[29]*W2[ip];
+          I[10] = G[8]*W2[ip];
           
           // Number of operations: 1
-          I[11] = G[8]*W2[ip];
+          I[11] = G[9]*W2[ip];
           
           // Number of operations: 1
-          I[12] = G[9]*W2[ip];
+          I[12] = G[11]*W2[ip];
           
           // Number of operations: 1
-          I[13] = G[11]*W2[ip];
+          I[13] = G[12]*W2[ip];
           
           // Number of operations: 1
-          I[14] = G[12]*W2[ip];
+          I[14] = G[13]*W2[ip];
           
           // Number of operations: 1
-          I[15] = G[13]*W2[ip];
+          I[15] = G[15]*W2[ip];
           
           // Number of operations: 1
-          I[16] = G[15]*W2[ip];
+          I[16] = G[18]*W2[ip];
           
           // Number of operations: 1
-          I[17] = G[19]*W2[ip];
+          I[17] = G[22]*W2[ip];
           
           // Number of operations: 1
-          I[18] = G[24]*W2[ip];
+          I[18] = G[31]*W2[ip];
           
           // Number of operations: 1
-          I[19] = G[27]*W2[ip];
+          I[19] = G[16]*W2[ip];
           
           // Number of operations: 1
-          I[20] = G[31]*W2[ip];
+          I[20] = G[17]*W2[ip];
           
           // Number of operations: 1
-          I[21] = G[30]*W2[ip];
+          I[21] = G[19]*W2[ip];
           
           // Number of operations: 1
-          I[22] = G[16]*W2[ip];
+          I[22] = G[20]*W2[ip];
           
           // Number of operations: 1
-          I[23] = G[17]*W2[ip];
+          I[23] = G[21]*W2[ip];
           
           // Number of operations: 1
-          I[24] = G[18]*W2[ip];
+          I[24] = G[23]*W2[ip];
           
           // Number of operations: 1
-          I[25] = G[21]*W2[ip];
+          I[25] = G[26]*W2[ip];
           
           // Number of operations: 1
-          I[26] = G[20]*W2[ip];
+          I[26] = G[29]*W2[ip];
           
           // Number of operations: 1
-          I[27] = G[22]*W2[ip];
+          I[27] = G[32]*W2[ip];
           
           // Number of operations: 1
-          I[28] = G[23]*W2[ip];
+          I[28] = G[24]*W2[ip];
           
           // Number of operations: 1
-          I[29] = G[26]*W2[ip];
+          I[29] = G[25]*W2[ip];
           
           // Number of operations: 1
-          I[30] = G[25]*W2[ip];
+          I[30] = G[27]*W2[ip];
           
           // Number of operations: 1
           I[31] = G[28]*W2[ip];
           
           // Number of operations: 1
-          I[32] = G[33]*W2[ip];
+          I[32] = G[30]*W2[ip];
           
           // Number of operations: 1
-          I[33] = G[32]*W2[ip];
+          I[33] = G[33]*W2[ip];
           
           
-          // Number of operations for primary indices: 72
+          // Number of operations for primary indices: 144
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + nzc7[k]] += FE0_f0_D20[ip][j]*FE0_f1_D01[ip][k]*I[0];
+              A[(nzc2[j] + 6)*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc5[j] + 6)*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[1];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[1];
+              A[nzc2[j]*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[2];
+              // Number of operations to compute entry: 3
+              A[nzc9[j]*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[3];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 270
+          // Number of operations for primary indices: 540
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[2];
+              A[(nzc2[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[4];
+              // Number of operations to compute entry: 3
+              A[(nzc2[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[5];
+              // Number of operations to compute entry: 3
+              A[(nzc2[j] + 6)*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[6];
+              // Number of operations to compute entry: 3
+              A[(nzc5[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[7];
+              // Number of operations to compute entry: 3
+              A[(nzc5[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[8];
+              // Number of operations to compute entry: 3
+              A[(nzc5[j] + 6)*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[9];
+              // Number of operations to compute entry: 3
+              A[nzc2[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[10];
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[3];
+              A[nzc2[j]*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[11];
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + nzc8[k]] += FE0_f0_D20[ip][j]*FE0_f1_D10[ip][k]*I[4];
+              A[nzc2[j]*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[12];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f1_D20[ip][j]*I[5];
+              A[nzc9[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[13];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f1_D20[ip][j]*I[6];
+              A[nzc9[j]*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[14];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[7];
+              A[nzc9[j]*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[15];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 72
+          // Number of operations for primary indices: 144
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc5[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f1_D01[ip][j]*I[0];
+              A[nzc7[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[0];
+              // Number of operations to compute entry: 3
+              A[nzc7[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[1];
+              // Number of operations to compute entry: 3
+              A[nzc7[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[2];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc9[k]] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[1];
+              A[nzc7[j]*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[3];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -3827,143 +6533,123 @@ public:
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[8];
+              A[(nzc4[j] + 6)*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[16];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[9];
+              A[nzc4[j]*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[17];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[8];
+              A[nzc7[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[16];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[9];
+              A[nzc7[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[17];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc7[k]] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[10];
+              A[nzc7[j]*12 + nzc7[k]] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[18];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 660
+          // Number of operations for primary indices: 540
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[11];
-              // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[12];
+              A[(nzc4[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[19];
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[13];
+              A[(nzc4[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[14];
+              A[(nzc4[j] + 6)*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[21];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[15];
+              A[nzc4[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[22];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[16];
+              A[nzc4[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[23];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f1_D01[ip][j]*I[17];
+              A[nzc4[j]*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f1_D01[ip][j]*I[18];
+              A[nzc7[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f1_D01[ip][j]*I[25];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[19];
+              A[nzc7[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f1_D01[ip][j]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[20];
-              // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc8[k]] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[21];
+              A[nzc7[j]*12 + nzc8[k]] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[27];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 270
+          // Number of operations for primary indices: 540
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[2];
+              A[(nzc1[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[4];
+              // Number of operations to compute entry: 3
+              A[(nzc1[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[7];
+              // Number of operations to compute entry: 3
+              A[(nzc1[j] + 6)*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[10];
+              // Number of operations to compute entry: 3
+              A[(nzc1[j] + 6)*12 + nzc9[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[13];
+              // Number of operations to compute entry: 3
+              A[(nzc3[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[5];
+              // Number of operations to compute entry: 3
+              A[(nzc3[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[8];
+              // Number of operations to compute entry: 3
+              A[(nzc3[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[11];
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc9[k]] += FE0_f0_D01[ip][j]*FE0_f1_D20[ip][k]*I[5];
+              A[(nzc3[j] + 6)*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[14];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[3];
+              A[nzc8[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[6];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc9[k]] += FE0_f0_D10[ip][j]*FE0_f1_D20[ip][k]*I[6];
+              A[nzc8[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[9];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc5[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f1_D10[ip][j]*I[4];
+              A[nzc8[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[12];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc9[k]] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[7];
+              A[nzc8[j]*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[15];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 660
+          // Number of operations for primary indices: 540
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[11];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[14];
+              A[(nzc1[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[19];
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc7[k]] += FE0_f0_D01[ip][j]*FE0_f1_D01[ip][k]*I[17];
+              A[(nzc1[j] + 6)*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[22];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[12];
+              A[(nzc1[j] + 6)*12 + nzc7[k]] += FE0_f0_D01[ip][j]*FE0_f1_D01[ip][k]*I[25];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[15];
+              A[(nzc3[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc7[k]] += FE0_f0_D10[ip][j]*FE0_f1_D01[ip][k]*I[18];
+              A[(nzc3[j] + 6)*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[23];
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[19];
+              A[(nzc3[j] + 6)*12 + nzc7[k]] += FE0_f0_D10[ip][j]*FE0_f1_D01[ip][k]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[20];
+              A[nzc8[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[21];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[13];
+              A[nzc8[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[16];
-              // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[21];
+              A[nzc8[j]*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[27];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 1575
+          // Number of operations for primary indices: 675
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[22];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[24];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[25];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc8[k]] += FE0_f0_D01[ip][j]*FE0_f1_D10[ip][k]*I[26];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[27];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[28];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[29];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc8[k]] += FE0_f0_D10[ip][j]*FE0_f1_D10[ip][k]*I[30];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[24];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[28];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[31];
+              A[(nzc1[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[28];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[25];
+              A[(nzc1[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[29];
+              A[(nzc1[j] + 6)*12 + nzc8[k]] += FE0_f0_D01[ip][j]*FE0_f1_D10[ip][k]*I[30];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[32];
+              A[(nzc3[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f1_D10[ip][j]*I[26];
+              A[(nzc3[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[31];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f1_D10[ip][j]*I[30];
+              A[(nzc3[j] + 6)*12 + nzc8[k]] += FE0_f0_D10[ip][j]*FE0_f1_D10[ip][k]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[31];
+              A[nzc8[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f1_D10[ip][j]*I[30];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[32];
+              A[nzc8[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f1_D10[ip][j]*I[32];
               // Number of operations to compute entry: 3
               A[nzc8[j]*12 + nzc8[k]] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[33];
             } // end loop over 'k'
@@ -3973,10 +6659,10 @@ public:
         }
       case 1:
         {
-          // Total number of operations to compute element tensor (from this point): 7196
+          // Total number of operations to compute element tensor (from this point): 6332
         
         // Loop quadrature points for integral.
-        // Number of operations to compute element tensor for following IP loop = 7196
+        // Number of operations to compute element tensor for following IP loop = 6332
         for (unsigned int ip = 0; ip < 2; ip++)
         {
           
@@ -3995,141 +6681,165 @@ public:
           I[3] = G[6]*W2[ip];
           
           // Number of operations: 1
-          I[4] = G[1]*W2[ip];
+          I[4] = G[8]*W2[ip];
           
           // Number of operations: 1
-          I[5] = G[3]*W2[ip];
+          I[5] = G[10]*W2[ip];
           
           // Number of operations: 1
-          I[6] = G[5]*W2[ip];
+          I[6] = G[12]*W2[ip];
           
           // Number of operations: 1
-          I[7] = G[7]*W2[ip];
+          I[7] = G[14]*W2[ip];
           
           // Number of operations: 1
-          I[8] = G[8]*W2[ip];
+          I[8] = G[1]*W2[ip];
           
           // Number of operations: 1
-          I[9] = G[10]*W2[ip];
+          I[9] = G[3]*W2[ip];
           
           // Number of operations: 1
-          I[10] = G[16]*W2[ip];
+          I[10] = G[5]*W2[ip];
           
           // Number of operations: 1
-          I[11] = G[12]*W2[ip];
+          I[11] = G[7]*W2[ip];
           
           // Number of operations: 1
-          I[12] = G[19]*W2[ip];
+          I[12] = G[9]*W2[ip];
           
           // Number of operations: 1
-          I[13] = G[14]*W2[ip];
+          I[13] = G[11]*W2[ip];
           
           // Number of operations: 1
-          I[14] = G[29]*W2[ip];
+          I[14] = G[13]*W2[ip];
           
           // Number of operations: 1
-          I[15] = G[9]*W2[ip];
+          I[15] = G[15]*W2[ip];
           
           // Number of operations: 1
-          I[16] = G[11]*W2[ip];
+          I[16] = G[16]*W2[ip];
           
           // Number of operations: 1
           I[17] = G[18]*W2[ip];
           
           // Number of operations: 1
-          I[18] = G[17]*W2[ip];
+          I[18] = G[24]*W2[ip];
           
           // Number of operations: 1
-          I[19] = G[21]*W2[ip];
+          I[19] = G[20]*W2[ip];
           
           // Number of operations: 1
-          I[20] = G[20]*W2[ip];
+          I[20] = G[26]*W2[ip];
           
           // Number of operations: 1
-          I[21] = G[13]*W2[ip];
+          I[21] = G[22]*W2[ip];
           
           // Number of operations: 1
-          I[22] = G[15]*W2[ip];
+          I[22] = G[31]*W2[ip];
           
           // Number of operations: 1
-          I[23] = G[27]*W2[ip];
+          I[23] = G[17]*W2[ip];
           
           // Number of operations: 1
-          I[24] = G[24]*W2[ip];
+          I[24] = G[19]*W2[ip];
           
           // Number of operations: 1
-          I[25] = G[31]*W2[ip];
+          I[25] = G[25]*W2[ip];
           
           // Number of operations: 1
-          I[26] = G[30]*W2[ip];
+          I[26] = G[27]*W2[ip];
           
           // Number of operations: 1
-          I[27] = G[23]*W2[ip];
+          I[27] = G[21]*W2[ip];
           
           // Number of operations: 1
-          I[28] = G[28]*W2[ip];
+          I[28] = G[23]*W2[ip];
           
           // Number of operations: 1
-          I[29] = G[22]*W2[ip];
+          I[29] = G[29]*W2[ip];
           
           // Number of operations: 1
-          I[30] = G[26]*W2[ip];
+          I[30] = G[32]*W2[ip];
           
           // Number of operations: 1
-          I[31] = G[25]*W2[ip];
+          I[31] = G[28]*W2[ip];
           
           // Number of operations: 1
-          I[32] = G[33]*W2[ip];
+          I[32] = G[30]*W2[ip];
           
           // Number of operations: 1
-          I[33] = G[32]*W2[ip];
+          I[33] = G[33]*W2[ip];
           
           
-          // Number of operations for primary indices: 144
+          // Number of operations for primary indices: 288
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[0];
+              A[(nzc2[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc2[j] + 6)*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[1];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[1];
+              A[(nzc9[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[2];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[2];
+              A[(nzc9[j] + 6)*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[3];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[3];
+              A[nzc2[j]*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[4];
+              // Number of operations to compute entry: 3
+              A[nzc2[j]*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[5];
+              // Number of operations to compute entry: 3
+              A[nzc9[j]*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[6];
+              // Number of operations to compute entry: 3
+              A[nzc9[j]*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[7];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 360
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[4];
+              A[(nzc2[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[8];
+              // Number of operations to compute entry: 3
+              A[(nzc2[j] + 6)*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[9];
+              // Number of operations to compute entry: 3
+              A[(nzc9[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[10];
+              // Number of operations to compute entry: 3
+              A[(nzc9[j] + 6)*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[11];
+              // Number of operations to compute entry: 3
+              A[nzc2[j]*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[12];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[5];
+              A[nzc2[j]*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[13];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[6];
+              A[nzc9[j]*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[14];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[7];
+              A[nzc9[j]*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[15];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 144
+          // Number of operations for primary indices: 288
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[0];
+              A[(nzc7[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc7[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[2];
+              // Number of operations to compute entry: 3
+              A[(nzc7[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[4];
+              // Number of operations to compute entry: 3
+              A[(nzc7[j] + 6)*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[6];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc9[k]] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[2];
+              A[nzc7[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[1];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc9[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[1];
+              A[nzc7[j]*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[3];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc9[k]] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[3];
+              A[nzc7[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[5];
+              // Number of operations to compute entry: 3
+              A[nzc7[j]*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[7];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -4139,139 +6849,115 @@ public:
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[8];
+              A[(nzc4[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[9];
+              A[(nzc4[j] + 6)*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[17];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[8];
+              A[(nzc7[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[10];
+              A[(nzc7[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[18];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[11];
+              A[(nzc7[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[19];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[12];
+              A[(nzc7[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[11];
+              A[nzc4[j]*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[13];
+              A[nzc4[j]*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[21];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[9];
+              A[nzc7[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[17];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[12];
+              A[nzc7[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[13];
+              A[nzc7[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[21];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc7[k]] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[14];
+              A[nzc7[j]*12 + nzc7[k]] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[22];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 720
+          // Number of operations for primary indices: 480
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[15];
-              // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[16];
-              // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[17];
-              // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[18];
+              A[(nzc4[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[23];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[19];
-              // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc8[k]] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[20];
+              A[(nzc4[j] + 6)*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[21];
+              A[(nzc7[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[25];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[22];
+              A[(nzc7[j] + 6)*12 + nzc8[k]] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[23];
+              A[nzc4[j]*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[27];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc8[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[24];
+              A[nzc4[j]*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[28];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[25];
+              A[nzc7[j]*12 + (nzc8[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc8[k]] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[26];
+              A[nzc7[j]*12 + nzc8[k]] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[30];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 360
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[4];
+              A[(nzc8[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[8];
+              // Number of operations to compute entry: 3
+              A[(nzc8[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[10];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc9[k]] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[6];
+              A[(nzc8[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[12];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc9[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[5];
+              A[(nzc8[j] + 6)*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[14];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc9[k]] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[7];
+              A[nzc8[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[9];
+              // Number of operations to compute entry: 3
+              A[nzc8[j]*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[11];
+              // Number of operations to compute entry: 3
+              A[nzc8[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[13];
+              // Number of operations to compute entry: 3
+              A[nzc8[j]*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[15];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 720
+          // Number of operations for primary indices: 480
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[17];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[15];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[18];
+              A[(nzc8[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[23];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[21];
+              A[(nzc8[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[25];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[24];
+              A[(nzc8[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[27];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[19];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[25];
+              A[(nzc8[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[16];
+              A[nzc8[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[20];
+              A[nzc8[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[22];
+              A[nzc8[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[28];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[26];
+              A[nzc8[j]*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[30];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 900
+          // Number of operations for primary indices: 300
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[27];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[28];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[27];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[29];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[30];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc8[k]] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[31];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[30];
+              A[(nzc8[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[31];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[32];
+              A[(nzc8[j] + 6)*12 + nzc8[k]] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[28];
-              // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[31];
-              // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[32];
+              A[nzc8[j]*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[32];
               // Number of operations to compute entry: 3
               A[nzc8[j]*12 + nzc8[k]] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[33];
             } // end loop over 'k'
@@ -4281,155 +6967,163 @@ public:
         }
       case 2:
         {
-          // Total number of operations to compute element tensor (from this point): 6494
+          // Total number of operations to compute element tensor (from this point): 5882
         
         // Loop quadrature points for integral.
-        // Number of operations to compute element tensor for following IP loop = 6494
+        // Number of operations to compute element tensor for following IP loop = 5882
         for (unsigned int ip = 0; ip < 2; ip++)
         {
           
           // Number of operations to compute ip constants: 34
           double I[34];
           // Number of operations: 1
-          I[0] = G[9]*W2[ip];
+          I[0] = G[28]*W2[ip];
           
           // Number of operations: 1
-          I[1] = G[22]*W2[ip];
+          I[1] = G[1]*W2[ip];
           
           // Number of operations: 1
-          I[2] = G[1]*W2[ip];
+          I[2] = G[5]*W2[ip];
           
           // Number of operations: 1
-          I[3] = G[5]*W2[ip];
+          I[3] = G[9]*W2[ip];
           
           // Number of operations: 1
-          I[4] = G[10]*W2[ip];
+          I[4] = G[13]*W2[ip];
           
           // Number of operations: 1
-          I[5] = G[13]*W2[ip];
+          I[5] = G[17]*W2[ip];
           
           // Number of operations: 1
-          I[6] = G[24]*W2[ip];
+          I[6] = G[21]*W2[ip];
           
           // Number of operations: 1
-          I[7] = G[2]*W2[ip];
+          I[7] = G[29]*W2[ip];
           
           // Number of operations: 1
-          I[8] = G[6]*W2[ip];
+          I[8] = G[2]*W2[ip];
           
           // Number of operations: 1
-          I[9] = G[8]*W2[ip];
+          I[9] = G[6]*W2[ip];
           
           // Number of operations: 1
-          I[10] = G[11]*W2[ip];
+          I[10] = G[10]*W2[ip];
           
           // Number of operations: 1
-          I[11] = G[17]*W2[ip];
+          I[11] = G[14]*W2[ip];
           
           // Number of operations: 1
-          I[12] = G[23]*W2[ip];
+          I[12] = G[25]*W2[ip];
           
           // Number of operations: 1
-          I[13] = G[26]*W2[ip];
+          I[13] = G[30]*W2[ip];
           
           // Number of operations: 1
-          I[14] = G[25]*W2[ip];
+          I[14] = G[0]*W2[ip];
           
           // Number of operations: 1
-          I[15] = G[0]*W2[ip];
+          I[15] = G[3]*W2[ip];
           
           // Number of operations: 1
-          I[16] = G[3]*W2[ip];
+          I[16] = G[4]*W2[ip];
           
           // Number of operations: 1
-          I[17] = G[4]*W2[ip];
+          I[17] = G[7]*W2[ip];
           
           // Number of operations: 1
-          I[18] = G[7]*W2[ip];
+          I[18] = G[8]*W2[ip];
           
           // Number of operations: 1
-          I[19] = G[14]*W2[ip];
+          I[19] = G[11]*W2[ip];
           
           // Number of operations: 1
-          I[20] = G[29]*W2[ip];
+          I[20] = G[12]*W2[ip];
           
           // Number of operations: 1
-          I[21] = G[12]*W2[ip];
+          I[21] = G[15]*W2[ip];
           
           // Number of operations: 1
-          I[22] = G[15]*W2[ip];
+          I[22] = G[18]*W2[ip];
           
           // Number of operations: 1
-          I[23] = G[19]*W2[ip];
+          I[23] = G[22]*W2[ip];
           
           // Number of operations: 1
-          I[24] = G[27]*W2[ip];
+          I[24] = G[31]*W2[ip];
           
           // Number of operations: 1
-          I[25] = G[31]*W2[ip];
+          I[25] = G[16]*W2[ip];
           
           // Number of operations: 1
-          I[26] = G[30]*W2[ip];
+          I[26] = G[19]*W2[ip];
           
           // Number of operations: 1
-          I[27] = G[16]*W2[ip];
+          I[27] = G[20]*W2[ip];
           
           // Number of operations: 1
-          I[28] = G[18]*W2[ip];
+          I[28] = G[23]*W2[ip];
           
           // Number of operations: 1
-          I[29] = G[21]*W2[ip];
+          I[29] = G[26]*W2[ip];
           
           // Number of operations: 1
-          I[30] = G[20]*W2[ip];
+          I[30] = G[32]*W2[ip];
           
           // Number of operations: 1
-          I[31] = G[28]*W2[ip];
+          I[31] = G[24]*W2[ip];
           
           // Number of operations: 1
-          I[32] = G[33]*W2[ip];
+          I[32] = G[27]*W2[ip];
           
           // Number of operations: 1
-          I[33] = G[32]*W2[ip];
+          I[33] = G[33]*W2[ip];
           
           
-          // Number of operations for primary indices: 189
+          // Number of operations for primary indices: 243
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[0];
+              A[(nzc12[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[0];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[0];
+              A[(nzc12[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[1];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[1];
+              A[(nzc12[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[2];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[2];
+              A[(nzc12[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[3];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[3];
+              A[(nzc12[j] + 6)*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[4];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[2];
+              A[(nzc2[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[1];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc13[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[3];
+              A[(nzc5[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[2];
+              // Number of operations to compute entry: 3
+              A[nzc2[j]*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[3];
+              // Number of operations to compute entry: 3
+              A[nzc9[j]*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[4];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 252
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + nzc7[k]] += FE0_f0_D20[ip][j]*FE0_f1_D01[ip][k]*I[4];
+              A[(nzc12[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[5];
+              // Number of operations to compute entry: 3
+              A[(nzc12[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[6];
+              // Number of operations to compute entry: 3
+              A[(nzc12[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f2_D10[ip][j]*I[7];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[5];
+              A[(nzc2[j] + 6)*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[8];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f2_D10[ip][j]*I[6];
+              A[(nzc5[j] + 6)*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[9];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[7];
+              A[nzc2[j]*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[10];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[8];
+              A[nzc9[j]*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[11];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -4439,57 +7133,65 @@ public:
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[9];
+              A[(nzc12[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[12];
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + nzc8[k]] += FE0_f0_D20[ip][j]*FE0_f1_D10[ip][k]*I[10];
+              A[(nzc12[j] + 6)*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f2_D10[ip][j]*I[13];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[11];
+              A[(nzc2[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[14];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc14[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D11[ip][k]*I[12];
+              A[(nzc2[j] + 6)*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[15];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[13];
+              A[(nzc5[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f2_D10[ip][j]*I[14];
+              A[(nzc5[j] + 6)*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[17];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[15];
+              A[nzc2[j]*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[18];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[16];
+              A[nzc2[j]*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc11[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[17];
+              A[nzc9[j]*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[18];
+              A[nzc9[j]*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[21];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 252
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc13[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[5];
+              A[(nzc4[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[5];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + (nzc12[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[6];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f1_D01[ip][j]*I[4];
+              A[nzc7[j]*12 + (nzc12[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f2_D10[ip][k]*I[7];
+              // Number of operations to compute entry: 3
+              A[nzc7[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[8];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc13[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f2_D10[ip][k]*I[6];
+              A[nzc7[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[9];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc9[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[7];
+              A[nzc7[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[10];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc9[k]] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[8];
+              A[nzc7[j]*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[11];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 144
+          // Number of operations for primary indices: 240
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc7[k]] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[19];
+              A[(nzc4[j] + 6)*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[22];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[23];
+              // Number of operations to compute entry: 3
+              A[nzc7[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[22];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[19];
+              A[nzc7[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[23];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc7[k]] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[20];
+              A[nzc7[j]*12 + nzc7[k]] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[24];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -4499,17 +7201,17 @@ public:
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[21];
+              A[(nzc4[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[25];
               // Number of operations to compute entry: 3
-              A[nzc2[j]*12 + nzc8[k]] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[22];
+              A[(nzc4[j] + 6)*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc11[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f2_D01[ip][k]*I[23];
+              A[nzc4[j]*12 + (nzc11[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[27];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + (nzc14[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f2_D11[ip][k]*I[24];
+              A[nzc4[j]*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[28];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[25];
+              A[nzc7[j]*12 + (nzc11[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f2_D01[ip][k]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc7[j]*12 + nzc8[k]] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[26];
+              A[nzc7[j]*12 + nzc8[k]] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[30];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -4519,25 +7221,25 @@ public:
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[9];
+              A[(nzc11[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[12];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[11];
+              A[(nzc11[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[14];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[15];
+              A[(nzc11[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[17];
+              A[(nzc11[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[18];
               // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f2_D10[ip][k]*FE0_f2_D11[ip][j]*I[12];
+              A[(nzc11[j] + 6)*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc13[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[13];
+              A[nzc8[j]*12 + (nzc12[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f2_D10[ip][k]*I[13];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f1_D10[ip][j]*I[10];
+              A[nzc8[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[15];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc13[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f2_D10[ip][k]*I[14];
+              A[nzc8[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[17];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc9[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[16];
+              A[nzc8[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc9[k]] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[18];
+              A[nzc8[j]*12 + nzc9[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[21];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -4547,47 +7249,31 @@ public:
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[21];
+              A[(nzc11[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[25];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f2_D01[ip][j]*I[23];
+              A[(nzc11[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[27];
               // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f2_D11[ip][j]*I[24];
+              A[(nzc11[j] + 6)*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f2_D01[ip][j]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc7[k]] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[25];
+              A[nzc8[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[22];
+              A[nzc8[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[28];
               // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[26];
+              A[nzc8[j]*12 + nzc7[k]] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[30];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 900
+          // Number of operations for primary indices: 300
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[27];
+              A[(nzc11[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[31];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc14[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D11[ip][k]*I[28];
+              A[(nzc11[j] + 6)*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f2_D01[ip][j]*I[32];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[29];
-              // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f2_D01[ip][j]*I[30];
-              // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D11[ip][j]*I[28];
-              // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + nzc8[k]] += FE0_f1_D10[ip][k]*FE0_f2_D11[ip][j]*I[31];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + (nzc11[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[29];
-              // Number of operations to compute entry: 3
-              A[nzc4[j]*12 + nzc8[k]] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[32];
-              // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc11[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f2_D01[ip][k]*I[30];
-              // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + (nzc14[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f2_D11[ip][k]*I[31];
-              // Number of operations to compute entry: 3
-              A[nzc8[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[32];
+              A[nzc8[j]*12 + (nzc11[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f2_D01[ip][k]*I[32];
               // Number of operations to compute entry: 3
               A[nzc8[j]*12 + nzc8[k]] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[33];
             } // end loop over 'k'
@@ -4605,10 +7291,10 @@ public:
       {
       case 0:
         {
-          // Total number of operations to compute element tensor (from this point): 6980
+          // Total number of operations to compute element tensor (from this point): 6332
         
         // Loop quadrature points for integral.
-        // Number of operations to compute element tensor for following IP loop = 6980
+        // Number of operations to compute element tensor for following IP loop = 6332
         for (unsigned int ip = 0; ip < 2; ip++)
         {
           
@@ -4618,67 +7304,67 @@ public:
           I[0] = G[3]*W2[ip];
           
           // Number of operations: 1
-          I[1] = G[15]*W2[ip];
+          I[1] = G[7]*W2[ip];
           
           // Number of operations: 1
-          I[2] = G[32]*W2[ip];
+          I[2] = G[33]*W2[ip];
           
           // Number of operations: 1
-          I[3] = G[7]*W2[ip];
+          I[3] = G[11]*W2[ip];
           
           // Number of operations: 1
-          I[4] = G[11]*W2[ip];
+          I[4] = G[15]*W2[ip];
           
           // Number of operations: 1
-          I[5] = G[0]*W2[ip];
+          I[5] = G[19]*W2[ip];
           
           // Number of operations: 1
-          I[6] = G[1]*W2[ip];
+          I[6] = G[23]*W2[ip];
           
           // Number of operations: 1
-          I[7] = G[2]*W2[ip];
+          I[7] = G[0]*W2[ip];
           
           // Number of operations: 1
-          I[8] = G[12]*W2[ip];
+          I[8] = G[1]*W2[ip];
           
           // Number of operations: 1
-          I[9] = G[13]*W2[ip];
+          I[9] = G[2]*W2[ip];
           
           // Number of operations: 1
-          I[10] = G[14]*W2[ip];
+          I[10] = G[4]*W2[ip];
           
           // Number of operations: 1
-          I[11] = G[20]*W2[ip];
+          I[11] = G[5]*W2[ip];
           
           // Number of operations: 1
-          I[12] = G[25]*W2[ip];
+          I[12] = G[6]*W2[ip];
           
           // Number of operations: 1
-          I[13] = G[28]*W2[ip];
+          I[13] = G[27]*W2[ip];
           
           // Number of operations: 1
           I[14] = G[30]*W2[ip];
           
           // Number of operations: 1
-          I[15] = G[33]*W2[ip];
+          I[15] = G[32]*W2[ip];
           
           // Number of operations: 1
-          I[16] = G[4]*W2[ip];
+          I[16] = G[8]*W2[ip];
           
           // Number of operations: 1
-          I[17] = G[5]*W2[ip];
+          I[17] = G[9]*W2[ip];
           
           // Number of operations: 1
-          I[18] = G[6]*W2[ip];
+          I[18] = G[10]*W2[ip];
           
           // Number of operations: 1
-          I[19] = G[8]*W2[ip];
+          I[19] = G[12]*W2[ip];
           
           // Number of operations: 1
-          I[20] = G[9]*W2[ip];
+          I[20] = G[13]*W2[ip];
           
           // Number of operations: 1
-          I[21] = G[10]*W2[ip];
+          I[21] = G[14]*W2[ip];
           
           // Number of operations: 1
           I[22] = G[16]*W2[ip];
@@ -4690,7 +7376,7 @@ public:
           I[24] = G[18]*W2[ip];
           
           // Number of operations: 1
-          I[25] = G[19]*W2[ip];
+          I[25] = G[20]*W2[ip];
           
           // Number of operations: 1
           I[26] = G[21]*W2[ip];
@@ -4699,16 +7385,16 @@ public:
           I[27] = G[22]*W2[ip];
           
           // Number of operations: 1
-          I[28] = G[23]*W2[ip];
+          I[28] = G[24]*W2[ip];
           
           // Number of operations: 1
-          I[29] = G[24]*W2[ip];
+          I[29] = G[25]*W2[ip];
           
           // Number of operations: 1
           I[30] = G[26]*W2[ip];
           
           // Number of operations: 1
-          I[31] = G[27]*W2[ip];
+          I[31] = G[28]*W2[ip];
           
           // Number of operations: 1
           I[32] = G[29]*W2[ip];
@@ -4717,195 +7403,195 @@ public:
           I[33] = G[31]*W2[ip];
           
           
-          // Number of operations for primary indices: 189
+          // Number of operations for primary indices: 243
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + nzc13[k]] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[0];
+              A[(nzc2[j] + 6)*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc5[j] + 6)*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[1];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + nzc13[k]] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[1];
+              A[nzc12[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[0];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc5[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[0];
+              A[nzc12[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[1];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[1];
+              A[nzc12[j]*12 + nzc12[k]] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[2];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc13[k]] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[2];
+              A[nzc12[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[3];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[3];
+              A[nzc12[j]*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[4];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc13[k]] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[3];
+              A[nzc2[j]*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[3];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[4];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 36
+          // Number of operations for primary indices: 72
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[4];
+              A[nzc12[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[5];
+              // Number of operations to compute entry: 3
+              A[nzc12[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[6];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 630
+          // Number of operations for primary indices: 675
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[5];
+              A[(nzc2[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[7];
+              // Number of operations to compute entry: 3
+              A[(nzc2[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[8];
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[6];
+              A[(nzc2[j] + 6)*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[9];
               // Number of operations to compute entry: 3
-              A[(nzc5[j] + 6)*12 + nzc11[k]] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[7];
+              A[(nzc5[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[10];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D20[ip][j]*I[8];
+              A[(nzc5[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[11];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D20[ip][j]*I[9];
+              A[(nzc5[j] + 6)*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[12];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + nzc11[k]] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[10];
+              A[nzc12[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f2_D10[ip][j]*I[13];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f2_D10[ip][j]*I[11];
+              A[nzc12[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f2_D10[ip][j]*I[14];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f2_D10[ip][j]*I[12];
+              A[nzc12[j]*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[15];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[13];
+              A[nzc2[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[16];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[14];
+              A[nzc2[j]*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[17];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc14[k]] += FE0_f2_D10[ip][j]*FE0_f2_D11[ip][k]*I[15];
+              A[nzc2[j]*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[18];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f1_D20[ip][j]*I[16];
+              A[nzc5[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f1_D20[ip][j]*I[17];
+              A[nzc5[j]*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc11[k]] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[18];
+              A[nzc5[j]*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[21];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 36
+          // Number of operations for primary indices: 72
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc13[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[4];
+              A[(nzc4[j] + 6)*12 + nzc12[k]] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[5];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + nzc12[k]] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[6];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 360
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D02[ip][j]*I[19];
+              A[(nzc4[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[22];
+              // Number of operations to compute entry: 3
+              A[(nzc4[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[23];
+              // Number of operations to compute entry: 3
+              A[(nzc4[j] + 6)*12 + nzc11[k]] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[24];
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f0_D10[ip][k]*I[20];
+              A[nzc4[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[25];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[26];
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[21];
+              A[nzc4[j]*12 + nzc11[k]] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[27];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 630
+          // Number of operations for primary indices: 675
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[5];
+              A[(nzc1[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[7];
+              // Number of operations to compute entry: 3
+              A[(nzc1[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[10];
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc12[k]] += FE0_f0_D01[ip][j]*FE0_f0_D20[ip][k]*I[8];
+              A[(nzc1[j] + 6)*12 + nzc12[k]] += FE0_f0_D01[ip][j]*FE0_f2_D10[ip][k]*I[13];
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc13[k]] += FE0_f0_D01[ip][j]*FE0_f2_D10[ip][k]*I[11];
+              A[(nzc1[j] + 6)*12 + nzc2[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc9[k]] += FE0_f0_D01[ip][j]*FE0_f1_D20[ip][k]*I[16];
+              A[(nzc1[j] + 6)*12 + nzc5[k]] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[19];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[6];
+              A[(nzc3[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[8];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc12[k]] += FE0_f0_D10[ip][j]*FE0_f0_D20[ip][k]*I[9];
+              A[(nzc3[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[11];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc13[k]] += FE0_f0_D10[ip][j]*FE0_f2_D10[ip][k]*I[12];
+              A[(nzc3[j] + 6)*12 + nzc12[k]] += FE0_f0_D10[ip][j]*FE0_f2_D10[ip][k]*I[14];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc9[k]] += FE0_f0_D10[ip][j]*FE0_f1_D20[ip][k]*I[17];
+              A[(nzc3[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[17];
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc13[k]] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[13];
+              A[(nzc3[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc5[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[7];
+              A[nzc11[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[9];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[10];
+              A[nzc11[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[12];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc13[k]] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[14];
+              A[nzc11[j]*12 + nzc12[k]] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[15];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[18];
+              A[nzc11[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[18];
               // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + nzc13[k]] += FE0_f2_D10[ip][k]*FE0_f2_D11[ip][j]*I[15];
+              A[nzc11[j]*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[21];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 360
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D02[ip][k]*I[19];
+              A[(nzc1[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[22];
+              // Number of operations to compute entry: 3
+              A[(nzc1[j] + 6)*12 + nzc4[k]] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[25];
+              // Number of operations to compute entry: 3
+              A[(nzc3[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[23];
+              // Number of operations to compute entry: 3
+              A[(nzc3[j] + 6)*12 + nzc4[k]] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[26];
               // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f0_D10[ip][j]*I[20];
+              A[nzc11[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[21];
+              A[nzc11[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[27];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 1575
+          // Number of operations for primary indices: 675
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[22];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D11[ip][k]*I[24];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc11[k]] += FE0_f0_D01[ip][j]*FE0_f2_D01[ip][k]*I[25];
-              // Number of operations to compute entry: 3
-              A[(nzc1[j] + 6)*12 + nzc14[k]] += FE0_f0_D01[ip][j]*FE0_f2_D11[ip][k]*I[26];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[23];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[27];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D11[ip][k]*I[28];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc11[k]] += FE0_f0_D10[ip][j]*FE0_f2_D01[ip][k]*I[29];
-              // Number of operations to compute entry: 3
-              A[(nzc3[j] + 6)*12 + nzc14[k]] += FE0_f0_D10[ip][j]*FE0_f2_D11[ip][k]*I[30];
+              A[(nzc1[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D01[ip][k]*I[28];
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D11[ip][j]*I[24];
+              A[(nzc1[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D01[ip][j]*FE0_f0_D10[ip][k]*I[29];
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f0_D11[ip][j]*I[28];
+              A[(nzc1[j] + 6)*12 + nzc11[k]] += FE0_f0_D01[ip][j]*FE0_f2_D01[ip][k]*I[30];
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc11[k]] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[31];
+              A[(nzc3[j] + 6)*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f0_D10[ip][j]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f2_D01[ip][j]*I[25];
+              A[(nzc3[j] + 6)*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][j]*FE0_f0_D10[ip][k]*I[31];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f2_D01[ip][j]*I[29];
+              A[(nzc3[j] + 6)*12 + nzc11[k]] += FE0_f0_D10[ip][j]*FE0_f2_D01[ip][k]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[31];
+              A[nzc11[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f2_D01[ip][j]*I[30];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc11[k]] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[32];
+              A[nzc11[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f2_D01[ip][j]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc14[k]] += FE0_f2_D01[ip][j]*FE0_f2_D11[ip][k]*I[33];
-              // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + (nzc1[k] + 6)] += FE0_f0_D01[ip][k]*FE0_f2_D11[ip][j]*I[26];
-              // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + (nzc3[k] + 6)] += FE0_f0_D10[ip][k]*FE0_f2_D11[ip][j]*I[30];
-              // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D11[ip][j]*I[33];
+              A[nzc11[j]*12 + nzc11[k]] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[33];
             } // end loop over 'k'
           } // end loop over 'j'
         } // end loop over 'ip'
@@ -4913,10 +7599,10 @@ public:
         }
       case 1:
         {
-          // Total number of operations to compute element tensor (from this point): 6494
+          // Total number of operations to compute element tensor (from this point): 5882
         
         // Loop quadrature points for integral.
-        // Number of operations to compute element tensor for following IP loop = 6494
+        // Number of operations to compute element tensor for following IP loop = 5882
         for (unsigned int ip = 0; ip < 2; ip++)
         {
           
@@ -4926,97 +7612,97 @@ public:
           I[0] = G[3]*W2[ip];
           
           // Number of operations: 1
-          I[1] = G[15]*W2[ip];
+          I[1] = G[7]*W2[ip];
           
           // Number of operations: 1
-          I[2] = G[32]*W2[ip];
+          I[2] = G[33]*W2[ip];
           
           // Number of operations: 1
-          I[3] = G[7]*W2[ip];
+          I[3] = G[11]*W2[ip];
           
           // Number of operations: 1
-          I[4] = G[0]*W2[ip];
+          I[4] = G[15]*W2[ip];
           
           // Number of operations: 1
-          I[5] = G[12]*W2[ip];
+          I[5] = G[0]*W2[ip];
           
           // Number of operations: 1
-          I[6] = G[11]*W2[ip];
+          I[6] = G[4]*W2[ip];
           
           // Number of operations: 1
-          I[7] = G[20]*W2[ip];
+          I[7] = G[19]*W2[ip];
           
           // Number of operations: 1
-          I[8] = G[4]*W2[ip];
+          I[8] = G[27]*W2[ip];
           
           // Number of operations: 1
-          I[9] = G[1]*W2[ip];
+          I[9] = G[23]*W2[ip];
           
           // Number of operations: 1
-          I[10] = G[2]*W2[ip];
+          I[10] = G[8]*W2[ip];
           
           // Number of operations: 1
-          I[11] = G[13]*W2[ip];
+          I[11] = G[12]*W2[ip];
           
           // Number of operations: 1
-          I[12] = G[14]*W2[ip];
+          I[12] = G[1]*W2[ip];
           
           // Number of operations: 1
-          I[13] = G[28]*W2[ip];
+          I[13] = G[2]*W2[ip];
           
           // Number of operations: 1
-          I[14] = G[25]*W2[ip];
+          I[14] = G[5]*W2[ip];
           
           // Number of operations: 1
-          I[15] = G[30]*W2[ip];
+          I[15] = G[6]*W2[ip];
           
           // Number of operations: 1
-          I[16] = G[33]*W2[ip];
+          I[16] = G[30]*W2[ip];
           
           // Number of operations: 1
-          I[17] = G[5]*W2[ip];
+          I[17] = G[32]*W2[ip];
           
           // Number of operations: 1
-          I[18] = G[6]*W2[ip];
+          I[18] = G[9]*W2[ip];
           
           // Number of operations: 1
-          I[19] = G[8]*W2[ip];
+          I[19] = G[10]*W2[ip];
           
           // Number of operations: 1
-          I[20] = G[16]*W2[ip];
+          I[20] = G[13]*W2[ip];
           
           // Number of operations: 1
-          I[21] = G[9]*W2[ip];
+          I[21] = G[14]*W2[ip];
           
           // Number of operations: 1
-          I[22] = G[10]*W2[ip];
+          I[22] = G[16]*W2[ip];
           
           // Number of operations: 1
-          I[23] = G[18]*W2[ip];
+          I[23] = G[24]*W2[ip];
           
           // Number of operations: 1
-          I[24] = G[17]*W2[ip];
+          I[24] = G[20]*W2[ip];
           
           // Number of operations: 1
-          I[25] = G[19]*W2[ip];
+          I[25] = G[17]*W2[ip];
           
           // Number of operations: 1
-          I[26] = G[21]*W2[ip];
+          I[26] = G[18]*W2[ip];
           
           // Number of operations: 1
-          I[27] = G[23]*W2[ip];
+          I[27] = G[25]*W2[ip];
           
           // Number of operations: 1
-          I[28] = G[27]*W2[ip];
+          I[28] = G[26]*W2[ip];
           
           // Number of operations: 1
-          I[29] = G[22]*W2[ip];
+          I[29] = G[21]*W2[ip];
           
           // Number of operations: 1
-          I[30] = G[24]*W2[ip];
+          I[30] = G[22]*W2[ip];
           
           // Number of operations: 1
-          I[31] = G[26]*W2[ip];
+          I[31] = G[28]*W2[ip];
           
           // Number of operations: 1
           I[32] = G[29]*W2[ip];
@@ -5025,43 +7711,51 @@ public:
           I[33] = G[31]*W2[ip];
           
           
-          // Number of operations for primary indices: 189
+          // Number of operations for primary indices: 243
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc13[k]] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[0];
+              A[(nzc2[j] + 6)*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[0];
+              // Number of operations to compute entry: 3
+              A[(nzc9[j] + 6)*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[1];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + nzc13[k]] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[1];
+              A[nzc12[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[0];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[0];
+              A[nzc12[j]*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[1];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[1];
+              A[nzc12[j]*12 + nzc12[k]] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[2];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc13[k]] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[2];
+              A[nzc12[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[3];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[3];
+              A[nzc12[j]*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[4];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc13[k]] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[3];
+              A[nzc2[j]*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[3];
+              // Number of operations to compute entry: 3
+              A[nzc5[j]*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[4];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 252
           for (unsigned int j = 0; j < 3; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[4];
+              A[(nzc2[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[5];
+              // Number of operations to compute entry: 3
+              A[(nzc9[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[6];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + (nzc7[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f1_D01[ip][k]*I[5];
+              A[nzc12[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[7];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[6];
+              A[nzc12[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f2_D10[ip][j]*I[8];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f2_D10[ip][j]*I[7];
+              A[nzc12[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[9];
+              // Number of operations to compute entry: 3
+              A[nzc2[j]*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[10];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D20[ip][j]*I[8];
+              A[nzc5[j]*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[11];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -5071,57 +7765,65 @@ public:
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[9];
+              A[(nzc2[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[12];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc11[k]] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[10];
+              A[(nzc2[j] + 6)*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[13];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + (nzc8[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f1_D10[ip][k]*I[11];
+              A[(nzc9[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[14];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + nzc11[k]] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[12];
+              A[(nzc9[j] + 6)*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[15];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[13];
+              A[nzc12[j]*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f2_D10[ip][j]*I[16];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f2_D10[ip][j]*I[14];
+              A[nzc12[j]*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[17];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[15];
+              A[nzc2[j]*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[18];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc14[k]] += FE0_f2_D10[ip][j]*FE0_f2_D11[ip][k]*I[16];
+              A[nzc2[j]*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f1_D20[ip][j]*I[17];
+              A[nzc5[j]*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc11[k]] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[18];
+              A[nzc5[j]*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[21];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 180
+          // Number of operations for primary indices: 252
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc13[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[6];
+              A[(nzc4[j] + 6)*12 + nzc12[k]] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[7];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[4];
+              A[(nzc7[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[5];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f1_D01[ip][j]*I[5];
+              A[(nzc7[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[6];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc13[k]] += FE0_f1_D01[ip][j]*FE0_f2_D10[ip][k]*I[7];
+              A[(nzc7[j] + 6)*12 + nzc12[k]] += FE0_f1_D01[ip][j]*FE0_f2_D10[ip][k]*I[8];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc9[k]] += FE0_f1_D01[ip][j]*FE0_f1_D20[ip][k]*I[8];
+              A[(nzc7[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[10];
+              // Number of operations to compute entry: 3
+              A[(nzc7[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[11];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + nzc12[k]] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[9];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 144
+          // Number of operations for primary indices: 240
           for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D01[ip][k]*I[19];
+              A[(nzc4[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[22];
+              // Number of operations to compute entry: 3
+              A[(nzc7[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[22];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D01[ip][j]*I[19];
+              A[(nzc7[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[23];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D01[ip][k]*I[20];
+              A[(nzc7[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[24];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[24];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -5131,17 +7833,17 @@ public:
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f1_D10[ip][k]*I[21];
+              A[(nzc4[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[25];
               // Number of operations to compute entry: 3
-              A[(nzc2[j] + 6)*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[22];
+              A[(nzc4[j] + 6)*12 + nzc11[k]] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[26];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D01[ip][j]*I[23];
+              A[(nzc7[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[27];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D01[ip][j]*FE0_f1_D10[ip][k]*I[24];
+              A[(nzc7[j] + 6)*12 + nzc11[k]] += FE0_f1_D01[ip][j]*FE0_f2_D01[ip][k]*I[28];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc11[k]] += FE0_f1_D01[ip][j]*FE0_f2_D01[ip][k]*I[25];
+              A[nzc4[j]*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[29];
               // Number of operations to compute entry: 3
-              A[(nzc7[j] + 6)*12 + nzc14[k]] += FE0_f1_D01[ip][j]*FE0_f2_D11[ip][k]*I[26];
+              A[nzc4[j]*12 + nzc11[k]] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[30];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -5151,25 +7853,25 @@ public:
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc13[k]] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[13];
+              A[(nzc8[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[12];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[9];
+              A[(nzc8[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[14];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f1_D10[ip][j]*I[11];
+              A[(nzc8[j] + 6)*12 + nzc12[k]] += FE0_f1_D10[ip][j]*FE0_f2_D10[ip][k]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc13[k]] += FE0_f1_D10[ip][j]*FE0_f2_D10[ip][k]*I[14];
+              A[(nzc8[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[18];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc9[k]] += FE0_f1_D10[ip][j]*FE0_f1_D20[ip][k]*I[17];
+              A[(nzc8[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[10];
+              A[nzc11[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[13];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[12];
+              A[nzc11[j]*12 + (nzc9[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[15];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc13[k]] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[15];
+              A[nzc11[j]*12 + nzc12[k]] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[17];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[18];
+              A[nzc11[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + nzc13[k]] += FE0_f2_D10[ip][k]*FE0_f2_D11[ip][j]*I[16];
+              A[nzc11[j]*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[21];
             } // end loop over 'k'
           } // end loop over 'j'
           
@@ -5179,49 +7881,33 @@ public:
             for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D01[ip][k]*I[23];
+              A[(nzc8[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[25];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f1_D10[ip][j]*I[21];
+              A[(nzc8[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[27];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f1_D10[ip][j]*I[24];
+              A[(nzc8[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[22];
+              A[nzc11[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[26];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f2_D01[ip][j]*I[25];
+              A[nzc11[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f2_D01[ip][j]*I[28];
               // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + (nzc7[k] + 6)] += FE0_f1_D01[ip][k]*FE0_f2_D11[ip][j]*I[26];
+              A[nzc11[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[30];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 900
+          // Number of operations for primary indices: 300
           for (unsigned int j = 0; j < 5; j++)
           {
             for (unsigned int k = 0; k < 5; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f1_D10[ip][k]*I[27];
-              // Number of operations to compute entry: 3
-              A[(nzc4[j] + 6)*12 + nzc11[k]] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[28];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f1_D10[ip][j]*I[27];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[29];
-              // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc11[k]] += FE0_f1_D10[ip][j]*FE0_f2_D01[ip][k]*I[30];
+              A[(nzc8[j] + 6)*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][j]*FE0_f1_D10[ip][k]*I[31];
               // Number of operations to compute entry: 3
-              A[(nzc8[j] + 6)*12 + nzc14[k]] += FE0_f1_D10[ip][j]*FE0_f2_D11[ip][k]*I[31];
+              A[(nzc8[j] + 6)*12 + nzc11[k]] += FE0_f1_D10[ip][j]*FE0_f2_D01[ip][k]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[28];
-              // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f2_D01[ip][j]*I[30];
-              // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc11[k]] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[32];
-              // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc14[k]] += FE0_f2_D01[ip][j]*FE0_f2_D11[ip][k]*I[33];
+              A[nzc11[j]*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f2_D01[ip][j]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + (nzc8[k] + 6)] += FE0_f1_D10[ip][k]*FE0_f2_D11[ip][j]*I[31];
-              // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D11[ip][j]*I[33];
+              A[nzc11[j]*12 + nzc11[k]] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[33];
             } // end loop over 'k'
           } // end loop over 'j'
         } // end loop over 'ip'
@@ -5229,65 +7915,65 @@ public:
         }
       case 2:
         {
-          // Total number of operations to compute element tensor (from this point): 5828
+          // Total number of operations to compute element tensor (from this point): 5444
         
         // Loop quadrature points for integral.
-        // Number of operations to compute element tensor for following IP loop = 5828
+        // Number of operations to compute element tensor for following IP loop = 5444
         for (unsigned int ip = 0; ip < 2; ip++)
         {
           
           // Number of operations to compute ip constants: 34
           double I[34];
           // Number of operations: 1
-          I[0] = G[9]*W2[ip];
+          I[0] = G[28]*W2[ip];
           
           // Number of operations: 1
-          I[1] = G[11]*W2[ip];
+          I[1] = G[1]*W2[ip];
           
           // Number of operations: 1
-          I[2] = G[22]*W2[ip];
+          I[2] = G[5]*W2[ip];
           
           // Number of operations: 1
-          I[3] = G[1]*W2[ip];
+          I[3] = G[30]*W2[ip];
           
           // Number of operations: 1
-          I[4] = G[13]*W2[ip];
+          I[4] = G[9]*W2[ip];
           
           // Number of operations: 1
-          I[5] = G[25]*W2[ip];
+          I[5] = G[13]*W2[ip];
           
           // Number of operations: 1
-          I[6] = G[5]*W2[ip];
+          I[6] = G[3]*W2[ip];
           
           // Number of operations: 1
-          I[7] = G[3]*W2[ip];
+          I[7] = G[7]*W2[ip];
           
           // Number of operations: 1
-          I[8] = G[15]*W2[ip];
+          I[8] = G[33]*W2[ip];
           
           // Number of operations: 1
-          I[9] = G[32]*W2[ip];
+          I[9] = G[11]*W2[ip];
           
           // Number of operations: 1
-          I[10] = G[7]*W2[ip];
+          I[10] = G[15]*W2[ip];
           
           // Number of operations: 1
-          I[11] = G[8]*W2[ip];
+          I[11] = G[17]*W2[ip];
           
           // Number of operations: 1
-          I[12] = G[10]*W2[ip];
+          I[12] = G[21]*W2[ip];
           
           // Number of operations: 1
-          I[13] = G[17]*W2[ip];
+          I[13] = G[19]*W2[ip];
           
           // Number of operations: 1
           I[14] = G[23]*W2[ip];
           
           // Number of operations: 1
-          I[15] = G[24]*W2[ip];
+          I[15] = G[25]*W2[ip];
           
           // Number of operations: 1
-          I[16] = G[26]*W2[ip];
+          I[16] = G[29]*W2[ip];
           
           // Number of operations: 1
           I[17] = G[0]*W2[ip];
@@ -5296,28 +7982,28 @@ public:
           I[18] = G[2]*W2[ip];
           
           // Number of operations: 1
-          I[19] = G[12]*W2[ip];
+          I[19] = G[4]*W2[ip];
           
           // Number of operations: 1
-          I[20] = G[14]*W2[ip];
+          I[20] = G[6]*W2[ip];
           
           // Number of operations: 1
-          I[21] = G[20]*W2[ip];
+          I[21] = G[27]*W2[ip];
           
           // Number of operations: 1
-          I[22] = G[28]*W2[ip];
+          I[22] = G[32]*W2[ip];
           
           // Number of operations: 1
-          I[23] = G[30]*W2[ip];
+          I[23] = G[8]*W2[ip];
           
           // Number of operations: 1
-          I[24] = G[33]*W2[ip];
+          I[24] = G[10]*W2[ip];
           
           // Number of operations: 1
-          I[25] = G[4]*W2[ip];
+          I[25] = G[12]*W2[ip];
           
           // Number of operations: 1
-          I[26] = G[6]*W2[ip];
+          I[26] = G[14]*W2[ip];
           
           // Number of operations: 1
           I[27] = G[16]*W2[ip];
@@ -5326,16 +8012,16 @@ public:
           I[28] = G[18]*W2[ip];
           
           // Number of operations: 1
-          I[29] = G[19]*W2[ip];
+          I[29] = G[20]*W2[ip];
           
           // Number of operations: 1
-          I[30] = G[21]*W2[ip];
+          I[30] = G[22]*W2[ip];
           
           // Number of operations: 1
-          I[31] = G[27]*W2[ip];
+          I[31] = G[24]*W2[ip];
           
           // Number of operations: 1
-          I[32] = G[29]*W2[ip];
+          I[32] = G[26]*W2[ip];
           
           // Number of operations: 1
           I[33] = G[31]*W2[ip];
@@ -5347,157 +8033,189 @@ public:
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[0];
+              A[(nzc12[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[0];
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + nzc13[k]] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[1];
+              A[(nzc12[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[1];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[0];
+              A[(nzc12[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[2];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[2];
+              A[(nzc12[j] + 6)*12 + nzc12[k]] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[3];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[3];
+              A[(nzc12[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[4];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[4];
+              A[(nzc12[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[5];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc13[k]] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[5];
+              A[(nzc2[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[1];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[6];
+              A[(nzc2[j] + 6)*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[6];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[3];
+              A[(nzc5[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[2];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc13[k]] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[7];
+              A[(nzc5[j] + 6)*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[7];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + (nzc13[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[4];
+              A[nzc12[j]*12 + (nzc12[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[3];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + nzc13[k]] += FE0_f0_D20[ip][j]*FE0_f2_D10[ip][k]*I[8];
+              A[nzc12[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[6];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[1];
+              A[nzc12[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[7];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc13[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[5];
+              A[nzc12[j]*12 + nzc12[k]] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[8];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[7];
+              A[nzc12[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[9];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f2_D10[ip][j]*I[8];
+              A[nzc12[j]*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D10[ip][j]*I[10];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc13[k]] += FE0_f2_D10[ip][j]*FE0_f2_D10[ip][k]*I[9];
+              A[nzc2[j]*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[4];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D10[ip][j]*I[10];
+              A[nzc2[j]*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[9];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc13[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[6];
+              A[nzc5[j]*12 + (nzc12[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[5];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc13[k]] += FE0_f1_D20[ip][j]*FE0_f2_D10[ip][k]*I[10];
+              A[nzc5[j]*12 + nzc12[k]] += FE0_f0_D02[ip][j]*FE0_f2_D10[ip][k]*I[10];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 720
+          // Number of operations for primary indices: 144
           for (unsigned int j = 0; j < 3; j++)
           {
-            for (unsigned int k = 0; k < 5; k++)
+            for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[11];
+              A[(nzc12[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[11];
               // Number of operations to compute entry: 3
-              A[(nzc12[j] + 6)*12 + nzc11[k]] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[12];
+              A[(nzc12[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[12];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[13];
+              A[nzc12[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[13];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + (nzc14[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D11[ip][k]*I[14];
+              A[nzc12[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D10[ip][j]*I[14];
+            } // end loop over 'k'
+          } // end loop over 'j'
+          
+          // Number of operations for primary indices: 540
+          for (unsigned int j = 0; j < 3; j++)
+          {
+            for (unsigned int k = 0; k < 5; k++)
+            {
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[15];
+              A[(nzc12[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[15];
               // Number of operations to compute entry: 3
-              A[(nzc13[j] + 6)*12 + nzc14[k]] += FE0_f2_D10[ip][j]*FE0_f2_D11[ip][k]*I[16];
+              A[(nzc12[j] + 6)*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[16];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[17];
+              A[(nzc2[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[17];
               // Number of operations to compute entry: 3
-              A[(nzc9[j] + 6)*12 + nzc11[k]] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[18];
+              A[(nzc2[j] + 6)*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[18];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + (nzc11[k] + 6)] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[19];
+              A[(nzc5[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[19];
               // Number of operations to compute entry: 3
-              A[nzc12[j]*12 + nzc11[k]] += FE0_f0_D20[ip][j]*FE0_f2_D01[ip][k]*I[20];
+              A[(nzc5[j] + 6)*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[21];
+              A[nzc12[j]*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[21];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + (nzc14[k] + 6)] += FE0_f2_D10[ip][j]*FE0_f2_D11[ip][k]*I[22];
+              A[nzc12[j]*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[22];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D10[ip][j]*I[23];
+              A[nzc2[j]*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[23];
               // Number of operations to compute entry: 3
-              A[nzc13[j]*12 + nzc14[k]] += FE0_f2_D10[ip][j]*FE0_f2_D11[ip][k]*I[24];
+              A[nzc2[j]*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + (nzc11[k] + 6)] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[25];
+              A[nzc5[j]*12 + (nzc11[k] + 6)] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[25];
               // Number of operations to compute entry: 3
-              A[nzc9[j]*12 + nzc11[k]] += FE0_f1_D20[ip][j]*FE0_f2_D01[ip][k]*I[26];
+              A[nzc5[j]*12 + nzc11[k]] += FE0_f0_D02[ip][j]*FE0_f2_D01[ip][k]*I[26];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 720
-          for (unsigned int j = 0; j < 5; j++)
+          // Number of operations for primary indices: 144
+          for (unsigned int j = 0; j < 4; j++)
           {
             for (unsigned int k = 0; k < 3; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[11];
+              A[(nzc4[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[11];
+              // Number of operations to compute entry: 3
+              A[(nzc4[j] + 6)*12 + nzc12[k]] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[13];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + (nzc12[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[12];
+              // Number of operations to compute entry: 3
+              A[nzc4[j]*12 + nzc12[k]] += FE0_f0_D11[ip][j]*FE0_f2_D10[ip][k]*I[14];
+            } // end loop over 'k'
+          } // end loop over 'j'
+          
+          // Number of operations for primary indices: 240
+          for (unsigned int j = 0; j < 4; j++)
+          {
+            for (unsigned int k = 0; k < 5; k++)
+            {
+              // Number of operations to compute entry: 3
+              A[(nzc4[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[27];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[13];
+              A[(nzc4[j] + 6)*12 + nzc11[k]] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[28];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[17];
+              A[nzc4[j]*12 + (nzc11[k] + 6)] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[29];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[19];
+              A[nzc4[j]*12 + nzc11[k]] += FE0_f0_D11[ip][j]*FE0_f2_D01[ip][k]*I[30];
+            } // end loop over 'k'
+          } // end loop over 'j'
+          
+          // Number of operations for primary indices: 540
+          for (unsigned int j = 0; j < 5; j++)
+          {
+            for (unsigned int k = 0; k < 3; k++)
+            {
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc13[k]] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[21];
+              A[(nzc11[j] + 6)*12 + (nzc12[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[15];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[25];
+              A[(nzc11[j] + 6)*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[17];
               // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + (nzc13[k] + 6)] += FE0_f2_D10[ip][k]*FE0_f2_D11[ip][j]*I[14];
+              A[(nzc11[j] + 6)*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[19];
               // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + nzc13[k]] += FE0_f2_D10[ip][k]*FE0_f2_D11[ip][j]*I[22];
+              A[(nzc11[j] + 6)*12 + nzc12[k]] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[21];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc12[k] + 6)] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[12];
+              A[(nzc11[j] + 6)*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[23];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc13[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[15];
+              A[(nzc11[j] + 6)*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[25];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc9[k] + 6)] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[18];
+              A[nzc11[j]*12 + (nzc12[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[16];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc12[k]] += FE0_f0_D20[ip][k]*FE0_f2_D01[ip][j]*I[20];
+              A[nzc11[j]*12 + (nzc2[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[18];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc13[k]] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[23];
+              A[nzc11[j]*12 + (nzc5[k] + 6)] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[20];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc9[k]] += FE0_f1_D20[ip][k]*FE0_f2_D01[ip][j]*I[26];
+              A[nzc11[j]*12 + nzc12[k]] += FE0_f2_D01[ip][j]*FE0_f2_D10[ip][k]*I[22];
               // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + (nzc13[k] + 6)] += FE0_f2_D10[ip][k]*FE0_f2_D11[ip][j]*I[16];
+              A[nzc11[j]*12 + nzc2[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[24];
               // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + nzc13[k]] += FE0_f2_D10[ip][k]*FE0_f2_D11[ip][j]*I[24];
+              A[nzc11[j]*12 + nzc5[k]] += FE0_f0_D02[ip][k]*FE0_f2_D01[ip][j]*I[26];
             } // end loop over 'k'
           } // end loop over 'j'
           
-          // Number of operations for primary indices: 900
+          // Number of operations for primary indices: 240
           for (unsigned int j = 0; j < 5; j++)
           {
-            for (unsigned int k = 0; k < 5; k++)
+            for (unsigned int k = 0; k < 4; k++)
             {
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[27];
-              // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + (nzc14[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D11[ip][k]*I[28];
-              // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc11[k]] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[29];
+              A[(nzc11[j] + 6)*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[27];
               // Number of operations to compute entry: 3
-              A[(nzc11[j] + 6)*12 + nzc14[k]] += FE0_f2_D01[ip][j]*FE0_f2_D11[ip][k]*I[30];
-              // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D11[ip][j]*I[28];
-              // Number of operations to compute entry: 3
-              A[(nzc14[j] + 6)*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D11[ip][j]*I[31];
+              A[(nzc11[j] + 6)*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[29];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[29];
+              A[nzc11[j]*12 + (nzc4[k] + 6)] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[28];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + (nzc14[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D11[ip][k]*I[31];
+              A[nzc11[j]*12 + nzc4[k]] += FE0_f0_D11[ip][k]*FE0_f2_D01[ip][j]*I[30];
+            } // end loop over 'k'
+          } // end loop over 'j'
+          
+          // Number of operations for primary indices: 300
+          for (unsigned int j = 0; j < 5; j++)
+          {
+            for (unsigned int k = 0; k < 5; k++)
+            {
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc11[k]] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[32];
+              A[(nzc11[j] + 6)*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[31];
               // Number of operations to compute entry: 3
-              A[nzc11[j]*12 + nzc14[k]] += FE0_f2_D01[ip][j]*FE0_f2_D11[ip][k]*I[33];
+              A[(nzc11[j] + 6)*12 + nzc11[k]] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][k]*FE0_f2_D11[ip][j]*I[30];
+              A[nzc11[j]*12 + (nzc11[k] + 6)] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[32];
               // Number of operations to compute entry: 3
-              A[nzc14[j]*12 + nzc11[k]] += FE0_f2_D01[ip][k]*FE0_f2_D11[ip][j]*I[33];
+              A[nzc11[j]*12 + nzc11[k]] += FE0_f2_D01[ip][j]*FE0_f2_D01[ip][k]*I[33];
             } // end loop over 'k'
           } // end loop over 'j'
         } // end loop over 'ip'
@@ -5513,38 +8231,31 @@ public:
 
 };
 
-/// 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 biharmonic_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   biharmonic_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~biharmonic_cell_integral_1_otherwise()
+  ~biharmonic_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    6
@@ -5553,7 +8264,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5582,82 +8293,74 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class biharmonic_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   biharmonic_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~biharmonic_form_0()
+  ~biharmonic_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "6beb2f07cbb3a8c89289e2a018f5c8e00d73aabffbbc9a66b06995ffce26cba15fb55daa45c376d0749a8a3ba952aed08895223e1d7aa75b675ae962f1ec04ad";
+    return "9d0a970db85ef744ea93e9590448b141b75eeac86324b33f70e5924b5c9776b26a958402c5fa79ea5c09900db45f33740c9bb831e809aacf3e99523174f35417";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new biharmonic_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new biharmonic_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new biharmonic_finite_element_1();
+        return new biharmonic_finite_element_3();
         break;
       }
     case 1:
       {
-        return new biharmonic_finite_element_1();
+        return new biharmonic_finite_element_3();
         break;
       }
     case 2:
       {
-        return new biharmonic_finite_element_0();
+        return new biharmonic_finite_element_2();
         break;
       }
     }
@@ -5665,24 +8368,23 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new biharmonic_dofmap_1();
+        return new biharmonic_dofmap_3();
         break;
       }
     case 1:
       {
-        return new biharmonic_dofmap_1();
+        return new biharmonic_dofmap_3();
         break;
       }
     case 2:
       {
-        return new biharmonic_dofmap_0();
+        return new biharmonic_dofmap_2();
         break;
       }
     }
@@ -5690,203 +8392,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return new biharmonic_cell_integral_0_otherwise();
+  }
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return new biharmonic_interior_facet_integral_0_otherwise();
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new biharmonic_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
-    return new biharmonic_interior_facet_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class biharmonic_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   biharmonic_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~biharmonic_form_1()
+  ~biharmonic_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "07b6393b633a38325050104913c136e7e5d2b2da205ac08c6ad897ae1258184c9375821d518bfb41a40331a1e3897d3a5cbbad74735bc7a72894514860ffe114";
+    return "9050c89a2c6705ec05da94c4d5c93d1d37302b91b6887ea41c8842c0fbd8b77d1bd95bd6274fd5b43b484e3d801496a90a286f3c61fe7a258147be1208ad6abe";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new biharmonic_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new biharmonic_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new biharmonic_finite_element_1();
+        return new biharmonic_finite_element_3();
         break;
       }
     case 1:
       {
-        return new biharmonic_finite_element_1();
+        return new biharmonic_finite_element_3();
         break;
       }
     }
@@ -5894,19 +8624,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new biharmonic_dofmap_1();
+        return new biharmonic_dofmap_3();
         break;
       }
     case 1:
       {
-        return new biharmonic_dofmap_1();
+        return new biharmonic_dofmap_3();
         break;
       }
     }
@@ -5914,126 +8643,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new biharmonic_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -6047,14 +8812,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Biharmonic
 {
@@ -6063,43 +8834,20 @@ class CoefficientSpace_alpha: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_alpha(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_alpha(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_alpha(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_alpha(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6110,43 +8858,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6157,43 +8882,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6204,45 +8906,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -6254,75 +8973,114 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     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);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_0());
+    _ufc_form = std::make_shared<const biharmonic_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& alpha):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::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);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->alpha = alpha;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_0());
+    _ufc_form = std::make_shared<const biharmonic_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::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);
+  // Destructor
+  ~Form_a()
+  {}
 
-    this->alpha = *alpha;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "alpha")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 1), alpha(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "alpha";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_alpha;
+
+  // Coefficients
+  dolfin::CoefficientAssigner alpha;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& alpha):
-    dolfin::Form(2, 1), alpha(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), alpha(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->alpha = alpha;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> alpha):
-    dolfin::Form(2, 1), alpha(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> alpha):
+    dolfin::MultiMeshForm(V1, V0), alpha(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->alpha = *alpha;
+    /// Assign coefficients
+    this->alpha = alpha;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -6355,55 +9113,54 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_alpha;
 
   // Coefficients
-  dolfin::CoefficientAssigner alpha;
+  dolfin::MultiMeshCoefficientAssigner alpha;
 };
 
 class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), mesh)))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<biharmonic_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<biharmonic_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new biharmonic_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new biharmonic_dofmap_1()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -6415,69 +9172,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_1());
+    _ufc_form = std::make_shared<const biharmonic_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_1());
+    _ufc_form = std::make_shared<const biharmonic_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new biharmonic_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -6509,18 +9307,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/biharmonic/cpp/CMakeLists.txt b/demo/documented/biharmonic/cpp/CMakeLists.txt
index 686e1c6..c1d318e 100644
--- a/demo/documented/biharmonic/cpp/CMakeLists.txt
+++ b/demo/documented/biharmonic/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/biharmonic/cpp/compile.log b/demo/documented/biharmonic/cpp/compile.log
index 70378a0..6eb3502 100644
--- a/demo/documented/biharmonic/cpp/compile.log
+++ b/demo/documented/biharmonic/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Biharmonic
 
@@ -13,24 +14,24 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0, v_1)'
   Number of coefficients:              1
   Coefficients:                        '[w_1]'
-  Unique elements:                     'CG2(?), R0(?)'
-  Unique sub elements:                 'CG2(?), R0(?)'
+  Unique elements:                     'CG2(?), R0(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG2(?), R0(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -38,8 +39,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -47,20 +48,32 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.128394 seconds.
+Compiler stage 1 finished in 0.261419 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 2 elements
+  Computing representation of 4 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 2 dofmaps
   Reusing element from cache
+  Computing representation of 4 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
@@ -70,9 +83,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
+  {1: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
           [  0.00000000e+00]],
   
          [[  8.88178420e-16],
@@ -120,22 +134,22 @@ Compiler stage 2: Computing intermediate representation
           [ 0.33333333]],
   
          [[ 0.        ],
-          [ 0.33333333]]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {None: {(0, 1): array([[ -3.33333333e-01],
-         [  7.34134975e-15],
+          [ 0.33333333]]])}}}, FiniteElement('Lagrange', triangle, 2): {None: {None: {(0, 1): array([[ -3.33333333e-01],
+         [  7.45237205e-15],
          [  3.33333333e-01],
          [  1.33333333e+00],
-         [  9.27036226e-15],
+         [  9.43689571e-15],
          [ -1.33333333e+00]]), (0, 0): array([[-0.11111111],
          [-0.11111111],
          [-0.11111111],
          [ 0.44444444],
          [ 0.44444444],
          [ 0.44444444]]), (0, 2): array([[  4.00000000e+00],
-         [  2.88657986e-15],
+         [  3.77475828e-15],
          [  4.00000000e+00],
-         [ -2.66453526e-15],
+         [ -3.55271368e-15],
          [ -8.00000000e+00],
-         [ -2.44249065e-15]]), (2, 0): array([[ 4.],
+         [ -3.10862447e-15]]), (2, 0): array([[ 4.],
          [ 4.],
          [ 0.],
          [ 0.],
@@ -145,7 +159,7 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00],
          [  1.33333333e+00],
          [ -1.33333333e+00],
-         [ -7.07941648e-17]]), (1, 1): array([[  4.00000000e+00],
+         [ -2.43306259e-16]]), (1, 1): array([[  4.00000000e+00],
          [  7.32747196e-15],
          [  0.00000000e+00],
          [  4.00000000e+00],
@@ -154,9 +168,9 @@ Compiler stage 2: Computing intermediate representation
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17]]), 'FE0_D02': array([[  4.00000000e+00,   2.88657986e-15,   4.00000000e+00,
-           -2.66453526e-15,  -8.00000000e+00,  -2.44249065e-15]]), 'FE0_D01': array([[ -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00]]), 'FE0_D11': array([[  4.00000000e+00,   7.32747196e-15,   0.00000000e+00,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16]]), 'FE0_D02': array([[  4.00000000e+00,   3.77475828e-15,   4.00000000e+00,
+           -3.55271368e-15,  -8.00000000e+00,  -3.10862447e-15]]), 'FE0_D01': array([[ -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00]]), 'FE0_D11': array([[  4.00000000e+00,   7.32747196e-15,   0.00000000e+00,
             4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
            0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
            0.33333333]]), 'FE0_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
@@ -165,9 +179,9 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]])}
   
   tables: {'FE0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17]]), 'FE0_D02': array([[  4.00000000e+00,   2.88657986e-15,   4.00000000e+00,
-           -2.66453526e-15,  -8.00000000e+00,  -2.44249065e-15]]), 'FE0_D01': array([[ -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00]]), 'FE0_D11': array([[  4.00000000e+00,   7.32747196e-15,   0.00000000e+00,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16]]), 'FE0_D02': array([[  4.00000000e+00,   3.77475828e-15,   4.00000000e+00,
+           -3.55271368e-15,  -8.00000000e+00,  -3.10862447e-15]]), 'FE0_D01': array([[ -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00]]), 'FE0_D11': array([[  4.00000000e+00,   7.32747196e-15,   0.00000000e+00,
             4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
            0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
            0.33333333]]), 'FE0_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
@@ -204,9 +218,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {2: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {0: {(0, 0): array([[ 1.,  1.]])}, 1: {(0, 0): array([[ 1.,  1.]])}, 2: {(0, 0): array([[ 1.,  1.]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
+  {2: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16],
@@ -350,8 +365,8 @@ Compiler stage 2: Computing intermediate representation
           [ 0.21132487,  0.78867513]],
   
          [[ 0.        ,  0.        ],
-          [ 0.        ,  0.        ]]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {0: {(0, 1): array([[  1.00000000e+00,   1.00000000e+00],
-         [  8.93729535e-15,   8.43769499e-15],
+          [ 0.        ,  0.        ]]])}}}, FiniteElement('Real', triangle, 0): {None: {0: {(0, 0): array([[ 1.,  1.]])}, 1: {(0, 0): array([[ 1.,  1.]])}, 2: {(0, 0): array([[ 1.,  1.]])}}}, FiniteElement('Lagrange', triangle, 2): {None: {0: {(0, 1): array([[  1.00000000e+00,   1.00000000e+00],
+         [  8.60422844e-15,   7.54951657e-15],
          [ -1.54700538e-01,   2.15470054e+00],
          [  3.15470054e+00,   8.45299462e-01],
          [ -8.45299462e-01,  -3.15470054e+00],
@@ -361,11 +376,11 @@ Compiler stage 2: Computing intermediate representation
          [  6.66666667e-01,   6.66666667e-01],
          [ -1.38777878e-17,  -5.55111512e-17],
          [ -1.73472348e-17,  -4.16333634e-17]]), (0, 2): array([[  4.00000000e+00,   4.00000000e+00],
-         [  2.88657986e-15,   3.33066907e-15],
+         [  5.10702591e-15,   0.00000000e+00],
          [  4.00000000e+00,   4.00000000e+00],
-         [ -1.77635684e-15,  -1.19904087e-14],
+         [ -3.10862447e-15,  -6.66133815e-15],
          [ -8.00000000e+00,  -8.00000000e+00],
-         [ -1.77635684e-15,   1.99840144e-15]]), (2, 0): array([[ 4.,  4.],
+         [ -4.88498131e-15,   3.33066907e-15]]), (2, 0): array([[ 4.,  4.],
          [ 4.,  4.],
          [ 0.,  0.],
          [ 0.,  0.],
@@ -376,26 +391,26 @@ Compiler stage 2: Computing intermediate representation
          [ 0.84529946,  3.15470054],
          [-0.84529946, -3.15470054],
          [-3.15470054, -0.84529946]]), (1, 1): array([[  4.00000000e+00,   4.00000000e+00],
-         [  1.19904087e-14,   2.44249065e-15],
+         [  9.32587341e-15,   5.77315973e-15],
          [  0.00000000e+00,   0.00000000e+00],
          [  4.00000000e+00,   4.00000000e+00],
          [ -4.00000000e+00,  -4.00000000e+00],
          [ -4.00000000e+00,  -4.00000000e+00]])}, 1: {(0, 1): array([[ -2.15470054e+00,   1.54700538e-01],
-         [  5.82867088e-15,   7.77156117e-15],
+         [  5.49560397e-15,   6.66133815e-15],
          [ -1.54700538e-01,   2.15470054e+00],
-         [ -1.13242749e-14,  -1.64313008e-14],
+         [ -1.06581410e-14,  -1.55431223e-14],
          [  2.30940108e+00,  -2.30940108e+00],
-         [  1.60982339e-15,   2.33146835e-15]]), (0, 0): array([[  4.55341801e-01,  -1.22008468e-01],
+         [  1.60982339e-15,   3.21964677e-15]]), (0, 0): array([[  4.55341801e-01,  -1.22008468e-01],
          [  2.08166817e-17,   9.02056208e-17],
          [ -1.22008468e-01,   4.55341801e-01],
          [ -1.38777878e-17,  -2.77555756e-17],
          [  6.66666667e-01,   6.66666667e-01],
          [ -1.73472348e-17,  -4.16333634e-17]]), (0, 2): array([[  4.00000000e+00,   4.00000000e+00],
-         [  2.88657986e-15,   3.33066907e-15],
+         [  4.66293670e-15,   0.00000000e+00],
          [  4.00000000e+00,   4.00000000e+00],
-         [  4.44089210e-16,  -1.15463195e-14],
+         [ -3.55271368e-15,  -7.54951657e-15],
          [ -8.00000000e+00,  -8.00000000e+00],
-         [ -5.55111512e-15,   6.66133815e-16]]), (2, 0): array([[ 4.,  4.],
+         [ -5.10702591e-15,   3.10862447e-15]]), (2, 0): array([[ 4.,  4.],
          [ 4.,  4.],
          [ 0.,  0.],
          [ 0.,  0.],
@@ -406,12 +421,12 @@ Compiler stage 2: Computing intermediate representation
          [ 0.84529946,  3.15470054],
          [-0.84529946, -3.15470054],
          [ 3.15470054,  0.84529946]]), (1, 1): array([[  4.00000000e+00,   4.00000000e+00],
-         [  7.10542736e-15,   6.66133815e-16],
+         [  7.99360578e-15,   4.88498131e-15],
          [  0.00000000e+00,   0.00000000e+00],
          [  4.00000000e+00,   4.00000000e+00],
          [ -4.00000000e+00,  -4.00000000e+00],
          [ -4.00000000e+00,  -4.00000000e+00]])}, 2: {(0, 1): array([[ -2.15470054e+00,   1.54700538e-01],
-         [  5.99520433e-15,   8.10462808e-15],
+         [  5.32907052e-15,   7.32747196e-15],
          [ -1.00000000e+00,  -1.00000000e+00],
          [  8.45299462e-01,   3.15470054e+00],
          [  3.15470054e+00,   8.45299462e-01],
@@ -421,11 +436,11 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   2.77555756e-17],
          [  0.00000000e+00,  -5.55111512e-17],
          [  6.66666667e-01,   6.66666667e-01]]), (0, 2): array([[  4.00000000e+00,   4.00000000e+00],
-         [  2.88657986e-15,   2.88657986e-15],
+         [  6.43929354e-15,   6.43929354e-15],
          [  4.00000000e+00,   4.00000000e+00],
-         [  1.77635684e-15,   4.44089210e-16],
+         [ -3.99680289e-15,  -3.10862447e-15],
          [ -8.00000000e+00,  -8.00000000e+00],
-         [ -4.88498131e-15,  -1.77635684e-15]]), (2, 0): array([[ 4.,  4.],
+         [ -5.99520433e-15,  -5.55111512e-15]]), (2, 0): array([[ 4.,  4.],
          [ 4.,  4.],
          [ 0.,  0.],
          [ 0.,  0.],
@@ -436,14 +451,18 @@ Compiler stage 2: Computing intermediate representation
          [ -1.22124533e-15,  -1.22124533e-15],
          [  1.22124533e-15,   1.22124533e-15],
          [  2.30940108e+00,  -2.30940108e+00]]), (1, 1): array([[  4.00000000e+00,   4.00000000e+00],
-         [  8.43769499e-15,   1.24344979e-14],
+         [  7.54951657e-15,   8.43769499e-15],
          [  0.00000000e+00,   0.00000000e+00],
          [  4.00000000e+00,   4.00000000e+00],
          [ -4.00000000e+00,  -4.00000000e+00],
          [ -4.00000000e+00,  -4.00000000e+00]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_f0': array([[  2.77555756e-17,   4.55341801e-01,  -1.22008468e-01,
+  {'FE2_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f0': array([[  2.77555756e-17,   4.55341801e-01,  -1.22008468e-01,
             6.66666667e-01,  -1.38777878e-17,  -1.73472348e-17],
          [  4.16333634e-17,  -1.22008468e-01,   4.55341801e-01,
             6.66666667e-01,  -5.55111512e-17,  -4.16333634e-17]]), 'FE0_f1': array([[  4.55341801e-01,   2.08166817e-17,  -1.22008468e-01,
@@ -452,91 +471,87 @@ Compiler stage 2: Computing intermediate representation
            -2.77555756e-17,   6.66666667e-01,  -4.16333634e-17]]), 'FE0_f2': array([[  4.55341801e-01,  -1.22008468e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   6.66666667e-01],
          [ -1.22008468e-01,   4.55341801e-01,   0.00000000e+00,
-            2.77555756e-17,  -5.55111512e-17,   6.66666667e-01]]), 'FE2_f2': array([[ 1.],
-         [ 1.]]), 'FE1_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,  -5.55111512e-17,   6.66666667e-01]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_f1_D11': array([[  4.00000000e+00,   7.10542736e-15,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_f1_D11': array([[  4.00000000e+00,   7.99360578e-15,   0.00000000e+00,
             4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00],
-         [  4.00000000e+00,   6.66133815e-16,   0.00000000e+00,
+         [  4.00000000e+00,   4.88498131e-15,   0.00000000e+00,
             4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE0_f1_D10': array([[-2.15470054, -1.        ,  0.        ,  0.84529946, -0.84529946,
            3.15470054],
          [ 0.15470054, -1.        ,  0.        ,  3.15470054, -3.15470054,
            0.84529946]]), 'FE0_f2_D10': array([[ -2.15470054e+00,  -1.54700538e-01,   0.00000000e+00,
            -1.22124533e-15,   1.22124533e-15,   2.30940108e+00],
          [  1.54700538e-01,   2.15470054e+00,   0.00000000e+00,
-           -1.22124533e-15,   1.22124533e-15,  -2.30940108e+00]]), 'FE0_f2_D11': array([[  4.00000000e+00,   8.43769499e-15,   0.00000000e+00,
+           -1.22124533e-15,   1.22124533e-15,  -2.30940108e+00]]), 'FE0_f2_D11': array([[  4.00000000e+00,   7.54951657e-15,   0.00000000e+00,
             4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00],
-         [  4.00000000e+00,   1.24344979e-14,   0.00000000e+00,
-            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE1_f2_C0': array([[ 0.78867513,  0.21132487,  0.        ,  0.        ,  0.        ,
+         [  4.00000000e+00,   8.43769499e-15,   0.00000000e+00,
+            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE2_f2_C0': array([[ 0.78867513,  0.21132487,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.21132487,  0.78867513,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE1_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.78867513,  0.21132487,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.21132487,  0.78867513,
-           0.        ]]), 'FE2_f1': array([[ 1.],
-         [ 1.]]), 'FE1_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+           0.        ]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE2_f0_C0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f0_D10': array([[ 1.        ,  2.15470054,  0.        ,  0.84529946, -0.84529946,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_f0_D10': array([[ 1.        ,  2.15470054,  0.        ,  0.84529946, -0.84529946,
           -3.15470054],
          [ 1.        , -0.15470054,  0.        ,  3.15470054, -3.15470054,
-          -0.84529946]]), 'FE0_f0_D11': array([[  4.00000000e+00,   1.19904087e-14,   0.00000000e+00,
+          -0.84529946]]), 'FE0_f0_D11': array([[  4.00000000e+00,   9.32587341e-15,   0.00000000e+00,
             4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00],
-         [  4.00000000e+00,   2.44249065e-15,   0.00000000e+00,
-            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE1_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  4.00000000e+00,   5.77315973e-15,   0.00000000e+00,
+            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE2_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f2': array([[ 1.],
+         [ 1.]]), 'FE1_f1': array([[ 1.],
+         [ 1.]]), 'FE1_f0': array([[ 1.],
+         [ 1.]]), 'FE2_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_f2_D02': array([[  4.00000000e+00,   2.88657986e-15,   4.00000000e+00,
-            1.77635684e-15,  -8.00000000e+00,  -4.88498131e-15],
-         [  4.00000000e+00,   2.88657986e-15,   4.00000000e+00,
-            4.44089210e-16,  -8.00000000e+00,  -1.77635684e-15]]), 'FE0_f2_D01': array([[ -2.15470054e+00,   5.99520433e-15,  -1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_f2_D02': array([[  4.00000000e+00,   6.43929354e-15,   4.00000000e+00,
+           -3.99680289e-15,  -8.00000000e+00,  -5.99520433e-15],
+         [  4.00000000e+00,   6.43929354e-15,   4.00000000e+00,
+           -3.10862447e-15,  -8.00000000e+00,  -5.55111512e-15]]), 'FE0_f2_D01': array([[ -2.15470054e+00,   5.32907052e-15,  -1.00000000e+00,
             8.45299462e-01,   3.15470054e+00,  -8.45299462e-01],
-         [  1.54700538e-01,   8.10462808e-15,  -1.00000000e+00,
-            3.15470054e+00,   8.45299462e-01,  -3.15470054e+00]]), 'FE1_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_f2_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.],
-         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE1_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [  1.54700538e-01,   7.32747196e-15,  -1.00000000e+00,
+            3.15470054e+00,   8.45299462e-01,  -3.15470054e+00]]), 'FE0_f2_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.],
+         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.78867513,  0.21132487,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.21132487,  0.78867513,
+           0.        ]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f1_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.],
-         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE0_f1_D01': array([[ -2.15470054e+00,   5.82867088e-15,  -1.54700538e-01,
-           -1.13242749e-14,   2.30940108e+00,   1.60982339e-15],
-         [  1.54700538e-01,   7.77156117e-15,   2.15470054e+00,
-           -1.64313008e-14,  -2.30940108e+00,   2.33146835e-15]]), 'FE0_f1_D02': array([[  4.00000000e+00,   2.88657986e-15,   4.00000000e+00,
-            4.44089210e-16,  -8.00000000e+00,  -5.55111512e-15],
-         [  4.00000000e+00,   3.33066907e-15,   4.00000000e+00,
-           -1.15463195e-14,  -8.00000000e+00,   6.66133815e-16]]), 'FE0_f0_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.],
-         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE0_f0_D01': array([[  1.00000000e+00,   8.93729535e-15,  -1.54700538e-01,
+         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE0_f1_D01': array([[ -2.15470054e+00,   5.49560397e-15,  -1.54700538e-01,
+           -1.06581410e-14,   2.30940108e+00,   1.60982339e-15],
+         [  1.54700538e-01,   6.66133815e-15,   2.15470054e+00,
+           -1.55431223e-14,  -2.30940108e+00,   3.21964677e-15]]), 'FE0_f1_D02': array([[  4.00000000e+00,   4.66293670e-15,   4.00000000e+00,
+           -3.55271368e-15,  -8.00000000e+00,  -5.10702591e-15],
+         [  4.00000000e+00,   0.00000000e+00,   4.00000000e+00,
+           -7.54951657e-15,  -8.00000000e+00,   3.10862447e-15]]), 'FE0_f0_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.],
+         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE0_f0_D01': array([[  1.00000000e+00,   8.60422844e-15,  -1.54700538e-01,
             3.15470054e+00,  -8.45299462e-01,  -3.15470054e+00],
-         [  1.00000000e+00,   8.43769499e-15,   2.15470054e+00,
-            8.45299462e-01,  -3.15470054e+00,  -8.45299462e-01]]), 'FE2_f0': array([[ 1.],
-         [ 1.]]), 'FE0_f0_D02': array([[  4.00000000e+00,   2.88657986e-15,   4.00000000e+00,
-           -1.77635684e-15,  -8.00000000e+00,  -1.77635684e-15],
-         [  4.00000000e+00,   3.33066907e-15,   4.00000000e+00,
-           -1.19904087e-14,  -8.00000000e+00,   1.99840144e-15]]), 'FE1_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  1.00000000e+00,   7.54951657e-15,   2.15470054e+00,
+            8.45299462e-01,  -3.15470054e+00,  -8.45299462e-01]]), 'FE2_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_f0_D02': array([[  4.00000000e+00,   5.10702591e-15,   4.00000000e+00,
+           -3.10862447e-15,  -8.00000000e+00,  -4.88498131e-15],
+         [  4.00000000e+00,   0.00000000e+00,   4.00000000e+00,
+           -6.66133815e-15,  -8.00000000e+00,   3.33066907e-15]]), 'FE2_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f1_C0': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]])}
   
   tables: {'FE0_f0': array([[  2.77555756e-17,   4.55341801e-01,  -1.22008468e-01,
             6.66666667e-01,  -1.38777878e-17,  -1.73472348e-17],
@@ -547,7 +562,7 @@ Compiler stage 2: Computing intermediate representation
            -2.77555756e-17,   6.66666667e-01,  -4.16333634e-17]]), 'FE0_f2': array([[  4.55341801e-01,  -1.22008468e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   6.66666667e-01],
          [ -1.22008468e-01,   4.55341801e-01,   0.00000000e+00,
-            2.77555756e-17,  -5.55111512e-17,   6.66666667e-01]]), 'FE1_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,  -5.55111512e-17,   6.66666667e-01]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_f1_D10': array([[-2.15470054, -1.        ,  0.        ,  0.84529946, -0.84529946,
@@ -556,90 +571,75 @@ Compiler stage 2: Computing intermediate representation
            0.84529946]]), 'FE0_f2_D10': array([[ -2.15470054e+00,  -1.54700538e-01,   0.00000000e+00,
            -1.22124533e-15,   1.22124533e-15,   2.30940108e+00],
          [  1.54700538e-01,   2.15470054e+00,   0.00000000e+00,
-           -1.22124533e-15,   1.22124533e-15,  -2.30940108e+00]]), 'FE0_f2_D11': array([[  4.00000000e+00,   8.43769499e-15,   0.00000000e+00,
-            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00],
-         [  4.00000000e+00,   1.24344979e-14,   0.00000000e+00,
-            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE1_f2_C0': array([[ 0.78867513,  0.21132487,  0.        ,  0.        ,  0.        ,
+           -1.22124533e-15,   1.22124533e-15,  -2.30940108e+00]]), 'FE2_f2_C0': array([[ 0.78867513,  0.21132487,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.21132487,  0.78867513,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE1_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.78867513,  0.21132487,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.21132487,  0.78867513,
-           0.        ]]), 'FE0_f0_D10': array([[ 1.        ,  2.15470054,  0.        ,  0.84529946, -0.84529946,
-          -3.15470054],
-         [ 1.        , -0.15470054,  0.        ,  3.15470054, -3.15470054,
-          -0.84529946]]), 'FE0_f0_D11': array([[  4.00000000e+00,   1.19904087e-14,   0.00000000e+00,
-            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00],
-         [  4.00000000e+00,   2.44249065e-15,   0.00000000e+00,
-            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.        ]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE1_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f0_C0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01,
+            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE2_f0_C0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_f2_D02': array([[  4.00000000e+00,   2.88657986e-15,   4.00000000e+00,
-            1.77635684e-15,  -8.00000000e+00,  -4.88498131e-15],
-         [  4.00000000e+00,   2.88657986e-15,   4.00000000e+00,
-            4.44089210e-16,  -8.00000000e+00,  -1.77635684e-15]]), 'FE0_f2_D01': array([[ -2.15470054e+00,   5.99520433e-15,  -1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_f0_D10': array([[ 1.        ,  2.15470054,  0.        ,  0.84529946, -0.84529946,
+          -3.15470054],
+         [ 1.        , -0.15470054,  0.        ,  3.15470054, -3.15470054,
+          -0.84529946]]), 'FE0_f0_D11': array([[  4.00000000e+00,   9.32587341e-15,   0.00000000e+00,
+            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00],
+         [  4.00000000e+00,   5.77315973e-15,   0.00000000e+00,
+            4.00000000e+00,  -4.00000000e+00,  -4.00000000e+00]]), 'FE1_f0': array([[ 1.],
+         [ 1.]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_f2_D01': array([[ -2.15470054e+00,   5.32907052e-15,  -1.00000000e+00,
             8.45299462e-01,   3.15470054e+00,  -8.45299462e-01],
-         [  1.54700538e-01,   8.10462808e-15,  -1.00000000e+00,
-            3.15470054e+00,   8.45299462e-01,  -3.15470054e+00]]), 'FE1_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_f1_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.],
-         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE0_f1_D01': array([[ -2.15470054e+00,   5.82867088e-15,  -1.54700538e-01,
-           -1.13242749e-14,   2.30940108e+00,   1.60982339e-15],
-         [  1.54700538e-01,   7.77156117e-15,   2.15470054e+00,
-           -1.64313008e-14,  -2.30940108e+00,   2.33146835e-15]]), 'FE0_f0_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.],
-         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE0_f0_D01': array([[  1.00000000e+00,   8.93729535e-15,  -1.54700538e-01,
+         [  1.54700538e-01,   7.32747196e-15,  -1.00000000e+00,
+            3.15470054e+00,   8.45299462e-01,  -3.15470054e+00]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.78867513,  0.21132487,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.21132487,  0.78867513,
+           0.        ]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f1_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.],
+         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE0_f1_D01': array([[ -2.15470054e+00,   5.49560397e-15,  -1.54700538e-01,
+           -1.06581410e-14,   2.30940108e+00,   1.60982339e-15],
+         [  1.54700538e-01,   6.66133815e-15,   2.15470054e+00,
+           -1.55431223e-14,  -2.30940108e+00,   3.21964677e-15]]), 'FE0_f0_D20': array([[ 4.,  4.,  0.,  0.,  0., -8.],
+         [ 4.,  4.,  0.,  0.,  0., -8.]]), 'FE0_f0_D01': array([[  1.00000000e+00,   8.60422844e-15,  -1.54700538e-01,
             3.15470054e+00,  -8.45299462e-01,  -3.15470054e+00],
-         [  1.00000000e+00,   8.43769499e-15,   2.15470054e+00,
-            8.45299462e-01,  -3.15470054e+00,  -8.45299462e-01]]), 'FE2_f0': array([[ 1.],
-         [ 1.]]), 'FE0_f0_D02': array([[  4.00000000e+00,   2.88657986e-15,   4.00000000e+00,
-           -1.77635684e-15,  -8.00000000e+00,  -1.77635684e-15],
-         [  4.00000000e+00,   3.33066907e-15,   4.00000000e+00,
-           -1.19904087e-14,  -8.00000000e+00,   1.99840144e-15]]), 'FE1_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  1.00000000e+00,   7.54951657e-15,   2.15470054e+00,
+            8.45299462e-01,  -3.15470054e+00,  -8.45299462e-01]]), 'FE0_f0_D02': array([[  4.00000000e+00,   5.10702591e-15,   4.00000000e+00,
+           -3.10862447e-15,  -8.00000000e+00,  -4.88498131e-15],
+         [  4.00000000e+00,   0.00000000e+00,   4.00000000e+00,
+           -6.66133815e-15,  -8.00000000e+00,   3.33066907e-15]]), 'FE2_f1_C0': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f1_C0': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]])}
   
-  name_map: {'FE1_f0_C1_D01': ['FE1_f1_C1_D01', 'FE1_f2_C1_D01'], 'FE2_f0': ['FE2_f1', 'FE2_f2'], 'FE0_f0_D11': ['FE0_f1_D11'], 'FE1_f0_C1_D10': ['FE1_f1_C1_D10', 'FE1_f2_C1_D10'], 'FE0_f1_D20': ['FE0_f2_D20'], 'FE0_f0_D02': ['FE0_f1_D02'], 'FE1_f0_C0_D01': ['FE1_f1_C0_D01', 'FE1_f2_C0_D01'], 'FE1_f0_C0_D10': ['FE1_f1_C0_D10', 'FE1_f2_C0_D10']}
+  name_map: {'FE2_f0_C0_D01': ['FE2_f1_C0_D01', 'FE2_f2_C0_D01'], 'FE2_f0_C1_D10': ['FE2_f1_C1_D10', 'FE2_f2_C1_D10'], 'FE0_f0_D20': ['FE0_f2_D20'], 'FE2_f0_C1_D01': ['FE2_f1_C1_D01', 'FE2_f2_C1_D01'], 'FE0_f0_D02': ['FE0_f1_D02', 'FE0_f2_D02'], 'FE0_f0_D11': ['FE0_f1_D11', 'FE0_f2_D11'], 'FE2_f0_C0_D10': ['FE2_f1_C0_D10', 'FE2_f2_C0_D10'], 'FE1_f0': ['FE1_f1', 'FE1_f2']}
   
-  inv_name_map: {'FE0_f0': 'FE0_f0', 'FE1_f1_C0_D10': 'FE1_f0_C0_D10', 'FE0_f2': 'FE0_f2', 'FE0_f0_D01': 'FE0_f0_D01', 'FE1_f0_C1_D01': 'FE1_f0_C1_D01', 'FE1_f2_C1_D01': 'FE1_f0_C1_D01', 'FE1_f1_C1_D10': 'FE1_f0_C1_D10', 'FE0_f1_D11': 'FE0_f0_D11', 'FE0_f1_D10': 'FE0_f1_D10', 'FE0_f2_D10': 'FE0_f2_D10', 'FE0_f2_D11': 'FE0_f2_D11', 'FE1_f2_C0': 'FE1_f2_C0', 'FE1_f2_C1': 'FE1_f2_C1', 'FE0_f0_D02': 'FE0_f0_D02', 'FE1_f2_C0_D01': 'FE1_f0_C0_D01', 'FE0_f1': 'FE0_f1', 'FE0_f0_D10': 'FE0_f0_D10 [...]
+  inv_name_map: {'FE2_f1_C1_D01': 'FE2_f0_C1_D01', 'FE2_f2_C0_D10': 'FE2_f0_C0_D10', 'FE0_f0': 'FE0_f0', 'FE0_f1': 'FE0_f1', 'FE0_f2': 'FE0_f2', 'FE2_f0_C1_D01': 'FE2_f0_C1_D01', 'FE0_f1_D11': 'FE0_f0_D11', 'FE0_f1_D10': 'FE0_f1_D10', 'FE0_f2_D10': 'FE0_f2_D10', 'FE0_f2_D11': 'FE0_f0_D11', 'FE2_f0_C0_D10': 'FE2_f0_C0_D10', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0': 'FE2_f0_C0', 'FE2_f0_C0_D01': 'FE2_f0_C0_D01', 'FE2_f2_C1_D01': 'FE2_f0_C1_D01', 'FE0_f0_D10': 'FE0_f0_D10', 'FE0_f0_D11': 'FE0_ [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_f0': array([[ 0.4553418 , -0.12200847,  0.66666667],
          [-0.12200847,  0.4553418 ,  0.66666667]]), 'FE0_f1_D10': array([[-2.15470054, -1.        ,  0.84529946, -0.84529946,  3.15470054],
          [ 0.15470054, -1.        ,  3.15470054, -3.15470054,  0.84529946]]), 'FE0_f2_D10': array([[-2.15470054, -0.15470054,  2.30940108],
-         [ 0.15470054,  2.15470054, -2.30940108]]), 'FE0_f2_D11': array([[  4.00000000e+00,   0.00000000e+00,   4.00000000e+00,
-           -4.00000000e+00,  -4.00000000e+00],
-         [  4.00000000e+00,   1.24344979e-14,   4.00000000e+00,
-           -4.00000000e+00,  -4.00000000e+00]]), 'FE0_f0_D10': array([[ 1.        ,  2.15470054,  0.84529946, -0.84529946, -3.15470054],
-         [ 1.        , -0.15470054,  3.15470054, -3.15470054, -0.84529946]]), 'FE0_f0_D11': array([[  4.00000000e+00,   1.19904087e-14,   4.00000000e+00,
-           -4.00000000e+00,  -4.00000000e+00],
-         [  4.00000000e+00,   0.00000000e+00,   4.00000000e+00,
-           -4.00000000e+00,  -4.00000000e+00]]), 'FE1_f0_C0': array([[ 0.78867513,  0.21132487],
-         [ 0.21132487,  0.78867513]]), 'FE0_f2_D01': array([[-2.15470054, -1.        ,  0.84529946,  3.15470054, -0.84529946],
-         [ 0.15470054, -1.        ,  3.15470054,  0.84529946, -3.15470054]]), 'FE0_f1_D20': array([[ 4.,  4., -8.],
-         [ 4.,  4., -8.]]), 'FE0_f1_D01': array([[ -2.15470054e+00,  -1.54700538e-01,  -1.13242749e-14,
+         [ 0.15470054,  2.15470054, -2.30940108]]), 'FE2_f0_C0': array([[ 0.78867513,  0.21132487],
+         [ 0.21132487,  0.78867513]]), 'FE2_f0_C0_D01': array([[-1.,  1.],
+         [-1.,  1.]]), 'FE0_f0_D10': array([[ 1.        ,  2.15470054,  0.84529946, -0.84529946, -3.15470054],
+         [ 1.        , -0.15470054,  3.15470054, -3.15470054, -0.84529946]]), 'FE0_f0_D11': array([[ 4.,  4., -4., -4.],
+         [ 4.,  4., -4., -4.]]), 'FE1_f0': array([[ 1.],
+         [ 1.]]), 'FE0_f2_D01': array([[-2.15470054, -1.        ,  0.84529946,  3.15470054, -0.84529946],
+         [ 0.15470054, -1.        ,  3.15470054,  0.84529946, -3.15470054]]), 'FE0_f1_D01': array([[ -2.15470054e+00,  -1.54700538e-01,  -1.06581410e-14,
             2.30940108e+00],
-         [  1.54700538e-01,   2.15470054e+00,  -1.64313008e-14,
-           -2.30940108e+00]]), 'FE0_f0_D20': array([[ 4.,  4., -8.],
-         [ 4.,  4., -8.]]), 'FE0_f0_D01': array([[ 1.        , -0.15470054,  3.15470054, -0.84529946, -3.15470054],
-         [ 1.        ,  2.15470054,  0.84529946, -3.15470054, -0.84529946]]), 'FE2_f0': array([[ 1.],
-         [ 1.]]), 'FE0_f0_D02': array([[  4.00000000e+00,   4.00000000e+00,   0.00000000e+00,
-           -8.00000000e+00],
-         [  4.00000000e+00,   4.00000000e+00,  -1.19904087e-14,
-           -8.00000000e+00]]), 'FE1_f0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.]])}
+         [  1.54700538e-01,   2.15470054e+00,  -1.55431223e-14,
+           -2.30940108e+00]]), 'FE0_f0_D01': array([[ 1.        , -0.15470054,  3.15470054, -0.84529946, -3.15470054],
+         [ 1.        ,  2.15470054,  0.84529946, -3.15470054, -0.84529946]]), 'FE0_f0_D02': array([[ 4.,  4., -8.],
+         [ 4.,  4., -8.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_f0': ('FE0_f0', (0, [1, 2, 3]), False, False), 'FE1_f1_C0_D10': ('FE1_f0_C0_D01', (17, [0, 1]), False, False), 'FE0_f2': ('FE0_f0', (10, [0, 1, 5]), False, False), 'FE0_f0_D01': ('FE0_f0_D01', (1, [0, 2, 3, 4, 5]), False, False), 'FE1_f0_C1_D01': ('FE1_f0_C0_D01', (19, [3, 5]), False, False), 'FE1_f2_C1_D01': ('FE1_f0_C0_D01', (19, [3, 5]), False, False), 'FE1_f1_C1_D10': ('FE1_f0_C0_D01', (20, [3, 4]), False, False), 'FE0_f1_D11': ('FE0_f0_D11', (4, [0, 1, 3, 4, 5]), False, Fals [...]
+  {'FE2_f1_C1_D01': ('FE2_f0_C0_D01', (17, [3, 5]), False, False), 'FE2_f2_C0_D10': ('FE2_f0_C0_D01', (15, [0, 1]), False, False), 'FE0_f0': ('FE0_f0', (0, [1, 2, 3]), False, False), 'FE0_f1': ('FE0_f0', (6, [0, 2, 4]), False, False), 'FE0_f2': ('FE0_f0', (10, [0, 1, 5]), False, False), 'FE2_f0_C1_D01': ('FE2_f0_C0_D01', (17, [3, 5]), False, False), 'FE0_f1_D11': ('FE0_f0_D11', (4, [0, 3, 4, 5]), False, False), 'FE0_f1_D10': ('FE0_f1_D10', (8, [0, 1, 3, 4, 5]), False, False), 'FE0_f2_D10 [...]
   Transforming interior facet integral (0, 0)
   Reusing element from cache
   Reusing element from cache
@@ -1109,7 +1109,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000799 seconds
+  36 entries computed in 0.000969 seconds
   Shape of reference tensor: (6, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1117,9 +1117,10 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.331933 seconds.
+Compiler stage 2 finished in 0.679099 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
@@ -1134,97 +1135,56 @@ Compiler stage 3: Optimizing intermediate representation
   Optimising expressions for facet integral (2, 1)
   Optimising expressions for facet integral (2, 2)
   
-Compiler stage 3 finished in 0.301002 seconds.
+Compiler stage 3 finished in 0.395683 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 2 element(s)
+  Generating code for 4 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: Y
   Removing unused variable: X
   Removing unused variable: C1
   Removing unused variable: C0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 2 dofmap(s)
+  Generating code for 4 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -1236,18 +1196,18 @@ Compiler stage 4: Generating code
   Removing unused variable: n_10
   Generating code for forms
   
-Compiler stage 4 finished in 0.15472 seconds.
+Compiler stage 4 finished in 0.352024 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000626087 seconds.
+Compiler stage 4.1 finished in 0.000824928 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Biharmonic.h.
-Compiler stage 5 finished in 0.000882149 seconds.
+Compiler stage 5 finished in 0.00114107 seconds.
 
-FFC finished in 0.917898 seconds.
+FFC finished in 1.69072 seconds.
+Output written to ./Biharmonic.h.
diff --git a/demo/documented/biharmonic/cpp/documentation.rst b/demo/documented/biharmonic/cpp/documentation.rst
index 346eac9..b9c19b4 100644
--- a/demo/documented/biharmonic/cpp/documentation.rst
+++ b/demo/documented/biharmonic/cpp/documentation.rst
@@ -129,7 +129,7 @@ vertices in each direction:
     parameters["ghost_mode"] = "shared_facet";
 
     // Create mesh
-    UnitSquareMesh mesh(32, 32);
+    auto mesh = std::make_shared<UnitSquareMesh>(32, 32);
 
 The source function, a function for the cell size and the penalty term
 are declared:
@@ -137,8 +137,8 @@ are declared:
 .. code-block:: c++
 
     // Create functions
-    Source f;
-    Constant alpha(8.0);
+    auto f = std::make_shared<Source>();
+    auto alpha = std::make_shared<Constant>(8.0);
 
 A function space object, which is defined in the generated code, is
 created:
@@ -146,7 +146,7 @@ created:
 .. code-block:: c++
 
     // Create function space
-    Biharmonic::FunctionSpace V(mesh);
+    auto V = std::make_shared<Biharmonic::FunctionSpace>(mesh);
 
 The Dirichlet boundary condition on :math:`u` is constructed by
 defining a :cpp:class:`Constant` which is equal to zero, defining the
@@ -156,8 +156,8 @@ boundary (``DirichletBoundary``), and using these, together with
 .. code-block:: c++
 
     // Define boundary condition
-    Constant u0(0.0);
-    DirichletBoundary boundary;
+    auto u0 = std::make_shared<Constant>(0.0);
+    auto boundary = std::make_shared<DirichletBoundary>();
     DirichletBC bc(V, u0, boundary);
 
 Using the function space ``V``, the bilinear and linear forms are
diff --git a/demo/documented/biharmonic/cpp/main.cpp b/demo/documented/biharmonic/cpp/main.cpp
index 8c33594..fd5f2ba 100644
--- a/demo/documented/biharmonic/cpp/main.cpp
+++ b/demo/documented/biharmonic/cpp/main.cpp
@@ -66,18 +66,18 @@ int main()
   parameters["ghost_mode"] = "shared_facet";
 
   // Create mesh
-  UnitSquareMesh mesh(32, 32);
+  auto mesh = std::make_shared<UnitSquareMesh>(32, 32);
 
   // Create functions
-  Source f;
-  Constant alpha(8.0);
+  auto f = std::make_shared<Source>();
+  auto alpha = std::make_shared<Constant>(8.0);
 
   // Create function space
-  Biharmonic::FunctionSpace V(mesh);
+  auto V = std::make_shared<Biharmonic::FunctionSpace>(mesh);
 
   // Define boundary condition
-  Constant u0(0.0);
-  DirichletBoundary boundary;
+  auto u0 = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
   DirichletBC bc(V, u0, boundary);
 
   // Define variational problem
diff --git a/demo/documented/biharmonic/python/demo_biharmonic.py b/demo/documented/biharmonic/python/demo_biharmonic.py
index 08b4952..748094d 100644
--- a/demo/documented/biharmonic/python/demo_biharmonic.py
+++ b/demo/documented/biharmonic/python/demo_biharmonic.py
@@ -72,7 +72,7 @@ v = TestFunction(V)
 h = CellSize(mesh)
 h_avg = (h('+') + h('-'))/2.0
 n = FacetNormal(mesh)
-f = Source()
+f = Source(degree=2)
 
 # Penalty parameter
 alpha = Constant(8.0)
diff --git a/demo/documented/biharmonic/python/documentation.rst b/demo/documented/biharmonic/python/documentation.rst
index a424e1f..d0b0eb6 100644
--- a/demo/documented/biharmonic/python/documentation.rst
+++ b/demo/documented/biharmonic/python/documentation.rst
@@ -94,7 +94,7 @@ can be changed without needing to regenerate code.
     h = CellSize(mesh)
     h_avg = (h('+') + h('-'))/2.0
     n = FacetNormal(mesh)
-    f = Source()
+    f = Source(degree=2)
 
     # Penalty parameter
     alpha = Constant(8.0)
diff --git a/demo/documented/built-in-meshes/cpp/CMakeLists.txt b/demo/documented/built-in-meshes/cpp/CMakeLists.txt
index a73dc8a..0083b6a 100644
--- a/demo/documented/built-in-meshes/cpp/CMakeLists.txt
+++ b/demo/documented/built-in-meshes/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/built-in-meshes/python/documentation.rst b/demo/documented/built-in-meshes/python/documentation.rst
index 79ed50e..082af2d 100644
--- a/demo/documented/built-in-meshes/python/documentation.rst
+++ b/demo/documented/built-in-meshes/python/documentation.rst
@@ -54,7 +54,7 @@ can also omit this argument and thereby use the default direction
    plot(mesh, title="Unit square")
 
 .. image:: unitsquaremesh.png
-	:scale: 75 %
+    :scale: 75 %
 
 Our second version of a mesh on the unit square has diagonals to the
 left, the third version has crossed diagonals and our final version
@@ -104,10 +104,10 @@ diagonals to both left and right.
    plot(mesh, title="Rectangle (right/left)")
 
 .. image:: rectanglemesh.png
-	:scale: 75 %
+    :scale: 75 %
 
 .. image:: rectanglemesh_left_right.png
-	:scale: 75 %
+    :scale: 75 %
 
 To make a mesh of the 3D unit cube :math:`[0,1] \times [0,1] \times
 [0,1]`, we use :py:class:`UnitCubeMesh
diff --git a/demo/documented/cahn-hilliard/common.txt b/demo/documented/cahn-hilliard/common.txt
index 43426df..8b3e3d3 100644
--- a/demo/documented/cahn-hilliard/common.txt
+++ b/demo/documented/cahn-hilliard/common.txt
@@ -15,21 +15,21 @@ equation. In particular it demonstrates the use of
 Equation and problem definition
 -------------------------------
 
-The Cahn-Hilliard equation is a parabolic equation and is typically used
-to model phase separation in binary mixtures.  It involves first-order
-time derivatives, and second- and fourth-order spatial derivatives.
-The equation reads:
+The Cahn-Hilliard equation is a parabolic equation and is typically
+used to model phase separation in binary mixtures.  It involves
+first-order time derivatives, and second- and fourth-order spatial
+derivatives.  The equation reads:
 
 .. math::
    \frac{\partial c}{\partial t} - \nabla \cdot M \left(\nabla\left(\frac{d f}{d c}
              - \lambda \nabla^{2}c\right)\right) &= 0 \quad {\rm in} \ \Omega, \\
-   M\left(\nabla\left(\frac{d f}{d c} - \lambda \nabla^{2}c\right)\right) &= 0 \quad {\rm on} \ \partial\Omega, \\
+   M\left(\nabla\left(\frac{d f}{d c} - \lambda \nabla^{2}c\right)\right) \cdot n &= 0 \quad {\rm on} \ \partial\Omega, \\
    M \lambda \nabla c \cdot n &= 0 \quad {\rm on} \ \partial\Omega.
 
-where :math:`c` is the unknown field, the function :math:`f` is usually
-non-convex in :math:`c` (a fourth-order polynomial is commonly used),
-:math:`n` is the outward directed boundary normal, and :math:`M` is a
-scalar parameter.
+where :math:`c` is the unknown field, the function :math:`f` is
+usually non-convex in :math:`c` (a fourth-order polynomial is commonly
+used), :math:`n` is the outward directed boundary normal, and
+:math:`M` is a scalar parameter.
 
 Mixed form
 ^^^^^^^^^^
@@ -68,10 +68,10 @@ the equation:
    \int_{\Omega} \mu_{n+1} v  \, {\rm d} x - \int_{\Omega} \frac{d f_{n+1}}{d c} v  \, {\rm d} x - \int_{\Omega} \lambda \nabla c_{n+1} \cdot \nabla v \, {\rm d} x
           &= 0 \quad \forall \ v \in V
 
-where :math:`dt = t_{n+1} - t_{n}`
-and :math:`\mu_{n+\theta} = (1-\theta) \mu_{n} + \theta \mu_{n+1}`.
-The task is: given :math:`c_{n}` and :math:`\mu_{n}`, solve the above
-equation to find :math:`c_{n+1}` and :math:`\mu_{n+1}`.
+where :math:`dt = t_{n+1} - t_{n}` and :math:`\mu_{n+\theta} =
+(1-\theta) \mu_{n} + \theta \mu_{n+1}`.  The task is: given
+:math:`c_{n}` and :math:`\mu_{n}`, solve the above equation to find
+:math:`c_{n+1}` and :math:`\mu_{n+1}`.
 
 
 Demo parameters
diff --git a/demo/documented/cahn-hilliard/cpp/CMakeLists.txt b/demo/documented/cahn-hilliard/cpp/CMakeLists.txt
index 179e4d9..c9743fb 100644
--- a/demo/documented/cahn-hilliard/cpp/CMakeLists.txt
+++ b/demo/documented/cahn-hilliard/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} CahnHilliard3D.cpp CahnHilliard2D.cpp main.cpp)
 
diff --git a/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.cpp b/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.cpp
index 5c5a4a3..b6f3c14 100644
--- a/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.cpp
+++ b/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,329 +13,99 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "CahnHilliard2D.h"
 
-/// Constructor
 cahnhilliard2d_finite_element_0::cahnhilliard2d_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 cahnhilliard2d_finite_element_0::~cahnhilliard2d_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* cahnhilliard2d_finite_element_0::signature() const
+const char * cahnhilliard2d_finite_element_0::signature() const
 {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
 }
 
-/// Return the cell shape
 ufc::shape cahnhilliard2d_finite_element_0::cell_shape() const
 {
-    return ufc::triangle;
+    return ufc::shape::triangle;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t cahnhilliard2d_finite_element_0::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t cahnhilliard2d_finite_element_0::geometric_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t cahnhilliard2d_finite_element_0::space_dimension() const
 {
-    return 1;
+    return 3;
 }
 
-/// Return the rank of the value space
 std::size_t cahnhilliard2d_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t cahnhilliard2d_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
-void cahnhilliard2d_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
-                                    int cell_orientation)
-{
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-}
-
-/// Evaluate all basis functions at given point x in cell
-void cahnhilliard2d_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
-                                        int cell_orientation)
-{
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-}
-
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void cahnhilliard2d_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
-                                                std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
-                                                int cell_orientation)
-{
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-}
-
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void cahnhilliard2d_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
-                                                    int cell_orientation)
-{
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-}
-
-/// Evaluate linear functional for dof i on the function f
-double cahnhilliard2d_finite_element_0::evaluate_dof(std::size_t i,
-                                   const ufc::function& f,
-                                   const double* vertex_coordinates,
-                                   int cell_orientation,
-                                   const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-}
-
-/// Evaluate linear functionals for all dofs on the function f
-void cahnhilliard2d_finite_element_0::evaluate_dofs(double* values,
-                                  const ufc::function& f,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation,
-                                  const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-}
-
-/// Interpolate vertex values from dof values
-void cahnhilliard2d_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation,
-                                              const ufc::cell& c) const
-{
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-}
-
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void cahnhilliard2d_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
+std::size_t cahnhilliard2d_finite_element_0::value_size() const
 {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-}
-
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void cahnhilliard2d_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
-{
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-}
-
-/// Return the number of sub elements (for a mixed element)
-std::size_t cahnhilliard2d_finite_element_0::num_sub_elements() const
-{
-    return 0;
+    return 1;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* cahnhilliard2d_finite_element_0::create_sub_element(std::size_t i) const
+std::size_t cahnhilliard2d_finite_element_0::reference_value_rank() const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::finite_element* cahnhilliard2d_finite_element_0::create() const
-{
-    return new cahnhilliard2d_finite_element_0();
-}
-
-
-/// Constructor
-cahnhilliard2d_finite_element_1::cahnhilliard2d_finite_element_1() : ufc::finite_element()
-{
-    // Do nothing
-}
-
-/// Destructor
-cahnhilliard2d_finite_element_1::~cahnhilliard2d_finite_element_1()
-{
-    // Do nothing
-}
-
-/// Return a string identifying the finite element
-const char* cahnhilliard2d_finite_element_1::signature() const
-{
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-}
-
-/// Return the cell shape
-ufc::shape cahnhilliard2d_finite_element_1::cell_shape() const
-{
-    return ufc::triangle;
-}
-
-/// Return the topological dimension of the cell shape
-std::size_t cahnhilliard2d_finite_element_1::topological_dimension() const
-{
-    return 2;
-}
-
-/// Return the geometric dimension of the cell shape
-std::size_t cahnhilliard2d_finite_element_1::geometric_dimension() const
+std::size_t cahnhilliard2d_finite_element_0::reference_value_dimension(std::size_t i) const
 {
-    return 2;
+    return 1;
 }
 
-/// Return the dimension of the finite element function space
-std::size_t cahnhilliard2d_finite_element_1::space_dimension() const
+std::size_t cahnhilliard2d_finite_element_0::reference_value_size() const
 {
-    return 3;
+    return 1;
 }
 
-/// Return the rank of the value space
-std::size_t cahnhilliard2d_finite_element_1::value_rank() const
+std::size_t cahnhilliard2d_finite_element_0::degree() const
 {
-    return 0;
+    return 1;
 }
 
-/// Return the dimension of the value space for axis i
-std::size_t cahnhilliard2d_finite_element_1::value_dimension(std::size_t i) const
+const char * cahnhilliard2d_finite_element_0::family() const
 {
-    return 1;
+    return "Lagrange";
 }
 
-/// Evaluate basis function i at given point x in cell
-void cahnhilliard2d_finite_element_1::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+void cahnhilliard2d_finite_element_0::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -344,8 +114,8 @@ void cahnhilliard2d_finite_element_1::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -443,10 +213,9 @@ void cahnhilliard2d_finite_element_1::_evaluate_basis(std::size_t i,
     
 }
 
-/// Evaluate all basis functions at given point x in cell
-void cahnhilliard2d_finite_element_1::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void cahnhilliard2d_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
@@ -455,17 +224,16 @@ void cahnhilliard2d_finite_element_1::_evaluate_basis_all(double* values,
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+void cahnhilliard2d_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
     
@@ -485,7 +253,7 @@ void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -497,7 +265,7 @@ void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -506,8 +274,8 @@ void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -959,17 +727,16 @@ void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
     
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
+void cahnhilliard2d_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
                                                     int cell_orientation)
 {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1005,7 +772,7 @@ void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives_all(std::size_
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1013,10 +780,9 @@ void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives_all(std::size_
     } // end loop over 'r'
 }
 
-/// Evaluate linear functional for dof i on the function f
-double cahnhilliard2d_finite_element_1::evaluate_dof(std::size_t i,
+double cahnhilliard2d_finite_element_0::evaluate_dof(std::size_t i,
                                    const ufc::function& f,
-                                   const double* vertex_coordinates,
+                                   const double * coordinate_dofs,
                                    int cell_orientation,
                                    const ufc::cell& c) const
 {
@@ -1029,24 +795,24 @@ double cahnhilliard2d_finite_element_1::evaluate_dof(std::size_t i,
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1056,10 +822,9 @@ double cahnhilliard2d_finite_element_1::evaluate_dof(std::size_t i,
     return 0.0;
 }
 
-/// Evaluate linear functionals for all dofs on the function f
-void cahnhilliard2d_finite_element_1::evaluate_dofs(double* values,
+void cahnhilliard2d_finite_element_0::evaluate_dofs(double * values,
                                   const ufc::function& f,
-                                  const double* vertex_coordinates,
+                                  const double * coordinate_dofs,
                                   int cell_orientation,
                                   const ufc::cell& c) const
 {
@@ -1068,24 +833,23 @@ void cahnhilliard2d_finite_element_1::evaluate_dofs(double* values,
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
 }
 
-/// Interpolate vertex values from dof values
-void cahnhilliard2d_finite_element_1::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
+void cahnhilliard2d_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
                                               int cell_orientation,
                                               const ufc::cell& c) const
 {
@@ -1095,91 +859,74 @@ void cahnhilliard2d_finite_element_1::interpolate_vertex_values(double* vertex_v
     vertex_values[2] = dof_values[2];
 }
 
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void cahnhilliard2d_finite_element_1::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-}
-
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void cahnhilliard2d_finite_element_1::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+void cahnhilliard2d_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t cahnhilliard2d_finite_element_1::num_sub_elements() const
+std::size_t cahnhilliard2d_finite_element_0::num_sub_elements() const
 {
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* cahnhilliard2d_finite_element_1::create_sub_element(std::size_t i) const
+ufc::finite_element * cahnhilliard2d_finite_element_0::create_sub_element(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::finite_element* cahnhilliard2d_finite_element_1::create() const
+ufc::finite_element * cahnhilliard2d_finite_element_0::create() const
 {
-    return new cahnhilliard2d_finite_element_1();
+    return new cahnhilliard2d_finite_element_0();
 }
 
 
-/// Constructor
-cahnhilliard2d_finite_element_2::cahnhilliard2d_finite_element_2() : ufc::finite_element()
+cahnhilliard2d_finite_element_1::cahnhilliard2d_finite_element_1() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
-cahnhilliard2d_finite_element_2::~cahnhilliard2d_finite_element_2()
+cahnhilliard2d_finite_element_1::~cahnhilliard2d_finite_element_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* cahnhilliard2d_finite_element_2::signature() const
+const char * cahnhilliard2d_finite_element_1::signature() const
 {
-    return "MixedElement(FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (2,) })";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
 }
 
-/// Return the cell shape
-ufc::shape cahnhilliard2d_finite_element_2::cell_shape() const
+ufc::shape cahnhilliard2d_finite_element_1::cell_shape() const
 {
-    return ufc::triangle;
+    return ufc::shape::triangle;
 }
 
-/// Return the topological dimension of the cell shape
-std::size_t cahnhilliard2d_finite_element_2::topological_dimension() const
+std::size_t cahnhilliard2d_finite_element_1::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the geometric dimension of the cell shape
-std::size_t cahnhilliard2d_finite_element_2::geometric_dimension() const
+std::size_t cahnhilliard2d_finite_element_1::geometric_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the finite element function space
-std::size_t cahnhilliard2d_finite_element_2::space_dimension() const
+std::size_t cahnhilliard2d_finite_element_1::space_dimension() const
 {
     return 6;
 }
 
-/// Return the rank of the value space
-std::size_t cahnhilliard2d_finite_element_2::value_rank() const
+std::size_t cahnhilliard2d_finite_element_1::value_rank() const
 {
     return 1;
 }
 
-/// Return the dimension of the value space for axis i
-std::size_t cahnhilliard2d_finite_element_2::value_dimension(std::size_t i) const
+std::size_t cahnhilliard2d_finite_element_1::value_dimension(std::size_t i) const
 {
     switch (i)
     {
@@ -1193,16 +940,54 @@ std::size_t cahnhilliard2d_finite_element_2::value_dimension(std::size_t i) cons
     return 0;
 }
 
-/// Evaluate basis function i at given point x in cell
-void cahnhilliard2d_finite_element_2::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+std::size_t cahnhilliard2d_finite_element_1::value_size() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_finite_element_1::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard2d_finite_element_1::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t cahnhilliard2d_finite_element_1::reference_value_size() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_finite_element_1::degree() const
+{
+    return 1;
+}
+
+const char * cahnhilliard2d_finite_element_1::family() const
+{
+    return "Lagrange";
+}
+
+void cahnhilliard2d_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1211,8 +996,8 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1395,10 +1180,9 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis(std::size_t i,
     
 }
 
-/// Evaluate all basis functions at given point x in cell
-void cahnhilliard2d_finite_element_2::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void cahnhilliard2d_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
@@ -1407,7 +1191,7 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis_all(double* values,
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1415,12 +1199,11 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis_all(double* values,
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
     
@@ -1440,7 +1223,7 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1452,7 +1235,7 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1461,8 +1244,8 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2307,17 +2090,16 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
     
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
+void cahnhilliard2d_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
                                                     int cell_orientation)
 {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2353,7 +2135,7 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives_all(std::size_
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2361,10 +2143,9 @@ void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives_all(std::size_
     } // end loop over 'r'
 }
 
-/// Evaluate linear functional for dof i on the function f
-double cahnhilliard2d_finite_element_2::evaluate_dof(std::size_t i,
+double cahnhilliard2d_finite_element_1::evaluate_dof(std::size_t i,
                                    const ufc::function& f,
-                                   const double* vertex_coordinates,
+                                   const double * coordinate_dofs,
                                    int cell_orientation,
                                    const ufc::cell& c) const
 {
@@ -2377,48 +2158,48 @@ double cahnhilliard2d_finite_element_2::evaluate_dof(std::size_t i,
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -2428,10 +2209,9 @@ double cahnhilliard2d_finite_element_2::evaluate_dof(std::size_t i,
     return 0.0;
 }
 
-/// Evaluate linear functionals for all dofs on the function f
-void cahnhilliard2d_finite_element_2::evaluate_dofs(double* values,
+void cahnhilliard2d_finite_element_1::evaluate_dofs(double * values,
                                   const ufc::function& f,
-                                  const double* vertex_coordinates,
+                                  const double * coordinate_dofs,
                                   int cell_orientation,
                                   const ufc::cell& c) const
 {
@@ -2440,36 +2220,35 @@ void cahnhilliard2d_finite_element_2::evaluate_dofs(double* values,
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
 }
 
-/// Interpolate vertex values from dof values
-void cahnhilliard2d_finite_element_2::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
+void cahnhilliard2d_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
                                               int cell_orientation,
                                               const ufc::cell& c) const
 {
@@ -2483,41 +2262,40 @@ void cahnhilliard2d_finite_element_2::interpolate_vertex_values(double* vertex_v
     vertex_values[5] = dof_values[5];
 }
 
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void cahnhilliard2d_finite_element_2::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-}
-
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void cahnhilliard2d_finite_element_2::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+void cahnhilliard2d_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t cahnhilliard2d_finite_element_2::num_sub_elements() const
+std::size_t cahnhilliard2d_finite_element_1::num_sub_elements() const
 {
     return 2;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* cahnhilliard2d_finite_element_2::create_sub_element(std::size_t i) const
+ufc::finite_element * cahnhilliard2d_finite_element_1::create_sub_element(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return new cahnhilliard2d_finite_element_1();
+        return new cahnhilliard2d_finite_element_0();
         break;
       }
     case 1:
       {
-        return new cahnhilliard2d_finite_element_1();
+        return new cahnhilliard2d_finite_element_0();
         break;
       }
     }
@@ -2525,38 +2303,1895 @@ ufc::finite_element* cahnhilliard2d_finite_element_2::create_sub_element(std::si
     return 0;
 }
 
-/// Create a new class instance
-ufc::finite_element* cahnhilliard2d_finite_element_2::create() const
+ufc::finite_element * cahnhilliard2d_finite_element_1::create() const
 {
-    return new cahnhilliard2d_finite_element_2();
+    return new cahnhilliard2d_finite_element_1();
 }
 
-/// Constructor
-cahnhilliard2d_dofmap_0::cahnhilliard2d_dofmap_0() : ufc::dofmap()
+
+cahnhilliard2d_finite_element_2::cahnhilliard2d_finite_element_2() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+cahnhilliard2d_finite_element_2::~cahnhilliard2d_finite_element_2()
+{
+    // Do nothing
+}
+
+const char * cahnhilliard2d_finite_element_2::signature() const
+{
+    return "MixedElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', triangle, 1))";
+}
+
+ufc::shape cahnhilliard2d_finite_element_2::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::space_dimension() const
+{
+    return 6;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::value_rank() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::value_size() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::reference_value_size() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_finite_element_2::degree() const
+{
+    return 1;
+}
+
+const char * cahnhilliard2d_finite_element_2::family() const
+{
+    return "Mixed";
+}
+
+void cahnhilliard2d_finite_element_2::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void cahnhilliard2d_finite_element_2::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void cahnhilliard2d_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double cahnhilliard2d_finite_element_2::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void cahnhilliard2d_finite_element_2::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+}
+
+void cahnhilliard2d_finite_element_2::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+}
+
+void cahnhilliard2d_finite_element_2::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+}
+
+std::size_t cahnhilliard2d_finite_element_2::num_sub_elements() const
+{
+    return 2;
+}
+
+ufc::finite_element * cahnhilliard2d_finite_element_2::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new cahnhilliard2d_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new cahnhilliard2d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * cahnhilliard2d_finite_element_2::create() const
+{
+    return new cahnhilliard2d_finite_element_2();
+}
+
+
+cahnhilliard2d_finite_element_3::cahnhilliard2d_finite_element_3() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+cahnhilliard2d_finite_element_3::~cahnhilliard2d_finite_element_3()
+{
+    // Do nothing
+}
+
+const char * cahnhilliard2d_finite_element_3::signature() const
+{
+    return "FiniteElement('Real', triangle, 0)";
+}
+
+ufc::shape cahnhilliard2d_finite_element_3::cell_shape() const
+{
+    return ufc::shape::triangle;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::geometric_dimension() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::space_dimension() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::value_rank() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::value_size() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard2d_finite_element_3::degree() const
+{
+    return 0;
+}
+
+const char * cahnhilliard2d_finite_element_3::family() const
+{
+    return "Real";
+}
+
+void cahnhilliard2d_finite_element_3::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+}
+
+void cahnhilliard2d_finite_element_3::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+}
+
+void cahnhilliard2d_finite_element_3::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+}
+
+void cahnhilliard2d_finite_element_3::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+}
+
+double cahnhilliard2d_finite_element_3::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void cahnhilliard2d_finite_element_3::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+}
+
+void cahnhilliard2d_finite_element_3::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+}
+
+void cahnhilliard2d_finite_element_3::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+}
+
+std::size_t cahnhilliard2d_finite_element_3::num_sub_elements() const
+{
+    return 0;
+}
+
+ufc::finite_element * cahnhilliard2d_finite_element_3::create_sub_element(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::finite_element * cahnhilliard2d_finite_element_3::create() const
+{
+    return new cahnhilliard2d_finite_element_3();
+}
+
+
+cahnhilliard2d_dofmap_0::cahnhilliard2d_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+cahnhilliard2d_dofmap_0::~cahnhilliard2d_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * cahnhilliard2d_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+}
+
+bool cahnhilliard2d_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t cahnhilliard2d_dofmap_0::topological_dimension() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t cahnhilliard2d_dofmap_0::num_element_dofs() const
+{
+    return 3;
+}
+
+std::size_t cahnhilliard2d_dofmap_0::num_facet_dofs() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard2d_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void cahnhilliard2d_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+}
+
+void cahnhilliard2d_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t 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;
+      }
+    }
+    
+}
+
+void cahnhilliard2d_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
+{
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+}
+
+std::size_t cahnhilliard2d_dofmap_0::num_sub_dofmaps() const
+{
+    return 0;
+}
+
+ufc::dofmap * cahnhilliard2d_dofmap_0::create_sub_dofmap(std::size_t i) const
+{
+    return 0;
+}
+
+ufc::dofmap * cahnhilliard2d_dofmap_0::create() const
+{
+    return new cahnhilliard2d_dofmap_0();
+}
+
+
+cahnhilliard2d_dofmap_1::cahnhilliard2d_dofmap_1() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-cahnhilliard2d_dofmap_0::~cahnhilliard2d_dofmap_0()
+cahnhilliard2d_dofmap_1::~cahnhilliard2d_dofmap_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* cahnhilliard2d_dofmap_0::signature() const
+const char * cahnhilliard2d_dofmap_1::signature() const
 {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool cahnhilliard2d_dofmap_0::needs_mesh_entities(std::size_t d) const
+bool cahnhilliard2d_dofmap_1::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -2574,45 +4209,34 @@ bool cahnhilliard2d_dofmap_0::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t cahnhilliard2d_dofmap_0::topological_dimension() const
-{
-    return 2;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t cahnhilliard2d_dofmap_0::geometric_dimension() const
+std::size_t cahnhilliard2d_dofmap_1::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t cahnhilliard2d_dofmap_0::global_dimension(const std::vector<std::size_t>&
+std::size_t cahnhilliard2d_dofmap_1::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
-    return 1;
+    return 2*num_global_entities[0];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t cahnhilliard2d_dofmap_0::num_element_dofs() const
+std::size_t cahnhilliard2d_dofmap_1::num_element_dofs() const
 {
-    return 1;
+    return 6;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t cahnhilliard2d_dofmap_0::num_facet_dofs() const
+std::size_t cahnhilliard2d_dofmap_1::num_facet_dofs() const
 {
-    return 0;
+    return 4;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t cahnhilliard2d_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t cahnhilliard2d_dofmap_1::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 2;
         break;
       }
     case 1:
@@ -2622,7 +4246,7 @@ std::size_t cahnhilliard2d_dofmap_0::num_entity_dofs(std::size_t d) const
       }
     case 2:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -2630,41 +4254,55 @@ std::size_t cahnhilliard2d_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void cahnhilliard2d_dofmap_0::tabulate_dofs(std::size_t* dofs,
+void cahnhilliard2d_dofmap_1::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
-    dofs[0] = 0;
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void cahnhilliard2d_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
+void cahnhilliard2d_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void cahnhilliard2d_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
+void cahnhilliard2d_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 2)
@@ -2676,7 +4314,33 @@ void cahnhilliard2d_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -2686,64 +4350,59 @@ void cahnhilliard2d_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void cahnhilliard2d_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
+std::size_t cahnhilliard2d_dofmap_1::num_sub_dofmaps() const
 {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    return 2;
 }
 
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t cahnhilliard2d_dofmap_0::num_sub_dofmaps() const
+ufc::dofmap * cahnhilliard2d_dofmap_1::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new cahnhilliard2d_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new cahnhilliard2d_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* cahnhilliard2d_dofmap_0::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard2d_dofmap_1::create() const
 {
-    return 0;
+    return new cahnhilliard2d_dofmap_1();
 }
 
-/// Create a new class instance
-ufc::dofmap* cahnhilliard2d_dofmap_0::create() const
-{
-    return new cahnhilliard2d_dofmap_0();
-}
 
-/// Constructor
-cahnhilliard2d_dofmap_1::cahnhilliard2d_dofmap_1() : ufc::dofmap()
+cahnhilliard2d_dofmap_2::cahnhilliard2d_dofmap_2() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-cahnhilliard2d_dofmap_1::~cahnhilliard2d_dofmap_1()
+cahnhilliard2d_dofmap_2::~cahnhilliard2d_dofmap_2()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* cahnhilliard2d_dofmap_1::signature() const
+const char * cahnhilliard2d_dofmap_2::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for MixedElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', triangle, 1))";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool cahnhilliard2d_dofmap_1::needs_mesh_entities(std::size_t d) const
+bool cahnhilliard2d_dofmap_2::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
@@ -2767,45 +4426,34 @@ bool cahnhilliard2d_dofmap_1::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t cahnhilliard2d_dofmap_1::topological_dimension() const
-{
-    return 2;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t cahnhilliard2d_dofmap_1::geometric_dimension() const
+std::size_t cahnhilliard2d_dofmap_2::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t cahnhilliard2d_dofmap_1::global_dimension(const std::vector<std::size_t>&
+std::size_t cahnhilliard2d_dofmap_2::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
-    return num_global_entities[0];
+    return 2*num_global_entities[0];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t cahnhilliard2d_dofmap_1::num_element_dofs() const
+std::size_t cahnhilliard2d_dofmap_2::num_element_dofs() const
 {
-    return 3;
+    return 6;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t cahnhilliard2d_dofmap_1::num_facet_dofs() const
+std::size_t cahnhilliard2d_dofmap_2::num_facet_dofs() const
 {
-    return 2;
+    return 4;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t cahnhilliard2d_dofmap_1::num_entity_dofs(std::size_t d) const
+std::size_t cahnhilliard2d_dofmap_2::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
@@ -2823,18 +4471,22 @@ std::size_t cahnhilliard2d_dofmap_1::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void cahnhilliard2d_dofmap_1::tabulate_dofs(std::size_t* dofs,
+void cahnhilliard2d_dofmap_2::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void cahnhilliard2d_dofmap_1::tabulate_facet_dofs(std::size_t* dofs,
+void cahnhilliard2d_dofmap_2::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
@@ -2843,26 +4495,31 @@ void cahnhilliard2d_dofmap_1::tabulate_facet_dofs(std::size_t* dofs,
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void cahnhilliard2d_dofmap_1::tabulate_entity_dofs(std::size_t* dofs,
+void cahnhilliard2d_dofmap_2::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 2)
@@ -2884,16 +4541,19 @@ void cahnhilliard2d_dofmap_1::tabulate_entity_dofs(std::size_t* dofs,
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -2914,62 +4574,58 @@ void cahnhilliard2d_dofmap_1::tabulate_entity_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void cahnhilliard2d_dofmap_1::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
+std::size_t cahnhilliard2d_dofmap_2::num_sub_dofmaps() const
 {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
+    return 2;
 }
 
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t cahnhilliard2d_dofmap_1::num_sub_dofmaps() const
+ufc::dofmap * cahnhilliard2d_dofmap_2::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new cahnhilliard2d_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new cahnhilliard2d_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* cahnhilliard2d_dofmap_1::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard2d_dofmap_2::create() const
 {
-    return 0;
+    return new cahnhilliard2d_dofmap_2();
 }
 
-/// Create a new class instance
-ufc::dofmap* cahnhilliard2d_dofmap_1::create() const
-{
-    return new cahnhilliard2d_dofmap_1();
-}
 
-/// Constructor
-cahnhilliard2d_dofmap_2::cahnhilliard2d_dofmap_2() : ufc::dofmap()
+cahnhilliard2d_dofmap_3::cahnhilliard2d_dofmap_3() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-cahnhilliard2d_dofmap_2::~cahnhilliard2d_dofmap_2()
+cahnhilliard2d_dofmap_3::~cahnhilliard2d_dofmap_3()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* cahnhilliard2d_dofmap_2::signature() const
+const char * cahnhilliard2d_dofmap_3::signature() const
 {
-    return "FFC dofmap for MixedElement(FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (2,) })";
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool cahnhilliard2d_dofmap_2::needs_mesh_entities(std::size_t d) const
+bool cahnhilliard2d_dofmap_3::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -2987,45 +4643,34 @@ bool cahnhilliard2d_dofmap_2::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t cahnhilliard2d_dofmap_2::topological_dimension() const
-{
-    return 2;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t cahnhilliard2d_dofmap_2::geometric_dimension() const
+std::size_t cahnhilliard2d_dofmap_3::topological_dimension() const
 {
     return 2;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t cahnhilliard2d_dofmap_2::global_dimension(const std::vector<std::size_t>&
+std::size_t cahnhilliard2d_dofmap_3::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
-    return 2*num_global_entities[0];
+    return 1;
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t cahnhilliard2d_dofmap_2::num_element_dofs() const
+std::size_t cahnhilliard2d_dofmap_3::num_element_dofs() const
 {
-    return 6;
+    return 1;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t cahnhilliard2d_dofmap_2::num_facet_dofs() const
+std::size_t cahnhilliard2d_dofmap_3::num_facet_dofs() const
 {
-    return 4;
+    return 0;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t cahnhilliard2d_dofmap_2::num_entity_dofs(std::size_t d) const
+std::size_t cahnhilliard2d_dofmap_3::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 0;
         break;
       }
     case 1:
@@ -3035,7 +4680,7 @@ std::size_t cahnhilliard2d_dofmap_2::num_entity_dofs(std::size_t d) const
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -3043,58 +4688,38 @@ std::size_t cahnhilliard2d_dofmap_2::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void cahnhilliard2d_dofmap_2::tabulate_dofs(std::size_t* dofs,
+void cahnhilliard2d_dofmap_3::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
+    dofs[0] = 0;
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void cahnhilliard2d_dofmap_2::tabulate_facet_dofs(std::size_t* dofs,
+void cahnhilliard2d_dofmap_3::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 4;
-      dofs[3] = 5;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 5;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-      dofs[3] = 4;
+        
         break;
       }
     }
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void cahnhilliard2d_dofmap_2::tabulate_entity_dofs(std::size_t* dofs,
+void cahnhilliard2d_dofmap_3::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 2)
@@ -3106,33 +4731,7 @@ void cahnhilliard2d_dofmap_2::tabulate_entity_dofs(std::size_t* dofs,
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 5;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -3142,91 +4741,58 @@ void cahnhilliard2d_dofmap_2::tabulate_entity_dofs(std::size_t* dofs,
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void cahnhilliard2d_dofmap_2::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t cahnhilliard2d_dofmap_2::num_sub_dofmaps() const
+std::size_t cahnhilliard2d_dofmap_3::num_sub_dofmaps() const
 {
-    return 2;
+    return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* cahnhilliard2d_dofmap_2::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard2d_dofmap_3::create_sub_dofmap(std::size_t i) const
 {
-    switch (i)
-    {
-    case 0:
-      {
-        return new cahnhilliard2d_dofmap_1();
-        break;
-      }
-    case 1:
-      {
-        return new cahnhilliard2d_dofmap_1();
-        break;
-      }
-    }
-    
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* cahnhilliard2d_dofmap_2::create() const
+ufc::dofmap * cahnhilliard2d_dofmap_3::create() const
 {
-    return new cahnhilliard2d_dofmap_2();
+    return new cahnhilliard2d_dofmap_3();
 }
 
-/// Constructor
+
 cahnhilliard2d_cell_integral_0_otherwise::cahnhilliard2d_cell_integral_0_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 cahnhilliard2d_cell_integral_0_otherwise::~cahnhilliard2d_cell_integral_0_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & cahnhilliard2d_cell_integral_0_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true, true, true, true, true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void cahnhilliard2d_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void cahnhilliard2d_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3384,34 +4950,31 @@ void cahnhilliard2d_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     } // end loop over 'ip'
 }
 
-/// Constructor
+
 cahnhilliard2d_cell_integral_1_otherwise::cahnhilliard2d_cell_integral_1_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 cahnhilliard2d_cell_integral_1_otherwise::~cahnhilliard2d_cell_integral_1_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & cahnhilliard2d_cell_integral_1_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true, true, true, true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void cahnhilliard2d_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void cahnhilliard2d_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3567,47 +5130,54 @@ void cahnhilliard2d_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     } // end loop over 'ip'
 }
 
-/// Constructor
+
 cahnhilliard2d_form_0::cahnhilliard2d_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 cahnhilliard2d_form_0::~cahnhilliard2d_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* cahnhilliard2d_form_0::signature() const
+const char * cahnhilliard2d_form_0::signature() const
 {
-    return "d0a5997dffab4fa53eab7ddf23f977471d7b8881f491d30b3c438848857e3b359cd7d41a280eb88ea995c90efbfb7a6b93a45c935c94269ee793d360ff91b70a";
+    return "03ecafe51ceecb55e45bc10591368c600282bb005383c7aaeba30e140d0b1e11c455194608ebc5d3548488baaaf5640d11f53f65364ffcd9e109c19390bde656";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t cahnhilliard2d_form_0::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t cahnhilliard2d_form_0::num_coefficients() const
 {
     return 5;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t cahnhilliard2d_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0, 1, 2, 3, 4});
     return position[i];
 }
 
+ufc::finite_element * cahnhilliard2d_form_0::create_coordinate_finite_element() const
+{
+    return new cahnhilliard2d_finite_element_1();
+}
+
+ufc::dofmap * cahnhilliard2d_form_0::create_coordinate_dofmap() const
+{
+    return new cahnhilliard2d_dofmap_1();
+}
+
+ufc::coordinate_mapping * cahnhilliard2d_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* cahnhilliard2d_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * cahnhilliard2d_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
@@ -3628,17 +5198,17 @@ ufc::finite_element* cahnhilliard2d_form_0::create_finite_element(std::size_t i)
       }
     case 3:
       {
-        return new cahnhilliard2d_finite_element_0();
+        return new cahnhilliard2d_finite_element_3();
         break;
       }
     case 4:
       {
-        return new cahnhilliard2d_finite_element_0();
+        return new cahnhilliard2d_finite_element_3();
         break;
       }
     case 5:
       {
-        return new cahnhilliard2d_finite_element_0();
+        return new cahnhilliard2d_finite_element_3();
         break;
       }
     }
@@ -3646,8 +5216,7 @@ ufc::finite_element* cahnhilliard2d_form_0::create_finite_element(std::size_t i)
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* cahnhilliard2d_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard2d_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
@@ -3668,17 +5237,17 @@ ufc::dofmap* cahnhilliard2d_form_0::create_dofmap(std::size_t i) const
       }
     case 3:
       {
-        return new cahnhilliard2d_dofmap_0();
+        return new cahnhilliard2d_dofmap_3();
         break;
       }
     case 4:
       {
-        return new cahnhilliard2d_dofmap_0();
+        return new cahnhilliard2d_dofmap_3();
         break;
       }
     case 5:
       {
-        return new cahnhilliard2d_dofmap_0();
+        return new cahnhilliard2d_dofmap_3();
         break;
       }
     }
@@ -3686,172 +5255,214 @@ ufc::dofmap* cahnhilliard2d_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t cahnhilliard2d_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t cahnhilliard2d_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t cahnhilliard2d_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t cahnhilliard2d_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t cahnhilliard2d_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t cahnhilliard2d_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard2d_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard2d_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool cahnhilliard2d_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool cahnhilliard2d_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool cahnhilliard2d_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool cahnhilliard2d_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool cahnhilliard2d_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool cahnhilliard2d_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool cahnhilliard2d_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool cahnhilliard2d_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * cahnhilliard2d_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * cahnhilliard2d_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* cahnhilliard2d_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * cahnhilliard2d_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* cahnhilliard2d_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * cahnhilliard2d_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* cahnhilliard2d_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * cahnhilliard2d_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* cahnhilliard2d_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * cahnhilliard2d_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* cahnhilliard2d_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * cahnhilliard2d_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * cahnhilliard2d_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* cahnhilliard2d_form_0::create_default_cell_integral() const
+ufc::cell_integral * cahnhilliard2d_form_0::create_default_cell_integral() const
 {
     return new cahnhilliard2d_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* cahnhilliard2d_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * cahnhilliard2d_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * cahnhilliard2d_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * cahnhilliard2d_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * cahnhilliard2d_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* cahnhilliard2d_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * cahnhilliard2d_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* cahnhilliard2d_form_0::create_default_vertex_integral() const
+ufc::interface_integral * cahnhilliard2d_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* cahnhilliard2d_form_0::create_default_custom_integral() const
+ufc::overlap_integral * cahnhilliard2d_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 cahnhilliard2d_form_1::cahnhilliard2d_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 cahnhilliard2d_form_1::~cahnhilliard2d_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* cahnhilliard2d_form_1::signature() const
+const char * cahnhilliard2d_form_1::signature() const
 {
-    return "563f070053df452e5a6210b15a536fed312c77598a686b3270851b4fc6a1866f355789bc1f7bd82923e09d37b25ca722f9933450171dd56c4d093e1ddcbd5bc6";
+    return "3aedd8e5fe0170c54f18eac8519eb71f691d8ad55d46c1b57748bf366f9d8357d821fcea1e008b0bb49a25a6cc59fda47de42978354754b999ca55059536b5b9";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t cahnhilliard2d_form_1::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t cahnhilliard2d_form_1::num_coefficients() const
 {
     return 4;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t cahnhilliard2d_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0, 2, 3, 4});
     return position[i];
 }
 
+ufc::finite_element * cahnhilliard2d_form_1::create_coordinate_finite_element() const
+{
+    return new cahnhilliard2d_finite_element_1();
+}
+
+ufc::dofmap * cahnhilliard2d_form_1::create_coordinate_dofmap() const
+{
+    return new cahnhilliard2d_dofmap_1();
+}
+
+ufc::coordinate_mapping * cahnhilliard2d_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* cahnhilliard2d_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * cahnhilliard2d_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
@@ -3872,17 +5483,17 @@ ufc::finite_element* cahnhilliard2d_form_1::create_finite_element(std::size_t i)
       }
     case 3:
       {
-        return new cahnhilliard2d_finite_element_0();
+        return new cahnhilliard2d_finite_element_3();
         break;
       }
     case 4:
       {
-        return new cahnhilliard2d_finite_element_0();
+        return new cahnhilliard2d_finite_element_3();
         break;
       }
     case 5:
       {
-        return new cahnhilliard2d_finite_element_0();
+        return new cahnhilliard2d_finite_element_3();
         break;
       }
     }
@@ -3890,8 +5501,7 @@ ufc::finite_element* cahnhilliard2d_form_1::create_finite_element(std::size_t i)
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* cahnhilliard2d_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard2d_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
@@ -3912,17 +5522,17 @@ ufc::dofmap* cahnhilliard2d_form_1::create_dofmap(std::size_t i) const
       }
     case 3:
       {
-        return new cahnhilliard2d_dofmap_0();
+        return new cahnhilliard2d_dofmap_3();
         break;
       }
     case 4:
       {
-        return new cahnhilliard2d_dofmap_0();
+        return new cahnhilliard2d_dofmap_3();
         break;
       }
     case 5:
       {
-        return new cahnhilliard2d_dofmap_0();
+        return new cahnhilliard2d_dofmap_3();
         break;
       }
     }
@@ -3930,128 +5540,163 @@ ufc::dofmap* cahnhilliard2d_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t cahnhilliard2d_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t cahnhilliard2d_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t cahnhilliard2d_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t cahnhilliard2d_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t cahnhilliard2d_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t cahnhilliard2d_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard2d_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard2d_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool cahnhilliard2d_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool cahnhilliard2d_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool cahnhilliard2d_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool cahnhilliard2d_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool cahnhilliard2d_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool cahnhilliard2d_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool cahnhilliard2d_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool cahnhilliard2d_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * cahnhilliard2d_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * cahnhilliard2d_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* cahnhilliard2d_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * cahnhilliard2d_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* cahnhilliard2d_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * cahnhilliard2d_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* cahnhilliard2d_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * cahnhilliard2d_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* cahnhilliard2d_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * cahnhilliard2d_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* cahnhilliard2d_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * cahnhilliard2d_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * cahnhilliard2d_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* cahnhilliard2d_form_1::create_default_cell_integral() const
+ufc::cell_integral * cahnhilliard2d_form_1::create_default_cell_integral() const
 {
     return new cahnhilliard2d_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* cahnhilliard2d_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * cahnhilliard2d_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * cahnhilliard2d_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * cahnhilliard2d_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* cahnhilliard2d_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * cahnhilliard2d_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* cahnhilliard2d_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * cahnhilliard2d_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* cahnhilliard2d_form_1::create_default_custom_integral() const
+ufc::interface_integral * cahnhilliard2d_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * cahnhilliard2d_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.h b/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.h
index f026248..b6a617f 100644
--- a/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.h
+++ b/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,918 +13,901 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __CAHNHILLIARD2D_H
 #define __CAHNHILLIARD2D_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class cahnhilliard2d_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_finite_element_0();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_finite_element_0();
+  ~cahnhilliard2d_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_size() const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a finite element.
 
 class cahnhilliard2d_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_finite_element_1();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_finite_element_1();
+  ~cahnhilliard2d_finite_element_1() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_size() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_size() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t degree() const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a finite element.
 
 class cahnhilliard2d_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_finite_element_2();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_finite_element_2();
+  ~cahnhilliard2d_finite_element_2() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_size() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_size() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t degree() const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class cahnhilliard2d_finite_element_3: public ufc::finite_element
+{
+public:
+
+  cahnhilliard2d_finite_element_3();
+
+  ~cahnhilliard2d_finite_element_3() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class cahnhilliard2d_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_dofmap_0();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_dofmap_0();
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  ~cahnhilliard2d_dofmap_0() override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  const char * signature() const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_sub_dofmaps() const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  ufc::dofmap * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class cahnhilliard2d_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_dofmap_1();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_dofmap_1();
+  ~cahnhilliard2d_dofmap_1() override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  const char * signature() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t topological_dimension() const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t num_sub_dofmaps() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  ufc::dofmap * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class cahnhilliard2d_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_dofmap_2();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_dofmap_2();
+  ~cahnhilliard2d_dofmap_2() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  std::size_t num_sub_dofmaps() const final override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class cahnhilliard2d_dofmap_3: public ufc::dofmap
+{
+public:
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  cahnhilliard2d_dofmap_3();
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  ~cahnhilliard2d_dofmap_3() override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  const char * signature() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t topological_dimension() const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  std::size_t num_element_dofs() const final override;
+
+  std::size_t num_facet_dofs() const final override;
+
+  std::size_t num_entity_dofs(std::size_t d) const final override;
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 cahnhilliard2d_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_cell_integral_0_otherwise();
+  ~cahnhilliard2d_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 cahnhilliard2d_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_cell_integral_1_otherwise();
+  ~cahnhilliard2d_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class cahnhilliard2d_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_form_0();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_form_0();
+  ~cahnhilliard2d_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class cahnhilliard2d_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   cahnhilliard2d_form_1();
 
-  /// Destructor
-  virtual ~cahnhilliard2d_form_1();
+  ~cahnhilliard2d_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
+
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_vertex_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_cutcell_integrals() const final override;
 
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::custom_integral * create_default_custom_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -934,14 +917,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace CahnHilliard2D
 {
@@ -950,43 +939,20 @@ class CoefficientSpace_dt: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_dt(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_dt(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_dt(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_dt(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -997,43 +963,20 @@ class CoefficientSpace_lmbda: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1044,43 +987,20 @@ class CoefficientSpace_theta: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_theta(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_theta(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_theta(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_theta(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1091,43 +1011,20 @@ class CoefficientSpace_u: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1138,43 +1035,20 @@ class CoefficientSpace_u0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1185,45 +1059,42 @@ class Form_F_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_F_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_F_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_F_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -1243,19 +1114,19 @@ class Form_F: public dolfin::Form
 public:
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_0());
+    _ufc_form = std::make_shared<const cahnhilliard2d_form_0>();
   }
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& dt, const dolfin::GenericFunction& theta):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
     dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->u = u;
     this->u0 = u0;
@@ -1263,65 +1134,122 @@ public:
     this->dt = dt;
     this->theta = theta;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_0());
+    _ufc_form = std::make_shared<const cahnhilliard2d_form_0>();
   }
 
-  // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
-    dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
+  // Destructor
+  ~Form_F()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    if (name == "u")
+      return 0;
+    else if (name == "u0")
+      return 1;
+    else if (name == "lmbda")
+      return 2;
+    else if (name == "dt")
+      return 3;
+    else if (name == "theta")
+      return 4;
 
-    this->u = *u;
-    this->u0 = *u0;
-    this->lmbda = *lmbda;
-    this->dt = *dt;
-    this->theta = *theta;
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_0());
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "u";
+    case 1:
+      return "u0";
+    case 2:
+      return "lmbda";
+    case 3:
+      return "dt";
+    case 4:
+      return "theta";
+    }
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_F_FunctionSpace_1 CoefficientSpace_u;
+  typedef Form_F_FunctionSpace_2 CoefficientSpace_u0;
+  typedef Form_F_FunctionSpace_3 CoefficientSpace_lmbda;
+  typedef Form_F_FunctionSpace_4 CoefficientSpace_dt;
+  typedef Form_F_FunctionSpace_5 CoefficientSpace_theta;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+  dolfin::CoefficientAssigner u0;
+  dolfin::CoefficientAssigner lmbda;
+  dolfin::CoefficientAssigner dt;
+  dolfin::CoefficientAssigner theta;
+};
+
+class MultiMeshForm_F: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_0());
   }
 
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& dt, const dolfin::GenericFunction& theta):
-    dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
+    dolfin::MultiMeshForm(V0), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
+    /// Assign coefficients
     this->u = u;
     this->u0 = u0;
     this->lmbda = lmbda;
     this->dt = dt;
     this->theta = theta;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_0());
-  }
-
-  // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
-    dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
-  {
-    _function_spaces[0] = V0;
-
-    this->u = *u;
-    this->u0 = *u0;
-    this->lmbda = *lmbda;
-    this->dt = *dt;
-    this->theta = *theta;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_0());
   }
 
   // Destructor
-  ~Form_F()
+  ~MultiMeshForm_F()
   {}
 
   /// Return the number of the coefficient with this name
@@ -1369,6 +1297,7 @@ public:
 
   // Typedefs
   typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_F_FunctionSpace_1 CoefficientSpace_u;
   typedef Form_F_FunctionSpace_2 CoefficientSpace_u0;
   typedef Form_F_FunctionSpace_3 CoefficientSpace_lmbda;
@@ -1376,54 +1305,31 @@ public:
   typedef Form_F_FunctionSpace_5 CoefficientSpace_theta;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
-  dolfin::CoefficientAssigner u0;
-  dolfin::CoefficientAssigner lmbda;
-  dolfin::CoefficientAssigner dt;
-  dolfin::CoefficientAssigner theta;
+  dolfin::MultiMeshCoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner u0;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner dt;
+  dolfin::MultiMeshCoefficientAssigner theta;
 };
 
 class Form_J_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1434,45 +1340,62 @@ class Form_J_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard2d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard2d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_J_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard2d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard2d_dofmap_2()), *mesh, constrained_domain)))
+};
+
+class Form_J_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -1490,87 +1413,138 @@ class Form_J: public dolfin::Form
 public:
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_1());
+    _ufc_form = std::make_shared<const cahnhilliard2d_form_1>();
   }
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& dt, const dolfin::GenericFunction& theta):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
     dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->u = u;
     this->lmbda = lmbda;
     this->dt = dt;
     this->theta = theta;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_1());
+    _ufc_form = std::make_shared<const cahnhilliard2d_form_1>();
   }
 
-  // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
-    dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_J()
+  {}
 
-    this->u = *u;
-    this->lmbda = *lmbda;
-    this->dt = *dt;
-    this->theta = *theta;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "u")
+      return 0;
+    else if (name == "lmbda")
+      return 1;
+    else if (name == "dt")
+      return 2;
+    else if (name == "theta")
+      return 3;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "u";
+    case 1:
+      return "lmbda";
+    case 2:
+      return "dt";
+    case 3:
+      return "theta";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_J_FunctionSpace_0 TestSpace;
+  typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
+  typedef Form_J_FunctionSpace_3 CoefficientSpace_lmbda;
+  typedef Form_J_FunctionSpace_4 CoefficientSpace_dt;
+  typedef Form_J_FunctionSpace_5 CoefficientSpace_theta;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+  dolfin::CoefficientAssigner lmbda;
+  dolfin::CoefficientAssigner dt;
+  dolfin::CoefficientAssigner theta;
+};
+
+class MultiMeshForm_J: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& dt, const dolfin::GenericFunction& theta):
-    dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->u = u;
-    this->lmbda = lmbda;
-    this->dt = dt;
-    this->theta = theta;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_1());
   }
 
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
-    dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->u = *u;
-    this->lmbda = *lmbda;
-    this->dt = *dt;
-    this->theta = *theta;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->u = u;
+    this->lmbda = lmbda;
+    this->dt = dt;
+    this->theta = theta;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard2d_form_1());
   }
 
   // Destructor
-  ~Form_J()
+  ~MultiMeshForm_J()
   {}
 
   /// Return the number of the coefficient with this name
@@ -1615,24 +1589,31 @@ public:
   // Typedefs
   typedef Form_J_FunctionSpace_0 TestSpace;
   typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
   typedef Form_J_FunctionSpace_3 CoefficientSpace_lmbda;
   typedef Form_J_FunctionSpace_4 CoefficientSpace_dt;
   typedef Form_J_FunctionSpace_5 CoefficientSpace_theta;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
-  dolfin::CoefficientAssigner lmbda;
-  dolfin::CoefficientAssigner dt;
-  dolfin::CoefficientAssigner theta;
+  dolfin::MultiMeshCoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner dt;
+  dolfin::MultiMeshCoefficientAssigner theta;
 };
 
 // Class typedefs
 typedef Form_J BilinearForm;
+typedef MultiMeshForm_J MultiMeshBilinearForm;
 typedef Form_J JacobianForm;
+typedef MultiMeshForm_J MultiMeshJacobianForm;
 typedef Form_F LinearForm;
+typedef MultiMeshForm_F MultiMeshLinearForm;
 typedef Form_F ResidualForm;
+typedef MultiMeshForm_F MultiMeshResidualForm;
 typedef Form_F::TestSpace FunctionSpace;
+typedef Form_F::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.ufl b/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.ufl
index 65a158a..4c1adc5 100644
--- a/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.ufl
+++ b/demo/documented/cahn-hilliard/cpp/CahnHilliard2D.ufl
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2006-2014 Garth N. Wells
 #
 # This file is part of DOLFIN.
@@ -16,7 +17,7 @@
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
 # Modified by Anders Logg 2011
-# Modified by Martin Alnaes 2014
+# Modified by Martin Alnæs 2014
 #
 # The linearised bilinear form a(du, v) and linear form L(v) for
 # the Cahn-Hilliard equation.
diff --git a/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.cpp b/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.cpp
index ee1e148..88742dd 100644
--- a/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.cpp
+++ b/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.cpp
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,335 +13,99 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #include "CahnHilliard3D.h"
 
-/// Constructor
 cahnhilliard3d_finite_element_0::cahnhilliard3d_finite_element_0() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
 cahnhilliard3d_finite_element_0::~cahnhilliard3d_finite_element_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* cahnhilliard3d_finite_element_0::signature() const
+const char * cahnhilliard3d_finite_element_0::signature() const
 {
-    return "FiniteElement('Real', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
 }
 
-/// Return the cell shape
 ufc::shape cahnhilliard3d_finite_element_0::cell_shape() const
 {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
 }
 
-/// Return the topological dimension of the cell shape
 std::size_t cahnhilliard3d_finite_element_0::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the geometric dimension of the cell shape
 std::size_t cahnhilliard3d_finite_element_0::geometric_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the finite element function space
 std::size_t cahnhilliard3d_finite_element_0::space_dimension() const
 {
-    return 1;
+    return 4;
 }
 
-/// Return the rank of the value space
 std::size_t cahnhilliard3d_finite_element_0::value_rank() const
 {
     return 0;
 }
 
-/// Return the dimension of the value space for axis i
 std::size_t cahnhilliard3d_finite_element_0::value_dimension(std::size_t i) const
 {
     return 1;
 }
 
-/// Evaluate basis function i at given point x in cell
-void cahnhilliard3d_finite_element_0::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
-                                    int cell_orientation)
-{
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Compute subdeterminants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-}
-
-/// Evaluate all basis functions at given point x in cell
-void cahnhilliard3d_finite_element_0::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
-                                        int cell_orientation)
-{
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-}
-
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void cahnhilliard3d_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
-                                                std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
-                                                int cell_orientation)
-{
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-}
-
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void cahnhilliard3d_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
-                                                    int cell_orientation)
-{
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-}
-
-/// Evaluate linear functional for dof i on the function f
-double cahnhilliard3d_finite_element_0::evaluate_dof(std::size_t i,
-                                   const ufc::function& f,
-                                   const double* vertex_coordinates,
-                                   int cell_orientation,
-                                   const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-}
-
-/// Evaluate linear functionals for all dofs on the function f
-void cahnhilliard3d_finite_element_0::evaluate_dofs(double* values,
-                                  const ufc::function& f,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation,
-                                  const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-}
-
-/// Interpolate vertex values from dof values
-void cahnhilliard3d_finite_element_0::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation,
-                                              const ufc::cell& c) const
-{
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-    vertex_values[3] = dof_values[0];
-}
-
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void cahnhilliard3d_finite_element_0::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-}
-
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void cahnhilliard3d_finite_element_0::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
-{
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-}
-
-/// Return the number of sub elements (for a mixed element)
-std::size_t cahnhilliard3d_finite_element_0::num_sub_elements() const
+std::size_t cahnhilliard3d_finite_element_0::value_size() const
 {
-    return 0;
+    return 1;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* cahnhilliard3d_finite_element_0::create_sub_element(std::size_t i) const
+std::size_t cahnhilliard3d_finite_element_0::reference_value_rank() const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::finite_element* cahnhilliard3d_finite_element_0::create() const
-{
-    return new cahnhilliard3d_finite_element_0();
-}
-
-
-/// Constructor
-cahnhilliard3d_finite_element_1::cahnhilliard3d_finite_element_1() : ufc::finite_element()
-{
-    // Do nothing
-}
-
-/// Destructor
-cahnhilliard3d_finite_element_1::~cahnhilliard3d_finite_element_1()
-{
-    // Do nothing
-}
-
-/// Return a string identifying the finite element
-const char* cahnhilliard3d_finite_element_1::signature() const
-{
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
-}
-
-/// Return the cell shape
-ufc::shape cahnhilliard3d_finite_element_1::cell_shape() const
-{
-    return ufc::tetrahedron;
-}
-
-/// Return the topological dimension of the cell shape
-std::size_t cahnhilliard3d_finite_element_1::topological_dimension() const
-{
-    return 3;
-}
-
-/// Return the geometric dimension of the cell shape
-std::size_t cahnhilliard3d_finite_element_1::geometric_dimension() const
+std::size_t cahnhilliard3d_finite_element_0::reference_value_dimension(std::size_t i) const
 {
-    return 3;
+    return 1;
 }
 
-/// Return the dimension of the finite element function space
-std::size_t cahnhilliard3d_finite_element_1::space_dimension() const
+std::size_t cahnhilliard3d_finite_element_0::reference_value_size() const
 {
-    return 4;
+    return 1;
 }
 
-/// Return the rank of the value space
-std::size_t cahnhilliard3d_finite_element_1::value_rank() const
+std::size_t cahnhilliard3d_finite_element_0::degree() const
 {
-    return 0;
+    return 1;
 }
 
-/// Return the dimension of the value space for axis i
-std::size_t cahnhilliard3d_finite_element_1::value_dimension(std::size_t i) const
+const char * cahnhilliard3d_finite_element_0::family() const
 {
-    return 1;
+    return "Lagrange";
 }
 
-/// Evaluate basis function i at given point x in cell
-void cahnhilliard3d_finite_element_1::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+void cahnhilliard3d_finite_element_0::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -350,9 +114,9 @@ void cahnhilliard3d_finite_element_1::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -499,10 +263,9 @@ void cahnhilliard3d_finite_element_1::_evaluate_basis(std::size_t i,
     
 }
 
-/// Evaluate all basis functions at given point x in cell
-void cahnhilliard3d_finite_element_1::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
+void cahnhilliard3d_finite_element_0::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
                                         int cell_orientation)
 {
     // Helper variable to hold values of a single dof.
@@ -511,17 +274,16 @@ void cahnhilliard3d_finite_element_1::_evaluate_basis_all(double* values,
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
+void cahnhilliard3d_finite_element_0::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
     
@@ -541,7 +303,7 @@ void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -553,7 +315,7 @@ void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -562,9 +324,9 @@ void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1264,17 +1026,16 @@ void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
     
 }
 
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
+void cahnhilliard3d_finite_element_0::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
                                                     int cell_orientation)
 {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1310,7 +1071,7 @@ void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives_all(std::size_
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1318,10 +1079,9 @@ void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives_all(std::size_
     } // end loop over 'r'
 }
 
-/// Evaluate linear functional for dof i on the function f
-double cahnhilliard3d_finite_element_1::evaluate_dof(std::size_t i,
+double cahnhilliard3d_finite_element_0::evaluate_dof(std::size_t i,
                                    const ufc::function& f,
-                                   const double* vertex_coordinates,
+                                   const double * coordinate_dofs,
                                    int cell_orientation,
                                    const ufc::cell& c) const
 {
@@ -1334,36 +1094,36 @@ double cahnhilliard3d_finite_element_1::evaluate_dof(std::size_t i,
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1373,10 +1133,9 @@ double cahnhilliard3d_finite_element_1::evaluate_dof(std::size_t i,
     return 0.0;
 }
 
-/// Evaluate linear functionals for all dofs on the function f
-void cahnhilliard3d_finite_element_1::evaluate_dofs(double* values,
+void cahnhilliard3d_finite_element_0::evaluate_dofs(double * values,
                                   const ufc::function& f,
-                                  const double* vertex_coordinates,
+                                  const double * coordinate_dofs,
                                   int cell_orientation,
                                   const ufc::cell& c) const
 {
@@ -1385,32 +1144,31 @@ void cahnhilliard3d_finite_element_1::evaluate_dofs(double* values,
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
 }
 
-/// Interpolate vertex values from dof values
-void cahnhilliard3d_finite_element_1::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
+void cahnhilliard3d_finite_element_0::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
                                               int cell_orientation,
                                               const ufc::cell& c) const
 {
@@ -1421,97 +1179,86 @@ void cahnhilliard3d_finite_element_1::interpolate_vertex_values(double* vertex_v
     vertex_values[3] = dof_values[3];
 }
 
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void cahnhilliard3d_finite_element_1::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
-{
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-}
-
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void cahnhilliard3d_finite_element_1::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+void cahnhilliard3d_finite_element_0::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t cahnhilliard3d_finite_element_1::num_sub_elements() const
+std::size_t cahnhilliard3d_finite_element_0::num_sub_elements() const
 {
     return 0;
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* cahnhilliard3d_finite_element_1::create_sub_element(std::size_t i) const
+ufc::finite_element * cahnhilliard3d_finite_element_0::create_sub_element(std::size_t i) const
 {
     return 0;
 }
 
-/// Create a new class instance
-ufc::finite_element* cahnhilliard3d_finite_element_1::create() const
+ufc::finite_element * cahnhilliard3d_finite_element_0::create() const
 {
-    return new cahnhilliard3d_finite_element_1();
+    return new cahnhilliard3d_finite_element_0();
 }
 
 
-/// Constructor
-cahnhilliard3d_finite_element_2::cahnhilliard3d_finite_element_2() : ufc::finite_element()
+cahnhilliard3d_finite_element_1::cahnhilliard3d_finite_element_1() : ufc::finite_element()
 {
     // Do nothing
 }
 
-/// Destructor
-cahnhilliard3d_finite_element_2::~cahnhilliard3d_finite_element_2()
+cahnhilliard3d_finite_element_1::~cahnhilliard3d_finite_element_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the finite element
-const char* cahnhilliard3d_finite_element_2::signature() const
+const char * cahnhilliard3d_finite_element_1::signature() const
 {
-    return "MixedElement(FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None), FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None), **{'value_shape': (2,) })";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
 }
 
-/// Return the cell shape
-ufc::shape cahnhilliard3d_finite_element_2::cell_shape() const
+ufc::shape cahnhilliard3d_finite_element_1::cell_shape() const
 {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
 }
 
-/// Return the topological dimension of the cell shape
-std::size_t cahnhilliard3d_finite_element_2::topological_dimension() const
+std::size_t cahnhilliard3d_finite_element_1::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the geometric dimension of the cell shape
-std::size_t cahnhilliard3d_finite_element_2::geometric_dimension() const
+std::size_t cahnhilliard3d_finite_element_1::geometric_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the finite element function space
-std::size_t cahnhilliard3d_finite_element_2::space_dimension() const
+std::size_t cahnhilliard3d_finite_element_1::space_dimension() const
 {
-    return 8;
+    return 12;
 }
 
-/// Return the rank of the value space
-std::size_t cahnhilliard3d_finite_element_2::value_rank() const
+std::size_t cahnhilliard3d_finite_element_1::value_rank() const
 {
     return 1;
 }
 
-/// Return the dimension of the value space for axis i
-std::size_t cahnhilliard3d_finite_element_2::value_dimension(std::size_t i) const
+std::size_t cahnhilliard3d_finite_element_1::value_dimension(std::size_t i) const
 {
     switch (i)
     {
     case 0:
       {
-        return 2;
+        return 3;
         break;
       }
     }
@@ -1519,16 +1266,54 @@ std::size_t cahnhilliard3d_finite_element_2::value_dimension(std::size_t i) cons
     return 0;
 }
 
-/// Evaluate basis function i at given point x in cell
-void cahnhilliard3d_finite_element_2::_evaluate_basis(std::size_t i,
-                                    double* values,
-                                    const double* x,
-                                    const double* vertex_coordinates,
+std::size_t cahnhilliard3d_finite_element_1::value_size() const
+{
+    return 3;
+}
+
+std::size_t cahnhilliard3d_finite_element_1::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard3d_finite_element_1::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t cahnhilliard3d_finite_element_1::reference_value_size() const
+{
+    return 3;
+}
+
+std::size_t cahnhilliard3d_finite_element_1::degree() const
+{
+    return 1;
+}
+
+const char * cahnhilliard3d_finite_element_1::family() const
+{
+    return "Lagrange";
+}
+
+void cahnhilliard3d_finite_element_1::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
                                     int cell_orientation)
 {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1537,9 +1322,9 @@ void cahnhilliard3d_finite_element_2::_evaluate_basis(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1561,6 +1346,7 @@ void cahnhilliard3d_finite_element_2::_evaluate_basis(std::size_t i,
     // Reset values
     values[0] = 0.0;
     values[1] = 0.0;
+    values[2] = 0.0;
     switch (i)
     {
     case 0:
@@ -1803,36 +1589,154 @@ void cahnhilliard3d_finite_element_2::_evaluate_basis(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    }
-    
-}
-
-/// Evaluate all basis functions at given point x in cell
-void cahnhilliard3d_finite_element_2::_evaluate_basis_all(double* values,
-                                        const double* x,
-                                        const double* vertex_coordinates,
-                                        int cell_orientation)
-{
-    // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 8; r++)
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void cahnhilliard3d_finite_element_1::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
       {
-        values[r*2 + s] = dof_values[s];
+        values[r*3 + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
 }
 
-/// Evaluate order n derivatives of basis function i at given point x in cell
-void cahnhilliard3d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives(std::size_t i,
                                                 std::size_t n,
-                                                double* values,
-                                                const double* x,
-                                                const double* vertex_coordinates,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
                                                 int cell_orientation)
 {
     
@@ -1844,7 +1748,7 @@ void cahnhilliard3d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -1852,7 +1756,7 @@ void cahnhilliard3d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1864,7 +1768,7 @@ void cahnhilliard3d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1873,9 +1777,9 @@ void cahnhilliard3d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -3199,302 +3103,3534 @@ void cahnhilliard3d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
       } // end loop over 'r'
         break;
       }
-    }
-    
-}
-
-/// Evaluate order n derivatives of all basis functions at given point x in cell
-void cahnhilliard3d_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
-                                                    double* values,
-                                                    const double* x,
-                                                    const double* vertex_coordinates,
-                                                    int cell_orientation)
-{
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+    case 8:
       {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[6];
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-}
-
-/// Evaluate linear functional for dof i on the function f
-double cahnhilliard3d_finite_element_2::evaluate_dof(std::size_t i,
-                                   const ufc::function& f,
-                                   const double* vertex_coordinates,
-                                   int cell_orientation,
-                                   const ufc::cell& c) const
-{
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void cahnhilliard3d_finite_element_1::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double cahnhilliard3d_finite_element_1::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void cahnhilliard3d_finite_element_1::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+}
+
+void cahnhilliard3d_finite_element_1::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+}
+
+void cahnhilliard3d_finite_element_1::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+}
+
+std::size_t cahnhilliard3d_finite_element_1::num_sub_elements() const
+{
+    return 3;
+}
+
+ufc::finite_element * cahnhilliard3d_finite_element_1::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new cahnhilliard3d_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new cahnhilliard3d_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new cahnhilliard3d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * cahnhilliard3d_finite_element_1::create() const
+{
+    return new cahnhilliard3d_finite_element_1();
+}
+
+
+cahnhilliard3d_finite_element_2::cahnhilliard3d_finite_element_2() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+cahnhilliard3d_finite_element_2::~cahnhilliard3d_finite_element_2()
+{
+    // Do nothing
+}
+
+const char * cahnhilliard3d_finite_element_2::signature() const
+{
+    return "MixedElement(FiniteElement('Lagrange', tetrahedron, 1), FiniteElement('Lagrange', tetrahedron, 1))";
+}
+
+ufc::shape cahnhilliard3d_finite_element_2::cell_shape() const
+{
+    return ufc::shape::tetrahedron;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::geometric_dimension() const
+{
+    return 3;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::space_dimension() const
+{
+    return 8;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::value_rank() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::value_size() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::reference_value_rank() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::reference_value_dimension(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::reference_value_size() const
+{
+    return 2;
+}
+
+std::size_t cahnhilliard3d_finite_element_2::degree() const
+{
+    return 1;
+}
+
+const char * cahnhilliard3d_finite_element_2::family() const
+{
+    return "Mixed";
+}
+
+void cahnhilliard3d_finite_element_2::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void cahnhilliard3d_finite_element_2::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+void cahnhilliard3d_finite_element_2::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+}
+
+void cahnhilliard3d_finite_element_2::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[6];
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+}
+
+double cahnhilliard3d_finite_element_2::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+}
+
+void cahnhilliard3d_finite_element_2::evaluate_dofs(double * values,
+                                  const ufc::function& f,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation,
+                                  const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+}
+
+void cahnhilliard3d_finite_element_2::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation,
+                                              const ufc::cell& c) const
+{
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    vertex_values[6] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[3] = dof_values[5];
+    vertex_values[5] = dof_values[6];
+    vertex_values[7] = dof_values[7];
+}
+
+void cahnhilliard3d_finite_element_2::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+}
+
+std::size_t cahnhilliard3d_finite_element_2::num_sub_elements() const
+{
+    return 2;
+}
+
+ufc::finite_element * cahnhilliard3d_finite_element_2::create_sub_element(std::size_t i) const
+{
+    switch (i)
+    {
+    case 0:
+      {
+        return new cahnhilliard3d_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new cahnhilliard3d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+ufc::finite_element * cahnhilliard3d_finite_element_2::create() const
+{
+    return new cahnhilliard3d_finite_element_2();
+}
+
+
+cahnhilliard3d_finite_element_3::cahnhilliard3d_finite_element_3() : ufc::finite_element()
+{
+    // Do nothing
+}
+
+cahnhilliard3d_finite_element_3::~cahnhilliard3d_finite_element_3()
+{
+    // Do nothing
+}
+
+const char * cahnhilliard3d_finite_element_3::signature() const
+{
+    return "FiniteElement('Real', tetrahedron, 0)";
+}
+
+ufc::shape cahnhilliard3d_finite_element_3::cell_shape() const
+{
+    return ufc::shape::tetrahedron;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::geometric_dimension() const
+{
+    return 3;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::space_dimension() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::value_rank() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::value_size() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::reference_value_rank() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::reference_value_dimension(std::size_t i) const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::reference_value_size() const
+{
+    return 1;
+}
+
+std::size_t cahnhilliard3d_finite_element_3::degree() const
+{
+    return 0;
+}
+
+const char * cahnhilliard3d_finite_element_3::family() const
+{
+    return "Real";
+}
+
+void cahnhilliard3d_finite_element_3::_evaluate_basis(std::size_t i,
+                                    double * values,
+                                    const double * x,
+                                    const double * coordinate_dofs,
+                                    int cell_orientation)
+{
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Compute subdeterminants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+}
+
+void cahnhilliard3d_finite_element_3::_evaluate_basis_all(double * values,
+                                        const double * x,
+                                        const double * coordinate_dofs,
+                                        int cell_orientation)
+{
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+}
+
+void cahnhilliard3d_finite_element_3::_evaluate_basis_derivatives(std::size_t i,
+                                                std::size_t n,
+                                                double * values,
+                                                const double * x,
+                                                const double * coordinate_dofs,
+                                                int cell_orientation)
+{
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+}
+
+void cahnhilliard3d_finite_element_3::_evaluate_basis_derivatives_all(std::size_t n,
+                                                    double * values,
+                                                    const double * x,
+                                                    const double * coordinate_dofs,
+                                                    int cell_orientation)
+{
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+}
+
+double cahnhilliard3d_finite_element_3::evaluate_dof(std::size_t i,
+                                   const ufc::function& f,
+                                   const double * coordinate_dofs,
+                                   int cell_orientation,
+                                   const ufc::cell& c) const
+{
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 4:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 5:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 6:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
     }
     
     return 0.0;
 }
 
-/// Evaluate linear functionals for all dofs on the function f
-void cahnhilliard3d_finite_element_2::evaluate_dofs(double* values,
+void cahnhilliard3d_finite_element_3::evaluate_dofs(double * values,
                                   const ufc::function& f,
-                                  const double* vertex_coordinates,
+                                  const double * coordinate_dofs,
                                   int cell_orientation,
                                   const ufc::cell& c) const
 {
     // Declare variables for result of evaluation
-    double vals[2];
+    double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[4] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
 }
 
-/// Interpolate vertex values from dof values
-void cahnhilliard3d_finite_element_2::interpolate_vertex_values(double* vertex_values,
-                                              const double* dof_values,
-                                              const double* vertex_coordinates,
+void cahnhilliard3d_finite_element_3::interpolate_vertex_values(double * vertex_values,
+                                              const double * dof_values,
+                                              const double * coordinate_dofs,
                                               int cell_orientation,
                                               const ufc::cell& c) const
 {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    vertex_values[6] = dof_values[3];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[4];
-    vertex_values[3] = dof_values[5];
-    vertex_values[5] = dof_values[6];
-    vertex_values[7] = dof_values[7];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+    vertex_values[3] = dof_values[0];
+}
+
+void cahnhilliard3d_finite_element_3::tabulate_dof_coordinates(double * dof_coordinates,
+                                             const double * coordinate_dofs) const
+{
+    dof_coordinates[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
 }
 
-/// Map coordinate xhat from reference cell to coordinate x in cell
-void cahnhilliard3d_finite_element_2::map_from_reference_cell(double* x,
-                                            const double* xhat,
-                                            const ufc::cell& c) const
+std::size_t cahnhilliard3d_finite_element_3::num_sub_elements() const
 {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    return 0;
 }
 
-/// Map from coordinate x in cell to coordinate xhat in reference cell
-void cahnhilliard3d_finite_element_2::map_to_reference_cell(double* xhat,
-                                          const double* x,
-                                          const ufc::cell& c) const
+ufc::finite_element * cahnhilliard3d_finite_element_3::create_sub_element(std::size_t i) const
 {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 0;
 }
 
-/// Return the number of sub elements (for a mixed element)
-std::size_t cahnhilliard3d_finite_element_2::num_sub_elements() const
+ufc::finite_element * cahnhilliard3d_finite_element_3::create() const
 {
-    return 2;
+    return new cahnhilliard3d_finite_element_3();
+}
+
+
+cahnhilliard3d_dofmap_0::cahnhilliard3d_dofmap_0() : ufc::dofmap()
+{
+    // Do nothing
+}
+
+cahnhilliard3d_dofmap_0::~cahnhilliard3d_dofmap_0()
+{
+    // Do nothing
+}
+
+const char * cahnhilliard3d_dofmap_0::signature() const
+{
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+}
+
+bool cahnhilliard3d_dofmap_0::needs_mesh_entities(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+}
+
+std::size_t cahnhilliard3d_dofmap_0::topological_dimension() const
+{
+    return 3;
+}
+
+std::size_t cahnhilliard3d_dofmap_0::global_dimension(const std::vector<std::size_t>&
+                                            num_global_entities) const
+{
+    return num_global_entities[0];
+}
+
+std::size_t cahnhilliard3d_dofmap_0::num_element_dofs() const
+{
+    return 4;
+}
+
+std::size_t cahnhilliard3d_dofmap_0::num_facet_dofs() const
+{
+    return 3;
+}
+
+std::size_t cahnhilliard3d_dofmap_0::num_entity_dofs(std::size_t d) const
+{
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+}
+
+void cahnhilliard3d_dofmap_0::tabulate_dofs(std::size_t * dofs,
+                                  const std::vector<std::size_t>& num_global_entities,
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
+{
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+}
+
+void cahnhilliard3d_dofmap_0::tabulate_facet_dofs(std::size_t * dofs,
+                                        std::size_t facet) const
+{
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
 }
 
-/// Create a new finite element for sub element i (for a mixed element)
-ufc::finite_element* cahnhilliard3d_finite_element_2::create_sub_element(std::size_t i) const
+void cahnhilliard3d_dofmap_0::tabulate_entity_dofs(std::size_t * dofs,
+                                  std::size_t d, std::size_t i) const
 {
-    switch (i)
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
     {
     case 0:
       {
-        return new cahnhilliard3d_finite_element_1();
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        return new cahnhilliard3d_finite_element_1();
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
         break;
       }
     }
     
+}
+
+std::size_t cahnhilliard3d_dofmap_0::num_sub_dofmaps() const
+{
     return 0;
 }
 
-/// Create a new class instance
-ufc::finite_element* cahnhilliard3d_finite_element_2::create() const
+ufc::dofmap * cahnhilliard3d_dofmap_0::create_sub_dofmap(std::size_t i) const
 {
-    return new cahnhilliard3d_finite_element_2();
+    return 0;
 }
 
-/// Constructor
-cahnhilliard3d_dofmap_0::cahnhilliard3d_dofmap_0() : ufc::dofmap()
+ufc::dofmap * cahnhilliard3d_dofmap_0::create() const
+{
+    return new cahnhilliard3d_dofmap_0();
+}
+
+
+cahnhilliard3d_dofmap_1::cahnhilliard3d_dofmap_1() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-cahnhilliard3d_dofmap_0::~cahnhilliard3d_dofmap_0()
+cahnhilliard3d_dofmap_1::~cahnhilliard3d_dofmap_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* cahnhilliard3d_dofmap_0::signature() const
+const char * cahnhilliard3d_dofmap_1::signature() const
 {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool cahnhilliard3d_dofmap_0::needs_mesh_entities(std::size_t d) const
+bool cahnhilliard3d_dofmap_1::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -3517,45 +6653,34 @@ bool cahnhilliard3d_dofmap_0::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t cahnhilliard3d_dofmap_0::topological_dimension() const
-{
-    return 3;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t cahnhilliard3d_dofmap_0::geometric_dimension() const
+std::size_t cahnhilliard3d_dofmap_1::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t cahnhilliard3d_dofmap_0::global_dimension(const std::vector<std::size_t>&
+std::size_t cahnhilliard3d_dofmap_1::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
-    return 1;
+    return 3*num_global_entities[0];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t cahnhilliard3d_dofmap_0::num_element_dofs() const
+std::size_t cahnhilliard3d_dofmap_1::num_element_dofs() const
 {
-    return 1;
+    return 12;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t cahnhilliard3d_dofmap_0::num_facet_dofs() const
+std::size_t cahnhilliard3d_dofmap_1::num_facet_dofs() const
 {
-    return 0;
+    return 9;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t cahnhilliard3d_dofmap_0::num_entity_dofs(std::size_t d) const
+std::size_t cahnhilliard3d_dofmap_1::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 3;
         break;
       }
     case 1:
@@ -3570,7 +6695,7 @@ std::size_t cahnhilliard3d_dofmap_0::num_entity_dofs(std::size_t d) const
       }
     case 3:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -3578,46 +6703,90 @@ std::size_t cahnhilliard3d_dofmap_0::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void cahnhilliard3d_dofmap_0::tabulate_dofs(std::size_t* dofs,
+void cahnhilliard3d_dofmap_1::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
-    dofs[0] = 0;
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void cahnhilliard3d_dofmap_0::tabulate_facet_dofs(std::size_t* dofs,
+void cahnhilliard3d_dofmap_1::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
         break;
       }
     case 3:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
         break;
       }
     }
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void cahnhilliard3d_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
+void cahnhilliard3d_dofmap_1::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 3)
@@ -3629,7 +6798,43 @@ void cahnhilliard3d_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
     {
     case 0:
       {
-        
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -3644,65 +6849,64 @@ void cahnhilliard3d_dofmap_0::tabulate_entity_dofs(std::size_t* dofs,
       }
     case 3:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void cahnhilliard3d_dofmap_0::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
+std::size_t cahnhilliard3d_dofmap_1::num_sub_dofmaps() const
 {
-    dof_coordinates[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+    return 3;
 }
 
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t cahnhilliard3d_dofmap_0::num_sub_dofmaps() const
+ufc::dofmap * cahnhilliard3d_dofmap_1::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new cahnhilliard3d_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new cahnhilliard3d_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new cahnhilliard3d_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* cahnhilliard3d_dofmap_0::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard3d_dofmap_1::create() const
 {
-    return 0;
+    return new cahnhilliard3d_dofmap_1();
 }
 
-/// Create a new class instance
-ufc::dofmap* cahnhilliard3d_dofmap_0::create() const
-{
-    return new cahnhilliard3d_dofmap_0();
-}
 
-/// Constructor
-cahnhilliard3d_dofmap_1::cahnhilliard3d_dofmap_1() : ufc::dofmap()
+cahnhilliard3d_dofmap_2::cahnhilliard3d_dofmap_2() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-cahnhilliard3d_dofmap_1::~cahnhilliard3d_dofmap_1()
+cahnhilliard3d_dofmap_2::~cahnhilliard3d_dofmap_2()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* cahnhilliard3d_dofmap_1::signature() const
+const char * cahnhilliard3d_dofmap_2::signature() const
 {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for MixedElement(FiniteElement('Lagrange', tetrahedron, 1), FiniteElement('Lagrange', tetrahedron, 1))";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool cahnhilliard3d_dofmap_1::needs_mesh_entities(std::size_t d) const
+bool cahnhilliard3d_dofmap_2::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
@@ -3731,45 +6935,34 @@ bool cahnhilliard3d_dofmap_1::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t cahnhilliard3d_dofmap_1::topological_dimension() const
-{
-    return 3;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t cahnhilliard3d_dofmap_1::geometric_dimension() const
+std::size_t cahnhilliard3d_dofmap_2::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t cahnhilliard3d_dofmap_1::global_dimension(const std::vector<std::size_t>&
+std::size_t cahnhilliard3d_dofmap_2::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
-    return num_global_entities[0];
+    return 2*num_global_entities[0];
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t cahnhilliard3d_dofmap_1::num_element_dofs() const
+std::size_t cahnhilliard3d_dofmap_2::num_element_dofs() const
 {
-    return 4;
+    return 8;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t cahnhilliard3d_dofmap_1::num_facet_dofs() const
+std::size_t cahnhilliard3d_dofmap_2::num_facet_dofs() const
 {
-    return 3;
+    return 6;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t cahnhilliard3d_dofmap_1::num_entity_dofs(std::size_t d) const
+std::size_t cahnhilliard3d_dofmap_2::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
@@ -3792,19 +6985,24 @@ std::size_t cahnhilliard3d_dofmap_1::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void cahnhilliard3d_dofmap_1::tabulate_dofs(std::size_t* dofs,
+void cahnhilliard3d_dofmap_2::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void cahnhilliard3d_dofmap_1::tabulate_facet_dofs(std::size_t* dofs,
+void cahnhilliard3d_dofmap_2::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
@@ -3814,6 +7012,9 @@ void cahnhilliard3d_dofmap_1::tabulate_facet_dofs(std::size_t* dofs,
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
         break;
       }
     case 1:
@@ -3821,6 +7022,9 @@ void cahnhilliard3d_dofmap_1::tabulate_facet_dofs(std::size_t* dofs,
         dofs[0] = 0;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
         break;
       }
     case 2:
@@ -3828,6 +7032,9 @@ void cahnhilliard3d_dofmap_1::tabulate_facet_dofs(std::size_t* dofs,
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
         break;
       }
     case 3:
@@ -3835,14 +7042,16 @@ void cahnhilliard3d_dofmap_1::tabulate_facet_dofs(std::size_t* dofs,
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
         break;
       }
     }
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void cahnhilliard3d_dofmap_1::tabulate_entity_dofs(std::size_t* dofs,
+void cahnhilliard3d_dofmap_2::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 3)
@@ -3864,21 +7073,25 @@ void cahnhilliard3d_dofmap_1::tabulate_entity_dofs(std::size_t* dofs,
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 4;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 5;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 6;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
+        dofs[1] = 7;
           break;
         }
       }
@@ -3904,68 +7117,58 @@ void cahnhilliard3d_dofmap_1::tabulate_entity_dofs(std::size_t* dofs,
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void cahnhilliard3d_dofmap_1::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
+std::size_t cahnhilliard3d_dofmap_2::num_sub_dofmaps() const
 {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
+    return 2;
 }
 
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t cahnhilliard3d_dofmap_1::num_sub_dofmaps() const
+ufc::dofmap * cahnhilliard3d_dofmap_2::create_sub_dofmap(std::size_t i) const
 {
+    switch (i)
+    {
+    case 0:
+      {
+        return new cahnhilliard3d_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new cahnhilliard3d_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* cahnhilliard3d_dofmap_1::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard3d_dofmap_2::create() const
 {
-    return 0;
+    return new cahnhilliard3d_dofmap_2();
 }
 
-/// Create a new class instance
-ufc::dofmap* cahnhilliard3d_dofmap_1::create() const
-{
-    return new cahnhilliard3d_dofmap_1();
-}
 
-/// Constructor
-cahnhilliard3d_dofmap_2::cahnhilliard3d_dofmap_2() : ufc::dofmap()
+cahnhilliard3d_dofmap_3::cahnhilliard3d_dofmap_3() : ufc::dofmap()
 {
     // Do nothing
 }
 
-/// Destructor
-cahnhilliard3d_dofmap_2::~cahnhilliard3d_dofmap_2()
+cahnhilliard3d_dofmap_3::~cahnhilliard3d_dofmap_3()
 {
     // Do nothing
 }
 
-/// Return a string identifying the dofmap
-const char* cahnhilliard3d_dofmap_2::signature() const
+const char * cahnhilliard3d_dofmap_3::signature() const
 {
-    return "FFC dofmap for MixedElement(FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None), FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None), **{'value_shape': (2,) })";
+    return "FFC dofmap for FiniteElement('Real', tetrahedron, 0)";
 }
 
-/// Return true iff mesh entities of topological dimension d are needed
-bool cahnhilliard3d_dofmap_2::needs_mesh_entities(std::size_t d) const
+bool cahnhilliard3d_dofmap_3::needs_mesh_entities(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -3988,45 +7191,34 @@ bool cahnhilliard3d_dofmap_2::needs_mesh_entities(std::size_t d) const
     return false;
 }
 
-/// Return the topological dimension of the associated cell shape
-std::size_t cahnhilliard3d_dofmap_2::topological_dimension() const
-{
-    return 3;
-}
-
-/// Return the geometric dimension of the associated cell shape
-std::size_t cahnhilliard3d_dofmap_2::geometric_dimension() const
+std::size_t cahnhilliard3d_dofmap_3::topological_dimension() const
 {
     return 3;
 }
 
-/// Return the dimension of the global finite element function space
-std::size_t cahnhilliard3d_dofmap_2::global_dimension(const std::vector<std::size_t>&
+std::size_t cahnhilliard3d_dofmap_3::global_dimension(const std::vector<std::size_t>&
                                             num_global_entities) const
 {
-    return 2*num_global_entities[0];
+    return 1;
 }
 
-/// Return the dimension of the local finite element function space for a cell
-std::size_t cahnhilliard3d_dofmap_2::num_element_dofs() const
+std::size_t cahnhilliard3d_dofmap_3::num_element_dofs() const
 {
-    return 8;
+    return 1;
 }
 
-/// Return the number of dofs on each cell facet
-std::size_t cahnhilliard3d_dofmap_2::num_facet_dofs() const
+std::size_t cahnhilliard3d_dofmap_3::num_facet_dofs() const
 {
-    return 6;
+    return 0;
 }
 
-/// Return the number of dofs associated with each cell entity of dimension d
-std::size_t cahnhilliard3d_dofmap_2::num_entity_dofs(std::size_t d) const
+std::size_t cahnhilliard3d_dofmap_3::num_entity_dofs(std::size_t d) const
 {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 0;
         break;
       }
     case 1:
@@ -4041,7 +7233,7 @@ std::size_t cahnhilliard3d_dofmap_2::num_entity_dofs(std::size_t d) const
       }
     case 3:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -4049,76 +7241,43 @@ std::size_t cahnhilliard3d_dofmap_2::num_entity_dofs(std::size_t d) const
     return 0;
 }
 
-/// Tabulate the local-to-global mapping of dofs on a cell
-void cahnhilliard3d_dofmap_2::tabulate_dofs(std::size_t* dofs,
+void cahnhilliard3d_dofmap_3::tabulate_dofs(std::size_t * dofs,
                                   const std::vector<std::size_t>& num_global_entities,
-                                  const ufc::cell& c) const
+                                  const std::vector<std::vector<std::size_t>>& entity_indices) const
 {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[0][0];
-    dofs[5] = offset + c.entity_indices[0][1];
-    dofs[6] = offset + c.entity_indices[0][2];
-    dofs[7] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
+    dofs[0] = 0;
 }
 
-/// Tabulate the local-to-local mapping from facet dofs to cell dofs
-void cahnhilliard3d_dofmap_2::tabulate_facet_dofs(std::size_t* dofs,
+void cahnhilliard3d_dofmap_3::tabulate_facet_dofs(std::size_t * dofs,
                                         std::size_t facet) const
 {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 5;
-      dofs[4] = 6;
-      dofs[5] = 7;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 6;
-      dofs[5] = 7;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 7;
+        
         break;
       }
     case 3:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 6;
+        
         break;
       }
     }
     
 }
 
-/// Tabulate the local-to-local mapping of dofs on entity (d, i)
-void cahnhilliard3d_dofmap_2::tabulate_entity_dofs(std::size_t* dofs,
+void cahnhilliard3d_dofmap_3::tabulate_entity_dofs(std::size_t * dofs,
                                   std::size_t d, std::size_t i) const
 {
     if (d > 3)
@@ -4130,39 +7289,7 @@ void cahnhilliard3d_dofmap_2::tabulate_entity_dofs(std::size_t* dofs,
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 4;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 5;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 6;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-        dofs[1] = 7;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -4177,103 +7304,58 @@ void cahnhilliard3d_dofmap_2::tabulate_entity_dofs(std::size_t* dofs,
       }
     case 3:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
 }
 
-/// Tabulate the coordinates of all dofs on a cell
-void cahnhilliard3d_dofmap_2::tabulate_coordinates(double* dof_coordinates,
-                                         const double* vertex_coordinates) const
-{
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = vertex_coordinates[6];
-    dof_coordinates[19] = vertex_coordinates[7];
-    dof_coordinates[20] = vertex_coordinates[8];
-    dof_coordinates[21] = vertex_coordinates[9];
-    dof_coordinates[22] = vertex_coordinates[10];
-    dof_coordinates[23] = vertex_coordinates[11];
-}
-
-/// Return the number of sub dofmaps (for a mixed element)
-std::size_t cahnhilliard3d_dofmap_2::num_sub_dofmaps() const
+std::size_t cahnhilliard3d_dofmap_3::num_sub_dofmaps() const
 {
-    return 2;
+    return 0;
 }
 
-/// Create a new dofmap for sub dofmap i (for a mixed element)
-ufc::dofmap* cahnhilliard3d_dofmap_2::create_sub_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard3d_dofmap_3::create_sub_dofmap(std::size_t i) const
 {
-    switch (i)
-    {
-    case 0:
-      {
-        return new cahnhilliard3d_dofmap_1();
-        break;
-      }
-    case 1:
-      {
-        return new cahnhilliard3d_dofmap_1();
-        break;
-      }
-    }
-    
     return 0;
 }
 
-/// Create a new class instance
-ufc::dofmap* cahnhilliard3d_dofmap_2::create() const
+ufc::dofmap * cahnhilliard3d_dofmap_3::create() const
 {
-    return new cahnhilliard3d_dofmap_2();
+    return new cahnhilliard3d_dofmap_3();
 }
 
-/// Constructor
+
 cahnhilliard3d_cell_integral_0_otherwise::cahnhilliard3d_cell_integral_0_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 cahnhilliard3d_cell_integral_0_otherwise::~cahnhilliard3d_cell_integral_0_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & cahnhilliard3d_cell_integral_0_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true, true, true, true, true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void cahnhilliard3d_cell_integral_0_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void cahnhilliard3d_cell_integral_0_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -4311,10 +7393,10 @@ void cahnhilliard3d_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     {0.314372873493192, 0.314372873493192, 0.0568813795204235, 0.314372873493192}};
     
     // Array of non-zero columns
-    static const unsigned int nzc12[4] = {0, 1, 2, 3};
+    static const unsigned int nzc0[4] = {0, 1, 2, 3};
     
     // Array of non-zero columns
-    static const unsigned int nzc16[4] = {4, 5, 6, 7};
+    static const unsigned int nzc4[4] = {4, 5, 6, 7};
     
     static const double FE0_C0_D001[14][2] = \
     {{-1.0, 1.0},
@@ -4333,22 +7415,22 @@ void cahnhilliard3d_cell_integral_0_otherwise::tabulate_tensor(double*  A,
     {-1.0, 1.0}};
     
     // Array of non-zero columns
-    static const unsigned int nzc13[2] = {0, 3};
+    static const unsigned int nzc1[2] = {0, 3};
     
     // Array of non-zero columns
-    static const unsigned int nzc14[2] = {0, 2};
+    static const unsigned int nzc2[2] = {0, 2};
     
     // Array of non-zero columns
-    static const unsigned int nzc15[2] = {0, 1};
+    static const unsigned int nzc3[2] = {0, 1};
     
     // Array of non-zero columns
-    static const unsigned int nzc17[2] = {4, 7};
+    static const unsigned int nzc5[2] = {4, 7};
     
     // Array of non-zero columns
-    static const unsigned int nzc18[2] = {4, 6};
+    static const unsigned int nzc6[2] = {4, 6};
     
     // Array of non-zero columns
-    static const unsigned int nzc19[2] = {4, 5};
+    static const unsigned int nzc7[2] = {4, 5};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 8; r++)
@@ -4404,23 +7486,23 @@ void cahnhilliard3d_cell_integral_0_otherwise::tabulate_tensor(double*  A,
       // Total number of operations to compute function values = 36
       for (unsigned int r = 0; r < 2; r++)
       {
-        F3 += FE0_C0_D001[ip][r]*w[0][nzc15[r]];
-        F4 += FE0_C0_D001[ip][r]*w[0][nzc14[r]];
-        F5 += FE0_C0_D001[ip][r]*w[0][nzc13[r]];
-        F6 += FE0_C0_D001[ip][r]*w[0][nzc19[r]];
-        F7 += FE0_C0_D001[ip][r]*w[0][nzc18[r]];
-        F8 += FE0_C0_D001[ip][r]*w[0][nzc17[r]];
-        F9 += FE0_C0_D001[ip][r]*w[1][nzc19[r]];
-        F10 += FE0_C0_D001[ip][r]*w[1][nzc18[r]];
-        F11 += FE0_C0_D001[ip][r]*w[1][nzc17[r]];
+        F3 += FE0_C0_D001[ip][r]*w[0][nzc3[r]];
+        F4 += FE0_C0_D001[ip][r]*w[0][nzc2[r]];
+        F5 += FE0_C0_D001[ip][r]*w[0][nzc1[r]];
+        F6 += FE0_C0_D001[ip][r]*w[0][nzc7[r]];
+        F7 += FE0_C0_D001[ip][r]*w[0][nzc6[r]];
+        F8 += FE0_C0_D001[ip][r]*w[0][nzc5[r]];
+        F9 += FE0_C0_D001[ip][r]*w[1][nzc7[r]];
+        F10 += FE0_C0_D001[ip][r]*w[1][nzc6[r]];
+        F11 += FE0_C0_D001[ip][r]*w[1][nzc5[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 24
       for (unsigned int r = 0; r < 4; r++)
       {
-        F0 += FE0_C0[ip][r]*w[0][nzc16[r]];
-        F1 += FE0_C0[ip][r]*w[0][nzc12[r]];
-        F2 += FE0_C0[ip][r]*w[1][nzc12[r]];
+        F0 += FE0_C0[ip][r]*w[0][nzc4[r]];
+        F1 += FE0_C0[ip][r]*w[0][nzc0[r]];
+        F2 += FE0_C0[ip][r]*w[1][nzc0[r]];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 65
@@ -4454,58 +7536,55 @@ void cahnhilliard3d_cell_integral_0_otherwise::tabulate_tensor(double*  A,
       for (unsigned int j = 0; j < 2; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc13[j]] += FE0_C0_D001[ip][j]*I[0];
+        A[nzc1[j]] += FE0_C0_D001[ip][j]*I[0];
         // Number of operations to compute entry: 2
-        A[nzc14[j]] += FE0_C0_D001[ip][j]*I[1];
+        A[nzc2[j]] += FE0_C0_D001[ip][j]*I[1];
         // Number of operations to compute entry: 2
-        A[nzc15[j]] += FE0_C0_D001[ip][j]*I[2];
+        A[nzc3[j]] += FE0_C0_D001[ip][j]*I[2];
         // Number of operations to compute entry: 2
-        A[nzc17[j]] += FE0_C0_D001[ip][j]*I[3];
+        A[nzc5[j]] += FE0_C0_D001[ip][j]*I[3];
         // Number of operations to compute entry: 2
-        A[nzc18[j]] += FE0_C0_D001[ip][j]*I[4];
+        A[nzc6[j]] += FE0_C0_D001[ip][j]*I[4];
         // Number of operations to compute entry: 2
-        A[nzc19[j]] += FE0_C0_D001[ip][j]*I[5];
+        A[nzc7[j]] += FE0_C0_D001[ip][j]*I[5];
       } // end loop over 'j'
       
       // Number of operations for primary indices: 16
       for (unsigned int j = 0; j < 4; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc12[j]] += FE0_C0[ip][j]*I[6];
+        A[nzc0[j]] += FE0_C0[ip][j]*I[6];
         // Number of operations to compute entry: 2
-        A[nzc16[j]] += FE0_C0[ip][j]*I[7];
+        A[nzc4[j]] += FE0_C0[ip][j]*I[7];
       } // end loop over 'j'
     } // end loop over 'ip'
 }
 
-/// Constructor
+
 cahnhilliard3d_cell_integral_1_otherwise::cahnhilliard3d_cell_integral_1_otherwise() : ufc::cell_integral()
 {
-    // Do nothing
+    
 }
 
-/// Destructor
 cahnhilliard3d_cell_integral_1_otherwise::~cahnhilliard3d_cell_integral_1_otherwise()
 {
-    // Do nothing
+    
 }
 
-/// Tabulate which form coefficients are used by this integral
 const std::vector<bool> & cahnhilliard3d_cell_integral_1_otherwise::enabled_coefficients() const
 {
     static const std::vector<bool> enabled({true, true, true, true});
     return enabled;
 }
 
-/// Tabulate the tensor for the contribution from a local cell
-void cahnhilliard3d_cell_integral_1_otherwise::tabulate_tensor(double*  A,
-                                    const double * const *  w,
-                                    const double*  vertex_coordinates,
+void cahnhilliard3d_cell_integral_1_otherwise::tabulate_tensor(double * A,
+                                    const double * const * w,
+                                    const double * coordinate_dofs,
                                     int cell_orientation) const
 {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -4543,10 +7622,10 @@ void cahnhilliard3d_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     {0.314372873493192, 0.314372873493192, 0.0568813795204235, 0.314372873493192}};
     
     // Array of non-zero columns
-    static const unsigned int nzc12[4] = {0, 1, 2, 3};
+    static const unsigned int nzc0[4] = {0, 1, 2, 3};
     
     // Array of non-zero columns
-    static const unsigned int nzc16[4] = {4, 5, 6, 7};
+    static const unsigned int nzc4[4] = {4, 5, 6, 7};
     
     static const double FE0_C0_D001[14][2] = \
     {{-1.0, 1.0},
@@ -4565,22 +7644,22 @@ void cahnhilliard3d_cell_integral_1_otherwise::tabulate_tensor(double*  A,
     {-1.0, 1.0}};
     
     // Array of non-zero columns
-    static const unsigned int nzc13[2] = {0, 3};
+    static const unsigned int nzc1[2] = {0, 3};
     
     // Array of non-zero columns
-    static const unsigned int nzc14[2] = {0, 2};
+    static const unsigned int nzc2[2] = {0, 2};
     
     // Array of non-zero columns
-    static const unsigned int nzc15[2] = {0, 1};
+    static const unsigned int nzc3[2] = {0, 1};
     
     // Array of non-zero columns
-    static const unsigned int nzc17[2] = {4, 7};
+    static const unsigned int nzc5[2] = {4, 7};
     
     // Array of non-zero columns
-    static const unsigned int nzc18[2] = {4, 6};
+    static const unsigned int nzc6[2] = {4, 6};
     
     // Array of non-zero columns
-    static const unsigned int nzc19[2] = {4, 5};
+    static const unsigned int nzc7[2] = {4, 5};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 64; r++)
@@ -4619,7 +7698,7 @@ void cahnhilliard3d_cell_integral_1_otherwise::tabulate_tensor(double*  A,
       // Total number of operations to compute function values = 8
       for (unsigned int r = 0; r < 4; r++)
       {
-        F0 += FE0_C0[ip][r]*w[0][nzc12[r]];
+        F0 += FE0_C0[ip][r]*w[0][nzc0[r]];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 18
@@ -4673,41 +7752,41 @@ void cahnhilliard3d_cell_integral_1_otherwise::tabulate_tensor(double*  A,
         for (unsigned int k = 0; k < 2; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc13[j]*8 + nzc17[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[0];
+          A[nzc1[j]*8 + nzc5[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[0];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*8 + nzc18[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[1];
+          A[nzc1[j]*8 + nzc6[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[1];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*8 + nzc19[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[2];
+          A[nzc1[j]*8 + nzc7[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[2];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*8 + nzc17[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[1];
+          A[nzc2[j]*8 + nzc5[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[1];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*8 + nzc18[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[3];
+          A[nzc2[j]*8 + nzc6[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[3];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*8 + nzc19[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[4];
+          A[nzc2[j]*8 + nzc7[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[4];
           // Number of operations to compute entry: 3
-          A[nzc15[j]*8 + nzc17[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[2];
+          A[nzc3[j]*8 + nzc5[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[2];
           // Number of operations to compute entry: 3
-          A[nzc15[j]*8 + nzc18[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[4];
+          A[nzc3[j]*8 + nzc6[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[4];
           // Number of operations to compute entry: 3
-          A[nzc15[j]*8 + nzc19[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[5];
+          A[nzc3[j]*8 + nzc7[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[5];
           // Number of operations to compute entry: 3
-          A[nzc17[j]*8 + nzc13[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[6];
+          A[nzc5[j]*8 + nzc1[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[6];
           // Number of operations to compute entry: 3
-          A[nzc17[j]*8 + nzc14[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[7];
+          A[nzc5[j]*8 + nzc2[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[7];
           // Number of operations to compute entry: 3
-          A[nzc17[j]*8 + nzc15[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[8];
+          A[nzc5[j]*8 + nzc3[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[8];
           // Number of operations to compute entry: 3
-          A[nzc18[j]*8 + nzc13[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[7];
+          A[nzc6[j]*8 + nzc1[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[7];
           // Number of operations to compute entry: 3
-          A[nzc18[j]*8 + nzc14[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[9];
+          A[nzc6[j]*8 + nzc2[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[9];
           // Number of operations to compute entry: 3
-          A[nzc18[j]*8 + nzc15[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[10];
+          A[nzc6[j]*8 + nzc3[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[10];
           // Number of operations to compute entry: 3
-          A[nzc19[j]*8 + nzc13[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[8];
+          A[nzc7[j]*8 + nzc1[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[8];
           // Number of operations to compute entry: 3
-          A[nzc19[j]*8 + nzc14[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[10];
+          A[nzc7[j]*8 + nzc2[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[10];
           // Number of operations to compute entry: 3
-          A[nzc19[j]*8 + nzc15[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[11];
+          A[nzc7[j]*8 + nzc3[k]] += FE0_C0_D001[ip][j]*FE0_C0_D001[ip][k]*I[11];
         } // end loop over 'k'
       } // end loop over 'j'
       
@@ -4717,57 +7796,64 @@ void cahnhilliard3d_cell_integral_1_otherwise::tabulate_tensor(double*  A,
         for (unsigned int k = 0; k < 4; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc12[j]*8 + nzc12[k]] += FE0_C0[ip][j]*FE0_C0[ip][k]*I[12];
+          A[nzc0[j]*8 + nzc0[k]] += FE0_C0[ip][j]*FE0_C0[ip][k]*I[12];
           // Number of operations to compute entry: 3
-          A[nzc16[j]*8 + nzc12[k]] += FE0_C0[ip][j]*FE0_C0[ip][k]*I[13];
+          A[nzc4[j]*8 + nzc0[k]] += FE0_C0[ip][j]*FE0_C0[ip][k]*I[13];
           // Number of operations to compute entry: 3
-          A[nzc16[j]*8 + nzc16[k]] += FE0_C0[ip][j]*FE0_C0[ip][k]*I[12];
+          A[nzc4[j]*8 + nzc4[k]] += FE0_C0[ip][j]*FE0_C0[ip][k]*I[12];
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
 }
 
-/// Constructor
+
 cahnhilliard3d_form_0::cahnhilliard3d_form_0() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 cahnhilliard3d_form_0::~cahnhilliard3d_form_0()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* cahnhilliard3d_form_0::signature() const
+const char * cahnhilliard3d_form_0::signature() const
 {
-    return "c99bedacdb89140447f6fb11076a88d1797617ab5810fff80ddb310b3ac96061d8a283875a26f46c3a1e78fbc73b7fd7465ea8b422408f23dde89fca771a3943";
+    return "d5150d94b3bd09e6ceca9d09afda39e2119a6cb6547ac85205009ca1a593b6fa005a5f402fb19b3374ef1a0dc3c4b03161cd7326b42add38c0d4ee80ec920308";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t cahnhilliard3d_form_0::rank() const
 {
     return 1;
 }
 
-/// Return the number of coefficients (n)
 std::size_t cahnhilliard3d_form_0::num_coefficients() const
 {
     return 5;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t cahnhilliard3d_form_0::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0, 1, 2, 3, 4});
     return position[i];
 }
 
+ufc::finite_element * cahnhilliard3d_form_0::create_coordinate_finite_element() const
+{
+    return new cahnhilliard3d_finite_element_1();
+}
+
+ufc::dofmap * cahnhilliard3d_form_0::create_coordinate_dofmap() const
+{
+    return new cahnhilliard3d_dofmap_1();
+}
+
+ufc::coordinate_mapping * cahnhilliard3d_form_0::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* cahnhilliard3d_form_0::create_finite_element(std::size_t i) const
+ufc::finite_element * cahnhilliard3d_form_0::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
@@ -4788,17 +7874,17 @@ ufc::finite_element* cahnhilliard3d_form_0::create_finite_element(std::size_t i)
       }
     case 3:
       {
-        return new cahnhilliard3d_finite_element_0();
+        return new cahnhilliard3d_finite_element_3();
         break;
       }
     case 4:
       {
-        return new cahnhilliard3d_finite_element_0();
+        return new cahnhilliard3d_finite_element_3();
         break;
       }
     case 5:
       {
-        return new cahnhilliard3d_finite_element_0();
+        return new cahnhilliard3d_finite_element_3();
         break;
       }
     }
@@ -4806,8 +7892,7 @@ ufc::finite_element* cahnhilliard3d_form_0::create_finite_element(std::size_t i)
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* cahnhilliard3d_form_0::create_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard3d_form_0::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
@@ -4828,17 +7913,17 @@ ufc::dofmap* cahnhilliard3d_form_0::create_dofmap(std::size_t i) const
       }
     case 3:
       {
-        return new cahnhilliard3d_dofmap_0();
+        return new cahnhilliard3d_dofmap_3();
         break;
       }
     case 4:
       {
-        return new cahnhilliard3d_dofmap_0();
+        return new cahnhilliard3d_dofmap_3();
         break;
       }
     case 5:
       {
-        return new cahnhilliard3d_dofmap_0();
+        return new cahnhilliard3d_dofmap_3();
         break;
       }
     }
@@ -4846,172 +7931,214 @@ ufc::dofmap* cahnhilliard3d_form_0::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t cahnhilliard3d_form_0::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t cahnhilliard3d_form_0::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t cahnhilliard3d_form_0::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t cahnhilliard3d_form_0::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t cahnhilliard3d_form_0::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t cahnhilliard3d_form_0::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard3d_form_0::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard3d_form_0::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool cahnhilliard3d_form_0::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool cahnhilliard3d_form_0::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool cahnhilliard3d_form_0::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool cahnhilliard3d_form_0::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool cahnhilliard3d_form_0::has_custom_integrals() const
 {
     return false;
 }
 
+bool cahnhilliard3d_form_0::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool cahnhilliard3d_form_0::has_interface_integrals() const
+{
+    return false;
+}
+
+bool cahnhilliard3d_form_0::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * cahnhilliard3d_form_0::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * cahnhilliard3d_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* cahnhilliard3d_form_0::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * cahnhilliard3d_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* cahnhilliard3d_form_0::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * cahnhilliard3d_form_0::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* cahnhilliard3d_form_0::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * cahnhilliard3d_form_0::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* cahnhilliard3d_form_0::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * cahnhilliard3d_form_0::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* cahnhilliard3d_form_0::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * cahnhilliard3d_form_0::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * cahnhilliard3d_form_0::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* cahnhilliard3d_form_0::create_default_cell_integral() const
+ufc::cell_integral * cahnhilliard3d_form_0::create_default_cell_integral() const
 {
     return new cahnhilliard3d_cell_integral_0_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* cahnhilliard3d_form_0::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * cahnhilliard3d_form_0::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * cahnhilliard3d_form_0::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * cahnhilliard3d_form_0::create_default_vertex_integral() const
+{
+    return 0;
+}
+
+ufc::custom_integral * cahnhilliard3d_form_0::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* cahnhilliard3d_form_0::create_default_interior_facet_integral() const
+ufc::cutcell_integral * cahnhilliard3d_form_0::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* cahnhilliard3d_form_0::create_default_vertex_integral() const
+ufc::interface_integral * cahnhilliard3d_form_0::create_default_interface_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* cahnhilliard3d_form_0::create_default_custom_integral() const
+ufc::overlap_integral * cahnhilliard3d_form_0::create_default_overlap_integral() const
 {
     return 0;
 }
 
 
-/// Constructor
 cahnhilliard3d_form_1::cahnhilliard3d_form_1() : ufc::form()
 {
     // Do nothing
 }
 
-/// Destructor
 cahnhilliard3d_form_1::~cahnhilliard3d_form_1()
 {
     // Do nothing
 }
 
-/// Return a string identifying the form
-const char* cahnhilliard3d_form_1::signature() const
+const char * cahnhilliard3d_form_1::signature() const
 {
-    return "6ba86e6f9cc2b13cff9b029731e43789c7876b31ca945d316589dfb985a4f52baefe5317f9eb1e527c009fdb4c6fc40a9f702df3ce723ef8e2d39d57a8a5f8a5";
+    return "de362a73f656f9a69f43f8ea0ac2637021186cefce4f5df9cdea5cf77244d9d3d7e3d75c3ccea2ab95617742c41b0ec432c2935ce380d50bc73ff73f86e77398";
 }
 
-
-/// Return the rank of the global tensor (r)
 std::size_t cahnhilliard3d_form_1::rank() const
 {
     return 2;
 }
 
-/// Return the number of coefficients (n)
 std::size_t cahnhilliard3d_form_1::num_coefficients() const
 {
     return 4;
 }
 
-/// Return original coefficient position for each coefficient (0 <= i < n)
 std::size_t cahnhilliard3d_form_1::original_coefficient_position(std::size_t i) const
 {
     static const std::vector<std::size_t> position({0, 2, 3, 4});
     return position[i];
 }
 
+ufc::finite_element * cahnhilliard3d_form_1::create_coordinate_finite_element() const
+{
+    return new cahnhilliard3d_finite_element_1();
+}
+
+ufc::dofmap * cahnhilliard3d_form_1::create_coordinate_dofmap() const
+{
+    return new cahnhilliard3d_dofmap_1();
+}
+
+ufc::coordinate_mapping * cahnhilliard3d_form_1::create_coordinate_mapping() const
+{
+    return nullptr;
+}
 
-/// Create a new finite element for argument function i
-ufc::finite_element* cahnhilliard3d_form_1::create_finite_element(std::size_t i) const
+ufc::finite_element * cahnhilliard3d_form_1::create_finite_element(std::size_t i) const
 {
     switch (i)
     {
@@ -5032,17 +8159,17 @@ ufc::finite_element* cahnhilliard3d_form_1::create_finite_element(std::size_t i)
       }
     case 3:
       {
-        return new cahnhilliard3d_finite_element_0();
+        return new cahnhilliard3d_finite_element_3();
         break;
       }
     case 4:
       {
-        return new cahnhilliard3d_finite_element_0();
+        return new cahnhilliard3d_finite_element_3();
         break;
       }
     case 5:
       {
-        return new cahnhilliard3d_finite_element_0();
+        return new cahnhilliard3d_finite_element_3();
         break;
       }
     }
@@ -5050,8 +8177,7 @@ ufc::finite_element* cahnhilliard3d_form_1::create_finite_element(std::size_t i)
     return 0;
 }
 
-/// Create a new dofmap for argument function i
-ufc::dofmap* cahnhilliard3d_form_1::create_dofmap(std::size_t i) const
+ufc::dofmap * cahnhilliard3d_form_1::create_dofmap(std::size_t i) const
 {
     switch (i)
     {
@@ -5072,17 +8198,17 @@ ufc::dofmap* cahnhilliard3d_form_1::create_dofmap(std::size_t i) const
       }
     case 3:
       {
-        return new cahnhilliard3d_dofmap_0();
+        return new cahnhilliard3d_dofmap_3();
         break;
       }
     case 4:
       {
-        return new cahnhilliard3d_dofmap_0();
+        return new cahnhilliard3d_dofmap_3();
         break;
       }
     case 5:
       {
-        return new cahnhilliard3d_dofmap_0();
+        return new cahnhilliard3d_dofmap_3();
         break;
       }
     }
@@ -5090,128 +8216,163 @@ ufc::dofmap* cahnhilliard3d_form_1::create_dofmap(std::size_t i) const
     return 0;
 }
 
-
-/// Return the number of cell domains
 std::size_t cahnhilliard3d_form_1::max_cell_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of exterior facet domains
 std::size_t cahnhilliard3d_form_1::max_exterior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of interior facet domains
 std::size_t cahnhilliard3d_form_1::max_interior_facet_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of vertex domains
 std::size_t cahnhilliard3d_form_1::max_vertex_subdomain_id() const
 {
     return 0;
 }
 
-/// Return the number of custom domains
 std::size_t cahnhilliard3d_form_1::max_custom_subdomain_id() const
 {
     return 0;
 }
 
+std::size_t cahnhilliard3d_form_1::max_cutcell_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard3d_form_1::max_interface_subdomain_id() const
+{
+    return 0;
+}
+
+std::size_t cahnhilliard3d_form_1::max_overlap_subdomain_id() const
+{
+    return 0;
+}
 
-/// Return whether the form has any cell integrals
 bool cahnhilliard3d_form_1::has_cell_integrals() const
 {
     return true;
 }
 
-/// Return whether the form has any exterior facet integrals
 bool cahnhilliard3d_form_1::has_exterior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any interior facet integrals
 bool cahnhilliard3d_form_1::has_interior_facet_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any vertex integrals
 bool cahnhilliard3d_form_1::has_vertex_integrals() const
 {
     return false;
 }
 
-/// Return whether the form has any custom integrals
 bool cahnhilliard3d_form_1::has_custom_integrals() const
 {
     return false;
 }
 
+bool cahnhilliard3d_form_1::has_cutcell_integrals() const
+{
+    return false;
+}
+
+bool cahnhilliard3d_form_1::has_interface_integrals() const
+{
+    return false;
+}
+
+bool cahnhilliard3d_form_1::has_overlap_integrals() const
+{
+    return false;
+}
+
+ufc::cell_integral * cahnhilliard3d_form_1::create_cell_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
+
+ufc::exterior_facet_integral * cahnhilliard3d_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on sub domain subdomain_id
-ufc::cell_integral* cahnhilliard3d_form_1::create_cell_integral(std::size_t subdomain_id) const
+ufc::interior_facet_integral * cahnhilliard3d_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new exterior facet integral on sub domain subdomain_id
-ufc::exterior_facet_integral* cahnhilliard3d_form_1::create_exterior_facet_integral(std::size_t subdomain_id) const
+ufc::vertex_integral * cahnhilliard3d_form_1::create_vertex_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on sub domain subdomain_id
-ufc::interior_facet_integral* cahnhilliard3d_form_1::create_interior_facet_integral(std::size_t subdomain_id) const
+ufc::custom_integral * cahnhilliard3d_form_1::create_custom_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new vertex integral on sub domain subdomain_id
-ufc::vertex_integral* cahnhilliard3d_form_1::create_vertex_integral(std::size_t subdomain_id) const
+ufc::cutcell_integral * cahnhilliard3d_form_1::create_cutcell_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
-/// Create a new custom integral on sub domain subdomain_id
-ufc::custom_integral* cahnhilliard3d_form_1::create_custom_integral(std::size_t subdomain_id) const
+ufc::interface_integral * cahnhilliard3d_form_1::create_interface_integral(std::size_t subdomain_id) const
 {
     return 0;
 }
 
+ufc::overlap_integral * cahnhilliard3d_form_1::create_overlap_integral(std::size_t subdomain_id) const
+{
+    return 0;
+}
 
-/// Create a new cell integral on everywhere else
-ufc::cell_integral* cahnhilliard3d_form_1::create_default_cell_integral() const
+ufc::cell_integral * cahnhilliard3d_form_1::create_default_cell_integral() const
 {
     return new cahnhilliard3d_cell_integral_1_otherwise();
 }
 
-/// Create a new exterior facet integral on everywhere else
-ufc::exterior_facet_integral* cahnhilliard3d_form_1::create_default_exterior_facet_integral() const
+ufc::exterior_facet_integral * cahnhilliard3d_form_1::create_default_exterior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::interior_facet_integral * cahnhilliard3d_form_1::create_default_interior_facet_integral() const
+{
+    return 0;
+}
+
+ufc::vertex_integral * cahnhilliard3d_form_1::create_default_vertex_integral() const
 {
     return 0;
 }
 
-/// Create a new interior facet integral on everywhere else
-ufc::interior_facet_integral* cahnhilliard3d_form_1::create_default_interior_facet_integral() const
+ufc::custom_integral * cahnhilliard3d_form_1::create_default_custom_integral() const
 {
     return 0;
 }
 
-/// Create a new vertex integral on everywhere else
-ufc::vertex_integral* cahnhilliard3d_form_1::create_default_vertex_integral() const
+ufc::cutcell_integral * cahnhilliard3d_form_1::create_default_cutcell_integral() const
 {
     return 0;
 }
 
-/// Create a new custom integral on everywhere else
-ufc::custom_integral* cahnhilliard3d_form_1::create_default_custom_integral() const
+ufc::interface_integral * cahnhilliard3d_form_1::create_default_interface_integral() const
 {
     return 0;
 }
 
+ufc::overlap_integral * cahnhilliard3d_form_1::create_default_overlap_integral() const
+{
+    return 0;
+}
 
diff --git a/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.h b/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.h
index 5aaaa86..e0a88af 100644
--- a/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.h
+++ b/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,918 +13,901 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          True
 
 #ifndef __CAHNHILLIARD3D_H
 #define __CAHNHILLIARD3D_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class cahnhilliard3d_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_finite_element_0();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_finite_element_0();
+  ~cahnhilliard3d_finite_element_0() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t value_rank() const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t value_size() const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t reference_value_size() const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a finite element.
 
 class cahnhilliard3d_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_finite_element_1();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_finite_element_1();
+  ~cahnhilliard3d_finite_element_1() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_size() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_size() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t degree() const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a finite element.
 
 class cahnhilliard3d_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_finite_element_2();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_finite_element_2();
+  ~cahnhilliard3d_finite_element_2() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const;
+  std::size_t value_dimension(std::size_t i) const final override;
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const;
+  std::size_t value_size() const final override;
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t reference_value_rank() const final override;
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t reference_value_dimension(std::size_t i) const final override;
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const;
+  std::size_t reference_value_size() const final override;
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const;
+  std::size_t degree() const final override;
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const;
+  const char * family() const final override;
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation);
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation);
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation);
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation);
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
+
+};
+
+
+class cahnhilliard3d_finite_element_3: public ufc::finite_element
+{
+public:
+
+  cahnhilliard3d_finite_element_3();
+
+  ~cahnhilliard3d_finite_element_3() override;
+
+  const char * signature() const final override;
+
+  ufc::shape cell_shape() const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t geometric_dimension() const final override;
+
+  std::size_t space_dimension() const final override;
+
+  std::size_t value_rank() const final override;
+
+  std::size_t value_dimension(std::size_t i) const final override;
+
+  std::size_t value_size() const final override;
+
+  std::size_t reference_value_rank() const final override;
+
+  std::size_t reference_value_dimension(std::size_t i) const final override;
+
+  std::size_t reference_value_size() const final override;
+
+  std::size_t degree() const final override;
+
+  const char * family() const final override;
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation);
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation);
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation);
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation);
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const;
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const;
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const;
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const;
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const;
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const;
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const;
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const;
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override;
+
+  void evaluate_dofs(double * values,
+                     const ufc::function& f,
+                     const double * coordinate_dofs,
+                     int cell_orientation,
+                     const ufc::cell& c) const final override;
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override;
+
+  void tabulate_dof_coordinates(double * coordinates,
+                                const double * coordinate_dofs) const final override;
+
+  std::size_t num_sub_elements() const final override;
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override;
+
+  ufc::finite_element * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class cahnhilliard3d_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_dofmap_0();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_dofmap_0();
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  ~cahnhilliard3d_dofmap_0() override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  const char * signature() const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  std::size_t topological_dimension() const final override;
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t num_sub_dofmaps() const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  ufc::dofmap * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class cahnhilliard3d_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_dofmap_1();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_dofmap_1();
+  ~cahnhilliard3d_dofmap_1() override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  const char * signature() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  std::size_t topological_dimension() const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  std::size_t num_element_dofs() const final override;
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  std::size_t num_sub_dofmaps() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  ufc::dofmap * create() const final override;
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class cahnhilliard3d_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_dofmap_2();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_dofmap_2();
+  ~cahnhilliard3d_dofmap_2() override;
+
+  const char * signature() const final override;
+
+  bool needs_mesh_entities(std::size_t d) const final override;
+
+  std::size_t topological_dimension() const final override;
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
+
+  std::size_t num_element_dofs() const final override;
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const;
+  std::size_t num_facet_dofs() const final override;
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const;
+  std::size_t num_entity_dofs(std::size_t d) const final override;
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const;
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const;
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const;
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const;
+  std::size_t num_sub_dofmaps() const final override;
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const;
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const;
+  ufc::dofmap * create() const final override;
+
+};
+
+
+class cahnhilliard3d_dofmap_3: public ufc::dofmap
+{
+public:
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const;
+  cahnhilliard3d_dofmap_3();
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const;
+  ~cahnhilliard3d_dofmap_3() override;
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const;
+  const char * signature() const final override;
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* coordinates,
-                                    const double* vertex_coordinates) const;
+  bool needs_mesh_entities(std::size_t d) const final override;
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const;
+  std::size_t topological_dimension() const final override;
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const;
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override;
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const;
+  std::size_t num_element_dofs() const final override;
+
+  std::size_t num_facet_dofs() const final override;
+
+  std::size_t num_entity_dofs(std::size_t d) const final override;
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override;
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override;
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override;
+
+  std::size_t num_sub_dofmaps() const final override;
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override;
+
+  ufc::dofmap * create() const final override;
 
 };
 
-/// 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 cahnhilliard3d_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_cell_integral_0_otherwise();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_cell_integral_0_otherwise();
+  ~cahnhilliard3d_cell_integral_0_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// 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 cahnhilliard3d_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_cell_integral_1_otherwise();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_cell_integral_1_otherwise();
+  ~cahnhilliard3d_cell_integral_1_otherwise() override;
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const;
+  const std::vector<bool> & enabled_coefficients() const final override;
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const;
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override;
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class cahnhilliard3d_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_form_0();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_form_0();
+  ~cahnhilliard3d_form_0() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
 
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
+  bool has_vertex_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  bool has_cutcell_integrals() const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
+
+  ufc::custom_integral * create_default_custom_integral() const final override;
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
+
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class cahnhilliard3d_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   cahnhilliard3d_form_1();
 
-  /// Destructor
-  virtual ~cahnhilliard3d_form_1();
+  ~cahnhilliard3d_form_1() override;
+
+  const char * signature() const final override;
+
+  std::size_t rank() const final override;
+
+  std::size_t num_coefficients() const final override;
+
+  std::size_t original_coefficient_position(std::size_t i) const final override;
+
+  ufc::finite_element * create_coordinate_finite_element() const final override;
+
+  ufc::dofmap * create_coordinate_dofmap() const final override;
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override;
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override;
+
+  ufc::dofmap * create_dofmap(std::size_t i) const final override;
 
-  /// Return a string identifying the form
-  virtual const char* signature() const;
+  std::size_t max_cell_subdomain_id() const final override;
 
+  std::size_t max_exterior_facet_subdomain_id() const final override;
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const;
+  std::size_t max_interior_facet_subdomain_id() const final override;
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const;
+  std::size_t max_vertex_subdomain_id() const final override;
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const;
+  std::size_t max_custom_subdomain_id() const final override;
 
+  std::size_t max_cutcell_subdomain_id() const final override;
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const;
+  std::size_t max_interface_subdomain_id() const final override;
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const;
+  std::size_t max_overlap_subdomain_id() const final override;
 
+  bool has_cell_integrals() const final override;
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const;
+  bool has_exterior_facet_integrals() const final override;
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const;
+  bool has_interior_facet_integrals() const final override;
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const;
+  bool has_vertex_integrals() const final override;
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const;
+  bool has_custom_integrals() const final override;
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const;
+  bool has_cutcell_integrals() const final override;
 
+  bool has_interface_integrals() const final override;
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const;
+  bool has_overlap_integrals() const final override;
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const;
+  ufc::cell_integral * create_cell_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const;
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const;
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t i) const final override;
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const;
+  ufc::vertex_integral * create_vertex_integral(std::size_t i) const final override;
 
+  ufc::custom_integral * create_custom_integral(std::size_t i) const final override;
 
-  /// Create a new cell integral on sub domain i
-  virtual ufc::cell_integral* create_cell_integral(std::size_t i) const;
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t i) const final override;
 
-  /// Create a new exterior facet integral on sub domain i
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const;
+  ufc::interface_integral * create_interface_integral(std::size_t i) const final override;
 
-  /// Create a new interior facet integral on sub domain i
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const;
+  ufc::overlap_integral * create_overlap_integral(std::size_t i) const final override;
 
-  /// Create a new vertex integral on sub domain i
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t i) const;
+  ufc::cell_integral * create_default_cell_integral() const final override;
 
-  /// Create a new custom integral on sub domain i
-  virtual ufc::custom_integral* create_custom_integral(std::size_t i) const;
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override;
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override;
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const;
+  ufc::vertex_integral * create_default_vertex_integral() const final override;
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const;
+  ufc::custom_integral * create_default_custom_integral() const final override;
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const;
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override;
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const;
+  ufc::interface_integral * create_default_interface_integral() const final override;
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override;
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const;
 };
 
 // DOLFIN wrappers
@@ -934,14 +917,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace CahnHilliard3D
 {
@@ -950,43 +939,20 @@ class CoefficientSpace_dt: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_dt(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_dt(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_dt(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_dt(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -997,43 +963,20 @@ class CoefficientSpace_lmbda: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1044,43 +987,20 @@ class CoefficientSpace_theta: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_theta(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_theta(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_theta(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_theta(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1091,43 +1011,20 @@ class CoefficientSpace_u: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1138,43 +1035,20 @@ class CoefficientSpace_u0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1185,45 +1059,42 @@ class Form_F_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_F_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_F_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_F_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -1243,19 +1114,19 @@ class Form_F: public dolfin::Form
 public:
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_0());
+    _ufc_form = std::make_shared<const cahnhilliard3d_form_0>();
   }
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& dt, const dolfin::GenericFunction& theta):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
     dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->u = u;
     this->u0 = u0;
@@ -1263,65 +1134,122 @@ public:
     this->dt = dt;
     this->theta = theta;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_0());
+    _ufc_form = std::make_shared<const cahnhilliard3d_form_0>();
   }
 
-  // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
-    dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
+  // Destructor
+  ~Form_F()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    if (name == "u")
+      return 0;
+    else if (name == "u0")
+      return 1;
+    else if (name == "lmbda")
+      return 2;
+    else if (name == "dt")
+      return 3;
+    else if (name == "theta")
+      return 4;
 
-    this->u = *u;
-    this->u0 = *u0;
-    this->lmbda = *lmbda;
-    this->dt = *dt;
-    this->theta = *theta;
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_0());
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "u";
+    case 1:
+      return "u0";
+    case 2:
+      return "lmbda";
+    case 3:
+      return "dt";
+    case 4:
+      return "theta";
+    }
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_F_FunctionSpace_1 CoefficientSpace_u;
+  typedef Form_F_FunctionSpace_2 CoefficientSpace_u0;
+  typedef Form_F_FunctionSpace_3 CoefficientSpace_lmbda;
+  typedef Form_F_FunctionSpace_4 CoefficientSpace_dt;
+  typedef Form_F_FunctionSpace_5 CoefficientSpace_theta;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+  dolfin::CoefficientAssigner u0;
+  dolfin::CoefficientAssigner lmbda;
+  dolfin::CoefficientAssigner dt;
+  dolfin::CoefficientAssigner theta;
+};
+
+class MultiMeshForm_F: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_0());
   }
 
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& dt, const dolfin::GenericFunction& theta):
-    dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
+    dolfin::MultiMeshForm(V0), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
+    /// Assign coefficients
     this->u = u;
     this->u0 = u0;
     this->lmbda = lmbda;
     this->dt = dt;
     this->theta = theta;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_0());
-  }
-
-  // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
-    dolfin::Form(1, 5), u(*this, 0), u0(*this, 1), lmbda(*this, 2), dt(*this, 3), theta(*this, 4)
-  {
-    _function_spaces[0] = V0;
-
-    this->u = *u;
-    this->u0 = *u0;
-    this->lmbda = *lmbda;
-    this->dt = *dt;
-    this->theta = *theta;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_0());
   }
 
   // Destructor
-  ~Form_F()
+  ~MultiMeshForm_F()
   {}
 
   /// Return the number of the coefficient with this name
@@ -1369,6 +1297,7 @@ public:
 
   // Typedefs
   typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_F_FunctionSpace_1 CoefficientSpace_u;
   typedef Form_F_FunctionSpace_2 CoefficientSpace_u0;
   typedef Form_F_FunctionSpace_3 CoefficientSpace_lmbda;
@@ -1376,54 +1305,31 @@ public:
   typedef Form_F_FunctionSpace_5 CoefficientSpace_theta;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
-  dolfin::CoefficientAssigner u0;
-  dolfin::CoefficientAssigner lmbda;
-  dolfin::CoefficientAssigner dt;
-  dolfin::CoefficientAssigner theta;
+  dolfin::MultiMeshCoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner u0;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner dt;
+  dolfin::MultiMeshCoefficientAssigner theta;
 };
 
 class Form_J_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1434,45 +1340,62 @@ class Form_J_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<cahnhilliard3d_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<cahnhilliard3d_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_J_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new cahnhilliard3d_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new cahnhilliard3d_dofmap_2()), *mesh, constrained_domain)))
+};
+
+class Form_J_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -1490,87 +1413,138 @@ class Form_J: public dolfin::Form
 public:
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_1());
+    _ufc_form = std::make_shared<const cahnhilliard3d_form_1>();
   }
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& dt, const dolfin::GenericFunction& theta):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
     dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->u = u;
     this->lmbda = lmbda;
     this->dt = dt;
     this->theta = theta;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_1());
+    _ufc_form = std::make_shared<const cahnhilliard3d_form_1>();
   }
 
-  // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
-    dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_J()
+  {}
 
-    this->u = *u;
-    this->lmbda = *lmbda;
-    this->dt = *dt;
-    this->theta = *theta;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "u")
+      return 0;
+    else if (name == "lmbda")
+      return 1;
+    else if (name == "dt")
+      return 2;
+    else if (name == "theta")
+      return 3;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "u";
+    case 1:
+      return "lmbda";
+    case 2:
+      return "dt";
+    case 3:
+      return "theta";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_J_FunctionSpace_0 TestSpace;
+  typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
+  typedef Form_J_FunctionSpace_3 CoefficientSpace_lmbda;
+  typedef Form_J_FunctionSpace_4 CoefficientSpace_dt;
+  typedef Form_J_FunctionSpace_5 CoefficientSpace_theta;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+  dolfin::CoefficientAssigner lmbda;
+  dolfin::CoefficientAssigner dt;
+  dolfin::CoefficientAssigner theta;
+};
+
+class MultiMeshForm_J: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& dt, const dolfin::GenericFunction& theta):
-    dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->u = u;
-    this->lmbda = lmbda;
-    this->dt = dt;
-    this->theta = theta;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_1());
   }
 
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
-    dolfin::Form(2, 4), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> dt, std::shared_ptr<const dolfin::GenericFunction> theta):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), lmbda(*this, 1), dt(*this, 2), theta(*this, 3)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->u = *u;
-    this->lmbda = *lmbda;
-    this->dt = *dt;
-    this->theta = *theta;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->u = u;
+    this->lmbda = lmbda;
+    this->dt = dt;
+    this->theta = theta;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new cahnhilliard3d_form_1());
   }
 
   // Destructor
-  ~Form_J()
+  ~MultiMeshForm_J()
   {}
 
   /// Return the number of the coefficient with this name
@@ -1615,24 +1589,31 @@ public:
   // Typedefs
   typedef Form_J_FunctionSpace_0 TestSpace;
   typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
   typedef Form_J_FunctionSpace_3 CoefficientSpace_lmbda;
   typedef Form_J_FunctionSpace_4 CoefficientSpace_dt;
   typedef Form_J_FunctionSpace_5 CoefficientSpace_theta;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
-  dolfin::CoefficientAssigner lmbda;
-  dolfin::CoefficientAssigner dt;
-  dolfin::CoefficientAssigner theta;
+  dolfin::MultiMeshCoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner dt;
+  dolfin::MultiMeshCoefficientAssigner theta;
 };
 
 // Class typedefs
 typedef Form_J BilinearForm;
+typedef MultiMeshForm_J MultiMeshBilinearForm;
 typedef Form_J JacobianForm;
+typedef MultiMeshForm_J MultiMeshJacobianForm;
 typedef Form_F LinearForm;
+typedef MultiMeshForm_F MultiMeshLinearForm;
 typedef Form_F ResidualForm;
+typedef MultiMeshForm_F MultiMeshResidualForm;
 typedef Form_F::TestSpace FunctionSpace;
+typedef Form_F::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.ufl b/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.ufl
index e4c6dab..5fd82b3 100644
--- a/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.ufl
+++ b/demo/documented/cahn-hilliard/cpp/CahnHilliard3D.ufl
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2006-2014 Garth N. Wells
 #
 # This file is part of DOLFIN.
@@ -16,7 +17,7 @@
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
 # Modified by Anders Logg 2011
-# Modified by Martin Alnaes 2014
+# Modified by Martin Alnæs 2014
 #
 # The linearised bilinear form a(du, v) and linear form L(v) for
 # the Cahn-Hilliard equation.
diff --git a/demo/documented/cahn-hilliard/cpp/compile.log b/demo/documented/cahn-hilliard/cpp/compile.log
index c7d195f..83bed4f 100644
--- a/demo/documented/cahn-hilliard/cpp/compile.log
+++ b/demo/documented/cahn-hilliard/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form CahnHilliard3D
 
@@ -12,8 +13,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    5
   Coefficients:              '[w_0, w_1, w_2, w_3, w_4]'
-  Unique elements:           'Mixed<CG1(?), CG1(?)>, R0(?)'
-  Unique sub elements:       'Mixed<CG1(?), CG1(?)>, R0(?), CG1(?)'
+  Unique elements:           'Mixed<CG1(?), CG1(?)>, R0(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'Mixed<CG1(?), CG1(?)>, R0(?), Vector<3 x CG1(?)>, CG1(
+                             ?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -90,9 +92,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 5
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -100,8 +102,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    4
   Coefficients:              '[w_0, w_2, w_3, w_4]'
-  Unique elements:           'Mixed<CG1(?), CG1(?)>, R0(?)'
-  Unique sub elements:       'Mixed<CG1(?), CG1(?)>, R0(?), CG1(?)'
+  Unique elements:           'Mixed<CG1(?), CG1(?)>, R0(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'Mixed<CG1(?), CG1(?)>, R0(?), Vector<3 x CG1(?)>, CG1(
+                             ?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -186,25 +189,36 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.11376 seconds.
+Compiler stage 1 finished in 0.200224 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 3 elements
+  Computing representation of 4 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Computing representation of 4 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -214,92 +228,46 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Reusing element from cache
   
   QG-utils, psi_tables:
-  {14: {FiniteElement('Real', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-           1.]])}}}, VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+  {14: {MixedElement(FiniteElement('Lagrange', tetrahedron, 1), FiniteElement('Lagrange', tetrahedron, 1)): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
            -1.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
             1.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
           [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
            -1.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
           [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
             1.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]]]), (0, 1, 0): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
@@ -309,11 +277,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
@@ -325,11 +288,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
@@ -341,75 +299,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
-            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
-            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
-            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
-            -1.11022302e-16,  -1.66533454e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -421,11 +310,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -433,11 +317,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
           [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
@@ -449,11 +328,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
           [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
             -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
             -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
@@ -465,11 +339,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
           [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
@@ -485,11 +354,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]]]), (0, 0, 0): array([[[  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
              5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
              1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
@@ -499,11 +363,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
@@ -515,11 +374,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
@@ -531,11 +385,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
@@ -547,11 +396,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -563,12 +407,7 @@ Compiler stage 2: Computing intermediate representation
              5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
              1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
              1.00526765e-01,   3.14372873e-01,   5.68813795e-02,
-             3.14372873e-01,   3.14372873e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
+             3.14372873e-01,   3.14372873e-01]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -579,12 +418,7 @@ Compiler stage 2: Computing intermediate representation
              5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
              6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
              1.00526765e-01,   5.68813795e-02,   3.14372873e-01,
-             3.14372873e-01,   3.14372873e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
+             3.14372873e-01,   3.14372873e-01]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -595,12 +429,7 @@ Compiler stage 2: Computing intermediate representation
             -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
              1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
              6.98419704e-01,   3.14372873e-01,   3.14372873e-01,
-             3.14372873e-01,   5.68813795e-02],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
+             3.14372873e-01,   5.68813795e-02]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -611,76 +440,176 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
              1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
              1.00526765e-01,   3.14372873e-01,   3.14372873e-01,
-             5.68813795e-02,   3.14372873e-01],
+             5.68813795e-02,   3.14372873e-01]]]), (0, 0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
+             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
+             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
+             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
+             1.11022302e-16,  -1.11022302e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
+             0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
+             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+             5.55111512e-17,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
-             5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
-             1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
-             1.00526765e-01,   3.14372873e-01,   5.68813795e-02,
-             3.14372873e-01,   3.14372873e-01]],
+             0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-             5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
-             6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
-             1.00526765e-01,   5.68813795e-02,   3.14372873e-01,
-             3.14372873e-01,   3.14372873e-01]],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
-            -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
-             1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
-             6.98419704e-01,   3.14372873e-01,   3.14372873e-01,
-             3.14372873e-01,   5.68813795e-02]],
+          [ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
+             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
+             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
+             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
+             1.11022302e-16,  -1.11022302e-16]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+          [ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
+             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+             5.55111512e-17,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-             1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
-             1.00526765e-01,   3.14372873e-01,   3.14372873e-01,
-             5.68813795e-02,   3.14372873e-01]]]), (0, 0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00]]])}}}, FiniteElement('Real', tetrahedron, 0): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+           1.]])}}}, VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]]]), (0, 1, 0): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
@@ -696,11 +625,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
-             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
-             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
-             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
-             1.11022302e-16,  -1.11022302e-16],
+         [[ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
+            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
+            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
+            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
+            -1.11022302e-16,  -1.66533454e-16],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -712,11 +641,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
-             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
-             5.55111512e-17,   0.00000000e+00],
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -728,11 +657,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00],
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -765,11 +694,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
-             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
-             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
-             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
-             1.11022302e-16,  -1.11022302e-16],
+          [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
+            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
+            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
+            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
+            -1.11022302e-16,  -1.66533454e-16],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -781,11 +710,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
-             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
-             5.55111512e-17,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -797,11 +726,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -834,11 +763,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
-             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
-             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
-             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
-             1.11022302e-16,  -1.11022302e-16]],
+          [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
+            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
+            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
+            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
+            -1.11022302e-16,  -1.66533454e-16]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -850,11 +779,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
-             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
-             5.55111512e-17,   0.00000000e+00]],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -866,85 +795,35 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00]]])}}}, MixedElement(*[FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (2,) }): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]]]), (0, 1, 0): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
-            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
-            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
-            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
-            -1.11022302e-16,  -1.66533454e-16],
+             0.00000000e+00,   0.00000000e+00]]]), (0, 0, 0): array([[[  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
+             5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
+             1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
+             1.00526765e-01,   3.14372873e-01,   5.68813795e-02,
+             3.14372873e-01,   3.14372873e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00],
+         [[  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
+             5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
+             6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
+             1.00526765e-01,   5.68813795e-02,   3.14372873e-01,
+             3.14372873e-01,   3.14372873e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -952,49 +831,44 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
+            -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
+             1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
+             6.98419704e-01,   3.14372873e-01,   3.14372873e-01,
+             3.14372873e-01,   5.68813795e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
-            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
-            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
-            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
-            -1.11022302e-16,  -1.66533454e-16]],
+             0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+             1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
+             1.00526765e-01,   3.14372873e-01,   3.14372873e-01,
+             5.68813795e-02,   3.14372873e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]]]), (0, 0, 0): array([[[  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
+             0.00000000e+00,   0.00000000e+00],
+          [  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
              5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
              1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
              1.00526765e-01,   3.14372873e-01,   5.68813795e-02,
@@ -1005,7 +879,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
              5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
              6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
              1.00526765e-01,   5.68813795e-02,   3.14372873e-01,
@@ -1016,7 +895,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
             -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
              1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
              6.98419704e-01,   3.14372873e-01,   3.14372873e-01,
@@ -1027,7 +911,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
              1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
              1.00526765e-01,   3.14372873e-01,   3.14372873e-01,
@@ -1043,6 +932,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
              5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
              1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
@@ -1054,6 +948,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
              5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
              6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
@@ -1065,6 +964,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
             -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
              1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
@@ -1076,6 +980,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
              1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
@@ -1089,6 +998,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
@@ -1100,6 +1014,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
@@ -1111,6 +1030,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
@@ -1122,6 +1046,75 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
+             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
+             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
+             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
+             1.11022302e-16,  -1.11022302e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
+             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+             5.55111512e-17,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1129,6 +1122,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
@@ -1140,6 +1138,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
              1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
              1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
@@ -1151,6 +1154,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
              5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
              5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
@@ -1162,6 +1170,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
@@ -1169,117 +1182,89 @@ Compiler stage 2: Computing intermediate representation
              1.00000000e+00,   1.00000000e+00]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
+  {'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
+           -1.11022302e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1334,238 +1319,319 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
+            5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
+           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
+           -2.77555756e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
+           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
+            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
+            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
+            1.00526765e-01,   6.98419704e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
+            6.98419704e-01,   1.00526765e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
+            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
+            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
+            3.14372873e-01,   5.68813795e-02,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
+            5.68813795e-02,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
+            6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+         [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
+            5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+         [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+            0.00000000e+00,   5.00000000e-01,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   9.71445147e-17,
+            5.00000000e-01,  -2.77555756e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.93889390e-17,
+            5.00000000e-01,   5.00000000e-01,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+            5.00000000e-01,  -2.77555756e-17,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+           -1.38777878e-17,   5.00000000e-01,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+            1.38777878e-17,  -2.77555756e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            6.98419704e-01,   1.00526765e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.98419704e-01,
+            1.00526765e-01,   1.00526765e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            1.00526765e-01,   1.00526765e-01,   6.98419704e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            1.00526765e-01,   6.98419704e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            5.68813795e-02,   3.14372873e-01,   3.14372873e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.68813795e-02,
+            3.14372873e-01,   3.14372873e-01,   3.14372873e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            3.14372873e-01,   3.14372873e-01,   5.68813795e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            3.14372873e-01,   5.68813795e-02,   3.14372873e-01]]), 'FE2_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1620,115 +1686,62 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
-            5.00000000e-01,   5.00000000e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
-           -2.77555756e-17,   5.00000000e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-           -2.77555756e-17,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
-            5.00000000e-01,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
-           -2.77555756e-17,   5.00000000e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE2': array([[ 1.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -1741,366 +1754,338 @@ Compiler stage 2: Computing intermediate representation
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+         [ 1.]]), 'FE2_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -3.33066907e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00],
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00]]), 'FE0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-            0.00000000e+00,   5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   9.71445147e-17,
-            5.00000000e-01,  -2.77555756e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.93889390e-17,
-            5.00000000e-01,   5.00000000e-01,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-            5.00000000e-01,  -2.77555756e-17,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-           -1.38777878e-17,   5.00000000e-01,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-            1.38777878e-17,  -2.77555756e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01,   6.98419704e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01,   3.14372873e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01,   3.14372873e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01,   5.68813795e-02],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02,   3.14372873e-01]]), 'FE0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
-            5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
+            5.00000000e-01,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
-           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.00000000e-01,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-           -2.77555756e-17,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.00000000e-01,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
-           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   6.98419704e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            6.98419704e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   3.14372873e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   3.14372873e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   5.68813795e-02],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
+            5.68813795e-02,   3.14372873e-01]]), 'FE0_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
             6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
             5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+            0.00000000e+00,   0.00000000e+00]])}
   
-  tables: {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
+  tables: {'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
+           -1.11022302e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -2155,116 +2140,101 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
+            5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
+           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
+           -2.77555756e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
+           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
+            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
+            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
+            1.00526765e-01,   6.98419704e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
+            6.98419704e-01,   1.00526765e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
+            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
+            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
+            3.14372873e-01,   5.68813795e-02,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
+            5.68813795e-02,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
@@ -2277,20 +2247,20 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
@@ -2331,62 +2301,158 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
+            6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+         [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
+            5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+         [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+            0.00000000e+00,   5.00000000e-01,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   9.71445147e-17,
+            5.00000000e-01,  -2.77555756e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.93889390e-17,
+            5.00000000e-01,   5.00000000e-01,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+            5.00000000e-01,  -2.77555756e-17,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+           -1.38777878e-17,   5.00000000e-01,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+            1.38777878e-17,  -2.77555756e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            6.98419704e-01,   1.00526765e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.98419704e-01,
+            1.00526765e-01,   1.00526765e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            1.00526765e-01,   1.00526765e-01,   6.98419704e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            1.00526765e-01,   6.98419704e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            5.68813795e-02,   3.14372873e-01,   3.14372873e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.68813795e-02,
+            3.14372873e-01,   3.14372873e-01,   3.14372873e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            3.14372873e-01,   3.14372873e-01,   5.68813795e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            3.14372873e-01,   5.68813795e-02,   3.14372873e-01]]), 'FE2_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -2441,115 +2507,62 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
-            5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
-           -2.77555756e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-           -2.77555756e-17,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
-            5.00000000e-01,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
-           -2.77555756e-17,   5.00000000e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE2': array([[ 1.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -2562,258 +2575,258 @@ Compiler stage 2: Computing intermediate representation
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+         [ 1.]]), 'FE2_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -3.33066907e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00],
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00]]), 'FE0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-            0.00000000e+00,   5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   9.71445147e-17,
-            5.00000000e-01,  -2.77555756e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.93889390e-17,
-            5.00000000e-01,   5.00000000e-01,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-            5.00000000e-01,  -2.77555756e-17,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-           -1.38777878e-17,   5.00000000e-01,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-            1.38777878e-17,  -2.77555756e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01,   6.98419704e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01,   3.14372873e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01,   3.14372873e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01,   5.68813795e-02],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02,   3.14372873e-01]]), 'FE0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
-            5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
+            5.00000000e-01,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
-           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.00000000e-01,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-           -2.77555756e-17,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.00000000e-01,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
-           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   6.98419704e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            6.98419704e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   3.14372873e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   3.14372873e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   5.68813795e-02],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
+            5.68813795e-02,   3.14372873e-01]]), 'FE0_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
          [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
             6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
             5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+            0.00000000e+00,   0.00000000e+00]])}
   
   name_map: {}
   
-  inv_name_map: {'FE0_C2_D001': 'FE0_C2_D001', 'FE0_C1_D001': 'FE0_C1_D001', 'FE0_C1_D010': 'FE0_C1_D010', 'FE0_C2_D010': 'FE0_C2_D010', 'FE1_C0': 'FE1_C0', 'FE0_C1_D100': 'FE0_C1_D100', 'FE0_C0_D100': 'FE0_C0_D100', 'FE1_C0_D100': 'FE1_C0_D100', 'FE1_C0_D010': 'FE1_C0_D010', 'FE0_C0_D010': 'FE0_C0_D010', 'FE0_C0_D001': 'FE0_C0_D001', 'FE1_C0_D001': 'FE1_C0_D001', 'FE1_C1_D100': 'FE1_C1_D100', 'FE1_C1': 'FE1_C1', 'FE0_C2_D100': 'FE0_C2_D100', 'FE2': 'FE2', 'FE1_C1_D010': 'FE1_C1_D010', ' [...]
+  inv_name_map: {'FE0_C1_D001': 'FE0_C1_D001', 'FE0_C1_D010': 'FE0_C1_D010', 'FE2_C1_D010': 'FE2_C1_D010', 'FE0_C0_D010': 'FE0_C0_D010', 'FE0_C1_D100': 'FE0_C1_D100', 'FE0_C0_D100': 'FE0_C0_D100', 'FE2_C0_D100': 'FE2_C0_D100', 'FE2_C2_D100': 'FE2_C2_D100', 'FE2_C1': 'FE2_C1', 'FE2_C0': 'FE2_C0', 'FE0_C0_D001': 'FE0_C0_D001', 'FE2_C1_D100': 'FE2_C1_D100', 'FE2_C0_D001': 'FE2_C0_D001', 'FE2_C2_D001': 'FE2_C2_D001', 'FE1': 'FE1', 'FE2_C2_D010': 'FE2_C2_D010', 'FE2_C2': 'FE2_C2', 'FE2_C1_D00 [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_C0_D001': array([[-1.,  1.],
@@ -2829,7 +2842,7 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.],
          [-1.,  1.],
          [-1.,  1.],
-         [-1.,  1.]]), 'FE2': array([[ 1.],
+         [-1.,  1.]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -2858,7 +2871,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.31437287,  0.31437287,  0.05688138,  0.31437287]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C2_D001': ('FE0_C0_D001', (9, [8, 11]), False, False), 'FE0_C1_D001': ('FE0_C0_D001', (5, [4, 7]), False, False), 'FE0_C1_D010': ('FE0_C0_D001', (6, [4, 6]), False, False), 'FE0_C2_D010': ('FE0_C0_D001', (10, [8, 10]), False, False), 'FE1_C0': ('FE0_C0', (12, [0, 1, 2, 3]), False, False), 'FE0_C1_D100': ('FE0_C0_D001', (7, [4, 5]), False, False), 'FE0_C0_D100': ('FE0_C0_D001', (3, [0, 1]), False, False), 'FE1_C0_D100': ('FE0_C0_D001', (15, [0, 1]), False, False), 'FE1_C0_D010': ( [...]
+  {'FE0_C1_D001': ('FE0_C0_D001', (5, [4, 7]), False, False), 'FE0_C1_D010': ('FE0_C0_D001', (6, [4, 6]), False, False), 'FE2_C1_D010': ('FE0_C0_D001', (14, [4, 6]), False, False), 'FE0_C0_D010': ('FE0_C0_D001', (2, [0, 2]), False, False), 'FE0_C1_D100': ('FE0_C0_D001', (7, [4, 5]), False, False), 'FE0_C0_D100': ('FE0_C0_D001', (3, [0, 1]), False, False), 'FE2_C0_D100': ('FE0_C0_D001', (11, [0, 1]), False, False), 'FE2_C2_D100': ('FE0_C0_D001', (19, [8, 9]), False, False), 'FE2_C1': ('FE [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -2939,91 +2952,47 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {14: {FiniteElement('Real', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-           1.]])}}}, VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+  {14: {MixedElement(FiniteElement('Lagrange', tetrahedron, 1), FiniteElement('Lagrange', tetrahedron, 1)): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
            -1.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
             1.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
           [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
            -1.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
           [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
             1.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]],
   
          [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
             0.]]]), (0, 1, 0): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
@@ -3033,11 +3002,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
@@ -3049,11 +3013,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
@@ -3065,75 +3024,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
-            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
-            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
-            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
-            -1.11022302e-16,  -1.66533454e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3145,11 +3035,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3157,11 +3042,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
           [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
@@ -3173,11 +3053,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
           [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
             -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
             -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
@@ -3189,11 +3064,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
           [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
@@ -3209,11 +3079,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]]]), (0, 0, 0): array([[[  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
              5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
              1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
@@ -3223,11 +3088,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
@@ -3239,11 +3099,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
@@ -3255,11 +3110,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
@@ -3271,11 +3121,6 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3287,12 +3132,7 @@ Compiler stage 2: Computing intermediate representation
              5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
              1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
              1.00526765e-01,   3.14372873e-01,   5.68813795e-02,
-             3.14372873e-01,   3.14372873e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
+             3.14372873e-01,   3.14372873e-01]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3303,12 +3143,7 @@ Compiler stage 2: Computing intermediate representation
              5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
              6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
              1.00526765e-01,   5.68813795e-02,   3.14372873e-01,
-             3.14372873e-01,   3.14372873e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
+             3.14372873e-01,   3.14372873e-01]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3319,12 +3154,7 @@ Compiler stage 2: Computing intermediate representation
             -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
              1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
              6.98419704e-01,   3.14372873e-01,   3.14372873e-01,
-             3.14372873e-01,   5.68813795e-02],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
+             3.14372873e-01,   5.68813795e-02]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3335,76 +3165,176 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
              1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
              1.00526765e-01,   3.14372873e-01,   3.14372873e-01,
-             5.68813795e-02,   3.14372873e-01],
+             5.68813795e-02,   3.14372873e-01]]]), (0, 0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
+         [[ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
+             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
+             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
+             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
+             1.11022302e-16,  -1.11022302e-16],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
-             5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
-             1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
-             1.00526765e-01,   3.14372873e-01,   5.68813795e-02,
-             3.14372873e-01,   3.14372873e-01]],
+             0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
+         [[ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
+             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+             5.55111512e-17,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-             5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
-             6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
-             1.00526765e-01,   5.68813795e-02,   3.14372873e-01,
-             3.14372873e-01,   3.14372873e-01]],
+             0.00000000e+00,   0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
-            -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
-             1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
-             6.98419704e-01,   3.14372873e-01,   3.14372873e-01,
-             3.14372873e-01,   5.68813795e-02]],
+          [ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
+             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
+             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
+             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
+             1.11022302e-16,  -1.11022302e-16]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+          [ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
+             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+             5.55111512e-17,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-             1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
-             1.00526765e-01,   3.14372873e-01,   3.14372873e-01,
-             5.68813795e-02,   3.14372873e-01]]]), (0, 0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00]]])}}}, FiniteElement('Real', tetrahedron, 0): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+           1.]])}}}, VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.]]]), (0, 1, 0): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
@@ -3420,11 +3350,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
-             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
-             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
-             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
-             1.11022302e-16,  -1.11022302e-16],
+         [[ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
+            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
+            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
+            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
+            -1.11022302e-16,  -1.66533454e-16],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3436,11 +3366,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
-             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
-             5.55111512e-17,   0.00000000e+00],
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3452,11 +3382,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00],
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3489,11 +3419,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
-             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
-             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
-             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
-             1.11022302e-16,  -1.11022302e-16],
+          [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
+            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
+            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
+            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
+            -1.11022302e-16,  -1.66533454e-16],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3505,11 +3435,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
-             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
-             5.55111512e-17,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3521,11 +3451,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3558,11 +3488,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
-             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
-             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
-             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
-             1.11022302e-16,  -1.11022302e-16]],
+          [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
+            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
+            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
+            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
+            -1.11022302e-16,  -1.66533454e-16]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3574,11 +3504,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
-             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
-             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
-             5.55111512e-17,   0.00000000e+00]],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3590,85 +3520,35 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00]]])}}}, MixedElement(*[FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (2,) }): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.]]]), (0, 1, 0): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
-            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
-            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
-            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
-            -1.11022302e-16,  -1.66533454e-16],
+             0.00000000e+00,   0.00000000e+00]]]), (0, 0, 0): array([[[  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
+             5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
+             1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
+             1.00526765e-01,   3.14372873e-01,   5.68813795e-02,
+             3.14372873e-01,   3.14372873e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00],
+         [[  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
+             5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
+             6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
+             1.00526765e-01,   5.68813795e-02,   3.14372873e-01,
+             3.14372873e-01,   3.14372873e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3676,49 +3556,44 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
+            -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
+             1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
+             6.98419704e-01,   3.14372873e-01,   3.14372873e-01,
+             3.14372873e-01,   5.68813795e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [ -1.66533454e-16,  -1.66533454e-16,  -5.55111512e-17,
-            -5.55111512e-17,  -5.55111512e-17,  -1.66533454e-16,
-            -1.11022302e-16,  -1.11022302e-16,  -3.33066907e-16,
-            -1.11022302e-16,  -1.66533454e-16,  -1.66533454e-16,
-            -1.11022302e-16,  -1.66533454e-16]],
+             0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+             1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
+             1.00526765e-01,   3.14372873e-01,   3.14372873e-01,
+             5.68813795e-02,   3.14372873e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00]]]), (0, 0, 0): array([[[  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
+             0.00000000e+00,   0.00000000e+00],
+          [  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
              5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
              1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
              1.00526765e-01,   3.14372873e-01,   5.68813795e-02,
@@ -3729,7 +3604,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
              5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
              6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
              1.00526765e-01,   5.68813795e-02,   3.14372873e-01,
@@ -3740,7 +3620,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
             -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
              1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
              6.98419704e-01,   3.14372873e-01,   3.14372873e-01,
@@ -3751,7 +3636,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
-         [[  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
              1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
              1.00526765e-01,   3.14372873e-01,   3.14372873e-01,
@@ -3767,6 +3657,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  4.16333634e-17,   9.71445147e-17,   6.93889390e-17,
              5.00000000e-01,   5.00000000e-01,   5.00000000e-01,
              1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
@@ -3778,6 +3673,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
              5.00000000e-01,  -1.38777878e-17,   1.38777878e-17,
              6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
@@ -3789,6 +3689,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  5.00000000e-01,  -2.77555756e-17,   5.00000000e-01,
             -2.77555756e-17,   5.00000000e-01,  -2.77555756e-17,
              1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
@@ -3800,6 +3705,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
           [  5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
              1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
@@ -3813,6 +3723,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
@@ -3824,6 +3739,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
@@ -3835,6 +3755,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
@@ -3846,6 +3771,11 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3857,7 +3787,12 @@ Compiler stage 2: Computing intermediate representation
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00]],
+            -1.00000000e+00,  -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3868,7 +3803,12 @@ Compiler stage 2: Computing intermediate representation
              1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
              1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
              1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
-             1.11022302e-16,  -1.11022302e-16]],
+             1.11022302e-16,  -1.11022302e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3879,7 +3819,12 @@ Compiler stage 2: Computing intermediate representation
              5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
              5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
              5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
-             5.55111512e-17,   0.00000000e+00]],
+             5.55111512e-17,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3890,120 +3835,161 @@ Compiler stage 2: Computing intermediate representation
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00]]])}}}}}
+             1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00]],
   
-  QG-utils, psi_tables, flat_tables:
-  {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [ -1.66533454e-16,  -1.66533454e-16,   1.11022302e-16,
+             1.11022302e-16,   1.11022302e-16,  -1.66533454e-16,
+             1.11022302e-16,   1.11022302e-16,  -3.33066907e-16,
+             1.11022302e-16,  -1.11022302e-16,  -1.11022302e-16,
+             1.11022302e-16,  -1.11022302e-16]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [ -5.55111512e-17,  -5.55111512e-17,   5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -5.55111512e-17,
+             5.55111512e-17,   5.55111512e-17,  -1.11022302e-16,
+             5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+             5.55111512e-17,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00]]])}}}}}
+  
+  QG-utils, psi_tables, flat_tables:
+  {'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -1.11022302e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -4058,103 +4044,7 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
          [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
          [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
          [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
@@ -4167,7 +4057,88 @@ Compiler stage 2: Computing intermediate representation
          [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
          [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
          [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
+            5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
+           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
+           -2.77555756e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
+           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
+            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
+            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
+            1.00526765e-01,   6.98419704e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
+            6.98419704e-01,   1.00526765e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
+            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
+            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
+            3.14372873e-01,   5.68813795e-02,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
+            5.68813795e-02,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
@@ -4180,20 +4151,20 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
@@ -4234,62 +4205,158 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
+            6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+         [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+         [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
+            5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
+         [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+            0.00000000e+00,   5.00000000e-01,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   9.71445147e-17,
+            5.00000000e-01,  -2.77555756e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.93889390e-17,
+            5.00000000e-01,   5.00000000e-01,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+            5.00000000e-01,  -2.77555756e-17,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+           -1.38777878e-17,   5.00000000e-01,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+            1.38777878e-17,  -2.77555756e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            6.98419704e-01,   1.00526765e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.98419704e-01,
+            1.00526765e-01,   1.00526765e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            1.00526765e-01,   1.00526765e-01,   6.98419704e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            1.00526765e-01,   6.98419704e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            5.68813795e-02,   3.14372873e-01,   3.14372873e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            0.00000000e+00,   0.00000000e+00,   5.68813795e-02,
+            3.14372873e-01,   3.14372873e-01,   3.14372873e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            3.14372873e-01,   3.14372873e-01,   5.68813795e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            3.14372873e-01,   5.68813795e-02,   3.14372873e-01]]), 'FE2_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -4344,115 +4411,62 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
-            5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
-           -2.77555756e-17,   5.00000000e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-           -2.77555756e-17,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
-            5.00000000e-01,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
-           -2.77555756e-17,   5.00000000e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE2': array([[ 1.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -4465,366 +4479,378 @@ Compiler stage 2: Computing intermediate representation
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+         [ 1.]]), 'FE2_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -3.33066907e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00],
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00]]), 'FE0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-            0.00000000e+00,   5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   9.71445147e-17,
-            5.00000000e-01,  -2.77555756e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.93889390e-17,
-            5.00000000e-01,   5.00000000e-01,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-            5.00000000e-01,  -2.77555756e-17,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-           -1.38777878e-17,   5.00000000e-01,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-            1.38777878e-17,  -2.77555756e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01,   6.98419704e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01,   3.14372873e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01,   3.14372873e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01,   5.68813795e-02],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02,   3.14372873e-01]]), 'FE0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
-            5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
+            5.00000000e-01,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
-           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.00000000e-01,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-           -2.77555756e-17,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.00000000e-01,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
-           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   6.98419704e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            6.98419704e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   3.14372873e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   3.14372873e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   5.68813795e-02],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
+            5.68813795e-02,   3.14372873e-01]]), 'FE0_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
             6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
             5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+            0.00000000e+00,   0.00000000e+00]])}
   
-  tables: {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
+  tables: {'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
+           -1.11022302e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
+            5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -4833,162 +4859,107 @@ Compiler stage 2: Computing intermediate representation
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
+            5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
+           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
+           -2.77555756e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
+           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
+            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
+            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
+            1.00526765e-01,   6.98419704e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
+            6.98419704e-01,   1.00526765e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
+            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -3.33066907e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
+            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
+            3.14372873e-01,   5.68813795e-02,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
+            5.68813795e-02,   3.14372873e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
@@ -5001,20 +4972,20 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE2_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
@@ -5055,62 +5026,158 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
+            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+         [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
+            6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
+            1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+         [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
+            5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+         [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
+            3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+            0.00000000e+00,   5.00000000e-01,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   9.71445147e-17,
+            5.00000000e-01,  -2.77555756e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.93889390e-17,
+            5.00000000e-01,   5.00000000e-01,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+            5.00000000e-01,  -2.77555756e-17,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+           -1.38777878e-17,   5.00000000e-01,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
+            1.38777878e-17,  -2.77555756e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            6.98419704e-01,   1.00526765e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.98419704e-01,
+            1.00526765e-01,   1.00526765e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            1.00526765e-01,   1.00526765e-01,   6.98419704e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
+            1.00526765e-01,   6.98419704e-01,   1.00526765e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            5.68813795e-02,   3.14372873e-01,   3.14372873e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   5.68813795e-02,
+            3.14372873e-01,   3.14372873e-01,   3.14372873e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            3.14372873e-01,   3.14372873e-01,   5.68813795e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
+            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
+            3.14372873e-01,   5.68813795e-02,   3.14372873e-01]]), 'FE2_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -5165,115 +5232,62 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D001': array([[ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.66533454e-16,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   1.11022302e-16,   5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
-            5.00000000e-01,   5.00000000e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
-           -2.77555756e-17,   5.00000000e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-           -2.77555756e-17,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
-            5.00000000e-01,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
-           -2.77555756e-17,   5.00000000e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -3.33066907e-16,  -1.11022302e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+            1.11022302e-16,   5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE2': array([[ 1.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   0.00000000e+00,   1.00000000e+00]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -5286,258 +5300,258 @@ Compiler stage 2: Computing intermediate representation
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+         [ 1.]]), 'FE2_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -3.33066907e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.66533454e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-            1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.66533454e-16,
-           -5.55111512e-17,   1.00000000e+00],
+           -5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00],
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00],
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,   1.11022302e-16,
-            5.55111512e-17,   1.00000000e+00],
+            5.55111512e-17,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
-            0.00000000e+00,   1.00000000e+00]]), 'FE0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D010': array([[ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-            0.00000000e+00,   5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   9.71445147e-17,
-            5.00000000e-01,  -2.77555756e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.93889390e-17,
-            5.00000000e-01,   5.00000000e-01,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-            5.00000000e-01,  -2.77555756e-17,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-           -1.38777878e-17,   5.00000000e-01,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.00000000e-01,
-            1.38777878e-17,  -2.77555756e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01,   6.98419704e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01,   1.00526765e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01,   3.14372873e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01,   3.14372873e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01,   5.68813795e-02],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02,   3.14372873e-01]]), 'FE0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
-            5.00000000e-01,   5.00000000e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -1.66533454e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.16333634e-17,   0.00000000e+00,
+            5.00000000e-01,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   9.71445147e-17,   5.00000000e-01,
-           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   6.93889390e-17,   5.00000000e-01,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.00000000e-01,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,   5.00000000e-01,
-           -2.77555756e-17,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,  -1.38777878e-17,
-            5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            5.00000000e-01,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.00000000e-01,   1.38777878e-17,
-           -2.77555756e-17,   5.00000000e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -2.77555756e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   6.98419704e-01,
-            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   6.98419704e-01,   1.00526765e-01,
-            1.00526765e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            1.00526765e-01,   6.98419704e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            1.00526765e-01,   6.98419704e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   1.00526765e-01,   1.00526765e-01,
-            6.98419704e-01,   1.00526765e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            6.98419704e-01,   1.00526765e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   5.68813795e-02,
-            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   3.14372873e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   5.68813795e-02,   3.14372873e-01,
-            3.14372873e-01,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   3.14372873e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            3.14372873e-01,   5.68813795e-02,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            3.14372873e-01,   5.68813795e-02],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   3.14372873e-01,   3.14372873e-01,
-            5.68813795e-02,   3.14372873e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
+            5.68813795e-02,   3.14372873e-01]]), 'FE0_C0': array([[  4.16333634e-17,   0.00000000e+00,   5.00000000e-01,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  9.71445147e-17,   5.00000000e-01,  -2.77555756e-17,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  6.93889390e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,   5.00000000e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,  -1.38777878e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.00000000e-01,   1.38777878e-17,  -2.77555756e-17,
             5.00000000e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   6.98419704e-01,   1.00526765e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  6.98419704e-01,   1.00526765e-01,   1.00526765e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   1.00526765e-01,   1.00526765e-01,
             6.98419704e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  1.00526765e-01,   1.00526765e-01,   6.98419704e-01,
             1.00526765e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   5.68813795e-02,   3.14372873e-01,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  5.68813795e-02,   3.14372873e-01,   3.14372873e-01,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   3.14372873e-01,   3.14372873e-01,
             5.68813795e-02,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  3.14372873e-01,   3.14372873e-01,   5.68813795e-02,
             3.14372873e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+            0.00000000e+00,   0.00000000e+00]])}
   
   name_map: {}
   
-  inv_name_map: {'FE0_C2_D001': 'FE0_C2_D001', 'FE0_C1_D001': 'FE0_C1_D001', 'FE0_C1_D010': 'FE0_C1_D010', 'FE0_C2_D010': 'FE0_C2_D010', 'FE1_C0': 'FE1_C0', 'FE0_C1_D100': 'FE0_C1_D100', 'FE0_C0_D100': 'FE0_C0_D100', 'FE1_C0_D100': 'FE1_C0_D100', 'FE1_C0_D010': 'FE1_C0_D010', 'FE0_C0_D010': 'FE0_C0_D010', 'FE0_C0_D001': 'FE0_C0_D001', 'FE1_C0_D001': 'FE1_C0_D001', 'FE1_C1_D100': 'FE1_C1_D100', 'FE1_C1': 'FE1_C1', 'FE0_C2_D100': 'FE0_C2_D100', 'FE2': 'FE2', 'FE1_C1_D010': 'FE1_C1_D010', ' [...]
+  inv_name_map: {'FE0_C1_D001': 'FE0_C1_D001', 'FE0_C1_D010': 'FE0_C1_D010', 'FE2_C1_D010': 'FE2_C1_D010', 'FE0_C0_D010': 'FE0_C0_D010', 'FE0_C1_D100': 'FE0_C1_D100', 'FE0_C0_D100': 'FE0_C0_D100', 'FE2_C0_D100': 'FE2_C0_D100', 'FE2_C2_D100': 'FE2_C2_D100', 'FE2_C1': 'FE2_C1', 'FE2_C0': 'FE2_C0', 'FE0_C0_D001': 'FE0_C0_D001', 'FE2_C1_D100': 'FE2_C1_D100', 'FE2_C0_D001': 'FE2_C0_D001', 'FE2_C2_D001': 'FE2_C2_D001', 'FE1': 'FE1', 'FE2_C2_D010': 'FE2_C2_D010', 'FE2_C2': 'FE2_C2', 'FE2_C1_D00 [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_C0_D001': array([[-1.,  1.],
@@ -5553,7 +5567,7 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.],
          [-1.,  1.],
          [-1.,  1.],
-         [-1.,  1.]]), 'FE2': array([[ 1.],
+         [-1.,  1.]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -5582,7 +5596,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.31437287,  0.31437287,  0.05688138,  0.31437287]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C2_D001': ('FE0_C0_D001', (9, [8, 11]), False, False), 'FE0_C1_D001': ('FE0_C0_D001', (5, [4, 7]), False, False), 'FE0_C1_D010': ('FE0_C0_D001', (6, [4, 6]), False, False), 'FE0_C2_D010': ('FE0_C0_D001', (10, [8, 10]), False, False), 'FE1_C0': ('FE0_C0', (12, [0, 1, 2, 3]), False, False), 'FE0_C1_D100': ('FE0_C0_D001', (7, [4, 5]), False, False), 'FE0_C0_D100': ('FE0_C0_D001', (3, [0, 1]), False, False), 'FE1_C0_D100': ('FE0_C0_D001', (15, [0, 1]), False, False), 'FE1_C0_D010': ( [...]
+  {'FE0_C1_D001': ('FE0_C0_D001', (5, [4, 7]), False, False), 'FE0_C1_D010': ('FE0_C0_D001', (6, [4, 6]), False, False), 'FE2_C1_D010': ('FE0_C0_D001', (14, [4, 6]), False, False), 'FE0_C0_D010': ('FE0_C0_D001', (2, [0, 2]), False, False), 'FE0_C1_D100': ('FE0_C0_D001', (7, [4, 5]), False, False), 'FE0_C0_D100': ('FE0_C0_D001', (3, [0, 1]), False, False), 'FE2_C0_D100': ('FE0_C0_D001', (11, [0, 1]), False, False), 'FE2_C2_D100': ('FE0_C0_D001', (19, [8, 9]), False, False), 'FE2_C1': ('FE [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -5653,285 +5667,232 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.5761 seconds.
+Compiler stage 2 finished in 0.829551 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.063026 seconds.
+Compiler stage 3 finished in 0.0601542 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 3 element(s)
+  Generating code for 4 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Z
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: d_22
-  Removing unused variable: d_21
-  Removing unused variable: d_20
-  Removing unused variable: d_12
-  Removing unused variable: d_11
-  Removing unused variable: d_10
-  Removing unused variable: d_02
-  Removing unused variable: d_01
-  Removing unused variable: d_00
-  Removing unused variable: C2
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 3 dofmap(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp0
+  Removing unused variable: Z
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: d_22
+  Removing unused variable: d_21
+  Removing unused variable: d_20
+  Removing unused variable: d_12
+  Removing unused variable: d_11
+  Removing unused variable: d_10
+  Removing unused variable: d_02
+  Removing unused variable: d_01
+  Removing unused variable: d_00
+  Removing unused variable: C2
+  Removing unused variable: C1
+  Removing unused variable: C0
+  Generating code for 4 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: area
@@ -5961,24 +5922,25 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.227542 seconds.
+Compiler stage 4 finished in 0.50511 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000810862 seconds.
+Compiler stage 4.1 finished in 0.001194 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.00148797 seconds.
+
+FFC finished in 1.59828 seconds.
 Output written to ./CahnHilliard3D.h.
 Output written to ./CahnHilliard3D.cpp.
-Compiler stage 5 finished in 0.000998974 seconds.
-
-FFC finished in 0.982694 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form CahnHilliard2D
 
@@ -5991,8 +5953,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    5
   Coefficients:              '[w_0, w_1, w_2, w_3, w_4]'
-  Unique elements:           'Mixed<CG1(?), CG1(?)>, R0(?)'
-  Unique sub elements:       'Mixed<CG1(?), CG1(?)>, R0(?), CG1(?)'
+  Unique elements:           'Mixed<CG1(?), CG1(?)>, R0(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'Mixed<CG1(?), CG1(?)>, R0(?), Vector<2 x CG1(?)>, CG1(
+                             ?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -6069,9 +6032,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 5
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -6079,8 +6042,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    4
   Coefficients:              '[w_0, w_2, w_3, w_4]'
-  Unique elements:           'Mixed<CG1(?), CG1(?)>, R0(?)'
-  Unique sub elements:       'Mixed<CG1(?), CG1(?)>, R0(?), CG1(?)'
+  Unique elements:           'Mixed<CG1(?), CG1(?)>, R0(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'Mixed<CG1(?), CG1(?)>, R0(?), Vector<2 x CG1(?)>, CG1(
+                             ?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -6165,25 +6129,35 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.092845 seconds.
+Compiler stage 1 finished in 0.196058 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 3 elements
+  Computing representation of 4 elements
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 4 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -6195,7 +6169,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {6: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.]])}}}, MixedElement(*[FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (2,) }): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+  {6: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
@@ -6267,7 +6241,7 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ],
           [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            0.44594849]]])}}}, MixedElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
@@ -6339,10 +6313,21 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ],
           [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849]]])}}}}}
+            0.44594849]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
@@ -6353,7 +6338,7 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
            0.        ],
          [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
            0.        ],
@@ -6364,7 +6349,33 @@ Compiler stage 2: Computing intermediate representation
          [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
            0.        ],
          [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
+           0.        ]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
            0.09157621],
          [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
            0.81684757],
@@ -6375,17 +6386,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
            0.10810302],
          [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
-           0.44594849]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+           0.44594849]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
@@ -6401,39 +6402,12 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
+         [ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
            0.09157621],
          [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
            0.81684757],
@@ -6489,7 +6463,7 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -6518,9 +6492,9 @@ Compiler stage 2: Computing intermediate representation
          [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
            0.        ]])}
   
-  name_map: {'FE0_C1_D01': ['FE1_C1_D01'], 'FE0_C1_D10': ['FE1_C1_D10'], 'FE0_C0_D10': ['FE1_C0_D10'], 'FE0_C0_D01': ['FE1_C0_D01'], 'FE0_C1': ['FE1_C1'], 'FE0_C0': ['FE1_C0']}
+  name_map: {'FE0_C1_D01': ['FE2_C1_D01'], 'FE0_C1_D10': ['FE2_C1_D10'], 'FE0_C0_D10': ['FE2_C0_D10'], 'FE0_C0_D01': ['FE2_C0_D01'], 'FE0_C1': ['FE2_C1'], 'FE0_C0': ['FE2_C0']}
   
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE0_C0', 'FE1_C1_D01': 'FE0_C1_D01', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C1_D10': 'FE0_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE2': 'FE2', 'FE1_C1': 'FE0_C1', 'FE1_C0_D01': 'FE0_C0_D01', 'FE1_C0_D10': 'FE0_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE2_C1_D01': 'FE0_C1_D01', 'FE2_C1_D10': 'FE0_C1_D10', 'FE2_C0_D01': 'FE0_C0_D01', 'FE0_C0_D10': 'FE0_C0_D10', 'FE1': 'FE1', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C1_D01': 'FE0_C1_D01', 'FE2_C1': 'FE0_C1', 'FE2_C0': 'FE0_C0', 'FE0_C0_D01': 'FE0_C0_D01', 'FE2_C0_D10': 'FE0_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_C0_D01': array([[-1.,  1.],
@@ -6528,7 +6502,7 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.],
          [-1.,  1.],
          [-1.,  1.],
-         [-1.,  1.]]), 'FE2': array([[ 1.],
+         [-1.,  1.]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -6541,7 +6515,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.10810302,  0.44594849,  0.44594849]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE1_C0': ('FE0_C0', (0, [0, 1, 2]), False, False), 'FE1_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE1_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2]), False, False), 'FE2': ('FE2', (), False, True), 'FE1_C1': ('FE0_C0', (3, [3, 4, 5]), False, False), 'FE1_C0_D0 [...]
+  {'FE2_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE2_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE2_C0_D01': ('FE0_C0_D01', (1, [0, 2]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE1': ('FE1', (), False, True), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE2_C1': ('FE0_C0', (3, [3, 4, 5]), False, False), 'FE2_C0': ('FE0_C0', (0, [0, 1, 2]), False, False), 'FE0_C0_D0 [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -6608,9 +6582,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {6: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.]])}}}, MixedElement(*[FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (2,) }): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+  {6: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
@@ -6682,7 +6657,7 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ],
           [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            0.44594849]]])}}}, MixedElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
@@ -6754,21 +6729,32 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ],
           [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849]]])}}}}}
+            0.44594849]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
            0.        ],
          [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
            0.        ],
@@ -6779,7 +6765,33 @@ Compiler stage 2: Computing intermediate representation
          [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
            0.        ],
          [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
+           0.        ]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
            0.09157621],
          [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
            0.81684757],
@@ -6790,17 +6802,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
            0.10810302],
          [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
-           0.44594849]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+           0.44594849]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
@@ -6816,39 +6818,12 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
+         [ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
            0.09157621],
          [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
            0.81684757],
@@ -6904,7 +6879,7 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -6933,9 +6908,9 @@ Compiler stage 2: Computing intermediate representation
          [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
            0.        ]])}
   
-  name_map: {'FE0_C1_D01': ['FE1_C1_D01'], 'FE0_C1_D10': ['FE1_C1_D10'], 'FE0_C0_D10': ['FE1_C0_D10'], 'FE0_C0_D01': ['FE1_C0_D01'], 'FE0_C1': ['FE1_C1'], 'FE0_C0': ['FE1_C0']}
+  name_map: {'FE0_C1_D01': ['FE2_C1_D01'], 'FE0_C1_D10': ['FE2_C1_D10'], 'FE0_C0_D10': ['FE2_C0_D10'], 'FE0_C0_D01': ['FE2_C0_D01'], 'FE0_C1': ['FE2_C1'], 'FE0_C0': ['FE2_C0']}
   
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE0_C0', 'FE1_C1_D01': 'FE0_C1_D01', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C1_D10': 'FE0_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE2': 'FE2', 'FE1_C1': 'FE0_C1', 'FE1_C0_D01': 'FE0_C0_D01', 'FE1_C0_D10': 'FE0_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE2_C1_D01': 'FE0_C1_D01', 'FE2_C1_D10': 'FE0_C1_D10', 'FE2_C0_D01': 'FE0_C0_D01', 'FE0_C0_D10': 'FE0_C0_D10', 'FE1': 'FE1', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C1_D01': 'FE0_C1_D01', 'FE2_C1': 'FE0_C1', 'FE2_C0': 'FE0_C0', 'FE0_C0_D01': 'FE0_C0_D01', 'FE2_C0_D10': 'FE0_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_C0_D01': array([[-1.,  1.],
@@ -6943,7 +6918,7 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.],
          [-1.,  1.],
          [-1.,  1.],
-         [-1.,  1.]]), 'FE2': array([[ 1.],
+         [-1.,  1.]]), 'FE1': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -6956,7 +6931,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.10810302,  0.44594849,  0.44594849]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE1_C0': ('FE0_C0', (0, [0, 1, 2]), False, False), 'FE1_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE1_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2]), False, False), 'FE2': ('FE2', (), False, True), 'FE1_C1': ('FE0_C0', (3, [3, 4, 5]), False, False), 'FE1_C0_D0 [...]
+  {'FE2_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE2_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE2_C0_D01': ('FE0_C0_D01', (1, [0, 2]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE1': ('FE1', (), False, True), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE2_C1': ('FE0_C0', (3, [3, 4, 5]), False, False), 'FE2_C0': ('FE0_C0', (0, [0, 1, 2]), False, False), 'FE0_C0_D0 [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -7017,176 +6992,87 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.103931 seconds.
+Compiler stage 2 finished in 0.160156 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.011445 seconds.
+Compiler stage 3 finished in 0.0192368 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 3 element(s)
+  Generating code for 4 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 3 dofmap(s)
+  Removing unused variable: tmp0
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: C1
+  Removing unused variable: C0
+  Generating code for 4 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -7200,19 +7086,19 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.0984321 seconds.
+Compiler stage 4 finished in 0.22032 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000858068 seconds.
+Compiler stage 4.1 finished in 0.00128007 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.00136805 seconds.
+
+FFC finished in 0.598979 seconds.
 Output written to ./CahnHilliard2D.h.
 Output written to ./CahnHilliard2D.cpp.
-Compiler stage 5 finished in 0.000969172 seconds.
-
-FFC finished in 0.308817 seconds.
diff --git a/demo/documented/cahn-hilliard/cpp/documentation.rst b/demo/documented/cahn-hilliard/cpp/documentation.rst
index 2bddc50..663edfe 100644
--- a/demo/documented/cahn-hilliard/cpp/documentation.rst
+++ b/demo/documented/cahn-hilliard/cpp/documentation.rst
@@ -178,17 +178,20 @@ function ``init``:
 .. code-block:: c++
 
     // Constructor
-    CahnHilliardEquation(const Mesh& mesh, const Constant& dt,
-                         const Constant& theta, const Constant& lambda)
+    CahnHilliardEquation(std::shared_ptr<const Mesh> mesh,
+                         std::shared_ptr<const Constant> dt,
+                         std::shared_ptr<const Constant> theta,
+                         std::shared_ptr<const Constant> lambda)
     {
       // Initialize class (depending on geometric dimension of the mesh).
       // Unfortunately C++ does not allow namespaces as template arguments
-      if (mesh.geometry().dim() == 2)
+      dolfin_assert(mesh);
+      if (mesh->geometry().dim() == 2)
       {
         init<CahnHilliard2D::FunctionSpace, CahnHilliard2D::JacobianForm,
              CahnHilliard2D::ResidualForm>(mesh, dt, theta, lambda);
       }
-      else if (mesh.geometry().dim() == 3)
+      else if (mesh->geometry().dim() == 3)
       {
         init<CahnHilliard3D::FunctionSpace, CahnHilliard3D::JacobianForm,
              CahnHilliard3D::ResidualForm>(mesh, dt, theta, lambda);
@@ -253,33 +256,35 @@ initial condition (by interpolation).
 
 .. code-block:: c++
 
-  private:
+    private:
 
-    template<class X, class Y, class Z>
-    void init(const Mesh& mesh, const Constant& dt, const Constant& theta,
-              const Constant& lambda)
-    {
-      // Create function space and functions
-      std::shared_ptr<X> V(new X(mesh));
-      _u.reset(new Function(V));
-      _u0.reset(new Function(V));
-
-      // Create forms and attach functions
-      Y* _a = new Y(V, V);
-      Z* _L = new Z(V);
-      _a->u = *_u;
-      _a->lmbda = lambda; _a->dt = dt; _a->theta = theta;
-      _L->u = *_u; _L->u0 = *_u0;
-      _L->lmbda = lambda; _L->dt = dt; _L->theta = theta;
-
-      // Wrap pointers in a smart pointer
-      a.reset(_a);
-      L.reset(_L);
-
-      // Set solution to intitial condition
-      InitialConditions u_initial;
-      *_u = u_initial;
-    }
+      template<class X, class Y, class Z>
+      void init(std::shared_ptr<const Mesh> mesh,
+                std::shared_ptr<const Constant> dt,
+                std::shared_ptr<const Constant> theta,
+                std::shared_ptr<const Constant> lambda)
+      {
+        // Create function space and functions
+        std::shared_ptr<X> V(new X(mesh));
+        _u.reset(new Function(V));
+        _u0.reset(new Function(V));
+
+        // Create forms and attach functions
+        Y* _a = new Y(V, V);
+        Z* _L = new Z(V);
+        _a->u = _u;
+        _a->lmbda = lambda; _a->dt = dt; _a->theta = theta;
+        _L->u = _u; _L->u0 = _u0;
+        _L->lmbda = lambda; _L->dt = dt; _L->theta = theta;
+
+        // Wrap pointers in a smart pointer
+        a.reset(_a);
+        L.reset(_L);
+
+        // Set solution to intitial condition
+        InitialConditions u_initial;
+        *_u = u_initial;
+      }
 
 The ``CahnHilliardEquation`` class stores the data required for
 computing the residual vector and the Jacobian matrix as private data:
@@ -287,10 +292,10 @@ computing the residual vector and the Jacobian matrix as private data:
 .. code-block:: c++
 
       // Function space, forms and functions
-      boost::scoped_ptr<Form> a;
-      boost::scoped_ptr<Form> L;
-      boost::scoped_ptr<Function> _u;
-      boost::scoped_ptr<Function> _u0;
+      std::unique_ptr<Form> a;
+      std::unique_ptr<Form> L;
+      std::shared_ptr<Function> _u;
+      std::shared_ptr<Function> _u0;
   };
 
 The main program is started, and declared such that it can accept
@@ -308,7 +313,7 @@ A mesh is then created with 97 (96 + 1) vertices in each direction:
 .. code-block:: c++
 
     // Mesh
-    UnitSquareMesh mesh(96, 96);
+    auto mesh = std::make_shared<UnitSquareMesh>(96, 96);
 
 A set of constants (required for the assembling of the forms) and two
 scalars (to be used in the time stepping) are then declared:
@@ -316,12 +321,12 @@ scalars (to be used in the time stepping) are then declared:
 .. code-block:: c++
 
     // Time stepping and model parameters
-    Constant dt(5.0e-6);
-    Constant theta(0.5);
-    Constant lambda(1.0e-2);
+    auto dt = std::make_shared<Constant>(5.0e-6);
+    auto theta = std::make_shared<Constant>(0.5);
+    auto lambda = std::make_shared<Constant>(1.0e-2);
 
     double t = 0.0;
-    double T = 50*dt;
+    double T = 50*(*dt);
 
 A ``CahnHilliardEquation`` object is created, which will be used in conjunction
 with a Newton solver, and references to solution functions are
@@ -371,7 +376,7 @@ is saved to a file, along with the time ``t``.
     while (t < T)
     {
       // Update for next time step
-      t += dt;
+      t += *dt;
       *u0.vector() = *u.vector();
 
       // Solve
diff --git a/demo/documented/cahn-hilliard/cpp/main.cpp b/demo/documented/cahn-hilliard/cpp/main.cpp
index 0afe31d..a189026 100644
--- a/demo/documented/cahn-hilliard/cpp/main.cpp
+++ b/demo/documented/cahn-hilliard/cpp/main.cpp
@@ -59,17 +59,20 @@ class CahnHilliardEquation : public NonlinearProblem
   public:
 
     // Constructor
-  CahnHilliardEquation(const Mesh& mesh, const Constant& dt,
-                         const Constant& theta, const Constant& lambda)
+    CahnHilliardEquation(std::shared_ptr<const Mesh> mesh,
+                         std::shared_ptr<const Constant> dt,
+                         std::shared_ptr<const Constant> theta,
+                         std::shared_ptr<const Constant> lambda)
     {
       // Initialize class (depending on geometric dimension of the mesh).
       // Unfortunately C++ does not allow namespaces as template arguments
-      if (mesh.geometry().dim() == 2)
+      dolfin_assert(mesh);
+      if (mesh->geometry().dim() == 2)
       {
         init<CahnHilliard2D::FunctionSpace, CahnHilliard2D::JacobianForm,
              CahnHilliard2D::ResidualForm>(mesh, dt, theta, lambda);
       }
-      else if (mesh.geometry().dim() == 3)
+      else if (mesh->geometry().dim() == 3)
       {
         init<CahnHilliard3D::FunctionSpace, CahnHilliard3D::JacobianForm,
              CahnHilliard3D::ResidualForm>(mesh, dt, theta, lambda);
@@ -105,8 +108,10 @@ class CahnHilliardEquation : public NonlinearProblem
   private:
 
     template<class X, class Y, class Z>
-    void init(const Mesh& mesh, const Constant& dt, const Constant& theta,
-              const Constant& lambda)
+    void init(std::shared_ptr<const Mesh> mesh,
+              std::shared_ptr<const Constant> dt,
+              std::shared_ptr<const Constant> theta,
+              std::shared_ptr<const Constant> lambda)
     {
       // Create function space and functions
       std::shared_ptr<X> V(new X(mesh));
@@ -116,9 +121,9 @@ class CahnHilliardEquation : public NonlinearProblem
       // Create forms and attach functions
       Y* _a = new Y(V, V);
       Z* _L = new Z(V);
-      _a->u = *_u;
+      _a->u = _u;
       _a->lmbda = lambda; _a->dt = dt; _a->theta = theta;
-      _L->u = *_u; _L->u0 = *_u0;
+      _L->u = _u; _L->u0 = _u0;
       _L->lmbda = lambda; _L->dt = dt; _L->theta = theta;
 
       // Wrap pointers in a smart pointer
@@ -131,10 +136,10 @@ class CahnHilliardEquation : public NonlinearProblem
     }
 
     // Function space, forms and functions
-    boost::scoped_ptr<Form> a;
-    boost::scoped_ptr<Form> L;
-    boost::scoped_ptr<Function> _u;
-    boost::scoped_ptr<Function> _u0;
+    std::unique_ptr<Form> a;
+    std::unique_ptr<Form> L;
+    std::shared_ptr<Function> _u;
+    std::shared_ptr<Function> _u0;
 };
 
 
@@ -143,15 +148,15 @@ int main(int argc, char* argv[])
   init(argc, argv);
 
   // Mesh
-  UnitSquareMesh mesh(96, 96);
+  auto mesh = std::make_shared<UnitSquareMesh>(96, 96);
 
   // Time stepping and model parameters
-  Constant dt(5.0e-6);
-  Constant theta(0.5);
-  Constant lambda(1.0e-2);
+  auto dt = std::make_shared<Constant>(5.0e-6);
+  auto theta = std::make_shared<Constant>(0.5);
+  auto lambda = std::make_shared<Constant>(1.0e-2);
 
   double t = 0.0;
-  double T = 50*dt;
+  double T = 50*(*dt);
 
   // Create user-defined nonlinear problem
   CahnHilliardEquation cahn_hilliard(mesh, dt, theta, lambda);
@@ -176,7 +181,7 @@ int main(int argc, char* argv[])
   while (t < T)
   {
     // Update for next time step
-    t += dt;
+    t += *dt;
     *u0.vector() = *u.vector();
 
     // Solve
diff --git a/demo/documented/cahn-hilliard/python/demo_cahn-hilliard.py b/demo/documented/cahn-hilliard/python/demo_cahn-hilliard.py
index afa3b1b..4bf7cba 100644
--- a/demo/documented/cahn-hilliard/python/demo_cahn-hilliard.py
+++ b/demo/documented/cahn-hilliard/python/demo_cahn-hilliard.py
@@ -28,7 +28,7 @@ from dolfin import *
 
 # Class representing the intial conditions
 class InitialConditions(Expression):
-    def __init__(self):
+    def __init__(self, **kwargs):
         random.seed(2 + MPI.rank(mpi_comm_world()))
     def eval(self, values, x):
         values[0] = 0.63 + 0.02*(0.5 - random.random())
@@ -57,10 +57,10 @@ parameters["form_compiler"]["optimize"]     = True
 parameters["form_compiler"]["cpp_optimize"] = True
 parameters["form_compiler"]["representation"] = "quadrature"
 
-# Create mesh and define function spaces
+# Create mesh and build function space
 mesh = UnitSquareMesh(96, 96)
-V = FunctionSpace(mesh, "Lagrange", 1)
-ME = V*V
+P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+ME = FunctionSpace(mesh, P1*P1)
 
 # Define trial and test functions
 du    = TrialFunction(ME)
@@ -76,7 +76,7 @@ c,  mu  = split(u)
 c0, mu0 = split(u0)
 
 # Create intial conditions and interpolate
-u_init = InitialConditions()
+u_init = InitialConditions(degree=1)
 u.interpolate(u_init)
 u0.interpolate(u_init)
 
diff --git a/demo/documented/cahn-hilliard/python/documentation.rst b/demo/documented/cahn-hilliard/python/documentation.rst
index d5f6538..eb01d20 100644
--- a/demo/documented/cahn-hilliard/python/documentation.rst
+++ b/demo/documented/cahn-hilliard/python/documentation.rst
@@ -33,7 +33,7 @@ created:
 
     # Class representing the intial conditions
     class InitialConditions(Expression):
-        def __init__(self):
+        def __init__(self, **kwargs):
             random.seed(2 + MPI.rank(mpi_comm_world()))
         def eval(self, values, x):
             values[0] = 0.63 + 0.02*(0.5 - random.random())
@@ -112,20 +112,15 @@ the code and the generation phase may use considerably more memory).
 
 A unit square mesh with 97 (= 96 + 1) vertices in each direction is
 created, and on this mesh a :py:class:`FunctionSpace
-<dolfin.functions.functionspace.FunctionSpace>` :math:`V` and a
-:py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>` space :math:`ME =
-V \times V` are defined:
+<dolfin.functions.functionspace.FunctionSpace>` ``ME`` is built
+using a pair of linear Lagrangian elements.
 
 .. code-block:: python
 
-    # Create mesh and define function spaces
+    # Create mesh and build function space
     mesh = UnitSquareMesh(96, 96)
-    V = FunctionSpace(mesh, "Lagrange", 1)
-    ME = V*V
-
-The space ``V`` involves first-order continuous Lagrange basis functions.
-The mixed space is created using the ``*`` operator.
+    P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    ME = FunctionSpace(mesh, P1*P1)
 
 Trial and test functions of the space ``ME`` are now defined:
 
@@ -172,7 +167,7 @@ into a finite element space:
 .. code-block:: python
 
     # Create intial conditions and interpolate
-    u_init = InitialConditions()
+    u_init = InitialConditions(degree=1)
     u.interpolate(u_init)
     u0.interpolate(u_init)
 
diff --git a/demo/documented/eigenvalue/cpp/CMakeLists.txt b/demo/documented/eigenvalue/cpp/CMakeLists.txt
index b4baeb5..8f74ffe 100644
--- a/demo/documented/eigenvalue/cpp/CMakeLists.txt
+++ b/demo/documented/eigenvalue/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/eigenvalue/cpp/StiffnessMatrix.h b/demo/documented/eigenvalue/cpp/StiffnessMatrix.h
index dbb3f0e..9588be3 100644
--- a/demo/documented/eigenvalue/cpp/StiffnessMatrix.h
+++ b/demo/documented/eigenvalue/cpp/StiffnessMatrix.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __STIFFNESSMATRIX_H
 #define __STIFFNESSMATRIX_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class stiffnessmatrix_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stiffnessmatrix_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stiffnessmatrix_finite_element_0()
+  ~stiffnessmatrix_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -257,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -279,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -318,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -330,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -339,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1041,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1098,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1106,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1132,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1171,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1219,151 +1222,92 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new stiffnessmatrix_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stiffnessmatrix_dofmap_0: public ufc::dofmap
+class stiffnessmatrix_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  stiffnessmatrix_dofmap_0() : ufc::dofmap()
+  stiffnessmatrix_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stiffnessmatrix_dofmap_0()
+  ~stiffnessmatrix_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    case 3:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
   {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 4;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    case 3:
-      {
-        return 0;
+        return 3;
         break;
       }
     }
@@ -1371,298 +1315,3505 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    return 3;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-        break;
-      }
-    case 3:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-        break;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 3)
-    {
-    throw std::runtime_error("d is larger than dimension (3)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        
+        return 3;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  std::size_t reference_value_size() const final override
   {
-    return new stiffnessmatrix_dofmap_0();
-  }
-
-};
-
-/// 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 stiffnessmatrix_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  stiffnessmatrix_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
+    return 3;
   }
 
-  /// Destructor
-  virtual ~stiffnessmatrix_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    27
-    // Number of operations (multiply-add pairs) for tensor contraction: 28
-    // Total number of operations (multiply-add pairs):                  58
-    
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
     double detJ;
     compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
-    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
-    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
-    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
-    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
-    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
-    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
-    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
-    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
-    // Compute element tensor
-    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
-    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
-    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
-    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
-    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
-    A[5] = 0.166666666666667*G0_0_0;
-    A[6] = 0.166666666666667*G0_0_1;
-    A[7] = 0.166666666666667*G0_0_2;
-    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
-    A[9] = 0.166666666666667*G0_1_0;
-    A[10] = 0.166666666666667*G0_1_1;
-    A[11] = 0.166666666666667*G0_1_2;
-    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
-    A[13] = 0.166666666666667*G0_2_0;
-    A[14] = 0.166666666666667*G0_2_1;
-    A[15] = 0.166666666666667*G0_2_2;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class stiffnessmatrix_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  stiffnessmatrix_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stiffnessmatrix_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "a5657a1dd60218144b4fe2e36664f1098b8e80641236aae91a093d2ed5433f9d7c4918ac8fcd0edd9773e6cd40a0cb65ea22ad761a4d9e97dee820354f3788a6";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stiffnessmatrix_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new stiffnessmatrix_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new stiffnessmatrix_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stiffnessmatrix_finite_element_1();
+  }
+
+};
+
+
+class stiffnessmatrix_dofmap_0: public ufc::dofmap
+{
+public:
+
+  stiffnessmatrix_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~stiffnessmatrix_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new stiffnessmatrix_dofmap_0();
+  }
+
+};
+
+
+class stiffnessmatrix_dofmap_1: public ufc::dofmap
+{
+public:
+
+  stiffnessmatrix_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~stiffnessmatrix_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 3*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 9;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 3;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stiffnessmatrix_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new stiffnessmatrix_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new stiffnessmatrix_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new stiffnessmatrix_dofmap_1();
+  }
+
+};
+
+
+class stiffnessmatrix_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  stiffnessmatrix_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~stiffnessmatrix_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    27
+    // Number of operations (multiply-add pairs) for tensor contraction: 28
+    // Total number of operations (multiply-add pairs):                  58
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
+    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
+    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
+    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
+    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
+    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
+    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
+    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
+    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    
+    // Compute element tensor
+    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
+    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
+    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
+    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
+    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
+    A[5] = 0.166666666666667*G0_0_0;
+    A[6] = 0.166666666666667*G0_0_1;
+    A[7] = 0.166666666666667*G0_0_2;
+    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
+    A[9] = 0.166666666666667*G0_1_0;
+    A[10] = 0.166666666666667*G0_1_1;
+    A[11] = 0.166666666666667*G0_1_2;
+    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
+    A[13] = 0.166666666666667*G0_2_0;
+    A[14] = 0.166666666666667*G0_2_1;
+    A[15] = 0.166666666666667*G0_2_2;
+  }
+
+};
+
+
+class stiffnessmatrix_form_0: public ufc::form
+{
+public:
+
+  stiffnessmatrix_form_0() : ufc::form()
+  {
+    // Do nothing
+  }
+
+  ~stiffnessmatrix_form_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "f40249973629a3ed69f1938215fd750d79b950ffd1c814a6060dcf2b09f3ff6a624bed216e9e59900affbf436fffb41f50e98739baecf87fe3c491de99cd0f31";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 2;
+  }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stiffnessmatrix_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stiffnessmatrix_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1681,8 +4832,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1701,126 +4851,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stiffnessmatrix_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1834,14 +5020,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace StiffnessMatrix
 {
@@ -1850,43 +5042,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1897,63 +5066,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stiffnessmatrix_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1961,7 +5137,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stiffnessmatrix_form_0());
+    _ufc_form = std::make_shared<const stiffnessmatrix_form_0>();
   }
 
   // Destructor
@@ -1991,14 +5167,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/eigenvalue/cpp/compile.log b/demo/documented/eigenvalue/cpp/compile.log
index e21aa6b..aa4e02e 100644
--- a/demo/documented/eigenvalue/cpp/compile.log
+++ b/demo/documented/eigenvalue/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form StiffnessMatrix
 
@@ -12,26 +13,35 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<3 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.0542011 seconds.
+Compiler stage 1 finished in 0.113691 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -41,7 +51,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000842 seconds
+  144 entries computed in 0.000949 seconds
   Shape of reference tensor: (4, 4, 3, 3)
   Primary multi index:   rank = 2 dims = [4, 4] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -49,114 +59,164 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   External multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00444293 seconds.
+Compiler stage 2 finished in 0.0107231 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000165939 seconds.
+Compiler stage 3 finished in 0.000235796 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.072911 seconds.
+Compiler stage 4 finished in 0.461126 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000406027 seconds.
+Compiler stage 4.1 finished in 0.000633001 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./StiffnessMatrix.h.
-Compiler stage 5 finished in 0.00062108 seconds.
+Compiler stage 5 finished in 0.000978947 seconds.
 
-FFC finished in 0.133113 seconds.
+FFC finished in 0.58798 seconds.
+Output written to ./StiffnessMatrix.h.
diff --git a/demo/documented/eigenvalue/cpp/main.cpp b/demo/documented/eigenvalue/cpp/main.cpp
index b709c16..86a6aff 100644
--- a/demo/documented/eigenvalue/cpp/main.cpp
+++ b/demo/documented/eigenvalue/cpp/main.cpp
@@ -33,13 +33,13 @@ int main()
   #ifdef HAS_SLEPC
 
   // Create mesh
-  Mesh mesh("../box_with_dent.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../box_with_dent.xml.gz");
 
   // Build stiffness matrix
-  PETScMatrix A;
-  StiffnessMatrix::FunctionSpace V(mesh);
+  auto A = std::make_shared<PETScMatrix>();
+  auto V = std::make_shared<StiffnessMatrix::FunctionSpace>(mesh);
   StiffnessMatrix::BilinearForm a(V, V);
-  assemble(A, a);
+  assemble(*A, a);
 
   // Create eigensolver
   SLEPcEigenSolver esolver(A);
diff --git a/demo/documented/hyperelasticity/cpp/CMakeLists.txt b/demo/documented/hyperelasticity/cpp/CMakeLists.txt
index 584b592..d75e841 100644
--- a/demo/documented/hyperelasticity/cpp/CMakeLists.txt
+++ b/demo/documented/hyperelasticity/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/hyperelasticity/cpp/HyperElasticity.h b/demo/documented/hyperelasticity/cpp/HyperElasticity.h
index 9dd6ad6..b03f6b9 100644
--- a/demo/documented/hyperelasticity/cpp/HyperElasticity.h
+++ b/demo/documented/hyperelasticity/cpp/HyperElasticity.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,394 +13,107 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       False
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __HYPERELASTICITY_H
 #define __HYPERELASTICITY_H
-
 #include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class hyperelasticity_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   hyperelasticity_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_finite_element_0()
+  ~hyperelasticity_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Real', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Compute subdeterminants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-    vertex_values[3] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t value_size() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new hyperelasticity_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class hyperelasticity_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  hyperelasticity_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~hyperelasticity_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 4;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -409,9 +122,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -558,20 +271,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -580,26 +291,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -619,7 +328,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -631,7 +340,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -640,9 +349,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1342,28 +1051,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1399,7 +1106,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1407,22 +1114,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1433,36 +1138,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1472,46 +1177,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1520,98 +1223,110 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new hyperelasticity_finite_element_1();
+    return new hyperelasticity_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class hyperelasticity_finite_element_2: public ufc::finite_element
+class hyperelasticity_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  hyperelasticity_finite_element_2() : ufc::finite_element()
+  hyperelasticity_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_finite_element_2()
+  ~hyperelasticity_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1625,16 +1340,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1643,9 +1372,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -2034,20 +1763,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2056,7 +1783,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -2064,21 +1791,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2098,7 +1823,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2110,7 +1835,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -2119,9 +1844,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -4077,28 +3802,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4134,7 +3857,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -4142,22 +3865,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -4168,108 +3889,108 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 9:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 10:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 11:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -4279,86 +4000,84 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[8] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[10] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[11] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4377,46 +4096,69 @@ public:
     vertex_values[11] = dof_values[11];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 3;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_finite_element_1();
+        return new hyperelasticity_finite_element_0();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_finite_element_1();
+        return new hyperelasticity_finite_element_0();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_finite_element_1();
+        return new hyperelasticity_finite_element_0();
         break;
       }
     }
@@ -4424,264 +4166,333 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new hyperelasticity_finite_element_2();
+    return new hyperelasticity_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class hyperelasticity_dofmap_0: public ufc::dofmap
+class hyperelasticity_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  hyperelasticity_dofmap_0() : ufc::dofmap()
+  hyperelasticity_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_dofmap_0()
+  ~hyperelasticity_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FiniteElement('Real', tetrahedron, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    case 3:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    case 3:
-      {
-        return 1;
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  const char * family() const final override
   {
-    dofs[0] = 0;
+    return "Real";
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        
-        break;
-      }
-    }
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Compute subdeterminants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
     
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    if (d > 3)
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
     {
-    throw std::runtime_error("d is larger than dimension (3)");
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
     }
     
-    switch (d)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
     {
     case 0:
       {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     }
     
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+    vertex_values[3] = dof_values[0];
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    dof_coordinates[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
+    dof_coordinates[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
   }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::finite_element * create() const final override
   {
-    return new hyperelasticity_dofmap_0();
+    return new hyperelasticity_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class hyperelasticity_dofmap_1: public ufc::dofmap
+class hyperelasticity_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  hyperelasticity_dofmap_1() : ufc::dofmap()
+  hyperelasticity_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_dofmap_1()
+  ~hyperelasticity_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4710,39 +4521,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4771,20 +4571,18 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4820,9 +4618,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -4883,71 +4680,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new hyperelasticity_dofmap_1();
+    return new hyperelasticity_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class hyperelasticity_dofmap_2: public ufc::dofmap
+class hyperelasticity_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  hyperelasticity_dofmap_2() : ufc::dofmap()
+  hyperelasticity_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_dofmap_2()
+  ~hyperelasticity_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4976,39 +4747,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 9;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5037,32 +4797,30 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[0][0];
-    dofs[5] = offset + c.entity_indices[0][1];
-    dofs[6] = offset + c.entity_indices[0][2];
-    dofs[7] = offset + c.entity_indices[0][3];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[8] = offset + c.entity_indices[0][0];
-    dofs[9] = offset + c.entity_indices[0][1];
-    dofs[10] = offset + c.entity_indices[0][2];
-    dofs[11] = offset + c.entity_indices[0][3];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5122,9 +4880,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -5193,72 +4950,29 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = vertex_coordinates[6];
-    dof_coordinates[19] = vertex_coordinates[7];
-    dof_coordinates[20] = vertex_coordinates[8];
-    dof_coordinates[21] = vertex_coordinates[9];
-    dof_coordinates[22] = vertex_coordinates[10];
-    dof_coordinates[23] = vertex_coordinates[11];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[6];
-    dof_coordinates[31] = vertex_coordinates[7];
-    dof_coordinates[32] = vertex_coordinates[8];
-    dof_coordinates[33] = vertex_coordinates[9];
-    dof_coordinates[34] = vertex_coordinates[10];
-    dof_coordinates[35] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_dofmap_1();
+        return new hyperelasticity_dofmap_0();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_dofmap_1();
+        return new hyperelasticity_dofmap_0();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_dofmap_1();
+        return new hyperelasticity_dofmap_0();
         break;
       }
     }
@@ -5266,50 +4980,234 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new hyperelasticity_dofmap_2();
+    return new hyperelasticity_dofmap_1();
   }
 
 };
 
-/// 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 hyperelasticity_cell_integral_0_otherwise: public ufc::cell_integral
+class hyperelasticity_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  hyperelasticity_cell_integral_0_otherwise() : ufc::cell_integral()
+  hyperelasticity_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_cell_integral_0_otherwise()
+  ~hyperelasticity_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Real', tetrahedron, 0)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return false;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 0;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 0;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 1;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = 0;
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new hyperelasticity_dofmap_2();
+  }
+
+};
+
+
+class hyperelasticity_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  hyperelasticity_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~hyperelasticity_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, false, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -5330,84 +5228,84 @@ public:
     // Quadrature points on the UFC reference element: (0.585410196624969, 0.138196601125011, 0.138196601125011), (0.138196601125011, 0.585410196624969, 0.138196601125011), (0.138196601125011, 0.138196601125011, 0.585410196624969), (0.138196601125011, 0.138196601125011, 0.138196601125011)
     
     // Values of basis functions at quadrature points.
-    static const double FE0_C0[4][12] = \
+    static const double FE0[4][1] = \
+    {{1.0},
+    {1.0},
+    {1.0},
+    {1.0}};
+    
+    static const double FE1_C0[4][12] = \
     {{0.138196601125009, 0.585410196624969, 0.138196601125011, 0.138196601125011, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {0.138196601125009, 0.138196601125011, 0.585410196624969, 0.138196601125011, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {0.138196601125009, 0.138196601125011, 0.138196601125011, 0.585410196624969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {0.585410196624967, 0.138196601125011, 0.138196601125011, 0.138196601125011, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C0_D001[4][12] = \
+    static const double FE1_C0_D001[4][12] = \
     {{-1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {-1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {-1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {-1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C0_D010[4][12] = \
+    static const double FE1_C0_D010[4][12] = \
     {{-1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {-1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {-1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {-1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C0_D100[4][12] = \
+    static const double FE1_C0_D100[4][12] = \
     {{-1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {-1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {-1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {-1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C1[4][12] = \
+    static const double FE1_C1[4][12] = \
     {{0.0, 0.0, 0.0, 0.0, 0.138196601125009, 0.585410196624969, 0.138196601125011, 0.138196601125011, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, 0.138196601125009, 0.138196601125011, 0.585410196624969, 0.138196601125011, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, 0.138196601125009, 0.138196601125011, 0.138196601125011, 0.585410196624969, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, 0.585410196624967, 0.138196601125011, 0.138196601125011, 0.138196601125011, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C1_D001[4][12] = \
+    static const double FE1_C1_D001[4][12] = \
     {{0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C1_D010[4][12] = \
+    static const double FE1_C1_D010[4][12] = \
     {{0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C1_D100[4][12] = \
+    static const double FE1_C1_D100[4][12] = \
     {{0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C2[4][12] = \
+    static const double FE1_C2[4][12] = \
     {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.138196601125009, 0.585410196624969, 0.138196601125011, 0.138196601125011},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.138196601125009, 0.138196601125011, 0.585410196624969, 0.138196601125011},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.138196601125009, 0.138196601125011, 0.138196601125011, 0.585410196624969},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.585410196624967, 0.138196601125011, 0.138196601125011, 0.138196601125011}};
     
-    static const double FE0_C2_D001[4][12] = \
+    static const double FE1_C2_D001[4][12] = \
     {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0}};
     
-    static const double FE0_C2_D010[4][12] = \
+    static const double FE1_C2_D010[4][12] = \
     {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0}};
     
-    static const double FE0_C2_D100[4][12] = \
+    static const double FE1_C2_D100[4][12] = \
     {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0},
     {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0}};
     
-    static const double FE1[4][1] = \
-    {{1.0},
-    {1.0},
-    {1.0},
-    {1.0}};
-    
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 12; r++)
     {
@@ -5441,71 +5339,64 @@ public:
       // Total number of operations to compute function values = 4
       for (unsigned int r = 0; r < 1; r++)
       {
-        F0 += FE1[ip][0]*w[3][0];
-        F10 += FE1[ip][0]*w[4][0];
+        F0 += FE0[ip][0]*w[3][0];
+        F10 += FE0[ip][0]*w[4][0];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 288
       for (unsigned int r = 0; r < 12; r++)
       {
-        F1 += FE0_C0_D100[ip][r]*w[0][r];
-        F2 += FE0_C0_D010[ip][r]*w[0][r];
-        F3 += FE0_C0_D001[ip][r]*w[0][r];
-        F4 += FE0_C2_D100[ip][r]*w[0][r];
-        F5 += FE0_C2_D010[ip][r]*w[0][r];
-        F6 += FE0_C2_D001[ip][r]*w[0][r];
-        F7 += FE0_C1_D100[ip][r]*w[0][r];
-        F8 += FE0_C1_D010[ip][r]*w[0][r];
-        F9 += FE0_C1_D001[ip][r]*w[0][r];
-        F11 += FE0_C0[ip][r]*w[1][r];
-        F12 += FE0_C1[ip][r]*w[1][r];
-        F13 += FE0_C2[ip][r]*w[1][r];
+        F1 += FE1_C0_D100[ip][r]*w[0][r];
+        F2 += FE1_C0_D010[ip][r]*w[0][r];
+        F3 += FE1_C0_D001[ip][r]*w[0][r];
+        F4 += FE1_C2_D100[ip][r]*w[0][r];
+        F5 += FE1_C2_D010[ip][r]*w[0][r];
+        F6 += FE1_C2_D001[ip][r]*w[0][r];
+        F7 += FE1_C1_D100[ip][r]*w[0][r];
+        F8 += FE1_C1_D010[ip][r]*w[0][r];
+        F9 += FE1_C1_D001[ip][r]*w[0][r];
+        F11 += FE1_C0[ip][r]*w[1][r];
+        F12 += FE1_C1[ip][r]*w[1][r];
+        F13 += FE1_C2[ip][r]*w[1][r];
       } // end loop over 'r'
       
       // Number of operations for primary indices: 11520
       for (unsigned int j = 0; j < 12; j++)
       {
         // Number of operations to compute entry: 960
-        A[j] += ((((((((((((((K[0]*FE0_C1_D100[ip][j] + K[3]*FE0_C1_D010[ip][j] + K[6]*FE0_C1_D001[ip][j]))*(((K[2]*F4 + K[5]*F5 + K[8]*F6) + 1.0)) + ((K[2]*FE0_C2_D100[ip][j] + K[5]*FE0_C2_D010[ip][j] + K[8]*FE0_C2_D001[ip][j]))*((K[0]*F7 + K[3]*F8 + K[6]*F9))))*(-1.0) + (((K[0]*FE0_C2_D100[ip][j] + K[3]*FE0_C2_D010[ip][j] + K[6]*FE0_C2_D001[ip][j]))*((K[2]*F7 + K[5]*F8 + K[8]*F9)) + ((K[2]*FE0_C1_D100[ip][j] + K[5]*FE0_C1_D010[ip][j] + K[8]*FE0_C1_D001[ip][j]))*((K[0]*F4 + K[3]*F5 + K[ [...]
+        A[j] += ((((((((((((((K[0]*FE1_C1_D100[ip][j] + K[3]*FE1_C1_D010[ip][j] + K[6]*FE1_C1_D001[ip][j]))*(((K[2]*F4 + K[5]*F5 + K[8]*F6) + 1.0)) + ((K[2]*FE1_C2_D100[ip][j] + K[5]*FE1_C2_D010[ip][j] + K[8]*FE1_C2_D001[ip][j]))*((K[0]*F7 + K[3]*F8 + K[6]*F9))))*(-1.0) + (((K[0]*FE1_C2_D100[ip][j] + K[3]*FE1_C2_D010[ip][j] + K[6]*FE1_C2_D001[ip][j]))*((K[2]*F7 + K[5]*F8 + K[8]*F9)) + ((K[2]*FE1_C1_D100[ip][j] + K[5]*FE1_C1_D010[ip][j] + K[8]*FE1_C1_D001[ip][j]))*((K[0]*F4 + K[3]*F5 + K[ [...]
       } // end loop over 'j'
     } // end loop over 'ip'
   }
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class hyperelasticity_exterior_facet_integral_0_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   hyperelasticity_exterior_facet_integral_0_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_exterior_facet_integral_0_otherwise()
+  ~hyperelasticity_exterior_facet_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, false, true, false, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      59
     // Number of operations (multiply-add pairs) for geometry tensor:    12
@@ -5514,7 +5405,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -5528,11 +5419,11 @@ public:
     const unsigned int v2 = face_vertices[facet][2];
     
     // Compute scale factor (area of face scaled by area of reference triangle)
-    const double a0 = (vertex_coordinates[3*v0 + 1]*vertex_coordinates[3*v1 + 2]  + vertex_coordinates[3*v0 + 2]*vertex_coordinates[3*v2 + 1]  + vertex_coordinates[3*v1 + 1]*vertex_coordinates[3*v2 + 2]) - (vertex_coordinates[3*v2 + 1]*vertex_coordinates[3*v1 + 2] + vertex_coordinates[3*v2 + 2]*vertex_coordinates[3*v0 + 1] + vertex_coordinates[3*v1 + 1]*vertex_coordinates[3*v0 + 2]);
+    const double a0 = (coordinate_dofs[3*v0 + 1]*coordinate_dofs[3*v1 + 2]  + coordinate_dofs[3*v0 + 2]*coordinate_dofs[3*v2 + 1]  + coordinate_dofs[3*v1 + 1]*coordinate_dofs[3*v2 + 2]) - (coordinate_dofs[3*v2 + 1]*coordinate_dofs[3*v1 + 2] + coordinate_dofs[3*v2 + 2]*coordinate_dofs[3*v0 + 1] + coordinate_dofs[3*v1 + 1]*coordinate_dofs[3*v0 + 2]);
     
-    const double a1 = (vertex_coordinates[3*v0 + 2]*vertex_coordinates[3*v1 + 0]  + vertex_coordinates[3*v0 + 0]*vertex_coordinates[3*v2 + 2] + vertex_coordinates[3*v1 + 2]*vertex_coordinates[3*v2 + 0]) - (vertex_coordinates[3*v2 + 2]*vertex_coordinates[3*v1 + 0]  + vertex_coordinates[3*v2 + 0]*vertex_coordinates[3*v0 + 2] + vertex_coordinates[3*v1 + 2]*vertex_coordinates[3*v0 + 0]);
+    const double a1 = (coordinate_dofs[3*v0 + 2]*coordinate_dofs[3*v1 + 0]  + coordinate_dofs[3*v0 + 0]*coordinate_dofs[3*v2 + 2] + coordinate_dofs[3*v1 + 2]*coordinate_dofs[3*v2 + 0]) - (coordinate_dofs[3*v2 + 2]*coordinate_dofs[3*v1 + 0]  + coordinate_dofs[3*v2 + 0]*coordinate_dofs[3*v0 + 2] + coordinate_dofs[3*v1 + 2]*coordinate_dofs[3*v0 + 0]);
     
-    const double a2 = (vertex_coordinates[3*v0 + 0]*vertex_coordinates[3*v1 + 1]  + vertex_coordinates[3*v0 + 1]*vertex_coordinates[3*v2 + 0]  + vertex_coordinates[3*v1 + 0]*vertex_coordinates[3*v2 + 1]) - (vertex_coordinates[3*v2 + 0]*vertex_coordinates[3*v1 + 1]  + vertex_coordinates[3*v2 + 1]*vertex_coordinates[3*v0 + 0]  + vertex_coordinates[3*v1 + 0]*vertex_coordinates[3*v0 + 1]);
+    const double a2 = (coordinate_dofs[3*v0 + 0]*coordinate_dofs[3*v1 + 1]  + coordinate_dofs[3*v0 + 1]*coordinate_dofs[3*v2 + 0]  + coordinate_dofs[3*v1 + 0]*coordinate_dofs[3*v2 + 1]) - (coordinate_dofs[3*v2 + 0]*coordinate_dofs[3*v1 + 1]  + coordinate_dofs[3*v2 + 1]*coordinate_dofs[3*v0 + 0]  + coordinate_dofs[3*v1 + 0]*coordinate_dofs[3*v0 + 1]);
     
     const double det = std::sqrt(a0*a0 + a1*a1 + a2*a2);
     
@@ -5624,42 +5515,35 @@ public:
 
 };
 
-/// 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 hyperelasticity_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   hyperelasticity_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_cell_integral_1_otherwise()
+  ~hyperelasticity_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -5680,36 +5564,36 @@ public:
     // Quadrature points on the UFC reference element: (0.25, 0.25, 0.25)
     
     // Values of basis functions at quadrature points.
-    static const double FE0_C0_D001[1][12] = \
+    static const double FE0[1][1] = \
+    {{1.0}};
+    
+    static const double FE1_C0_D001[1][12] = \
     {{-1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C0_D010[1][12] = \
+    static const double FE1_C0_D010[1][12] = \
     {{-1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C0_D100[1][12] = \
+    static const double FE1_C0_D100[1][12] = \
     {{-1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C1_D001[1][12] = \
+    static const double FE1_C1_D001[1][12] = \
     {{0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C1_D010[1][12] = \
+    static const double FE1_C1_D010[1][12] = \
     {{0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C1_D100[1][12] = \
+    static const double FE1_C1_D100[1][12] = \
     {{0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C2_D001[1][12] = \
+    static const double FE1_C2_D001[1][12] = \
     {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0}};
     
-    static const double FE0_C2_D010[1][12] = \
+    static const double FE1_C2_D010[1][12] = \
     {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0}};
     
-    static const double FE0_C2_D100[1][12] = \
+    static const double FE1_C2_D100[1][12] = \
     {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0}};
     
-    static const double FE1[1][1] = \
-    {{1.0}};
-    
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 144; r++)
     {
@@ -5740,22 +5624,22 @@ public:
       // Total number of operations to compute function values = 4
       for (unsigned int r = 0; r < 1; r++)
       {
-        F0 += FE1[0][0]*w[1][0];
-        F10 += FE1[0][0]*w[2][0];
+        F0 += FE0[0][0]*w[1][0];
+        F10 += FE0[0][0]*w[2][0];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 216
       for (unsigned int r = 0; r < 12; r++)
       {
-        F1 += FE0_C2_D100[0][r]*w[0][r];
-        F2 += FE0_C2_D010[0][r]*w[0][r];
-        F3 += FE0_C2_D001[0][r]*w[0][r];
-        F4 += FE0_C1_D100[0][r]*w[0][r];
-        F5 += FE0_C1_D010[0][r]*w[0][r];
-        F6 += FE0_C1_D001[0][r]*w[0][r];
-        F7 += FE0_C0_D100[0][r]*w[0][r];
-        F8 += FE0_C0_D010[0][r]*w[0][r];
-        F9 += FE0_C0_D001[0][r]*w[0][r];
+        F1 += FE1_C2_D100[0][r]*w[0][r];
+        F2 += FE1_C2_D010[0][r]*w[0][r];
+        F3 += FE1_C2_D001[0][r]*w[0][r];
+        F4 += FE1_C1_D100[0][r]*w[0][r];
+        F5 += FE1_C1_D010[0][r]*w[0][r];
+        F6 += FE1_C1_D001[0][r]*w[0][r];
+        F7 += FE1_C0_D100[0][r]*w[0][r];
+        F8 += FE1_C0_D010[0][r]*w[0][r];
+        F9 += FE1_C0_D001[0][r]*w[0][r];
       } // end loop over 'r'
       
       // Number of operations for primary indices: 492048
@@ -5764,7 +5648,7 @@ public:
         for (unsigned int k = 0; k < 12; k++)
         {
           // Number of operations to compute entry: 3417
-          A[j*12 + k] += (((((((((((((((((K[0]*FE0_C1_D100[0][k] + K[3]*FE0_C1_D010[0][k] + K[6]*FE0_C1_D001[0][k]))*(((K[2]*F1 + K[5]*F2 + K[8]*F3) + 1.0)) + ((K[2]*FE0_C2_D100[0][k] + K[5]*FE0_C2_D010[0][k] + K[8]*FE0_C2_D001[0][k]))*((K[0]*F4 + K[3]*F5 + K[6]*F6))))*(-1.0) + (((K[0]*FE0_C2_D100[0][k] + K[3]*FE0_C2_D010[0][k] + K[6]*FE0_C2_D001[0][k]))*((K[2]*F4 + K[5]*F5 + K[8]*F6)) + ((K[2]*FE0_C1_D100[0][k] + K[5]*FE0_C1_D010[0][k] + K[8]*FE0_C1_D001[0][k]))*((K[0]*F1 + K[3]*F2 + K[ [...]
+          A[j*12 + k] += (((((((((((((((((K[0]*FE1_C1_D100[0][k] + K[3]*FE1_C1_D010[0][k] + K[6]*FE1_C1_D001[0][k]))*(((K[2]*F1 + K[5]*F2 + K[8]*F3) + 1.0)) + ((K[2]*FE1_C2_D100[0][k] + K[5]*FE1_C2_D010[0][k] + K[8]*FE1_C2_D001[0][k]))*((K[0]*F4 + K[3]*F5 + K[6]*F6))))*(-1.0) + (((K[0]*FE1_C2_D100[0][k] + K[3]*FE1_C2_D010[0][k] + K[6]*FE1_C2_D001[0][k]))*((K[2]*F4 + K[5]*F5 + K[8]*F6)) + ((K[2]*FE1_C1_D100[0][k] + K[5]*FE1_C1_D010[0][k] + K[8]*FE1_C1_D001[0][k]))*((K[0]*F1 + K[3]*F2 + K[ [...]
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -5772,97 +5656,89 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class hyperelasticity_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   hyperelasticity_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_form_0()
+  ~hyperelasticity_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "1ffae2b29e3ce8cf38b12fc29f24442c96dcafb2cef5059fe0cca6ac5c643a02e6b6e88ca96c9a1a08c1eb9c31bea053100d68dc0a4054f6583b50f3a492a55f";
+    return "a07b9447da6ae9d949071750728923b9a3830037df8dc006b3d5d1a798c395ca9f4f9042a3d9dc5ac3f20404c374f55a83569594155770a581a577ace2d220c2";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 5;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3, 4});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new hyperelasticity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new hyperelasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 3:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 4:
       {
-        return new hyperelasticity_finite_element_0();
+        return new hyperelasticity_finite_element_2();
         break;
       }
     case 5:
       {
-        return new hyperelasticity_finite_element_0();
+        return new hyperelasticity_finite_element_2();
         break;
       }
     }
@@ -5870,39 +5746,38 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 3:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 4:
       {
-        return new hyperelasticity_dofmap_0();
+        return new hyperelasticity_dofmap_2();
         break;
       }
     case 5:
       {
-        return new hyperelasticity_dofmap_0();
+        return new hyperelasticity_dofmap_2();
         break;
       }
     }
@@ -5910,218 +5785,246 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_interface_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  bool has_overlap_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return new hyperelasticity_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return new hyperelasticity_exterior_facet_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return new hyperelasticity_cell_integral_0_otherwise();
+  }
 
-class hyperelasticity_form_1: public ufc::form
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return new hyperelasticity_exterior_facet_integral_0_otherwise();
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
+  {
+    return 0;
+  }
+
+};
+
+
+class hyperelasticity_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   hyperelasticity_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_form_1()
+  ~hyperelasticity_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "55caaffb330df012804263370547325ced2257e2f4bc4310a0290e1571b8cb9e2ca7fca19810676ff019d40c44e4f4205da1b0cd0c42da94c6b4d1264499e2fa";
+    return "89b4df7f5669048713d37817883c73cd4ce5dc8d75fb4c6225803635d0742d0817b6a13559cd5dca2c8aaa5729e7969608bcc70b489943c2173ef1583e467241";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 3;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 3, 4});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new hyperelasticity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new hyperelasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 3:
       {
-        return new hyperelasticity_finite_element_0();
+        return new hyperelasticity_finite_element_2();
         break;
       }
     case 4:
       {
-        return new hyperelasticity_finite_element_0();
+        return new hyperelasticity_finite_element_2();
         break;
       }
     }
@@ -6129,34 +6032,33 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 3:
       {
-        return new hyperelasticity_dofmap_0();
+        return new hyperelasticity_dofmap_2();
         break;
       }
     case 4:
       {
-        return new hyperelasticity_dofmap_0();
+        return new hyperelasticity_dofmap_2();
         break;
       }
     }
@@ -6164,126 +6066,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new hyperelasticity_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -6297,14 +6235,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace HyperElasticity
 {
@@ -6313,43 +6257,20 @@ class CoefficientSpace_B: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_B(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_B(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_B(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_B(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6360,43 +6281,20 @@ class CoefficientSpace_T: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_T(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_T(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_T(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_T(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6407,43 +6305,20 @@ class CoefficientSpace_lmbda: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6454,43 +6329,20 @@ class CoefficientSpace_mu: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6501,43 +6353,20 @@ class CoefficientSpace_u: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6548,45 +6377,42 @@ class Form_F_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_F_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_F_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_F_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -6606,19 +6432,19 @@ class Form_F: public dolfin::Form
 public:
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 5), u(*this, 0), B(*this, 1), T(*this, 2), mu(*this, 3), lmbda(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
+    _ufc_form = std::make_shared<const hyperelasticity_form_0>();
   }
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& B, const dolfin::GenericFunction& T, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> B, std::shared_ptr<const dolfin::GenericFunction> T, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
     dolfin::Form(1, 5), u(*this, 0), B(*this, 1), T(*this, 2), mu(*this, 3), lmbda(*this, 4)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->u = u;
     this->B = B;
@@ -6626,65 +6452,122 @@ public:
     this->mu = mu;
     this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
+    _ufc_form = std::make_shared<const hyperelasticity_form_0>();
   }
 
-  // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> B, std::shared_ptr<const dolfin::GenericFunction> T, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(1, 5), u(*this, 0), B(*this, 1), T(*this, 2), mu(*this, 3), lmbda(*this, 4)
+  // Destructor
+  ~Form_F()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    if (name == "u")
+      return 0;
+    else if (name == "B")
+      return 1;
+    else if (name == "T")
+      return 2;
+    else if (name == "mu")
+      return 3;
+    else if (name == "lmbda")
+      return 4;
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
 
-    this->u = *u;
-    this->B = *B;
-    this->T = *T;
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "u";
+    case 1:
+      return "B";
+    case 2:
+      return "T";
+    case 3:
+      return "mu";
+    case 4:
+      return "lmbda";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_F_FunctionSpace_1 CoefficientSpace_u;
+  typedef Form_F_FunctionSpace_2 CoefficientSpace_B;
+  typedef Form_F_FunctionSpace_3 CoefficientSpace_T;
+  typedef Form_F_FunctionSpace_4 CoefficientSpace_mu;
+  typedef Form_F_FunctionSpace_5 CoefficientSpace_lmbda;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+  dolfin::CoefficientAssigner B;
+  dolfin::CoefficientAssigner T;
+  dolfin::CoefficientAssigner mu;
+  dolfin::CoefficientAssigner lmbda;
+};
+
+class MultiMeshForm_F: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 5), u(*this, 0), B(*this, 1), T(*this, 2), mu(*this, 3), lmbda(*this, 4)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), u(*this, 0), B(*this, 1), T(*this, 2), mu(*this, 3), lmbda(*this, 4)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
   }
 
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& B, const dolfin::GenericFunction& T, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
-    dolfin::Form(1, 5), u(*this, 0), B(*this, 1), T(*this, 2), mu(*this, 3), lmbda(*this, 4)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> B, std::shared_ptr<const dolfin::GenericFunction> T, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
+    dolfin::MultiMeshForm(V0), u(*this, 0), B(*this, 1), T(*this, 2), mu(*this, 3), lmbda(*this, 4)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
+    /// Assign coefficients
     this->u = u;
     this->B = B;
     this->T = T;
     this->mu = mu;
     this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
-  }
-
-  // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> B, std::shared_ptr<const dolfin::GenericFunction> T, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(1, 5), u(*this, 0), B(*this, 1), T(*this, 2), mu(*this, 3), lmbda(*this, 4)
-  {
-    _function_spaces[0] = V0;
-
-    this->u = *u;
-    this->B = *B;
-    this->T = *T;
-    this->mu = *mu;
-    this->lmbda = *lmbda;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
   }
 
   // Destructor
-  ~Form_F()
+  ~MultiMeshForm_F()
   {}
 
   /// Return the number of the coefficient with this name
@@ -6732,6 +6615,7 @@ public:
 
   // Typedefs
   typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_F_FunctionSpace_1 CoefficientSpace_u;
   typedef Form_F_FunctionSpace_2 CoefficientSpace_B;
   typedef Form_F_FunctionSpace_3 CoefficientSpace_T;
@@ -6739,54 +6623,31 @@ public:
   typedef Form_F_FunctionSpace_5 CoefficientSpace_lmbda;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
-  dolfin::CoefficientAssigner B;
-  dolfin::CoefficientAssigner T;
-  dolfin::CoefficientAssigner mu;
-  dolfin::CoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner B;
+  dolfin::MultiMeshCoefficientAssigner T;
+  dolfin::MultiMeshCoefficientAssigner mu;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
 };
 
 class Form_J_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6797,45 +6658,62 @@ class Form_J_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_J_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+};
+
+class Form_J_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -6851,83 +6729,130 @@ class Form_J: public dolfin::Form
 public:
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
+    _ufc_form = std::make_shared<const hyperelasticity_form_1>();
   }
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
     dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->u = u;
     this->mu = mu;
     this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
+    _ufc_form = std::make_shared<const hyperelasticity_form_1>();
   }
 
-  // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_J()
+  {}
 
-    this->u = *u;
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "u")
+      return 0;
+    else if (name == "mu")
+      return 1;
+    else if (name == "lmbda")
+      return 2;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "u";
+    case 1:
+      return "mu";
+    case 2:
+      return "lmbda";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_J_FunctionSpace_0 TestSpace;
+  typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
+  typedef Form_J_FunctionSpace_3 CoefficientSpace_mu;
+  typedef Form_J_FunctionSpace_4 CoefficientSpace_lmbda;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+  dolfin::CoefficientAssigner mu;
+  dolfin::CoefficientAssigner lmbda;
+};
+
+class MultiMeshForm_J: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
-    dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->u = u;
-    this->mu = mu;
-    this->lmbda = lmbda;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
   }
 
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->u = *u;
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+    /// Assign coefficients
+    this->u = u;
+    this->mu = mu;
+    this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
   }
 
   // Destructor
-  ~Form_J()
+  ~MultiMeshForm_J()
   {}
 
   /// Return the number of the coefficient with this name
@@ -6968,22 +6893,29 @@ public:
   // Typedefs
   typedef Form_J_FunctionSpace_0 TestSpace;
   typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
   typedef Form_J_FunctionSpace_3 CoefficientSpace_mu;
   typedef Form_J_FunctionSpace_4 CoefficientSpace_lmbda;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
-  dolfin::CoefficientAssigner mu;
-  dolfin::CoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner mu;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
 };
 
 // Class typedefs
 typedef Form_J BilinearForm;
+typedef MultiMeshForm_J MultiMeshBilinearForm;
 typedef Form_J JacobianForm;
+typedef MultiMeshForm_J MultiMeshJacobianForm;
 typedef Form_F LinearForm;
+typedef MultiMeshForm_F MultiMeshLinearForm;
 typedef Form_F ResidualForm;
+typedef MultiMeshForm_F MultiMeshResidualForm;
 typedef Form_F::TestSpace FunctionSpace;
+typedef Form_F::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/hyperelasticity/cpp/HyperElasticity.ufl b/demo/documented/hyperelasticity/cpp/HyperElasticity.ufl
index e2aa5b3..53ab95e 100644
--- a/demo/documented/hyperelasticity/cpp/HyperElasticity.ufl
+++ b/demo/documented/hyperelasticity/cpp/HyperElasticity.ufl
@@ -38,7 +38,7 @@ B = Coefficient(element)        # Body force per unit volume
 T = Coefficient(element)        # Traction force on the boundary
 
 # Kinematics
-d = u.geometric_dimension()
+d = len(u)
 I = Identity(d)                 # Identity tensor
 F = I + grad(u)                 # Deformation gradient
 C = F.T*F                       # Right Cauchy-Green tensor
diff --git a/demo/documented/hyperelasticity/cpp/compile.log b/demo/documented/hyperelasticity/cpp/compile.log
index 6f1c8d5..7b72a35 100644
--- a/demo/documented/hyperelasticity/cpp/compile.log
+++ b/demo/documented/hyperelasticity/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form HyperElasticity
 
@@ -20,9 +21,9 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -36,9 +37,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -53,11 +54,11 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.127291 seconds.
+Compiler stage 1 finished in 0.200946 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -67,10 +68,15 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -80,7 +86,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {4: {FiniteElement('Real', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.]])}}}, VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1.],
+  {4: {FiniteElement('Real', tetrahedron, 0): {None: {None: {(0, 0, 0): array([[ 1.,  1.,  1.,  1.]])}}}, VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1., -1., -1., -1.],
           [ 0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.]],
   
@@ -339,7 +345,58 @@ Compiler stage 2: Computing intermediate representation
              1.00000000e+00]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.1381966,  0.1381966,  0.5854102,  0.1381966,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.1381966,  0.1381966,  0.1381966,  0.5854102,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.5854102,  0.1381966,  0.1381966,  0.1381966,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ]]), 'FE1_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.5854102,  0.1381966,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.1381966,  0.5854102,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.1381966,  0.1381966,  0.5854102,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.5854102,
+           0.1381966,  0.1381966,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ]]), 'FE1_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.5854102,
+           0.1381966,  0.1381966],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
+           0.5854102,  0.1381966],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
+           0.1381966,  0.5854102],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.5854102,  0.1381966,
+           0.1381966,  0.1381966]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
            -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
@@ -354,22 +411,22 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -2.77555756e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -384,7 +441,16 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
            -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
@@ -399,28 +465,24 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -2.77555756e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+  
+  tables: {'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -435,35 +497,7 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.5854102,
-           0.1381966,  0.1381966],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
-           0.5854102,  0.1381966],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
-           0.1381966,  0.5854102],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.5854102,  0.1381966,
-           0.1381966,  0.1381966]]), 'FE0_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.5854102,  0.1381966,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.1381966,  0.5854102,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.1381966,  0.1381966,  0.5854102,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.5854102,
-           0.1381966,  0.1381966,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ]]), 'FE0_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
            0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
            0.       ,  0.       ],
          [ 0.1381966,  0.1381966,  0.5854102,  0.1381966,  0.       ,
@@ -474,9 +508,32 @@ Compiler stage 2: Computing intermediate representation
            0.       ,  0.       ],
          [ 0.5854102,  0.1381966,  0.1381966,  0.1381966,  0.       ,
            0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ]])}
-  
-  tables: {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.       ,  0.       ]]), 'FE1_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.5854102,  0.1381966,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.1381966,  0.5854102,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.1381966,  0.1381966,  0.5854102,  0.       ,  0.       ,
+           0.       ,  0.       ],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.5854102,
+           0.1381966,  0.1381966,  0.1381966,  0.       ,  0.       ,
+           0.       ,  0.       ]]), 'FE1_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.5854102,
+           0.1381966,  0.1381966],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
+           0.5854102,  0.1381966],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
+           0.1381966,  0.5854102],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.5854102,  0.1381966,
+           0.1381966,  0.1381966]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
            -5.55111512e-17,   0.00000000e+00,   1.00000000e+00],
@@ -491,22 +548,22 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -2.77555756e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -521,7 +578,16 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
            -1.11022302e-16,   1.00000000e+00,   0.00000000e+00],
@@ -536,71 +602,32 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -2.77555756e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -3.33066907e-16,  -1.11022302e-16,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -3.33066907e-16,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.5854102,
-           0.1381966,  0.1381966],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
-           0.5854102,  0.1381966],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
-           0.1381966,  0.5854102],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.5854102,  0.1381966,
-           0.1381966,  0.1381966]]), 'FE0_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.5854102,  0.1381966,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.1381966,  0.5854102,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
-           0.1381966,  0.1381966,  0.5854102,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.5854102,
-           0.1381966,  0.1381966,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ]]), 'FE0_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+  
+  name_map: {}
+  
+  inv_name_map: {'FE1_C0_D001': 'FE1_C0_D001', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE1_C0_D100': 'FE1_C0_D100', 'FE1_C2_D001': 'FE1_C2_D001', 'FE1_C0_D010': 'FE1_C0_D010', 'FE1_C1_D010': 'FE1_C1_D010', 'FE1_C1_D100': 'FE1_C1_D100', 'FE1_C2_D100': 'FE1_C2_D100', 'FE0': 'FE0', 'FE1_C2_D010': 'FE1_C2_D010', 'FE1_C1_D001': 'FE1_C1_D001'}
+  
+  QG-utils, psi_tables, unique_tables:
+  {'FE1_C0_D001': array([[-1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
            0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
            0.       ,  0.       ],
          [ 0.1381966,  0.1381966,  0.5854102,  0.1381966,  0.       ,
@@ -611,55 +638,7 @@ Compiler stage 2: Computing intermediate representation
            0.       ,  0.       ],
          [ 0.5854102,  0.1381966,  0.1381966,  0.1381966,  0.       ,
            0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ]])}
-  
-  name_map: {}
-  
-  inv_name_map: {'FE0_C2_D001': 'FE0_C2_D001', 'FE0_C1_D001': 'FE0_C1_D001', 'FE0_C1_D010': 'FE0_C1_D010', 'FE0_C2_D010': 'FE0_C2_D010', 'FE0_C1_D100': 'FE0_C1_D100', 'FE0_C0_D100': 'FE0_C0_D100', 'FE0_C0_D010': 'FE0_C0_D010', 'FE0_C0_D001': 'FE0_C0_D001', 'FE1': 'FE1', 'FE0_C2_D100': 'FE0_C2_D100', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE0_C2_D001': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.]]), 'FE0_C1_D001': array([[ 0.,  0.,  0.,  0., -1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C1_D010': array([[ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C2_D010': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  0.]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D010': array([[-1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D001': array([[-1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.5854102,
-           0.1381966,  0.1381966],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
-           0.5854102,  0.1381966],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
-           0.1381966,  0.5854102],
-         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.5854102,  0.1381966,
-           0.1381966,  0.1381966]]), 'FE0_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
+           0.       ,  0.       ]]), 'FE1_C1': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
            0.5854102,  0.1381966,  0.1381966,  0.       ,  0.       ,
            0.       ,  0.       ],
          [ 0.       ,  0.       ,  0.       ,  0.       ,  0.1381966,
@@ -670,21 +649,48 @@ Compiler stage 2: Computing intermediate representation
            0.       ,  0.       ],
          [ 0.       ,  0.       ,  0.       ,  0.       ,  0.5854102,
            0.1381966,  0.1381966,  0.1381966,  0.       ,  0.       ,
-           0.       ,  0.       ]]), 'FE0_C0': array([[ 0.1381966,  0.5854102,  0.1381966,  0.1381966,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.1381966,  0.1381966,  0.5854102,  0.1381966,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.1381966,  0.1381966,  0.1381966,  0.5854102,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ],
-         [ 0.5854102,  0.1381966,  0.1381966,  0.1381966,  0.       ,
-           0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
-           0.       ,  0.       ]])}
+           0.       ,  0.       ]]), 'FE1_C2': array([[ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.5854102,
+           0.1381966,  0.1381966],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
+           0.5854102,  0.1381966],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.1381966,  0.1381966,
+           0.1381966,  0.5854102],
+         [ 0.       ,  0.       ,  0.       ,  0.       ,  0.       ,
+           0.       ,  0.       ,  0.       ,  0.5854102,  0.1381966,
+           0.1381966,  0.1381966]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.]]), 'FE1_C0_D010': array([[-1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [-1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C1_D010': array([[ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C2_D010': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  0.]]), 'FE1_C1_D001': array([[ 0.,  0.,  0.,  0., -1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.],
+         [ 0.,  0.,  0.,  0., -1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C2_D001': ('FE0_C2_D001', (), False, False), 'FE0_C1_D001': ('FE0_C1_D001', (), False, False), 'FE0_C1_D010': ('FE0_C1_D010', (), False, False), 'FE0_C2_D010': ('FE0_C2_D010', (), False, False), 'FE0_C1_D100': ('FE0_C1_D100', (), False, False), 'FE0_C0_D100': ('FE0_C0_D100', (), False, False), 'FE0_C0_D010': ('FE0_C0_D010', (), False, False), 'FE0_C0_D001': ('FE0_C0_D001', (), False, False), 'FE1': ('FE1', (), False, True), 'FE0_C2_D100': ('FE0_C2_D100', (), False, False), 'FE0_C [...]
+  {'FE1_C0_D001': ('FE1_C0_D001', (), False, False), 'FE1_C0': ('FE1_C0', (), False, False), 'FE1_C1': ('FE1_C1', (), False, False), 'FE1_C2': ('FE1_C2', (), False, False), 'FE1_C0_D100': ('FE1_C0_D100', (), False, False), 'FE1_C2_D001': ('FE1_C2_D001', (), False, False), 'FE1_C0_D010': ('FE1_C0_D010', (), False, False), 'FE1_C1_D010': ('FE1_C1_D010', (), False, False), 'FE1_C1_D100': ('FE1_C1_D100', (), False, False), 'FE1_C2_D100': ('FE1_C2_D100', (), False, False), 'FE0': ('FE0', (),  [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -753,7 +759,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.00157 seconds
+  144 entries computed in 0.00199 seconds
   Shape of reference tensor: (12, 12)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -762,7 +768,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.00147 seconds
+  144 entries computed in 0.00177 seconds
   Shape of reference tensor: (12, 12)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -771,7 +777,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.00148 seconds
+  144 entries computed in 0.00179 seconds
   Shape of reference tensor: (12, 12)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -780,7 +786,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.00161 seconds
+  144 entries computed in 0.00178 seconds
   Shape of reference tensor: (12, 12)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -798,7 +804,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {FiniteElement('Real', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0, 0): array([[ 1.]])}}}, VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1.],
+  {1: {FiniteElement('Real', tetrahedron, 0): {None: {None: {(0, 0, 0): array([[ 1.]])}}}, VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1.],
           [ 0.],
           [ 0.]],
   
@@ -985,64 +991,64 @@ Compiler stage 2: Computing intermediate representation
           [  1.00000000e+00]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+  {'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
+           0.25,  0.25,  0.25]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
-           0.25,  0.25,  0.25]]), 'FE0_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE0_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
-           0.  ,  0.  ,  0.  ]])}
-  
-  tables: {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0': array([[ 1.]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+  
+  tables: {'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
+           0.25,  0.25,  0.25]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0': array([[ 1.]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
-           0.25,  0.25,  0.25]]), 'FE0_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE0_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
-           0.  ,  0.  ,  0.  ]])}
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
   
   name_map: {}
   
-  inv_name_map: {'FE0_C2_D001': 'FE0_C2_D001', 'FE0_C1_D001': 'FE0_C1_D001', 'FE0_C1_D010': 'FE0_C1_D010', 'FE0_C2_D010': 'FE0_C2_D010', 'FE0_C1_D100': 'FE0_C1_D100', 'FE0_C0_D100': 'FE0_C0_D100', 'FE0_C0_D010': 'FE0_C0_D010', 'FE0_C0_D001': 'FE0_C0_D001', 'FE1': 'FE1', 'FE0_C2_D100': 'FE0_C2_D100', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE1_C0_D001': 'FE1_C0_D001', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE1_C0_D100': 'FE1_C0_D100', 'FE1_C2_D001': 'FE1_C2_D001', 'FE1_C0_D010': 'FE1_C0_D010', 'FE1_C1_D010': 'FE1_C1_D010', 'FE1_C1_D100': 'FE1_C1_D100', 'FE1_C2_D100': 'FE1_C2_D100', 'FE0': 'FE0', 'FE1_C2_D010': 'FE1_C2_D010', 'FE1_C1_D001': 'FE1_C1_D001'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE0_C2_D001': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.]]), 'FE0_C1_D001': array([[ 0.,  0.,  0.,  0., -1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C1_D010': array([[ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C2_D010': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  0.]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,   [...]
-           0.25,  0.25,  0.25]]), 'FE0_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE0_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
-           0.  ,  0.  ,  0.  ]])}
+  {'FE1_C0_D001': array([[-1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
+           0.25,  0.25,  0.25]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  0.,  1.]]), 'FE1_C0_D010': array([[-1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C1_D010': array([[ 0.,  0.,  0.,  0., -1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  [...]
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C2_D001': ('FE0_C2_D001', (), False, False), 'FE0_C1_D001': ('FE0_C1_D001', (), False, False), 'FE0_C1_D010': ('FE0_C1_D010', (), False, False), 'FE0_C2_D010': ('FE0_C2_D010', (), False, False), 'FE0_C1_D100': ('FE0_C1_D100', (), False, False), 'FE0_C0_D100': ('FE0_C0_D100', (), False, False), 'FE0_C0_D010': ('FE0_C0_D010', (), False, False), 'FE0_C0_D001': ('FE0_C0_D001', (), False, False), 'FE1': ('FE1', (), False, True), 'FE0_C2_D100': ('FE0_C2_D100', (), False, False), 'FE0_C [...]
+  {'FE1_C0_D001': ('FE1_C0_D001', (), False, False), 'FE1_C0': ('FE1_C0', (), False, False), 'FE1_C1': ('FE1_C1', (), False, False), 'FE1_C2': ('FE1_C2', (), False, False), 'FE1_C0_D100': ('FE1_C0_D100', (), False, False), 'FE1_C2_D001': ('FE1_C2_D001', (), False, False), 'FE1_C0_D010': ('FE1_C0_D010', (), False, False), 'FE1_C1_D010': ('FE1_C1_D010', (), False, False), 'FE1_C1_D100': ('FE1_C1_D100', (), False, False), 'FE1_C2_D100': ('FE1_C2_D100', (), False, False), 'FE0': ('FE0', (),  [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -1106,13 +1112,13 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.207305 seconds.
+Compiler stage 2 finished in 0.276255 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Skipping optimizations, add -O to optimize
   
-Compiler stage 3 finished in 0.00019598 seconds.
+Compiler stage 3 finished in 0.00029397 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
@@ -1121,349 +1127,152 @@ Compiler stage 4: Generating code
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Z
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: d_22
-  Removing unused variable: d_21
-  Removing unused variable: d_20
-  Removing unused variable: d_12
-  Removing unused variable: d_11
-  Removing unused variable: d_10
-  Removing unused variable: d_02
-  Removing unused variable: d_01
-  Removing unused variable: d_00
-  Removing unused variable: C2
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Z
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: d_22
+  Removing unused variable: d_21
+  Removing unused variable: d_20
+  Removing unused variable: d_12
+  Removing unused variable: d_11
+  Removing unused variable: d_10
+  Removing unused variable: d_02
+  Removing unused variable: d_01
+  Removing unused variable: d_00
+  Removing unused variable: C2
+  Removing unused variable: C1
+  Removing unused variable: C0
   Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: area
@@ -1493,18 +1302,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.249889 seconds.
+Compiler stage 4 finished in 0.335966 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.00167894 seconds.
+Compiler stage 4.1 finished in 0.00114083 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./HyperElasticity.h.
-Compiler stage 5 finished in 0.00161099 seconds.
+Compiler stage 5 finished in 0.00134301 seconds.
 
-FFC finished in 0.588463 seconds.
+FFC finished in 0.816488 seconds.
+Output written to ./HyperElasticity.h.
diff --git a/demo/documented/hyperelasticity/cpp/documentation.rst b/demo/documented/hyperelasticity/cpp/documentation.rst
index fc6c4a7..0eb9bb7 100644
--- a/demo/documented/hyperelasticity/cpp/documentation.rst
+++ b/demo/documented/hyperelasticity/cpp/documentation.rst
@@ -57,7 +57,7 @@ Now, we can define the kinematic quantities involved in the model
 .. code-block:: python
 
     # Kinematics
-    d = u.geometric_dimension()
+    d = len(u)
     I = Identity(d)                 # Identity tensor
     F = I + grad(u)                 # Deformation gradient
     C = F.T*F                       # Right Cauchy-Green tensor
@@ -215,9 +215,9 @@ generated code.
 
 .. code-block:: c++
 
-  // Create mesh and define function space
-  UnitCubeMesh mesh (24, 16, 16);
-  HyperElasticity::FunctionSpace V(mesh);
+   // Create mesh and define function space
+   auto mesh = std::make_shared<UnitCubeMesh>(24, 16, 16);
+   auto V = std::make_shared<HyperElasticity::FunctionSpace>(mesh);
 
 Now, the Dirichlet boundary conditions can be created using the class
 :cpp:class:`DirichletBC`, the previously initialized
@@ -228,18 +228,18 @@ and ``Rotation`` (for the value on the right boundary).
 
 .. code-block:: c++
 
-  // Define Dirichlet boundaries
-  Left left;
-  Right right;
+   // Define Dirichlet boundaries
+   auto left = std::make_shared<Left>();
+   auto right = std::make_shared<Right>();
 
-  // Define Dirichlet boundary functions
-  Clamp c;
-  Rotation r;
+   // Define Dirichlet boundary functions
+   auto c = std::make_shared<Clamp>();
+   auto r = std::make_shared<Rotation>();
 
-  // Create Dirichlet boundary conditions
-  DirichletBC bcl(V, c, left);
-  DirichletBC bcr(V, r, right);
-  std::vector<const DirichletBC*> bcs = {{&bcl, &bcr}};
+   // Create Dirichlet boundary conditions
+   DirichletBC bcl(V, c, left);
+   DirichletBC bcr(V, r, right);
+   std::vector<const DirichletBC*> bcs = {{&bcl, &bcr}};
 
 The two boundary conditions are collected in the container ``bcs``.
 
@@ -249,8 +249,8 @@ source ``B`` and the traction ``T``.
 .. code-block:: c++
 
   // Define source and boundary traction functions
-  Constant B(0.0, -0.5, 0.0);
-  Constant T(0.1,  0.0, 0.0);
+  auto B = std::make_shared<Constant>(0.0, -0.5, 0.0);
+  auto T = std::make_shared<Constant>(0.1,  0.0, 0.0);
 
 The solution for the displacement will be an instance of the class
 :cpp:class:`Function`, living in the function space ``V``; we define
@@ -259,7 +259,7 @@ it here:
 .. code-block:: c++
 
   // Define solution function
-  Function u(V);
+  auto u = std::make_shared<Function>(V);
 
 Next, we set the material parameters
 
@@ -268,8 +268,8 @@ Next, we set the material parameters
   // Set material parameters
   const double E  = 10.0;
   const double nu = 0.3;
-  Constant mu(E/(2*(1 + nu)));
-  Constant lambda(E*nu/((1 + nu)*(1 - 2*nu)));
+  auto mu = std::make_shared<Constant>(E/(2*(1 + nu)));
+  auto lambda = std::make_shared<Constant>(E*nu/((1 + nu)*(1 - 2*nu)));
 
 Now, we can initialize the bilinear and linear forms (``a``, ``L``)
 using the previously defined :cpp:class:`FunctionSpace` ``V``. We
@@ -293,7 +293,7 @@ solution of the variational problem.
 .. code-block:: c++
 
   // Solve nonlinear variational problem F(u; v) = 0
-  solve(F == 0, u, bcs, J);
+  solve(F == 0, *u, bcs, J);
 
 Finally, the solution ``u`` is saved to a file named
 ``displacement.pvd`` in VTK format, and the displacement solution is
@@ -303,10 +303,10 @@ plotted.
 
   // Save solution in VTK format
   File file("displacement.pvd");
-  file << u;
+  file << *u;
 
   // Plot solution
-  plot(u);
+  plot(*u);
   interactive();
 
   return 0;
diff --git a/demo/documented/hyperelasticity/cpp/main.cpp b/demo/documented/hyperelasticity/cpp/main.cpp
index 0d9451e..d5de9ae 100644
--- a/demo/documented/hyperelasticity/cpp/main.cpp
+++ b/demo/documented/hyperelasticity/cpp/main.cpp
@@ -96,16 +96,16 @@ public:
 int main()
 {
   // Create mesh and define function space
-  UnitCubeMesh mesh (24, 16, 16);
-  HyperElasticity::FunctionSpace V(mesh);
+  auto mesh = std::make_shared<UnitCubeMesh>(24, 16, 16);
+  auto V = std::make_shared<HyperElasticity::FunctionSpace>(mesh);
 
   // Define Dirichlet boundaries
-  Left left;
-  Right right;
+  auto left = std::make_shared<Left>();
+  auto right = std::make_shared<Right>();
 
   // Define Dirichlet boundary functions
-  Clamp c;
-  Rotation r;
+  auto c = std::make_shared<Clamp>();
+  auto r = std::make_shared<Rotation>();
 
   // Create Dirichlet boundary conditions
   DirichletBC bcl(V, c, left);
@@ -113,17 +113,17 @@ int main()
   std::vector<const DirichletBC*> bcs = {{&bcl, &bcr}};
 
   // Define source and boundary traction functions
-  Constant B(0.0, -0.5, 0.0);
-  Constant T(0.1,  0.0, 0.0);
+  auto B = std::make_shared<Constant>(0.0, -0.5, 0.0);
+  auto T = std::make_shared<Constant>(0.1,  0.0, 0.0);
 
   // Define solution function
-  Function u(V);
+  auto u = std::make_shared<Function>(V);
 
   // Set material parameters
   const double E  = 10.0;
   const double nu = 0.3;
-  Constant mu(E/(2*(1 + nu)));
-  Constant lambda(E*nu/((1 + nu)*(1 - 2*nu)));
+  auto mu = std::make_shared<Constant>(E/(2*(1 + nu)));
+  auto lambda = std::make_shared<Constant>(E*nu/((1 + nu)*(1 - 2*nu)));
 
   // Create (linear) form defining (nonlinear) variational problem
   HyperElasticity::ResidualForm F(V);
@@ -135,14 +135,14 @@ int main()
   J.mu = mu; J.lmbda = lambda; J.u = u;
 
   // Solve nonlinear variational problem F(u; v) = 0
-  solve(F == 0, u, bcs, J);
+  solve(F == 0, *u, bcs, J);
 
   // Save solution in VTK format
   File file("displacement.pvd");
-  file << u;
+  file << *u;
 
   // Plot solution
-  plot(u);
+  plot(*u);
   interactive();
 
   return 0;
diff --git a/demo/documented/hyperelasticity/python/demo_hyperelasticity.py b/demo/documented/hyperelasticity/python/demo_hyperelasticity.py
index 351b7a9..7fdae17 100644
--- a/demo/documented/hyperelasticity/python/demo_hyperelasticity.py
+++ b/demo/documented/hyperelasticity/python/demo_hyperelasticity.py
@@ -44,11 +44,11 @@ left =  CompiledSubDomain("near(x[0], side) && on_boundary", side = 0.0)
 right = CompiledSubDomain("near(x[0], side) && on_boundary", side = 1.0)
 
 # Define Dirichlet boundary (x = 0 or x = 1)
-c = Expression(("0.0", "0.0", "0.0"))
+c = Constant((0.0, 0.0, 0.0))
 r = Expression(("scale*0.0",
                 "scale*(y0 + (x[1] - y0)*cos(theta) - (x[2] - z0)*sin(theta) - x[1])",
                 "scale*(z0 + (x[1] - y0)*sin(theta) + (x[2] - z0)*cos(theta) - x[2])"),
-                scale = 0.5, y0 = 0.5, z0 = 0.5, theta = pi/3)
+                scale = 0.5, y0 = 0.5, z0 = 0.5, theta = pi/3, degree=2)
 
 bcl = DirichletBC(V, c, left)
 bcr = DirichletBC(V, r, right)
@@ -62,7 +62,7 @@ B  = Constant((0.0, -0.5, 0.0))  # Body force per unit volume
 T  = Constant((0.1,  0.0, 0.0))  # Traction force on the boundary
 
 # Kinematics
-d = u.geometric_dimension()
+d = len(u)
 I = Identity(d)             # Identity tensor
 F = I + grad(u)             # Deformation gradient
 C = F.T*F                   # Right Cauchy-Green tensor
diff --git a/demo/documented/hyperelasticity/python/documentation.rst b/demo/documented/hyperelasticity/python/documentation.rst
index 0028e9b..045278e 100644
--- a/demo/documented/hyperelasticity/python/documentation.rst
+++ b/demo/documented/hyperelasticity/python/documentation.rst
@@ -89,11 +89,11 @@ The Dirichlet boundary values are defined using compiled expressions:
 .. code-block:: python
 
     # Define Dirichlet boundary (x = 0 or x = 1)
-    c = Expression(("0.0", "0.0", "0.0"))
+    c = Constant((0.0, 0.0, 0.0))
     r = Expression(("scale*0.0",
                     "scale*(y0 + (x[1] - y0)*cos(theta) - (x[2] - z0)*sin(theta) - x[1])",
                     "scale*(z0 + (x[1] - y0)*sin(theta) + (x[2] - z0)*cos(theta) - x[2])"),
-                    scale = 0.5, y0 = 0.5, z0 = 0.5, theta = pi/3)
+                    scale = 0.5, y0 = 0.5, z0 = 0.5, theta = pi/3, degree=2)
 
 Note the use of setting named parameters in the :py:class:`Expression
 <dolfin.functions.expression.Expression>` for ``r``.
@@ -142,7 +142,7 @@ are defined using UFL syntax:
 .. code-block:: python
 
     # Kinematics
-    d = u.geometric_dimension()
+    d = len(u)
     I = Identity(d)             # Identity tensor
     F = I + grad(u)             # Deformation gradient
     C = F.T*F                   # Right Cauchy-Green tensor
diff --git a/demo/documented/mixed-poisson-dual/cpp/CMakeLists.txt b/demo/documented/mixed-poisson-dual/cpp/CMakeLists.txt
index dd0b92e..4689553 100644
--- a/demo/documented/mixed-poisson-dual/cpp/CMakeLists.txt
+++ b/demo/documented/mixed-poisson-dual/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/mixed-poisson-dual/cpp/MixedPoissonDual.h b/demo/documented/mixed-poisson-dual/cpp/MixedPoissonDual.h
index 9b7bba1..3a93b5d 100644
--- a/demo/documented/mixed-poisson-dual/cpp/MixedPoissonDual.h
+++ b/demo/documented/mixed-poisson-dual/cpp/MixedPoissonDual.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __MIXEDPOISSONDUAL_H
 #define __MIXEDPOISSONDUAL_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class mixedpoissondual_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   mixedpoissondual_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_finite_element_0()
+  ~mixedpoissondual_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,98 +902,104 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new mixedpoissondual_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class mixedpoissondual_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   mixedpoissondual_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_finite_element_1()
+  ~mixedpoissondual_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Raviart-Thomas', Domain(Cell('triangle', 2)), 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 8;
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1004,16 +1013,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1021,10 +1044,9 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     
-    
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1039,298 +1061,1764 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.235702260395516, 0.404145188432738, -0.233333333333333, 0.182574185835055, -0.14142135623731, 0.0816496580927727};
-      
-      static const double coefficients1[6] = \
-      {-0.117851130197758, 0.173205080756888, -0.233333333333333, 0.0, 0.14142135623731, -0.122474487139159};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {-0.117851130197758, -0.115470053837925, 0.266666666666667, 0.0, 0.14142135623731, -0.122474487139159};
-      
-      static const double coefficients1[6] = \
-      {0.235702260395516, 0.0, 0.466666666666667, 0.0, 0.0, 0.244948974278318};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.117851130197758, -0.577350269189625, -0.466666666666667, 0.182574185835056, 0.0, -0.0408248290463863};
-      
-      static const double coefficients1[6] = \
-      {0.117851130197758, 0.173205080756888, 0.233333333333333, 0.0, 0.141421356237309, 0.122474487139159};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.117851130197758, 0.115470053837925, 0.733333333333333, 0.0, -0.14142135623731, 0.122474487139159};
-      
-      static const double coefficients1[6] = \
-      {-0.235702260395516, 0.0, -0.466666666666667, 0.0, 0.0, -0.244948974278318};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {-0.117851130197758, -0.288675134594813, -0.0333333333333332, -0.182574185835056, 0.0, 0.0408248290463861};
-      
-      static const double coefficients1[6] = \
-      {-0.117851130197758, 0.692820323027551, 0.266666666666666, 0.0, -0.141421356237309, -0.122474487139159};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.235702260395516, 0.404145188432738, -0.233333333333333, 0.182574185835055, -0.14142135623731, 0.0816496580927727};
-      
-      static const double coefficients1[6] = \
-      {-0.117851130197758, -0.692820323027551, 0.266666666666667, 0.0, 0.14142135623731, -0.122474487139159};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
-    case 6:
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new mixedpoissondual_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new mixedpoissondual_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new mixedpoissondual_finite_element_1();
+  }
+
+};
+
+
+class mixedpoissondual_finite_element_2: public ufc::finite_element
+{
+public:
+
+  mixedpoissondual_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~mixedpoissondual_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Raviart-Thomas', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 8;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Raviart-Thomas";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.235702260395516, 0.404145188432738, -0.233333333333333, 0.182574185835055, -0.14142135623731, 0.0816496580927727};
+      
+      static const double coefficients1[6] = \
+      {-0.117851130197758, 0.173205080756888, -0.233333333333333, 0.0, 0.14142135623731, -0.122474487139159};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {-0.117851130197758, -0.115470053837925, 0.266666666666667, 0.0, 0.14142135623731, -0.122474487139159};
+      
+      static const double coefficients1[6] = \
+      {0.235702260395516, 0.0, 0.466666666666667, 0.0, 0.0, 0.244948974278318};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.117851130197758, -0.577350269189625, -0.466666666666667, 0.182574185835056, 0.0, -0.0408248290463863};
+      
+      static const double coefficients1[6] = \
+      {0.117851130197758, 0.173205080756888, 0.233333333333333, 0.0, 0.141421356237309, 0.122474487139159};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.117851130197758, 0.115470053837925, 0.733333333333333, 0.0, -0.14142135623731, 0.122474487139159};
+      
+      static const double coefficients1[6] = \
+      {-0.235702260395516, 0.0, -0.466666666666667, 0.0, 0.0, -0.244948974278318};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {-0.117851130197758, -0.288675134594813, -0.0333333333333332, -0.182574185835056, 0.0, 0.0408248290463861};
+      
+      static const double coefficients1[6] = \
+      {-0.117851130197758, 0.692820323027551, 0.266666666666666, 0.0, -0.141421356237309, -0.122474487139159};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.235702260395516, 0.404145188432738, -0.233333333333333, 0.182574185835055, -0.14142135623731, 0.0816496580927727};
+      
+      static const double coefficients1[6] = \
+      {-0.117851130197758, -0.692820323027551, 0.266666666666667, 0.0, 0.14142135623731, -0.122474487139159};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
@@ -1407,20 +2895,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1429,7 +2915,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 8; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1437,21 +2923,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1471,7 +2955,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1483,7 +2967,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1493,8 +2977,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1595,7 +3079,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1764,7 +3248,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1933,7 +3417,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2102,7 +3586,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2271,7 +3755,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2440,7 +3924,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2609,7 +4093,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2778,7 +4262,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2905,28 +4389,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2962,7 +4444,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 8; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2970,22 +4452,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2996,7 +4476,7 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -3009,8 +4489,8 @@ public:
     {
     case 0:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -3018,8 +4498,8 @@ public:
       }
     case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -3027,8 +4507,8 @@ public:
       }
     case 2:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -3036,8 +4516,8 @@ public:
       }
     case 3:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -3045,8 +4525,8 @@ public:
       }
     case 4:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -3054,8 +4534,8 @@ public:
       }
     case 5:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -3063,8 +4543,8 @@ public:
       }
     case 6:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -3072,8 +4552,8 @@ public:
       }
     case 7:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -3084,12 +4564,11 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -3100,7 +4579,7 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -3109,58 +4588,57 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[0] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[1] = result;
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[2] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[3] = result;
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[4] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[5] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[6] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[7] = result;
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -3179,112 +4657,133 @@ public:
     vertex_values[5] = dof_values[0]*((1.0/detJ)*(J[3]*(-1.0))) + dof_values[1]*(1.0/detJ)*J[3]*2.0 + dof_values[2]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[3]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[3] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[4] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[5] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[6] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[7] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[8] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[9] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[10] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[11] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[14] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[15] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new mixedpoissondual_finite_element_1();
+    return new mixedpoissondual_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class mixedpoissondual_finite_element_2: public ufc::finite_element
+class mixedpoissondual_finite_element_3: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  mixedpoissondual_finite_element_2() : ufc::finite_element()
+  mixedpoissondual_finite_element_3() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_finite_element_2()
+  ~mixedpoissondual_finite_element_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 10;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3293,8 +4792,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -3748,20 +5247,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -3770,26 +5267,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -3809,7 +5304,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -3821,7 +5316,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3830,8 +5325,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -3931,21 +5426,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4106,21 +5601,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4281,21 +5776,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4456,21 +5951,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4631,21 +6126,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4806,21 +6301,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4981,21 +6476,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -5156,21 +6651,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -5331,21 +6826,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -5506,21 +7001,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -5640,28 +7135,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5697,7 +7190,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -5705,22 +7198,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -5731,80 +7222,80 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 7:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 8:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 9:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -5814,66 +7305,64 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -5881,98 +7370,94 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[8] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[9] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[10] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[11] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[15] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[18] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[19] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new mixedpoissondual_finite_element_2();
+    return new mixedpoissondual_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class mixedpoissondual_finite_element_3: public ufc::finite_element
+class mixedpoissondual_finite_element_4: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  mixedpoissondual_finite_element_3() : ufc::finite_element()
+  mixedpoissondual_finite_element_4() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_finite_element_3()
+  ~mixedpoissondual_finite_element_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(FiniteElement('Discontinuous Raviart-Thomas', Domain(Cell('triangle', 2)), 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), **{'value_shape': (3,) })";
+    return "MixedElement(FiniteElement('Discontinuous Raviart-Thomas', triangle, 2), FiniteElement('Lagrange', triangle, 3))";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 18;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5986,16 +7471,54 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6005,8 +7528,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -6830,20 +8353,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -6852,7 +8373,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 18; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -6860,21 +8381,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -6894,7 +8413,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -6906,7 +8425,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6916,8 +8435,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -7018,7 +8537,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7187,7 +8706,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7356,7 +8875,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7525,7 +9044,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7694,7 +9213,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7863,7 +9382,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8032,7 +9551,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8201,7 +9720,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8369,21 +9888,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8544,21 +10063,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8719,21 +10238,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8894,21 +10413,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -9069,21 +10588,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -9244,21 +10763,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -9419,21 +10938,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -9594,21 +11113,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -9769,21 +11288,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -9944,21 +11463,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -10078,28 +11597,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -10135,7 +11652,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 18; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -10143,22 +11660,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -10169,7 +11684,7 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -10182,8 +11697,8 @@ public:
     {
     case 0:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -10191,8 +11706,8 @@ public:
       }
     case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -10200,8 +11715,8 @@ public:
       }
     case 2:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -10209,8 +11724,8 @@ public:
       }
     case 3:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -10218,8 +11733,8 @@ public:
       }
     case 4:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -10227,8 +11742,8 @@ public:
       }
     case 5:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -10236,8 +11751,8 @@ public:
       }
     case 6:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -10245,8 +11760,8 @@ public:
       }
     case 7:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -10254,80 +11769,80 @@ public:
       }
     case 8:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 9:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 10:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 11:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 12:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 13:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 14:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 15:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 16:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 17:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -10337,12 +11852,11 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -10353,7 +11867,7 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -10362,98 +11876,97 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[0] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[1] = result;
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[2] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[3] = result;
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[4] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[5] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[6] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[7] = result;
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[8] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[9] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[2];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[11] = vals[2];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[12] = vals[2];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[13] = vals[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[14] = vals[2];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[15] = vals[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[16] = vals[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[17] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -10476,41 +11989,160 @@ public:
     vertex_values[8] = dof_values[10];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[3] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[4] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[5] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[6] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[7] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[8] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[9] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[10] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[11] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[14] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[15] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[16] = coordinate_dofs[0];
+    dof_coordinates[17] = coordinate_dofs[1];
+    dof_coordinates[18] = coordinate_dofs[2];
+    dof_coordinates[19] = coordinate_dofs[3];
+    dof_coordinates[20] = coordinate_dofs[4];
+    dof_coordinates[21] = coordinate_dofs[5];
+    dof_coordinates[22] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[23] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[24] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[25] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[26] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[27] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[28] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[29] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[30] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[31] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[32] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[33] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[34] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[35] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new mixedpoissondual_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new mixedpoissondual_finite_element_3();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new mixedpoissondual_finite_element_4();
+  }
+
+};
+
+
+class mixedpoissondual_dofmap_0: public ufc::dofmap
+{
+public:
+
+  mixedpoissondual_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~mixedpoissondual_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    return num_global_entities[0];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  std::size_t num_element_dofs() const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 3;
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
-    switch (i)
+    switch (d)
     {
     case 0:
       {
-        return new mixedpoissondual_finite_element_1();
+        return 1;
         break;
       }
     case 1:
       {
-        return new mixedpoissondual_finite_element_2();
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
         break;
       }
     }
@@ -10518,41 +12150,133 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    return new mixedpoissondual_finite_element_3();
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new mixedpoissondual_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class mixedpoissondual_dofmap_0: public ufc::dofmap
+class mixedpoissondual_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  mixedpoissondual_dofmap_0() : ufc::dofmap()
+  mixedpoissondual_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_dofmap_0()
+  ~mixedpoissondual_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -10576,45 +12300,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
@@ -10632,19 +12345,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -10652,27 +12369,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -10693,16 +12415,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -10723,65 +12448,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new mixedpoissondual_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new mixedpoissondual_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new mixedpoissondual_dofmap_0();
+    return new mixedpoissondual_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class mixedpoissondual_dofmap_1: public ufc::dofmap
+class mixedpoissondual_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  mixedpoissondual_dofmap_1() : ufc::dofmap()
+  mixedpoissondual_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_dofmap_1()
+  ~mixedpoissondual_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Raviart-Thomas', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Raviart-Thomas', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -10805,39 +12524,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 8*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 8;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -10861,24 +12569,22 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 8*c.entity_indices[2][0];
-    dofs[1] = 8*c.entity_indices[2][0] + 1;
-    dofs[2] = 8*c.entity_indices[2][0] + 2;
-    dofs[3] = 8*c.entity_indices[2][0] + 3;
-    dofs[4] = 8*c.entity_indices[2][0] + 4;
-    dofs[5] = 8*c.entity_indices[2][0] + 5;
-    dofs[6] = 8*c.entity_indices[2][0] + 6;
-    dofs[7] = 8*c.entity_indices[2][0] + 7;
+    dofs[0] = 8*entity_indices[2][0];
+    dofs[1] = 8*entity_indices[2][0] + 1;
+    dofs[2] = 8*entity_indices[2][0] + 2;
+    dofs[3] = 8*entity_indices[2][0] + 3;
+    dofs[4] = 8*entity_indices[2][0] + 4;
+    dofs[5] = 8*entity_indices[2][0] + 5;
+    dofs[6] = 8*entity_indices[2][0] + 6;
+    dofs[7] = 8*entity_indices[2][0] + 7;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -10901,9 +12607,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -10943,75 +12648,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[3] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[4] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[5] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[6] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[7] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[8] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[9] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[10] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[11] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[14] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[15] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new mixedpoissondual_dofmap_1();
+    return new mixedpoissondual_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class mixedpoissondual_dofmap_2: public ufc::dofmap
+class mixedpoissondual_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  mixedpoissondual_dofmap_2() : ufc::dofmap()
+  mixedpoissondual_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_dofmap_2()
+  ~mixedpoissondual_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -11035,39 +12710,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -11091,30 +12755,28 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
+    dofs[3] = offset + 2*entity_indices[1][0];
+    dofs[4] = offset + 2*entity_indices[1][0] + 1;
+    dofs[5] = offset + 2*entity_indices[1][1];
+    dofs[6] = offset + 2*entity_indices[1][1] + 1;
+    dofs[7] = offset + 2*entity_indices[1][2];
+    dofs[8] = offset + 2*entity_indices[1][2] + 1;
     offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
+    dofs[9] = offset + entity_indices[2][0];
     offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -11146,9 +12808,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -11230,79 +12891,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new mixedpoissondual_dofmap_2();
+    return new mixedpoissondual_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class mixedpoissondual_dofmap_3: public ufc::dofmap
+class mixedpoissondual_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  mixedpoissondual_dofmap_3() : ufc::dofmap()
+  mixedpoissondual_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_dofmap_3()
+  ~mixedpoissondual_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(FiniteElement('Discontinuous Raviart-Thomas', Domain(Cell('triangle', 2)), 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for MixedElement(FiniteElement('Discontinuous Raviart-Thomas', triangle, 2), FiniteElement('Lagrange', triangle, 3))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -11326,39 +12953,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + 2*num_global_entities[1] + 9*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 18;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -11382,39 +12998,37 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + 8*c.entity_indices[2][0];
-    dofs[1] = offset + 8*c.entity_indices[2][0] + 1;
-    dofs[2] = offset + 8*c.entity_indices[2][0] + 2;
-    dofs[3] = offset + 8*c.entity_indices[2][0] + 3;
-    dofs[4] = offset + 8*c.entity_indices[2][0] + 4;
-    dofs[5] = offset + 8*c.entity_indices[2][0] + 5;
-    dofs[6] = offset + 8*c.entity_indices[2][0] + 6;
-    dofs[7] = offset + 8*c.entity_indices[2][0] + 7;
+    dofs[0] = offset + 8*entity_indices[2][0];
+    dofs[1] = offset + 8*entity_indices[2][0] + 1;
+    dofs[2] = offset + 8*entity_indices[2][0] + 2;
+    dofs[3] = offset + 8*entity_indices[2][0] + 3;
+    dofs[4] = offset + 8*entity_indices[2][0] + 4;
+    dofs[5] = offset + 8*entity_indices[2][0] + 5;
+    dofs[6] = offset + 8*entity_indices[2][0] + 6;
+    dofs[7] = offset + 8*entity_indices[2][0] + 7;
     offset += 8*num_global_entities[2];
-    dofs[8] = offset + c.entity_indices[0][0];
-    dofs[9] = offset + c.entity_indices[0][1];
-    dofs[10] = offset + c.entity_indices[0][2];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[11] = offset + 2*c.entity_indices[1][0];
-    dofs[12] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[13] = offset + 2*c.entity_indices[1][1];
-    dofs[14] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[15] = offset + 2*c.entity_indices[1][2];
-    dofs[16] = offset + 2*c.entity_indices[1][2] + 1;
+    dofs[11] = offset + 2*entity_indices[1][0];
+    dofs[12] = offset + 2*entity_indices[1][0] + 1;
+    dofs[13] = offset + 2*entity_indices[1][1];
+    dofs[14] = offset + 2*entity_indices[1][1] + 1;
+    dofs[15] = offset + 2*entity_indices[1][2];
+    dofs[16] = offset + 2*entity_indices[1][2] + 1;
     offset += 2*num_global_entities[1];
-    dofs[17] = offset + c.entity_indices[2][0];
+    dofs[17] = offset + entity_indices[2][0];
     offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -11446,9 +13060,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -11538,67 +13151,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[3] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[4] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[5] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[6] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[7] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[8] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[9] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[10] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[11] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[14] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[15] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[16] = vertex_coordinates[0];
-    dof_coordinates[17] = vertex_coordinates[1];
-    dof_coordinates[18] = vertex_coordinates[2];
-    dof_coordinates[19] = vertex_coordinates[3];
-    dof_coordinates[20] = vertex_coordinates[4];
-    dof_coordinates[21] = vertex_coordinates[5];
-    dof_coordinates[22] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[23] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[24] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[25] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[26] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[27] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[28] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[29] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[30] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[31] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[32] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[33] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[34] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[35] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoissondual_dofmap_1();
+        return new mixedpoissondual_dofmap_2();
         break;
       }
     case 1:
       {
-        return new mixedpoissondual_dofmap_2();
+        return new mixedpoissondual_dofmap_3();
         break;
       }
     }
@@ -11606,46 +13176,38 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new mixedpoissondual_dofmap_3();
+    return new mixedpoissondual_dofmap_4();
   }
 
 };
 
-/// 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 mixedpoissondual_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   mixedpoissondual_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_cell_integral_0_otherwise()
+  ~mixedpoissondual_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    64
@@ -11654,7 +13216,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -11699,14 +13261,14 @@ public:
     A[5] = 0.0833333333333339*G0_0_0 - 0.1*G0_0_1 + 0.0166666666666667*G0_1_0 - 0.0333333333333336*G0_1_1 + 0.0833333333333339*G1_0_0 - 0.1*G1_0_1 + 0.0166666666666667*G1_1_0 - 0.0333333333333336*G1_1_1;
     A[6] = 0.0750000000000004*G0_0_0 - 0.0250000000000001*G0_0_1 - 0.0250000000000003*G0_1_1 + 0.0750000000000004*G1_0_0 - 0.0250000000000001*G1_0_1 - 0.0250000000000003*G1_1_1;
     A[7] = 0.0250000000000001*G0_0_1 - 0.0500000000000004*G0_1_1 + 0.0250000000000001*G1_0_1 - 0.0500000000000004*G1_1_1;
-    A[8] = -0.00833333333333337*G2_0_0 - 0.00833333333333396*G2_0_1 + 0.0041666666666668*G2_1_0 + 0.00416666666666683*G2_1_1 - 0.00833333333333337*G3_0_0 - 0.00833333333333396*G3_0_1 + 0.0041666666666668*G3_1_0 + 0.00416666666666683*G3_1_1;
-    A[9] = 0.158333333333334*G2_0_0 - 0.00416666666666718*G2_1_0 + 0.158333333333334*G3_0_0 - 0.00416666666666718*G3_1_0;
+    A[8] = -0.00833333333333325*G2_0_0 - 0.00833333333333391*G2_0_1 + 0.00416666666666685*G2_1_0 + 0.00416666666666684*G2_1_1 - 0.00833333333333325*G3_0_0 - 0.00833333333333391*G3_0_1 + 0.00416666666666685*G3_1_0 + 0.00416666666666684*G3_1_1;
+    A[9] = 0.158333333333334*G2_0_0 - 0.00416666666666717*G2_1_0 + 0.158333333333334*G3_0_0 - 0.00416666666666717*G3_1_0;
     A[10] = 0.00833333333333402*G2_0_1 - 0.0791666666666673*G2_1_1 + 0.00833333333333402*G3_0_1 - 0.0791666666666673*G3_1_1;
-    A[11] = 0.187500000000001*G2_0_0 + 0.375000000000003*G2_0_1 + 0.150000000000002*G2_1_0 + 0.0750000000000008*G2_1_1 + 0.187500000000001*G3_0_0 + 0.375000000000003*G3_0_1 + 0.150000000000002*G3_1_0 + 0.0750000000000008*G3_1_1;
-    A[12] = -0.0375*G2_0_0 - 0.0750000000000021*G2_0_1 - 0.187500000000001*G2_1_0 - 0.0374999999999996*G2_1_1 - 0.0375*G3_0_0 - 0.0750000000000021*G3_0_1 - 0.187500000000001*G3_1_0 - 0.0374999999999996*G3_1_1;
-    A[13] = 0.0375000000000005*G2_0_0 + 0.0750000000000011*G2_1_0 + 0.0375000000000008*G2_1_1 + 0.0375000000000005*G3_0_0 + 0.0750000000000011*G3_1_0 + 0.0375000000000008*G3_1_1;
-    A[14] = 0.0375*G2_0_0 + 0.187500000000001*G2_1_0 + 0.0374999999999995*G2_1_1 + 0.0375*G3_0_0 + 0.187500000000001*G3_1_0 + 0.0374999999999995*G3_1_1;
-    A[15] = 0.0375*G2_0_0 + 0.074999999999999*G2_0_1 + 0.0375000000000004*G2_1_1 + 0.0375*G3_0_0 + 0.074999999999999*G3_0_1 + 0.0375000000000004*G3_1_1;
+    A[11] = 0.187500000000001*G2_0_0 + 0.375000000000003*G2_0_1 + 0.150000000000002*G2_1_0 + 0.0750000000000007*G2_1_1 + 0.187500000000001*G3_0_0 + 0.375000000000003*G3_0_1 + 0.150000000000002*G3_1_0 + 0.0750000000000007*G3_1_1;
+    A[12] = -0.0375*G2_0_0 - 0.0750000000000021*G2_0_1 - 0.187500000000001*G2_1_0 - 0.0374999999999995*G2_1_1 - 0.0375*G3_0_0 - 0.0750000000000021*G3_0_1 - 0.187500000000001*G3_1_0 - 0.0374999999999995*G3_1_1;
+    A[13] = 0.0375000000000005*G2_0_0 + 0.0750000000000012*G2_1_0 + 0.0375000000000008*G2_1_1 + 0.0375000000000005*G3_0_0 + 0.0750000000000012*G3_1_0 + 0.0375000000000008*G3_1_1;
+    A[14] = 0.0375*G2_0_0 + 0.187500000000001*G2_1_0 + 0.0374999999999994*G2_1_1 + 0.0375*G3_0_0 + 0.187500000000001*G3_1_0 + 0.0374999999999994*G3_1_1;
+    A[15] = 0.0374999999999997*G2_0_0 + 0.0749999999999989*G2_0_1 + 0.0375000000000003*G2_1_1 + 0.0374999999999997*G3_0_0 + 0.0749999999999989*G3_0_1 + 0.0375000000000003*G3_1_1;
     A[16] = -0.187500000000001*G2_0_0 - 0.375000000000001*G2_0_1 - 0.0750000000000004*G2_1_1 - 0.187500000000001*G3_0_0 - 0.375000000000001*G3_0_1 - 0.0750000000000004*G3_1_1;
     A[17] = -0.225000000000001*G2_0_0 - 0.225000000000003*G2_1_0 - 0.225000000000001*G3_0_0 - 0.225000000000003*G3_1_0;
     A[18] = -0.0416666666666669*G0_0_0 - 0.00833333333333331*G0_0_1 - 0.00833333333333337*G0_1_0 - 0.041666666666667*G0_1_1 - 0.0416666666666669*G1_0_0 - 0.00833333333333331*G1_0_1 - 0.00833333333333337*G1_1_0 - 0.041666666666667*G1_1_1;
@@ -11717,15 +13279,15 @@ public:
     A[23] = -0.0416666666666669*G0_0_0 + 0.0500000000000003*G0_0_1 - 0.00833333333333337*G0_1_0 + 0.0166666666666668*G0_1_1 - 0.0416666666666669*G1_0_0 + 0.0500000000000003*G1_0_1 - 0.00833333333333337*G1_1_0 + 0.0166666666666668*G1_1_1;
     A[24] = -0.0500000000000004*G0_0_0 + 0.025*G0_1_0 - 0.0500000000000004*G1_0_0 + 0.025*G1_1_0;
     A[25] = -0.0250000000000004*G0_0_0 - 0.0250000000000001*G0_1_0 + 0.0750000000000004*G0_1_1 - 0.0250000000000004*G1_0_0 - 0.0250000000000001*G1_1_0 + 0.0750000000000004*G1_1_1;
-    A[26] = 0.00416666666666646*G2_0_0 + 0.00416666666666681*G2_0_1 - 0.0083333333333338*G2_1_0 - 0.0083333333333339*G2_1_1 + 0.00416666666666646*G3_0_0 + 0.00416666666666681*G3_0_1 - 0.0083333333333338*G3_1_0 - 0.0083333333333339*G3_1_1;
-    A[27] = -0.0791666666666671*G2_0_0 + 0.00833333333333375*G2_1_0 - 0.0791666666666671*G3_0_0 + 0.00833333333333375*G3_1_0;
+    A[26] = 0.00416666666666639*G2_0_0 + 0.00416666666666677*G2_0_1 - 0.00833333333333385*G2_1_0 - 0.00833333333333392*G2_1_1 + 0.00416666666666639*G3_0_0 + 0.00416666666666677*G3_0_1 - 0.00833333333333385*G3_1_0 - 0.00833333333333392*G3_1_1;
+    A[27] = -0.0791666666666671*G2_0_0 + 0.00833333333333376*G2_1_0 - 0.0791666666666671*G3_0_0 + 0.00833333333333376*G3_1_0;
     A[28] = -0.00416666666666729*G2_0_1 + 0.158333333333335*G2_1_1 - 0.00416666666666729*G3_0_1 + 0.158333333333335*G3_1_1;
-    A[29] = -0.0374999999999993*G2_0_0 - 0.187500000000002*G2_0_1 - 0.0750000000000012*G2_1_0 - 0.037500000000001*G2_1_1 - 0.0374999999999993*G3_0_0 - 0.187500000000002*G3_0_1 - 0.0750000000000012*G3_1_0 - 0.037500000000001*G3_1_1;
-    A[30] = 0.0750000000000004*G2_0_0 + 0.150000000000003*G2_0_1 + 0.375000000000003*G2_1_0 + 0.187500000000001*G2_1_1 + 0.0750000000000004*G3_0_0 + 0.150000000000003*G3_0_1 + 0.375000000000003*G3_1_0 + 0.187500000000001*G3_1_1;
+    A[29] = -0.0374999999999993*G2_0_0 - 0.187500000000002*G2_0_1 - 0.0750000000000013*G2_1_0 - 0.0375000000000008*G2_1_1 - 0.0374999999999993*G3_0_0 - 0.187500000000002*G3_0_1 - 0.0750000000000013*G3_1_0 - 0.0375000000000008*G3_1_1;
+    A[30] = 0.0750000000000004*G2_0_0 + 0.150000000000003*G2_0_1 + 0.375000000000003*G2_1_0 + 0.1875*G2_1_1 + 0.0750000000000004*G3_0_0 + 0.150000000000003*G3_0_1 + 0.375000000000003*G3_1_0 + 0.1875*G3_1_1;
     A[31] = 0.0375000000000006*G2_0_0 + 0.0750000000000008*G2_1_0 + 0.0375000000000007*G2_1_1 + 0.0375000000000006*G3_0_0 + 0.0750000000000008*G3_1_0 + 0.0375000000000007*G3_1_1;
     A[32] = -0.0750000000000005*G2_0_0 - 0.375000000000003*G2_1_0 - 0.187500000000001*G2_1_1 - 0.0750000000000005*G3_0_0 - 0.375000000000003*G3_1_0 - 0.187500000000001*G3_1_1;
-    A[33] = 0.0375000000000011*G2_0_0 + 0.0750000000000023*G2_0_1 + 0.0374999999999999*G2_1_1 + 0.0375000000000011*G3_0_0 + 0.0750000000000023*G3_0_1 + 0.0374999999999999*G3_1_1;
-    A[34] = 0.0374999999999995*G2_0_0 + 0.1875*G2_0_1 + 0.0375000000000009*G2_1_1 + 0.0374999999999995*G3_0_0 + 0.1875*G3_0_1 + 0.0375000000000009*G3_1_1;
+    A[33] = 0.0375000000000013*G2_0_0 + 0.0750000000000024*G2_0_1 + 0.0374999999999999*G2_1_1 + 0.0375000000000013*G3_0_0 + 0.0750000000000024*G3_0_1 + 0.0374999999999999*G3_1_1;
+    A[34] = 0.0374999999999994*G2_0_0 + 0.1875*G2_0_1 + 0.0375000000000009*G2_1_1 + 0.0374999999999994*G3_0_0 + 0.1875*G3_0_1 + 0.0375000000000009*G3_1_1;
     A[35] = -0.225000000000003*G2_0_1 - 0.225000000000002*G2_1_1 - 0.225000000000003*G3_0_1 - 0.225000000000002*G3_1_1;
     A[36] = -0.0166666666666667*G0_0_0 + 0.00833333333333338*G0_1_0 - 0.00833333333333332*G0_1_1 - 0.0166666666666667*G1_0_0 + 0.00833333333333338*G1_1_0 - 0.00833333333333332*G1_1_1;
     A[37] = -0.0166666666666669*G0_0_0 - 0.0500000000000002*G0_0_1 + 0.00833333333333345*G0_1_0 + 0.0416666666666669*G0_1_1 - 0.0166666666666669*G1_0_0 - 0.0500000000000002*G1_0_1 + 0.00833333333333345*G1_1_0 + 0.0416666666666669*G1_1_1;
@@ -11735,15 +13297,15 @@ public:
     A[41] = -0.0166666666666667*G0_0_0 + 0.066666666666667*G0_0_1 + 0.00833333333333339*G0_1_0 - 0.0166666666666668*G0_1_1 - 0.0166666666666667*G1_0_0 + 0.066666666666667*G1_0_1 + 0.00833333333333339*G1_1_0 - 0.0166666666666668*G1_1_1;
     A[42] = 0.0250000000000002*G0_0_0 + 0.0500000000000004*G0_0_1 + 0.0250000000000001*G0_1_0 - 0.0250000000000003*G0_1_1 + 0.0250000000000002*G1_0_0 + 0.0500000000000004*G1_0_1 + 0.0250000000000001*G1_1_0 - 0.0250000000000003*G1_1_1;
     A[43] = 0.0500000000000004*G0_0_0 + 0.0250000000000003*G0_0_1 - 0.0250000000000003*G0_1_0 + 0.025*G0_1_1 + 0.0500000000000004*G1_0_0 + 0.0250000000000003*G1_0_1 - 0.0250000000000003*G1_1_0 + 0.025*G1_1_1;
-    A[44] = -0.154166666666668*G2_0_0 - 0.154166666666668*G2_0_1 - 0.00416666666666702*G2_1_0 - 0.00416666666666709*G2_1_1 - 0.154166666666668*G3_0_0 - 0.154166666666668*G3_0_1 - 0.00416666666666702*G3_1_0 - 0.00416666666666709*G3_1_1;
-    A[45] = 0.00416666666666739*G2_0_0 + 0.00416666666666657*G2_1_0 + 0.00416666666666739*G3_0_0 + 0.00416666666666657*G3_1_0;
+    A[44] = -0.154166666666668*G2_0_0 - 0.154166666666668*G2_0_1 - 0.00416666666666702*G2_1_0 - 0.00416666666666711*G2_1_1 - 0.154166666666668*G3_0_0 - 0.154166666666668*G3_0_1 - 0.00416666666666702*G3_1_0 - 0.00416666666666711*G3_1_1;
+    A[45] = 0.00416666666666734*G2_0_0 + 0.00416666666666659*G2_1_0 + 0.00416666666666734*G3_0_0 + 0.00416666666666659*G3_1_0;
     A[46] = -0.0708333333333333*G2_0_1 + 0.0791666666666673*G2_1_1 - 0.0708333333333333*G3_0_1 + 0.0791666666666673*G3_1_1;
-    A[47] = -0.112500000000002*G2_0_0 - 0.0749999999999992*G2_0_1 + 0.0750000000000009*G2_1_0 + 0.0375*G2_1_1 - 0.112500000000002*G3_0_0 - 0.0749999999999992*G3_0_1 + 0.0750000000000009*G3_1_0 + 0.0375*G3_1_1;
+    A[47] = -0.112500000000002*G2_0_0 - 0.0749999999999994*G2_0_1 + 0.075000000000001*G2_1_0 + 0.0375000000000001*G2_1_1 - 0.112500000000002*G3_0_0 - 0.0749999999999994*G3_0_1 + 0.075000000000001*G3_1_0 + 0.0375000000000001*G3_1_1;
     A[48] = -0.225000000000001*G2_0_0 - 0.187500000000003*G2_0_1 + 0.187500000000001*G2_1_0 + 0.150000000000001*G2_1_1 - 0.225000000000001*G3_0_0 - 0.187500000000003*G3_0_1 + 0.187500000000001*G3_1_0 + 0.150000000000001*G3_1_1;
     A[49] = -0.337500000000003*G2_0_0 + 0.112500000000001*G2_0_1 + 0.150000000000002*G2_1_0 + 0.0750000000000016*G2_1_1 - 0.337500000000003*G3_0_0 + 0.112500000000001*G3_0_1 + 0.150000000000002*G3_1_0 + 0.0750000000000016*G3_1_1;
     A[50] = 0.225000000000001*G2_0_0 + 0.112500000000001*G2_0_1 - 0.187500000000001*G2_1_0 - 0.150000000000001*G2_1_1 + 0.225000000000001*G3_0_0 + 0.112500000000001*G3_0_1 - 0.187500000000001*G3_1_0 - 0.150000000000001*G3_1_1;
-    A[51] = 0.187500000000003*G2_0_0 - 0.262500000000001*G2_0_1 + 0.0750000000000003*G2_1_1 + 0.187500000000003*G3_0_0 - 0.262500000000001*G3_0_1 + 0.0750000000000003*G3_1_1;
-    A[52] = -0.0375000000000022*G2_0_0 + 0.0749999999999997*G2_0_1 - 0.0374999999999997*G2_1_1 - 0.0375000000000022*G3_0_0 + 0.0749999999999997*G3_0_1 - 0.0374999999999997*G3_1_1;
+    A[51] = 0.187500000000002*G2_0_0 - 0.262500000000001*G2_0_1 + 0.0750000000000003*G2_1_1 + 0.187500000000002*G3_0_0 - 0.262500000000001*G3_0_1 + 0.0750000000000003*G3_1_1;
+    A[52] = -0.0375000000000021*G2_0_0 + 0.0749999999999997*G2_0_1 - 0.0374999999999997*G2_1_1 - 0.0375000000000021*G3_0_0 + 0.0749999999999997*G3_0_1 - 0.0374999999999997*G3_1_1;
     A[53] = 0.450000000000005*G2_0_0 + 0.450000000000003*G2_0_1 - 0.225000000000003*G2_1_0 - 0.225000000000002*G2_1_1 + 0.450000000000005*G3_0_0 + 0.450000000000003*G3_0_1 - 0.225000000000003*G3_1_0 - 0.225000000000002*G3_1_1;
     A[54] = -0.0166666666666668*G0_0_0 - 0.0500000000000004*G0_0_1 + 0.00833333333333335*G0_1_0 + 0.041666666666667*G0_1_1 - 0.0166666666666668*G1_0_0 - 0.0500000000000004*G1_0_1 + 0.00833333333333335*G1_1_0 + 0.041666666666667*G1_1_1;
     A[55] = 0.0333333333333336*G0_0_0 + 0.1*G0_0_1 - 0.0166666666666668*G0_1_0 - 0.0833333333333339*G0_1_1 + 0.0333333333333336*G1_0_0 + 0.1*G1_0_1 - 0.0166666666666668*G1_1_0 - 0.0833333333333339*G1_1_1;
@@ -11753,15 +13315,15 @@ public:
     A[59] = -0.0166666666666668*G0_0_0 + 0.0166666666666669*G0_0_1 + 0.00833333333333335*G0_1_0 - 0.0166666666666668*G0_1_1 - 0.0166666666666668*G1_0_0 + 0.0166666666666669*G1_0_1 + 0.00833333333333335*G1_1_0 - 0.0166666666666668*G1_1_1;
     A[60] = -0.0250000000000005*G0_0_0 - 0.025*G0_1_0 - 0.0250000000000005*G1_0_0 - 0.025*G1_1_0;
     A[61] = -0.0500000000000004*G0_0_0 + 0.0750000000000004*G0_0_1 + 0.0250000000000001*G0_1_0 - 0.0750000000000003*G0_1_1 - 0.0500000000000004*G1_0_0 + 0.0750000000000004*G1_0_1 + 0.0250000000000001*G1_1_0 - 0.0750000000000003*G1_1_1;
-    A[62] = 0.0708333333333336*G2_0_0 + 0.0708333333333337*G2_0_1 + 0.00833333333333379*G2_1_0 + 0.00833333333333389*G2_1_1 + 0.0708333333333336*G3_0_0 + 0.0708333333333337*G3_0_1 + 0.00833333333333379*G3_1_0 + 0.00833333333333389*G3_1_1;
-    A[63] = 0.00416666666666698*G2_0_0 - 0.00833333333333375*G2_1_0 + 0.00416666666666698*G3_0_0 - 0.00833333333333375*G3_1_0;
+    A[62] = 0.0708333333333335*G2_0_0 + 0.0708333333333336*G2_0_1 + 0.00833333333333384*G2_1_0 + 0.00833333333333391*G2_1_1 + 0.0708333333333335*G3_0_0 + 0.0708333333333336*G3_0_1 + 0.00833333333333384*G3_1_0 + 0.00833333333333391*G3_1_1;
+    A[63] = 0.00416666666666701*G2_0_0 - 0.00833333333333376*G2_1_0 + 0.00416666666666701*G3_0_0 - 0.00833333333333376*G3_1_0;
     A[64] = 0.154166666666667*G2_0_1 - 0.158333333333335*G2_1_1 + 0.154166666666667*G3_0_1 - 0.158333333333335*G3_1_1;
-    A[65] = -0.112500000000001*G2_0_0 - 0.075000000000002*G2_0_1 + 0.0750000000000011*G2_1_0 + 0.0375000000000009*G2_1_1 - 0.112500000000001*G3_0_0 - 0.075000000000002*G3_0_1 + 0.0750000000000011*G3_1_0 + 0.0375000000000009*G3_1_1;
-    A[66] = 0.450000000000003*G2_0_0 + 0.262500000000002*G2_0_1 - 0.375000000000003*G2_1_0 - 0.187500000000001*G2_1_1 + 0.450000000000003*G3_0_0 + 0.262500000000002*G3_0_1 - 0.375000000000003*G3_1_0 - 0.187500000000001*G3_1_1;
-    A[67] = 0.112500000000001*G2_0_0 - 0.112500000000002*G2_0_1 - 0.075000000000001*G2_1_0 - 0.0375000000000008*G2_1_1 + 0.112500000000001*G3_0_0 - 0.112500000000002*G3_0_1 - 0.075000000000001*G3_1_0 - 0.0375000000000008*G3_1_1;
+    A[65] = -0.112500000000001*G2_0_0 - 0.0750000000000018*G2_0_1 + 0.0750000000000011*G2_1_0 + 0.0375000000000007*G2_1_1 - 0.112500000000001*G3_0_0 - 0.0750000000000018*G3_0_1 + 0.0750000000000011*G3_1_0 + 0.0375000000000007*G3_1_1;
+    A[66] = 0.450000000000003*G2_0_0 + 0.262500000000002*G2_0_1 - 0.375000000000003*G2_1_0 - 0.1875*G2_1_1 + 0.450000000000003*G3_0_0 + 0.262500000000002*G3_0_1 - 0.375000000000003*G3_1_0 - 0.1875*G3_1_1;
+    A[67] = 0.112500000000001*G2_0_0 - 0.112500000000002*G2_0_1 - 0.075000000000001*G2_1_0 - 0.0375000000000007*G2_1_1 + 0.112500000000001*G3_0_0 - 0.112500000000002*G3_0_1 - 0.075000000000001*G3_1_0 - 0.0375000000000007*G3_1_1;
     A[68] = -0.450000000000003*G2_0_0 - 0.112499999999999*G2_0_1 + 0.375000000000003*G2_1_0 + 0.187500000000001*G2_1_1 - 0.450000000000003*G3_0_0 - 0.112499999999999*G3_0_1 + 0.375000000000003*G3_1_0 + 0.187500000000001*G3_1_1;
-    A[69] = -0.0374999999999999*G2_0_0 + 0.187500000000002*G2_0_1 - 0.0375*G2_1_1 - 0.0374999999999999*G3_0_0 + 0.187500000000002*G3_0_1 - 0.0375*G3_1_1;
-    A[70] = -0.0375000000000006*G2_0_0 + 0.075000000000001*G2_0_1 - 0.0375000000000008*G2_1_1 - 0.0375000000000006*G3_0_0 + 0.075000000000001*G3_0_1 - 0.0375000000000008*G3_1_1;
+    A[69] = -0.0374999999999997*G2_0_0 + 0.187500000000002*G2_0_1 - 0.0375*G2_1_1 - 0.0374999999999997*G3_0_0 + 0.187500000000002*G3_0_1 - 0.0375*G3_1_1;
+    A[70] = -0.0375000000000008*G2_0_0 + 0.0750000000000011*G2_0_1 - 0.0375000000000008*G2_1_1 - 0.0375000000000008*G3_0_0 + 0.0750000000000011*G3_0_1 - 0.0375000000000008*G3_1_1;
     A[71] = -0.450000000000004*G2_0_1 + 0.225000000000002*G2_1_1 - 0.450000000000004*G3_0_1 + 0.225000000000002*G3_1_1;
     A[72] = -0.041666666666667*G0_0_0 - 0.00833333333333342*G0_0_1 + 0.0500000000000002*G0_1_0 + 0.0166666666666669*G0_1_1 - 0.041666666666667*G1_0_0 - 0.00833333333333342*G1_0_1 + 0.0500000000000002*G1_1_0 + 0.0166666666666669*G1_1_1;
     A[73] = 0.00833333333333327*G0_0_0 - 0.00833333333333339*G0_0_1 + 0.0166666666666666*G0_1_1 + 0.00833333333333327*G1_0_0 - 0.00833333333333339*G1_0_1 + 0.0166666666666666*G1_1_1;
@@ -11771,15 +13333,15 @@ public:
     A[77] = -0.041666666666667*G0_0_0 + 0.0500000000000003*G0_0_1 + 0.0500000000000003*G0_1_0 - 0.1*G0_1_1 - 0.041666666666667*G1_0_0 + 0.0500000000000003*G1_0_1 + 0.0500000000000003*G1_1_0 - 0.1*G1_1_1;
     A[78] = -0.025*G0_0_0 + 0.0250000000000003*G0_0_1 - 0.0250000000000004*G0_1_0 - 0.0500000000000004*G0_1_1 - 0.025*G1_0_0 + 0.0250000000000003*G1_0_1 - 0.0250000000000004*G1_1_0 - 0.0500000000000004*G1_1_1;
     A[79] = 0.0250000000000004*G0_0_0 - 0.0250000000000003*G0_0_1 - 0.0500000000000006*G0_1_0 - 0.0250000000000001*G0_1_1 + 0.0250000000000004*G1_0_0 - 0.0250000000000003*G1_0_1 - 0.0500000000000006*G1_1_0 - 0.0250000000000001*G1_1_1;
-    A[80] = 0.00416666666666693*G2_0_0 + 0.00416666666666717*G2_0_1 + 0.154166666666668*G2_1_0 + 0.154166666666668*G2_1_1 + 0.00416666666666693*G3_0_0 + 0.00416666666666717*G3_0_1 + 0.154166666666668*G3_1_0 + 0.154166666666668*G3_1_1;
+    A[80] = 0.00416666666666687*G2_0_0 + 0.00416666666666715*G2_0_1 + 0.154166666666668*G2_1_0 + 0.154166666666668*G2_1_1 + 0.00416666666666687*G3_0_0 + 0.00416666666666715*G3_0_1 + 0.154166666666668*G3_1_0 + 0.154166666666668*G3_1_1;
     A[81] = -0.0791666666666673*G2_0_0 + 0.0708333333333332*G2_1_0 - 0.0791666666666673*G3_0_0 + 0.0708333333333332*G3_1_0;
     A[82] = -0.00416666666666674*G2_0_1 - 0.00416666666666739*G2_1_1 - 0.00416666666666674*G3_0_1 - 0.00416666666666739*G3_1_1;
     A[83] = -0.150000000000002*G2_0_0 - 0.187500000000002*G2_0_1 + 0.187500000000002*G2_1_0 + 0.225000000000001*G2_1_1 - 0.150000000000002*G3_0_0 - 0.187500000000002*G3_0_1 + 0.187500000000002*G3_1_0 + 0.225000000000001*G3_1_1;
     A[84] = -0.0375000000000004*G2_0_0 - 0.0750000000000007*G2_0_1 + 0.0750000000000001*G2_1_0 + 0.112500000000002*G2_1_1 - 0.0375000000000004*G3_0_0 - 0.0750000000000007*G3_0_1 + 0.0750000000000001*G3_1_0 + 0.112500000000002*G3_1_1;
-    A[85] = -0.075000000000001*G2_0_0 + 0.262500000000002*G2_1_0 - 0.187500000000001*G2_1_1 - 0.075000000000001*G3_0_0 + 0.262500000000002*G3_1_0 - 0.187500000000001*G3_1_1;
+    A[85] = -0.0750000000000011*G2_0_0 + 0.262500000000002*G2_1_0 - 0.187500000000001*G2_1_1 - 0.0750000000000011*G3_0_0 + 0.262500000000002*G3_1_0 - 0.187500000000001*G3_1_1;
     A[86] = 0.0375000000000004*G2_0_0 - 0.0750000000000001*G2_1_0 + 0.0375000000000008*G2_1_1 + 0.0375000000000004*G3_0_0 - 0.0750000000000001*G3_1_0 + 0.0375000000000008*G3_1_1;
-    A[87] = -0.0750000000000011*G2_0_0 - 0.150000000000001*G2_0_1 - 0.112500000000002*G2_1_0 + 0.337500000000002*G2_1_1 - 0.0750000000000011*G3_0_0 - 0.150000000000001*G3_0_1 - 0.112500000000002*G3_1_0 + 0.337500000000002*G3_1_1;
-    A[88] = 0.150000000000001*G2_0_0 + 0.187500000000001*G2_0_1 - 0.1125*G2_1_0 - 0.225*G2_1_1 + 0.150000000000001*G3_0_0 + 0.187500000000001*G3_0_1 - 0.1125*G3_1_0 - 0.225*G3_1_1;
+    A[87] = -0.075000000000001*G2_0_0 - 0.150000000000001*G2_0_1 - 0.112500000000002*G2_1_0 + 0.337500000000002*G2_1_1 - 0.075000000000001*G3_0_0 - 0.150000000000001*G3_0_1 - 0.112500000000002*G3_1_0 + 0.337500000000002*G3_1_1;
+    A[88] = 0.150000000000001*G2_0_0 + 0.187500000000001*G2_0_1 - 0.112499999999999*G2_1_0 - 0.225*G2_1_1 + 0.150000000000001*G3_0_0 + 0.187500000000001*G3_0_1 - 0.112499999999999*G3_1_0 - 0.225*G3_1_1;
     A[89] = 0.225000000000003*G2_0_0 + 0.225000000000004*G2_0_1 - 0.450000000000004*G2_1_0 - 0.450000000000005*G2_1_1 + 0.225000000000003*G3_0_0 + 0.225000000000004*G3_0_1 - 0.450000000000004*G3_1_0 - 0.450000000000005*G3_1_1;
     A[90] = 0.0833333333333339*G0_0_0 + 0.0166666666666667*G0_0_1 - 0.1*G0_1_0 - 0.0333333333333336*G0_1_1 + 0.0833333333333339*G1_0_0 + 0.0166666666666667*G1_0_1 - 0.1*G1_1_0 - 0.0333333333333336*G1_1_1;
     A[91] = -0.0416666666666669*G0_0_0 - 0.00833333333333336*G0_0_1 + 0.0500000000000003*G0_1_0 + 0.0166666666666668*G0_1_1 - 0.0416666666666669*G1_0_0 - 0.00833333333333336*G1_0_1 + 0.0500000000000003*G1_1_0 + 0.0166666666666668*G1_1_1;
@@ -11789,16 +13351,16 @@ public:
     A[95] = 0.0833333333333339*G0_0_0 - 0.1*G0_0_1 - 0.1*G0_1_0 + 0.150000000000001*G0_1_1 + 0.0833333333333339*G1_0_0 - 0.1*G1_0_1 - 0.1*G1_1_0 + 0.150000000000001*G1_1_1;
     A[96] = 0.0750000000000004*G0_0_0 - 0.0250000000000001*G0_0_1 - 0.0750000000000006*G0_1_0 + 0.0500000000000003*G0_1_1 + 0.0750000000000004*G1_0_0 - 0.0250000000000001*G1_0_1 - 0.0750000000000006*G1_1_0 + 0.0500000000000003*G1_1_1;
     A[97] = 0.0250000000000001*G0_0_1 + 0.0250000000000003*G0_1_1 + 0.0250000000000001*G1_0_1 + 0.0250000000000003*G1_1_1;
-    A[98] = -0.00833333333333339*G2_0_0 - 0.00833333333333397*G2_0_1 - 0.0708333333333341*G2_1_0 - 0.0708333333333336*G2_1_1 - 0.00833333333333339*G3_0_0 - 0.00833333333333397*G3_0_1 - 0.0708333333333341*G3_1_0 - 0.0708333333333336*G3_1_1;
+    A[98] = -0.00833333333333326*G2_0_0 - 0.00833333333333391*G2_0_1 - 0.0708333333333343*G2_1_0 - 0.0708333333333336*G2_1_1 - 0.00833333333333326*G3_0_0 - 0.00833333333333391*G3_0_1 - 0.0708333333333343*G3_1_0 - 0.0708333333333336*G3_1_1;
     A[99] = 0.158333333333334*G2_0_0 - 0.154166666666667*G2_1_0 + 0.158333333333334*G3_0_0 - 0.154166666666667*G3_1_0;
-    A[100] = 0.00833333333333403*G2_0_1 - 0.00416666666666736*G2_1_1 + 0.00833333333333403*G3_0_1 - 0.00416666666666736*G3_1_1;
+    A[100] = 0.00833333333333404*G2_0_1 - 0.00416666666666736*G2_1_1 + 0.00833333333333404*G3_0_1 - 0.00416666666666736*G3_1_1;
     A[101] = 0.187500000000001*G2_0_0 + 0.375000000000003*G2_0_1 - 0.262500000000002*G2_1_0 - 0.450000000000004*G2_1_1 + 0.187500000000001*G3_0_0 + 0.375000000000003*G3_0_1 - 0.262500000000002*G3_1_0 - 0.450000000000004*G3_1_1;
     A[102] = -0.0375*G2_0_0 - 0.0750000000000021*G2_0_1 + 0.0750000000000003*G2_1_0 + 0.112500000000002*G2_1_1 - 0.0375*G3_0_0 - 0.0750000000000021*G3_0_1 + 0.0750000000000003*G3_1_0 + 0.112500000000002*G3_1_1;
-    A[103] = 0.0375000000000005*G2_0_0 - 0.187500000000002*G2_1_0 + 0.0374999999999981*G2_1_1 + 0.0375000000000005*G3_0_0 - 0.187500000000002*G3_1_0 + 0.0374999999999981*G3_1_1;
-    A[104] = 0.0375*G2_0_0 - 0.0750000000000003*G2_1_0 + 0.0375000000000015*G2_1_1 + 0.0375*G3_0_0 - 0.0750000000000003*G3_1_0 + 0.0375000000000015*G3_1_1;
-    A[105] = 0.0375000000000001*G2_0_0 + 0.074999999999999*G2_0_1 + 0.112500000000002*G2_1_0 - 0.112499999999998*G2_1_1 + 0.0375000000000001*G3_0_0 + 0.074999999999999*G3_0_1 + 0.112500000000002*G3_1_0 - 0.112499999999998*G3_1_1;
+    A[103] = 0.0375000000000006*G2_0_0 - 0.187500000000002*G2_1_0 + 0.0374999999999981*G2_1_1 + 0.0375000000000006*G3_0_0 - 0.187500000000002*G3_1_0 + 0.0374999999999981*G3_1_1;
+    A[104] = 0.0375*G2_0_0 - 0.0750000000000003*G2_1_0 + 0.0375000000000016*G2_1_1 + 0.0375*G3_0_0 - 0.0750000000000003*G3_1_0 + 0.0375000000000016*G3_1_1;
+    A[105] = 0.0374999999999998*G2_0_0 + 0.0749999999999989*G2_0_1 + 0.112500000000003*G2_1_0 - 0.112499999999998*G2_1_1 + 0.0374999999999998*G3_0_0 + 0.0749999999999989*G3_0_1 + 0.112500000000003*G3_1_0 - 0.112499999999998*G3_1_1;
     A[106] = -0.187500000000001*G2_0_0 - 0.375000000000001*G2_0_1 + 0.112499999999999*G2_1_0 + 0.450000000000001*G2_1_1 - 0.187500000000001*G3_0_0 - 0.375000000000001*G3_0_1 + 0.112499999999999*G3_1_0 + 0.450000000000001*G3_1_1;
-    A[107] = -0.225000000000001*G2_0_0 + 0.450000000000004*G2_1_0 - 0.225000000000001*G3_0_0 + 0.450000000000004*G3_1_0;
+    A[107] = -0.225000000000002*G2_0_0 + 0.450000000000004*G2_1_0 - 0.225000000000002*G3_0_0 + 0.450000000000004*G3_1_0;
     A[108] = 0.0750000000000004*G0_0_0 - 0.0250000000000001*G0_1_0 - 0.0250000000000003*G0_1_1 + 0.0750000000000004*G1_0_0 - 0.0250000000000001*G1_1_0 - 0.0250000000000003*G1_1_1;
     A[109] = -0.0500000000000004*G0_0_0 + 0.025*G0_0_1 - 0.0500000000000004*G1_0_0 + 0.025*G1_0_1;
     A[110] = 0.0250000000000002*G0_0_0 + 0.0250000000000001*G0_0_1 + 0.0500000000000004*G0_1_0 - 0.0250000000000003*G0_1_1 + 0.0250000000000002*G1_0_0 + 0.0250000000000001*G1_0_1 + 0.0500000000000004*G1_1_0 - 0.0250000000000003*G1_1_1;
@@ -11807,14 +13369,14 @@ public:
     A[113] = 0.0750000000000004*G0_0_0 - 0.0750000000000006*G0_0_1 - 0.0250000000000001*G0_1_0 + 0.0500000000000003*G0_1_1 + 0.0750000000000004*G1_0_0 - 0.0750000000000006*G1_0_1 - 0.0250000000000001*G1_1_0 + 0.0500000000000003*G1_1_1;
     A[114] = 0.350000000000001*G0_0_0 - 0.0250000000000002*G0_0_1 - 0.0250000000000002*G0_1_0 + 0.0500000000000006*G0_1_1 + 0.350000000000001*G1_0_0 - 0.0250000000000002*G1_0_1 - 0.0250000000000002*G1_1_0 + 0.0500000000000006*G1_1_1;
     A[115] = 0.0250000000000004*G0_0_0 + 0.249999999999999*G0_0_1 + 0.0250000000000004*G0_1_0 + 0.0250000000000003*G0_1_1 + 0.0250000000000004*G1_0_0 + 0.249999999999999*G1_0_1 + 0.0250000000000004*G1_1_0 + 0.0250000000000003*G1_1_1;
-    A[116] = -0.0375000000000012*G2_0_0 - 0.0375000000000025*G2_0_1 - 0.0375000000000012*G3_0_0 - 0.0375000000000025*G3_0_1;
+    A[116] = -0.0375000000000011*G2_0_0 - 0.0375000000000025*G2_0_1 - 0.0375000000000011*G3_0_0 - 0.0375000000000025*G3_0_1;
     A[117] = 0.0375000000000008*G2_0_0 + 0.0375000000000008*G3_0_0;
-    A[118] = 0.0375000000000025*G2_0_1 + 0.0375000000000025*G3_0_1;
+    A[118] = 0.0375000000000026*G2_0_1 + 0.0375000000000026*G3_0_1;
     A[119] = 0.449999999999999*G2_0_0 + 0.337500000000003*G2_0_1 - 0.225000000000003*G2_1_0 - 0.112500000000001*G2_1_1 + 0.449999999999999*G3_0_0 + 0.337500000000003*G3_0_1 - 0.225000000000003*G3_1_0 - 0.112500000000001*G3_1_1;
-    A[120] = 0.1125*G2_0_0 + 0.224999999999992*G2_0_1 - 0.112500000000002*G2_1_1 + 0.1125*G3_0_0 + 0.224999999999992*G3_0_1 - 0.112500000000002*G3_1_1;
+    A[120] = 0.1125*G2_0_0 + 0.224999999999993*G2_0_1 - 0.112500000000002*G2_1_1 + 0.1125*G3_0_0 + 0.224999999999993*G3_0_1 - 0.112500000000002*G3_1_1;
     A[121] = -0.224999999999997*G2_0_0 - 0.225000000000003*G2_1_0 - 0.112500000000002*G2_1_1 - 0.224999999999997*G3_0_0 - 0.225000000000003*G3_1_0 - 0.112500000000002*G3_1_1;
     A[122] = -0.1125*G2_0_0 + 0.112500000000002*G2_1_1 - 0.1125*G3_0_0 + 0.112500000000002*G3_1_1;
-    A[123] = -0.224999999999999*G2_0_0 - 0.450000000000005*G2_0_1 - 0.112500000000001*G2_1_1 - 0.224999999999999*G3_0_0 - 0.450000000000005*G3_0_1 - 0.112500000000001*G3_1_1;
+    A[123] = -0.225*G2_0_0 - 0.450000000000005*G2_0_1 - 0.112500000000001*G2_1_1 - 0.225*G3_0_0 - 0.450000000000005*G3_0_1 - 0.112500000000001*G3_1_1;
     A[124] = 0.225*G2_0_0 - 0.337499999999998*G2_0_1 + 0.1125*G2_1_1 + 0.225*G3_0_0 - 0.337499999999998*G3_0_1 + 0.1125*G3_1_1;
     A[125] = -0.225000000000002*G2_0_0 + 0.225000000000002*G2_0_1 + 0.450000000000006*G2_1_0 + 0.225000000000003*G2_1_1 - 0.225000000000002*G3_0_0 + 0.225000000000002*G3_0_1 + 0.450000000000006*G3_1_0 + 0.225000000000003*G3_1_1;
     A[126] = 0.0250000000000001*G0_1_0 - 0.0500000000000004*G0_1_1 + 0.0250000000000001*G1_1_0 - 0.0500000000000004*G1_1_1;
@@ -11827,21 +13389,21 @@ public:
     A[133] = 0.0500000000000008*G0_0_0 - 0.0250000000000003*G0_0_1 - 0.0250000000000003*G0_1_0 + 0.35*G0_1_1 + 0.0500000000000008*G1_0_0 - 0.0250000000000003*G1_0_1 - 0.0250000000000003*G1_1_0 + 0.35*G1_1_1;
     A[134] = -0.0375000000000014*G2_1_0 - 0.0375000000000024*G2_1_1 - 0.0375000000000014*G3_1_0 - 0.0375000000000024*G3_1_1;
     A[135] = 0.0375000000000019*G2_1_0 + 0.0375000000000019*G3_1_0;
-    A[136] = 0.0375000000000009*G2_1_1 + 0.0375000000000009*G3_1_1;
+    A[136] = 0.037500000000001*G2_1_1 + 0.037500000000001*G3_1_1;
     A[137] = -0.112500000000002*G2_0_0 + 0.224999999999998*G2_1_0 + 0.1125*G2_1_1 - 0.112500000000002*G3_0_0 + 0.224999999999998*G3_1_0 + 0.1125*G3_1_1;
-    A[138] = -0.112500000000001*G2_0_0 - 0.225000000000004*G2_0_1 + 0.337500000000001*G2_1_0 + 0.449999999999996*G2_1_1 - 0.112500000000001*G3_0_0 - 0.225000000000004*G3_0_1 + 0.337500000000001*G3_1_0 + 0.449999999999996*G3_1_1;
-    A[139] = -0.112500000000001*G2_0_0 - 0.450000000000001*G2_1_0 - 0.224999999999998*G2_1_1 - 0.112500000000001*G3_0_0 - 0.450000000000001*G3_1_0 - 0.224999999999998*G3_1_1;
+    A[138] = -0.112500000000001*G2_0_0 - 0.225000000000003*G2_0_1 + 0.337500000000001*G2_1_0 + 0.449999999999996*G2_1_1 - 0.112500000000001*G3_0_0 - 0.225000000000003*G3_0_1 + 0.337500000000001*G3_1_0 + 0.449999999999996*G3_1_1;
+    A[139] = -0.112500000000002*G2_0_0 - 0.450000000000001*G2_1_0 - 0.224999999999998*G2_1_1 - 0.112500000000002*G3_0_0 - 0.450000000000001*G3_1_0 - 0.224999999999998*G3_1_1;
     A[140] = 0.112500000000001*G2_0_0 - 0.337500000000001*G2_1_0 + 0.225000000000004*G2_1_1 + 0.112500000000001*G3_0_0 - 0.337500000000001*G3_1_0 + 0.225000000000004*G3_1_1;
     A[141] = -0.112500000000002*G2_0_0 - 0.225000000000004*G2_0_1 - 0.225*G2_1_1 - 0.112500000000002*G3_0_0 - 0.225000000000004*G3_0_1 - 0.225*G3_1_1;
     A[142] = 0.112500000000002*G2_0_0 - 0.112499999999997*G2_1_1 + 0.112500000000002*G3_0_0 - 0.112499999999997*G3_1_1;
     A[143] = 0.225000000000004*G2_0_0 + 0.450000000000007*G2_0_1 + 0.225000000000003*G2_1_0 - 0.225000000000005*G2_1_1 + 0.225000000000004*G3_0_0 + 0.450000000000007*G3_0_1 + 0.225000000000003*G3_1_0 - 0.225000000000005*G3_1_1;
-    A[144] = -0.00833333333333337*G4_0_0 - 0.00833333333333396*G4_0_1 + 0.0041666666666668*G4_1_0 + 0.00416666666666683*G4_1_1 - 0.00833333333333337*G5_0_0 - 0.00833333333333396*G5_0_1 + 0.0041666666666668*G5_1_0 + 0.00416666666666683*G5_1_1;
-    A[145] = 0.00416666666666646*G4_0_0 + 0.00416666666666681*G4_0_1 - 0.0083333333333338*G4_1_0 - 0.0083333333333339*G4_1_1 + 0.00416666666666646*G5_0_0 + 0.00416666666666681*G5_0_1 - 0.0083333333333338*G5_1_0 - 0.0083333333333339*G5_1_1;
-    A[146] = -0.154166666666668*G4_0_0 - 0.154166666666668*G4_0_1 - 0.00416666666666702*G4_1_0 - 0.00416666666666709*G4_1_1 - 0.154166666666668*G5_0_0 - 0.154166666666668*G5_0_1 - 0.00416666666666702*G5_1_0 - 0.00416666666666709*G5_1_1;
-    A[147] = 0.0708333333333336*G4_0_0 + 0.0708333333333337*G4_0_1 + 0.00833333333333379*G4_1_0 + 0.00833333333333389*G4_1_1 + 0.0708333333333336*G5_0_0 + 0.0708333333333337*G5_0_1 + 0.00833333333333379*G5_1_0 + 0.00833333333333389*G5_1_1;
-    A[148] = 0.00416666666666693*G4_0_0 + 0.00416666666666717*G4_0_1 + 0.154166666666668*G4_1_0 + 0.154166666666668*G4_1_1 + 0.00416666666666693*G5_0_0 + 0.00416666666666717*G5_0_1 + 0.154166666666668*G5_1_0 + 0.154166666666668*G5_1_1;
-    A[149] = -0.00833333333333339*G4_0_0 - 0.00833333333333397*G4_0_1 - 0.0708333333333341*G4_1_0 - 0.0708333333333336*G4_1_1 - 0.00833333333333339*G5_0_0 - 0.00833333333333397*G5_0_1 - 0.0708333333333341*G5_1_0 - 0.0708333333333336*G5_1_1;
-    A[150] = -0.0375000000000012*G4_0_0 - 0.0375000000000025*G4_0_1 - 0.0375000000000012*G5_0_0 - 0.0375000000000025*G5_0_1;
+    A[144] = -0.00833333333333325*G4_0_0 - 0.00833333333333391*G4_0_1 + 0.00416666666666685*G4_1_0 + 0.00416666666666684*G4_1_1 - 0.00833333333333325*G5_0_0 - 0.00833333333333391*G5_0_1 + 0.00416666666666685*G5_1_0 + 0.00416666666666684*G5_1_1;
+    A[145] = 0.00416666666666639*G4_0_0 + 0.00416666666666677*G4_0_1 - 0.00833333333333385*G4_1_0 - 0.00833333333333392*G4_1_1 + 0.00416666666666639*G5_0_0 + 0.00416666666666677*G5_0_1 - 0.00833333333333385*G5_1_0 - 0.00833333333333392*G5_1_1;
+    A[146] = -0.154166666666668*G4_0_0 - 0.154166666666668*G4_0_1 - 0.00416666666666702*G4_1_0 - 0.00416666666666711*G4_1_1 - 0.154166666666668*G5_0_0 - 0.154166666666668*G5_0_1 - 0.00416666666666702*G5_1_0 - 0.00416666666666711*G5_1_1;
+    A[147] = 0.0708333333333335*G4_0_0 + 0.0708333333333336*G4_0_1 + 0.00833333333333384*G4_1_0 + 0.00833333333333391*G4_1_1 + 0.0708333333333335*G5_0_0 + 0.0708333333333336*G5_0_1 + 0.00833333333333384*G5_1_0 + 0.00833333333333391*G5_1_1;
+    A[148] = 0.00416666666666687*G4_0_0 + 0.00416666666666715*G4_0_1 + 0.154166666666668*G4_1_0 + 0.154166666666668*G4_1_1 + 0.00416666666666687*G5_0_0 + 0.00416666666666715*G5_0_1 + 0.154166666666668*G5_1_0 + 0.154166666666668*G5_1_1;
+    A[149] = -0.00833333333333326*G4_0_0 - 0.00833333333333391*G4_0_1 - 0.0708333333333343*G4_1_0 - 0.0708333333333336*G4_1_1 - 0.00833333333333326*G5_0_0 - 0.00833333333333391*G5_0_1 - 0.0708333333333343*G5_1_0 - 0.0708333333333336*G5_1_1;
+    A[150] = -0.0375000000000011*G4_0_0 - 0.0375000000000025*G4_0_1 - 0.0375000000000011*G5_0_0 - 0.0375000000000025*G5_0_1;
     A[151] = -0.0375000000000014*G4_1_0 - 0.0375000000000024*G4_1_1 - 0.0375000000000014*G5_1_0 - 0.0375000000000024*G5_1_1;
     A[152] = 0.0;
     A[153] = 0.0;
@@ -11853,10 +13415,10 @@ public:
     A[159] = 0.0;
     A[160] = 0.0;
     A[161] = 0.0;
-    A[162] = 0.158333333333334*G4_0_0 - 0.00416666666666718*G4_1_0 + 0.158333333333334*G5_0_0 - 0.00416666666666718*G5_1_0;
-    A[163] = -0.0791666666666671*G4_0_0 + 0.00833333333333375*G4_1_0 - 0.0791666666666671*G5_0_0 + 0.00833333333333375*G5_1_0;
-    A[164] = 0.00416666666666739*G4_0_0 + 0.00416666666666657*G4_1_0 + 0.00416666666666739*G5_0_0 + 0.00416666666666657*G5_1_0;
-    A[165] = 0.00416666666666698*G4_0_0 - 0.00833333333333375*G4_1_0 + 0.00416666666666698*G5_0_0 - 0.00833333333333375*G5_1_0;
+    A[162] = 0.158333333333334*G4_0_0 - 0.00416666666666717*G4_1_0 + 0.158333333333334*G5_0_0 - 0.00416666666666717*G5_1_0;
+    A[163] = -0.0791666666666671*G4_0_0 + 0.00833333333333376*G4_1_0 - 0.0791666666666671*G5_0_0 + 0.00833333333333376*G5_1_0;
+    A[164] = 0.00416666666666734*G4_0_0 + 0.00416666666666659*G4_1_0 + 0.00416666666666734*G5_0_0 + 0.00416666666666659*G5_1_0;
+    A[165] = 0.00416666666666701*G4_0_0 - 0.00833333333333376*G4_1_0 + 0.00416666666666701*G5_0_0 - 0.00833333333333376*G5_1_0;
     A[166] = -0.0791666666666673*G4_0_0 + 0.0708333333333332*G4_1_0 - 0.0791666666666673*G5_0_0 + 0.0708333333333332*G5_1_0;
     A[167] = 0.158333333333334*G4_0_0 - 0.154166666666667*G4_1_0 + 0.158333333333334*G5_0_0 - 0.154166666666667*G5_1_0;
     A[168] = 0.0375000000000008*G4_0_0 + 0.0375000000000008*G5_0_0;
@@ -11876,9 +13438,9 @@ public:
     A[182] = -0.0708333333333333*G4_0_1 + 0.0791666666666673*G4_1_1 - 0.0708333333333333*G5_0_1 + 0.0791666666666673*G5_1_1;
     A[183] = 0.154166666666667*G4_0_1 - 0.158333333333335*G4_1_1 + 0.154166666666667*G5_0_1 - 0.158333333333335*G5_1_1;
     A[184] = -0.00416666666666674*G4_0_1 - 0.00416666666666739*G4_1_1 - 0.00416666666666674*G5_0_1 - 0.00416666666666739*G5_1_1;
-    A[185] = 0.00833333333333403*G4_0_1 - 0.00416666666666736*G4_1_1 + 0.00833333333333403*G5_0_1 - 0.00416666666666736*G5_1_1;
-    A[186] = 0.0375000000000025*G4_0_1 + 0.0375000000000025*G5_0_1;
-    A[187] = 0.0375000000000009*G4_1_1 + 0.0375000000000009*G5_1_1;
+    A[185] = 0.00833333333333404*G4_0_1 - 0.00416666666666736*G4_1_1 + 0.00833333333333404*G5_0_1 - 0.00416666666666736*G5_1_1;
+    A[186] = 0.0375000000000026*G4_0_1 + 0.0375000000000026*G5_0_1;
+    A[187] = 0.037500000000001*G4_1_1 + 0.037500000000001*G5_1_1;
     A[188] = 0.0;
     A[189] = 0.0;
     A[190] = 0.0;
@@ -11889,10 +13451,10 @@ public:
     A[195] = 0.0;
     A[196] = 0.0;
     A[197] = 0.0;
-    A[198] = 0.187500000000001*G4_0_0 + 0.375000000000003*G4_0_1 + 0.150000000000002*G4_1_0 + 0.0750000000000008*G4_1_1 + 0.187500000000001*G5_0_0 + 0.375000000000003*G5_0_1 + 0.150000000000002*G5_1_0 + 0.0750000000000008*G5_1_1;
-    A[199] = -0.0374999999999993*G4_0_0 - 0.187500000000002*G4_0_1 - 0.0750000000000012*G4_1_0 - 0.037500000000001*G4_1_1 - 0.0374999999999993*G5_0_0 - 0.187500000000002*G5_0_1 - 0.0750000000000012*G5_1_0 - 0.037500000000001*G5_1_1;
-    A[200] = -0.112500000000002*G4_0_0 - 0.0749999999999992*G4_0_1 + 0.0750000000000009*G4_1_0 + 0.0375*G4_1_1 - 0.112500000000002*G5_0_0 - 0.0749999999999992*G5_0_1 + 0.0750000000000009*G5_1_0 + 0.0375*G5_1_1;
-    A[201] = -0.112500000000001*G4_0_0 - 0.075000000000002*G4_0_1 + 0.0750000000000011*G4_1_0 + 0.0375000000000009*G4_1_1 - 0.112500000000001*G5_0_0 - 0.075000000000002*G5_0_1 + 0.0750000000000011*G5_1_0 + 0.0375000000000009*G5_1_1;
+    A[198] = 0.187500000000001*G4_0_0 + 0.375000000000003*G4_0_1 + 0.150000000000002*G4_1_0 + 0.0750000000000007*G4_1_1 + 0.187500000000001*G5_0_0 + 0.375000000000003*G5_0_1 + 0.150000000000002*G5_1_0 + 0.0750000000000007*G5_1_1;
+    A[199] = -0.0374999999999993*G4_0_0 - 0.187500000000002*G4_0_1 - 0.0750000000000013*G4_1_0 - 0.0375000000000008*G4_1_1 - 0.0374999999999993*G5_0_0 - 0.187500000000002*G5_0_1 - 0.0750000000000013*G5_1_0 - 0.0375000000000008*G5_1_1;
+    A[200] = -0.112500000000002*G4_0_0 - 0.0749999999999994*G4_0_1 + 0.075000000000001*G4_1_0 + 0.0375000000000001*G4_1_1 - 0.112500000000002*G5_0_0 - 0.0749999999999994*G5_0_1 + 0.075000000000001*G5_1_0 + 0.0375000000000001*G5_1_1;
+    A[201] = -0.112500000000001*G4_0_0 - 0.0750000000000018*G4_0_1 + 0.0750000000000011*G4_1_0 + 0.0375000000000007*G4_1_1 - 0.112500000000001*G5_0_0 - 0.0750000000000018*G5_0_1 + 0.0750000000000011*G5_1_0 + 0.0375000000000007*G5_1_1;
     A[202] = -0.150000000000002*G4_0_0 - 0.187500000000002*G4_0_1 + 0.187500000000002*G4_1_0 + 0.225000000000001*G4_1_1 - 0.150000000000002*G5_0_0 - 0.187500000000002*G5_0_1 + 0.187500000000002*G5_1_0 + 0.225000000000001*G5_1_1;
     A[203] = 0.187500000000001*G4_0_0 + 0.375000000000003*G4_0_1 - 0.262500000000002*G4_1_0 - 0.450000000000004*G4_1_1 + 0.187500000000001*G5_0_0 + 0.375000000000003*G5_0_1 - 0.262500000000002*G5_1_0 - 0.450000000000004*G5_1_1;
     A[204] = 0.449999999999999*G4_0_0 + 0.337500000000003*G4_0_1 - 0.225000000000003*G4_1_0 - 0.112500000000001*G4_1_1 + 0.449999999999999*G5_0_0 + 0.337500000000003*G5_0_1 - 0.225000000000003*G5_1_0 - 0.112500000000001*G5_1_1;
@@ -11907,14 +13469,14 @@ public:
     A[213] = 0.0;
     A[214] = 0.0;
     A[215] = 0.0;
-    A[216] = -0.0375*G4_0_0 - 0.0750000000000021*G4_0_1 - 0.187500000000001*G4_1_0 - 0.0374999999999996*G4_1_1 - 0.0375*G5_0_0 - 0.0750000000000021*G5_0_1 - 0.187500000000001*G5_1_0 - 0.0374999999999996*G5_1_1;
-    A[217] = 0.0750000000000004*G4_0_0 + 0.150000000000003*G4_0_1 + 0.375000000000003*G4_1_0 + 0.187500000000001*G4_1_1 + 0.0750000000000004*G5_0_0 + 0.150000000000003*G5_0_1 + 0.375000000000003*G5_1_0 + 0.187500000000001*G5_1_1;
+    A[216] = -0.0375*G4_0_0 - 0.0750000000000021*G4_0_1 - 0.187500000000001*G4_1_0 - 0.0374999999999995*G4_1_1 - 0.0375*G5_0_0 - 0.0750000000000021*G5_0_1 - 0.187500000000001*G5_1_0 - 0.0374999999999995*G5_1_1;
+    A[217] = 0.0750000000000004*G4_0_0 + 0.150000000000003*G4_0_1 + 0.375000000000003*G4_1_0 + 0.1875*G4_1_1 + 0.0750000000000004*G5_0_0 + 0.150000000000003*G5_0_1 + 0.375000000000003*G5_1_0 + 0.1875*G5_1_1;
     A[218] = -0.225000000000001*G4_0_0 - 0.187500000000003*G4_0_1 + 0.187500000000001*G4_1_0 + 0.150000000000001*G4_1_1 - 0.225000000000001*G5_0_0 - 0.187500000000003*G5_0_1 + 0.187500000000001*G5_1_0 + 0.150000000000001*G5_1_1;
-    A[219] = 0.450000000000003*G4_0_0 + 0.262500000000002*G4_0_1 - 0.375000000000003*G4_1_0 - 0.187500000000001*G4_1_1 + 0.450000000000003*G5_0_0 + 0.262500000000002*G5_0_1 - 0.375000000000003*G5_1_0 - 0.187500000000001*G5_1_1;
+    A[219] = 0.450000000000003*G4_0_0 + 0.262500000000002*G4_0_1 - 0.375000000000003*G4_1_0 - 0.1875*G4_1_1 + 0.450000000000003*G5_0_0 + 0.262500000000002*G5_0_1 - 0.375000000000003*G5_1_0 - 0.1875*G5_1_1;
     A[220] = -0.0375000000000004*G4_0_0 - 0.0750000000000007*G4_0_1 + 0.0750000000000001*G4_1_0 + 0.112500000000002*G4_1_1 - 0.0375000000000004*G5_0_0 - 0.0750000000000007*G5_0_1 + 0.0750000000000001*G5_1_0 + 0.112500000000002*G5_1_1;
     A[221] = -0.0375*G4_0_0 - 0.0750000000000021*G4_0_1 + 0.0750000000000003*G4_1_0 + 0.112500000000002*G4_1_1 - 0.0375*G5_0_0 - 0.0750000000000021*G5_0_1 + 0.0750000000000003*G5_1_0 + 0.112500000000002*G5_1_1;
-    A[222] = 0.1125*G4_0_0 + 0.224999999999992*G4_0_1 - 0.112500000000002*G4_1_1 + 0.1125*G5_0_0 + 0.224999999999992*G5_0_1 - 0.112500000000002*G5_1_1;
-    A[223] = -0.112500000000001*G4_0_0 - 0.225000000000004*G4_0_1 + 0.337500000000001*G4_1_0 + 0.449999999999996*G4_1_1 - 0.112500000000001*G5_0_0 - 0.225000000000004*G5_0_1 + 0.337500000000001*G5_1_0 + 0.449999999999996*G5_1_1;
+    A[222] = 0.1125*G4_0_0 + 0.224999999999993*G4_0_1 - 0.112500000000002*G4_1_1 + 0.1125*G5_0_0 + 0.224999999999993*G5_0_1 - 0.112500000000002*G5_1_1;
+    A[223] = -0.112500000000001*G4_0_0 - 0.225000000000003*G4_0_1 + 0.337500000000001*G4_1_0 + 0.449999999999996*G4_1_1 - 0.112500000000001*G5_0_0 - 0.225000000000003*G5_0_1 + 0.337500000000001*G5_1_0 + 0.449999999999996*G5_1_1;
     A[224] = 0.0;
     A[225] = 0.0;
     A[226] = 0.0;
@@ -11925,14 +13487,14 @@ public:
     A[231] = 0.0;
     A[232] = 0.0;
     A[233] = 0.0;
-    A[234] = 0.0375000000000005*G4_0_0 + 0.0750000000000011*G4_1_0 + 0.0375000000000008*G4_1_1 + 0.0375000000000005*G5_0_0 + 0.0750000000000011*G5_1_0 + 0.0375000000000008*G5_1_1;
+    A[234] = 0.0375000000000005*G4_0_0 + 0.0750000000000012*G4_1_0 + 0.0375000000000008*G4_1_1 + 0.0375000000000005*G5_0_0 + 0.0750000000000012*G5_1_0 + 0.0375000000000008*G5_1_1;
     A[235] = 0.0375000000000006*G4_0_0 + 0.0750000000000008*G4_1_0 + 0.0375000000000007*G4_1_1 + 0.0375000000000006*G5_0_0 + 0.0750000000000008*G5_1_0 + 0.0375000000000007*G5_1_1;
     A[236] = -0.337500000000003*G4_0_0 + 0.112500000000001*G4_0_1 + 0.150000000000002*G4_1_0 + 0.0750000000000016*G4_1_1 - 0.337500000000003*G5_0_0 + 0.112500000000001*G5_0_1 + 0.150000000000002*G5_1_0 + 0.0750000000000016*G5_1_1;
-    A[237] = 0.112500000000001*G4_0_0 - 0.112500000000002*G4_0_1 - 0.075000000000001*G4_1_0 - 0.0375000000000008*G4_1_1 + 0.112500000000001*G5_0_0 - 0.112500000000002*G5_0_1 - 0.075000000000001*G5_1_0 - 0.0375000000000008*G5_1_1;
-    A[238] = -0.075000000000001*G4_0_0 + 0.262500000000002*G4_1_0 - 0.187500000000001*G4_1_1 - 0.075000000000001*G5_0_0 + 0.262500000000002*G5_1_0 - 0.187500000000001*G5_1_1;
-    A[239] = 0.0375000000000005*G4_0_0 - 0.187500000000002*G4_1_0 + 0.0374999999999981*G4_1_1 + 0.0375000000000005*G5_0_0 - 0.187500000000002*G5_1_0 + 0.0374999999999981*G5_1_1;
+    A[237] = 0.112500000000001*G4_0_0 - 0.112500000000002*G4_0_1 - 0.075000000000001*G4_1_0 - 0.0375000000000007*G4_1_1 + 0.112500000000001*G5_0_0 - 0.112500000000002*G5_0_1 - 0.075000000000001*G5_1_0 - 0.0375000000000007*G5_1_1;
+    A[238] = -0.0750000000000011*G4_0_0 + 0.262500000000002*G4_1_0 - 0.187500000000001*G4_1_1 - 0.0750000000000011*G5_0_0 + 0.262500000000002*G5_1_0 - 0.187500000000001*G5_1_1;
+    A[239] = 0.0375000000000006*G4_0_0 - 0.187500000000002*G4_1_0 + 0.0374999999999981*G4_1_1 + 0.0375000000000006*G5_0_0 - 0.187500000000002*G5_1_0 + 0.0374999999999981*G5_1_1;
     A[240] = -0.224999999999997*G4_0_0 - 0.225000000000003*G4_1_0 - 0.112500000000002*G4_1_1 - 0.224999999999997*G5_0_0 - 0.225000000000003*G5_1_0 - 0.112500000000002*G5_1_1;
-    A[241] = -0.112500000000001*G4_0_0 - 0.450000000000001*G4_1_0 - 0.224999999999998*G4_1_1 - 0.112500000000001*G5_0_0 - 0.450000000000001*G5_1_0 - 0.224999999999998*G5_1_1;
+    A[241] = -0.112500000000002*G4_0_0 - 0.450000000000001*G4_1_0 - 0.224999999999998*G4_1_1 - 0.112500000000002*G5_0_0 - 0.450000000000001*G5_1_0 - 0.224999999999998*G5_1_1;
     A[242] = 0.0;
     A[243] = 0.0;
     A[244] = 0.0;
@@ -11943,12 +13505,12 @@ public:
     A[249] = 0.0;
     A[250] = 0.0;
     A[251] = 0.0;
-    A[252] = 0.0375*G4_0_0 + 0.187500000000001*G4_1_0 + 0.0374999999999995*G4_1_1 + 0.0375*G5_0_0 + 0.187500000000001*G5_1_0 + 0.0374999999999995*G5_1_1;
+    A[252] = 0.0375*G4_0_0 + 0.187500000000001*G4_1_0 + 0.0374999999999994*G4_1_1 + 0.0375*G5_0_0 + 0.187500000000001*G5_1_0 + 0.0374999999999994*G5_1_1;
     A[253] = -0.0750000000000005*G4_0_0 - 0.375000000000003*G4_1_0 - 0.187500000000001*G4_1_1 - 0.0750000000000005*G5_0_0 - 0.375000000000003*G5_1_0 - 0.187500000000001*G5_1_1;
     A[254] = 0.225000000000001*G4_0_0 + 0.112500000000001*G4_0_1 - 0.187500000000001*G4_1_0 - 0.150000000000001*G4_1_1 + 0.225000000000001*G5_0_0 + 0.112500000000001*G5_0_1 - 0.187500000000001*G5_1_0 - 0.150000000000001*G5_1_1;
     A[255] = -0.450000000000003*G4_0_0 - 0.112499999999999*G4_0_1 + 0.375000000000003*G4_1_0 + 0.187500000000001*G4_1_1 - 0.450000000000003*G5_0_0 - 0.112499999999999*G5_0_1 + 0.375000000000003*G5_1_0 + 0.187500000000001*G5_1_1;
     A[256] = 0.0375000000000004*G4_0_0 - 0.0750000000000001*G4_1_0 + 0.0375000000000008*G4_1_1 + 0.0375000000000004*G5_0_0 - 0.0750000000000001*G5_1_0 + 0.0375000000000008*G5_1_1;
-    A[257] = 0.0375*G4_0_0 - 0.0750000000000003*G4_1_0 + 0.0375000000000015*G4_1_1 + 0.0375*G5_0_0 - 0.0750000000000003*G5_1_0 + 0.0375000000000015*G5_1_1;
+    A[257] = 0.0375*G4_0_0 - 0.0750000000000003*G4_1_0 + 0.0375000000000016*G4_1_1 + 0.0375*G5_0_0 - 0.0750000000000003*G5_1_0 + 0.0375000000000016*G5_1_1;
     A[258] = -0.1125*G4_0_0 + 0.112500000000002*G4_1_1 - 0.1125*G5_0_0 + 0.112500000000002*G5_1_1;
     A[259] = 0.112500000000001*G4_0_0 - 0.337500000000001*G4_1_0 + 0.225000000000004*G4_1_1 + 0.112500000000001*G5_0_0 - 0.337500000000001*G5_1_0 + 0.225000000000004*G5_1_1;
     A[260] = 0.0;
@@ -11961,13 +13523,13 @@ public:
     A[267] = 0.0;
     A[268] = 0.0;
     A[269] = 0.0;
-    A[270] = 0.0375*G4_0_0 + 0.074999999999999*G4_0_1 + 0.0375000000000004*G4_1_1 + 0.0375*G5_0_0 + 0.074999999999999*G5_0_1 + 0.0375000000000004*G5_1_1;
-    A[271] = 0.0375000000000011*G4_0_0 + 0.0750000000000023*G4_0_1 + 0.0374999999999999*G4_1_1 + 0.0375000000000011*G5_0_0 + 0.0750000000000023*G5_0_1 + 0.0374999999999999*G5_1_1;
-    A[272] = 0.187500000000003*G4_0_0 - 0.262500000000001*G4_0_1 + 0.0750000000000003*G4_1_1 + 0.187500000000003*G5_0_0 - 0.262500000000001*G5_0_1 + 0.0750000000000003*G5_1_1;
-    A[273] = -0.0374999999999999*G4_0_0 + 0.187500000000002*G4_0_1 - 0.0375*G4_1_1 - 0.0374999999999999*G5_0_0 + 0.187500000000002*G5_0_1 - 0.0375*G5_1_1;
-    A[274] = -0.0750000000000011*G4_0_0 - 0.150000000000001*G4_0_1 - 0.112500000000002*G4_1_0 + 0.337500000000002*G4_1_1 - 0.0750000000000011*G5_0_0 - 0.150000000000001*G5_0_1 - 0.112500000000002*G5_1_0 + 0.337500000000002*G5_1_1;
-    A[275] = 0.0375000000000001*G4_0_0 + 0.074999999999999*G4_0_1 + 0.112500000000002*G4_1_0 - 0.112499999999998*G4_1_1 + 0.0375000000000001*G5_0_0 + 0.074999999999999*G5_0_1 + 0.112500000000002*G5_1_0 - 0.112499999999998*G5_1_1;
-    A[276] = -0.224999999999999*G4_0_0 - 0.450000000000005*G4_0_1 - 0.112500000000001*G4_1_1 - 0.224999999999999*G5_0_0 - 0.450000000000005*G5_0_1 - 0.112500000000001*G5_1_1;
+    A[270] = 0.0374999999999997*G4_0_0 + 0.0749999999999989*G4_0_1 + 0.0375000000000003*G4_1_1 + 0.0374999999999997*G5_0_0 + 0.0749999999999989*G5_0_1 + 0.0375000000000003*G5_1_1;
+    A[271] = 0.0375000000000013*G4_0_0 + 0.0750000000000024*G4_0_1 + 0.0374999999999999*G4_1_1 + 0.0375000000000013*G5_0_0 + 0.0750000000000024*G5_0_1 + 0.0374999999999999*G5_1_1;
+    A[272] = 0.187500000000002*G4_0_0 - 0.262500000000001*G4_0_1 + 0.0750000000000003*G4_1_1 + 0.187500000000002*G5_0_0 - 0.262500000000001*G5_0_1 + 0.0750000000000003*G5_1_1;
+    A[273] = -0.0374999999999997*G4_0_0 + 0.187500000000002*G4_0_1 - 0.0375*G4_1_1 - 0.0374999999999997*G5_0_0 + 0.187500000000002*G5_0_1 - 0.0375*G5_1_1;
+    A[274] = -0.075000000000001*G4_0_0 - 0.150000000000001*G4_0_1 - 0.112500000000002*G4_1_0 + 0.337500000000002*G4_1_1 - 0.075000000000001*G5_0_0 - 0.150000000000001*G5_0_1 - 0.112500000000002*G5_1_0 + 0.337500000000002*G5_1_1;
+    A[275] = 0.0374999999999998*G4_0_0 + 0.0749999999999989*G4_0_1 + 0.112500000000003*G4_1_0 - 0.112499999999998*G4_1_1 + 0.0374999999999998*G5_0_0 + 0.0749999999999989*G5_0_1 + 0.112500000000003*G5_1_0 - 0.112499999999998*G5_1_1;
+    A[276] = -0.225*G4_0_0 - 0.450000000000005*G4_0_1 - 0.112500000000001*G4_1_1 - 0.225*G5_0_0 - 0.450000000000005*G5_0_1 - 0.112500000000001*G5_1_1;
     A[277] = -0.112500000000002*G4_0_0 - 0.225000000000004*G4_0_1 - 0.225*G4_1_1 - 0.112500000000002*G5_0_0 - 0.225000000000004*G5_0_1 - 0.225*G5_1_1;
     A[278] = 0.0;
     A[279] = 0.0;
@@ -11980,10 +13542,10 @@ public:
     A[286] = 0.0;
     A[287] = 0.0;
     A[288] = -0.187500000000001*G4_0_0 - 0.375000000000001*G4_0_1 - 0.0750000000000004*G4_1_1 - 0.187500000000001*G5_0_0 - 0.375000000000001*G5_0_1 - 0.0750000000000004*G5_1_1;
-    A[289] = 0.0374999999999995*G4_0_0 + 0.1875*G4_0_1 + 0.0375000000000009*G4_1_1 + 0.0374999999999995*G5_0_0 + 0.1875*G5_0_1 + 0.0375000000000009*G5_1_1;
-    A[290] = -0.0375000000000022*G4_0_0 + 0.0749999999999997*G4_0_1 - 0.0374999999999997*G4_1_1 - 0.0375000000000022*G5_0_0 + 0.0749999999999997*G5_0_1 - 0.0374999999999997*G5_1_1;
-    A[291] = -0.0375000000000006*G4_0_0 + 0.075000000000001*G4_0_1 - 0.0375000000000008*G4_1_1 - 0.0375000000000006*G5_0_0 + 0.075000000000001*G5_0_1 - 0.0375000000000008*G5_1_1;
-    A[292] = 0.150000000000001*G4_0_0 + 0.187500000000001*G4_0_1 - 0.1125*G4_1_0 - 0.225*G4_1_1 + 0.150000000000001*G5_0_0 + 0.187500000000001*G5_0_1 - 0.1125*G5_1_0 - 0.225*G5_1_1;
+    A[289] = 0.0374999999999994*G4_0_0 + 0.1875*G4_0_1 + 0.0375000000000009*G4_1_1 + 0.0374999999999994*G5_0_0 + 0.1875*G5_0_1 + 0.0375000000000009*G5_1_1;
+    A[290] = -0.0375000000000021*G4_0_0 + 0.0749999999999997*G4_0_1 - 0.0374999999999997*G4_1_1 - 0.0375000000000021*G5_0_0 + 0.0749999999999997*G5_0_1 - 0.0374999999999997*G5_1_1;
+    A[291] = -0.0375000000000008*G4_0_0 + 0.0750000000000011*G4_0_1 - 0.0375000000000008*G4_1_1 - 0.0375000000000008*G5_0_0 + 0.0750000000000011*G5_0_1 - 0.0375000000000008*G5_1_1;
+    A[292] = 0.150000000000001*G4_0_0 + 0.187500000000001*G4_0_1 - 0.112499999999999*G4_1_0 - 0.225*G4_1_1 + 0.150000000000001*G5_0_0 + 0.187500000000001*G5_0_1 - 0.112499999999999*G5_1_0 - 0.225*G5_1_1;
     A[293] = -0.187500000000001*G4_0_0 - 0.375000000000001*G4_0_1 + 0.112499999999999*G4_1_0 + 0.450000000000001*G4_1_1 - 0.187500000000001*G5_0_0 - 0.375000000000001*G5_0_1 + 0.112499999999999*G5_1_0 + 0.450000000000001*G5_1_1;
     A[294] = 0.225*G4_0_0 - 0.337499999999998*G4_0_1 + 0.1125*G4_1_1 + 0.225*G5_0_0 - 0.337499999999998*G5_0_1 + 0.1125*G5_1_1;
     A[295] = 0.112500000000002*G4_0_0 - 0.112499999999997*G4_1_1 + 0.112500000000002*G5_0_0 - 0.112499999999997*G5_1_1;
@@ -12002,7 +13564,7 @@ public:
     A[308] = 0.450000000000005*G4_0_0 + 0.450000000000003*G4_0_1 - 0.225000000000003*G4_1_0 - 0.225000000000002*G4_1_1 + 0.450000000000005*G5_0_0 + 0.450000000000003*G5_0_1 - 0.225000000000003*G5_1_0 - 0.225000000000002*G5_1_1;
     A[309] = -0.450000000000004*G4_0_1 + 0.225000000000002*G4_1_1 - 0.450000000000004*G5_0_1 + 0.225000000000002*G5_1_1;
     A[310] = 0.225000000000003*G4_0_0 + 0.225000000000004*G4_0_1 - 0.450000000000004*G4_1_0 - 0.450000000000005*G4_1_1 + 0.225000000000003*G5_0_0 + 0.225000000000004*G5_0_1 - 0.450000000000004*G5_1_0 - 0.450000000000005*G5_1_1;
-    A[311] = -0.225000000000001*G4_0_0 + 0.450000000000004*G4_1_0 - 0.225000000000001*G5_0_0 + 0.450000000000004*G5_1_0;
+    A[311] = -0.225000000000002*G4_0_0 + 0.450000000000004*G4_1_0 - 0.225000000000002*G5_0_0 + 0.450000000000004*G5_1_0;
     A[312] = -0.225000000000002*G4_0_0 + 0.225000000000002*G4_0_1 + 0.450000000000006*G4_1_0 + 0.225000000000003*G4_1_1 - 0.225000000000002*G5_0_0 + 0.225000000000002*G5_0_1 + 0.450000000000006*G5_1_0 + 0.225000000000003*G5_1_1;
     A[313] = 0.225000000000004*G4_0_0 + 0.450000000000007*G4_0_1 + 0.225000000000003*G4_1_0 - 0.225000000000005*G4_1_1 + 0.225000000000004*G5_0_0 + 0.450000000000007*G5_0_1 + 0.225000000000003*G5_1_0 - 0.225000000000005*G5_1_1;
     A[314] = 0.0;
@@ -12019,38 +13581,31 @@ public:
 
 };
 
-/// 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 mixedpoissondual_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   mixedpoissondual_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_cell_integral_1_otherwise()
+  ~mixedpoissondual_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -12059,7 +13614,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -12097,39 +13652,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class mixedpoissondual_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   mixedpoissondual_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_exterior_facet_integral_1_otherwise()
+  ~mixedpoissondual_exterior_facet_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -12138,7 +13686,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -12151,8 +13699,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -12236,77 +13784,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class mixedpoissondual_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   mixedpoissondual_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_form_0()
+  ~mixedpoissondual_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "281c7cceadbd46b41ca21479957d5a8bc593c074bb311081a7d6203011c4b7e5c60333622be48a900e67fcab0aa8c71912f51e1b9191e06c3411dee826c6b38a";
+    return "46d8cd974dfa45d2017b0c800fb5cd88d3d330deca42ed75976a0ce1a2bad00bb842e756820ce534dfbd3ef8fd49e02ed1f6015913c18479b3434a781ad5e6e1";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new mixedpoissondual_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new mixedpoissondual_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoissondual_finite_element_3();
+        return new mixedpoissondual_finite_element_4();
         break;
       }
     case 1:
       {
-        return new mixedpoissondual_finite_element_3();
+        return new mixedpoissondual_finite_element_4();
         break;
       }
     }
@@ -12314,19 +13854,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoissondual_dofmap_3();
+        return new mixedpoissondual_dofmap_4();
         break;
       }
     case 1:
       {
-        return new mixedpoissondual_dofmap_3();
+        return new mixedpoissondual_dofmap_4();
         break;
       }
     }
@@ -12334,198 +13873,226 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new mixedpoissondual_cell_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new mixedpoissondual_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class mixedpoissondual_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   mixedpoissondual_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoissondual_form_1()
+  ~mixedpoissondual_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "13c3604bdb66825e5ab9e1d74975a6f1005312f75b72afc6f211cb8d2fd0126ddd4c84f09dff882d8fcb25118646411d451ad6a4212bf01654429f940bd793b2";
+    return "717dcecc3642f3db1c1e735b3bb475e901808f18c00bd4ffb8cd0c98bfcf5c38436c56e8e3a3bc9828b1ac37f4431f930b8fd74b23f6df07ad50a7bee787cb86";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new mixedpoissondual_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new mixedpoissondual_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoissondual_finite_element_3();
+        return new mixedpoissondual_finite_element_4();
         break;
       }
     case 1:
@@ -12543,14 +14110,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoissondual_dofmap_3();
+        return new mixedpoissondual_dofmap_4();
         break;
       }
     case 1:
@@ -12568,126 +14134,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new mixedpoissondual_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new mixedpoissondual_exterior_facet_integral_1_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -12701,14 +14303,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace MixedPoissonDual
 {
@@ -12717,43 +14325,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12764,43 +14349,20 @@ class CoefficientSpace_g: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12811,43 +14373,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -12858,63 +14397,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoissondual_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -12922,7 +14468,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoissondual_form_0());
+    _ufc_form = std::make_shared<const mixedpoissondual_form_0>();
   }
 
   // Destructor
@@ -12952,57 +14498,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoissondual_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoissondual_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoissondual_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoissondual_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_g Form_L_FunctionSpace_2;
@@ -13012,73 +14613,118 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoissondual_form_1());
+    _ufc_form = std::make_shared<const mixedpoissondual_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
     this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoissondual_form_1());
+    _ufc_form = std::make_shared<const mixedpoissondual_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
-    this->g = *g;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+    else if (name == "g")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoissondual_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    case 1:
+      return "g";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoissondual_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner g;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
-    this->g = g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoissondual_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
-    this->g = *g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+    this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoissondual_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -13114,20 +14760,26 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner g;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner g;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/mixed-poisson-dual/cpp/compile.log b/demo/documented/mixed-poisson-dual/cpp/compile.log
index 856842e..7099caa 100644
--- a/demo/documented/mixed-poisson-dual/cpp/compile.log
+++ b/demo/documented/mixed-poisson-dual/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form MixedPoissonDual
 
@@ -12,8 +13,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Mixed<DRT2(?), CG3(?)>'
-  Unique sub elements:       'Mixed<DRT2(?), CG3(?)>, DRT2(?), CG3(?)'
+  Unique elements:           'Mixed<DRT2(?), CG3(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'Mixed<DRT2(?), CG3(?)>, Vector<2 x CG1(?)>, DRT2(?), C
+                             G3(?), CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -42,9 +44,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -53,9 +55,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              2
   Coefficients:                        '[w_0, w_1]'
-  Unique elements:                     'Mixed<DRT2(?), CG3(?)>, CG1(?)'
-  Unique sub elements:                 'Mixed<DRT2(?), CG3(?)>, CG1(?), DRT2(?), CG3
-                                       (?)'
+  Unique elements:                     'Mixed<DRT2(?), CG3(?)>, CG1(?), Vector<2 x C
+                                       G1(?)>'
+  Unique sub elements:                 'Mixed<DRT2(?), CG3(?)>, CG1(?), Vector<2 x C
+                                       G1(?)>, DRT2(?), CG3(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -63,9 +66,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -73,15 +76,20 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.290465 seconds.
+Compiler stage 1 finished in 0.678321 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -90,10 +98,16 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 5 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -125,7 +139,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  1296 entries computed in 0.00138 seconds
+  1296 entries computed in 0.00188 seconds
   Shape of reference tensor: (18, 18, 2, 2)
   Primary multi index:   rank = 2 dims = [18, 18] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2 [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -134,7 +148,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  1296 entries computed in 0.00132 seconds
+  1296 entries computed in 0.00179 seconds
   Shape of reference tensor: (18, 18, 2, 2)
   Primary multi index:   rank = 2 dims = [18, 18] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2 [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -143,7 +157,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  1296 entries computed in 0.00142 seconds
+  1296 entries computed in 0.00185 seconds
   Shape of reference tensor: (18, 18, 2, 2)
   Primary multi index:   rank = 2 dims = [18, 18] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2 [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -152,7 +166,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  1296 entries computed in 0.00144 seconds
+  1296 entries computed in 0.00206 seconds
   Shape of reference tensor: (18, 18, 2, 2)
   Primary multi index:   rank = 2 dims = [18, 18] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2 [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -161,7 +175,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  1296 entries computed in 0.00151 seconds
+  1296 entries computed in 0.00261 seconds
   Shape of reference tensor: (18, 18, 2, 2)
   Primary multi index:   rank = 2 dims = [18, 18] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2 [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -170,7 +184,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  1296 entries computed in 0.00148 seconds
+  1296 entries computed in 0.00216 seconds
   Shape of reference tensor: (18, 18, 2, 2)
   Primary multi index:   rank = 2 dims = [18, 18] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [2 [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -187,7 +201,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00125 seconds
+  54 entries computed in 0.00175 seconds
   Shape of reference tensor: (18, 3)
   Primary multi index:   rank = 1 dims = [18] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -204,7 +218,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00172 seconds
+  54 entries computed in 0.00285 seconds
   Shape of reference tensor: (18, 3)
   Primary multi index:   rank = 1 dims = [18] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -214,7 +228,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00164 seconds
+  54 entries computed in 0.0026 seconds
   Shape of reference tensor: (18, 3)
   Primary multi index:   rank = 1 dims = [18] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -224,7 +238,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  54 entries computed in 0.00163 seconds
+  54 entries computed in 0.00258 seconds
   Shape of reference tensor: (18, 3)
   Primary multi index:   rank = 1 dims = [18] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -234,512 +248,69 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.033742 seconds.
+Compiler stage 2 finished in 0.0604539 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000161171 seconds.
+Compiler stage 3 finished in 0.000254869 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
+  Generating code for 5 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.633046 seconds.
+Compiler stage 4 finished in 0.918485 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000569105 seconds.
+Compiler stage 4.1 finished in 0.00102019 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./MixedPoissonDual.h.
-Compiler stage 5 finished in 0.001302 seconds.
+Compiler stage 5 finished in 0.00387502 seconds.
 
-FFC finished in 0.95961 seconds.
+FFC finished in 1.66308 seconds.
+Output written to ./MixedPoissonDual.h.
diff --git a/demo/documented/mixed-poisson-dual/cpp/documentation.rst b/demo/documented/mixed-poisson-dual/cpp/documentation.rst
index fa1cb94..6a49252 100644
--- a/demo/documented/mixed-poisson-dual/cpp/documentation.rst
+++ b/demo/documented/mixed-poisson-dual/cpp/documentation.rst
@@ -134,7 +134,7 @@ formulation. We also define the bilinear form ``a`` and linear form
 .. code-block:: c++
 
     // Construct function space
-    MixedPoissonDual::FunctionSpace W(mesh);
+    auto W = std::make_shared<MixedPoissonDual::FunctionSpace>(mesh);
     MixedPoissonDual::BilinearForm a(W, W);
     MixedPoissonDual::LinearForm L(W);
 
@@ -144,8 +144,8 @@ linear form.
 .. code-block:: c++
 
     // Create sources and assign to L
-    Source f;
-    BoundarySource g;
+    auto f = std::make_shared<Source>();
+    auto g = std::make_shared<BoundarySource>();
     L.f = f;
     L.g = g;
 
@@ -156,16 +156,14 @@ space the boundary condition is supposed to be applied to, the data
 for the boundary condition, and the relevant part of the boundary.
 
 We want to apply the boundary condition to the second subspace of the
-mixed space. This space can be accessed by the :cpp:class:`Subspace`
-class.
+mixed space.
 
 .. code-block:: c++
 
     // Define boundary condition
-    Constant zero(0.0);
-    SubSpace W1(W, 1);
-    DirichletBoundary boundary;
-    DirichletBC bc(W1, zero, boundary);
+    auto zero = std::make_shared<Constant>(0.0);
+    auto boundary = std::make_shared<DirichletBoundary>();
+    DirichletBC bc(W->sub(1), zero, boundary);
 
 To compute the solution we use the bilinear and linear forms, and the
 boundary condition, but we also need to create a :cpp:class:`Function`
diff --git a/demo/documented/mixed-poisson-dual/cpp/main.cpp b/demo/documented/mixed-poisson-dual/cpp/main.cpp
index 3dc9c7e..ddc2b83 100644
--- a/demo/documented/mixed-poisson-dual/cpp/main.cpp
+++ b/demo/documented/mixed-poisson-dual/cpp/main.cpp
@@ -51,24 +51,23 @@ class DirichletBoundary : public SubDomain
 int main()
 {
   // Create mesh
-  UnitSquareMesh mesh(32, 32);
+  auto mesh = std::make_shared<UnitSquareMesh>(32, 32);
 
   // Construct function space
-  MixedPoissonDual::FunctionSpace W(mesh);
+  auto W = std::make_shared<MixedPoissonDual::FunctionSpace>(mesh);
   MixedPoissonDual::BilinearForm a(W, W);
   MixedPoissonDual::LinearForm L(W);
 
   // Create sources and assign to L
-  Source f;
-  BoundarySource g;
+  auto f = std::make_shared<Source>();
+  auto g = std::make_shared<BoundarySource>();
   L.f = f;
   L.g = g;
 
   // Define boundary condition
-  Constant zero(0.0);
-  SubSpace W1(W, 1);
-  DirichletBoundary boundary;
-  DirichletBC bc(W1, zero, boundary);
+  auto zero = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
+  DirichletBC bc(W->sub(1), zero, boundary);
 
   // Compute solution
   Function w(W);
diff --git a/demo/documented/mixed-poisson-dual/python/demo_mixed-poisson-dual.py b/demo/documented/mixed-poisson-dual/python/demo_mixed-poisson-dual.py
index bb8f2e6..427beea 100644
--- a/demo/documented/mixed-poisson-dual/python/demo_mixed-poisson-dual.py
+++ b/demo/documented/mixed-poisson-dual/python/demo_mixed-poisson-dual.py
@@ -45,18 +45,18 @@ from dolfin import *
 # Create mesh
 mesh = UnitSquareMesh(32, 32)
 
-# Define function spaces and mixed (product) space
-DRT = FunctionSpace(mesh, "DRT", 2)
-CG  = FunctionSpace(mesh, "CG", 3)
-W = DRT * CG
+# Define finite elements spaces and build mixed space
+DRT = FiniteElement("DRT", mesh.ufl_cell(), 2)
+CG  = FiniteElement("CG", mesh.ufl_cell(), 3)
+W = FunctionSpace(mesh, DRT * CG)
 
 # Define trial and test functions
 (sigma, u) = TrialFunctions(W)
 (tau, v) = TestFunctions(W)
 
 # Define source functions
-f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-g = Expression("sin(5.0*x[0])")
+f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+g = Expression("sin(5.0*x[0])", degree=2)
 
 # Define variational form
 a = (dot(sigma, tau) + dot(grad(u), tau) + dot(sigma, grad(v)))*dx
diff --git a/demo/documented/mixed-poisson-dual/python/documentation.rst b/demo/documented/mixed-poisson-dual/python/documentation.rst
index b17fba9..bae2f67 100644
--- a/demo/documented/mixed-poisson-dual/python/documentation.rst
+++ b/demo/documented/mixed-poisson-dual/python/documentation.rst
@@ -37,24 +37,18 @@ the unit square. In this example, we will let the mesh consist of 32 x
    pair: FunctionSpace; Discontinuous Raviart-Thomas
    pair: FunctionSpace; Lagrange
 
-Next, we need to define the function spaces. We define the two
-function spaces :math:`\Sigma_h = DRT` and :math:`V_h = CG`
-separately, before combining these into a mixed function space:
+Next, we need to build the function space.
 
 .. code-block:: python
 
-    # Define function spaces and mixed (product) space
-    DRT = FunctionSpace(mesh, "DRT", 2)
-    CG = FunctionSpace(mesh, "CG", 3)
-    W = DRT * CG
+    # Define finite elements spaces and build mixed space
+    DRT = FiniteElement("DRT", mesh.ufl_cell(), 2)
+    CG  = FiniteElement("CG", mesh.ufl_cell(), 3)
+    W = FunctionSpace(mesh, DRT * CG)
 
 The second argument to :py:class:`FunctionSpace
-<dolfin.functions.functionspace.FunctionSpace>` specifies the type of
-finite element family, while the third argument specifies the
-polynomial degree. The UFL user manual contains a list of all
-available finite element families and more details.  The * operator
-creates a mixed (product) space ``W`` from the two separate spaces
-``DRT`` and ``CG``. Hence,
+<dolfin.functions.functionspace.FunctionSpace>` specifies underlying
+finite element, here mixed element obtained by ``*`` operator.
 
 .. math::
 
@@ -77,8 +71,8 @@ source functions :math:`f` and :math:`g`. This is done just as for the
 .. code-block:: python
 
     # Define source functions
-    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-    g = Expression("sin(5.0*x[0])")
+    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+    g = Expression("sin(5.0*x[0])", degree=2)
 
 We are now ready to define the variational forms a and L.
 
@@ -96,10 +90,10 @@ to be applied to, the data for the boundary condition, and the
 relevant part of the boundary.
 
 We want to apply the boundary condition to the second subspace of the
-mixed space. Subspaces of a :py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>` can be accessed
+mixed space. Subspaces of a mixed :py:class:`FunctionSpace
+<dolfin.functions.functionspace.FunctionSpace>` can be accessed
 by the method :py:func:`sub
-<dolfin.functions.functionspace.FunctionSpaceBase.sub>`. In our case,
+<dolfin.functions.functionspace.FunctionSpace.sub>`. In our case,
 this reads ``W.sub(1)``. (Do *not* use the separate space ``CG`` as
 this would mess up the numbering.)
 
diff --git a/demo/documented/mixed-poisson/cpp/CMakeLists.txt b/demo/documented/mixed-poisson/cpp/CMakeLists.txt
index 1e7dec8..29dd3e3 100644
--- a/demo/documented/mixed-poisson/cpp/CMakeLists.txt
+++ b/demo/documented/mixed-poisson/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/mixed-poisson/cpp/MixedPoisson.h b/demo/documented/mixed-poisson/cpp/MixedPoisson.h
index 712f48d..0ec0c80 100644
--- a/demo/documented/mixed-poisson/cpp/MixedPoisson.h
+++ b/demo/documented/mixed-poisson/cpp/MixedPoisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __MIXEDPOISSON_H
 #define __MIXEDPOISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class mixedpoisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   mixedpoisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_finite_element_0()
+  ~mixedpoisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,98 +902,104 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new mixedpoisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class mixedpoisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   mixedpoisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_finite_element_1()
+  ~mixedpoisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Brezzi-Douglas-Marini', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1004,16 +1013,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1021,10 +1044,9 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     
-    
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1054,23 +1076,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.942809041582063, 0.577350269189626, -0.333333333333333};
-      
-      static const double coefficients1[3] = \
-      {-0.471404520791032, 0.0, -0.333333333333333};
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 1:
@@ -1092,23 +1104,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {-0.471404520791032, -0.288675134594813, 0.166666666666667};
-      
-      static const double coefficients1[3] = \
-      {0.942809041582063, 0.0, 0.666666666666667};
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 2:
@@ -1130,23 +1132,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.471404520791032, -0.577350269189626, -0.666666666666667};
-      
-      static const double coefficients1[3] = \
       {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 3:
@@ -1168,23 +1160,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, 0.833333333333333};
-      
-      static const double coefficients1[3] = \
-      {-0.942809041582063, 0.0, -0.666666666666667};
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 4:
@@ -1206,23 +1188,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {-0.471404520791032, -0.288675134594813, 0.166666666666667};
-      
-      static const double coefficients1[3] = \
-      {-0.471404520791032, 0.866025403784438, 0.166666666666667};
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     case 5:
@@ -1244,43 +1216,31 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.942809041582063, 0.577350269189626, -0.333333333333334};
-      
-      static const double coefficients1[3] = \
-      {-0.471404520791032, -0.866025403784439, 0.166666666666667};
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using contravariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
         break;
       }
     }
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1289,7 +1249,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1297,21 +1257,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1331,7 +1289,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1343,7 +1301,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1351,10 +1309,9 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     
-    
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1428,10 +1385,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.942809041582063, 0.577350269189626, -0.333333333333333};
-      
-      static const double coefficients1[3] = \
-      {-0.471404520791032, 0.0, -0.333333333333333};
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[3][3] = \
@@ -1446,19 +1400,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[3][3] = \
       {{1.0, 0.0, 0.0},
@@ -1536,15 +1483,8 @@ public:
           for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using contravariant Piola transform to map values back to the physical element.
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1552,8 +1492,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -1577,10 +1516,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {-0.471404520791032, -0.288675134594813, 0.166666666666667};
-      
-      static const double coefficients1[3] = \
-      {0.942809041582063, 0.0, 0.666666666666667};
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[3][3] = \
@@ -1595,19 +1531,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[3][3] = \
       {{1.0, 0.0, 0.0},
@@ -1685,15 +1614,8 @@ public:
           for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using contravariant Piola transform to map values back to the physical element.
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1701,8 +1623,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -1726,9 +1647,6 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.471404520791032, -0.577350269189626, -0.666666666666667};
-      
-      static const double coefficients1[3] = \
       {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
@@ -1744,19 +1662,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[3][3] = \
       {{1.0, 0.0, 0.0},
@@ -1834,15 +1745,8 @@ public:
           for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using contravariant Piola transform to map values back to the physical element.
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1850,8 +1754,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -1875,10 +1778,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, 0.833333333333333};
-      
-      static const double coefficients1[3] = \
-      {-0.942809041582063, 0.0, -0.666666666666667};
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[3][3] = \
@@ -1893,19 +1793,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[3][3] = \
       {{1.0, 0.0, 0.0},
@@ -1983,15 +1876,8 @@ public:
           for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using contravariant Piola transform to map values back to the physical element.
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
-        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1999,8 +1885,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -2024,10 +1909,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[3] = \
-      {-0.471404520791032, -0.288675134594813, 0.166666666666667};
-      
-      static const double coefficients1[3] = \
-      {-0.471404520791032, 0.866025403784438, 0.166666666666667};
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[3][3] = \
@@ -2042,19 +1924,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[3][3] = \
       {{1.0, 0.0, 0.0},
@@ -2132,11 +2007,1620 @@ public:
           for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using contravariant Piola transform to map values back to the physical element.
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new mixedpoisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new mixedpoisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new mixedpoisson_finite_element_1();
+  }
+
+};
+
+
+class mixedpoisson_finite_element_2: public ufc::finite_element
+{
+public:
+
+  mixedpoisson_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~mixedpoisson_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Brezzi-Douglas-Marini', triangle, 1)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Brezzi-Douglas-Marini";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.942809041582063, 0.577350269189626, -0.333333333333333};
+      
+      static const double coefficients1[3] = \
+      {-0.471404520791032, 0.0, -0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {-0.471404520791032, -0.288675134594813, 0.166666666666667};
+      
+      static const double coefficients1[3] = \
+      {0.942809041582063, 0.0, 0.666666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.577350269189626, -0.666666666666667};
+      
+      static const double coefficients1[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, 0.833333333333333};
+      
+      static const double coefficients1[3] = \
+      {-0.942809041582063, 0.0, -0.666666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {-0.471404520791032, -0.288675134594813, 0.166666666666667};
+      
+      static const double coefficients1[3] = \
+      {-0.471404520791032, 0.866025403784438, 0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.942809041582063, 0.577350269189626, -0.333333333333334};
+      
+      static const double coefficients1[3] = \
+      {-0.471404520791032, -0.866025403784439, 0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using contravariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+      values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.942809041582063, 0.577350269189626, -0.333333333333333};
+      
+      static const double coefficients1[3] = \
+      {-0.471404520791032, 0.0, -0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+        
+        // Using contravariant Piola transform to map values back to the physical element.
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {-0.471404520791032, -0.288675134594813, 0.166666666666667};
+      
+      static const double coefficients1[3] = \
+      {0.942809041582063, 0.0, 0.666666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+        
+        // Using contravariant Piola transform to map values back to the physical element.
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.577350269189626, -0.666666666666667};
+      
+      static const double coefficients1[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+        
+        // Using contravariant Piola transform to map values back to the physical element.
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, 0.833333333333333};
+      
+      static const double coefficients1[3] = \
+      {-0.942809041582063, 0.0, -0.666666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+        
+        // Using contravariant Piola transform to map values back to the physical element.
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
+        derivatives_p[num_derivatives + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {-0.471404520791032, -0.288675134594813, 0.166666666666667};
+      
+      static const double coefficients1[3] = \
+      {-0.471404520791032, 0.866025403784438, 0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+        
+        // Using contravariant Piola transform to map values back to the physical element.
         const double tmp_ref0 = derivatives[r];
         const double tmp_ref1 = derivatives[num_derivatives + r];
         derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
@@ -2307,28 +3791,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2364,7 +3846,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2372,22 +3854,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2398,7 +3878,7 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -2411,8 +3891,8 @@ public:
     {
     case 0:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -2420,8 +3900,8 @@ public:
       }
     case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -2429,8 +3909,8 @@ public:
       }
     case 2:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -2438,8 +3918,8 @@ public:
       }
     case 3:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -2447,8 +3927,8 @@ public:
       }
     case 4:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -2456,8 +3936,8 @@ public:
       }
     case 5:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -2468,12 +3948,11 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2484,7 +3963,7 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -2493,48 +3972,47 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[0] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[1] = result;
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[2] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[3] = result;
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[4] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[5] = result;
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -2553,112 +4031,129 @@ public:
     vertex_values[5] = dof_values[0]*((1.0/detJ)*(J[3]*(-1.0))) + dof_values[1]*(1.0/detJ)*J[3]*2.0 + dof_values[2]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[3]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[3] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[4] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[5] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[6] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[7] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[8] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[9] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[10] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[11] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new mixedpoisson_finite_element_1();
+    return new mixedpoisson_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class mixedpoisson_finite_element_2: public ufc::finite_element
+class mixedpoisson_finite_element_3: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  mixedpoisson_finite_element_2() : ufc::finite_element()
+  mixedpoisson_finite_element_3() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_finite_element_2()
+  ~mixedpoisson_finite_element_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2692,41 +4187,37 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2746,7 +4237,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2758,44 +4249,40 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -2806,8 +4293,8 @@ public:
     {
     case 0:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -2817,30 +4304,28 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2848,98 +4333,100 @@ public:
     vertex_values[2] = dof_values[0];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new mixedpoisson_finite_element_2();
+    return new mixedpoisson_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class mixedpoisson_finite_element_3: public ufc::finite_element
+class mixedpoisson_finite_element_4: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  mixedpoisson_finite_element_3() : ufc::finite_element()
+  mixedpoisson_finite_element_4() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_finite_element_3()
+  ~mixedpoisson_finite_element_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(FiniteElement('Brezzi-Douglas-Marini', Domain(Cell('triangle', 2)), 1, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None), **{'value_shape': (3,) })";
+    return "MixedElement(FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Discontinuous Lagrange', triangle, 0))";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 7;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2953,16 +4440,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2972,8 +4473,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -3239,20 +4740,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -3261,7 +4760,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 7; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -3269,21 +4768,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -3303,7 +4800,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -3315,7 +4812,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3325,8 +4822,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -4396,28 +5893,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4453,7 +5948,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 7; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -4461,22 +5956,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -4487,7 +5980,7 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -4500,8 +5993,8 @@ public:
     {
     case 0:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -4509,8 +6002,8 @@ public:
       }
     case 1:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -4518,8 +6011,8 @@ public:
       }
     case 2:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -4527,8 +6020,8 @@ public:
       }
     case 3:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
       return result;
@@ -4536,8 +6029,8 @@ public:
       }
     case 4:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -4545,8 +6038,8 @@ public:
       }
     case 5:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
       return result;
@@ -4554,8 +6047,8 @@ public:
       }
     case 6:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -4565,12 +6058,11 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -4581,7 +6073,7 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -4590,52 +6082,51 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[0] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1])) + (detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[1] = result;
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[2] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (detJ*(K[0]*vals[0] + K[1]*vals[1]));
     values[3] = result;
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[4] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (-1.0)*(detJ*(K[2]*vals[0] + K[3]*vals[1]));
     values[5] = result;
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[6] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -4654,45 +6145,46 @@ public:
     vertex_values[7] = dof_values[0]*((1.0/detJ)*(J[3]*(-1.0))) + dof_values[1]*(1.0/detJ)*J[3]*2.0 + dof_values[2]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[3]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
     // Evaluate function and change variables
     vertex_values[2] = dof_values[6];
-    vertex_values[5] = dof_values[6];
-    vertex_values[8] = dof_values[6];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[5] = dof_values[6];
+    vertex_values[8] = dof_values[6];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[2] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[3] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[4] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[5] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[6] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[7] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[8] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[9] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[10] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[11] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoisson_finite_element_1();
+        return new mixedpoisson_finite_element_2();
         break;
       }
     case 1:
       {
-        return new mixedpoisson_finite_element_2();
+        return new mixedpoisson_finite_element_3();
         break;
       }
     }
@@ -4700,41 +6192,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new mixedpoisson_finite_element_3();
+    return new mixedpoisson_finite_element_4();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class mixedpoisson_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   mixedpoisson_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_dofmap_0()
+  ~mixedpoisson_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4758,39 +6243,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4814,19 +6288,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4852,9 +6324,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4905,76 +6376,56 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new mixedpoisson_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class mixedpoisson_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   mixedpoisson_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_dofmap_1()
+  ~mixedpoisson_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Brezzi-Douglas-Marini', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -4987,39 +6438,252 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new mixedpoisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new mixedpoisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new mixedpoisson_dofmap_1();
+  }
+
+};
+
+
+class mixedpoisson_dofmap_2: public ufc::dofmap
+{
+public:
+
+  mixedpoisson_dofmap_2() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~mixedpoisson_dofmap_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Brezzi-Douglas-Marini', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return false;
+        break;
+      }
+    case 1:
+      {
+        return true;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5043,22 +6707,20 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 2*c.entity_indices[1][0];
-    dofs[1] = 2*c.entity_indices[1][0] + 1;
-    dofs[2] = 2*c.entity_indices[1][1];
-    dofs[3] = 2*c.entity_indices[1][1] + 1;
-    dofs[4] = 2*c.entity_indices[1][2];
-    dofs[5] = 2*c.entity_indices[1][2] + 1;
+    dofs[0] = 2*entity_indices[1][0];
+    dofs[1] = 2*entity_indices[1][0] + 1;
+    dofs[2] = 2*entity_indices[1][1];
+    dofs[3] = 2*entity_indices[1][1] + 1;
+    dofs[4] = 2*entity_indices[1][2];
+    dofs[5] = 2*entity_indices[1][2] + 1;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5084,9 +6746,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -5140,71 +6801,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[3] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[4] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[5] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[6] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[7] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[8] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[9] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[10] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[11] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new mixedpoisson_dofmap_1();
+    return new mixedpoisson_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class mixedpoisson_dofmap_2: public ufc::dofmap
+class mixedpoisson_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  mixedpoisson_dofmap_2() : ufc::dofmap()
+  mixedpoisson_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_dofmap_2()
+  ~mixedpoisson_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5228,39 +6863,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5284,17 +6908,15 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[2][0];
+    dofs[0] = entity_indices[2][0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5317,9 +6939,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -5352,61 +6973,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new mixedpoisson_dofmap_2();
+    return new mixedpoisson_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class mixedpoisson_dofmap_3: public ufc::dofmap
+class mixedpoisson_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  mixedpoisson_dofmap_3() : ufc::dofmap()
+  mixedpoisson_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_dofmap_3()
+  ~mixedpoisson_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(FiniteElement('Brezzi-Douglas-Marini', Domain(Cell('triangle', 2)), 1, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for MixedElement(FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Discontinuous Lagrange', triangle, 0))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5430,39 +7035,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[1] + num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 7;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5486,26 +7080,24 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + 2*c.entity_indices[1][0];
-    dofs[1] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[2] = offset + 2*c.entity_indices[1][1];
-    dofs[3] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[4] = offset + 2*c.entity_indices[1][2];
-    dofs[5] = offset + 2*c.entity_indices[1][2] + 1;
+    dofs[0] = offset + 2*entity_indices[1][0];
+    dofs[1] = offset + 2*entity_indices[1][0] + 1;
+    dofs[2] = offset + 2*entity_indices[1][1];
+    dofs[3] = offset + 2*entity_indices[1][1] + 1;
+    dofs[4] = offset + 2*entity_indices[1][2];
+    dofs[5] = offset + 2*entity_indices[1][2] + 1;
     offset += 2*num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[2][0];
+    dofs[6] = offset + entity_indices[2][0];
     offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5531,9 +7123,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -5592,45 +7183,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[2] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[3] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[4] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[5] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[6] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[7] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[8] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[9] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[10] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[11] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoisson_dofmap_1();
+        return new mixedpoisson_dofmap_2();
         break;
       }
     case 1:
       {
-        return new mixedpoisson_dofmap_2();
+        return new mixedpoisson_dofmap_3();
         break;
       }
     }
@@ -5638,46 +7208,38 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new mixedpoisson_dofmap_3();
+    return new mixedpoisson_dofmap_4();
   }
 
 };
 
-/// 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 mixedpoisson_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   mixedpoisson_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_cell_integral_0_otherwise()
+  ~mixedpoisson_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    64
@@ -5686,7 +7248,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5776,38 +7338,31 @@ public:
 
 };
 
-/// 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 mixedpoisson_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   mixedpoisson_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_cell_integral_1_otherwise()
+  ~mixedpoisson_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -5816,7 +7371,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5843,77 +7398,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class mixedpoisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   mixedpoisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_form_0()
+  ~mixedpoisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "474eb30a5ca5f077c243e9114ce8f24cc301e0f84f02896bb9467a72f0f9a59a026ef963c9df9a2c3d19ff5289aa7c48228f8415724db07446ccfe09e05c6aa5";
+    return "ca5641cd2d10cdf97be6b249f1afe32656f91dd1035b9bf8bf5b8ff8cf046e5457d88fa3bdfc78c196b7ca3afcf3803f4c0571cfb092ef798195b70e938e593b";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new mixedpoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new mixedpoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoisson_finite_element_3();
+        return new mixedpoisson_finite_element_4();
         break;
       }
     case 1:
       {
-        return new mixedpoisson_finite_element_3();
+        return new mixedpoisson_finite_element_4();
         break;
       }
     }
@@ -5921,19 +7468,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoisson_dofmap_3();
+        return new mixedpoisson_dofmap_4();
         break;
       }
     case 1:
       {
-        return new mixedpoisson_dofmap_3();
+        return new mixedpoisson_dofmap_4();
         break;
       }
     }
@@ -5941,198 +7487,226 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new mixedpoisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class mixedpoisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   mixedpoisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~mixedpoisson_form_1()
+  ~mixedpoisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "de4a0e2fd75518cd085d1b1e54c0d82df1c890b795727039fcaefa07b8fcfe2866c28d8bb645c5a643d84a93f9d315d36ff80c326b19054e1dde7331a9518f08";
+    return "bbddc01569ae6013c1175030d785b7d352c9f833eb378efad86a7f7627729c56c338998dc4a49decf3741e3826f93e0ca18e0b9fa87f46308cb1ba289e19a246";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new mixedpoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new mixedpoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoisson_finite_element_3();
+        return new mixedpoisson_finite_element_4();
         break;
       }
     case 1:
@@ -6145,14 +7719,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new mixedpoisson_dofmap_3();
+        return new mixedpoisson_dofmap_4();
         break;
       }
     case 1:
@@ -6165,126 +7738,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new mixedpoisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -6298,14 +7907,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace MixedPoisson
 {
@@ -6314,43 +7929,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6361,43 +7953,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6408,63 +7977,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -6472,7 +8048,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoisson_form_0());
+    _ufc_form = std::make_shared<const mixedpoisson_form_0>();
   }
 
   // Destructor
@@ -6502,57 +8078,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoisson_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new mixedpoisson_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new mixedpoisson_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<mixedpoisson_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<mixedpoisson_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -6560,69 +8191,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoisson_form_1());
+    _ufc_form = std::make_shared<const mixedpoisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoisson_form_1());
+    _ufc_form = std::make_shared<const mixedpoisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new mixedpoisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -6654,18 +8326,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/mixed-poisson/cpp/compile.log b/demo/documented/mixed-poisson/cpp/compile.log
index a08e275..2dbe6c6 100644
--- a/demo/documented/mixed-poisson/cpp/compile.log
+++ b/demo/documented/mixed-poisson/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form MixedPoisson
 
@@ -12,8 +13,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Mixed<BDM1(?), DG0(?)>'
-  Unique sub elements:       'Mixed<BDM1(?), DG0(?)>, BDM1(?), DG0(?)'
+  Unique elements:           'Mixed<BDM1(?), DG0(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'Mixed<BDM1(?), DG0(?)>, Vector<2 x CG1(?)>, BDM1(?), D
+                             G0(?), CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -42,9 +44,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -52,8 +54,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'Mixed<BDM1(?), DG0(?)>, CG1(?)'
-  Unique sub elements:       'Mixed<BDM1(?), DG0(?)>, CG1(?), BDM1(?), DG0(?)'
+  Unique elements:           'Mixed<BDM1(?), DG0(?)>, CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'Mixed<BDM1(?), DG0(?)>, CG1(?), Vector<2 x CG1(?)>, BD
+                             M1(?), DG0(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -61,15 +64,21 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0625551 seconds.
+Compiler stage 1 finished in 0.134415 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -78,11 +87,16 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 5 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -113,7 +127,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  196 entries computed in 0.000743 seconds
+  196 entries computed in 0.00107 seconds
   Shape of reference tensor: (7, 7, 2, 2)
   Primary multi index:   rank = 2 dims = [7, 7] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -122,7 +136,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  196 entries computed in 0.000702 seconds
+  196 entries computed in 0.00101 seconds
   Shape of reference tensor: (7, 7, 2, 2)
   Primary multi index:   rank = 2 dims = [7, 7] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -131,7 +145,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  196 entries computed in 0.000802 seconds
+  196 entries computed in 0.00132 seconds
   Shape of reference tensor: (7, 7, 2, 2)
   Primary multi index:   rank = 2 dims = [7, 7] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -140,7 +154,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  196 entries computed in 0.000824 seconds
+  196 entries computed in 0.00111 seconds
   Shape of reference tensor: (7, 7, 2, 2)
   Primary multi index:   rank = 2 dims = [7, 7] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -149,7 +163,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  196 entries computed in 0.000803 seconds
+  196 entries computed in 0.0011 seconds
   Shape of reference tensor: (7, 7, 2, 2)
   Primary multi index:   rank = 2 dims = [7, 7] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -158,7 +172,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  196 entries computed in 0.000808 seconds
+  196 entries computed in 0.00112 seconds
   Shape of reference tensor: (7, 7, 2, 2)
   Primary multi index:   rank = 2 dims = [7, 7] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -175,7 +189,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  21 entries computed in 0.000858 seconds
+  21 entries computed in 0.00118 seconds
   Shape of reference tensor: (7, 3)
   Primary multi index:   rank = 1 dims = [7] indices = [[0], [1], [2], [3], [4], [5], [6]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -185,303 +199,130 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0180321 seconds.
+Compiler stage 2 finished in 0.0308011 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000144958 seconds.
+Compiler stage 3 finished in 0.00022316 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
+  Generating code for 5 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: Y
   Removing unused variable: X
   Removing unused variable: C1
   Removing unused variable: C0
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.180229 seconds.
+Compiler stage 4 finished in 0.366145 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000550032 seconds.
+Compiler stage 4.1 finished in 0.0013051 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./MixedPoisson.h.
-Compiler stage 5 finished in 0.000905037 seconds.
+Compiler stage 5 finished in 0.00138712 seconds.
 
-FFC finished in 0.262739 seconds.
+FFC finished in 0.534963 seconds.
+Output written to ./MixedPoisson.h.
diff --git a/demo/documented/mixed-poisson/cpp/documentation.rst b/demo/documented/mixed-poisson/cpp/documentation.rst
index 3247c44..ad5d6f7 100644
--- a/demo/documented/mixed-poisson/cpp/documentation.rst
+++ b/demo/documented/mixed-poisson/cpp/documentation.rst
@@ -154,7 +154,7 @@ formulation. We also define the bilinear form ``a`` and linear form
 .. code-block:: c++
 
     // Construct function space
-    MixedPoisson::FunctionSpace W(mesh);
+    auto W = std::make_shared<MixedPoisson::FunctionSpace>(mesh);
     MixedPoisson::BilinearForm a(W, W);
     MixedPoisson::LinearForm L(W);
 
@@ -163,7 +163,7 @@ Then we create the source (:math:`f`) and assign it to the linear form.
 .. code-block:: c++
 
     // Create source and assign to L
-    Source f;
+    auto f = std::make_shared<Source>();
     L.f = f;
 
 It only remains to prescribe the boundary condition for the
@@ -173,8 +173,8 @@ space the boundary condition is supposed to be applied to, the data
 for the boundary condition, and the relevant part of the boundary.
 
 We want to apply the boundary condition to the first subspace of the
-mixed space. This space can be accessed by the :cpp:class:`Subspace`
-class.
+mixed space. This space can be accessed through the `sub` member
+function of the :cpp:class:`FunctionSpace` class.
 
 Next, we need to construct the data for the boundary condition. An
 essential boundary condition is handled by replacing degrees of
@@ -189,10 +189,9 @@ defined above does.
 .. code-block:: c++
 
     // Define boundary condition
-    SubSpace W0(W, 0);
-    BoundarySource G(mesh);
-    EssentialBoundary boundary;
-    DirichletBC bc(W0, G, boundary);
+    auto G = std::make_shared<BoundarySource>(*mesh);
+    auto boundary = std::make_shared<EssentialBoundary>();
+    DirichletBC bc(W->sub(0), G, boundary);
 
 To compute the solution we use the bilinear and linear forms, and the
 boundary condition, but we also need to create a :cpp:class:`Function`
diff --git a/demo/documented/mixed-poisson/cpp/main.cpp b/demo/documented/mixed-poisson/cpp/main.cpp
index e1e8c62..fa40c23 100644
--- a/demo/documented/mixed-poisson/cpp/main.cpp
+++ b/demo/documented/mixed-poisson/cpp/main.cpp
@@ -74,22 +74,21 @@ class EssentialBoundary : public SubDomain
 int main()
 {
   // Create mesh
-  UnitSquareMesh mesh(32, 32);
+  auto mesh = std::make_shared<UnitSquareMesh>(32, 32);
 
   // Construct function space
-  MixedPoisson::FunctionSpace W(mesh);
+  auto W = std::make_shared<MixedPoisson::FunctionSpace>(mesh);
   MixedPoisson::BilinearForm a(W, W);
   MixedPoisson::LinearForm L(W);
 
   // Create source and assign to L
-  Source f;
+  auto f = std::make_shared<Source>();
   L.f = f;
 
   // Define boundary condition
-  SubSpace W0(W, 0);
-  BoundarySource G(mesh);
-  EssentialBoundary boundary;
-  DirichletBC bc(W0, G, boundary);
+  auto G = std::make_shared<BoundarySource>(*mesh);
+  auto boundary = std::make_shared<EssentialBoundary>();
+  DirichletBC bc(W->sub(0), G, boundary);
 
   // Compute solution
   Function w(W);
diff --git a/demo/documented/mixed-poisson/python/demo_mixed-poisson.py b/demo/documented/mixed-poisson/python/demo_mixed-poisson.py
index e607675..cc1f73a 100644
--- a/demo/documented/mixed-poisson/python/demo_mixed-poisson.py
+++ b/demo/documented/mixed-poisson/python/demo_mixed-poisson.py
@@ -46,17 +46,17 @@ from dolfin import *
 # Create mesh
 mesh = UnitSquareMesh(32, 32)
 
-# Define function spaces and mixed (product) space
-BDM = FunctionSpace(mesh, "BDM", 1)
-DG = FunctionSpace(mesh, "DG", 0)
-W = BDM * DG
+# Define finite elements spaces and build mixed space
+BDM = FiniteElement("BDM", mesh.ufl_cell(), 1)
+DG  = FiniteElement("DG", mesh.ufl_cell(), 0)
+W = FunctionSpace(mesh, BDM * DG)
 
 # Define trial and test functions
 (sigma, u) = TrialFunctions(W)
 (tau, v) = TestFunctions(W)
 
 # Define source function
-f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
+f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
 
 # Define variational form
 a = (dot(sigma, tau) + div(tau)*u + div(sigma)*v)*dx
@@ -64,7 +64,7 @@ L = - f*v*dx
 
 # Define function G such that G \cdot n = g
 class BoundarySource(Expression):
-    def __init__(self, mesh):
+    def __init__(self, mesh, **kwargs):
         self.mesh = mesh
     def eval_cell(self, values, x, ufc_cell):
         cell = Cell(self.mesh, ufc_cell.index)
@@ -75,7 +75,7 @@ class BoundarySource(Expression):
     def value_shape(self):
         return (2,)
 
-G = BoundarySource(mesh)
+G = BoundarySource(mesh, degree=2)
 
 # Define essential boundary
 def boundary(x):
diff --git a/demo/documented/mixed-poisson/python/documentation.rst b/demo/documented/mixed-poisson/python/documentation.rst
index 9bbb676..af30cc4 100644
--- a/demo/documented/mixed-poisson/python/documentation.rst
+++ b/demo/documented/mixed-poisson/python/documentation.rst
@@ -37,24 +37,18 @@ the unit square. In this example, we will let the mesh consist of 32 x
    pair: FunctionSpace; Brezzi-Douglas-Marini
    pair: FunctionSpace; Discontinous Lagrange
 
-Next, we need to define the function spaces. We define the two
-function spaces :math:`\Sigma_h` and :math:`V_h` separately, before
-combining these into a mixed function space:
+Next, we need to build the function space.
 
 .. code-block:: python
 
-    # Define function spaces and mixed (product) space
-    BDM = FunctionSpace(mesh, "BDM", 1)
-    DG = FunctionSpace(mesh, "DG", 0)
-    W = BDM * DG
+    # Define finite elements spaces and build mixed space
+    BDM = FiniteElement("BDM", mesh.ufl_cell(), 1)
+    DG  = FiniteElement("DG", mesh.ufl_cell(), 0)
+    W = FunctionSpace(mesh, BDM * DG)
 
 The second argument to :py:class:`FunctionSpace
-<dolfin.functions.functionspace.FunctionSpace>` specifies the type of
-finite element family, while the third argument specifies the
-polynomial degree. The UFL user manual contains a list of all
-available finite element families and more details.  The * operator
-creates a mixed (product) space ``W`` from the two separate spaces
-``BDM`` and ``DG``. Hence,
+<dolfin.functions.functionspace.FunctionSpace>` specifies underlying
+finite element, here mixed element obtained by ``*`` operator.
 
 .. math::
 
@@ -76,7 +70,7 @@ demo <demo_pde_poisson_python_documentation>`:
 .. code-block:: python
 
     # Define source function
-    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
+    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
 
 We are now ready to define the variational forms a and L. Since,
 :math:`u_0 = 0` in this example, the boundary term on the right-hand
@@ -96,10 +90,10 @@ applied to, the data for the boundary condition, and the relevant part
 of the boundary.
 
 We want to apply the boundary condition to the first subspace of the
-mixed space. Subspaces of a :py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>` can be accessed
+mixed space. Subspaces of a mixed :py:class:`FunctionSpace
+<dolfin.functions.functionspace.FunctionSpace>` can be accessed
 by the method :py:func:`sub
-<dolfin.functions.functionspace.FunctionSpaceBase.sub>`. In our case,
+<dolfin.functions.functionspace.FunctionSpace.sub>`. In our case,
 this reads ``W.sub(0)``. (Do *not* use the separate space ``BDM`` as
 this would mess up the numbering.)
 
@@ -124,7 +118,7 @@ to overload the ``value_shape`` method.
 
     # Define function G such that G \cdot n = g
     class BoundarySource(Expression):
-           def __init__(self, mesh):
+           def __init__(self, mesh, **kwargs):
                self.mesh = mesh
            def eval_cell(self, values, x, ufc_cell):
                cell = Cell(self.mesh, ufc_cell.index)
@@ -135,7 +129,7 @@ to overload the ``value_shape`` method.
            def value_shape(self):
                return (2,)
 
-     G = BoundarySource(mesh)
+     G = BoundarySource(mesh, degree=2)
 
 Specifying the relevant part of the boundary can be done as for the
 Poisson demo (but now the top and bottom of the unit square is the
diff --git a/demo/documented/navier-stokes/cpp/CMakeLists.txt b/demo/documented/navier-stokes/cpp/CMakeLists.txt
index 5c36632..5e11299 100644
--- a/demo/documented/navier-stokes/cpp/CMakeLists.txt
+++ b/demo/documented/navier-stokes/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/navier-stokes/cpp/PressureUpdate.h b/demo/documented/navier-stokes/cpp/PressureUpdate.h
index 8aa09e9..f9e7ac3 100644
--- a/demo/documented/navier-stokes/cpp/PressureUpdate.h
+++ b/demo/documented/navier-stokes/cpp/PressureUpdate.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __PRESSUREUPDATE_H
 #define __PRESSUREUPDATE_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class pressureupdate_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   pressureupdate_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~pressureupdate_finite_element_0()
+  ~pressureupdate_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -339,20 +352,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -361,26 +372,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,7 +409,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -412,7 +421,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,8 +430,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -520,7 +529,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -671,7 +680,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -822,7 +831,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -973,7 +982,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1124,7 +1133,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +1284,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1387,28 +1396,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1444,7 +1451,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1452,22 +1459,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1478,48 +1483,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1529,50 +1534,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1580,98 +1583,110 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new pressureupdate_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class pressureupdate_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   pressureupdate_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~pressureupdate_finite_element_1()
+  ~pressureupdate_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1685,16 +1700,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1703,8 +1732,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2151,20 +2180,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2173,7 +2200,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -2181,21 +2208,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2215,7 +2240,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2227,7 +2252,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2236,8 +2261,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2335,7 +2360,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2486,7 +2511,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2637,7 +2662,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2788,7 +2813,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2939,7 +2964,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3090,7 +3115,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3241,7 +3266,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3392,7 +3417,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3543,7 +3568,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3694,7 +3719,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3845,7 +3870,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3996,7 +4021,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4108,28 +4133,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4165,7 +4188,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -4173,22 +4196,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -4199,96 +4220,96 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -4298,74 +4319,72 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4377,30 +4396,41 @@ public:
     vertex_values[5] = dof_values[8];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4419,379 +4449,102 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new pressureupdate_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class pressureupdate_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   pressureupdate_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~pressureupdate_finite_element_2()
+  ~pressureupdate_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t value_size() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new pressureupdate_finite_element_2();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class pressureupdate_finite_element_3: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  pressureupdate_finite_element_3() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~pressureupdate_finite_element_3()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4800,8 +4553,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -4899,20 +4652,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -4921,26 +4672,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -4960,7 +4709,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4972,7 +4721,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4981,8 +4730,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -5434,28 +5183,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5491,7 +5238,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -5499,22 +5246,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -5525,24 +5270,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -5552,38 +5297,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -5591,69 +5334,1812 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new pressureupdate_finite_element_3();
+    return new pressureupdate_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class pressureupdate_dofmap_0: public ufc::dofmap
+class pressureupdate_finite_element_3: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  pressureupdate_dofmap_0() : ufc::dofmap()
+  pressureupdate_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~pressureupdate_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new pressureupdate_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new pressureupdate_finite_element_2();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new pressureupdate_finite_element_3();
+  }
+
+};
+
+
+class pressureupdate_finite_element_4: public ufc::finite_element
+{
+public:
+
+  pressureupdate_finite_element_4() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~pressureupdate_finite_element_4() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Real', triangle, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Real";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new pressureupdate_finite_element_4();
+  }
+
+};
+
+
+class pressureupdate_dofmap_0: public ufc::dofmap
+{
+public:
+
+  pressureupdate_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~pressureupdate_dofmap_0()
+  ~pressureupdate_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5677,39 +7163,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5733,25 +7208,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5780,9 +7253,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -5856,71 +7328,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new pressureupdate_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class pressureupdate_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   pressureupdate_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~pressureupdate_dofmap_1()
+  ~pressureupdate_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5944,39 +7390,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6000,33 +7435,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6064,9 +7497,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6117,26 +7549,235 @@ public:
       {
       case 0:
         {
-          dofs[0] = 3;
-        dofs[1] = 9;
+          dofs[0] = 3;
+        dofs[1] = 9;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+        dofs[1] = 10;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+        dofs[1] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new pressureupdate_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new pressureupdate_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new pressureupdate_dofmap_1();
+  }
+
+};
+
+
+class pressureupdate_dofmap_2: public ufc::dofmap
+{
+public:
+
+  pressureupdate_dofmap_2() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~pressureupdate_dofmap_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
           break;
         }
       case 1:
         {
-          dofs[0] = 4;
-        dofs[1] = 10;
+          dofs[0] = 1;
           break;
         }
       case 2:
         {
-          dofs[0] = 5;
-        dofs[1] = 11;
+          dofs[0] = 2;
           break;
         }
       }
       
         break;
       }
+    case 1:
+      {
+        
+        break;
+      }
     case 2:
       {
         
@@ -6146,103 +7787,51 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new pressureupdate_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new pressureupdate_dofmap_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new pressureupdate_dofmap_1();
+    return new pressureupdate_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class pressureupdate_dofmap_2: public ufc::dofmap
+class pressureupdate_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  pressureupdate_dofmap_2() : ufc::dofmap()
+  pressureupdate_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~pressureupdate_dofmap_2()
+  ~pressureupdate_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -6260,45 +7849,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 1;
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 2;
         break;
       }
     case 1:
@@ -6308,7 +7886,7 @@ public:
       }
     case 2:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -6316,42 +7894,56 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 0;
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6362,7 +7954,33 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -6372,79 +7990,72 @@ public:
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new pressureupdate_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new pressureupdate_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new pressureupdate_dofmap_2();
+    return new pressureupdate_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class pressureupdate_dofmap_3: public ufc::dofmap
+class pressureupdate_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  pressureupdate_dofmap_3() : ufc::dofmap()
+  pressureupdate_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~pressureupdate_dofmap_3()
+  ~pressureupdate_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -6462,45 +8073,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 0;
         break;
       }
     case 1:
@@ -6510,7 +8110,7 @@ public:
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -6518,47 +8118,39 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = 0;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6569,30 +8161,7 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -6602,77 +8171,61 @@ public:
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new pressureupdate_dofmap_3();
+    return new pressureupdate_dofmap_4();
   }
 
 };
 
-/// 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 pressureupdate_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   pressureupdate_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~pressureupdate_cell_integral_0_otherwise()
+  ~pressureupdate_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
@@ -6681,7 +8234,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6711,42 +8264,35 @@ public:
 
 };
 
-/// 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 pressureupdate_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   pressureupdate_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~pressureupdate_cell_integral_1_otherwise()
+  ~pressureupdate_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6772,10 +8318,10 @@ public:
     {0.166666666666667, 0.166666666666667, 0.666666666666667},
     {0.166666666666667, 0.666666666666667, 0.166666666666667}};
     
-    static const double FE2_C0_D01[3][5] = \
-    {{-1.66666666666667, -0.333333333333332, 0.666666666666655, 2.00000000000001, -0.666666666666666},
-    {0.333333333333328, 1.66666666666667, 0.666666666666651, -1.99999999999999, -0.666666666666665},
-    {0.333333333333328, -0.333333333333332, 2.66666666666665, 1.0991207943789e-14, -2.66666666666667}};
+    static const double FE3_C0_D01[3][5] = \
+    {{-1.66666666666667, -0.333333333333332, 0.666666666666656, 2.00000000000001, -0.666666666666666},
+    {0.333333333333328, 1.66666666666667, 0.666666666666652, -1.99999999999999, -0.666666666666665},
+    {0.333333333333329, -0.333333333333332, 2.66666666666665, 1.0547118733939e-14, -2.66666666666667}};
     
     // Array of non-zero columns
     static const unsigned int nzc7[5] = {0, 2, 3, 4, 5};
@@ -6783,10 +8329,10 @@ public:
     // Array of non-zero columns
     static const unsigned int nzc10[5] = {6, 8, 9, 10, 11};
     
-    static const double FE2_C0_D10[3][5] = \
+    static const double FE3_C0_D10[3][5] = \
     {{-1.66666666666667, -0.333333333333336, 0.666666666666665, -0.666666666666665, 2},
     {0.333333333333333, -0.333333333333334, 2.66666666666666, -2.66666666666666, 0.0},
-    {0.333333333333336, 1.66666666666667, 0.666666666666665, -0.666666666666665, -2}};
+    {0.333333333333335, 1.66666666666667, 0.666666666666665, -0.666666666666665, -2}};
     
     // Array of non-zero columns
     static const unsigned int nzc8[5] = {0, 1, 3, 4, 5};
@@ -6823,10 +8369,10 @@ public:
       // Total number of operations to compute function values = 40
       for (unsigned int r = 0; r < 5; r++)
       {
-        F0 += FE2_C0_D10[ip][r]*w[1][nzc8[r]];
-        F1 += FE2_C0_D01[ip][r]*w[1][nzc7[r]];
-        F2 += FE2_C0_D10[ip][r]*w[1][nzc11[r]];
-        F3 += FE2_C0_D01[ip][r]*w[1][nzc10[r]];
+        F0 += FE3_C0_D10[ip][r]*w[1][nzc8[r]];
+        F1 += FE3_C0_D01[ip][r]*w[1][nzc7[r]];
+        F2 += FE3_C0_D10[ip][r]*w[1][nzc11[r]];
+        F3 += FE3_C0_D01[ip][r]*w[1][nzc10[r]];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 8
@@ -6846,77 +8392,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class pressureupdate_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   pressureupdate_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~pressureupdate_form_0()
+  ~pressureupdate_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "7f3815c8e31ab18b282532dab8742e6961eab53ad4e81fa7cb09d956cec41e4af64946224d6780069be4537652b627b48dcbe12cb4f41895baf526eb4e5dcc56";
+    return "43feb4df5c0f918b8e0c704dcc3347e7ba836f6789fff2a5eab375cebd1a89b9c11ac8a2672ff5b2e765a36ff221d887ada9a5989db46716fbaeaeda07acdb99";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new pressureupdate_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new pressureupdate_dofmap_3();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new pressureupdate_finite_element_3();
+        return new pressureupdate_finite_element_2();
         break;
       }
     case 1:
       {
-        return new pressureupdate_finite_element_3();
+        return new pressureupdate_finite_element_2();
         break;
       }
     }
@@ -6924,19 +8462,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new pressureupdate_dofmap_3();
+        return new pressureupdate_dofmap_2();
         break;
       }
     case 1:
       {
-        return new pressureupdate_dofmap_3();
+        return new pressureupdate_dofmap_2();
         break;
       }
     }
@@ -6944,203 +8481,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new pressureupdate_cell_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new pressureupdate_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class pressureupdate_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   pressureupdate_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~pressureupdate_form_1()
+  ~pressureupdate_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "47f109f681b03fafc74d12312568dc4773270958be871d7efa3d548f0d89bb431f1406771a5b5e1df181cc87ca11effeb66d601dcd12abdee1ceed05debc9f35";
+    return "da0f062015ff2b10a79c66a106077a36b09a815b0167eb1a427db918b7dc60a257d0020fa98cbb251d1c8f9d53fdb73267550bfabf3de4c385ed8dab8799a087";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new pressureupdate_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new pressureupdate_dofmap_3();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new pressureupdate_finite_element_3();
+        return new pressureupdate_finite_element_2();
         break;
       }
     case 1:
       {
-        return new pressureupdate_finite_element_2();
+        return new pressureupdate_finite_element_4();
         break;
       }
     case 2:
@@ -7153,19 +8718,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new pressureupdate_dofmap_3();
+        return new pressureupdate_dofmap_2();
         break;
       }
     case 1:
       {
-        return new pressureupdate_dofmap_2();
+        return new pressureupdate_dofmap_4();
         break;
       }
     case 2:
@@ -7178,126 +8742,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new pressureupdate_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -7311,14 +8911,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace PressureUpdate
 {
@@ -7327,43 +8933,20 @@ class CoefficientSpace_k: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7374,43 +8957,20 @@ class CoefficientSpace_u1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7421,43 +8981,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7468,63 +9005,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new pressureupdate_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -7532,7 +9076,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new pressureupdate_form_0());
+    _ufc_form = std::make_shared<const pressureupdate_form_0>();
   }
 
   // Destructor
@@ -7562,57 +9106,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new pressureupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new pressureupdate_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<pressureupdate_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<pressureupdate_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_k Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_u1 Form_L_FunctionSpace_2;
@@ -7622,73 +9221,118 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), k(*this, 0), u1(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new pressureupdate_form_1());
+    _ufc_form = std::make_shared<const pressureupdate_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& k, const dolfin::GenericFunction& u1):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u1):
     dolfin::Form(1, 2), k(*this, 0), u1(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->k = k;
     this->u1 = u1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new pressureupdate_form_1());
+    _ufc_form = std::make_shared<const pressureupdate_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u1):
-    dolfin::Form(1, 2), k(*this, 0), u1(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->k = *k;
-    this->u1 = *u1;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "k")
+      return 0;
+    else if (name == "u1")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new pressureupdate_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), k(*this, 0), u1(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "k";
+    case 1:
+      return "u1";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new pressureupdate_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_k;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_u1;
+
+  // Coefficients
+  dolfin::CoefficientAssigner k;
+  dolfin::CoefficientAssigner u1;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& k, const dolfin::GenericFunction& u1):
-    dolfin::Form(1, 2), k(*this, 0), u1(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), k(*this, 0), u1(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->k = k;
-    this->u1 = u1;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new pressureupdate_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u1):
-    dolfin::Form(1, 2), k(*this, 0), u1(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u1):
+    dolfin::MultiMeshForm(V0), k(*this, 0), u1(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->k = *k;
-    this->u1 = *u1;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->k = k;
+    this->u1 = u1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new pressureupdate_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -7724,20 +9368,26 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_k;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_u1;
 
   // Coefficients
-  dolfin::CoefficientAssigner k;
-  dolfin::CoefficientAssigner u1;
+  dolfin::MultiMeshCoefficientAssigner k;
+  dolfin::MultiMeshCoefficientAssigner u1;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/navier-stokes/cpp/TentativeVelocity.h b/demo/documented/navier-stokes/cpp/TentativeVelocity.h
index a1815a0..6447e73 100644
--- a/demo/documented/navier-stokes/cpp/TentativeVelocity.h
+++ b/demo/documented/navier-stokes/cpp/TentativeVelocity.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,388 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __TENTATIVEVELOCITY_H
 #define __TENTATIVEVELOCITY_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class tentativevelocity_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   tentativevelocity_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~tentativevelocity_finite_element_0()
+  ~tentativevelocity_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new tentativevelocity_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class tentativevelocity_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  tentativevelocity_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~tentativevelocity_finite_element_1()
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
+    return 1;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t degree() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 6;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -403,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -634,20 +352,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -656,26 +372,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -695,7 +409,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -707,7 +421,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -716,8 +430,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -815,7 +529,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -966,7 +680,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1117,7 +831,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1268,7 +982,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1419,7 +1133,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1570,7 +1284,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1682,28 +1396,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1739,7 +1451,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1747,22 +1459,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1773,48 +1483,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1824,50 +1534,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1875,98 +1583,110 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new tentativevelocity_finite_element_1();
+    return new tentativevelocity_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class tentativevelocity_finite_element_2: public ufc::finite_element
+class tentativevelocity_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  tentativevelocity_finite_element_2() : ufc::finite_element()
+  tentativevelocity_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~tentativevelocity_finite_element_2()
+  ~tentativevelocity_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1980,16 +1700,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1998,8 +1732,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2446,20 +2180,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2468,7 +2200,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -2476,21 +2208,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2510,7 +2240,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2522,7 +2252,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2531,8 +2261,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2630,7 +2360,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2781,7 +2511,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2932,7 +2662,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3083,7 +2813,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3234,7 +2964,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3385,7 +3115,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3536,7 +3266,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3687,7 +3417,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3838,7 +3568,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3989,7 +3719,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4140,7 +3870,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4291,7 +4021,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4403,28 +4133,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4460,7 +4188,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -4468,22 +4196,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -4494,96 +4220,96 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -4593,74 +4319,72 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4672,41 +4396,52 @@ public:
     vertex_values[5] = dof_values[8];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new tentativevelocity_finite_element_1();
+        return new tentativevelocity_finite_element_0();
         break;
       }
     case 1:
       {
-        return new tentativevelocity_finite_element_1();
+        return new tentativevelocity_finite_element_0();
         break;
       }
     }
@@ -4714,103 +4449,3239 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new tentativevelocity_finite_element_2();
+    return new tentativevelocity_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class tentativevelocity_dofmap_0: public ufc::dofmap
+class tentativevelocity_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  tentativevelocity_dofmap_0() : ufc::dofmap()
+  tentativevelocity_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~tentativevelocity_dofmap_0()
+  ~tentativevelocity_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new tentativevelocity_finite_element_2();
+  }
+
+};
+
+
+class tentativevelocity_finite_element_3: public ufc::finite_element
+{
+public:
+
+  tentativevelocity_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~tentativevelocity_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new tentativevelocity_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new tentativevelocity_finite_element_2();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new tentativevelocity_finite_element_3();
+  }
+
+};
+
+
+class tentativevelocity_finite_element_4: public ufc::finite_element
+{
+public:
+
+  tentativevelocity_finite_element_4() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~tentativevelocity_finite_element_4() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Real', triangle, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Real";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new tentativevelocity_finite_element_4();
+  }
+
+};
+
+
+class tentativevelocity_dofmap_0: public ufc::dofmap
+{
+public:
+
+  tentativevelocity_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~tentativevelocity_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return true;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0] + num_global_entities[1];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 1;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 4;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 5;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new tentativevelocity_dofmap_0();
+  }
+
+};
+
+
+class tentativevelocity_dofmap_1: public ufc::dofmap
+{
+public:
+
+  tentativevelocity_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~tentativevelocity_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return true;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0] + 2*num_global_entities[1];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 2;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
+      dofs[5] = 11;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 6;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 7;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 8;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 9;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+        dofs[1] = 10;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+        dofs[1] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
     
-    return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new tentativevelocity_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new tentativevelocity_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new tentativevelocity_dofmap_1();
+  }
+
+};
+
+
+class tentativevelocity_dofmap_2: public ufc::dofmap
+{
+public:
+
+  tentativevelocity_dofmap_2() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~tentativevelocity_dofmap_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 1;
+    return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
@@ -4820,7 +7691,7 @@ public:
       }
     case 2:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -4828,42 +7699,44 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 0;
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4874,7 +7747,30 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -4884,73 +7780,52 @@ public:
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new tentativevelocity_dofmap_0();
+    return new tentativevelocity_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class tentativevelocity_dofmap_1: public ufc::dofmap
+class tentativevelocity_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  tentativevelocity_dofmap_1() : ufc::dofmap()
+  tentativevelocity_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~tentativevelocity_dofmap_1()
+  ~tentativevelocity_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4961,7 +7836,7 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -4974,50 +7849,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0] + num_global_entities[1];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -5030,25 +7894,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5056,30 +7918,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
-      dofs[2] = 3;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 4;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 5;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -5100,16 +7964,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -5118,117 +7985,82 @@ public:
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
+        
+        break;
       }
-      
-      switch (i)
+    case 2:
       {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
+        
+        break;
       }
-      
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new tentativevelocity_dofmap_2();
         break;
       }
-    case 2:
+    case 1:
       {
-        
+        return new tentativevelocity_dofmap_2();
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new tentativevelocity_dofmap_1();
+    return new tentativevelocity_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class tentativevelocity_dofmap_2: public ufc::dofmap
+class tentativevelocity_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  tentativevelocity_dofmap_2() : ufc::dofmap()
+  tentativevelocity_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~tentativevelocity_dofmap_2()
+  ~tentativevelocity_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -5241,55 +8073,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2*num_global_entities[0] + 2*num_global_entities[1];
+    return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 0;
         break;
       }
     case 1:
       {
-        return 2;
+        return 0;
         break;
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -5297,73 +8118,39 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    dofs[0] = 0;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -5374,175 +8161,75 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 6;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 7;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 8;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 9;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-        dofs[1] = 10;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-        dofs[1] = 11;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new tentativevelocity_dofmap_1();
-        break;
-      }
-    case 1:
-      {
-        return new tentativevelocity_dofmap_1();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new tentativevelocity_dofmap_2();
+    return new tentativevelocity_dofmap_4();
   }
 
 };
 
-/// 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 tentativevelocity_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   tentativevelocity_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~tentativevelocity_cell_integral_0_otherwise()
+  ~tentativevelocity_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5563,7 +8250,7 @@ public:
     // Quadrature points on the UFC reference element: (0.816847572980459, 0.091576213509771), (0.091576213509771, 0.816847572980459), (0.091576213509771, 0.091576213509771), (0.10810301816807, 0.445948490915965), (0.445948490915965, 0.10810301816807), (0.445948490915965, 0.445948490915965)
     
     // Values of basis functions at quadrature points.
-    static const double FE1_C0[6][6] = \
+    static const double FE2_C0[6][6] = \
     {{-0.074803807748196, 0.517632341987673, -0.0748038077481966, 0.299215230992787, 0.0335448115231483, 0.299215230992784},
     {-0.074803807748196, -0.0748038077481966, 0.517632341987674, 0.299215230992787, 0.299215230992784, 0.0335448115231483},
     {0.517632341987671, -0.0748038077481966, -0.0748038077481966, 0.0335448115231487, 0.299215230992787, 0.299215230992787},
@@ -5577,10 +8264,10 @@ public:
     // Array of non-zero columns
     static const unsigned int nzc9[6] = {6, 7, 8, 9, 10, 11};
     
-    static const double FE1_C0_D01[6][5] = \
+    static const double FE2_C0_D01[6][5] = \
     {{0.633695145960915, -0.633695145960916, 3.26739029192182, 0.0, -3.26739029192184},
-    {0.633695145960915, 2.26739029192184, 0.366304854039066, -2.90108543788275, -0.366304854039082},
-    {-2.26739029192184, -0.633695145960916, 0.366304854039073, 2.90108543788276, -0.366304854039083},
+    {0.633695145960915, 2.26739029192184, 0.366304854039068, -2.90108543788275, -0.366304854039081},
+    {-2.26739029192184, -0.633695145960916, 0.366304854039074, 2.90108543788276, -0.366304854039083},
     {-0.783793963663865, 0.783793963663862, 0.432412072672267, 0.0, -0.432412072672279},
     {-0.783793963663864, -0.567587927327719, 1.78379396366385, 1.35138189099159, -1.78379396366386},
     {0.567587927327715, 0.783793963663862, 1.78379396366385, -1.35138189099157, -1.78379396366386}};
@@ -5591,9 +8278,9 @@ public:
     // Array of non-zero columns
     static const unsigned int nzc10[5] = {6, 8, 9, 10, 11};
     
-    static const double FE1_C0_D10[6][5] = \
-    {{0.633695145960923, 2.26739029192184, 0.366304854039083, -0.366304854039083, -2.90108543788276},
-    {0.633695145960919, -0.633695145960917, 3.26739029192183, -3.26739029192183, 0.0},
+    static const double FE2_C0_D10[6][5] = \
+    {{0.633695145960922, 2.26739029192184, 0.366304854039083, -0.366304854039083, -2.90108543788276},
+    {0.63369514596092, -0.633695145960917, 3.26739029192183, -3.26739029192183, 0.0},
     {-2.26739029192183, -0.633695145960919, 0.366304854039083, -0.366304854039083, 2.90108543788275},
     {-0.78379396366386, -0.567587927327721, 1.78379396366386, -1.78379396366386, 1.35138189099158},
     {-0.783793963663859, 0.783793963663859, 0.432412072672279, -0.432412072672279, 0.0},
@@ -5646,21 +8333,21 @@ public:
         for (unsigned int k = 0; k < 5; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc10[k]] += FE1_C0_D01[ip][j]*FE1_C0_D01[ip][k]*I[0];
+          A[nzc10[j]*12 + nzc10[k]] += FE2_C0_D01[ip][j]*FE2_C0_D01[ip][k]*I[0];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc11[k]] += FE1_C0_D01[ip][j]*FE1_C0_D10[ip][k]*I[1];
+          A[nzc10[j]*12 + nzc11[k]] += FE2_C0_D01[ip][j]*FE2_C0_D10[ip][k]*I[1];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc10[k]] += FE1_C0_D01[ip][k]*FE1_C0_D10[ip][j]*I[1];
+          A[nzc11[j]*12 + nzc10[k]] += FE2_C0_D01[ip][k]*FE2_C0_D10[ip][j]*I[1];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc11[k]] += FE1_C0_D10[ip][j]*FE1_C0_D10[ip][k]*I[2];
+          A[nzc11[j]*12 + nzc11[k]] += FE2_C0_D10[ip][j]*FE2_C0_D10[ip][k]*I[2];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc7[k]] += FE1_C0_D01[ip][j]*FE1_C0_D01[ip][k]*I[0];
+          A[nzc7[j]*12 + nzc7[k]] += FE2_C0_D01[ip][j]*FE2_C0_D01[ip][k]*I[0];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc8[k]] += FE1_C0_D01[ip][j]*FE1_C0_D10[ip][k]*I[1];
+          A[nzc7[j]*12 + nzc8[k]] += FE2_C0_D01[ip][j]*FE2_C0_D10[ip][k]*I[1];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc7[k]] += FE1_C0_D01[ip][k]*FE1_C0_D10[ip][j]*I[1];
+          A[nzc8[j]*12 + nzc7[k]] += FE2_C0_D01[ip][k]*FE2_C0_D10[ip][j]*I[1];
           // Number of operations to compute entry: 3
-          A[nzc8[j]*12 + nzc8[k]] += FE1_C0_D10[ip][j]*FE1_C0_D10[ip][k]*I[2];
+          A[nzc8[j]*12 + nzc8[k]] += FE2_C0_D10[ip][j]*FE2_C0_D10[ip][k]*I[2];
         } // end loop over 'k'
       } // end loop over 'j'
       
@@ -5670,9 +8357,9 @@ public:
         for (unsigned int k = 0; k < 6; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc6[k]] += FE1_C0[ip][j]*FE1_C0[ip][k]*I[3];
+          A[nzc6[j]*12 + nzc6[k]] += FE2_C0[ip][j]*FE2_C0[ip][k]*I[3];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc9[k]] += FE1_C0[ip][j]*FE1_C0[ip][k]*I[3];
+          A[nzc9[j]*12 + nzc9[k]] += FE2_C0[ip][j]*FE2_C0[ip][k]*I[3];
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -5680,42 +8367,35 @@ public:
 
 };
 
-/// 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 tentativevelocity_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   tentativevelocity_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~tentativevelocity_cell_integral_1_otherwise()
+  ~tentativevelocity_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5736,7 +8416,7 @@ public:
     // Quadrature points on the UFC reference element: (0.333333333333333, 0.333333333333333), (0.797426985353087, 0.101286507323456), (0.101286507323456, 0.797426985353087), (0.101286507323456, 0.101286507323456), (0.0597158717897698, 0.470142064105115), (0.470142064105115, 0.0597158717897698), (0.470142064105115, 0.470142064105115)
     
     // Values of basis functions at quadrature points.
-    static const double FE1_C0[7][6] = \
+    static const double FE2_C0[7][6] = \
     {{-0.111111111111111, -0.111111111111111, -0.111111111111111, 0.444444444444444, 0.444444444444444, 0.444444444444444},
     {-0.0807685941918872, 0.474352608585538, -0.0807685941918871, 0.323074376767549, 0.0410358262631383, 0.323074376767549},
     {-0.0807685941918872, -0.0807685941918872, 0.474352608585538, 0.323074376767549, 0.323074376767549, 0.0410358262631383},
@@ -5751,14 +8431,14 @@ public:
     // Array of non-zero columns
     static const unsigned int nzc9[6] = {6, 7, 8, 9, 10, 11};
     
-    static const double FE1_C0_D01[7][5] = \
+    static const double FE2_C0_D01[7][5] = \
     {{-0.333333333333338, 0.333333333333335, 1.33333333333332, 0.0, -1.33333333333333},
-    {0.59485397070617, -0.594853970706174, 3.18970794141233, 1.22124532708767e-14, -3.18970794141235},
-    {0.594853970706169, 2.18970794141235, 0.405146029293808, -2.78456191211851, -0.405146029293824},
-    {-2.18970794141235, -0.594853970706174, 0.405146029293814, 2.78456191211853, -0.405146029293824},
+    {0.59485397070617, -0.594853970706174, 3.18970794141233, 1.15463194561016e-14, -3.18970794141235},
+    {0.594853970706169, 2.18970794141235, 0.405146029293809, -2.78456191211851, -0.405146029293823},
+    {-2.18970794141235, -0.594853970706174, 0.405146029293815, 2.78456191211853, -0.405146029293824},
     {-0.880568256420466, 0.880568256420462, 0.238863487159066, 0.0, -0.238863487159078},
     {-0.880568256420465, -0.76113651284092, 1.88056825642045, 1.64170476926139, -1.88056825642046},
-    {0.761136512840915, 0.880568256420462, 1.88056825642045, -1.64170476926137, -1.88056825642046}};
+    {0.761136512840916, 0.880568256420462, 1.88056825642045, -1.64170476926137, -1.88056825642046}};
     
     // Array of non-zero columns
     static const unsigned int nzc7[5] = {0, 2, 3, 4, 5};
@@ -5766,13 +8446,13 @@ public:
     // Array of non-zero columns
     static const unsigned int nzc10[5] = {6, 8, 9, 10, 11};
     
-    static const double FE1_C0_D10[7][5] = \
+    static const double FE2_C0_D10[7][5] = \
     {{-0.333333333333333, 0.333333333333333, 1.33333333333333, -1.33333333333333, 0.0},
-    {0.594853970706177, 2.18970794141235, 0.405146029293824, -0.405146029293824, -2.78456191211853},
-    {0.594853970706173, -0.594853970706176, 3.18970794141234, -3.18970794141234, 0.0},
-    {-2.18970794141235, -0.594853970706177, 0.405146029293824, -0.405146029293824, 2.78456191211853},
-    {-0.880568256420461, -0.761136512840922, 1.88056825642046, -1.88056825642046, 1.64170476926138},
-    {-0.88056825642046, 0.880568256420459, 0.238863487159078, -0.238863487159078, 0.0},
+    {0.594853970706176, 2.18970794141235, 0.405146029293824, -0.405146029293824, -2.78456191211853},
+    {0.594853970706174, -0.594853970706175, 3.18970794141234, -3.18970794141234, 0.0},
+    {-2.18970794141235, -0.594853970706178, 0.405146029293824, -0.405146029293824, 2.78456191211853},
+    {-0.880568256420462, -0.761136512840923, 1.88056825642046, -1.88056825642046, 1.64170476926138},
+    {-0.880568256420459, 0.880568256420459, 0.238863487159078, -0.238863487159078, 0.0},
     {0.761136512840922, 0.880568256420461, 1.88056825642046, -1.88056825642046, -1.64170476926138}};
     
     // Array of non-zero columns
@@ -5815,19 +8495,19 @@ public:
       // Total number of operations to compute function values = 40
       for (unsigned int r = 0; r < 5; r++)
       {
-        F4 += FE1_C0_D10[ip][r]*w[1][nzc8[r]];
-        F5 += FE1_C0_D01[ip][r]*w[1][nzc7[r]];
-        F6 += FE1_C0_D10[ip][r]*w[1][nzc11[r]];
-        F7 += FE1_C0_D01[ip][r]*w[1][nzc10[r]];
+        F4 += FE2_C0_D10[ip][r]*w[1][nzc8[r]];
+        F5 += FE2_C0_D01[ip][r]*w[1][nzc7[r]];
+        F6 += FE2_C0_D10[ip][r]*w[1][nzc11[r]];
+        F7 += FE2_C0_D01[ip][r]*w[1][nzc10[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 48
       for (unsigned int r = 0; r < 6; r++)
       {
-        F0 += FE1_C0[ip][r]*w[1][nzc6[r]];
-        F1 += FE1_C0[ip][r]*w[1][nzc9[r]];
-        F2 += FE1_C0[ip][r]*w[2][nzc6[r]];
-        F3 += FE1_C0[ip][r]*w[2][nzc9[r]];
+        F0 += FE2_C0[ip][r]*w[1][nzc6[r]];
+        F1 += FE2_C0[ip][r]*w[1][nzc9[r]];
+        F2 += FE2_C0[ip][r]*w[2][nzc6[r]];
+        F3 += FE2_C0[ip][r]*w[2][nzc9[r]];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 26
@@ -5843,91 +8523,83 @@ public:
       for (unsigned int j = 0; j < 6; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc6[j]] += FE1_C0[ip][j]*I[0];
+        A[nzc6[j]] += FE2_C0[ip][j]*I[0];
         // Number of operations to compute entry: 2
-        A[nzc9[j]] += FE1_C0[ip][j]*I[1];
+        A[nzc9[j]] += FE2_C0[ip][j]*I[1];
       } // end loop over 'j'
     } // end loop over 'ip'
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class tentativevelocity_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   tentativevelocity_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~tentativevelocity_form_0()
+  ~tentativevelocity_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "d1fbb99a836d1ae102990139f0b2029eff72abb57f3e1175a90832b7bd23066a8bbe3591e601bb2d11ed904707cfbbf69df40904bbef75c8f8baf6472213dd16";
+    return "46a78fa8638931849f6ac5f2e85d4b4af87825e924e32525d4eaf478eb0b291f760b03ed337eed26ce8a6bc72b8d09156780843a39418117f7d2322c35f303a2";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new tentativevelocity_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new tentativevelocity_dofmap_3();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new tentativevelocity_finite_element_2();
+        return new tentativevelocity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new tentativevelocity_finite_element_2();
+        return new tentativevelocity_finite_element_1();
         break;
       }
     case 2:
       {
-        return new tentativevelocity_finite_element_0();
+        return new tentativevelocity_finite_element_4();
         break;
       }
     }
@@ -5935,24 +8607,23 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new tentativevelocity_dofmap_2();
+        return new tentativevelocity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new tentativevelocity_dofmap_2();
+        return new tentativevelocity_dofmap_1();
         break;
       }
     case 2:
       {
-        return new tentativevelocity_dofmap_0();
+        return new tentativevelocity_dofmap_4();
         break;
       }
     }
@@ -5960,213 +8631,241 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new tentativevelocity_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class tentativevelocity_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   tentativevelocity_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~tentativevelocity_form_1()
+  ~tentativevelocity_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "538b00343e8ea975e1e532a3a1b1d38faad801c985e582b28067a22c39cec1d4eb0b461257fc24d87ebd280056bfbebee3d513f22b695a6b60c7ba5cc2f9a1b2";
+    return "70affe55cef9e00c637c137008a7a485207fe2130634f3618efff53c77814e64afb96c4eeb34b921c076942413f14ed952ac47b7c5ccc9918e59423f3427f5fd";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 3;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new tentativevelocity_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new tentativevelocity_dofmap_3();
+   }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new tentativevelocity_finite_element_2();
+        return new tentativevelocity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new tentativevelocity_finite_element_0();
+        return new tentativevelocity_finite_element_4();
         break;
       }
     case 2:
       {
-        return new tentativevelocity_finite_element_2();
+        return new tentativevelocity_finite_element_1();
         break;
       }
     case 3:
       {
-        return new tentativevelocity_finite_element_2();
+        return new tentativevelocity_finite_element_1();
         break;
       }
     }
@@ -6174,29 +8873,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new tentativevelocity_dofmap_2();
+        return new tentativevelocity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new tentativevelocity_dofmap_0();
+        return new tentativevelocity_dofmap_4();
         break;
       }
     case 2:
       {
-        return new tentativevelocity_dofmap_2();
+        return new tentativevelocity_dofmap_1();
         break;
       }
     case 3:
       {
-        return new tentativevelocity_dofmap_2();
+        return new tentativevelocity_dofmap_1();
         break;
       }
     }
@@ -6204,126 +8902,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_cell_integrals() const final override
   {
-    return 0;
+    return true;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  bool has_exterior_facet_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_vertex_integrals() const final override
   {
-    return true;
+    return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new tentativevelocity_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -6337,14 +9071,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace TentativeVelocity
 {
@@ -6353,43 +9093,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6400,43 +9117,20 @@ class CoefficientSpace_k: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6447,43 +9141,20 @@ class CoefficientSpace_u0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6494,43 +9165,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6541,45 +9189,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -6591,75 +9256,114 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 1), k(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_0());
+    _ufc_form = std::make_shared<const tentativevelocity_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& k):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k):
     dolfin::Form(2, 1), k(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->k = k;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_0());
+    _ufc_form = std::make_shared<const tentativevelocity_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> k):
-    dolfin::Form(2, 1), k(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_a()
+  {}
 
-    this->k = *k;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "k")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 1), k(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "k";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_k;
+
+  // Coefficients
+  dolfin::CoefficientAssigner k;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& k):
-    dolfin::Form(2, 1), k(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), k(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->k = k;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k):
-    dolfin::Form(2, 1), k(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k):
+    dolfin::MultiMeshForm(V1, V0), k(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->k = *k;
+    /// Assign coefficients
+    this->k = k;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -6692,55 +9396,54 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_k;
 
   // Coefficients
-  dolfin::CoefficientAssigner k;
+  dolfin::MultiMeshCoefficientAssigner k;
 };
 
 class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<tentativevelocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<tentativevelocity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new tentativevelocity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new tentativevelocity_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -6756,77 +9459,126 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 3), k(*this, 0), u0(*this, 1), f(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_1());
+    _ufc_form = std::make_shared<const tentativevelocity_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& k, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 3), k(*this, 0), u0(*this, 1), f(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->k = k;
     this->u0 = u0;
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_1());
+    _ufc_form = std::make_shared<const tentativevelocity_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 3), k(*this, 0), u0(*this, 1), f(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->k = *k;
-    this->u0 = *u0;
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "k")
+      return 0;
+    else if (name == "u0")
+      return 1;
+    else if (name == "f")
+      return 2;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 3), k(*this, 0), u0(*this, 1), f(*this, 2)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "k";
+    case 1:
+      return "u0";
+    case 2:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_k;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_u0;
+  typedef Form_L_FunctionSpace_3 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner k;
+  dolfin::CoefficientAssigner u0;
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& k, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 3), k(*this, 0), u0(*this, 1), f(*this, 2)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), k(*this, 0), u0(*this, 1), f(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->k = k;
-    this->u0 = u0;
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 3), k(*this, 0), u0(*this, 1), f(*this, 2)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), k(*this, 0), u0(*this, 1), f(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->k = *k;
-    this->u0 = *u0;
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->k = k;
+    this->u0 = u0;
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new tentativevelocity_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -6866,22 +9618,28 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_k;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_u0;
   typedef Form_L_FunctionSpace_3 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner k;
-  dolfin::CoefficientAssigner u0;
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner k;
+  dolfin::MultiMeshCoefficientAssigner u0;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/navier-stokes/cpp/VelocityUpdate.h b/demo/documented/navier-stokes/cpp/VelocityUpdate.h
index 59bfbf1..164ae6e 100644
--- a/demo/documented/navier-stokes/cpp/VelocityUpdate.h
+++ b/demo/documented/navier-stokes/cpp/VelocityUpdate.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __VELOCITYUPDATE_H
 #define __VELOCITYUPDATE_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class velocityupdate_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   velocityupdate_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocityupdate_finite_element_0()
+  ~velocityupdate_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,25 +136,33 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -151,25 +172,33 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -179,25 +208,141 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -207,48 +352,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,19 +409,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 2)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,18 +430,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
     {
-      for (unsigned int col = 0; col < 1; col++)
+      for (unsigned int col = 0; col < 2; col++)
         combinations[row][col] = 0;
     }
     
@@ -327,7 +468,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
+    double transform[4][4];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -349,61 +490,81 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -418,9 +579,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -430,11 +591,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -444,11 +605,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -457,9 +618,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -480,61 +641,81 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -549,9 +730,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -561,11 +742,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -575,11 +756,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -588,9 +769,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -611,61 +792,81 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -680,9 +881,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -692,11 +893,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -706,11 +907,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -719,9 +920,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -738,343 +939,485 @@ public:
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 3:
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 1:
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new velocityupdate_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class velocityupdate_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  velocityupdate_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~velocityupdate_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 1;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    return 1;
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
     {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
     
     // Compute number of derivatives.
     unsigned int num_derivatives = 1;
@@ -1083,65 +1426,53 @@ public:
       num_derivatives *= 2;
     } // end loop over 'r'
     
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
     {
-      values[r] = 0.0;
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
     } // end loop over 'r'
     
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
+    if (n > 2)
     {
-    return ;
+      return ;
     }
     
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1152,8 +1483,48 @@ public:
     {
     case 0:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1163,143 +1534,196 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new velocityupdate_finite_element_1();
+    return new velocityupdate_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class velocityupdate_finite_element_2: public ufc::finite_element
+class velocityupdate_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  velocityupdate_finite_element_2() : ufc::finite_element()
+  velocityupdate_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocityupdate_finite_element_2()
+  ~velocityupdate_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_dimension(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1308,15 +1732,16 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Reset values
-    *values = 0.0;
+    values[0] = 0.0;
+    values[1] = 0.0;
     switch (i)
     {
     case 0:
@@ -1351,11 +1776,227 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 7:
       {
         
       // Array of basisvalues
@@ -1387,11 +2028,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 8:
       {
         
       // Array of basisvalues
@@ -1423,11 +2064,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 9:
       {
         
       // Array of basisvalues
@@ -1459,11 +2100,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 10:
       {
         
       // Array of basisvalues
@@ -1495,11 +2136,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 11:
       {
         
       // Array of basisvalues
@@ -1531,7 +2172,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1539,48 +2180,47 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
+    double dof_values[2] = {0.0, 0.0};
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1592,7 +2232,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -1600,7 +2240,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1612,7 +2252,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1621,8 +2261,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1671,13 +2311,164 @@ public:
     {
       for (unsigned int col = 0; col < num_derivatives; col++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 1:
       {
         
       // Array of basisvalues
@@ -1704,7 +2495,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -1720,7 +2511,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1828,7 +2619,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 2:
       {
         
       // Array of basisvalues
@@ -1855,7 +2646,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -1871,7 +2662,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1979,7 +2770,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 3:
       {
         
       // Array of basisvalues
@@ -2006,7 +2797,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -2022,7 +2813,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2130,7 +2921,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 4:
       {
         
       // Array of basisvalues
@@ -2157,7 +2948,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -2173,7 +2964,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2281,7 +3072,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 5:
       {
         
       // Array of basisvalues
@@ -2308,7 +3099,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -2324,7 +3115,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2432,7 +3223,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 6:
       {
         
       // Array of basisvalues
@@ -2459,7 +3250,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -2475,7 +3266,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2578,344 +3369,163 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
+    case 7:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new velocityupdate_finite_element_2();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class velocityupdate_finite_element_3: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  velocityupdate_finite_element_3() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~velocityupdate_finite_element_3()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 12;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        return 2;
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 8:
       {
         
       // Array of basisvalues
@@ -2942,16 +3552,131 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 9:
       {
         
       // Array of basisvalues
@@ -2978,16 +3703,131 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 10:
       {
         
       // Array of basisvalues
@@ -3014,16 +3854,131 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 11:
       {
         
       // Array of basisvalues
@@ -3050,300 +4005,646 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
     case 5:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 6:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
         break;
       }
     case 7:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
         break;
       }
     case 8:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
         break;
       }
     case 9:
       {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[1];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[6];
+    vertex_values[3] = dof_values[7];
+    vertex_values[5] = dof_values[8];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new velocityupdate_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new velocityupdate_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new velocityupdate_finite_element_1();
+  }
+
+};
+
+
+class velocityupdate_finite_element_2: public ufc::finite_element
+{
+public:
+
+  velocityupdate_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~velocityupdate_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -3351,51 +4652,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
+    double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
-      {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -3407,7 +4701,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -3415,19 +4709,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3436,18 +4730,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -3474,7 +4768,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -3496,81 +4790,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3585,9 +4859,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3597,11 +4871,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3611,11 +4885,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3624,9 +4898,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3647,81 +4921,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3736,9 +4990,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3748,11 +5002,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3762,11 +5016,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3775,9 +5029,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3798,81 +5052,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3887,9 +5121,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3899,11 +5133,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3913,11 +5147,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3926,9 +5160,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3938,394 +5172,691 @@ public:
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new velocityupdate_finite_element_2();
+  }
+
+};
+
+
+class velocityupdate_finite_element_3: public ufc::finite_element
+{
+public:
+
+  velocityupdate_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~velocityupdate_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
         break;
       }
-    case 3:
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        break;
+      }
+    case 1:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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--)
         {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
+          if (combinations[row][col] + 1 > 1)
+            combinations[row][col] = 0;
+          else
           {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
+            combinations[row][col] += 1;
+            break;
           }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
-    case 5:
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4340,9 +5871,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4352,11 +5883,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4366,11 +5897,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4379,9 +5910,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4398,85 +5929,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4491,9 +6002,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4503,11 +6014,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4517,11 +6028,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4530,9 +6041,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4544,90 +6055,70 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4642,9 +6133,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4654,11 +6145,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4668,11 +6159,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4681,9 +6172,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4695,90 +6186,70 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4793,9 +6264,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4805,11 +6276,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4819,11 +6290,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4832,9 +6303,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4851,85 +6322,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4944,9 +6395,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4956,11 +6407,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4970,11 +6421,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4983,9 +6434,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5002,85 +6453,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5095,9 +6526,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5107,11 +6538,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5121,11 +6552,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5134,9 +6565,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5153,185 +6584,404 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 11:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
         break;
       }
     }
     
+    return 0.0;
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new velocityupdate_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new velocityupdate_finite_element_2();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new velocityupdate_finite_element_3();
+  }
+
+};
+
+
+class velocityupdate_finite_element_4: public ufc::finite_element
+{
+public:
+
+  velocityupdate_finite_element_4() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~velocityupdate_finite_element_4() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Real', triangle, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Real";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
     
     // Compute number of derivatives.
     unsigned int num_derivatives = 1;
@@ -5340,58 +6990,64 @@ public:
       num_derivatives *= 2;
     } // end loop over 'r'
     
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
+      values[r] = 0.0;
     } // end loop over 'r'
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
     {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
     {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
+    return ;
+    }
     
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[2];
+    double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
@@ -5399,261 +7055,318 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new velocityupdate_finite_element_4();
+  }
+
+};
+
+
+class velocityupdate_dofmap_0: public ufc::dofmap
+{
+public:
+
+  velocityupdate_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~velocityupdate_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return true;
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
-    case 3:
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0] + num_global_entities[1];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 1;
         break;
       }
-    case 4:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 1;
         break;
       }
-    case 5:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 6:
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
-    case 7:
+    case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 4;
         break;
       }
-    case 8:
+    case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 5;
         break;
       }
-    case 9:
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
-    case 10:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
+    case 1:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+          break;
+        }
+      }
+      
         break;
       }
-    case 11:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[3] = dof_values[7];
-    vertex_values[5] = dof_values[8];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new velocityupdate_finite_element_2();
-        break;
-      }
-    case 1:
-      {
-        return new velocityupdate_finite_element_2();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new velocityupdate_finite_element_3();
+    return new velocityupdate_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class velocityupdate_dofmap_0: public ufc::dofmap
+class velocityupdate_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  velocityupdate_dofmap_0() : ufc::dofmap()
+  velocityupdate_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocityupdate_dofmap_0()
+  ~velocityupdate_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5664,7 +7377,7 @@ public:
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -5677,50 +7390,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 0;
+        return 2;
         break;
       }
     case 2:
@@ -5733,19 +7435,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5753,27 +7467,38 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
+      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -5794,16 +7519,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 8;
           break;
         }
       }
@@ -5812,7 +7540,33 @@ public:
       }
     case 1:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 9;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+        dofs[1] = 10;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+        dofs[1] = 11;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -5824,71 +7578,65 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new velocityupdate_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new velocityupdate_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new velocityupdate_dofmap_0();
+    return new velocityupdate_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class velocityupdate_dofmap_1: public ufc::dofmap
+class velocityupdate_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  velocityupdate_dofmap_1() : ufc::dofmap()
+  velocityupdate_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocityupdate_dofmap_1()
+  ~velocityupdate_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -5906,45 +7654,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 1;
+    return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
@@ -5954,7 +7691,7 @@ public:
       }
     case 2:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -5962,42 +7699,44 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 0;
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6008,7 +7747,30 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -6018,73 +7780,52 @@ public:
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new velocityupdate_dofmap_1();
+    return new velocityupdate_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class velocityupdate_dofmap_2: public ufc::dofmap
+class velocityupdate_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  velocityupdate_dofmap_2() : ufc::dofmap()
+  velocityupdate_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocityupdate_dofmap_2()
+  ~velocityupdate_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6095,7 +7836,7 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -6108,50 +7849,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0] + num_global_entities[1];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -6164,25 +7894,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6190,30 +7918,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
-      dofs[2] = 3;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 4;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 5;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6234,16 +7964,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -6252,30 +7985,7 @@ public:
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
@@ -6287,82 +7997,70 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new velocityupdate_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new velocityupdate_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new velocityupdate_dofmap_2();
+    return new velocityupdate_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class velocityupdate_dofmap_3: public ufc::dofmap
+class velocityupdate_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  velocityupdate_dofmap_3() : ufc::dofmap()
+  velocityupdate_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocityupdate_dofmap_3()
+  ~velocityupdate_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -6375,55 +8073,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2*num_global_entities[0] + 2*num_global_entities[1];
+    return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 0;
         break;
       }
     case 1:
       {
-        return 2;
+        return 0;
         break;
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -6431,73 +8118,39 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    dofs[0] = 0;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6508,171 +8161,71 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 6;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 7;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 8;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 9;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-        dofs[1] = 10;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-        dofs[1] = 11;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new velocityupdate_dofmap_2();
-        break;
-      }
-    case 1:
-      {
-        return new velocityupdate_dofmap_2();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new velocityupdate_dofmap_3();
+    return new velocityupdate_dofmap_4();
   }
 
 };
 
-/// 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 velocityupdate_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   velocityupdate_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~velocityupdate_cell_integral_0_otherwise()
+  ~velocityupdate_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    0
@@ -6681,7 +8234,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6843,38 +8396,31 @@ public:
 
 };
 
-/// 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 velocityupdate_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   velocityupdate_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~velocityupdate_cell_integral_1_otherwise()
+  ~velocityupdate_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    28
@@ -6883,7 +8429,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6932,77 +8478,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class velocityupdate_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   velocityupdate_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocityupdate_form_0()
+  ~velocityupdate_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "4061c1e2ee4dc2319fdd72cf5c4e7b35102d1c4db9248e605df9b280b7036247960e9d32477a79d990888ce1f6fc20fb236122d4927f886428332c6b2a26c54c";
+    return "c126dca5483da946196f5eab752e60f86ac0ce8de190d4077c4d9b9364051cbe6e824622a2ffc23a665f5c95722d13f566932bb6856f8e480958a634d7186fb8";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new velocityupdate_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new velocityupdate_dofmap_3();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new velocityupdate_finite_element_3();
+        return new velocityupdate_finite_element_1();
         break;
       }
     case 1:
       {
-        return new velocityupdate_finite_element_3();
+        return new velocityupdate_finite_element_1();
         break;
       }
     }
@@ -7010,19 +8548,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new velocityupdate_dofmap_3();
+        return new velocityupdate_dofmap_1();
         break;
       }
     case 1:
       {
-        return new velocityupdate_dofmap_3();
+        return new velocityupdate_dofmap_1();
         break;
       }
     }
@@ -7030,213 +8567,241 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new velocityupdate_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class velocityupdate_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   velocityupdate_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocityupdate_form_1()
+  ~velocityupdate_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "21ba17b3bfefbaae4463f5dc7b89a9ecc117aff0f6e852884e7a2fa9bacd156a9bddf59543449361b39b11250e1b3b01621adfd1be2c8e3262e839bd4f2d6b22";
+    return "e87c51c52d05cba9889e4d22d3b0ac4b4794f9cd867d6b0e6098b012878e6bf6b8806eb6306f26245074b69c01f691c0f0103df834ea386d59e7d1428d0ab570";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 3;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
+  {
+    static const std::vector<std::size_t> position({0, 1, 2});
+    return position[i];
+  }
+
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new velocityupdate_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new velocityupdate_dofmap_3();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
   {
-    static const std::vector<std::size_t> position({0, 1, 2});
-    return position[i];
+    return nullptr;
   }
 
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new velocityupdate_finite_element_3();
+        return new velocityupdate_finite_element_1();
         break;
       }
     case 1:
       {
-        return new velocityupdate_finite_element_1();
+        return new velocityupdate_finite_element_4();
         break;
       }
     case 2:
       {
-        return new velocityupdate_finite_element_3();
+        return new velocityupdate_finite_element_1();
         break;
       }
     case 3:
       {
-        return new velocityupdate_finite_element_0();
+        return new velocityupdate_finite_element_2();
         break;
       }
     }
@@ -7244,29 +8809,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new velocityupdate_dofmap_3();
+        return new velocityupdate_dofmap_1();
         break;
       }
     case 1:
       {
-        return new velocityupdate_dofmap_1();
+        return new velocityupdate_dofmap_4();
         break;
       }
     case 2:
       {
-        return new velocityupdate_dofmap_3();
+        return new velocityupdate_dofmap_1();
         break;
       }
     case 3:
       {
-        return new velocityupdate_dofmap_0();
+        return new velocityupdate_dofmap_2();
         break;
       }
     }
@@ -7274,126 +8838,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new velocityupdate_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -7407,14 +9007,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace VelocityUpdate
 {
@@ -7423,43 +9029,20 @@ class CoefficientSpace_k: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_k(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_k(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7470,43 +9053,20 @@ class CoefficientSpace_p1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_p1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_p1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7517,43 +9077,20 @@ class CoefficientSpace_u1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7564,43 +9101,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7611,63 +9125,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new velocityupdate_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -7675,7 +9196,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new velocityupdate_form_0());
+    _ufc_form = std::make_shared<const velocityupdate_form_0>();
   }
 
   // Destructor
@@ -7705,57 +9226,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocityupdate_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocityupdate_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocityupdate_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocityupdate_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_k Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_u1 Form_L_FunctionSpace_2;
@@ -7767,77 +9343,126 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 3), k(*this, 0), u1(*this, 1), p1(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new velocityupdate_form_1());
+    _ufc_form = std::make_shared<const velocityupdate_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& k, const dolfin::GenericFunction& u1, const dolfin::GenericFunction& p1):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u1, std::shared_ptr<const dolfin::GenericFunction> p1):
     dolfin::Form(1, 3), k(*this, 0), u1(*this, 1), p1(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->k = k;
     this->u1 = u1;
     this->p1 = p1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new velocityupdate_form_1());
+    _ufc_form = std::make_shared<const velocityupdate_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u1, std::shared_ptr<const dolfin::GenericFunction> p1):
-    dolfin::Form(1, 3), k(*this, 0), u1(*this, 1), p1(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->k = *k;
-    this->u1 = *u1;
-    this->p1 = *p1;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "k")
+      return 0;
+    else if (name == "u1")
+      return 1;
+    else if (name == "p1")
+      return 2;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new velocityupdate_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 3), k(*this, 0), u1(*this, 1), p1(*this, 2)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "k";
+    case 1:
+      return "u1";
+    case 2:
+      return "p1";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new velocityupdate_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_k;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_u1;
+  typedef Form_L_FunctionSpace_3 CoefficientSpace_p1;
+
+  // Coefficients
+  dolfin::CoefficientAssigner k;
+  dolfin::CoefficientAssigner u1;
+  dolfin::CoefficientAssigner p1;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& k, const dolfin::GenericFunction& u1, const dolfin::GenericFunction& p1):
-    dolfin::Form(1, 3), k(*this, 0), u1(*this, 1), p1(*this, 2)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), k(*this, 0), u1(*this, 1), p1(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->k = k;
-    this->u1 = u1;
-    this->p1 = p1;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new velocityupdate_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u1, std::shared_ptr<const dolfin::GenericFunction> p1):
-    dolfin::Form(1, 3), k(*this, 0), u1(*this, 1), p1(*this, 2)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> k, std::shared_ptr<const dolfin::GenericFunction> u1, std::shared_ptr<const dolfin::GenericFunction> p1):
+    dolfin::MultiMeshForm(V0), k(*this, 0), u1(*this, 1), p1(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->k = *k;
-    this->u1 = *u1;
-    this->p1 = *p1;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->k = k;
+    this->u1 = u1;
+    this->p1 = p1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new velocityupdate_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -7877,22 +9502,28 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_k;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_u1;
   typedef Form_L_FunctionSpace_3 CoefficientSpace_p1;
 
   // Coefficients
-  dolfin::CoefficientAssigner k;
-  dolfin::CoefficientAssigner u1;
-  dolfin::CoefficientAssigner p1;
+  dolfin::MultiMeshCoefficientAssigner k;
+  dolfin::MultiMeshCoefficientAssigner u1;
+  dolfin::MultiMeshCoefficientAssigner p1;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/navier-stokes/cpp/compile.log b/demo/documented/navier-stokes/cpp/compile.log
index 745812f..67b13f3 100644
--- a/demo/documented/navier-stokes/cpp/compile.log
+++ b/demo/documented/navier-stokes/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form PressureUpdate
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -30,22 +31,27 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    2
   Coefficients:              '[w_0, w_1]'
-  Unique elements:           'CG1(?), R0(?), Vector<2 x CG2(?)>'
-  Unique sub elements:       'CG1(?), R0(?), Vector<2 x CG2(?)>, CG2(?)'
+  Unique elements:           'CG1(?), R0(?), Vector<2 x CG2(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), R0(?), Vector<2 x CG2(?)>, Vector<2 x CG1(?)>,
+                              CG2(?)'
   
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0532479 seconds.
+Compiler stage 1 finished in 0.099833 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -53,11 +59,18 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 5 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -66,7 +79,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.00071 seconds
+  36 entries computed in 0.00114 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -74,6 +87,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
@@ -86,60 +100,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 0): array([[ 0.66666667,  0.16666667,  0.16666667],
-         [ 0.16666667,  0.16666667,  0.66666667],
-         [ 0.16666667,  0.66666667,  0.16666667]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [-1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 1.,  1.,  1.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]]]), (0, 0): array([[[ 0.66666667,  0.16666667,  0.16666667],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.16666667,  0.16666667,  0.66666667],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.16666667,  0.66666667,  0.16666667],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.66666667,  0.16666667,  0.16666667]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.16666667,  0.66666667]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.66666667e+00,   3.33333333e-01,   3.33333333e-01],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2): {None: {None: {(0, 1): array([[[ -1.66666667e+00,   3.33333333e-01,   3.33333333e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  6.32827124e-15,   7.88258347e-15,   8.16013923e-15],
+         [[  6.21724894e-15,   7.49400542e-15,   8.04911693e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[ -3.33333333e-01,   1.66666667e+00,  -3.33333333e-01],
@@ -148,7 +112,7 @@ Compiler stage 2: Computing intermediate representation
          [[  6.66666667e-01,   6.66666667e-01,   2.66666667e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  2.00000000e+00,  -2.00000000e+00,   1.09912079e-14],
+         [[  2.00000000e+00,  -2.00000000e+00,   1.05471187e-14],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[ -6.66666667e-01,  -6.66666667e-01,  -2.66666667e+00],
@@ -158,7 +122,7 @@ Compiler stage 2: Computing intermediate representation
           [ -1.66666667e+00,   3.33333333e-01,   3.33333333e-01]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  6.32827124e-15,   7.88258347e-15,   8.16013923e-15]],
+          [  6.21724894e-15,   7.49400542e-15,   8.04911693e-15]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [ -3.33333333e-01,   1.66666667e+00,  -3.33333333e-01]],
@@ -167,7 +131,7 @@ Compiler stage 2: Computing intermediate representation
           [  6.66666667e-01,   6.66666667e-01,   2.66666667e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  2.00000000e+00,  -2.00000000e+00,   1.09912079e-14]],
+          [  2.00000000e+00,  -2.00000000e+00,   1.05471187e-14]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [ -6.66666667e-01,  -6.66666667e-01,  -2.66666667e+00]]]), (1, 0): array([[[ -1.66666667e+00,   3.33333333e-01,   3.33333333e-01],
@@ -185,7 +149,7 @@ Compiler stage 2: Computing intermediate representation
          [[ -6.66666667e-01,  -2.66666667e+00,  -6.66666667e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  2.00000000e+00,   1.00742216e-15,  -2.00000000e+00],
+         [[  2.00000000e+00,   2.92740528e-16,  -2.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -204,7 +168,7 @@ Compiler stage 2: Computing intermediate representation
           [ -6.66666667e-01,  -2.66666667e+00,  -6.66666667e-01]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  2.00000000e+00,   1.00742216e-15,  -2.00000000e+00]]]), (0, 0): array([[[ 0.22222222, -0.11111111, -0.11111111],
+          [  2.00000000e+00,   2.92740528e-16,  -2.00000000e+00]]]), (0, 0): array([[[ 0.22222222, -0.11111111, -0.11111111],
           [ 0.        ,  0.        ,  0.        ]],
   
          [[-0.11111111, -0.11111111,  0.22222222],
@@ -238,66 +202,78 @@ Compiler stage 2: Computing intermediate representation
           [ 0.44444444,  0.44444444,  0.11111111]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.44444444,  0.11111111,  0.44444444]]])}}}}}
+          [ 0.44444444,  0.11111111,  0.44444444]]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1.],
+          [ 0.,  0.,  0.]],
+  
+         [[ 1.,  1.,  1.],
+          [ 0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.],
+          [ 0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.],
+          [-1., -1., -1.]],
+  
+         [[ 0.,  0.,  0.],
+          [ 1.,  1.,  1.]],
+  
+         [[ 0.,  0.,  0.],
+          [ 0.,  0.,  0.]]]), (0, 0): array([[[ 0.66666667,  0.16666667,  0.16666667],
+          [ 0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.16666667,  0.16666667,  0.66666667],
+          [ 0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.16666667,  0.66666667,  0.16666667],
+          [ 0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ],
+          [ 0.66666667,  0.16666667,  0.16666667]],
+  
+         [[ 0.        ,  0.        ,  0.        ],
+          [ 0.16666667,  0.16666667,  0.66666667]],
+  
+         [[ 0.        ,  0.        ,  0.        ],
+          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 0): array([[ 0.66666667,  0.16666667,  0.16666667],
+         [ 0.16666667,  0.16666667,  0.66666667],
+         [ 0.16666667,  0.66666667,  0.16666667]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.66666667e+00,   6.32827124e-15,  -3.33333333e-01,
-            6.66666667e-01,   2.00000000e+00,  -6.66666667e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.33333333e-01,   7.88258347e-15,   1.66666667e+00,
-            6.66666667e-01,  -2.00000000e+00,  -6.66666667e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.33333333e-01,   8.16013923e-15,  -3.33333333e-01,
-            2.66666667e+00,   1.09912079e-14,  -2.66666667e+00]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.66666667e+00,  -3.33333333e-01,   0.00000000e+00,
-            6.66666667e-01,  -6.66666667e-01,   2.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.33333333e-01,  -3.33333333e-01,   0.00000000e+00,
-            2.66666667e+00,  -2.66666667e+00,   1.00742216e-15],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.33333333e-01,   1.66666667e+00,   0.00000000e+00,
-            6.66666667e-01,  -6.66666667e-01,  -2.00000000e+00]]), 'FE2_C0_D01': array([[ -1.66666667e+00,   6.32827124e-15,  -3.33333333e-01,
-            6.66666667e-01,   2.00000000e+00,  -6.66666667e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.33333333e-01,   7.88258347e-15,   1.66666667e+00,
-            6.66666667e-01,  -2.00000000e+00,  -6.66666667e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.33333333e-01,   8.16013923e-15,  -3.33333333e-01,
-            2.66666667e+00,   1.09912079e-14,  -2.66666667e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
-           0.16666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
-           0.66666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
-           0.16666667]]), 'FE2_C0_D10': array([[ -1.66666667e+00,  -3.33333333e-01,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_C0_D10': array([[ -1.66666667e+00,  -3.33333333e-01,   0.00000000e+00,
             6.66666667e-01,  -6.66666667e-01,   2.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  3.33333333e-01,  -3.33333333e-01,   0.00000000e+00,
-            2.66666667e+00,  -2.66666667e+00,   1.00742216e-15,
+            2.66666667e+00,  -2.66666667e+00,   2.92740528e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  3.33333333e-01,   1.66666667e+00,   0.00000000e+00,
             6.66666667e-01,  -6.66666667e-01,  -2.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
          [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.22222222, -0.11111111, -0.11111111,  0.11111111,
            0.44444444,  0.44444444],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -305,7 +281,23 @@ Compiler stage 2: Computing intermediate representation
            0.44444444,  0.11111111],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -0.11111111,  0.22222222, -0.11111111,  0.44444444,
-           0.11111111,  0.44444444]]), 'FE2_C0': array([[ 0.22222222, -0.11111111, -0.11111111,  0.11111111,  0.44444444,
+           0.11111111,  0.44444444]]), 'FE3_C0_D01': array([[ -1.66666667e+00,   6.21724894e-15,  -3.33333333e-01,
+            6.66666667e-01,   2.00000000e+00,  -6.66666667e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.33333333e-01,   7.49400542e-15,   1.66666667e+00,
+            6.66666667e-01,  -2.00000000e+00,  -6.66666667e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.33333333e-01,   8.04911693e-15,  -3.33333333e-01,
+            2.66666667e+00,   1.05471187e-14,  -2.66666667e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C0': array([[ 0.22222222, -0.11111111, -0.11111111,  0.11111111,  0.44444444,
            0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ],
          [-0.11111111, -0.11111111,  0.22222222,  0.44444444,  0.44444444,
@@ -313,81 +305,65 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ],
          [-0.11111111,  0.22222222, -0.11111111,  0.44444444,  0.11111111,
            0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ]]), 'FE3': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0': array([[ 0.66666667,  0.16666667,  0.16666667],
-         [ 0.16666667,  0.16666667,  0.66666667],
-         [ 0.16666667,  0.66666667,  0.16666667]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+           0.        ,  0.        ]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]])}
-  
-  tables: {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
+           0.16666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
+           0.66666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
+           0.16666667]]), 'FE2_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
+           0.        ],
+         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
+           0.        ],
+         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
+           0.        ]]), 'FE3_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.66666667e+00,   6.32827124e-15,  -3.33333333e-01,
+           -1.66666667e+00,   6.21724894e-15,  -3.33333333e-01,
             6.66666667e-01,   2.00000000e+00,  -6.66666667e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.33333333e-01,   7.88258347e-15,   1.66666667e+00,
+            3.33333333e-01,   7.49400542e-15,   1.66666667e+00,
             6.66666667e-01,  -2.00000000e+00,  -6.66666667e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.33333333e-01,   8.16013923e-15,  -3.33333333e-01,
-            2.66666667e+00,   1.09912079e-14,  -2.66666667e+00]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.33333333e-01,   8.04911693e-15,  -3.33333333e-01,
+            2.66666667e+00,   1.05471187e-14,  -2.66666667e+00]]), 'FE0': array([[ 0.66666667,  0.16666667,  0.16666667],
+         [ 0.16666667,  0.16666667,  0.66666667],
+         [ 0.16666667,  0.66666667,  0.16666667]]), 'FE1': array([[ 1.],
+         [ 1.],
+         [ 1.]]), 'FE3_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.66666667e+00,  -3.33333333e-01,   0.00000000e+00,
             6.66666667e-01,  -6.66666667e-01,   2.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             3.33333333e-01,  -3.33333333e-01,   0.00000000e+00,
-            2.66666667e+00,  -2.66666667e+00,   1.00742216e-15],
+            2.66666667e+00,  -2.66666667e+00,   2.92740528e-16],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             3.33333333e-01,   1.66666667e+00,   0.00000000e+00,
-            6.66666667e-01,  -6.66666667e-01,  -2.00000000e+00]]), 'FE2_C0_D01': array([[ -1.66666667e+00,   6.32827124e-15,  -3.33333333e-01,
-            6.66666667e-01,   2.00000000e+00,  -6.66666667e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.33333333e-01,   7.88258347e-15,   1.66666667e+00,
-            6.66666667e-01,  -2.00000000e+00,  -6.66666667e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.33333333e-01,   8.16013923e-15,  -3.33333333e-01,
-            2.66666667e+00,   1.09912079e-14,  -2.66666667e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
-           0.16666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
-           0.66666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
-           0.16666667]]), 'FE2_C0_D10': array([[ -1.66666667e+00,  -3.33333333e-01,   0.00000000e+00,
+            6.66666667e-01,  -6.66666667e-01,  -2.00000000e+00]])}
+  
+  tables: {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_C0_D10': array([[ -1.66666667e+00,  -3.33333333e-01,   0.00000000e+00,
             6.66666667e-01,  -6.66666667e-01,   2.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  3.33333333e-01,  -3.33333333e-01,   0.00000000e+00,
-            2.66666667e+00,  -2.66666667e+00,   1.00742216e-15,
+            2.66666667e+00,  -2.66666667e+00,   2.92740528e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  3.33333333e-01,   1.66666667e+00,   0.00000000e+00,
             6.66666667e-01,  -6.66666667e-01,  -2.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
          [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.22222222, -0.11111111, -0.11111111,  0.11111111,
            0.44444444,  0.44444444],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -395,7 +371,23 @@ Compiler stage 2: Computing intermediate representation
            0.44444444,  0.11111111],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -0.11111111,  0.22222222, -0.11111111,  0.44444444,
-           0.11111111,  0.44444444]]), 'FE2_C0': array([[ 0.22222222, -0.11111111, -0.11111111,  0.11111111,  0.44444444,
+           0.11111111,  0.44444444]]), 'FE3_C0_D01': array([[ -1.66666667e+00,   6.21724894e-15,  -3.33333333e-01,
+            6.66666667e-01,   2.00000000e+00,  -6.66666667e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.33333333e-01,   7.49400542e-15,   1.66666667e+00,
+            6.66666667e-01,  -2.00000000e+00,  -6.66666667e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.33333333e-01,   8.04911693e-15,  -3.33333333e-01,
+            2.66666667e+00,   1.05471187e-14,  -2.66666667e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C0': array([[ 0.22222222, -0.11111111, -0.11111111,  0.11111111,  0.44444444,
            0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ],
          [-0.11111111, -0.11111111,  0.22222222,  0.44444444,  0.44444444,
@@ -403,51 +395,73 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ],
          [-0.11111111,  0.22222222, -0.11111111,  0.44444444,  0.11111111,
            0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ]]), 'FE3': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0': array([[ 0.66666667,  0.16666667,  0.16666667],
+           0.        ,  0.        ]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
+           0.16666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
+           0.66666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
+           0.16666667]]), 'FE2_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
+           0.        ],
+         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
+           0.        ],
+         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
+           0.        ]]), 'FE3_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.66666667e+00,   6.21724894e-15,  -3.33333333e-01,
+            6.66666667e-01,   2.00000000e+00,  -6.66666667e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.33333333e-01,   7.49400542e-15,   1.66666667e+00,
+            6.66666667e-01,  -2.00000000e+00,  -6.66666667e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.33333333e-01,   8.04911693e-15,  -3.33333333e-01,
+            2.66666667e+00,   1.05471187e-14,  -2.66666667e+00]]), 'FE0': array([[ 0.66666667,  0.16666667,  0.16666667],
          [ 0.16666667,  0.16666667,  0.66666667],
-         [ 0.16666667,  0.66666667,  0.16666667]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [ 0.16666667,  0.66666667,  0.16666667]]), 'FE1': array([[ 1.],
+         [ 1.],
+         [ 1.]]), 'FE3_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.66666667e+00,  -3.33333333e-01,   0.00000000e+00,
+            6.66666667e-01,  -6.66666667e-01,   2.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.33333333e-01,  -3.33333333e-01,   0.00000000e+00,
+            2.66666667e+00,  -2.66666667e+00,   2.92740528e-16],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]])}
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.33333333e-01,   1.66666667e+00,   0.00000000e+00,
+            6.66666667e-01,  -6.66666667e-01,  -2.00000000e+00]])}
   
   name_map: {}
   
-  inv_name_map: {'FE2_C1_D01': 'FE2_C1_D01', 'FE2_C1_D10': 'FE2_C1_D10', 'FE2_C0': 'FE2_C0', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C1_D10': 'FE1_C1_D10', 'FE2_C1': 'FE2_C1', 'FE2_C0_D01': 'FE2_C0_D01', 'FE3': 'FE3', 'FE0': 'FE0', 'FE2_C0_D10': 'FE2_C0_D10', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10'}
+  inv_name_map: {'FE2_C1_D01': 'FE2_C1_D01', 'FE2_C1': 'FE2_C1', 'FE2_C1_D10': 'FE2_C1_D10', 'FE0': 'FE0', 'FE1': 'FE1', 'FE2_C0': 'FE2_C0', 'FE3_C0': 'FE3_C0', 'FE3_C1': 'FE3_C1', 'FE3_C0_D10': 'FE3_C0_D10', 'FE2_C0_D01': 'FE2_C0_D01', 'FE3_C1_D01': 'FE3_C1_D01', 'FE3_C0_D01': 'FE3_C0_D01', 'FE2_C0_D10': 'FE2_C0_D10', 'FE3_C1_D10': 'FE3_C1_D10'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE2_C0_D01': array([[ -1.66666667e+00,  -3.33333333e-01,   6.66666667e-01,
+  {'FE3_C0_D10': array([[-1.66666667, -0.33333333,  0.66666667, -0.66666667,  2.        ],
+         [ 0.33333333, -0.33333333,  2.66666667, -2.66666667,  0.        ],
+         [ 0.33333333,  1.66666667,  0.66666667, -0.66666667, -2.        ]]), 'FE3_C0_D01': array([[ -1.66666667e+00,  -3.33333333e-01,   6.66666667e-01,
             2.00000000e+00,  -6.66666667e-01],
          [  3.33333333e-01,   1.66666667e+00,   6.66666667e-01,
            -2.00000000e+00,  -6.66666667e-01],
          [  3.33333333e-01,  -3.33333333e-01,   2.66666667e+00,
-            1.09912079e-14,  -2.66666667e+00]]), 'FE2_C0_D10': array([[-1.66666667, -0.33333333,  0.66666667, -0.66666667,  2.        ],
-         [ 0.33333333, -0.33333333,  2.66666667, -2.66666667,  0.        ],
-         [ 0.33333333,  1.66666667,  0.66666667, -0.66666667, -2.        ]]), 'FE2_C0': array([[ 0.22222222, -0.11111111, -0.11111111,  0.11111111,  0.44444444,
+            1.05471187e-14,  -2.66666667e+00]]), 'FE2_C0_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]]), 'FE3_C0': array([[ 0.22222222, -0.11111111, -0.11111111,  0.11111111,  0.44444444,
            0.44444444],
          [-0.11111111, -0.11111111,  0.22222222,  0.44444444,  0.44444444,
            0.11111111],
          [-0.11111111,  0.22222222, -0.11111111,  0.44444444,  0.11111111,
-           0.44444444]]), 'FE3': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0': array([[ 0.66666667,  0.16666667,  0.16666667],
+           0.44444444]]), 'FE0': array([[ 0.66666667,  0.16666667,  0.16666667],
          [ 0.16666667,  0.16666667,  0.66666667],
-         [ 0.16666667,  0.66666667,  0.16666667]]), 'FE1_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]])}
+         [ 0.16666667,  0.66666667,  0.16666667]]), 'FE1': array([[ 1.],
+         [ 1.],
+         [ 1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE2_C1_D01': ('FE2_C0_D01', (10, [6, 8, 9, 10, 11]), False, False), 'FE2_C1_D10': ('FE2_C0_D10', (11, [6, 7, 9, 10, 11]), False, False), 'FE2_C0': ('FE2_C0', (6, [0, 1, 2, 3, 4, 5]), False, False), 'FE1_C0': ('FE0', (0, [0, 1, 2]), False, False), 'FE1_C1': ('FE0', (3, [3, 4, 5]), False, False), 'FE1_C1_D01': ('FE1_C0_D01', (4, [3, 5]), False, False), 'FE1_C1_D10': ('FE1_C0_D01', (5, [3, 4]), False, False), 'FE2_C1': ('FE2_C0', (9, [6, 7, 8, 9, 10, 11]), False, False), 'FE2_C0_D01': ( [...]
+  {'FE2_C1_D01': ('FE2_C0_D01', (4, [3, 5]), False, False), 'FE2_C1': ('FE0', (3, [3, 4, 5]), False, False), 'FE2_C1_D10': ('FE2_C0_D01', (5, [3, 4]), False, False), 'FE0': ('FE0', (), False, False), 'FE1': ('FE1', (), False, True), 'FE2_C0': ('FE0', (0, [0, 1, 2]), False, False), 'FE3_C0': ('FE3_C0', (6, [0, 1, 2, 3, 4, 5]), False, False), 'FE3_C1': ('FE3_C0', (9, [6, 7, 8, 9, 10, 11]), False, False), 'FE3_C0_D10': ('FE3_C0_D10', (8, [0, 1, 3, 4, 5]), False, False), 'FE2_C0_D01': ('FE2_ [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -463,295 +477,62 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.130968 seconds.
+Compiler stage 2 finished in 0.222156 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.00169802 seconds.
+Compiler stage 3 finished in 0.00219202 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Generating code for 5 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Removing unused variable: tmp0
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: C1
+  Removing unused variable: C0
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -760,23 +541,24 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.296391 seconds.
+Compiler stage 4 finished in 0.45831 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000713825 seconds.
+Compiler stage 4.1 finished in 0.00170112 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./PressureUpdate.h.
-Compiler stage 5 finished in 0.00120306 seconds.
+Compiler stage 5 finished in 0.00205779 seconds.
 
-FFC finished in 0.484628 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.787097 seconds.
+Output written to ./PressureUpdate.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form TentativeVelocity
 
@@ -789,16 +571,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'Vector<2 x CG2(?)>, R0(?)'
-  Unique sub elements:       'Vector<2 x CG2(?)>, R0(?), CG2(?)'
+  Unique elements:           'Vector<2 x CG2(?)>, R0(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'Vector<2 x CG2(?)>, R0(?), Vector<2 x CG1(?)>, CG2(?),
+                              CG1(?)'
   
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -806,31 +589,45 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    3
   Coefficients:              '[w_0, w_1, w_2]'
-  Unique elements:           'Vector<2 x CG2(?)>, R0(?)'
-  Unique sub elements:       'Vector<2 x CG2(?)>, R0(?), CG2(?)'
+  Unique elements:           'Vector<2 x CG2(?)>, R0(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'Vector<2 x CG2(?)>, R0(?), Vector<2 x CG1(?)>, CG2(?),
+                              CG1(?)'
   
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   
-Compiler stage 1 finished in 0.0241051 seconds.
+Compiler stage 1 finished in 0.0406079 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 3 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 3 dofmaps
   Reusing element from cache
+  Computing representation of 5 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -840,87 +637,16 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {6: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.,  1.,  1.,  1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.],
-          [-1., -1., -1., -1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
-            0.10810302],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ]],
-  
-         [[ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
-            0.44594849],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ]],
-  
-         [[ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ],
-          [ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
-            0.10810302]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ],
-          [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
-            0.44594849]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ],
-          [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[  6.33695146e-01,   6.33695146e-01,  -2.26739029e+00,
+  {6: {VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2): {None: {None: {(0, 1): array([[[  6.33695146e-01,   6.33695146e-01,  -2.26739029e+00,
             -7.83793964e-01,  -7.83793964e-01,   5.67587927e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  8.77076189e-15,   8.32667268e-15,   5.88418203e-15,
-             6.94583280e-15,   7.04991621e-15,   8.22952817e-15],
+         [[  7.99360578e-15,   7.32747196e-15,   5.44009282e-15,
+             6.93195501e-15,   6.88338275e-15,   8.11850587e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
@@ -934,8 +660,8 @@ Compiler stage 2: Computing intermediate representation
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  8.43769499e-15,  -2.90108544e+00,   2.90108544e+00,
-             8.18789481e-15,   1.35138189e+00,  -1.35138189e+00],
+         [[  7.10542736e-15,  -2.90108544e+00,   2.90108544e+00,
+             8.13238366e-15,   1.35138189e+00,  -1.35138189e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
@@ -951,8 +677,8 @@ Compiler stage 2: Computing intermediate representation
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.77076189e-15,   8.32667268e-15,   5.88418203e-15,
-             6.94583280e-15,   7.04991621e-15,   8.22952817e-15]],
+          [  7.99360578e-15,   7.32747196e-15,   5.44009282e-15,
+             6.93195501e-15,   6.88338275e-15,   8.11850587e-15]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -966,8 +692,8 @@ Compiler stage 2: Computing intermediate representation
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.43769499e-15,  -2.90108544e+00,   2.90108544e+00,
-             8.18789481e-15,   1.35138189e+00,  -1.35138189e+00]],
+          [  7.10542736e-15,  -2.90108544e+00,   2.90108544e+00,
+             8.13238366e-15,   1.35138189e+00,  -1.35138189e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -997,8 +723,8 @@ Compiler stage 2: Computing intermediate representation
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -2.90108544e+00,  -2.42787315e-15,   2.90108544e+00,
-             1.35138189e+00,   2.02557929e-16,  -1.35138189e+00],
+         [[ -2.90108544e+00,  -3.86532069e-15,   2.90108544e+00,
+             1.35138189e+00,  -4.32612710e-16,  -1.35138189e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
@@ -1029,8 +755,8 @@ Compiler stage 2: Computing intermediate representation
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -2.90108544e+00,  -2.42787315e-15,   2.90108544e+00,
-             1.35138189e+00,   2.02557929e-16,  -1.35138189e+00]]]), (0, 0): array([[[-0.07480381, -0.07480381,  0.51763234, -0.04820838, -0.04820838,
+          [ -2.90108544e+00,  -3.86532069e-15,   2.90108544e+00,
+             1.35138189e+00,  -4.32612710e-16,  -1.35138189e+00]]]), (0, 0): array([[[-0.07480381, -0.07480381,  0.51763234, -0.04820838, -0.04820838,
            -0.08473049],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ]],
@@ -1088,67 +814,112 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ],
           [ 0.29921523,  0.03354481,  0.29921523,  0.19283351,  0.79548023,
-            0.19283351]]])}}}}}
+            0.19283351]]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 1.,  1.,  1.,  1.,  1.,  1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.],
+          [-1., -1., -1., -1., -1., -1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
+            0.10810302],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ]],
+  
+         [[ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
+            0.44594849],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ]],
+  
+         [[ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
+            0.44594849],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ],
+          [ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
+            0.10810302]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ],
+          [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
+            0.44594849]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ],
+          [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
+            0.44594849]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+  {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.33695146e-01,   7.99360578e-15,  -6.33695146e-01,
+            3.26739029e+00,   7.10542736e-15,  -3.26739029e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.33695146e-01,   7.32747196e-15,   2.26739029e+00,
+            3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.26739029e+00,   5.44009282e-15,  -6.33695146e-01,
+            3.66304854e-01,   2.90108544e+00,  -3.66304854e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -7.83793964e-01,   6.93195501e-15,   7.83793964e-01,
+            4.32412073e-01,   8.13238366e-15,  -4.32412073e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -7.83793964e-01,   6.88338275e-15,  -5.67587927e-01,
+            1.78379396e+00,   1.35138189e+00,  -1.78379396e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[-0.07480381,  0.51763234, -0.07480381,  0.29921523,  0.03354481,
-           0.29921523,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.07480381, -0.07480381,  0.51763234,  0.29921523,  0.29921523,
-           0.03354481,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [ 0.51763234, -0.07480381, -0.07480381,  0.03354481,  0.29921523,
-           0.29921523,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.04820838, -0.08473049, -0.04820838,  0.19283351,  0.79548023,
-           0.19283351,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.04820838, -0.04820838, -0.08473049,  0.19283351,  0.19283351,
-           0.79548023,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.08473049, -0.04820838, -0.04820838,  0.79548023,  0.19283351,
-           0.19283351,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.07480381,  0.51763234, -0.07480381,  0.29921523,
-           0.03354481,  0.29921523],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.07480381, -0.07480381,  0.51763234,  0.29921523,
-           0.29921523,  0.03354481],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.51763234, -0.07480381, -0.07480381,  0.03354481,
-           0.29921523,  0.29921523],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04820838, -0.08473049, -0.04820838,  0.19283351,
-           0.79548023,  0.19283351],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04820838, -0.04820838, -0.08473049,  0.19283351,
-           0.19283351,  0.79548023],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.08473049, -0.04820838, -0.04820838,  0.79548023,
-           0.19283351,  0.19283351]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.67587927e-01,   8.11850587e-15,   7.83793964e-01,
+            1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,  -2.90108544e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             6.33695146e-01,  -6.33695146e-01,   0.00000000e+00,
-            3.26739029e+00,  -3.26739029e+00,  -2.42787315e-15],
+            3.26739029e+00,  -3.26739029e+00,  -3.86532069e-15],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -2.26739029e+00,  -6.33695146e-01,   0.00000000e+00,
@@ -1160,83 +931,61 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -7.83793964e-01,   7.83793964e-01,   0.00000000e+00,
-            4.32412073e-01,  -4.32412073e-01,   2.02557929e-16],
+            4.32412073e-01,  -4.32412073e-01,  -4.32612710e-16],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             5.67587927e-01,   7.83793964e-01,   0.00000000e+00,
-            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE2_C0_D01': array([[  6.33695146e-01,   7.99360578e-15,  -6.33695146e-01,
+            3.26739029e+00,   7.10542736e-15,  -3.26739029e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  6.33695146e-01,   7.32747196e-15,   2.26739029e+00,
+            3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.33695146e-01,   8.77076189e-15,  -6.33695146e-01,
-            3.26739029e+00,   8.43769499e-15,  -3.26739029e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.33695146e-01,   8.32667268e-15,   2.26739029e+00,
-            3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.26739029e+00,   5.88418203e-15,  -6.33695146e-01,
-            3.66304854e-01,   2.90108544e+00,  -3.66304854e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -7.83793964e-01,   6.94583280e-15,   7.83793964e-01,
-            4.32412073e-01,   8.18789481e-15,  -4.32412073e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -7.83793964e-01,   7.04991621e-15,  -5.67587927e-01,
-            1.78379396e+00,   1.35138189e+00,  -1.78379396e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.67587927e-01,   8.22952817e-15,   7.83793964e-01,
-            1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00]]), 'FE1_C0_D01': array([[  6.33695146e-01,   8.77076189e-15,  -6.33695146e-01,
-            3.26739029e+00,   8.43769499e-15,  -3.26739029e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.33695146e-01,   8.32667268e-15,   2.26739029e+00,
-            3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.26739029e+00,   5.88418203e-15,  -6.33695146e-01,
+         [ -2.26739029e+00,   5.44009282e-15,  -6.33695146e-01,
             3.66304854e-01,   2.90108544e+00,  -3.66304854e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -7.83793964e-01,   6.94583280e-15,   7.83793964e-01,
-            4.32412073e-01,   8.18789481e-15,  -4.32412073e-01,
+         [ -7.83793964e-01,   6.93195501e-15,   7.83793964e-01,
+            4.32412073e-01,   8.13238366e-15,  -4.32412073e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -7.83793964e-01,   7.04991621e-15,  -5.67587927e-01,
+         [ -7.83793964e-01,   6.88338275e-15,  -5.67587927e-01,
             1.78379396e+00,   1.35138189e+00,  -1.78379396e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.67587927e-01,   8.22952817e-15,   7.83793964e-01,
+         [  5.67587927e-01,   8.11850587e-15,   7.83793964e-01,
             1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[  6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
+           0.        ],
+         [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
+           0.        ],
+         [ 0.81684757,  0.09157621,  0.09157621,  0.        ,  0.        ,
+           0.        ],
+         [ 0.44594849,  0.10810302,  0.44594849,  0.        ,  0.        ,
+           0.        ],
+         [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
+           0.09157621],
+         [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
+           0.81684757],
+         [ 0.        ,  0.        ,  0.        ,  0.81684757,  0.09157621,
+           0.09157621],
+         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.10810302,
+           0.44594849],
+         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
+           0.10810302],
+         [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
+           0.44594849]]), 'FE2_C0_D10': array([[  6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,  -2.90108544e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  6.33695146e-01,  -6.33695146e-01,   0.00000000e+00,
-            3.26739029e+00,  -3.26739029e+00,  -2.42787315e-15,
+            3.26739029e+00,  -3.26739029e+00,  -3.86532069e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -2.26739029e+00,  -6.33695146e-01,   0.00000000e+00,
@@ -1248,65 +997,18 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -7.83793964e-01,   7.83793964e-01,   0.00000000e+00,
-            4.32412073e-01,  -4.32412073e-01,   2.02557929e-16,
+            4.32412073e-01,  -4.32412073e-01,  -4.32612710e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  5.67587927e-01,   7.83793964e-01,   0.00000000e+00,
             1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
-           0.09157621],
-         [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
-           0.81684757],
-         [ 0.        ,  0.        ,  0.        ,  0.81684757,  0.09157621,
-           0.09157621],
-         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.10810302,
-           0.44594849],
-         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
-           0.10810302],
-         [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
-           0.44594849]]), 'FE0_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
-           0.        ],
-         [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
-           0.        ],
-         [ 0.81684757,  0.09157621,  0.09157621,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44594849,  0.10810302,  0.44594849,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
-           0.        ]])}
-  
-  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[-0.07480381,  0.51763234, -0.07480381,  0.29921523,  0.03354481,
-           0.29921523,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.07480381, -0.07480381,  0.51763234,  0.29921523,  0.29921523,
-           0.03354481,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [ 0.51763234, -0.07480381, -0.07480381,  0.03354481,  0.29921523,
-           0.29921523,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.04820838, -0.08473049, -0.04820838,  0.19283351,  0.79548023,
-           0.19283351,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.04820838, -0.04820838, -0.08473049,  0.19283351,  0.19283351,
-           0.79548023,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.08473049, -0.04820838, -0.04820838,  0.79548023,  0.19283351,
-           0.19283351,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -0.07480381,  0.51763234, -0.07480381,  0.29921523,
            0.03354481,  0.29921523],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -1323,40 +1025,40 @@ Compiler stage 2: Computing intermediate representation
            0.19283351,  0.79548023],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -0.08473049, -0.04820838, -0.04820838,  0.79548023,
-           0.19283351,  0.19283351]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
-            3.66304854e-01,  -3.66304854e-01,  -2.90108544e+00],
+           0.19283351,  0.19283351]]), 'FE2_C0': array([[-0.07480381,  0.51763234, -0.07480381,  0.29921523,  0.03354481,
+           0.29921523,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.07480381, -0.07480381,  0.51763234,  0.29921523,  0.29921523,
+           0.03354481,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.51763234, -0.07480381, -0.07480381,  0.03354481,  0.29921523,
+           0.29921523,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.04820838, -0.08473049, -0.04820838,  0.19283351,  0.79548023,
+           0.19283351,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.04820838, -0.04820838, -0.08473049,  0.19283351,  0.19283351,
+           0.79548023,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.08473049, -0.04820838, -0.04820838,  0.79548023,  0.19283351,
+           0.19283351,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.33695146e-01,  -6.33695146e-01,   0.00000000e+00,
-            3.26739029e+00,  -3.26739029e+00,  -2.42787315e-15],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.26739029e+00,  -6.33695146e-01,   0.00000000e+00,
-            3.66304854e-01,  -3.66304854e-01,   2.90108544e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -7.83793964e-01,  -5.67587927e-01,   0.00000000e+00,
-            1.78379396e+00,  -1.78379396e+00,   1.35138189e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -7.83793964e-01,   7.83793964e-01,   0.00000000e+00,
-            4.32412073e-01,  -4.32412073e-01,   2.02557929e-16],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.67587927e-01,   7.83793964e-01,   0.00000000e+00,
-            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1367,63 +1069,110 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]])}
+  
+  tables: {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.33695146e-01,   8.77076189e-15,  -6.33695146e-01,
-            3.26739029e+00,   8.43769499e-15,  -3.26739029e+00],
+            6.33695146e-01,   7.99360578e-15,  -6.33695146e-01,
+            3.26739029e+00,   7.10542736e-15,  -3.26739029e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.33695146e-01,   8.32667268e-15,   2.26739029e+00,
+            6.33695146e-01,   7.32747196e-15,   2.26739029e+00,
             3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.26739029e+00,   5.88418203e-15,  -6.33695146e-01,
+           -2.26739029e+00,   5.44009282e-15,  -6.33695146e-01,
             3.66304854e-01,   2.90108544e+00,  -3.66304854e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -7.83793964e-01,   6.94583280e-15,   7.83793964e-01,
-            4.32412073e-01,   8.18789481e-15,  -4.32412073e-01],
+           -7.83793964e-01,   6.93195501e-15,   7.83793964e-01,
+            4.32412073e-01,   8.13238366e-15,  -4.32412073e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -7.83793964e-01,   7.04991621e-15,  -5.67587927e-01,
+           -7.83793964e-01,   6.88338275e-15,  -5.67587927e-01,
             1.78379396e+00,   1.35138189e+00,  -1.78379396e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.67587927e-01,   8.22952817e-15,   7.83793964e-01,
-            1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00]]), 'FE1_C0_D01': array([[  6.33695146e-01,   8.77076189e-15,  -6.33695146e-01,
-            3.26739029e+00,   8.43769499e-15,  -3.26739029e+00,
+            5.67587927e-01,   8.11850587e-15,   7.83793964e-01,
+            1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
+            3.66304854e-01,  -3.66304854e-01,  -2.90108544e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.33695146e-01,  -6.33695146e-01,   0.00000000e+00,
+            3.26739029e+00,  -3.26739029e+00,  -3.86532069e-15],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.26739029e+00,  -6.33695146e-01,   0.00000000e+00,
+            3.66304854e-01,  -3.66304854e-01,   2.90108544e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -7.83793964e-01,  -5.67587927e-01,   0.00000000e+00,
+            1.78379396e+00,  -1.78379396e+00,   1.35138189e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -7.83793964e-01,   7.83793964e-01,   0.00000000e+00,
+            4.32412073e-01,  -4.32412073e-01,  -4.32612710e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.67587927e-01,   7.83793964e-01,   0.00000000e+00,
+            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE2_C0_D01': array([[  6.33695146e-01,   7.99360578e-15,  -6.33695146e-01,
+            3.26739029e+00,   7.10542736e-15,  -3.26739029e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.33695146e-01,   8.32667268e-15,   2.26739029e+00,
+         [  6.33695146e-01,   7.32747196e-15,   2.26739029e+00,
             3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.26739029e+00,   5.88418203e-15,  -6.33695146e-01,
+         [ -2.26739029e+00,   5.44009282e-15,  -6.33695146e-01,
             3.66304854e-01,   2.90108544e+00,  -3.66304854e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -7.83793964e-01,   6.94583280e-15,   7.83793964e-01,
-            4.32412073e-01,   8.18789481e-15,  -4.32412073e-01,
+         [ -7.83793964e-01,   6.93195501e-15,   7.83793964e-01,
+            4.32412073e-01,   8.13238366e-15,  -4.32412073e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -7.83793964e-01,   7.04991621e-15,  -5.67587927e-01,
+         [ -7.83793964e-01,   6.88338275e-15,  -5.67587927e-01,
             1.78379396e+00,   1.35138189e+00,  -1.78379396e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.67587927e-01,   8.22952817e-15,   7.83793964e-01,
+         [  5.67587927e-01,   8.11850587e-15,   7.83793964e-01,
             1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[  6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
+           0.        ],
+         [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
+           0.        ],
+         [ 0.81684757,  0.09157621,  0.09157621,  0.        ,  0.        ,
+           0.        ],
+         [ 0.44594849,  0.10810302,  0.44594849,  0.        ,  0.        ,
+           0.        ],
+         [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
+           0.09157621],
+         [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
+           0.81684757],
+         [ 0.        ,  0.        ,  0.        ,  0.81684757,  0.09157621,
+           0.09157621],
+         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.10810302,
+           0.44594849],
+         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
+           0.10810302],
+         [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
+           0.44594849]]), 'FE2_C0_D10': array([[  6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,  -2.90108544e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  6.33695146e-01,  -6.33695146e-01,   0.00000000e+00,
-            3.26739029e+00,  -3.26739029e+00,  -2.42787315e-15,
+            3.26739029e+00,  -3.26739029e+00,  -3.86532069e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -2.26739029e+00,  -6.33695146e-01,   0.00000000e+00,
@@ -1435,42 +1184,106 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -7.83793964e-01,   7.83793964e-01,   0.00000000e+00,
-            4.32412073e-01,  -4.32412073e-01,   2.02557929e-16,
+            4.32412073e-01,  -4.32412073e-01,  -4.32612710e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  5.67587927e-01,   7.83793964e-01,   0.00000000e+00,
             1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
-           0.09157621],
-         [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
-           0.81684757],
-         [ 0.        ,  0.        ,  0.        ,  0.81684757,  0.09157621,
-           0.09157621],
-         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.10810302,
-           0.44594849],
-         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
-           0.10810302],
-         [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
-           0.44594849]]), 'FE0_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
-           0.        ],
-         [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
-           0.        ],
-         [ 0.81684757,  0.09157621,  0.09157621,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44594849,  0.10810302,  0.44594849,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
-           0.        ]])}
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.07480381,  0.51763234, -0.07480381,  0.29921523,
+           0.03354481,  0.29921523],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.07480381, -0.07480381,  0.51763234,  0.29921523,
+           0.29921523,  0.03354481],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.51763234, -0.07480381, -0.07480381,  0.03354481,
+           0.29921523,  0.29921523],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04820838, -0.08473049, -0.04820838,  0.19283351,
+           0.79548023,  0.19283351],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04820838, -0.04820838, -0.08473049,  0.19283351,
+           0.19283351,  0.79548023],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.08473049, -0.04820838, -0.04820838,  0.79548023,
+           0.19283351,  0.19283351]]), 'FE2_C0': array([[-0.07480381,  0.51763234, -0.07480381,  0.29921523,  0.03354481,
+           0.29921523,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.07480381, -0.07480381,  0.51763234,  0.29921523,  0.29921523,
+           0.03354481,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.51763234, -0.07480381, -0.07480381,  0.03354481,  0.29921523,
+           0.29921523,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.04820838, -0.08473049, -0.04820838,  0.19283351,  0.79548023,
+           0.19283351,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.04820838, -0.04820838, -0.08473049,  0.19283351,  0.19283351,
+           0.79548023,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.08473049, -0.04820838, -0.04820838,  0.79548023,  0.19283351,
+           0.19283351,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]])}
   
   name_map: {}
   
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C1_D10': 'FE1_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE2': 'FE2', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE2_C1_D01': 'FE2_C1_D01', 'FE2_C1_D10': 'FE2_C1_D10', 'FE2_C0': 'FE2_C0', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C1_D10': 'FE1_C1_D10', 'FE2_C1': 'FE2_C1', 'FE2_C0_D01': 'FE2_C0_D01', 'FE0': 'FE0', 'FE2_C0_D10': 'FE2_C0_D10', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE1_C0': array([[-0.07480381,  0.51763234, -0.07480381,  0.29921523,  0.03354481,
+  {'FE2_C0_D01': array([[ 0.63369515, -0.63369515,  3.26739029,  0.        , -3.26739029],
+         [ 0.63369515,  2.26739029,  0.36630485, -2.90108544, -0.36630485],
+         [-2.26739029, -0.63369515,  0.36630485,  2.90108544, -0.36630485],
+         [-0.78379396,  0.78379396,  0.43241207,  0.        , -0.43241207],
+         [-0.78379396, -0.56758793,  1.78379396,  1.35138189, -1.78379396],
+         [ 0.56758793,  0.78379396,  1.78379396, -1.35138189, -1.78379396]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621],
+         [ 0.09157621,  0.09157621,  0.81684757],
+         [ 0.81684757,  0.09157621,  0.09157621],
+         [ 0.44594849,  0.10810302,  0.44594849],
+         [ 0.44594849,  0.44594849,  0.10810302],
+         [ 0.10810302,  0.44594849,  0.44594849]]), 'FE2_C0_D10': array([[ 0.63369515,  2.26739029,  0.36630485, -0.36630485, -2.90108544],
+         [ 0.63369515, -0.63369515,  3.26739029, -3.26739029,  0.        ],
+         [-2.26739029, -0.63369515,  0.36630485, -0.36630485,  2.90108544],
+         [-0.78379396, -0.56758793,  1.78379396, -1.78379396,  1.35138189],
+         [-0.78379396,  0.78379396,  0.43241207, -0.43241207,  0.        ],
+         [ 0.56758793,  0.78379396,  1.78379396, -1.78379396, -1.35138189]]), 'FE2_C0': array([[-0.07480381,  0.51763234, -0.07480381,  0.29921523,  0.03354481,
            0.29921523],
          [-0.07480381, -0.07480381,  0.51763234,  0.29921523,  0.29921523,
            0.03354481],
@@ -1481,35 +1294,20 @@ Compiler stage 2: Computing intermediate representation
          [-0.04820838, -0.04820838, -0.08473049,  0.19283351,  0.19283351,
            0.79548023],
          [-0.08473049, -0.04820838, -0.04820838,  0.79548023,  0.19283351,
-           0.19283351]]), 'FE0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE2': array([[ 1.],
+           0.19283351]]), 'FE0': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE1_C0_D01': array([[ 0.63369515, -0.63369515,  3.26739029,  0.        , -3.26739029],
-         [ 0.63369515,  2.26739029,  0.36630485, -2.90108544, -0.36630485],
-         [-2.26739029, -0.63369515,  0.36630485,  2.90108544, -0.36630485],
-         [-0.78379396,  0.78379396,  0.43241207,  0.        , -0.43241207],
-         [-0.78379396, -0.56758793,  1.78379396,  1.35138189, -1.78379396],
-         [ 0.56758793,  0.78379396,  1.78379396, -1.35138189, -1.78379396]]), 'FE1_C0_D10': array([[ 0.63369515,  2.26739029,  0.36630485, -0.36630485, -2.90108544],
-         [ 0.63369515, -0.63369515,  3.26739029, -3.26739029,  0.        ],
-         [-2.26739029, -0.63369515,  0.36630485, -0.36630485,  2.90108544],
-         [-0.78379396, -0.56758793,  1.78379396, -1.78379396,  1.35138189],
-         [-0.78379396,  0.78379396,  0.43241207, -0.43241207,  0.        ],
-         [ 0.56758793,  0.78379396,  1.78379396, -1.78379396, -1.35138189]]), 'FE0_C0': array([[ 0.09157621,  0.81684757,  0.09157621],
-         [ 0.09157621,  0.09157621,  0.81684757],
-         [ 0.81684757,  0.09157621,  0.09157621],
-         [ 0.44594849,  0.10810302,  0.44594849],
-         [ 0.44594849,  0.44594849,  0.10810302],
-         [ 0.10810302,  0.44594849,  0.44594849]])}
+         [ 1.]]), 'FE1_C0_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE1_C0': ('FE1_C0', (6, [0, 1, 2, 3, 4, 5]), False, False), 'FE1_C1': ('FE1_C0', (9, [6, 7, 8, 9, 10, 11]), False, False), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE1_C1_D10': ('FE1_C0_D10', (11, [6, 7, 9, 10, 11]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2]), False, False), 'FE2': ('FE2', (), False, True), 'FE1_C1_D01': ('FE1_C0_D01', (10, [ [...]
+  {'FE2_C1_D01': ('FE2_C0_D01', (10, [6, 8, 9, 10, 11]), False, False), 'FE2_C1_D10': ('FE2_C0_D10', (11, [6, 7, 9, 10, 11]), False, False), 'FE2_C0': ('FE2_C0', (6, [0, 1, 2, 3, 4, 5]), False, False), 'FE1_C0': ('FE1_C0', (0, [0, 1, 2]), False, False), 'FE1_C1': ('FE1_C0', (3, [3, 4, 5]), False, False), 'FE1_C1_D01': ('FE1_C0_D01', (4, [3, 5]), False, False), 'FE1_C1_D10': ('FE1_C0_D01', (5, [3, 4]), False, False), 'FE2_C1': ('FE2_C0', (9, [6, 7, 8, 9, 10, 11]), False, False), 'FE2_C0_D [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -1547,102 +1345,19 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {7: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [-1., -1., -1., -1., -1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
-            0.47014206,  0.05971587],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
-            0.47014206,  0.47014206],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
-            0.05971587,  0.47014206],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
-            0.47014206,  0.05971587]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
-            0.47014206,  0.47014206]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
-            0.05971587,  0.47014206]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -3.33333333e-01,   5.94853971e-01,   5.94853971e-01,
+  {7: {VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2): {None: {None: {(0, 1): array([[[ -3.33333333e-01,   5.94853971e-01,   5.94853971e-01,
             -2.18970794e+00,  -8.80568256e-01,  -8.80568256e-01,
              7.61136513e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
   
-         [[  7.34134975e-15,   8.77076189e-15,   8.10462808e-15,
-             6.05071548e-15,   6.88338275e-15,   6.93889390e-15,
-             8.45157277e-15],
+         [[  7.45237205e-15,   8.21565038e-15,   7.21644966e-15,
+             5.71764858e-15,   6.68909372e-15,   6.66133815e-15,
+             8.34055047e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
@@ -1661,8 +1376,8 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
   
-         [[  9.27036226e-15,   1.22124533e-14,  -2.78456191e+00,
-             2.78456191e+00,   8.71525074e-15,   1.64170477e+00,
+         [[  9.43689571e-15,   1.15463195e-14,  -2.78456191e+00,
+             2.78456191e+00,   8.49320614e-15,   1.64170477e+00,
             -1.64170477e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1685,9 +1400,9 @@ Compiler stage 2: Computing intermediate representation
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
-          [  7.34134975e-15,   8.77076189e-15,   8.10462808e-15,
-             6.05071548e-15,   6.88338275e-15,   6.93889390e-15,
-             8.45157277e-15]],
+          [  7.45237205e-15,   8.21565038e-15,   7.21644966e-15,
+             5.71764858e-15,   6.68909372e-15,   6.66133815e-15,
+             8.34055047e-15]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1706,8 +1421,8 @@ Compiler stage 2: Computing intermediate representation
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
-          [  9.27036226e-15,   1.22124533e-14,  -2.78456191e+00,
-             2.78456191e+00,   8.71525074e-15,   1.64170477e+00,
+          [  9.43689571e-15,   1.15463195e-14,  -2.78456191e+00,
+             2.78456191e+00,   8.49320614e-15,   1.64170477e+00,
             -1.64170477e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1750,8 +1465,8 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
   
-         [[ -7.07941648e-17,  -2.78456191e+00,   1.86130332e-15,
-             2.78456191e+00,   1.64170477e+00,   8.66091206e-16,
+         [[ -2.43306259e-16,  -2.78456191e+00,   5.34053683e-16,
+             2.78456191e+00,   1.64170477e+00,   4.42833521e-17,
             -1.64170477e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1795,8 +1510,8 @@ Compiler stage 2: Computing intermediate representation
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
-          [ -7.07941648e-17,  -2.78456191e+00,   1.86130332e-15,
-             2.78456191e+00,   1.64170477e+00,   8.66091206e-16,
+          [ -2.43306259e-16,  -2.78456191e+00,   5.34053683e-16,
+             2.78456191e+00,   1.64170477e+00,   4.42833521e-17,
             -1.64170477e+00]]]), (0, 0): array([[[-0.11111111, -0.08076859, -0.08076859,  0.47435261, -0.02807494,
            -0.02807494, -0.0525839 ],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -1855,176 +1570,202 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
           [ 0.44444444,  0.32307438,  0.04103583,  0.32307438,  0.11229977,
-            0.88413424,  0.11229977]]])}}}}}
+            0.88413424,  0.11229977]]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
   
-  QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
-           0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
-           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
-           0.04103583,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
-           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
-           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
-           0.88413424,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
-           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.11111111, -0.11111111, -0.11111111,  0.44444444,
-           0.44444444,  0.44444444],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.08076859,  0.47435261, -0.08076859,  0.32307438,
-           0.04103583,  0.32307438],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.08076859, -0.08076859,  0.47435261,  0.32307438,
-           0.32307438,  0.04103583],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.47435261, -0.08076859, -0.08076859,  0.04103583,
-           0.32307438,  0.32307438],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.02807494, -0.0525839 , -0.02807494,  0.11229977,
-           0.88413424,  0.11229977],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.02807494, -0.02807494, -0.0525839 ,  0.11229977,
-           0.11229977,  0.88413424],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.0525839 , -0.02807494, -0.02807494,  0.88413424,
-           0.11229977,  0.11229977]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [-1., -1., -1., -1., -1., -1., -1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
+            0.47014206,  0.05971587],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
+            0.47014206,  0.47014206],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
+            0.05971587,  0.47014206],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
+            0.47014206,  0.05971587]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
+            0.47014206,  0.47014206]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
+            0.05971587,  0.47014206]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.]])}}}}}
+  
+  QG-utils, psi_tables, flat_tables:
+  {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17],
+           -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00],
+            5.94853971e-01,   8.21565038e-15,  -5.94853971e-01,
+            3.18970794e+00,   1.15463195e-14,  -3.18970794e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
-            3.18970794e+00,  -3.18970794e+00,   1.86130332e-15],
+            5.94853971e-01,   7.21644966e-15,   2.18970794e+00,
+            4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00],
+           -2.18970794e+00,   5.71764858e-15,  -5.94853971e-01,
+            4.05146029e-01,   2.78456191e+00,  -4.05146029e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00],
+           -8.80568256e-01,   6.68909372e-15,   8.80568256e-01,
+            2.38863487e-01,   8.49320614e-15,  -2.38863487e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
-            2.38863487e-01,  -2.38863487e-01,   8.66091206e-16],
+           -8.80568256e-01,   6.66133815e-15,  -7.61136513e-01,
+            1.88056826e+00,   1.64170477e+00,  -1.88056826e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.61136513e-01,   8.34055047e-15,   8.80568256e-01,
+            1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00],
+           -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   8.77076189e-15,  -5.94853971e-01,
-            3.18970794e+00,   1.22124533e-14,  -3.18970794e+00],
+            5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   8.10462808e-15,   2.18970794e+00,
-            4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01],
+            5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
+            3.18970794e+00,  -3.18970794e+00,   5.34053683e-16],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.18970794e+00,   6.05071548e-15,  -5.94853971e-01,
-            4.05146029e-01,   2.78456191e+00,  -4.05146029e-01],
+           -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   6.88338275e-15,   8.80568256e-01,
-            2.38863487e-01,   8.71525074e-15,  -2.38863487e-01],
+           -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   6.93889390e-15,  -7.61136513e-01,
-            1.88056826e+00,   1.64170477e+00,  -1.88056826e+00],
+           -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
+            2.38863487e-01,  -2.38863487e-01,   4.42833521e-17],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.61136513e-01,   8.45157277e-15,   8.80568256e-01,
-            1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00]]), 'FE1_C0_D01': array([[ -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00,
+            7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00]]), 'FE2_C0_D01': array([[ -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   8.77076189e-15,  -5.94853971e-01,
-            3.18970794e+00,   1.22124533e-14,  -3.18970794e+00,
+         [  5.94853971e-01,   8.21565038e-15,  -5.94853971e-01,
+            3.18970794e+00,   1.15463195e-14,  -3.18970794e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   8.10462808e-15,   2.18970794e+00,
+         [  5.94853971e-01,   7.21644966e-15,   2.18970794e+00,
             4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.18970794e+00,   6.05071548e-15,  -5.94853971e-01,
+         [ -2.18970794e+00,   5.71764858e-15,  -5.94853971e-01,
             4.05146029e-01,   2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   6.88338275e-15,   8.80568256e-01,
-            2.38863487e-01,   8.71525074e-15,  -2.38863487e-01,
+         [ -8.80568256e-01,   6.68909372e-15,   8.80568256e-01,
+            2.38863487e-01,   8.49320614e-15,  -2.38863487e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   6.93889390e-15,  -7.61136513e-01,
+         [ -8.80568256e-01,   6.66133815e-15,  -7.61136513e-01,
             1.88056826e+00,   1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.61136513e-01,   8.45157277e-15,   8.80568256e-01,
+         [  7.61136513e-01,   8.34055047e-15,   8.80568256e-01,
             1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10128651,  0.79742699,  0.10128651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10128651,  0.10128651,  0.79742699,  0.        ,  0.        ,
+           0.        ],
+         [ 0.79742699,  0.10128651,  0.10128651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.47014206,  0.05971587,  0.47014206,  0.        ,  0.        ,
+           0.        ],
+         [ 0.47014206,  0.47014206,  0.05971587,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05971587,  0.47014206,  0.47014206,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333],
+         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.79742699,
+           0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.10128651,
+           0.79742699],
+         [ 0.        ,  0.        ,  0.        ,  0.79742699,  0.10128651,
+           0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.05971587,
+           0.47014206],
+         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.47014206,
+           0.05971587],
+         [ 0.        ,  0.        ,  0.        ,  0.05971587,  0.47014206,
+           0.47014206]]), 'FE2_C0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
@@ -2032,7 +1773,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
-            3.18970794e+00,  -3.18970794e+00,   1.86130332e-15,
+            3.18970794e+00,  -3.18970794e+00,   5.34053683e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
@@ -2044,74 +1785,19 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
-            2.38863487e-01,  -2.38863487e-01,   8.66091206e-16,
+            2.38863487e-01,  -2.38863487e-01,   4.42833521e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
             1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333],
-         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.79742699,
-           0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.10128651,
-           0.79742699],
-         [ 0.        ,  0.        ,  0.        ,  0.79742699,  0.10128651,
-           0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.05971587,
-           0.47014206],
-         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.47014206,
-           0.05971587],
-         [ 0.        ,  0.        ,  0.        ,  0.05971587,  0.47014206,
-           0.47014206]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10128651,  0.79742699,  0.10128651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10128651,  0.10128651,  0.79742699,  0.        ,  0.        ,
-           0.        ],
-         [ 0.79742699,  0.10128651,  0.10128651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.47014206,  0.05971587,  0.47014206,  0.        ,  0.        ,
-           0.        ],
-         [ 0.47014206,  0.47014206,  0.05971587,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05971587,  0.47014206,  0.47014206,  0.        ,  0.        ,
-           0.        ]])}
-  
-  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
-           0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
-           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
-           0.04103583,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
-           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
-           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
-           0.88413424,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ],
-         [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
-           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -0.11111111, -0.11111111, -0.11111111,  0.44444444,
            0.44444444,  0.44444444],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -2131,46 +1817,46 @@ Compiler stage 2: Computing intermediate representation
            0.11229977,  0.88413424],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -0.0525839 , -0.02807494, -0.02807494,  0.88413424,
-           0.11229977,  0.11229977]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17],
+           0.11229977,  0.11229977]]), 'FE2_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
+           0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
+           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
+           0.04103583,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
+           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
+           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
+           0.88413424,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
+           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
-            3.18970794e+00,  -3.18970794e+00,   1.86130332e-15],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
-            2.38863487e-01,  -2.38863487e-01,   8.66091206e-16],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -2183,68 +1869,123 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]])}
+  
+  tables: {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00],
+           -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   8.77076189e-15,  -5.94853971e-01,
-            3.18970794e+00,   1.22124533e-14,  -3.18970794e+00],
+            5.94853971e-01,   8.21565038e-15,  -5.94853971e-01,
+            3.18970794e+00,   1.15463195e-14,  -3.18970794e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   8.10462808e-15,   2.18970794e+00,
+            5.94853971e-01,   7.21644966e-15,   2.18970794e+00,
             4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.18970794e+00,   6.05071548e-15,  -5.94853971e-01,
+           -2.18970794e+00,   5.71764858e-15,  -5.94853971e-01,
             4.05146029e-01,   2.78456191e+00,  -4.05146029e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   6.88338275e-15,   8.80568256e-01,
-            2.38863487e-01,   8.71525074e-15,  -2.38863487e-01],
+           -8.80568256e-01,   6.68909372e-15,   8.80568256e-01,
+            2.38863487e-01,   8.49320614e-15,  -2.38863487e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   6.93889390e-15,  -7.61136513e-01,
+           -8.80568256e-01,   6.66133815e-15,  -7.61136513e-01,
             1.88056826e+00,   1.64170477e+00,  -1.88056826e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.61136513e-01,   8.45157277e-15,   8.80568256e-01,
-            1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00]]), 'FE1_C0_D01': array([[ -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00,
+            7.61136513e-01,   8.34055047e-15,   8.80568256e-01,
+            1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
+            3.18970794e+00,  -3.18970794e+00,   5.34053683e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
+            2.38863487e-01,  -2.38863487e-01,   4.42833521e-17],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00]]), 'FE2_C0_D01': array([[ -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   8.77076189e-15,  -5.94853971e-01,
-            3.18970794e+00,   1.22124533e-14,  -3.18970794e+00,
+         [  5.94853971e-01,   8.21565038e-15,  -5.94853971e-01,
+            3.18970794e+00,   1.15463195e-14,  -3.18970794e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   8.10462808e-15,   2.18970794e+00,
+         [  5.94853971e-01,   7.21644966e-15,   2.18970794e+00,
             4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.18970794e+00,   6.05071548e-15,  -5.94853971e-01,
+         [ -2.18970794e+00,   5.71764858e-15,  -5.94853971e-01,
             4.05146029e-01,   2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   6.88338275e-15,   8.80568256e-01,
-            2.38863487e-01,   8.71525074e-15,  -2.38863487e-01,
+         [ -8.80568256e-01,   6.68909372e-15,   8.80568256e-01,
+            2.38863487e-01,   8.49320614e-15,  -2.38863487e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   6.93889390e-15,  -7.61136513e-01,
+         [ -8.80568256e-01,   6.66133815e-15,  -7.61136513e-01,
             1.88056826e+00,   1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.61136513e-01,   8.45157277e-15,   8.80568256e-01,
+         [  7.61136513e-01,   8.34055047e-15,   8.80568256e-01,
             1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10128651,  0.79742699,  0.10128651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10128651,  0.10128651,  0.79742699,  0.        ,  0.        ,
+           0.        ],
+         [ 0.79742699,  0.10128651,  0.10128651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.47014206,  0.05971587,  0.47014206,  0.        ,  0.        ,
+           0.        ],
+         [ 0.47014206,  0.47014206,  0.05971587,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05971587,  0.47014206,  0.47014206,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333],
+         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.79742699,
+           0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.10128651,
+           0.79742699],
+         [ 0.        ,  0.        ,  0.        ,  0.79742699,  0.10128651,
+           0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.05971587,
+           0.47014206],
+         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.47014206,
+           0.05971587],
+         [ 0.        ,  0.        ,  0.        ,  0.05971587,  0.47014206,
+           0.47014206]]), 'FE2_C0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
@@ -2252,7 +1993,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
-            3.18970794e+00,  -3.18970794e+00,   1.86130332e-15,
+            3.18970794e+00,  -3.18970794e+00,   5.34053683e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
@@ -2264,74 +2005,107 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
-            2.38863487e-01,  -2.38863487e-01,   8.66091206e-16,
+            2.38863487e-01,  -2.38863487e-01,   4.42833521e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
             1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333],
-         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.79742699,
-           0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.10128651,
-           0.79742699],
-         [ 0.        ,  0.        ,  0.        ,  0.79742699,  0.10128651,
-           0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.05971587,
-           0.47014206],
-         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.47014206,
-           0.05971587],
-         [ 0.        ,  0.        ,  0.        ,  0.05971587,  0.47014206,
-           0.47014206]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10128651,  0.79742699,  0.10128651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10128651,  0.10128651,  0.79742699,  0.        ,  0.        ,
-           0.        ],
-         [ 0.79742699,  0.10128651,  0.10128651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.47014206,  0.05971587,  0.47014206,  0.        ,  0.        ,
-           0.        ],
-         [ 0.47014206,  0.47014206,  0.05971587,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05971587,  0.47014206,  0.47014206,  0.        ,  0.        ,
-           0.        ]])}
-  
-  name_map: {}
-  
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C1_D10': 'FE1_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE2': 'FE2', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE1_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
-           0.44444444],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.11111111, -0.11111111, -0.11111111,  0.44444444,
+           0.44444444,  0.44444444],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.08076859,  0.47435261, -0.08076859,  0.32307438,
+           0.04103583,  0.32307438],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.08076859, -0.08076859,  0.47435261,  0.32307438,
+           0.32307438,  0.04103583],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.47435261, -0.08076859, -0.08076859,  0.04103583,
+           0.32307438,  0.32307438],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02807494, -0.0525839 , -0.02807494,  0.11229977,
+           0.88413424,  0.11229977],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02807494, -0.02807494, -0.0525839 ,  0.11229977,
+           0.11229977,  0.88413424],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.0525839 , -0.02807494, -0.02807494,  0.88413424,
+           0.11229977,  0.11229977]]), 'FE2_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
+           0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
          [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
-           0.32307438],
+           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
          [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
-           0.04103583],
+           0.04103583,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
          [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
-           0.32307438],
+           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
          [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
-           0.11229977],
+           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
          [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
-           0.88413424],
+           0.88413424,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
          [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
-           0.11229977]]), 'FE0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE2': array([[ 1.],
+           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ]]), 'FE0': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE1_C0_D01': array([[ -3.33333333e-01,   3.33333333e-01,   1.33333333e+00,
+         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]])}
+  
+  name_map: {}
+  
+  inv_name_map: {'FE2_C1_D01': 'FE2_C1_D01', 'FE2_C1_D10': 'FE2_C1_D10', 'FE2_C0': 'FE2_C0', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C1_D10': 'FE1_C1_D10', 'FE2_C1': 'FE2_C1', 'FE2_C0_D01': 'FE2_C0_D01', 'FE0': 'FE0', 'FE2_C0_D10': 'FE2_C0_D10', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10'}
+  
+  QG-utils, psi_tables, unique_tables:
+  {'FE2_C0_D01': array([[ -3.33333333e-01,   3.33333333e-01,   1.33333333e+00,
             0.00000000e+00,  -1.33333333e+00],
          [  5.94853971e-01,  -5.94853971e-01,   3.18970794e+00,
-            1.22124533e-14,  -3.18970794e+00],
+            1.15463195e-14,  -3.18970794e+00],
          [  5.94853971e-01,   2.18970794e+00,   4.05146029e-01,
            -2.78456191e+00,  -4.05146029e-01],
          [ -2.18970794e+00,  -5.94853971e-01,   4.05146029e-01,
@@ -2341,22 +2115,47 @@ Compiler stage 2: Computing intermediate representation
          [ -8.80568256e-01,  -7.61136513e-01,   1.88056826e+00,
             1.64170477e+00,  -1.88056826e+00],
          [  7.61136513e-01,   8.80568256e-01,   1.88056826e+00,
-           -1.64170477e+00,  -1.88056826e+00]]), 'FE1_C0_D10': array([[-0.33333333,  0.33333333,  1.33333333, -1.33333333,  0.        ],
-         [ 0.59485397,  2.18970794,  0.40514603, -0.40514603, -2.78456191],
-         [ 0.59485397, -0.59485397,  3.18970794, -3.18970794,  0.        ],
-         [-2.18970794, -0.59485397,  0.40514603, -0.40514603,  2.78456191],
-         [-0.88056826, -0.76113651,  1.88056826, -1.88056826,  1.64170477],
-         [-0.88056826,  0.88056826,  0.23886349, -0.23886349,  0.        ],
-         [ 0.76113651,  0.88056826,  1.88056826, -1.88056826, -1.64170477]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333],
+           -1.64170477e+00,  -1.88056826e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333],
          [ 0.10128651,  0.79742699,  0.10128651],
          [ 0.10128651,  0.10128651,  0.79742699],
          [ 0.79742699,  0.10128651,  0.10128651],
          [ 0.47014206,  0.05971587,  0.47014206],
          [ 0.47014206,  0.47014206,  0.05971587],
-         [ 0.05971587,  0.47014206,  0.47014206]])}
+         [ 0.05971587,  0.47014206,  0.47014206]]), 'FE2_C0_D10': array([[-0.33333333,  0.33333333,  1.33333333, -1.33333333,  0.        ],
+         [ 0.59485397,  2.18970794,  0.40514603, -0.40514603, -2.78456191],
+         [ 0.59485397, -0.59485397,  3.18970794, -3.18970794,  0.        ],
+         [-2.18970794, -0.59485397,  0.40514603, -0.40514603,  2.78456191],
+         [-0.88056826, -0.76113651,  1.88056826, -1.88056826,  1.64170477],
+         [-0.88056826,  0.88056826,  0.23886349, -0.23886349,  0.        ],
+         [ 0.76113651,  0.88056826,  1.88056826, -1.88056826, -1.64170477]]), 'FE2_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
+           0.44444444],
+         [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
+           0.32307438],
+         [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
+           0.04103583],
+         [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
+           0.32307438],
+         [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
+           0.11229977],
+         [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
+           0.88413424],
+         [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
+           0.11229977]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C0_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE1_C0': ('FE1_C0', (6, [0, 1, 2, 3, 4, 5]), False, False), 'FE1_C1': ('FE1_C0', (9, [6, 7, 8, 9, 10, 11]), False, False), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE1_C1_D10': ('FE1_C0_D10', (11, [6, 7, 9, 10, 11]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2]), False, False), 'FE2': ('FE2', (), False, True), 'FE1_C1_D01': ('FE1_C0_D01', (10, [ [...]
+  {'FE2_C1_D01': ('FE2_C0_D01', (10, [6, 8, 9, 10, 11]), False, False), 'FE2_C1_D10': ('FE2_C0_D10', (11, [6, 7, 9, 10, 11]), False, False), 'FE2_C0': ('FE2_C0', (6, [0, 1, 2, 3, 4, 5]), False, False), 'FE1_C0': ('FE1_C0', (0, [0, 1, 2]), False, False), 'FE1_C1': ('FE1_C0', (3, [3, 4, 5]), False, False), 'FE1_C1_D01': ('FE1_C0_D01', (4, [3, 5]), False, False), 'FE1_C1_D10': ('FE1_C0_D01', (5, [3, 4]), False, False), 'FE2_C1': ('FE2_C0', (9, [6, 7, 8, 9, 10, 11]), False, False), 'FE2_C0_D [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -2401,248 +2200,63 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.260134 seconds.
+Compiler stage 2 finished in 0.376363 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.00521493 seconds.
+Compiler stage 3 finished in 0.00869703 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 3 element(s)
+  Generating code for 5 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: Y
   Removing unused variable: X
   Removing unused variable: C1
   Removing unused variable: C0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 3 dofmap(s)
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -2656,23 +2270,24 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.235484 seconds.
+Compiler stage 4 finished in 0.399085 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000846863 seconds.
+Compiler stage 4.1 finished in 0.00109982 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./TentativeVelocity.h.
-Compiler stage 5 finished in 0.000993013 seconds.
+Compiler stage 5 finished in 0.00154901 seconds.
 
-FFC finished in 0.527165 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.827913 seconds.
+Output written to ./TentativeVelocity.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form VelocityUpdate
 
@@ -2685,8 +2300,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Vector<2 x CG2(?)>'
-  Unique sub elements:       'Vector<2 x CG2(?)>, CG2(?)'
+  Unique elements:           'Vector<2 x CG2(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'Vector<2 x CG2(?)>, Vector<2 x CG1(?)>, CG2(?), CG1(?)
+                             '
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2698,9 +2314,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 0
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -2708,8 +2324,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    3
   Coefficients:              '[w_0, w_1, w_2]'
-  Unique elements:           'Vector<2 x CG2(?)>, R0(?), CG1(?)'
-  Unique sub elements:       'Vector<2 x CG2(?)>, R0(?), CG1(?), CG2(?)'
+  Unique elements:           'Vector<2 x CG2(?)>, R0(?), CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'Vector<2 x CG2(?)>, R0(?), CG1(?), Vector<2 x CG1(?)>,
+                              CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2724,15 +2341,21 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 3
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.0953648 seconds.
+Compiler stage 1 finished in 0.216867 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -2741,11 +2364,16 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 5 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -2758,7 +2386,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.00119 seconds
+  144 entries computed in 0.00134 seconds
   Shape of reference tensor: (12, 12)
   Primary multi index:   rank = 2 dims = [12, 12] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [...]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -2766,6 +2394,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 0 dims = [] indices = [[]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -2784,7 +2413,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  144 entries computed in 0.00154 seconds
+  144 entries computed in 0.00188 seconds
   Shape of reference tensor: (12, 1, 2, 3, 2)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 4 dims = [1, 2, 3, 2] indices = [[0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 0, 1, 1], [0, 0, 2, 0], [0, 0, 2, 1], [0, 1, 0, 0], [0, 1, 0, 1], [0, 1, 1, 0], [0, 1, 1, 1], [0, 1, 2, 0], [0, 1, 2, 1]]
@@ -2793,7 +2422,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.00108 seconds
+  144 entries computed in 0.00122 seconds
   Shape of reference tensor: (12, 12)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -2803,311 +2432,79 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.012553 seconds.
+Compiler stage 2 finished in 0.0197508 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000152111 seconds.
+Compiler stage 3 finished in 0.000216007 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
+  Generating code for 5 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: Y
   Removing unused variable: X
   Removing unused variable: C1
   Removing unused variable: C0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.255155 seconds.
+Compiler stage 4 finished in 0.392538 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.00066781 seconds.
+Compiler stage 4.1 finished in 0.000917912 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./VelocityUpdate.h.
-Compiler stage 5 finished in 0.00103593 seconds.
+Compiler stage 5 finished in 0.00131917 seconds.
 
-FFC finished in 0.365279 seconds.
+FFC finished in 0.63212 seconds.
+Output written to ./VelocityUpdate.h.
diff --git a/demo/documented/navier-stokes/cpp/documentation.rst b/demo/documented/navier-stokes/cpp/documentation.rst
index 1347638..169710d 100644
--- a/demo/documented/navier-stokes/cpp/documentation.rst
+++ b/demo/documented/navier-stokes/cpp/documentation.rst
@@ -204,7 +204,7 @@ We then load the mesh for the L-shaped domain from file:
 .. code-block:: c++
 
     // Load mesh from file
-    Mesh mesh("../lshape.xml.gz");
+    auto mesh = std::make_shared<Mesh>("../lshape.xml.gz");
 
 We next define a pair of function spaces :math:`V` and :math:`Q` for
 the velocity and pressure, and test and trial functions on these
@@ -213,8 +213,8 @@ spaces:
 .. code-block:: c++
 
     // Create function spaces
-    VelocityUpdate::FunctionSpace V(mesh);
-    PressureUpdate::FunctionSpace Q(mesh);
+    auto V = std::make_shared<VelocityUpdate::FunctionSpace>(mesh);
+    auto Q = std::make_shared<PressureUpdate::FunctionSpace>(mesh);
 
 The time step and the length of the interval are defined by:
 
@@ -230,10 +230,10 @@ below.
 
 .. code-block:: c++
 
-    // Define values for boundary conditions
-    InflowPressure p_in;
-    Constant zero(0);
-    Constant zero_vector(0, 0);
+   // Define values for boundary conditions
+   auto p_in = std::make_shared<InflowPressure>();
+   auto zero = std::make_shared<Constant>(0.0);
+   auto zero_vector = std::make_shared<Constant>(0.0, 0.0);
 
 Before we can define our boundary conditions, we also need to
 instantiate the classes we defined above for the boundary subdomains:
@@ -241,9 +241,9 @@ instantiate the classes we defined above for the boundary subdomains:
 .. code-block:: c++
 
     // Define subdomains for boundary conditions
-    NoslipDomain noslip_domain;
-    InflowDomain inflow_domain;
-    OutflowDomain outflow_domain;
+    auto noslip_domain = std::make_shared<NoslipDomain>();
+    auto inflow_domain = std::make_shared<InflowDomain>();
+    auto outflow_domain = std::make_shared<OutflowDomain>() ;
 
 We may now define the boundary conditions for the velocity and
 pressure. We define one no-slip boundary condition for the velocity
@@ -271,13 +271,13 @@ below:
 .. code-block:: c++
 
     // Create functions
-    Function u0(V);
-    Function u1(V);
-    Function p1(Q);
+    auto u0 = std::make_shared<Function>(V);
+    auto u1 = std::make_shared<Function>(V);
+    auto p1 = std::make_shared<Function>(Q);
 
     // Create coefficients
-    Constant k(dt);
-    Constant f(0, 0);
+    auto k = std::make_shared<Constant>(dt);
+    auto f = std::make_shared<Constant>(0, 0);
 
 The next step is now to define the variational problems for the three
 steps of Chorin's method. We do this by instantiating the classes
@@ -344,7 +344,7 @@ The time-stepping loop is now implemented as follows:
     while (t < T + DOLFIN_EPS)
     {
       // Update pressure boundary condition
-      p_in.t = t;
+      p_in->t = t;
 
 We remember to update the current time for the time-dependent pressure
 boundary value.
@@ -363,7 +363,7 @@ pressure equation if available:
     assemble(b1, L1);
     for (std::size_t i = 0; i < bcu.size(); i++)
       bcu[i]->apply(A1, b1);
-    solve(A1, *u1.vector(), b1, "gmres", "default");
+    solve(A1, *u1->vector(), b1, "gmres", "default");
     end();
 
     // Pressure correction
@@ -372,9 +372,9 @@ pressure equation if available:
     for (std::size_t i = 0; i < bcp.size(); i++)
     {
       bcp[i]->apply(A2, b2);
-      bcp[i]->apply(*p1.vector());
+      bcp[i]->apply(*p1->vector());
     }
-    solve(A2, *p1.vector(), b2, "bicgstab", prec);
+    solve(A2, *p1->vector(), b2, "bicgstab", prec);
     end();
 
     // Velocity correction
@@ -382,7 +382,7 @@ pressure equation if available:
     assemble(b3, L3);
     for (std::size_t i = 0; i < bcu.size(); i++)
       bcu[i]->apply(A3, b3);
-    solve(A3, *u1.vector(), b3, "gmres", "default");
+    solve(A3, *u1->vector(), b3, "gmres", "default");
     end();
 
 Note the use of ``begin`` and ``end``; these improve the readability
@@ -395,11 +395,11 @@ and update values for the next time step:
 .. code-block:: c++
 
     // Save to file
-    ufile << u1;
-    pfile << p1;
+    ufile << *u1;
+    pfile << *p1;
 
     // Move to next time step
-    u0 = u1;
+    *u0 = *u1;
     t += dt;
 
 Finally, we plot the solution and the program is finished:
diff --git a/demo/documented/navier-stokes/cpp/main.cpp b/demo/documented/navier-stokes/cpp/main.cpp
index f0c0c26..cd88a2c 100644
--- a/demo/documented/navier-stokes/cpp/main.cpp
+++ b/demo/documented/navier-stokes/cpp/main.cpp
@@ -78,25 +78,25 @@ int main()
   parameters["std_out_all_processes"] = false;
 
   // Load mesh from file
-  Mesh mesh("../lshape.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../lshape.xml.gz");
 
   // Create function spaces
-  VelocityUpdate::FunctionSpace V(mesh);
-  PressureUpdate::FunctionSpace Q(mesh);
+  auto V = std::make_shared<VelocityUpdate::FunctionSpace>(mesh);
+  auto Q = std::make_shared<PressureUpdate::FunctionSpace>(mesh);
 
   // Set parameter values
   double dt = 0.01;
   double T = 3;
 
   // Define values for boundary conditions
-  InflowPressure p_in;
-  Constant zero(0);
-  Constant zero_vector(0, 0);
+  auto p_in = std::make_shared<InflowPressure>();
+  auto zero = std::make_shared<Constant>(0.0);
+  auto zero_vector = std::make_shared<Constant>(0.0, 0.0);
 
   // Define subdomains for boundary conditions
-  NoslipDomain noslip_domain;
-  InflowDomain inflow_domain;
-  OutflowDomain outflow_domain;
+  auto noslip_domain = std::make_shared<NoslipDomain>();
+  auto inflow_domain = std::make_shared<InflowDomain>();
+  auto outflow_domain = std::make_shared<OutflowDomain>() ;
 
   // Define boundary conditions
   DirichletBC noslip(V, zero_vector, noslip_domain);
@@ -106,13 +106,13 @@ int main()
   std::vector<DirichletBC*> bcp = {{&inflow, &outflow}};
 
   // Create functions
-  Function u0(V);
-  Function u1(V);
-  Function p1(Q);
+  auto u0 = std::make_shared<Function>(V);
+  auto u1 = std::make_shared<Function>(V);
+  auto p1 = std::make_shared<Function>(Q);
 
   // Create coefficients
-  Constant k(dt);
-  Constant f(0, 0);
+  auto k = std::make_shared<Constant>(dt);
+  auto f = std::make_shared<Constant>(0, 0);
 
   // Create forms
   TentativeVelocity::BilinearForm a1(V, V);
@@ -148,14 +148,14 @@ int main()
   while (t < T + DOLFIN_EPS)
   {
     // Update pressure boundary condition
-    p_in.t = t;
+    p_in->t = t;
 
     // Compute tentative velocity step
     begin("Computing tentative velocity");
     assemble(b1, L1);
     for (std::size_t i = 0; i < bcu.size(); i++)
       bcu[i]->apply(A1, b1);
-    solve(A1, *u1.vector(), b1, "gmres", "default");
+    solve(A1, *u1->vector(), b1, "gmres", "default");
     end();
 
     // Pressure correction
@@ -164,9 +164,9 @@ int main()
     for (std::size_t i = 0; i < bcp.size(); i++)
     {
       bcp[i]->apply(A2, b2);
-      bcp[i]->apply(*p1.vector());
+      bcp[i]->apply(*p1->vector());
     }
-    solve(A2, *p1.vector(), b2, "bicgstab", prec);
+    solve(A2, *p1->vector(), b2, "bicgstab", prec);
     end();
 
     // Velocity correction
@@ -174,15 +174,15 @@ int main()
     assemble(b3, L3);
     for (std::size_t i = 0; i < bcu.size(); i++)
       bcu[i]->apply(A3, b3);
-    solve(A3, *u1.vector(), b3, "gmres", "default");
+    solve(A3, *u1->vector(), b3, "gmres", "default");
     end();
 
     // Save to file
-    ufile << u1;
-    pfile << p1;
+    ufile << *u1;
+    pfile << *p1;
 
     // Move to next time step
-    u0 = u1;
+    *u0 = *u1;
     t += dt;
     cout << "t = " << t << endl;
   }
diff --git a/demo/documented/navier-stokes/python/demo_navier-stokes.py b/demo/documented/navier-stokes/python/demo_navier-stokes.py
index 8597499..e0d9e32 100644
--- a/demo/documented/navier-stokes/python/demo_navier-stokes.py
+++ b/demo/documented/navier-stokes/python/demo_navier-stokes.py
@@ -50,7 +50,7 @@ T = 3
 nu = 0.01
 
 # Define time-dependent pressure boundary condition
-p_in = Expression("sin(3.0*t)", t=0.0)
+p_in = Expression("sin(3.0*t)", t=0.0, degree=2)
 
 # Define boundary conditions
 noslip  = DirichletBC(V, (0, 0),
diff --git a/demo/documented/navier-stokes/python/documentation.rst b/demo/documented/navier-stokes/python/documentation.rst
index 6b714f2..106fce0 100644
--- a/demo/documented/navier-stokes/python/documentation.rst
+++ b/demo/documented/navier-stokes/python/documentation.rst
@@ -70,7 +70,7 @@ class:
 .. code-block:: python
 
     # Define time-dependent pressure boundary condition
-    p_in = Expression("sin(3.0*t)", t=0.0)
+    p_in = Expression("sin(3.0*t)", t=0.0, degree=2)
 
 Note that the variable ``t`` is not automatically updated during
 time-stepping, so we must remember to manually update the value of the
diff --git a/demo/documented/neumann-poisson/cpp/CMakeLists.txt b/demo/documented/neumann-poisson/cpp/CMakeLists.txt
index 6678e06..fa2d66f 100644
--- a/demo/documented/neumann-poisson/cpp/CMakeLists.txt
+++ b/demo/documented/neumann-poisson/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/neumann-poisson/cpp/Poisson.h b/demo/documented/neumann-poisson/cpp/Poisson.h
index 09c766a..c7f3277 100644
--- a/demo/documented/neumann-poisson/cpp/Poisson.h
+++ b/demo/documented/neumann-poisson/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,416 +902,141 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_1()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 1;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t space_dimension() const final override
   {
-    return 0;
+    return 6;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
+    switch (i)
     {
-    return ;
+    case 0:
+      {
+        return 2;
+        break;
+      }
     }
     
+    return 0;
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  std::size_t value_size() const final override
   {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
+    return 2;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  std::size_t reference_value_rank() const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    return 1;
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
     switch (i)
     {
     case 0:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 2;
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new poisson_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class poisson_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  poisson_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "MixedElement(FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None), **{'value_shape': (2,) })";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t reference_value_size() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 4;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1317,8 +1045,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1417,79 +1145,137 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[1] = {0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
+    case 4:
       {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
     {
       num_derivatives *= 2;
     } // end loop over 'r'
@@ -1503,7 +1289,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1515,7 +1301,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1524,8 +1310,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1977,23 +1763,33 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[1] = {0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[1][1] = \
-      {{0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[1][1] = \
-      {{0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -2004,20 +1800,24 @@ public:
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[1][1] = \
-      {{1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[1][1] = \
-      {{1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 1; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 1; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2032,9 +1832,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 1; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 1; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2044,11 +1844,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 1; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 1; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 1; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2058,11 +1858,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 1; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 1; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 1; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2071,9 +1871,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 1; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 1; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2090,127 +1890,1804 @@ public:
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
+    case 4:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~poisson_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Real', triangle, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Real";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_2();
+  }
+
+};
+
+
+class poisson_finite_element_3: public ufc::finite_element
+{
+public:
+
+  poisson_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~poisson_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "MixedElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Real', triangle, 0))";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 4;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[1][1] = \
+      {{0.0}};
+      
+      static const double dmats1[1][1] = \
+      {{0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[1][1] = \
+      {{1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[1][1] = \
+      {{1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 1; t++)
+        {
+          for (unsigned int u = 0; u < 1; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 1; t++)
+          {
+            for (unsigned int u = 0; u < 1; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 1; t++)
+          {
+            for (unsigned int u = 0; u < 1; u++)
+            {
+              for (unsigned int tu = 0; tu < 1; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 1; t++)
+          {
+            for (unsigned int u = 0; u < 1; u++)
+            {
+              for (unsigned int tu = 0; tu < 1; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 1; s++)
+        {
+          for (unsigned int t = 0; t < 1; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -2220,130 +3697,311 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[3];
+    vertex_values[5] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_2();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_3();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
   {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[1];
+    return 2;
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[3];
-    vertex_values[3] = dof_values[3];
-    vertex_values[5] = dof_values[3];
+    return num_global_entities[0];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t num_element_dofs() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    return 3;
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  std::size_t num_facet_dofs() const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 2;
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
-    return 2;
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    switch (i)
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
     {
     case 0:
       {
-        return new poisson_finite_element_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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        return new poisson_finite_element_1();
+        
+        break;
+      }
+    case 2:
+      {
+        
         break;
       }
     }
     
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    return new poisson_finite_element_2();
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2367,45 +4025,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
@@ -2423,19 +4070,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2443,27 +4094,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2484,16 +4140,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -2514,65 +4173,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new poisson_dofmap_0();
+    return new poisson_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_1: public ufc::dofmap
+class poisson_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_1() : ufc::dofmap()
+  poisson_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_1()
+  ~poisson_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2596,39 +4249,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2652,17 +4294,15 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     dofs[0] = 0;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2685,9 +4325,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2720,61 +4359,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new poisson_dofmap_1();
+    return new poisson_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_2: public ufc::dofmap
+class poisson_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_2() : ufc::dofmap()
+  poisson_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_2()
+  ~poisson_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None), **{'value_shape': (2,) })";
+    return "FFC dofmap for MixedElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Real', triangle, 0))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2798,39 +4421,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2854,23 +4466,21 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
     dofs[3] = offset;
     offset += 1;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2896,9 +4506,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2954,28 +4563,13 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2986,7 +4580,7 @@ public:
       }
     case 1:
       {
-        return new poisson_dofmap_1();
+        return new poisson_dofmap_2();
         break;
       }
     }
@@ -2994,46 +4588,38 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new poisson_dofmap_2();
+    return new poisson_dofmap_3();
   }
 
 };
 
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  ~poisson_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
@@ -3042,7 +4628,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3081,38 +4667,31 @@ public:
 
 };
 
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
+  ~poisson_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -3121,7 +4700,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3145,39 +4724,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class poisson_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   poisson_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_exterior_facet_integral_1_otherwise()
+  ~poisson_exterior_facet_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -3186,7 +4758,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3199,8 +4771,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -3242,77 +4814,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_0()
+  ~poisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "ab5b92e57285149e7dae775675f2adddeb270be6239474bf5e8897257c9290d545b2c01c5149042b7ba4c55b366c36415bc21a513e9eff7797cdb9832dacf407";
+    return "eaae3dd9e225aa6c2f4e9860e74a750b8642f50564cc99eaf2f8c9a460ab46909e3dc9deedada0dd570804c1af737f72fbfae1a3a4c7dfaf795ab5b4fcd54641";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson_finite_element_2();
+        return new poisson_finite_element_3();
         break;
       }
     case 1:
       {
-        return new poisson_finite_element_2();
+        return new poisson_finite_element_3();
         break;
       }
     }
@@ -3320,19 +4884,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson_dofmap_2();
+        return new poisson_dofmap_3();
         break;
       }
     case 1:
       {
-        return new poisson_dofmap_2();
+        return new poisson_dofmap_3();
         break;
       }
     }
@@ -3340,198 +4903,226 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new poisson_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "8dffab5ca03d88f238b849afb117dc3a0993c035e49a39ab86a5f2e0aebe3a5af15bb72005b3cf959fc758ed28ceca8f419e694176254999f9d08ab778ebc188";
+    return "9d3730008097ab7d4a43fc3ea58eebb01145004464ff7374b0e9a0c5d708f28b72f719bada3e1a3b0cd722a693bc756a230631188603b4a53db6b082f954d4c8";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson_finite_element_2();
+        return new poisson_finite_element_3();
         break;
       }
     case 1:
@@ -3549,14 +5140,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson_dofmap_2();
+        return new poisson_dofmap_3();
         break;
       }
     case 1:
@@ -3574,126 +5164,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new poisson_exterior_facet_integral_1_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -3707,14 +5333,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -3723,43 +5355,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -3770,43 +5379,20 @@ class CoefficientSpace_g: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -3817,43 +5403,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -3864,63 +5427,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -3928,7 +5498,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -3958,57 +5528,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_g Form_L_FunctionSpace_2;
@@ -4018,73 +5643,118 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
     this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
-    this->g = *g;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+    else if (name == "g")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    case 1:
+      return "g";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner g;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
-    this->g = g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
-    this->g = *g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+    this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -4120,20 +5790,26 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner g;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner g;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/neumann-poisson/cpp/compile.log b/demo/documented/neumann-poisson/cpp/compile.log
index e4e3aa6..2fc2be1 100644
--- a/demo/documented/neumann-poisson/cpp/compile.log
+++ b/demo/documented/neumann-poisson/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,8 +13,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Mixed<CG1(?), R0(?)>'
-  Unique sub elements:       'Mixed<CG1(?), R0(?)>, CG1(?), R0(?)'
+  Unique elements:           'Mixed<CG1(?), R0(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'Mixed<CG1(?), R0(?)>, Vector<2 x CG1(?)>, CG1(?), R0(?
+                             )'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -30,9 +32,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -41,8 +43,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              2
   Coefficients:                        '[w_0, w_1]'
-  Unique elements:                     'Mixed<CG1(?), R0(?)>, CG1(?)'
-  Unique sub elements:                 'Mixed<CG1(?), R0(?)>, CG1(?), R0(?)'
+  Unique elements:                     'Mixed<CG1(?), R0(?)>, CG1(?), Vector<2 x CG1
+                                       (?)>'
+  Unique sub elements:                 'Mixed<CG1(?), R0(?)>, CG1(?), Vector<2 x CG1
+                                       (?)>, R0(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -51,9 +55,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -61,24 +65,34 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.050034 seconds.
+Compiler stage 1 finished in 0.0928741 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 3 elements
+  Computing representation of 4 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 4 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -98,7 +112,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  16 entries computed in 0.000795 seconds
+  16 entries computed in 0.000893 seconds
   Shape of reference tensor: (4, 4)
   Primary multi index:   rank = 2 dims = [4, 4] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -107,7 +121,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  64 entries computed in 0.000886 seconds
+  64 entries computed in 0.00103 seconds
   Shape of reference tensor: (4, 4, 2, 2)
   Primary multi index:   rank = 2 dims = [4, 4] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -116,7 +130,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Precomputing integrals on reference element
   Reusing element from cache
-  16 entries computed in 0.000749 seconds
+  16 entries computed in 0.000824 seconds
   Shape of reference tensor: (4, 4)
   Primary multi index:   rank = 2 dims = [4, 4] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -124,6 +138,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 0 dims = [] indices = [[]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -133,7 +148,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  12 entries computed in 0.000959 seconds
+  12 entries computed in 0.00107 seconds
   Shape of reference tensor: (4, 3)
   Primary multi index:   rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -142,6 +157,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -151,7 +167,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  12 entries computed in 0.00136 seconds
+  12 entries computed in 0.00164 seconds
   Shape of reference tensor: (4, 3)
   Primary multi index:   rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -161,7 +177,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  12 entries computed in 0.00126 seconds
+  12 entries computed in 0.00153 seconds
   Shape of reference tensor: (4, 3)
   Primary multi index:   rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -171,7 +187,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  12 entries computed in 0.00126 seconds
+  12 entries computed in 0.0015 seconds
   Shape of reference tensor: (4, 3)
   Primary multi index:   rank = 1 dims = [4] indices = [[0], [1], [2], [3]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -180,161 +196,97 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.017879 seconds.
+Compiler stage 2 finished in 0.0259519 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000172853 seconds.
+Compiler stage 3 finished in 0.000240803 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 3 element(s)
+  Generating code for 4 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: Y
   Removing unused variable: X
   Removing unused variable: C1
   Removing unused variable: C0
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 3 dofmap(s)
+  Generating code for 4 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.084744 seconds.
+Compiler stage 4 finished in 0.166009 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000625849 seconds.
+Compiler stage 4.1 finished in 0.000943899 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000748873 seconds.
+Compiler stage 5 finished in 0.00105309 seconds.
 
-FFC finished in 0.154546 seconds.
+FFC finished in 0.287588 seconds.
+Output written to ./Poisson.h.
diff --git a/demo/documented/neumann-poisson/cpp/main.cpp b/demo/documented/neumann-poisson/cpp/main.cpp
index f373adc..68ae4aa 100644
--- a/demo/documented/neumann-poisson/cpp/main.cpp
+++ b/demo/documented/neumann-poisson/cpp/main.cpp
@@ -70,25 +70,26 @@ class Flux : public Expression
 int main()
 {
   // Create mesh and function space
-  UnitSquareMesh mesh(64, 64);
-  Poisson::FunctionSpace V(mesh);
+  auto mesh = std::make_shared<UnitSquareMesh>(64, 64);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
 
   // Define variational problem
-  Poisson::BilinearForm a(V, V);
-  Poisson::LinearForm L(V);
-  Source f;
-  Flux g;
-  L.f = f;
-  L.g = g;
-  Function w(V);
-  LinearVariationalProblem problem(a, L, w);
+  auto a = std::make_shared<Poisson::BilinearForm>(V, V);
+  auto L = std::make_shared<Poisson::LinearForm>(V);
+  auto f = std::make_shared<Source>();
+  auto g = std::make_shared<Flux>();
+  L->f = f;
+  L->g = g;
+  auto w = std::make_shared<Function>(V);
+  std::vector<std::shared_ptr<const DirichletBC>> bcs;
+  auto problem = std::make_shared<LinearVariationalProblem>(a, L, w, bcs);
 
   // Compute solution
   LinearVariationalSolver solver(problem);
   solver.solve();
 
   // Extract subfunction
-  Function u = w[0];
+  Function u = (*w)[0];
 
   // Plot solution
   plot(u);
diff --git a/demo/documented/neumann-poisson/python/demo_neumann-poisson.py b/demo/documented/neumann-poisson/python/demo_neumann-poisson.py
index ac37eac..680daf8 100644
--- a/demo/documented/neumann-poisson/python/demo_neumann-poisson.py
+++ b/demo/documented/neumann-poisson/python/demo_neumann-poisson.py
@@ -47,17 +47,19 @@ and the above constraint.
 
 from dolfin import *
 
-# Create mesh and define function space
+# Create mesh
 mesh = UnitSquareMesh(64, 64)
-V = FunctionSpace(mesh, "CG", 1)
-R = FunctionSpace(mesh, "R", 0)
-W = V * R
+
+# Build function space with Lagrange multiplier
+P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+R = FiniteElement("Real", mesh.ufl_cell(), 0)
+W = FunctionSpace(mesh, P1 * R)
 
 # Define variational problem
 (u, c) = TrialFunction(W)
 (v, d) = TestFunctions(W)
-f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-g = Expression("-sin(5*x[0])")
+f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+g = Expression("-sin(5*x[0])", degree=2)
 a = (inner(grad(u), grad(v)) + c*v + u*d)*dx
 L = f*v*dx + g*v*ds
 
diff --git a/demo/documented/neumann-poisson/python/documentation.rst b/demo/documented/neumann-poisson/python/documentation.rst
index f17b2f2..a534508 100644
--- a/demo/documented/neumann-poisson/python/documentation.rst
+++ b/demo/documented/neumann-poisson/python/documentation.rst
@@ -32,31 +32,21 @@ triangles, we do as follows:
 
 .. code-block:: python
 
-	# Create mesh
-	mesh = UnitSquareMesh(64, 64)
+    # Create mesh
+    mesh = UnitSquareMesh(64, 64)
 
-Next, we need to define the function spaces. We define the two
-function spaces :math:`V` and :math:`R` separately, before combining
-these into a mixed function space :math:`W`:
+Next, we need to define the function space.
 
 .. code-block:: python
 
-	# Define function spaces and mixed (product) space
-	V = FunctionSpace(mesh, "CG", 1)
-	R = FunctionSpace(mesh, "R", 0)
-	W = V * R
+    # Build function space with Lagrange multiplier
+    P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    R = FiniteElement("Real", mesh.ufl_cell(), 0)
+    W = FunctionSpace(mesh, P1 * R)
 
 The second argument to :py:class:`FunctionSpace
-<dolfin.functions.functionspace.FunctionSpace>` specifies the type of
-finite element family, while the third argument specifies the
-polynomial degree.  The UFL user manual contains a list of all
-available finite element families and more details.  The * operator
-creates a mixed (product) space :math:`W` from the two separate spaces
-:math:`V` and :math:`R`.  Hence,
-
-.. math::
-
-	W = \{ (v, d) \ \text{such that} \ v \in V, d \in R \}.
+<dolfin.functions.functionspace.FunctionSpace>` specifies underlying
+finite element, here mixed element obtained by ``*`` operator.
 
 Now, we want to define the variational problem, but first we need to
 specify the trial functions (the unknowns) and the test functions.
@@ -75,13 +65,13 @@ problem:
 
 .. code-block:: python
 
-	# Define variational problem
-	(u, c) = TrialFunction(W)
-	(v, d) = TestFunctions(W)
-	f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-	g = Expression("-sin(5*x[0])")
-	a = (inner(grad(u), grad(v)) + c*v + u*d)*dx
-	L = f*v*dx + g*v*ds
+    # Define variational problem
+    (u, c) = TrialFunction(W)
+    (v, d) = TestFunctions(W)
+    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+    g = Expression("-sin(5*x[0])", degree=2)
+    a = (inner(grad(u), grad(v)) + c*v + u*d)*dx
+    L = f*v*dx + g*v*ds
 
 Since we have natural (Neumann) boundary conditions in this problem,
 we don´t have to implement boundary conditions.  This is because
@@ -100,13 +90,13 @@ function.  Finally, we plot the solutions to examine the result.
 
 .. code-block:: python
 
-	# Compute solution
-	w = Function(W)
-	solve(a == L, w)
-	(u, c) = w.split()
+    # Compute solution
+    w = Function(W)
+    solve(a == L, w)
+    (u, c) = w.split()
 
-	# Plot solution
-	plot(u, interactive=True)
+    # Plot solution
+    plot(u, interactive=True)
 
 Complete code
 -------------
diff --git a/demo/documented/nonlinear-poisson/cpp/CMakeLists.txt b/demo/documented/nonlinear-poisson/cpp/CMakeLists.txt
index 514ffe7..925459a 100644
--- a/demo/documented/nonlinear-poisson/cpp/CMakeLists.txt
+++ b/demo/documented/nonlinear-poisson/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/nonlinear-poisson/cpp/NonlinearPoisson.h b/demo/documented/nonlinear-poisson/cpp/NonlinearPoisson.h
index 02b77ed..6b7bf8c 100644
--- a/demo/documented/nonlinear-poisson/cpp/NonlinearPoisson.h
+++ b/demo/documented/nonlinear-poisson/cpp/NonlinearPoisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __NONLINEARPOISSON_H
 #define __NONLINEARPOISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class nonlinearpoisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   nonlinearpoisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nonlinearpoisson_finite_element_0()
+  ~nonlinearpoisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +902,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new nonlinearpoisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class nonlinearpoisson_dofmap_0: public ufc::dofmap
+class nonlinearpoisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  nonlinearpoisson_dofmap_0() : ufc::dofmap()
+  nonlinearpoisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nonlinearpoisson_dofmap_0()
+  ~nonlinearpoisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -1041,238 +989,1933 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    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;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new nonlinearpoisson_dofmap_0();
-  }
-
-};
-
-/// 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 nonlinearpoisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  nonlinearpoisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~nonlinearpoisson_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({true, true});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute cell volume
-    
-    
-    // Compute circumradius of triangle in 2D
-    
-    
-    // Array of quadrature weights.
-    static const double W3[3] = {0.166666666666667, 0.166666666666667, 0.166666666666667};
-    // Quadrature points on the UFC reference element: (0.166666666666667, 0.166666666666667), (0.166666666666667, 0.666666666666667), (0.666666666666667, 0.166666666666667)
-    
-    // Values of basis functions at quadrature points.
-    static const double FE0[3][3] = \
-    {{0.666666666666667, 0.166666666666667, 0.166666666666667},
-    {0.166666666666667, 0.166666666666667, 0.666666666666667},
-    {0.166666666666667, 0.666666666666667, 0.166666666666667}};
-    
-    static const double FE0_D01[3][2] = \
-    {{-1.0, 1.0},
-    {-1.0, 1.0},
-    {-1.0, 1.0}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc0[2] = {0, 2};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc1[2] = {0, 1};
     
-    // Reset values in the element tensor.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      A[r] = 0.0;
-    } // end loop over 'r'
-    // Number of operations to compute geometry constants: 12.
-    double G[3];
-    G[0] = det*(K[0]*K[2] + K[1]*K[3]);
-    G[1] = det*(K[2]*K[2] + K[3]*K[3]);
-    G[2] = det*(K[0]*K[0] + K[1]*K[1]);
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Compute element tensor using UFL quadrature representation
-    // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
-    // Loop quadrature points for integral.
-    // Number of operations to compute element tensor for following IP loop = 168
-    for (unsigned int ip = 0; ip < 3; ip++)
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
     {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Coefficient declarations.
-      double F0 = 0.0;
-      double F1 = 0.0;
-      double F2 = 0.0;
-      double F3 = 0.0;
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Total number of operations to compute function values = 8
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        F1 += FE0_D01[ip][r]*w[1][nzc1[r]];
-        F2 += FE0_D01[ip][r]*w[1][nzc0[r]];
-      } // end loop over 'r'
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
-      // Total number of operations to compute function values = 12
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
-        F0 += FE0[ip][r]*w[0][r];
-        F3 += FE0[ip][r]*w[1][r];
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new nonlinearpoisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new nonlinearpoisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new nonlinearpoisson_finite_element_1();
+  }
+
+};
+
+
+class nonlinearpoisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  nonlinearpoisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~nonlinearpoisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new nonlinearpoisson_dofmap_0();
+  }
+
+};
+
+
+class nonlinearpoisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  nonlinearpoisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~nonlinearpoisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new nonlinearpoisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new nonlinearpoisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new nonlinearpoisson_dofmap_1();
+  }
+
+};
+
+
+class nonlinearpoisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  nonlinearpoisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~nonlinearpoisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true, true});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute cell volume
+    
+    
+    // Compute circumradius of triangle in 2D
+    
+    
+    // Array of quadrature weights.
+    static const double W3[3] = {0.166666666666667, 0.166666666666667, 0.166666666666667};
+    // Quadrature points on the UFC reference element: (0.166666666666667, 0.166666666666667), (0.166666666666667, 0.666666666666667), (0.666666666666667, 0.166666666666667)
+    
+    // Values of basis functions at quadrature points.
+    static const double FE0[3][3] = \
+    {{0.666666666666667, 0.166666666666667, 0.166666666666667},
+    {0.166666666666667, 0.166666666666667, 0.666666666666667},
+    {0.166666666666667, 0.666666666666667, 0.166666666666667}};
+    
+    static const double FE0_D01[3][2] = \
+    {{-1.0, 1.0},
+    {-1.0, 1.0},
+    {-1.0, 1.0}};
+    
+    // Array of non-zero columns
+    static const unsigned int nzc0[2] = {0, 2};
+    
+    // Array of non-zero columns
+    static const unsigned int nzc1[2] = {0, 1};
+    
+    // Reset values in the element tensor.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      A[r] = 0.0;
+    } // end loop over 'r'
+    // Number of operations to compute geometry constants: 12.
+    double G[3];
+    G[0] = det*(K[0]*K[2] + K[1]*K[3]);
+    G[1] = det*(K[2]*K[2] + K[3]*K[3]);
+    G[2] = det*(K[0]*K[0] + K[1]*K[1]);
+    
+    // Compute element tensor using UFL quadrature representation
+    // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
+    
+    // Loop quadrature points for integral.
+    // Number of operations to compute element tensor for following IP loop = 168
+    for (unsigned int ip = 0; ip < 3; ip++)
+    {
+      
+      // Coefficient declarations.
+      double F0 = 0.0;
+      double F1 = 0.0;
+      double F2 = 0.0;
+      double F3 = 0.0;
+      
+      // Total number of operations to compute function values = 8
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        F1 += FE0_D01[ip][r]*w[1][nzc1[r]];
+        F2 += FE0_D01[ip][r]*w[1][nzc0[r]];
+      } // end loop over 'r'
+      
+      // Total number of operations to compute function values = 12
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        F0 += FE0[ip][r]*w[0][r];
+        F3 += FE0[ip][r]*w[1][r];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 22
@@ -1307,42 +2950,35 @@ public:
 
 };
 
-/// 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 nonlinearpoisson_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   nonlinearpoisson_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~nonlinearpoisson_cell_integral_1_otherwise()
+  ~nonlinearpoisson_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1469,66 +3105,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class nonlinearpoisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   nonlinearpoisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nonlinearpoisson_form_0()
+  ~nonlinearpoisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "4e254acd3cd2071bdbc7e45278ef6da930eb5ac7d1c00862705a137688b598378f18cee7224b62058e785c39fd06fd24a4eeba96e5f1761a611b42dd7ab8aec7";
+    return "18d8e01864ab83fcefd75bc641341e12f4d551faf81e7b3dd607626b4da452bb5880967de7eb4c4f8e5c1698cd330d75d654359d0c322672a71fe5f148ce636f";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new nonlinearpoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new nonlinearpoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1552,8 +3180,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1577,192 +3204,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new nonlinearpoisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class nonlinearpoisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   nonlinearpoisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~nonlinearpoisson_form_1()
+  ~nonlinearpoisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
+  {
+    return "451f3352d80aae7e38ffee0ade5ef310294f37d55e4835420402ae1fde8a5ff1f0ec35b8e2935849f036015e10a4cfc43cef7f4179d704edb456b1b18f1a461e";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_coefficients() const final override
   {
-    return "4f3d1b87b53a5ab3ccc22024a4b9db5605ed8a8ee97bf3374ec4be1a8e10710c614d337865a6727d4663c9a415c7eb73796360b388952165e4184cbbc46a4519";
+    return 1;
   }
 
+  std::size_t original_coefficient_position(std::size_t i) const final override
+  {
+    static const std::vector<std::size_t> position({1});
+    return position[i];
+  }
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  ufc::finite_element * create_coordinate_finite_element() const final override
   {
-    return 2;
+    return new nonlinearpoisson_finite_element_1();
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  ufc::dofmap * create_coordinate_dofmap() const final override
   {
-    return 1;
-  }
+    return new nonlinearpoisson_dofmap_1();
+   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
   {
-    static const std::vector<std::size_t> position({1});
-    return position[i];
+    return nullptr;
   }
 
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1786,8 +3441,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1811,126 +3465,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new nonlinearpoisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1944,14 +3634,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace NonlinearPoisson
 {
@@ -1960,43 +3656,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2007,43 +3680,20 @@ class CoefficientSpace_u: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2054,45 +3704,42 @@ class Form_F_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_F_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_F_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_F_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -2106,73 +3753,118 @@ class Form_F: public dolfin::Form
 public:
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), f(*this, 0), u(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_0());
+    _ufc_form = std::make_shared<const nonlinearpoisson_form_0>();
   }
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& u):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> u):
     dolfin::Form(1, 2), f(*this, 0), u(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
     this->u = u;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_0());
+    _ufc_form = std::make_shared<const nonlinearpoisson_form_0>();
   }
 
-  // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 2), f(*this, 0), u(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_F()
+  {}
 
-    this->f = *f;
-    this->u = *u;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+    else if (name == "u")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), f(*this, 0), u(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    case 1:
+      return "u";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_F_FunctionSpace_1 CoefficientSpace_f;
+  typedef Form_F_FunctionSpace_2 CoefficientSpace_u;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner u;
+};
+
+class MultiMeshForm_F: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& u):
-    dolfin::Form(1, 2), f(*this, 0), u(*this, 1)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0), u(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
-    this->u = u;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_0());
   }
 
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 2), f(*this, 0), u(*this, 1)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> u):
+    dolfin::MultiMeshForm(V0), f(*this, 0), u(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
-    this->u = *u;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+    this->u = u;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_0());
   }
 
   // Destructor
-  ~Form_F()
+  ~MultiMeshForm_F()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2208,55 +3900,33 @@ public:
 
   // Typedefs
   typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_F_FunctionSpace_1 CoefficientSpace_f;
   typedef Form_F_FunctionSpace_2 CoefficientSpace_u;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner u;
 };
 
 class Form_J_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2267,45 +3937,62 @@ class Form_J_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<nonlinearpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<nonlinearpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_J_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new nonlinearpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new nonlinearpoisson_dofmap_0()), *mesh, constrained_domain)))
+};
+
+class Form_J_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -2317,75 +4004,114 @@ class Form_J: public dolfin::Form
 public:
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 1), u(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_1());
+    _ufc_form = std::make_shared<const nonlinearpoisson_form_1>();
   }
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
     dolfin::Form(2, 1), u(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->u = u;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_1());
+    _ufc_form = std::make_shared<const nonlinearpoisson_form_1>();
   }
 
-  // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(2, 1), u(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_J()
+  {}
 
-    this->u = *u;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "u")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 1), u(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "u";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_J_FunctionSpace_0 TestSpace;
+  typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+};
+
+class MultiMeshForm_J: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u):
-    dolfin::Form(2, 1), u(*this, 0)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->u = u;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_1());
   }
 
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(2, 1), u(*this, 0)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->u = *u;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->u = u;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new nonlinearpoisson_form_1());
   }
 
   // Destructor
-  ~Form_J()
+  ~MultiMeshForm_J()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2418,18 +4144,25 @@ public:
   // Typedefs
   typedef Form_J_FunctionSpace_0 TestSpace;
   typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner u;
 };
 
 // Class typedefs
 typedef Form_J BilinearForm;
+typedef MultiMeshForm_J MultiMeshBilinearForm;
 typedef Form_J JacobianForm;
+typedef MultiMeshForm_J MultiMeshJacobianForm;
 typedef Form_F LinearForm;
+typedef MultiMeshForm_F MultiMeshLinearForm;
 typedef Form_F ResidualForm;
+typedef MultiMeshForm_F MultiMeshResidualForm;
 typedef Form_F::TestSpace FunctionSpace;
+typedef Form_F::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/nonlinear-poisson/cpp/compile.log b/demo/documented/nonlinear-poisson/cpp/compile.log
index 3fb831e..544213c 100644
--- a/demo/documented/nonlinear-poisson/cpp/compile.log
+++ b/demo/documented/nonlinear-poisson/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form NonlinearPoisson
 
@@ -12,8 +13,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    2
   Coefficients:              '[w_0, w_1]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -26,9 +27,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 5
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -36,8 +37,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    1
   Coefficients:              '[w_1]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -53,18 +54,26 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0546479 seconds.
+Compiler stage 1 finished in 0.099508 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
@@ -75,13 +84,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
-         [ 1.,  1.,  1.],
-         [ 0.,  0.,  0.]]), (0, 0): array([[ 0.66666667,  0.16666667,  0.16666667],
-         [ 0.16666667,  0.16666667,  0.66666667],
-         [ 0.16666667,  0.66666667,  0.16666667]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -129,7 +132,13 @@ Compiler stage 2: Computing intermediate representation
           [ 0.16666667,  0.16666667,  0.66666667]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667]]])}}}}}
+          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
+         [ 1.,  1.,  1.],
+         [ 0.,  0.,  0.]]), (0, 0): array([[ 0.66666667,  0.16666667,  0.16666667],
+         [ 0.16666667,  0.16666667,  0.66666667],
+         [ 0.16666667,  0.66666667,  0.16666667]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_D10': array([[-1.,  1.,  0.],
@@ -234,15 +243,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
-         [ 1.,  1.,  1.],
-         [ 0.,  0.,  0.]]), (0, 0): array([[ 0.66666667,  0.16666667,  0.16666667],
-         [ 0.16666667,  0.16666667,  0.66666667],
-         [ 0.16666667,  0.66666667,  0.16666667]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -290,7 +294,13 @@ Compiler stage 2: Computing intermediate representation
           [ 0.16666667,  0.16666667,  0.66666667]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667]]])}}}}}
+          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
+         [ 1.,  1.,  1.],
+         [ 0.,  0.,  0.]]), (0, 0): array([[ 0.66666667,  0.16666667,  0.16666667],
+         [ 0.16666667,  0.16666667,  0.66666667],
+         [ 0.16666667,  0.66666667,  0.16666667]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_D10': array([[-1.,  1.,  0.],
@@ -399,67 +409,56 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0566361 seconds.
+Compiler stage 2 finished in 0.0713391 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.00832796 seconds.
+Compiler stage 3 finished in 0.0106699 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -473,18 +472,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.0492339 seconds.
+Compiler stage 4 finished in 0.141625 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000843048 seconds.
+Compiler stage 4.1 finished in 0.000977993 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./NonlinearPoisson.h.
-Compiler stage 5 finished in 0.000712872 seconds.
+Compiler stage 5 finished in 0.000804901 seconds.
 
-FFC finished in 0.170778 seconds.
+FFC finished in 0.325425 seconds.
+Output written to ./NonlinearPoisson.h.
diff --git a/demo/documented/nonlinear-poisson/cpp/main.cpp b/demo/documented/nonlinear-poisson/cpp/main.cpp
index d7650a6..46d52e4 100644
--- a/demo/documented/nonlinear-poisson/cpp/main.cpp
+++ b/demo/documented/nonlinear-poisson/cpp/main.cpp
@@ -69,17 +69,17 @@ class DirichletBoundary : public SubDomain
 int main()
 {
   // Create mesh and define function space
-  UnitSquareMesh mesh(16, 16);
-  NonlinearPoisson::FunctionSpace V(mesh);
+  auto mesh = std::make_shared<UnitSquareMesh>(16, 16);
+  auto V = std::make_shared<NonlinearPoisson::FunctionSpace>(mesh);
 
   // Define boundary condition
-  DirichletBoundary dirichlet_boundary;
-  Constant g(1.0);
+  auto dirichlet_boundary = std::make_shared<DirichletBoundary>();
+  auto g = std::make_shared<Constant>(1.0);
   DirichletBC bc(V, g, dirichlet_boundary);
 
   // Define source and solution functions
-  Source f;
-  Function u(V);
+  auto f = std::make_shared<Source>();
+  auto u = std::make_shared<Function>(V);
 
   // Create residual form defining (nonlinear) variational problem
   NonlinearPoisson::LinearForm F(V);
@@ -97,14 +97,14 @@ int main()
   params.add(newton_params);
 
   // Solve nonlinear variational problem
-  solve(F == 0, u, bc, J, params);
+  solve(F == 0, *u, bc, J, params);
 
   // Save solution in VTK format
   File file("nonlinear_poisson.pvd");
-  file << u;
+  file << *u;
 
   // Plot solution
-  plot(u);
+  plot(*u);
   interactive();
 
   return 0;
diff --git a/demo/documented/nonlinear-poisson/python/demo_nonlinear-poisson.py b/demo/documented/nonlinear-poisson/python/demo_nonlinear-poisson.py
index 6712212..612aee1 100644
--- a/demo/documented/nonlinear-poisson/python/demo_nonlinear-poisson.py
+++ b/demo/documented/nonlinear-poisson/python/demo_nonlinear-poisson.py
@@ -64,12 +64,11 @@ bc = DirichletBC(V, g, DirichletBoundary())
 # Define variational problem
 u = Function(V)
 v = TestFunction(V)
-f = Expression("x[0]*sin(x[1])")
+f = Expression("x[0]*sin(x[1])", degree=2)
 F = inner((1 + u**2)*grad(u), grad(v))*dx - f*v*dx
 
 # Compute solution
-solve(F == 0, u, bc, solver_parameters={"newton_solver":
-                                        {"relative_tolerance": 1e-6}})
+solve(F == 0, u, bc, solver_parameters={"newton_solver": {"relative_tolerance": 1e-6}})
 
 # Plot solution and solution gradient
 plot(u, title="Solution")
diff --git a/demo/documented/nonlinear-poisson/python/documentation.rst b/demo/documented/nonlinear-poisson/python/documentation.rst
index e41b971..67179f7 100644
--- a/demo/documented/nonlinear-poisson/python/documentation.rst
+++ b/demo/documented/nonlinear-poisson/python/documentation.rst
@@ -36,10 +36,10 @@ often wise to instead specify :math:`|x - 1| < \epsilon`, where
 
 .. code-block:: python
 
-	# Sub domain for Dirichlet boundary condition
-	class DirichletBoundary(SubDomain):
-	    def inside(self, x, on_boundary):
-	        return abs(x[0] - 1.0) < DOLFIN_EPS and on_boundary
+    # Sub domain for Dirichlet boundary condition
+    class DirichletBoundary(SubDomain):
+        def inside(self, x, on_boundary):
+            return abs(x[0] - 1.0) < DOLFIN_EPS and on_boundary
 
 We then define a mesh of the domain and a finite element function
 space V relative to this mesh. We use the built-in mesh provided by
@@ -50,11 +50,11 @@ into two triangles, we do as follows:
 
 .. code-block:: python
 
-	# Create mesh and define function space
-	mesh = UnitSquareMesh(32, 32)
-	File("mesh.pvd") << mesh
+    # Create mesh and define function space
+    mesh = UnitSquareMesh(32, 32)
+    File("mesh.pvd") << mesh
 
-	V = FunctionSpace(mesh, "CG", 1)
+    V = FunctionSpace(mesh, "CG", 1)
 
 The second argument to :py:class:`FunctionSpace
 <dolfin.cpp.function.FunctionSpace>` is the finite element family,
@@ -76,9 +76,9 @@ of the Dirichlet boundary condition then looks as follows:
 
 .. code-block:: python
 
-	# Define boundary condition
-	g = Constant(1.0)
-	bc = DirichletBC(V, g, DirichletBoundary())
+    # Define boundary condition
+    g = Constant(1.0)
+    bc = DirichletBC(V, g, DirichletBoundary())
 
 Next, we want to express the variational problem. First, we need to
 specify the function u which represents the solution. Upon
@@ -107,11 +107,11 @@ summary, this reads
 
 .. code-block:: python
 
-	# Define variational problem
-	u = Function(V)
-	v = TestFunction(V)
-	f = Expression("x[0]*sin(x[1])")
-	F = inner((1 + u**2)*grad(u), grad(v))*dx - f*v*dx
+    # Define variational problem
+    u = Function(V)
+    v = TestFunction(V)
+    f = Expression("x[0]*sin(x[1])", degree=2)
+    F = inner((1 + u**2)*grad(u), grad(v))*dx - f*v*dx
 
 Now, we have specified the variational forms and can consider the
 solution of the variational problem.  Next, we can call the solve
@@ -120,9 +120,8 @@ follows:
 
 .. code-block:: python
 
-	# Compute solution
-	solve(F == 0, u, bc, solver_parameters={"newton_solver":
-		                                    {"relative_tolerance": 1e-6}})
+    # Compute solution
+    solve(F == 0, u, bc, solver_parameters={"newton_solver": {"relative_tolerance": 1e-6}})
 
 The Newton procedure is considered to have converged when the residual
 :math:`r_n` at iteration :math:`n` is less than the absolute tolerance
@@ -137,14 +136,14 @@ command:
 
 .. code-block:: python
 
-	# Plot solution and solution gradient
-	plot(u, title="Solution")
-	plot(grad(u), title="Solution gradient")
-	interactive()
+    # Plot solution and solution gradient
+    plot(u, title="Solution")
+    plot(grad(u), title="Solution gradient")
+    interactive()
 
-	# Save solution in VTK format
-	file = File("nonlinear_poisson.pvd")
-	file << u
+    # Save solution in VTK format
+    file = File("nonlinear_poisson.pvd")
+    file << u
 
 Complete code
 -------------
diff --git a/demo/documented/periodic/cpp/CMakeLists.txt b/demo/documented/periodic/cpp/CMakeLists.txt
index 41e3247..d818565 100644
--- a/demo/documented/periodic/cpp/CMakeLists.txt
+++ b/demo/documented/periodic/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/periodic/cpp/Poisson.h b/demo/documented/periodic/cpp/Poisson.h
index 2296b0f..0ef0561 100644
--- a/demo/documented/periodic/cpp/Poisson.h
+++ b/demo/documented/periodic/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +902,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -1041,322 +989,2002 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    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;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
-    
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-  }
-
-};
-
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    3
-    // Number of operations (multiply-add pairs) for tensor contraction: 7
-    // Total number of operations (multiply-add pairs):                  13
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Compute geometry tensor
-    const double G0_0 = det*w[0][0]*(1.0);
-    const double G0_1 = det*w[0][1]*(1.0);
-    const double G0_2 = det*w[0][2]*(1.0);
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
-    // Compute element tensor
-    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
-    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
-    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class poisson_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  poisson_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_form_0()
-  {
-    // Do nothing
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+  }
+
+};
+
+
+class poisson_cell_integral_1_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    return "a56ff760d1b2d36392fecaa89295d221b18d120e912a2917bc2e8573297855e6979ab2d877460aedf3ffaa3771279e271eabec6012cb797b652aa5da059b83ed";
+    
+  }
+
+  ~poisson_cell_integral_1_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    3
+    // Number of operations (multiply-add pairs) for tensor contraction: 7
+    // Total number of operations (multiply-add pairs):                  13
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0 = det*w[0][0]*(1.0);
+    const double G0_1 = det*w[0][1]*(1.0);
+    const double G0_2 = det*w[0][2]*(1.0);
+    
+    // Compute element tensor
+    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
+    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
+    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
+  }
+
+};
+
+
+class poisson_form_0: public ufc::form
+{
+public:
+
+  poisson_form_0() : ufc::form()
+  {
+    // Do nothing
+  }
+
+  ~poisson_form_0() override
+  {
+    // Do nothing
   }
 
+  const char * signature() const final override
+  {
+    return "327a2ebce665f0df9dcdfb386a5f82bed655eb49e6748bfe664bd49258af417c023ae55cb0509c094373c6b9856a9f7f919048c8bddfe52512e528caaee3cde4";
+  }
 
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1375,8 +3003,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1395,192 +3022,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "9b3ffdf60467e039d8e8a97e79c7ff10aafc42a857591aa4af5591dbc4c3a0fdb2fddbef0bbdd9059db18858572b02dab934b8253fc38648f9f82876cd336c76";
+    return "92c518e8d0beb49f0835ca6333b891530ac780c1757521b8add952f7823551f2029560f0f1c361aeb61c5d6664af01c47d85599f161e4fdf4b43e8af78c2089a";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1599,8 +3254,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1619,126 +3273,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1752,14 +3442,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -1768,43 +3464,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1815,43 +3488,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1862,63 +3512,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1926,7 +3583,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -1956,57 +3613,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -2014,69 +3726,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2108,18 +3861,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/periodic/cpp/compile.log b/demo/documented/periodic/cpp/compile.log
index 17f8b35..7abb774 100644
--- a/demo/documented/periodic/cpp/compile.log
+++ b/demo/documented/periodic/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -30,8 +31,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -39,18 +40,26 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0379171 seconds.
+Compiler stage 1 finished in 0.122452 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
+  Computing representation of 2 dofmaps
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -60,7 +69,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000621 seconds
+  36 entries computed in 0.00104 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -68,6 +77,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -75,7 +85,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000612 seconds
+  9 entries computed in 0.000716 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -83,82 +93,72 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00519395 seconds.
+Compiler stage 2 finished in 0.0145111 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000151873 seconds.
+Compiler stage 3 finished in 0.0002141 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.035588 seconds.
+Compiler stage 4 finished in 0.124845 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000634193 seconds.
+Compiler stage 4.1 finished in 0.000880003 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000662088 seconds.
+Compiler stage 5 finished in 0.00082016 seconds.
 
-FFC finished in 0.0804858 seconds.
+FFC finished in 0.264327 seconds.
+Output written to ./Poisson.h.
diff --git a/demo/documented/periodic/cpp/main.cpp b/demo/documented/periodic/cpp/main.cpp
index d90e360..fbaa830 100644
--- a/demo/documented/periodic/cpp/main.cpp
+++ b/demo/documented/periodic/cpp/main.cpp
@@ -69,23 +69,23 @@ int main()
   };
 
   // Create mesh
-  UnitSquareMesh mesh(32, 32);
+  auto mesh = std::make_shared<UnitSquareMesh>(32, 32);
 
   // Create periodic boundary condition
-  PeriodicBoundary periodic_boundary;
+  auto periodic_boundary = std::make_shared<PeriodicBoundary>();
 
   // Create functions
-  Source f;
+  auto f = std::make_shared<Source>();
 
   // Define PDE
-  Poisson::FunctionSpace V(mesh, periodic_boundary);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh, periodic_boundary);
   Poisson::BilinearForm a(V, V);
   Poisson::LinearForm L(V);
   L.f = f;
 
   // Create Dirichlet boundary condition
-  Constant u0(0.0);
-  DirichletBoundary dirichlet_boundary;
+  auto u0 = std::make_shared<Constant>(0.0);
+  auto dirichlet_boundary = std::make_shared<DirichletBoundary>();
   DirichletBC bc0(V, u0, dirichlet_boundary);
 
   // Collect boundary conditions
diff --git a/demo/documented/periodic/python/demo_periodic.py b/demo/documented/periodic/python/demo_periodic.py
index 143d25c..a4aa36c 100644
--- a/demo/documented/periodic/python/demo_periodic.py
+++ b/demo/documented/periodic/python/demo_periodic.py
@@ -73,7 +73,7 @@ bcs = [bc0]
 # Define variational problem
 u = TrialFunction(V)
 v = TestFunction(V)
-f = Source()
+f = Source(degree=1)
 a = dot(grad(u), grad(v))*dx
 L = f*v*dx
 
diff --git a/demo/documented/periodic/python/documentation.rst b/demo/documented/periodic/python/documentation.rst
index 1751874..024fc19 100644
--- a/demo/documented/periodic/python/documentation.rst
+++ b/demo/documented/periodic/python/documentation.rst
@@ -23,7 +23,7 @@ First, the :py:mod:`dolfin` module is imported
 
 .. code-block:: python
 
-	from dolfin import *
+    from dolfin import *
 
 A subclass of :py:class:`Expression <dolfin.cpp.function.Expression>`,
 ``Source``, is created for the source term ``f``. The function
@@ -32,12 +32,13 @@ for a function at the given point ``x``.
 
 .. code-block:: python
 
-	# Source term
-	class Source(Expression):
-	    def eval(self, values, x):
-	        dx = x[0] - 0.5
-	        dy = x[1] - 0.5
-	        values[0] = x[0]*sin(5.0*DOLFIN_PI*x[1]) + 1.0*exp(-(dx*dx + dy*dy)/0.02)
+    # Source term
+    class Source(Expression):
+        def eval(self, values, x):
+            dx = x[0] - 0.5
+            dy = x[1] - 0.5
+            values[0] = x[0]*sin(5.0*DOLFIN_PI*x[1]) \
+                        + 1.0*exp(-(dx*dx + dy*dy)/0.02)
 
 To define the boundaries, we create subclasses of the class
 :py:class:`SubDomain <dolfin.cpp.mesh.SubDomain>`. A simple Python
@@ -53,10 +54,11 @@ precision).)
 
 .. code-block:: python
 
-	# Sub domain for Dirichlet boundary condition
-	class DirichletBoundary(SubDomain):
-	    def inside(self, x, on_boundary):
-	        return bool((x[1] < DOLFIN_EPS or x[1] > (1.0 - DOLFIN_EPS)) and on_boundary)
+    # Sub domain for Dirichlet boundary condition
+    class DirichletBoundary(SubDomain):
+        def inside(self, x, on_boundary):
+            return bool((x[1] < DOLFIN_EPS or x[1] > (1.0 - DOLFIN_EPS)) \
+                        and on_boundary)
 
 The periodic boundary is defined by PeriodicBoundary and we define
 what is inside the boundary in the same way as in
@@ -68,20 +70,17 @@ the boundary by making an instance of the class.
 
 .. code-block:: python
 
-	# Sub domain for Periodic boundary condition
-	class PeriodicBoundary(SubDomain):
+    # Sub domain for Periodic boundary condition
+    class PeriodicBoundary(SubDomain):
 
-	    # Left boundary is "target domain" G
-	    def inside(self, x, on_boundary):
-	        return bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)
+        # Left boundary is "target domain" G
+        def inside(self, x, on_boundary):
+            return bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)
 
-	    # Map right boundary (H) to left boundary (G)
-	    def map(self, x, y):
-	        y[0] = x[0] - 1.0
-	        y[1] = x[1]
-
-	# Create periodic boundary condition
-	pbc = PeriodicBoundary()
+        # Map right boundary (H) to left boundary (G)
+        def map(self, x, y):
+            y[0] = x[0] - 1.0
+            y[1] = x[1]
 
 A 2D mesh is created using the built-in class
 :py:class:`UnitSquareMesh <dolfin.cpp.mesh.UnitSquareMesh>`, and we
@@ -97,9 +96,9 @@ generated ones).
 
 .. code-block:: python
 
-	# Create mesh and finite element
-	mesh = UnitSquareMesh(32, 32)
-	V = FunctionSpace(mesh, "CG", 1, constrained_domain=pbc)
+    # Create mesh and finite element
+    mesh = UnitSquareMesh(32, 32)
+    V = FunctionSpace(mesh, "CG", 1, constrained_domain=PeriodicBoundary())
 
 Now, we create the Dirichlet boundary condition using the class
 :py:class:`DirichletBC <dolfin.cpp.fem.DirichletBC>`. A
@@ -115,18 +114,18 @@ definition of the Dirichlet boundary condition then looks as follows:
 
 .. code-block:: python
 
-	# Create Dirichlet boundary condition
-	u0 = Constant(0.0)
-	dbc = DirichletBoundary()
-	bc0 = DirichletBC(V, u0, dbc)
+    # Create Dirichlet boundary condition
+    u0 = Constant(0.0)
+    dbc = DirichletBoundary()
+    bc0 = DirichletBC(V, u0, dbc)
 
 When all boundary conditions are defined and created we can collect
 them in a list:
 
 .. code-block:: python
 
-	# Collect boundary conditions
-	bcs = [bc0]
+    # Collect boundary conditions
+    bcs = [bc0]
 
 Here only the Dirichlet boundary condition is put into the list
 because the periodic boundary condition is already applied in the
@@ -144,20 +143,20 @@ operators). In summary, this reads
 
 .. code-block:: python
 
-	# Define variational problem
-	u = TrialFunction(V)
-	v = TestFunction(V)
-	f = Source()
-	a = dot(grad(u), grad(v))*dx
-	L = f*v*dx
+    # Define variational problem
+    u = TrialFunction(V)
+    v = TestFunction(V)
+    f = Source(degree=1)
+    a = dot(grad(u), grad(v))*dx
+    L = f*v*dx
 
 Now, we have specified the variational form and can consider the solution of the variational problem. First, we need to define a :py:class:`Function <dolfin.cpp.function.Function>` u to represent the solution. (Upon initialization, it is simply set to the zero function.) A Function represents a function living in a finite element function space. Next, we can call the solve function with the arguments a == L, u and bcs as follows:
 
 .. code-block:: python
 
-	# Compute solution
-	u = Function(V)
-	solve(a == L, u, bcs)
+    # Compute solution
+    u = Function(V)
+    solve(a == L, u, bcs)
 
 The function u will be modified during the call to solve. The default settings for solving a variational problem have been used. However, the solution process can be controlled in much more detail if desired.
 
@@ -165,15 +164,15 @@ A :py:class:`Function <dolfin.cpp.function.Function>` can be manipulated in vari
 
 .. code-block:: python
 
-	# Save solution to file
-	file = File("periodic.pvd")
-	file << u
+    # Save solution to file
+    file = File("periodic.pvd")
+    file << u
 
-	# Plot solution
-	plot(u, interactive=True)
+    # Plot solution
+    plot(u, interactive=True)
 
 Complete code
 -------------
 
 .. literalinclude:: demo_periodic.py
-	:start-after: # Begin demo
+    :start-after: # Begin demo
diff --git a/demo/documented/poisson/cpp/CMakeLists.txt b/demo/documented/poisson/cpp/CMakeLists.txt
index fd7eaa7..4d3da50 100644
--- a/demo/documented/poisson/cpp/CMakeLists.txt
+++ b/demo/documented/poisson/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/poisson/cpp/Poisson.h b/demo/documented/poisson/cpp/Poisson.h
index 575d935..8fd6ca3 100644
--- a/demo/documented/poisson/cpp/Poisson.h
+++ b/demo/documented/poisson/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +902,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -1041,295 +989,1976 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    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;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
-    
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-  }
-
-};
-
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true, false});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    3
-    // Number of operations (multiply-add pairs) for tensor contraction: 7
-    // Total number of operations (multiply-add pairs):                  13
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Compute geometry tensor
-    const double G0_0 = det*w[0][0]*(1.0);
-    const double G0_1 = det*w[0][1]*(1.0);
-    const double G0_2 = det*w[0][2]*(1.0);
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
+  }
+
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+  }
+
+};
+
+
+class poisson_cell_integral_1_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_1_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true, false});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    3
+    // Number of operations (multiply-add pairs) for tensor contraction: 7
+    // Total number of operations (multiply-add pairs):                  13
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0 = det*w[0][0]*(1.0);
+    const double G0_1 = det*w[0][1]*(1.0);
+    const double G0_2 = det*w[0][2]*(1.0);
+    
+    // Compute element tensor
+    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
+    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
+    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
+  }
+
+};
+
+
+class poisson_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
+{
+public:
+
+  poisson_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
+  {
+    
+  }
+
+  ~poisson_exterior_facet_integral_1_otherwise() override
+  {
     
-    // Compute element tensor
-    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
-    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
-    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
-  }
-
-};
-
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
-
-class poisson_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
-{
-public:
-
-  /// Constructor
-  poisson_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_exterior_facet_integral_1_otherwise()
-  {
-    // Do nothing
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -1338,7 +2967,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1351,8 +2980,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -1391,66 +3020,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_0()
+  ~poisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "7f3815c8e31ab18b282532dab8742e6961eab53ad4e81fa7cb09d956cec41e4af64946224d6780069be4537652b627b48dcbe12cb4f41895baf526eb4e5dcc56";
+    return "43feb4df5c0f918b8e0c704dcc3347e7ba836f6789fff2a5eab375cebd1a89b9c11ac8a2672ff5b2e765a36ff221d887ada9a5989db46716fbaeaeda07acdb99";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1469,8 +3090,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1489,192 +3109,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  bool has_interface_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_overlap_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new poisson_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "e58507906d4ed11ee413a96a0fc6c639025a4127e4d90f9e99c7bee85f398d70855d6f5e3ae70dcc968b6b0f7967bb5fa54f876c26904fcb75b8950e4bc622c4";
+    return "4b3b1c93f282ab055c940e8938b5687d692b500d84be151f71593ae9d6ad97e0c11f287e5960fa8de2ad6025423bd6e9dc808cf75c5a18587d11a7db9b67ccf0";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1698,8 +3346,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1723,126 +3370,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new poisson_exterior_facet_integral_1_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1856,14 +3539,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -1872,43 +3561,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1919,43 +3585,20 @@ class CoefficientSpace_g: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1966,43 +3609,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2013,63 +3633,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -2077,7 +3704,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -2107,57 +3734,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_g Form_L_FunctionSpace_2;
@@ -2167,73 +3849,118 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
     this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
-    this->g = *g;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+    else if (name == "g")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    case 1:
+      return "g";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner g;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
-    this->g = g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
-    this->g = *g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+    this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2269,20 +3996,26 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner g;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner g;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/poisson/cpp/compile.log b/demo/documented/poisson/cpp/compile.log
index 8b74f09..7565a75 100644
--- a/demo/documented/poisson/cpp/compile.log
+++ b/demo/documented/poisson/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -31,8 +32,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              2
   Coefficients:                        '[w_0, w_1]'
-  Unique elements:                     'CG1(?)'
-  Unique sub elements:                 'CG1(?)'
+  Unique elements:                     'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -40,27 +41,35 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.04318 seconds.
+Compiler stage 1 finished in 0.0852511 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -70,7 +79,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000621 seconds
+  36 entries computed in 0.00129 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -78,6 +87,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -85,7 +95,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000541 seconds
+  9 entries computed in 0.00111 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -93,6 +103,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -100,7 +111,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000881 seconds
+  9 entries computed in 0.00172 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -109,7 +120,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000766 seconds
+  9 entries computed in 0.00148 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -118,7 +129,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000735 seconds
+  9 entries computed in 0.00147 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -126,82 +137,72 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00946498 seconds.
+Compiler stage 2 finished in 0.0243161 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000144958 seconds.
+Compiler stage 3 finished in 0.000322104 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0346661 seconds.
+Compiler stage 4 finished in 0.111718 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000604868 seconds.
+Compiler stage 4.1 finished in 0.000779867 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000622034 seconds.
+Compiler stage 5 finished in 0.000730991 seconds.
 
-FFC finished in 0.0889981 seconds.
+FFC finished in 0.223648 seconds.
+Output written to ./Poisson.h.
diff --git a/demo/documented/poisson/cpp/documentation.rst b/demo/documented/poisson/cpp/documentation.rst
index 92baa33..c3c0c0b 100644
--- a/demo/documented/poisson/cpp/documentation.rst
+++ b/demo/documented/poisson/cpp/documentation.rst
@@ -136,8 +136,8 @@ the form file) defined relative to this mesh, we do as follows
 .. code-block:: c++
 
     // Create mesh and function space
-    UnitSquareMesh mesh(32, 32);
-    Poisson::FunctionSpace V(mesh);
+    auto mesh = std::make_shared<UnitSquareMesh>(32, 32);
+    auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
 
 .. index:: DirichletBC
 
@@ -155,8 +155,8 @@ as follows:
 .. code-block:: c++
 
     // Define boundary condition
-    Constant u0(0.0);
-    DirichletBoundary boundary;
+    auto u0 = std::make_shared<Constant>(0.0);
+    auto boundary = std::make_shared<DirichletBoundary>();
     DirichletBC bc(V, u0, boundary);
 
 .. index::
@@ -173,8 +173,8 @@ to the linear form.
     // Define variational forms
     Poisson::BilinearForm a(V, V);
     Poisson::LinearForm L(V);
-    Source f;
-    dUdN g;
+    auto f = std::make_shared<Source>();
+    auto g = std::make_shared<dUdN>();
     L.f = f;
     L.g = g;
 
diff --git a/demo/documented/poisson/cpp/main.cpp b/demo/documented/poisson/cpp/main.cpp
index c7f8e07..b70d37c 100644
--- a/demo/documented/poisson/cpp/main.cpp
+++ b/demo/documented/poisson/cpp/main.cpp
@@ -68,20 +68,20 @@ class DirichletBoundary : public SubDomain
 int main()
 {
   // Create mesh and function space
-  UnitSquareMesh mesh(32, 32);
-  Poisson::FunctionSpace V(mesh);
+  auto mesh = std::make_shared<UnitSquareMesh>(32, 32);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
 
   // Define boundary condition
-  Constant u0(0.0);
-  DirichletBoundary boundary;
+  auto u0 = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
   DirichletBC bc(V, u0, boundary);
 
   // Define variational forms
   Poisson::BilinearForm a(V, V);
   Poisson::LinearForm L(V);
 
-  Source f;
-  dUdN g;
+  auto f = std::make_shared<Source>();
+  auto g = std::make_shared<dUdN>();
   L.f = f;
   L.g = g;
 
diff --git a/demo/documented/poisson/python/demo_poisson.py b/demo/documented/poisson/python/demo_poisson.py
index b1b9db0..d82b033 100644
--- a/demo/documented/poisson/python/demo_poisson.py
+++ b/demo/documented/poisson/python/demo_poisson.py
@@ -51,8 +51,8 @@ bc = DirichletBC(V, u0, boundary)
 # Define variational problem
 u = TrialFunction(V)
 v = TestFunction(V)
-f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-g = Expression("sin(5*x[0])")
+f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+g = Expression("sin(5*x[0])", degree=2)
 a = inner(grad(u), grad(v))*dx
 L = f*v*dx + g*v*ds
 
diff --git a/demo/documented/poisson/python/documentation.rst b/demo/documented/poisson/python/documentation.rst
index 4597ce7..8e3f2e4 100644
--- a/demo/documented/poisson/python/documentation.rst
+++ b/demo/documented/poisson/python/documentation.rst
@@ -106,8 +106,8 @@ the linear form ``L`` (using UFL operators). In summary, this reads
   # Define variational problem
   u = TrialFunction(V)
   v = TestFunction(V)
-  f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-  g = Expression("sin(5*x[0])")
+  f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+  g = Expression("sin(5*x[0])", degree=2)
   a = inner(grad(u), grad(v))*dx
   L = f*v*dx + g*v*ds
 
diff --git a/demo/documented/singular-poisson/cpp/CMakeLists.txt b/demo/documented/singular-poisson/cpp/CMakeLists.txt
index a643189..2afe31c 100644
--- a/demo/documented/singular-poisson/cpp/CMakeLists.txt
+++ b/demo/documented/singular-poisson/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/singular-poisson/cpp/Poisson.h b/demo/documented/singular-poisson/cpp/Poisson.h
index 575d935..8fd6ca3 100644
--- a/demo/documented/singular-poisson/cpp/Poisson.h
+++ b/demo/documented/singular-poisson/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +902,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -1041,295 +989,1976 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    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;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
-    
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-  }
-
-};
-
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true, false});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    3
-    // Number of operations (multiply-add pairs) for tensor contraction: 7
-    // Total number of operations (multiply-add pairs):                  13
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Compute geometry tensor
-    const double G0_0 = det*w[0][0]*(1.0);
-    const double G0_1 = det*w[0][1]*(1.0);
-    const double G0_2 = det*w[0][2]*(1.0);
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
+  }
+
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+  }
+
+};
+
+
+class poisson_cell_integral_1_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_1_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true, false});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    3
+    // Number of operations (multiply-add pairs) for tensor contraction: 7
+    // Total number of operations (multiply-add pairs):                  13
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0 = det*w[0][0]*(1.0);
+    const double G0_1 = det*w[0][1]*(1.0);
+    const double G0_2 = det*w[0][2]*(1.0);
+    
+    // Compute element tensor
+    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
+    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
+    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
+  }
+
+};
+
+
+class poisson_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
+{
+public:
+
+  poisson_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
+  {
+    
+  }
+
+  ~poisson_exterior_facet_integral_1_otherwise() override
+  {
     
-    // Compute element tensor
-    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
-    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
-    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
-  }
-
-};
-
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
-
-class poisson_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
-{
-public:
-
-  /// Constructor
-  poisson_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_exterior_facet_integral_1_otherwise()
-  {
-    // Do nothing
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -1338,7 +2967,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1351,8 +2980,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -1391,66 +3020,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_0()
+  ~poisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "7f3815c8e31ab18b282532dab8742e6961eab53ad4e81fa7cb09d956cec41e4af64946224d6780069be4537652b627b48dcbe12cb4f41895baf526eb4e5dcc56";
+    return "43feb4df5c0f918b8e0c704dcc3347e7ba836f6789fff2a5eab375cebd1a89b9c11ac8a2672ff5b2e765a36ff221d887ada9a5989db46716fbaeaeda07acdb99";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1469,8 +3090,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1489,192 +3109,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  bool has_interface_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_overlap_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new poisson_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "e58507906d4ed11ee413a96a0fc6c639025a4127e4d90f9e99c7bee85f398d70855d6f5e3ae70dcc968b6b0f7967bb5fa54f876c26904fcb75b8950e4bc622c4";
+    return "4b3b1c93f282ab055c940e8938b5687d692b500d84be151f71593ae9d6ad97e0c11f287e5960fa8de2ad6025423bd6e9dc808cf75c5a18587d11a7db9b67ccf0";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1698,8 +3346,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1723,126 +3370,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new poisson_exterior_facet_integral_1_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1856,14 +3539,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -1872,43 +3561,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1919,43 +3585,20 @@ class CoefficientSpace_g: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1966,43 +3609,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2013,63 +3633,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -2077,7 +3704,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -2107,57 +3734,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_g Form_L_FunctionSpace_2;
@@ -2167,73 +3849,118 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
     this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
-    this->g = *g;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+    else if (name == "g")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    case 1:
+      return "g";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner g;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
-    this->g = g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
-    this->g = *g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+    this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2269,20 +3996,26 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner g;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner g;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/singular-poisson/cpp/compile.log b/demo/documented/singular-poisson/cpp/compile.log
index ddc85e8..92e8c5f 100644
--- a/demo/documented/singular-poisson/cpp/compile.log
+++ b/demo/documented/singular-poisson/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -31,8 +32,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              2
   Coefficients:                        '[w_0, w_1]'
-  Unique elements:                     'CG1(?)'
-  Unique sub elements:                 'CG1(?)'
+  Unique elements:                     'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -40,27 +41,35 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0431499 seconds.
+Compiler stage 1 finished in 0.088177 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -70,7 +79,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000636 seconds
+  36 entries computed in 0.000824 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -78,6 +87,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -85,7 +95,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000564 seconds
+  9 entries computed in 0.000827 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -93,6 +103,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -100,7 +111,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.00113 seconds
+  9 entries computed in 0.0012 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -109,7 +120,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000881 seconds
+  9 entries computed in 0.00107 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -118,7 +129,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000814 seconds
+  9 entries computed in 0.00111 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -126,82 +137,72 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0105262 seconds.
+Compiler stage 2 finished in 0.018404 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.00015521 seconds.
+Compiler stage 3 finished in 0.000252008 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.041513 seconds.
+Compiler stage 4 finished in 0.12269 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000725031 seconds.
+Compiler stage 4.1 finished in 0.000874996 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000715971 seconds.
+Compiler stage 5 finished in 0.000812054 seconds.
 
-FFC finished in 0.097137 seconds.
+FFC finished in 0.231795 seconds.
+Output written to ./Poisson.h.
diff --git a/demo/documented/singular-poisson/cpp/main.cpp b/demo/documented/singular-poisson/cpp/main.cpp
index e5b55ef..e480917 100644
--- a/demo/documented/singular-poisson/cpp/main.cpp
+++ b/demo/documented/singular-poisson/cpp/main.cpp
@@ -68,20 +68,20 @@ int main()
 {
   #ifdef HAS_PETSC
   // Create mesh and function space
-  UnitSquareMesh mesh(64, 64);
-  Poisson::FunctionSpace V(mesh);
+  auto mesh = std::make_shared<UnitSquareMesh>(64, 64);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
 
   // Define variational problem
   Poisson::BilinearForm a(V, V);
   Poisson::LinearForm L(V);
-  Source f;
-  Flux g;
+  auto f = std::make_shared<Source>();
+  auto g = std::make_shared<Flux>();
   L.f = f;
   L.g = g;
 
   // Assemble system
-  std::shared_ptr<GenericMatrix> A(new Matrix);
-  Vector b;
+  auto A = std::make_shared<PETScMatrix>();
+  PETScVector b;
   assemble(*A, a);
   assemble(b, L);
 
@@ -89,17 +89,18 @@ int main()
   Function u(V);
 
   // Create Krylov solver
-  KrylovSolver solver(A, "gmres");
+  PETScKrylovSolver solver("cg");
+  solver.set_operator(A);
 
   // Create vector that spans null space (normalised)
   std::shared_ptr<GenericVector> null_space_ptr(b.copy());
-  V.dofmap()->set(*null_space_ptr, sqrt(1.0/null_space_ptr->size()));
+  V->dofmap()->set(*null_space_ptr, sqrt(1.0/null_space_ptr->size()));
   std::vector<std::shared_ptr<GenericVector>> null_space_basis
     = {{null_space_ptr}};
 
   // Create null space basis object and attach to Krylov solver
   VectorSpaceBasis null_space(null_space_basis);
-  A->down_cast<PETScMatrix>().set_nullspace(null_space);
+  A->set_nullspace(null_space);
 
   // Orthogonalize b with respect to the null space (this gurantees
   // that a solution exists)
diff --git a/demo/documented/singular-poisson/python/demo_singular-poisson.py b/demo/documented/singular-poisson/python/demo_singular-poisson.py
index fcf9bb9..2967fd4 100644
--- a/demo/documented/singular-poisson/python/demo_singular-poisson.py
+++ b/demo/documented/singular-poisson/python/demo_singular-poisson.py
@@ -46,7 +46,7 @@ from dolfin import *
 
 # Test for PETSc
 if not has_linear_algebra_backend("PETSc"):
-    info("DOLFIN has not been configured with TPETSc. Exiting.")
+    info("DOLFIN has not been configured with PETSc. Exiting.")
     exit()
 
 parameters["linear_algebra_backend"] = "PETSc"
@@ -58,8 +58,8 @@ V = FunctionSpace(mesh, "CG", 1)
 # Define variational problem
 u = TrialFunction(V)
 v = TestFunction(V)
-f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-g = Expression("-sin(5*x[0])")
+f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+g = Expression("-sin(5*x[0])", degree=2)
 a = inner(grad(u), grad(v))*dx
 L = f*v*dx + g*v*ds
 
@@ -71,19 +71,20 @@ b = assemble(L)
 u = Function(V)
 
 # Create Krylov solver
-solver = KrylovSolver(A, "gmres")
+solver = PETScKrylovSolver("cg")
+solver.set_operator(A)
 
 # Create vector that spans the null space and normalize
 null_vec = Vector(u.vector())
 V.dofmap().set(null_vec, 1.0)
 null_vec *= 1.0/null_vec.norm("l2")
 
-# Create null space basis object and attach to Krylov solver
+# Create null space basis object and attach to PETSc matrix
 null_space = VectorSpaceBasis([null_vec])
 as_backend_type(A).set_nullspace(null_space)
 
-# Orthogonalize RHS b with respect to the null space (this gurantees a
-# solution exists)
+# Orthogonalize RHS vector b with respect to the null space (this
+# gurantees a solution exists)
 null_space.orthogonalize(b);
 
 # Solve
diff --git a/demo/documented/singular-poisson/python/documentation.rst b/demo/documented/singular-poisson/python/documentation.rst
index a21fd5a..e662649 100644
--- a/demo/documented/singular-poisson/python/documentation.rst
+++ b/demo/documented/singular-poisson/python/documentation.rst
@@ -11,6 +11,7 @@ forms and the solver.
 
 .. include:: ../common.txt
 
+
 Implementation
 --------------
 
@@ -31,12 +32,12 @@ our backend for linear algebra.
 
 .. code-block:: python
 
-	# Test for PETSc
-	if not has_linear_algebra_backend("PETSc"):
-	    info("DOLFIN has not been configured with PETSc. Exiting.")
-	    exit()
+    # Test for PETSc
+    if not has_linear_algebra_backend("PETSc"):
+        info("DOLFIN has not been configured with PETSc. Exiting.")
+        exit()
 
-	parameters["linear_algebra_backend"] = "PETSc"
+    parameters["linear_algebra_backend"] = "PETSc"
 
 
 We begin by defining a mesh of the domain and a finite element
@@ -61,8 +62,8 @@ and a :py:class:`TestFunction
 
 .. code-block:: python
 
-	u = TrialFunction(V)
-	v = TestFunction(V)
+    u = TrialFunction(V)
+    v = TestFunction(V)
 
 Further, the source :math:`f` and the boundary normal derivative
 :math:`g` are involved in the variational forms, and hence we must
@@ -75,8 +76,8 @@ expressions at run-time.
 
 .. code-block:: python
 
-	f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-	g = Expression("-sin(5*x[0])")
+    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+    g = Expression("-sin(5*x[0])", degree=2)
 
 
 With :math:`u,v,f` and :math:`g`, we can write down the bilinear form
@@ -84,8 +85,8 @@ With :math:`u,v,f` and :math:`g`, we can write down the bilinear form
 
 .. code-block:: python
 
-	a = inner(grad(u), grad(v))*dx
-	L = f*v*dx + g*v*ds
+    a = inner(grad(u), grad(v))*dx
+    L = f*v*dx + g*v*ds
 
 In order to transform our variational problem into a linear system we
 need to assemble the coefficient matrix ``A`` and the right-side
@@ -94,65 +95,65 @@ vector ``b``. We do this using the function :py:meth:`assemble
 
 .. code-block:: python
 
-	# Assemble system
-	A = assemble(a)
-	b = assemble(L)
+    # Assemble system
+    A = assemble(a)
+    b = assemble(L)
 
 We specify a Vector for storing the result by defining a
 :py:class:`Function <dolfin.cpp.function.Function>`.
 
 .. code-block:: python
 
-	# Solution Function
-	u = Function(V)
+    # Solution Function
+    u = Function(V)
 
 Next, we specify the iterative solver we want to use, in this case a
-:py:class:`KrylovSolver <dolfin.cpp.la.KrylovSolver>`. The first
-argument is the left-hand side matrix, and the second argument
-specifies the method used. In this case we use the Generalized Minimum
-Residual (GMRES) method.
+:py:class:`PETScKrylovSolver <dolfin.cpp.la.PETScKrylovSolver>` with
+the conjugate gradient (CG) method, and attach the matrix operator to
+the solver.
 
 .. code-block:: python
 
-	# Create Krylov solver
-	solver = KrylovSolver(A, "gmres")
+    # Create Krylov solver
+    solver = PETScKrylovSolver("cg")
+    solver.set_operator(A)
 
 We impose our additional constraint by removing the null space
 component from the solution vector. In order to do this we need a
 basis for the null space. This is done by creating a vector that spans
 the null space, and then defining a basis from it. The basis is then
-attached to the :py:class:`KrylovSolver <dolfin.cpp.la.KrylovSolver>`
-as its null space.
+attached to the matrix ``A`` as its null space.
 
 .. code-block:: python
 
-	# Create vector that spans the null space
-	null_vec = Vector(u.vector())
-	V.dofmap().set(null_vec, 1.0)
-	null_vec *= 1.0/null_vec.norm("l2")
+    # Create vector that spans the null space and normalize
+    null_vec = Vector(u.vector())
+    V.dofmap().set(null_vec, 1.0)
+    null_vec *= 1.0/null_vec.norm("l2")
 
-	# Create null space basis object and attach to Krylov solver
-	null_space = VectorSpaceBasis([null_vec])
-	solver.set_nullspace(null_space)
+    # Create null space basis object and attach to PETSc matrix
+    null_space = VectorSpaceBasis([null_vec])
+    as_backend_type(A).set_nullspace(null_space)
 
 Orthogonalization of ``b`` with respect to the null space makes sure
 that it doesn't contain any component in the null space.
 
 .. code-block:: python
 
-	null_space.orthogonalize(b);
+    null_space.orthogonalize(b);
 
 Finally we are able to solve our linear system
 
 .. code-block:: python
 
-	solver.solve(u.vector(), b)
+    solver.solve(u.vector(), b)
 
 and plot the solution
 
 .. code-block:: python
 
-	plot(u, interactive=True)
+    plot(u, interactive=True)
+
 
 Complete code
 -------------
diff --git a/demo/documented/stokes-iterative/cpp/CMakeLists.txt b/demo/documented/stokes-iterative/cpp/CMakeLists.txt
index 9ed9f4f..7d7fc86 100644
--- a/demo/documented/stokes-iterative/cpp/CMakeLists.txt
+++ b/demo/documented/stokes-iterative/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/stokes-iterative/cpp/Stokes.h b/demo/documented/stokes-iterative/cpp/Stokes.h
index a23863d..bfa7fc5 100644
--- a/demo/documented/stokes-iterative/cpp/Stokes.h
+++ b/demo/documented/stokes-iterative/cpp/Stokes.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __STOKES_H
 #define __STOKES_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class stokes_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stokes_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_finite_element_0()
+  ~stokes_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 10;
+    return 4;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -137,43 +150,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -183,43 +180,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -229,43 +210,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -275,597 +240,569 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[9][2];
-    for (unsigned int row = 0; row < 9; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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 > 2)
-            combinations[row][col] = 0;
-          else
-          {
-            combinations[row][col] += 1;
-            break;
-          }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[9][9];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
+        derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -880,9 +817,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -892,11 +829,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -906,11 +843,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -920,11 +857,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -933,9 +870,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -952,123 +889,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1083,9 +974,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1095,11 +986,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1109,11 +1000,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1123,11 +1014,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1136,9 +1027,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1155,815 +1046,535 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 2:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 3:
+    case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_0();
+  }
+
+};
+
+
+class stokes_finite_element_1: public ufc::finite_element
+{
+public:
+
+  stokes_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokes_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        return 3;
         break;
       }
-    case 4:
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1971,322 +1582,408 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        break;
+      }
+    case 8:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2301,9 +1998,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2313,11 +2010,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2327,11 +2024,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2341,11 +2038,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2354,9 +2051,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2373,123 +2070,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2504,9 +2155,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2516,11 +2167,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2530,11 +2181,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2544,11 +2195,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2557,9 +2208,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2576,123 +2227,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2707,9 +2312,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2719,11 +2324,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2733,11 +2338,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2747,11 +2352,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2760,9 +2365,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2779,695 +2384,474 @@ public:
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[9];
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 7:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokes_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokes_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokes_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 30;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
@@ -3475,785 +2859,1442 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 12:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 13:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 14:
+    case 10:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 15:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 16:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 17:
+    case 11:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 18:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 19:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 20:
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
         
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 21:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 22:
+    case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
       {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 23:
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_1();
+  }
+
+};
+
+
+class stokes_finite_element_2: public ufc::finite_element
+{
+public:
+
+  stokes_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokes_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', tetrahedron, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 10;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -4290,16 +4331,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 24:
+    case 1:
       {
         
       // Array of basisvalues
@@ -4336,16 +4377,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 25:
+    case 2:
       {
         
       // Array of basisvalues
@@ -4382,16 +4423,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 26:
+    case 3:
       {
         
       // Array of basisvalues
@@ -4428,16 +4469,154 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 27:
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
       {
         
       // Array of basisvalues
@@ -4479,11 +4658,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 28:
+    case 8:
       {
         
       // Array of basisvalues
@@ -4525,11 +4704,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 29:
+    case 9:
       {
         
       // Array of basisvalues
@@ -4571,7 +4750,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -4579,51 +4758,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
+    double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 30; r++)
+    for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -4635,7 +4807,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -4643,7 +4815,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4655,7 +4827,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -4664,9 +4836,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -4780,7 +4952,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4792,7 +4964,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4804,8 +4976,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -4983,7 +5155,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4995,7 +5167,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5007,8 +5179,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5186,7 +5358,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5198,7 +5370,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5210,8 +5382,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5389,7 +5561,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5401,7 +5573,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5413,8 +5585,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5592,7 +5764,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5604,7 +5776,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5616,8 +5788,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5795,7 +5967,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5807,7 +5979,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5819,8 +5991,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5998,7 +6170,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6010,7 +6182,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6022,8 +6194,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -6201,7 +6373,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6213,7 +6385,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6225,8 +6397,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -6404,7 +6576,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6416,7 +6588,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6428,8 +6600,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -6607,7 +6779,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6619,7 +6791,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6631,8 +6803,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -6764,536 +6936,2525 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 10:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 11:
+    case 2:
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 12:
+    case 6:
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[13] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[14] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[19] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[20] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[21] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[22] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[23] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[26] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[27] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[28] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_2();
+  }
+
+};
+
+
+class stokes_finite_element_3: public ufc::finite_element
+{
+public:
+
+  stokes_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokes_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 2), dim=3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 30;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 12:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 13:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 14:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 15:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 16:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 17:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 18:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 19:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 20:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 21:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 22:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 23:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 24:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 25:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 26:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 27:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 28:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 29:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 30; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[9][2];
+    for (unsigned int row = 0; row < 9; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[9][9];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
           } // end loop over 'u'
         } // end loop over 't'
         
@@ -7368,12 +9529,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 13:
+    case 3:
       {
         
       // Array of basisvalues
@@ -7419,7 +9580,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7431,7 +9592,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7443,8 +9604,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -7571,12 +9732,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 14:
+    case 4:
       {
         
       // Array of basisvalues
@@ -7622,7 +9783,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7634,7 +9795,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7646,8 +9807,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -7774,12 +9935,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 15:
+    case 5:
       {
         
       // Array of basisvalues
@@ -7825,7 +9986,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7837,7 +9998,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7849,8 +10010,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -7977,12 +10138,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 16:
+    case 6:
       {
         
       // Array of basisvalues
@@ -8028,7 +10189,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8040,7 +10201,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8052,8 +10213,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8180,12 +10341,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 17:
+    case 7:
       {
         
       // Array of basisvalues
@@ -8231,7 +10392,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8243,7 +10404,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8255,8 +10416,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8383,12 +10544,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 18:
+    case 8:
       {
         
       // Array of basisvalues
@@ -8434,7 +10595,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8446,7 +10607,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8458,8 +10619,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8586,12 +10747,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 19:
+    case 9:
       {
         
       // Array of basisvalues
@@ -8637,7 +10798,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8649,7 +10810,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8661,8 +10822,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8789,12 +10950,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 20:
+    case 10:
       {
         
       // Array of basisvalues
@@ -8840,7 +11001,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8852,7 +11013,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8864,8 +11025,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8992,12 +11153,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 21:
+    case 11:
       {
         
       // Array of basisvalues
@@ -9043,7 +11204,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9055,7 +11216,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9067,8 +11228,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -9195,12 +11356,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 22:
+    case 12:
       {
         
       // Array of basisvalues
@@ -9246,7 +11407,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9258,7 +11419,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9270,8 +11431,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -9398,12 +11559,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 23:
+    case 13:
       {
         
       // Array of basisvalues
@@ -9449,7 +11610,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9461,7 +11622,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9473,8 +11634,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -9601,12 +11762,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 24:
+    case 14:
       {
         
       // Array of basisvalues
@@ -9652,7 +11813,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9664,7 +11825,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9676,8 +11837,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -9804,12 +11965,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 25:
+    case 15:
       {
         
       // Array of basisvalues
@@ -9855,7 +12016,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9867,7 +12028,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9879,8 +12040,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10007,12 +12168,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 26:
+    case 16:
       {
         
       // Array of basisvalues
@@ -10058,7 +12219,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10070,7 +12231,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10082,8 +12243,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10210,12 +12371,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 27:
+    case 17:
       {
         
       // Array of basisvalues
@@ -10261,7 +12422,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10273,7 +12434,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10285,8 +12446,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10413,12 +12574,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 28:
+    case 18:
       {
         
       // Array of basisvalues
@@ -10464,7 +12625,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10476,7 +12637,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10488,8 +12649,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10616,12 +12777,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 29:
+    case 19:
       {
         
       // Array of basisvalues
@@ -10667,7 +12828,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10679,7 +12840,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10691,8 +12852,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10784,13 +12945,202 @@ public:
             {
               for (unsigned int tu = 0; tu < 10; tu++)
               {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 20:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
             } // end loop over 'u'
           } // end loop over 't'
           }
           
-          if (combinations[r][s] == 2)
+          if (combinations[r][s] == 1)
           {
           for (unsigned int t = 0; t < 10; t++)
           {
@@ -10798,1093 +13148,1178 @@ public:
             {
               for (unsigned int tu = 0; tu < 10; tu++)
               {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
             } // end loop over 'u'
           } // end loop over 't'
           }
           
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 30; r++)
-    {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[27];
-    for (unsigned int r = 0; r < 27; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 30; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 10:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 12:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 13:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 14:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 15:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 16:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 17:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 18:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 19:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 20:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 21:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 22:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 23:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 24:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 25:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 26:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 27:
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 28:
+    case 21:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 29:
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[12] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[13] = vals[1];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[14] = vals[1];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[15] = vals[1];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[16] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[17] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[18] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[19] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[20] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[21] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[22] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[23] = vals[2];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[24] = vals[2];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[25] = vals[2];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[26] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[27] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[28] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[29] = vals[2];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    vertex_values[9] = dof_values[3];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[10];
-    vertex_values[4] = dof_values[11];
-    vertex_values[7] = dof_values[12];
-    vertex_values[10] = dof_values[13];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[20];
-    vertex_values[5] = dof_values[21];
-    vertex_values[8] = dof_values[22];
-    vertex_values[11] = dof_values[23];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 3;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokes_finite_element_0();
-        break;
-      }
-    case 1:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokes_finite_element_0();
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 2:
+    case 22:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokes_finite_element_0();
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokes_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokes_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokes_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 4;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 23:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 24:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 25:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[3][1];
-    for (unsigned int row = 0; row < 3; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
         {
-          if (combinations[row][col] + 1 > 2)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
           {
-            combinations[row][col] += 1;
-            break;
-          }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[3][3];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 26:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -11899,9 +14334,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -11911,11 +14346,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11925,11 +14360,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11939,11 +14374,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11952,9 +14387,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -11966,82 +14401,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 27:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -12056,9 +14537,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -12068,11 +14549,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12082,11 +14563,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12096,11 +14577,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12109,9 +14590,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -12123,82 +14604,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 28:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -12213,9 +14740,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -12225,11 +14752,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12239,11 +14766,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12253,11 +14780,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12266,9 +14793,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -12280,82 +14807,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 29:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -12370,9 +14943,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -12382,11 +14955,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12396,11 +14969,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12410,11 +14983,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12423,9 +14996,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -12437,7 +15010,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -12446,28 +15019,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -12479,57 +15050,55 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 4; r++)
+    for (unsigned int r = 0; r < 30; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = 0.0;
+        values[r*3*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 2)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[3];
-    for (unsigned int r = 0; r < 3; r++)
+    double dof_values[27];
+    for (unsigned int r = 0; r < 27; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 4; r++)
+    for (unsigned int r = 0; r < 30; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
+        values[r*3*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
@@ -12537,185 +15106,666 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
+    case 10:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 12:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 13:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 14:
+      {
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 15:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 16:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 17:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 18:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 19:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 20:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 21:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 22:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 23:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 24:
+      {
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 25:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 26:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 27:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 28:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 29:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
     }
     
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[12] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[13] = vals[1];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[14] = vals[1];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[15] = vals[1];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[16] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[17] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[18] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[19] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[20] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[21] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[22] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[23] = vals[2];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[24] = vals[2];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[25] = vals[2];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[26] = vals[2];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[27] = vals[2];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[28] = vals[2];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[29] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[10];
+    vertex_values[4] = dof_values[11];
+    vertex_values[7] = dof_values[12];
+    vertex_values[10] = dof_values[13];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[20];
+    vertex_values[5] = dof_values[21];
+    vertex_values[8] = dof_values[22];
+    vertex_values[11] = dof_values[23];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[13] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[14] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[19] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[20] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[21] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[22] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[23] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[26] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[27] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[28] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[0];
+    dof_coordinates[31] = coordinate_dofs[1];
+    dof_coordinates[32] = coordinate_dofs[2];
+    dof_coordinates[33] = coordinate_dofs[3];
+    dof_coordinates[34] = coordinate_dofs[4];
+    dof_coordinates[35] = coordinate_dofs[5];
+    dof_coordinates[36] = coordinate_dofs[6];
+    dof_coordinates[37] = coordinate_dofs[7];
+    dof_coordinates[38] = coordinate_dofs[8];
+    dof_coordinates[39] = coordinate_dofs[9];
+    dof_coordinates[40] = coordinate_dofs[10];
+    dof_coordinates[41] = coordinate_dofs[11];
+    dof_coordinates[42] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[43] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[44] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[45] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[46] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[47] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[48] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[49] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[50] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[51] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[52] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[53] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[54] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[55] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[56] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[57] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[58] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[59] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[60] = coordinate_dofs[0];
+    dof_coordinates[61] = coordinate_dofs[1];
+    dof_coordinates[62] = coordinate_dofs[2];
+    dof_coordinates[63] = coordinate_dofs[3];
+    dof_coordinates[64] = coordinate_dofs[4];
+    dof_coordinates[65] = coordinate_dofs[5];
+    dof_coordinates[66] = coordinate_dofs[6];
+    dof_coordinates[67] = coordinate_dofs[7];
+    dof_coordinates[68] = coordinate_dofs[8];
+    dof_coordinates[69] = coordinate_dofs[9];
+    dof_coordinates[70] = coordinate_dofs[10];
+    dof_coordinates[71] = coordinate_dofs[11];
+    dof_coordinates[72] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[73] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[74] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[75] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[76] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[77] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[78] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[79] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[80] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[81] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[82] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[83] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[84] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[85] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[86] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[87] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[88] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[89] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_finite_element_2();
+        break;
+      }
+    case 2:
+      {
+        return new stokes_finite_element_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new stokes_finite_element_2();
+    return new stokes_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class stokes_finite_element_3: public ufc::finite_element
+class stokes_finite_element_4: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  stokes_finite_element_3() : ufc::finite_element()
+  stokes_finite_element_4() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_finite_element_3()
+  ~stokes_finite_element_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None), FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None), **{'value_shape': (4,) })";
+    return "MixedElement(VectorElement(FiniteElement('Lagrange', tetrahedron, 2), dim=3), FiniteElement('Lagrange', tetrahedron, 1))";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 34;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 4;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 4;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -12729,16 +15779,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 4;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -12747,9 +15811,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -14279,20 +17343,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -14301,7 +17363,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 34; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 4; s++)
       {
         values[r*4 + s] = dof_values[s];
@@ -14309,21 +17371,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -14343,7 +17403,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -14355,7 +17415,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -14364,9 +17424,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -14480,7 +17540,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14492,7 +17552,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14504,8 +17564,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -14683,7 +17743,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14695,7 +17755,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14707,8 +17767,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -14886,7 +17946,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14898,7 +17958,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14910,8 +17970,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15089,7 +18149,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15101,7 +18161,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15113,8 +18173,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15292,7 +18352,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15304,7 +18364,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15316,8 +18376,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15495,7 +18555,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15507,7 +18567,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15519,8 +18579,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15698,7 +18758,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15710,7 +18770,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15722,8 +18782,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15901,7 +18961,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15913,7 +18973,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15925,8 +18985,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16104,7 +19164,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16116,7 +19176,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16128,8 +19188,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16307,7 +19367,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16319,7 +19379,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16331,8 +19391,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16510,7 +19570,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16522,7 +19582,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16534,8 +19594,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16713,7 +19773,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16725,7 +19785,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16737,8 +19797,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16916,7 +19976,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16928,7 +19988,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16940,8 +20000,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17119,7 +20179,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17131,7 +20191,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17143,8 +20203,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17322,7 +20382,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17334,7 +20394,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17346,8 +20406,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17525,7 +20585,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17537,7 +20597,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17549,8 +20609,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17728,7 +20788,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17740,7 +20800,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17752,8 +20812,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17931,7 +20991,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17943,7 +21003,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17955,8 +21015,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18134,7 +21194,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18146,7 +21206,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18158,8 +21218,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18337,7 +21397,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18349,7 +21409,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18361,8 +21421,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18540,7 +21600,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18552,7 +21612,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18564,8 +21624,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18743,7 +21803,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18755,7 +21815,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18767,8 +21827,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18946,7 +22006,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18958,7 +22018,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18970,8 +22030,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19149,7 +22209,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19161,7 +22221,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19173,8 +22233,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19352,7 +22412,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19364,7 +22424,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19376,8 +22436,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19555,7 +22615,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19567,7 +22627,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19579,8 +22639,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19758,7 +22818,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19770,7 +22830,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19782,8 +22842,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19961,7 +23021,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19973,7 +23033,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19985,8 +23045,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -20164,7 +23224,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -20176,7 +23236,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -20188,8 +23248,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -20367,7 +23427,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -20379,7 +23439,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -20391,8 +23451,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -21156,28 +24216,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -21213,7 +24271,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 34; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 4*num_derivatives; s++)
       {
         values[r*4*num_derivatives + s] = dof_values[s];
@@ -21221,22 +24279,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[4];
@@ -21247,306 +24303,306 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 7:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 8:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 10:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 12:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 13:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 14:
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 15:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 16:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 17:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 18:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 19:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 20:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 21:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 22:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 23:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 24:
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 25:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 26:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 27:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 28:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 29:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 30:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[3];
         break;
       }
     case 31:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[3];
         break;
       }
     case 32:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[3];
         break;
       }
     case 33:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[3];
         break;
@@ -21556,196 +24612,194 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[4];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[8] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[12] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[13] = vals[1];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[14] = vals[1];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[15] = vals[1];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[16] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[17] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[18] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[19] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[20] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[21] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[22] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[23] = vals[2];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[24] = vals[2];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[25] = vals[2];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[26] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[27] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[28] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[29] = vals[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[30] = vals[3];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[31] = vals[3];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[32] = vals[3];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[33] = vals[3];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -21769,83 +24823,391 @@ public:
     vertex_values[15] = dof_values[33];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[13] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[14] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[19] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[20] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[21] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[22] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[23] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[26] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[27] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[28] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[0];
+    dof_coordinates[31] = coordinate_dofs[1];
+    dof_coordinates[32] = coordinate_dofs[2];
+    dof_coordinates[33] = coordinate_dofs[3];
+    dof_coordinates[34] = coordinate_dofs[4];
+    dof_coordinates[35] = coordinate_dofs[5];
+    dof_coordinates[36] = coordinate_dofs[6];
+    dof_coordinates[37] = coordinate_dofs[7];
+    dof_coordinates[38] = coordinate_dofs[8];
+    dof_coordinates[39] = coordinate_dofs[9];
+    dof_coordinates[40] = coordinate_dofs[10];
+    dof_coordinates[41] = coordinate_dofs[11];
+    dof_coordinates[42] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[43] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[44] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[45] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[46] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[47] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[48] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[49] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[50] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[51] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[52] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[53] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[54] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[55] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[56] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[57] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[58] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[59] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[60] = coordinate_dofs[0];
+    dof_coordinates[61] = coordinate_dofs[1];
+    dof_coordinates[62] = coordinate_dofs[2];
+    dof_coordinates[63] = coordinate_dofs[3];
+    dof_coordinates[64] = coordinate_dofs[4];
+    dof_coordinates[65] = coordinate_dofs[5];
+    dof_coordinates[66] = coordinate_dofs[6];
+    dof_coordinates[67] = coordinate_dofs[7];
+    dof_coordinates[68] = coordinate_dofs[8];
+    dof_coordinates[69] = coordinate_dofs[9];
+    dof_coordinates[70] = coordinate_dofs[10];
+    dof_coordinates[71] = coordinate_dofs[11];
+    dof_coordinates[72] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[73] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[74] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[75] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[76] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[77] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[78] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[79] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[80] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[81] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[82] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[83] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[84] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[85] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[86] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[87] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[88] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[89] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[90] = coordinate_dofs[0];
+    dof_coordinates[91] = coordinate_dofs[1];
+    dof_coordinates[92] = coordinate_dofs[2];
+    dof_coordinates[93] = coordinate_dofs[3];
+    dof_coordinates[94] = coordinate_dofs[4];
+    dof_coordinates[95] = coordinate_dofs[5];
+    dof_coordinates[96] = coordinate_dofs[6];
+    dof_coordinates[97] = coordinate_dofs[7];
+    dof_coordinates[98] = coordinate_dofs[8];
+    dof_coordinates[99] = coordinate_dofs[9];
+    dof_coordinates[100] = coordinate_dofs[10];
+    dof_coordinates[101] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    return 2;
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_finite_element_3();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  ufc::finite_element * create() const final override
   {
-    return 2;
+    return new stokes_finite_element_4();
+  }
+
+};
+
+
+class stokes_dofmap_0: public ufc::dofmap
+{
+public:
+
+  stokes_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~stokes_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
-    switch (i)
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
     {
     case 0:
       {
-        return new stokes_finite_element_1();
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        return new stokes_finite_element_2();
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
         break;
       }
     }
     
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    return new stokes_finite_element_3();
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new stokes_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_0: public ufc::dofmap
+class stokes_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_0() : ufc::dofmap()
+  stokes_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_0()
+  ~stokes_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -21856,7 +25218,7 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -21874,50 +25236,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0] + num_global_entities[1];
+    return 3*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 10;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 9;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 3;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -21935,29 +25286,30 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[1][0];
-    dofs[5] = offset + c.entity_indices[1][1];
-    dofs[6] = offset + c.entity_indices[1][2];
-    dofs[7] = offset + c.entity_indices[1][3];
-    dofs[8] = offset + c.entity_indices[1][4];
-    dofs[9] = offset + c.entity_indices[1][5];
-    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -21966,9 +25318,12 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 6;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 1:
@@ -21977,8 +25332,11 @@ public:
       dofs[1] = 2;
       dofs[2] = 3;
       dofs[3] = 4;
-      dofs[4] = 7;
-      dofs[5] = 8;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 2:
@@ -21986,9 +25344,12 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 3;
-      dofs[3] = 5;
-      dofs[4] = 7;
-      dofs[5] = 9;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
         break;
       }
     case 3:
@@ -21996,18 +25357,20 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 2;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 9;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -22028,21 +25391,29 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
           break;
         }
       }
@@ -22051,45 +25422,7 @@ public:
       }
     case 1:
       {
-        if (i > 5)
-      {
-      throw std::runtime_error("i is larger than number of entities (5)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 6;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 7;
-          break;
-        }
-      case 4:
-        {
-          dofs[0] = 8;
-          break;
-        }
-      case 5:
-        {
-          dofs[0] = 9;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
@@ -22106,89 +25439,64 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new stokes_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_0();
+    return new stokes_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_1: public ufc::dofmap
+class stokes_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_1() : ufc::dofmap()
+  stokes_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_1()
+  ~stokes_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -22217,50 +25525,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3*num_global_entities[0] + 3*num_global_entities[1];
+    return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 30;
+    return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 18;
+    return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 3;
+        return 1;
         break;
       }
     case 1:
       {
-        return 3;
+        return 1;
         break;
       }
     case 2:
@@ -22278,53 +25575,27 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[1][0];
-    dofs[5] = offset + c.entity_indices[1][1];
-    dofs[6] = offset + c.entity_indices[1][2];
-    dofs[7] = offset + c.entity_indices[1][3];
-    dofs[8] = offset + c.entity_indices[1][4];
-    dofs[9] = offset + c.entity_indices[1][5];
-    offset += num_global_entities[1];
-    dofs[10] = offset + c.entity_indices[0][0];
-    dofs[11] = offset + c.entity_indices[0][1];
-    dofs[12] = offset + c.entity_indices[0][2];
-    dofs[13] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[14] = offset + c.entity_indices[1][0];
-    dofs[15] = offset + c.entity_indices[1][1];
-    dofs[16] = offset + c.entity_indices[1][2];
-    dofs[17] = offset + c.entity_indices[1][3];
-    dofs[18] = offset + c.entity_indices[1][4];
-    dofs[19] = offset + c.entity_indices[1][5];
-    offset += num_global_entities[1];
-    dofs[20] = offset + c.entity_indices[0][0];
-    dofs[21] = offset + c.entity_indices[0][1];
-    dofs[22] = offset + c.entity_indices[0][2];
-    dofs[23] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[24] = offset + c.entity_indices[1][0];
-    dofs[25] = offset + c.entity_indices[1][1];
-    dofs[26] = offset + c.entity_indices[1][2];
-    dofs[27] = offset + c.entity_indices[1][3];
-    dofs[28] = offset + c.entity_indices[1][4];
-    dofs[29] = offset + c.entity_indices[1][5];
+    dofs[4] = offset + entity_indices[1][0];
+    dofs[5] = offset + entity_indices[1][1];
+    dofs[6] = offset + entity_indices[1][2];
+    dofs[7] = offset + entity_indices[1][3];
+    dofs[8] = offset + entity_indices[1][4];
+    dofs[9] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -22336,18 +25607,6 @@ public:
       dofs[3] = 4;
       dofs[4] = 5;
       dofs[5] = 6;
-      dofs[6] = 11;
-      dofs[7] = 12;
-      dofs[8] = 13;
-      dofs[9] = 14;
-      dofs[10] = 15;
-      dofs[11] = 16;
-      dofs[12] = 21;
-      dofs[13] = 22;
-      dofs[14] = 23;
-      dofs[15] = 24;
-      dofs[16] = 25;
-      dofs[17] = 26;
         break;
       }
     case 1:
@@ -22358,18 +25617,6 @@ public:
       dofs[3] = 4;
       dofs[4] = 7;
       dofs[5] = 8;
-      dofs[6] = 10;
-      dofs[7] = 12;
-      dofs[8] = 13;
-      dofs[9] = 14;
-      dofs[10] = 17;
-      dofs[11] = 18;
-      dofs[12] = 20;
-      dofs[13] = 22;
-      dofs[14] = 23;
-      dofs[15] = 24;
-      dofs[16] = 27;
-      dofs[17] = 28;
         break;
       }
     case 2:
@@ -22380,18 +25627,6 @@ public:
       dofs[3] = 5;
       dofs[4] = 7;
       dofs[5] = 9;
-      dofs[6] = 10;
-      dofs[7] = 11;
-      dofs[8] = 13;
-      dofs[9] = 15;
-      dofs[10] = 17;
-      dofs[11] = 19;
-      dofs[12] = 20;
-      dofs[13] = 21;
-      dofs[14] = 23;
-      dofs[15] = 25;
-      dofs[16] = 27;
-      dofs[17] = 29;
         break;
       }
     case 3:
@@ -22402,27 +25637,14 @@ public:
       dofs[3] = 6;
       dofs[4] = 8;
       dofs[5] = 9;
-      dofs[6] = 10;
-      dofs[7] = 11;
-      dofs[8] = 12;
-      dofs[9] = 16;
-      dofs[10] = 18;
-      dofs[11] = 19;
-      dofs[12] = 20;
-      dofs[13] = 21;
-      dofs[14] = 22;
-      dofs[15] = 26;
-      dofs[16] = 28;
-      dofs[17] = 29;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -22443,29 +25665,21 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 10;
-        dofs[2] = 20;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 11;
-        dofs[2] = 21;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 12;
-        dofs[2] = 22;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
-        dofs[1] = 13;
-        dofs[2] = 23;
           break;
         }
       }
@@ -22484,43 +25698,31 @@ public:
       case 0:
         {
           dofs[0] = 4;
-        dofs[1] = 14;
-        dofs[2] = 24;
           break;
         }
       case 1:
         {
           dofs[0] = 5;
-        dofs[1] = 15;
-        dofs[2] = 25;
           break;
         }
       case 2:
         {
           dofs[0] = 6;
-        dofs[1] = 16;
-        dofs[2] = 26;
           break;
         }
       case 3:
         {
           dofs[0] = 7;
-        dofs[1] = 17;
-        dofs[2] = 27;
           break;
         }
       case 4:
         {
           dofs[0] = 8;
-        dofs[1] = 18;
-        dofs[2] = 28;
           break;
         }
       case 5:
         {
           dofs[0] = 9;
-        dofs[1] = 19;
-        dofs[2] = 29;
           break;
         }
       }
@@ -22541,168 +25743,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[0];
-    dof_coordinates[31] = vertex_coordinates[1];
-    dof_coordinates[32] = vertex_coordinates[2];
-    dof_coordinates[33] = vertex_coordinates[3];
-    dof_coordinates[34] = vertex_coordinates[4];
-    dof_coordinates[35] = vertex_coordinates[5];
-    dof_coordinates[36] = vertex_coordinates[6];
-    dof_coordinates[37] = vertex_coordinates[7];
-    dof_coordinates[38] = vertex_coordinates[8];
-    dof_coordinates[39] = vertex_coordinates[9];
-    dof_coordinates[40] = vertex_coordinates[10];
-    dof_coordinates[41] = vertex_coordinates[11];
-    dof_coordinates[42] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[43] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[44] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[45] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[46] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[47] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[48] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[49] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[50] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[51] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[52] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[53] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[54] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[55] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[56] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[57] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[58] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[59] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[60] = vertex_coordinates[0];
-    dof_coordinates[61] = vertex_coordinates[1];
-    dof_coordinates[62] = vertex_coordinates[2];
-    dof_coordinates[63] = vertex_coordinates[3];
-    dof_coordinates[64] = vertex_coordinates[4];
-    dof_coordinates[65] = vertex_coordinates[5];
-    dof_coordinates[66] = vertex_coordinates[6];
-    dof_coordinates[67] = vertex_coordinates[7];
-    dof_coordinates[68] = vertex_coordinates[8];
-    dof_coordinates[69] = vertex_coordinates[9];
-    dof_coordinates[70] = vertex_coordinates[10];
-    dof_coordinates[71] = vertex_coordinates[11];
-    dof_coordinates[72] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[73] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[74] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[75] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[76] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[77] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[78] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[79] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[80] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[81] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[82] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[83] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[84] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[85] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[86] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[87] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[88] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[89] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    case 2:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_1();
+    return new stokes_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_2: public ufc::dofmap
+class stokes_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_2() : ufc::dofmap()
+  stokes_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_2()
+  ~stokes_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 2), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -22713,7 +25792,7 @@ public:
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -22731,50 +25810,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 3*num_global_entities[0] + 3*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 4;
+    return 30;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 18;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 3;
         break;
       }
     case 1:
       {
-        return 0;
+        return 3;
         break;
       }
     case 2:
@@ -22792,20 +25860,51 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[1][0];
+    dofs[5] = offset + entity_indices[1][1];
+    dofs[6] = offset + entity_indices[1][2];
+    dofs[7] = offset + entity_indices[1][3];
+    dofs[8] = offset + entity_indices[1][4];
+    dofs[9] = offset + entity_indices[1][5];
+    offset += num_global_entities[1];
+    dofs[10] = offset + entity_indices[0][0];
+    dofs[11] = offset + entity_indices[0][1];
+    dofs[12] = offset + entity_indices[0][2];
+    dofs[13] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[14] = offset + entity_indices[1][0];
+    dofs[15] = offset + entity_indices[1][1];
+    dofs[16] = offset + entity_indices[1][2];
+    dofs[17] = offset + entity_indices[1][3];
+    dofs[18] = offset + entity_indices[1][4];
+    dofs[19] = offset + entity_indices[1][5];
+    offset += num_global_entities[1];
+    dofs[20] = offset + entity_indices[0][0];
+    dofs[21] = offset + entity_indices[0][1];
+    dofs[22] = offset + entity_indices[0][2];
+    dofs[23] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[24] = offset + entity_indices[1][0];
+    dofs[25] = offset + entity_indices[1][1];
+    dofs[26] = offset + entity_indices[1][2];
+    dofs[27] = offset + entity_indices[1][3];
+    dofs[28] = offset + entity_indices[1][4];
+    dofs[29] = offset + entity_indices[1][5];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -22814,6 +25913,21 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 11;
+      dofs[7] = 12;
+      dofs[8] = 13;
+      dofs[9] = 14;
+      dofs[10] = 15;
+      dofs[11] = 16;
+      dofs[12] = 21;
+      dofs[13] = 22;
+      dofs[14] = 23;
+      dofs[15] = 24;
+      dofs[16] = 25;
+      dofs[17] = 26;
         break;
       }
     case 1:
@@ -22821,6 +25935,21 @@ public:
         dofs[0] = 0;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 7;
+      dofs[5] = 8;
+      dofs[6] = 10;
+      dofs[7] = 12;
+      dofs[8] = 13;
+      dofs[9] = 14;
+      dofs[10] = 17;
+      dofs[11] = 18;
+      dofs[12] = 20;
+      dofs[13] = 22;
+      dofs[14] = 23;
+      dofs[15] = 24;
+      dofs[16] = 27;
+      dofs[17] = 28;
         break;
       }
     case 2:
@@ -22828,6 +25957,21 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 7;
+      dofs[5] = 9;
+      dofs[6] = 10;
+      dofs[7] = 11;
+      dofs[8] = 13;
+      dofs[9] = 15;
+      dofs[10] = 17;
+      dofs[11] = 19;
+      dofs[12] = 20;
+      dofs[13] = 21;
+      dofs[14] = 23;
+      dofs[15] = 25;
+      dofs[16] = 27;
+      dofs[17] = 29;
         break;
       }
     case 3:
@@ -22835,15 +25979,29 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 2;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 9;
+      dofs[6] = 10;
+      dofs[7] = 11;
+      dofs[8] = 12;
+      dofs[9] = 16;
+      dofs[10] = 18;
+      dofs[11] = 19;
+      dofs[12] = 20;
+      dofs[13] = 21;
+      dofs[14] = 22;
+      dofs[15] = 26;
+      dofs[16] = 28;
+      dofs[17] = 29;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -22864,21 +26022,29 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 10;
+        dofs[2] = 20;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 11;
+        dofs[2] = 21;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 12;
+        dofs[2] = 22;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
+        dofs[1] = 13;
+        dofs[2] = 23;
           break;
         }
       }
@@ -22887,7 +26053,57 @@ public:
       }
     case 1:
       {
-        
+        if (i > 5)
+      {
+      throw std::runtime_error("i is larger than number of entities (5)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 4;
+        dofs[1] = 14;
+        dofs[2] = 24;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 5;
+        dofs[1] = 15;
+        dofs[2] = 25;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 6;
+        dofs[1] = 16;
+        dofs[2] = 26;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 7;
+        dofs[1] = 17;
+        dofs[2] = 27;
+          break;
+        }
+      case 4:
+        {
+          dofs[0] = 8;
+        dofs[1] = 18;
+        dofs[2] = 28;
+          break;
+        }
+      case 5:
+        {
+          dofs[0] = 9;
+        dofs[1] = 19;
+        dofs[2] = 29;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -22904,71 +26120,64 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_dofmap_2();
+        break;
+      }
+    case 2:
+      {
+        return new stokes_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_2();
+    return new stokes_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_3: public ufc::dofmap
+class stokes_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_3() : ufc::dofmap()
+  stokes_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_3()
+  ~stokes_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None), FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None), **{'value_shape': (4,) })";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Lagrange', tetrahedron, 2), dim=3), FiniteElement('Lagrange', tetrahedron, 1))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -22997,39 +26206,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 4*num_global_entities[0] + 3*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 34;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 21;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -23058,58 +26256,56 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[1][0];
-    dofs[5] = offset + c.entity_indices[1][1];
-    dofs[6] = offset + c.entity_indices[1][2];
-    dofs[7] = offset + c.entity_indices[1][3];
-    dofs[8] = offset + c.entity_indices[1][4];
-    dofs[9] = offset + c.entity_indices[1][5];
+    dofs[4] = offset + entity_indices[1][0];
+    dofs[5] = offset + entity_indices[1][1];
+    dofs[6] = offset + entity_indices[1][2];
+    dofs[7] = offset + entity_indices[1][3];
+    dofs[8] = offset + entity_indices[1][4];
+    dofs[9] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
-    dofs[10] = offset + c.entity_indices[0][0];
-    dofs[11] = offset + c.entity_indices[0][1];
-    dofs[12] = offset + c.entity_indices[0][2];
-    dofs[13] = offset + c.entity_indices[0][3];
+    dofs[10] = offset + entity_indices[0][0];
+    dofs[11] = offset + entity_indices[0][1];
+    dofs[12] = offset + entity_indices[0][2];
+    dofs[13] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[14] = offset + c.entity_indices[1][0];
-    dofs[15] = offset + c.entity_indices[1][1];
-    dofs[16] = offset + c.entity_indices[1][2];
-    dofs[17] = offset + c.entity_indices[1][3];
-    dofs[18] = offset + c.entity_indices[1][4];
-    dofs[19] = offset + c.entity_indices[1][5];
+    dofs[14] = offset + entity_indices[1][0];
+    dofs[15] = offset + entity_indices[1][1];
+    dofs[16] = offset + entity_indices[1][2];
+    dofs[17] = offset + entity_indices[1][3];
+    dofs[18] = offset + entity_indices[1][4];
+    dofs[19] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
-    dofs[20] = offset + c.entity_indices[0][0];
-    dofs[21] = offset + c.entity_indices[0][1];
-    dofs[22] = offset + c.entity_indices[0][2];
-    dofs[23] = offset + c.entity_indices[0][3];
+    dofs[20] = offset + entity_indices[0][0];
+    dofs[21] = offset + entity_indices[0][1];
+    dofs[22] = offset + entity_indices[0][2];
+    dofs[23] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[24] = offset + c.entity_indices[1][0];
-    dofs[25] = offset + c.entity_indices[1][1];
-    dofs[26] = offset + c.entity_indices[1][2];
-    dofs[27] = offset + c.entity_indices[1][3];
-    dofs[28] = offset + c.entity_indices[1][4];
-    dofs[29] = offset + c.entity_indices[1][5];
+    dofs[24] = offset + entity_indices[1][0];
+    dofs[25] = offset + entity_indices[1][1];
+    dofs[26] = offset + entity_indices[1][2];
+    dofs[27] = offset + entity_indices[1][3];
+    dofs[28] = offset + entity_indices[1][4];
+    dofs[29] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
-    dofs[30] = offset + c.entity_indices[0][0];
-    dofs[31] = offset + c.entity_indices[0][1];
-    dofs[32] = offset + c.entity_indices[0][2];
-    dofs[33] = offset + c.entity_indices[0][3];
+    dofs[30] = offset + entity_indices[0][0];
+    dofs[31] = offset + entity_indices[0][1];
+    dofs[32] = offset + entity_indices[0][2];
+    dofs[33] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -23217,9 +26413,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -23342,133 +26537,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[0];
-    dof_coordinates[31] = vertex_coordinates[1];
-    dof_coordinates[32] = vertex_coordinates[2];
-    dof_coordinates[33] = vertex_coordinates[3];
-    dof_coordinates[34] = vertex_coordinates[4];
-    dof_coordinates[35] = vertex_coordinates[5];
-    dof_coordinates[36] = vertex_coordinates[6];
-    dof_coordinates[37] = vertex_coordinates[7];
-    dof_coordinates[38] = vertex_coordinates[8];
-    dof_coordinates[39] = vertex_coordinates[9];
-    dof_coordinates[40] = vertex_coordinates[10];
-    dof_coordinates[41] = vertex_coordinates[11];
-    dof_coordinates[42] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[43] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[44] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[45] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[46] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[47] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[48] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[49] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[50] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[51] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[52] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[53] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[54] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[55] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[56] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[57] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[58] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[59] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[60] = vertex_coordinates[0];
-    dof_coordinates[61] = vertex_coordinates[1];
-    dof_coordinates[62] = vertex_coordinates[2];
-    dof_coordinates[63] = vertex_coordinates[3];
-    dof_coordinates[64] = vertex_coordinates[4];
-    dof_coordinates[65] = vertex_coordinates[5];
-    dof_coordinates[66] = vertex_coordinates[6];
-    dof_coordinates[67] = vertex_coordinates[7];
-    dof_coordinates[68] = vertex_coordinates[8];
-    dof_coordinates[69] = vertex_coordinates[9];
-    dof_coordinates[70] = vertex_coordinates[10];
-    dof_coordinates[71] = vertex_coordinates[11];
-    dof_coordinates[72] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[73] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[74] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[75] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[76] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[77] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[78] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[79] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[80] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[81] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[82] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[83] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[84] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[85] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[86] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[87] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[88] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[89] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[90] = vertex_coordinates[0];
-    dof_coordinates[91] = vertex_coordinates[1];
-    dof_coordinates[92] = vertex_coordinates[2];
-    dof_coordinates[93] = vertex_coordinates[3];
-    dof_coordinates[94] = vertex_coordinates[4];
-    dof_coordinates[95] = vertex_coordinates[5];
-    dof_coordinates[96] = vertex_coordinates[6];
-    dof_coordinates[97] = vertex_coordinates[7];
-    dof_coordinates[98] = vertex_coordinates[8];
-    dof_coordinates[99] = vertex_coordinates[9];
-    dof_coordinates[100] = vertex_coordinates[10];
-    dof_coordinates[101] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_dofmap_1();
+        return new stokes_dofmap_3();
         break;
       }
     case 1:
       {
-        return new stokes_dofmap_2();
+        return new stokes_dofmap_0();
         break;
       }
     }
@@ -23476,46 +26562,38 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_3();
+    return new stokes_dofmap_4();
   }
 
 };
 
-/// 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_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   stokes_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~stokes_cell_integral_0_otherwise()
+  ~stokes_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    139
@@ -23524,7 +26602,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -23640,12 +26718,12 @@ public:
     A[1] = 0.0333333333333333*G0_0_0 + 0.0333333333333333*G0_1_0 + 0.0333333333333333*G0_2_0 + 0.0333333333333333*G3_0_0 + 0.0333333333333333*G3_1_0 + 0.0333333333333333*G3_2_0 + 0.0333333333333333*G6_0_0 + 0.0333333333333333*G6_1_0 + 0.0333333333333333*G6_2_0;
     A[2] = 0.0333333333333334*G0_0_1 + 0.0333333333333333*G0_1_1 + 0.0333333333333333*G0_2_1 + 0.0333333333333334*G3_0_1 + 0.0333333333333333*G3_1_1 + 0.0333333333333333*G3_2_1 + 0.0333333333333334*G6_0_1 + 0.0333333333333333*G6_1_1 + 0.0333333333333333*G6_2_1;
     A[3] = 0.0333333333333334*G0_0_2 + 0.0333333333333334*G0_1_2 + 0.0333333333333334*G0_2_2 + 0.0333333333333334*G3_0_2 + 0.0333333333333334*G3_1_2 + 0.0333333333333334*G3_2_2 + 0.0333333333333334*G6_0_2 + 0.0333333333333334*G6_1_2 + 0.0333333333333334*G6_2_2;
-    A[4] = 0.0333333333333335*G0_0_1 + 0.0333333333333335*G0_0_2 + 0.0333333333333335*G0_1_1 + 0.0333333333333334*G0_1_2 + 0.0333333333333334*G0_2_1 + 0.0333333333333334*G0_2_2 + 0.0333333333333335*G3_0_1 + 0.0333333333333335*G3_0_2 + 0.0333333333333335*G3_1_1 + 0.0333333333333334*G3_1_2 + 0.0333333333333334*G3_2_1 + 0.0333333333333334*G3_2_2 + 0.0333333333333335*G6_0_1 + 0.0333333333333335*G6_0_2 + 0.0333333333333335*G6_1_1 + 0.0333333333333334*G6_1_2 + 0.0333333333333334*G6_2_1 + 0.033 [...]
+    A[4] = 0.0333333333333335*G0_0_1 + 0.0333333333333334*G0_0_2 + 0.0333333333333335*G0_1_1 + 0.0333333333333334*G0_1_2 + 0.0333333333333335*G0_2_1 + 0.0333333333333334*G0_2_2 + 0.0333333333333335*G3_0_1 + 0.0333333333333334*G3_0_2 + 0.0333333333333335*G3_1_1 + 0.0333333333333334*G3_1_2 + 0.0333333333333335*G3_2_1 + 0.0333333333333334*G3_2_2 + 0.0333333333333335*G6_0_1 + 0.0333333333333334*G6_0_2 + 0.0333333333333335*G6_1_1 + 0.0333333333333334*G6_1_2 + 0.0333333333333335*G6_2_1 + 0.033 [...]
     A[5] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_0_2 + 0.0333333333333335*G0_1_0 + 0.0333333333333336*G0_1_2 + 0.0333333333333335*G0_2_0 + 0.0333333333333335*G0_2_2 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_0_2 + 0.0333333333333335*G3_1_0 + 0.0333333333333336*G3_1_2 + 0.0333333333333335*G3_2_0 + 0.0333333333333335*G3_2_2 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_0_2 + 0.0333333333333335*G6_1_0 + 0.0333333333333336*G6_1_2 + 0.0333333333333335*G6_2_0 + 0.033 [...]
-    A[6] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_0_1 + 0.0333333333333335*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333334*G0_2_0 + 0.0333333333333334*G0_2_1 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_0_1 + 0.0333333333333335*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333334*G3_2_0 + 0.0333333333333334*G3_2_1 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_0_1 + 0.0333333333333335*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0333333333333334*G6_2_0 + 0.033 [...]
-    A[7] = -0.0333333333333335*G0_0_0 - 0.0333333333333335*G0_0_1 - 0.133333333333333*G0_0_2 - 0.0333333333333335*G0_1_0 - 0.0333333333333335*G0_1_1 - 0.133333333333334*G0_1_2 - 0.0333333333333334*G0_2_0 - 0.0333333333333334*G0_2_1 - 0.133333333333334*G0_2_2 - 0.0333333333333335*G3_0_0 - 0.0333333333333335*G3_0_1 - 0.133333333333333*G3_0_2 - 0.0333333333333335*G3_1_0 - 0.0333333333333335*G3_1_1 - 0.133333333333334*G3_1_2 - 0.0333333333333334*G3_2_0 - 0.0333333333333334*G3_2_1 - 0.1333333 [...]
+    A[6] = 0.0333333333333335*G0_0_0 + 0.0333333333333334*G0_0_1 + 0.0333333333333335*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333335*G0_2_0 + 0.0333333333333334*G0_2_1 + 0.0333333333333335*G3_0_0 + 0.0333333333333334*G3_0_1 + 0.0333333333333335*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333335*G3_2_0 + 0.0333333333333334*G3_2_1 + 0.0333333333333335*G6_0_0 + 0.0333333333333334*G6_0_1 + 0.0333333333333335*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0333333333333335*G6_2_0 + 0.033 [...]
+    A[7] = -0.0333333333333335*G0_0_0 - 0.0333333333333335*G0_0_1 - 0.133333333333333*G0_0_2 - 0.0333333333333335*G0_1_0 - 0.0333333333333335*G0_1_1 - 0.133333333333333*G0_1_2 - 0.0333333333333334*G0_2_0 - 0.0333333333333334*G0_2_1 - 0.133333333333333*G0_2_2 - 0.0333333333333335*G3_0_0 - 0.0333333333333335*G3_0_1 - 0.133333333333333*G3_0_2 - 0.0333333333333335*G3_1_0 - 0.0333333333333335*G3_1_1 - 0.133333333333333*G3_1_2 - 0.0333333333333334*G3_2_0 - 0.0333333333333334*G3_2_1 - 0.1333333 [...]
     A[8] = -0.0333333333333335*G0_0_0 - 0.133333333333333*G0_0_1 - 0.0333333333333335*G0_0_2 - 0.0333333333333335*G0_1_0 - 0.133333333333333*G0_1_1 - 0.0333333333333334*G0_1_2 - 0.0333333333333334*G0_2_0 - 0.133333333333333*G0_2_1 - 0.0333333333333334*G0_2_2 - 0.0333333333333335*G3_0_0 - 0.133333333333333*G3_0_1 - 0.0333333333333335*G3_0_2 - 0.0333333333333335*G3_1_0 - 0.133333333333333*G3_1_1 - 0.0333333333333334*G3_1_2 - 0.0333333333333334*G3_2_0 - 0.133333333333333*G3_2_1 - 0.03333333 [...]
-    A[9] = -0.133333333333333*G0_0_0 - 0.0333333333333335*G0_0_1 - 0.0333333333333335*G0_0_2 - 0.133333333333333*G0_1_0 - 0.0333333333333335*G0_1_1 - 0.0333333333333335*G0_1_2 - 0.133333333333333*G0_2_0 - 0.0333333333333335*G0_2_1 - 0.0333333333333335*G0_2_2 - 0.133333333333333*G3_0_0 - 0.0333333333333335*G3_0_1 - 0.0333333333333335*G3_0_2 - 0.133333333333333*G3_1_0 - 0.0333333333333335*G3_1_1 - 0.0333333333333335*G3_1_2 - 0.133333333333333*G3_2_0 - 0.0333333333333335*G3_2_1 - 0.03333333 [...]
+    A[9] = -0.133333333333333*G0_0_0 - 0.0333333333333334*G0_0_1 - 0.0333333333333334*G0_0_2 - 0.133333333333333*G0_1_0 - 0.0333333333333335*G0_1_1 - 0.0333333333333335*G0_1_2 - 0.133333333333333*G0_2_0 - 0.0333333333333334*G0_2_1 - 0.0333333333333334*G0_2_2 - 0.133333333333333*G3_0_0 - 0.0333333333333334*G3_0_1 - 0.0333333333333334*G3_0_2 - 0.133333333333333*G3_1_0 - 0.0333333333333335*G3_1_1 - 0.0333333333333335*G3_1_2 - 0.133333333333333*G3_2_0 - 0.0333333333333334*G3_2_1 - 0.03333333 [...]
     A[10] = 0.0;
     A[11] = 0.0;
     A[12] = 0.0;
@@ -23669,7 +26747,7 @@ public:
     A[30] = -0.025*G10_0 - 0.025*G10_1 - 0.025*G10_2;
     A[31] = 0.00833333333333336*G10_0 + 0.00833333333333338*G10_1 + 0.00833333333333336*G10_2;
     A[32] = 0.00833333333333337*G10_0 + 0.00833333333333337*G10_1 + 0.00833333333333335*G10_2;
-    A[33] = 0.00833333333333337*G10_0 + 0.00833333333333337*G10_1 + 0.00833333333333335*G10_2;
+    A[33] = 0.00833333333333337*G10_0 + 0.00833333333333338*G10_1 + 0.00833333333333336*G10_2;
     A[34] = 0.0333333333333333*G0_0_0 + 0.0333333333333333*G0_0_1 + 0.0333333333333333*G0_0_2 + 0.0333333333333333*G3_0_0 + 0.0333333333333333*G3_0_1 + 0.0333333333333333*G3_0_2 + 0.0333333333333333*G6_0_0 + 0.0333333333333333*G6_0_1 + 0.0333333333333333*G6_0_2;
     A[35] = 0.1*G0_0_0 + 0.1*G3_0_0 + 0.1*G6_0_0;
     A[36] = -0.0333333333333334*G0_0_1 - 0.0333333333333334*G3_0_1 - 0.0333333333333334*G6_0_1;
@@ -23678,7 +26756,7 @@ public:
     A[39] = -0.0333333333333336*G0_0_0 + 0.1*G0_0_2 - 0.0333333333333336*G3_0_0 + 0.1*G3_0_2 - 0.0333333333333336*G6_0_0 + 0.1*G6_0_2;
     A[40] = -0.0333333333333336*G0_0_0 + 0.1*G0_0_1 - 0.0333333333333336*G3_0_0 + 0.1*G3_0_1 - 0.0333333333333336*G6_0_0 + 0.1*G6_0_1;
     A[41] = 0.0333333333333336*G0_0_0 + 0.0333333333333336*G0_0_1 + 0.0333333333333336*G3_0_0 + 0.0333333333333336*G3_0_1 + 0.0333333333333336*G6_0_0 + 0.0333333333333336*G6_0_1;
-    A[42] = 0.0333333333333337*G0_0_0 + 0.0333333333333336*G0_0_2 + 0.0333333333333337*G3_0_0 + 0.0333333333333336*G3_0_2 + 0.0333333333333337*G6_0_0 + 0.0333333333333336*G6_0_2;
+    A[42] = 0.0333333333333336*G0_0_0 + 0.0333333333333335*G0_0_2 + 0.0333333333333336*G3_0_0 + 0.0333333333333335*G3_0_2 + 0.0333333333333336*G6_0_0 + 0.0333333333333335*G6_0_2;
     A[43] = -0.133333333333333*G0_0_0 - 0.1*G0_0_1 - 0.1*G0_0_2 - 0.133333333333333*G3_0_0 - 0.1*G3_0_1 - 0.1*G3_0_2 - 0.133333333333333*G6_0_0 - 0.1*G6_0_1 - 0.1*G6_0_2;
     A[44] = 0.0;
     A[45] = 0.0;
@@ -23701,17 +26779,17 @@ public:
     A[62] = 0.0;
     A[63] = 0.0;
     A[64] = -0.00833333333333338*G10_0;
-    A[65] = 0.0249999999999999*G10_0;
-    A[66] = -0.0083333333333334*G10_0;
+    A[65] = 0.025*G10_0;
+    A[66] = -0.00833333333333339*G10_0;
     A[67] = -0.00833333333333339*G10_0;
     A[68] = 0.0333333333333334*G0_1_0 + 0.0333333333333333*G0_1_1 + 0.0333333333333333*G0_1_2 + 0.0333333333333334*G3_1_0 + 0.0333333333333333*G3_1_1 + 0.0333333333333333*G3_1_2 + 0.0333333333333334*G6_1_0 + 0.0333333333333333*G6_1_1 + 0.0333333333333333*G6_1_2;
     A[69] = -0.0333333333333334*G0_1_0 - 0.0333333333333334*G3_1_0 - 0.0333333333333334*G6_1_0;
     A[70] = 0.1*G0_1_1 + 0.1*G3_1_1 + 0.1*G6_1_1;
     A[71] = -0.0333333333333333*G0_1_2 - 0.0333333333333333*G3_1_2 - 0.0333333333333333*G6_1_2;
     A[72] = -0.0333333333333337*G0_1_1 + 0.1*G0_1_2 - 0.0333333333333337*G3_1_1 + 0.1*G3_1_2 - 0.0333333333333337*G6_1_1 + 0.1*G6_1_2;
-    A[73] = -0.0333333333333338*G0_1_0 - 0.0333333333333338*G0_1_2 - 0.0333333333333338*G3_1_0 - 0.0333333333333338*G3_1_2 - 0.0333333333333338*G6_1_0 - 0.0333333333333338*G6_1_2;
-    A[74] = 0.1*G0_1_0 - 0.0333333333333337*G0_1_1 + 0.1*G3_1_0 - 0.0333333333333337*G3_1_1 + 0.1*G6_1_0 - 0.0333333333333337*G6_1_1;
-    A[75] = 0.0333333333333338*G0_1_0 + 0.0333333333333338*G0_1_1 + 0.0333333333333338*G3_1_0 + 0.0333333333333338*G3_1_1 + 0.0333333333333338*G6_1_0 + 0.0333333333333338*G6_1_1;
+    A[73] = -0.0333333333333337*G0_1_0 - 0.0333333333333338*G0_1_2 - 0.0333333333333337*G3_1_0 - 0.0333333333333338*G3_1_2 - 0.0333333333333337*G6_1_0 - 0.0333333333333338*G6_1_2;
+    A[74] = 0.1*G0_1_0 - 0.0333333333333336*G0_1_1 + 0.1*G3_1_0 - 0.0333333333333336*G3_1_1 + 0.1*G6_1_0 - 0.0333333333333336*G6_1_1;
+    A[75] = 0.0333333333333337*G0_1_0 + 0.0333333333333337*G0_1_1 + 0.0333333333333337*G3_1_0 + 0.0333333333333337*G3_1_1 + 0.0333333333333337*G6_1_0 + 0.0333333333333337*G6_1_1;
     A[76] = -0.1*G0_1_0 - 0.133333333333333*G0_1_1 - 0.1*G0_1_2 - 0.1*G3_1_0 - 0.133333333333333*G3_1_1 - 0.1*G3_1_2 - 0.1*G6_1_0 - 0.133333333333333*G6_1_1 - 0.1*G6_1_2;
     A[77] = 0.0333333333333337*G0_1_1 + 0.0333333333333338*G0_1_2 + 0.0333333333333337*G3_1_1 + 0.0333333333333338*G3_1_2 + 0.0333333333333337*G6_1_1 + 0.0333333333333338*G6_1_2;
     A[78] = 0.0;
@@ -23734,8 +26812,8 @@ public:
     A[95] = 0.0;
     A[96] = 0.0;
     A[97] = 0.0;
-    A[98] = -0.00833333333333345*G10_1;
-    A[99] = -0.00833333333333344*G10_1;
+    A[98] = -0.00833333333333343*G10_1;
+    A[99] = -0.00833333333333343*G10_1;
     A[100] = 0.0249999999999999*G10_1;
     A[101] = -0.00833333333333343*G10_1;
     A[102] = 0.0333333333333334*G0_2_0 + 0.0333333333333334*G0_2_1 + 0.0333333333333334*G0_2_2 + 0.0333333333333334*G3_2_0 + 0.0333333333333334*G3_2_1 + 0.0333333333333334*G3_2_2 + 0.0333333333333334*G6_2_0 + 0.0333333333333334*G6_2_1 + 0.0333333333333334*G6_2_2;
@@ -23772,7 +26850,7 @@ public:
     A[133] = -0.00833333333333351*G10_2;
     A[134] = -0.00833333333333351*G10_2;
     A[135] = 0.0249999999999999*G10_2;
-    A[136] = 0.0333333333333335*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333334*G0_1_2 + 0.0333333333333335*G0_2_0 + 0.0333333333333334*G0_2_1 + 0.0333333333333334*G0_2_2 + 0.0333333333333335*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333334*G3_1_2 + 0.0333333333333335*G3_2_0 + 0.0333333333333334*G3_2_1 + 0.0333333333333334*G3_2_2 + 0.0333333333333335*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0333333333333334*G6_1_2 + 0.0333333333333335*G6_2_0 + 0.0333333333333334*G6_2_1 + 0.0 [...]
+    A[136] = 0.0333333333333335*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333335*G0_1_2 + 0.0333333333333334*G0_2_0 + 0.0333333333333334*G0_2_1 + 0.0333333333333334*G0_2_2 + 0.0333333333333335*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333335*G3_1_2 + 0.0333333333333334*G3_2_0 + 0.0333333333333334*G3_2_1 + 0.0333333333333334*G3_2_2 + 0.0333333333333335*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0333333333333335*G6_1_2 + 0.0333333333333334*G6_2_0 + 0.0333333333333334*G6_2_1 + 0.0 [...]
     A[137] = -0.0333333333333336*G0_1_0 - 0.0333333333333335*G0_2_0 - 0.0333333333333336*G3_1_0 - 0.0333333333333335*G3_2_0 - 0.0333333333333336*G6_1_0 - 0.0333333333333335*G6_2_0;
     A[138] = -0.0333333333333337*G0_1_1 + 0.1*G0_2_1 - 0.0333333333333337*G3_1_1 + 0.1*G3_2_1 - 0.0333333333333337*G6_1_1 + 0.1*G6_2_1;
     A[139] = 0.1*G0_1_2 - 0.0333333333333343*G0_2_2 + 0.1*G3_1_2 - 0.0333333333333343*G3_2_2 + 0.1*G6_1_2 - 0.0333333333333343*G6_2_2;
@@ -23808,13 +26886,13 @@ public:
     A[169] = 0.0666666666666667*G10_1 + 0.0333333333333333*G10_2;
     A[170] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_0_1 + 0.0333333333333335*G0_0_2 + 0.0333333333333335*G0_2_0 + 0.0333333333333336*G0_2_1 + 0.0333333333333335*G0_2_2 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_0_1 + 0.0333333333333335*G3_0_2 + 0.0333333333333335*G3_2_0 + 0.0333333333333336*G3_2_1 + 0.0333333333333335*G3_2_2 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_0_1 + 0.0333333333333335*G6_0_2 + 0.0333333333333335*G6_2_0 + 0.0333333333333336*G6_2_1 + 0.0 [...]
     A[171] = -0.0333333333333336*G0_0_0 + 0.1*G0_2_0 - 0.0333333333333336*G3_0_0 + 0.1*G3_2_0 - 0.0333333333333336*G6_0_0 + 0.1*G6_2_0;
-    A[172] = -0.0333333333333338*G0_0_1 - 0.0333333333333338*G0_2_1 - 0.0333333333333338*G3_0_1 - 0.0333333333333338*G3_2_1 - 0.0333333333333338*G6_0_1 - 0.0333333333333338*G6_2_1;
+    A[172] = -0.0333333333333337*G0_0_1 - 0.0333333333333338*G0_2_1 - 0.0333333333333337*G3_0_1 - 0.0333333333333338*G3_2_1 - 0.0333333333333337*G6_0_1 - 0.0333333333333338*G6_2_1;
     A[173] = 0.1*G0_0_2 - 0.033333333333334*G0_2_2 + 0.1*G3_0_2 - 0.033333333333334*G3_2_2 + 0.1*G6_0_2 - 0.033333333333334*G6_2_2;
     A[174] = 0.266666666666667*G0_0_1 + 0.133333333333333*G0_0_2 + 0.133333333333335*G0_2_1 + 0.133333333333335*G0_2_2 + 0.266666666666667*G3_0_1 + 0.133333333333333*G3_0_2 + 0.133333333333335*G3_2_1 + 0.133333333333335*G3_2_2 + 0.266666666666667*G6_0_1 + 0.133333333333333*G6_0_2 + 0.133333333333335*G6_2_1 + 0.133333333333335*G6_2_2;
     A[175] = 0.266666666666667*G0_0_0 + 0.133333333333334*G0_0_2 + 0.133333333333334*G0_2_0 + 0.266666666666669*G0_2_2 + 0.266666666666667*G3_0_0 + 0.133333333333334*G3_0_2 + 0.133333333333334*G3_2_0 + 0.266666666666669*G3_2_2 + 0.266666666666667*G6_0_0 + 0.133333333333334*G6_0_2 + 0.133333333333334*G6_2_0 + 0.266666666666669*G6_2_2;
     A[176] = 0.133333333333333*G0_0_0 + 0.133333333333334*G0_0_1 + 0.133333333333334*G0_2_0 + 0.266666666666669*G0_2_1 + 0.133333333333333*G3_0_0 + 0.133333333333334*G3_0_1 + 0.133333333333334*G3_2_0 + 0.266666666666669*G3_2_1 + 0.133333333333333*G6_0_0 + 0.133333333333334*G6_0_1 + 0.133333333333334*G6_2_0 + 0.266666666666669*G6_2_1;
     A[177] = -0.266666666666667*G0_0_0 - 0.266666666666667*G0_0_1 - 0.133333333333334*G0_0_2 - 0.133333333333334*G0_2_0 - 0.133333333333335*G0_2_1 - 0.266666666666667*G3_0_0 - 0.266666666666667*G3_0_1 - 0.133333333333334*G3_0_2 - 0.133333333333334*G3_2_0 - 0.133333333333335*G3_2_1 - 0.266666666666667*G6_0_0 - 0.266666666666667*G6_0_1 - 0.133333333333334*G6_0_2 - 0.133333333333334*G6_2_0 - 0.133333333333335*G6_2_1;
-    A[178] = -0.133333333333334*G0_0_0 - 0.133333333333333*G0_0_2 - 0.133333333333334*G0_2_0 - 0.133333333333334*G0_2_2 - 0.133333333333334*G3_0_0 - 0.133333333333333*G3_0_2 - 0.133333333333334*G3_2_0 - 0.133333333333334*G3_2_2 - 0.133333333333334*G6_0_0 - 0.133333333333333*G6_0_2 - 0.133333333333334*G6_2_0 - 0.133333333333334*G6_2_2;
+    A[178] = -0.133333333333333*G0_0_0 - 0.133333333333333*G0_0_2 - 0.133333333333334*G0_2_0 - 0.133333333333334*G0_2_2 - 0.133333333333333*G3_0_0 - 0.133333333333333*G3_0_2 - 0.133333333333334*G3_2_0 - 0.133333333333334*G3_2_2 - 0.133333333333333*G6_0_0 - 0.133333333333333*G6_0_2 - 0.133333333333334*G6_2_0 - 0.133333333333334*G6_2_2;
     A[179] = -0.133333333333333*G0_0_1 - 0.133333333333333*G0_0_2 - 0.133333333333333*G0_2_0 - 0.266666666666668*G0_2_1 - 0.266666666666668*G0_2_2 - 0.133333333333333*G3_0_1 - 0.133333333333333*G3_0_2 - 0.133333333333333*G3_2_0 - 0.266666666666668*G3_2_1 - 0.266666666666668*G3_2_2 - 0.133333333333333*G6_0_1 - 0.133333333333333*G6_0_2 - 0.133333333333333*G6_2_0 - 0.266666666666668*G6_2_1 - 0.266666666666668*G6_2_2;
     A[180] = 0.0;
     A[181] = 0.0;
@@ -23840,15 +26918,15 @@ public:
     A[201] = 0.0333333333333333*G10_0 + 0.0666666666666669*G10_2;
     A[202] = 0.0333333333333333*G10_0 + 0.0333333333333336*G10_2;
     A[203] = 0.0666666666666667*G10_0 + 0.0333333333333336*G10_2;
-    A[204] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_0_1 + 0.0333333333333334*G0_0_2 + 0.0333333333333335*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333334*G0_1_2 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_0_1 + 0.0333333333333334*G3_0_2 + 0.0333333333333335*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333334*G3_1_2 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_0_1 + 0.0333333333333334*G6_0_2 + 0.0333333333333335*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0 [...]
+    A[204] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_0_1 + 0.0333333333333335*G0_0_2 + 0.0333333333333335*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333334*G0_1_2 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_0_1 + 0.0333333333333335*G3_0_2 + 0.0333333333333335*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333334*G3_1_2 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_0_1 + 0.0333333333333335*G6_0_2 + 0.0333333333333335*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0 [...]
     A[205] = -0.0333333333333336*G0_0_0 + 0.1*G0_1_0 - 0.0333333333333336*G3_0_0 + 0.1*G3_1_0 - 0.0333333333333336*G6_0_0 + 0.1*G6_1_0;
-    A[206] = 0.1*G0_0_1 - 0.0333333333333337*G0_1_1 + 0.1*G3_0_1 - 0.0333333333333337*G3_1_1 + 0.1*G6_0_1 - 0.0333333333333337*G6_1_1;
+    A[206] = 0.1*G0_0_1 - 0.0333333333333336*G0_1_1 + 0.1*G3_0_1 - 0.0333333333333336*G3_1_1 + 0.1*G6_0_1 - 0.0333333333333336*G6_1_1;
     A[207] = -0.0333333333333341*G0_0_2 - 0.0333333333333342*G0_1_2 - 0.0333333333333341*G3_0_2 - 0.0333333333333342*G3_1_2 - 0.0333333333333341*G6_0_2 - 0.0333333333333342*G6_1_2;
     A[208] = 0.133333333333334*G0_0_1 + 0.266666666666667*G0_0_2 + 0.133333333333334*G0_1_1 + 0.133333333333335*G0_1_2 + 0.133333333333334*G3_0_1 + 0.266666666666667*G3_0_2 + 0.133333333333334*G3_1_1 + 0.133333333333335*G3_1_2 + 0.133333333333334*G6_0_1 + 0.266666666666667*G6_0_2 + 0.133333333333334*G6_1_1 + 0.133333333333335*G6_1_2;
     A[209] = 0.133333333333333*G0_0_0 + 0.133333333333334*G0_0_2 + 0.133333333333334*G0_1_0 + 0.266666666666669*G0_1_2 + 0.133333333333333*G3_0_0 + 0.133333333333334*G3_0_2 + 0.133333333333334*G3_1_0 + 0.266666666666669*G3_1_2 + 0.133333333333333*G6_0_0 + 0.133333333333334*G6_0_2 + 0.133333333333334*G6_1_0 + 0.266666666666669*G6_1_2;
     A[210] = 0.266666666666667*G0_0_0 + 0.133333333333334*G0_0_1 + 0.133333333333334*G0_1_0 + 0.266666666666669*G0_1_1 + 0.266666666666667*G3_0_0 + 0.133333333333334*G3_0_1 + 0.133333333333334*G3_1_0 + 0.266666666666669*G3_1_1 + 0.266666666666667*G6_0_0 + 0.133333333333334*G6_0_1 + 0.133333333333334*G6_1_0 + 0.266666666666669*G6_1_1;
-    A[211] = -0.133333333333333*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_1 - 0.133333333333333*G3_0_0 - 0.133333333333334*G3_0_1 - 0.133333333333334*G3_1_0 - 0.133333333333334*G3_1_1 - 0.133333333333333*G6_0_0 - 0.133333333333334*G6_0_1 - 0.133333333333334*G6_1_0 - 0.133333333333334*G6_1_1;
-    A[212] = -0.266666666666667*G0_0_0 - 0.133333333333334*G0_0_1 - 0.266666666666667*G0_0_2 - 0.133333333333335*G0_1_0 - 0.133333333333334*G0_1_2 - 0.266666666666667*G3_0_0 - 0.133333333333334*G3_0_1 - 0.266666666666667*G3_0_2 - 0.133333333333335*G3_1_0 - 0.133333333333334*G3_1_2 - 0.266666666666667*G6_0_0 - 0.133333333333334*G6_0_1 - 0.266666666666667*G6_0_2 - 0.133333333333335*G6_1_0 - 0.133333333333334*G6_1_2;
+    A[211] = -0.133333333333333*G0_0_0 - 0.133333333333333*G0_0_1 - 0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_1 - 0.133333333333333*G3_0_0 - 0.133333333333333*G3_0_1 - 0.133333333333334*G3_1_0 - 0.133333333333334*G3_1_1 - 0.133333333333333*G6_0_0 - 0.133333333333333*G6_0_1 - 0.133333333333334*G6_1_0 - 0.133333333333334*G6_1_1;
+    A[212] = -0.266666666666667*G0_0_0 - 0.133333333333333*G0_0_1 - 0.266666666666667*G0_0_2 - 0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_2 - 0.266666666666667*G3_0_0 - 0.133333333333333*G3_0_1 - 0.266666666666667*G3_0_2 - 0.133333333333334*G3_1_0 - 0.133333333333334*G3_1_2 - 0.266666666666667*G6_0_0 - 0.133333333333333*G6_0_1 - 0.266666666666667*G6_0_2 - 0.133333333333334*G6_1_0 - 0.133333333333334*G6_1_2;
     A[213] = -0.133333333333334*G0_0_1 - 0.133333333333333*G0_0_2 - 0.133333333333333*G0_1_0 - 0.266666666666668*G0_1_1 - 0.266666666666668*G0_1_2 - 0.133333333333334*G3_0_1 - 0.133333333333333*G3_0_2 - 0.133333333333333*G3_1_0 - 0.266666666666668*G3_1_1 - 0.266666666666668*G3_1_2 - 0.133333333333334*G6_0_1 - 0.133333333333333*G6_0_2 - 0.133333333333333*G6_1_0 - 0.266666666666668*G6_1_1 - 0.266666666666668*G6_1_2;
     A[214] = 0.0;
     A[215] = 0.0;
@@ -23874,13 +26952,13 @@ public:
     A[235] = 0.0333333333333333*G10_0 + 0.0666666666666669*G10_1;
     A[236] = 0.0666666666666667*G10_0 + 0.0333333333333336*G10_1;
     A[237] = 0.0333333333333333*G10_0 + 0.0333333333333335*G10_1;
-    A[238] = -0.0333333333333335*G0_0_0 - 0.0333333333333335*G0_0_1 - 0.0333333333333334*G0_0_2 - 0.0333333333333335*G0_1_0 - 0.0333333333333335*G0_1_1 - 0.0333333333333334*G0_1_2 - 0.133333333333333*G0_2_0 - 0.133333333333334*G0_2_1 - 0.133333333333334*G0_2_2 - 0.0333333333333335*G3_0_0 - 0.0333333333333335*G3_0_1 - 0.0333333333333334*G3_0_2 - 0.0333333333333335*G3_1_0 - 0.0333333333333335*G3_1_1 - 0.0333333333333334*G3_1_2 - 0.133333333333333*G3_2_0 - 0.133333333333334*G3_2_1 - 0.13333 [...]
+    A[238] = -0.0333333333333335*G0_0_0 - 0.0333333333333335*G0_0_1 - 0.0333333333333335*G0_0_2 - 0.0333333333333335*G0_1_0 - 0.0333333333333335*G0_1_1 - 0.0333333333333335*G0_1_2 - 0.133333333333333*G0_2_0 - 0.133333333333333*G0_2_1 - 0.133333333333333*G0_2_2 - 0.0333333333333335*G3_0_0 - 0.0333333333333335*G3_0_1 - 0.0333333333333335*G3_0_2 - 0.0333333333333335*G3_1_0 - 0.0333333333333335*G3_1_1 - 0.0333333333333335*G3_1_2 - 0.133333333333333*G3_2_0 - 0.133333333333333*G3_2_1 - 0.13333 [...]
     A[239] = 0.0333333333333336*G0_0_0 + 0.0333333333333336*G0_1_0 + 0.0333333333333336*G3_0_0 + 0.0333333333333336*G3_1_0 + 0.0333333333333336*G6_0_0 + 0.0333333333333336*G6_1_0;
-    A[240] = 0.0333333333333338*G0_0_1 + 0.0333333333333338*G0_1_1 + 0.0333333333333338*G3_0_1 + 0.0333333333333338*G3_1_1 + 0.0333333333333338*G6_0_1 + 0.0333333333333338*G6_1_1;
+    A[240] = 0.0333333333333337*G0_0_1 + 0.0333333333333337*G0_1_1 + 0.0333333333333337*G3_0_1 + 0.0333333333333337*G3_1_1 + 0.0333333333333337*G6_0_1 + 0.0333333333333337*G6_1_1;
     A[241] = -0.1*G0_0_2 - 0.1*G0_1_2 - 0.133333333333334*G0_2_2 - 0.1*G3_0_2 - 0.1*G3_1_2 - 0.133333333333334*G3_2_2 - 0.1*G6_0_2 - 0.1*G6_1_2 - 0.133333333333334*G6_2_2;
     A[242] = -0.266666666666667*G0_0_1 - 0.133333333333333*G0_0_2 - 0.266666666666667*G0_1_1 - 0.133333333333333*G0_1_2 - 0.133333333333334*G0_2_1 - 0.266666666666667*G3_0_1 - 0.133333333333333*G3_0_2 - 0.266666666666667*G3_1_1 - 0.133333333333333*G3_1_2 - 0.133333333333334*G3_2_1 - 0.266666666666667*G6_0_1 - 0.133333333333333*G6_0_2 - 0.266666666666667*G6_1_1 - 0.133333333333333*G6_1_2 - 0.133333333333334*G6_2_1;
     A[243] = -0.266666666666667*G0_0_0 - 0.133333333333334*G0_0_2 - 0.266666666666667*G0_1_0 - 0.133333333333335*G0_1_2 - 0.133333333333334*G0_2_0 - 0.266666666666667*G3_0_0 - 0.133333333333334*G3_0_2 - 0.266666666666667*G3_1_0 - 0.133333333333335*G3_1_2 - 0.133333333333334*G3_2_0 - 0.266666666666667*G6_0_0 - 0.133333333333334*G6_0_2 - 0.266666666666667*G6_1_0 - 0.133333333333335*G6_1_2 - 0.133333333333334*G6_2_0;
-    A[244] = -0.133333333333333*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_1 - 0.133333333333333*G3_0_0 - 0.133333333333334*G3_0_1 - 0.133333333333334*G3_1_0 - 0.133333333333334*G3_1_1 - 0.133333333333333*G6_0_0 - 0.133333333333334*G6_0_1 - 0.133333333333334*G6_1_0 - 0.133333333333334*G6_1_1;
+    A[244] = -0.133333333333333*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333333*G0_1_0 - 0.133333333333334*G0_1_1 - 0.133333333333333*G3_0_0 - 0.133333333333334*G3_0_1 - 0.133333333333333*G3_1_0 - 0.133333333333334*G3_1_1 - 0.133333333333333*G6_0_0 - 0.133333333333334*G6_0_1 - 0.133333333333333*G6_1_0 - 0.133333333333334*G6_1_1;
     A[245] = 0.266666666666667*G0_0_0 + 0.266666666666667*G0_0_1 + 0.133333333333334*G0_0_2 + 0.266666666666667*G0_1_0 + 0.266666666666667*G0_1_1 + 0.133333333333334*G0_1_2 + 0.133333333333334*G0_2_0 + 0.133333333333334*G0_2_1 + 0.266666666666667*G0_2_2 + 0.266666666666667*G3_0_0 + 0.266666666666667*G3_0_1 + 0.133333333333334*G3_0_2 + 0.266666666666667*G3_1_0 + 0.266666666666667*G3_1_1 + 0.133333333333334*G3_1_2 + 0.133333333333334*G3_2_0 + 0.133333333333334*G3_2_1 + 0.266666666666667*G3 [...]
     A[246] = 0.133333333333334*G0_0_0 + 0.133333333333333*G0_0_2 + 0.133333333333334*G0_1_0 + 0.133333333333333*G0_1_2 + 0.133333333333334*G0_2_1 + 0.133333333333334*G3_0_0 + 0.133333333333333*G3_0_2 + 0.133333333333334*G3_1_0 + 0.133333333333333*G3_1_2 + 0.133333333333334*G3_2_1 + 0.133333333333334*G6_0_0 + 0.133333333333333*G6_0_2 + 0.133333333333334*G6_1_0 + 0.133333333333333*G6_1_2 + 0.133333333333334*G6_2_1;
     A[247] = 0.133333333333333*G0_0_1 + 0.133333333333333*G0_0_2 + 0.133333333333334*G0_1_1 + 0.133333333333334*G0_1_2 + 0.133333333333334*G0_2_0 + 0.133333333333333*G3_0_1 + 0.133333333333333*G3_0_2 + 0.133333333333334*G3_1_1 + 0.133333333333334*G3_1_2 + 0.133333333333334*G3_2_0 + 0.133333333333333*G6_0_1 + 0.133333333333333*G6_0_2 + 0.133333333333334*G6_1_1 + 0.133333333333334*G6_1_2 + 0.133333333333334*G6_2_0;
@@ -23908,14 +26986,14 @@ public:
     A[269] = -0.0333333333333333*G10_0 - 0.0333333333333334*G10_1;
     A[270] = -0.0333333333333333*G10_0 - 0.0333333333333334*G10_1;
     A[271] = -0.0666666666666667*G10_0 - 0.0666666666666667*G10_1 - 0.0333333333333334*G10_2;
-    A[272] = -0.0333333333333335*G0_0_0 - 0.0333333333333335*G0_0_1 - 0.0333333333333334*G0_0_2 - 0.133333333333333*G0_1_0 - 0.133333333333333*G0_1_1 - 0.133333333333333*G0_1_2 - 0.0333333333333335*G0_2_0 - 0.0333333333333334*G0_2_1 - 0.0333333333333334*G0_2_2 - 0.0333333333333335*G3_0_0 - 0.0333333333333335*G3_0_1 - 0.0333333333333334*G3_0_2 - 0.133333333333333*G3_1_0 - 0.133333333333333*G3_1_1 - 0.133333333333333*G3_1_2 - 0.0333333333333335*G3_2_0 - 0.0333333333333334*G3_2_1 - 0.033333 [...]
+    A[272] = -0.0333333333333335*G0_0_0 - 0.0333333333333335*G0_0_1 - 0.0333333333333334*G0_0_2 - 0.133333333333333*G0_1_0 - 0.133333333333333*G0_1_1 - 0.133333333333333*G0_1_2 - 0.0333333333333334*G0_2_0 - 0.0333333333333334*G0_2_1 - 0.0333333333333334*G0_2_2 - 0.0333333333333335*G3_0_0 - 0.0333333333333335*G3_0_1 - 0.0333333333333334*G3_0_2 - 0.133333333333333*G3_1_0 - 0.133333333333333*G3_1_1 - 0.133333333333333*G3_1_2 - 0.0333333333333334*G3_2_0 - 0.0333333333333334*G3_2_1 - 0.033333 [...]
     A[273] = 0.0333333333333336*G0_0_0 + 0.0333333333333336*G0_2_0 + 0.0333333333333336*G3_0_0 + 0.0333333333333336*G3_2_0 + 0.0333333333333336*G6_0_0 + 0.0333333333333336*G6_2_0;
     A[274] = -0.1*G0_0_1 - 0.133333333333333*G0_1_1 - 0.1*G0_2_1 - 0.1*G3_0_1 - 0.133333333333333*G3_1_1 - 0.1*G3_2_1 - 0.1*G6_0_1 - 0.133333333333333*G6_1_1 - 0.1*G6_2_1;
     A[275] = 0.0333333333333341*G0_0_2 + 0.0333333333333341*G0_2_2 + 0.0333333333333341*G3_0_2 + 0.0333333333333341*G3_2_2 + 0.0333333333333341*G6_0_2 + 0.0333333333333341*G6_2_2;
     A[276] = -0.133333333333334*G0_0_1 - 0.266666666666667*G0_0_2 - 0.133333333333333*G0_1_2 - 0.133333333333333*G0_2_1 - 0.266666666666667*G0_2_2 - 0.133333333333334*G3_0_1 - 0.266666666666667*G3_0_2 - 0.133333333333333*G3_1_2 - 0.133333333333333*G3_2_1 - 0.266666666666667*G3_2_2 - 0.133333333333334*G6_0_1 - 0.266666666666667*G6_0_2 - 0.133333333333333*G6_1_2 - 0.133333333333333*G6_2_1 - 0.266666666666667*G6_2_2;
     A[277] = -0.133333333333333*G0_0_0 - 0.133333333333334*G0_0_2 - 0.133333333333333*G0_2_0 - 0.133333333333334*G0_2_2 - 0.133333333333333*G3_0_0 - 0.133333333333334*G3_0_2 - 0.133333333333333*G3_2_0 - 0.133333333333334*G3_2_2 - 0.133333333333333*G6_0_0 - 0.133333333333334*G6_0_2 - 0.133333333333333*G6_2_0 - 0.133333333333334*G6_2_2;
-    A[278] = -0.266666666666667*G0_0_0 - 0.133333333333335*G0_0_1 - 0.133333333333333*G0_1_0 - 0.266666666666667*G0_2_0 - 0.133333333333334*G0_2_1 - 0.266666666666667*G3_0_0 - 0.133333333333335*G3_0_1 - 0.133333333333333*G3_1_0 - 0.266666666666667*G3_2_0 - 0.133333333333334*G3_2_1 - 0.266666666666667*G6_0_0 - 0.133333333333335*G6_0_1 - 0.133333333333333*G6_1_0 - 0.266666666666667*G6_2_0 - 0.133333333333334*G6_2_1;
-    A[279] = 0.133333333333334*G0_0_0 + 0.133333333333334*G0_0_1 + 0.133333333333334*G0_1_2 + 0.133333333333333*G0_2_0 + 0.133333333333333*G0_2_1 + 0.133333333333334*G3_0_0 + 0.133333333333334*G3_0_1 + 0.133333333333334*G3_1_2 + 0.133333333333333*G3_2_0 + 0.133333333333333*G3_2_1 + 0.133333333333334*G6_0_0 + 0.133333333333334*G6_0_1 + 0.133333333333334*G6_1_2 + 0.133333333333333*G6_2_0 + 0.133333333333333*G6_2_1;
+    A[278] = -0.266666666666667*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333333*G0_1_0 - 0.266666666666667*G0_2_0 - 0.133333333333334*G0_2_1 - 0.266666666666667*G3_0_0 - 0.133333333333334*G3_0_1 - 0.133333333333333*G3_1_0 - 0.266666666666667*G3_2_0 - 0.133333333333334*G3_2_1 - 0.266666666666667*G6_0_0 - 0.133333333333334*G6_0_1 - 0.133333333333333*G6_1_0 - 0.266666666666667*G6_2_0 - 0.133333333333334*G6_2_1;
+    A[279] = 0.133333333333333*G0_0_0 + 0.133333333333334*G0_0_1 + 0.133333333333334*G0_1_2 + 0.133333333333333*G0_2_0 + 0.133333333333333*G0_2_1 + 0.133333333333333*G3_0_0 + 0.133333333333334*G3_0_1 + 0.133333333333334*G3_1_2 + 0.133333333333333*G3_2_0 + 0.133333333333333*G3_2_1 + 0.133333333333333*G6_0_0 + 0.133333333333334*G6_0_1 + 0.133333333333334*G6_1_2 + 0.133333333333333*G6_2_0 + 0.133333333333333*G6_2_1;
     A[280] = 0.266666666666667*G0_0_0 + 0.133333333333334*G0_0_1 + 0.266666666666667*G0_0_2 + 0.133333333333334*G0_1_0 + 0.266666666666667*G0_1_1 + 0.133333333333333*G0_1_2 + 0.266666666666667*G0_2_0 + 0.133333333333333*G0_2_1 + 0.266666666666667*G0_2_2 + 0.266666666666667*G3_0_0 + 0.133333333333334*G3_0_1 + 0.266666666666667*G3_0_2 + 0.133333333333334*G3_1_0 + 0.266666666666667*G3_1_1 + 0.133333333333333*G3_1_2 + 0.266666666666667*G3_2_0 + 0.133333333333333*G3_2_1 + 0.266666666666667*G3 [...]
     A[281] = 0.133333333333334*G0_0_1 + 0.133333333333333*G0_0_2 + 0.133333333333333*G0_1_0 + 0.133333333333333*G0_2_1 + 0.133333333333333*G0_2_2 + 0.133333333333334*G3_0_1 + 0.133333333333333*G3_0_2 + 0.133333333333333*G3_1_0 + 0.133333333333333*G3_2_1 + 0.133333333333333*G3_2_2 + 0.133333333333334*G6_0_1 + 0.133333333333333*G6_0_2 + 0.133333333333333*G6_1_0 + 0.133333333333333*G6_2_1 + 0.133333333333333*G6_2_2;
     A[282] = 0.0;
@@ -23939,10 +27017,10 @@ public:
     A[300] = 0.0;
     A[301] = 0.0;
     A[302] = -0.0333333333333334*G10_0 + 0.0333333333333333*G10_1 - 0.0333333333333334*G10_2;
-    A[303] = -0.0333333333333334*G10_0 - 0.0333333333333333*G10_2;
-    A[304] = -0.0666666666666667*G10_0 - 0.0333333333333333*G10_1 - 0.0666666666666667*G10_2;
+    A[303] = -0.0333333333333333*G10_0 - 0.0333333333333333*G10_2;
+    A[304] = -0.0666666666666667*G10_0 - 0.0333333333333334*G10_1 - 0.0666666666666667*G10_2;
     A[305] = -0.0333333333333334*G10_0 - 0.0333333333333333*G10_2;
-    A[306] = -0.133333333333333*G0_0_0 - 0.133333333333333*G0_0_1 - 0.133333333333333*G0_0_2 - 0.0333333333333335*G0_1_0 - 0.0333333333333335*G0_1_1 - 0.0333333333333335*G0_1_2 - 0.0333333333333335*G0_2_0 - 0.0333333333333335*G0_2_1 - 0.0333333333333334*G0_2_2 - 0.133333333333333*G3_0_0 - 0.133333333333333*G3_0_1 - 0.133333333333333*G3_0_2 - 0.0333333333333335*G3_1_0 - 0.0333333333333335*G3_1_1 - 0.0333333333333335*G3_1_2 - 0.0333333333333335*G3_2_0 - 0.0333333333333335*G3_2_1 - 0.033333 [...]
+    A[306] = -0.133333333333333*G0_0_0 - 0.133333333333333*G0_0_1 - 0.133333333333333*G0_0_2 - 0.0333333333333334*G0_1_0 - 0.0333333333333335*G0_1_1 - 0.0333333333333334*G0_1_2 - 0.0333333333333334*G0_2_0 - 0.0333333333333335*G0_2_1 - 0.0333333333333334*G0_2_2 - 0.133333333333333*G3_0_0 - 0.133333333333333*G3_0_1 - 0.133333333333333*G3_0_2 - 0.0333333333333334*G3_1_0 - 0.0333333333333335*G3_1_1 - 0.0333333333333334*G3_1_2 - 0.0333333333333334*G3_2_0 - 0.0333333333333335*G3_2_1 - 0.033333 [...]
     A[307] = -0.133333333333333*G0_0_0 - 0.1*G0_1_0 - 0.1*G0_2_0 - 0.133333333333333*G3_0_0 - 0.1*G3_1_0 - 0.1*G3_2_0 - 0.133333333333333*G6_0_0 - 0.1*G6_1_0 - 0.1*G6_2_0;
     A[308] = 0.0333333333333337*G0_1_1 + 0.0333333333333338*G0_2_1 + 0.0333333333333337*G3_1_1 + 0.0333333333333338*G3_2_1 + 0.0333333333333337*G6_1_1 + 0.0333333333333338*G6_2_1;
     A[309] = 0.0333333333333341*G0_1_2 + 0.033333333333334*G0_2_2 + 0.0333333333333341*G3_1_2 + 0.033333333333334*G3_2_2 + 0.0333333333333341*G6_1_2 + 0.033333333333334*G6_2_2;
@@ -23975,7 +27053,7 @@ public:
     A[336] = 0.0333333333333333*G10_0 - 0.0333333333333334*G10_1 - 0.0333333333333334*G10_2;
     A[337] = -0.0333333333333333*G10_0 - 0.0666666666666667*G10_1 - 0.0666666666666667*G10_2;
     A[338] = -0.0333333333333334*G10_1 - 0.0333333333333333*G10_2;
-    A[339] = -0.0333333333333333*G10_1 - 0.0333333333333333*G10_2;
+    A[339] = -0.0333333333333334*G10_1 - 0.0333333333333333*G10_2;
     A[340] = 0.0;
     A[341] = 0.0;
     A[342] = 0.0;
@@ -23990,12 +27068,12 @@ public:
     A[351] = 0.0333333333333333*G1_0_0 + 0.0333333333333333*G1_1_0 + 0.0333333333333333*G1_2_0 + 0.0333333333333333*G4_0_0 + 0.0333333333333333*G4_1_0 + 0.0333333333333333*G4_2_0 + 0.0333333333333333*G7_0_0 + 0.0333333333333333*G7_1_0 + 0.0333333333333333*G7_2_0;
     A[352] = 0.0333333333333334*G1_0_1 + 0.0333333333333333*G1_1_1 + 0.0333333333333333*G1_2_1 + 0.0333333333333334*G4_0_1 + 0.0333333333333333*G4_1_1 + 0.0333333333333333*G4_2_1 + 0.0333333333333334*G7_0_1 + 0.0333333333333333*G7_1_1 + 0.0333333333333333*G7_2_1;
     A[353] = 0.0333333333333334*G1_0_2 + 0.0333333333333334*G1_1_2 + 0.0333333333333334*G1_2_2 + 0.0333333333333334*G4_0_2 + 0.0333333333333334*G4_1_2 + 0.0333333333333334*G4_2_2 + 0.0333333333333334*G7_0_2 + 0.0333333333333334*G7_1_2 + 0.0333333333333334*G7_2_2;
-    A[354] = 0.0333333333333335*G1_0_1 + 0.0333333333333335*G1_0_2 + 0.0333333333333335*G1_1_1 + 0.0333333333333334*G1_1_2 + 0.0333333333333334*G1_2_1 + 0.0333333333333334*G1_2_2 + 0.0333333333333335*G4_0_1 + 0.0333333333333335*G4_0_2 + 0.0333333333333335*G4_1_1 + 0.0333333333333334*G4_1_2 + 0.0333333333333334*G4_2_1 + 0.0333333333333334*G4_2_2 + 0.0333333333333335*G7_0_1 + 0.0333333333333335*G7_0_2 + 0.0333333333333335*G7_1_1 + 0.0333333333333334*G7_1_2 + 0.0333333333333334*G7_2_1 + 0.0 [...]
+    A[354] = 0.0333333333333335*G1_0_1 + 0.0333333333333334*G1_0_2 + 0.0333333333333335*G1_1_1 + 0.0333333333333334*G1_1_2 + 0.0333333333333335*G1_2_1 + 0.0333333333333334*G1_2_2 + 0.0333333333333335*G4_0_1 + 0.0333333333333334*G4_0_2 + 0.0333333333333335*G4_1_1 + 0.0333333333333334*G4_1_2 + 0.0333333333333335*G4_2_1 + 0.0333333333333334*G4_2_2 + 0.0333333333333335*G7_0_1 + 0.0333333333333334*G7_0_2 + 0.0333333333333335*G7_1_1 + 0.0333333333333334*G7_1_2 + 0.0333333333333335*G7_2_1 + 0.0 [...]
     A[355] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_0_2 + 0.0333333333333335*G1_1_0 + 0.0333333333333336*G1_1_2 + 0.0333333333333335*G1_2_0 + 0.0333333333333335*G1_2_2 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_0_2 + 0.0333333333333335*G4_1_0 + 0.0333333333333336*G4_1_2 + 0.0333333333333335*G4_2_0 + 0.0333333333333335*G4_2_2 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_0_2 + 0.0333333333333335*G7_1_0 + 0.0333333333333336*G7_1_2 + 0.0333333333333335*G7_2_0 + 0.0 [...]
-    A[356] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_0_1 + 0.0333333333333335*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333334*G1_2_0 + 0.0333333333333334*G1_2_1 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_0_1 + 0.0333333333333335*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333334*G4_2_0 + 0.0333333333333334*G4_2_1 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_0_1 + 0.0333333333333335*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0333333333333334*G7_2_0 + 0.0 [...]
-    A[357] = -0.0333333333333335*G1_0_0 - 0.0333333333333335*G1_0_1 - 0.133333333333333*G1_0_2 - 0.0333333333333335*G1_1_0 - 0.0333333333333335*G1_1_1 - 0.133333333333334*G1_1_2 - 0.0333333333333334*G1_2_0 - 0.0333333333333334*G1_2_1 - 0.133333333333334*G1_2_2 - 0.0333333333333335*G4_0_0 - 0.0333333333333335*G4_0_1 - 0.133333333333333*G4_0_2 - 0.0333333333333335*G4_1_0 - 0.0333333333333335*G4_1_1 - 0.133333333333334*G4_1_2 - 0.0333333333333334*G4_2_0 - 0.0333333333333334*G4_2_1 - 0.13333 [...]
+    A[356] = 0.0333333333333335*G1_0_0 + 0.0333333333333334*G1_0_1 + 0.0333333333333335*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333335*G1_2_0 + 0.0333333333333334*G1_2_1 + 0.0333333333333335*G4_0_0 + 0.0333333333333334*G4_0_1 + 0.0333333333333335*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333335*G4_2_0 + 0.0333333333333334*G4_2_1 + 0.0333333333333335*G7_0_0 + 0.0333333333333334*G7_0_1 + 0.0333333333333335*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0333333333333335*G7_2_0 + 0.0 [...]
+    A[357] = -0.0333333333333335*G1_0_0 - 0.0333333333333335*G1_0_1 - 0.133333333333333*G1_0_2 - 0.0333333333333335*G1_1_0 - 0.0333333333333335*G1_1_1 - 0.133333333333333*G1_1_2 - 0.0333333333333334*G1_2_0 - 0.0333333333333334*G1_2_1 - 0.133333333333333*G1_2_2 - 0.0333333333333335*G4_0_0 - 0.0333333333333335*G4_0_1 - 0.133333333333333*G4_0_2 - 0.0333333333333335*G4_1_0 - 0.0333333333333335*G4_1_1 - 0.133333333333333*G4_1_2 - 0.0333333333333334*G4_2_0 - 0.0333333333333334*G4_2_1 - 0.13333 [...]
     A[358] = -0.0333333333333335*G1_0_0 - 0.133333333333333*G1_0_1 - 0.0333333333333335*G1_0_2 - 0.0333333333333335*G1_1_0 - 0.133333333333333*G1_1_1 - 0.0333333333333334*G1_1_2 - 0.0333333333333334*G1_2_0 - 0.133333333333333*G1_2_1 - 0.0333333333333334*G1_2_2 - 0.0333333333333335*G4_0_0 - 0.133333333333333*G4_0_1 - 0.0333333333333335*G4_0_2 - 0.0333333333333335*G4_1_0 - 0.133333333333333*G4_1_1 - 0.0333333333333334*G4_1_2 - 0.0333333333333334*G4_2_0 - 0.133333333333333*G4_2_1 - 0.033333 [...]
-    A[359] = -0.133333333333333*G1_0_0 - 0.0333333333333335*G1_0_1 - 0.0333333333333335*G1_0_2 - 0.133333333333333*G1_1_0 - 0.0333333333333335*G1_1_1 - 0.0333333333333335*G1_1_2 - 0.133333333333333*G1_2_0 - 0.0333333333333335*G1_2_1 - 0.0333333333333335*G1_2_2 - 0.133333333333333*G4_0_0 - 0.0333333333333335*G4_0_1 - 0.0333333333333335*G4_0_2 - 0.133333333333333*G4_1_0 - 0.0333333333333335*G4_1_1 - 0.0333333333333335*G4_1_2 - 0.133333333333333*G4_2_0 - 0.0333333333333335*G4_2_1 - 0.033333 [...]
+    A[359] = -0.133333333333333*G1_0_0 - 0.0333333333333334*G1_0_1 - 0.0333333333333334*G1_0_2 - 0.133333333333333*G1_1_0 - 0.0333333333333335*G1_1_1 - 0.0333333333333335*G1_1_2 - 0.133333333333333*G1_2_0 - 0.0333333333333334*G1_2_1 - 0.0333333333333334*G1_2_2 - 0.133333333333333*G4_0_0 - 0.0333333333333334*G4_0_1 - 0.0333333333333334*G4_0_2 - 0.133333333333333*G4_1_0 - 0.0333333333333335*G4_1_1 - 0.0333333333333335*G4_1_2 - 0.133333333333333*G4_2_0 - 0.0333333333333334*G4_2_1 - 0.033333 [...]
     A[360] = 0.0;
     A[361] = 0.0;
     A[362] = 0.0;
@@ -24009,7 +27087,7 @@ public:
     A[370] = -0.025*G11_0 - 0.025*G11_1 - 0.025*G11_2;
     A[371] = 0.00833333333333336*G11_0 + 0.00833333333333338*G11_1 + 0.00833333333333336*G11_2;
     A[372] = 0.00833333333333337*G11_0 + 0.00833333333333337*G11_1 + 0.00833333333333335*G11_2;
-    A[373] = 0.00833333333333337*G11_0 + 0.00833333333333337*G11_1 + 0.00833333333333335*G11_2;
+    A[373] = 0.00833333333333337*G11_0 + 0.00833333333333338*G11_1 + 0.00833333333333336*G11_2;
     A[374] = 0.0;
     A[375] = 0.0;
     A[376] = 0.0;
@@ -24028,7 +27106,7 @@ public:
     A[389] = -0.0333333333333336*G1_0_0 + 0.1*G1_0_2 - 0.0333333333333336*G4_0_0 + 0.1*G4_0_2 - 0.0333333333333336*G7_0_0 + 0.1*G7_0_2;
     A[390] = -0.0333333333333336*G1_0_0 + 0.1*G1_0_1 - 0.0333333333333336*G4_0_0 + 0.1*G4_0_1 - 0.0333333333333336*G7_0_0 + 0.1*G7_0_1;
     A[391] = 0.0333333333333336*G1_0_0 + 0.0333333333333336*G1_0_1 + 0.0333333333333336*G4_0_0 + 0.0333333333333336*G4_0_1 + 0.0333333333333336*G7_0_0 + 0.0333333333333336*G7_0_1;
-    A[392] = 0.0333333333333337*G1_0_0 + 0.0333333333333336*G1_0_2 + 0.0333333333333337*G4_0_0 + 0.0333333333333336*G4_0_2 + 0.0333333333333337*G7_0_0 + 0.0333333333333336*G7_0_2;
+    A[392] = 0.0333333333333336*G1_0_0 + 0.0333333333333335*G1_0_2 + 0.0333333333333336*G4_0_0 + 0.0333333333333335*G4_0_2 + 0.0333333333333336*G7_0_0 + 0.0333333333333335*G7_0_2;
     A[393] = -0.133333333333333*G1_0_0 - 0.1*G1_0_1 - 0.1*G1_0_2 - 0.133333333333333*G4_0_0 - 0.1*G4_0_1 - 0.1*G4_0_2 - 0.133333333333333*G7_0_0 - 0.1*G7_0_1 - 0.1*G7_0_2;
     A[394] = 0.0;
     A[395] = 0.0;
@@ -24041,8 +27119,8 @@ public:
     A[402] = 0.0;
     A[403] = 0.0;
     A[404] = -0.00833333333333338*G11_0;
-    A[405] = 0.0249999999999999*G11_0;
-    A[406] = -0.0083333333333334*G11_0;
+    A[405] = 0.025*G11_0;
+    A[406] = -0.00833333333333339*G11_0;
     A[407] = -0.00833333333333339*G11_0;
     A[408] = 0.0;
     A[409] = 0.0;
@@ -24059,9 +27137,9 @@ public:
     A[420] = 0.1*G1_1_1 + 0.1*G4_1_1 + 0.1*G7_1_1;
     A[421] = -0.0333333333333333*G1_1_2 - 0.0333333333333333*G4_1_2 - 0.0333333333333333*G7_1_2;
     A[422] = -0.0333333333333337*G1_1_1 + 0.1*G1_1_2 - 0.0333333333333337*G4_1_1 + 0.1*G4_1_2 - 0.0333333333333337*G7_1_1 + 0.1*G7_1_2;
-    A[423] = -0.0333333333333338*G1_1_0 - 0.0333333333333338*G1_1_2 - 0.0333333333333338*G4_1_0 - 0.0333333333333338*G4_1_2 - 0.0333333333333338*G7_1_0 - 0.0333333333333338*G7_1_2;
-    A[424] = 0.1*G1_1_0 - 0.0333333333333337*G1_1_1 + 0.1*G4_1_0 - 0.0333333333333337*G4_1_1 + 0.1*G7_1_0 - 0.0333333333333337*G7_1_1;
-    A[425] = 0.0333333333333338*G1_1_0 + 0.0333333333333338*G1_1_1 + 0.0333333333333338*G4_1_0 + 0.0333333333333338*G4_1_1 + 0.0333333333333338*G7_1_0 + 0.0333333333333338*G7_1_1;
+    A[423] = -0.0333333333333337*G1_1_0 - 0.0333333333333338*G1_1_2 - 0.0333333333333337*G4_1_0 - 0.0333333333333338*G4_1_2 - 0.0333333333333337*G7_1_0 - 0.0333333333333338*G7_1_2;
+    A[424] = 0.1*G1_1_0 - 0.0333333333333336*G1_1_1 + 0.1*G4_1_0 - 0.0333333333333336*G4_1_1 + 0.1*G7_1_0 - 0.0333333333333336*G7_1_1;
+    A[425] = 0.0333333333333337*G1_1_0 + 0.0333333333333337*G1_1_1 + 0.0333333333333337*G4_1_0 + 0.0333333333333337*G4_1_1 + 0.0333333333333337*G7_1_0 + 0.0333333333333337*G7_1_1;
     A[426] = -0.1*G1_1_0 - 0.133333333333333*G1_1_1 - 0.1*G1_1_2 - 0.1*G4_1_0 - 0.133333333333333*G4_1_1 - 0.1*G4_1_2 - 0.1*G7_1_0 - 0.133333333333333*G7_1_1 - 0.1*G7_1_2;
     A[427] = 0.0333333333333337*G1_1_1 + 0.0333333333333338*G1_1_2 + 0.0333333333333337*G4_1_1 + 0.0333333333333338*G4_1_2 + 0.0333333333333337*G7_1_1 + 0.0333333333333338*G7_1_2;
     A[428] = 0.0;
@@ -24074,8 +27152,8 @@ public:
     A[435] = 0.0;
     A[436] = 0.0;
     A[437] = 0.0;
-    A[438] = -0.00833333333333345*G11_1;
-    A[439] = -0.00833333333333344*G11_1;
+    A[438] = -0.00833333333333343*G11_1;
+    A[439] = -0.00833333333333343*G11_1;
     A[440] = 0.0249999999999999*G11_1;
     A[441] = -0.00833333333333343*G11_1;
     A[442] = 0.0;
@@ -24122,7 +27200,7 @@ public:
     A[483] = 0.0;
     A[484] = 0.0;
     A[485] = 0.0;
-    A[486] = 0.0333333333333335*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333334*G1_1_2 + 0.0333333333333335*G1_2_0 + 0.0333333333333334*G1_2_1 + 0.0333333333333334*G1_2_2 + 0.0333333333333335*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333334*G4_1_2 + 0.0333333333333335*G4_2_0 + 0.0333333333333334*G4_2_1 + 0.0333333333333334*G4_2_2 + 0.0333333333333335*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0333333333333334*G7_1_2 + 0.0333333333333335*G7_2_0 + 0.0333333333333334*G7_2_1 + 0.0 [...]
+    A[486] = 0.0333333333333335*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333335*G1_1_2 + 0.0333333333333334*G1_2_0 + 0.0333333333333334*G1_2_1 + 0.0333333333333334*G1_2_2 + 0.0333333333333335*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333335*G4_1_2 + 0.0333333333333334*G4_2_0 + 0.0333333333333334*G4_2_1 + 0.0333333333333334*G4_2_2 + 0.0333333333333335*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0333333333333335*G7_1_2 + 0.0333333333333334*G7_2_0 + 0.0333333333333334*G7_2_1 + 0.0 [...]
     A[487] = -0.0333333333333336*G1_1_0 - 0.0333333333333335*G1_2_0 - 0.0333333333333336*G4_1_0 - 0.0333333333333335*G4_2_0 - 0.0333333333333336*G7_1_0 - 0.0333333333333335*G7_2_0;
     A[488] = -0.0333333333333337*G1_1_1 + 0.1*G1_2_1 - 0.0333333333333337*G4_1_1 + 0.1*G4_2_1 - 0.0333333333333337*G7_1_1 + 0.1*G7_2_1;
     A[489] = 0.1*G1_1_2 - 0.0333333333333343*G1_2_2 + 0.1*G4_1_2 - 0.0333333333333343*G4_2_2 + 0.1*G7_1_2 - 0.0333333333333343*G7_2_2;
@@ -24158,13 +27236,13 @@ public:
     A[519] = 0.0;
     A[520] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_0_1 + 0.0333333333333335*G1_0_2 + 0.0333333333333335*G1_2_0 + 0.0333333333333336*G1_2_1 + 0.0333333333333335*G1_2_2 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_0_1 + 0.0333333333333335*G4_0_2 + 0.0333333333333335*G4_2_0 + 0.0333333333333336*G4_2_1 + 0.0333333333333335*G4_2_2 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_0_1 + 0.0333333333333335*G7_0_2 + 0.0333333333333335*G7_2_0 + 0.0333333333333336*G7_2_1 + 0.0 [...]
     A[521] = -0.0333333333333336*G1_0_0 + 0.1*G1_2_0 - 0.0333333333333336*G4_0_0 + 0.1*G4_2_0 - 0.0333333333333336*G7_0_0 + 0.1*G7_2_0;
-    A[522] = -0.0333333333333338*G1_0_1 - 0.0333333333333338*G1_2_1 - 0.0333333333333338*G4_0_1 - 0.0333333333333338*G4_2_1 - 0.0333333333333338*G7_0_1 - 0.0333333333333338*G7_2_1;
+    A[522] = -0.0333333333333337*G1_0_1 - 0.0333333333333338*G1_2_1 - 0.0333333333333337*G4_0_1 - 0.0333333333333338*G4_2_1 - 0.0333333333333337*G7_0_1 - 0.0333333333333338*G7_2_1;
     A[523] = 0.1*G1_0_2 - 0.033333333333334*G1_2_2 + 0.1*G4_0_2 - 0.033333333333334*G4_2_2 + 0.1*G7_0_2 - 0.033333333333334*G7_2_2;
     A[524] = 0.266666666666667*G1_0_1 + 0.133333333333333*G1_0_2 + 0.133333333333335*G1_2_1 + 0.133333333333335*G1_2_2 + 0.266666666666667*G4_0_1 + 0.133333333333333*G4_0_2 + 0.133333333333335*G4_2_1 + 0.133333333333335*G4_2_2 + 0.266666666666667*G7_0_1 + 0.133333333333333*G7_0_2 + 0.133333333333335*G7_2_1 + 0.133333333333335*G7_2_2;
     A[525] = 0.266666666666667*G1_0_0 + 0.133333333333334*G1_0_2 + 0.133333333333334*G1_2_0 + 0.266666666666669*G1_2_2 + 0.266666666666667*G4_0_0 + 0.133333333333334*G4_0_2 + 0.133333333333334*G4_2_0 + 0.266666666666669*G4_2_2 + 0.266666666666667*G7_0_0 + 0.133333333333334*G7_0_2 + 0.133333333333334*G7_2_0 + 0.266666666666669*G7_2_2;
     A[526] = 0.133333333333333*G1_0_0 + 0.133333333333334*G1_0_1 + 0.133333333333334*G1_2_0 + 0.266666666666669*G1_2_1 + 0.133333333333333*G4_0_0 + 0.133333333333334*G4_0_1 + 0.133333333333334*G4_2_0 + 0.266666666666669*G4_2_1 + 0.133333333333333*G7_0_0 + 0.133333333333334*G7_0_1 + 0.133333333333334*G7_2_0 + 0.266666666666669*G7_2_1;
     A[527] = -0.266666666666667*G1_0_0 - 0.266666666666667*G1_0_1 - 0.133333333333334*G1_0_2 - 0.133333333333334*G1_2_0 - 0.133333333333335*G1_2_1 - 0.266666666666667*G4_0_0 - 0.266666666666667*G4_0_1 - 0.133333333333334*G4_0_2 - 0.133333333333334*G4_2_0 - 0.133333333333335*G4_2_1 - 0.266666666666667*G7_0_0 - 0.266666666666667*G7_0_1 - 0.133333333333334*G7_0_2 - 0.133333333333334*G7_2_0 - 0.133333333333335*G7_2_1;
-    A[528] = -0.133333333333334*G1_0_0 - 0.133333333333333*G1_0_2 - 0.133333333333334*G1_2_0 - 0.133333333333334*G1_2_2 - 0.133333333333334*G4_0_0 - 0.133333333333333*G4_0_2 - 0.133333333333334*G4_2_0 - 0.133333333333334*G4_2_2 - 0.133333333333334*G7_0_0 - 0.133333333333333*G7_0_2 - 0.133333333333334*G7_2_0 - 0.133333333333334*G7_2_2;
+    A[528] = -0.133333333333333*G1_0_0 - 0.133333333333333*G1_0_2 - 0.133333333333334*G1_2_0 - 0.133333333333334*G1_2_2 - 0.133333333333333*G4_0_0 - 0.133333333333333*G4_0_2 - 0.133333333333334*G4_2_0 - 0.133333333333334*G4_2_2 - 0.133333333333333*G7_0_0 - 0.133333333333333*G7_0_2 - 0.133333333333334*G7_2_0 - 0.133333333333334*G7_2_2;
     A[529] = -0.133333333333333*G1_0_1 - 0.133333333333333*G1_0_2 - 0.133333333333333*G1_2_0 - 0.266666666666668*G1_2_1 - 0.266666666666668*G1_2_2 - 0.133333333333333*G4_0_1 - 0.133333333333333*G4_0_2 - 0.133333333333333*G4_2_0 - 0.266666666666668*G4_2_1 - 0.266666666666668*G4_2_2 - 0.133333333333333*G7_0_1 - 0.133333333333333*G7_0_2 - 0.133333333333333*G7_2_0 - 0.266666666666668*G7_2_1 - 0.266666666666668*G7_2_2;
     A[530] = 0.0;
     A[531] = 0.0;
@@ -24190,15 +27268,15 @@ public:
     A[551] = 0.0;
     A[552] = 0.0;
     A[553] = 0.0;
-    A[554] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_0_1 + 0.0333333333333334*G1_0_2 + 0.0333333333333335*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333334*G1_1_2 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_0_1 + 0.0333333333333334*G4_0_2 + 0.0333333333333335*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333334*G4_1_2 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_0_1 + 0.0333333333333334*G7_0_2 + 0.0333333333333335*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0 [...]
+    A[554] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_0_1 + 0.0333333333333335*G1_0_2 + 0.0333333333333335*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333334*G1_1_2 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_0_1 + 0.0333333333333335*G4_0_2 + 0.0333333333333335*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333334*G4_1_2 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_0_1 + 0.0333333333333335*G7_0_2 + 0.0333333333333335*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0 [...]
     A[555] = -0.0333333333333336*G1_0_0 + 0.1*G1_1_0 - 0.0333333333333336*G4_0_0 + 0.1*G4_1_0 - 0.0333333333333336*G7_0_0 + 0.1*G7_1_0;
-    A[556] = 0.1*G1_0_1 - 0.0333333333333337*G1_1_1 + 0.1*G4_0_1 - 0.0333333333333337*G4_1_1 + 0.1*G7_0_1 - 0.0333333333333337*G7_1_1;
+    A[556] = 0.1*G1_0_1 - 0.0333333333333336*G1_1_1 + 0.1*G4_0_1 - 0.0333333333333336*G4_1_1 + 0.1*G7_0_1 - 0.0333333333333336*G7_1_1;
     A[557] = -0.0333333333333341*G1_0_2 - 0.0333333333333342*G1_1_2 - 0.0333333333333341*G4_0_2 - 0.0333333333333342*G4_1_2 - 0.0333333333333341*G7_0_2 - 0.0333333333333342*G7_1_2;
     A[558] = 0.133333333333334*G1_0_1 + 0.266666666666667*G1_0_2 + 0.133333333333334*G1_1_1 + 0.133333333333335*G1_1_2 + 0.133333333333334*G4_0_1 + 0.266666666666667*G4_0_2 + 0.133333333333334*G4_1_1 + 0.133333333333335*G4_1_2 + 0.133333333333334*G7_0_1 + 0.266666666666667*G7_0_2 + 0.133333333333334*G7_1_1 + 0.133333333333335*G7_1_2;
     A[559] = 0.133333333333333*G1_0_0 + 0.133333333333334*G1_0_2 + 0.133333333333334*G1_1_0 + 0.266666666666669*G1_1_2 + 0.133333333333333*G4_0_0 + 0.133333333333334*G4_0_2 + 0.133333333333334*G4_1_0 + 0.266666666666669*G4_1_2 + 0.133333333333333*G7_0_0 + 0.133333333333334*G7_0_2 + 0.133333333333334*G7_1_0 + 0.266666666666669*G7_1_2;
     A[560] = 0.266666666666667*G1_0_0 + 0.133333333333334*G1_0_1 + 0.133333333333334*G1_1_0 + 0.266666666666669*G1_1_1 + 0.266666666666667*G4_0_0 + 0.133333333333334*G4_0_1 + 0.133333333333334*G4_1_0 + 0.266666666666669*G4_1_1 + 0.266666666666667*G7_0_0 + 0.133333333333334*G7_0_1 + 0.133333333333334*G7_1_0 + 0.266666666666669*G7_1_1;
-    A[561] = -0.133333333333333*G1_0_0 - 0.133333333333334*G1_0_1 - 0.133333333333334*G1_1_0 - 0.133333333333334*G1_1_1 - 0.133333333333333*G4_0_0 - 0.133333333333334*G4_0_1 - 0.133333333333334*G4_1_0 - 0.133333333333334*G4_1_1 - 0.133333333333333*G7_0_0 - 0.133333333333334*G7_0_1 - 0.133333333333334*G7_1_0 - 0.133333333333334*G7_1_1;
-    A[562] = -0.266666666666667*G1_0_0 - 0.133333333333334*G1_0_1 - 0.266666666666667*G1_0_2 - 0.133333333333335*G1_1_0 - 0.133333333333334*G1_1_2 - 0.266666666666667*G4_0_0 - 0.133333333333334*G4_0_1 - 0.266666666666667*G4_0_2 - 0.133333333333335*G4_1_0 - 0.133333333333334*G4_1_2 - 0.266666666666667*G7_0_0 - 0.133333333333334*G7_0_1 - 0.266666666666667*G7_0_2 - 0.133333333333335*G7_1_0 - 0.133333333333334*G7_1_2;
+    A[561] = -0.133333333333333*G1_0_0 - 0.133333333333333*G1_0_1 - 0.133333333333334*G1_1_0 - 0.133333333333334*G1_1_1 - 0.133333333333333*G4_0_0 - 0.133333333333333*G4_0_1 - 0.133333333333334*G4_1_0 - 0.133333333333334*G4_1_1 - 0.133333333333333*G7_0_0 - 0.133333333333333*G7_0_1 - 0.133333333333334*G7_1_0 - 0.133333333333334*G7_1_1;
+    A[562] = -0.266666666666667*G1_0_0 - 0.133333333333333*G1_0_1 - 0.266666666666667*G1_0_2 - 0.133333333333334*G1_1_0 - 0.133333333333334*G1_1_2 - 0.266666666666667*G4_0_0 - 0.133333333333333*G4_0_1 - 0.266666666666667*G4_0_2 - 0.133333333333334*G4_1_0 - 0.133333333333334*G4_1_2 - 0.266666666666667*G7_0_0 - 0.133333333333333*G7_0_1 - 0.266666666666667*G7_0_2 - 0.133333333333334*G7_1_0 - 0.133333333333334*G7_1_2;
     A[563] = -0.133333333333334*G1_0_1 - 0.133333333333333*G1_0_2 - 0.133333333333333*G1_1_0 - 0.266666666666668*G1_1_1 - 0.266666666666668*G1_1_2 - 0.133333333333334*G4_0_1 - 0.133333333333333*G4_0_2 - 0.133333333333333*G4_1_0 - 0.266666666666668*G4_1_1 - 0.266666666666668*G4_1_2 - 0.133333333333334*G7_0_1 - 0.133333333333333*G7_0_2 - 0.133333333333333*G7_1_0 - 0.266666666666668*G7_1_1 - 0.266666666666668*G7_1_2;
     A[564] = 0.0;
     A[565] = 0.0;
@@ -24224,13 +27302,13 @@ public:
     A[585] = 0.0;
     A[586] = 0.0;
     A[587] = 0.0;
-    A[588] = -0.0333333333333335*G1_0_0 - 0.0333333333333335*G1_0_1 - 0.0333333333333334*G1_0_2 - 0.0333333333333335*G1_1_0 - 0.0333333333333335*G1_1_1 - 0.0333333333333334*G1_1_2 - 0.133333333333333*G1_2_0 - 0.133333333333334*G1_2_1 - 0.133333333333334*G1_2_2 - 0.0333333333333335*G4_0_0 - 0.0333333333333335*G4_0_1 - 0.0333333333333334*G4_0_2 - 0.0333333333333335*G4_1_0 - 0.0333333333333335*G4_1_1 - 0.0333333333333334*G4_1_2 - 0.133333333333333*G4_2_0 - 0.133333333333334*G4_2_1 - 0.13333 [...]
+    A[588] = -0.0333333333333335*G1_0_0 - 0.0333333333333335*G1_0_1 - 0.0333333333333335*G1_0_2 - 0.0333333333333335*G1_1_0 - 0.0333333333333335*G1_1_1 - 0.0333333333333335*G1_1_2 - 0.133333333333333*G1_2_0 - 0.133333333333333*G1_2_1 - 0.133333333333333*G1_2_2 - 0.0333333333333335*G4_0_0 - 0.0333333333333335*G4_0_1 - 0.0333333333333335*G4_0_2 - 0.0333333333333335*G4_1_0 - 0.0333333333333335*G4_1_1 - 0.0333333333333335*G4_1_2 - 0.133333333333333*G4_2_0 - 0.133333333333333*G4_2_1 - 0.13333 [...]
     A[589] = 0.0333333333333336*G1_0_0 + 0.0333333333333336*G1_1_0 + 0.0333333333333336*G4_0_0 + 0.0333333333333336*G4_1_0 + 0.0333333333333336*G7_0_0 + 0.0333333333333336*G7_1_0;
-    A[590] = 0.0333333333333338*G1_0_1 + 0.0333333333333338*G1_1_1 + 0.0333333333333338*G4_0_1 + 0.0333333333333338*G4_1_1 + 0.0333333333333338*G7_0_1 + 0.0333333333333338*G7_1_1;
+    A[590] = 0.0333333333333337*G1_0_1 + 0.0333333333333337*G1_1_1 + 0.0333333333333337*G4_0_1 + 0.0333333333333337*G4_1_1 + 0.0333333333333337*G7_0_1 + 0.0333333333333337*G7_1_1;
     A[591] = -0.1*G1_0_2 - 0.1*G1_1_2 - 0.133333333333334*G1_2_2 - 0.1*G4_0_2 - 0.1*G4_1_2 - 0.133333333333334*G4_2_2 - 0.1*G7_0_2 - 0.1*G7_1_2 - 0.133333333333334*G7_2_2;
     A[592] = -0.266666666666667*G1_0_1 - 0.133333333333333*G1_0_2 - 0.266666666666667*G1_1_1 - 0.133333333333333*G1_1_2 - 0.133333333333334*G1_2_1 - 0.266666666666667*G4_0_1 - 0.133333333333333*G4_0_2 - 0.266666666666667*G4_1_1 - 0.133333333333333*G4_1_2 - 0.133333333333334*G4_2_1 - 0.266666666666667*G7_0_1 - 0.133333333333333*G7_0_2 - 0.266666666666667*G7_1_1 - 0.133333333333333*G7_1_2 - 0.133333333333334*G7_2_1;
     A[593] = -0.266666666666667*G1_0_0 - 0.133333333333334*G1_0_2 - 0.266666666666667*G1_1_0 - 0.133333333333335*G1_1_2 - 0.133333333333334*G1_2_0 - 0.266666666666667*G4_0_0 - 0.133333333333334*G4_0_2 - 0.266666666666667*G4_1_0 - 0.133333333333335*G4_1_2 - 0.133333333333334*G4_2_0 - 0.266666666666667*G7_0_0 - 0.133333333333334*G7_0_2 - 0.266666666666667*G7_1_0 - 0.133333333333335*G7_1_2 - 0.133333333333334*G7_2_0;
-    A[594] = -0.133333333333333*G1_0_0 - 0.133333333333334*G1_0_1 - 0.133333333333334*G1_1_0 - 0.133333333333334*G1_1_1 - 0.133333333333333*G4_0_0 - 0.133333333333334*G4_0_1 - 0.133333333333334*G4_1_0 - 0.133333333333334*G4_1_1 - 0.133333333333333*G7_0_0 - 0.133333333333334*G7_0_1 - 0.133333333333334*G7_1_0 - 0.133333333333334*G7_1_1;
+    A[594] = -0.133333333333333*G1_0_0 - 0.133333333333334*G1_0_1 - 0.133333333333333*G1_1_0 - 0.133333333333334*G1_1_1 - 0.133333333333333*G4_0_0 - 0.133333333333334*G4_0_1 - 0.133333333333333*G4_1_0 - 0.133333333333334*G4_1_1 - 0.133333333333333*G7_0_0 - 0.133333333333334*G7_0_1 - 0.133333333333333*G7_1_0 - 0.133333333333334*G7_1_1;
     A[595] = 0.266666666666667*G1_0_0 + 0.266666666666667*G1_0_1 + 0.133333333333334*G1_0_2 + 0.266666666666667*G1_1_0 + 0.266666666666667*G1_1_1 + 0.133333333333334*G1_1_2 + 0.133333333333334*G1_2_0 + 0.133333333333334*G1_2_1 + 0.266666666666667*G1_2_2 + 0.266666666666667*G4_0_0 + 0.266666666666667*G4_0_1 + 0.133333333333334*G4_0_2 + 0.266666666666667*G4_1_0 + 0.266666666666667*G4_1_1 + 0.133333333333334*G4_1_2 + 0.133333333333334*G4_2_0 + 0.133333333333334*G4_2_1 + 0.266666666666667*G4 [...]
     A[596] = 0.133333333333334*G1_0_0 + 0.133333333333333*G1_0_2 + 0.133333333333334*G1_1_0 + 0.133333333333333*G1_1_2 + 0.133333333333334*G1_2_1 + 0.133333333333334*G4_0_0 + 0.133333333333333*G4_0_2 + 0.133333333333334*G4_1_0 + 0.133333333333333*G4_1_2 + 0.133333333333334*G4_2_1 + 0.133333333333334*G7_0_0 + 0.133333333333333*G7_0_2 + 0.133333333333334*G7_1_0 + 0.133333333333333*G7_1_2 + 0.133333333333334*G7_2_1;
     A[597] = 0.133333333333333*G1_0_1 + 0.133333333333333*G1_0_2 + 0.133333333333334*G1_1_1 + 0.133333333333334*G1_1_2 + 0.133333333333334*G1_2_0 + 0.133333333333333*G4_0_1 + 0.133333333333333*G4_0_2 + 0.133333333333334*G4_1_1 + 0.133333333333334*G4_1_2 + 0.133333333333334*G4_2_0 + 0.133333333333333*G7_0_1 + 0.133333333333333*G7_0_2 + 0.133333333333334*G7_1_1 + 0.133333333333334*G7_1_2 + 0.133333333333334*G7_2_0;
@@ -24258,14 +27336,14 @@ public:
     A[619] = 0.0;
     A[620] = 0.0;
     A[621] = 0.0;
-    A[622] = -0.0333333333333335*G1_0_0 - 0.0333333333333335*G1_0_1 - 0.0333333333333334*G1_0_2 - 0.133333333333333*G1_1_0 - 0.133333333333333*G1_1_1 - 0.133333333333333*G1_1_2 - 0.0333333333333335*G1_2_0 - 0.0333333333333334*G1_2_1 - 0.0333333333333334*G1_2_2 - 0.0333333333333335*G4_0_0 - 0.0333333333333335*G4_0_1 - 0.0333333333333334*G4_0_2 - 0.133333333333333*G4_1_0 - 0.133333333333333*G4_1_1 - 0.133333333333333*G4_1_2 - 0.0333333333333335*G4_2_0 - 0.0333333333333334*G4_2_1 - 0.033333 [...]
+    A[622] = -0.0333333333333335*G1_0_0 - 0.0333333333333335*G1_0_1 - 0.0333333333333334*G1_0_2 - 0.133333333333333*G1_1_0 - 0.133333333333333*G1_1_1 - 0.133333333333333*G1_1_2 - 0.0333333333333334*G1_2_0 - 0.0333333333333334*G1_2_1 - 0.0333333333333334*G1_2_2 - 0.0333333333333335*G4_0_0 - 0.0333333333333335*G4_0_1 - 0.0333333333333334*G4_0_2 - 0.133333333333333*G4_1_0 - 0.133333333333333*G4_1_1 - 0.133333333333333*G4_1_2 - 0.0333333333333334*G4_2_0 - 0.0333333333333334*G4_2_1 - 0.033333 [...]
     A[623] = 0.0333333333333336*G1_0_0 + 0.0333333333333336*G1_2_0 + 0.0333333333333336*G4_0_0 + 0.0333333333333336*G4_2_0 + 0.0333333333333336*G7_0_0 + 0.0333333333333336*G7_2_0;
     A[624] = -0.1*G1_0_1 - 0.133333333333333*G1_1_1 - 0.1*G1_2_1 - 0.1*G4_0_1 - 0.133333333333333*G4_1_1 - 0.1*G4_2_1 - 0.1*G7_0_1 - 0.133333333333333*G7_1_1 - 0.1*G7_2_1;
     A[625] = 0.0333333333333341*G1_0_2 + 0.0333333333333341*G1_2_2 + 0.0333333333333341*G4_0_2 + 0.0333333333333341*G4_2_2 + 0.0333333333333341*G7_0_2 + 0.0333333333333341*G7_2_2;
     A[626] = -0.133333333333334*G1_0_1 - 0.266666666666667*G1_0_2 - 0.133333333333333*G1_1_2 - 0.133333333333333*G1_2_1 - 0.266666666666667*G1_2_2 - 0.133333333333334*G4_0_1 - 0.266666666666667*G4_0_2 - 0.133333333333333*G4_1_2 - 0.133333333333333*G4_2_1 - 0.266666666666667*G4_2_2 - 0.133333333333334*G7_0_1 - 0.266666666666667*G7_0_2 - 0.133333333333333*G7_1_2 - 0.133333333333333*G7_2_1 - 0.266666666666667*G7_2_2;
     A[627] = -0.133333333333333*G1_0_0 - 0.133333333333334*G1_0_2 - 0.133333333333333*G1_2_0 - 0.133333333333334*G1_2_2 - 0.133333333333333*G4_0_0 - 0.133333333333334*G4_0_2 - 0.133333333333333*G4_2_0 - 0.133333333333334*G4_2_2 - 0.133333333333333*G7_0_0 - 0.133333333333334*G7_0_2 - 0.133333333333333*G7_2_0 - 0.133333333333334*G7_2_2;
-    A[628] = -0.266666666666667*G1_0_0 - 0.133333333333335*G1_0_1 - 0.133333333333333*G1_1_0 - 0.266666666666667*G1_2_0 - 0.133333333333334*G1_2_1 - 0.266666666666667*G4_0_0 - 0.133333333333335*G4_0_1 - 0.133333333333333*G4_1_0 - 0.266666666666667*G4_2_0 - 0.133333333333334*G4_2_1 - 0.266666666666667*G7_0_0 - 0.133333333333335*G7_0_1 - 0.133333333333333*G7_1_0 - 0.266666666666667*G7_2_0 - 0.133333333333334*G7_2_1;
-    A[629] = 0.133333333333334*G1_0_0 + 0.133333333333334*G1_0_1 + 0.133333333333334*G1_1_2 + 0.133333333333333*G1_2_0 + 0.133333333333333*G1_2_1 + 0.133333333333334*G4_0_0 + 0.133333333333334*G4_0_1 + 0.133333333333334*G4_1_2 + 0.133333333333333*G4_2_0 + 0.133333333333333*G4_2_1 + 0.133333333333334*G7_0_0 + 0.133333333333334*G7_0_1 + 0.133333333333334*G7_1_2 + 0.133333333333333*G7_2_0 + 0.133333333333333*G7_2_1;
+    A[628] = -0.266666666666667*G1_0_0 - 0.133333333333334*G1_0_1 - 0.133333333333333*G1_1_0 - 0.266666666666667*G1_2_0 - 0.133333333333334*G1_2_1 - 0.266666666666667*G4_0_0 - 0.133333333333334*G4_0_1 - 0.133333333333333*G4_1_0 - 0.266666666666667*G4_2_0 - 0.133333333333334*G4_2_1 - 0.266666666666667*G7_0_0 - 0.133333333333334*G7_0_1 - 0.133333333333333*G7_1_0 - 0.266666666666667*G7_2_0 - 0.133333333333334*G7_2_1;
+    A[629] = 0.133333333333333*G1_0_0 + 0.133333333333334*G1_0_1 + 0.133333333333334*G1_1_2 + 0.133333333333333*G1_2_0 + 0.133333333333333*G1_2_1 + 0.133333333333333*G4_0_0 + 0.133333333333334*G4_0_1 + 0.133333333333334*G4_1_2 + 0.133333333333333*G4_2_0 + 0.133333333333333*G4_2_1 + 0.133333333333333*G7_0_0 + 0.133333333333334*G7_0_1 + 0.133333333333334*G7_1_2 + 0.133333333333333*G7_2_0 + 0.133333333333333*G7_2_1;
     A[630] = 0.266666666666667*G1_0_0 + 0.133333333333334*G1_0_1 + 0.266666666666667*G1_0_2 + 0.133333333333334*G1_1_0 + 0.266666666666667*G1_1_1 + 0.133333333333333*G1_1_2 + 0.266666666666667*G1_2_0 + 0.133333333333333*G1_2_1 + 0.266666666666667*G1_2_2 + 0.266666666666667*G4_0_0 + 0.133333333333334*G4_0_1 + 0.266666666666667*G4_0_2 + 0.133333333333334*G4_1_0 + 0.266666666666667*G4_1_1 + 0.133333333333333*G4_1_2 + 0.266666666666667*G4_2_0 + 0.133333333333333*G4_2_1 + 0.266666666666667*G4 [...]
     A[631] = 0.133333333333334*G1_0_1 + 0.133333333333333*G1_0_2 + 0.133333333333333*G1_1_0 + 0.133333333333333*G1_2_1 + 0.133333333333333*G1_2_2 + 0.133333333333334*G4_0_1 + 0.133333333333333*G4_0_2 + 0.133333333333333*G4_1_0 + 0.133333333333333*G4_2_1 + 0.133333333333333*G4_2_2 + 0.133333333333334*G7_0_1 + 0.133333333333333*G7_0_2 + 0.133333333333333*G7_1_0 + 0.133333333333333*G7_2_1 + 0.133333333333333*G7_2_2;
     A[632] = 0.0;
@@ -24279,8 +27357,8 @@ public:
     A[640] = 0.0;
     A[641] = 0.0;
     A[642] = -0.0333333333333334*G11_0 + 0.0333333333333333*G11_1 - 0.0333333333333334*G11_2;
-    A[643] = -0.0333333333333334*G11_0 - 0.0333333333333333*G11_2;
-    A[644] = -0.0666666666666667*G11_0 - 0.0333333333333333*G11_1 - 0.0666666666666667*G11_2;
+    A[643] = -0.0333333333333333*G11_0 - 0.0333333333333333*G11_2;
+    A[644] = -0.0666666666666667*G11_0 - 0.0333333333333334*G11_1 - 0.0666666666666667*G11_2;
     A[645] = -0.0333333333333334*G11_0 - 0.0333333333333333*G11_2;
     A[646] = 0.0;
     A[647] = 0.0;
@@ -24292,7 +27370,7 @@ public:
     A[653] = 0.0;
     A[654] = 0.0;
     A[655] = 0.0;
-    A[656] = -0.133333333333333*G1_0_0 - 0.133333333333333*G1_0_1 - 0.133333333333333*G1_0_2 - 0.0333333333333335*G1_1_0 - 0.0333333333333335*G1_1_1 - 0.0333333333333335*G1_1_2 - 0.0333333333333335*G1_2_0 - 0.0333333333333335*G1_2_1 - 0.0333333333333334*G1_2_2 - 0.133333333333333*G4_0_0 - 0.133333333333333*G4_0_1 - 0.133333333333333*G4_0_2 - 0.0333333333333335*G4_1_0 - 0.0333333333333335*G4_1_1 - 0.0333333333333335*G4_1_2 - 0.0333333333333335*G4_2_0 - 0.0333333333333335*G4_2_1 - 0.033333 [...]
+    A[656] = -0.133333333333333*G1_0_0 - 0.133333333333333*G1_0_1 - 0.133333333333333*G1_0_2 - 0.0333333333333334*G1_1_0 - 0.0333333333333335*G1_1_1 - 0.0333333333333334*G1_1_2 - 0.0333333333333334*G1_2_0 - 0.0333333333333335*G1_2_1 - 0.0333333333333334*G1_2_2 - 0.133333333333333*G4_0_0 - 0.133333333333333*G4_0_1 - 0.133333333333333*G4_0_2 - 0.0333333333333334*G4_1_0 - 0.0333333333333335*G4_1_1 - 0.0333333333333334*G4_1_2 - 0.0333333333333334*G4_2_0 - 0.0333333333333335*G4_2_1 - 0.033333 [...]
     A[657] = -0.133333333333333*G1_0_0 - 0.1*G1_1_0 - 0.1*G1_2_0 - 0.133333333333333*G4_0_0 - 0.1*G4_1_0 - 0.1*G4_2_0 - 0.133333333333333*G7_0_0 - 0.1*G7_1_0 - 0.1*G7_2_0;
     A[658] = 0.0333333333333337*G1_1_1 + 0.0333333333333338*G1_2_1 + 0.0333333333333337*G4_1_1 + 0.0333333333333338*G4_2_1 + 0.0333333333333337*G7_1_1 + 0.0333333333333338*G7_2_1;
     A[659] = 0.0333333333333341*G1_1_2 + 0.033333333333334*G1_2_2 + 0.0333333333333341*G4_1_2 + 0.033333333333334*G4_2_2 + 0.0333333333333341*G7_1_2 + 0.033333333333334*G7_2_2;
@@ -24315,7 +27393,7 @@ public:
     A[676] = 0.0333333333333333*G11_0 - 0.0333333333333334*G11_1 - 0.0333333333333334*G11_2;
     A[677] = -0.0333333333333333*G11_0 - 0.0666666666666667*G11_1 - 0.0666666666666667*G11_2;
     A[678] = -0.0333333333333334*G11_1 - 0.0333333333333333*G11_2;
-    A[679] = -0.0333333333333333*G11_1 - 0.0333333333333333*G11_2;
+    A[679] = -0.0333333333333334*G11_1 - 0.0333333333333333*G11_2;
     A[680] = 0.0;
     A[681] = 0.0;
     A[682] = 0.0;
@@ -24340,16 +27418,16 @@ public:
     A[701] = 0.0333333333333333*G2_0_0 + 0.0333333333333333*G2_1_0 + 0.0333333333333333*G2_2_0 + 0.0333333333333333*G5_0_0 + 0.0333333333333333*G5_1_0 + 0.0333333333333333*G5_2_0 + 0.0333333333333333*G8_0_0 + 0.0333333333333333*G8_1_0 + 0.0333333333333333*G8_2_0;
     A[702] = 0.0333333333333334*G2_0_1 + 0.0333333333333333*G2_1_1 + 0.0333333333333333*G2_2_1 + 0.0333333333333334*G5_0_1 + 0.0333333333333333*G5_1_1 + 0.0333333333333333*G5_2_1 + 0.0333333333333334*G8_0_1 + 0.0333333333333333*G8_1_1 + 0.0333333333333333*G8_2_1;
     A[703] = 0.0333333333333334*G2_0_2 + 0.0333333333333334*G2_1_2 + 0.0333333333333334*G2_2_2 + 0.0333333333333334*G5_0_2 + 0.0333333333333334*G5_1_2 + 0.0333333333333334*G5_2_2 + 0.0333333333333334*G8_0_2 + 0.0333333333333334*G8_1_2 + 0.0333333333333334*G8_2_2;
-    A[704] = 0.0333333333333335*G2_0_1 + 0.0333333333333335*G2_0_2 + 0.0333333333333335*G2_1_1 + 0.0333333333333334*G2_1_2 + 0.0333333333333334*G2_2_1 + 0.0333333333333334*G2_2_2 + 0.0333333333333335*G5_0_1 + 0.0333333333333335*G5_0_2 + 0.0333333333333335*G5_1_1 + 0.0333333333333334*G5_1_2 + 0.0333333333333334*G5_2_1 + 0.0333333333333334*G5_2_2 + 0.0333333333333335*G8_0_1 + 0.0333333333333335*G8_0_2 + 0.0333333333333335*G8_1_1 + 0.0333333333333334*G8_1_2 + 0.0333333333333334*G8_2_1 + 0.0 [...]
+    A[704] = 0.0333333333333335*G2_0_1 + 0.0333333333333334*G2_0_2 + 0.0333333333333335*G2_1_1 + 0.0333333333333334*G2_1_2 + 0.0333333333333335*G2_2_1 + 0.0333333333333334*G2_2_2 + 0.0333333333333335*G5_0_1 + 0.0333333333333334*G5_0_2 + 0.0333333333333335*G5_1_1 + 0.0333333333333334*G5_1_2 + 0.0333333333333335*G5_2_1 + 0.0333333333333334*G5_2_2 + 0.0333333333333335*G8_0_1 + 0.0333333333333334*G8_0_2 + 0.0333333333333335*G8_1_1 + 0.0333333333333334*G8_1_2 + 0.0333333333333335*G8_2_1 + 0.0 [...]
     A[705] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_0_2 + 0.0333333333333335*G2_1_0 + 0.0333333333333336*G2_1_2 + 0.0333333333333335*G2_2_0 + 0.0333333333333335*G2_2_2 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_0_2 + 0.0333333333333335*G5_1_0 + 0.0333333333333336*G5_1_2 + 0.0333333333333335*G5_2_0 + 0.0333333333333335*G5_2_2 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_0_2 + 0.0333333333333335*G8_1_0 + 0.0333333333333336*G8_1_2 + 0.0333333333333335*G8_2_0 + 0.0 [...]
-    A[706] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_0_1 + 0.0333333333333335*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333334*G2_2_0 + 0.0333333333333334*G2_2_1 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_0_1 + 0.0333333333333335*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333334*G5_2_0 + 0.0333333333333334*G5_2_1 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_0_1 + 0.0333333333333335*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0333333333333334*G8_2_0 + 0.0 [...]
-    A[707] = -0.0333333333333335*G2_0_0 - 0.0333333333333335*G2_0_1 - 0.133333333333333*G2_0_2 - 0.0333333333333335*G2_1_0 - 0.0333333333333335*G2_1_1 - 0.133333333333334*G2_1_2 - 0.0333333333333334*G2_2_0 - 0.0333333333333334*G2_2_1 - 0.133333333333334*G2_2_2 - 0.0333333333333335*G5_0_0 - 0.0333333333333335*G5_0_1 - 0.133333333333333*G5_0_2 - 0.0333333333333335*G5_1_0 - 0.0333333333333335*G5_1_1 - 0.133333333333334*G5_1_2 - 0.0333333333333334*G5_2_0 - 0.0333333333333334*G5_2_1 - 0.13333 [...]
+    A[706] = 0.0333333333333335*G2_0_0 + 0.0333333333333334*G2_0_1 + 0.0333333333333335*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333335*G2_2_0 + 0.0333333333333334*G2_2_1 + 0.0333333333333335*G5_0_0 + 0.0333333333333334*G5_0_1 + 0.0333333333333335*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333335*G5_2_0 + 0.0333333333333334*G5_2_1 + 0.0333333333333335*G8_0_0 + 0.0333333333333334*G8_0_1 + 0.0333333333333335*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0333333333333335*G8_2_0 + 0.0 [...]
+    A[707] = -0.0333333333333335*G2_0_0 - 0.0333333333333335*G2_0_1 - 0.133333333333333*G2_0_2 - 0.0333333333333335*G2_1_0 - 0.0333333333333335*G2_1_1 - 0.133333333333333*G2_1_2 - 0.0333333333333334*G2_2_0 - 0.0333333333333334*G2_2_1 - 0.133333333333333*G2_2_2 - 0.0333333333333335*G5_0_0 - 0.0333333333333335*G5_0_1 - 0.133333333333333*G5_0_2 - 0.0333333333333335*G5_1_0 - 0.0333333333333335*G5_1_1 - 0.133333333333333*G5_1_2 - 0.0333333333333334*G5_2_0 - 0.0333333333333334*G5_2_1 - 0.13333 [...]
     A[708] = -0.0333333333333335*G2_0_0 - 0.133333333333333*G2_0_1 - 0.0333333333333335*G2_0_2 - 0.0333333333333335*G2_1_0 - 0.133333333333333*G2_1_1 - 0.0333333333333334*G2_1_2 - 0.0333333333333334*G2_2_0 - 0.133333333333333*G2_2_1 - 0.0333333333333334*G2_2_2 - 0.0333333333333335*G5_0_0 - 0.133333333333333*G5_0_1 - 0.0333333333333335*G5_0_2 - 0.0333333333333335*G5_1_0 - 0.133333333333333*G5_1_1 - 0.0333333333333334*G5_1_2 - 0.0333333333333334*G5_2_0 - 0.133333333333333*G5_2_1 - 0.033333 [...]
-    A[709] = -0.133333333333333*G2_0_0 - 0.0333333333333335*G2_0_1 - 0.0333333333333335*G2_0_2 - 0.133333333333333*G2_1_0 - 0.0333333333333335*G2_1_1 - 0.0333333333333335*G2_1_2 - 0.133333333333333*G2_2_0 - 0.0333333333333335*G2_2_1 - 0.0333333333333335*G2_2_2 - 0.133333333333333*G5_0_0 - 0.0333333333333335*G5_0_1 - 0.0333333333333335*G5_0_2 - 0.133333333333333*G5_1_0 - 0.0333333333333335*G5_1_1 - 0.0333333333333335*G5_1_2 - 0.133333333333333*G5_2_0 - 0.0333333333333335*G5_2_1 - 0.033333 [...]
+    A[709] = -0.133333333333333*G2_0_0 - 0.0333333333333334*G2_0_1 - 0.0333333333333334*G2_0_2 - 0.133333333333333*G2_1_0 - 0.0333333333333335*G2_1_1 - 0.0333333333333335*G2_1_2 - 0.133333333333333*G2_2_0 - 0.0333333333333334*G2_2_1 - 0.0333333333333334*G2_2_2 - 0.133333333333333*G5_0_0 - 0.0333333333333334*G5_0_1 - 0.0333333333333334*G5_0_2 - 0.133333333333333*G5_1_0 - 0.0333333333333335*G5_1_1 - 0.0333333333333335*G5_1_2 - 0.133333333333333*G5_2_0 - 0.0333333333333334*G5_2_1 - 0.033333 [...]
     A[710] = -0.025*G9_0 - 0.025*G9_1 - 0.025*G9_2;
     A[711] = 0.00833333333333336*G9_0 + 0.00833333333333338*G9_1 + 0.00833333333333336*G9_2;
     A[712] = 0.00833333333333337*G9_0 + 0.00833333333333337*G9_1 + 0.00833333333333335*G9_2;
-    A[713] = 0.00833333333333337*G9_0 + 0.00833333333333337*G9_1 + 0.00833333333333335*G9_2;
+    A[713] = 0.00833333333333337*G9_0 + 0.00833333333333338*G9_1 + 0.00833333333333336*G9_2;
     A[714] = 0.0;
     A[715] = 0.0;
     A[716] = 0.0;
@@ -24378,11 +27456,11 @@ public:
     A[739] = -0.0333333333333336*G2_0_0 + 0.1*G2_0_2 - 0.0333333333333336*G5_0_0 + 0.1*G5_0_2 - 0.0333333333333336*G8_0_0 + 0.1*G8_0_2;
     A[740] = -0.0333333333333336*G2_0_0 + 0.1*G2_0_1 - 0.0333333333333336*G5_0_0 + 0.1*G5_0_1 - 0.0333333333333336*G8_0_0 + 0.1*G8_0_1;
     A[741] = 0.0333333333333336*G2_0_0 + 0.0333333333333336*G2_0_1 + 0.0333333333333336*G5_0_0 + 0.0333333333333336*G5_0_1 + 0.0333333333333336*G8_0_0 + 0.0333333333333336*G8_0_1;
-    A[742] = 0.0333333333333337*G2_0_0 + 0.0333333333333336*G2_0_2 + 0.0333333333333337*G5_0_0 + 0.0333333333333336*G5_0_2 + 0.0333333333333337*G8_0_0 + 0.0333333333333336*G8_0_2;
+    A[742] = 0.0333333333333336*G2_0_0 + 0.0333333333333335*G2_0_2 + 0.0333333333333336*G5_0_0 + 0.0333333333333335*G5_0_2 + 0.0333333333333336*G8_0_0 + 0.0333333333333335*G8_0_2;
     A[743] = -0.133333333333333*G2_0_0 - 0.1*G2_0_1 - 0.1*G2_0_2 - 0.133333333333333*G5_0_0 - 0.1*G5_0_1 - 0.1*G5_0_2 - 0.133333333333333*G8_0_0 - 0.1*G8_0_1 - 0.1*G8_0_2;
     A[744] = -0.00833333333333338*G9_0;
-    A[745] = 0.0249999999999999*G9_0;
-    A[746] = -0.0083333333333334*G9_0;
+    A[745] = 0.025*G9_0;
+    A[746] = -0.00833333333333339*G9_0;
     A[747] = -0.00833333333333339*G9_0;
     A[748] = 0.0;
     A[749] = 0.0;
@@ -24409,13 +27487,13 @@ public:
     A[770] = 0.1*G2_1_1 + 0.1*G5_1_1 + 0.1*G8_1_1;
     A[771] = -0.0333333333333333*G2_1_2 - 0.0333333333333333*G5_1_2 - 0.0333333333333333*G8_1_2;
     A[772] = -0.0333333333333337*G2_1_1 + 0.1*G2_1_2 - 0.0333333333333337*G5_1_1 + 0.1*G5_1_2 - 0.0333333333333337*G8_1_1 + 0.1*G8_1_2;
-    A[773] = -0.0333333333333338*G2_1_0 - 0.0333333333333338*G2_1_2 - 0.0333333333333338*G5_1_0 - 0.0333333333333338*G5_1_2 - 0.0333333333333338*G8_1_0 - 0.0333333333333338*G8_1_2;
-    A[774] = 0.1*G2_1_0 - 0.0333333333333337*G2_1_1 + 0.1*G5_1_0 - 0.0333333333333337*G5_1_1 + 0.1*G8_1_0 - 0.0333333333333337*G8_1_1;
-    A[775] = 0.0333333333333338*G2_1_0 + 0.0333333333333338*G2_1_1 + 0.0333333333333338*G5_1_0 + 0.0333333333333338*G5_1_1 + 0.0333333333333338*G8_1_0 + 0.0333333333333338*G8_1_1;
+    A[773] = -0.0333333333333337*G2_1_0 - 0.0333333333333338*G2_1_2 - 0.0333333333333337*G5_1_0 - 0.0333333333333338*G5_1_2 - 0.0333333333333337*G8_1_0 - 0.0333333333333338*G8_1_2;
+    A[774] = 0.1*G2_1_0 - 0.0333333333333336*G2_1_1 + 0.1*G5_1_0 - 0.0333333333333336*G5_1_1 + 0.1*G8_1_0 - 0.0333333333333336*G8_1_1;
+    A[775] = 0.0333333333333337*G2_1_0 + 0.0333333333333337*G2_1_1 + 0.0333333333333337*G5_1_0 + 0.0333333333333337*G5_1_1 + 0.0333333333333337*G8_1_0 + 0.0333333333333337*G8_1_1;
     A[776] = -0.1*G2_1_0 - 0.133333333333333*G2_1_1 - 0.1*G2_1_2 - 0.1*G5_1_0 - 0.133333333333333*G5_1_1 - 0.1*G5_1_2 - 0.1*G8_1_0 - 0.133333333333333*G8_1_1 - 0.1*G8_1_2;
     A[777] = 0.0333333333333337*G2_1_1 + 0.0333333333333338*G2_1_2 + 0.0333333333333337*G5_1_1 + 0.0333333333333338*G5_1_2 + 0.0333333333333337*G8_1_1 + 0.0333333333333338*G8_1_2;
-    A[778] = -0.00833333333333345*G9_1;
-    A[779] = -0.00833333333333344*G9_1;
+    A[778] = -0.00833333333333343*G9_1;
+    A[779] = -0.00833333333333343*G9_1;
     A[780] = 0.0249999999999999*G9_1;
     A[781] = -0.00833333333333343*G9_1;
     A[782] = 0.0;
@@ -24472,7 +27550,7 @@ public:
     A[833] = 0.0;
     A[834] = 0.0;
     A[835] = 0.0;
-    A[836] = 0.0333333333333335*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333334*G2_1_2 + 0.0333333333333335*G2_2_0 + 0.0333333333333334*G2_2_1 + 0.0333333333333334*G2_2_2 + 0.0333333333333335*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333334*G5_1_2 + 0.0333333333333335*G5_2_0 + 0.0333333333333334*G5_2_1 + 0.0333333333333334*G5_2_2 + 0.0333333333333335*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0333333333333334*G8_1_2 + 0.0333333333333335*G8_2_0 + 0.0333333333333334*G8_2_1 + 0.0 [...]
+    A[836] = 0.0333333333333335*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333335*G2_1_2 + 0.0333333333333334*G2_2_0 + 0.0333333333333334*G2_2_1 + 0.0333333333333334*G2_2_2 + 0.0333333333333335*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333335*G5_1_2 + 0.0333333333333334*G5_2_0 + 0.0333333333333334*G5_2_1 + 0.0333333333333334*G5_2_2 + 0.0333333333333335*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0333333333333335*G8_1_2 + 0.0333333333333334*G8_2_0 + 0.0333333333333334*G8_2_1 + 0.0 [...]
     A[837] = -0.0333333333333336*G2_1_0 - 0.0333333333333335*G2_2_0 - 0.0333333333333336*G5_1_0 - 0.0333333333333335*G5_2_0 - 0.0333333333333336*G8_1_0 - 0.0333333333333335*G8_2_0;
     A[838] = -0.0333333333333337*G2_1_1 + 0.1*G2_2_1 - 0.0333333333333337*G5_1_1 + 0.1*G5_2_1 - 0.0333333333333337*G8_1_1 + 0.1*G8_2_1;
     A[839] = 0.1*G2_1_2 - 0.0333333333333343*G2_2_2 + 0.1*G5_1_2 - 0.0333333333333343*G5_2_2 + 0.1*G8_1_2 - 0.0333333333333343*G8_2_2;
@@ -24508,13 +27586,13 @@ public:
     A[869] = 0.0;
     A[870] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_0_1 + 0.0333333333333335*G2_0_2 + 0.0333333333333335*G2_2_0 + 0.0333333333333336*G2_2_1 + 0.0333333333333335*G2_2_2 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_0_1 + 0.0333333333333335*G5_0_2 + 0.0333333333333335*G5_2_0 + 0.0333333333333336*G5_2_1 + 0.0333333333333335*G5_2_2 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_0_1 + 0.0333333333333335*G8_0_2 + 0.0333333333333335*G8_2_0 + 0.0333333333333336*G8_2_1 + 0.0 [...]
     A[871] = -0.0333333333333336*G2_0_0 + 0.1*G2_2_0 - 0.0333333333333336*G5_0_0 + 0.1*G5_2_0 - 0.0333333333333336*G8_0_0 + 0.1*G8_2_0;
-    A[872] = -0.0333333333333338*G2_0_1 - 0.0333333333333338*G2_2_1 - 0.0333333333333338*G5_0_1 - 0.0333333333333338*G5_2_1 - 0.0333333333333338*G8_0_1 - 0.0333333333333338*G8_2_1;
+    A[872] = -0.0333333333333337*G2_0_1 - 0.0333333333333338*G2_2_1 - 0.0333333333333337*G5_0_1 - 0.0333333333333338*G5_2_1 - 0.0333333333333337*G8_0_1 - 0.0333333333333338*G8_2_1;
     A[873] = 0.1*G2_0_2 - 0.033333333333334*G2_2_2 + 0.1*G5_0_2 - 0.033333333333334*G5_2_2 + 0.1*G8_0_2 - 0.033333333333334*G8_2_2;
     A[874] = 0.266666666666667*G2_0_1 + 0.133333333333333*G2_0_2 + 0.133333333333335*G2_2_1 + 0.133333333333335*G2_2_2 + 0.266666666666667*G5_0_1 + 0.133333333333333*G5_0_2 + 0.133333333333335*G5_2_1 + 0.133333333333335*G5_2_2 + 0.266666666666667*G8_0_1 + 0.133333333333333*G8_0_2 + 0.133333333333335*G8_2_1 + 0.133333333333335*G8_2_2;
     A[875] = 0.266666666666667*G2_0_0 + 0.133333333333334*G2_0_2 + 0.133333333333334*G2_2_0 + 0.266666666666669*G2_2_2 + 0.266666666666667*G5_0_0 + 0.133333333333334*G5_0_2 + 0.133333333333334*G5_2_0 + 0.266666666666669*G5_2_2 + 0.266666666666667*G8_0_0 + 0.133333333333334*G8_0_2 + 0.133333333333334*G8_2_0 + 0.266666666666669*G8_2_2;
     A[876] = 0.133333333333333*G2_0_0 + 0.133333333333334*G2_0_1 + 0.133333333333334*G2_2_0 + 0.266666666666669*G2_2_1 + 0.133333333333333*G5_0_0 + 0.133333333333334*G5_0_1 + 0.133333333333334*G5_2_0 + 0.266666666666669*G5_2_1 + 0.133333333333333*G8_0_0 + 0.133333333333334*G8_0_1 + 0.133333333333334*G8_2_0 + 0.266666666666669*G8_2_1;
     A[877] = -0.266666666666667*G2_0_0 - 0.266666666666667*G2_0_1 - 0.133333333333334*G2_0_2 - 0.133333333333334*G2_2_0 - 0.133333333333335*G2_2_1 - 0.266666666666667*G5_0_0 - 0.266666666666667*G5_0_1 - 0.133333333333334*G5_0_2 - 0.133333333333334*G5_2_0 - 0.133333333333335*G5_2_1 - 0.266666666666667*G8_0_0 - 0.266666666666667*G8_0_1 - 0.133333333333334*G8_0_2 - 0.133333333333334*G8_2_0 - 0.133333333333335*G8_2_1;
-    A[878] = -0.133333333333334*G2_0_0 - 0.133333333333333*G2_0_2 - 0.133333333333334*G2_2_0 - 0.133333333333334*G2_2_2 - 0.133333333333334*G5_0_0 - 0.133333333333333*G5_0_2 - 0.133333333333334*G5_2_0 - 0.133333333333334*G5_2_2 - 0.133333333333334*G8_0_0 - 0.133333333333333*G8_0_2 - 0.133333333333334*G8_2_0 - 0.133333333333334*G8_2_2;
+    A[878] = -0.133333333333333*G2_0_0 - 0.133333333333333*G2_0_2 - 0.133333333333334*G2_2_0 - 0.133333333333334*G2_2_2 - 0.133333333333333*G5_0_0 - 0.133333333333333*G5_0_2 - 0.133333333333334*G5_2_0 - 0.133333333333334*G5_2_2 - 0.133333333333333*G8_0_0 - 0.133333333333333*G8_0_2 - 0.133333333333334*G8_2_0 - 0.133333333333334*G8_2_2;
     A[879] = -0.133333333333333*G2_0_1 - 0.133333333333333*G2_0_2 - 0.133333333333333*G2_2_0 - 0.266666666666668*G2_2_1 - 0.266666666666668*G2_2_2 - 0.133333333333333*G5_0_1 - 0.133333333333333*G5_0_2 - 0.133333333333333*G5_2_0 - 0.266666666666668*G5_2_1 - 0.266666666666668*G5_2_2 - 0.133333333333333*G8_0_1 - 0.133333333333333*G8_0_2 - 0.133333333333333*G8_2_0 - 0.266666666666668*G8_2_1 - 0.266666666666668*G8_2_2;
     A[880] = 0.0333333333333334*G9_0 + 0.0333333333333336*G9_2;
     A[881] = 0.0333333333333333*G9_0 + 0.0666666666666669*G9_2;
@@ -24540,15 +27618,15 @@ public:
     A[901] = 0.0;
     A[902] = 0.0;
     A[903] = 0.0;
-    A[904] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_0_1 + 0.0333333333333334*G2_0_2 + 0.0333333333333335*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333334*G2_1_2 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_0_1 + 0.0333333333333334*G5_0_2 + 0.0333333333333335*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333334*G5_1_2 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_0_1 + 0.0333333333333334*G8_0_2 + 0.0333333333333335*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0 [...]
+    A[904] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_0_1 + 0.0333333333333335*G2_0_2 + 0.0333333333333335*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333334*G2_1_2 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_0_1 + 0.0333333333333335*G5_0_2 + 0.0333333333333335*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333334*G5_1_2 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_0_1 + 0.0333333333333335*G8_0_2 + 0.0333333333333335*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0 [...]
     A[905] = -0.0333333333333336*G2_0_0 + 0.1*G2_1_0 - 0.0333333333333336*G5_0_0 + 0.1*G5_1_0 - 0.0333333333333336*G8_0_0 + 0.1*G8_1_0;
-    A[906] = 0.1*G2_0_1 - 0.0333333333333337*G2_1_1 + 0.1*G5_0_1 - 0.0333333333333337*G5_1_1 + 0.1*G8_0_1 - 0.0333333333333337*G8_1_1;
+    A[906] = 0.1*G2_0_1 - 0.0333333333333336*G2_1_1 + 0.1*G5_0_1 - 0.0333333333333336*G5_1_1 + 0.1*G8_0_1 - 0.0333333333333336*G8_1_1;
     A[907] = -0.0333333333333341*G2_0_2 - 0.0333333333333342*G2_1_2 - 0.0333333333333341*G5_0_2 - 0.0333333333333342*G5_1_2 - 0.0333333333333341*G8_0_2 - 0.0333333333333342*G8_1_2;
     A[908] = 0.133333333333334*G2_0_1 + 0.266666666666667*G2_0_2 + 0.133333333333334*G2_1_1 + 0.133333333333335*G2_1_2 + 0.133333333333334*G5_0_1 + 0.266666666666667*G5_0_2 + 0.133333333333334*G5_1_1 + 0.133333333333335*G5_1_2 + 0.133333333333334*G8_0_1 + 0.266666666666667*G8_0_2 + 0.133333333333334*G8_1_1 + 0.133333333333335*G8_1_2;
     A[909] = 0.133333333333333*G2_0_0 + 0.133333333333334*G2_0_2 + 0.133333333333334*G2_1_0 + 0.266666666666669*G2_1_2 + 0.133333333333333*G5_0_0 + 0.133333333333334*G5_0_2 + 0.133333333333334*G5_1_0 + 0.266666666666669*G5_1_2 + 0.133333333333333*G8_0_0 + 0.133333333333334*G8_0_2 + 0.133333333333334*G8_1_0 + 0.266666666666669*G8_1_2;
     A[910] = 0.266666666666667*G2_0_0 + 0.133333333333334*G2_0_1 + 0.133333333333334*G2_1_0 + 0.266666666666669*G2_1_1 + 0.266666666666667*G5_0_0 + 0.133333333333334*G5_0_1 + 0.133333333333334*G5_1_0 + 0.266666666666669*G5_1_1 + 0.266666666666667*G8_0_0 + 0.133333333333334*G8_0_1 + 0.133333333333334*G8_1_0 + 0.266666666666669*G8_1_1;
-    A[911] = -0.133333333333333*G2_0_0 - 0.133333333333334*G2_0_1 - 0.133333333333334*G2_1_0 - 0.133333333333334*G2_1_1 - 0.133333333333333*G5_0_0 - 0.133333333333334*G5_0_1 - 0.133333333333334*G5_1_0 - 0.133333333333334*G5_1_1 - 0.133333333333333*G8_0_0 - 0.133333333333334*G8_0_1 - 0.133333333333334*G8_1_0 - 0.133333333333334*G8_1_1;
-    A[912] = -0.266666666666667*G2_0_0 - 0.133333333333334*G2_0_1 - 0.266666666666667*G2_0_2 - 0.133333333333335*G2_1_0 - 0.133333333333334*G2_1_2 - 0.266666666666667*G5_0_0 - 0.133333333333334*G5_0_1 - 0.266666666666667*G5_0_2 - 0.133333333333335*G5_1_0 - 0.133333333333334*G5_1_2 - 0.266666666666667*G8_0_0 - 0.133333333333334*G8_0_1 - 0.266666666666667*G8_0_2 - 0.133333333333335*G8_1_0 - 0.133333333333334*G8_1_2;
+    A[911] = -0.133333333333333*G2_0_0 - 0.133333333333333*G2_0_1 - 0.133333333333334*G2_1_0 - 0.133333333333334*G2_1_1 - 0.133333333333333*G5_0_0 - 0.133333333333333*G5_0_1 - 0.133333333333334*G5_1_0 - 0.133333333333334*G5_1_1 - 0.133333333333333*G8_0_0 - 0.133333333333333*G8_0_1 - 0.133333333333334*G8_1_0 - 0.133333333333334*G8_1_1;
+    A[912] = -0.266666666666667*G2_0_0 - 0.133333333333333*G2_0_1 - 0.266666666666667*G2_0_2 - 0.133333333333334*G2_1_0 - 0.133333333333334*G2_1_2 - 0.266666666666667*G5_0_0 - 0.133333333333333*G5_0_1 - 0.266666666666667*G5_0_2 - 0.133333333333334*G5_1_0 - 0.133333333333334*G5_1_2 - 0.266666666666667*G8_0_0 - 0.133333333333333*G8_0_1 - 0.266666666666667*G8_0_2 - 0.133333333333334*G8_1_0 - 0.133333333333334*G8_1_2;
     A[913] = -0.133333333333334*G2_0_1 - 0.133333333333333*G2_0_2 - 0.133333333333333*G2_1_0 - 0.266666666666668*G2_1_1 - 0.266666666666668*G2_1_2 - 0.133333333333334*G5_0_1 - 0.133333333333333*G5_0_2 - 0.133333333333333*G5_1_0 - 0.266666666666668*G5_1_1 - 0.266666666666668*G5_1_2 - 0.133333333333334*G8_0_1 - 0.133333333333333*G8_0_2 - 0.133333333333333*G8_1_0 - 0.266666666666668*G8_1_1 - 0.266666666666668*G8_1_2;
     A[914] = 0.0333333333333334*G9_0 + 0.0333333333333336*G9_1;
     A[915] = 0.0333333333333333*G9_0 + 0.0666666666666669*G9_1;
@@ -24574,13 +27652,13 @@ public:
     A[935] = 0.0;
     A[936] = 0.0;
     A[937] = 0.0;
-    A[938] = -0.0333333333333335*G2_0_0 - 0.0333333333333335*G2_0_1 - 0.0333333333333334*G2_0_2 - 0.0333333333333335*G2_1_0 - 0.0333333333333335*G2_1_1 - 0.0333333333333334*G2_1_2 - 0.133333333333333*G2_2_0 - 0.133333333333334*G2_2_1 - 0.133333333333334*G2_2_2 - 0.0333333333333335*G5_0_0 - 0.0333333333333335*G5_0_1 - 0.0333333333333334*G5_0_2 - 0.0333333333333335*G5_1_0 - 0.0333333333333335*G5_1_1 - 0.0333333333333334*G5_1_2 - 0.133333333333333*G5_2_0 - 0.133333333333334*G5_2_1 - 0.13333 [...]
+    A[938] = -0.0333333333333335*G2_0_0 - 0.0333333333333335*G2_0_1 - 0.0333333333333335*G2_0_2 - 0.0333333333333335*G2_1_0 - 0.0333333333333335*G2_1_1 - 0.0333333333333335*G2_1_2 - 0.133333333333333*G2_2_0 - 0.133333333333333*G2_2_1 - 0.133333333333333*G2_2_2 - 0.0333333333333335*G5_0_0 - 0.0333333333333335*G5_0_1 - 0.0333333333333335*G5_0_2 - 0.0333333333333335*G5_1_0 - 0.0333333333333335*G5_1_1 - 0.0333333333333335*G5_1_2 - 0.133333333333333*G5_2_0 - 0.133333333333333*G5_2_1 - 0.13333 [...]
     A[939] = 0.0333333333333336*G2_0_0 + 0.0333333333333336*G2_1_0 + 0.0333333333333336*G5_0_0 + 0.0333333333333336*G5_1_0 + 0.0333333333333336*G8_0_0 + 0.0333333333333336*G8_1_0;
-    A[940] = 0.0333333333333338*G2_0_1 + 0.0333333333333338*G2_1_1 + 0.0333333333333338*G5_0_1 + 0.0333333333333338*G5_1_1 + 0.0333333333333338*G8_0_1 + 0.0333333333333338*G8_1_1;
+    A[940] = 0.0333333333333337*G2_0_1 + 0.0333333333333337*G2_1_1 + 0.0333333333333337*G5_0_1 + 0.0333333333333337*G5_1_1 + 0.0333333333333337*G8_0_1 + 0.0333333333333337*G8_1_1;
     A[941] = -0.1*G2_0_2 - 0.1*G2_1_2 - 0.133333333333334*G2_2_2 - 0.1*G5_0_2 - 0.1*G5_1_2 - 0.133333333333334*G5_2_2 - 0.1*G8_0_2 - 0.1*G8_1_2 - 0.133333333333334*G8_2_2;
     A[942] = -0.266666666666667*G2_0_1 - 0.133333333333333*G2_0_2 - 0.266666666666667*G2_1_1 - 0.133333333333333*G2_1_2 - 0.133333333333334*G2_2_1 - 0.266666666666667*G5_0_1 - 0.133333333333333*G5_0_2 - 0.266666666666667*G5_1_1 - 0.133333333333333*G5_1_2 - 0.133333333333334*G5_2_1 - 0.266666666666667*G8_0_1 - 0.133333333333333*G8_0_2 - 0.266666666666667*G8_1_1 - 0.133333333333333*G8_1_2 - 0.133333333333334*G8_2_1;
     A[943] = -0.266666666666667*G2_0_0 - 0.133333333333334*G2_0_2 - 0.266666666666667*G2_1_0 - 0.133333333333335*G2_1_2 - 0.133333333333334*G2_2_0 - 0.266666666666667*G5_0_0 - 0.133333333333334*G5_0_2 - 0.266666666666667*G5_1_0 - 0.133333333333335*G5_1_2 - 0.133333333333334*G5_2_0 - 0.266666666666667*G8_0_0 - 0.133333333333334*G8_0_2 - 0.266666666666667*G8_1_0 - 0.133333333333335*G8_1_2 - 0.133333333333334*G8_2_0;
-    A[944] = -0.133333333333333*G2_0_0 - 0.133333333333334*G2_0_1 - 0.133333333333334*G2_1_0 - 0.133333333333334*G2_1_1 - 0.133333333333333*G5_0_0 - 0.133333333333334*G5_0_1 - 0.133333333333334*G5_1_0 - 0.133333333333334*G5_1_1 - 0.133333333333333*G8_0_0 - 0.133333333333334*G8_0_1 - 0.133333333333334*G8_1_0 - 0.133333333333334*G8_1_1;
+    A[944] = -0.133333333333333*G2_0_0 - 0.133333333333334*G2_0_1 - 0.133333333333333*G2_1_0 - 0.133333333333334*G2_1_1 - 0.133333333333333*G5_0_0 - 0.133333333333334*G5_0_1 - 0.133333333333333*G5_1_0 - 0.133333333333334*G5_1_1 - 0.133333333333333*G8_0_0 - 0.133333333333334*G8_0_1 - 0.133333333333333*G8_1_0 - 0.133333333333334*G8_1_1;
     A[945] = 0.266666666666667*G2_0_0 + 0.266666666666667*G2_0_1 + 0.133333333333334*G2_0_2 + 0.266666666666667*G2_1_0 + 0.266666666666667*G2_1_1 + 0.133333333333334*G2_1_2 + 0.133333333333334*G2_2_0 + 0.133333333333334*G2_2_1 + 0.266666666666667*G2_2_2 + 0.266666666666667*G5_0_0 + 0.266666666666667*G5_0_1 + 0.133333333333334*G5_0_2 + 0.266666666666667*G5_1_0 + 0.266666666666667*G5_1_1 + 0.133333333333334*G5_1_2 + 0.133333333333334*G5_2_0 + 0.133333333333334*G5_2_1 + 0.266666666666667*G5 [...]
     A[946] = 0.133333333333334*G2_0_0 + 0.133333333333333*G2_0_2 + 0.133333333333334*G2_1_0 + 0.133333333333333*G2_1_2 + 0.133333333333334*G2_2_1 + 0.133333333333334*G5_0_0 + 0.133333333333333*G5_0_2 + 0.133333333333334*G5_1_0 + 0.133333333333333*G5_1_2 + 0.133333333333334*G5_2_1 + 0.133333333333334*G8_0_0 + 0.133333333333333*G8_0_2 + 0.133333333333334*G8_1_0 + 0.133333333333333*G8_1_2 + 0.133333333333334*G8_2_1;
     A[947] = 0.133333333333333*G2_0_1 + 0.133333333333333*G2_0_2 + 0.133333333333334*G2_1_1 + 0.133333333333334*G2_1_2 + 0.133333333333334*G2_2_0 + 0.133333333333333*G5_0_1 + 0.133333333333333*G5_0_2 + 0.133333333333334*G5_1_1 + 0.133333333333334*G5_1_2 + 0.133333333333334*G5_2_0 + 0.133333333333333*G8_0_1 + 0.133333333333333*G8_0_2 + 0.133333333333334*G8_1_1 + 0.133333333333334*G8_1_2 + 0.133333333333334*G8_2_0;
@@ -24608,19 +27686,19 @@ public:
     A[969] = 0.0;
     A[970] = 0.0;
     A[971] = 0.0;
-    A[972] = -0.0333333333333335*G2_0_0 - 0.0333333333333335*G2_0_1 - 0.0333333333333334*G2_0_2 - 0.133333333333333*G2_1_0 - 0.133333333333333*G2_1_1 - 0.133333333333333*G2_1_2 - 0.0333333333333335*G2_2_0 - 0.0333333333333334*G2_2_1 - 0.0333333333333334*G2_2_2 - 0.0333333333333335*G5_0_0 - 0.0333333333333335*G5_0_1 - 0.0333333333333334*G5_0_2 - 0.133333333333333*G5_1_0 - 0.133333333333333*G5_1_1 - 0.133333333333333*G5_1_2 - 0.0333333333333335*G5_2_0 - 0.0333333333333334*G5_2_1 - 0.033333 [...]
+    A[972] = -0.0333333333333335*G2_0_0 - 0.0333333333333335*G2_0_1 - 0.0333333333333334*G2_0_2 - 0.133333333333333*G2_1_0 - 0.133333333333333*G2_1_1 - 0.133333333333333*G2_1_2 - 0.0333333333333334*G2_2_0 - 0.0333333333333334*G2_2_1 - 0.0333333333333334*G2_2_2 - 0.0333333333333335*G5_0_0 - 0.0333333333333335*G5_0_1 - 0.0333333333333334*G5_0_2 - 0.133333333333333*G5_1_0 - 0.133333333333333*G5_1_1 - 0.133333333333333*G5_1_2 - 0.0333333333333334*G5_2_0 - 0.0333333333333334*G5_2_1 - 0.033333 [...]
     A[973] = 0.0333333333333336*G2_0_0 + 0.0333333333333336*G2_2_0 + 0.0333333333333336*G5_0_0 + 0.0333333333333336*G5_2_0 + 0.0333333333333336*G8_0_0 + 0.0333333333333336*G8_2_0;
     A[974] = -0.1*G2_0_1 - 0.133333333333333*G2_1_1 - 0.1*G2_2_1 - 0.1*G5_0_1 - 0.133333333333333*G5_1_1 - 0.1*G5_2_1 - 0.1*G8_0_1 - 0.133333333333333*G8_1_1 - 0.1*G8_2_1;
     A[975] = 0.0333333333333341*G2_0_2 + 0.0333333333333341*G2_2_2 + 0.0333333333333341*G5_0_2 + 0.0333333333333341*G5_2_2 + 0.0333333333333341*G8_0_2 + 0.0333333333333341*G8_2_2;
     A[976] = -0.133333333333334*G2_0_1 - 0.266666666666667*G2_0_2 - 0.133333333333333*G2_1_2 - 0.133333333333333*G2_2_1 - 0.266666666666667*G2_2_2 - 0.133333333333334*G5_0_1 - 0.266666666666667*G5_0_2 - 0.133333333333333*G5_1_2 - 0.133333333333333*G5_2_1 - 0.266666666666667*G5_2_2 - 0.133333333333334*G8_0_1 - 0.266666666666667*G8_0_2 - 0.133333333333333*G8_1_2 - 0.133333333333333*G8_2_1 - 0.266666666666667*G8_2_2;
     A[977] = -0.133333333333333*G2_0_0 - 0.133333333333334*G2_0_2 - 0.133333333333333*G2_2_0 - 0.133333333333334*G2_2_2 - 0.133333333333333*G5_0_0 - 0.133333333333334*G5_0_2 - 0.133333333333333*G5_2_0 - 0.133333333333334*G5_2_2 - 0.133333333333333*G8_0_0 - 0.133333333333334*G8_0_2 - 0.133333333333333*G8_2_0 - 0.133333333333334*G8_2_2;
-    A[978] = -0.266666666666667*G2_0_0 - 0.133333333333335*G2_0_1 - 0.133333333333333*G2_1_0 - 0.266666666666667*G2_2_0 - 0.133333333333334*G2_2_1 - 0.266666666666667*G5_0_0 - 0.133333333333335*G5_0_1 - 0.133333333333333*G5_1_0 - 0.266666666666667*G5_2_0 - 0.133333333333334*G5_2_1 - 0.266666666666667*G8_0_0 - 0.133333333333335*G8_0_1 - 0.133333333333333*G8_1_0 - 0.266666666666667*G8_2_0 - 0.133333333333334*G8_2_1;
-    A[979] = 0.133333333333334*G2_0_0 + 0.133333333333334*G2_0_1 + 0.133333333333334*G2_1_2 + 0.133333333333333*G2_2_0 + 0.133333333333333*G2_2_1 + 0.133333333333334*G5_0_0 + 0.133333333333334*G5_0_1 + 0.133333333333334*G5_1_2 + 0.133333333333333*G5_2_0 + 0.133333333333333*G5_2_1 + 0.133333333333334*G8_0_0 + 0.133333333333334*G8_0_1 + 0.133333333333334*G8_1_2 + 0.133333333333333*G8_2_0 + 0.133333333333333*G8_2_1;
+    A[978] = -0.266666666666667*G2_0_0 - 0.133333333333334*G2_0_1 - 0.133333333333333*G2_1_0 - 0.266666666666667*G2_2_0 - 0.133333333333334*G2_2_1 - 0.266666666666667*G5_0_0 - 0.133333333333334*G5_0_1 - 0.133333333333333*G5_1_0 - 0.266666666666667*G5_2_0 - 0.133333333333334*G5_2_1 - 0.266666666666667*G8_0_0 - 0.133333333333334*G8_0_1 - 0.133333333333333*G8_1_0 - 0.266666666666667*G8_2_0 - 0.133333333333334*G8_2_1;
+    A[979] = 0.133333333333333*G2_0_0 + 0.133333333333334*G2_0_1 + 0.133333333333334*G2_1_2 + 0.133333333333333*G2_2_0 + 0.133333333333333*G2_2_1 + 0.133333333333333*G5_0_0 + 0.133333333333334*G5_0_1 + 0.133333333333334*G5_1_2 + 0.133333333333333*G5_2_0 + 0.133333333333333*G5_2_1 + 0.133333333333333*G8_0_0 + 0.133333333333334*G8_0_1 + 0.133333333333334*G8_1_2 + 0.133333333333333*G8_2_0 + 0.133333333333333*G8_2_1;
     A[980] = 0.266666666666667*G2_0_0 + 0.133333333333334*G2_0_1 + 0.266666666666667*G2_0_2 + 0.133333333333334*G2_1_0 + 0.266666666666667*G2_1_1 + 0.133333333333333*G2_1_2 + 0.266666666666667*G2_2_0 + 0.133333333333333*G2_2_1 + 0.266666666666667*G2_2_2 + 0.266666666666667*G5_0_0 + 0.133333333333334*G5_0_1 + 0.266666666666667*G5_0_2 + 0.133333333333334*G5_1_0 + 0.266666666666667*G5_1_1 + 0.133333333333333*G5_1_2 + 0.266666666666667*G5_2_0 + 0.133333333333333*G5_2_1 + 0.266666666666667*G5 [...]
     A[981] = 0.133333333333334*G2_0_1 + 0.133333333333333*G2_0_2 + 0.133333333333333*G2_1_0 + 0.133333333333333*G2_2_1 + 0.133333333333333*G2_2_2 + 0.133333333333334*G5_0_1 + 0.133333333333333*G5_0_2 + 0.133333333333333*G5_1_0 + 0.133333333333333*G5_2_1 + 0.133333333333333*G5_2_2 + 0.133333333333334*G8_0_1 + 0.133333333333333*G8_0_2 + 0.133333333333333*G8_1_0 + 0.133333333333333*G8_2_1 + 0.133333333333333*G8_2_2;
     A[982] = -0.0333333333333334*G9_0 + 0.0333333333333333*G9_1 - 0.0333333333333334*G9_2;
-    A[983] = -0.0333333333333334*G9_0 - 0.0333333333333333*G9_2;
-    A[984] = -0.0666666666666667*G9_0 - 0.0333333333333333*G9_1 - 0.0666666666666667*G9_2;
+    A[983] = -0.0333333333333333*G9_0 - 0.0333333333333333*G9_2;
+    A[984] = -0.0666666666666667*G9_0 - 0.0333333333333334*G9_1 - 0.0666666666666667*G9_2;
     A[985] = -0.0333333333333334*G9_0 - 0.0333333333333333*G9_2;
     A[986] = 0.0;
     A[987] = 0.0;
@@ -24642,7 +27720,7 @@ public:
     A[1003] = 0.0;
     A[1004] = 0.0;
     A[1005] = 0.0;
-    A[1006] = -0.133333333333333*G2_0_0 - 0.133333333333333*G2_0_1 - 0.133333333333333*G2_0_2 - 0.0333333333333335*G2_1_0 - 0.0333333333333335*G2_1_1 - 0.0333333333333335*G2_1_2 - 0.0333333333333335*G2_2_0 - 0.0333333333333335*G2_2_1 - 0.0333333333333334*G2_2_2 - 0.133333333333333*G5_0_0 - 0.133333333333333*G5_0_1 - 0.133333333333333*G5_0_2 - 0.0333333333333335*G5_1_0 - 0.0333333333333335*G5_1_1 - 0.0333333333333335*G5_1_2 - 0.0333333333333335*G5_2_0 - 0.0333333333333335*G5_2_1 - 0.03333 [...]
+    A[1006] = -0.133333333333333*G2_0_0 - 0.133333333333333*G2_0_1 - 0.133333333333333*G2_0_2 - 0.0333333333333334*G2_1_0 - 0.0333333333333335*G2_1_1 - 0.0333333333333334*G2_1_2 - 0.0333333333333334*G2_2_0 - 0.0333333333333335*G2_2_1 - 0.0333333333333334*G2_2_2 - 0.133333333333333*G5_0_0 - 0.133333333333333*G5_0_1 - 0.133333333333333*G5_0_2 - 0.0333333333333334*G5_1_0 - 0.0333333333333335*G5_1_1 - 0.0333333333333334*G5_1_2 - 0.0333333333333334*G5_2_0 - 0.0333333333333335*G5_2_1 - 0.03333 [...]
     A[1007] = -0.133333333333333*G2_0_0 - 0.1*G2_1_0 - 0.1*G2_2_0 - 0.133333333333333*G5_0_0 - 0.1*G5_1_0 - 0.1*G5_2_0 - 0.133333333333333*G8_0_0 - 0.1*G8_1_0 - 0.1*G8_2_0;
     A[1008] = 0.0333333333333337*G2_1_1 + 0.0333333333333338*G2_2_1 + 0.0333333333333337*G5_1_1 + 0.0333333333333338*G5_2_1 + 0.0333333333333337*G8_1_1 + 0.0333333333333338*G8_2_1;
     A[1009] = 0.0333333333333341*G2_1_2 + 0.033333333333334*G2_2_2 + 0.0333333333333341*G5_1_2 + 0.033333333333334*G5_2_2 + 0.0333333333333341*G8_1_2 + 0.033333333333334*G8_2_2;
@@ -24655,10 +27733,10 @@ public:
     A[1016] = 0.0333333333333333*G9_0 - 0.0333333333333334*G9_1 - 0.0333333333333334*G9_2;
     A[1017] = -0.0333333333333333*G9_0 - 0.0666666666666667*G9_1 - 0.0666666666666667*G9_2;
     A[1018] = -0.0333333333333334*G9_1 - 0.0333333333333333*G9_2;
-    A[1019] = -0.0333333333333333*G9_1 - 0.0333333333333333*G9_2;
+    A[1019] = -0.0333333333333334*G9_1 - 0.0333333333333333*G9_2;
     A[1020] = -0.025*G13_0 - 0.025*G13_1 - 0.025*G13_2;
     A[1021] = -0.00833333333333338*G13_0;
-    A[1022] = -0.00833333333333345*G13_1;
+    A[1022] = -0.00833333333333343*G13_1;
     A[1023] = -0.00833333333333351*G13_2;
     A[1024] = 0.0333333333333334*G13_1 + 0.0333333333333334*G13_2;
     A[1025] = 0.0333333333333334*G13_0 + 0.0333333333333336*G13_2;
@@ -24668,7 +27746,7 @@ public:
     A[1029] = 0.0333333333333333*G13_0 - 0.0333333333333334*G13_1 - 0.0333333333333334*G13_2;
     A[1030] = -0.025*G14_0 - 0.025*G14_1 - 0.025*G14_2;
     A[1031] = -0.00833333333333338*G14_0;
-    A[1032] = -0.00833333333333345*G14_1;
+    A[1032] = -0.00833333333333343*G14_1;
     A[1033] = -0.00833333333333351*G14_2;
     A[1034] = 0.0333333333333334*G14_1 + 0.0333333333333334*G14_2;
     A[1035] = 0.0333333333333334*G14_0 + 0.0333333333333336*G14_2;
@@ -24678,7 +27756,7 @@ public:
     A[1039] = 0.0333333333333333*G14_0 - 0.0333333333333334*G14_1 - 0.0333333333333334*G14_2;
     A[1040] = -0.025*G12_0 - 0.025*G12_1 - 0.025*G12_2;
     A[1041] = -0.00833333333333338*G12_0;
-    A[1042] = -0.00833333333333345*G12_1;
+    A[1042] = -0.00833333333333343*G12_1;
     A[1043] = -0.00833333333333351*G12_2;
     A[1044] = 0.0333333333333334*G12_1 + 0.0333333333333334*G12_2;
     A[1045] = 0.0333333333333334*G12_0 + 0.0333333333333336*G12_2;
@@ -24691,74 +27769,74 @@ public:
     A[1052] = 0.0;
     A[1053] = 0.0;
     A[1054] = 0.00833333333333336*G13_0 + 0.00833333333333338*G13_1 + 0.00833333333333336*G13_2;
-    A[1055] = 0.0249999999999999*G13_0;
-    A[1056] = -0.00833333333333344*G13_1;
+    A[1055] = 0.025*G13_0;
+    A[1056] = -0.00833333333333343*G13_1;
     A[1057] = -0.00833333333333351*G13_2;
     A[1058] = 0.0333333333333334*G13_1 + 0.0333333333333334*G13_2;
     A[1059] = 0.0333333333333333*G13_0 + 0.0666666666666669*G13_2;
     A[1060] = 0.0333333333333333*G13_0 + 0.0666666666666669*G13_1;
     A[1061] = -0.0333333333333333*G13_0 - 0.0333333333333334*G13_1;
-    A[1062] = -0.0333333333333334*G13_0 - 0.0333333333333333*G13_2;
+    A[1062] = -0.0333333333333333*G13_0 - 0.0333333333333333*G13_2;
     A[1063] = -0.0333333333333333*G13_0 - 0.0666666666666667*G13_1 - 0.0666666666666667*G13_2;
     A[1064] = 0.00833333333333336*G14_0 + 0.00833333333333338*G14_1 + 0.00833333333333336*G14_2;
-    A[1065] = 0.0249999999999999*G14_0;
-    A[1066] = -0.00833333333333344*G14_1;
+    A[1065] = 0.025*G14_0;
+    A[1066] = -0.00833333333333343*G14_1;
     A[1067] = -0.00833333333333351*G14_2;
     A[1068] = 0.0333333333333334*G14_1 + 0.0333333333333334*G14_2;
     A[1069] = 0.0333333333333333*G14_0 + 0.0666666666666669*G14_2;
     A[1070] = 0.0333333333333333*G14_0 + 0.0666666666666669*G14_1;
     A[1071] = -0.0333333333333333*G14_0 - 0.0333333333333334*G14_1;
-    A[1072] = -0.0333333333333334*G14_0 - 0.0333333333333333*G14_2;
+    A[1072] = -0.0333333333333333*G14_0 - 0.0333333333333333*G14_2;
     A[1073] = -0.0333333333333333*G14_0 - 0.0666666666666667*G14_1 - 0.0666666666666667*G14_2;
     A[1074] = 0.00833333333333336*G12_0 + 0.00833333333333338*G12_1 + 0.00833333333333336*G12_2;
-    A[1075] = 0.0249999999999999*G12_0;
-    A[1076] = -0.00833333333333344*G12_1;
+    A[1075] = 0.025*G12_0;
+    A[1076] = -0.00833333333333343*G12_1;
     A[1077] = -0.00833333333333351*G12_2;
     A[1078] = 0.0333333333333334*G12_1 + 0.0333333333333334*G12_2;
     A[1079] = 0.0333333333333333*G12_0 + 0.0666666666666669*G12_2;
     A[1080] = 0.0333333333333333*G12_0 + 0.0666666666666669*G12_1;
     A[1081] = -0.0333333333333333*G12_0 - 0.0333333333333334*G12_1;
-    A[1082] = -0.0333333333333334*G12_0 - 0.0333333333333333*G12_2;
+    A[1082] = -0.0333333333333333*G12_0 - 0.0333333333333333*G12_2;
     A[1083] = -0.0333333333333333*G12_0 - 0.0666666666666667*G12_1 - 0.0666666666666667*G12_2;
     A[1084] = 0.0;
     A[1085] = 0.0;
     A[1086] = 0.0;
     A[1087] = 0.0;
     A[1088] = 0.00833333333333337*G13_0 + 0.00833333333333337*G13_1 + 0.00833333333333335*G13_2;
-    A[1089] = -0.0083333333333334*G13_0;
+    A[1089] = -0.00833333333333339*G13_0;
     A[1090] = 0.0249999999999999*G13_1;
     A[1091] = -0.00833333333333351*G13_2;
     A[1092] = 0.0333333333333334*G13_1 + 0.0666666666666667*G13_2;
     A[1093] = 0.0333333333333333*G13_0 + 0.0333333333333336*G13_2;
     A[1094] = 0.0666666666666667*G13_0 + 0.0333333333333336*G13_1;
     A[1095] = -0.0333333333333333*G13_0 - 0.0333333333333334*G13_1;
-    A[1096] = -0.0666666666666667*G13_0 - 0.0333333333333333*G13_1 - 0.0666666666666667*G13_2;
+    A[1096] = -0.0666666666666667*G13_0 - 0.0333333333333334*G13_1 - 0.0666666666666667*G13_2;
     A[1097] = -0.0333333333333334*G13_1 - 0.0333333333333333*G13_2;
     A[1098] = 0.00833333333333337*G14_0 + 0.00833333333333337*G14_1 + 0.00833333333333335*G14_2;
-    A[1099] = -0.0083333333333334*G14_0;
+    A[1099] = -0.00833333333333339*G14_0;
     A[1100] = 0.0249999999999999*G14_1;
     A[1101] = -0.00833333333333351*G14_2;
     A[1102] = 0.0333333333333334*G14_1 + 0.0666666666666667*G14_2;
     A[1103] = 0.0333333333333333*G14_0 + 0.0333333333333336*G14_2;
     A[1104] = 0.0666666666666667*G14_0 + 0.0333333333333336*G14_1;
     A[1105] = -0.0333333333333333*G14_0 - 0.0333333333333334*G14_1;
-    A[1106] = -0.0666666666666667*G14_0 - 0.0333333333333333*G14_1 - 0.0666666666666667*G14_2;
+    A[1106] = -0.0666666666666667*G14_0 - 0.0333333333333334*G14_1 - 0.0666666666666667*G14_2;
     A[1107] = -0.0333333333333334*G14_1 - 0.0333333333333333*G14_2;
     A[1108] = 0.00833333333333337*G12_0 + 0.00833333333333337*G12_1 + 0.00833333333333335*G12_2;
-    A[1109] = -0.0083333333333334*G12_0;
+    A[1109] = -0.00833333333333339*G12_0;
     A[1110] = 0.0249999999999999*G12_1;
     A[1111] = -0.00833333333333351*G12_2;
     A[1112] = 0.0333333333333334*G12_1 + 0.0666666666666667*G12_2;
     A[1113] = 0.0333333333333333*G12_0 + 0.0333333333333336*G12_2;
     A[1114] = 0.0666666666666667*G12_0 + 0.0333333333333336*G12_1;
     A[1115] = -0.0333333333333333*G12_0 - 0.0333333333333334*G12_1;
-    A[1116] = -0.0666666666666667*G12_0 - 0.0333333333333333*G12_1 - 0.0666666666666667*G12_2;
+    A[1116] = -0.0666666666666667*G12_0 - 0.0333333333333334*G12_1 - 0.0666666666666667*G12_2;
     A[1117] = -0.0333333333333334*G12_1 - 0.0333333333333333*G12_2;
     A[1118] = 0.0;
     A[1119] = 0.0;
     A[1120] = 0.0;
     A[1121] = 0.0;
-    A[1122] = 0.00833333333333337*G13_0 + 0.00833333333333337*G13_1 + 0.00833333333333335*G13_2;
+    A[1122] = 0.00833333333333337*G13_0 + 0.00833333333333338*G13_1 + 0.00833333333333336*G13_2;
     A[1123] = -0.00833333333333339*G13_0;
     A[1124] = -0.00833333333333343*G13_1;
     A[1125] = 0.0249999999999999*G13_2;
@@ -24767,8 +27845,8 @@ public:
     A[1128] = 0.0333333333333333*G13_0 + 0.0333333333333335*G13_1;
     A[1129] = -0.0666666666666667*G13_0 - 0.0666666666666667*G13_1 - 0.0333333333333334*G13_2;
     A[1130] = -0.0333333333333334*G13_0 - 0.0333333333333333*G13_2;
-    A[1131] = -0.0333333333333333*G13_1 - 0.0333333333333333*G13_2;
-    A[1132] = 0.00833333333333337*G14_0 + 0.00833333333333337*G14_1 + 0.00833333333333335*G14_2;
+    A[1131] = -0.0333333333333334*G13_1 - 0.0333333333333333*G13_2;
+    A[1132] = 0.00833333333333337*G14_0 + 0.00833333333333338*G14_1 + 0.00833333333333336*G14_2;
     A[1133] = -0.00833333333333339*G14_0;
     A[1134] = -0.00833333333333343*G14_1;
     A[1135] = 0.0249999999999999*G14_2;
@@ -24777,8 +27855,8 @@ public:
     A[1138] = 0.0333333333333333*G14_0 + 0.0333333333333335*G14_1;
     A[1139] = -0.0666666666666667*G14_0 - 0.0666666666666667*G14_1 - 0.0333333333333334*G14_2;
     A[1140] = -0.0333333333333334*G14_0 - 0.0333333333333333*G14_2;
-    A[1141] = -0.0333333333333333*G14_1 - 0.0333333333333333*G14_2;
-    A[1142] = 0.00833333333333337*G12_0 + 0.00833333333333337*G12_1 + 0.00833333333333335*G12_2;
+    A[1141] = -0.0333333333333334*G14_1 - 0.0333333333333333*G14_2;
+    A[1142] = 0.00833333333333337*G12_0 + 0.00833333333333338*G12_1 + 0.00833333333333336*G12_2;
     A[1143] = -0.00833333333333339*G12_0;
     A[1144] = -0.00833333333333343*G12_1;
     A[1145] = 0.0249999999999999*G12_2;
@@ -24787,7 +27865,7 @@ public:
     A[1148] = 0.0333333333333333*G12_0 + 0.0333333333333335*G12_1;
     A[1149] = -0.0666666666666667*G12_0 - 0.0666666666666667*G12_1 - 0.0333333333333334*G12_2;
     A[1150] = -0.0333333333333334*G12_0 - 0.0333333333333333*G12_2;
-    A[1151] = -0.0333333333333333*G12_1 - 0.0333333333333333*G12_2;
+    A[1151] = -0.0333333333333334*G12_1 - 0.0333333333333333*G12_2;
     A[1152] = 0.0;
     A[1153] = 0.0;
     A[1154] = 0.0;
@@ -24796,38 +27874,31 @@ public:
 
 };
 
-/// 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_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   stokes_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~stokes_cell_integral_1_otherwise()
+  ~stokes_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    30
@@ -24836,7 +27907,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -24917,77 +27988,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stokes_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   stokes_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_form_0()
+  ~stokes_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "adf0c58993b3452b7cd678c19bd43f369735ad1bda81d11143e0f1698fa820c6d82ad3a1f0b96ac9607bdfd8031db846d4bf2c134c81e8efdb21c7a13b0bcaa8";
+    return "12094666928c151134ae1d1bdef15b3cea540a87b18f94c0ad6036da4f68d22a12793d68d4cb2c013a742f2bc6b082caab42baa1ae9d0a9db287ab99e297ed6f";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_finite_element_3();
+        return new stokes_finite_element_4();
         break;
       }
     case 1:
       {
-        return new stokes_finite_element_3();
+        return new stokes_finite_element_4();
         break;
       }
     }
@@ -24995,19 +28058,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_dofmap_3();
+        return new stokes_dofmap_4();
         break;
       }
     case 1:
       {
-        return new stokes_dofmap_3();
+        return new stokes_dofmap_4();
         break;
       }
     }
@@ -25015,203 +28077,231 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stokes_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stokes_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   stokes_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_form_1()
+  ~stokes_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "173d4d5651200e810a4bb601b8e2199f3e76b6d3a95b78a3d607718d5f1bd74638aefe0ccf86d038f5f35016be0cb8e52c4e85a6f434b09c67adefca9f9ec7ee";
+    return "7ce23b297a05d5fb70bc64e5c35698d5e1eef801e44971f0ad118a5c35efc9a4454f4db7a91cc0e9e92d3b87a08b6baaa83e0a004b19f6b5fe4fdb52b38a9487";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_finite_element_3();
+        return new stokes_finite_element_4();
         break;
       }
     case 1:
       {
-        return new stokes_finite_element_1();
+        return new stokes_finite_element_3();
         break;
       }
     }
@@ -25219,19 +28309,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_dofmap_3();
+        return new stokes_dofmap_4();
         break;
       }
     case 1:
       {
-        return new stokes_dofmap_1();
+        return new stokes_dofmap_3();
         break;
       }
     }
@@ -25239,126 +28328,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stokes_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -25372,14 +28497,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Stokes
 {
@@ -25388,43 +28519,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -25435,43 +28543,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -25482,63 +28567,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -25546,7 +28638,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_0());
+    _ufc_form = std::make_shared<const stokes_form_0>();
   }
 
   // Destructor
@@ -25576,57 +28668,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -25634,69 +28781,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    _ufc_form = std::make_shared<const stokes_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    _ufc_form = std::make_shared<const stokes_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -25728,18 +28916,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/stokes-iterative/cpp/StokesPreconditioner.h b/demo/documented/stokes-iterative/cpp/StokesPreconditioner.h
index e7bfcda..fd1c0a1 100644
--- a/demo/documented/stokes-iterative/cpp/StokesPreconditioner.h
+++ b/demo/documented/stokes-iterative/cpp/StokesPreconditioner.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __STOKESPRECONDITIONER_H
 #define __STOKESPRECONDITIONER_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class stokespreconditioner_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stokespreconditioner_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokespreconditioner_finite_element_0()
+  ~stokespreconditioner_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 10;
+    return 4;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -137,43 +150,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -183,43 +180,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -229,43 +210,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -275,597 +240,569 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[9][2];
-    for (unsigned int row = 0; row < 9; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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 > 2)
-            combinations[row][col] = 0;
-          else
-          {
-            combinations[row][col] += 1;
-            break;
-          }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[9][9];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
+        derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -880,9 +817,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -892,11 +829,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -906,11 +843,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -920,11 +857,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -933,9 +870,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -952,123 +889,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1083,9 +974,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1095,11 +986,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1109,11 +1000,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1123,11 +1014,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1136,9 +1027,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1155,815 +1046,535 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 2:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 3:
+    case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokespreconditioner_finite_element_0();
+  }
+
+};
+
+
+class stokespreconditioner_finite_element_1: public ufc::finite_element
+{
+public:
+
+  stokespreconditioner_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokespreconditioner_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        return 3;
         break;
       }
-    case 4:
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1971,322 +1582,408 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        break;
+      }
+    case 8:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2301,9 +1998,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2313,11 +2010,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2327,11 +2024,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2341,11 +2038,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2354,9 +2051,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2373,123 +2070,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2504,9 +2155,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2516,11 +2167,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2530,11 +2181,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2544,11 +2195,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2557,9 +2208,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2576,123 +2227,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2707,9 +2312,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2719,11 +2324,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2733,11 +2338,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2747,11 +2352,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2760,9 +2365,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2779,695 +2384,474 @@ public:
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[9];
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 7:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokespreconditioner_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokespreconditioner_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokespreconditioner_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokespreconditioner_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 30;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
@@ -3475,785 +2859,1442 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 12:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 13:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 14:
+    case 10:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 15:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 16:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 17:
+    case 11:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 18:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 19:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 20:
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
         
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 21:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 22:
+    case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
       {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 23:
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokespreconditioner_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new stokespreconditioner_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new stokespreconditioner_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokespreconditioner_finite_element_1();
+  }
+
+};
+
+
+class stokespreconditioner_finite_element_2: public ufc::finite_element
+{
+public:
+
+  stokespreconditioner_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokespreconditioner_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', tetrahedron, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 10;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -4290,16 +4331,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 24:
+    case 1:
       {
         
       // Array of basisvalues
@@ -4336,16 +4377,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 25:
+    case 2:
       {
         
       // Array of basisvalues
@@ -4382,16 +4423,154 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 26:
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
       {
         
       // Array of basisvalues
@@ -4433,11 +4612,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 27:
+    case 7:
       {
         
       // Array of basisvalues
@@ -4479,11 +4658,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 28:
+    case 8:
       {
         
       // Array of basisvalues
@@ -4525,11 +4704,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 29:
+    case 9:
       {
         
       // Array of basisvalues
@@ -4571,7 +4750,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -4579,51 +4758,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
+    double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 30; r++)
+    for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -4635,7 +4807,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -4643,7 +4815,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4655,7 +4827,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -4664,9 +4836,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -4780,7 +4952,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4792,7 +4964,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4804,8 +4976,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -4983,7 +5155,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -4995,7 +5167,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5007,8 +5179,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5186,7 +5358,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5198,7 +5370,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5210,8 +5382,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5389,7 +5561,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5401,7 +5573,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5413,8 +5585,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5592,7 +5764,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5604,7 +5776,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5616,8 +5788,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5795,7 +5967,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5807,7 +5979,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -5819,8 +5991,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -5998,7 +6170,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6010,7 +6182,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6022,8 +6194,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -6201,7 +6373,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6213,7 +6385,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6225,8 +6397,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -6404,7 +6576,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6416,7 +6588,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6428,8 +6600,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -6607,7 +6779,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6619,7 +6791,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -6631,8 +6803,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -6764,537 +6936,2729 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 10:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 11:
+    case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 12:
+    case 5:
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[13] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[14] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[19] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[20] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[21] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[22] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[23] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[26] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[27] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[28] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokespreconditioner_finite_element_2();
+  }
+
+};
+
+
+class stokespreconditioner_finite_element_3: public ufc::finite_element
+{
+public:
+
+  stokespreconditioner_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokespreconditioner_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 2), dim=3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 30;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 12:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 13:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 14:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 15:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 16:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 17:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 18:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 19:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 20:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 21:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 22:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 23:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 24:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 25:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 26:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 27:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 28:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 29:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 30; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[9][2];
+    for (unsigned int row = 0; row < 9; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[9][9];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
         } // end loop over 't'
         
         // Looping derivative order to generate dmats.
@@ -7368,12 +9732,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 13:
+    case 4:
       {
         
       // Array of basisvalues
@@ -7410,7 +9774,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -7419,7 +9783,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7431,7 +9795,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7443,8 +9807,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -7571,12 +9935,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 14:
+    case 5:
       {
         
       // Array of basisvalues
@@ -7613,7 +9977,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -7622,7 +9986,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7634,7 +9998,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7646,8 +10010,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -7774,12 +10138,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 15:
+    case 6:
       {
         
       // Array of basisvalues
@@ -7816,7 +10180,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -7825,7 +10189,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7837,7 +10201,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -7849,8 +10213,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -7977,12 +10341,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 16:
+    case 7:
       {
         
       // Array of basisvalues
@@ -8019,7 +10383,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -8028,7 +10392,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8040,7 +10404,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8052,8 +10416,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8180,12 +10544,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 17:
+    case 8:
       {
         
       // Array of basisvalues
@@ -8222,7 +10586,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -8231,7 +10595,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8243,7 +10607,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8255,8 +10619,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8383,12 +10747,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 18:
+    case 9:
       {
         
       // Array of basisvalues
@@ -8425,7 +10789,210 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -8434,7 +11001,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8446,7 +11013,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8458,8 +11025,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8591,7 +11158,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 19:
+    case 11:
       {
         
       // Array of basisvalues
@@ -8628,7 +11195,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -8637,7 +11204,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8649,7 +11216,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8661,8 +11228,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8794,7 +11361,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 20:
+    case 12:
       {
         
       // Array of basisvalues
@@ -8831,7 +11398,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -8840,7 +11407,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8852,7 +11419,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -8864,8 +11431,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -8992,12 +11559,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 21:
+    case 13:
       {
         
       // Array of basisvalues
@@ -9034,7 +11601,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -9043,7 +11610,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9055,7 +11622,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9067,8 +11634,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -9195,12 +11762,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 22:
+    case 14:
       {
         
       // Array of basisvalues
@@ -9237,7 +11804,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -9246,7 +11813,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9258,7 +11825,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9270,8 +11837,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -9398,12 +11965,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 23:
+    case 15:
       {
         
       // Array of basisvalues
@@ -9440,7 +12007,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -9449,7 +12016,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9461,7 +12028,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9473,8 +12040,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -9601,12 +12168,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 24:
+    case 16:
       {
         
       // Array of basisvalues
@@ -9643,7 +12210,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -9652,7 +12219,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9664,7 +12231,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9676,8 +12243,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -9804,12 +12371,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 25:
+    case 17:
       {
         
       // Array of basisvalues
@@ -9846,7 +12413,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -9855,7 +12422,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9867,7 +12434,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -9879,8 +12446,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10007,12 +12574,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 26:
+    case 18:
       {
         
       // Array of basisvalues
@@ -10049,7 +12616,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -10058,7 +12625,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10070,7 +12637,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10082,8 +12649,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10210,12 +12777,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 27:
+    case 19:
       {
         
       // Array of basisvalues
@@ -10252,7 +12819,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -10261,7 +12828,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10273,7 +12840,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10285,8 +12852,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10413,12 +12980,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 28:
+    case 20:
       {
         
       // Array of basisvalues
@@ -10455,7 +13022,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -10464,7 +13031,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10476,7 +13043,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10488,8 +13055,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10621,7 +13188,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 29:
+    case 21:
       {
         
       // Array of basisvalues
@@ -10658,7 +13225,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -10667,7 +13234,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10679,7 +13246,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -10691,8 +13258,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -10814,1077 +13381,945 @@ public:
         } // end loop over 's'
       } // end loop over 'r'
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 30; r++)
-    {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[27];
-    for (unsigned int r = 0; r < 27; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 30; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 10:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 12:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 13:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 14:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 15:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 16:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 17:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 18:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 19:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 20:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 21:
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
     case 22:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 23:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 24:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 25:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 26:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 27:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 28:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 29:
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[12] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[13] = vals[1];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[14] = vals[1];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[15] = vals[1];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[16] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[17] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[18] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[19] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[20] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[21] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[22] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[23] = vals[2];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[24] = vals[2];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[25] = vals[2];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[26] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[27] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[28] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[29] = vals[2];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    vertex_values[9] = dof_values[3];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[10];
-    vertex_values[4] = dof_values[11];
-    vertex_values[7] = dof_values[12];
-    vertex_values[10] = dof_values[13];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[20];
-    vertex_values[5] = dof_values[21];
-    vertex_values[8] = dof_values[22];
-    vertex_values[11] = dof_values[23];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 3;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokespreconditioner_finite_element_0();
-        break;
-      }
-    case 1:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokespreconditioner_finite_element_0();
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 2:
+    case 23:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokespreconditioner_finite_element_0();
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokespreconditioner_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokespreconditioner_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokespreconditioner_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokespreconditioner_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 4;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 24:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
       } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 25:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[3][1];
-    for (unsigned int row = 0; row < 3; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
         {
-          if (combinations[row][col] + 1 > 2)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 10; u++)
           {
-            combinations[row][col] += 1;
-            break;
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[3][3];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 26:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -11899,9 +14334,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -11911,11 +14346,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11925,11 +14360,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11939,11 +14374,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11952,9 +14387,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -11966,82 +14401,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 27:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -12056,9 +14537,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -12068,11 +14549,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12082,11 +14563,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12096,11 +14577,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12109,9 +14590,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -12123,82 +14604,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 28:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -12213,9 +14740,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -12225,11 +14752,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12239,11 +14766,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12253,11 +14780,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12266,9 +14793,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -12280,82 +14807,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 29:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -12370,9 +14943,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -12382,11 +14955,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12396,11 +14969,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12410,11 +14983,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -12423,9 +14996,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -12437,7 +15010,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -12446,28 +15019,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -12479,243 +15050,722 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 4; r++)
+    for (unsigned int r = 0; r < 30; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = 0.0;
+        values[r*3*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 2)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[3];
-    for (unsigned int r = 0; r < 3; r++)
+    double dof_values[27];
+    for (unsigned int r = 0; r < 27; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 4; r++)
+    for (unsigned int r = 0; r < 30; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 1:
+    case 7:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 2:
+    case 8:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 3:
+    case 9:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
+    case 10:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 12:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 13:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 14:
+      {
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 15:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 16:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 17:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 18:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 19:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 20:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 21:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 22:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 23:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 24:
+      {
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 25:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 26:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 27:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 28:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 29:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
     }
     
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[12] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[13] = vals[1];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[14] = vals[1];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[15] = vals[1];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[16] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[17] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[18] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[19] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[20] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[21] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[22] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[23] = vals[2];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[24] = vals[2];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[25] = vals[2];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[26] = vals[2];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[27] = vals[2];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[28] = vals[2];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[29] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[10];
+    vertex_values[4] = dof_values[11];
+    vertex_values[7] = dof_values[12];
+    vertex_values[10] = dof_values[13];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[20];
+    vertex_values[5] = dof_values[21];
+    vertex_values[8] = dof_values[22];
+    vertex_values[11] = dof_values[23];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[13] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[14] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[19] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[20] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[21] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[22] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[23] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[26] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[27] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[28] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[0];
+    dof_coordinates[31] = coordinate_dofs[1];
+    dof_coordinates[32] = coordinate_dofs[2];
+    dof_coordinates[33] = coordinate_dofs[3];
+    dof_coordinates[34] = coordinate_dofs[4];
+    dof_coordinates[35] = coordinate_dofs[5];
+    dof_coordinates[36] = coordinate_dofs[6];
+    dof_coordinates[37] = coordinate_dofs[7];
+    dof_coordinates[38] = coordinate_dofs[8];
+    dof_coordinates[39] = coordinate_dofs[9];
+    dof_coordinates[40] = coordinate_dofs[10];
+    dof_coordinates[41] = coordinate_dofs[11];
+    dof_coordinates[42] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[43] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[44] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[45] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[46] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[47] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[48] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[49] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[50] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[51] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[52] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[53] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[54] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[55] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[56] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[57] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[58] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[59] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[60] = coordinate_dofs[0];
+    dof_coordinates[61] = coordinate_dofs[1];
+    dof_coordinates[62] = coordinate_dofs[2];
+    dof_coordinates[63] = coordinate_dofs[3];
+    dof_coordinates[64] = coordinate_dofs[4];
+    dof_coordinates[65] = coordinate_dofs[5];
+    dof_coordinates[66] = coordinate_dofs[6];
+    dof_coordinates[67] = coordinate_dofs[7];
+    dof_coordinates[68] = coordinate_dofs[8];
+    dof_coordinates[69] = coordinate_dofs[9];
+    dof_coordinates[70] = coordinate_dofs[10];
+    dof_coordinates[71] = coordinate_dofs[11];
+    dof_coordinates[72] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[73] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[74] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[75] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[76] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[77] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[78] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[79] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[80] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[81] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[82] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[83] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[84] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[85] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[86] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[87] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[88] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[89] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokespreconditioner_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new stokespreconditioner_finite_element_2();
+        break;
+      }
+    case 2:
+      {
+        return new stokespreconditioner_finite_element_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new stokespreconditioner_finite_element_2();
+    return new stokespreconditioner_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class stokespreconditioner_finite_element_3: public ufc::finite_element
+class stokespreconditioner_finite_element_4: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  stokespreconditioner_finite_element_3() : ufc::finite_element()
+  stokespreconditioner_finite_element_4() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokespreconditioner_finite_element_3()
+  ~stokespreconditioner_finite_element_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
+  {
+    return "MixedElement(VectorElement(FiniteElement('Lagrange', tetrahedron, 2), dim=3), FiniteElement('Lagrange', tetrahedron, 1))";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
   {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None), FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None), **{'value_shape': (4,) })";
+    return 3;
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  std::size_t space_dimension() const final override
   {
-    return ufc::tetrahedron;
+    return 34;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t value_rank() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    return 3;
+    switch (i)
+    {
+    case 0:
+      {
+        return 4;
+        break;
+      }
+    }
+    
+    return 0;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t value_size() const final override
   {
-    return 34;
+    return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -12729,16 +15779,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 4;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -12747,9 +15811,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -14279,20 +17343,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -14301,7 +17363,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 34; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 4; s++)
       {
         values[r*4 + s] = dof_values[s];
@@ -14309,21 +17371,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -14343,7 +17403,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -14355,7 +17415,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -14364,9 +17424,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -14480,7 +17540,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14492,7 +17552,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14504,8 +17564,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -14683,7 +17743,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14695,7 +17755,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14707,8 +17767,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -14886,7 +17946,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14898,7 +17958,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -14910,8 +17970,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15089,7 +18149,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15101,7 +18161,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15113,8 +18173,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15292,7 +18352,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15304,7 +18364,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15316,8 +18376,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15495,7 +18555,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15507,7 +18567,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15519,8 +18579,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15698,7 +18758,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15710,7 +18770,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15722,8 +18782,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -15901,7 +18961,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15913,7 +18973,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -15925,8 +18985,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16104,7 +19164,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16116,7 +19176,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16128,8 +19188,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16307,7 +19367,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16319,7 +19379,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16331,8 +19391,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16510,7 +19570,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16522,7 +19582,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16534,8 +19594,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16713,7 +19773,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16725,7 +19785,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16737,8 +19797,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -16916,7 +19976,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16928,7 +19988,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -16940,8 +20000,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17119,7 +20179,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17131,7 +20191,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17143,8 +20203,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17322,7 +20382,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17334,7 +20394,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17346,8 +20406,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17525,7 +20585,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17537,7 +20597,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17549,8 +20609,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17728,7 +20788,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17740,7 +20800,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17752,8 +20812,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -17931,7 +20991,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17943,7 +21003,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -17955,8 +21015,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18134,7 +21194,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18146,7 +21206,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18158,8 +21218,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18337,7 +21397,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18349,7 +21409,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18361,8 +21421,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18540,7 +21600,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18552,7 +21612,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18564,8 +21624,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18743,7 +21803,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18755,7 +21815,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18767,8 +21827,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -18946,7 +22006,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18958,7 +22018,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -18970,8 +22030,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19149,7 +22209,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19161,7 +22221,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19173,8 +22233,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19352,7 +22412,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19364,7 +22424,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19376,8 +22436,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19555,7 +22615,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19567,7 +22627,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19579,8 +22639,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19758,7 +22818,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19770,7 +22830,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19782,8 +22842,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -19961,7 +23021,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19973,7 +23033,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -19985,8 +23045,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -20164,7 +23224,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -20176,7 +23236,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -20188,8 +23248,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -20367,7 +23427,7 @@ public:
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -20379,7 +23439,7 @@ public:
       {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
@@ -20391,8 +23451,8 @@ public:
       {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
@@ -21156,28 +24216,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -21213,7 +24271,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 34; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 4*num_derivatives; s++)
       {
         values[r*4*num_derivatives + s] = dof_values[s];
@@ -21221,22 +24279,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[4];
@@ -21247,306 +24303,306 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 7:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 8:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 10:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 12:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 13:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 14:
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 15:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 16:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 17:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 18:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 19:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 20:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 21:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 22:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 23:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 24:
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 25:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 26:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 27:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 28:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 29:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 30:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[3];
         break;
       }
     case 31:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[3];
         break;
       }
     case 32:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[3];
         break;
       }
     case 33:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[3];
         break;
@@ -21556,196 +24612,194 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[4];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[8] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[12] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[13] = vals[1];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[14] = vals[1];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[15] = vals[1];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[16] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[17] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[18] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[19] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[20] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[21] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[22] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[23] = vals[2];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[24] = vals[2];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[25] = vals[2];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[26] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[27] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[28] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[29] = vals[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[30] = vals[3];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[31] = vals[3];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[32] = vals[3];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[33] = vals[3];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -21769,41 +24823,130 @@ public:
     vertex_values[15] = dof_values[33];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[13] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[14] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[19] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[20] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[21] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[22] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[23] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[26] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[27] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[28] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[0];
+    dof_coordinates[31] = coordinate_dofs[1];
+    dof_coordinates[32] = coordinate_dofs[2];
+    dof_coordinates[33] = coordinate_dofs[3];
+    dof_coordinates[34] = coordinate_dofs[4];
+    dof_coordinates[35] = coordinate_dofs[5];
+    dof_coordinates[36] = coordinate_dofs[6];
+    dof_coordinates[37] = coordinate_dofs[7];
+    dof_coordinates[38] = coordinate_dofs[8];
+    dof_coordinates[39] = coordinate_dofs[9];
+    dof_coordinates[40] = coordinate_dofs[10];
+    dof_coordinates[41] = coordinate_dofs[11];
+    dof_coordinates[42] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[43] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[44] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[45] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[46] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[47] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[48] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[49] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[50] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[51] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[52] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[53] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[54] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[55] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[56] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[57] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[58] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[59] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[60] = coordinate_dofs[0];
+    dof_coordinates[61] = coordinate_dofs[1];
+    dof_coordinates[62] = coordinate_dofs[2];
+    dof_coordinates[63] = coordinate_dofs[3];
+    dof_coordinates[64] = coordinate_dofs[4];
+    dof_coordinates[65] = coordinate_dofs[5];
+    dof_coordinates[66] = coordinate_dofs[6];
+    dof_coordinates[67] = coordinate_dofs[7];
+    dof_coordinates[68] = coordinate_dofs[8];
+    dof_coordinates[69] = coordinate_dofs[9];
+    dof_coordinates[70] = coordinate_dofs[10];
+    dof_coordinates[71] = coordinate_dofs[11];
+    dof_coordinates[72] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[73] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[74] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[75] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[76] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[77] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[78] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[79] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[80] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[81] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[82] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[83] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[84] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[85] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[86] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[87] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[88] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[89] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    dof_coordinates[90] = coordinate_dofs[0];
+    dof_coordinates[91] = coordinate_dofs[1];
+    dof_coordinates[92] = coordinate_dofs[2];
+    dof_coordinates[93] = coordinate_dofs[3];
+    dof_coordinates[94] = coordinate_dofs[4];
+    dof_coordinates[95] = coordinate_dofs[5];
+    dof_coordinates[96] = coordinate_dofs[6];
+    dof_coordinates[97] = coordinate_dofs[7];
+    dof_coordinates[98] = coordinate_dofs[8];
+    dof_coordinates[99] = coordinate_dofs[9];
+    dof_coordinates[100] = coordinate_dofs[10];
+    dof_coordinates[101] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokespreconditioner_finite_element_1();
+        return new stokespreconditioner_finite_element_3();
         break;
       }
     case 1:
       {
-        return new stokespreconditioner_finite_element_2();
+        return new stokespreconditioner_finite_element_0();
         break;
       }
     }
@@ -21811,41 +24954,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new stokespreconditioner_finite_element_3();
+    return new stokespreconditioner_finite_element_4();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class stokespreconditioner_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   stokespreconditioner_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokespreconditioner_dofmap_0()
+  ~stokespreconditioner_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -21856,7 +24992,7 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -21874,50 +25010,265 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
-    return num_global_entities[0] + num_global_entities[1];
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    return 10;
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
-    return 6;
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
     switch (d)
     {
     case 0:
       {
-        return 1;
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        return 1;
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new stokespreconditioner_dofmap_0();
+  }
+
+};
+
+
+class stokespreconditioner_dofmap_1: public ufc::dofmap
+{
+public:
+
+  stokespreconditioner_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~stokespreconditioner_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 3*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 9;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 0;
         break;
       }
     case 2:
@@ -21935,29 +25286,30 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[1][0];
-    dofs[5] = offset + c.entity_indices[1][1];
-    dofs[6] = offset + c.entity_indices[1][2];
-    dofs[7] = offset + c.entity_indices[1][3];
-    dofs[8] = offset + c.entity_indices[1][4];
-    dofs[9] = offset + c.entity_indices[1][5];
-    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -21966,9 +25318,12 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 6;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 1:
@@ -21977,18 +25332,24 @@ public:
       dofs[1] = 2;
       dofs[2] = 3;
       dofs[3] = 4;
-      dofs[4] = 7;
-      dofs[5] = 8;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 3;
-      dofs[3] = 5;
-      dofs[4] = 7;
-      dofs[5] = 9;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
         break;
       }
     case 3:
@@ -21996,18 +25357,20 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 2;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 9;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -22028,21 +25391,29 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
           break;
         }
       }
@@ -22051,45 +25422,7 @@ public:
       }
     case 1:
       {
-        if (i > 5)
-      {
-      throw std::runtime_error("i is larger than number of entities (5)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 6;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 7;
-          break;
-        }
-      case 4:
-        {
-          dofs[0] = 8;
-          break;
-        }
-      case 5:
-        {
-          dofs[0] = 9;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
@@ -22106,89 +25439,64 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokespreconditioner_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new stokespreconditioner_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new stokespreconditioner_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokespreconditioner_dofmap_0();
+    return new stokespreconditioner_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokespreconditioner_dofmap_1: public ufc::dofmap
+class stokespreconditioner_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokespreconditioner_dofmap_1() : ufc::dofmap()
+  stokespreconditioner_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokespreconditioner_dofmap_1()
+  ~stokespreconditioner_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -22217,50 +25525,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3*num_global_entities[0] + 3*num_global_entities[1];
+    return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 30;
+    return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 18;
+    return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 3;
+        return 1;
         break;
       }
     case 1:
       {
-        return 3;
+        return 1;
         break;
       }
     case 2:
@@ -22278,53 +25575,27 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[1][0];
-    dofs[5] = offset + c.entity_indices[1][1];
-    dofs[6] = offset + c.entity_indices[1][2];
-    dofs[7] = offset + c.entity_indices[1][3];
-    dofs[8] = offset + c.entity_indices[1][4];
-    dofs[9] = offset + c.entity_indices[1][5];
-    offset += num_global_entities[1];
-    dofs[10] = offset + c.entity_indices[0][0];
-    dofs[11] = offset + c.entity_indices[0][1];
-    dofs[12] = offset + c.entity_indices[0][2];
-    dofs[13] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[14] = offset + c.entity_indices[1][0];
-    dofs[15] = offset + c.entity_indices[1][1];
-    dofs[16] = offset + c.entity_indices[1][2];
-    dofs[17] = offset + c.entity_indices[1][3];
-    dofs[18] = offset + c.entity_indices[1][4];
-    dofs[19] = offset + c.entity_indices[1][5];
-    offset += num_global_entities[1];
-    dofs[20] = offset + c.entity_indices[0][0];
-    dofs[21] = offset + c.entity_indices[0][1];
-    dofs[22] = offset + c.entity_indices[0][2];
-    dofs[23] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[24] = offset + c.entity_indices[1][0];
-    dofs[25] = offset + c.entity_indices[1][1];
-    dofs[26] = offset + c.entity_indices[1][2];
-    dofs[27] = offset + c.entity_indices[1][3];
-    dofs[28] = offset + c.entity_indices[1][4];
-    dofs[29] = offset + c.entity_indices[1][5];
+    dofs[4] = offset + entity_indices[1][0];
+    dofs[5] = offset + entity_indices[1][1];
+    dofs[6] = offset + entity_indices[1][2];
+    dofs[7] = offset + entity_indices[1][3];
+    dofs[8] = offset + entity_indices[1][4];
+    dofs[9] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -22336,18 +25607,6 @@ public:
       dofs[3] = 4;
       dofs[4] = 5;
       dofs[5] = 6;
-      dofs[6] = 11;
-      dofs[7] = 12;
-      dofs[8] = 13;
-      dofs[9] = 14;
-      dofs[10] = 15;
-      dofs[11] = 16;
-      dofs[12] = 21;
-      dofs[13] = 22;
-      dofs[14] = 23;
-      dofs[15] = 24;
-      dofs[16] = 25;
-      dofs[17] = 26;
         break;
       }
     case 1:
@@ -22358,18 +25617,6 @@ public:
       dofs[3] = 4;
       dofs[4] = 7;
       dofs[5] = 8;
-      dofs[6] = 10;
-      dofs[7] = 12;
-      dofs[8] = 13;
-      dofs[9] = 14;
-      dofs[10] = 17;
-      dofs[11] = 18;
-      dofs[12] = 20;
-      dofs[13] = 22;
-      dofs[14] = 23;
-      dofs[15] = 24;
-      dofs[16] = 27;
-      dofs[17] = 28;
         break;
       }
     case 2:
@@ -22380,18 +25627,6 @@ public:
       dofs[3] = 5;
       dofs[4] = 7;
       dofs[5] = 9;
-      dofs[6] = 10;
-      dofs[7] = 11;
-      dofs[8] = 13;
-      dofs[9] = 15;
-      dofs[10] = 17;
-      dofs[11] = 19;
-      dofs[12] = 20;
-      dofs[13] = 21;
-      dofs[14] = 23;
-      dofs[15] = 25;
-      dofs[16] = 27;
-      dofs[17] = 29;
         break;
       }
     case 3:
@@ -22402,27 +25637,14 @@ public:
       dofs[3] = 6;
       dofs[4] = 8;
       dofs[5] = 9;
-      dofs[6] = 10;
-      dofs[7] = 11;
-      dofs[8] = 12;
-      dofs[9] = 16;
-      dofs[10] = 18;
-      dofs[11] = 19;
-      dofs[12] = 20;
-      dofs[13] = 21;
-      dofs[14] = 22;
-      dofs[15] = 26;
-      dofs[16] = 28;
-      dofs[17] = 29;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -22443,29 +25665,21 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 10;
-        dofs[2] = 20;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 11;
-        dofs[2] = 21;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 12;
-        dofs[2] = 22;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
-        dofs[1] = 13;
-        dofs[2] = 23;
           break;
         }
       }
@@ -22484,43 +25698,31 @@ public:
       case 0:
         {
           dofs[0] = 4;
-        dofs[1] = 14;
-        dofs[2] = 24;
           break;
         }
       case 1:
         {
           dofs[0] = 5;
-        dofs[1] = 15;
-        dofs[2] = 25;
           break;
         }
       case 2:
         {
           dofs[0] = 6;
-        dofs[1] = 16;
-        dofs[2] = 26;
           break;
         }
       case 3:
         {
           dofs[0] = 7;
-        dofs[1] = 17;
-        dofs[2] = 27;
           break;
         }
       case 4:
         {
           dofs[0] = 8;
-        dofs[1] = 18;
-        dofs[2] = 28;
           break;
         }
       case 5:
         {
           dofs[0] = 9;
-        dofs[1] = 19;
-        dofs[2] = 29;
           break;
         }
       }
@@ -22541,168 +25743,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[0];
-    dof_coordinates[31] = vertex_coordinates[1];
-    dof_coordinates[32] = vertex_coordinates[2];
-    dof_coordinates[33] = vertex_coordinates[3];
-    dof_coordinates[34] = vertex_coordinates[4];
-    dof_coordinates[35] = vertex_coordinates[5];
-    dof_coordinates[36] = vertex_coordinates[6];
-    dof_coordinates[37] = vertex_coordinates[7];
-    dof_coordinates[38] = vertex_coordinates[8];
-    dof_coordinates[39] = vertex_coordinates[9];
-    dof_coordinates[40] = vertex_coordinates[10];
-    dof_coordinates[41] = vertex_coordinates[11];
-    dof_coordinates[42] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[43] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[44] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[45] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[46] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[47] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[48] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[49] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[50] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[51] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[52] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[53] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[54] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[55] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[56] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[57] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[58] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[59] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[60] = vertex_coordinates[0];
-    dof_coordinates[61] = vertex_coordinates[1];
-    dof_coordinates[62] = vertex_coordinates[2];
-    dof_coordinates[63] = vertex_coordinates[3];
-    dof_coordinates[64] = vertex_coordinates[4];
-    dof_coordinates[65] = vertex_coordinates[5];
-    dof_coordinates[66] = vertex_coordinates[6];
-    dof_coordinates[67] = vertex_coordinates[7];
-    dof_coordinates[68] = vertex_coordinates[8];
-    dof_coordinates[69] = vertex_coordinates[9];
-    dof_coordinates[70] = vertex_coordinates[10];
-    dof_coordinates[71] = vertex_coordinates[11];
-    dof_coordinates[72] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[73] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[74] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[75] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[76] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[77] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[78] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[79] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[80] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[81] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[82] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[83] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[84] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[85] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[86] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[87] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[88] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[89] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokespreconditioner_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new stokespreconditioner_dofmap_0();
-        break;
-      }
-    case 2:
-      {
-        return new stokespreconditioner_dofmap_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokespreconditioner_dofmap_1();
+    return new stokespreconditioner_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokespreconditioner_dofmap_2: public ufc::dofmap
+class stokespreconditioner_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokespreconditioner_dofmap_2() : ufc::dofmap()
+  stokespreconditioner_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokespreconditioner_dofmap_2()
+  ~stokespreconditioner_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 2), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -22713,7 +25792,7 @@ public:
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -22731,50 +25810,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 3*num_global_entities[0] + 3*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 4;
+    return 30;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 18;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 3;
         break;
       }
     case 1:
       {
-        return 0;
+        return 3;
         break;
       }
     case 2:
@@ -22792,20 +25860,51 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[1][0];
+    dofs[5] = offset + entity_indices[1][1];
+    dofs[6] = offset + entity_indices[1][2];
+    dofs[7] = offset + entity_indices[1][3];
+    dofs[8] = offset + entity_indices[1][4];
+    dofs[9] = offset + entity_indices[1][5];
+    offset += num_global_entities[1];
+    dofs[10] = offset + entity_indices[0][0];
+    dofs[11] = offset + entity_indices[0][1];
+    dofs[12] = offset + entity_indices[0][2];
+    dofs[13] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[14] = offset + entity_indices[1][0];
+    dofs[15] = offset + entity_indices[1][1];
+    dofs[16] = offset + entity_indices[1][2];
+    dofs[17] = offset + entity_indices[1][3];
+    dofs[18] = offset + entity_indices[1][4];
+    dofs[19] = offset + entity_indices[1][5];
+    offset += num_global_entities[1];
+    dofs[20] = offset + entity_indices[0][0];
+    dofs[21] = offset + entity_indices[0][1];
+    dofs[22] = offset + entity_indices[0][2];
+    dofs[23] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[24] = offset + entity_indices[1][0];
+    dofs[25] = offset + entity_indices[1][1];
+    dofs[26] = offset + entity_indices[1][2];
+    dofs[27] = offset + entity_indices[1][3];
+    dofs[28] = offset + entity_indices[1][4];
+    dofs[29] = offset + entity_indices[1][5];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -22814,6 +25913,21 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 11;
+      dofs[7] = 12;
+      dofs[8] = 13;
+      dofs[9] = 14;
+      dofs[10] = 15;
+      dofs[11] = 16;
+      dofs[12] = 21;
+      dofs[13] = 22;
+      dofs[14] = 23;
+      dofs[15] = 24;
+      dofs[16] = 25;
+      dofs[17] = 26;
         break;
       }
     case 1:
@@ -22821,6 +25935,21 @@ public:
         dofs[0] = 0;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 7;
+      dofs[5] = 8;
+      dofs[6] = 10;
+      dofs[7] = 12;
+      dofs[8] = 13;
+      dofs[9] = 14;
+      dofs[10] = 17;
+      dofs[11] = 18;
+      dofs[12] = 20;
+      dofs[13] = 22;
+      dofs[14] = 23;
+      dofs[15] = 24;
+      dofs[16] = 27;
+      dofs[17] = 28;
         break;
       }
     case 2:
@@ -22828,6 +25957,21 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 7;
+      dofs[5] = 9;
+      dofs[6] = 10;
+      dofs[7] = 11;
+      dofs[8] = 13;
+      dofs[9] = 15;
+      dofs[10] = 17;
+      dofs[11] = 19;
+      dofs[12] = 20;
+      dofs[13] = 21;
+      dofs[14] = 23;
+      dofs[15] = 25;
+      dofs[16] = 27;
+      dofs[17] = 29;
         break;
       }
     case 3:
@@ -22835,15 +25979,29 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 2;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 9;
+      dofs[6] = 10;
+      dofs[7] = 11;
+      dofs[8] = 12;
+      dofs[9] = 16;
+      dofs[10] = 18;
+      dofs[11] = 19;
+      dofs[12] = 20;
+      dofs[13] = 21;
+      dofs[14] = 22;
+      dofs[15] = 26;
+      dofs[16] = 28;
+      dofs[17] = 29;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -22864,21 +26022,29 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 10;
+        dofs[2] = 20;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 11;
+        dofs[2] = 21;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 12;
+        dofs[2] = 22;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
+        dofs[1] = 13;
+        dofs[2] = 23;
           break;
         }
       }
@@ -22887,7 +26053,57 @@ public:
       }
     case 1:
       {
-        
+        if (i > 5)
+      {
+      throw std::runtime_error("i is larger than number of entities (5)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 4;
+        dofs[1] = 14;
+        dofs[2] = 24;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 5;
+        dofs[1] = 15;
+        dofs[2] = 25;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 6;
+        dofs[1] = 16;
+        dofs[2] = 26;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 7;
+        dofs[1] = 17;
+        dofs[2] = 27;
+          break;
+        }
+      case 4:
+        {
+          dofs[0] = 8;
+        dofs[1] = 18;
+        dofs[2] = 28;
+          break;
+        }
+      case 5:
+        {
+          dofs[0] = 9;
+        dofs[1] = 19;
+        dofs[2] = 29;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -22904,71 +26120,64 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokespreconditioner_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new stokespreconditioner_dofmap_2();
+        break;
+      }
+    case 2:
+      {
+        return new stokespreconditioner_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokespreconditioner_dofmap_2();
+    return new stokespreconditioner_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokespreconditioner_dofmap_3: public ufc::dofmap
+class stokespreconditioner_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokespreconditioner_dofmap_3() : ufc::dofmap()
+  stokespreconditioner_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokespreconditioner_dofmap_3()
+  ~stokespreconditioner_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, 3, None), FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None), **{'value_shape': (4,) })";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Lagrange', tetrahedron, 2), dim=3), FiniteElement('Lagrange', tetrahedron, 1))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -22997,39 +26206,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 4*num_global_entities[0] + 3*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 34;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 21;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -23058,58 +26256,56 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[1][0];
-    dofs[5] = offset + c.entity_indices[1][1];
-    dofs[6] = offset + c.entity_indices[1][2];
-    dofs[7] = offset + c.entity_indices[1][3];
-    dofs[8] = offset + c.entity_indices[1][4];
-    dofs[9] = offset + c.entity_indices[1][5];
+    dofs[4] = offset + entity_indices[1][0];
+    dofs[5] = offset + entity_indices[1][1];
+    dofs[6] = offset + entity_indices[1][2];
+    dofs[7] = offset + entity_indices[1][3];
+    dofs[8] = offset + entity_indices[1][4];
+    dofs[9] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
-    dofs[10] = offset + c.entity_indices[0][0];
-    dofs[11] = offset + c.entity_indices[0][1];
-    dofs[12] = offset + c.entity_indices[0][2];
-    dofs[13] = offset + c.entity_indices[0][3];
+    dofs[10] = offset + entity_indices[0][0];
+    dofs[11] = offset + entity_indices[0][1];
+    dofs[12] = offset + entity_indices[0][2];
+    dofs[13] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[14] = offset + c.entity_indices[1][0];
-    dofs[15] = offset + c.entity_indices[1][1];
-    dofs[16] = offset + c.entity_indices[1][2];
-    dofs[17] = offset + c.entity_indices[1][3];
-    dofs[18] = offset + c.entity_indices[1][4];
-    dofs[19] = offset + c.entity_indices[1][5];
+    dofs[14] = offset + entity_indices[1][0];
+    dofs[15] = offset + entity_indices[1][1];
+    dofs[16] = offset + entity_indices[1][2];
+    dofs[17] = offset + entity_indices[1][3];
+    dofs[18] = offset + entity_indices[1][4];
+    dofs[19] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
-    dofs[20] = offset + c.entity_indices[0][0];
-    dofs[21] = offset + c.entity_indices[0][1];
-    dofs[22] = offset + c.entity_indices[0][2];
-    dofs[23] = offset + c.entity_indices[0][3];
+    dofs[20] = offset + entity_indices[0][0];
+    dofs[21] = offset + entity_indices[0][1];
+    dofs[22] = offset + entity_indices[0][2];
+    dofs[23] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[24] = offset + c.entity_indices[1][0];
-    dofs[25] = offset + c.entity_indices[1][1];
-    dofs[26] = offset + c.entity_indices[1][2];
-    dofs[27] = offset + c.entity_indices[1][3];
-    dofs[28] = offset + c.entity_indices[1][4];
-    dofs[29] = offset + c.entity_indices[1][5];
+    dofs[24] = offset + entity_indices[1][0];
+    dofs[25] = offset + entity_indices[1][1];
+    dofs[26] = offset + entity_indices[1][2];
+    dofs[27] = offset + entity_indices[1][3];
+    dofs[28] = offset + entity_indices[1][4];
+    dofs[29] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
-    dofs[30] = offset + c.entity_indices[0][0];
-    dofs[31] = offset + c.entity_indices[0][1];
-    dofs[32] = offset + c.entity_indices[0][2];
-    dofs[33] = offset + c.entity_indices[0][3];
+    dofs[30] = offset + entity_indices[0][0];
+    dofs[31] = offset + entity_indices[0][1];
+    dofs[32] = offset + entity_indices[0][2];
+    dofs[33] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -23217,9 +26413,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -23342,133 +26537,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[0];
-    dof_coordinates[31] = vertex_coordinates[1];
-    dof_coordinates[32] = vertex_coordinates[2];
-    dof_coordinates[33] = vertex_coordinates[3];
-    dof_coordinates[34] = vertex_coordinates[4];
-    dof_coordinates[35] = vertex_coordinates[5];
-    dof_coordinates[36] = vertex_coordinates[6];
-    dof_coordinates[37] = vertex_coordinates[7];
-    dof_coordinates[38] = vertex_coordinates[8];
-    dof_coordinates[39] = vertex_coordinates[9];
-    dof_coordinates[40] = vertex_coordinates[10];
-    dof_coordinates[41] = vertex_coordinates[11];
-    dof_coordinates[42] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[43] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[44] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[45] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[46] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[47] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[48] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[49] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[50] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[51] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[52] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[53] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[54] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[55] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[56] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[57] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[58] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[59] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[60] = vertex_coordinates[0];
-    dof_coordinates[61] = vertex_coordinates[1];
-    dof_coordinates[62] = vertex_coordinates[2];
-    dof_coordinates[63] = vertex_coordinates[3];
-    dof_coordinates[64] = vertex_coordinates[4];
-    dof_coordinates[65] = vertex_coordinates[5];
-    dof_coordinates[66] = vertex_coordinates[6];
-    dof_coordinates[67] = vertex_coordinates[7];
-    dof_coordinates[68] = vertex_coordinates[8];
-    dof_coordinates[69] = vertex_coordinates[9];
-    dof_coordinates[70] = vertex_coordinates[10];
-    dof_coordinates[71] = vertex_coordinates[11];
-    dof_coordinates[72] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[73] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[74] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[75] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[76] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[77] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[78] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[79] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[80] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[81] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[82] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[83] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[84] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[85] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[86] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[87] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[88] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[89] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    dof_coordinates[90] = vertex_coordinates[0];
-    dof_coordinates[91] = vertex_coordinates[1];
-    dof_coordinates[92] = vertex_coordinates[2];
-    dof_coordinates[93] = vertex_coordinates[3];
-    dof_coordinates[94] = vertex_coordinates[4];
-    dof_coordinates[95] = vertex_coordinates[5];
-    dof_coordinates[96] = vertex_coordinates[6];
-    dof_coordinates[97] = vertex_coordinates[7];
-    dof_coordinates[98] = vertex_coordinates[8];
-    dof_coordinates[99] = vertex_coordinates[9];
-    dof_coordinates[100] = vertex_coordinates[10];
-    dof_coordinates[101] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokespreconditioner_dofmap_1();
+        return new stokespreconditioner_dofmap_3();
         break;
       }
     case 1:
       {
-        return new stokespreconditioner_dofmap_2();
+        return new stokespreconditioner_dofmap_0();
         break;
       }
     }
@@ -23476,46 +26562,38 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokespreconditioner_dofmap_3();
+    return new stokespreconditioner_dofmap_4();
   }
 
 };
 
-/// 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 stokespreconditioner_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   stokespreconditioner_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~stokespreconditioner_cell_integral_0_otherwise()
+  ~stokespreconditioner_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    121
@@ -23524,7 +26602,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -23624,10 +26702,10 @@ public:
     A[2] = 0.0333333333333334*G0_0_1 + 0.0333333333333333*G0_1_1 + 0.0333333333333333*G0_2_1 + 0.0333333333333334*G3_0_1 + 0.0333333333333333*G3_1_1 + 0.0333333333333333*G3_2_1 + 0.0333333333333334*G6_0_1 + 0.0333333333333333*G6_1_1 + 0.0333333333333333*G6_2_1;
     A[3] = 0.0333333333333334*G0_0_2 + 0.0333333333333334*G0_1_2 + 0.0333333333333334*G0_2_2 + 0.0333333333333334*G3_0_2 + 0.0333333333333334*G3_1_2 + 0.0333333333333334*G3_2_2 + 0.0333333333333334*G6_0_2 + 0.0333333333333334*G6_1_2 + 0.0333333333333334*G6_2_2;
     A[4] = 0.0333333333333336*G0_0_1 + 0.0333333333333335*G0_0_2 + 0.0333333333333336*G0_1_1 + 0.0333333333333335*G0_1_2 + 0.0333333333333335*G0_2_1 + 0.0333333333333334*G0_2_2 + 0.0333333333333336*G3_0_1 + 0.0333333333333335*G3_0_2 + 0.0333333333333336*G3_1_1 + 0.0333333333333335*G3_1_2 + 0.0333333333333335*G3_2_1 + 0.0333333333333334*G3_2_2 + 0.0333333333333336*G6_0_1 + 0.0333333333333335*G6_0_2 + 0.0333333333333336*G6_1_1 + 0.0333333333333335*G6_1_2 + 0.0333333333333335*G6_2_1 + 0.033 [...]
-    A[5] = 0.0333333333333335*G0_0_0 + 0.0333333333333336*G0_0_2 + 0.0333333333333336*G0_1_0 + 0.0333333333333336*G0_1_2 + 0.0333333333333335*G0_2_0 + 0.0333333333333335*G0_2_2 + 0.0333333333333335*G3_0_0 + 0.0333333333333336*G3_0_2 + 0.0333333333333336*G3_1_0 + 0.0333333333333336*G3_1_2 + 0.0333333333333335*G3_2_0 + 0.0333333333333335*G3_2_2 + 0.0333333333333335*G6_0_0 + 0.0333333333333336*G6_0_2 + 0.0333333333333336*G6_1_0 + 0.0333333333333336*G6_1_2 + 0.0333333333333335*G6_2_0 + 0.033 [...]
-    A[6] = 0.0333333333333336*G0_0_0 + 0.0333333333333335*G0_0_1 + 0.0333333333333336*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333335*G0_2_0 + 0.0333333333333335*G0_2_1 + 0.0333333333333336*G3_0_0 + 0.0333333333333335*G3_0_1 + 0.0333333333333336*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333335*G3_2_0 + 0.0333333333333335*G3_2_1 + 0.0333333333333336*G6_0_0 + 0.0333333333333335*G6_0_1 + 0.0333333333333336*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0333333333333335*G6_2_0 + 0.033 [...]
+    A[5] = 0.0333333333333336*G0_0_0 + 0.0333333333333335*G0_0_2 + 0.0333333333333336*G0_1_0 + 0.0333333333333336*G0_1_2 + 0.0333333333333335*G0_2_0 + 0.0333333333333335*G0_2_2 + 0.0333333333333336*G3_0_0 + 0.0333333333333335*G3_0_2 + 0.0333333333333336*G3_1_0 + 0.0333333333333336*G3_1_2 + 0.0333333333333335*G3_2_0 + 0.0333333333333335*G3_2_2 + 0.0333333333333336*G6_0_0 + 0.0333333333333335*G6_0_2 + 0.0333333333333336*G6_1_0 + 0.0333333333333336*G6_1_2 + 0.0333333333333335*G6_2_0 + 0.033 [...]
+    A[6] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_0_1 + 0.0333333333333335*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333335*G0_2_0 + 0.0333333333333335*G0_2_1 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_0_1 + 0.0333333333333335*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333335*G3_2_0 + 0.0333333333333335*G3_2_1 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_0_1 + 0.0333333333333335*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0333333333333335*G6_2_0 + 0.033 [...]
     A[7] = -0.0333333333333336*G0_0_0 - 0.0333333333333336*G0_0_1 - 0.133333333333333*G0_0_2 - 0.0333333333333336*G0_1_0 - 0.0333333333333336*G0_1_1 - 0.133333333333333*G0_1_2 - 0.0333333333333335*G0_2_0 - 0.0333333333333335*G0_2_1 - 0.133333333333333*G0_2_2 - 0.0333333333333336*G3_0_0 - 0.0333333333333336*G3_0_1 - 0.133333333333333*G3_0_2 - 0.0333333333333336*G3_1_0 - 0.0333333333333336*G3_1_1 - 0.133333333333333*G3_1_2 - 0.0333333333333335*G3_2_0 - 0.0333333333333335*G3_2_1 - 0.1333333 [...]
-    A[8] = -0.0333333333333336*G0_0_0 - 0.133333333333333*G0_0_1 - 0.0333333333333335*G0_0_2 - 0.0333333333333336*G0_1_0 - 0.133333333333333*G0_1_1 - 0.0333333333333335*G0_1_2 - 0.0333333333333335*G0_2_0 - 0.133333333333333*G0_2_1 - 0.0333333333333334*G0_2_2 - 0.0333333333333336*G3_0_0 - 0.133333333333333*G3_0_1 - 0.0333333333333335*G3_0_2 - 0.0333333333333336*G3_1_0 - 0.133333333333333*G3_1_1 - 0.0333333333333335*G3_1_2 - 0.0333333333333335*G3_2_0 - 0.133333333333333*G3_2_1 - 0.03333333 [...]
+    A[8] = -0.0333333333333336*G0_0_0 - 0.133333333333333*G0_0_1 - 0.0333333333333335*G0_0_2 - 0.0333333333333336*G0_1_0 - 0.133333333333333*G0_1_1 - 0.0333333333333335*G0_1_2 - 0.0333333333333335*G0_2_0 - 0.133333333333333*G0_2_1 - 0.0333333333333335*G0_2_2 - 0.0333333333333336*G3_0_0 - 0.133333333333333*G3_0_1 - 0.0333333333333335*G3_0_2 - 0.0333333333333336*G3_1_0 - 0.133333333333333*G3_1_1 - 0.0333333333333335*G3_1_2 - 0.0333333333333335*G3_2_0 - 0.133333333333333*G3_2_1 - 0.03333333 [...]
     A[9] = -0.133333333333333*G0_0_0 - 0.0333333333333335*G0_0_1 - 0.0333333333333335*G0_0_2 - 0.133333333333333*G0_1_0 - 0.0333333333333335*G0_1_1 - 0.0333333333333335*G0_1_2 - 0.133333333333333*G0_2_0 - 0.0333333333333335*G0_2_1 - 0.0333333333333335*G0_2_2 - 0.133333333333333*G3_0_0 - 0.0333333333333335*G3_0_1 - 0.0333333333333335*G3_0_2 - 0.133333333333333*G3_1_0 - 0.0333333333333335*G3_1_1 - 0.0333333333333335*G3_1_2 - 0.133333333333333*G3_2_0 - 0.0333333333333335*G3_2_1 - 0.03333333 [...]
     A[10] = 0.0;
     A[11] = 0.0;
@@ -23655,13 +26733,13 @@ public:
     A[33] = 0.0;
     A[34] = 0.0333333333333333*G0_0_0 + 0.0333333333333333*G0_0_1 + 0.0333333333333333*G0_0_2 + 0.0333333333333333*G3_0_0 + 0.0333333333333333*G3_0_1 + 0.0333333333333333*G3_0_2 + 0.0333333333333333*G6_0_0 + 0.0333333333333333*G6_0_1 + 0.0333333333333333*G6_0_2;
     A[35] = 0.1*G0_0_0 + 0.1*G3_0_0 + 0.1*G6_0_0;
-    A[36] = -0.0333333333333334*G0_0_1 - 0.0333333333333334*G3_0_1 - 0.0333333333333334*G6_0_1;
+    A[36] = -0.0333333333333333*G0_0_1 - 0.0333333333333333*G3_0_1 - 0.0333333333333333*G6_0_1;
     A[37] = -0.0333333333333333*G0_0_2 - 0.0333333333333333*G3_0_2 - 0.0333333333333333*G6_0_2;
-    A[38] = -0.0333333333333335*G0_0_1 - 0.0333333333333335*G0_0_2 - 0.0333333333333335*G3_0_1 - 0.0333333333333335*G3_0_2 - 0.0333333333333335*G6_0_1 - 0.0333333333333335*G6_0_2;
+    A[38] = -0.0333333333333335*G0_0_1 - 0.0333333333333334*G0_0_2 - 0.0333333333333335*G3_0_1 - 0.0333333333333334*G3_0_2 - 0.0333333333333335*G6_0_1 - 0.0333333333333334*G6_0_2;
     A[39] = -0.0333333333333335*G0_0_0 + 0.1*G0_0_2 - 0.0333333333333335*G3_0_0 + 0.1*G3_0_2 - 0.0333333333333335*G6_0_0 + 0.1*G6_0_2;
-    A[40] = -0.0333333333333336*G0_0_0 + 0.1*G0_0_1 - 0.0333333333333336*G3_0_0 + 0.1*G3_0_1 - 0.0333333333333336*G6_0_0 + 0.1*G6_0_1;
+    A[40] = -0.0333333333333335*G0_0_0 + 0.1*G0_0_1 - 0.0333333333333335*G3_0_0 + 0.1*G3_0_1 - 0.0333333333333335*G6_0_0 + 0.1*G6_0_1;
     A[41] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_0_1 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_0_1 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_0_1;
-    A[42] = 0.0333333333333336*G0_0_0 + 0.0333333333333335*G0_0_2 + 0.0333333333333336*G3_0_0 + 0.0333333333333335*G3_0_2 + 0.0333333333333336*G6_0_0 + 0.0333333333333335*G6_0_2;
+    A[42] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_0_2 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_0_2 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_0_2;
     A[43] = -0.133333333333333*G0_0_0 - 0.1*G0_0_1 - 0.1*G0_0_2 - 0.133333333333333*G3_0_0 - 0.1*G3_0_1 - 0.1*G3_0_2 - 0.133333333333333*G6_0_0 - 0.1*G6_0_1 - 0.1*G6_0_2;
     A[44] = 0.0;
     A[45] = 0.0;
@@ -23688,12 +26766,12 @@ public:
     A[66] = 0.0;
     A[67] = 0.0;
     A[68] = 0.0333333333333334*G0_1_0 + 0.0333333333333333*G0_1_1 + 0.0333333333333333*G0_1_2 + 0.0333333333333334*G3_1_0 + 0.0333333333333333*G3_1_1 + 0.0333333333333333*G3_1_2 + 0.0333333333333334*G6_1_0 + 0.0333333333333333*G6_1_1 + 0.0333333333333333*G6_1_2;
-    A[69] = -0.0333333333333334*G0_1_0 - 0.0333333333333334*G3_1_0 - 0.0333333333333334*G6_1_0;
+    A[69] = -0.0333333333333333*G0_1_0 - 0.0333333333333333*G3_1_0 - 0.0333333333333333*G6_1_0;
     A[70] = 0.1*G0_1_1 + 0.1*G3_1_1 + 0.1*G6_1_1;
     A[71] = -0.0333333333333333*G0_1_2 - 0.0333333333333333*G3_1_2 - 0.0333333333333333*G6_1_2;
     A[72] = -0.0333333333333337*G0_1_1 + 0.1*G0_1_2 - 0.0333333333333337*G3_1_1 + 0.1*G3_1_2 - 0.0333333333333337*G6_1_1 + 0.1*G6_1_2;
     A[73] = -0.0333333333333337*G0_1_0 - 0.0333333333333338*G0_1_2 - 0.0333333333333337*G3_1_0 - 0.0333333333333338*G3_1_2 - 0.0333333333333337*G6_1_0 - 0.0333333333333338*G6_1_2;
-    A[74] = 0.1*G0_1_0 - 0.0333333333333337*G0_1_1 + 0.1*G3_1_0 - 0.0333333333333337*G3_1_1 + 0.1*G6_1_0 - 0.0333333333333337*G6_1_1;
+    A[74] = 0.1*G0_1_0 - 0.0333333333333336*G0_1_1 + 0.1*G3_1_0 - 0.0333333333333336*G3_1_1 + 0.1*G6_1_0 - 0.0333333333333336*G6_1_1;
     A[75] = 0.0333333333333337*G0_1_0 + 0.0333333333333337*G0_1_1 + 0.0333333333333337*G3_1_0 + 0.0333333333333337*G3_1_1 + 0.0333333333333337*G6_1_0 + 0.0333333333333337*G6_1_1;
     A[76] = -0.1*G0_1_0 - 0.133333333333333*G0_1_1 - 0.1*G0_1_2 - 0.1*G3_1_0 - 0.133333333333333*G3_1_1 - 0.1*G3_1_2 - 0.1*G6_1_0 - 0.133333333333333*G6_1_1 - 0.1*G6_1_2;
     A[77] = 0.0333333333333337*G0_1_1 + 0.0333333333333338*G0_1_2 + 0.0333333333333337*G3_1_1 + 0.0333333333333338*G3_1_2 + 0.0333333333333337*G6_1_1 + 0.0333333333333338*G6_1_2;
@@ -23722,12 +26800,12 @@ public:
     A[100] = 0.0;
     A[101] = 0.0;
     A[102] = 0.0333333333333334*G0_2_0 + 0.0333333333333334*G0_2_1 + 0.0333333333333334*G0_2_2 + 0.0333333333333334*G3_2_0 + 0.0333333333333334*G3_2_1 + 0.0333333333333334*G3_2_2 + 0.0333333333333334*G6_2_0 + 0.0333333333333334*G6_2_1 + 0.0333333333333334*G6_2_2;
-    A[103] = -0.0333333333333333*G0_2_0 - 0.0333333333333333*G3_2_0 - 0.0333333333333333*G6_2_0;
+    A[103] = -0.0333333333333334*G0_2_0 - 0.0333333333333334*G3_2_0 - 0.0333333333333334*G6_2_0;
     A[104] = -0.0333333333333333*G0_2_1 - 0.0333333333333333*G3_2_1 - 0.0333333333333333*G6_2_1;
     A[105] = 0.1*G0_2_2 + 0.1*G3_2_2 + 0.1*G6_2_2;
     A[106] = 0.1*G0_2_1 - 0.0333333333333343*G0_2_2 + 0.1*G3_2_1 - 0.0333333333333343*G3_2_2 + 0.1*G6_2_1 - 0.0333333333333343*G6_2_2;
-    A[107] = 0.1*G0_2_0 - 0.0333333333333339*G0_2_2 + 0.1*G3_2_0 - 0.0333333333333339*G3_2_2 + 0.1*G6_2_0 - 0.0333333333333339*G6_2_2;
-    A[108] = -0.0333333333333341*G0_2_0 - 0.0333333333333342*G0_2_1 - 0.0333333333333341*G3_2_0 - 0.0333333333333342*G3_2_1 - 0.0333333333333341*G6_2_0 - 0.0333333333333342*G6_2_1;
+    A[107] = 0.1*G0_2_0 - 0.033333333333334*G0_2_2 + 0.1*G3_2_0 - 0.033333333333334*G3_2_2 + 0.1*G6_2_0 - 0.033333333333334*G6_2_2;
+    A[108] = -0.033333333333334*G0_2_0 - 0.0333333333333342*G0_2_1 - 0.033333333333334*G3_2_0 - 0.0333333333333342*G3_2_1 - 0.033333333333334*G6_2_0 - 0.0333333333333342*G6_2_1;
     A[109] = -0.1*G0_2_0 - 0.1*G0_2_1 - 0.133333333333333*G0_2_2 - 0.1*G3_2_0 - 0.1*G3_2_1 - 0.133333333333333*G3_2_2 - 0.1*G6_2_0 - 0.1*G6_2_1 - 0.133333333333333*G6_2_2;
     A[110] = 0.0333333333333341*G0_2_0 + 0.0333333333333341*G0_2_2 + 0.0333333333333341*G3_2_0 + 0.0333333333333341*G3_2_2 + 0.0333333333333341*G6_2_0 + 0.0333333333333341*G6_2_2;
     A[111] = 0.033333333333334*G0_2_1 + 0.033333333333334*G0_2_2 + 0.033333333333334*G3_2_1 + 0.033333333333334*G3_2_2 + 0.033333333333334*G6_2_1 + 0.033333333333334*G6_2_2;
@@ -23755,8 +26833,8 @@ public:
     A[133] = 0.0;
     A[134] = 0.0;
     A[135] = 0.0;
-    A[136] = 0.0333333333333335*G0_1_0 + 0.0333333333333336*G0_1_1 + 0.0333333333333335*G0_1_2 + 0.0333333333333335*G0_2_0 + 0.0333333333333335*G0_2_1 + 0.0333333333333334*G0_2_2 + 0.0333333333333335*G3_1_0 + 0.0333333333333336*G3_1_1 + 0.0333333333333335*G3_1_2 + 0.0333333333333335*G3_2_0 + 0.0333333333333335*G3_2_1 + 0.0333333333333334*G3_2_2 + 0.0333333333333335*G6_1_0 + 0.0333333333333336*G6_1_1 + 0.0333333333333335*G6_1_2 + 0.0333333333333335*G6_2_0 + 0.0333333333333335*G6_2_1 + 0.0 [...]
-    A[137] = -0.0333333333333335*G0_1_0 - 0.0333333333333335*G0_2_0 - 0.0333333333333335*G3_1_0 - 0.0333333333333335*G3_2_0 - 0.0333333333333335*G6_1_0 - 0.0333333333333335*G6_2_0;
+    A[136] = 0.0333333333333336*G0_1_0 + 0.0333333333333336*G0_1_1 + 0.0333333333333335*G0_1_2 + 0.0333333333333335*G0_2_0 + 0.0333333333333335*G0_2_1 + 0.0333333333333334*G0_2_2 + 0.0333333333333336*G3_1_0 + 0.0333333333333336*G3_1_1 + 0.0333333333333335*G3_1_2 + 0.0333333333333335*G3_2_0 + 0.0333333333333335*G3_2_1 + 0.0333333333333334*G3_2_2 + 0.0333333333333336*G6_1_0 + 0.0333333333333336*G6_1_1 + 0.0333333333333335*G6_1_2 + 0.0333333333333335*G6_2_0 + 0.0333333333333335*G6_2_1 + 0.0 [...]
+    A[137] = -0.0333333333333335*G0_1_0 - 0.0333333333333334*G0_2_0 - 0.0333333333333335*G3_1_0 - 0.0333333333333334*G3_2_0 - 0.0333333333333335*G6_1_0 - 0.0333333333333334*G6_2_0;
     A[138] = -0.0333333333333337*G0_1_1 + 0.1*G0_2_1 - 0.0333333333333337*G3_1_1 + 0.1*G3_2_1 - 0.0333333333333337*G6_1_1 + 0.1*G6_2_1;
     A[139] = 0.1*G0_1_2 - 0.0333333333333343*G0_2_2 + 0.1*G3_1_2 - 0.0333333333333343*G3_2_2 + 0.1*G6_1_2 - 0.0333333333333343*G6_2_2;
     A[140] = 0.266666666666667*G0_1_1 + 0.133333333333333*G0_1_2 + 0.133333333333333*G0_2_1 + 0.266666666666667*G0_2_2 + 0.266666666666667*G3_1_1 + 0.133333333333333*G3_1_2 + 0.133333333333333*G3_2_1 + 0.266666666666667*G3_2_2 + 0.266666666666667*G6_1_1 + 0.133333333333333*G6_1_2 + 0.133333333333333*G6_2_1 + 0.266666666666667*G6_2_2;
@@ -23789,14 +26867,14 @@ public:
     A[167] = 0.0;
     A[168] = 0.0;
     A[169] = 0.0;
-    A[170] = 0.0333333333333335*G0_0_0 + 0.0333333333333336*G0_0_1 + 0.0333333333333335*G0_0_2 + 0.0333333333333336*G0_2_0 + 0.0333333333333336*G0_2_1 + 0.0333333333333335*G0_2_2 + 0.0333333333333335*G3_0_0 + 0.0333333333333336*G3_0_1 + 0.0333333333333335*G3_0_2 + 0.0333333333333336*G3_2_0 + 0.0333333333333336*G3_2_1 + 0.0333333333333335*G3_2_2 + 0.0333333333333335*G6_0_0 + 0.0333333333333336*G6_0_1 + 0.0333333333333335*G6_0_2 + 0.0333333333333336*G6_2_0 + 0.0333333333333336*G6_2_1 + 0.0 [...]
+    A[170] = 0.0333333333333336*G0_0_0 + 0.0333333333333336*G0_0_1 + 0.0333333333333335*G0_0_2 + 0.0333333333333335*G0_2_0 + 0.0333333333333336*G0_2_1 + 0.0333333333333335*G0_2_2 + 0.0333333333333336*G3_0_0 + 0.0333333333333336*G3_0_1 + 0.0333333333333335*G3_0_2 + 0.0333333333333335*G3_2_0 + 0.0333333333333336*G3_2_1 + 0.0333333333333335*G3_2_2 + 0.0333333333333336*G6_0_0 + 0.0333333333333336*G6_0_1 + 0.0333333333333335*G6_0_2 + 0.0333333333333335*G6_2_0 + 0.0333333333333336*G6_2_1 + 0.0 [...]
     A[171] = -0.0333333333333335*G0_0_0 + 0.1*G0_2_0 - 0.0333333333333335*G3_0_0 + 0.1*G3_2_0 - 0.0333333333333335*G6_0_0 + 0.1*G6_2_0;
     A[172] = -0.0333333333333337*G0_0_1 - 0.0333333333333338*G0_2_1 - 0.0333333333333337*G3_0_1 - 0.0333333333333338*G3_2_1 - 0.0333333333333337*G6_0_1 - 0.0333333333333338*G6_2_1;
-    A[173] = 0.1*G0_0_2 - 0.0333333333333339*G0_2_2 + 0.1*G3_0_2 - 0.0333333333333339*G3_2_2 + 0.1*G6_0_2 - 0.0333333333333339*G6_2_2;
+    A[173] = 0.1*G0_0_2 - 0.033333333333334*G0_2_2 + 0.1*G3_0_2 - 0.033333333333334*G3_2_2 + 0.1*G6_0_2 - 0.033333333333334*G6_2_2;
     A[174] = 0.266666666666667*G0_0_1 + 0.133333333333333*G0_0_2 + 0.133333333333335*G0_2_1 + 0.133333333333335*G0_2_2 + 0.266666666666667*G3_0_1 + 0.133333333333333*G3_0_2 + 0.133333333333335*G3_2_1 + 0.133333333333335*G3_2_2 + 0.266666666666667*G6_0_1 + 0.133333333333333*G6_0_2 + 0.133333333333335*G6_2_1 + 0.133333333333335*G6_2_2;
     A[175] = 0.266666666666667*G0_0_0 + 0.133333333333334*G0_0_2 + 0.133333333333334*G0_2_0 + 0.266666666666669*G0_2_2 + 0.266666666666667*G3_0_0 + 0.133333333333334*G3_0_2 + 0.133333333333334*G3_2_0 + 0.266666666666669*G3_2_2 + 0.266666666666667*G6_0_0 + 0.133333333333334*G6_0_2 + 0.133333333333334*G6_2_0 + 0.266666666666669*G6_2_2;
     A[176] = 0.133333333333333*G0_0_0 + 0.133333333333334*G0_0_1 + 0.133333333333334*G0_2_0 + 0.266666666666669*G0_2_1 + 0.133333333333333*G3_0_0 + 0.133333333333334*G3_0_1 + 0.133333333333334*G3_2_0 + 0.266666666666669*G3_2_1 + 0.133333333333333*G6_0_0 + 0.133333333333334*G6_0_1 + 0.133333333333334*G6_2_0 + 0.266666666666669*G6_2_1;
-    A[177] = -0.266666666666667*G0_0_0 - 0.266666666666667*G0_0_1 - 0.133333333333334*G0_0_2 - 0.133333333333335*G0_2_0 - 0.133333333333335*G0_2_1 - 0.266666666666667*G3_0_0 - 0.266666666666667*G3_0_1 - 0.133333333333334*G3_0_2 - 0.133333333333335*G3_2_0 - 0.133333333333335*G3_2_1 - 0.266666666666667*G6_0_0 - 0.266666666666667*G6_0_1 - 0.133333333333334*G6_0_2 - 0.133333333333335*G6_2_0 - 0.133333333333335*G6_2_1;
+    A[177] = -0.266666666666667*G0_0_0 - 0.266666666666667*G0_0_1 - 0.133333333333333*G0_0_2 - 0.133333333333335*G0_2_0 - 0.133333333333335*G0_2_1 - 0.266666666666667*G3_0_0 - 0.266666666666667*G3_0_1 - 0.133333333333333*G3_0_2 - 0.133333333333335*G3_2_0 - 0.133333333333335*G3_2_1 - 0.266666666666667*G6_0_0 - 0.266666666666667*G6_0_1 - 0.133333333333333*G6_0_2 - 0.133333333333335*G6_2_0 - 0.133333333333335*G6_2_1;
     A[178] = -0.133333333333333*G0_0_0 - 0.133333333333333*G0_0_2 - 0.133333333333334*G0_2_0 - 0.133333333333334*G0_2_2 - 0.133333333333333*G3_0_0 - 0.133333333333333*G3_0_2 - 0.133333333333334*G3_2_0 - 0.133333333333334*G3_2_2 - 0.133333333333333*G6_0_0 - 0.133333333333333*G6_0_2 - 0.133333333333334*G6_2_0 - 0.133333333333334*G6_2_2;
     A[179] = -0.133333333333333*G0_0_1 - 0.133333333333333*G0_0_2 - 0.133333333333333*G0_2_0 - 0.266666666666668*G0_2_1 - 0.266666666666668*G0_2_2 - 0.133333333333333*G3_0_1 - 0.133333333333333*G3_0_2 - 0.133333333333333*G3_2_0 - 0.266666666666668*G3_2_1 - 0.266666666666668*G3_2_2 - 0.133333333333333*G6_0_1 - 0.133333333333333*G6_0_2 - 0.133333333333333*G6_2_0 - 0.266666666666668*G6_2_1 - 0.266666666666668*G6_2_2;
     A[180] = 0.0;
@@ -23823,15 +26901,15 @@ public:
     A[201] = 0.0;
     A[202] = 0.0;
     A[203] = 0.0;
-    A[204] = 0.0333333333333336*G0_0_0 + 0.0333333333333336*G0_0_1 + 0.0333333333333335*G0_0_2 + 0.0333333333333335*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333335*G0_1_2 + 0.0333333333333336*G3_0_0 + 0.0333333333333336*G3_0_1 + 0.0333333333333335*G3_0_2 + 0.0333333333333335*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333335*G3_1_2 + 0.0333333333333336*G6_0_0 + 0.0333333333333336*G6_0_1 + 0.0333333333333335*G6_0_2 + 0.0333333333333335*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0 [...]
-    A[205] = -0.0333333333333336*G0_0_0 + 0.1*G0_1_0 - 0.0333333333333336*G3_0_0 + 0.1*G3_1_0 - 0.0333333333333336*G6_0_0 + 0.1*G6_1_0;
+    A[204] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_0_1 + 0.0333333333333335*G0_0_2 + 0.0333333333333335*G0_1_0 + 0.0333333333333335*G0_1_1 + 0.0333333333333335*G0_1_2 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_0_1 + 0.0333333333333335*G3_0_2 + 0.0333333333333335*G3_1_0 + 0.0333333333333335*G3_1_1 + 0.0333333333333335*G3_1_2 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_0_1 + 0.0333333333333335*G6_0_2 + 0.0333333333333335*G6_1_0 + 0.0333333333333335*G6_1_1 + 0.0 [...]
+    A[205] = -0.0333333333333335*G0_0_0 + 0.1*G0_1_0 - 0.0333333333333335*G3_0_0 + 0.1*G3_1_0 - 0.0333333333333335*G6_0_0 + 0.1*G6_1_0;
     A[206] = 0.1*G0_0_1 - 0.0333333333333336*G0_1_1 + 0.1*G3_0_1 - 0.0333333333333336*G3_1_1 + 0.1*G6_0_1 - 0.0333333333333336*G6_1_1;
-    A[207] = -0.0333333333333341*G0_0_2 - 0.0333333333333342*G0_1_2 - 0.0333333333333341*G3_0_2 - 0.0333333333333342*G3_1_2 - 0.0333333333333341*G6_0_2 - 0.0333333333333342*G6_1_2;
+    A[207] = -0.033333333333334*G0_0_2 - 0.0333333333333342*G0_1_2 - 0.033333333333334*G3_0_2 - 0.0333333333333342*G3_1_2 - 0.033333333333334*G6_0_2 - 0.0333333333333342*G6_1_2;
     A[208] = 0.133333333333334*G0_0_1 + 0.266666666666667*G0_0_2 + 0.133333333333334*G0_1_1 + 0.133333333333335*G0_1_2 + 0.133333333333334*G3_0_1 + 0.266666666666667*G3_0_2 + 0.133333333333334*G3_1_1 + 0.133333333333335*G3_1_2 + 0.133333333333334*G6_0_1 + 0.266666666666667*G6_0_2 + 0.133333333333334*G6_1_1 + 0.133333333333335*G6_1_2;
     A[209] = 0.133333333333333*G0_0_0 + 0.133333333333334*G0_0_2 + 0.133333333333334*G0_1_0 + 0.266666666666669*G0_1_2 + 0.133333333333333*G3_0_0 + 0.133333333333334*G3_0_2 + 0.133333333333334*G3_1_0 + 0.266666666666669*G3_1_2 + 0.133333333333333*G6_0_0 + 0.133333333333334*G6_0_2 + 0.133333333333334*G6_1_0 + 0.266666666666669*G6_1_2;
     A[210] = 0.266666666666667*G0_0_0 + 0.133333333333334*G0_0_1 + 0.133333333333334*G0_1_0 + 0.266666666666669*G0_1_1 + 0.266666666666667*G3_0_0 + 0.133333333333334*G3_0_1 + 0.133333333333334*G3_1_0 + 0.266666666666669*G3_1_1 + 0.266666666666667*G6_0_0 + 0.133333333333334*G6_0_1 + 0.133333333333334*G6_1_0 + 0.266666666666669*G6_1_1;
-    A[211] = -0.133333333333333*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_1 - 0.133333333333333*G3_0_0 - 0.133333333333334*G3_0_1 - 0.133333333333334*G3_1_0 - 0.133333333333334*G3_1_1 - 0.133333333333333*G6_0_0 - 0.133333333333334*G6_0_1 - 0.133333333333334*G6_1_0 - 0.133333333333334*G6_1_1;
-    A[212] = -0.266666666666667*G0_0_0 - 0.133333333333334*G0_0_1 - 0.266666666666667*G0_0_2 - 0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_2 - 0.266666666666667*G3_0_0 - 0.133333333333334*G3_0_1 - 0.266666666666667*G3_0_2 - 0.133333333333334*G3_1_0 - 0.133333333333334*G3_1_2 - 0.266666666666667*G6_0_0 - 0.133333333333334*G6_0_1 - 0.266666666666667*G6_0_2 - 0.133333333333334*G6_1_0 - 0.133333333333334*G6_1_2;
+    A[211] = -0.133333333333333*G0_0_0 - 0.133333333333333*G0_0_1 - 0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_1 - 0.133333333333333*G3_0_0 - 0.133333333333333*G3_0_1 - 0.133333333333334*G3_1_0 - 0.133333333333334*G3_1_1 - 0.133333333333333*G6_0_0 - 0.133333333333333*G6_0_1 - 0.133333333333334*G6_1_0 - 0.133333333333334*G6_1_1;
+    A[212] = -0.266666666666667*G0_0_0 - 0.133333333333333*G0_0_1 - 0.266666666666667*G0_0_2 - 0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_2 - 0.266666666666667*G3_0_0 - 0.133333333333333*G3_0_1 - 0.266666666666667*G3_0_2 - 0.133333333333334*G3_1_0 - 0.133333333333334*G3_1_2 - 0.266666666666667*G6_0_0 - 0.133333333333333*G6_0_1 - 0.266666666666667*G6_0_2 - 0.133333333333334*G6_1_0 - 0.133333333333334*G6_1_2;
     A[213] = -0.133333333333334*G0_0_1 - 0.133333333333333*G0_0_2 - 0.133333333333333*G0_1_0 - 0.266666666666668*G0_1_1 - 0.266666666666668*G0_1_2 - 0.133333333333334*G3_0_1 - 0.133333333333333*G3_0_2 - 0.133333333333333*G3_1_0 - 0.266666666666668*G3_1_1 - 0.266666666666668*G3_1_2 - 0.133333333333334*G6_0_1 - 0.133333333333333*G6_0_2 - 0.133333333333333*G6_1_0 - 0.266666666666668*G6_1_1 - 0.266666666666668*G6_1_2;
     A[214] = 0.0;
     A[215] = 0.0;
@@ -23863,7 +26941,7 @@ public:
     A[241] = -0.1*G0_0_2 - 0.1*G0_1_2 - 0.133333333333333*G0_2_2 - 0.1*G3_0_2 - 0.1*G3_1_2 - 0.133333333333333*G3_2_2 - 0.1*G6_0_2 - 0.1*G6_1_2 - 0.133333333333333*G6_2_2;
     A[242] = -0.266666666666667*G0_0_1 - 0.133333333333333*G0_0_2 - 0.266666666666667*G0_1_1 - 0.133333333333333*G0_1_2 - 0.133333333333333*G0_2_1 - 0.266666666666667*G3_0_1 - 0.133333333333333*G3_0_2 - 0.266666666666667*G3_1_1 - 0.133333333333333*G3_1_2 - 0.133333333333333*G3_2_1 - 0.266666666666667*G6_0_1 - 0.133333333333333*G6_0_2 - 0.266666666666667*G6_1_1 - 0.133333333333333*G6_1_2 - 0.133333333333333*G6_2_1;
     A[243] = -0.266666666666667*G0_0_0 - 0.133333333333335*G0_0_2 - 0.266666666666667*G0_1_0 - 0.133333333333335*G0_1_2 - 0.133333333333334*G0_2_0 - 0.266666666666667*G3_0_0 - 0.133333333333335*G3_0_2 - 0.266666666666667*G3_1_0 - 0.133333333333335*G3_1_2 - 0.133333333333334*G3_2_0 - 0.266666666666667*G6_0_0 - 0.133333333333335*G6_0_2 - 0.266666666666667*G6_1_0 - 0.133333333333335*G6_1_2 - 0.133333333333334*G6_2_0;
-    A[244] = -0.133333333333333*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333334*G0_1_0 - 0.133333333333334*G0_1_1 - 0.133333333333333*G3_0_0 - 0.133333333333334*G3_0_1 - 0.133333333333334*G3_1_0 - 0.133333333333334*G3_1_1 - 0.133333333333333*G6_0_0 - 0.133333333333334*G6_0_1 - 0.133333333333334*G6_1_0 - 0.133333333333334*G6_1_1;
+    A[244] = -0.133333333333333*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333333*G0_1_0 - 0.133333333333334*G0_1_1 - 0.133333333333333*G3_0_0 - 0.133333333333334*G3_0_1 - 0.133333333333333*G3_1_0 - 0.133333333333334*G3_1_1 - 0.133333333333333*G6_0_0 - 0.133333333333334*G6_0_1 - 0.133333333333333*G6_1_0 - 0.133333333333334*G6_1_1;
     A[245] = 0.266666666666667*G0_0_0 + 0.266666666666667*G0_0_1 + 0.133333333333334*G0_0_2 + 0.266666666666667*G0_1_0 + 0.266666666666667*G0_1_1 + 0.133333333333334*G0_1_2 + 0.133333333333334*G0_2_0 + 0.133333333333334*G0_2_1 + 0.266666666666667*G0_2_2 + 0.266666666666667*G3_0_0 + 0.266666666666667*G3_0_1 + 0.133333333333334*G3_0_2 + 0.266666666666667*G3_1_0 + 0.266666666666667*G3_1_1 + 0.133333333333334*G3_1_2 + 0.133333333333334*G3_2_0 + 0.133333333333334*G3_2_1 + 0.266666666666667*G3 [...]
     A[246] = 0.133333333333333*G0_0_0 + 0.133333333333333*G0_0_2 + 0.133333333333334*G0_1_0 + 0.133333333333333*G0_1_2 + 0.133333333333333*G0_2_1 + 0.133333333333333*G3_0_0 + 0.133333333333333*G3_0_2 + 0.133333333333334*G3_1_0 + 0.133333333333333*G3_1_2 + 0.133333333333333*G3_2_1 + 0.133333333333333*G6_0_0 + 0.133333333333333*G6_0_2 + 0.133333333333334*G6_1_0 + 0.133333333333333*G6_1_2 + 0.133333333333333*G6_2_1;
     A[247] = 0.133333333333333*G0_0_1 + 0.133333333333333*G0_0_2 + 0.133333333333334*G0_1_1 + 0.133333333333334*G0_1_2 + 0.133333333333333*G0_2_0 + 0.133333333333333*G3_0_1 + 0.133333333333333*G3_0_2 + 0.133333333333334*G3_1_1 + 0.133333333333334*G3_1_2 + 0.133333333333333*G3_2_0 + 0.133333333333333*G6_0_1 + 0.133333333333333*G6_0_2 + 0.133333333333334*G6_1_1 + 0.133333333333334*G6_1_2 + 0.133333333333333*G6_2_0;
@@ -23891,13 +26969,13 @@ public:
     A[269] = 0.0;
     A[270] = 0.0;
     A[271] = 0.0;
-    A[272] = -0.0333333333333336*G0_0_0 - 0.0333333333333336*G0_0_1 - 0.0333333333333335*G0_0_2 - 0.133333333333333*G0_1_0 - 0.133333333333333*G0_1_1 - 0.133333333333333*G0_1_2 - 0.0333333333333335*G0_2_0 - 0.0333333333333335*G0_2_1 - 0.0333333333333334*G0_2_2 - 0.0333333333333336*G3_0_0 - 0.0333333333333336*G3_0_1 - 0.0333333333333335*G3_0_2 - 0.133333333333333*G3_1_0 - 0.133333333333333*G3_1_1 - 0.133333333333333*G3_1_2 - 0.0333333333333335*G3_2_0 - 0.0333333333333335*G3_2_1 - 0.033333 [...]
-    A[273] = 0.0333333333333336*G0_0_0 + 0.0333333333333335*G0_2_0 + 0.0333333333333336*G3_0_0 + 0.0333333333333335*G3_2_0 + 0.0333333333333336*G6_0_0 + 0.0333333333333335*G6_2_0;
+    A[272] = -0.0333333333333336*G0_0_0 - 0.0333333333333335*G0_0_1 - 0.0333333333333335*G0_0_2 - 0.133333333333333*G0_1_0 - 0.133333333333333*G0_1_1 - 0.133333333333333*G0_1_2 - 0.0333333333333335*G0_2_0 - 0.0333333333333335*G0_2_1 - 0.0333333333333335*G0_2_2 - 0.0333333333333336*G3_0_0 - 0.0333333333333335*G3_0_1 - 0.0333333333333335*G3_0_2 - 0.133333333333333*G3_1_0 - 0.133333333333333*G3_1_1 - 0.133333333333333*G3_1_2 - 0.0333333333333335*G3_2_0 - 0.0333333333333335*G3_2_1 - 0.033333 [...]
+    A[273] = 0.0333333333333335*G0_0_0 + 0.0333333333333335*G0_2_0 + 0.0333333333333335*G3_0_0 + 0.0333333333333335*G3_2_0 + 0.0333333333333335*G6_0_0 + 0.0333333333333335*G6_2_0;
     A[274] = -0.1*G0_0_1 - 0.133333333333333*G0_1_1 - 0.1*G0_2_1 - 0.1*G3_0_1 - 0.133333333333333*G3_1_1 - 0.1*G3_2_1 - 0.1*G6_0_1 - 0.133333333333333*G6_1_1 - 0.1*G6_2_1;
     A[275] = 0.0333333333333341*G0_0_2 + 0.0333333333333341*G0_2_2 + 0.0333333333333341*G3_0_2 + 0.0333333333333341*G3_2_2 + 0.0333333333333341*G6_0_2 + 0.0333333333333341*G6_2_2;
     A[276] = -0.133333333333334*G0_0_1 - 0.266666666666667*G0_0_2 - 0.133333333333334*G0_1_2 - 0.133333333333333*G0_2_1 - 0.266666666666667*G0_2_2 - 0.133333333333334*G3_0_1 - 0.266666666666667*G3_0_2 - 0.133333333333334*G3_1_2 - 0.133333333333333*G3_2_1 - 0.266666666666667*G3_2_2 - 0.133333333333334*G6_0_1 - 0.266666666666667*G6_0_2 - 0.133333333333334*G6_1_2 - 0.133333333333333*G6_2_1 - 0.266666666666667*G6_2_2;
     A[277] = -0.133333333333333*G0_0_0 - 0.133333333333334*G0_0_2 - 0.133333333333333*G0_2_0 - 0.133333333333334*G0_2_2 - 0.133333333333333*G3_0_0 - 0.133333333333334*G3_0_2 - 0.133333333333333*G3_2_0 - 0.133333333333334*G3_2_2 - 0.133333333333333*G6_0_0 - 0.133333333333334*G6_0_2 - 0.133333333333333*G6_2_0 - 0.133333333333334*G6_2_2;
-    A[278] = -0.266666666666667*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333334*G0_1_0 - 0.266666666666667*G0_2_0 - 0.133333333333334*G0_2_1 - 0.266666666666667*G3_0_0 - 0.133333333333334*G3_0_1 - 0.133333333333334*G3_1_0 - 0.266666666666667*G3_2_0 - 0.133333333333334*G3_2_1 - 0.266666666666667*G6_0_0 - 0.133333333333334*G6_0_1 - 0.133333333333334*G6_1_0 - 0.266666666666667*G6_2_0 - 0.133333333333334*G6_2_1;
+    A[278] = -0.266666666666667*G0_0_0 - 0.133333333333334*G0_0_1 - 0.133333333333333*G0_1_0 - 0.266666666666667*G0_2_0 - 0.133333333333334*G0_2_1 - 0.266666666666667*G3_0_0 - 0.133333333333334*G3_0_1 - 0.133333333333333*G3_1_0 - 0.266666666666667*G3_2_0 - 0.133333333333334*G3_2_1 - 0.266666666666667*G6_0_0 - 0.133333333333334*G6_0_1 - 0.133333333333333*G6_1_0 - 0.266666666666667*G6_2_0 - 0.133333333333334*G6_2_1;
     A[279] = 0.133333333333333*G0_0_0 + 0.133333333333334*G0_0_1 + 0.133333333333333*G0_1_2 + 0.133333333333333*G0_2_0 + 0.133333333333333*G0_2_1 + 0.133333333333333*G3_0_0 + 0.133333333333334*G3_0_1 + 0.133333333333333*G3_1_2 + 0.133333333333333*G3_2_0 + 0.133333333333333*G3_2_1 + 0.133333333333333*G6_0_0 + 0.133333333333334*G6_0_1 + 0.133333333333333*G6_1_2 + 0.133333333333333*G6_2_0 + 0.133333333333333*G6_2_1;
     A[280] = 0.266666666666667*G0_0_0 + 0.133333333333334*G0_0_1 + 0.266666666666667*G0_0_2 + 0.133333333333334*G0_1_0 + 0.266666666666667*G0_1_1 + 0.133333333333333*G0_1_2 + 0.266666666666667*G0_2_0 + 0.133333333333333*G0_2_1 + 0.266666666666667*G0_2_2 + 0.266666666666667*G3_0_0 + 0.133333333333334*G3_0_1 + 0.266666666666667*G3_0_2 + 0.133333333333334*G3_1_0 + 0.266666666666667*G3_1_1 + 0.133333333333333*G3_1_2 + 0.266666666666667*G3_2_0 + 0.133333333333333*G3_2_1 + 0.266666666666667*G3 [...]
     A[281] = 0.133333333333334*G0_0_1 + 0.133333333333333*G0_0_2 + 0.133333333333333*G0_1_0 + 0.133333333333333*G0_2_1 + 0.133333333333333*G0_2_2 + 0.133333333333334*G3_0_1 + 0.133333333333333*G3_0_2 + 0.133333333333333*G3_1_0 + 0.133333333333333*G3_2_1 + 0.133333333333333*G3_2_2 + 0.133333333333334*G6_0_1 + 0.133333333333333*G6_0_2 + 0.133333333333333*G6_1_0 + 0.133333333333333*G6_2_1 + 0.133333333333333*G6_2_2;
@@ -23974,10 +27052,10 @@ public:
     A[352] = 0.0333333333333334*G1_0_1 + 0.0333333333333333*G1_1_1 + 0.0333333333333333*G1_2_1 + 0.0333333333333334*G4_0_1 + 0.0333333333333333*G4_1_1 + 0.0333333333333333*G4_2_1 + 0.0333333333333334*G7_0_1 + 0.0333333333333333*G7_1_1 + 0.0333333333333333*G7_2_1;
     A[353] = 0.0333333333333334*G1_0_2 + 0.0333333333333334*G1_1_2 + 0.0333333333333334*G1_2_2 + 0.0333333333333334*G4_0_2 + 0.0333333333333334*G4_1_2 + 0.0333333333333334*G4_2_2 + 0.0333333333333334*G7_0_2 + 0.0333333333333334*G7_1_2 + 0.0333333333333334*G7_2_2;
     A[354] = 0.0333333333333336*G1_0_1 + 0.0333333333333335*G1_0_2 + 0.0333333333333336*G1_1_1 + 0.0333333333333335*G1_1_2 + 0.0333333333333335*G1_2_1 + 0.0333333333333334*G1_2_2 + 0.0333333333333336*G4_0_1 + 0.0333333333333335*G4_0_2 + 0.0333333333333336*G4_1_1 + 0.0333333333333335*G4_1_2 + 0.0333333333333335*G4_2_1 + 0.0333333333333334*G4_2_2 + 0.0333333333333336*G7_0_1 + 0.0333333333333335*G7_0_2 + 0.0333333333333336*G7_1_1 + 0.0333333333333335*G7_1_2 + 0.0333333333333335*G7_2_1 + 0.0 [...]
-    A[355] = 0.0333333333333335*G1_0_0 + 0.0333333333333336*G1_0_2 + 0.0333333333333336*G1_1_0 + 0.0333333333333336*G1_1_2 + 0.0333333333333335*G1_2_0 + 0.0333333333333335*G1_2_2 + 0.0333333333333335*G4_0_0 + 0.0333333333333336*G4_0_2 + 0.0333333333333336*G4_1_0 + 0.0333333333333336*G4_1_2 + 0.0333333333333335*G4_2_0 + 0.0333333333333335*G4_2_2 + 0.0333333333333335*G7_0_0 + 0.0333333333333336*G7_0_2 + 0.0333333333333336*G7_1_0 + 0.0333333333333336*G7_1_2 + 0.0333333333333335*G7_2_0 + 0.0 [...]
-    A[356] = 0.0333333333333336*G1_0_0 + 0.0333333333333335*G1_0_1 + 0.0333333333333336*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333335*G1_2_0 + 0.0333333333333335*G1_2_1 + 0.0333333333333336*G4_0_0 + 0.0333333333333335*G4_0_1 + 0.0333333333333336*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333335*G4_2_0 + 0.0333333333333335*G4_2_1 + 0.0333333333333336*G7_0_0 + 0.0333333333333335*G7_0_1 + 0.0333333333333336*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0333333333333335*G7_2_0 + 0.0 [...]
+    A[355] = 0.0333333333333336*G1_0_0 + 0.0333333333333335*G1_0_2 + 0.0333333333333336*G1_1_0 + 0.0333333333333336*G1_1_2 + 0.0333333333333335*G1_2_0 + 0.0333333333333335*G1_2_2 + 0.0333333333333336*G4_0_0 + 0.0333333333333335*G4_0_2 + 0.0333333333333336*G4_1_0 + 0.0333333333333336*G4_1_2 + 0.0333333333333335*G4_2_0 + 0.0333333333333335*G4_2_2 + 0.0333333333333336*G7_0_0 + 0.0333333333333335*G7_0_2 + 0.0333333333333336*G7_1_0 + 0.0333333333333336*G7_1_2 + 0.0333333333333335*G7_2_0 + 0.0 [...]
+    A[356] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_0_1 + 0.0333333333333335*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333335*G1_2_0 + 0.0333333333333335*G1_2_1 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_0_1 + 0.0333333333333335*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333335*G4_2_0 + 0.0333333333333335*G4_2_1 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_0_1 + 0.0333333333333335*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0333333333333335*G7_2_0 + 0.0 [...]
     A[357] = -0.0333333333333336*G1_0_0 - 0.0333333333333336*G1_0_1 - 0.133333333333333*G1_0_2 - 0.0333333333333336*G1_1_0 - 0.0333333333333336*G1_1_1 - 0.133333333333333*G1_1_2 - 0.0333333333333335*G1_2_0 - 0.0333333333333335*G1_2_1 - 0.133333333333333*G1_2_2 - 0.0333333333333336*G4_0_0 - 0.0333333333333336*G4_0_1 - 0.133333333333333*G4_0_2 - 0.0333333333333336*G4_1_0 - 0.0333333333333336*G4_1_1 - 0.133333333333333*G4_1_2 - 0.0333333333333335*G4_2_0 - 0.0333333333333335*G4_2_1 - 0.13333 [...]
-    A[358] = -0.0333333333333336*G1_0_0 - 0.133333333333333*G1_0_1 - 0.0333333333333335*G1_0_2 - 0.0333333333333336*G1_1_0 - 0.133333333333333*G1_1_1 - 0.0333333333333335*G1_1_2 - 0.0333333333333335*G1_2_0 - 0.133333333333333*G1_2_1 - 0.0333333333333334*G1_2_2 - 0.0333333333333336*G4_0_0 - 0.133333333333333*G4_0_1 - 0.0333333333333335*G4_0_2 - 0.0333333333333336*G4_1_0 - 0.133333333333333*G4_1_1 - 0.0333333333333335*G4_1_2 - 0.0333333333333335*G4_2_0 - 0.133333333333333*G4_2_1 - 0.033333 [...]
+    A[358] = -0.0333333333333336*G1_0_0 - 0.133333333333333*G1_0_1 - 0.0333333333333335*G1_0_2 - 0.0333333333333336*G1_1_0 - 0.133333333333333*G1_1_1 - 0.0333333333333335*G1_1_2 - 0.0333333333333335*G1_2_0 - 0.133333333333333*G1_2_1 - 0.0333333333333335*G1_2_2 - 0.0333333333333336*G4_0_0 - 0.133333333333333*G4_0_1 - 0.0333333333333335*G4_0_2 - 0.0333333333333336*G4_1_0 - 0.133333333333333*G4_1_1 - 0.0333333333333335*G4_1_2 - 0.0333333333333335*G4_2_0 - 0.133333333333333*G4_2_1 - 0.033333 [...]
     A[359] = -0.133333333333333*G1_0_0 - 0.0333333333333335*G1_0_1 - 0.0333333333333335*G1_0_2 - 0.133333333333333*G1_1_0 - 0.0333333333333335*G1_1_1 - 0.0333333333333335*G1_1_2 - 0.133333333333333*G1_2_0 - 0.0333333333333335*G1_2_1 - 0.0333333333333335*G1_2_2 - 0.133333333333333*G4_0_0 - 0.0333333333333335*G4_0_1 - 0.0333333333333335*G4_0_2 - 0.133333333333333*G4_1_0 - 0.0333333333333335*G4_1_1 - 0.0333333333333335*G4_1_2 - 0.133333333333333*G4_2_0 - 0.0333333333333335*G4_2_1 - 0.033333 [...]
     A[360] = 0.0;
     A[361] = 0.0;
@@ -24005,13 +27083,13 @@ public:
     A[383] = 0.0;
     A[384] = 0.0333333333333333*G1_0_0 + 0.0333333333333333*G1_0_1 + 0.0333333333333333*G1_0_2 + 0.0333333333333333*G4_0_0 + 0.0333333333333333*G4_0_1 + 0.0333333333333333*G4_0_2 + 0.0333333333333333*G7_0_0 + 0.0333333333333333*G7_0_1 + 0.0333333333333333*G7_0_2;
     A[385] = 0.1*G1_0_0 + 0.1*G4_0_0 + 0.1*G7_0_0;
-    A[386] = -0.0333333333333334*G1_0_1 - 0.0333333333333334*G4_0_1 - 0.0333333333333334*G7_0_1;
+    A[386] = -0.0333333333333333*G1_0_1 - 0.0333333333333333*G4_0_1 - 0.0333333333333333*G7_0_1;
     A[387] = -0.0333333333333333*G1_0_2 - 0.0333333333333333*G4_0_2 - 0.0333333333333333*G7_0_2;
-    A[388] = -0.0333333333333335*G1_0_1 - 0.0333333333333335*G1_0_2 - 0.0333333333333335*G4_0_1 - 0.0333333333333335*G4_0_2 - 0.0333333333333335*G7_0_1 - 0.0333333333333335*G7_0_2;
+    A[388] = -0.0333333333333335*G1_0_1 - 0.0333333333333334*G1_0_2 - 0.0333333333333335*G4_0_1 - 0.0333333333333334*G4_0_2 - 0.0333333333333335*G7_0_1 - 0.0333333333333334*G7_0_2;
     A[389] = -0.0333333333333335*G1_0_0 + 0.1*G1_0_2 - 0.0333333333333335*G4_0_0 + 0.1*G4_0_2 - 0.0333333333333335*G7_0_0 + 0.1*G7_0_2;
-    A[390] = -0.0333333333333336*G1_0_0 + 0.1*G1_0_1 - 0.0333333333333336*G4_0_0 + 0.1*G4_0_1 - 0.0333333333333336*G7_0_0 + 0.1*G7_0_1;
+    A[390] = -0.0333333333333335*G1_0_0 + 0.1*G1_0_1 - 0.0333333333333335*G4_0_0 + 0.1*G4_0_1 - 0.0333333333333335*G7_0_0 + 0.1*G7_0_1;
     A[391] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_0_1 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_0_1 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_0_1;
-    A[392] = 0.0333333333333336*G1_0_0 + 0.0333333333333335*G1_0_2 + 0.0333333333333336*G4_0_0 + 0.0333333333333335*G4_0_2 + 0.0333333333333336*G7_0_0 + 0.0333333333333335*G7_0_2;
+    A[392] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_0_2 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_0_2 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_0_2;
     A[393] = -0.133333333333333*G1_0_0 - 0.1*G1_0_1 - 0.1*G1_0_2 - 0.133333333333333*G4_0_0 - 0.1*G4_0_1 - 0.1*G4_0_2 - 0.133333333333333*G7_0_0 - 0.1*G7_0_1 - 0.1*G7_0_2;
     A[394] = 0.0;
     A[395] = 0.0;
@@ -24038,12 +27116,12 @@ public:
     A[416] = 0.0;
     A[417] = 0.0;
     A[418] = 0.0333333333333334*G1_1_0 + 0.0333333333333333*G1_1_1 + 0.0333333333333333*G1_1_2 + 0.0333333333333334*G4_1_0 + 0.0333333333333333*G4_1_1 + 0.0333333333333333*G4_1_2 + 0.0333333333333334*G7_1_0 + 0.0333333333333333*G7_1_1 + 0.0333333333333333*G7_1_2;
-    A[419] = -0.0333333333333334*G1_1_0 - 0.0333333333333334*G4_1_0 - 0.0333333333333334*G7_1_0;
+    A[419] = -0.0333333333333333*G1_1_0 - 0.0333333333333333*G4_1_0 - 0.0333333333333333*G7_1_0;
     A[420] = 0.1*G1_1_1 + 0.1*G4_1_1 + 0.1*G7_1_1;
     A[421] = -0.0333333333333333*G1_1_2 - 0.0333333333333333*G4_1_2 - 0.0333333333333333*G7_1_2;
     A[422] = -0.0333333333333337*G1_1_1 + 0.1*G1_1_2 - 0.0333333333333337*G4_1_1 + 0.1*G4_1_2 - 0.0333333333333337*G7_1_1 + 0.1*G7_1_2;
     A[423] = -0.0333333333333337*G1_1_0 - 0.0333333333333338*G1_1_2 - 0.0333333333333337*G4_1_0 - 0.0333333333333338*G4_1_2 - 0.0333333333333337*G7_1_0 - 0.0333333333333338*G7_1_2;
-    A[424] = 0.1*G1_1_0 - 0.0333333333333337*G1_1_1 + 0.1*G4_1_0 - 0.0333333333333337*G4_1_1 + 0.1*G7_1_0 - 0.0333333333333337*G7_1_1;
+    A[424] = 0.1*G1_1_0 - 0.0333333333333336*G1_1_1 + 0.1*G4_1_0 - 0.0333333333333336*G4_1_1 + 0.1*G7_1_0 - 0.0333333333333336*G7_1_1;
     A[425] = 0.0333333333333337*G1_1_0 + 0.0333333333333337*G1_1_1 + 0.0333333333333337*G4_1_0 + 0.0333333333333337*G4_1_1 + 0.0333333333333337*G7_1_0 + 0.0333333333333337*G7_1_1;
     A[426] = -0.1*G1_1_0 - 0.133333333333333*G1_1_1 - 0.1*G1_1_2 - 0.1*G4_1_0 - 0.133333333333333*G4_1_1 - 0.1*G4_1_2 - 0.1*G7_1_0 - 0.133333333333333*G7_1_1 - 0.1*G7_1_2;
     A[427] = 0.0333333333333337*G1_1_1 + 0.0333333333333338*G1_1_2 + 0.0333333333333337*G4_1_1 + 0.0333333333333338*G4_1_2 + 0.0333333333333337*G7_1_1 + 0.0333333333333338*G7_1_2;
@@ -24072,12 +27150,12 @@ public:
     A[450] = 0.0;
     A[451] = 0.0;
     A[452] = 0.0333333333333334*G1_2_0 + 0.0333333333333334*G1_2_1 + 0.0333333333333334*G1_2_2 + 0.0333333333333334*G4_2_0 + 0.0333333333333334*G4_2_1 + 0.0333333333333334*G4_2_2 + 0.0333333333333334*G7_2_0 + 0.0333333333333334*G7_2_1 + 0.0333333333333334*G7_2_2;
-    A[453] = -0.0333333333333333*G1_2_0 - 0.0333333333333333*G4_2_0 - 0.0333333333333333*G7_2_0;
+    A[453] = -0.0333333333333334*G1_2_0 - 0.0333333333333334*G4_2_0 - 0.0333333333333334*G7_2_0;
     A[454] = -0.0333333333333333*G1_2_1 - 0.0333333333333333*G4_2_1 - 0.0333333333333333*G7_2_1;
     A[455] = 0.1*G1_2_2 + 0.1*G4_2_2 + 0.1*G7_2_2;
     A[456] = 0.1*G1_2_1 - 0.0333333333333343*G1_2_2 + 0.1*G4_2_1 - 0.0333333333333343*G4_2_2 + 0.1*G7_2_1 - 0.0333333333333343*G7_2_2;
-    A[457] = 0.1*G1_2_0 - 0.0333333333333339*G1_2_2 + 0.1*G4_2_0 - 0.0333333333333339*G4_2_2 + 0.1*G7_2_0 - 0.0333333333333339*G7_2_2;
-    A[458] = -0.0333333333333341*G1_2_0 - 0.0333333333333342*G1_2_1 - 0.0333333333333341*G4_2_0 - 0.0333333333333342*G4_2_1 - 0.0333333333333341*G7_2_0 - 0.0333333333333342*G7_2_1;
+    A[457] = 0.1*G1_2_0 - 0.033333333333334*G1_2_2 + 0.1*G4_2_0 - 0.033333333333334*G4_2_2 + 0.1*G7_2_0 - 0.033333333333334*G7_2_2;
+    A[458] = -0.033333333333334*G1_2_0 - 0.0333333333333342*G1_2_1 - 0.033333333333334*G4_2_0 - 0.0333333333333342*G4_2_1 - 0.033333333333334*G7_2_0 - 0.0333333333333342*G7_2_1;
     A[459] = -0.1*G1_2_0 - 0.1*G1_2_1 - 0.133333333333333*G1_2_2 - 0.1*G4_2_0 - 0.1*G4_2_1 - 0.133333333333333*G4_2_2 - 0.1*G7_2_0 - 0.1*G7_2_1 - 0.133333333333333*G7_2_2;
     A[460] = 0.0333333333333341*G1_2_0 + 0.0333333333333341*G1_2_2 + 0.0333333333333341*G4_2_0 + 0.0333333333333341*G4_2_2 + 0.0333333333333341*G7_2_0 + 0.0333333333333341*G7_2_2;
     A[461] = 0.033333333333334*G1_2_1 + 0.033333333333334*G1_2_2 + 0.033333333333334*G4_2_1 + 0.033333333333334*G4_2_2 + 0.033333333333334*G7_2_1 + 0.033333333333334*G7_2_2;
@@ -24105,8 +27183,8 @@ public:
     A[483] = 0.0;
     A[484] = 0.0;
     A[485] = 0.0;
-    A[486] = 0.0333333333333335*G1_1_0 + 0.0333333333333336*G1_1_1 + 0.0333333333333335*G1_1_2 + 0.0333333333333335*G1_2_0 + 0.0333333333333335*G1_2_1 + 0.0333333333333334*G1_2_2 + 0.0333333333333335*G4_1_0 + 0.0333333333333336*G4_1_1 + 0.0333333333333335*G4_1_2 + 0.0333333333333335*G4_2_0 + 0.0333333333333335*G4_2_1 + 0.0333333333333334*G4_2_2 + 0.0333333333333335*G7_1_0 + 0.0333333333333336*G7_1_1 + 0.0333333333333335*G7_1_2 + 0.0333333333333335*G7_2_0 + 0.0333333333333335*G7_2_1 + 0.0 [...]
-    A[487] = -0.0333333333333335*G1_1_0 - 0.0333333333333335*G1_2_0 - 0.0333333333333335*G4_1_0 - 0.0333333333333335*G4_2_0 - 0.0333333333333335*G7_1_0 - 0.0333333333333335*G7_2_0;
+    A[486] = 0.0333333333333336*G1_1_0 + 0.0333333333333336*G1_1_1 + 0.0333333333333335*G1_1_2 + 0.0333333333333335*G1_2_0 + 0.0333333333333335*G1_2_1 + 0.0333333333333334*G1_2_2 + 0.0333333333333336*G4_1_0 + 0.0333333333333336*G4_1_1 + 0.0333333333333335*G4_1_2 + 0.0333333333333335*G4_2_0 + 0.0333333333333335*G4_2_1 + 0.0333333333333334*G4_2_2 + 0.0333333333333336*G7_1_0 + 0.0333333333333336*G7_1_1 + 0.0333333333333335*G7_1_2 + 0.0333333333333335*G7_2_0 + 0.0333333333333335*G7_2_1 + 0.0 [...]
+    A[487] = -0.0333333333333335*G1_1_0 - 0.0333333333333334*G1_2_0 - 0.0333333333333335*G4_1_0 - 0.0333333333333334*G4_2_0 - 0.0333333333333335*G7_1_0 - 0.0333333333333334*G7_2_0;
     A[488] = -0.0333333333333337*G1_1_1 + 0.1*G1_2_1 - 0.0333333333333337*G4_1_1 + 0.1*G4_2_1 - 0.0333333333333337*G7_1_1 + 0.1*G7_2_1;
     A[489] = 0.1*G1_1_2 - 0.0333333333333343*G1_2_2 + 0.1*G4_1_2 - 0.0333333333333343*G4_2_2 + 0.1*G7_1_2 - 0.0333333333333343*G7_2_2;
     A[490] = 0.266666666666667*G1_1_1 + 0.133333333333333*G1_1_2 + 0.133333333333333*G1_2_1 + 0.266666666666667*G1_2_2 + 0.266666666666667*G4_1_1 + 0.133333333333333*G4_1_2 + 0.133333333333333*G4_2_1 + 0.266666666666667*G4_2_2 + 0.266666666666667*G7_1_1 + 0.133333333333333*G7_1_2 + 0.133333333333333*G7_2_1 + 0.266666666666667*G7_2_2;
@@ -24139,14 +27217,14 @@ public:
     A[517] = 0.0;
     A[518] = 0.0;
     A[519] = 0.0;
-    A[520] = 0.0333333333333335*G1_0_0 + 0.0333333333333336*G1_0_1 + 0.0333333333333335*G1_0_2 + 0.0333333333333336*G1_2_0 + 0.0333333333333336*G1_2_1 + 0.0333333333333335*G1_2_2 + 0.0333333333333335*G4_0_0 + 0.0333333333333336*G4_0_1 + 0.0333333333333335*G4_0_2 + 0.0333333333333336*G4_2_0 + 0.0333333333333336*G4_2_1 + 0.0333333333333335*G4_2_2 + 0.0333333333333335*G7_0_0 + 0.0333333333333336*G7_0_1 + 0.0333333333333335*G7_0_2 + 0.0333333333333336*G7_2_0 + 0.0333333333333336*G7_2_1 + 0.0 [...]
+    A[520] = 0.0333333333333336*G1_0_0 + 0.0333333333333336*G1_0_1 + 0.0333333333333335*G1_0_2 + 0.0333333333333335*G1_2_0 + 0.0333333333333336*G1_2_1 + 0.0333333333333335*G1_2_2 + 0.0333333333333336*G4_0_0 + 0.0333333333333336*G4_0_1 + 0.0333333333333335*G4_0_2 + 0.0333333333333335*G4_2_0 + 0.0333333333333336*G4_2_1 + 0.0333333333333335*G4_2_2 + 0.0333333333333336*G7_0_0 + 0.0333333333333336*G7_0_1 + 0.0333333333333335*G7_0_2 + 0.0333333333333335*G7_2_0 + 0.0333333333333336*G7_2_1 + 0.0 [...]
     A[521] = -0.0333333333333335*G1_0_0 + 0.1*G1_2_0 - 0.0333333333333335*G4_0_0 + 0.1*G4_2_0 - 0.0333333333333335*G7_0_0 + 0.1*G7_2_0;
     A[522] = -0.0333333333333337*G1_0_1 - 0.0333333333333338*G1_2_1 - 0.0333333333333337*G4_0_1 - 0.0333333333333338*G4_2_1 - 0.0333333333333337*G7_0_1 - 0.0333333333333338*G7_2_1;
-    A[523] = 0.1*G1_0_2 - 0.0333333333333339*G1_2_2 + 0.1*G4_0_2 - 0.0333333333333339*G4_2_2 + 0.1*G7_0_2 - 0.0333333333333339*G7_2_2;
+    A[523] = 0.1*G1_0_2 - 0.033333333333334*G1_2_2 + 0.1*G4_0_2 - 0.033333333333334*G4_2_2 + 0.1*G7_0_2 - 0.033333333333334*G7_2_2;
     A[524] = 0.266666666666667*G1_0_1 + 0.133333333333333*G1_0_2 + 0.133333333333335*G1_2_1 + 0.133333333333335*G1_2_2 + 0.266666666666667*G4_0_1 + 0.133333333333333*G4_0_2 + 0.133333333333335*G4_2_1 + 0.133333333333335*G4_2_2 + 0.266666666666667*G7_0_1 + 0.133333333333333*G7_0_2 + 0.133333333333335*G7_2_1 + 0.133333333333335*G7_2_2;
     A[525] = 0.266666666666667*G1_0_0 + 0.133333333333334*G1_0_2 + 0.133333333333334*G1_2_0 + 0.266666666666669*G1_2_2 + 0.266666666666667*G4_0_0 + 0.133333333333334*G4_0_2 + 0.133333333333334*G4_2_0 + 0.266666666666669*G4_2_2 + 0.266666666666667*G7_0_0 + 0.133333333333334*G7_0_2 + 0.133333333333334*G7_2_0 + 0.266666666666669*G7_2_2;
     A[526] = 0.133333333333333*G1_0_0 + 0.133333333333334*G1_0_1 + 0.133333333333334*G1_2_0 + 0.266666666666669*G1_2_1 + 0.133333333333333*G4_0_0 + 0.133333333333334*G4_0_1 + 0.133333333333334*G4_2_0 + 0.266666666666669*G4_2_1 + 0.133333333333333*G7_0_0 + 0.133333333333334*G7_0_1 + 0.133333333333334*G7_2_0 + 0.266666666666669*G7_2_1;
-    A[527] = -0.266666666666667*G1_0_0 - 0.266666666666667*G1_0_1 - 0.133333333333334*G1_0_2 - 0.133333333333335*G1_2_0 - 0.133333333333335*G1_2_1 - 0.266666666666667*G4_0_0 - 0.266666666666667*G4_0_1 - 0.133333333333334*G4_0_2 - 0.133333333333335*G4_2_0 - 0.133333333333335*G4_2_1 - 0.266666666666667*G7_0_0 - 0.266666666666667*G7_0_1 - 0.133333333333334*G7_0_2 - 0.133333333333335*G7_2_0 - 0.133333333333335*G7_2_1;
+    A[527] = -0.266666666666667*G1_0_0 - 0.266666666666667*G1_0_1 - 0.133333333333333*G1_0_2 - 0.133333333333335*G1_2_0 - 0.133333333333335*G1_2_1 - 0.266666666666667*G4_0_0 - 0.266666666666667*G4_0_1 - 0.133333333333333*G4_0_2 - 0.133333333333335*G4_2_0 - 0.133333333333335*G4_2_1 - 0.266666666666667*G7_0_0 - 0.266666666666667*G7_0_1 - 0.133333333333333*G7_0_2 - 0.133333333333335*G7_2_0 - 0.133333333333335*G7_2_1;
     A[528] = -0.133333333333333*G1_0_0 - 0.133333333333333*G1_0_2 - 0.133333333333334*G1_2_0 - 0.133333333333334*G1_2_2 - 0.133333333333333*G4_0_0 - 0.133333333333333*G4_0_2 - 0.133333333333334*G4_2_0 - 0.133333333333334*G4_2_2 - 0.133333333333333*G7_0_0 - 0.133333333333333*G7_0_2 - 0.133333333333334*G7_2_0 - 0.133333333333334*G7_2_2;
     A[529] = -0.133333333333333*G1_0_1 - 0.133333333333333*G1_0_2 - 0.133333333333333*G1_2_0 - 0.266666666666668*G1_2_1 - 0.266666666666668*G1_2_2 - 0.133333333333333*G4_0_1 - 0.133333333333333*G4_0_2 - 0.133333333333333*G4_2_0 - 0.266666666666668*G4_2_1 - 0.266666666666668*G4_2_2 - 0.133333333333333*G7_0_1 - 0.133333333333333*G7_0_2 - 0.133333333333333*G7_2_0 - 0.266666666666668*G7_2_1 - 0.266666666666668*G7_2_2;
     A[530] = 0.0;
@@ -24173,15 +27251,15 @@ public:
     A[551] = 0.0;
     A[552] = 0.0;
     A[553] = 0.0;
-    A[554] = 0.0333333333333336*G1_0_0 + 0.0333333333333336*G1_0_1 + 0.0333333333333335*G1_0_2 + 0.0333333333333335*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333335*G1_1_2 + 0.0333333333333336*G4_0_0 + 0.0333333333333336*G4_0_1 + 0.0333333333333335*G4_0_2 + 0.0333333333333335*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333335*G4_1_2 + 0.0333333333333336*G7_0_0 + 0.0333333333333336*G7_0_1 + 0.0333333333333335*G7_0_2 + 0.0333333333333335*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0 [...]
-    A[555] = -0.0333333333333336*G1_0_0 + 0.1*G1_1_0 - 0.0333333333333336*G4_0_0 + 0.1*G4_1_0 - 0.0333333333333336*G7_0_0 + 0.1*G7_1_0;
+    A[554] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_0_1 + 0.0333333333333335*G1_0_2 + 0.0333333333333335*G1_1_0 + 0.0333333333333335*G1_1_1 + 0.0333333333333335*G1_1_2 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_0_1 + 0.0333333333333335*G4_0_2 + 0.0333333333333335*G4_1_0 + 0.0333333333333335*G4_1_1 + 0.0333333333333335*G4_1_2 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_0_1 + 0.0333333333333335*G7_0_2 + 0.0333333333333335*G7_1_0 + 0.0333333333333335*G7_1_1 + 0.0 [...]
+    A[555] = -0.0333333333333335*G1_0_0 + 0.1*G1_1_0 - 0.0333333333333335*G4_0_0 + 0.1*G4_1_0 - 0.0333333333333335*G7_0_0 + 0.1*G7_1_0;
     A[556] = 0.1*G1_0_1 - 0.0333333333333336*G1_1_1 + 0.1*G4_0_1 - 0.0333333333333336*G4_1_1 + 0.1*G7_0_1 - 0.0333333333333336*G7_1_1;
-    A[557] = -0.0333333333333341*G1_0_2 - 0.0333333333333342*G1_1_2 - 0.0333333333333341*G4_0_2 - 0.0333333333333342*G4_1_2 - 0.0333333333333341*G7_0_2 - 0.0333333333333342*G7_1_2;
+    A[557] = -0.033333333333334*G1_0_2 - 0.0333333333333342*G1_1_2 - 0.033333333333334*G4_0_2 - 0.0333333333333342*G4_1_2 - 0.033333333333334*G7_0_2 - 0.0333333333333342*G7_1_2;
     A[558] = 0.133333333333334*G1_0_1 + 0.266666666666667*G1_0_2 + 0.133333333333334*G1_1_1 + 0.133333333333335*G1_1_2 + 0.133333333333334*G4_0_1 + 0.266666666666667*G4_0_2 + 0.133333333333334*G4_1_1 + 0.133333333333335*G4_1_2 + 0.133333333333334*G7_0_1 + 0.266666666666667*G7_0_2 + 0.133333333333334*G7_1_1 + 0.133333333333335*G7_1_2;
     A[559] = 0.133333333333333*G1_0_0 + 0.133333333333334*G1_0_2 + 0.133333333333334*G1_1_0 + 0.266666666666669*G1_1_2 + 0.133333333333333*G4_0_0 + 0.133333333333334*G4_0_2 + 0.133333333333334*G4_1_0 + 0.266666666666669*G4_1_2 + 0.133333333333333*G7_0_0 + 0.133333333333334*G7_0_2 + 0.133333333333334*G7_1_0 + 0.266666666666669*G7_1_2;
     A[560] = 0.266666666666667*G1_0_0 + 0.133333333333334*G1_0_1 + 0.133333333333334*G1_1_0 + 0.266666666666669*G1_1_1 + 0.266666666666667*G4_0_0 + 0.133333333333334*G4_0_1 + 0.133333333333334*G4_1_0 + 0.266666666666669*G4_1_1 + 0.266666666666667*G7_0_0 + 0.133333333333334*G7_0_1 + 0.133333333333334*G7_1_0 + 0.266666666666669*G7_1_1;
-    A[561] = -0.133333333333333*G1_0_0 - 0.133333333333334*G1_0_1 - 0.133333333333334*G1_1_0 - 0.133333333333334*G1_1_1 - 0.133333333333333*G4_0_0 - 0.133333333333334*G4_0_1 - 0.133333333333334*G4_1_0 - 0.133333333333334*G4_1_1 - 0.133333333333333*G7_0_0 - 0.133333333333334*G7_0_1 - 0.133333333333334*G7_1_0 - 0.133333333333334*G7_1_1;
-    A[562] = -0.266666666666667*G1_0_0 - 0.133333333333334*G1_0_1 - 0.266666666666667*G1_0_2 - 0.133333333333334*G1_1_0 - 0.133333333333334*G1_1_2 - 0.266666666666667*G4_0_0 - 0.133333333333334*G4_0_1 - 0.266666666666667*G4_0_2 - 0.133333333333334*G4_1_0 - 0.133333333333334*G4_1_2 - 0.266666666666667*G7_0_0 - 0.133333333333334*G7_0_1 - 0.266666666666667*G7_0_2 - 0.133333333333334*G7_1_0 - 0.133333333333334*G7_1_2;
+    A[561] = -0.133333333333333*G1_0_0 - 0.133333333333333*G1_0_1 - 0.133333333333334*G1_1_0 - 0.133333333333334*G1_1_1 - 0.133333333333333*G4_0_0 - 0.133333333333333*G4_0_1 - 0.133333333333334*G4_1_0 - 0.133333333333334*G4_1_1 - 0.133333333333333*G7_0_0 - 0.133333333333333*G7_0_1 - 0.133333333333334*G7_1_0 - 0.133333333333334*G7_1_1;
+    A[562] = -0.266666666666667*G1_0_0 - 0.133333333333333*G1_0_1 - 0.266666666666667*G1_0_2 - 0.133333333333334*G1_1_0 - 0.133333333333334*G1_1_2 - 0.266666666666667*G4_0_0 - 0.133333333333333*G4_0_1 - 0.266666666666667*G4_0_2 - 0.133333333333334*G4_1_0 - 0.133333333333334*G4_1_2 - 0.266666666666667*G7_0_0 - 0.133333333333333*G7_0_1 - 0.266666666666667*G7_0_2 - 0.133333333333334*G7_1_0 - 0.133333333333334*G7_1_2;
     A[563] = -0.133333333333334*G1_0_1 - 0.133333333333333*G1_0_2 - 0.133333333333333*G1_1_0 - 0.266666666666668*G1_1_1 - 0.266666666666668*G1_1_2 - 0.133333333333334*G4_0_1 - 0.133333333333333*G4_0_2 - 0.133333333333333*G4_1_0 - 0.266666666666668*G4_1_1 - 0.266666666666668*G4_1_2 - 0.133333333333334*G7_0_1 - 0.133333333333333*G7_0_2 - 0.133333333333333*G7_1_0 - 0.266666666666668*G7_1_1 - 0.266666666666668*G7_1_2;
     A[564] = 0.0;
     A[565] = 0.0;
@@ -24213,7 +27291,7 @@ public:
     A[591] = -0.1*G1_0_2 - 0.1*G1_1_2 - 0.133333333333333*G1_2_2 - 0.1*G4_0_2 - 0.1*G4_1_2 - 0.133333333333333*G4_2_2 - 0.1*G7_0_2 - 0.1*G7_1_2 - 0.133333333333333*G7_2_2;
     A[592] = -0.266666666666667*G1_0_1 - 0.133333333333333*G1_0_2 - 0.266666666666667*G1_1_1 - 0.133333333333333*G1_1_2 - 0.133333333333333*G1_2_1 - 0.266666666666667*G4_0_1 - 0.133333333333333*G4_0_2 - 0.266666666666667*G4_1_1 - 0.133333333333333*G4_1_2 - 0.133333333333333*G4_2_1 - 0.266666666666667*G7_0_1 - 0.133333333333333*G7_0_2 - 0.266666666666667*G7_1_1 - 0.133333333333333*G7_1_2 - 0.133333333333333*G7_2_1;
     A[593] = -0.266666666666667*G1_0_0 - 0.133333333333335*G1_0_2 - 0.266666666666667*G1_1_0 - 0.133333333333335*G1_1_2 - 0.133333333333334*G1_2_0 - 0.266666666666667*G4_0_0 - 0.133333333333335*G4_0_2 - 0.266666666666667*G4_1_0 - 0.133333333333335*G4_1_2 - 0.133333333333334*G4_2_0 - 0.266666666666667*G7_0_0 - 0.133333333333335*G7_0_2 - 0.266666666666667*G7_1_0 - 0.133333333333335*G7_1_2 - 0.133333333333334*G7_2_0;
-    A[594] = -0.133333333333333*G1_0_0 - 0.133333333333334*G1_0_1 - 0.133333333333334*G1_1_0 - 0.133333333333334*G1_1_1 - 0.133333333333333*G4_0_0 - 0.133333333333334*G4_0_1 - 0.133333333333334*G4_1_0 - 0.133333333333334*G4_1_1 - 0.133333333333333*G7_0_0 - 0.133333333333334*G7_0_1 - 0.133333333333334*G7_1_0 - 0.133333333333334*G7_1_1;
+    A[594] = -0.133333333333333*G1_0_0 - 0.133333333333334*G1_0_1 - 0.133333333333333*G1_1_0 - 0.133333333333334*G1_1_1 - 0.133333333333333*G4_0_0 - 0.133333333333334*G4_0_1 - 0.133333333333333*G4_1_0 - 0.133333333333334*G4_1_1 - 0.133333333333333*G7_0_0 - 0.133333333333334*G7_0_1 - 0.133333333333333*G7_1_0 - 0.133333333333334*G7_1_1;
     A[595] = 0.266666666666667*G1_0_0 + 0.266666666666667*G1_0_1 + 0.133333333333334*G1_0_2 + 0.266666666666667*G1_1_0 + 0.266666666666667*G1_1_1 + 0.133333333333334*G1_1_2 + 0.133333333333334*G1_2_0 + 0.133333333333334*G1_2_1 + 0.266666666666667*G1_2_2 + 0.266666666666667*G4_0_0 + 0.266666666666667*G4_0_1 + 0.133333333333334*G4_0_2 + 0.266666666666667*G4_1_0 + 0.266666666666667*G4_1_1 + 0.133333333333334*G4_1_2 + 0.133333333333334*G4_2_0 + 0.133333333333334*G4_2_1 + 0.266666666666667*G4 [...]
     A[596] = 0.133333333333333*G1_0_0 + 0.133333333333333*G1_0_2 + 0.133333333333334*G1_1_0 + 0.133333333333333*G1_1_2 + 0.133333333333333*G1_2_1 + 0.133333333333333*G4_0_0 + 0.133333333333333*G4_0_2 + 0.133333333333334*G4_1_0 + 0.133333333333333*G4_1_2 + 0.133333333333333*G4_2_1 + 0.133333333333333*G7_0_0 + 0.133333333333333*G7_0_2 + 0.133333333333334*G7_1_0 + 0.133333333333333*G7_1_2 + 0.133333333333333*G7_2_1;
     A[597] = 0.133333333333333*G1_0_1 + 0.133333333333333*G1_0_2 + 0.133333333333334*G1_1_1 + 0.133333333333334*G1_1_2 + 0.133333333333333*G1_2_0 + 0.133333333333333*G4_0_1 + 0.133333333333333*G4_0_2 + 0.133333333333334*G4_1_1 + 0.133333333333334*G4_1_2 + 0.133333333333333*G4_2_0 + 0.133333333333333*G7_0_1 + 0.133333333333333*G7_0_2 + 0.133333333333334*G7_1_1 + 0.133333333333334*G7_1_2 + 0.133333333333333*G7_2_0;
@@ -24241,13 +27319,13 @@ public:
     A[619] = 0.0;
     A[620] = 0.0;
     A[621] = 0.0;
-    A[622] = -0.0333333333333336*G1_0_0 - 0.0333333333333336*G1_0_1 - 0.0333333333333335*G1_0_2 - 0.133333333333333*G1_1_0 - 0.133333333333333*G1_1_1 - 0.133333333333333*G1_1_2 - 0.0333333333333335*G1_2_0 - 0.0333333333333335*G1_2_1 - 0.0333333333333334*G1_2_2 - 0.0333333333333336*G4_0_0 - 0.0333333333333336*G4_0_1 - 0.0333333333333335*G4_0_2 - 0.133333333333333*G4_1_0 - 0.133333333333333*G4_1_1 - 0.133333333333333*G4_1_2 - 0.0333333333333335*G4_2_0 - 0.0333333333333335*G4_2_1 - 0.033333 [...]
-    A[623] = 0.0333333333333336*G1_0_0 + 0.0333333333333335*G1_2_0 + 0.0333333333333336*G4_0_0 + 0.0333333333333335*G4_2_0 + 0.0333333333333336*G7_0_0 + 0.0333333333333335*G7_2_0;
+    A[622] = -0.0333333333333336*G1_0_0 - 0.0333333333333335*G1_0_1 - 0.0333333333333335*G1_0_2 - 0.133333333333333*G1_1_0 - 0.133333333333333*G1_1_1 - 0.133333333333333*G1_1_2 - 0.0333333333333335*G1_2_0 - 0.0333333333333335*G1_2_1 - 0.0333333333333335*G1_2_2 - 0.0333333333333336*G4_0_0 - 0.0333333333333335*G4_0_1 - 0.0333333333333335*G4_0_2 - 0.133333333333333*G4_1_0 - 0.133333333333333*G4_1_1 - 0.133333333333333*G4_1_2 - 0.0333333333333335*G4_2_0 - 0.0333333333333335*G4_2_1 - 0.033333 [...]
+    A[623] = 0.0333333333333335*G1_0_0 + 0.0333333333333335*G1_2_0 + 0.0333333333333335*G4_0_0 + 0.0333333333333335*G4_2_0 + 0.0333333333333335*G7_0_0 + 0.0333333333333335*G7_2_0;
     A[624] = -0.1*G1_0_1 - 0.133333333333333*G1_1_1 - 0.1*G1_2_1 - 0.1*G4_0_1 - 0.133333333333333*G4_1_1 - 0.1*G4_2_1 - 0.1*G7_0_1 - 0.133333333333333*G7_1_1 - 0.1*G7_2_1;
     A[625] = 0.0333333333333341*G1_0_2 + 0.0333333333333341*G1_2_2 + 0.0333333333333341*G4_0_2 + 0.0333333333333341*G4_2_2 + 0.0333333333333341*G7_0_2 + 0.0333333333333341*G7_2_2;
     A[626] = -0.133333333333334*G1_0_1 - 0.266666666666667*G1_0_2 - 0.133333333333334*G1_1_2 - 0.133333333333333*G1_2_1 - 0.266666666666667*G1_2_2 - 0.133333333333334*G4_0_1 - 0.266666666666667*G4_0_2 - 0.133333333333334*G4_1_2 - 0.133333333333333*G4_2_1 - 0.266666666666667*G4_2_2 - 0.133333333333334*G7_0_1 - 0.266666666666667*G7_0_2 - 0.133333333333334*G7_1_2 - 0.133333333333333*G7_2_1 - 0.266666666666667*G7_2_2;
     A[627] = -0.133333333333333*G1_0_0 - 0.133333333333334*G1_0_2 - 0.133333333333333*G1_2_0 - 0.133333333333334*G1_2_2 - 0.133333333333333*G4_0_0 - 0.133333333333334*G4_0_2 - 0.133333333333333*G4_2_0 - 0.133333333333334*G4_2_2 - 0.133333333333333*G7_0_0 - 0.133333333333334*G7_0_2 - 0.133333333333333*G7_2_0 - 0.133333333333334*G7_2_2;
-    A[628] = -0.266666666666667*G1_0_0 - 0.133333333333334*G1_0_1 - 0.133333333333334*G1_1_0 - 0.266666666666667*G1_2_0 - 0.133333333333334*G1_2_1 - 0.266666666666667*G4_0_0 - 0.133333333333334*G4_0_1 - 0.133333333333334*G4_1_0 - 0.266666666666667*G4_2_0 - 0.133333333333334*G4_2_1 - 0.266666666666667*G7_0_0 - 0.133333333333334*G7_0_1 - 0.133333333333334*G7_1_0 - 0.266666666666667*G7_2_0 - 0.133333333333334*G7_2_1;
+    A[628] = -0.266666666666667*G1_0_0 - 0.133333333333334*G1_0_1 - 0.133333333333333*G1_1_0 - 0.266666666666667*G1_2_0 - 0.133333333333334*G1_2_1 - 0.266666666666667*G4_0_0 - 0.133333333333334*G4_0_1 - 0.133333333333333*G4_1_0 - 0.266666666666667*G4_2_0 - 0.133333333333334*G4_2_1 - 0.266666666666667*G7_0_0 - 0.133333333333334*G7_0_1 - 0.133333333333333*G7_1_0 - 0.266666666666667*G7_2_0 - 0.133333333333334*G7_2_1;
     A[629] = 0.133333333333333*G1_0_0 + 0.133333333333334*G1_0_1 + 0.133333333333333*G1_1_2 + 0.133333333333333*G1_2_0 + 0.133333333333333*G1_2_1 + 0.133333333333333*G4_0_0 + 0.133333333333334*G4_0_1 + 0.133333333333333*G4_1_2 + 0.133333333333333*G4_2_0 + 0.133333333333333*G4_2_1 + 0.133333333333333*G7_0_0 + 0.133333333333334*G7_0_1 + 0.133333333333333*G7_1_2 + 0.133333333333333*G7_2_0 + 0.133333333333333*G7_2_1;
     A[630] = 0.266666666666667*G1_0_0 + 0.133333333333334*G1_0_1 + 0.266666666666667*G1_0_2 + 0.133333333333334*G1_1_0 + 0.266666666666667*G1_1_1 + 0.133333333333333*G1_1_2 + 0.266666666666667*G1_2_0 + 0.133333333333333*G1_2_1 + 0.266666666666667*G1_2_2 + 0.266666666666667*G4_0_0 + 0.133333333333334*G4_0_1 + 0.266666666666667*G4_0_2 + 0.133333333333334*G4_1_0 + 0.266666666666667*G4_1_1 + 0.133333333333333*G4_1_2 + 0.266666666666667*G4_2_0 + 0.133333333333333*G4_2_1 + 0.266666666666667*G4 [...]
     A[631] = 0.133333333333334*G1_0_1 + 0.133333333333333*G1_0_2 + 0.133333333333333*G1_1_0 + 0.133333333333333*G1_2_1 + 0.133333333333333*G1_2_2 + 0.133333333333334*G4_0_1 + 0.133333333333333*G4_0_2 + 0.133333333333333*G4_1_0 + 0.133333333333333*G4_2_1 + 0.133333333333333*G4_2_2 + 0.133333333333334*G7_0_1 + 0.133333333333333*G7_0_2 + 0.133333333333333*G7_1_0 + 0.133333333333333*G7_2_1 + 0.133333333333333*G7_2_2;
@@ -24324,10 +27402,10 @@ public:
     A[702] = 0.0333333333333334*G2_0_1 + 0.0333333333333333*G2_1_1 + 0.0333333333333333*G2_2_1 + 0.0333333333333334*G5_0_1 + 0.0333333333333333*G5_1_1 + 0.0333333333333333*G5_2_1 + 0.0333333333333334*G8_0_1 + 0.0333333333333333*G8_1_1 + 0.0333333333333333*G8_2_1;
     A[703] = 0.0333333333333334*G2_0_2 + 0.0333333333333334*G2_1_2 + 0.0333333333333334*G2_2_2 + 0.0333333333333334*G5_0_2 + 0.0333333333333334*G5_1_2 + 0.0333333333333334*G5_2_2 + 0.0333333333333334*G8_0_2 + 0.0333333333333334*G8_1_2 + 0.0333333333333334*G8_2_2;
     A[704] = 0.0333333333333336*G2_0_1 + 0.0333333333333335*G2_0_2 + 0.0333333333333336*G2_1_1 + 0.0333333333333335*G2_1_2 + 0.0333333333333335*G2_2_1 + 0.0333333333333334*G2_2_2 + 0.0333333333333336*G5_0_1 + 0.0333333333333335*G5_0_2 + 0.0333333333333336*G5_1_1 + 0.0333333333333335*G5_1_2 + 0.0333333333333335*G5_2_1 + 0.0333333333333334*G5_2_2 + 0.0333333333333336*G8_0_1 + 0.0333333333333335*G8_0_2 + 0.0333333333333336*G8_1_1 + 0.0333333333333335*G8_1_2 + 0.0333333333333335*G8_2_1 + 0.0 [...]
-    A[705] = 0.0333333333333335*G2_0_0 + 0.0333333333333336*G2_0_2 + 0.0333333333333336*G2_1_0 + 0.0333333333333336*G2_1_2 + 0.0333333333333335*G2_2_0 + 0.0333333333333335*G2_2_2 + 0.0333333333333335*G5_0_0 + 0.0333333333333336*G5_0_2 + 0.0333333333333336*G5_1_0 + 0.0333333333333336*G5_1_2 + 0.0333333333333335*G5_2_0 + 0.0333333333333335*G5_2_2 + 0.0333333333333335*G8_0_0 + 0.0333333333333336*G8_0_2 + 0.0333333333333336*G8_1_0 + 0.0333333333333336*G8_1_2 + 0.0333333333333335*G8_2_0 + 0.0 [...]
-    A[706] = 0.0333333333333336*G2_0_0 + 0.0333333333333335*G2_0_1 + 0.0333333333333336*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333335*G2_2_0 + 0.0333333333333335*G2_2_1 + 0.0333333333333336*G5_0_0 + 0.0333333333333335*G5_0_1 + 0.0333333333333336*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333335*G5_2_0 + 0.0333333333333335*G5_2_1 + 0.0333333333333336*G8_0_0 + 0.0333333333333335*G8_0_1 + 0.0333333333333336*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0333333333333335*G8_2_0 + 0.0 [...]
+    A[705] = 0.0333333333333336*G2_0_0 + 0.0333333333333335*G2_0_2 + 0.0333333333333336*G2_1_0 + 0.0333333333333336*G2_1_2 + 0.0333333333333335*G2_2_0 + 0.0333333333333335*G2_2_2 + 0.0333333333333336*G5_0_0 + 0.0333333333333335*G5_0_2 + 0.0333333333333336*G5_1_0 + 0.0333333333333336*G5_1_2 + 0.0333333333333335*G5_2_0 + 0.0333333333333335*G5_2_2 + 0.0333333333333336*G8_0_0 + 0.0333333333333335*G8_0_2 + 0.0333333333333336*G8_1_0 + 0.0333333333333336*G8_1_2 + 0.0333333333333335*G8_2_0 + 0.0 [...]
+    A[706] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_0_1 + 0.0333333333333335*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333335*G2_2_0 + 0.0333333333333335*G2_2_1 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_0_1 + 0.0333333333333335*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333335*G5_2_0 + 0.0333333333333335*G5_2_1 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_0_1 + 0.0333333333333335*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0333333333333335*G8_2_0 + 0.0 [...]
     A[707] = -0.0333333333333336*G2_0_0 - 0.0333333333333336*G2_0_1 - 0.133333333333333*G2_0_2 - 0.0333333333333336*G2_1_0 - 0.0333333333333336*G2_1_1 - 0.133333333333333*G2_1_2 - 0.0333333333333335*G2_2_0 - 0.0333333333333335*G2_2_1 - 0.133333333333333*G2_2_2 - 0.0333333333333336*G5_0_0 - 0.0333333333333336*G5_0_1 - 0.133333333333333*G5_0_2 - 0.0333333333333336*G5_1_0 - 0.0333333333333336*G5_1_1 - 0.133333333333333*G5_1_2 - 0.0333333333333335*G5_2_0 - 0.0333333333333335*G5_2_1 - 0.13333 [...]
-    A[708] = -0.0333333333333336*G2_0_0 - 0.133333333333333*G2_0_1 - 0.0333333333333335*G2_0_2 - 0.0333333333333336*G2_1_0 - 0.133333333333333*G2_1_1 - 0.0333333333333335*G2_1_2 - 0.0333333333333335*G2_2_0 - 0.133333333333333*G2_2_1 - 0.0333333333333334*G2_2_2 - 0.0333333333333336*G5_0_0 - 0.133333333333333*G5_0_1 - 0.0333333333333335*G5_0_2 - 0.0333333333333336*G5_1_0 - 0.133333333333333*G5_1_1 - 0.0333333333333335*G5_1_2 - 0.0333333333333335*G5_2_0 - 0.133333333333333*G5_2_1 - 0.033333 [...]
+    A[708] = -0.0333333333333336*G2_0_0 - 0.133333333333333*G2_0_1 - 0.0333333333333335*G2_0_2 - 0.0333333333333336*G2_1_0 - 0.133333333333333*G2_1_1 - 0.0333333333333335*G2_1_2 - 0.0333333333333335*G2_2_0 - 0.133333333333333*G2_2_1 - 0.0333333333333335*G2_2_2 - 0.0333333333333336*G5_0_0 - 0.133333333333333*G5_0_1 - 0.0333333333333335*G5_0_2 - 0.0333333333333336*G5_1_0 - 0.133333333333333*G5_1_1 - 0.0333333333333335*G5_1_2 - 0.0333333333333335*G5_2_0 - 0.133333333333333*G5_2_1 - 0.033333 [...]
     A[709] = -0.133333333333333*G2_0_0 - 0.0333333333333335*G2_0_1 - 0.0333333333333335*G2_0_2 - 0.133333333333333*G2_1_0 - 0.0333333333333335*G2_1_1 - 0.0333333333333335*G2_1_2 - 0.133333333333333*G2_2_0 - 0.0333333333333335*G2_2_1 - 0.0333333333333335*G2_2_2 - 0.133333333333333*G5_0_0 - 0.0333333333333335*G5_0_1 - 0.0333333333333335*G5_0_2 - 0.133333333333333*G5_1_0 - 0.0333333333333335*G5_1_1 - 0.0333333333333335*G5_1_2 - 0.133333333333333*G5_2_0 - 0.0333333333333335*G5_2_1 - 0.033333 [...]
     A[710] = 0.0;
     A[711] = 0.0;
@@ -24355,13 +27433,13 @@ public:
     A[733] = 0.0;
     A[734] = 0.0333333333333333*G2_0_0 + 0.0333333333333333*G2_0_1 + 0.0333333333333333*G2_0_2 + 0.0333333333333333*G5_0_0 + 0.0333333333333333*G5_0_1 + 0.0333333333333333*G5_0_2 + 0.0333333333333333*G8_0_0 + 0.0333333333333333*G8_0_1 + 0.0333333333333333*G8_0_2;
     A[735] = 0.1*G2_0_0 + 0.1*G5_0_0 + 0.1*G8_0_0;
-    A[736] = -0.0333333333333334*G2_0_1 - 0.0333333333333334*G5_0_1 - 0.0333333333333334*G8_0_1;
+    A[736] = -0.0333333333333333*G2_0_1 - 0.0333333333333333*G5_0_1 - 0.0333333333333333*G8_0_1;
     A[737] = -0.0333333333333333*G2_0_2 - 0.0333333333333333*G5_0_2 - 0.0333333333333333*G8_0_2;
-    A[738] = -0.0333333333333335*G2_0_1 - 0.0333333333333335*G2_0_2 - 0.0333333333333335*G5_0_1 - 0.0333333333333335*G5_0_2 - 0.0333333333333335*G8_0_1 - 0.0333333333333335*G8_0_2;
+    A[738] = -0.0333333333333335*G2_0_1 - 0.0333333333333334*G2_0_2 - 0.0333333333333335*G5_0_1 - 0.0333333333333334*G5_0_2 - 0.0333333333333335*G8_0_1 - 0.0333333333333334*G8_0_2;
     A[739] = -0.0333333333333335*G2_0_0 + 0.1*G2_0_2 - 0.0333333333333335*G5_0_0 + 0.1*G5_0_2 - 0.0333333333333335*G8_0_0 + 0.1*G8_0_2;
-    A[740] = -0.0333333333333336*G2_0_0 + 0.1*G2_0_1 - 0.0333333333333336*G5_0_0 + 0.1*G5_0_1 - 0.0333333333333336*G8_0_0 + 0.1*G8_0_1;
+    A[740] = -0.0333333333333335*G2_0_0 + 0.1*G2_0_1 - 0.0333333333333335*G5_0_0 + 0.1*G5_0_1 - 0.0333333333333335*G8_0_0 + 0.1*G8_0_1;
     A[741] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_0_1 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_0_1 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_0_1;
-    A[742] = 0.0333333333333336*G2_0_0 + 0.0333333333333335*G2_0_2 + 0.0333333333333336*G5_0_0 + 0.0333333333333335*G5_0_2 + 0.0333333333333336*G8_0_0 + 0.0333333333333335*G8_0_2;
+    A[742] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_0_2 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_0_2 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_0_2;
     A[743] = -0.133333333333333*G2_0_0 - 0.1*G2_0_1 - 0.1*G2_0_2 - 0.133333333333333*G5_0_0 - 0.1*G5_0_1 - 0.1*G5_0_2 - 0.133333333333333*G8_0_0 - 0.1*G8_0_1 - 0.1*G8_0_2;
     A[744] = 0.0;
     A[745] = 0.0;
@@ -24388,12 +27466,12 @@ public:
     A[766] = 0.0;
     A[767] = 0.0;
     A[768] = 0.0333333333333334*G2_1_0 + 0.0333333333333333*G2_1_1 + 0.0333333333333333*G2_1_2 + 0.0333333333333334*G5_1_0 + 0.0333333333333333*G5_1_1 + 0.0333333333333333*G5_1_2 + 0.0333333333333334*G8_1_0 + 0.0333333333333333*G8_1_1 + 0.0333333333333333*G8_1_2;
-    A[769] = -0.0333333333333334*G2_1_0 - 0.0333333333333334*G5_1_0 - 0.0333333333333334*G8_1_0;
+    A[769] = -0.0333333333333333*G2_1_0 - 0.0333333333333333*G5_1_0 - 0.0333333333333333*G8_1_0;
     A[770] = 0.1*G2_1_1 + 0.1*G5_1_1 + 0.1*G8_1_1;
     A[771] = -0.0333333333333333*G2_1_2 - 0.0333333333333333*G5_1_2 - 0.0333333333333333*G8_1_2;
     A[772] = -0.0333333333333337*G2_1_1 + 0.1*G2_1_2 - 0.0333333333333337*G5_1_1 + 0.1*G5_1_2 - 0.0333333333333337*G8_1_1 + 0.1*G8_1_2;
     A[773] = -0.0333333333333337*G2_1_0 - 0.0333333333333338*G2_1_2 - 0.0333333333333337*G5_1_0 - 0.0333333333333338*G5_1_2 - 0.0333333333333337*G8_1_0 - 0.0333333333333338*G8_1_2;
-    A[774] = 0.1*G2_1_0 - 0.0333333333333337*G2_1_1 + 0.1*G5_1_0 - 0.0333333333333337*G5_1_1 + 0.1*G8_1_0 - 0.0333333333333337*G8_1_1;
+    A[774] = 0.1*G2_1_0 - 0.0333333333333336*G2_1_1 + 0.1*G5_1_0 - 0.0333333333333336*G5_1_1 + 0.1*G8_1_0 - 0.0333333333333336*G8_1_1;
     A[775] = 0.0333333333333337*G2_1_0 + 0.0333333333333337*G2_1_1 + 0.0333333333333337*G5_1_0 + 0.0333333333333337*G5_1_1 + 0.0333333333333337*G8_1_0 + 0.0333333333333337*G8_1_1;
     A[776] = -0.1*G2_1_0 - 0.133333333333333*G2_1_1 - 0.1*G2_1_2 - 0.1*G5_1_0 - 0.133333333333333*G5_1_1 - 0.1*G5_1_2 - 0.1*G8_1_0 - 0.133333333333333*G8_1_1 - 0.1*G8_1_2;
     A[777] = 0.0333333333333337*G2_1_1 + 0.0333333333333338*G2_1_2 + 0.0333333333333337*G5_1_1 + 0.0333333333333338*G5_1_2 + 0.0333333333333337*G8_1_1 + 0.0333333333333338*G8_1_2;
@@ -24422,12 +27500,12 @@ public:
     A[800] = 0.0;
     A[801] = 0.0;
     A[802] = 0.0333333333333334*G2_2_0 + 0.0333333333333334*G2_2_1 + 0.0333333333333334*G2_2_2 + 0.0333333333333334*G5_2_0 + 0.0333333333333334*G5_2_1 + 0.0333333333333334*G5_2_2 + 0.0333333333333334*G8_2_0 + 0.0333333333333334*G8_2_1 + 0.0333333333333334*G8_2_2;
-    A[803] = -0.0333333333333333*G2_2_0 - 0.0333333333333333*G5_2_0 - 0.0333333333333333*G8_2_0;
+    A[803] = -0.0333333333333334*G2_2_0 - 0.0333333333333334*G5_2_0 - 0.0333333333333334*G8_2_0;
     A[804] = -0.0333333333333333*G2_2_1 - 0.0333333333333333*G5_2_1 - 0.0333333333333333*G8_2_1;
     A[805] = 0.1*G2_2_2 + 0.1*G5_2_2 + 0.1*G8_2_2;
     A[806] = 0.1*G2_2_1 - 0.0333333333333343*G2_2_2 + 0.1*G5_2_1 - 0.0333333333333343*G5_2_2 + 0.1*G8_2_1 - 0.0333333333333343*G8_2_2;
-    A[807] = 0.1*G2_2_0 - 0.0333333333333339*G2_2_2 + 0.1*G5_2_0 - 0.0333333333333339*G5_2_2 + 0.1*G8_2_0 - 0.0333333333333339*G8_2_2;
-    A[808] = -0.0333333333333341*G2_2_0 - 0.0333333333333342*G2_2_1 - 0.0333333333333341*G5_2_0 - 0.0333333333333342*G5_2_1 - 0.0333333333333341*G8_2_0 - 0.0333333333333342*G8_2_1;
+    A[807] = 0.1*G2_2_0 - 0.033333333333334*G2_2_2 + 0.1*G5_2_0 - 0.033333333333334*G5_2_2 + 0.1*G8_2_0 - 0.033333333333334*G8_2_2;
+    A[808] = -0.033333333333334*G2_2_0 - 0.0333333333333342*G2_2_1 - 0.033333333333334*G5_2_0 - 0.0333333333333342*G5_2_1 - 0.033333333333334*G8_2_0 - 0.0333333333333342*G8_2_1;
     A[809] = -0.1*G2_2_0 - 0.1*G2_2_1 - 0.133333333333333*G2_2_2 - 0.1*G5_2_0 - 0.1*G5_2_1 - 0.133333333333333*G5_2_2 - 0.1*G8_2_0 - 0.1*G8_2_1 - 0.133333333333333*G8_2_2;
     A[810] = 0.0333333333333341*G2_2_0 + 0.0333333333333341*G2_2_2 + 0.0333333333333341*G5_2_0 + 0.0333333333333341*G5_2_2 + 0.0333333333333341*G8_2_0 + 0.0333333333333341*G8_2_2;
     A[811] = 0.033333333333334*G2_2_1 + 0.033333333333334*G2_2_2 + 0.033333333333334*G5_2_1 + 0.033333333333334*G5_2_2 + 0.033333333333334*G8_2_1 + 0.033333333333334*G8_2_2;
@@ -24455,8 +27533,8 @@ public:
     A[833] = 0.0;
     A[834] = 0.0;
     A[835] = 0.0;
-    A[836] = 0.0333333333333335*G2_1_0 + 0.0333333333333336*G2_1_1 + 0.0333333333333335*G2_1_2 + 0.0333333333333335*G2_2_0 + 0.0333333333333335*G2_2_1 + 0.0333333333333334*G2_2_2 + 0.0333333333333335*G5_1_0 + 0.0333333333333336*G5_1_1 + 0.0333333333333335*G5_1_2 + 0.0333333333333335*G5_2_0 + 0.0333333333333335*G5_2_1 + 0.0333333333333334*G5_2_2 + 0.0333333333333335*G8_1_0 + 0.0333333333333336*G8_1_1 + 0.0333333333333335*G8_1_2 + 0.0333333333333335*G8_2_0 + 0.0333333333333335*G8_2_1 + 0.0 [...]
-    A[837] = -0.0333333333333335*G2_1_0 - 0.0333333333333335*G2_2_0 - 0.0333333333333335*G5_1_0 - 0.0333333333333335*G5_2_0 - 0.0333333333333335*G8_1_0 - 0.0333333333333335*G8_2_0;
+    A[836] = 0.0333333333333336*G2_1_0 + 0.0333333333333336*G2_1_1 + 0.0333333333333335*G2_1_2 + 0.0333333333333335*G2_2_0 + 0.0333333333333335*G2_2_1 + 0.0333333333333334*G2_2_2 + 0.0333333333333336*G5_1_0 + 0.0333333333333336*G5_1_1 + 0.0333333333333335*G5_1_2 + 0.0333333333333335*G5_2_0 + 0.0333333333333335*G5_2_1 + 0.0333333333333334*G5_2_2 + 0.0333333333333336*G8_1_0 + 0.0333333333333336*G8_1_1 + 0.0333333333333335*G8_1_2 + 0.0333333333333335*G8_2_0 + 0.0333333333333335*G8_2_1 + 0.0 [...]
+    A[837] = -0.0333333333333335*G2_1_0 - 0.0333333333333334*G2_2_0 - 0.0333333333333335*G5_1_0 - 0.0333333333333334*G5_2_0 - 0.0333333333333335*G8_1_0 - 0.0333333333333334*G8_2_0;
     A[838] = -0.0333333333333337*G2_1_1 + 0.1*G2_2_1 - 0.0333333333333337*G5_1_1 + 0.1*G5_2_1 - 0.0333333333333337*G8_1_1 + 0.1*G8_2_1;
     A[839] = 0.1*G2_1_2 - 0.0333333333333343*G2_2_2 + 0.1*G5_1_2 - 0.0333333333333343*G5_2_2 + 0.1*G8_1_2 - 0.0333333333333343*G8_2_2;
     A[840] = 0.266666666666667*G2_1_1 + 0.133333333333333*G2_1_2 + 0.133333333333333*G2_2_1 + 0.266666666666667*G2_2_2 + 0.266666666666667*G5_1_1 + 0.133333333333333*G5_1_2 + 0.133333333333333*G5_2_1 + 0.266666666666667*G5_2_2 + 0.266666666666667*G8_1_1 + 0.133333333333333*G8_1_2 + 0.133333333333333*G8_2_1 + 0.266666666666667*G8_2_2;
@@ -24489,14 +27567,14 @@ public:
     A[867] = 0.0;
     A[868] = 0.0;
     A[869] = 0.0;
-    A[870] = 0.0333333333333335*G2_0_0 + 0.0333333333333336*G2_0_1 + 0.0333333333333335*G2_0_2 + 0.0333333333333336*G2_2_0 + 0.0333333333333336*G2_2_1 + 0.0333333333333335*G2_2_2 + 0.0333333333333335*G5_0_0 + 0.0333333333333336*G5_0_1 + 0.0333333333333335*G5_0_2 + 0.0333333333333336*G5_2_0 + 0.0333333333333336*G5_2_1 + 0.0333333333333335*G5_2_2 + 0.0333333333333335*G8_0_0 + 0.0333333333333336*G8_0_1 + 0.0333333333333335*G8_0_2 + 0.0333333333333336*G8_2_0 + 0.0333333333333336*G8_2_1 + 0.0 [...]
+    A[870] = 0.0333333333333336*G2_0_0 + 0.0333333333333336*G2_0_1 + 0.0333333333333335*G2_0_2 + 0.0333333333333335*G2_2_0 + 0.0333333333333336*G2_2_1 + 0.0333333333333335*G2_2_2 + 0.0333333333333336*G5_0_0 + 0.0333333333333336*G5_0_1 + 0.0333333333333335*G5_0_2 + 0.0333333333333335*G5_2_0 + 0.0333333333333336*G5_2_1 + 0.0333333333333335*G5_2_2 + 0.0333333333333336*G8_0_0 + 0.0333333333333336*G8_0_1 + 0.0333333333333335*G8_0_2 + 0.0333333333333335*G8_2_0 + 0.0333333333333336*G8_2_1 + 0.0 [...]
     A[871] = -0.0333333333333335*G2_0_0 + 0.1*G2_2_0 - 0.0333333333333335*G5_0_0 + 0.1*G5_2_0 - 0.0333333333333335*G8_0_0 + 0.1*G8_2_0;
     A[872] = -0.0333333333333337*G2_0_1 - 0.0333333333333338*G2_2_1 - 0.0333333333333337*G5_0_1 - 0.0333333333333338*G5_2_1 - 0.0333333333333337*G8_0_1 - 0.0333333333333338*G8_2_1;
-    A[873] = 0.1*G2_0_2 - 0.0333333333333339*G2_2_2 + 0.1*G5_0_2 - 0.0333333333333339*G5_2_2 + 0.1*G8_0_2 - 0.0333333333333339*G8_2_2;
+    A[873] = 0.1*G2_0_2 - 0.033333333333334*G2_2_2 + 0.1*G5_0_2 - 0.033333333333334*G5_2_2 + 0.1*G8_0_2 - 0.033333333333334*G8_2_2;
     A[874] = 0.266666666666667*G2_0_1 + 0.133333333333333*G2_0_2 + 0.133333333333335*G2_2_1 + 0.133333333333335*G2_2_2 + 0.266666666666667*G5_0_1 + 0.133333333333333*G5_0_2 + 0.133333333333335*G5_2_1 + 0.133333333333335*G5_2_2 + 0.266666666666667*G8_0_1 + 0.133333333333333*G8_0_2 + 0.133333333333335*G8_2_1 + 0.133333333333335*G8_2_2;
     A[875] = 0.266666666666667*G2_0_0 + 0.133333333333334*G2_0_2 + 0.133333333333334*G2_2_0 + 0.266666666666669*G2_2_2 + 0.266666666666667*G5_0_0 + 0.133333333333334*G5_0_2 + 0.133333333333334*G5_2_0 + 0.266666666666669*G5_2_2 + 0.266666666666667*G8_0_0 + 0.133333333333334*G8_0_2 + 0.133333333333334*G8_2_0 + 0.266666666666669*G8_2_2;
     A[876] = 0.133333333333333*G2_0_0 + 0.133333333333334*G2_0_1 + 0.133333333333334*G2_2_0 + 0.266666666666669*G2_2_1 + 0.133333333333333*G5_0_0 + 0.133333333333334*G5_0_1 + 0.133333333333334*G5_2_0 + 0.266666666666669*G5_2_1 + 0.133333333333333*G8_0_0 + 0.133333333333334*G8_0_1 + 0.133333333333334*G8_2_0 + 0.266666666666669*G8_2_1;
-    A[877] = -0.266666666666667*G2_0_0 - 0.266666666666667*G2_0_1 - 0.133333333333334*G2_0_2 - 0.133333333333335*G2_2_0 - 0.133333333333335*G2_2_1 - 0.266666666666667*G5_0_0 - 0.266666666666667*G5_0_1 - 0.133333333333334*G5_0_2 - 0.133333333333335*G5_2_0 - 0.133333333333335*G5_2_1 - 0.266666666666667*G8_0_0 - 0.266666666666667*G8_0_1 - 0.133333333333334*G8_0_2 - 0.133333333333335*G8_2_0 - 0.133333333333335*G8_2_1;
+    A[877] = -0.266666666666667*G2_0_0 - 0.266666666666667*G2_0_1 - 0.133333333333333*G2_0_2 - 0.133333333333335*G2_2_0 - 0.133333333333335*G2_2_1 - 0.266666666666667*G5_0_0 - 0.266666666666667*G5_0_1 - 0.133333333333333*G5_0_2 - 0.133333333333335*G5_2_0 - 0.133333333333335*G5_2_1 - 0.266666666666667*G8_0_0 - 0.266666666666667*G8_0_1 - 0.133333333333333*G8_0_2 - 0.133333333333335*G8_2_0 - 0.133333333333335*G8_2_1;
     A[878] = -0.133333333333333*G2_0_0 - 0.133333333333333*G2_0_2 - 0.133333333333334*G2_2_0 - 0.133333333333334*G2_2_2 - 0.133333333333333*G5_0_0 - 0.133333333333333*G5_0_2 - 0.133333333333334*G5_2_0 - 0.133333333333334*G5_2_2 - 0.133333333333333*G8_0_0 - 0.133333333333333*G8_0_2 - 0.133333333333334*G8_2_0 - 0.133333333333334*G8_2_2;
     A[879] = -0.133333333333333*G2_0_1 - 0.133333333333333*G2_0_2 - 0.133333333333333*G2_2_0 - 0.266666666666668*G2_2_1 - 0.266666666666668*G2_2_2 - 0.133333333333333*G5_0_1 - 0.133333333333333*G5_0_2 - 0.133333333333333*G5_2_0 - 0.266666666666668*G5_2_1 - 0.266666666666668*G5_2_2 - 0.133333333333333*G8_0_1 - 0.133333333333333*G8_0_2 - 0.133333333333333*G8_2_0 - 0.266666666666668*G8_2_1 - 0.266666666666668*G8_2_2;
     A[880] = 0.0;
@@ -24523,15 +27601,15 @@ public:
     A[901] = 0.0;
     A[902] = 0.0;
     A[903] = 0.0;
-    A[904] = 0.0333333333333336*G2_0_0 + 0.0333333333333336*G2_0_1 + 0.0333333333333335*G2_0_2 + 0.0333333333333335*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333335*G2_1_2 + 0.0333333333333336*G5_0_0 + 0.0333333333333336*G5_0_1 + 0.0333333333333335*G5_0_2 + 0.0333333333333335*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333335*G5_1_2 + 0.0333333333333336*G8_0_0 + 0.0333333333333336*G8_0_1 + 0.0333333333333335*G8_0_2 + 0.0333333333333335*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0 [...]
-    A[905] = -0.0333333333333336*G2_0_0 + 0.1*G2_1_0 - 0.0333333333333336*G5_0_0 + 0.1*G5_1_0 - 0.0333333333333336*G8_0_0 + 0.1*G8_1_0;
+    A[904] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_0_1 + 0.0333333333333335*G2_0_2 + 0.0333333333333335*G2_1_0 + 0.0333333333333335*G2_1_1 + 0.0333333333333335*G2_1_2 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_0_1 + 0.0333333333333335*G5_0_2 + 0.0333333333333335*G5_1_0 + 0.0333333333333335*G5_1_1 + 0.0333333333333335*G5_1_2 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_0_1 + 0.0333333333333335*G8_0_2 + 0.0333333333333335*G8_1_0 + 0.0333333333333335*G8_1_1 + 0.0 [...]
+    A[905] = -0.0333333333333335*G2_0_0 + 0.1*G2_1_0 - 0.0333333333333335*G5_0_0 + 0.1*G5_1_0 - 0.0333333333333335*G8_0_0 + 0.1*G8_1_0;
     A[906] = 0.1*G2_0_1 - 0.0333333333333336*G2_1_1 + 0.1*G5_0_1 - 0.0333333333333336*G5_1_1 + 0.1*G8_0_1 - 0.0333333333333336*G8_1_1;
-    A[907] = -0.0333333333333341*G2_0_2 - 0.0333333333333342*G2_1_2 - 0.0333333333333341*G5_0_2 - 0.0333333333333342*G5_1_2 - 0.0333333333333341*G8_0_2 - 0.0333333333333342*G8_1_2;
+    A[907] = -0.033333333333334*G2_0_2 - 0.0333333333333342*G2_1_2 - 0.033333333333334*G5_0_2 - 0.0333333333333342*G5_1_2 - 0.033333333333334*G8_0_2 - 0.0333333333333342*G8_1_2;
     A[908] = 0.133333333333334*G2_0_1 + 0.266666666666667*G2_0_2 + 0.133333333333334*G2_1_1 + 0.133333333333335*G2_1_2 + 0.133333333333334*G5_0_1 + 0.266666666666667*G5_0_2 + 0.133333333333334*G5_1_1 + 0.133333333333335*G5_1_2 + 0.133333333333334*G8_0_1 + 0.266666666666667*G8_0_2 + 0.133333333333334*G8_1_1 + 0.133333333333335*G8_1_2;
     A[909] = 0.133333333333333*G2_0_0 + 0.133333333333334*G2_0_2 + 0.133333333333334*G2_1_0 + 0.266666666666669*G2_1_2 + 0.133333333333333*G5_0_0 + 0.133333333333334*G5_0_2 + 0.133333333333334*G5_1_0 + 0.266666666666669*G5_1_2 + 0.133333333333333*G8_0_0 + 0.133333333333334*G8_0_2 + 0.133333333333334*G8_1_0 + 0.266666666666669*G8_1_2;
     A[910] = 0.266666666666667*G2_0_0 + 0.133333333333334*G2_0_1 + 0.133333333333334*G2_1_0 + 0.266666666666669*G2_1_1 + 0.266666666666667*G5_0_0 + 0.133333333333334*G5_0_1 + 0.133333333333334*G5_1_0 + 0.266666666666669*G5_1_1 + 0.266666666666667*G8_0_0 + 0.133333333333334*G8_0_1 + 0.133333333333334*G8_1_0 + 0.266666666666669*G8_1_1;
-    A[911] = -0.133333333333333*G2_0_0 - 0.133333333333334*G2_0_1 - 0.133333333333334*G2_1_0 - 0.133333333333334*G2_1_1 - 0.133333333333333*G5_0_0 - 0.133333333333334*G5_0_1 - 0.133333333333334*G5_1_0 - 0.133333333333334*G5_1_1 - 0.133333333333333*G8_0_0 - 0.133333333333334*G8_0_1 - 0.133333333333334*G8_1_0 - 0.133333333333334*G8_1_1;
-    A[912] = -0.266666666666667*G2_0_0 - 0.133333333333334*G2_0_1 - 0.266666666666667*G2_0_2 - 0.133333333333334*G2_1_0 - 0.133333333333334*G2_1_2 - 0.266666666666667*G5_0_0 - 0.133333333333334*G5_0_1 - 0.266666666666667*G5_0_2 - 0.133333333333334*G5_1_0 - 0.133333333333334*G5_1_2 - 0.266666666666667*G8_0_0 - 0.133333333333334*G8_0_1 - 0.266666666666667*G8_0_2 - 0.133333333333334*G8_1_0 - 0.133333333333334*G8_1_2;
+    A[911] = -0.133333333333333*G2_0_0 - 0.133333333333333*G2_0_1 - 0.133333333333334*G2_1_0 - 0.133333333333334*G2_1_1 - 0.133333333333333*G5_0_0 - 0.133333333333333*G5_0_1 - 0.133333333333334*G5_1_0 - 0.133333333333334*G5_1_1 - 0.133333333333333*G8_0_0 - 0.133333333333333*G8_0_1 - 0.133333333333334*G8_1_0 - 0.133333333333334*G8_1_1;
+    A[912] = -0.266666666666667*G2_0_0 - 0.133333333333333*G2_0_1 - 0.266666666666667*G2_0_2 - 0.133333333333334*G2_1_0 - 0.133333333333334*G2_1_2 - 0.266666666666667*G5_0_0 - 0.133333333333333*G5_0_1 - 0.266666666666667*G5_0_2 - 0.133333333333334*G5_1_0 - 0.133333333333334*G5_1_2 - 0.266666666666667*G8_0_0 - 0.133333333333333*G8_0_1 - 0.266666666666667*G8_0_2 - 0.133333333333334*G8_1_0 - 0.133333333333334*G8_1_2;
     A[913] = -0.133333333333334*G2_0_1 - 0.133333333333333*G2_0_2 - 0.133333333333333*G2_1_0 - 0.266666666666668*G2_1_1 - 0.266666666666668*G2_1_2 - 0.133333333333334*G5_0_1 - 0.133333333333333*G5_0_2 - 0.133333333333333*G5_1_0 - 0.266666666666668*G5_1_1 - 0.266666666666668*G5_1_2 - 0.133333333333334*G8_0_1 - 0.133333333333333*G8_0_2 - 0.133333333333333*G8_1_0 - 0.266666666666668*G8_1_1 - 0.266666666666668*G8_1_2;
     A[914] = 0.0;
     A[915] = 0.0;
@@ -24563,7 +27641,7 @@ public:
     A[941] = -0.1*G2_0_2 - 0.1*G2_1_2 - 0.133333333333333*G2_2_2 - 0.1*G5_0_2 - 0.1*G5_1_2 - 0.133333333333333*G5_2_2 - 0.1*G8_0_2 - 0.1*G8_1_2 - 0.133333333333333*G8_2_2;
     A[942] = -0.266666666666667*G2_0_1 - 0.133333333333333*G2_0_2 - 0.266666666666667*G2_1_1 - 0.133333333333333*G2_1_2 - 0.133333333333333*G2_2_1 - 0.266666666666667*G5_0_1 - 0.133333333333333*G5_0_2 - 0.266666666666667*G5_1_1 - 0.133333333333333*G5_1_2 - 0.133333333333333*G5_2_1 - 0.266666666666667*G8_0_1 - 0.133333333333333*G8_0_2 - 0.266666666666667*G8_1_1 - 0.133333333333333*G8_1_2 - 0.133333333333333*G8_2_1;
     A[943] = -0.266666666666667*G2_0_0 - 0.133333333333335*G2_0_2 - 0.266666666666667*G2_1_0 - 0.133333333333335*G2_1_2 - 0.133333333333334*G2_2_0 - 0.266666666666667*G5_0_0 - 0.133333333333335*G5_0_2 - 0.266666666666667*G5_1_0 - 0.133333333333335*G5_1_2 - 0.133333333333334*G5_2_0 - 0.266666666666667*G8_0_0 - 0.133333333333335*G8_0_2 - 0.266666666666667*G8_1_0 - 0.133333333333335*G8_1_2 - 0.133333333333334*G8_2_0;
-    A[944] = -0.133333333333333*G2_0_0 - 0.133333333333334*G2_0_1 - 0.133333333333334*G2_1_0 - 0.133333333333334*G2_1_1 - 0.133333333333333*G5_0_0 - 0.133333333333334*G5_0_1 - 0.133333333333334*G5_1_0 - 0.133333333333334*G5_1_1 - 0.133333333333333*G8_0_0 - 0.133333333333334*G8_0_1 - 0.133333333333334*G8_1_0 - 0.133333333333334*G8_1_1;
+    A[944] = -0.133333333333333*G2_0_0 - 0.133333333333334*G2_0_1 - 0.133333333333333*G2_1_0 - 0.133333333333334*G2_1_1 - 0.133333333333333*G5_0_0 - 0.133333333333334*G5_0_1 - 0.133333333333333*G5_1_0 - 0.133333333333334*G5_1_1 - 0.133333333333333*G8_0_0 - 0.133333333333334*G8_0_1 - 0.133333333333333*G8_1_0 - 0.133333333333334*G8_1_1;
     A[945] = 0.266666666666667*G2_0_0 + 0.266666666666667*G2_0_1 + 0.133333333333334*G2_0_2 + 0.266666666666667*G2_1_0 + 0.266666666666667*G2_1_1 + 0.133333333333334*G2_1_2 + 0.133333333333334*G2_2_0 + 0.133333333333334*G2_2_1 + 0.266666666666667*G2_2_2 + 0.266666666666667*G5_0_0 + 0.266666666666667*G5_0_1 + 0.133333333333334*G5_0_2 + 0.266666666666667*G5_1_0 + 0.266666666666667*G5_1_1 + 0.133333333333334*G5_1_2 + 0.133333333333334*G5_2_0 + 0.133333333333334*G5_2_1 + 0.266666666666667*G5 [...]
     A[946] = 0.133333333333333*G2_0_0 + 0.133333333333333*G2_0_2 + 0.133333333333334*G2_1_0 + 0.133333333333333*G2_1_2 + 0.133333333333333*G2_2_1 + 0.133333333333333*G5_0_0 + 0.133333333333333*G5_0_2 + 0.133333333333334*G5_1_0 + 0.133333333333333*G5_1_2 + 0.133333333333333*G5_2_1 + 0.133333333333333*G8_0_0 + 0.133333333333333*G8_0_2 + 0.133333333333334*G8_1_0 + 0.133333333333333*G8_1_2 + 0.133333333333333*G8_2_1;
     A[947] = 0.133333333333333*G2_0_1 + 0.133333333333333*G2_0_2 + 0.133333333333334*G2_1_1 + 0.133333333333334*G2_1_2 + 0.133333333333333*G2_2_0 + 0.133333333333333*G5_0_1 + 0.133333333333333*G5_0_2 + 0.133333333333334*G5_1_1 + 0.133333333333334*G5_1_2 + 0.133333333333333*G5_2_0 + 0.133333333333333*G8_0_1 + 0.133333333333333*G8_0_2 + 0.133333333333334*G8_1_1 + 0.133333333333334*G8_1_2 + 0.133333333333333*G8_2_0;
@@ -24591,13 +27669,13 @@ public:
     A[969] = 0.0;
     A[970] = 0.0;
     A[971] = 0.0;
-    A[972] = -0.0333333333333336*G2_0_0 - 0.0333333333333336*G2_0_1 - 0.0333333333333335*G2_0_2 - 0.133333333333333*G2_1_0 - 0.133333333333333*G2_1_1 - 0.133333333333333*G2_1_2 - 0.0333333333333335*G2_2_0 - 0.0333333333333335*G2_2_1 - 0.0333333333333334*G2_2_2 - 0.0333333333333336*G5_0_0 - 0.0333333333333336*G5_0_1 - 0.0333333333333335*G5_0_2 - 0.133333333333333*G5_1_0 - 0.133333333333333*G5_1_1 - 0.133333333333333*G5_1_2 - 0.0333333333333335*G5_2_0 - 0.0333333333333335*G5_2_1 - 0.033333 [...]
-    A[973] = 0.0333333333333336*G2_0_0 + 0.0333333333333335*G2_2_0 + 0.0333333333333336*G5_0_0 + 0.0333333333333335*G5_2_0 + 0.0333333333333336*G8_0_0 + 0.0333333333333335*G8_2_0;
+    A[972] = -0.0333333333333336*G2_0_0 - 0.0333333333333335*G2_0_1 - 0.0333333333333335*G2_0_2 - 0.133333333333333*G2_1_0 - 0.133333333333333*G2_1_1 - 0.133333333333333*G2_1_2 - 0.0333333333333335*G2_2_0 - 0.0333333333333335*G2_2_1 - 0.0333333333333335*G2_2_2 - 0.0333333333333336*G5_0_0 - 0.0333333333333335*G5_0_1 - 0.0333333333333335*G5_0_2 - 0.133333333333333*G5_1_0 - 0.133333333333333*G5_1_1 - 0.133333333333333*G5_1_2 - 0.0333333333333335*G5_2_0 - 0.0333333333333335*G5_2_1 - 0.033333 [...]
+    A[973] = 0.0333333333333335*G2_0_0 + 0.0333333333333335*G2_2_0 + 0.0333333333333335*G5_0_0 + 0.0333333333333335*G5_2_0 + 0.0333333333333335*G8_0_0 + 0.0333333333333335*G8_2_0;
     A[974] = -0.1*G2_0_1 - 0.133333333333333*G2_1_1 - 0.1*G2_2_1 - 0.1*G5_0_1 - 0.133333333333333*G5_1_1 - 0.1*G5_2_1 - 0.1*G8_0_1 - 0.133333333333333*G8_1_1 - 0.1*G8_2_1;
     A[975] = 0.0333333333333341*G2_0_2 + 0.0333333333333341*G2_2_2 + 0.0333333333333341*G5_0_2 + 0.0333333333333341*G5_2_2 + 0.0333333333333341*G8_0_2 + 0.0333333333333341*G8_2_2;
     A[976] = -0.133333333333334*G2_0_1 - 0.266666666666667*G2_0_2 - 0.133333333333334*G2_1_2 - 0.133333333333333*G2_2_1 - 0.266666666666667*G2_2_2 - 0.133333333333334*G5_0_1 - 0.266666666666667*G5_0_2 - 0.133333333333334*G5_1_2 - 0.133333333333333*G5_2_1 - 0.266666666666667*G5_2_2 - 0.133333333333334*G8_0_1 - 0.266666666666667*G8_0_2 - 0.133333333333334*G8_1_2 - 0.133333333333333*G8_2_1 - 0.266666666666667*G8_2_2;
     A[977] = -0.133333333333333*G2_0_0 - 0.133333333333334*G2_0_2 - 0.133333333333333*G2_2_0 - 0.133333333333334*G2_2_2 - 0.133333333333333*G5_0_0 - 0.133333333333334*G5_0_2 - 0.133333333333333*G5_2_0 - 0.133333333333334*G5_2_2 - 0.133333333333333*G8_0_0 - 0.133333333333334*G8_0_2 - 0.133333333333333*G8_2_0 - 0.133333333333334*G8_2_2;
-    A[978] = -0.266666666666667*G2_0_0 - 0.133333333333334*G2_0_1 - 0.133333333333334*G2_1_0 - 0.266666666666667*G2_2_0 - 0.133333333333334*G2_2_1 - 0.266666666666667*G5_0_0 - 0.133333333333334*G5_0_1 - 0.133333333333334*G5_1_0 - 0.266666666666667*G5_2_0 - 0.133333333333334*G5_2_1 - 0.266666666666667*G8_0_0 - 0.133333333333334*G8_0_1 - 0.133333333333334*G8_1_0 - 0.266666666666667*G8_2_0 - 0.133333333333334*G8_2_1;
+    A[978] = -0.266666666666667*G2_0_0 - 0.133333333333334*G2_0_1 - 0.133333333333333*G2_1_0 - 0.266666666666667*G2_2_0 - 0.133333333333334*G2_2_1 - 0.266666666666667*G5_0_0 - 0.133333333333334*G5_0_1 - 0.133333333333333*G5_1_0 - 0.266666666666667*G5_2_0 - 0.133333333333334*G5_2_1 - 0.266666666666667*G8_0_0 - 0.133333333333334*G8_0_1 - 0.133333333333333*G8_1_0 - 0.266666666666667*G8_2_0 - 0.133333333333334*G8_2_1;
     A[979] = 0.133333333333333*G2_0_0 + 0.133333333333334*G2_0_1 + 0.133333333333333*G2_1_2 + 0.133333333333333*G2_2_0 + 0.133333333333333*G2_2_1 + 0.133333333333333*G5_0_0 + 0.133333333333334*G5_0_1 + 0.133333333333333*G5_1_2 + 0.133333333333333*G5_2_0 + 0.133333333333333*G5_2_1 + 0.133333333333333*G8_0_0 + 0.133333333333334*G8_0_1 + 0.133333333333333*G8_1_2 + 0.133333333333333*G8_2_0 + 0.133333333333333*G8_2_1;
     A[980] = 0.266666666666667*G2_0_0 + 0.133333333333334*G2_0_1 + 0.266666666666667*G2_0_2 + 0.133333333333334*G2_1_0 + 0.266666666666667*G2_1_1 + 0.133333333333333*G2_1_2 + 0.266666666666667*G2_2_0 + 0.133333333333333*G2_2_1 + 0.266666666666667*G2_2_2 + 0.266666666666667*G5_0_0 + 0.133333333333334*G5_0_1 + 0.266666666666667*G5_0_2 + 0.133333333333334*G5_1_0 + 0.266666666666667*G5_1_1 + 0.133333333333333*G5_1_2 + 0.266666666666667*G5_2_0 + 0.133333333333333*G5_2_1 + 0.266666666666667*G5 [...]
     A[981] = 0.133333333333334*G2_0_1 + 0.133333333333333*G2_0_2 + 0.133333333333333*G2_1_0 + 0.133333333333333*G2_2_1 + 0.133333333333333*G2_2_2 + 0.133333333333334*G5_0_1 + 0.133333333333333*G5_0_2 + 0.133333333333333*G5_1_0 + 0.133333333333333*G5_2_1 + 0.133333333333333*G5_2_2 + 0.133333333333334*G8_0_1 + 0.133333333333333*G8_0_2 + 0.133333333333333*G8_1_0 + 0.133333333333333*G8_2_1 + 0.133333333333333*G8_2_2;
@@ -24779,77 +27857,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stokespreconditioner_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   stokespreconditioner_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokespreconditioner_form_0()
+  ~stokespreconditioner_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "a20dfbf851fe9cb077d0f0076c52ac781755a785dd19de2f1b142d4230a6dfc2d3f77845481bfe3758da43da3d168827dbc65dbfa01c803183b4e044d8b84745";
+    return "4567cd98e62c75f5ece079467d8ab8fe8f7ed1cdc37f873eb0ba89b578b82f5674ebd1bfb2709f03d1e90805f2ffe558e33e9d4472c29c4e0e978884b5b095db";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stokespreconditioner_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stokespreconditioner_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokespreconditioner_finite_element_3();
+        return new stokespreconditioner_finite_element_4();
         break;
       }
     case 1:
       {
-        return new stokespreconditioner_finite_element_3();
+        return new stokespreconditioner_finite_element_4();
         break;
       }
     }
@@ -24857,19 +27927,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokespreconditioner_dofmap_3();
+        return new stokespreconditioner_dofmap_4();
         break;
       }
     case 1:
       {
-        return new stokespreconditioner_dofmap_3();
+        return new stokespreconditioner_dofmap_4();
         break;
       }
     }
@@ -24877,126 +27946,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stokespreconditioner_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -25010,14 +28115,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace StokesPreconditioner
 {
@@ -25026,43 +28137,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokespreconditioner_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokespreconditioner_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokespreconditioner_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokespreconditioner_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokespreconditioner_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokespreconditioner_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokespreconditioner_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokespreconditioner_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokespreconditioner_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokespreconditioner_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokespreconditioner_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokespreconditioner_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -25073,63 +28161,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokespreconditioner_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokespreconditioner_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokespreconditioner_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokespreconditioner_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokespreconditioner_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokespreconditioner_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokespreconditioner_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokespreconditioner_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokespreconditioner_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokespreconditioner_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokespreconditioner_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokespreconditioner_dofmap_3()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokespreconditioner_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -25137,7 +28232,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokespreconditioner_form_0());
+    _ufc_form = std::make_shared<const stokespreconditioner_form_0>();
   }
 
   // Destructor
@@ -25167,14 +28262,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/stokes-iterative/cpp/compile.log b/demo/documented/stokes-iterative/cpp/compile.log
index 382d0ef..401aad7 100644
--- a/demo/documented/stokes-iterative/cpp/compile.log
+++ b/demo/documented/stokes-iterative/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form StokesPreconditioner
 
@@ -12,9 +13,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Mixed<Vector<3 x CG2(?)>, CG1(?)>'
-  Unique sub elements:       'Mixed<Vector<3 x CG2(?)>, CG1(?)>, Vector<3 x CG2(?)>,
-                              CG1(?), CG2(?)'
+  Unique elements:           'Mixed<Vector<3 x CG2(?)>, CG1(?)>, Vector<3 x CG1(?)>'
+  Unique sub elements:       'Mixed<Vector<3 x CG2(?)>, CG1(?)>, Vector<3 x CG1(?)>,
+                              Vector<3 x CG2(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -61,15 +62,24 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.200664 seconds.
+Compiler stage 1 finished in 0.467361 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -80,11 +90,14 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
+  Computing representation of 5 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -131,7 +144,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00345 seconds
+  10404 entries computed in 0.00502 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -140,7 +153,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00328 seconds
+  10404 entries computed in 0.00358 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -149,7 +162,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00331 seconds
+  10404 entries computed in 0.00359 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -158,7 +171,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00335 seconds
+  10404 entries computed in 0.00365 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -167,7 +180,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00338 seconds
+  10404 entries computed in 0.00361 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -176,7 +189,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00338 seconds
+  10404 entries computed in 0.00378 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -185,7 +198,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00337 seconds
+  10404 entries computed in 0.00368 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -194,7 +207,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00338 seconds
+  10404 entries computed in 0.00369 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -203,7 +216,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00337 seconds
+  10404 entries computed in 0.00377 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -212,7 +225,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  1156 entries computed in 0.00221 seconds
+  1156 entries computed in 0.00227 seconds
   Shape of reference tensor: (34, 34)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -220,1039 +233,202 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 0 dims = [] indices = [[]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0684609 seconds.
+Compiler stage 2 finished in 0.106929 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000150919 seconds.
+Compiler stage 3 finished in 0.000221968 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Generating code for 5 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 1.73418 seconds.
+Compiler stage 4 finished in 2.91445 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000390053 seconds.
+Compiler stage 4.1 finished in 0.000558138 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./StokesPreconditioner.h.
-Compiler stage 5 finished in 0.00294209 seconds.
+Compiler stage 5 finished in 0.00268912 seconds.
 
-FFC finished in 2.00712 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 3.49277 seconds.
+Output written to ./StokesPreconditioner.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Stokes
 
@@ -1265,9 +441,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Mixed<Vector<3 x CG2(?)>, CG1(?)>'
-  Unique sub elements:       'Mixed<Vector<3 x CG2(?)>, CG1(?)>, Vector<3 x CG2(?)>,
-                              CG1(?), CG2(?)'
+  Unique elements:           'Mixed<Vector<3 x CG2(?)>, CG1(?)>, Vector<3 x CG1(?)>'
+  Unique sub elements:       'Mixed<Vector<3 x CG2(?)>, CG1(?)>, Vector<3 x CG1(?)>,
+                              Vector<3 x CG2(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1334,9 +510,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -1344,9 +520,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'Mixed<Vector<3 x CG2(?)>, CG1(?)>, Vector<3 x CG2(?)>'
+  Unique elements:           'Mixed<Vector<3 x CG2(?)>, CG1(?)>, Vector<3 x CG2(?)>,
+                              Vector<3 x CG1(?)>'
   Unique sub elements:       'Mixed<Vector<3 x CG2(?)>, CG1(?)>, Vector<3 x CG2(?)>,
-                              CG1(?), CG2(?)'
+                              Vector<3 x CG1(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1366,15 +543,24 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.213407 seconds.
+Compiler stage 1 finished in 0.49605 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -1383,11 +569,14 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
+  Computing representation of 5 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -1454,7 +643,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00277 seconds
+  10404 entries computed in 0.00315 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1463,7 +652,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00282 seconds
+  10404 entries computed in 0.00309 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1472,7 +661,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00266 seconds
+  10404 entries computed in 0.00305 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1481,7 +670,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00269 seconds
+  10404 entries computed in 0.00321 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1490,7 +679,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00267 seconds
+  10404 entries computed in 0.00314 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1499,7 +688,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00267 seconds
+  10404 entries computed in 0.00308 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1508,7 +697,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00277 seconds
+  10404 entries computed in 0.00307 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1517,7 +706,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00277 seconds
+  10404 entries computed in 0.00307 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1526,7 +715,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  10404 entries computed in 0.00281 seconds
+  10404 entries computed in 0.0031 seconds
   Shape of reference tensor: (34, 34, 3, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -1535,7 +724,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  3468 entries computed in 0.00253 seconds
+  3468 entries computed in 0.0027 seconds
   Shape of reference tensor: (34, 34, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1544,7 +733,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  3468 entries computed in 0.00252 seconds
+  3468 entries computed in 0.00275 seconds
   Shape of reference tensor: (34, 34, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1553,7 +742,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  3468 entries computed in 0.00252 seconds
+  3468 entries computed in 0.00281 seconds
   Shape of reference tensor: (34, 34, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1562,7 +751,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  3468 entries computed in 0.00252 seconds
+  3468 entries computed in 0.0028 seconds
   Shape of reference tensor: (34, 34, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1571,7 +760,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  3468 entries computed in 0.00251 seconds
+  3468 entries computed in 0.00266 seconds
   Shape of reference tensor: (34, 34, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1580,7 +769,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  3468 entries computed in 0.00251 seconds
+  3468 entries computed in 0.00372 seconds
   Shape of reference tensor: (34, 34, 3)
   Primary multi index:   rank = 2 dims = [34, 34] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [0, 26], [0, 27], [0, 28], [0, 29], [0, 30], [0, 31], [0, 32], [0, 33], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [ [...]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1588,6 +777,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1606,7 +796,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1020 entries computed in 0.00371 seconds
+  1020 entries computed in 0.00492 seconds
   Shape of reference tensor: (34, 30)
   Primary multi index:   rank = 1 dims = [34] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33]]
   Secondary multi index: rank = 1 dims = [30] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29]]
@@ -1616,7 +806,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1020 entries computed in 0.00362 seconds
+  1020 entries computed in 0.00463 seconds
   Shape of reference tensor: (34, 30)
   Primary multi index:   rank = 1 dims = [34] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33]]
   Secondary multi index: rank = 1 dims = [30] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29]]
@@ -1626,7 +816,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1020 entries computed in 0.00357 seconds
+  1020 entries computed in 0.00368 seconds
   Shape of reference tensor: (34, 30)
   Primary multi index:   rank = 1 dims = [34] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33]]
   Secondary multi index: rank = 1 dims = [30] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29]]
@@ -1635,1034 +825,196 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.108114 seconds.
+Compiler stage 2 finished in 0.147087 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000165939 seconds.
+Compiler stage 3 finished in 0.000223875 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp4
-  Removing unused variable: tmp3
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Generating code for 5 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 1.91453 seconds.
+Compiler stage 4 finished in 2.7902 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000602007 seconds.
+Compiler stage 4.1 finished in 0.00105095 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Stokes.h.
-Compiler stage 5 finished in 0.0030551 seconds.
+Compiler stage 5 finished in 0.0063839 seconds.
 
-FFC finished in 2.24024 seconds.
+FFC finished in 3.44154 seconds.
+Output written to ./Stokes.h.
diff --git a/demo/documented/stokes-iterative/cpp/main.cpp b/demo/documented/stokes-iterative/cpp/main.cpp
index c354a53..c59947d 100644
--- a/demo/documented/stokes-iterative/cpp/main.cpp
+++ b/demo/documented/stokes-iterative/cpp/main.cpp
@@ -100,28 +100,25 @@ int main()
   }
 
   // Create mesh
-  UnitCubeMesh mesh(16, 16, 16);
+  auto mesh = std::make_shared<UnitCubeMesh>(16, 16, 16);
 
   // Create function space and subspaces
-  Stokes::FunctionSpace W(mesh);
-  SubSpace W0(W, 0);
-  SubSpace W1(W, 1);
+  auto W = std::make_shared<Stokes::FunctionSpace>(mesh);
 
   // Set-up infow boundary condition
-  Inflow inflow_prfofile;
-  Right right;
-  DirichletBC inflow(W0, inflow_prfofile, right);
+  auto inflow_prfofile = std::make_shared<Inflow>();
+  auto right = std::make_shared<Right>();
+  auto inflow = std::make_shared<DirichletBC>(W->sub(0), inflow_prfofile,
+                                              right);
 
   // Set-up no-slip boundary condition
-  Constant zero_vector(0.0, 0.0, 0.0);
-  TopBottom top_bottom;
-  DirichletBC noslip(W0, zero_vector, top_bottom);
-
-  // Collect boundary conditions
-  std::vector<const DirichletBC*> bcs = {{&inflow, &noslip}};
+  auto zero_vector = std::make_shared<Constant>(0.0, 0.0, 0.0);
+  auto top_bottom = std::make_shared<TopBottom>();
+  auto noslip = std::make_shared<DirichletBC>(W->sub(0), zero_vector,
+                                              top_bottom);
 
   // Create forms for the Stokes problem
-  Constant f(0.0, 0.0, 0.0);
+  auto f = std::make_shared<Constant>(0.0, 0.0, 0.0);
   Stokes::BilinearForm a(W, W);
   Stokes::LinearForm L(W);
   L.f = f;
@@ -133,13 +130,13 @@ int main()
   StokesPreconditioner::BilinearForm a_P(W, W);
 
   // Assemble precondtioner system (P, b_dummy)
-  std::shared_ptr<Matrix> P(new Matrix);
+  auto P = std::make_shared<Matrix>();
   Vector b;
-  assemble_system(*P, b, a_P, L, bcs);
+  assemble_system(*P, b, a_P, L, {inflow, noslip});
 
   // Assemble Stokes system (A, b)
-  std::shared_ptr<Matrix> A(new Matrix);
-  assemble_system(*A, b, a, L, bcs);
+  auto A = std::make_shared<Matrix>();
+  assemble_system(*A, b, a, L, {inflow, noslip});
 
   // Create Krylov solver with specified method and preconditioner
   KrylovSolver solver(krylov_method, "amg");
diff --git a/demo/documented/stokes-iterative/python/demo_stokes-iterative.py b/demo/documented/stokes-iterative/python/demo_stokes-iterative.py
index 3fdbc50..cd43f71 100644
--- a/demo/documented/stokes-iterative/python/demo_stokes-iterative.py
+++ b/demo/documented/stokes-iterative/python/demo_stokes-iterative.py
@@ -47,10 +47,11 @@ else:
 # Load mesh
 mesh = UnitCubeMesh(16, 16, 16)
 
-# Define function spaces
-V = VectorFunctionSpace(mesh, "CG", 2)
-Q = FunctionSpace(mesh, "CG", 1)
-W = V * Q
+# Build function space
+P2 = VectorElement("Lagrange", mesh.ufl_cell(), 2)
+P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+TH = P2 * P1
+W = FunctionSpace(mesh, TH)
 
 # Boundaries
 def right(x, on_boundary): return x[0] > (1.0 - DOLFIN_EPS)
@@ -63,7 +64,7 @@ noslip = Constant((0.0, 0.0, 0.0))
 bc0 = DirichletBC(W.sub(0), noslip, top_bottom)
 
 # Inflow boundary condition for velocity
-inflow = Expression(("-sin(x[1]*pi)", "0.0", "0.0"))
+inflow = Expression(("-sin(x[1]*pi)", "0.0", "0.0"), degree=2)
 bc1 = DirichletBC(W.sub(0), inflow, right)
 
 # Collect boundary conditions
diff --git a/demo/documented/stokes-iterative/python/documentation.rst b/demo/documented/stokes-iterative/python/documentation.rst
index bfc7fd7..711c272 100644
--- a/demo/documented/stokes-iterative/python/documentation.rst
+++ b/demo/documented/stokes-iterative/python/documentation.rst
@@ -61,13 +61,10 @@ If not available, costly QMR method is choosen.
         exit()
 
 Next, we define the mesh (a :py:class:`UnitCubeMesh
-<dolfin.cpp.UnitCubeMesh>`) and a :py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>` composed of a
-:py:class:`VectorFunctionSpace
-<dolfin.functions.functionspace.VectorFunctionSpace>` of continuous
-piecewise quadratics and a :py:class:`FunctionSpace
-<dolfin.functions.functionspace.FunctionSpace>` of continuous
-piecewise linears. (This mixed finite element space is known as the
+<dolfin.cpp.UnitCubeMesh>`) and a mixed finite element ``TH``.
+Then we build a :py:class:`FunctionSpace
+<dolfin.functions.functionspace.FunctionSpace>` on this element.
+(This mixed finite element space is known as the
 Taylor--Hood elements and is a stable, standard element pair for the
 Stokes equations.)
 
@@ -76,10 +73,11 @@ Stokes equations.)
     # Load mesh
     mesh = UnitCubeMesh(16, 16, 16)
 
-    # Define function spaces
-    V = VectorFunctionSpace(mesh, "CG", 2)
-    Q = FunctionSpace(mesh, "CG", 1)
-    W = V * Q
+    # Build function space
+    P2 = VectorElement("Lagrange", mesh.ufl_cell(), 2)
+    P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    TH = P2 * P1
+    W = FunctionSpace(mesh, TH)
 
 Next, we define the boundary conditions.
 
@@ -96,7 +94,7 @@ Next, we define the boundary conditions.
     bc0 = DirichletBC(W.sub(0), noslip, top_bottom)
 
     # Inflow boundary condition for velocity
-    inflow = Expression(("-sin(x[1]*pi)", "0.0", "0.0"))
+    inflow = Expression(("-sin(x[1]*pi)", "0.0", "0.0"), degree=2)
     bc1 = DirichletBC(W.sub(0), inflow, right)
 
     # Collect boundary conditions
diff --git a/demo/documented/stokes-mini/python/demo_stokes-mini.py b/demo/documented/stokes-mini/python/demo_stokes-mini.py
index a5ab464..a35bb2b 100644
--- a/demo/documented/stokes-mini/python/demo_stokes-mini.py
+++ b/demo/documented/stokes-mini/python/demo_stokes-mini.py
@@ -34,35 +34,34 @@ from dolfin import *
 mesh = Mesh("../dolfin_fine.xml.gz")
 sub_domains = MeshFunction("size_t", mesh, "../dolfin_fine_subdomains.xml.gz")
 
-# Define function spaces
-P1 = VectorFunctionSpace(mesh, "Lagrange", 1)
-B  = VectorFunctionSpace(mesh, "Bubble", 3)
-Q  = FunctionSpace(mesh, "CG",  1)
-V = P1 + B
-Mini = V*Q
+# Build function spaces on Mini element
+P1 = VectorElement("Lagrange", mesh.ufl_cell(), 1)
+B = VectorElement("Bubble",   mesh.ufl_cell(), 3)
+Q = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+W = FunctionSpace(mesh, (P1 + B) * Q)
 
 # No-slip boundary condition for velocity
 # NOTE: Projection here is inefficient workaround of issue #489, FFC issue #69
-noslip = project(Constant((0, 0)), V)
-bc0 = DirichletBC(Mini.sub(0), noslip, sub_domains, 0)
+noslip = project(Constant((0, 0)), W.sub(0).collapse())
+bc0 = DirichletBC(W.sub(0), noslip, sub_domains, 0)
 
 # Inflow boundary condition for velocity
 # NOTE: Projection here is inefficient workaround of issue #489, FFC issue #69
-inflow = project(Expression(("-sin(x[1]*pi)", "0.0")), V)
-bc1 = DirichletBC(Mini.sub(0), inflow, sub_domains, 1)
+inflow = project(Expression(("-sin(x[1]*pi)", "0.0"), degree=2), W.sub(0).collapse())
+bc1 = DirichletBC(W.sub(0), inflow, sub_domains, 1)
 
 # Collect boundary conditions
 bcs = [bc0, bc1]
 
 # Define variational problem
-(u, p) = TrialFunctions(Mini)
-(v, q) = TestFunctions(Mini)
+(u, p) = TrialFunctions(W)
+(v, q) = TestFunctions(W)
 f = Constant((0, 0))
 a = (inner(grad(u), grad(v)) - div(v)*p + q*div(u))*dx
 L = inner(f, v)*dx
 
 # Compute solution
-w = Function(Mini)
+w = Function(W)
 solve(a == L, w, bcs)
 
 # Split the mixed solution using deepcopy
diff --git a/demo/documented/stokes-mini/python/documentation.rst b/demo/documented/stokes-mini/python/documentation.rst
index 7a48e51..b501809 100644
--- a/demo/documented/stokes-mini/python/documentation.rst
+++ b/demo/documented/stokes-mini/python/documentation.rst
@@ -40,25 +40,19 @@ following way:
     mesh = Mesh("../dolfin_fine.xml.gz")
     sub_domains = MeshFunction("size_t", mesh, "../dolfin_fine_subdomains.xml.gz")
 
-Next, we define a :py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>` composed of a
-:py:class:`VectorFunctionSpace
-<dolfin.functions.functionspace.VectorFunctionSpace>` of the linear
-vector Lagrange elements enriched with the cubic vector Bubble
-elements and a :py:class:`FunctionSpace
-<dolfin.cpp.function.FunctionSpace>` of continuous piecewise
-linears. (This mixed finite element space is known as the Mini space
-where we have the vector Bubble element for the velocity
-approximation.)
+Next, we define a :py:class:`FunctionSpace
+<dolfin.functions.functionspace.FunctionSpace>` on Mini element
+``(P1 + B) * Q``. UFL object ``P1 + B`` stands for the vectorial
+Lagrange element of degree 1 enriched with the cubic Bubble.
+``(P1 + B) * Q`` defines the mixed element for velocity and pressure.
 
 .. code-block:: python
 
-    # Define function spaces
-    P1 = VectorFunctionSpace(mesh, "Lagrange", 1)
-    B  = VectorFunctionSpace(mesh, "Bubble", 3)
-    Q  = FunctionSpace(mesh, "CG",  1)
-    V = P1 + B
-    Mini = V*Q
+    # Build function spaces on Mini element
+    P1 = VectorElement("Lagrange", mesh.ufl_cell(), 1)
+    B = VectorElement("Bubble",   mesh.ufl_cell(), 3)
+    Q = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    W = FunctionSpace(mesh, (P1 + B) * Q)
 
 Now that we have our mixed function space and marked subdomains
 defining the boundaries, we define boundary conditions:
@@ -67,13 +61,13 @@ defining the boundaries, we define boundary conditions:
 
     # No-slip boundary condition for velocity
     # NOTE: Projection here is inefficient workaround of issue #489, FFC issue #69
-    noslip = project(Constant((0, 0)), V)
-    bc0 = DirichletBC(Mini.sub(0), noslip, sub_domains, 0)
+    noslip = project(Constant((0, 0)), W.sub(0).collapse())
+    bc0 = DirichletBC(W.sub(0), noslip, sub_domains, 0)
 
     # Inflow boundary condition for velocity
     # NOTE: Projection here is inefficient workaround of issue #489, FFC issue #69
-    inflow = project(Expression(("-sin(x[1]*pi)", "0.0")), V)
-    bc1 = DirichletBC(Mini.sub(0), inflow, sub_domains, 1)
+    inflow = project(Expression(("-sin(x[1]*pi)", "0.0"), degree=2), W.sub(0).collapse())
+    bc1 = DirichletBC(W.sub(0), inflow, sub_domains, 1)
 
     # Collect boundary conditions
     bcs = [bc0, bc1]
@@ -82,9 +76,9 @@ Here, we have given four arguments in the call of
 :py:class:`DirichletBC <dolfin.cpp.fem.DirichletBC>`. The first
 specifies the :py:class:`FunctionSpace
 <dolfin.cpp.function.FunctionSpace>`. Since we have a
-:py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>`, we write
-W.sub(0) for the function space V, and W.sub(1) for Q. The second
+mixed function space, we write
+``W.sub(0)`` for the velocity componenet of the space,
+and ``W.sub(1)`` for the pressure component of the space. The second
 argument specifies the value on the Dirichlet boundary. The two last
 arguments specify the marking of the subdomains; ``sub_domains`` contains
 the subdomain markers and the number given as the last argument is the
@@ -96,8 +90,8 @@ formulation of the Stokes equations are defined as follows:
 .. code-block:: python
 
     # Define variational problem
-    (u, p) = TrialFunctions(Mini)
-    (v, q) = TestFunctions(Mini)
+    (u, p) = TrialFunctions(W)
+    (v, q) = TestFunctions(W)
     f = Constant((0, 0))
     a = (inner(grad(u), grad(v)) - div(v)*p + q*div(u))*dx
     L = inner(f, v)*dx
@@ -105,9 +99,8 @@ formulation of the Stokes equations are defined as follows:
 To compute the solution we use the bilinear and linear forms, and the
 boundary condition, but we also need to create a :py:class:`Function
 <dolfin.cpp.function.Function>` to store the solution(s). The (full)
-solution will be stored in ``w``, which we initialize using the
-:py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>` ``W``. The actual
+solution will be stored in ``w``, which we initialize using the mixed
+function space ``W``. The actual
 computation is performed by calling solve with the arguments ``a``,
 ``L``, ``w`` and ``bcs``. The separate components ``u`` and ``p`` of
 the solution can be extracted by calling the :py:meth:`split
@@ -119,14 +112,14 @@ a deep copy for further computations on the coefficient vectors.
 .. code-block:: python
 
     # Compute solution
-    w = Function(Mini)
+    w = Function(W)
     solve(a == L, w, bcs)
 
     # Split the mixed solution using deepcopy
     # (needed for further computation on coefficient vector)
     (u, p) = w.split(True)
 
-We may be interested in the :math:`L^2` norms of u and p, they can be
+We may be interested in the :math:`l^2` norms of u and p, they can be
 calculated and printed by writing
 
 .. code-block:: python
diff --git a/demo/documented/stokes-stabilized/common.txt b/demo/documented/stokes-stabilized/common.txt
deleted file mode 100644
index 1fea095..0000000
--- a/demo/documented/stokes-stabilized/common.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-
-This demo illustrates how to:
-
-* Solve the Stokes problem using a stabilized method
-
-The velocity :math:`u` and :math:`p` will look as follows:
-
-.. image:: ../plot_u.png
-
-.. image:: ../plot_p.png
-
-Equation and problem definition
--------------------------------
-
-Strong formulation of the problem:
-
-.. math::
-	- \nabla \cdot (\nabla u + p I) &= f \quad {\rm in} \ \Omega, \\
-                	\nabla \cdot u &= 0 \quad {\rm in} \ \Omega. \\
-
-.. note::
-	The sign of the pressure has been flipped from the classical
-	definition. This is done in order to have a symmetric (but not
-	positive-definite) system of equations rather than a
-	non-symmetric (but positive-definite) system of equations.
-
-A typical set of boundary conditions on the boundary :math:`\partial
-\Omega = \Gamma_{D} \cup \Gamma_{N}` can be:
-
-.. math::
-	u &= u_0 \quad {\rm on} \ \Gamma_{D}, \\
-	\nabla u \cdot n + p n &= g   \quad {\rm on} \ \Gamma_{N}. \\
-
-The Stokes equations can easily be formulated in a mixed variational
-form; that is, a form where the two variables, the velocity and the
-pressure, are approximated simultaneously. Using the abstract
-framework, we have the problem: find :math:`(u, p) \in W` such that
-
-.. math::
-	a((u, p), (v, q)) = L((v, q))
-
-for all :math:`(v, q) \in W`, where
-
-.. math::
-	a((u, p), (v, q))
-				&= \int_{\Omega} \nabla u \cdot \nabla v
-                 - \nabla \cdot v \ p
-                 + \nabla \cdot u \ q \, {\rm d} x, \\
-	L((v, q))
-				&= \int_{\Omega} f \cdot v \, {\rm d} x \, {\rm d} s. \\
-
-The space :math:`W` should be a mixed (product) function space:
-:math:`W = V \times Q` such that :math:`u \in V` and :math:`q \in
-Q`. In this demo we will use first order elements in both velocity and
-pressure, which will lead to stability problems. Therefore we use a
-stabilized variational formulation. It reads as follows: find
-:math:`(u, p) \in W` such that
-
-.. math::
-	a((u, p), (v, q)) = L((v, q))
-
-for all :math:`(v, q) \in W`, where
-
-.. math::
-	a((u, p), (v, q))
-				&= \int_{\Omega} \nabla u \cdot \nabla v
-                 - \nabla \cdot v \ p
-                 + \nabla \cdot u \ q
-                 + \delta \nabla q \cdot \nabla p \, {\rm d} x, \\
-	L((v, q))
-				&= \int_{\Omega} f \cdot v \, {\rm d} x
-    			+ \delta \nabla q \cdot f \, {\rm d} s.
-
-where :math:`\delta = \beta h^2` and :math:`\beta` is some number and :math:`h` is the mesh cell size.
-
-In this demo, we shall consider the following definitions of the input
-functions, the domain, and the boundaries:
-
-* :math:`(\Omega = [0,1]\times[0, 1]) \backslash {\rm dolphin}`
-* :math:`\Gamma_D =`
-* :math:`\Gamma_N =`
-* :math:`u_0 = (- \sin(\pi x_1), 0.0) \, {\rm for} \, x_0 = 1 \, {\rm and} \, u_0 = (0.0, 0.0)` otherwise
-* :math:`f = (0.0, 0.0)`
-* :math:`g = (0.0, 0.0)`
diff --git a/demo/documented/stokes-stabilized/cpp/CMakeLists.txt b/demo/documented/stokes-stabilized/cpp/CMakeLists.txt
deleted file mode 100644
index d6bb5d6..0000000
--- a/demo/documented/stokes-stabilized/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# This file is automatically generated by running
-#
-#     cmake/scripts/generate-cmakefiles
-#
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-set(PROJECT_NAME demo_stokes-stabilized)
-project(${PROJECT_NAME})
-
-# Set verbose output while testing CMake
-#set(CMAKE_VERBOSE_MAKEFILE 1)
-
-# Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
-
-# Get DOLFIN configuration data (DOLFINConfig.cmake must be in
-# DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
-endif()
-
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
-# Executable
-add_executable(${PROJECT_NAME} main.cpp)
-
-# Target libraries
-target_link_libraries(${PROJECT_NAME} ${DOLFIN_LIBRARIES})
diff --git a/demo/documented/stokes-stabilized/cpp/Stokes.h b/demo/documented/stokes-stabilized/cpp/Stokes.h
deleted file mode 100644
index cc5ecdf..0000000
--- a/demo/documented/stokes-stabilized/cpp/Stokes.h
+++ /dev/null
@@ -1,6299 +0,0 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
-//
-// This code was generated with the option '-l dolfin' and
-// contains DOLFIN-specific wrappers that depend on DOLFIN.
-// 
-// This code was generated with the following parameters:
-// 
-//   convert_exceptions_to_warnings: False
-//   cpp_optimize:                   True
-//   cpp_optimize_flags:             '-O2'
-//   epsilon:                        1e-14
-//   error_control:                  False
-//   form_postfix:                   True
-//   format:                         'dolfin'
-//   no_ferari:                      True
-//   optimize:                       True
-//   precision:                      15
-//   quadrature_degree:              'auto'
-//   quadrature_rule:                'auto'
-//   representation:                 'auto'
-//   restrict_keyword:               ''
-//   split:                          False
-
-#ifndef __STOKES_H
-#define __STOKES_H
-
-#include <cmath>
-#include <stdexcept>
-#include <fstream>
-#include <ufc.h>
-
-/// This class defines the interface for a finite element.
-
-class stokes_finite_element_0: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokes_finite_element_0() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_finite_element_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokes_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokes_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokes_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 6;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
-      {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 4:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 5:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[1];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[3];
-    vertex_values[3] = dof_values[4];
-    vertex_values[5] = dof_values[5];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_finite_element_0();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokes_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokes_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokes_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 9;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[6];
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 4:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 5:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 6:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 8:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[2];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[3];
-    vertex_values[4] = dof_values[4];
-    vertex_values[7] = dof_values[5];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[6];
-    vertex_values[5] = dof_values[7];
-    vertex_values[8] = dof_values[8];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_finite_element_1();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokes_finite_element_2();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class stokes_dofmap_0: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  stokes_dofmap_0() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_dofmap_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 3;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 2;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             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(std::size_t* dofs,
-                                   std::size_t 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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new stokes_dofmap_0();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class stokes_dofmap_1: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  stokes_dofmap_1() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_dofmap_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 2*num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 6;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 4;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 4;
-      dofs[3] = 5;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 5;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-      dofs[3] = 4;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 5;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 2;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new stokes_dofmap_1();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class stokes_dofmap_2: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  stokes_dofmap_2() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_dofmap_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 3*num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 9;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 6;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 4;
-      dofs[3] = 5;
-      dofs[4] = 7;
-      dofs[5] = 8;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 5;
-      dofs[4] = 6;
-      dofs[5] = 8;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 6;
-      dofs[5] = 7;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 3;
-        dofs[2] = 6;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 4;
-        dofs[2] = 7;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 5;
-        dofs[2] = 8;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 2;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_dofmap_1();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new stokes_dofmap_2();
-  }
-
-};
-
-/// 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_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  stokes_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute cell volume
-    const double volume = std::abs(detJ)/2.0;
-    
-    
-    // Compute circumradius of triangle in 2D
-    const double v1v2  = std::sqrt((vertex_coordinates[4] - vertex_coordinates[2])*(vertex_coordinates[4] - vertex_coordinates[2]) + (vertex_coordinates[5] - vertex_coordinates[3])*(vertex_coordinates[5] - vertex_coordinates[3]) );
-    const double v0v2  = std::sqrt(J[3]*J[3] + J[1]*J[1]);
-    const double v0v1  = std::sqrt(J[0]*J[0] + J[2]*J[2]);
-    const double circumradius = 0.25*(v1v2*v0v2*v0v1)/(volume);
-    
-    
-    // Array of quadrature weights.
-    static const double W1 = 0.5;
-    // Quadrature points on the UFC reference element: (0.333333333333333, 0.333333333333333)
-    
-    // Values of basis functions at quadrature points.
-    static const double FE0_C0[1][3] = \
-    {{0.333333333333333, 0.333333333333333, 0.333333333333333}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc12[3] = {6, 7, 8};
-    
-    static const double FE0_C0_D01[1][2] = \
-    {{-1.0, 1.0}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc7[2] = {0, 2};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc8[2] = {0, 1};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc10[2] = {3, 5};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc11[2] = {3, 4};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc13[2] = {6, 8};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc14[2] = {6, 7};
-    
-    // Reset values in the element tensor.
-    for (unsigned int r = 0; r < 81; r++)
-    {
-      A[r] = 0.0;
-    } // end loop over 'r'
-    // Number of operations to compute geometry constants: 55.
-    double G[14];
-    G[0] = W1*det*(K[2]*K[2] + K[3]*K[3]);
-    G[1] = W1*det*(K[0]*K[2] + K[1]*K[3]);
-    G[2] = W1*det*(K[0]*K[0] + K[1]*K[1]);
-    G[3] = 0.8*W1*circumradius*circumradius*det*(K[2]*K[2] + K[3]*K[3]);
-    G[4] = 0.8*W1*circumradius*circumradius*det*(K[0]*K[2] + K[1]*K[3]);
-    G[5] = 0.8*W1*circumradius*circumradius*det*(K[0]*K[0] + K[1]*K[1]);
-    G[6] =  - K[3]*W1*det;
-    G[7] =  - K[1]*W1*det;
-    G[8] =  - K[2]*W1*det;
-    G[9] =  - K[0]*W1*det;
-    G[10] = K[3]*W1*det;
-    G[11] = K[1]*W1*det;
-    G[12] = K[2]*W1*det;
-    G[13] = K[0]*W1*det;
-    
-    // Compute element tensor using UFL quadrature representation
-    // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
-    
-    // Loop quadrature points for integral.
-    // Number of operations to compute element tensor for following IP loop = 288
-    for (unsigned int ip = 0; ip < 1; ip++)
-    {
-      
-      // Number of operations for primary indices: 144
-      for (unsigned int j = 0; j < 2; j++)
-      {
-        for (unsigned int k = 0; k < 2; k++)
-        {
-          // Number of operations to compute entry: 3
-          A[nzc10[j]*9 + nzc10[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[0];
-          // Number of operations to compute entry: 3
-          A[nzc10[j]*9 + nzc11[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[1];
-          // Number of operations to compute entry: 3
-          A[nzc11[j]*9 + nzc10[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[1];
-          // Number of operations to compute entry: 3
-          A[nzc11[j]*9 + nzc11[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[2];
-          // Number of operations to compute entry: 3
-          A[nzc13[j]*9 + nzc13[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[3];
-          // Number of operations to compute entry: 3
-          A[nzc13[j]*9 + nzc14[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[4];
-          // Number of operations to compute entry: 3
-          A[nzc14[j]*9 + nzc13[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[4];
-          // Number of operations to compute entry: 3
-          A[nzc14[j]*9 + nzc14[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[5];
-          // Number of operations to compute entry: 3
-          A[nzc7[j]*9 + nzc7[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[0];
-          // Number of operations to compute entry: 3
-          A[nzc7[j]*9 + nzc8[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[1];
-          // Number of operations to compute entry: 3
-          A[nzc8[j]*9 + nzc7[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[1];
-          // Number of operations to compute entry: 3
-          A[nzc8[j]*9 + nzc8[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[2];
-        } // end loop over 'k'
-      } // end loop over 'j'
-      
-      // Number of operations for primary indices: 72
-      for (unsigned int j = 0; j < 2; j++)
-      {
-        for (unsigned int k = 0; k < 3; k++)
-        {
-          // Number of operations to compute entry: 3
-          A[nzc10[j]*9 + nzc12[k]] += FE0_C0[0][k]*FE0_C0_D01[0][j]*G[6];
-          // Number of operations to compute entry: 3
-          A[nzc11[j]*9 + nzc12[k]] += FE0_C0[0][k]*FE0_C0_D01[0][j]*G[7];
-          // Number of operations to compute entry: 3
-          A[nzc7[j]*9 + nzc12[k]] += FE0_C0[0][k]*FE0_C0_D01[0][j]*G[8];
-          // Number of operations to compute entry: 3
-          A[nzc8[j]*9 + nzc12[k]] += FE0_C0[0][k]*FE0_C0_D01[0][j]*G[9];
-        } // end loop over 'k'
-      } // end loop over 'j'
-      
-      // Number of operations for primary indices: 72
-      for (unsigned int j = 0; j < 3; j++)
-      {
-        for (unsigned int k = 0; k < 2; k++)
-        {
-          // Number of operations to compute entry: 3
-          A[nzc12[j]*9 + nzc10[k]] += FE0_C0[0][j]*FE0_C0_D01[0][k]*G[10];
-          // Number of operations to compute entry: 3
-          A[nzc12[j]*9 + nzc11[k]] += FE0_C0[0][j]*FE0_C0_D01[0][k]*G[11];
-          // Number of operations to compute entry: 3
-          A[nzc12[j]*9 + nzc7[k]] += FE0_C0[0][j]*FE0_C0_D01[0][k]*G[12];
-          // Number of operations to compute entry: 3
-          A[nzc12[j]*9 + nzc8[k]] += FE0_C0[0][j]*FE0_C0_D01[0][k]*G[13];
-        } // 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_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  stokes_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute cell volume
-    const double volume = std::abs(detJ)/2.0;
-    
-    
-    // Compute circumradius of triangle in 2D
-    const double v1v2  = std::sqrt((vertex_coordinates[4] - vertex_coordinates[2])*(vertex_coordinates[4] - vertex_coordinates[2]) + (vertex_coordinates[5] - vertex_coordinates[3])*(vertex_coordinates[5] - vertex_coordinates[3]) );
-    const double v0v2  = std::sqrt(J[3]*J[3] + J[1]*J[1]);
-    const double v0v1  = std::sqrt(J[0]*J[0] + J[2]*J[2]);
-    const double circumradius = 0.25*(v1v2*v0v2*v0v1)/(volume);
-    
-    
-    // Array of quadrature weights.
-    static const double W3[3] = {0.166666666666667, 0.166666666666667, 0.166666666666667};
-    // Quadrature points on the UFC reference element: (0.166666666666667, 0.166666666666667), (0.166666666666667, 0.666666666666667), (0.666666666666667, 0.166666666666667)
-    
-    // Values of basis functions at quadrature points.
-    static const double FE0_C0[3][3] = \
-    {{0.666666666666667, 0.166666666666667, 0.166666666666667},
-    {0.166666666666667, 0.166666666666667, 0.666666666666667},
-    {0.166666666666667, 0.666666666666667, 0.166666666666667}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc0[3] = {0, 1, 2};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc3[3] = {3, 4, 5};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc6[3] = {0, 1, 2};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc9[3] = {3, 4, 5};
-    
-    static const double FE0_C0_D01[3][2] = \
-    {{-1.0, 1.0},
-    {-1.0, 1.0},
-    {-1.0, 1.0}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc13[2] = {6, 8};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc14[2] = {6, 7};
-    
-    // Reset values in the element tensor.
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      A[r] = 0.0;
-    } // end loop over 'r'
-    // Number of operations to compute geometry constants: 16.
-    double G[4];
-    G[0] = 0.8*K[2]*circumradius*circumradius*det;
-    G[1] = 0.8*K[3]*circumradius*circumradius*det;
-    G[2] = 0.8*K[0]*circumradius*circumradius*det;
-    G[3] = 0.8*K[1]*circumradius*circumradius*det;
-    
-    // Compute element tensor using UFL quadrature representation
-    // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
-    
-    // Loop quadrature points for integral.
-    // Number of operations to compute element tensor for following IP loop = 132
-    for (unsigned int ip = 0; ip < 3; ip++)
-    {
-      
-      // Coefficient declarations.
-      double F0 = 0.0;
-      double F1 = 0.0;
-      
-      // Total number of operations to compute function values = 12
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        F0 += FE0_C0[ip][r]*w[0][nzc0[r]];
-        F1 += FE0_C0[ip][r]*w[0][nzc3[r]];
-      } // end loop over 'r'
-      
-      // Number of operations to compute ip constants: 12
-      double I[4];
-      // Number of operations: 4
-      I[0] = W3[ip]*(F0*G[0] + F1*G[1]);
-      
-      // Number of operations: 4
-      I[1] = W3[ip]*(F0*G[2] + F1*G[3]);
-      
-      // Number of operations: 2
-      I[2] = F0*W3[ip]*det;
-      
-      // Number of operations: 2
-      I[3] = F1*W3[ip]*det;
-      
-      
-      // Number of operations for primary indices: 8
-      for (unsigned int j = 0; j < 2; j++)
-      {
-        // Number of operations to compute entry: 2
-        A[nzc13[j]] += FE0_C0_D01[ip][j]*I[0];
-        // Number of operations to compute entry: 2
-        A[nzc14[j]] += FE0_C0_D01[ip][j]*I[1];
-      } // end loop over 'j'
-      
-      // Number of operations for primary indices: 12
-      for (unsigned int j = 0; j < 3; j++)
-      {
-        // Number of operations to compute entry: 2
-        A[nzc6[j]] += FE0_C0[ip][j]*I[2];
-        // Number of operations to compute entry: 2
-        A[nzc9[j]] += FE0_C0[ip][j]*I[3];
-      } // end loop over 'j'
-    } // end loop over 'ip'
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class stokes_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  stokes_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "7f9591d8bb1ba1cad4fc8adc29656ceb0f322055b1699e9fdb7712e5846edc10bc8e382207d7cf1ac42d8753f086e90ab4920c2e0ac6451eafd63e2dbf951899";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 0;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_finite_element_2();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_finite_element_2();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_dofmap_2();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_dofmap_2();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 0;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new stokes_cell_integral_0_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class stokes_form_1: public ufc::form
-{
-public:
-
-  /// Constructor
-  stokes_form_1() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_form_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "e07cbcc92d3eb0b1538b488ca04f830e5adca241f7326f82acf57aff83b2022487969f2b3cb4812eb0b6768483748b2a6e39aa0290a0a12dcbb5038fdc094de4";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 1;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 1;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({0});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_finite_element_2();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_finite_element_1();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_dofmap_2();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_dofmap_1();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 0;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new stokes_cell_integral_1_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-// DOLFIN wrappers
-
-// Standard library includes
-#include <string>
-
-// DOLFIN includes
-#include <dolfin/common/NoDeleter.h>
-#include <dolfin/fem/FiniteElement.h>
-#include <dolfin/fem/DofMap.h>
-#include <dolfin/fem/Form.h>
-#include <dolfin/function/FunctionSpace.h>
-#include <dolfin/function/GenericFunction.h>
-#include <dolfin/function/CoefficientAssigner.h>
-#include <dolfin/adaptivity/ErrorControl.h>
-#include <dolfin/adaptivity/GoalFunctional.h>
-
-namespace Stokes
-{
-
-class CoefficientSpace_f: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 0)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_0());
-  }
-
-  // Destructor
-  ~Form_a()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "There are no coefficients");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "There are no coefficients");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_a_FunctionSpace_0 TestSpace;
-  typedef Form_a_FunctionSpace_1 TrialSpace;
-
-  // Coefficients
-};
-
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_2()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-typedef CoefficientSpace_f Form_L_FunctionSpace_1;
-
-class Form_L: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
-  }
-
-  // Constructor
-  Form_L(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 = std::shared_ptr<const ufc::form>(new stokes_form_1());
-  }
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::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 = std::shared_ptr<const ufc::form>(new stokes_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
-  }
-
-  // Constructor
-  Form_L(std::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 = std::shared_ptr<const ufc::form>(new stokes_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    this->f = *f;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
-  }
-
-  // Destructor
-  ~Form_L()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-    if (name == "f")
-      return 0;
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      return "f";
-    }
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_L_FunctionSpace_0 TestSpace;
-  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
-
-  // Coefficients
-  dolfin::CoefficientAssigner f;
-};
-
-// Class typedefs
-typedef Form_a BilinearForm;
-typedef Form_a JacobianForm;
-typedef Form_L LinearForm;
-typedef Form_L ResidualForm;
-typedef Form_a::TestSpace FunctionSpace;
-
-}
-
-#endif
diff --git a/demo/documented/stokes-stabilized/cpp/Stokes.ufl b/demo/documented/stokes-stabilized/cpp/Stokes.ufl
deleted file mode 100644
index e4622ed..0000000
--- a/demo/documented/stokes-stabilized/cpp/Stokes.ufl
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (c) 2005-2007 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2011-03-09
-#
-# The bilinear form a(u, v) and Linear form L(v) for the Stokes
-# equations using a mixed formulation (equal-order stabilized).
-#
-# Compile this form with FFC: ffc -l dolfin Stokes.ufl
-
-vector   = VectorElement("Lagrange", triangle, 1)
-scalar   = FiniteElement("Lagrange", triangle, 1)
-system = vector * scalar
-
-(v, q) = TestFunctions(system)
-(u, p) = TrialFunctions(system)
-
-f = Coefficient(vector)
-h = 2.0*Circumradius(triangle)
-
-beta  = 0.2
-delta = beta*h*h
-
-a = (inner(grad(u), grad(v)) - div(v)*p + div(u)*q + delta*dot(grad(p), grad(q)))*dx
-L = dot(f, v + delta*grad(q))*dx
diff --git a/demo/documented/stokes-stabilized/cpp/compile.log b/demo/documented/stokes-stabilized/cpp/compile.log
deleted file mode 100644
index d64120f..0000000
--- a/demo/documented/stokes-stabilized/cpp/compile.log
+++ /dev/null
@@ -1,953 +0,0 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
-
-Compiling form Stokes
-
-Compiler stage 1: Analyzing form(s)
------------------------------------
-  
-  Geometric dimension:       2
-  Number of cell subdomains: 0
-  Rank:                      2
-  Arguments:                 '(v_0, v_1)'
-  Number of coefficients:    0
-  Coefficients:              '[]'
-  Unique elements:           'Mixed<Vector<2 x CG1(?)>, CG1(?)>'
-  Unique sub elements:       'Mixed<Vector<2 x CG1(?)>, CG1(?)>, Vector<2 x CG1(?)>,
-                              CG1(?)'
-  
-  Extracting monomial form representation from UFL form
-  Monomial extraction failed: No handler defined for terminal Circumradius.
-  Estimated cost of tensor representation: -1
-  representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 1
-  quadrature_degree: auto --> 1
-  quadrature_rule:   auto --> default
-  
-  Geometric dimension:       2
-  Number of cell subdomains: 0
-  Rank:                      1
-  Arguments:                 '(v_0)'
-  Number of coefficients:    1
-  Coefficients:              '[w_0]'
-  Unique elements:           'Mixed<Vector<2 x CG1(?)>, CG1(?)>, Vector<2 x CG1(?)>'
-  Unique sub elements:       'Mixed<Vector<2 x CG1(?)>, CG1(?)>, Vector<2 x CG1(?)>,
-                              CG1(?)'
-  
-  Extracting monomial form representation from UFL form
-  Monomial extraction failed: No handler defined for terminal Circumradius.
-  Estimated cost of tensor representation: -1
-  representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
-  quadrature_rule:   auto --> default
-  
-Compiler stage 1 finished in 0.038784 seconds.
-
-Compiler stage 2: Computing intermediate representation
--------------------------------------------------------
-  Computing representation of 3 elements
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing representation of 3 dofmaps
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing representation of integrals
-  Computing quadrature representation
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  
-  QG-utils, psi_tables:
-  {1: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
-          [  0.00000000e+00]],
-  
-         [[  8.88178420e-16],
-          [  0.00000000e+00]],
-  
-         [[  1.00000000e+00],
-          [  0.00000000e+00]],
-  
-         [[  0.00000000e+00],
-          [ -1.00000000e+00]],
-  
-         [[  0.00000000e+00],
-          [  8.88178420e-16]],
-  
-         [[  0.00000000e+00],
-          [  1.00000000e+00]]]), (1, 0): array([[[-1.],
-          [ 0.]],
-  
-         [[ 1.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [-1.]],
-  
-         [[ 0.],
-          [ 1.]],
-  
-         [[ 0.],
-          [ 0.]]]), (0, 0): array([[[ 0.33333333],
-          [ 0.        ]],
-  
-         [[ 0.33333333],
-          [ 0.        ]],
-  
-         [[ 0.33333333],
-          [ 0.        ]],
-  
-         [[ 0.        ],
-          [ 0.33333333]],
-  
-         [[ 0.        ],
-          [ 0.33333333]],
-  
-         [[ 0.        ],
-          [ 0.33333333]]])}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
-          [  0.00000000e+00],
-          [  0.00000000e+00]],
-  
-         [[  8.88178420e-16],
-          [  0.00000000e+00],
-          [  0.00000000e+00]],
-  
-         [[  1.00000000e+00],
-          [  0.00000000e+00],
-          [  0.00000000e+00]],
-  
-         [[  0.00000000e+00],
-          [ -1.00000000e+00],
-          [  0.00000000e+00]],
-  
-         [[  0.00000000e+00],
-          [  8.88178420e-16],
-          [  0.00000000e+00]],
-  
-         [[  0.00000000e+00],
-          [  1.00000000e+00],
-          [  0.00000000e+00]],
-  
-         [[  0.00000000e+00],
-          [  0.00000000e+00],
-          [ -1.00000000e+00]],
-  
-         [[  0.00000000e+00],
-          [  0.00000000e+00],
-          [  8.88178420e-16]],
-  
-         [[  0.00000000e+00],
-          [  0.00000000e+00],
-          [  1.00000000e+00]]]), (1, 0): array([[[-1.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 1.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [-1.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 1.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [-1.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 1.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.]]]), (0, 0): array([[[ 0.33333333],
-          [ 0.        ],
-          [ 0.        ]],
-  
-         [[ 0.33333333],
-          [ 0.        ],
-          [ 0.        ]],
-  
-         [[ 0.33333333],
-          [ 0.        ],
-          [ 0.        ]],
-  
-         [[ 0.        ],
-          [ 0.33333333],
-          [ 0.        ]],
-  
-         [[ 0.        ],
-          [ 0.33333333],
-          [ 0.        ]],
-  
-         [[ 0.        ],
-          [ 0.33333333],
-          [ 0.        ]],
-  
-         [[ 0.        ],
-          [ 0.        ],
-          [ 0.33333333]],
-  
-         [[ 0.        ],
-          [ 0.        ],
-          [ 0.33333333]],
-  
-         [[ 0.        ],
-          [ 0.        ],
-          [ 0.33333333]]])}}}}}
-  
-  QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.33333333,  0.33333333,  0.33333333]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ]])}
-  
-  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.33333333,  0.33333333,  0.33333333]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ]])}
-  
-  name_map: {}
-  
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C1_D10': 'FE1_C1_D10', 'FE1_C2_D10': 'FE1_C2_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE1_C2_D01': 'FE1_C2_D01', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE0_C0_D01': array([[-1.,  1.]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333]])}
-  
-  QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE1_C0': ('FE0_C0', (6, [0, 1, 2]), False, False), 'FE1_C1': ('FE0_C0', (9, [3, 4, 5]), False, False), 'FE1_C2': ('FE0_C0', (12, [6, 7, 8]), False, False), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE1_C1_D10': ('FE0_C0_D01', (11, [3, 4]), False, False), 'FE1_C2_D10': ('FE0_C0_D01', (14, [6, 7]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2]), Fal [...]
-  Transforming cell integral
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing quadrature representation
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  
-  QG-utils, psi_tables:
-  {3: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [-1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 1.,  1.,  1.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]]]), (0, 0): array([[[ 0.66666667,  0.16666667,  0.16666667],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.16666667,  0.16666667,  0.66666667],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.16666667,  0.66666667,  0.16666667],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.66666667,  0.16666667,  0.16666667]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.16666667,  0.66666667]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1.],
-          [ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.],
-          [ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [-1., -1., -1.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 1.,  1.,  1.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.],
-          [-1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.],
-          [ 1.,  1.,  1.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]]]), (0, 0): array([[[ 0.66666667,  0.16666667,  0.16666667],
-          [ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.16666667,  0.16666667,  0.66666667],
-          [ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.16666667,  0.66666667,  0.16666667],
-          [ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.66666667,  0.16666667,  0.16666667],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.16666667,  0.66666667],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667],
-          [ 0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ],
-          [ 0.66666667,  0.16666667,  0.16666667]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.16666667,  0.66666667]],
-  
-         [[ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667]]])}}}}}
-  
-  QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
-           0.16666667,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
-           0.66666667,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
-           0.16666667,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.66666667,  0.16666667,  0.16666667],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.16666667,  0.16666667,  0.66666667],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.16666667,  0.66666667,  0.16666667]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
-           0.16666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
-           0.66666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
-           0.16666667]]), 'FE0_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
-           0.        ]])}
-  
-  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
-           0.16666667,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
-           0.66666667,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
-           0.16666667,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.66666667,  0.16666667,  0.16666667],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.16666667,  0.16666667,  0.66666667],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.16666667,  0.66666667,  0.16666667]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
-           0.16666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
-           0.66666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
-           0.16666667]]), 'FE0_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
-           0.        ]])}
-  
-  name_map: {}
-  
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C1_D10': 'FE1_C1_D10', 'FE1_C2_D10': 'FE1_C2_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE1_C2_D01': 'FE1_C2_D01', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE0_C0': array([[ 0.66666667,  0.16666667,  0.16666667],
-         [ 0.16666667,  0.16666667,  0.66666667],
-         [ 0.16666667,  0.66666667,  0.16666667]])}
-  
-  QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE1_C0': ('FE0_C0', (6, [0, 1, 2]), False, False), 'FE1_C1': ('FE0_C0', (9, [3, 4, 5]), False, False), 'FE1_C2': ('FE0_C0', (12, [6, 7, 8]), False, False), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE1_C1_D10': ('FE0_C0_D01', (11, [3, 4]), False, False), 'FE1_C2_D10': ('FE0_C0_D01', (14, [6, 7]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2]), Fal [...]
-  Transforming cell integral
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing representation of forms
-  
-Compiler stage 2 finished in 0.113666 seconds.
-
-Compiler stage 3: Optimizing intermediate representation
---------------------------------------------------------
-  Optimising expressions for cell integral
-  Optimising expressions for cell integral
-  
-Compiler stage 3 finished in 0.00400376 seconds.
-
-Compiler stage 4: Generating code
----------------------------------
-  Generating code for 3 element(s)
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 3 dofmap(s)
-  Generating code for integrals
-  Generating code for forms
-  
-Compiler stage 4 finished in 0.176235 seconds.
-
-Compiler stage 4.1: Generating additional wrapper code
-------------------------------------------------------
-  Generating wrapper code for DOLFIN
-  
-Compiler stage 4.1 finished in 0.000555992 seconds.
-
-Compiler stage 5: Formatting code
----------------------------------
-  
-Output written to ./Stokes.h.
-Compiler stage 5 finished in 0.000813961 seconds.
-
-FFC finished in 0.334401 seconds.
diff --git a/demo/documented/stokes-stabilized/cpp/documentation.rst b/demo/documented/stokes-stabilized/cpp/documentation.rst
deleted file mode 100644
index d2a8a2f..0000000
--- a/demo/documented/stokes-stabilized/cpp/documentation.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-.. Documentation for the stokes stabilized demo from DOLFIN.
-
-.. _demo_pde_stokes-stabilized_cpp_documentation:
-
-There is as yet no documentation for the C++ version of this demo.
-Please consider contributing the missing documentation.
diff --git a/demo/documented/stokes-stabilized/cpp/main.cpp b/demo/documented/stokes-stabilized/cpp/main.cpp
deleted file mode 100644
index 2980192..0000000
--- a/demo/documented/stokes-stabilized/cpp/main.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (C) 2006-2008 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2006-02-09
-// Last changed: 2013-03-21
-//
-// This demo solves the Stokes equations, using stabilized
-// first order elements for the velocity and pressure. The
-// sub domains for the different boundary conditions used
-// in this simulation are computed by the demo program in
-// src/demo/mesh/subdomains.
-
-#include <dolfin.h>
-#include "Stokes.h"
-
-using namespace dolfin;
-
-int main()
-{
-  // Function for no-slip boundary condition for velocity
-  class Noslip : public Expression
-  {
-  public:
-
-    Noslip() : Expression(2) {}
-
-    void eval(Array<double>& values, const Array<double>& x) const
-    {
-      values[0] = 0.0;
-      values[1] = 0.0;
-    }
-
-  };
-
-  // Function for inflow boundary condition for velocity
-  class Inflow : public Expression
-  {
-  public:
-
-    Inflow() : Expression(2) {}
-
-    void eval(Array<double>& values, const Array<double>& x) const
-    {
-      values[0] = -sin(x[1]*DOLFIN_PI);
-      values[1] = 0.0;
-    }
-
-  };
-
-  // Read mesh and sub domain markers
-  Mesh mesh("../dolfin_fine.xml.gz");
-  MeshFunction<std::size_t> sub_domains(mesh, "../dolfin_fine_subdomains.xml.gz");
-
-  // Create function space and subspaces
-  Stokes::FunctionSpace W(mesh);
-  SubSpace W0(W, 0);
-  SubSpace W1(W, 1);
-
-  // Create functions for boundary conditions
-  Noslip noslip;
-  Inflow inflow;
-  Constant zero(0.0);
-
-  // No-slip boundary condition for velocity
-  DirichletBC bc0(W0, noslip, sub_domains, 0);
-
-  // Inflow boundary condition for velocity
-  DirichletBC bc1(W0, inflow, sub_domains, 1);
-
-  // Collect boundary conditions
-  std::vector<const DirichletBC*> bcs = {{&bc0, &bc1}};
-
-  // Define variational problem
-  Constant f(0.0, 0.0);
-  Stokes::BilinearForm a(W, W);
-  Stokes::LinearForm L(W);
-  L.f = f;
-  Function w(W);
-  LinearVariationalProblem problem(a, L, w, bcs);
-
-  // Compute solution
-  LinearVariationalSolver solver(problem);
-  solver.parameters["linear_solver"] = "direct";
-  solver.solve();
-
-  // Extract subfunctions
-  Function u = w[0];
-  Function p = w[1];
-
-  // Save solution in VTK format
-  File ufile_pvd("velocity.pvd");
-  ufile_pvd << u;
-  File pfile_pvd("pressure.pvd");
-  pfile_pvd << p;
-
-  // Plot solution
-  plot(u);
-  plot(p);
-  interactive();
-
-  return 0;
-}
diff --git a/demo/documented/stokes-stabilized/cpp/plot.py b/demo/documented/stokes-stabilized/cpp/plot.py
deleted file mode 100644
index c5efa01..0000000
--- a/demo/documented/stokes-stabilized/cpp/plot.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from dolfin import *
-
-# Plot velocity
-u = Function("velocity.xml")
-plot(u)
-
-# Plot pressure
-p = Function("pressure.xml")
-plot(p)
diff --git a/demo/documented/stokes-stabilized/dolfin_fine.xml.gz b/demo/documented/stokes-stabilized/dolfin_fine.xml.gz
deleted file mode 100644
index 6f071e4..0000000
Binary files a/demo/documented/stokes-stabilized/dolfin_fine.xml.gz and /dev/null differ
diff --git a/demo/documented/stokes-stabilized/dolfin_fine_subdomains.xml.gz b/demo/documented/stokes-stabilized/dolfin_fine_subdomains.xml.gz
deleted file mode 100644
index 2a350b8..0000000
Binary files a/demo/documented/stokes-stabilized/dolfin_fine_subdomains.xml.gz and /dev/null differ
diff --git a/demo/documented/stokes-stabilized/plot_p.png b/demo/documented/stokes-stabilized/plot_p.png
deleted file mode 100644
index 0a5ad4e..0000000
Binary files a/demo/documented/stokes-stabilized/plot_p.png and /dev/null differ
diff --git a/demo/documented/stokes-stabilized/plot_u.png b/demo/documented/stokes-stabilized/plot_u.png
deleted file mode 100644
index 0657890..0000000
Binary files a/demo/documented/stokes-stabilized/plot_u.png and /dev/null differ
diff --git a/demo/documented/stokes-stabilized/python/demo_stokes-stabilized.py b/demo/documented/stokes-stabilized/python/demo_stokes-stabilized.py
deleted file mode 100644
index 1b04e58..0000000
--- a/demo/documented/stokes-stabilized/python/demo_stokes-stabilized.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# This demo solves the Stokes equations, using stabilized
-# first order elements for the velocity and pressure. The
-# sub domains for the different boundary conditions used
-# in this simulation are computed by the demo program in
-# src/demo/mesh/subdomains.
-#
-# Original implementation: ../cpp/main.cpp by Anders Logg
-
-# Copyright (C) 2007 Kristian B. Oelgaard
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# Modified by Anders Logg, 2009.
-#
-# First added:  2007-11-15
-# Last changed: 2009-11-26
-# Begin demo
-
-from dolfin import *
-
-# Load mesh and subdomains
-mesh = Mesh("../dolfin_fine.xml.gz")
-sub_domains = MeshFunction("size_t", mesh, "../dolfin_fine_subdomains.xml.gz");
-
-# Define function spaces
-scalar = FunctionSpace(mesh, "CG", 1)
-vector = VectorFunctionSpace(mesh, "CG", 1)
-system = vector * scalar
-
-# Create functions for boundary conditions
-noslip = Constant((0, 0))
-inflow = Expression(("-sin(x[1]*pi)", "0"))
-zero   = Constant(0)
-
-# No-slip boundary condition for velocity
-bc0 = DirichletBC(system.sub(0), noslip, sub_domains, 0)
-
-# Inflow boundary condition for velocity
-bc1 = DirichletBC(system.sub(0), inflow, sub_domains, 1)
-
-# Collect boundary conditions
-bcs = [bc0, bc1]
-
-# Define variational problem
-(v, q) = TestFunctions(system)
-(u, p) = TrialFunctions(system)
-f = Constant((0, 0))
-h = CellSize(mesh)
-beta  = 0.2
-delta = beta*h*h
-a = (inner(grad(v), grad(u)) - div(v)*p + q*div(u) + \
-    delta*inner(grad(q), grad(p)))*dx
-L = inner(v + delta*grad(q), f)*dx
-
-# Compute solution
-w = Function(system)
-solve(a == L, w, bcs)
-u, p = w.split()
-
-# Save solution in VTK format
-ufile_pvd = File("velocity.pvd")
-ufile_pvd << u
-pfile_pvd = File("pressure.pvd")
-pfile_pvd << p
-
-# Plot solution
-plot(u)
-plot(p)
-interactive()
diff --git a/demo/documented/stokes-stabilized/python/documentation.rst b/demo/documented/stokes-stabilized/python/documentation.rst
deleted file mode 100644
index f8428ac..0000000
--- a/demo/documented/stokes-stabilized/python/documentation.rst
+++ /dev/null
@@ -1,133 +0,0 @@
-.. Documentation for the stokes stabilized demo from DOLFIN.
-
-.. _demo_pde_stokes-stabilized_python_documentation:
-
-Stokes equations with stabilized first order elements
-=====================================================
-
-.. include:: ../common.txt
-
-Implementation
---------------
-First, the :py:mod:`dolfin` module is imported:
-
-.. code-block:: python
-
-	from dolfin import *
-
-In this example, different boundary conditions are prescribed on
-different parts of the boundaries. This information must be made
-available to the solver. One way of doing this, is to tag the
-different sub-regions with different (integer) labels. DOLFIN provides
-a class :py:class:`MeshFunction <dolfin.cpp.mesh.MeshFunction>` which
-is useful for these types of operations: instances of this class
-represent functions over mesh entities (such as over cells or over
-facets). Mesh and mesh functions can be read from file in the
-following way:
-
-.. code-block:: python
-
-	# Load mesh and subdomains
-	mesh = Mesh("dolfin_fine.xml.gz")
-	sub_domains = MeshFunction("size_t", mesh, "dolfin_fine_subdomains.xml.gz")
-
-Next, we define a :py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>` composed of a
-:py:class:`VectorFunctionSpace
-<dolfin.functions.functionspace.VectorFunctionSpace>` and a
-:py:class:`FunctionSpace <dolfin.cpp.function.FunctionSpace>`, both of
-continuous piecewise linears.
-
-.. code-block:: python
-
-	# Define function spaces
-	scalar = FunctionSpace(mesh, "CG", 1)
-	vector = VectorFunctionSpace(mesh, "CG", 1)
-	system = vector * scalar
-
-Now that we have our mixed function space and marked subdomains
-defining the boundaries, we create functions for the boundary
-conditions and define boundary conditions:
-
-.. code-block:: python
-
-	# Create functions for boundary conditions
-	noslip = Constant((0, 0))
-	inflow = Expression(("-sin(x[1]*pi)", "0"))
-	zero   = Constant(0)
-
-	# No-slip boundary condition for velocity
-	bc0 = DirichletBC(system.sub(0), noslip, sub_domains, 0)
-
-	# Inflow boundary condition for velocity
-	bc1 = DirichletBC(system.sub(0), inflow, sub_domains, 1)
-
-	# Collect boundary conditions
-	bcs = [bc0, bc1]
-
-Here, we have given four arguments to :py:class:`DirichletBC
-<dolfin.cpp.fem.DirichletBC>`. The first specifies the
-:py:class:`FunctionSpace <dolfin.cpp.function.FunctionSpace>`. Since
-we have a :py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>`, we write
-system.sub(0) for the :py:class:`VectorFunctionSpace
-<dolfin.functions.functionspace.VectorFunctionSpace>`, and
-system.sub(1) for the :py:class:`FunctionSpace
-<dolfin.cpp.function.FunctionSpace>`. The second argument specifies
-the value on the Dirichlet boundary. The two last arguments specify the
-marking of the subdomains; sub_domains contains the subdomain markers
-and the number given as the last argument is the subdomain index.
-
-The bilinear and linear forms corresponding to the stabilized weak
-mixed formulation of the Stokes equations are defined as follows:
-
-.. code-block:: python
-
-	# Define variational problem
-	(v, q) = TestFunctions(system)
-	(u, p) = TrialFunctions(system)
-	f = Constant((0, 0))
-	h = CellSize(mesh)
-	beta  = 0.2
-	delta = beta*h*h
-	a = (inner(grad(v), grad(u)) - div(v)*p + q*div(u) + \
-	    delta*inner(grad(q), grad(p)))*dx
-	L = inner(v + delta*grad(q), f)*dx
-
-To compute the solution we use the bilinear and linear forms, and the
-boundary condition, but we also need to create a :py:class:`Function
-<dolfin.cpp.function.Function>` to store the solution(s). The (full)
-solution will be stored in ``w``, which we initialize using the
-MixedFunctionSpace system. The actual computation is performed by
-calling solve with the arguments ``a``, ``L`` and ``bcs``. The
-separate components ``u`` and ``p`` of the solution can be extracted
-by calling the :py:meth:`split
-<dolfin.functions.function.Function.split>` function.
-
-.. code-block:: python
-
-	# Compute solution
-	w = Function(system)
-	solve(a == L, w, bcs)
-	u, p = w.split()
-
-Finally, we can store to file and plot the solutions.
-
-.. code-block:: python
-
-	# Save solution in VTK format
-	ufile_pvd = File("velocity.pvd")
-	ufile_pvd << u
-	pfile_pvd = File("pressure.pvd")
-	pfile_pvd << p
-
-	# Plot solution
-	plot(u)
-	plot(p)
-	interactive()
-
-Complete code
--------------
-
-.. literalinclude:: demo_stokes-stabilized.py
-	:start-after: # Begin demo
diff --git a/demo/documented/stokes-taylor-hood/cpp/CMakeLists.txt b/demo/documented/stokes-taylor-hood/cpp/CMakeLists.txt
index f82bb73..955dac0 100644
--- a/demo/documented/stokes-taylor-hood/cpp/CMakeLists.txt
+++ b/demo/documented/stokes-taylor-hood/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/stokes-taylor-hood/cpp/Stokes.h b/demo/documented/stokes-taylor-hood/cpp/Stokes.h
index 5af5d73..ed6f3da 100644
--- a/demo/documented/stokes-taylor-hood/cpp/Stokes.h
+++ b/demo/documented/stokes-taylor-hood/cpp/Stokes.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __STOKES_H
 #define __STOKES_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class stokes_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stokes_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_finite_element_0()
+  ~stokes_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,33 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -159,33 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -195,141 +192,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -339,48 +220,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -459,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -481,81 +358,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -570,9 +427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -582,11 +439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -596,11 +453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -609,9 +466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -632,81 +489,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -721,9 +558,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -733,11 +570,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -747,11 +584,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -760,9 +597,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -783,81 +620,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -872,9 +689,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -884,11 +701,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -898,11 +715,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -911,9 +728,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -930,42 +747,2605 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_0();
+  }
+
+};
+
+
+class stokes_finite_element_1: public ufc::finite_element
+{
+public:
+
+  stokes_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokes_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_1();
+  }
+
+};
+
+
+class stokes_finite_element_2: public ufc::finite_element
+{
+public:
+
+  stokes_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokes_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[6][6] = \
@@ -973,7 +3353,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1124,7 +3504,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +3655,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1387,28 +3767,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1444,7 +3822,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1452,558 +3830,292 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokes_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokes_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokes_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 12;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 2:
+    case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 3:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 4:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 5:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_2();
+  }
+
+};
+
+
+class stokes_finite_element_3: public ufc::finite_element
+{
+public:
+
+  stokes_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokes_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        return 2;
         break;
       }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        return 2;
         break;
       }
-    case 8:
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -2030,16 +4142,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 1:
       {
         
       // Array of basisvalues
@@ -2066,16 +4178,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 2:
       {
         
       // Array of basisvalues
@@ -2102,16 +4214,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 3:
       {
         
       // Array of basisvalues
@@ -2136,163 +4248,18 @@ public:
       basisvalues[4] *= std::sqrt(4.5);
       basisvalues[3] *= std::sqrt(7.5);
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
-      {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 4:
       {
         
       // Array of basisvalues
@@ -2319,131 +4286,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 5:
       {
         
       // Array of basisvalues
@@ -2466,135 +4318,20 @@ public:
       basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 6:
       {
         
       // Array of basisvalues
@@ -2621,131 +4358,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 7:
       {
         
       // Array of basisvalues
@@ -2768,135 +4390,20 @@ public:
       basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 8:
       {
         
       // Array of basisvalues
@@ -2923,131 +4430,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 9:
       {
         
       // Array of basisvalues
@@ -3074,131 +4466,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 10:
       {
         
       // Array of basisvalues
@@ -3225,131 +4502,193 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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--)
         {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
+          if (combinations[row][col] + 1 > 1)
+            combinations[row][col] = 0;
+          else
           {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
+            combinations[row][col] += 1;
+            break;
           }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
-    case 7:
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -3376,7 +4715,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3392,7 +4731,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3495,12 +4834,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 1:
       {
         
       // Array of basisvalues
@@ -3527,7 +4866,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3543,7 +4882,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3646,12 +4985,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 2:
       {
         
       // Array of basisvalues
@@ -3678,7 +5017,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3694,7 +5033,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3797,12 +5136,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 3:
       {
         
       // Array of basisvalues
@@ -3829,7 +5168,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3845,7 +5184,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3948,12 +5287,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 4:
       {
         
       // Array of basisvalues
@@ -3980,7 +5319,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3996,7 +5335,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4009,798 +5348,784 @@ public:
       
       // Declare derivative matrix (of polynomial basis).
       double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 8:
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 9:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 10:
+    case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[3] = dof_values[7];
-    vertex_values[5] = dof_values[8];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokes_finite_element_0();
-        break;
-      }
-    case 1:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokes_finite_element_0();
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokes_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokes_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokes_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
         {
-          if (combinations[row][col] + 1 > 1)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 6; u++)
           {
-            combinations[row][col] += 1;
-            break;
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4815,9 +6140,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4827,11 +6152,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4841,11 +6166,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4854,9 +6179,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4868,70 +6193,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 10:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4946,9 +6291,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4958,11 +6303,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4972,11 +6317,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4985,9 +6330,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4999,70 +6344,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 11:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5077,9 +6442,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5089,11 +6454,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5103,11 +6468,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5116,9 +6481,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5130,7 +6495,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -5139,28 +6504,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5172,57 +6535,55 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = 0.0;
+        values[r*2*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 2)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
+        values[r*2*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
@@ -5230,164 +6591,312 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
+    case 6:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
     }
     
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[1];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[6];
+    vertex_values[3] = dof_values[7];
+    vertex_values[5] = dof_values[8];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_finite_element_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new stokes_finite_element_2();
+    return new stokes_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class stokes_finite_element_3: public ufc::finite_element
+class stokes_finite_element_4: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  stokes_finite_element_3() : ufc::finite_element()
+  stokes_finite_element_4() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_finite_element_3()
+  ~stokes_finite_element_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 15;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5401,16 +6910,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5419,8 +6942,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -5952,20 +7475,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -5974,7 +7495,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -5982,21 +7503,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -6016,7 +7535,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -6028,7 +7547,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6037,8 +7556,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -6136,7 +7655,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6287,7 +7806,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6438,7 +7957,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6589,7 +8108,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6740,7 +8259,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6891,7 +8410,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7042,7 +8561,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7193,7 +8712,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7344,7 +8863,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7495,7 +9014,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7646,7 +9165,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7797,7 +9316,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8302,28 +9821,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -8359,7 +9876,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -8367,22 +9884,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -8393,120 +9908,120 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 12:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 13:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 14:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -8516,86 +10031,84 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[12] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[13] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[14] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -8611,41 +10124,154 @@ public:
     vertex_values[8] = dof_values[14];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_finite_element_3();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_4();
+  }
+
+};
+
+
+class stokes_dofmap_0: public ufc::dofmap
+{
+public:
+
+  stokes_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~stokes_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  std::size_t num_element_dofs() const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 3;
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
-    switch (i)
+    switch (d)
     {
     case 0:
       {
-        return new stokes_finite_element_1();
+        return 1;
         break;
       }
     case 1:
       {
-        return new stokes_finite_element_2();
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
         break;
       }
     }
@@ -8653,41 +10279,133 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    return new stokes_finite_element_3();
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new stokes_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_0: public ufc::dofmap
+class stokes_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_0() : ufc::dofmap()
+  stokes_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_0()
+  ~stokes_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -8698,7 +10416,7 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -8711,50 +10429,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0] + num_global_entities[1];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -8767,25 +10474,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -8793,30 +10498,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
-      dofs[2] = 3;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 4;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 5;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -8837,16 +10544,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -8855,30 +10565,7 @@ public:
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
@@ -8890,71 +10577,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_0();
+    return new stokes_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_1: public ufc::dofmap
+class stokes_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_1() : ufc::dofmap()
+  stokes_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_1()
+  ~stokes_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -8978,50 +10653,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2*num_global_entities[0] + 2*num_global_entities[1];
+    return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 1;
         break;
       }
     case 1:
       {
-        return 2;
+        return 1;
         break;
       }
     case 2:
@@ -9034,33 +10698,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9069,9 +10723,6 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
         break;
       }
     case 1:
@@ -9079,9 +10730,6 @@ public:
         dofs[0] = 0;
       dofs[1] = 2;
       dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
         break;
       }
     case 2:
@@ -9089,18 +10737,14 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9121,19 +10765,16 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 8;
           break;
         }
       }
@@ -9152,19 +10793,16 @@ public:
       case 0:
         {
           dofs[0] = 3;
-        dofs[1] = 9;
           break;
         }
       case 1:
         {
           dofs[0] = 4;
-        dofs[1] = 10;
           break;
         }
       case 2:
         {
           dofs[0] = 5;
-        dofs[1] = 11;
           break;
         }
       }
@@ -9180,97 +10818,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_1();
+    return new stokes_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_2: public ufc::dofmap
+class stokes_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_2() : ufc::dofmap()
+  stokes_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_2()
+  ~stokes_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9281,7 +10867,7 @@ public:
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -9294,50 +10880,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 0;
+        return 2;
         break;
       }
     case 2:
@@ -9350,19 +10925,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9370,27 +10957,38 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
+      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9411,16 +11009,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 8;
           break;
         }
       }
@@ -9429,7 +11030,33 @@ public:
       }
     case 1:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 9;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+        dofs[1] = 10;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+        dofs[1] = 11;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -9441,65 +11068,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_2();
+    return new stokes_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_3: public ufc::dofmap
+class stokes_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_3() : ufc::dofmap()
+  stokes_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_3()
+  ~stokes_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9523,39 +11144,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 15;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 8;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9579,37 +11189,35 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[12] = offset + c.entity_indices[0][0];
-    dofs[13] = offset + c.entity_indices[0][1];
-    dofs[14] = offset + c.entity_indices[0][2];
+    dofs[12] = offset + entity_indices[0][0];
+    dofs[13] = offset + entity_indices[0][1];
+    dofs[14] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9653,9 +11261,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9738,61 +11345,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_dofmap_1();
+        return new stokes_dofmap_3();
         break;
       }
     case 1:
       {
-        return new stokes_dofmap_2();
+        return new stokes_dofmap_0();
         break;
       }
     }
@@ -9800,46 +11370,38 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_3();
+    return new stokes_dofmap_4();
   }
 
 };
 
-/// 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_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   stokes_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~stokes_cell_integral_0_otherwise()
+  ~stokes_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    32
@@ -9848,7 +11410,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -9903,7 +11465,7 @@ public:
     A[15] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_0_1 + 0.166666666666668*G2_0_0 + 0.166666666666666*G2_0_1;
     A[16] = 0.5*G0_0_0 + 0.5*G2_0_0;
     A[17] = -0.166666666666666*G0_0_1 - 0.166666666666666*G2_0_1;
-    A[18] = 0.666666666666663*G0_0_1 + 0.666666666666663*G2_0_1;
+    A[18] = 0.666666666666664*G0_0_1 + 0.666666666666664*G2_0_1;
     A[19] = 0.0;
     A[20] = -0.666666666666667*G0_0_0 - 0.666666666666666*G0_0_1 - 0.666666666666667*G2_0_0 - 0.666666666666666*G2_0_1;
     A[21] = 0.0;
@@ -9931,9 +11493,9 @@ public:
     A[43] = 0.0;
     A[44] = -0.166666666666667*G4_1;
     A[45] = 0.0;
-    A[46] = 0.666666666666663*G0_1_0 + 0.666666666666663*G2_1_0;
+    A[46] = 0.666666666666664*G0_1_0 + 0.666666666666664*G2_1_0;
     A[47] = 0.666666666666666*G0_0_1 + 0.666666666666666*G2_0_1;
-    A[48] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333331*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666656*G2_0_1 + 0.666666666666656*G2_1_0 + 1.33333333333331*G2_1_1;
+    A[48] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333332*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666656*G2_0_1 + 0.666666666666656*G2_1_0 + 1.33333333333332*G2_1_1;
     A[49] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666656*G0_1_0 - 1.33333333333333*G2_0_0 - 0.666666666666659*G2_0_1 - 0.666666666666656*G2_1_0;
     A[50] = -0.666666666666665*G0_0_1 - 0.666666666666666*G0_1_0 - 1.33333333333332*G0_1_1 - 0.666666666666665*G2_0_1 - 0.666666666666666*G2_1_0 - 1.33333333333332*G2_1_1;
     A[51] = 0.0;
@@ -9950,7 +11512,7 @@ public:
     A[62] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_1 - 0.666666666666666*G2_0_1 - 0.666666666666665*G2_1_1;
     A[63] = -1.33333333333333*G0_0_0 - 0.666666666666656*G0_0_1 - 0.666666666666659*G0_1_0 - 1.33333333333333*G2_0_0 - 0.666666666666656*G2_0_1 - 0.666666666666659*G2_1_0;
     A[64] = 1.33333333333333*G0_0_0 + 0.666666666666659*G0_0_1 + 0.666666666666659*G0_1_0 + 1.33333333333333*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666659*G2_0_1 + 0.666666666666659*G2_1_0 + 1.33333333333333*G2_1_1;
-    A[65] = 0.666666666666665*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666665*G2_1_0;
+    A[65] = 0.666666666666665*G0_0_1 + 0.666666666666666*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666666*G2_1_0;
     A[66] = 0.0;
     A[67] = 0.0;
     A[68] = 0.0;
@@ -9964,7 +11526,7 @@ public:
     A[76] = -0.666666666666667*G0_0_0 - 0.666666666666666*G0_1_0 - 0.666666666666667*G2_0_0 - 0.666666666666666*G2_1_0;
     A[77] = 0.0;
     A[78] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_0 - 1.33333333333332*G0_1_1 - 0.666666666666666*G2_0_1 - 0.666666666666665*G2_1_0 - 1.33333333333332*G2_1_1;
-    A[79] = 0.666666666666665*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666665*G2_1_0;
+    A[79] = 0.666666666666666*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666666*G2_0_1 + 0.666666666666665*G2_1_0;
     A[80] = 1.33333333333333*G0_0_0 + 0.666666666666667*G0_0_1 + 0.666666666666667*G0_1_0 + 1.33333333333333*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666667*G2_0_1 + 0.666666666666667*G2_1_0 + 1.33333333333333*G2_1_1;
     A[81] = 0.0;
     A[82] = 0.0;
@@ -9999,7 +11561,7 @@ public:
     A[111] = 0.166666666666668*G1_0_0 + 0.166666666666666*G1_0_1 + 0.166666666666668*G3_0_0 + 0.166666666666666*G3_0_1;
     A[112] = 0.5*G1_0_0 + 0.5*G3_0_0;
     A[113] = -0.166666666666666*G1_0_1 - 0.166666666666666*G3_0_1;
-    A[114] = 0.666666666666663*G1_0_1 + 0.666666666666663*G3_0_1;
+    A[114] = 0.666666666666664*G1_0_1 + 0.666666666666664*G3_0_1;
     A[115] = 0.0;
     A[116] = -0.666666666666667*G1_0_0 - 0.666666666666666*G1_0_1 - 0.666666666666667*G3_0_0 - 0.666666666666666*G3_0_1;
     A[117] = 0.0;
@@ -10027,9 +11589,9 @@ public:
     A[139] = 0.0;
     A[140] = 0.0;
     A[141] = 0.0;
-    A[142] = 0.666666666666663*G1_1_0 + 0.666666666666663*G3_1_0;
+    A[142] = 0.666666666666664*G1_1_0 + 0.666666666666664*G3_1_0;
     A[143] = 0.666666666666666*G1_0_1 + 0.666666666666666*G3_0_1;
-    A[144] = 1.33333333333333*G1_0_0 + 0.666666666666656*G1_0_1 + 0.666666666666656*G1_1_0 + 1.33333333333331*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666656*G3_0_1 + 0.666666666666656*G3_1_0 + 1.33333333333331*G3_1_1;
+    A[144] = 1.33333333333333*G1_0_0 + 0.666666666666656*G1_0_1 + 0.666666666666656*G1_1_0 + 1.33333333333332*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666656*G3_0_1 + 0.666666666666656*G3_1_0 + 1.33333333333332*G3_1_1;
     A[145] = -1.33333333333333*G1_0_0 - 0.666666666666659*G1_0_1 - 0.666666666666656*G1_1_0 - 1.33333333333333*G3_0_0 - 0.666666666666659*G3_0_1 - 0.666666666666656*G3_1_0;
     A[146] = -0.666666666666665*G1_0_1 - 0.666666666666666*G1_1_0 - 1.33333333333332*G1_1_1 - 0.666666666666665*G3_0_1 - 0.666666666666666*G3_1_0 - 1.33333333333332*G3_1_1;
     A[147] = -0.166666666666666*G5_0 - 0.166666666666665*G5_1;
@@ -10046,7 +11608,7 @@ public:
     A[158] = -0.666666666666666*G1_0_1 - 0.666666666666665*G1_1_1 - 0.666666666666666*G3_0_1 - 0.666666666666665*G3_1_1;
     A[159] = -1.33333333333333*G1_0_0 - 0.666666666666656*G1_0_1 - 0.666666666666659*G1_1_0 - 1.33333333333333*G3_0_0 - 0.666666666666656*G3_0_1 - 0.666666666666659*G3_1_0;
     A[160] = 1.33333333333333*G1_0_0 + 0.666666666666659*G1_0_1 + 0.666666666666659*G1_1_0 + 1.33333333333333*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666659*G3_0_1 + 0.666666666666659*G3_1_0 + 1.33333333333333*G3_1_1;
-    A[161] = 0.666666666666665*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666665*G3_1_0;
+    A[161] = 0.666666666666665*G1_0_1 + 0.666666666666666*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666666*G3_1_0;
     A[162] = 0.166666666666666*G5_0 - 0.166666666666668*G5_1;
     A[163] = 0.166666666666666*G5_0;
     A[164] = 0.333333333333333*G5_0 + 0.166666666666665*G5_1;
@@ -10060,7 +11622,7 @@ public:
     A[172] = -0.666666666666667*G1_0_0 - 0.666666666666666*G1_1_0 - 0.666666666666667*G3_0_0 - 0.666666666666666*G3_1_0;
     A[173] = 0.0;
     A[174] = -0.666666666666666*G1_0_1 - 0.666666666666665*G1_1_0 - 1.33333333333332*G1_1_1 - 0.666666666666666*G3_0_1 - 0.666666666666665*G3_1_0 - 1.33333333333332*G3_1_1;
-    A[175] = 0.666666666666665*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666665*G3_1_0;
+    A[175] = 0.666666666666666*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666666*G3_0_1 + 0.666666666666665*G3_1_0;
     A[176] = 1.33333333333333*G1_0_0 + 0.666666666666667*G1_0_1 + 0.666666666666667*G1_1_0 + 1.33333333333333*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666667*G3_0_1 + 0.666666666666667*G3_1_0 + 1.33333333333333*G3_1_1;
     A[177] = -0.166666666666667*G5_0 + 0.166666666666667*G5_1;
     A[178] = 0.166666666666667*G5_0 + 0.333333333333333*G5_1;
@@ -10114,38 +11676,31 @@ public:
 
 };
 
-/// 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_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   stokes_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~stokes_cell_integral_1_otherwise()
+  ~stokes_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    12
@@ -10154,7 +11709,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -10198,77 +11753,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stokes_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   stokes_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_form_0()
+  ~stokes_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "b09b377c06ecc96e334de0b26d6f197196a371cfb88886cd25459d7d06fa6d98a8c24516f87cc94c5254744e71491a4877bfb352e417944a8f69d7ae365c5e61";
+    return "e4d3ecbcdcc80b02d3c0adee30cc75bba2be1e9a878bd5bcbaad2828d515a74c3f10875315ab6377135f3f73085ca535c1ae31a4c3cec4e7cad1313629a5cc25";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_finite_element_3();
+        return new stokes_finite_element_4();
         break;
       }
     case 1:
       {
-        return new stokes_finite_element_3();
+        return new stokes_finite_element_4();
         break;
       }
     }
@@ -10276,19 +11823,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_dofmap_3();
+        return new stokes_dofmap_4();
         break;
       }
     case 1:
       {
-        return new stokes_dofmap_3();
+        return new stokes_dofmap_4();
         break;
       }
     }
@@ -10296,203 +11842,231 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stokes_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stokes_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   stokes_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_form_1()
+  ~stokes_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "43676e2f137cfd4188bb548b1833d00983af00f41426b57e72b0c804401a25e71490a10707082871d12911dbde6adff36393f8da1e94dc3611db8fa1800a19f3";
+    return "e13c435cc005a4412da38ee23ad0d3cf6d5098c580cd3a1faeeb8bfa2177ce6cc5ee82811668cce1fb7d26742e62ef02e5acae25c4ae5d926278f948d0096626";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_finite_element_3();
+        return new stokes_finite_element_4();
         break;
       }
     case 1:
       {
-        return new stokes_finite_element_1();
+        return new stokes_finite_element_3();
         break;
       }
     }
@@ -10500,19 +12074,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_dofmap_3();
+        return new stokes_dofmap_4();
         break;
       }
     case 1:
       {
-        return new stokes_dofmap_1();
+        return new stokes_dofmap_3();
         break;
       }
     }
@@ -10520,126 +12093,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stokes_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -10653,14 +12262,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Stokes
 {
@@ -10669,43 +12284,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -10716,43 +12308,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -10763,63 +12332,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -10827,7 +12403,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_0());
+    _ufc_form = std::make_shared<const stokes_form_0>();
   }
 
   // Destructor
@@ -10857,57 +12433,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -10915,69 +12546,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    _ufc_form = std::make_shared<const stokes_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    _ufc_form = std::make_shared<const stokes_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -11009,18 +12681,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/documented/stokes-taylor-hood/cpp/compile.log b/demo/documented/stokes-taylor-hood/cpp/compile.log
index 529796e..16e49ad 100644
--- a/demo/documented/stokes-taylor-hood/cpp/compile.log
+++ b/demo/documented/stokes-taylor-hood/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Stokes
 
@@ -12,9 +13,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>'
-  Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)>,
-                              CG1(?), CG2(?)'
+  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1(?)>,
+                              Vector<2 x CG2(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -52,9 +53,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -62,9 +63,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)>'
+  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)>,
+                              Vector<2 x CG1(?)>'
   Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)>,
-                              CG1(?), CG2(?)'
+                              Vector<2 x CG1(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -79,15 +81,21 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.118341 seconds.
+Compiler stage 1 finished in 0.245315 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -96,11 +104,16 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 5 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -139,7 +152,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00143 seconds
+  900 entries computed in 0.00177 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -148,7 +161,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00136 seconds
+  900 entries computed in 0.0019 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -157,7 +170,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00132 seconds
+  900 entries computed in 0.00178 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -166,7 +179,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00134 seconds
+  900 entries computed in 0.00169 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -175,7 +188,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.0013 seconds
+  450 entries computed in 0.00206 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -184,7 +197,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00131 seconds
+  450 entries computed in 0.00166 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -193,7 +206,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00133 seconds
+  450 entries computed in 0.00157 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -202,7 +215,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00132 seconds
+  450 entries computed in 0.00158 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -210,6 +223,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -224,7 +238,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  180 entries computed in 0.00158 seconds
+  180 entries computed in 0.00281 seconds
   Shape of reference tensor: (15, 12)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -234,7 +248,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  180 entries computed in 0.00157 seconds
+  180 entries computed in 0.00198 seconds
   Shape of reference tensor: (15, 12)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -243,490 +257,84 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.034564 seconds.
+Compiler stage 2 finished in 0.0554719 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000154018 seconds.
+Compiler stage 3 finished in 0.00022006 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Generating code for 5 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.435341 seconds.
+Compiler stage 4 finished in 0.674834 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000557899 seconds.
+Compiler stage 4.1 finished in 0.000847101 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Stokes.h.
-Compiler stage 5 finished in 0.00121784 seconds.
+Compiler stage 5 finished in 0.00112987 seconds.
 
-FFC finished in 0.590517 seconds.
+FFC finished in 0.978379 seconds.
+Output written to ./Stokes.h.
diff --git a/demo/documented/stokes-taylor-hood/cpp/main.cpp b/demo/documented/stokes-taylor-hood/cpp/main.cpp
index aae7df6..7074ecd 100644
--- a/demo/documented/stokes-taylor-hood/cpp/main.cpp
+++ b/demo/documented/stokes-taylor-hood/cpp/main.cpp
@@ -62,30 +62,28 @@ int main()
   };
 
   // Read mesh and sub domain markers
-  Mesh mesh("../dolfin_fine.xml.gz");
-  MeshFunction<std::size_t> sub_domains(mesh, "../dolfin_fine_subdomains.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../dolfin_fine.xml.gz");
+  auto sub_domains = std::make_shared<MeshFunction<std::size_t>>(mesh, "../dolfin_fine_subdomains.xml.gz");
 
-  // Create function space and subspaces
-  Stokes::FunctionSpace W(mesh);
-  SubSpace W0(W, 0);
-  SubSpace W1(W, 1);
+  // Create function space
+  auto W = std::make_shared<Stokes::FunctionSpace>(mesh);
 
   // Create functions for boundary conditions
-  Noslip noslip;
-  Inflow inflow;
-  Constant zero(0);
+  auto noslip = std::make_shared<Noslip>();
+  auto inflow = std::make_shared<Inflow>();
+  auto zero = std::make_shared<Constant>(0.0);
 
   // No-slip boundary condition for velocity
-  DirichletBC bc0(W0, noslip, sub_domains, 0);
+  DirichletBC bc0(W->sub(0), noslip, sub_domains, 0);
 
   // Inflow boundary condition for velocity
-  DirichletBC bc1(W0, inflow, sub_domains, 1);
+  DirichletBC bc1(W->sub(0), inflow, sub_domains, 1);
 
   // Collect boundary conditions
   std::vector<const DirichletBC*> bcs = {{&bc0, &bc1}};
 
   // Define variational problem
-  Constant f(0.0, 0.0);
+  auto f = std::make_shared<Constant>(0.0, 0.0);
   Stokes::BilinearForm a(W, W);
   Stokes::LinearForm L(W);
   L.f = f;
@@ -103,7 +101,7 @@ int main()
   pfile_pvd << p;
 
   File pfile_mf("mf.pvd");
-  pfile_mf << sub_domains;
+  pfile_mf << *sub_domains;
 
   // Plot solution
   plot(u);
diff --git a/demo/documented/stokes-taylor-hood/python/demo_stokes-taylor-hood.py b/demo/documented/stokes-taylor-hood/python/demo_stokes-taylor-hood.py
index c3fcd6f..496f01b 100644
--- a/demo/documented/stokes-taylor-hood/python/demo_stokes-taylor-hood.py
+++ b/demo/documented/stokes-taylor-hood/python/demo_stokes-taylor-hood.py
@@ -38,9 +38,10 @@ plot(mesh)
 plot(sub_domains)
 
 # Define function spaces
-V = VectorFunctionSpace(mesh, "CG", 2)
-Q = FunctionSpace(mesh, "CG", 1)
-W = V * Q
+P2 = VectorElement("Lagrange", mesh.ufl_cell(), 2)
+P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+TH = P2 * P1
+W = FunctionSpace(mesh, TH)
 
 # No-slip boundary condition for velocity
 # x1 = 0, x1 = 1 and around the dolphin
@@ -49,7 +50,7 @@ bc0 = DirichletBC(W.sub(0), noslip, sub_domains, 0)
 
 # Inflow boundary condition for velocity
 # x0 = 1
-inflow = Expression(("-sin(x[1]*pi)", "0.0"))
+inflow = Expression(("-sin(x[1]*pi)", "0.0"), degree=2)
 bc1 = DirichletBC(W.sub(0), inflow, sub_domains, 1)
 
 # Collect boundary conditions
diff --git a/demo/documented/stokes-taylor-hood/python/documentation.rst b/demo/documented/stokes-taylor-hood/python/documentation.rst
index e7847b2..7adbd30 100644
--- a/demo/documented/stokes-taylor-hood/python/documentation.rst
+++ b/demo/documented/stokes-taylor-hood/python/documentation.rst
@@ -18,7 +18,7 @@ First, the :py:mod:`dolfin` module is imported:
 
 .. code-block:: python
 
-	from dolfin import *
+    from dolfin import *
 
 In this example, different boundary conditions are prescribed on
 different parts of the boundaries. This information must be made
@@ -32,53 +32,52 @@ following way:
 
 .. code-block:: python
 
-	# Load mesh and subdomains
-	mesh = Mesh("dolfin_fine.xml.gz")
-	sub_domains = MeshFunction("size_t", mesh, "dolfin_fine_subdomains.xml.gz")
+    # Load mesh and subdomains
+    mesh = Mesh("../dolfin_fine.xml.gz")
+    sub_domains = MeshFunction("size_t", mesh, "../dolfin_fine_subdomains.xml.gz")
 
-Next, we define a :py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>` composed of a
-:py:class:`VectorFunctionSpace
-<dolfin.functions.functionspace.VectorFunctionSpace>` of continuous
-piecewise quadratics and a :py:class:`FunctionSpace
-<dolfin.cpp.function.FunctionSpace>` of continuous piecewise
+Next, we define a :py:class:`FunctionSpace
+<dolfin.functions.functionspace.FunctionSpace>` built on a mixed
+finite element ``TH`` which consists of continuous
+piecewise quadratics and continuous piecewise
 linears. (This mixed finite element space is known as the Taylor–Hood
 elements and is a stable, standard element pair for the Stokes
 equations.)
 
 .. code-block:: python
 
-	# Define function spaces
-	V = VectorFunctionSpace(mesh, "CG", 2)
-	Q = FunctionSpace(mesh, "CG", 1)
-	W = V * Q
+    # Define function spaces
+    P2 = VectorElement("Lagrange", mesh.ufl_cell(), 2)
+    P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    TH = P2 * P1
+    W = FunctionSpace(mesh, TH)
 
 Now that we have our mixed function space and marked subdomains
 defining the boundaries, we define boundary conditions:
 
 .. code-block:: python
 
-	# No-slip boundary condition for velocity
-	# x1 = 0, x1 = 1 and around dolphin
-	noslip = Constant((0, 0))
-	bc0 = DirichletBC(W.sub(0), noslip, sub_domains, 0)
+    # No-slip boundary condition for velocity
+    # x1 = 0, x1 = 1 and around the dolphin
+    noslip = Constant((0, 0))
+    bc0 = DirichletBC(W.sub(0), noslip, sub_domains, 0)
 
-	# Inflow boundary condition for velocity
-	# x0 = 1
-	inflow = Expression(("-sin(x[1]*pi)", "0.0"))
-	bc1 = DirichletBC(W.sub(0), inflow, sub_domains, 1)
+    # Inflow boundary condition for velocity
+    # x0 = 1
+    inflow = Expression(("-sin(x[1]*pi)", "0.0"), degree=2)
+    bc1 = DirichletBC(W.sub(0), inflow, sub_domains, 1)
 
-	# Collect boundary conditions
-	bcs = [bc0, bc1]
+    # Collect boundary conditions
+    bcs = [bc0, bc1]
 
 Here, we have given four arguments in the call to
 :py:class:`DirichletBC <dolfin.cpp.fem.DirichletBC>`. The first
 specifies the :py:class:`FunctionSpace
 <dolfin.cpp.function.FunctionSpace>`. Since we have a
-:py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>`, we write
-``W.sub(0)`` for the function space ``V``, and ``W.sub(1)`` for
-``Q``. The second argument specifies the value on the Dirichlet
+mixed function space, we write
+``W.sub(0)`` for the velocity component of the space, and
+``W.sub(1)`` for the pressure componnen of the space.
+The second argument specifies the value on the Dirichlet
 boundary. The two last ones specifies the marking of the subdomains;
 ``sub_domains`` contains the subdomain markers and the number given as
 the last argument is the subdomain index.
@@ -88,19 +87,18 @@ formulation of the Stokes equations are defined as follows:
 
 .. code-block:: python
 
-	# Define variational problem
-	(u, p) = TrialFunctions(W)
-	(v, q) = TestFunctions(W)
-	f = Constant((0, 0))
-	a = (inner(grad(u), grad(v)) - div(v)*p + q*div(u))*dx
-	L = inner(f, v)*dx
+    # Define variational problem
+    (u, p) = TrialFunctions(W)
+    (v, q) = TestFunctions(W)
+    f = Constant((0, 0))
+    a = (inner(grad(u), grad(v)) - div(v)*p + q*div(u))*dx
+    L = inner(f, v)*dx
 
 To compute the solution we use the bilinear and linear forms, and the
 boundary condition, but we also need to create a :py:class:`Function
 <dolfin.cpp.function.Function>` to store the solution(s). The (full)
-solution will be stored in w, which we initialize using the
-:py:class:`MixedFunctionSpace
-<dolfin.functions.functionspace.MixedFunctionSpace>` ``W``. The actual
+solution will be stored in w, which we initialize using the mixed
+function space ``W``. The actual
 computation is performed by calling solve with the arguments ``a``,
 ``L``, ``w`` and ``bcs``. The separate components ``u`` and ``p`` of
 the solution can be extracted by calling the :py:meth:`split
@@ -111,47 +109,47 @@ a deep copy for further computations on the coefficient vectors.
 
 .. code-block:: python
 
-	# Compute solution
-	w = Function(W)
-	solve(a == L, w, bcs)
+    # Compute solution
+    w = Function(W)
+    solve(a == L, w, bcs)
 
-	# Split the mixed solution using deepcopy
-	# (needed for further computation on coefficient vector)
-	(u, p) = w.split(True)
+    # Split the mixed solution using deepcopy
+    # (needed for further computation on coefficient vector)
+    (u, p) = w.split(True)
 
 We may be interested in the :math:`L^2` norms of u and p, they can be
 calculated and printed by writing
 
 .. code-block:: python
 
-	print "Norm of velocity coefficient vector: %.15g" % u.vector().norm("l2")
-	print "Norm of pressure coefficient vector: %.15g" % p.vector().norm("l2")
+    print("Norm of velocity coefficient vector: %.15g" % u.vector().norm("l2"))
+    print("Norm of pressure coefficient vector: %.15g" % p.vector().norm("l2"))
 
 One can also split functions using shallow copies (which is enough
 when we just plotting the result) by writing
 
 .. code-block:: python
 
-	# Split the mixed solution using a shallow copy
-	(u, p) = w.split()
+    # Split the mixed solution using a shallow copy
+    (u, p) = w.split()
 
 Finally, we can store to file and plot the solutions.
 
 .. code-block:: python
 
-	# Save solution in VTK format
-	ufile_pvd = File("velocity.pvd")
-	ufile_pvd << u
-	pfile_pvd = File("pressure.pvd")
-	pfile_pvd << p
+    # Save solution in VTK format
+    ufile_pvd = File("velocity.pvd")
+    ufile_pvd << u
+    pfile_pvd = File("pressure.pvd")
+    pfile_pvd << p
 
-	# Plot solution
-	plot(u)
-	plot(p)
-	interactive()
+    # Plot solution
+    plot(u)
+    plot(p)
+    interactive()
 
 Complete code
 -------------
 
 .. literalinclude:: demo_stokes-taylor-hood.py
-	:start-after: # Begin demo
+    :start-after: # Begin demo
diff --git a/demo/documented/subdomains-poisson/python/demo_subdomains-poisson.py b/demo/documented/subdomains-poisson/python/demo_subdomains-poisson.py
index 28e848a..0540592 100644
--- a/demo/documented/subdomains-poisson/python/demo_subdomains-poisson.py
+++ b/demo/documented/subdomains-poisson/python/demo_subdomains-poisson.py
@@ -71,8 +71,8 @@ bottom.mark(boundaries, 4)
 # Define input data
 a0 = Constant(1.0)
 a1 = Constant(0.01)
-g_L = Expression("- 10*exp(- pow(x[1] - 0.5, 2))")
-g_R = Constant("1.0")
+g_L = Expression("- 10*exp(- pow(x[1] - 0.5, 2))", degree=2)
+g_R = Constant(1.0)
 f = Constant(1.0)
 
 # Define function space and basis functions
diff --git a/demo/documented/subdomains-poisson/python/documentation.rst b/demo/documented/subdomains-poisson/python/documentation.rst
index 355eab9..85d8341 100644
--- a/demo/documented/subdomains-poisson/python/documentation.rst
+++ b/demo/documented/subdomains-poisson/python/documentation.rst
@@ -136,8 +136,8 @@ defining the input source functions:
     # Define input data
     a0 = Constant(1.0)
     a1 = Constant(0.01)
-    g_L = Expression("- 10*exp(- pow(x[1] - 0.5, 2))")
-    g_R = Constant("1.0")
+    g_L = Expression("- 10*exp(- pow(x[1] - 0.5, 2))", degree=2)
+    g_R = Constant(1.0)
     f = Constant(1.0)
 
 Here, ``a0`` and ``a1`` represent the values of the coefficient
diff --git a/demo/documented/subdomains/cpp/CMakeLists.txt b/demo/documented/subdomains/cpp/CMakeLists.txt
index 916d29e..0527cf2 100644
--- a/demo/documented/subdomains/cpp/CMakeLists.txt
+++ b/demo/documented/subdomains/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/documented/subdomains/cpp/main.cpp b/demo/documented/subdomains/cpp/main.cpp
index 1a523b2..9ea446c 100644
--- a/demo/documented/subdomains/cpp/main.cpp
+++ b/demo/documented/subdomains/cpp/main.cpp
@@ -61,12 +61,12 @@ int main()
   };
 
   // Read mesh
-  Mesh mesh("../dolfin_fine.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../dolfin_fine.xml.gz");
 
   // Create mesh functions over the cell facets
-  MeshFunction<std::size_t> sub_domains(mesh, mesh.topology().dim() - 1);
-  MeshFunction<double> sub_domains_double(mesh, mesh.topology().dim() - 1);
-  MeshFunction<bool> sub_domains_bool(mesh, mesh.topology().dim() - 1);
+  MeshFunction<std::size_t> sub_domains(mesh, mesh->topology().dim() - 1);
+  MeshFunction<double> sub_domains_double(mesh, mesh->topology().dim() - 1);
+  MeshFunction<bool> sub_domains_bool(mesh, mesh->topology().dim() - 1);
 
   // Mark all facets as sub domain 3
   sub_domains = 3;
diff --git a/demo/documented/subdomains/python/documentation.rst b/demo/documented/subdomains/python/documentation.rst
index 5793d43..976fb50 100644
--- a/demo/documented/subdomains/python/documentation.rst
+++ b/demo/documented/subdomains/python/documentation.rst
@@ -32,7 +32,7 @@ possible we will set the log level to 1:
 
 .. code-block:: python
 
-	set_log_level(1)
+    set_log_level(1)
 
 Before we can mark the boundaries, we must specify the boundary
 conditions.  We do this by defining three classes, one for each
@@ -42,27 +42,27 @@ inflow and outflow.
 
 .. code-block:: python
 
-	# Sub domain for no-slip (mark whole boundary, inflow and outflow will overwrite)
-	class Noslip(SubDomain):
-	    def inside(self, x, on_boundary):
-	        return on_boundary
+    # Sub domain for no-slip (mark whole boundary, inflow and outflow will overwrite)
+    class Noslip(SubDomain):
+        def inside(self, x, on_boundary):
+            return on_boundary
 
-	# Sub domain for inflow (right)
-	class Inflow(SubDomain):
-	    def inside(self, x, on_boundary):
-	        return x[0] > 1.0 - DOLFIN_EPS and on_boundary
+    # Sub domain for inflow (right)
+    class Inflow(SubDomain):
+        def inside(self, x, on_boundary):
+            return x[0] > 1.0 - DOLFIN_EPS and on_boundary
 
-	# Sub domain for outflow (left)
-	class Outflow(SubDomain):
-	    def inside(self, x, on_boundary):
-	        return x[0] < DOLFIN_EPS and on_boundary
+    # Sub domain for outflow (left)
+    class Outflow(SubDomain):
+        def inside(self, x, on_boundary):
+            return x[0] < DOLFIN_EPS and on_boundary
 
 Then, we import the mesh:
 
 .. code-block:: python
 
-	# Read mesh
-	mesh = Mesh("dolfin-2.xml.gz")
+    # Read mesh
+    mesh = Mesh("../dolfin_fine.xml.gz")
 
 We create a :py:class:`MeshFunction <dolfin.cpp.MeshFunction>` to
 store the numbering of the subdomains.  When creating a MeshFunction
@@ -73,10 +73,10 @@ the difference of these we will use both ‘size_t’, ‘double’ and
 
 .. code-block:: python
 
-	# Create mesh functions over the cell facets
-	sub_domains = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
-	sub_domains_bool = MeshFunction("bool", mesh, mesh.topology().dim() - 1)
-	sub_domains_double = MeshFunction("double", mesh, mesh.topology().dim() - 1)
+    # Create mesh functions over the cell facets
+    sub_domains = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
+    sub_domains_bool = MeshFunction("bool", mesh, mesh.topology().dim() - 1)
+    sub_domains_double = MeshFunction("double", mesh, mesh.topology().dim() - 1)
 
 The second and third arguments are optional. The second argument
 specifies our mesh, while the third argument gives the topological
@@ -99,10 +99,10 @@ all the facets.
 
 .. code-block:: python
 
-	# Mark all facets as sub domain 3
-	sub_domains.set_all(3)
-	sub_domains_bool.set_all(False)
-	sub_domains_double.set_all(0.3)
+    # Mark all facets as sub domain 3
+    sub_domains.set_all(3)
+    sub_domains_bool.set_all(False)
+    sub_domains_double.set_all(0.3)
 
 When all facets are marked, we mark only the boundary facets.  We give
 the noslip boundary the index 0.  To mark the facets of the noslip
@@ -112,10 +112,10 @@ or double).
 
 .. code-block:: python
 
-	# Mark no-slip facets as sub domain 0, 0.0
-	noslip = Noslip()
-	noslip.mark(sub_domains, 0)
-	noslip.mark(sub_domains_double, 0.0)
+    # Mark no-slip facets as sub domain 0, 0.0
+    noslip = Noslip()
+    noslip.mark(sub_domains, 0)
+    noslip.mark(sub_domains_double, 0.0)
 
 The same must be done for the inflow and outflow boundaries.  The
 inflow is marked as subdomain 1 and the outflow is marked as subdomain
@@ -123,16 +123,16 @@ inflow is marked as subdomain 1 and the outflow is marked as subdomain
 
 .. code-block:: python
 
-	# Mark inflow as sub domain 1, 01
-	inflow = Inflow()
-	inflow.mark(sub_domains, 1)
-	inflow.mark(sub_domains_double, 0.1)
+    # Mark inflow as sub domain 1, 01
+    inflow = Inflow()
+    inflow.mark(sub_domains, 1)
+    inflow.mark(sub_domains_double, 0.1)
 
-	# Mark outflow as sub domain 2, 0.2, True
-	outflow = Outflow()
-	outflow.mark(sub_domains, 2)
-	outflow.mark(sub_domains_double, 0.2)
-	outflow.mark(sub_domains_bool, True)
+    # Mark outflow as sub domain 2, 0.2, True
+    outflow = Outflow()
+    outflow.mark(sub_domains, 2)
+    outflow.mark(sub_domains_double, 0.2)
+    outflow.mark(sub_domains_bool, True)
 
 Finally, to be able to use these subdomains together with the mesh in
 other programs, we save the subdomains to file, both as XML and VTK
@@ -140,23 +140,23 @@ files:
 
 .. code-block:: python
 
-	# Save sub domains to file
-	file = File("subdomains.xml")
-	file << sub_domains
+    # Save sub domains to file
+    file = File("subdomains.xml")
+    file << sub_domains
 
-	# FIXME: Not implemented
-	#file_bool = File("subdomains_bool.xml")
-	#file_bool << sub_domains_bool
+    # FIXME: Not implemented
+    #file_bool = File("subdomains_bool.xml")
+    #file_bool << sub_domains_bool
 
-	file_double = File("subdomains_double.xml")
-	file_double << sub_domains_double
+    file_double = File("subdomains_double.xml")
+    file_double << sub_domains_double
 
-	# Save sub domains to VTK files
-	file = File("subdomains.pvd")
-	file << sub_domains
+    # Save sub domains to VTK files
+    file = File("subdomains.pvd")
+    file << sub_domains
 
-	file = File("subdomains_double.pvd")
-	file << sub_domains_double
+    file = File("subdomains_double.pvd")
+    file << sub_domains_double
 
 Complete code
 -------------
diff --git a/demo/documented/tensor-weighted-poisson/python/demo_tensor-weighted-poisson.py b/demo/documented/tensor-weighted-poisson/python/demo_tensor-weighted-poisson.py
index 1e326bd..7d63510 100644
--- a/demo/documented/tensor-weighted-poisson/python/demo_tensor-weighted-poisson.py
+++ b/demo/documented/tensor-weighted-poisson/python/demo_tensor-weighted-poisson.py
@@ -95,7 +95,7 @@ c00 = MeshFunction("double", mesh, "../unitsquare_32_32_c00.xml.gz")
 c01 = MeshFunction("double", mesh, "../unitsquare_32_32_c01.xml.gz")
 c11 = MeshFunction("double", mesh, "../unitsquare_32_32_c11.xml.gz")
 
-c = Expression(cppcode=conductivity_code)
+c = Expression(cppcode=conductivity_code, degree=0)
 c.c00 = c00
 c.c01 = c01
 c.c11 = c11
@@ -104,7 +104,7 @@ C = as_matrix(((c[0], c[1]), (c[1], c[2])))
 # Define variational problem
 u = TrialFunction(V)
 v = TestFunction(V)
-f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
+f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
 a = inner(C*grad(u), grad(v))*dx
 L = f*v*dx
 
diff --git a/demo/documented/tensor-weighted-poisson/python/documentation.rst b/demo/documented/tensor-weighted-poisson/python/documentation.rst
index ef6ad00..73279da 100644
--- a/demo/documented/tensor-weighted-poisson/python/documentation.rst
+++ b/demo/documented/tensor-weighted-poisson/python/documentation.rst
@@ -22,7 +22,7 @@ First, the :py:mod:`dolfin` module is imported:
 
 .. code-block:: python
 
-	from dolfin import *
+    from dolfin import *
 
 Then, we define a mesh of the domain. We use the built-in mesh,
 provided by the class :py:class:`UnitSquareMesh
@@ -32,8 +32,8 @@ into two triangles, we do as follows:
 
 .. code-block:: python
 
-	# Create mesh
-	mesh = UnitSquareMesh(32, 32)
+    # Create mesh
+    mesh = UnitSquareMesh(32, 32)
 
 Now, we create mesh functions to store the values of the conductivity
 matrix as it varies over the domain.  Since the matrix is symmetric,
@@ -47,10 +47,10 @@ and the second the topological dimension of the mesh function.
 
 .. code-block:: python
 
-	# Create mesh functions for c00, c01, c11
-	c00 = MeshFunction("double", mesh, 2)
-	c01 = MeshFunction("double", mesh, 2)
-	c11 = MeshFunction("double", mesh, 2)
+    # Create mesh functions for c00, c01, c11
+    c00 = MeshFunction("double", mesh, 2)
+    c01 = MeshFunction("double", mesh, 2)
+    c11 = MeshFunction("double", mesh, 2)
 
 To set the values of the mesh functions, we go through all the cells
 in the mesh and check whether the midpoint value of the cell in the
@@ -61,42 +61,42 @@ on which half we are in.
 
 .. code-block:: python
 
-	# Iterate over mesh and set values
-	for cell in cells(mesh):
-	    if cell.midpoint().x() < 0.5:
-			c00[cell] = 1.0
-			c01[cell] = 0.3
-			c11[cell] = 2.0
-	    else:
-			c00[cell] = 3.0
-			c01[cell] = 0.5
-			c11[cell] = 4.0
+    # Iterate over mesh and set values
+    for cell in cells(mesh):
+        if cell.midpoint().x() < 0.5:
+            c00[cell] = 1.0
+            c01[cell] = 0.3
+            c11[cell] = 2.0
+        else:
+            c00[cell] = 3.0
+            c01[cell] = 0.5
+            c11[cell] = 4.0
 
 Create files to store data and save to file:
 
 .. code-block:: python
 
-	# Store to file
-	mesh_file = File("../unitsquare_32_32.xml.gz")
-	c00_file = File("../unitsquare_32_32_c00.xml.gz")
-	c01_file = File("../unitsquare_32_32_c01.xml.gz")
-	c11_file = File("../unitsquare_32_32_c11.xml.gz")
+    # Store to file
+    mesh_file = File("../unitsquare_32_32.xml.gz")
+    c00_file = File("../unitsquare_32_32_c00.xml.gz")
+    c01_file = File("../unitsquare_32_32_c01.xml.gz")
+    c11_file = File("../unitsquare_32_32_c11.xml.gz")
 
-	mesh_file << mesh
-	c00_file << c00
-	c01_file << c01
-	c11_file << c11
+    mesh_file << mesh
+    c00_file << c00
+    c01_file << c01
+    c11_file << c11
 
 Plot the mesh functions using the ``plot`` function:
 
 .. code-block:: python
 
-	# Plot mesh functions
-	plot(c00, title="C00")
-	plot(c01, title="C01")
-	plot(c11, title="C11")
+    # Plot mesh functions
+    plot(c00, title="C00")
+    plot(c01, title="C01")
+    plot(c11, title="C11")
 
-	interactive()
+    interactive()
 
 Implementation of tensor-weighted-poisson.py
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -110,7 +110,7 @@ First, the :py:mod:`dolfin` module is imported:
 
 .. code-block:: python
 
-	from dolfin import *
+    from dolfin import *
 
 We proceed by defining a mesh of the domain and a finite element
 function space :math:`V` relative to this mesh. We read the mesh file
@@ -119,9 +119,9 @@ space in the following way:
 
 .. code-block:: python
 
-	# Read mesh from file and create function space
-	mesh = Mesh("../unitsquare_32_32.xml.gz")
-	V = FunctionSpace(mesh, "Lagrange", 1)
+    # Read mesh from file and create function space
+    mesh = Mesh("../unitsquare_32_32.xml.gz")
+    V = FunctionSpace(mesh, "Lagrange", 1)
 
 The second argument to :py:class:`FunctionSpace
 <dolfin.cpp.function.FunctionSpace>` is the finite element family,
@@ -143,9 +143,9 @@ small number (such as machine precision).)
 
 .. code-block:: python
 
-	# Define Dirichlet boundary (x = 0 or x = 1)
-	def boundary(x):
-	    return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS
+    # Define Dirichlet boundary (x = 0 or x = 1)
+    def boundary(x):
+        return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS
 
 Now, the Dirichlet boundary condition can be created using the class
 :py:class:`DirichletBC <dolfin.cpp.fem.DirichletBC>`.  A
@@ -161,9 +161,9 @@ condition then looks as follows:
 
 .. code-block:: python
 
-	# Define boundary condition
-	u0 = Constant(0.0)
-	bc = DirichletBC(V, u0, boundary)
+    # Define boundary condition
+    u0 = Constant(0.0)
+    bc = DirichletBC(V, u0, boundary)
 
 Before we define the conductivity matrix, we create a string
 containing C++ code for evaluation of the conductivity. Later we will
@@ -173,33 +173,33 @@ matrix.
 
 .. code-block:: python
 
-	# Code for C++ evaluation of conductivity
-	conductivity_code = """
+    # Code for C++ evaluation of conductivity
+    conductivity_code = """
 
-	class Conductivity : public Expression
-	{
-	public:
+    class Conductivity : public Expression
+    {
+    public:
 
-	  // Create expression with 3 components
-	  Conductivity() : Expression(3) {}
+      // Create expression with 3 components
+      Conductivity() : Expression(3) {}
 
-	  // Function for evaluating expression on each cell
-	  void eval(Array<double>& values, const Array<double>& x, const ufc::cell& cell) const
-	  {
-	    const uint D = cell.topological_dimension;
-	    const uint cell_index = cell.index;
-	    values[0] = (*c00)[cell_index];
-	    values[1] = (*c01)[cell_index];
-	    values[2] = (*c11)[cell_index];
-	  }
+      // Function for evaluating expression on each cell
+      void eval(Array<double>& values, const Array<double>& x, const ufc::cell& cell) const
+      {
+        const uint D = cell.topological_dimension;
+        const uint cell_index = cell.index;
+        values[0] = (*c00)[cell_index];
+        values[1] = (*c01)[cell_index];
+        values[2] = (*c11)[cell_index];
+      }
 
-	  // The data stored in mesh functions
-	  std::shared_ptr<MeshFunction<double> > c00;
-	  std::shared_ptr<MeshFunction<double> > c01;
-	  std::shared_ptr<MeshFunction<double> > c11;
+      // The data stored in mesh functions
+      std::shared_ptr<MeshFunction<double> > c00;
+      std::shared_ptr<MeshFunction<double> > c01;
+      std::shared_ptr<MeshFunction<double> > c11;
 
-	};
-	"""
+    };
+    """
 
 We define the conductivity matrix by first creating mesh functions
 from the files we stored in :download:`generate_data.py`.  Here, the
@@ -212,16 +212,16 @@ expressions.
 
 .. code-block:: python
 
-	# Define conductivity expression and matrix
-	c00 = MeshFunction("double", mesh, "../unitsquare_32_32_c00.xml.gz")
-	c01 = MeshFunction("double", mesh, "../unitsquare_32_32_c01.xml.gz")
-	c11 = MeshFunction("double", mesh, "../unitsquare_32_32_c11.xml.gz")
+    # Define conductivity expression and matrix
+    c00 = MeshFunction("double", mesh, "../unitsquare_32_32_c00.xml.gz")
+    c01 = MeshFunction("double", mesh, "../unitsquare_32_32_c01.xml.gz")
+    c11 = MeshFunction("double", mesh, "../unitsquare_32_32_c11.xml.gz")
 
-	c = Expression(cppcode=conductivity_code)
-	c.c00 = c00
-	c.c01 = c01
-	c.c11 = c11
-	C = as_matrix(((c[0], c[1]), (c[1], c[2])))
+    c = Expression(cppcode=conductivity_code, degree=0)
+    c.c00 = c00
+    c.c01 = c01
+    c.c11 = c11
+    C = as_matrix(((c[0], c[1]), (c[1], c[2])))
 
 Next, we want to express the variational problem. First, we need to
 specify the trial function :math:`u` and the test function :math:`v`,
@@ -245,12 +245,12 @@ reads:
 
 .. code-block:: python
 
-	# Define variational problem
-	u = TrialFunction(V)
-	v = TestFunction(V)
-	f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-	a = inner(C*grad(u), grad(v))*dx
-	L = f*v*dx
+    # Define variational problem
+    u = TrialFunction(V)
+    v = TestFunction(V)
+    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+    a = inner(C*grad(u), grad(v))*dx
+    L = f*v*dx
 
 Now, we have specified the bilinear and linear forms and can consider
 the solution of the variational problem.  First, we need to define a
@@ -264,9 +264,9 @@ the arguments ``a == L``, ``u`` and ``bc`` as follows:
 
 .. code-block:: python
 
-	# Compute solution
-	u = Function(V)
-	solve(a == L, u, bc)
+    # Compute solution
+    u = Function(V)
+    solve(a == L, u, bc)
 
 The function ``u`` will be modified during the call to solve. The
 default settings for solving a variational problem have been used.
@@ -281,12 +281,12 @@ suffix .pvd) for later visualization and also plot it using the
 
 .. code-block:: python
 
-	# Save solution in VTK format
-	file = File("poisson.pvd")
-	file << u
+    # Save solution in VTK format
+    file = File("poisson.pvd")
+    file << u
 
-	# Plot solution
-	plot(u, interactive=True)
+    # Plot solution
+    plot(u, interactive=True)
 
 Complete code
 -------------
diff --git a/demo/undocumented/adaptive-poisson/python/demo_adaptive-poisson.py b/demo/undocumented/adaptive-poisson/python/demo_adaptive-poisson.py
index 89bc46e..28757ff 100755
--- a/demo/undocumented/adaptive-poisson/python/demo_adaptive-poisson.py
+++ b/demo/undocumented/adaptive-poisson/python/demo_adaptive-poisson.py
@@ -53,7 +53,7 @@ for level in range(MAX_ITER):
     V = FunctionSpace(mesh, "CG", 1)
     v = TestFunction(V)
     u = TrialFunction(V)
-    f = Expression(source_str)
+    f = Expression(source_str, degree=2)
     a = dot(grad(v), grad(u))*dx
     L = v*f*dx
 
@@ -66,7 +66,7 @@ for level in range(MAX_ITER):
     solve(a == L, u, bc)
 
     # Compute error indicators
-    h = array([c.diameter() for c in cells(mesh)])
+    h = array([c.h() for c in cells(mesh)])
     K = array([c.volume() for c in cells(mesh)])
     R = array([abs(source([c.midpoint().x(), c.midpoint().y()])) for c in cells(mesh)])
     gamma = h*R*sqrt(K)
diff --git a/demo/undocumented/advection-diffusion/cpp/AdvectionDiffusion.h b/demo/undocumented/advection-diffusion/cpp/AdvectionDiffusion.h
index 5543a00..d0d1ae9 100644
--- a/demo/undocumented/advection-diffusion/cpp/AdvectionDiffusion.h
+++ b/demo/undocumented/advection-diffusion/cpp/AdvectionDiffusion.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __ADVECTIONDIFFUSION_H
 #define __ADVECTIONDIFFUSION_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class advectiondiffusion_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   advectiondiffusion_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_finite_element_0()
+  ~advectiondiffusion_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -339,20 +352,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -361,26 +372,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,7 +409,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -412,7 +421,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,8 +430,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -520,7 +529,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -671,7 +680,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -822,7 +831,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -973,7 +982,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1124,7 +1133,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +1284,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1387,28 +1396,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1444,7 +1451,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1452,22 +1459,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1478,48 +1483,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1529,50 +1534,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1580,98 +1583,110 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new advectiondiffusion_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class advectiondiffusion_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   advectiondiffusion_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_finite_element_1()
+  ~advectiondiffusion_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1685,16 +1700,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1703,8 +1732,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2151,20 +2180,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2173,7 +2200,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -2181,21 +2208,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2215,7 +2240,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2227,7 +2252,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2236,8 +2261,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2335,7 +2360,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2486,7 +2511,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2637,7 +2662,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2788,7 +2813,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2939,7 +2964,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3090,7 +3115,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3241,7 +3266,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3392,7 +3417,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3543,7 +3568,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3694,7 +3719,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3845,7 +3870,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3996,7 +4021,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4108,28 +4133,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4165,7 +4188,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -4173,22 +4196,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -4199,96 +4220,96 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -4298,74 +4319,72 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4377,30 +4396,41 @@ public:
     vertex_values[5] = dof_values[8];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4419,84 +4449,102 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new advectiondiffusion_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class advectiondiffusion_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   advectiondiffusion_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_finite_element_2()
+  ~advectiondiffusion_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4505,8 +4553,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -4604,20 +4652,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -4626,26 +4672,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -4665,7 +4709,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4677,7 +4721,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4686,8 +4730,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -5139,28 +5183,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5196,7 +5238,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -5204,22 +5246,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -5230,24 +5270,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -5257,38 +5297,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -5296,141 +5334,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new advectiondiffusion_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class advectiondiffusion_dofmap_0: public ufc::dofmap
+class advectiondiffusion_finite_element_3: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  advectiondiffusion_dofmap_0() : ufc::dofmap()
+  advectiondiffusion_finite_element_3() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_dofmap_0()
+  ~advectiondiffusion_finite_element_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return true;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0] + num_global_entities[1];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 1;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -5438,194 +5421,1924 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 4;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 5;
-        break;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  std::size_t reference_value_size() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  std::size_t degree() const final override
   {
-    return new advectiondiffusion_dofmap_0();
+    return 1;
   }
 
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class advectiondiffusion_dofmap_1: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  advectiondiffusion_dofmap_1() : ufc::dofmap()
+  const char * family() const final override
   {
-    // Do nothing
+    return "Lagrange";
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_dofmap_1()
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new advectiondiffusion_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new advectiondiffusion_finite_element_2();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new advectiondiffusion_finite_element_3();
+  }
+
+};
+
+
+class advectiondiffusion_dofmap_0: public ufc::dofmap
+{
+public:
+
+  advectiondiffusion_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~advectiondiffusion_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return true;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0] + num_global_entities[1];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 1;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 4;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 5;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new advectiondiffusion_dofmap_0();
+  }
+
+};
+
+
+class advectiondiffusion_dofmap_1: public ufc::dofmap
+{
+public:
+
+  advectiondiffusion_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~advectiondiffusion_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return true;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0] + 2*num_global_entities[1];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 2;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
+      dofs[5] = 11;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 6;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 7;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 8;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 9;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+        dofs[1] = 10;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+        dofs[1] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new advectiondiffusion_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new advectiondiffusion_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new advectiondiffusion_dofmap_1();
+  }
+
+};
+
+
+class advectiondiffusion_dofmap_2: public ufc::dofmap
+{
+public:
+
+  advectiondiffusion_dofmap_2() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~advectiondiffusion_dofmap_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5636,7 +7349,7 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -5649,50 +7362,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2*num_global_entities[0] + 2*num_global_entities[1];
+    return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 1;
         break;
       }
     case 1:
       {
-        return 2;
+        return 0;
         break;
       }
     case 2:
@@ -5705,33 +7407,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5739,39 +7425,26 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -5792,19 +7465,16 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 8;
           break;
         }
       }
@@ -5813,33 +7483,7 @@ public:
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 9;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-        dofs[1] = 10;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-        dofs[1] = 11;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
@@ -5851,97 +7495,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new advectiondiffusion_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new advectiondiffusion_dofmap_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new advectiondiffusion_dofmap_1();
+    return new advectiondiffusion_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class advectiondiffusion_dofmap_2: public ufc::dofmap
+class advectiondiffusion_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  advectiondiffusion_dofmap_2() : ufc::dofmap()
+  advectiondiffusion_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_dofmap_2()
+  ~advectiondiffusion_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5965,45 +7557,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
@@ -6021,19 +7602,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6041,27 +7626,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6082,16 +7672,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -6112,70 +7705,63 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new advectiondiffusion_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new advectiondiffusion_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new advectiondiffusion_dofmap_2();
+    return new advectiondiffusion_dofmap_3();
   }
 
 };
 
-/// 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 advectiondiffusion_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   advectiondiffusion_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_cell_integral_0_otherwise()
+  ~advectiondiffusion_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    44
@@ -6184,7 +7770,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6239,38 +7825,31 @@ public:
 
 };
 
-/// 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 advectiondiffusion_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   advectiondiffusion_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_cell_integral_1_otherwise()
+  ~advectiondiffusion_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    122
@@ -6279,7 +7858,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6361,66 +7940,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class advectiondiffusion_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   advectiondiffusion_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_form_0()
+  ~advectiondiffusion_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "dfa7f7e5a6b13e2f171389e1ccba3f1947b7c19440f441967e68f1087fb9b14047ce5d23ebf369f9100726ee02fd0fb54a2edc784cd6ea87faa05f00b7b121b3";
+    return "14f7031d21c5c04d5b5ed7b663dee079c6b2b9124496795f96d0d1c94501b19f1e2c2379e1edddd8da3d3a670a05118ef40a5ebacb6f446d4d1bf3d8c528e13b";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new advectiondiffusion_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new advectiondiffusion_dofmap_3();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -6444,8 +8015,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -6469,192 +8039,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new advectiondiffusion_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class advectiondiffusion_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   advectiondiffusion_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_form_1()
+  ~advectiondiffusion_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "240bcdaa3f10571c3737d5e7efcaecb2d2819a6ce2e9241e952c2908ef2857034a52d001b778ffda3c0b1931ce94590dc1a505b95d68cbf83d3de322399ea121";
+    return "0911772983168b25a29a52dd63f148c18017aee4f42534046f4c026a6ccb8d5c6748141c767580bf86991f96e7667cc83cb91d7e13b602f5aabf680930f9aa06";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 3;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new advectiondiffusion_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new advectiondiffusion_dofmap_3();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -6683,8 +8281,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -6713,126 +8310,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_cell_integrals() const final override
   {
-    return 0;
+    return true;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  bool has_exterior_facet_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_vertex_integrals() const final override
   {
-    return true;
+    return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new advectiondiffusion_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -6846,14 +8479,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace AdvectionDiffusion
 {
@@ -6862,43 +8501,20 @@ class CoefficientSpace_b: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_b(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_b(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_b(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_b(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6909,43 +8525,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -6956,43 +8549,20 @@ class CoefficientSpace_u0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7003,43 +8573,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7050,45 +8597,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -7100,75 +8664,114 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 1), b(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
+    _ufc_form = std::make_shared<const advectiondiffusion_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& b):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> b):
     dolfin::Form(2, 1), b(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->b = b;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
+    _ufc_form = std::make_shared<const advectiondiffusion_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> b):
-    dolfin::Form(2, 1), b(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_a()
+  {}
 
-    this->b = *b;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "b")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 1), b(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "b";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_b;
+
+  // Coefficients
+  dolfin::CoefficientAssigner b;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& b):
-    dolfin::Form(2, 1), b(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), b(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->b = b;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> b):
-    dolfin::Form(2, 1), b(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> b):
+    dolfin::MultiMeshForm(V1, V0), b(*this, 0)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->b = *b;
+    /// Assign coefficients
+    this->b = b;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -7201,55 +8804,54 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_b;
 
   // Coefficients
-  dolfin::CoefficientAssigner b;
+  dolfin::MultiMeshCoefficientAssigner b;
 };
 
 class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -7265,77 +8867,126 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 3), u0(*this, 0), b(*this, 1), f(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
+    _ufc_form = std::make_shared<const advectiondiffusion_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& b, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> b, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 3), u0(*this, 0), b(*this, 1), f(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->u0 = u0;
     this->b = b;
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
+    _ufc_form = std::make_shared<const advectiondiffusion_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> b, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 3), u0(*this, 0), b(*this, 1), f(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->u0 = *u0;
-    this->b = *b;
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "u0")
+      return 0;
+    else if (name == "b")
+      return 1;
+    else if (name == "f")
+      return 2;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 3), u0(*this, 0), b(*this, 1), f(*this, 2)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "u0";
+    case 1:
+      return "b";
+    case 2:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_u0;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_b;
+  typedef Form_L_FunctionSpace_3 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u0;
+  dolfin::CoefficientAssigner b;
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& b, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 3), u0(*this, 0), b(*this, 1), f(*this, 2)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), u0(*this, 0), b(*this, 1), f(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->u0 = u0;
-    this->b = b;
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> b, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 3), u0(*this, 0), b(*this, 1), f(*this, 2)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> b, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), u0(*this, 0), b(*this, 1), f(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->u0 = *u0;
-    this->b = *b;
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->u0 = u0;
+    this->b = b;
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -7375,22 +9026,28 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_u0;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_b;
   typedef Form_L_FunctionSpace_3 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner u0;
-  dolfin::CoefficientAssigner b;
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner u0;
+  dolfin::MultiMeshCoefficientAssigner b;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/advection-diffusion/cpp/CMakeLists.txt b/demo/undocumented/advection-diffusion/cpp/CMakeLists.txt
index 658ab33..47e917d 100644
--- a/demo/undocumented/advection-diffusion/cpp/CMakeLists.txt
+++ b/demo/undocumented/advection-diffusion/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/advection-diffusion/cpp/Velocity.h b/demo/undocumented/advection-diffusion/cpp/Velocity.h
index bb1bfdb..cadd365 100644
--- a/demo/undocumented/advection-diffusion/cpp/Velocity.h
+++ b/demo/undocumented/advection-diffusion/cpp/Velocity.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __VELOCITY_H
 #define __VELOCITY_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class velocity_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   velocity_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_finite_element_0()
+  ~velocity_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -339,20 +352,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -361,26 +372,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,7 +409,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -412,7 +421,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,8 +430,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -520,7 +529,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -671,7 +680,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -822,7 +831,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -973,7 +982,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1124,7 +1133,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +1284,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1387,28 +1396,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1444,7 +1451,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1452,22 +1459,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1478,48 +1483,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1529,50 +1534,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1580,98 +1583,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new velocity_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class velocity_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   velocity_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_finite_element_1()
+  ~velocity_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1685,16 +1676,54 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1703,8 +1732,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2151,20 +2180,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2173,7 +2200,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -2181,21 +2208,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2215,7 +2240,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2227,7 +2252,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2236,8 +2261,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2335,7 +2360,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2486,7 +2511,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2637,7 +2662,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2788,7 +2813,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2939,7 +2964,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3090,7 +3115,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3241,7 +3266,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3392,7 +3417,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3543,7 +3568,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3694,7 +3719,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3845,7 +3870,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3996,7 +4021,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4108,28 +4133,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4165,7 +4188,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -4173,22 +4196,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -4199,96 +4220,96 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -4298,74 +4319,72 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4377,30 +4396,41 @@ public:
     vertex_values[5] = dof_values[8];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4419,41 +4449,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new velocity_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class velocity_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   velocity_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_dofmap_0()
+  ~velocity_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4477,39 +4500,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4533,25 +4545,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4580,9 +4590,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4656,71 +4665,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new velocity_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class velocity_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   velocity_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_dofmap_1()
+  ~velocity_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4744,39 +4727,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4800,33 +4772,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4864,9 +4834,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4946,44 +4915,13 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5002,8 +4940,7 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new velocity_dofmap_1();
   }
@@ -5017,14 +4954,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Velocity
 {
@@ -5033,43 +4976,20 @@ class FunctionSpace: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
diff --git a/demo/undocumented/advection-diffusion/cpp/compile.log b/demo/undocumented/advection-diffusion/cpp/compile.log
index 83a9fd5..5e7e662 100644
--- a/demo/undocumented/advection-diffusion/cpp/compile.log
+++ b/demo/undocumented/advection-diffusion/cpp/compile.log
@@ -1,12 +1,13 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling element Velocity
 
-Compiler stage 1: Analyzing form(s)
------------------------------------
+Compiler stage 1: Analyzing elements(s)
+---------------------------------------
   
-Compiler stage 1 finished in 0.00019908 seconds.
+Compiler stage 1 finished in 0.000267982 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -15,259 +16,48 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 2 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 0 coordinate mappings
   Computing representation of integrals
   Computing representation of forms
   
-Compiler stage 2 finished in 0.059453 seconds.
+Compiler stage 2 finished in 0.113754 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000116825 seconds.
+Compiler stage 3 finished in 0.000124931 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 2 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 2 dofmap(s)
+  Generating code for 0 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.179184 seconds.
+Compiler stage 4 finished in 0.173298 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000230074 seconds.
+Compiler stage 4.1 finished in 0.000211954 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Velocity.h.
-Compiler stage 5 finished in 0.000646114 seconds.
+Compiler stage 5 finished in 0.000473022 seconds.
 
-FFC finished in 0.240111 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.288462 seconds.
+Output written to ./Velocity.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form AdvectionDiffusion
 
@@ -280,8 +70,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    1
   Coefficients:              '[w_1]'
-  Unique elements:           'CG1(?), Vector<2 x CG2(?)>'
-  Unique sub elements:       'CG1(?), Vector<2 x CG2(?)>, CG2(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG2(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG2(?)>, Vector<2 x CG1(?)>, CG2(?)
+                             '
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -295,9 +86,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -305,8 +96,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    3
   Coefficients:              '[w_0, w_1, w_2]'
-  Unique elements:           'CG1(?), Vector<2 x CG2(?)>'
-  Unique sub elements:       'CG1(?), Vector<2 x CG2(?)>, CG2(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG2(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG2(?)>, Vector<2 x CG1(?)>, CG2(?)
+                             '
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -323,25 +115,35 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 3
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   
-Compiler stage 1 finished in 0.093585 seconds.
+Compiler stage 1 finished in 0.155089 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 3 elements
+  Computing representation of 4 elements
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 4 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -357,7 +159,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000592 seconds
+  9 entries computed in 0.000556 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -366,7 +168,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000645 seconds
+  36 entries computed in 0.000607 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -376,7 +178,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  432 entries computed in 0.00125 seconds
+  432 entries computed in 0.00115 seconds
   Shape of reference tensor: (3, 3, 2, 12, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 3 dims = [2, 12, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [0, 2, 0], [0, 2, 1], [0, 3, 0], [0, 3, 1], [0, 4, 0], [0, 4, 1], [0, 5, 0], [0, 5, 1], [0, 6, 0], [0, 6, 1], [0, 7, 0], [0, 7, 1], [0, 8, 0], [0, 8, 1], [0, 9, 0], [0, 9, 1], [0, 10, 0], [0, 10, 1], [0, 11, 0], [0, 11, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1], [1, 2, 0], [1, 2, 1], [1, 3, 0], [1, 3, 1], [1, 4, 0], [1, 4, 1], [1, 5, 0], [1, 5, 1], [1, 6, 0], [1, 6, 1], [1, 7,  [...]
@@ -385,6 +187,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -401,7 +204,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.00056 seconds
+  9 entries computed in 0.000535 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -410,7 +213,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000548 seconds
+  9 entries computed in 0.000524 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -419,7 +222,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000631 seconds
+  36 entries computed in 0.000626 seconds
   Shape of reference tensor: (3, 2, 3, 2)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 3 dims = [2, 3, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [0, 2, 0], [0, 2, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1], [1, 2, 0], [1, 2, 1]]
@@ -429,7 +232,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  432 entries computed in 0.00125 seconds
+  432 entries computed in 0.00113 seconds
   Shape of reference tensor: (3, 3, 2, 12, 2)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 4 dims = [3, 2, 12, 2] indices = [[0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 0, 1, 1], [0, 0, 2, 0], [0, 0, 2, 1], [0, 0, 3, 0], [0, 0, 3, 1], [0, 0, 4, 0], [0, 0, 4, 1], [0, 0, 5, 0], [0, 0, 5, 1], [0, 0, 6, 0], [0, 0, 6, 1], [0, 0, 7, 0], [0, 0, 7, 1], [0, 0, 8, 0], [0, 0, 8, 1], [0, 0, 9, 0], [0, 0, 9, 1], [0, 0, 10, 0], [0, 0, 10, 1], [0, 0, 11, 0], [0, 0, 11, 1], [0, 1, 0, 0], [0, 1, 0, 1], [0, 1, 1, 0], [0, 1, 1, 1], [0, 1, 2, 0], [0, 1, 2, 1], [0 [...]
@@ -438,298 +241,72 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.016382 seconds.
+Compiler stage 2 finished in 0.01947 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000138044 seconds.
+Compiler stage 3 finished in 0.000157118 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 3 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Generating code for 4 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 3 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 4 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.21171 seconds.
+Compiler stage 4 finished in 0.263447 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000651836 seconds.
+Compiler stage 4.1 finished in 0.000663996 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./AdvectionDiffusion.h.
-Compiler stage 5 finished in 0.000758886 seconds.
+Compiler stage 5 finished in 0.000643015 seconds.
 
-FFC finished in 0.323529 seconds.
+FFC finished in 0.439816 seconds.
+Output written to ./AdvectionDiffusion.h.
diff --git a/demo/undocumented/advection-diffusion/cpp/main.cpp b/demo/undocumented/advection-diffusion/cpp/main.cpp
index c8b53e5..413b49b 100644
--- a/demo/undocumented/advection-diffusion/cpp/main.cpp
+++ b/demo/undocumented/advection-diffusion/cpp/main.cpp
@@ -27,33 +27,32 @@
 #include <dolfin.h>
 #include "AdvectionDiffusion.h"
 #include "Velocity.h"
-#include <dolfin/io/XMLFile.h>
 
 using namespace dolfin;
 
 int main(int argc, char *argv[])
 {
   // Read mesh
-  Mesh mesh("../dolfin_fine.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../dolfin_fine.xml.gz");
 
   // Create velocity FunctionSpace
-  Velocity::FunctionSpace V_u(mesh);
+  auto V_u = std::make_shared<Velocity::FunctionSpace>(mesh);
 
   // Create velocity function
-  Function velocity(V_u);
-  XMLFile file_u(mesh.mpi_comm(), "../dolfin_fine_velocity.xml.gz");
-  file_u >> velocity;
+  auto velocity = std::make_shared<Function>(V_u);
+  File file_u(mesh->mpi_comm(), "../dolfin_fine_velocity.xml.gz");
+  file_u >> *velocity;
 
   // Read sub domain markers
-  MeshFunction<std::size_t> sub_domains(mesh,
+  auto sub_domains = std::make_shared<MeshFunction<std::size_t>>(mesh,
                                         "../dolfin_fine_subdomains.xml.gz");
 
   // Create function space
-  AdvectionDiffusion::FunctionSpace V(mesh);
+  auto V = std::make_shared<AdvectionDiffusion::FunctionSpace>(mesh);
 
   // Source term and initial condition
-  Constant f(0.0);
-  Function u(V);
+  auto f = std::make_shared<Constant>(0.0);
+  auto u = std::make_shared<Function>(V);
 
   // Set up forms
   AdvectionDiffusion::BilinearForm a(V, V);
@@ -62,12 +61,9 @@ int main(int argc, char *argv[])
   L.u0 = u; L.b = velocity; L.f = f;
 
   // Set up boundary condition
-  Constant g(1.0);
+  auto g = std::make_shared<Constant>(1.0);
   DirichletBC bc(V, g, sub_domains, 1);
 
-  // Solution
-  Function u1(V);
-
   // Linear system
   std::shared_ptr<Matrix> A(new Matrix);
   Vector b;
@@ -97,17 +93,17 @@ int main(int argc, char *argv[])
     bc.apply(b);
 
     // Solve the linear system (re-use the already factorized matrix A)
-    lu.solve(*u.vector(), b);
+    lu.solve(*u->vector(), b);
 
     // Save solution in VTK format
-    file << std::pair<const Function*, double>(&u, t);
+    file << std::pair<const Function*, double>(u.get(), t);
 
     // Move to next interval
-    p = t / T;
+    p = t/T;
     t += k;
   }
 
   // Plot solution
-  plot(u);
+  plot(*u);
   interactive();
 }
diff --git a/demo/undocumented/ale/cpp/CMakeLists.txt b/demo/undocumented/ale/cpp/CMakeLists.txt
index 6628a30..b8b43f0 100644
--- a/demo/undocumented/ale/cpp/CMakeLists.txt
+++ b/demo/undocumented/ale/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/ale/cpp/main.cpp b/demo/undocumented/ale/cpp/main.cpp
index fc8c2f8..7a32abc 100644
--- a/demo/undocumented/ale/cpp/main.cpp
+++ b/demo/undocumented/ale/cpp/main.cpp
@@ -31,30 +31,33 @@ using namespace dolfin;
 int main()
 {
   // Create mesh
-  UnitSquareMesh mesh(20, 20);
+  auto mesh = std::make_shared<UnitSquareMesh>(20, 20);
 
   // Create boundary mesh
-  BoundaryMesh boundary(mesh, "exterior");
+  BoundaryMesh boundary(*mesh, "exterior");
 
   // Move vertices in boundary
   MeshGeometry& geometry = boundary.geometry();
+
+  std::vector<double> x(2);
   for (VertexIterator v(boundary); !v.end(); ++v)
   {
-    double* x = geometry.x(v->index());
-    x[0] *= 3.0;
-    x[1] += 0.1*sin(5.0*x[0]);
+    std::size_t i = v->index();
+    x[0] = geometry.x(i, 0)*3.0;
+    x[1] = geometry.x(i, 1) + 0.1*sin(5.0*x[0]);
+    geometry.set(i, x.data());
   }
 
   // Move mesh
-  mesh.move(boundary);
+  ALE::move(mesh, boundary);
 
   // Plot mesh
-  plot(mesh);
+  plot(*mesh);
   interactive();
 
   // Write mesh to file
   File file("mesh_deformed.pvd");
-  file << mesh;
+  file << *mesh;
 
   return 0;
 }
diff --git a/demo/undocumented/ale/python/demo_ale.py b/demo/undocumented/ale/python/demo_ale.py
index 4464d30..fa358fc 100644
--- a/demo/undocumented/ale/python/demo_ale.py
+++ b/demo/undocumented/ale/python/demo_ale.py
@@ -37,7 +37,7 @@ for x in boundary.coordinates():
     x[1] += 0.1*sin(5.0*x[0])
 
 # Move mesh
-mesh.move(boundary)
+ALE.move(mesh, boundary)
 
 # Plot mesh
 plot(mesh, interactive=True)
diff --git a/demo/undocumented/auto-adaptive-navier-stokes/cpp/AdaptiveNavierStokes.h b/demo/undocumented/auto-adaptive-navier-stokes/cpp/AdaptiveNavierStokes.h
index d0ecef9..1469435 100644
--- a/demo/undocumented/auto-adaptive-navier-stokes/cpp/AdaptiveNavierStokes.h
+++ b/demo/undocumented/auto-adaptive-navier-stokes/cpp/AdaptiveNavierStokes.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,388 +13,106 @@
 //   error_control:                  True
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __ADAPTIVENAVIERSTOKES_H
 #define __ADAPTIVENAVIERSTOKES_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class adaptivenavierstokes_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_0()
+  ~adaptivenavierstokes_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivenavierstokes_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivenavierstokes_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivenavierstokes_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_1()
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Bubble', Domain(Cell('triangle', 2)), 3, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
     return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -403,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -412,83 +130,134 @@ public:
     
     // Reset values
     *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-    
-    // Declare helper variables
-    double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-    double tmp1 = (1.0 - Y)/2.0;
-    double tmp2 = tmp1*tmp1;
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    basisvalues[1] = tmp0;
-    basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-    basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-    basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-    basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-    basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-    basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-    basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-    basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-    basisvalues[0] *= std::sqrt(0.5);
-    basisvalues[2] *= std::sqrt(1.0);
-    basisvalues[5] *= std::sqrt(1.5);
-    basisvalues[9] *= std::sqrt(2.0);
-    basisvalues[1] *= std::sqrt(3.0);
-    basisvalues[4] *= std::sqrt(4.5);
-    basisvalues[8] *= std::sqrt(6.0);
-    basisvalues[3] *= std::sqrt(7.5);
-    basisvalues[7] *= std::sqrt(10.0);
-    basisvalues[6] *= std::sqrt(14.0);
-    
-    // Table(s) of coefficients
-    static const double coefficients0[10] = \
-    {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 10; r++)
+    switch (i)
     {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -508,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -529,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[8][3];
-    for (unsigned int row = 0; row < 8; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 3; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -567,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[8][8];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -583,217 +352,482 @@ public:
           transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
     }
-    
-    // Array of basisvalues
-    double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-    
-    // Declare helper variables
-    double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-    double tmp1 = (1.0 - Y)/2.0;
-    double tmp2 = tmp1*tmp1;
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    basisvalues[1] = tmp0;
-    basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-    basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-    basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-    basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-    basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-    basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-    basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-    basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-    basisvalues[0] *= std::sqrt(0.5);
-    basisvalues[2] *= std::sqrt(1.0);
-    basisvalues[5] *= std::sqrt(1.5);
-    basisvalues[9] *= std::sqrt(2.0);
-    basisvalues[1] *= std::sqrt(3.0);
-    basisvalues[4] *= std::sqrt(4.5);
-    basisvalues[8] *= std::sqrt(6.0);
-    basisvalues[3] *= std::sqrt(7.5);
-    basisvalues[7] *= std::sqrt(10.0);
-    basisvalues[6] *= std::sqrt(14.0);
-    
-    // Table(s) of coefficients
-    static const double coefficients0[10] = \
-    {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-    
-    // Tables of derivatives of the polynomial base (transpose).
-    static const double dmats0[10][10] = \
-    {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-    
-    static const double dmats1[10][10] = \
-    {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-    {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-    {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-    {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-    
-    // Compute reference derivatives.
-    // Declare array of derivatives on FIAT element.
-    double derivatives[8];
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      derivatives[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Declare derivative matrix (of polynomial basis).
-    double dmats[10][10] = \
-    {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-    
-    // Declare (auxiliary) derivative matrix (of polynomial basis).
-    double dmats_old[10][10] = \
-    {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-    
-    // Loop possible derivatives.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    switch (i)
     {
-      // Resetting dmats values to compute next derivative.
-      for (unsigned int t = 0; t < 10; t++)
+    case 0:
       {
-        for (unsigned int u = 0; u < 10; u++)
-        {
-          dmats[t][u] = 0.0;
-          if (t == u)
-          {
-          dmats[t][u] = 1.0;
-          }
-          
-        } // end loop over 'u'
-      } // end loop over 't'
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Looping derivative order to generate dmats.
-      for (unsigned int s = 0; s < n; s++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        // Updating dmats_old with new values and resetting dmats.
-        for (unsigned int t = 0; t < 10; t++)
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
-            dmats_old[t][u] = dmats[t][u];
             dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
           } // end loop over 'u'
         } // end loop over 't'
         
-        // Update dmats using an inner product.
-        if (combinations[r][s] == 0)
-        {
-        for (unsigned int t = 0; t < 10; t++)
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int tu = 0; tu < 10; tu++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-            } // end loop over 'tu'
-          } // end loop over 'u'
-        } // end loop over 't'
-        }
-        
-        if (combinations[r][s] == 1)
-        {
-        for (unsigned int t = 0; t < 10; t++)
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int tu = 0; tu < 10; tu++)
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
             {
-              dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-            } // end loop over 'tu'
+            dmats[t][u] = 1.0;
+            }
+            
           } // end loop over 'u'
         } // end loop over 't'
-        }
         
-      } // end loop over 's'
-      for (unsigned int s = 0; s < 10; s++)
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
         } // end loop over 't'
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // Transform derivatives back to physical element
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[r] += transform[r][s]*derivatives[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -804,8 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -815,143 +865,178 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
-    vertex_values[0] = 0;
-    vertex_values[1] = 0;
-    vertex_values[2] = 0;
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new adaptivenavierstokes_finite_element_1();
+    return new adaptivenavierstokes_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class adaptivenavierstokes_finite_element_2: public ufc::finite_element
+class adaptivenavierstokes_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  adaptivenavierstokes_finite_element_2() : ufc::finite_element()
+  adaptivenavierstokes_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_2()
+  ~adaptivenavierstokes_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -960,50 +1045,43 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Reset values
-    *values = 0.0;
+    values[0] = 0.0;
+    values[1] = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1011,35 +1089,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1047,35 +1117,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1083,35 +1145,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1119,35 +1173,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1155,35 +1201,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1191,48 +1229,47 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
+    double dof_values[2] = {0.0, 0.0};
     
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1244,7 +1281,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -1252,19 +1289,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1273,18 +1310,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -1311,7 +1348,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -1333,81 +1370,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1422,9 +1439,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1434,11 +1451,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1448,11 +1465,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1461,9 +1478,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1484,81 +1501,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1573,9 +1570,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1585,11 +1582,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1599,11 +1596,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1612,9 +1609,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1635,81 +1632,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1724,9 +1701,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1736,11 +1713,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1750,11 +1727,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1763,9 +1740,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1786,81 +1763,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1875,9 +1832,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1887,11 +1844,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1901,11 +1858,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1914,9 +1871,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1928,7 +1885,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -1937,81 +1894,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2026,9 +1963,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2038,11 +1975,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2052,11 +1989,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2065,9 +2002,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2079,7 +2016,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -2088,81 +2025,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2177,9 +2094,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2189,11 +2106,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2203,11 +2120,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2216,9 +2133,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2230,7 +2147,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -2239,28 +2156,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2274,14 +2189,14 @@ public:
     // Set values equal to zero.
     for (unsigned int r = 0; r < 6; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = 0.0;
+        values[r*2*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
       return ;
     }
@@ -2296,33 +2211,31 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
+        values[r*2*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
@@ -2330,50 +2243,50 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
     }
@@ -2381,172 +2294,196 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    values[5] = vals[0];
+    values[5] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivenavierstokes_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivenavierstokes_finite_element_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new adaptivenavierstokes_finite_element_2();
+    return new adaptivenavierstokes_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class adaptivenavierstokes_finite_element_3: public ufc::finite_element
+class adaptivenavierstokes_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  adaptivenavierstokes_finite_element_3() : ufc::finite_element()
+  adaptivenavierstokes_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_3()
+  ~adaptivenavierstokes_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None), **{'value_shape': (2,) })";
+    return "FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 12;
+    return 10;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2555,23 +2492,22 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
+    *values = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2582,24 +2518,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2607,7 +2551,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2618,24 +2562,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2643,7 +2595,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2654,24 +2606,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2679,7 +2639,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2690,24 +2650,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2715,7 +2683,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2726,24 +2694,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2751,7 +2727,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2762,24 +2738,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2787,7 +2771,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2798,24 +2782,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2823,7 +2815,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2834,24 +2826,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2859,7 +2859,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2870,24 +2870,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2895,79 +2903,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 10:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -2978,24 +2914,32 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -3003,51 +2947,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
+    double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
-      {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -3059,7 +2996,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -3067,19 +3004,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 3)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3088,18 +3025,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[8][3];
+    for (unsigned int row = 0; row < 8; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 3; col++)
         combinations[row][col] = 0;
     }
     
@@ -3126,7 +3063,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[8][8];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -3148,7 +3085,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -3159,70 +3096,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3237,9 +3198,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3249,11 +3210,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3263,11 +3224,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3276,9 +3237,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3299,7 +3260,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -3310,70 +3271,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3388,9 +3373,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3400,11 +3385,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3414,11 +3399,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3427,9 +3412,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3450,7 +3435,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -3461,70 +3446,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3539,9 +3548,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3551,11 +3560,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3565,11 +3574,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3578,9 +3587,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3601,7 +3610,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -3612,70 +3621,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3690,9 +3723,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3702,11 +3735,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3716,11 +3749,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3729,9 +3762,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3752,7 +3785,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -3763,72 +3796,96 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
             if (t == u)
             {
             dmats[t][u] = 1.0;
@@ -3841,9 +3898,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3853,11 +3910,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3867,11 +3924,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3880,9 +3937,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3903,7 +3960,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -3914,70 +3971,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3992,9 +4073,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4004,11 +4085,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4018,11 +4099,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4031,9 +4112,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4054,7 +4135,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -4065,70 +4146,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4143,9 +4248,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4155,11 +4260,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4169,11 +4274,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4182,9 +4287,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4196,7 +4301,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -4205,7 +4310,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -4216,70 +4321,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4294,9 +4423,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4306,11 +4435,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4320,11 +4449,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4333,9 +4462,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4347,7 +4476,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -4356,7 +4485,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -4367,70 +4496,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4445,9 +4598,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4457,11 +4610,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4471,11 +4624,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4484,9 +4637,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4498,7 +4651,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -4507,7 +4660,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -4518,372 +4671,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 10:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4898,9 +4773,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4910,11 +4785,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4924,11 +4799,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4937,9 +4812,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4951,7 +4826,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -4960,28 +4835,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4993,16 +4866,16 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 10; r++)
     {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        values[r*2*num_derivatives + s] = 0.0;
+        values[r*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 3)
     {
       return ;
     }
@@ -5015,35 +4888,33 @@ public:
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        values[r*2*num_derivatives + s] = dof_values[s];
+        values[r*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[2];
+    double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
@@ -5051,98 +4922,82 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 10:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
     }
@@ -5150,205 +5005,220 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[2];
+    double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    values[6] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
     f.evaluate(vals, y, c);
-    values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    values[7] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
     f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    values[8] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    values[11] = vals[1];
+    values[9] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[3] = dof_values[7];
-    vertex_values[5] = dof_values[8];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[8] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[9] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[10] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[11] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[15] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[18] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[19] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new adaptivenavierstokes_finite_element_2();
-        break;
-      }
-    case 1:
-      {
-        return new adaptivenavierstokes_finite_element_2();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new adaptivenavierstokes_finite_element_3();
+    return new adaptivenavierstokes_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class adaptivenavierstokes_finite_element_4: public ufc::finite_element
+class adaptivenavierstokes_finite_element_3: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  adaptivenavierstokes_finite_element_4() : ufc::finite_element()
+  adaptivenavierstokes_finite_element_3() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_4()
+  ~adaptivenavierstokes_finite_element_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 3), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 20;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_dimension(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5357,42 +5227,59 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Reset values
-    *values = 0.0;
+    values[0] = 0.0;
+    values[1] = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -5400,27 +5287,43 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -5428,867 +5331,227 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivenavierstokes_finite_element_4();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivenavierstokes_finite_element_5: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivenavierstokes_finite_element_5() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_5()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "MixedElement(MixedElement(FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None), **{'value_shape': (2,) }), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 15;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6299,32 +5562,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6335,32 +5606,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6371,32 +5650,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 10:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6407,32 +5694,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 11:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6443,32 +5738,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 12:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6479,32 +5782,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 13:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6515,32 +5826,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
         values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 14:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6551,32 +5870,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
         values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 15:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6587,32 +5914,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
         values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 16:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6623,32 +5958,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
         values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 17:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6659,32 +6002,40 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
         values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 18:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6695,108 +6046,76 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
         values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 12:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 13:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 14:
+    case 19:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[10] = \
+      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -6804,51 +6123,47 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
+    double dof_values[2] = {0.0, 0.0};
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 15; r++)
+    for (unsigned int r = 0; r < 20; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
       {
-        values[r*3 + s] = dof_values[s];
+        values[r*2 + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -6860,7 +6175,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -6868,19 +6183,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 3)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6889,18 +6204,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[8][3];
+    for (unsigned int row = 0; row < 8; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 3; col++)
         combinations[row][col] = 0;
     }
     
@@ -6927,7 +6242,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[8][8];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -6949,7 +6264,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -6960,70 +6275,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -7038,9 +6377,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -7050,11 +6389,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7064,11 +6403,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7077,9 +6416,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -7100,7 +6439,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -7111,70 +6450,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -7189,9 +6552,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -7201,11 +6564,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7215,11 +6578,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7228,9 +6591,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -7251,7 +6614,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -7262,70 +6625,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -7340,9 +6727,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -7352,11 +6739,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7366,11 +6753,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7379,9 +6766,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -7402,7 +6789,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -7413,70 +6800,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -7491,9 +6902,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -7503,11 +6914,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7517,11 +6928,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7530,9 +6941,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -7553,7 +6964,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -7564,70 +6975,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -7642,9 +7077,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -7654,11 +7089,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7668,11 +7103,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7681,9 +7116,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -7704,7 +7139,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -7715,70 +7150,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -7793,9 +7252,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -7805,11 +7264,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7819,11 +7278,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7832,9 +7291,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -7855,7 +7314,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -7866,70 +7325,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -7944,9 +7427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -7956,11 +7439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7970,11 +7453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -7983,9 +7466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -7997,7 +7480,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -8006,7 +7489,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -8017,70 +7500,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -8095,9 +7602,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -8107,11 +7614,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8121,11 +7628,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8134,9 +7641,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -8148,7 +7655,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -8157,7 +7664,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -8168,70 +7675,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -8246,9 +7777,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -8258,11 +7789,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8272,11 +7803,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8285,9 +7816,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -8299,7 +7830,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -8308,7 +7839,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -8319,70 +7850,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -8397,9 +7952,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -8409,11 +7964,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8423,11 +7978,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8436,9 +7991,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -8450,7 +8005,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -8459,7 +8014,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -8470,70 +8025,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -8548,9 +8127,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -8560,11 +8139,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8574,11 +8153,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8587,9 +8166,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -8610,7 +8189,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -8621,70 +8200,94 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -8699,9 +8302,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -8711,11 +8314,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8725,11 +8328,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8738,9 +8341,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -8761,61 +8364,105 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -8830,9 +8477,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -8842,11 +8489,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8856,11 +8503,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8869,9 +8516,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -8883,7 +8530,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -8892,61 +8539,105 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -8961,9 +8652,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -8973,11 +8664,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -8987,11 +8678,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -9000,9 +8691,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -9014,7 +8705,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -9023,61 +8714,105 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -9092,9 +8827,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -9104,11 +8839,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -9118,11 +8853,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -9131,9 +8866,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -9145,464 +8880,187 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 15; r++)
-    {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[12];
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 15; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 8:
+    case 15:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 9:
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 10:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 12:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 13:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 14:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[12] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[13] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[14] = vals[2];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[4] = dof_values[7];
-    vertex_values[7] = dof_values[8];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[12];
-    vertex_values[5] = dof_values[13];
-    vertex_values[8] = dof_values[14];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new adaptivenavierstokes_finite_element_3();
-        break;
-      }
-    case 1:
-      {
-        return new adaptivenavierstokes_finite_element_4();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivenavierstokes_finite_element_5();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivenavierstokes_finite_element_6: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivenavierstokes_finite_element_6() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_6()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 10;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 16:
       {
         
       // Array of basisvalues
@@ -9637,60 +9095,147 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 17:
       {
         
       // Array of basisvalues
@@ -9725,60 +9270,147 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 18:
       {
         
       // Array of basisvalues
@@ -9813,413 +9445,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[8][3];
-    for (unsigned int row = 0; row < 8; row++)
-    {
-      for (unsigned int col = 0; col < 3; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[8][8];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -10229,21 +9455,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -10354,12 +9580,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 19:
       {
         
       // Array of basisvalues
@@ -10394,7 +9620,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[10][10] = \
@@ -10404,21 +9630,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -10529,191 +9755,563 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 20; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 3)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[16];
+    for (unsigned int r = 0; r < 16; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 20; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 3:
       {
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 12:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 13:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 14:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 15:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 16:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 17:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 18:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 19:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[12] = vals[1];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[13] = vals[1];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[14] = vals[1];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[15] = vals[1];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[16] = vals[1];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[17] = vals[1];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[18] = vals[1];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[19] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[10];
+    vertex_values[3] = dof_values[11];
+    vertex_values[5] = dof_values[12];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[8] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[9] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[10] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[11] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[15] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[18] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[19] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[20] = coordinate_dofs[0];
+    dof_coordinates[21] = coordinate_dofs[1];
+    dof_coordinates[22] = coordinate_dofs[2];
+    dof_coordinates[23] = coordinate_dofs[3];
+    dof_coordinates[24] = coordinate_dofs[4];
+    dof_coordinates[25] = coordinate_dofs[5];
+    dof_coordinates[26] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[27] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[28] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[29] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[30] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[31] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[32] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[33] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[34] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[35] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[36] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[37] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[38] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[39] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivenavierstokes_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivenavierstokes_finite_element_2();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivenavierstokes_finite_element_3();
+  }
+
+};
+
+
+class adaptivenavierstokes_finite_element_4: public ufc::finite_element
+{
+public:
+
+  adaptivenavierstokes_finite_element_4() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivenavierstokes_finite_element_4() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -10724,163 +10322,132 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -10888,7 +10455,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -10899,94 +10466,280 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -11001,9 +10754,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -11013,11 +10766,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11027,11 +10780,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11040,9 +10793,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -11059,11 +10812,11 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -11074,94 +10827,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -11176,9 +10905,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -11188,11 +10917,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11202,11 +10931,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11215,9 +10944,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -11234,11 +10963,11 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -11249,94 +10978,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -11351,9 +11056,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -11363,11 +11068,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11377,11 +11082,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11390,9 +11095,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -11409,11 +11114,11 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -11424,94 +11129,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -11526,9 +11207,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -11538,11 +11219,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11552,11 +11233,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11565,9 +11246,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -11584,11 +11265,11 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -11599,94 +11280,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -11701,9 +11358,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -11713,11 +11370,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11727,11 +11384,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11740,9 +11397,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -11759,11 +11416,11 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -11774,94 +11431,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -11876,9 +11509,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -11888,11 +11521,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11902,11 +11535,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -11915,9 +11548,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -11938,28 +11571,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -11971,7 +11602,7 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
+    for (unsigned int r = 0; r < 6; r++)
     {
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
@@ -11980,22 +11611,22 @@ public:
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
+    if (n > 2)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
+    for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -12003,22 +11634,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -12029,80 +11658,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -12112,66 +11709,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -12179,104 +11758,92 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new adaptivenavierstokes_finite_element_6();
+    return new adaptivenavierstokes_finite_element_4();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class adaptivenavierstokes_finite_element_7: public ufc::finite_element
+class adaptivenavierstokes_finite_element_5: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  adaptivenavierstokes_finite_element_7() : ufc::finite_element()
+  adaptivenavierstokes_finite_element_5() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_7()
+  ~adaptivenavierstokes_finite_element_5() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), **{'value_shape': (2,) })";
+    return "MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 3), dim=2), FiniteElement('Lagrange', triangle, 2))";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 20;
+    return 26;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return 2;
+        return 3;
         break;
       }
     }
@@ -12284,26 +11851,64 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
+  std::size_t value_size() const final override
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -12312,6 +11917,7 @@ public:
     // Reset values
     values[0] = 0.0;
     values[1] = 0.0;
+    values[2] = 0.0;
     switch (i)
     {
     case 0:
@@ -13194,55 +12800,267 @@ public:
       } // end loop over 'r'
         break;
       }
+    case 20:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 21:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 22:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 23:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 24:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 25:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
     }
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
+    double dof_values[3] = {0.0, 0.0, 0.0};
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 20; r++)
+    for (unsigned int r = 0; r < 26; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
       {
-        values[r*2 + s] = dof_values[s];
+        values[r*3 + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -13254,7 +13072,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -13262,7 +13080,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -13274,7 +13092,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -13283,8 +13101,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -13384,21 +13202,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -13559,21 +13377,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -13734,21 +13552,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -13909,21 +13727,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -14084,21 +13902,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -14259,21 +14077,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -14434,21 +14252,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -14609,21 +14427,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -14784,21 +14602,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -14959,21 +14777,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -15134,21 +14952,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -15309,21 +15127,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -15484,21 +15302,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -15659,21 +15477,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -15834,21 +15652,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -16009,21 +15827,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -16184,21 +16002,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -16359,21 +16177,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -16534,21 +16352,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -16709,21 +16527,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -16839,515 +16657,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 20; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[16];
-    for (unsigned int r = 0; r < 16; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 20; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 10:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 12:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 13:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 14:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 15:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 16:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 17:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 18:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 19:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[12] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[13] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[14] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[15] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[16] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[17] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[18] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[19] = vals[1];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[10];
-    vertex_values[3] = dof_values[11];
-    vertex_values[5] = dof_values[12];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new adaptivenavierstokes_finite_element_6();
-        break;
-      }
-    case 1:
-      {
-        return new adaptivenavierstokes_finite_element_6();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivenavierstokes_finite_element_7();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivenavierstokes_finite_element_8: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivenavierstokes_finite_element_8() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_8()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 6;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 20:
       {
         
       // Array of basisvalues
@@ -17376,50 +16686,129 @@ public:
       static const double coefficients0[6] = \
       {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 21:
       {
         
       // Array of basisvalues
@@ -17446,293 +16835,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -17748,13 +16851,13 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
@@ -17851,12 +16954,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 22:
       {
         
       // Array of basisvalues
@@ -17883,7 +16986,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -17899,13 +17002,13 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
@@ -18002,12 +17105,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 23:
       {
         
       // Array of basisvalues
@@ -18034,7 +17137,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -18050,13 +17153,13 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
@@ -18153,12 +17256,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 24:
       {
         
       // Array of basisvalues
@@ -18185,7 +17288,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -18201,13 +17304,13 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
@@ -18304,163 +17407,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 25:
       {
         
       // Array of basisvalues
@@ -18503,13 +17455,13 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
@@ -18606,7 +17558,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -18615,28 +17567,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -18648,57 +17598,55 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 26; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = 0.0;
+        values[r*3*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 3)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
+    double dof_values[24];
+    for (unsigned int r = 0; r < 24; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 26; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
+        values[r*3*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[3];
     
     // Declare variable for physical coordinates
     double y[2];
@@ -18706,206 +17654,518 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
+    case 10:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 12:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 13:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 14:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 15:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 16:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 17:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 18:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 19:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 20:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 21:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 22:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 23:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 24:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 25:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
     }
     
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[3];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[12] = vals[1];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[13] = vals[1];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[14] = vals[1];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[15] = vals[1];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[16] = vals[1];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[17] = vals[1];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[18] = vals[1];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[19] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[20] = vals[2];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[21] = vals[2];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[22] = vals[2];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[23] = vals[2];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[24] = vals[2];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[25] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[10];
+    vertex_values[4] = dof_values[11];
+    vertex_values[7] = dof_values[12];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[20];
+    vertex_values[5] = dof_values[21];
+    vertex_values[8] = dof_values[22];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[8] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[9] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[10] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[11] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[15] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[18] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[19] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[20] = coordinate_dofs[0];
+    dof_coordinates[21] = coordinate_dofs[1];
+    dof_coordinates[22] = coordinate_dofs[2];
+    dof_coordinates[23] = coordinate_dofs[3];
+    dof_coordinates[24] = coordinate_dofs[4];
+    dof_coordinates[25] = coordinate_dofs[5];
+    dof_coordinates[26] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[27] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[28] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[29] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[30] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[31] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[32] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[33] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[34] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[35] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[36] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[37] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[38] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[39] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[40] = coordinate_dofs[0];
+    dof_coordinates[41] = coordinate_dofs[1];
+    dof_coordinates[42] = coordinate_dofs[2];
+    dof_coordinates[43] = coordinate_dofs[3];
+    dof_coordinates[44] = coordinate_dofs[4];
+    dof_coordinates[45] = coordinate_dofs[5];
+    dof_coordinates[46] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[47] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[48] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[49] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[50] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[51] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivenavierstokes_finite_element_3();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivenavierstokes_finite_element_4();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new adaptivenavierstokes_finite_element_8();
+    return new adaptivenavierstokes_finite_element_5();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class adaptivenavierstokes_finite_element_9: public ufc::finite_element
+class adaptivenavierstokes_finite_element_6: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  adaptivenavierstokes_finite_element_9() : ufc::finite_element()
+  adaptivenavierstokes_finite_element_6() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_9()
+  ~adaptivenavierstokes_finite_element_6() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(MixedElement(FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), **{'value_shape': (2,) }), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None), **{'value_shape': (3,) })";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 26;
+    return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return 3;
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
         break;
       }
     }
@@ -18913,16 +18173,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -18931,8 +18205,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -18941,14 +18215,13 @@ public:
     // Reset values
     values[0] = 0.0;
     values[1] = 0.0;
-    values[2] = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -18959,30 +18232,22 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -18992,7 +18257,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19003,30 +18268,22 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -19036,7 +18293,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19047,30 +18304,22 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -19080,7 +18329,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19091,30 +18340,22 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -19124,7 +18365,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19135,30 +18376,22 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -19168,7 +18401,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19179,30 +18412,22 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -19212,7 +18437,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19223,32 +18448,24 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -19256,7 +18473,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19267,32 +18484,24 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -19300,7 +18509,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19311,32 +18520,24 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -19344,7 +18545,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19355,32 +18556,24 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -19388,7 +18581,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19399,30 +18592,22 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -19432,7 +18617,7 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19443,40 +18628,173 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 6; r++)
       {
         values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 12:
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19487,40 +18805,147 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 13:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19531,40 +18956,147 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 14:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19575,84 +19107,147 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 15:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 16:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19663,84 +19258,147 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 17:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 18:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -19751,80 +19409,143 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 19:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 20:
+    case 5:
       {
         
       // Array of basisvalues
@@ -19851,443 +19572,58 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 21:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 22:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 23:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 24:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 25:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 26; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[8][3];
-    for (unsigned int row = 0; row < 8; row++)
-    {
-      for (unsigned int col = 0; col < 3; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[8][8];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -20302,9 +19638,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -20314,11 +19650,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -20328,11 +19664,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -20341,9 +19677,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -20360,11 +19696,11 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -20375,94 +19711,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -20477,9 +19789,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -20489,11 +19801,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -20503,11 +19815,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -20516,9 +19828,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -20530,16 +19842,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -20550,94 +19862,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -20652,9 +19940,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -20664,11 +19952,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -20678,11 +19966,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -20691,9 +19979,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -20705,16 +19993,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -20725,94 +20013,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -20827,9 +20091,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -20839,11 +20103,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -20853,11 +20117,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -20866,9 +20130,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -20880,16 +20144,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -20900,94 +20164,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -21002,9 +20242,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -21014,11 +20254,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -21028,11 +20268,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -21041,9 +20281,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -21055,16 +20295,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 10:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -21075,94 +20315,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -21177,9 +20393,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -21189,11 +20405,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -21203,11 +20419,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -21216,9 +20432,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -21230,16 +20446,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 11:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -21250,94 +20466,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -21352,9 +20544,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -21364,11 +20556,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -21378,11 +20570,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -21391,9 +20583,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -21405,16 +20597,471 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
     case 7:
       {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[1];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[6];
+    vertex_values[3] = dof_values[7];
+    vertex_values[5] = dof_values[8];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivenavierstokes_finite_element_4();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivenavierstokes_finite_element_4();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivenavierstokes_finite_element_6();
+  }
+
+};
+
+
+class adaptivenavierstokes_finite_element_7: public ufc::finite_element
+{
+public:
+
+  adaptivenavierstokes_finite_element_7() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivenavierstokes_finite_element_7() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 15;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -21425,171 +21072,140 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -21600,171 +21216,68 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -21775,171 +21288,68 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -21950,94 +21360,439 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 12:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 13:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 14:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 15; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -22052,9 +21807,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -22064,11 +21819,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22078,11 +21833,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22091,9 +21846,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -22105,16 +21860,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -22125,94 +21880,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -22227,9 +21958,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -22239,11 +21970,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22253,11 +21984,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22266,9 +21997,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -22280,16 +22011,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 12:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -22300,94 +22031,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -22402,9 +22109,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -22414,11 +22121,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22428,11 +22135,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22441,9 +22148,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -22455,16 +22162,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 13:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -22475,94 +22182,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -22577,9 +22260,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -22589,11 +22272,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22603,11 +22286,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22616,9 +22299,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -22630,16 +22313,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 14:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -22650,94 +22333,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -22752,9 +22411,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -22764,11 +22423,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22778,11 +22437,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22791,9 +22450,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -22805,16 +22464,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 15:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -22825,94 +22484,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -22927,9 +22562,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -22939,11 +22574,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22953,11 +22588,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -22966,9 +22601,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -22980,16 +22615,16 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 16:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -23000,94 +22635,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -23102,9 +22713,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -23114,11 +22725,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -23128,11 +22739,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -23141,9 +22752,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -23160,11 +22771,11 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 17:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -23175,94 +22786,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -23277,9 +22864,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -23289,11 +22876,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -23303,11 +22890,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -23316,9 +22903,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -23335,11 +22922,11 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 18:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -23350,94 +22937,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -23452,9 +23015,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -23464,11 +23027,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -23478,11 +23041,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -23491,9 +23054,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -23510,11 +23073,11 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 19:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
@@ -23525,94 +23088,70 @@ public:
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
       basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
       basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
       basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
       basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
       basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -23627,9 +23166,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -23639,11 +23178,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -23653,11 +23192,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -23666,9 +23205,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -23685,7 +23224,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 20:
+    case 10:
       {
         
       // Array of basisvalues
@@ -23712,7 +23251,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -23728,13 +23267,13 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
@@ -23831,12 +23370,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 21:
+    case 11:
       {
         
       // Array of basisvalues
@@ -23863,7 +23402,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -23879,13 +23418,13 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
@@ -23982,241 +23521,70 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 22:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 23:
+    case 12:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -24231,9 +23599,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -24243,11 +23611,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -24257,11 +23625,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -24270,9 +23638,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -24289,85 +23657,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 24:
+    case 13:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -24382,9 +23730,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -24394,11 +23742,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -24408,11 +23756,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -24421,9 +23769,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -24440,85 +23788,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 25:
+    case 14:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -24533,9 +23861,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -24545,11 +23873,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -24559,11 +23887,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -24572,9 +23900,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -24595,28 +23923,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -24628,7 +23954,7 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 26; r++)
+    for (unsigned int r = 0; r < 15; r++)
     {
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
@@ -24637,22 +23963,22 @@ public:
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
+    if (n > 2)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[24];
-    for (unsigned int r = 0; r < 24; r++)
+    double dof_values[12];
+    for (unsigned int r = 0; r < 12; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 26; r++)
+    for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -24660,22 +23986,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -24686,208 +24010,120 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[0];
+      return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 12:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 13:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 14:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 15:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 16:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 17:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 18:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 19:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 20:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
-    case 21:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 22:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 23:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 24:
+    case 13:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
-    case 25:
+    case 14:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -24897,180 +24133,151 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    values[8] = vals[1];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    values[9] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    values[9] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
-    values[12] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    values[12] = vals[2];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
-    values[13] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[14] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[15] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[16] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[17] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[18] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[19] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[20] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[21] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[22] = vals[2];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[23] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[24] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    values[13] = vals[2];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    values[25] = vals[2];
+    values[14] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
     vertex_values[3] = dof_values[1];
     vertex_values[6] = dof_values[2];
     // Evaluate function and change variables
-    vertex_values[1] = dof_values[10];
-    vertex_values[4] = dof_values[11];
-    vertex_values[7] = dof_values[12];
+    vertex_values[1] = dof_values[6];
+    vertex_values[4] = dof_values[7];
+    vertex_values[7] = dof_values[8];
     // Evaluate function and change variables
-    vertex_values[2] = dof_values[20];
-    vertex_values[5] = dof_values[21];
-    vertex_values[8] = dof_values[22];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    vertex_values[2] = dof_values[12];
+    vertex_values[5] = dof_values[13];
+    vertex_values[8] = dof_values[14];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_7();
+        return new adaptivenavierstokes_finite_element_6();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_8();
+        return new adaptivenavierstokes_finite_element_0();
         break;
       }
     }
@@ -25078,388 +24285,102 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new adaptivenavierstokes_finite_element_9();
+    return new adaptivenavierstokes_finite_element_7();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class adaptivenavierstokes_finite_element_10: public ufc::finite_element
+class adaptivenavierstokes_finite_element_8: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  adaptivenavierstokes_finite_element_10() : ufc::finite_element()
+  adaptivenavierstokes_finite_element_8() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_10()
+  ~adaptivenavierstokes_finite_element_8() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Discontinuous Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
+  std::size_t value_size() const final override
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivenavierstokes_finite_element_10();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivenavierstokes_finite_element_11: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivenavierstokes_finite_element_11() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_11()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    return ufc::triangle;
+    return 1;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t degree() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 12;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  const char * family() const final override
   {
-    return 1;
+    return "Discontinuous Lagrange";
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -25468,16 +24389,15 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
+    *values = 0.0;
     switch (i)
     {
     case 0:
@@ -25512,7 +24432,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -25548,7 +24468,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -25584,7 +24504,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -25620,7 +24540,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -25656,7 +24576,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -25692,223 +24612,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 10:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -25916,51 +24620,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
+    double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
-      {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -25972,7 +24669,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -25980,7 +24677,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -25992,7 +24689,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -26001,8 +24698,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -26100,7 +24797,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -26251,7 +24948,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -26402,7 +25099,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -26553,7 +25250,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -26704,7 +25401,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -26855,7 +25552,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -26963,7 +25660,359 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 6:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivenavierstokes_finite_element_8();
+  }
+
+};
+
+
+class adaptivenavierstokes_finite_element_9: public ufc::finite_element
+{
+public:
+
+  adaptivenavierstokes_finite_element_9() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivenavierstokes_finite_element_9() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Discontinuous Lagrange', triangle, 2), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -26992,129 +26041,14 @@ public:
       static const double coefficients0[6] = \
       {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 1:
       {
         
       // Array of basisvalues
@@ -27143,129 +26077,14 @@ public:
       static const double coefficients0[6] = \
       {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 2:
       {
         
       // Array of basisvalues
@@ -27294,21 +26113,522 @@ public:
       static const double coefficients0[6] = \
       {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
       static const double dmats1[6][6] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -27411,12 +26731,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 1:
       {
         
       // Array of basisvalues
@@ -27443,7 +26763,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -27459,7 +26779,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -27562,12 +26882,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 2:
       {
         
       // Array of basisvalues
@@ -27594,7 +26914,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -27610,7 +26930,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -27713,12 +27033,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 3:
       {
         
       // Array of basisvalues
@@ -27745,7 +27065,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -27761,7 +27081,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -27864,708 +27184,392 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 8:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 10:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[3] = dof_values[7];
-    vertex_values[5] = dof_values[8];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new adaptivenavierstokes_finite_element_8();
-        break;
-      }
-    case 1:
-      {
-        return new adaptivenavierstokes_finite_element_8();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivenavierstokes_finite_element_11();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivenavierstokes_finite_element_12: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivenavierstokes_finite_element_12() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_12()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
         {
-          if (combinations[row][col] + 1 > 1)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 6; u++)
           {
-            combinations[row][col] += 1;
-            break;
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -28580,9 +27584,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -28592,11 +27596,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -28606,11 +27610,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -28619,9 +27623,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -28633,70 +27637,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -28711,9 +27735,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -28723,11 +27747,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -28737,11 +27761,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -28750,9 +27774,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -28764,70 +27788,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -28842,9 +27886,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -28854,11 +27898,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -28868,11 +27912,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -28881,9 +27925,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -28895,309 +27939,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new adaptivenavierstokes_finite_element_12();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class adaptivenavierstokes_finite_element_13: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  adaptivenavierstokes_finite_element_13() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~adaptivenavierstokes_finite_element_13()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 15;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 9:
       {
         
       // Array of basisvalues
@@ -29224,124 +27971,131 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
         
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 10:
       {
         
       // Array of basisvalues
@@ -29370,50 +28124,129 @@ public:
       static const double coefficients0[6] = \
       {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 11:
       {
         
       // Array of basisvalues
@@ -29440,476 +28273,31 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 10:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 12:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 13:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 14:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 15; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
+        derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
@@ -30004,90 +28392,727 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
     case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[1];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[6];
+    vertex_values[3] = dof_values[7];
+    vertex_values[5] = dof_values[8];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivenavierstokes_finite_element_8();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivenavierstokes_finite_element_8();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivenavierstokes_finite_element_9();
+  }
+
+};
+
+
+class adaptivenavierstokes_finite_element_10: public ufc::finite_element
+{
+public:
+
+  adaptivenavierstokes_finite_element_10() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivenavierstokes_finite_element_10() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', triangle, 1)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -30102,9 +29127,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -30114,11 +29139,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -30128,11 +29153,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -30141,9 +29166,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -30160,85 +29185,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -30253,9 +29258,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -30265,11 +29270,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -30279,11 +29284,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -30292,9 +29297,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -30311,85 +29316,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -30404,9 +29389,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -30416,11 +29401,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -30430,11 +29415,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -30443,9 +29428,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -30462,7 +29447,318 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 4:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivenavierstokes_finite_element_10();
+  }
+
+};
+
+
+class adaptivenavierstokes_finite_element_11: public ufc::finite_element
+{
+public:
+
+  adaptivenavierstokes_finite_element_11() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivenavierstokes_finite_element_11() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "MixedElement(VectorElement(FiniteElement('Discontinuous Lagrange', triangle, 2), dim=2), FiniteElement('Discontinuous Lagrange', triangle, 1))";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 15;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -30489,131 +29785,88 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 3:
       {
         
       // Array of basisvalues
@@ -30640,131 +29893,52 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 5:
       {
         
       // Array of basisvalues
@@ -30791,127 +29965,48 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -30944,125 +30039,10 @@ public:
       static const double coefficients0[6] = \
       {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -31095,24 +30075,393 @@ public:
       static const double coefficients0[6] = \
       {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 12:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 13:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 14:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 15; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
       double derivatives[4];
       for (unsigned int r = 0; r < 4; r++)
@@ -31212,12 +30561,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 1:
       {
         
       // Array of basisvalues
@@ -31244,7 +30593,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -31260,7 +30609,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -31363,12 +30712,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 2:
       {
         
       // Array of basisvalues
@@ -31395,7 +30744,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -31411,7 +30760,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -31514,12 +30863,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 3:
       {
         
       // Array of basisvalues
@@ -31546,7 +30895,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -31562,7 +30911,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -31665,42 +31014,56 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 12:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
@@ -31711,24 +31074,30 @@ public:
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -31742,415 +31111,2955 @@ public:
         // Looping derivative order to generate dmats.
         for (unsigned int s = 0; s < n; s++)
         {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 12:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 13:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 14:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 15; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[12];
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 15; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 12:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 13:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 14:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[1];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[12] = vals[2];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[13] = vals[2];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[14] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[6];
+    vertex_values[4] = dof_values[7];
+    vertex_values[7] = dof_values[8];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[12];
+    vertex_values[5] = dof_values[13];
+    vertex_values[8] = dof_values[14];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivenavierstokes_finite_element_9();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivenavierstokes_finite_element_10();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivenavierstokes_finite_element_11();
+  }
+
+};
+
+
+class adaptivenavierstokes_finite_element_12: public ufc::finite_element
+{
+public:
+
+  adaptivenavierstokes_finite_element_12() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivenavierstokes_finite_element_12() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Real', triangle, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Real";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivenavierstokes_finite_element_12();
+  }
+
+};
+
+
+class adaptivenavierstokes_finite_element_13: public ufc::finite_element
+{
+public:
+
+  adaptivenavierstokes_finite_element_13() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivenavierstokes_finite_element_13() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', triangle, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new adaptivenavierstokes_finite_element_13();
+  }
+
+};
+
+
+class adaptivenavierstokes_finite_element_14: public ufc::finite_element
+{
+public:
+
+  adaptivenavierstokes_finite_element_14() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~adaptivenavierstokes_finite_element_14() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Bubble', triangle, 3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Bubble";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+    
+    // Declare helper variables
+    double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+    double tmp1 = (1.0 - Y)/2.0;
+    double tmp2 = tmp1*tmp1;
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    basisvalues[1] = tmp0;
+    basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+    basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+    basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+    basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+    basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+    basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+    basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+    basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+    basisvalues[0] *= std::sqrt(0.5);
+    basisvalues[2] *= std::sqrt(1.0);
+    basisvalues[5] *= std::sqrt(1.5);
+    basisvalues[9] *= std::sqrt(2.0);
+    basisvalues[1] *= std::sqrt(3.0);
+    basisvalues[4] *= std::sqrt(4.5);
+    basisvalues[8] *= std::sqrt(6.0);
+    basisvalues[3] *= std::sqrt(7.5);
+    basisvalues[7] *= std::sqrt(10.0);
+    basisvalues[6] *= std::sqrt(14.0);
+    
+    // Table(s) of coefficients
+    static const double coefficients0[10] = \
+    {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 3)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[8][3];
+    for (unsigned int row = 0; row < 8; row++)
+    {
+      for (unsigned int col = 0; col < 3; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[8][8];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    
+    // Array of basisvalues
+    double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+    
+    // Declare helper variables
+    double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+    double tmp1 = (1.0 - Y)/2.0;
+    double tmp2 = tmp1*tmp1;
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    basisvalues[1] = tmp0;
+    basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+    basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+    basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+    basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+    basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+    basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+    basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+    basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+    basisvalues[0] *= std::sqrt(0.5);
+    basisvalues[2] *= std::sqrt(1.0);
+    basisvalues[5] *= std::sqrt(1.5);
+    basisvalues[9] *= std::sqrt(2.0);
+    basisvalues[1] *= std::sqrt(3.0);
+    basisvalues[4] *= std::sqrt(4.5);
+    basisvalues[8] *= std::sqrt(6.0);
+    basisvalues[3] *= std::sqrt(7.5);
+    basisvalues[7] *= std::sqrt(10.0);
+    basisvalues[6] *= std::sqrt(14.0);
+    
+    // Table(s) of coefficients
+    static const double coefficients0[10] = \
+    {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+    
+    // Tables of derivatives of the polynomial base (transpose).
+    static const double dmats0[10][10] = \
+    {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+    
+    static const double dmats1[10][10] = \
+    {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+    {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+    {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+    {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+    
+    // Compute reference derivatives.
+    // Declare array of derivatives on FIAT element.
+    double derivatives[8];
+    for (unsigned int r = 0; r < 8; r++)
+    {
+      derivatives[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Declare derivative matrix (of polynomial basis).
+    double dmats[10][10] = \
+    {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+    
+    // Declare (auxiliary) derivative matrix (of polynomial basis).
+    double dmats_old[10][10] = \
+    {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+    
+    // Loop possible derivatives.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      // Resetting dmats values to compute next derivative.
+      for (unsigned int t = 0; t < 10; t++)
+      {
+        for (unsigned int u = 0; u < 10; u++)
+        {
+          dmats[t][u] = 0.0;
+          if (t == u)
           {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
+          dmats[t][u] = 1.0;
           }
           
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 13:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+        } // end loop over 'u'
+      } // end loop over 't'
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Looping derivative order to generate dmats.
+      for (unsigned int s = 0; s < n; s++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        // Updating dmats_old with new values and resetting dmats.
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
+            dmats_old[t][u] = dmats[t][u];
             dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
           } // end loop over 'u'
         } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
+        // Update dmats using an inner product.
+        if (combinations[r][s] == 0)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 14:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
-            dmats[t][u] = 0.0;
-            if (t == u)
+            for (unsigned int tu = 0; tu < 10; tu++)
             {
-            dmats[t][u] = 1.0;
-            }
-            
+              dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+            } // end loop over 'tu'
           } // end loop over 'u'
         } // end loop over 't'
+        }
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
+        if (combinations[r][s] == 1)
         {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int u = 0; u < 10; u++)
           {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+            for (unsigned int tu = 0; tu < 10; tu++)
+            {
+              dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+            } // end loop over 'tu'
+          } // end loop over 'u'
+        } // end loop over 't'
+        }
+        
+      } // end loop over 's'
+      for (unsigned int s = 0; s < 10; s++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
+          derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+        } // end loop over 't'
+      } // end loop over 's'
+    } // end loop over 'r'
     
+    // Transform derivatives back to physical element
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r] += transform[r][s]*derivatives[s];
+      } // end loop over 's'
+    } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 15; r++)
-    {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[12];
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 15; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[3];
+    double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
@@ -32158,307 +34067,97 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
-    case 6:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 8:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 10:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 12:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 13:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 14:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
     }
     
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[3];
+    double vals[1];
     
     // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[12] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[13] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    values[14] = vals[2];
+    values[0] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[4] = dof_values[7];
-    vertex_values[7] = dof_values[8];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[12];
-    vertex_values[5] = dof_values[13];
-    vertex_values[8] = dof_values[14];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[0] = 0;
+    vertex_values[1] = 0;
+    vertex_values[2] = 0;
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new adaptivenavierstokes_finite_element_11();
-        break;
-      }
-    case 1:
-      {
-        return new adaptivenavierstokes_finite_element_12();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new adaptivenavierstokes_finite_element_13();
+    return new adaptivenavierstokes_finite_element_14();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_0()
+  ~adaptivenavierstokes_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -32468,7 +34167,7 @@ public:
       }
     case 2:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -32476,45 +34175,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[2];
+    return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
@@ -32524,7 +34212,7 @@ public:
       }
     case 2:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -32532,42 +34220,44 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[2][0];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -32578,7 +34268,30 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -32588,79 +34301,58 @@ public:
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_1()
+  ~adaptivenavierstokes_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Bubble', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -32670,7 +34362,7 @@ public:
       }
     case 2:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -32678,45 +34370,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[2];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 2;
         break;
       }
     case 1:
@@ -32726,7 +34407,7 @@ public:
       }
     case 2:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -32734,42 +34415,56 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[2][0];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -32780,7 +34475,33 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -32790,84 +34511,77 @@ public:
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivenavierstokes_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivenavierstokes_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_2()
+  ~adaptivenavierstokes_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -32880,55 +34594,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 6*num_global_entities[2];
+    return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 6;
+    return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
       {
-        return 0;
+        return 2;
         break;
       }
     case 2:
       {
-        return 6;
+        return 1;
         break;
       }
     }
@@ -32936,47 +34639,61 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 6*c.entity_indices[2][0];
-    dofs[1] = 6*c.entity_indices[2][0] + 1;
-    dofs[2] = 6*c.entity_indices[2][0] + 2;
-    dofs[3] = 6*c.entity_indices[2][0] + 3;
-    dofs[4] = 6*c.entity_indices[2][0] + 4;
-    dofs[5] = 6*c.entity_indices[2][0] + 5;
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + 2*entity_indices[1][0];
+    dofs[4] = offset + 2*entity_indices[1][0] + 1;
+    dofs[5] = offset + 2*entity_indices[1][1];
+    dofs[6] = offset + 2*entity_indices[1][1] + 1;
+    dofs[7] = offset + 2*entity_indices[1][2];
+    dofs[8] = offset + 2*entity_indices[1][2] + 1;
+    offset += 2*num_global_entities[1];
+    dofs[9] = offset + entity_indices[2][0];
+    offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 5;
+      dofs[3] = 6;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 7;
+      dofs[3] = 8;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -32987,12 +34704,61 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 4;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 5;
+        dofs[1] = 6;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 7;
+        dofs[1] = 8;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -33002,94 +34768,63 @@ public:
       throw std::runtime_error("i is larger than number of entities (0)");
       }
       
-      dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 3;
-      dofs[4] = 4;
-      dofs[5] = 5;
+      dofs[0] = 9;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_3()
+  ~adaptivenavierstokes_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None), **{'value_shape': (2,) })";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 3), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -33102,55 +34837,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 12*num_global_entities[2];
+    return 2*num_global_entities[0] + 4*num_global_entities[1] + 2*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 20;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 8;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 2;
         break;
       }
     case 1:
       {
-        return 0;
+        return 4;
         break;
       }
     case 2:
       {
-        return 12;
+        return 2;
         break;
       }
     }
@@ -33158,56 +34882,86 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + 6*c.entity_indices[2][0];
-    dofs[1] = offset + 6*c.entity_indices[2][0] + 1;
-    dofs[2] = offset + 6*c.entity_indices[2][0] + 2;
-    dofs[3] = offset + 6*c.entity_indices[2][0] + 3;
-    dofs[4] = offset + 6*c.entity_indices[2][0] + 4;
-    dofs[5] = offset + 6*c.entity_indices[2][0] + 5;
-    offset += 6*num_global_entities[2];
-    dofs[6] = offset + 6*c.entity_indices[2][0];
-    dofs[7] = offset + 6*c.entity_indices[2][0] + 1;
-    dofs[8] = offset + 6*c.entity_indices[2][0] + 2;
-    dofs[9] = offset + 6*c.entity_indices[2][0] + 3;
-    dofs[10] = offset + 6*c.entity_indices[2][0] + 4;
-    dofs[11] = offset + 6*c.entity_indices[2][0] + 5;
-    offset += 6*num_global_entities[2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + 2*entity_indices[1][0];
+    dofs[4] = offset + 2*entity_indices[1][0] + 1;
+    dofs[5] = offset + 2*entity_indices[1][1];
+    dofs[6] = offset + 2*entity_indices[1][1] + 1;
+    dofs[7] = offset + 2*entity_indices[1][2];
+    dofs[8] = offset + 2*entity_indices[1][2] + 1;
+    offset += 2*num_global_entities[1];
+    dofs[9] = offset + entity_indices[2][0];
+    offset += num_global_entities[2];
+    dofs[10] = offset + entity_indices[0][0];
+    dofs[11] = offset + entity_indices[0][1];
+    dofs[12] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[13] = offset + 2*entity_indices[1][0];
+    dofs[14] = offset + 2*entity_indices[1][0] + 1;
+    dofs[15] = offset + 2*entity_indices[1][1];
+    dofs[16] = offset + 2*entity_indices[1][1] + 1;
+    dofs[17] = offset + 2*entity_indices[1][2];
+    dofs[18] = offset + 2*entity_indices[1][2] + 1;
+    offset += 2*num_global_entities[1];
+    dofs[19] = offset + entity_indices[2][0];
+    offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 11;
+      dofs[5] = 12;
+      dofs[6] = 13;
+      dofs[7] = 14;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 10;
+      dofs[5] = 12;
+      dofs[6] = 15;
+      dofs[7] = 16;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 7;
+      dofs[3] = 8;
+      dofs[4] = 10;
+      dofs[5] = 11;
+      dofs[6] = 17;
+      dofs[7] = 18;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -33218,12 +34972,70 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 10;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 11;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 12;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 4;
+        dofs[2] = 13;
+        dofs[3] = 14;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 5;
+        dofs[1] = 6;
+        dofs[2] = 15;
+        dofs[3] = 16;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 7;
+        dofs[1] = 8;
+        dofs[2] = 17;
+        dofs[3] = 18;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -33233,62 +35045,21 @@ public:
       throw std::runtime_error("i is larger than number of entities (0)");
       }
       
-      dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 3;
-      dofs[4] = 4;
-      dofs[5] = 5;
-      dofs[6] = 6;
-      dofs[7] = 7;
-      dofs[8] = 8;
-      dofs[9] = 9;
-      dofs[10] = 10;
-      dofs[11] = 11;
+      dofs[0] = 9;
+      dofs[1] = 19;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -33307,57 +35078,50 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_4()
+  ~adaptivenavierstokes_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -33365,55 +35129,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2;
+    return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t num_element_dofs() const final override
   {
-    return 3*num_global_entities[2];
+    return 6;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 0;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
       {
-        return 0;
+        return 1;
         break;
       }
     case 2:
       {
-        return 3;
+        return 0;
         break;
       }
     }
@@ -33421,44 +35174,53 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 3*c.entity_indices[2][0];
-    dofs[1] = 3*c.entity_indices[2][0] + 1;
-    dofs[2] = 3*c.entity_indices[2][0] + 2;
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 4;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 5;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -33469,100 +35231,119 @@ public:
     {
     case 0:
       {
-        
-        break;
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
       }
-    case 1:
+      
+      switch (i)
       {
-        
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
-    case 2:
+    case 1:
       {
-        if (i > 0)
+        if (i > 2)
       {
-      throw std::runtime_error("i is larger than number of entities (0)");
+      throw std::runtime_error("i is larger than number of entities (2)");
       }
       
-      dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 2:
+      {
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_4();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_5: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_5() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_5()
+  ~adaptivenavierstokes_dofmap_5() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(MixedElement(FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 2, None), **{'value_shape': (2,) }), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 3), dim=2), FiniteElement('Lagrange', triangle, 2))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -33575,55 +35356,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 15*num_global_entities[2];
+    return 3*num_global_entities[0] + 5*num_global_entities[1] + 2*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 15;
+    return 26;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 11;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 3;
         break;
       }
     case 1:
       {
-        return 0;
+        return 5;
         break;
       }
     case 2:
       {
-        return 15;
+        return 2;
         break;
       }
     }
@@ -33631,60 +35401,103 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + 6*c.entity_indices[2][0];
-    dofs[1] = offset + 6*c.entity_indices[2][0] + 1;
-    dofs[2] = offset + 6*c.entity_indices[2][0] + 2;
-    dofs[3] = offset + 6*c.entity_indices[2][0] + 3;
-    dofs[4] = offset + 6*c.entity_indices[2][0] + 4;
-    dofs[5] = offset + 6*c.entity_indices[2][0] + 5;
-    offset += 6*num_global_entities[2];
-    dofs[6] = offset + 6*c.entity_indices[2][0];
-    dofs[7] = offset + 6*c.entity_indices[2][0] + 1;
-    dofs[8] = offset + 6*c.entity_indices[2][0] + 2;
-    dofs[9] = offset + 6*c.entity_indices[2][0] + 3;
-    dofs[10] = offset + 6*c.entity_indices[2][0] + 4;
-    dofs[11] = offset + 6*c.entity_indices[2][0] + 5;
-    offset += 6*num_global_entities[2];
-    dofs[12] = offset + 3*c.entity_indices[2][0];
-    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
-    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
-    offset += 3*num_global_entities[2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + 2*entity_indices[1][0];
+    dofs[4] = offset + 2*entity_indices[1][0] + 1;
+    dofs[5] = offset + 2*entity_indices[1][1];
+    dofs[6] = offset + 2*entity_indices[1][1] + 1;
+    dofs[7] = offset + 2*entity_indices[1][2];
+    dofs[8] = offset + 2*entity_indices[1][2] + 1;
+    offset += 2*num_global_entities[1];
+    dofs[9] = offset + entity_indices[2][0];
+    offset += num_global_entities[2];
+    dofs[10] = offset + entity_indices[0][0];
+    dofs[11] = offset + entity_indices[0][1];
+    dofs[12] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[13] = offset + 2*entity_indices[1][0];
+    dofs[14] = offset + 2*entity_indices[1][0] + 1;
+    dofs[15] = offset + 2*entity_indices[1][1];
+    dofs[16] = offset + 2*entity_indices[1][1] + 1;
+    dofs[17] = offset + 2*entity_indices[1][2];
+    dofs[18] = offset + 2*entity_indices[1][2] + 1;
+    offset += 2*num_global_entities[1];
+    dofs[19] = offset + entity_indices[2][0];
+    offset += num_global_entities[2];
+    dofs[20] = offset + entity_indices[0][0];
+    dofs[21] = offset + entity_indices[0][1];
+    dofs[22] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[23] = offset + entity_indices[1][0];
+    dofs[24] = offset + entity_indices[1][1];
+    dofs[25] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 11;
+      dofs[5] = 12;
+      dofs[6] = 13;
+      dofs[7] = 14;
+      dofs[8] = 21;
+      dofs[9] = 22;
+      dofs[10] = 23;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 10;
+      dofs[5] = 12;
+      dofs[6] = 15;
+      dofs[7] = 16;
+      dofs[8] = 20;
+      dofs[9] = 22;
+      dofs[10] = 24;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 7;
+      dofs[3] = 8;
+      dofs[4] = 10;
+      dofs[5] = 11;
+      dofs[6] = 17;
+      dofs[7] = 18;
+      dofs[8] = 20;
+      dofs[9] = 21;
+      dofs[10] = 25;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -33695,12 +35508,76 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 10;
+        dofs[2] = 20;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 11;
+        dofs[2] = 21;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 12;
+        dofs[2] = 22;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 4;
+        dofs[2] = 13;
+        dofs[3] = 14;
+        dofs[4] = 23;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 5;
+        dofs[1] = 6;
+        dofs[2] = 15;
+        dofs[3] = 16;
+        dofs[4] = 24;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 7;
+        dofs[1] = 8;
+        dofs[2] = 17;
+        dofs[3] = 18;
+        dofs[4] = 25;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -33710,71 +35587,21 @@ public:
       throw std::runtime_error("i is larger than number of entities (0)");
       }
       
-      dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 3;
-      dofs[4] = 4;
-      dofs[5] = 5;
-      dofs[6] = 6;
-      dofs[7] = 7;
-      dofs[8] = 8;
-      dofs[9] = 9;
-      dofs[10] = 10;
-      dofs[11] = 11;
-      dofs[12] = 12;
-      dofs[13] = 13;
-      dofs[14] = 14;
+      dofs[0] = 9;
+      dofs[1] = 19;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -33793,41 +35620,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_5();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_6: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_6() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_6()
+  ~adaptivenavierstokes_dofmap_6() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -33843,7 +35663,7 @@ public:
       }
     case 2:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -33851,45 +35671,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
+    return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 10;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 4;
+    return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
@@ -33899,7 +35708,7 @@ public:
       }
     case 2:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -33907,30 +35716,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -33939,32 +35749,37 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
-      dofs[3] = 4;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 5;
+      dofs[2] = 4;
       dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 7;
-      dofs[3] = 8;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
+      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -33985,16 +35800,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 8;
           break;
         }
       }
@@ -34013,19 +35831,19 @@ public:
       case 0:
         {
           dofs[0] = 3;
-        dofs[1] = 4;
+        dofs[1] = 9;
           break;
         }
       case 1:
         {
-          dofs[0] = 5;
-        dofs[1] = 6;
+          dofs[0] = 4;
+        dofs[1] = 10;
           break;
         }
       case 2:
         {
-          dofs[0] = 7;
-        dofs[1] = 8;
+          dofs[0] = 5;
+        dofs[1] = 11;
           break;
         }
       }
@@ -34034,91 +35852,66 @@ public:
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 9;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new adaptivenavierstokes_dofmap_4();
+        break;
+      }
+    case 1:
+      {
+        return new adaptivenavierstokes_dofmap_4();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_6();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_7: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_7() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_7()
+  ~adaptivenavierstokes_dofmap_7() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), **{'value_shape': (2,) })";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -34134,7 +35927,7 @@ public:
       }
     case 2:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -34142,55 +35935,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 2*num_global_entities[0] + 4*num_global_entities[1] + 2*num_global_entities[2];
+    return 3*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 20;
+    return 15;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 8;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 3;
         break;
       }
     case 1:
       {
-        return 4;
+        return 2;
         break;
       }
     case 2:
       {
-        return 2;
+        return 0;
         break;
       }
     }
@@ -34198,43 +35980,35 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
-    dofs[10] = offset + c.entity_indices[0][0];
-    dofs[11] = offset + c.entity_indices[0][1];
-    dofs[12] = offset + c.entity_indices[0][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[12] = offset + entity_indices[0][0];
+    dofs[13] = offset + entity_indices[0][1];
+    dofs[14] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[13] = offset + 2*c.entity_indices[1][0];
-    dofs[14] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[15] = offset + 2*c.entity_indices[1][1];
-    dofs[16] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[17] = offset + 2*c.entity_indices[1][2];
-    dofs[18] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[19] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -34243,9 +36017,9 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 11;
-      dofs[5] = 12;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
       dofs[6] = 13;
       dofs[7] = 14;
         break;
@@ -34254,33 +36028,32 @@ public:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 10;
-      dofs[5] = 12;
-      dofs[6] = 15;
-      dofs[7] = 16;
+      dofs[2] = 4;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
+      dofs[6] = 12;
+      dofs[7] = 14;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 7;
-      dofs[3] = 8;
-      dofs[4] = 10;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
       dofs[5] = 11;
-      dofs[6] = 17;
-      dofs[7] = 18;
+      dofs[6] = 12;
+      dofs[7] = 13;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -34301,19 +36074,22 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 10;
+        dofs[1] = 6;
+        dofs[2] = 12;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 11;
+        dofs[1] = 7;
+        dofs[2] = 13;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 12;
+        dofs[1] = 8;
+        dofs[2] = 14;
           break;
         }
       }
@@ -34332,25 +36108,19 @@ public:
       case 0:
         {
           dofs[0] = 3;
-        dofs[1] = 4;
-        dofs[2] = 13;
-        dofs[3] = 14;
+        dofs[1] = 9;
           break;
         }
       case 1:
         {
-          dofs[0] = 5;
-        dofs[1] = 6;
-        dofs[2] = 15;
-        dofs[3] = 16;
+          dofs[0] = 4;
+        dofs[1] = 10;
           break;
         }
       case 2:
         {
-          dofs[0] = 7;
-        dofs[1] = 8;
-        dofs[2] = 17;
-        dofs[3] = 18;
+          dofs[0] = 5;
+        dofs[1] = 11;
           break;
         }
       }
@@ -34359,73 +36129,20 @@ public:
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 9;
-      dofs[1] = 19;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[20] = vertex_coordinates[0];
-    dof_coordinates[21] = vertex_coordinates[1];
-    dof_coordinates[22] = vertex_coordinates[2];
-    dof_coordinates[23] = vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[4];
-    dof_coordinates[25] = vertex_coordinates[5];
-    dof_coordinates[26] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[27] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[28] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[29] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[30] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[31] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[32] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[33] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[34] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[35] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[36] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[37] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[38] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[39] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -34436,7 +36153,7 @@ public:
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_6();
+        return new adaptivenavierstokes_dofmap_0();
         break;
       }
     }
@@ -34444,57 +36161,50 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_7();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_8: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_8() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_8()
+  ~adaptivenavierstokes_dofmap_8() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -34502,55 +36212,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0] + num_global_entities[1];
+    return 6*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 0;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
       {
-        return 0;
+        return 6;
         break;
       }
     }
@@ -34558,56 +36257,44 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    dofs[0] = 6*entity_indices[2][0];
+    dofs[1] = 6*entity_indices[2][0] + 1;
+    dofs[2] = 6*entity_indices[2][0] + 2;
+    dofs[3] = 6*entity_indices[2][0] + 3;
+    dofs[4] = 6*entity_indices[2][0] + 4;
+    dofs[5] = 6*entity_indices[2][0] + 5;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 4;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 5;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -34618,145 +36305,83 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 3;
+      dofs[4] = 4;
+      dofs[5] = 5;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_8();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_9: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_9() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_9()
+  ~adaptivenavierstokes_dofmap_9() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(MixedElement(FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None), **{'value_shape': (2,) }), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for VectorElement(FiniteElement('Discontinuous Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -34769,55 +36394,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3*num_global_entities[0] + 5*num_global_entities[1] + 2*num_global_entities[2];
+    return 12*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 26;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 11;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 3;
+        return 0;
         break;
       }
     case 1:
       {
-        return 5;
+        return 0;
         break;
       }
     case 2:
       {
-        return 2;
+        return 12;
         break;
       }
     }
@@ -34825,106 +36439,53 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
-    dofs[10] = offset + c.entity_indices[0][0];
-    dofs[11] = offset + c.entity_indices[0][1];
-    dofs[12] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[13] = offset + 2*c.entity_indices[1][0];
-    dofs[14] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[15] = offset + 2*c.entity_indices[1][1];
-    dofs[16] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[17] = offset + 2*c.entity_indices[1][2];
-    dofs[18] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[19] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
-    dofs[20] = offset + c.entity_indices[0][0];
-    dofs[21] = offset + c.entity_indices[0][1];
-    dofs[22] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[23] = offset + c.entity_indices[1][0];
-    dofs[24] = offset + c.entity_indices[1][1];
-    dofs[25] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    dofs[0] = offset + 6*entity_indices[2][0];
+    dofs[1] = offset + 6*entity_indices[2][0] + 1;
+    dofs[2] = offset + 6*entity_indices[2][0] + 2;
+    dofs[3] = offset + 6*entity_indices[2][0] + 3;
+    dofs[4] = offset + 6*entity_indices[2][0] + 4;
+    dofs[5] = offset + 6*entity_indices[2][0] + 5;
+    offset += 6*num_global_entities[2];
+    dofs[6] = offset + 6*entity_indices[2][0];
+    dofs[7] = offset + 6*entity_indices[2][0] + 1;
+    dofs[8] = offset + 6*entity_indices[2][0] + 2;
+    dofs[9] = offset + 6*entity_indices[2][0] + 3;
+    dofs[10] = offset + 6*entity_indices[2][0] + 4;
+    dofs[11] = offset + 6*entity_indices[2][0] + 5;
+    offset += 6*num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 11;
-      dofs[5] = 12;
-      dofs[6] = 13;
-      dofs[7] = 14;
-      dofs[8] = 21;
-      dofs[9] = 22;
-      dofs[10] = 23;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 10;
-      dofs[5] = 12;
-      dofs[6] = 15;
-      dofs[7] = 16;
-      dofs[8] = 20;
-      dofs[9] = 22;
-      dofs[10] = 24;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 7;
-      dofs[3] = 8;
-      dofs[4] = 10;
-      dofs[5] = 11;
-      dofs[6] = 17;
-      dofs[7] = 18;
-      dofs[8] = 20;
-      dofs[9] = 21;
-      dofs[10] = 25;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -34935,76 +36496,12 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 10;
-        dofs[2] = 20;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 11;
-        dofs[2] = 21;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 12;
-        dofs[2] = 22;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 4;
-        dofs[2] = 13;
-        dofs[3] = 14;
-        dofs[4] = 23;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 5;
-        dofs[1] = 6;
-        dofs[2] = 15;
-        dofs[3] = 16;
-        dofs[4] = 24;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 7;
-        dofs[1] = 8;
-        dofs[2] = 17;
-        dofs[3] = 18;
-        dofs[4] = 25;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
@@ -35014,86 +36511,37 @@ public:
       throw std::runtime_error("i is larger than number of entities (0)");
       }
       
-      dofs[0] = 9;
-      dofs[1] = 19;
+      dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 3;
+      dofs[4] = 4;
+      dofs[5] = 5;
+      dofs[6] = 6;
+      dofs[7] = 7;
+      dofs[8] = 8;
+      dofs[9] = 9;
+      dofs[10] = 10;
+      dofs[11] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[20] = vertex_coordinates[0];
-    dof_coordinates[21] = vertex_coordinates[1];
-    dof_coordinates[22] = vertex_coordinates[2];
-    dof_coordinates[23] = vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[4];
-    dof_coordinates[25] = vertex_coordinates[5];
-    dof_coordinates[26] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[27] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[28] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[29] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[30] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[31] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[32] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[33] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[34] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[35] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[36] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[37] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[38] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[39] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[40] = vertex_coordinates[0];
-    dof_coordinates[41] = vertex_coordinates[1];
-    dof_coordinates[42] = vertex_coordinates[2];
-    dof_coordinates[43] = vertex_coordinates[3];
-    dof_coordinates[44] = vertex_coordinates[4];
-    dof_coordinates[45] = vertex_coordinates[5];
-    dof_coordinates[46] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[47] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[48] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[49] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[50] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[51] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_7();
+        return new adaptivenavierstokes_dofmap_8();
         break;
       }
     case 1:
@@ -35106,41 +36554,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_9();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_10: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_10() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_10()
+  ~adaptivenavierstokes_dofmap_10() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -35156,7 +36597,7 @@ public:
       }
     case 2:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -35164,39 +36605,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 1;
+    return 3*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -35212,7 +36642,7 @@ public:
       }
     case 2:
       {
-        return 1;
+        return 3;
         break;
       }
     }
@@ -35220,17 +36650,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 0;
+    dofs[0] = 3*entity_indices[2][0];
+    dofs[1] = 3*entity_indices[2][0] + 1;
+    dofs[2] = 3*entity_indices[2][0] + 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -35253,9 +36683,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -35282,83 +36711,69 @@ public:
       }
       
       dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_10();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_11: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_11() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_11()
+  ~adaptivenavierstokes_dofmap_11() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Discontinuous Lagrange', triangle, 2), dim=2), FiniteElement('Discontinuous Lagrange', triangle, 1))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -35366,55 +36781,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2*num_global_entities[0] + 2*num_global_entities[1];
+    return 15*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 15;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 0;
         break;
       }
     case 1:
       {
-        return 2;
+        return 0;
         break;
       }
     case 2:
       {
-        return 0;
+        return 15;
         break;
       }
     }
@@ -35422,73 +36826,57 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    dofs[0] = offset + 6*entity_indices[2][0];
+    dofs[1] = offset + 6*entity_indices[2][0] + 1;
+    dofs[2] = offset + 6*entity_indices[2][0] + 2;
+    dofs[3] = offset + 6*entity_indices[2][0] + 3;
+    dofs[4] = offset + 6*entity_indices[2][0] + 4;
+    dofs[5] = offset + 6*entity_indices[2][0] + 5;
+    offset += 6*num_global_entities[2];
+    dofs[6] = offset + 6*entity_indices[2][0];
+    dofs[7] = offset + 6*entity_indices[2][0] + 1;
+    dofs[8] = offset + 6*entity_indices[2][0] + 2;
+    dofs[9] = offset + 6*entity_indices[2][0] + 3;
+    dofs[10] = offset + 6*entity_indices[2][0] + 4;
+    dofs[11] = offset + 6*entity_indices[2][0] + 5;
+    offset += 6*num_global_entities[2];
+    dofs[12] = offset + 3*entity_indices[2][0];
+    dofs[13] = offset + 3*entity_indices[2][0] + 1;
+    dofs[14] = offset + 3*entity_indices[2][0] + 2;
+    offset += 3*num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -35499,124 +36887,60 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 6;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 7;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 8;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 9;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-        dofs[1] = 10;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-        dofs[1] = 11;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 3;
+      dofs[4] = 4;
+      dofs[5] = 5;
+      dofs[6] = 6;
+      dofs[7] = 7;
+      dofs[8] = 8;
+      dofs[9] = 9;
+      dofs[10] = 10;
+      dofs[11] = 11;
+      dofs[12] = 12;
+      dofs[13] = 13;
+      dofs[14] = 14;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_8();
+        return new adaptivenavierstokes_dofmap_9();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_8();
+        return new adaptivenavierstokes_dofmap_10();
         break;
       }
     }
@@ -35624,47 +36948,40 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_11();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_12: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_12() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_12()
+  ~adaptivenavierstokes_dofmap_12() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -35682,45 +36999,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 0;
         break;
       }
     case 1:
@@ -35730,7 +37036,7 @@ public:
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -35738,47 +37044,39 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = 0;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -35789,30 +37087,7 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -35822,88 +37097,73 @@ public:
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new adaptivenavierstokes_dofmap_12();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class adaptivenavierstokes_dofmap_13: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_dofmap_13() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_dofmap_13()
+  ~adaptivenavierstokes_dofmap_13() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -35911,55 +37171,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 3*num_global_entities[0] + 2*num_global_entities[1];
+    return num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 15;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 8;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 3;
+        return 0;
         break;
       }
     case 1:
       {
-        return 2;
+        return 0;
         break;
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -35967,83 +37216,39 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[12] = offset + c.entity_indices[0][0];
-    dofs[13] = offset + c.entity_indices[0][1];
-    dofs[14] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
+    dofs[0] = entity_indices[2][0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
-      dofs[6] = 13;
-      dofs[7] = 14;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
-      dofs[6] = 12;
-      dofs[7] = 14;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
-      dofs[6] = 12;
-      dofs[7] = 13;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -36054,180 +37259,243 @@ public:
     {
     case 0:
       {
-        if (i > 2)
+        
+        break;
+      }
+    case 1:
       {
-      throw std::runtime_error("i is larger than number of entities (2)");
+        
+        break;
       }
-      
-      switch (i)
+    case 2:
       {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 6;
-        dofs[2] = 12;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 7;
-        dofs[2] = 13;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 8;
-        dofs[2] = 14;
-          break;
-        }
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
       }
       
+      dofs[0] = 0;
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new adaptivenavierstokes_dofmap_13();
+  }
+
+};
+
+
+class adaptivenavierstokes_dofmap_14: public ufc::dofmap
+{
+public:
+
+  adaptivenavierstokes_dofmap_14() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~adaptivenavierstokes_dofmap_14() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Bubble', triangle, 3)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return false;
         break;
       }
     case 1:
       {
-        if (i > 2)
+        return false;
+        break;
+      }
+    case 2:
       {
-      throw std::runtime_error("i is larger than number of entities (2)");
+        return true;
+        break;
       }
-      
-      switch (i)
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[2];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 0;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
       {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 9;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-        dofs[1] = 10;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-        dofs[1] = 11;
-          break;
-        }
+        return 0;
+        break;
       }
-      
+    case 1:
+      {
+        return 0;
         break;
       }
     case 2:
       {
-        
+        return 1;
         break;
       }
     }
     
+    return 0;
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
+    dofs[0] = entity_indices[2][0];
   }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
-    return 2;
+    switch (facet)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
-    switch (i)
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_11();
+        
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_12();
+        
+        break;
+      }
+    case 2:
+      {
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    return new adaptivenavierstokes_dofmap_13();
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new adaptivenavierstokes_dofmap_14();
   }
 
 };
 
-/// 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 adaptivenavierstokes_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_cell_integral_0_otherwise()
+  ~adaptivenavierstokes_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    172
@@ -36236,7 +37504,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -36361,193 +37629,193 @@ public:
     const double G15_11_1 = det*w[0][11]*K[3]*(1.0);
     
     // Compute element tensor
-    A[0] = 0.5*G0_0_0_0 + 0.5*G0_0_0_1 + 0.5*G0_0_1_0 + 0.500000000000001*G0_0_1_1 + 0.5*G2_0_0_0 + 0.5*G2_0_0_1 + 0.5*G2_0_1_0 + 0.500000000000001*G2_0_1_1 - 0.030952380952381*G8_0_0 - 0.030952380952381*G8_0_1 + 0.00357142857142856*G8_1_0 + 0.00357142857142858*G8_1_1 + 0.00357142857142858*G8_2_0 + 0.00357142857142859*G8_2_1 - 0.00476190476190477*G8_3_0 - 0.00476190476190471*G8_3_1 - 0.0190476190476191*G8_4_0 - 0.0190476190476191*G8_4_1 - 0.0190476190476191*G8_5_0 - 0.0190476190476191*G8 [...]
-    A[1] = 0.166666666666668*G0_0_0_0 + 0.166666666666666*G0_0_1_0 + 0.166666666666668*G2_0_0_0 + 0.166666666666666*G2_0_1_0 + 0.00357142857142856*G8_0_0 + 0.00357142857142858*G8_0_1 + 0.00714285714285717*G8_1_0 + 0.00714285714285705*G8_1_1 - 0.00436507936507936*G8_2_0 - 0.00436507936507934*G8_2_1 + 0.00634920634920636*G8_3_0 + 0.00634920634920634*G8_3_1 + 0.00793650793650793*G8_4_0 + 0.00793650793650798*G8_4_1 + 0.0126984126984127*G8_5_0 + 0.0126984126984127*G8_5_1 + 0.00357142857142856 [...]
-    A[2] = 0.166666666666666*G0_0_0_1 + 0.166666666666666*G0_0_1_1 + 0.166666666666666*G2_0_0_1 + 0.166666666666666*G2_0_1_1 + 0.00357142857142858*G8_0_0 + 0.00357142857142859*G8_0_1 - 0.00436507936507936*G8_1_0 - 0.00436507936507934*G8_1_1 + 0.00714285714285712*G8_2_0 + 0.00714285714285704*G8_2_1 + 0.00634920634920632*G8_3_0 + 0.00634920634920634*G8_3_1 + 0.0126984126984127*G8_4_0 + 0.0126984126984127*G8_4_1 + 0.00793650793650792*G8_5_0 + 0.00793650793650798*G8_5_1 + 0.00357142857142858 [...]
-    A[3] = -0.00476190476190477*G8_0_0 - 0.00476190476190471*G8_0_1 + 0.00634920634920636*G8_1_0 + 0.00634920634920634*G8_1_1 + 0.00634920634920632*G8_2_0 + 0.00634920634920634*G8_2_1 + 0.0380952380952381*G8_3_0 + 0.0380952380952376*G8_3_1 - 0.00634920634920632*G8_4_0 - 0.00634920634920656*G8_4_1 - 0.00634920634920629*G8_5_0 - 0.00634920634920655*G8_5_1 - 0.00476190476190477*G9_0_0 - 0.00476190476190471*G9_0_1 - 0.00793650793650793*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619* [...]
-    A[4] = -0.666666666666668*G0_0_0_1 - 0.666666666666668*G0_0_1_1 - 0.666666666666668*G2_0_0_1 - 0.666666666666668*G2_0_1_1 - 0.0190476190476191*G8_0_0 - 0.0190476190476191*G8_0_1 + 0.00793650793650793*G8_1_0 + 0.00793650793650798*G8_1_1 + 0.0126984126984127*G8_2_0 + 0.0126984126984127*G8_2_1 - 0.00634920634920632*G8_3_0 - 0.00634920634920656*G8_3_1 - 0.0634920634920635*G8_4_0 - 0.0634920634920639*G8_4_1 - 0.0317460317460317*G8_5_0 - 0.031746031746032*G8_5_1 - 0.0190476190476191*G9_0_0 [...]
+    A[0] = 0.5*G0_0_0_0 + 0.5*G0_0_0_1 + 0.5*G0_0_1_0 + 0.500000000000001*G0_0_1_1 + 0.5*G2_0_0_0 + 0.5*G2_0_0_1 + 0.5*G2_0_1_0 + 0.500000000000001*G2_0_1_1 - 0.030952380952381*G8_0_0 - 0.030952380952381*G8_0_1 + 0.00357142857142857*G8_1_0 + 0.00357142857142858*G8_1_1 + 0.00357142857142858*G8_2_0 + 0.00357142857142859*G8_2_1 - 0.00476190476190477*G8_3_0 - 0.00476190476190471*G8_3_1 - 0.0190476190476191*G8_4_0 - 0.0190476190476191*G8_4_1 - 0.0190476190476191*G8_5_0 - 0.0190476190476191*G8 [...]
+    A[1] = 0.166666666666668*G0_0_0_0 + 0.166666666666666*G0_0_1_0 + 0.166666666666668*G2_0_0_0 + 0.166666666666666*G2_0_1_0 + 0.00357142857142857*G8_0_0 + 0.00357142857142858*G8_0_1 + 0.00714285714285716*G8_1_0 + 0.00714285714285705*G8_1_1 - 0.00436507936507936*G8_2_0 - 0.00436507936507934*G8_2_1 + 0.00634920634920635*G8_3_0 + 0.00634920634920634*G8_3_1 + 0.00793650793650793*G8_4_0 + 0.00793650793650798*G8_4_1 + 0.0126984126984127*G8_5_0 + 0.0126984126984127*G8_5_1 + 0.00357142857142857 [...]
+    A[2] = 0.166666666666666*G0_0_0_1 + 0.166666666666666*G0_0_1_1 + 0.166666666666666*G2_0_0_1 + 0.166666666666666*G2_0_1_1 + 0.00357142857142858*G8_0_0 + 0.00357142857142859*G8_0_1 - 0.00436507936507936*G8_1_0 - 0.00436507936507934*G8_1_1 + 0.00714285714285713*G8_2_0 + 0.00714285714285705*G8_2_1 + 0.00634920634920633*G8_3_0 + 0.00634920634920634*G8_3_1 + 0.0126984126984127*G8_4_0 + 0.0126984126984127*G8_4_1 + 0.00793650793650792*G8_5_0 + 0.00793650793650798*G8_5_1 + 0.00357142857142858 [...]
+    A[3] = -0.00476190476190477*G8_0_0 - 0.00476190476190471*G8_0_1 + 0.00634920634920635*G8_1_0 + 0.00634920634920634*G8_1_1 + 0.00634920634920633*G8_2_0 + 0.00634920634920634*G8_2_1 + 0.0380952380952381*G8_3_0 + 0.0380952380952376*G8_3_1 - 0.00634920634920632*G8_4_0 - 0.00634920634920656*G8_4_1 - 0.00634920634920629*G8_5_0 - 0.00634920634920655*G8_5_1 - 0.00476190476190477*G9_0_0 - 0.00476190476190471*G9_0_1 - 0.00793650793650794*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619* [...]
+    A[4] = -0.666666666666668*G0_0_0_1 - 0.666666666666668*G0_0_1_1 - 0.666666666666668*G2_0_0_1 - 0.666666666666668*G2_0_1_1 - 0.0190476190476191*G8_0_0 - 0.0190476190476191*G8_0_1 + 0.00793650793650793*G8_1_0 + 0.00793650793650798*G8_1_1 + 0.0126984126984127*G8_2_0 + 0.0126984126984127*G8_2_1 - 0.00634920634920632*G8_3_0 - 0.00634920634920656*G8_3_1 - 0.0634920634920635*G8_4_0 - 0.0634920634920639*G8_4_1 - 0.0317460317460317*G8_5_0 - 0.0317460317460319*G8_5_1 - 0.0190476190476191*G9_0_ [...]
     A[5] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_1_0 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_1_0 - 0.0190476190476191*G8_0_0 - 0.0190476190476191*G8_0_1 + 0.0126984126984127*G8_1_0 + 0.0126984126984127*G8_1_1 + 0.00793650793650792*G8_2_0 + 0.00793650793650798*G8_2_1 - 0.00634920634920629*G8_3_0 - 0.00634920634920655*G8_3_1 - 0.0317460317460317*G8_4_0 - 0.0317460317460319*G8_4_1 - 0.0634920634920634*G8_5_0 - 0.0634920634920639*G8_5_1 - 0.0190476190476191*G9_0_ [...]
-    A[6] = -0.030952380952381*G13_6_0 - 0.030952380952381*G13_6_1 - 0.00714285714285718*G13_7_0 - 0.00714285714285714*G13_8_1 + 0.0095238095238095*G13_9_0 + 0.00952380952380933*G13_9_1 - 0.0095238095238095*G13_10_0 + 0.0380952380952383*G13_10_1 + 0.0380952380952381*G13_11_0 - 0.00952380952380951*G13_11_1;
-    A[7] = 0.00357142857142856*G13_6_0 + 0.00357142857142858*G13_6_1 - 0.00357142857142857*G13_7_0 + 0.00436507936507936*G13_8_1 + 0.00158730158730159*G13_9_0 - 0.00634920634920631*G13_9_1 - 0.00158730158730159*G13_10_0 - 0.00793650793650796*G13_10_1 + 0.00634920634920635*G13_11_1;
-    A[8] = 0.00357142857142858*G13_6_0 + 0.00357142857142859*G13_6_1 + 0.00436507936507937*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.00158730158730163*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00793650793650795*G13_11_0 - 0.00158730158730159*G13_11_1;
-    A[9] = -0.00476190476190477*G13_6_0 - 0.00476190476190471*G13_6_1 - 0.00793650793650793*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.019047619047619*G13_10_0 + 0.0126984126984126*G13_10_1 + 0.0126984126984127*G13_11_0 + 0.019047619047619*G13_11_1;
-    A[10] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.00634920634920637*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 - 0.00634920634920632*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.0317460317460317*G13_10_1 + 0.0253968253968254*G13_11_0 + 0.00634920634920635*G13_11_1;
+    A[6] = -0.030952380952381*G13_6_0 - 0.030952380952381*G13_6_1 - 0.00714285714285719*G13_7_0 - 0.00714285714285714*G13_8_1 + 0.0095238095238095*G13_9_0 + 0.00952380952380934*G13_9_1 - 0.0095238095238095*G13_10_0 + 0.0380952380952382*G13_10_1 + 0.0380952380952382*G13_11_0 - 0.00952380952380951*G13_11_1;
+    A[7] = 0.00357142857142857*G13_6_0 + 0.00357142857142858*G13_6_1 - 0.00357142857142856*G13_7_0 + 0.00436507936507936*G13_8_1 + 0.00158730158730159*G13_9_0 - 0.00634920634920631*G13_9_1 - 0.00158730158730159*G13_10_0 - 0.00793650793650796*G13_10_1 + 0.00634920634920635*G13_11_1;
+    A[8] = 0.00357142857142858*G13_6_0 + 0.00357142857142859*G13_6_1 + 0.00436507936507937*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.00158730158730162*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00793650793650795*G13_11_0 - 0.00158730158730159*G13_11_1;
+    A[9] = -0.00476190476190477*G13_6_0 - 0.00476190476190471*G13_6_1 - 0.00793650793650794*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.019047619047619*G13_10_0 + 0.0126984126984126*G13_10_1 + 0.0126984126984127*G13_11_0 + 0.019047619047619*G13_11_1;
+    A[10] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.00634920634920638*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 - 0.00634920634920631*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.0317460317460317*G13_10_1 + 0.0253968253968254*G13_11_0 + 0.00634920634920635*G13_11_1;
     A[11] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.0126984126984127*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 - 0.0126984126984127*G13_9_1 + 0.00634920634920634*G13_10_0 + 0.0253968253968254*G13_10_1 + 0.0317460317460318*G13_11_0 + 0.0126984126984127*G13_11_1;
-    A[12] = -0.166666666666667*G6_0 - 0.166666666666668*G6_1;
+    A[12] = -0.166666666666667*G6_0 - 0.166666666666667*G6_1;
     A[13] = 0.0;
     A[14] = 0.0;
-    A[15] = 0.166666666666668*G0_0_0_0 + 0.166666666666666*G0_0_0_1 + 0.166666666666668*G2_0_0_0 + 0.166666666666666*G2_0_0_1 - 0.00714285714285718*G8_0_0 - 0.00357142857142857*G8_1_0 + 0.00436507936507937*G8_2_0 - 0.00793650793650793*G8_3_0 - 0.00634920634920637*G8_4_0 - 0.0126984126984127*G8_5_0 + 0.00357142857142856*G9_0_0 + 0.00357142857142858*G9_0_1 - 0.00357142857142857*G9_1_0 + 0.00436507936507936*G9_2_1 + 0.00158730158730159*G9_3_0 - 0.00634920634920631*G9_3_1 - 0.001587301587301 [...]
-    A[16] = 0.5*G0_0_0_0 + 0.5*G2_0_0_0 - 0.00357142857142857*G8_0_0 + 0.0309523809523809*G8_1_0 - 0.00357142857142857*G8_2_0 + 0.019047619047619*G8_3_0 + 0.00476190476190477*G8_4_0 + 0.0190476190476191*G8_5_0 + 0.00714285714285717*G9_0_0 + 0.00714285714285705*G9_0_1 + 0.0309523809523809*G9_1_0 - 0.00714285714285712*G9_2_1 + 0.00952380952380949*G9_3_0 + 0.0476190476190473*G9_3_1 - 0.00952380952380949*G9_4_0 - 0.0380952380952381*G9_5_0 - 0.0476190476190476*G9_5_1 - 0.00357142857142857*G11 [...]
-    A[17] = -0.166666666666667*G0_0_0_1 - 0.166666666666667*G2_0_0_1 + 0.00436507936507937*G8_0_0 - 0.00357142857142857*G8_1_0 - 0.00714285714285716*G8_2_0 - 0.0126984126984127*G8_3_0 - 0.00634920634920635*G8_4_0 - 0.00793650793650792*G8_5_0 - 0.00436507936507936*G9_0_0 - 0.00436507936507934*G9_0_1 - 0.00357142857142857*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.00634920634920629*G9_3_1 + 0.00634920634920633*G9_4_0 + 0.00793650793650789*G9_4_1 + 0.00793650793650 [...]
-    A[18] = 0.666666666666664*G0_0_0_1 + 0.666666666666664*G2_0_0_1 - 0.00793650793650793*G8_0_0 + 0.019047619047619*G8_1_0 - 0.0126984126984127*G8_2_0 + 0.0634920634920634*G8_3_0 + 0.00634920634920632*G8_4_0 + 0.0317460317460317*G8_5_0 + 0.00634920634920636*G9_0_0 + 0.00634920634920634*G9_0_1 + 0.019047619047619*G9_1_0 - 0.0126984126984127*G9_2_1 - 0.0126984126984127*G9_3_0 + 0.019047619047619*G9_3_1 + 0.0126984126984127*G9_4_0 + 0.00634920634920638*G9_4_1 - 0.0253968253968254*G9_5_0 -  [...]
-    A[19] = -0.00634920634920637*G8_0_0 + 0.00476190476190477*G8_1_0 - 0.00634920634920635*G8_2_0 + 0.00634920634920632*G8_3_0 - 0.0380952380952382*G8_4_0 + 0.0063492063492063*G8_5_0 + 0.00793650793650793*G9_0_0 + 0.00793650793650798*G9_0_1 + 0.00476190476190477*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_0 - 0.00634920634920621*G9_3_1 + 0.019047619047619*G9_4_0 - 0.0126984126984127*G9_5_0 + 0.00634920634920634*G9_5_1 - 0.00634920634920637*G11_0_6 + 0.00476190476190477*G [...]
-    A[20] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_0_1 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_0_1 - 0.0126984126984127*G8_0_0 + 0.0190476190476191*G8_1_0 - 0.00793650793650792*G8_2_0 + 0.0317460317460317*G8_3_0 + 0.0063492063492063*G8_4_0 + 0.0634920634920634*G8_5_0 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 + 0.0190476190476191*G9_1_0 - 0.00634920634920636*G9_2_1 - 0.00634920634920634*G9_3_0 + 0.019047619047619*G9_3_1 + 0.00634920634920634*G9_4_ [...]
-    A[21] = 0.00357142857142856*G13_6_0 + 0.00357142857142858*G13_6_1 - 0.00357142857142857*G13_7_0 + 0.00436507936507936*G13_8_1 + 0.00158730158730159*G13_9_0 - 0.00634920634920631*G13_9_1 - 0.00158730158730159*G13_10_0 - 0.00793650793650796*G13_10_1 + 0.00634920634920635*G13_11_1;
-    A[22] = 0.00714285714285717*G13_6_0 + 0.00714285714285705*G13_6_1 + 0.0309523809523809*G13_7_0 - 0.00714285714285712*G13_8_1 + 0.00952380952380949*G13_9_0 + 0.0476190476190473*G13_9_1 - 0.00952380952380949*G13_10_0 - 0.0380952380952381*G13_11_0 - 0.0476190476190476*G13_11_1;
-    A[23] = -0.00436507936507936*G13_6_0 - 0.00436507936507934*G13_6_1 - 0.00357142857142857*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.00634920634920629*G13_9_1 + 0.00634920634920633*G13_10_0 + 0.00793650793650789*G13_10_1 + 0.00793650793650793*G13_11_0 + 0.00634920634920634*G13_11_1;
-    A[24] = 0.00634920634920636*G13_6_0 + 0.00634920634920634*G13_6_1 + 0.019047619047619*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 + 0.019047619047619*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.00634920634920638*G13_10_1 - 0.0253968253968254*G13_11_0 - 0.019047619047619*G13_11_1;
+    A[15] = 0.166666666666668*G0_0_0_0 + 0.166666666666666*G0_0_0_1 + 0.166666666666668*G2_0_0_0 + 0.166666666666666*G2_0_0_1 - 0.00714285714285719*G8_0_0 - 0.00357142857142856*G8_1_0 + 0.00436507936507937*G8_2_0 - 0.00793650793650793*G8_3_0 - 0.00634920634920638*G8_4_0 - 0.0126984126984127*G8_5_0 + 0.00357142857142857*G9_0_0 + 0.00357142857142858*G9_0_1 - 0.00357142857142856*G9_1_0 + 0.00436507936507936*G9_2_1 + 0.00158730158730159*G9_3_0 - 0.00634920634920631*G9_3_1 - 0.001587301587301 [...]
+    A[16] = 0.5*G0_0_0_0 + 0.5*G2_0_0_0 - 0.00357142857142856*G8_0_0 + 0.0309523809523809*G8_1_0 - 0.00357142857142857*G8_2_0 + 0.019047619047619*G8_3_0 + 0.00476190476190477*G8_4_0 + 0.0190476190476191*G8_5_0 + 0.00714285714285716*G9_0_0 + 0.00714285714285705*G9_0_1 + 0.0309523809523809*G9_1_0 - 0.00714285714285712*G9_2_1 + 0.00952380952380949*G9_3_0 + 0.0476190476190473*G9_3_1 - 0.00952380952380949*G9_4_0 - 0.0380952380952381*G9_5_0 - 0.0476190476190476*G9_5_1 - 0.00357142857142856*G11 [...]
+    A[17] = -0.166666666666667*G0_0_0_1 - 0.166666666666667*G2_0_0_1 + 0.00436507936507937*G8_0_0 - 0.00357142857142857*G8_1_0 - 0.00714285714285715*G8_2_0 - 0.0126984126984127*G8_3_0 - 0.00634920634920635*G8_4_0 - 0.00793650793650792*G8_5_0 - 0.00436507936507936*G9_0_0 - 0.00436507936507934*G9_0_1 - 0.00357142857142857*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.00634920634920629*G9_3_1 + 0.00634920634920633*G9_4_0 + 0.0079365079365079*G9_4_1 + 0.007936507936507 [...]
+    A[18] = 0.666666666666664*G0_0_0_1 + 0.666666666666664*G2_0_0_1 - 0.00793650793650794*G8_0_0 + 0.019047619047619*G8_1_0 - 0.0126984126984127*G8_2_0 + 0.0634920634920634*G8_3_0 + 0.00634920634920632*G8_4_0 + 0.0317460317460317*G8_5_0 + 0.00634920634920635*G9_0_0 + 0.00634920634920634*G9_0_1 + 0.019047619047619*G9_1_0 - 0.0126984126984127*G9_2_1 - 0.0126984126984127*G9_3_0 + 0.019047619047619*G9_3_1 + 0.0126984126984127*G9_4_0 + 0.00634920634920637*G9_4_1 - 0.0253968253968254*G9_5_0 -  [...]
+    A[19] = -0.00634920634920638*G8_0_0 + 0.00476190476190477*G8_1_0 - 0.00634920634920635*G8_2_0 + 0.00634920634920632*G8_3_0 - 0.0380952380952382*G8_4_0 + 0.0063492063492063*G8_5_0 + 0.00793650793650793*G9_0_0 + 0.00793650793650798*G9_0_1 + 0.00476190476190477*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_0 - 0.00634920634920621*G9_3_1 + 0.019047619047619*G9_4_0 - 0.0126984126984127*G9_5_0 + 0.00634920634920634*G9_5_1 - 0.00634920634920638*G11_0_6 + 0.00476190476190477*G [...]
+    A[20] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_0_1 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_0_1 - 0.0126984126984127*G8_0_0 + 0.0190476190476191*G8_1_0 - 0.00793650793650792*G8_2_0 + 0.0317460317460317*G8_3_0 + 0.0063492063492063*G8_4_0 + 0.0634920634920634*G8_5_0 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 + 0.0190476190476191*G9_1_0 - 0.00634920634920636*G9_2_1 - 0.00634920634920634*G9_3_0 + 0.019047619047619*G9_3_1 + 0.00634920634920634*G9_4_ [...]
+    A[21] = 0.00357142857142857*G13_6_0 + 0.00357142857142858*G13_6_1 - 0.00357142857142856*G13_7_0 + 0.00436507936507936*G13_8_1 + 0.00158730158730159*G13_9_0 - 0.00634920634920631*G13_9_1 - 0.00158730158730159*G13_10_0 - 0.00793650793650796*G13_10_1 + 0.00634920634920635*G13_11_1;
+    A[22] = 0.00714285714285716*G13_6_0 + 0.00714285714285705*G13_6_1 + 0.0309523809523809*G13_7_0 - 0.00714285714285712*G13_8_1 + 0.00952380952380949*G13_9_0 + 0.0476190476190473*G13_9_1 - 0.00952380952380949*G13_10_0 - 0.0380952380952381*G13_11_0 - 0.0476190476190476*G13_11_1;
+    A[23] = -0.00436507936507936*G13_6_0 - 0.00436507936507934*G13_6_1 - 0.00357142857142857*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.00634920634920629*G13_9_1 + 0.00634920634920633*G13_10_0 + 0.0079365079365079*G13_10_1 + 0.00793650793650793*G13_11_0 + 0.00634920634920634*G13_11_1;
+    A[24] = 0.00634920634920635*G13_6_0 + 0.00634920634920634*G13_6_1 + 0.019047619047619*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 + 0.019047619047619*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.00634920634920637*G13_10_1 - 0.0253968253968254*G13_11_0 - 0.019047619047619*G13_11_1;
     A[25] = 0.00793650793650793*G13_6_0 + 0.00793650793650798*G13_6_1 + 0.00476190476190477*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.00634920634920621*G13_9_1 + 0.019047619047619*G13_10_0 - 0.0126984126984127*G13_11_0 + 0.00634920634920634*G13_11_1;
-    A[26] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 + 0.0190476190476191*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.019047619047619*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00634920634920631*G13_10_1 - 0.0317460317460318*G13_11_0 - 0.0190476190476191*G13_11_1;
+    A[26] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 + 0.0190476190476191*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.019047619047619*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00634920634920632*G13_10_1 - 0.0317460317460318*G13_11_0 - 0.0190476190476191*G13_11_1;
     A[27] = 0.0;
     A[28] = 0.166666666666667*G6_0;
     A[29] = 0.0;
-    A[30] = 0.166666666666666*G0_0_1_0 + 0.166666666666666*G0_0_1_1 + 0.166666666666666*G2_0_1_0 + 0.166666666666666*G2_0_1_1 - 0.00714285714285714*G8_0_1 + 0.00436507936507936*G8_1_1 - 0.00357142857142857*G8_2_1 - 0.00793650793650795*G8_3_1 - 0.0126984126984127*G8_4_1 - 0.00634920634920636*G8_5_1 + 0.00357142857142858*G9_0_0 + 0.00357142857142859*G9_0_1 + 0.00436507936507937*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920634*G9_3_0 + 0.00158730158730163*G9_3_1 + 0.006349206349206 [...]
-    A[31] = -0.166666666666667*G0_0_1_0 - 0.166666666666667*G2_0_1_0 + 0.00436507936507936*G8_0_1 - 0.00714285714285712*G8_1_1 - 0.00357142857142857*G8_2_1 - 0.0126984126984127*G8_3_1 - 0.00793650793650795*G8_4_1 - 0.00634920634920636*G8_5_1 - 0.00436507936507936*G9_0_0 - 0.00436507936507934*G9_0_1 - 0.00357142857142857*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.00634920634920629*G9_3_1 + 0.00634920634920633*G9_4_0 + 0.00793650793650789*G9_4_1 + 0.00793650793650 [...]
-    A[32] = 0.5*G0_0_1_1 + 0.5*G2_0_1_1 - 0.00357142857142857*G8_0_1 - 0.00357142857142857*G8_1_1 + 0.030952380952381*G8_2_1 + 0.019047619047619*G8_3_1 + 0.0190476190476191*G8_4_1 + 0.00476190476190475*G8_5_1 + 0.00714285714285712*G9_0_0 + 0.00714285714285704*G9_0_1 - 0.00714285714285716*G9_1_0 + 0.030952380952381*G9_2_1 + 0.0476190476190475*G9_3_0 + 0.00952380952380924*G9_3_1 - 0.0476190476190475*G9_4_0 - 0.0380952380952379*G9_4_1 - 0.00952380952380949*G9_5_1 - 0.00357142857142857*G11_1 [...]
-    A[33] = 0.666666666666667*G0_0_1_0 + 0.666666666666667*G2_0_1_0 - 0.00793650793650795*G8_0_1 - 0.0126984126984127*G8_1_1 + 0.019047619047619*G8_2_1 + 0.0634920634920636*G8_3_1 + 0.0317460317460318*G8_4_1 + 0.00634920634920641*G8_5_1 + 0.00634920634920632*G9_0_0 + 0.00634920634920634*G9_0_1 - 0.0126984126984127*G9_1_0 + 0.019047619047619*G9_2_1 + 0.019047619047619*G9_3_0 - 0.0126984126984127*G9_3_1 - 0.019047619047619*G9_4_0 - 0.0253968253968254*G9_4_1 + 0.00634920634920637*G9_5_0 + 0 [...]
-    A[34] = -0.666666666666667*G0_0_1_0 - 0.666666666666665*G0_0_1_1 - 0.666666666666667*G2_0_1_0 - 0.666666666666665*G2_0_1_1 - 0.0126984126984127*G8_0_1 - 0.00793650793650795*G8_1_1 + 0.0190476190476191*G8_2_1 + 0.0317460317460318*G8_3_1 + 0.0634920634920636*G8_4_1 + 0.00634920634920641*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 - 0.00634920634920635*G9_1_0 + 0.0190476190476191*G9_2_1 + 0.019047619047619*G9_3_0 - 0.00634920634920638*G9_3_1 - 0.019047619047619*G9_4_0 [...]
+    A[30] = 0.166666666666666*G0_0_1_0 + 0.166666666666666*G0_0_1_1 + 0.166666666666666*G2_0_1_0 + 0.166666666666666*G2_0_1_1 - 0.00714285714285714*G8_0_1 + 0.00436507936507936*G8_1_1 - 0.00357142857142857*G8_2_1 - 0.00793650793650795*G8_3_1 - 0.0126984126984127*G8_4_1 - 0.00634920634920636*G8_5_1 + 0.00357142857142858*G9_0_0 + 0.00357142857142859*G9_0_1 + 0.00436507936507937*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920634*G9_3_0 + 0.00158730158730162*G9_3_1 + 0.006349206349206 [...]
+    A[31] = -0.166666666666667*G0_0_1_0 - 0.166666666666667*G2_0_1_0 + 0.00436507936507936*G8_0_1 - 0.00714285714285712*G8_1_1 - 0.00357142857142857*G8_2_1 - 0.0126984126984127*G8_3_1 - 0.00793650793650795*G8_4_1 - 0.00634920634920636*G8_5_1 - 0.00436507936507936*G9_0_0 - 0.00436507936507934*G9_0_1 - 0.00357142857142857*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.00634920634920629*G9_3_1 + 0.00634920634920633*G9_4_0 + 0.0079365079365079*G9_4_1 + 0.007936507936507 [...]
+    A[32] = 0.5*G0_0_1_1 + 0.5*G2_0_1_1 - 0.00357142857142857*G8_0_1 - 0.00357142857142857*G8_1_1 + 0.030952380952381*G8_2_1 + 0.019047619047619*G8_3_1 + 0.0190476190476191*G8_4_1 + 0.00476190476190475*G8_5_1 + 0.00714285714285713*G9_0_0 + 0.00714285714285705*G9_0_1 - 0.00714285714285715*G9_1_0 + 0.030952380952381*G9_2_1 + 0.0476190476190475*G9_3_0 + 0.00952380952380926*G9_3_1 - 0.0476190476190475*G9_4_0 - 0.0380952380952379*G9_4_1 - 0.00952380952380948*G9_5_1 - 0.00357142857142857*G11_1 [...]
+    A[33] = 0.666666666666667*G0_0_1_0 + 0.666666666666667*G2_0_1_0 - 0.00793650793650795*G8_0_1 - 0.0126984126984127*G8_1_1 + 0.019047619047619*G8_2_1 + 0.0634920634920636*G8_3_1 + 0.0317460317460318*G8_4_1 + 0.00634920634920641*G8_5_1 + 0.00634920634920633*G9_0_0 + 0.00634920634920634*G9_0_1 - 0.0126984126984127*G9_1_0 + 0.019047619047619*G9_2_1 + 0.019047619047619*G9_3_0 - 0.0126984126984127*G9_3_1 - 0.019047619047619*G9_4_0 - 0.0253968253968254*G9_4_1 + 0.00634920634920635*G9_5_0 + 0 [...]
+    A[34] = -0.666666666666667*G0_0_1_0 - 0.666666666666665*G0_0_1_1 - 0.666666666666667*G2_0_1_0 - 0.666666666666665*G2_0_1_1 - 0.0126984126984127*G8_0_1 - 0.00793650793650795*G8_1_1 + 0.0190476190476191*G8_2_1 + 0.0317460317460318*G8_3_1 + 0.0634920634920636*G8_4_1 + 0.00634920634920641*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 - 0.00634920634920635*G9_1_0 + 0.0190476190476191*G9_2_1 + 0.019047619047619*G9_3_0 - 0.00634920634920637*G9_3_1 - 0.019047619047619*G9_4_0 [...]
     A[35] = -0.00634920634920636*G8_0_1 - 0.00634920634920636*G8_1_1 + 0.00476190476190475*G8_2_1 + 0.00634920634920641*G8_3_1 + 0.00634920634920641*G8_4_1 - 0.038095238095238*G8_5_1 + 0.00793650793650792*G9_0_0 + 0.00793650793650798*G9_0_1 - 0.00793650793650792*G9_1_0 + 0.00476190476190475*G9_2_1 - 0.00634920634920632*G9_3_0 - 0.0190476190476189*G9_3_1 + 0.00634920634920632*G9_4_0 - 0.0126984126984128*G9_4_1 + 0.019047619047619*G9_5_1 - 0.00634920634920636*G11_1_6 - 0.00634920634920636* [...]
-    A[36] = 0.00357142857142858*G13_6_0 + 0.00357142857142859*G13_6_1 + 0.00436507936507937*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.00158730158730163*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00793650793650795*G13_11_0 - 0.00158730158730159*G13_11_1;
-    A[37] = -0.00436507936507936*G13_6_0 - 0.00436507936507934*G13_6_1 - 0.00357142857142857*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.00634920634920629*G13_9_1 + 0.00634920634920633*G13_10_0 + 0.00793650793650789*G13_10_1 + 0.00793650793650793*G13_11_0 + 0.00634920634920634*G13_11_1;
-    A[38] = 0.00714285714285712*G13_6_0 + 0.00714285714285704*G13_6_1 - 0.00714285714285716*G13_7_0 + 0.030952380952381*G13_8_1 + 0.0476190476190475*G13_9_0 + 0.00952380952380924*G13_9_1 - 0.0476190476190475*G13_10_0 - 0.0380952380952379*G13_10_1 - 0.00952380952380949*G13_11_1;
-    A[39] = 0.00634920634920632*G13_6_0 + 0.00634920634920634*G13_6_1 - 0.0126984126984127*G13_7_0 + 0.019047619047619*G13_8_1 + 0.019047619047619*G13_9_0 - 0.0126984126984127*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0253968253968254*G13_10_1 + 0.00634920634920637*G13_11_0 + 0.0126984126984127*G13_11_1;
-    A[40] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 - 0.00634920634920635*G13_7_0 + 0.0190476190476191*G13_8_1 + 0.019047619047619*G13_9_0 - 0.00634920634920638*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0317460317460317*G13_10_1 - 0.00634920634920633*G13_11_0 + 0.00634920634920636*G13_11_1;
+    A[36] = 0.00357142857142858*G13_6_0 + 0.00357142857142859*G13_6_1 + 0.00436507936507937*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.00158730158730162*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00793650793650795*G13_11_0 - 0.00158730158730159*G13_11_1;
+    A[37] = -0.00436507936507936*G13_6_0 - 0.00436507936507934*G13_6_1 - 0.00357142857142857*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.00634920634920629*G13_9_1 + 0.00634920634920633*G13_10_0 + 0.0079365079365079*G13_10_1 + 0.00793650793650793*G13_11_0 + 0.00634920634920634*G13_11_1;
+    A[38] = 0.00714285714285713*G13_6_0 + 0.00714285714285705*G13_6_1 - 0.00714285714285715*G13_7_0 + 0.030952380952381*G13_8_1 + 0.0476190476190475*G13_9_0 + 0.00952380952380926*G13_9_1 - 0.0476190476190475*G13_10_0 - 0.0380952380952379*G13_10_1 - 0.00952380952380948*G13_11_1;
+    A[39] = 0.00634920634920633*G13_6_0 + 0.00634920634920634*G13_6_1 - 0.0126984126984127*G13_7_0 + 0.019047619047619*G13_8_1 + 0.019047619047619*G13_9_0 - 0.0126984126984127*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0253968253968254*G13_10_1 + 0.00634920634920635*G13_11_0 + 0.0126984126984127*G13_11_1;
+    A[40] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 - 0.00634920634920635*G13_7_0 + 0.0190476190476191*G13_8_1 + 0.019047619047619*G13_9_0 - 0.00634920634920637*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0317460317460317*G13_10_1 - 0.00634920634920635*G13_11_0 + 0.00634920634920636*G13_11_1;
     A[41] = 0.00793650793650792*G13_6_0 + 0.00793650793650798*G13_6_1 - 0.00793650793650792*G13_7_0 + 0.00476190476190475*G13_8_1 - 0.00634920634920632*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.00634920634920632*G13_10_0 - 0.0126984126984128*G13_10_1 + 0.019047619047619*G13_11_1;
     A[42] = 0.0;
     A[43] = 0.0;
     A[44] = 0.166666666666667*G6_1;
-    A[45] = 0.0095238095238095*G8_0_0 + 0.00952380952380933*G8_0_1 + 0.00158730158730159*G8_1_0 - 0.00634920634920631*G8_1_1 - 0.00634920634920634*G8_2_0 + 0.00158730158730163*G8_2_1 - 0.019047619047619*G8_3_0 - 0.0190476190476189*G8_3_1 - 0.0126984126984127*G8_4_0 - 0.00634920634920632*G8_4_1 - 0.00634920634920634*G8_5_0 - 0.0126984126984127*G8_5_1 - 0.00476190476190477*G9_0_0 - 0.00476190476190471*G9_0_1 - 0.00793650793650793*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3 [...]
-    A[46] = 0.666666666666664*G0_0_1_0 + 0.666666666666664*G2_0_1_0 + 0.00158730158730159*G8_0_0 - 0.00634920634920631*G8_0_1 + 0.00952380952380949*G8_1_0 + 0.0476190476190473*G8_1_1 - 0.00634920634920633*G8_2_0 - 0.00634920634920629*G8_2_1 - 0.0126984126984127*G8_3_0 + 0.019047619047619*G8_3_1 - 0.019047619047619*G8_4_0 - 0.00634920634920621*G8_4_1 - 0.00634920634920634*G8_5_0 + 0.019047619047619*G8_5_1 + 0.00634920634920636*G9_0_0 + 0.00634920634920634*G9_0_1 + 0.019047619047619*G9_1_0 [...]
-    A[47] = 0.666666666666667*G0_0_0_1 + 0.666666666666667*G2_0_0_1 - 0.00634920634920634*G8_0_0 + 0.00158730158730163*G8_0_1 - 0.00634920634920633*G8_1_0 - 0.00634920634920629*G8_1_1 + 0.0476190476190475*G8_2_0 + 0.00952380952380924*G8_2_1 + 0.019047619047619*G8_3_0 - 0.0126984126984127*G8_3_1 + 0.019047619047619*G8_4_0 - 0.00634920634920638*G8_4_1 - 0.00634920634920633*G8_5_0 - 0.0190476190476189*G8_5_1 + 0.00634920634920632*G9_0_0 + 0.00634920634920634*G9_0_1 - 0.0126984126984127*G9_1 [...]
+    A[45] = 0.0095238095238095*G8_0_0 + 0.00952380952380934*G8_0_1 + 0.00158730158730159*G8_1_0 - 0.00634920634920631*G8_1_1 - 0.00634920634920634*G8_2_0 + 0.00158730158730162*G8_2_1 - 0.019047619047619*G8_3_0 - 0.0190476190476189*G8_3_1 - 0.0126984126984127*G8_4_0 - 0.00634920634920631*G8_4_1 - 0.00634920634920634*G8_5_0 - 0.0126984126984127*G8_5_1 - 0.00476190476190477*G9_0_0 - 0.00476190476190471*G9_0_1 - 0.00793650793650793*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3 [...]
+    A[46] = 0.666666666666664*G0_0_1_0 + 0.666666666666664*G2_0_1_0 + 0.00158730158730159*G8_0_0 - 0.00634920634920631*G8_0_1 + 0.00952380952380949*G8_1_0 + 0.0476190476190473*G8_1_1 - 0.00634920634920633*G8_2_0 - 0.00634920634920629*G8_2_1 - 0.0126984126984127*G8_3_0 + 0.019047619047619*G8_3_1 - 0.019047619047619*G8_4_0 - 0.00634920634920621*G8_4_1 - 0.00634920634920634*G8_5_0 + 0.019047619047619*G8_5_1 + 0.00634920634920635*G9_0_0 + 0.00634920634920634*G9_0_1 + 0.019047619047619*G9_1_0 [...]
+    A[47] = 0.666666666666667*G0_0_0_1 + 0.666666666666667*G2_0_0_1 - 0.00634920634920634*G8_0_0 + 0.00158730158730162*G8_0_1 - 0.00634920634920633*G8_1_0 - 0.00634920634920629*G8_1_1 + 0.0476190476190475*G8_2_0 + 0.00952380952380926*G8_2_1 + 0.019047619047619*G8_3_0 - 0.0126984126984127*G8_3_1 + 0.019047619047619*G8_4_0 - 0.00634920634920638*G8_4_1 - 0.00634920634920633*G8_5_0 - 0.0190476190476189*G8_5_1 + 0.00634920634920633*G9_0_0 + 0.00634920634920634*G9_0_1 - 0.0126984126984127*G9_1 [...]
     A[48] = 1.33333333333333*G0_0_0_0 + 0.666666666666656*G0_0_0_1 + 0.666666666666656*G0_0_1_0 + 1.33333333333332*G0_0_1_1 + 1.33333333333333*G2_0_0_0 + 0.666666666666656*G2_0_0_1 + 0.666666666666656*G2_0_1_0 + 1.33333333333332*G2_0_1_1 - 0.019047619047619*G8_0_0 - 0.0190476190476189*G8_0_1 - 0.0126984126984127*G8_1_0 + 0.019047619047619*G8_1_1 + 0.019047619047619*G8_2_0 - 0.0126984126984127*G8_2_1 + 0.152380952380952*G8_3_0 + 0.152380952380951*G8_3_1 + 0.076190476190476*G8_4_0 + 0.0507 [...]
-    A[49] = -1.33333333333333*G0_0_0_0 - 0.666666666666659*G0_0_0_1 - 0.666666666666656*G0_0_1_0 - 1.33333333333333*G2_0_0_0 - 0.666666666666659*G2_0_0_1 - 0.666666666666656*G2_0_1_0 - 0.0126984126984127*G8_0_0 - 0.00634920634920632*G8_0_1 - 0.019047619047619*G8_1_0 - 0.00634920634920621*G8_1_1 + 0.019047619047619*G8_2_0 - 0.00634920634920638*G8_2_1 + 0.076190476190476*G8_3_0 + 0.0507936507936502*G8_3_1 + 0.152380952380952*G8_4_0 + 0.0507936507936496*G8_4_1 + 0.0507936507936507*G8_5_0 +  [...]
+    A[49] = -1.33333333333333*G0_0_0_0 - 0.666666666666659*G0_0_0_1 - 0.666666666666656*G0_0_1_0 - 1.33333333333333*G2_0_0_0 - 0.666666666666659*G2_0_0_1 - 0.666666666666656*G2_0_1_0 - 0.0126984126984127*G8_0_0 - 0.00634920634920631*G8_0_1 - 0.019047619047619*G8_1_0 - 0.00634920634920621*G8_1_1 + 0.019047619047619*G8_2_0 - 0.00634920634920637*G8_2_1 + 0.076190476190476*G8_3_0 + 0.0507936507936502*G8_3_1 + 0.152380952380952*G8_4_0 + 0.0507936507936496*G8_4_1 + 0.0507936507936507*G8_5_0 +  [...]
     A[50] = -0.666666666666665*G0_0_0_1 - 0.666666666666666*G0_0_1_0 - 1.33333333333332*G0_0_1_1 - 0.666666666666665*G2_0_0_1 - 0.666666666666666*G2_0_1_0 - 1.33333333333332*G2_0_1_1 - 0.00634920634920634*G8_0_0 - 0.0126984126984127*G8_0_1 - 0.00634920634920634*G8_1_0 + 0.019047619047619*G8_1_1 - 0.00634920634920632*G8_2_0 - 0.0190476190476189*G8_2_1 + 0.0507936507936507*G8_3_0 + 0.0761904761904756*G8_3_1 + 0.0507936507936507*G8_4_0 + 0.0507936507936502*G8_4_1 + 0.0507936507936507*G8_5_0 [...]
     A[51] = -0.00476190476190477*G13_6_0 - 0.00476190476190471*G13_6_1 - 0.00793650793650793*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.019047619047619*G13_10_0 + 0.0126984126984126*G13_10_1 + 0.0126984126984127*G13_11_0 + 0.019047619047619*G13_11_1;
-    A[52] = 0.00634920634920636*G13_6_0 + 0.00634920634920634*G13_6_1 + 0.019047619047619*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 + 0.019047619047619*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.00634920634920638*G13_10_1 - 0.0253968253968254*G13_11_0 - 0.019047619047619*G13_11_1;
-    A[53] = 0.00634920634920632*G13_6_0 + 0.00634920634920634*G13_6_1 - 0.0126984126984127*G13_7_0 + 0.019047619047619*G13_8_1 + 0.019047619047619*G13_9_0 - 0.0126984126984127*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0253968253968254*G13_10_1 + 0.00634920634920637*G13_11_0 + 0.0126984126984127*G13_11_1;
+    A[52] = 0.00634920634920635*G13_6_0 + 0.00634920634920634*G13_6_1 + 0.019047619047619*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 + 0.019047619047619*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.00634920634920637*G13_10_1 - 0.0253968253968254*G13_11_0 - 0.019047619047619*G13_11_1;
+    A[53] = 0.00634920634920633*G13_6_0 + 0.00634920634920634*G13_6_1 - 0.0126984126984127*G13_7_0 + 0.019047619047619*G13_8_1 + 0.019047619047619*G13_9_0 - 0.0126984126984127*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0253968253968254*G13_10_1 + 0.00634920634920635*G13_11_0 + 0.0126984126984127*G13_11_1;
     A[54] = 0.0380952380952381*G13_6_0 + 0.0380952380952376*G13_6_1 + 0.0634920634920634*G13_7_0 + 0.0634920634920636*G13_8_1 + 0.152380952380952*G13_9_0 + 0.152380952380951*G13_9_1 - 0.152380952380952*G13_10_0 - 0.101587301587301*G13_10_1 - 0.101587301587302*G13_11_0 - 0.152380952380952*G13_11_1;
     A[55] = -0.00634920634920632*G13_6_0 - 0.00634920634920656*G13_6_1 + 0.00634920634920632*G13_7_0 + 0.0317460317460318*G13_8_1 + 0.076190476190476*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.076190476190476*G13_10_0 - 0.025396825396825*G13_10_1 - 0.0507936507936508*G13_11_1;
     A[56] = -0.00634920634920629*G13_6_0 - 0.00634920634920655*G13_6_1 + 0.0317460317460317*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0761904761904756*G13_9_1 - 0.0507936507936507*G13_10_0 - 0.0253968253968254*G13_11_0 - 0.0761904761904762*G13_11_1;
     A[57] = 0.166666666666666*G6_0 + 0.166666666666665*G6_1;
     A[58] = 0.166666666666666*G6_0 + 0.333333333333331*G6_1;
     A[59] = 0.333333333333333*G6_0 + 0.166666666666664*G6_1;
-    A[60] = -0.666666666666668*G0_0_1_0 - 0.666666666666668*G0_0_1_1 - 0.666666666666668*G2_0_1_0 - 0.666666666666668*G2_0_1_1 - 0.0095238095238095*G8_0_0 + 0.0380952380952383*G8_0_1 - 0.00158730158730159*G8_1_0 - 0.00793650793650796*G8_1_1 + 0.00634920634920634*G8_2_0 + 0.019047619047619*G8_3_0 + 0.0126984126984126*G8_3_1 + 0.0126984126984127*G8_4_0 + 0.0317460317460317*G8_4_1 + 0.00634920634920634*G8_5_0 + 0.0253968253968254*G8_5_1 - 0.0190476190476191*G9_0_0 - 0.0190476190476191*G9_0_ [...]
-    A[61] = -0.00158730158730159*G8_0_0 - 0.00793650793650796*G8_0_1 - 0.00952380952380949*G8_1_0 + 0.00634920634920633*G8_2_0 + 0.00793650793650789*G8_2_1 + 0.0126984126984127*G8_3_0 + 0.00634920634920638*G8_3_1 + 0.019047619047619*G8_4_0 + 0.00634920634920634*G8_5_0 - 0.00634920634920631*G8_5_1 + 0.00793650793650793*G9_0_0 + 0.00793650793650798*G9_0_1 + 0.00476190476190477*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_0 - 0.00634920634920621*G9_3_1 + 0.019047619047619*G9 [...]
-    A[62] = -0.666666666666667*G0_0_0_1 - 0.666666666666665*G0_0_1_1 - 0.666666666666667*G2_0_0_1 - 0.666666666666665*G2_0_1_1 + 0.00634920634920634*G8_0_0 + 0.00634920634920633*G8_1_0 + 0.00793650793650789*G8_1_1 - 0.0476190476190475*G8_2_0 - 0.0380952380952379*G8_2_1 - 0.019047619047619*G8_3_0 - 0.0253968253968254*G8_3_1 - 0.019047619047619*G8_4_0 - 0.0317460317460317*G8_4_1 + 0.00634920634920633*G8_5_0 - 0.0126984126984128*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 [...]
-    A[63] = -1.33333333333333*G0_0_0_0 - 0.666666666666656*G0_0_0_1 - 0.666666666666659*G0_0_1_0 - 1.33333333333333*G2_0_0_0 - 0.666666666666656*G2_0_0_1 - 0.666666666666659*G2_0_1_0 + 0.019047619047619*G8_0_0 + 0.0126984126984126*G8_0_1 + 0.0126984126984127*G8_1_0 + 0.00634920634920638*G8_1_1 - 0.019047619047619*G8_2_0 - 0.0253968253968254*G8_2_1 - 0.152380952380952*G8_3_0 - 0.101587301587301*G8_3_1 - 0.076190476190476*G8_4_0 - 0.025396825396825*G8_4_1 - 0.0507936507936507*G8_5_0 - 0.00 [...]
+    A[60] = -0.666666666666668*G0_0_1_0 - 0.666666666666668*G0_0_1_1 - 0.666666666666668*G2_0_1_0 - 0.666666666666668*G2_0_1_1 - 0.0095238095238095*G8_0_0 + 0.0380952380952382*G8_0_1 - 0.00158730158730159*G8_1_0 - 0.00793650793650796*G8_1_1 + 0.00634920634920634*G8_2_0 + 0.019047619047619*G8_3_0 + 0.0126984126984126*G8_3_1 + 0.0126984126984127*G8_4_0 + 0.0317460317460317*G8_4_1 + 0.00634920634920634*G8_5_0 + 0.0253968253968254*G8_5_1 - 0.0190476190476191*G9_0_0 - 0.0190476190476191*G9_0_ [...]
+    A[61] = -0.00158730158730159*G8_0_0 - 0.00793650793650796*G8_0_1 - 0.00952380952380949*G8_1_0 + 0.00634920634920633*G8_2_0 + 0.0079365079365079*G8_2_1 + 0.0126984126984127*G8_3_0 + 0.00634920634920637*G8_3_1 + 0.019047619047619*G8_4_0 + 0.00634920634920634*G8_5_0 - 0.00634920634920632*G8_5_1 + 0.00793650793650793*G9_0_0 + 0.00793650793650798*G9_0_1 + 0.00476190476190477*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_0 - 0.00634920634920621*G9_3_1 + 0.019047619047619*G9_ [...]
+    A[62] = -0.666666666666667*G0_0_0_1 - 0.666666666666665*G0_0_1_1 - 0.666666666666667*G2_0_0_1 - 0.666666666666665*G2_0_1_1 + 0.00634920634920634*G8_0_0 + 0.00634920634920633*G8_1_0 + 0.0079365079365079*G8_1_1 - 0.0476190476190475*G8_2_0 - 0.0380952380952379*G8_2_1 - 0.019047619047619*G8_3_0 - 0.0253968253968254*G8_3_1 - 0.019047619047619*G8_4_0 - 0.0317460317460317*G8_4_1 + 0.00634920634920633*G8_5_0 - 0.0126984126984128*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1  [...]
+    A[63] = -1.33333333333333*G0_0_0_0 - 0.666666666666656*G0_0_0_1 - 0.666666666666659*G0_0_1_0 - 1.33333333333333*G2_0_0_0 - 0.666666666666656*G2_0_0_1 - 0.666666666666659*G2_0_1_0 + 0.019047619047619*G8_0_0 + 0.0126984126984126*G8_0_1 + 0.0126984126984127*G8_1_0 + 0.00634920634920637*G8_1_1 - 0.019047619047619*G8_2_0 - 0.0253968253968254*G8_2_1 - 0.152380952380952*G8_3_0 - 0.101587301587301*G8_3_1 - 0.076190476190476*G8_4_0 - 0.025396825396825*G8_4_1 - 0.0507936507936507*G8_5_0 - 0.00 [...]
     A[64] = 1.33333333333333*G0_0_0_0 + 0.666666666666659*G0_0_0_1 + 0.666666666666659*G0_0_1_0 + 1.33333333333333*G0_0_1_1 + 1.33333333333333*G2_0_0_0 + 0.666666666666659*G2_0_0_1 + 0.666666666666659*G2_0_1_0 + 1.33333333333333*G2_0_1_1 + 0.0126984126984127*G8_0_0 + 0.0317460317460317*G8_0_1 + 0.019047619047619*G8_1_0 - 0.019047619047619*G8_2_0 - 0.0317460317460317*G8_2_1 - 0.076190476190476*G8_3_0 - 0.025396825396825*G8_3_1 - 0.152380952380952*G8_4_0 - 0.0507936507936507*G8_5_0 + 0.025 [...]
-    A[65] = 0.666666666666665*G0_0_0_1 + 0.666666666666666*G0_0_1_0 + 0.666666666666665*G2_0_0_1 + 0.666666666666666*G2_0_1_0 + 0.00634920634920634*G8_0_0 + 0.0253968253968254*G8_0_1 + 0.00634920634920634*G8_1_0 - 0.00634920634920631*G8_1_1 + 0.00634920634920632*G8_2_0 - 0.0126984126984128*G8_2_1 - 0.0507936507936507*G8_3_0 - 0.0507936507936507*G8_4_0 + 0.0253968253968258*G8_4_1 - 0.0507936507936507*G8_5_0 + 0.101587301587302*G8_5_1 - 0.0317460317460317*G9_0_0 - 0.0317460317460319*G9_0_1 [...]
-    A[66] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.00634920634920637*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 - 0.00634920634920632*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.0317460317460317*G13_10_1 + 0.0253968253968254*G13_11_0 + 0.00634920634920635*G13_11_1;
+    A[65] = 0.666666666666665*G0_0_0_1 + 0.666666666666666*G0_0_1_0 + 0.666666666666665*G2_0_0_1 + 0.666666666666666*G2_0_1_0 + 0.00634920634920634*G8_0_0 + 0.0253968253968254*G8_0_1 + 0.00634920634920634*G8_1_0 - 0.00634920634920632*G8_1_1 + 0.00634920634920632*G8_2_0 - 0.0126984126984128*G8_2_1 - 0.0507936507936507*G8_3_0 - 0.0507936507936507*G8_4_0 + 0.0253968253968258*G8_4_1 - 0.0507936507936507*G8_5_0 + 0.101587301587302*G8_5_1 - 0.0317460317460317*G9_0_0 - 0.0317460317460319*G9_0_1 [...]
+    A[66] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.00634920634920638*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 - 0.00634920634920631*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.0317460317460317*G13_10_1 + 0.0253968253968254*G13_11_0 + 0.00634920634920635*G13_11_1;
     A[67] = 0.00793650793650793*G13_6_0 + 0.00793650793650798*G13_6_1 + 0.00476190476190477*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.00634920634920621*G13_9_1 + 0.019047619047619*G13_10_0 - 0.0126984126984127*G13_11_0 + 0.00634920634920634*G13_11_1;
-    A[68] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 - 0.00634920634920635*G13_7_0 + 0.0190476190476191*G13_8_1 + 0.019047619047619*G13_9_0 - 0.00634920634920638*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0317460317460317*G13_10_1 - 0.00634920634920633*G13_11_0 + 0.00634920634920636*G13_11_1;
+    A[68] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 - 0.00634920634920635*G13_7_0 + 0.0190476190476191*G13_8_1 + 0.019047619047619*G13_9_0 - 0.00634920634920638*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0317460317460317*G13_10_1 - 0.00634920634920635*G13_11_0 + 0.00634920634920636*G13_11_1;
     A[69] = -0.00634920634920632*G13_6_0 - 0.00634920634920656*G13_6_1 + 0.00634920634920632*G13_7_0 + 0.0317460317460318*G13_8_1 + 0.076190476190476*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.076190476190476*G13_10_0 - 0.025396825396825*G13_10_1 - 0.0507936507936508*G13_11_1;
     A[70] = -0.0634920634920635*G13_6_0 - 0.0634920634920639*G13_6_1 - 0.0380952380952382*G13_7_0 + 0.0634920634920636*G13_8_1 + 0.152380952380952*G13_9_0 + 0.0507936507936496*G13_9_1 - 0.152380952380952*G13_10_0 + 0.101587301587302*G13_11_0 - 0.0507936507936507*G13_11_1;
     A[71] = -0.0317460317460317*G13_6_0 - 0.0317460317460319*G13_6_1 + 0.0063492063492063*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.0507936507936507*G13_10_0 + 0.0253968253968258*G13_10_1 + 0.0253968253968254*G13_11_0 - 0.0507936507936508*G13_11_1;
     A[72] = -0.166666666666666*G6_0 + 0.166666666666668*G6_1;
     A[73] = -0.166666666666666*G6_0;
     A[74] = -0.333333333333333*G6_0 - 0.166666666666665*G6_1;
-    A[75] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_0_1 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_0_1 + 0.0380952380952381*G8_0_0 - 0.00952380952380951*G8_0_1 + 0.00634920634920635*G8_1_1 - 0.00793650793650795*G8_2_0 - 0.00158730158730159*G8_2_1 + 0.0126984126984127*G8_3_0 + 0.019047619047619*G8_3_1 + 0.0253968253968254*G8_4_0 + 0.00634920634920635*G8_4_1 + 0.0317460317460318*G8_5_0 + 0.0126984126984127*G8_5_1 - 0.0190476190476191*G9_0_0 - 0.0190476190476191*G9_0 [...]
-    A[76] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_1_0 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_1_0 + 0.00634920634920635*G8_0_1 - 0.0380952380952381*G8_1_0 - 0.0476190476190476*G8_1_1 + 0.00793650793650793*G8_2_0 + 0.00634920634920634*G8_2_1 - 0.0253968253968254*G8_3_0 - 0.019047619047619*G8_3_1 - 0.0126984126984127*G8_4_0 + 0.00634920634920634*G8_4_1 - 0.0317460317460318*G8_5_0 - 0.0190476190476191*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_ [...]
-    A[77] = -0.00793650793650795*G8_0_0 - 0.00158730158730159*G8_0_1 + 0.00793650793650793*G8_1_0 + 0.00634920634920634*G8_1_1 - 0.00952380952380949*G8_2_1 + 0.00634920634920637*G8_3_0 + 0.0126984126984127*G8_3_1 - 0.00634920634920633*G8_4_0 + 0.00634920634920636*G8_4_1 + 0.019047619047619*G8_5_1 + 0.00793650793650792*G9_0_0 + 0.00793650793650798*G9_0_1 - 0.00793650793650792*G9_1_0 + 0.00476190476190475*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.0190476190476189*G9_3_1 + 0.00634920634920633 [...]
-    A[78] = -0.666666666666666*G0_0_0_1 - 0.666666666666665*G0_0_1_0 - 1.33333333333332*G0_0_1_1 - 0.666666666666666*G2_0_0_1 - 0.666666666666665*G2_0_1_0 - 1.33333333333332*G2_0_1_1 + 0.0126984126984127*G8_0_0 + 0.019047619047619*G8_0_1 - 0.0253968253968254*G8_1_0 - 0.019047619047619*G8_1_1 + 0.00634920634920637*G8_2_0 + 0.0126984126984127*G8_2_1 - 0.101587301587302*G8_3_0 - 0.152380952380952*G8_3_1 - 0.0507936507936508*G8_4_1 - 0.0253968253968254*G8_5_0 - 0.0761904761904762*G8_5_1 - 0. [...]
-    A[79] = 0.666666666666666*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 0.666666666666666*G2_0_0_1 + 0.666666666666665*G2_0_1_0 + 0.0253968253968254*G8_0_0 + 0.00634920634920635*G8_0_1 - 0.0126984126984127*G8_1_0 + 0.00634920634920634*G8_1_1 - 0.00634920634920633*G8_2_0 + 0.00634920634920636*G8_2_1 - 0.0507936507936508*G8_3_1 + 0.101587301587302*G8_4_0 - 0.0507936507936507*G8_4_1 + 0.0253968253968254*G8_5_0 - 0.0507936507936508*G8_5_1 - 0.0317460317460317*G9_0_0 - 0.031746031746032*G9_0_1  [...]
+    A[75] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_0_1 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_0_1 + 0.0380952380952382*G8_0_0 - 0.00952380952380951*G8_0_1 + 0.00634920634920635*G8_1_1 - 0.00793650793650795*G8_2_0 - 0.00158730158730159*G8_2_1 + 0.0126984126984127*G8_3_0 + 0.019047619047619*G8_3_1 + 0.0253968253968254*G8_4_0 + 0.00634920634920635*G8_4_1 + 0.0317460317460318*G8_5_0 + 0.0126984126984127*G8_5_1 - 0.0190476190476191*G9_0_0 - 0.0190476190476191*G9_0 [...]
+    A[76] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_1_0 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_1_0 + 0.00634920634920635*G8_0_1 - 0.0380952380952381*G8_1_0 - 0.0476190476190476*G8_1_1 + 0.00793650793650793*G8_2_0 + 0.00634920634920634*G8_2_1 - 0.0253968253968254*G8_3_0 - 0.019047619047619*G8_3_1 - 0.0126984126984127*G8_4_0 + 0.00634920634920634*G8_4_1 - 0.0317460317460318*G8_5_0 - 0.0190476190476191*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_ [...]
+    A[77] = -0.00793650793650795*G8_0_0 - 0.00158730158730159*G8_0_1 + 0.00793650793650793*G8_1_0 + 0.00634920634920634*G8_1_1 - 0.00952380952380948*G8_2_1 + 0.00634920634920635*G8_3_0 + 0.0126984126984127*G8_3_1 - 0.00634920634920635*G8_4_0 + 0.00634920634920636*G8_4_1 + 0.019047619047619*G8_5_1 + 0.00793650793650792*G9_0_0 + 0.00793650793650798*G9_0_1 - 0.00793650793650792*G9_1_0 + 0.00476190476190475*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.0190476190476189*G9_3_1 + 0.00634920634920633 [...]
+    A[78] = -0.666666666666666*G0_0_0_1 - 0.666666666666665*G0_0_1_0 - 1.33333333333332*G0_0_1_1 - 0.666666666666666*G2_0_0_1 - 0.666666666666665*G2_0_1_0 - 1.33333333333332*G2_0_1_1 + 0.0126984126984127*G8_0_0 + 0.019047619047619*G8_0_1 - 0.0253968253968254*G8_1_0 - 0.019047619047619*G8_1_1 + 0.00634920634920635*G8_2_0 + 0.0126984126984127*G8_2_1 - 0.101587301587302*G8_3_0 - 0.152380952380952*G8_3_1 - 0.0507936507936508*G8_4_1 - 0.0253968253968254*G8_5_0 - 0.0761904761904762*G8_5_1 - 0. [...]
+    A[79] = 0.666666666666666*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 0.666666666666666*G2_0_0_1 + 0.666666666666665*G2_0_1_0 + 0.0253968253968254*G8_0_0 + 0.00634920634920635*G8_0_1 - 0.0126984126984127*G8_1_0 + 0.00634920634920634*G8_1_1 - 0.00634920634920635*G8_2_0 + 0.00634920634920636*G8_2_1 - 0.0507936507936508*G8_3_1 + 0.101587301587302*G8_4_0 - 0.0507936507936507*G8_4_1 + 0.0253968253968254*G8_5_0 - 0.0507936507936508*G8_5_1 - 0.0317460317460317*G9_0_0 - 0.0317460317460319*G9_0_1 [...]
     A[80] = 1.33333333333334*G0_0_0_0 + 0.666666666666668*G0_0_0_1 + 0.666666666666668*G0_0_1_0 + 1.33333333333333*G0_0_1_1 + 1.33333333333334*G2_0_0_0 + 0.666666666666668*G2_0_0_1 + 0.666666666666668*G2_0_1_0 + 1.33333333333333*G2_0_1_1 + 0.0317460317460318*G8_0_0 + 0.0126984126984127*G8_0_1 - 0.0317460317460318*G8_1_0 - 0.0190476190476191*G8_1_1 + 0.019047619047619*G8_2_1 - 0.0253968253968254*G8_3_0 - 0.0761904761904762*G8_3_1 + 0.0253968253968254*G8_4_0 - 0.0507936507936508*G8_4_1 - 0 [...]
     A[81] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.0126984126984127*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 - 0.0126984126984127*G13_9_1 + 0.00634920634920634*G13_10_0 + 0.0253968253968254*G13_10_1 + 0.0317460317460318*G13_11_0 + 0.0126984126984127*G13_11_1;
-    A[82] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 + 0.0190476190476191*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.019047619047619*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00634920634920631*G13_10_1 - 0.0317460317460318*G13_11_0 - 0.0190476190476191*G13_11_1;
+    A[82] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 + 0.0190476190476191*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.019047619047619*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00634920634920632*G13_10_1 - 0.0317460317460318*G13_11_0 - 0.0190476190476191*G13_11_1;
     A[83] = 0.00793650793650792*G13_6_0 + 0.00793650793650798*G13_6_1 - 0.00793650793650792*G13_7_0 + 0.00476190476190475*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.00634920634920633*G13_10_0 - 0.0126984126984128*G13_10_1 + 0.019047619047619*G13_11_1;
     A[84] = -0.00634920634920629*G13_6_0 - 0.00634920634920655*G13_6_1 + 0.0317460317460317*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0761904761904756*G13_9_1 - 0.0507936507936507*G13_10_0 - 0.0253968253968254*G13_11_0 - 0.0761904761904762*G13_11_1;
-    A[85] = -0.0317460317460317*G13_6_0 - 0.031746031746032*G13_6_1 + 0.0063492063492063*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.0507936507936507*G13_10_0 + 0.0253968253968258*G13_10_1 + 0.0253968253968254*G13_11_0 - 0.0507936507936508*G13_11_1;
+    A[85] = -0.0317460317460317*G13_6_0 - 0.0317460317460319*G13_6_1 + 0.0063492063492063*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.0507936507936507*G13_10_0 + 0.0253968253968258*G13_10_1 + 0.0253968253968254*G13_11_0 - 0.0507936507936508*G13_11_1;
     A[86] = -0.0634920634920634*G13_6_0 - 0.0634920634920639*G13_6_1 + 0.0634920634920634*G13_7_0 - 0.038095238095238*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.152380952380951*G13_9_1 - 0.0507936507936507*G13_10_0 + 0.101587301587302*G13_10_1 - 0.152380952380952*G13_11_1;
     A[87] = 0.166666666666667*G6_0 - 0.166666666666667*G6_1;
     A[88] = -0.166666666666667*G6_0 - 0.333333333333333*G6_1;
     A[89] = -0.166666666666667*G6_1;
-    A[90] = -0.030952380952381*G10_0_0 - 0.030952380952381*G10_0_1 - 0.00714285714285718*G10_1_0 - 0.00714285714285714*G10_2_1 + 0.0095238095238095*G10_3_0 + 0.00952380952380933*G10_3_1 - 0.0095238095238095*G10_4_0 + 0.0380952380952383*G10_4_1 + 0.0380952380952381*G10_5_0 - 0.00952380952380951*G10_5_1;
-    A[91] = 0.00357142857142857*G10_0_0 + 0.00357142857142858*G10_0_1 - 0.00357142857142857*G10_1_0 + 0.00436507936507936*G10_2_1 + 0.00158730158730159*G10_3_0 - 0.00634920634920631*G10_3_1 - 0.00158730158730159*G10_4_0 - 0.00793650793650796*G10_4_1 + 0.00634920634920635*G10_5_1;
-    A[92] = 0.00357142857142858*G10_0_0 + 0.00357142857142859*G10_0_1 + 0.00436507936507937*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.00158730158730163*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00793650793650795*G10_5_0 - 0.00158730158730159*G10_5_1;
+    A[90] = -0.030952380952381*G10_0_0 - 0.030952380952381*G10_0_1 - 0.00714285714285719*G10_1_0 - 0.00714285714285714*G10_2_1 + 0.0095238095238095*G10_3_0 + 0.00952380952380934*G10_3_1 - 0.0095238095238095*G10_4_0 + 0.0380952380952382*G10_4_1 + 0.0380952380952382*G10_5_0 - 0.00952380952380951*G10_5_1;
+    A[91] = 0.00357142857142857*G10_0_0 + 0.00357142857142858*G10_0_1 - 0.00357142857142856*G10_1_0 + 0.00436507936507936*G10_2_1 + 0.00158730158730159*G10_3_0 - 0.00634920634920631*G10_3_1 - 0.00158730158730159*G10_4_0 - 0.00793650793650796*G10_4_1 + 0.00634920634920635*G10_5_1;
+    A[92] = 0.00357142857142858*G10_0_0 + 0.00357142857142859*G10_0_1 + 0.00436507936507937*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.00158730158730162*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00793650793650795*G10_5_0 - 0.00158730158730159*G10_5_1;
     A[93] = -0.00476190476190477*G10_0_0 - 0.00476190476190471*G10_0_1 - 0.00793650793650793*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.019047619047619*G10_4_0 + 0.0126984126984126*G10_4_1 + 0.0126984126984127*G10_5_0 + 0.019047619047619*G10_5_1;
-    A[94] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.00634920634920637*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 - 0.00634920634920632*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.0317460317460317*G10_4_1 + 0.0253968253968254*G10_5_0 + 0.00634920634920635*G10_5_1;
+    A[94] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.00634920634920638*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 - 0.00634920634920631*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.0317460317460317*G10_4_1 + 0.0253968253968254*G10_5_0 + 0.00634920634920635*G10_5_1;
     A[95] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.0126984126984127*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 - 0.0126984126984127*G10_3_1 + 0.00634920634920634*G10_4_0 + 0.0253968253968254*G10_4_1 + 0.0317460317460318*G10_5_0 + 0.0126984126984127*G10_5_1;
-    A[96] = 0.5*G1_0_0_0 + 0.5*G1_0_0_1 + 0.5*G1_0_1_0 + 0.500000000000001*G1_0_1_1 + 0.5*G3_0_0_0 + 0.5*G3_0_0_1 + 0.5*G3_0_1_0 + 0.500000000000001*G3_0_1_1 - 0.030952380952381*G12_0_0 - 0.030952380952381*G12_0_1 + 0.00357142857142856*G12_1_0 + 0.00357142857142858*G12_1_1 + 0.00357142857142858*G12_2_0 + 0.00357142857142859*G12_2_1 - 0.00476190476190477*G12_3_0 - 0.00476190476190471*G12_3_1 - 0.0190476190476191*G12_4_0 - 0.0190476190476191*G12_4_1 - 0.0190476190476191*G12_5_0 - 0.0190476 [...]
-    A[97] = 0.166666666666668*G1_0_0_0 + 0.166666666666666*G1_0_1_0 + 0.166666666666668*G3_0_0_0 + 0.166666666666666*G3_0_1_0 + 0.00357142857142856*G12_0_0 + 0.00357142857142858*G12_0_1 + 0.00714285714285717*G12_1_0 + 0.00714285714285705*G12_1_1 - 0.00436507936507936*G12_2_0 - 0.00436507936507934*G12_2_1 + 0.00634920634920636*G12_3_0 + 0.00634920634920634*G12_3_1 + 0.00793650793650793*G12_4_0 + 0.00793650793650798*G12_4_1 + 0.0126984126984127*G12_5_0 + 0.0126984126984127*G12_5_1 + 0.0035 [...]
-    A[98] = 0.166666666666666*G1_0_0_1 + 0.166666666666666*G1_0_1_1 + 0.166666666666666*G3_0_0_1 + 0.166666666666666*G3_0_1_1 + 0.00357142857142858*G12_0_0 + 0.00357142857142859*G12_0_1 - 0.00436507936507936*G12_1_0 - 0.00436507936507934*G12_1_1 + 0.00714285714285712*G12_2_0 + 0.00714285714285704*G12_2_1 + 0.00634920634920632*G12_3_0 + 0.00634920634920634*G12_3_1 + 0.0126984126984127*G12_4_0 + 0.0126984126984127*G12_4_1 + 0.00793650793650792*G12_5_0 + 0.00793650793650798*G12_5_1 + 0.0035 [...]
-    A[99] = -0.00476190476190477*G12_0_0 - 0.00476190476190471*G12_0_1 + 0.00634920634920636*G12_1_0 + 0.00634920634920634*G12_1_1 + 0.00634920634920632*G12_2_0 + 0.00634920634920634*G12_2_1 + 0.0380952380952381*G12_3_0 + 0.0380952380952376*G12_3_1 - 0.00634920634920632*G12_4_0 - 0.00634920634920656*G12_4_1 - 0.00634920634920629*G12_5_0 - 0.00634920634920655*G12_5_1 - 0.00476190476190477*G14_6_0 - 0.00476190476190471*G14_6_1 + 0.00634920634920636*G14_7_0 + 0.00634920634920634*G14_7_1 + 0 [...]
-    A[100] = -0.666666666666668*G1_0_0_1 - 0.666666666666668*G1_0_1_1 - 0.666666666666668*G3_0_0_1 - 0.666666666666668*G3_0_1_1 - 0.0190476190476191*G12_0_0 - 0.0190476190476191*G12_0_1 + 0.00793650793650793*G12_1_0 + 0.00793650793650798*G12_1_1 + 0.0126984126984127*G12_2_0 + 0.0126984126984127*G12_2_1 - 0.00634920634920632*G12_3_0 - 0.00634920634920656*G12_3_1 - 0.0634920634920635*G12_4_0 - 0.0634920634920639*G12_4_1 - 0.0317460317460317*G12_5_0 - 0.031746031746032*G12_5_1 - 0.019047619 [...]
+    A[96] = 0.5*G1_0_0_0 + 0.5*G1_0_0_1 + 0.5*G1_0_1_0 + 0.500000000000001*G1_0_1_1 + 0.5*G3_0_0_0 + 0.5*G3_0_0_1 + 0.5*G3_0_1_0 + 0.500000000000001*G3_0_1_1 - 0.030952380952381*G12_0_0 - 0.030952380952381*G12_0_1 + 0.00357142857142857*G12_1_0 + 0.00357142857142858*G12_1_1 + 0.00357142857142858*G12_2_0 + 0.00357142857142859*G12_2_1 - 0.00476190476190477*G12_3_0 - 0.00476190476190471*G12_3_1 - 0.0190476190476191*G12_4_0 - 0.0190476190476191*G12_4_1 - 0.0190476190476191*G12_5_0 - 0.0190476 [...]
+    A[97] = 0.166666666666668*G1_0_0_0 + 0.166666666666666*G1_0_1_0 + 0.166666666666668*G3_0_0_0 + 0.166666666666666*G3_0_1_0 + 0.00357142857142857*G12_0_0 + 0.00357142857142858*G12_0_1 + 0.00714285714285716*G12_1_0 + 0.00714285714285705*G12_1_1 - 0.00436507936507936*G12_2_0 - 0.00436507936507934*G12_2_1 + 0.00634920634920635*G12_3_0 + 0.00634920634920634*G12_3_1 + 0.00793650793650793*G12_4_0 + 0.00793650793650798*G12_4_1 + 0.0126984126984127*G12_5_0 + 0.0126984126984127*G12_5_1 + 0.0035 [...]
+    A[98] = 0.166666666666666*G1_0_0_1 + 0.166666666666666*G1_0_1_1 + 0.166666666666666*G3_0_0_1 + 0.166666666666666*G3_0_1_1 + 0.00357142857142858*G12_0_0 + 0.00357142857142859*G12_0_1 - 0.00436507936507936*G12_1_0 - 0.00436507936507934*G12_1_1 + 0.00714285714285713*G12_2_0 + 0.00714285714285705*G12_2_1 + 0.00634920634920633*G12_3_0 + 0.00634920634920634*G12_3_1 + 0.0126984126984127*G12_4_0 + 0.0126984126984127*G12_4_1 + 0.00793650793650792*G12_5_0 + 0.00793650793650798*G12_5_1 + 0.0035 [...]
+    A[99] = -0.00476190476190477*G12_0_0 - 0.00476190476190471*G12_0_1 + 0.00634920634920635*G12_1_0 + 0.00634920634920634*G12_1_1 + 0.00634920634920633*G12_2_0 + 0.00634920634920634*G12_2_1 + 0.0380952380952381*G12_3_0 + 0.0380952380952376*G12_3_1 - 0.00634920634920632*G12_4_0 - 0.00634920634920656*G12_4_1 - 0.00634920634920629*G12_5_0 - 0.00634920634920655*G12_5_1 - 0.00476190476190477*G14_6_0 - 0.00476190476190471*G14_6_1 + 0.00634920634920635*G14_7_0 + 0.00634920634920634*G14_7_1 + 0 [...]
+    A[100] = -0.666666666666668*G1_0_0_1 - 0.666666666666668*G1_0_1_1 - 0.666666666666668*G3_0_0_1 - 0.666666666666668*G3_0_1_1 - 0.0190476190476191*G12_0_0 - 0.0190476190476191*G12_0_1 + 0.00793650793650793*G12_1_0 + 0.00793650793650798*G12_1_1 + 0.0126984126984127*G12_2_0 + 0.0126984126984127*G12_2_1 - 0.00634920634920632*G12_3_0 - 0.00634920634920656*G12_3_1 - 0.0634920634920635*G12_4_0 - 0.0634920634920639*G12_4_1 - 0.0317460317460317*G12_5_0 - 0.0317460317460319*G12_5_1 - 0.01904761 [...]
     A[101] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_1_0 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_1_0 - 0.0190476190476191*G12_0_0 - 0.0190476190476191*G12_0_1 + 0.0126984126984127*G12_1_0 + 0.0126984126984127*G12_1_1 + 0.00793650793650792*G12_2_0 + 0.00793650793650798*G12_2_1 - 0.00634920634920629*G12_3_0 - 0.00634920634920655*G12_3_1 - 0.0317460317460317*G12_4_0 - 0.0317460317460319*G12_4_1 - 0.0634920634920634*G12_5_0 - 0.0634920634920639*G12_5_1 - 0.01904761 [...]
-    A[102] = -0.166666666666667*G7_0 - 0.166666666666668*G7_1;
+    A[102] = -0.166666666666667*G7_0 - 0.166666666666667*G7_1;
     A[103] = 0.0;
     A[104] = 0.0;
-    A[105] = 0.00357142857142856*G10_0_0 + 0.00357142857142858*G10_0_1 - 0.00357142857142857*G10_1_0 + 0.00436507936507936*G10_2_1 + 0.00158730158730159*G10_3_0 - 0.00634920634920631*G10_3_1 - 0.00158730158730159*G10_4_0 - 0.00793650793650796*G10_4_1 + 0.00634920634920635*G10_5_1;
-    A[106] = 0.00714285714285717*G10_0_0 + 0.00714285714285705*G10_0_1 + 0.0309523809523809*G10_1_0 - 0.00714285714285712*G10_2_1 + 0.00952380952380949*G10_3_0 + 0.0476190476190473*G10_3_1 - 0.00952380952380949*G10_4_0 - 0.0380952380952381*G10_5_0 - 0.0476190476190476*G10_5_1;
-    A[107] = -0.00436507936507936*G10_0_0 - 0.00436507936507934*G10_0_1 - 0.00357142857142857*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 - 0.00634920634920629*G10_3_1 + 0.00634920634920633*G10_4_0 + 0.00793650793650789*G10_4_1 + 0.00793650793650793*G10_5_0 + 0.00634920634920634*G10_5_1;
-    A[108] = 0.00634920634920636*G10_0_0 + 0.00634920634920634*G10_0_1 + 0.019047619047619*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 + 0.019047619047619*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.00634920634920638*G10_4_1 - 0.0253968253968254*G10_5_0 - 0.019047619047619*G10_5_1;
+    A[105] = 0.00357142857142857*G10_0_0 + 0.00357142857142858*G10_0_1 - 0.00357142857142856*G10_1_0 + 0.00436507936507936*G10_2_1 + 0.00158730158730159*G10_3_0 - 0.00634920634920631*G10_3_1 - 0.00158730158730159*G10_4_0 - 0.00793650793650796*G10_4_1 + 0.00634920634920635*G10_5_1;
+    A[106] = 0.00714285714285716*G10_0_0 + 0.00714285714285705*G10_0_1 + 0.0309523809523809*G10_1_0 - 0.00714285714285712*G10_2_1 + 0.00952380952380949*G10_3_0 + 0.0476190476190473*G10_3_1 - 0.00952380952380949*G10_4_0 - 0.0380952380952381*G10_5_0 - 0.0476190476190476*G10_5_1;
+    A[107] = -0.00436507936507936*G10_0_0 - 0.00436507936507934*G10_0_1 - 0.00357142857142857*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 - 0.00634920634920629*G10_3_1 + 0.00634920634920633*G10_4_0 + 0.0079365079365079*G10_4_1 + 0.00793650793650793*G10_5_0 + 0.00634920634920634*G10_5_1;
+    A[108] = 0.00634920634920635*G10_0_0 + 0.00634920634920634*G10_0_1 + 0.019047619047619*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 + 0.019047619047619*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.00634920634920637*G10_4_1 - 0.0253968253968254*G10_5_0 - 0.019047619047619*G10_5_1;
     A[109] = 0.00793650793650793*G10_0_0 + 0.00793650793650798*G10_0_1 + 0.00476190476190477*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.00634920634920621*G10_3_1 + 0.019047619047619*G10_4_0 - 0.0126984126984127*G10_5_0 + 0.00634920634920634*G10_5_1;
-    A[110] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 + 0.0190476190476191*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.019047619047619*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00634920634920631*G10_4_1 - 0.0317460317460318*G10_5_0 - 0.0190476190476191*G10_5_1;
-    A[111] = 0.166666666666668*G1_0_0_0 + 0.166666666666666*G1_0_0_1 + 0.166666666666668*G3_0_0_0 + 0.166666666666666*G3_0_0_1 - 0.00714285714285718*G12_0_0 - 0.00357142857142857*G12_1_0 + 0.00436507936507937*G12_2_0 - 0.00793650793650793*G12_3_0 - 0.00634920634920637*G12_4_0 - 0.0126984126984127*G12_5_0 - 0.00714285714285718*G14_6_0 - 0.00357142857142857*G14_7_0 + 0.00436507936507937*G14_8_0 - 0.00793650793650793*G14_9_0 - 0.00634920634920637*G14_10_0 - 0.0126984126984127*G14_11_0 + 0.0 [...]
-    A[112] = 0.5*G1_0_0_0 + 0.5*G3_0_0_0 - 0.00357142857142857*G12_0_0 + 0.0309523809523809*G12_1_0 - 0.00357142857142857*G12_2_0 + 0.019047619047619*G12_3_0 + 0.00476190476190477*G12_4_0 + 0.0190476190476191*G12_5_0 - 0.00357142857142857*G14_6_0 + 0.0309523809523809*G14_7_0 - 0.00357142857142857*G14_8_0 + 0.019047619047619*G14_9_0 + 0.00476190476190477*G14_10_0 + 0.0190476190476191*G14_11_0 + 0.00714285714285717*G15_6_0 + 0.00714285714285705*G15_6_1 + 0.0309523809523809*G15_7_0 - 0.0071 [...]
-    A[113] = -0.166666666666667*G1_0_0_1 - 0.166666666666667*G3_0_0_1 + 0.00436507936507937*G12_0_0 - 0.00357142857142857*G12_1_0 - 0.00714285714285716*G12_2_0 - 0.0126984126984127*G12_3_0 - 0.00634920634920635*G12_4_0 - 0.00793650793650792*G12_5_0 + 0.00436507936507937*G14_6_0 - 0.00357142857142857*G14_7_0 - 0.00714285714285716*G14_8_0 - 0.0126984126984127*G14_9_0 - 0.00634920634920635*G14_10_0 - 0.00793650793650792*G14_11_0 - 0.00436507936507936*G15_6_0 - 0.00436507936507934*G15_6_1 -  [...]
-    A[114] = 0.666666666666664*G1_0_0_1 + 0.666666666666664*G3_0_0_1 - 0.00793650793650793*G12_0_0 + 0.019047619047619*G12_1_0 - 0.0126984126984127*G12_2_0 + 0.0634920634920634*G12_3_0 + 0.00634920634920632*G12_4_0 + 0.0317460317460317*G12_5_0 - 0.00793650793650793*G14_6_0 + 0.019047619047619*G14_7_0 - 0.0126984126984127*G14_8_0 + 0.0634920634920634*G14_9_0 + 0.00634920634920632*G14_10_0 + 0.0317460317460317*G14_11_0 + 0.00634920634920636*G15_6_0 + 0.00634920634920634*G15_6_1 + 0.0190476 [...]
-    A[115] = -0.00634920634920637*G12_0_0 + 0.00476190476190477*G12_1_0 - 0.00634920634920635*G12_2_0 + 0.00634920634920632*G12_3_0 - 0.0380952380952382*G12_4_0 + 0.0063492063492063*G12_5_0 - 0.00634920634920637*G14_6_0 + 0.00476190476190477*G14_7_0 - 0.00634920634920635*G14_8_0 + 0.00634920634920632*G14_9_0 - 0.0380952380952382*G14_10_0 + 0.0063492063492063*G14_11_0 + 0.00793650793650793*G15_6_0 + 0.00793650793650798*G15_6_1 + 0.00476190476190477*G15_7_0 - 0.00793650793650795*G15_8_1 -  [...]
-    A[116] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_0_1 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_0_1 - 0.0126984126984127*G12_0_0 + 0.0190476190476191*G12_1_0 - 0.00793650793650792*G12_2_0 + 0.0317460317460317*G12_3_0 + 0.0063492063492063*G12_4_0 + 0.0634920634920634*G12_5_0 - 0.0126984126984127*G14_6_0 + 0.0190476190476191*G14_7_0 - 0.00793650793650792*G14_8_0 + 0.0317460317460317*G14_9_0 + 0.0063492063492063*G14_10_0 + 0.0634920634920634*G14_11_0 + 0.01269841 [...]
+    A[110] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 + 0.0190476190476191*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.019047619047619*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00634920634920632*G10_4_1 - 0.0317460317460318*G10_5_0 - 0.0190476190476191*G10_5_1;
+    A[111] = 0.166666666666668*G1_0_0_0 + 0.166666666666666*G1_0_0_1 + 0.166666666666668*G3_0_0_0 + 0.166666666666666*G3_0_0_1 - 0.00714285714285719*G12_0_0 - 0.00357142857142856*G12_1_0 + 0.00436507936507937*G12_2_0 - 0.00793650793650793*G12_3_0 - 0.00634920634920638*G12_4_0 - 0.0126984126984127*G12_5_0 - 0.00714285714285719*G14_6_0 - 0.00357142857142856*G14_7_0 + 0.00436507936507937*G14_8_0 - 0.00793650793650793*G14_9_0 - 0.00634920634920638*G14_10_0 - 0.0126984126984127*G14_11_0 + 0.0 [...]
+    A[112] = 0.5*G1_0_0_0 + 0.5*G3_0_0_0 - 0.00357142857142856*G12_0_0 + 0.0309523809523809*G12_1_0 - 0.00357142857142857*G12_2_0 + 0.019047619047619*G12_3_0 + 0.00476190476190477*G12_4_0 + 0.0190476190476191*G12_5_0 - 0.00357142857142856*G14_6_0 + 0.0309523809523809*G14_7_0 - 0.00357142857142857*G14_8_0 + 0.019047619047619*G14_9_0 + 0.00476190476190477*G14_10_0 + 0.0190476190476191*G14_11_0 + 0.00714285714285716*G15_6_0 + 0.00714285714285705*G15_6_1 + 0.0309523809523809*G15_7_0 - 0.0071 [...]
+    A[113] = -0.166666666666667*G1_0_0_1 - 0.166666666666667*G3_0_0_1 + 0.00436507936507937*G12_0_0 - 0.00357142857142857*G12_1_0 - 0.00714285714285715*G12_2_0 - 0.0126984126984127*G12_3_0 - 0.00634920634920635*G12_4_0 - 0.00793650793650792*G12_5_0 + 0.00436507936507937*G14_6_0 - 0.00357142857142857*G14_7_0 - 0.00714285714285715*G14_8_0 - 0.0126984126984127*G14_9_0 - 0.00634920634920635*G14_10_0 - 0.00793650793650792*G14_11_0 - 0.00436507936507936*G15_6_0 - 0.00436507936507934*G15_6_1 -  [...]
+    A[114] = 0.666666666666664*G1_0_0_1 + 0.666666666666664*G3_0_0_1 - 0.00793650793650794*G12_0_0 + 0.019047619047619*G12_1_0 - 0.0126984126984127*G12_2_0 + 0.0634920634920634*G12_3_0 + 0.00634920634920632*G12_4_0 + 0.0317460317460317*G12_5_0 - 0.00793650793650794*G14_6_0 + 0.019047619047619*G14_7_0 - 0.0126984126984127*G14_8_0 + 0.0634920634920634*G14_9_0 + 0.00634920634920632*G14_10_0 + 0.0317460317460317*G14_11_0 + 0.00634920634920635*G15_6_0 + 0.00634920634920634*G15_6_1 + 0.0190476 [...]
+    A[115] = -0.00634920634920638*G12_0_0 + 0.00476190476190477*G12_1_0 - 0.00634920634920635*G12_2_0 + 0.00634920634920632*G12_3_0 - 0.0380952380952382*G12_4_0 + 0.0063492063492063*G12_5_0 - 0.00634920634920638*G14_6_0 + 0.00476190476190477*G14_7_0 - 0.00634920634920635*G14_8_0 + 0.00634920634920632*G14_9_0 - 0.0380952380952382*G14_10_0 + 0.0063492063492063*G14_11_0 + 0.00793650793650793*G15_6_0 + 0.00793650793650798*G15_6_1 + 0.00476190476190477*G15_7_0 - 0.00793650793650795*G15_8_1 -  [...]
+    A[116] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_0_1 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_0_1 - 0.0126984126984127*G12_0_0 + 0.0190476190476191*G12_1_0 - 0.00793650793650792*G12_2_0 + 0.0317460317460317*G12_3_0 + 0.0063492063492063*G12_4_0 + 0.0634920634920634*G12_5_0 - 0.0126984126984127*G14_6_0 + 0.0190476190476191*G14_7_0 - 0.00793650793650792*G14_8_0 + 0.0317460317460317*G14_9_0 + 0.0063492063492063*G14_10_0 + 0.0634920634920634*G14_11_0 + 0.01269841 [...]
     A[117] = 0.0;
     A[118] = 0.166666666666667*G7_0;
     A[119] = 0.0;
-    A[120] = 0.00357142857142858*G10_0_0 + 0.00357142857142859*G10_0_1 + 0.00436507936507937*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 + 0.00158730158730163*G10_3_1 + 0.00634920634920633*G10_4_0 - 0.00793650793650795*G10_5_0 - 0.00158730158730159*G10_5_1;
-    A[121] = -0.00436507936507936*G10_0_0 - 0.00436507936507934*G10_0_1 - 0.00357142857142857*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 - 0.00634920634920629*G10_3_1 + 0.00634920634920633*G10_4_0 + 0.00793650793650789*G10_4_1 + 0.00793650793650793*G10_5_0 + 0.00634920634920634*G10_5_1;
-    A[122] = 0.00714285714285712*G10_0_0 + 0.00714285714285704*G10_0_1 - 0.00714285714285716*G10_1_0 + 0.030952380952381*G10_2_1 + 0.0476190476190475*G10_3_0 + 0.00952380952380924*G10_3_1 - 0.0476190476190475*G10_4_0 - 0.0380952380952379*G10_4_1 - 0.00952380952380949*G10_5_1;
-    A[123] = 0.00634920634920633*G10_0_0 + 0.00634920634920634*G10_0_1 - 0.0126984126984127*G10_1_0 + 0.019047619047619*G10_2_1 + 0.019047619047619*G10_3_0 - 0.0126984126984127*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0253968253968254*G10_4_1 + 0.00634920634920637*G10_5_0 + 0.0126984126984127*G10_5_1;
-    A[124] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 - 0.00634920634920635*G10_1_0 + 0.0190476190476191*G10_2_1 + 0.019047619047619*G10_3_0 - 0.00634920634920638*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0317460317460317*G10_4_1 - 0.00634920634920633*G10_5_0 + 0.00634920634920636*G10_5_1;
+    A[120] = 0.00357142857142858*G10_0_0 + 0.00357142857142859*G10_0_1 + 0.00436507936507937*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 + 0.00158730158730162*G10_3_1 + 0.00634920634920633*G10_4_0 - 0.00793650793650795*G10_5_0 - 0.00158730158730159*G10_5_1;
+    A[121] = -0.00436507936507936*G10_0_0 - 0.00436507936507934*G10_0_1 - 0.00357142857142857*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 - 0.00634920634920629*G10_3_1 + 0.00634920634920633*G10_4_0 + 0.0079365079365079*G10_4_1 + 0.00793650793650793*G10_5_0 + 0.00634920634920634*G10_5_1;
+    A[122] = 0.00714285714285713*G10_0_0 + 0.00714285714285705*G10_0_1 - 0.00714285714285715*G10_1_0 + 0.030952380952381*G10_2_1 + 0.0476190476190475*G10_3_0 + 0.00952380952380926*G10_3_1 - 0.0476190476190475*G10_4_0 - 0.0380952380952379*G10_4_1 - 0.00952380952380948*G10_5_1;
+    A[123] = 0.00634920634920633*G10_0_0 + 0.00634920634920634*G10_0_1 - 0.0126984126984127*G10_1_0 + 0.019047619047619*G10_2_1 + 0.019047619047619*G10_3_0 - 0.0126984126984127*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0253968253968254*G10_4_1 + 0.00634920634920635*G10_5_0 + 0.0126984126984127*G10_5_1;
+    A[124] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 - 0.00634920634920634*G10_1_0 + 0.0190476190476191*G10_2_1 + 0.019047619047619*G10_3_0 - 0.00634920634920637*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0317460317460317*G10_4_1 - 0.00634920634920635*G10_5_0 + 0.00634920634920636*G10_5_1;
     A[125] = 0.00793650793650792*G10_0_0 + 0.00793650793650798*G10_0_1 - 0.00793650793650792*G10_1_0 + 0.00476190476190475*G10_2_1 - 0.00634920634920632*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.00634920634920632*G10_4_0 - 0.0126984126984128*G10_4_1 + 0.019047619047619*G10_5_1;
-    A[126] = 0.166666666666666*G1_0_1_0 + 0.166666666666666*G1_0_1_1 + 0.166666666666666*G3_0_1_0 + 0.166666666666666*G3_0_1_1 - 0.00714285714285714*G12_0_1 + 0.00436507936507936*G12_1_1 - 0.00357142857142857*G12_2_1 - 0.00793650793650795*G12_3_1 - 0.0126984126984127*G12_4_1 - 0.00634920634920636*G12_5_1 - 0.00714285714285714*G14_6_1 + 0.00436507936507936*G14_7_1 - 0.00357142857142857*G14_8_1 - 0.00793650793650795*G14_9_1 - 0.0126984126984127*G14_10_1 - 0.00634920634920636*G14_11_1 + 0.0 [...]
-    A[127] = -0.166666666666667*G1_0_1_0 - 0.166666666666667*G3_0_1_0 + 0.00436507936507936*G12_0_1 - 0.00714285714285712*G12_1_1 - 0.00357142857142857*G12_2_1 - 0.0126984126984127*G12_3_1 - 0.00793650793650795*G12_4_1 - 0.00634920634920636*G12_5_1 + 0.00436507936507936*G14_6_1 - 0.00714285714285712*G14_7_1 - 0.00357142857142857*G14_8_1 - 0.0126984126984127*G14_9_1 - 0.00793650793650795*G14_10_1 - 0.00634920634920636*G14_11_1 - 0.00436507936507936*G15_6_0 - 0.00436507936507934*G15_6_1 -  [...]
-    A[128] = 0.5*G1_0_1_1 + 0.5*G3_0_1_1 - 0.00357142857142857*G12_0_1 - 0.00357142857142857*G12_1_1 + 0.030952380952381*G12_2_1 + 0.019047619047619*G12_3_1 + 0.0190476190476191*G12_4_1 + 0.00476190476190475*G12_5_1 - 0.00357142857142857*G14_6_1 - 0.00357142857142857*G14_7_1 + 0.030952380952381*G14_8_1 + 0.019047619047619*G14_9_1 + 0.0190476190476191*G14_10_1 + 0.00476190476190475*G14_11_1 + 0.00714285714285712*G15_6_0 + 0.00714285714285704*G15_6_1 - 0.00714285714285716*G15_7_0 + 0.03095 [...]
-    A[129] = 0.666666666666667*G1_0_1_0 + 0.666666666666667*G3_0_1_0 - 0.00793650793650795*G12_0_1 - 0.0126984126984127*G12_1_1 + 0.019047619047619*G12_2_1 + 0.0634920634920636*G12_3_1 + 0.0317460317460318*G12_4_1 + 0.00634920634920641*G12_5_1 - 0.00793650793650795*G14_6_1 - 0.0126984126984127*G14_7_1 + 0.019047619047619*G14_8_1 + 0.0634920634920636*G14_9_1 + 0.0317460317460318*G14_10_1 + 0.00634920634920641*G14_11_1 + 0.00634920634920632*G15_6_0 + 0.00634920634920634*G15_6_1 - 0.0126984 [...]
-    A[130] = -0.666666666666667*G1_0_1_0 - 0.666666666666665*G1_0_1_1 - 0.666666666666667*G3_0_1_0 - 0.666666666666665*G3_0_1_1 - 0.0126984126984127*G12_0_1 - 0.00793650793650795*G12_1_1 + 0.0190476190476191*G12_2_1 + 0.0317460317460318*G12_3_1 + 0.0634920634920636*G12_4_1 + 0.00634920634920641*G12_5_1 - 0.0126984126984127*G14_6_1 - 0.00793650793650795*G14_7_1 + 0.0190476190476191*G14_8_1 + 0.0317460317460318*G14_9_1 + 0.0634920634920636*G14_10_1 + 0.00634920634920641*G14_11_1 + 0.012698 [...]
+    A[126] = 0.166666666666666*G1_0_1_0 + 0.166666666666666*G1_0_1_1 + 0.166666666666666*G3_0_1_0 + 0.166666666666666*G3_0_1_1 - 0.00714285714285714*G12_0_1 + 0.00436507936507936*G12_1_1 - 0.00357142857142857*G12_2_1 - 0.00793650793650795*G12_3_1 - 0.0126984126984127*G12_4_1 - 0.00634920634920636*G12_5_1 - 0.00714285714285714*G14_6_1 + 0.00436507936507936*G14_7_1 - 0.00357142857142857*G14_8_1 - 0.00793650793650795*G14_9_1 - 0.0126984126984127*G14_10_1 - 0.00634920634920636*G14_11_1 + 0.0 [...]
+    A[127] = -0.166666666666667*G1_0_1_0 - 0.166666666666667*G3_0_1_0 + 0.00436507936507936*G12_0_1 - 0.00714285714285712*G12_1_1 - 0.00357142857142857*G12_2_1 - 0.0126984126984127*G12_3_1 - 0.00793650793650795*G12_4_1 - 0.00634920634920636*G12_5_1 + 0.00436507936507936*G14_6_1 - 0.00714285714285712*G14_7_1 - 0.00357142857142857*G14_8_1 - 0.0126984126984127*G14_9_1 - 0.00793650793650795*G14_10_1 - 0.00634920634920636*G14_11_1 - 0.00436507936507936*G15_6_0 - 0.00436507936507934*G15_6_1 -  [...]
+    A[128] = 0.5*G1_0_1_1 + 0.5*G3_0_1_1 - 0.00357142857142857*G12_0_1 - 0.00357142857142857*G12_1_1 + 0.030952380952381*G12_2_1 + 0.019047619047619*G12_3_1 + 0.0190476190476191*G12_4_1 + 0.00476190476190475*G12_5_1 - 0.00357142857142857*G14_6_1 - 0.00357142857142857*G14_7_1 + 0.030952380952381*G14_8_1 + 0.019047619047619*G14_9_1 + 0.0190476190476191*G14_10_1 + 0.00476190476190475*G14_11_1 + 0.00714285714285713*G15_6_0 + 0.00714285714285705*G15_6_1 - 0.00714285714285715*G15_7_0 + 0.03095 [...]
+    A[129] = 0.666666666666667*G1_0_1_0 + 0.666666666666667*G3_0_1_0 - 0.00793650793650795*G12_0_1 - 0.0126984126984127*G12_1_1 + 0.019047619047619*G12_2_1 + 0.0634920634920636*G12_3_1 + 0.0317460317460318*G12_4_1 + 0.00634920634920641*G12_5_1 - 0.00793650793650795*G14_6_1 - 0.0126984126984127*G14_7_1 + 0.019047619047619*G14_8_1 + 0.0634920634920636*G14_9_1 + 0.0317460317460318*G14_10_1 + 0.00634920634920641*G14_11_1 + 0.00634920634920633*G15_6_0 + 0.00634920634920634*G15_6_1 - 0.0126984 [...]
+    A[130] = -0.666666666666667*G1_0_1_0 - 0.666666666666665*G1_0_1_1 - 0.666666666666667*G3_0_1_0 - 0.666666666666665*G3_0_1_1 - 0.0126984126984127*G12_0_1 - 0.00793650793650795*G12_1_1 + 0.0190476190476191*G12_2_1 + 0.0317460317460318*G12_3_1 + 0.0634920634920636*G12_4_1 + 0.00634920634920641*G12_5_1 - 0.0126984126984127*G14_6_1 - 0.00793650793650795*G14_7_1 + 0.0190476190476191*G14_8_1 + 0.0317460317460318*G14_9_1 + 0.0634920634920636*G14_10_1 + 0.00634920634920641*G14_11_1 + 0.012698 [...]
     A[131] = -0.00634920634920636*G12_0_1 - 0.00634920634920636*G12_1_1 + 0.00476190476190475*G12_2_1 + 0.00634920634920641*G12_3_1 + 0.00634920634920641*G12_4_1 - 0.038095238095238*G12_5_1 - 0.00634920634920636*G14_6_1 - 0.00634920634920636*G14_7_1 + 0.00476190476190475*G14_8_1 + 0.00634920634920641*G14_9_1 + 0.00634920634920641*G14_10_1 - 0.038095238095238*G14_11_1 + 0.00793650793650792*G15_6_0 + 0.00793650793650798*G15_6_1 - 0.00793650793650792*G15_7_0 + 0.00476190476190475*G15_8_1 -  [...]
     A[132] = 0.0;
     A[133] = 0.0;
     A[134] = 0.166666666666667*G7_1;
-    A[135] = -0.00476190476190477*G10_0_0 - 0.00476190476190471*G10_0_1 - 0.00793650793650793*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.019047619047619*G10_4_0 + 0.0126984126984126*G10_4_1 + 0.0126984126984127*G10_5_0 + 0.019047619047619*G10_5_1;
-    A[136] = 0.00634920634920636*G10_0_0 + 0.00634920634920634*G10_0_1 + 0.019047619047619*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 + 0.019047619047619*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.00634920634920638*G10_4_1 - 0.0253968253968254*G10_5_0 - 0.019047619047619*G10_5_1;
-    A[137] = 0.00634920634920632*G10_0_0 + 0.00634920634920634*G10_0_1 - 0.0126984126984127*G10_1_0 + 0.019047619047619*G10_2_1 + 0.019047619047619*G10_3_0 - 0.0126984126984127*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0253968253968254*G10_4_1 + 0.00634920634920637*G10_5_0 + 0.0126984126984127*G10_5_1;
+    A[135] = -0.00476190476190477*G10_0_0 - 0.00476190476190471*G10_0_1 - 0.00793650793650794*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.019047619047619*G10_4_0 + 0.0126984126984126*G10_4_1 + 0.0126984126984127*G10_5_0 + 0.019047619047619*G10_5_1;
+    A[136] = 0.00634920634920635*G10_0_0 + 0.00634920634920634*G10_0_1 + 0.019047619047619*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 + 0.019047619047619*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.00634920634920637*G10_4_1 - 0.0253968253968254*G10_5_0 - 0.019047619047619*G10_5_1;
+    A[137] = 0.00634920634920633*G10_0_0 + 0.00634920634920634*G10_0_1 - 0.0126984126984127*G10_1_0 + 0.019047619047619*G10_2_1 + 0.019047619047619*G10_3_0 - 0.0126984126984127*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0253968253968254*G10_4_1 + 0.00634920634920635*G10_5_0 + 0.0126984126984127*G10_5_1;
     A[138] = 0.0380952380952381*G10_0_0 + 0.0380952380952376*G10_0_1 + 0.0634920634920634*G10_1_0 + 0.0634920634920636*G10_2_1 + 0.152380952380952*G10_3_0 + 0.152380952380951*G10_3_1 - 0.152380952380952*G10_4_0 - 0.101587301587301*G10_4_1 - 0.101587301587302*G10_5_0 - 0.152380952380952*G10_5_1;
     A[139] = -0.00634920634920632*G10_0_0 - 0.00634920634920656*G10_0_1 + 0.00634920634920632*G10_1_0 + 0.0317460317460318*G10_2_1 + 0.076190476190476*G10_3_0 + 0.0507936507936502*G10_3_1 - 0.076190476190476*G10_4_0 - 0.025396825396825*G10_4_1 - 0.0507936507936508*G10_5_1;
     A[140] = -0.00634920634920629*G10_0_0 - 0.00634920634920655*G10_0_1 + 0.0317460317460317*G10_1_0 + 0.00634920634920641*G10_2_1 + 0.0507936507936507*G10_3_0 + 0.0761904761904756*G10_3_1 - 0.0507936507936507*G10_4_0 - 0.0253968253968254*G10_5_0 - 0.0761904761904762*G10_5_1;
-    A[141] = 0.0095238095238095*G12_0_0 + 0.00952380952380933*G12_0_1 + 0.00158730158730159*G12_1_0 - 0.00634920634920631*G12_1_1 - 0.00634920634920634*G12_2_0 + 0.00158730158730163*G12_2_1 - 0.019047619047619*G12_3_0 - 0.0190476190476189*G12_3_1 - 0.0126984126984127*G12_4_0 - 0.00634920634920632*G12_4_1 - 0.00634920634920634*G12_5_0 - 0.0126984126984127*G12_5_1 + 0.0095238095238095*G14_6_0 + 0.00952380952380933*G14_6_1 + 0.00158730158730159*G14_7_0 - 0.00634920634920631*G14_7_1 - 0.0063 [...]
-    A[142] = 0.666666666666664*G1_0_1_0 + 0.666666666666664*G3_0_1_0 + 0.00158730158730159*G12_0_0 - 0.00634920634920631*G12_0_1 + 0.00952380952380949*G12_1_0 + 0.0476190476190473*G12_1_1 - 0.00634920634920633*G12_2_0 - 0.00634920634920629*G12_2_1 - 0.0126984126984127*G12_3_0 + 0.019047619047619*G12_3_1 - 0.019047619047619*G12_4_0 - 0.00634920634920621*G12_4_1 - 0.00634920634920634*G12_5_0 + 0.019047619047619*G12_5_1 + 0.00158730158730159*G14_6_0 - 0.00634920634920631*G14_6_1 + 0.0095238 [...]
-    A[143] = 0.666666666666667*G1_0_0_1 + 0.666666666666667*G3_0_0_1 - 0.00634920634920634*G12_0_0 + 0.00158730158730163*G12_0_1 - 0.00634920634920633*G12_1_0 - 0.00634920634920629*G12_1_1 + 0.0476190476190475*G12_2_0 + 0.00952380952380924*G12_2_1 + 0.019047619047619*G12_3_0 - 0.0126984126984127*G12_3_1 + 0.019047619047619*G12_4_0 - 0.00634920634920638*G12_4_1 - 0.00634920634920633*G12_5_0 - 0.0190476190476189*G12_5_1 - 0.00634920634920634*G14_6_0 + 0.00158730158730163*G14_6_1 - 0.006349 [...]
+    A[141] = 0.0095238095238095*G12_0_0 + 0.00952380952380934*G12_0_1 + 0.00158730158730159*G12_1_0 - 0.00634920634920631*G12_1_1 - 0.00634920634920634*G12_2_0 + 0.00158730158730162*G12_2_1 - 0.019047619047619*G12_3_0 - 0.0190476190476189*G12_3_1 - 0.0126984126984127*G12_4_0 - 0.00634920634920631*G12_4_1 - 0.00634920634920634*G12_5_0 - 0.0126984126984127*G12_5_1 + 0.0095238095238095*G14_6_0 + 0.00952380952380934*G14_6_1 + 0.00158730158730159*G14_7_0 - 0.00634920634920631*G14_7_1 - 0.0063 [...]
+    A[142] = 0.666666666666664*G1_0_1_0 + 0.666666666666664*G3_0_1_0 + 0.00158730158730159*G12_0_0 - 0.00634920634920631*G12_0_1 + 0.00952380952380949*G12_1_0 + 0.0476190476190473*G12_1_1 - 0.00634920634920633*G12_2_0 - 0.00634920634920629*G12_2_1 - 0.0126984126984127*G12_3_0 + 0.019047619047619*G12_3_1 - 0.019047619047619*G12_4_0 - 0.00634920634920621*G12_4_1 - 0.00634920634920634*G12_5_0 + 0.019047619047619*G12_5_1 + 0.00158730158730159*G14_6_0 - 0.00634920634920631*G14_6_1 + 0.0095238 [...]
+    A[143] = 0.666666666666667*G1_0_0_1 + 0.666666666666667*G3_0_0_1 - 0.00634920634920634*G12_0_0 + 0.00158730158730162*G12_0_1 - 0.00634920634920633*G12_1_0 - 0.00634920634920629*G12_1_1 + 0.0476190476190475*G12_2_0 + 0.00952380952380926*G12_2_1 + 0.019047619047619*G12_3_0 - 0.0126984126984127*G12_3_1 + 0.019047619047619*G12_4_0 - 0.00634920634920638*G12_4_1 - 0.00634920634920633*G12_5_0 - 0.0190476190476189*G12_5_1 - 0.00634920634920634*G14_6_0 + 0.00158730158730162*G14_6_1 - 0.006349 [...]
     A[144] = 1.33333333333333*G1_0_0_0 + 0.666666666666656*G1_0_0_1 + 0.666666666666656*G1_0_1_0 + 1.33333333333332*G1_0_1_1 + 1.33333333333333*G3_0_0_0 + 0.666666666666656*G3_0_0_1 + 0.666666666666656*G3_0_1_0 + 1.33333333333332*G3_0_1_1 - 0.019047619047619*G12_0_0 - 0.0190476190476189*G12_0_1 - 0.0126984126984127*G12_1_0 + 0.019047619047619*G12_1_1 + 0.019047619047619*G12_2_0 - 0.0126984126984127*G12_2_1 + 0.152380952380952*G12_3_0 + 0.152380952380951*G12_3_1 + 0.076190476190476*G12_4_ [...]
-    A[145] = -1.33333333333333*G1_0_0_0 - 0.666666666666659*G1_0_0_1 - 0.666666666666656*G1_0_1_0 - 1.33333333333333*G3_0_0_0 - 0.666666666666659*G3_0_0_1 - 0.666666666666656*G3_0_1_0 - 0.0126984126984127*G12_0_0 - 0.00634920634920632*G12_0_1 - 0.019047619047619*G12_1_0 - 0.00634920634920621*G12_1_1 + 0.019047619047619*G12_2_0 - 0.00634920634920638*G12_2_1 + 0.076190476190476*G12_3_0 + 0.0507936507936502*G12_3_1 + 0.152380952380952*G12_4_0 + 0.0507936507936496*G12_4_1 + 0.050793650793650 [...]
+    A[145] = -1.33333333333333*G1_0_0_0 - 0.666666666666659*G1_0_0_1 - 0.666666666666656*G1_0_1_0 - 1.33333333333333*G3_0_0_0 - 0.666666666666659*G3_0_0_1 - 0.666666666666656*G3_0_1_0 - 0.0126984126984127*G12_0_0 - 0.00634920634920631*G12_0_1 - 0.019047619047619*G12_1_0 - 0.00634920634920621*G12_1_1 + 0.019047619047619*G12_2_0 - 0.00634920634920637*G12_2_1 + 0.076190476190476*G12_3_0 + 0.0507936507936502*G12_3_1 + 0.152380952380952*G12_4_0 + 0.0507936507936496*G12_4_1 + 0.050793650793650 [...]
     A[146] = -0.666666666666665*G1_0_0_1 - 0.666666666666666*G1_0_1_0 - 1.33333333333332*G1_0_1_1 - 0.666666666666665*G3_0_0_1 - 0.666666666666666*G3_0_1_0 - 1.33333333333332*G3_0_1_1 - 0.00634920634920634*G12_0_0 - 0.0126984126984127*G12_0_1 - 0.00634920634920634*G12_1_0 + 0.019047619047619*G12_1_1 - 0.00634920634920632*G12_2_0 - 0.0190476190476189*G12_2_1 + 0.0507936507936507*G12_3_0 + 0.0761904761904756*G12_3_1 + 0.0507936507936507*G12_4_0 + 0.0507936507936502*G12_4_1 + 0.050793650793 [...]
     A[147] = 0.166666666666666*G7_0 + 0.166666666666665*G7_1;
     A[148] = 0.166666666666666*G7_0 + 0.333333333333331*G7_1;
     A[149] = 0.333333333333333*G7_0 + 0.166666666666664*G7_1;
-    A[150] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.00634920634920637*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 - 0.00634920634920632*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.0317460317460317*G10_4_1 + 0.0253968253968254*G10_5_0 + 0.00634920634920635*G10_5_1;
+    A[150] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.00634920634920638*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 - 0.00634920634920631*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.0317460317460317*G10_4_1 + 0.0253968253968254*G10_5_0 + 0.00634920634920635*G10_5_1;
     A[151] = 0.00793650793650793*G10_0_0 + 0.00793650793650798*G10_0_1 + 0.00476190476190477*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.00634920634920621*G10_3_1 + 0.019047619047619*G10_4_0 - 0.0126984126984127*G10_5_0 + 0.00634920634920634*G10_5_1;
-    A[152] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 - 0.00634920634920635*G10_1_0 + 0.0190476190476191*G10_2_1 + 0.019047619047619*G10_3_0 - 0.00634920634920638*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0317460317460317*G10_4_1 - 0.00634920634920633*G10_5_0 + 0.00634920634920636*G10_5_1;
+    A[152] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 - 0.00634920634920635*G10_1_0 + 0.0190476190476191*G10_2_1 + 0.019047619047619*G10_3_0 - 0.00634920634920638*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0317460317460317*G10_4_1 - 0.00634920634920635*G10_5_0 + 0.00634920634920636*G10_5_1;
     A[153] = -0.00634920634920632*G10_0_0 - 0.00634920634920656*G10_0_1 + 0.00634920634920632*G10_1_0 + 0.0317460317460318*G10_2_1 + 0.076190476190476*G10_3_0 + 0.0507936507936502*G10_3_1 - 0.076190476190476*G10_4_0 - 0.025396825396825*G10_4_1 - 0.0507936507936508*G10_5_1;
     A[154] = -0.0634920634920635*G10_0_0 - 0.0634920634920639*G10_0_1 - 0.0380952380952382*G10_1_0 + 0.0634920634920636*G10_2_1 + 0.152380952380952*G10_3_0 + 0.0507936507936496*G10_3_1 - 0.152380952380952*G10_4_0 + 0.101587301587302*G10_5_0 - 0.0507936507936507*G10_5_1;
     A[155] = -0.0317460317460317*G10_0_0 - 0.0317460317460319*G10_0_1 + 0.0063492063492063*G10_1_0 + 0.00634920634920641*G10_2_1 + 0.0507936507936507*G10_3_0 + 0.0507936507936502*G10_3_1 - 0.0507936507936507*G10_4_0 + 0.0253968253968258*G10_4_1 + 0.0253968253968254*G10_5_0 - 0.0507936507936508*G10_5_1;
-    A[156] = -0.666666666666668*G1_0_1_0 - 0.666666666666668*G1_0_1_1 - 0.666666666666668*G3_0_1_0 - 0.666666666666668*G3_0_1_1 - 0.0095238095238095*G12_0_0 + 0.0380952380952383*G12_0_1 - 0.00158730158730159*G12_1_0 - 0.00793650793650796*G12_1_1 + 0.00634920634920634*G12_2_0 + 0.019047619047619*G12_3_0 + 0.0126984126984126*G12_3_1 + 0.0126984126984127*G12_4_0 + 0.0317460317460317*G12_4_1 + 0.00634920634920634*G12_5_0 + 0.0253968253968254*G12_5_1 - 0.0095238095238095*G14_6_0 + 0.038095238 [...]
-    A[157] = -0.00158730158730159*G12_0_0 - 0.00793650793650796*G12_0_1 - 0.00952380952380949*G12_1_0 + 0.00634920634920633*G12_2_0 + 0.00793650793650789*G12_2_1 + 0.0126984126984127*G12_3_0 + 0.00634920634920638*G12_3_1 + 0.019047619047619*G12_4_0 + 0.00634920634920634*G12_5_0 - 0.00634920634920631*G12_5_1 - 0.00158730158730159*G14_6_0 - 0.00793650793650796*G14_6_1 - 0.00952380952380949*G14_7_0 + 0.00634920634920633*G14_8_0 + 0.00793650793650789*G14_8_1 + 0.0126984126984127*G14_9_0 + 0. [...]
-    A[158] = -0.666666666666667*G1_0_0_1 - 0.666666666666665*G1_0_1_1 - 0.666666666666667*G3_0_0_1 - 0.666666666666665*G3_0_1_1 + 0.00634920634920634*G12_0_0 + 0.00634920634920633*G12_1_0 + 0.00793650793650789*G12_1_1 - 0.0476190476190475*G12_2_0 - 0.0380952380952379*G12_2_1 - 0.019047619047619*G12_3_0 - 0.0253968253968254*G12_3_1 - 0.019047619047619*G12_4_0 - 0.0317460317460317*G12_4_1 + 0.00634920634920633*G12_5_0 - 0.0126984126984128*G12_5_1 + 0.00634920634920634*G14_6_0 + 0.006349206 [...]
-    A[159] = -1.33333333333333*G1_0_0_0 - 0.666666666666656*G1_0_0_1 - 0.666666666666659*G1_0_1_0 - 1.33333333333333*G3_0_0_0 - 0.666666666666656*G3_0_0_1 - 0.666666666666659*G3_0_1_0 + 0.019047619047619*G12_0_0 + 0.0126984126984126*G12_0_1 + 0.0126984126984127*G12_1_0 + 0.00634920634920638*G12_1_1 - 0.019047619047619*G12_2_0 - 0.0253968253968254*G12_2_1 - 0.152380952380952*G12_3_0 - 0.101587301587301*G12_3_1 - 0.076190476190476*G12_4_0 - 0.025396825396825*G12_4_1 - 0.0507936507936507*G1 [...]
+    A[156] = -0.666666666666668*G1_0_1_0 - 0.666666666666668*G1_0_1_1 - 0.666666666666668*G3_0_1_0 - 0.666666666666668*G3_0_1_1 - 0.0095238095238095*G12_0_0 + 0.0380952380952382*G12_0_1 - 0.00158730158730159*G12_1_0 - 0.00793650793650796*G12_1_1 + 0.00634920634920634*G12_2_0 + 0.019047619047619*G12_3_0 + 0.0126984126984126*G12_3_1 + 0.0126984126984127*G12_4_0 + 0.0317460317460317*G12_4_1 + 0.00634920634920634*G12_5_0 + 0.0253968253968254*G12_5_1 - 0.0095238095238095*G14_6_0 + 0.038095238 [...]
+    A[157] = -0.00158730158730159*G12_0_0 - 0.00793650793650796*G12_0_1 - 0.00952380952380949*G12_1_0 + 0.00634920634920633*G12_2_0 + 0.0079365079365079*G12_2_1 + 0.0126984126984127*G12_3_0 + 0.00634920634920637*G12_3_1 + 0.019047619047619*G12_4_0 + 0.00634920634920634*G12_5_0 - 0.00634920634920632*G12_5_1 - 0.00158730158730159*G14_6_0 - 0.00793650793650796*G14_6_1 - 0.00952380952380949*G14_7_0 + 0.00634920634920633*G14_8_0 + 0.0079365079365079*G14_8_1 + 0.0126984126984127*G14_9_0 + 0.00 [...]
+    A[158] = -0.666666666666667*G1_0_0_1 - 0.666666666666665*G1_0_1_1 - 0.666666666666667*G3_0_0_1 - 0.666666666666665*G3_0_1_1 + 0.00634920634920634*G12_0_0 + 0.00634920634920633*G12_1_0 + 0.0079365079365079*G12_1_1 - 0.0476190476190475*G12_2_0 - 0.0380952380952379*G12_2_1 - 0.019047619047619*G12_3_0 - 0.0253968253968254*G12_3_1 - 0.019047619047619*G12_4_0 - 0.0317460317460317*G12_4_1 + 0.00634920634920633*G12_5_0 - 0.0126984126984128*G12_5_1 + 0.00634920634920634*G14_6_0 + 0.0063492063 [...]
+    A[159] = -1.33333333333333*G1_0_0_0 - 0.666666666666656*G1_0_0_1 - 0.666666666666659*G1_0_1_0 - 1.33333333333333*G3_0_0_0 - 0.666666666666656*G3_0_0_1 - 0.666666666666659*G3_0_1_0 + 0.019047619047619*G12_0_0 + 0.0126984126984126*G12_0_1 + 0.0126984126984127*G12_1_0 + 0.00634920634920637*G12_1_1 - 0.019047619047619*G12_2_0 - 0.0253968253968254*G12_2_1 - 0.152380952380952*G12_3_0 - 0.101587301587301*G12_3_1 - 0.076190476190476*G12_4_0 - 0.025396825396825*G12_4_1 - 0.0507936507936507*G1 [...]
     A[160] = 1.33333333333333*G1_0_0_0 + 0.666666666666659*G1_0_0_1 + 0.666666666666659*G1_0_1_0 + 1.33333333333333*G1_0_1_1 + 1.33333333333333*G3_0_0_0 + 0.666666666666659*G3_0_0_1 + 0.666666666666659*G3_0_1_0 + 1.33333333333333*G3_0_1_1 + 0.0126984126984127*G12_0_0 + 0.0317460317460317*G12_0_1 + 0.019047619047619*G12_1_0 - 0.019047619047619*G12_2_0 - 0.0317460317460317*G12_2_1 - 0.076190476190476*G12_3_0 - 0.025396825396825*G12_3_1 - 0.152380952380952*G12_4_0 - 0.0507936507936507*G12_5 [...]
-    A[161] = 0.666666666666665*G1_0_0_1 + 0.666666666666666*G1_0_1_0 + 0.666666666666665*G3_0_0_1 + 0.666666666666666*G3_0_1_0 + 0.00634920634920634*G12_0_0 + 0.0253968253968254*G12_0_1 + 0.00634920634920634*G12_1_0 - 0.00634920634920631*G12_1_1 + 0.00634920634920632*G12_2_0 - 0.0126984126984128*G12_2_1 - 0.0507936507936507*G12_3_0 - 0.0507936507936507*G12_4_0 + 0.0253968253968258*G12_4_1 - 0.0507936507936507*G12_5_0 + 0.101587301587302*G12_5_1 + 0.00634920634920634*G14_6_0 + 0.025396825 [...]
+    A[161] = 0.666666666666665*G1_0_0_1 + 0.666666666666666*G1_0_1_0 + 0.666666666666665*G3_0_0_1 + 0.666666666666666*G3_0_1_0 + 0.00634920634920634*G12_0_0 + 0.0253968253968254*G12_0_1 + 0.00634920634920634*G12_1_0 - 0.00634920634920632*G12_1_1 + 0.00634920634920632*G12_2_0 - 0.0126984126984128*G12_2_1 - 0.0507936507936507*G12_3_0 - 0.0507936507936507*G12_4_0 + 0.0253968253968258*G12_4_1 - 0.0507936507936507*G12_5_0 + 0.101587301587302*G12_5_1 + 0.00634920634920634*G14_6_0 + 0.025396825 [...]
     A[162] = -0.166666666666666*G7_0 + 0.166666666666668*G7_1;
     A[163] = -0.166666666666666*G7_0;
     A[164] = -0.333333333333333*G7_0 - 0.166666666666665*G7_1;
     A[165] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.0126984126984127*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 - 0.0126984126984127*G10_3_1 + 0.00634920634920634*G10_4_0 + 0.0253968253968254*G10_4_1 + 0.0317460317460318*G10_5_0 + 0.0126984126984127*G10_5_1;
-    A[166] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 + 0.0190476190476191*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.019047619047619*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00634920634920631*G10_4_1 - 0.0317460317460318*G10_5_0 - 0.0190476190476191*G10_5_1;
+    A[166] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 + 0.0190476190476191*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.019047619047619*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00634920634920632*G10_4_1 - 0.0317460317460318*G10_5_0 - 0.0190476190476191*G10_5_1;
     A[167] = 0.00793650793650792*G10_0_0 + 0.00793650793650798*G10_0_1 - 0.00793650793650792*G10_1_0 + 0.00476190476190475*G10_2_1 - 0.00634920634920632*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.00634920634920632*G10_4_0 - 0.0126984126984128*G10_4_1 + 0.019047619047619*G10_5_1;
     A[168] = -0.00634920634920629*G10_0_0 - 0.00634920634920655*G10_0_1 + 0.0317460317460317*G10_1_0 + 0.00634920634920641*G10_2_1 + 0.0507936507936507*G10_3_0 + 0.0761904761904756*G10_3_1 - 0.0507936507936507*G10_4_0 - 0.0253968253968254*G10_5_0 - 0.0761904761904762*G10_5_1;
     A[169] = -0.0317460317460317*G10_0_0 - 0.0317460317460319*G10_0_1 + 0.0063492063492063*G10_1_0 + 0.00634920634920641*G10_2_1 + 0.0507936507936507*G10_3_0 + 0.0507936507936502*G10_3_1 - 0.0507936507936507*G10_4_0 + 0.0253968253968258*G10_4_1 + 0.0253968253968254*G10_5_0 - 0.0507936507936508*G10_5_1;
     A[170] = -0.0634920634920634*G10_0_0 - 0.0634920634920639*G10_0_1 + 0.0634920634920634*G10_1_0 - 0.038095238095238*G10_2_1 + 0.0507936507936507*G10_3_0 + 0.152380952380951*G10_3_1 - 0.0507936507936507*G10_4_0 + 0.101587301587302*G10_4_1 - 0.152380952380952*G10_5_1;
-    A[171] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_0_1 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_0_1 + 0.0380952380952381*G12_0_0 - 0.00952380952380951*G12_0_1 + 0.00634920634920635*G12_1_1 - 0.00793650793650795*G12_2_0 - 0.00158730158730159*G12_2_1 + 0.0126984126984127*G12_3_0 + 0.019047619047619*G12_3_1 + 0.0253968253968254*G12_4_0 + 0.00634920634920635*G12_4_1 + 0.0317460317460318*G12_5_0 + 0.0126984126984127*G12_5_1 + 0.0380952380952381*G14_6_0 - 0.00952380 [...]
-    A[172] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_1_0 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_1_0 + 0.00634920634920635*G12_0_1 - 0.0380952380952381*G12_1_0 - 0.0476190476190476*G12_1_1 + 0.00793650793650793*G12_2_0 + 0.00634920634920634*G12_2_1 - 0.0253968253968254*G12_3_0 - 0.019047619047619*G12_3_1 - 0.0126984126984127*G12_4_0 + 0.00634920634920634*G12_4_1 - 0.0317460317460318*G12_5_0 - 0.0190476190476191*G12_5_1 + 0.00634920634920635*G14_6_1 - 0.03809523 [...]
-    A[173] = -0.00793650793650795*G12_0_0 - 0.00158730158730159*G12_0_1 + 0.00793650793650793*G12_1_0 + 0.00634920634920634*G12_1_1 - 0.00952380952380949*G12_2_1 + 0.00634920634920637*G12_3_0 + 0.0126984126984127*G12_3_1 - 0.00634920634920633*G12_4_0 + 0.00634920634920636*G12_4_1 + 0.019047619047619*G12_5_1 - 0.00793650793650795*G14_6_0 - 0.00158730158730159*G14_6_1 + 0.00793650793650793*G14_7_0 + 0.00634920634920634*G14_7_1 - 0.00952380952380949*G14_8_1 + 0.00634920634920637*G14_9_0 + 0 [...]
-    A[174] = -0.666666666666666*G1_0_0_1 - 0.666666666666665*G1_0_1_0 - 1.33333333333332*G1_0_1_1 - 0.666666666666666*G3_0_0_1 - 0.666666666666665*G3_0_1_0 - 1.33333333333332*G3_0_1_1 + 0.0126984126984127*G12_0_0 + 0.019047619047619*G12_0_1 - 0.0253968253968254*G12_1_0 - 0.019047619047619*G12_1_1 + 0.00634920634920637*G12_2_0 + 0.0126984126984127*G12_2_1 - 0.101587301587302*G12_3_0 - 0.152380952380952*G12_3_1 - 0.0507936507936508*G12_4_1 - 0.0253968253968254*G12_5_0 - 0.0761904761904762* [...]
-    A[175] = 0.666666666666666*G1_0_0_1 + 0.666666666666665*G1_0_1_0 + 0.666666666666666*G3_0_0_1 + 0.666666666666665*G3_0_1_0 + 0.0253968253968254*G12_0_0 + 0.00634920634920635*G12_0_1 - 0.0126984126984127*G12_1_0 + 0.00634920634920634*G12_1_1 - 0.00634920634920633*G12_2_0 + 0.00634920634920636*G12_2_1 - 0.0507936507936508*G12_3_1 + 0.101587301587302*G12_4_0 - 0.0507936507936507*G12_4_1 + 0.0253968253968254*G12_5_0 - 0.0507936507936508*G12_5_1 + 0.0253968253968254*G14_6_0 + 0.0063492063 [...]
+    A[171] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_0_1 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_0_1 + 0.0380952380952382*G12_0_0 - 0.00952380952380951*G12_0_1 + 0.00634920634920635*G12_1_1 - 0.00793650793650795*G12_2_0 - 0.00158730158730159*G12_2_1 + 0.0126984126984127*G12_3_0 + 0.019047619047619*G12_3_1 + 0.0253968253968254*G12_4_0 + 0.00634920634920635*G12_4_1 + 0.0317460317460318*G12_5_0 + 0.0126984126984127*G12_5_1 + 0.0380952380952382*G14_6_0 - 0.00952380 [...]
+    A[172] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_1_0 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_1_0 + 0.00634920634920635*G12_0_1 - 0.0380952380952381*G12_1_0 - 0.0476190476190476*G12_1_1 + 0.00793650793650793*G12_2_0 + 0.00634920634920634*G12_2_1 - 0.0253968253968254*G12_3_0 - 0.019047619047619*G12_3_1 - 0.0126984126984127*G12_4_0 + 0.00634920634920634*G12_4_1 - 0.0317460317460318*G12_5_0 - 0.0190476190476191*G12_5_1 + 0.00634920634920635*G14_6_1 - 0.03809523 [...]
+    A[173] = -0.00793650793650795*G12_0_0 - 0.00158730158730159*G12_0_1 + 0.00793650793650793*G12_1_0 + 0.00634920634920634*G12_1_1 - 0.00952380952380948*G12_2_1 + 0.00634920634920635*G12_3_0 + 0.0126984126984127*G12_3_1 - 0.00634920634920635*G12_4_0 + 0.00634920634920636*G12_4_1 + 0.019047619047619*G12_5_1 - 0.00793650793650795*G14_6_0 - 0.00158730158730159*G14_6_1 + 0.00793650793650793*G14_7_0 + 0.00634920634920634*G14_7_1 - 0.00952380952380948*G14_8_1 + 0.00634920634920635*G14_9_0 + 0 [...]
+    A[174] = -0.666666666666666*G1_0_0_1 - 0.666666666666665*G1_0_1_0 - 1.33333333333332*G1_0_1_1 - 0.666666666666666*G3_0_0_1 - 0.666666666666665*G3_0_1_0 - 1.33333333333332*G3_0_1_1 + 0.0126984126984127*G12_0_0 + 0.019047619047619*G12_0_1 - 0.0253968253968254*G12_1_0 - 0.019047619047619*G12_1_1 + 0.00634920634920635*G12_2_0 + 0.0126984126984127*G12_2_1 - 0.101587301587302*G12_3_0 - 0.152380952380952*G12_3_1 - 0.0507936507936508*G12_4_1 - 0.0253968253968254*G12_5_0 - 0.0761904761904762* [...]
+    A[175] = 0.666666666666666*G1_0_0_1 + 0.666666666666665*G1_0_1_0 + 0.666666666666666*G3_0_0_1 + 0.666666666666665*G3_0_1_0 + 0.0253968253968254*G12_0_0 + 0.00634920634920635*G12_0_1 - 0.0126984126984127*G12_1_0 + 0.00634920634920634*G12_1_1 - 0.00634920634920635*G12_2_0 + 0.00634920634920636*G12_2_1 - 0.0507936507936508*G12_3_1 + 0.101587301587302*G12_4_0 - 0.0507936507936507*G12_4_1 + 0.0253968253968254*G12_5_0 - 0.0507936507936508*G12_5_1 + 0.0253968253968254*G14_6_0 + 0.0063492063 [...]
     A[176] = 1.33333333333334*G1_0_0_0 + 0.666666666666668*G1_0_0_1 + 0.666666666666668*G1_0_1_0 + 1.33333333333333*G1_0_1_1 + 1.33333333333334*G3_0_0_0 + 0.666666666666668*G3_0_0_1 + 0.666666666666668*G3_0_1_0 + 1.33333333333333*G3_0_1_1 + 0.0317460317460318*G12_0_0 + 0.0126984126984127*G12_0_1 - 0.0317460317460318*G12_1_0 - 0.0190476190476191*G12_1_1 + 0.019047619047619*G12_2_1 - 0.0253968253968254*G12_3_0 - 0.0761904761904762*G12_3_1 + 0.0253968253968254*G12_4_0 - 0.0507936507936508*G [...]
     A[177] = 0.166666666666667*G7_0 - 0.166666666666667*G7_1;
     A[178] = -0.166666666666667*G7_0 - 0.333333333333333*G7_1;
     A[179] = -0.166666666666667*G7_1;
-    A[180] = 0.166666666666667*G4_0 + 0.166666666666668*G4_1;
+    A[180] = 0.166666666666667*G4_0 + 0.166666666666667*G4_1;
     A[181] = 0.0;
     A[182] = 0.0;
     A[183] = -0.166666666666666*G4_0 - 0.166666666666665*G4_1;
     A[184] = 0.166666666666666*G4_0 - 0.166666666666668*G4_1;
     A[185] = -0.166666666666667*G4_0 + 0.166666666666667*G4_1;
-    A[186] = 0.166666666666667*G5_0 + 0.166666666666668*G5_1;
+    A[186] = 0.166666666666667*G5_0 + 0.166666666666667*G5_1;
     A[187] = 0.0;
     A[188] = 0.0;
     A[189] = -0.166666666666666*G5_0 - 0.166666666666665*G5_1;
@@ -36590,39 +37858,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivenavierstokes_exterior_facet_integral_1_0: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_exterior_facet_integral_1_0() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_exterior_facet_integral_1_0()
+  ~adaptivenavierstokes_exterior_facet_integral_1_0() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    0
@@ -36631,7 +37892,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -36644,8 +37905,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -36718,42 +37979,35 @@ public:
 
 };
 
-/// 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 adaptivenavierstokes_cell_integral_2_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_cell_integral_2_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_cell_integral_2_otherwise()
+  ~adaptivenavierstokes_cell_integral_2_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -36774,24 +38028,7 @@ public:
     // Quadrature points on the UFC reference element: (0.873821971016996, 0.063089014491502), (0.063089014491502, 0.873821971016996), (0.063089014491502, 0.063089014491502), (0.501426509658179, 0.24928674517091), (0.24928674517091, 0.501426509658179), (0.24928674517091, 0.24928674517091), (0.636502499121399, 0.310352451033785), (0.636502499121399, 0.053145049844816), (0.310352451033785, 0.636502499121399), (0.310352451033785, 0.053145049844816), (0.053145049844816, 0.636502499121399), ( [...]
     
     // Values of basis functions at quadrature points.
-    static const double FE0_C0[12][3] = \
-    {{0.0630890144915021, 0.873821971016996, 0.063089014491502},
-    {0.0630890144915021, 0.0630890144915021, 0.873821971016996},
-    {0.873821971016996, 0.0630890144915021, 0.063089014491502},
-    {0.249286745170911, 0.501426509658179, 0.24928674517091},
-    {0.249286745170911, 0.24928674517091, 0.501426509658179},
-    {0.50142650965818, 0.24928674517091, 0.24928674517091},
-    {0.053145049844816, 0.636502499121399, 0.310352451033785},
-    {0.310352451033785, 0.636502499121399, 0.053145049844816},
-    {0.0531450498448161, 0.310352451033785, 0.636502499121399},
-    {0.636502499121399, 0.310352451033785, 0.053145049844816},
-    {0.310352451033785, 0.0531450498448161, 0.636502499121399},
-    {0.636502499121399, 0.053145049844816, 0.310352451033785}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc12[3] = {12, 13, 14};
-    
-    static const double FE1_C0[12][6] = \
+    static const double FE0_C0[12][6] = \
     {{-0.0551285669924841, 0.653307703047059, -0.0551285669924841, 0.220514267969936, 0.0159208949980358, 0.220514267969936},
     {-0.055128566992484, -0.055128566992484, 0.65330770304706, 0.220514267969936, 0.220514267969936, 0.0159208949980358},
     {0.65330770304706, -0.0551285669924841, -0.0551285669924841, 0.0159208949980358, 0.220514267969936, 0.220514267969936},
@@ -36806,55 +38043,72 @@ public:
     {0.173768363654174, -0.0474962571988001, -0.117715163308429, 0.0659747859186054, 0.790160442765823, 0.135307828168627}};
     
     // Array of non-zero columns
-    static const unsigned int nzc6[6] = {0, 1, 2, 3, 4, 5};
+    static const unsigned int nzc0[6] = {0, 1, 2, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc9[6] = {6, 7, 8, 9, 10, 11};
+    static const unsigned int nzc3[6] = {6, 7, 8, 9, 10, 11};
     
     // Array of non-zero columns
-    static const unsigned int nzc21[6] = {20, 21, 22, 23, 24, 25};
-    
-    static const double FE1_C0_D01[12][5] = \
-    {{0.747643942033987, -0.747643942033992, 3.49528788406797, 1.24344978758018e-14, -3.49528788406799},
-    {0.747643942033987, 2.49528788406799, 0.252356057965989, -3.24293182610197, -0.252356057966006},
-    {-2.49528788406799, -0.747643942033992, 0.252356057965998, 3.24293182610198, -0.252356057966007},
-    {0.00285301931635132, -0.00285301931635895, 2.0057060386327, 1.40998324127395e-14, -2.00570603863272},
-    {0.00285301931635096, 1.00570603863272, 0.997146980683626, -1.00855905794906, -0.99714698068364},
+    static const unsigned int nzc15[6] = {20, 21, 22, 23, 24, 25};
+    
+    static const double FE0_C0_D01[12][5] = \
+    {{0.747643942033987, -0.747643942033992, 3.49528788406797, 1.15463194561016e-14, -3.49528788406798},
+    {0.747643942033987, 2.49528788406799, 0.252356057965991, -3.24293182610197, -0.252356057966005},
+    {-2.49528788406799, -0.747643942033992, 0.252356057965999, 3.24293182610198, -0.252356057966007},
+    {0.00285301931635137, -0.00285301931635895, 2.0057060386327, 1.40998324127395e-14, -2.00570603863272},
+    {0.00285301931635112, 1.00570603863272, 0.997146980683626, -1.00855905794906, -0.99714698068364},
     {-1.00570603863272, -0.00285301931635895, 0.997146980683629, 1.00855905794909, -0.99714698068364},
-    {0.787419800620731, 0.241409804135141, 2.54600999648558, -1.02882960475586, -2.5460099964856},
+    {0.787419800620731, 0.241409804135141, 2.54600999648558, -1.02882960475587, -2.5460099964856},
     {-0.241409804135144, -0.787419800620735, 2.54600999648558, 1.02882960475589, -2.5460099964856},
     {0.787419800620731, 1.5460099964856, 1.24140980413512, -2.33342979710632, -1.24140980413514},
     {-1.5460099964856, -0.787419800620735, 1.24140980413513, 2.33342979710634, -1.24140980413514},
-    {-0.241409804135145, 1.5460099964856, 0.212580199379249, -1.30460019235045, -0.212580199379262},
+    {-0.241409804135145, 1.5460099964856, 0.21258019937925, -1.30460019235045, -0.212580199379262},
     {-1.5460099964856, 0.241409804135141, 0.212580199379252, 1.30460019235046, -0.212580199379263}};
     
     // Array of non-zero columns
-    static const unsigned int nzc7[5] = {0, 2, 3, 4, 5};
+    static const unsigned int nzc1[5] = {0, 2, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc10[5] = {6, 8, 9, 10, 11};
+    static const unsigned int nzc4[5] = {6, 8, 9, 10, 11};
     
-    static const double FE1_C0_D10[12][5] = \
+    static const double FE0_C0_D10[12][5] = \
     {{0.747643942033995, 2.49528788406798, 0.252356057966007, -0.252356057966007, -3.24293182610198},
-    {0.747643942033991, -0.747643942033994, 3.49528788406798, -3.49528788406798, 0.0},
+    {0.747643942033992, -0.747643942033993, 3.49528788406798, -3.49528788406798, 0.0},
     {-2.49528788406798, -0.747643942033995, 0.252356057966007, -0.252356057966007, 3.24293182610198},
-    {0.00285301931635752, 1.00570603863272, 0.997146980683638, -0.997146980683638, -1.00855905794907},
-    {0.00285301931635629, -0.00285301931636062, 2.00570603863271, -2.00570603863271, 0.0},
-    {-1.00570603863272, -0.00285301931636132, 0.997146980683638, -0.997146980683638, 1.00855905794908},
-    {0.787419800620738, 1.5460099964856, 1.24140980413514, -1.24140980413514, -2.33342979710634},
+    {0.00285301931635741, 1.00570603863272, 0.997146980683638, -0.997146980683638, -1.00855905794907},
+    {0.00285301931635651, -0.00285301931636039, 2.00570603863271, -2.00570603863271, 0.0},
+    {-1.00570603863272, -0.00285301931636144, 0.997146980683638, -0.997146980683638, 1.00855905794908},
+    {0.787419800620738, 1.5460099964856, 1.24140980413514, -1.24140980413514, -2.33342979710633},
     {-0.241409804135138, 1.5460099964856, 0.212580199379263, -0.212580199379263, -1.30460019235046},
     {0.787419800620737, 0.24140980413514, 2.54600999648559, -2.54600999648559, -1.02882960475588},
     {-1.5460099964856, 0.241409804135138, 0.212580199379263, -0.212580199379263, 1.30460019235046},
     {-0.241409804135141, -0.787419800620737, 2.54600999648559, -2.54600999648559, 1.02882960475588},
-    {-1.5460099964856, -0.787419800620738, 1.24140980413514, -1.24140980413514, 2.33342979710633}};
+    {-1.5460099964856, -0.787419800620738, 1.24140980413514, -1.24140980413514, 2.33342979710634}};
     
     // Array of non-zero columns
-    static const unsigned int nzc8[5] = {0, 1, 3, 4, 5};
+    static const unsigned int nzc2[5] = {0, 1, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc11[5] = {6, 7, 9, 10, 11};
+    static const unsigned int nzc5[5] = {6, 7, 9, 10, 11};
     
-    static const double FE2_C0[12][10] = \
+    static const double FE0_C2[12][3] = \
+    {{0.0630890144915021, 0.873821971016996, 0.063089014491502},
+    {0.0630890144915021, 0.0630890144915021, 0.873821971016996},
+    {0.873821971016996, 0.0630890144915021, 0.063089014491502},
+    {0.249286745170911, 0.501426509658179, 0.24928674517091},
+    {0.249286745170911, 0.24928674517091, 0.501426509658179},
+    {0.50142650965818, 0.24928674517091, 0.24928674517091},
+    {0.053145049844816, 0.636502499121399, 0.310352451033785},
+    {0.310352451033785, 0.636502499121399, 0.053145049844816},
+    {0.0531450498448161, 0.310352451033785, 0.636502499121399},
+    {0.636502499121399, 0.310352451033785, 0.053145049844816},
+    {0.310352451033785, 0.0531450498448161, 0.636502499121399},
+    {0.636502499121399, 0.053145049844816, 0.310352451033785}};
+    
+    // Array of non-zero columns
+    static const unsigned int nzc6[3] = {12, 13, 14};
+    
+    static const double FE1_C0[12][10] = \
     {{0.0463079953908666, 0.440268993398561, 0.0463079953908666, 0.402250914961474, -0.201125457480737, -0.0145210435563256, -0.0145210435563258, -0.201125457480737, 0.402250914961474, 0.0939061879708835},
     {0.0463079953908666, 0.0463079953908666, 0.440268993398561, -0.201125457480737, 0.402250914961474, -0.201125457480737, 0.402250914961474, -0.0145210435563258, -0.0145210435563256, 0.0939061879708832},
     {0.440268993398561, 0.0463079953908666, 0.0463079953908666, -0.0145210435563258, -0.0145210435563257, 0.402250914961474, -0.201125457480737, 0.402250914961474, -0.201125457480737, 0.0939061879708837},
@@ -36869,50 +38123,50 @@ public:
     {-0.0261932265993555, 0.0411107284664351, 0.0114358260653798, -0.0623880968176906, -0.00511703591602503, 0.808488952668145, -0.0612852214487412, 0.138446419692862, -0.127951879895303, 0.283453533784293}};
     
     // Array of non-zero columns
-    static const unsigned int nzc15[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+    static const unsigned int nzc9[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
     
     // Array of non-zero columns
-    static const unsigned int nzc18[10] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-    
-    static const double FE2_C0_D01[12][9] = \
-    {{-0.485931890194859, 0.485931890194857, 6.3759264303559, -2.44372756077943, -0.0537330206183488, 0.0537330206183695, 2.44372756077939, -6.37592643035587, 0.0},
-    {-0.485931890194857, 3.44372756077941, -0.230167544593401, 1.20457074358532, 2.21356001618603, -5.17135568677058, 0.176434523975015, 0.230167544593395, -1.38100526756034},
-    {-3.44372756077942, 0.485931890194858, -0.230167544593377, -0.176434523975039, 5.17135568677059, -2.21356001618602, -1.20457074358531, 0.23016754459339, 1.38100526756033},
-    {0.404638308746456, -0.404638308746454, 1.13786605847598, 1.11855323498581, -0.838942397791731, 0.838942397791744, -1.11855323498585, -1.13786605847597, 0.0},
-    {0.404638308746456, -0.118553234985829, -0.282847955477364, 2.25318217517852, -1.40140119046319, 1.11531611670258, -0.556094442314385, 0.28284795547737, -1.69708773286416},
-    {0.118553234985819, -0.404638308746454, -0.28284795547736, 0.556094442314362, -1.11531611670255, 1.40140119046319, -2.25318217517854, 0.282847955477367, 1.69708773286416},
-    {-0.559823901757264, -0.492870367157912, 2.60506707768883, 2.469321742623, 0.750232850760387, 0.302461418154806, 1.95093340590805, -2.60506707768881, -4.42025514853109},
-    {0.492870367157909, 0.559823901757269, 2.60506707768883, -1.95093340590808, -0.302461418154779, -0.750232850760382, -2.46932174262302, -2.60506707768881, 4.42025514853107},
-    {-0.559823901757265, 0.740805831642527, -0.0962843375058833, 3.93699695901726, 1.749910031967, -1.93089196185225, 0.95125622470144, 0.0962843375058927, -4.88825318371873},
-    {-0.740805831642532, 0.559823901757269, -0.0962843375058711, -0.951256224701467, 1.93089196185227, -1.749910031967, -3.93699695901728, 0.0962843375058848, 4.88825318371872},
-    {0.49287036715791, 0.740805831642526, -0.201023373941073, 0.674175115836557, -2.56560608012889, 1.33192988132846, -0.206177080648918, 0.201023373941072, -0.467998035187654},
-    {-0.740805831642533, -0.492870367157912, -0.201023373941066, 0.206177080648907, -1.33192988132844, 2.5656060801289, -0.67417511583656, 0.20102337394107, 0.467998035187636}};
+    static const unsigned int nzc12[10] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+    
+    static const double FE1_C0_D01[12][9] = \
+    {{-0.485931890194858, 0.485931890194857, 6.3759264303559, -2.44372756077943, -0.0537330206183471, 0.0537330206183695, 2.44372756077939, -6.37592643035587, -1.06581410364015e-14},
+    {-0.485931890194857, 3.44372756077941, -0.230167544593396, 1.20457074358531, 2.21356001618603, -5.17135568677058, 0.176434523975015, 0.230167544593396, -1.38100526756034},
+    {-3.44372756077942, 0.485931890194858, -0.230167544593379, -0.176434523975039, 5.17135568677059, -2.21356001618602, -1.20457074358531, 0.23016754459339, 1.38100526756033},
+    {0.404638308746456, -0.404638308746454, 1.13786605847598, 1.11855323498581, -0.838942397791732, 0.838942397791744, -1.11855323498585, -1.13786605847597, 0.0},
+    {0.404638308746455, -0.118553234985829, -0.282847955477364, 2.25318217517852, -1.40140119046319, 1.11531611670258, -0.556094442314385, 0.28284795547737, -1.69708773286416},
+    {0.118553234985819, -0.404638308746454, -0.282847955477359, 0.556094442314362, -1.11531611670255, 1.40140119046319, -2.25318217517854, 0.282847955477367, 1.69708773286416},
+    {-0.559823901757264, -0.492870367157912, 2.60506707768883, 2.469321742623, 0.750232850760386, 0.302461418154807, 1.95093340590805, -2.60506707768881, -4.42025514853108},
+    {0.492870367157909, 0.559823901757269, 2.60506707768883, -1.95093340590808, -0.302461418154779, -0.750232850760384, -2.46932174262302, -2.60506707768881, 4.42025514853107},
+    {-0.559823901757266, 0.740805831642527, -0.0962843375058831, 3.93699695901726, 1.749910031967, -1.93089196185225, 0.951256224701441, 0.0962843375058929, -4.88825318371873},
+    {-0.740805831642532, 0.559823901757269, -0.096284337505872, -0.951256224701466, 1.93089196185227, -1.749910031967, -3.93699695901728, 0.0962843375058845, 4.88825318371872},
+    {0.49287036715791, 0.740805831642526, -0.201023373941072, 0.674175115836556, -2.56560608012889, 1.33192988132846, -0.206177080648917, 0.201023373941072, -0.467998035187653},
+    {-0.740805831642533, -0.492870367157911, -0.201023373941067, 0.206177080648907, -1.33192988132844, 2.5656060801289, -0.674175115836561, 0.20102337394107, 0.467998035187637}};
     
     // Array of non-zero columns
-    static const unsigned int nzc16[9] = {0, 2, 3, 4, 5, 6, 7, 8, 9};
+    static const unsigned int nzc10[9] = {0, 2, 3, 4, 5, 6, 7, 8, 9};
     
     // Array of non-zero columns
-    static const unsigned int nzc19[9] = {10, 12, 13, 14, 15, 16, 17, 18, 19};
+    static const unsigned int nzc13[9] = {10, 12, 13, 14, 15, 16, 17, 18, 19};
     
-    static const double FE2_C0_D10[12][9] = \
-    {{-0.48593189019485, 3.44372756077941, 1.20457074358532, -0.23016754459339, 0.176434523975019, 0.23016754459339, 2.21356001618601, -5.17135568677057, -1.38100526756033},
-    {-0.485931890194855, 0.485931890194855, -2.44372756077941, 6.3759264303559, 2.44372756077942, -6.3759264303559, -0.0537330206183711, 0.0537330206183718, -1.32779142447141e-14},
-    {-3.44372756077941, 0.485931890194857, -0.176434523975022, -0.230167544593389, -1.20457074358531, 0.230167544593389, 5.17135568677059, -2.21356001618604, 1.38100526756033},
+    static const double FE1_C0_D10[12][9] = \
+    {{-0.485931890194847, 3.44372756077941, 1.20457074358532, -0.23016754459339, 0.176434523975019, 0.23016754459339, 2.21356001618601, -5.17135568677057, -1.38100526756034},
+    {-0.485931890194857, 0.485931890194854, -2.44372756077941, 6.3759264303559, 2.44372756077942, -6.3759264303559, -0.0537330206183684, 0.0537330206183718, 0.0},
+    {-3.44372756077941, 0.485931890194856, -0.176434523975022, -0.230167544593389, -1.20457074358531, 0.230167544593389, 5.17135568677059, -2.21356001618604, 1.38100526756033},
     {0.404638308746459, -0.118553234985828, 2.25318217517853, -0.282847955477362, -0.556094442314377, 0.282847955477362, -1.4014011904632, 1.11531611670256, -1.69708773286416},
-    {0.404638308746457, -0.404638308746455, 1.11855323498582, 1.13786605847597, -1.11855323498583, -1.13786605847598, -0.838942397791736, 0.838942397791735, 1.36155758129985e-14},
-    {0.118553234985822, -0.404638308746454, 0.556094442314372, -0.282847955477362, -2.25318217517854, 0.282847955477361, -1.11531611670254, 1.40140119046318, 1.69708773286417},
-    {-0.559823901757261, 0.740805831642525, 3.93699695901727, -0.0962843375058808, 0.951256224701448, 0.0962843375058804, 1.74991003196699, -1.93089196185226, -4.88825318371872},
-    {0.492870367157915, 0.740805831642527, 0.67417511583656, -0.201023373941065, -0.206177080648911, 0.201023373941065, -2.56560608012889, 1.33192988132845, -0.467998035187649},
-    {-0.559823901757265, -0.492870367157914, 2.46932174262301, 2.60506707768882, 1.95093340590807, -2.60506707768882, 0.750232850760382, 0.302461418154798, -4.42025514853108},
-    {-0.740805831642529, -0.492870367157911, 0.206177080648911, -0.201023373941064, -0.674175115836558, 0.201023373941064, -1.33192988132844, 2.56560608012888, 0.467998035187647},
-    {0.492870367157912, 0.559823901757265, -1.95093340590807, 2.60506707768882, -2.46932174262301, -2.60506707768882, -0.302461418154793, -0.750232850760383, 4.42025514853108},
-    {-0.74080583164253, 0.559823901757265, -0.951256224701448, -0.0962843375058815, -3.93699695901727, 0.096284337505881, 1.93089196185227, -1.74991003196701, 4.88825318371872}};
+    {0.404638308746458, -0.404638308746455, 1.11855323498582, 1.13786605847597, -1.11855323498583, -1.13786605847598, -0.838942397791737, 0.838942397791735, 1.30826400560679e-14},
+    {0.118553234985822, -0.404638308746454, 0.556094442314372, -0.282847955477362, -2.25318217517854, 0.282847955477362, -1.11531611670254, 1.40140119046318, 1.69708773286417},
+    {-0.55982390175726, 0.740805831642526, 3.93699695901728, -0.0962843375058809, 0.951256224701448, 0.0962843375058804, 1.74991003196699, -1.93089196185226, -4.88825318371872},
+    {0.492870367157916, 0.740805831642527, 0.674175115836561, -0.201023373941065, -0.206177080648911, 0.201023373941065, -2.56560608012889, 1.33192988132845, -0.46799803518765},
+    {-0.559823901757264, -0.492870367157914, 2.46932174262301, 2.60506707768882, 1.95093340590807, -2.60506707768882, 0.750232850760382, 0.302461418154797, -4.42025514853108},
+    {-0.740805831642529, -0.492870367157911, 0.206177080648912, -0.201023373941064, -0.674175115836557, 0.201023373941064, -1.33192988132844, 2.56560608012888, 0.467998035187646},
+    {0.492870367157912, 0.559823901757265, -1.95093340590807, 2.60506707768882, -2.46932174262301, -2.60506707768882, -0.302461418154792, -0.750232850760384, 4.42025514853108},
+    {-0.740805831642531, 0.559823901757265, -0.951256224701448, -0.0962843375058816, -3.93699695901727, 0.0962843375058811, 1.93089196185227, -1.74991003196701, 4.88825318371872}};
     
     // Array of non-zero columns
-    static const unsigned int nzc17[9] = {0, 1, 3, 4, 5, 6, 7, 8, 9};
+    static const unsigned int nzc11[9] = {0, 1, 3, 4, 5, 6, 7, 8, 9};
     
     // Array of non-zero columns
-    static const unsigned int nzc20[9] = {10, 11, 13, 14, 15, 16, 17, 18, 19};
+    static const unsigned int nzc14[9] = {10, 11, 13, 14, 15, 16, 17, 18, 19};
     
     // Reset values in the element tensor.
     A[0] = 0.0;
@@ -36957,40 +38211,40 @@ public:
       // Total number of operations to compute function values = 6
       for (unsigned int r = 0; r < 3; r++)
       {
-        F0 += FE0_C0[ip][r]*w[0][nzc12[r]];
+        F0 += FE0_C2[ip][r]*w[0][nzc6[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 40
       for (unsigned int r = 0; r < 5; r++)
       {
-        F5 += FE1_C0_D10[ip][r]*w[0][nzc8[r]];
-        F6 += FE1_C0_D01[ip][r]*w[0][nzc7[r]];
-        F7 += FE1_C0_D10[ip][r]*w[0][nzc11[r]];
-        F8 += FE1_C0_D01[ip][r]*w[0][nzc10[r]];
+        F5 += FE0_C0_D10[ip][r]*w[0][nzc2[r]];
+        F6 += FE0_C0_D01[ip][r]*w[0][nzc1[r]];
+        F7 += FE0_C0_D10[ip][r]*w[0][nzc5[r]];
+        F8 += FE0_C0_D01[ip][r]*w[0][nzc4[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 36
       for (unsigned int r = 0; r < 6; r++)
       {
-        F9 += FE1_C0[ip][r]*w[3][nzc21[r]];
-        F11 += FE1_C0[ip][r]*w[0][nzc6[r]];
-        F12 += FE1_C0[ip][r]*w[0][nzc9[r]];
+        F9 += FE0_C0[ip][r]*w[3][nzc15[r]];
+        F11 += FE0_C0[ip][r]*w[0][nzc0[r]];
+        F12 += FE0_C0[ip][r]*w[0][nzc3[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 72
       for (unsigned int r = 0; r < 9; r++)
       {
-        F1 += FE2_C0_D10[ip][r]*w[3][nzc17[r]];
-        F2 += FE2_C0_D01[ip][r]*w[3][nzc16[r]];
-        F3 += FE2_C0_D10[ip][r]*w[3][nzc20[r]];
-        F4 += FE2_C0_D01[ip][r]*w[3][nzc19[r]];
+        F1 += FE1_C0_D10[ip][r]*w[3][nzc11[r]];
+        F2 += FE1_C0_D01[ip][r]*w[3][nzc10[r]];
+        F3 += FE1_C0_D10[ip][r]*w[3][nzc14[r]];
+        F4 += FE1_C0_D01[ip][r]*w[3][nzc13[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 40
       for (unsigned int r = 0; r < 10; r++)
       {
-        F10 += FE2_C0[ip][r]*w[3][nzc15[r]];
-        F13 += FE2_C0[ip][r]*w[3][nzc18[r]];
+        F10 += FE1_C0[ip][r]*w[3][nzc9[r]];
+        F13 += FE1_C0[ip][r]*w[3][nzc12[r]];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 57
@@ -37007,43 +38261,36 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivenavierstokes_exterior_facet_integral_2_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_exterior_facet_integral_2_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_exterior_facet_integral_2_otherwise()
+  ~adaptivenavierstokes_exterior_facet_integral_2_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -37058,12 +38305,12 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates[2*facet] - vertex_coordinates[2*v0]) - dx0*(vertex_coordinates[2*facet + 1] - vertex_coordinates[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs[2*facet] - coordinate_dofs[2*v0]) - dx0*(coordinate_dofs[2*facet + 1] - coordinate_dofs[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n0 = direction ? dx1 / det : -dx1 / det;
     const double n1 = direction ? -dx0 / det : dx0 / det;
@@ -37095,28 +38342,28 @@ public:
     // Array of non-zero columns
     static const unsigned int nzc2[2] = {0, 1};
     
-    static const double FE2_f0_C0[3][4] = \
+    static const double FE1_f0_C0[3][4] = \
     {{0.488014084041408, 0.061985915958592, 0.747852751738001, -0.297852751738001},
     {-0.0625, -0.0625, 0.5625, 0.5625},
     {0.0619859159585921, 0.488014084041408, -0.297852751738001, 0.747852751738001}};
     
     // Array of non-zero columns
-    static const unsigned int nzc13[4] = {1, 2, 3, 4};
+    static const unsigned int nzc3[4] = {1, 2, 3, 4};
     
     // Array of non-zero columns
-    static const unsigned int nzc14[4] = {11, 12, 13, 14};
+    static const unsigned int nzc4[4] = {11, 12, 13, 14};
     
     // Array of non-zero columns
-    static const unsigned int nzc16[4] = {0, 2, 5, 6};
+    static const unsigned int nzc6[4] = {0, 2, 5, 6};
     
     // Array of non-zero columns
-    static const unsigned int nzc17[4] = {10, 12, 15, 16};
+    static const unsigned int nzc7[4] = {10, 12, 15, 16};
     
     // Array of non-zero columns
-    static const unsigned int nzc19[4] = {0, 1, 7, 8};
+    static const unsigned int nzc9[4] = {0, 1, 7, 8};
     
     // Array of non-zero columns
-    static const unsigned int nzc20[4] = {10, 11, 17, 18};
+    static const unsigned int nzc10[4] = {10, 11, 17, 18};
     
     // Reset values in the element tensor.
     A[0] = 0.0;
@@ -37152,8 +38399,8 @@ public:
         // Total number of operations to compute function values = 16
         for (unsigned int r = 0; r < 4; r++)
         {
-          F1 += FE2_f0_C0[ip][r]*w[3][nzc13[r]];
-          F2 += FE2_f0_C0[ip][r]*w[3][nzc14[r]];
+          F1 += FE1_f0_C0[ip][r]*w[3][nzc3[r]];
+          F2 += FE1_f0_C0[ip][r]*w[3][nzc4[r]];
         } // end loop over 'r'
         
         // Number of operations to compute ip constants: 5
@@ -37191,8 +38438,8 @@ public:
         // Total number of operations to compute function values = 16
         for (unsigned int r = 0; r < 4; r++)
         {
-          F1 += FE2_f0_C0[ip][r]*w[3][nzc16[r]];
-          F2 += FE2_f0_C0[ip][r]*w[3][nzc17[r]];
+          F1 += FE1_f0_C0[ip][r]*w[3][nzc6[r]];
+          F2 += FE1_f0_C0[ip][r]*w[3][nzc7[r]];
         } // end loop over 'r'
         
         // Number of operations to compute ip constants: 5
@@ -37230,8 +38477,8 @@ public:
         // Total number of operations to compute function values = 16
         for (unsigned int r = 0; r < 4; r++)
         {
-          F1 += FE2_f0_C0[ip][r]*w[3][nzc19[r]];
-          F2 += FE2_f0_C0[ip][r]*w[3][nzc20[r]];
+          F1 += FE1_f0_C0[ip][r]*w[3][nzc9[r]];
+          F2 += FE1_f0_C0[ip][r]*w[3][nzc10[r]];
         } // end loop over 'r'
         
         // Number of operations to compute ip constants: 5
@@ -37252,38 +38499,31 @@ public:
 
 };
 
-/// 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 adaptivenavierstokes_cell_integral_3_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_cell_integral_3_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_cell_integral_3_otherwise()
+  ~adaptivenavierstokes_cell_integral_3_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    1
@@ -37292,7 +38532,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -37535,42 +38775,35 @@ public:
 
 };
 
-/// 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 adaptivenavierstokes_cell_integral_4_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_cell_integral_4_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_cell_integral_4_otherwise()
+  ~adaptivenavierstokes_cell_integral_4_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -37620,89 +38853,59 @@ public:
     
     static const double FE0_D01[25][1] = \
     {{1.06454195761932},
-    {0.575285441238389},
-    {0.0695371421115127},
-    {-0.156297836604578},
-    {-0.100783948537449},
+    {0.57528544123839},
+    {0.0695371421115145},
+    {-0.156297836604576},
+    {-0.100783948537451},
     {4.18066660252782},
     {2.09321751667939},
-    {-0.0197695576719565},
+    {-0.0197695576719561},
     {-0.87511767987259},
-    {-0.506910012747098},
+    {-0.506910012747101},
     {5.70722656015912},
     {2.19762631898683},
     {-1.19092570485195},
     {-2.23320663144434},
     {-1.13361310483318},
     {3.62492541922148},
-    {-0.215583167171886},
+    {-0.215583167171885},
     {-3.59850532693657},
     {-3.95431694241715},
     {-1.79832091177049},
-    {0.129295602035059},
+    {0.129295602035058},
     {-3.31015168346014},
     {-5.9530497856577},
     {-5.33822419894347},
     {-2.27407499327842}};
     
     static const double FE0_D10[25][1] = \
-    {{0.935246355584253},
+    {{0.935246355584254},
     {3.88543712469853},
     {6.02258692776922},
     {5.18192636233889},
-    {2.17329104474095},
+    {2.17329104474096},
     {0.555741183306337},
     {2.30880068385127},
     {3.57873576926462},
     {3.07919926254456},
-    {1.29141089902337},
+    {1.29141089902338},
     {0.0},
     {0.0},
     {0.0},
     {0.0},
-    {-1.59987077851595e-14},
-    {-0.555741183306339},
+    {-1.11583099202429e-14},
+    {-0.555741183306341},
     {-2.30880068385127},
-    {-3.57873576926461},
+    {-3.57873576926462},
     {-3.07919926254456},
-    {-1.29141089902341},
-    {-0.935246355584256},
+    {-1.2914108990234},
+    {-0.935246355584257},
     {-3.88543712469853},
-    {-6.02258692776921},
+    {-6.02258692776922},
     {-5.18192636233889},
     {-2.17329104474098}};
     
-    static const double FE1_C0[25][3] = \
-    {{0.915147549378728, 0.0450425935698037, 0.0398098570514687},
-    {0.764365329781281, 0.0376212523451112, 0.198013417873608},
-    {0.535660544808143, 0.026364644944471, 0.437974810247386},
-    {0.290249932250793, 0.0142857943955714, 0.695464273353636},
-    {0.0939127973337801, 0.00462228846504648, 0.901464914201173},
-    {0.738611533396152, 0.221578609552379, 0.0398098570514687},
-    {0.616915871859002, 0.185070710267389, 0.198013417873608},
-    {0.43232925297036, 0.129695936782254, 0.437974810247386},
-    {0.234259434638082, 0.0702762920082818, 0.695464273353636},
-    {0.0757966027350624, 0.0227384830637641, 0.901464914201173},
-    {0.480095071474266, 0.480095071474266, 0.0398098570514687},
-    {0.400993291063196, 0.400993291063196, 0.198013417873608},
-    {0.281012594876307, 0.281012594876307, 0.437974810247386},
-    {0.152267863323182, 0.152267863323182, 0.695464273353636},
-    {0.0492675428994133, 0.0492675428994133, 0.901464914201173},
-    {0.221578609552379, 0.738611533396152, 0.0398098570514687},
-    {0.185070710267389, 0.616915871859002, 0.198013417873608},
-    {0.129695936782254, 0.43232925297036, 0.437974810247386},
-    {0.0702762920082818, 0.234259434638082, 0.695464273353636},
-    {0.0227384830637641, 0.0757966027350624, 0.901464914201173},
-    {0.0450425935698037, 0.915147549378728, 0.0398098570514687},
-    {0.0376212523451112, 0.764365329781281, 0.198013417873608},
-    {0.026364644944471, 0.535660544808143, 0.437974810247386},
-    {0.0142857943955715, 0.290249932250793, 0.695464273353636},
-    {0.00462228846504648, 0.0939127973337801, 0.901464914201173}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc12[3] = {12, 13, 14};
-    
-    static const double FE2_C0[25][6] = \
+    static const double FE1_C0[25][6] = \
     {{0.759842524889054, -0.0409849230988147, -0.036640207614552, 0.00717255684496523, 0.145727572487076, 0.164882476492272},
     {0.404143384962011, -0.0347905350890822, -0.119594790557632, 0.0297980510461639, 0.605418365816316, 0.115025523822223},
     {0.0382038937201701, -0.0249744559383748, -0.0543309414249183, 0.0461882014671775, 0.938423301877431, 0.0564900002985142},
@@ -37730,76 +38933,106 @@ public:
     {-0.00457955736373816, -0.0762735703276687, 0.723813068870285, 0.338636367163553, 0.0166673234982245, 0.00173636815934466}};
     
     // Array of non-zero columns
-    static const unsigned int nzc6[6] = {0, 1, 2, 3, 4, 5};
+    static const unsigned int nzc0[6] = {0, 1, 2, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc9[6] = {6, 7, 8, 9, 10, 11};
+    static const unsigned int nzc3[6] = {6, 7, 8, 9, 10, 11};
     
-    static const double FE2_C0_D01[25][5] = \
-    {{-2.66059019751491, -0.840760571794125, 0.180170374279205, 3.50135076930904, -0.180170374279213},
+    static const double FE1_C0_D01[25][5] = \
+    {{-2.66059019751491, -0.840760571794125, 0.180170374279206, 3.50135076930904, -0.180170374279213},
     {-2.05746131912513, -0.207946328505566, 0.150485009380434, 2.2654076476307, -0.150485009380443},
     {-1.14264217923258, 0.751899240989546, 0.105458579777871, 0.390742938243035, -0.105458579777882},
-    {-0.160999729003176, 1.78185709341455, 0.0571431775822704, -1.62085736441136, -0.0571431775822835},
-    {0.624348810664875, 2.6058596568047, 0.0184891538601675, -3.23020846746956, -0.0184891538601829},
-    {-1.95444613358461, -0.840760571794125, 0.886314438209506, 2.79520670537874, -0.886314438209516},
+    {-0.160999729003176, 1.78185709341455, 0.0571431775822711, -1.62085736441137, -0.0571431775822828},
+    {0.624348810664875, 2.6058596568047, 0.0184891538601692, -3.23020846746957, -0.0184891538601817},
+    {-1.95444613358461, -0.840760571794125, 0.886314438209507, 2.79520670537874, -0.886314438209516},
     {-1.46766348743601, -0.207946328505566, 0.740282841069546, 1.67560981594158, -0.740282841069557},
-    {-0.729317011881444, 0.751899240989546, 0.518783747129004, -0.0225822291080975, -0.518783747129016},
+    {-0.729317011881444, 0.751899240989546, 0.518783747129004, -0.0225822291080974, -0.518783747129016},
     {0.0629622614476658, 1.78185709341455, 0.281105168033112, -1.84481935486221, -0.281105168033125},
-    {0.696813589059745, 2.6058596568047, 0.0909539322550379, -3.30267324586443, -0.0909539322550535},
+    {0.696813589059745, 2.6058596568047, 0.0909539322550397, -3.30267324586444, -0.0909539322550523},
     {-0.920380285897067, -0.840760571794124, 1.92038028589705, 1.7611408576912, -1.92038028589706},
     {-0.603973164252788, -0.207946328505566, 1.60397316425277, 0.81191949275836, -1.60397316425278},
     {-0.124050379505233, 0.751899240989546, 1.12405037950521, -0.627848861484308, -1.12405037950523},
     {0.390928546707267, 1.78185709341455, 0.609071453292713, -2.17278564012181, -0.609071453292727},
-    {0.802929828402342, 2.6058596568047, 0.197070171597634, -3.40878948520703, -0.19707017159765},
-    {0.113685561790479, -0.840760571794125, 2.95444613358459, 0.727075010003654, -2.95444613358461},
-    {0.259717158930437, -0.207946328505566, 2.467663487436, -0.0517708304248641, -2.46766348743601},
-    {0.481216252870978, 0.751899240989546, 1.72931701188142, -1.23311549386052, -1.72931701188144},
+    {0.802929828402342, 2.6058596568047, 0.197070171597636, -3.40878948520703, -0.197070171597649},
+    {0.113685561790479, -0.840760571794125, 2.9544461335846, 0.727075010003653, -2.95444613358461},
+    {0.259717158930438, -0.207946328505566, 2.467663487436, -0.0517708304248647, -2.46766348743601},
+    {0.481216252870979, 0.751899240989546, 1.72931701188142, -1.23311549386052, -1.72931701188144},
     {0.718894831966868, 1.78185709341455, 0.937037738552313, -2.50075192538141, -0.937037738552328},
-    {0.909046067744938, 2.6058596568047, 0.303186410940231, -3.51490572454963, -0.303186410940247},
-    {0.81982962572078, -0.840760571794125, 3.66059019751489, 0.0209309460733531, -3.66059019751491},
-    {0.84951499061955, -0.207946328505566, 3.05746131912511, -0.641568662113976, -3.05746131912512},
+    {0.909046067744939, 2.6058596568047, 0.303186410940233, -3.51490572454963, -0.303186410940246},
+    {0.819829625720781, -0.840760571794125, 3.6605901975149, 0.0209309460733513, -3.66059019751491},
+    {0.849514990619551, -0.207946328505566, 3.05746131912511, -0.641568662113977, -3.05746131912512},
     {0.894541420222111, 0.751899240989546, 2.14264217923256, -1.64644066121165, -2.14264217923257},
     {0.942856822417709, 1.78185709341455, 1.16099972900315, -2.72471391583225, -1.16099972900317},
-    {0.981510846139809, 2.6058596568047, 0.375651189335101, -3.5873705029445, -0.375651189335118}};
+    {0.981510846139809, 2.6058596568047, 0.375651189335103, -3.5873705029445, -0.375651189335117}};
     
     // Array of non-zero columns
-    static const unsigned int nzc7[5] = {0, 2, 3, 4, 5};
+    static const unsigned int nzc1[5] = {0, 2, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc10[5] = {6, 8, 9, 10, 11};
+    static const unsigned int nzc4[5] = {6, 8, 9, 10, 11};
     
-    static const double FE2_C0_D10[25][5] = \
-    {{-2.66059019751491, -0.819829625720788, 0.159239428205874, -0.159239428205874, 3.4804198232357},
-    {-2.05746131912512, -0.849514990619557, 0.792053671494431, -0.792053671494431, 2.90697630974468},
-    {-1.14264217923257, -0.894541420222118, 1.75189924098954, -1.75189924098954, 2.03718359945469},
+    static const double FE1_C0_D10[25][5] = \
+    {{-2.66059019751491, -0.819829625720789, 0.159239428205874, -0.159239428205874, 3.4804198232357},
+    {-2.05746131912512, -0.849514990619558, 0.792053671494431, -0.792053671494431, 2.90697630974468},
+    {-1.14264217923257, -0.894541420222119, 1.75189924098954, -1.75189924098954, 2.03718359945469},
     {-0.160999729003171, -0.942856822417716, 2.78185709341454, -2.78185709341454, 1.10385655142089},
-    {0.624348810664879, -0.981510846139816, 3.60585965680469, -3.60585965680469, 0.357162035474937},
+    {0.624348810664879, -0.981510846139816, 3.60585965680469, -3.60585965680469, 0.357162035474935},
     {-1.95444613358461, -0.113685561790486, 0.159239428205874, -0.159239428205874, 2.06813169537509},
     {-1.46766348743601, -0.259717158930444, 0.792053671494431, -0.792053671494431, 1.72738064636645},
     {-0.729317011881439, -0.481216252870985, 1.75189924098954, -1.75189924098954, 1.21053326475242},
-    {0.0629622614476701, -0.718894831966874, 2.78185709341454, -2.78185709341454, 0.655932570519204},
-    {0.696813589059749, -0.909046067744946, 3.60585965680469, -3.60585965680469, 0.212232478685196},
+    {0.0629622614476704, -0.718894831966874, 2.78185709341454, -2.78185709341454, 0.655932570519203},
+    {0.69681358905975, -0.909046067744945, 3.60585965680469, -3.60585965680469, 0.212232478685194},
     {-0.920380285897061, 0.920380285897061, 0.159239428205874, -0.159239428205874, 0.0},
-    {-0.603973164252783, 0.603973164252783, 0.792053671494431, -0.792053671494431, 0.0},
+    {-0.603973164252782, 0.603973164252783, 0.792053671494431, -0.792053671494431, 0.0},
     {-0.124050379505227, 0.124050379505227, 1.75189924098954, -1.75189924098954, 0.0},
-    {0.390928546707272, -0.390928546707273, 2.78185709341454, -2.78185709341454, 0.0},
-    {0.802929828402346, -0.802929828402349, 3.60585965680469, -3.60585965680469, 0.0},
+    {0.390928546707272, -0.390928546707272, 2.78185709341454, -2.78185709341454, 0.0},
+    {0.802929828402347, -0.802929828402348, 3.60585965680469, -3.60585965680469, 0.0},
     {0.113685561790485, 1.95444613358461, 0.159239428205874, -0.159239428205874, -2.06813169537509},
     {0.259717158930444, 1.46766348743601, 0.792053671494431, -0.792053671494431, -1.72738064636645},
     {0.481216252870985, 0.729317011881439, 1.75189924098954, -1.75189924098954, -1.21053326475242},
-    {0.718894831966873, -0.0629622614476715, 2.78185709341454, -2.78185709341454, -0.655932570519202},
-    {0.909046067744943, -0.696813589059752, 3.60585965680469, -3.60585965680469, -0.212232478685192},
-    {0.819829625720789, 2.66059019751491, 0.159239428205874, -0.159239428205874, -3.4804198232357},
-    {0.849514990619558, 2.05746131912512, 0.792053671494431, -0.792053671494431, -2.90697630974468},
+    {0.718894831966873, -0.062962261447671, 2.78185709341454, -2.78185709341454, -0.655932570519203},
+    {0.909046067744944, -0.696813589059751, 3.60585965680469, -3.60585965680469, -0.212232478685194},
+    {0.819829625720787, 2.66059019751491, 0.159239428205874, -0.159239428205874, -3.4804198232357},
+    {0.849514990619557, 2.05746131912512, 0.792053671494431, -0.792053671494431, -2.90697630974468},
     {0.894541420222118, 1.14264217923257, 1.75189924098954, -1.75189924098954, -2.03718359945469},
-    {0.942856822417714, 0.16099972900317, 2.78185709341454, -2.78185709341454, -1.10385655142088},
-    {0.981510846139813, -0.624348810664881, 3.60585965680469, -3.60585965680469, -0.357162035474933}};
+    {0.942856822417715, 0.160999729003171, 2.78185709341454, -2.78185709341454, -1.10385655142089},
+    {0.981510846139814, -0.62434881066488, 3.60585965680469, -3.60585965680469, -0.357162035474935}};
     
     // Array of non-zero columns
-    static const unsigned int nzc8[5] = {0, 1, 3, 4, 5};
+    static const unsigned int nzc2[5] = {0, 1, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc11[5] = {6, 7, 9, 10, 11};
+    static const unsigned int nzc5[5] = {6, 7, 9, 10, 11};
+    
+    static const double FE1_C2[25][3] = \
+    {{0.915147549378728, 0.0450425935698037, 0.0398098570514687},
+    {0.764365329781281, 0.0376212523451112, 0.198013417873608},
+    {0.535660544808143, 0.026364644944471, 0.437974810247386},
+    {0.290249932250793, 0.0142857943955714, 0.695464273353636},
+    {0.0939127973337801, 0.00462228846504648, 0.901464914201173},
+    {0.738611533396152, 0.221578609552379, 0.0398098570514687},
+    {0.616915871859002, 0.185070710267389, 0.198013417873608},
+    {0.43232925297036, 0.129695936782254, 0.437974810247386},
+    {0.234259434638082, 0.0702762920082818, 0.695464273353636},
+    {0.0757966027350624, 0.0227384830637641, 0.901464914201173},
+    {0.480095071474266, 0.480095071474266, 0.0398098570514687},
+    {0.400993291063196, 0.400993291063196, 0.198013417873608},
+    {0.281012594876307, 0.281012594876307, 0.437974810247386},
+    {0.152267863323182, 0.152267863323182, 0.695464273353636},
+    {0.0492675428994133, 0.0492675428994133, 0.901464914201173},
+    {0.221578609552379, 0.738611533396152, 0.0398098570514687},
+    {0.185070710267389, 0.616915871859002, 0.198013417873608},
+    {0.129695936782254, 0.43232925297036, 0.437974810247386},
+    {0.0702762920082818, 0.234259434638082, 0.695464273353636},
+    {0.0227384830637641, 0.0757966027350624, 0.901464914201173},
+    {0.0450425935698037, 0.915147549378728, 0.0398098570514687},
+    {0.0376212523451112, 0.764365329781281, 0.198013417873608},
+    {0.026364644944471, 0.535660544808143, 0.437974810247386},
+    {0.0142857943955715, 0.290249932250793, 0.695464273353636},
+    {0.00462228846504648, 0.0939127973337801, 0.901464914201173}};
+    
+    // Array of non-zero columns
+    static const unsigned int nzc6[3] = {12, 13, 14};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 15; r++)
@@ -37812,13 +39045,13 @@ public:
     G[1] =  - K[2]*det;
     G[2] =  - K[1]*det;
     G[3] =  - K[3]*det;
-    G[4] = K[3]*det;
+    G[4] = K[2]*det;
     G[5] =  - det*w[2][0]*(K[0]*K[2] + K[1]*K[3]);
     G[6] =  - det*w[2][0]*(K[2]*K[2] + K[3]*K[3]);
-    G[7] = K[1]*det;
+    G[7] = K[0]*det;
     G[8] =  - det*w[2][0]*(K[0]*K[0] + K[1]*K[1]);
-    G[9] = K[2]*det;
-    G[10] = K[0]*det;
+    G[9] = K[3]*det;
+    G[10] = K[1]*det;
     
     // Compute element tensor using UFL quadrature representation
     // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
@@ -37851,23 +39084,23 @@ public:
       // Total number of operations to compute function values = 6
       for (unsigned int r = 0; r < 3; r++)
       {
-        F0 += FE1_C0[ip][r]*w[0][nzc12[r]];
+        F0 += FE1_C2[ip][r]*w[0][nzc6[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 40
       for (unsigned int r = 0; r < 5; r++)
       {
-        F4 += FE2_C0_D10[ip][r]*w[0][nzc8[r]];
-        F5 += FE2_C0_D01[ip][r]*w[0][nzc7[r]];
-        F6 += FE2_C0_D10[ip][r]*w[0][nzc11[r]];
-        F7 += FE2_C0_D01[ip][r]*w[0][nzc10[r]];
+        F4 += FE1_C0_D10[ip][r]*w[0][nzc2[r]];
+        F5 += FE1_C0_D01[ip][r]*w[0][nzc1[r]];
+        F6 += FE1_C0_D10[ip][r]*w[0][nzc5[r]];
+        F7 += FE1_C0_D01[ip][r]*w[0][nzc4[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 24
       for (unsigned int r = 0; r < 6; r++)
       {
-        F8 += FE2_C0[ip][r]*w[0][nzc6[r]];
-        F9 += FE2_C0[ip][r]*w[0][nzc9[r]];
+        F8 += FE1_C0[ip][r]*w[0][nzc0[r]];
+        F9 += FE1_C0[ip][r]*w[0][nzc3[r]];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 87
@@ -37876,94 +39109,87 @@ public:
       I[0] = F3*W25[ip]*(F4*G[0] + F5*G[1] + F6*G[2] + F7*G[3]);
       
       // Number of operations: 7
-      I[1] = F3*W25[ip]*(F0*G[4] + F6*G[5] + F7*G[6]);
+      I[1] = F3*W25[ip]*(F0*G[4] + F4*G[5] + F5*G[6]);
       
       // Number of operations: 7
-      I[2] = F3*W25[ip]*(F0*G[7] + F6*G[8] + F7*G[5]);
+      I[2] = F3*W25[ip]*(F0*G[7] + F4*G[8] + F5*G[5]);
       
       // Number of operations: 7
-      I[3] = F3*W25[ip]*(F0*G[9] + F4*G[5] + F5*G[6]);
+      I[3] = F3*W25[ip]*(F0*G[9] + F6*G[5] + F7*G[6]);
       
       // Number of operations: 7
-      I[4] = F3*W25[ip]*(F0*G[10] + F4*G[8] + F5*G[5]);
+      I[4] = F3*W25[ip]*(F0*G[10] + F6*G[8] + F7*G[5]);
       
       // Number of operations: 25
-      I[5] = W25[ip]*(F0*(F1*G[10] + F2*G[9]) + F4*(F1*G[8] + F2*G[5] + F3*(F8*G[0] + F9*G[2])) + F5*(F1*G[5] + F2*G[6] + F3*(F8*G[1] + F9*G[3])));
+      I[5] = W25[ip]*(F0*(F1*G[7] + F2*G[4]) + F4*(F1*G[8] + F2*G[5] + F3*(F8*G[0] + F9*G[2])) + F5*(F1*G[5] + F2*G[6] + F3*(F8*G[1] + F9*G[3])));
       
       // Number of operations: 25
-      I[6] = W25[ip]*(F0*(F1*G[7] + F2*G[4]) + F6*(F1*G[8] + F2*G[5] + F3*(F8*G[0] + F9*G[2])) + F7*(F1*G[5] + F2*G[6] + F3*(F8*G[1] + F9*G[3])));
+      I[6] = W25[ip]*(F0*(F1*G[10] + F2*G[9]) + F6*(F1*G[8] + F2*G[5] + F3*(F8*G[0] + F9*G[2])) + F7*(F1*G[5] + F2*G[6] + F3*(F8*G[1] + F9*G[3])));
       
       
       // Number of operations for primary indices: 6
       for (unsigned int j = 0; j < 3; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc12[j]] += FE1_C0[ip][j]*I[0];
+        A[nzc6[j]] += FE1_C2[ip][j]*I[0];
       } // end loop over 'j'
       
       // Number of operations for primary indices: 40
       for (unsigned int j = 0; j < 5; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc10[j]] += FE2_C0_D01[ip][j]*I[1];
+        A[nzc1[j]] += FE1_C0_D01[ip][j]*I[1];
         // Number of operations to compute entry: 2
-        A[nzc11[j]] += FE2_C0_D10[ip][j]*I[2];
+        A[nzc2[j]] += FE1_C0_D10[ip][j]*I[2];
         // Number of operations to compute entry: 2
-        A[nzc7[j]] += FE2_C0_D01[ip][j]*I[3];
+        A[nzc4[j]] += FE1_C0_D01[ip][j]*I[3];
         // Number of operations to compute entry: 2
-        A[nzc8[j]] += FE2_C0_D10[ip][j]*I[4];
+        A[nzc5[j]] += FE1_C0_D10[ip][j]*I[4];
       } // end loop over 'j'
       
       // Number of operations for primary indices: 24
       for (unsigned int j = 0; j < 6; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc6[j]] += FE2_C0[ip][j]*I[5];
+        A[nzc0[j]] += FE1_C0[ip][j]*I[5];
         // Number of operations to compute entry: 2
-        A[nzc9[j]] += FE2_C0[ip][j]*I[6];
+        A[nzc3[j]] += FE1_C0[ip][j]*I[6];
       } // end loop over 'j'
     } // end loop over 'ip'
   }
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivenavierstokes_exterior_facet_integral_4_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_exterior_facet_integral_4_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_exterior_facet_integral_4_otherwise()
+  ~adaptivenavierstokes_exterior_facet_integral_4_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -38080,39 +39306,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivenavierstokes_exterior_facet_integral_5_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_exterior_facet_integral_5_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_exterior_facet_integral_5_otherwise()
+  ~adaptivenavierstokes_exterior_facet_integral_5_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    6
@@ -38121,7 +39340,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -38134,8 +39353,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -38843,42 +40062,35 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// interior facet tensor corresponding to the local contribution to
-/// a form from the integral over an interior facet.
 
 class adaptivenavierstokes_interior_facet_integral_5_otherwise: public ufc::interior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_interior_facet_integral_5_otherwise() : ufc::interior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_interior_facet_integral_5_otherwise()
+  ~adaptivenavierstokes_interior_facet_integral_5_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local interior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates_0,
-                               const double*  vertex_coordinates_1,
-                               std::size_t facet_0,
-                               std::size_t facet_1,
-                               int cell_orientation_0,
-                               int cell_orientation_1) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs_0,
+                       const double * coordinate_dofs_1,
+                       std::size_t facet_0,
+                       std::size_t facet_1,
+                       int cell_orientation_0,
+                       int cell_orientation_1) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      12
     // Number of operations (multiply-add pairs) for geometry tensor:    12
@@ -38887,7 +40099,7 @@ public:
     
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -38896,7 +40108,7 @@ public:
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -38909,8 +40121,8 @@ public:
     const unsigned int v1 = edge_vertices[facet_0][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates_0[2*v1 + 0] - vertex_coordinates_0[2*v0 + 0];
-    const double dx1 = vertex_coordinates_0[2*v1 + 1] - vertex_coordinates_0[2*v0 + 1];
+    const double dx0 = coordinate_dofs_0[2*v1 + 0] - coordinate_dofs_0[2*v0 + 0];
+    const double dx1 = coordinate_dofs_0[2*v1 + 1] - coordinate_dofs_0[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -47098,42 +48310,35 @@ public:
 
 };
 
-/// 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 adaptivenavierstokes_cell_integral_6_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_cell_integral_6_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_cell_integral_6_otherwise()
+  ~adaptivenavierstokes_cell_integral_6_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -47173,66 +48378,66 @@ public:
     {-0.00951545823536613, -0.0962269117343234, 0.619786046331442, 0.447517836913623, 0.0333903417359314, 0.0050481449886929}};
     
     // Array of non-zero columns
-    static const unsigned int nzc8[6] = {0, 1, 2, 3, 4, 5};
+    static const unsigned int nzc2[6] = {0, 1, 2, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc11[6] = {6, 7, 8, 9, 10, 11};
+    static const unsigned int nzc5[6] = {6, 7, 8, 9, 10, 11};
     
     static const double FE0_D01[16][5] = \
-    {{-2.50971523732188, -0.771583215541929, 0.261867978220048, 3.28129845286381, -0.261867978220057},
-    {-1.69178745260203, 0.107372054552496, 0.200840492845468, 1.58441539804954, -0.200840492845478},
+    {{-2.50971523732187, -0.771583215541929, 0.261867978220049, 3.28129845286381, -0.261867978220057},
+    {-1.69178745260203, 0.107372054552496, 0.200840492845468, 1.58441539804954, -0.200840492845477},
     {-0.549989933626782, 1.33436172947567, 0.115648336897542, -0.784371795848882, -0.115648336897554},
-    {0.479775683132657, 2.44096054262488, 0.0388151405077668, -2.92073622575753, -0.038815140507782},
+    {0.479775683132657, 2.44096054262488, 0.0388151405077681, -2.92073622575753, -0.0388151405077809},
     {-1.52692500656451, -0.771583215541929, 1.24465820897742, 2.29850822210644, -1.24465820897743},
-    {-0.938033306521738, 0.107372054552496, 0.95459463892576, 0.830661251969246, -0.954594638925772},
+    {-0.938033306521738, 0.107372054552496, 0.95459463892576, 0.830661251969247, -0.954594638925772},
     {-0.11596185398604, 1.33436172947567, 0.549676416538283, -1.21839987548962, -0.549676416538296},
-    {0.625448862250681, 2.44096054262488, 0.184488319625791, -3.06640940487555, -0.184488319625806},
+    {0.625448862250681, 2.44096054262488, 0.184488319625792, -3.06640940487556, -0.184488319625805},
     {-0.244658208977433, -0.771583215541929, 2.52692500656449, 1.01624142451937, -2.5269250065645},
     {0.0454053610742235, 0.107372054552497, 1.93803330652172, -0.152777415626714, -1.93803330652173},
-    {0.450323583461697, 1.33436172947567, 1.11596185398602, -1.78468531293736, -1.11596185398603},
-    {0.815511680374187, 2.44096054262488, 0.374551137749296, -3.25647222299906, -0.374551137749312},
-    {0.738132021779938, -0.771583215541929, 3.50971523732186, 0.0334511937620001, -3.50971523732187},
+    {0.450323583461698, 1.33436172947567, 1.11596185398602, -1.78468531293736, -1.11596185398603},
+    {0.815511680374187, 2.44096054262488, 0.374551137749298, -3.25647222299906, -0.374551137749311},
+    {0.738132021779938, -0.771583215541929, 3.50971523732186, 0.0334511937619992, -3.50971523732187},
     {0.799159507154516, 0.107372054552496, 2.69178745260201, -0.906531561707005, -2.69178745260203},
     {0.884351663102439, 1.33436172947567, 1.54998993362676, -2.2187133925781, -1.54998993362678},
-    {0.961184859492211, 2.44096054262488, 0.52022431686732, -3.40214540211708, -0.520224316867336}};
+    {0.961184859492211, 2.44096054262488, 0.520224316867321, -3.40214540211708, -0.520224316867335}};
     
     // Array of non-zero columns
     static const unsigned int nzc0[5] = {0, 2, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc9[5] = {0, 2, 3, 4, 5};
+    static const unsigned int nzc3[5] = {0, 2, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc12[5] = {6, 8, 9, 10, 11};
+    static const unsigned int nzc6[5] = {6, 8, 9, 10, 11};
     
     static const double FE0_D10[16][5] = \
     {{-2.50971523732187, -0.738132021779945, 0.228416784458069, -0.228416784458069, 3.24784725910182},
-    {-1.69178745260203, -0.799159507154523, 1.10737205455249, -1.10737205455249, 2.49094695975655},
-    {-0.549989933626778, -0.884351663102445, 2.33436172947566, -2.33436172947566, 1.43434159672922},
-    {0.479775683132661, -0.961184859492217, 3.44096054262487, -3.44096054262487, 0.481409176359556},
+    {-1.69178745260203, -0.799159507154524, 1.10737205455249, -1.10737205455249, 2.49094695975655},
+    {-0.549989933626778, -0.884351663102446, 2.33436172947566, -2.33436172947566, 1.43434159672922},
+    {0.479775683132662, -0.961184859492217, 3.44096054262487, -3.44096054262487, 0.481409176359554},
     {-1.5269250065645, 0.244658208977426, 0.228416784458069, -0.228416784458069, 1.28226679758707},
-    {-0.938033306521733, -0.0454053610742297, 1.10737205455249, -1.10737205455249, 0.983438667595962},
-    {-0.115961853986036, -0.450323583461703, 2.33436172947566, -2.33436172947566, 0.566285437447739},
-    {0.625448862250685, -0.815511680374193, 3.44096054262487, -3.44096054262487, 0.190062818123508},
+    {-0.938033306521733, -0.0454053610742298, 1.10737205455249, -1.10737205455249, 0.983438667595963},
+    {-0.115961853986035, -0.450323583461703, 2.33436172947566, -2.33436172947566, 0.566285437447738},
+    {0.625448862250686, -0.815511680374193, 3.44096054262487, -3.44096054262487, 0.190062818123506},
     {-0.244658208977426, 1.5269250065645, 0.228416784458069, -0.228416784458069, -1.28226679758707},
-    {0.0454053610742296, 0.938033306521733, 1.10737205455249, -1.10737205455249, -0.983438667595963},
-    {0.450323583461703, 0.115961853986035, 2.33436172947566, -2.33436172947566, -0.566285437447738},
-    {0.815511680374191, -0.625448862250687, 3.44096054262487, -3.44096054262487, -0.190062818123504},
+    {0.0454053610742297, 0.938033306521733, 1.10737205455249, -1.10737205455249, -0.983438667595963},
+    {0.450323583461703, 0.115961853986035, 2.33436172947566, -2.33436172947566, -0.566285437447739},
+    {0.815511680374192, -0.625448862250686, 3.44096054262487, -3.44096054262487, -0.190062818123506},
     {0.738132021779945, 2.50971523732187, 0.228416784458069, -0.228416784458069, -3.24784725910182},
     {0.799159507154523, 1.69178745260203, 1.10737205455249, -1.10737205455249, -2.49094695975655},
     {0.884351663102445, 0.549989933626778, 2.33436172947566, -2.33436172947566, -1.43434159672922},
-    {0.961184859492215, -0.479775683132663, 3.44096054262487, -3.44096054262487, -0.481409176359553}};
+    {0.961184859492216, -0.479775683132662, 3.44096054262487, -3.44096054262487, -0.481409176359555}};
     
     // Array of non-zero columns
     static const unsigned int nzc1[5] = {0, 1, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc10[5] = {0, 1, 3, 4, 5};
+    static const unsigned int nzc4[5] = {0, 1, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc13[5] = {6, 7, 9, 10, 11};
+    static const unsigned int nzc7[5] = {6, 7, 9, 10, 11};
     
-    static const double FE1_C0[16][3] = \
+    static const double FE1_C2[16][3] = \
     {{0.877428809330468, 0.0654669945550145, 0.0571041961145176},
     {0.672946863150506, 0.0502101232113698, 0.276843013638124},
     {0.387497483406694, 0.028912084224389, 0.583590432368917},
@@ -47251,7 +48456,7 @@ public:
     {0.00970378512694609, 0.130056079216835, 0.860240135656219}};
     
     // Array of non-zero columns
-    static const unsigned int nzc14[3] = {12, 13, 14};
+    static const unsigned int nzc8[3] = {12, 13, 14};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 15; r++)
@@ -47264,13 +48469,13 @@ public:
     G[1] =  - K[2]*det;
     G[2] =  - K[1]*det;
     G[3] =  - K[3]*det;
-    G[4] = K[0]*det;
-    G[5] =  - det*w[2][0]*(K[0]*K[0] + K[1]*K[1]);
-    G[6] =  - det*w[2][0]*(K[0]*K[2] + K[1]*K[3]);
-    G[7] = K[3]*det;
-    G[8] =  - det*w[2][0]*(K[2]*K[2] + K[3]*K[3]);
-    G[9] = K[1]*det;
-    G[10] = K[2]*det;
+    G[4] = K[2]*det;
+    G[5] =  - det*w[2][0]*(K[0]*K[2] + K[1]*K[3]);
+    G[6] =  - det*w[2][0]*(K[2]*K[2] + K[3]*K[3]);
+    G[7] = K[0]*det;
+    G[8] =  - det*w[2][0]*(K[0]*K[0] + K[1]*K[1]);
+    G[9] = K[3]*det;
+    G[10] = K[1]*det;
     
     // Compute element tensor using UFL quadrature representation
     // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
@@ -47298,8 +48503,8 @@ public:
       // Total number of operations to compute function values = 12
       for (unsigned int r = 0; r < 3; r++)
       {
-        F0 += FE1_C0[ip][r]*w[0][nzc14[r]];
-        F12 += FE1_C0[ip][r]*w[3][nzc14[r]];
+        F0 += FE1_C2[ip][r]*w[0][nzc8[r]];
+        F12 += FE1_C2[ip][r]*w[3][nzc8[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 60
@@ -47307,20 +48512,20 @@ public:
       {
         F1 += FE0_D10[ip][r]*w[4][nzc1[r]];
         F2 += FE0_D01[ip][r]*w[4][nzc0[r]];
-        F4 += FE0_D10[ip][r]*w[0][nzc10[r]];
-        F5 += FE0_D01[ip][r]*w[0][nzc9[r]];
-        F6 += FE0_D10[ip][r]*w[0][nzc13[r]];
-        F7 += FE0_D01[ip][r]*w[0][nzc12[r]];
+        F4 += FE0_D10[ip][r]*w[0][nzc4[r]];
+        F5 += FE0_D01[ip][r]*w[0][nzc3[r]];
+        F6 += FE0_D10[ip][r]*w[0][nzc7[r]];
+        F7 += FE0_D01[ip][r]*w[0][nzc6[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 60
       for (unsigned int r = 0; r < 6; r++)
       {
         F3 += FE0[ip][r]*w[4][r];
-        F8 += FE0[ip][r]*w[0][nzc8[r]];
-        F9 += FE0[ip][r]*w[0][nzc11[r]];
-        F10 += FE0[ip][r]*w[3][nzc8[r]];
-        F11 += FE0[ip][r]*w[3][nzc11[r]];
+        F8 += FE0[ip][r]*w[0][nzc2[r]];
+        F9 += FE0[ip][r]*w[0][nzc5[r]];
+        F10 += FE0[ip][r]*w[3][nzc2[r]];
+        F11 += FE0[ip][r]*w[3][nzc5[r]];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 93
@@ -47332,91 +48537,84 @@ public:
       I[1] = F3*W16[ip]*(F0*G[4] + F4*G[5] + F5*G[6]);
       
       // Number of operations: 7
-      I[2] = F3*W16[ip]*(F0*G[7] + F6*G[6] + F7*G[8]);
+      I[2] = F3*W16[ip]*(F0*G[7] + F4*G[8] + F5*G[5]);
       
       // Number of operations: 7
       I[3] = F3*W16[ip]*(F0*G[9] + F6*G[5] + F7*G[6]);
       
       // Number of operations: 7
-      I[4] = F3*W16[ip]*(F0*G[10] + F4*G[6] + F5*G[8]);
+      I[4] = F3*W16[ip]*(F0*G[10] + F6*G[8] + F7*G[5]);
       
       // Number of operations: 27
-      I[5] = W16[ip]*(F1*(F0*G[9] + F6*G[5] + F7*G[6]) + F2*(F0*G[7] + F6*G[6] + F7*G[8]) + F3*(F8*(F6*G[0] + F7*G[1]) + F9*(F6*G[2] + F7*G[3]) - F11*det));
+      I[5] = W16[ip]*(F1*(F0*G[7] + F4*G[8] + F5*G[5]) + F2*(F0*G[4] + F4*G[5] + F5*G[6]) + F3*(F8*(F4*G[0] + F5*G[1]) + F9*(F4*G[2] + F5*G[3]) - F10*det));
       
       // Number of operations: 27
-      I[6] = W16[ip]*(F1*(F0*G[4] + F4*G[5] + F5*G[6]) + F2*(F0*G[10] + F4*G[6] + F5*G[8]) + F3*(F8*(F4*G[0] + F5*G[1]) + F9*(F4*G[2] + F5*G[3]) - F10*det));
+      I[6] = W16[ip]*(F1*(F0*G[10] + F6*G[8] + F7*G[5]) + F2*(F0*G[9] + F6*G[5] + F7*G[6]) + F3*(F8*(F6*G[0] + F7*G[1]) + F9*(F6*G[2] + F7*G[3]) - F11*det));
       
       
       // Number of operations for primary indices: 6
       for (unsigned int j = 0; j < 3; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc14[j]] += FE1_C0[ip][j]*I[0];
+        A[nzc8[j]] += FE1_C2[ip][j]*I[0];
       } // end loop over 'j'
       
       // Number of operations for primary indices: 40
       for (unsigned int j = 0; j < 5; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc10[j]] += FE0_D10[ip][j]*I[1];
+        A[nzc3[j]] += FE0_D01[ip][j]*I[1];
         // Number of operations to compute entry: 2
-        A[nzc12[j]] += FE0_D01[ip][j]*I[2];
+        A[nzc4[j]] += FE0_D10[ip][j]*I[2];
         // Number of operations to compute entry: 2
-        A[nzc13[j]] += FE0_D10[ip][j]*I[3];
+        A[nzc6[j]] += FE0_D01[ip][j]*I[3];
         // Number of operations to compute entry: 2
-        A[nzc9[j]] += FE0_D01[ip][j]*I[4];
+        A[nzc7[j]] += FE0_D10[ip][j]*I[4];
       } // end loop over 'j'
       
       // Number of operations for primary indices: 24
       for (unsigned int j = 0; j < 6; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc11[j]] += FE0[ip][j]*I[5];
+        A[nzc2[j]] += FE0[ip][j]*I[5];
         // Number of operations to compute entry: 2
-        A[nzc8[j]] += FE0[ip][j]*I[6];
+        A[nzc5[j]] += FE0[ip][j]*I[6];
       } // end loop over 'j'
     } // end loop over 'ip'
   }
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivenavierstokes_exterior_facet_integral_6_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_exterior_facet_integral_6_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_exterior_facet_integral_6_otherwise()
+  ~adaptivenavierstokes_exterior_facet_integral_6_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true, false, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -47431,12 +48629,12 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates[2*facet] - vertex_coordinates[2*v0]) - dx0*(vertex_coordinates[2*facet + 1] - vertex_coordinates[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs[2*facet] - coordinate_dofs[2*v0]) - dx0*(coordinate_dofs[2*facet + 1] - coordinate_dofs[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n0 = direction ? dx1 / det : -dx1 / det;
     const double n1 = direction ? -dx0 / det : dx0 / det;
@@ -47483,22 +48681,22 @@ public:
     static const unsigned int nzc5[3] = {0, 1, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc16[3] = {1, 2, 3};
+    static const unsigned int nzc6[3] = {1, 2, 3};
     
     // Array of non-zero columns
-    static const unsigned int nzc17[3] = {7, 8, 9};
+    static const unsigned int nzc7[3] = {7, 8, 9};
     
     // Array of non-zero columns
-    static const unsigned int nzc19[3] = {0, 2, 4};
+    static const unsigned int nzc9[3] = {0, 2, 4};
     
     // Array of non-zero columns
-    static const unsigned int nzc20[3] = {6, 8, 10};
+    static const unsigned int nzc10[3] = {6, 8, 10};
     
     // Array of non-zero columns
-    static const unsigned int nzc22[3] = {0, 1, 5};
+    static const unsigned int nzc12[3] = {0, 1, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc23[3] = {6, 7, 11};
+    static const unsigned int nzc13[3] = {6, 7, 11};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 15; r++)
@@ -47552,9 +48750,9 @@ public:
         for (unsigned int j = 0; j < 3; j++)
         {
           // Number of operations to compute entry: 2
-          A[nzc16[j]] += FE1_f0[ip][j]*I[0];
+          A[nzc6[j]] += FE1_f0[ip][j]*I[0];
           // Number of operations to compute entry: 2
-          A[nzc17[j]] += FE1_f0[ip][j]*I[1];
+          A[nzc7[j]] += FE1_f0[ip][j]*I[1];
         } // end loop over 'j'
       } // end loop over 'ip'
         break;
@@ -47587,19 +48785,19 @@ public:
         // Number of operations to compute ip constants: 6
         double I[2];
         // Number of operations: 3
-        I[0] = F0*F1*G[0]*W3[ip];
+        I[0] = F0*F1*G[1]*W3[ip];
         
         // Number of operations: 3
-        I[1] = F0*F1*G[1]*W3[ip];
+        I[1] = F0*F1*G[0]*W3[ip];
         
         
         // Number of operations for primary indices: 12
         for (unsigned int j = 0; j < 3; j++)
         {
           // Number of operations to compute entry: 2
-          A[nzc19[j]] += FE1_f0[ip][j]*I[0];
+          A[nzc10[j]] += FE1_f0[ip][j]*I[0];
           // Number of operations to compute entry: 2
-          A[nzc20[j]] += FE1_f0[ip][j]*I[1];
+          A[nzc9[j]] += FE1_f0[ip][j]*I[1];
         } // end loop over 'j'
       } // end loop over 'ip'
         break;
@@ -47642,9 +48840,9 @@ public:
         for (unsigned int j = 0; j < 3; j++)
         {
           // Number of operations to compute entry: 2
-          A[nzc22[j]] += FE1_f0[ip][j]*I[0];
+          A[nzc12[j]] += FE1_f0[ip][j]*I[0];
           // Number of operations to compute entry: 2
-          A[nzc23[j]] += FE1_f0[ip][j]*I[1];
+          A[nzc13[j]] += FE1_f0[ip][j]*I[1];
         } // end loop over 'j'
       } // end loop over 'ip'
         break;
@@ -47655,38 +48853,31 @@ public:
 
 };
 
-/// 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 adaptivenavierstokes_cell_integral_7_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_cell_integral_7_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_cell_integral_7_otherwise()
+  ~adaptivenavierstokes_cell_integral_7_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    292
@@ -47695,7 +48886,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -47908,39 +49099,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivenavierstokes_exterior_facet_integral_7_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_exterior_facet_integral_7_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_exterior_facet_integral_7_otherwise()
+  ~adaptivenavierstokes_exterior_facet_integral_7_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    180
@@ -47949,7 +49133,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -47962,8 +49146,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -48113,42 +49297,35 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// interior facet tensor corresponding to the local contribution to
-/// a form from the integral over an interior facet.
 
 class adaptivenavierstokes_interior_facet_integral_7_otherwise: public ufc::interior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_interior_facet_integral_7_otherwise() : ufc::interior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_interior_facet_integral_7_otherwise()
+  ~adaptivenavierstokes_interior_facet_integral_7_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local interior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates_0,
-                               const double*  vertex_coordinates_1,
-                               std::size_t facet_0,
-                               std::size_t facet_1,
-                               int cell_orientation_0,
-                               int cell_orientation_1) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs_0,
+                       const double * coordinate_dofs_1,
+                       std::size_t facet_0,
+                       std::size_t facet_1,
+                       int cell_orientation_0,
+                       int cell_orientation_1) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      12
     // Number of operations (multiply-add pairs) for geometry tensor:    720
@@ -48157,7 +49334,7 @@ public:
     
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -48166,7 +49343,7 @@ public:
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -48179,8 +49356,8 @@ public:
     const unsigned int v1 = edge_vertices[facet_0][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates_0[2*v1 + 0] - vertex_coordinates_0[2*v0 + 0];
-    const double dx1 = vertex_coordinates_0[2*v1 + 1] - vertex_coordinates_0[2*v0 + 1];
+    const double dx0 = coordinate_dofs_0[2*v1 + 0] - coordinate_dofs_0[2*v0 + 0];
+    const double dx1 = coordinate_dofs_0[2*v1 + 1] - coordinate_dofs_0[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -48754,38 +49931,31 @@ public:
 
 };
 
-/// 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 adaptivenavierstokes_cell_integral_8_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_cell_integral_8_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_cell_integral_8_otherwise()
+  ~adaptivenavierstokes_cell_integral_8_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    172
@@ -48794,7 +49964,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -48919,75 +50089,75 @@ public:
     const double G15_11_1 = det*w[0][11]*K[3]*(1.0);
     
     // Compute element tensor
-    A[0] = 0.5*G0_0_0_0 + 0.5*G0_0_0_1 + 0.5*G0_0_1_0 + 0.500000000000001*G0_0_1_1 + 0.5*G2_0_0_0 + 0.5*G2_0_0_1 + 0.5*G2_0_1_0 + 0.500000000000001*G2_0_1_1 - 0.030952380952381*G8_0_0 - 0.030952380952381*G8_0_1 + 0.00357142857142856*G8_1_0 + 0.00357142857142858*G8_1_1 + 0.00357142857142858*G8_2_0 + 0.00357142857142859*G8_2_1 - 0.00476190476190477*G8_3_0 - 0.00476190476190471*G8_3_1 - 0.0190476190476191*G8_4_0 - 0.0190476190476191*G8_4_1 - 0.0190476190476191*G8_5_0 - 0.0190476190476191*G8 [...]
-    A[1] = 0.166666666666668*G0_0_0_0 + 0.166666666666666*G0_0_1_0 + 0.166666666666668*G2_0_0_0 + 0.166666666666666*G2_0_1_0 - 0.00714285714285718*G8_0_0 - 0.00357142857142857*G8_1_0 + 0.00436507936507937*G8_2_0 - 0.00793650793650793*G8_3_0 - 0.00634920634920637*G8_4_0 - 0.0126984126984127*G8_5_0 + 0.00357142857142856*G9_0_0 + 0.00357142857142858*G9_0_1 - 0.00357142857142857*G9_1_0 + 0.00436507936507936*G9_2_1 + 0.00158730158730159*G9_3_0 - 0.00634920634920631*G9_3_1 - 0.0015873015873015 [...]
-    A[2] = 0.166666666666666*G0_0_0_1 + 0.166666666666666*G0_0_1_1 + 0.166666666666666*G2_0_0_1 + 0.166666666666666*G2_0_1_1 - 0.00714285714285714*G8_0_1 + 0.00436507936507936*G8_1_1 - 0.00357142857142857*G8_2_1 - 0.00793650793650795*G8_3_1 - 0.0126984126984127*G8_4_1 - 0.00634920634920636*G8_5_1 + 0.00357142857142858*G9_0_0 + 0.00357142857142859*G9_0_1 + 0.00436507936507937*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920634*G9_3_0 + 0.00158730158730163*G9_3_1 + 0.0063492063492063 [...]
-    A[3] = 0.0095238095238095*G8_0_0 + 0.00952380952380933*G8_0_1 + 0.00158730158730159*G8_1_0 - 0.00634920634920631*G8_1_1 - 0.00634920634920634*G8_2_0 + 0.00158730158730163*G8_2_1 - 0.019047619047619*G8_3_0 - 0.0190476190476189*G8_3_1 - 0.0126984126984127*G8_4_0 - 0.00634920634920632*G8_4_1 - 0.00634920634920634*G8_5_0 - 0.0126984126984127*G8_5_1 - 0.00476190476190477*G9_0_0 - 0.00476190476190471*G9_0_1 - 0.00793650793650793*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_ [...]
-    A[4] = -0.666666666666668*G0_0_0_1 - 0.666666666666668*G0_0_1_1 - 0.666666666666668*G2_0_0_1 - 0.666666666666668*G2_0_1_1 - 0.0095238095238095*G8_0_0 + 0.0380952380952383*G8_0_1 - 0.00158730158730159*G8_1_0 - 0.00793650793650796*G8_1_1 + 0.00634920634920634*G8_2_0 + 0.019047619047619*G8_3_0 + 0.0126984126984126*G8_3_1 + 0.0126984126984127*G8_4_0 + 0.0317460317460317*G8_4_1 + 0.00634920634920634*G8_5_0 + 0.0253968253968254*G8_5_1 - 0.0190476190476191*G9_0_0 - 0.0190476190476191*G9_0_1 [...]
-    A[5] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_1_0 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_1_0 + 0.0380952380952381*G8_0_0 - 0.00952380952380951*G8_0_1 + 0.00634920634920635*G8_1_1 - 0.00793650793650795*G8_2_0 - 0.00158730158730159*G8_2_1 + 0.0126984126984127*G8_3_0 + 0.019047619047619*G8_3_1 + 0.0253968253968254*G8_4_0 + 0.00634920634920635*G8_4_1 + 0.0317460317460318*G8_5_0 + 0.0126984126984127*G8_5_1 - 0.0190476190476191*G9_0_0 - 0.0190476190476191*G9_0_ [...]
-    A[6] = -0.030952380952381*G10_0_0 - 0.030952380952381*G10_0_1 - 0.00714285714285718*G10_1_0 - 0.00714285714285714*G10_2_1 + 0.0095238095238095*G10_3_0 + 0.00952380952380933*G10_3_1 - 0.0095238095238095*G10_4_0 + 0.0380952380952383*G10_4_1 + 0.0380952380952381*G10_5_0 - 0.00952380952380951*G10_5_1;
-    A[7] = 0.00357142857142856*G10_0_0 + 0.00357142857142858*G10_0_1 - 0.00357142857142857*G10_1_0 + 0.00436507936507936*G10_2_1 + 0.00158730158730159*G10_3_0 - 0.00634920634920631*G10_3_1 - 0.00158730158730159*G10_4_0 - 0.00793650793650796*G10_4_1 + 0.00634920634920635*G10_5_1;
-    A[8] = 0.00357142857142858*G10_0_0 + 0.00357142857142859*G10_0_1 + 0.00436507936507937*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 + 0.00158730158730163*G10_3_1 + 0.00634920634920633*G10_4_0 - 0.00793650793650795*G10_5_0 - 0.00158730158730159*G10_5_1;
-    A[9] = -0.00476190476190477*G10_0_0 - 0.00476190476190471*G10_0_1 - 0.00793650793650793*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.019047619047619*G10_4_0 + 0.0126984126984126*G10_4_1 + 0.0126984126984127*G10_5_0 + 0.019047619047619*G10_5_1;
-    A[10] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.00634920634920637*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 - 0.00634920634920632*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.0317460317460317*G10_4_1 + 0.0253968253968254*G10_5_0 + 0.00634920634920635*G10_5_1;
+    A[0] = 0.5*G0_0_0_0 + 0.5*G0_0_0_1 + 0.5*G0_0_1_0 + 0.500000000000001*G0_0_1_1 + 0.5*G2_0_0_0 + 0.5*G2_0_0_1 + 0.5*G2_0_1_0 + 0.500000000000001*G2_0_1_1 - 0.030952380952381*G8_0_0 - 0.030952380952381*G8_0_1 + 0.00357142857142857*G8_1_0 + 0.00357142857142858*G8_1_1 + 0.00357142857142858*G8_2_0 + 0.00357142857142859*G8_2_1 - 0.00476190476190477*G8_3_0 - 0.00476190476190471*G8_3_1 - 0.0190476190476191*G8_4_0 - 0.0190476190476191*G8_4_1 - 0.0190476190476191*G8_5_0 - 0.0190476190476191*G8 [...]
+    A[1] = 0.166666666666668*G0_0_0_0 + 0.166666666666666*G0_0_1_0 + 0.166666666666668*G2_0_0_0 + 0.166666666666666*G2_0_1_0 - 0.00714285714285719*G8_0_0 - 0.00357142857142856*G8_1_0 + 0.00436507936507937*G8_2_0 - 0.00793650793650793*G8_3_0 - 0.00634920634920638*G8_4_0 - 0.0126984126984127*G8_5_0 + 0.00357142857142857*G9_0_0 + 0.00357142857142858*G9_0_1 - 0.00357142857142856*G9_1_0 + 0.00436507936507936*G9_2_1 + 0.00158730158730159*G9_3_0 - 0.00634920634920631*G9_3_1 - 0.0015873015873015 [...]
+    A[2] = 0.166666666666666*G0_0_0_1 + 0.166666666666666*G0_0_1_1 + 0.166666666666666*G2_0_0_1 + 0.166666666666666*G2_0_1_1 - 0.00714285714285714*G8_0_1 + 0.00436507936507936*G8_1_1 - 0.00357142857142857*G8_2_1 - 0.00793650793650795*G8_3_1 - 0.0126984126984127*G8_4_1 - 0.00634920634920636*G8_5_1 + 0.00357142857142858*G9_0_0 + 0.00357142857142859*G9_0_1 + 0.00436507936507937*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920634*G9_3_0 + 0.00158730158730162*G9_3_1 + 0.0063492063492063 [...]
+    A[3] = 0.0095238095238095*G8_0_0 + 0.00952380952380934*G8_0_1 + 0.00158730158730159*G8_1_0 - 0.00634920634920631*G8_1_1 - 0.00634920634920634*G8_2_0 + 0.00158730158730162*G8_2_1 - 0.019047619047619*G8_3_0 - 0.0190476190476189*G8_3_1 - 0.0126984126984127*G8_4_0 - 0.00634920634920631*G8_4_1 - 0.00634920634920634*G8_5_0 - 0.0126984126984127*G8_5_1 - 0.00476190476190477*G9_0_0 - 0.00476190476190471*G9_0_1 - 0.00793650793650793*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_ [...]
+    A[4] = -0.666666666666668*G0_0_0_1 - 0.666666666666668*G0_0_1_1 - 0.666666666666668*G2_0_0_1 - 0.666666666666668*G2_0_1_1 - 0.0095238095238095*G8_0_0 + 0.0380952380952382*G8_0_1 - 0.00158730158730159*G8_1_0 - 0.00793650793650796*G8_1_1 + 0.00634920634920634*G8_2_0 + 0.019047619047619*G8_3_0 + 0.0126984126984126*G8_3_1 + 0.0126984126984127*G8_4_0 + 0.0317460317460317*G8_4_1 + 0.00634920634920634*G8_5_0 + 0.0253968253968254*G8_5_1 - 0.0190476190476191*G9_0_0 - 0.0190476190476191*G9_0_1 [...]
+    A[5] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_1_0 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_1_0 + 0.0380952380952382*G8_0_0 - 0.00952380952380951*G8_0_1 + 0.00634920634920635*G8_1_1 - 0.00793650793650795*G8_2_0 - 0.00158730158730159*G8_2_1 + 0.0126984126984127*G8_3_0 + 0.019047619047619*G8_3_1 + 0.0253968253968254*G8_4_0 + 0.00634920634920635*G8_4_1 + 0.0317460317460318*G8_5_0 + 0.0126984126984127*G8_5_1 - 0.0190476190476191*G9_0_0 - 0.0190476190476191*G9_0_ [...]
+    A[6] = -0.030952380952381*G10_0_0 - 0.030952380952381*G10_0_1 - 0.00714285714285719*G10_1_0 - 0.00714285714285714*G10_2_1 + 0.0095238095238095*G10_3_0 + 0.00952380952380934*G10_3_1 - 0.0095238095238095*G10_4_0 + 0.0380952380952382*G10_4_1 + 0.0380952380952382*G10_5_0 - 0.00952380952380951*G10_5_1;
+    A[7] = 0.00357142857142857*G10_0_0 + 0.00357142857142858*G10_0_1 - 0.00357142857142856*G10_1_0 + 0.00436507936507936*G10_2_1 + 0.00158730158730159*G10_3_0 - 0.00634920634920631*G10_3_1 - 0.00158730158730159*G10_4_0 - 0.00793650793650796*G10_4_1 + 0.00634920634920635*G10_5_1;
+    A[8] = 0.00357142857142858*G10_0_0 + 0.00357142857142859*G10_0_1 + 0.00436507936507937*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 + 0.00158730158730162*G10_3_1 + 0.00634920634920633*G10_4_0 - 0.00793650793650795*G10_5_0 - 0.00158730158730159*G10_5_1;
+    A[9] = -0.00476190476190477*G10_0_0 - 0.00476190476190471*G10_0_1 - 0.00793650793650794*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.019047619047619*G10_4_0 + 0.0126984126984126*G10_4_1 + 0.0126984126984127*G10_5_0 + 0.019047619047619*G10_5_1;
+    A[10] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.00634920634920638*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 - 0.00634920634920631*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.0317460317460317*G10_4_1 + 0.0253968253968254*G10_5_0 + 0.00634920634920635*G10_5_1;
     A[11] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.0126984126984127*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 - 0.0126984126984127*G10_3_1 + 0.00634920634920634*G10_4_0 + 0.0253968253968254*G10_4_1 + 0.0317460317460318*G10_5_0 + 0.0126984126984127*G10_5_1;
-    A[12] = 0.166666666666667*G4_0 + 0.166666666666668*G4_1;
+    A[12] = 0.166666666666667*G4_0 + 0.166666666666667*G4_1;
     A[13] = 0.0;
     A[14] = 0.0;
-    A[15] = 0.166666666666668*G0_0_0_0 + 0.166666666666666*G0_0_0_1 + 0.166666666666668*G2_0_0_0 + 0.166666666666666*G2_0_0_1 + 0.00357142857142856*G8_0_0 + 0.00357142857142858*G8_0_1 + 0.00714285714285717*G8_1_0 + 0.00714285714285705*G8_1_1 - 0.00436507936507936*G8_2_0 - 0.00436507936507934*G8_2_1 + 0.00634920634920636*G8_3_0 + 0.00634920634920634*G8_3_1 + 0.00793650793650793*G8_4_0 + 0.00793650793650798*G8_4_1 + 0.0126984126984127*G8_5_0 + 0.0126984126984127*G8_5_1 + 0.0035714285714285 [...]
-    A[16] = 0.5*G0_0_0_0 + 0.5*G2_0_0_0 - 0.00357142857142857*G8_0_0 + 0.0309523809523809*G8_1_0 - 0.00357142857142857*G8_2_0 + 0.019047619047619*G8_3_0 + 0.00476190476190477*G8_4_0 + 0.0190476190476191*G8_5_0 + 0.00714285714285717*G9_0_0 + 0.00714285714285705*G9_0_1 + 0.0309523809523809*G9_1_0 - 0.00714285714285712*G9_2_1 + 0.00952380952380949*G9_3_0 + 0.0476190476190473*G9_3_1 - 0.00952380952380949*G9_4_0 - 0.0380952380952381*G9_5_0 - 0.0476190476190476*G9_5_1 - 0.00357142857142857*G11 [...]
-    A[17] = -0.166666666666667*G0_0_0_1 - 0.166666666666667*G2_0_0_1 + 0.00436507936507936*G8_0_1 - 0.00714285714285712*G8_1_1 - 0.00357142857142857*G8_2_1 - 0.0126984126984127*G8_3_1 - 0.00793650793650795*G8_4_1 - 0.00634920634920636*G8_5_1 - 0.00436507936507936*G9_0_0 - 0.00436507936507934*G9_0_1 - 0.00357142857142857*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.00634920634920629*G9_3_1 + 0.00634920634920633*G9_4_0 + 0.00793650793650789*G9_4_1 + 0.00793650793650 [...]
-    A[18] = 0.666666666666664*G0_0_0_1 + 0.666666666666664*G2_0_0_1 + 0.00158730158730159*G8_0_0 - 0.00634920634920631*G8_0_1 + 0.00952380952380949*G8_1_0 + 0.0476190476190473*G8_1_1 - 0.00634920634920633*G8_2_0 - 0.00634920634920629*G8_2_1 - 0.0126984126984127*G8_3_0 + 0.019047619047619*G8_3_1 - 0.019047619047619*G8_4_0 - 0.00634920634920621*G8_4_1 - 0.00634920634920634*G8_5_0 + 0.019047619047619*G8_5_1 + 0.00634920634920636*G9_0_0 + 0.00634920634920634*G9_0_1 + 0.019047619047619*G9_1_0 [...]
-    A[19] = -0.00158730158730159*G8_0_0 - 0.00793650793650796*G8_0_1 - 0.00952380952380949*G8_1_0 + 0.00634920634920633*G8_2_0 + 0.00793650793650789*G8_2_1 + 0.0126984126984127*G8_3_0 + 0.00634920634920638*G8_3_1 + 0.019047619047619*G8_4_0 + 0.00634920634920634*G8_5_0 - 0.00634920634920631*G8_5_1 + 0.00793650793650793*G9_0_0 + 0.00793650793650798*G9_0_1 + 0.00476190476190477*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_0 - 0.00634920634920621*G9_3_1 + 0.019047619047619*G9 [...]
-    A[20] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_0_1 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_0_1 + 0.00634920634920635*G8_0_1 - 0.0380952380952381*G8_1_0 - 0.0476190476190476*G8_1_1 + 0.00793650793650793*G8_2_0 + 0.00634920634920634*G8_2_1 - 0.0253968253968254*G8_3_0 - 0.019047619047619*G8_3_1 - 0.0126984126984127*G8_4_0 + 0.00634920634920634*G8_4_1 - 0.0317460317460318*G8_5_0 - 0.0190476190476191*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_ [...]
-    A[21] = 0.00357142857142857*G10_0_0 + 0.00357142857142858*G10_0_1 - 0.00357142857142857*G10_1_0 + 0.00436507936507936*G10_2_1 + 0.00158730158730159*G10_3_0 - 0.00634920634920631*G10_3_1 - 0.00158730158730159*G10_4_0 - 0.00793650793650796*G10_4_1 + 0.00634920634920635*G10_5_1;
-    A[22] = 0.00714285714285717*G10_0_0 + 0.00714285714285705*G10_0_1 + 0.0309523809523809*G10_1_0 - 0.00714285714285712*G10_2_1 + 0.00952380952380949*G10_3_0 + 0.0476190476190473*G10_3_1 - 0.00952380952380949*G10_4_0 - 0.0380952380952381*G10_5_0 - 0.0476190476190476*G10_5_1;
-    A[23] = -0.00436507936507936*G10_0_0 - 0.00436507936507934*G10_0_1 - 0.00357142857142857*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 - 0.00634920634920629*G10_3_1 + 0.00634920634920633*G10_4_0 + 0.00793650793650789*G10_4_1 + 0.00793650793650793*G10_5_0 + 0.00634920634920634*G10_5_1;
-    A[24] = 0.00634920634920636*G10_0_0 + 0.00634920634920634*G10_0_1 + 0.019047619047619*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 + 0.019047619047619*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.00634920634920638*G10_4_1 - 0.0253968253968254*G10_5_0 - 0.019047619047619*G10_5_1;
+    A[15] = 0.166666666666668*G0_0_0_0 + 0.166666666666666*G0_0_0_1 + 0.166666666666668*G2_0_0_0 + 0.166666666666666*G2_0_0_1 + 0.00357142857142857*G8_0_0 + 0.00357142857142858*G8_0_1 + 0.00714285714285716*G8_1_0 + 0.00714285714285705*G8_1_1 - 0.00436507936507936*G8_2_0 - 0.00436507936507934*G8_2_1 + 0.00634920634920635*G8_3_0 + 0.00634920634920634*G8_3_1 + 0.00793650793650793*G8_4_0 + 0.00793650793650798*G8_4_1 + 0.0126984126984127*G8_5_0 + 0.0126984126984127*G8_5_1 + 0.0035714285714285 [...]
+    A[16] = 0.5*G0_0_0_0 + 0.5*G2_0_0_0 - 0.00357142857142856*G8_0_0 + 0.0309523809523809*G8_1_0 - 0.00357142857142857*G8_2_0 + 0.019047619047619*G8_3_0 + 0.00476190476190477*G8_4_0 + 0.0190476190476191*G8_5_0 + 0.00714285714285716*G9_0_0 + 0.00714285714285705*G9_0_1 + 0.0309523809523809*G9_1_0 - 0.00714285714285712*G9_2_1 + 0.00952380952380949*G9_3_0 + 0.0476190476190473*G9_3_1 - 0.00952380952380949*G9_4_0 - 0.0380952380952381*G9_5_0 - 0.0476190476190476*G9_5_1 - 0.00357142857142856*G11 [...]
+    A[17] = -0.166666666666667*G0_0_0_1 - 0.166666666666667*G2_0_0_1 + 0.00436507936507936*G8_0_1 - 0.00714285714285712*G8_1_1 - 0.00357142857142857*G8_2_1 - 0.0126984126984127*G8_3_1 - 0.00793650793650795*G8_4_1 - 0.00634920634920636*G8_5_1 - 0.00436507936507936*G9_0_0 - 0.00436507936507934*G9_0_1 - 0.00357142857142857*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.00634920634920629*G9_3_1 + 0.00634920634920633*G9_4_0 + 0.0079365079365079*G9_4_1 + 0.007936507936507 [...]
+    A[18] = 0.666666666666664*G0_0_0_1 + 0.666666666666664*G2_0_0_1 + 0.00158730158730159*G8_0_0 - 0.00634920634920631*G8_0_1 + 0.00952380952380949*G8_1_0 + 0.0476190476190473*G8_1_1 - 0.00634920634920633*G8_2_0 - 0.00634920634920629*G8_2_1 - 0.0126984126984127*G8_3_0 + 0.019047619047619*G8_3_1 - 0.019047619047619*G8_4_0 - 0.00634920634920621*G8_4_1 - 0.00634920634920634*G8_5_0 + 0.019047619047619*G8_5_1 + 0.00634920634920635*G9_0_0 + 0.00634920634920634*G9_0_1 + 0.019047619047619*G9_1_0 [...]
+    A[19] = -0.00158730158730159*G8_0_0 - 0.00793650793650796*G8_0_1 - 0.00952380952380949*G8_1_0 + 0.00634920634920633*G8_2_0 + 0.0079365079365079*G8_2_1 + 0.0126984126984127*G8_3_0 + 0.00634920634920637*G8_3_1 + 0.019047619047619*G8_4_0 + 0.00634920634920634*G8_5_0 - 0.00634920634920632*G8_5_1 + 0.00793650793650793*G9_0_0 + 0.00793650793650798*G9_0_1 + 0.00476190476190477*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_0 - 0.00634920634920621*G9_3_1 + 0.019047619047619*G9_ [...]
+    A[20] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_0_1 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_0_1 + 0.00634920634920635*G8_0_1 - 0.0380952380952381*G8_1_0 - 0.0476190476190476*G8_1_1 + 0.00793650793650793*G8_2_0 + 0.00634920634920634*G8_2_1 - 0.0253968253968254*G8_3_0 - 0.019047619047619*G8_3_1 - 0.0126984126984127*G8_4_0 + 0.00634920634920634*G8_4_1 - 0.0317460317460318*G8_5_0 - 0.0190476190476191*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_ [...]
+    A[21] = 0.00357142857142857*G10_0_0 + 0.00357142857142858*G10_0_1 - 0.00357142857142856*G10_1_0 + 0.00436507936507936*G10_2_1 + 0.00158730158730159*G10_3_0 - 0.00634920634920631*G10_3_1 - 0.00158730158730159*G10_4_0 - 0.00793650793650796*G10_4_1 + 0.00634920634920635*G10_5_1;
+    A[22] = 0.00714285714285716*G10_0_0 + 0.00714285714285705*G10_0_1 + 0.0309523809523809*G10_1_0 - 0.00714285714285712*G10_2_1 + 0.00952380952380949*G10_3_0 + 0.0476190476190473*G10_3_1 - 0.00952380952380949*G10_4_0 - 0.0380952380952381*G10_5_0 - 0.0476190476190476*G10_5_1;
+    A[23] = -0.00436507936507936*G10_0_0 - 0.00436507936507934*G10_0_1 - 0.00357142857142857*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 - 0.00634920634920629*G10_3_1 + 0.00634920634920633*G10_4_0 + 0.0079365079365079*G10_4_1 + 0.00793650793650793*G10_5_0 + 0.00634920634920634*G10_5_1;
+    A[24] = 0.00634920634920635*G10_0_0 + 0.00634920634920634*G10_0_1 + 0.019047619047619*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 + 0.019047619047619*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.00634920634920637*G10_4_1 - 0.0253968253968254*G10_5_0 - 0.019047619047619*G10_5_1;
     A[25] = 0.00793650793650793*G10_0_0 + 0.00793650793650798*G10_0_1 + 0.00476190476190477*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.00634920634920621*G10_3_1 + 0.019047619047619*G10_4_0 - 0.0126984126984127*G10_5_0 + 0.00634920634920634*G10_5_1;
-    A[26] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 + 0.0190476190476191*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.019047619047619*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00634920634920631*G10_4_1 - 0.0317460317460318*G10_5_0 - 0.0190476190476191*G10_5_1;
+    A[26] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 + 0.0190476190476191*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.019047619047619*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00634920634920632*G10_4_1 - 0.0317460317460318*G10_5_0 - 0.0190476190476191*G10_5_1;
     A[27] = 0.0;
     A[28] = -0.166666666666667*G4_0;
     A[29] = 0.0;
-    A[30] = 0.166666666666666*G0_0_1_0 + 0.166666666666666*G0_0_1_1 + 0.166666666666666*G2_0_1_0 + 0.166666666666666*G2_0_1_1 + 0.00357142857142858*G8_0_0 + 0.00357142857142859*G8_0_1 - 0.00436507936507936*G8_1_0 - 0.00436507936507934*G8_1_1 + 0.00714285714285712*G8_2_0 + 0.00714285714285704*G8_2_1 + 0.00634920634920632*G8_3_0 + 0.00634920634920634*G8_3_1 + 0.0126984126984127*G8_4_0 + 0.0126984126984127*G8_4_1 + 0.00793650793650792*G8_5_0 + 0.00793650793650798*G8_5_1 + 0.0035714285714285 [...]
-    A[31] = -0.166666666666667*G0_0_1_0 - 0.166666666666667*G2_0_1_0 + 0.00436507936507937*G8_0_0 - 0.00357142857142857*G8_1_0 - 0.00714285714285716*G8_2_0 - 0.0126984126984127*G8_3_0 - 0.00634920634920635*G8_4_0 - 0.00793650793650792*G8_5_0 - 0.00436507936507936*G9_0_0 - 0.00436507936507934*G9_0_1 - 0.00357142857142857*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.00634920634920629*G9_3_1 + 0.00634920634920633*G9_4_0 + 0.00793650793650789*G9_4_1 + 0.00793650793650 [...]
-    A[32] = 0.5*G0_0_1_1 + 0.5*G2_0_1_1 - 0.00357142857142857*G8_0_1 - 0.00357142857142857*G8_1_1 + 0.030952380952381*G8_2_1 + 0.019047619047619*G8_3_1 + 0.0190476190476191*G8_4_1 + 0.00476190476190475*G8_5_1 + 0.00714285714285712*G9_0_0 + 0.00714285714285704*G9_0_1 - 0.00714285714285716*G9_1_0 + 0.030952380952381*G9_2_1 + 0.0476190476190475*G9_3_0 + 0.00952380952380924*G9_3_1 - 0.0476190476190475*G9_4_0 - 0.0380952380952379*G9_4_1 - 0.00952380952380949*G9_5_1 - 0.00357142857142857*G11_1 [...]
-    A[33] = 0.666666666666667*G0_0_1_0 + 0.666666666666667*G2_0_1_0 - 0.00634920634920634*G8_0_0 + 0.00158730158730163*G8_0_1 - 0.00634920634920633*G8_1_0 - 0.00634920634920629*G8_1_1 + 0.0476190476190475*G8_2_0 + 0.00952380952380924*G8_2_1 + 0.019047619047619*G8_3_0 - 0.0126984126984127*G8_3_1 + 0.019047619047619*G8_4_0 - 0.00634920634920638*G8_4_1 - 0.00634920634920633*G8_5_0 - 0.0190476190476189*G8_5_1 + 0.00634920634920632*G9_0_0 + 0.00634920634920634*G9_0_1 - 0.0126984126984127*G9_1 [...]
-    A[34] = -0.666666666666667*G0_0_1_0 - 0.666666666666665*G0_0_1_1 - 0.666666666666667*G2_0_1_0 - 0.666666666666665*G2_0_1_1 + 0.00634920634920634*G8_0_0 + 0.00634920634920633*G8_1_0 + 0.00793650793650789*G8_1_1 - 0.0476190476190475*G8_2_0 - 0.0380952380952379*G8_2_1 - 0.019047619047619*G8_3_0 - 0.0253968253968254*G8_3_1 - 0.019047619047619*G8_4_0 - 0.0317460317460317*G8_4_1 + 0.00634920634920633*G8_5_0 - 0.0126984126984128*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 [...]
-    A[35] = -0.00793650793650795*G8_0_0 - 0.00158730158730159*G8_0_1 + 0.00793650793650793*G8_1_0 + 0.00634920634920634*G8_1_1 - 0.00952380952380949*G8_2_1 + 0.00634920634920637*G8_3_0 + 0.0126984126984127*G8_3_1 - 0.00634920634920633*G8_4_0 + 0.00634920634920636*G8_4_1 + 0.019047619047619*G8_5_1 + 0.00793650793650792*G9_0_0 + 0.00793650793650798*G9_0_1 - 0.00793650793650792*G9_1_0 + 0.00476190476190475*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.0190476190476189*G9_3_1 + 0.00634920634920633 [...]
-    A[36] = 0.00357142857142858*G10_0_0 + 0.00357142857142859*G10_0_1 + 0.00436507936507937*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.00158730158730163*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00793650793650795*G10_5_0 - 0.00158730158730159*G10_5_1;
-    A[37] = -0.00436507936507936*G10_0_0 - 0.00436507936507934*G10_0_1 - 0.00357142857142857*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 - 0.00634920634920629*G10_3_1 + 0.00634920634920633*G10_4_0 + 0.00793650793650789*G10_4_1 + 0.00793650793650793*G10_5_0 + 0.00634920634920634*G10_5_1;
-    A[38] = 0.00714285714285712*G10_0_0 + 0.00714285714285704*G10_0_1 - 0.00714285714285716*G10_1_0 + 0.030952380952381*G10_2_1 + 0.0476190476190475*G10_3_0 + 0.00952380952380924*G10_3_1 - 0.0476190476190475*G10_4_0 - 0.0380952380952379*G10_4_1 - 0.00952380952380949*G10_5_1;
-    A[39] = 0.00634920634920632*G10_0_0 + 0.00634920634920634*G10_0_1 - 0.0126984126984127*G10_1_0 + 0.019047619047619*G10_2_1 + 0.019047619047619*G10_3_0 - 0.0126984126984127*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0253968253968254*G10_4_1 + 0.00634920634920637*G10_5_0 + 0.0126984126984127*G10_5_1;
-    A[40] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 - 0.00634920634920635*G10_1_0 + 0.0190476190476191*G10_2_1 + 0.019047619047619*G10_3_0 - 0.00634920634920638*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0317460317460317*G10_4_1 - 0.00634920634920633*G10_5_0 + 0.00634920634920636*G10_5_1;
+    A[30] = 0.166666666666666*G0_0_1_0 + 0.166666666666666*G0_0_1_1 + 0.166666666666666*G2_0_1_0 + 0.166666666666666*G2_0_1_1 + 0.00357142857142858*G8_0_0 + 0.00357142857142859*G8_0_1 - 0.00436507936507936*G8_1_0 - 0.00436507936507934*G8_1_1 + 0.00714285714285713*G8_2_0 + 0.00714285714285705*G8_2_1 + 0.00634920634920633*G8_3_0 + 0.00634920634920634*G8_3_1 + 0.0126984126984127*G8_4_0 + 0.0126984126984127*G8_4_1 + 0.00793650793650792*G8_5_0 + 0.00793650793650798*G8_5_1 + 0.0035714285714285 [...]
+    A[31] = -0.166666666666667*G0_0_1_0 - 0.166666666666667*G2_0_1_0 + 0.00436507936507937*G8_0_0 - 0.00357142857142857*G8_1_0 - 0.00714285714285715*G8_2_0 - 0.0126984126984127*G8_3_0 - 0.00634920634920635*G8_4_0 - 0.00793650793650792*G8_5_0 - 0.00436507936507936*G9_0_0 - 0.00436507936507934*G9_0_1 - 0.00357142857142857*G9_1_0 - 0.00357142857142857*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.00634920634920629*G9_3_1 + 0.00634920634920633*G9_4_0 + 0.0079365079365079*G9_4_1 + 0.007936507936507 [...]
+    A[32] = 0.5*G0_0_1_1 + 0.5*G2_0_1_1 - 0.00357142857142857*G8_0_1 - 0.00357142857142857*G8_1_1 + 0.030952380952381*G8_2_1 + 0.019047619047619*G8_3_1 + 0.0190476190476191*G8_4_1 + 0.00476190476190475*G8_5_1 + 0.00714285714285713*G9_0_0 + 0.00714285714285705*G9_0_1 - 0.00714285714285715*G9_1_0 + 0.030952380952381*G9_2_1 + 0.0476190476190475*G9_3_0 + 0.00952380952380926*G9_3_1 - 0.0476190476190475*G9_4_0 - 0.0380952380952379*G9_4_1 - 0.00952380952380948*G9_5_1 - 0.00357142857142857*G11_1 [...]
+    A[33] = 0.666666666666667*G0_0_1_0 + 0.666666666666667*G2_0_1_0 - 0.00634920634920634*G8_0_0 + 0.00158730158730162*G8_0_1 - 0.00634920634920633*G8_1_0 - 0.00634920634920629*G8_1_1 + 0.0476190476190475*G8_2_0 + 0.00952380952380926*G8_2_1 + 0.019047619047619*G8_3_0 - 0.0126984126984127*G8_3_1 + 0.019047619047619*G8_4_0 - 0.00634920634920638*G8_4_1 - 0.00634920634920633*G8_5_0 - 0.0190476190476189*G8_5_1 + 0.00634920634920633*G9_0_0 + 0.00634920634920634*G9_0_1 - 0.0126984126984127*G9_1 [...]
+    A[34] = -0.666666666666667*G0_0_1_0 - 0.666666666666665*G0_0_1_1 - 0.666666666666667*G2_0_1_0 - 0.666666666666665*G2_0_1_1 + 0.00634920634920634*G8_0_0 + 0.00634920634920633*G8_1_0 + 0.0079365079365079*G8_1_1 - 0.0476190476190475*G8_2_0 - 0.0380952380952379*G8_2_1 - 0.019047619047619*G8_3_0 - 0.0253968253968254*G8_3_1 - 0.019047619047619*G8_4_0 - 0.0317460317460317*G8_4_1 + 0.00634920634920633*G8_5_0 - 0.0126984126984128*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1  [...]
+    A[35] = -0.00793650793650795*G8_0_0 - 0.00158730158730159*G8_0_1 + 0.00793650793650793*G8_1_0 + 0.00634920634920634*G8_1_1 - 0.00952380952380948*G8_2_1 + 0.00634920634920635*G8_3_0 + 0.0126984126984127*G8_3_1 - 0.00634920634920635*G8_4_0 + 0.00634920634920636*G8_4_1 + 0.019047619047619*G8_5_1 + 0.00793650793650792*G9_0_0 + 0.00793650793650798*G9_0_1 - 0.00793650793650792*G9_1_0 + 0.00476190476190475*G9_2_1 - 0.00634920634920633*G9_3_0 - 0.0190476190476189*G9_3_1 + 0.00634920634920633 [...]
+    A[36] = 0.00357142857142858*G10_0_0 + 0.00357142857142859*G10_0_1 + 0.00436507936507937*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.00158730158730162*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00793650793650795*G10_5_0 - 0.00158730158730159*G10_5_1;
+    A[37] = -0.00436507936507936*G10_0_0 - 0.00436507936507934*G10_0_1 - 0.00357142857142857*G10_1_0 - 0.00357142857142857*G10_2_1 - 0.00634920634920633*G10_3_0 - 0.00634920634920629*G10_3_1 + 0.00634920634920633*G10_4_0 + 0.0079365079365079*G10_4_1 + 0.00793650793650793*G10_5_0 + 0.00634920634920634*G10_5_1;
+    A[38] = 0.00714285714285713*G10_0_0 + 0.00714285714285705*G10_0_1 - 0.00714285714285715*G10_1_0 + 0.030952380952381*G10_2_1 + 0.0476190476190475*G10_3_0 + 0.00952380952380926*G10_3_1 - 0.0476190476190475*G10_4_0 - 0.0380952380952379*G10_4_1 - 0.00952380952380948*G10_5_1;
+    A[39] = 0.00634920634920633*G10_0_0 + 0.00634920634920634*G10_0_1 - 0.0126984126984127*G10_1_0 + 0.019047619047619*G10_2_1 + 0.019047619047619*G10_3_0 - 0.0126984126984127*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0253968253968254*G10_4_1 + 0.00634920634920635*G10_5_0 + 0.0126984126984127*G10_5_1;
+    A[40] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 - 0.00634920634920635*G10_1_0 + 0.0190476190476191*G10_2_1 + 0.019047619047619*G10_3_0 - 0.00634920634920638*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0317460317460317*G10_4_1 - 0.00634920634920635*G10_5_0 + 0.00634920634920636*G10_5_1;
     A[41] = 0.00793650793650792*G10_0_0 + 0.00793650793650798*G10_0_1 - 0.00793650793650792*G10_1_0 + 0.00476190476190475*G10_2_1 - 0.00634920634920632*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.00634920634920632*G10_4_0 - 0.0126984126984128*G10_4_1 + 0.019047619047619*G10_5_1;
     A[42] = 0.0;
     A[43] = 0.0;
     A[44] = -0.166666666666667*G4_1;
-    A[45] = -0.00476190476190477*G8_0_0 - 0.00476190476190471*G8_0_1 + 0.00634920634920636*G8_1_0 + 0.00634920634920634*G8_1_1 + 0.00634920634920632*G8_2_0 + 0.00634920634920634*G8_2_1 + 0.0380952380952381*G8_3_0 + 0.0380952380952376*G8_3_1 - 0.00634920634920632*G8_4_0 - 0.00634920634920656*G8_4_1 - 0.00634920634920629*G8_5_0 - 0.00634920634920655*G8_5_1 - 0.00476190476190477*G9_0_0 - 0.00476190476190471*G9_0_1 - 0.00793650793650793*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619 [...]
-    A[46] = 0.666666666666664*G0_0_1_0 + 0.666666666666664*G2_0_1_0 - 0.00793650793650793*G8_0_0 + 0.019047619047619*G8_1_0 - 0.0126984126984127*G8_2_0 + 0.0634920634920634*G8_3_0 + 0.00634920634920632*G8_4_0 + 0.0317460317460317*G8_5_0 + 0.00634920634920636*G9_0_0 + 0.00634920634920634*G9_0_1 + 0.019047619047619*G9_1_0 - 0.0126984126984127*G9_2_1 - 0.0126984126984127*G9_3_0 + 0.019047619047619*G9_3_1 + 0.0126984126984127*G9_4_0 + 0.00634920634920638*G9_4_1 - 0.0253968253968254*G9_5_0 -  [...]
-    A[47] = 0.666666666666667*G0_0_0_1 + 0.666666666666667*G2_0_0_1 - 0.00793650793650795*G8_0_1 - 0.0126984126984127*G8_1_1 + 0.019047619047619*G8_2_1 + 0.0634920634920636*G8_3_1 + 0.0317460317460318*G8_4_1 + 0.00634920634920641*G8_5_1 + 0.00634920634920632*G9_0_0 + 0.00634920634920634*G9_0_1 - 0.0126984126984127*G9_1_0 + 0.019047619047619*G9_2_1 + 0.019047619047619*G9_3_0 - 0.0126984126984127*G9_3_1 - 0.019047619047619*G9_4_0 - 0.0253968253968254*G9_4_1 + 0.00634920634920637*G9_5_0 + 0 [...]
+    A[45] = -0.00476190476190477*G8_0_0 - 0.00476190476190471*G8_0_1 + 0.00634920634920635*G8_1_0 + 0.00634920634920634*G8_1_1 + 0.00634920634920633*G8_2_0 + 0.00634920634920634*G8_2_1 + 0.0380952380952381*G8_3_0 + 0.0380952380952376*G8_3_1 - 0.00634920634920632*G8_4_0 - 0.00634920634920656*G8_4_1 - 0.00634920634920629*G8_5_0 - 0.00634920634920655*G8_5_1 - 0.00476190476190477*G9_0_0 - 0.00476190476190471*G9_0_1 - 0.00793650793650794*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619 [...]
+    A[46] = 0.666666666666664*G0_0_1_0 + 0.666666666666664*G2_0_1_0 - 0.00793650793650794*G8_0_0 + 0.019047619047619*G8_1_0 - 0.0126984126984127*G8_2_0 + 0.0634920634920634*G8_3_0 + 0.00634920634920632*G8_4_0 + 0.0317460317460317*G8_5_0 + 0.00634920634920635*G9_0_0 + 0.00634920634920634*G9_0_1 + 0.019047619047619*G9_1_0 - 0.0126984126984127*G9_2_1 - 0.0126984126984127*G9_3_0 + 0.019047619047619*G9_3_1 + 0.0126984126984127*G9_4_0 + 0.00634920634920637*G9_4_1 - 0.0253968253968254*G9_5_0 -  [...]
+    A[47] = 0.666666666666667*G0_0_0_1 + 0.666666666666667*G2_0_0_1 - 0.00793650793650795*G8_0_1 - 0.0126984126984127*G8_1_1 + 0.019047619047619*G8_2_1 + 0.0634920634920636*G8_3_1 + 0.0317460317460318*G8_4_1 + 0.00634920634920641*G8_5_1 + 0.00634920634920633*G9_0_0 + 0.00634920634920634*G9_0_1 - 0.0126984126984127*G9_1_0 + 0.019047619047619*G9_2_1 + 0.019047619047619*G9_3_0 - 0.0126984126984127*G9_3_1 - 0.019047619047619*G9_4_0 - 0.0253968253968254*G9_4_1 + 0.00634920634920635*G9_5_0 + 0 [...]
     A[48] = 1.33333333333333*G0_0_0_0 + 0.666666666666656*G0_0_0_1 + 0.666666666666656*G0_0_1_0 + 1.33333333333332*G0_0_1_1 + 1.33333333333333*G2_0_0_0 + 0.666666666666656*G2_0_0_1 + 0.666666666666656*G2_0_1_0 + 1.33333333333332*G2_0_1_1 - 0.019047619047619*G8_0_0 - 0.0190476190476189*G8_0_1 - 0.0126984126984127*G8_1_0 + 0.019047619047619*G8_1_1 + 0.019047619047619*G8_2_0 - 0.0126984126984127*G8_2_1 + 0.152380952380952*G8_3_0 + 0.152380952380951*G8_3_1 + 0.076190476190476*G8_4_0 + 0.0507 [...]
-    A[49] = -1.33333333333333*G0_0_0_0 - 0.666666666666659*G0_0_0_1 - 0.666666666666656*G0_0_1_0 - 1.33333333333333*G2_0_0_0 - 0.666666666666659*G2_0_0_1 - 0.666666666666656*G2_0_1_0 + 0.019047619047619*G8_0_0 + 0.0126984126984126*G8_0_1 + 0.0126984126984127*G8_1_0 + 0.00634920634920638*G8_1_1 - 0.019047619047619*G8_2_0 - 0.0253968253968254*G8_2_1 - 0.152380952380952*G8_3_0 - 0.101587301587301*G8_3_1 - 0.076190476190476*G8_4_0 - 0.025396825396825*G8_4_1 - 0.0507936507936507*G8_5_0 - 0.00 [...]
-    A[50] = -0.666666666666665*G0_0_0_1 - 0.666666666666666*G0_0_1_0 - 1.33333333333332*G0_0_1_1 - 0.666666666666665*G2_0_0_1 - 0.666666666666666*G2_0_1_0 - 1.33333333333332*G2_0_1_1 + 0.0126984126984127*G8_0_0 + 0.019047619047619*G8_0_1 - 0.0253968253968254*G8_1_0 - 0.019047619047619*G8_1_1 + 0.00634920634920637*G8_2_0 + 0.0126984126984127*G8_2_1 - 0.101587301587302*G8_3_0 - 0.152380952380952*G8_3_1 - 0.0507936507936508*G8_4_1 - 0.0253968253968254*G8_5_0 - 0.0761904761904762*G8_5_1 - 0. [...]
+    A[49] = -1.33333333333333*G0_0_0_0 - 0.666666666666659*G0_0_0_1 - 0.666666666666656*G0_0_1_0 - 1.33333333333333*G2_0_0_0 - 0.666666666666659*G2_0_0_1 - 0.666666666666656*G2_0_1_0 + 0.019047619047619*G8_0_0 + 0.0126984126984126*G8_0_1 + 0.0126984126984127*G8_1_0 + 0.00634920634920637*G8_1_1 - 0.019047619047619*G8_2_0 - 0.0253968253968254*G8_2_1 - 0.152380952380952*G8_3_0 - 0.101587301587301*G8_3_1 - 0.076190476190476*G8_4_0 - 0.025396825396825*G8_4_1 - 0.0507936507936507*G8_5_0 - 0.00 [...]
+    A[50] = -0.666666666666665*G0_0_0_1 - 0.666666666666666*G0_0_1_0 - 1.33333333333332*G0_0_1_1 - 0.666666666666665*G2_0_0_1 - 0.666666666666666*G2_0_1_0 - 1.33333333333332*G2_0_1_1 + 0.0126984126984127*G8_0_0 + 0.019047619047619*G8_0_1 - 0.0253968253968254*G8_1_0 - 0.019047619047619*G8_1_1 + 0.00634920634920635*G8_2_0 + 0.0126984126984127*G8_2_1 - 0.101587301587302*G8_3_0 - 0.152380952380952*G8_3_1 - 0.0507936507936508*G8_4_1 - 0.0253968253968254*G8_5_0 - 0.0761904761904762*G8_5_1 - 0. [...]
     A[51] = -0.00476190476190477*G10_0_0 - 0.00476190476190471*G10_0_1 - 0.00793650793650793*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.019047619047619*G10_4_0 + 0.0126984126984126*G10_4_1 + 0.0126984126984127*G10_5_0 + 0.019047619047619*G10_5_1;
-    A[52] = 0.00634920634920636*G10_0_0 + 0.00634920634920634*G10_0_1 + 0.019047619047619*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 + 0.019047619047619*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.00634920634920638*G10_4_1 - 0.0253968253968254*G10_5_0 - 0.019047619047619*G10_5_1;
-    A[53] = 0.00634920634920633*G10_0_0 + 0.00634920634920634*G10_0_1 - 0.0126984126984127*G10_1_0 + 0.019047619047619*G10_2_1 + 0.019047619047619*G10_3_0 - 0.0126984126984127*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0253968253968254*G10_4_1 + 0.00634920634920637*G10_5_0 + 0.0126984126984127*G10_5_1;
+    A[52] = 0.00634920634920635*G10_0_0 + 0.00634920634920634*G10_0_1 + 0.019047619047619*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 + 0.019047619047619*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.00634920634920637*G10_4_1 - 0.0253968253968254*G10_5_0 - 0.019047619047619*G10_5_1;
+    A[53] = 0.00634920634920633*G10_0_0 + 0.00634920634920634*G10_0_1 - 0.0126984126984127*G10_1_0 + 0.019047619047619*G10_2_1 + 0.019047619047619*G10_3_0 - 0.0126984126984127*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0253968253968254*G10_4_1 + 0.00634920634920635*G10_5_0 + 0.0126984126984127*G10_5_1;
     A[54] = 0.0380952380952381*G10_0_0 + 0.0380952380952376*G10_0_1 + 0.0634920634920634*G10_1_0 + 0.0634920634920636*G10_2_1 + 0.152380952380952*G10_3_0 + 0.152380952380951*G10_3_1 - 0.152380952380952*G10_4_0 - 0.101587301587301*G10_4_1 - 0.101587301587302*G10_5_0 - 0.152380952380952*G10_5_1;
     A[55] = -0.00634920634920632*G10_0_0 - 0.00634920634920656*G10_0_1 + 0.00634920634920632*G10_1_0 + 0.0317460317460318*G10_2_1 + 0.076190476190476*G10_3_0 + 0.0507936507936502*G10_3_1 - 0.076190476190476*G10_4_0 - 0.025396825396825*G10_4_1 - 0.0507936507936508*G10_5_1;
     A[56] = -0.00634920634920629*G10_0_0 - 0.00634920634920655*G10_0_1 + 0.0317460317460317*G10_1_0 + 0.00634920634920641*G10_2_1 + 0.0507936507936507*G10_3_0 + 0.0761904761904756*G10_3_1 - 0.0507936507936507*G10_4_0 - 0.0253968253968254*G10_5_0 - 0.0761904761904762*G10_5_1;
     A[57] = -0.166666666666666*G4_0 - 0.166666666666665*G4_1;
     A[58] = -0.166666666666666*G4_0 - 0.333333333333331*G4_1;
     A[59] = -0.333333333333333*G4_0 - 0.166666666666664*G4_1;
-    A[60] = -0.666666666666668*G0_0_1_0 - 0.666666666666668*G0_0_1_1 - 0.666666666666668*G2_0_1_0 - 0.666666666666668*G2_0_1_1 - 0.0190476190476191*G8_0_0 - 0.0190476190476191*G8_0_1 + 0.00793650793650793*G8_1_0 + 0.00793650793650798*G8_1_1 + 0.0126984126984127*G8_2_0 + 0.0126984126984127*G8_2_1 - 0.00634920634920632*G8_3_0 - 0.00634920634920656*G8_3_1 - 0.0634920634920635*G8_4_0 - 0.0634920634920639*G8_4_1 - 0.0317460317460317*G8_5_0 - 0.031746031746032*G8_5_1 - 0.0190476190476191*G9_0_ [...]
-    A[61] = -0.00634920634920637*G8_0_0 + 0.00476190476190477*G8_1_0 - 0.00634920634920635*G8_2_0 + 0.00634920634920632*G8_3_0 - 0.0380952380952382*G8_4_0 + 0.0063492063492063*G8_5_0 + 0.00793650793650793*G9_0_0 + 0.00793650793650798*G9_0_1 + 0.00476190476190477*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_0 - 0.00634920634920621*G9_3_1 + 0.019047619047619*G9_4_0 - 0.0126984126984127*G9_5_0 + 0.00634920634920634*G9_5_1 - 0.00634920634920637*G11_0_6 + 0.00476190476190477*G [...]
-    A[62] = -0.666666666666667*G0_0_0_1 - 0.666666666666665*G0_0_1_1 - 0.666666666666667*G2_0_0_1 - 0.666666666666665*G2_0_1_1 - 0.0126984126984127*G8_0_1 - 0.00793650793650795*G8_1_1 + 0.0190476190476191*G8_2_1 + 0.0317460317460318*G8_3_1 + 0.0634920634920636*G8_4_1 + 0.00634920634920641*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 - 0.00634920634920635*G9_1_0 + 0.0190476190476191*G9_2_1 + 0.019047619047619*G9_3_0 - 0.00634920634920638*G9_3_1 - 0.019047619047619*G9_4_0 [...]
-    A[63] = -1.33333333333333*G0_0_0_0 - 0.666666666666656*G0_0_0_1 - 0.666666666666659*G0_0_1_0 - 1.33333333333333*G2_0_0_0 - 0.666666666666656*G2_0_0_1 - 0.666666666666659*G2_0_1_0 - 0.0126984126984127*G8_0_0 - 0.00634920634920632*G8_0_1 - 0.019047619047619*G8_1_0 - 0.00634920634920621*G8_1_1 + 0.019047619047619*G8_2_0 - 0.00634920634920638*G8_2_1 + 0.076190476190476*G8_3_0 + 0.0507936507936502*G8_3_1 + 0.152380952380952*G8_4_0 + 0.0507936507936496*G8_4_1 + 0.0507936507936507*G8_5_0 +  [...]
+    A[60] = -0.666666666666668*G0_0_1_0 - 0.666666666666668*G0_0_1_1 - 0.666666666666668*G2_0_1_0 - 0.666666666666668*G2_0_1_1 - 0.0190476190476191*G8_0_0 - 0.0190476190476191*G8_0_1 + 0.00793650793650793*G8_1_0 + 0.00793650793650798*G8_1_1 + 0.0126984126984127*G8_2_0 + 0.0126984126984127*G8_2_1 - 0.00634920634920632*G8_3_0 - 0.00634920634920656*G8_3_1 - 0.0634920634920635*G8_4_0 - 0.0634920634920639*G8_4_1 - 0.0317460317460317*G8_5_0 - 0.0317460317460319*G8_5_1 - 0.0190476190476191*G9_0 [...]
+    A[61] = -0.00634920634920638*G8_0_0 + 0.00476190476190477*G8_1_0 - 0.00634920634920635*G8_2_0 + 0.00634920634920632*G8_3_0 - 0.0380952380952382*G8_4_0 + 0.0063492063492063*G8_5_0 + 0.00793650793650793*G9_0_0 + 0.00793650793650798*G9_0_1 + 0.00476190476190477*G9_1_0 - 0.00793650793650795*G9_2_1 - 0.019047619047619*G9_3_0 - 0.00634920634920621*G9_3_1 + 0.019047619047619*G9_4_0 - 0.0126984126984127*G9_5_0 + 0.00634920634920634*G9_5_1 - 0.00634920634920638*G11_0_6 + 0.00476190476190477*G [...]
+    A[62] = -0.666666666666667*G0_0_0_1 - 0.666666666666665*G0_0_1_1 - 0.666666666666667*G2_0_0_1 - 0.666666666666665*G2_0_1_1 - 0.0126984126984127*G8_0_1 - 0.00793650793650795*G8_1_1 + 0.0190476190476191*G8_2_1 + 0.0317460317460318*G8_3_1 + 0.0634920634920636*G8_4_1 + 0.00634920634920641*G8_5_1 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 - 0.00634920634920635*G9_1_0 + 0.0190476190476191*G9_2_1 + 0.019047619047619*G9_3_0 - 0.00634920634920637*G9_3_1 - 0.019047619047619*G9_4_0 [...]
+    A[63] = -1.33333333333333*G0_0_0_0 - 0.666666666666656*G0_0_0_1 - 0.666666666666659*G0_0_1_0 - 1.33333333333333*G2_0_0_0 - 0.666666666666656*G2_0_0_1 - 0.666666666666659*G2_0_1_0 - 0.0126984126984127*G8_0_0 - 0.00634920634920631*G8_0_1 - 0.019047619047619*G8_1_0 - 0.00634920634920621*G8_1_1 + 0.019047619047619*G8_2_0 - 0.00634920634920637*G8_2_1 + 0.076190476190476*G8_3_0 + 0.0507936507936502*G8_3_1 + 0.152380952380952*G8_4_0 + 0.0507936507936496*G8_4_1 + 0.0507936507936507*G8_5_0 +  [...]
     A[64] = 1.33333333333333*G0_0_0_0 + 0.666666666666659*G0_0_0_1 + 0.666666666666659*G0_0_1_0 + 1.33333333333333*G0_0_1_1 + 1.33333333333333*G2_0_0_0 + 0.666666666666659*G2_0_0_1 + 0.666666666666659*G2_0_1_0 + 1.33333333333333*G2_0_1_1 + 0.0126984126984127*G8_0_0 + 0.0317460317460317*G8_0_1 + 0.019047619047619*G8_1_0 - 0.019047619047619*G8_2_0 - 0.0317460317460317*G8_2_1 - 0.076190476190476*G8_3_0 - 0.025396825396825*G8_3_1 - 0.152380952380952*G8_4_0 - 0.0507936507936507*G8_5_0 + 0.025 [...]
-    A[65] = 0.666666666666665*G0_0_0_1 + 0.666666666666666*G0_0_1_0 + 0.666666666666665*G2_0_0_1 + 0.666666666666666*G2_0_1_0 + 0.0253968253968254*G8_0_0 + 0.00634920634920635*G8_0_1 - 0.0126984126984127*G8_1_0 + 0.00634920634920634*G8_1_1 - 0.00634920634920633*G8_2_0 + 0.00634920634920636*G8_2_1 - 0.0507936507936508*G8_3_1 + 0.101587301587302*G8_4_0 - 0.0507936507936507*G8_4_1 + 0.0253968253968254*G8_5_0 - 0.0507936507936508*G8_5_1 - 0.0317460317460317*G9_0_0 - 0.031746031746032*G9_0_1  [...]
-    A[66] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.00634920634920637*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 - 0.00634920634920632*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.0317460317460317*G10_4_1 + 0.0253968253968254*G10_5_0 + 0.00634920634920635*G10_5_1;
+    A[65] = 0.666666666666665*G0_0_0_1 + 0.666666666666666*G0_0_1_0 + 0.666666666666665*G2_0_0_1 + 0.666666666666666*G2_0_1_0 + 0.0253968253968254*G8_0_0 + 0.00634920634920635*G8_0_1 - 0.0126984126984127*G8_1_0 + 0.00634920634920634*G8_1_1 - 0.00634920634920635*G8_2_0 + 0.00634920634920636*G8_2_1 - 0.0507936507936508*G8_3_1 + 0.101587301587302*G8_4_0 - 0.0507936507936507*G8_4_1 + 0.0253968253968254*G8_5_0 - 0.0507936507936508*G8_5_1 - 0.0317460317460317*G9_0_0 - 0.0317460317460319*G9_0_1 [...]
+    A[66] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.00634920634920638*G10_1_0 - 0.0126984126984127*G10_2_1 - 0.0126984126984127*G10_3_0 - 0.00634920634920631*G10_3_1 + 0.0126984126984127*G10_4_0 + 0.0317460317460317*G10_4_1 + 0.0253968253968254*G10_5_0 + 0.00634920634920635*G10_5_1;
     A[67] = 0.00793650793650793*G10_0_0 + 0.00793650793650798*G10_0_1 + 0.00476190476190477*G10_1_0 - 0.00793650793650795*G10_2_1 - 0.019047619047619*G10_3_0 - 0.00634920634920621*G10_3_1 + 0.019047619047619*G10_4_0 - 0.0126984126984127*G10_5_0 + 0.00634920634920634*G10_5_1;
-    A[68] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 - 0.00634920634920635*G10_1_0 + 0.0190476190476191*G10_2_1 + 0.019047619047619*G10_3_0 - 0.00634920634920638*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0317460317460317*G10_4_1 - 0.00634920634920633*G10_5_0 + 0.00634920634920636*G10_5_1;
+    A[68] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 - 0.00634920634920634*G10_1_0 + 0.0190476190476191*G10_2_1 + 0.019047619047619*G10_3_0 - 0.00634920634920637*G10_3_1 - 0.019047619047619*G10_4_0 - 0.0317460317460317*G10_4_1 - 0.00634920634920635*G10_5_0 + 0.00634920634920636*G10_5_1;
     A[69] = -0.00634920634920632*G10_0_0 - 0.00634920634920656*G10_0_1 + 0.00634920634920632*G10_1_0 + 0.0317460317460318*G10_2_1 + 0.076190476190476*G10_3_0 + 0.0507936507936502*G10_3_1 - 0.076190476190476*G10_4_0 - 0.025396825396825*G10_4_1 - 0.0507936507936508*G10_5_1;
     A[70] = -0.0634920634920635*G10_0_0 - 0.0634920634920639*G10_0_1 - 0.0380952380952382*G10_1_0 + 0.0634920634920636*G10_2_1 + 0.152380952380952*G10_3_0 + 0.0507936507936496*G10_3_1 - 0.152380952380952*G10_4_0 + 0.101587301587302*G10_5_0 - 0.0507936507936507*G10_5_1;
     A[71] = -0.0317460317460317*G10_0_0 - 0.0317460317460319*G10_0_1 + 0.0063492063492063*G10_1_0 + 0.00634920634920641*G10_2_1 + 0.0507936507936507*G10_3_0 + 0.0507936507936502*G10_3_1 - 0.0507936507936507*G10_4_0 + 0.0253968253968258*G10_4_1 + 0.0253968253968254*G10_5_0 - 0.0507936507936508*G10_5_1;
@@ -48995,13 +50165,13 @@ public:
     A[73] = 0.166666666666666*G4_0;
     A[74] = 0.333333333333333*G4_0 + 0.166666666666665*G4_1;
     A[75] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_0_1 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_0_1 - 0.0190476190476191*G8_0_0 - 0.0190476190476191*G8_0_1 + 0.0126984126984127*G8_1_0 + 0.0126984126984127*G8_1_1 + 0.00793650793650792*G8_2_0 + 0.00793650793650798*G8_2_1 - 0.00634920634920629*G8_3_0 - 0.00634920634920655*G8_3_1 - 0.0317460317460317*G8_4_0 - 0.0317460317460319*G8_4_1 - 0.0634920634920634*G8_5_0 - 0.0634920634920639*G8_5_1 - 0.0190476190476191*G9_0 [...]
-    A[76] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_1_0 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_1_0 - 0.0126984126984127*G8_0_0 + 0.0190476190476191*G8_1_0 - 0.00793650793650792*G8_2_0 + 0.0317460317460317*G8_3_0 + 0.0063492063492063*G8_4_0 + 0.0634920634920634*G8_5_0 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 + 0.0190476190476191*G9_1_0 - 0.00634920634920636*G9_2_1 - 0.00634920634920634*G9_3_0 + 0.019047619047619*G9_3_1 + 0.00634920634920634*G9_4_ [...]
+    A[76] = -0.666666666666668*G0_0_0_0 - 0.666666666666667*G0_0_1_0 - 0.666666666666668*G2_0_0_0 - 0.666666666666667*G2_0_1_0 - 0.0126984126984127*G8_0_0 + 0.0190476190476191*G8_1_0 - 0.00793650793650792*G8_2_0 + 0.0317460317460317*G8_3_0 + 0.0063492063492063*G8_4_0 + 0.0634920634920634*G8_5_0 + 0.0126984126984127*G9_0_0 + 0.0126984126984127*G9_0_1 + 0.0190476190476191*G9_1_0 - 0.00634920634920636*G9_2_1 - 0.00634920634920634*G9_3_0 + 0.019047619047619*G9_3_1 + 0.00634920634920634*G9_4_ [...]
     A[77] = -0.00634920634920636*G8_0_1 - 0.00634920634920636*G8_1_1 + 0.00476190476190475*G8_2_1 + 0.00634920634920641*G8_3_1 + 0.00634920634920641*G8_4_1 - 0.038095238095238*G8_5_1 + 0.00793650793650792*G9_0_0 + 0.00793650793650798*G9_0_1 - 0.00793650793650792*G9_1_0 + 0.00476190476190475*G9_2_1 - 0.00634920634920632*G9_3_0 - 0.0190476190476189*G9_3_1 + 0.00634920634920632*G9_4_0 - 0.0126984126984128*G9_4_1 + 0.019047619047619*G9_5_1 - 0.00634920634920636*G11_1_6 - 0.00634920634920636* [...]
     A[78] = -0.666666666666666*G0_0_0_1 - 0.666666666666665*G0_0_1_0 - 1.33333333333332*G0_0_1_1 - 0.666666666666666*G2_0_0_1 - 0.666666666666665*G2_0_1_0 - 1.33333333333332*G2_0_1_1 - 0.00634920634920634*G8_0_0 - 0.0126984126984127*G8_0_1 - 0.00634920634920634*G8_1_0 + 0.019047619047619*G8_1_1 - 0.00634920634920632*G8_2_0 - 0.0190476190476189*G8_2_1 + 0.0507936507936507*G8_3_0 + 0.0761904761904756*G8_3_1 + 0.0507936507936507*G8_4_0 + 0.0507936507936502*G8_4_1 + 0.0507936507936507*G8_5_0 [...]
-    A[79] = 0.666666666666666*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 0.666666666666666*G2_0_0_1 + 0.666666666666665*G2_0_1_0 + 0.00634920634920634*G8_0_0 + 0.0253968253968254*G8_0_1 + 0.00634920634920634*G8_1_0 - 0.00634920634920631*G8_1_1 + 0.00634920634920632*G8_2_0 - 0.0126984126984128*G8_2_1 - 0.0507936507936507*G8_3_0 - 0.0507936507936507*G8_4_0 + 0.0253968253968258*G8_4_1 - 0.0507936507936507*G8_5_0 + 0.101587301587302*G8_5_1 - 0.0317460317460317*G9_0_0 - 0.0317460317460319*G9_0_1 [...]
+    A[79] = 0.666666666666666*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 0.666666666666666*G2_0_0_1 + 0.666666666666665*G2_0_1_0 + 0.00634920634920634*G8_0_0 + 0.0253968253968254*G8_0_1 + 0.00634920634920634*G8_1_0 - 0.00634920634920632*G8_1_1 + 0.00634920634920632*G8_2_0 - 0.0126984126984128*G8_2_1 - 0.0507936507936507*G8_3_0 - 0.0507936507936507*G8_4_0 + 0.0253968253968258*G8_4_1 - 0.0507936507936507*G8_5_0 + 0.101587301587302*G8_5_1 - 0.0317460317460317*G9_0_0 - 0.0317460317460319*G9_0_1 [...]
     A[80] = 1.33333333333334*G0_0_0_0 + 0.666666666666668*G0_0_0_1 + 0.666666666666668*G0_0_1_0 + 1.33333333333333*G0_0_1_1 + 1.33333333333334*G2_0_0_0 + 0.666666666666668*G2_0_0_1 + 0.666666666666668*G2_0_1_0 + 1.33333333333333*G2_0_1_1 + 0.0317460317460318*G8_0_0 + 0.0126984126984127*G8_0_1 - 0.0317460317460318*G8_1_0 - 0.0190476190476191*G8_1_1 + 0.019047619047619*G8_2_1 - 0.0253968253968254*G8_3_0 - 0.0761904761904762*G8_3_1 + 0.0253968253968254*G8_4_0 - 0.0507936507936508*G8_4_1 - 0 [...]
     A[81] = -0.0190476190476191*G10_0_0 - 0.0190476190476191*G10_0_1 - 0.0126984126984127*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 - 0.0126984126984127*G10_3_1 + 0.00634920634920634*G10_4_0 + 0.0253968253968254*G10_4_1 + 0.0317460317460318*G10_5_0 + 0.0126984126984127*G10_5_1;
-    A[82] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 + 0.0190476190476191*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.019047619047619*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00634920634920631*G10_4_1 - 0.0317460317460318*G10_5_0 - 0.0190476190476191*G10_5_1;
+    A[82] = 0.0126984126984127*G10_0_0 + 0.0126984126984127*G10_0_1 + 0.0190476190476191*G10_1_0 - 0.00634920634920636*G10_2_1 - 0.00634920634920634*G10_3_0 + 0.019047619047619*G10_3_1 + 0.00634920634920634*G10_4_0 - 0.00634920634920632*G10_4_1 - 0.0317460317460318*G10_5_0 - 0.0190476190476191*G10_5_1;
     A[83] = 0.00793650793650792*G10_0_0 + 0.00793650793650798*G10_0_1 - 0.00793650793650792*G10_1_0 + 0.00476190476190475*G10_2_1 - 0.00634920634920632*G10_3_0 - 0.0190476190476189*G10_3_1 + 0.00634920634920632*G10_4_0 - 0.0126984126984128*G10_4_1 + 0.019047619047619*G10_5_1;
     A[84] = -0.00634920634920629*G10_0_0 - 0.00634920634920655*G10_0_1 + 0.0317460317460317*G10_1_0 + 0.00634920634920641*G10_2_1 + 0.0507936507936507*G10_3_0 + 0.0761904761904756*G10_3_1 - 0.0507936507936507*G10_4_0 - 0.0253968253968254*G10_5_0 - 0.0761904761904762*G10_5_1;
     A[85] = -0.0317460317460317*G10_0_0 - 0.0317460317460319*G10_0_1 + 0.0063492063492063*G10_1_0 + 0.00634920634920641*G10_2_1 + 0.0507936507936507*G10_3_0 + 0.0507936507936502*G10_3_1 - 0.0507936507936507*G10_4_0 + 0.0253968253968258*G10_4_1 + 0.0253968253968254*G10_5_0 - 0.0507936507936508*G10_5_1;
@@ -49009,103 +50179,103 @@ public:
     A[87] = -0.166666666666667*G4_0 + 0.166666666666667*G4_1;
     A[88] = 0.166666666666667*G4_0 + 0.333333333333333*G4_1;
     A[89] = 0.166666666666667*G4_1;
-    A[90] = -0.030952380952381*G13_6_0 - 0.030952380952381*G13_6_1 - 0.00714285714285718*G13_7_0 - 0.00714285714285714*G13_8_1 + 0.0095238095238095*G13_9_0 + 0.00952380952380933*G13_9_1 - 0.0095238095238095*G13_10_0 + 0.0380952380952383*G13_10_1 + 0.0380952380952381*G13_11_0 - 0.00952380952380951*G13_11_1;
-    A[91] = 0.00357142857142856*G13_6_0 + 0.00357142857142858*G13_6_1 - 0.00357142857142857*G13_7_0 + 0.00436507936507936*G13_8_1 + 0.00158730158730159*G13_9_0 - 0.00634920634920631*G13_9_1 - 0.00158730158730159*G13_10_0 - 0.00793650793650796*G13_10_1 + 0.00634920634920635*G13_11_1;
-    A[92] = 0.00357142857142858*G13_6_0 + 0.00357142857142859*G13_6_1 + 0.00436507936507937*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.00158730158730163*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00793650793650795*G13_11_0 - 0.00158730158730159*G13_11_1;
+    A[90] = -0.030952380952381*G13_6_0 - 0.030952380952381*G13_6_1 - 0.00714285714285719*G13_7_0 - 0.00714285714285714*G13_8_1 + 0.0095238095238095*G13_9_0 + 0.00952380952380934*G13_9_1 - 0.0095238095238095*G13_10_0 + 0.0380952380952382*G13_10_1 + 0.0380952380952382*G13_11_0 - 0.00952380952380951*G13_11_1;
+    A[91] = 0.00357142857142857*G13_6_0 + 0.00357142857142858*G13_6_1 - 0.00357142857142856*G13_7_0 + 0.00436507936507936*G13_8_1 + 0.00158730158730159*G13_9_0 - 0.00634920634920631*G13_9_1 - 0.00158730158730159*G13_10_0 - 0.00793650793650796*G13_10_1 + 0.00634920634920635*G13_11_1;
+    A[92] = 0.00357142857142858*G13_6_0 + 0.00357142857142859*G13_6_1 + 0.00436507936507937*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.00158730158730162*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00793650793650795*G13_11_0 - 0.00158730158730159*G13_11_1;
     A[93] = -0.00476190476190477*G13_6_0 - 0.00476190476190471*G13_6_1 - 0.00793650793650793*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.019047619047619*G13_10_0 + 0.0126984126984126*G13_10_1 + 0.0126984126984127*G13_11_0 + 0.019047619047619*G13_11_1;
-    A[94] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.00634920634920637*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 - 0.00634920634920632*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.0317460317460317*G13_10_1 + 0.0253968253968254*G13_11_0 + 0.00634920634920635*G13_11_1;
+    A[94] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.00634920634920638*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 - 0.00634920634920631*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.0317460317460317*G13_10_1 + 0.0253968253968254*G13_11_0 + 0.00634920634920635*G13_11_1;
     A[95] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.0126984126984127*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 - 0.0126984126984127*G13_9_1 + 0.00634920634920634*G13_10_0 + 0.0253968253968254*G13_10_1 + 0.0317460317460318*G13_11_0 + 0.0126984126984127*G13_11_1;
-    A[96] = 0.5*G1_0_0_0 + 0.5*G1_0_0_1 + 0.5*G1_0_1_0 + 0.500000000000001*G1_0_1_1 + 0.5*G3_0_0_0 + 0.5*G3_0_0_1 + 0.5*G3_0_1_0 + 0.500000000000001*G3_0_1_1 - 0.030952380952381*G12_0_0 - 0.030952380952381*G12_0_1 + 0.00357142857142856*G12_1_0 + 0.00357142857142858*G12_1_1 + 0.00357142857142858*G12_2_0 + 0.00357142857142859*G12_2_1 - 0.00476190476190477*G12_3_0 - 0.00476190476190471*G12_3_1 - 0.0190476190476191*G12_4_0 - 0.0190476190476191*G12_4_1 - 0.0190476190476191*G12_5_0 - 0.0190476 [...]
-    A[97] = 0.166666666666668*G1_0_0_0 + 0.166666666666666*G1_0_1_0 + 0.166666666666668*G3_0_0_0 + 0.166666666666666*G3_0_1_0 - 0.00714285714285718*G12_0_0 - 0.00357142857142857*G12_1_0 + 0.00436507936507937*G12_2_0 - 0.00793650793650793*G12_3_0 - 0.00634920634920637*G12_4_0 - 0.0126984126984127*G12_5_0 - 0.00714285714285718*G14_6_0 - 0.00357142857142857*G14_7_0 + 0.00436507936507937*G14_8_0 - 0.00793650793650793*G14_9_0 - 0.00634920634920637*G14_10_0 - 0.0126984126984127*G14_11_0 + 0.00 [...]
-    A[98] = 0.166666666666666*G1_0_0_1 + 0.166666666666666*G1_0_1_1 + 0.166666666666666*G3_0_0_1 + 0.166666666666666*G3_0_1_1 - 0.00714285714285714*G12_0_1 + 0.00436507936507936*G12_1_1 - 0.00357142857142857*G12_2_1 - 0.00793650793650795*G12_3_1 - 0.0126984126984127*G12_4_1 - 0.00634920634920636*G12_5_1 - 0.00714285714285714*G14_6_1 + 0.00436507936507936*G14_7_1 - 0.00357142857142857*G14_8_1 - 0.00793650793650795*G14_9_1 - 0.0126984126984127*G14_10_1 - 0.00634920634920636*G14_11_1 + 0.00 [...]
-    A[99] = 0.0095238095238095*G12_0_0 + 0.00952380952380933*G12_0_1 + 0.00158730158730159*G12_1_0 - 0.00634920634920631*G12_1_1 - 0.00634920634920634*G12_2_0 + 0.00158730158730163*G12_2_1 - 0.019047619047619*G12_3_0 - 0.0190476190476189*G12_3_1 - 0.0126984126984127*G12_4_0 - 0.00634920634920632*G12_4_1 - 0.00634920634920634*G12_5_0 - 0.0126984126984127*G12_5_1 + 0.0095238095238095*G14_6_0 + 0.00952380952380933*G14_6_1 + 0.00158730158730159*G14_7_0 - 0.00634920634920631*G14_7_1 - 0.00634 [...]
-    A[100] = -0.666666666666668*G1_0_0_1 - 0.666666666666668*G1_0_1_1 - 0.666666666666668*G3_0_0_1 - 0.666666666666668*G3_0_1_1 - 0.0095238095238095*G12_0_0 + 0.0380952380952383*G12_0_1 - 0.00158730158730159*G12_1_0 - 0.00793650793650796*G12_1_1 + 0.00634920634920634*G12_2_0 + 0.019047619047619*G12_3_0 + 0.0126984126984126*G12_3_1 + 0.0126984126984127*G12_4_0 + 0.0317460317460317*G12_4_1 + 0.00634920634920634*G12_5_0 + 0.0253968253968254*G12_5_1 - 0.0095238095238095*G14_6_0 + 0.038095238 [...]
-    A[101] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_1_0 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_1_0 + 0.0380952380952381*G12_0_0 - 0.00952380952380951*G12_0_1 + 0.00634920634920635*G12_1_1 - 0.00793650793650795*G12_2_0 - 0.00158730158730159*G12_2_1 + 0.0126984126984127*G12_3_0 + 0.019047619047619*G12_3_1 + 0.0253968253968254*G12_4_0 + 0.00634920634920635*G12_4_1 + 0.0317460317460318*G12_5_0 + 0.0126984126984127*G12_5_1 + 0.0380952380952381*G14_6_0 - 0.00952380 [...]
-    A[102] = 0.166666666666667*G5_0 + 0.166666666666668*G5_1;
+    A[96] = 0.5*G1_0_0_0 + 0.5*G1_0_0_1 + 0.5*G1_0_1_0 + 0.500000000000001*G1_0_1_1 + 0.5*G3_0_0_0 + 0.5*G3_0_0_1 + 0.5*G3_0_1_0 + 0.500000000000001*G3_0_1_1 - 0.030952380952381*G12_0_0 - 0.030952380952381*G12_0_1 + 0.00357142857142857*G12_1_0 + 0.00357142857142858*G12_1_1 + 0.00357142857142858*G12_2_0 + 0.00357142857142859*G12_2_1 - 0.00476190476190477*G12_3_0 - 0.00476190476190471*G12_3_1 - 0.0190476190476191*G12_4_0 - 0.0190476190476191*G12_4_1 - 0.0190476190476191*G12_5_0 - 0.0190476 [...]
+    A[97] = 0.166666666666668*G1_0_0_0 + 0.166666666666666*G1_0_1_0 + 0.166666666666668*G3_0_0_0 + 0.166666666666666*G3_0_1_0 - 0.00714285714285719*G12_0_0 - 0.00357142857142856*G12_1_0 + 0.00436507936507937*G12_2_0 - 0.00793650793650793*G12_3_0 - 0.00634920634920638*G12_4_0 - 0.0126984126984127*G12_5_0 - 0.00714285714285719*G14_6_0 - 0.00357142857142856*G14_7_0 + 0.00436507936507937*G14_8_0 - 0.00793650793650793*G14_9_0 - 0.00634920634920638*G14_10_0 - 0.0126984126984127*G14_11_0 + 0.00 [...]
+    A[98] = 0.166666666666666*G1_0_0_1 + 0.166666666666666*G1_0_1_1 + 0.166666666666666*G3_0_0_1 + 0.166666666666666*G3_0_1_1 - 0.00714285714285714*G12_0_1 + 0.00436507936507936*G12_1_1 - 0.00357142857142857*G12_2_1 - 0.00793650793650795*G12_3_1 - 0.0126984126984127*G12_4_1 - 0.00634920634920636*G12_5_1 - 0.00714285714285714*G14_6_1 + 0.00436507936507936*G14_7_1 - 0.00357142857142857*G14_8_1 - 0.00793650793650795*G14_9_1 - 0.0126984126984127*G14_10_1 - 0.00634920634920636*G14_11_1 + 0.00 [...]
+    A[99] = 0.0095238095238095*G12_0_0 + 0.00952380952380934*G12_0_1 + 0.00158730158730159*G12_1_0 - 0.00634920634920631*G12_1_1 - 0.00634920634920634*G12_2_0 + 0.00158730158730162*G12_2_1 - 0.019047619047619*G12_3_0 - 0.0190476190476189*G12_3_1 - 0.0126984126984127*G12_4_0 - 0.00634920634920631*G12_4_1 - 0.00634920634920634*G12_5_0 - 0.0126984126984127*G12_5_1 + 0.0095238095238095*G14_6_0 + 0.00952380952380934*G14_6_1 + 0.00158730158730159*G14_7_0 - 0.00634920634920631*G14_7_1 - 0.00634 [...]
+    A[100] = -0.666666666666668*G1_0_0_1 - 0.666666666666668*G1_0_1_1 - 0.666666666666668*G3_0_0_1 - 0.666666666666668*G3_0_1_1 - 0.0095238095238095*G12_0_0 + 0.0380952380952382*G12_0_1 - 0.00158730158730159*G12_1_0 - 0.00793650793650796*G12_1_1 + 0.00634920634920634*G12_2_0 + 0.019047619047619*G12_3_0 + 0.0126984126984126*G12_3_1 + 0.0126984126984127*G12_4_0 + 0.0317460317460317*G12_4_1 + 0.00634920634920634*G12_5_0 + 0.0253968253968254*G12_5_1 - 0.0095238095238095*G14_6_0 + 0.038095238 [...]
+    A[101] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_1_0 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_1_0 + 0.0380952380952382*G12_0_0 - 0.00952380952380951*G12_0_1 + 0.00634920634920635*G12_1_1 - 0.00793650793650795*G12_2_0 - 0.00158730158730159*G12_2_1 + 0.0126984126984127*G12_3_0 + 0.019047619047619*G12_3_1 + 0.0253968253968254*G12_4_0 + 0.00634920634920635*G12_4_1 + 0.0317460317460318*G12_5_0 + 0.0126984126984127*G12_5_1 + 0.0380952380952382*G14_6_0 - 0.00952380 [...]
+    A[102] = 0.166666666666667*G5_0 + 0.166666666666667*G5_1;
     A[103] = 0.0;
     A[104] = 0.0;
-    A[105] = 0.00357142857142856*G13_6_0 + 0.00357142857142858*G13_6_1 - 0.00357142857142857*G13_7_0 + 0.00436507936507936*G13_8_1 + 0.00158730158730159*G13_9_0 - 0.00634920634920631*G13_9_1 - 0.00158730158730159*G13_10_0 - 0.00793650793650796*G13_10_1 + 0.00634920634920635*G13_11_1;
-    A[106] = 0.00714285714285717*G13_6_0 + 0.00714285714285705*G13_6_1 + 0.0309523809523809*G13_7_0 - 0.00714285714285712*G13_8_1 + 0.00952380952380949*G13_9_0 + 0.0476190476190473*G13_9_1 - 0.00952380952380949*G13_10_0 - 0.0380952380952381*G13_11_0 - 0.0476190476190476*G13_11_1;
-    A[107] = -0.00436507936507936*G13_6_0 - 0.00436507936507934*G13_6_1 - 0.00357142857142857*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.00634920634920629*G13_9_1 + 0.00634920634920633*G13_10_0 + 0.00793650793650789*G13_10_1 + 0.00793650793650793*G13_11_0 + 0.00634920634920634*G13_11_1;
-    A[108] = 0.00634920634920636*G13_6_0 + 0.00634920634920634*G13_6_1 + 0.019047619047619*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 + 0.019047619047619*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.00634920634920638*G13_10_1 - 0.0253968253968254*G13_11_0 - 0.019047619047619*G13_11_1;
+    A[105] = 0.00357142857142857*G13_6_0 + 0.00357142857142858*G13_6_1 - 0.00357142857142856*G13_7_0 + 0.00436507936507936*G13_8_1 + 0.00158730158730159*G13_9_0 - 0.00634920634920631*G13_9_1 - 0.00158730158730159*G13_10_0 - 0.00793650793650796*G13_10_1 + 0.00634920634920635*G13_11_1;
+    A[106] = 0.00714285714285716*G13_6_0 + 0.00714285714285705*G13_6_1 + 0.0309523809523809*G13_7_0 - 0.00714285714285712*G13_8_1 + 0.00952380952380949*G13_9_0 + 0.0476190476190473*G13_9_1 - 0.00952380952380949*G13_10_0 - 0.0380952380952381*G13_11_0 - 0.0476190476190476*G13_11_1;
+    A[107] = -0.00436507936507936*G13_6_0 - 0.00436507936507934*G13_6_1 - 0.00357142857142857*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.00634920634920629*G13_9_1 + 0.00634920634920633*G13_10_0 + 0.0079365079365079*G13_10_1 + 0.00793650793650793*G13_11_0 + 0.00634920634920634*G13_11_1;
+    A[108] = 0.00634920634920635*G13_6_0 + 0.00634920634920634*G13_6_1 + 0.019047619047619*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 + 0.019047619047619*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.00634920634920637*G13_10_1 - 0.0253968253968254*G13_11_0 - 0.019047619047619*G13_11_1;
     A[109] = 0.00793650793650793*G13_6_0 + 0.00793650793650798*G13_6_1 + 0.00476190476190477*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.00634920634920621*G13_9_1 + 0.019047619047619*G13_10_0 - 0.0126984126984127*G13_11_0 + 0.00634920634920634*G13_11_1;
-    A[110] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 + 0.0190476190476191*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.019047619047619*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00634920634920631*G13_10_1 - 0.0317460317460318*G13_11_0 - 0.0190476190476191*G13_11_1;
-    A[111] = 0.166666666666668*G1_0_0_0 + 0.166666666666666*G1_0_0_1 + 0.166666666666668*G3_0_0_0 + 0.166666666666666*G3_0_0_1 + 0.00357142857142856*G12_0_0 + 0.00357142857142858*G12_0_1 + 0.00714285714285717*G12_1_0 + 0.00714285714285705*G12_1_1 - 0.00436507936507936*G12_2_0 - 0.00436507936507934*G12_2_1 + 0.00634920634920636*G12_3_0 + 0.00634920634920634*G12_3_1 + 0.00793650793650793*G12_4_0 + 0.00793650793650798*G12_4_1 + 0.0126984126984127*G12_5_0 + 0.0126984126984127*G12_5_1 + 0.003 [...]
-    A[112] = 0.5*G1_0_0_0 + 0.5*G3_0_0_0 - 0.00357142857142857*G12_0_0 + 0.0309523809523809*G12_1_0 - 0.00357142857142857*G12_2_0 + 0.019047619047619*G12_3_0 + 0.00476190476190477*G12_4_0 + 0.0190476190476191*G12_5_0 - 0.00357142857142857*G14_6_0 + 0.0309523809523809*G14_7_0 - 0.00357142857142857*G14_8_0 + 0.019047619047619*G14_9_0 + 0.00476190476190477*G14_10_0 + 0.0190476190476191*G14_11_0 + 0.00714285714285717*G15_6_0 + 0.00714285714285705*G15_6_1 + 0.0309523809523809*G15_7_0 - 0.0071 [...]
-    A[113] = -0.166666666666667*G1_0_0_1 - 0.166666666666667*G3_0_0_1 + 0.00436507936507936*G12_0_1 - 0.00714285714285712*G12_1_1 - 0.00357142857142857*G12_2_1 - 0.0126984126984127*G12_3_1 - 0.00793650793650795*G12_4_1 - 0.00634920634920636*G12_5_1 + 0.00436507936507936*G14_6_1 - 0.00714285714285712*G14_7_1 - 0.00357142857142857*G14_8_1 - 0.0126984126984127*G14_9_1 - 0.00793650793650795*G14_10_1 - 0.00634920634920636*G14_11_1 - 0.00436507936507936*G15_6_0 - 0.00436507936507934*G15_6_1 -  [...]
-    A[114] = 0.666666666666664*G1_0_0_1 + 0.666666666666664*G3_0_0_1 + 0.00158730158730159*G12_0_0 - 0.00634920634920631*G12_0_1 + 0.00952380952380949*G12_1_0 + 0.0476190476190473*G12_1_1 - 0.00634920634920633*G12_2_0 - 0.00634920634920629*G12_2_1 - 0.0126984126984127*G12_3_0 + 0.019047619047619*G12_3_1 - 0.019047619047619*G12_4_0 - 0.00634920634920621*G12_4_1 - 0.00634920634920634*G12_5_0 + 0.019047619047619*G12_5_1 + 0.00158730158730159*G14_6_0 - 0.00634920634920631*G14_6_1 + 0.0095238 [...]
-    A[115] = -0.00158730158730159*G12_0_0 - 0.00793650793650796*G12_0_1 - 0.00952380952380949*G12_1_0 + 0.00634920634920633*G12_2_0 + 0.00793650793650789*G12_2_1 + 0.0126984126984127*G12_3_0 + 0.00634920634920638*G12_3_1 + 0.019047619047619*G12_4_0 + 0.00634920634920634*G12_5_0 - 0.00634920634920631*G12_5_1 - 0.00158730158730159*G14_6_0 - 0.00793650793650796*G14_6_1 - 0.00952380952380949*G14_7_0 + 0.00634920634920633*G14_8_0 + 0.00793650793650789*G14_8_1 + 0.0126984126984127*G14_9_0 + 0. [...]
-    A[116] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_0_1 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_0_1 + 0.00634920634920635*G12_0_1 - 0.0380952380952381*G12_1_0 - 0.0476190476190476*G12_1_1 + 0.00793650793650793*G12_2_0 + 0.00634920634920634*G12_2_1 - 0.0253968253968254*G12_3_0 - 0.019047619047619*G12_3_1 - 0.0126984126984127*G12_4_0 + 0.00634920634920634*G12_4_1 - 0.0317460317460318*G12_5_0 - 0.0190476190476191*G12_5_1 + 0.00634920634920635*G14_6_1 - 0.03809523 [...]
+    A[110] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 + 0.0190476190476191*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.019047619047619*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00634920634920632*G13_10_1 - 0.0317460317460318*G13_11_0 - 0.0190476190476191*G13_11_1;
+    A[111] = 0.166666666666668*G1_0_0_0 + 0.166666666666666*G1_0_0_1 + 0.166666666666668*G3_0_0_0 + 0.166666666666666*G3_0_0_1 + 0.00357142857142857*G12_0_0 + 0.00357142857142858*G12_0_1 + 0.00714285714285716*G12_1_0 + 0.00714285714285705*G12_1_1 - 0.00436507936507936*G12_2_0 - 0.00436507936507934*G12_2_1 + 0.00634920634920635*G12_3_0 + 0.00634920634920634*G12_3_1 + 0.00793650793650793*G12_4_0 + 0.00793650793650798*G12_4_1 + 0.0126984126984127*G12_5_0 + 0.0126984126984127*G12_5_1 + 0.003 [...]
+    A[112] = 0.5*G1_0_0_0 + 0.5*G3_0_0_0 - 0.00357142857142856*G12_0_0 + 0.0309523809523809*G12_1_0 - 0.00357142857142857*G12_2_0 + 0.019047619047619*G12_3_0 + 0.00476190476190477*G12_4_0 + 0.0190476190476191*G12_5_0 - 0.00357142857142856*G14_6_0 + 0.0309523809523809*G14_7_0 - 0.00357142857142857*G14_8_0 + 0.019047619047619*G14_9_0 + 0.00476190476190477*G14_10_0 + 0.0190476190476191*G14_11_0 + 0.00714285714285716*G15_6_0 + 0.00714285714285705*G15_6_1 + 0.0309523809523809*G15_7_0 - 0.0071 [...]
+    A[113] = -0.166666666666667*G1_0_0_1 - 0.166666666666667*G3_0_0_1 + 0.00436507936507936*G12_0_1 - 0.00714285714285712*G12_1_1 - 0.00357142857142857*G12_2_1 - 0.0126984126984127*G12_3_1 - 0.00793650793650795*G12_4_1 - 0.00634920634920636*G12_5_1 + 0.00436507936507936*G14_6_1 - 0.00714285714285712*G14_7_1 - 0.00357142857142857*G14_8_1 - 0.0126984126984127*G14_9_1 - 0.00793650793650795*G14_10_1 - 0.00634920634920636*G14_11_1 - 0.00436507936507936*G15_6_0 - 0.00436507936507934*G15_6_1 -  [...]
+    A[114] = 0.666666666666664*G1_0_0_1 + 0.666666666666664*G3_0_0_1 + 0.00158730158730159*G12_0_0 - 0.00634920634920631*G12_0_1 + 0.00952380952380949*G12_1_0 + 0.0476190476190473*G12_1_1 - 0.00634920634920633*G12_2_0 - 0.00634920634920629*G12_2_1 - 0.0126984126984127*G12_3_0 + 0.019047619047619*G12_3_1 - 0.019047619047619*G12_4_0 - 0.00634920634920621*G12_4_1 - 0.00634920634920634*G12_5_0 + 0.019047619047619*G12_5_1 + 0.00158730158730159*G14_6_0 - 0.00634920634920631*G14_6_1 + 0.0095238 [...]
+    A[115] = -0.00158730158730159*G12_0_0 - 0.00793650793650796*G12_0_1 - 0.00952380952380949*G12_1_0 + 0.00634920634920633*G12_2_0 + 0.0079365079365079*G12_2_1 + 0.0126984126984127*G12_3_0 + 0.00634920634920637*G12_3_1 + 0.019047619047619*G12_4_0 + 0.00634920634920634*G12_5_0 - 0.00634920634920632*G12_5_1 - 0.00158730158730159*G14_6_0 - 0.00793650793650796*G14_6_1 - 0.00952380952380949*G14_7_0 + 0.00634920634920633*G14_8_0 + 0.0079365079365079*G14_8_1 + 0.0126984126984127*G14_9_0 + 0.00 [...]
+    A[116] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_0_1 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_0_1 + 0.00634920634920635*G12_0_1 - 0.0380952380952381*G12_1_0 - 0.0476190476190476*G12_1_1 + 0.00793650793650793*G12_2_0 + 0.00634920634920634*G12_2_1 - 0.0253968253968254*G12_3_0 - 0.019047619047619*G12_3_1 - 0.0126984126984127*G12_4_0 + 0.00634920634920634*G12_4_1 - 0.0317460317460318*G12_5_0 - 0.0190476190476191*G12_5_1 + 0.00634920634920635*G14_6_1 - 0.03809523 [...]
     A[117] = 0.0;
     A[118] = -0.166666666666667*G5_0;
     A[119] = 0.0;
-    A[120] = 0.00357142857142858*G13_6_0 + 0.00357142857142859*G13_6_1 + 0.00436507936507937*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.00158730158730163*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00793650793650795*G13_11_0 - 0.00158730158730159*G13_11_1;
-    A[121] = -0.00436507936507936*G13_6_0 - 0.00436507936507934*G13_6_1 - 0.00357142857142857*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.00634920634920629*G13_9_1 + 0.00634920634920633*G13_10_0 + 0.00793650793650789*G13_10_1 + 0.00793650793650793*G13_11_0 + 0.00634920634920634*G13_11_1;
-    A[122] = 0.00714285714285712*G13_6_0 + 0.00714285714285704*G13_6_1 - 0.00714285714285716*G13_7_0 + 0.030952380952381*G13_8_1 + 0.0476190476190475*G13_9_0 + 0.00952380952380924*G13_9_1 - 0.0476190476190475*G13_10_0 - 0.0380952380952379*G13_10_1 - 0.00952380952380949*G13_11_1;
-    A[123] = 0.00634920634920632*G13_6_0 + 0.00634920634920634*G13_6_1 - 0.0126984126984127*G13_7_0 + 0.019047619047619*G13_8_1 + 0.019047619047619*G13_9_0 - 0.0126984126984127*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0253968253968254*G13_10_1 + 0.00634920634920637*G13_11_0 + 0.0126984126984127*G13_11_1;
-    A[124] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 - 0.00634920634920635*G13_7_0 + 0.0190476190476191*G13_8_1 + 0.019047619047619*G13_9_0 - 0.00634920634920638*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0317460317460317*G13_10_1 - 0.00634920634920633*G13_11_0 + 0.00634920634920636*G13_11_1;
+    A[120] = 0.00357142857142858*G13_6_0 + 0.00357142857142859*G13_6_1 + 0.00436507936507937*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.00158730158730162*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00793650793650795*G13_11_0 - 0.00158730158730159*G13_11_1;
+    A[121] = -0.00436507936507936*G13_6_0 - 0.00436507936507934*G13_6_1 - 0.00357142857142857*G13_7_0 - 0.00357142857142857*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.00634920634920629*G13_9_1 + 0.00634920634920633*G13_10_0 + 0.0079365079365079*G13_10_1 + 0.00793650793650793*G13_11_0 + 0.00634920634920634*G13_11_1;
+    A[122] = 0.00714285714285713*G13_6_0 + 0.00714285714285705*G13_6_1 - 0.00714285714285715*G13_7_0 + 0.030952380952381*G13_8_1 + 0.0476190476190475*G13_9_0 + 0.00952380952380926*G13_9_1 - 0.0476190476190475*G13_10_0 - 0.0380952380952379*G13_10_1 - 0.00952380952380948*G13_11_1;
+    A[123] = 0.00634920634920633*G13_6_0 + 0.00634920634920634*G13_6_1 - 0.0126984126984127*G13_7_0 + 0.019047619047619*G13_8_1 + 0.019047619047619*G13_9_0 - 0.0126984126984127*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0253968253968254*G13_10_1 + 0.00634920634920635*G13_11_0 + 0.0126984126984127*G13_11_1;
+    A[124] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 - 0.00634920634920635*G13_7_0 + 0.0190476190476191*G13_8_1 + 0.019047619047619*G13_9_0 - 0.00634920634920638*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0317460317460317*G13_10_1 - 0.00634920634920635*G13_11_0 + 0.00634920634920636*G13_11_1;
     A[125] = 0.00793650793650792*G13_6_0 + 0.00793650793650798*G13_6_1 - 0.00793650793650792*G13_7_0 + 0.00476190476190475*G13_8_1 - 0.00634920634920633*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.00634920634920633*G13_10_0 - 0.0126984126984128*G13_10_1 + 0.019047619047619*G13_11_1;
-    A[126] = 0.166666666666666*G1_0_1_0 + 0.166666666666666*G1_0_1_1 + 0.166666666666666*G3_0_1_0 + 0.166666666666666*G3_0_1_1 + 0.00357142857142858*G12_0_0 + 0.00357142857142859*G12_0_1 - 0.00436507936507936*G12_1_0 - 0.00436507936507934*G12_1_1 + 0.00714285714285712*G12_2_0 + 0.00714285714285704*G12_2_1 + 0.00634920634920632*G12_3_0 + 0.00634920634920634*G12_3_1 + 0.0126984126984127*G12_4_0 + 0.0126984126984127*G12_4_1 + 0.00793650793650792*G12_5_0 + 0.00793650793650798*G12_5_1 + 0.003 [...]
-    A[127] = -0.166666666666667*G1_0_1_0 - 0.166666666666667*G3_0_1_0 + 0.00436507936507937*G12_0_0 - 0.00357142857142857*G12_1_0 - 0.00714285714285716*G12_2_0 - 0.0126984126984127*G12_3_0 - 0.00634920634920635*G12_4_0 - 0.00793650793650792*G12_5_0 + 0.00436507936507937*G14_6_0 - 0.00357142857142857*G14_7_0 - 0.00714285714285716*G14_8_0 - 0.0126984126984127*G14_9_0 - 0.00634920634920635*G14_10_0 - 0.00793650793650792*G14_11_0 - 0.00436507936507936*G15_6_0 - 0.00436507936507934*G15_6_1 -  [...]
-    A[128] = 0.5*G1_0_1_1 + 0.5*G3_0_1_1 - 0.00357142857142857*G12_0_1 - 0.00357142857142857*G12_1_1 + 0.030952380952381*G12_2_1 + 0.019047619047619*G12_3_1 + 0.0190476190476191*G12_4_1 + 0.00476190476190475*G12_5_1 - 0.00357142857142857*G14_6_1 - 0.00357142857142857*G14_7_1 + 0.030952380952381*G14_8_1 + 0.019047619047619*G14_9_1 + 0.0190476190476191*G14_10_1 + 0.00476190476190475*G14_11_1 + 0.00714285714285712*G15_6_0 + 0.00714285714285704*G15_6_1 - 0.00714285714285716*G15_7_0 + 0.03095 [...]
-    A[129] = 0.666666666666667*G1_0_1_0 + 0.666666666666667*G3_0_1_0 - 0.00634920634920634*G12_0_0 + 0.00158730158730163*G12_0_1 - 0.00634920634920633*G12_1_0 - 0.00634920634920629*G12_1_1 + 0.0476190476190475*G12_2_0 + 0.00952380952380924*G12_2_1 + 0.019047619047619*G12_3_0 - 0.0126984126984127*G12_3_1 + 0.019047619047619*G12_4_0 - 0.00634920634920638*G12_4_1 - 0.00634920634920633*G12_5_0 - 0.0190476190476189*G12_5_1 - 0.00634920634920634*G14_6_0 + 0.00158730158730163*G14_6_1 - 0.006349 [...]
-    A[130] = -0.666666666666667*G1_0_1_0 - 0.666666666666665*G1_0_1_1 - 0.666666666666667*G3_0_1_0 - 0.666666666666665*G3_0_1_1 + 0.00634920634920634*G12_0_0 + 0.00634920634920633*G12_1_0 + 0.00793650793650789*G12_1_1 - 0.0476190476190475*G12_2_0 - 0.0380952380952379*G12_2_1 - 0.019047619047619*G12_3_0 - 0.0253968253968254*G12_3_1 - 0.019047619047619*G12_4_0 - 0.0317460317460317*G12_4_1 + 0.00634920634920633*G12_5_0 - 0.0126984126984128*G12_5_1 + 0.00634920634920634*G14_6_0 + 0.006349206 [...]
-    A[131] = -0.00793650793650795*G12_0_0 - 0.00158730158730159*G12_0_1 + 0.00793650793650793*G12_1_0 + 0.00634920634920634*G12_1_1 - 0.00952380952380949*G12_2_1 + 0.00634920634920637*G12_3_0 + 0.0126984126984127*G12_3_1 - 0.00634920634920633*G12_4_0 + 0.00634920634920636*G12_4_1 + 0.019047619047619*G12_5_1 - 0.00793650793650795*G14_6_0 - 0.00158730158730159*G14_6_1 + 0.00793650793650793*G14_7_0 + 0.00634920634920634*G14_7_1 - 0.00952380952380949*G14_8_1 + 0.00634920634920637*G14_9_0 + 0 [...]
+    A[126] = 0.166666666666666*G1_0_1_0 + 0.166666666666666*G1_0_1_1 + 0.166666666666666*G3_0_1_0 + 0.166666666666666*G3_0_1_1 + 0.00357142857142858*G12_0_0 + 0.00357142857142859*G12_0_1 - 0.00436507936507936*G12_1_0 - 0.00436507936507934*G12_1_1 + 0.00714285714285713*G12_2_0 + 0.00714285714285705*G12_2_1 + 0.00634920634920633*G12_3_0 + 0.00634920634920634*G12_3_1 + 0.0126984126984127*G12_4_0 + 0.0126984126984127*G12_4_1 + 0.00793650793650792*G12_5_0 + 0.00793650793650798*G12_5_1 + 0.003 [...]
+    A[127] = -0.166666666666667*G1_0_1_0 - 0.166666666666667*G3_0_1_0 + 0.00436507936507937*G12_0_0 - 0.00357142857142857*G12_1_0 - 0.00714285714285715*G12_2_0 - 0.0126984126984127*G12_3_0 - 0.00634920634920635*G12_4_0 - 0.00793650793650792*G12_5_0 + 0.00436507936507937*G14_6_0 - 0.00357142857142857*G14_7_0 - 0.00714285714285715*G14_8_0 - 0.0126984126984127*G14_9_0 - 0.00634920634920635*G14_10_0 - 0.00793650793650792*G14_11_0 - 0.00436507936507936*G15_6_0 - 0.00436507936507934*G15_6_1 -  [...]
+    A[128] = 0.5*G1_0_1_1 + 0.5*G3_0_1_1 - 0.00357142857142857*G12_0_1 - 0.00357142857142857*G12_1_1 + 0.030952380952381*G12_2_1 + 0.019047619047619*G12_3_1 + 0.0190476190476191*G12_4_1 + 0.00476190476190475*G12_5_1 - 0.00357142857142857*G14_6_1 - 0.00357142857142857*G14_7_1 + 0.030952380952381*G14_8_1 + 0.019047619047619*G14_9_1 + 0.0190476190476191*G14_10_1 + 0.00476190476190475*G14_11_1 + 0.00714285714285713*G15_6_0 + 0.00714285714285705*G15_6_1 - 0.00714285714285715*G15_7_0 + 0.03095 [...]
+    A[129] = 0.666666666666667*G1_0_1_0 + 0.666666666666667*G3_0_1_0 - 0.00634920634920634*G12_0_0 + 0.00158730158730162*G12_0_1 - 0.00634920634920633*G12_1_0 - 0.00634920634920629*G12_1_1 + 0.0476190476190475*G12_2_0 + 0.00952380952380926*G12_2_1 + 0.019047619047619*G12_3_0 - 0.0126984126984127*G12_3_1 + 0.019047619047619*G12_4_0 - 0.00634920634920638*G12_4_1 - 0.00634920634920633*G12_5_0 - 0.0190476190476189*G12_5_1 - 0.00634920634920634*G14_6_0 + 0.00158730158730162*G14_6_1 - 0.006349 [...]
+    A[130] = -0.666666666666667*G1_0_1_0 - 0.666666666666665*G1_0_1_1 - 0.666666666666667*G3_0_1_0 - 0.666666666666665*G3_0_1_1 + 0.00634920634920634*G12_0_0 + 0.00634920634920633*G12_1_0 + 0.0079365079365079*G12_1_1 - 0.0476190476190475*G12_2_0 - 0.0380952380952379*G12_2_1 - 0.019047619047619*G12_3_0 - 0.0253968253968254*G12_3_1 - 0.019047619047619*G12_4_0 - 0.0317460317460317*G12_4_1 + 0.00634920634920633*G12_5_0 - 0.0126984126984128*G12_5_1 + 0.00634920634920634*G14_6_0 + 0.0063492063 [...]
+    A[131] = -0.00793650793650795*G12_0_0 - 0.00158730158730159*G12_0_1 + 0.00793650793650793*G12_1_0 + 0.00634920634920634*G12_1_1 - 0.00952380952380948*G12_2_1 + 0.00634920634920635*G12_3_0 + 0.0126984126984127*G12_3_1 - 0.00634920634920635*G12_4_0 + 0.00634920634920636*G12_4_1 + 0.019047619047619*G12_5_1 - 0.00793650793650795*G14_6_0 - 0.00158730158730159*G14_6_1 + 0.00793650793650793*G14_7_0 + 0.00634920634920634*G14_7_1 - 0.00952380952380948*G14_8_1 + 0.00634920634920635*G14_9_0 + 0 [...]
     A[132] = 0.0;
     A[133] = 0.0;
     A[134] = -0.166666666666667*G5_1;
-    A[135] = -0.00476190476190477*G13_6_0 - 0.00476190476190471*G13_6_1 - 0.00793650793650793*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.019047619047619*G13_10_0 + 0.0126984126984126*G13_10_1 + 0.0126984126984127*G13_11_0 + 0.019047619047619*G13_11_1;
-    A[136] = 0.00634920634920636*G13_6_0 + 0.00634920634920634*G13_6_1 + 0.019047619047619*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 + 0.019047619047619*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.00634920634920638*G13_10_1 - 0.0253968253968254*G13_11_0 - 0.019047619047619*G13_11_1;
-    A[137] = 0.00634920634920632*G13_6_0 + 0.00634920634920634*G13_6_1 - 0.0126984126984127*G13_7_0 + 0.019047619047619*G13_8_1 + 0.019047619047619*G13_9_0 - 0.0126984126984127*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0253968253968254*G13_10_1 + 0.00634920634920637*G13_11_0 + 0.0126984126984127*G13_11_1;
+    A[135] = -0.00476190476190477*G13_6_0 - 0.00476190476190471*G13_6_1 - 0.00793650793650794*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.019047619047619*G13_10_0 + 0.0126984126984126*G13_10_1 + 0.0126984126984127*G13_11_0 + 0.019047619047619*G13_11_1;
+    A[136] = 0.00634920634920635*G13_6_0 + 0.00634920634920634*G13_6_1 + 0.019047619047619*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 + 0.019047619047619*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.00634920634920637*G13_10_1 - 0.0253968253968254*G13_11_0 - 0.019047619047619*G13_11_1;
+    A[137] = 0.00634920634920633*G13_6_0 + 0.00634920634920634*G13_6_1 - 0.0126984126984127*G13_7_0 + 0.019047619047619*G13_8_1 + 0.019047619047619*G13_9_0 - 0.0126984126984127*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0253968253968254*G13_10_1 + 0.00634920634920635*G13_11_0 + 0.0126984126984127*G13_11_1;
     A[138] = 0.0380952380952381*G13_6_0 + 0.0380952380952376*G13_6_1 + 0.0634920634920634*G13_7_0 + 0.0634920634920636*G13_8_1 + 0.152380952380952*G13_9_0 + 0.152380952380951*G13_9_1 - 0.152380952380952*G13_10_0 - 0.101587301587301*G13_10_1 - 0.101587301587302*G13_11_0 - 0.152380952380952*G13_11_1;
     A[139] = -0.00634920634920632*G13_6_0 - 0.00634920634920656*G13_6_1 + 0.00634920634920632*G13_7_0 + 0.0317460317460318*G13_8_1 + 0.076190476190476*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.076190476190476*G13_10_0 - 0.025396825396825*G13_10_1 - 0.0507936507936508*G13_11_1;
     A[140] = -0.00634920634920629*G13_6_0 - 0.00634920634920655*G13_6_1 + 0.0317460317460317*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0761904761904756*G13_9_1 - 0.0507936507936507*G13_10_0 - 0.0253968253968254*G13_11_0 - 0.0761904761904762*G13_11_1;
-    A[141] = -0.00476190476190477*G12_0_0 - 0.00476190476190471*G12_0_1 + 0.00634920634920636*G12_1_0 + 0.00634920634920634*G12_1_1 + 0.00634920634920632*G12_2_0 + 0.00634920634920634*G12_2_1 + 0.0380952380952381*G12_3_0 + 0.0380952380952376*G12_3_1 - 0.00634920634920632*G12_4_0 - 0.00634920634920656*G12_4_1 - 0.00634920634920629*G12_5_0 - 0.00634920634920655*G12_5_1 - 0.00476190476190477*G14_6_0 - 0.00476190476190471*G14_6_1 + 0.00634920634920636*G14_7_0 + 0.00634920634920634*G14_7_1 +  [...]
-    A[142] = 0.666666666666664*G1_0_1_0 + 0.666666666666664*G3_0_1_0 - 0.00793650793650793*G12_0_0 + 0.019047619047619*G12_1_0 - 0.0126984126984127*G12_2_0 + 0.0634920634920634*G12_3_0 + 0.00634920634920632*G12_4_0 + 0.0317460317460317*G12_5_0 - 0.00793650793650793*G14_6_0 + 0.019047619047619*G14_7_0 - 0.0126984126984127*G14_8_0 + 0.0634920634920634*G14_9_0 + 0.00634920634920632*G14_10_0 + 0.0317460317460317*G14_11_0 + 0.00634920634920636*G15_6_0 + 0.00634920634920634*G15_6_1 + 0.0190476 [...]
-    A[143] = 0.666666666666667*G1_0_0_1 + 0.666666666666667*G3_0_0_1 - 0.00793650793650795*G12_0_1 - 0.0126984126984127*G12_1_1 + 0.019047619047619*G12_2_1 + 0.0634920634920636*G12_3_1 + 0.0317460317460318*G12_4_1 + 0.00634920634920641*G12_5_1 - 0.00793650793650795*G14_6_1 - 0.0126984126984127*G14_7_1 + 0.019047619047619*G14_8_1 + 0.0634920634920636*G14_9_1 + 0.0317460317460318*G14_10_1 + 0.00634920634920641*G14_11_1 + 0.00634920634920632*G15_6_0 + 0.00634920634920634*G15_6_1 - 0.0126984 [...]
+    A[141] = -0.00476190476190477*G12_0_0 - 0.00476190476190471*G12_0_1 + 0.00634920634920635*G12_1_0 + 0.00634920634920634*G12_1_1 + 0.00634920634920633*G12_2_0 + 0.00634920634920634*G12_2_1 + 0.0380952380952381*G12_3_0 + 0.0380952380952376*G12_3_1 - 0.00634920634920632*G12_4_0 - 0.00634920634920656*G12_4_1 - 0.00634920634920629*G12_5_0 - 0.00634920634920655*G12_5_1 - 0.00476190476190477*G14_6_0 - 0.00476190476190471*G14_6_1 + 0.00634920634920635*G14_7_0 + 0.00634920634920634*G14_7_1 +  [...]
+    A[142] = 0.666666666666664*G1_0_1_0 + 0.666666666666664*G3_0_1_0 - 0.00793650793650794*G12_0_0 + 0.019047619047619*G12_1_0 - 0.0126984126984127*G12_2_0 + 0.0634920634920634*G12_3_0 + 0.00634920634920632*G12_4_0 + 0.0317460317460317*G12_5_0 - 0.00793650793650794*G14_6_0 + 0.019047619047619*G14_7_0 - 0.0126984126984127*G14_8_0 + 0.0634920634920634*G14_9_0 + 0.00634920634920632*G14_10_0 + 0.0317460317460317*G14_11_0 + 0.00634920634920635*G15_6_0 + 0.00634920634920634*G15_6_1 + 0.0190476 [...]
+    A[143] = 0.666666666666667*G1_0_0_1 + 0.666666666666667*G3_0_0_1 - 0.00793650793650795*G12_0_1 - 0.0126984126984127*G12_1_1 + 0.019047619047619*G12_2_1 + 0.0634920634920636*G12_3_1 + 0.0317460317460318*G12_4_1 + 0.00634920634920641*G12_5_1 - 0.00793650793650795*G14_6_1 - 0.0126984126984127*G14_7_1 + 0.019047619047619*G14_8_1 + 0.0634920634920636*G14_9_1 + 0.0317460317460318*G14_10_1 + 0.00634920634920641*G14_11_1 + 0.00634920634920633*G15_6_0 + 0.00634920634920634*G15_6_1 - 0.0126984 [...]
     A[144] = 1.33333333333333*G1_0_0_0 + 0.666666666666656*G1_0_0_1 + 0.666666666666656*G1_0_1_0 + 1.33333333333332*G1_0_1_1 + 1.33333333333333*G3_0_0_0 + 0.666666666666656*G3_0_0_1 + 0.666666666666656*G3_0_1_0 + 1.33333333333332*G3_0_1_1 - 0.019047619047619*G12_0_0 - 0.0190476190476189*G12_0_1 - 0.0126984126984127*G12_1_0 + 0.019047619047619*G12_1_1 + 0.019047619047619*G12_2_0 - 0.0126984126984127*G12_2_1 + 0.152380952380952*G12_3_0 + 0.152380952380951*G12_3_1 + 0.076190476190476*G12_4_ [...]
-    A[145] = -1.33333333333333*G1_0_0_0 - 0.666666666666659*G1_0_0_1 - 0.666666666666656*G1_0_1_0 - 1.33333333333333*G3_0_0_0 - 0.666666666666659*G3_0_0_1 - 0.666666666666656*G3_0_1_0 + 0.019047619047619*G12_0_0 + 0.0126984126984126*G12_0_1 + 0.0126984126984127*G12_1_0 + 0.00634920634920638*G12_1_1 - 0.019047619047619*G12_2_0 - 0.0253968253968254*G12_2_1 - 0.152380952380952*G12_3_0 - 0.101587301587301*G12_3_1 - 0.076190476190476*G12_4_0 - 0.025396825396825*G12_4_1 - 0.0507936507936507*G1 [...]
-    A[146] = -0.666666666666665*G1_0_0_1 - 0.666666666666666*G1_0_1_0 - 1.33333333333332*G1_0_1_1 - 0.666666666666665*G3_0_0_1 - 0.666666666666666*G3_0_1_0 - 1.33333333333332*G3_0_1_1 + 0.0126984126984127*G12_0_0 + 0.019047619047619*G12_0_1 - 0.0253968253968254*G12_1_0 - 0.019047619047619*G12_1_1 + 0.00634920634920637*G12_2_0 + 0.0126984126984127*G12_2_1 - 0.101587301587302*G12_3_0 - 0.152380952380952*G12_3_1 - 0.0507936507936508*G12_4_1 - 0.0253968253968254*G12_5_0 - 0.0761904761904762* [...]
+    A[145] = -1.33333333333333*G1_0_0_0 - 0.666666666666659*G1_0_0_1 - 0.666666666666656*G1_0_1_0 - 1.33333333333333*G3_0_0_0 - 0.666666666666659*G3_0_0_1 - 0.666666666666656*G3_0_1_0 + 0.019047619047619*G12_0_0 + 0.0126984126984126*G12_0_1 + 0.0126984126984127*G12_1_0 + 0.00634920634920637*G12_1_1 - 0.019047619047619*G12_2_0 - 0.0253968253968254*G12_2_1 - 0.152380952380952*G12_3_0 - 0.101587301587301*G12_3_1 - 0.076190476190476*G12_4_0 - 0.025396825396825*G12_4_1 - 0.0507936507936507*G1 [...]
+    A[146] = -0.666666666666665*G1_0_0_1 - 0.666666666666666*G1_0_1_0 - 1.33333333333332*G1_0_1_1 - 0.666666666666665*G3_0_0_1 - 0.666666666666666*G3_0_1_0 - 1.33333333333332*G3_0_1_1 + 0.0126984126984127*G12_0_0 + 0.019047619047619*G12_0_1 - 0.0253968253968254*G12_1_0 - 0.019047619047619*G12_1_1 + 0.00634920634920635*G12_2_0 + 0.0126984126984127*G12_2_1 - 0.101587301587302*G12_3_0 - 0.152380952380952*G12_3_1 - 0.0507936507936508*G12_4_1 - 0.0253968253968254*G12_5_0 - 0.0761904761904762* [...]
     A[147] = -0.166666666666666*G5_0 - 0.166666666666665*G5_1;
     A[148] = -0.166666666666666*G5_0 - 0.333333333333331*G5_1;
     A[149] = -0.333333333333333*G5_0 - 0.166666666666664*G5_1;
-    A[150] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.00634920634920637*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 - 0.00634920634920632*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.0317460317460317*G13_10_1 + 0.0253968253968254*G13_11_0 + 0.00634920634920635*G13_11_1;
+    A[150] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.00634920634920638*G13_7_0 - 0.0126984126984127*G13_8_1 - 0.0126984126984127*G13_9_0 - 0.00634920634920631*G13_9_1 + 0.0126984126984127*G13_10_0 + 0.0317460317460317*G13_10_1 + 0.0253968253968254*G13_11_0 + 0.00634920634920635*G13_11_1;
     A[151] = 0.00793650793650793*G13_6_0 + 0.00793650793650798*G13_6_1 + 0.00476190476190477*G13_7_0 - 0.00793650793650795*G13_8_1 - 0.019047619047619*G13_9_0 - 0.00634920634920621*G13_9_1 + 0.019047619047619*G13_10_0 - 0.0126984126984127*G13_11_0 + 0.00634920634920634*G13_11_1;
-    A[152] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 - 0.00634920634920635*G13_7_0 + 0.0190476190476191*G13_8_1 + 0.019047619047619*G13_9_0 - 0.00634920634920638*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0317460317460317*G13_10_1 - 0.00634920634920633*G13_11_0 + 0.00634920634920636*G13_11_1;
+    A[152] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 - 0.00634920634920635*G13_7_0 + 0.0190476190476191*G13_8_1 + 0.019047619047619*G13_9_0 - 0.00634920634920637*G13_9_1 - 0.019047619047619*G13_10_0 - 0.0317460317460317*G13_10_1 - 0.00634920634920635*G13_11_0 + 0.00634920634920636*G13_11_1;
     A[153] = -0.00634920634920632*G13_6_0 - 0.00634920634920656*G13_6_1 + 0.00634920634920632*G13_7_0 + 0.0317460317460318*G13_8_1 + 0.076190476190476*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.076190476190476*G13_10_0 - 0.025396825396825*G13_10_1 - 0.0507936507936508*G13_11_1;
     A[154] = -0.0634920634920635*G13_6_0 - 0.0634920634920639*G13_6_1 - 0.0380952380952382*G13_7_0 + 0.0634920634920636*G13_8_1 + 0.152380952380952*G13_9_0 + 0.0507936507936496*G13_9_1 - 0.152380952380952*G13_10_0 + 0.101587301587302*G13_11_0 - 0.0507936507936507*G13_11_1;
-    A[155] = -0.0317460317460317*G13_6_0 - 0.031746031746032*G13_6_1 + 0.0063492063492063*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.0507936507936507*G13_10_0 + 0.0253968253968258*G13_10_1 + 0.0253968253968254*G13_11_0 - 0.0507936507936508*G13_11_1;
-    A[156] = -0.666666666666668*G1_0_1_0 - 0.666666666666668*G1_0_1_1 - 0.666666666666668*G3_0_1_0 - 0.666666666666668*G3_0_1_1 - 0.0190476190476191*G12_0_0 - 0.0190476190476191*G12_0_1 + 0.00793650793650793*G12_1_0 + 0.00793650793650798*G12_1_1 + 0.0126984126984127*G12_2_0 + 0.0126984126984127*G12_2_1 - 0.00634920634920632*G12_3_0 - 0.00634920634920656*G12_3_1 - 0.0634920634920635*G12_4_0 - 0.0634920634920639*G12_4_1 - 0.0317460317460317*G12_5_0 - 0.031746031746032*G12_5_1 - 0.019047619 [...]
-    A[157] = -0.00634920634920637*G12_0_0 + 0.00476190476190477*G12_1_0 - 0.00634920634920635*G12_2_0 + 0.00634920634920632*G12_3_0 - 0.0380952380952382*G12_4_0 + 0.0063492063492063*G12_5_0 - 0.00634920634920637*G14_6_0 + 0.00476190476190477*G14_7_0 - 0.00634920634920635*G14_8_0 + 0.00634920634920632*G14_9_0 - 0.0380952380952382*G14_10_0 + 0.0063492063492063*G14_11_0 + 0.00793650793650793*G15_6_0 + 0.00793650793650798*G15_6_1 + 0.00476190476190477*G15_7_0 - 0.00793650793650795*G15_8_1 -  [...]
-    A[158] = -0.666666666666667*G1_0_0_1 - 0.666666666666665*G1_0_1_1 - 0.666666666666667*G3_0_0_1 - 0.666666666666665*G3_0_1_1 - 0.0126984126984127*G12_0_1 - 0.00793650793650795*G12_1_1 + 0.0190476190476191*G12_2_1 + 0.0317460317460318*G12_3_1 + 0.0634920634920636*G12_4_1 + 0.00634920634920641*G12_5_1 - 0.0126984126984127*G14_6_1 - 0.00793650793650795*G14_7_1 + 0.0190476190476191*G14_8_1 + 0.0317460317460318*G14_9_1 + 0.0634920634920636*G14_10_1 + 0.00634920634920641*G14_11_1 + 0.012698 [...]
-    A[159] = -1.33333333333333*G1_0_0_0 - 0.666666666666656*G1_0_0_1 - 0.666666666666659*G1_0_1_0 - 1.33333333333333*G3_0_0_0 - 0.666666666666656*G3_0_0_1 - 0.666666666666659*G3_0_1_0 - 0.0126984126984127*G12_0_0 - 0.00634920634920632*G12_0_1 - 0.019047619047619*G12_1_0 - 0.00634920634920621*G12_1_1 + 0.019047619047619*G12_2_0 - 0.00634920634920638*G12_2_1 + 0.076190476190476*G12_3_0 + 0.0507936507936502*G12_3_1 + 0.152380952380952*G12_4_0 + 0.0507936507936496*G12_4_1 + 0.050793650793650 [...]
+    A[155] = -0.0317460317460317*G13_6_0 - 0.0317460317460319*G13_6_1 + 0.0063492063492063*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.0507936507936507*G13_10_0 + 0.0253968253968258*G13_10_1 + 0.0253968253968254*G13_11_0 - 0.0507936507936508*G13_11_1;
+    A[156] = -0.666666666666668*G1_0_1_0 - 0.666666666666668*G1_0_1_1 - 0.666666666666668*G3_0_1_0 - 0.666666666666668*G3_0_1_1 - 0.0190476190476191*G12_0_0 - 0.0190476190476191*G12_0_1 + 0.00793650793650793*G12_1_0 + 0.00793650793650798*G12_1_1 + 0.0126984126984127*G12_2_0 + 0.0126984126984127*G12_2_1 - 0.00634920634920632*G12_3_0 - 0.00634920634920656*G12_3_1 - 0.0634920634920635*G12_4_0 - 0.0634920634920639*G12_4_1 - 0.0317460317460317*G12_5_0 - 0.0317460317460319*G12_5_1 - 0.01904761 [...]
+    A[157] = -0.00634920634920638*G12_0_0 + 0.00476190476190477*G12_1_0 - 0.00634920634920635*G12_2_0 + 0.00634920634920632*G12_3_0 - 0.0380952380952382*G12_4_0 + 0.0063492063492063*G12_5_0 - 0.00634920634920638*G14_6_0 + 0.00476190476190477*G14_7_0 - 0.00634920634920635*G14_8_0 + 0.00634920634920632*G14_9_0 - 0.0380952380952382*G14_10_0 + 0.0063492063492063*G14_11_0 + 0.00793650793650793*G15_6_0 + 0.00793650793650798*G15_6_1 + 0.00476190476190477*G15_7_0 - 0.00793650793650795*G15_8_1 -  [...]
+    A[158] = -0.666666666666667*G1_0_0_1 - 0.666666666666665*G1_0_1_1 - 0.666666666666667*G3_0_0_1 - 0.666666666666665*G3_0_1_1 - 0.0126984126984127*G12_0_1 - 0.00793650793650795*G12_1_1 + 0.0190476190476191*G12_2_1 + 0.0317460317460318*G12_3_1 + 0.0634920634920636*G12_4_1 + 0.00634920634920641*G12_5_1 - 0.0126984126984127*G14_6_1 - 0.00793650793650795*G14_7_1 + 0.0190476190476191*G14_8_1 + 0.0317460317460318*G14_9_1 + 0.0634920634920636*G14_10_1 + 0.00634920634920641*G14_11_1 + 0.012698 [...]
+    A[159] = -1.33333333333333*G1_0_0_0 - 0.666666666666656*G1_0_0_1 - 0.666666666666659*G1_0_1_0 - 1.33333333333333*G3_0_0_0 - 0.666666666666656*G3_0_0_1 - 0.666666666666659*G3_0_1_0 - 0.0126984126984127*G12_0_0 - 0.00634920634920631*G12_0_1 - 0.019047619047619*G12_1_0 - 0.00634920634920621*G12_1_1 + 0.019047619047619*G12_2_0 - 0.00634920634920637*G12_2_1 + 0.076190476190476*G12_3_0 + 0.0507936507936502*G12_3_1 + 0.152380952380952*G12_4_0 + 0.0507936507936496*G12_4_1 + 0.050793650793650 [...]
     A[160] = 1.33333333333333*G1_0_0_0 + 0.666666666666659*G1_0_0_1 + 0.666666666666659*G1_0_1_0 + 1.33333333333333*G1_0_1_1 + 1.33333333333333*G3_0_0_0 + 0.666666666666659*G3_0_0_1 + 0.666666666666659*G3_0_1_0 + 1.33333333333333*G3_0_1_1 + 0.0126984126984127*G12_0_0 + 0.0317460317460317*G12_0_1 + 0.019047619047619*G12_1_0 - 0.019047619047619*G12_2_0 - 0.0317460317460317*G12_2_1 - 0.076190476190476*G12_3_0 - 0.025396825396825*G12_3_1 - 0.152380952380952*G12_4_0 - 0.0507936507936507*G12_5 [...]
-    A[161] = 0.666666666666665*G1_0_0_1 + 0.666666666666666*G1_0_1_0 + 0.666666666666665*G3_0_0_1 + 0.666666666666666*G3_0_1_0 + 0.0253968253968254*G12_0_0 + 0.00634920634920635*G12_0_1 - 0.0126984126984127*G12_1_0 + 0.00634920634920634*G12_1_1 - 0.00634920634920633*G12_2_0 + 0.00634920634920636*G12_2_1 - 0.0507936507936508*G12_3_1 + 0.101587301587302*G12_4_0 - 0.0507936507936507*G12_4_1 + 0.0253968253968254*G12_5_0 - 0.0507936507936508*G12_5_1 + 0.0253968253968254*G14_6_0 + 0.0063492063 [...]
+    A[161] = 0.666666666666665*G1_0_0_1 + 0.666666666666666*G1_0_1_0 + 0.666666666666665*G3_0_0_1 + 0.666666666666666*G3_0_1_0 + 0.0253968253968254*G12_0_0 + 0.00634920634920635*G12_0_1 - 0.0126984126984127*G12_1_0 + 0.00634920634920634*G12_1_1 - 0.00634920634920635*G12_2_0 + 0.00634920634920636*G12_2_1 - 0.0507936507936508*G12_3_1 + 0.101587301587302*G12_4_0 - 0.0507936507936507*G12_4_1 + 0.0253968253968254*G12_5_0 - 0.0507936507936508*G12_5_1 + 0.0253968253968254*G14_6_0 + 0.0063492063 [...]
     A[162] = 0.166666666666666*G5_0 - 0.166666666666668*G5_1;
     A[163] = 0.166666666666666*G5_0;
     A[164] = 0.333333333333333*G5_0 + 0.166666666666665*G5_1;
     A[165] = -0.0190476190476191*G13_6_0 - 0.0190476190476191*G13_6_1 - 0.0126984126984127*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 - 0.0126984126984127*G13_9_1 + 0.00634920634920634*G13_10_0 + 0.0253968253968254*G13_10_1 + 0.0317460317460318*G13_11_0 + 0.0126984126984127*G13_11_1;
-    A[166] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 + 0.0190476190476191*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.019047619047619*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00634920634920631*G13_10_1 - 0.0317460317460318*G13_11_0 - 0.0190476190476191*G13_11_1;
+    A[166] = 0.0126984126984127*G13_6_0 + 0.0126984126984127*G13_6_1 + 0.0190476190476191*G13_7_0 - 0.00634920634920636*G13_8_1 - 0.00634920634920634*G13_9_0 + 0.019047619047619*G13_9_1 + 0.00634920634920634*G13_10_0 - 0.00634920634920632*G13_10_1 - 0.0317460317460318*G13_11_0 - 0.0190476190476191*G13_11_1;
     A[167] = 0.00793650793650792*G13_6_0 + 0.00793650793650798*G13_6_1 - 0.00793650793650792*G13_7_0 + 0.00476190476190475*G13_8_1 - 0.00634920634920632*G13_9_0 - 0.0190476190476189*G13_9_1 + 0.00634920634920632*G13_10_0 - 0.0126984126984128*G13_10_1 + 0.019047619047619*G13_11_1;
     A[168] = -0.00634920634920629*G13_6_0 - 0.00634920634920655*G13_6_1 + 0.0317460317460317*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0761904761904756*G13_9_1 - 0.0507936507936507*G13_10_0 - 0.0253968253968254*G13_11_0 - 0.0761904761904762*G13_11_1;
     A[169] = -0.0317460317460317*G13_6_0 - 0.0317460317460319*G13_6_1 + 0.0063492063492063*G13_7_0 + 0.00634920634920641*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.0507936507936502*G13_9_1 - 0.0507936507936507*G13_10_0 + 0.0253968253968258*G13_10_1 + 0.0253968253968254*G13_11_0 - 0.0507936507936508*G13_11_1;
     A[170] = -0.0634920634920634*G13_6_0 - 0.0634920634920639*G13_6_1 + 0.0634920634920634*G13_7_0 - 0.038095238095238*G13_8_1 + 0.0507936507936507*G13_9_0 + 0.152380952380951*G13_9_1 - 0.0507936507936507*G13_10_0 + 0.101587301587302*G13_10_1 - 0.152380952380952*G13_11_1;
     A[171] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_0_1 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_0_1 - 0.0190476190476191*G12_0_0 - 0.0190476190476191*G12_0_1 + 0.0126984126984127*G12_1_0 + 0.0126984126984127*G12_1_1 + 0.00793650793650792*G12_2_0 + 0.00793650793650798*G12_2_1 - 0.00634920634920629*G12_3_0 - 0.00634920634920655*G12_3_1 - 0.0317460317460317*G12_4_0 - 0.0317460317460319*G12_4_1 - 0.0634920634920634*G12_5_0 - 0.0634920634920639*G12_5_1 - 0.01904761 [...]
-    A[172] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_1_0 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_1_0 - 0.0126984126984127*G12_0_0 + 0.0190476190476191*G12_1_0 - 0.00793650793650792*G12_2_0 + 0.0317460317460317*G12_3_0 + 0.0063492063492063*G12_4_0 + 0.0634920634920634*G12_5_0 - 0.0126984126984127*G14_6_0 + 0.0190476190476191*G14_7_0 - 0.00793650793650792*G14_8_0 + 0.0317460317460317*G14_9_0 + 0.0063492063492063*G14_10_0 + 0.0634920634920634*G14_11_0 + 0.01269841 [...]
+    A[172] = -0.666666666666668*G1_0_0_0 - 0.666666666666667*G1_0_1_0 - 0.666666666666668*G3_0_0_0 - 0.666666666666667*G3_0_1_0 - 0.0126984126984127*G12_0_0 + 0.0190476190476191*G12_1_0 - 0.00793650793650792*G12_2_0 + 0.0317460317460317*G12_3_0 + 0.0063492063492063*G12_4_0 + 0.0634920634920634*G12_5_0 - 0.0126984126984127*G14_6_0 + 0.0190476190476191*G14_7_0 - 0.00793650793650792*G14_8_0 + 0.0317460317460317*G14_9_0 + 0.0063492063492063*G14_10_0 + 0.0634920634920634*G14_11_0 + 0.01269841 [...]
     A[173] = -0.00634920634920636*G12_0_1 - 0.00634920634920636*G12_1_1 + 0.00476190476190475*G12_2_1 + 0.00634920634920641*G12_3_1 + 0.00634920634920641*G12_4_1 - 0.038095238095238*G12_5_1 - 0.00634920634920636*G14_6_1 - 0.00634920634920636*G14_7_1 + 0.00476190476190475*G14_8_1 + 0.00634920634920641*G14_9_1 + 0.00634920634920641*G14_10_1 - 0.038095238095238*G14_11_1 + 0.00793650793650792*G15_6_0 + 0.00793650793650798*G15_6_1 - 0.00793650793650792*G15_7_0 + 0.00476190476190475*G15_8_1 -  [...]
     A[174] = -0.666666666666666*G1_0_0_1 - 0.666666666666665*G1_0_1_0 - 1.33333333333332*G1_0_1_1 - 0.666666666666666*G3_0_0_1 - 0.666666666666665*G3_0_1_0 - 1.33333333333332*G3_0_1_1 - 0.00634920634920634*G12_0_0 - 0.0126984126984127*G12_0_1 - 0.00634920634920634*G12_1_0 + 0.019047619047619*G12_1_1 - 0.00634920634920632*G12_2_0 - 0.0190476190476189*G12_2_1 + 0.0507936507936507*G12_3_0 + 0.0761904761904756*G12_3_1 + 0.0507936507936507*G12_4_0 + 0.0507936507936502*G12_4_1 + 0.050793650793 [...]
-    A[175] = 0.666666666666666*G1_0_0_1 + 0.666666666666665*G1_0_1_0 + 0.666666666666666*G3_0_0_1 + 0.666666666666665*G3_0_1_0 + 0.00634920634920634*G12_0_0 + 0.0253968253968254*G12_0_1 + 0.00634920634920634*G12_1_0 - 0.00634920634920631*G12_1_1 + 0.00634920634920632*G12_2_0 - 0.0126984126984128*G12_2_1 - 0.0507936507936507*G12_3_0 - 0.0507936507936507*G12_4_0 + 0.0253968253968258*G12_4_1 - 0.0507936507936507*G12_5_0 + 0.101587301587302*G12_5_1 + 0.00634920634920634*G14_6_0 + 0.025396825 [...]
+    A[175] = 0.666666666666666*G1_0_0_1 + 0.666666666666665*G1_0_1_0 + 0.666666666666666*G3_0_0_1 + 0.666666666666665*G3_0_1_0 + 0.00634920634920634*G12_0_0 + 0.0253968253968254*G12_0_1 + 0.00634920634920634*G12_1_0 - 0.00634920634920632*G12_1_1 + 0.00634920634920632*G12_2_0 - 0.0126984126984128*G12_2_1 - 0.0507936507936507*G12_3_0 - 0.0507936507936507*G12_4_0 + 0.0253968253968258*G12_4_1 - 0.0507936507936507*G12_5_0 + 0.101587301587302*G12_5_1 + 0.00634920634920634*G14_6_0 + 0.025396825 [...]
     A[176] = 1.33333333333334*G1_0_0_0 + 0.666666666666668*G1_0_0_1 + 0.666666666666668*G1_0_1_0 + 1.33333333333333*G1_0_1_1 + 1.33333333333334*G3_0_0_0 + 0.666666666666668*G3_0_0_1 + 0.666666666666668*G3_0_1_0 + 1.33333333333333*G3_0_1_1 + 0.0317460317460318*G12_0_0 + 0.0126984126984127*G12_0_1 - 0.0317460317460318*G12_1_0 - 0.0190476190476191*G12_1_1 + 0.019047619047619*G12_2_1 - 0.0253968253968254*G12_3_0 - 0.0761904761904762*G12_3_1 + 0.0253968253968254*G12_4_0 - 0.0507936507936508*G [...]
     A[177] = -0.166666666666667*G5_0 + 0.166666666666667*G5_1;
     A[178] = 0.166666666666667*G5_0 + 0.333333333333333*G5_1;
     A[179] = 0.166666666666667*G5_1;
-    A[180] = -0.166666666666667*G6_0 - 0.166666666666668*G6_1;
+    A[180] = -0.166666666666667*G6_0 - 0.166666666666667*G6_1;
     A[181] = 0.0;
     A[182] = 0.0;
     A[183] = 0.166666666666666*G6_0 + 0.166666666666665*G6_1;
     A[184] = -0.166666666666666*G6_0 + 0.166666666666668*G6_1;
     A[185] = 0.166666666666667*G6_0 - 0.166666666666667*G6_1;
-    A[186] = -0.166666666666667*G7_0 - 0.166666666666668*G7_1;
+    A[186] = -0.166666666666667*G7_0 - 0.166666666666667*G7_1;
     A[187] = 0.0;
     A[188] = 0.0;
     A[189] = 0.166666666666666*G7_0 + 0.166666666666665*G7_1;
@@ -49148,42 +50318,35 @@ public:
 
 };
 
-/// 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 adaptivenavierstokes_cell_integral_9_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_cell_integral_9_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_cell_integral_9_otherwise()
+  ~adaptivenavierstokes_cell_integral_9_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -49204,19 +50367,7 @@ public:
     // Quadrature points on the UFC reference element: (0.333333333333333, 0.333333333333333), (0.797426985353087, 0.101286507323456), (0.101286507323456, 0.797426985353087), (0.101286507323456, 0.101286507323456), (0.0597158717897698, 0.470142064105115), (0.470142064105115, 0.0597158717897698), (0.470142064105115, 0.470142064105115)
     
     // Values of basis functions at quadrature points.
-    static const double FE0_C0[7][3] = \
-    {{0.333333333333333, 0.333333333333333, 0.333333333333333},
-    {0.101286507323456, 0.797426985353087, 0.101286507323456},
-    {0.101286507323457, 0.101286507323456, 0.797426985353087},
-    {0.797426985353087, 0.101286507323456, 0.101286507323456},
-    {0.470142064105115, 0.0597158717897698, 0.470142064105115},
-    {0.470142064105115, 0.470142064105115, 0.0597158717897697},
-    {0.0597158717897699, 0.470142064105115, 0.470142064105115}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc12[3] = {12, 13, 14};
-    
-    static const double FE1_C0[7][6] = \
+    static const double FE0_C0[7][6] = \
     {{-0.111111111111111, -0.111111111111111, -0.111111111111111, 0.444444444444444, 0.444444444444444, 0.444444444444444},
     {-0.0807685941918872, 0.474352608585538, -0.0807685941918871, 0.323074376767549, 0.0410358262631383, 0.323074376767549},
     {-0.0807685941918872, -0.0807685941918872, 0.474352608585538, 0.323074376767549, 0.323074376767549, 0.0410358262631383},
@@ -49226,40 +50377,52 @@ public:
     {-0.0525839011025454, -0.0280749432230789, -0.0280749432230788, 0.884134241764072, 0.112299772892315, 0.112299772892315}};
     
     // Array of non-zero columns
-    static const unsigned int nzc6[6] = {0, 1, 2, 3, 4, 5};
+    static const unsigned int nzc0[6] = {0, 1, 2, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc9[6] = {6, 7, 8, 9, 10, 11};
+    static const unsigned int nzc3[6] = {6, 7, 8, 9, 10, 11};
     
-    static const double FE1_C0_D01[7][5] = \
+    static const double FE0_C0_D01[7][5] = \
     {{-0.333333333333338, 0.333333333333335, 1.33333333333332, 0.0, -1.33333333333333},
-    {0.59485397070617, -0.594853970706174, 3.18970794141233, 1.22124532708767e-14, -3.18970794141235},
-    {0.594853970706169, 2.18970794141235, 0.405146029293808, -2.78456191211851, -0.405146029293824},
-    {-2.18970794141235, -0.594853970706174, 0.405146029293814, 2.78456191211853, -0.405146029293824},
+    {0.59485397070617, -0.594853970706174, 3.18970794141233, 1.15463194561016e-14, -3.18970794141235},
+    {0.594853970706169, 2.18970794141235, 0.405146029293809, -2.78456191211851, -0.405146029293823},
+    {-2.18970794141235, -0.594853970706174, 0.405146029293815, 2.78456191211853, -0.405146029293824},
     {-0.880568256420466, 0.880568256420462, 0.238863487159066, 0.0, -0.238863487159078},
     {-0.880568256420465, -0.76113651284092, 1.88056825642045, 1.64170476926139, -1.88056825642046},
-    {0.761136512840915, 0.880568256420462, 1.88056825642045, -1.64170476926137, -1.88056825642046}};
+    {0.761136512840916, 0.880568256420462, 1.88056825642045, -1.64170476926137, -1.88056825642046}};
     
     // Array of non-zero columns
-    static const unsigned int nzc7[5] = {0, 2, 3, 4, 5};
+    static const unsigned int nzc1[5] = {0, 2, 3, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc10[5] = {6, 8, 9, 10, 11};
+    static const unsigned int nzc4[5] = {6, 8, 9, 10, 11};
     
-    static const double FE1_C0_D10[7][5] = \
+    static const double FE0_C0_D10[7][5] = \
     {{-0.333333333333333, 0.333333333333333, 1.33333333333333, -1.33333333333333, 0.0},
-    {0.594853970706177, 2.18970794141235, 0.405146029293824, -0.405146029293824, -2.78456191211853},
-    {0.594853970706173, -0.594853970706176, 3.18970794141234, -3.18970794141234, 0.0},
-    {-2.18970794141235, -0.594853970706177, 0.405146029293824, -0.405146029293824, 2.78456191211853},
-    {-0.880568256420461, -0.761136512840922, 1.88056825642046, -1.88056825642046, 1.64170476926138},
-    {-0.88056825642046, 0.880568256420459, 0.238863487159078, -0.238863487159078, 0.0},
+    {0.594853970706176, 2.18970794141235, 0.405146029293824, -0.405146029293824, -2.78456191211853},
+    {0.594853970706174, -0.594853970706175, 3.18970794141234, -3.18970794141234, 0.0},
+    {-2.18970794141235, -0.594853970706178, 0.405146029293824, -0.405146029293824, 2.78456191211853},
+    {-0.880568256420462, -0.761136512840923, 1.88056825642046, -1.88056825642046, 1.64170476926138},
+    {-0.880568256420459, 0.880568256420459, 0.238863487159078, -0.238863487159078, 0.0},
     {0.761136512840922, 0.880568256420461, 1.88056825642046, -1.88056825642046, -1.64170476926138}};
     
     // Array of non-zero columns
-    static const unsigned int nzc8[5] = {0, 1, 3, 4, 5};
+    static const unsigned int nzc2[5] = {0, 1, 3, 4, 5};
+    
+    // Array of non-zero columns
+    static const unsigned int nzc5[5] = {6, 7, 9, 10, 11};
+    
+    static const double FE0_C2[7][3] = \
+    {{0.333333333333333, 0.333333333333333, 0.333333333333333},
+    {0.101286507323456, 0.797426985353087, 0.101286507323456},
+    {0.101286507323457, 0.101286507323456, 0.797426985353087},
+    {0.797426985353087, 0.101286507323456, 0.101286507323456},
+    {0.470142064105115, 0.0597158717897698, 0.470142064105115},
+    {0.470142064105115, 0.470142064105115, 0.0597158717897697},
+    {0.0597158717897699, 0.470142064105115, 0.470142064105115}};
     
     // Array of non-zero columns
-    static const unsigned int nzc11[5] = {6, 7, 9, 10, 11};
+    static const unsigned int nzc6[3] = {12, 13, 14};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 15; r++)
@@ -49272,13 +50435,13 @@ public:
     G[1] = K[2]*det;
     G[2] = K[1]*det;
     G[3] = K[3]*det;
-    G[4] =  - K[3]*det;
+    G[4] =  - K[2]*det;
     G[5] = det*w[2][0]*(K[0]*K[2] + K[1]*K[3]);
     G[6] = det*w[2][0]*(K[2]*K[2] + K[3]*K[3]);
-    G[7] =  - K[1]*det;
+    G[7] =  - K[0]*det;
     G[8] = det*w[2][0]*(K[0]*K[0] + K[1]*K[1]);
-    G[9] =  - K[2]*det;
-    G[10] =  - K[0]*det;
+    G[9] =  - K[3]*det;
+    G[10] =  - K[1]*det;
     
     // Compute element tensor using UFL quadrature representation
     // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
@@ -49300,23 +50463,23 @@ public:
       // Total number of operations to compute function values = 6
       for (unsigned int r = 0; r < 3; r++)
       {
-        F0 += FE0_C0[ip][r]*w[0][nzc12[r]];
+        F0 += FE0_C2[ip][r]*w[0][nzc6[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 40
       for (unsigned int r = 0; r < 5; r++)
       {
-        F1 += FE1_C0_D10[ip][r]*w[0][nzc8[r]];
-        F2 += FE1_C0_D01[ip][r]*w[0][nzc7[r]];
-        F3 += FE1_C0_D10[ip][r]*w[0][nzc11[r]];
-        F4 += FE1_C0_D01[ip][r]*w[0][nzc10[r]];
+        F1 += FE0_C0_D10[ip][r]*w[0][nzc2[r]];
+        F2 += FE0_C0_D01[ip][r]*w[0][nzc1[r]];
+        F3 += FE0_C0_D10[ip][r]*w[0][nzc5[r]];
+        F4 += FE0_C0_D01[ip][r]*w[0][nzc4[r]];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 24
       for (unsigned int r = 0; r < 6; r++)
       {
-        F5 += FE1_C0[ip][r]*w[0][nzc6[r]];
-        F6 += FE1_C0[ip][r]*w[0][nzc9[r]];
+        F5 += FE0_C0[ip][r]*w[0][nzc0[r]];
+        F6 += FE0_C0[ip][r]*w[0][nzc3[r]];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 52
@@ -49325,16 +50488,16 @@ public:
       I[0] = W7[ip]*(F1*G[0] + F2*G[1] + F3*G[2] + F4*G[3]);
       
       // Number of operations: 6
-      I[1] = W7[ip]*(F0*G[4] + F3*G[5] + F4*G[6]);
+      I[1] = W7[ip]*(F0*G[4] + F1*G[5] + F2*G[6]);
       
       // Number of operations: 6
-      I[2] = W7[ip]*(F0*G[7] + F3*G[8] + F4*G[5]);
+      I[2] = W7[ip]*(F0*G[7] + F1*G[8] + F2*G[5]);
       
       // Number of operations: 6
-      I[3] = W7[ip]*(F0*G[9] + F1*G[5] + F2*G[6]);
+      I[3] = W7[ip]*(F0*G[9] + F3*G[5] + F4*G[6]);
       
       // Number of operations: 6
-      I[4] = W7[ip]*(F0*G[10] + F1*G[8] + F2*G[5]);
+      I[4] = W7[ip]*(F0*G[10] + F3*G[8] + F4*G[5]);
       
       // Number of operations: 10
       I[5] = W7[ip]*(F5*(F1*G[0] + F2*G[1]) + F6*(F1*G[2] + F2*G[3]));
@@ -49347,72 +50510,65 @@ public:
       for (unsigned int j = 0; j < 3; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc12[j]] += FE0_C0[ip][j]*I[0];
+        A[nzc6[j]] += FE0_C2[ip][j]*I[0];
       } // end loop over 'j'
       
       // Number of operations for primary indices: 40
       for (unsigned int j = 0; j < 5; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc10[j]] += FE1_C0_D01[ip][j]*I[1];
+        A[nzc1[j]] += FE0_C0_D01[ip][j]*I[1];
         // Number of operations to compute entry: 2
-        A[nzc11[j]] += FE1_C0_D10[ip][j]*I[2];
+        A[nzc2[j]] += FE0_C0_D10[ip][j]*I[2];
         // Number of operations to compute entry: 2
-        A[nzc7[j]] += FE1_C0_D01[ip][j]*I[3];
+        A[nzc4[j]] += FE0_C0_D01[ip][j]*I[3];
         // Number of operations to compute entry: 2
-        A[nzc8[j]] += FE1_C0_D10[ip][j]*I[4];
+        A[nzc5[j]] += FE0_C0_D10[ip][j]*I[4];
       } // end loop over 'j'
       
       // Number of operations for primary indices: 24
       for (unsigned int j = 0; j < 6; j++)
       {
         // Number of operations to compute entry: 2
-        A[nzc6[j]] += FE1_C0[ip][j]*I[5];
+        A[nzc0[j]] += FE0_C0[ip][j]*I[5];
         // Number of operations to compute entry: 2
-        A[nzc9[j]] += FE1_C0[ip][j]*I[6];
+        A[nzc3[j]] += FE0_C0[ip][j]*I[6];
       } // end loop over 'j'
     } // end loop over 'ip'
   }
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivenavierstokes_exterior_facet_integral_9_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_exterior_facet_integral_9_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_exterior_facet_integral_9_otherwise()
+  ~adaptivenavierstokes_exterior_facet_integral_9_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -49427,12 +50583,12 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates[2*facet] - vertex_coordinates[2*v0]) - dx0*(vertex_coordinates[2*facet + 1] - vertex_coordinates[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs[2*facet] - coordinate_dofs[2*v0]) - dx0*(coordinate_dofs[2*facet + 1] - coordinate_dofs[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n0 = direction ? dx1 / det : -dx1 / det;
     const double n1 = direction ? -dx0 / det : dx0 / det;
@@ -49463,27 +50619,27 @@ public:
     // Array of non-zero columns
     static const unsigned int nzc2[2] = {0, 1};
     
-    static const double FE2_f0_C0[2][3] = \
+    static const double FE1_f0_C0[2][3] = \
     {{0.455341801261479, -0.122008467928146, 0.666666666666667},
     {-0.122008467928146, 0.45534180126148, 0.666666666666667}};
     
     // Array of non-zero columns
-    static const unsigned int nzc13[3] = {1, 2, 3};
+    static const unsigned int nzc3[3] = {1, 2, 3};
     
     // Array of non-zero columns
-    static const unsigned int nzc14[3] = {7, 8, 9};
+    static const unsigned int nzc4[3] = {7, 8, 9};
     
     // Array of non-zero columns
-    static const unsigned int nzc16[3] = {0, 2, 4};
+    static const unsigned int nzc6[3] = {0, 2, 4};
     
     // Array of non-zero columns
-    static const unsigned int nzc17[3] = {6, 8, 10};
+    static const unsigned int nzc7[3] = {6, 8, 10};
     
     // Array of non-zero columns
-    static const unsigned int nzc19[3] = {0, 1, 5};
+    static const unsigned int nzc9[3] = {0, 1, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc20[3] = {6, 7, 11};
+    static const unsigned int nzc10[3] = {6, 7, 11};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 15; r++)
@@ -49530,9 +50686,9 @@ public:
         for (unsigned int j = 0; j < 3; j++)
         {
           // Number of operations to compute entry: 2
-          A[nzc13[j]] += FE2_f0_C0[ip][j]*I[0];
+          A[nzc3[j]] += FE1_f0_C0[ip][j]*I[0];
           // Number of operations to compute entry: 2
-          A[nzc14[j]] += FE2_f0_C0[ip][j]*I[1];
+          A[nzc4[j]] += FE1_f0_C0[ip][j]*I[1];
         } // end loop over 'j'
       } // end loop over 'ip'
         break;
@@ -49568,9 +50724,9 @@ public:
         for (unsigned int j = 0; j < 3; j++)
         {
           // Number of operations to compute entry: 2
-          A[nzc16[j]] += FE2_f0_C0[ip][j]*I[0];
+          A[nzc6[j]] += FE1_f0_C0[ip][j]*I[0];
           // Number of operations to compute entry: 2
-          A[nzc17[j]] += FE2_f0_C0[ip][j]*I[1];
+          A[nzc7[j]] += FE1_f0_C0[ip][j]*I[1];
         } // end loop over 'j'
       } // end loop over 'ip'
         break;
@@ -49596,19 +50752,19 @@ public:
         // Number of operations to compute ip constants: 4
         double I[2];
         // Number of operations: 2
-        I[0] = F0*G[0]*W2[ip];
+        I[0] = F0*G[1]*W2[ip];
         
         // Number of operations: 2
-        I[1] = F0*G[1]*W2[ip];
+        I[1] = F0*G[0]*W2[ip];
         
         
         // Number of operations for primary indices: 12
         for (unsigned int j = 0; j < 3; j++)
         {
           // Number of operations to compute entry: 2
-          A[nzc19[j]] += FE2_f0_C0[ip][j]*I[0];
+          A[nzc10[j]] += FE1_f0_C0[ip][j]*I[0];
           // Number of operations to compute entry: 2
-          A[nzc20[j]] += FE2_f0_C0[ip][j]*I[1];
+          A[nzc9[j]] += FE1_f0_C0[ip][j]*I[1];
         } // end loop over 'j'
       } // end loop over 'ip'
         break;
@@ -49619,39 +50775,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class adaptivenavierstokes_exterior_facet_integral_10_0: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_exterior_facet_integral_10_0() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_exterior_facet_integral_10_0()
+  ~adaptivenavierstokes_exterior_facet_integral_10_0() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    6
@@ -49660,7 +50809,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -49673,8 +50822,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -49710,87 +50859,79 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_0()
+  ~adaptivenavierstokes_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "7315455a6c55ac1e50ee9396e41c1d7f23f04f17e8c71825ee60f8cb0f291cc0f8c2609c50c084e8d6e9925a773d29d3a787989fe9888fa3207ff14127386789";
+    return "5597076b43e906e85ef50e9bd61ee48023310167d57bf8f7de76961afafea661bc406718405b8199dc626b96ea2ddd516e256258f24b1c77aa42d210265de88b";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_finite_element_10();
+        return new adaptivenavierstokes_finite_element_12();
         break;
       }
     }
@@ -49798,29 +50939,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_dofmap_10();
+        return new adaptivenavierstokes_dofmap_12();
         break;
       }
     }
@@ -49828,198 +50968,226 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivenavierstokes_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_1()
+  ~adaptivenavierstokes_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "9b37393104457db2780d80c8c85ab821dd707de014083029e347a83bbf5e57d7f817d60a28e825910ab0d683d85321e415f5a625f6e6f1f61290434d028adf3b";
+    return "f0d1224986ec99346a324d60ae81eaf3f6fb43469dc42b203881423d8c9759f83d1e5a52aabd71b0c28f39edd84c1e0246876fda1aca16fa9ed2572cd88c5d08";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     }
@@ -50027,14 +51195,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     }
@@ -50042,77 +51209,92 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 1;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     switch (subdomain_id)
     {
@@ -50126,138 +51308,151 @@ public:
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_2: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_2() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_2()
+  ~adaptivenavierstokes_form_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "c682d3300b864ee652506ae1d27587a734c25e2508c9623e3e22e6333803ba937db88b307e8353bd659886a9a67e4e7871c16a14f2affd322654d72ccfdb4391";
+    return "da3571765f8a617f58ff3aa617deb35fc893aed7d93033440296a99fb8ae28d8df9c87f6847bf7a495526330d961d59446735569641c0853d638e7040ca8d00e";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 4;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_12();
+        return new adaptivenavierstokes_finite_element_0();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_finite_element_10();
+        return new adaptivenavierstokes_finite_element_12();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_finite_element_9();
+        return new adaptivenavierstokes_finite_element_5();
         break;
       }
     }
@@ -50265,29 +51460,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_12();
+        return new adaptivenavierstokes_dofmap_0();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_dofmap_10();
+        return new adaptivenavierstokes_dofmap_12();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_dofmap_9();
+        return new adaptivenavierstokes_dofmap_5();
         break;
       }
     }
@@ -50295,208 +51489,236 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivenavierstokes_cell_integral_2_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivenavierstokes_exterior_facet_integral_2_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_3: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_3() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_3()
+  ~adaptivenavierstokes_form_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "7cabfe3f95dbb90dece2290671781940d8dabb527b6db8c4d74c741135569eea76471b54a831279886f464c388c47bf09178b9f52e9c60b752fec84c2758515f";
+    return "695be2382b2764d196bef4180480082feda16760c28c118dd38babd0796864ffc785daf6c696a2594d1774fb88efd14de379c2a6d1599274b9f4e993fff0d28c";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_5();
+        return new adaptivenavierstokes_finite_element_11();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_5();
+        return new adaptivenavierstokes_finite_element_11();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_finite_element_1();
+        return new adaptivenavierstokes_finite_element_14();
         break;
       }
     }
@@ -50504,24 +51726,23 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_5();
+        return new adaptivenavierstokes_dofmap_11();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_5();
+        return new adaptivenavierstokes_dofmap_11();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_dofmap_1();
+        return new adaptivenavierstokes_dofmap_14();
         break;
       }
     }
@@ -50529,218 +51750,246 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivenavierstokes_cell_integral_3_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_4: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_4() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_4()
+  ~adaptivenavierstokes_form_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "001d42bc5e292ccc3cf53484263aac0309bf302bb4733c3bd15d9860aa58419e4588ee4841d2d23648e4fbd902a1fd39e50c6d041bbfcfdb956712489aa21840";
+    return "96e22a79aa1e8e76ef1e6fb55c717aa6a8124084bfc5055111aa2b60dcf18db5741c27bc243a7cf4dee17517090df51d8d10f2403ea6abe6901ce2411938ba53";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 4;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_5();
+        return new adaptivenavierstokes_finite_element_11();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_finite_element_12();
+        return new adaptivenavierstokes_finite_element_0();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_finite_element_10();
+        return new adaptivenavierstokes_finite_element_12();
         break;
       }
     case 4:
       {
-        return new adaptivenavierstokes_finite_element_1();
+        return new adaptivenavierstokes_finite_element_14();
         break;
       }
     }
@@ -50748,34 +51997,33 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_5();
+        return new adaptivenavierstokes_dofmap_11();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_dofmap_12();
+        return new adaptivenavierstokes_dofmap_0();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_dofmap_10();
+        return new adaptivenavierstokes_dofmap_12();
         break;
       }
     case 4:
       {
-        return new adaptivenavierstokes_dofmap_1();
+        return new adaptivenavierstokes_dofmap_14();
         break;
       }
     }
@@ -50783,208 +52031,236 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivenavierstokes_cell_integral_4_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivenavierstokes_exterior_facet_integral_4_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_5: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_5() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_5()
+  ~adaptivenavierstokes_form_5() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "51b75993ecf7b0b1a97d80de85475e1fc40b9aab6d84f4989f80b90baa7f387d39b9c7a009e0d380156453a1c64725acf1e9e40652d9e2a2414966b0c1702554";
+    return "de4acd7980dc35146d232bdc80a5b79ebe99ddc00da1605bd3e5e1a0140545aeacdefe548c1a4e82fe180b6308565373092d24f967778a8fbb206a78de9f1e9b";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_5();
+        return new adaptivenavierstokes_finite_element_11();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_5();
+        return new adaptivenavierstokes_finite_element_11();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_finite_element_2();
+        return new adaptivenavierstokes_finite_element_8();
         break;
       }
     }
@@ -50992,24 +52268,23 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_5();
+        return new adaptivenavierstokes_dofmap_11();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_5();
+        return new adaptivenavierstokes_dofmap_11();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_dofmap_2();
+        return new adaptivenavierstokes_dofmap_8();
         break;
       }
     }
@@ -51017,223 +52292,251 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivenavierstokes_exterior_facet_integral_5_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return new adaptivenavierstokes_interior_facet_integral_5_otherwise();
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_6: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_6() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_6()
+  ~adaptivenavierstokes_form_6() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "04f9ac8e0bdd607409e440ad89f2c4c1f2ce2401a129a4dc621e25b0bc4c82298239ab5d77f149bfa4b96e8653e63032965a702260fdebca13116ef29fddf247";
+    return "c7b37964a5ff917f54650b524da2de0c63e311f39b75cdfab4f231955d63b613934623821dcddc32e299373e205d4bdbe3f73b4d15b461e116d21670ed329f69";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 5;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3, 4});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_5();
+        return new adaptivenavierstokes_finite_element_11();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_finite_element_12();
+        return new adaptivenavierstokes_finite_element_0();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_finite_element_10();
+        return new adaptivenavierstokes_finite_element_12();
         break;
       }
     case 4:
       {
-        return new adaptivenavierstokes_finite_element_5();
+        return new adaptivenavierstokes_finite_element_11();
         break;
       }
     case 5:
       {
-        return new adaptivenavierstokes_finite_element_2();
+        return new adaptivenavierstokes_finite_element_8();
         break;
       }
     }
@@ -51241,39 +52544,38 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_5();
+        return new adaptivenavierstokes_dofmap_11();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_dofmap_12();
+        return new adaptivenavierstokes_dofmap_0();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_dofmap_10();
+        return new adaptivenavierstokes_dofmap_12();
         break;
       }
     case 4:
       {
-        return new adaptivenavierstokes_dofmap_5();
+        return new adaptivenavierstokes_dofmap_11();
         break;
       }
     case 5:
       {
-        return new adaptivenavierstokes_dofmap_2();
+        return new adaptivenavierstokes_dofmap_8();
         break;
       }
     }
@@ -51281,218 +52583,246 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivenavierstokes_cell_integral_6_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivenavierstokes_exterior_facet_integral_6_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_7: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_7() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_7()
+  ~adaptivenavierstokes_form_7() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "7bb517be129a282a443263443344826631c9aa0c1afa7c6b72721e95a29d28124ca10b5f45b68d7886d52f67064178489f99599fe836086e762b6704690227ef";
+    return "dbde56376dfae87bebc3a63a5ef6acacfbe8e9cf80c90aeba8455b9be3fab078e33ef7f9e1f3e731f8b14760017966592c9770e5ce5d6bfbd0dd559c63da2077";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 4;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_0();
+        return new adaptivenavierstokes_finite_element_13();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_9();
+        return new adaptivenavierstokes_finite_element_5();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_finite_element_5();
+        return new adaptivenavierstokes_finite_element_11();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_finite_element_5();
+        return new adaptivenavierstokes_finite_element_11();
         break;
       }
     case 4:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     }
@@ -51500,34 +52830,33 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_0();
+        return new adaptivenavierstokes_dofmap_13();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_9();
+        return new adaptivenavierstokes_dofmap_5();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_dofmap_5();
+        return new adaptivenavierstokes_dofmap_11();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_dofmap_5();
+        return new adaptivenavierstokes_dofmap_11();
         break;
       }
     case 4:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     }
@@ -51535,213 +52864,241 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivenavierstokes_cell_integral_7_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivenavierstokes_exterior_facet_integral_7_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return new adaptivenavierstokes_interior_facet_integral_7_otherwise();
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_8: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_8() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_8()
+  ~adaptivenavierstokes_form_8() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "8a709ae8ec64fbc68410c13c014fc2a7046737ed457d665c6b78ae4bf1fefdc916839c4dd8a49c14685e1a420d4979c3d82bd3b0a2ac3044083497625984bd86";
+    return "80b29a1a32032e0371a8be3d9d6d96c1aa2f8ffe2235a459217bc7b609a7ce0393321acb9f064cd32f8eaa4c270ec3bcfb1d99cb27f25fb4ea511acbe0f79e6d";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 2});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_finite_element_10();
+        return new adaptivenavierstokes_finite_element_12();
         break;
       }
     }
@@ -51749,29 +53106,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_dofmap_10();
+        return new adaptivenavierstokes_dofmap_12();
         break;
       }
     }
@@ -51779,213 +53135,241 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivenavierstokes_cell_integral_8_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_9: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_9() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_9()
+  ~adaptivenavierstokes_form_9() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "e4136798a0a12d89e6b4f9d2958d7d8285dfb83790c81fbbcffb938afc5a6e4fa98d7307742f170f7b8a91c8215f692f73cd5056e6bc99e3380e6093bc3f1854";
+    return "f82836e3161b48213f009818fe56064b78b2b1aa719f4afdf21744949d12eb75ea97c21d7cd48328369aff513e8b00af1f75d2b146a4f988e05669072697f4f0";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 3;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_finite_element_12();
+        return new adaptivenavierstokes_finite_element_0();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_finite_element_10();
+        return new adaptivenavierstokes_finite_element_12();
         break;
       }
     }
@@ -51993,29 +53377,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 1:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     case 2:
       {
-        return new adaptivenavierstokes_dofmap_12();
+        return new adaptivenavierstokes_dofmap_0();
         break;
       }
     case 3:
       {
-        return new adaptivenavierstokes_dofmap_10();
+        return new adaptivenavierstokes_dofmap_12();
         break;
       }
     }
@@ -52023,198 +53406,226 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new adaptivenavierstokes_cell_integral_9_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new adaptivenavierstokes_exterior_facet_integral_9_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class adaptivenavierstokes_form_10: public ufc::form
 {
 public:
 
-  /// Constructor
   adaptivenavierstokes_form_10() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~adaptivenavierstokes_form_10()
+  ~adaptivenavierstokes_form_10() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "60055e2632ff80a080ffa8fff27089de5f595cfaba9d6939cad81b656796d082ede19480f5e648c11a9a77bb39a33b7067be530fee2acc1caf9a63922ab13b5f";
+    return "4550def622021d5db68cb635ff1f7bd5c9c55866fdda67f7d9bbfd5542aa71e486400216eb53cefd960e41177cf369baba4eb29d1291c7b5cb3e6e60fba95782";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new adaptivenavierstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new adaptivenavierstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_finite_element_13();
+        return new adaptivenavierstokes_finite_element_7();
         break;
       }
     }
@@ -52222,14 +53633,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new adaptivenavierstokes_dofmap_13();
+        return new adaptivenavierstokes_dofmap_7();
         break;
       }
     }
@@ -52237,77 +53647,92 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 1;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     switch (subdomain_id)
     {
@@ -52321,51 +53746,72 @@ public:
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -52379,14 +53825,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace AdaptiveNavierStokes
 {
@@ -52395,43 +53847,20 @@ class CoefficientSpace___cell_bubble: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_bubble(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___cell_bubble(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_bubble(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_14>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_14>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___cell_bubble(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_14>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_14>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52442,43 +53871,20 @@ class CoefficientSpace___cell_cone: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_cone(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___cell_cone(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_8>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_8>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_cone(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___cell_cone(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_8>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_8>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52489,43 +53895,20 @@ class CoefficientSpace___cell_residual: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_residual(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___cell_residual(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___cell_residual(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___cell_residual(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52536,43 +53919,20 @@ class CoefficientSpace___discrete_dual_solution: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___discrete_dual_solution(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___discrete_dual_solution(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___discrete_dual_solution(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___discrete_dual_solution(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52583,43 +53943,20 @@ class CoefficientSpace___facet_residual: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___facet_residual(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___facet_residual(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___facet_residual(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___facet_residual(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52630,43 +53967,20 @@ class CoefficientSpace___improved_dual: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___improved_dual(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_9()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_9()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace___improved_dual(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_9()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_9()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_5>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace___improved_dual(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_9()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_9()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace___improved_dual(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_9()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_9()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_5>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52677,43 +53991,20 @@ class CoefficientSpace_nu: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_nu(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_10()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_10()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_nu(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_10()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_10()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_12>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_12>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_nu(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_10()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_10()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_nu(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_10()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_10()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_12>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_12>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52724,43 +54015,20 @@ class CoefficientSpace_p0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_12()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_12()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_p0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_12()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_12()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_12()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_12()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_p0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_12()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_12()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52771,43 +54039,20 @@ class CoefficientSpace_w: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_w(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_w(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52818,43 +54063,20 @@ class Form_0_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_0_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_0_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_0_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_0_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52865,43 +54087,20 @@ class Form_0_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_0_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_0_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_0_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_0_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -52917,53 +54116,17 @@ class Form_0: public dolfin::Form
 public:
 
   // Constructor
-  Form_0(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_0());
-  }
-
-  // Constructor
-  Form_0(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& nu):
-    dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->w = w;
-    this->nu = nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_0());
-  }
-
-  // Constructor
-  Form_0(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->w = *w;
-    this->nu = *nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_0());
-  }
-
-  // Constructor
   Form_0(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
   {
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_0());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_0>();
   }
 
   // Constructor
-  Form_0(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& nu):
+  Form_0(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> nu):
     dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
   {
     _function_spaces[0] = V0;
@@ -52972,20 +54135,7 @@ public:
     this->w = w;
     this->nu = nu;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_0());
-  }
-
-  // Constructor
-  Form_0(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->w = *w;
-    this->nu = *nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_0());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_0>();
   }
 
   // Destructor
@@ -53034,47 +54184,25 @@ public:
   dolfin::CoefficientAssigner nu;
 };
 
+
 class Form_1_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_1_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_1_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_1_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_1_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -53086,21 +54214,12 @@ class Form_1: public dolfin::Form
 public:
 
   // Constructor
-  Form_1(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_1());
-  }
-
-  // Constructor
   Form_1(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 0)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_1());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_1>();
   }
 
   // Destructor
@@ -53133,6 +54252,7 @@ public:
   // Coefficients
 };
 
+
 typedef CoefficientSpace_w Form_2_FunctionSpace_0;
 
 typedef CoefficientSpace_p0 Form_2_FunctionSpace_1;
@@ -53146,49 +54266,15 @@ class Form_2: public dolfin::Form
 public:
 
   // Constructor
-  Form_2(const dolfin::Mesh& mesh):
-    dolfin::Form(0, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __improved_dual(*this, 3)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_2());
-  }
-
-  // Constructor
-  Form_2(const dolfin::Mesh& mesh, const dolfin::GenericFunction& w, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& nu, const dolfin::GenericFunction& __improved_dual):
-    dolfin::Form(0, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __improved_dual(*this, 3)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->w = w;
-    this->p0 = p0;
-    this->nu = nu;
-    this->__improved_dual = __improved_dual;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_2());
-  }
-
-  // Constructor
-  Form_2(const dolfin::Mesh& mesh, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu, std::shared_ptr<const dolfin::GenericFunction> __improved_dual):
-    dolfin::Form(0, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __improved_dual(*this, 3)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->w = *w;
-    this->p0 = *p0;
-    this->nu = *nu;
-    this->__improved_dual = *__improved_dual;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_2());
-  }
-
-  // Constructor
   Form_2(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::Form(0, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __improved_dual(*this, 3)
   {
     _mesh = mesh;
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_2());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_2>();
   }
 
   // Constructor
-  Form_2(std::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& w, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& nu, const dolfin::GenericFunction& __improved_dual):
+  Form_2(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu, std::shared_ptr<const dolfin::GenericFunction> __improved_dual):
     dolfin::Form(0, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __improved_dual(*this, 3)
   {
     _mesh = mesh;
@@ -53197,20 +54283,7 @@ public:
     this->nu = nu;
     this->__improved_dual = __improved_dual;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_2());
-  }
-
-  // Constructor
-  Form_2(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu, std::shared_ptr<const dolfin::GenericFunction> __improved_dual):
-    dolfin::Form(0, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __improved_dual(*this, 3)
-  {
-    _mesh = mesh;
-    this->w = *w;
-    this->p0 = *p0;
-    this->nu = *nu;
-    this->__improved_dual = *__improved_dual;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_2());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_2>();
   }
 
   // Destructor
@@ -53269,47 +54342,25 @@ public:
   dolfin::CoefficientAssigner __improved_dual;
 };
 
+
 class Form_3_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_3_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_3_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_3_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_3_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -53320,43 +54371,20 @@ class Form_3_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_3_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_3_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_3_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_3_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -53370,59 +54398,13 @@ class Form_3: public dolfin::Form
 public:
 
   // Constructor
-  Form_3(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 1), __cell_bubble(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_3());
-  }
-
-  // Constructor
-  Form_3(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& __cell_bubble):
-    dolfin::Form(2, 1), __cell_bubble(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->__cell_bubble = __cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_3());
-  }
-
-  // Constructor
-  Form_3(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> __cell_bubble):
-    dolfin::Form(2, 1), __cell_bubble(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->__cell_bubble = *__cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_3());
-  }
-
-  // Constructor
   Form_3(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 1), __cell_bubble(*this, 0)
   {
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_3());
-  }
-
-  // Constructor
-  Form_3(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& __cell_bubble):
-    dolfin::Form(2, 1), __cell_bubble(*this, 0)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->__cell_bubble = __cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_3());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_3>();
   }
 
   // Constructor
@@ -53432,9 +54414,9 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    this->__cell_bubble = *__cell_bubble;
+    this->__cell_bubble = __cell_bubble;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_3());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_3>();
   }
 
   // Destructor
@@ -53477,47 +54459,25 @@ public:
   dolfin::CoefficientAssigner __cell_bubble;
 };
 
+
 class Form_4_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_4_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_4_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_4_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_4_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -53537,53 +54497,16 @@ class Form_4: public dolfin::Form
 public:
 
   // Constructor
-  Form_4(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_bubble(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_4());
-  }
-
-  // Constructor
-  Form_4(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& nu, const dolfin::GenericFunction& __cell_bubble):
-    dolfin::Form(1, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_bubble(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->w = w;
-    this->p0 = p0;
-    this->nu = nu;
-    this->__cell_bubble = __cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_4());
-  }
-
-  // Constructor
-  Form_4(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu, std::shared_ptr<const dolfin::GenericFunction> __cell_bubble):
-    dolfin::Form(1, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_bubble(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->w = *w;
-    this->p0 = *p0;
-    this->nu = *nu;
-    this->__cell_bubble = *__cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_4());
-  }
-
-  // Constructor
   Form_4(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_bubble(*this, 3)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_4());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_4>();
   }
 
   // Constructor
-  Form_4(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& nu, const dolfin::GenericFunction& __cell_bubble):
+  Form_4(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu, std::shared_ptr<const dolfin::GenericFunction> __cell_bubble):
     dolfin::Form(1, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_bubble(*this, 3)
   {
     _function_spaces[0] = V0;
@@ -53593,21 +54516,7 @@ public:
     this->nu = nu;
     this->__cell_bubble = __cell_bubble;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_4());
-  }
-
-  // Constructor
-  Form_4(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu, std::shared_ptr<const dolfin::GenericFunction> __cell_bubble):
-    dolfin::Form(1, 4), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_bubble(*this, 3)
-  {
-    _function_spaces[0] = V0;
-
-    this->w = *w;
-    this->p0 = *p0;
-    this->nu = *nu;
-    this->__cell_bubble = *__cell_bubble;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_4());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_4>();
   }
 
   // Destructor
@@ -53667,47 +54576,25 @@ public:
   dolfin::CoefficientAssigner __cell_bubble;
 };
 
+
 class Form_5_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_5_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_5_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_5_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_5_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -53718,43 +54605,20 @@ class Form_5_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_5_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_5_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_5_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_5_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -53768,59 +54632,13 @@ class Form_5: public dolfin::Form
 public:
 
   // Constructor
-  Form_5(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 1), __cell_cone(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_5());
-  }
-
-  // Constructor
-  Form_5(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& __cell_cone):
-    dolfin::Form(2, 1), __cell_cone(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->__cell_cone = __cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_5());
-  }
-
-  // Constructor
-  Form_5(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> __cell_cone):
-    dolfin::Form(2, 1), __cell_cone(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->__cell_cone = *__cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_5());
-  }
-
-  // Constructor
   Form_5(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 1), __cell_cone(*this, 0)
   {
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_5());
-  }
-
-  // Constructor
-  Form_5(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& __cell_cone):
-    dolfin::Form(2, 1), __cell_cone(*this, 0)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->__cell_cone = __cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_5());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_5>();
   }
 
   // Constructor
@@ -53830,9 +54648,9 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    this->__cell_cone = *__cell_cone;
+    this->__cell_cone = __cell_cone;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_5());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_5>();
   }
 
   // Destructor
@@ -53875,47 +54693,25 @@ public:
   dolfin::CoefficientAssigner __cell_cone;
 };
 
+
 class Form_6_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_6_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_6_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_6_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_6_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_5()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_5()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_11>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_11>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -53937,55 +54733,16 @@ class Form_6: public dolfin::Form
 public:
 
   // Constructor
-  Form_6(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 5), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_6());
-  }
-
-  // Constructor
-  Form_6(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& nu, const dolfin::GenericFunction& __cell_residual, const dolfin::GenericFunction& __cell_cone):
-    dolfin::Form(1, 5), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->w = w;
-    this->p0 = p0;
-    this->nu = nu;
-    this->__cell_residual = __cell_residual;
-    this->__cell_cone = __cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_6());
-  }
-
-  // Constructor
-  Form_6(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __cell_cone):
-    dolfin::Form(1, 5), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->w = *w;
-    this->p0 = *p0;
-    this->nu = *nu;
-    this->__cell_residual = *__cell_residual;
-    this->__cell_cone = *__cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_6());
-  }
-
-  // Constructor
   Form_6(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 5), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_6());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_6>();
   }
 
   // Constructor
-  Form_6(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& nu, const dolfin::GenericFunction& __cell_residual, const dolfin::GenericFunction& __cell_cone):
+  Form_6(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __cell_cone):
     dolfin::Form(1, 5), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
   {
     _function_spaces[0] = V0;
@@ -53996,22 +54753,7 @@ public:
     this->__cell_residual = __cell_residual;
     this->__cell_cone = __cell_cone;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_6());
-  }
-
-  // Constructor
-  Form_6(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __cell_cone):
-    dolfin::Form(1, 5), w(*this, 0), p0(*this, 1), nu(*this, 2), __cell_residual(*this, 3), __cell_cone(*this, 4)
-  {
-    _function_spaces[0] = V0;
-
-    this->w = *w;
-    this->p0 = *p0;
-    this->nu = *nu;
-    this->__cell_residual = *__cell_residual;
-    this->__cell_cone = *__cell_cone;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_6());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_6>();
   }
 
   // Destructor
@@ -54077,47 +54819,25 @@ public:
   dolfin::CoefficientAssigner __cell_cone;
 };
 
+
 class Form_7_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_7_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_7_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_13>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_13>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_7_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_7_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_13>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_13>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -54137,53 +54857,16 @@ class Form_7: public dolfin::Form
 public:
 
   // Constructor
-  Form_7(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_7());
-  }
-
-  // Constructor
-  Form_7(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& __improved_dual, const dolfin::GenericFunction& __cell_residual, const dolfin::GenericFunction& __facet_residual, const dolfin::GenericFunction& __discrete_dual_solution):
-    dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->__improved_dual = __improved_dual;
-    this->__cell_residual = __cell_residual;
-    this->__facet_residual = __facet_residual;
-    this->__discrete_dual_solution = __discrete_dual_solution;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_7());
-  }
-
-  // Constructor
-  Form_7(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> __improved_dual, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __facet_residual, std::shared_ptr<const dolfin::GenericFunction> __discrete_dual_solution):
-    dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->__improved_dual = *__improved_dual;
-    this->__cell_residual = *__cell_residual;
-    this->__facet_residual = *__facet_residual;
-    this->__discrete_dual_solution = *__discrete_dual_solution;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_7());
-  }
-
-  // Constructor
   Form_7(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_7());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_7>();
   }
 
   // Constructor
-  Form_7(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& __improved_dual, const dolfin::GenericFunction& __cell_residual, const dolfin::GenericFunction& __facet_residual, const dolfin::GenericFunction& __discrete_dual_solution):
+  Form_7(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> __improved_dual, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __facet_residual, std::shared_ptr<const dolfin::GenericFunction> __discrete_dual_solution):
     dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
   {
     _function_spaces[0] = V0;
@@ -54193,21 +54876,7 @@ public:
     this->__facet_residual = __facet_residual;
     this->__discrete_dual_solution = __discrete_dual_solution;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_7());
-  }
-
-  // Constructor
-  Form_7(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> __improved_dual, std::shared_ptr<const dolfin::GenericFunction> __cell_residual, std::shared_ptr<const dolfin::GenericFunction> __facet_residual, std::shared_ptr<const dolfin::GenericFunction> __discrete_dual_solution):
-    dolfin::Form(1, 4), __improved_dual(*this, 0), __cell_residual(*this, 1), __facet_residual(*this, 2), __discrete_dual_solution(*this, 3)
-  {
-    _function_spaces[0] = V0;
-
-    this->__improved_dual = *__improved_dual;
-    this->__cell_residual = *__cell_residual;
-    this->__facet_residual = *__facet_residual;
-    this->__discrete_dual_solution = *__discrete_dual_solution;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_7());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_7>();
   }
 
   // Destructor
@@ -54267,47 +54936,25 @@ public:
   dolfin::CoefficientAssigner __discrete_dual_solution;
 };
 
+
 class Form_lhs_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_lhs_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_lhs_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_lhs_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_lhs_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -54318,43 +54965,20 @@ class Form_lhs_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_lhs_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_lhs_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_lhs_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_lhs_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -54370,53 +54994,17 @@ class Form_lhs: public dolfin::Form
 public:
 
   // Constructor
-  Form_lhs(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_8());
-  }
-
-  // Constructor
-  Form_lhs(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& nu):
-    dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->w = w;
-    this->nu = nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_8());
-  }
-
-  // Constructor
-  Form_lhs(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->w = *w;
-    this->nu = *nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_8());
-  }
-
-  // Constructor
   Form_lhs(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
   {
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_8());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_8>();
   }
 
   // Constructor
-  Form_lhs(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& nu):
+  Form_lhs(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> nu):
     dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
   {
     _function_spaces[0] = V0;
@@ -54425,20 +55013,7 @@ public:
     this->w = w;
     this->nu = nu;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_8());
-  }
-
-  // Constructor
-  Form_lhs(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(2, 2), w(*this, 0), nu(*this, 1)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->w = *w;
-    this->nu = *nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_8());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_8>();
   }
 
   // Destructor
@@ -54487,47 +55062,25 @@ public:
   dolfin::CoefficientAssigner nu;
 };
 
+
 class Form_rhs_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_rhs_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_rhs_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_rhs_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_rhs_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new adaptivenavierstokes_finite_element_13()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new adaptivenavierstokes_dofmap_13()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<adaptivenavierstokes_finite_element_7>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<adaptivenavierstokes_dofmap_7>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -54545,51 +55098,16 @@ class Form_rhs: public dolfin::Form
 public:
 
   // Constructor
-  Form_rhs(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 3), w(*this, 0), p0(*this, 1), nu(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_9());
-  }
-
-  // Constructor
-  Form_rhs(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& nu):
-    dolfin::Form(1, 3), w(*this, 0), p0(*this, 1), nu(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->w = w;
-    this->p0 = p0;
-    this->nu = nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_9());
-  }
-
-  // Constructor
-  Form_rhs(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(1, 3), w(*this, 0), p0(*this, 1), nu(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->w = *w;
-    this->p0 = *p0;
-    this->nu = *nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_9());
-  }
-
-  // Constructor
   Form_rhs(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 3), w(*this, 0), p0(*this, 1), nu(*this, 2)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_9());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_9>();
   }
 
   // Constructor
-  Form_rhs(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& w, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& nu):
+  Form_rhs(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu):
     dolfin::Form(1, 3), w(*this, 0), p0(*this, 1), nu(*this, 2)
   {
     _function_spaces[0] = V0;
@@ -54598,20 +55116,7 @@ public:
     this->p0 = p0;
     this->nu = nu;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_9());
-  }
-
-  // Constructor
-  Form_rhs(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> nu):
-    dolfin::Form(1, 3), w(*this, 0), p0(*this, 1), nu(*this, 2)
-  {
-    _function_spaces[0] = V0;
-
-    this->w = *w;
-    this->p0 = *p0;
-    this->nu = *nu;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_9());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_9>();
   }
 
   // Destructor
@@ -54665,6 +55170,7 @@ public:
   dolfin::CoefficientAssigner nu;
 };
 
+
 typedef CoefficientSpace_w Form_goal_FunctionSpace_0;
 
 class Form_goal: public dolfin::GoalFunctional
@@ -54672,49 +55178,11 @@ class Form_goal: public dolfin::GoalFunctional
 public:
 
   // Constructor
-  Form_goal(const dolfin::Mesh& mesh):
-    dolfin::GoalFunctional(0, 1), w(*this, 0)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_10());
-  }
-
-  // Constructor
-  Form_goal(const dolfin::Mesh& mesh, const dolfin::GenericFunction& w):
-    dolfin::GoalFunctional(0, 1), w(*this, 0)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->w = w;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_10());
-  }
-
-  // Constructor
-  Form_goal(const dolfin::Mesh& mesh, std::shared_ptr<const dolfin::GenericFunction> w):
-    dolfin::GoalFunctional(0, 1), w(*this, 0)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->w = *w;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_10());
-  }
-
-  // Constructor
   Form_goal(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::GoalFunctional(0, 1), w(*this, 0)
   {
     _mesh = mesh;
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_10());
-  }
-
-  // Constructor
-  Form_goal(std::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& w):
-    dolfin::GoalFunctional(0, 1), w(*this, 0)
-  {
-    _mesh = mesh;
-    this->w = w;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_10());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_10>();
   }
 
   // Constructor
@@ -54722,9 +55190,9 @@ public:
     dolfin::GoalFunctional(0, 1), w(*this, 0)
   {
     _mesh = mesh;
-    this->w = *w;
+    this->w = w;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new adaptivenavierstokes_form_10());
+    _ufc_form = std::make_shared<const adaptivenavierstokes_form_10>();
   }
 
   // Destructor
@@ -54788,10 +55256,15 @@ public:
     std::shared_ptr<dolfin::Form> eta_T;            // Indicator form
 
     // Some handy views
-    const dolfin::FunctionSpace& Vhat(*(a.function_space(0))); // Primal test
-    const dolfin::FunctionSpace& V(*(a.function_space(1)));    // Primal trial
-    assert(V.mesh());
-    const dolfin::Mesh& mesh(*V.mesh());
+    assert(a.function_space(0));
+    const auto Vhat = a.function_space(0); // Primal test
+
+    assert(a.function_space(0));
+    const auto V = a.function_space(1);    // Primal trial
+
+    assert(V->mesh());
+    const auto mesh = V->mesh();
+
     std::string name;
 
     // Initialize dual forms
@@ -55025,11 +55498,11 @@ public:
     _ec.reset(new dolfin::ErrorControl(a_star, L_star, residual,
                                        a_R_T, L_R_T, a_R_dT, L_R_dT, eta_T,
                                        false));
-
   }
 
 };
 
+
 // Class typedefs
 typedef Form_lhs BilinearForm;
 typedef Form_rhs LinearForm;
diff --git a/demo/undocumented/auto-adaptive-navier-stokes/cpp/CMakeLists.txt b/demo/undocumented/auto-adaptive-navier-stokes/cpp/CMakeLists.txt
index 6dcfe11..249432e 100644
--- a/demo/undocumented/auto-adaptive-navier-stokes/cpp/CMakeLists.txt
+++ b/demo/undocumented/auto-adaptive-navier-stokes/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/auto-adaptive-navier-stokes/cpp/compile.log b/demo/undocumented/auto-adaptive-navier-stokes/cpp/compile.log
index 5e6e435..ef161fe 100644
--- a/demo/undocumented/auto-adaptive-navier-stokes/cpp/compile.log
+++ b/demo/undocumented/auto-adaptive-navier-stokes/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form AdaptiveNavierStokes
 
@@ -12,9 +13,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    2
   Coefficients:              '[w_0, w_2]'
-  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, R0(?)'
+  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, R0(?), Vector<2 x C
+                             G1(?)>'
   Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, R0(?), Vector<2 x C
-                             G2(?)>, CG1(?), CG2(?)'
+                             G1(?)>, Vector<2 x CG2(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -103,9 +105,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 3
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   
   Geometric dimension:                 2
   Number of exterior_facet subdomains: 1
@@ -113,9 +115,11 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              0
   Coefficients:                        '[]'
-  Unique elements:                     'Mixed<Vector<2 x CG2(?)>, CG1(?)>'
+  Unique elements:                     'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 
+                                       x CG1(?)>'
   Unique sub elements:                 'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 
-                                       x CG2(?)>, CG1(?), CG2(?)'
+                                       x CG1(?)>, Vector<2 x CG2(?)>, CG1(?), CG2(?)
+                                       '
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -123,9 +127,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 0
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -135,11 +139,12 @@ Compiler stage 1: Analyzing form(s)
   Number of coefficients:              4
   Coefficients:                        '[w_0, w_1, w_2, w_3]'
   Unique elements:                     'Mixed<Vector<2 x CG2(?)>, CG1(?)>, CG1(?), R
-                                       0(?), Mixed<Mixed<CG3(?), CG3(?)>, CG2(?)>'
+                                       0(?), Mixed<Vector<2 x CG3(?)>, CG2(?)>, Vect
+                                       or<2 x CG1(?)>'
   Unique sub elements:                 'Mixed<Vector<2 x CG2(?)>, CG1(?)>, CG1(?), R
-                                       0(?), Mixed<Mixed<CG3(?), CG3(?)>, CG2(?)>, V
-                                       ector<2 x CG2(?)>, Mixed<CG3(?), CG3(?)>, CG2
-                                       (?), CG3(?)'
+                                       0(?), Mixed<Vector<2 x CG3(?)>, CG2(?)>, Vect
+                                       or<2 x CG1(?)>, Vector<2 x CG2(?)>, Vector<2 
+                                       x CG3(?)>, CG2(?), CG3(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -206,16 +211,16 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 5
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -223,9 +228,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    1
   Coefficients:              '[w_4]'
-  Unique elements:           'Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, B3(?)'
-  Unique sub elements:       'Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, B3(?), Mixed<DG2
-                             (?), DG2(?)>, DG1(?), DG2(?)'
+  Unique elements:           'Mixed<Vector<2 x DG2(?)>, DG1(?)>, B3(?), Vector<2 x C
+                             G1(?)>'
+  Unique sub elements:       'Mixed<Vector<2 x DG2(?)>, DG1(?)>, B3(?), Vector<2 x C
+                             G1(?)>, Vector<2 x DG2(?)>, DG1(?), CG1(?), DG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -239,9 +245,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 7
-  quadrature_degree: auto --> 7
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 7
+  quadrature_degree: 7
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -250,13 +256,13 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              4
   Coefficients:                        '[w_0, w_1, w_2, w_4]'
-  Unique elements:                     'Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, Mixed<
-                                       Vector<2 x CG2(?)>, CG1(?)>, CG1(?), R0(?), B
-                                       3(?)'
-  Unique sub elements:                 'Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, Mixed<
-                                       Vector<2 x CG2(?)>, CG1(?)>, CG1(?), R0(?), B
-                                       3(?), Mixed<DG2(?), DG2(?)>, DG1(?), Vector<2
-                                        x CG2(?)>, DG2(?), CG2(?)'
+  Unique elements:                     'Mixed<Vector<2 x DG2(?)>, DG1(?)>, Mixed<Vec
+                                       tor<2 x CG2(?)>, CG1(?)>, CG1(?), R0(?), B3(?
+                                       ), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'Mixed<Vector<2 x DG2(?)>, DG1(?)>, Mixed<Vec
+                                       tor<2 x CG2(?)>, CG1(?)>, CG1(?), R0(?), B3(?
+                                       ), Vector<2 x CG1(?)>, Vector<2 x DG2(?)>, DG
+                                       1(?), Vector<2 x CG2(?)>, DG2(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -368,16 +374,16 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 5
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 8
-  quadrature_degree: auto --> 8
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 8
+  quadrature_degree: 8
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   
   Geometric dimension:                 2
   Number of exterior_facet subdomains: 0
@@ -386,10 +392,11 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0, v_1)'
   Number of coefficients:              1
   Coefficients:                        '[w_6]'
-  Unique elements:                     'Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, DG2(?)
-                                       '
-  Unique sub elements:                 'Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, DG2(?)
-                                       , Mixed<DG2(?), DG2(?)>, DG1(?)'
+  Unique elements:                     'Mixed<Vector<2 x DG2(?)>, DG1(?)>, DG2(?), V
+                                       ector<2 x CG1(?)>'
+  Unique sub elements:                 'Mixed<Vector<2 x DG2(?)>, DG1(?)>, DG2(?), V
+                                       ector<2 x CG1(?)>, Vector<2 x DG2(?)>, DG1(?)
+                                       , CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -404,9 +411,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -429,9 +436,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -440,13 +447,13 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              5
   Coefficients:                        '[w_0, w_1, w_2, w_5, w_6]'
-  Unique elements:                     'Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, Mixed<
-                                       Vector<2 x CG2(?)>, CG1(?)>, CG1(?), R0(?), D
-                                       G2(?)'
-  Unique sub elements:                 'Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, Mixed<
-                                       Vector<2 x CG2(?)>, CG1(?)>, CG1(?), R0(?), D
-                                       G2(?), Mixed<DG2(?), DG2(?)>, DG1(?), Vector<
-                                       2 x CG2(?)>, CG2(?)'
+  Unique elements:                     'Mixed<Vector<2 x DG2(?)>, DG1(?)>, Mixed<Vec
+                                       tor<2 x CG2(?)>, CG1(?)>, CG1(?), R0(?), DG2(
+                                       ?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'Mixed<Vector<2 x DG2(?)>, DG1(?)>, Mixed<Vec
+                                       tor<2 x CG2(?)>, CG1(?)>, CG1(?), R0(?), DG2(
+                                       ?), Vector<2 x CG1(?)>, Vector<2 x DG2(?)>, D
+                                       G1(?), Vector<2 x CG2(?)>, CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -573,16 +580,16 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 5
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 7
-  quadrature_degree: auto --> 7
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 7
+  quadrature_degree: 7
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -592,14 +599,15 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              4
   Coefficients:                        '[w_3, w_5, w_7, w_8]'
-  Unique elements:                     'DG0(?), Mixed<Mixed<CG3(?), CG3(?)>, CG2(?)>
-                                       , Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, Mixed
-                                       <Vector<2 x CG2(?)>, CG1(?)>'
-  Unique sub elements:                 'DG0(?), Mixed<Mixed<CG3(?), CG3(?)>, CG2(?)>
-                                       , Mixed<Mixed<DG2(?), DG2(?)>, DG1(?)>, Mixed
-                                       <Vector<2 x CG2(?)>, CG1(?)>, Mixed<CG3(?), C
-                                       G3(?)>, CG2(?), Mixed<DG2(?), DG2(?)>, DG1(?)
-                                       , Vector<2 x CG2(?)>, CG1(?), CG3(?), DG2(?)'
+  Unique elements:                     'DG0(?), Mixed<Vector<2 x CG3(?)>, CG2(?)>, M
+                                       ixed<Vector<2 x DG2(?)>, DG1(?)>, Mixed<Vecto
+                                       r<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:                 'DG0(?), Mixed<Vector<2 x CG3(?)>, CG2(?)>, M
+                                       ixed<Vector<2 x DG2(?)>, DG1(?)>, Mixed<Vecto
+                                       r<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1(?)>, V
+                                       ector<2 x CG3(?)>, CG2(?), Vector<2 x DG2(?)>
+                                       , DG1(?), Vector<2 x CG2(?)>, CG1(?), CG3(?),
+                                        DG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -622,9 +630,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -647,9 +655,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -726,9 +734,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -736,9 +744,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    2
   Coefficients:              '[w_0, w_2]'
-  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, R0(?)'
+  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, R0(?), Vector<2 x C
+                             G1(?)>'
   Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, R0(?), Vector<2 x C
-                             G2(?)>, CG1(?), CG2(?)'
+                             G1(?)>, Vector<2 x CG2(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -828,9 +837,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 3
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -840,9 +849,10 @@ Compiler stage 1: Analyzing form(s)
   Number of coefficients:              3
   Coefficients:                        '[w_0, w_1, w_2]'
   Unique elements:                     'Mixed<Vector<2 x CG2(?)>, CG1(?)>, CG1(?), R
-                                       0(?)'
+                                       0(?), Vector<2 x CG1(?)>'
   Unique sub elements:                 'Mixed<Vector<2 x CG2(?)>, CG1(?)>, CG1(?), R
-                                       0(?), Vector<2 x CG2(?)>, CG2(?)'
+                                       0(?), Vector<2 x CG1(?)>, Vector<2 x CG2(?)>,
+                                        CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -908,16 +918,16 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   
   Geometric dimension:                 2
   Number of exterior_facet subdomains: 1
@@ -925,9 +935,11 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '()'
   Number of coefficients:              1
   Coefficients:                        '[w_0]'
-  Unique elements:                     'Mixed<Vector<2 x CG2(?)>, CG1(?)>'
+  Unique elements:                     'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 
+                                       x CG1(?)>'
   Unique sub elements:                 'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 
-                                       x CG2(?)>, CG1(?), CG2(?)'
+                                       x CG1(?)>, Vector<2 x CG2(?)>, CG1(?), CG2(?)
+                                       '
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -935,15 +947,24 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.557169 seconds.
+Compiler stage 1 finished in 0.990452 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 14 elements
+  Computing representation of 15 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -975,7 +996,6 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 14 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -985,11 +1005,24 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 15 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -1081,7 +1114,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  900 entries computed in 0.0016 seconds
+  900 entries computed in 0.00152 seconds
   Shape of reference tensor: (15, 15, 1, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 3 dims = [1, 2, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1]]
@@ -1091,7 +1124,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  900 entries computed in 0.00159 seconds
+  900 entries computed in 0.00143 seconds
   Shape of reference tensor: (15, 15, 1, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 3 dims = [1, 2, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1]]
@@ -1101,7 +1134,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  900 entries computed in 0.00151 seconds
+  900 entries computed in 0.00154 seconds
   Shape of reference tensor: (15, 15, 1, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 3 dims = [1, 2, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1]]
@@ -1120,7 +1153,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.0012 seconds
+  450 entries computed in 0.00116 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -1129,7 +1162,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.0012 seconds
+  450 entries computed in 0.00113 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -1138,7 +1171,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00119 seconds
+  450 entries computed in 0.0011 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -1147,7 +1180,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.0012 seconds
+  450 entries computed in 0.00111 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -1156,7 +1189,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00162 seconds
+  6750 entries computed in 0.00158 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -1165,7 +1198,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00165 seconds
+  6750 entries computed in 0.00156 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -1174,7 +1207,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00155 seconds
+  6750 entries computed in 0.0015 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -1183,7 +1216,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00153 seconds
+  6750 entries computed in 0.00148 seconds
   Shape of reference tensor: (15, 15, 2, 15)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14]]
@@ -1192,7 +1225,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00164 seconds
+  6750 entries computed in 0.00159 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -1201,7 +1234,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00161 seconds
+  6750 entries computed in 0.00157 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -1210,7 +1243,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.0016 seconds
+  6750 entries computed in 0.00156 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -1219,7 +1252,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00162 seconds
+  6750 entries computed in 0.00165 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -1228,6 +1261,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1235,7 +1269,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  15 entries computed in 0.00112 seconds
+  15 entries computed in 0.00113 seconds
   Shape of reference tensor: (15,)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -1244,7 +1278,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  15 entries computed in 0.00104 seconds
+  15 entries computed in 0.000998 seconds
   Shape of reference tensor: (15,)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -1253,7 +1287,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  15 entries computed in 0.00102 seconds
+  15 entries computed in 0.000985 seconds
   Shape of reference tensor: (15,)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -1261,6 +1295,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 0 dims = [] indices = [[]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
@@ -1273,10 +1308,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {12: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]])}}}, MixedElement(*[MixedElement(*[FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 3, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 3, quad_scheme=None)], **{'value_shape': (2,) }), FiniteElement('Lagrange', Domain( [...]
-             4.04638309e-01,   4.04638309e-01,   1.18553235e-01,
-            -5.59823902e-01,   4.92870367e-01,  -5.59823902e-01,
-            -7.40805832e-01,   4.92870367e-01,  -7.40805832e-01],
+  {12: {MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): array([[[  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
+             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
+             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
+            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1286,10 +1321,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -4.94049246e-15,   7.77156117e-15,  -6.66133815e-16,
-             1.85615412e-15,   4.49640325e-15,   3.27168848e-15,
-             3.05311332e-16,  -1.27675648e-15,   3.60475538e-15,
-             2.77555756e-16,   6.44102827e-15,   4.17721413e-15],
+         [[  7.66053887e-15,   7.10542736e-15,   5.05151476e-15,
+             7.74380560e-15,   7.60502772e-15,   6.68909372e-15,
+             8.50708393e-15,   7.16093851e-15,   8.21565038e-15,
+             5.88418203e-15,   7.04991621e-15,   6.32827124e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1299,10 +1334,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  4.85931890e-01,   3.44372756e+00,   4.85931890e-01,
-            -4.04638309e-01,  -1.18553235e-01,  -4.04638309e-01,
-            -4.92870367e-01,   5.59823902e-01,   7.40805832e-01,
-             5.59823902e-01,   7.40805832e-01,  -4.92870367e-01],
+         [[ -7.47643942e-01,   2.49528788e+00,  -7.47643942e-01,
+            -2.85301932e-03,   1.00570604e+00,  -2.85301932e-03,
+             2.41409804e-01,  -7.87419801e-01,   1.54601000e+00,
+            -7.87419801e-01,   1.54601000e+00,   2.41409804e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1312,10 +1347,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  6.37592643e+00,  -2.30167545e-01,  -2.30167545e-01,
-             1.13786606e+00,  -2.82847955e-01,  -2.82847955e-01,
-             2.60506708e+00,   2.60506708e+00,  -9.62843375e-02,
-            -9.62843375e-02,  -2.01023374e-01,  -2.01023374e-01],
+         [[  3.49528788e+00,   2.52356058e-01,   2.52356058e-01,
+             2.00570604e+00,   9.97146981e-01,   9.97146981e-01,
+             2.54601000e+00,   2.54601000e+00,   1.24140980e+00,
+             1.24140980e+00,   2.12580199e-01,   2.12580199e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1325,10 +1360,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -2.44372756e+00,   1.20457074e+00,  -1.76434524e-01,
-             1.11855323e+00,   2.25318218e+00,   5.56094442e-01,
-             2.46932174e+00,  -1.95093341e+00,   3.93699696e+00,
-            -9.51256225e-01,   6.74175116e-01,   2.06177081e-01],
+         [[  1.15463195e-14,  -3.24293183e+00,   3.24293183e+00,
+             1.40998324e-14,  -1.00855906e+00,   1.00855906e+00,
+            -1.02882960e+00,   1.02882960e+00,  -2.33342980e+00,
+             2.33342980e+00,  -1.30460019e+00,   1.30460019e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1338,10 +1373,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -5.37330206e-02,   2.21356002e+00,   5.17135569e+00,
-            -8.38942398e-01,  -1.40140119e+00,  -1.11531612e+00,
-             7.50232851e-01,  -3.02461418e-01,   1.74991003e+00,
-             1.93089196e+00,  -2.56560608e+00,  -1.33192988e+00],
+         [[ -3.49528788e+00,  -2.52356058e-01,  -2.52356058e-01,
+            -2.00570604e+00,  -9.97146981e-01,  -9.97146981e-01,
+            -2.54601000e+00,  -2.54601000e+00,  -1.24140980e+00,
+            -1.24140980e+00,  -2.12580199e-01,  -2.12580199e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1351,53 +1386,53 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  5.37330206e-02,  -5.17135569e+00,  -2.21356002e+00,
-             8.38942398e-01,   1.11531612e+00,   1.40140119e+00,
-             3.02461418e-01,  -7.50232851e-01,  -1.93089196e+00,
-            -1.74991003e+00,   1.33192988e+00,   2.56560608e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
+             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
+             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
+            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  2.44372756e+00,   1.76434524e-01,  -1.20457074e+00,
-            -1.11855323e+00,  -5.56094442e-01,  -2.25318218e+00,
-             1.95093341e+00,  -2.46932174e+00,   9.51256225e-01,
-            -3.93699696e+00,  -2.06177081e-01,  -6.74175116e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  7.66053887e-15,   7.10542736e-15,   5.05151476e-15,
+             7.74380560e-15,   7.60502772e-15,   6.68909372e-15,
+             8.50708393e-15,   7.16093851e-15,   8.21565038e-15,
+             5.88418203e-15,   7.04991621e-15,   6.32827124e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -6.37592643e+00,   2.30167545e-01,   2.30167545e-01,
-            -1.13786606e+00,   2.82847955e-01,   2.82847955e-01,
-            -2.60506708e+00,  -2.60506708e+00,   9.62843375e-02,
-             9.62843375e-02,   2.01023374e-01,   2.01023374e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -7.47643942e-01,   2.49528788e+00,  -7.47643942e-01,
+            -2.85301932e-03,   1.00570604e+00,  -2.85301932e-03,
+             2.41409804e-01,  -7.87419801e-01,   1.54601000e+00,
+            -7.87419801e-01,   1.54601000e+00,   2.41409804e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -9.10382880e-15,  -1.38100527e+00,   1.38100527e+00,
-             6.68909372e-15,  -1.69708773e+00,   1.69708773e+00,
-            -4.42025515e+00,   4.42025515e+00,  -4.88825318e+00,
-             4.88825318e+00,  -4.67998035e-01,   4.67998035e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  3.49528788e+00,   2.52356058e-01,   2.52356058e-01,
+             2.00570604e+00,   9.97146981e-01,   9.97146981e-01,
+             2.54601000e+00,   2.54601000e+00,   1.24140980e+00,
+             1.24140980e+00,   2.12580199e-01,   2.12580199e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1407,10 +1442,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -4.85931890e-01,  -4.85931890e-01,  -3.44372756e+00,
-             4.04638309e-01,   4.04638309e-01,   1.18553235e-01,
-            -5.59823902e-01,   4.92870367e-01,  -5.59823902e-01,
-            -7.40805832e-01,   4.92870367e-01,  -7.40805832e-01],
+          [  1.15463195e-14,  -3.24293183e+00,   3.24293183e+00,
+             1.40998324e-14,  -1.00855906e+00,   1.00855906e+00,
+            -1.02882960e+00,   1.02882960e+00,  -2.33342980e+00,
+             2.33342980e+00,  -1.30460019e+00,   1.30460019e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1420,10 +1455,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -4.94049246e-15,   7.77156117e-15,  -6.66133815e-16,
-             1.85615412e-15,   4.49640325e-15,   3.27168848e-15,
-             3.05311332e-16,  -1.27675648e-15,   3.60475538e-15,
-             2.77555756e-16,   6.44102827e-15,   4.17721413e-15],
+          [ -3.49528788e+00,  -2.52356058e-01,  -2.52356058e-01,
+            -2.00570604e+00,  -9.97146981e-01,  -9.97146981e-01,
+            -2.54601000e+00,  -2.54601000e+00,  -1.24140980e+00,
+            -1.24140980e+00,  -2.12580199e-01,  -2.12580199e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1433,62 +1468,60 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  4.85931890e-01,   3.44372756e+00,   4.85931890e-01,
-            -4.04638309e-01,  -1.18553235e-01,  -4.04638309e-01,
-            -4.92870367e-01,   5.59823902e-01,   7.40805832e-01,
-             5.59823902e-01,   7.40805832e-01,  -4.92870367e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  6.37592643e+00,  -2.30167545e-01,  -2.30167545e-01,
-             1.13786606e+00,  -2.82847955e-01,  -2.82847955e-01,
-             2.60506708e+00,   2.60506708e+00,  -9.62843375e-02,
-            -9.62843375e-02,  -2.01023374e-01,  -2.01023374e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -2.44372756e+00,   1.20457074e+00,  -1.76434524e-01,
-             1.11855323e+00,   2.25318218e+00,   5.56094442e-01,
-             2.46932174e+00,  -1.95093341e+00,   3.93699696e+00,
-            -9.51256225e-01,   6.74175116e-01,   2.06177081e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
+             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
+             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
+            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -5.37330206e-02,   2.21356002e+00,   5.17135569e+00,
-            -8.38942398e-01,  -1.40140119e+00,  -1.11531612e+00,
-             7.50232851e-01,  -3.02461418e-01,   1.74991003e+00,
-             1.93089196e+00,  -2.56560608e+00,  -1.33192988e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  2.49528788e+00,  -7.47643942e-01,  -7.47643942e-01,
+             1.00570604e+00,  -2.85301932e-03,  -2.85301932e-03,
+             1.54601000e+00,   1.54601000e+00,   2.41409804e-01,
+             2.41409804e-01,  -7.87419801e-01,  -7.87419801e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  5.37330206e-02,  -5.17135569e+00,  -2.21356002e+00,
-             8.38942398e-01,   1.11531612e+00,   1.40140119e+00,
-             3.02461418e-01,  -7.50232851e-01,  -1.93089196e+00,
-            -1.74991003e+00,   1.33192988e+00,   2.56560608e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1498,66 +1531,79 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  2.44372756e+00,   1.76434524e-01,  -1.20457074e+00,
-            -1.11855323e+00,  -5.56094442e-01,  -2.25318218e+00,
-             1.95093341e+00,  -2.46932174e+00,   9.51256225e-01,
-            -3.93699696e+00,  -2.06177081e-01,  -6.74175116e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  2.52356058e-01,   3.49528788e+00,   2.52356058e-01,
+             9.97146981e-01,   2.00570604e+00,   9.97146981e-01,
+             1.24140980e+00,   2.12580199e-01,   2.54601000e+00,
+             2.12580199e-01,   2.54601000e+00,   1.24140980e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -6.37592643e+00,   2.30167545e-01,   2.30167545e-01,
-            -1.13786606e+00,   2.82847955e-01,   2.82847955e-01,
-            -2.60506708e+00,  -2.60506708e+00,   9.62843375e-02,
-             9.62843375e-02,   2.01023374e-01,   2.01023374e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[ -2.52356058e-01,  -3.49528788e+00,  -2.52356058e-01,
+            -9.97146981e-01,  -2.00570604e+00,  -9.97146981e-01,
+            -1.24140980e+00,  -2.12580199e-01,  -2.54601000e+00,
+            -2.12580199e-01,  -2.54601000e+00,  -1.24140980e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -9.10382880e-15,  -1.38100527e+00,   1.38100527e+00,
-             6.68909372e-15,  -1.69708773e+00,   1.69708773e+00,
-            -4.42025515e+00,   4.42025515e+00,  -4.88825318e+00,
-             4.88825318e+00,  -4.67998035e-01,   4.67998035e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[ -3.24293183e+00,   2.61756373e-16,   3.24293183e+00,
+            -1.00855906e+00,   3.63572562e-15,   1.00855906e+00,
+            -2.33342980e+00,  -1.30460019e+00,  -1.02882960e+00,
+             1.30460019e+00,   1.02882960e+00,   2.33342980e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
              2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
              7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
-            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00]],
+            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  2.49528788e+00,  -7.47643942e-01,  -7.47643942e-01,
+             1.00570604e+00,  -2.85301932e-03,  -2.85301932e-03,
+             1.54601000e+00,   1.54601000e+00,   2.41409804e-01,
+             2.41409804e-01,  -7.87419801e-01,  -7.87419801e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.43769499e-15,   8.43769499e-15,   5.38458167e-15,
-             7.63278329e-15,   7.63278329e-15,   6.63358257e-15,
-             8.50708393e-15,   7.66053887e-15,   8.38218384e-15,
-             6.05071548e-15,   7.49400542e-15,   6.38378239e-15]],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1567,143 +1613,347 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -7.47643942e-01,   2.49528788e+00,  -7.47643942e-01,
-            -2.85301932e-03,   1.00570604e+00,  -2.85301932e-03,
-             2.41409804e-01,  -7.87419801e-01,   1.54601000e+00,
-            -7.87419801e-01,   1.54601000e+00,   2.41409804e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  3.49528788e+00,   2.52356058e-01,   2.52356058e-01,
-             2.00570604e+00,   9.97146981e-01,   9.97146981e-01,
-             2.54601000e+00,   2.54601000e+00,   1.24140980e+00,
-             1.24140980e+00,   2.12580199e-01,   2.12580199e-01]],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  2.52356058e-01,   3.49528788e+00,   2.52356058e-01,
+             9.97146981e-01,   2.00570604e+00,   9.97146981e-01,
+             1.24140980e+00,   2.12580199e-01,   2.54601000e+00,
+             2.12580199e-01,   2.54601000e+00,   1.24140980e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.24344979e-14,  -3.24293183e+00,   3.24293183e+00,
-             1.40998324e-14,  -1.00855906e+00,   1.00855906e+00,
-            -1.02882960e+00,   1.02882960e+00,  -2.33342980e+00,
-             2.33342980e+00,  -1.30460019e+00,   1.30460019e+00]],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -2.52356058e-01,  -3.49528788e+00,  -2.52356058e-01,
+            -9.97146981e-01,  -2.00570604e+00,  -9.97146981e-01,
+            -1.24140980e+00,  -2.12580199e-01,  -2.54601000e+00,
+            -2.12580199e-01,  -2.54601000e+00,  -1.24140980e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -3.49528788e+00,  -2.52356058e-01,  -2.52356058e-01,
-            -2.00570604e+00,  -9.97146981e-01,  -9.97146981e-01,
-            -2.54601000e+00,  -2.54601000e+00,  -1.24140980e+00,
-            -1.24140980e+00,  -2.12580199e-01,  -2.12580199e-01]]]), (1, 0): array([[[ -4.85931890e-01,  -4.85931890e-01,  -3.44372756e+00,
-             4.04638309e-01,   4.04638309e-01,   1.18553235e-01,
-            -5.59823902e-01,   4.92870367e-01,  -5.59823902e-01,
-            -7.40805832e-01,   4.92870367e-01,  -7.40805832e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -3.24293183e+00,   2.61756373e-16,   3.24293183e+00,
+            -1.00855906e+00,   3.63572562e-15,   1.00855906e+00,
+            -2.33342980e+00,  -1.30460019e+00,  -1.02882960e+00,
+             1.30460019e+00,   1.02882960e+00,   2.33342980e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  3.44372756e+00,   4.85931890e-01,   4.85931890e-01,
-            -1.18553235e-01,  -4.04638309e-01,  -4.04638309e-01,
-             7.40805832e-01,   7.40805832e-01,  -4.92870367e-01,
-            -4.92870367e-01,   5.59823902e-01,   5.59823902e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
   
-         [[ -6.19847219e-18,   3.35148811e-16,  -1.00022725e-16,
-            -2.96189892e-17,  -3.69822127e-17,  -1.57310230e-16,
-             7.96972856e-17,  -1.12042977e-17,   2.24860335e-16,
-            -4.21435619e-17,  -1.14379134e-16,  -2.90481448e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]],
   
-         [[  1.20457074e+00,  -2.44372756e+00,  -1.76434524e-01,
-             2.25318218e+00,   1.11855323e+00,   5.56094442e-01,
-             3.93699696e+00,   6.74175116e-01,   2.46932174e+00,
-             2.06177081e-01,  -1.95093341e+00,  -9.51256225e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -2.30167545e-01,   6.37592643e+00,  -2.30167545e-01,
-            -2.82847955e-01,   1.13786606e+00,  -2.82847955e-01,
-            -9.62843375e-02,  -2.01023374e-01,   2.60506708e+00,
-            -2.01023374e-01,   2.60506708e+00,  -9.62843375e-02],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]]), (0, 0): array([[[-0.05512857, -0.05512857,  0.6533077 , -0.12499898, -0.12499898,
+            0.00143058, -0.04749626, -0.11771516, -0.04749626,  0.17376836,
+           -0.11771516,  0.17376836],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.6533077 , -0.05512857, -0.05512857,  0.00143058, -0.12499898,
+           -0.12499898,  0.17376836,  0.17376836, -0.11771516, -0.11771516,
+           -0.04749626, -0.04749626],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[-0.05512857,  0.6533077 , -0.05512857, -0.12499898,  0.00143058,
+           -0.12499898, -0.11771516, -0.04749626,  0.17376836, -0.04749626,
+            0.17376836, -0.11771516],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.22051427,  0.22051427,  0.01592089,  0.49999593,  0.49999593,
+            0.24857553,  0.79016044,  0.13530783,  0.79016044,  0.06597479,
+            0.13530783,  0.06597479],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.01592089,  0.22051427,  0.22051427,  0.24857553,  0.49999593,
+            0.49999593,  0.06597479,  0.06597479,  0.13530783,  0.13530783,
+            0.79016044,  0.79016044],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.22051427,  0.01592089,  0.22051427,  0.49999593,  0.24857553,
+            0.49999593,  0.13530783,  0.79016044,  0.06597479,  0.79016044,
+            0.06597479,  0.13530783],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.05512857, -0.05512857,  0.6533077 , -0.12499898, -0.12499898,
+            0.00143058, -0.04749626, -0.11771516, -0.04749626,  0.17376836,
+           -0.11771516,  0.17376836],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.6533077 , -0.05512857, -0.05512857,  0.00143058, -0.12499898,
+           -0.12499898,  0.17376836,  0.17376836, -0.11771516, -0.11771516,
+           -0.04749626, -0.04749626],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.05512857,  0.6533077 , -0.05512857, -0.12499898,  0.00143058,
+           -0.12499898, -0.11771516, -0.04749626,  0.17376836, -0.04749626,
+            0.17376836, -0.11771516],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.22051427,  0.22051427,  0.01592089,  0.49999593,  0.49999593,
+            0.24857553,  0.79016044,  0.13530783,  0.79016044,  0.06597479,
+            0.13530783,  0.06597479],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.01592089,  0.22051427,  0.22051427,  0.24857553,  0.49999593,
+            0.49999593,  0.06597479,  0.06597479,  0.13530783,  0.13530783,
+            0.79016044,  0.79016044],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.22051427,  0.01592089,  0.22051427,  0.49999593,  0.24857553,
+            0.49999593,  0.13530783,  0.79016044,  0.06597479,  0.79016044,
+            0.06597479,  0.13530783],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.06308901,  0.06308901,  0.87382197,  0.24928675,  0.24928675,
+            0.50142651,  0.05314505,  0.31035245,  0.05314505,  0.6365025 ,
+            0.31035245,  0.6365025 ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.87382197,  0.06308901,  0.06308901,  0.50142651,  0.24928675,
+            0.24928675,  0.6365025 ,  0.6365025 ,  0.31035245,  0.31035245,
+            0.05314505,  0.05314505]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.06308901,  0.87382197,  0.06308901,  0.24928675,  0.50142651,
+            0.24928675,  0.31035245,  0.05314505,  0.6365025 ,  0.05314505,
+            0.6365025 ,  0.31035245]]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  1.76434524e-01,   2.44372756e+00,  -1.20457074e+00,
-            -5.56094442e-01,  -1.11855323e+00,  -2.25318218e+00,
-             9.51256225e-01,  -2.06177081e-01,   1.95093341e+00,
-            -6.74175116e-01,  -2.46932174e+00,  -3.93699696e+00],
+         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  2.30167545e-01,  -6.37592643e+00,   2.30167545e-01,
-             2.82847955e-01,  -1.13786606e+00,   2.82847955e-01,
-             9.62843375e-02,   2.01023374e-01,  -2.60506708e+00,
-             2.01023374e-01,  -2.60506708e+00,   9.62843375e-02],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
   
-         [[  2.21356002e+00,  -5.37330206e-02,   5.17135569e+00,
-            -1.40140119e+00,  -8.38942398e-01,  -1.11531612e+00,
-             1.74991003e+00,  -2.56560608e+00,   7.50232851e-01,
-            -1.33192988e+00,  -3.02461418e-01,   1.93089196e+00],
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.06308901,  0.06308901,  0.87382197,  0.24928675,  0.24928675,
+            0.50142651,  0.05314505,  0.31035245,  0.05314505,  0.6365025 ,
+            0.31035245,  0.6365025 ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.87382197,  0.06308901,  0.06308901,  0.50142651,  0.24928675,
+            0.24928675,  0.6365025 ,  0.6365025 ,  0.31035245,  0.31035245,
+            0.05314505,  0.05314505],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.06308901,  0.87382197,  0.06308901,  0.24928675,  0.50142651,
+            0.24928675,  0.31035245,  0.05314505,  0.6365025 ,  0.05314505,
+            0.6365025 ,  0.31035245],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.06308901,  0.06308901,  0.87382197,  0.24928675,  0.24928675,
+            0.50142651,  0.05314505,  0.31035245,  0.05314505,  0.6365025 ,
+            0.31035245,  0.6365025 ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.87382197,  0.06308901,  0.06308901,  0.50142651,  0.24928675,
+            0.24928675,  0.6365025 ,  0.6365025 ,  0.31035245,  0.31035245,
+            0.05314505,  0.05314505]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.06308901,  0.87382197,  0.06308901,  0.24928675,  0.50142651,
+            0.24928675,  0.31035245,  0.05314505,  0.6365025 ,  0.05314505,
+            0.6365025 ,  0.31035245]]])}}}, MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 3), dim=2), FiniteElement('Lagrange', triangle, 2)): {None: {None: {(0, 1): array([[[ -4.85931890e-01,  -4.85931890e-01,  -3.44372756e+00,
+             4.04638309e-01,   4.04638309e-01,   1.18553235e-01,
+            -5.59823902e-01,   4.92870367e-01,  -5.59823902e-01,
+            -7.40805832e-01,   4.92870367e-01,  -7.40805832e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1713,10 +1963,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -5.17135569e+00,   5.37330206e-02,  -2.21356002e+00,
-             1.11531612e+00,   8.38942398e-01,   1.40140119e+00,
-            -1.93089196e+00,   1.33192988e+00,   3.02461418e-01,
-             2.56560608e+00,  -7.50232851e-01,  -1.74991003e+00],
+         [[ -4.27435864e-15,   6.10622664e-15,   1.66533454e-16,
+             1.59594560e-15,   4.44089210e-15,   3.17107451e-15,
+            -9.71445147e-17,  -1.05471187e-15,   3.34801631e-15,
+             7.21644966e-16,   6.21031004e-15,   4.01068068e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1726,10 +1976,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -1.38100527e+00,  -1.32779142e-14,   1.38100527e+00,
-            -1.69708773e+00,   1.36155758e-14,   1.69708773e+00,
-            -4.88825318e+00,  -4.67998035e-01,  -4.42025515e+00,
-             4.67998035e-01,   4.42025515e+00,   4.88825318e+00],
+         [[  4.85931890e-01,   3.44372756e+00,   4.85931890e-01,
+            -4.04638309e-01,  -1.18553235e-01,  -4.04638309e-01,
+            -4.92870367e-01,   5.59823902e-01,   7.40805832e-01,
+             5.59823902e-01,   7.40805832e-01,  -4.92870367e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1739,79 +1989,92 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  6.37592643e+00,  -2.30167545e-01,  -2.30167545e-01,
+             1.13786606e+00,  -2.82847955e-01,  -2.82847955e-01,
+             2.60506708e+00,   2.60506708e+00,  -9.62843375e-02,
+            -9.62843375e-02,  -2.01023374e-01,  -2.01023374e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -4.85931890e-01,  -4.85931890e-01,  -3.44372756e+00,
-             4.04638309e-01,   4.04638309e-01,   1.18553235e-01,
-            -5.59823902e-01,   4.92870367e-01,  -5.59823902e-01,
-            -7.40805832e-01,   4.92870367e-01,  -7.40805832e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[ -2.44372756e+00,   1.20457074e+00,  -1.76434524e-01,
+             1.11855323e+00,   2.25318218e+00,   5.56094442e-01,
+             2.46932174e+00,  -1.95093341e+00,   3.93699696e+00,
+            -9.51256225e-01,   6.74175116e-01,   2.06177081e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  3.44372756e+00,   4.85931890e-01,   4.85931890e-01,
-            -1.18553235e-01,  -4.04638309e-01,  -4.04638309e-01,
-             7.40805832e-01,   7.40805832e-01,  -4.92870367e-01,
-            -4.92870367e-01,   5.59823902e-01,   5.59823902e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[ -5.37330206e-02,   2.21356002e+00,   5.17135569e+00,
+            -8.38942398e-01,  -1.40140119e+00,  -1.11531612e+00,
+             7.50232851e-01,  -3.02461418e-01,   1.74991003e+00,
+             1.93089196e+00,  -2.56560608e+00,  -1.33192988e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -6.19847219e-18,   3.35148811e-16,  -1.00022725e-16,
-            -2.96189892e-17,  -3.69822127e-17,  -1.57310230e-16,
-             7.96972856e-17,  -1.12042977e-17,   2.24860335e-16,
-            -4.21435619e-17,  -1.14379134e-16,  -2.90481448e-16],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  5.37330206e-02,  -5.17135569e+00,  -2.21356002e+00,
+             8.38942398e-01,   1.11531612e+00,   1.40140119e+00,
+             3.02461418e-01,  -7.50232851e-01,  -1.93089196e+00,
+            -1.74991003e+00,   1.33192988e+00,   2.56560608e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.20457074e+00,  -2.44372756e+00,  -1.76434524e-01,
-             2.25318218e+00,   1.11855323e+00,   5.56094442e-01,
-             3.93699696e+00,   6.74175116e-01,   2.46932174e+00,
-             2.06177081e-01,  -1.95093341e+00,  -9.51256225e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  2.44372756e+00,   1.76434524e-01,  -1.20457074e+00,
+            -1.11855323e+00,  -5.56094442e-01,  -2.25318218e+00,
+             1.95093341e+00,  -2.46932174e+00,   9.51256225e-01,
+            -3.93699696e+00,  -2.06177081e-01,  -6.74175116e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -2.30167545e-01,   6.37592643e+00,  -2.30167545e-01,
-            -2.82847955e-01,   1.13786606e+00,  -2.82847955e-01,
-            -9.62843375e-02,  -2.01023374e-01,   2.60506708e+00,
-            -2.01023374e-01,   2.60506708e+00,  -9.62843375e-02],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[ -6.37592643e+00,   2.30167545e-01,   2.30167545e-01,
+            -1.13786606e+00,   2.82847955e-01,   2.82847955e-01,
+            -2.60506708e+00,  -2.60506708e+00,   9.62843375e-02,
+             9.62843375e-02,   2.01023374e-01,   2.01023374e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -1.06581410e-14,  -1.38100527e+00,   1.38100527e+00,
+             6.84174939e-15,  -1.69708773e+00,   1.69708773e+00,
+            -4.42025515e+00,   4.42025515e+00,  -4.88825318e+00,
+             4.88825318e+00,  -4.67998035e-01,   4.67998035e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.76434524e-01,   2.44372756e+00,  -1.20457074e+00,
-            -5.56094442e-01,  -1.11855323e+00,  -2.25318218e+00,
-             9.51256225e-01,  -2.06177081e-01,   1.95093341e+00,
-            -6.74175116e-01,  -2.46932174e+00,  -3.93699696e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1821,10 +2084,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  2.30167545e-01,  -6.37592643e+00,   2.30167545e-01,
-             2.82847955e-01,  -1.13786606e+00,   2.82847955e-01,
-             9.62843375e-02,   2.01023374e-01,  -2.60506708e+00,
-             2.01023374e-01,  -2.60506708e+00,   9.62843375e-02],
+          [ -4.85931890e-01,  -4.85931890e-01,  -3.44372756e+00,
+             4.04638309e-01,   4.04638309e-01,   1.18553235e-01,
+            -5.59823902e-01,   4.92870367e-01,  -5.59823902e-01,
+            -7.40805832e-01,   4.92870367e-01,  -7.40805832e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1834,10 +2097,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  2.21356002e+00,  -5.37330206e-02,   5.17135569e+00,
-            -1.40140119e+00,  -8.38942398e-01,  -1.11531612e+00,
-             1.74991003e+00,  -2.56560608e+00,   7.50232851e-01,
-            -1.33192988e+00,  -3.02461418e-01,   1.93089196e+00],
+          [ -4.27435864e-15,   6.10622664e-15,   1.66533454e-16,
+             1.59594560e-15,   4.44089210e-15,   3.17107451e-15,
+            -9.71445147e-17,  -1.05471187e-15,   3.34801631e-15,
+             7.21644966e-16,   6.21031004e-15,   4.01068068e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1847,10 +2110,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -5.17135569e+00,   5.37330206e-02,  -2.21356002e+00,
-             1.11531612e+00,   8.38942398e-01,   1.40140119e+00,
-            -1.93089196e+00,   1.33192988e+00,   3.02461418e-01,
-             2.56560608e+00,  -7.50232851e-01,  -1.74991003e+00],
+          [  4.85931890e-01,   3.44372756e+00,   4.85931890e-01,
+            -4.04638309e-01,  -1.18553235e-01,  -4.04638309e-01,
+            -4.92870367e-01,   5.59823902e-01,   7.40805832e-01,
+             5.59823902e-01,   7.40805832e-01,  -4.92870367e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1860,10 +2123,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.38100527e+00,  -1.32779142e-14,   1.38100527e+00,
-            -1.69708773e+00,   1.36155758e-14,   1.69708773e+00,
-            -4.88825318e+00,  -4.67998035e-01,  -4.42025515e+00,
-             4.67998035e-01,   4.42025515e+00,   4.88825318e+00],
+          [  6.37592643e+00,  -2.30167545e-01,  -2.30167545e-01,
+             1.13786606e+00,  -2.82847955e-01,  -2.82847955e-01,
+             2.60506708e+00,   2.60506708e+00,  -9.62843375e-02,
+            -9.62843375e-02,  -2.01023374e-01,  -2.01023374e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1873,36 +2136,75 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -2.44372756e+00,   1.20457074e+00,  -1.76434524e-01,
+             1.11855323e+00,   2.25318218e+00,   5.56094442e-01,
+             2.46932174e+00,  -1.95093341e+00,   3.93699696e+00,
+            -9.51256225e-01,   6.74175116e-01,   2.06177081e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
-             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
-             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
-            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00]],
+          [ -5.37330206e-02,   2.21356002e+00,   5.17135569e+00,
+            -8.38942398e-01,  -1.40140119e+00,  -1.11531612e+00,
+             7.50232851e-01,  -3.02461418e-01,   1.74991003e+00,
+             1.93089196e+00,  -2.56560608e+00,  -1.33192988e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  5.37330206e-02,  -5.17135569e+00,  -2.21356002e+00,
+             8.38942398e-01,   1.11531612e+00,   1.40140119e+00,
+             3.02461418e-01,  -7.50232851e-01,  -1.93089196e+00,
+            -1.74991003e+00,   1.33192988e+00,   2.56560608e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  2.49528788e+00,  -7.47643942e-01,  -7.47643942e-01,
-             1.00570604e+00,  -2.85301932e-03,  -2.85301932e-03,
-             1.54601000e+00,   1.54601000e+00,   2.41409804e-01,
-             2.41409804e-01,  -7.87419801e-01,  -7.87419801e-01]],
+          [  2.44372756e+00,   1.76434524e-01,  -1.20457074e+00,
+            -1.11855323e+00,  -5.56094442e-01,  -2.25318218e+00,
+             1.95093341e+00,  -2.46932174e+00,   9.51256225e-01,
+            -3.93699696e+00,  -2.06177081e-01,  -6.74175116e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -6.37592643e+00,   2.30167545e-01,   2.30167545e-01,
+            -1.13786606e+00,   2.82847955e-01,   2.82847955e-01,
+            -2.60506708e+00,  -2.60506708e+00,   9.62843375e-02,
+             9.62843375e-02,   2.01023374e-01,   2.01023374e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.06581410e-14,  -1.38100527e+00,   1.38100527e+00,
+             6.84174939e-15,  -1.69708773e+00,   1.69708773e+00,
+            -4.42025515e+00,   4.42025515e+00,  -4.88825318e+00,
+             4.88825318e+00,  -4.67998035e-01,   4.67998035e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1916,10 +2218,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  2.52356058e-01,   3.49528788e+00,   2.52356058e-01,
-             9.97146981e-01,   2.00570604e+00,   9.97146981e-01,
-             1.24140980e+00,   2.12580199e-01,   2.54601000e+00,
-             2.12580199e-01,   2.54601000e+00,   1.24140980e+00]],
+          [  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
+             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
+             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
+            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1929,10 +2231,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -2.52356058e-01,  -3.49528788e+00,  -2.52356058e-01,
-            -9.97146981e-01,  -2.00570604e+00,  -9.97146981e-01,
-            -1.24140980e+00,  -2.12580199e-01,  -2.54601000e+00,
-            -2.12580199e-01,  -2.54601000e+00,  -1.24140980e+00]],
+          [  7.66053887e-15,   7.10542736e-15,   5.05151476e-15,
+             7.74380560e-15,   7.60502772e-15,   6.68909372e-15,
+             8.50708393e-15,   7.16093851e-15,   8.21565038e-15,
+             5.88418203e-15,   7.04991621e-15,   6.32827124e-15]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -1942,271 +2244,169 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -3.24293183e+00,   2.05117403e-15,   3.24293183e+00,
-            -1.00855906e+00,   3.89861391e-15,   1.00855906e+00,
-            -2.33342980e+00,  -1.30460019e+00,  -1.02882960e+00,
-             1.30460019e+00,   1.02882960e+00,   2.33342980e+00]]]), (0, 0): array([[[ 0.046308  ,  0.046308  ,  0.44026899,  0.03935169,  0.03935169,
-           -0.06267372,  0.04111073,  0.01143583,  0.04111073, -0.02619323,
-            0.01143583, -0.02619323],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.44026899,  0.046308  ,  0.046308  , -0.06267372,  0.03935169,
-            0.03935169, -0.02619323, -0.02619323,  0.01143583,  0.01143583,
-            0.04111073,  0.04111073],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+          [ -7.47643942e-01,   2.49528788e+00,  -7.47643942e-01,
+            -2.85301932e-03,   1.00570604e+00,  -2.85301932e-03,
+             2.41409804e-01,  -7.87419801e-01,   1.54601000e+00,
+            -7.87419801e-01,   1.54601000e+00,   2.41409804e-01]],
   
-         [[ 0.046308  ,  0.44026899,  0.046308  ,  0.03935169, -0.06267372,
-            0.03935169,  0.01143583,  0.04111073, -0.02619323,  0.04111073,
-           -0.02619323,  0.01143583],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  3.49528788e+00,   2.52356058e-01,   2.52356058e-01,
+             2.00570604e+00,   9.97146981e-01,   9.97146981e-01,
+             2.54601000e+00,   2.54601000e+00,   1.24140980e+00,
+             1.24140980e+00,   2.12580199e-01,   2.12580199e-01]],
   
-         [[ 0.40225091, -0.20112546, -0.01452104,  0.28365493, -0.14182746,
-           -0.07051025,  0.80848895,  0.13844642, -0.06128522, -0.00511704,
-           -0.12795188, -0.0623881 ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.15463195e-14,  -3.24293183e+00,   3.24293183e+00,
+             1.40998324e-14,  -1.00855906e+00,   1.00855906e+00,
+            -1.02882960e+00,   1.02882960e+00,  -2.33342980e+00,
+             2.33342980e+00,  -1.30460019e+00,   1.30460019e+00]],
   
-         [[-0.20112546,  0.40225091, -0.01452104, -0.14182746,  0.28365493,
-           -0.07051025, -0.06128522, -0.12795188,  0.80848895, -0.0623881 ,
-            0.13844642, -0.00511704],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -3.49528788e+00,  -2.52356058e-01,  -2.52356058e-01,
+            -2.00570604e+00,  -9.97146981e-01,  -9.97146981e-01,
+            -2.54601000e+00,  -2.54601000e+00,  -1.24140980e+00,
+            -1.24140980e+00,  -2.12580199e-01,  -2.12580199e-01]]]), (1, 0): array([[[ -4.85931890e-01,  -4.85931890e-01,  -3.44372756e+00,
+             4.04638309e-01,   4.04638309e-01,   1.18553235e-01,
+            -5.59823902e-01,   4.92870367e-01,  -5.59823902e-01,
+            -7.40805832e-01,   4.92870367e-01,  -7.40805832e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[-0.01452104, -0.20112546,  0.40225091, -0.07051025, -0.14182746,
-            0.28365493, -0.0623881 , -0.00511704, -0.12795188,  0.13844642,
-           -0.06128522,  0.80848895],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[  3.44372756e+00,   4.85931890e-01,   4.85931890e-01,
+            -1.18553235e-01,  -4.04638309e-01,  -4.04638309e-01,
+             7.40805832e-01,   7.40805832e-01,  -4.92870367e-01,
+            -4.92870367e-01,   5.59823902e-01,   5.59823902e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[-0.01452104,  0.40225091, -0.20112546, -0.07051025,  0.28365493,
-           -0.14182746, -0.00511704, -0.0623881 ,  0.13844642, -0.12795188,
-            0.80848895, -0.06128522],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[ -6.19847219e-18,   3.35148811e-16,  -1.00022725e-16,
+            -2.96189892e-17,  -3.69822127e-17,  -1.57310230e-16,
+             7.96972856e-17,  -1.12042977e-17,   2.24860335e-16,
+            -4.21435619e-17,  -1.14379134e-16,  -2.90481448e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[-0.20112546, -0.01452104,  0.40225091, -0.14182746, -0.07051025,
-            0.28365493, -0.12795188, -0.06128522, -0.0623881 ,  0.80848895,
-           -0.00511704,  0.13844642],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[  1.20457074e+00,  -2.44372756e+00,  -1.76434524e-01,
+             2.25318218e+00,   1.11855323e+00,   5.56094442e-01,
+             3.93699696e+00,   6.74175116e-01,   2.46932174e+00,
+             2.06177081e-01,  -1.95093341e+00,  -9.51256225e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ 0.40225091, -0.01452104, -0.20112546,  0.28365493, -0.07051025,
-           -0.14182746,  0.13844642,  0.80848895, -0.00511704, -0.06128522,
-           -0.0623881 , -0.12795188],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[ -2.30167545e-01,   6.37592643e+00,  -2.30167545e-01,
+            -2.82847955e-01,   1.13786606e+00,  -2.82847955e-01,
+            -9.62843375e-02,  -2.01023374e-01,   2.60506708e+00,
+            -2.01023374e-01,   2.60506708e+00,  -9.62843375e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ 0.09390619,  0.09390619,  0.09390619,  0.84133592,  0.84133592,
-            0.84133592,  0.28345353,  0.28345353,  0.28345353,  0.28345353,
-            0.28345353,  0.28345353],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[  1.76434524e-01,   2.44372756e+00,  -1.20457074e+00,
+            -5.56094442e-01,  -1.11855323e+00,  -2.25318218e+00,
+             9.51256225e-01,  -2.06177081e-01,   1.95093341e+00,
+            -6.74175116e-01,  -2.46932174e+00,  -3.93699696e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.046308  ,  0.046308  ,  0.44026899,  0.03935169,  0.03935169,
-           -0.06267372,  0.04111073,  0.01143583,  0.04111073, -0.02619323,
-            0.01143583, -0.02619323],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[  2.30167545e-01,  -6.37592643e+00,   2.30167545e-01,
+             2.82847955e-01,  -1.13786606e+00,   2.82847955e-01,
+             9.62843375e-02,   2.01023374e-01,  -2.60506708e+00,
+             2.01023374e-01,  -2.60506708e+00,   9.62843375e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.44026899,  0.046308  ,  0.046308  , -0.06267372,  0.03935169,
-            0.03935169, -0.02619323, -0.02619323,  0.01143583,  0.01143583,
-            0.04111073,  0.04111073],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[  2.21356002e+00,  -5.37330206e-02,   5.17135569e+00,
+            -1.40140119e+00,  -8.38942398e-01,  -1.11531612e+00,
+             1.74991003e+00,  -2.56560608e+00,   7.50232851e-01,
+            -1.33192988e+00,  -3.02461418e-01,   1.93089196e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.046308  ,  0.44026899,  0.046308  ,  0.03935169, -0.06267372,
-            0.03935169,  0.01143583,  0.04111073, -0.02619323,  0.04111073,
-           -0.02619323,  0.01143583],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[ -5.17135569e+00,   5.37330206e-02,  -2.21356002e+00,
+             1.11531612e+00,   8.38942398e-01,   1.40140119e+00,
+            -1.93089196e+00,   1.33192988e+00,   3.02461418e-01,
+             2.56560608e+00,  -7.50232851e-01,  -1.74991003e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.40225091, -0.20112546, -0.01452104,  0.28365493, -0.14182746,
-           -0.07051025,  0.80848895,  0.13844642, -0.06128522, -0.00511704,
-           -0.12795188, -0.0623881 ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [-0.20112546,  0.40225091, -0.01452104, -0.14182746,  0.28365493,
-           -0.07051025, -0.06128522, -0.12795188,  0.80848895, -0.0623881 ,
-            0.13844642, -0.00511704],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [-0.01452104, -0.20112546,  0.40225091, -0.07051025, -0.14182746,
-            0.28365493, -0.0623881 , -0.00511704, -0.12795188,  0.13844642,
-           -0.06128522,  0.80848895],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [-0.01452104,  0.40225091, -0.20112546, -0.07051025,  0.28365493,
-           -0.14182746, -0.00511704, -0.0623881 ,  0.13844642, -0.12795188,
-            0.80848895, -0.06128522],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [-0.20112546, -0.01452104,  0.40225091, -0.14182746, -0.07051025,
-            0.28365493, -0.12795188, -0.06128522, -0.0623881 ,  0.80848895,
-           -0.00511704,  0.13844642],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.40225091, -0.01452104, -0.20112546,  0.28365493, -0.07051025,
-           -0.14182746,  0.13844642,  0.80848895, -0.00511704, -0.06128522,
-           -0.0623881 , -0.12795188],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.09390619,  0.09390619,  0.09390619,  0.84133592,  0.84133592,
-            0.84133592,  0.28345353,  0.28345353,  0.28345353,  0.28345353,
-            0.28345353,  0.28345353],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [-0.05512857, -0.05512857,  0.6533077 , -0.12499898, -0.12499898,
-            0.00143058, -0.04749626, -0.11771516, -0.04749626,  0.17376836,
-           -0.11771516,  0.17376836]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.6533077 , -0.05512857, -0.05512857,  0.00143058, -0.12499898,
-           -0.12499898,  0.17376836,  0.17376836, -0.11771516, -0.11771516,
-           -0.04749626, -0.04749626]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [-0.05512857,  0.6533077 , -0.05512857, -0.12499898,  0.00143058,
-           -0.12499898, -0.11771516, -0.04749626,  0.17376836, -0.04749626,
-            0.17376836, -0.11771516]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.22051427,  0.22051427,  0.01592089,  0.49999593,  0.49999593,
-            0.24857553,  0.79016044,  0.13530783,  0.79016044,  0.06597479,
-            0.13530783,  0.06597479]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.01592089,  0.22051427,  0.22051427,  0.24857553,  0.49999593,
-            0.49999593,  0.06597479,  0.06597479,  0.13530783,  0.13530783,
-            0.79016044,  0.79016044]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.22051427,  0.01592089,  0.22051427,  0.49999593,  0.24857553,
-            0.49999593,  0.13530783,  0.79016044,  0.06597479,  0.79016044,
-            0.06597479,  0.13530783]]])}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): array([[[  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
-             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
-             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
-            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00],
+         [[ -1.38100527e+00,  -9.48836306e-15,   1.38100527e+00,
+            -1.69708773e+00,   1.30826401e-14,   1.69708773e+00,
+            -4.88825318e+00,  -4.67998035e-01,  -4.42025515e+00,
+             4.67998035e-01,   4.42025515e+00,   4.88825318e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2216,66 +2416,66 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  8.43769499e-15,   8.43769499e-15,   5.38458167e-15,
-             7.63278329e-15,   7.63278329e-15,   6.63358257e-15,
-             8.50708393e-15,   7.66053887e-15,   8.38218384e-15,
-             6.05071548e-15,   7.49400542e-15,   6.38378239e-15],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -4.85931890e-01,  -4.85931890e-01,  -3.44372756e+00,
+             4.04638309e-01,   4.04638309e-01,   1.18553235e-01,
+            -5.59823902e-01,   4.92870367e-01,  -5.59823902e-01,
+            -7.40805832e-01,   4.92870367e-01,  -7.40805832e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -7.47643942e-01,   2.49528788e+00,  -7.47643942e-01,
-            -2.85301932e-03,   1.00570604e+00,  -2.85301932e-03,
-             2.41409804e-01,  -7.87419801e-01,   1.54601000e+00,
-            -7.87419801e-01,   1.54601000e+00,   2.41409804e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  3.44372756e+00,   4.85931890e-01,   4.85931890e-01,
+            -1.18553235e-01,  -4.04638309e-01,  -4.04638309e-01,
+             7.40805832e-01,   7.40805832e-01,  -4.92870367e-01,
+            -4.92870367e-01,   5.59823902e-01,   5.59823902e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  3.49528788e+00,   2.52356058e-01,   2.52356058e-01,
-             2.00570604e+00,   9.97146981e-01,   9.97146981e-01,
-             2.54601000e+00,   2.54601000e+00,   1.24140980e+00,
-             1.24140980e+00,   2.12580199e-01,   2.12580199e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -6.19847219e-18,   3.35148811e-16,  -1.00022725e-16,
+            -2.96189892e-17,  -3.69822127e-17,  -1.57310230e-16,
+             7.96972856e-17,  -1.12042977e-17,   2.24860335e-16,
+            -4.21435619e-17,  -1.14379134e-16,  -2.90481448e-16],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  1.24344979e-14,  -3.24293183e+00,   3.24293183e+00,
-             1.40998324e-14,  -1.00855906e+00,   1.00855906e+00,
-            -1.02882960e+00,   1.02882960e+00,  -2.33342980e+00,
-             2.33342980e+00,  -1.30460019e+00,   1.30460019e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.20457074e+00,  -2.44372756e+00,  -1.76434524e-01,
+             2.25318218e+00,   1.11855323e+00,   5.56094442e-01,
+             3.93699696e+00,   6.74175116e-01,   2.46932174e+00,
+             2.06177081e-01,  -1.95093341e+00,  -9.51256225e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[ -3.49528788e+00,  -2.52356058e-01,  -2.52356058e-01,
-            -2.00570604e+00,  -9.97146981e-01,  -9.97146981e-01,
-            -2.54601000e+00,  -2.54601000e+00,  -1.24140980e+00,
-            -1.24140980e+00,  -2.12580199e-01,  -2.12580199e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -2.30167545e-01,   6.37592643e+00,  -2.30167545e-01,
+            -2.82847955e-01,   1.13786606e+00,  -2.82847955e-01,
+            -9.62843375e-02,  -2.01023374e-01,   2.60506708e+00,
+            -2.01023374e-01,   2.60506708e+00,  -9.62843375e-02],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2285,10 +2485,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
-             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
-             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
-            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00],
+          [  1.76434524e-01,   2.44372756e+00,  -1.20457074e+00,
+            -5.56094442e-01,  -1.11855323e+00,  -2.25318218e+00,
+             9.51256225e-01,  -2.06177081e-01,   1.95093341e+00,
+            -6.74175116e-01,  -2.46932174e+00,  -3.93699696e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2298,10 +2498,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.43769499e-15,   8.43769499e-15,   5.38458167e-15,
-             7.63278329e-15,   7.63278329e-15,   6.63358257e-15,
-             8.50708393e-15,   7.66053887e-15,   8.38218384e-15,
-             6.05071548e-15,   7.49400542e-15,   6.38378239e-15],
+          [  2.30167545e-01,  -6.37592643e+00,   2.30167545e-01,
+             2.82847955e-01,  -1.13786606e+00,   2.82847955e-01,
+             9.62843375e-02,   2.01023374e-01,  -2.60506708e+00,
+             2.01023374e-01,  -2.60506708e+00,   9.62843375e-02],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2311,10 +2511,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -7.47643942e-01,   2.49528788e+00,  -7.47643942e-01,
-            -2.85301932e-03,   1.00570604e+00,  -2.85301932e-03,
-             2.41409804e-01,  -7.87419801e-01,   1.54601000e+00,
-            -7.87419801e-01,   1.54601000e+00,   2.41409804e-01],
+          [  2.21356002e+00,  -5.37330206e-02,   5.17135569e+00,
+            -1.40140119e+00,  -8.38942398e-01,  -1.11531612e+00,
+             1.74991003e+00,  -2.56560608e+00,   7.50232851e-01,
+            -1.33192988e+00,  -3.02461418e-01,   1.93089196e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2324,10 +2524,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  3.49528788e+00,   2.52356058e-01,   2.52356058e-01,
-             2.00570604e+00,   9.97146981e-01,   9.97146981e-01,
-             2.54601000e+00,   2.54601000e+00,   1.24140980e+00,
-             1.24140980e+00,   2.12580199e-01,   2.12580199e-01],
+          [ -5.17135569e+00,   5.37330206e-02,  -2.21356002e+00,
+             1.11531612e+00,   8.38942398e-01,   1.40140119e+00,
+            -1.93089196e+00,   1.33192988e+00,   3.02461418e-01,
+             2.56560608e+00,  -7.50232851e-01,  -1.74991003e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2337,10 +2537,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.24344979e-14,  -3.24293183e+00,   3.24293183e+00,
-             1.40998324e-14,  -1.00855906e+00,   1.00855906e+00,
-            -1.02882960e+00,   1.02882960e+00,  -2.33342980e+00,
-             2.33342980e+00,  -1.30460019e+00,   1.30460019e+00],
+          [ -1.38100527e+00,  -9.48836306e-15,   1.38100527e+00,
+            -1.69708773e+00,   1.30826401e-14,   1.69708773e+00,
+            -4.88825318e+00,  -4.67998035e-01,  -4.42025515e+00,
+             4.67998035e-01,   4.42025515e+00,   4.88825318e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2350,14 +2550,14 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -3.49528788e+00,  -2.52356058e-01,  -2.52356058e-01,
-            -2.00570604e+00,  -9.97146981e-01,  -9.97146981e-01,
-            -2.54601000e+00,  -2.54601000e+00,  -1.24140980e+00,
-            -1.24140980e+00,  -2.12580199e-01,  -2.12580199e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
+             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
+             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
+            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2367,10 +2567,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
+          [  2.49528788e+00,  -7.47643942e-01,  -7.47643942e-01,
+             1.00570604e+00,  -2.85301932e-03,  -2.85301932e-03,
+             1.54601000e+00,   1.54601000e+00,   2.41409804e-01,
+             2.41409804e-01,  -7.87419801e-01,  -7.87419801e-01]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2380,10 +2580,10 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2393,190 +2593,23 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
-             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
-             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
-            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+          [  2.52356058e-01,   3.49528788e+00,   2.52356058e-01,
+             9.97146981e-01,   2.00570604e+00,   9.97146981e-01,
+             1.24140980e+00,   2.12580199e-01,   2.54601000e+00,
+             2.12580199e-01,   2.54601000e+00,   1.24140980e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  2.49528788e+00,  -7.47643942e-01,  -7.47643942e-01,
-             1.00570604e+00,  -2.85301932e-03,  -2.85301932e-03,
-             1.54601000e+00,   1.54601000e+00,   2.41409804e-01,
-             2.41409804e-01,  -7.87419801e-01,  -7.87419801e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  2.52356058e-01,   3.49528788e+00,   2.52356058e-01,
-             9.97146981e-01,   2.00570604e+00,   9.97146981e-01,
-             1.24140980e+00,   2.12580199e-01,   2.54601000e+00,
-             2.12580199e-01,   2.54601000e+00,   1.24140980e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -2.52356058e-01,  -3.49528788e+00,  -2.52356058e-01,
-            -9.97146981e-01,  -2.00570604e+00,  -9.97146981e-01,
-            -1.24140980e+00,  -2.12580199e-01,  -2.54601000e+00,
-            -2.12580199e-01,  -2.54601000e+00,  -1.24140980e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -3.24293183e+00,   2.05117403e-15,   3.24293183e+00,
-            -1.00855906e+00,   3.89861391e-15,   1.00855906e+00,
-            -2.33342980e+00,  -1.30460019e+00,  -1.02882960e+00,
-             1.30460019e+00,   1.02882960e+00,   2.33342980e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  7.47643942e-01,   7.47643942e-01,  -2.49528788e+00,
-             2.85301932e-03,   2.85301932e-03,  -1.00570604e+00,
-             7.87419801e-01,  -2.41409804e-01,   7.87419801e-01,
-            -1.54601000e+00,  -2.41409804e-01,  -1.54601000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  2.49528788e+00,  -7.47643942e-01,  -7.47643942e-01,
-             1.00570604e+00,  -2.85301932e-03,  -2.85301932e-03,
-             1.54601000e+00,   1.54601000e+00,   2.41409804e-01,
-             2.41409804e-01,  -7.87419801e-01,  -7.87419801e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  2.52356058e-01,   3.49528788e+00,   2.52356058e-01,
-             9.97146981e-01,   2.00570604e+00,   9.97146981e-01,
-             1.24140980e+00,   2.12580199e-01,   2.54601000e+00,
-             2.12580199e-01,   2.54601000e+00,   1.24140980e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [ -2.52356058e-01,  -3.49528788e+00,  -2.52356058e-01,
             -9.97146981e-01,  -2.00570604e+00,  -9.97146981e-01,
             -1.24140980e+00,  -2.12580199e-01,  -2.54601000e+00,
-            -2.12580199e-01,  -2.54601000e+00,  -1.24140980e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -3.24293183e+00,   2.05117403e-15,   3.24293183e+00,
-            -1.00855906e+00,   3.89861391e-15,   1.00855906e+00,
-            -2.33342980e+00,  -1.30460019e+00,  -1.02882960e+00,
-             1.30460019e+00,   1.02882960e+00,   2.33342980e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]],
+            -2.12580199e-01,  -2.54601000e+00,  -1.24140980e+00]],
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2586,12 +2619,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]]), (0, 0): array([[[-0.05512857, -0.05512857,  0.6533077 , -0.12499898, -0.12499898,
-            0.00143058, -0.04749626, -0.11771516, -0.04749626,  0.17376836,
-           -0.11771516,  0.17376836],
+          [ -3.24293183e+00,   2.61756373e-16,   3.24293183e+00,
+            -1.00855906e+00,   3.63572562e-15,   1.00855906e+00,
+            -2.33342980e+00,  -1.30460019e+00,  -1.02882960e+00,
+             1.30460019e+00,   1.02882960e+00,   2.33342980e+00]]]), (0, 0): array([[[ 0.046308  ,  0.046308  ,  0.44026899,  0.03935169,  0.03935169,
+           -0.06267372,  0.04111073,  0.01143583,  0.04111073, -0.02619323,
+            0.01143583, -0.02619323],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
@@ -2599,9 +2632,9 @@ Compiler stage 2: Computing intermediate representation
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.6533077 , -0.05512857, -0.05512857,  0.00143058, -0.12499898,
-           -0.12499898,  0.17376836,  0.17376836, -0.11771516, -0.11771516,
-           -0.04749626, -0.04749626],
+         [[ 0.44026899,  0.046308  ,  0.046308  , -0.06267372,  0.03935169,
+            0.03935169, -0.02619323, -0.02619323,  0.01143583,  0.01143583,
+            0.04111073,  0.04111073],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
@@ -2609,9 +2642,9 @@ Compiler stage 2: Computing intermediate representation
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[-0.05512857,  0.6533077 , -0.05512857, -0.12499898,  0.00143058,
-           -0.12499898, -0.11771516, -0.04749626,  0.17376836, -0.04749626,
-            0.17376836, -0.11771516],
+         [[ 0.046308  ,  0.44026899,  0.046308  ,  0.03935169, -0.06267372,
+            0.03935169,  0.01143583,  0.04111073, -0.02619323,  0.04111073,
+           -0.02619323,  0.01143583],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
@@ -2619,9 +2652,9 @@ Compiler stage 2: Computing intermediate representation
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.22051427,  0.22051427,  0.01592089,  0.49999593,  0.49999593,
-            0.24857553,  0.79016044,  0.13530783,  0.79016044,  0.06597479,
-            0.13530783,  0.06597479],
+         [[ 0.40225091, -0.20112546, -0.01452104,  0.28365493, -0.14182746,
+           -0.07051025,  0.80848895,  0.13844642, -0.06128522, -0.00511704,
+           -0.12795188, -0.0623881 ],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
@@ -2629,9 +2662,9 @@ Compiler stage 2: Computing intermediate representation
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.01592089,  0.22051427,  0.22051427,  0.24857553,  0.49999593,
-            0.49999593,  0.06597479,  0.06597479,  0.13530783,  0.13530783,
-            0.79016044,  0.79016044],
+         [[-0.20112546,  0.40225091, -0.01452104, -0.14182746,  0.28365493,
+           -0.07051025, -0.06128522, -0.12795188,  0.80848895, -0.0623881 ,
+            0.13844642, -0.00511704],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
@@ -2639,9 +2672,9 @@ Compiler stage 2: Computing intermediate representation
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.22051427,  0.01592089,  0.22051427,  0.49999593,  0.24857553,
-            0.49999593,  0.13530783,  0.79016044,  0.06597479,  0.79016044,
-            0.06597479,  0.13530783],
+         [[-0.01452104, -0.20112546,  0.40225091, -0.07051025, -0.14182746,
+            0.28365493, -0.0623881 , -0.00511704, -0.12795188,  0.13844642,
+           -0.06128522,  0.80848895],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
@@ -2649,42 +2682,42 @@ Compiler stage 2: Computing intermediate representation
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+         [[-0.01452104,  0.40225091, -0.20112546, -0.07051025,  0.28365493,
+           -0.14182746, -0.00511704, -0.0623881 ,  0.13844642, -0.12795188,
+            0.80848895, -0.06128522],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [-0.05512857, -0.05512857,  0.6533077 , -0.12499898, -0.12499898,
-            0.00143058, -0.04749626, -0.11771516, -0.04749626,  0.17376836,
-           -0.11771516,  0.17376836],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+         [[-0.20112546, -0.01452104,  0.40225091, -0.14182746, -0.07051025,
+            0.28365493, -0.12795188, -0.06128522, -0.0623881 ,  0.80848895,
+           -0.00511704,  0.13844642],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.6533077 , -0.05512857, -0.05512857,  0.00143058, -0.12499898,
-           -0.12499898,  0.17376836,  0.17376836, -0.11771516, -0.11771516,
-           -0.04749626, -0.04749626],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+         [[ 0.40225091, -0.01452104, -0.20112546,  0.28365493, -0.07051025,
+           -0.14182746,  0.13844642,  0.80848895, -0.00511704, -0.06128522,
+           -0.0623881 , -0.12795188],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [-0.05512857,  0.6533077 , -0.05512857, -0.12499898,  0.00143058,
-           -0.12499898, -0.11771516, -0.04749626,  0.17376836, -0.04749626,
-            0.17376836, -0.11771516],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+         [[ 0.09390619,  0.09390619,  0.09390619,  0.84133592,  0.84133592,
+            0.84133592,  0.28345353,  0.28345353,  0.28345353,  0.28345353,
+            0.28345353,  0.28345353],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.22051427,  0.22051427,  0.01592089,  0.49999593,  0.49999593,
-            0.24857553,  0.79016044,  0.13530783,  0.79016044,  0.06597479,
-            0.13530783,  0.06597479],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
@@ -2692,9 +2725,9 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.01592089,  0.22051427,  0.22051427,  0.24857553,  0.49999593,
-            0.49999593,  0.06597479,  0.06597479,  0.13530783,  0.13530783,
-            0.79016044,  0.79016044],
+          [ 0.046308  ,  0.046308  ,  0.44026899,  0.03935169,  0.03935169,
+           -0.06267372,  0.04111073,  0.01143583,  0.04111073, -0.02619323,
+            0.01143583, -0.02619323],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
@@ -2702,9 +2735,9 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.22051427,  0.01592089,  0.22051427,  0.49999593,  0.24857553,
-            0.49999593,  0.13530783,  0.79016044,  0.06597479,  0.79016044,
-            0.06597479,  0.13530783],
+          [ 0.44026899,  0.046308  ,  0.046308  , -0.06267372,  0.03935169,
+            0.03935169, -0.02619323, -0.02619323,  0.01143583,  0.01143583,
+            0.04111073,  0.04111073],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
@@ -2712,116 +2745,79 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
+          [ 0.046308  ,  0.44026899,  0.046308  ,  0.03935169, -0.06267372,
+            0.03935169,  0.01143583,  0.04111073, -0.02619323,  0.04111073,
+           -0.02619323,  0.01143583],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.06308901,  0.06308901,  0.87382197,  0.24928675,  0.24928675,
-            0.50142651,  0.05314505,  0.31035245,  0.05314505,  0.6365025 ,
-            0.31035245,  0.6365025 ]],
+            0.        ,  0.        ]],
   
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
+          [ 0.40225091, -0.20112546, -0.01452104,  0.28365493, -0.14182746,
+           -0.07051025,  0.80848895,  0.13844642, -0.06128522, -0.00511704,
+           -0.12795188, -0.0623881 ],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.87382197,  0.06308901,  0.06308901,  0.50142651,  0.24928675,
-            0.24928675,  0.6365025 ,  0.6365025 ,  0.31035245,  0.31035245,
-            0.05314505,  0.05314505]],
+            0.        ,  0.        ]],
   
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
+          [-0.20112546,  0.40225091, -0.01452104, -0.14182746,  0.28365493,
+           -0.07051025, -0.06128522, -0.12795188,  0.80848895, -0.0623881 ,
+            0.13844642, -0.00511704],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.06308901,  0.87382197,  0.06308901,  0.24928675,  0.50142651,
-            0.24928675,  0.31035245,  0.05314505,  0.6365025 ,  0.05314505,
-            0.6365025 ,  0.31035245]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+            0.        ,  0.        ]],
   
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.]],
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.01452104, -0.20112546,  0.40225091, -0.07051025, -0.14182746,
+            0.28365493, -0.0623881 , -0.00511704, -0.12795188,  0.13844642,
+           -0.06128522,  0.80848895],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
   
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]],
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.01452104,  0.40225091, -0.20112546, -0.07051025,  0.28365493,
+           -0.14182746, -0.00511704, -0.0623881 ,  0.13844642, -0.12795188,
+            0.80848895, -0.06128522],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
   
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.06308901,  0.06308901,  0.87382197,  0.24928675,  0.24928675,
-            0.50142651,  0.05314505,  0.31035245,  0.05314505,  0.6365025 ,
-            0.31035245,  0.6365025 ],
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.20112546, -0.01452104,  0.40225091, -0.14182746, -0.07051025,
+            0.28365493, -0.12795188, -0.06128522, -0.0623881 ,  0.80848895,
+           -0.00511704,  0.13844642],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.87382197,  0.06308901,  0.06308901,  0.50142651,  0.24928675,
-            0.24928675,  0.6365025 ,  0.6365025 ,  0.31035245,  0.31035245,
-            0.05314505,  0.05314505],
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.40225091, -0.01452104, -0.20112546,  0.28365493, -0.07051025,
+           -0.14182746,  0.13844642,  0.80848895, -0.00511704, -0.06128522,
+           -0.0623881 , -0.12795188],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.06308901,  0.87382197,  0.06308901,  0.24928675,  0.50142651,
-            0.24928675,  0.31035245,  0.05314505,  0.6365025 ,  0.05314505,
-            0.6365025 ,  0.31035245],
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.09390619,  0.09390619,  0.09390619,  0.84133592,  0.84133592,
+            0.84133592,  0.28345353,  0.28345353,  0.28345353,  0.28345353,
+            0.28345353,  0.28345353],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
@@ -2829,156 +2825,361 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.06308901,  0.06308901,  0.87382197,  0.24928675,  0.24928675,
-            0.50142651,  0.05314505,  0.31035245,  0.05314505,  0.6365025 ,
-            0.31035245,  0.6365025 ]],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.05512857, -0.05512857,  0.6533077 , -0.12499898, -0.12499898,
+            0.00143058, -0.04749626, -0.11771516, -0.04749626,  0.17376836,
+           -0.11771516,  0.17376836]],
   
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.87382197,  0.06308901,  0.06308901,  0.50142651,  0.24928675,
-            0.24928675,  0.6365025 ,  0.6365025 ,  0.31035245,  0.31035245,
-            0.05314505,  0.05314505]],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.6533077 , -0.05512857, -0.05512857,  0.00143058, -0.12499898,
+           -0.12499898,  0.17376836,  0.17376836, -0.11771516, -0.11771516,
+           -0.04749626, -0.04749626]],
   
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.06308901,  0.87382197,  0.06308901,  0.24928675,  0.50142651,
-            0.24928675,  0.31035245,  0.05314505,  0.6365025 ,  0.05314505,
-            0.6365025 ,  0.31035245]]])}}}}}
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.05512857,  0.6533077 , -0.05512857, -0.12499898,  0.00143058,
+           -0.12499898, -0.11771516, -0.04749626,  0.17376836, -0.04749626,
+            0.17376836, -0.11771516]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.22051427,  0.22051427,  0.01592089,  0.49999593,  0.49999593,
+            0.24857553,  0.79016044,  0.13530783,  0.79016044,  0.06597479,
+            0.13530783,  0.06597479]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.01592089,  0.22051427,  0.22051427,  0.24857553,  0.49999593,
+            0.49999593,  0.06597479,  0.06597479,  0.13530783,  0.13530783,
+            0.79016044,  0.79016044]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.22051427,  0.01592089,  0.22051427,  0.49999593,  0.24857553,
+            0.49999593,  0.13530783,  0.79016044,  0.06597479,  0.79016044,
+            0.06597479,  0.13530783]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -4.85931890e-01,  -4.94049246e-15,
-            4.85931890e-01,   6.37592643e+00,  -2.44372756e+00,
-           -5.37330206e-02,   5.37330206e-02,   2.44372756e+00,
-           -6.37592643e+00,  -9.10382880e-15,   0.00000000e+00,
+            7.47643942e-01,   7.66053887e-15,  -7.47643942e-01,
+            3.49528788e+00,   1.15463195e-14,  -3.49528788e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+            7.47643942e-01,   7.10542736e-15,   2.49528788e+00,
+            2.52356058e-01,  -3.24293183e+00,  -2.52356058e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.49528788e+00,   5.05151476e-15,  -7.47643942e-01,
+            2.52356058e-01,   3.24293183e+00,  -2.52356058e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -4.85931890e-01,   7.77156117e-15,
-            3.44372756e+00,  -2.30167545e-01,   1.20457074e+00,
-            2.21356002e+00,  -5.17135569e+00,   1.76434524e-01,
-            2.30167545e-01,  -1.38100527e+00,   0.00000000e+00,
+            2.85301932e-03,   7.74380560e-15,  -2.85301932e-03,
+            2.00570604e+00,   1.40998324e-14,  -2.00570604e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+            2.85301932e-03,   7.60502772e-15,   1.00570604e+00,
+            9.97146981e-01,  -1.00855906e+00,  -9.97146981e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00570604e+00,   6.68909372e-15,  -2.85301932e-03,
+            9.97146981e-01,   1.00855906e+00,  -9.97146981e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -3.44372756e+00,  -6.66133815e-16,
-            4.85931890e-01,  -2.30167545e-01,  -1.76434524e-01,
-            5.17135569e+00,  -2.21356002e+00,  -1.20457074e+00,
-            2.30167545e-01,   1.38100527e+00,   0.00000000e+00,
+            7.87419801e-01,   8.50708393e-15,   2.41409804e-01,
+            2.54601000e+00,  -1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+           -2.41409804e-01,   7.16093851e-15,  -7.87419801e-01,
+            2.54601000e+00,   1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.87419801e-01,   8.21565038e-15,   1.54601000e+00,
+            1.24140980e+00,  -2.33342980e+00,  -1.24140980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.04638309e-01,   1.85615412e-15,
-           -4.04638309e-01,   1.13786606e+00,   1.11855323e+00,
-           -8.38942398e-01,   8.38942398e-01,  -1.11855323e+00,
-           -1.13786606e+00,   6.68909372e-15,   0.00000000e+00,
+           -1.54601000e+00,   5.88418203e-15,  -7.87419801e-01,
+            1.24140980e+00,   2.33342980e+00,  -1.24140980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+           -2.41409804e-01,   7.04991621e-15,   1.54601000e+00,
+            2.12580199e-01,  -1.30460019e+00,  -2.12580199e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.54601000e+00,   6.32827124e-15,   2.41409804e-01,
+            2.12580199e-01,   1.30460019e+00,  -2.12580199e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.04638309e-01,   4.49640325e-15,
-           -1.18553235e-01,  -2.82847955e-01,   2.25318218e+00,
-           -1.40140119e+00,   1.11531612e+00,  -5.56094442e-01,
-            2.82847955e-01,  -1.69708773e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.18553235e-01,   3.27168848e-15,
-           -4.04638309e-01,  -2.82847955e-01,   5.56094442e-01,
-           -1.11531612e+00,   1.40140119e+00,  -2.25318218e+00,
-            2.82847955e-01,   1.69708773e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
+            7.66053887e-15,  -7.47643942e-01,   3.49528788e+00,
+            1.15463195e-14,  -3.49528788e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -5.59823902e-01,   3.05311332e-16,
-           -4.92870367e-01,   2.60506708e+00,   2.46932174e+00,
-            7.50232851e-01,   3.02461418e-01,   1.95093341e+00,
-           -2.60506708e+00,  -4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
+            7.10542736e-15,   2.49528788e+00,   2.52356058e-01,
+           -3.24293183e+00,  -2.52356058e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.92870367e-01,  -1.27675648e-15,
-            5.59823902e-01,   2.60506708e+00,  -1.95093341e+00,
-           -3.02461418e-01,  -7.50232851e-01,  -2.46932174e+00,
-           -2.60506708e+00,   4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -2.49528788e+00,
+            5.05151476e-15,  -7.47643942e-01,   2.52356058e-01,
+            3.24293183e+00,  -2.52356058e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -5.59823902e-01,   3.60475538e-15,
-            7.40805832e-01,  -9.62843375e-02,   3.93699696e+00,
-            1.74991003e+00,  -1.93089196e+00,   9.51256225e-01,
-            9.62843375e-02,  -4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
+            7.74380560e-15,  -2.85301932e-03,   2.00570604e+00,
+            1.40998324e-14,  -2.00570604e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -7.40805832e-01,   2.77555756e-16,
-            5.59823902e-01,  -9.62843375e-02,  -9.51256225e-01,
-            1.93089196e+00,  -1.74991003e+00,  -3.93699696e+00,
-            9.62843375e-02,   4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
+            7.60502772e-15,   1.00570604e+00,   9.97146981e-01,
+           -1.00855906e+00,  -9.97146981e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.92870367e-01,   6.44102827e-15,
-            7.40805832e-01,  -2.01023374e-01,   6.74175116e-01,
-           -2.56560608e+00,   1.33192988e+00,  -2.06177081e-01,
-            2.01023374e-01,  -4.67998035e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00570604e+00,
+            6.68909372e-15,  -2.85301932e-03,   9.97146981e-01,
+            1.00855906e+00,  -9.97146981e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -7.40805832e-01,   4.17721413e-15,
-           -4.92870367e-01,  -2.01023374e-01,   2.06177081e-01,
-           -1.33192988e+00,   2.56560608e+00,  -6.74175116e-01,
-            2.01023374e-01,   4.67998035e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
+            8.50708393e-15,   2.41409804e-01,   2.54601000e+00,
+           -1.02882960e+00,  -2.54601000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
+            7.16093851e-15,  -7.87419801e-01,   2.54601000e+00,
+            1.02882960e+00,  -2.54601000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
+            8.21565038e-15,   1.54601000e+00,   1.24140980e+00,
+           -2.33342980e+00,  -1.24140980e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
+            5.88418203e-15,  -7.87419801e-01,   1.24140980e+00,
+            2.33342980e+00,  -1.24140980e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
+            7.04991621e-15,   1.54601000e+00,   2.12580199e-01,
+           -1.30460019e+00,  -2.12580199e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
+            6.32827124e-15,   2.41409804e-01,   2.12580199e-01,
+            1.30460019e+00,  -2.12580199e-01]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -4.85931890e-01,   3.44372756e+00,
+           -6.19847219e-18,   1.20457074e+00,  -2.30167545e-01,
+            1.76434524e-01,   2.30167545e-01,   2.21356002e+00,
+           -5.17135569e+00,  -1.38100527e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -4.85931890e-01,   4.85931890e-01,
+            3.35148811e-16,  -2.44372756e+00,   6.37592643e+00,
+            2.44372756e+00,  -6.37592643e+00,  -5.37330206e-02,
+            5.37330206e-02,  -9.48836306e-15,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -3.44372756e+00,   4.85931890e-01,
+           -1.00022725e-16,  -1.76434524e-01,  -2.30167545e-01,
+           -1.20457074e+00,   2.30167545e-01,   5.17135569e+00,
+           -2.21356002e+00,   1.38100527e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.04638309e-01,  -1.18553235e-01,
+           -2.96189892e-17,   2.25318218e+00,  -2.82847955e-01,
+           -5.56094442e-01,   2.82847955e-01,  -1.40140119e+00,
+            1.11531612e+00,  -1.69708773e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.04638309e-01,  -4.04638309e-01,
+           -3.69822127e-17,   1.11855323e+00,   1.13786606e+00,
+           -1.11855323e+00,  -1.13786606e+00,  -8.38942398e-01,
+            8.38942398e-01,   1.30826401e-14,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.18553235e-01,  -4.04638309e-01,
+           -1.57310230e-16,   5.56094442e-01,  -2.82847955e-01,
+           -2.25318218e+00,   2.82847955e-01,  -1.11531612e+00,
+            1.40140119e+00,   1.69708773e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -5.59823902e-01,   7.40805832e-01,
+            7.96972856e-17,   3.93699696e+00,  -9.62843375e-02,
+            9.51256225e-01,   9.62843375e-02,   1.74991003e+00,
+           -1.93089196e+00,  -4.88825318e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.92870367e-01,   7.40805832e-01,
+           -1.12042977e-17,   6.74175116e-01,  -2.01023374e-01,
+           -2.06177081e-01,   2.01023374e-01,  -2.56560608e+00,
+            1.33192988e+00,  -4.67998035e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -5.59823902e-01,  -4.92870367e-01,
+            2.24860335e-16,   2.46932174e+00,   2.60506708e+00,
+            1.95093341e+00,  -2.60506708e+00,   7.50232851e-01,
+            3.02461418e-01,  -4.42025515e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -7.40805832e-01,  -4.92870367e-01,
+           -4.21435619e-17,   2.06177081e-01,  -2.01023374e-01,
+           -6.74175116e-01,   2.01023374e-01,  -1.33192988e+00,
+            2.56560608e+00,   4.67998035e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.92870367e-01,   5.59823902e-01,
+           -1.14379134e-16,  -1.95093341e+00,   2.60506708e+00,
+           -2.46932174e+00,  -2.60506708e+00,  -3.02461418e-01,
+           -7.50232851e-01,   4.42025515e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C2_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -7.40805832e-01,   5.59823902e-01,
+           -2.90481448e-16,  -9.51256225e-01,  -9.62843375e-02,
+           -3.93699696e+00,   9.62843375e-02,   1.93089196e+00,
+           -1.74991003e+00,   4.88825318e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -2995,7 +3196,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
            -7.47643942e-01,   0.00000000e+00,   3.49528788e+00,
-           -3.49528788e+00,   2.05117403e-15],
+           -3.49528788e+00,   2.61756373e-16],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3022,7 +3223,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
            -2.85301932e-03,   0.00000000e+00,   2.00570604e+00,
-           -2.00570604e+00,   3.89861391e-15],
+           -2.00570604e+00,   3.63572562e-15],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3085,98 +3286,156 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
            -7.87419801e-01,   0.00000000e+00,   1.24140980e+00,
-           -1.24140980e+00,   2.33342980e+00]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.24140980e+00,   2.33342980e+00]]), 'FE0_C0_D01': array([[  7.47643942e-01,   7.66053887e-15,  -7.47643942e-01,
+            3.49528788e+00,   1.15463195e-14,  -3.49528788e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.47643942e-01,   2.49528788e+00,   0.00000000e+00,
-            2.52356058e-01,  -2.52356058e-01,  -3.24293183e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  7.47643942e-01,   7.10542736e-15,   2.49528788e+00,
+            2.52356058e-01,  -3.24293183e+00,  -2.52356058e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.47643942e-01,  -7.47643942e-01,   0.00000000e+00,
-            3.49528788e+00,  -3.49528788e+00,   2.05117403e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -2.49528788e+00,   5.05151476e-15,  -7.47643942e-01,
+            2.52356058e-01,   3.24293183e+00,  -2.52356058e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.49528788e+00,  -7.47643942e-01,   0.00000000e+00,
-            2.52356058e-01,  -2.52356058e-01,   3.24293183e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  2.85301932e-03,   7.74380560e-15,  -2.85301932e-03,
+            2.00570604e+00,   1.40998324e-14,  -2.00570604e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.85301932e-03,   1.00570604e+00,   0.00000000e+00,
-            9.97146981e-01,  -9.97146981e-01,  -1.00855906e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  2.85301932e-03,   7.60502772e-15,   1.00570604e+00,
+            9.97146981e-01,  -1.00855906e+00,  -9.97146981e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.85301932e-03,  -2.85301932e-03,   0.00000000e+00,
-            2.00570604e+00,  -2.00570604e+00,   3.89861391e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00570604e+00,   6.68909372e-15,  -2.85301932e-03,
+            9.97146981e-01,   1.00855906e+00,  -9.97146981e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00570604e+00,  -2.85301932e-03,   0.00000000e+00,
-            9.97146981e-01,  -9.97146981e-01,   1.00855906e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  7.87419801e-01,   8.50708393e-15,   2.41409804e-01,
+            2.54601000e+00,  -1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.87419801e-01,   1.54601000e+00,   0.00000000e+00,
-            1.24140980e+00,  -1.24140980e+00,  -2.33342980e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -2.41409804e-01,   7.16093851e-15,  -7.87419801e-01,
+            2.54601000e+00,   1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.41409804e-01,   1.54601000e+00,   0.00000000e+00,
-            2.12580199e-01,  -2.12580199e-01,  -1.30460019e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  7.87419801e-01,   8.21565038e-15,   1.54601000e+00,
+            1.24140980e+00,  -2.33342980e+00,  -1.24140980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.87419801e-01,   2.41409804e-01,   0.00000000e+00,
-            2.54601000e+00,  -2.54601000e+00,  -1.02882960e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.54601000e+00,   5.88418203e-15,  -7.87419801e-01,
+            1.24140980e+00,   2.33342980e+00,  -1.24140980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.54601000e+00,   2.41409804e-01,   0.00000000e+00,
-            2.12580199e-01,  -2.12580199e-01,   1.30460019e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -2.41409804e-01,   7.04991621e-15,   1.54601000e+00,
+            2.12580199e-01,  -1.30460019e+00,  -2.12580199e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.41409804e-01,  -7.87419801e-01,   0.00000000e+00,
-            2.54601000e+00,  -2.54601000e+00,   1.02882960e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.54601000e+00,   6.32827124e-15,   2.41409804e-01,
+            2.12580199e-01,   1.30460019e+00,  -2.12580199e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.54601000e+00,  -7.87419801e-01,   0.00000000e+00,
-            1.24140980e+00,  -1.24140980e+00,   2.33342980e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE2_C0_D01': array([[ -4.85931890e-01,  -4.94049246e-15,   4.85931890e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE0_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -4.85931890e-01,  -4.27435864e-15,   4.85931890e-01,
             6.37592643e+00,  -2.44372756e+00,  -5.37330206e-02,
             5.37330206e-02,   2.44372756e+00,  -6.37592643e+00,
-           -9.10382880e-15,   0.00000000e+00,   0.00000000e+00,
+           -1.06581410e-14,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -4.85931890e-01,   7.77156117e-15,   3.44372756e+00,
+         [ -4.85931890e-01,   6.10622664e-15,   3.44372756e+00,
            -2.30167545e-01,   1.20457074e+00,   2.21356002e+00,
            -5.17135569e+00,   1.76434524e-01,   2.30167545e-01,
            -1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3185,7 +3444,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -3.44372756e+00,  -6.66133815e-16,   4.85931890e-01,
+         [ -3.44372756e+00,   1.66533454e-16,   4.85931890e-01,
            -2.30167545e-01,  -1.76434524e-01,   5.17135569e+00,
            -2.21356002e+00,  -1.20457074e+00,   2.30167545e-01,
             1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3194,16 +3453,16 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  4.04638309e-01,   1.85615412e-15,  -4.04638309e-01,
+         [  4.04638309e-01,   1.59594560e-15,  -4.04638309e-01,
             1.13786606e+00,   1.11855323e+00,  -8.38942398e-01,
             8.38942398e-01,  -1.11855323e+00,  -1.13786606e+00,
-            6.68909372e-15,   0.00000000e+00,   0.00000000e+00,
+            6.84174939e-15,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  4.04638309e-01,   4.49640325e-15,  -1.18553235e-01,
+         [  4.04638309e-01,   4.44089210e-15,  -1.18553235e-01,
            -2.82847955e-01,   2.25318218e+00,  -1.40140119e+00,
             1.11531612e+00,  -5.56094442e-01,   2.82847955e-01,
            -1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3212,7 +3471,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  1.18553235e-01,   3.27168848e-15,  -4.04638309e-01,
+         [  1.18553235e-01,   3.17107451e-15,  -4.04638309e-01,
            -2.82847955e-01,   5.56094442e-01,  -1.11531612e+00,
             1.40140119e+00,  -2.25318218e+00,   2.82847955e-01,
             1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3221,7 +3480,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -5.59823902e-01,   3.05311332e-16,  -4.92870367e-01,
+         [ -5.59823902e-01,  -9.71445147e-17,  -4.92870367e-01,
             2.60506708e+00,   2.46932174e+00,   7.50232851e-01,
             3.02461418e-01,   1.95093341e+00,  -2.60506708e+00,
            -4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3230,7 +3489,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  4.92870367e-01,  -1.27675648e-15,   5.59823902e-01,
+         [  4.92870367e-01,  -1.05471187e-15,   5.59823902e-01,
             2.60506708e+00,  -1.95093341e+00,  -3.02461418e-01,
            -7.50232851e-01,  -2.46932174e+00,  -2.60506708e+00,
             4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3239,7 +3498,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -5.59823902e-01,   3.60475538e-15,   7.40805832e-01,
+         [ -5.59823902e-01,   3.34801631e-15,   7.40805832e-01,
            -9.62843375e-02,   3.93699696e+00,   1.74991003e+00,
            -1.93089196e+00,   9.51256225e-01,   9.62843375e-02,
            -4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3248,7 +3507,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -7.40805832e-01,   2.77555756e-16,   5.59823902e-01,
+         [ -7.40805832e-01,   7.21644966e-16,   5.59823902e-01,
            -9.62843375e-02,  -9.51256225e-01,   1.93089196e+00,
            -1.74991003e+00,  -3.93699696e+00,   9.62843375e-02,
             4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
@@ -3257,7 +3516,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  4.92870367e-01,   6.44102827e-15,   7.40805832e-01,
+         [  4.92870367e-01,   6.21031004e-15,   7.40805832e-01,
            -2.01023374e-01,   6.74175116e-01,  -2.56560608e+00,
             1.33192988e+00,  -2.06177081e-01,   2.01023374e-01,
            -4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
@@ -3266,7 +3525,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -7.40805832e-01,   4.17721413e-15,  -4.92870367e-01,
+         [ -7.40805832e-01,   4.01068068e-15,  -4.92870367e-01,
            -2.01023374e-01,   2.06177081e-01,  -1.33192988e+00,
             2.56560608e+00,  -6.74175116e-01,   2.01023374e-01,
             4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
@@ -3274,643 +3533,383 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
-          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619,
+            0.00000000e+00,   0.00000000e+00]]), 'FE0_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.06308901,  0.87382197,  0.06308901],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.046308  ,  0.046308  ,  0.44026899, -0.20112546,  0.40225091,
-          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.06308901,  0.06308901,  0.87382197],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.44026899,  0.046308  ,  0.046308  , -0.01452104, -0.01452104,
-           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.87382197,  0.06308901,  0.06308901],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.03935169, -0.06267372,  0.03935169,  0.28365493, -0.14182746,
-          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.24928675,  0.50142651,  0.24928675],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.03935169,  0.03935169, -0.06267372, -0.14182746,  0.28365493,
-          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.24928675,  0.24928675,  0.50142651],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.06267372,  0.03935169,  0.03935169, -0.07051025, -0.07051025,
-           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.50142651,  0.24928675,  0.24928675],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.04111073, -0.02619323,  0.01143583,  0.80848895, -0.06128522,
-          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.05314505,  0.6365025 ,  0.31035245],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.01143583, -0.02619323,  0.04111073,  0.13844642, -0.12795188,
-          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.31035245,  0.6365025 ,  0.05314505],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.04111073,  0.01143583, -0.02619323, -0.06128522,  0.80848895,
-          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.05314505,  0.31035245,  0.6365025 ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
-           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.6365025 ,  0.31035245,  0.05314505],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.01143583,  0.04111073, -0.02619323, -0.12795188,  0.13844642,
-          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
+           0.        ,  0.        ,  0.31035245,  0.05314505,  0.6365025 ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.02619323,  0.04111073,  0.01143583, -0.0623881 , -0.00511704,
-           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE2_C0': array([[ 0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
-          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.046308  ,  0.046308  ,  0.44026899, -0.20112546,  0.40225091,
-          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44026899,  0.046308  ,  0.046308  , -0.01452104, -0.01452104,
-           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.03935169, -0.06267372,  0.03935169,  0.28365493, -0.14182746,
-          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.03935169,  0.03935169, -0.06267372, -0.14182746,  0.28365493,
-          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [-0.06267372,  0.03935169,  0.03935169, -0.07051025, -0.07051025,
-           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04111073, -0.02619323,  0.01143583,  0.80848895, -0.06128522,
-          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.01143583, -0.02619323,  0.04111073,  0.13844642, -0.12795188,
-          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04111073,  0.01143583, -0.02619323, -0.06128522,  0.80848895,
-          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [-0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
-           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.01143583,  0.04111073, -0.02619323, -0.12795188,  0.13844642,
-          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [-0.02619323,  0.04111073,  0.01143583, -0.0623881 , -0.00511704,
-           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
-           0.22051427],
+           0.        ,  0.        ,  0.6365025 ,  0.05314505,  0.31035245]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.05512857,  0.6533077 , -0.05512857,  0.22051427,
+           0.01592089,  0.22051427,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
-           0.01592089],
+           0.        , -0.05512857, -0.05512857,  0.6533077 ,  0.22051427,
+           0.22051427,  0.01592089,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
-           0.22051427],
+           0.        ,  0.6533077 , -0.05512857, -0.05512857,  0.01592089,
+           0.22051427,  0.22051427,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
-           0.49999593],
+           0.        , -0.12499898,  0.00143058, -0.12499898,  0.49999593,
+           0.24857553,  0.49999593,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
-           0.24857553],
+           0.        , -0.12499898, -0.12499898,  0.00143058,  0.49999593,
+           0.49999593,  0.24857553,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
-           0.49999593],
+           0.        ,  0.00143058, -0.12499898, -0.12499898,  0.24857553,
+           0.49999593,  0.49999593,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
-           0.13530783],
+           0.        , -0.04749626,  0.17376836, -0.11771516,  0.79016044,
+           0.06597479,  0.13530783,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
-           0.79016044],
+           0.        , -0.11771516,  0.17376836, -0.04749626,  0.13530783,
+           0.06597479,  0.79016044,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
-           0.06597479],
+           0.        , -0.04749626, -0.11771516,  0.17376836,  0.79016044,
+           0.13530783,  0.06597479,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
-           0.79016044],
+           0.        ,  0.17376836, -0.11771516, -0.04749626,  0.06597479,
+           0.13530783,  0.79016044,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
-           0.06597479],
+           0.        , -0.11771516, -0.04749626,  0.17376836,  0.13530783,
+           0.79016044,  0.06597479,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
-           0.13530783]]), 'FE3': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_C0_D01': array([[  7.47643942e-01,   8.43769499e-15,  -7.47643942e-01,
-            3.49528788e+00,   1.24344979e-14,  -3.49528788e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.47643942e-01,   8.43769499e-15,   2.49528788e+00,
-            2.52356058e-01,  -3.24293183e+00,  -2.52356058e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.        ,  0.17376836, -0.04749626, -0.11771516,  0.06597479,
+           0.79016044,  0.13530783,  0.        ,  0.        ,  0.        ]]), 'FE0_C0': array([[-0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
+           0.22051427,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
+           0.01592089,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
+           0.22051427,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
+           0.49999593,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
+           0.24857553,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
+           0.49999593,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
+           0.13530783,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
+           0.79016044,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
+           0.06597479,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
+           0.79016044,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
+           0.06597479,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
+           0.13530783,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE3_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.49528788e+00,   5.38458167e-15,  -7.47643942e-01,
-            2.52356058e-01,   3.24293183e+00,  -2.52356058e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -4.85931890e-01,  -4.27435864e-15,
+            4.85931890e-01,   6.37592643e+00,  -2.44372756e+00,
+           -5.37330206e-02,   5.37330206e-02,   2.44372756e+00,
+           -6.37592643e+00,  -1.06581410e-14,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.85301932e-03,   7.63278329e-15,  -2.85301932e-03,
-            2.00570604e+00,   1.40998324e-14,  -2.00570604e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.85301932e-03,   7.63278329e-15,   1.00570604e+00,
-            9.97146981e-01,  -1.00855906e+00,  -9.97146981e-01,
+            0.00000000e+00,  -4.85931890e-01,   6.10622664e-15,
+            3.44372756e+00,  -2.30167545e-01,   1.20457074e+00,
+            2.21356002e+00,  -5.17135569e+00,   1.76434524e-01,
+            2.30167545e-01,  -1.38100527e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00570604e+00,   6.63358257e-15,  -2.85301932e-03,
-            9.97146981e-01,   1.00855906e+00,  -9.97146981e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -3.44372756e+00,   1.66533454e-16,
+            4.85931890e-01,  -2.30167545e-01,  -1.76434524e-01,
+            5.17135569e+00,  -2.21356002e+00,  -1.20457074e+00,
+            2.30167545e-01,   1.38100527e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.87419801e-01,   8.50708393e-15,   2.41409804e-01,
-            2.54601000e+00,  -1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.41409804e-01,   7.66053887e-15,  -7.87419801e-01,
-            2.54601000e+00,   1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   4.04638309e-01,   1.59594560e-15,
+           -4.04638309e-01,   1.13786606e+00,   1.11855323e+00,
+           -8.38942398e-01,   8.38942398e-01,  -1.11855323e+00,
+           -1.13786606e+00,   6.84174939e-15,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.87419801e-01,   8.38218384e-15,   1.54601000e+00,
-            1.24140980e+00,  -2.33342980e+00,  -1.24140980e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.04638309e-01,   4.44089210e-15,
+           -1.18553235e-01,  -2.82847955e-01,   2.25318218e+00,
+           -1.40140119e+00,   1.11531612e+00,  -5.56094442e-01,
+            2.82847955e-01,  -1.69708773e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.54601000e+00,   6.05071548e-15,  -7.87419801e-01,
-            1.24140980e+00,   2.33342980e+00,  -1.24140980e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.41409804e-01,   7.49400542e-15,   1.54601000e+00,
-            2.12580199e-01,  -1.30460019e+00,  -2.12580199e-01,
+            0.00000000e+00,   1.18553235e-01,   3.17107451e-15,
+           -4.04638309e-01,  -2.82847955e-01,   5.56094442e-01,
+           -1.11531612e+00,   1.40140119e+00,  -2.25318218e+00,
+            2.82847955e-01,   1.69708773e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.54601000e+00,   6.38378239e-15,   2.41409804e-01,
-            2.12580199e-01,   1.30460019e+00,  -2.12580199e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -5.59823902e-01,  -9.71445147e-17,
+           -4.92870367e-01,   2.60506708e+00,   2.46932174e+00,
+            7.50232851e-01,   3.02461418e-01,   1.95093341e+00,
+           -2.60506708e+00,  -4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.06308901,  0.87382197,
-           0.06308901],
-         [ 0.        ,  0.        ,  0.        ,  0.06308901,  0.06308901,
-           0.87382197],
-         [ 0.        ,  0.        ,  0.        ,  0.87382197,  0.06308901,
-           0.06308901],
-         [ 0.        ,  0.        ,  0.        ,  0.24928675,  0.50142651,
-           0.24928675],
-         [ 0.        ,  0.        ,  0.        ,  0.24928675,  0.24928675,
-           0.50142651],
-         [ 0.        ,  0.        ,  0.        ,  0.50142651,  0.24928675,
-           0.24928675],
-         [ 0.        ,  0.        ,  0.        ,  0.05314505,  0.6365025 ,
-           0.31035245],
-         [ 0.        ,  0.        ,  0.        ,  0.31035245,  0.6365025 ,
-           0.05314505],
-         [ 0.        ,  0.        ,  0.        ,  0.05314505,  0.31035245,
-           0.6365025 ],
-         [ 0.        ,  0.        ,  0.        ,  0.6365025 ,  0.31035245,
-           0.05314505],
-         [ 0.        ,  0.        ,  0.        ,  0.31035245,  0.05314505,
-           0.6365025 ],
-         [ 0.        ,  0.        ,  0.        ,  0.6365025 ,  0.05314505,
-           0.31035245]]), 'FE0_C0': array([[ 0.06308901,  0.87382197,  0.06308901,  0.        ,  0.        ,
-           0.        ],
-         [ 0.06308901,  0.06308901,  0.87382197,  0.        ,  0.        ,
-           0.        ],
-         [ 0.87382197,  0.06308901,  0.06308901,  0.        ,  0.        ,
-           0.        ],
-         [ 0.24928675,  0.50142651,  0.24928675,  0.        ,  0.        ,
-           0.        ],
-         [ 0.24928675,  0.24928675,  0.50142651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.50142651,  0.24928675,  0.24928675,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05314505,  0.6365025 ,  0.31035245,  0.        ,  0.        ,
-           0.        ],
-         [ 0.31035245,  0.6365025 ,  0.05314505,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05314505,  0.31035245,  0.6365025 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.6365025 ,  0.31035245,  0.05314505,  0.        ,  0.        ,
-           0.        ],
-         [ 0.31035245,  0.05314505,  0.6365025 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.6365025 ,  0.05314505,  0.31035245,  0.        ,  0.        ,
-           0.        ]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -4.85931890e-01,   3.44372756e+00,
-           -6.19847219e-18,   1.20457074e+00,  -2.30167545e-01,
-            1.76434524e-01,   2.30167545e-01,   2.21356002e+00,
-           -5.17135569e+00,  -1.38100527e+00,   0.00000000e+00,
+            0.00000000e+00,   4.92870367e-01,  -1.05471187e-15,
+            5.59823902e-01,   2.60506708e+00,  -1.95093341e+00,
+           -3.02461418e-01,  -7.50232851e-01,  -2.46932174e+00,
+           -2.60506708e+00,   4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -4.85931890e-01,   4.85931890e-01,
-            3.35148811e-16,  -2.44372756e+00,   6.37592643e+00,
-            2.44372756e+00,  -6.37592643e+00,  -5.37330206e-02,
-            5.37330206e-02,  -1.32779142e-14,   0.00000000e+00,
+            0.00000000e+00,  -5.59823902e-01,   3.34801631e-15,
+            7.40805832e-01,  -9.62843375e-02,   3.93699696e+00,
+            1.74991003e+00,  -1.93089196e+00,   9.51256225e-01,
+            9.62843375e-02,  -4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -3.44372756e+00,   4.85931890e-01,
-           -1.00022725e-16,  -1.76434524e-01,  -2.30167545e-01,
-           -1.20457074e+00,   2.30167545e-01,   5.17135569e+00,
-           -2.21356002e+00,   1.38100527e+00,   0.00000000e+00,
+            0.00000000e+00,  -7.40805832e-01,   7.21644966e-16,
+            5.59823902e-01,  -9.62843375e-02,  -9.51256225e-01,
+            1.93089196e+00,  -1.74991003e+00,  -3.93699696e+00,
+            9.62843375e-02,   4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.04638309e-01,  -1.18553235e-01,
-           -2.96189892e-17,   2.25318218e+00,  -2.82847955e-01,
-           -5.56094442e-01,   2.82847955e-01,  -1.40140119e+00,
-            1.11531612e+00,  -1.69708773e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.04638309e-01,  -4.04638309e-01,
-           -3.69822127e-17,   1.11855323e+00,   1.13786606e+00,
-           -1.11855323e+00,  -1.13786606e+00,  -8.38942398e-01,
-            8.38942398e-01,   1.36155758e-14,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.18553235e-01,  -4.04638309e-01,
-           -1.57310230e-16,   5.56094442e-01,  -2.82847955e-01,
-           -2.25318218e+00,   2.82847955e-01,  -1.11531612e+00,
-            1.40140119e+00,   1.69708773e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -5.59823902e-01,   7.40805832e-01,
-            7.96972856e-17,   3.93699696e+00,  -9.62843375e-02,
-            9.51256225e-01,   9.62843375e-02,   1.74991003e+00,
-           -1.93089196e+00,  -4.88825318e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.92870367e-01,   7.40805832e-01,
-           -1.12042977e-17,   6.74175116e-01,  -2.01023374e-01,
-           -2.06177081e-01,   2.01023374e-01,  -2.56560608e+00,
-            1.33192988e+00,  -4.67998035e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -5.59823902e-01,  -4.92870367e-01,
-            2.24860335e-16,   2.46932174e+00,   2.60506708e+00,
-            1.95093341e+00,  -2.60506708e+00,   7.50232851e-01,
-            3.02461418e-01,  -4.42025515e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -7.40805832e-01,  -4.92870367e-01,
-           -4.21435619e-17,   2.06177081e-01,  -2.01023374e-01,
-           -6.74175116e-01,   2.01023374e-01,  -1.33192988e+00,
-            2.56560608e+00,   4.67998035e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.92870367e-01,   5.59823902e-01,
-           -1.14379134e-16,  -1.95093341e+00,   2.60506708e+00,
-           -2.46932174e+00,  -2.60506708e+00,  -3.02461418e-01,
-           -7.50232851e-01,   4.42025515e+00,   0.00000000e+00,
+            0.00000000e+00,   4.92870367e-01,   6.21031004e-15,
+            7.40805832e-01,  -2.01023374e-01,   6.74175116e-01,
+           -2.56560608e+00,   1.33192988e+00,  -2.06177081e-01,
+            2.01023374e-01,  -4.67998035e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -7.40805832e-01,   5.59823902e-01,
-           -2.90481448e-16,  -9.51256225e-01,  -9.62843375e-02,
-           -3.93699696e+00,   9.62843375e-02,   1.93089196e+00,
-           -1.74991003e+00,   4.88825318e+00,   0.00000000e+00,
+            0.00000000e+00,  -7.40805832e-01,   4.01068068e-15,
+           -4.92870367e-01,  -2.01023374e-01,   2.06177081e-01,
+           -1.33192988e+00,   2.56560608e+00,  -6.74175116e-01,
+            2.01023374e-01,   4.67998035e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.47643942e-01,   8.43769499e-15,  -7.47643942e-01,
-            3.49528788e+00,   1.24344979e-14,  -3.49528788e+00,
+            7.47643942e-01,   2.49528788e+00,   0.00000000e+00,
+            2.52356058e-01,  -2.52356058e-01,  -3.24293183e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.47643942e-01,   8.43769499e-15,   2.49528788e+00,
-            2.52356058e-01,  -3.24293183e+00,  -2.52356058e-01,
+            7.47643942e-01,  -7.47643942e-01,   0.00000000e+00,
+            3.49528788e+00,  -3.49528788e+00,   2.61756373e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.49528788e+00,   5.38458167e-15,  -7.47643942e-01,
-            2.52356058e-01,   3.24293183e+00,  -2.52356058e-01,
+           -2.49528788e+00,  -7.47643942e-01,   0.00000000e+00,
+            2.52356058e-01,  -2.52356058e-01,   3.24293183e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.85301932e-03,   7.63278329e-15,  -2.85301932e-03,
-            2.00570604e+00,   1.40998324e-14,  -2.00570604e+00,
+            2.85301932e-03,   1.00570604e+00,   0.00000000e+00,
+            9.97146981e-01,  -9.97146981e-01,  -1.00855906e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.85301932e-03,   7.63278329e-15,   1.00570604e+00,
-            9.97146981e-01,  -1.00855906e+00,  -9.97146981e-01,
+            2.85301932e-03,  -2.85301932e-03,   0.00000000e+00,
+            2.00570604e+00,  -2.00570604e+00,   3.63572562e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00570604e+00,   6.63358257e-15,  -2.85301932e-03,
-            9.97146981e-01,   1.00855906e+00,  -9.97146981e-01,
+           -1.00570604e+00,  -2.85301932e-03,   0.00000000e+00,
+            9.97146981e-01,  -9.97146981e-01,   1.00855906e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.87419801e-01,   8.50708393e-15,   2.41409804e-01,
-            2.54601000e+00,  -1.02882960e+00,  -2.54601000e+00,
+            7.87419801e-01,   1.54601000e+00,   0.00000000e+00,
+            1.24140980e+00,  -1.24140980e+00,  -2.33342980e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.41409804e-01,   7.66053887e-15,  -7.87419801e-01,
-            2.54601000e+00,   1.02882960e+00,  -2.54601000e+00,
+           -2.41409804e-01,   1.54601000e+00,   0.00000000e+00,
+            2.12580199e-01,  -2.12580199e-01,  -1.30460019e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.87419801e-01,   8.38218384e-15,   1.54601000e+00,
-            1.24140980e+00,  -2.33342980e+00,  -1.24140980e+00,
+            7.87419801e-01,   2.41409804e-01,   0.00000000e+00,
+            2.54601000e+00,  -2.54601000e+00,  -1.02882960e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.54601000e+00,   6.05071548e-15,  -7.87419801e-01,
-            1.24140980e+00,   2.33342980e+00,  -1.24140980e+00,
+           -1.54601000e+00,   2.41409804e-01,   0.00000000e+00,
+            2.12580199e-01,  -2.12580199e-01,   1.30460019e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.41409804e-01,   7.49400542e-15,   1.54601000e+00,
-            2.12580199e-01,  -1.30460019e+00,  -2.12580199e-01,
+           -2.41409804e-01,  -7.87419801e-01,   0.00000000e+00,
+            2.54601000e+00,  -2.54601000e+00,   1.02882960e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.54601000e+00,   6.38378239e-15,   2.41409804e-01,
-            2.12580199e-01,   1.30460019e+00,  -2.12580199e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
-            8.43769499e-15,  -7.47643942e-01,   3.49528788e+00,
-            1.24344979e-14,  -3.49528788e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
-            8.43769499e-15,   2.49528788e+00,   2.52356058e-01,
-           -3.24293183e+00,  -2.52356058e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -2.49528788e+00,
-            5.38458167e-15,  -7.47643942e-01,   2.52356058e-01,
-            3.24293183e+00,  -2.52356058e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
-            7.63278329e-15,  -2.85301932e-03,   2.00570604e+00,
-            1.40998324e-14,  -2.00570604e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
-            7.63278329e-15,   1.00570604e+00,   9.97146981e-01,
-           -1.00855906e+00,  -9.97146981e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00570604e+00,
-            6.63358257e-15,  -2.85301932e-03,   9.97146981e-01,
-            1.00855906e+00,  -9.97146981e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
-            8.50708393e-15,   2.41409804e-01,   2.54601000e+00,
-           -1.02882960e+00,  -2.54601000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.54601000e+00,  -7.87419801e-01,   0.00000000e+00,
+            1.24140980e+00,  -1.24140980e+00,   2.33342980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D10': array([[  7.47643942e-01,   2.49528788e+00,   0.00000000e+00,
+            2.52356058e-01,  -2.52356058e-01,  -3.24293183e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.47643942e-01,  -7.47643942e-01,   0.00000000e+00,
+            3.49528788e+00,  -3.49528788e+00,   2.61756373e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
-            7.66053887e-15,  -7.87419801e-01,   2.54601000e+00,
-            1.02882960e+00,  -2.54601000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.49528788e+00,  -7.47643942e-01,   0.00000000e+00,
+            2.52356058e-01,  -2.52356058e-01,   3.24293183e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.85301932e-03,   1.00570604e+00,   0.00000000e+00,
+            9.97146981e-01,  -9.97146981e-01,  -1.00855906e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.85301932e-03,  -2.85301932e-03,   0.00000000e+00,
+            2.00570604e+00,  -2.00570604e+00,   3.63572562e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
-            8.38218384e-15,   1.54601000e+00,   1.24140980e+00,
-           -2.33342980e+00,  -1.24140980e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00570604e+00,  -2.85301932e-03,   0.00000000e+00,
+            9.97146981e-01,  -9.97146981e-01,   1.00855906e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.87419801e-01,   1.54601000e+00,   0.00000000e+00,
+            1.24140980e+00,  -1.24140980e+00,  -2.33342980e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
-            6.05071548e-15,  -7.87419801e-01,   1.24140980e+00,
-            2.33342980e+00,  -1.24140980e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.41409804e-01,   1.54601000e+00,   0.00000000e+00,
+            2.12580199e-01,  -2.12580199e-01,  -1.30460019e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.87419801e-01,   2.41409804e-01,   0.00000000e+00,
+            2.54601000e+00,  -2.54601000e+00,  -1.02882960e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.54601000e+00,   2.41409804e-01,   0.00000000e+00,
+            2.12580199e-01,  -2.12580199e-01,   1.30460019e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
-            7.49400542e-15,   1.54601000e+00,   2.12580199e-01,
-           -1.30460019e+00,  -2.12580199e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.41409804e-01,  -7.87419801e-01,   0.00000000e+00,
+            2.54601000e+00,  -2.54601000e+00,   1.02882960e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.54601000e+00,  -7.87419801e-01,   0.00000000e+00,
+            1.24140980e+00,  -1.24140980e+00,   2.33342980e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
-            6.38378239e-15,   2.41409804e-01,   2.12580199e-01,
-            1.30460019e+00,  -2.12580199e-01]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
@@ -3921,477 +3920,465 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0_D10': array([[ -4.85931890e-01,   3.44372756e+00,  -6.19847219e-18,
-            1.20457074e+00,  -2.30167545e-01,   1.76434524e-01,
-            2.30167545e-01,   2.21356002e+00,  -5.17135569e+00,
-           -1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -4.85931890e-01,   4.85931890e-01,   3.35148811e-16,
-           -2.44372756e+00,   6.37592643e+00,   2.44372756e+00,
-           -6.37592643e+00,  -5.37330206e-02,   5.37330206e-02,
-           -1.32779142e-14,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -3.44372756e+00,   4.85931890e-01,  -1.00022725e-16,
-           -1.76434524e-01,  -2.30167545e-01,  -1.20457074e+00,
-            2.30167545e-01,   5.17135569e+00,  -2.21356002e+00,
-            1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  4.04638309e-01,  -1.18553235e-01,  -2.96189892e-17,
-            2.25318218e+00,  -2.82847955e-01,  -5.56094442e-01,
-            2.82847955e-01,  -1.40140119e+00,   1.11531612e+00,
-           -1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  4.04638309e-01,  -4.04638309e-01,  -3.69822127e-17,
-            1.11855323e+00,   1.13786606e+00,  -1.11855323e+00,
-           -1.13786606e+00,  -8.38942398e-01,   8.38942398e-01,
-            1.36155758e-14,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.18553235e-01,  -4.04638309e-01,  -1.57310230e-16,
-            5.56094442e-01,  -2.82847955e-01,  -2.25318218e+00,
-            2.82847955e-01,  -1.11531612e+00,   1.40140119e+00,
-            1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -5.59823902e-01,   7.40805832e-01,   7.96972856e-17,
-            3.93699696e+00,  -9.62843375e-02,   9.51256225e-01,
-            9.62843375e-02,   1.74991003e+00,  -1.93089196e+00,
-           -4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  4.92870367e-01,   7.40805832e-01,  -1.12042977e-17,
-            6.74175116e-01,  -2.01023374e-01,  -2.06177081e-01,
-            2.01023374e-01,  -2.56560608e+00,   1.33192988e+00,
-           -4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -5.59823902e-01,  -4.92870367e-01,   2.24860335e-16,
-            2.46932174e+00,   2.60506708e+00,   1.95093341e+00,
-           -2.60506708e+00,   7.50232851e-01,   3.02461418e-01,
-           -4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -7.40805832e-01,  -4.92870367e-01,  -4.21435619e-17,
-            2.06177081e-01,  -2.01023374e-01,  -6.74175116e-01,
-            2.01023374e-01,  -1.33192988e+00,   2.56560608e+00,
-            4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  4.92870367e-01,   5.59823902e-01,  -1.14379134e-16,
-           -1.95093341e+00,   2.60506708e+00,  -2.46932174e+00,
-           -2.60506708e+00,  -3.02461418e-01,  -7.50232851e-01,
-            4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -7.40805832e-01,   5.59823902e-01,  -2.90481448e-16,
-           -9.51256225e-01,  -9.62843375e-02,  -3.93699696e+00,
-            9.62843375e-02,   1.93089196e+00,  -1.74991003e+00,
-            4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[-0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
-           0.22051427,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
-           0.01592089,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
-           0.22051427,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
-           0.49999593,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
-           0.24857553,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
-           0.49999593,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
-           0.13530783,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
-           0.79016044,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
-           0.06597479,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
-           0.79016044,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
-           0.06597479,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
-           0.13530783,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.05512857,  0.6533077 , -0.05512857,  0.22051427,
-           0.01592089,  0.22051427,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.05512857, -0.05512857,  0.6533077 ,  0.22051427,
-           0.22051427,  0.01592089,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.6533077 , -0.05512857, -0.05512857,  0.01592089,
-           0.22051427,  0.22051427,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12499898,  0.00143058, -0.12499898,  0.49999593,
-           0.24857553,  0.49999593,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12499898, -0.12499898,  0.00143058,  0.49999593,
-           0.49999593,  0.24857553,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.00143058, -0.12499898, -0.12499898,  0.24857553,
-           0.49999593,  0.49999593,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04749626,  0.17376836, -0.11771516,  0.79016044,
-           0.06597479,  0.13530783,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.11771516,  0.17376836, -0.04749626,  0.13530783,
-           0.06597479,  0.79016044,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04749626, -0.11771516,  0.17376836,  0.79016044,
-           0.13530783,  0.06597479,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.17376836, -0.11771516, -0.04749626,  0.06597479,
-           0.13530783,  0.79016044,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.11771516, -0.04749626,  0.17376836,  0.13530783,
-           0.79016044,  0.06597479,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.17376836, -0.04749626, -0.11771516,  0.06597479,
-           0.79016044,  0.13530783,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C0': array([[ 0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
+          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.06308901,  0.87382197,  0.06308901],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.06308901,  0.06308901,  0.87382197],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.87382197,  0.06308901,  0.06308901],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.046308  ,  0.046308  ,  0.44026899, -0.20112546,  0.40225091,
+          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.24928675,  0.50142651,  0.24928675],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.24928675,  0.24928675,  0.50142651],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.50142651,  0.24928675,  0.24928675],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.44026899,  0.046308  ,  0.046308  , -0.01452104, -0.01452104,
+           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.05314505,  0.6365025 ,  0.31035245],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.31035245,  0.6365025 ,  0.05314505],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.05314505,  0.31035245,  0.6365025 ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.03935169, -0.06267372,  0.03935169,  0.28365493, -0.14182746,
+          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.6365025 ,  0.31035245,  0.05314505],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.31035245,  0.05314505,  0.6365025 ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.6365025 ,  0.05314505,  0.31035245]]), 'FE1_C0_D10': array([[  7.47643942e-01,   2.49528788e+00,   0.00000000e+00,
-            2.52356058e-01,  -2.52356058e-01,  -3.24293183e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.47643942e-01,  -7.47643942e-01,   0.00000000e+00,
-            3.49528788e+00,  -3.49528788e+00,   2.05117403e-15,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.        ],
+         [ 0.03935169,  0.03935169, -0.06267372, -0.14182746,  0.28365493,
+          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [-0.06267372,  0.03935169,  0.03935169, -0.07051025, -0.07051025,
+           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.04111073, -0.02619323,  0.01143583,  0.80848895, -0.06128522,
+          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.01143583, -0.02619323,  0.04111073,  0.13844642, -0.12795188,
+          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.04111073,  0.01143583, -0.02619323, -0.06128522,  0.80848895,
+          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [-0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
+           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.01143583,  0.04111073, -0.02619323, -0.12795188,  0.13844642,
+          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [-0.02619323,  0.04111073,  0.01143583, -0.0623881 , -0.00511704,
+           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
+          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.046308  ,  0.046308  ,  0.44026899, -0.20112546,  0.40225091,
+          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.44026899,  0.046308  ,  0.046308  , -0.01452104, -0.01452104,
+           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.03935169, -0.06267372,  0.03935169,  0.28365493, -0.14182746,
+          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.03935169,  0.03935169, -0.06267372, -0.14182746,  0.28365493,
+          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.06267372,  0.03935169,  0.03935169, -0.07051025, -0.07051025,
+           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.04111073, -0.02619323,  0.01143583,  0.80848895, -0.06128522,
+          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.01143583, -0.02619323,  0.04111073,  0.13844642, -0.12795188,
+          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.04111073,  0.01143583, -0.02619323, -0.06128522,  0.80848895,
+          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
+           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.01143583,  0.04111073, -0.02619323, -0.12795188,  0.13844642,
+          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.02619323,  0.04111073,  0.01143583, -0.0623881 , -0.00511704,
+           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
+           0.22051427],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
+           0.01592089],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
+           0.22051427],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
+           0.49999593],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
+           0.24857553],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
+           0.49999593],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
+           0.13530783],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
+           0.79016044],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
+           0.06597479],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
+           0.79016044],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
+           0.06597479],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
+           0.13530783]]), 'FE3_C1': array([[ 0.        ,  0.        ,  0.        ,  0.06308901,  0.87382197,
+           0.06308901],
+         [ 0.        ,  0.        ,  0.        ,  0.06308901,  0.06308901,
+           0.87382197],
+         [ 0.        ,  0.        ,  0.        ,  0.87382197,  0.06308901,
+           0.06308901],
+         [ 0.        ,  0.        ,  0.        ,  0.24928675,  0.50142651,
+           0.24928675],
+         [ 0.        ,  0.        ,  0.        ,  0.24928675,  0.24928675,
+           0.50142651],
+         [ 0.        ,  0.        ,  0.        ,  0.50142651,  0.24928675,
+           0.24928675],
+         [ 0.        ,  0.        ,  0.        ,  0.05314505,  0.6365025 ,
+           0.31035245],
+         [ 0.        ,  0.        ,  0.        ,  0.31035245,  0.6365025 ,
+           0.05314505],
+         [ 0.        ,  0.        ,  0.        ,  0.05314505,  0.31035245,
+           0.6365025 ],
+         [ 0.        ,  0.        ,  0.        ,  0.6365025 ,  0.31035245,
+           0.05314505],
+         [ 0.        ,  0.        ,  0.        ,  0.31035245,  0.05314505,
+           0.6365025 ],
+         [ 0.        ,  0.        ,  0.        ,  0.6365025 ,  0.05314505,
+           0.31035245]]), 'FE1_C0_D10': array([[ -4.85931890e-01,   3.44372756e+00,  -6.19847219e-18,
+            1.20457074e+00,  -2.30167545e-01,   1.76434524e-01,
+            2.30167545e-01,   2.21356002e+00,  -5.17135569e+00,
+           -1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.49528788e+00,  -7.47643942e-01,   0.00000000e+00,
-            2.52356058e-01,  -2.52356058e-01,   3.24293183e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.85301932e-03,   1.00570604e+00,   0.00000000e+00,
-            9.97146981e-01,  -9.97146981e-01,  -1.00855906e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -4.85931890e-01,   4.85931890e-01,   3.35148811e-16,
+           -2.44372756e+00,   6.37592643e+00,   2.44372756e+00,
+           -6.37592643e+00,  -5.37330206e-02,   5.37330206e-02,
+           -9.48836306e-15,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.85301932e-03,  -2.85301932e-03,   0.00000000e+00,
-            2.00570604e+00,  -2.00570604e+00,   3.89861391e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00570604e+00,  -2.85301932e-03,   0.00000000e+00,
-            9.97146981e-01,  -9.97146981e-01,   1.00855906e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -3.44372756e+00,   4.85931890e-01,  -1.00022725e-16,
+           -1.76434524e-01,  -2.30167545e-01,  -1.20457074e+00,
+            2.30167545e-01,   5.17135569e+00,  -2.21356002e+00,
+            1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.87419801e-01,   1.54601000e+00,   0.00000000e+00,
-            1.24140980e+00,  -1.24140980e+00,  -2.33342980e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.41409804e-01,   1.54601000e+00,   0.00000000e+00,
-            2.12580199e-01,  -2.12580199e-01,  -1.30460019e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  4.04638309e-01,  -1.18553235e-01,  -2.96189892e-17,
+            2.25318218e+00,  -2.82847955e-01,  -5.56094442e-01,
+            2.82847955e-01,  -1.40140119e+00,   1.11531612e+00,
+           -1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.87419801e-01,   2.41409804e-01,   0.00000000e+00,
-            2.54601000e+00,  -2.54601000e+00,  -1.02882960e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.54601000e+00,   2.41409804e-01,   0.00000000e+00,
-            2.12580199e-01,  -2.12580199e-01,   1.30460019e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  4.04638309e-01,  -4.04638309e-01,  -3.69822127e-17,
+            1.11855323e+00,   1.13786606e+00,  -1.11855323e+00,
+           -1.13786606e+00,  -8.38942398e-01,   8.38942398e-01,
+            1.30826401e-14,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.41409804e-01,  -7.87419801e-01,   0.00000000e+00,
-            2.54601000e+00,  -2.54601000e+00,   1.02882960e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.54601000e+00,  -7.87419801e-01,   0.00000000e+00,
-            1.24140980e+00,  -1.24140980e+00,   2.33342980e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  1.18553235e-01,  -4.04638309e-01,  -1.57310230e-16,
+            5.56094442e-01,  -2.82847955e-01,  -2.25318218e+00,
+            2.82847955e-01,  -1.11531612e+00,   1.40140119e+00,
+            1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
-  
-  tables: {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -4.85931890e-01,  -4.94049246e-15,
-            4.85931890e-01,   6.37592643e+00,  -2.44372756e+00,
-           -5.37330206e-02,   5.37330206e-02,   2.44372756e+00,
-           -6.37592643e+00,  -9.10382880e-15,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -4.85931890e-01,   7.77156117e-15,
-            3.44372756e+00,  -2.30167545e-01,   1.20457074e+00,
-            2.21356002e+00,  -5.17135569e+00,   1.76434524e-01,
-            2.30167545e-01,  -1.38100527e+00,   0.00000000e+00,
+         [ -5.59823902e-01,   7.40805832e-01,   7.96972856e-17,
+            3.93699696e+00,  -9.62843375e-02,   9.51256225e-01,
+            9.62843375e-02,   1.74991003e+00,  -1.93089196e+00,
+           -4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -3.44372756e+00,  -6.66133815e-16,
-            4.85931890e-01,  -2.30167545e-01,  -1.76434524e-01,
-            5.17135569e+00,  -2.21356002e+00,  -1.20457074e+00,
-            2.30167545e-01,   1.38100527e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.04638309e-01,   1.85615412e-15,
-           -4.04638309e-01,   1.13786606e+00,   1.11855323e+00,
-           -8.38942398e-01,   8.38942398e-01,  -1.11855323e+00,
-           -1.13786606e+00,   6.68909372e-15,   0.00000000e+00,
+         [  4.92870367e-01,   7.40805832e-01,  -1.12042977e-17,
+            6.74175116e-01,  -2.01023374e-01,  -2.06177081e-01,
+            2.01023374e-01,  -2.56560608e+00,   1.33192988e+00,
+           -4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.04638309e-01,   4.49640325e-15,
-           -1.18553235e-01,  -2.82847955e-01,   2.25318218e+00,
-           -1.40140119e+00,   1.11531612e+00,  -5.56094442e-01,
-            2.82847955e-01,  -1.69708773e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.18553235e-01,   3.27168848e-15,
-           -4.04638309e-01,  -2.82847955e-01,   5.56094442e-01,
-           -1.11531612e+00,   1.40140119e+00,  -2.25318218e+00,
-            2.82847955e-01,   1.69708773e+00,   0.00000000e+00,
+         [ -5.59823902e-01,  -4.92870367e-01,   2.24860335e-16,
+            2.46932174e+00,   2.60506708e+00,   1.95093341e+00,
+           -2.60506708e+00,   7.50232851e-01,   3.02461418e-01,
+           -4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -5.59823902e-01,   3.05311332e-16,
-           -4.92870367e-01,   2.60506708e+00,   2.46932174e+00,
-            7.50232851e-01,   3.02461418e-01,   1.95093341e+00,
-           -2.60506708e+00,  -4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.92870367e-01,  -1.27675648e-15,
-            5.59823902e-01,   2.60506708e+00,  -1.95093341e+00,
-           -3.02461418e-01,  -7.50232851e-01,  -2.46932174e+00,
-           -2.60506708e+00,   4.42025515e+00,   0.00000000e+00,
+         [ -7.40805832e-01,  -4.92870367e-01,  -4.21435619e-17,
+            2.06177081e-01,  -2.01023374e-01,  -6.74175116e-01,
+            2.01023374e-01,  -1.33192988e+00,   2.56560608e+00,
+            4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -5.59823902e-01,   3.60475538e-15,
-            7.40805832e-01,  -9.62843375e-02,   3.93699696e+00,
-            1.74991003e+00,  -1.93089196e+00,   9.51256225e-01,
-            9.62843375e-02,  -4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  4.92870367e-01,   5.59823902e-01,  -1.14379134e-16,
+           -1.95093341e+00,   2.60506708e+00,  -2.46932174e+00,
+           -2.60506708e+00,  -3.02461418e-01,  -7.50232851e-01,
+            4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -7.40805832e-01,   2.77555756e-16,
-            5.59823902e-01,  -9.62843375e-02,  -9.51256225e-01,
-            1.93089196e+00,  -1.74991003e+00,  -3.93699696e+00,
-            9.62843375e-02,   4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -7.40805832e-01,   5.59823902e-01,  -2.90481448e-16,
+           -9.51256225e-01,  -9.62843375e-02,  -3.93699696e+00,
+            9.62843375e-02,   1.93089196e+00,  -1.74991003e+00,
+            4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.92870367e-01,   6.44102827e-15,
-            7.40805832e-01,  -2.01023374e-01,   6.74175116e-01,
-           -2.56560608e+00,   1.33192988e+00,  -2.06177081e-01,
-            2.01023374e-01,  -4.67998035e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -7.40805832e-01,   4.17721413e-15,
-           -4.92870367e-01,  -2.01023374e-01,   2.06177081e-01,
-           -1.33192988e+00,   2.56560608e+00,  -6.74175116e-01,
-            2.01023374e-01,   4.67998035e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE3_C0': array([[ 0.06308901,  0.87382197,  0.06308901,  0.        ,  0.        ,
+           0.        ],
+         [ 0.06308901,  0.06308901,  0.87382197,  0.        ,  0.        ,
+           0.        ],
+         [ 0.87382197,  0.06308901,  0.06308901,  0.        ,  0.        ,
+           0.        ],
+         [ 0.24928675,  0.50142651,  0.24928675,  0.        ,  0.        ,
+           0.        ],
+         [ 0.24928675,  0.24928675,  0.50142651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.50142651,  0.24928675,  0.24928675,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05314505,  0.6365025 ,  0.31035245,  0.        ,  0.        ,
+           0.        ],
+         [ 0.31035245,  0.6365025 ,  0.05314505,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05314505,  0.31035245,  0.6365025 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.6365025 ,  0.31035245,  0.05314505,  0.        ,  0.        ,
+           0.        ],
+         [ 0.31035245,  0.05314505,  0.6365025 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.6365025 ,  0.05314505,  0.31035245,  0.        ,  0.        ,
+           0.        ]])}
+  
+  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            7.47643942e-01,   7.66053887e-15,  -7.47643942e-01,
+            3.49528788e+00,   1.15463195e-14,  -3.49528788e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.47643942e-01,   7.10542736e-15,   2.49528788e+00,
+            2.52356058e-01,  -3.24293183e+00,  -2.52356058e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.49528788e+00,   5.05151476e-15,  -7.47643942e-01,
+            2.52356058e-01,   3.24293183e+00,  -2.52356058e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.85301932e-03,   7.74380560e-15,  -2.85301932e-03,
+            2.00570604e+00,   1.40998324e-14,  -2.00570604e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.85301932e-03,   7.60502772e-15,   1.00570604e+00,
+            9.97146981e-01,  -1.00855906e+00,  -9.97146981e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00570604e+00,   6.68909372e-15,  -2.85301932e-03,
+            9.97146981e-01,   1.00855906e+00,  -9.97146981e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.87419801e-01,   8.50708393e-15,   2.41409804e-01,
+            2.54601000e+00,  -1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.41409804e-01,   7.16093851e-15,  -7.87419801e-01,
+            2.54601000e+00,   1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.87419801e-01,   8.21565038e-15,   1.54601000e+00,
+            1.24140980e+00,  -2.33342980e+00,  -1.24140980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.54601000e+00,   5.88418203e-15,  -7.87419801e-01,
+            1.24140980e+00,   2.33342980e+00,  -1.24140980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.41409804e-01,   7.04991621e-15,   1.54601000e+00,
+            2.12580199e-01,  -1.30460019e+00,  -2.12580199e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C2_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.54601000e+00,   6.32827124e-15,   2.41409804e-01,
+            2.12580199e-01,   1.30460019e+00,  -2.12580199e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
-            2.49528788e+00,   0.00000000e+00,   2.52356058e-01,
-           -2.52356058e-01,  -3.24293183e+00],
+            7.66053887e-15,  -7.47643942e-01,   3.49528788e+00,
+            1.15463195e-14,  -3.49528788e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4399,8 +4386,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
-           -7.47643942e-01,   0.00000000e+00,   3.49528788e+00,
-           -3.49528788e+00,   2.05117403e-15],
+            7.10542736e-15,   2.49528788e+00,   2.52356058e-01,
+           -3.24293183e+00,  -2.52356058e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4408,8 +4395,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -2.49528788e+00,
-           -7.47643942e-01,   0.00000000e+00,   2.52356058e-01,
-           -2.52356058e-01,   3.24293183e+00],
+            5.05151476e-15,  -7.47643942e-01,   2.52356058e-01,
+            3.24293183e+00,  -2.52356058e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4417,8 +4404,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
-            1.00570604e+00,   0.00000000e+00,   9.97146981e-01,
-           -9.97146981e-01,  -1.00855906e+00],
+            7.74380560e-15,  -2.85301932e-03,   2.00570604e+00,
+            1.40998324e-14,  -2.00570604e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4426,8 +4413,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
-           -2.85301932e-03,   0.00000000e+00,   2.00570604e+00,
-           -2.00570604e+00,   3.89861391e-15],
+            7.60502772e-15,   1.00570604e+00,   9.97146981e-01,
+           -1.00855906e+00,  -9.97146981e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4435,8 +4422,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00570604e+00,
-           -2.85301932e-03,   0.00000000e+00,   9.97146981e-01,
-           -9.97146981e-01,   1.00855906e+00],
+            6.68909372e-15,  -2.85301932e-03,   9.97146981e-01,
+            1.00855906e+00,  -9.97146981e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4444,8 +4431,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
-            1.54601000e+00,   0.00000000e+00,   1.24140980e+00,
-           -1.24140980e+00,  -2.33342980e+00],
+            8.50708393e-15,   2.41409804e-01,   2.54601000e+00,
+           -1.02882960e+00,  -2.54601000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4453,8 +4440,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
-            1.54601000e+00,   0.00000000e+00,   2.12580199e-01,
-           -2.12580199e-01,  -1.30460019e+00],
+            7.16093851e-15,  -7.87419801e-01,   2.54601000e+00,
+            1.02882960e+00,  -2.54601000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4462,8 +4449,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
-            2.41409804e-01,   0.00000000e+00,   2.54601000e+00,
-           -2.54601000e+00,  -1.02882960e+00],
+            8.21565038e-15,   1.54601000e+00,   1.24140980e+00,
+           -2.33342980e+00,  -1.24140980e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4471,8 +4458,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
-            2.41409804e-01,   0.00000000e+00,   2.12580199e-01,
-           -2.12580199e-01,   1.30460019e+00],
+            5.88418203e-15,  -7.87419801e-01,   1.24140980e+00,
+            2.33342980e+00,  -1.24140980e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4480,8 +4467,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
-           -7.87419801e-01,   0.00000000e+00,   2.54601000e+00,
-           -2.54601000e+00,   1.02882960e+00],
+            7.04991621e-15,   1.54601000e+00,   2.12580199e-01,
+           -1.30460019e+00,  -2.12580199e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -4489,433 +4476,292 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
-           -7.87419801e-01,   0.00000000e+00,   1.24140980e+00,
-           -1.24140980e+00,   2.33342980e+00]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.32827124e-15,   2.41409804e-01,   2.12580199e-01,
+            1.30460019e+00,  -2.12580199e-01]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.47643942e-01,   2.49528788e+00,   0.00000000e+00,
-            2.52356058e-01,  -2.52356058e-01,  -3.24293183e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.47643942e-01,  -7.47643942e-01,   0.00000000e+00,
-            3.49528788e+00,  -3.49528788e+00,   2.05117403e-15,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -4.85931890e-01,   3.44372756e+00,
+           -6.19847219e-18,   1.20457074e+00,  -2.30167545e-01,
+            1.76434524e-01,   2.30167545e-01,   2.21356002e+00,
+           -5.17135569e+00,  -1.38100527e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.49528788e+00,  -7.47643942e-01,   0.00000000e+00,
-            2.52356058e-01,  -2.52356058e-01,   3.24293183e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.85301932e-03,   1.00570604e+00,   0.00000000e+00,
-            9.97146981e-01,  -9.97146981e-01,  -1.00855906e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.85301932e-03,  -2.85301932e-03,   0.00000000e+00,
-            2.00570604e+00,  -2.00570604e+00,   3.89861391e-15,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -4.85931890e-01,   4.85931890e-01,
+            3.35148811e-16,  -2.44372756e+00,   6.37592643e+00,
+            2.44372756e+00,  -6.37592643e+00,  -5.37330206e-02,
+            5.37330206e-02,  -9.48836306e-15,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00570604e+00,  -2.85301932e-03,   0.00000000e+00,
-            9.97146981e-01,  -9.97146981e-01,   1.00855906e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.87419801e-01,   1.54601000e+00,   0.00000000e+00,
-            1.24140980e+00,  -1.24140980e+00,  -2.33342980e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.41409804e-01,   1.54601000e+00,   0.00000000e+00,
-            2.12580199e-01,  -2.12580199e-01,  -1.30460019e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -3.44372756e+00,   4.85931890e-01,
+           -1.00022725e-16,  -1.76434524e-01,  -2.30167545e-01,
+           -1.20457074e+00,   2.30167545e-01,   5.17135569e+00,
+           -2.21356002e+00,   1.38100527e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.87419801e-01,   2.41409804e-01,   0.00000000e+00,
-            2.54601000e+00,  -2.54601000e+00,  -1.02882960e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.54601000e+00,   2.41409804e-01,   0.00000000e+00,
-            2.12580199e-01,  -2.12580199e-01,   1.30460019e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.04638309e-01,  -1.18553235e-01,
+           -2.96189892e-17,   2.25318218e+00,  -2.82847955e-01,
+           -5.56094442e-01,   2.82847955e-01,  -1.40140119e+00,
+            1.11531612e+00,  -1.69708773e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.41409804e-01,  -7.87419801e-01,   0.00000000e+00,
-            2.54601000e+00,  -2.54601000e+00,   1.02882960e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.04638309e-01,  -4.04638309e-01,
+           -3.69822127e-17,   1.11855323e+00,   1.13786606e+00,
+           -1.11855323e+00,  -1.13786606e+00,  -8.38942398e-01,
+            8.38942398e-01,   1.30826401e-14,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.54601000e+00,  -7.87419801e-01,   0.00000000e+00,
-            1.24140980e+00,  -1.24140980e+00,   2.33342980e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE2_C0_D01': array([[ -4.85931890e-01,  -4.94049246e-15,   4.85931890e-01,
-            6.37592643e+00,  -2.44372756e+00,  -5.37330206e-02,
-            5.37330206e-02,   2.44372756e+00,  -6.37592643e+00,
-           -9.10382880e-15,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.18553235e-01,  -4.04638309e-01,
+           -1.57310230e-16,   5.56094442e-01,  -2.82847955e-01,
+           -2.25318218e+00,   2.82847955e-01,  -1.11531612e+00,
+            1.40140119e+00,   1.69708773e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -5.59823902e-01,   7.40805832e-01,
+            7.96972856e-17,   3.93699696e+00,  -9.62843375e-02,
+            9.51256225e-01,   9.62843375e-02,   1.74991003e+00,
+           -1.93089196e+00,  -4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -4.85931890e-01,   7.77156117e-15,   3.44372756e+00,
-           -2.30167545e-01,   1.20457074e+00,   2.21356002e+00,
-           -5.17135569e+00,   1.76434524e-01,   2.30167545e-01,
-           -1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.92870367e-01,   7.40805832e-01,
+           -1.12042977e-17,   6.74175116e-01,  -2.01023374e-01,
+           -2.06177081e-01,   2.01023374e-01,  -2.56560608e+00,
+            1.33192988e+00,  -4.67998035e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -5.59823902e-01,  -4.92870367e-01,
+            2.24860335e-16,   2.46932174e+00,   2.60506708e+00,
+            1.95093341e+00,  -2.60506708e+00,   7.50232851e-01,
+            3.02461418e-01,  -4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -3.44372756e+00,  -6.66133815e-16,   4.85931890e-01,
-           -2.30167545e-01,  -1.76434524e-01,   5.17135569e+00,
-           -2.21356002e+00,  -1.20457074e+00,   2.30167545e-01,
-            1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -7.40805832e-01,  -4.92870367e-01,
+           -4.21435619e-17,   2.06177081e-01,  -2.01023374e-01,
+           -6.74175116e-01,   2.01023374e-01,  -1.33192988e+00,
+            2.56560608e+00,   4.67998035e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.92870367e-01,   5.59823902e-01,
+           -1.14379134e-16,  -1.95093341e+00,   2.60506708e+00,
+           -2.46932174e+00,  -2.60506708e+00,  -3.02461418e-01,
+           -7.50232851e-01,   4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  4.04638309e-01,   1.85615412e-15,  -4.04638309e-01,
-            1.13786606e+00,   1.11855323e+00,  -8.38942398e-01,
-            8.38942398e-01,  -1.11855323e+00,  -1.13786606e+00,
-            6.68909372e-15,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -7.40805832e-01,   5.59823902e-01,
+           -2.90481448e-16,  -9.51256225e-01,  -9.62843375e-02,
+           -3.93699696e+00,   9.62843375e-02,   1.93089196e+00,
+           -1.74991003e+00,   4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  4.04638309e-01,   4.49640325e-15,  -1.18553235e-01,
-           -2.82847955e-01,   2.25318218e+00,  -1.40140119e+00,
-            1.11531612e+00,  -5.56094442e-01,   2.82847955e-01,
-           -1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.18553235e-01,   3.27168848e-15,  -4.04638309e-01,
-           -2.82847955e-01,   5.56094442e-01,  -1.11531612e+00,
-            1.40140119e+00,  -2.25318218e+00,   2.82847955e-01,
-            1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
+            2.49528788e+00,   0.00000000e+00,   2.52356058e-01,
+           -2.52356058e-01,  -3.24293183e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -5.59823902e-01,   3.05311332e-16,  -4.92870367e-01,
-            2.60506708e+00,   2.46932174e+00,   7.50232851e-01,
-            3.02461418e-01,   1.95093341e+00,  -2.60506708e+00,
-           -4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
+           -7.47643942e-01,   0.00000000e+00,   3.49528788e+00,
+           -3.49528788e+00,   2.61756373e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  4.92870367e-01,  -1.27675648e-15,   5.59823902e-01,
-            2.60506708e+00,  -1.95093341e+00,  -3.02461418e-01,
-           -7.50232851e-01,  -2.46932174e+00,  -2.60506708e+00,
-            4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -2.49528788e+00,
+           -7.47643942e-01,   0.00000000e+00,   2.52356058e-01,
+           -2.52356058e-01,   3.24293183e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -5.59823902e-01,   3.60475538e-15,   7.40805832e-01,
-           -9.62843375e-02,   3.93699696e+00,   1.74991003e+00,
-           -1.93089196e+00,   9.51256225e-01,   9.62843375e-02,
-           -4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
+            1.00570604e+00,   0.00000000e+00,   9.97146981e-01,
+           -9.97146981e-01,  -1.00855906e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -7.40805832e-01,   2.77555756e-16,   5.59823902e-01,
-           -9.62843375e-02,  -9.51256225e-01,   1.93089196e+00,
-           -1.74991003e+00,  -3.93699696e+00,   9.62843375e-02,
-            4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  4.92870367e-01,   6.44102827e-15,   7.40805832e-01,
-           -2.01023374e-01,   6.74175116e-01,  -2.56560608e+00,
-            1.33192988e+00,  -2.06177081e-01,   2.01023374e-01,
-           -4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
+           -2.85301932e-03,   0.00000000e+00,   2.00570604e+00,
+           -2.00570604e+00,   3.63572562e-15],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -7.40805832e-01,   4.17721413e-15,  -4.92870367e-01,
-           -2.01023374e-01,   2.06177081e-01,  -1.33192988e+00,
-            2.56560608e+00,  -6.74175116e-01,   2.01023374e-01,
-            4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00570604e+00,
+           -2.85301932e-03,   0.00000000e+00,   9.97146981e-01,
+           -9.97146981e-01,   1.00855906e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
+            1.54601000e+00,   0.00000000e+00,   1.24140980e+00,
+           -1.24140980e+00,  -2.33342980e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
+            1.54601000e+00,   0.00000000e+00,   2.12580199e-01,
+           -2.12580199e-01,  -1.30460019e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
+            2.41409804e-01,   0.00000000e+00,   2.54601000e+00,
+           -2.54601000e+00,  -1.02882960e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
+            2.41409804e-01,   0.00000000e+00,   2.12580199e-01,
+           -2.12580199e-01,   1.30460019e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
+           -7.87419801e-01,   0.00000000e+00,   2.54601000e+00,
+           -2.54601000e+00,   1.02882960e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
+           -7.87419801e-01,   0.00000000e+00,   1.24140980e+00,
+           -1.24140980e+00,   2.33342980e+00]]), 'FE0_C0_D01': array([[  7.47643942e-01,   7.66053887e-15,  -7.47643942e-01,
+            3.49528788e+00,   1.15463195e-14,  -3.49528788e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  7.47643942e-01,   7.10542736e-15,   2.49528788e+00,
+            2.52356058e-01,  -3.24293183e+00,  -2.52356058e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [ -2.49528788e+00,   5.05151476e-15,  -7.47643942e-01,
+            2.52356058e-01,   3.24293183e+00,  -2.52356058e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  2.85301932e-03,   7.74380560e-15,  -2.85301932e-03,
+            2.00570604e+00,   1.40998324e-14,  -2.00570604e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  2.85301932e-03,   7.60502772e-15,   1.00570604e+00,
+            9.97146981e-01,  -1.00855906e+00,  -9.97146981e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [ -1.00570604e+00,   6.68909372e-15,  -2.85301932e-03,
+            9.97146981e-01,   1.00855906e+00,  -9.97146981e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  7.87419801e-01,   8.50708393e-15,   2.41409804e-01,
+            2.54601000e+00,  -1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [ -2.41409804e-01,   7.16093851e-15,  -7.87419801e-01,
+            2.54601000e+00,   1.02882960e+00,  -2.54601000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  7.87419801e-01,   8.21565038e-15,   1.54601000e+00,
+            1.24140980e+00,  -2.33342980e+00,  -1.24140980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [ -1.54601000e+00,   5.88418203e-15,  -7.87419801e-01,
+            1.24140980e+00,   2.33342980e+00,  -1.24140980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [ -2.41409804e-01,   7.04991621e-15,   1.54601000e+00,
+            2.12580199e-01,  -1.30460019e+00,  -2.12580199e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
-          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.046308  ,  0.046308  ,  0.44026899, -0.20112546,  0.40225091,
-          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.44026899,  0.046308  ,  0.046308  , -0.01452104, -0.01452104,
-           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.03935169, -0.06267372,  0.03935169,  0.28365493, -0.14182746,
-          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.03935169,  0.03935169, -0.06267372, -0.14182746,  0.28365493,
-          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.06267372,  0.03935169,  0.03935169, -0.07051025, -0.07051025,
-           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.04111073, -0.02619323,  0.01143583,  0.80848895, -0.06128522,
-          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.01143583, -0.02619323,  0.04111073,  0.13844642, -0.12795188,
-          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.04111073,  0.01143583, -0.02619323, -0.06128522,  0.80848895,
-          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
-           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.01143583,  0.04111073, -0.02619323, -0.12795188,  0.13844642,
-          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.02619323,  0.04111073,  0.01143583, -0.0623881 , -0.00511704,
-           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE2_C0': array([[ 0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
-          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.046308  ,  0.046308  ,  0.44026899, -0.20112546,  0.40225091,
-          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44026899,  0.046308  ,  0.046308  , -0.01452104, -0.01452104,
-           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.03935169, -0.06267372,  0.03935169,  0.28365493, -0.14182746,
-          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.03935169,  0.03935169, -0.06267372, -0.14182746,  0.28365493,
-          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [-0.06267372,  0.03935169,  0.03935169, -0.07051025, -0.07051025,
-           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04111073, -0.02619323,  0.01143583,  0.80848895, -0.06128522,
-          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.01143583, -0.02619323,  0.04111073,  0.13844642, -0.12795188,
-          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04111073,  0.01143583, -0.02619323, -0.06128522,  0.80848895,
-          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [-0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
-           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.01143583,  0.04111073, -0.02619323, -0.12795188,  0.13844642,
-          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [-0.02619323,  0.04111073,  0.01143583, -0.0623881 , -0.00511704,
-           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
-           0.22051427],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
-           0.01592089],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
-           0.22051427],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
-           0.49999593],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
-           0.24857553],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
-           0.49999593],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
-           0.13530783],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
-           0.79016044],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
-           0.06597479],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
-           0.79016044],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-          -0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
-           0.06597479],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
-           0.13530783]]), 'FE3': array([[ 1.],
+         [ -1.54601000e+00,   6.32827124e-15,   2.41409804e-01,
+            2.12580199e-01,   1.30460019e+00,  -2.12580199e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -4926,684 +4772,473 @@ Compiler stage 2: Computing intermediate representation
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE1_C0_D01': array([[  7.47643942e-01,   8.43769499e-15,  -7.47643942e-01,
-            3.49528788e+00,   1.24344979e-14,  -3.49528788e+00,
+         [ 1.]]), 'FE0_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.47643942e-01,   8.43769499e-15,   2.49528788e+00,
-            2.52356058e-01,  -3.24293183e+00,  -2.52356058e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.49528788e+00,   5.38458167e-15,  -7.47643942e-01,
-            2.52356058e-01,   3.24293183e+00,  -2.52356058e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.85301932e-03,   7.63278329e-15,  -2.85301932e-03,
-            2.00570604e+00,   1.40998324e-14,  -2.00570604e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.85301932e-03,   7.63278329e-15,   1.00570604e+00,
-            9.97146981e-01,  -1.00855906e+00,  -9.97146981e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00570604e+00,   6.63358257e-15,  -2.85301932e-03,
-            9.97146981e-01,   1.00855906e+00,  -9.97146981e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.87419801e-01,   8.50708393e-15,   2.41409804e-01,
-            2.54601000e+00,  -1.02882960e+00,  -2.54601000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.41409804e-01,   7.66053887e-15,  -7.87419801e-01,
-            2.54601000e+00,   1.02882960e+00,  -2.54601000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.87419801e-01,   8.38218384e-15,   1.54601000e+00,
-            1.24140980e+00,  -2.33342980e+00,  -1.24140980e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.54601000e+00,   6.05071548e-15,  -7.87419801e-01,
-            1.24140980e+00,   2.33342980e+00,  -1.24140980e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.41409804e-01,   7.49400542e-15,   1.54601000e+00,
-            2.12580199e-01,  -1.30460019e+00,  -2.12580199e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.54601000e+00,   6.38378239e-15,   2.41409804e-01,
-            2.12580199e-01,   1.30460019e+00,  -2.12580199e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.06308901,  0.87382197,
-           0.06308901],
-         [ 0.        ,  0.        ,  0.        ,  0.06308901,  0.06308901,
-           0.87382197],
-         [ 0.        ,  0.        ,  0.        ,  0.87382197,  0.06308901,
-           0.06308901],
-         [ 0.        ,  0.        ,  0.        ,  0.24928675,  0.50142651,
-           0.24928675],
-         [ 0.        ,  0.        ,  0.        ,  0.24928675,  0.24928675,
-           0.50142651],
-         [ 0.        ,  0.        ,  0.        ,  0.50142651,  0.24928675,
-           0.24928675],
-         [ 0.        ,  0.        ,  0.        ,  0.05314505,  0.6365025 ,
-           0.31035245],
-         [ 0.        ,  0.        ,  0.        ,  0.31035245,  0.6365025 ,
-           0.05314505],
-         [ 0.        ,  0.        ,  0.        ,  0.05314505,  0.31035245,
-           0.6365025 ],
-         [ 0.        ,  0.        ,  0.        ,  0.6365025 ,  0.31035245,
-           0.05314505],
-         [ 0.        ,  0.        ,  0.        ,  0.31035245,  0.05314505,
-           0.6365025 ],
-         [ 0.        ,  0.        ,  0.        ,  0.6365025 ,  0.05314505,
-           0.31035245]]), 'FE0_C0': array([[ 0.06308901,  0.87382197,  0.06308901,  0.        ,  0.        ,
-           0.        ],
-         [ 0.06308901,  0.06308901,  0.87382197,  0.        ,  0.        ,
-           0.        ],
-         [ 0.87382197,  0.06308901,  0.06308901,  0.        ,  0.        ,
-           0.        ],
-         [ 0.24928675,  0.50142651,  0.24928675,  0.        ,  0.        ,
-           0.        ],
-         [ 0.24928675,  0.24928675,  0.50142651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.50142651,  0.24928675,  0.24928675,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05314505,  0.6365025 ,  0.31035245,  0.        ,  0.        ,
-           0.        ],
-         [ 0.31035245,  0.6365025 ,  0.05314505,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05314505,  0.31035245,  0.6365025 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.6365025 ,  0.31035245,  0.05314505,  0.        ,  0.        ,
-           0.        ],
-         [ 0.31035245,  0.05314505,  0.6365025 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.6365025 ,  0.05314505,  0.31035245,  0.        ,  0.        ,
-           0.        ]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -4.85931890e-01,   3.44372756e+00,
-           -6.19847219e-18,   1.20457074e+00,  -2.30167545e-01,
-            1.76434524e-01,   2.30167545e-01,   2.21356002e+00,
-           -5.17135569e+00,  -1.38100527e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -4.85931890e-01,   4.85931890e-01,
-            3.35148811e-16,  -2.44372756e+00,   6.37592643e+00,
-            2.44372756e+00,  -6.37592643e+00,  -5.37330206e-02,
-            5.37330206e-02,  -1.32779142e-14,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -3.44372756e+00,   4.85931890e-01,
-           -1.00022725e-16,  -1.76434524e-01,  -2.30167545e-01,
-           -1.20457074e+00,   2.30167545e-01,   5.17135569e+00,
-           -2.21356002e+00,   1.38100527e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.04638309e-01,  -1.18553235e-01,
-           -2.96189892e-17,   2.25318218e+00,  -2.82847955e-01,
-           -5.56094442e-01,   2.82847955e-01,  -1.40140119e+00,
-            1.11531612e+00,  -1.69708773e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.04638309e-01,  -4.04638309e-01,
-           -3.69822127e-17,   1.11855323e+00,   1.13786606e+00,
-           -1.11855323e+00,  -1.13786606e+00,  -8.38942398e-01,
-            8.38942398e-01,   1.36155758e-14,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   1.18553235e-01,  -4.04638309e-01,
-           -1.57310230e-16,   5.56094442e-01,  -2.82847955e-01,
-           -2.25318218e+00,   2.82847955e-01,  -1.11531612e+00,
-            1.40140119e+00,   1.69708773e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -4.85931890e-01,  -4.27435864e-15,   4.85931890e-01,
+            6.37592643e+00,  -2.44372756e+00,  -5.37330206e-02,
+            5.37330206e-02,   2.44372756e+00,  -6.37592643e+00,
+           -1.06581410e-14,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -5.59823902e-01,   7.40805832e-01,
-            7.96972856e-17,   3.93699696e+00,  -9.62843375e-02,
-            9.51256225e-01,   9.62843375e-02,   1.74991003e+00,
-           -1.93089196e+00,  -4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.92870367e-01,   7.40805832e-01,
-           -1.12042977e-17,   6.74175116e-01,  -2.01023374e-01,
-           -2.06177081e-01,   2.01023374e-01,  -2.56560608e+00,
-            1.33192988e+00,  -4.67998035e-01,   0.00000000e+00,
+         [ -4.85931890e-01,   6.10622664e-15,   3.44372756e+00,
+           -2.30167545e-01,   1.20457074e+00,   2.21356002e+00,
+           -5.17135569e+00,   1.76434524e-01,   2.30167545e-01,
+           -1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -5.59823902e-01,  -4.92870367e-01,
-            2.24860335e-16,   2.46932174e+00,   2.60506708e+00,
-            1.95093341e+00,  -2.60506708e+00,   7.50232851e-01,
-            3.02461418e-01,  -4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -7.40805832e-01,  -4.92870367e-01,
-           -4.21435619e-17,   2.06177081e-01,  -2.01023374e-01,
-           -6.74175116e-01,   2.01023374e-01,  -1.33192988e+00,
-            2.56560608e+00,   4.67998035e-01,   0.00000000e+00,
+         [ -3.44372756e+00,   1.66533454e-16,   4.85931890e-01,
+           -2.30167545e-01,  -1.76434524e-01,   5.17135569e+00,
+           -2.21356002e+00,  -1.20457074e+00,   2.30167545e-01,
+            1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.92870367e-01,   5.59823902e-01,
-           -1.14379134e-16,  -1.95093341e+00,   2.60506708e+00,
-           -2.46932174e+00,  -2.60506708e+00,  -3.02461418e-01,
-           -7.50232851e-01,   4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -7.40805832e-01,   5.59823902e-01,
-           -2.90481448e-16,  -9.51256225e-01,  -9.62843375e-02,
-           -3.93699696e+00,   9.62843375e-02,   1.93089196e+00,
-           -1.74991003e+00,   4.88825318e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.47643942e-01,   8.43769499e-15,  -7.47643942e-01,
-            3.49528788e+00,   1.24344979e-14,  -3.49528788e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.47643942e-01,   8.43769499e-15,   2.49528788e+00,
-            2.52356058e-01,  -3.24293183e+00,  -2.52356058e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.49528788e+00,   5.38458167e-15,  -7.47643942e-01,
-            2.52356058e-01,   3.24293183e+00,  -2.52356058e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.85301932e-03,   7.63278329e-15,  -2.85301932e-03,
-            2.00570604e+00,   1.40998324e-14,  -2.00570604e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.85301932e-03,   7.63278329e-15,   1.00570604e+00,
-            9.97146981e-01,  -1.00855906e+00,  -9.97146981e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00570604e+00,   6.63358257e-15,  -2.85301932e-03,
-            9.97146981e-01,   1.00855906e+00,  -9.97146981e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.87419801e-01,   8.50708393e-15,   2.41409804e-01,
-            2.54601000e+00,  -1.02882960e+00,  -2.54601000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.41409804e-01,   7.66053887e-15,  -7.87419801e-01,
-            2.54601000e+00,   1.02882960e+00,  -2.54601000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.87419801e-01,   8.38218384e-15,   1.54601000e+00,
-            1.24140980e+00,  -2.33342980e+00,  -1.24140980e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.54601000e+00,   6.05071548e-15,  -7.87419801e-01,
-            1.24140980e+00,   2.33342980e+00,  -1.24140980e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.41409804e-01,   7.49400542e-15,   1.54601000e+00,
-            2.12580199e-01,  -1.30460019e+00,  -2.12580199e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.54601000e+00,   6.38378239e-15,   2.41409804e-01,
-            2.12580199e-01,   1.30460019e+00,  -2.12580199e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
-            8.43769499e-15,  -7.47643942e-01,   3.49528788e+00,
-            1.24344979e-14,  -3.49528788e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   7.47643942e-01,
-            8.43769499e-15,   2.49528788e+00,   2.52356058e-01,
-           -3.24293183e+00,  -2.52356058e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  4.04638309e-01,   1.59594560e-15,  -4.04638309e-01,
+            1.13786606e+00,   1.11855323e+00,  -8.38942398e-01,
+            8.38942398e-01,  -1.11855323e+00,  -1.13786606e+00,
+            6.84174939e-15,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  4.04638309e-01,   4.44089210e-15,  -1.18553235e-01,
+           -2.82847955e-01,   2.25318218e+00,  -1.40140119e+00,
+            1.11531612e+00,  -5.56094442e-01,   2.82847955e-01,
+           -1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -2.49528788e+00,
-            5.38458167e-15,  -7.47643942e-01,   2.52356058e-01,
-            3.24293183e+00,  -2.52356058e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  1.18553235e-01,   3.17107451e-15,  -4.04638309e-01,
+           -2.82847955e-01,   5.56094442e-01,  -1.11531612e+00,
+            1.40140119e+00,  -2.25318218e+00,   2.82847955e-01,
+            1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
-            7.63278329e-15,  -2.85301932e-03,   2.00570604e+00,
-            1.40998324e-14,  -2.00570604e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -5.59823902e-01,  -9.71445147e-17,  -4.92870367e-01,
+            2.60506708e+00,   2.46932174e+00,   7.50232851e-01,
+            3.02461418e-01,   1.95093341e+00,  -2.60506708e+00,
+           -4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   2.85301932e-03,
-            7.63278329e-15,   1.00570604e+00,   9.97146981e-01,
-           -1.00855906e+00,  -9.97146981e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  4.92870367e-01,  -1.05471187e-15,   5.59823902e-01,
+            2.60506708e+00,  -1.95093341e+00,  -3.02461418e-01,
+           -7.50232851e-01,  -2.46932174e+00,  -2.60506708e+00,
+            4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00570604e+00,
-            6.63358257e-15,  -2.85301932e-03,   9.97146981e-01,
-            1.00855906e+00,  -9.97146981e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -5.59823902e-01,   3.34801631e-15,   7.40805832e-01,
+           -9.62843375e-02,   3.93699696e+00,   1.74991003e+00,
+           -1.93089196e+00,   9.51256225e-01,   9.62843375e-02,
+           -4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -7.40805832e-01,   7.21644966e-16,   5.59823902e-01,
+           -9.62843375e-02,  -9.51256225e-01,   1.93089196e+00,
+           -1.74991003e+00,  -3.93699696e+00,   9.62843375e-02,
+            4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
-            8.50708393e-15,   2.41409804e-01,   2.54601000e+00,
-           -1.02882960e+00,  -2.54601000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  4.92870367e-01,   6.21031004e-15,   7.40805832e-01,
+           -2.01023374e-01,   6.74175116e-01,  -2.56560608e+00,
+            1.33192988e+00,  -2.06177081e-01,   2.01023374e-01,
+           -4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
-            7.66053887e-15,  -7.87419801e-01,   2.54601000e+00,
-            1.02882960e+00,  -2.54601000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -7.40805832e-01,   4.01068068e-15,  -4.92870367e-01,
+           -2.01023374e-01,   2.06177081e-01,  -1.33192988e+00,
+            2.56560608e+00,  -6.74175116e-01,   2.01023374e-01,
+            4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   7.87419801e-01,
-            8.38218384e-15,   1.54601000e+00,   1.24140980e+00,
-           -2.33342980e+00,  -1.24140980e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
-            6.05071548e-15,  -7.87419801e-01,   1.24140980e+00,
-            2.33342980e+00,  -1.24140980e+00],
+            0.00000000e+00,   0.00000000e+00]]), 'FE0_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.06308901,  0.87382197,  0.06308901],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.06308901,  0.06308901,  0.87382197],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.87382197,  0.06308901,  0.06308901],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.24928675,  0.50142651,  0.24928675],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.24928675,  0.24928675,  0.50142651],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.50142651,  0.24928675,  0.24928675],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.05314505,  0.6365025 ,  0.31035245],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.31035245,  0.6365025 ,  0.05314505],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.05314505,  0.31035245,  0.6365025 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.6365025 ,  0.31035245,  0.05314505],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.31035245,  0.05314505,  0.6365025 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.6365025 ,  0.05314505,  0.31035245]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.05512857,  0.6533077 , -0.05512857,  0.22051427,
+           0.01592089,  0.22051427,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.05512857, -0.05512857,  0.6533077 ,  0.22051427,
+           0.22051427,  0.01592089,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.6533077 , -0.05512857, -0.05512857,  0.01592089,
+           0.22051427,  0.22051427,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12499898,  0.00143058, -0.12499898,  0.49999593,
+           0.24857553,  0.49999593,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12499898, -0.12499898,  0.00143058,  0.49999593,
+           0.49999593,  0.24857553,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.00143058, -0.12499898, -0.12499898,  0.24857553,
+           0.49999593,  0.49999593,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04749626,  0.17376836, -0.11771516,  0.79016044,
+           0.06597479,  0.13530783,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.11771516,  0.17376836, -0.04749626,  0.13530783,
+           0.06597479,  0.79016044,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04749626, -0.11771516,  0.17376836,  0.79016044,
+           0.13530783,  0.06597479,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.17376836, -0.11771516, -0.04749626,  0.06597479,
+           0.13530783,  0.79016044,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.11771516, -0.04749626,  0.17376836,  0.13530783,
+           0.79016044,  0.06597479,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.17376836, -0.04749626, -0.11771516,  0.06597479,
+           0.79016044,  0.13530783,  0.        ,  0.        ,  0.        ]]), 'FE0_C0': array([[-0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
+           0.22051427,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
+           0.01592089,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
+           0.22051427,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
+           0.49999593,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
+           0.24857553,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
+           0.49999593,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
+           0.13530783,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
+           0.79016044,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
+           0.06597479,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
+           0.79016044,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
+           0.06597479,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
+           0.13530783,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE3_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -2.41409804e-01,
-            7.49400542e-15,   1.54601000e+00,   2.12580199e-01,
-           -1.30460019e+00,  -2.12580199e-01],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.54601000e+00,
-            6.38378239e-15,   2.41409804e-01,   2.12580199e-01,
-            1.30460019e+00,  -2.12580199e-01]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -4.85931890e-01,  -4.27435864e-15,
+            4.85931890e-01,   6.37592643e+00,  -2.44372756e+00,
+           -5.37330206e-02,   5.37330206e-02,   2.44372756e+00,
+           -6.37592643e+00,  -1.06581410e-14,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -4.85931890e-01,   6.10622664e-15,
+            3.44372756e+00,  -2.30167545e-01,   1.20457074e+00,
+            2.21356002e+00,  -5.17135569e+00,   1.76434524e-01,
+            2.30167545e-01,  -1.38100527e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -3.44372756e+00,   1.66533454e-16,
+            4.85931890e-01,  -2.30167545e-01,  -1.76434524e-01,
+            5.17135569e+00,  -2.21356002e+00,  -1.20457074e+00,
+            2.30167545e-01,   1.38100527e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0_D10': array([[ -4.85931890e-01,   3.44372756e+00,  -6.19847219e-18,
-            1.20457074e+00,  -2.30167545e-01,   1.76434524e-01,
-            2.30167545e-01,   2.21356002e+00,  -5.17135569e+00,
-           -1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.04638309e-01,   1.59594560e-15,
+           -4.04638309e-01,   1.13786606e+00,   1.11855323e+00,
+           -8.38942398e-01,   8.38942398e-01,  -1.11855323e+00,
+           -1.13786606e+00,   6.84174939e-15,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -4.85931890e-01,   4.85931890e-01,   3.35148811e-16,
-           -2.44372756e+00,   6.37592643e+00,   2.44372756e+00,
-           -6.37592643e+00,  -5.37330206e-02,   5.37330206e-02,
-           -1.32779142e-14,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.04638309e-01,   4.44089210e-15,
+           -1.18553235e-01,  -2.82847955e-01,   2.25318218e+00,
+           -1.40140119e+00,   1.11531612e+00,  -5.56094442e-01,
+            2.82847955e-01,  -1.69708773e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -3.44372756e+00,   4.85931890e-01,  -1.00022725e-16,
-           -1.76434524e-01,  -2.30167545e-01,  -1.20457074e+00,
-            2.30167545e-01,   5.17135569e+00,  -2.21356002e+00,
-            1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   1.18553235e-01,   3.17107451e-15,
+           -4.04638309e-01,  -2.82847955e-01,   5.56094442e-01,
+           -1.11531612e+00,   1.40140119e+00,  -2.25318218e+00,
+            2.82847955e-01,   1.69708773e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  4.04638309e-01,  -1.18553235e-01,  -2.96189892e-17,
-            2.25318218e+00,  -2.82847955e-01,  -5.56094442e-01,
-            2.82847955e-01,  -1.40140119e+00,   1.11531612e+00,
-           -1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -5.59823902e-01,  -9.71445147e-17,
+           -4.92870367e-01,   2.60506708e+00,   2.46932174e+00,
+            7.50232851e-01,   3.02461418e-01,   1.95093341e+00,
+           -2.60506708e+00,  -4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  4.04638309e-01,  -4.04638309e-01,  -3.69822127e-17,
-            1.11855323e+00,   1.13786606e+00,  -1.11855323e+00,
-           -1.13786606e+00,  -8.38942398e-01,   8.38942398e-01,
-            1.36155758e-14,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.92870367e-01,  -1.05471187e-15,
+            5.59823902e-01,   2.60506708e+00,  -1.95093341e+00,
+           -3.02461418e-01,  -7.50232851e-01,  -2.46932174e+00,
+           -2.60506708e+00,   4.42025515e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  1.18553235e-01,  -4.04638309e-01,  -1.57310230e-16,
-            5.56094442e-01,  -2.82847955e-01,  -2.25318218e+00,
-            2.82847955e-01,  -1.11531612e+00,   1.40140119e+00,
-            1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -5.59823902e-01,   3.34801631e-15,
+            7.40805832e-01,  -9.62843375e-02,   3.93699696e+00,
+            1.74991003e+00,  -1.93089196e+00,   9.51256225e-01,
+            9.62843375e-02,  -4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -5.59823902e-01,   7.40805832e-01,   7.96972856e-17,
-            3.93699696e+00,  -9.62843375e-02,   9.51256225e-01,
-            9.62843375e-02,   1.74991003e+00,  -1.93089196e+00,
-           -4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -7.40805832e-01,   7.21644966e-16,
+            5.59823902e-01,  -9.62843375e-02,  -9.51256225e-01,
+            1.93089196e+00,  -1.74991003e+00,  -3.93699696e+00,
+            9.62843375e-02,   4.88825318e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [  4.92870367e-01,   7.40805832e-01,  -1.12042977e-17,
-            6.74175116e-01,  -2.01023374e-01,  -2.06177081e-01,
-            2.01023374e-01,  -2.56560608e+00,   1.33192988e+00,
-           -4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.92870367e-01,   6.21031004e-15,
+            7.40805832e-01,  -2.01023374e-01,   6.74175116e-01,
+           -2.56560608e+00,   1.33192988e+00,  -2.06177081e-01,
+            2.01023374e-01,  -4.67998035e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00],
-         [ -5.59823902e-01,  -4.92870367e-01,   2.24860335e-16,
-            2.46932174e+00,   2.60506708e+00,   1.95093341e+00,
-           -2.60506708e+00,   7.50232851e-01,   3.02461418e-01,
-           -4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -7.40805832e-01,   4.01068068e-15,
+           -4.92870367e-01,  -2.01023374e-01,   2.06177081e-01,
+           -1.33192988e+00,   2.56560608e+00,  -6.74175116e-01,
+            2.01023374e-01,   4.67998035e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -7.40805832e-01,  -4.92870367e-01,  -4.21435619e-17,
-            2.06177081e-01,  -2.01023374e-01,  -6.74175116e-01,
-            2.01023374e-01,  -1.33192988e+00,   2.56560608e+00,
-            4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.47643942e-01,   2.49528788e+00,   0.00000000e+00,
+            2.52356058e-01,  -2.52356058e-01,  -3.24293183e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.47643942e-01,  -7.47643942e-01,   0.00000000e+00,
+            3.49528788e+00,  -3.49528788e+00,   2.61756373e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.49528788e+00,  -7.47643942e-01,   0.00000000e+00,
+            2.52356058e-01,  -2.52356058e-01,   3.24293183e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  4.92870367e-01,   5.59823902e-01,  -1.14379134e-16,
-           -1.95093341e+00,   2.60506708e+00,  -2.46932174e+00,
-           -2.60506708e+00,  -3.02461418e-01,  -7.50232851e-01,
-            4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
+            2.85301932e-03,   1.00570604e+00,   0.00000000e+00,
+            9.97146981e-01,  -9.97146981e-01,  -1.00855906e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.85301932e-03,  -2.85301932e-03,   0.00000000e+00,
+            2.00570604e+00,  -2.00570604e+00,   3.63572562e-15,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00570604e+00,  -2.85301932e-03,   0.00000000e+00,
+            9.97146981e-01,  -9.97146981e-01,   1.00855906e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.87419801e-01,   1.54601000e+00,   0.00000000e+00,
+            1.24140980e+00,  -1.24140980e+00,  -2.33342980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -7.40805832e-01,   5.59823902e-01,  -2.90481448e-16,
-           -9.51256225e-01,  -9.62843375e-02,  -3.93699696e+00,
-            9.62843375e-02,   1.93089196e+00,  -1.74991003e+00,
-            4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.41409804e-01,   1.54601000e+00,   0.00000000e+00,
+            2.12580199e-01,  -2.12580199e-01,  -1.30460019e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.87419801e-01,   2.41409804e-01,   0.00000000e+00,
+            2.54601000e+00,  -2.54601000e+00,  -1.02882960e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.54601000e+00,   2.41409804e-01,   0.00000000e+00,
+            2.12580199e-01,  -2.12580199e-01,   1.30460019e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.41409804e-01,  -7.87419801e-01,   0.00000000e+00,
+            2.54601000e+00,  -2.54601000e+00,   1.02882960e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[-0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
-           0.22051427,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
-           0.01592089,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
-           0.22051427,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
-           0.49999593,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
-           0.24857553,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
-           0.49999593,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
-           0.13530783,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
-           0.79016044,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
-           0.06597479,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
-           0.79016044,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
-           0.06597479,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
-           0.13530783,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.05512857,  0.6533077 , -0.05512857,  0.22051427,
-           0.01592089,  0.22051427,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.05512857, -0.05512857,  0.6533077 ,  0.22051427,
-           0.22051427,  0.01592089,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.6533077 , -0.05512857, -0.05512857,  0.01592089,
-           0.22051427,  0.22051427,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12499898,  0.00143058, -0.12499898,  0.49999593,
-           0.24857553,  0.49999593,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12499898, -0.12499898,  0.00143058,  0.49999593,
-           0.49999593,  0.24857553,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.00143058, -0.12499898, -0.12499898,  0.24857553,
-           0.49999593,  0.49999593,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04749626,  0.17376836, -0.11771516,  0.79016044,
-           0.06597479,  0.13530783,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.11771516,  0.17376836, -0.04749626,  0.13530783,
-           0.06597479,  0.79016044,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04749626, -0.11771516,  0.17376836,  0.79016044,
-           0.13530783,  0.06597479,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.17376836, -0.11771516, -0.04749626,  0.06597479,
-           0.13530783,  0.79016044,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.11771516, -0.04749626,  0.17376836,  0.13530783,
-           0.79016044,  0.06597479,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.17376836, -0.04749626, -0.11771516,  0.06597479,
-           0.79016044,  0.13530783,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.06308901,  0.87382197,  0.06308901],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.06308901,  0.06308901,  0.87382197],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.87382197,  0.06308901,  0.06308901],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.24928675,  0.50142651,  0.24928675],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.24928675,  0.24928675,  0.50142651],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.50142651,  0.24928675,  0.24928675],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.05314505,  0.6365025 ,  0.31035245],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.31035245,  0.6365025 ,  0.05314505],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.05314505,  0.31035245,  0.6365025 ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.6365025 ,  0.31035245,  0.05314505],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.31035245,  0.05314505,  0.6365025 ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.6365025 ,  0.05314505,  0.31035245]]), 'FE1_C0_D10': array([[  7.47643942e-01,   2.49528788e+00,   0.00000000e+00,
+           -1.54601000e+00,  -7.87419801e-01,   0.00000000e+00,
+            1.24140980e+00,  -1.24140980e+00,   2.33342980e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D10': array([[  7.47643942e-01,   2.49528788e+00,   0.00000000e+00,
             2.52356058e-01,  -2.52356058e-01,  -3.24293183e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  7.47643942e-01,  -7.47643942e-01,   0.00000000e+00,
-            3.49528788e+00,  -3.49528788e+00,   2.05117403e-15,
+            3.49528788e+00,  -3.49528788e+00,   2.61756373e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -5618,7 +5253,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  2.85301932e-03,  -2.85301932e-03,   0.00000000e+00,
-            2.00570604e+00,  -2.00570604e+00,   3.89861391e-15,
+            2.00570604e+00,  -2.00570604e+00,   3.63572562e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -5656,308 +5291,715 @@ Compiler stage 2: Computing intermediate representation
             1.24140980e+00,  -1.24140980e+00,   2.33342980e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
-  
-  name_map: {}
-  
-  inv_name_map: {'FE2_C1_D01': 'FE2_C1_D01', 'FE0_C1_D01': 'FE0_C1_D01', 'FE2_C2_D10': 'FE2_C2_D10', 'FE1_C1_D10': 'FE1_C1_D10', 'FE1_C2_D10': 'FE1_C2_D10', 'FE2_C0_D01': 'FE2_C0_D01', 'FE0_C0_D01': 'FE0_C0_D01', 'FE2_C1': 'FE2_C1', 'FE2_C0': 'FE2_C0', 'FE2_C2': 'FE2_C2', 'FE3': 'FE3', 'FE1_C0_D01': 'FE1_C0_D01', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0', 'FE2_C1_D10': 'FE2_C1_D10', 'FE1_C1_D01': 'FE1_C1_D01', 'FE0_C1_D10': 'FE0_C1_D10', 'FE2_C2_D01': 'FE2_C2_D01', 'FE0_C0_D10': 'FE0_C0_D10 [...]
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE2_C0_D01': array([[-0.48593189,  0.48593189,  6.37592643, -2.44372756, -0.05373302,
-           0.05373302,  2.44372756, -6.37592643,  0.        ],
-         [-0.48593189,  3.44372756, -0.23016754,  1.20457074,  2.21356002,
-          -5.17135569,  0.17643452,  0.23016754, -1.38100527],
-         [-3.44372756,  0.48593189, -0.23016754, -0.17643452,  5.17135569,
-          -2.21356002, -1.20457074,  0.23016754,  1.38100527],
-         [ 0.40463831, -0.40463831,  1.13786606,  1.11855323, -0.8389424 ,
-           0.8389424 , -1.11855323, -1.13786606,  0.        ],
-         [ 0.40463831, -0.11855323, -0.28284796,  2.25318218, -1.40140119,
-           1.11531612, -0.55609444,  0.28284796, -1.69708773],
-         [ 0.11855323, -0.40463831, -0.28284796,  0.55609444, -1.11531612,
-           1.40140119, -2.25318218,  0.28284796,  1.69708773],
-         [-0.5598239 , -0.49287037,  2.60506708,  2.46932174,  0.75023285,
-           0.30246142,  1.95093341, -2.60506708, -4.42025515],
-         [ 0.49287037,  0.5598239 ,  2.60506708, -1.95093341, -0.30246142,
-          -0.75023285, -2.46932174, -2.60506708,  4.42025515],
-         [-0.5598239 ,  0.74080583, -0.09628434,  3.93699696,  1.74991003,
-          -1.93089196,  0.95125622,  0.09628434, -4.88825318],
-         [-0.74080583,  0.5598239 , -0.09628434, -0.95125622,  1.93089196,
-          -1.74991003, -3.93699696,  0.09628434,  4.88825318],
-         [ 0.49287037,  0.74080583, -0.20102337,  0.67417512, -2.56560608,
-           1.33192988, -0.20617708,  0.20102337, -0.46799804],
-         [-0.74080583, -0.49287037, -0.20102337,  0.20617708, -1.33192988,
-           2.56560608, -0.67417512,  0.20102337,  0.46799804]]), 'FE0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE2_C0': array([[ 0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
-          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_C0': array([[ 0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
+          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [ 0.046308  ,  0.046308  ,  0.44026899, -0.20112546,  0.40225091,
-          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619],
+          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [ 0.44026899,  0.046308  ,  0.046308  , -0.01452104, -0.01452104,
-           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619],
+           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [ 0.03935169, -0.06267372,  0.03935169,  0.28365493, -0.14182746,
-          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592],
+          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [ 0.03935169,  0.03935169, -0.06267372, -0.14182746,  0.28365493,
-          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592],
+          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [-0.06267372,  0.03935169,  0.03935169, -0.07051025, -0.07051025,
-           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592],
+           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [ 0.04111073, -0.02619323,  0.01143583,  0.80848895, -0.06128522,
-          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353],
+          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [ 0.01143583, -0.02619323,  0.04111073,  0.13844642, -0.12795188,
-          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353],
+          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [ 0.04111073,  0.01143583, -0.02619323, -0.06128522,  0.80848895,
-          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353],
-         [-0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
-           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353],
+          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [-0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
+           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [ 0.01143583,  0.04111073, -0.02619323, -0.12795188,  0.13844642,
-          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353],
+          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
          [-0.02619323,  0.04111073,  0.01143583, -0.0623881 , -0.00511704,
-           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353]]), 'FE3': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_C0_D01': array([[  7.47643942e-01,  -7.47643942e-01,   3.49528788e+00,
-            1.24344979e-14,  -3.49528788e+00],
-         [  7.47643942e-01,   2.49528788e+00,   2.52356058e-01,
-           -3.24293183e+00,  -2.52356058e-01],
-         [ -2.49528788e+00,  -7.47643942e-01,   2.52356058e-01,
-            3.24293183e+00,  -2.52356058e-01],
-         [  2.85301932e-03,  -2.85301932e-03,   2.00570604e+00,
-            1.40998324e-14,  -2.00570604e+00],
-         [  2.85301932e-03,   1.00570604e+00,   9.97146981e-01,
-           -1.00855906e+00,  -9.97146981e-01],
-         [ -1.00570604e+00,  -2.85301932e-03,   9.97146981e-01,
-            1.00855906e+00,  -9.97146981e-01],
-         [  7.87419801e-01,   2.41409804e-01,   2.54601000e+00,
-           -1.02882960e+00,  -2.54601000e+00],
-         [ -2.41409804e-01,  -7.87419801e-01,   2.54601000e+00,
-            1.02882960e+00,  -2.54601000e+00],
-         [  7.87419801e-01,   1.54601000e+00,   1.24140980e+00,
-           -2.33342980e+00,  -1.24140980e+00],
-         [ -1.54601000e+00,  -7.87419801e-01,   1.24140980e+00,
-            2.33342980e+00,  -1.24140980e+00],
-         [ -2.41409804e-01,   1.54601000e+00,   2.12580199e-01,
-           -1.30460019e+00,  -2.12580199e-01],
-         [ -1.54601000e+00,   2.41409804e-01,   2.12580199e-01,
-            1.30460019e+00,  -2.12580199e-01]]), 'FE0_C0': array([[ 0.06308901,  0.87382197,  0.06308901],
-         [ 0.06308901,  0.06308901,  0.87382197],
-         [ 0.87382197,  0.06308901,  0.06308901],
-         [ 0.24928675,  0.50142651,  0.24928675],
-         [ 0.24928675,  0.24928675,  0.50142651],
-         [ 0.50142651,  0.24928675,  0.24928675],
-         [ 0.05314505,  0.6365025 ,  0.31035245],
-         [ 0.31035245,  0.6365025 ,  0.05314505],
-         [ 0.05314505,  0.31035245,  0.6365025 ],
-         [ 0.6365025 ,  0.31035245,  0.05314505],
-         [ 0.31035245,  0.05314505,  0.6365025 ],
-         [ 0.6365025 ,  0.05314505,  0.31035245]]), 'FE2_C0_D10': array([[ -4.85931890e-01,   3.44372756e+00,   1.20457074e+00,
-           -2.30167545e-01,   1.76434524e-01,   2.30167545e-01,
-            2.21356002e+00,  -5.17135569e+00,  -1.38100527e+00],
-         [ -4.85931890e-01,   4.85931890e-01,  -2.44372756e+00,
-            6.37592643e+00,   2.44372756e+00,  -6.37592643e+00,
-           -5.37330206e-02,   5.37330206e-02,  -1.32779142e-14],
-         [ -3.44372756e+00,   4.85931890e-01,  -1.76434524e-01,
-           -2.30167545e-01,  -1.20457074e+00,   2.30167545e-01,
-            5.17135569e+00,  -2.21356002e+00,   1.38100527e+00],
-         [  4.04638309e-01,  -1.18553235e-01,   2.25318218e+00,
-           -2.82847955e-01,  -5.56094442e-01,   2.82847955e-01,
-           -1.40140119e+00,   1.11531612e+00,  -1.69708773e+00],
-         [  4.04638309e-01,  -4.04638309e-01,   1.11855323e+00,
-            1.13786606e+00,  -1.11855323e+00,  -1.13786606e+00,
-           -8.38942398e-01,   8.38942398e-01,   1.36155758e-14],
-         [  1.18553235e-01,  -4.04638309e-01,   5.56094442e-01,
-           -2.82847955e-01,  -2.25318218e+00,   2.82847955e-01,
-           -1.11531612e+00,   1.40140119e+00,   1.69708773e+00],
-         [ -5.59823902e-01,   7.40805832e-01,   3.93699696e+00,
-           -9.62843375e-02,   9.51256225e-01,   9.62843375e-02,
-            1.74991003e+00,  -1.93089196e+00,  -4.88825318e+00],
-         [  4.92870367e-01,   7.40805832e-01,   6.74175116e-01,
-           -2.01023374e-01,  -2.06177081e-01,   2.01023374e-01,
-           -2.56560608e+00,   1.33192988e+00,  -4.67998035e-01],
-         [ -5.59823902e-01,  -4.92870367e-01,   2.46932174e+00,
-            2.60506708e+00,   1.95093341e+00,  -2.60506708e+00,
-            7.50232851e-01,   3.02461418e-01,  -4.42025515e+00],
-         [ -7.40805832e-01,  -4.92870367e-01,   2.06177081e-01,
-           -2.01023374e-01,  -6.74175116e-01,   2.01023374e-01,
-           -1.33192988e+00,   2.56560608e+00,   4.67998035e-01],
-         [  4.92870367e-01,   5.59823902e-01,  -1.95093341e+00,
-            2.60506708e+00,  -2.46932174e+00,  -2.60506708e+00,
-           -3.02461418e-01,  -7.50232851e-01,   4.42025515e+00],
-         [ -7.40805832e-01,   5.59823902e-01,  -9.51256225e-01,
-           -9.62843375e-02,  -3.93699696e+00,   9.62843375e-02,
-            1.93089196e+00,  -1.74991003e+00,   4.88825318e+00]]), 'FE1_C0': array([[-0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
+           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
+          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.046308  ,  0.046308  ,  0.44026899, -0.20112546,  0.40225091,
+          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.44026899,  0.046308  ,  0.046308  , -0.01452104, -0.01452104,
+           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.03935169, -0.06267372,  0.03935169,  0.28365493, -0.14182746,
+          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.03935169,  0.03935169, -0.06267372, -0.14182746,  0.28365493,
+          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.06267372,  0.03935169,  0.03935169, -0.07051025, -0.07051025,
+           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.04111073, -0.02619323,  0.01143583,  0.80848895, -0.06128522,
+          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.01143583, -0.02619323,  0.04111073,  0.13844642, -0.12795188,
+          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.04111073,  0.01143583, -0.02619323, -0.06128522,  0.80848895,
+          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
+           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.01143583,  0.04111073, -0.02619323, -0.12795188,  0.13844642,
+          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.02619323,  0.04111073,  0.01143583, -0.0623881 , -0.00511704,
+           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
            0.22051427],
-         [-0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
            0.01592089],
-         [ 0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
            0.22051427],
-         [-0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
            0.49999593],
-         [-0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
            0.24857553],
-         [ 0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
            0.49999593],
-         [-0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
            0.13530783],
-         [-0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
            0.79016044],
-         [-0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
            0.06597479],
-         [ 0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
            0.79016044],
-         [-0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
            0.06597479],
-         [ 0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
-           0.13530783]]), 'FE1_C0_D10': array([[  7.47643942e-01,   2.49528788e+00,   2.52356058e-01,
-           -2.52356058e-01,  -3.24293183e+00],
-         [  7.47643942e-01,  -7.47643942e-01,   3.49528788e+00,
-           -3.49528788e+00,   0.00000000e+00],
-         [ -2.49528788e+00,  -7.47643942e-01,   2.52356058e-01,
-           -2.52356058e-01,   3.24293183e+00],
-         [  2.85301932e-03,   1.00570604e+00,   9.97146981e-01,
-           -9.97146981e-01,  -1.00855906e+00],
-         [  2.85301932e-03,  -2.85301932e-03,   2.00570604e+00,
-           -2.00570604e+00,   0.00000000e+00],
-         [ -1.00570604e+00,  -2.85301932e-03,   9.97146981e-01,
-           -9.97146981e-01,   1.00855906e+00],
-         [  7.87419801e-01,   1.54601000e+00,   1.24140980e+00,
-           -1.24140980e+00,  -2.33342980e+00],
-         [ -2.41409804e-01,   1.54601000e+00,   2.12580199e-01,
-           -2.12580199e-01,  -1.30460019e+00],
-         [  7.87419801e-01,   2.41409804e-01,   2.54601000e+00,
-           -2.54601000e+00,  -1.02882960e+00],
-         [ -1.54601000e+00,   2.41409804e-01,   2.12580199e-01,
-           -2.12580199e-01,   1.30460019e+00],
-         [ -2.41409804e-01,  -7.87419801e-01,   2.54601000e+00,
-           -2.54601000e+00,   1.02882960e+00],
-         [ -1.54601000e+00,  -7.87419801e-01,   1.24140980e+00,
-           -1.24140980e+00,   2.33342980e+00]])}
-  
-  QG-utils, psi_tables, name_map:
-  {'FE2_C1_D01': ('FE2_C0_D01', (19, [10, 12, 13, 14, 15, 16, 17, 18, 19]), False, False), 'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE2_C2_D10': ('FE1_C0_D10', (23, [20, 21, 23, 24, 25]), False, False), 'FE1_C1_D10': ('FE1_C0_D10', (11, [6, 7, 9, 10, 11]), False, False), 'FE1_C2_D10': ('FE0_C0_D01', (14, [12, 13]), False, False), 'FE2_C0_D01': ('FE2_C0_D01', (16, [0, 2, 3, 4, 5, 6, 7, 8, 9]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2]), False, False), 'FE2_C1 [...]
-  Transforming cell integral
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing quadrature representation
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  
-  QG-utils, psi_tables:
-  {3: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 0): array([[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
-         [  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
-         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 1: {(0, 0): array([[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
-         [  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
-         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 2: {(0, 0): array([[ 0.88729833,  0.5       ,  0.11270167],
-         [ 0.11270167,  0.5       ,  0.88729833],
-         [ 0.        ,  0.        ,  0.        ]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.],
-          [-1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.],
-          [ 1.,  1.,  1.]],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
+           0.13530783]]), 'FE3_C1': array([[ 0.        ,  0.        ,  0.        ,  0.06308901,  0.87382197,
+           0.06308901],
+         [ 0.        ,  0.        ,  0.        ,  0.06308901,  0.06308901,
+           0.87382197],
+         [ 0.        ,  0.        ,  0.        ,  0.87382197,  0.06308901,
+           0.06308901],
+         [ 0.        ,  0.        ,  0.        ,  0.24928675,  0.50142651,
+           0.24928675],
+         [ 0.        ,  0.        ,  0.        ,  0.24928675,  0.24928675,
+           0.50142651],
+         [ 0.        ,  0.        ,  0.        ,  0.50142651,  0.24928675,
+           0.24928675],
+         [ 0.        ,  0.        ,  0.        ,  0.05314505,  0.6365025 ,
+           0.31035245],
+         [ 0.        ,  0.        ,  0.        ,  0.31035245,  0.6365025 ,
+           0.05314505],
+         [ 0.        ,  0.        ,  0.        ,  0.05314505,  0.31035245,
+           0.6365025 ],
+         [ 0.        ,  0.        ,  0.        ,  0.6365025 ,  0.31035245,
+           0.05314505],
+         [ 0.        ,  0.        ,  0.        ,  0.31035245,  0.05314505,
+           0.6365025 ],
+         [ 0.        ,  0.        ,  0.        ,  0.6365025 ,  0.05314505,
+           0.31035245]]), 'FE1_C0_D10': array([[ -4.85931890e-01,   3.44372756e+00,  -6.19847219e-18,
+            1.20457074e+00,  -2.30167545e-01,   1.76434524e-01,
+            2.30167545e-01,   2.21356002e+00,  -5.17135569e+00,
+           -1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -4.85931890e-01,   4.85931890e-01,   3.35148811e-16,
+           -2.44372756e+00,   6.37592643e+00,   2.44372756e+00,
+           -6.37592643e+00,  -5.37330206e-02,   5.37330206e-02,
+           -9.48836306e-15,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -3.44372756e+00,   4.85931890e-01,  -1.00022725e-16,
+           -1.76434524e-01,  -2.30167545e-01,  -1.20457074e+00,
+            2.30167545e-01,   5.17135569e+00,  -2.21356002e+00,
+            1.38100527e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  4.04638309e-01,  -1.18553235e-01,  -2.96189892e-17,
+            2.25318218e+00,  -2.82847955e-01,  -5.56094442e-01,
+            2.82847955e-01,  -1.40140119e+00,   1.11531612e+00,
+           -1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  4.04638309e-01,  -4.04638309e-01,  -3.69822127e-17,
+            1.11855323e+00,   1.13786606e+00,  -1.11855323e+00,
+           -1.13786606e+00,  -8.38942398e-01,   8.38942398e-01,
+            1.30826401e-14,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  1.18553235e-01,  -4.04638309e-01,  -1.57310230e-16,
+            5.56094442e-01,  -2.82847955e-01,  -2.25318218e+00,
+            2.82847955e-01,  -1.11531612e+00,   1.40140119e+00,
+            1.69708773e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -5.59823902e-01,   7.40805832e-01,   7.96972856e-17,
+            3.93699696e+00,  -9.62843375e-02,   9.51256225e-01,
+            9.62843375e-02,   1.74991003e+00,  -1.93089196e+00,
+           -4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  4.92870367e-01,   7.40805832e-01,  -1.12042977e-17,
+            6.74175116e-01,  -2.01023374e-01,  -2.06177081e-01,
+            2.01023374e-01,  -2.56560608e+00,   1.33192988e+00,
+           -4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -5.59823902e-01,  -4.92870367e-01,   2.24860335e-16,
+            2.46932174e+00,   2.60506708e+00,   1.95093341e+00,
+           -2.60506708e+00,   7.50232851e-01,   3.02461418e-01,
+           -4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -7.40805832e-01,  -4.92870367e-01,  -4.21435619e-17,
+            2.06177081e-01,  -2.01023374e-01,  -6.74175116e-01,
+            2.01023374e-01,  -1.33192988e+00,   2.56560608e+00,
+            4.67998035e-01,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  4.92870367e-01,   5.59823902e-01,  -1.14379134e-16,
+           -1.95093341e+00,   2.60506708e+00,  -2.46932174e+00,
+           -2.60506708e+00,  -3.02461418e-01,  -7.50232851e-01,
+            4.42025515e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -7.40805832e-01,   5.59823902e-01,  -2.90481448e-16,
+           -9.51256225e-01,  -9.62843375e-02,  -3.93699696e+00,
+            9.62843375e-02,   1.93089196e+00,  -1.74991003e+00,
+            4.88825318e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE3_C0': array([[ 0.06308901,  0.87382197,  0.06308901,  0.        ,  0.        ,
+           0.        ],
+         [ 0.06308901,  0.06308901,  0.87382197,  0.        ,  0.        ,
+           0.        ],
+         [ 0.87382197,  0.06308901,  0.06308901,  0.        ,  0.        ,
+           0.        ],
+         [ 0.24928675,  0.50142651,  0.24928675,  0.        ,  0.        ,
+           0.        ],
+         [ 0.24928675,  0.24928675,  0.50142651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.50142651,  0.24928675,  0.24928675,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05314505,  0.6365025 ,  0.31035245,  0.        ,  0.        ,
+           0.        ],
+         [ 0.31035245,  0.6365025 ,  0.05314505,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05314505,  0.31035245,  0.6365025 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.6365025 ,  0.31035245,  0.05314505,  0.        ,  0.        ,
+           0.        ],
+         [ 0.31035245,  0.05314505,  0.6365025 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.6365025 ,  0.05314505,  0.31035245,  0.        ,  0.        ,
+           0.        ]])}
   
-         [[ 0.,  0.,  0.],
-          [ 0.,  0.,  0.]]]), (0, 0): array([[[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  name_map: {}
   
-         [[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE3_C1': 'FE3_C1', 'FE3_C1_D10': 'FE3_C1_D10', 'FE1_C1_D10': 'FE1_C1_D10', 'FE3_C0_D10': 'FE3_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE2': 'FE2', 'FE0_C2_D01': 'FE0_C2_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0', 'FE3_C1_D01': 'FE3_C1_D01', 'FE1_C1_D01': 'FE1_C1_D01', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C2_D01': 'FE1_C2_D01', 'FE0_C0_D10': 'FE0_C0_D10', 'FE3_C0_D01': 'FE3_C0_D01', 'FE1_C2_D10': 'FE [...]
+  
+  QG-utils, psi_tables, unique_tables:
+  {'FE0_C0_D01': array([[  7.47643942e-01,  -7.47643942e-01,   3.49528788e+00,
+            1.15463195e-14,  -3.49528788e+00],
+         [  7.47643942e-01,   2.49528788e+00,   2.52356058e-01,
+           -3.24293183e+00,  -2.52356058e-01],
+         [ -2.49528788e+00,  -7.47643942e-01,   2.52356058e-01,
+            3.24293183e+00,  -2.52356058e-01],
+         [  2.85301932e-03,  -2.85301932e-03,   2.00570604e+00,
+            1.40998324e-14,  -2.00570604e+00],
+         [  2.85301932e-03,   1.00570604e+00,   9.97146981e-01,
+           -1.00855906e+00,  -9.97146981e-01],
+         [ -1.00570604e+00,  -2.85301932e-03,   9.97146981e-01,
+            1.00855906e+00,  -9.97146981e-01],
+         [  7.87419801e-01,   2.41409804e-01,   2.54601000e+00,
+           -1.02882960e+00,  -2.54601000e+00],
+         [ -2.41409804e-01,  -7.87419801e-01,   2.54601000e+00,
+            1.02882960e+00,  -2.54601000e+00],
+         [  7.87419801e-01,   1.54601000e+00,   1.24140980e+00,
+           -2.33342980e+00,  -1.24140980e+00],
+         [ -1.54601000e+00,  -7.87419801e-01,   1.24140980e+00,
+            2.33342980e+00,  -1.24140980e+00],
+         [ -2.41409804e-01,   1.54601000e+00,   2.12580199e-01,
+           -1.30460019e+00,  -2.12580199e-01],
+         [ -1.54601000e+00,   2.41409804e-01,   2.12580199e-01,
+            1.30460019e+00,  -2.12580199e-01]]), 'FE2': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE0_C2_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]]), 'FE1_C0_D01': array([[ -4.85931890e-01,   4.85931890e-01,   6.37592643e+00,
+           -2.44372756e+00,  -5.37330206e-02,   5.37330206e-02,
+            2.44372756e+00,  -6.37592643e+00,  -1.06581410e-14],
+         [ -4.85931890e-01,   3.44372756e+00,  -2.30167545e-01,
+            1.20457074e+00,   2.21356002e+00,  -5.17135569e+00,
+            1.76434524e-01,   2.30167545e-01,  -1.38100527e+00],
+         [ -3.44372756e+00,   4.85931890e-01,  -2.30167545e-01,
+           -1.76434524e-01,   5.17135569e+00,  -2.21356002e+00,
+           -1.20457074e+00,   2.30167545e-01,   1.38100527e+00],
+         [  4.04638309e-01,  -4.04638309e-01,   1.13786606e+00,
+            1.11855323e+00,  -8.38942398e-01,   8.38942398e-01,
+           -1.11855323e+00,  -1.13786606e+00,   0.00000000e+00],
+         [  4.04638309e-01,  -1.18553235e-01,  -2.82847955e-01,
+            2.25318218e+00,  -1.40140119e+00,   1.11531612e+00,
+           -5.56094442e-01,   2.82847955e-01,  -1.69708773e+00],
+         [  1.18553235e-01,  -4.04638309e-01,  -2.82847955e-01,
+            5.56094442e-01,  -1.11531612e+00,   1.40140119e+00,
+           -2.25318218e+00,   2.82847955e-01,   1.69708773e+00],
+         [ -5.59823902e-01,  -4.92870367e-01,   2.60506708e+00,
+            2.46932174e+00,   7.50232851e-01,   3.02461418e-01,
+            1.95093341e+00,  -2.60506708e+00,  -4.42025515e+00],
+         [  4.92870367e-01,   5.59823902e-01,   2.60506708e+00,
+           -1.95093341e+00,  -3.02461418e-01,  -7.50232851e-01,
+           -2.46932174e+00,  -2.60506708e+00,   4.42025515e+00],
+         [ -5.59823902e-01,   7.40805832e-01,  -9.62843375e-02,
+            3.93699696e+00,   1.74991003e+00,  -1.93089196e+00,
+            9.51256225e-01,   9.62843375e-02,  -4.88825318e+00],
+         [ -7.40805832e-01,   5.59823902e-01,  -9.62843375e-02,
+           -9.51256225e-01,   1.93089196e+00,  -1.74991003e+00,
+           -3.93699696e+00,   9.62843375e-02,   4.88825318e+00],
+         [  4.92870367e-01,   7.40805832e-01,  -2.01023374e-01,
+            6.74175116e-01,  -2.56560608e+00,   1.33192988e+00,
+           -2.06177081e-01,   2.01023374e-01,  -4.67998035e-01],
+         [ -7.40805832e-01,  -4.92870367e-01,  -2.01023374e-01,
+            2.06177081e-01,  -1.33192988e+00,   2.56560608e+00,
+           -6.74175116e-01,   2.01023374e-01,   4.67998035e-01]]), 'FE0_C2': array([[ 0.06308901,  0.87382197,  0.06308901],
+         [ 0.06308901,  0.06308901,  0.87382197],
+         [ 0.87382197,  0.06308901,  0.06308901],
+         [ 0.24928675,  0.50142651,  0.24928675],
+         [ 0.24928675,  0.24928675,  0.50142651],
+         [ 0.50142651,  0.24928675,  0.24928675],
+         [ 0.05314505,  0.6365025 ,  0.31035245],
+         [ 0.31035245,  0.6365025 ,  0.05314505],
+         [ 0.05314505,  0.31035245,  0.6365025 ],
+         [ 0.6365025 ,  0.31035245,  0.05314505],
+         [ 0.31035245,  0.05314505,  0.6365025 ],
+         [ 0.6365025 ,  0.05314505,  0.31035245]]), 'FE0_C0': array([[-0.05512857,  0.6533077 , -0.05512857,  0.22051427,  0.01592089,
+           0.22051427],
+         [-0.05512857, -0.05512857,  0.6533077 ,  0.22051427,  0.22051427,
+           0.01592089],
+         [ 0.6533077 , -0.05512857, -0.05512857,  0.01592089,  0.22051427,
+           0.22051427],
+         [-0.12499898,  0.00143058, -0.12499898,  0.49999593,  0.24857553,
+           0.49999593],
+         [-0.12499898, -0.12499898,  0.00143058,  0.49999593,  0.49999593,
+           0.24857553],
+         [ 0.00143058, -0.12499898, -0.12499898,  0.24857553,  0.49999593,
+           0.49999593],
+         [-0.04749626,  0.17376836, -0.11771516,  0.79016044,  0.06597479,
+           0.13530783],
+         [-0.11771516,  0.17376836, -0.04749626,  0.13530783,  0.06597479,
+           0.79016044],
+         [-0.04749626, -0.11771516,  0.17376836,  0.79016044,  0.13530783,
+           0.06597479],
+         [ 0.17376836, -0.11771516, -0.04749626,  0.06597479,  0.13530783,
+           0.79016044],
+         [-0.11771516, -0.04749626,  0.17376836,  0.13530783,  0.79016044,
+           0.06597479],
+         [ 0.17376836, -0.04749626, -0.11771516,  0.06597479,  0.79016044,
+           0.13530783]]), 'FE0_C0_D10': array([[  7.47643942e-01,   2.49528788e+00,   2.52356058e-01,
+           -2.52356058e-01,  -3.24293183e+00],
+         [  7.47643942e-01,  -7.47643942e-01,   3.49528788e+00,
+           -3.49528788e+00,   0.00000000e+00],
+         [ -2.49528788e+00,  -7.47643942e-01,   2.52356058e-01,
+           -2.52356058e-01,   3.24293183e+00],
+         [  2.85301932e-03,   1.00570604e+00,   9.97146981e-01,
+           -9.97146981e-01,  -1.00855906e+00],
+         [  2.85301932e-03,  -2.85301932e-03,   2.00570604e+00,
+           -2.00570604e+00,   0.00000000e+00],
+         [ -1.00570604e+00,  -2.85301932e-03,   9.97146981e-01,
+           -9.97146981e-01,   1.00855906e+00],
+         [  7.87419801e-01,   1.54601000e+00,   1.24140980e+00,
+           -1.24140980e+00,  -2.33342980e+00],
+         [ -2.41409804e-01,   1.54601000e+00,   2.12580199e-01,
+           -2.12580199e-01,  -1.30460019e+00],
+         [  7.87419801e-01,   2.41409804e-01,   2.54601000e+00,
+           -2.54601000e+00,  -1.02882960e+00],
+         [ -1.54601000e+00,   2.41409804e-01,   2.12580199e-01,
+           -2.12580199e-01,   1.30460019e+00],
+         [ -2.41409804e-01,  -7.87419801e-01,   2.54601000e+00,
+           -2.54601000e+00,   1.02882960e+00],
+         [ -1.54601000e+00,  -7.87419801e-01,   1.24140980e+00,
+           -1.24140980e+00,   2.33342980e+00]]), 'FE1_C0': array([[ 0.046308  ,  0.44026899,  0.046308  ,  0.40225091, -0.20112546,
+          -0.01452104, -0.01452104, -0.20112546,  0.40225091,  0.09390619],
+         [ 0.046308  ,  0.046308  ,  0.44026899, -0.20112546,  0.40225091,
+          -0.20112546,  0.40225091, -0.01452104, -0.01452104,  0.09390619],
+         [ 0.44026899,  0.046308  ,  0.046308  , -0.01452104, -0.01452104,
+           0.40225091, -0.20112546,  0.40225091, -0.20112546,  0.09390619],
+         [ 0.03935169, -0.06267372,  0.03935169,  0.28365493, -0.14182746,
+          -0.07051025, -0.07051025, -0.14182746,  0.28365493,  0.84133592],
+         [ 0.03935169,  0.03935169, -0.06267372, -0.14182746,  0.28365493,
+          -0.14182746,  0.28365493, -0.07051025, -0.07051025,  0.84133592],
+         [-0.06267372,  0.03935169,  0.03935169, -0.07051025, -0.07051025,
+           0.28365493, -0.14182746,  0.28365493, -0.14182746,  0.84133592],
+         [ 0.04111073, -0.02619323,  0.01143583,  0.80848895, -0.06128522,
+          -0.0623881 , -0.00511704, -0.12795188,  0.13844642,  0.28345353],
+         [ 0.01143583, -0.02619323,  0.04111073,  0.13844642, -0.12795188,
+          -0.00511704, -0.0623881 , -0.06128522,  0.80848895,  0.28345353],
+         [ 0.04111073,  0.01143583, -0.02619323, -0.06128522,  0.80848895,
+          -0.12795188,  0.13844642, -0.0623881 , -0.00511704,  0.28345353],
+         [-0.02619323,  0.01143583,  0.04111073, -0.00511704, -0.0623881 ,
+           0.13844642, -0.12795188,  0.80848895, -0.06128522,  0.28345353],
+         [ 0.01143583,  0.04111073, -0.02619323, -0.12795188,  0.13844642,
+          -0.06128522,  0.80848895, -0.00511704, -0.0623881 ,  0.28345353],
+         [-0.02619323,  0.04111073,  0.01143583, -0.0623881 , -0.00511704,
+           0.80848895, -0.06128522,  0.13844642, -0.12795188,  0.28345353]]), 'FE1_C0_D10': array([[ -4.85931890e-01,   3.44372756e+00,   1.20457074e+00,
+           -2.30167545e-01,   1.76434524e-01,   2.30167545e-01,
+            2.21356002e+00,  -5.17135569e+00,  -1.38100527e+00],
+         [ -4.85931890e-01,   4.85931890e-01,  -2.44372756e+00,
+            6.37592643e+00,   2.44372756e+00,  -6.37592643e+00,
+           -5.37330206e-02,   5.37330206e-02,   0.00000000e+00],
+         [ -3.44372756e+00,   4.85931890e-01,  -1.76434524e-01,
+           -2.30167545e-01,  -1.20457074e+00,   2.30167545e-01,
+            5.17135569e+00,  -2.21356002e+00,   1.38100527e+00],
+         [  4.04638309e-01,  -1.18553235e-01,   2.25318218e+00,
+           -2.82847955e-01,  -5.56094442e-01,   2.82847955e-01,
+           -1.40140119e+00,   1.11531612e+00,  -1.69708773e+00],
+         [  4.04638309e-01,  -4.04638309e-01,   1.11855323e+00,
+            1.13786606e+00,  -1.11855323e+00,  -1.13786606e+00,
+           -8.38942398e-01,   8.38942398e-01,   1.30826401e-14],
+         [  1.18553235e-01,  -4.04638309e-01,   5.56094442e-01,
+           -2.82847955e-01,  -2.25318218e+00,   2.82847955e-01,
+           -1.11531612e+00,   1.40140119e+00,   1.69708773e+00],
+         [ -5.59823902e-01,   7.40805832e-01,   3.93699696e+00,
+           -9.62843375e-02,   9.51256225e-01,   9.62843375e-02,
+            1.74991003e+00,  -1.93089196e+00,  -4.88825318e+00],
+         [  4.92870367e-01,   7.40805832e-01,   6.74175116e-01,
+           -2.01023374e-01,  -2.06177081e-01,   2.01023374e-01,
+           -2.56560608e+00,   1.33192988e+00,  -4.67998035e-01],
+         [ -5.59823902e-01,  -4.92870367e-01,   2.46932174e+00,
+            2.60506708e+00,   1.95093341e+00,  -2.60506708e+00,
+            7.50232851e-01,   3.02461418e-01,  -4.42025515e+00],
+         [ -7.40805832e-01,  -4.92870367e-01,   2.06177081e-01,
+           -2.01023374e-01,  -6.74175116e-01,   2.01023374e-01,
+           -1.33192988e+00,   2.56560608e+00,   4.67998035e-01],
+         [  4.92870367e-01,   5.59823902e-01,  -1.95093341e+00,
+            2.60506708e+00,  -2.46932174e+00,  -2.60506708e+00,
+           -3.02461418e-01,  -7.50232851e-01,   4.42025515e+00],
+         [ -7.40805832e-01,   5.59823902e-01,  -9.51256225e-01,
+           -9.62843375e-02,  -3.93699696e+00,   9.62843375e-02,
+            1.93089196e+00,  -1.74991003e+00,   4.88825318e+00]])}
+  
+  QG-utils, psi_tables, name_map:
+  {'FE0_C1_D01': ('FE0_C0_D01', (4, [6, 8, 9, 10, 11]), False, False), 'FE3_C1': ('FE0_C2', (21, [3, 4, 5]), False, False), 'FE3_C1_D10': ('FE0_C2_D01', (23, [3, 4]), False, False), 'FE1_C1_D10': ('FE1_C0_D10', (14, [10, 11, 13, 14, 15, 16, 17, 18, 19]), False, False), 'FE3_C0_D10': ('FE0_C2_D01', (20, [0, 1]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2, 3, 4, 5]), False, False), 'FE2': ('FE2', (), False, True), 'FE0_C2_D01': ('FE0_C2_D01', (7, [12, 14]), False, False), 'FE1_C [...]
+  Transforming cell integral
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing quadrature representation
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  
+  QG-utils, psi_tables:
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1.],
+          [ 0.,  0.,  0.]],
+  
+         [[ 1.,  1.,  1.],
+          [ 0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.],
+          [ 0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.],
+          [-1., -1., -1.]],
+  
+         [[ 0.,  0.,  0.],
+          [ 1.,  1.,  1.]],
+  
+         [[ 0.,  0.,  0.],
+          [ 0.,  0.,  0.]]]), (0, 0): array([[[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  1.12701665e-01,   5.00000000e-01,   8.87298335e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
@@ -6065,7 +6107,7 @@ Compiler stage 2: Computing intermediate representation
           [ 0.11270167,  0.5       ,  0.88729833]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ]]])}}}, MixedElement(*[MixedElement(*[FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 3, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 3, quad_scheme=None)], **{'value_shape': (2,) }), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None)], **{'value_shape': (3,) }): {None: {0: {(0, 0): array([[[  4.16333634e-17,    [...]
+          [ 0.        ,  0.        ,  0.        ]]])}}}, MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 3), dim=2), FiniteElement('Lagrange', triangle, 2)): {None: {0: {(0, 0): array([[[  4.16333634e-17,   2.08166817e-17,   1.38777878e-17],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
@@ -6371,28 +6413,86 @@ Compiler stage 2: Computing intermediate representation
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]]])}}}}}
-  
+          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {0: {(0, 0): array([[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
+         [  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
+         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 1: {(0, 0): array([[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
+         [  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
+         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 2: {(0, 0): array([[ 0.88729833,  0.5       ,  0.11270167],
+         [ 0.11270167,  0.5       ,  0.88729833],
+         [ 0.        ,  0.        ,  0.        ]])}}}}}
+  
   QG-utils, psi_tables, flat_tables:
-  {'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
+  {'FE2_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
          [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
          [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE0_f1': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
          [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE0_f2': array([[ 0.88729833,  0.11270167,  0.        ],
          [ 0.5       ,  0.5       ,  0.        ],
-         [ 0.11270167,  0.88729833,  0.        ]]), 'FE1_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ 0.11270167,  0.88729833,  0.        ]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.87298335e-01,
+           -8.72983346e-02,   0.00000000e+00,   0.00000000e+00,
+           -2.77555756e-17,   4.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+            1.38777878e-17,   0.00000000e+00,   0.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -8.72983346e-02,
+            6.87298335e-01,   0.00000000e+00,   0.00000000e+00,
+           -5.55111512e-17,   4.00000000e-01]]), 'FE1_f2_C0': array([[  4.88014084e-01,   6.19859160e-02,   0.00000000e+00,
+           -1.11022302e-16,   2.77555756e-17,  -1.38777878e-16,
+            0.00000000e+00,   7.47852752e-01,  -2.97852752e-01,
+            1.66533454e-16,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -6.25000000e-02,  -6.25000000e-02,   0.00000000e+00,
+           -1.38777878e-16,   8.32667268e-17,   0.00000000e+00,
+            5.55111512e-17,   5.62500000e-01,   5.62500000e-01,
+            5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  6.19859160e-02,   4.88014084e-01,   2.77555756e-17,
+           -1.94289029e-16,   0.00000000e+00,  -2.77555756e-17,
+            5.55111512e-17,  -2.97852752e-01,   7.47852752e-01,
+           -5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   4.88014084e-01,   6.19859160e-02,
@@ -6418,43 +6518,69 @@ Compiler stage 2: Computing intermediate representation
            -2.77555756e-17,   5.55111512e-17,  -2.97852752e-01,
             7.47852752e-01,  -5.55111512e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.5       ,  0.5       ,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.11270167,  0.88729833,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE1_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
-           0.        ]]), 'FE2_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.        ]]), 'FE2_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f0_C0': array([[  4.16333634e-17,   4.88014084e-01,   6.19859160e-02,
+            7.47852752e-01,  -2.97852752e-01,   1.42247325e-16,
+           -1.11022302e-16,   1.96891115e-16,  -1.26634814e-16,
+            4.51028104e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.12757026e-16,
-            6.87298335e-01,  -8.72983346e-02,   4.00000000e-01,
-           -4.85722573e-17,  -1.23165367e-16],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  2.08166817e-17,  -6.25000000e-02,  -6.25000000e-02,
+            5.62500000e-01,   5.62500000e-01,   9.71445147e-17,
+           -9.71445147e-17,   6.76542156e-17,  -1.90819582e-17,
+           -3.46944695e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-           -9.71445147e-17,   8.32667268e-17,   1.00000000e+00,
-            1.38777878e-17,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  1.38777878e-17,   6.19859160e-02,   4.88014084e-01,
+           -2.97852752e-01,   7.47852752e-01,  -1.11022302e-16,
+           -5.55111512e-17,  -5.55111512e-17,   7.63278329e-17,
+           -5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-           -8.72983346e-02,   6.87298335e-01,   4.00000000e-01,
-            5.55111512e-17,  -6.93889390e-17]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   4.16333634e-17,   4.88014084e-01,
@@ -6480,120 +6606,109 @@ Compiler stage 2: Computing intermediate representation
            -1.11022302e-16,  -5.55111512e-17,  -5.55111512e-17,
             7.63278329e-17,  -5.55111512e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  4.16333634e-17,   4.88014084e-01,   6.19859160e-02,
-            7.47852752e-01,  -2.97852752e-01,   1.42247325e-16,
-           -1.11022302e-16,   1.96891115e-16,  -1.26634814e-16,
-            4.51028104e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  2.08166817e-17,  -6.25000000e-02,  -6.25000000e-02,
-            5.62500000e-01,   5.62500000e-01,   9.71445147e-17,
-           -9.71445147e-17,   6.76542156e-17,  -1.90819582e-17,
-           -3.46944695e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.12757026e-16,
+            6.87298335e-01,  -8.72983346e-02,   4.00000000e-01,
+           -4.85722573e-17,  -1.23165367e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.38777878e-17,   6.19859160e-02,   4.88014084e-01,
-           -2.97852752e-01,   7.47852752e-01,  -1.11022302e-16,
-           -5.55111512e-17,  -5.55111512e-17,   7.63278329e-17,
-           -5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+           -9.71445147e-17,   8.32667268e-17,   1.00000000e+00,
+            1.38777878e-17,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+           -8.72983346e-02,   6.87298335e-01,   4.00000000e-01,
+            5.55111512e-17,  -6.93889390e-17]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
+           0.        ]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
+         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE1_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f2_C0': array([[  4.88014084e-01,   6.19859160e-02,   0.00000000e+00,
-           -1.11022302e-16,   2.77555756e-17,  -1.38777878e-16,
-            0.00000000e+00,   7.47852752e-01,  -2.97852752e-01,
-            1.66533454e-16,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE1_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -6.25000000e-02,  -6.25000000e-02,   0.00000000e+00,
-           -1.38777878e-16,   8.32667268e-17,   0.00000000e+00,
-            5.55111512e-17,   5.62500000e-01,   5.62500000e-01,
-            5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.87298335e-01,
+            9.36750677e-17,  -8.72983346e-02,  -2.77555756e-17,
+            4.00000000e-01,  -1.23165367e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  6.19859160e-02,   4.88014084e-01,   2.77555756e-17,
-           -1.94289029e-16,   0.00000000e+00,  -2.77555756e-17,
-            5.55111512e-17,  -2.97852752e-01,   7.47852752e-01,
-           -5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   8.32667268e-17,
+            8.32667268e-17,   8.32667268e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -8.72983346e-02,
+            9.71445147e-17,   6.87298335e-01,   0.00000000e+00,
+            4.00000000e-01,  -6.93889390e-17]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.87298335e-01,
-           -8.72983346e-02,   0.00000000e+00,   0.00000000e+00,
-           -2.77555756e-17,   4.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   4.88014084e-01,   1.47451495e-17,
+            6.19859160e-02,  -4.16333634e-17,   6.93889390e-18,
+            7.47852752e-01,  -2.97852752e-01,  -3.40873163e-16,
+            7.45931095e-17,   7.97972799e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -6.25000000e-02,   6.07153217e-17,
+           -6.25000000e-02,  -2.01227923e-16,   1.11022302e-16,
+            5.62500000e-01,   5.62500000e-01,  -2.09901541e-16,
+            4.33680869e-17,  -1.59594560e-16,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-            1.38777878e-17,   0.00000000e+00,   0.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   6.19859160e-02,   7.63278329e-17,
+            4.88014084e-01,  -1.38777878e-16,   0.00000000e+00,
+           -2.97852752e-01,   7.47852752e-01,  -7.63278329e-17,
+            2.77555756e-17,  -2.22044605e-16,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -8.72983346e-02,
-            6.87298335e-01,   0.00000000e+00,   0.00000000e+00,
-           -5.55111512e-17,   4.00000000e-01]]), 'FE2_f1_C0': array([[  4.88014084e-01,   1.47451495e-17,   6.19859160e-02,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C0': array([[  4.88014084e-01,   1.47451495e-17,   6.19859160e-02,
            -4.16333634e-17,   6.93889390e-18,   7.47852752e-01,
            -2.97852752e-01,  -3.40873163e-16,   7.45931095e-17,
             7.97972799e-17,   0.00000000e+00,   0.00000000e+00,
@@ -6619,87 +6734,72 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]])}
+  
+  tables: {'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
+         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
+         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE0_f1': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
+         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
+         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE0_f2': array([[ 0.88729833,  0.11270167,  0.        ],
+         [ 0.5       ,  0.5       ,  0.        ],
+         [ 0.11270167,  0.88729833,  0.        ]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   4.88014084e-01,   1.47451495e-17,
-            6.19859160e-02,  -4.16333634e-17,   6.93889390e-18,
-            7.47852752e-01,  -2.97852752e-01,  -3.40873163e-16,
-            7.45931095e-17,   7.97972799e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   6.87298335e-01,
+           -8.72983346e-02,   0.00000000e+00,   0.00000000e+00,
+           -2.77555756e-17,   4.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -6.25000000e-02,   6.07153217e-17,
-           -6.25000000e-02,  -2.01227923e-16,   1.11022302e-16,
-            5.62500000e-01,   5.62500000e-01,  -2.09901541e-16,
-            4.33680869e-17,  -1.59594560e-16,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   6.19859160e-02,   7.63278329e-17,
-            4.88014084e-01,  -1.38777878e-16,   0.00000000e+00,
-           -2.97852752e-01,   7.47852752e-01,  -7.63278329e-17,
-            2.77555756e-17,  -2.22044605e-16,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+            1.38777878e-17,   0.00000000e+00,   0.00000000e+00,
+           -5.55111512e-17,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -8.72983346e-02,
+            6.87298335e-01,   0.00000000e+00,   0.00000000e+00,
+           -5.55111512e-17,   4.00000000e-01]]), 'FE1_f2_C0': array([[  4.88014084e-01,   6.19859160e-02,   0.00000000e+00,
+           -1.11022302e-16,   2.77555756e-17,  -1.38777878e-16,
+            0.00000000e+00,   7.47852752e-01,  -2.97852752e-01,
+            1.66533454e-16,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.87298335e-01,
-            9.36750677e-17,  -8.72983346e-02,  -2.77555756e-17,
-            4.00000000e-01,  -1.23165367e-16],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -6.25000000e-02,  -6.25000000e-02,   0.00000000e+00,
+           -1.38777878e-16,   8.32667268e-17,   0.00000000e+00,
+            5.55111512e-17,   5.62500000e-01,   5.62500000e-01,
+            5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   8.32667268e-17,
-            8.32667268e-17,   8.32667268e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  6.19859160e-02,   4.88014084e-01,   2.77555756e-17,
+           -1.94289029e-16,   0.00000000e+00,  -2.77555756e-17,
+            5.55111512e-17,  -2.97852752e-01,   7.47852752e-01,
+           -5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -8.72983346e-02,
-            9.71445147e-17,   6.87298335e-01,   0.00000000e+00,
-            4.00000000e-01,  -6.93889390e-17]]), 'FE1_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE1_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
-  
-  tables: {'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
-         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
-         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE0_f1': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
-         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
-         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE0_f2': array([[ 0.88729833,  0.11270167,  0.        ],
-         [ 0.5       ,  0.5       ,  0.        ],
-         [ 0.11270167,  0.88729833,  0.        ]]), 'FE1_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   4.88014084e-01,   6.19859160e-02,
@@ -6725,43 +6825,55 @@ Compiler stage 2: Computing intermediate representation
            -2.77555756e-17,   5.55111512e-17,  -2.97852752e-01,
             7.47852752e-01,  -5.55111512e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.5       ,  0.5       ,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.11270167,  0.88729833,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE1_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
-           0.        ]]), 'FE2_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.        ]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f0_C0': array([[  4.16333634e-17,   4.88014084e-01,   6.19859160e-02,
+            7.47852752e-01,  -2.97852752e-01,   1.42247325e-16,
+           -1.11022302e-16,   1.96891115e-16,  -1.26634814e-16,
+            4.51028104e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   1.12757026e-16,
-            6.87298335e-01,  -8.72983346e-02,   4.00000000e-01,
-           -4.85722573e-17,  -1.23165367e-16],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  2.08166817e-17,  -6.25000000e-02,  -6.25000000e-02,
+            5.62500000e-01,   5.62500000e-01,   9.71445147e-17,
+           -9.71445147e-17,   6.76542156e-17,  -1.90819582e-17,
+           -3.46944695e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-           -9.71445147e-17,   8.32667268e-17,   1.00000000e+00,
-            1.38777878e-17,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  1.38777878e-17,   6.19859160e-02,   4.88014084e-01,
+           -2.97852752e-01,   7.47852752e-01,  -1.11022302e-16,
+           -5.55111512e-17,  -5.55111512e-17,   7.63278329e-17,
+           -5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-           -8.72983346e-02,   6.87298335e-01,   4.00000000e-01,
-            5.55111512e-17,  -6.93889390e-17]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   4.16333634e-17,   4.88014084e-01,
@@ -6787,90 +6899,67 @@ Compiler stage 2: Computing intermediate representation
            -1.11022302e-16,  -5.55111512e-17,  -5.55111512e-17,
             7.63278329e-17,  -5.55111512e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  4.16333634e-17,   4.88014084e-01,   6.19859160e-02,
-            7.47852752e-01,  -2.97852752e-01,   1.42247325e-16,
-           -1.11022302e-16,   1.96891115e-16,  -1.26634814e-16,
-            4.51028104e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  2.08166817e-17,  -6.25000000e-02,  -6.25000000e-02,
-            5.62500000e-01,   5.62500000e-01,   9.71445147e-17,
-           -9.71445147e-17,   6.76542156e-17,  -1.90819582e-17,
-           -3.46944695e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   1.12757026e-16,
+            6.87298335e-01,  -8.72983346e-02,   4.00000000e-01,
+           -4.85722573e-17,  -1.23165367e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  1.38777878e-17,   6.19859160e-02,   4.88014084e-01,
-           -2.97852752e-01,   7.47852752e-01,  -1.11022302e-16,
-           -5.55111512e-17,  -5.55111512e-17,   7.63278329e-17,
-           -5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+           -9.71445147e-17,   8.32667268e-17,   1.00000000e+00,
+            1.38777878e-17,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
+           -8.72983346e-02,   6.87298335e-01,   4.00000000e-01,
+            5.55111512e-17,  -6.93889390e-17]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
+           0.        ]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
+         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
+         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
+            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE1_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f2_C0': array([[  4.88014084e-01,   6.19859160e-02,   0.00000000e+00,
-           -1.11022302e-16,   2.77555756e-17,  -1.38777878e-16,
-            0.00000000e+00,   7.47852752e-01,  -2.97852752e-01,
-            1.66533454e-16,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -6.25000000e-02,  -6.25000000e-02,   0.00000000e+00,
-           -1.38777878e-16,   8.32667268e-17,   0.00000000e+00,
-            5.55111512e-17,   5.62500000e-01,   5.62500000e-01,
-            5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  6.19859160e-02,   4.88014084e-01,   2.77555756e-17,
-           -1.94289029e-16,   0.00000000e+00,  -2.77555756e-17,
-            5.55111512e-17,  -2.97852752e-01,   7.47852752e-01,
-           -5.55111512e-17,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE1_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   6.87298335e-01,
-           -8.72983346e-02,   0.00000000e+00,   0.00000000e+00,
-           -2.77555756e-17,   4.00000000e-01],
+            9.36750677e-17,  -8.72983346e-02,  -2.77555756e-17,
+            4.00000000e-01,  -1.23165367e-16],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   4.16333634e-17,
-            1.38777878e-17,   0.00000000e+00,   0.00000000e+00,
-           -5.55111512e-17,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   8.32667268e-17,
+            8.32667268e-17,   8.32667268e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -6878,34 +6967,8 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -8.72983346e-02,
-            6.87298335e-01,   0.00000000e+00,   0.00000000e+00,
-           -5.55111512e-17,   4.00000000e-01]]), 'FE2_f1_C0': array([[  4.88014084e-01,   1.47451495e-17,   6.19859160e-02,
-           -4.16333634e-17,   6.93889390e-18,   7.47852752e-01,
-           -2.97852752e-01,  -3.40873163e-16,   7.45931095e-17,
-            7.97972799e-17,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [ -6.25000000e-02,   6.07153217e-17,  -6.25000000e-02,
-           -2.01227923e-16,   1.11022302e-16,   5.62500000e-01,
-            5.62500000e-01,  -2.09901541e-16,   4.33680869e-17,
-           -1.59594560e-16,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00],
-         [  6.19859160e-02,   7.63278329e-17,   4.88014084e-01,
-           -1.38777878e-16,   0.00000000e+00,  -2.97852752e-01,
-            7.47852752e-01,  -7.63278329e-17,   2.77555756e-17,
-           -2.22044605e-16,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.71445147e-17,   6.87298335e-01,   0.00000000e+00,
+            4.00000000e-01,  -6.93889390e-17]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   4.88014084e-01,   1.47451495e-17,
@@ -6931,66 +6994,51 @@ Compiler stage 2: Computing intermediate representation
            -2.97852752e-01,   7.47852752e-01,  -7.63278329e-17,
             2.77555756e-17,  -2.22044605e-16,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C0': array([[  4.88014084e-01,   1.47451495e-17,   6.19859160e-02,
+           -4.16333634e-17,   6.93889390e-18,   7.47852752e-01,
+           -2.97852752e-01,  -3.40873163e-16,   7.45931095e-17,
+            7.97972799e-17,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.87298335e-01,
-            9.36750677e-17,  -8.72983346e-02,  -2.77555756e-17,
-            4.00000000e-01,  -1.23165367e-16],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [ -6.25000000e-02,   6.07153217e-17,  -6.25000000e-02,
+           -2.01227923e-16,   1.11022302e-16,   5.62500000e-01,
+            5.62500000e-01,  -2.09901541e-16,   4.33680869e-17,
+           -1.59594560e-16,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   8.32667268e-17,
-            8.32667268e-17,   8.32667268e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00],
+         [  6.19859160e-02,   7.63278329e-17,   4.88014084e-01,
+           -1.38777878e-16,   0.00000000e+00,  -2.97852752e-01,
+            7.47852752e-01,  -7.63278329e-17,   2.77555756e-17,
+           -2.22044605e-16,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -8.72983346e-02,
-            9.71445147e-17,   6.87298335e-01,   0.00000000e+00,
-            4.00000000e-01,  -6.93889390e-17]]), 'FE1_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE1_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+            0.00000000e+00,   0.00000000e+00]])}
   
-  name_map: {'FE1_f0_C1_D10': ['FE1_f1_C1_D10', 'FE1_f2_C1_D10'], 'FE1_f0_C0_D01': ['FE1_f1_C0_D01', 'FE1_f2_C0_D01'], 'FE1_f0_C1_D01': ['FE1_f1_C1_D01', 'FE1_f2_C1_D01'], 'FE1_f0_C0_D10': ['FE1_f1_C0_D10', 'FE1_f2_C0_D10']}
+  name_map: {'FE2_f0_C0_D10': ['FE2_f1_C0_D10', 'FE2_f2_C0_D10'], 'FE2_f0_C1_D01': ['FE2_f1_C1_D01', 'FE2_f2_C1_D01'], 'FE2_f0_C0_D01': ['FE2_f1_C0_D01', 'FE2_f2_C0_D01'], 'FE2_f0_C1_D10': ['FE2_f1_C1_D10', 'FE2_f2_C1_D10']}
   
-  inv_name_map: {'FE0_f0': 'FE0_f0', 'FE1_f1_C0_D10': 'FE1_f0_C0_D10', 'FE0_f2': 'FE0_f2', 'FE1_f0_C1_D01': 'FE1_f0_C1_D01', 'FE1_f2_C1_D01': 'FE1_f0_C1_D01', 'FE1_f1_C1_D10': 'FE1_f0_C1_D10', 'FE1_f2_C0_D10': 'FE1_f0_C0_D10', 'FE1_f2_C0': 'FE1_f2_C0', 'FE1_f2_C1': 'FE1_f2_C1', 'FE2_f0_C2': 'FE2_f0_C2', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0': 'FE2_f0_C0', 'FE1_f2_C0_D01': 'FE1_f0_C0_D01', 'FE0_f1': 'FE0_f1', 'FE1_f0_C0_D10': 'FE1_f0_C0_D10', 'FE1_f1_C0_D01': 'FE1_f0_C0_D01', 'FE1_f0_C0':  [...]
+  inv_name_map: {'FE2_f1_C1_D01': 'FE2_f0_C1_D01', 'FE2_f2_C0_D10': 'FE2_f0_C0_D10', 'FE0_f0': 'FE0_f0', 'FE0_f1': 'FE0_f1', 'FE0_f2': 'FE0_f2', 'FE2_f0_C1_D01': 'FE2_f0_C1_D01', 'FE1_f2_C2': 'FE1_f2_C2', 'FE1_f2_C0': 'FE1_f2_C0', 'FE1_f2_C1': 'FE1_f2_C1', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0_D01': 'FE2_f0_C0_D01', 'FE2_f0_C0': 'FE2_f0_C0', 'FE2_f2_C1_D01': 'FE2_f0_C1_D01', 'FE2_f1_C0_D10': 'FE2_f0_C0_D10', 'FE2_f0_C0_D10': 'FE2_f0_C0_D10', 'FE2_f2_C0_D01': 'FE2_f0_C0_D01', 'FE2_f0_C1_D1 [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_f0': array([[ 0.88729833,  0.11270167],
          [ 0.5       ,  0.5       ],
-         [ 0.11270167,  0.88729833]]), 'FE2_f0_C2': array([[ 0.68729833, -0.08729833,  0.4       ],
-         [ 0.        ,  0.        ,  1.        ],
-         [-0.08729833,  0.68729833,  0.4       ]]), 'FE2_f0_C0': array([[ 0.48801408,  0.06198592,  0.74785275, -0.29785275],
-         [-0.0625    , -0.0625    ,  0.5625    ,  0.5625    ],
-         [ 0.06198592,  0.48801408, -0.29785275,  0.74785275]]), 'FE1_f0_C0_D01': array([[-1.,  1.],
+         [ 0.11270167,  0.88729833]]), 'FE2_f0_C0_D01': array([[-1.,  1.],
          [-1.,  1.],
-         [-1.,  1.]])}
+         [-1.,  1.]]), 'FE1_f0_C0': array([[ 0.48801408,  0.06198592,  0.74785275, -0.29785275],
+         [-0.0625    , -0.0625    ,  0.5625    ,  0.5625    ],
+         [ 0.06198592,  0.48801408, -0.29785275,  0.74785275]]), 'FE1_f0_C2': array([[ 0.68729833, -0.08729833,  0.4       ],
+         [ 0.        ,  0.        ,  1.        ],
+         [-0.08729833,  0.68729833,  0.4       ]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_f0': ('FE0_f0', (0, [1, 2]), False, False), 'FE1_f1_C0_D10': ('FE1_f0_C0_D01', (5, [0, 1]), False, False), 'FE0_f2': ('FE0_f0', (2, [0, 1]), False, False), 'FE1_f0_C1_D01': ('FE1_f0_C0_D01', (7, [3, 5]), False, False), 'FE1_f2_C1_D01': ('FE1_f0_C0_D01', (7, [3, 5]), False, False), 'FE1_f1_C1_D10': ('FE1_f0_C0_D01', (8, [3, 4]), False, False), 'FE1_f2_C0_D10': ('FE1_f0_C0_D01', (5, [0, 1]), False, False), 'FE1_f2_C0': ('FE0_f0', (11, [0, 1]), False, False), 'FE1_f2_C1': ('FE0_f0', [...]
+  {'FE2_f1_C1_D01': ('FE2_f0_C0_D01', (16, [3, 5]), False, False), 'FE2_f2_C0_D10': ('FE2_f0_C0_D01', (14, [0, 1]), False, False), 'FE0_f0': ('FE0_f0', (0, [1, 2]), False, False), 'FE0_f1': ('FE0_f0', (1, [0, 2]), False, False), 'FE0_f2': ('FE0_f0', (2, [0, 1]), False, False), 'FE2_f0_C1_D01': ('FE2_f0_C0_D01', (16, [3, 5]), False, False), 'FE1_f2_C2': ('FE1_f0_C2', (11, [20, 21, 25]), False, False), 'FE1_f2_C0': ('FE1_f0_C0', (9, [0, 1, 7, 8]), False, False), 'FE1_f2_C1': ('FE1_f0_C0',  [...]
   Transforming exterior facet integral 0
   Reusing element from cache
   Reusing element from cache
@@ -7030,7 +7078,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00354 seconds
+  225 entries computed in 0.00317 seconds
   Shape of reference tensor: (15, 15, 1)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [1] indices = [[0]]
@@ -7039,6 +7087,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
@@ -7051,222 +7100,18 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {25: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-           1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.91514755,  0.76436533,  0.53566054,  0.29024993,  0.0939128 ,
-            0.73861153,  0.61691587,  0.43232925,  0.23425943,  0.0757966 ,
-            0.48009507,  0.40099329,  0.28101259,  0.15226786,  0.04926754,
-            0.22157861,  0.18507071,  0.12969594,  0.07027629,  0.02273848,
-            0.04504259,  0.03762125,  0.02636464,  0.01428579,  0.00462229],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.04504259,  0.03762125,  0.02636464,  0.01428579,  0.00462229,
-            0.22157861,  0.18507071,  0.12969594,  0.07027629,  0.02273848,
-            0.48009507,  0.40099329,  0.28101259,  0.15226786,  0.04926754,
-            0.73861153,  0.61691587,  0.43232925,  0.23425943,  0.0757966 ,
-            0.91514755,  0.76436533,  0.53566054,  0.29024993,  0.0939128 ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
-            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
-            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
-            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
-            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-          [ 0.91514755,  0.76436533,  0.53566054,  0.29024993,  0.0939128 ,
-            0.73861153,  0.61691587,  0.43232925,  0.23425943,  0.0757966 ,
-            0.48009507,  0.40099329,  0.28101259,  0.15226786,  0.04926754,
-            0.22157861,  0.18507071,  0.12969594,  0.07027629,  0.02273848,
-            0.04504259,  0.03762125,  0.02636464,  0.01428579,  0.00462229]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-          [ 0.04504259,  0.03762125,  0.02636464,  0.01428579,  0.00462229,
-            0.22157861,  0.18507071,  0.12969594,  0.07027629,  0.02273848,
-            0.48009507,  0.40099329,  0.28101259,  0.15226786,  0.04926754,
-            0.73861153,  0.61691587,  0.43232925,  0.23425943,  0.0757966 ,
-            0.91514755,  0.76436533,  0.53566054,  0.29024993,  0.0939128 ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-          [ 0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
-            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
-            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
-            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
-            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491]]])}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): array([[[ -2.66059020e+00,  -2.05746132e+00,  -1.14264218e+00, ...,
+  {25: {MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): array([[[ -2.66059020e+00,  -2.05746132e+00,  -1.14264218e+00, ...,
              8.94541420e-01,   9.42856822e-01,   9.81510846e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00, ...,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00, ...,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  5.44009282e-15,   5.82867088e-15,   6.61970478e-15, ...,
-             8.66667849e-15,   8.27116153e-15,   8.32667268e-15],
+         [[  4.77395901e-15,   5.66213743e-15,   6.45317133e-15, ...,
+             8.66667849e-15,   7.99360578e-15,   7.10542736e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00, ...,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00, ...,
@@ -7381,15 +7226,16 @@ Compiler stage 2: Computing intermediate representation
           [ 0.        ,  0.        ,  0.        , ...,  0.        ,
             0.        ,  0.        ],
           [ 0.03980986,  0.19801342,  0.43797481, ...,  0.43797481,
-            0.69546427,  0.90146491]]])}}}, MixedElement(*[MixedElement(*[FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None)], **{'value_shape': (2,) }), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1 [...]
+            0.69546427,  0.90146491]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+           1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]])}}}, MixedElement(VectorElement(FiniteElement('Discontinuous Lagrange', triangle, 2), dim=2), FiniteElement('Discontinuous Lagrange', triangle, 1)): {None: {None: {(0, 1): array([[[ -2.66059020e+00,  -2.05746132e+00,  -1.14264218e+00, ...,
              8.94541420e-01,   9.42856822e-01,   9.81510846e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00, ...,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00, ...,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
-         [[  5.44009282e-15,   5.82867088e-15,   6.61970478e-15, ...,
-             8.66667849e-15,   8.27116153e-15,   8.32667268e-15],
+         [[  4.77395901e-15,   5.66213743e-15,   6.45317133e-15, ...,
+             8.66667849e-15,   7.99360578e-15,   7.10542736e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00, ...,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00, ...,
@@ -7504,15 +7350,15 @@ Compiler stage 2: Computing intermediate representation
           [ 0.        ,  0.        ,  0.        , ...,  0.        ,
             0.        ,  0.        ],
           [ 0.03980986,  0.19801342,  0.43797481, ...,  0.43797481,
-            0.69546427,  0.90146491]]])}}}, FiniteElement('Bubble', Domain(Cell('triangle', 2), label=None, data=None), 3, quad_scheme=None): {None: {None: {(0, 1): array([[ 1.06454196,  0.57528544,  0.06953714, -0.15629784, -0.10078395,
+            0.69546427,  0.90146491]]])}}}, FiniteElement('Bubble', triangle, 3): {None: {None: {(0, 1): array([[ 1.06454196,  0.57528544,  0.06953714, -0.15629784, -0.10078395,
            4.1806666 ,  2.09321752, -0.01976956, -0.87511768, -0.50691001,
            5.70722656,  2.19762632, -1.1909257 , -2.23320663, -1.1336131 ,
            3.62492542, -0.21558317, -3.59850533, -3.95431694, -1.79832091,
            0.1292956 , -3.31015168, -5.95304979, -5.3382242 , -2.27407499]]), (1, 0): array([[  9.35246356e-01,   3.88543712e+00,   6.02258693e+00,
             5.18192636e+00,   2.17329104e+00,   5.55741183e-01,
             2.30880068e+00,   3.57873577e+00,   3.07919926e+00,
-            1.29141090e+00,  -6.56553795e-16,  -2.70598676e-15,
-           -2.99077992e-16,  -2.38900442e-15,  -1.59987078e-14,
+            1.29141090e+00,  -2.27067044e-15,  -2.41579066e-15,
+           -5.59655100e-16,  -2.50001051e-15,  -1.11583099e-14,
            -5.55741183e-01,  -2.30880068e+00,  -3.57873577e+00,
            -3.07919926e+00,  -1.29141090e+00,  -9.35246356e-01,
            -3.88543712e+00,  -6.02258693e+00,  -5.18192636e+00,
@@ -7520,86 +7366,290 @@ Compiler stage 2: Computing intermediate representation
            0.17591315,  0.61041053,  0.66306162,  0.30913239,  0.04194921,
            0.24774727,  0.85967164,  0.93382279,  0.43536659,  0.05907917,
            0.17591315,  0.61041053,  0.66306162,  0.30913239,  0.04194921,
-           0.04430665,  0.15374203,  0.16700308,  0.07786013,  0.01056561]])}}}}}
+           0.04430665,  0.15374203,  0.16700308,  0.07786013,  0.01056561]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
   
-  QG-utils, psi_tables, flat_tables:
-  {'FE0_D10': array([[  9.35246356e-01],
-         [  3.88543712e+00],
-         [  6.02258693e+00],
-         [  5.18192636e+00],
-         [  2.17329104e+00],
-         [  5.55741183e-01],
-         [  2.30880068e+00],
-         [  3.57873577e+00],
-         [  3.07919926e+00],
-         [  1.29141090e+00],
-         [ -6.56553795e-16],
-         [ -2.70598676e-15],
-         [ -2.99077992e-16],
-         [ -2.38900442e-15],
-         [ -1.59987078e-14],
-         [ -5.55741183e-01],
-         [ -2.30880068e+00],
-         [ -3.57873577e+00],
-         [ -3.07919926e+00],
-         [ -1.29141090e+00],
-         [ -9.35246356e-01],
-         [ -3.88543712e+00],
-         [ -6.02258693e+00],
-         [ -5.18192636e+00],
-         [ -2.17329104e+00]]), 'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.66059020e+00,   5.44009282e-15,  -8.40760572e-01,
-            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.05746132e+00,   5.82867088e-15,  -2.07946329e-01,
-            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.14264218e+00,   6.61970478e-15,   7.51899241e-01,
-            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.60999729e-01,   7.43849426e-15,   1.78185709e+00,
-            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.91514755,  0.76436533,  0.53566054,  0.29024993,  0.0939128 ,
+            0.73861153,  0.61691587,  0.43232925,  0.23425943,  0.0757966 ,
+            0.48009507,  0.40099329,  0.28101259,  0.15226786,  0.04926754,
+            0.22157861,  0.18507071,  0.12969594,  0.07027629,  0.02273848,
+            0.04504259,  0.03762125,  0.02636464,  0.01428579,  0.00462229],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.04504259,  0.03762125,  0.02636464,  0.01428579,  0.00462229,
+            0.22157861,  0.18507071,  0.12969594,  0.07027629,  0.02273848,
+            0.48009507,  0.40099329,  0.28101259,  0.15226786,  0.04926754,
+            0.73861153,  0.61691587,  0.43232925,  0.23425943,  0.0757966 ,
+            0.91514755,  0.76436533,  0.53566054,  0.29024993,  0.0939128 ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
+            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
+            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
+            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
+            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+          [ 0.91514755,  0.76436533,  0.53566054,  0.29024993,  0.0939128 ,
+            0.73861153,  0.61691587,  0.43232925,  0.23425943,  0.0757966 ,
+            0.48009507,  0.40099329,  0.28101259,  0.15226786,  0.04926754,
+            0.22157861,  0.18507071,  0.12969594,  0.07027629,  0.02273848,
+            0.04504259,  0.03762125,  0.02636464,  0.01428579,  0.00462229]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+          [ 0.04504259,  0.03762125,  0.02636464,  0.01428579,  0.00462229,
+            0.22157861,  0.18507071,  0.12969594,  0.07027629,  0.02273848,
+            0.48009507,  0.40099329,  0.28101259,  0.15226786,  0.04926754,
+            0.73861153,  0.61691587,  0.43232925,  0.23425943,  0.0757966 ,
+            0.91514755,  0.76436533,  0.53566054,  0.29024993,  0.0939128 ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+          [ 0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
+            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
+            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
+            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491,
+            0.03980986,  0.19801342,  0.43797481,  0.69546427,  0.90146491]]])}}}}}
+  
+  QG-utils, psi_tables, flat_tables:
+  {'FE0_D10': array([[  9.35246356e-01],
+         [  3.88543712e+00],
+         [  6.02258693e+00],
+         [  5.18192636e+00],
+         [  2.17329104e+00],
+         [  5.55741183e-01],
+         [  2.30880068e+00],
+         [  3.57873577e+00],
+         [  3.07919926e+00],
+         [  1.29141090e+00],
+         [ -2.27067044e-15],
+         [ -2.41579066e-15],
+         [ -5.59655100e-16],
+         [ -2.50001051e-15],
+         [ -1.11583099e-14],
+         [ -5.55741183e-01],
+         [ -2.30880068e+00],
+         [ -3.57873577e+00],
+         [ -3.07919926e+00],
+         [ -1.29141090e+00],
+         [ -9.35246356e-01],
+         [ -3.88543712e+00],
+         [ -6.02258693e+00],
+         [ -5.18192636e+00],
+         [ -2.17329104e+00]]), 'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
+            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
+            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
+            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
+            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.24348811e-01,   8.10462808e-15,   2.60585966e+00,
+            6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
             1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.95444613e+00,   5.88418203e-15,  -8.40760572e-01,
+           -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
             8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.46766349e+00,   6.43929354e-15,  -2.07946329e-01,
+           -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
             7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -7.29317012e-01,   6.98746616e-15,   7.51899241e-01,
+           -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
             5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.29622614e-02,   7.54951657e-15,   1.78185709e+00,
+            6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
             2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.96813589e-01,   8.21565038e-15,   2.60585966e+00,
+            6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
             9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -9.20380286e-01,   6.99440506e-15,  -8.40760572e-01,
+           -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
             1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -7609,52 +7659,52 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.24050380e-01,   7.55645546e-15,   7.51899241e-01,
+           -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
             1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.90928547e-01,   7.88258347e-15,   1.78185709e+00,
+            3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
             6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.02929828e-01,   8.32667268e-15,   2.60585966e+00,
+            8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
             1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.13685562e-01,   8.16013923e-15,  -8.40760572e-01,
+            1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
             2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.59717159e-01,   8.32667268e-15,  -2.07946329e-01,
+            2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
             2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.81216253e-01,   7.99360578e-15,   7.51899241e-01,
+            4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
             1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.18894832e-01,   8.21565038e-15,   1.78185709e+00,
+            7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
             9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.09046068e-01,   8.43769499e-15,   2.60585966e+00,
+            9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
             3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.19829626e-01,   9.21485110e-15,  -8.40760572e-01,
+            8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
             3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.49514991e-01,   8.60422844e-15,  -2.07946329e-01,
+            8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
             3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -7664,14 +7714,14 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.42856822e-01,   8.27116153e-15,   1.78185709e+00,
+            9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
             1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.81510846e-01,   8.32667268e-15,   2.60585966e+00,
+            9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
             3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
             1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
@@ -7724,27 +7774,27 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,   3.01839136e-16,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,  -3.21103098e-16,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,  -2.28343072e-16,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,   7.26320131e-16,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,   2.30511706e-15,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -7795,7 +7845,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             9.81510846e-01,  -6.24348811e-01,   0.00000000e+00,
             3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
             1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
@@ -7848,27 +7898,27 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,   3.01839136e-16,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,  -3.21103098e-16,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,  -2.28343072e-16,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,   7.26320131e-16,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,   2.30511706e-15,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -7919,205 +7969,106 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             9.81510846e-01,  -6.24348811e-01,   0.00000000e+00,
             3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_C0_D10': array([[ -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.05746132e+00,  -8.49514991e-01,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,   2.90697631e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.14264218e+00,  -8.94541420e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,   2.03718360e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.60999729e-01,  -9.42856822e-01,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,   1.10385655e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.24348811e-01,  -9.81510846e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,   3.57162035e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.95444613e+00,  -1.13685562e-01,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,   2.06813170e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.46766349e+00,  -2.59717159e-01,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,   1.72738065e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -7.29317012e-01,  -4.81216253e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,   1.21053326e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.29622614e-02,  -7.18894832e-01,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,   6.55932571e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.96813589e-01,  -9.09046068e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,   2.12232479e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,   3.01839136e-16,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,  -3.21103098e-16,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,  -2.28343072e-16,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,   7.26320131e-16,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,   2.30511706e-15,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.13685562e-01,   1.95444613e+00,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,  -2.06813170e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.59717159e-01,   1.46766349e+00,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,  -1.72738065e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.81216253e-01,   7.29317012e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,  -1.21053326e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.18894832e-01,  -6.29622614e-02,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,  -6.55932571e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.09046068e-01,  -6.96813589e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,  -2.12232479e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.19829626e-01,   2.66059020e+00,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,  -3.48041982e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.49514991e-01,   2.05746132e+00,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,  -2.90697631e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.94541420e-01,   1.14264218e+00,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,  -2.03718360e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.42856822e-01,   1.60999729e-01,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,  -1.10385655e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.81510846e-01,  -6.24348811e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D01': array([[ -2.66059020e+00,   5.44009282e-15,  -8.40760572e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.]]), 'FE2_C0_D01': array([[ -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
             1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.05746132e+00,   5.82867088e-15,  -2.07946329e-01,
+         [ -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
             1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.14264218e+00,   6.61970478e-15,   7.51899241e-01,
+         [ -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
             1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.60999729e-01,   7.43849426e-15,   1.78185709e+00,
+         [ -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
             5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.24348811e-01,   8.10462808e-15,   2.60585966e+00,
+         [  6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
             1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.95444613e+00,   5.88418203e-15,  -8.40760572e-01,
+         [ -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
             8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.46766349e+00,   6.43929354e-15,  -2.07946329e-01,
+         [ -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
             7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -7.29317012e-01,   6.98746616e-15,   7.51899241e-01,
+         [ -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
             5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.29622614e-02,   7.54951657e-15,   1.78185709e+00,
+         [  6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
             2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.96813589e-01,   8.21565038e-15,   2.60585966e+00,
+         [  6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
             9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -9.20380286e-01,   6.99440506e-15,  -8.40760572e-01,
+         [ -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
             1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -8127,52 +8078,52 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.24050380e-01,   7.55645546e-15,   7.51899241e-01,
+         [ -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
             1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.90928547e-01,   7.88258347e-15,   1.78185709e+00,
+         [  3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
             6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.02929828e-01,   8.32667268e-15,   2.60585966e+00,
+         [  8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
             1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.13685562e-01,   8.16013923e-15,  -8.40760572e-01,
+         [  1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
             2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.59717159e-01,   8.32667268e-15,  -2.07946329e-01,
+         [  2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
             2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.81216253e-01,   7.99360578e-15,   7.51899241e-01,
+         [  4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
             1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.18894832e-01,   8.21565038e-15,   1.78185709e+00,
+         [  7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
             9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.09046068e-01,   8.43769499e-15,   2.60585966e+00,
+         [  9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
             3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.19829626e-01,   9.21485110e-15,  -8.40760572e-01,
+         [  8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
             3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.49514991e-01,   8.60422844e-15,  -2.07946329e-01,
+         [  8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
             3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -8182,16 +8133,65 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.42856822e-01,   8.27116153e-15,   1.78185709e+00,
+         [  9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
             1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.81510846e-01,   8.32667268e-15,   2.60585966e+00,
+         [  9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
             3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.75984252, -0.04098492, -0.03664021,  0.00717256,
            0.14572757,  0.16488248,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -8339,31 +8339,7 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
            0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE4': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.91514755,  0.04504259,  0.03980986],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -8437,7 +8413,31 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.01428579,  0.29024993,  0.69546427],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.00462229,  0.0939128 ,  0.90146491]]), 'FE0': array([[ 0.04430665],
+           0.        ,  0.        ,  0.00462229,  0.0939128 ,  0.90146491]]), 'FE3': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE0': array([[ 0.04430665],
          [ 0.15374203],
          [ 0.16700308],
          [ 0.07786013],
@@ -8461,9 +8461,133 @@ Compiler stage 2: Computing intermediate representation
          [ 0.15374203],
          [ 0.16700308],
          [ 0.07786013],
-         [ 0.01056561]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [ 0.01056561]]), 'FE1_C0_D01': array([[ -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
+            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
+            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
+            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
+            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
+            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
+            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
+            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
+            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
+            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
+            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
+            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
+            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
+            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
+            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
+            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
+            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
+            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
+            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
+            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
+            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
+            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
+            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
+            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
+            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
+            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -8534,59 +8658,108 @@ Compiler stage 2: Computing intermediate representation
          [-3.31015168],
          [-5.95304979],
          [-5.3382242 ],
-         [-2.27407499]]), 'FE3_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [-2.27407499]]), 'FE4_C0': array([[ 0.91514755,  0.04504259,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.76436533,  0.03762125,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.53566054,  0.02636464,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.29024993,  0.01428579,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.0939128 ,  0.00462229,  0.90146491,  0.        ,  0.        ,
+           0.        ],
+         [ 0.73861153,  0.22157861,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.61691587,  0.18507071,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.43232925,  0.12969594,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.23425943,  0.07027629,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.0757966 ,  0.02273848,  0.90146491,  0.        ,  0.        ,
+           0.        ],
+         [ 0.48009507,  0.48009507,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.40099329,  0.40099329,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.28101259,  0.28101259,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.15226786,  0.15226786,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.04926754,  0.04926754,  0.90146491,  0.        ,  0.        ,
+           0.        ],
+         [ 0.22157861,  0.73861153,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.18507071,  0.61691587,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.12969594,  0.43232925,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.07027629,  0.23425943,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.02273848,  0.0757966 ,  0.90146491,  0.        ,  0.        ,
+           0.        ],
+         [ 0.04504259,  0.91514755,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.03762125,  0.76436533,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.02636464,  0.53566054,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.01428579,  0.29024993,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.00462229,  0.0939128 ,  0.90146491,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.66059020e+00,   5.44009282e-15,  -8.40760572e-01,
+           -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
             1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.05746132e+00,   5.82867088e-15,  -2.07946329e-01,
+           -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
             1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.14264218e+00,   6.61970478e-15,   7.51899241e-01,
+           -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
             1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.60999729e-01,   7.43849426e-15,   1.78185709e+00,
+           -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
             5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.24348811e-01,   8.10462808e-15,   2.60585966e+00,
+            6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
             1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.95444613e+00,   5.88418203e-15,  -8.40760572e-01,
+           -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
             8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.46766349e+00,   6.43929354e-15,  -2.07946329e-01,
+           -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
             7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -7.29317012e-01,   6.98746616e-15,   7.51899241e-01,
+           -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
             5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.29622614e-02,   7.54951657e-15,   1.78185709e+00,
+            6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
             2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.96813589e-01,   8.21565038e-15,   2.60585966e+00,
+            6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
             9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -9.20380286e-01,   6.99440506e-15,  -8.40760572e-01,
+           -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
             1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -8596,52 +8769,52 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.24050380e-01,   7.55645546e-15,   7.51899241e-01,
+           -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
             1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.90928547e-01,   7.88258347e-15,   1.78185709e+00,
+            3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
             6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.02929828e-01,   8.32667268e-15,   2.60585966e+00,
+            8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
             1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.13685562e-01,   8.16013923e-15,  -8.40760572e-01,
+            1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
             2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.59717159e-01,   8.32667268e-15,  -2.07946329e-01,
+            2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
             2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.81216253e-01,   7.99360578e-15,   7.51899241e-01,
+            4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
             1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.18894832e-01,   8.21565038e-15,   1.78185709e+00,
+            7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
             9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.09046068e-01,   8.43769499e-15,   2.60585966e+00,
+            9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
             3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.19829626e-01,   9.21485110e-15,  -8.40760572e-01,
+            8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
             3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.49514991e-01,   8.60422844e-15,  -2.07946329e-01,
+            8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
             3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -8651,63 +8824,63 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.42856822e-01,   8.27116153e-15,   1.78185709e+00,
+            9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
             1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.81510846e-01,   8.32667268e-15,   2.60585966e+00,
+            9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
             3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C1': array([[ 0.        ,  0.        ,  0.        ,  0.91514755,  0.04504259,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.76436533,  0.03762125,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.53566054,  0.02636464,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.29024993,  0.01428579,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.0939128 ,  0.00462229,
+           0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.73861153,  0.22157861,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.61691587,  0.18507071,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.43232925,  0.12969594,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.23425943,  0.07027629,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.0757966 ,  0.02273848,
+           0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.48009507,  0.48009507,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.40099329,  0.40099329,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.28101259,  0.28101259,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.15226786,  0.15226786,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.04926754,  0.04926754,
+           0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.22157861,  0.73861153,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.18507071,  0.61691587,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.12969594,  0.43232925,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.07027629,  0.23425943,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.02273848,  0.0757966 ,
+           0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.04504259,  0.91514755,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.03762125,  0.76436533,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.02636464,  0.53566054,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.01428579,  0.29024993,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.00462229,  0.0939128 ,
+           0.90146491]]), 'FE2_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -8831,7 +9004,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -8955,142 +9128,18 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_C0_D01': array([[ -2.66059020e+00,   5.44009282e-15,  -8.40760572e-01,
-            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0_D10': array([[ -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.05746132e+00,   5.82867088e-15,  -2.07946329e-01,
-            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
+         [ -2.05746132e+00,  -8.49514991e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   2.90697631e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.14264218e+00,   6.61970478e-15,   7.51899241e-01,
-            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.60999729e-01,   7.43849426e-15,   1.78185709e+00,
-            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.24348811e-01,   8.10462808e-15,   2.60585966e+00,
-            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.95444613e+00,   5.88418203e-15,  -8.40760572e-01,
-            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.46766349e+00,   6.43929354e-15,  -2.07946329e-01,
-            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -7.29317012e-01,   6.98746616e-15,   7.51899241e-01,
-            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.29622614e-02,   7.54951657e-15,   1.78185709e+00,
-            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.96813589e-01,   8.21565038e-15,   2.60585966e+00,
-            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -9.20380286e-01,   6.99440506e-15,  -8.40760572e-01,
-            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
-            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.24050380e-01,   7.55645546e-15,   7.51899241e-01,
-            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.90928547e-01,   7.88258347e-15,   1.78185709e+00,
-            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.02929828e-01,   8.32667268e-15,   2.60585966e+00,
-            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.13685562e-01,   8.16013923e-15,  -8.40760572e-01,
-            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.59717159e-01,   8.32667268e-15,  -2.07946329e-01,
-            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.81216253e-01,   7.99360578e-15,   7.51899241e-01,
-            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.18894832e-01,   8.21565038e-15,   1.78185709e+00,
-            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.09046068e-01,   8.43769499e-15,   2.60585966e+00,
-            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.19829626e-01,   9.21485110e-15,  -8.40760572e-01,
-            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.49514991e-01,   8.60422844e-15,  -2.07946329e-01,
-            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
-            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.42856822e-01,   8.27116153e-15,   1.78185709e+00,
-            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.81510846e-01,   8.32667268e-15,   2.60585966e+00,
-            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D10': array([[ -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.05746132e+00,  -8.49514991e-01,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,   2.90697631e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.14264218e+00,  -8.94541420e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,   2.03718360e+00,
+         [ -1.14264218e+00,  -8.94541420e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   2.03718360e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -9130,27 +9179,27 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,   3.01839136e-16,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,  -3.21103098e-16,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,  -2.28343072e-16,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,   7.26320131e-16,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,   2.30511706e-15,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -9252,154 +9301,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
            1.,  0.],
          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE3_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE1_C0': array([[ 0.91514755,  0.04504259,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.76436533,  0.03762125,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.53566054,  0.02636464,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.29024993,  0.01428579,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.0939128 ,  0.00462229,  0.90146491,  0.        ,  0.        ,
-           0.        ],
-         [ 0.73861153,  0.22157861,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.61691587,  0.18507071,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.43232925,  0.12969594,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.23425943,  0.07027629,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.0757966 ,  0.02273848,  0.90146491,  0.        ,  0.        ,
-           0.        ],
-         [ 0.48009507,  0.48009507,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.40099329,  0.40099329,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.28101259,  0.28101259,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.15226786,  0.15226786,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04926754,  0.04926754,  0.90146491,  0.        ,  0.        ,
-           0.        ],
-         [ 0.22157861,  0.73861153,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.18507071,  0.61691587,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.12969594,  0.43232925,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.07027629,  0.23425943,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.02273848,  0.0757966 ,  0.90146491,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04504259,  0.91514755,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.03762125,  0.76436533,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.02636464,  0.53566054,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.01428579,  0.29024993,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.00462229,  0.0939128 ,  0.90146491,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.91514755,  0.04504259,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.76436533,  0.03762125,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.53566054,  0.02636464,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.29024993,  0.01428579,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.0939128 ,  0.00462229,
-           0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.73861153,  0.22157861,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.61691587,  0.18507071,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.43232925,  0.12969594,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.23425943,  0.07027629,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.0757966 ,  0.02273848,
-           0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.48009507,  0.48009507,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.40099329,  0.40099329,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.28101259,  0.28101259,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.15226786,  0.15226786,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.04926754,  0.04926754,
-           0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.22157861,  0.73861153,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.18507071,  0.61691587,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.12969594,  0.43232925,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.07027629,  0.23425943,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.02273848,  0.0757966 ,
-           0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.04504259,  0.91514755,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.03762125,  0.76436533,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.02636464,  0.53566054,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.01428579,  0.29024993,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.00462229,  0.0939128 ,
-           0.90146491]]), 'FE3_C0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
+           1.,  0.]]), 'FE1_C0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
            0.16488248,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [ 0.40414338, -0.03479054, -0.11959479,  0.02979805,  0.60541837,
@@ -9473,7 +9375,7 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
            0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE3_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.75984252, -0.04098492, -0.03664021,  0.00717256,
            0.14572757,  0.16488248,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -9547,7 +9449,7 @@ Compiler stage 2: Computing intermediate representation
            0.03974104,  0.0165858 ,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -0.00457956, -0.07627357,  0.72381307,  0.33863637,
-           0.01666732,  0.00173637,  0.        ,  0.        ,  0.        ]]), 'FE3_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.01666732,  0.00173637,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.91514755,  0.04504259,  0.03980986],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -9621,181 +9523,205 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.01428579,  0.29024993,  0.69546427],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.00462229,  0.0939128 ,  0.90146491]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]])}
-  
-  tables: {'FE0_D10': array([[  9.35246356e-01],
-         [  3.88543712e+00],
-         [  6.02258693e+00],
-         [  5.18192636e+00],
-         [  2.17329104e+00],
-         [  5.55741183e-01],
-         [  2.30880068e+00],
-         [  3.57873577e+00],
-         [  3.07919926e+00],
-         [  1.29141090e+00],
-         [ -6.56553795e-16],
-         [ -2.70598676e-15],
-         [ -2.99077992e-16],
-         [ -2.38900442e-15],
-         [ -1.59987078e-14],
-         [ -5.55741183e-01],
-         [ -2.30880068e+00],
-         [ -3.57873577e+00],
-         [ -3.07919926e+00],
-         [ -1.29141090e+00],
-         [ -9.35246356e-01],
-         [ -3.88543712e+00],
-         [ -6.02258693e+00],
-         [ -5.18192636e+00],
-         [ -2.17329104e+00]]), 'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.        ,  0.        ,  0.00462229,  0.0939128 ,  0.90146491]]), 'FE4_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C0_D10': array([[ -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.66059020e+00,   5.44009282e-15,  -8.40760572e-01,
-            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -2.05746132e+00,  -8.49514991e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   2.90697631e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.05746132e+00,   5.82867088e-15,  -2.07946329e-01,
-            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.14264218e+00,  -8.94541420e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   2.03718360e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.14264218e+00,   6.61970478e-15,   7.51899241e-01,
-            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.60999729e-01,  -9.42856822e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   1.10385655e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.60999729e-01,   7.43849426e-15,   1.78185709e+00,
-            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  6.24348811e-01,  -9.81510846e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.57162035e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.24348811e-01,   8.10462808e-15,   2.60585966e+00,
-            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.95444613e+00,  -1.13685562e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   2.06813170e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.95444613e+00,   5.88418203e-15,  -8.40760572e-01,
-            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.46766349e+00,  -2.59717159e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   1.72738065e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.46766349e+00,   6.43929354e-15,  -2.07946329e-01,
-            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -7.29317012e-01,  -4.81216253e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   1.21053326e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -7.29317012e-01,   6.98746616e-15,   7.51899241e-01,
-            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  6.29622614e-02,  -7.18894832e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   6.55932571e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.29622614e-02,   7.54951657e-15,   1.78185709e+00,
-            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  6.96813589e-01,  -9.09046068e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   2.12232479e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.96813589e-01,   8.21565038e-15,   2.60585966e+00,
-            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -9.20380286e-01,   6.99440506e-15,  -8.40760572e-01,
-            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
-            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.24050380e-01,   7.55645546e-15,   7.51899241e-01,
-            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.90928547e-01,   7.88258347e-15,   1.78185709e+00,
-            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.02929828e-01,   8.32667268e-15,   2.60585966e+00,
-            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  1.13685562e-01,   1.95444613e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -2.06813170e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.13685562e-01,   8.16013923e-15,  -8.40760572e-01,
-            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  2.59717159e-01,   1.46766349e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -1.72738065e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.59717159e-01,   8.32667268e-15,  -2.07946329e-01,
-            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  4.81216253e-01,   7.29317012e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -1.21053326e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.81216253e-01,   7.99360578e-15,   7.51899241e-01,
-            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  7.18894832e-01,  -6.29622614e-02,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -6.55932571e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.18894832e-01,   8.21565038e-15,   1.78185709e+00,
-            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  9.09046068e-01,  -6.96813589e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -2.12232479e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.09046068e-01,   8.43769499e-15,   2.60585966e+00,
-            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  8.19829626e-01,   2.66059020e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -3.48041982e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.19829626e-01,   9.21485110e-15,  -8.40760572e-01,
-            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  8.49514991e-01,   2.05746132e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -2.90697631e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.49514991e-01,   8.60422844e-15,  -2.07946329e-01,
-            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  8.94541420e-01,   1.14264218e+00,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -2.03718360e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
-            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  9.42856822e-01,   1.60999729e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.10385655e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.42856822e-01,   8.27116153e-15,   1.78185709e+00,
-            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  9.81510846e-01,  -6.24348811e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.81510846e-01,   8.32667268e-15,   2.60585966e+00,
-            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]])}
+  
+  tables: {'FE0_D10': array([[  9.35246356e-01],
+         [  3.88543712e+00],
+         [  6.02258693e+00],
+         [  5.18192636e+00],
+         [  2.17329104e+00],
+         [  5.55741183e-01],
+         [  2.30880068e+00],
+         [  3.57873577e+00],
+         [  3.07919926e+00],
+         [  1.29141090e+00],
+         [ -2.27067044e-15],
+         [ -2.41579066e-15],
+         [ -5.59655100e-16],
+         [ -2.50001051e-15],
+         [ -1.11583099e-14],
+         [ -5.55741183e-01],
+         [ -2.30880068e+00],
+         [ -3.57873577e+00],
+         [ -3.07919926e+00],
+         [ -1.29141090e+00],
+         [ -9.35246356e-01],
+         [ -3.88543712e+00],
+         [ -6.02258693e+00],
+         [ -5.18192636e+00],
+         [ -2.17329104e+00]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
             1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
@@ -9848,27 +9774,27 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,   3.01839136e-16,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,  -3.21103098e-16,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,  -2.28343072e-16,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,   7.26320131e-16,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,   2.30511706e-15,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -9919,401 +9845,129 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             9.81510846e-01,  -6.24348811e-01,   0.00000000e+00,
             3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C0_D01': array([[ -2.66059020e+00,   5.44009282e-15,  -8.40760572e-01,
-            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.05746132e+00,   5.82867088e-15,  -2.07946329e-01,
-            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.14264218e+00,   6.61970478e-15,   7.51899241e-01,
-            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.60999729e-01,   7.43849426e-15,   1.78185709e+00,
-            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.24348811e-01,   8.10462808e-15,   2.60585966e+00,
-            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.95444613e+00,   5.88418203e-15,  -8.40760572e-01,
-            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.46766349e+00,   6.43929354e-15,  -2.07946329e-01,
-            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -7.29317012e-01,   6.98746616e-15,   7.51899241e-01,
-            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.29622614e-02,   7.54951657e-15,   1.78185709e+00,
-            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.96813589e-01,   8.21565038e-15,   2.60585966e+00,
-            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -9.20380286e-01,   6.99440506e-15,  -8.40760572e-01,
-            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
-            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.24050380e-01,   7.55645546e-15,   7.51899241e-01,
-            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.90928547e-01,   7.88258347e-15,   1.78185709e+00,
-            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.02929828e-01,   8.32667268e-15,   2.60585966e+00,
-            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.13685562e-01,   8.16013923e-15,  -8.40760572e-01,
-            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.59717159e-01,   8.32667268e-15,  -2.07946329e-01,
-            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.81216253e-01,   7.99360578e-15,   7.51899241e-01,
-            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.18894832e-01,   8.21565038e-15,   1.78185709e+00,
-            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.09046068e-01,   8.43769499e-15,   2.60585966e+00,
-            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.19829626e-01,   9.21485110e-15,  -8.40760572e-01,
-            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.49514991e-01,   8.60422844e-15,  -2.07946329e-01,
-            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
-            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.42856822e-01,   8.27116153e-15,   1.78185709e+00,
-            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.81510846e-01,   8.32667268e-15,   2.60585966e+00,
-            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.75984252, -0.04098492, -0.03664021,  0.00717256,
-           0.14572757,  0.16488248,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.40414338, -0.03479054, -0.11959479,  0.02979805,
-           0.60541837,  0.11502552,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.03820389, -0.02497446, -0.05433094,  0.0461882 ,
-           0.9384233 ,  0.05649   ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12175989, -0.01387763,  0.27187684,  0.03974104,
-           0.80743383,  0.0165858 ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.07627357, -0.00457956,  0.72381307,  0.01666732,
-           0.33863637,  0.00173637,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.35248246, -0.12338445, -0.03664021,  0.03528405,
-           0.11761608,  0.65464207,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.14425451, -0.11656837, -0.11959479,  0.14658594,
-           0.48863048,  0.45669223,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.05851209, -0.09605386, -0.05433094,  0.22721421,
-           0.75739729,  0.22428539,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12450447, -0.06039878,  0.27187684,  0.1954986 ,
-           0.65167627,  0.06585154,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.06430635, -0.02170441,  0.72381307,  0.08199178,
-           0.27331191,  0.006894  ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.01911252, -0.01911252, -0.03664021,  0.07645006,
-           0.07645006,  0.92196511,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.07940205, -0.07940205, -0.11959479,  0.31760821,
-           0.31760821,  0.64318248,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12307644, -0.12307644, -0.05433094,  0.49230575,
-           0.49230575,  0.31587231,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.10589686, -0.10589686,  0.27187684,  0.42358744,
-           0.42358744,  0.09274201,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04441296, -0.04441296,  0.72381307,  0.17765185,
-           0.17765185,  0.00970916,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12338445,  0.35248246, -0.03664021,  0.11761608,
-           0.03528405,  0.65464207,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.11656837,  0.14425451, -0.11959479,  0.48863048,
-           0.14658594,  0.45669223,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.09605386, -0.05851209, -0.05433094,  0.75739729,
-           0.22721421,  0.22428539,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.06039878, -0.12450447,  0.27187684,  0.65167627,
-           0.1954986 ,  0.06585154,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.02170441, -0.06430635,  0.72381307,  0.27331191,
-           0.08199178,  0.006894  ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04098492,  0.75984252, -0.03664021,  0.14572757,
-           0.00717256,  0.16488248,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.03479054,  0.40414338, -0.11959479,  0.60541837,
-           0.02979805,  0.11502552,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.02497446,  0.03820389, -0.05433094,  0.9384233 ,
-           0.0461882 ,  0.05649   ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.01387763, -0.12175989,  0.27187684,  0.80743383,
-           0.03974104,  0.0165858 ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.00457956, -0.07627357,  0.72381307,  0.33863637,
-           0.01666732,  0.00173637,  0.        ,  0.        ,  0.        ]]), 'FE2_C0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
-           0.16488248,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.40414338, -0.03479054, -0.11959479,  0.02979805,  0.60541837,
-           0.11502552,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.03820389, -0.02497446, -0.05433094,  0.0461882 ,  0.9384233 ,
-           0.05649   ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12175989, -0.01387763,  0.27187684,  0.03974104,  0.80743383,
-           0.0165858 ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.07627357, -0.00457956,  0.72381307,  0.01666732,  0.33863637,
-           0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.35248246, -0.12338445, -0.03664021,  0.03528405,  0.11761608,
-           0.65464207,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.14425451, -0.11656837, -0.11959479,  0.14658594,  0.48863048,
-           0.45669223,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.05851209, -0.09605386, -0.05433094,  0.22721421,  0.75739729,
-           0.22428539,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12450447, -0.06039878,  0.27187684,  0.1954986 ,  0.65167627,
-           0.06585154,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.06430635, -0.02170441,  0.72381307,  0.08199178,  0.27331191,
-           0.006894  ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.01911252, -0.01911252, -0.03664021,  0.07645006,  0.07645006,
-           0.92196511,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.07940205, -0.07940205, -0.11959479,  0.31760821,  0.31760821,
-           0.64318248,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12307644, -0.12307644, -0.05433094,  0.49230575,  0.49230575,
-           0.31587231,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.10589686, -0.10589686,  0.27187684,  0.42358744,  0.42358744,
-           0.09274201,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.04441296, -0.04441296,  0.72381307,  0.17765185,  0.17765185,
-           0.00970916,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12338445,  0.35248246, -0.03664021,  0.11761608,  0.03528405,
-           0.65464207,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.11656837,  0.14425451, -0.11959479,  0.48863048,  0.14658594,
-           0.45669223,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.09605386, -0.05851209, -0.05433094,  0.75739729,  0.22721421,
-           0.22428539,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.06039878, -0.12450447,  0.27187684,  0.65167627,  0.1954986 ,
-           0.06585154,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.02170441, -0.06430635,  0.72381307,  0.27331191,  0.08199178,
-           0.006894  ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.04098492,  0.75984252, -0.03664021,  0.14572757,  0.00717256,
-           0.16488248,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.03479054,  0.40414338, -0.11959479,  0.60541837,  0.02979805,
-           0.11502552,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.02497446,  0.03820389, -0.05433094,  0.9384233 ,  0.0461882 ,
-           0.05649   ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.01387763, -0.12175989,  0.27187684,  0.80743383,  0.03974104,
-           0.0165858 ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
-           0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE4': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.91514755,  0.04504259,  0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.76436533,  0.03762125,  0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.53566054,  0.02636464,  0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.29024993,  0.01428579,  0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.0939128 ,  0.00462229,  0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.73861153,  0.22157861,  0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.61691587,  0.18507071,  0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.43232925,  0.12969594,  0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.23425943,  0.07027629,  0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.0757966 ,  0.02273848,  0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.48009507,  0.48009507,  0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.40099329,  0.40099329,  0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.28101259,  0.28101259,  0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.15226786,  0.15226786,  0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.04926754,  0.04926754,  0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.22157861,  0.73861153,  0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.18507071,  0.61691587,  0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.12969594,  0.43232925,  0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.07027629,  0.23425943,  0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.02273848,  0.0757966 ,  0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.04504259,  0.91514755,  0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.03762125,  0.76436533,  0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.02636464,  0.53566054,  0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.01428579,  0.29024993,  0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.00462229,  0.0939128 ,  0.90146491]]), 'FE0': array([[ 0.04430665],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.]]), 'FE4_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE0': array([[ 0.04430665],
          [ 0.15374203],
          [ 0.16700308],
          [ 0.07786013],
@@ -10337,7 +9991,131 @@ Compiler stage 2: Computing intermediate representation
          [ 0.15374203],
          [ 0.16700308],
          [ 0.07786013],
-         [ 0.01056561]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [ 0.01056561]]), 'FE1_C0_D01': array([[ -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
+            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
+            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
+            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
+            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
+            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
+            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
+            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
+            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
+            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
+            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
+            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
+            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
+            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
+            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
+            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
+            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
+            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
+            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
+            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
+            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
+            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
+            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
+            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
+            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
+            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -10410,56 +10188,229 @@ Compiler stage 2: Computing intermediate representation
          [-3.31015168],
          [-5.95304979],
          [-5.3382242 ],
-         [-2.27407499]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [-2.27407499]]), 'FE4_C0': array([[ 0.91514755,  0.04504259,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.76436533,  0.03762125,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.53566054,  0.02636464,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.29024993,  0.01428579,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.0939128 ,  0.00462229,  0.90146491,  0.        ,  0.        ,
+           0.        ],
+         [ 0.73861153,  0.22157861,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.61691587,  0.18507071,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.43232925,  0.12969594,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.23425943,  0.07027629,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.0757966 ,  0.02273848,  0.90146491,  0.        ,  0.        ,
+           0.        ],
+         [ 0.48009507,  0.48009507,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.40099329,  0.40099329,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.28101259,  0.28101259,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.15226786,  0.15226786,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.04926754,  0.04926754,  0.90146491,  0.        ,  0.        ,
+           0.        ],
+         [ 0.22157861,  0.73861153,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.18507071,  0.61691587,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.12969594,  0.43232925,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.07027629,  0.23425943,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.02273848,  0.0757966 ,  0.90146491,  0.        ,  0.        ,
+           0.        ],
+         [ 0.04504259,  0.91514755,  0.03980986,  0.        ,  0.        ,
+           0.        ],
+         [ 0.03762125,  0.76436533,  0.19801342,  0.        ,  0.        ,
+           0.        ],
+         [ 0.02636464,  0.53566054,  0.43797481,  0.        ,  0.        ,
+           0.        ],
+         [ 0.01428579,  0.29024993,  0.69546427,  0.        ,  0.        ,
+           0.        ],
+         [ 0.00462229,  0.0939128 ,  0.90146491,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
+            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
+            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
+            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
+            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
+            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
+            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
+            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
+            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
+            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
+            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
+            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
+            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
+            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
+            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
+            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
+            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
+            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
+            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
+            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
+            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
+            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
+            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
+            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
+            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
+            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C1': array([[ 0.        ,  0.        ,  0.        ,  0.91514755,  0.04504259,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.76436533,  0.03762125,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.53566054,  0.02636464,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.29024993,  0.01428579,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.0939128 ,  0.00462229,
+           0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.73861153,  0.22157861,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.61691587,  0.18507071,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.43232925,  0.12969594,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.23425943,  0.07027629,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.0757966 ,  0.02273848,
+           0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.48009507,  0.48009507,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.40099329,  0.40099329,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.28101259,  0.28101259,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.15226786,  0.15226786,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.04926754,  0.04926754,
+           0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.22157861,  0.73861153,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.18507071,  0.61691587,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.12969594,  0.43232925,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.07027629,  0.23425943,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.02273848,  0.0757966 ,
+           0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.04504259,  0.91514755,
+           0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.03762125,  0.76436533,
+           0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.02636464,  0.53566054,
+           0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.01428579,  0.29024993,
+           0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.00462229,  0.0939128 ,
+           0.90146491]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -10583,7 +10534,253 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0_D10': array([[ -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
+           0.16488248,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.40414338, -0.03479054, -0.11959479,  0.02979805,  0.60541837,
+           0.11502552,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.03820389, -0.02497446, -0.05433094,  0.0461882 ,  0.9384233 ,
+           0.05649   ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12175989, -0.01387763,  0.27187684,  0.03974104,  0.80743383,
+           0.0165858 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.07627357, -0.00457956,  0.72381307,  0.01666732,  0.33863637,
+           0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.35248246, -0.12338445, -0.03664021,  0.03528405,  0.11761608,
+           0.65464207,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.14425451, -0.11656837, -0.11959479,  0.14658594,  0.48863048,
+           0.45669223,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.05851209, -0.09605386, -0.05433094,  0.22721421,  0.75739729,
+           0.22428539,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12450447, -0.06039878,  0.27187684,  0.1954986 ,  0.65167627,
+           0.06585154,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.06430635, -0.02170441,  0.72381307,  0.08199178,  0.27331191,
+           0.006894  ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.01911252, -0.01911252, -0.03664021,  0.07645006,  0.07645006,
+           0.92196511,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.07940205, -0.07940205, -0.11959479,  0.31760821,  0.31760821,
+           0.64318248,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12307644, -0.12307644, -0.05433094,  0.49230575,  0.49230575,
+           0.31587231,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.10589686, -0.10589686,  0.27187684,  0.42358744,  0.42358744,
+           0.09274201,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.04441296, -0.04441296,  0.72381307,  0.17765185,  0.17765185,
+           0.00970916,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12338445,  0.35248246, -0.03664021,  0.11761608,  0.03528405,
+           0.65464207,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.11656837,  0.14425451, -0.11959479,  0.48863048,  0.14658594,
+           0.45669223,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.09605386, -0.05851209, -0.05433094,  0.75739729,  0.22721421,
+           0.22428539,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.06039878, -0.12450447,  0.27187684,  0.65167627,  0.1954986 ,
+           0.06585154,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.02170441, -0.06430635,  0.72381307,  0.27331191,  0.08199178,
+           0.006894  ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.04098492,  0.75984252, -0.03664021,  0.14572757,  0.00717256,
+           0.16488248,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.03479054,  0.40414338, -0.11959479,  0.60541837,  0.02979805,
+           0.11502552,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.02497446,  0.03820389, -0.05433094,  0.9384233 ,  0.0461882 ,
+           0.05649   ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.01387763, -0.12175989,  0.27187684,  0.80743383,  0.03974104,
+           0.0165858 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
+           0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.75984252, -0.04098492, -0.03664021,  0.00717256,
+           0.14572757,  0.16488248,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.40414338, -0.03479054, -0.11959479,  0.02979805,
+           0.60541837,  0.11502552,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.03820389, -0.02497446, -0.05433094,  0.0461882 ,
+           0.9384233 ,  0.05649   ,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12175989, -0.01387763,  0.27187684,  0.03974104,
+           0.80743383,  0.0165858 ,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.07627357, -0.00457956,  0.72381307,  0.01666732,
+           0.33863637,  0.00173637,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.35248246, -0.12338445, -0.03664021,  0.03528405,
+           0.11761608,  0.65464207,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.14425451, -0.11656837, -0.11959479,  0.14658594,
+           0.48863048,  0.45669223,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.05851209, -0.09605386, -0.05433094,  0.22721421,
+           0.75739729,  0.22428539,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12450447, -0.06039878,  0.27187684,  0.1954986 ,
+           0.65167627,  0.06585154,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.06430635, -0.02170441,  0.72381307,  0.08199178,
+           0.27331191,  0.006894  ,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.01911252, -0.01911252, -0.03664021,  0.07645006,
+           0.07645006,  0.92196511,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.07940205, -0.07940205, -0.11959479,  0.31760821,
+           0.31760821,  0.64318248,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12307644, -0.12307644, -0.05433094,  0.49230575,
+           0.49230575,  0.31587231,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.10589686, -0.10589686,  0.27187684,  0.42358744,
+           0.42358744,  0.09274201,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04441296, -0.04441296,  0.72381307,  0.17765185,
+           0.17765185,  0.00970916,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12338445,  0.35248246, -0.03664021,  0.11761608,
+           0.03528405,  0.65464207,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.11656837,  0.14425451, -0.11959479,  0.48863048,
+           0.14658594,  0.45669223,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.09605386, -0.05851209, -0.05433094,  0.75739729,
+           0.22721421,  0.22428539,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.06039878, -0.12450447,  0.27187684,  0.65167627,
+           0.1954986 ,  0.06585154,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02170441, -0.06430635,  0.72381307,  0.27331191,
+           0.08199178,  0.006894  ,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04098492,  0.75984252, -0.03664021,  0.14572757,
+           0.00717256,  0.16488248,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.03479054,  0.40414338, -0.11959479,  0.60541837,
+           0.02979805,  0.11502552,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02497446,  0.03820389, -0.05433094,  0.9384233 ,
+           0.0461882 ,  0.05649   ,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.01387763, -0.12175989,  0.27187684,  0.80743383,
+           0.03974104,  0.0165858 ,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.00457956, -0.07627357,  0.72381307,  0.33863637,
+           0.01666732,  0.00173637,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.91514755,  0.04504259,  0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.76436533,  0.03762125,  0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.53566054,  0.02636464,  0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.29024993,  0.01428579,  0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.0939128 ,  0.00462229,  0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.73861153,  0.22157861,  0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.61691587,  0.18507071,  0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.43232925,  0.12969594,  0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.23425943,  0.07027629,  0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.0757966 ,  0.02273848,  0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.48009507,  0.48009507,  0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.40099329,  0.40099329,  0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.28101259,  0.28101259,  0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.15226786,  0.15226786,  0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.04926754,  0.04926754,  0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.22157861,  0.73861153,  0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.18507071,  0.61691587,  0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.12969594,  0.43232925,  0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.07027629,  0.23425943,  0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.02273848,  0.0757966 ,  0.90146491],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.04504259,  0.91514755,  0.03980986],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.03762125,  0.76436533,  0.19801342],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.02636464,  0.53566054,  0.43797481],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.01428579,  0.29024993,  0.69546427],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.00462229,  0.0939128 ,  0.90146491]]), 'FE4_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C0_D10': array([[ -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
             1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -10634,27 +10831,27 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
-            1.59239428e-01,  -1.59239428e-01,   3.01839136e-16,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
-            7.92053671e-01,  -7.92053671e-01,  -3.21103098e-16,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
-            1.75189924e+00,  -1.75189924e+00,  -2.28343072e-16,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
-            2.78185709e+00,  -2.78185709e+00,   7.26320131e-16,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
-            3.60585966e+00,  -3.60585966e+00,   2.30511706e-15,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -10707,154 +10904,7 @@ Compiler stage 2: Computing intermediate representation
             3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE1_C0': array([[ 0.91514755,  0.04504259,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.76436533,  0.03762125,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.53566054,  0.02636464,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.29024993,  0.01428579,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.0939128 ,  0.00462229,  0.90146491,  0.        ,  0.        ,
-           0.        ],
-         [ 0.73861153,  0.22157861,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.61691587,  0.18507071,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.43232925,  0.12969594,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.23425943,  0.07027629,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.0757966 ,  0.02273848,  0.90146491,  0.        ,  0.        ,
-           0.        ],
-         [ 0.48009507,  0.48009507,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.40099329,  0.40099329,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.28101259,  0.28101259,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.15226786,  0.15226786,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04926754,  0.04926754,  0.90146491,  0.        ,  0.        ,
-           0.        ],
-         [ 0.22157861,  0.73861153,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.18507071,  0.61691587,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.12969594,  0.43232925,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.07027629,  0.23425943,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.02273848,  0.0757966 ,  0.90146491,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04504259,  0.91514755,  0.03980986,  0.        ,  0.        ,
-           0.        ],
-         [ 0.03762125,  0.76436533,  0.19801342,  0.        ,  0.        ,
-           0.        ],
-         [ 0.02636464,  0.53566054,  0.43797481,  0.        ,  0.        ,
-           0.        ],
-         [ 0.01428579,  0.29024993,  0.69546427,  0.        ,  0.        ,
-           0.        ],
-         [ 0.00462229,  0.0939128 ,  0.90146491,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.91514755,  0.04504259,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.76436533,  0.03762125,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.53566054,  0.02636464,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.29024993,  0.01428579,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.0939128 ,  0.00462229,
-           0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.73861153,  0.22157861,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.61691587,  0.18507071,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.43232925,  0.12969594,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.23425943,  0.07027629,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.0757966 ,  0.02273848,
-           0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.48009507,  0.48009507,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.40099329,  0.40099329,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.28101259,  0.28101259,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.15226786,  0.15226786,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.04926754,  0.04926754,
-           0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.22157861,  0.73861153,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.18507071,  0.61691587,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.12969594,  0.43232925,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.07027629,  0.23425943,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.02273848,  0.0757966 ,
-           0.90146491],
-         [ 0.        ,  0.        ,  0.        ,  0.04504259,  0.91514755,
-           0.03980986],
-         [ 0.        ,  0.        ,  0.        ,  0.03762125,  0.76436533,
-           0.19801342],
-         [ 0.        ,  0.        ,  0.        ,  0.02636464,  0.53566054,
-           0.43797481],
-         [ 0.        ,  0.        ,  0.        ,  0.01428579,  0.29024993,
-           0.69546427],
-         [ 0.        ,  0.        ,  0.        ,  0.00462229,  0.0939128 ,
-           0.90146491]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
@@ -10880,9 +10930,9 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.]])}
   
-  name_map: {'FE2_C1_D01': ['FE3_C1_D01'], 'FE2_C1_D10': ['FE3_C1_D10'], 'FE2_C0_D01': ['FE3_C0_D01'], 'FE2_C2_D10': ['FE3_C2_D10'], 'FE2_C2_D01': ['FE3_C2_D01'], 'FE2_C1': ['FE3_C1'], 'FE2_C0': ['FE3_C0'], 'FE2_C2': ['FE3_C2'], 'FE2_C0_D10': ['FE3_C0_D10']}
+  name_map: {'FE1_C0': ['FE2_C0'], 'FE1_C1_D01': ['FE2_C1_D01'], 'FE1_C2': ['FE2_C2'], 'FE1_C1_D10': ['FE2_C1_D10'], 'FE1_C2_D10': ['FE2_C2_D10'], 'FE1_C2_D01': ['FE2_C2_D01'], 'FE1_C1': ['FE2_C1'], 'FE1_C0_D01': ['FE2_C0_D01'], 'FE1_C0_D10': ['FE2_C0_D10']}
   
-  inv_name_map: {'FE0_D10': 'FE0_D10', 'FE2_C1_D01': 'FE2_C1_D01', 'FE3_C1_D10': 'FE2_C1_D10', 'FE0_D01': 'FE0_D01', 'FE1_C1_D10': 'FE1_C1_D10', 'FE3_C0_D10': 'FE2_C0_D10', 'FE2_C0_D01': 'FE2_C0_D01', 'FE2_C1': 'FE2_C1', 'FE2_C0': 'FE2_C0', 'FE4': 'FE4', 'FE2_C2': 'FE2_C2', 'FE0': 'FE0', 'FE1_C0_D01': 'FE1_C0_D01', 'FE2_C1_D10': 'FE2_C1_D10', 'FE3_C1_D01': 'FE2_C1_D01', 'FE1_C1_D01': 'FE1_C1_D01', 'FE2_C2_D01': 'FE2_C2_D01', 'FE3_C2_D01': 'FE2_C2_D01', 'FE3_C0_D01': 'FE2_C0_D01', 'FE2_C0 [...]
+  inv_name_map: {'FE2_C1_D01': 'FE1_C1_D01', 'FE0_D10': 'FE0_D10', 'FE4_C1': 'FE4_C1', 'FE1_C1_D10': 'FE1_C1_D10', 'FE1_C2_D10': 'FE1_C2_D10', 'FE2_C0_D01': 'FE1_C0_D01', 'FE4_C1_D01': 'FE4_C1_D01', 'FE2_C1': 'FE1_C1', 'FE2_C0': 'FE1_C0', 'FE2_C2': 'FE1_C2', 'FE0_D01': 'FE0_D01', 'FE3': 'FE3', 'FE0': 'FE0', 'FE1_C0_D01': 'FE1_C0_D01', 'FE4_C0_D01': 'FE4_C0_D01', 'FE2_C1_D10': 'FE1_C1_D10', 'FE4_C0': 'FE4_C0', 'FE1_C1_D01': 'FE1_C1_D01', 'FE2_C2_D10': 'FE1_C2_D10', 'FE1_C2_D01': 'FE1_C2_D [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_D10': array([[  9.35246356e-01],
@@ -10899,7 +10949,7 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00],
          [  0.00000000e+00],
          [  0.00000000e+00],
-         [ -1.59987078e-14],
+         [ -1.11583099e-14],
          [ -5.55741183e-01],
          [ -2.30880068e+00],
          [ -3.57873577e+00],
@@ -10909,7 +10959,55 @@ Compiler stage 2: Computing intermediate representation
          [ -3.88543712e+00],
          [ -6.02258693e+00],
          [ -5.18192636e+00],
-         [ -2.17329104e+00]]), 'FE2_C0_D01': array([[-2.6605902 , -0.84076057,  0.18017037,  3.50135077, -0.18017037],
+         [ -2.17329104e+00]]), 'FE3': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE0': array([[ 0.04430665],
+         [ 0.15374203],
+         [ 0.16700308],
+         [ 0.07786013],
+         [ 0.01056561],
+         [ 0.17591315],
+         [ 0.61041053],
+         [ 0.66306162],
+         [ 0.30913239],
+         [ 0.04194921],
+         [ 0.24774727],
+         [ 0.85967164],
+         [ 0.93382279],
+         [ 0.43536659],
+         [ 0.05907917],
+         [ 0.17591315],
+         [ 0.61041053],
+         [ 0.66306162],
+         [ 0.30913239],
+         [ 0.04194921],
+         [ 0.04430665],
+         [ 0.15374203],
+         [ 0.16700308],
+         [ 0.07786013],
+         [ 0.01056561]]), 'FE1_C0_D01': array([[-2.6605902 , -0.84076057,  0.18017037,  3.50135077, -0.18017037],
          [-2.05746132, -0.20794633,  0.15048501,  2.26540765, -0.15048501],
          [-1.14264218,  0.75189924,  0.10545858,  0.39074294, -0.10545858],
          [-0.16099973,  1.78185709,  0.05714318, -1.62085736, -0.05714318],
@@ -10933,7 +11031,55 @@ Compiler stage 2: Computing intermediate representation
          [ 0.84951499, -0.20794633,  3.05746132, -0.64156866, -3.05746132],
          [ 0.89454142,  0.75189924,  2.14264218, -1.64644066, -2.14264218],
          [ 0.94285682,  1.78185709,  1.16099973, -2.72471392, -1.16099973],
-         [ 0.98151085,  2.60585966,  0.37565119, -3.5873705 , -0.37565119]]), 'FE2_C0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
+         [ 0.98151085,  2.60585966,  0.37565119, -3.5873705 , -0.37565119]]), 'FE0_D01': array([[ 1.06454196],
+         [ 0.57528544],
+         [ 0.06953714],
+         [-0.15629784],
+         [-0.10078395],
+         [ 4.1806666 ],
+         [ 2.09321752],
+         [-0.01976956],
+         [-0.87511768],
+         [-0.50691001],
+         [ 5.70722656],
+         [ 2.19762632],
+         [-1.1909257 ],
+         [-2.23320663],
+         [-1.1336131 ],
+         [ 3.62492542],
+         [-0.21558317],
+         [-3.59850533],
+         [-3.95431694],
+         [-1.79832091],
+         [ 0.1292956 ],
+         [-3.31015168],
+         [-5.95304979],
+         [-5.3382242 ],
+         [-2.27407499]]), 'FE1_C2_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]]), 'FE1_C0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
            0.16488248],
          [ 0.40414338, -0.03479054, -0.11959479,  0.02979805,  0.60541837,
            0.11502552],
@@ -10982,127 +11128,7 @@ Compiler stage 2: Computing intermediate representation
          [-0.01387763, -0.12175989,  0.27187684,  0.80743383,  0.03974104,
            0.0165858 ],
          [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
-           0.00173637]]), 'FE4': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0': array([[ 0.04430665],
-         [ 0.15374203],
-         [ 0.16700308],
-         [ 0.07786013],
-         [ 0.01056561],
-         [ 0.17591315],
-         [ 0.61041053],
-         [ 0.66306162],
-         [ 0.30913239],
-         [ 0.04194921],
-         [ 0.24774727],
-         [ 0.85967164],
-         [ 0.93382279],
-         [ 0.43536659],
-         [ 0.05907917],
-         [ 0.17591315],
-         [ 0.61041053],
-         [ 0.66306162],
-         [ 0.30913239],
-         [ 0.04194921],
-         [ 0.04430665],
-         [ 0.15374203],
-         [ 0.16700308],
-         [ 0.07786013],
-         [ 0.01056561]]), 'FE1_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE0_D01': array([[ 1.06454196],
-         [ 0.57528544],
-         [ 0.06953714],
-         [-0.15629784],
-         [-0.10078395],
-         [ 4.1806666 ],
-         [ 2.09321752],
-         [-0.01976956],
-         [-0.87511768],
-         [-0.50691001],
-         [ 5.70722656],
-         [ 2.19762632],
-         [-1.1909257 ],
-         [-2.23320663],
-         [-1.1336131 ],
-         [ 3.62492542],
-         [-0.21558317],
-         [-3.59850533],
-         [-3.95431694],
-         [-1.79832091],
-         [ 0.1292956 ],
-         [-3.31015168],
-         [-5.95304979],
-         [-5.3382242 ],
-         [-2.27407499]]), 'FE2_C0_D10': array([[-2.6605902 , -0.81982963,  0.15923943, -0.15923943,  3.48041982],
-         [-2.05746132, -0.84951499,  0.79205367, -0.79205367,  2.90697631],
-         [-1.14264218, -0.89454142,  1.75189924, -1.75189924,  2.0371836 ],
-         [-0.16099973, -0.94285682,  2.78185709, -2.78185709,  1.10385655],
-         [ 0.62434881, -0.98151085,  3.60585966, -3.60585966,  0.35716204],
-         [-1.95444613, -0.11368556,  0.15923943, -0.15923943,  2.0681317 ],
-         [-1.46766349, -0.25971716,  0.79205367, -0.79205367,  1.72738065],
-         [-0.72931701, -0.48121625,  1.75189924, -1.75189924,  1.21053326],
-         [ 0.06296226, -0.71889483,  2.78185709, -2.78185709,  0.65593257],
-         [ 0.69681359, -0.90904607,  3.60585966, -3.60585966,  0.21223248],
-         [-0.92038029,  0.92038029,  0.15923943, -0.15923943,  0.        ],
-         [-0.60397316,  0.60397316,  0.79205367, -0.79205367,  0.        ],
-         [-0.12405038,  0.12405038,  1.75189924, -1.75189924,  0.        ],
-         [ 0.39092855, -0.39092855,  2.78185709, -2.78185709,  0.        ],
-         [ 0.80292983, -0.80292983,  3.60585966, -3.60585966,  0.        ],
-         [ 0.11368556,  1.95444613,  0.15923943, -0.15923943, -2.0681317 ],
-         [ 0.25971716,  1.46766349,  0.79205367, -0.79205367, -1.72738065],
-         [ 0.48121625,  0.72931701,  1.75189924, -1.75189924, -1.21053326],
-         [ 0.71889483, -0.06296226,  2.78185709, -2.78185709, -0.65593257],
-         [ 0.90904607, -0.69681359,  3.60585966, -3.60585966, -0.21223248],
-         [ 0.81982963,  2.6605902 ,  0.15923943, -0.15923943, -3.48041982],
-         [ 0.84951499,  2.05746132,  0.79205367, -0.79205367, -2.90697631],
-         [ 0.89454142,  1.14264218,  1.75189924, -1.75189924, -2.0371836 ],
-         [ 0.94285682,  0.16099973,  2.78185709, -2.78185709, -1.10385655],
-         [ 0.98151085, -0.62434881,  3.60585966, -3.60585966, -0.35716204]]), 'FE1_C0': array([[ 0.91514755,  0.04504259,  0.03980986],
+           0.00173637]]), 'FE1_C2': array([[ 0.91514755,  0.04504259,  0.03980986],
          [ 0.76436533,  0.03762125,  0.19801342],
          [ 0.53566054,  0.02636464,  0.43797481],
          [ 0.29024993,  0.01428579,  0.69546427],
@@ -11126,10 +11152,34 @@ Compiler stage 2: Computing intermediate representation
          [ 0.03762125,  0.76436533,  0.19801342],
          [ 0.02636464,  0.53566054,  0.43797481],
          [ 0.01428579,  0.29024993,  0.69546427],
-         [ 0.00462229,  0.0939128 ,  0.90146491]])}
+         [ 0.00462229,  0.0939128 ,  0.90146491]]), 'FE1_C0_D10': array([[-2.6605902 , -0.81982963,  0.15923943, -0.15923943,  3.48041982],
+         [-2.05746132, -0.84951499,  0.79205367, -0.79205367,  2.90697631],
+         [-1.14264218, -0.89454142,  1.75189924, -1.75189924,  2.0371836 ],
+         [-0.16099973, -0.94285682,  2.78185709, -2.78185709,  1.10385655],
+         [ 0.62434881, -0.98151085,  3.60585966, -3.60585966,  0.35716204],
+         [-1.95444613, -0.11368556,  0.15923943, -0.15923943,  2.0681317 ],
+         [-1.46766349, -0.25971716,  0.79205367, -0.79205367,  1.72738065],
+         [-0.72931701, -0.48121625,  1.75189924, -1.75189924,  1.21053326],
+         [ 0.06296226, -0.71889483,  2.78185709, -2.78185709,  0.65593257],
+         [ 0.69681359, -0.90904607,  3.60585966, -3.60585966,  0.21223248],
+         [-0.92038029,  0.92038029,  0.15923943, -0.15923943,  0.        ],
+         [-0.60397316,  0.60397316,  0.79205367, -0.79205367,  0.        ],
+         [-0.12405038,  0.12405038,  1.75189924, -1.75189924,  0.        ],
+         [ 0.39092855, -0.39092855,  2.78185709, -2.78185709,  0.        ],
+         [ 0.80292983, -0.80292983,  3.60585966, -3.60585966,  0.        ],
+         [ 0.11368556,  1.95444613,  0.15923943, -0.15923943, -2.0681317 ],
+         [ 0.25971716,  1.46766349,  0.79205367, -0.79205367, -1.72738065],
+         [ 0.48121625,  0.72931701,  1.75189924, -1.75189924, -1.21053326],
+         [ 0.71889483, -0.06296226,  2.78185709, -2.78185709, -0.65593257],
+         [ 0.90904607, -0.69681359,  3.60585966, -3.60585966, -0.21223248],
+         [ 0.81982963,  2.6605902 ,  0.15923943, -0.15923943, -3.48041982],
+         [ 0.84951499,  2.05746132,  0.79205367, -0.79205367, -2.90697631],
+         [ 0.89454142,  1.14264218,  1.75189924, -1.75189924, -2.0371836 ],
+         [ 0.94285682,  0.16099973,  2.78185709, -2.78185709, -1.10385655],
+         [ 0.98151085, -0.62434881,  3.60585966, -3.60585966, -0.35716204]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_D10': ('FE0_D10', (), False, False), 'FE2_C1_D01': ('FE2_C0_D01', (10, [6, 8, 9, 10, 11]), False, False), 'FE3_C1_D10': ('FE2_C0_D10', (11, [6, 7, 9, 10, 11]), False, False), 'FE0_D01': ('FE0_D01', (), False, False), 'FE1_C1_D10': ('FE1_C0_D01', (5, [3, 4]), False, False), 'FE3_C0_D10': ('FE2_C0_D10', (8, [0, 1, 3, 4, 5]), False, False), 'FE2_C0_D01': ('FE2_C0_D01', (7, [0, 2, 3, 4, 5]), False, False), 'FE2_C1': ('FE2_C0', (9, [6, 7, 8, 9, 10, 11]), False, False), 'FE2_C0': ('FE2 [...]
+  {'FE2_C1_D01': ('FE1_C0_D01', (4, [6, 8, 9, 10, 11]), False, False), 'FE0_D10': ('FE0_D10', (), False, False), 'FE4_C1': ('FE1_C2', (12, [3, 4, 5]), False, False), 'FE1_C1_D10': ('FE1_C0_D10', (5, [6, 7, 9, 10, 11]), False, False), 'FE1_C2_D10': ('FE1_C2_D01', (8, [12, 13]), False, False), 'FE2_C0_D01': ('FE1_C0_D01', (1, [0, 2, 3, 4, 5]), False, False), 'FE4_C1_D01': ('FE1_C2_D01', (13, [3, 5]), False, False), 'FE2_C1': ('FE1_C0', (3, [6, 7, 8, 9, 10, 11]), False, False), 'FE2_C0': (' [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -11239,21 +11289,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {4: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 0): array([[  0.00000000e+00,  -1.88651178e-17,   2.77555756e-17,
-            5.55111512e-17],
-         [  9.30568156e-01,   6.69990522e-01,   3.30009478e-01,
-            6.94318442e-02],
-         [  6.94318442e-02,   3.30009478e-01,   6.69990522e-01,
-            9.30568156e-01]])}, 1: {(0, 0): array([[  9.30568156e-01,   6.69990522e-01,   3.30009478e-01,
-            6.94318442e-02],
-         [  0.00000000e+00,  -1.88651178e-17,   2.77555756e-17,
-            5.55111512e-17],
-         [  6.94318442e-02,   3.30009478e-01,   6.69990522e-01,
-            9.30568156e-01]])}, 2: {(0, 0): array([[ 0.93056816,  0.66999052,  0.33000948,  0.06943184],
-         [ 0.06943184,  0.33000948,  0.66999052,  0.93056816],
-         [ 0.        ,  0.        ,  0.        ,  0.        ]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+  {4: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
@@ -11457,7 +11496,7 @@ Compiler stage 2: Computing intermediate representation
           [ 0.06943184,  0.33000948,  0.66999052,  0.93056816]],
   
          [[ 0.        ,  0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ]]])}}}, MixedElement(*[MixedElement(*[FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None)], **{'value_shape': (2,) }), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3, [...]
+          [ 0.        ,  0.        ,  0.        ,  0.        ]]])}}}, MixedElement(VectorElement(FiniteElement('Discontinuous Lagrange', triangle, 2), dim=2), FiniteElement('Discontinuous Lagrange', triangle, 1)): {None: {0: {(0, 0): array([[[  5.55111512e-17,  -6.93889390e-18,   7.45931095e-17,
              5.55111512e-17],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
@@ -11766,23 +11805,25 @@ Compiler stage 2: Computing intermediate representation
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]]])}}}, FiniteElement('Bubble', Domain(Cell('triangle', 2), label=None, data=None), 3, quad_scheme=None): {None: {0: {(0, 0): array([[ -4.16333634e-17,   5.55111512e-17,  -2.77555756e-16,
+             0.00000000e+00]]])}}}, FiniteElement('Bubble', triangle, 3): {None: {0: {(0, 0): array([[ -4.16333634e-17,   5.55111512e-17,  -2.77555756e-16,
            -1.66533454e-16]])}, 1: {(0, 0): array([[ -5.55111512e-17,  -2.77555756e-17,  -3.88578059e-16,
            -1.66533454e-16]])}, 2: {(0, 0): array([[  8.32667268e-17,   0.00000000e+00,  -8.32667268e-17,
-            2.77555756e-17]])}}}}}
+            2.77555756e-17]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {0: {(0, 0): array([[  0.00000000e+00,  -1.88651178e-17,   2.77555756e-17,
+            5.55111512e-17],
+         [  9.30568156e-01,   6.69990522e-01,   3.30009478e-01,
+            6.94318442e-02],
+         [  6.94318442e-02,   3.30009478e-01,   6.69990522e-01,
+            9.30568156e-01]])}, 1: {(0, 0): array([[  9.30568156e-01,   6.69990522e-01,   3.30009478e-01,
+            6.94318442e-02],
+         [  0.00000000e+00,  -1.88651178e-17,   2.77555756e-17,
+            5.55111512e-17],
+         [  6.94318442e-02,   3.30009478e-01,   6.69990522e-01,
+            9.30568156e-01]])}, 2: {(0, 0): array([[ 0.93056816,  0.66999052,  0.33000948,  0.06943184],
+         [ 0.06943184,  0.33000948,  0.66999052,  0.93056816],
+         [ 0.        ,  0.        ,  0.        ,  0.        ]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE2_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f0': array([[ -4.16333634e-17],
+  {'FE0_f0': array([[ -4.16333634e-17],
          [  5.55111512e-17],
          [ -2.77555756e-16],
          [ -1.66533454e-16]]), 'FE0_f1': array([[ -5.55111512e-17],
@@ -11791,95 +11832,153 @@ Compiler stage 2: Computing intermediate representation
          [ -1.66533454e-16]]), 'FE0_f2': array([[  8.32667268e-17],
          [  0.00000000e+00],
          [ -8.32667268e-17],
-         [  2.77555756e-17]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [  2.77555756e-17]]), 'FE3_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE3_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.01346029e-01,   1.04083409e-16,  -5.97902822e-02,
-           -1.38777878e-17,   2.58444253e-01,  -2.77555756e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   8.01346029e-01,  -5.97902822e-02,
+            2.58444253e-01,  -9.71445147e-17,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.27784077e-01,   6.93889390e-18,  -1.12196967e-01,
-           -4.16333634e-17,   8.84412890e-01,   3.46944695e-17,
+           -6.93889390e-18,   2.27784077e-01,  -1.12196967e-01,
+            8.84412890e-01,  -2.77555756e-17,   3.46944695e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.12196967e-01,   8.67361738e-17,   2.27784077e-01,
-           -2.77555756e-17,   8.84412890e-01,  -1.56125113e-17,
+            7.45931095e-17,  -1.12196967e-01,   2.27784077e-01,
+            8.84412890e-01,  -6.59194921e-17,   1.90819582e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -5.97902822e-02,   8.32667268e-17,   8.01346029e-01,
-           -1.11022302e-16,   2.58444253e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C0': array([[  8.01346029e-01,   1.04083409e-16,  -5.97902822e-02,
-           -1.38777878e-17,   2.58444253e-01,  -2.77555756e-17,
+            5.55111512e-17,  -5.97902822e-02,   8.01346029e-01,
+            2.58444253e-01,  -1.66533454e-16,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  5.55111512e-17,   8.01346029e-01,  -5.97902822e-02,
+            2.58444253e-01,  -9.71445147e-17,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.27784077e-01,   6.93889390e-18,  -1.12196967e-01,
-           -4.16333634e-17,   8.84412890e-01,   3.46944695e-17,
+         [ -6.93889390e-18,   2.27784077e-01,  -1.12196967e-01,
+            8.84412890e-01,  -2.77555756e-17,   3.46944695e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.12196967e-01,   8.67361738e-17,   2.27784077e-01,
-           -2.77555756e-17,   8.84412890e-01,  -1.56125113e-17,
+         [  7.45931095e-17,  -1.12196967e-01,   2.27784077e-01,
+            8.84412890e-01,  -6.59194921e-17,   1.90819582e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -5.97902822e-02,   8.32667268e-17,   8.01346029e-01,
-           -1.11022302e-16,   2.58444253e-01,   0.00000000e+00,
+         [  5.55111512e-17,  -5.97902822e-02,   8.01346029e-01,
+            2.58444253e-01,  -1.66533454e-16,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  0.00000000e+00,   9.30568156e-01,   6.94318442e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE3_f1_C0': array([[  9.30568156e-01,   0.00000000e+00,   6.94318442e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.88651178e-17,   6.69990522e-01,   3.30009478e-01,
+         [  6.69990522e-01,  -1.88651178e-17,   3.30009478e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.77555756e-17,   3.30009478e-01,   6.69990522e-01,
+         [  3.30009478e-01,   2.77555756e-17,   6.69990522e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,   6.94318442e-02,   9.30568156e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  6.94318442e-02,   5.55111512e-17,   9.30568156e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE3_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE3_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f1': array([[  9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
+         [  6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
+         [  3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
+         [  6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE1_f0': array([[  0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
+         [ -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
+         [  2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
+         [  5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE3_f2_C0': array([[ 0.93056816,  0.06943184,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.66999052,  0.33000948,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.33000948,  0.66999052,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.06943184,  0.93056816,  0.        ,  0.        ,  0.        ,
+           0.        ]]), 'FE3_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.93056816,  0.06943184,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.66999052,  0.33000948,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.33000948,  0.66999052,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.06943184,  0.93056816,
+           0.        ]]), 'FE3_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f2': array([[ 0.93056816,  0.06943184,  0.        ],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2': array([[ 0.93056816,  0.06943184,  0.        ],
          [ 0.66999052,  0.33000948,  0.        ],
          [ 0.33000948,  0.66999052,  0.        ],
-         [ 0.06943184,  0.93056816,  0.        ]]), 'FE1_f1': array([[  9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
-         [  6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
-         [  3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
-         [  6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE1_f0': array([[  0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
-         [ -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
-         [  2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
-         [  5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE3_f2_C0': array([[  8.01346029e-01,  -5.97902822e-02,   0.00000000e+00,
+         [ 0.06943184,  0.93056816,  0.        ]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.01346029e-01,  -5.97902822e-02,   0.00000000e+00,
+           -5.55111512e-17,  -2.77555756e-17,   2.58444253e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.27784077e-01,  -1.12196967e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   8.84412890e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.12196967e-01,   2.27784077e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   8.84412890e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -5.97902822e-02,   8.01346029e-01,   0.00000000e+00,
+            5.55111512e-17,  -1.11022302e-16,   2.58444253e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0': array([[  8.01346029e-01,  -5.97902822e-02,   0.00000000e+00,
            -5.55111512e-17,  -2.77555756e-17,   2.58444253e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -11898,14 +11997,7 @@ Compiler stage 2: Computing intermediate representation
             5.55111512e-17,  -1.11022302e-16,   2.58444253e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.93056816,  0.06943184,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -11916,229 +12008,229 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.33000948,  0.66999052,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.06943184,  0.93056816,  0.        ]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+           0.        ,  0.        ,  0.06943184,  0.93056816,  0.        ]]), 'FE3_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE3_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
          [ 0.,  0.,  0., -1.,  1.,  0.],
          [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  8.01346029e-01,   1.04083409e-16,  -5.97902822e-02,
+           -1.38777878e-17,   2.58444253e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.27784077e-01,   6.93889390e-18,  -1.12196967e-01,
+           -4.16333634e-17,   8.84412890e-01,   3.46944695e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.12196967e-01,   8.67361738e-17,   2.27784077e-01,
+           -2.77555756e-17,   8.84412890e-01,  -1.56125113e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -5.97902822e-02,   8.32667268e-17,   8.01346029e-01,
+           -1.11022302e-16,   2.58444253e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.93056816,  0.06943184,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.66999052,  0.33000948,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.33000948,  0.66999052,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.06943184,  0.93056816,
-           0.        ]]), 'FE2_f2_C0': array([[ 0.93056816,  0.06943184,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.66999052,  0.33000948,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.33000948,  0.66999052,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.06943184,  0.93056816,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE2_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.01346029e-01,  -5.97902822e-02,   0.00000000e+00,
-           -5.55111512e-17,  -2.77555756e-17,   2.58444253e-01,
+            8.01346029e-01,   1.04083409e-16,  -5.97902822e-02,
+           -1.38777878e-17,   2.58444253e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.27784077e-01,  -1.12196967e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   8.84412890e-01,
+            2.27784077e-01,   6.93889390e-18,  -1.12196967e-01,
+           -4.16333634e-17,   8.84412890e-01,   3.46944695e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.12196967e-01,   2.27784077e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   8.84412890e-01,
+           -1.12196967e-01,   8.67361738e-17,   2.27784077e-01,
+           -2.77555756e-17,   8.84412890e-01,  -1.56125113e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -5.97902822e-02,   8.01346029e-01,   0.00000000e+00,
-            5.55111512e-17,  -1.11022302e-16,   2.58444253e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  9.30568156e-01,   0.00000000e+00,   6.94318442e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.69990522e-01,  -1.88651178e-17,   3.30009478e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.30009478e-01,   2.77555756e-17,   6.69990522e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.94318442e-02,   5.55111512e-17,   9.30568156e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE3_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -5.97902822e-02,   8.32667268e-17,   8.01346029e-01,
+           -1.11022302e-16,   2.58444253e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
+            9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
+            6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
+            3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE3_f0_C0': array([[  5.55111512e-17,   8.01346029e-01,  -5.97902822e-02,
-            2.58444253e-01,  -9.71445147e-17,  -2.77555756e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -6.93889390e-18,   2.27784077e-01,  -1.12196967e-01,
-            8.84412890e-01,  -2.77555756e-17,   3.46944695e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE3_f0_C0': array([[  0.00000000e+00,   9.30568156e-01,   6.94318442e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.45931095e-17,  -1.12196967e-01,   2.27784077e-01,
-            8.84412890e-01,  -6.59194921e-17,   1.90819582e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.88651178e-17,   6.69990522e-01,   3.30009478e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,  -5.97902822e-02,   8.01346029e-01,
-            2.58444253e-01,  -1.66533454e-16,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   8.01346029e-01,  -5.97902822e-02,
-            2.58444253e-01,  -9.71445147e-17,  -2.77555756e-17,
+         [  2.77555756e-17,   3.30009478e-01,   6.69990522e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.55111512e-17,   6.94318442e-02,   9.30568156e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -6.93889390e-18,   2.27784077e-01,  -1.12196967e-01,
-            8.84412890e-01,  -2.77555756e-17,   3.46944695e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.45931095e-17,  -1.12196967e-01,   2.27784077e-01,
-            8.84412890e-01,  -6.59194921e-17,   1.90819582e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,  -5.97902822e-02,   8.01346029e-01,
-            2.58444253e-01,  -1.66533454e-16,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]])}
   
   tables: {'FE0_f0': array([[ -4.16333634e-17],
          [  5.55111512e-17],
          [ -2.77555756e-16],
-         [ -1.66533454e-16]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.66533454e-16]]), 'FE2_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.01346029e-01,   1.04083409e-16,  -5.97902822e-02,
-           -1.38777878e-17,   2.58444253e-01,  -2.77555756e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   8.01346029e-01,  -5.97902822e-02,
+            2.58444253e-01,  -9.71445147e-17,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.27784077e-01,   6.93889390e-18,  -1.12196967e-01,
-           -4.16333634e-17,   8.84412890e-01,   3.46944695e-17,
+           -6.93889390e-18,   2.27784077e-01,  -1.12196967e-01,
+            8.84412890e-01,  -2.77555756e-17,   3.46944695e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.12196967e-01,   8.67361738e-17,   2.27784077e-01,
-           -2.77555756e-17,   8.84412890e-01,  -1.56125113e-17,
+            7.45931095e-17,  -1.12196967e-01,   2.27784077e-01,
+            8.84412890e-01,  -6.59194921e-17,   1.90819582e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -5.97902822e-02,   8.32667268e-17,   8.01346029e-01,
-           -1.11022302e-16,   2.58444253e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C0': array([[  8.01346029e-01,   1.04083409e-16,  -5.97902822e-02,
-           -1.38777878e-17,   2.58444253e-01,  -2.77555756e-17,
+            5.55111512e-17,  -5.97902822e-02,   8.01346029e-01,
+            2.58444253e-01,  -1.66533454e-16,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  5.55111512e-17,   8.01346029e-01,  -5.97902822e-02,
+            2.58444253e-01,  -9.71445147e-17,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.27784077e-01,   6.93889390e-18,  -1.12196967e-01,
-           -4.16333634e-17,   8.84412890e-01,   3.46944695e-17,
+         [ -6.93889390e-18,   2.27784077e-01,  -1.12196967e-01,
+            8.84412890e-01,  -2.77555756e-17,   3.46944695e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.12196967e-01,   8.67361738e-17,   2.27784077e-01,
-           -2.77555756e-17,   8.84412890e-01,  -1.56125113e-17,
+         [  7.45931095e-17,  -1.12196967e-01,   2.27784077e-01,
+            8.84412890e-01,  -6.59194921e-17,   1.90819582e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -5.97902822e-02,   8.32667268e-17,   8.01346029e-01,
-           -1.11022302e-16,   2.58444253e-01,   0.00000000e+00,
+         [  5.55111512e-17,  -5.97902822e-02,   8.01346029e-01,
+            2.58444253e-01,  -1.66533454e-16,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  0.00000000e+00,   9.30568156e-01,   6.94318442e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE3_f1_C0': array([[  9.30568156e-01,   0.00000000e+00,   6.94318442e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.88651178e-17,   6.69990522e-01,   3.30009478e-01,
+         [  6.69990522e-01,  -1.88651178e-17,   3.30009478e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.77555756e-17,   3.30009478e-01,   6.69990522e-01,
+         [  3.30009478e-01,   2.77555756e-17,   6.69990522e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,   6.94318442e-02,   9.30568156e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2': array([[ 0.93056816,  0.06943184,  0.        ],
-         [ 0.66999052,  0.33000948,  0.        ],
-         [ 0.33000948,  0.66999052,  0.        ],
-         [ 0.06943184,  0.93056816,  0.        ]]), 'FE1_f1': array([[  9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
+         [  6.94318442e-02,   5.55111512e-17,   9.30568156e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE3_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f1': array([[  9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
          [  6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
          [  3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
          [  6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE1_f0': array([[  0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
          [ -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
          [  2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
-         [  5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE3_f2_C0': array([[  8.01346029e-01,  -5.97902822e-02,   0.00000000e+00,
+         [  5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE3_f2_C0': array([[ 0.93056816,  0.06943184,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.66999052,  0.33000948,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.33000948,  0.66999052,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.06943184,  0.93056816,  0.        ,  0.        ,  0.        ,
+           0.        ]]), 'FE3_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.93056816,  0.06943184,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.66999052,  0.33000948,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.33000948,  0.66999052,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.06943184,  0.93056816,
+           0.        ]]), 'FE1_f2': array([[ 0.93056816,  0.06943184,  0.        ],
+         [ 0.66999052,  0.33000948,  0.        ],
+         [ 0.33000948,  0.66999052,  0.        ],
+         [ 0.06943184,  0.93056816,  0.        ]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.01346029e-01,  -5.97902822e-02,   0.00000000e+00,
+           -5.55111512e-17,  -2.77555756e-17,   2.58444253e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.27784077e-01,  -1.12196967e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   8.84412890e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.12196967e-01,   2.27784077e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   8.84412890e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -5.97902822e-02,   8.01346029e-01,   0.00000000e+00,
+            5.55111512e-17,  -1.11022302e-16,   2.58444253e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0': array([[  8.01346029e-01,  -5.97902822e-02,   0.00000000e+00,
            -5.55111512e-17,  -2.77555756e-17,   2.58444253e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -12157,7 +12249,7 @@ Compiler stage 2: Computing intermediate representation
             5.55111512e-17,  -1.11022302e-16,   2.58444253e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.93056816,  0.06943184,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -12168,155 +12260,114 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.33000948,  0.66999052,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.06943184,  0.93056816,  0.        ]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
+           0.        ,  0.        ,  0.06943184,  0.93056816,  0.        ]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE3_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  8.01346029e-01,   1.04083409e-16,  -5.97902822e-02,
+           -1.38777878e-17,   2.58444253e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.27784077e-01,   6.93889390e-18,  -1.12196967e-01,
+           -4.16333634e-17,   8.84412890e-01,   3.46944695e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.12196967e-01,   8.67361738e-17,   2.27784077e-01,
+           -2.77555756e-17,   8.84412890e-01,  -1.56125113e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -5.97902822e-02,   8.32667268e-17,   8.01346029e-01,
+           -1.11022302e-16,   2.58444253e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.93056816,  0.06943184,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.66999052,  0.33000948,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.33000948,  0.66999052,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.06943184,  0.93056816,
-           0.        ]]), 'FE2_f2_C0': array([[ 0.93056816,  0.06943184,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.66999052,  0.33000948,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.33000948,  0.66999052,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.06943184,  0.93056816,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE3_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.01346029e-01,  -5.97902822e-02,   0.00000000e+00,
-           -5.55111512e-17,  -2.77555756e-17,   2.58444253e-01,
+            8.01346029e-01,   1.04083409e-16,  -5.97902822e-02,
+           -1.38777878e-17,   2.58444253e-01,  -2.77555756e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.27784077e-01,  -1.12196967e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   8.84412890e-01,
+            2.27784077e-01,   6.93889390e-18,  -1.12196967e-01,
+           -4.16333634e-17,   8.84412890e-01,   3.46944695e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.12196967e-01,   2.27784077e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   8.84412890e-01,
+           -1.12196967e-01,   8.67361738e-17,   2.27784077e-01,
+           -2.77555756e-17,   8.84412890e-01,  -1.56125113e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -5.97902822e-02,   8.01346029e-01,   0.00000000e+00,
-            5.55111512e-17,  -1.11022302e-16,   2.58444253e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  9.30568156e-01,   0.00000000e+00,   6.94318442e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.69990522e-01,  -1.88651178e-17,   3.30009478e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  3.30009478e-01,   2.77555756e-17,   6.69990522e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.94318442e-02,   5.55111512e-17,   9.30568156e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE3_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -5.97902822e-02,   8.32667268e-17,   8.01346029e-01,
+           -1.11022302e-16,   2.58444253e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   9.30568156e-01,   6.94318442e-02],
+            9.30568156e-01,   0.00000000e+00,   6.94318442e-02],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.88651178e-17,   6.69990522e-01,   3.30009478e-01],
+            6.69990522e-01,  -1.88651178e-17,   3.30009478e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   3.30009478e-01,   6.69990522e-01],
+            3.30009478e-01,   2.77555756e-17,   6.69990522e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   6.94318442e-02,   9.30568156e-01]]), 'FE3_f0_C0': array([[  5.55111512e-17,   8.01346029e-01,  -5.97902822e-02,
-            2.58444253e-01,  -9.71445147e-17,  -2.77555756e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -6.93889390e-18,   2.27784077e-01,  -1.12196967e-01,
-            8.84412890e-01,  -2.77555756e-17,   3.46944695e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.94318442e-02,   5.55111512e-17,   9.30568156e-01]]), 'FE3_f0_C0': array([[  0.00000000e+00,   9.30568156e-01,   6.94318442e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.45931095e-17,  -1.12196967e-01,   2.27784077e-01,
-            8.84412890e-01,  -6.59194921e-17,   1.90819582e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.88651178e-17,   6.69990522e-01,   3.30009478e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,  -5.97902822e-02,   8.01346029e-01,
-            2.58444253e-01,  -1.66533454e-16,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   8.01346029e-01,  -5.97902822e-02,
-            2.58444253e-01,  -9.71445147e-17,  -2.77555756e-17,
+         [  2.77555756e-17,   3.30009478e-01,   6.69990522e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.55111512e-17,   6.94318442e-02,   9.30568156e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -6.93889390e-18,   2.27784077e-01,  -1.12196967e-01,
-            8.84412890e-01,  -2.77555756e-17,   3.46944695e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.45931095e-17,  -1.12196967e-01,   2.27784077e-01,
-            8.84412890e-01,  -6.59194921e-17,   1.90819582e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,  -5.97902822e-02,   8.01346029e-01,
-            2.58444253e-01,  -1.66533454e-16,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]])}
   
-  name_map: {'FE2_f0_C0_D10': ['FE2_f1_C0_D10', 'FE2_f2_C0_D10'], 'FE2_f0_C1_D01': ['FE2_f1_C1_D01', 'FE2_f2_C1_D01'], 'FE2_f0_C0_D01': ['FE2_f1_C0_D01', 'FE2_f2_C0_D01'], 'FE0_f0': ['FE0_f1', 'FE0_f2'], 'FE2_f0_C1_D10': ['FE2_f1_C1_D10', 'FE2_f2_C1_D10']}
+  name_map: {'FE3_f0_C0_D10': ['FE3_f1_C0_D10', 'FE3_f2_C0_D10'], 'FE3_f0_C0_D01': ['FE3_f1_C0_D01', 'FE3_f2_C0_D01'], 'FE3_f0_C1_D01': ['FE3_f1_C1_D01', 'FE3_f2_C1_D01'], 'FE0_f0': ['FE0_f1', 'FE0_f2'], 'FE3_f0_C1_D10': ['FE3_f1_C1_D10', 'FE3_f2_C1_D10']}
   
-  inv_name_map: {'FE2_f1_C1_D01': 'FE2_f0_C1_D01', 'FE2_f2_C0_D10': 'FE2_f0_C0_D10', 'FE0_f0': 'FE0_f0', 'FE0_f1': 'FE0_f0', 'FE0_f2': 'FE0_f0', 'FE2_f0_C1_D01': 'FE2_f0_C1_D01', 'FE2_f2_C0': 'FE2_f2_C0', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0_D01': 'FE2_f0_C0_D01', 'FE3_f1_C1': 'FE3_f1_C1', 'FE3_f1_C0': 'FE3_f1_C0', 'FE2_f0_C0': 'FE2_f0_C0', 'FE2_f2_C1_D01': 'FE2_f0_C1_D01', 'FE2_f1_C0_D10': 'FE2_f0_C0_D10', 'FE1_f2': 'FE1_f2', 'FE1_f1': 'FE1_f1', 'FE1_f0': 'FE1_f0', 'FE3_f2_C0': 'FE3_f2_ [...]
+  inv_name_map: {'FE0_f0': 'FE0_f0', 'FE0_f1': 'FE0_f0', 'FE0_f2': 'FE0_f0', 'FE3_f2_C0_D10': 'FE3_f0_C0_D10', 'FE3_f1_C0_D01': 'FE3_f0_C0_D01', 'FE2_f2_C0': 'FE2_f2_C0', 'FE2_f0_C2': 'FE2_f0_C2', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0': 'FE2_f0_C0', 'FE3_f1_C1': 'FE3_f1_C1', 'FE3_f1_C0': 'FE3_f1_C0', 'FE2_f2_C2': 'FE2_f2_C2', 'FE3_f1_C1_D01': 'FE3_f0_C1_D01', 'FE3_f2_C1_D01': 'FE3_f0_C1_D01', 'FE1_f1': 'FE1_f1', 'FE1_f0': 'FE1_f0', 'FE3_f2_C0': 'FE3_f2_C0', 'FE3_f2_C1': 'FE3_f2_C1', 'FE2_ [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_f0': array([[ 0.],
          [ 0.],
          [ 0.],
-         [ 0.]]), 'FE2_f0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE1_f0': array([[ 0.93056816,  0.06943184],
-         [ 0.66999052,  0.33000948],
-         [ 0.33000948,  0.66999052],
-         [ 0.06943184,  0.93056816]]), 'FE3_f0_C0': array([[ 0.80134603, -0.05979028,  0.25844425],
+         [ 0.]]), 'FE2_f0_C0': array([[ 0.80134603, -0.05979028,  0.25844425],
          [ 0.22778408, -0.11219697,  0.88441289],
          [-0.11219697,  0.22778408,  0.88441289],
-         [-0.05979028,  0.80134603,  0.25844425]])}
+         [-0.05979028,  0.80134603,  0.25844425]]), 'FE1_f0': array([[ 0.93056816,  0.06943184],
+         [ 0.66999052,  0.33000948],
+         [ 0.33000948,  0.66999052],
+         [ 0.06943184,  0.93056816]]), 'FE3_f0_C0_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE2_f1_C1_D01': ('FE2_f0_C0_D01', (7, [3, 5]), False, False), 'FE2_f2_C0_D10': ('FE2_f0_C0_D01', (5, [0, 1]), False, False), 'FE0_f0': ('FE0_f0', (), True, False), 'FE0_f1': ('FE0_f0', (), True, False), 'FE0_f2': ('FE0_f0', (), True, False), 'FE2_f0_C1_D01': ('FE2_f0_C0_D01', (7, [3, 5]), False, False), 'FE2_f2_C0': ('FE1_f0', (11, [0, 1]), False, False), 'FE2_f0_C1': ('FE1_f0', (6, [4, 5]), False, False), 'FE2_f0_C0_D01': ('FE2_f0_C0_D01', (4, [0, 2]), False, False), 'FE3_f1_C1': (' [...]
+  {'FE0_f0': ('FE0_f0', (), True, False), 'FE0_f1': ('FE0_f0', (), True, False), 'FE0_f2': ('FE0_f0', (), True, False), 'FE3_f2_C0_D10': ('FE3_f0_C0_D01', (14, [0, 1]), False, False), 'FE3_f1_C0_D01': ('FE3_f0_C0_D01', (13, [0, 2]), False, False), 'FE2_f2_C0': ('FE2_f0_C0', (9, [0, 1, 5]), False, False), 'FE2_f0_C2': ('FE1_f0', (5, [13, 14]), False, False), 'FE2_f0_C1': ('FE2_f0_C0', (4, [7, 8, 9]), False, False), 'FE2_f0_C0': ('FE2_f0_C0', (3, [1, 2, 3]), False, False), 'FE3_f1_C1': ('F [...]
   Transforming exterior facet integral 0
   Reusing element from cache
   Reusing element from cache
@@ -12369,7 +12420,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00247 seconds
+  1350 entries computed in 0.00208 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12379,7 +12430,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00338 seconds
+  1350 entries computed in 0.00202 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12389,7 +12440,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00294 seconds
+  1350 entries computed in 0.00215 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12398,6 +12449,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -12422,67 +12474,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00325 seconds
-  Shape of reference tensor: (15, 15, 6)
-  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  Reusing element from cache
-  1350 entries computed in 0.00322 seconds
-  Shape of reference tensor: (15, 15, 6)
-  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  Reusing element from cache
-  1350 entries computed in 0.00314 seconds
-  Shape of reference tensor: (15, 15, 6)
-  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  Reusing element from cache
-  1350 entries computed in 0.00313 seconds
-  Shape of reference tensor: (15, 15, 6)
-  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  Reusing element from cache
-  1350 entries computed in 0.00311 seconds
-  Shape of reference tensor: (15, 15, 6)
-  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  Reusing element from cache
-  1350 entries computed in 0.00314 seconds
-  Shape of reference tensor: (15, 15, 6)
-  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
-  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  Reusing element from cache
-  1350 entries computed in 0.00313 seconds
+  1350 entries computed in 0.00283 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12492,7 +12484,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00522 seconds
+  1350 entries computed in 0.00284 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12502,7 +12494,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00319 seconds
+  1350 entries computed in 0.00284 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12512,7 +12504,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00311 seconds
+  1350 entries computed in 0.00283 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12522,7 +12514,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.0031 seconds
+  1350 entries computed in 0.0029 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12532,7 +12524,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00305 seconds
+  1350 entries computed in 0.00278 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12542,7 +12534,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00303 seconds
+  1350 entries computed in 0.00276 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12552,7 +12544,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00304 seconds
+  1350 entries computed in 0.0028 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12562,7 +12554,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00303 seconds
+  1350 entries computed in 0.00282 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12572,7 +12564,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00302 seconds
+  1350 entries computed in 0.00275 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12582,7 +12574,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00382 seconds
+  1350 entries computed in 0.00281 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -12592,268 +12584,92 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  1350 entries computed in 0.00317 seconds
+  1350 entries computed in 0.00279 seconds
   Shape of reference tensor: (15, 15, 6)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   External multi index:  rank = 0 dims = [] indices = [[]]
+  Precomputing integrals on reference element
+  Reusing element from cache
+  Reusing element from cache
+  1350 entries computed in 0.00289 seconds
+  Shape of reference tensor: (15, 15, 6)
+  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  External multi index:  rank = 0 dims = [] indices = [[]]
+  Precomputing integrals on reference element
+  Reusing element from cache
+  Reusing element from cache
+  1350 entries computed in 0.00286 seconds
+  Shape of reference tensor: (15, 15, 6)
+  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  External multi index:  rank = 0 dims = [] indices = [[]]
+  Precomputing integrals on reference element
+  Reusing element from cache
+  Reusing element from cache
+  1350 entries computed in 0.00289 seconds
+  Shape of reference tensor: (15, 15, 6)
+  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  External multi index:  rank = 0 dims = [] indices = [[]]
+  Precomputing integrals on reference element
+  Reusing element from cache
+  Reusing element from cache
+  1350 entries computed in 0.00285 seconds
+  Shape of reference tensor: (15, 15, 6)
+  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  External multi index:  rank = 0 dims = [] indices = [[]]
+  Precomputing integrals on reference element
+  Reusing element from cache
+  Reusing element from cache
+  1350 entries computed in 0.00286 seconds
+  Shape of reference tensor: (15, 15, 6)
+  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  External multi index:  rank = 0 dims = [] indices = [[]]
+  Precomputing integrals on reference element
+  Reusing element from cache
+  Reusing element from cache
+  1350 entries computed in 0.00285 seconds
+  Shape of reference tensor: (15, 15, 6)
+  Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  Internal multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  External multi index:  rank = 0 dims = [] indices = [[]]
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing quadrature representation
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing quadrature representation
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  
-  QG-utils, psi_tables:
-  {16: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-           1.,  1.,  1.]])}}}, FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {None: {(0, 1): array([[ -2.50971524e+00,  -1.69178745e+00,  -5.49989934e-01,
-            4.79775683e-01,  -1.52692501e+00,  -9.38033307e-01,
-           -1.15961854e-01,   6.25448862e-01,  -2.44658209e-01,
-            4.54053611e-02,   4.50323583e-01,   8.15511680e-01,
-            7.38132022e-01,   7.99159507e-01,   8.84351663e-01,
-            9.61184859e-01],
-         [  5.60662627e-15,   6.13398221e-15,   7.18869408e-15,
-            8.10462808e-15,   6.21724894e-15,   6.77236045e-15,
-            7.49400542e-15,   8.10462808e-15,   7.60502772e-15,
-            7.68829445e-15,   7.96585020e-15,   8.43769499e-15,
-            8.93729535e-15,   8.40993941e-15,   8.46545056e-15,
-            8.65973959e-15],
-         [ -7.71583216e-01,   1.07372055e-01,   1.33436173e+00,
-            2.44096054e+00,  -7.71583216e-01,   1.07372055e-01,
-            1.33436173e+00,   2.44096054e+00,  -7.71583216e-01,
-            1.07372055e-01,   1.33436173e+00,   2.44096054e+00,
-           -7.71583216e-01,   1.07372055e-01,   1.33436173e+00,
-            2.44096054e+00],
-         [  2.61867978e-01,   2.00840493e-01,   1.15648337e-01,
-            3.88151405e-02,   1.24465821e+00,   9.54594639e-01,
-            5.49676417e-01,   1.84488320e-01,   2.52692501e+00,
-            1.93803331e+00,   1.11596185e+00,   3.74551138e-01,
-            3.50971524e+00,   2.69178745e+00,   1.54998993e+00,
-            5.20224317e-01],
-         [  3.28129845e+00,   1.58441540e+00,  -7.84371796e-01,
-           -2.92073623e+00,   2.29850822e+00,   8.30661252e-01,
-           -1.21839988e+00,  -3.06640940e+00,   1.01624142e+00,
-           -1.52777416e-01,  -1.78468531e+00,  -3.25647222e+00,
-            3.34511938e-02,  -9.06531562e-01,  -2.21871339e+00,
-           -3.40214540e+00],
-         [ -2.61867978e-01,  -2.00840493e-01,  -1.15648337e-01,
-           -3.88151405e-02,  -1.24465821e+00,  -9.54594639e-01,
-           -5.49676417e-01,  -1.84488320e-01,  -2.52692501e+00,
-           -1.93803331e+00,  -1.11596185e+00,  -3.74551138e-01,
-           -3.50971524e+00,  -2.69178745e+00,  -1.54998993e+00,
-           -5.20224317e-01]]), (1, 0): array([[-2.50971524, -1.69178745, -0.54998993,  0.47977568, -1.52692501,
-          -0.93803331, -0.11596185,  0.62544886, -0.24465821,  0.04540536,
-           0.45032358,  0.81551168,  0.73813202,  0.79915951,  0.88435166,
-           0.96118486],
-         [-0.73813202, -0.79915951, -0.88435166, -0.96118486,  0.24465821,
-          -0.04540536, -0.45032358, -0.81551168,  1.52692501,  0.93803331,
-           0.11596185, -0.62544886,  2.50971524,  1.69178745,  0.54998993,
-          -0.47977568],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.22841678,  1.10737205,  2.33436173,  3.44096054,  0.22841678,
-           1.10737205,  2.33436173,  3.44096054,  0.22841678,  1.10737205,
-           2.33436173,  3.44096054,  0.22841678,  1.10737205,  2.33436173,
-           3.44096054],
-         [-0.22841678, -1.10737205, -2.33436173, -3.44096054, -0.22841678,
-          -1.10737205, -2.33436173, -3.44096054, -0.22841678, -1.10737205,
-          -2.33436173, -3.44096054, -0.22841678, -1.10737205, -2.33436173,
-          -3.44096054],
-         [ 3.24784726,  2.49094696,  1.4343416 ,  0.48140918,  1.2822668 ,
-           0.98343867,  0.56628544,  0.19006282, -1.2822668 , -0.98343867,
-          -0.56628544, -0.19006282, -3.24784726, -2.49094696, -1.4343416 ,
-          -0.48140918]]), (0, 0): array([[ 0.66233382,  0.2327681 , -0.08718888, -0.09622691,  0.1664375 ,
-          -0.01501169, -0.12331911, -0.07610172, -0.1175178 , -0.12474229,
-          -0.09965108, -0.04186759, -0.05689514, -0.04516801, -0.02724027,
-          -0.00951546],
-         [-0.05689514, -0.04516801, -0.02724027, -0.00951546, -0.1175178 ,
-          -0.12474229, -0.09965108, -0.04186759,  0.1664375 , -0.01501169,
-          -0.12331911, -0.07610172,  0.66233382,  0.2327681 , -0.08718888,
-          -0.09622691],
-         [-0.05058242, -0.12355891,  0.09756515,  0.61978605, -0.05058242,
-          -0.12355891,  0.09756515,  0.61978605, -0.05058242, -0.12355891,
-           0.09756515,  0.61978605, -0.05058242, -0.12355891,  0.09756515,
-           0.61978605],
-         [ 0.01495376,  0.05560129,  0.06749126,  0.03339034,  0.07107521,
-           0.26427286,  0.3207859 ,  0.15870426,  0.14429802,  0.53653098,
-           0.65126466,  0.32220392,  0.20041947,  0.74520255,  0.9045593 ,
-           0.44751784],
-         [ 0.20041947,  0.74520255,  0.9045593 ,  0.44751784,  0.14429802,
-           0.53653098,  0.65126466,  0.32220392,  0.07107521,  0.26427286,
-           0.3207859 ,  0.15870426,  0.01495376,  0.05560129,  0.06749126,
-           0.03339034],
-         [ 0.22977051,  0.13515498,  0.04481344,  0.00504814,  0.78628949,
-           0.46250905,  0.15335448,  0.01727508,  0.78628949,  0.46250905,
-           0.15335448,  0.01727508,  0.22977051,  0.13515498,  0.04481344,
-           0.00504814]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1., -1., -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.,  1.,  1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.],
-          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-           -1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
-            1.,  1.,  1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
-            0.,  0.,  0.]]]), (0, 0): array([[[ 0.87742881,  0.67294686,  0.38749748,  0.13005608,  0.63173125,
-            0.48450833,  0.27899046,  0.09363778,  0.31116455,  0.23864866,
-            0.1374191 ,  0.04612208,  0.06546699,  0.05021012,  0.02891208,
-            0.00970379],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ]],
-  
-         [[ 0.06546699,  0.05021012,  0.02891208,  0.00970379,  0.31116455,
-            0.23864866,  0.1374191 ,  0.04612208,  0.63173125,  0.48450833,
-            0.27899046,  0.09363778,  0.87742881,  0.67294686,  0.38749748,
-            0.13005608],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ]],
-  
-         [[ 0.0571042 ,  0.27684301,  0.58359043,  0.86024014,  0.0571042 ,
-            0.27684301,  0.58359043,  0.86024014,  0.0571042 ,  0.27684301,
-            0.58359043,  0.86024014,  0.0571042 ,  0.27684301,  0.58359043,
-            0.86024014],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ],
-          [ 0.87742881,  0.67294686,  0.38749748,  0.13005608,  0.63173125,
-            0.48450833,  0.27899046,  0.09363778,  0.31116455,  0.23864866,
-            0.1374191 ,  0.04612208,  0.06546699,  0.05021012,  0.02891208,
-            0.00970379]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ],
-          [ 0.06546699,  0.05021012,  0.02891208,  0.00970379,  0.31116455,
-            0.23864866,  0.1374191 ,  0.04612208,  0.63173125,  0.48450833,
-            0.27899046,  0.09363778,  0.87742881,  0.67294686,  0.38749748,
-            0.13005608]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ],
-          [ 0.0571042 ,  0.27684301,  0.58359043,  0.86024014,  0.0571042 ,
-            0.27684301,  0.58359043,  0.86024014,  0.0571042 ,  0.27684301,
-            0.58359043,  0.86024014,  0.0571042 ,  0.27684301,  0.58359043,
-            0.86024014]]])}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): array([[[ -2.50971524e+00,  -1.69178745e+00,  -5.49989934e-01,
+  QG-utils, psi_tables:
+  {16: {MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): array([[[ -2.50971524e+00,  -1.69178745e+00,  -5.49989934e-01,
              4.79775683e-01,  -1.52692501e+00,  -9.38033307e-01,
             -1.15961854e-01,   6.25448862e-01,  -2.44658209e-01,
              4.54053611e-02,   4.50323583e-01,   8.15511680e-01,
@@ -12872,12 +12688,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
   
-         [[  5.60662627e-15,   6.13398221e-15,   7.18869408e-15,
-             8.10462808e-15,   6.21724894e-15,   6.77236045e-15,
-             7.49400542e-15,   8.10462808e-15,   7.60502772e-15,
-             7.68829445e-15,   7.96585020e-15,   8.43769499e-15,
-             8.93729535e-15,   8.40993941e-15,   8.46545056e-15,
-             8.65973959e-15],
+         [[  5.05151476e-15,   6.07847106e-15,   6.85562718e-15,
+             6.88338275e-15,   5.88418203e-15,   6.85562718e-15,
+             7.27196081e-15,   6.99440506e-15,   7.16093851e-15,
+             7.85482790e-15,   7.85482790e-15,   7.32747196e-15,
+             7.93809463e-15,   8.52096171e-15,   8.35442826e-15,
+             7.54951657e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -12992,12 +12808,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
-          [  5.60662627e-15,   6.13398221e-15,   7.18869408e-15,
-             8.10462808e-15,   6.21724894e-15,   6.77236045e-15,
-             7.49400542e-15,   8.10462808e-15,   7.60502772e-15,
-             7.68829445e-15,   7.96585020e-15,   8.43769499e-15,
-             8.93729535e-15,   8.40993941e-15,   8.46545056e-15,
-             8.65973959e-15],
+          [  5.05151476e-15,   6.07847106e-15,   6.85562718e-15,
+             6.88338275e-15,   5.88418203e-15,   6.85562718e-15,
+             7.27196081e-15,   6.99440506e-15,   7.16093851e-15,
+             7.85482790e-15,   7.85482790e-15,   7.32747196e-15,
+             7.93809463e-15,   8.52096171e-15,   8.35442826e-15,
+             7.54951657e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -13522,7 +13338,164 @@ Compiler stage 2: Computing intermediate representation
           [ 0.0571042 ,  0.27684301,  0.58359043,  0.86024014,  0.0571042 ,
             0.27684301,  0.58359043,  0.86024014,  0.0571042 ,  0.27684301,
             0.58359043,  0.86024014,  0.0571042 ,  0.27684301,  0.58359043,
-            0.86024014]]])}}}, MixedElement(*[MixedElement(*[FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None)], **{'value_shape': (2,) }), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): array([[[  [...]
+            0.86024014]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+           1.,  1.,  1.]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1., -1., -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.]],
+  
+         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.,  1.,  1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.],
+          [-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
+           -1., -1., -1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
+            1.,  1.,  1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
+            0.,  0.,  0.]]]), (0, 0): array([[[ 0.87742881,  0.67294686,  0.38749748,  0.13005608,  0.63173125,
+            0.48450833,  0.27899046,  0.09363778,  0.31116455,  0.23864866,
+            0.1374191 ,  0.04612208,  0.06546699,  0.05021012,  0.02891208,
+            0.00970379],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ]],
+  
+         [[ 0.06546699,  0.05021012,  0.02891208,  0.00970379,  0.31116455,
+            0.23864866,  0.1374191 ,  0.04612208,  0.63173125,  0.48450833,
+            0.27899046,  0.09363778,  0.87742881,  0.67294686,  0.38749748,
+            0.13005608],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ]],
+  
+         [[ 0.0571042 ,  0.27684301,  0.58359043,  0.86024014,  0.0571042 ,
+            0.27684301,  0.58359043,  0.86024014,  0.0571042 ,  0.27684301,
+            0.58359043,  0.86024014,  0.0571042 ,  0.27684301,  0.58359043,
+            0.86024014],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ],
+          [ 0.87742881,  0.67294686,  0.38749748,  0.13005608,  0.63173125,
+            0.48450833,  0.27899046,  0.09363778,  0.31116455,  0.23864866,
+            0.1374191 ,  0.04612208,  0.06546699,  0.05021012,  0.02891208,
+            0.00970379]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ],
+          [ 0.06546699,  0.05021012,  0.02891208,  0.00970379,  0.31116455,
+            0.23864866,  0.1374191 ,  0.04612208,  0.63173125,  0.48450833,
+            0.27899046,  0.09363778,  0.87742881,  0.67294686,  0.38749748,
+            0.13005608]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ],
+          [ 0.0571042 ,  0.27684301,  0.58359043,  0.86024014,  0.0571042 ,
+            0.27684301,  0.58359043,  0.86024014,  0.0571042 ,  0.27684301,
+            0.58359043,  0.86024014,  0.0571042 ,  0.27684301,  0.58359043,
+            0.86024014]]])}}}, MixedElement(VectorElement(FiniteElement('Discontinuous Lagrange', triangle, 2), dim=2), FiniteElement('Discontinuous Lagrange', triangle, 1)): {None: {None: {(0, 1): array([[[ -2.50971524e+00,  -1.69178745e+00,  -5.49989934e-01,
              4.79775683e-01,  -1.52692501e+00,  -9.38033307e-01,
             -1.15961854e-01,   6.25448862e-01,  -2.44658209e-01,
              4.54053611e-02,   4.50323583e-01,   8.15511680e-01,
@@ -13541,12 +13514,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
   
-         [[  5.60662627e-15,   6.13398221e-15,   7.18869408e-15,
-             8.10462808e-15,   6.21724894e-15,   6.77236045e-15,
-             7.49400542e-15,   8.10462808e-15,   7.60502772e-15,
-             7.68829445e-15,   7.96585020e-15,   8.43769499e-15,
-             8.93729535e-15,   8.40993941e-15,   8.46545056e-15,
-             8.65973959e-15],
+         [[  5.05151476e-15,   6.07847106e-15,   6.85562718e-15,
+             6.88338275e-15,   5.88418203e-15,   6.85562718e-15,
+             7.27196081e-15,   6.99440506e-15,   7.16093851e-15,
+             7.85482790e-15,   7.85482790e-15,   7.32747196e-15,
+             7.93809463e-15,   8.52096171e-15,   8.35442826e-15,
+             7.54951657e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -13661,12 +13634,12 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
-          [  5.60662627e-15,   6.13398221e-15,   7.18869408e-15,
-             8.10462808e-15,   6.21724894e-15,   6.77236045e-15,
-             7.49400542e-15,   8.10462808e-15,   7.60502772e-15,
-             7.68829445e-15,   7.96585020e-15,   8.43769499e-15,
-             8.93729535e-15,   8.40993941e-15,   8.46545056e-15,
-             8.65973959e-15],
+          [  5.05151476e-15,   6.07847106e-15,   6.85562718e-15,
+             6.88338275e-15,   5.88418203e-15,   6.85562718e-15,
+             7.27196081e-15,   6.99440506e-15,   7.16093851e-15,
+             7.85482790e-15,   7.85482790e-15,   7.32747196e-15,
+             7.93809463e-15,   8.52096171e-15,   8.35442826e-15,
+             7.54951657e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -14191,7 +14164,88 @@ Compiler stage 2: Computing intermediate representation
           [ 0.0571042 ,  0.27684301,  0.58359043,  0.86024014,  0.0571042 ,
             0.27684301,  0.58359043,  0.86024014,  0.0571042 ,  0.27684301,
             0.58359043,  0.86024014,  0.0571042 ,  0.27684301,  0.58359043,
-            0.86024014]]])}}}}}
+            0.86024014]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 2): {None: {None: {(0, 1): array([[ -2.50971524e+00,  -1.69178745e+00,  -5.49989934e-01,
+            4.79775683e-01,  -1.52692501e+00,  -9.38033307e-01,
+           -1.15961854e-01,   6.25448862e-01,  -2.44658209e-01,
+            4.54053611e-02,   4.50323583e-01,   8.15511680e-01,
+            7.38132022e-01,   7.99159507e-01,   8.84351663e-01,
+            9.61184859e-01],
+         [  5.05151476e-15,   6.07847106e-15,   6.85562718e-15,
+            6.88338275e-15,   5.88418203e-15,   6.85562718e-15,
+            7.27196081e-15,   6.99440506e-15,   7.16093851e-15,
+            7.85482790e-15,   7.85482790e-15,   7.32747196e-15,
+            7.93809463e-15,   8.52096171e-15,   8.35442826e-15,
+            7.54951657e-15],
+         [ -7.71583216e-01,   1.07372055e-01,   1.33436173e+00,
+            2.44096054e+00,  -7.71583216e-01,   1.07372055e-01,
+            1.33436173e+00,   2.44096054e+00,  -7.71583216e-01,
+            1.07372055e-01,   1.33436173e+00,   2.44096054e+00,
+           -7.71583216e-01,   1.07372055e-01,   1.33436173e+00,
+            2.44096054e+00],
+         [  2.61867978e-01,   2.00840493e-01,   1.15648337e-01,
+            3.88151405e-02,   1.24465821e+00,   9.54594639e-01,
+            5.49676417e-01,   1.84488320e-01,   2.52692501e+00,
+            1.93803331e+00,   1.11596185e+00,   3.74551138e-01,
+            3.50971524e+00,   2.69178745e+00,   1.54998993e+00,
+            5.20224317e-01],
+         [  3.28129845e+00,   1.58441540e+00,  -7.84371796e-01,
+           -2.92073623e+00,   2.29850822e+00,   8.30661252e-01,
+           -1.21839988e+00,  -3.06640940e+00,   1.01624142e+00,
+           -1.52777416e-01,  -1.78468531e+00,  -3.25647222e+00,
+            3.34511938e-02,  -9.06531562e-01,  -2.21871339e+00,
+           -3.40214540e+00],
+         [ -2.61867978e-01,  -2.00840493e-01,  -1.15648337e-01,
+           -3.88151405e-02,  -1.24465821e+00,  -9.54594639e-01,
+           -5.49676417e-01,  -1.84488320e-01,  -2.52692501e+00,
+           -1.93803331e+00,  -1.11596185e+00,  -3.74551138e-01,
+           -3.50971524e+00,  -2.69178745e+00,  -1.54998993e+00,
+           -5.20224317e-01]]), (1, 0): array([[-2.50971524, -1.69178745, -0.54998993,  0.47977568, -1.52692501,
+          -0.93803331, -0.11596185,  0.62544886, -0.24465821,  0.04540536,
+           0.45032358,  0.81551168,  0.73813202,  0.79915951,  0.88435166,
+           0.96118486],
+         [-0.73813202, -0.79915951, -0.88435166, -0.96118486,  0.24465821,
+          -0.04540536, -0.45032358, -0.81551168,  1.52692501,  0.93803331,
+           0.11596185, -0.62544886,  2.50971524,  1.69178745,  0.54998993,
+          -0.47977568],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.22841678,  1.10737205,  2.33436173,  3.44096054,  0.22841678,
+           1.10737205,  2.33436173,  3.44096054,  0.22841678,  1.10737205,
+           2.33436173,  3.44096054,  0.22841678,  1.10737205,  2.33436173,
+           3.44096054],
+         [-0.22841678, -1.10737205, -2.33436173, -3.44096054, -0.22841678,
+          -1.10737205, -2.33436173, -3.44096054, -0.22841678, -1.10737205,
+          -2.33436173, -3.44096054, -0.22841678, -1.10737205, -2.33436173,
+          -3.44096054],
+         [ 3.24784726,  2.49094696,  1.4343416 ,  0.48140918,  1.2822668 ,
+           0.98343867,  0.56628544,  0.19006282, -1.2822668 , -0.98343867,
+          -0.56628544, -0.19006282, -3.24784726, -2.49094696, -1.4343416 ,
+          -0.48140918]]), (0, 0): array([[ 0.66233382,  0.2327681 , -0.08718888, -0.09622691,  0.1664375 ,
+          -0.01501169, -0.12331911, -0.07610172, -0.1175178 , -0.12474229,
+          -0.09965108, -0.04186759, -0.05689514, -0.04516801, -0.02724027,
+          -0.00951546],
+         [-0.05689514, -0.04516801, -0.02724027, -0.00951546, -0.1175178 ,
+          -0.12474229, -0.09965108, -0.04186759,  0.1664375 , -0.01501169,
+          -0.12331911, -0.07610172,  0.66233382,  0.2327681 , -0.08718888,
+          -0.09622691],
+         [-0.05058242, -0.12355891,  0.09756515,  0.61978605, -0.05058242,
+          -0.12355891,  0.09756515,  0.61978605, -0.05058242, -0.12355891,
+           0.09756515,  0.61978605, -0.05058242, -0.12355891,  0.09756515,
+           0.61978605],
+         [ 0.01495376,  0.05560129,  0.06749126,  0.03339034,  0.07107521,
+           0.26427286,  0.3207859 ,  0.15870426,  0.14429802,  0.53653098,
+           0.65126466,  0.32220392,  0.20041947,  0.74520255,  0.9045593 ,
+           0.44751784],
+         [ 0.20041947,  0.74520255,  0.9045593 ,  0.44751784,  0.14429802,
+           0.53653098,  0.65126466,  0.32220392,  0.07107521,  0.26427286,
+           0.3207859 ,  0.15870426,  0.01495376,  0.05560129,  0.06749126,
+           0.03339034],
+         [ 0.22977051,  0.13515498,  0.04481344,  0.00504814,  0.78628949,
+           0.46250905,  0.15335448,  0.01727508,  0.78628949,  0.46250905,
+           0.15335448,  0.01727508,  0.22977051,  0.13515498,  0.04481344,
+           0.00504814]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_D10': array([[-2.50971524, -0.73813202,  0.        ,  0.22841678, -0.22841678,
@@ -14227,84 +14281,84 @@ Compiler stage 2: Computing intermediate representation
          [ 0.96118486, -0.47977568,  0.        ,  3.44096054, -3.44096054,
           -0.48140918]]), 'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.50971524e+00,   5.60662627e-15,  -7.71583216e-01,
+           -2.50971524e+00,   5.05151476e-15,  -7.71583216e-01,
             2.61867978e-01,   3.28129845e+00,  -2.61867978e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.69178745e+00,   6.13398221e-15,   1.07372055e-01,
+           -1.69178745e+00,   6.07847106e-15,   1.07372055e-01,
             2.00840493e-01,   1.58441540e+00,  -2.00840493e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -5.49989934e-01,   7.18869408e-15,   1.33436173e+00,
+           -5.49989934e-01,   6.85562718e-15,   1.33436173e+00,
             1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.79775683e-01,   8.10462808e-15,   2.44096054e+00,
+            4.79775683e-01,   6.88338275e-15,   2.44096054e+00,
             3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.52692501e+00,   6.21724894e-15,  -7.71583216e-01,
+           -1.52692501e+00,   5.88418203e-15,  -7.71583216e-01,
             1.24465821e+00,   2.29850822e+00,  -1.24465821e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -9.38033307e-01,   6.77236045e-15,   1.07372055e-01,
+           -9.38033307e-01,   6.85562718e-15,   1.07372055e-01,
             9.54594639e-01,   8.30661252e-01,  -9.54594639e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.15961854e-01,   7.49400542e-15,   1.33436173e+00,
+           -1.15961854e-01,   7.27196081e-15,   1.33436173e+00,
             5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.25448862e-01,   8.10462808e-15,   2.44096054e+00,
+            6.25448862e-01,   6.99440506e-15,   2.44096054e+00,
             1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.44658209e-01,   7.60502772e-15,  -7.71583216e-01,
+           -2.44658209e-01,   7.16093851e-15,  -7.71583216e-01,
             2.52692501e+00,   1.01624142e+00,  -2.52692501e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.54053611e-02,   7.68829445e-15,   1.07372055e-01,
+            4.54053611e-02,   7.85482790e-15,   1.07372055e-01,
             1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.50323583e-01,   7.96585020e-15,   1.33436173e+00,
+            4.50323583e-01,   7.85482790e-15,   1.33436173e+00,
             1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.15511680e-01,   8.43769499e-15,   2.44096054e+00,
+            8.15511680e-01,   7.32747196e-15,   2.44096054e+00,
             3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.38132022e-01,   8.93729535e-15,  -7.71583216e-01,
+            7.38132022e-01,   7.93809463e-15,  -7.71583216e-01,
             3.50971524e+00,   3.34511938e-02,  -3.50971524e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.99159507e-01,   8.40993941e-15,   1.07372055e-01,
+            7.99159507e-01,   8.52096171e-15,   1.07372055e-01,
             2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.84351663e-01,   8.46545056e-15,   1.33436173e+00,
+            8.84351663e-01,   8.35442826e-15,   1.33436173e+00,
             1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.61184859e-01,   8.65973959e-15,   2.44096054e+00,
+            9.61184859e-01,   7.54951657e-15,   2.44096054e+00,
             5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_C1_D10': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D10': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -2.50971524, -0.73813202,  0.        ,  0.22841678,
           -0.22841678,  3.24784726,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -14351,7 +14405,7 @@ Compiler stage 2: Computing intermediate representation
           -2.33436173, -1.4343416 ,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.96118486, -0.47977568,  0.        ,  3.44096054,
-          -3.44096054, -0.48140918,  0.        ,  0.        ,  0.        ]]), 'FE2_C1_D10': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -3.44096054, -0.48140918,  0.        ,  0.        ,  0.        ]]), 'FE1_C1_D10': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -2.50971524, -0.73813202,  0.        ,  0.22841678,
           -0.22841678,  3.24784726,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -14398,148 +14452,148 @@ Compiler stage 2: Computing intermediate representation
           -2.33436173, -1.4343416 ,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.96118486, -0.47977568,  0.        ,  3.44096054,
-          -3.44096054, -0.48140918,  0.        ,  0.        ,  0.        ]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_C0_D10': array([[-2.50971524, -0.73813202,  0.        ,  0.22841678, -0.22841678,
-           3.24784726,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-1.69178745, -0.79915951,  0.        ,  1.10737205, -1.10737205,
-           2.49094696,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.54998993, -0.88435166,  0.        ,  2.33436173, -2.33436173,
-           1.4343416 ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.47977568, -0.96118486,  0.        ,  3.44096054, -3.44096054,
-           0.48140918,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-1.52692501,  0.24465821,  0.        ,  0.22841678, -0.22841678,
-           1.2822668 ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.93803331, -0.04540536,  0.        ,  1.10737205, -1.10737205,
-           0.98343867,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.11596185, -0.45032358,  0.        ,  2.33436173, -2.33436173,
-           0.56628544,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.62544886, -0.81551168,  0.        ,  3.44096054, -3.44096054,
-           0.19006282,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.24465821,  1.52692501,  0.        ,  0.22841678, -0.22841678,
-          -1.2822668 ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.04540536,  0.93803331,  0.        ,  1.10737205, -1.10737205,
-          -0.98343867,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.45032358,  0.11596185,  0.        ,  2.33436173, -2.33436173,
-          -0.56628544,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.81551168, -0.62544886,  0.        ,  3.44096054, -3.44096054,
-          -0.19006282,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.73813202,  2.50971524,  0.        ,  0.22841678, -0.22841678,
-          -3.24784726,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.79915951,  1.69178745,  0.        ,  1.10737205, -1.10737205,
-          -2.49094696,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.88435166,  0.54998993,  0.        ,  2.33436173, -2.33436173,
-          -1.4343416 ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.96118486, -0.47977568,  0.        ,  3.44096054, -3.44096054,
-          -0.48140918,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE2_C0_D01': array([[ -2.50971524e+00,   5.60662627e-15,  -7.71583216e-01,
+          -3.44096054, -0.48140918,  0.        ,  0.        ,  0.        ]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.]]), 'FE2_C0_D01': array([[ -2.50971524e+00,   5.05151476e-15,  -7.71583216e-01,
             2.61867978e-01,   3.28129845e+00,  -2.61867978e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.69178745e+00,   6.13398221e-15,   1.07372055e-01,
+         [ -1.69178745e+00,   6.07847106e-15,   1.07372055e-01,
             2.00840493e-01,   1.58441540e+00,  -2.00840493e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -5.49989934e-01,   7.18869408e-15,   1.33436173e+00,
+         [ -5.49989934e-01,   6.85562718e-15,   1.33436173e+00,
             1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.79775683e-01,   8.10462808e-15,   2.44096054e+00,
+         [  4.79775683e-01,   6.88338275e-15,   2.44096054e+00,
             3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.52692501e+00,   6.21724894e-15,  -7.71583216e-01,
+         [ -1.52692501e+00,   5.88418203e-15,  -7.71583216e-01,
             1.24465821e+00,   2.29850822e+00,  -1.24465821e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -9.38033307e-01,   6.77236045e-15,   1.07372055e-01,
+         [ -9.38033307e-01,   6.85562718e-15,   1.07372055e-01,
             9.54594639e-01,   8.30661252e-01,  -9.54594639e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.15961854e-01,   7.49400542e-15,   1.33436173e+00,
+         [ -1.15961854e-01,   7.27196081e-15,   1.33436173e+00,
             5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.25448862e-01,   8.10462808e-15,   2.44096054e+00,
+         [  6.25448862e-01,   6.99440506e-15,   2.44096054e+00,
             1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.44658209e-01,   7.60502772e-15,  -7.71583216e-01,
+         [ -2.44658209e-01,   7.16093851e-15,  -7.71583216e-01,
             2.52692501e+00,   1.01624142e+00,  -2.52692501e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.54053611e-02,   7.68829445e-15,   1.07372055e-01,
+         [  4.54053611e-02,   7.85482790e-15,   1.07372055e-01,
             1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.50323583e-01,   7.96585020e-15,   1.33436173e+00,
+         [  4.50323583e-01,   7.85482790e-15,   1.33436173e+00,
             1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.15511680e-01,   8.43769499e-15,   2.44096054e+00,
+         [  8.15511680e-01,   7.32747196e-15,   2.44096054e+00,
             3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.38132022e-01,   8.93729535e-15,  -7.71583216e-01,
+         [  7.38132022e-01,   7.93809463e-15,  -7.71583216e-01,
             3.50971524e+00,   3.34511938e-02,  -3.50971524e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.99159507e-01,   8.40993941e-15,   1.07372055e-01,
+         [  7.99159507e-01,   8.52096171e-15,   1.07372055e-01,
             2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.84351663e-01,   8.46545056e-15,   1.33436173e+00,
+         [  8.84351663e-01,   8.35442826e-15,   1.33436173e+00,
             1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.61184859e-01,   8.65973959e-15,   2.44096054e+00,
+         [  9.61184859e-01,   7.54951657e-15,   2.44096054e+00,
             5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.66233382, -0.05689514, -0.05058242,  0.01495376,
            0.20041947,  0.22977051,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -14633,22 +14687,7 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-0.00951546, -0.09622691,  0.61978605,  0.44751784,  0.03339034,
            0.00504814,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE4': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.87742881,  0.06546699,  0.0571042 ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -14695,7 +14734,22 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.02891208,  0.38749748,  0.58359043],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.00970379,  0.13005608,  0.86024014]]), 'FE0': array([[ 0.66233382, -0.05689514, -0.05058242,  0.01495376,  0.20041947,
+           0.        ,  0.        ,  0.00970379,  0.13005608,  0.86024014]]), 'FE3': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE0': array([[ 0.66233382, -0.05689514, -0.05058242,  0.01495376,  0.20041947,
            0.22977051],
          [ 0.2327681 , -0.04516801, -0.12355891,  0.05560129,  0.74520255,
            0.13515498],
@@ -14726,7 +14780,86 @@ Compiler stage 2: Computing intermediate representation
          [-0.02724027, -0.08718888,  0.09756515,  0.9045593 ,  0.06749126,
            0.04481344],
          [-0.00951546, -0.09622691,  0.61978605,  0.44751784,  0.03339034,
-           0.00504814]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+           0.00504814]]), 'FE1_C0_D01': array([[ -2.50971524e+00,   5.05151476e-15,  -7.71583216e-01,
+            2.61867978e-01,   3.28129845e+00,  -2.61867978e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.69178745e+00,   6.07847106e-15,   1.07372055e-01,
+            2.00840493e-01,   1.58441540e+00,  -2.00840493e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -5.49989934e-01,   6.85562718e-15,   1.33436173e+00,
+            1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.79775683e-01,   6.88338275e-15,   2.44096054e+00,
+            3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.52692501e+00,   5.88418203e-15,  -7.71583216e-01,
+            1.24465821e+00,   2.29850822e+00,  -1.24465821e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -9.38033307e-01,   6.85562718e-15,   1.07372055e-01,
+            9.54594639e-01,   8.30661252e-01,  -9.54594639e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.15961854e-01,   7.27196081e-15,   1.33436173e+00,
+            5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.25448862e-01,   6.99440506e-15,   2.44096054e+00,
+            1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.44658209e-01,   7.16093851e-15,  -7.71583216e-01,
+            2.52692501e+00,   1.01624142e+00,  -2.52692501e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.54053611e-02,   7.85482790e-15,   1.07372055e-01,
+            1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.50323583e-01,   7.85482790e-15,   1.33436173e+00,
+            1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.15511680e-01,   7.32747196e-15,   2.44096054e+00,
+            3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.38132022e-01,   7.93809463e-15,  -7.71583216e-01,
+            3.50971524e+00,   3.34511938e-02,  -3.50971524e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.99159507e-01,   8.52096171e-15,   1.07372055e-01,
+            2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.84351663e-01,   8.35442826e-15,   1.33436173e+00,
+            1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.61184859e-01,   7.54951657e-15,   2.44096054e+00,
+            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -14757,148 +14890,179 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_D01': array([[ -2.50971524e+00,   5.60662627e-15,  -7.71583216e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_D01': array([[ -2.50971524e+00,   5.05151476e-15,  -7.71583216e-01,
             2.61867978e-01,   3.28129845e+00,  -2.61867978e-01],
-         [ -1.69178745e+00,   6.13398221e-15,   1.07372055e-01,
+         [ -1.69178745e+00,   6.07847106e-15,   1.07372055e-01,
             2.00840493e-01,   1.58441540e+00,  -2.00840493e-01],
-         [ -5.49989934e-01,   7.18869408e-15,   1.33436173e+00,
+         [ -5.49989934e-01,   6.85562718e-15,   1.33436173e+00,
             1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01],
-         [  4.79775683e-01,   8.10462808e-15,   2.44096054e+00,
+         [  4.79775683e-01,   6.88338275e-15,   2.44096054e+00,
             3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02],
-         [ -1.52692501e+00,   6.21724894e-15,  -7.71583216e-01,
+         [ -1.52692501e+00,   5.88418203e-15,  -7.71583216e-01,
             1.24465821e+00,   2.29850822e+00,  -1.24465821e+00],
-         [ -9.38033307e-01,   6.77236045e-15,   1.07372055e-01,
+         [ -9.38033307e-01,   6.85562718e-15,   1.07372055e-01,
             9.54594639e-01,   8.30661252e-01,  -9.54594639e-01],
-         [ -1.15961854e-01,   7.49400542e-15,   1.33436173e+00,
+         [ -1.15961854e-01,   7.27196081e-15,   1.33436173e+00,
             5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01],
-         [  6.25448862e-01,   8.10462808e-15,   2.44096054e+00,
+         [  6.25448862e-01,   6.99440506e-15,   2.44096054e+00,
             1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01],
-         [ -2.44658209e-01,   7.60502772e-15,  -7.71583216e-01,
+         [ -2.44658209e-01,   7.16093851e-15,  -7.71583216e-01,
             2.52692501e+00,   1.01624142e+00,  -2.52692501e+00],
-         [  4.54053611e-02,   7.68829445e-15,   1.07372055e-01,
+         [  4.54053611e-02,   7.85482790e-15,   1.07372055e-01,
             1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00],
-         [  4.50323583e-01,   7.96585020e-15,   1.33436173e+00,
+         [  4.50323583e-01,   7.85482790e-15,   1.33436173e+00,
             1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00],
-         [  8.15511680e-01,   8.43769499e-15,   2.44096054e+00,
+         [  8.15511680e-01,   7.32747196e-15,   2.44096054e+00,
             3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01],
-         [  7.38132022e-01,   8.93729535e-15,  -7.71583216e-01,
+         [  7.38132022e-01,   7.93809463e-15,  -7.71583216e-01,
             3.50971524e+00,   3.34511938e-02,  -3.50971524e+00],
-         [  7.99159507e-01,   8.40993941e-15,   1.07372055e-01,
+         [  7.99159507e-01,   8.52096171e-15,   1.07372055e-01,
             2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00],
-         [  8.84351663e-01,   8.46545056e-15,   1.33436173e+00,
+         [  8.84351663e-01,   8.35442826e-15,   1.33436173e+00,
             1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00],
-         [  9.61184859e-01,   8.65973959e-15,   2.44096054e+00,
-            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01]]), 'FE3_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  9.61184859e-01,   7.54951657e-15,   2.44096054e+00,
+            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01]]), 'FE4_C0': array([[ 0.87742881,  0.06546699,  0.0571042 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.67294686,  0.05021012,  0.27684301,  0.        ,  0.        ,
+           0.        ],
+         [ 0.38749748,  0.02891208,  0.58359043,  0.        ,  0.        ,
+           0.        ],
+         [ 0.13005608,  0.00970379,  0.86024014,  0.        ,  0.        ,
+           0.        ],
+         [ 0.63173125,  0.31116455,  0.0571042 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.48450833,  0.23864866,  0.27684301,  0.        ,  0.        ,
+           0.        ],
+         [ 0.27899046,  0.1374191 ,  0.58359043,  0.        ,  0.        ,
+           0.        ],
+         [ 0.09363778,  0.04612208,  0.86024014,  0.        ,  0.        ,
+           0.        ],
+         [ 0.31116455,  0.63173125,  0.0571042 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.23864866,  0.48450833,  0.27684301,  0.        ,  0.        ,
+           0.        ],
+         [ 0.1374191 ,  0.27899046,  0.58359043,  0.        ,  0.        ,
+           0.        ],
+         [ 0.04612208,  0.09363778,  0.86024014,  0.        ,  0.        ,
+           0.        ],
+         [ 0.06546699,  0.87742881,  0.0571042 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05021012,  0.67294686,  0.27684301,  0.        ,  0.        ,
+           0.        ],
+         [ 0.02891208,  0.38749748,  0.58359043,  0.        ,  0.        ,
+           0.        ],
+         [ 0.00970379,  0.13005608,  0.86024014,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.50971524e+00,   5.60662627e-15,  -7.71583216e-01,
+           -2.50971524e+00,   5.05151476e-15,  -7.71583216e-01,
             2.61867978e-01,   3.28129845e+00,  -2.61867978e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.69178745e+00,   6.13398221e-15,   1.07372055e-01,
+           -1.69178745e+00,   6.07847106e-15,   1.07372055e-01,
             2.00840493e-01,   1.58441540e+00,  -2.00840493e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -5.49989934e-01,   7.18869408e-15,   1.33436173e+00,
+           -5.49989934e-01,   6.85562718e-15,   1.33436173e+00,
             1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.79775683e-01,   8.10462808e-15,   2.44096054e+00,
+            4.79775683e-01,   6.88338275e-15,   2.44096054e+00,
             3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.52692501e+00,   6.21724894e-15,  -7.71583216e-01,
+           -1.52692501e+00,   5.88418203e-15,  -7.71583216e-01,
             1.24465821e+00,   2.29850822e+00,  -1.24465821e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -9.38033307e-01,   6.77236045e-15,   1.07372055e-01,
+           -9.38033307e-01,   6.85562718e-15,   1.07372055e-01,
             9.54594639e-01,   8.30661252e-01,  -9.54594639e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.15961854e-01,   7.49400542e-15,   1.33436173e+00,
+           -1.15961854e-01,   7.27196081e-15,   1.33436173e+00,
             5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.25448862e-01,   8.10462808e-15,   2.44096054e+00,
+            6.25448862e-01,   6.99440506e-15,   2.44096054e+00,
             1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.44658209e-01,   7.60502772e-15,  -7.71583216e-01,
+           -2.44658209e-01,   7.16093851e-15,  -7.71583216e-01,
             2.52692501e+00,   1.01624142e+00,  -2.52692501e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.54053611e-02,   7.68829445e-15,   1.07372055e-01,
+            4.54053611e-02,   7.85482790e-15,   1.07372055e-01,
             1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.50323583e-01,   7.96585020e-15,   1.33436173e+00,
+            4.50323583e-01,   7.85482790e-15,   1.33436173e+00,
             1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.15511680e-01,   8.43769499e-15,   2.44096054e+00,
+            8.15511680e-01,   7.32747196e-15,   2.44096054e+00,
             3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.38132022e-01,   8.93729535e-15,  -7.71583216e-01,
+            7.38132022e-01,   7.93809463e-15,  -7.71583216e-01,
             3.50971524e+00,   3.34511938e-02,  -3.50971524e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.99159507e-01,   8.40993941e-15,   1.07372055e-01,
+            7.99159507e-01,   8.52096171e-15,   1.07372055e-01,
             2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.84351663e-01,   8.46545056e-15,   1.33436173e+00,
+            8.84351663e-01,   8.35442826e-15,   1.33436173e+00,
             1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.61184859e-01,   8.65973959e-15,   2.44096054e+00,
+            9.61184859e-01,   7.54951657e-15,   2.44096054e+00,
             5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C1': array([[ 0.        ,  0.        ,  0.        ,  0.87742881,  0.06546699,
+           0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.67294686,  0.05021012,
+           0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.38749748,  0.02891208,
+           0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.13005608,  0.00970379,
+           0.86024014],
+         [ 0.        ,  0.        ,  0.        ,  0.63173125,  0.31116455,
+           0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.48450833,  0.23864866,
+           0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.27899046,  0.1374191 ,
+           0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.09363778,  0.04612208,
+           0.86024014],
+         [ 0.        ,  0.        ,  0.        ,  0.31116455,  0.63173125,
+           0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.23864866,  0.48450833,
+           0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.1374191 ,  0.27899046,
+           0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.04612208,  0.09363778,
+           0.86024014],
+         [ 0.        ,  0.        ,  0.        ,  0.06546699,  0.87742881,
+           0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.05021012,  0.67294686,
+           0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.02891208,  0.38749748,
+           0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.00970379,  0.13005608,
+           0.86024014]]), 'FE2_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -14977,7 +15141,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -15056,86 +15220,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_C0_D01': array([[ -2.50971524e+00,   5.60662627e-15,  -7.71583216e-01,
-            2.61867978e-01,   3.28129845e+00,  -2.61867978e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.69178745e+00,   6.13398221e-15,   1.07372055e-01,
-            2.00840493e-01,   1.58441540e+00,  -2.00840493e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -5.49989934e-01,   7.18869408e-15,   1.33436173e+00,
-            1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.79775683e-01,   8.10462808e-15,   2.44096054e+00,
-            3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.52692501e+00,   6.21724894e-15,  -7.71583216e-01,
-            1.24465821e+00,   2.29850822e+00,  -1.24465821e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -9.38033307e-01,   6.77236045e-15,   1.07372055e-01,
-            9.54594639e-01,   8.30661252e-01,  -9.54594639e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.15961854e-01,   7.49400542e-15,   1.33436173e+00,
-            5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.25448862e-01,   8.10462808e-15,   2.44096054e+00,
-            1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.44658209e-01,   7.60502772e-15,  -7.71583216e-01,
-            2.52692501e+00,   1.01624142e+00,  -2.52692501e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.54053611e-02,   7.68829445e-15,   1.07372055e-01,
-            1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.50323583e-01,   7.96585020e-15,   1.33436173e+00,
-            1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.15511680e-01,   8.43769499e-15,   2.44096054e+00,
-            3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.38132022e-01,   8.93729535e-15,  -7.71583216e-01,
-            3.50971524e+00,   3.34511938e-02,  -3.50971524e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.99159507e-01,   8.40993941e-15,   1.07372055e-01,
-            2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.84351663e-01,   8.46545056e-15,   1.33436173e+00,
-            1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.61184859e-01,   8.65973959e-15,   2.44096054e+00,
-            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D10': array([[-2.50971524, -0.73813202,  0.        ,  0.22841678, -0.22841678,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0_D10': array([[-2.50971524, -0.73813202,  0.        ,  0.22841678, -0.22841678,
            3.24784726,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-1.69178745, -0.79915951,  0.        ,  1.10737205, -1.10737205,
@@ -15206,107 +15291,14 @@ Compiler stage 2: Computing intermediate representation
            1.,  0.],
          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
            1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE3_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE1_C0': array([[ 0.87742881,  0.06546699,  0.0571042 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.67294686,  0.05021012,  0.27684301,  0.        ,  0.        ,
-           0.        ],
-         [ 0.38749748,  0.02891208,  0.58359043,  0.        ,  0.        ,
-           0.        ],
-         [ 0.13005608,  0.00970379,  0.86024014,  0.        ,  0.        ,
-           0.        ],
-         [ 0.63173125,  0.31116455,  0.0571042 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.48450833,  0.23864866,  0.27684301,  0.        ,  0.        ,
-           0.        ],
-         [ 0.27899046,  0.1374191 ,  0.58359043,  0.        ,  0.        ,
-           0.        ],
-         [ 0.09363778,  0.04612208,  0.86024014,  0.        ,  0.        ,
-           0.        ],
-         [ 0.31116455,  0.63173125,  0.0571042 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.23864866,  0.48450833,  0.27684301,  0.        ,  0.        ,
-           0.        ],
-         [ 0.1374191 ,  0.27899046,  0.58359043,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04612208,  0.09363778,  0.86024014,  0.        ,  0.        ,
-           0.        ],
-         [ 0.06546699,  0.87742881,  0.0571042 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05021012,  0.67294686,  0.27684301,  0.        ,  0.        ,
-           0.        ],
-         [ 0.02891208,  0.38749748,  0.58359043,  0.        ,  0.        ,
-           0.        ],
-         [ 0.00970379,  0.13005608,  0.86024014,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.87742881,  0.06546699,
-           0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.67294686,  0.05021012,
-           0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.38749748,  0.02891208,
-           0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.13005608,  0.00970379,
-           0.86024014],
-         [ 0.        ,  0.        ,  0.        ,  0.63173125,  0.31116455,
-           0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.48450833,  0.23864866,
-           0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.27899046,  0.1374191 ,
-           0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.09363778,  0.04612208,
-           0.86024014],
-         [ 0.        ,  0.        ,  0.        ,  0.31116455,  0.63173125,
-           0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.23864866,  0.48450833,
-           0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.1374191 ,  0.27899046,
-           0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.04612208,  0.09363778,
-           0.86024014],
-         [ 0.        ,  0.        ,  0.        ,  0.06546699,  0.87742881,
-           0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.05021012,  0.67294686,
-           0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.02891208,  0.38749748,
-           0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.00970379,  0.13005608,
-           0.86024014]]), 'FE3_C0': array([[ 0.66233382, -0.05689514, -0.05058242,  0.01495376,  0.20041947,
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.]]), 'FE1_C0': array([[ 0.66233382, -0.05689514, -0.05058242,  0.01495376,  0.20041947,
            0.22977051,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [ 0.2327681 , -0.04516801, -0.12355891,  0.05560129,  0.74520255,
@@ -15353,7 +15345,7 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-0.00951546, -0.09622691,  0.61978605,  0.44751784,  0.03339034,
            0.00504814,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE3_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.66233382, -0.05689514, -0.05058242,  0.01495376,
            0.20041947,  0.22977051,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -15400,7 +15392,7 @@ Compiler stage 2: Computing intermediate representation
            0.06749126,  0.04481344,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -0.00951546, -0.09622691,  0.61978605,  0.44751784,
-           0.03339034,  0.00504814,  0.        ,  0.        ,  0.        ]]), 'FE3_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.03339034,  0.00504814,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.87742881,  0.06546699,  0.0571042 ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -15447,7 +15439,69 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.02891208,  0.38749748,  0.58359043],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.00970379,  0.13005608,  0.86024014]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+           0.        ,  0.        ,  0.00970379,  0.13005608,  0.86024014]]), 'FE4_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C0_D10': array([[-2.50971524, -0.73813202,  0.        ,  0.22841678, -0.22841678,
+           3.24784726,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-1.69178745, -0.79915951,  0.        ,  1.10737205, -1.10737205,
+           2.49094696,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.54998993, -0.88435166,  0.        ,  2.33436173, -2.33436173,
+           1.4343416 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.47977568, -0.96118486,  0.        ,  3.44096054, -3.44096054,
+           0.48140918,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-1.52692501,  0.24465821,  0.        ,  0.22841678, -0.22841678,
+           1.2822668 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.93803331, -0.04540536,  0.        ,  1.10737205, -1.10737205,
+           0.98343867,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.11596185, -0.45032358,  0.        ,  2.33436173, -2.33436173,
+           0.56628544,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.62544886, -0.81551168,  0.        ,  3.44096054, -3.44096054,
+           0.19006282,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.24465821,  1.52692501,  0.        ,  0.22841678, -0.22841678,
+          -1.2822668 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.04540536,  0.93803331,  0.        ,  1.10737205, -1.10737205,
+          -0.98343867,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.45032358,  0.11596185,  0.        ,  2.33436173, -2.33436173,
+          -0.56628544,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.81551168, -0.62544886,  0.        ,  3.44096054, -3.44096054,
+          -0.19006282,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.73813202,  2.50971524,  0.        ,  0.22841678, -0.22841678,
+          -3.24784726,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.79915951,  1.69178745,  0.        ,  1.10737205, -1.10737205,
+          -2.49094696,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.88435166,  0.54998993,  0.        ,  2.33436173, -2.33436173,
+          -1.4343416 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.96118486, -0.47977568,  0.        ,  3.44096054, -3.44096054,
+          -0.48140918,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE4_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
@@ -15495,86 +15549,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.88435166,  0.54998993,  0.        ,  2.33436173, -2.33436173,
           -1.4343416 ],
          [ 0.96118486, -0.47977568,  0.        ,  3.44096054, -3.44096054,
-          -0.48140918]]), 'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.50971524e+00,   5.60662627e-15,  -7.71583216e-01,
-            2.61867978e-01,   3.28129845e+00,  -2.61867978e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.69178745e+00,   6.13398221e-15,   1.07372055e-01,
-            2.00840493e-01,   1.58441540e+00,  -2.00840493e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -5.49989934e-01,   7.18869408e-15,   1.33436173e+00,
-            1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.79775683e-01,   8.10462808e-15,   2.44096054e+00,
-            3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.52692501e+00,   6.21724894e-15,  -7.71583216e-01,
-            1.24465821e+00,   2.29850822e+00,  -1.24465821e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -9.38033307e-01,   6.77236045e-15,   1.07372055e-01,
-            9.54594639e-01,   8.30661252e-01,  -9.54594639e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.15961854e-01,   7.49400542e-15,   1.33436173e+00,
-            5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.25448862e-01,   8.10462808e-15,   2.44096054e+00,
-            1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.44658209e-01,   7.60502772e-15,  -7.71583216e-01,
-            2.52692501e+00,   1.01624142e+00,  -2.52692501e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.54053611e-02,   7.68829445e-15,   1.07372055e-01,
-            1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.50323583e-01,   7.96585020e-15,   1.33436173e+00,
-            1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.15511680e-01,   8.43769499e-15,   2.44096054e+00,
-            3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.38132022e-01,   8.93729535e-15,  -7.71583216e-01,
-            3.50971524e+00,   3.34511938e-02,  -3.50971524e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.99159507e-01,   8.40993941e-15,   1.07372055e-01,
-            2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.84351663e-01,   8.46545056e-15,   1.33436173e+00,
-            1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            9.61184859e-01,   8.65973959e-15,   2.44096054e+00,
-            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D10': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+          -0.48140918]]), 'FE1_C1_D10': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -2.50971524, -0.73813202,  0.        ,  0.22841678,
           -0.22841678,  3.24784726,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -15582,234 +15557,108 @@ Compiler stage 2: Computing intermediate representation
           -1.10737205,  2.49094696,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        , -0.54998993, -0.88435166,  0.        ,  2.33436173,
-          -2.33436173,  1.4343416 ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.47977568, -0.96118486,  0.        ,  3.44096054,
-          -3.44096054,  0.48140918,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -1.52692501,  0.24465821,  0.        ,  0.22841678,
-          -0.22841678,  1.2822668 ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.93803331, -0.04540536,  0.        ,  1.10737205,
-          -1.10737205,  0.98343867,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.11596185, -0.45032358,  0.        ,  2.33436173,
-          -2.33436173,  0.56628544,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.62544886, -0.81551168,  0.        ,  3.44096054,
-          -3.44096054,  0.19006282,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.24465821,  1.52692501,  0.        ,  0.22841678,
-          -0.22841678, -1.2822668 ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.04540536,  0.93803331,  0.        ,  1.10737205,
-          -1.10737205, -0.98343867,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.45032358,  0.11596185,  0.        ,  2.33436173,
-          -2.33436173, -0.56628544,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.81551168, -0.62544886,  0.        ,  3.44096054,
-          -3.44096054, -0.19006282,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.73813202,  2.50971524,  0.        ,  0.22841678,
-          -0.22841678, -3.24784726,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.79915951,  1.69178745,  0.        ,  1.10737205,
-          -1.10737205, -2.49094696,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.88435166,  0.54998993,  0.        ,  2.33436173,
-          -2.33436173, -1.4343416 ,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.96118486, -0.47977568,  0.        ,  3.44096054,
-          -3.44096054, -0.48140918,  0.        ,  0.        ,  0.        ]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C0_D01': array([[ -2.50971524e+00,   5.60662627e-15,  -7.71583216e-01,
-            2.61867978e-01,   3.28129845e+00,  -2.61867978e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.69178745e+00,   6.13398221e-15,   1.07372055e-01,
-            2.00840493e-01,   1.58441540e+00,  -2.00840493e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -5.49989934e-01,   7.18869408e-15,   1.33436173e+00,
-            1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.79775683e-01,   8.10462808e-15,   2.44096054e+00,
-            3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.52692501e+00,   6.21724894e-15,  -7.71583216e-01,
-            1.24465821e+00,   2.29850822e+00,  -1.24465821e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -9.38033307e-01,   6.77236045e-15,   1.07372055e-01,
-            9.54594639e-01,   8.30661252e-01,  -9.54594639e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.15961854e-01,   7.49400542e-15,   1.33436173e+00,
-            5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  6.25448862e-01,   8.10462808e-15,   2.44096054e+00,
-            1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.44658209e-01,   7.60502772e-15,  -7.71583216e-01,
-            2.52692501e+00,   1.01624142e+00,  -2.52692501e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.54053611e-02,   7.68829445e-15,   1.07372055e-01,
-            1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.50323583e-01,   7.96585020e-15,   1.33436173e+00,
-            1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.15511680e-01,   8.43769499e-15,   2.44096054e+00,
-            3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.38132022e-01,   8.93729535e-15,  -7.71583216e-01,
-            3.50971524e+00,   3.34511938e-02,  -3.50971524e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.99159507e-01,   8.40993941e-15,   1.07372055e-01,
-            2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.84351663e-01,   8.46545056e-15,   1.33436173e+00,
-            1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  9.61184859e-01,   8.65973959e-15,   2.44096054e+00,
-            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.66233382, -0.05689514, -0.05058242,  0.01495376,
-           0.20041947,  0.22977051,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.2327681 , -0.04516801, -0.12355891,  0.05560129,
-           0.74520255,  0.13515498,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.08718888, -0.02724027,  0.09756515,  0.06749126,
-           0.9045593 ,  0.04481344,  0.        ,  0.        ,  0.        ],
+          -2.33436173,  1.4343416 ,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.09622691, -0.00951546,  0.61978605,  0.03339034,
-           0.44751784,  0.00504814,  0.        ,  0.        ,  0.        ],
+           0.        ,  0.47977568, -0.96118486,  0.        ,  3.44096054,
+          -3.44096054,  0.48140918,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.1664375 , -0.1175178 , -0.05058242,  0.07107521,
-           0.14429802,  0.78628949,  0.        ,  0.        ,  0.        ],
+           0.        , -1.52692501,  0.24465821,  0.        ,  0.22841678,
+          -0.22841678,  1.2822668 ,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.01501169, -0.12474229, -0.12355891,  0.26427286,
-           0.53653098,  0.46250905,  0.        ,  0.        ,  0.        ],
+           0.        , -0.93803331, -0.04540536,  0.        ,  1.10737205,
+          -1.10737205,  0.98343867,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12331911, -0.09965108,  0.09756515,  0.3207859 ,
-           0.65126466,  0.15335448,  0.        ,  0.        ,  0.        ],
+           0.        , -0.11596185, -0.45032358,  0.        ,  2.33436173,
+          -2.33436173,  0.56628544,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.07610172, -0.04186759,  0.61978605,  0.15870426,
-           0.32220392,  0.01727508,  0.        ,  0.        ,  0.        ],
+           0.        ,  0.62544886, -0.81551168,  0.        ,  3.44096054,
+          -3.44096054,  0.19006282,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.1175178 ,  0.1664375 , -0.05058242,  0.14429802,
-           0.07107521,  0.78628949,  0.        ,  0.        ,  0.        ],
+           0.        , -0.24465821,  1.52692501,  0.        ,  0.22841678,
+          -0.22841678, -1.2822668 ,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.12474229, -0.01501169, -0.12355891,  0.53653098,
-           0.26427286,  0.46250905,  0.        ,  0.        ,  0.        ],
+           0.        ,  0.04540536,  0.93803331,  0.        ,  1.10737205,
+          -1.10737205, -0.98343867,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.09965108, -0.12331911,  0.09756515,  0.65126466,
-           0.3207859 ,  0.15335448,  0.        ,  0.        ,  0.        ],
+           0.        ,  0.45032358,  0.11596185,  0.        ,  2.33436173,
+          -2.33436173, -0.56628544,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04186759, -0.07610172,  0.61978605,  0.32220392,
-           0.15870426,  0.01727508,  0.        ,  0.        ,  0.        ],
+           0.        ,  0.81551168, -0.62544886,  0.        ,  3.44096054,
+          -3.44096054, -0.19006282,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.05689514,  0.66233382, -0.05058242,  0.20041947,
-           0.01495376,  0.22977051,  0.        ,  0.        ,  0.        ],
+           0.        ,  0.73813202,  2.50971524,  0.        ,  0.22841678,
+          -0.22841678, -3.24784726,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.04516801,  0.2327681 , -0.12355891,  0.74520255,
-           0.05560129,  0.13515498,  0.        ,  0.        ,  0.        ],
+           0.        ,  0.79915951,  1.69178745,  0.        ,  1.10737205,
+          -1.10737205, -2.49094696,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.02724027, -0.08718888,  0.09756515,  0.9045593 ,
-           0.06749126,  0.04481344,  0.        ,  0.        ,  0.        ],
+           0.        ,  0.88435166,  0.54998993,  0.        ,  2.33436173,
+          -2.33436173, -1.4343416 ,  0.        ,  0.        ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.00951546, -0.09622691,  0.61978605,  0.44751784,
-           0.03339034,  0.00504814,  0.        ,  0.        ,  0.        ]]), 'FE2_C0': array([[ 0.66233382, -0.05689514, -0.05058242,  0.01495376,  0.20041947,
-           0.22977051,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.2327681 , -0.04516801, -0.12355891,  0.05560129,  0.74520255,
-           0.13515498,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.08718888, -0.02724027,  0.09756515,  0.06749126,  0.9045593 ,
-           0.04481344,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.09622691, -0.00951546,  0.61978605,  0.03339034,  0.44751784,
-           0.00504814,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.1664375 , -0.1175178 , -0.05058242,  0.07107521,  0.14429802,
-           0.78628949,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.01501169, -0.12474229, -0.12355891,  0.26427286,  0.53653098,
-           0.46250905,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12331911, -0.09965108,  0.09756515,  0.3207859 ,  0.65126466,
-           0.15335448,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.07610172, -0.04186759,  0.61978605,  0.15870426,  0.32220392,
-           0.01727508,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.1175178 ,  0.1664375 , -0.05058242,  0.14429802,  0.07107521,
-           0.78628949,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.12474229, -0.01501169, -0.12355891,  0.53653098,  0.26427286,
-           0.46250905,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.09965108, -0.12331911,  0.09756515,  0.65126466,  0.3207859 ,
-           0.15335448,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.04186759, -0.07610172,  0.61978605,  0.32220392,  0.15870426,
-           0.01727508,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.05689514,  0.66233382, -0.05058242,  0.20041947,  0.01495376,
-           0.22977051,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.04516801,  0.2327681 , -0.12355891,  0.74520255,  0.05560129,
-           0.13515498,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.02724027, -0.08718888,  0.09756515,  0.9045593 ,  0.06749126,
-           0.04481344,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.00951546, -0.09622691,  0.61978605,  0.44751784,  0.03339034,
-           0.00504814,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE4': array([[ 1.],
+           0.        ,  0.96118486, -0.47977568,  0.        ,  3.44096054,
+          -3.44096054, -0.48140918,  0.        ,  0.        ,  0.        ]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.]]), 'FE4_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -15824,54 +15673,7 @@ Compiler stage 2: Computing intermediate representation
          [ 1.],
          [ 1.],
          [ 1.],
-         [ 1.]]), 'FE2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.87742881,  0.06546699,  0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.67294686,  0.05021012,  0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.38749748,  0.02891208,  0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.13005608,  0.00970379,  0.86024014],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.63173125,  0.31116455,  0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.48450833,  0.23864866,  0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.27899046,  0.1374191 ,  0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.09363778,  0.04612208,  0.86024014],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.31116455,  0.63173125,  0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.23864866,  0.48450833,  0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.1374191 ,  0.27899046,  0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.04612208,  0.09363778,  0.86024014],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.06546699,  0.87742881,  0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.05021012,  0.67294686,  0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.02891208,  0.38749748,  0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.00970379,  0.13005608,  0.86024014]]), 'FE0': array([[ 0.66233382, -0.05689514, -0.05058242,  0.01495376,  0.20041947,
+         [ 1.]]), 'FE0': array([[ 0.66233382, -0.05689514, -0.05058242,  0.01495376,  0.20041947,
            0.22977051],
          [ 0.2327681 , -0.04516801, -0.12355891,  0.05560129,  0.74520255,
            0.13515498],
@@ -15902,7 +15704,86 @@ Compiler stage 2: Computing intermediate representation
          [-0.02724027, -0.08718888,  0.09756515,  0.9045593 ,  0.06749126,
            0.04481344],
          [-0.00951546, -0.09622691,  0.61978605,  0.44751784,  0.03339034,
-           0.00504814]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+           0.00504814]]), 'FE1_C0_D01': array([[ -2.50971524e+00,   5.05151476e-15,  -7.71583216e-01,
+            2.61867978e-01,   3.28129845e+00,  -2.61867978e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.69178745e+00,   6.07847106e-15,   1.07372055e-01,
+            2.00840493e-01,   1.58441540e+00,  -2.00840493e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -5.49989934e-01,   6.85562718e-15,   1.33436173e+00,
+            1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.79775683e-01,   6.88338275e-15,   2.44096054e+00,
+            3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.52692501e+00,   5.88418203e-15,  -7.71583216e-01,
+            1.24465821e+00,   2.29850822e+00,  -1.24465821e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -9.38033307e-01,   6.85562718e-15,   1.07372055e-01,
+            9.54594639e-01,   8.30661252e-01,  -9.54594639e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.15961854e-01,   7.27196081e-15,   1.33436173e+00,
+            5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.25448862e-01,   6.99440506e-15,   2.44096054e+00,
+            1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.44658209e-01,   7.16093851e-15,  -7.71583216e-01,
+            2.52692501e+00,   1.01624142e+00,  -2.52692501e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.54053611e-02,   7.85482790e-15,   1.07372055e-01,
+            1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.50323583e-01,   7.85482790e-15,   1.33436173e+00,
+            1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.15511680e-01,   7.32747196e-15,   2.44096054e+00,
+            3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.38132022e-01,   7.93809463e-15,  -7.71583216e-01,
+            3.50971524e+00,   3.34511938e-02,  -3.50971524e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.99159507e-01,   8.52096171e-15,   1.07372055e-01,
+            2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.84351663e-01,   8.35442826e-15,   1.33436173e+00,
+            1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.61184859e-01,   7.54951657e-15,   2.44096054e+00,
+            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -15933,69 +15814,179 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_D01': array([[ -2.50971524e+00,   5.60662627e-15,  -7.71583216e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_D01': array([[ -2.50971524e+00,   5.05151476e-15,  -7.71583216e-01,
             2.61867978e-01,   3.28129845e+00,  -2.61867978e-01],
-         [ -1.69178745e+00,   6.13398221e-15,   1.07372055e-01,
+         [ -1.69178745e+00,   6.07847106e-15,   1.07372055e-01,
             2.00840493e-01,   1.58441540e+00,  -2.00840493e-01],
-         [ -5.49989934e-01,   7.18869408e-15,   1.33436173e+00,
+         [ -5.49989934e-01,   6.85562718e-15,   1.33436173e+00,
             1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01],
-         [  4.79775683e-01,   8.10462808e-15,   2.44096054e+00,
+         [  4.79775683e-01,   6.88338275e-15,   2.44096054e+00,
             3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02],
-         [ -1.52692501e+00,   6.21724894e-15,  -7.71583216e-01,
+         [ -1.52692501e+00,   5.88418203e-15,  -7.71583216e-01,
             1.24465821e+00,   2.29850822e+00,  -1.24465821e+00],
-         [ -9.38033307e-01,   6.77236045e-15,   1.07372055e-01,
+         [ -9.38033307e-01,   6.85562718e-15,   1.07372055e-01,
             9.54594639e-01,   8.30661252e-01,  -9.54594639e-01],
-         [ -1.15961854e-01,   7.49400542e-15,   1.33436173e+00,
+         [ -1.15961854e-01,   7.27196081e-15,   1.33436173e+00,
             5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01],
-         [  6.25448862e-01,   8.10462808e-15,   2.44096054e+00,
+         [  6.25448862e-01,   6.99440506e-15,   2.44096054e+00,
             1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01],
-         [ -2.44658209e-01,   7.60502772e-15,  -7.71583216e-01,
+         [ -2.44658209e-01,   7.16093851e-15,  -7.71583216e-01,
             2.52692501e+00,   1.01624142e+00,  -2.52692501e+00],
-         [  4.54053611e-02,   7.68829445e-15,   1.07372055e-01,
+         [  4.54053611e-02,   7.85482790e-15,   1.07372055e-01,
             1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00],
-         [  4.50323583e-01,   7.96585020e-15,   1.33436173e+00,
+         [  4.50323583e-01,   7.85482790e-15,   1.33436173e+00,
             1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00],
-         [  8.15511680e-01,   8.43769499e-15,   2.44096054e+00,
+         [  8.15511680e-01,   7.32747196e-15,   2.44096054e+00,
             3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01],
-         [  7.38132022e-01,   8.93729535e-15,  -7.71583216e-01,
+         [  7.38132022e-01,   7.93809463e-15,  -7.71583216e-01,
             3.50971524e+00,   3.34511938e-02,  -3.50971524e+00],
-         [  7.99159507e-01,   8.40993941e-15,   1.07372055e-01,
+         [  7.99159507e-01,   8.52096171e-15,   1.07372055e-01,
             2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00],
-         [  8.84351663e-01,   8.46545056e-15,   1.33436173e+00,
+         [  8.84351663e-01,   8.35442826e-15,   1.33436173e+00,
             1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00],
-         [  9.61184859e-01,   8.65973959e-15,   2.44096054e+00,
-            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  9.61184859e-01,   7.54951657e-15,   2.44096054e+00,
+            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01]]), 'FE4_C0': array([[ 0.87742881,  0.06546699,  0.0571042 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.67294686,  0.05021012,  0.27684301,  0.        ,  0.        ,
+           0.        ],
+         [ 0.38749748,  0.02891208,  0.58359043,  0.        ,  0.        ,
+           0.        ],
+         [ 0.13005608,  0.00970379,  0.86024014,  0.        ,  0.        ,
+           0.        ],
+         [ 0.63173125,  0.31116455,  0.0571042 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.48450833,  0.23864866,  0.27684301,  0.        ,  0.        ,
+           0.        ],
+         [ 0.27899046,  0.1374191 ,  0.58359043,  0.        ,  0.        ,
+           0.        ],
+         [ 0.09363778,  0.04612208,  0.86024014,  0.        ,  0.        ,
+           0.        ],
+         [ 0.31116455,  0.63173125,  0.0571042 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.23864866,  0.48450833,  0.27684301,  0.        ,  0.        ,
+           0.        ],
+         [ 0.1374191 ,  0.27899046,  0.58359043,  0.        ,  0.        ,
+           0.        ],
+         [ 0.04612208,  0.09363778,  0.86024014,  0.        ,  0.        ,
+           0.        ],
+         [ 0.06546699,  0.87742881,  0.0571042 ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05021012,  0.67294686,  0.27684301,  0.        ,  0.        ,
+           0.        ],
+         [ 0.02891208,  0.38749748,  0.58359043,  0.        ,  0.        ,
+           0.        ],
+         [ 0.00970379,  0.13005608,  0.86024014,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.50971524e+00,   5.05151476e-15,  -7.71583216e-01,
+            2.61867978e-01,   3.28129845e+00,  -2.61867978e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.69178745e+00,   6.07847106e-15,   1.07372055e-01,
+            2.00840493e-01,   1.58441540e+00,  -2.00840493e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -5.49989934e-01,   6.85562718e-15,   1.33436173e+00,
+            1.15648337e-01,  -7.84371796e-01,  -1.15648337e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.79775683e-01,   6.88338275e-15,   2.44096054e+00,
+            3.88151405e-02,  -2.92073623e+00,  -3.88151405e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.52692501e+00,   5.88418203e-15,  -7.71583216e-01,
+            1.24465821e+00,   2.29850822e+00,  -1.24465821e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -9.38033307e-01,   6.85562718e-15,   1.07372055e-01,
+            9.54594639e-01,   8.30661252e-01,  -9.54594639e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.15961854e-01,   7.27196081e-15,   1.33436173e+00,
+            5.49676417e-01,  -1.21839988e+00,  -5.49676417e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.25448862e-01,   6.99440506e-15,   2.44096054e+00,
+            1.84488320e-01,  -3.06640940e+00,  -1.84488320e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.44658209e-01,   7.16093851e-15,  -7.71583216e-01,
+            2.52692501e+00,   1.01624142e+00,  -2.52692501e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.54053611e-02,   7.85482790e-15,   1.07372055e-01,
+            1.93803331e+00,  -1.52777416e-01,  -1.93803331e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.50323583e-01,   7.85482790e-15,   1.33436173e+00,
+            1.11596185e+00,  -1.78468531e+00,  -1.11596185e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.15511680e-01,   7.32747196e-15,   2.44096054e+00,
+            3.74551138e-01,  -3.25647222e+00,  -3.74551138e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.38132022e-01,   7.93809463e-15,  -7.71583216e-01,
+            3.50971524e+00,   3.34511938e-02,  -3.50971524e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.99159507e-01,   8.52096171e-15,   1.07372055e-01,
+            2.69178745e+00,  -9.06531562e-01,  -2.69178745e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.84351663e-01,   8.35442826e-15,   1.33436173e+00,
+            1.54998993e+00,  -2.21871339e+00,  -1.54998993e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.61184859e-01,   7.54951657e-15,   2.44096054e+00,
+            5.20224317e-01,  -3.40214540e+00,  -5.20224317e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE4_C1': array([[ 0.        ,  0.        ,  0.        ,  0.87742881,  0.06546699,
+           0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.67294686,  0.05021012,
+           0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.38749748,  0.02891208,
+           0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.13005608,  0.00970379,
+           0.86024014],
+         [ 0.        ,  0.        ,  0.        ,  0.63173125,  0.31116455,
+           0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.48450833,  0.23864866,
+           0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.27899046,  0.1374191 ,
+           0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.09363778,  0.04612208,
+           0.86024014],
+         [ 0.        ,  0.        ,  0.        ,  0.31116455,  0.63173125,
+           0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.23864866,  0.48450833,
+           0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.1374191 ,  0.27899046,
+           0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.04612208,  0.09363778,
+           0.86024014],
+         [ 0.        ,  0.        ,  0.        ,  0.06546699,  0.87742881,
+           0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.05021012,  0.67294686,
+           0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.02891208,  0.38749748,
+           0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.00970379,  0.13005608,
+           0.86024014]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -16074,7 +16065,163 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0_D10': array([[-2.50971524, -0.73813202,  0.        ,  0.22841678, -0.22841678,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ 0.66233382, -0.05689514, -0.05058242,  0.01495376,  0.20041947,
+           0.22977051,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.2327681 , -0.04516801, -0.12355891,  0.05560129,  0.74520255,
+           0.13515498,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.08718888, -0.02724027,  0.09756515,  0.06749126,  0.9045593 ,
+           0.04481344,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.09622691, -0.00951546,  0.61978605,  0.03339034,  0.44751784,
+           0.00504814,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.1664375 , -0.1175178 , -0.05058242,  0.07107521,  0.14429802,
+           0.78628949,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.01501169, -0.12474229, -0.12355891,  0.26427286,  0.53653098,
+           0.46250905,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12331911, -0.09965108,  0.09756515,  0.3207859 ,  0.65126466,
+           0.15335448,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.07610172, -0.04186759,  0.61978605,  0.15870426,  0.32220392,
+           0.01727508,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.1175178 ,  0.1664375 , -0.05058242,  0.14429802,  0.07107521,
+           0.78628949,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.12474229, -0.01501169, -0.12355891,  0.53653098,  0.26427286,
+           0.46250905,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.09965108, -0.12331911,  0.09756515,  0.65126466,  0.3207859 ,
+           0.15335448,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.04186759, -0.07610172,  0.61978605,  0.32220392,  0.15870426,
+           0.01727508,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.05689514,  0.66233382, -0.05058242,  0.20041947,  0.01495376,
+           0.22977051,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.04516801,  0.2327681 , -0.12355891,  0.74520255,  0.05560129,
+           0.13515498,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.02724027, -0.08718888,  0.09756515,  0.9045593 ,  0.06749126,
+           0.04481344,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.00951546, -0.09622691,  0.61978605,  0.44751784,  0.03339034,
+           0.00504814,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.66233382, -0.05689514, -0.05058242,  0.01495376,
+           0.20041947,  0.22977051,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.2327681 , -0.04516801, -0.12355891,  0.05560129,
+           0.74520255,  0.13515498,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.08718888, -0.02724027,  0.09756515,  0.06749126,
+           0.9045593 ,  0.04481344,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.09622691, -0.00951546,  0.61978605,  0.03339034,
+           0.44751784,  0.00504814,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.1664375 , -0.1175178 , -0.05058242,  0.07107521,
+           0.14429802,  0.78628949,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.01501169, -0.12474229, -0.12355891,  0.26427286,
+           0.53653098,  0.46250905,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12331911, -0.09965108,  0.09756515,  0.3207859 ,
+           0.65126466,  0.15335448,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.07610172, -0.04186759,  0.61978605,  0.15870426,
+           0.32220392,  0.01727508,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.1175178 ,  0.1664375 , -0.05058242,  0.14429802,
+           0.07107521,  0.78628949,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12474229, -0.01501169, -0.12355891,  0.53653098,
+           0.26427286,  0.46250905,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.09965108, -0.12331911,  0.09756515,  0.65126466,
+           0.3207859 ,  0.15335448,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04186759, -0.07610172,  0.61978605,  0.32220392,
+           0.15870426,  0.01727508,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.05689514,  0.66233382, -0.05058242,  0.20041947,
+           0.01495376,  0.22977051,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04516801,  0.2327681 , -0.12355891,  0.74520255,
+           0.05560129,  0.13515498,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02724027, -0.08718888,  0.09756515,  0.9045593 ,
+           0.06749126,  0.04481344,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.00951546, -0.09622691,  0.61978605,  0.44751784,
+           0.03339034,  0.00504814,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.87742881,  0.06546699,  0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.67294686,  0.05021012,  0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.38749748,  0.02891208,  0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.13005608,  0.00970379,  0.86024014],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.63173125,  0.31116455,  0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.48450833,  0.23864866,  0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.27899046,  0.1374191 ,  0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.09363778,  0.04612208,  0.86024014],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.31116455,  0.63173125,  0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.23864866,  0.48450833,  0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.1374191 ,  0.27899046,  0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.04612208,  0.09363778,  0.86024014],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.06546699,  0.87742881,  0.0571042 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.05021012,  0.67294686,  0.27684301],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.02891208,  0.38749748,  0.58359043],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.00970379,  0.13005608,  0.86024014]]), 'FE4_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C0_D10': array([[-2.50971524, -0.73813202,  0.        ,  0.22841678, -0.22841678,
            3.24784726,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-1.69178745, -0.79915951,  0.        ,  1.10737205, -1.10737205,
@@ -16121,100 +16268,7 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [ 0.96118486, -0.47977568,  0.        ,  3.44096054, -3.44096054,
           -0.48140918,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE2_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE1_C0': array([[ 0.87742881,  0.06546699,  0.0571042 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.67294686,  0.05021012,  0.27684301,  0.        ,  0.        ,
-           0.        ],
-         [ 0.38749748,  0.02891208,  0.58359043,  0.        ,  0.        ,
-           0.        ],
-         [ 0.13005608,  0.00970379,  0.86024014,  0.        ,  0.        ,
-           0.        ],
-         [ 0.63173125,  0.31116455,  0.0571042 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.48450833,  0.23864866,  0.27684301,  0.        ,  0.        ,
-           0.        ],
-         [ 0.27899046,  0.1374191 ,  0.58359043,  0.        ,  0.        ,
-           0.        ],
-         [ 0.09363778,  0.04612208,  0.86024014,  0.        ,  0.        ,
-           0.        ],
-         [ 0.31116455,  0.63173125,  0.0571042 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.23864866,  0.48450833,  0.27684301,  0.        ,  0.        ,
-           0.        ],
-         [ 0.1374191 ,  0.27899046,  0.58359043,  0.        ,  0.        ,
-           0.        ],
-         [ 0.04612208,  0.09363778,  0.86024014,  0.        ,  0.        ,
-           0.        ],
-         [ 0.06546699,  0.87742881,  0.0571042 ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05021012,  0.67294686,  0.27684301,  0.        ,  0.        ,
-           0.        ],
-         [ 0.02891208,  0.38749748,  0.58359043,  0.        ,  0.        ,
-           0.        ],
-         [ 0.00970379,  0.13005608,  0.86024014,  0.        ,  0.        ,
-           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.87742881,  0.06546699,
-           0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.67294686,  0.05021012,
-           0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.38749748,  0.02891208,
-           0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.13005608,  0.00970379,
-           0.86024014],
-         [ 0.        ,  0.        ,  0.        ,  0.63173125,  0.31116455,
-           0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.48450833,  0.23864866,
-           0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.27899046,  0.1374191 ,
-           0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.09363778,  0.04612208,
-           0.86024014],
-         [ 0.        ,  0.        ,  0.        ,  0.31116455,  0.63173125,
-           0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.23864866,  0.48450833,
-           0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.1374191 ,  0.27899046,
-           0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.04612208,  0.09363778,
-           0.86024014],
-         [ 0.        ,  0.        ,  0.        ,  0.06546699,  0.87742881,
-           0.0571042 ],
-         [ 0.        ,  0.        ,  0.        ,  0.05021012,  0.67294686,
-           0.27684301],
-         [ 0.        ,  0.        ,  0.        ,  0.02891208,  0.38749748,
-           0.58359043],
-         [ 0.        ,  0.        ,  0.        ,  0.00970379,  0.13005608,
-           0.86024014]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE4_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
@@ -16231,9 +16285,9 @@ Compiler stage 2: Computing intermediate representation
          [-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.]])}
   
-  name_map: {'FE2_C1_D01': ['FE3_C1_D01'], 'FE2_C1_D10': ['FE3_C1_D10'], 'FE2_C0_D01': ['FE3_C0_D01'], 'FE2_C2_D10': ['FE3_C2_D10'], 'FE2_C2_D01': ['FE3_C2_D01'], 'FE2_C1': ['FE3_C1'], 'FE2_C0': ['FE3_C0'], 'FE2_C2': ['FE3_C2'], 'FE2_C0_D10': ['FE3_C0_D10']}
+  name_map: {'FE1_C0': ['FE2_C0'], 'FE1_C1_D01': ['FE2_C1_D01'], 'FE1_C2': ['FE2_C2'], 'FE1_C1_D10': ['FE2_C1_D10'], 'FE1_C2_D10': ['FE2_C2_D10'], 'FE1_C2_D01': ['FE2_C2_D01'], 'FE1_C1': ['FE2_C1'], 'FE1_C0_D01': ['FE2_C0_D01'], 'FE1_C0_D10': ['FE2_C0_D10']}
   
-  inv_name_map: {'FE0_D10': 'FE0_D10', 'FE2_C1_D01': 'FE2_C1_D01', 'FE3_C1_D10': 'FE2_C1_D10', 'FE0_D01': 'FE0_D01', 'FE1_C1_D10': 'FE1_C1_D10', 'FE3_C0_D10': 'FE2_C0_D10', 'FE2_C0_D01': 'FE2_C0_D01', 'FE2_C1': 'FE2_C1', 'FE2_C0': 'FE2_C0', 'FE4': 'FE4', 'FE2_C2': 'FE2_C2', 'FE0': 'FE0', 'FE1_C0_D01': 'FE1_C0_D01', 'FE2_C1_D10': 'FE2_C1_D10', 'FE3_C1_D01': 'FE2_C1_D01', 'FE1_C1_D01': 'FE1_C1_D01', 'FE2_C2_D01': 'FE2_C2_D01', 'FE3_C2_D01': 'FE2_C2_D01', 'FE3_C0_D01': 'FE2_C0_D01', 'FE2_C0 [...]
+  inv_name_map: {'FE2_C1_D01': 'FE1_C1_D01', 'FE0_D10': 'FE0_D10', 'FE4_C1': 'FE4_C1', 'FE1_C1_D10': 'FE1_C1_D10', 'FE1_C2_D10': 'FE1_C2_D10', 'FE2_C0_D01': 'FE1_C0_D01', 'FE4_C1_D01': 'FE4_C1_D01', 'FE2_C1': 'FE1_C1', 'FE2_C0': 'FE1_C0', 'FE2_C2': 'FE1_C2', 'FE0_D01': 'FE0_D01', 'FE3': 'FE3', 'FE0': 'FE0', 'FE1_C0_D01': 'FE1_C0_D01', 'FE4_C0_D01': 'FE4_C0_D01', 'FE2_C1_D10': 'FE1_C1_D10', 'FE4_C0': 'FE4_C0', 'FE1_C1_D01': 'FE1_C1_D01', 'FE2_C2_D10': 'FE1_C2_D10', 'FE1_C2_D01': 'FE1_C2_D [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_D10': array([[-2.50971524, -0.73813202,  0.22841678, -0.22841678,  3.24784726],
@@ -16251,7 +16305,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.73813202,  2.50971524,  0.22841678, -0.22841678, -3.24784726],
          [ 0.79915951,  1.69178745,  1.10737205, -1.10737205, -2.49094696],
          [ 0.88435166,  0.54998993,  2.33436173, -2.33436173, -1.4343416 ],
-         [ 0.96118486, -0.47977568,  3.44096054, -3.44096054, -0.48140918]]), 'FE4': array([[ 1.],
+         [ 0.96118486, -0.47977568,  3.44096054, -3.44096054, -0.48140918]]), 'FE3': array([[ 1.],
          [ 1.],
          [ 1.],
          [ 1.],
@@ -16297,22 +16351,7 @@ Compiler stage 2: Computing intermediate representation
          [-0.02724027, -0.08718888,  0.09756515,  0.9045593 ,  0.06749126,
            0.04481344],
          [-0.00951546, -0.09622691,  0.61978605,  0.44751784,  0.03339034,
-           0.00504814]]), 'FE1_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE0_D01': array([[-2.50971524, -0.77158322,  0.26186798,  3.28129845, -0.26186798],
+           0.00504814]]), 'FE0_D01': array([[-2.50971524, -0.77158322,  0.26186798,  3.28129845, -0.26186798],
          [-1.69178745,  0.10737205,  0.20084049,  1.5844154 , -0.20084049],
          [-0.54998993,  1.33436173,  0.11564834, -0.7843718 , -0.11564834],
          [ 0.47977568,  2.44096054,  0.03881514, -2.92073623, -0.03881514],
@@ -16327,7 +16366,22 @@ Compiler stage 2: Computing intermediate representation
          [ 0.73813202, -0.77158322,  3.50971524,  0.03345119, -3.50971524],
          [ 0.79915951,  0.10737205,  2.69178745, -0.90653156, -2.69178745],
          [ 0.88435166,  1.33436173,  1.54998993, -2.21871339, -1.54998993],
-         [ 0.96118486,  2.44096054,  0.52022432, -3.4021454 , -0.52022432]]), 'FE1_C0': array([[ 0.87742881,  0.06546699,  0.0571042 ],
+         [ 0.96118486,  2.44096054,  0.52022432, -3.4021454 , -0.52022432]]), 'FE1_C2_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]]), 'FE1_C2': array([[ 0.87742881,  0.06546699,  0.0571042 ],
          [ 0.67294686,  0.05021012,  0.27684301],
          [ 0.38749748,  0.02891208,  0.58359043],
          [ 0.13005608,  0.00970379,  0.86024014],
@@ -16345,7 +16399,7 @@ Compiler stage 2: Computing intermediate representation
          [ 0.00970379,  0.13005608,  0.86024014]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_D10': ('FE0_D10', (1, [0, 1, 3, 4, 5]), False, False), 'FE2_C1_D01': ('FE0_D01', (12, [6, 8, 9, 10, 11]), False, False), 'FE3_C1_D10': ('FE0_D10', (13, [6, 7, 9, 10, 11]), False, False), 'FE0_D01': ('FE0_D01', (0, [0, 2, 3, 4, 5]), False, False), 'FE1_C1_D10': ('FE1_C0_D01', (7, [3, 4]), False, False), 'FE3_C0_D10': ('FE0_D10', (10, [0, 1, 3, 4, 5]), False, False), 'FE2_C0_D01': ('FE0_D01', (9, [0, 2, 3, 4, 5]), False, False), 'FE2_C1': ('FE0', (11, [6, 7, 8, 9, 10, 11]), False,  [...]
+  {'FE2_C1_D01': ('FE0_D01', (6, [6, 8, 9, 10, 11]), False, False), 'FE0_D10': ('FE0_D10', (1, [0, 1, 3, 4, 5]), False, False), 'FE4_C1': ('FE1_C2', (14, [3, 4, 5]), False, False), 'FE1_C1_D10': ('FE0_D10', (7, [6, 7, 9, 10, 11]), False, False), 'FE1_C2_D10': ('FE1_C2_D01', (10, [12, 13]), False, False), 'FE2_C0_D01': ('FE0_D01', (3, [0, 2, 3, 4, 5]), False, False), 'FE4_C1_D01': ('FE1_C2_D01', (15, [3, 5]), False, False), 'FE2_C1': ('FE0', (5, [6, 7, 8, 9, 10, 11]), False, False), 'FE2_ [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -16473,9 +16527,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {0: {(0, 0): array([[  1.12757026e-16,   4.16333634e-17,   4.16333634e-17],
+  {3: {FiniteElement('Discontinuous Lagrange', triangle, 2): {None: {0: {(0, 0): array([[  1.12757026e-16,   4.16333634e-17,   4.16333634e-17],
          [  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02],
          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
@@ -16490,13 +16545,7 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -2.77555756e-17,  -5.55111512e-17,  -5.55111512e-17],
-         [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 0): array([[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
-         [  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
-         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 1: {(0, 0): array([[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
-         [  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
-         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 2: {(0, 0): array([[ 0.88729833,  0.5       ,  0.11270167],
-         [ 0.11270167,  0.5       ,  0.88729833],
-         [ 0.        ,  0.        ,  0.        ]])}}}, MixedElement(*[MixedElement(*[FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None)], **{'value_shape': (2,) }), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {0 [...]
+         [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]])}}}, MixedElement(VectorElement(FiniteElement('Discontinuous Lagrange', triangle, 2), dim=2), FiniteElement('Discontinuous Lagrange', triangle, 1)): {None: {0: {(0, 0): array([[[  1.12757026e-16,   4.16333634e-17,   4.16333634e-17],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
@@ -16670,7 +16719,13 @@ Compiler stage 2: Computing intermediate representation
   
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {0: {(0, 0): array([[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
+         [  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
+         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 1: {(0, 0): array([[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
+         [  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
+         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 2: {(0, 0): array([[ 0.88729833,  0.5       ,  0.11270167],
+         [ 0.11270167,  0.5       ,  0.88729833],
+         [ 0.        ,  0.        ,  0.        ]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -16817,82 +16872,78 @@ Compiler stage 2: Computing intermediate representation
           [ 0.        ,  0.        ,  0.        ]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE2_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
+  {'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
          [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
          [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE0_f1': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
          [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE0_f2': array([[ 0.88729833,  0.11270167,  0.        ],
          [ 0.5       ,  0.5       ,  0.        ],
-         [ 0.11270167,  0.88729833,  0.        ]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [ 0.11270167,  0.88729833,  0.        ]]), 'FE3_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE3_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
-           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
+            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
+            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
-            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C0': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
-           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
+            4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
+            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+         [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
+            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
-            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
+         [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE3_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f2': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
-            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01],
-         [  4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00],
-         [ -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01]]), 'FE1_f1': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE3_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE3_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f1': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
            -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16],
          [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
@@ -16902,7 +16953,46 @@ Compiler stage 2: Computing intermediate representation
          [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
             1.00000000e+00,   1.38777878e-17,   0.00000000e+00],
          [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17]]), 'FE3_f2_C0': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17]]), 'FE3_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.5       ,  0.5       ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.11270167,  0.88729833,  0.        ,  0.        ,  0.        ,
+           0.        ]]), 'FE3_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
+           0.        ]]), 'FE3_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01],
+         [  4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00],
+         [ -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
             0.00000000e+00,  -2.77555756e-17,   4.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -16916,12 +17006,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,  -5.55111512e-17,   4.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.88729833,  0.11270167,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -16929,108 +17014,78 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.5       ,  0.5       ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.11270167,  0.88729833,  0.        ]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
+           0.        ,  0.        ,  0.11270167,  0.88729833,  0.        ]]), 'FE3_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
-           0.        ]]), 'FE2_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.5       ,  0.5       ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.11270167,  0.88729833,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE2_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
-            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE3_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE3_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
+            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
+            8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
+            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE3_f0_C0': array([[  1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
-            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
-            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
+            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
-            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
+            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE3_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
-            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
+         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]])}
   
   tables: {'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
          [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
@@ -17038,62 +17093,63 @@ Compiler stage 2: Computing intermediate representation
          [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE0_f2': array([[ 0.88729833,  0.11270167,  0.        ],
          [ 0.5       ,  0.5       ,  0.        ],
-         [ 0.11270167,  0.88729833,  0.        ]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ 0.11270167,  0.88729833,  0.        ]]), 'FE2_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
-           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
+            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
+            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
-            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C0': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
-           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
+            4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
+            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+         [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
+            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
-            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
+         [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE3_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
+         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
-            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01],
-         [  4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00],
-         [ -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01]]), 'FE1_f1': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE3_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f1': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
            -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16],
          [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
@@ -17103,7 +17159,36 @@ Compiler stage 2: Computing intermediate representation
          [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
             1.00000000e+00,   1.38777878e-17,   0.00000000e+00],
          [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17]]), 'FE3_f2_C0': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17]]), 'FE3_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.5       ,  0.5       ,  0.        ,  0.        ,  0.        ,
+           0.        ],
+         [ 0.11270167,  0.88729833,  0.        ,  0.        ,  0.        ,
+           0.        ]]), 'FE3_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
+           0.        ]]), 'FE1_f2': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01],
+         [  4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00],
+         [ -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
             0.00000000e+00,  -2.77555756e-17,   4.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -17117,7 +17202,7 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,  -5.55111512e-17,   4.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.88729833,  0.11270167,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -17125,115 +17210,85 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.5       ,  0.5       ,  0.        ],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.11270167,  0.88729833,  0.        ]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
+           0.        ,  0.        ,  0.11270167,  0.88729833,  0.        ]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
+            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
-           0.        ]]), 'FE2_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.5       ,  0.5       ,  0.        ,  0.        ,  0.        ,
-           0.        ],
-         [ 0.11270167,  0.88729833,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE3_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
-            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01,
+            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE3_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00,
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE3_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
+            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
+            8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
+            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE3_f0_C0': array([[  1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
-            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
-            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
+            5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
-            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
+            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE3_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
-            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
+         [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]])}
   
-  name_map: {'FE2_f0_C0_D10': ['FE2_f1_C0_D10', 'FE2_f2_C0_D10'], 'FE2_f0_C1_D01': ['FE2_f1_C1_D01', 'FE2_f2_C1_D01'], 'FE2_f0_C0_D01': ['FE2_f1_C0_D01', 'FE2_f2_C0_D01'], 'FE2_f0_C1_D10': ['FE2_f1_C1_D10', 'FE2_f2_C1_D10']}
+  name_map: {'FE3_f0_C1_D10': ['FE3_f1_C1_D10', 'FE3_f2_C1_D10'], 'FE3_f0_C0_D01': ['FE3_f1_C0_D01', 'FE3_f2_C0_D01'], 'FE3_f0_C1_D01': ['FE3_f1_C1_D01', 'FE3_f2_C1_D01'], 'FE3_f0_C0_D10': ['FE3_f1_C0_D10', 'FE3_f2_C0_D10']}
   
-  inv_name_map: {'FE2_f1_C1_D01': 'FE2_f0_C1_D01', 'FE2_f2_C0_D10': 'FE2_f0_C0_D10', 'FE0_f0': 'FE0_f0', 'FE0_f1': 'FE0_f1', 'FE0_f2': 'FE0_f2', 'FE2_f0_C1_D01': 'FE2_f0_C1_D01', 'FE2_f2_C0': 'FE2_f2_C0', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0_D01': 'FE2_f0_C0_D01', 'FE3_f1_C1': 'FE3_f1_C1', 'FE3_f1_C0': 'FE3_f1_C0', 'FE2_f0_C0': 'FE2_f0_C0', 'FE2_f2_C1_D01': 'FE2_f0_C1_D01', 'FE2_f1_C0_D10': 'FE2_f0_C0_D10', 'FE1_f2': 'FE1_f2', 'FE1_f1': 'FE1_f1', 'FE1_f0': 'FE1_f0', 'FE3_f2_C0': 'FE3_f2_ [...]
+  inv_name_map: {'FE0_f0': 'FE0_f0', 'FE0_f1': 'FE0_f1', 'FE0_f2': 'FE0_f2', 'FE3_f2_C0_D10': 'FE3_f0_C0_D10', 'FE3_f1_C0_D01': 'FE3_f0_C0_D01', 'FE2_f2_C0': 'FE2_f2_C0', 'FE2_f0_C2': 'FE2_f0_C2', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0': 'FE2_f0_C0', 'FE3_f1_C1': 'FE3_f1_C1', 'FE3_f1_C0': 'FE3_f1_C0', 'FE2_f2_C2': 'FE2_f2_C2', 'FE3_f1_C1_D01': 'FE3_f0_C1_D01', 'FE3_f0_C1_D10': 'FE3_f0_C1_D10', 'FE1_f1': 'FE1_f1', 'FE1_f0': 'FE1_f0', 'FE3_f2_C0': 'FE3_f2_C0', 'FE3_f2_C1': 'FE3_f2_C1', 'FE2_ [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_f0': array([[ 0.88729833,  0.11270167],
          [ 0.5       ,  0.5       ],
-         [ 0.11270167,  0.88729833]]), 'FE2_f0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE1_f0': array([[ 0.68729833, -0.08729833,  0.4       ],
+         [ 0.11270167,  0.88729833]]), 'FE1_f0': array([[ 0.68729833, -0.08729833,  0.4       ],
          [ 0.        ,  0.        ,  1.        ],
-         [-0.08729833,  0.68729833,  0.4       ]])}
+         [-0.08729833,  0.68729833,  0.4       ]]), 'FE3_f0_C0_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE2_f1_C1_D01': ('FE2_f0_C0_D01', (10, [3, 5]), False, False), 'FE2_f2_C0_D10': ('FE2_f0_C0_D01', (8, [0, 1]), False, False), 'FE0_f0': ('FE0_f0', (0, [1, 2]), False, False), 'FE0_f1': ('FE0_f0', (1, [0, 2]), False, False), 'FE0_f2': ('FE0_f0', (2, [0, 1]), False, False), 'FE2_f0_C1_D01': ('FE2_f0_C0_D01', (10, [3, 5]), False, False), 'FE2_f2_C0': ('FE0_f0', (14, [0, 1]), False, False), 'FE2_f0_C1': ('FE0_f0', (9, [4, 5]), False, False), 'FE2_f0_C0_D01': ('FE2_f0_C0_D01', (7, [0, 2]) [...]
+  {'FE0_f0': ('FE0_f0', (0, [1, 2]), False, False), 'FE0_f1': ('FE0_f0', (1, [0, 2]), False, False), 'FE0_f2': ('FE0_f0', (2, [0, 1]), False, False), 'FE3_f2_C0_D10': ('FE3_f0_C0_D01', (17, [0, 1]), False, False), 'FE3_f1_C0_D01': ('FE3_f0_C0_D01', (16, [0, 2]), False, False), 'FE2_f2_C0': ('FE1_f0', (12, [0, 1, 5]), False, False), 'FE2_f0_C2': ('FE0_f0', (8, [13, 14]), False, False), 'FE2_f0_C1': ('FE1_f0', (7, [7, 8, 9]), False, False), 'FE2_f0_C0': ('FE1_f0', (6, [1, 2, 3]), False, Fa [...]
   Transforming exterior facet integral 0
   Reusing element from cache
   Reusing element from cache
@@ -17296,7 +17351,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00239 seconds
+  225 entries computed in 0.00209 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17307,7 +17362,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.0025 seconds
+  390 entries computed in 0.00219 seconds
   Shape of reference tensor: (1, 15, 26)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
@@ -17318,6 +17373,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -17343,7 +17399,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00251 seconds
+  225 entries computed in 0.00242 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17354,7 +17410,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00267 seconds
+  390 entries computed in 0.00244 seconds
   Shape of reference tensor: (1, 15, 26)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
@@ -17365,7 +17421,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00249 seconds
+  225 entries computed in 0.00229 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17376,7 +17432,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00269 seconds
+  390 entries computed in 0.00248 seconds
   Shape of reference tensor: (1, 15, 26)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
@@ -17387,7 +17443,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00248 seconds
+  225 entries computed in 0.00255 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17398,7 +17454,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00272 seconds
+  390 entries computed in 0.00269 seconds
   Shape of reference tensor: (1, 15, 26)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
@@ -17409,6 +17465,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -17488,7 +17545,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00388 seconds
+  225 entries computed in 0.00393 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17499,7 +17556,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00393 seconds
+  225 entries computed in 0.00378 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17510,7 +17567,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00431 seconds
+  390 entries computed in 0.00407 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17521,7 +17578,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00422 seconds
+  390 entries computed in 0.00406 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17532,7 +17589,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00383 seconds
+  225 entries computed in 0.00352 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17543,7 +17600,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00409 seconds
+  225 entries computed in 0.00371 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17554,7 +17611,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00435 seconds
+  390 entries computed in 0.00409 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17565,7 +17622,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00419 seconds
+  390 entries computed in 0.0047 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17576,7 +17633,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00382 seconds
+  225 entries computed in 0.00375 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17587,7 +17644,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00384 seconds
+  225 entries computed in 0.0034 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17598,7 +17655,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00423 seconds
+  390 entries computed in 0.00364 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17609,7 +17666,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00423 seconds
+  390 entries computed in 0.00366 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17620,7 +17677,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00423 seconds
+  225 entries computed in 0.00338 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17631,7 +17688,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00382 seconds
+  225 entries computed in 0.00349 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17642,7 +17699,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00423 seconds
+  390 entries computed in 0.00381 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17653,7 +17710,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00419 seconds
+  390 entries computed in 0.00386 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17664,7 +17721,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00383 seconds
+  225 entries computed in 0.00353 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17675,7 +17732,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00381 seconds
+  225 entries computed in 0.00353 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17686,7 +17743,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.0042 seconds
+  390 entries computed in 0.00388 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17697,7 +17754,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00421 seconds
+  390 entries computed in 0.00379 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17708,7 +17765,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00383 seconds
+  225 entries computed in 0.00358 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17719,7 +17776,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00395 seconds
+  225 entries computed in 0.00355 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17730,7 +17787,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00427 seconds
+  390 entries computed in 0.00383 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17741,7 +17798,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00422 seconds
+  390 entries computed in 0.00379 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17752,7 +17809,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.004 seconds
+  225 entries computed in 0.00355 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17763,7 +17820,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00372 seconds
+  225 entries computed in 0.00352 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17774,7 +17831,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00408 seconds
+  390 entries computed in 0.00384 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17785,7 +17842,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00405 seconds
+  390 entries computed in 0.00375 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17796,7 +17853,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00373 seconds
+  225 entries computed in 0.00344 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17807,7 +17864,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00371 seconds
+  225 entries computed in 0.00341 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17818,7 +17875,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00408 seconds
+  390 entries computed in 0.00369 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17829,7 +17886,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.0042 seconds
+  390 entries computed in 0.00369 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17840,7 +17897,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00393 seconds
+  225 entries computed in 0.00341 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17851,7 +17908,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00398 seconds
+  225 entries computed in 0.00339 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17862,7 +17919,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00438 seconds
+  390 entries computed in 0.00368 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17873,7 +17930,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00429 seconds
+  390 entries computed in 0.00372 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17884,7 +17941,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00385 seconds
+  225 entries computed in 0.00343 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17895,7 +17952,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00385 seconds
+  225 entries computed in 0.00342 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17906,7 +17963,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00421 seconds
+  390 entries computed in 0.00381 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17917,7 +17974,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00422 seconds
+  390 entries computed in 0.00381 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17928,7 +17985,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00461 seconds
+  225 entries computed in 0.00343 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17939,7 +17996,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00412 seconds
+  225 entries computed in 0.00343 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17950,7 +18007,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00422 seconds
+  390 entries computed in 0.0037 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17961,7 +18018,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00424 seconds
+  390 entries computed in 0.00369 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17972,7 +18029,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00399 seconds
+  225 entries computed in 0.00341 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17983,7 +18040,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00395 seconds
+  225 entries computed in 0.00346 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -17994,7 +18051,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00418 seconds
+  390 entries computed in 0.00371 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18005,7 +18062,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.0044 seconds
+  390 entries computed in 0.00367 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18016,7 +18073,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.0038 seconds
+  225 entries computed in 0.00347 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18027,7 +18084,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00373 seconds
+  225 entries computed in 0.00342 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18038,7 +18095,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00412 seconds
+  390 entries computed in 0.00369 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18049,7 +18106,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00406 seconds
+  390 entries computed in 0.00366 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18060,7 +18117,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00378 seconds
+  225 entries computed in 0.0034 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18071,7 +18128,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00388 seconds
+  225 entries computed in 0.0033 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18082,7 +18139,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00424 seconds
+  390 entries computed in 0.00363 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18093,7 +18150,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00416 seconds
+  390 entries computed in 0.00366 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18104,7 +18161,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00384 seconds
+  225 entries computed in 0.0034 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18115,7 +18172,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00383 seconds
+  225 entries computed in 0.00343 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18126,7 +18183,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00423 seconds
+  390 entries computed in 0.00379 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18137,7 +18194,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00421 seconds
+  390 entries computed in 0.00367 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18148,7 +18205,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00383 seconds
+  225 entries computed in 0.00342 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18159,7 +18216,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00386 seconds
+  225 entries computed in 0.00348 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18170,7 +18227,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00432 seconds
+  390 entries computed in 0.00369 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18181,7 +18238,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00436 seconds
+  390 entries computed in 0.00367 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18192,7 +18249,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00393 seconds
+  225 entries computed in 0.00342 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18203,7 +18260,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00384 seconds
+  225 entries computed in 0.00352 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18214,7 +18271,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.0042 seconds
+  390 entries computed in 0.00382 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18225,7 +18282,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00423 seconds
+  390 entries computed in 0.00368 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18236,7 +18293,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00385 seconds
+  225 entries computed in 0.0034 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18247,7 +18304,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  225 entries computed in 0.00387 seconds
+  225 entries computed in 0.0034 seconds
   Shape of reference tensor: (1, 15, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18258,7 +18315,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00421 seconds
+  390 entries computed in 0.00369 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18269,7 +18326,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  390 entries computed in 0.00422 seconds
+  390 entries computed in 0.00368 seconds
   Shape of reference tensor: (1, 26, 15)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [26, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
@@ -18280,6 +18337,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -18370,7 +18428,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  900 entries computed in 0.00161 seconds
+  900 entries computed in 0.0015 seconds
   Shape of reference tensor: (15, 15, 1, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 3 dims = [1, 2, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1]]
@@ -18380,7 +18438,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  900 entries computed in 0.00154 seconds
+  900 entries computed in 0.00139 seconds
   Shape of reference tensor: (15, 15, 1, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 3 dims = [1, 2, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1]]
@@ -18390,7 +18448,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  900 entries computed in 0.00151 seconds
+  900 entries computed in 0.0014 seconds
   Shape of reference tensor: (15, 15, 1, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 3 dims = [1, 2, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1]]
@@ -18400,7 +18458,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  900 entries computed in 0.00149 seconds
+  900 entries computed in 0.00142 seconds
   Shape of reference tensor: (15, 15, 1, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 3 dims = [1, 2, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1]]
@@ -18409,7 +18467,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00119 seconds
+  450 entries computed in 0.00112 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -18418,7 +18476,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00118 seconds
+  450 entries computed in 0.0011 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -18427,7 +18485,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00117 seconds
+  450 entries computed in 0.00112 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -18436,7 +18494,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00134 seconds
+  450 entries computed in 0.0011 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -18445,7 +18503,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00163 seconds
+  6750 entries computed in 0.00159 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -18454,7 +18512,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00159 seconds
+  6750 entries computed in 0.00157 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -18463,7 +18521,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00152 seconds
+  6750 entries computed in 0.00145 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -18472,7 +18530,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00164 seconds
+  6750 entries computed in 0.00152 seconds
   Shape of reference tensor: (15, 15, 2, 15)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14]]
@@ -18481,7 +18539,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00159 seconds
+  6750 entries computed in 0.00154 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -18490,7 +18548,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00162 seconds
+  6750 entries computed in 0.00154 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -18499,7 +18557,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00159 seconds
+  6750 entries computed in 0.00154 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -18508,7 +18566,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  6750 entries computed in 0.00159 seconds
+  6750 entries computed in 0.0016 seconds
   Shape of reference tensor: (15, 15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [15, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1], [6, 0], [6, 1], [7, 0], [7, 1], [8, 0], [8, 1], [9, 0], [9, 1], [10, 0], [10, 1], [11, 0], [11, 1], [12, 0], [12, 1], [13, 0], [13, 1], [14, 0], [14, 1]]
@@ -18517,6 +18575,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
@@ -18525,93 +18584,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {7: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [-1., -1., -1., -1., -1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
-            0.47014206,  0.05971587],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
-            0.47014206,  0.47014206],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
-            0.05971587,  0.47014206],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
-            0.47014206,  0.05971587]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
-            0.47014206,  0.47014206]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
-            0.05971587,  0.47014206]]])}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): array([[[ -3.33333333e-01,   5.94853971e-01,   5.94853971e-01,
+  {7: {MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): array([[[ -3.33333333e-01,   5.94853971e-01,   5.94853971e-01,
             -2.18970794e+00,  -8.80568256e-01,  -8.80568256e-01,
              7.61136513e-01],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -18621,9 +18597,9 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
   
-         [[  7.34134975e-15,   8.77076189e-15,   8.10462808e-15,
-             6.05071548e-15,   6.88338275e-15,   6.93889390e-15,
-             8.45157277e-15],
+         [[  7.45237205e-15,   8.21565038e-15,   7.21644966e-15,
+             5.71764858e-15,   6.68909372e-15,   6.66133815e-15,
+             8.34055047e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
@@ -18651,8 +18627,8 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
   
-         [[  9.27036226e-15,   1.22124533e-14,  -2.78456191e+00,
-             2.78456191e+00,   8.71525074e-15,   1.64170477e+00,
+         [[  9.43689571e-15,   1.15463195e-14,  -2.78456191e+00,
+             2.78456191e+00,   8.49320614e-15,   1.64170477e+00,
             -1.64170477e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -18684,9 +18660,9 @@ Compiler stage 2: Computing intermediate representation
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
-          [  7.34134975e-15,   8.77076189e-15,   8.10462808e-15,
-             6.05071548e-15,   6.88338275e-15,   6.93889390e-15,
-             8.45157277e-15],
+          [  7.45237205e-15,   8.21565038e-15,   7.21644966e-15,
+             5.71764858e-15,   6.68909372e-15,   6.66133815e-15,
+             8.34055047e-15],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
@@ -18714,8 +18690,8 @@ Compiler stage 2: Computing intermediate representation
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
-          [  9.27036226e-15,   1.22124533e-14,  -2.78456191e+00,
-             2.78456191e+00,   8.71525074e-15,   1.64170477e+00,
+          [  9.43689571e-15,   1.15463195e-14,  -2.78456191e+00,
+             2.78456191e+00,   8.49320614e-15,   1.64170477e+00,
             -1.64170477e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -18809,8 +18785,8 @@ Compiler stage 2: Computing intermediate representation
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00]],
   
-         [[ -7.07941648e-17,  -2.78456191e+00,   1.86130332e-15,
-             2.78456191e+00,   1.64170477e+00,   8.66091206e-16,
+         [[ -2.43306259e-16,  -2.78456191e+00,   5.34053683e-16,
+             2.78456191e+00,   1.64170477e+00,   4.42833521e-17,
             -1.64170477e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -18872,8 +18848,8 @@ Compiler stage 2: Computing intermediate representation
          [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00],
-          [ -7.07941648e-17,  -2.78456191e+00,   1.86130332e-15,
-             2.78456191e+00,   1.64170477e+00,   8.66091206e-16,
+          [ -2.43306259e-16,  -2.78456191e+00,   5.34053683e-16,
+             2.78456191e+00,   1.64170477e+00,   4.42833521e-17,
             -1.64170477e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -18935,85 +18911,169 @@ Compiler stage 2: Computing intermediate representation
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.44444444,  0.04103583,  0.32307438,  0.32307438,  0.88413424,
-            0.11229977,  0.11229977],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[ 0.44444444,  0.04103583,  0.32307438,  0.32307438,  0.88413424,
+            0.11229977,  0.11229977],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.44444444,  0.32307438,  0.04103583,  0.32307438,  0.11229977,
+            0.88413424,  0.11229977],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.11111111, -0.08076859, -0.08076859,  0.47435261, -0.02807494,
+           -0.02807494, -0.0525839 ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.11111111,  0.47435261, -0.08076859, -0.08076859, -0.0525839 ,
+           -0.02807494, -0.02807494],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [-0.11111111, -0.08076859,  0.47435261, -0.08076859, -0.02807494,
+           -0.0525839 , -0.02807494],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.44444444,  0.32307438,  0.32307438,  0.04103583,  0.11229977,
+            0.11229977,  0.88413424],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.44444444,  0.04103583,  0.32307438,  0.32307438,  0.88413424,
+            0.11229977,  0.11229977],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.44444444,  0.32307438,  0.04103583,  0.32307438,  0.11229977,
+            0.88413424,  0.11229977],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
+            0.47014206,  0.05971587]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
+            0.47014206,  0.47014206]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ],
+          [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
+            0.05971587,  0.47014206]]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1., -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
   
-         [[ 0.44444444,  0.32307438,  0.04103583,  0.32307438,  0.11229977,
-            0.88413424,  0.11229977],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[ 1.,  1.,  1.,  1.,  1.,  1.,  1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [-0.11111111, -0.08076859, -0.08076859,  0.47435261, -0.02807494,
-           -0.02807494, -0.0525839 ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [-0.11111111,  0.47435261, -0.08076859, -0.08076859, -0.0525839 ,
-           -0.02807494, -0.02807494],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [-1., -1., -1., -1., -1., -1., -1.]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [-0.11111111, -0.08076859,  0.47435261, -0.08076859, -0.02807494,
-           -0.0525839 , -0.02807494],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ]],
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.,  1.]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.44444444,  0.32307438,  0.32307438,  0.04103583,  0.11229977,
-            0.11229977,  0.88413424],
+         [[ 0.,  0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
+            0.47014206,  0.05971587],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.44444444,  0.04103583,  0.32307438,  0.32307438,  0.88413424,
-            0.11229977,  0.11229977],
+         [[ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
+            0.47014206,  0.47014206],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
-          [ 0.44444444,  0.32307438,  0.04103583,  0.32307438,  0.11229977,
-            0.88413424,  0.11229977],
+         [[ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
+            0.05971587,  0.47014206],
           [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ]],
   
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
           [ 0.33333333,  0.10128651,  0.10128651,  0.79742699,  0.47014206,
             0.47014206,  0.05971587]],
   
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
           [ 0.33333333,  0.79742699,  0.10128651,  0.10128651,  0.05971587,
             0.47014206,  0.47014206]],
   
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ,  0.        ],
           [ 0.33333333,  0.10128651,  0.79742699,  0.10128651,  0.47014206,
-            0.05971587,  0.47014206]]])}}}}}
+            0.05971587,  0.47014206]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
@@ -19026,126 +19086,54 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
-           0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
-           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
-           0.04103583,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
-           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
-           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
-           0.88413424,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
-           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.11111111, -0.11111111, -0.11111111,  0.44444444,
-           0.44444444,  0.44444444,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.08076859,  0.47435261, -0.08076859,  0.32307438,
-           0.04103583,  0.32307438,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.08076859, -0.08076859,  0.47435261,  0.32307438,
-           0.32307438,  0.04103583,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.47435261, -0.08076859, -0.08076859,  0.04103583,
-           0.32307438,  0.32307438,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.02807494, -0.0525839 , -0.02807494,  0.11229977,
-           0.88413424,  0.11229977,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.02807494, -0.02807494, -0.0525839 ,  0.11229977,
-           0.11229977,  0.88413424,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.0525839 , -0.02807494, -0.02807494,  0.88413424,
-           0.11229977,  0.11229977,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.33333333,  0.33333333,  0.33333333],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.10128651,  0.79742699,  0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.10128651,  0.10128651,  0.79742699],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.79742699,  0.10128651,  0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.47014206,  0.05971587,  0.47014206],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.47014206,  0.47014206,  0.05971587],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.05971587,  0.47014206,  0.47014206]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17,
+           -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00,
+            5.94853971e-01,   8.21565038e-15,  -5.94853971e-01,
+            3.18970794e+00,   1.15463195e-14,  -3.18970794e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
-            3.18970794e+00,  -3.18970794e+00,   1.86130332e-15,
+            5.94853971e-01,   7.21644966e-15,   2.18970794e+00,
+            4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00,
+           -2.18970794e+00,   5.71764858e-15,  -5.94853971e-01,
+            4.05146029e-01,   2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00,
+           -8.80568256e-01,   6.68909372e-15,   8.80568256e-01,
+            2.38863487e-01,   8.49320614e-15,  -2.38863487e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
-            2.38863487e-01,  -2.38863487e-01,   8.66091206e-16,
+           -8.80568256e-01,   6.66133815e-15,  -7.61136513e-01,
+            1.88056826e+00,   1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            7.61136513e-01,   8.34055047e-15,   8.80568256e-01,
+            1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10128651,  0.79742699,  0.10128651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10128651,  0.10128651,  0.79742699,  0.        ,  0.        ,
+           0.        ],
+         [ 0.79742699,  0.10128651,  0.10128651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.47014206,  0.05971587,  0.47014206,  0.        ,  0.        ,
+           0.        ],
+         [ 0.47014206,  0.47014206,  0.05971587,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05971587,  0.47014206,  0.47014206,  0.        ,  0.        ,
+           0.        ]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -19158,230 +19146,187 @@ Compiler stage 2: Computing intermediate representation
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.]]), 'FE0_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+           -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
+            3.18970794e+00,  -3.18970794e+00,   5.34053683e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+           -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+           -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
+            2.38863487e-01,  -2.38863487e-01,   4.42833521e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333],
+         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.79742699,
+           0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.10128651,
+           0.79742699],
+         [ 0.        ,  0.        ,  0.        ,  0.79742699,  0.10128651,
+           0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.05971587,
+           0.47014206],
+         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.47014206,
+           0.05971587],
+         [ 0.        ,  0.        ,  0.        ,  0.05971587,  0.47014206,
+           0.47014206]]), 'FE0_C0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
+            3.18970794e+00,  -3.18970794e+00,   5.34053683e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   8.77076189e-15,  -5.94853971e-01,
-            3.18970794e+00,   1.22124533e-14,  -3.18970794e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   8.10462808e-15,   2.18970794e+00,
-            4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.18970794e+00,   6.05071548e-15,  -5.94853971e-01,
-            4.05146029e-01,   2.78456191e+00,  -4.05146029e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   6.88338275e-15,   8.80568256e-01,
-            2.38863487e-01,   8.71525074e-15,  -2.38863487e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
+            2.38863487e-01,  -2.38863487e-01,   4.42833521e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   6.93889390e-15,  -7.61136513e-01,
-            1.88056826e+00,   1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.61136513e-01,   8.45157277e-15,   8.80568256e-01,
-            1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D01': array([[ -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D01': array([[ -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   8.77076189e-15,  -5.94853971e-01,
-            3.18970794e+00,   1.22124533e-14,  -3.18970794e+00,
+         [  5.94853971e-01,   8.21565038e-15,  -5.94853971e-01,
+            3.18970794e+00,   1.15463195e-14,  -3.18970794e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   8.10462808e-15,   2.18970794e+00,
+         [  5.94853971e-01,   7.21644966e-15,   2.18970794e+00,
             4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.18970794e+00,   6.05071548e-15,  -5.94853971e-01,
+         [ -2.18970794e+00,   5.71764858e-15,  -5.94853971e-01,
             4.05146029e-01,   2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   6.88338275e-15,   8.80568256e-01,
-            2.38863487e-01,   8.71525074e-15,  -2.38863487e-01,
+         [ -8.80568256e-01,   6.68909372e-15,   8.80568256e-01,
+            2.38863487e-01,   8.49320614e-15,  -2.38863487e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   6.93889390e-15,  -7.61136513e-01,
+         [ -8.80568256e-01,   6.66133815e-15,  -7.61136513e-01,
             1.88056826e+00,   1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.61136513e-01,   8.45157277e-15,   8.80568256e-01,
+         [  7.61136513e-01,   8.34055047e-15,   8.80568256e-01,
             1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
-            3.18970794e+00,  -3.18970794e+00,   1.86130332e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
-            2.38863487e-01,  -2.38863487e-01,   8.66091206e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333],
-         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.79742699,
-           0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.10128651,
-           0.79742699],
-         [ 0.        ,  0.        ,  0.        ,  0.79742699,  0.10128651,
-           0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.05971587,
-           0.47014206],
-         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.47014206,
-           0.05971587],
-         [ 0.        ,  0.        ,  0.        ,  0.05971587,  0.47014206,
-           0.47014206]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10128651,  0.79742699,  0.10128651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10128651,  0.10128651,  0.79742699,  0.        ,  0.        ,
-           0.        ],
-         [ 0.79742699,  0.10128651,  0.10128651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.47014206,  0.05971587,  0.47014206,  0.        ,  0.        ,
-           0.        ],
-         [ 0.47014206,  0.47014206,  0.05971587,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05971587,  0.47014206,  0.47014206,  0.        ,  0.        ,
-           0.        ]])}
-  
-  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
-           0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
-           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
-           0.04103583,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
-           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
-           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
-           0.88413424,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
-         [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
-           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.11111111, -0.11111111, -0.11111111,  0.44444444,
-           0.44444444,  0.44444444,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.08076859,  0.47435261, -0.08076859,  0.32307438,
-           0.04103583,  0.32307438,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.08076859, -0.08076859,  0.47435261,  0.32307438,
-           0.32307438,  0.04103583,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.47435261, -0.08076859, -0.08076859,  0.04103583,
-           0.32307438,  0.32307438,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.02807494, -0.0525839 , -0.02807494,  0.11229977,
-           0.88413424,  0.11229977,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.02807494, -0.02807494, -0.0525839 ,  0.11229977,
-           0.11229977,  0.88413424,  0.        ,  0.        ,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        , -0.0525839 , -0.02807494, -0.02807494,  0.88413424,
-           0.11229977,  0.11229977,  0.        ,  0.        ,  0.        ]]), 'FE1_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE0_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.33333333,  0.33333333,  0.33333333],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
@@ -19401,16 +19346,138 @@ Compiler stage 2: Computing intermediate representation
            0.        ,  0.        ,  0.47014206,  0.47014206,  0.05971587],
          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.05971587,  0.47014206,  0.47014206]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.        ,  0.        ,  0.05971587,  0.47014206,  0.47014206]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.11111111, -0.11111111, -0.11111111,  0.44444444,
+           0.44444444,  0.44444444,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.08076859,  0.47435261, -0.08076859,  0.32307438,
+           0.04103583,  0.32307438,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.08076859, -0.08076859,  0.47435261,  0.32307438,
+           0.32307438,  0.04103583,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.47435261, -0.08076859, -0.08076859,  0.04103583,
+           0.32307438,  0.32307438,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02807494, -0.0525839 , -0.02807494,  0.11229977,
+           0.88413424,  0.11229977,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02807494, -0.02807494, -0.0525839 ,  0.11229977,
+           0.11229977,  0.88413424,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.0525839 , -0.02807494, -0.02807494,  0.88413424,
+           0.11229977,  0.11229977,  0.        ,  0.        ,  0.        ]]), 'FE0_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
+           0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
+           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
+           0.04103583,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
+           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
+           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
+           0.88413424,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+         [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
+           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]])}
+  
+  tables: {'FE2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.94853971e-01,   8.21565038e-15,  -5.94853971e-01,
+            3.18970794e+00,   1.15463195e-14,  -3.18970794e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.94853971e-01,   7.21644966e-15,   2.18970794e+00,
+            4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.18970794e+00,   5.71764858e-15,  -5.94853971e-01,
+            4.05146029e-01,   2.78456191e+00,  -4.05146029e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.80568256e-01,   6.68909372e-15,   8.80568256e-01,
+            2.38863487e-01,   8.49320614e-15,  -2.38863487e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.80568256e-01,   6.66133815e-15,  -7.61136513e-01,
+            1.88056826e+00,   1.64170477e+00,  -1.88056826e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.61136513e-01,   8.34055047e-15,   8.80568256e-01,
+            1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10128651,  0.79742699,  0.10128651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10128651,  0.10128651,  0.79742699,  0.        ,  0.        ,
+           0.        ],
+         [ 0.79742699,  0.10128651,  0.10128651,  0.        ,  0.        ,
+           0.        ],
+         [ 0.47014206,  0.05971587,  0.47014206,  0.        ,  0.        ,
+           0.        ],
+         [ 0.47014206,  0.47014206,  0.05971587,  0.        ,  0.        ,
+           0.        ],
+         [ 0.05971587,  0.47014206,  0.47014206,  0.        ,  0.        ,
+           0.        ]]), 'FE2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.],
+         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
+           1.,  0.]]), 'FE0_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -19420,7 +19487,7 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
-            3.18970794e+00,  -3.18970794e+00,   1.86130332e-15,
+            3.18970794e+00,  -3.18970794e+00,   5.34053683e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
@@ -19435,248 +19502,222 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
-            2.38863487e-01,  -2.38863487e-01,   8.66091206e-16,
+            2.38863487e-01,  -2.38863487e-01,   4.42833521e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
             1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D10': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.],
-         [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,
-           1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333],
+         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.79742699,
+           0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.10128651,
+           0.79742699],
+         [ 0.        ,  0.        ,  0.        ,  0.79742699,  0.10128651,
+           0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.05971587,
+           0.47014206],
+         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.47014206,
+           0.05971587],
+         [ 0.        ,  0.        ,  0.        ,  0.05971587,  0.47014206,
+           0.47014206]]), 'FE0_C0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
+            1.33333333e+00,  -1.33333333e+00,  -2.43306259e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
+            3.18970794e+00,  -3.18970794e+00,   5.34053683e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
+            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   8.77076189e-15,  -5.94853971e-01,
-            3.18970794e+00,   1.22124533e-14,  -3.18970794e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.94853971e-01,   8.10462808e-15,   2.18970794e+00,
-            4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
+            2.38863487e-01,  -2.38863487e-01,   4.42833521e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.18970794e+00,   6.05071548e-15,  -5.94853971e-01,
-            4.05146029e-01,   2.78456191e+00,  -4.05146029e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   6.88338275e-15,   8.80568256e-01,
-            2.38863487e-01,   8.71525074e-15,  -2.38863487e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
+            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.80568256e-01,   6.93889390e-15,  -7.61136513e-01,
-            1.88056826e+00,   1.64170477e+00,  -1.88056826e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.61136513e-01,   8.45157277e-15,   8.80568256e-01,
-            1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D01': array([[ -3.33333333e-01,   7.34134975e-15,   3.33333333e-01,
-            1.33333333e+00,   9.27036226e-15,  -1.33333333e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D01': array([[ -3.33333333e-01,   7.45237205e-15,   3.33333333e-01,
+            1.33333333e+00,   9.43689571e-15,  -1.33333333e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   8.77076189e-15,  -5.94853971e-01,
-            3.18970794e+00,   1.22124533e-14,  -3.18970794e+00,
+         [  5.94853971e-01,   8.21565038e-15,  -5.94853971e-01,
+            3.18970794e+00,   1.15463195e-14,  -3.18970794e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   8.10462808e-15,   2.18970794e+00,
+         [  5.94853971e-01,   7.21644966e-15,   2.18970794e+00,
             4.05146029e-01,  -2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.18970794e+00,   6.05071548e-15,  -5.94853971e-01,
+         [ -2.18970794e+00,   5.71764858e-15,  -5.94853971e-01,
             4.05146029e-01,   2.78456191e+00,  -4.05146029e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   6.88338275e-15,   8.80568256e-01,
-            2.38863487e-01,   8.71525074e-15,  -2.38863487e-01,
+         [ -8.80568256e-01,   6.68909372e-15,   8.80568256e-01,
+            2.38863487e-01,   8.49320614e-15,  -2.38863487e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   6.93889390e-15,  -7.61136513e-01,
+         [ -8.80568256e-01,   6.66133815e-15,  -7.61136513e-01,
             1.88056826e+00,   1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.61136513e-01,   8.45157277e-15,   8.80568256e-01,
+         [  7.61136513e-01,   8.34055047e-15,   8.80568256e-01,
             1.88056826e+00,  -1.64170477e+00,  -1.88056826e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[ -3.33333333e-01,   3.33333333e-01,   0.00000000e+00,
-            1.33333333e+00,  -1.33333333e+00,  -7.07941648e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,   2.18970794e+00,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,  -2.78456191e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.94853971e-01,  -5.94853971e-01,   0.00000000e+00,
-            3.18970794e+00,  -3.18970794e+00,   1.86130332e-15,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -2.18970794e+00,  -5.94853971e-01,   0.00000000e+00,
-            4.05146029e-01,  -4.05146029e-01,   2.78456191e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,  -7.61136513e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,   1.64170477e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.80568256e-01,   8.80568256e-01,   0.00000000e+00,
-            2.38863487e-01,  -2.38863487e-01,   8.66091206e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  7.61136513e-01,   8.80568256e-01,   0.00000000e+00,
-            1.88056826e+00,  -1.88056826e+00,  -1.64170477e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333],
-         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.79742699,
-           0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.10128651,  0.10128651,
-           0.79742699],
-         [ 0.        ,  0.        ,  0.        ,  0.79742699,  0.10128651,
-           0.10128651],
-         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.05971587,
-           0.47014206],
-         [ 0.        ,  0.        ,  0.        ,  0.47014206,  0.47014206,
-           0.05971587],
-         [ 0.        ,  0.        ,  0.        ,  0.05971587,  0.47014206,
-           0.47014206]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10128651,  0.79742699,  0.10128651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10128651,  0.10128651,  0.79742699,  0.        ,  0.        ,
-           0.        ],
-         [ 0.79742699,  0.10128651,  0.10128651,  0.        ,  0.        ,
-           0.        ],
-         [ 0.47014206,  0.05971587,  0.47014206,  0.        ,  0.        ,
-           0.        ],
-         [ 0.47014206,  0.47014206,  0.05971587,  0.        ,  0.        ,
-           0.        ],
-         [ 0.05971587,  0.47014206,  0.47014206,  0.        ,  0.        ,
-           0.        ]])}
-  
-  name_map: {}
-  
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C1_D10': 'FE1_C1_D10', 'FE1_C2_D10': 'FE1_C2_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE2': 'FE2', 'FE1_C2_D01': 'FE1_C2_D01', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE1_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
-           0.44444444],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE0_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.33333333,  0.33333333,  0.33333333],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.10128651,  0.79742699,  0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.10128651,  0.10128651,  0.79742699],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.79742699,  0.10128651,  0.10128651],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.47014206,  0.05971587,  0.47014206],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.47014206,  0.47014206,  0.05971587],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.05971587,  0.47014206,  0.47014206]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.11111111, -0.11111111, -0.11111111,  0.44444444,
+           0.44444444,  0.44444444,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.08076859,  0.47435261, -0.08076859,  0.32307438,
+           0.04103583,  0.32307438,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.08076859, -0.08076859,  0.47435261,  0.32307438,
+           0.32307438,  0.04103583,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.47435261, -0.08076859, -0.08076859,  0.04103583,
+           0.32307438,  0.32307438,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02807494, -0.0525839 , -0.02807494,  0.11229977,
+           0.88413424,  0.11229977,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02807494, -0.02807494, -0.0525839 ,  0.11229977,
+           0.11229977,  0.88413424,  0.        ,  0.        ,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.0525839 , -0.02807494, -0.02807494,  0.88413424,
+           0.11229977,  0.11229977,  0.        ,  0.        ,  0.        ]]), 'FE0_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
+           0.44444444,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
-           0.32307438],
+           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
-           0.04103583],
+           0.04103583,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
-           0.32307438],
+           0.32307438,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
-           0.11229977],
+           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
-           0.88413424],
+           0.88413424,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
          [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
-           0.11229977]]), 'FE0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE2': array([[ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_C0_D01': array([[ -3.33333333e-01,   3.33333333e-01,   1.33333333e+00,
+           0.11229977,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ]])}
+  
+  name_map: {}
+  
+  inv_name_map: {'FE2_C1_D01': 'FE2_C1_D01', 'FE0_C1_D01': 'FE0_C1_D01', 'FE1': 'FE1', 'FE2_C0_D01': 'FE2_C0_D01', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C2_D10': 'FE0_C2_D10', 'FE0_C1_D10': 'FE0_C1_D10', 'FE2_C1_D10': 'FE2_C1_D10', 'FE2_C1': 'FE2_C1', 'FE2_C0': 'FE2_C0', 'FE0_C0_D01': 'FE0_C0_D01', 'FE0_C2_D01': 'FE0_C2_D01', 'FE2_C0_D10': 'FE2_C0_D10', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  
+  QG-utils, psi_tables, unique_tables:
+  {'FE0_C0_D10': array([[-0.33333333,  0.33333333,  1.33333333, -1.33333333,  0.        ],
+         [ 0.59485397,  2.18970794,  0.40514603, -0.40514603, -2.78456191],
+         [ 0.59485397, -0.59485397,  3.18970794, -3.18970794,  0.        ],
+         [-2.18970794, -0.59485397,  0.40514603, -0.40514603,  2.78456191],
+         [-0.88056826, -0.76113651,  1.88056826, -1.88056826,  1.64170477],
+         [-0.88056826,  0.88056826,  0.23886349, -0.23886349,  0.        ],
+         [ 0.76113651,  0.88056826,  1.88056826, -1.88056826, -1.64170477]]), 'FE0_C0_D01': array([[ -3.33333333e-01,   3.33333333e-01,   1.33333333e+00,
             0.00000000e+00,  -1.33333333e+00],
          [  5.94853971e-01,  -5.94853971e-01,   3.18970794e+00,
-            1.22124533e-14,  -3.18970794e+00],
+            1.15463195e-14,  -3.18970794e+00],
          [  5.94853971e-01,   2.18970794e+00,   4.05146029e-01,
            -2.78456191e+00,  -4.05146029e-01],
          [ -2.18970794e+00,  -5.94853971e-01,   4.05146029e-01,
@@ -19686,22 +19727,41 @@ Compiler stage 2: Computing intermediate representation
          [ -8.80568256e-01,  -7.61136513e-01,   1.88056826e+00,
             1.64170477e+00,  -1.88056826e+00],
          [  7.61136513e-01,   8.80568256e-01,   1.88056826e+00,
-           -1.64170477e+00,  -1.88056826e+00]]), 'FE1_C0_D10': array([[-0.33333333,  0.33333333,  1.33333333, -1.33333333,  0.        ],
-         [ 0.59485397,  2.18970794,  0.40514603, -0.40514603, -2.78456191],
-         [ 0.59485397, -0.59485397,  3.18970794, -3.18970794,  0.        ],
-         [-2.18970794, -0.59485397,  0.40514603, -0.40514603,  2.78456191],
-         [-0.88056826, -0.76113651,  1.88056826, -1.88056826,  1.64170477],
-         [-0.88056826,  0.88056826,  0.23886349, -0.23886349,  0.        ],
-         [ 0.76113651,  0.88056826,  1.88056826, -1.88056826, -1.64170477]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333],
+           -1.64170477e+00,  -1.88056826e+00]]), 'FE0_C2_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]]), 'FE1': array([[ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.],
+         [ 1.]]), 'FE0_C2': array([[ 0.33333333,  0.33333333,  0.33333333],
          [ 0.10128651,  0.79742699,  0.10128651],
          [ 0.10128651,  0.10128651,  0.79742699],
          [ 0.79742699,  0.10128651,  0.10128651],
          [ 0.47014206,  0.05971587,  0.47014206],
          [ 0.47014206,  0.47014206,  0.05971587],
-         [ 0.05971587,  0.47014206,  0.47014206]])}
+         [ 0.05971587,  0.47014206,  0.47014206]]), 'FE0_C0': array([[-0.11111111, -0.11111111, -0.11111111,  0.44444444,  0.44444444,
+           0.44444444],
+         [-0.08076859,  0.47435261, -0.08076859,  0.32307438,  0.04103583,
+           0.32307438],
+         [-0.08076859, -0.08076859,  0.47435261,  0.32307438,  0.32307438,
+           0.04103583],
+         [ 0.47435261, -0.08076859, -0.08076859,  0.04103583,  0.32307438,
+           0.32307438],
+         [-0.02807494, -0.0525839 , -0.02807494,  0.11229977,  0.88413424,
+           0.11229977],
+         [-0.02807494, -0.02807494, -0.0525839 ,  0.11229977,  0.11229977,
+           0.88413424],
+         [-0.0525839 , -0.02807494, -0.02807494,  0.88413424,  0.11229977,
+           0.11229977]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE1_C0': ('FE1_C0', (6, [0, 1, 2, 3, 4, 5]), False, False), 'FE1_C1': ('FE1_C0', (9, [6, 7, 8, 9, 10, 11]), False, False), 'FE1_C2': ('FE0_C0', (12, [12, 13, 14]), False, False), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE1_C1_D10': ('FE1_C0_D10', (11, [6, 7, 9, 10, 11]), False, False), 'FE1_C2_D10': ('FE0_C0_D01', (14, [12, 13]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE0_C0_D [...]
+  {'FE2_C1_D01': ('FE0_C2_D01', (13, [3, 5]), False, False), 'FE0_C1_D01': ('FE0_C0_D01', (4, [6, 8, 9, 10, 11]), False, False), 'FE1': ('FE1', (), False, True), 'FE2_C0_D01': ('FE0_C2_D01', (10, [0, 2]), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (2, [0, 1, 3, 4, 5]), False, False), 'FE0_C2_D10': ('FE0_C2_D01', (8, [12, 13]), False, False), 'FE0_C1_D10': ('FE0_C0_D10', (5, [6, 7, 9, 10, 11]), False, False), 'FE2_C1_D10': ('FE0_C2_D01', (14, [3, 4]), False, False), 'FE2_C1': ('FE0_C2',  [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -19764,15 +19824,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {2: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 0): array([[ -2.08166817e-17,   5.55111512e-17],
-         [  7.88675135e-01,   2.11324865e-01],
-         [  2.11324865e-01,   7.88675135e-01]])}, 1: {(0, 0): array([[  7.88675135e-01,   2.11324865e-01],
-         [ -2.08166817e-17,   5.55111512e-17],
-         [  2.11324865e-01,   7.88675135e-01]])}, 2: {(0, 0): array([[ 0.78867513,  0.21132487],
-         [ 0.21132487,  0.78867513],
-         [ 0.        ,  0.        ]])}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {0: {(0, 0): array([[[  2.77555756e-17,   4.16333634e-17],
+  {2: {MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1)): {None: {0: {(0, 0): array([[[  2.77555756e-17,   4.16333634e-17],
           [  0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00]],
   
@@ -19946,7 +20001,7 @@ Compiler stage 2: Computing intermediate representation
   
          [[  0.00000000e+00,   0.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00]]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16],
@@ -20090,20 +20145,40 @@ Compiler stage 2: Computing intermediate representation
           [ 0.21132487,  0.78867513]],
   
          [[ 0.        ,  0.        ],
-          [ 0.        ,  0.        ]]])}}}}}
+          [ 0.        ,  0.        ]]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {0: {(0, 0): array([[ -2.08166817e-17,   5.55111512e-17],
+         [  7.88675135e-01,   2.11324865e-01],
+         [  2.11324865e-01,   7.88675135e-01]])}, 1: {(0, 0): array([[  7.88675135e-01,   2.11324865e-01],
+         [ -2.08166817e-17,   5.55111512e-17],
+         [  2.11324865e-01,   7.88675135e-01]])}, 2: {(0, 0): array([[ 0.78867513,  0.21132487],
+         [ 0.21132487,  0.78867513],
+         [ 0.        ,  0.        ]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_f0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
-         [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE0_f1': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
-         [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE0_f2': array([[ 0.78867513,  0.21132487,  0.        ],
-         [ 0.21132487,  0.78867513,  0.        ]]), 'FE1_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE2_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
+         [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE0_f1': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
+         [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE0_f2': array([[ 0.78867513,  0.21132487,  0.        ],
+         [ 0.21132487,  0.78867513,  0.        ]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.78867513,  0.21132487,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.21132487,  0.78867513,  0.        ]]), 'FE1_f2_C0': array([[  4.55341801e-01,  -1.22008468e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.66666667e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.22008468e-01,   4.55341801e-01,   0.00000000e+00,
+            2.77555756e-17,  -5.55111512e-17,   6.66666667e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             4.55341801e-01,  -1.22008468e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   6.66666667e-01,
@@ -20112,22 +20187,37 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.22008468e-01,   4.55341801e-01,   0.00000000e+00,
             2.77555756e-17,  -5.55111512e-17,   6.66666667e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C0': array([[ 0.78867513,  0.21132487,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0': array([[ 0.78867513,  0.21132487,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.21132487,  0.78867513,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE1_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.78867513,  0.21132487,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.21132487,  0.78867513,
-           0.        ]]), 'FE2_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
+           0.        ]]), 'FE2_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f0_C0': array([[  2.77555756e-17,   4.55341801e-01,  -1.22008468e-01,
+            6.66666667e-01,  -1.38777878e-17,  -1.73472348e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.16333634e-17,  -1.22008468e-01,   4.55341801e-01,
+            6.66666667e-01,  -5.55111512e-17,  -4.16333634e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             2.77555756e-17,   4.55341801e-01,  -1.22008468e-01,
             6.66666667e-01,  -1.38777878e-17,  -1.73472348e-17,
@@ -20136,59 +20226,39 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             4.16333634e-17,  -1.22008468e-01,   4.55341801e-01,
             6.66666667e-01,  -5.55111512e-17,  -4.16333634e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  2.77555756e-17,   4.55341801e-01,  -1.22008468e-01,
-            6.66666667e-01,  -1.38777878e-17,  -1.73472348e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -1.22008468e-01,   4.55341801e-01,
-            6.66666667e-01,  -5.55111512e-17,  -4.16333634e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE1_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f2_C0': array([[  4.55341801e-01,  -1.22008468e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.66666667e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.78867513,  0.21132487,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.21132487,  0.78867513,
+           0.        ]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.22008468e-01,   4.55341801e-01,   0.00000000e+00,
-            2.77555756e-17,  -5.55111512e-17,   6.66666667e-01,
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.78867513,  0.21132487,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.21132487,  0.78867513,  0.        ]]), 'FE2_f1_C0': array([[  4.55341801e-01,   2.08166817e-17,  -1.22008468e-01,
-           -1.38777878e-17,   6.66666667e-01,  -1.73472348e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.22008468e-01,   9.02056208e-17,   4.55341801e-01,
-           -2.77555756e-17,   6.66666667e-01,  -4.16333634e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             4.55341801e-01,   2.08166817e-17,  -1.22008468e-01,
            -1.38777878e-17,   6.66666667e-01,  -1.73472348e-17,
@@ -20197,33 +20267,38 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.22008468e-01,   9.02056208e-17,   4.55341801e-01,
            -2.77555756e-17,   6.66666667e-01,  -4.16333634e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C0': array([[  4.55341801e-01,   2.08166817e-17,  -1.22008468e-01,
+           -1.38777878e-17,   6.66666667e-01,  -1.73472348e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.22008468e-01,   9.02056208e-17,   4.55341801e-01,
+           -2.77555756e-17,   6.66666667e-01,  -4.16333634e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f1_C0': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
   
   tables: {'FE0_f0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
          [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE0_f1': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
          [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE0_f2': array([[ 0.78867513,  0.21132487,  0.        ],
-         [ 0.21132487,  0.78867513,  0.        ]]), 'FE1_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ 0.21132487,  0.78867513,  0.        ]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.78867513,  0.21132487,  0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ,  0.21132487,  0.78867513,  0.        ]]), 'FE1_f2_C0': array([[  4.55341801e-01,  -1.22008468e-01,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   6.66666667e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.22008468e-01,   4.55341801e-01,   0.00000000e+00,
+            2.77555756e-17,  -5.55111512e-17,   6.66666667e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             4.55341801e-01,  -1.22008468e-01,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   6.66666667e-01,
@@ -20232,22 +20307,29 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.22008468e-01,   4.55341801e-01,   0.00000000e+00,
             2.77555756e-17,  -5.55111512e-17,   6.66666667e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C0': array([[ 0.78867513,  0.21132487,  0.        ,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0': array([[ 0.78867513,  0.21132487,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.21132487,  0.78867513,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE1_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.78867513,  0.21132487,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.21132487,  0.78867513,
-           0.        ]]), 'FE2_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.        ]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f0_C0': array([[  2.77555756e-17,   4.55341801e-01,  -1.22008468e-01,
+            6.66666667e-01,  -1.38777878e-17,  -1.73472348e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.16333634e-17,  -1.22008468e-01,   4.55341801e-01,
+            6.66666667e-01,  -5.55111512e-17,  -4.16333634e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             2.77555756e-17,   4.55341801e-01,  -1.22008468e-01,
             6.66666667e-01,  -1.38777878e-17,  -1.73472348e-17,
@@ -20256,47 +20338,35 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             4.16333634e-17,  -1.22008468e-01,   4.55341801e-01,
             6.66666667e-01,  -5.55111512e-17,  -4.16333634e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  2.77555756e-17,   4.55341801e-01,  -1.22008468e-01,
-            6.66666667e-01,  -1.38777878e-17,  -1.73472348e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -1.22008468e-01,   4.55341801e-01,
-            6.66666667e-01,  -5.55111512e-17,  -4.16333634e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f0_C0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.55111512e-17,   2.11324865e-01,   7.88675135e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE1_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f2_C0': array([[  4.55341801e-01,  -1.22008468e-01,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   6.66666667e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   2.11324865e-01,   7.88675135e-01]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.78867513,  0.21132487,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.21132487,  0.78867513,
+           0.        ]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f1_C0': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.22008468e-01,   4.55341801e-01,   0.00000000e+00,
-            2.77555756e-17,  -5.55111512e-17,   6.66666667e-01,
+         [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C2': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.78867513,  0.21132487,  0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-           0.        ,  0.        ,  0.21132487,  0.78867513,  0.        ]]), 'FE2_f1_C0': array([[  4.55341801e-01,   2.08166817e-17,  -1.22008468e-01,
-           -1.38777878e-17,   6.66666667e-01,  -1.73472348e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.22008468e-01,   9.02056208e-17,   4.55341801e-01,
-           -2.77555756e-17,   6.66666667e-01,  -4.16333634e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             4.55341801e-01,   2.08166817e-17,  -1.22008468e-01,
            -1.38777878e-17,   6.66666667e-01,  -1.73472348e-17,
@@ -20305,38 +20375,29 @@ Compiler stage 2: Computing intermediate representation
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.22008468e-01,   9.02056208e-17,   4.55341801e-01,
            -2.77555756e-17,   6.66666667e-01,  -4.16333634e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C2': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C0': array([[  4.55341801e-01,   2.08166817e-17,  -1.22008468e-01,
+           -1.38777878e-17,   6.66666667e-01,  -1.73472348e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.22008468e-01,   9.02056208e-17,   4.55341801e-01,
+           -2.77555756e-17,   6.66666667e-01,  -4.16333634e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            7.88675135e-01,  -2.08166817e-17,   2.11324865e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.11324865e-01,   5.55111512e-17,   7.88675135e-01]]), 'FE1_f1_C0': array([[  7.88675135e-01,  -2.08166817e-17,   2.11324865e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  2.11324865e-01,   5.55111512e-17,   7.88675135e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
   
-  name_map: {'FE1_f0_C1_D10': ['FE1_f1_C1_D10', 'FE1_f2_C1_D10'], 'FE1_f0_C0_D01': ['FE1_f1_C0_D01', 'FE1_f2_C0_D01'], 'FE1_f0_C1_D01': ['FE1_f1_C1_D01', 'FE1_f2_C1_D01'], 'FE1_f0_C0_D10': ['FE1_f1_C0_D10', 'FE1_f2_C0_D10']}
+  name_map: {'FE2_f0_C0_D10': ['FE2_f1_C0_D10', 'FE2_f2_C0_D10'], 'FE2_f0_C1_D01': ['FE2_f1_C1_D01', 'FE2_f2_C1_D01'], 'FE2_f0_C0_D01': ['FE2_f1_C0_D01', 'FE2_f2_C0_D01'], 'FE2_f0_C1_D10': ['FE2_f1_C1_D10', 'FE2_f2_C1_D10']}
   
-  inv_name_map: {'FE0_f0': 'FE0_f0', 'FE1_f1_C0_D10': 'FE1_f0_C0_D10', 'FE0_f2': 'FE0_f2', 'FE1_f0_C1_D01': 'FE1_f0_C1_D01', 'FE1_f2_C1_D01': 'FE1_f0_C1_D01', 'FE1_f1_C1_D10': 'FE1_f0_C1_D10', 'FE1_f2_C0_D10': 'FE1_f0_C0_D10', 'FE1_f2_C0': 'FE1_f2_C0', 'FE1_f2_C1': 'FE1_f2_C1', 'FE2_f0_C2': 'FE2_f0_C2', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0': 'FE2_f0_C0', 'FE1_f2_C0_D01': 'FE1_f0_C0_D01', 'FE0_f1': 'FE0_f1', 'FE1_f0_C0_D10': 'FE1_f0_C0_D10', 'FE1_f1_C0_D01': 'FE1_f0_C0_D01', 'FE1_f0_C0':  [...]
+  inv_name_map: {'FE2_f1_C1_D01': 'FE2_f0_C1_D01', 'FE2_f2_C0_D10': 'FE2_f0_C0_D10', 'FE0_f0': 'FE0_f0', 'FE0_f1': 'FE0_f1', 'FE0_f2': 'FE0_f2', 'FE2_f0_C1_D01': 'FE2_f0_C1_D01', 'FE1_f2_C2': 'FE1_f2_C2', 'FE1_f2_C0': 'FE1_f2_C0', 'FE1_f2_C1': 'FE1_f2_C1', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0_D01': 'FE2_f0_C0_D01', 'FE2_f0_C0': 'FE2_f0_C0', 'FE2_f2_C1_D01': 'FE2_f0_C1_D01', 'FE2_f1_C0_D10': 'FE2_f0_C0_D10', 'FE2_f0_C0_D10': 'FE2_f0_C0_D10', 'FE2_f2_C0_D01': 'FE2_f0_C0_D01', 'FE2_f0_C1_D1 [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_f0': array([[ 0.78867513,  0.21132487],
-         [ 0.21132487,  0.78867513]]), 'FE2_f0_C0': array([[ 0.4553418 , -0.12200847,  0.66666667],
-         [-0.12200847,  0.4553418 ,  0.66666667]]), 'FE1_f0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.]])}
+         [ 0.21132487,  0.78867513]]), 'FE2_f0_C0_D01': array([[-1.,  1.],
+         [-1.,  1.]]), 'FE1_f0_C0': array([[ 0.4553418 , -0.12200847,  0.66666667],
+         [-0.12200847,  0.4553418 ,  0.66666667]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_f0': ('FE0_f0', (0, [1, 2]), False, False), 'FE1_f1_C0_D10': ('FE1_f0_C0_D01', (5, [0, 1]), False, False), 'FE0_f2': ('FE0_f0', (2, [0, 1]), False, False), 'FE1_f0_C1_D01': ('FE1_f0_C0_D01', (7, [3, 5]), False, False), 'FE1_f2_C1_D01': ('FE1_f0_C0_D01', (7, [3, 5]), False, False), 'FE1_f1_C1_D10': ('FE1_f0_C0_D01', (8, [3, 4]), False, False), 'FE1_f2_C0_D10': ('FE1_f0_C0_D01', (5, [0, 1]), False, False), 'FE1_f2_C0': ('FE0_f0', (11, [0, 1]), False, False), 'FE1_f2_C1': ('FE0_f0', [...]
+  {'FE2_f1_C1_D01': ('FE2_f0_C0_D01', (16, [3, 5]), False, False), 'FE2_f2_C0_D10': ('FE2_f0_C0_D01', (14, [0, 1]), False, False), 'FE0_f0': ('FE0_f0', (0, [1, 2]), False, False), 'FE0_f1': ('FE0_f0', (1, [0, 2]), False, False), 'FE0_f2': ('FE0_f0', (2, [0, 1]), False, False), 'FE2_f0_C1_D01': ('FE2_f0_C0_D01', (16, [3, 5]), False, False), 'FE1_f2_C2': ('FE0_f0', (11, [12, 13]), False, False), 'FE1_f2_C0': ('FE1_f0_C0', (9, [0, 1, 5]), False, False), 'FE1_f2_C1': ('FE1_f0_C0', (10, [6, 7 [...]
   Transforming exterior facet integral 0
   Reusing element from cache
   Reusing element from cache
@@ -20368,7 +20429,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  15 entries computed in 0.00111 seconds
+  15 entries computed in 0.00103 seconds
   Shape of reference tensor: (15,)
   Primary multi index:   rank = 0 dims = [] indices = [[]]
   Secondary multi index: rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
@@ -20377,7 +20438,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  15 entries computed in 0.00102 seconds
+  15 entries computed in 0.000947 seconds
   Shape of reference tensor: (15,)
   Primary multi index:   rank = 0 dims = [] indices = [[]]
   Secondary multi index: rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
@@ -20386,7 +20447,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  15 entries computed in 0.00102 seconds
+  15 entries computed in 0.000952 seconds
   Shape of reference tensor: (15,)
   Primary multi index:   rank = 0 dims = [] indices = [[]]
   Secondary multi index: rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
@@ -20394,9 +20455,10 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 2.2876 seconds.
+Compiler stage 2 finished in 2.30518 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
@@ -20417,1634 +20479,99 @@ Compiler stage 3: Optimizing intermediate representation
   Optimising expressions for facet integral 1
   Optimising expressions for facet integral 2
   
-Compiler stage 3 finished in 0.040272 seconds.
+Compiler stage 3 finished in 0.0453558 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 14 element(s)
+  Generating code for 15 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: C1
-  Removing unused variable: C0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: C1
-  Removing unused variable: C0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 14 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp0
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: C1
+  Removing unused variable: C0
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp0
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: C1
+  Removing unused variable: C0
+  Generating code for 15 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -22101,18 +20628,18 @@ Compiler stage 4: Generating code
   Removing unused variable: facet_area
   Generating code for forms
   
-Compiler stage 4 finished in 2.64111 seconds.
+Compiler stage 4 finished in 2.90447 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.00231504 seconds.
+Compiler stage 4.1 finished in 0.00240588 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./AdaptiveNavierStokes.h.
-Compiler stage 5 finished in 0.003865 seconds.
+Compiler stage 5 finished in 0.00524402 seconds.
 
-FFC finished in 5.53266 seconds.
+FFC finished in 6.25351 seconds.
+Output written to ./AdaptiveNavierStokes.h.
diff --git a/demo/undocumented/auto-adaptive-navier-stokes/cpp/main.cpp b/demo/undocumented/auto-adaptive-navier-stokes/cpp/main.cpp
index 39b1268..59459df 100644
--- a/demo/undocumented/auto-adaptive-navier-stokes/cpp/main.cpp
+++ b/demo/undocumented/auto-adaptive-navier-stokes/cpp/main.cpp
@@ -59,40 +59,40 @@ int main()
   parameters["refinement_algorithm"] = "plaza_with_parent_facets";
 
   // Create mesh and function space
-  Mesh mesh("../channel_with_flap.xml.gz");
-  AdaptiveNavierStokes::BilinearForm::TrialSpace W(mesh);
+  auto mesh = std::make_shared<Mesh>("../channel_with_flap.xml.gz");
+  auto W = std::make_shared<AdaptiveNavierStokes::BilinearForm::TrialSpace>(mesh);
 
-  // Unknown
-  Function w(W);
+  // Unknown field
+  auto w = std::make_shared<Function>(W);
 
   // Define boundary condition
-  Constant u0(0.0, 0.0);
+  auto u0 = std::make_shared<Constant>(0.0, 0.0);
   Noslip noslip;
-  MeshFunction<std::size_t> noslip_markers(mesh, mesh.topology().dim() - 1, 1);
-  noslip.mark(noslip_markers, 0);
-  SubSpace W0(W, 0);
-  DirichletBC bc(W0, u0, noslip_markers, 0);
+  auto noslip_markers = std::make_shared<FacetFunction<std::size_t>>(mesh, 1);
+  noslip.mark(*noslip_markers, 0);
+  auto W0 = W->sub(0);
+  auto bc = std::make_shared<DirichletBC>(W0, u0, noslip_markers, 0);
 
   // Create variational formulation and assign coefficients
-  Constant nu(0.02);
-  AdaptiveNavierStokes::LinearForm F(W);
-  Pressure p0;
-  F.p0 = p0;
-  F.nu = nu;
-  F.w = w;
+  auto nu = std::make_shared<Constant>(0.02);
+  auto F = std::make_shared<AdaptiveNavierStokes::LinearForm>(W);
+  auto p0 = std::make_shared<Pressure>();
+  F->p0 = p0;
+  F->nu = nu;
+  F->w = w;
 
   // Initialize Jacobian dF
-  AdaptiveNavierStokes::BilinearForm dF(W, W);
-  dF.nu = nu;
-  dF.w = w;
+  auto dF = std::make_shared<AdaptiveNavierStokes::BilinearForm>(W, W);
+  dF->nu = nu;
+  dF->w = w;
 
   // Define goal functional
-  AdaptiveNavierStokes::GoalFunctional M(mesh);
-  M.w = w;
+  auto M = std::make_shared<AdaptiveNavierStokes::GoalFunctional>(mesh);
+  M->w = w;
   Outflow outflow;
-  MeshFunction<std::size_t> outflow_markers(mesh, mesh.topology().dim()-1, 1);
-  outflow.mark(outflow_markers, 0);
-  M.ds = outflow_markers;
+  auto outflow_markers = std::make_shared<FacetFunction<std::size_t>>(mesh, 1);
+  outflow.mark(*outflow_markers, 0);
+  M->ds = outflow_markers;
 
   // Define error tolerance
   double tol = 1.e-5;
@@ -103,7 +103,8 @@ int main()
 
   // Define variational problem from the variational form F, specify
   // the unknown Function w and the boundary condition bc
-  NonlinearVariationalProblem pde(F, w, bc, dF);
+  std::vector<std::shared_ptr<const DirichletBC>> bcs {bc};
+  auto pde = std::make_shared<NonlinearVariationalProblem>(F, w, bcs, dF);
 
   // Define solver
   AdaptiveNonlinearVariationalSolver solver(pde, M);
@@ -122,7 +123,7 @@ int main()
   list_timings(TimingClear::clear, { TimingType::wall });
 
   // Plot solutions
-  Function solution = w.leaf_node();
+  Function solution = w->leaf_node();
   plot(solution[0], "Velocity on finest mesh");
   plot(solution[1], "Pressure on finest mesh");
   interactive();
diff --git a/demo/undocumented/auto-adaptive-navier-stokes/python/demo_auto-adaptive-navier-stokes.py b/demo/undocumented/auto-adaptive-navier-stokes/python/demo_auto-adaptive-navier-stokes.py
index f8e139e..e831ab9 100644
--- a/demo/undocumented/auto-adaptive-navier-stokes/python/demo_auto-adaptive-navier-stokes.py
+++ b/demo/undocumented/auto-adaptive-navier-stokes/python/demo_auto-adaptive-navier-stokes.py
@@ -46,9 +46,9 @@ nu = Constant(0.02)
 mesh = Mesh("../channel_with_flap.xml.gz")
 
 # Define function spaces (Taylor-Hood)
-V = VectorFunctionSpace(mesh, "CG", 2)
-Q = FunctionSpace(mesh, "CG", 1)
-W = V * Q
+V = VectorElement("CG", mesh.ufl_cell(), 2)
+Q = FiniteElement("CG", mesh.ufl_cell(), 1)
+W = FunctionSpace(mesh, V * Q)
 
 # Define unknown and test function(s)
 (v, q) = TestFunctions(W)
@@ -56,7 +56,7 @@ w = Function(W)
 (u, p) = (as_vector((w[0], w[1])), w[2])
 
 # Prescribed pressure
-p0 = Expression("(4.0 - x[0])/4.0")
+p0 = Expression("(4.0 - x[0])/4.0", degree=2)
 
 # Define variational forms
 n = FacetNormal(mesh)
diff --git a/demo/undocumented/block-matrix/cpp/CMakeLists.txt b/demo/undocumented/block-matrix/cpp/CMakeLists.txt
index f957a8a..147b29a 100644
--- a/demo/undocumented/block-matrix/cpp/CMakeLists.txt
+++ b/demo/undocumented/block-matrix/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/block-matrix/cpp/StiffnessMatrix.h b/demo/undocumented/block-matrix/cpp/StiffnessMatrix.h
index 9c7219d..4b32449 100644
--- a/demo/undocumented/block-matrix/cpp/StiffnessMatrix.h
+++ b/demo/undocumented/block-matrix/cpp/StiffnessMatrix.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,107 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __STIFFNESSMATRIX_H
 #define __STIFFNESSMATRIX_H
-
 #include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class stiffnessmatrix_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stiffnessmatrix_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stiffnessmatrix_finite_element_0()
+  ~stiffnessmatrix_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +122,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +221,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +241,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +278,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +290,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +299,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +752,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +807,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +815,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +839,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +866,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +903,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new stiffnessmatrix_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stiffnessmatrix_dofmap_0: public ufc::dofmap
+class stiffnessmatrix_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  stiffnessmatrix_dofmap_0() : ufc::dofmap()
+  stiffnessmatrix_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stiffnessmatrix_dofmap_0()
+  ~stiffnessmatrix_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -1041,274 +990,1962 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    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;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new stiffnessmatrix_dofmap_0();
-  }
-
-};
-
-/// 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 stiffnessmatrix_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  stiffnessmatrix_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stiffnessmatrix_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
-    
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-  }
-
-};
-
-/// 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 stiffnessmatrix_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  stiffnessmatrix_cell_integral_1_otherwise() : ufc::cell_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~stiffnessmatrix_cell_integral_1_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute cell volume
-    
-    
-    // Compute circumradius of triangle in 2D
-    
-    
-    // Array of quadrature weights.
-    static const double W6[6] = {0.054975871827661, 0.054975871827661, 0.054975871827661, 0.111690794839005, 0.111690794839005, 0.111690794839005};
-    // Quadrature points on the UFC reference element: (0.816847572980459, 0.091576213509771), (0.091576213509771, 0.816847572980459), (0.091576213509771, 0.091576213509771), (0.10810301816807, 0.445948490915965), (0.445948490915965, 0.10810301816807), (0.445948490915965, 0.445948490915965)
     
-    // Values of basis functions at quadrature points.
-    static const double FE0[6][3] = \
-    {{0.09157621350977, 0.816847572980459, 0.091576213509771},
-    {0.0915762135097701, 0.0915762135097711, 0.816847572980459},
-    {0.816847572980458, 0.091576213509771, 0.091576213509771},
-    {0.445948490915965, 0.10810301816807, 0.445948490915965},
-    {0.445948490915965, 0.445948490915965, 0.10810301816807},
-    {0.10810301816807, 0.445948490915965, 0.445948490915965}};
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    static const double FEA6_f0[6][3] = \
-    {{0.09157621350977, 0.816847572980459, 0.091576213509771},
-    {0.0915762135097701, 0.091576213509771, 0.816847572980459},
-    {0.816847572980458, 0.091576213509771, 0.091576213509771},
-    {0.445948490915965, 0.10810301816807, 0.445948490915965},
-    {0.445948490915965, 0.445948490915965, 0.10810301816807},
-    {0.10810301816807, 0.445948490915965, 0.445948490915965}};
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
-    // Reset values in the element tensor.
-    for (unsigned int r = 0; r < 3; r++)
-    {
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stiffnessmatrix_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new stiffnessmatrix_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stiffnessmatrix_finite_element_1();
+  }
+
+};
+
+
+class stiffnessmatrix_dofmap_0: public ufc::dofmap
+{
+public:
+
+  stiffnessmatrix_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~stiffnessmatrix_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new stiffnessmatrix_dofmap_0();
+  }
+
+};
+
+
+class stiffnessmatrix_dofmap_1: public ufc::dofmap
+{
+public:
+
+  stiffnessmatrix_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~stiffnessmatrix_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stiffnessmatrix_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new stiffnessmatrix_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new stiffnessmatrix_dofmap_1();
+  }
+
+};
+
+
+class stiffnessmatrix_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  stiffnessmatrix_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~stiffnessmatrix_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+  }
+
+};
+
+
+class stiffnessmatrix_cell_integral_1_otherwise: public ufc::cell_integral
+{
+public:
+
+  stiffnessmatrix_cell_integral_1_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~stiffnessmatrix_cell_integral_1_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute cell volume
+    
+    
+    // Compute circumradius of triangle in 2D
+    
+    
+    // Array of quadrature weights.
+    static const double W6[6] = {0.054975871827661, 0.054975871827661, 0.054975871827661, 0.111690794839005, 0.111690794839005, 0.111690794839005};
+    // Quadrature points on the UFC reference element: (0.816847572980459, 0.091576213509771), (0.091576213509771, 0.816847572980459), (0.091576213509771, 0.091576213509771), (0.10810301816807, 0.445948490915965), (0.445948490915965, 0.10810301816807), (0.445948490915965, 0.445948490915965)
+    
+    // Values of basis functions at quadrature points.
+    static const double FE0[6][3] = \
+    {{0.09157621350977, 0.816847572980459, 0.091576213509771},
+    {0.0915762135097701, 0.0915762135097711, 0.816847572980459},
+    {0.816847572980458, 0.091576213509771, 0.091576213509771},
+    {0.445948490915965, 0.10810301816807, 0.445948490915965},
+    {0.445948490915965, 0.445948490915965, 0.10810301816807},
+    {0.10810301816807, 0.445948490915965, 0.445948490915965}};
+    
+    static const double FEA6_f0[6][3] = \
+    {{0.09157621350977, 0.816847572980459, 0.091576213509771},
+    {0.0915762135097701, 0.091576213509771, 0.816847572980459},
+    {0.816847572980458, 0.091576213509771, 0.091576213509771},
+    {0.445948490915965, 0.10810301816807, 0.445948490915965},
+    {0.445948490915965, 0.445948490915965, 0.10810301816807},
+    {0.10810301816807, 0.445948490915965, 0.445948490915965}};
+    
+    // Reset values in the element tensor.
+    for (unsigned int r = 0; r < 3; r++)
+    {
       A[r] = 0.0;
     } // end loop over 'r'
     
@@ -1324,8 +2961,8 @@ public:
     {
       
       // Compute physical coordinate of quadrature point, operations: 10.
-      X6[0] = FEA6_f0[ip][0]*vertex_coordinates[0] +                  FEA6_f0[ip][1]*vertex_coordinates[2] + FEA6_f0[ip][2]*vertex_coordinates[4];
-      X6[1] = FEA6_f0[ip][0]*vertex_coordinates[1] +                  FEA6_f0[ip][1]*vertex_coordinates[3] + FEA6_f0[ip][2]*vertex_coordinates[5];
+      X6[0] = FEA6_f0[ip][0]*coordinate_dofs[0] +                  FEA6_f0[ip][1]*coordinate_dofs[2] + FEA6_f0[ip][2]*coordinate_dofs[4];
+      X6[1] = FEA6_f0[ip][0]*coordinate_dofs[1] +                  FEA6_f0[ip][1]*coordinate_dofs[3] + FEA6_f0[ip][2]*coordinate_dofs[5];
       
       // Number of operations to compute ip constants: 3
       double I[1];
@@ -1344,66 +2981,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stiffnessmatrix_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   stiffnessmatrix_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stiffnessmatrix_form_0()
+  ~stiffnessmatrix_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "a56ff760d1b2d36392fecaa89295d221b18d120e912a2917bc2e8573297855e6979ab2d877460aedf3ffaa3771279e271eabec6012cb797b652aa5da059b83ed";
+    return "327a2ebce665f0df9dcdfb386a5f82bed655eb49e6748bfe664bd49258af417c023ae55cb0509c094373c6b9856a9f7f919048c8bddfe52512e528caaee3cde4";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stiffnessmatrix_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stiffnessmatrix_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1422,8 +3051,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1442,192 +3070,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stiffnessmatrix_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stiffnessmatrix_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   stiffnessmatrix_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stiffnessmatrix_form_1()
+  ~stiffnessmatrix_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "37eb71856ac7048661aa777fa4b0bb263913bb5dc10b13e6232e397fd45d057ef5f911be0737e454f82115ddb5022ae425887868839bf6a9195ec446bb42074e";
+    return "f89c9bb1ccf7f51226fde8e8e23f298de051011e56e8c9da08020590207b9517563f8224cd401a6ddc81a53753a795490280a2be4a2b059bee4223cb79061a5f";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stiffnessmatrix_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stiffnessmatrix_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1641,8 +3297,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1656,126 +3311,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stiffnessmatrix_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1789,14 +3480,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace StiffnessMatrix
 {
@@ -1805,43 +3502,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1852,63 +3526,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stiffnessmatrix_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1916,7 +3597,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stiffnessmatrix_form_0());
+    _ufc_form = std::make_shared<const stiffnessmatrix_form_0>();
   }
 
   // Destructor
@@ -1946,77 +3627,123 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stiffnessmatrix_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stiffnessmatrix_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stiffnessmatrix_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stiffnessmatrix_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
-class Form_L: public dolfin::Form
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 0)
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stiffnessmatrix_form_1());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_L: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 0)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stiffnessmatrix_form_1());
+    _ufc_form = std::make_shared<const stiffnessmatrix_form_1>();
   }
 
   // Destructor
@@ -2045,16 +3772,76 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_L()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/block-matrix/cpp/compile.log b/demo/undocumented/block-matrix/cpp/compile.log
index 1a7c4d2..a57c55f 100644
--- a/demo/undocumented/block-matrix/cpp/compile.log
+++ b/demo/undocumented/block-matrix/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form StiffnessMatrix
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -30,25 +31,33 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal SpatialCoordinate.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.0938361 seconds.
+Compiler stage 1 finished in 0.0863791 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -58,7 +67,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.00113 seconds
+  36 entries computed in 0.00106 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -66,6 +75,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
@@ -74,12 +84,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {6: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 0): array([[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
-           0.10810302],
-         [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
-           0.44594849],
-         [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-           0.44594849]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+  {6: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
@@ -151,7 +156,12 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ],
           [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849]]])}}}}}
+            0.44594849]]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 0): array([[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
+           0.10810302],
+         [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
+           0.44594849],
+         [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
+           0.44594849]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
@@ -302,66 +312,55 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0559759 seconds.
+Compiler stage 2 finished in 0.0537622 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.000488997 seconds.
+Compiler stage 3 finished in 0.000820875 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -370,18 +369,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.050185 seconds.
+Compiler stage 4 finished in 0.157527 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000550985 seconds.
+Compiler stage 4.1 finished in 0.000762939 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./StiffnessMatrix.h.
-Compiler stage 5 finished in 0.000743151 seconds.
+Compiler stage 5 finished in 0.000785828 seconds.
 
-FFC finished in 0.202263 seconds.
+FFC finished in 0.300668 seconds.
+Output written to ./StiffnessMatrix.h.
diff --git a/demo/undocumented/block-matrix/cpp/main.cpp b/demo/undocumented/block-matrix/cpp/main.cpp
index b216fb5..59f1bf0 100644
--- a/demo/undocumented/block-matrix/cpp/main.cpp
+++ b/demo/undocumented/block-matrix/cpp/main.cpp
@@ -31,10 +31,10 @@ using namespace dolfin;
 int main()
 {
   // Create mesh
-  UnitSquareMesh mesh(32, 32);
+  auto mesh = std::make_shared<UnitSquareMesh>(32, 32);
 
   // Create a simple stiffness matrix and vector
-  StiffnessMatrix::FunctionSpace V(mesh);
+  auto V = std::make_shared<StiffnessMatrix::FunctionSpace>(mesh);
 
   StiffnessMatrix::BilinearForm a(V, V);
   std::shared_ptr<GenericMatrix> A(new Matrix);
diff --git a/demo/undocumented/buckling-tao/python/demo_buckling-tao.py b/demo/undocumented/buckling-tao/python/demo_buckling-tao.py
index 1d57ec0..7708e59 100644
--- a/demo/undocumented/buckling-tao/python/demo_buckling-tao.py
+++ b/demo/undocumented/buckling-tao/python/demo_buckling-tao.py
@@ -28,12 +28,13 @@ upwards (and not downwards) in order to minimise the potential energy."""
 from __future__ import print_function
 from dolfin import *
 
-if not has_tao():
-    print("DOLFIN must be compiled at least with PETSc 3.5 to run this demo.")
+if not has_petsc():
+    print("DOLFIN must be compiled at least with PETSc 3.6 to run this demo.")
     exit(0)
 
-# Read mesh
+# Read mesh and refine once
 mesh = Mesh("../buckling.xml.gz")
+mesh = refine(mesh)
 
 # Create function space
 V = VectorFunctionSpace(mesh, "Lagrange", 1)
@@ -59,8 +60,8 @@ f = Constant((-0.08, 0.0))
 
 # The displacement u must be such that the current configuration
 # doesn't escape the box [xmin, xmax] x [ymin, ymax]
-constraint_u = Expression(("xmax-x[0]", "ymax-x[1]"), xmax=10.0, ymax=2.0)
-constraint_l = Expression(("xmin-x[0]", "ymin-x[1]"), xmin=0.0, ymin=-0.2)
+constraint_u = Expression(("xmax-x[0]", "ymax-x[1]"), xmax=10.0, ymax=2.0, degree=1)
+constraint_l = Expression(("xmin-x[0]", "ymin-x[1]"), xmin=0.0, ymin=-0.2, degree=1)
 u_min = interpolate(constraint_l, V)
 u_max = interpolate(constraint_u, V)
 
@@ -125,9 +126,17 @@ parameters.parse()
 # Solve the problem
 solver.solve(BucklingProblem(), u.vector(), u_min.vector(), u_max.vector())
 
-# Save solution in XDMF format
-out = File("u.xdmf")
-out << u
+# Save solution in XDMF format if available
+out = XDMFFile(mesh.mpi_comm(), "u.xdmf")
+if has_hdf5():
+    out.write(u)
+elif MPI.size(mesh.mpi_comm()) == 1:
+    encoding = XDMFFile.Encoding_ASCII
+    out.write(u, encoding)
+else:
+    # Save solution in vtk format
+    out = File("u.pvd")
+    out << u
 
 # Plot the current configuration
 plot(u, mode="displacement", wireframe=True, title="Displacement field")
diff --git a/demo/undocumented/collision-detection/python/demo_collision-detection.py b/demo/undocumented/collision-detection/python/demo_collision-detection.py
index be73acc..567ce1d 100644
--- a/demo/undocumented/collision-detection/python/demo_collision-detection.py
+++ b/demo/undocumented/collision-detection/python/demo_collision-detection.py
@@ -17,6 +17,11 @@
 
 from dolfin import *
 
+# Sequence of plots eats a lot of memory with matplotlib (maybe leak)
+if parameters['plotting_backend'] == 'matplotlib':
+    warning("Collision detection demo does not work with matplotlib. Bye!")
+    exit(0)
+
 # Some parameters
 L = 10.0
 h = 0.1
diff --git a/demo/undocumented/coloring/cpp/CMakeLists.txt b/demo/undocumented/coloring/cpp/CMakeLists.txt
index 6108388..18fbd14 100644
--- a/demo/undocumented/coloring/cpp/CMakeLists.txt
+++ b/demo/undocumented/coloring/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/coloring/cpp/main.cpp b/demo/undocumented/coloring/cpp/main.cpp
index c80e3e1..e0dd19b 100644
--- a/demo/undocumented/coloring/cpp/main.cpp
+++ b/demo/undocumented/coloring/cpp/main.cpp
@@ -31,36 +31,36 @@ using namespace dolfin;
 int main()
 {
   // Create mesh
-  UnitCubeMesh mesh(24, 24, 24);
+  auto mesh = std::make_shared<UnitCubeMesh>(24, 24, 24);
 
   // Compute vertex-based coloring
-  mesh.color("vertex");
+  mesh->color("vertex");
   const MeshFunction<std::size_t> colors_vertex
     = MeshColoring::cell_colors(mesh, "vertex");
   plot(colors_vertex, "Vertex-based cell coloring");
 
   // Compute edge-based coloring
-  mesh.color("edge");
+  mesh->color("edge");
   const CellFunction<std::size_t> colors_edge
     = MeshColoring::cell_colors(mesh, "edge");
   plot(colors_edge, "Edge-based cell coloring");
 
   // Compute facet-based coloring
-  mesh.color("facet");
+  mesh->color("facet");
   const CellFunction<std::size_t> colors_facet
     = MeshColoring::cell_colors(mesh, "facet");
   plot(colors_facet, "Facet-based cell coloring");
 
   // Compute facet-based coloring with distance 2
   std::vector<std::size_t> coloring_type
-    = {{mesh.topology().dim(),
-        mesh.topology().dim() - 1,
-        mesh.topology().dim(),
-        mesh.topology().dim() - 1,
-        mesh.topology().dim()}};
-  mesh.color(coloring_type);
+    = {{mesh->topology().dim(),
+        mesh->topology().dim() - 1,
+        mesh->topology().dim(),
+        mesh->topology().dim() - 1,
+        mesh->topology().dim()}};
+  mesh->color(coloring_type);
   const CellFunction<std::size_t> colors_vertex_2
-      = MeshColoring::cell_colors(mesh, coloring_type);
+    = MeshColoring::cell_colors(mesh, coloring_type);
   plot(colors_vertex_2, "Facet-based cell coloring with distance 2");
 
   interactive();
diff --git a/demo/undocumented/compiled-extension-module/python/Probe/Probe.cpp b/demo/undocumented/compiled-extension-module/python/Probe/Probe.cpp
index 8f58e0e..6f7edcd 100644
--- a/demo/undocumented/compiled-extension-module/python/Probe/Probe.cpp
+++ b/demo/undocumented/compiled-extension-module/python/Probe/Probe.cpp
@@ -57,7 +57,7 @@ Probe::Probe(const Array<double>& x, const FunctionSpace& V)
     // Create cell that contains point
     dolfin_cell.reset(new Cell(mesh, id));
     dolfin_cell->get_cell_data(ufc_cell);
-    dolfin_cell->get_vertex_coordinates(_vertex_coordinates);
+    dolfin_cell->get_coordinate_dofs(_coordinate_dofs);
 
     // Create work vector for basis
     std::vector<double> basis(value_size_loc);
@@ -72,7 +72,7 @@ Probe::Probe(const Array<double>& x, const FunctionSpace& V)
     for (std::size_t i = 0; i < _element->space_dimension(); ++i)
     {
       _element->evaluate_basis(i, basis.data(), x.data(),
-                               _vertex_coordinates.data(),
+                               _coordinate_dofs.data(),
                                dolfin_cell->orientation());
       for (std::size_t j = 0; j < value_size_loc; ++j)
         _basis_matrix[j][i] = basis[j];
@@ -96,7 +96,7 @@ void Probe::eval(const Function& u)
 {
   // Restrict function to cell
   u.restrict(&_coefficients[0], *_element, *dolfin_cell,
-             _vertex_coordinates.data(), ufc_cell);
+             _coordinate_dofs.data(), ufc_cell);
 
   // Make room for one more evaluation
   for (std::size_t j = 0; j < value_size_loc; j++)
diff --git a/demo/undocumented/compiled-extension-module/python/Probe/Probe.h b/demo/undocumented/compiled-extension-module/python/Probe/Probe.h
index 284a2c9..1552c29 100644
--- a/demo/undocumented/compiled-extension-module/python/Probe/Probe.h
+++ b/demo/undocumented/compiled-extension-module/python/Probe/Probe.h
@@ -72,7 +72,7 @@ namespace dolfin
 
     ufc::cell ufc_cell;
 
-    std::vector<double> _vertex_coordinates;
+    std::vector<double> _coordinate_dofs;
 
     std::size_t value_size_loc;
 
diff --git a/demo/undocumented/compiled-extension-module/python/demo_compiled-extension-module.py b/demo/undocumented/compiled-extension-module/python/demo_compiled-extension-module.py
index 176cd9b..389d43c 100644
--- a/demo/undocumented/compiled-extension-module/python/demo_compiled-extension-module.py
+++ b/demo/undocumented/compiled-extension-module/python/demo_compiled-extension-module.py
@@ -1,6 +1,6 @@
 "This demo program demonstrates how to include additional C++ code in DOLFIN."
 
-# Copyright (C) 2013 Kent-Andre Mardal, Mikael Mortensen, Johan Hake 
+# Copyright (C) 2013 Kent-Andre Mardal, Mikael Mortensen, Johan Hake
 #
 # This file is part of DOLFIN.
 #
@@ -25,7 +25,7 @@ import numpy
 import os
 
 header_file = open("Probe/Probe.h")
-code = "\n".join(header_file.readlines()) 
+code = "\n".join(header_file.readlines())
 compiled_module = compile_extension_module(code=code, source_directory="Probe", \
                                            sources=["Probe.cpp"], \
                                            include_dirs=[".", os.path.abspath("Probe")])
@@ -37,7 +37,7 @@ x = numpy.array((0.5, 0.5, 0.5))
 probe = compiled_module.Probe(x, V)
 
 # Just create some random data to be used for probing
-u0 = interpolate(Expression('x[0]'), V)
+u0 = interpolate(Expression('x[0]', degree=1), V)
 probe.eval(u0)
 print("number of probes: ", probe.value_size())
 print("value at first probe: ", probe.get_probe(0))
diff --git a/demo/undocumented/conditional/cpp/CMakeLists.txt b/demo/undocumented/conditional/cpp/CMakeLists.txt
index e4d30cf..70cdda9 100644
--- a/demo/undocumented/conditional/cpp/CMakeLists.txt
+++ b/demo/undocumented/conditional/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/conditional/cpp/Conditional.h b/demo/undocumented/conditional/cpp/Conditional.h
index 58745cc..80c5d0e 100644
--- a/demo/undocumented/conditional/cpp/Conditional.h
+++ b/demo/undocumented/conditional/cpp/Conditional.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __CONDITIONAL_H
 #define __CONDITIONAL_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class conditional_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   conditional_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~conditional_finite_element_0()
+  ~conditional_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,33 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -159,33 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -195,141 +192,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -339,48 +220,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -459,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -481,81 +358,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -570,9 +427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -582,11 +439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -596,11 +453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -609,9 +466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -632,81 +489,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -721,9 +558,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -733,11 +570,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -747,11 +584,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -760,9 +597,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -783,81 +620,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -872,9 +689,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -884,11 +701,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -898,11 +715,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -911,9 +728,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -930,236 +747,684 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 4:
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new conditional_finite_element_0();
+  }
+
+};
+
+
+class conditional_finite_element_1: public ufc::finite_element
+{
+public:
+
+  conditional_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~conditional_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1174,9 +1439,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1186,11 +1451,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1200,11 +1465,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1213,9 +1478,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1232,85 +1497,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1325,9 +1570,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1337,11 +1582,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1351,11 +1596,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1364,9 +1609,271 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1376,273 +1883,2551 @@ public:
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new conditional_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new conditional_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new conditional_finite_element_1();
+  }
+
+};
+
+
+class conditional_finite_element_2: public ufc::finite_element
+{
+public:
+
+  conditional_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~conditional_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new conditional_finite_element_2();
+  }
+
+};
+
+
+class conditional_dofmap_0: public ufc::dofmap
+{
+public:
+
+  conditional_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~conditional_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
         break;
       }
     }
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    return 0;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new conditional_dofmap_0();
+  }
+
+};
+
+
+class conditional_dofmap_1: public ufc::dofmap
+{
+public:
+
+  conditional_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  ~conditional_dofmap_1() override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    // Do nothing
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  const char * signature() const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return true;
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
-    case 3:
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 2;
         break;
       }
-    case 4:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 5:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
     }
     
-    return 0.0;
+    return 0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new conditional_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new conditional_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new conditional_finite_element_0();
+    return new conditional_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class conditional_dofmap_0: public ufc::dofmap
+class conditional_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  conditional_dofmap_0() : ufc::dofmap()
+  conditional_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~conditional_dofmap_0()
+  ~conditional_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1661,44 +4446,33 @@ public:
         return false;
         break;
       }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
+    }
+    
+    return false;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1722,25 +4496,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1769,9 +4541,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -1845,76 +4616,49 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new conditional_dofmap_0();
+    return new conditional_dofmap_2();
   }
 
 };
 
-/// 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 conditional_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   conditional_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~conditional_cell_integral_0_otherwise()
+  ~conditional_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
@@ -1923,7 +4667,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1941,81 +4685,74 @@ public:
     
     // Compute element tensor
     A[0] = 0.5*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.500000000000002*G0_1_1;
-    A[1] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_1_0;
+    A[1] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_1_0;
     A[2] = 0.166666666666666*G0_0_1 + 0.166666666666666*G0_1_1;
     A[3] = 0.0;
     A[4] = -0.666666666666668*G0_0_1 - 0.666666666666668*G0_1_1;
-    A[5] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_1_0;
-    A[6] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_0_1;
+    A[5] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_1_0;
+    A[6] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_0_1;
     A[7] = 0.5*G0_0_0;
-    A[8] = -0.166666666666667*G0_0_1;
+    A[8] = -0.166666666666666*G0_0_1;
     A[9] = 0.666666666666664*G0_0_1;
     A[10] = 0.0;
     A[11] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_0_1;
     A[12] = 0.166666666666666*G0_1_0 + 0.166666666666666*G0_1_1;
-    A[13] = -0.166666666666667*G0_1_0;
+    A[13] = -0.166666666666666*G0_1_0;
     A[14] = 0.5*G0_1_1;
     A[15] = 0.666666666666667*G0_1_0;
-    A[16] = -0.666666666666667*G0_1_0 - 0.666666666666665*G0_1_1;
+    A[16] = -0.666666666666667*G0_1_0 - 0.666666666666666*G0_1_1;
     A[17] = 0.0;
     A[18] = 0.0;
     A[19] = 0.666666666666664*G0_1_0;
     A[20] = 0.666666666666667*G0_0_1;
-    A[21] = 1.33333333333333*G0_0_0 + 0.666666666666655*G0_0_1 + 0.666666666666655*G0_1_0 + 1.33333333333331*G0_1_1;
-    A[22] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666655*G0_1_0;
+    A[21] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333332*G0_1_1;
+    A[22] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666656*G0_1_0;
     A[23] = -0.666666666666665*G0_0_1 - 0.666666666666666*G0_1_0 - 1.33333333333332*G0_1_1;
     A[24] = -0.666666666666668*G0_1_0 - 0.666666666666668*G0_1_1;
     A[25] = 0.0;
     A[26] = -0.666666666666667*G0_0_1 - 0.666666666666665*G0_1_1;
-    A[27] = -1.33333333333333*G0_0_0 - 0.666666666666655*G0_0_1 - 0.666666666666659*G0_1_0;
+    A[27] = -1.33333333333333*G0_0_0 - 0.666666666666656*G0_0_1 - 0.666666666666659*G0_1_0;
     A[28] = 1.33333333333333*G0_0_0 + 0.666666666666659*G0_0_1 + 0.666666666666659*G0_1_0 + 1.33333333333333*G0_1_1;
-    A[29] = 0.666666666666665*G0_0_1 + 0.666666666666666*G0_1_0;
-    A[30] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_0_1;
+    A[29] = 0.666666666666665*G0_0_1 + 0.666666666666667*G0_1_0;
+    A[30] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_0_1;
     A[31] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_1_0;
     A[32] = 0.0;
     A[33] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_0 - 1.33333333333332*G0_1_1;
-    A[34] = 0.666666666666666*G0_0_1 + 0.666666666666665*G0_1_0;
+    A[34] = 0.666666666666667*G0_0_1 + 0.666666666666665*G0_1_0;
     A[35] = 1.33333333333334*G0_0_0 + 0.666666666666668*G0_0_1 + 0.666666666666668*G0_1_0 + 1.33333333333333*G0_1_1;
   }
 
 };
 
-/// 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 conditional_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   conditional_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~conditional_cell_integral_1_otherwise()
+  ~conditional_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2064,8 +4801,8 @@ public:
     {
       
       // Compute physical coordinate of quadrature point, operations: 10.
-      X3[0] = FEA3_f0[ip][0]*vertex_coordinates[0] +                  FEA3_f0[ip][1]*vertex_coordinates[2] + FEA3_f0[ip][2]*vertex_coordinates[4];
-      X3[1] = FEA3_f0[ip][0]*vertex_coordinates[1] +                  FEA3_f0[ip][1]*vertex_coordinates[3] + FEA3_f0[ip][2]*vertex_coordinates[5];
+      X3[0] = FEA3_f0[ip][0]*coordinate_dofs[0] +                  FEA3_f0[ip][1]*coordinate_dofs[2] + FEA3_f0[ip][2]*coordinate_dofs[4];
+      X3[1] = FEA3_f0[ip][0]*coordinate_dofs[1] +                  FEA3_f0[ip][1]*coordinate_dofs[3] + FEA3_f0[ip][2]*coordinate_dofs[5];
       double C[7];
       // Compute conditional, operations: 1.
       C[0] = ((X3[0] >= 0.55)) ? -1.0 : 0.0;
@@ -2099,77 +4836,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class conditional_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   conditional_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~conditional_form_0()
+  ~conditional_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "93a9e6de15168c1b53e577fc0d6aa7449365b3f2425fde638446780769d86eaf2a5581d66ce609ea332fabce82f078b2997155a424dc86ab13186acf61b35fc8";
+    return "8cee0bf13890a9231bf66c3c44c36a24bac7d1666db42f48cc265cabd45c1c80f86678c05d9edd62a234dc2f88873b9ff104eeef8f81de298326c00ddc51cf92";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new conditional_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new conditional_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new conditional_finite_element_0();
+        return new conditional_finite_element_2();
         break;
       }
     case 1:
       {
-        return new conditional_finite_element_0();
+        return new conditional_finite_element_2();
         break;
       }
     }
@@ -2177,19 +4906,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new conditional_dofmap_0();
+        return new conditional_dofmap_2();
         break;
       }
     case 1:
       {
-        return new conditional_dofmap_0();
+        return new conditional_dofmap_2();
         break;
       }
     }
@@ -2197,198 +4925,226 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new conditional_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class conditional_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   conditional_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~conditional_form_1()
+  ~conditional_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "55f28c1b66565936926c23826bd5421117be1e1db30d4ed400671a59c4755ad1d794d4b74eb9629d61cafb6b5c8a06847430b79cb3e0b3354cb0cdae750c0157";
+    return "26a27e837564877e70a98fc6fd51cad2f513dd643e6441412dbc590f4fda54e1b71609e632df6e1174e7fb084559c4015da4bbffc027f83df8a2aa39b3cdc10f";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new conditional_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new conditional_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new conditional_finite_element_0();
+        return new conditional_finite_element_2();
         break;
       }
     }
@@ -2396,14 +5152,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new conditional_dofmap_0();
+        return new conditional_dofmap_2();
         break;
       }
     }
@@ -2411,126 +5166,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new conditional_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -2544,14 +5335,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Conditional
 {
@@ -2560,43 +5357,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<conditional_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<conditional_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<conditional_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<conditional_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2607,63 +5381,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<conditional_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<conditional_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<conditional_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<conditional_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new conditional_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -2671,7 +5452,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new conditional_form_0());
+    _ufc_form = std::make_shared<const conditional_form_0>();
   }
 
   // Destructor
@@ -2701,77 +5482,123 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<conditional_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<conditional_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new conditional_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new conditional_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<conditional_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<conditional_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
-class Form_L: public dolfin::Form
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 0)
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new conditional_form_1());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_L: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 0)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new conditional_form_1());
+    _ufc_form = std::make_shared<const conditional_form_1>();
   }
 
   // Destructor
@@ -2800,16 +5627,76 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_L()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/conditional/cpp/compile.log b/demo/undocumented/conditional/cpp/compile.log
index d6e38ff..a023696 100644
--- a/demo/undocumented/conditional/cpp/compile.log
+++ b/demo/undocumented/conditional/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Conditional
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -30,25 +31,36 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal SpatialCoordinate.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0721469 seconds.
+Compiler stage 1 finished in 0.126747 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -58,7 +70,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000681 seconds
+  144 entries computed in 0.00067 seconds
   Shape of reference tensor: (6, 6, 2, 2)
   Primary multi index:   rank = 2 dims = [6, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -66,14 +78,16 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -121,7 +135,7 @@ Compiler stage 2: Computing intermediate representation
           [ 0.16666667,  0.16666667,  0.66666667]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {None: {(0, 0): array([[ 0.22222222, -0.11111111, -0.11111111],
+          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Lagrange', triangle, 2): {None: {None: {(0, 0): array([[ 0.22222222, -0.11111111, -0.11111111],
          [-0.11111111, -0.11111111,  0.22222222],
          [-0.11111111,  0.22222222, -0.11111111],
          [ 0.11111111,  0.44444444,  0.44444444],
@@ -216,90 +230,55 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0340312 seconds.
+Compiler stage 2 finished in 0.040158 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.000492096 seconds.
+Compiler stage 3 finished in 0.000566006 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -308,18 +287,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.0721951 seconds.
+Compiler stage 4 finished in 0.143291 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000424862 seconds.
+Compiler stage 4.1 finished in 0.000662088 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Conditional.h.
-Compiler stage 5 finished in 0.000580072 seconds.
+Compiler stage 5 finished in 0.000540972 seconds.
 
-FFC finished in 0.180167 seconds.
+FFC finished in 0.312303 seconds.
+Output written to ./Conditional.h.
diff --git a/demo/undocumented/conditional/cpp/main.cpp b/demo/undocumented/conditional/cpp/main.cpp
index efd3715..16eebe5 100644
--- a/demo/undocumented/conditional/cpp/main.cpp
+++ b/demo/undocumented/conditional/cpp/main.cpp
@@ -48,12 +48,12 @@ class DirichletBoundary : public SubDomain
 int main()
 {
   // Create mesh and function space
-  UnitSquareMesh mesh(64, 64);
-  Conditional::FunctionSpace V(mesh);
+  auto mesh = std::make_shared<UnitSquareMesh>(64, 64);
+  auto V = std::make_shared<Conditional::FunctionSpace>(mesh);
 
   // Define boundary condition
-  Constant u0(0.0);
-  DirichletBoundary boundary;
+  auto u0 = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
   DirichletBC bc(V, u0, boundary);
 
   // Define variational problem
diff --git a/demo/undocumented/contact-vi-snes/cpp/CMakeLists.txt b/demo/undocumented/contact-vi-snes/cpp/CMakeLists.txt
index 568d010..ad6a621 100644
--- a/demo/undocumented/contact-vi-snes/cpp/CMakeLists.txt
+++ b/demo/undocumented/contact-vi-snes/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/contact-vi-snes/cpp/HyperElasticity.h b/demo/undocumented/contact-vi-snes/cpp/HyperElasticity.h
index 213ff2f..02fc7fd 100644
--- a/demo/undocumented/contact-vi-snes/cpp/HyperElasticity.h
+++ b/demo/undocumented/contact-vi-snes/cpp/HyperElasticity.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,388 +13,107 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       False
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __HYPERELASTICITY_H
 #define __HYPERELASTICITY_H
-
 #include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class hyperelasticity_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   hyperelasticity_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_finite_element_0()
+  ~hyperelasticity_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new hyperelasticity_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class hyperelasticity_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  hyperelasticity_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~hyperelasticity_finite_element_1()
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -403,8 +122,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -502,20 +221,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -524,26 +241,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -563,7 +278,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -575,7 +290,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -584,8 +299,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1037,28 +752,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1094,7 +807,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1102,22 +815,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1128,24 +839,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1155,38 +866,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1194,98 +903,104 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new hyperelasticity_finite_element_1();
+    return new hyperelasticity_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class hyperelasticity_finite_element_2: public ufc::finite_element
+class hyperelasticity_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  hyperelasticity_finite_element_2() : ufc::finite_element()
+  hyperelasticity_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_finite_element_2()
+  ~hyperelasticity_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1299,16 +1014,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1317,8 +1046,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1501,20 +1230,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1523,7 +1250,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1531,21 +1258,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1565,7 +1290,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1577,7 +1302,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1586,8 +1311,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2432,28 +2157,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2489,7 +2212,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2497,22 +2220,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2523,48 +2244,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -2574,50 +2295,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2629,41 +2348,40 @@ public:
     vertex_values[5] = dof_values[5];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_finite_element_1();
+        return new hyperelasticity_finite_element_0();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_finite_element_1();
+        return new hyperelasticity_finite_element_0();
         break;
       }
     }
@@ -2671,243 +2389,326 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new hyperelasticity_finite_element_2();
+    return new hyperelasticity_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class hyperelasticity_dofmap_0: public ufc::dofmap
+class hyperelasticity_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  hyperelasticity_dofmap_0() : ufc::dofmap()
+  hyperelasticity_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_dofmap_0()
+  ~hyperelasticity_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Real', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 1;
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  const char * family() const final override
   {
-    dofs[0] = 0;
+    return "Real";
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    if (d > 2)
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
     {
-    throw std::runtime_error("d is larger than dimension (2)");
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
     }
     
-    switch (d)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
     {
     case 0:
       {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     }
     
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::finite_element * create() const final override
   {
-    return new hyperelasticity_dofmap_0();
+    return new hyperelasticity_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class hyperelasticity_dofmap_1: public ufc::dofmap
+class hyperelasticity_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  hyperelasticity_dofmap_1() : ufc::dofmap()
+  hyperelasticity_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_dofmap_1()
+  ~hyperelasticity_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2931,39 +2732,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2987,19 +2777,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3025,9 +2813,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3078,65 +2865,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new hyperelasticity_dofmap_1();
+    return new hyperelasticity_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class hyperelasticity_dofmap_2: public ufc::dofmap
+class hyperelasticity_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  hyperelasticity_dofmap_2() : ufc::dofmap()
+  hyperelasticity_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_dofmap_2()
+  ~hyperelasticity_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3160,39 +2927,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3216,25 +2972,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3266,9 +3020,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3322,43 +3075,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_dofmap_1();
+        return new hyperelasticity_dofmap_0();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_dofmap_1();
+        return new hyperelasticity_dofmap_0();
         break;
       }
     }
@@ -3366,63 +3100,227 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new hyperelasticity_dofmap_2();
+    return new hyperelasticity_dofmap_1();
   }
 
 };
 
-/// 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 hyperelasticity_cell_integral_0_otherwise: public ufc::cell_integral
+class hyperelasticity_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  hyperelasticity_cell_integral_0_otherwise() : ufc::cell_integral()
+  hyperelasticity_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_cell_integral_0_otherwise()
+  ~hyperelasticity_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * signature() const final override
   {
-    static const std::vector<bool> enabled({true, true, true, true});
-    return enabled;
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute cell volume
-    
+    switch (d)
+    {
+    case 0:
+      {
+        return false;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 0;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 0;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 1;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = 0;
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new hyperelasticity_dofmap_2();
+  }
+
+};
+
+
+class hyperelasticity_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  hyperelasticity_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~hyperelasticity_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true, true, true, true});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute cell volume
     
-    // Compute circumradius of triangle in 2D
+    
+    // Compute circumradius of triangle in 2D
     
     
     // Array of quadrature weights.
@@ -3430,41 +3328,41 @@ public:
     // Quadrature points on the UFC reference element: (0.166666666666667, 0.166666666666667), (0.166666666666667, 0.666666666666667), (0.666666666666667, 0.166666666666667)
     
     // Values of basis functions at quadrature points.
-    static const double FE0_C0[3][6] = \
+    static const double FE0[3][1] = \
+    {{1.0},
+    {1.0},
+    {1.0}};
+    
+    static const double FE1_C0[3][6] = \
     {{0.666666666666667, 0.166666666666667, 0.166666666666667, 0.0, 0.0, 0.0},
     {0.166666666666667, 0.166666666666667, 0.666666666666667, 0.0, 0.0, 0.0},
     {0.166666666666667, 0.666666666666667, 0.166666666666667, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C0_D01[3][6] = \
+    static const double FE1_C0_D01[3][6] = \
     {{-1.0, 0.0, 1.0, 0.0, 0.0, 0.0},
     {-1.0, 0.0, 1.0, 0.0, 0.0, 0.0},
     {-1.0, 0.0, 1.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C0_D10[3][6] = \
+    static const double FE1_C0_D10[3][6] = \
     {{-0.999999999999999, 0.999999999999999, 0.0, 0.0, 0.0, 0.0},
     {-0.999999999999999, 0.999999999999999, 0.0, 0.0, 0.0, 0.0},
     {-0.999999999999999, 0.999999999999999, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C1[3][6] = \
+    static const double FE1_C1[3][6] = \
     {{0.0, 0.0, 0.0, 0.666666666666667, 0.166666666666667, 0.166666666666667},
     {0.0, 0.0, 0.0, 0.166666666666667, 0.166666666666667, 0.666666666666667},
     {0.0, 0.0, 0.0, 0.166666666666667, 0.666666666666667, 0.166666666666667}};
     
-    static const double FE0_C1_D01[3][6] = \
+    static const double FE1_C1_D01[3][6] = \
     {{0.0, 0.0, 0.0, -1.0, 0.0, 1.0},
     {0.0, 0.0, 0.0, -1.0, 0.0, 1.0},
     {0.0, 0.0, 0.0, -1.0, 0.0, 1.0}};
     
-    static const double FE0_C1_D10[3][6] = \
+    static const double FE1_C1_D10[3][6] = \
     {{0.0, 0.0, 0.0, -0.999999999999999, 0.999999999999999, 0.0},
     {0.0, 0.0, 0.0, -0.999999999999999, 0.999999999999999, 0.0},
     {0.0, 0.0, 0.0, -0.999999999999999, 0.999999999999999, 0.0}};
     
-    static const double FE1[3][1] = \
-    {{1.0},
-    {1.0},
-    {1.0}};
-    
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 6; r++)
     {
@@ -3492,68 +3390,61 @@ public:
       // Total number of operations to compute function values = 4
       for (unsigned int r = 0; r < 1; r++)
       {
-        F0 += FE1[ip][0]*w[2][0];
-        F5 += FE1[ip][0]*w[3][0];
+        F0 += FE0[ip][0]*w[2][0];
+        F5 += FE0[ip][0]*w[3][0];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 72
       for (unsigned int r = 0; r < 6; r++)
       {
-        F1 += FE0_C1_D10[ip][r]*w[0][r];
-        F2 += FE0_C1_D01[ip][r]*w[0][r];
-        F3 += FE0_C0_D10[ip][r]*w[0][r];
-        F4 += FE0_C0_D01[ip][r]*w[0][r];
-        F6 += FE0_C0[ip][r]*w[1][r];
-        F7 += FE0_C1[ip][r]*w[1][r];
+        F1 += FE1_C1_D10[ip][r]*w[0][r];
+        F2 += FE1_C1_D01[ip][r]*w[0][r];
+        F3 += FE1_C0_D10[ip][r]*w[0][r];
+        F4 += FE1_C0_D01[ip][r]*w[0][r];
+        F6 += FE1_C0[ip][r]*w[1][r];
+        F7 += FE1_C1[ip][r]*w[1][r];
       } // end loop over 'r'
       
       // Number of operations for primary indices: 1050
       for (unsigned int j = 0; j < 6; j++)
       {
         // Number of operations to compute entry: 175
-        A[j] += ((((((((((K[0]*FE0_C1_D10[ip][j] + K[2]*FE0_C1_D01[ip][j]))*((K[1]*F3 + K[3]*F4)) + ((K[1]*FE0_C0_D10[ip][j] + K[3]*FE0_C0_D01[ip][j]))*((K[0]*F1 + K[2]*F2))))*(-1.0) + (((K[0]*FE0_C0_D10[ip][j] + K[2]*FE0_C0_D01[ip][j]))*(((K[1]*F1 + K[3]*F2) + 1.0)) + ((K[1]*FE0_C1_D10[ip][j] + K[3]*FE0_C1_D01[ip][j]))*(((K[0]*F3 + K[2]*F4) + 1.0))))/(((((K[0]*F3 + K[2]*F4) + 1.0))*(((K[1]*F1 + K[3]*F2) + 1.0)) + (-1.0)*(((K[1]*F3 + K[3]*F4))*((K[0]*F1 + K[2]*F2))))))*2.0)*(std::log(((( [...]
+        A[j] += ((((((((((K[0]*FE1_C1_D10[ip][j] + K[2]*FE1_C1_D01[ip][j]))*((K[1]*F3 + K[3]*F4)) + ((K[1]*FE1_C0_D10[ip][j] + K[3]*FE1_C0_D01[ip][j]))*((K[0]*F1 + K[2]*F2))))*(-1.0) + (((K[0]*FE1_C0_D10[ip][j] + K[2]*FE1_C0_D01[ip][j]))*(((K[1]*F1 + K[3]*F2) + 1.0)) + ((K[1]*FE1_C1_D10[ip][j] + K[3]*FE1_C1_D01[ip][j]))*(((K[0]*F3 + K[2]*F4) + 1.0))))/(((((K[0]*F3 + K[2]*F4) + 1.0))*(((K[1]*F1 + K[3]*F2) + 1.0)) + (-1.0)*(((K[1]*F3 + K[3]*F4))*((K[0]*F1 + K[2]*F2))))))*2.0)*(std::log(((( [...]
       } // 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 hyperelasticity_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   hyperelasticity_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_cell_integral_1_otherwise()
+  ~hyperelasticity_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3574,21 +3465,21 @@ public:
     // Quadrature points on the UFC reference element: (0.333333333333333, 0.333333333333333)
     
     // Values of basis functions at quadrature points.
-    static const double FE0_C0_D01[1][6] = \
+    static const double FE0[1][1] = \
+    {{1.0}};
+    
+    static const double FE1_C0_D01[1][6] = \
     {{-1.0, 0.0, 1.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C0_D10[1][6] = \
+    static const double FE1_C0_D10[1][6] = \
     {{-0.999999999999999, 0.999999999999999, 0.0, 0.0, 0.0, 0.0}};
     
-    static const double FE0_C1_D01[1][6] = \
+    static const double FE1_C1_D01[1][6] = \
     {{0.0, 0.0, 0.0, -1.0, 0.0, 1.0}};
     
-    static const double FE0_C1_D10[1][6] = \
+    static const double FE1_C1_D10[1][6] = \
     {{0.0, 0.0, 0.0, -0.999999999999999, 0.999999999999999, 0.0}};
     
-    static const double FE1[1][1] = \
-    {{1.0}};
-    
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 36; r++)
     {
@@ -3614,17 +3505,17 @@ public:
       // Total number of operations to compute function values = 4
       for (unsigned int r = 0; r < 1; r++)
       {
-        F0 += FE1[0][0]*w[1][0];
-        F5 += FE1[0][0]*w[2][0];
+        F0 += FE0[0][0]*w[1][0];
+        F5 += FE0[0][0]*w[2][0];
       } // end loop over 'r'
       
       // Total number of operations to compute function values = 48
       for (unsigned int r = 0; r < 6; r++)
       {
-        F1 += FE0_C1_D10[0][r]*w[0][r];
-        F2 += FE0_C1_D01[0][r]*w[0][r];
-        F3 += FE0_C0_D10[0][r]*w[0][r];
-        F4 += FE0_C0_D01[0][r]*w[0][r];
+        F1 += FE1_C1_D10[0][r]*w[0][r];
+        F2 += FE1_C1_D01[0][r]*w[0][r];
+        F3 += FE1_C0_D10[0][r]*w[0][r];
+        F4 += FE1_C0_D01[0][r]*w[0][r];
       } // end loop over 'r'
       
       // Number of operations for primary indices: 16164
@@ -3633,7 +3524,7 @@ public:
         for (unsigned int k = 0; k < 6; k++)
         {
           // Number of operations to compute entry: 449
-          A[j*6 + k] += (((((((((((((K[0]*FE0_C1_D10[0][k] + K[2]*FE0_C1_D01[0][k]))*((K[1]*F3 + K[3]*F4)) + ((K[1]*FE0_C0_D10[0][k] + K[3]*FE0_C0_D01[0][k]))*((K[0]*F1 + K[2]*F2))))*(-1.0) + (((K[0]*FE0_C0_D10[0][k] + K[2]*FE0_C0_D01[0][k]))*(((K[1]*F1 + K[3]*F2) + 1.0)) + ((K[1]*FE0_C1_D10[0][k] + K[3]*FE0_C1_D01[0][k]))*(((K[0]*F3 + K[2]*F4) + 1.0)))))*((((((K[0]*FE0_C1_D10[0][j] + K[2]*FE0_C1_D01[0][j]))*((K[1]*F3 + K[3]*F4)) + ((K[1]*FE0_C0_D10[0][j] + K[3]*FE0_C0_D01[0][j]))*((K[0] [...]
+          A[j*6 + k] += (((((((((((((K[0]*FE1_C1_D10[0][k] + K[2]*FE1_C1_D01[0][k]))*((K[1]*F3 + K[3]*F4)) + ((K[1]*FE1_C0_D10[0][k] + K[3]*FE1_C0_D01[0][k]))*((K[0]*F1 + K[2]*F2))))*(-1.0) + (((K[0]*FE1_C0_D10[0][k] + K[2]*FE1_C0_D01[0][k]))*(((K[1]*F1 + K[3]*F2) + 1.0)) + ((K[1]*FE1_C1_D10[0][k] + K[3]*FE1_C1_D01[0][k]))*(((K[0]*F3 + K[2]*F4) + 1.0)))))*((((((K[0]*FE1_C1_D10[0][j] + K[2]*FE1_C1_D01[0][j]))*((K[1]*F3 + K[3]*F4)) + ((K[1]*FE1_C0_D10[0][j] + K[3]*FE1_C0_D01[0][j]))*((K[0] [...]
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -3641,92 +3532,84 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class hyperelasticity_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   hyperelasticity_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_form_0()
+  ~hyperelasticity_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "736d4e8a4a457839821abe99aa9267a9935fd7eb783aa98c4a6b6b55e393a3650c09daf3724985881fb6f4681926b2d5a177a269815227cba65977f2991fa723";
+    return "192e48d745b685fae7715e811e3b5dd44533406a034de857b2de110616e6c3afc4f296ce443f930109edb459a8edbedc0114c596e120190a8b11df83169006cd";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 4;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new hyperelasticity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new hyperelasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 3:
       {
-        return new hyperelasticity_finite_element_0();
+        return new hyperelasticity_finite_element_2();
         break;
       }
     case 4:
       {
-        return new hyperelasticity_finite_element_0();
+        return new hyperelasticity_finite_element_2();
         break;
       }
     }
@@ -3734,34 +3617,33 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 3:
       {
-        return new hyperelasticity_dofmap_0();
+        return new hyperelasticity_dofmap_2();
         break;
       }
     case 4:
       {
-        return new hyperelasticity_dofmap_0();
+        return new hyperelasticity_dofmap_2();
         break;
       }
     }
@@ -3769,218 +3651,246 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new hyperelasticity_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class hyperelasticity_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   hyperelasticity_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~hyperelasticity_form_1()
+  ~hyperelasticity_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "70384a028fa6cdc437d837857cc2c13852694952d596a9b286ffcdb64cedfa5382cd6a283f62a1f3e772263dab5ad2a5ba58ce1d297621bce0068aba4d68058f";
+    return "0031ae9281bf2229d3faaf5fe618b38aeafad9ffe40cc440550d2d1133b3c7edfdd6dbcdc6c9ae960b6107075cad7526a7b5d39369d96c007bf6b670e89eaa70";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 3;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 2, 3});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new hyperelasticity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new hyperelasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_finite_element_2();
+        return new hyperelasticity_finite_element_1();
         break;
       }
     case 3:
       {
-        return new hyperelasticity_finite_element_0();
+        return new hyperelasticity_finite_element_2();
         break;
       }
     case 4:
       {
-        return new hyperelasticity_finite_element_0();
+        return new hyperelasticity_finite_element_2();
         break;
       }
     }
@@ -3988,34 +3898,33 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 2:
       {
-        return new hyperelasticity_dofmap_2();
+        return new hyperelasticity_dofmap_1();
         break;
       }
     case 3:
       {
-        return new hyperelasticity_dofmap_0();
+        return new hyperelasticity_dofmap_2();
         break;
       }
     case 4:
       {
-        return new hyperelasticity_dofmap_0();
+        return new hyperelasticity_dofmap_2();
         break;
       }
     }
@@ -4023,126 +3932,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new hyperelasticity_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -4156,14 +4101,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace HyperElasticity
 {
@@ -4172,43 +4123,20 @@ class CoefficientSpace_B: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_B(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_B(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_B(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_B(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4219,43 +4147,20 @@ class CoefficientSpace_lmbda: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4266,43 +4171,20 @@ class CoefficientSpace_mu: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4313,43 +4195,20 @@ class CoefficientSpace_u: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4360,45 +4219,42 @@ class Form_F_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_F_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_F_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_F_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_F_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_F_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -4416,81 +4272,134 @@ class Form_F: public dolfin::Form
 public:
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 4), u(*this, 0), B(*this, 1), mu(*this, 2), lmbda(*this, 3)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
+    _ufc_form = std::make_shared<const hyperelasticity_form_0>();
   }
 
   // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& B, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
+  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> B, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
     dolfin::Form(1, 4), u(*this, 0), B(*this, 1), mu(*this, 2), lmbda(*this, 3)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->u = u;
     this->B = B;
     this->mu = mu;
     this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
+    _ufc_form = std::make_shared<const hyperelasticity_form_0>();
   }
 
-  // Constructor
-  Form_F(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> B, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(1, 4), u(*this, 0), B(*this, 1), mu(*this, 2), lmbda(*this, 3)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_F()
+  {}
 
-    this->u = *u;
-    this->B = *B;
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "u")
+      return 0;
+    else if (name == "B")
+      return 1;
+    else if (name == "mu")
+      return 2;
+    else if (name == "lmbda")
+      return 3;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 4), u(*this, 0), B(*this, 1), mu(*this, 2), lmbda(*this, 3)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "u";
+    case 1:
+      return "B";
+    case 2:
+      return "mu";
+    case 3:
+      return "lmbda";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_F_FunctionSpace_1 CoefficientSpace_u;
+  typedef Form_F_FunctionSpace_2 CoefficientSpace_B;
+  typedef Form_F_FunctionSpace_3 CoefficientSpace_mu;
+  typedef Form_F_FunctionSpace_4 CoefficientSpace_lmbda;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+  dolfin::CoefficientAssigner B;
+  dolfin::CoefficientAssigner mu;
+  dolfin::CoefficientAssigner lmbda;
+};
+
+class MultiMeshForm_F: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& B, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
-    dolfin::Form(1, 4), u(*this, 0), B(*this, 1), mu(*this, 2), lmbda(*this, 3)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), u(*this, 0), B(*this, 1), mu(*this, 2), lmbda(*this, 3)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
 
-    this->u = u;
-    this->B = B;
-    this->mu = mu;
-    this->lmbda = lmbda;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
   }
 
   // Constructor
-  Form_F(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> B, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(1, 4), u(*this, 0), B(*this, 1), mu(*this, 2), lmbda(*this, 3)
+  MultiMeshForm_F(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> B, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
+    dolfin::MultiMeshForm(V0), u(*this, 0), B(*this, 1), mu(*this, 2), lmbda(*this, 3)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_F(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->u = *u;
-    this->B = *B;
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+    /// Assign coefficients
+    this->u = u;
+    this->B = B;
+    this->mu = mu;
+    this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_0());
   }
 
   // Destructor
-  ~Form_F()
+  ~MultiMeshForm_F()
   {}
 
   /// Return the number of the coefficient with this name
@@ -4534,59 +4443,37 @@ public:
 
   // Typedefs
   typedef Form_F_FunctionSpace_0 TestSpace;
+  typedef Form_F_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_F_FunctionSpace_1 CoefficientSpace_u;
   typedef Form_F_FunctionSpace_2 CoefficientSpace_B;
   typedef Form_F_FunctionSpace_3 CoefficientSpace_mu;
   typedef Form_F_FunctionSpace_4 CoefficientSpace_lmbda;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
-  dolfin::CoefficientAssigner B;
-  dolfin::CoefficientAssigner mu;
-  dolfin::CoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner B;
+  dolfin::MultiMeshCoefficientAssigner mu;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
 };
 
 class Form_J_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_J_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4597,45 +4484,62 @@ class Form_J_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<hyperelasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<hyperelasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_J_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_J_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_J_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new hyperelasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new hyperelasticity_dofmap_2()), *mesh, constrained_domain)))
+};
+
+class Form_J_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_J_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_J_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -4651,83 +4555,130 @@ class Form_J: public dolfin::Form
 public:
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
+    _ufc_form = std::make_shared<const hyperelasticity_form_1>();
   }
 
   // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
+  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
     dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->u = u;
     this->mu = mu;
     this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
+    _ufc_form = std::make_shared<const hyperelasticity_form_1>();
   }
 
-  // Constructor
-  Form_J(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_J()
+  {}
 
-    this->u = *u;
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "u")
+      return 0;
+    else if (name == "mu")
+      return 1;
+    else if (name == "lmbda")
+      return 2;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "u";
+    case 1:
+      return "mu";
+    case 2:
+      return "lmbda";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_J_FunctionSpace_0 TestSpace;
+  typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
+  typedef Form_J_FunctionSpace_3 CoefficientSpace_mu;
+  typedef Form_J_FunctionSpace_4 CoefficientSpace_lmbda;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+  dolfin::CoefficientAssigner mu;
+  dolfin::CoefficientAssigner lmbda;
+};
+
+class MultiMeshForm_J: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
-    dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->u = u;
-    this->mu = mu;
-    this->lmbda = lmbda;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
   }
 
   // Constructor
-  Form_J(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(2, 3), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
+  MultiMeshForm_J(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), mu(*this, 1), lmbda(*this, 2)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_J(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->u = *u;
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+    /// Assign coefficients
+    this->u = u;
+    this->mu = mu;
+    this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new hyperelasticity_form_1());
   }
 
   // Destructor
-  ~Form_J()
+  ~MultiMeshForm_J()
   {}
 
   /// Return the number of the coefficient with this name
@@ -4768,22 +4719,29 @@ public:
   // Typedefs
   typedef Form_J_FunctionSpace_0 TestSpace;
   typedef Form_J_FunctionSpace_1 TrialSpace;
+  typedef Form_J_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_J_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_J_FunctionSpace_2 CoefficientSpace_u;
   typedef Form_J_FunctionSpace_3 CoefficientSpace_mu;
   typedef Form_J_FunctionSpace_4 CoefficientSpace_lmbda;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
-  dolfin::CoefficientAssigner mu;
-  dolfin::CoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner mu;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
 };
 
 // Class typedefs
 typedef Form_J BilinearForm;
+typedef MultiMeshForm_J MultiMeshBilinearForm;
 typedef Form_J JacobianForm;
+typedef MultiMeshForm_J MultiMeshJacobianForm;
 typedef Form_F LinearForm;
+typedef MultiMeshForm_F MultiMeshLinearForm;
 typedef Form_F ResidualForm;
+typedef MultiMeshForm_F MultiMeshResidualForm;
 typedef Form_F::TestSpace FunctionSpace;
+typedef Form_F::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/contact-vi-snes/cpp/compile.log b/demo/undocumented/contact-vi-snes/cpp/compile.log
index b07ca08..c71e76b 100644
--- a/demo/undocumented/contact-vi-snes/cpp/compile.log
+++ b/demo/undocumented/contact-vi-snes/cpp/compile.log
@@ -1,6 +1,8 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
+Expr.geometric_dimension() is deprecated, please use find_geometric_dimension(expr) instead.
 Compiling form HyperElasticity
 
 Compiler stage 1: Analyzing form(s)
@@ -19,9 +21,9 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -36,11 +38,11 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.0409489 seconds.
+Compiler stage 1 finished in 0.048768 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -50,10 +52,15 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -63,7 +70,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -111,94 +118,94 @@ Compiler stage 2: Computing intermediate representation
           [ 0.16666667,  0.16666667,  0.66666667]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667]]])}}}}}
+          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE1_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
+           0.        ],
+         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
+           0.        ],
+         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
+           0.16666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
+           0.66666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
+           0.16666667]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
-           0.16666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
-           0.66666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
-           0.16666667]]), 'FE0_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]])}
+  
+  tables: {'FE1_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
            0.        ],
          [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
            0.        ],
          [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
-           0.        ]])}
-  
-  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
+           0.16666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
+           0.66666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
+           0.16666667]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
-           0.16666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
-           0.66666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
-           0.16666667]]), 'FE0_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
-           0.        ],
-         [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
-           0.        ]])}
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]])}
   
   name_map: {}
   
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE1': 'FE1', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C1_D10': 'FE1_C1_D10', 'FE0': 'FE0', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE0_C1_D01': array([[ 0.,  0.,  0., -1.,  0.,  1.],
-         [ 0.,  0.,  0., -1.,  0.,  1.],
-         [ 0.,  0.,  0., -1.,  0.,  1.]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[-1.,  0.,  1.,  0.,  0.,  0.],
-         [-1.,  0.,  1.,  0.,  0.,  0.],
-         [-1.,  0.,  1.,  0.,  0.,  0.]]), 'FE1': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
-           0.16666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
-           0.66666667],
-         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
-           0.16666667]]), 'FE0_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
+  {'FE1_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
            0.        ],
          [ 0.16666667,  0.16666667,  0.66666667,  0.        ,  0.        ,
            0.        ],
          [ 0.16666667,  0.66666667,  0.16666667,  0.        ,  0.        ,
-           0.        ]])}
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.66666667,  0.16666667,
+           0.16666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.16666667,
+           0.66666667],
+         [ 0.        ,  0.        ,  0.        ,  0.16666667,  0.66666667,
+           0.16666667]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_C1_D01': array([[ 0.,  0.,  0., -1.,  0.,  1.],
+         [ 0.,  0.,  0., -1.,  0.,  1.],
+         [ 0.,  0.,  0., -1.,  0.,  1.]]), 'FE1_C0_D01': array([[-1.,  0.,  1.,  0.,  0.,  0.],
+         [-1.,  0.,  1.,  0.,  0.,  0.],
+         [-1.,  0.,  1.,  0.,  0.,  0.]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C1_D01', (), False, False), 'FE0_C1_D10': ('FE0_C1_D10', (), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (), False, False), 'FE1': ('FE1', (), False, True), 'FE0_C1': ('FE0_C1', (), False, False), 'FE0_C0': ('FE0_C0', (), False, False)}
+  {'FE1_C0': ('FE1_C0', (), False, False), 'FE1_C1': ('FE1_C1', (), False, False), 'FE1_C1_D10': ('FE1_C1_D10', (), False, False), 'FE0': ('FE0', (), False, True), 'FE1_C1_D01': ('FE1_C1_D01', (), False, False), 'FE1_C0_D01': ('FE1_C0_D01', (), False, False), 'FE1_C0_D10': ('FE1_C0_D10', (), False, False)}
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -239,7 +246,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
+  {1: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
           [  0.00000000e+00]],
   
          [[  8.88178420e-16],
@@ -287,32 +294,32 @@ Compiler stage 2: Computing intermediate representation
           [ 0.33333333]],
   
          [[ 0.        ],
-          [ 0.33333333]]])}}}}}
+          [ 0.33333333]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ]])}
-  
-  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ]])}
+  {'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]])}
+  
+  tables: {'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]])}
   
   name_map: {}
   
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE1': 'FE1', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C1_D10': 'FE1_C1_D10', 'FE0': 'FE0', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE0_C1_D01': array([[ 0.,  0.,  0., -1.,  0.,  1.]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[-1.,  0.,  1.,  0.,  0.,  0.]]), 'FE1': array([[ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ]])}
+  {'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[ 1.]]), 'FE1_C1_D01': array([[ 0.,  0.,  0., -1.,  0.,  1.]]), 'FE1_C0_D01': array([[-1.,  0.,  1.,  0.,  0.,  0.]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C1_D01', (), False, False), 'FE0_C1_D10': ('FE0_C1_D10', (), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (), False, False), 'FE1': ('FE1', (), False, True), 'FE0_C1': ('FE0_C1', (), False, False), 'FE0_C0': ('FE0_C0', (), False, False)}
+  {'FE1_C0': ('FE1_C0', (), False, False), 'FE1_C1': ('FE1_C1', (), False, False), 'FE1_C1_D10': ('FE1_C1_D10', (), False, False), 'FE0': ('FE0', (), False, True), 'FE1_C1_D01': ('FE1_C1_D01', (), False, False), 'FE1_C0_D01': ('FE1_C0_D01', (), False, False), 'FE1_C0_D10': ('FE1_C0_D10', (), False, False)}
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -346,175 +353,62 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0727019 seconds.
+Compiler stage 2 finished in 0.091553 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Skipping optimizations, add -O to optimize
   
-Compiler stage 3 finished in 0.000152111 seconds.
+Compiler stage 3 finished in 0.000175953 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 3 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: C1
+  Removing unused variable: C0
   Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -528,18 +422,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.081789 seconds.
+Compiler stage 4 finished in 0.081141 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000693798 seconds.
+Compiler stage 4.1 finished in 0.000962973 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./HyperElasticity.h.
-Compiler stage 5 finished in 0.000642061 seconds.
+Compiler stage 5 finished in 0.000764132 seconds.
 
-FFC finished in 0.197217 seconds.
+FFC finished in 0.223773 seconds.
+Output written to ./HyperElasticity.h.
diff --git a/demo/undocumented/contact-vi-snes/cpp/main.cpp b/demo/undocumented/contact-vi-snes/cpp/main.cpp
index ed7bb30..4ab69af 100644
--- a/demo/undocumented/contact-vi-snes/cpp/main.cpp
+++ b/demo/undocumented/contact-vi-snes/cpp/main.cpp
@@ -70,37 +70,35 @@ int main()
 #ifdef HAS_PETSC
 
   // Read mesh and create function space
-  Mesh mesh("../circle_yplane.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../circle_yplane.xml.gz");
 
   // Create function space
-  HyperElasticity::FunctionSpace V(mesh);
+  auto V = std::make_shared<HyperElasticity::FunctionSpace>(mesh);
 
   // Create Dirichlet boundary conditions
-  SubSpace V0(V, 0);
-  Constant zero(0.0);
-  SymmetryLine s;
-  DirichletBC bc(V0, zero, s, "pointwise");
-  std::vector<const DirichletBC*> bcs {&bc};
+  auto zero = std::make_shared<Constant>(0.0);
+  auto s = std::make_shared<SymmetryLine>();
+  auto bc = std::make_shared<DirichletBC>(V->sub(0), zero, s, "pointwise");
 
   // Define source and boundary traction functions
-  Constant B(0.0, -0.05);
+  auto B = std::make_shared<Constant>(0.0, -0.05);
 
   // Define solution function
-  Function u(V);
+  auto u = std::make_shared<Function>(V);
 
   // Set material parameters
   const double E  = 10.0;
   const double nu = 0.3;
-  Constant mu(E/(2*(1 + nu)));
-  Constant lambda(E*nu/((1.0 + nu)*(1.0 - 2.0*nu)));
+  auto mu = std::make_shared<Constant>(E/(2*(1 + nu)));
+  auto lambda = std::make_shared<Constant>(E*nu/((1.0 + nu)*(1.0 - 2.0*nu)));
 
   // Create (linear) form defining (nonlinear) variational problem
-  HyperElasticity::ResidualForm F(V);
-  F.mu = mu; F.lmbda = lambda; F.B = B; F.u = u;
+  auto F = std::make_shared<HyperElasticity::ResidualForm>(V);
+  F->mu = mu; F->lmbda = lambda; F->B = B; F->u = u;
 
   // Create jacobian dF = F' (for use in nonlinear solver).
-  HyperElasticity::JacobianForm J(V, V);
-  J.mu = mu; J.lmbda = lambda; J.u = u;
+  auto J = std::make_shared<HyperElasticity::JacobianForm>(V, V);
+  J->mu = mu; J->lmbda = lambda; J->u = u;
 
   // Interpolate expression for upper bound
   UpperBound umax_exp;
@@ -113,7 +111,9 @@ int main()
   umin.interpolate(umin_exp);
 
   // Set up the non-linear problem
-  NonlinearVariationalProblem problem(F, u, bcs, J);
+  std::vector<std::shared_ptr<const DirichletBC>> bcs = {bc};
+  auto problem = std::make_shared<NonlinearVariationalProblem>(F, u, bcs, J);
+  problem->set_bounds(umin, umax);
 
   // Set up the non-linear solver
   NonlinearVariationalSolver solver(problem);
@@ -125,7 +125,7 @@ int main()
 
   // Solve the problems
   std::pair<std::size_t, bool> out;
-  out = solver.solve(umin,umax);
+  out = solver.solve();
 
   // Check for convergence. Convergence is one modifies the loading
   // and the mesh size
@@ -137,10 +137,10 @@ int main()
 
   // Save solution in VTK format
   File file("displacement.pvd");
-  file << u;
+  file << *u;
 
   // plot the current configuration
-  plot(u,"Displacement", "displacement");
+  plot(*u, "Displacement", "displacement");
 
   // Make plot windows interactive
   interactive();
diff --git a/demo/undocumented/contact-vi-snes/python/demo_contact-vi-snes.py b/demo/undocumented/contact-vi-snes/python/demo_contact-vi-snes.py
index 7645059..dcca29d 100644
--- a/demo/undocumented/contact-vi-snes/python/demo_contact-vi-snes.py
+++ b/demo/undocumented/contact-vi-snes/python/demo_contact-vi-snes.py
@@ -41,7 +41,7 @@ u  = Function(V)                 # Displacement from previous iteration
 B  = Constant((0.0, -0.05))      # Body force per unit volume
 
 # Kinematics
-I = Identity(u.geometric_dimension())  # Identity tensor
+I = Identity(len(u))  # Identity tensor
 F = I + grad(u)             # Deformation gradient
 C = F.T*F                   # Right Cauchy-Green tensor
 
@@ -74,23 +74,23 @@ bc = DirichletBC(V.sub(0), 0., symmetry_line, method="pointwise")
 
 # The displacement u must be such that the current configuration x+u
 # remains in the box [xmin,xmax] x [umin,ymax]
-constraint_u = Expression(("xmax - x[0]","ymax - x[1]"), \
-                          xmax=1.0+DOLFIN_EPS,  ymax=1.0)
-constraint_l = Expression(("xmin - x[0]","ymin - x[1]"), \
-                          xmin=-1.0-DOLFIN_EPS, ymin=-1.0)
+constraint_u = Expression(("xmax - x[0]","ymax - x[1]"),
+                          xmax=1.0+DOLFIN_EPS,  ymax=1.0, degree=1)
+constraint_l = Expression(("xmin - x[0]","ymin - x[1]"),
+                          xmin=-1.0-DOLFIN_EPS, ymin=-1.0, degree=1)
 umin = interpolate(constraint_l, V)
 umax = interpolate(constraint_u, V)
 
 # Define the solver parameters
 snes_solver_parameters = {"nonlinear_solver": "snes",
-                          "snes_solver"     : { "linear_solver"   : "lu",
-                                                "maximum_iterations": 20,
-                                                "report": True,
-                                                "error_on_nonconvergence": False,
-                                               }}
+                          "snes_solver": {"linear_solver": "lu",
+                                          "maximum_iterations": 20,
+                                          "report": True,
+                                          "error_on_nonconvergence": False}}
 
 # Set up the non-linear problem
 problem = NonlinearVariationalProblem(F, u, bc, J=J)
+problem.set_bounds(umin, umax)
 
 # Set up the non-linear solver
 solver  = NonlinearVariationalSolver(problem)
@@ -98,7 +98,7 @@ solver.parameters.update(snes_solver_parameters)
 info(solver.parameters, True)
 
 # Solve the problem
-(iter, converged) = solver.solve(umin, umax)
+(iter, converged) = solver.solve()
 
 # Check for convergence
 if not converged:
diff --git a/demo/undocumented/contact-vi-tao/cpp/CMakeLists.txt b/demo/undocumented/contact-vi-tao/cpp/CMakeLists.txt
index 63c619a..5803d67 100644
--- a/demo/undocumented/contact-vi-tao/cpp/CMakeLists.txt
+++ b/demo/undocumented/contact-vi-tao/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/contact-vi-tao/cpp/Elasticity.h b/demo/undocumented/contact-vi-tao/cpp/Elasticity.h
index 3e0235f..ed639da 100644
--- a/demo/undocumented/contact-vi-tao/cpp/Elasticity.h
+++ b/demo/undocumented/contact-vi-tao/cpp/Elasticity.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,388 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __ELASTICITY_H
 #define __ELASTICITY_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class elasticity_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   elasticity_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_finite_element_0()
+  ~elasticity_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new elasticity_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class elasticity_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  elasticity_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~elasticity_finite_element_1()
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -403,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -502,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -524,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -563,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -575,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -584,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1037,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1094,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1102,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1128,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1155,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1194,98 +902,104 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new elasticity_finite_element_1();
+    return new elasticity_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class elasticity_finite_element_2: public ufc::finite_element
+class elasticity_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  elasticity_finite_element_2() : ufc::finite_element()
+  elasticity_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_finite_element_2()
+  ~elasticity_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1299,16 +1013,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1317,8 +1045,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1501,20 +1229,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1523,7 +1249,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1531,21 +1257,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1565,7 +1289,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1577,7 +1301,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1586,8 +1310,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2432,28 +2156,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2489,7 +2211,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2497,22 +2219,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2523,48 +2243,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -2574,50 +2294,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2629,41 +2347,40 @@ public:
     vertex_values[5] = dof_values[5];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_finite_element_1();
+        return new elasticity_finite_element_0();
         break;
       }
     case 1:
       {
-        return new elasticity_finite_element_1();
+        return new elasticity_finite_element_0();
         break;
       }
     }
@@ -2671,243 +2388,326 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new elasticity_finite_element_2();
+    return new elasticity_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class elasticity_dofmap_0: public ufc::dofmap
+class elasticity_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  elasticity_dofmap_0() : ufc::dofmap()
+  elasticity_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_dofmap_0()
+  ~elasticity_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Real', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 1;
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  const char * family() const final override
   {
-    dofs[0] = 0;
+    return "Real";
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    if (d > 2)
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
     {
-    throw std::runtime_error("d is larger than dimension (2)");
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
     }
     
-    switch (d)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
     {
     case 0:
       {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     }
     
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::finite_element * create() const final override
   {
-    return new elasticity_dofmap_0();
+    return new elasticity_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class elasticity_dofmap_1: public ufc::dofmap
+class elasticity_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  elasticity_dofmap_1() : ufc::dofmap()
+  elasticity_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_dofmap_1()
+  ~elasticity_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2931,39 +2731,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2987,19 +2776,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3025,9 +2812,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3078,65 +2864,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new elasticity_dofmap_1();
+    return new elasticity_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class elasticity_dofmap_2: public ufc::dofmap
+class elasticity_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  elasticity_dofmap_2() : ufc::dofmap()
+  elasticity_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_dofmap_2()
+  ~elasticity_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3160,39 +2926,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3216,25 +2971,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3266,9 +3019,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3322,43 +3074,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_dofmap_1();
+        return new elasticity_dofmap_0();
         break;
       }
     case 1:
       {
-        return new elasticity_dofmap_1();
+        return new elasticity_dofmap_0();
         break;
       }
     }
@@ -3366,63 +3099,227 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new elasticity_dofmap_2();
+    return new elasticity_dofmap_1();
   }
 
 };
 
-/// 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 elasticity_cell_integral_0_otherwise: public ufc::cell_integral
+class elasticity_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  elasticity_cell_integral_0_otherwise() : ufc::cell_integral()
+  elasticity_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_cell_integral_0_otherwise()
+  ~elasticity_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * signature() const final override
   {
-    static const std::vector<bool> enabled({true, true});
-    return enabled;
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute cell volume
-    
+    switch (d)
+    {
+    case 0:
+      {
+        return false;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
     
-    // Compute circumradius of triangle in 2D
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 0;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 0;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 1;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = 0;
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new elasticity_dofmap_2();
+  }
+
+};
+
+
+class elasticity_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  elasticity_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~elasticity_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true, true});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute cell volume
+    
+    
+    // Compute circumradius of triangle in 2D
     
     
     // Array of quadrature weights.
@@ -3430,7 +3327,7 @@ public:
     // Quadrature points on the UFC reference element: (0.333333333333333, 0.333333333333333)
     
     // Values of basis functions at quadrature points.
-    static const double FE0_C0_D01[1][2] = \
+    static const double FE1_C0_D01[1][2] = \
     {{-1.0, 1.0}};
     
     // Array of non-zero columns
@@ -3477,37 +3374,37 @@ public:
         for (unsigned int k = 0; k < 2; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc1[j]*6 + nzc1[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[0];
+          A[nzc1[j]*6 + nzc1[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[0];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*6 + nzc2[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[1];
+          A[nzc1[j]*6 + nzc2[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[1];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*6 + nzc4[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[2];
+          A[nzc1[j]*6 + nzc4[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[2];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*6 + nzc5[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[3];
+          A[nzc1[j]*6 + nzc5[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[3];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*6 + nzc1[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[1];
+          A[nzc2[j]*6 + nzc1[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[1];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*6 + nzc2[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[4];
+          A[nzc2[j]*6 + nzc2[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[4];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*6 + nzc4[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[5];
+          A[nzc2[j]*6 + nzc4[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*6 + nzc5[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[6];
+          A[nzc2[j]*6 + nzc5[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[6];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*6 + nzc1[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[2];
+          A[nzc4[j]*6 + nzc1[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[2];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*6 + nzc2[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[5];
+          A[nzc4[j]*6 + nzc2[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*6 + nzc4[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[7];
+          A[nzc4[j]*6 + nzc4[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[7];
           // Number of operations to compute entry: 3
-          A[nzc4[j]*6 + nzc5[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[8];
+          A[nzc4[j]*6 + nzc5[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[8];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*6 + nzc1[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[3];
+          A[nzc5[j]*6 + nzc1[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[3];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*6 + nzc2[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[6];
+          A[nzc5[j]*6 + nzc2[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[6];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*6 + nzc4[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[8];
+          A[nzc5[j]*6 + nzc4[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[8];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*6 + nzc5[k]] += FE0_C0_D01[0][j]*FE0_C0_D01[0][k]*G[9];
+          A[nzc5[j]*6 + nzc5[k]] += FE1_C0_D01[0][j]*FE1_C0_D01[0][k]*G[9];
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -3515,38 +3412,31 @@ public:
 
 };
 
-/// 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 elasticity_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   elasticity_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~elasticity_cell_integral_1_otherwise()
+  ~elasticity_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    6
@@ -3555,7 +3445,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3584,87 +3474,79 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class elasticity_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   elasticity_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_form_0()
+  ~elasticity_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "146f714f856a50c46311a798f48e1697458bb67670a31f1e24aaaad4d6635cc0d81db9b0da15b366ba9196a2b2ce089beb0d088dba94532d04c3aa9640086e6f";
+    return "67c3a56c13ceb9d0682d8d22760cd760e80135a15989f0270d87d0ebe013ec0dd68cd0d44c3fcab4fba04570f055476eaa8f90ef00cc3612061381c836f99d03";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new elasticity_finite_element_1();
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new elasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_finite_element_2();
+        return new elasticity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new elasticity_finite_element_2();
+        return new elasticity_finite_element_1();
         break;
       }
     case 2:
       {
-        return new elasticity_finite_element_0();
+        return new elasticity_finite_element_2();
         break;
       }
     case 3:
       {
-        return new elasticity_finite_element_0();
+        return new elasticity_finite_element_2();
         break;
       }
     }
@@ -3672,29 +3554,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_dofmap_2();
+        return new elasticity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new elasticity_dofmap_2();
+        return new elasticity_dofmap_1();
         break;
       }
     case 2:
       {
-        return new elasticity_dofmap_0();
+        return new elasticity_dofmap_2();
         break;
       }
     case 3:
       {
-        return new elasticity_dofmap_0();
+        return new elasticity_dofmap_2();
         break;
       }
     }
@@ -3702,203 +3583,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new elasticity_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class elasticity_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   elasticity_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_form_1()
+  ~elasticity_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "814c3ac27e70f5078c2aaba16f7b4468689c35281b1ed2acfcf138b4d438e625500d4c3e49865fa1deacecfd2c93a165aeab6b9929b858d7e406fb9d9862399e";
+    return "ce4f296f3d4e07a279fa02777710bbddaeaefb2f477125bffea462dee56bec39b4b7fb74d7916fb3af16d9ef0a97342d393ffb7587016099f59ddb8854e6c229";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new elasticity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new elasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_finite_element_2();
+        return new elasticity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new elasticity_finite_element_2();
+        return new elasticity_finite_element_1();
         break;
       }
     }
@@ -3906,19 +3815,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_dofmap_2();
+        return new elasticity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new elasticity_dofmap_2();
+        return new elasticity_dofmap_1();
         break;
       }
     }
@@ -3926,126 +3834,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new elasticity_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -4059,14 +4003,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Elasticity
 {
@@ -4075,43 +4025,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4122,43 +4049,20 @@ class CoefficientSpace_lmbda: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4169,43 +4073,20 @@ class CoefficientSpace_mu: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4216,43 +4097,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4263,45 +4121,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -4315,79 +4190,122 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
+    _ufc_form = std::make_shared<const elasticity_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
     dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->mu = mu;
     this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
+    _ufc_form = std::make_shared<const elasticity_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_a()
+  {}
 
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "mu")
+      return 0;
+    else if (name == "lmbda")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "mu";
+    case 1:
+      return "lmbda";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_mu;
+  typedef Form_a_FunctionSpace_3 CoefficientSpace_lmbda;
+
+  // Coefficients
+  dolfin::CoefficientAssigner mu;
+  dolfin::CoefficientAssigner lmbda;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
-    dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), mu(*this, 0), lmbda(*this, 1)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->mu = mu;
-    this->lmbda = lmbda;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
+    dolfin::MultiMeshForm(V1, V0), mu(*this, 0), lmbda(*this, 1)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->mu = mu;
+    this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -4424,57 +4342,56 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_mu;
   typedef Form_a_FunctionSpace_3 CoefficientSpace_lmbda;
 
   // Coefficients
-  dolfin::CoefficientAssigner mu;
-  dolfin::CoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner mu;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
 };
 
 class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -4486,69 +4403,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
+    _ufc_form = std::make_shared<const elasticity_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
+    _ufc_form = std::make_shared<const elasticity_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -4580,18 +4538,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/contact-vi-tao/cpp/compile.log b/demo/undocumented/contact-vi-tao/cpp/compile.log
index be5f374..f3cec1f 100644
--- a/demo/undocumented/contact-vi-tao/cpp/compile.log
+++ b/demo/undocumented/contact-vi-tao/cpp/compile.log
@@ -1,6 +1,8 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
+Expr.geometric_dimension() is deprecated, please use find_geometric_dimension(expr) instead.
 Compiling form Elasticity
 
 Compiler stage 1: Analyzing form(s)
@@ -19,9 +21,9 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for terminal Identity.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -42,11 +44,11 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0524678 seconds.
+Compiler stage 1 finished in 0.0760391 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -56,10 +58,15 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -70,7 +77,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
+  {1: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00],
           [  0.00000000e+00]],
   
          [[  8.88178420e-16],
@@ -118,30 +125,30 @@ Compiler stage 2: Computing intermediate representation
           [ 0.33333333]],
   
          [[ 0.        ],
-          [ 0.33333333]]])}}}}}
+          [ 0.33333333]]])}}}, FiniteElement('Real', triangle, 0): {None: {None: {(0, 0): array([[ 1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ]])}
-  
-  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
-           0.33333333]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
-           0.        ]])}
+  {'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]])}
+  
+  tables: {'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.33333333,  0.33333333,
+           0.33333333]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0': array([[ 1.]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.]])}
   
   name_map: {}
   
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE1': 'FE1', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C1_D10': 'FE1_C1_D10', 'FE0': 'FE0', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE0_C0_D01': array([[-1.,  1.]]), 'FE1': array([[ 1.]]), 'FE0_C0': array([[ 0.33333333,  0.33333333,  0.33333333]])}
+  {'FE1_C0': array([[ 0.33333333,  0.33333333,  0.33333333]]), 'FE0': array([[ 1.]]), 'FE1_C0_D01': array([[-1.,  1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2]), False, False), 'FE1': ('FE1', (), False, True), 'FE0_C1': ('FE0_C0', (3, [3, 4, 5]), False, False), 'FE0_C0': ('FE0_C0', (0, [0, 1, 2]), False, False)}
+  {'FE1_C0': ('FE1_C0', (0, [0, 1, 2]), False, False), 'FE1_C1': ('FE1_C0', (3, [3, 4, 5]), False, False), 'FE1_C1_D10': ('FE1_C0_D01', (5, [3, 4]), False, False), 'FE0': ('FE0', (), False, True), 'FE1_C1_D01': ('FE1_C0_D01', (4, [3, 5]), False, False), 'FE1_C0_D01': ('FE1_C0_D01', (1, [0, 2]), False, False), 'FE1_C0_D10': ('FE1_C0_D01', (2, [0, 1]), False, False)}
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -236,7 +243,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000874 seconds
+  36 entries computed in 0.000959 seconds
   Shape of reference tensor: (6, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -246,175 +253,62 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0395789 seconds.
+Compiler stage 2 finished in 0.0473549 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.00726104 seconds.
+Compiler stage 3 finished in 0.00879693 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 3 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: C1
+  Removing unused variable: C0
   Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -423,18 +317,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.0993102 seconds.
+Compiler stage 4 finished in 0.114696 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000674009 seconds.
+Compiler stage 4.1 finished in 0.000829935 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Elasticity.h.
-Compiler stage 5 finished in 0.000762939 seconds.
+Compiler stage 5 finished in 0.000618935 seconds.
 
-FFC finished in 0.200397 seconds.
+FFC finished in 0.248768 seconds.
+Output written to ./Elasticity.h.
diff --git a/demo/undocumented/contact-vi-tao/cpp/main.cpp b/demo/undocumented/contact-vi-tao/cpp/main.cpp
index 2ee51e0..9bcf624 100644
--- a/demo/undocumented/contact-vi-tao/cpp/main.cpp
+++ b/demo/undocumented/contact-vi-tao/cpp/main.cpp
@@ -60,22 +60,22 @@ public:
 
 int main()
 {
-#ifdef ENABLE_PETSC_TAO
+#ifdef HAS_PETSC
 
   // Read mesh
-  Mesh mesh("../circle_yplane.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../circle_yplane.xml.gz");
 
   // Create function space
-  Elasticity::FunctionSpace V(mesh);
+  auto V = std::make_shared<Elasticity::FunctionSpace>(mesh);
 
   // Create right-hand side
-  Constant f(0.0, -0.1);
+  auto f = std::make_shared<Constant>(0.0, -0.1);
 
   // Set elasticity parameters
   double E  = 10.0;
   double nu = 0.3;
-  Constant mu(E / (2*(1 + nu)));
-  Constant lambda(E*nu / ((1 + nu)*(1 - 2*nu)));
+  auto mu = std::make_shared<Constant>(E / (2*(1 + nu)));
+  auto lambda = std::make_shared<Constant>(E*nu / ((1 + nu)*(1 - 2*nu)));
 
   // Define variational problem
   Elasticity::BilinearForm a(V, V);
@@ -111,9 +111,9 @@ int main()
   TAOLinearBoundSolver TAOSolver("tron","stcg");
 
   // Set some parameters
-  TAOSolver.parameters["monitor_convergence"]=true;
-  TAOSolver.parameters["report"]=true;
-  TAOSolver.parameters("krylov_solver")["monitor_convergence"]=false;
+  TAOSolver.parameters["monitor_convergence"] = true;
+  TAOSolver.parameters["report"] = true;
+  TAOSolver.parameters("krylov_solver")["monitor_convergence"] = false;
 
   // Solve the problem
   TAOSolver.solve(A, x, b, xl, xu);
@@ -126,7 +126,7 @@ int main()
 
   #else
 
-  cout << "This demo requires DOLFIN to be configured with PETSc version 3.5 or later" << endl;
+  cout << "This demo requires DOLFIN to be configured with PETSc version 3.6 or later" << endl;
 
   #endif
 
diff --git a/demo/undocumented/contact-vi-tao/python/demo_contact-vi-tao.py b/demo/undocumented/contact-vi-tao/python/demo_contact-vi-tao.py
index e50b0e1..63b24a0 100644
--- a/demo/undocumented/contact-vi-tao/python/demo_contact-vi-tao.py
+++ b/demo/undocumented/contact-vi-tao/python/demo_contact-vi-tao.py
@@ -28,7 +28,7 @@ in a box of the same size."""
 from __future__ import print_function
 from dolfin import *
 
-if not has_tao():
+if not has_petsc():
     print("DOLFIN must be compiled with PETSc to run this demo.")
     exit(0)
 
@@ -45,7 +45,7 @@ u  = Function(V)                 # Displacement from previous iteration
 B  = Constant((0.0, -1.5))       # Body force per unit volume
 
 # Kinematics
-I = Identity(u.geometric_dimension())  # Identity tensor
+I = Identity(len(u))  # Identity tensor
 F = I + grad(u)             # Deformation gradient
 C = F.T*F                   # Right Cauchy-Green tensor
 
@@ -93,8 +93,8 @@ class ContactProblem(OptimisationProblem):
 
 # The displacement u must be such that the current configuration
 # doesn't escape the box [xmin, xmax] x [ymin, ymax]
-constraint_u = Expression(("xmax-x[0]", "ymax-x[1]"), xmax=1.0, ymax=1.0)
-constraint_l = Expression(("xmin-x[0]", "ymin-x[1]"), xmin=-1.0, ymin=-1.0)
+constraint_u = Expression(("xmax-x[0]", "ymax-x[1]"), xmax=1.0, ymax=1.0, degree=1)
+constraint_l = Expression(("xmin-x[0]", "ymin-x[1]"), xmin=-1.0, ymin=-1.0, degree=1)
 u_min = interpolate(constraint_l, V)
 u_max = interpolate(constraint_u, V)
 
@@ -125,9 +125,17 @@ parameters.parse()
 # Solve the problem
 solver.solve(ContactProblem(), u.vector(), u_min.vector(), u_max.vector())
 
-# Save solution in XDMF format
-out = File("u.xdmf")
-out << u
+# Save solution in XDMF format if available
+out = XDMFFile(mesh.mpi_comm(), "u.xdmf")
+if has_hdf5():
+    out.write(u)
+elif MPI.size(mesh.mpi_comm()) == 1:
+    encoding = XDMFFile.Encoding_ASCII
+    out.write(u, encoding)
+else:
+    # Save solution in vtk format
+    out = File("u.pvd")
+    out << u
 
 # Plot the current configuration
 plot(u, mode="displacement", wireframe=True, title="Displacement field")
diff --git a/demo/undocumented/coordinates/cpp/README b/demo/undocumented/coordinates/cpp/README
new file mode 100644
index 0000000..cca85b7
--- /dev/null
+++ b/demo/undocumented/coordinates/cpp/README
@@ -0,0 +1 @@
+There is no C++ version of this demo.
diff --git a/demo/undocumented/coordinates/python/demo_coordinates.py b/demo/undocumented/coordinates/python/demo_coordinates.py
new file mode 100644
index 0000000..cd2feae
--- /dev/null
+++ b/demo/undocumented/coordinates/python/demo_coordinates.py
@@ -0,0 +1,52 @@
+"""This demo program demonstrates how to manipulate (higher-order) mesh
+coordinates."""
+
+# Copyright (C) 2016 Jan Blechta
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+from dolfin import *
+
+# Create mesh
+comm = mpi_comm_world()
+mesh = UnitDiscMesh(comm, 20, 2, 2)
+plot(mesh, interactive=True)
+
+# Fetch coordinate function
+C = FunctionSpace(mesh, mesh.ufl_coordinate_element())
+c = Function(C)
+get_coordinates(c, mesh.geometry())
+
+# Deform coordinates harmonically subject to BC
+u, v = TrialFunction(C), TestFunction(C)
+a = inner(grad(u), grad(v))*dx
+L = dot(Constant((0, 0)), v)*dx
+bc1 = DirichletBC(C, (-1, -1), "x[0] < -0.5")
+bc2 = DirichletBC(C, c, "x[0] >= -0.5")
+displacement = Function(C)
+solve(a == L, displacement, [bc1, bc2])
+c_vec = c.vector()
+c_vec += displacement.vector()
+
+# Set coordinates
+set_coordinates(mesh.geometry(), c)
+plot(mesh, interactive=True)
+
+# We can create (cubic) mesh from function
+C3 = VectorFunctionSpace(mesh, "Lagrange", 4)
+c3 = interpolate(c, C3)
+mesh3 = create_mesh(c3)
+plot(mesh3, interactive=True)
diff --git a/demo/undocumented/curl-curl/cpp/CMakeLists.txt b/demo/undocumented/curl-curl/cpp/CMakeLists.txt
index a9e5f4c..c244224 100644
--- a/demo/undocumented/curl-curl/cpp/CMakeLists.txt
+++ b/demo/undocumented/curl-curl/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/curl-curl/cpp/CurrentDensity.h b/demo/undocumented/curl-curl/cpp/CurrentDensity.h
index d05f18a..d492451 100644
--- a/demo/undocumented/curl-curl/cpp/CurrentDensity.h
+++ b/demo/undocumented/curl-curl/cpp/CurrentDensity.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,102 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __CURRENTDENSITY_H
 #define __CURRENTDENSITY_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class currentdensity_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   currentdensity_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_finite_element_0()
+  ~currentdensity_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 4;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -117,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -139,9 +143,7 @@ public:
     
     
     // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
+    *values = 0.0;
     switch (i)
     {
     case 0:
@@ -165,29 +167,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.0, 0.0, 0.0, 0.0};
-      
-      static const double coefficients1[4] = \
-      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
     case 1:
@@ -211,29 +197,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
-      
-      static const double coefficients1[4] = \
-      {0.0, 0.0, 0.0, 0.0};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.182574185835056, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
     case 2:
@@ -257,29 +227,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {-0.288675134594813, 0.0, -0.210818510677892, 0.074535599249993};
-      
-      static const double coefficients1[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      static const double coefficients2[4] = \
-      {0.0, 0.0, 0.0, 0.0};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
     case 3:
@@ -303,172 +257,57 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594812, 0.0, 0.0, 0.223606797749979};
-      
-      static const double coefficients1[4] = \
       {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      static const double coefficients2[4] = \
-      {0.577350269189625, -0.182574185835056, -0.105409255338946, 0.149071198499986};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
-      } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
-      
-      static const double coefficients1[4] = \
-      {0.577350269189626, -0.182574185835055, 0.105409255338946, -0.149071198499986};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
-      } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.577350269189626, 0.0, -0.210818510677892, -0.149071198499986};
-      
-      static const double coefficients1[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
-      
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
     }
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
+    double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -480,7 +319,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -488,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -500,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -509,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -600,13 +439,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.0, 0.0, 0.0, 0.0};
-      
-      static const double coefficients1[4] = \
-      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -629,19 +462,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -735,18 +561,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -754,9 +570,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -782,13 +596,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
-      
-      static const double coefficients1[4] = \
-      {0.0, 0.0, 0.0, 0.0};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.182574185835056, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -811,19 +619,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -917,18 +718,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -936,9 +727,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -964,13 +753,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {-0.288675134594813, 0.0, -0.210818510677892, 0.074535599249993};
-      
-      static const double coefficients1[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      static const double coefficients2[4] = \
-      {0.0, 0.0, 0.0, 0.0};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -993,19 +776,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -1099,18 +875,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1118,9 +884,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -1146,14 +910,8 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594812, 0.0, 0.0, 0.223606797749979};
-      
-      static const double coefficients1[4] = \
       {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      static const double coefficients2[4] = \
-      {0.577350269189625, -0.182574185835056, -0.105409255338946, 0.149071198499986};
-      
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
       {{0.0, 0.0, 0.0, 0.0},
@@ -1175,19 +933,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -1281,18 +1032,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1300,533 +1041,134 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 4:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
-      
-      static const double coefficients1[4] = \
-      {0.577350269189626, -0.182574185835055, 0.105409255338946, -0.149071198499986};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
       {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.577350269189626, 0.0, -0.210818510677892, -0.149071198499986};
-      
-      static const double coefficients1[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[9];
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    
-    double result;
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-      return result;
-        break;
-      }
-    case 1:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-      return result;
+      return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
-      result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
-      return result;
+      return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-      return result;
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
-      return result;
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
-      result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]);
-      return result;
+      return vals[0];
         break;
       }
     }
@@ -1834,199 +1176,193 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    
-    double result;
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-    values[0] = result;
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-    values[1] = result;
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
-    result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
-    values[2] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-    values[3] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
-    result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
-    values[4] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
-    result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]);
-    values[5] = result;
+    values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
     // Evaluate function and change variables
-    vertex_values[0] = dof_values[3]*K[6] + dof_values[4]*K[3] + dof_values[5]*K[0];
-    vertex_values[3] = dof_values[1]*K[6] + dof_values[2]*K[3] + dof_values[5]*(K[0] + K[3] + K[6]);
-    vertex_values[6] = dof_values[0]*K[6] + dof_values[2]*(K[0]*(-1.0)) + dof_values[4]*(K[0] + K[3] + K[6]);
-    vertex_values[9] = dof_values[0]*(K[3]*(-1.0)) + dof_values[1]*(K[0]*(-1.0)) + dof_values[3]*(K[0] + K[3] + K[6]);
-    vertex_values[1] = dof_values[3]*K[7] + dof_values[4]*K[4] + dof_values[5]*K[1];
-    vertex_values[4] = dof_values[1]*K[7] + dof_values[2]*K[4] + dof_values[5]*(K[1] + K[4] + K[7]);
-    vertex_values[7] = dof_values[0]*K[7] + dof_values[2]*(K[1]*(-1.0)) + dof_values[4]*(K[1] + K[4] + K[7]);
-    vertex_values[10] = dof_values[0]*(K[4]*(-1.0)) + dof_values[1]*(K[1]*(-1.0)) + dof_values[3]*(K[1] + K[4] + K[7]);
-    vertex_values[2] = dof_values[3]*K[8] + dof_values[4]*K[5] + dof_values[5]*K[2];
-    vertex_values[5] = dof_values[1]*K[8] + dof_values[2]*K[5] + dof_values[5]*(K[2] + K[5] + K[8]);
-    vertex_values[8] = dof_values[0]*K[8] + dof_values[2]*(K[2]*(-1.0)) + dof_values[4]*(K[2] + K[5] + K[8]);
-    vertex_values[11] = dof_values[0]*(K[5]*(-1.0)) + dof_values[1]*(K[2]*(-1.0)) + dof_values[3]*(K[2] + K[5] + K[8]);
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new currentdensity_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class currentdensity_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   currentdensity_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_finite_element_1()
+  ~currentdensity_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 4;
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -2035,9 +1371,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -2057,7 +1393,9 @@ public:
     
     
     // Reset values
-    *values = 0.0;
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
     switch (i)
     {
     case 0:
@@ -2086,11 +1424,251 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 9:
       {
         
       // Array of basisvalues
@@ -2116,11 +1694,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 10:
       {
         
       // Array of basisvalues
@@ -2146,11 +1724,11 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 11:
       {
         
       // Array of basisvalues
@@ -2176,7 +1754,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2184,48 +1762,47 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
+    double dof_values[3] = {0.0, 0.0, 0.0};
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 4; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2237,7 +1814,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -2245,7 +1822,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2257,7 +1834,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -2266,9 +1843,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -2333,10 +1910,167 @@ public:
         for (unsigned int k = 0; k < n; k++)
           transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
-    }
-    switch (i)
-    {
-    case 0:
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
       {
         
       // Array of basisvalues
@@ -2357,7 +2091,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -2493,7 +2227,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 2:
       {
         
       // Array of basisvalues
@@ -2514,7 +2248,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -2650,7 +2384,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 3:
       {
         
       // Array of basisvalues
@@ -2671,7 +2405,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -2807,7 +2541,7 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 4:
       {
         
       // Array of basisvalues
@@ -2828,7 +2562,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -2959,344 +2693,169 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[3];
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
+    case 5:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new currentdensity_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class currentdensity_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  currentdensity_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~currentdensity_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 12;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return 3;
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 6:
       {
         
       // Array of basisvalues
@@ -3317,16 +2876,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 7:
       {
         
       // Array of basisvalues
@@ -3347,46 +3033,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 8:
       {
         
       // Array of basisvalues
@@ -3407,46 +3190,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
       } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 9:
       {
         
       // Array of basisvalues
@@ -3469,104 +3349,141 @@ public:
       static const double coefficients0[4] = \
       {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 10:
       {
         
       // Array of basisvalues
@@ -3587,235 +3504,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 10:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[3][1];
-    for (unsigned int row = 0; row < 3; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
         {
-          if (combinations[row][col] + 1 > 2)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
           {
-            combinations[row][col] += 1;
-            break;
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[3][3];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 11:
       {
         
       // Array of basisvalues
@@ -3836,7 +3661,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -3965,171 +3790,531 @@ public:
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new currentdensity_finite_element_0();
         break;
       }
     case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+        return new currentdensity_finite_element_0();
+        break;
+      }
+    case 2:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        return new currentdensity_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new currentdensity_finite_element_1();
+  }
+
+};
+
+
+class currentdensity_finite_element_2: public ufc::finite_element
+{
+public:
+
+  currentdensity_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~currentdensity_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Nedelec 1st kind H(curl)', tetrahedron, 1)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        return 3;
         break;
       }
-    case 2:
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Nedelec 1st kind H(curl)";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -4150,143 +4335,32 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
+      {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      static const double coefficients1[4] = \
+      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      static const double coefficients2[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+        values[2] += coefficients2[r]*basisvalues[r];
       } // end loop over 'r'
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      const double tmp_ref2 = values[2];
+      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
-    case 3:
+    case 1:
       {
         
       // Array of basisvalues
@@ -4307,143 +4381,32 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
+      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      static const double coefficients1[4] = \
+      {0.0, 0.0, 0.0, 0.0};
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      static const double coefficients2[4] = \
+      {0.288675134594813, 0.182574185835056, -0.105409255338946, -0.074535599249993};
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+        values[2] += coefficients2[r]*basisvalues[r];
       } // end loop over 'r'
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      const double tmp_ref2 = values[2];
+      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
-    case 4:
+    case 2:
       {
         
       // Array of basisvalues
@@ -4464,143 +4427,78 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      {-0.288675134594813, 0.0, -0.210818510677892, 0.074535599249993};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double coefficients1[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double coefficients2[4] = \
+      {0.0, 0.0, 0.0, 0.0};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+        values[2] += coefficients2[r]*basisvalues[r];
       } // end loop over 'r'
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      const double tmp_ref2 = values[2];
+      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
+        break;
+      }
+    case 3:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594812, 0.0, 0.0, 0.223606797749979};
+      
+      static const double coefficients1[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      static const double coefficients2[4] = \
+      {0.577350269189625, -0.182574185835056, -0.105409255338946, 0.149071198499986};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+        values[2] += coefficients2[r]*basisvalues[r];
       } // end loop over 'r'
+      
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      const double tmp_ref2 = values[2];
+      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
-    case 5:
+    case 4:
       {
         
       // Array of basisvalues
@@ -4621,143 +4519,233 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      static const double coefficients1[4] = \
+      {0.577350269189626, -0.182574185835055, 0.105409255338946, -0.149071198499986};
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double coefficients2[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+        values[2] += coefficients2[r]*basisvalues[r];
       } // end loop over 'r'
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      const double tmp_ref2 = values[2];
+      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.577350269189626, 0.0, -0.210818510677892, -0.149071198499986};
+      
+      static const double coefficients1[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
+      
+      static const double coefficients2[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+        values[2] += coefficients2[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      const double tmp_ref2 = values[2];
+      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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--)
         {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
+          if (combinations[row][col] + 1 > 2)
+            combinations[row][col] = 0;
+          else
           {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
+            combinations[row][col] += 1;
+            break;
           }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
-    case 6:
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -4778,7 +4766,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      {0.0, 0.0, 0.0, 0.0};
+      
+      static const double coefficients1[4] = \
+      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
+      
+      static const double coefficients2[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -4801,12 +4795,19 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -4900,8 +4901,18 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
+        
+        // Using covariant Piola transform to map values back to the physical element
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        const double tmp_ref2 = derivatives[2*num_derivatives + r];
+        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -4909,12 +4920,14 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 1:
       {
         
       // Array of basisvalues
@@ -4935,7 +4948,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
+      
+      static const double coefficients1[4] = \
+      {0.0, 0.0, 0.0, 0.0};
+      
+      static const double coefficients2[4] = \
+      {0.288675134594813, 0.182574185835056, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -4958,12 +4977,19 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -5057,8 +5083,18 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
+        
+        // Using covariant Piola transform to map values back to the physical element
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        const double tmp_ref2 = derivatives[2*num_derivatives + r];
+        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -5066,12 +5102,14 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 2:
       {
         
       // Array of basisvalues
@@ -5092,7 +5130,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {-0.288675134594813, 0.0, -0.210818510677892, 0.074535599249993};
+      
+      static const double coefficients1[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      static const double coefficients2[4] = \
+      {0.0, 0.0, 0.0, 0.0};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -5115,12 +5159,19 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -5214,8 +5265,18 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
+        
+        // Using covariant Piola transform to map values back to the physical element
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        const double tmp_ref2 = derivatives[2*num_derivatives + r];
+        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -5223,12 +5284,14 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 3:
       {
         
       // Array of basisvalues
@@ -5249,7 +5312,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594812, 0.0, 0.0, 0.223606797749979};
+      
+      static const double coefficients1[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      static const double coefficients2[4] = \
+      {0.577350269189625, -0.182574185835056, -0.105409255338946, 0.149071198499986};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -5272,12 +5341,19 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -5371,8 +5447,18 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
+        
+        // Using covariant Piola transform to map values back to the physical element
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        const double tmp_ref2 = derivatives[2*num_derivatives + r];
+        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -5380,12 +5466,14 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 4:
       {
         
       // Array of basisvalues
@@ -5406,6 +5494,12 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
+      
+      static const double coefficients1[4] = \
+      {0.577350269189626, -0.182574185835055, 0.105409255338946, -0.149071198499986};
+      
+      static const double coefficients2[4] = \
       {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
@@ -5429,10 +5523,17 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
-        derivatives[r] = 0.0;
+        derivatives_p[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
@@ -5528,8 +5629,18 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
+        
+        // Using covariant Piola transform to map values back to the physical element
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        const double tmp_ref2 = derivatives[2*num_derivatives + r];
+        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -5537,12 +5648,14 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 5:
       {
         
       // Array of basisvalues
@@ -5563,7 +5676,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      {0.577350269189626, 0.0, -0.210818510677892, -0.149071198499986};
+      
+      static const double coefficients1[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
+      
+      static const double coefficients2[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -5586,12 +5705,19 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
+      // Declare array of reference derivatives on physical element.
+      double derivatives_p[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives_p[r] = 0.0;
+      } // end loop over 'r'
+      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -5685,8 +5811,18 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
+            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
+        
+        // Using covariant Piola transform to map values back to the physical element
+        const double tmp_ref0 = derivatives[r];
+        const double tmp_ref1 = derivatives[num_derivatives + r];
+        const double tmp_ref2 = derivatives[2*num_derivatives + r];
+        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
+        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
+        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -5694,7 +5830,9 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives_p[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -5703,28 +5841,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5736,7 +5872,7 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 6; r++)
     {
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
@@ -5758,9 +5894,9 @@ public:
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -5768,136 +5904,91 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
+    
+    double result;
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     switch (i)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
-      return vals[0];
+      result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
+      return result;
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
-      return vals[0];
+      result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
+      return result;
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
-      return vals[0];
+      result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
+      return result;
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
-      return vals[0];
+      result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
+      return result;
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
-      return vals[1];
+      result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
+      return result;
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 6:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 8:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 9:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 10:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 11:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
+      result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]);
+      return result;
         break;
       }
     }
@@ -5905,197 +5996,163 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[4] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    
+    double result;
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
+    values[0] = result;
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
+    values[1] = result;
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
-    values[8] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
+    values[2] = result;
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
-    values[9] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
+    values[3] = result;
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
-    values[10] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
+    values[4] = result;
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    values[11] = vals[2];
+    result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]);
+    values[5] = result;
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
     // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    vertex_values[9] = dof_values[3];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[4];
-    vertex_values[4] = dof_values[5];
-    vertex_values[7] = dof_values[6];
-    vertex_values[10] = dof_values[7];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[8];
-    vertex_values[5] = dof_values[9];
-    vertex_values[8] = dof_values[10];
-    vertex_values[11] = dof_values[11];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[0] = dof_values[3]*K[6] + dof_values[4]*K[3] + dof_values[5]*K[0];
+    vertex_values[3] = dof_values[1]*K[6] + dof_values[2]*K[3] + dof_values[5]*(K[0] + K[3] + K[6]);
+    vertex_values[6] = dof_values[0]*K[6] + dof_values[2]*(K[0]*(-1.0)) + dof_values[4]*(K[0] + K[3] + K[6]);
+    vertex_values[9] = dof_values[0]*(K[3]*(-1.0)) + dof_values[1]*(K[0]*(-1.0)) + dof_values[3]*(K[0] + K[3] + K[6]);
+    vertex_values[1] = dof_values[3]*K[7] + dof_values[4]*K[4] + dof_values[5]*K[1];
+    vertex_values[4] = dof_values[1]*K[7] + dof_values[2]*K[4] + dof_values[5]*(K[1] + K[4] + K[7]);
+    vertex_values[7] = dof_values[0]*K[7] + dof_values[2]*(K[1]*(-1.0)) + dof_values[4]*(K[1] + K[4] + K[7]);
+    vertex_values[10] = dof_values[0]*(K[4]*(-1.0)) + dof_values[1]*(K[1]*(-1.0)) + dof_values[3]*(K[1] + K[4] + K[7]);
+    vertex_values[2] = dof_values[3]*K[8] + dof_values[4]*K[5] + dof_values[5]*K[2];
+    vertex_values[5] = dof_values[1]*K[8] + dof_values[2]*K[5] + dof_values[5]*(K[2] + K[5] + K[8]);
+    vertex_values[8] = dof_values[0]*K[8] + dof_values[2]*(K[2]*(-1.0)) + dof_values[4]*(K[2] + K[5] + K[8]);
+    vertex_values[11] = dof_values[0]*(K[5]*(-1.0)) + dof_values[1]*(K[2]*(-1.0)) + dof_values[3]*(K[2] + K[5] + K[8]);
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[3] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[4] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[5] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[6] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[7] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[8] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[9] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[10] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[11] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[13] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[14] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[15] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[16] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[17] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new currentdensity_finite_element_1();
-        break;
-      }
-    case 1:
-      {
-        return new currentdensity_finite_element_1();
-        break;
-      }
-    case 2:
-      {
-        return new currentdensity_finite_element_1();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new currentdensity_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class currentdensity_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   currentdensity_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_dofmap_0()
+  ~currentdensity_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -6113,50 +6170,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[1];
+    return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 6;
+    return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -6174,60 +6220,55 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[1][0];
-    dofs[1] = c.entity_indices[1][1];
-    dofs[2] = c.entity_indices[1][2];
-    dofs[3] = c.entity_indices[1][3];
-    dofs[4] = c.entity_indices[1][4];
-    dofs[5] = c.entity_indices[1][5];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
-      dofs[1] = 3;
-      dofs[2] = 4;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 2:
       {
-        dofs[0] = 1;
-      dofs[1] = 3;
-      dofs[2] = 5;
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
         break;
       }
     case 3:
       {
-        dofs[0] = 2;
-      dofs[1] = 4;
-      dofs[2] = 5;
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6238,14 +6279,9 @@ public:
     {
     case 0:
       {
-        
-        break;
-      }
-    case 1:
-      {
-        if (i > 5)
+        if (i > 3)
       {
-      throw std::runtime_error("i is larger than number of entities (5)");
+      throw std::runtime_error("i is larger than number of entities (3)");
       }
       
       switch (i)
@@ -6270,20 +6306,15 @@ public:
           dofs[0] = 3;
           break;
         }
-      case 4:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 5:
-        {
-          dofs[0] = 5;
-          break;
-        }
       }
       
         break;
       }
+    case 1:
+      {
+        
+        break;
+      }
     case 2:
       {
         
@@ -6298,77 +6329,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[3] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[4] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[5] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[6] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[7] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[8] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[9] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[10] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[11] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[13] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[14] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[15] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[16] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[17] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new currentdensity_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class currentdensity_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   currentdensity_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_dofmap_1()
+  ~currentdensity_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6397,45 +6396,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 3*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 4;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 9;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 3;
         break;
       }
     case 1:
@@ -6458,20 +6446,30 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6480,6 +6478,12 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 1:
@@ -6487,6 +6491,12 @@ public:
         dofs[0] = 0;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 2:
@@ -6494,6 +6504,12 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
         break;
       }
     case 3:
@@ -6501,15 +6517,20 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6530,21 +6551,29 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
           break;
         }
       }
@@ -6570,82 +6599,75 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new currentdensity_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new currentdensity_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new currentdensity_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new currentdensity_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class currentdensity_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   currentdensity_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_dofmap_2()
+  ~currentdensity_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "FFC dofmap for FiniteElement('Nedelec 1st kind H(curl)', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -6663,50 +6685,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3*num_global_entities[0];
+    return num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 9;
+    return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 3;
+        return 0;
         break;
       }
     case 1:
       {
-        return 0;
+        return 1;
         break;
       }
     case 2:
@@ -6724,94 +6735,57 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[0][0];
-    dofs[5] = offset + c.entity_indices[0][1];
-    dofs[6] = offset + c.entity_indices[0][2];
-    dofs[7] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[8] = offset + c.entity_indices[0][0];
-    dofs[9] = offset + c.entity_indices[0][1];
-    dofs[10] = offset + c.entity_indices[0][2];
-    dofs[11] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
+    dofs[0] = entity_indices[1][0];
+    dofs[1] = entity_indices[1][1];
+    dofs[2] = entity_indices[1][2];
+    dofs[3] = entity_indices[1][3];
+    dofs[4] = entity_indices[1][4];
+    dofs[5] = entity_indices[1][5];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 5;
-      dofs[4] = 6;
-      dofs[5] = 7;
-      dofs[6] = 9;
-      dofs[7] = 10;
-      dofs[8] = 11;
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 6;
-      dofs[5] = 7;
-      dofs[6] = 8;
-      dofs[7] = 10;
-      dofs[8] = 11;
+      dofs[1] = 3;
+      dofs[2] = 4;
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 7;
-      dofs[6] = 8;
-      dofs[7] = 9;
-      dofs[8] = 11;
+        dofs[0] = 1;
+      dofs[1] = 3;
+      dofs[2] = 5;
         break;
       }
     case 3:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 6;
-      dofs[6] = 8;
-      dofs[7] = 9;
-      dofs[8] = 10;
+        dofs[0] = 2;
+      dofs[1] = 4;
+      dofs[2] = 5;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6822,9 +6796,14 @@ public:
     {
     case 0:
       {
-        if (i > 3)
+        
+        break;
+      }
+    case 1:
       {
-      throw std::runtime_error("i is larger than number of entities (3)");
+        if (i > 5)
+      {
+      throw std::runtime_error("i is larger than number of entities (5)");
       }
       
       switch (i)
@@ -6832,40 +6811,37 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 4;
-        dofs[2] = 8;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 5;
-        dofs[2] = 9;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 6;
-        dofs[2] = 10;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
-        dofs[1] = 7;
-        dofs[2] = 11;
+          break;
+        }
+      case 4:
+        {
+          dofs[0] = 4;
+          break;
+        }
+      case 5:
+        {
+          dofs[0] = 5;
           break;
         }
       }
       
         break;
       }
-    case 1:
-      {
-        
-        break;
-      }
     case 2:
       {
         
@@ -6880,119 +6856,49 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = vertex_coordinates[6];
-    dof_coordinates[19] = vertex_coordinates[7];
-    dof_coordinates[20] = vertex_coordinates[8];
-    dof_coordinates[21] = vertex_coordinates[9];
-    dof_coordinates[22] = vertex_coordinates[10];
-    dof_coordinates[23] = vertex_coordinates[11];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[6];
-    dof_coordinates[31] = vertex_coordinates[7];
-    dof_coordinates[32] = vertex_coordinates[8];
-    dof_coordinates[33] = vertex_coordinates[9];
-    dof_coordinates[34] = vertex_coordinates[10];
-    dof_coordinates[35] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new currentdensity_dofmap_1();
-        break;
-      }
-    case 1:
-      {
-        return new currentdensity_dofmap_1();
-        break;
-      }
-    case 2:
-      {
-        return new currentdensity_dofmap_1();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new currentdensity_dofmap_2();
   }
 
 };
 
-/// 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 currentdensity_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   currentdensity_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~currentdensity_cell_integral_0_otherwise()
+  ~currentdensity_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    0
@@ -7001,7 +6907,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7163,38 +7069,31 @@ public:
 
 };
 
-/// 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 currentdensity_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   currentdensity_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~currentdensity_cell_integral_1_otherwise()
+  ~currentdensity_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    216
@@ -7203,7 +7102,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7340,77 +7239,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class currentdensity_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   currentdensity_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_form_0()
+  ~currentdensity_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "990d5db83b5c540830effab8fb9e6c9a6b475e964da621fcc7e12d54515f2a41fca2eb111437f612206453285044b8ea089d2abd1fc3308c223fa14ca314fc7b";
+    return "ef6890e8317f8e9d7f4f092ab4a26d7cd7b32f8b6d8c2fb6f78cd9a80589f5d475fce766c55cf462899c250c2370c5b91830e93c9d2fccd972aefdcc5632302d";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new currentdensity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new currentdensity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new currentdensity_finite_element_2();
+        return new currentdensity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new currentdensity_finite_element_2();
+        return new currentdensity_finite_element_1();
         break;
       }
     }
@@ -7418,19 +7309,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new currentdensity_dofmap_2();
+        return new currentdensity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new currentdensity_dofmap_2();
+        return new currentdensity_dofmap_1();
         break;
       }
     }
@@ -7438,203 +7328,231 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_cell_integrals() const final override
   {
-    return 0;
+    return true;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  bool has_exterior_facet_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_vertex_integrals() const final override
   {
-    return true;
+    return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new currentdensity_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class currentdensity_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   currentdensity_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_form_1()
+  ~currentdensity_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "bc0f411d750898082ec3ad7ea773479307cf0a372a4a9600bbf93b0dfe0743a768b863bcf8f6eaffd88db4795cfda49b6c0bbd4089a104b336abe9eb5fbe850a";
+    return "88e592cae6cb1ce50fe88f2b3a547ca1e2f417884e8f35919fdddaf51231c46e23ea3a49907ca7a128c58eedb7dd1c446cb5f54cdc384bb52581236142da7290";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new currentdensity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new currentdensity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new currentdensity_finite_element_2();
+        return new currentdensity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new currentdensity_finite_element_0();
+        return new currentdensity_finite_element_2();
         break;
       }
     }
@@ -7642,19 +7560,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new currentdensity_dofmap_2();
+        return new currentdensity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new currentdensity_dofmap_0();
+        return new currentdensity_dofmap_2();
         break;
       }
     }
@@ -7662,126 +7579,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new currentdensity_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -7795,14 +7748,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace CurrentDensity
 {
@@ -7811,43 +7770,20 @@ class CoefficientSpace_T: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_T(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_T(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_T(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<currentdensity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<currentdensity_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_T(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<currentdensity_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<currentdensity_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7858,43 +7794,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<currentdensity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<currentdensity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<currentdensity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<currentdensity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7905,63 +7818,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<currentdensity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<currentdensity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<currentdensity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<currentdensity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -7969,7 +7889,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_0());
+    _ufc_form = std::make_shared<const currentdensity_form_0>();
   }
 
   // Destructor
@@ -7999,57 +7919,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<currentdensity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<currentdensity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<currentdensity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<currentdensity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_T Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -8057,69 +8032,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), T(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
+    _ufc_form = std::make_shared<const currentdensity_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& T):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> T):
     dolfin::Form(1, 1), T(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->T = T;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
+    _ufc_form = std::make_shared<const currentdensity_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> T):
-    dolfin::Form(1, 1), T(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->T = *T;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "T")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), T(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "T";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_T;
+
+  // Coefficients
+  dolfin::CoefficientAssigner T;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& T):
-    dolfin::Form(1, 1), T(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), T(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->T = T;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> T):
-    dolfin::Form(1, 1), T(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> T):
+    dolfin::MultiMeshForm(V0), T(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->T = *T;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->T = T;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -8151,18 +8167,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_T;
 
   // Coefficients
-  dolfin::CoefficientAssigner T;
+  dolfin::MultiMeshCoefficientAssigner T;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/curl-curl/cpp/EddyCurrents.h b/demo/undocumented/curl-curl/cpp/EddyCurrents.h
index d6dc26d..ad95308 100644
--- a/demo/undocumented/curl-curl/cpp/EddyCurrents.h
+++ b/demo/undocumented/curl-curl/cpp/EddyCurrents.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __EDDYCURRENTS_H
 #define __EDDYCURRENTS_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class eddycurrents_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   eddycurrents_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~eddycurrents_finite_element_0()
+  ~eddycurrents_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -257,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -279,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -318,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -330,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -339,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1041,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1098,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1106,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1132,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1171,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1219,98 +1222,110 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new eddycurrents_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class eddycurrents_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   eddycurrents_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~eddycurrents_finite_element_1()
+  ~eddycurrents_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1324,16 +1339,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1342,9 +1371,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1733,20 +1762,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1755,7 +1782,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -1763,21 +1790,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1797,7 +1822,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1809,7 +1834,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -1818,9 +1843,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -3776,28 +3801,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -3833,7 +3856,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -3841,22 +3864,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -3867,108 +3888,108 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 9:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 10:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 11:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -3978,86 +3999,84 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[8] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[10] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[11] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4076,30 +4095,53 @@ public:
     vertex_values[11] = dof_values[11];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 3;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4123,70 +4165,83 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new eddycurrents_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class eddycurrents_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   eddycurrents_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~eddycurrents_finite_element_2()
+  ~eddycurrents_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Nedelec 1st kind H(curl)', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4200,16 +4255,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Nedelec 1st kind H(curl)";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -4218,9 +4287,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -4525,20 +4594,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -4547,7 +4614,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -4555,21 +4622,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -4589,7 +4654,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4601,7 +4666,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -4610,9 +4675,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -5776,28 +5841,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5833,7 +5896,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -5841,22 +5904,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -5867,14 +5928,14 @@ public:
     double result;
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     switch (i)
     {
     case 0:
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
       return result;
@@ -5882,9 +5943,9 @@ public:
       }
     case 1:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
       return result;
@@ -5892,9 +5953,9 @@ public:
       }
     case 2:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
       return result;
@@ -5902,9 +5963,9 @@ public:
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
       result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
       return result;
@@ -5912,9 +5973,9 @@ public:
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
       result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
       return result;
@@ -5922,9 +5983,9 @@ public:
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]);
       return result;
@@ -5935,12 +5996,11 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -5951,55 +6011,54 @@ public:
     double result;
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
     values[0] = result;
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
     values[1] = result;
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
     values[2] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
     values[3] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
     result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
     values[4] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]);
     values[5] = result;
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     
     // Compute Jacobian inverse and determinant
@@ -6022,69 +6081,67 @@ public:
     vertex_values[11] = dof_values[0]*(K[5]*(-1.0)) + dof_values[1]*(K[2]*(-1.0)) + dof_values[3]*(K[2] + K[5] + K[8]);
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[3] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[4] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[5] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[6] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[7] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[8] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[9] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[10] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[11] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[13] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[14] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[15] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[16] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[17] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new eddycurrents_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class eddycurrents_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   eddycurrents_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~eddycurrents_dofmap_0()
+  ~eddycurrents_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6113,39 +6170,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6174,20 +6220,18 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6223,9 +6267,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6286,71 +6329,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new eddycurrents_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class eddycurrents_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   eddycurrents_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~eddycurrents_dofmap_1()
+  ~eddycurrents_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6379,39 +6396,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 9;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6440,32 +6446,30 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[0][0];
-    dofs[5] = offset + c.entity_indices[0][1];
-    dofs[6] = offset + c.entity_indices[0][2];
-    dofs[7] = offset + c.entity_indices[0][3];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[8] = offset + c.entity_indices[0][0];
-    dofs[9] = offset + c.entity_indices[0][1];
-    dofs[10] = offset + c.entity_indices[0][2];
-    dofs[11] = offset + c.entity_indices[0][3];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6525,9 +6529,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6596,56 +6599,13 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = vertex_coordinates[6];
-    dof_coordinates[19] = vertex_coordinates[7];
-    dof_coordinates[20] = vertex_coordinates[8];
-    dof_coordinates[21] = vertex_coordinates[9];
-    dof_coordinates[22] = vertex_coordinates[10];
-    dof_coordinates[23] = vertex_coordinates[11];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[6];
-    dof_coordinates[31] = vertex_coordinates[7];
-    dof_coordinates[32] = vertex_coordinates[8];
-    dof_coordinates[33] = vertex_coordinates[9];
-    dof_coordinates[34] = vertex_coordinates[10];
-    dof_coordinates[35] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -6669,41 +6629,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new eddycurrents_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class eddycurrents_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   eddycurrents_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~eddycurrents_dofmap_2()
+  ~eddycurrents_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Nedelec 1st kind H(curl)', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6732,39 +6685,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6793,22 +6735,20 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[1][0];
-    dofs[1] = c.entity_indices[1][1];
-    dofs[2] = c.entity_indices[1][2];
-    dofs[3] = c.entity_indices[1][3];
-    dofs[4] = c.entity_indices[1][4];
-    dofs[5] = c.entity_indices[1][5];
+    dofs[0] = entity_indices[1][0];
+    dofs[1] = entity_indices[1][1];
+    dofs[2] = entity_indices[1][2];
+    dofs[3] = entity_indices[1][3];
+    dofs[4] = entity_indices[1][4];
+    dofs[5] = entity_indices[1][5];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6844,9 +6784,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6917,86 +6856,53 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[3] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[4] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[5] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[6] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[7] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[8] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[9] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[10] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[11] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[13] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[14] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[15] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[16] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[17] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new eddycurrents_dofmap_2();
   }
 
 };
 
-/// 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 eddycurrents_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   eddycurrents_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~eddycurrents_cell_integral_0_otherwise()
+  ~eddycurrents_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7017,29 +6923,29 @@ public:
     // Quadrature points on the UFC reference element: (0.25, 0.25, 0.25)
     
     // Values of basis functions at quadrature points.
-    static const double FE1_C0_D001[1][3] = \
+    static const double FE0_C0_D001[1][3] = \
     {{-1.0, 0.999999999999999, -1.0}};
     
     // Array of non-zero columns
-    static const unsigned int nzc13[3] = {1, 3, 5};
+    static const unsigned int nzc1[3] = {1, 3, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc14[3] = {2, 4, 5};
+    static const unsigned int nzc2[3] = {2, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc16[3] = {0, 3, 4};
+    static const unsigned int nzc4[3] = {0, 3, 4};
     
-    static const double FE1_C1_D100[1][3] = \
+    static const double FE0_C1_D100[1][3] = \
     {{1.0, -1.0, 1.0}};
     
     // Array of non-zero columns
-    static const unsigned int nzc17[3] = {2, 4, 5};
+    static const unsigned int nzc5[3] = {2, 4, 5};
     
     // Array of non-zero columns
-    static const unsigned int nzc19[3] = {0, 3, 4};
+    static const unsigned int nzc7[3] = {0, 3, 4};
     
     // Array of non-zero columns
-    static const unsigned int nzc20[3] = {1, 3, 5};
+    static const unsigned int nzc8[3] = {1, 3, 5};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 36; r++)
@@ -7075,77 +6981,77 @@ public:
         for (unsigned int k = 0; k < 3; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc13[j]*6 + nzc13[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[0];
+          A[nzc1[j]*6 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[0];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*6 + nzc14[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[1];
+          A[nzc1[j]*6 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[1];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*6 + nzc16[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[2];
+          A[nzc1[j]*6 + nzc4[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[2];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*6 + nzc17[k]] += FE1_C0_D001[0][j]*FE1_C1_D100[0][k]*G[3];
+          A[nzc1[j]*6 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C1_D100[0][k]*G[3];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*6 + nzc19[k]] += FE1_C0_D001[0][j]*FE1_C1_D100[0][k]*G[4];
+          A[nzc1[j]*6 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C1_D100[0][k]*G[4];
           // Number of operations to compute entry: 3
-          A[nzc13[j]*6 + nzc20[k]] += FE1_C0_D001[0][j]*FE1_C1_D100[0][k]*G[5];
+          A[nzc1[j]*6 + nzc8[k]] += FE0_C0_D001[0][j]*FE0_C1_D100[0][k]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*6 + nzc13[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[1];
+          A[nzc2[j]*6 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[1];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*6 + nzc14[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[6];
+          A[nzc2[j]*6 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[6];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*6 + nzc16[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[7];
+          A[nzc2[j]*6 + nzc4[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[7];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*6 + nzc17[k]] += FE1_C0_D001[0][j]*FE1_C1_D100[0][k]*G[8];
+          A[nzc2[j]*6 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C1_D100[0][k]*G[8];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*6 + nzc19[k]] += FE1_C0_D001[0][j]*FE1_C1_D100[0][k]*G[9];
+          A[nzc2[j]*6 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C1_D100[0][k]*G[9];
           // Number of operations to compute entry: 3
-          A[nzc14[j]*6 + nzc20[k]] += FE1_C0_D001[0][j]*FE1_C1_D100[0][k]*G[3];
+          A[nzc2[j]*6 + nzc8[k]] += FE0_C0_D001[0][j]*FE0_C1_D100[0][k]*G[3];
           // Number of operations to compute entry: 3
-          A[nzc16[j]*6 + nzc13[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[2];
+          A[nzc4[j]*6 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[2];
           // Number of operations to compute entry: 3
-          A[nzc16[j]*6 + nzc14[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[7];
+          A[nzc4[j]*6 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[7];
           // Number of operations to compute entry: 3
-          A[nzc16[j]*6 + nzc16[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[10];
+          A[nzc4[j]*6 + nzc4[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[10];
           // Number of operations to compute entry: 3
-          A[nzc16[j]*6 + nzc17[k]] += FE1_C0_D001[0][j]*FE1_C1_D100[0][k]*G[9];
+          A[nzc4[j]*6 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C1_D100[0][k]*G[9];
           // Number of operations to compute entry: 3
-          A[nzc16[j]*6 + nzc19[k]] += FE1_C0_D001[0][j]*FE1_C1_D100[0][k]*G[11];
+          A[nzc4[j]*6 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C1_D100[0][k]*G[11];
           // Number of operations to compute entry: 3
-          A[nzc16[j]*6 + nzc20[k]] += FE1_C0_D001[0][j]*FE1_C1_D100[0][k]*G[4];
+          A[nzc4[j]*6 + nzc8[k]] += FE0_C0_D001[0][j]*FE0_C1_D100[0][k]*G[4];
           // Number of operations to compute entry: 3
-          A[nzc17[j]*6 + nzc13[k]] += FE1_C0_D001[0][k]*FE1_C1_D100[0][j]*G[3];
+          A[nzc5[j]*6 + nzc1[k]] += FE0_C0_D001[0][k]*FE0_C1_D100[0][j]*G[3];
           // Number of operations to compute entry: 3
-          A[nzc17[j]*6 + nzc14[k]] += FE1_C0_D001[0][k]*FE1_C1_D100[0][j]*G[8];
+          A[nzc5[j]*6 + nzc2[k]] += FE0_C0_D001[0][k]*FE0_C1_D100[0][j]*G[8];
           // Number of operations to compute entry: 3
-          A[nzc17[j]*6 + nzc16[k]] += FE1_C0_D001[0][k]*FE1_C1_D100[0][j]*G[9];
+          A[nzc5[j]*6 + nzc4[k]] += FE0_C0_D001[0][k]*FE0_C1_D100[0][j]*G[9];
           // Number of operations to compute entry: 3
-          A[nzc17[j]*6 + nzc17[k]] += FE1_C1_D100[0][j]*FE1_C1_D100[0][k]*G[6];
+          A[nzc5[j]*6 + nzc5[k]] += FE0_C1_D100[0][j]*FE0_C1_D100[0][k]*G[6];
           // Number of operations to compute entry: 3
-          A[nzc17[j]*6 + nzc19[k]] += FE1_C1_D100[0][j]*FE1_C1_D100[0][k]*G[7];
+          A[nzc5[j]*6 + nzc7[k]] += FE0_C1_D100[0][j]*FE0_C1_D100[0][k]*G[7];
           // Number of operations to compute entry: 3
-          A[nzc17[j]*6 + nzc20[k]] += FE1_C1_D100[0][j]*FE1_C1_D100[0][k]*G[1];
+          A[nzc5[j]*6 + nzc8[k]] += FE0_C1_D100[0][j]*FE0_C1_D100[0][k]*G[1];
           // Number of operations to compute entry: 3
-          A[nzc19[j]*6 + nzc13[k]] += FE1_C0_D001[0][k]*FE1_C1_D100[0][j]*G[4];
+          A[nzc7[j]*6 + nzc1[k]] += FE0_C0_D001[0][k]*FE0_C1_D100[0][j]*G[4];
           // Number of operations to compute entry: 3
-          A[nzc19[j]*6 + nzc14[k]] += FE1_C0_D001[0][k]*FE1_C1_D100[0][j]*G[9];
+          A[nzc7[j]*6 + nzc2[k]] += FE0_C0_D001[0][k]*FE0_C1_D100[0][j]*G[9];
           // Number of operations to compute entry: 3
-          A[nzc19[j]*6 + nzc16[k]] += FE1_C0_D001[0][k]*FE1_C1_D100[0][j]*G[11];
+          A[nzc7[j]*6 + nzc4[k]] += FE0_C0_D001[0][k]*FE0_C1_D100[0][j]*G[11];
           // Number of operations to compute entry: 3
-          A[nzc19[j]*6 + nzc17[k]] += FE1_C1_D100[0][j]*FE1_C1_D100[0][k]*G[7];
+          A[nzc7[j]*6 + nzc5[k]] += FE0_C1_D100[0][j]*FE0_C1_D100[0][k]*G[7];
           // Number of operations to compute entry: 3
-          A[nzc19[j]*6 + nzc19[k]] += FE1_C1_D100[0][j]*FE1_C1_D100[0][k]*G[10];
+          A[nzc7[j]*6 + nzc7[k]] += FE0_C1_D100[0][j]*FE0_C1_D100[0][k]*G[10];
           // Number of operations to compute entry: 3
-          A[nzc19[j]*6 + nzc20[k]] += FE1_C1_D100[0][j]*FE1_C1_D100[0][k]*G[2];
+          A[nzc7[j]*6 + nzc8[k]] += FE0_C1_D100[0][j]*FE0_C1_D100[0][k]*G[2];
           // Number of operations to compute entry: 3
-          A[nzc20[j]*6 + nzc13[k]] += FE1_C0_D001[0][k]*FE1_C1_D100[0][j]*G[5];
+          A[nzc8[j]*6 + nzc1[k]] += FE0_C0_D001[0][k]*FE0_C1_D100[0][j]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc20[j]*6 + nzc14[k]] += FE1_C0_D001[0][k]*FE1_C1_D100[0][j]*G[3];
+          A[nzc8[j]*6 + nzc2[k]] += FE0_C0_D001[0][k]*FE0_C1_D100[0][j]*G[3];
           // Number of operations to compute entry: 3
-          A[nzc20[j]*6 + nzc16[k]] += FE1_C0_D001[0][k]*FE1_C1_D100[0][j]*G[4];
+          A[nzc8[j]*6 + nzc4[k]] += FE0_C0_D001[0][k]*FE0_C1_D100[0][j]*G[4];
           // Number of operations to compute entry: 3
-          A[nzc20[j]*6 + nzc17[k]] += FE1_C1_D100[0][j]*FE1_C1_D100[0][k]*G[1];
+          A[nzc8[j]*6 + nzc5[k]] += FE0_C1_D100[0][j]*FE0_C1_D100[0][k]*G[1];
           // Number of operations to compute entry: 3
-          A[nzc20[j]*6 + nzc19[k]] += FE1_C1_D100[0][j]*FE1_C1_D100[0][k]*G[2];
+          A[nzc8[j]*6 + nzc7[k]] += FE0_C1_D100[0][j]*FE0_C1_D100[0][k]*G[2];
           // Number of operations to compute entry: 3
-          A[nzc20[j]*6 + nzc20[k]] += FE1_C1_D100[0][j]*FE1_C1_D100[0][k]*G[0];
+          A[nzc8[j]*6 + nzc8[k]] += FE0_C1_D100[0][j]*FE0_C1_D100[0][k]*G[0];
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -7153,38 +7059,31 @@ public:
 
 };
 
-/// 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 eddycurrents_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   eddycurrents_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~eddycurrents_cell_integral_1_otherwise()
+  ~eddycurrents_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    54
@@ -7193,7 +7092,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7252,66 +7151,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class eddycurrents_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   eddycurrents_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~eddycurrents_form_0()
+  ~eddycurrents_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "cf2540942dd05c55b0c569daf0bc34383dbe3f1c6a16e233be7d9c7a9a66feef26703aa3e907fc8a336a76f763adc2b6a57ff2e164c15d32e6a180e77232fd34";
+    return "ecafa2c465a623fac2d54a25e28586de3b89a538d25c039f8ae476343534093ad9bd69946769acec32d2a5537a2bea1159311ee00f507d0582d1069a72bf36b9";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new eddycurrents_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new eddycurrents_dofmap_1();
+   }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -7330,8 +7221,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -7350,192 +7240,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new eddycurrents_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class eddycurrents_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   eddycurrents_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~eddycurrents_form_1()
+  ~eddycurrents_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "9e205316eb28d16c483c70f293ffde8de9b56876968157779b71ad7834ec5af9d7efcbbc60ed69f64faca388f6536292644e4cce6ecf62e4cfbbef8b9ae683af";
+    return "b7ee1e617ad1333f698565c370c04cc6df2d211f2877988cb9a8e7a14cf3b2788a05b0a38adece2ee50c1aec179cf1258f15a274113aa73b6466c02ebcc0c79e";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new eddycurrents_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new eddycurrents_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -7554,8 +7472,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -7574,126 +7491,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new eddycurrents_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -7707,14 +7660,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace EddyCurrents
 {
@@ -7723,43 +7682,20 @@ class CoefficientSpace_dbdt: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_dbdt(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_dbdt(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_dbdt(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<eddycurrents_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<eddycurrents_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_dbdt(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<eddycurrents_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<eddycurrents_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7770,43 +7706,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<eddycurrents_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<eddycurrents_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<eddycurrents_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<eddycurrents_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7817,63 +7730,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<eddycurrents_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<eddycurrents_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<eddycurrents_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<eddycurrents_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new eddycurrents_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -7881,7 +7801,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new eddycurrents_form_0());
+    _ufc_form = std::make_shared<const eddycurrents_form_0>();
   }
 
   // Destructor
@@ -7911,57 +7831,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<eddycurrents_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<eddycurrents_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new eddycurrents_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new eddycurrents_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<eddycurrents_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<eddycurrents_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_dbdt Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -7969,69 +7944,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), dbdt(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new eddycurrents_form_1());
+    _ufc_form = std::make_shared<const eddycurrents_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& dbdt):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> dbdt):
     dolfin::Form(1, 1), dbdt(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->dbdt = dbdt;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new eddycurrents_form_1());
+    _ufc_form = std::make_shared<const eddycurrents_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> dbdt):
-    dolfin::Form(1, 1), dbdt(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->dbdt = *dbdt;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "dbdt")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new eddycurrents_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), dbdt(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "dbdt";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new eddycurrents_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_dbdt;
+
+  // Coefficients
+  dolfin::CoefficientAssigner dbdt;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& dbdt):
-    dolfin::Form(1, 1), dbdt(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), dbdt(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->dbdt = dbdt;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new eddycurrents_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> dbdt):
-    dolfin::Form(1, 1), dbdt(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> dbdt):
+    dolfin::MultiMeshForm(V0), dbdt(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->dbdt = *dbdt;
+    /// Assign coefficients
+    this->dbdt = dbdt;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new eddycurrents_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -8063,18 +8079,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_dbdt;
 
   // Coefficients
-  dolfin::CoefficientAssigner dbdt;
+  dolfin::MultiMeshCoefficientAssigner dbdt;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/bench/function/evaluation/cpp/P1.h b/demo/undocumented/curl-curl/cpp/P1Space.h
similarity index 72%
copy from bench/function/evaluation/cpp/P1.h
copy to demo/undocumented/curl-curl/cpp/P1Space.h
index 4c617f9..6d02545 100644
--- a/bench/function/evaluation/cpp/P1.h
+++ b/demo/undocumented/curl-curl/cpp/P1Space.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
-#ifndef __P1_H
-#define __P1_H
-
-#include <cmath>
+#ifndef __P1SPACE_H
+#define __P1SPACE_H
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
-class p1_finite_element_0: public ufc::finite_element
+class p1space_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  p1_finite_element_0() : ufc::finite_element()
+  p1space_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_finite_element_0()
+  ~p1space_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -257,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -279,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -318,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -330,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -339,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1041,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1098,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1106,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1132,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1171,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1219,69 +1222,61 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new p1_finite_element_0();
+    return new p1space_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class p1_dofmap_0: public ufc::dofmap
+class p1space_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  p1_dofmap_0() : ufc::dofmap()
+  p1space_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_dofmap_0()
+  ~p1space_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1310,39 +1305,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1371,20 +1355,18 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1420,9 +1402,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -1483,40 +1464,20 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new p1_dofmap_0();
+    return new p1space_dofmap_0();
   }
 
 };
@@ -1528,59 +1489,42 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
-namespace P1
+namespace P1Space
 {
 
 class FunctionSpace: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1space_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1space_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1space_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1space_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
diff --git a/test/unit/la/cpp/forms/ReactionDiffusionAction.ufl b/demo/undocumented/curl-curl/cpp/P1Space.ufl
similarity index 64%
copy from test/unit/la/cpp/forms/ReactionDiffusionAction.ufl
copy to demo/undocumented/curl-curl/cpp/P1Space.ufl
index 2455ab7..5c32c51 100644
--- a/test/unit/la/cpp/forms/ReactionDiffusionAction.ufl
+++ b/demo/undocumented/curl-curl/cpp/P1Space.ufl
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Anders Logg
+# Copyright (C) 2015 Garth N. Wells
 #
 # This file is part of DOLFIN.
 #
@@ -13,14 +13,8 @@
 # GNU Lesser General Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http:#www.gnu.org/licenses/>.
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
-# First added:  2012-08-21
-# Last changed: 2012-08-21
-#
-# Linear form the action of a simple reaction-diffusion problem
+# Compile this form with FFC: ffc -l dolfin P1Space.ufl
 
-V = FiniteElement("Lagrange", triangle, 1)
-u = Coefficient(V)
-v = TestFunction(V)
-a = dot(grad(u), grad(v))*dx + u*v*dx
+element = FiniteElement("Lagrange", tetrahedron, 1)
diff --git a/demo/undocumented/curl-curl/cpp/compile.log b/demo/undocumented/curl-curl/cpp/compile.log
index cf840c7..cf4d8a3 100644
--- a/demo/undocumented/curl-curl/cpp/compile.log
+++ b/demo/undocumented/curl-curl/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form CurrentDensity
 
@@ -28,9 +29,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 0
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -68,11 +69,11 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 3
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 1
-  quadrature_degree: auto --> 1
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 1
+  quadrature_degree: 1
   
-Compiler stage 1 finished in 0.0924141 seconds.
+Compiler stage 1 finished in 0.151629 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -83,10 +84,15 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -101,7 +107,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.00142 seconds
+  144 entries computed in 0.0013 seconds
   Shape of reference tensor: (12, 12)
   Primary multi index:   rank = 2 dims = [12, 12] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [...]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -139,7 +145,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  648 entries computed in 0.0014 seconds
+  648 entries computed in 0.00146 seconds
   Shape of reference tensor: (12, 6, 3, 3)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 3 dims = [6, 3, 3] indices = [[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 1, 0], [0, 1, 1], [0, 1, 2], [0, 2, 0], [0, 2, 1], [0, 2, 2], [1, 0, 0], [1, 0, 1], [1, 0, 2], [1, 1, 0], [1, 1, 1], [1, 1, 2], [1, 2, 0], [1, 2, 1], [1, 2, 2], [2, 0, 0], [2, 0, 1], [2, 0, 2], [2, 1, 0], [2, 1, 1], [2, 1, 2], [2, 2, 0], [2, 2, 1], [2, 2, 2], [3, 0, 0], [3, 0, 1], [3, 0, 2], [3, 1, 0], [3, 1, 1], [3, 1, 2], [3, 2, 0], [3, 2, 1], [3, 2, 2], [4, 0, 0], [4, 0, 1], [4, 0, 2], [ [...]
@@ -149,7 +155,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  648 entries computed in 0.00139 seconds
+  648 entries computed in 0.00144 seconds
   Shape of reference tensor: (12, 6, 3, 3)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 3 dims = [6, 3, 3] indices = [[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 1, 0], [0, 1, 1], [0, 1, 2], [0, 2, 0], [0, 2, 1], [0, 2, 2], [1, 0, 0], [1, 0, 1], [1, 0, 2], [1, 1, 0], [1, 1, 1], [1, 1, 2], [1, 2, 0], [1, 2, 1], [1, 2, 2], [2, 0, 0], [2, 0, 1], [2, 0, 2], [2, 1, 0], [2, 1, 1], [2, 1, 2], [2, 2, 0], [2, 2, 1], [2, 2, 2], [3, 0, 0], [3, 0, 1], [3, 0, 2], [3, 1, 0], [3, 1, 1], [3, 1, 2], [3, 2, 0], [3, 2, 1], [3, 2, 2], [4, 0, 0], [4, 0, 1], [4, 0, 2], [ [...]
@@ -159,7 +165,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  648 entries computed in 0.00145 seconds
+  648 entries computed in 0.00143 seconds
   Shape of reference tensor: (12, 6, 3, 3)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 3 dims = [6, 3, 3] indices = [[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 1, 0], [0, 1, 1], [0, 1, 2], [0, 2, 0], [0, 2, 1], [0, 2, 2], [1, 0, 0], [1, 0, 1], [1, 0, 2], [1, 1, 0], [1, 1, 1], [1, 1, 2], [1, 2, 0], [1, 2, 1], [1, 2, 2], [2, 0, 0], [2, 0, 1], [2, 0, 2], [2, 1, 0], [2, 1, 1], [2, 1, 2], [2, 2, 0], [2, 2, 1], [2, 2, 2], [3, 0, 0], [3, 0, 1], [3, 0, 2], [3, 1, 0], [3, 1, 1], [3, 1, 2], [3, 2, 0], [3, 2, 1], [3, 2, 2], [4, 0, 0], [4, 0, 1], [4, 0, 2], [ [...]
@@ -179,7 +185,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  648 entries computed in 0.00144 seconds
+  648 entries computed in 0.00142 seconds
   Shape of reference tensor: (12, 6, 3, 3)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 3 dims = [6, 3, 3] indices = [[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 1, 0], [0, 1, 1], [0, 1, 2], [0, 2, 0], [0, 2, 1], [0, 2, 2], [1, 0, 0], [1, 0, 1], [1, 0, 2], [1, 1, 0], [1, 1, 1], [1, 1, 2], [1, 2, 0], [1, 2, 1], [1, 2, 2], [2, 0, 0], [2, 0, 1], [2, 0, 2], [2, 1, 0], [2, 1, 1], [2, 1, 2], [2, 2, 0], [2, 2, 1], [2, 2, 2], [3, 0, 0], [3, 0, 1], [3, 0, 2], [3, 1, 0], [3, 1, 1], [3, 1, 2], [3, 2, 0], [3, 2, 1], [3, 2, 2], [4, 0, 0], [4, 0, 1], [4, 0, 2], [ [...]
@@ -200,12 +206,12 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.023725 seconds.
+Compiler stage 2 finished in 0.028836 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000139952 seconds.
+Compiler stage 3 finished in 0.000182152 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
@@ -214,463 +220,201 @@ Compiler stage 4: Generating code
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.294285 seconds.
+Compiler stage 4 finished in 0.387877 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000505924 seconds.
+Compiler stage 4.1 finished in 0.00071311 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./CurrentDensity.h.
-Compiler stage 5 finished in 0.000931025 seconds.
+Compiler stage 5 finished in 0.000742912 seconds.
 
-FFC finished in 0.412301 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.570383 seconds.
+Output written to ./CurrentDensity.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form EddyCurrents
 
@@ -683,8 +427,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'N1curl1(?)'
-  Unique sub elements:       'N1curl1(?)'
+  Unique elements:           'N1curl1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'N1curl1(?), Vector<3 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -737,9 +481,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -763,11 +507,11 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.103167 seconds.
+Compiler stage 1 finished in 0.270008 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -778,10 +522,15 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -789,9 +538,98 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1.],
+  {1: {FiniteElement('Nedelec 1st kind H(curl)', tetrahedron, 1): {None: {None: {(1, 0, 0): array([[[  1.60341042e-31],
+          [ -3.04047097e-16],
+          [  1.14017661e-16]],
+  
+         [[ -3.79213356e-16],
+          [ -1.90029436e-17],
+          [  1.00000000e+00]],
+  
+         [[ -5.82117938e-16],
+          [  1.00000000e+00],
+          [ -1.71026492e-16]],
+  
+         [[  3.79213356e-16],
+          [  1.52023549e-16],
+          [ -1.00000000e+00]],
+  
+         [[  5.82117938e-16],
+          [ -1.00000000e+00],
+          [  5.32082420e-16]],
+  
+         [[ -9.61331293e-16],
+          [  1.00000000e+00],
+          [  1.00000000e+00]]]), (0, 1, 0): array([[[ -6.58281275e-17],
+          [ -1.84937612e-16],
+          [  1.00000000e+00]],
+  
+         [[ -1.56692614e-16],
+          [  3.98696239e-17],
+          [  3.33066907e-16]],
+  
+         [[ -1.00000000e+00],
+          [  4.44089210e-16],
+          [  2.10713328e-16]],
+  
+         [[  3.87091060e-16],
+          [  1.74753966e-16],
+          [ -1.00000000e+00]],
+  
+         [[  1.00000000e+00],
+          [ -6.10622664e-16],
+          [  1.00000000e+00]],
+  
+         [[ -1.00000000e+00],
+          [  4.99600361e-16],
+          [  3.88578059e-16]]]), (0, 0, 0): array([[[  1.82237253e-17],
+          [ -2.50000000e-01],
+          [  2.50000000e-01]],
+  
+         [[ -2.50000000e-01],
+          [  7.25571004e-17],
+          [  2.50000000e-01]],
+  
+         [[ -2.50000000e-01],
+          [  2.50000000e-01],
+          [  4.85670141e-17]],
+  
+         [[  2.50000000e-01],
+          [  2.50000000e-01],
+          [  5.00000000e-01]],
+  
+         [[  2.50000000e-01],
+          [  5.00000000e-01],
+          [  2.50000000e-01]],
+  
+         [[  5.00000000e-01],
+          [  2.50000000e-01],
+          [  2.50000000e-01]]]), (0, 0, 1): array([[[  4.12500768e-16],
+          [ -1.00000000e+00],
+          [  4.44089210e-16]],
+  
+         [[ -1.00000000e+00],
+          [  4.10367360e-16],
+          [  4.44089210e-16]],
+  
+         [[ -2.77555756e-16],
+          [  1.66533454e-16],
+          [  1.32289452e-17]],
+  
+         [[  1.00000000e+00],
+          [  1.00000000e+00],
+          [ -7.77156117e-16]],
+  
+         [[  4.44089210e-16],
+          [ -1.00000000e+00],
+          [  3.33066907e-16]],
+  
+         [[ -1.00000000e+00],
+          [  4.99600361e-16],
+          [  4.99600361e-16]]])}}}, VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1.],
           [ 0.],
           [ 0.]],
   
@@ -975,174 +813,86 @@ Compiler stage 2: Computing intermediate representation
   
          [[  0.00000000e+00],
           [  0.00000000e+00],
-          [  1.00000000e+00]]])}}}, FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[  1.60341042e-31],
-          [ -3.04047097e-16],
-          [  1.14017661e-16]],
-  
-         [[ -3.79213356e-16],
-          [ -1.90029436e-17],
-          [  1.00000000e+00]],
-  
-         [[ -5.82117938e-16],
-          [  1.00000000e+00],
-          [ -1.71026492e-16]],
-  
-         [[  3.79213356e-16],
-          [  1.52023549e-16],
-          [ -1.00000000e+00]],
-  
-         [[  5.82117938e-16],
-          [ -1.00000000e+00],
-          [  5.32082420e-16]],
-  
-         [[ -9.61331293e-16],
-          [  1.00000000e+00],
-          [  1.00000000e+00]]]), (0, 1, 0): array([[[ -6.58281275e-17],
-          [ -1.84937612e-16],
-          [  1.00000000e+00]],
-  
-         [[ -1.56692614e-16],
-          [  3.98696239e-17],
-          [  3.33066907e-16]],
-  
-         [[ -1.00000000e+00],
-          [  4.44089210e-16],
-          [  2.10713328e-16]],
-  
-         [[  3.87091060e-16],
-          [  1.74753966e-16],
-          [ -1.00000000e+00]],
-  
-         [[  1.00000000e+00],
-          [ -6.10622664e-16],
-          [  1.00000000e+00]],
-  
-         [[ -1.00000000e+00],
-          [  4.99600361e-16],
-          [  3.88578059e-16]]]), (0, 0, 0): array([[[  1.82237253e-17],
-          [ -2.50000000e-01],
-          [  2.50000000e-01]],
-  
-         [[ -2.50000000e-01],
-          [  7.25571004e-17],
-          [  2.50000000e-01]],
-  
-         [[ -2.50000000e-01],
-          [  2.50000000e-01],
-          [  4.85670141e-17]],
-  
-         [[  2.50000000e-01],
-          [  2.50000000e-01],
-          [  5.00000000e-01]],
-  
-         [[  2.50000000e-01],
-          [  5.00000000e-01],
-          [  2.50000000e-01]],
-  
-         [[  5.00000000e-01],
-          [  2.50000000e-01],
-          [  2.50000000e-01]]]), (0, 0, 1): array([[[  4.12500768e-16],
-          [ -1.00000000e+00],
-          [  4.44089210e-16]],
-  
-         [[ -1.00000000e+00],
-          [  4.10367360e-16],
-          [  4.44089210e-16]],
-  
-         [[ -2.77555756e-16],
-          [  1.66533454e-16],
-          [  1.32289452e-17]],
-  
-         [[  1.00000000e+00],
-          [  1.00000000e+00],
-          [ -7.77156117e-16]],
-  
-         [[  4.44089210e-16],
-          [ -1.00000000e+00],
-          [  3.33066907e-16]],
-  
-         [[ -1.00000000e+00],
-          [  4.99600361e-16],
-          [  4.99600361e-16]]])}}}}}
+          [  1.00000000e+00]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE0_C2_D001': array([[  4.44089210e-16,   4.44089210e-16,   1.32289452e-17,
+           -7.77156117e-16,   3.33066907e-16,   4.99600361e-16]]), 'FE0_C1_D010': array([[ -1.84937612e-16,   3.98696239e-17,   4.44089210e-16,
+            1.74753966e-16,  -6.10622664e-16,   4.99600361e-16]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D010': array([[ -6.58281275e-17,  -1.56692614e-16,  -1.00000000e+00,
+            3.87091060e-16,   1.00000000e+00,  -1.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D010': array([[ -6.58281275e-17,  -1.56692614e-16,  -1.00000000e+00,
-            3.87091060e-16,   1.00000000e+00,  -1.00000000e+00]]), 'FE1_C2_D010': array([[  1.00000000e+00,   3.33066907e-16,   2.10713328e-16,
-           -1.00000000e+00,   1.00000000e+00,   3.88578059e-16]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2': array([[  2.50000000e-01,   2.50000000e-01,   4.85670141e-17,
+            5.00000000e-01,   2.50000000e-01,   2.50000000e-01]]), 'FE0_C1': array([[ -2.50000000e-01,   7.25571004e-17,   2.50000000e-01,
+            2.50000000e-01,   5.00000000e-01,   2.50000000e-01]]), 'FE0_C0': array([[  1.82237253e-17,  -2.50000000e-01,  -2.50000000e-01,
+            2.50000000e-01,   2.50000000e-01,   5.00000000e-01]]), 'FE0_C2_D010': array([[  1.00000000e+00,   3.33066907e-16,   2.10713328e-16,
+           -1.00000000e+00,   1.00000000e+00,   3.88578059e-16]]), 'FE0_C2_D100': array([[  1.14017661e-16,   1.00000000e+00,  -1.71026492e-16,
+           -1.00000000e+00,   5.32082420e-16,   1.00000000e+00]]), 'FE0_C1_D001': array([[ -1.00000000e+00,   4.10367360e-16,   1.66533454e-16,
+            1.00000000e+00,  -1.00000000e+00,   4.99600361e-16]]), 'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D010': array([[ -1.84937612e-16,   3.98696239e-17,   4.44089210e-16,
-            1.74753966e-16,  -6.10622664e-16,   4.99600361e-16]]), 'FE0_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
-           0.25,  0.25,  0.25]]), 'FE0_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE0_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE0_C1_D100': array([[ -3.04047097e-16,  -1.90029436e-17,   1.00000000e+00,
+            1.52023549e-16,  -1.00000000e+00,   1.00000000e+00]]), 'FE0_C0_D100': array([[  1.60341042e-31,  -3.79213356e-16,  -5.82117938e-16,
+            3.79213356e-16,   5.82117938e-16,  -9.61331293e-16]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C0_D001': array([[  4.12500768e-16,  -1.00000000e+00,  -2.77555756e-16,
+            1.00000000e+00,   4.44089210e-16,  -1.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D001': array([[  4.12500768e-16,  -1.00000000e+00,  -2.77555756e-16,
-            1.00000000e+00,   4.44089210e-16,  -1.00000000e+00]]), 'FE1_C0': array([[  1.82237253e-17,  -2.50000000e-01,  -2.50000000e-01,
-            2.50000000e-01,   2.50000000e-01,   5.00000000e-01]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D100': array([[  1.60341042e-31,  -3.79213356e-16,  -5.82117938e-16,
-            3.79213356e-16,   5.82117938e-16,  -9.61331293e-16]]), 'FE1_C2_D001': array([[  4.44089210e-16,   4.44089210e-16,   1.32289452e-17,
-           -7.77156117e-16,   3.33066907e-16,   4.99600361e-16]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
+           0.25,  0.25,  0.25]])}
+  
+  tables: {'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ -3.04047097e-16,  -1.90029436e-17,   1.00000000e+00,
-            1.52023549e-16,  -1.00000000e+00,   1.00000000e+00]]), 'FE1_C2_D100': array([[  1.14017661e-16,   1.00000000e+00,  -1.71026492e-16,
-           -1.00000000e+00,   5.32082420e-16,   1.00000000e+00]]), 'FE1_C1': array([[ -2.50000000e-01,   7.25571004e-17,   2.50000000e-01,
-            2.50000000e-01,   5.00000000e-01,   2.50000000e-01]]), 'FE1_C1_D001': array([[ -1.00000000e+00,   4.10367360e-16,   1.66533454e-16,
-            1.00000000e+00,  -1.00000000e+00,   4.99600361e-16]]), 'FE1_C2': array([[  2.50000000e-01,   2.50000000e-01,   4.85670141e-17,
-            5.00000000e-01,   2.50000000e-01,   2.50000000e-01]])}
-  
-  tables: {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D010': array([[ -6.58281275e-17,  -1.56692614e-16,  -1.00000000e+00,
+            3.87091060e-16,   1.00000000e+00,  -1.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D010': array([[ -6.58281275e-17,  -1.56692614e-16,  -1.00000000e+00,
-            3.87091060e-16,   1.00000000e+00,  -1.00000000e+00]]), 'FE1_C2_D010': array([[  1.00000000e+00,   3.33066907e-16,   2.10713328e-16,
-           -1.00000000e+00,   1.00000000e+00,   3.88578059e-16]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2': array([[  2.50000000e-01,   2.50000000e-01,   4.85670141e-17,
+            5.00000000e-01,   2.50000000e-01,   2.50000000e-01]]), 'FE0_C1': array([[ -2.50000000e-01,   7.25571004e-17,   2.50000000e-01,
+            2.50000000e-01,   5.00000000e-01,   2.50000000e-01]]), 'FE0_C0': array([[  1.82237253e-17,  -2.50000000e-01,  -2.50000000e-01,
+            2.50000000e-01,   2.50000000e-01,   5.00000000e-01]]), 'FE0_C2_D010': array([[  1.00000000e+00,   3.33066907e-16,   2.10713328e-16,
+           -1.00000000e+00,   1.00000000e+00,   3.88578059e-16]]), 'FE0_C2_D100': array([[  1.14017661e-16,   1.00000000e+00,  -1.71026492e-16,
+           -1.00000000e+00,   5.32082420e-16,   1.00000000e+00]]), 'FE0_C1_D001': array([[ -1.00000000e+00,   4.10367360e-16,   1.66533454e-16,
+            1.00000000e+00,  -1.00000000e+00,   4.99600361e-16]]), 'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
-           0.25,  0.25,  0.25]]), 'FE0_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE0_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE0_C1_D100': array([[ -3.04047097e-16,  -1.90029436e-17,   1.00000000e+00,
+            1.52023549e-16,  -1.00000000e+00,   1.00000000e+00]]), 'FE0_C0_D100': array([[  1.60341042e-31,  -3.79213356e-16,  -5.82117938e-16,
+            3.79213356e-16,   5.82117938e-16,  -9.61331293e-16]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C0_D001': array([[  4.12500768e-16,  -1.00000000e+00,  -2.77555756e-16,
+            1.00000000e+00,   4.44089210e-16,  -1.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D001': array([[  4.12500768e-16,  -1.00000000e+00,  -2.77555756e-16,
-            1.00000000e+00,   4.44089210e-16,  -1.00000000e+00]]), 'FE1_C0': array([[  1.82237253e-17,  -2.50000000e-01,  -2.50000000e-01,
-            2.50000000e-01,   2.50000000e-01,   5.00000000e-01]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0_D100': array([[  1.60341042e-31,  -3.79213356e-16,  -5.82117938e-16,
-            3.79213356e-16,   5.82117938e-16,  -9.61331293e-16]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ -3.04047097e-16,  -1.90029436e-17,   1.00000000e+00,
-            1.52023549e-16,  -1.00000000e+00,   1.00000000e+00]]), 'FE1_C2_D100': array([[  1.14017661e-16,   1.00000000e+00,  -1.71026492e-16,
-           -1.00000000e+00,   5.32082420e-16,   1.00000000e+00]]), 'FE1_C1': array([[ -2.50000000e-01,   7.25571004e-17,   2.50000000e-01,
-            2.50000000e-01,   5.00000000e-01,   2.50000000e-01]]), 'FE1_C1_D001': array([[ -1.00000000e+00,   4.10367360e-16,   1.66533454e-16,
-            1.00000000e+00,  -1.00000000e+00,   4.99600361e-16]]), 'FE1_C2': array([[  2.50000000e-01,   2.50000000e-01,   4.85670141e-17,
-            5.00000000e-01,   2.50000000e-01,   2.50000000e-01]])}
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
+           0.25,  0.25,  0.25]])}
   
-  name_map: {'FE1_C0_D100': ['FE1_C1_D010', 'FE1_C2_D001']}
+  name_map: {'FE0_C0_D100': ['FE0_C1_D010', 'FE0_C2_D001']}
   
-  inv_name_map: {'FE0_C2_D001': 'FE0_C2_D001', 'FE0_C1_D010': 'FE0_C1_D010', 'FE1_C0_D010': 'FE1_C0_D010', 'FE1_C2_D010': 'FE1_C2_D010', 'FE0_C0_D010': 'FE0_C0_D010', 'FE1_C1_D010': 'FE1_C0_D100', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0', 'FE0_C2_D010': 'FE0_C2_D010', 'FE0_C2_D100': 'FE0_C2_D100', 'FE0_C1_D001': 'FE0_C1_D001', 'FE1_C0_D001': 'FE1_C0_D001', 'FE1_C0': 'FE1_C0', 'FE0_C1_D100': 'FE0_C1_D100', 'FE0_C0_D100': 'FE0_C0_D100', 'FE1_C0_D100': 'FE1_C0_D100', 'FE1_ [...]
+  inv_name_map: {'FE0_C2_D001': 'FE0_C0_D100', 'FE0_C1_D010': 'FE0_C0_D100', 'FE1_C0_D010': 'FE1_C0_D010', 'FE1_C2_D010': 'FE1_C2_D010', 'FE0_C0_D010': 'FE0_C0_D010', 'FE1_C1_D010': 'FE1_C1_D010', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0', 'FE0_C2_D010': 'FE0_C2_D010', 'FE0_C2_D100': 'FE0_C2_D100', 'FE0_C1_D001': 'FE0_C1_D001', 'FE1_C0_D001': 'FE1_C0_D001', 'FE1_C0': 'FE1_C0', 'FE0_C1_D100': 'FE0_C1_D100', 'FE0_C0_D100': 'FE0_C0_D100', 'FE1_C0_D100': 'FE1_C0_D100', 'FE1_ [...]
   
   QG-utils, psi_tables, unique_tables:
-  {'FE0_C0': array([[ 0.25,  0.25,  0.25,  0.25]]), 'FE1_C0_D001': array([[-1.,  1., -1.]]), 'FE1_C0': array([[-0.25, -0.25,  0.25,  0.25,  0.5 ]]), 'FE1_C0_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D001': array([[-1.,  1.]]), 'FE1_C1_D100': array([[ 1., -1.,  1.]]), 'FE1_C1': array([[-0.25,  0.25,  0.25,  0.5 ,  0.25]]), 'FE1_C2': array([[ 0.25,  0.25,  0.5 ,  0.25,  0.25]])}
+  {'FE0_C2': array([[ 0.25,  0.25,  0.5 ,  0.25,  0.25]]), 'FE0_C1': array([[-0.25,  0.25,  0.25,  0.5 ,  0.25]]), 'FE0_C0': array([[-0.25, -0.25,  0.25,  0.25,  0.5 ]]), 'FE1_C0_D001': array([[-1.,  1.]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25]]), 'FE0_C1_D100': array([[ 1., -1.,  1.]]), 'FE0_C0_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D001': array([[-1.,  1., -1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C2_D001': ('FE0_C0_D001', (9, [8, 11]), False, False), 'FE0_C1_D010': ('FE0_C0_D001', (6, [4, 6]), False, False), 'FE1_C0_D010': ('FE1_C0_D001', (14, [2, 4, 5]), False, False), 'FE1_C2_D010': ('FE1_C1_D100', (19, [0, 3, 4]), False, False), 'FE0_C0_D010': ('FE0_C0_D001', (2, [0, 2]), False, False), 'FE1_C1_D010': ('FE1_C0_D100', (), True, False), 'FE0_C2': ('FE0_C0', (8, [8, 9, 10, 11]), False, False), 'FE0_C1': ('FE0_C0', (4, [4, 5, 6, 7]), False, False), 'FE0_C0': ('FE0_C0', (0, [...]
+  {'FE0_C2_D001': ('FE0_C0_D100', (), True, False), 'FE0_C1_D010': ('FE0_C0_D100', (), True, False), 'FE1_C0_D010': ('FE1_C0_D001', (11, [0, 2]), False, False), 'FE1_C2_D010': ('FE1_C0_D001', (19, [8, 10]), False, False), 'FE0_C0_D010': ('FE0_C0_D001', (2, [2, 4, 5]), False, False), 'FE1_C1_D010': ('FE1_C0_D001', (15, [4, 6]), False, False), 'FE0_C2': ('FE0_C2', (6, [0, 1, 3, 4, 5]), False, False), 'FE0_C1': ('FE0_C1', (3, [0, 2, 3, 4, 5]), False, False), 'FE0_C0': ('FE0_C0', (0, [1, 2,  [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -1184,7 +934,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  648 entries computed in 0.00156 seconds
+  648 entries computed in 0.0016 seconds
   Shape of reference tensor: (6, 3, 12, 3)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 3 dims = [3, 12, 3] indices = [[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 1, 0], [0, 1, 1], [0, 1, 2], [0, 2, 0], [0, 2, 1], [0, 2, 2], [0, 3, 0], [0, 3, 1], [0, 3, 2], [0, 4, 0], [0, 4, 1], [0, 4, 2], [0, 5, 0], [0, 5, 1], [0, 5, 2], [0, 6, 0], [0, 6, 1], [0, 6, 2], [0, 7, 0], [0, 7, 1], [0, 7, 2], [0, 8, 0], [0, 8, 1], [0, 8, 2], [0, 9, 0], [0, 9, 1], [0, 9, 2], [0, 10, 0], [0, 10, 1], [0, 10, 2], [0, 11, 0], [0, 11, 1], [0, 11, 2], [1, 0, 0], [1, 0, 1], [1, 0 [...]
@@ -1195,13 +945,13 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.068836 seconds.
+Compiler stage 2 finished in 0.14319 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.064759 seconds.
+Compiler stage 3 finished in 0.112505 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
@@ -1210,443 +960,180 @@ Compiler stage 4: Generating code
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: area
@@ -1663,18 +1150,102 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.458061 seconds.
+Compiler stage 4 finished in 0.527659 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000632048 seconds.
+Compiler stage 4.1 finished in 0.00155997 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
+Compiler stage 5 finished in 0.0012219 seconds.
+
+FFC finished in 1.05681 seconds.
 Output written to ./EddyCurrents.h.
-Compiler stage 5 finished in 0.00102019 seconds.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
+
+Compiling element P1Space
+
+Compiler stage 1: Analyzing elements(s)
+---------------------------------------
+  
+Compiler stage 1 finished in 0.000283003 seconds.
+
+Compiler stage 2: Computing intermediate representation
+-------------------------------------------------------
+  Computing representation of 1 elements
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 0 coordinate mappings
+  Computing representation of integrals
+  Computing representation of forms
+  
+Compiler stage 2 finished in 0.0772159 seconds.
+
+Compiler stage 3: Optimizing intermediate representation
+--------------------------------------------------------
+  
+Compiler stage 3 finished in 0.000174999 seconds.
+
+Compiler stage 4: Generating code
+---------------------------------
+  Generating code for 1 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 1 dofmap(s)
+  Generating code for 0 coordinate_mapping(s)
+  Generating code for integrals
+  Generating code for forms
+  
+Compiler stage 4 finished in 0.0963581 seconds.
+
+Compiler stage 4.1: Generating additional wrapper code
+------------------------------------------------------
+  Generating wrapper code for DOLFIN
+  
+Compiler stage 4.1 finished in 0.000289917 seconds.
+
+Compiler stage 5: Formatting code
+---------------------------------
+  
+Compiler stage 5 finished in 0.000469208 seconds.
 
-FFC finished in 0.696825 seconds.
+FFC finished in 0.175229 seconds.
+Output written to ./P1Space.h.
diff --git a/demo/undocumented/curl-curl/cpp/main.cpp b/demo/undocumented/curl-curl/cpp/main.cpp
index 99413d5..b9a9973 100644
--- a/demo/undocumented/curl-curl/cpp/main.cpp
+++ b/demo/undocumented/curl-curl/cpp/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 Bartosz Sawicki
+// Copyright (C) 2009-2015 Bartosz Sawicki, Stefano Zampini and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -15,11 +15,8 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// First added:  2009-03-30
-// Last changed: 2014-08-11
-//
-// Eddy currents phenomena in low conducting body can be
-// described using electric vector potential and curl-curl operator:
+// Eddy currents phenomena in low conducting body can be described
+// using electric vector potential and curl-curl operator:
 //
 //    \nabla \times \nabla \times T = - \frac{\partial B}{\partial t}
 //
@@ -30,87 +27,124 @@
 // Boundary condition
 //
 //    J_n = 0,
-//    T_t=T_w=0, \frac{\partial T_n}{\partial n} = 0
-// which is naturaly fulfilled for zero Dirichlet BC with Nedelec (edge)
-// elements.
+//    T_t = T_w = 0, \frac{\partial T_n}{\partial n} = 0
+//
+// which is naturaly fulfilled for zero Dirichlet BC with Nedelec
+// (edge) elements.
+//
+// This demo uses the auxiliary space Maxwell AMG preconditioner from
+// Hypre, via PETSc. It therefore requires PETSc, configured with
+// Hypre.
 
 #include <dolfin.h>
 #include "EddyCurrents.h"
 #include "CurrentDensity.h"
+#include "P1Space.h"
 
 using namespace dolfin;
 
+#if defined(HAS_PETSC) and defined(PETSC_HAVE_HYPRE)
+
 int main()
 {
-  // Homogenous external magnetic field (dB/dt)
-  class Source : public Expression
-  {
-  public:
-
-    Source() : Expression(3) {}
-
-    void eval(Array<double>& values, const Array<double>& x) const
-    {
-      values[0] = 0.0;
-      values[1] = 0.0;
-      values[2] = 1.0;
-    }
-
-  };
+  // Set PETSc as default linear algebra backend
+  parameters["linear_algebra_backend"] = "PETSc";
 
-  // Zero Dirichlet BC
-  class Zero : public Expression
-  {
-  public:
-
-    Zero() : Expression(3) {}
-
-    void eval(Array<double>& values, const Array<double>& x) const
-    {
-      values[0] = 0.0;
-      values[1] = 0.0;
-      values[2] = 0.0;
-    }
-
-  };
-
-  // Everywhere on external surface
+  // Everywhere on exterior surface
   class DirichletBoundary: public SubDomain
   {
     bool inside(const Array<double>& x, bool on_boundary) const
     { return on_boundary; }
   };
 
-  // Load sphere mesh
-  Mesh mesh("../sphere.xml.gz");
+  // Load sphere mesh and refine uniformly
+  auto mesh = std::make_shared<Mesh>("../sphere.xml.gz");
+  mesh = std::make_shared<Mesh>(refine(*mesh));
+
+  // Homogeneous external magnetic field (dB/dt)
+  auto dbdt = std::make_shared<Constant>(0.0, 0.0, 1.0);
 
-  // Define functions
-  Source dbdt;
-  Zero zero;
+  // Dirichlet boundary condition
+  auto zero = std::make_shared<Constant>(0.0, 0.0, 0.0);
 
   // Define function space and boundary condition
-  EddyCurrents::FunctionSpace V(mesh);
-  DirichletBoundary boundary;
-  DirichletBC bc(V, zero, boundary);
+  auto V = std::make_shared<EddyCurrents::FunctionSpace>(mesh);
+  auto boundary = std::make_shared<DirichletBoundary>();
+  auto bc = std::make_shared<DirichletBC>(V, zero, boundary);
 
   // Define variational problem for T
-  EddyCurrents::BilinearForm a(V,V);
+  EddyCurrents::BilinearForm a(V, V);
   EddyCurrents::LinearForm L(V);
   L.dbdt = dbdt;
 
-  // Compute solution
-  Function T(V);
-  solve(a == L, T, bc);
+  // Solution function
+  auto T = std::make_shared<Function>(V);
+
+  // Assemble system
+  auto A = std::make_shared<PETScMatrix>();
+  PETScVector b;
+  assemble_system(*A, b, a, L, {bc});
+
+  // Create PETSc Krylov solver
+  PETScKrylovSolver solver("cg");
+
+  // Get pointer to PETSc KSP object and set tolerances
+  KSP ksp = solver.ksp();
+  KSPSetTolerances(ksp, 1.0e-8, 1.0e-12, 1.0e10, 1000);
+
+  // Set preconditioner to AMS from HYPRE
+  PC pc;
+  KSPGetPC(ksp, &pc);
+  PCSetType(pc, PCHYPRE);
+  PCHYPRESetType(pc, "ams");
+
+  // Build discrete gradient operator and attach to preconditioner
+  P1Space::FunctionSpace P1(mesh);
+  auto G = DiscreteOperators::build_gradient(*V, P1);
+  PCHYPRESetDiscreteGradient(pc, as_type<PETScMatrix>(*G).mat());
+
+  // Inform preconditioner of constants in the Nedelec space
+  std::vector<Function> constants(3, Function(V));
+  constants[0] = Constant(1.0, 0.0, 0.0);
+  constants[1] = Constant(0.0, 1.0, 0.0);
+  constants[2] = Constant(0.0, 0.0, 1.0);
+
+  PCHYPRESetEdgeConstantVectors(pc,
+               as_type<PETScVector>(*constants[0].vector()).vec(),
+               as_type<PETScVector>(*constants[1].vector()).vec(),
+               as_type<PETScVector>(*constants[2].vector()).vec());
+
+  // We are dealing with a zero conductivity problem (no mass term),
+  // so we need to tell the preconditioner
+  PCHYPRESetBetaPoissonMatrix(pc, NULL);
+
+  // Set PETSc operators
+  solver.set_operator(A);
+
+  // Set PETSc Krylov prefix solver and set some options
+  KSPSetOptionsPrefix(ksp, "eddy_");
+  PETScOptions::set("eddy_ksp_monitor_true_residual");
+  PETScOptions::set("eddy_ksp_view");
+  KSPSetFromOptions(ksp);
+
+  // Solve system
+  KSPSolve(ksp, b.vec(), as_type<PETScVector>(*T->vector()).vec());
+
+  // Update ghost values in solution vector
+  T->vector()->apply("insert");
 
   // Define variational problem for J
-  CurrentDensity::FunctionSpace V1(mesh);
+  auto V1 = std::make_shared<CurrentDensity::FunctionSpace>(mesh);
   CurrentDensity::BilinearForm a1(V1,V1);
   CurrentDensity::LinearForm L1(V1);
   L1.T = T;
 
-  // Solve problem using default solver
+  // Solve problem using an iterative linear solver
   Function J(V1);
-  solve(a1 == L1, J);
+  Parameters p;
+  p.add("linear_solver", "cg");
+  p.add("symmetric", true);
+  solve(a1 == L1, J, p);
 
   File file("current_density.pvd");
   file << J;
@@ -121,3 +155,13 @@ int main()
 
   return 0;
 }
+
+#else
+
+int main()
+{
+  info("This demo requires DOLFIN to be configured with PETSc (with Hypre).");
+  return 0;
+}
+
+#endif
diff --git a/demo/undocumented/curl-curl/python/demo_curl-curl.py b/demo/undocumented/curl-curl/python/demo_curl-curl.py
index 143db8c..f20f38e 100644
--- a/demo/undocumented/curl-curl/python/demo_curl-curl.py
+++ b/demo/undocumented/curl-curl/python/demo_curl-curl.py
@@ -11,14 +11,18 @@ Boundary condition:
 
    J_n = 0,
 
-   T_t=T_w=0, \frac{\partial T_n}{\partial n} = 0
+   T_t = T_w = 0, \frac{\partial T_n}{\partial n} = 0
 
-which is naturaly fulfilled for zero Dirichlet BC with Nedelec (edge)
+which is naturally fulfilled for zero Dirichlet BC with Nedelec (edge)
 elements.
 
+This demo uses the auxiliary Maxwell space multigrid preconditioner
+from HYPRE (via PETSc). To run this demo, PETSc must be configured
+with HYPRE, and petsc4py must be available.
+
 """
 
-# Copyright (C) 2009 Bartosz Sawicki
+# Copyright (C) 2009-2015 Bartosz Sawicki and Garth N. Wells
 #
 # This file is part of DOLFIN.
 #
@@ -39,24 +43,48 @@ elements.
 
 from dolfin import *
 
+# Check that DOLFIN has been configured with PETSc
+if not has_petsc():
+    print("This demo requires DOLFIN to be configured with PETSc.")
+    exit()
+
+# Check that PETSc has been configured with HYPRE
+if not "hypre_amg" in PETScPreconditioner.preconditioners():
+    print("This demo requires PETSc to be configured with HYPRE.")
+    exit()
+
+if not has_petsc4py():
+    print("DOLFIN has not been compiled with petsc4py support.")
+    exit()
+
+# Import petsc4py and check that HYPRE bindings are available
+from petsc4py import *
+try:
+    getattr(PETSc.PC, 'getHYPREType')
+except AttributeError:
+    print("This demo requires a recent petsc4py with HYPRE bindings.")
+    exit()
+
+# Set PETSc as default linear algebra backend
+parameters["linear_algebra_backend"] = "PETSc";
+
 # Load sphere mesh
 mesh = Mesh("../sphere.xml.gz")
+mesh = refine(mesh)
 
 # Define function spaces
-P1 = VectorFunctionSpace(mesh, "CG", 1)
-PN = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
+V = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
 
 # Define test and trial functions
-v0 = TestFunction(PN)
-u0 = TrialFunction(PN)
-v1 = TestFunction(P1)
-u1 = TrialFunction(P1)
+v = TestFunction(V)
+u = TrialFunction(V)
 
-# Define functions
-dbdt = Expression(("0.0", "0.0", "1.0"), degree=1)
-zero = Expression(("0.0", "0.0", "0.0"), degree=1)
-T = Function(PN)
-J = Function(P1)
+# Define functions for boundary condiitons
+dbdt = Constant((0.0, 0.0, 1.0))
+zero = Constant((0.0, 0.0, 0.0))
+
+# Magnetic field (to be computed)
+T = Function(V)
 
 # Dirichlet boundary
 class DirichletBoundary(SubDomain):
@@ -64,19 +92,80 @@ class DirichletBoundary(SubDomain):
         return on_boundary
 
 # Boundary condition
-bc = DirichletBC(PN, zero, DirichletBoundary())
+bc = DirichletBC(V, zero, DirichletBoundary())
+
+# Forms for the eddy-current equation
+a = inner(curl(v), curl(u))*dx
+L = -inner(v, dbdt)*dx
+
+# Assemble system
+A, b = assemble_system(a, L, bc)
+
+# Create PETSc Krylov solver (from petsc4py)
+ksp = PETSc.KSP()
+ksp.create(PETSc.COMM_WORLD)
+
+# Set the Krylov solver type and set tolerances
+ksp.setType("cg")
+ksp.setTolerances(rtol=1.0e-8, atol=1.0e-12, divtol=1.0e10, max_it=300)
+
+# Get the preconditioner and set type (HYPRE AMS)
+pc = ksp.getPC()
+pc.setType("hypre")
+pc.setHYPREType("ams")
+
+# Build discrete gradient
+P1 = FunctionSpace(mesh, "Lagrange", 1)
+G = DiscreteOperators.build_gradient(V, P1)
+
+# Attach discrete gradient to preconditioner
+pc.setHYPREDiscreteGradient(as_backend_type(G).mat())
+
+# Build constants basis for the Nedelec space
+constants = [Function(V) for i in range(3)]
+for i, c in enumerate(constants):
+    direction = [1.0 if i == j else 0.0 for j in range(3)]
+    c.interpolate(Constant(direction))
+
+# Inform preconditioner of constants in the Nedelec space
+cvecs = [as_backend_type(constant.vector()).vec() for constant in constants]
+pc.setHYPRESetEdgeConstantVectors(cvecs[0], cvecs[1], cvecs[2])
+
+# We are dealing with a zero conductivity problem (no mass term), so
+# we need to tell the preconditioner
+pc.setHYPRESetBetaPoissonMatrix(None)
+
+# Set operator for the linear solver
+ksp.setOperators(as_backend_type(A).mat())
+
+# Set options prefix
+ksp.setOptionsPrefix("eddy_")
+
+# Turn on monitoring of residual
+opts = PETSc.Options()
+opts.setValue("-eddy_ksp_monitor_true_residual", None)
 
 # Solve eddy currents equation (using potential T)
-solve(inner(curl(v0), curl(u0))*dx == -inner(v0, dbdt)*dx, T, bc)
+ksp.setFromOptions()
+ksp.solve(as_backend_type(b).vec(), as_backend_type(T.vector()).vec())
 
-# Solve density equation
-solve(inner(v1, u1)*dx == dot(v1, curl(T))*dx, J)
+# Show linear solver details
+ksp.view()
 
-# Plot solution
-plot(J)
+# Test and trial functions for density equation
+W = VectorFunctionSpace(mesh, "Lagrange", 1)
+v = TestFunction(W)
+u = TrialFunction(W)
 
-file=File("current_density.pvd")
+# Solve density equation (use conjugate gradient linear solver)
+J = Function(W)
+solve(inner(v, u)*dx == dot(v, curl(T))*dx, J,
+      solver_parameters={"linear_solver": "cg"} )
+
+# Write solution to PVD/ParaView file
+file = File("current_density.pvd")
 file << J
 
-# Hold plot
+# Plot solution and hold plot
+plot(J)
 interactive()
diff --git a/demo/undocumented/dg-advection-diffusion/cpp/AdvectionDiffusion.h b/demo/undocumented/dg-advection-diffusion/cpp/AdvectionDiffusion.h
index 30d80dc..4a11839 100644
--- a/demo/undocumented/dg-advection-diffusion/cpp/AdvectionDiffusion.h
+++ b/demo/undocumented/dg-advection-diffusion/cpp/AdvectionDiffusion.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,388 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __ADVECTIONDIFFUSION_H
 #define __ADVECTIONDIFFUSION_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class advectiondiffusion_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   advectiondiffusion_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_finite_element_0()
+  ~advectiondiffusion_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new advectiondiffusion_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class advectiondiffusion_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  advectiondiffusion_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~advectiondiffusion_finite_element_1()
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
+    return 1;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t degree() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 6;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -403,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -634,20 +352,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -656,26 +372,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -695,7 +409,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -707,7 +421,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -716,8 +430,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -815,7 +529,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -966,7 +680,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1117,7 +831,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1268,7 +982,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1419,7 +1133,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1570,7 +1284,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1682,28 +1396,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1739,7 +1451,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1747,22 +1459,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1773,48 +1483,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1824,50 +1534,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1875,98 +1583,110 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new advectiondiffusion_finite_element_1();
+    return new advectiondiffusion_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class advectiondiffusion_finite_element_2: public ufc::finite_element
+class advectiondiffusion_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  advectiondiffusion_finite_element_2() : ufc::finite_element()
+  advectiondiffusion_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_finite_element_2()
+  ~advectiondiffusion_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1980,16 +1700,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1998,8 +1732,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2446,20 +2180,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2468,7 +2200,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -2476,21 +2208,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2510,7 +2240,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2522,7 +2252,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2531,8 +2261,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2630,7 +2360,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2781,7 +2511,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2932,7 +2662,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3083,7 +2813,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3234,7 +2964,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3385,7 +3115,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3536,7 +3266,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3687,7 +3417,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3838,7 +3568,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3989,7 +3719,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4140,7 +3870,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4291,7 +4021,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4403,28 +4133,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4460,7 +4188,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -4468,22 +4196,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -4494,96 +4220,96 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -4593,74 +4319,72 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4672,41 +4396,52 @@ public:
     vertex_values[5] = dof_values[8];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new advectiondiffusion_finite_element_1();
+        return new advectiondiffusion_finite_element_0();
         break;
       }
     case 1:
       {
-        return new advectiondiffusion_finite_element_1();
+        return new advectiondiffusion_finite_element_0();
         break;
       }
     }
@@ -4714,100 +4449,118 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new advectiondiffusion_finite_element_2();
+    return new advectiondiffusion_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class advectiondiffusion_finite_element_3: public ufc::finite_element
+class advectiondiffusion_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  advectiondiffusion_finite_element_3() : ufc::finite_element()
+  advectiondiffusion_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_finite_element_3()
+  ~advectiondiffusion_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
+  std::size_t value_size() const final override
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
     *values = 0.0;
     switch (i)
     {
@@ -4899,20 +4652,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -4921,26 +4672,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -4960,7 +4709,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4972,7 +4721,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4981,8 +4730,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -5434,28 +5183,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5491,7 +5238,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -5499,22 +5246,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -5525,24 +5270,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -5552,38 +5297,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -5591,141 +5334,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new advectiondiffusion_finite_element_3();
+    return new advectiondiffusion_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class advectiondiffusion_dofmap_0: public ufc::dofmap
+class advectiondiffusion_finite_element_3: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  advectiondiffusion_dofmap_0() : ufc::dofmap()
+  advectiondiffusion_finite_element_3() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_dofmap_0()
+  ~advectiondiffusion_finite_element_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 6;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 0;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 1;
+        return 2;
         break;
       }
     }
@@ -5733,185 +5421,3167 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = 0;
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new advectiondiffusion_dofmap_0();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class advectiondiffusion_dofmap_1: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  advectiondiffusion_dofmap_1() : ufc::dofmap()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_dofmap_1()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * family() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "Lagrange";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    switch (d)
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
     {
     case 0:
       {
-        return true;
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     case 1:
       {
-        return true;
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     case 2:
       {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0] + num_global_entities[1];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new advectiondiffusion_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new advectiondiffusion_finite_element_2();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new advectiondiffusion_finite_element_3();
+  }
+
+};
+
+
+class advectiondiffusion_finite_element_4: public ufc::finite_element
+{
+public:
+
+  advectiondiffusion_finite_element_4() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~advectiondiffusion_finite_element_4() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Real', triangle, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Real";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new advectiondiffusion_finite_element_4();
+  }
+
+};
+
+
+class advectiondiffusion_finite_element_5: public ufc::finite_element
+{
+public:
+
+  advectiondiffusion_finite_element_5() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~advectiondiffusion_finite_element_5() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', triangle, 1)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new advectiondiffusion_finite_element_5();
+  }
+
+};
+
+
+class advectiondiffusion_dofmap_0: public ufc::dofmap
+{
+public:
+
+  advectiondiffusion_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~advectiondiffusion_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return true;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0] + num_global_entities[1];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 1;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 4;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 5;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new advectiondiffusion_dofmap_0();
+  }
+
+};
+
+
+class advectiondiffusion_dofmap_1: public ufc::dofmap
+{
+public:
+
+  advectiondiffusion_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~advectiondiffusion_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return true;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0] + 2*num_global_entities[1];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 2;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
+      dofs[5] = 11;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 6;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 7;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 8;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 9;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+        dofs[1] = 10;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+        dofs[1] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new advectiondiffusion_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new advectiondiffusion_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new advectiondiffusion_dofmap_1();
+  }
+
+};
+
+
+class advectiondiffusion_dofmap_2: public ufc::dofmap
+{
+public:
+
+  advectiondiffusion_dofmap_2() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~advectiondiffusion_dofmap_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -5922,7 +8592,7 @@ public:
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -5935,25 +8605,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -5961,30 +8623,26 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
-      dofs[2] = 3;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 4;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 5;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6023,6 +8681,185 @@ public:
       }
     case 1:
       {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new advectiondiffusion_dofmap_2();
+  }
+
+};
+
+
+class advectiondiffusion_dofmap_3: public ufc::dofmap
+{
+public:
+
+  advectiondiffusion_dofmap_3() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~advectiondiffusion_dofmap_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
         if (i > 2)
       {
       throw std::runtime_error("i is larger than number of entities (2)");
@@ -6032,23 +8869,31 @@ public:
       {
       case 0:
         {
-          dofs[0] = 3;
+          dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
-          dofs[0] = 4;
+          dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
-          dofs[0] = 5;
+          dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
       
         break;
       }
+    case 1:
+      {
+        
+        break;
+      }
     case 2:
       {
         
@@ -6058,82 +8903,70 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new advectiondiffusion_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new advectiondiffusion_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new advectiondiffusion_dofmap_1();
+    return new advectiondiffusion_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class advectiondiffusion_dofmap_2: public ufc::dofmap
+class advectiondiffusion_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  advectiondiffusion_dofmap_2() : ufc::dofmap()
+  advectiondiffusion_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_dofmap_2()
+  ~advectiondiffusion_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for FiniteElement('Real', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -6146,55 +8979,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2*num_global_entities[0] + 2*num_global_entities[1];
+    return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 0;
         break;
       }
     case 1:
       {
-        return 2;
+        return 0;
         break;
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -6202,73 +9024,39 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
+    dofs[0] = 0;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6279,166 +9067,67 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 6;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 7;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 8;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 9;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-        dofs[1] = 10;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-        dofs[1] = 11;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new advectiondiffusion_dofmap_1();
-        break;
-      }
-    case 1:
-      {
-        return new advectiondiffusion_dofmap_1();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new advectiondiffusion_dofmap_2();
+    return new advectiondiffusion_dofmap_4();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class advectiondiffusion_dofmap_3: public ufc::dofmap
+class advectiondiffusion_dofmap_5: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  advectiondiffusion_dofmap_3() : ufc::dofmap()
+  advectiondiffusion_dofmap_5() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_dofmap_3()
+  ~advectiondiffusion_dofmap_5() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6462,39 +9151,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6518,19 +9196,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 3*c.entity_indices[2][0];
-    dofs[1] = 3*c.entity_indices[2][0] + 1;
-    dofs[2] = 3*c.entity_indices[2][0] + 2;
+    dofs[0] = 3*entity_indices[2][0];
+    dofs[1] = 3*entity_indices[2][0] + 1;
+    dofs[2] = 3*entity_indices[2][0] + 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6553,9 +9229,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -6590,70 +9265,49 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new advectiondiffusion_dofmap_3();
+    return new advectiondiffusion_dofmap_5();
   }
 
 };
 
-/// 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 advectiondiffusion_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   advectiondiffusion_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_cell_integral_0_otherwise()
+  ~advectiondiffusion_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    46
@@ -6662,7 +9316,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6716,43 +9370,36 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class advectiondiffusion_exterior_facet_integral_0_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   advectiondiffusion_exterior_facet_integral_0_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_exterior_facet_integral_0_otherwise()
+  ~advectiondiffusion_exterior_facet_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6767,12 +9414,12 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates[2*facet] - vertex_coordinates[2*v0]) - dx0*(vertex_coordinates[2*facet + 1] - vertex_coordinates[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs[2*facet] - coordinate_dofs[2*v0]) - dx0*(coordinate_dofs[2*facet + 1] - coordinate_dofs[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n0 = direction ? dx1 / det : -dx1 / det;
     const double n1 = direction ? -dx0 / det : dx0 / det;
@@ -6962,46 +9609,39 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// interior facet tensor corresponding to the local contribution to
-/// a form from the integral over an interior facet.
 
 class advectiondiffusion_interior_facet_integral_0_otherwise: public ufc::interior_facet_integral
 {
 public:
 
-  /// Constructor
   advectiondiffusion_interior_facet_integral_0_otherwise() : ufc::interior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_interior_facet_integral_0_otherwise()
+  ~advectiondiffusion_interior_facet_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local interior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates_0,
-                               const double*  vertex_coordinates_1,
-                               std::size_t facet_0,
-                               std::size_t facet_1,
-                               int cell_orientation_0,
-                               int cell_orientation_1) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs_0,
+                       const double * coordinate_dofs_1,
+                       std::size_t facet_0,
+                       std::size_t facet_1,
+                       int cell_orientation_0,
+                       int cell_orientation_1) const final override
   {
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -7010,7 +9650,7 @@ public:
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -7025,12 +9665,12 @@ public:
     const unsigned int v1 = edge_vertices[facet_0][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates_0[2*v1 + 0] - vertex_coordinates_0[2*v0 + 0];
-    const double dx1 = vertex_coordinates_0[2*v1 + 1] - vertex_coordinates_0[2*v0 + 1];
+    const double dx0 = coordinate_dofs_0[2*v1 + 0] - coordinate_dofs_0[2*v0 + 0];
+    const double dx1 = coordinate_dofs_0[2*v1 + 1] - coordinate_dofs_0[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates_0[2*facet_0] - vertex_coordinates_0[2*v0]) - dx0*(vertex_coordinates_0[2*facet_0 + 1] - vertex_coordinates_0[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs_0[2*facet_0] - coordinate_dofs_0[2*v0]) - dx0*(coordinate_dofs_0[2*facet_0 + 1] - coordinate_dofs_0[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n_00 = direction ? dx1 / det : -dx1 / det;
     const double n_01 = direction ? -dx0 / det : dx0 / det;// Compute facet normals from the facet scale factor constants
@@ -7044,12 +9684,12 @@ public:
     
     
     // Compute circumradius of triangle in 2D
-    const double v1v2_0  = std::sqrt((vertex_coordinates_0[4] - vertex_coordinates_0[2])*(vertex_coordinates_0[4] - vertex_coordinates_0[2]) + (vertex_coordinates_0[5] - vertex_coordinates_0[3])*(vertex_coordinates_0[5] - vertex_coordinates_0[3]) );
+    const double v1v2_0  = std::sqrt((coordinate_dofs_0[4] - coordinate_dofs_0[2])*(coordinate_dofs_0[4] - coordinate_dofs_0[2]) + (coordinate_dofs_0[5] - coordinate_dofs_0[3])*(coordinate_dofs_0[5] - coordinate_dofs_0[3]) );
     const double v0v2_0  = std::sqrt(J_0[3]*J_0[3] + J_0[1]*J_0[1]);
     const double v0v1_0  = std::sqrt(J_0[0]*J_0[0] + J_0[2]*J_0[2]);
     const double circumradius_0 = 0.25*(v1v2_0*v0v2_0*v0v1_0)/(volume_0);
     // Compute circumradius of triangle in 2D
-    const double v1v2_1  = std::sqrt((vertex_coordinates_1[4] - vertex_coordinates_1[2])*(vertex_coordinates_1[4] - vertex_coordinates_1[2]) + (vertex_coordinates_1[5] - vertex_coordinates_1[3])*(vertex_coordinates_1[5] - vertex_coordinates_1[3]) );
+    const double v1v2_1  = std::sqrt((coordinate_dofs_1[4] - coordinate_dofs_1[2])*(coordinate_dofs_1[4] - coordinate_dofs_1[2]) + (coordinate_dofs_1[5] - coordinate_dofs_1[3])*(coordinate_dofs_1[5] - coordinate_dofs_1[3]) );
     const double v0v2_1  = std::sqrt(J_1[3]*J_1[3] + J_1[1]*J_1[1]);
     const double v0v1_1  = std::sqrt(J_1[0]*J_1[0] + J_1[2]*J_1[2]);
     const double circumradius_1 = 0.25*(v1v2_1*v0v2_1*v0v1_1)/(volume_1);
@@ -7085,7 +9725,7 @@ public:
     // Array of non-zero columns
     static const unsigned int nzc2[2] = {0, 1};
     
-    static const double FE2_f0_C0[3][3] = \
+    static const double FE3_f0_C0[3][3] = \
     {{0.687298334620742, -0.0872983346207417, 0.4},
     {0.0, 0.0, 1.0},
     {-0.0872983346207416, 0.687298334620742, 0.4}};
@@ -7158,10 +9798,10 @@ public:
           // Total number of operations to compute function values = 24
           for (unsigned int r = 0; r < 3; r++)
           {
-            F0 += FE2_f0_C0[ip][r]*w[0][nzc15[r] + 12];
-            F1 += FE2_f0_C0[ip][r]*w[0][nzc16[r] + 12];
-            F2 += FE2_f0_C0[ip][r]*w[0][nzc15[r]];
-            F3 += FE2_f0_C0[ip][r]*w[0][nzc16[r]];
+            F0 += FE3_f0_C0[ip][r]*w[0][nzc15[r] + 12];
+            F1 += FE3_f0_C0[ip][r]*w[0][nzc16[r] + 12];
+            F2 += FE3_f0_C0[ip][r]*w[0][nzc15[r]];
+            F3 += FE3_f0_C0[ip][r]*w[0][nzc16[r]];
           } // end loop over 'r'
           
           // Number of operations to compute ip constants: 52
@@ -7271,10 +9911,10 @@ public:
           // Total number of operations to compute function values = 24
           for (unsigned int r = 0; r < 3; r++)
           {
-            F0 += FE2_f0_C0[ip][r]*w[0][nzc17[r] + 12];
-            F1 += FE2_f0_C0[ip][r]*w[0][nzc18[r] + 12];
-            F2 += FE2_f0_C0[ip][r]*w[0][nzc15[r]];
-            F3 += FE2_f0_C0[ip][r]*w[0][nzc16[r]];
+            F0 += FE3_f0_C0[ip][r]*w[0][nzc17[r] + 12];
+            F1 += FE3_f0_C0[ip][r]*w[0][nzc18[r] + 12];
+            F2 += FE3_f0_C0[ip][r]*w[0][nzc15[r]];
+            F3 += FE3_f0_C0[ip][r]*w[0][nzc16[r]];
           } // end loop over 'r'
           
           // Number of operations to compute ip constants: 52
@@ -7384,10 +10024,10 @@ public:
           // Total number of operations to compute function values = 24
           for (unsigned int r = 0; r < 3; r++)
           {
-            F0 += FE2_f0_C0[ip][r]*w[0][nzc19[r] + 12];
-            F1 += FE2_f0_C0[ip][r]*w[0][nzc20[r] + 12];
-            F2 += FE2_f0_C0[ip][r]*w[0][nzc15[r]];
-            F3 += FE2_f0_C0[ip][r]*w[0][nzc16[r]];
+            F0 += FE3_f0_C0[ip][r]*w[0][nzc19[r] + 12];
+            F1 += FE3_f0_C0[ip][r]*w[0][nzc20[r] + 12];
+            F2 += FE3_f0_C0[ip][r]*w[0][nzc15[r]];
+            F3 += FE3_f0_C0[ip][r]*w[0][nzc16[r]];
           } // end loop over 'r'
           
           // Number of operations to compute ip constants: 52
@@ -7505,10 +10145,10 @@ public:
           // Total number of operations to compute function values = 24
           for (unsigned int r = 0; r < 3; r++)
           {
-            F0 += FE2_f0_C0[ip][r]*w[0][nzc15[r] + 12];
-            F1 += FE2_f0_C0[ip][r]*w[0][nzc16[r] + 12];
-            F2 += FE2_f0_C0[ip][r]*w[0][nzc17[r]];
-            F3 += FE2_f0_C0[ip][r]*w[0][nzc18[r]];
+            F0 += FE3_f0_C0[ip][r]*w[0][nzc15[r] + 12];
+            F1 += FE3_f0_C0[ip][r]*w[0][nzc16[r] + 12];
+            F2 += FE3_f0_C0[ip][r]*w[0][nzc17[r]];
+            F3 += FE3_f0_C0[ip][r]*w[0][nzc18[r]];
           } // end loop over 'r'
           
           // Number of operations to compute ip constants: 52
@@ -7618,10 +10258,10 @@ public:
           // Total number of operations to compute function values = 24
           for (unsigned int r = 0; r < 3; r++)
           {
-            F0 += FE2_f0_C0[ip][r]*w[0][nzc17[r] + 12];
-            F1 += FE2_f0_C0[ip][r]*w[0][nzc18[r] + 12];
-            F2 += FE2_f0_C0[ip][r]*w[0][nzc17[r]];
-            F3 += FE2_f0_C0[ip][r]*w[0][nzc18[r]];
+            F0 += FE3_f0_C0[ip][r]*w[0][nzc17[r] + 12];
+            F1 += FE3_f0_C0[ip][r]*w[0][nzc18[r] + 12];
+            F2 += FE3_f0_C0[ip][r]*w[0][nzc17[r]];
+            F3 += FE3_f0_C0[ip][r]*w[0][nzc18[r]];
           } // end loop over 'r'
           
           // Number of operations to compute ip constants: 52
@@ -7731,10 +10371,10 @@ public:
           // Total number of operations to compute function values = 24
           for (unsigned int r = 0; r < 3; r++)
           {
-            F0 += FE2_f0_C0[ip][r]*w[0][nzc19[r] + 12];
-            F1 += FE2_f0_C0[ip][r]*w[0][nzc20[r] + 12];
-            F2 += FE2_f0_C0[ip][r]*w[0][nzc17[r]];
-            F3 += FE2_f0_C0[ip][r]*w[0][nzc18[r]];
+            F0 += FE3_f0_C0[ip][r]*w[0][nzc19[r] + 12];
+            F1 += FE3_f0_C0[ip][r]*w[0][nzc20[r] + 12];
+            F2 += FE3_f0_C0[ip][r]*w[0][nzc17[r]];
+            F3 += FE3_f0_C0[ip][r]*w[0][nzc18[r]];
           } // end loop over 'r'
           
           // Number of operations to compute ip constants: 52
@@ -7852,10 +10492,10 @@ public:
           // Total number of operations to compute function values = 24
           for (unsigned int r = 0; r < 3; r++)
           {
-            F0 += FE2_f0_C0[ip][r]*w[0][nzc15[r] + 12];
-            F1 += FE2_f0_C0[ip][r]*w[0][nzc16[r] + 12];
-            F2 += FE2_f0_C0[ip][r]*w[0][nzc19[r]];
-            F3 += FE2_f0_C0[ip][r]*w[0][nzc20[r]];
+            F0 += FE3_f0_C0[ip][r]*w[0][nzc15[r] + 12];
+            F1 += FE3_f0_C0[ip][r]*w[0][nzc16[r] + 12];
+            F2 += FE3_f0_C0[ip][r]*w[0][nzc19[r]];
+            F3 += FE3_f0_C0[ip][r]*w[0][nzc20[r]];
           } // end loop over 'r'
           
           // Number of operations to compute ip constants: 52
@@ -7965,10 +10605,10 @@ public:
           // Total number of operations to compute function values = 24
           for (unsigned int r = 0; r < 3; r++)
           {
-            F0 += FE2_f0_C0[ip][r]*w[0][nzc17[r] + 12];
-            F1 += FE2_f0_C0[ip][r]*w[0][nzc18[r] + 12];
-            F2 += FE2_f0_C0[ip][r]*w[0][nzc19[r]];
-            F3 += FE2_f0_C0[ip][r]*w[0][nzc20[r]];
+            F0 += FE3_f0_C0[ip][r]*w[0][nzc17[r] + 12];
+            F1 += FE3_f0_C0[ip][r]*w[0][nzc18[r] + 12];
+            F2 += FE3_f0_C0[ip][r]*w[0][nzc19[r]];
+            F3 += FE3_f0_C0[ip][r]*w[0][nzc20[r]];
           } // end loop over 'r'
           
           // Number of operations to compute ip constants: 52
@@ -8078,10 +10718,10 @@ public:
           // Total number of operations to compute function values = 24
           for (unsigned int r = 0; r < 3; r++)
           {
-            F0 += FE2_f0_C0[ip][r]*w[0][nzc19[r] + 12];
-            F1 += FE2_f0_C0[ip][r]*w[0][nzc20[r] + 12];
-            F2 += FE2_f0_C0[ip][r]*w[0][nzc19[r]];
-            F3 += FE2_f0_C0[ip][r]*w[0][nzc20[r]];
+            F0 += FE3_f0_C0[ip][r]*w[0][nzc19[r] + 12];
+            F1 += FE3_f0_C0[ip][r]*w[0][nzc20[r] + 12];
+            F2 += FE3_f0_C0[ip][r]*w[0][nzc19[r]];
+            F3 += FE3_f0_C0[ip][r]*w[0][nzc20[r]];
           } // end loop over 'r'
           
           // Number of operations to compute ip constants: 52
@@ -8183,38 +10823,31 @@ public:
 
 };
 
-/// 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 advectiondiffusion_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   advectiondiffusion_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_cell_integral_1_otherwise()
+  ~advectiondiffusion_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -8223,7 +10856,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -8246,92 +10879,84 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class advectiondiffusion_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   advectiondiffusion_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_form_0()
+  ~advectiondiffusion_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "16ea9851ff99742a26cb414d9c23d34b5d8aa53807b892a2d00b4aa8f83f21cc34a472161f32edcb1e9602edd7893ed7ac624e9fb46ae3bb998d2f8c29835156";
+    return "62ea3c85b579f5f9f120b5e6e5440e7119a70180bfdea737b7cdfc1f140ece8a17316114775be1a337b408f0551cd1ae21798703b36b8a214a23198341e0713d";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 3;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new advectiondiffusion_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new advectiondiffusion_dofmap_3();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new advectiondiffusion_finite_element_3();
+        return new advectiondiffusion_finite_element_5();
         break;
       }
     case 1:
       {
-        return new advectiondiffusion_finite_element_3();
+        return new advectiondiffusion_finite_element_5();
         break;
       }
     case 2:
       {
-        return new advectiondiffusion_finite_element_2();
+        return new advectiondiffusion_finite_element_1();
         break;
       }
     case 3:
       {
-        return new advectiondiffusion_finite_element_0();
+        return new advectiondiffusion_finite_element_4();
         break;
       }
     case 4:
       {
-        return new advectiondiffusion_finite_element_0();
+        return new advectiondiffusion_finite_element_4();
         break;
       }
     }
@@ -8339,34 +10964,33 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new advectiondiffusion_dofmap_3();
+        return new advectiondiffusion_dofmap_5();
         break;
       }
     case 1:
       {
-        return new advectiondiffusion_dofmap_3();
+        return new advectiondiffusion_dofmap_5();
         break;
       }
     case 2:
       {
-        return new advectiondiffusion_dofmap_2();
+        return new advectiondiffusion_dofmap_1();
         break;
       }
     case 3:
       {
-        return new advectiondiffusion_dofmap_0();
+        return new advectiondiffusion_dofmap_4();
         break;
       }
     case 4:
       {
-        return new advectiondiffusion_dofmap_0();
+        return new advectiondiffusion_dofmap_4();
         break;
       }
     }
@@ -8374,203 +10998,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new advectiondiffusion_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new advectiondiffusion_exterior_facet_integral_0_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return new advectiondiffusion_interior_facet_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class advectiondiffusion_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   advectiondiffusion_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~advectiondiffusion_form_1()
+  ~advectiondiffusion_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "5eab01fc063c5071b91c1e35bfd0b0a8fe3d04557c9b94cbc6b2c7fac0018bc78fc4b49548f220f55ed511117ecf4a2e53a319bc96afeb8ef02fdc5e43ba4c54";
+    return "a5685cebbf2179f82e890dd848a7d6184c3c39730dda36b2cf942b3f5b35220a91fb3494af8ceefd5447c07505ea953768566d866e7c216276db254711fcdbb2";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new advectiondiffusion_finite_element_3();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new advectiondiffusion_dofmap_3();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new advectiondiffusion_finite_element_3();
+        return new advectiondiffusion_finite_element_5();
         break;
       }
     case 1:
       {
-        return new advectiondiffusion_finite_element_3();
+        return new advectiondiffusion_finite_element_5();
         break;
       }
     }
@@ -8578,19 +11230,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new advectiondiffusion_dofmap_3();
+        return new advectiondiffusion_dofmap_5();
         break;
       }
     case 1:
       {
-        return new advectiondiffusion_dofmap_3();
+        return new advectiondiffusion_dofmap_5();
         break;
       }
     }
@@ -8598,126 +11249,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_overlap_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new advectiondiffusion_cell_integral_1_otherwise();
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new advectiondiffusion_cell_integral_1_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -8731,14 +11418,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace AdvectionDiffusion
 {
@@ -8747,43 +11440,20 @@ class CoefficientSpace_alpha: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_alpha(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_alpha(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_alpha(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_alpha(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8794,43 +11464,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_5>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_5>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8841,43 +11488,20 @@ class CoefficientSpace_kappa: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_kappa(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_kappa(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_kappa(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_kappa(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8888,43 +11512,20 @@ class CoefficientSpace_u: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8935,43 +11536,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_5>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_5>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8982,45 +11560,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_5>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_5>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -9036,83 +11631,130 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 3), u(*this, 0), kappa(*this, 1), alpha(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
+    _ufc_form = std::make_shared<const advectiondiffusion_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& kappa, const dolfin::GenericFunction& alpha):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> kappa, std::shared_ptr<const dolfin::GenericFunction> alpha):
     dolfin::Form(2, 3), u(*this, 0), kappa(*this, 1), alpha(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->u = u;
     this->kappa = kappa;
     this->alpha = alpha;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
+    _ufc_form = std::make_shared<const advectiondiffusion_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> kappa, std::shared_ptr<const dolfin::GenericFunction> alpha):
-    dolfin::Form(2, 3), u(*this, 0), kappa(*this, 1), alpha(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_a()
+  {}
 
-    this->u = *u;
-    this->kappa = *kappa;
-    this->alpha = *alpha;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "u")
+      return 0;
+    else if (name == "kappa")
+      return 1;
+    else if (name == "alpha")
+      return 2;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 3), u(*this, 0), kappa(*this, 1), alpha(*this, 2)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "u";
+    case 1:
+      return "kappa";
+    case 2:
+      return "alpha";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_u;
+  typedef Form_a_FunctionSpace_3 CoefficientSpace_kappa;
+  typedef Form_a_FunctionSpace_4 CoefficientSpace_alpha;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+  dolfin::CoefficientAssigner kappa;
+  dolfin::CoefficientAssigner alpha;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u, const dolfin::GenericFunction& kappa, const dolfin::GenericFunction& alpha):
-    dolfin::Form(2, 3), u(*this, 0), kappa(*this, 1), alpha(*this, 2)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), kappa(*this, 1), alpha(*this, 2)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->u = u;
-    this->kappa = kappa;
-    this->alpha = alpha;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> kappa, std::shared_ptr<const dolfin::GenericFunction> alpha):
-    dolfin::Form(2, 3), u(*this, 0), kappa(*this, 1), alpha(*this, 2)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u, std::shared_ptr<const dolfin::GenericFunction> kappa, std::shared_ptr<const dolfin::GenericFunction> alpha):
+    dolfin::MultiMeshForm(V1, V0), u(*this, 0), kappa(*this, 1), alpha(*this, 2)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->u = *u;
-    this->kappa = *kappa;
-    this->alpha = *alpha;
+    /// Assign coefficients
+    this->u = u;
+    this->kappa = kappa;
+    this->alpha = alpha;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -9153,59 +11795,58 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_u;
   typedef Form_a_FunctionSpace_3 CoefficientSpace_kappa;
   typedef Form_a_FunctionSpace_4 CoefficientSpace_alpha;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
-  dolfin::CoefficientAssigner kappa;
-  dolfin::CoefficientAssigner alpha;
+  dolfin::MultiMeshCoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner kappa;
+  dolfin::MultiMeshCoefficientAssigner alpha;
 };
 
 class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_5>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<advectiondiffusion_finite_element_5>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<advectiondiffusion_dofmap_5>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new advectiondiffusion_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new advectiondiffusion_dofmap_3()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -9217,69 +11858,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
+    _ufc_form = std::make_shared<const advectiondiffusion_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
+    _ufc_form = std::make_shared<const advectiondiffusion_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new advectiondiffusion_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -9311,18 +11993,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/dg-advection-diffusion/cpp/CMakeLists.txt b/demo/undocumented/dg-advection-diffusion/cpp/CMakeLists.txt
index 517c226..c419f5c 100644
--- a/demo/undocumented/dg-advection-diffusion/cpp/CMakeLists.txt
+++ b/demo/undocumented/dg-advection-diffusion/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/dg-advection-diffusion/cpp/Projection.h b/demo/undocumented/dg-advection-diffusion/cpp/Projection.h
index 777af96..e711ae3 100644
--- a/demo/undocumented/dg-advection-diffusion/cpp/Projection.h
+++ b/demo/undocumented/dg-advection-diffusion/cpp/Projection.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __PROJECTION_H
 #define __PROJECTION_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class projection_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   projection_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_finite_element_0()
+  ~projection_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,112 +902,141 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new projection_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class projection_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   projection_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_finite_element_1()
+  ~projection_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1013,15 +1045,16 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Reset values
-    *values = 0.0;
+    values[0] = 0.0;
+    values[1] = 0.0;
     switch (i)
     {
     case 0:
@@ -1048,7 +1081,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1076,7 +1109,7 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1104,7 +1137,91 @@ public:
       // Compute value(s)
       for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1112,48 +1229,47 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
+    double dof_values[2] = {0.0, 0.0};
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1165,7 +1281,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -1173,7 +1289,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1185,7 +1301,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1194,8 +1310,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1643,236 +1759,1770 @@ public:
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 3:
       {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new projection_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new projection_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new projection_finite_element_1();
+  }
+
+};
+
+
+class projection_finite_element_2: public ufc::finite_element
+{
+public:
+
+  projection_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~projection_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', triangle, 1)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new projection_finite_element_2();
+  }
+
+};
+
+
+class projection_dofmap_0: public ufc::dofmap
+{
+public:
+
+  projection_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~projection_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new projection_finite_element_1();
+    return new projection_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class projection_dofmap_0: public ufc::dofmap
+class projection_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  projection_dofmap_0() : ufc::dofmap()
+  projection_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_dofmap_0()
+  ~projection_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -1882,7 +3532,7 @@ public:
       }
     case 2:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -1890,45 +3540,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3*num_global_entities[2];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 2;
         break;
       }
     case 1:
@@ -1938,7 +3577,7 @@ public:
       }
     case 2:
       {
-        return 3;
+        return 0;
         break;
       }
     }
@@ -1946,44 +3585,56 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 3*c.entity_indices[2][0];
-    dofs[1] = 3*c.entity_indices[2][0] + 1;
-    dofs[2] = 3*c.entity_indices[2][0] + 2;
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -1994,7 +3645,33 @@ public:
     {
     case 0:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -2004,85 +3681,72 @@ public:
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new projection_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new projection_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new projection_dofmap_0();
+    return new projection_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class projection_dofmap_1: public ufc::dofmap
+class projection_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  projection_dofmap_1() : ufc::dofmap()
+  projection_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_dofmap_1()
+  ~projection_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -2092,7 +3756,7 @@ public:
       }
     case 2:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -2100,45 +3764,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 3*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 0;
         break;
       }
     case 1:
@@ -2148,7 +3801,7 @@ public:
       }
     case 2:
       {
-        return 0;
+        return 3;
         break;
       }
     }
@@ -2156,47 +3809,41 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = 3*entity_indices[2][0];
+    dofs[1] = 3*entity_indices[2][0] + 1;
+    dofs[2] = 3*entity_indices[2][0] + 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2207,30 +3854,7 @@ public:
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -2240,77 +3864,63 @@ public:
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new projection_dofmap_1();
+    return new projection_dofmap_2();
   }
 
 };
 
-/// 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 projection_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   projection_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~projection_cell_integral_0_otherwise()
+  ~projection_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    0
@@ -2319,7 +3929,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2346,38 +3956,31 @@ public:
 
 };
 
-/// 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 projection_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   projection_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~projection_cell_integral_1_otherwise()
+  ~projection_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -2386,7 +3989,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2409,77 +4012,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class projection_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   projection_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_form_0()
+  ~projection_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "52c8d096982a23a3bfc03f770ad68d237051e53889ec0254487f23fab5e3e4a95d618a5af0af524a61c2d495c8239e10d342691867a7dbec485ae128076e58e8";
+    return "ea8284e00827ee6f2efce3a3a357d76fa7efd777c89e134c1afd80eaa2c6c3fe1ab84efde4a0624488e0de44e821f0c62066757672d48b1703871602704038bb";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new projection_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new projection_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new projection_finite_element_1();
+        return new projection_finite_element_0();
         break;
       }
     case 1:
       {
-        return new projection_finite_element_1();
+        return new projection_finite_element_0();
         break;
       }
     }
@@ -2487,19 +4082,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new projection_dofmap_1();
+        return new projection_dofmap_0();
         break;
       }
     case 1:
       {
-        return new projection_dofmap_1();
+        return new projection_dofmap_0();
         break;
       }
     }
@@ -2507,203 +4101,231 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new projection_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class projection_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   projection_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_form_1()
+  ~projection_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "0e564b69dcd38cbe2a90b2a8ec3dc54ef0a474e176dd2f6b69af4b0af90d32165e09e193483f1b5aa93e90de8cc6718a4335762d5eb5bb8490c83af83028d9ce";
+    return "9bd9610daa49feafd37b5109a39bfe17938fefcd0ea0c9c305a88dfd90668354b2491067490ca425184b70ec64890edbec074c830759616cd2b9def785978c70";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new projection_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new projection_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new projection_finite_element_1();
+        return new projection_finite_element_0();
         break;
       }
     case 1:
       {
-        return new projection_finite_element_0();
+        return new projection_finite_element_2();
         break;
       }
     }
@@ -2711,19 +4333,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new projection_dofmap_1();
+        return new projection_dofmap_0();
         break;
       }
     case 1:
       {
-        return new projection_dofmap_0();
+        return new projection_dofmap_2();
         break;
       }
     }
@@ -2731,126 +4352,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new projection_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -2864,14 +4521,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Projection
 {
@@ -2880,43 +4543,20 @@ class CoefficientSpace_phi0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_phi0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_phi0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_phi0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_phi0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2927,43 +4567,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2974,63 +4591,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -3038,7 +4662,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_0());
+    _ufc_form = std::make_shared<const projection_form_0>();
   }
 
   // Destructor
@@ -3068,57 +4692,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_phi0 Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -3126,69 +4805,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), phi0(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
+    _ufc_form = std::make_shared<const projection_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& phi0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> phi0):
     dolfin::Form(1, 1), phi0(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->phi0 = phi0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
+    _ufc_form = std::make_shared<const projection_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> phi0):
-    dolfin::Form(1, 1), phi0(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->phi0 = *phi0;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "phi0")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), phi0(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "phi0";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_phi0;
+
+  // Coefficients
+  dolfin::CoefficientAssigner phi0;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& phi0):
-    dolfin::Form(1, 1), phi0(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), phi0(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->phi0 = phi0;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> phi0):
-    dolfin::Form(1, 1), phi0(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> phi0):
+    dolfin::MultiMeshForm(V0), phi0(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->phi0 = *phi0;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->phi0 = phi0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -3220,18 +4940,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_phi0;
 
   // Coefficients
-  dolfin::CoefficientAssigner phi0;
+  dolfin::MultiMeshCoefficientAssigner phi0;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/dg-advection-diffusion/cpp/Velocity.h b/demo/undocumented/dg-advection-diffusion/cpp/Velocity.h
index bb1bfdb..cadd365 100644
--- a/demo/undocumented/dg-advection-diffusion/cpp/Velocity.h
+++ b/demo/undocumented/dg-advection-diffusion/cpp/Velocity.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __VELOCITY_H
 #define __VELOCITY_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class velocity_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   velocity_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_finite_element_0()
+  ~velocity_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -339,20 +352,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -361,26 +372,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,7 +409,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -412,7 +421,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,8 +430,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -520,7 +529,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -671,7 +680,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -822,7 +831,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -973,7 +982,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1124,7 +1133,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +1284,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1387,28 +1396,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1444,7 +1451,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1452,22 +1459,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1478,48 +1483,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1529,50 +1534,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1580,98 +1583,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new velocity_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class velocity_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   velocity_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_finite_element_1()
+  ~velocity_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1685,16 +1676,54 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1703,8 +1732,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2151,20 +2180,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2173,7 +2200,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -2181,21 +2208,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2215,7 +2240,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2227,7 +2252,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2236,8 +2261,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2335,7 +2360,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2486,7 +2511,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2637,7 +2662,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2788,7 +2813,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2939,7 +2964,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3090,7 +3115,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3241,7 +3266,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3392,7 +3417,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3543,7 +3568,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3694,7 +3719,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3845,7 +3870,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3996,7 +4021,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4108,28 +4133,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4165,7 +4188,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -4173,22 +4196,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -4199,96 +4220,96 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -4298,74 +4319,72 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4377,30 +4396,41 @@ public:
     vertex_values[5] = dof_values[8];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -4419,41 +4449,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new velocity_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class velocity_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   velocity_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_dofmap_0()
+  ~velocity_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4477,39 +4500,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4533,25 +4545,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4580,9 +4590,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4656,71 +4665,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new velocity_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class velocity_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   velocity_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_dofmap_1()
+  ~velocity_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4744,39 +4727,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4800,33 +4772,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4864,9 +4834,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4946,44 +4915,13 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5002,8 +4940,7 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new velocity_dofmap_1();
   }
@@ -5017,14 +4954,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Velocity
 {
@@ -5033,43 +4976,20 @@ class FunctionSpace: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<velocity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<velocity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
diff --git a/demo/undocumented/dg-advection-diffusion/cpp/compile.log b/demo/undocumented/dg-advection-diffusion/cpp/compile.log
index d906443..d3f63d5 100644
--- a/demo/undocumented/dg-advection-diffusion/cpp/compile.log
+++ b/demo/undocumented/dg-advection-diffusion/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Projection
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 0
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -30,30 +31,39 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG1(?), DG1(?)'
-  Unique sub elements:       'CG1(?), DG1(?)'
+  Unique elements:           'CG1(?), DG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), DG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.043828 seconds.
+Compiler stage 1 finished in 0.105609 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 2 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 2 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -62,7 +72,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000586 seconds
+  9 entries computed in 0.000776 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -70,6 +80,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 0 dims = [] indices = [[]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -78,7 +89,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  9 entries computed in 0.000774 seconds
+  9 entries computed in 0.0012 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -87,142 +98,97 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00559402 seconds.
+Compiler stage 2 finished in 0.0122631 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000141859 seconds.
+Compiler stage 3 finished in 0.000249147 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 2 element(s)
+  Generating code for 3 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 2 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.059468 seconds.
+Compiler stage 4 finished in 0.227631 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000641108 seconds.
+Compiler stage 4.1 finished in 0.000816107 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Projection.h.
-Compiler stage 5 finished in 0.000678778 seconds.
+Compiler stage 5 finished in 0.000735044 seconds.
 
-FFC finished in 0.110672 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.347793 seconds.
+Output written to ./Projection.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling element Velocity
 
-Compiler stage 1: Analyzing form(s)
------------------------------------
+Compiler stage 1: Analyzing elements(s)
+---------------------------------------
   
-Compiler stage 1 finished in 0.000217199 seconds.
+Compiler stage 1 finished in 0.000303984 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -231,259 +197,48 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 2 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 0 coordinate mappings
   Computing representation of integrals
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0696592 seconds.
+Compiler stage 2 finished in 0.203056 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000143051 seconds.
+Compiler stage 3 finished in 0.000339031 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 2 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 2 dofmap(s)
+  Generating code for 0 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.216438 seconds.
+Compiler stage 4 finished in 0.354416 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000236034 seconds.
+Compiler stage 4.1 finished in 0.000307083 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Velocity.h.
-Compiler stage 5 finished in 0.000793219 seconds.
+Compiler stage 5 finished in 0.000663042 seconds.
 
-FFC finished in 0.287818 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.559677 seconds.
+Output written to ./Velocity.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form AdvectionDiffusion
 
@@ -498,8 +253,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0, v_1)'
   Number of coefficients:              3
   Coefficients:                        '[w_0, w_2, w_3]'
-  Unique elements:                     'DG1(?), Vector<2 x CG2(?)>, R0(?)'
-  Unique sub elements:                 'DG1(?), Vector<2 x CG2(?)>, R0(?), CG2(?)'
+  Unique elements:                     'DG1(?), Vector<2 x CG2(?)>, R0(?), Vector<2 
+                                       x CG1(?)>'
+  Unique sub elements:                 'DG1(?), Vector<2 x CG2(?)>, R0(?), Vector<2 
+                                       x CG1(?)>, CG2(?), CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -511,23 +268,23 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 3
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -535,8 +292,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_1]'
-  Unique elements:           'DG1(?)'
-  Unique sub elements:       'DG1(?)'
+  Unique elements:           'DG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'DG1(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -544,15 +301,21 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.138532 seconds.
+Compiler stage 1 finished in 0.268126 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 6 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -561,11 +324,19 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 6 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -581,7 +352,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  432 entries computed in 0.0016 seconds
+  432 entries computed in 0.00185 seconds
   Shape of reference tensor: (3, 3, 12, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 3 dims = [12, 2, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1], [2, 0, 0], [2, 0, 1], [2, 1, 0], [2, 1, 1], [3, 0, 0], [3, 0, 1], [3, 1, 0], [3, 1, 1], [4, 0, 0], [4, 0, 1], [4, 1, 0], [4, 1, 1], [5, 0, 0], [5, 0, 1], [5, 1, 0], [5, 1, 1], [6, 0, 0], [6, 0, 1], [6, 1, 0], [6, 1, 1], [7, 0, 0], [7, 0, 1], [7, 1, 0], [7, 1, 1], [8, 0, 0], [8, 0, 1], [8, 1, 0], [8, 1, 1], [9, 0, 0], [9, 0, 1], [9, 1, 0],  [...]
@@ -591,7 +362,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  36 entries computed in 0.0011 seconds
+  36 entries computed in 0.00157 seconds
   Shape of reference tensor: (3, 3, 2, 1, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 3 dims = [2, 1, 2] indices = [[0, 0, 0], [0, 0, 1], [1, 0, 0], [1, 0, 1]]
@@ -601,6 +372,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
@@ -610,15 +382,112 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 0): array([[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
-         [  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
-         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 1: {(0, 0): array([[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
-         [  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
-         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 2: {(0, 0): array([[ 0.88729833,  0.5       ,  0.11270167],
-         [ 0.11270167,  0.5       ,  0.88729833],
-         [ 0.        ,  0.        ,  0.        ]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2): {None: {0: {(0, 0): array([[[  1.12757026e-16,   4.16333634e-17,   4.16333634e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -4.85722573e-17,   1.38777878e-17,   5.55111512e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.12757026e-16,   4.16333634e-17,   4.16333634e-17]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -4.85722573e-17,   1.38777878e-17,   5.55111512e-17]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17]]])}, 1: {(0, 0): array([[[  6.87298335e-01,   8.32667268e-17,  -8.72983346e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  9.36750677e-17,   8.32667268e-17,   9.71445147e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -2.77555756e-17,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  6.87298335e-01,   8.32667268e-17,  -8.72983346e-02]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  9.36750677e-17,   8.32667268e-17,   9.71445147e-17]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -2.77555756e-17,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17]]])}, 2: {(0, 0): array([[[  6.87298335e-01,   4.16333634e-17,  -8.72983346e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -8.72983346e-02,   1.38777878e-17,   6.87298335e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -2.77555756e-17,  -5.55111512e-17,  -5.55111512e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  6.87298335e-01,   4.16333634e-17,  -8.72983346e-02]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -8.72983346e-02,   1.38777878e-17,   6.87298335e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -2.77555756e-17,  -5.55111512e-17,  -5.55111512e-17]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -762,109 +631,13 @@ Compiler stage 2: Computing intermediate representation
           [ 0.11270167,  0.5       ,  0.88729833]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None): {None: {0: {(0, 0): array([[[  1.12757026e-16,   4.16333634e-17,   4.16333634e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -4.85722573e-17,   1.38777878e-17,   5.55111512e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.12757026e-16,   4.16333634e-17,   4.16333634e-17]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -4.85722573e-17,   1.38777878e-17,   5.55111512e-17]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17]]])}, 1: {(0, 0): array([[[  6.87298335e-01,   8.32667268e-17,  -8.72983346e-02],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  9.36750677e-17,   8.32667268e-17,   9.71445147e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -2.77555756e-17,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  6.87298335e-01,   8.32667268e-17,  -8.72983346e-02]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  9.36750677e-17,   8.32667268e-17,   9.71445147e-17]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -2.77555756e-17,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17]]])}, 2: {(0, 0): array([[[  6.87298335e-01,   4.16333634e-17,  -8.72983346e-02],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -8.72983346e-02,   1.38777878e-17,   6.87298335e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -2.77555756e-17,  -5.55111512e-17,  -5.55111512e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  6.87298335e-01,   4.16333634e-17,  -8.72983346e-02]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -8.72983346e-02,   1.38777878e-17,   6.87298335e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -2.77555756e-17,  -5.55111512e-17,  -5.55111512e-17]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]]])}}}}}
+          [ 0.        ,  0.        ,  0.        ]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 1): {None: {0: {(0, 0): array([[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
+         [  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
+         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 1: {(0, 0): array([[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
+         [  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
+         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 2: {(0, 0): array([[ 0.88729833,  0.5       ,  0.11270167],
+         [ 0.11270167,  0.5       ,  0.88729833],
+         [ 0.        ,  0.        ,  0.        ]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
@@ -1198,27 +971,112 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {0: {(0, 0): array([[ 1.,  1.,  1.]])}, 1: {(0, 0): array([[ 1.,  1.,  1.]])}, 2: {(0, 0): array([[ 1.,  1.,  1.]])}}}, FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
-         [ 1.,  1.,  1.],
-         [ 0.,  0.,  0.]]), (0, 0): array([[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
-         [  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
-         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 1: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
-         [ 1.,  1.,  1.],
-         [ 0.,  0.,  0.]]), (0, 0): array([[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
-         [  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
-         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 2: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
-         [ 1.,  1.,  1.],
-         [ 0.,  0.,  0.]]), (0, 0): array([[ 0.88729833,  0.5       ,  0.11270167],
-         [ 0.11270167,  0.5       ,  0.88729833],
-         [ 0.        ,  0.        ,  0.        ]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2): {None: {0: {(0, 0): array([[[  1.12757026e-16,   4.16333634e-17,   4.16333634e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -4.85722573e-17,   1.38777878e-17,   5.55111512e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.12757026e-16,   4.16333634e-17,   4.16333634e-17]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -4.85722573e-17,   1.38777878e-17,   5.55111512e-17]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17]]])}, 1: {(0, 0): array([[[  6.87298335e-01,   8.32667268e-17,  -8.72983346e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  9.36750677e-17,   8.32667268e-17,   9.71445147e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -2.77555756e-17,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  6.87298335e-01,   8.32667268e-17,  -8.72983346e-02]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  9.36750677e-17,   8.32667268e-17,   9.71445147e-17]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -2.77555756e-17,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17]]])}, 2: {(0, 0): array([[[  6.87298335e-01,   4.16333634e-17,  -8.72983346e-02],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -8.72983346e-02,   1.38777878e-17,   6.87298335e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[ -2.77555756e-17,  -5.55111512e-17,  -5.55111512e-17],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  6.87298335e-01,   4.16333634e-17,  -8.72983346e-02]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -8.72983346e-02,   1.38777878e-17,   6.87298335e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -2.77555756e-17,  -5.55111512e-17,  -5.55111512e-17]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -1362,220 +1220,107 @@ Compiler stage 2: Computing intermediate representation
           [ 0.11270167,  0.5       ,  0.88729833]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ]]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None): {None: {0: {(0, 0): array([[[  1.12757026e-16,   4.16333634e-17,   4.16333634e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -4.85722573e-17,   1.38777878e-17,   5.55111512e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.12757026e-16,   4.16333634e-17,   4.16333634e-17]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -4.85722573e-17,   1.38777878e-17,   5.55111512e-17]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17]]])}, 1: {(0, 0): array([[[  6.87298335e-01,   8.32667268e-17,  -8.72983346e-02],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  9.36750677e-17,   8.32667268e-17,   9.71445147e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -2.77555756e-17,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  6.87298335e-01,   8.32667268e-17,  -8.72983346e-02]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  9.36750677e-17,   8.32667268e-17,   9.71445147e-17]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -2.77555756e-17,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.23165367e-16,   0.00000000e+00,  -6.93889390e-17]]])}, 2: {(0, 0): array([[[  6.87298335e-01,   4.16333634e-17,  -8.72983346e-02],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -8.72983346e-02,   1.38777878e-17,   6.87298335e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[ -2.77555756e-17,  -5.55111512e-17,  -5.55111512e-17],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  6.87298335e-01,   4.16333634e-17,  -8.72983346e-02]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -8.72983346e-02,   1.38777878e-17,   6.87298335e-01]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -2.77555756e-17,  -5.55111512e-17,  -5.55111512e-17]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01]]])}}}}}
+          [ 0.        ,  0.        ,  0.        ]]])}}}, FiniteElement('Real', triangle, 0): {None: {0: {(0, 0): array([[ 1.,  1.,  1.]])}, 1: {(0, 0): array([[ 1.,  1.,  1.]])}, 2: {(0, 0): array([[ 1.,  1.,  1.]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 1): {None: {0: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
+         [ 1.,  1.,  1.],
+         [ 0.,  0.,  0.]]), (0, 0): array([[  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
+         [  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
+         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 1: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
+         [ 1.,  1.,  1.],
+         [ 0.,  0.,  0.]]), (0, 0): array([[  8.87298335e-01,   5.00000000e-01,   1.12701665e-01],
+         [  2.77555756e-17,   4.16333634e-17,   5.55111512e-17],
+         [  1.12701665e-01,   5.00000000e-01,   8.87298335e-01]])}, 2: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1., -1.],
+         [ 1.,  1.,  1.],
+         [ 0.,  0.,  0.]]), (0, 0): array([[ 0.88729833,  0.5       ,  0.11270167],
+         [ 0.11270167,  0.5       ,  0.88729833],
+         [ 0.        ,  0.        ,  0.        ]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
+  {'FE2_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
          [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
          [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE0_f1': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
          [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE0_f2': array([[ 0.88729833,  0.11270167,  0.        ],
          [ 0.5       ,  0.5       ,  0.        ],
-         [ 0.11270167,  0.88729833,  0.        ]]), 'FE3_f2': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE1_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ 0.11270167,  0.88729833,  0.        ]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
-            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01]]), 'FE0_f1_D10': array([[-1.,  1.,  0.],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_f1_D10': array([[-1.,  1.,  0.],
          [-1.,  1.,  0.],
          [-1.,  1.,  0.]]), 'FE0_f2_D10': array([[-1.,  1.,  0.],
          [-1.,  1.,  0.],
-         [-1.,  1.,  0.]]), 'FE1_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
+         [-1.,  1.,  0.]]), 'FE2_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.5       ,  0.5       ,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.11270167,  0.88729833,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE1_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
-           0.        ]]), 'FE3_f1': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
-            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16],
+           0.        ]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
-            1.00000000e+00,   1.38777878e-17,   0.00000000e+00],
+            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17]]), 'FE2_f0_C0': array([[  1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
-            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
-            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f0_D10': array([[-1.,  1.,  0.],
-         [-1.,  1.,  0.],
-         [-1.,  1.,  0.]]), 'FE1_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
+            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17]]), 'FE3_f1_C0': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
+         [ -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
+            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE0_f2_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_f2_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_f0_D10': array([[-1.,  1.,  0.],
+         [-1.,  1.,  0.],
+         [-1.,  1.,  0.]]), 'FE2_f1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
          [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE2_f2_C0': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f2': array([[ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_f1': array([[ 1.],
+         [ 1.],
+         [ 1.]]), 'FE1_f0': array([[ 1.],
+         [ 1.],
+         [ 1.]]), 'FE3_f2_C0': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
             0.00000000e+00,  -2.77555756e-17,   4.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1586,50 +1331,79 @@ Compiler stage 2: Computing intermediate representation
          [ -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
             0.00000000e+00,  -5.55111512e-17,   4.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_f1_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_f0': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0_f0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f1_C0': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
-           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
-            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_f2_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
+           0.        ]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f1_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE0_f0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE3_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
-           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16],
+            6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
+            4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
-            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17]]), 'FE1_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+           -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01]]), 'FE2_f1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE1_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
+            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE3_f0_C0': array([[  1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
+            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
+         [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
+            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+         [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
+            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
+            1.00000000e+00,   1.38777878e-17,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17]])}
   
   tables: {'FE0_f0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
          [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
@@ -1637,71 +1411,58 @@ Compiler stage 2: Computing intermediate representation
          [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE0_f2': array([[ 0.88729833,  0.11270167,  0.        ],
          [ 0.5       ,  0.5       ,  0.        ],
-         [ 0.11270167,  0.88729833,  0.        ]]), 'FE1_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [ 0.11270167,  0.88729833,  0.        ]]), 'FE2_f0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
-            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
-            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01]]), 'FE1_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f2_C0': array([[ 0.88729833,  0.11270167,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.5       ,  0.5       ,  0.        ,  0.        ,  0.        ,
            0.        ],
          [ 0.11270167,  0.88729833,  0.        ,  0.        ,  0.        ,
-           0.        ]]), 'FE1_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
-           0.        ],
-         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
            0.        ]]), 'FE2_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE2_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
-            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16],
+            6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
-            1.00000000e+00,   1.38777878e-17,   0.00000000e+00],
+            8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17]]), 'FE2_f0_C0': array([[  1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
-            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
+           -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
+            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17]]), 'FE3_f1_C0': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
+           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
-            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
+         [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
-            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
+         [ -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
+            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_f0_D10': array([[-1.,  1.,  0.],
-         [-1.,  1.,  0.],
-         [-1.,  1.,  0.]]), 'FE1_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE1_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C0': array([[  2.77555756e-17,   8.87298335e-01,   1.12701665e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  4.16333634e-17,   5.00000000e-01,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
          [  5.55111512e-17,   1.12701665e-01,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            2.77555756e-17,   8.87298335e-01,   1.12701665e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            4.16333634e-17,   5.00000000e-01,   5.00000000e-01],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            5.55111512e-17,   1.12701665e-01,   8.87298335e-01]]), 'FE1_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f2_C0': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_f0_D10': array([[-1.,  1.,  0.],
+         [-1.,  1.,  0.],
+         [-1.,  1.,  0.]]), 'FE1_f0': array([[ 1.],
+         [ 1.],
+         [ 1.]]), 'FE3_f2_C0': array([[  6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
             0.00000000e+00,  -2.77555756e-17,   4.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
@@ -1712,66 +1473,79 @@ Compiler stage 2: Computing intermediate representation
          [ -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
             0.00000000e+00,  -5.55111512e-17,   4.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0': array([[ 1.],
-         [ 1.],
-         [ 1.]]), 'FE0_f0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE2_f2_C1': array([[ 0.        ,  0.        ,  0.        ,  0.88729833,  0.11270167,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.5       ,  0.5       ,
+           0.        ],
+         [ 0.        ,  0.        ,  0.        ,  0.11270167,  0.88729833,
+           0.        ]]), 'FE2_f0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_f0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE2_f1_C0': array([[  6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
-           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE3_f2_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
-            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            6.87298335e-01,   9.36750677e-17,  -8.72983346e-02,
-           -2.77555756e-17,   4.00000000e-01,  -1.23165367e-16],
+            6.87298335e-01,  -8.72983346e-02,   0.00000000e+00,
+            0.00000000e+00,  -2.77555756e-17,   4.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            8.32667268e-17,   8.32667268e-17,   8.32667268e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
+            4.16333634e-17,   1.38777878e-17,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -8.72983346e-02,   9.71445147e-17,   6.87298335e-01,
-            0.00000000e+00,   4.00000000e-01,  -6.93889390e-17]]), 'FE1_f0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+           -8.72983346e-02,   6.87298335e-01,   0.00000000e+00,
+            0.00000000e+00,  -5.55111512e-17,   4.00000000e-01]]), 'FE2_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_f1_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             8.87298335e-01,   2.77555756e-17,   1.12701665e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             5.00000000e-01,   4.16333634e-17,   5.00000000e-01],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE1_f1_C0': array([[  8.87298335e-01,   2.77555756e-17,   1.12701665e-01,
+            1.12701665e-01,   5.55111512e-17,   8.87298335e-01]]), 'FE3_f0_C0': array([[  1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
+            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  5.00000000e-01,   4.16333634e-17,   5.00000000e-01,
+         [  4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
+            1.00000000e+00,   1.38777878e-17,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [  1.12701665e-01,   5.55111512e-17,   8.87298335e-01,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+         [  4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE3_f0_C1': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.12757026e-16,   6.87298335e-01,  -8.72983346e-02,
+            4.00000000e-01,  -4.85722573e-17,  -1.23165367e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,  -9.71445147e-17,   8.32667268e-17,
+            1.00000000e+00,   1.38777878e-17,   0.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.16333634e-17,  -8.72983346e-02,   6.87298335e-01,
+            4.00000000e-01,   5.55111512e-17,  -6.93889390e-17]])}
   
-  name_map: {'FE3_f0': ['FE3_f1', 'FE3_f2'], 'FE0_f0_D01': ['FE0_f1_D01', 'FE0_f2_D01'], 'FE1_f0_C1_D01': ['FE1_f1_C1_D01', 'FE1_f2_C1_D01'], 'FE0_f0_D10': ['FE0_f1_D10', 'FE0_f2_D10'], 'FE1_f0_C1_D10': ['FE1_f1_C1_D10', 'FE1_f2_C1_D10'], 'FE1_f0_C0_D01': ['FE1_f1_C0_D01', 'FE1_f2_C0_D01'], 'FE1_f0_C0_D10': ['FE1_f1_C0_D10', 'FE1_f2_C0_D10']}
+  name_map: {'FE1_f0': ['FE1_f1', 'FE1_f2'], 'FE2_f0_C1_D10': ['FE2_f1_C1_D10', 'FE2_f2_C1_D10'], 'FE2_f0_C1_D01': ['FE2_f1_C1_D01', 'FE2_f2_C1_D01'], 'FE0_f0_D01': ['FE0_f1_D01', 'FE0_f2_D01'], 'FE0_f0_D10': ['FE0_f1_D10', 'FE0_f2_D10'], 'FE2_f0_C0_D10': ['FE2_f1_C0_D10', 'FE2_f2_C0_D10'], 'FE2_f0_C0_D01': ['FE2_f1_C0_D01', 'FE2_f2_C0_D01']}
   
-  inv_name_map: {'FE3_f1': 'FE3_f0', 'FE1_f1_C0_D10': 'FE1_f0_C0_D10', 'FE0_f2': 'FE0_f2', 'FE3_f2': 'FE3_f0', 'FE1_f0_C1_D01': 'FE1_f0_C1_D01', 'FE1_f2_C1_D01': 'FE1_f0_C1_D01', 'FE1_f1_C1_D10': 'FE1_f0_C1_D10', 'FE1_f2_C0_D10': 'FE1_f0_C0_D10', 'FE0_f1_D10': 'FE0_f0_D10', 'FE0_f2_D10': 'FE0_f0_D10', 'FE1_f2_C0': 'FE1_f2_C0', 'FE1_f2_C1': 'FE1_f2_C1', 'FE0_f0': 'FE0_f0', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0': 'FE2_f0_C0', 'FE1_f2_C0_D01': 'FE1_f0_C0_D01', 'FE0_f1': 'FE0_f1', 'FE0_f0_D10 [...]
+  inv_name_map: {'FE2_f1_C1_D01': 'FE2_f0_C1_D01', 'FE2_f2_C0_D10': 'FE2_f0_C0_D10', 'FE0_f0': 'FE0_f0', 'FE0_f1': 'FE0_f1', 'FE0_f2': 'FE0_f2', 'FE2_f0_C1_D01': 'FE2_f0_C1_D01', 'FE0_f1_D10': 'FE0_f0_D10', 'FE0_f2_D10': 'FE0_f0_D10', 'FE2_f0_C0_D10': 'FE2_f0_C0_D10', 'FE2_f0_C1': 'FE2_f0_C1', 'FE2_f0_C0_D01': 'FE2_f0_C0_D01', 'FE3_f1_C1': 'FE3_f1_C1', 'FE3_f1_C0': 'FE3_f1_C0', 'FE2_f0_C0': 'FE2_f0_C0', 'FE2_f2_C1_D01': 'FE2_f0_C1_D01', 'FE0_f0_D10': 'FE0_f0_D10', 'FE2_f1_C0_D10': 'FE2_f [...]
   
   QG-utils, psi_tables, unique_tables:
   {'FE0_f0': array([[ 0.88729833,  0.11270167],
          [ 0.5       ,  0.5       ],
-         [ 0.11270167,  0.88729833]]), 'FE2_f0_C0': array([[ 0.68729833, -0.08729833,  0.4       ],
-         [ 0.        ,  0.        ,  1.        ],
-         [-0.08729833,  0.68729833,  0.4       ]]), 'FE3_f0': array([[ 1.],
+         [ 0.11270167,  0.88729833]]), 'FE1_f0': array([[ 1.],
          [ 1.],
          [ 1.]]), 'FE0_f0_D01': array([[-1.,  1.],
          [-1.,  1.],
-         [-1.,  1.]])}
+         [-1.,  1.]]), 'FE3_f0_C0': array([[ 0.68729833, -0.08729833,  0.4       ],
+         [ 0.        ,  0.        ,  1.        ],
+         [-0.08729833,  0.68729833,  0.4       ]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE3_f1': ('FE3_f0', (), False, True), 'FE1_f1_C0_D10': ('FE0_f0_D01', (7, [0, 1]), False, False), 'FE0_f2': ('FE0_f0', (4, [0, 1]), False, False), 'FE3_f2': ('FE3_f0', (), False, True), 'FE1_f0_C1_D01': ('FE0_f0_D01', (9, [3, 5]), False, False), 'FE1_f2_C1_D01': ('FE0_f0_D01', (9, [3, 5]), False, False), 'FE1_f1_C1_D10': ('FE0_f0_D01', (10, [3, 4]), False, False), 'FE1_f2_C0_D10': ('FE0_f0_D01', (7, [0, 1]), False, False), 'FE0_f1_D10': ('FE0_f0_D01', (2, [0, 1]), False, False), 'FE0 [...]
+  {'FE2_f1_C1_D01': ('FE0_f0_D01', (9, [3, 5]), False, False), 'FE2_f2_C0_D10': ('FE0_f0_D01', (7, [0, 1]), False, False), 'FE0_f0': ('FE0_f0', (0, [1, 2]), False, False), 'FE0_f1': ('FE0_f0', (3, [0, 2]), False, False), 'FE0_f2': ('FE0_f0', (4, [0, 1]), False, False), 'FE2_f0_C1_D01': ('FE0_f0_D01', (9, [3, 5]), False, False), 'FE0_f1_D10': ('FE0_f0_D01', (2, [0, 1]), False, False), 'FE0_f2_D10': ('FE0_f0_D01', (2, [0, 1]), False, False), 'FE2_f0_C0_D10': ('FE0_f0_D01', (7, [0, 1]), Fal [...]
   Transforming interior facet integral (0, 0)
   Reusing element from cache
   Reusing element from cache
@@ -2512,7 +2286,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000606 seconds
+  9 entries computed in 0.000855 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -2520,9 +2294,10 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.305777 seconds.
+Compiler stage 2 finished in 0.535893 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
@@ -2539,289 +2314,68 @@ Compiler stage 3: Optimizing intermediate representation
   Optimising expressions for facet integral (2, 1)
   Optimising expressions for facet integral (2, 2)
   
-Compiler stage 3 finished in 0.0313461 seconds.
+Compiler stage 3 finished in 0.069833 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
+  Generating code for 6 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: Y
   Removing unused variable: X
   Removing unused variable: C1
   Removing unused variable: C0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Generating code for 6 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -2834,18 +2388,18 @@ Compiler stage 4: Generating code
   Removing unused variable: n_10
   Generating code for forms
   
-Compiler stage 4 finished in 0.256111 seconds.
+Compiler stage 4 finished in 0.475217 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000668049 seconds.
+Compiler stage 4.1 finished in 0.000929117 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./AdvectionDiffusion.h.
-Compiler stage 5 finished in 0.000981808 seconds.
+Compiler stage 5 finished in 0.00102401 seconds.
 
-FFC finished in 0.733751 seconds.
+FFC finished in 1.35152 seconds.
+Output written to ./AdvectionDiffusion.h.
diff --git a/demo/undocumented/dg-advection-diffusion/cpp/main.cpp b/demo/undocumented/dg-advection-diffusion/cpp/main.cpp
index d87a49d..8ee8195 100644
--- a/demo/undocumented/dg-advection-diffusion/cpp/main.cpp
+++ b/demo/undocumented/dg-advection-diffusion/cpp/main.cpp
@@ -59,25 +59,25 @@ int main(int argc, char *argv[])
   // mesh and a quadratic vector Lagrange element
 
   // Read mesh
-  Mesh mesh("../unitsquare_64_64.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../unitsquare_64_64.xml.gz");
 
   // Create velocity FunctionSpace
-  Velocity::FunctionSpace V_u(mesh);
+  auto V_u = std::make_shared<Velocity::FunctionSpace>(mesh);
 
   // Create velocity function
-  Function u(V_u, "../unitsquare_64_64_velocity.xml.gz");
+  auto u = std::make_shared<Function>(V_u, "../unitsquare_64_64_velocity.xml.gz");
 
   // Diffusivity
-  Constant c(0.0);
+  auto c = std::make_shared<Constant>(0.0);
 
   //Source term
-  Constant f(0.0);
+  auto f = std::make_shared<Constant>(0.0);
 
   // Penalty parameter
-  Constant alpha(5.0);
+  auto alpha = std::make_shared<Constant>(5.0);
 
   // Create function space
-  AdvectionDiffusion::FunctionSpace V(mesh);
+  auto V = std::make_shared<AdvectionDiffusion::FunctionSpace>(mesh);
 
   // Create forms and attach functions
   AdvectionDiffusion::BilinearForm a(V, V);
@@ -86,12 +86,12 @@ int main(int argc, char *argv[])
   L.f = f;
 
   // Set up boundary condition (apply strong BCs)
-  BC g;
-  DirichletBoundary boundary;
+  auto g = std::make_shared<BC>();
+  auto boundary = std::make_shared<DirichletBoundary>();
   DirichletBC bc(V, g, boundary, "geometric");
 
   // Solution function
-  Function phi_h(V);
+  auto phi_h = std::make_shared<Function>(V);
 
   // Assemble and apply boundary conditions
   Matrix A;
@@ -101,10 +101,10 @@ int main(int argc, char *argv[])
   bc.apply(A, b);
 
   // Solve system
-  solve(A, *phi_h.vector(), b);
+  solve(A, *phi_h->vector(), b);
 
   // Define variational problem
-  Projection::FunctionSpace Vp(mesh);
+  auto Vp = std::make_shared<Projection::FunctionSpace>(mesh);
   Projection::BilinearForm ap(Vp, Vp);
   Projection::LinearForm Lp(Vp);
   Lp.phi0 = phi_h;
diff --git a/demo/undocumented/dg-advection-diffusion/python/demo_dg-advection-diffusion.py b/demo/undocumented/dg-advection-diffusion/python/demo_dg-advection-diffusion.py
index 2f05b12..f3dedda 100644
--- a/demo/undocumented/dg-advection-diffusion/python/demo_dg-advection-diffusion.py
+++ b/demo/undocumented/dg-advection-diffusion/python/demo_dg-advection-diffusion.py
@@ -80,7 +80,7 @@ a = a_int + a_fac + a_vel
 L = v*f*dx
 
 # Set up boundary condition (apply strong BCs)
-g = Expression("sin(pi*5.0*x[1])")
+g = Expression("sin(pi*5.0*x[1])", degree=2)
 bc = DirichletBC(V_dg, g, DirichletBoundary(), "geometric")
 
 # Solution function
diff --git a/demo/undocumented/dg-poisson/cpp/CMakeLists.txt b/demo/undocumented/dg-poisson/cpp/CMakeLists.txt
index e7cdd0d..2a3323b 100644
--- a/demo/undocumented/dg-poisson/cpp/CMakeLists.txt
+++ b/demo/undocumented/dg-poisson/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/dg-poisson/cpp/Poisson.h b/demo/undocumented/dg-poisson/cpp/Poisson.h
index 05294bc..2635a44 100644
--- a/demo/undocumented/dg-poisson/cpp/Poisson.h
+++ b/demo/undocumented/dg-poisson/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +902,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return true;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 3*num_global_entities[2];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 3;
+        return 2;
         break;
       }
     }
@@ -1041,217 +989,54 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = 3*c.entity_indices[2][0];
-    dofs[1] = 3*c.entity_indices[2][0] + 1;
-    dofs[2] = 3*c.entity_indices[2][0] + 2;
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
-    
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-  }
-
-};
-
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
-
-class poisson_exterior_facet_integral_0_1: public ufc::exterior_facet_integral
-{
-public:
-
-  /// Constructor
-  poisson_exterior_facet_integral_0_1() : ufc::exterior_facet_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~poisson_exterior_facet_integral_0_1()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1259,60 +1044,3012 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Get vertices on edge
-    static unsigned int edge_vertices[3][2] = {{1, 2}, {0, 2}, {0, 1}};
-    const unsigned int v0 = edge_vertices[facet][0];
-    const unsigned int v1 = edge_vertices[facet][1];
-    
-    // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
-    const double det = std::sqrt(dx0*dx0 + dx1*dx1);
-    
-    
-    const bool direction = dx1*(vertex_coordinates[2*facet] - vertex_coordinates[2*v0]) - dx0*(vertex_coordinates[2*facet + 1] - vertex_coordinates[2*v0 + 1]) < 0;
-    // Compute facet normals from the facet scale factor constants
-    const double n0 = direction ? dx1 / det : -dx1 / det;
-    const double n1 = direction ? -dx0 / det : dx0 / det;
-    
-    // Facet area
-    
-    // Compute cell volume
-    const double volume = std::abs(detJ)/2.0;
-    
-    
-    // Compute circumradius of triangle in 2D
-    const double v1v2  = std::sqrt((vertex_coordinates[4] - vertex_coordinates[2])*(vertex_coordinates[4] - vertex_coordinates[2]) + (vertex_coordinates[5] - vertex_coordinates[3])*(vertex_coordinates[5] - vertex_coordinates[3]) );
-    const double v0v2  = std::sqrt(J[3]*J[3] + J[1]*J[1]);
-    const double v0v1  = std::sqrt(J[0]*J[0] + J[2]*J[2]);
-    const double circumradius = 0.25*(v1v2*v0v2*v0v1)/(volume);
-    
-    
-    // Array of quadrature weights.
-    static const double W2[2] = {0.5, 0.5};
-    // Quadrature points on the UFC reference element: (0.211324865405187), (0.788675134594813)
-    
-    // Values of basis functions at quadrature points.
-    static const double FE0_f0[2][2] = \
-    {{0.788675134594813, 0.211324865405187},
-    {0.211324865405187, 0.788675134594813}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc0[2] = {1, 2};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc3[2] = {0, 2};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc4[2] = {0, 1};
-    
-    static const double FE0_f0_D01[2][2] = \
-    {{-1.0, 1.0},
-    {-1.0, 1.0}};
-    
-    // Array of non-zero columns
-    static const unsigned int nzc1[2] = {0, 2};
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_finite_element_2: public ufc::finite_element
+{
+public:
+
+  poisson_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~poisson_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', triangle, 1)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_2();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
+  }
+
+};
+
+
+class poisson_dofmap_2: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_2() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return false;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return true;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 3*num_global_entities[2];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 0;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 0;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = 3*entity_indices[2][0];
+    dofs[1] = 3*entity_indices[2][0] + 1;
+    dofs[2] = 3*entity_indices[2][0] + 2;
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_2();
+  }
+
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+  }
+
+};
+
+
+class poisson_exterior_facet_integral_0_1: public ufc::exterior_facet_integral
+{
+public:
+
+  poisson_exterior_facet_integral_0_1() : ufc::exterior_facet_integral()
+  {
+    
+  }
+
+  ~poisson_exterior_facet_integral_0_1() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    
+    // Get vertices on edge
+    static unsigned int edge_vertices[3][2] = {{1, 2}, {0, 2}, {0, 1}};
+    const unsigned int v0 = edge_vertices[facet][0];
+    const unsigned int v1 = edge_vertices[facet][1];
+    
+    // Compute scale factor (length of edge scaled by length of reference interval)
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
+    const double det = std::sqrt(dx0*dx0 + dx1*dx1);
+    
+    
+    const bool direction = dx1*(coordinate_dofs[2*facet] - coordinate_dofs[2*v0]) - dx0*(coordinate_dofs[2*facet + 1] - coordinate_dofs[2*v0 + 1]) < 0;
+    // Compute facet normals from the facet scale factor constants
+    const double n0 = direction ? dx1 / det : -dx1 / det;
+    const double n1 = direction ? -dx0 / det : dx0 / det;
+    
+    // Facet area
+    
+    // Compute cell volume
+    const double volume = std::abs(detJ)/2.0;
+    
+    
+    // Compute circumradius of triangle in 2D
+    const double v1v2  = std::sqrt((coordinate_dofs[4] - coordinate_dofs[2])*(coordinate_dofs[4] - coordinate_dofs[2]) + (coordinate_dofs[5] - coordinate_dofs[3])*(coordinate_dofs[5] - coordinate_dofs[3]) );
+    const double v0v2  = std::sqrt(J[3]*J[3] + J[1]*J[1]);
+    const double v0v1  = std::sqrt(J[0]*J[0] + J[2]*J[2]);
+    const double circumradius = 0.25*(v1v2*v0v2*v0v1)/(volume);
+    
+    
+    // Array of quadrature weights.
+    static const double W2[2] = {0.5, 0.5};
+    // Quadrature points on the UFC reference element: (0.211324865405187), (0.788675134594813)
+    
+    // Values of basis functions at quadrature points.
+    static const double FE0_f0[2][2] = \
+    {{0.788675134594813, 0.211324865405187},
+    {0.211324865405187, 0.788675134594813}};
+    
+    // Array of non-zero columns
+    static const unsigned int nzc0[2] = {1, 2};
+    
+    // Array of non-zero columns
+    static const unsigned int nzc3[2] = {0, 2};
+    
+    // Array of non-zero columns
+    static const unsigned int nzc4[2] = {0, 1};
+    
+    static const double FE0_f0_D01[2][2] = \
+    {{-1.0, 1.0},
+    {-1.0, 1.0}};
+    
+    // Array of non-zero columns
+    static const unsigned int nzc1[2] = {0, 2};
     
     // Array of non-zero columns
     static const unsigned int nzc2[2] = {0, 1};
@@ -1461,46 +4198,39 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// interior facet tensor corresponding to the local contribution to
-/// a form from the integral over an interior facet.
 
 class poisson_interior_facet_integral_0_otherwise: public ufc::interior_facet_integral
 {
 public:
 
-  /// Constructor
   poisson_interior_facet_integral_0_otherwise() : ufc::interior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_interior_facet_integral_0_otherwise()
+  ~poisson_interior_facet_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local interior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates_0,
-                               const double*  vertex_coordinates_1,
-                               std::size_t facet_0,
-                               std::size_t facet_1,
-                               int cell_orientation_0,
-                               int cell_orientation_1) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs_0,
+                       const double * coordinate_dofs_1,
+                       std::size_t facet_0,
+                       std::size_t facet_1,
+                       int cell_orientation_0,
+                       int cell_orientation_1) const final override
   {
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -1509,7 +4239,7 @@ public:
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -1524,12 +4254,12 @@ public:
     const unsigned int v1 = edge_vertices[facet_0][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates_0[2*v1 + 0] - vertex_coordinates_0[2*v0 + 0];
-    const double dx1 = vertex_coordinates_0[2*v1 + 1] - vertex_coordinates_0[2*v0 + 1];
+    const double dx0 = coordinate_dofs_0[2*v1 + 0] - coordinate_dofs_0[2*v0 + 0];
+    const double dx1 = coordinate_dofs_0[2*v1 + 1] - coordinate_dofs_0[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates_0[2*facet_0] - vertex_coordinates_0[2*v0]) - dx0*(vertex_coordinates_0[2*facet_0 + 1] - vertex_coordinates_0[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs_0[2*facet_0] - coordinate_dofs_0[2*v0]) - dx0*(coordinate_dofs_0[2*facet_0 + 1] - coordinate_dofs_0[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n_00 = direction ? dx1 / det : -dx1 / det;
     const double n_01 = direction ? -dx0 / det : dx0 / det;// Compute facet normals from the facet scale factor constants
@@ -1543,12 +4273,12 @@ public:
     
     
     // Compute circumradius of triangle in 2D
-    const double v1v2_0  = std::sqrt((vertex_coordinates_0[4] - vertex_coordinates_0[2])*(vertex_coordinates_0[4] - vertex_coordinates_0[2]) + (vertex_coordinates_0[5] - vertex_coordinates_0[3])*(vertex_coordinates_0[5] - vertex_coordinates_0[3]) );
+    const double v1v2_0  = std::sqrt((coordinate_dofs_0[4] - coordinate_dofs_0[2])*(coordinate_dofs_0[4] - coordinate_dofs_0[2]) + (coordinate_dofs_0[5] - coordinate_dofs_0[3])*(coordinate_dofs_0[5] - coordinate_dofs_0[3]) );
     const double v0v2_0  = std::sqrt(J_0[3]*J_0[3] + J_0[1]*J_0[1]);
     const double v0v1_0  = std::sqrt(J_0[0]*J_0[0] + J_0[2]*J_0[2]);
     const double circumradius_0 = 0.25*(v1v2_0*v0v2_0*v0v1_0)/(volume_0);
     // Compute circumradius of triangle in 2D
-    const double v1v2_1  = std::sqrt((vertex_coordinates_1[4] - vertex_coordinates_1[2])*(vertex_coordinates_1[4] - vertex_coordinates_1[2]) + (vertex_coordinates_1[5] - vertex_coordinates_1[3])*(vertex_coordinates_1[5] - vertex_coordinates_1[3]) );
+    const double v1v2_1  = std::sqrt((coordinate_dofs_1[4] - coordinate_dofs_1[2])*(coordinate_dofs_1[4] - coordinate_dofs_1[2]) + (coordinate_dofs_1[5] - coordinate_dofs_1[3])*(coordinate_dofs_1[5] - coordinate_dofs_1[3]) );
     const double v0v2_1  = std::sqrt(J_1[3]*J_1[3] + J_1[1]*J_1[1]);
     const double v0v1_1  = std::sqrt(J_1[0]*J_1[0] + J_1[2]*J_1[2]);
     const double circumradius_1 = 0.25*(v1v2_1*v0v2_1*v0v1_1)/(volume_1);
@@ -2462,38 +5192,31 @@ public:
 
 };
 
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
+  ~poisson_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -2502,7 +5225,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2525,43 +5248,36 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class poisson_exterior_facet_integral_1_1: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   poisson_exterior_facet_integral_1_1() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_exterior_facet_integral_1_1()
+  ~poisson_exterior_facet_integral_1_1() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2576,12 +5292,12 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates[2*facet] - vertex_coordinates[2*v0]) - dx0*(vertex_coordinates[2*facet + 1] - vertex_coordinates[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs[2*facet] - coordinate_dofs[2*v0]) - dx0*(coordinate_dofs[2*facet + 1] - coordinate_dofs[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n0 = direction ? dx1 / det : -dx1 / det;
     const double n1 = direction ? -dx0 / det : dx0 / det;
@@ -2593,7 +5309,7 @@ public:
     
     
     // Compute circumradius of triangle in 2D
-    const double v1v2  = std::sqrt((vertex_coordinates[4] - vertex_coordinates[2])*(vertex_coordinates[4] - vertex_coordinates[2]) + (vertex_coordinates[5] - vertex_coordinates[3])*(vertex_coordinates[5] - vertex_coordinates[3]) );
+    const double v1v2  = std::sqrt((coordinate_dofs[4] - coordinate_dofs[2])*(coordinate_dofs[4] - coordinate_dofs[2]) + (coordinate_dofs[5] - coordinate_dofs[3])*(coordinate_dofs[5] - coordinate_dofs[3]) );
     const double v0v2  = std::sqrt(J[3]*J[3] + J[1]*J[1]);
     const double v0v1  = std::sqrt(J[0]*J[0] + J[2]*J[2]);
     const double circumradius = 0.25*(v1v2*v0v2*v0v1)/(volume);
@@ -2777,39 +5493,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class poisson_exterior_facet_integral_1_2: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   poisson_exterior_facet_integral_1_2() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_exterior_facet_integral_1_2()
+  ~poisson_exterior_facet_integral_1_2() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -2818,7 +5527,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2831,8 +5540,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -2871,77 +5580,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_0()
+  ~poisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "7efc868b7349cb4d891a050e31c2438a99487d0e934a14c74e9fe17e74cf0278c5950fd256377c40c967afe8a6ac4507e204c9d17ec582f3e81ddc4f04897446";
+    return "959a1a39a951a9e9653a47be1d0dc124aa7a6699a2546a601c4c99f2096468d40c4ae3d63dfbb1eda166f9199161ae409056c742b0f1ab251623449b6411f747";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson_finite_element_0();
+        return new poisson_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson_finite_element_0();
+        return new poisson_finite_element_2();
         break;
       }
     }
@@ -2949,19 +5650,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson_dofmap_0();
+        return new poisson_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson_dofmap_0();
+        return new poisson_dofmap_2();
         break;
       }
     }
@@ -2969,77 +5669,92 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 2;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     switch (subdomain_id)
     {
@@ -3053,138 +5768,151 @@ public:
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return new poisson_interior_facet_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "755f934520fafc394596bf3d436d798efd90f3f2fa450214eea77905fda8e885d1cee2863359c7f720fd4e300da656a37cee22b399f9f888020a1d5212a2a309";
+    return "5521953fdff3889958e8959e6ab2445befa197be64be27f5cd870dfccdb6879b2fb5130da79a80006ff57686808a7349274ac72a8805a390aa2e8f8960ea8d91";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 3;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
+  {
+    static const std::vector<std::size_t> position({0, 1, 2});
+    return position[i];
+  }
+
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
   {
-    static const std::vector<std::size_t> position({0, 1, 2});
-    return position[i];
+    return nullptr;
   }
 
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson_finite_element_0();
+        return new poisson_finite_element_2();
         break;
       }
     case 1:
       {
-        return new poisson_finite_element_0();
+        return new poisson_finite_element_2();
         break;
       }
     case 2:
       {
-        return new poisson_finite_element_0();
+        return new poisson_finite_element_2();
         break;
       }
     case 3:
       {
-        return new poisson_finite_element_0();
+        return new poisson_finite_element_2();
         break;
       }
     }
@@ -3192,29 +5920,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new poisson_dofmap_0();
+        return new poisson_dofmap_2();
         break;
       }
     case 1:
       {
-        return new poisson_dofmap_0();
+        return new poisson_dofmap_2();
         break;
       }
     case 2:
       {
-        return new poisson_dofmap_0();
+        return new poisson_dofmap_2();
         break;
       }
     case 3:
       {
-        return new poisson_dofmap_0();
+        return new poisson_dofmap_2();
         break;
       }
     }
@@ -3222,77 +5949,92 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 3;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     switch (subdomain_id)
     {
@@ -3311,51 +6053,72 @@ public:
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -3369,14 +6132,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -3385,43 +6154,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -3432,43 +6178,20 @@ class CoefficientSpace_g: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -3479,43 +6202,20 @@ class CoefficientSpace_u0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -3526,43 +6226,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -3573,63 +6250,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -3637,7 +6321,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -3667,57 +6351,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_u0 Form_L_FunctionSpace_2;
@@ -3729,77 +6468,126 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 3), f(*this, 0), u0(*this, 1), g(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& g):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> g):
     dolfin::Form(1, 3), f(*this, 0), u0(*this, 1), g(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
     this->u0 = u0;
     this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 3), f(*this, 0), u0(*this, 1), g(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
-    this->u0 = *u0;
-    this->g = *g;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+    else if (name == "u0")
+      return 1;
+    else if (name == "g")
+      return 2;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 3), f(*this, 0), u0(*this, 1), g(*this, 2)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    case 1:
+      return "u0";
+    case 2:
+      return "g";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_u0;
+  typedef Form_L_FunctionSpace_3 CoefficientSpace_g;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner u0;
+  dolfin::CoefficientAssigner g;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& g):
-    dolfin::Form(1, 3), f(*this, 0), u0(*this, 1), g(*this, 2)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0), u0(*this, 1), g(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
-    this->u0 = u0;
-    this->g = g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 3), f(*this, 0), u0(*this, 1), g(*this, 2)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> g):
+    dolfin::MultiMeshForm(V0), f(*this, 0), u0(*this, 1), g(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
-    this->u0 = *u0;
-    this->g = *g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+    this->u0 = u0;
+    this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -3839,22 +6627,28 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_u0;
   typedef Form_L_FunctionSpace_3 CoefficientSpace_g;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner u0;
-  dolfin::CoefficientAssigner g;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner u0;
+  dolfin::MultiMeshCoefficientAssigner g;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/dg-poisson/cpp/compile.log b/demo/undocumented/dg-poisson/cpp/compile.log
index b5a5323..261aa36 100644
--- a/demo/undocumented/dg-poisson/cpp/compile.log
+++ b/demo/undocumented/dg-poisson/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -14,31 +15,31 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0, v_1)'
   Number of coefficients:              0
   Coefficients:                        '[]'
-  Unique elements:                     'DG1(?)'
-  Unique sub elements:                 'DG1(?)'
+  Unique elements:                     'DG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'DG1(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -47,8 +48,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              3
   Coefficients:                        '[w_0, w_1, w_2]'
-  Unique elements:                     'DG1(?)'
-  Unique sub elements:                 'DG1(?)'
+  Unique elements:                     'DG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'DG1(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -56,34 +57,45 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0702031 seconds.
+Compiler stage 1 finished in 0.111267 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -93,7 +105,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000592 seconds
+  36 entries computed in 0.000697 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -101,33 +113,17 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {2: {FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
-         [ 1.,  1.],
-         [ 0.,  0.]]), (0, 0): array([[ -2.08166817e-17,   5.55111512e-17],
-         [  7.88675135e-01,   2.11324865e-01],
-         [  2.11324865e-01,   7.88675135e-01]])}, 1: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
-         [ 1.,  1.],
-         [ 0.,  0.]]), (0, 0): array([[  7.88675135e-01,   2.11324865e-01],
-         [ -2.08166817e-17,   5.55111512e-17],
-         [  2.11324865e-01,   7.88675135e-01]])}, 2: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
-         [ 1.,  1.],
-         [ 0.,  0.]]), (0, 0): array([[ 0.78867513,  0.21132487],
-         [ 0.21132487,  0.78867513],
-         [ 0.        ,  0.        ]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
+  {2: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16],
@@ -271,7 +267,25 @@ Compiler stage 2: Computing intermediate representation
           [ 0.21132487,  0.78867513]],
   
          [[ 0.        ,  0.        ],
-          [ 0.        ,  0.        ]]])}}}}}
+          [ 0.        ,  0.        ]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 1): {None: {0: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
+         [ 1.,  1.],
+         [ 0.,  0.]]), (0, 0): array([[ -2.08166817e-17,   5.55111512e-17],
+         [  7.88675135e-01,   2.11324865e-01],
+         [  2.11324865e-01,   7.88675135e-01]])}, 1: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
+         [ 1.,  1.],
+         [ 0.,  0.]]), (0, 0): array([[  7.88675135e-01,   2.11324865e-01],
+         [ -2.08166817e-17,   5.55111512e-17],
+         [  2.11324865e-01,   7.88675135e-01]])}, 2: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
+         [ 1.,  1.],
+         [ 0.,  0.]]), (0, 0): array([[ 0.78867513,  0.21132487],
+         [ 0.21132487,  0.78867513],
+         [ 0.        ,  0.        ]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_f0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
@@ -442,27 +456,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {2: {FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
-         [ 1.,  1.],
-         [ 0.,  0.]]), (0, 0): array([[ -2.08166817e-17,   5.55111512e-17],
-         [  7.88675135e-01,   2.11324865e-01],
-         [  2.11324865e-01,   7.88675135e-01]])}, 1: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
-         [ 1.,  1.],
-         [ 0.,  0.]]), (0, 0): array([[  7.88675135e-01,   2.11324865e-01],
-         [ -2.08166817e-17,   5.55111512e-17],
-         [  2.11324865e-01,   7.88675135e-01]])}, 2: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
-         [ 1.,  1.],
-         [ 0.,  0.]]), (0, 0): array([[ 0.78867513,  0.21132487],
-         [ 0.21132487,  0.78867513],
-         [ 0.        ,  0.        ]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
+  {2: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16],
@@ -606,7 +603,25 @@ Compiler stage 2: Computing intermediate representation
           [ 0.21132487,  0.78867513]],
   
          [[ 0.        ,  0.        ],
-          [ 0.        ,  0.        ]]])}}}}}
+          [ 0.        ,  0.        ]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 1): {None: {0: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
+         [ 1.,  1.],
+         [ 0.,  0.]]), (0, 0): array([[ -2.08166817e-17,   5.55111512e-17],
+         [  7.88675135e-01,   2.11324865e-01],
+         [  2.11324865e-01,   7.88675135e-01]])}, 1: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
+         [ 1.,  1.],
+         [ 0.,  0.]]), (0, 0): array([[  7.88675135e-01,   2.11324865e-01],
+         [ -2.08166817e-17,   5.55111512e-17],
+         [  2.11324865e-01,   7.88675135e-01]])}, 2: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
+         [ 1.,  1.],
+         [ 0.,  0.]]), (0, 0): array([[ 0.78867513,  0.21132487],
+         [ 0.21132487,  0.78867513],
+         [ 0.        ,  0.        ]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_f0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
@@ -1156,7 +1171,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000622 seconds
+  9 entries computed in 0.000754 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1164,32 +1179,16 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {2: {FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
-         [ 1.,  1.],
-         [ 0.,  0.]]), (0, 0): array([[ -2.08166817e-17,   5.55111512e-17],
-         [  7.88675135e-01,   2.11324865e-01],
-         [  2.11324865e-01,   7.88675135e-01]])}, 1: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
-         [ 1.,  1.],
-         [ 0.,  0.]]), (0, 0): array([[  7.88675135e-01,   2.11324865e-01],
-         [ -2.08166817e-17,   5.55111512e-17],
-         [  2.11324865e-01,   7.88675135e-01]])}, 2: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
-         [  8.88178420e-16,   8.88178420e-16],
-         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
-         [ 1.,  1.],
-         [ 0.,  0.]]), (0, 0): array([[ 0.78867513,  0.21132487],
-         [ 0.21132487,  0.78867513],
-         [ 0.        ,  0.        ]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
+  {2: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16],
@@ -1333,7 +1332,25 @@ Compiler stage 2: Computing intermediate representation
           [ 0.21132487,  0.78867513]],
   
          [[ 0.        ,  0.        ],
-          [ 0.        ,  0.        ]]])}}}}}
+          [ 0.        ,  0.        ]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 1): {None: {0: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
+         [ 1.,  1.],
+         [ 0.,  0.]]), (0, 0): array([[ -2.08166817e-17,   5.55111512e-17],
+         [  7.88675135e-01,   2.11324865e-01],
+         [  2.11324865e-01,   7.88675135e-01]])}, 1: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
+         [ 1.,  1.],
+         [ 0.,  0.]]), (0, 0): array([[  7.88675135e-01,   2.11324865e-01],
+         [ -2.08166817e-17,   5.55111512e-17],
+         [  2.11324865e-01,   7.88675135e-01]])}, 2: {(0, 1): array([[ -1.00000000e+00,  -1.00000000e+00],
+         [  8.88178420e-16,   8.88178420e-16],
+         [  1.00000000e+00,   1.00000000e+00]]), (1, 0): array([[-1., -1.],
+         [ 1.,  1.],
+         [ 0.,  0.]]), (0, 0): array([[ 0.78867513,  0.21132487],
+         [ 0.21132487,  0.78867513],
+         [ 0.        ,  0.        ]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_f0': array([[ -2.08166817e-17,   7.88675135e-01,   2.11324865e-01],
@@ -1475,7 +1492,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000796 seconds
+  9 entries computed in 0.00116 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1484,7 +1501,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000718 seconds
+  9 entries computed in 0.000931 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1493,7 +1510,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000709 seconds
+  9 entries computed in 0.000969 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -1501,9 +1518,10 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.241883 seconds.
+Compiler stage 2 finished in 0.339809 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
@@ -1523,60 +1541,61 @@ Compiler stage 3: Optimizing intermediate representation
   Optimising expressions for facet integral 1
   Optimising expressions for facet integral 2
   
-Compiler stage 3 finished in 0.0249159 seconds.
+Compiler stage 3 finished in 0.0595629 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: facet_area
   Removing unused variable: facet_area
@@ -1585,18 +1604,18 @@ Compiler stage 4: Generating code
   Removing unused variable: facet_area
   Generating code for forms
   
-Compiler stage 4 finished in 0.0580351 seconds.
+Compiler stage 4 finished in 0.174591 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000571012 seconds.
+Compiler stage 4.1 finished in 0.000699997 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000644922 seconds.
+Compiler stage 5 finished in 0.000664949 seconds.
 
-FFC finished in 0.396555 seconds.
+FFC finished in 0.687029 seconds.
+Output written to ./Poisson.h.
diff --git a/demo/undocumented/dg-poisson/cpp/main.cpp b/demo/undocumented/dg-poisson/cpp/main.cpp
index 93cf8eb..e9e8b0e 100644
--- a/demo/undocumented/dg-poisson/cpp/main.cpp
+++ b/demo/undocumented/dg-poisson/cpp/main.cpp
@@ -91,23 +91,23 @@ int main()
   parameters["ghost_mode"] = "shared_facet";
 
   // Create mesh
-  UnitSquareMesh mesh(24, 24);
+  auto mesh = std::make_shared<UnitSquareMesh>(24, 24);
 
   // Create functions
-  Source f;
-  BoundaryValue u0;
-  BoundaryDerivative g;
+  auto f = std::make_shared<Source>();
+  auto u0 = std::make_shared<BoundaryValue>();
+  auto g = std::make_shared<BoundaryDerivative>();
 
   // Create funtion space
-  Poisson::FunctionSpace V(mesh);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
 
   // Mark facets of the mesh
   NeumannBoundary neumann_boundary;
   DirichletBoundary dirichlet_boundary;
 
-  FacetFunction<std::size_t> boundaries(mesh, 0);
-  neumann_boundary.mark(boundaries, 2);
-  dirichlet_boundary.mark(boundaries, 1);
+  auto boundaries = std::make_shared<FacetFunction<std::size_t>>(mesh, 0);
+  neumann_boundary.mark(*boundaries, 2);
+  dirichlet_boundary.mark(*boundaries, 1);
 
   // Define variational problem
   Poisson::BilinearForm a(V, V);
diff --git a/demo/undocumented/dg-poisson/python/demo_dg-poisson.py b/demo/undocumented/dg-poisson/python/demo_dg-poisson.py
index c314549..6d29fc6 100644
--- a/demo/undocumented/dg-poisson/python/demo_dg-poisson.py
+++ b/demo/undocumented/dg-poisson/python/demo_dg-poisson.py
@@ -65,9 +65,9 @@ h = CellSize(mesh)
 h_avg = (h('+') + h('-'))/2
 
 # Define the source term f, Dirichlet term u0 and Neumann term g
-f = Expression('-100.0*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)')
-u0 = Expression('x[0] + 0.25*sin(2*pi*x[1])')
-g = Expression('(x[1] - 0.5)*(x[1] - 0.5)')
+f = Expression('-100.0*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)', degree=2)
+u0 = Expression('x[0] + 0.25*sin(2*pi*x[1])', degree=2)
+g = Expression('(x[1] - 0.5)*(x[1] - 0.5)', degree=2)
 
 # Mark facets of the mesh
 boundaries = FacetFunction('size_t', mesh, 0)
diff --git a/demo/undocumented/elasticity/cpp/CMakeLists.txt b/demo/undocumented/elasticity/cpp/CMakeLists.txt
index 316c281..93303f9 100644
--- a/demo/undocumented/elasticity/cpp/CMakeLists.txt
+++ b/demo/undocumented/elasticity/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/elasticity/cpp/Elasticity.h b/demo/undocumented/elasticity/cpp/Elasticity.h
index 6a2df1e..1deab5f 100644
--- a/demo/undocumented/elasticity/cpp/Elasticity.h
+++ b/demo/undocumented/elasticity/cpp/Elasticity.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,408 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __ELASTICITY_H
 #define __ELASTICITY_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class elasticity_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   elasticity_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_finite_element_0()
+  ~elasticity_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Compute subdeterminants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-    vertex_values[3] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t value_size() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new elasticity_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class elasticity_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  elasticity_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~elasticity_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "TensorElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, (3, 3), {}, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 9;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    case 1:
-      {
-        return 3;
-        break;
-      }
-    }
-    
-    return 0;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -423,43 +121,58 @@ public:
     
     
     // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
     
     // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
     
     
     // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
-    values[3] = 0.0;
-    values[4] = 0.0;
-    values[5] = 0.0;
-    values[6] = 0.0;
-    values[7] = 0.0;
-    values[8] = 0.0;
+    *values = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[1] = {0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -467,21 +180,29 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[1] = {0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -489,21 +210,29 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[1] = {0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -511,131 +240,29 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[1] = {0.0};
-      
-      // Declare helper variables
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      
-      // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
-      {
-        values[3] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[1] = {0.0};
-      
-      // Declare helper variables
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      
-      // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
-      {
-        values[4] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[1] = {0.0};
-      
-      // Declare helper variables
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      
-      // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
-      {
-        values[5] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[1] = {0.0};
-      
-      // Declare helper variables
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      
-      // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
-      {
-        values[6] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[1] = {0.0};
-      
-      // Declare helper variables
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      
-      // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
-      {
-        values[7] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[1] = {0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[1] = \
-      {1.0};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 1; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        values[8] += coefficients0[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -643,51 +270,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[9] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+    double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 9; r++)
+    for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 9; s++)
-      {
-        values[r*9 + s] = dof_values[s];
-      } // end loop over 's'
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -699,7 +319,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 9*num_derivatives; r++)
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -707,797 +327,413 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
+    if (n > 1)
     {
     return ;
     }
     
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
     
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 9; r++)
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
     {
-      for (unsigned int s = 0; s < 9*num_derivatives; s++)
-      {
-        values[r*9*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 0;
+    }
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
+    // Generate combinations of derivatives
+    for (unsigned int row = 1; row < num_derivatives; row++)
     {
-      return ;
+      for (unsigned int num = 0; num < row; num++)
+      {
+        for (unsigned int col = n-1; col+1 > 0; col--)
+        {
+          if (combinations[row][col] + 1 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[9];
-    for (unsigned int r = 0; r < 9; r++)
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
     {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
     
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 9; r++)
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 9*num_derivatives; s++)
+      for (unsigned int col = 0; col < num_derivatives; col++)
       {
-        values[r*9*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[9];
-    
-    // Declare variable for physical coordinates
-    double y[3];
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
     switch (i)
     {
     case 0:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 2:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[3];
-        break;
-      }
-    case 4:
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[4];
-        break;
-      }
-    case 5:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[5];
-        break;
-      }
-    case 6:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[6];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 7:
+    case 1:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[7];
-        break;
-      }
-    case 8:
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[8];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[9];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[1] = vals[1];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[2] = vals[2];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[3];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[4] = vals[4];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[5] = vals[5];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[6] = vals[6];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[7];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[8] = vals[8];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[9] = dof_values[0];
-    vertex_values[18] = dof_values[0];
-    vertex_values[27] = dof_values[0];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[1];
-    vertex_values[10] = dof_values[1];
-    vertex_values[19] = dof_values[1];
-    vertex_values[28] = dof_values[1];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[2];
-    vertex_values[11] = dof_values[2];
-    vertex_values[20] = dof_values[2];
-    vertex_values[29] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[3] = dof_values[3];
-    vertex_values[12] = dof_values[3];
-    vertex_values[21] = dof_values[3];
-    vertex_values[30] = dof_values[3];
-    // Evaluate function and change variables
-    vertex_values[4] = dof_values[4];
-    vertex_values[13] = dof_values[4];
-    vertex_values[22] = dof_values[4];
-    vertex_values[31] = dof_values[4];
-    // Evaluate function and change variables
-    vertex_values[5] = dof_values[5];
-    vertex_values[14] = dof_values[5];
-    vertex_values[23] = dof_values[5];
-    vertex_values[32] = dof_values[5];
-    // Evaluate function and change variables
-    vertex_values[6] = dof_values[6];
-    vertex_values[15] = dof_values[6];
-    vertex_values[24] = dof_values[6];
-    vertex_values[33] = dof_values[6];
-    // Evaluate function and change variables
-    vertex_values[7] = dof_values[7];
-    vertex_values[16] = dof_values[7];
-    vertex_values[25] = dof_values[7];
-    vertex_values[34] = dof_values[7];
-    // Evaluate function and change variables
-    vertex_values[8] = dof_values[8];
-    vertex_values[17] = dof_values[8];
-    vertex_values[26] = dof_values[8];
-    vertex_values[35] = dof_values[8];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 9;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new elasticity_finite_element_0();
-        break;
-      }
-    case 1:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new elasticity_finite_element_0();
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
     case 2:
       {
-        return new elasticity_finite_element_0();
-        break;
-      }
-    case 3:
-      {
-        return new elasticity_finite_element_0();
-        break;
-      }
-    case 4:
-      {
-        return new elasticity_finite_element_0();
-        break;
-      }
-    case 5:
-      {
-        return new elasticity_finite_element_0();
-        break;
-      }
-    case 6:
-      {
-        return new elasticity_finite_element_0();
-        break;
-      }
-    case 7:
-      {
-        return new elasticity_finite_element_0();
-        break;
-      }
-    case 8:
-      {
-        return new elasticity_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new elasticity_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class elasticity_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  elasticity_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~elasticity_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Real', Domain(Cell('tetrahedron', 3)), 0, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 1;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Compute subdeterminants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-      y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-      y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    y[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    y[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-    vertex_values[3] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new elasticity_finite_element_2();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class elasticity_finite_element_3: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  elasticity_finite_element_3() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~elasticity_finite_element_3()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 4;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
         
       // Array of basisvalues
       double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
@@ -1517,72 +753,139 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
@@ -1609,192 +912,6 @@ public:
       static const double coefficients0[4] = \
       {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[3][1];
-    for (unsigned int row = 0; row < 3; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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 > 2)
-            combinations[row][col] = 0;
-          else
-          {
-            combinations[row][col] += 1;
-            break;
-          }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[3][3];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
       {{0.0, 0.0, 0.0, 0.0},
@@ -1922,171 +1039,396 @@ public:
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new elasticity_finite_element_0();
+  }
+
+};
+
+
+class elasticity_finite_element_1: public ufc::finite_element
+{
+public:
+
+  elasticity_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~elasticity_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 1:
       {
         
       // Array of basisvalues
@@ -2107,139 +1449,42 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        break;
+      }
+    case 2:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2266,437 +1511,330 @@ public:
       static const double coefficients0[4] = \
       {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[3];
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 9:
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
-    case 1:
+    case 10:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
-    case 3:
+    case 11:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new elasticity_finite_element_3();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class elasticity_finite_element_4: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  elasticity_finite_element_4() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~elasticity_finite_element_4()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    return ufc::tetrahedron;
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
   {
-    return 12;
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    return 1;
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
   {
-    switch (i)
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
     {
-    case 0:
-      {
-        return 3;
-        break;
-      }
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
     }
     
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -2705,9 +1843,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -2726,10 +1864,53 @@ public:
     double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
     
     
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
     switch (i)
     {
     case 0:
@@ -2755,74 +1936,141 @@ public:
       static const double coefficients0[4] = \
       {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 1:
       {
         
       // Array of basisvalues
@@ -2843,16 +2091,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 2:
       {
         
       // Array of basisvalues
@@ -2873,46 +2248,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
       } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 3:
       {
         
       // Array of basisvalues
@@ -2933,106 +2405,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
         
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 4:
       {
         
       // Array of basisvalues
@@ -3053,205 +2562,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[2] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[3][1];
-    for (unsigned int row = 0; row < 3; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
         {
-          if (combinations[row][col] + 1 > 2)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 4; u++)
           {
-            combinations[row][col] += 1;
-            break;
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[3][3];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 5:
       {
         
       // Array of basisvalues
@@ -3272,7 +2719,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -3403,12 +2850,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 6:
       {
         
       // Array of basisvalues
@@ -3429,7 +2876,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -3560,12 +3007,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 7:
       {
         
       // Array of basisvalues
@@ -3586,7 +3033,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -3717,12 +3164,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 8:
       {
         
       // Array of basisvalues
@@ -3743,7 +3190,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -3874,12 +3321,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 9:
       {
         
       // Array of basisvalues
@@ -3900,7 +3347,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -4031,12 +3478,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 10:
       {
         
       // Array of basisvalues
@@ -4057,7 +3504,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -4188,12 +3635,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 11:
       {
         
       // Array of basisvalues
@@ -4214,7 +3661,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -4260,878 +3707,1108 @@ public:
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
         break;
       }
     case 7:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new elasticity_finite_element_0();
+        break;
+      }
+    case 1:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        return new elasticity_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new elasticity_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new elasticity_finite_element_1();
+  }
+
+};
+
+
+class elasticity_finite_element_2: public ufc::finite_element
+{
+public:
+
+  elasticity_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~elasticity_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Discontinuous Lagrange', tetrahedron, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Compute subdeterminants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+    vertex_values[3] = dof_values[0];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new elasticity_finite_element_2();
+  }
+
+};
+
+
+class elasticity_finite_element_3: public ufc::finite_element
+{
+public:
+
+  elasticity_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~elasticity_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "TensorElement(FiniteElement('Discontinuous Lagrange', tetrahedron, 0), shape=(3, 3), symmetry={})";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 9;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 2;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        return 3;
+        break;
+      }
+    case 1:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        return 3;
         break;
       }
-    case 9:
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 9;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 9;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Compute subdeterminants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    values[3] = 0.0;
+    values[4] = 0.0;
+    values[5] = 0.0;
+    values[6] = 0.0;
+    values[7] = 0.0;
+    values[8] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[1] = {0.0};
       
       // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[1] = \
+      {1.0};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[1] = {0.0};
       
       // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double coefficients0[1] = \
+      {1.0};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
       {
-        derivatives[r] = 0.0;
+        values[3] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[4] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[1] = {0.0};
       
       // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double coefficients0[1] = \
+      {1.0};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        values[5] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
       {
-        derivatives[r] = 0.0;
+        values[6] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        values[7] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Array of basisvalues
+      double basisvalues[1] = {0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      
+      // Table(s) of coefficients
+      static const double coefficients0[1] = \
+      {1.0};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 1; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[8] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -5139,28 +4816,98 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[9] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 9; s++)
+      {
+        values[r*9 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 9*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5172,16 +4919,16 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 9; r++)
     {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      for (unsigned int s = 0; s < 9*num_derivatives; s++)
       {
-        values[r*3*num_derivatives + s] = 0.0;
+        values[r*9*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 0)
     {
       return ;
     }
@@ -5194,146 +4941,569 @@ public:
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 9; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 9*num_derivatives; s++)
       {
-        values[r*3*num_derivatives + s] = dof_values[s];
+        values[r*9*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[9];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 2:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[3];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[4];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[5];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[6];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[7];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[8];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[9];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[1] = vals[1];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[2] = vals[2];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[3];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[4] = vals[4];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[5] = vals[5];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[6] = vals[6];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[7];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[8] = vals[8];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[9] = dof_values[0];
+    vertex_values[18] = dof_values[0];
+    vertex_values[27] = dof_values[0];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[1];
+    vertex_values[10] = dof_values[1];
+    vertex_values[19] = dof_values[1];
+    vertex_values[28] = dof_values[1];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[2];
+    vertex_values[11] = dof_values[2];
+    vertex_values[20] = dof_values[2];
+    vertex_values[29] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[3] = dof_values[3];
+    vertex_values[12] = dof_values[3];
+    vertex_values[21] = dof_values[3];
+    vertex_values[30] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[4] = dof_values[4];
+    vertex_values[13] = dof_values[4];
+    vertex_values[22] = dof_values[4];
+    vertex_values[31] = dof_values[4];
+    // Evaluate function and change variables
+    vertex_values[5] = dof_values[5];
+    vertex_values[14] = dof_values[5];
+    vertex_values[23] = dof_values[5];
+    vertex_values[32] = dof_values[5];
+    // Evaluate function and change variables
+    vertex_values[6] = dof_values[6];
+    vertex_values[15] = dof_values[6];
+    vertex_values[24] = dof_values[6];
+    vertex_values[33] = dof_values[6];
+    // Evaluate function and change variables
+    vertex_values[7] = dof_values[7];
+    vertex_values[16] = dof_values[7];
+    vertex_values[25] = dof_values[7];
+    vertex_values[34] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[8] = dof_values[8];
+    vertex_values[17] = dof_values[8];
+    vertex_values[26] = dof_values[8];
+    vertex_values[35] = dof_values[8];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[3] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[4] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[5] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[6] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[7] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[8] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[9] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[10] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[11] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[12] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[13] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[14] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[15] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[16] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[17] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[18] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[19] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[20] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[21] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[22] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[23] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+    dof_coordinates[24] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[25] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[26] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    return 9;
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
     switch (i)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return new elasticity_finite_element_2();
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return new elasticity_finite_element_2();
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return new elasticity_finite_element_2();
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return new elasticity_finite_element_2();
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        return new elasticity_finite_element_2();
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        return new elasticity_finite_element_2();
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        return new elasticity_finite_element_2();
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        return new elasticity_finite_element_2();
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 9:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 10:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[2];
+        return new elasticity_finite_element_2();
         break;
       }
-    case 11:
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new elasticity_finite_element_3();
+  }
+
+};
+
+
+class elasticity_finite_element_4: public ufc::finite_element
+{
+public:
+
+  elasticity_finite_element_4() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~elasticity_finite_element_4() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Real', tetrahedron, 0)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Real";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Compute subdeterminants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
+    
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+      y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+      y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
       f.evaluate(vals, y, c);
-      return vals[2];
+      return vals[0];
         break;
       }
     }
@@ -5341,192 +5511,89 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[3];
+    double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    y[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    y[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[4] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[8] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[10] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[11] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    vertex_values[9] = dof_values[3];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[4];
-    vertex_values[4] = dof_values[5];
-    vertex_values[7] = dof_values[6];
-    vertex_values[10] = dof_values[7];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[8];
-    vertex_values[5] = dof_values[9];
-    vertex_values[8] = dof_values[10];
-    vertex_values[11] = dof_values[11];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
+    vertex_values[3] = dof_values[0];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.25*coordinate_dofs[0] + 0.25*coordinate_dofs[3] + 0.25*coordinate_dofs[6] + 0.25*coordinate_dofs[9];
+    dof_coordinates[1] = 0.25*coordinate_dofs[1] + 0.25*coordinate_dofs[4] + 0.25*coordinate_dofs[7] + 0.25*coordinate_dofs[10];
+    dof_coordinates[2] = 0.25*coordinate_dofs[2] + 0.25*coordinate_dofs[5] + 0.25*coordinate_dofs[8] + 0.25*coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new elasticity_finite_element_3();
-        break;
-      }
-    case 1:
-      {
-        return new elasticity_finite_element_3();
-        break;
-      }
-    case 2:
-      {
-        return new elasticity_finite_element_3();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new elasticity_finite_element_4();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class elasticity_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   elasticity_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_dofmap_0()
+  ~elasticity_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -5541,7 +5608,7 @@ public:
       }
     case 3:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -5549,45 +5616,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[3];
+    return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 1;
+    return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
@@ -5602,7 +5658,7 @@ public:
       }
     case 3:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -5610,47 +5666,55 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[3][0];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
         break;
       }
     case 3:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -5661,7 +5725,35 @@ public:
     {
     case 0:
       {
-        
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -5676,80 +5768,58 @@ public:
       }
     case 3:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new elasticity_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class elasticity_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   elasticity_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_dofmap_1()
+  ~elasticity_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for TensorElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3)), 0, (3, 3), {}, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
@@ -5764,7 +5834,7 @@ public:
       }
     case 3:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -5772,45 +5842,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3;
+    return 3*num_global_entities[0];
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t num_element_dofs() const final override
   {
-    return 9*num_global_entities[3];
+    return 12;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 9;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 0;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 3;
         break;
       }
     case 1:
@@ -5825,7 +5884,7 @@ public:
       }
     case 3:
       {
-        return 9;
+        return 0;
         break;
       }
     }
@@ -5833,65 +5892,91 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[1] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[2] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[3] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[4] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[5] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[6] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[7] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
-    dofs[8] = offset + c.entity_indices[3][0];
-    offset += num_global_entities[3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 1:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 2:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
         break;
       }
     case 3:
       {
-        
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -5902,7 +5987,43 @@ public:
     {
     case 0:
       {
-        
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
@@ -5917,67 +6038,20 @@ public:
       }
     case 3:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 3;
-      dofs[4] = 4;
-      dofs[5] = 5;
-      dofs[6] = 6;
-      dofs[7] = 7;
-      dofs[8] = 8;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[3] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[4] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[5] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[6] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[7] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[8] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[9] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[10] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[11] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[12] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[13] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[14] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[15] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[16] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[17] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[18] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[19] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[20] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[21] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[22] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[23] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-    dof_coordinates[24] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[25] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[26] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 9;
+    return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5996,76 +6070,39 @@ public:
         return new elasticity_dofmap_0();
         break;
       }
-    case 3:
-      {
-        return new elasticity_dofmap_0();
-        break;
-      }
-    case 4:
-      {
-        return new elasticity_dofmap_0();
-        break;
-      }
-    case 5:
-      {
-        return new elasticity_dofmap_0();
-        break;
-      }
-    case 6:
-      {
-        return new elasticity_dofmap_0();
-        break;
-      }
-    case 7:
-      {
-        return new elasticity_dofmap_0();
-        break;
-      }
-    case 8:
-      {
-        return new elasticity_dofmap_0();
-        break;
-      }
     }
     
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new elasticity_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class elasticity_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   elasticity_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_dofmap_2()
+  ~elasticity_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('tetrahedron', 3)), 0, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', tetrahedron, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6086,7 +6123,7 @@ public:
       }
     case 3:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -6094,39 +6131,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 1;
+    return num_global_entities[3];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6155,17 +6181,15 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = 0;
+    dofs[0] = entity_indices[3][0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6193,9 +6217,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6233,68 +6256,51 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.25*vertex_coordinates[0] + 0.25*vertex_coordinates[3] + 0.25*vertex_coordinates[6] + 0.25*vertex_coordinates[9];
-    dof_coordinates[1] = 0.25*vertex_coordinates[1] + 0.25*vertex_coordinates[4] + 0.25*vertex_coordinates[7] + 0.25*vertex_coordinates[10];
-    dof_coordinates[2] = 0.25*vertex_coordinates[2] + 0.25*vertex_coordinates[5] + 0.25*vertex_coordinates[8] + 0.25*vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new elasticity_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class elasticity_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   elasticity_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_dofmap_3()
+  ~elasticity_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for TensorElement(FiniteElement('Discontinuous Lagrange', tetrahedron, 0), shape=(3, 3), symmetry={})";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -6309,7 +6315,7 @@ public:
       }
     case 3:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -6317,45 +6323,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 9*num_global_entities[3];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 4;
+    return 9;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 0;
         break;
       }
     case 1:
@@ -6370,7 +6365,7 @@ public:
       }
     case 3:
       {
-        return 0;
+        return 9;
         break;
       }
     }
@@ -6378,58 +6373,62 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[1] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[2] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[3] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[4] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[5] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[6] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[7] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
+    dofs[8] = offset + entity_indices[3][0];
+    offset += num_global_entities[3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
+        
         break;
       }
     case 1:
       {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
+        
         break;
       }
     case 3:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6440,35 +6439,7 @@ public:
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -6483,84 +6454,120 @@ public:
       }
     case 3:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 3;
+      dofs[4] = 4;
+      dofs[5] = 5;
+      dofs[6] = 6;
+      dofs[7] = 7;
+      dofs[8] = 8;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 9;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new elasticity_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new elasticity_dofmap_2();
+        break;
+      }
+    case 2:
+      {
+        return new elasticity_dofmap_2();
+        break;
+      }
+    case 3:
+      {
+        return new elasticity_dofmap_2();
+        break;
+      }
+    case 4:
+      {
+        return new elasticity_dofmap_2();
+        break;
+      }
+    case 5:
+      {
+        return new elasticity_dofmap_2();
+        break;
+      }
+    case 6:
+      {
+        return new elasticity_dofmap_2();
+        break;
+      }
+    case 7:
+      {
+        return new elasticity_dofmap_2();
+        break;
+      }
+    case 8:
+      {
+        return new elasticity_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new elasticity_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class elasticity_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   elasticity_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_dofmap_4()
+  ~elasticity_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "FFC dofmap for FiniteElement('Real', tetrahedron, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return true;
+        return false;
         break;
       }
     case 1:
@@ -6583,45 +6590,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3*num_global_entities[0];
+    return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 9;
+    return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 3;
+        return 0;
         break;
       }
     case 1:
@@ -6636,7 +6632,7 @@ public:
       }
     case 3:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -6644,94 +6640,44 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[0][0];
-    dofs[5] = offset + c.entity_indices[0][1];
-    dofs[6] = offset + c.entity_indices[0][2];
-    dofs[7] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[8] = offset + c.entity_indices[0][0];
-    dofs[9] = offset + c.entity_indices[0][1];
-    dofs[10] = offset + c.entity_indices[0][2];
-    dofs[11] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
+    dofs[0] = 0;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 5;
-      dofs[4] = 6;
-      dofs[5] = 7;
-      dofs[6] = 9;
-      dofs[7] = 10;
-      dofs[8] = 11;
+        
         break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 6;
-      dofs[5] = 7;
-      dofs[6] = 8;
-      dofs[7] = 10;
-      dofs[8] = 11;
+      }
+    case 1:
+      {
+        
         break;
       }
     case 2:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 7;
-      dofs[6] = 8;
-      dofs[7] = 9;
-      dofs[8] = 11;
+        
         break;
       }
     case 3:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 6;
-      dofs[6] = 8;
-      dofs[7] = 9;
-      dofs[8] = 10;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6742,43 +6688,7 @@ public:
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 4;
-        dofs[2] = 8;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 5;
-        dofs[2] = 9;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 6;
-        dofs[2] = 10;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-        dofs[1] = 7;
-        dofs[2] = 11;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 1:
@@ -6793,130 +6703,65 @@ public:
       }
     case 3:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = vertex_coordinates[6];
-    dof_coordinates[19] = vertex_coordinates[7];
-    dof_coordinates[20] = vertex_coordinates[8];
-    dof_coordinates[21] = vertex_coordinates[9];
-    dof_coordinates[22] = vertex_coordinates[10];
-    dof_coordinates[23] = vertex_coordinates[11];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[6];
-    dof_coordinates[31] = vertex_coordinates[7];
-    dof_coordinates[32] = vertex_coordinates[8];
-    dof_coordinates[33] = vertex_coordinates[9];
-    dof_coordinates[34] = vertex_coordinates[10];
-    dof_coordinates[35] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new elasticity_dofmap_3();
-        break;
-      }
-    case 1:
-      {
-        return new elasticity_dofmap_3();
-        break;
-      }
-    case 2:
-      {
-        return new elasticity_dofmap_3();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new elasticity_dofmap_4();
   }
 
 };
 
-/// 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 elasticity_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   elasticity_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~elasticity_cell_integral_0_otherwise()
+  ~elasticity_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -6937,7 +6782,7 @@ public:
     // Quadrature points on the UFC reference element: (0.25, 0.25, 0.25)
     
     // Values of basis functions at quadrature points.
-    static const double FE0_C0_D001[1][2] = \
+    static const double FE1_C0_D001[1][2] = \
     {{-1.0, 1.0}};
     
     // Array of non-zero columns
@@ -7034,167 +6879,167 @@ public:
         for (unsigned int k = 0; k < 2; k++)
         {
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc10[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[0];
+          A[nzc10[j]*12 + nzc10[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[0];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc11[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[1];
+          A[nzc10[j]*12 + nzc11[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[1];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[2];
+          A[nzc10[j]*12 + nzc1[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[2];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[3];
+          A[nzc10[j]*12 + nzc2[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[3];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc3[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[4];
+          A[nzc10[j]*12 + nzc3[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[4];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[5];
+          A[nzc10[j]*12 + nzc5[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc6[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[6];
+          A[nzc10[j]*12 + nzc6[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[6];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[7];
+          A[nzc10[j]*12 + nzc7[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[7];
           // Number of operations to compute entry: 3
-          A[nzc10[j]*12 + nzc9[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[8];
+          A[nzc10[j]*12 + nzc9[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[8];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc10[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[1];
+          A[nzc11[j]*12 + nzc10[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[1];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc11[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[9];
+          A[nzc11[j]*12 + nzc11[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[9];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[10];
+          A[nzc11[j]*12 + nzc1[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[10];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[11];
+          A[nzc11[j]*12 + nzc2[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[11];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc3[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[12];
+          A[nzc11[j]*12 + nzc3[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[12];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[13];
+          A[nzc11[j]*12 + nzc5[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[13];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc6[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[14];
+          A[nzc11[j]*12 + nzc6[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[14];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[15];
+          A[nzc11[j]*12 + nzc7[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[15];
           // Number of operations to compute entry: 3
-          A[nzc11[j]*12 + nzc9[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[16];
+          A[nzc11[j]*12 + nzc9[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[16];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*12 + nzc10[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[2];
+          A[nzc1[j]*12 + nzc10[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[2];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*12 + nzc11[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[10];
+          A[nzc1[j]*12 + nzc11[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[10];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*12 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[17];
+          A[nzc1[j]*12 + nzc1[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[17];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*12 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[18];
+          A[nzc1[j]*12 + nzc2[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[18];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*12 + nzc3[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[19];
+          A[nzc1[j]*12 + nzc3[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[19];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*12 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[20];
+          A[nzc1[j]*12 + nzc5[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[20];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*12 + nzc6[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[21];
+          A[nzc1[j]*12 + nzc6[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[21];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*12 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[22];
+          A[nzc1[j]*12 + nzc7[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[22];
           // Number of operations to compute entry: 3
-          A[nzc1[j]*12 + nzc9[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[23];
+          A[nzc1[j]*12 + nzc9[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[23];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*12 + nzc10[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[3];
+          A[nzc2[j]*12 + nzc10[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[3];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*12 + nzc11[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[11];
+          A[nzc2[j]*12 + nzc11[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[11];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*12 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[18];
+          A[nzc2[j]*12 + nzc1[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[18];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*12 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[24];
+          A[nzc2[j]*12 + nzc2[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[24];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*12 + nzc3[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[25];
+          A[nzc2[j]*12 + nzc3[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[25];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*12 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[26];
+          A[nzc2[j]*12 + nzc5[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[26];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*12 + nzc6[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[27];
+          A[nzc2[j]*12 + nzc6[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[27];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*12 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[28];
+          A[nzc2[j]*12 + nzc7[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[28];
           // Number of operations to compute entry: 3
-          A[nzc2[j]*12 + nzc9[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[29];
+          A[nzc2[j]*12 + nzc9[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[29];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc10[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[4];
+          A[nzc3[j]*12 + nzc10[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[4];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc11[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[12];
+          A[nzc3[j]*12 + nzc11[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[12];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[19];
+          A[nzc3[j]*12 + nzc1[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[19];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[25];
+          A[nzc3[j]*12 + nzc2[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[25];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc3[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[30];
+          A[nzc3[j]*12 + nzc3[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[30];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[31];
+          A[nzc3[j]*12 + nzc5[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[31];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc6[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[32];
+          A[nzc3[j]*12 + nzc6[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[32];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[33];
+          A[nzc3[j]*12 + nzc7[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[33];
           // Number of operations to compute entry: 3
-          A[nzc3[j]*12 + nzc9[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[34];
+          A[nzc3[j]*12 + nzc9[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[34];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc10[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[5];
+          A[nzc5[j]*12 + nzc10[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[5];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc11[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[13];
+          A[nzc5[j]*12 + nzc11[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[13];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[20];
+          A[nzc5[j]*12 + nzc1[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[20];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[26];
+          A[nzc5[j]*12 + nzc2[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[26];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc3[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[31];
+          A[nzc5[j]*12 + nzc3[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[31];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[35];
+          A[nzc5[j]*12 + nzc5[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[35];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc6[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[36];
+          A[nzc5[j]*12 + nzc6[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[36];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[37];
+          A[nzc5[j]*12 + nzc7[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[37];
           // Number of operations to compute entry: 3
-          A[nzc5[j]*12 + nzc9[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[38];
+          A[nzc5[j]*12 + nzc9[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[38];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc10[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[6];
+          A[nzc6[j]*12 + nzc10[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[6];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc11[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[14];
+          A[nzc6[j]*12 + nzc11[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[14];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[21];
+          A[nzc6[j]*12 + nzc1[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[21];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[27];
+          A[nzc6[j]*12 + nzc2[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[27];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc3[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[32];
+          A[nzc6[j]*12 + nzc3[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[32];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[36];
+          A[nzc6[j]*12 + nzc5[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[36];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc6[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[39];
+          A[nzc6[j]*12 + nzc6[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[39];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[40];
+          A[nzc6[j]*12 + nzc7[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[40];
           // Number of operations to compute entry: 3
-          A[nzc6[j]*12 + nzc9[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[41];
+          A[nzc6[j]*12 + nzc9[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[41];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc10[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[7];
+          A[nzc7[j]*12 + nzc10[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[7];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc11[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[15];
+          A[nzc7[j]*12 + nzc11[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[15];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[22];
+          A[nzc7[j]*12 + nzc1[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[22];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[28];
+          A[nzc7[j]*12 + nzc2[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[28];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc3[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[33];
+          A[nzc7[j]*12 + nzc3[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[33];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[37];
+          A[nzc7[j]*12 + nzc5[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[37];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc6[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[40];
+          A[nzc7[j]*12 + nzc6[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[40];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[42];
+          A[nzc7[j]*12 + nzc7[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[42];
           // Number of operations to compute entry: 3
-          A[nzc7[j]*12 + nzc9[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[43];
+          A[nzc7[j]*12 + nzc9[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[43];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc10[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[8];
+          A[nzc9[j]*12 + nzc10[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[8];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc11[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[16];
+          A[nzc9[j]*12 + nzc11[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[16];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc1[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[23];
+          A[nzc9[j]*12 + nzc1[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[23];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc2[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[29];
+          A[nzc9[j]*12 + nzc2[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[29];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc3[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[34];
+          A[nzc9[j]*12 + nzc3[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[34];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc5[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[38];
+          A[nzc9[j]*12 + nzc5[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[38];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc6[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[41];
+          A[nzc9[j]*12 + nzc6[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[41];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc7[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[43];
+          A[nzc9[j]*12 + nzc7[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[43];
           // Number of operations to compute entry: 3
-          A[nzc9[j]*12 + nzc9[k]] += FE0_C0_D001[0][j]*FE0_C0_D001[0][k]*G[44];
+          A[nzc9[j]*12 + nzc9[k]] += FE1_C0_D001[0][j]*FE1_C0_D001[0][k]*G[44];
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -7202,38 +7047,31 @@ public:
 
 };
 
-/// 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 elasticity_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   elasticity_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~elasticity_cell_integral_1_otherwise()
+  ~elasticity_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    12
@@ -7242,7 +7080,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7283,42 +7121,35 @@ public:
 
 };
 
-/// 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 elasticity_cell_integral_2_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   elasticity_cell_integral_2_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~elasticity_cell_integral_2_otherwise()
+  ~elasticity_cell_integral_2_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7380,42 +7211,35 @@ public:
 
 };
 
-/// 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 elasticity_cell_integral_3_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   elasticity_cell_integral_3_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~elasticity_cell_integral_3_otherwise()
+  ~elasticity_cell_integral_3_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7436,7 +7260,7 @@ public:
     // Quadrature points on the UFC reference element: (0.25, 0.25, 0.25)
     
     // Values of basis functions at quadrature points.
-    static const double FE1_C0_D001[1][2] = \
+    static const double FE2_C0_D001[1][2] = \
     {{-1.0, 1.0}};
     
     // Array of non-zero columns
@@ -7523,15 +7347,15 @@ public:
       // Total number of operations to compute function values = 36
       for (unsigned int r = 0; r < 2; r++)
       {
-        F0 += FE1_C0_D001[0][r]*w[2][nzc12[r]];
-        F1 += FE1_C0_D001[0][r]*w[2][nzc11[r]];
-        F2 += FE1_C0_D001[0][r]*w[2][nzc10[r]];
-        F3 += FE1_C0_D001[0][r]*w[2][nzc16[r]];
-        F4 += FE1_C0_D001[0][r]*w[2][nzc15[r]];
-        F5 += FE1_C0_D001[0][r]*w[2][nzc14[r]];
-        F6 += FE1_C0_D001[0][r]*w[2][nzc20[r]];
-        F7 += FE1_C0_D001[0][r]*w[2][nzc19[r]];
-        F8 += FE1_C0_D001[0][r]*w[2][nzc18[r]];
+        F0 += FE2_C0_D001[0][r]*w[2][nzc12[r]];
+        F1 += FE2_C0_D001[0][r]*w[2][nzc11[r]];
+        F2 += FE2_C0_D001[0][r]*w[2][nzc10[r]];
+        F3 += FE2_C0_D001[0][r]*w[2][nzc16[r]];
+        F4 += FE2_C0_D001[0][r]*w[2][nzc15[r]];
+        F5 += FE2_C0_D001[0][r]*w[2][nzc14[r]];
+        F6 += FE2_C0_D001[0][r]*w[2][nzc20[r]];
+        F7 += FE2_C0_D001[0][r]*w[2][nzc19[r]];
+        F8 += FE2_C0_D001[0][r]*w[2][nzc18[r]];
       } // end loop over 'r'
       
       // Number of operations to compute ip constants: 84
@@ -7579,87 +7403,79 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class elasticity_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   elasticity_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_form_0()
+  ~elasticity_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "34440b64adf5ad7012cadee1d1fdcc41208b042cdc306afeb654dadeb12bed0dcfb6fe0c3eb4f0b785f45633af88a153f2929ff0f288e8f0b60a4205c4f22c22";
+    return "a57c2fc50db266371d9a4aedb8537803f69551063e724687156dc1234cd01f19b10b8cfe4e15b8a48565c4c3dd28f747a014d9e52b522ba45f311c0e878c5b4d";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new elasticity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new elasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_finite_element_4();
+        return new elasticity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new elasticity_finite_element_4();
+        return new elasticity_finite_element_1();
         break;
       }
     case 2:
       {
-        return new elasticity_finite_element_2();
+        return new elasticity_finite_element_4();
         break;
       }
     case 3:
       {
-        return new elasticity_finite_element_2();
+        return new elasticity_finite_element_4();
         break;
       }
     }
@@ -7667,29 +7483,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_dofmap_4();
+        return new elasticity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new elasticity_dofmap_4();
+        return new elasticity_dofmap_1();
         break;
       }
     case 2:
       {
-        return new elasticity_dofmap_2();
+        return new elasticity_dofmap_4();
         break;
       }
     case 3:
       {
-        return new elasticity_dofmap_2();
+        return new elasticity_dofmap_4();
         break;
       }
     }
@@ -7697,203 +7512,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new elasticity_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class elasticity_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   elasticity_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_form_1()
+  ~elasticity_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "fa68fa6ec05d7d278da7ee3d8a7ab8501f708225e753a10a84685090e0495eddd4443ab0ff6c3258ef43e65c2db1fa8ffc767afa126c7f6a77e8eab0029883e0";
+    return "88cc47999be9310fd80d57d9bd4d65c762c87eb44e3af4be14db98ade91876e59d84bf815705157a4309a8401b52003c9dec97ba22d87863f6ec18240283b3ac";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new elasticity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new elasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_finite_element_4();
+        return new elasticity_finite_element_1();
         break;
       }
     case 1:
       {
-        return new elasticity_finite_element_4();
+        return new elasticity_finite_element_1();
         break;
       }
     }
@@ -7901,19 +7744,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_dofmap_4();
+        return new elasticity_dofmap_1();
         break;
       }
     case 1:
       {
-        return new elasticity_dofmap_4();
+        return new elasticity_dofmap_1();
         break;
       }
     }
@@ -7921,203 +7763,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new elasticity_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class elasticity_form_2: public ufc::form
 {
 public:
 
-  /// Constructor
   elasticity_form_2() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_form_2()
+  ~elasticity_form_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "2255e4e3563bf47dcfa7d1fa4742a25719b32a76ce28bbf30ea4fcb54b4146d20c932eedcd6920ae2225a07c023dc36c0fc528d3266ca1b2fa59d26abc287e35";
+    return "14d9d78304d264c8963bb8d58f1456735edd19723f64a1b3aa1124944b27b6d7f437c42b236b24eae917ec92311fcf24660e3ab141fd589ca3f1c6430d7e2afc";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new elasticity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new elasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_finite_element_1();
+        return new elasticity_finite_element_3();
         break;
       }
     case 1:
       {
-        return new elasticity_finite_element_1();
+        return new elasticity_finite_element_3();
         break;
       }
     }
@@ -8125,19 +7995,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_dofmap_1();
+        return new elasticity_dofmap_3();
         break;
       }
     case 1:
       {
-        return new elasticity_dofmap_1();
+        return new elasticity_dofmap_3();
         break;
       }
     }
@@ -8145,213 +8014,241 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new elasticity_cell_integral_2_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class elasticity_form_3: public ufc::form
 {
 public:
 
-  /// Constructor
   elasticity_form_3() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elasticity_form_3()
+  ~elasticity_form_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "d7ba5cf7e894c37f99c6e67fab93183e78d19855b1e3c0150f890e8fea4635141401962cb921a2c2d2f6405908d161ea6a3da856ffc7228f3e43263b58c767dc";
+    return "906b5d546f01564ad19b40329eaf905abb4b42df8e22edfcec87d5ab9f17a92dd275dcebea8e68f0ecdcbcf8e7db2e11e4b7c2531b7a95e455bf8e687f7748e3";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 3;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new elasticity_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new elasticity_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_finite_element_1();
+        return new elasticity_finite_element_3();
         break;
       }
     case 1:
       {
-        return new elasticity_finite_element_2();
+        return new elasticity_finite_element_4();
         break;
       }
     case 2:
       {
-        return new elasticity_finite_element_2();
+        return new elasticity_finite_element_4();
         break;
       }
     case 3:
       {
-        return new elasticity_finite_element_4();
+        return new elasticity_finite_element_1();
         break;
       }
     }
@@ -8359,29 +8256,28 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elasticity_dofmap_1();
+        return new elasticity_dofmap_3();
         break;
       }
     case 1:
       {
-        return new elasticity_dofmap_2();
+        return new elasticity_dofmap_4();
         break;
       }
     case 2:
       {
-        return new elasticity_dofmap_2();
+        return new elasticity_dofmap_4();
         break;
       }
     case 3:
       {
-        return new elasticity_dofmap_4();
+        return new elasticity_dofmap_1();
         break;
       }
     }
@@ -8389,126 +8285,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new elasticity_cell_integral_3_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -8522,14 +8454,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Elasticity
 {
@@ -8538,43 +8476,20 @@ class CoefficientSpace_disp: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_disp(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_disp(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_disp(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_disp(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8585,43 +8500,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8632,43 +8524,20 @@ class CoefficientSpace_lmbda: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8679,43 +8548,20 @@ class CoefficientSpace_mu: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8726,43 +8572,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -8773,45 +8596,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -8825,79 +8665,122 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
+    _ufc_form = std::make_shared<const elasticity_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
     dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->mu = mu;
     this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
+    _ufc_form = std::make_shared<const elasticity_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+  // Destructor
+  ~Form_a()
+  {}
 
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "mu")
+      return 0;
+    else if (name == "lmbda")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    switch (i)
+    {
+    case 0:
+      return "mu";
+    case 1:
+      return "lmbda";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_mu;
+  typedef Form_a_FunctionSpace_3 CoefficientSpace_lmbda;
+
+  // Coefficients
+  dolfin::CoefficientAssigner mu;
+  dolfin::CoefficientAssigner lmbda;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda):
-    dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), mu(*this, 0), lmbda(*this, 1)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->mu = mu;
-    this->lmbda = lmbda;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
-    dolfin::Form(2, 2), mu(*this, 0), lmbda(*this, 1)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda):
+    dolfin::MultiMeshForm(V1, V0), mu(*this, 0), lmbda(*this, 1)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
-    this->mu = *mu;
-    this->lmbda = *lmbda;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->mu = mu;
+    this->lmbda = lmbda;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -8934,57 +8817,56 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_mu;
   typedef Form_a_FunctionSpace_3 CoefficientSpace_lmbda;
 
   // Coefficients
-  dolfin::CoefficientAssigner mu;
-  dolfin::CoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner mu;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
 };
 
 class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh)))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_4()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -8996,69 +8878,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
+    _ufc_form = std::make_shared<const elasticity_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
+    _ufc_form = std::make_shared<const elasticity_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->f = *f;
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -9090,53 +9013,31 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 class Form_a_s_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_s_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_s_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_s_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_s_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -9147,63 +9048,70 @@ class Form_a_s_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_s_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), mesh)))
+  // Constructor for standard function space
+  Form_a_s_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_s_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_s_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_s_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_s_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_s_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_s_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_s_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a_s: public dolfin::Form
+class Form_a_s_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a_s(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_s_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_s_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_2());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a_s: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a_s(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -9211,7 +9119,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_2());
+    _ufc_form = std::make_shared<const elasticity_form_2>();
   }
 
   // Destructor
@@ -9241,57 +9149,112 @@ public:
   // Typedefs
   typedef Form_a_s_FunctionSpace_0 TestSpace;
   typedef Form_a_s_FunctionSpace_1 TrialSpace;
+  typedef Form_a_s_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_s_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_s_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a_s: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a_s(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a_s(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a_s()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_s_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_s_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_s_FunctionSpace_0 TestSpace;
+  typedef Form_a_s_FunctionSpace_1 TrialSpace;
+  typedef Form_a_s_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_s_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_s_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_s_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_s_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_s_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elasticity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elasticity_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elasticity_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elasticity_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_s_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_s_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_s_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_mu Form_L_s_FunctionSpace_1;
 
 typedef CoefficientSpace_lmbda Form_L_s_FunctionSpace_2;
@@ -9303,77 +9266,126 @@ class Form_L_s: public dolfin::Form
 public:
 
   // Constructor
-  Form_L_s(const dolfin::FunctionSpace& V0):
+  Form_L_s(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 3), mu(*this, 0), lmbda(*this, 1), disp(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_3());
+    _ufc_form = std::make_shared<const elasticity_form_3>();
   }
 
   // Constructor
-  Form_L_s(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& disp):
+  Form_L_s(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> disp):
     dolfin::Form(1, 3), mu(*this, 0), lmbda(*this, 1), disp(*this, 2)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->mu = mu;
     this->lmbda = lmbda;
     this->disp = disp;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_3());
+    _ufc_form = std::make_shared<const elasticity_form_3>();
   }
 
-  // Constructor
-  Form_L_s(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> disp):
-    dolfin::Form(1, 3), mu(*this, 0), lmbda(*this, 1), disp(*this, 2)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L_s()
+  {}
 
-    this->mu = *mu;
-    this->lmbda = *lmbda;
-    this->disp = *disp;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "mu")
+      return 0;
+    else if (name == "lmbda")
+      return 1;
+    else if (name == "disp")
+      return 2;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_3());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L_s(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 3), mu(*this, 0), lmbda(*this, 1), disp(*this, 2)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "mu";
+    case 1:
+      return "lmbda";
+    case 2:
+      return "disp";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_3());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_s_FunctionSpace_0 TestSpace;
+  typedef Form_L_s_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_s_FunctionSpace_1 CoefficientSpace_mu;
+  typedef Form_L_s_FunctionSpace_2 CoefficientSpace_lmbda;
+  typedef Form_L_s_FunctionSpace_3 CoefficientSpace_disp;
+
+  // Coefficients
+  dolfin::CoefficientAssigner mu;
+  dolfin::CoefficientAssigner lmbda;
+  dolfin::CoefficientAssigner disp;
+};
+
+class MultiMeshForm_L_s: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L_s(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& disp):
-    dolfin::Form(1, 3), mu(*this, 0), lmbda(*this, 1), disp(*this, 2)
+  MultiMeshForm_L_s(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), mu(*this, 0), lmbda(*this, 1), disp(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L_s(V0->part(part)));
+      add(a);
+    }
 
-    this->mu = mu;
-    this->lmbda = lmbda;
-    this->disp = disp;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_3());
   }
 
   // Constructor
-  Form_L_s(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> disp):
-    dolfin::Form(1, 3), mu(*this, 0), lmbda(*this, 1), disp(*this, 2)
+  MultiMeshForm_L_s(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> disp):
+    dolfin::MultiMeshForm(V0), mu(*this, 0), lmbda(*this, 1), disp(*this, 2)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L_s(V0->part(part)));
+      add(a);
+    }
 
-    this->mu = *mu;
-    this->lmbda = *lmbda;
-    this->disp = *disp;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->mu = mu;
+    this->lmbda = lmbda;
+    this->disp = disp;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elasticity_form_3());
   }
 
   // Destructor
-  ~Form_L_s()
+  ~MultiMeshForm_L_s()
   {}
 
   /// Return the number of the coefficient with this name
@@ -9413,14 +9425,15 @@ public:
 
   // Typedefs
   typedef Form_L_s_FunctionSpace_0 TestSpace;
+  typedef Form_L_s_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_s_FunctionSpace_1 CoefficientSpace_mu;
   typedef Form_L_s_FunctionSpace_2 CoefficientSpace_lmbda;
   typedef Form_L_s_FunctionSpace_3 CoefficientSpace_disp;
 
   // Coefficients
-  dolfin::CoefficientAssigner mu;
-  dolfin::CoefficientAssigner lmbda;
-  dolfin::CoefficientAssigner disp;
+  dolfin::MultiMeshCoefficientAssigner mu;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner disp;
 };
 
 
diff --git a/demo/undocumented/elasticity/cpp/compile.log b/demo/undocumented/elasticity/cpp/compile.log
index 9d286b0..2c73ce8 100644
--- a/demo/undocumented/elasticity/cpp/compile.log
+++ b/demo/undocumented/elasticity/cpp/compile.log
@@ -1,6 +1,9 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
+Expr.geometric_dimension() is deprecated, please use find_geometric_dimension(expr) instead.
+Expr.geometric_dimension() is deprecated, please use find_geometric_dimension(expr) instead.
 Compiling form Elasticity
 
 Compiler stage 1: Analyzing form(s)
@@ -19,9 +22,9 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for terminal Identity.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -45,9 +48,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -55,8 +58,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Tensor<(3, 3) x DG0(?)>'
-  Unique sub elements:       'Tensor<(3, 3) x DG0(?)>, DG0(?)'
+  Unique elements:           'Tensor<(3, 3) x DG0(?)>, Vector<3 x CG1(?)>'
+  Unique sub elements:       'Tensor<(3, 3) x DG0(?)>, Vector<3 x CG1(?)>, DG0(?), C
+                             G1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -71,9 +75,9 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: MonomialTransformation does not handle tensor-valued elements
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -89,11 +93,11 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for terminal Identity.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.0656281 seconds.
+Compiler stage 1 finished in 0.0986412 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -107,12 +111,19 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 5 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -123,7 +134,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {FiniteElement('Real', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0, 0): array([[ 1.]])}}}, VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1.],
+  {1: {FiniteElement('Real', tetrahedron, 0): {None: {None: {(0, 0, 0): array([[ 1.]])}}}, VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1.],
           [ 0.],
           [ 0.]],
   
@@ -310,61 +321,61 @@ Compiler stage 2: Computing intermediate representation
           [  1.00000000e+00]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
-            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+  {'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
+           0.25,  0.25,  0.25]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
-           0.25,  0.25,  0.25]]), 'FE0_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE0_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
-           0.  ,  0.  ,  0.  ]])}
-  
-  tables: {'FE0_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0': array([[ 1.]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE0_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+  
+  tables: {'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE1_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
+           0.25,  0.25,  0.25]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE0_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0': array([[ 1.]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1': array([[ 1.]]), 'FE0_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE0_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
-           0.25,  0.25,  0.25]]), 'FE0_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE0_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
-           0.  ,  0.  ,  0.  ]])}
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
+            0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
   
   name_map: {}
   
-  inv_name_map: {'FE0_C2_D001': 'FE0_C2_D001', 'FE0_C1_D001': 'FE0_C1_D001', 'FE0_C1_D010': 'FE0_C1_D010', 'FE0_C2_D010': 'FE0_C2_D010', 'FE0_C1_D100': 'FE0_C1_D100', 'FE0_C0_D100': 'FE0_C0_D100', 'FE0_C0_D010': 'FE0_C0_D010', 'FE0_C0_D001': 'FE0_C0_D001', 'FE1': 'FE1', 'FE0_C2_D100': 'FE0_C2_D100', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE1_C0_D001': 'FE1_C0_D001', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE1_C0_D100': 'FE1_C0_D100', 'FE1_C2_D001': 'FE1_C2_D001', 'FE1_C0_D010': 'FE1_C0_D010', 'FE1_C1_D010': 'FE1_C1_D010', 'FE1_C1_D100': 'FE1_C1_D100', 'FE1_C2_D100': 'FE1_C2_D100', 'FE0': 'FE0', 'FE1_C2_D010': 'FE1_C2_D010', 'FE1_C1_D001': 'FE1_C1_D001'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE0_C0_D001': array([[-1.,  1.]]), 'FE1': array([[ 1.]]), 'FE0_C0': array([[ 0.25,  0.25,  0.25,  0.25]])}
+  {'FE1_C0_D001': array([[-1.,  1.]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25]]), 'FE0': array([[ 1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C2_D001': ('FE0_C0_D001', (9, [8, 11]), False, False), 'FE0_C1_D001': ('FE0_C0_D001', (5, [4, 7]), False, False), 'FE0_C1_D010': ('FE0_C0_D001', (6, [4, 6]), False, False), 'FE0_C2_D010': ('FE0_C0_D001', (10, [8, 10]), False, False), 'FE0_C1_D100': ('FE0_C0_D001', (7, [4, 5]), False, False), 'FE0_C0_D100': ('FE0_C0_D001', (3, [0, 1]), False, False), 'FE0_C0_D010': ('FE0_C0_D001', (2, [0, 2]), False, False), 'FE0_C0_D001': ('FE0_C0_D001', (1, [0, 3]), False, False), 'FE1': ('FE1', [...]
+  {'FE1_C0_D001': ('FE1_C0_D001', (1, [0, 3]), False, False), 'FE1_C0': ('FE1_C0', (0, [0, 1, 2, 3]), False, False), 'FE1_C1': ('FE1_C0', (4, [4, 5, 6, 7]), False, False), 'FE1_C2': ('FE1_C0', (8, [8, 9, 10, 11]), False, False), 'FE1_C0_D100': ('FE1_C0_D001', (3, [0, 1]), False, False), 'FE1_C2_D001': ('FE1_C0_D001', (9, [8, 11]), False, False), 'FE1_C0_D010': ('FE1_C0_D001', (2, [0, 2]), False, False), 'FE1_C1_D010': ('FE1_C0_D001', (6, [4, 6]), False, False), 'FE1_C1_D100': ('FE1_C0_D0 [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -597,7 +608,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.00266 seconds
+  144 entries computed in 0.00125 seconds
   Shape of reference tensor: (12, 12)
   Primary multi index:   rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -611,97 +622,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {TensorElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, shape=(3, 3), symmetry={}, quad_scheme=None): {None: {None: {(0, 0, 0): array([[[ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.]]])}}}, VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1.],
+  {1: {VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1.],
           [ 0.],
           [ 0.]],
   
@@ -885,7 +809,95 @@ Compiler stage 2: Computing intermediate representation
   
          [[  0.00000000e+00],
           [  0.00000000e+00],
-          [  1.00000000e+00]]])}}}}}
+          [  1.00000000e+00]]])}}}, TensorElement(FiniteElement('Discontinuous Lagrange', tetrahedron, 0), shape=(3, 3), symmetry={}): {None: {None: {(0, 0, 0): array([[[ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C0_D001': array([[ -1.00000000e+00,  -5.55111512e-17,   0.00000000e+00,
@@ -992,119 +1004,31 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {FiniteElement('Real', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0, 0): array([[ 1.]])}}}, TensorElement('Discontinuous Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 0, shape=(3, 3), symmetry={}, quad_scheme=None): {None: {None: {(0, 0, 0): array([[[ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
+  {1: {FiniteElement('Real', tetrahedron, 0): {None: {None: {(0, 0, 0): array([[ 1.]])}}}, VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3): {None: {None: {(1, 0, 0): array([[[-1.],
           [ 0.],
+          [ 0.]],
+  
+         [[ 1.],
           [ 0.],
           [ 0.]],
   
          [[ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
           [ 0.],
           [ 0.]],
   
          [[ 0.],
           [ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
           [ 0.]],
   
          [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
+          [-1.],
           [ 0.]],
   
          [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
           [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 0.],
-          [ 1.]]])}}}, VectorElement('Lagrange', Domain(Cell('tetrahedron', 3), label=None, data=None), 1, dim=3, quad_scheme=None): {None: {None: {(1, 0, 0): array([[[-1.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 1.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 0.],
-          [ 0.]],
-  
-         [[ 0.],
-          [-1.],
-          [ 0.]],
-  
-         [[ 0.],
-          [ 1.],
-          [ 0.]],
-  
-         [[ 0.],
+          [ 0.]],
+  
+         [[ 0.],
           [ 0.],
           [ 0.]],
   
@@ -1264,64 +1188,152 @@ Compiler stage 2: Computing intermediate representation
   
          [[  0.00000000e+00],
           [  0.00000000e+00],
-          [  1.00000000e+00]]])}}}}}
+          [  1.00000000e+00]]])}}}, TensorElement(FiniteElement('Discontinuous Lagrange', tetrahedron, 0), shape=(3, 3), symmetry={}): {None: {None: {(0, 0, 0): array([[[ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.],
+          [ 0.]],
+  
+         [[ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 0.],
+          [ 1.]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+  {'FE2_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C6': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,  0.]]), 'FE2_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.]]), 'FE0_C8': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.]]), 'FE0_C7': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.]]), 'FE0_C6': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,  0.]]), 'FE0_C5': array([[ 0.,  0.,  0.,  0.,  0.,  1.,  0.,  0.,  0.]]), 'FE0_C4': array([[ 0.,  0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C3': array([[ 0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C [...]
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE1_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE1_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
-           0.25,  0.25,  0.25]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE2_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE2_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
+           0.25,  0.25,  0.25]]), 'FE2_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0': array([[ 1.]]), 'FE2_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
-  
-  tables: {'FE1_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C8': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.]]), 'FE2_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0': array([[ 1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C1': array([[ 0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2': array([[ 0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C3': array([[ 0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C4': [...]
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]])}
+  
+  tables: {'FE2_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C6': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,  0.]]), 'FE2_C1_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -1.11022302e-16,
             1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2': array([[ 1.]]), 'FE0_C8': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.]]), 'FE0_C7': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.]]), 'FE0_C6': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,  0.]]), 'FE0_C5': array([[ 0.,  0.,  0.,  0.,  0.,  1.,  0.,  0.,  0.]]), 'FE0_C4': array([[ 0.,  0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C3': array([[ 0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE0_C [...]
-            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C0_D010': array([[ -1.00000000e+00,  -1.11022302e-16,   1.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE1_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
-           0.  ,  0.  ,  0.  ]]), 'FE1_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
-           0.25,  0.25,  0.25]]), 'FE1_C0_D100': array([[-1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C1': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.25,  0.25,  0.25,  0.25,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE2_C0': array([[ 0.25,  0.25,  0.25,  0.25,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,
+           0.  ,  0.  ,  0.  ]]), 'FE2_C2': array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.  ,  0.25,
+           0.25,  0.25,  0.25]]), 'FE2_C2_D010': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
-           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]]), 'FE1_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2_D100': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0., -1.,  1.,  0.,  0.]]), 'FE1_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.11022302e-16,   1.00000000e+00,   0.00000000e+00]]), 'FE0': array([[ 1.]]), 'FE2_C1_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
             0.00000000e+00,  -1.00000000e+00,  -5.55111512e-17,
             0.00000000e+00,   1.00000000e+00,   0.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C8': array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.]]), 'FE2_C1_D100': array([[ 0.,  0.,  0.,  0., -1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C0': array([[ 1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C1': array([[ 0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C2': array([[ 0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C3': array([[ 0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.]]), 'FE1_C4': [...]
+            1.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE2_C2_D001': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,  -1.00000000e+00,
+           -5.55111512e-17,   0.00000000e+00,   1.00000000e+00]])}
   
   name_map: {}
   
-  inv_name_map: {'FE1_C0_D010': 'FE1_C0_D010', 'FE1_C2_D010': 'FE1_C2_D010', 'FE1_C1_D010': 'FE1_C1_D010', 'FE2': 'FE2', 'FE0_C8': 'FE0_C8', 'FE0_C7': 'FE0_C7', 'FE0_C6': 'FE0_C6', 'FE0_C5': 'FE0_C5', 'FE0_C4': 'FE0_C4', 'FE0_C3': 'FE0_C3', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0', 'FE1_C0_D001': 'FE1_C0_D001', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE1_C0_D100': 'FE1_C0_D100', 'FE1_C2_D001': 'FE1_C2_D001', 'FE1_C1_D100': 'FE1_C1_D100', 'FE1_C2_D10 [...]
+  inv_name_map: {'FE2_C0_D100': 'FE2_C0_D100', 'FE2_C2_D100': 'FE2_C2_D100', 'FE2_C1_D010': 'FE2_C1_D010', 'FE2_C0_D010': 'FE2_C0_D010', 'FE2_C1': 'FE2_C1', 'FE2_C0': 'FE2_C0', 'FE2_C2': 'FE2_C2', 'FE2_C2_D010': 'FE2_C2_D010', 'FE0': 'FE0', 'FE2_C1_D001': 'FE2_C1_D001', 'FE1_C8': 'FE1_C8', 'FE2_C1_D100': 'FE2_C1_D100', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE1_C3': 'FE1_C3', 'FE1_C4': 'FE1_C4', 'FE1_C5': 'FE1_C5', 'FE1_C6': 'FE1_C6', 'FE1_C7': 'FE1_C7', 'FE2_C0_D00 [...]
   
   QG-utils, psi_tables, unique_tables:
-  {'FE0_C0': array([[ 1.]]), 'FE1_C0_D001': array([[-1.,  1.]]), 'FE1_C0': array([[ 0.25,  0.25,  0.25,  0.25]])}
+  {'FE2_C0': array([[ 0.25,  0.25,  0.25,  0.25]]), 'FE0': array([[ 1.]]), 'FE2_C0_D001': array([[-1.,  1.]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE1_C0_D010': ('FE1_C0_D001', (11, [0, 2]), False, False), 'FE1_C2_D010': ('FE1_C0_D001', (19, [8, 10]), False, False), 'FE1_C1_D010': ('FE1_C0_D001', (15, [4, 6]), False, False), 'FE2': ('FE0_C0', (), False, True), 'FE0_C8': ('FE0_C0', (8, [8]), False, True), 'FE0_C7': ('FE0_C0', (7, [7]), False, True), 'FE0_C6': ('FE0_C0', (6, [6]), False, True), 'FE0_C5': ('FE0_C0', (5, [5]), False, True), 'FE0_C4': ('FE0_C0', (4, [4]), False, True), 'FE0_C3': ('FE0_C0', (3, [3]), False, True), 'F [...]
+  {'FE2_C0_D100': ('FE2_C0_D001', (12, [0, 1]), False, False), 'FE2_C2_D100': ('FE2_C0_D001', (20, [8, 9]), False, False), 'FE2_C1_D010': ('FE2_C0_D001', (15, [4, 6]), False, False), 'FE2_C0_D010': ('FE2_C0_D001', (11, [0, 2]), False, False), 'FE2_C1': ('FE2_C0', (13, [4, 5, 6, 7]), False, False), 'FE2_C0': ('FE2_C0', (9, [0, 1, 2, 3]), False, False), 'FE2_C2': ('FE2_C0', (17, [8, 9, 10, 11]), False, False), 'FE2_C2_D010': ('FE2_C0_D001', (19, [8, 10]), False, False), 'FE0': ('FE0', (),  [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -1526,7 +1538,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.263283 seconds.
+Compiler stage 2 finished in 0.213601 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
@@ -1534,7 +1546,7 @@ Compiler stage 3: Optimizing intermediate representation
   Optimising expressions for cell integral
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.0379291 seconds.
+Compiler stage 3 finished in 0.0405469 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
@@ -1543,489 +1555,232 @@ Compiler stage 4: Generating code
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Z
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: d_22
-  Removing unused variable: d_21
-  Removing unused variable: d_20
-  Removing unused variable: d_12
-  Removing unused variable: d_11
-  Removing unused variable: d_10
-  Removing unused variable: d_02
-  Removing unused variable: d_01
-  Removing unused variable: d_00
-  Removing unused variable: C2
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Z
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: d_22
-  Removing unused variable: d_21
-  Removing unused variable: d_20
-  Removing unused variable: d_12
-  Removing unused variable: d_11
-  Removing unused variable: d_10
-  Removing unused variable: d_02
-  Removing unused variable: d_01
-  Removing unused variable: d_00
-  Removing unused variable: C2
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Z
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: d_22
-  Removing unused variable: d_21
-  Removing unused variable: d_20
-  Removing unused variable: d_12
-  Removing unused variable: d_11
-  Removing unused variable: d_10
-  Removing unused variable: d_02
-  Removing unused variable: d_01
-  Removing unused variable: d_00
-  Removing unused variable: C2
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Z
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: d_22
+  Removing unused variable: d_21
+  Removing unused variable: d_20
+  Removing unused variable: d_12
+  Removing unused variable: d_11
+  Removing unused variable: d_10
+  Removing unused variable: d_02
+  Removing unused variable: d_01
+  Removing unused variable: d_00
+  Removing unused variable: C2
+  Removing unused variable: C1
+  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Z
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: d_22
+  Removing unused variable: d_21
+  Removing unused variable: d_20
+  Removing unused variable: d_12
+  Removing unused variable: d_11
+  Removing unused variable: d_10
+  Removing unused variable: d_02
+  Removing unused variable: d_01
+  Removing unused variable: d_00
+  Removing unused variable: C2
+  Removing unused variable: C1
+  Removing unused variable: C0
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Z
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: d_22
+  Removing unused variable: d_21
+  Removing unused variable: d_20
+  Removing unused variable: d_12
+  Removing unused variable: d_11
+  Removing unused variable: d_10
+  Removing unused variable: d_02
+  Removing unused variable: d_01
+  Removing unused variable: d_00
+  Removing unused variable: C2
+  Removing unused variable: C1
+  Removing unused variable: C0
   Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: area
@@ -2068,18 +1823,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.256759 seconds.
+Compiler stage 4 finished in 0.243112 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000931978 seconds.
+Compiler stage 4.1 finished in 0.000923872 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Elasticity.h.
-Compiler stage 5 finished in 0.000920057 seconds.
+Compiler stage 5 finished in 0.000668049 seconds.
 
-FFC finished in 0.625769 seconds.
+FFC finished in 0.597828 seconds.
+Output written to ./Elasticity.h.
diff --git a/demo/undocumented/elasticity/cpp/main.cpp b/demo/undocumented/elasticity/cpp/main.cpp
index 1d85b9e..51b869f 100644
--- a/demo/undocumented/elasticity/cpp/main.cpp
+++ b/demo/undocumented/elasticity/cpp/main.cpp
@@ -26,16 +26,13 @@ using namespace dolfin;
 
 // Function to compute the near nullspace for elasticity - it is made
 // up of the six rigid body modes
-dolfin::VectorSpaceBasis build_nullspace(const dolfin::FunctionSpace& V,
-                                         const GenericVector& x)
+dolfin::VectorSpaceBasis build_near_nullspace(const dolfin::FunctionSpace& V,
+                                              const GenericVector& x)
 {
-  dolfin_assert(V.mesh());
-  const dolfin::Mesh& mesh = *(V.mesh());
-
   // Get subspaces
-  dolfin::SubSpace V0(V, 0);
-  dolfin::SubSpace V1(V, 1);
-  dolfin::SubSpace V2(V, 2);
+  auto V0 = V.sub(0);
+  auto V1 = V.sub(1);
+  auto V2 = V.sub(2);
 
   // Create vectors for nullspace basis
   std::vector<std::shared_ptr<dolfin::GenericVector>> basis(6);
@@ -43,25 +40,28 @@ dolfin::VectorSpaceBasis build_nullspace(const dolfin::FunctionSpace& V,
     basis[i] = x.copy();
 
   // x0, x1, x2 translations
-  V0.dofmap()->set(*basis[0], 1.0);
-  V1.dofmap()->set(*basis[1], 1.0);
-  V2.dofmap()->set(*basis[2], 1.0);
+  V0->dofmap()->set(*basis[0], 1.0);
+  V1->dofmap()->set(*basis[1], 1.0);
+  V2->dofmap()->set(*basis[2], 1.0);
 
   // Rotations
-  V0.dofmap()->set_x(*basis[3], -1.0, 1, mesh);
-  V1.dofmap()->set_x(*basis[3],  1.0, 0, mesh);
+  V0->set_x(*basis[3], -1.0, 1);
+  V1->set_x(*basis[3],  1.0, 0);
 
-  V0.dofmap()->set_x(*basis[4],  1.0, 2, mesh);
-  V2.dofmap()->set_x(*basis[4], -1.0, 0, mesh);
+  V0->set_x(*basis[4],  1.0, 2);
+  V2->set_x(*basis[4], -1.0, 0);
 
-  V2.dofmap()->set_x(*basis[5],  1.0, 1, mesh);
-  V1.dofmap()->set_x(*basis[5], -1.0, 2, mesh);
+  V2->set_x(*basis[5],  1.0, 1);
+  V1->set_x(*basis[5], -1.0, 2);
 
   // Apply
   for (std::size_t i = 0; i < basis.size(); ++i)
     basis[i]->apply("add");
 
-  return dolfin::VectorSpaceBasis(basis);
+  // Create vector space and orthonormalize
+  VectorSpaceBasis vector_space(basis);
+  vector_space.orthonormalize();
+  return vector_space;
 }
 
 
@@ -99,19 +99,19 @@ int main()
   };
 
   // Read mesh
-  Mesh mesh("../pulley.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../pulley.xml.gz");
 
   // Create right-hand side loading function
-  CentripetalLoading f;
+  auto f = std::make_shared<CentripetalLoading>();
 
   // Set elasticity parameters
   double E  = 10.0;
   double nu = 0.3;
-  Constant mu(E/(2.0*(1.0 + nu)));
-  Constant lambda(E*nu/((1.0 + nu)*(1.0 - 2.0*nu)));
+  auto mu = std::make_shared<Constant>(E/(2.0*(1.0 + nu)));
+  auto lambda = std::make_shared<Constant>(E*nu/((1.0 + nu)*(1.0 - 2.0*nu)));
 
   // Create function space
-  Elasticity::Form_a::TestSpace V(mesh);
+  auto V = std::make_shared<Elasticity::Form_a::TestSpace>(mesh);
 
   // Define variational problem
   Elasticity::Form_a a(V, V);
@@ -120,59 +120,60 @@ int main()
   L.f = f;
 
   // Set up boundary condition on inner surface
-  InnerSurface inner_surface;
-  Constant zero(0.0, 0.0, 0.0);
-  DirichletBC bc(V, zero, inner_surface);
+  auto inner_surface = std::make_shared<InnerSurface>();
+  auto zero = std::make_shared<Constant>(0.0, 0.0, 0.0);
+  auto bc = std::make_shared<DirichletBC>(V, zero, inner_surface);
 
   // Assemble system, applying boundary conditions and preserving
   // symmetry)
   PETScMatrix A;
   PETScVector b;
-  assemble_system(A, b, a, L, bc);
+  assemble_system(A, b, a, L, {bc});
 
   // Create solution function
-  Function u(V);
+  auto u = std::make_shared<Function>(V);
 
   // Create near null space basis (required for smoothed aggregation
   // AMG). The solution vector is passed so that it can be copied to
   // generate compatible vectors for the nullspace.
-  VectorSpaceBasis null_space = build_nullspace(V, *u.vector());
+  VectorSpaceBasis near_null_space = build_near_nullspace(*V, *u->vector());
+
+  // Attach near nullspace to matrix
+  A.set_near_nullspace(near_null_space);
 
   // Create PETSc smoothed aggregation AMG preconditioner
-  PETScPreconditioner pc("petsc_amg");
-  pc.parameters["report"] = true;
-  pc.set_nullspace(null_space);
+  auto pc = std::make_shared<PETScPreconditioner>("petsc_amg");
 
-  // Set some multigrid smoother parameters
+  // Use Chebyshev smoothing for multigrid
   PETScOptions::set("mg_levels_ksp_type", "chebyshev");
   PETScOptions::set("mg_levels_pc_type", "jacobi");
 
   // Improve estimate of eigenvalues for Chebyshev smoothing
-  PETScOptions::set("gamg_est_ksp_type", "cg");
-  PETScOptions::set("gamg_est_ksp_max_it", 50);
+  PETScOptions::set("mg_levels_esteig_ksp_type", "cg");
+  PETScOptions::set("mg_levels_ksp_chebyshev_esteig_steps", 50);
 
   // Create CG PETSc linear solver and turn on convergence monitor
   PETScKrylovSolver solver("cg", pc);
   solver.parameters["monitor_convergence"] = true;
 
   // Solve
-  solver.solve(A, *(u.vector()), b);
+  solver.solve(A, *(u->vector()), b);
 
   // Extract solution components (deep copy)
-  Function ux = u[0];
-  Function uy = u[1];
-  Function uz = u[2];
-  std::cout << "Norm (u vector): " << u.vector()->norm("l2") << std::endl;
+  Function ux = (*u)[0];
+  Function uy = (*u)[1];
+  Function uz = (*u)[2];
+  std::cout << "Norm (u vector): " << u->vector()->norm("l2") << std::endl;
   std::cout << "Norm (ux, uy, uz): " << ux.vector()->norm("l2") << "  "
             << uy.vector()->norm("l2") << "  "
             << uz.vector()->norm("l2") << std::endl;
 
   // Save solution in VTK format
   File vtk_file("elasticity.pvd", "compressed");
-  vtk_file << u;
+  vtk_file << *u;
 
   // Extract stress and write in VTK format
-  Elasticity::Form_a_s::TestSpace W(mesh);
+  auto W = std::make_shared<Elasticity::Form_a_s::TestSpace>(mesh);
   Elasticity::Form_a_s a_s(W, W);
   Elasticity::Form_L_s L_s(W);
   L_s.mu = mu;
@@ -183,17 +184,17 @@ int main()
   Function stress(W);
   LocalSolver local_solver(std::shared_ptr<Form>(&a_s, NoDeleter()),
                            std::shared_ptr<Form>(&L_s, NoDeleter()),
-                           LocalSolver::Cholesky);
+                           LocalSolver::SolverType::Cholesky);
   local_solver.solve_local_rhs(stress);
 
   File file_stress("stress.pvd");
   file_stress << stress;
 
   // Save colored mesh paritions in VTK format if running in parallel
-  if (dolfin::MPI::size(mesh.mpi_comm()) > 1)
+  if (dolfin::MPI::size(mesh->mpi_comm()) > 1)
   {
     CellFunction<std::size_t>
-      partitions(mesh, dolfin::MPI::rank(mesh.mpi_comm()));
+      partitions(mesh, dolfin::MPI::rank(mesh->mpi_comm()));
     File file("partitions.pvd");
     file << partitions;
   }
@@ -202,8 +203,8 @@ int main()
   plot(u, "Displacement", "displacement");
 
   // Displace mesh and plot displaced mesh
-  mesh.move(u);
-  plot(mesh, "Deformed mesh");
+  ALE::move(*mesh, *u);
+  plot(*mesh, "Deformed mesh");
 
   // Make plot windows interactive
   interactive();
diff --git a/demo/undocumented/elasticity/python/demo_elasticity.py b/demo/undocumented/elasticity/python/demo_elasticity.py
index 06b9ecb..2c27725 100644
--- a/demo/undocumented/elasticity/python/demo_elasticity.py
+++ b/demo/undocumented/elasticity/python/demo_elasticity.py
@@ -42,17 +42,21 @@ def build_nullspace(V, x):
     V.sub(2).dofmap().set(nullspace_basis[2], 1.0);
 
     # Build rotational null space basis
-    V.sub(0).dofmap().set_x(nullspace_basis[3], -1.0, 1, V.mesh());
-    V.sub(1).dofmap().set_x(nullspace_basis[3],  1.0, 0, V.mesh());
-    V.sub(0).dofmap().set_x(nullspace_basis[4],  1.0, 2, V.mesh());
-    V.sub(2).dofmap().set_x(nullspace_basis[4], -1.0, 0, V.mesh());
-    V.sub(2).dofmap().set_x(nullspace_basis[5],  1.0, 1, V.mesh());
-    V.sub(1).dofmap().set_x(nullspace_basis[5], -1.0, 2, V.mesh());
+    V.sub(0).set_x(nullspace_basis[3], -1.0, 1);
+    V.sub(1).set_x(nullspace_basis[3],  1.0, 0);
+    V.sub(0).set_x(nullspace_basis[4],  1.0, 2);
+    V.sub(2).set_x(nullspace_basis[4], -1.0, 0);
+    V.sub(2).set_x(nullspace_basis[5],  1.0, 1);
+    V.sub(1).set_x(nullspace_basis[5], -1.0, 2);
 
     for x in nullspace_basis:
         x.apply("insert")
 
-    return VectorSpaceBasis(nullspace_basis)
+    # Create vector space basis and orthogonalize
+    basis = VectorSpaceBasis(nullspace_basis)
+    basis.orthonormalize()
+
+    return basis
 
 
 # Load mesh and define function space
@@ -68,9 +72,8 @@ omega = 300.0
 rho = 10.0
 
 # Loading due to centripetal acceleration (rho*omega^2*x_i)
-f = Expression(("rho*omega*omega*x[0]", \
-                "rho*omega*omega*x[1]", \
-                "0.0"), omega=omega, rho=rho)
+f = Expression(("rho*omega*omega*x[0]", "rho*omega*omega*x[1]", "0.0"),
+               omega=omega, rho=rho, degree=2)
 
 # Elasticity parameters
 E = 1.0e9
@@ -80,8 +83,7 @@ lmbda = E*nu/((1.0 + nu)*(1.0 - 2.0*nu))
 
 # Stress computation
 def sigma(v):
-    gdim = v.geometric_dimension()
-    return 2.0*mu*sym(grad(v)) + lmbda*tr(sym(grad(v)))*Identity(gdim)
+    return 2.0*mu*sym(grad(v)) + lmbda*tr(sym(grad(v)))*Identity(len(v))
 
 # Create function space
 V = VectorFunctionSpace(mesh, "Lagrange", 1)
@@ -108,10 +110,20 @@ u = Function(V)
 # generate compatible vectors for the nullspace.
 null_space = build_nullspace(V, u.vector())
 
+# Attach near nullspace to matrix
+as_backend_type(A).set_near_nullspace(null_space)
+
 # Create PETSC smoothed aggregation AMG preconditioner and attach near
 # null space
 pc = PETScPreconditioner("petsc_amg")
-pc.set_nullspace(null_space)
+
+# Use Chebyshev smoothing for multigrid
+PETScOptions.set("mg_levels_ksp_type", "chebyshev")
+PETScOptions.set("mg_levels_pc_type", "jacobi")
+
+# Improve estimate of eigenvalues for Chebyshev smoothing
+PETScOptions.set("mg_levels_esteig_ksp_type", "cg")
+PETScOptions.set("mg_levels_ksp_chebyshev_esteig_steps", 50)
 
 # Create CG Krylov solver and turn convergence monitoring on
 solver = PETScKrylovSolver("cg", pc)
diff --git a/demo/undocumented/elastodynamics/cpp/CMakeLists.txt b/demo/undocumented/elastodynamics/cpp/CMakeLists.txt
index ba5e197..06bd9d4 100644
--- a/demo/undocumented/elastodynamics/cpp/CMakeLists.txt
+++ b/demo/undocumented/elastodynamics/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h b/demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h
index 0eb8c0c..ee314e9 100644
--- a/demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h
+++ b/demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __DG0_EPS_XX_H
 #define __DG0_EPS_XX_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class dg0_eps_xx_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_finite_element_0()
+  ~dg0_eps_xx_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,98 +902,80 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new dg0_eps_xx_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class dg0_eps_xx_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_finite_element_1()
+  ~dg0_eps_xx_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1004,16 +989,54 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1022,8 +1045,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1206,20 +1229,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1228,7 +1249,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1236,21 +1257,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1270,7 +1289,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1282,7 +1301,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1291,8 +1310,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2137,28 +2156,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2194,7 +2211,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2202,22 +2219,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2228,48 +2243,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -2279,50 +2294,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2334,30 +2347,29 @@ public:
     vertex_values[5] = dof_values[5];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2376,84 +2388,102 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new dg0_eps_xx_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
 class dg0_eps_xx_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_finite_element_2()
+  ~dg0_eps_xx_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t degree() const final override
+  {
+    return 0;
+  }
+
+  const char * family() const final override
+  {
+    return "Discontinuous Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2487,41 +2517,37 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2541,7 +2567,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2553,44 +2579,40 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -2601,8 +2623,8 @@ public:
     {
     case 0:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -2612,30 +2634,28 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2643,69 +2663,51 @@ public:
     vertex_values[2] = dof_values[0];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new dg0_eps_xx_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class dg0_eps_xx_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_dofmap_0()
+  ~dg0_eps_xx_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2729,39 +2731,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2785,19 +2776,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2823,9 +2812,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2876,65 +2864,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new dg0_eps_xx_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class dg0_eps_xx_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_dofmap_1()
+  ~dg0_eps_xx_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2958,39 +2926,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3014,25 +2971,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3064,9 +3019,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3120,32 +3074,13 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -3164,41 +3099,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new dg0_eps_xx_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class dg0_eps_xx_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_dofmap_2()
+  ~dg0_eps_xx_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3222,39 +3150,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3278,17 +3195,15 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[2][0];
+    dofs[0] = entity_indices[2][0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3311,9 +3226,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3346,66 +3260,49 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new dg0_eps_xx_dofmap_2();
   }
 
 };
 
-/// 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 dg0_eps_xx_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_cell_integral_0_otherwise()
+  ~dg0_eps_xx_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    0
@@ -3414,7 +3311,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3433,38 +3330,31 @@ public:
 
 };
 
-/// 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 dg0_eps_xx_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_cell_integral_1_otherwise()
+  ~dg0_eps_xx_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    6
@@ -3473,7 +3363,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3495,66 +3385,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class dg0_eps_xx_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_form_0()
+  ~dg0_eps_xx_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "3a7d6cf5f936940a07586e666d248364c6c76be4fb59ab04802186cc019e746e821846bc912106cfbdc6564ebde9761ffad57f79ba3425159c2c30d4994ba45d";
+    return "aab8af83d634da879fa2ac45a2fad203a5ca629867e1c2a156eed0051dbdf8825cf1fbf50b4d8987492f5926ba81d5098a5fc4b48c25ddd9848b5e63e097cbf5";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new dg0_eps_xx_finite_element_1();
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new dg0_eps_xx_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -3573,8 +3455,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -3593,192 +3474,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new dg0_eps_xx_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class dg0_eps_xx_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   dg0_eps_xx_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_form_1()
+  ~dg0_eps_xx_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "038741e0ed19978c39773b2bd83665df732ab93a1ec0a900710b031eb2fbba2b3bf6bd7a181f6c1a206a45aecf1405c7ec66129fbcc1f64cad3d282f1a7c5690";
+    return "f27a92bdf5b800ffe35cc33559125f36ce249b2a62c5c913e35a0c5b81ad2e1751d8b416a15da6f097f82048b9f20356bb321beccd2d43952c46abc42642300b";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new dg0_eps_xx_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new dg0_eps_xx_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -3797,8 +3706,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -3817,126 +3725,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new dg0_eps_xx_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -3950,14 +3894,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace DG0_eps_xx
 {
@@ -3966,43 +3916,20 @@ class CoefficientSpace_u: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<dg0_eps_xx_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<dg0_eps_xx_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<dg0_eps_xx_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<dg0_eps_xx_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4013,43 +3940,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<dg0_eps_xx_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<dg0_eps_xx_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<dg0_eps_xx_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<dg0_eps_xx_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4060,63 +3964,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<dg0_eps_xx_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<dg0_eps_xx_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<dg0_eps_xx_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<dg0_eps_xx_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -4124,7 +4035,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_0());
+    _ufc_form = std::make_shared<const dg0_eps_xx_form_0>();
   }
 
   // Destructor
@@ -4154,57 +4065,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<dg0_eps_xx_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<dg0_eps_xx_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<dg0_eps_xx_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<dg0_eps_xx_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_u Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -4212,69 +4178,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), u(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
+    _ufc_form = std::make_shared<const dg0_eps_xx_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
     dolfin::Form(1, 1), u(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->u = u;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
+    _ufc_form = std::make_shared<const dg0_eps_xx_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->u = *u;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "u")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), u(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "u";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_u;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u):
-    dolfin::Form(1, 1), u(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), u(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->u = u;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 1), u(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
+    dolfin::MultiMeshForm(V0), u(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->u = *u;
+    /// Assign coefficients
+    this->u = u;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -4306,18 +4313,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_u;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner u;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/elastodynamics/cpp/ElastoDynamics.h b/demo/undocumented/elastodynamics/cpp/ElastoDynamics.h
index b2e91d9..e8e2798 100644
--- a/demo/undocumented/elastodynamics/cpp/ElastoDynamics.h
+++ b/demo/undocumented/elastodynamics/cpp/ElastoDynamics.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,388 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __ELASTODYNAMICS_H
 #define __ELASTODYNAMICS_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class elastodynamics_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   elastodynamics_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elastodynamics_finite_element_0()
+  ~elastodynamics_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 1;
+    return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
+    return 1;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new elastodynamics_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class elastodynamics_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  elastodynamics_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~elastodynamics_finite_element_1()
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
+    return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t reference_value_size() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t degree() const final override
   {
-    return 0;
+    return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -403,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -502,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -524,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -563,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -575,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -584,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1037,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1094,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1102,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1128,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1155,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1194,98 +902,104 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new elastodynamics_finite_element_1();
+    return new elastodynamics_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class elastodynamics_finite_element_2: public ufc::finite_element
+class elastodynamics_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  elastodynamics_finite_element_2() : ufc::finite_element()
+  elastodynamics_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elastodynamics_finite_element_2()
+  ~elastodynamics_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1299,16 +1013,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1317,8 +1045,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1501,20 +1229,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1523,7 +1249,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1531,21 +1257,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1565,7 +1289,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1577,7 +1301,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1586,8 +1310,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2432,28 +2156,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2489,7 +2211,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2497,22 +2219,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2523,48 +2243,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -2574,50 +2294,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2629,41 +2347,40 @@ public:
     vertex_values[5] = dof_values[5];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elastodynamics_finite_element_1();
+        return new elastodynamics_finite_element_0();
         break;
       }
     case 1:
       {
-        return new elastodynamics_finite_element_1();
+        return new elastodynamics_finite_element_0();
         break;
       }
     }
@@ -2671,243 +2388,326 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new elastodynamics_finite_element_2();
+    return new elastodynamics_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class elastodynamics_dofmap_0: public ufc::dofmap
+class elastodynamics_finite_element_2: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  elastodynamics_dofmap_0() : ufc::dofmap()
+  elastodynamics_finite_element_2() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elastodynamics_dofmap_0()
+  ~elastodynamics_finite_element_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    return "FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return true;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
   {
-    return num_global_entities[2];
+    return 1;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 1;
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  const char * family() const final override
   {
-    dofs[0] = c.entity_indices[2][0];
+    return "Discontinuous Lagrange";
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    
+    // Get coordinates and map to the reference (FIAT) element
+    
+    // Reset values
+    *values = 0.0;
+    
+    // Array of basisvalues
+    double basisvalues[1] = {0.0};
+    
+    // Declare helper variables
+    
+    // Compute basisvalues
+    basisvalues[0] = 1.0;
+    
+    // Table(s) of coefficients
+    static const double coefficients0[1] = \
+    {1.0};
     
+    // Compute value(s)
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      *values += coefficients0[r]*basisvalues[r];
+    } // end loop over 'r'
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    if (d > 2)
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis.
+    _evaluate_basis(0, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
     {
-    throw std::runtime_error("d is larger than dimension (2)");
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
     }
     
-    switch (d)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 0)
+    {
+    return ;
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Element is constant, calling evaluate_basis_derivatives.
+    _evaluate_basis_derivatives(0, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
     {
     case 0:
       {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     }
     
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[0];
+    vertex_values[2] = dof_values[0];
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    dof_coordinates[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::finite_element * create() const final override
   {
-    return new elastodynamics_dofmap_0();
+    return new elastodynamics_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class elastodynamics_dofmap_1: public ufc::dofmap
+class elastodynamics_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  elastodynamics_dofmap_1() : ufc::dofmap()
+  elastodynamics_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elastodynamics_dofmap_1()
+  ~elastodynamics_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2931,39 +2731,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2987,19 +2776,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3025,9 +2812,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3078,65 +2864,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new elastodynamics_dofmap_1();
+    return new elastodynamics_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class elastodynamics_dofmap_2: public ufc::dofmap
+class elastodynamics_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  elastodynamics_dofmap_2() : ufc::dofmap()
+  elastodynamics_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elastodynamics_dofmap_2()
+  ~elastodynamics_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3160,39 +2926,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3216,25 +2971,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3266,9 +3019,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3322,43 +3074,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elastodynamics_dofmap_1();
+        return new elastodynamics_dofmap_0();
         break;
       }
     case 1:
       {
-        return new elastodynamics_dofmap_1();
+        return new elastodynamics_dofmap_0();
         break;
       }
     }
@@ -3366,61 +3099,225 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new elastodynamics_dofmap_2();
+    return new elastodynamics_dofmap_1();
   }
 
 };
 
-/// 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 elastodynamics_cell_integral_0_otherwise: public ufc::cell_integral
+class elastodynamics_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  elastodynamics_cell_integral_0_otherwise() : ufc::cell_integral()
+  elastodynamics_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elastodynamics_cell_integral_0_otherwise()
+  ~elastodynamics_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * signature() const final override
   {
-    static const std::vector<bool> enabled({true, true, true, true, true, true, true, true, true});
-    return enabled;
+    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', triangle, 0)";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute cell volume
-    
+    switch (d)
+    {
+    case 0:
+      {
+        return false;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return true;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[2];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 0;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 0;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 1;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[2][0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 0;
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new elastodynamics_dofmap_2();
+  }
+
+};
+
+
+class elastodynamics_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  elastodynamics_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~elastodynamics_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true, true, true, true, true, true, true, true, true});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute cell volume
+    
     
     // Compute circumradius of triangle in 2D
     
@@ -3577,42 +3474,35 @@ public:
 
 };
 
-/// 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 elastodynamics_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   elastodynamics_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~elastodynamics_cell_integral_1_otherwise()
+  ~elastodynamics_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, true, true, false, true, false, true, true, true, true, true, true, true, true, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3773,39 +3663,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class elastodynamics_exterior_facet_integral_1_3: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   elastodynamics_exterior_facet_integral_1_3() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~elastodynamics_exterior_facet_integral_1_3()
+  ~elastodynamics_exterior_facet_integral_1_3() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, false, false, true, false, true, false, false, false, false, false, true, false, false, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    24
@@ -3814,7 +3697,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3827,8 +3710,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -3891,122 +3774,114 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class elastodynamics_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   elastodynamics_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elastodynamics_form_0()
+  ~elastodynamics_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "93d5000939d8a805b60ce0bd28cf50cc8b62e2e973b216992c520652f6e7997d6fcf02fff67f17016829fdcf1206b35fac9790ff28c3da1b6d7d1b454e2a63f8";
+    return "6c541f7759460b402a04f1560b655fdd887174999e90c7f0a0f42d512c75f07888110533868bc2d904e908c147e67001c02b9dd29c9ba26ded18f995c8b1b65d";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 9;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3, 4, 5, 6, 7, 8});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new elastodynamics_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new elastodynamics_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elastodynamics_finite_element_2();
+        return new elastodynamics_finite_element_1();
         break;
       }
     case 1:
       {
-        return new elastodynamics_finite_element_2();
+        return new elastodynamics_finite_element_1();
         break;
       }
     case 2:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 3:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 4:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 5:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 6:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 7:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 8:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 9:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 10:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     }
@@ -4014,64 +3889,63 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elastodynamics_dofmap_2();
+        return new elastodynamics_dofmap_1();
         break;
       }
     case 1:
       {
-        return new elastodynamics_dofmap_2();
+        return new elastodynamics_dofmap_1();
         break;
       }
     case 2:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 3:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 4:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 5:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 6:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 7:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 8:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 9:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 10:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     }
@@ -4079,273 +3953,301 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new elastodynamics_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class elastodynamics_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   elastodynamics_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~elastodynamics_form_1()
+  ~elastodynamics_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "15c984a33ff0dac47cded535dd569862a5430c24e4a805fad07959ba2b5a2cda4e35ec18bc7a4d4b310d67dc19cea4d8b44eff7b40f1280cb7f4a9fb0809b6bf";
+    return "d31ef110ea7a4f202b23fd18d4e630d0ae94523b57e863773903d64db2ae88aa3e72cd0bf208c3c932211164a093874304c6fa43955a3b1eac3e0188dc6a73f7";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 15;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14});
     return position[i];
   }
 
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new elastodynamics_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new elastodynamics_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elastodynamics_finite_element_2();
+        return new elastodynamics_finite_element_1();
         break;
       }
     case 1:
       {
-        return new elastodynamics_finite_element_2();
+        return new elastodynamics_finite_element_1();
         break;
       }
     case 2:
       {
-        return new elastodynamics_finite_element_2();
+        return new elastodynamics_finite_element_1();
         break;
       }
     case 3:
       {
-        return new elastodynamics_finite_element_2();
+        return new elastodynamics_finite_element_1();
         break;
       }
     case 4:
       {
-        return new elastodynamics_finite_element_2();
+        return new elastodynamics_finite_element_1();
         break;
       }
     case 5:
       {
-        return new elastodynamics_finite_element_2();
+        return new elastodynamics_finite_element_1();
         break;
       }
     case 6:
       {
-        return new elastodynamics_finite_element_2();
+        return new elastodynamics_finite_element_1();
         break;
       }
     case 7:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 8:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 9:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 10:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 11:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 12:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 13:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 14:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     case 15:
       {
-        return new elastodynamics_finite_element_0();
+        return new elastodynamics_finite_element_2();
         break;
       }
     }
@@ -4353,89 +4255,88 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new elastodynamics_dofmap_2();
+        return new elastodynamics_dofmap_1();
         break;
       }
     case 1:
       {
-        return new elastodynamics_dofmap_2();
+        return new elastodynamics_dofmap_1();
         break;
       }
     case 2:
       {
-        return new elastodynamics_dofmap_2();
+        return new elastodynamics_dofmap_1();
         break;
       }
     case 3:
       {
-        return new elastodynamics_dofmap_2();
+        return new elastodynamics_dofmap_1();
         break;
       }
     case 4:
       {
-        return new elastodynamics_dofmap_2();
+        return new elastodynamics_dofmap_1();
         break;
       }
     case 5:
       {
-        return new elastodynamics_dofmap_2();
+        return new elastodynamics_dofmap_1();
         break;
       }
     case 6:
       {
-        return new elastodynamics_dofmap_2();
+        return new elastodynamics_dofmap_1();
         break;
       }
     case 7:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 8:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 9:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 10:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 11:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 12:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 13:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 14:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     case 15:
       {
-        return new elastodynamics_dofmap_0();
+        return new elastodynamics_dofmap_2();
         break;
       }
     }
@@ -4443,77 +4344,92 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 4;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     switch (subdomain_id)
     {
@@ -4527,51 +4443,72 @@ public:
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new elastodynamics_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -4585,14 +4522,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace ElastoDynamics
 {
@@ -4601,43 +4544,20 @@ class CoefficientSpace_a0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_a0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_a0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_a0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_a0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4648,43 +4568,20 @@ class CoefficientSpace_alpha_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_alpha_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_alpha_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_alpha_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_alpha_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4695,43 +4592,20 @@ class CoefficientSpace_alpha_m: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_alpha_m(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_alpha_m(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_alpha_m(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_alpha_m(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4742,43 +4616,20 @@ class CoefficientSpace_beta: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_beta(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_beta(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_beta(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_beta(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4789,43 +4640,20 @@ class CoefficientSpace_dt: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_dt(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_dt(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_dt(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_dt(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4836,43 +4664,20 @@ class CoefficientSpace_eta: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_eta(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_eta(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_eta(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_eta(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4883,43 +4688,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4930,43 +4712,20 @@ class CoefficientSpace_gamma: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_gamma(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_gamma(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_gamma(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_gamma(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4977,43 +4736,20 @@ class CoefficientSpace_lmbda: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_lmbda(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_lmbda(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5024,43 +4760,20 @@ class CoefficientSpace_mu: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_mu(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_mu(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5071,43 +4784,20 @@ class CoefficientSpace_p: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_p(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_p(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5118,43 +4808,20 @@ class CoefficientSpace_p0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_p0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_p0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5165,43 +4832,20 @@ class CoefficientSpace_rho: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_rho(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_rho(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_rho(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_rho(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5212,90 +4856,44 @@ class CoefficientSpace_u0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_u0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
+};
 
 class CoefficientSpace_v0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_v0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_v0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_v0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_v0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5306,43 +4904,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5353,45 +4928,62 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh, constrained_domain)))
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -5419,21 +5011,21 @@ class Form_a: public dolfin::Form
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 9), rho(*this, 0), eta(*this, 1), lmbda(*this, 2), mu(*this, 3), alpha_m(*this, 4), alpha_f(*this, 5), beta(*this, 6), gamma(*this, 7), dt(*this, 8)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_0());
+    _ufc_form = std::make_shared<const elastodynamics_form_0>();
   }
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& rho, const dolfin::GenericFunction& eta, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& alpha_m, const dolfin::GenericFunction& alpha_f, const dolfin::GenericFunction& beta, const dolfin::GenericFunction& gamma, const dolfin::GenericFunction& dt):
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> rho, std::shared_ptr<const dolfin::GenericFunction> eta, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> alpha_m, std::shared_ptr<const dolfin::GenericFunction> alpha_f, std::shared_ptr<const dolfin::GenericFunction> beta, std::shared [...]
     dolfin::Form(2, 9), rho(*this, 0), eta(*this, 1), lmbda(*this, 2), mu(*this, 3), alpha_m(*this, 4), alpha_f(*this, 5), beta(*this, 6), gamma(*this, 7), dt(*this, 8)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
 
     this->rho = rho;
     this->eta = eta;
@@ -5445,46 +5037,138 @@ public:
     this->gamma = gamma;
     this->dt = dt;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_0());
+    _ufc_form = std::make_shared<const elastodynamics_form_0>();
   }
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> rho, std::shared_ptr<const dolfin::GenericFunction> eta, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> alpha_m, std::shared_ptr<const dolfin::GenericFunction> alpha_f, std::shared_ptr<const dolfin::GenericFunction> beta, std::shared_ptr<const dolfin::GenericFuncti [...]
-    dolfin::Form(2, 9), rho(*this, 0), eta(*this, 1), lmbda(*this, 2), mu(*this, 3), alpha_m(*this, 4), alpha_f(*this, 5), beta(*this, 6), gamma(*this, 7), dt(*this, 8)
+  // Destructor
+  ~Form_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    if (name == "rho")
+      return 0;
+    else if (name == "eta")
+      return 1;
+    else if (name == "lmbda")
+      return 2;
+    else if (name == "mu")
+      return 3;
+    else if (name == "alpha_m")
+      return 4;
+    else if (name == "alpha_f")
+      return 5;
+    else if (name == "beta")
+      return 6;
+    else if (name == "gamma")
+      return 7;
+    else if (name == "dt")
+      return 8;
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
 
-    this->rho = *rho;
-    this->eta = *eta;
-    this->lmbda = *lmbda;
-    this->mu = *mu;
-    this->alpha_m = *alpha_m;
-    this->alpha_f = *alpha_f;
-    this->beta = *beta;
-    this->gamma = *gamma;
-    this->dt = *dt;
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "rho";
+    case 1:
+      return "eta";
+    case 2:
+      return "lmbda";
+    case 3:
+      return "mu";
+    case 4:
+      return "alpha_m";
+    case 5:
+      return "alpha_f";
+    case 6:
+      return "beta";
+    case 7:
+      return "gamma";
+    case 8:
+      return "dt";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+  typedef Form_a_FunctionSpace_2 CoefficientSpace_rho;
+  typedef Form_a_FunctionSpace_3 CoefficientSpace_eta;
+  typedef Form_a_FunctionSpace_4 CoefficientSpace_lmbda;
+  typedef Form_a_FunctionSpace_5 CoefficientSpace_mu;
+  typedef Form_a_FunctionSpace_6 CoefficientSpace_alpha_m;
+  typedef Form_a_FunctionSpace_7 CoefficientSpace_alpha_f;
+  typedef Form_a_FunctionSpace_8 CoefficientSpace_beta;
+  typedef Form_a_FunctionSpace_9 CoefficientSpace_gamma;
+  typedef Form_a_FunctionSpace_10 CoefficientSpace_dt;
+
+  // Coefficients
+  dolfin::CoefficientAssigner rho;
+  dolfin::CoefficientAssigner eta;
+  dolfin::CoefficientAssigner lmbda;
+  dolfin::CoefficientAssigner mu;
+  dolfin::CoefficientAssigner alpha_m;
+  dolfin::CoefficientAssigner alpha_f;
+  dolfin::CoefficientAssigner beta;
+  dolfin::CoefficientAssigner gamma;
+  dolfin::CoefficientAssigner dt;
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 9), rho(*this, 0), eta(*this, 1), lmbda(*this, 2), mu(*this, 3), alpha_m(*this, 4), alpha_f(*this, 5), beta(*this, 6), gamma(*this, 7), dt(*this, 8)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0), rho(*this, 0), eta(*this, 1), lmbda(*this, 2), mu(*this, 3), alpha_m(*this, 4), alpha_f(*this, 5), beta(*this, 6), gamma(*this, 7), dt(*this, 8)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_0());
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& rho, const dolfin::GenericFunction& eta, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& alpha_m, const dolfin::GenericFunction& alpha_f, const dolfin::GenericFunction& beta, const dolfin::GenericFunction& gamma, const dolfin::GenericFunction& dt):
-    dolfin::Form(2, 9), rho(*this, 0), eta(*this, 1), lmbda(*this, 2), mu(*this, 3), alpha_m(*this, 4), alpha_f(*this, 5), beta(*this, 6), gamma(*this, 7), dt(*this, 8)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> rho, std::shared_ptr<const dolfin::GenericFunction> eta, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> alpha_m, std::shared_ptr<const dolfin::GenericFunction> alpha_f, std::shared_ptr<const dolfin::Generic [...]
+    dolfin::MultiMeshForm(V1, V0), rho(*this, 0), eta(*this, 1), lmbda(*this, 2), mu(*this, 3), alpha_m(*this, 4), alpha_f(*this, 5), beta(*this, 6), gamma(*this, 7), dt(*this, 8)
   {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
 
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
     this->rho = rho;
     this->eta = eta;
     this->lmbda = lmbda;
@@ -5495,31 +5179,10 @@ public:
     this->gamma = gamma;
     this->dt = dt;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> rho, std::shared_ptr<const dolfin::GenericFunction> eta, std::shared_ptr<const dolfin::GenericFunction> lmbda, std::shared_ptr<const dolfin::GenericFunction> mu, std::shared_ptr<const dolfin::GenericFunction> alpha_m, std::shared_ptr<const dolfin::GenericFunction> alpha_f, std::shared_ptr<const dolfin::GenericFunction> beta, std::shared [...]
-    dolfin::Form(2, 9), rho(*this, 0), eta(*this, 1), lmbda(*this, 2), mu(*this, 3), alpha_m(*this, 4), alpha_f(*this, 5), beta(*this, 6), gamma(*this, 7), dt(*this, 8)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->rho = *rho;
-    this->eta = *eta;
-    this->lmbda = *lmbda;
-    this->mu = *mu;
-    this->alpha_m = *alpha_m;
-    this->alpha_f = *alpha_f;
-    this->beta = *beta;
-    this->gamma = *gamma;
-    this->dt = *dt;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_0());
   }
 
   // Destructor
-  ~Form_a()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -5584,6 +5247,8 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
   typedef Form_a_FunctionSpace_2 CoefficientSpace_rho;
   typedef Form_a_FunctionSpace_3 CoefficientSpace_eta;
   typedef Form_a_FunctionSpace_4 CoefficientSpace_lmbda;
@@ -5595,60 +5260,57 @@ public:
   typedef Form_a_FunctionSpace_10 CoefficientSpace_dt;
 
   // Coefficients
-  dolfin::CoefficientAssigner rho;
-  dolfin::CoefficientAssigner eta;
-  dolfin::CoefficientAssigner lmbda;
-  dolfin::CoefficientAssigner mu;
-  dolfin::CoefficientAssigner alpha_m;
-  dolfin::CoefficientAssigner alpha_f;
-  dolfin::CoefficientAssigner beta;
-  dolfin::CoefficientAssigner gamma;
-  dolfin::CoefficientAssigner dt;
+  dolfin::MultiMeshCoefficientAssigner rho;
+  dolfin::MultiMeshCoefficientAssigner eta;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner mu;
+  dolfin::MultiMeshCoefficientAssigner alpha_m;
+  dolfin::MultiMeshCoefficientAssigner alpha_f;
+  dolfin::MultiMeshCoefficientAssigner beta;
+  dolfin::MultiMeshCoefficientAssigner gamma;
+  dolfin::MultiMeshCoefficientAssigner dt;
 };
 
 class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<elastodynamics_finite_element_1>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<elastodynamics_dofmap_1>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new elastodynamics_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new elastodynamics_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
@@ -5688,19 +5350,19 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 15), u0(*this, 0), v0(*this, 1), a0(*this, 2), p0(*this, 3), f(*this, 4), p(*this, 5), rho(*this, 6), eta(*this, 7), lmbda(*this, 8), mu(*this, 9), alpha_m(*this, 10), alpha_f(*this, 11), beta(*this, 12), gamma(*this, 13), dt(*this, 14)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_1());
+    _ufc_form = std::make_shared<const elastodynamics_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& v0, const dolfin::GenericFunction& a0, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& p, const dolfin::GenericFunction& rho, const dolfin::GenericFunction& eta, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& alpha_m, const dolfin::GenericFunction& alpha_f, const dolfin::Gen [...]
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> v0, std::shared_ptr<const dolfin::GenericFunction> a0, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> p, std::shared_ptr<const dolfin::GenericFunction> rho, std::shared_ptr<const dolfin::GenericFunction> eta, std::shared_ptr<const dolf [...]
     dolfin::Form(1, 15), u0(*this, 0), v0(*this, 1), a0(*this, 2), p0(*this, 3), f(*this, 4), p(*this, 5), rho(*this, 6), eta(*this, 7), lmbda(*this, 8), mu(*this, 9), alpha_m(*this, 10), alpha_f(*this, 11), beta(*this, 12), gamma(*this, 13), dt(*this, 14)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->u0 = u0;
     this->v0 = v0;
@@ -5718,49 +5380,172 @@ public:
     this->gamma = gamma;
     this->dt = dt;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_1());
+    _ufc_form = std::make_shared<const elastodynamics_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> v0, std::shared_ptr<const dolfin::GenericFunction> a0, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> p, std::shared_ptr<const dolfin::GenericFunction> rho, std::shared_ptr<const dolfin::GenericFunction> eta, std::shared_ptr<const dolfin::GenericFunct [...]
-    dolfin::Form(1, 15), u0(*this, 0), v0(*this, 1), a0(*this, 2), p0(*this, 3), f(*this, 4), p(*this, 5), rho(*this, 6), eta(*this, 7), lmbda(*this, 8), mu(*this, 9), alpha_m(*this, 10), alpha_f(*this, 11), beta(*this, 12), gamma(*this, 13), dt(*this, 14)
+  // Destructor
+  ~Form_L()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    if (name == "u0")
+      return 0;
+    else if (name == "v0")
+      return 1;
+    else if (name == "a0")
+      return 2;
+    else if (name == "p0")
+      return 3;
+    else if (name == "f")
+      return 4;
+    else if (name == "p")
+      return 5;
+    else if (name == "rho")
+      return 6;
+    else if (name == "eta")
+      return 7;
+    else if (name == "lmbda")
+      return 8;
+    else if (name == "mu")
+      return 9;
+    else if (name == "alpha_m")
+      return 10;
+    else if (name == "alpha_f")
+      return 11;
+    else if (name == "beta")
+      return 12;
+    else if (name == "gamma")
+      return 13;
+    else if (name == "dt")
+      return 14;
 
-    this->u0 = *u0;
-    this->v0 = *v0;
-    this->a0 = *a0;
-    this->p0 = *p0;
-    this->f = *f;
-    this->p = *p;
-    this->rho = *rho;
-    this->eta = *eta;
-    this->lmbda = *lmbda;
-    this->mu = *mu;
-    this->alpha_m = *alpha_m;
-    this->alpha_f = *alpha_f;
-    this->beta = *beta;
-    this->gamma = *gamma;
-    this->dt = *dt;
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "u0";
+    case 1:
+      return "v0";
+    case 2:
+      return "a0";
+    case 3:
+      return "p0";
+    case 4:
+      return "f";
+    case 5:
+      return "p";
+    case 6:
+      return "rho";
+    case 7:
+      return "eta";
+    case 8:
+      return "lmbda";
+    case 9:
+      return "mu";
+    case 10:
+      return "alpha_m";
+    case 11:
+      return "alpha_f";
+    case 12:
+      return "beta";
+    case 13:
+      return "gamma";
+    case 14:
+      return "dt";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_u0;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_v0;
+  typedef Form_L_FunctionSpace_3 CoefficientSpace_a0;
+  typedef Form_L_FunctionSpace_4 CoefficientSpace_p0;
+  typedef Form_L_FunctionSpace_5 CoefficientSpace_f;
+  typedef Form_L_FunctionSpace_6 CoefficientSpace_p;
+  typedef Form_L_FunctionSpace_7 CoefficientSpace_rho;
+  typedef Form_L_FunctionSpace_8 CoefficientSpace_eta;
+  typedef Form_L_FunctionSpace_9 CoefficientSpace_lmbda;
+  typedef Form_L_FunctionSpace_10 CoefficientSpace_mu;
+  typedef Form_L_FunctionSpace_11 CoefficientSpace_alpha_m;
+  typedef Form_L_FunctionSpace_12 CoefficientSpace_alpha_f;
+  typedef Form_L_FunctionSpace_13 CoefficientSpace_beta;
+  typedef Form_L_FunctionSpace_14 CoefficientSpace_gamma;
+  typedef Form_L_FunctionSpace_15 CoefficientSpace_dt;
+
+  // Coefficients
+  dolfin::CoefficientAssigner u0;
+  dolfin::CoefficientAssigner v0;
+  dolfin::CoefficientAssigner a0;
+  dolfin::CoefficientAssigner p0;
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner p;
+  dolfin::CoefficientAssigner rho;
+  dolfin::CoefficientAssigner eta;
+  dolfin::CoefficientAssigner lmbda;
+  dolfin::CoefficientAssigner mu;
+  dolfin::CoefficientAssigner alpha_m;
+  dolfin::CoefficientAssigner alpha_f;
+  dolfin::CoefficientAssigner beta;
+  dolfin::CoefficientAssigner gamma;
+  dolfin::CoefficientAssigner dt;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 15), u0(*this, 0), v0(*this, 1), a0(*this, 2), p0(*this, 3), f(*this, 4), p(*this, 5), rho(*this, 6), eta(*this, 7), lmbda(*this, 8), mu(*this, 9), alpha_m(*this, 10), alpha_f(*this, 11), beta(*this, 12), gamma(*this, 13), dt(*this, 14)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), u0(*this, 0), v0(*this, 1), a0(*this, 2), p0(*this, 3), f(*this, 4), p(*this, 5), rho(*this, 6), eta(*this, 7), lmbda(*this, 8), mu(*this, 9), alpha_m(*this, 10), alpha_f(*this, 11), beta(*this, 12), gamma(*this, 13), dt(*this, 14)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u0, const dolfin::GenericFunction& v0, const dolfin::GenericFunction& a0, const dolfin::GenericFunction& p0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& p, const dolfin::GenericFunction& rho, const dolfin::GenericFunction& eta, const dolfin::GenericFunction& lmbda, const dolfin::GenericFunction& mu, const dolfin::GenericFunction& alpha_m, const dolfin::GenericFunction& alpha_f, c [...]
-    dolfin::Form(1, 15), u0(*this, 0), v0(*this, 1), a0(*this, 2), p0(*this, 3), f(*this, 4), p(*this, 5), rho(*this, 6), eta(*this, 7), lmbda(*this, 8), mu(*this, 9), alpha_m(*this, 10), alpha_f(*this, 11), beta(*this, 12), gamma(*this, 13), dt(*this, 14)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> v0, std::shared_ptr<const dolfin::GenericFunction> a0, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> p, std::shared_ptr<const dolfin::GenericFunction> rho, std::shared_ptr<const dolfin::GenericFunction> eta, std::sha [...]
+    dolfin::MultiMeshForm(V0), u0(*this, 0), v0(*this, 1), a0(*this, 2), p0(*this, 3), f(*this, 4), p(*this, 5), rho(*this, 6), eta(*this, 7), lmbda(*this, 8), mu(*this, 9), alpha_m(*this, 10), alpha_f(*this, 11), beta(*this, 12), gamma(*this, 13), dt(*this, 14)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
+    /// Assign coefficients
     this->u0 = u0;
     this->v0 = v0;
     this->a0 = a0;
@@ -5777,36 +5562,10 @@ public:
     this->gamma = gamma;
     this->dt = dt;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u0, std::shared_ptr<const dolfin::GenericFunction> v0, std::shared_ptr<const dolfin::GenericFunction> a0, std::shared_ptr<const dolfin::GenericFunction> p0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> p, std::shared_ptr<const dolfin::GenericFunction> rho, std::shared_ptr<const dolfin::GenericFunction> eta, std::shared_ptr<const dolf [...]
-    dolfin::Form(1, 15), u0(*this, 0), v0(*this, 1), a0(*this, 2), p0(*this, 3), f(*this, 4), p(*this, 5), rho(*this, 6), eta(*this, 7), lmbda(*this, 8), mu(*this, 9), alpha_m(*this, 10), alpha_f(*this, 11), beta(*this, 12), gamma(*this, 13), dt(*this, 14)
-  {
-    _function_spaces[0] = V0;
-
-    this->u0 = *u0;
-    this->v0 = *v0;
-    this->a0 = *a0;
-    this->p0 = *p0;
-    this->f = *f;
-    this->p = *p;
-    this->rho = *rho;
-    this->eta = *eta;
-    this->lmbda = *lmbda;
-    this->mu = *mu;
-    this->alpha_m = *alpha_m;
-    this->alpha_f = *alpha_f;
-    this->beta = *beta;
-    this->gamma = *gamma;
-    this->dt = *dt;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new elastodynamics_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -5894,6 +5653,7 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_u0;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_v0;
   typedef Form_L_FunctionSpace_3 CoefficientSpace_a0;
@@ -5911,29 +5671,34 @@ public:
   typedef Form_L_FunctionSpace_15 CoefficientSpace_dt;
 
   // Coefficients
-  dolfin::CoefficientAssigner u0;
-  dolfin::CoefficientAssigner v0;
-  dolfin::CoefficientAssigner a0;
-  dolfin::CoefficientAssigner p0;
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner p;
-  dolfin::CoefficientAssigner rho;
-  dolfin::CoefficientAssigner eta;
-  dolfin::CoefficientAssigner lmbda;
-  dolfin::CoefficientAssigner mu;
-  dolfin::CoefficientAssigner alpha_m;
-  dolfin::CoefficientAssigner alpha_f;
-  dolfin::CoefficientAssigner beta;
-  dolfin::CoefficientAssigner gamma;
-  dolfin::CoefficientAssigner dt;
+  dolfin::MultiMeshCoefficientAssigner u0;
+  dolfin::MultiMeshCoefficientAssigner v0;
+  dolfin::MultiMeshCoefficientAssigner a0;
+  dolfin::MultiMeshCoefficientAssigner p0;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner p;
+  dolfin::MultiMeshCoefficientAssigner rho;
+  dolfin::MultiMeshCoefficientAssigner eta;
+  dolfin::MultiMeshCoefficientAssigner lmbda;
+  dolfin::MultiMeshCoefficientAssigner mu;
+  dolfin::MultiMeshCoefficientAssigner alpha_m;
+  dolfin::MultiMeshCoefficientAssigner alpha_f;
+  dolfin::MultiMeshCoefficientAssigner beta;
+  dolfin::MultiMeshCoefficientAssigner gamma;
+  dolfin::MultiMeshCoefficientAssigner dt;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/elastodynamics/cpp/compile.log b/demo/undocumented/elastodynamics/cpp/compile.log
index 1742b4f..a0f8686 100644
--- a/demo/undocumented/elastodynamics/cpp/compile.log
+++ b/demo/undocumented/elastodynamics/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form DG0_eps_xx
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'DG0(?)'
-  Unique sub elements:       'DG0(?)'
+  Unique elements:           'DG0(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'DG0(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 0
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -40,11 +41,11 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.043911 seconds.
+Compiler stage 1 finished in 0.0816491 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -55,10 +56,15 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -67,7 +73,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  1 entries computed in 0.000586 seconds
+  1 entries computed in 0.000572 seconds
   Shape of reference tensor: (1, 1)
   Primary multi index:   rank = 2 dims = [1, 1] indices = [[0, 0]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -75,6 +81,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 0 dims = [] indices = [[]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -84,7 +91,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  12 entries computed in 0.00114 seconds
+  12 entries computed in 0.00112 seconds
   Shape of reference tensor: (1, 6, 2)
   Primary multi index:   rank = 1 dims = [1] indices = [[0]]
   Secondary multi index: rank = 2 dims = [6, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1], [4, 0], [4, 1], [5, 0], [5, 1]]
@@ -95,195 +102,85 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00826502 seconds.
+Compiler stage 2 finished in 0.0118291 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000170231 seconds.
+Compiler stage 3 finished in 0.000231028 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 3 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
   Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: Y
   Removing unused variable: X
   Removing unused variable: C1
   Removing unused variable: C0
   Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.110159 seconds.
+Compiler stage 4 finished in 0.115847 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000557899 seconds.
+Compiler stage 4.1 finished in 0.00094986 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./DG0_eps_xx.h.
-Compiler stage 5 finished in 0.000727892 seconds.
+Compiler stage 5 finished in 0.000667095 seconds.
 
-FFC finished in 0.164134 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.211664 seconds.
+Output written to ./DG0_eps_xx.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
+Expr.geometric_dimension() is deprecated, please use find_geometric_dimension(expr) instead.
+Expr.geometric_dimension() is deprecated, please use find_geometric_dimension(expr) instead.
 Compiling form ElastoDynamics
 
 Compiler stage 1: Analyzing form(s)
@@ -303,9 +200,9 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for expression Division.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -323,9 +220,9 @@ Compiler stage 1: Analyzing form(s)
   Monomial extraction failed: No handler defined for terminal Identity.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
@@ -349,11 +246,11 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0736301 seconds.
+Compiler stage 1 finished in 0.130836 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
@@ -364,10 +261,15 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of 3 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
@@ -378,7 +280,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -426,7 +328,7 @@ Compiler stage 2: Computing intermediate representation
           [ 0.16666667,  0.16666667,  0.66666667]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.]])}}}}}
+          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE1_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
@@ -621,7 +523,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -669,7 +571,7 @@ Compiler stage 2: Computing intermediate representation
           [ 0.16666667,  0.16666667,  0.66666667]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): array([[ 1.,  1.,  1.]])}}}}}
+          [ 0.16666667,  0.66666667,  0.16666667]]])}}}, FiniteElement('Discontinuous Lagrange', triangle, 0): {None: {None: {(0, 0): array([[ 1.,  1.,  1.]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE1_C0': array([[ 0.66666667,  0.16666667,  0.16666667,  0.        ,  0.        ,
@@ -960,7 +862,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  36 entries computed in 0.00163 seconds
+  36 entries computed in 0.00207 seconds
   Shape of reference tensor: (6, 1, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 2 dims = [1, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]
@@ -969,7 +871,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.00119 seconds
+  36 entries computed in 0.00151 seconds
   Shape of reference tensor: (6, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -979,7 +881,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  36 entries computed in 0.00149 seconds
+  36 entries computed in 0.00197 seconds
   Shape of reference tensor: (6, 1, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 2 dims = [1, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]
@@ -989,7 +891,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  36 entries computed in 0.0015 seconds
+  36 entries computed in 0.00188 seconds
   Shape of reference tensor: (6, 1, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 2 dims = [1, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]
@@ -998,7 +900,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.00118 seconds
+  36 entries computed in 0.00271 seconds
   Shape of reference tensor: (6, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1008,7 +910,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  36 entries computed in 0.00151 seconds
+  36 entries computed in 0.00205 seconds
   Shape of reference tensor: (6, 1, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 2 dims = [1, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]
@@ -1018,7 +920,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  36 entries computed in 0.0015 seconds
+  36 entries computed in 0.00206 seconds
   Shape of reference tensor: (6, 1, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 2 dims = [1, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]
@@ -1027,7 +929,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.00114 seconds
+  36 entries computed in 0.0018 seconds
   Shape of reference tensor: (6, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
@@ -1037,7 +939,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  36 entries computed in 0.00148 seconds
+  36 entries computed in 0.00195 seconds
   Shape of reference tensor: (6, 1, 6)
   Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
   Secondary multi index: rank = 2 dims = [1, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5]]
@@ -1048,176 +950,63 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.115691 seconds.
+Compiler stage 2 finished in 0.177311 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.036027 seconds.
+Compiler stage 3 finished in 0.047612 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 3 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: C1
-  Removing unused variable: C0
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Removing unused variable: tmp0
+  Removing unused variable: Y
+  Removing unused variable: X
+  Removing unused variable: C1
+  Removing unused variable: C0
   Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -1231,18 +1020,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.118008 seconds.
+Compiler stage 4 finished in 0.166198 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.00123405 seconds.
+Compiler stage 4.1 finished in 0.00145483 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./ElastoDynamics.h.
-Compiler stage 5 finished in 0.000820875 seconds.
+Compiler stage 5 finished in 0.000711918 seconds.
 
-FFC finished in 0.345761 seconds.
+FFC finished in 0.524685 seconds.
+Output written to ./ElastoDynamics.h.
diff --git a/demo/undocumented/elastodynamics/cpp/main.cpp b/demo/undocumented/elastodynamics/cpp/main.cpp
index aa55917..d338bdf 100644
--- a/demo/undocumented/elastodynamics/cpp/main.cpp
+++ b/demo/undocumented/elastodynamics/cpp/main.cpp
@@ -115,52 +115,56 @@ int main(int argc, char* argv[])
   init(argc, argv);
 
   // Create mesh
-  Mesh mesh("../dolfin_fine.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../dolfin_fine.xml.gz");
 
   // Create function space
-  ElastoDynamics::FunctionSpace V(mesh);
+  auto V = std::make_shared<ElastoDynamics::FunctionSpace>(mesh);
 
   // Material parameters
-  Constant rho(1.0);                           // mass density
-  Constant eta(0.25);                          // damping coefficient
+  auto rho = std::make_shared<Constant>(1.0);  // mass density
+  auto eta = std::make_shared<Constant>(0.25); // damping coefficient
   double E  = 1.0;                             // Youngs modulus
   double nu = 0.0;                             // Poisson ratio
-  Constant lambda((nu*E)/((1.0 + nu)*(1.0 - 2.0 * nu))); // Lame coefficient
-  Constant mu(E/(2.0*(1.0 + nu)));               // Lame coefficient
+  auto lambda = std::make_shared<Constant>((nu*E)/((1.0 + nu)*(1.0 - 2.0 * nu))); // Lame coefficient
+  auto mu = std::make_shared<Constant>(E/(2.0*(1.0 + nu))); // Lame coefficient
 
   // Time stepping parameters
-  Constant alpha_m(0.2);
-  Constant alpha_f(0.4);
-  Constant beta(0.36);
-  Constant gamma(0.7);
-  Constant dt(1.0/32.0);    // time step
+  auto alpha_m = std::make_shared<Constant>(0.2);
+  auto alpha_f = std::make_shared<Constant>(0.4);
+  auto beta = std::make_shared<Constant>(0.36);
+  auto gamma = std::make_shared<Constant>(0.7);
+  auto dt = std::make_shared<Constant>(1.0/32.0);    // time step
   double t = 0.0;           // initial time
-  double T = 200*dt;        // final time
+  double T = 200*(*dt);        // final time
 
   // Body force
-  Constant f(0.0, 0.0);
+  auto f = std::make_shared<Constant>(0.0, 0.0);
 
   // External load
   RightBoundary right_boundary;
-  MeshFunction<std::size_t> right_boundary_function(mesh, 1);
-  right_boundary.mark(right_boundary_function, 3);
-  Pressure p(t, dt, false), p0(t, dt, true);
+  auto right_boundary_function
+    = std::make_shared<MeshFunction<std::size_t>>(mesh, 1);
+  right_boundary.mark(*right_boundary_function, 3);
+  auto p = std::make_shared<Pressure>(t, *dt, false);
+  auto p0 = std::make_shared<Pressure>(t, *dt, true);
 
   // Dirichlet boundary conditions
-  LeftBoundary left_boundary;
-  Constant zero(0.0, 0.0);
-  DirichletBC bc0(V, zero, left_boundary);
-  std::vector<const DirichletBC*> bc= {&bc0};
+  auto left_boundary = std::make_shared<LeftBoundary>();
+  auto zero = std::make_shared<Constant>(0.0, 0.0);
+  DirichletBC bc(V, zero, left_boundary);
 
   // Define solution vectors
-  Function u(V), u0(V);  // displacement
-  Function v(V), v0(V);  // velocity
-  Function a(V), a0(V);  // acceleration
+  auto u = std::make_shared<Function>(V); // displacement
+  auto u0 = std::make_shared<Function>(V);
+  Function v(V);  // velocity
+  auto v0 = std::make_shared<Function>(V);
+  Function a(V);  // acceleration
+  auto a0 = std::make_shared<Function>(V);
 
   // Set initial conditions and initialise acceleration function
-  u0.vector()->zero();
-  v0.vector()->zero();
-  a0.vector()->zero();
+  u0->vector()->zero();
+  v0->vector()->zero();
+  a0->vector()->zero();
 
   // Create forms
   ElastoDynamics::BilinearForm a_form(V, V);
@@ -192,7 +196,7 @@ int main(int argc, char* argv[])
   L.ds = right_boundary_function;
 
   // Create projection to compute the normal strain eps_xx
-  DG0_eps_xx::FunctionSpace Vdg(mesh);
+  auto Vdg = std::make_shared<DG0_eps_xx::FunctionSpace>(mesh);
   DG0_eps_xx::BilinearForm a_eps(Vdg, Vdg);
   DG0_eps_xx::LinearForm L_eps(Vdg);
   L_eps.u = u;
@@ -207,22 +211,22 @@ int main(int argc, char* argv[])
   while (t < T)
   {
     // Update for next time step
-    t += dt;
+    t += *dt;
     cout << "Time: " << t << endl;
 
     // Solve
-    solve(a_form == L, u, bc);
+    solve(a_form == L, *u, {&bc});
     solve(a_eps == L_eps, eps_xx);
 
     // Update velocity and acceleration
-    update_a(a, u, a0, v0, u0, beta, dt);
-    update_v(v, a, a0, v0, gamma, dt);
-    u0 = u; v0 = v; a0 = a;
+    update_a(a, *u, *a0, *v0, *u0, *beta, *dt);
+    update_v(v, a, *a0, *v0, *gamma, *dt);
+    *u0 = *u; *v0 = v; *a0 = a;
 
     // Save solutions to file
     if (step % 2 == 0)
     {
-      file_u << u;
+      file_u << *u;
       file_eps << eps_xx;
     }
     ++step;
diff --git a/demo/undocumented/elastodynamics/python/demo_elastodynamics.py b/demo/undocumented/elastodynamics/python/demo_elastodynamics.py
index 8df6542..28b6cf4 100644
--- a/demo/undocumented/elastodynamics/python/demo_elastodynamics.py
+++ b/demo/undocumented/elastodynamics/python/demo_elastodynamics.py
@@ -51,7 +51,7 @@ def update(u, u0, v0, a0, beta, gamma, dt):
 # External load
 class Traction(Expression):
 
-    def __init__(self, dt, t, old):
+    def __init__(self, dt, t, old, **kwargs):
         self.t   = t
         self.dt  = dt
         self.old = old
@@ -124,8 +124,8 @@ a0 = Function(V)
 
 # External forces (body and applied tractions
 f  = Constant((0.0, 0.0))
-p  = Traction(dt, t, False)
-p0 = Traction(dt, t, True)
+p  = Traction(dt, t, False, degree=1)
+p0 = Traction(dt, t, True, degree=1)
 
 # Create mesh function over the cell facets
 boundary_subdomains = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
@@ -134,11 +134,11 @@ force_boundary = AutoSubDomain(right)
 force_boundary.mark(boundary_subdomains, 3)
 
 # Define measure for boundary condition integral
-dss = ds[boundary_subdomains]
+dss = ds(subdomain_data=boundary_subdomains)
 
 # Stress tensor
 def sigma(r):
-    return 2.0*mu*sym(grad(r)) + lmbda*tr(sym(grad(r)))*Identity(r.geometric_dimension())
+    return 2.0*mu*sym(grad(r)) + lmbda*tr(sym(grad(r)))*Identity(len(r))
 
 # Forms
 a = factor_m1*inner(u, r)*dx + factor_d1*inner(u, r)*dx \
diff --git a/demo/undocumented/eval/cpp/CMakeLists.txt b/demo/undocumented/eval/cpp/CMakeLists.txt
index 283efd4..2ce1009 100644
--- a/demo/undocumented/eval/cpp/CMakeLists.txt
+++ b/demo/undocumented/eval/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/eval/cpp/Projection.h b/demo/undocumented/eval/cpp/Projection.h
index fafdf94..717e662 100644
--- a/demo/undocumented/eval/cpp/Projection.h
+++ b/demo/undocumented/eval/cpp/Projection.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __PROJECTION_H
 #define __PROJECTION_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class projection_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   projection_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_finite_element_0()
+  ~projection_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 10;
+    return 4;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -137,43 +150,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -183,43 +180,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -229,43 +210,27 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -275,321 +240,809 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 4; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
@@ -597,50 +1050,28 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
   {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 10; r++)
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
     
     // Compute number of derivatives.
     unsigned int num_derivatives = 1;
@@ -649,28 +1080,289 @@ public:
       num_derivatives *= 3;
     } // end loop over 'r'
     
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
     {
-      values[r] = 0.0;
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
     } // end loop over 'r'
     
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
       return ;
     }
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    // Helper variable to hold values of a single dof.
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
     {
-    return ;
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new projection_finite_element_0();
+  }
+
+};
+
+
+class projection_finite_element_1: public ufc::finite_element
+{
+public:
+
+  projection_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~projection_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
     }
     
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -679,9 +1371,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -700,578 +1392,598 @@ public:
     double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
     
     
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[9][2];
-    for (unsigned int row = 0; row < 9; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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 > 2)
-            combinations[row][col] = 0;
-          else
-          {
-            combinations[row][col] += 1;
-            break;
-          }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[9][9];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
       {
-        derivatives[r] = 0.0;
+        values[2] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1286,9 +1998,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1298,11 +2010,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1312,11 +2024,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1326,11 +2038,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1339,9 +2051,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1358,123 +2070,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1489,9 +2155,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1501,11 +2167,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1515,11 +2181,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1529,11 +2195,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1542,9 +2208,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1561,123 +2227,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1692,9 +2312,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1704,11 +2324,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1718,11 +2338,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1732,11 +2352,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1745,9 +2365,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1764,123 +2384,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1895,9 +2469,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1907,11 +2481,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1921,11 +2495,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1935,11 +2509,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1948,9 +2522,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1967,123 +2541,77 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2098,9 +2626,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2110,11 +2638,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2124,11 +2652,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2138,11 +2666,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2151,9 +2679,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2165,128 +2693,82 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2301,9 +2783,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2313,11 +2795,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2327,11 +2809,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2341,11 +2823,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2354,9 +2836,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2368,128 +2850,82 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2504,9 +2940,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2516,11 +2952,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2530,11 +2966,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2544,11 +2980,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2557,9 +2993,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2571,128 +3007,239 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
       
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 4; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 4; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2707,9 +3254,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2719,11 +3266,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2733,11 +3280,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2747,11 +3294,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 4; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 4; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2760,9 +3307,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 4; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2774,340 +3321,4469 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 9:
       {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new projection_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new projection_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new projection_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new projection_finite_element_1();
+  }
+
+};
+
+
+class projection_finite_element_2: public ufc::finite_element
+{
+public:
+
+  projection_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~projection_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', tetrahedron, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 10;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[9][2];
+    for (unsigned int row = 0; row < 9; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[9][9];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
       return ;
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[9];
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[13] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[14] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[19] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[20] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[21] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[22] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[23] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[26] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[27] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[28] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new projection_finite_element_2();
+  }
+
+};
+
+
+class projection_dofmap_0: public ufc::dofmap
+{
+public:
+
+  projection_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~projection_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new projection_dofmap_0();
+  }
+
+};
+
+
+class projection_dofmap_1: public ufc::dofmap
+{
+public:
+
+  projection_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~projection_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  std::size_t topological_dimension() const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    return 3;
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
+    return 3*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 9;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 3;
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 4:
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
-    case 5:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
-    case 6:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
         break;
       }
-    case 7:
+    case 3:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
         break;
       }
-    case 8:
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
         break;
       }
-    case 9:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new projection_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new projection_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new projection_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new projection_finite_element_0();
+    return new projection_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class projection_dofmap_0: public ufc::dofmap
+class projection_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  projection_dofmap_0() : ufc::dofmap()
+  projection_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_dofmap_0()
+  ~projection_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3136,39 +7812,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3197,29 +7862,27 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[1][0];
-    dofs[5] = offset + c.entity_indices[1][1];
-    dofs[6] = offset + c.entity_indices[1][2];
-    dofs[7] = offset + c.entity_indices[1][3];
-    dofs[8] = offset + c.entity_indices[1][4];
-    dofs[9] = offset + c.entity_indices[1][5];
+    dofs[4] = offset + entity_indices[1][0];
+    dofs[5] = offset + entity_indices[1][1];
+    dofs[6] = offset + entity_indices[1][2];
+    dofs[7] = offset + entity_indices[1][3];
+    dofs[8] = offset + entity_indices[1][4];
+    dofs[9] = offset + entity_indices[1][5];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3267,9 +7930,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -3368,94 +8030,49 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new projection_dofmap_0();
+    return new projection_dofmap_2();
   }
 
 };
 
-/// 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 projection_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   projection_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~projection_cell_integral_0_otherwise()
+  ~projection_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    0
@@ -3464,7 +8081,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -3582,38 +8199,31 @@ public:
 
 };
 
-/// 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 projection_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   projection_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~projection_cell_integral_1_otherwise()
+  ~projection_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    10
@@ -3622,7 +8232,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -3659,77 +8269,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class projection_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   projection_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_form_0()
+  ~projection_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "8ec192d748e0b1d80c50374dc4ed888f38dc673f73ebde37aa4a590682079661dd09e689716f540725f7f8309ef06755a6f1db9c4ec2fb29e4b712258735e921";
+    return "a51045c932d5633d5d0ff6cdd2e7ce24aa471d34d3138fa9f6ef66a34ea4b26e9ebbb1cd35672bdfa134dda3b16c96171fd390bdf703e731853c65e7b1cbc57a";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new projection_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new projection_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new projection_finite_element_0();
+        return new projection_finite_element_2();
         break;
       }
     case 1:
       {
-        return new projection_finite_element_0();
+        return new projection_finite_element_2();
         break;
       }
     }
@@ -3737,19 +8339,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new projection_dofmap_0();
+        return new projection_dofmap_2();
         break;
       }
     case 1:
       {
-        return new projection_dofmap_0();
+        return new projection_dofmap_2();
         break;
       }
     }
@@ -3757,203 +8358,231 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new projection_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class projection_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   projection_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~projection_form_1()
+  ~projection_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "14280f26afff16c433cf2017cc4e5a8311d176b7ed68f7c087c7e5f4c219ef81820bc16f078b41360f191473f0abb75e6353ddf46a811574bf764685e083de9a";
+    return "b46f48f12472849460aaeef75428df45f03cbf7e5e71982657486800128cac564af2c7e6859be4ca7806acf21213e185a39ae9199ece9584b2159606163cd264";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new projection_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new projection_dofmap_1();
+   }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new projection_finite_element_0();
+        return new projection_finite_element_2();
         break;
       }
     case 1:
       {
-        return new projection_finite_element_0();
+        return new projection_finite_element_2();
         break;
       }
     }
@@ -3961,19 +8590,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new projection_dofmap_0();
+        return new projection_dofmap_2();
         break;
       }
     case 1:
       {
-        return new projection_dofmap_0();
+        return new projection_dofmap_2();
         break;
       }
     }
@@ -3981,126 +8609,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new projection_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -4114,14 +8778,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Projection
 {
@@ -4130,43 +8800,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4177,43 +8824,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4224,63 +8848,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -4288,7 +8919,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_0());
+    _ufc_form = std::make_shared<const projection_form_0>();
   }
 
   // Destructor
@@ -4318,57 +8949,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -4376,69 +9062,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
+    _ufc_form = std::make_shared<const projection_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
+    _ufc_form = std::make_shared<const projection_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -4470,18 +9197,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/eval/cpp/compile.log b/demo/undocumented/eval/cpp/compile.log
index e168b37..35f75f2 100644
--- a/demo/undocumented/eval/cpp/compile.log
+++ b/demo/undocumented/eval/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Projection
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<3 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 0
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       3
   Number of cell subdomains: 0
@@ -30,8 +31,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<3 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -39,18 +40,30 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.14948 seconds.
+Compiler stage 1 finished in 0.334222 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -60,7 +73,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  100 entries computed in 0.00106 seconds
+  100 entries computed in 0.00113 seconds
   Shape of reference tensor: (10, 10)
   Primary multi index:   rank = 2 dims = [10, 10] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 0], [5, 1], [5, 2], [5, 3], [...]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -68,6 +81,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 0 dims = [] indices = [[]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -75,7 +89,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  100 entries computed in 0.001 seconds
+  100 entries computed in 0.00109 seconds
   Shape of reference tensor: (10, 10)
   Primary multi index:   rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
   Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
@@ -83,154 +97,164 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00633001 seconds.
+Compiler stage 2 finished in 0.0466971 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000148058 seconds.
+Compiler stage 3 finished in 0.000199795 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.24786 seconds.
+Compiler stage 4 finished in 0.523518 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000674009 seconds.
+Compiler stage 4.1 finished in 0.000703812 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Projection.h.
-Compiler stage 5 finished in 0.000725031 seconds.
+Compiler stage 5 finished in 0.00078392 seconds.
 
-FFC finished in 0.405538 seconds.
+FFC finished in 0.90657 seconds.
+Output written to ./Projection.h.
diff --git a/demo/undocumented/eval/cpp/main.cpp b/demo/undocumented/eval/cpp/main.cpp
index 0be9166..d044121 100644
--- a/demo/undocumented/eval/cpp/main.cpp
+++ b/demo/undocumented/eval/cpp/main.cpp
@@ -41,14 +41,14 @@ public:
 int main()
 {
   // Create mesh and a point in the mesh
-  UnitCubeMesh mesh(8, 8, 8);
+  auto mesh = std::make_shared<UnitCubeMesh>(8, 8, 8);
   Point x(0.31, 0.32, 0.33);
 
   // A user-defined function
-  F f;
+  auto f = std::make_shared<F>();
 
   // Project to a discrete function
-  Projection::FunctionSpace V(mesh);
+  auto V = std::make_shared<Projection::FunctionSpace>(mesh);
   Projection::BilinearForm a(V, V);
   Projection::LinearForm L(V);
   L.f = f;
@@ -56,7 +56,7 @@ int main()
   solve(a == L, g);
 
   // Evaluate user-defined function f
-  info("f(x) = %g", f(x));
+  info("f(x) = %g", (*f)(x));
 
   // Evaluate discrete function g (projection of f)
   info("g(x) = %g", g(x));
diff --git a/demo/undocumented/eval/python/demo_eval.py b/demo/undocumented/eval/python/demo_eval.py
index 5e048ff..96824b7 100644
--- a/demo/undocumented/eval/python/demo_eval.py
+++ b/demo/undocumented/eval/python/demo_eval.py
@@ -32,7 +32,7 @@ Vs = FunctionSpace(mesh, "CG", 2)
 Vv = VectorFunctionSpace(mesh, "CG", 2)
 fs = Expression("sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])", degree=2)
 fv = Expression(("sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])",
-               "1.0 + 3.0*x[0] + 4.0*x[1] + 0.5*x[2]","2"), element = Vv.ufl_element())
+                 "1.0 + 3.0*x[0] + 4.0*x[1] + 0.5*x[2]","2"), element = Vv.ufl_element())
 
 # Project to a discrete function
 g = project(fs, V=Vs)
diff --git a/demo/undocumented/extrapolation/cpp/CMakeLists.txt b/demo/undocumented/extrapolation/cpp/CMakeLists.txt
index 0d19677..b982180 100644
--- a/demo/undocumented/extrapolation/cpp/CMakeLists.txt
+++ b/demo/undocumented/extrapolation/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/extrapolation/cpp/P1.h b/demo/undocumented/extrapolation/cpp/P1.h
index 1053134..1dbe5da 100644
--- a/demo/undocumented/extrapolation/cpp/P1.h
+++ b/demo/undocumented/extrapolation/cpp/P1.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __P1_H
 #define __P1_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class p1_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   p1_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_finite_element_0()
+  ~p1_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,69 +902,55 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new p1_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class p1_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   p1_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_dofmap_0()
+  ~p1_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -985,39 +974,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1041,19 +1019,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1079,9 +1055,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -1132,32 +1107,18 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new p1_dofmap_0();
   }
@@ -1171,14 +1132,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace P1
 {
@@ -1187,43 +1154,20 @@ class FunctionSpace: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
diff --git a/demo/undocumented/extrapolation/cpp/P2.h b/demo/undocumented/extrapolation/cpp/P2.h
index 6c9de2a..695baa5 100644
--- a/demo/undocumented/extrapolation/cpp/P2.h
+++ b/demo/undocumented/extrapolation/cpp/P2.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __P2_H
 #define __P2_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class p2_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   p2_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p2_finite_element_0()
+  ~p2_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -339,20 +352,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -361,26 +372,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,7 +409,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -412,7 +421,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,8 +430,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -520,7 +529,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -671,7 +680,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -822,7 +831,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -973,7 +982,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1124,7 +1133,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +1284,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1387,28 +1396,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1444,7 +1451,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1452,22 +1459,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1478,48 +1483,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1529,50 +1534,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1580,69 +1583,61 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new p2_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class p2_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   p2_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p2_dofmap_0()
+  ~p2_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1666,39 +1661,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1722,25 +1706,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1769,9 +1751,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -1845,38 +1826,18 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new p2_dofmap_0();
   }
@@ -1890,14 +1851,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace P2
 {
@@ -1906,43 +1873,20 @@ class FunctionSpace: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p2_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p2_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p2_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p2_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p2_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p2_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p2_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p2_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p2_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
diff --git a/demo/undocumented/extrapolation/cpp/compile.log b/demo/undocumented/extrapolation/cpp/compile.log
index 99dfbdd..602583d 100644
--- a/demo/undocumented/extrapolation/cpp/compile.log
+++ b/demo/undocumented/extrapolation/cpp/compile.log
@@ -1,216 +1,116 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling element P2
 
-Compiler stage 1: Analyzing form(s)
------------------------------------
+Compiler stage 1: Analyzing elements(s)
+---------------------------------------
   
-Compiler stage 1 finished in 0.000213146 seconds.
+Compiler stage 1 finished in 0.000238895 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
   Computing representation of 1 elements
   Reusing element from cache
+  Reusing element from cache
   Computing representation of 1 dofmaps
   Reusing element from cache
+  Computing representation of 0 coordinate mappings
   Computing representation of integrals
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0745199 seconds.
+Compiler stage 2 finished in 0.124007 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000151157 seconds.
+Compiler stage 3 finished in 0.000151873 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 1 dofmap(s)
+  Generating code for 0 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.083565 seconds.
+Compiler stage 4 finished in 0.0726769 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000253916 seconds.
+Compiler stage 4.1 finished in 0.000240088 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./P2.h.
-Compiler stage 5 finished in 0.000640869 seconds.
+Compiler stage 5 finished in 0.000401974 seconds.
 
-FFC finished in 0.159695 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.198085 seconds.
+Output written to ./P2.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling element P1
 
-Compiler stage 1: Analyzing form(s)
------------------------------------
+Compiler stage 1: Analyzing elements(s)
+---------------------------------------
   
-Compiler stage 1 finished in 0.000165939 seconds.
+Compiler stage 1 finished in 0.000244856 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
   Computing representation of 1 elements
   Reusing element from cache
+  Reusing element from cache
   Computing representation of 1 dofmaps
   Reusing element from cache
+  Computing representation of 0 coordinate mappings
   Computing representation of integrals
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0176849 seconds.
+Compiler stage 2 finished in 0.0424871 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000112057 seconds.
+Compiler stage 3 finished in 0.000169039 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 1 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 1 dofmap(s)
+  Generating code for 0 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0300119 seconds.
+Compiler stage 4 finished in 0.0378098 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000215054 seconds.
+Compiler stage 4.1 finished in 0.000289917 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./P1.h.
-Compiler stage 5 finished in 0.00050211 seconds.
+Compiler stage 5 finished in 0.000458002 seconds.
 
-FFC finished in 0.0489728 seconds.
+FFC finished in 0.081876 seconds.
+Output written to ./P1.h.
diff --git a/demo/undocumented/extrapolation/cpp/main.cpp b/demo/undocumented/extrapolation/cpp/main.cpp
index ed08440..920d2e3 100644
--- a/demo/undocumented/extrapolation/cpp/main.cpp
+++ b/demo/undocumented/extrapolation/cpp/main.cpp
@@ -42,9 +42,9 @@ public:
 int main()
 {
   // Create mesh and function spaces
-  UnitSquareMesh mesh(8, 8);
-  P1::FunctionSpace P1(mesh);
-  P2::FunctionSpace P2(mesh);
+  auto mesh = std::make_shared<UnitSquareMesh>(8, 8);
+  auto P1 = std::make_shared<P1::FunctionSpace>(mesh);
+  auto P2 = std::make_shared<P2::FunctionSpace>(mesh);
 
   // Create exact dual
   Dual dual;
diff --git a/demo/undocumented/extrapolation/python/demo_extrapolation.py b/demo/undocumented/extrapolation/python/demo_extrapolation.py
index b77daef..381fd5e 100644
--- a/demo/undocumented/extrapolation/python/demo_extrapolation.py
+++ b/demo/undocumented/extrapolation/python/demo_extrapolation.py
@@ -26,7 +26,7 @@ P1 = FunctionSpace(mesh, "CG", 1)
 P2 = FunctionSpace(mesh, "CG", 2)
 
 # Create exact dual
-dual = Expression("sin(5.0*x[0])*sin(5.0*x[1])")
+dual = Expression("sin(5.0*x[0])*sin(5.0*x[1])", degree=2)
 
 # Create P1 approximation of exact dual
 z1 = Function(P1)
diff --git a/demo/undocumented/functional/cpp/CMakeLists.txt b/demo/undocumented/functional/cpp/CMakeLists.txt
index 75a6d25..5dc0f19 100644
--- a/demo/undocumented/functional/cpp/CMakeLists.txt
+++ b/demo/undocumented/functional/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/functional/cpp/EnergyNorm.h b/demo/undocumented/functional/cpp/EnergyNorm.h
index f162f7e..b16b58a 100644
--- a/demo/undocumented/functional/cpp/EnergyNorm.h
+++ b/demo/undocumented/functional/cpp/EnergyNorm.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __ENERGYNORM_H
 #define __ENERGYNORM_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class energynorm_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   energynorm_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~energynorm_finite_element_0()
+  ~energynorm_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,33 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -159,33 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -195,141 +192,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -339,48 +220,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -459,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -481,81 +358,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -570,9 +427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -582,11 +439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -596,11 +453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -609,9 +466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -632,81 +489,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -721,9 +558,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -733,11 +570,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -747,11 +584,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -760,9 +597,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -783,81 +620,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -872,9 +689,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -884,11 +701,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -898,11 +715,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -911,9 +728,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -930,129 +747,2692 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new energynorm_finite_element_0();
+  }
+
+};
+
+
+class energynorm_finite_element_1: public ufc::finite_element
+{
+public:
+
+  energynorm_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~energynorm_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new energynorm_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new energynorm_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new energynorm_finite_element_1();
+  }
+
+};
+
+
+class energynorm_finite_element_2: public ufc::finite_element
+{
+public:
+
+  energynorm_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~energynorm_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
               for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
@@ -1124,7 +3504,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +3655,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1376,273 +3756,678 @@ public:
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new energynorm_finite_element_2();
+  }
+
+};
+
+
+class energynorm_dofmap_0: public ufc::dofmap
+{
+public:
+
+  energynorm_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~energynorm_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
         break;
       }
     }
     
+    return false;
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  std::size_t topological_dimension() const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    return 2;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
     }
     
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
     {
-      num_derivatives *= 2;
-    } // end loop over 'r'
+    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;
+      }
+    }
     
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    switch (d)
     {
-      return ;
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new energynorm_dofmap_0();
+  }
+
+};
+
+
+class energynorm_dofmap_1: public ufc::dofmap
+{
+public:
+
+  energynorm_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~energynorm_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
     {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
     
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+    case 0:
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    switch (facet)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
         break;
       }
-    case 4:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
-    case 5:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new energynorm_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new energynorm_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new energynorm_finite_element_0();
+    return new energynorm_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class energynorm_dofmap_0: public ufc::dofmap
+class energynorm_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  energynorm_dofmap_0() : ufc::dofmap()
+  energynorm_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~energynorm_dofmap_0()
+  ~energynorm_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1666,39 +4451,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1722,25 +4496,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1769,9 +4541,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -1845,80 +4616,53 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new energynorm_dofmap_0();
+    return new energynorm_dofmap_2();
   }
 
 };
 
-/// 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 energynorm_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   energynorm_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~energynorm_cell_integral_0_otherwise()
+  ~energynorm_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1949,8 +4693,8 @@ public:
     
     static const double FE0_D01[6][5] = \
     {{0.633695145960915, -0.633695145960916, 3.26739029192182, 0.0, -3.26739029192184},
-    {0.633695145960915, 2.26739029192184, 0.366304854039066, -2.90108543788275, -0.366304854039082},
-    {-2.26739029192184, -0.633695145960916, 0.366304854039073, 2.90108543788276, -0.366304854039083},
+    {0.633695145960915, 2.26739029192184, 0.366304854039068, -2.90108543788275, -0.366304854039081},
+    {-2.26739029192184, -0.633695145960916, 0.366304854039074, 2.90108543788276, -0.366304854039083},
     {-0.783793963663865, 0.783793963663862, 0.432412072672267, 0.0, -0.432412072672279},
     {-0.783793963663864, -0.567587927327719, 1.78379396366385, 1.35138189099159, -1.78379396366386},
     {0.567587927327715, 0.783793963663862, 1.78379396366385, -1.35138189099157, -1.78379396366386}};
@@ -1959,8 +4703,8 @@ public:
     static const unsigned int nzc0[5] = {0, 2, 3, 4, 5};
     
     static const double FE0_D10[6][5] = \
-    {{0.633695145960923, 2.26739029192184, 0.366304854039083, -0.366304854039083, -2.90108543788276},
-    {0.633695145960919, -0.633695145960917, 3.26739029192183, -3.26739029192183, 0.0},
+    {{0.633695145960922, 2.26739029192184, 0.366304854039083, -0.366304854039083, -2.90108543788276},
+    {0.63369514596092, -0.633695145960917, 3.26739029192183, -3.26739029192183, 0.0},
     {-2.26739029192183, -0.633695145960919, 0.366304854039083, -0.366304854039083, 2.90108543788275},
     {-0.78379396366386, -0.567587927327721, 1.78379396366386, -1.78379396366386, 1.35138189099158},
     {-0.783793963663859, 0.783793963663859, 0.432412072672279, -0.432412072672279, 0.0},
@@ -2017,72 +4761,64 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class energynorm_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   energynorm_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~energynorm_form_0()
+  ~energynorm_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "98490660aa6f7c8728372c63f409769bc868518e4583907f9c1ca3093729a7af8e533376366146a5fd039bdec9ed300b3e1481d7ff5a82cbc29fb3070bcece2f";
+    return "b941483d4d69ad1f13c5c2dc1a68a01a8824b969219e5b3d50ff449e8bcfbc433f2089b2f4c3b4317ffd8a419a6331fc97b49d068827f1b2cdd1ab68f6da810e";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new energynorm_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new energynorm_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new energynorm_finite_element_0();
+        return new energynorm_finite_element_2();
         break;
       }
     }
@@ -2090,14 +4826,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new energynorm_dofmap_0();
+        return new energynorm_dofmap_2();
         break;
       }
     }
@@ -2105,126 +4840,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new energynorm_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -2238,14 +5009,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace EnergyNorm
 {
@@ -2254,43 +5031,20 @@ class CoefficientSpace_v: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_v(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new energynorm_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new energynorm_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_v(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new energynorm_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new energynorm_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_v(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new energynorm_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new energynorm_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<energynorm_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<energynorm_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_v(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new energynorm_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new energynorm_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<energynorm_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<energynorm_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2304,63 +5058,85 @@ class Form_M: public dolfin::Form
 public:
 
   // Constructor
-  Form_M(const dolfin::Mesh& mesh):
+  Form_M(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::Form(0, 1), v(*this, 0)
   {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _ufc_form = std::shared_ptr<const ufc::form>(new energynorm_form_0());
+    _mesh = mesh;
+    _ufc_form = std::make_shared<const energynorm_form_0>();
   }
 
   // Constructor
-  Form_M(const dolfin::Mesh& mesh, const dolfin::GenericFunction& v):
+  Form_M(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> v):
     dolfin::Form(0, 1), v(*this, 0)
   {
-    _mesh = reference_to_no_delete_pointer(mesh);
+    _mesh = mesh;
     this->v = v;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new energynorm_form_0());
+    _ufc_form = std::make_shared<const energynorm_form_0>();
   }
 
-  // Constructor
-  Form_M(const dolfin::Mesh& mesh, std::shared_ptr<const dolfin::GenericFunction> v):
-    dolfin::Form(0, 1), v(*this, 0)
+  // Destructor
+  ~Form_M()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->v = *v;
+    if (name == "v")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new energynorm_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_M(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::Form(0, 1), v(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _mesh = mesh;
-    _ufc_form = std::shared_ptr<const ufc::form>(new energynorm_form_0());
+    switch (i)
+    {
+    case 0:
+      return "v";
+    }
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_M_FunctionSpace_0 CoefficientSpace_v;
+
+  // Coefficients
+  dolfin::CoefficientAssigner v;
+};
+
+class MultiMeshForm_M: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_M(std::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& v):
-    dolfin::Form(0, 1), v(*this, 0)
+  MultiMeshForm_M(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::MultiMeshForm(), v(*this, 0)
   {
-    _mesh = mesh;
-    this->v = v;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new energynorm_form_0());
+    /// Assign coefficients
+
   }
 
   // Constructor
-  Form_M(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> v):
-    dolfin::Form(0, 1), v(*this, 0)
+  MultiMeshForm_M(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> v):
+    dolfin::MultiMeshForm(), v(*this, 0)
   {
-    _mesh = mesh;
-    this->v = *v;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new energynorm_form_0());
+    /// Assign coefficients    this->v = v;
+
   }
 
   // Destructor
-  ~Form_M()
+  ~MultiMeshForm_M()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2394,11 +5170,12 @@ public:
   typedef Form_M_FunctionSpace_0 CoefficientSpace_v;
 
   // Coefficients
-  dolfin::CoefficientAssigner v;
+  dolfin::MultiMeshCoefficientAssigner v;
 };
 
 // Class typedefs
 typedef Form_M Functional;
+typedef MultiMeshForm_M MultiMeshFunctional;
 
 }
 
diff --git a/demo/undocumented/functional/cpp/compile.log b/demo/undocumented/functional/cpp/compile.log
index e791da8..905073d 100644
--- a/demo/undocumented/functional/cpp/compile.log
+++ b/demo/undocumented/functional/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form EnergyNorm
 
@@ -12,8 +13,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '()'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -22,27 +23,39 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.064379 seconds.
+Compiler stage 1 finished in 0.12538 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {6: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+  {6: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
              0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
@@ -114,16 +127,16 @@ Compiler stage 2: Computing intermediate representation
          [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
             0.        ],
           [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849]]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {None: {(0, 1): array([[  6.33695146e-01,   6.33695146e-01,  -2.26739029e+00,
+            0.44594849]]])}}}, FiniteElement('Lagrange', triangle, 2): {None: {None: {(0, 1): array([[  6.33695146e-01,   6.33695146e-01,  -2.26739029e+00,
            -7.83793964e-01,  -7.83793964e-01,   5.67587927e-01],
-         [  8.77076189e-15,   8.32667268e-15,   5.88418203e-15,
-            6.94583280e-15,   7.04991621e-15,   8.22952817e-15],
+         [  7.99360578e-15,   7.32747196e-15,   5.44009282e-15,
+            6.93195501e-15,   6.88338275e-15,   8.11850587e-15],
          [ -6.33695146e-01,   2.26739029e+00,  -6.33695146e-01,
             7.83793964e-01,  -5.67587927e-01,   7.83793964e-01],
          [  3.26739029e+00,   3.66304854e-01,   3.66304854e-01,
             4.32412073e-01,   1.78379396e+00,   1.78379396e+00],
-         [  8.43769499e-15,  -2.90108544e+00,   2.90108544e+00,
-            8.18789481e-15,   1.35138189e+00,  -1.35138189e+00],
+         [  7.10542736e-15,  -2.90108544e+00,   2.90108544e+00,
+            8.13238366e-15,   1.35138189e+00,  -1.35138189e+00],
          [ -3.26739029e+00,  -3.66304854e-01,  -3.66304854e-01,
            -4.32412073e-01,  -1.78379396e+00,  -1.78379396e+00]]), (1, 0): array([[  6.33695146e-01,   6.33695146e-01,  -2.26739029e+00,
            -7.83793964e-01,  -7.83793964e-01,   5.67587927e-01],
@@ -135,8 +148,8 @@ Compiler stage 2: Computing intermediate representation
             1.78379396e+00,   4.32412073e-01,   1.78379396e+00],
          [ -3.66304854e-01,  -3.26739029e+00,  -3.66304854e-01,
            -1.78379396e+00,  -4.32412073e-01,  -1.78379396e+00],
-         [ -2.90108544e+00,  -2.42787315e-15,   2.90108544e+00,
-            1.35138189e+00,   2.02557929e-16,  -1.35138189e+00]]), (0, 0): array([[-0.07480381, -0.07480381,  0.51763234, -0.04820838, -0.04820838,
+         [ -2.90108544e+00,  -3.86532069e-15,   2.90108544e+00,
+            1.35138189e+00,  -4.32612710e-16,  -1.35138189e+00]]), (0, 0): array([[-0.07480381, -0.07480381,  0.51763234, -0.04820838, -0.04820838,
           -0.08473049],
          [ 0.51763234, -0.07480381, -0.07480381, -0.08473049, -0.04820838,
           -0.04820838],
@@ -153,25 +166,25 @@ Compiler stage 2: Computing intermediate representation
   {'FE0_D10': array([[  6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,  -2.90108544e+00],
          [  6.33695146e-01,  -6.33695146e-01,   0.00000000e+00,
-            3.26739029e+00,  -3.26739029e+00,  -2.42787315e-15],
+            3.26739029e+00,  -3.26739029e+00,  -3.86532069e-15],
          [ -2.26739029e+00,  -6.33695146e-01,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,   2.90108544e+00],
          [ -7.83793964e-01,  -5.67587927e-01,   0.00000000e+00,
             1.78379396e+00,  -1.78379396e+00,   1.35138189e+00],
          [ -7.83793964e-01,   7.83793964e-01,   0.00000000e+00,
-            4.32412073e-01,  -4.32412073e-01,   2.02557929e-16],
+            4.32412073e-01,  -4.32412073e-01,  -4.32612710e-16],
          [  5.67587927e-01,   7.83793964e-01,   0.00000000e+00,
-            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE0_D01': array([[  6.33695146e-01,   8.77076189e-15,  -6.33695146e-01,
-            3.26739029e+00,   8.43769499e-15,  -3.26739029e+00],
-         [  6.33695146e-01,   8.32667268e-15,   2.26739029e+00,
+            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE0_D01': array([[  6.33695146e-01,   7.99360578e-15,  -6.33695146e-01,
+            3.26739029e+00,   7.10542736e-15,  -3.26739029e+00],
+         [  6.33695146e-01,   7.32747196e-15,   2.26739029e+00,
             3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01],
-         [ -2.26739029e+00,   5.88418203e-15,  -6.33695146e-01,
+         [ -2.26739029e+00,   5.44009282e-15,  -6.33695146e-01,
             3.66304854e-01,   2.90108544e+00,  -3.66304854e-01],
-         [ -7.83793964e-01,   6.94583280e-15,   7.83793964e-01,
-            4.32412073e-01,   8.18789481e-15,  -4.32412073e-01],
-         [ -7.83793964e-01,   7.04991621e-15,  -5.67587927e-01,
+         [ -7.83793964e-01,   6.93195501e-15,   7.83793964e-01,
+            4.32412073e-01,   8.13238366e-15,  -4.32412073e-01],
+         [ -7.83793964e-01,   6.88338275e-15,  -5.67587927e-01,
             1.78379396e+00,   1.35138189e+00,  -1.78379396e+00],
-         [  5.67587927e-01,   8.22952817e-15,   7.83793964e-01,
+         [  5.67587927e-01,   8.11850587e-15,   7.83793964e-01,
             1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
            0.        ],
          [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
@@ -242,25 +255,25 @@ Compiler stage 2: Computing intermediate representation
   tables: {'FE0_D10': array([[  6.33695146e-01,   2.26739029e+00,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,  -2.90108544e+00],
          [  6.33695146e-01,  -6.33695146e-01,   0.00000000e+00,
-            3.26739029e+00,  -3.26739029e+00,  -2.42787315e-15],
+            3.26739029e+00,  -3.26739029e+00,  -3.86532069e-15],
          [ -2.26739029e+00,  -6.33695146e-01,   0.00000000e+00,
             3.66304854e-01,  -3.66304854e-01,   2.90108544e+00],
          [ -7.83793964e-01,  -5.67587927e-01,   0.00000000e+00,
             1.78379396e+00,  -1.78379396e+00,   1.35138189e+00],
          [ -7.83793964e-01,   7.83793964e-01,   0.00000000e+00,
-            4.32412073e-01,  -4.32412073e-01,   2.02557929e-16],
+            4.32412073e-01,  -4.32412073e-01,  -4.32612710e-16],
          [  5.67587927e-01,   7.83793964e-01,   0.00000000e+00,
-            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE0_D01': array([[  6.33695146e-01,   8.77076189e-15,  -6.33695146e-01,
-            3.26739029e+00,   8.43769499e-15,  -3.26739029e+00],
-         [  6.33695146e-01,   8.32667268e-15,   2.26739029e+00,
+            1.78379396e+00,  -1.78379396e+00,  -1.35138189e+00]]), 'FE0_D01': array([[  6.33695146e-01,   7.99360578e-15,  -6.33695146e-01,
+            3.26739029e+00,   7.10542736e-15,  -3.26739029e+00],
+         [  6.33695146e-01,   7.32747196e-15,   2.26739029e+00,
             3.66304854e-01,  -2.90108544e+00,  -3.66304854e-01],
-         [ -2.26739029e+00,   5.88418203e-15,  -6.33695146e-01,
+         [ -2.26739029e+00,   5.44009282e-15,  -6.33695146e-01,
             3.66304854e-01,   2.90108544e+00,  -3.66304854e-01],
-         [ -7.83793964e-01,   6.94583280e-15,   7.83793964e-01,
-            4.32412073e-01,   8.18789481e-15,  -4.32412073e-01],
-         [ -7.83793964e-01,   7.04991621e-15,  -5.67587927e-01,
+         [ -7.83793964e-01,   6.93195501e-15,   7.83793964e-01,
+            4.32412073e-01,   8.13238366e-15,  -4.32412073e-01],
+         [ -7.83793964e-01,   6.88338275e-15,  -5.67587927e-01,
             1.78379396e+00,   1.35138189e+00,  -1.78379396e+00],
-         [  5.67587927e-01,   8.22952817e-15,   7.83793964e-01,
+         [  5.67587927e-01,   8.11850587e-15,   7.83793964e-01,
             1.78379396e+00,  -1.35138189e+00,  -1.78379396e+00]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
            0.        ],
          [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
@@ -385,90 +398,55 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0522192 seconds.
+Compiler stage 2 finished in 0.0620902 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.00124002 seconds.
+Compiler stage 3 finished in 0.00180101 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -477,18 +455,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.0707121 seconds.
+Compiler stage 4 finished in 0.140345 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000365019 seconds.
+Compiler stage 4.1 finished in 0.000393152 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./EnergyNorm.h.
-Compiler stage 5 finished in 0.000524998 seconds.
+Compiler stage 5 finished in 0.00049901 seconds.
 
-FFC finished in 0.18973 seconds.
+FFC finished in 0.330873 seconds.
+Output written to ./EnergyNorm.h.
diff --git a/demo/undocumented/functional/cpp/main.cpp b/demo/undocumented/functional/cpp/main.cpp
index 908e6be..aa546c3 100644
--- a/demo/undocumented/functional/cpp/main.cpp
+++ b/demo/undocumented/functional/cpp/main.cpp
@@ -41,15 +41,13 @@ int main()
   public:
 
     void eval(Array<double>& values, const Array<double>& x) const
-    {
-      values[0] = sin(x[0]) + cos(x[1]);
-    }
+    { values[0] = sin(x[0]) + cos(x[1]); }
 
   };
 
   // Define functional
-  UnitSquareMesh mesh(16, 16);
-  MyFunction v;
+  auto mesh = std::make_shared<UnitSquareMesh>(16, 16);
+  auto v = std::make_shared<MyFunction>();
   EnergyNorm::Functional M(mesh, v);
 
   // Evaluate functional
diff --git a/demo/undocumented/ghost-mesh/python/.gitignore b/demo/undocumented/ghost-mesh/python/.gitignore
new file mode 100644
index 0000000..e33609d
--- /dev/null
+++ b/demo/undocumented/ghost-mesh/python/.gitignore
@@ -0,0 +1 @@
+*.png
diff --git a/demo/undocumented/ghost-mesh/python/demo_ghost-mesh.py b/demo/undocumented/ghost-mesh/python/demo_ghost-mesh.py
index 8927d95..5d1d343 100755
--- a/demo/undocumented/ghost-mesh/python/demo_ghost-mesh.py
+++ b/demo/undocumented/ghost-mesh/python/demo_ghost-mesh.py
@@ -4,20 +4,20 @@
 # run with mpirun
 #
 from __future__ import print_function
+from dolfin import *
+import numpy as np
+import sys, os
+import six
 
 try:
+    parameters['plotting_backend'] = 'matplotlib'
+except RuntimeError:
+    print("This demo requires matplotlib! Bye.")
+    exit()
+else:
     import matplotlib.pyplot as plt
     from matplotlib.collections import PolyCollection
-except ImportError:
-    print("matplotib is needed to run this demo. Import was not "
-          "succesful. Exiting gracefully.")
-    exit()
-
-from dolfin import *
 
-import numpy as np
-import sys
-import six
 
 parameters["ghost_mode"] = "shared_vertex"
 #parameters["ghost_mode"] = "shared_facet"
@@ -42,12 +42,12 @@ if(MPI.size(mpi_comm_world()) == 1):
 mesh = UnitSquareMesh(8, 8)
 # mesh = refine(M)
 
-shared_vertices = mesh.topology().shared_entities(0).keys()
+shared_vertices = np.fromiter(mesh.topology().shared_entities(0).keys(), dtype='uintc')
 shared_cells = mesh.topology().shared_entities(mesh.topology().dim())
 
 num_regular_vertices = mesh.topology().ghost_offset(0)
 
-ghost_vertices = range(num_regular_vertices, mesh.topology().size(0))
+ghost_vertices = np.arange(num_regular_vertices, mesh.topology().size(0))
 
 verts_note = []
 if (n == 0):
@@ -94,7 +94,7 @@ for c in cells(mesh, "all"):
 #    else:
 #        cell_str = str(c.index())
     cells_note.append((xavg, yavg, cell_str))
-    cells_store.append(zip(xc,yc))
+    cells_store.append(list(zip(xc,yc)))
 
     colors.append(cmap[cell_ownership[c.index()]])
     idx += 1
@@ -149,7 +149,18 @@ for note in facet_note:
 
 # Q = FacetFunction("double", mesh)
 
-# xdmf = File("a.xdmf")
-# xdmf << Q
+# # Save solution in XDMF format if available
+# xdmf = XDMFFile(mesh.mpi_comm(), "Q.xdmf")
+# if has_hdf5():
+#     xdmf.write(Q)
+# elif MPI.size(mesh.mpi_comm()) == 1:
+#     encoding = XDMFFile.Encoding_ASCII
+#     xdmf.write(Q, encoding)
+# else:
+#     # Save solution in vtk format
+#     xdmf = File("Q.pvd")
+#     xdmf << Q
 
 plt.savefig("mesh-rank%d.png" % rank)
+if os.environ.get("DOLFIN_NOPLOT", "0") == "0":
+    plt.show()
diff --git a/demo/undocumented/interpolation/python/demo_interpolation.py b/demo/undocumented/interpolation/python/demo_interpolation.py
index 93ff755..ff5ff0e 100644
--- a/demo/undocumented/interpolation/python/demo_interpolation.py
+++ b/demo/undocumented/interpolation/python/demo_interpolation.py
@@ -35,12 +35,9 @@ mesh = UnitSquareMesh(16, 16)
 V = FunctionSpace(mesh, "CG", 1)
 
 # Create a function on the original mesh
-f = Expression("sin(5.0*x[0])*sin(5.0*x[1])")
+f = Expression("sin(5.0*x[0])*sin(5.0*x[1])", degree=2)
 v = interpolate(f, V)
 
-# FIXME: We would like to do refined_mesh = refine(mesh) here
-# FIXME: but that breaks in parallel
-
 # Refine mesh and create a new function space
 refined_mesh = refine(mesh)
 W = FunctionSpace(refined_mesh, "CG", 1)
diff --git a/demo/undocumented/lift-drag/cpp/CMakeLists.txt b/demo/undocumented/lift-drag/cpp/CMakeLists.txt
index d41470f..c6477a6 100644
--- a/demo/undocumented/lift-drag/cpp/CMakeLists.txt
+++ b/demo/undocumented/lift-drag/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/lift-drag/cpp/Functionals.h b/demo/undocumented/lift-drag/cpp/Functionals.h
index f637e92..05a2f61 100644
--- a/demo/undocumented/lift-drag/cpp/Functionals.h
+++ b/demo/undocumented/lift-drag/cpp/Functionals.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __FUNCTIONALS_H
 #define __FUNCTIONALS_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class functionals_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   functionals_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~functionals_finite_element_0()
+  ~functionals_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,131 +902,1766 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new functionals_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class functionals_dofmap_0: public ufc::dofmap
+class functionals_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  functionals_dofmap_0() : ufc::dofmap()
+  functionals_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~functionals_dofmap_0()
+  ~functionals_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
     {
     case 0:
       {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
+        return 2;
         break;
       }
-    case 2:
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        return false;
+        return 2;
         break;
       }
     }
     
-    return false;
+    return 0;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t reference_value_size() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t degree() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  const char * family() const final override
   {
-    return num_global_entities[0];
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new functionals_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new functionals_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new functionals_finite_element_1();
+  }
+
+};
+
+
+class functionals_dofmap_0: public ufc::dofmap
+{
+public:
+
+  functionals_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~functionals_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new functionals_dofmap_0();
+  }
+
+};
+
+
+class functionals_dofmap_1: public ufc::dofmap
+{
+public:
+
+  functionals_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~functionals_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
@@ -1041,19 +2679,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1061,27 +2703,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -1102,16 +2749,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -1132,75 +2782,68 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new functionals_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new functionals_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new functionals_dofmap_0();
+    return new functionals_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class functionals_exterior_facet_integral_0_1: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   functionals_exterior_facet_integral_0_1() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~functionals_exterior_facet_integral_0_1()
+  ~functionals_exterior_facet_integral_0_1() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1215,12 +2858,12 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates[2*facet] - vertex_coordinates[2*v0]) - dx0*(vertex_coordinates[2*facet + 1] - vertex_coordinates[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs[2*facet] - coordinate_dofs[2*v0]) - dx0*(coordinate_dofs[2*facet + 1] - coordinate_dofs[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n0 = direction ? dx1 / det : -dx1 / det;
     
@@ -1355,43 +2998,36 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class functionals_exterior_facet_integral_1_1: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   functionals_exterior_facet_integral_1_1() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~functionals_exterior_facet_integral_1_1()
+  ~functionals_exterior_facet_integral_1_1() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1406,12 +3042,12 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
-    const bool direction = dx1*(vertex_coordinates[2*facet] - vertex_coordinates[2*v0]) - dx0*(vertex_coordinates[2*facet + 1] - vertex_coordinates[2*v0 + 1]) < 0;
+    const bool direction = dx1*(coordinate_dofs[2*facet] - coordinate_dofs[2*v0]) - dx0*(coordinate_dofs[2*facet + 1] - coordinate_dofs[2*v0 + 1]) < 0;
     // Compute facet normals from the facet scale factor constants
     const double n1 = direction ? -dx0 / det : dx0 / det;
     
@@ -1546,66 +3182,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class functionals_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   functionals_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~functionals_form_0()
+  ~functionals_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "7f5009f2376e4bb39e1c6462c021520b33645d3813f26f1a045d9c2b978edb384ec23a0113127d8b7c8740c0019a262e4c1425d2a836b8a3e274e2b780c0abc8";
+    return "38c56697162dfaaca2bc17e36cda6af990242807cab0eec88a4328705e5f6f21e59f94a1c6a22d1ad137b67fa6e2f41510155bc46f277054b78b875282cc8333";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new functionals_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new functionals_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1619,8 +3247,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1634,77 +3261,92 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 2;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     switch (subdomain_id)
     {
@@ -1718,117 +3360,130 @@ public:
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class functionals_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   functionals_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~functionals_form_1()
+  ~functionals_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "f0bfbf779bfbcb24e88f127bc3bcfd539410d3c6be715e9e3b00a3aa6891ac0c079d19d1df545e6bfde0df89fa4542665e11e276e7d953be97d5283ab60748a0";
+    return "9f44b8553e41fbc9be0ff0909fcdbf0207f3e0b03f01ec306671b8a93412b5ae86241666283cb199bd278212b89874a7b8db8a8c71c2527281e1a002229c42e2";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 0;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new functionals_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new functionals_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1842,8 +3497,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1857,77 +3511,92 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 2;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     switch (subdomain_id)
     {
@@ -1941,51 +3610,72 @@ public:
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1999,14 +3689,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Functionals
 {
@@ -2015,43 +3711,20 @@ class CoefficientSpace_p: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new functionals_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new functionals_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_p(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new functionals_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new functionals_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_p(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new functionals_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new functionals_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<functionals_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<functionals_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_p(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new functionals_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new functionals_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<functionals_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<functionals_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2065,63 +3738,85 @@ class Form_drag: public dolfin::Form
 public:
 
   // Constructor
-  Form_drag(const dolfin::Mesh& mesh):
+  Form_drag(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::Form(0, 1), p(*this, 0)
   {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_0());
+    _mesh = mesh;
+    _ufc_form = std::make_shared<const functionals_form_0>();
   }
 
   // Constructor
-  Form_drag(const dolfin::Mesh& mesh, const dolfin::GenericFunction& p):
+  Form_drag(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> p):
     dolfin::Form(0, 1), p(*this, 0)
   {
-    _mesh = reference_to_no_delete_pointer(mesh);
+    _mesh = mesh;
     this->p = p;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_0());
+    _ufc_form = std::make_shared<const functionals_form_0>();
   }
 
-  // Constructor
-  Form_drag(const dolfin::Mesh& mesh, std::shared_ptr<const dolfin::GenericFunction> p):
-    dolfin::Form(0, 1), p(*this, 0)
+  // Destructor
+  ~Form_drag()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->p = *p;
+    if (name == "p")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_0());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_drag(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::Form(0, 1), p(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _mesh = mesh;
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_0());
+    switch (i)
+    {
+    case 0:
+      return "p";
+    }
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_drag_FunctionSpace_0 CoefficientSpace_p;
+
+  // Coefficients
+  dolfin::CoefficientAssigner p;
+};
+
+class MultiMeshForm_drag: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_drag(std::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& p):
-    dolfin::Form(0, 1), p(*this, 0)
+  MultiMeshForm_drag(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::MultiMeshForm(), p(*this, 0)
   {
-    _mesh = mesh;
-    this->p = p;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_0());
+    /// Assign coefficients
+
   }
 
   // Constructor
-  Form_drag(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> p):
-    dolfin::Form(0, 1), p(*this, 0)
+  MultiMeshForm_drag(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> p):
+    dolfin::MultiMeshForm(), p(*this, 0)
   {
-    _mesh = mesh;
-    this->p = *p;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_0());
+    /// Assign coefficients    this->p = p;
+
   }
 
   // Destructor
-  ~Form_drag()
+  ~MultiMeshForm_drag()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2155,7 +3850,7 @@ public:
   typedef Form_drag_FunctionSpace_0 CoefficientSpace_p;
 
   // Coefficients
-  dolfin::CoefficientAssigner p;
+  dolfin::MultiMeshCoefficientAssigner p;
 };
 
 typedef CoefficientSpace_p Form_lift_FunctionSpace_0;
@@ -2165,63 +3860,85 @@ class Form_lift: public dolfin::Form
 public:
 
   // Constructor
-  Form_lift(const dolfin::Mesh& mesh):
+  Form_lift(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::Form(0, 1), p(*this, 0)
   {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_1());
+    _mesh = mesh;
+    _ufc_form = std::make_shared<const functionals_form_1>();
   }
 
   // Constructor
-  Form_lift(const dolfin::Mesh& mesh, const dolfin::GenericFunction& p):
+  Form_lift(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> p):
     dolfin::Form(0, 1), p(*this, 0)
   {
-    _mesh = reference_to_no_delete_pointer(mesh);
+    _mesh = mesh;
     this->p = p;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_1());
+    _ufc_form = std::make_shared<const functionals_form_1>();
   }
 
-  // Constructor
-  Form_lift(const dolfin::Mesh& mesh, std::shared_ptr<const dolfin::GenericFunction> p):
-    dolfin::Form(0, 1), p(*this, 0)
+  // Destructor
+  ~Form_lift()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->p = *p;
+    if (name == "p")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_lift(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::Form(0, 1), p(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _mesh = mesh;
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_1());
+    switch (i)
+    {
+    case 0:
+      return "p";
+    }
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_lift_FunctionSpace_0 CoefficientSpace_p;
+
+  // Coefficients
+  dolfin::CoefficientAssigner p;
+};
+
+class MultiMeshForm_lift: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_lift(std::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& p):
-    dolfin::Form(0, 1), p(*this, 0)
+  MultiMeshForm_lift(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::MultiMeshForm(), p(*this, 0)
   {
-    _mesh = mesh;
-    this->p = p;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_1());
+    /// Assign coefficients
+
   }
 
   // Constructor
-  Form_lift(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> p):
-    dolfin::Form(0, 1), p(*this, 0)
+  MultiMeshForm_lift(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> p):
+    dolfin::MultiMeshForm(), p(*this, 0)
   {
-    _mesh = mesh;
-    this->p = *p;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new functionals_form_1());
+    /// Assign coefficients    this->p = p;
+
   }
 
   // Destructor
-  ~Form_lift()
+  ~MultiMeshForm_lift()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2255,7 +3972,7 @@ public:
   typedef Form_lift_FunctionSpace_0 CoefficientSpace_p;
 
   // Coefficients
-  dolfin::CoefficientAssigner p;
+  dolfin::MultiMeshCoefficientAssigner p;
 };
 
 
diff --git a/demo/undocumented/lift-drag/cpp/Functionals.ufl b/demo/undocumented/lift-drag/cpp/Functionals.ufl
index dee90a8..d0407d4 100644
--- a/demo/undocumented/lift-drag/cpp/Functionals.ufl
+++ b/demo/undocumented/lift-drag/cpp/Functionals.ufl
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2007 Anders Logg
 #
 # This file is part of DOLFIN.
diff --git a/demo/undocumented/lift-drag/cpp/compile.log b/demo/undocumented/lift-drag/cpp/compile.log
index d5bebce..cfbdf47 100644
--- a/demo/undocumented/lift-drag/cpp/compile.log
+++ b/demo/undocumented/lift-drag/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Functionals
 
@@ -12,16 +13,16 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '()'
   Number of coefficients:              1
   Coefficients:                        '[w_0]'
-  Unique elements:                     'CG1(?)'
-  Unique sub elements:                 'CG1(?)'
+  Unique elements:                     'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 1
-  quadrature_degree: auto --> 1
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 1
+  quadrature_degree: 1
   
   Geometric dimension:                 2
   Number of exterior_facet subdomains: 2
@@ -29,24 +30,32 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '()'
   Number of coefficients:              1
   Coefficients:                        '[w_0]'
-  Unique elements:                     'CG1(?)'
-  Unique sub elements:                 'CG1(?)'
+  Unique elements:                     'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal FacetNormal.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 1
-  quadrature_degree: auto --> 1
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 1
+  quadrature_degree: 1
   
-Compiler stage 1 finished in 0.0129459 seconds.
+Compiler stage 1 finished in 0.0321281 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
@@ -56,13 +65,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 0): array([[  4.16333634e-17],
-         [  5.00000000e-01],
-         [  5.00000000e-01]])}, 1: {(0, 0): array([[  5.00000000e-01],
-         [  4.16333634e-17],
-         [  5.00000000e-01]])}, 2: {(0, 0): array([[ 0.5],
-         [ 0.5],
-         [ 0. ]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00],
+  {1: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00],
           [  0.00000000e+00]],
   
          [[  8.88178420e-16],
@@ -206,7 +209,13 @@ Compiler stage 2: Computing intermediate representation
           [ 0.5]],
   
          [[ 0. ],
-          [ 0. ]]])}}}}}
+          [ 0. ]]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {0: {(0, 0): array([[  4.16333634e-17],
+         [  5.00000000e-01],
+         [  5.00000000e-01]])}, 1: {(0, 0): array([[  5.00000000e-01],
+         [  4.16333634e-17],
+         [  5.00000000e-01]])}, 2: {(0, 0): array([[ 0.5],
+         [ 0.5],
+         [ 0. ]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE1_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
@@ -253,15 +262,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {1: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {0: {(0, 0): array([[  4.16333634e-17],
-         [  5.00000000e-01],
-         [  5.00000000e-01]])}, 1: {(0, 0): array([[  5.00000000e-01],
-         [  4.16333634e-17],
-         [  5.00000000e-01]])}, 2: {(0, 0): array([[ 0.5],
-         [ 0.5],
-         [ 0. ]])}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00],
+  {1: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00],
           [  0.00000000e+00]],
   
          [[  8.88178420e-16],
@@ -405,7 +409,13 @@ Compiler stage 2: Computing intermediate representation
           [ 0.5]],
   
          [[ 0. ],
-          [ 0. ]]])}}}}}
+          [ 0. ]]])}}}, FiniteElement('Lagrange', triangle, 1): {None: {0: {(0, 0): array([[  4.16333634e-17],
+         [  5.00000000e-01],
+         [  5.00000000e-01]])}, 1: {(0, 0): array([[  5.00000000e-01],
+         [  4.16333634e-17],
+         [  5.00000000e-01]])}, 2: {(0, 0): array([[ 0.5],
+         [ 0.5],
+         [ 0. ]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE1_f2_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_f2_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
@@ -450,7 +460,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0732968 seconds.
+Compiler stage 2 finished in 0.127938 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
@@ -461,60 +471,49 @@ Compiler stage 3: Optimizing intermediate representation
   Optimising expressions for facet integral 1
   Optimising expressions for facet integral 2
   
-Compiler stage 3 finished in 0.000839949 seconds.
+Compiler stage 3 finished in 0.00124502 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -532,18 +531,18 @@ Compiler stage 4: Generating code
   Removing unused variable: n0
   Generating code for forms
   
-Compiler stage 4 finished in 0.0429831 seconds.
+Compiler stage 4 finished in 0.125604 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000525951 seconds.
+Compiler stage 4.1 finished in 0.000950813 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Functionals.h.
-Compiler stage 5 finished in 0.000610828 seconds.
+Compiler stage 5 finished in 0.000720978 seconds.
 
-FFC finished in 0.131514 seconds.
+FFC finished in 0.289169 seconds.
+Output written to ./Functionals.h.
diff --git a/demo/undocumented/lift-drag/cpp/main.cpp b/demo/undocumented/lift-drag/cpp/main.cpp
index dc7fb97..d271037 100644
--- a/demo/undocumented/lift-drag/cpp/main.cpp
+++ b/demo/undocumented/lift-drag/cpp/main.cpp
@@ -50,16 +50,16 @@ class Fish : public SubDomain
 int main()
 {
   // Read mesh from file
-  Mesh mesh("../dolfin_fine.xml.gz");
+  auto mesh = std::make_shared<Mesh>("../dolfin_fine.xml.gz");
 
   // Read velocity field from file
-  Functionals::CoefficientSpace_p Vp(mesh);
-  Function p(Vp, "../dolfin_fine_pressure.xml.gz");
+  auto Vp = std::make_shared<Functionals::CoefficientSpace_p>(mesh);
+  auto p = std::make_shared<Function>(Vp, "../dolfin_fine_pressure.xml.gz");
 
   // Mark 'fish'
-  FacetFunction<std::size_t> markers(mesh, 1);
+  auto markers = std::make_shared<FacetFunction<std::size_t>>(mesh, 1);
   Fish fish;
-  fish.mark(markers, 1);
+  fish.mark(*markers, 1);
 
   // Functionals for lift and drag
   Functionals::Form_lift L(mesh, p);
diff --git a/demo/undocumented/lift-drag/python/demo_lift-drag.py b/demo/undocumented/lift-drag/python/demo_lift-drag.py
index d0c9cc3..f27b151 100644
--- a/demo/undocumented/lift-drag/python/demo_lift-drag.py
+++ b/demo/undocumented/lift-drag/python/demo_lift-drag.py
@@ -52,7 +52,7 @@ markers = FacetFunctionSizet(mesh, 1)
 Fish().mark(markers, 1);
 
 # Define functionals for drag and lift
-ds = ds[markers]
+ds = ds(subdomain_data=markers)
 n = FacetNormal(mesh)
 D = -p*n[0]*ds(1)
 L = p*n[1]*ds(1)
diff --git a/demo/undocumented/mesh-quality/cpp/CMakeLists.txt b/demo/undocumented/mesh-quality/cpp/CMakeLists.txt
index bfd0fda..b311e0e 100644
--- a/demo/undocumented/mesh-quality/cpp/CMakeLists.txt
+++ b/demo/undocumented/mesh-quality/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/mesh-quality/python/.gitignore b/demo/undocumented/mesh-quality/python/.gitignore
new file mode 100644
index 0000000..a136337
--- /dev/null
+++ b/demo/undocumented/mesh-quality/python/.gitignore
@@ -0,0 +1 @@
+*.pdf
diff --git a/demo/undocumented/mesh-quality/python/demo_mesh-quality.py b/demo/undocumented/mesh-quality/python/demo_mesh-quality.py
index e5bb590..0f625e2 100644
--- a/demo/undocumented/mesh-quality/python/demo_mesh-quality.py
+++ b/demo/undocumented/mesh-quality/python/demo_mesh-quality.py
@@ -33,8 +33,8 @@ print('Maximal radius ratio:', qmax)
 
 # Show histogram using matplotlib
 hist = MeshQuality.radius_ratio_matplotlib_histogram(mesh)
-hist = hist.replace('import pylab', 'import matplotlib\n    matplotlib.use(\'Agg\')\n    import pylab')
-hist = hist.replace('pylab.show()', 'pylab.savefig("mesh-quality.pdf")')
+hist = hist.replace('    import matplotlib.pylab', '    import matplotlib\n    matplotlib.use(\'Agg\')\n    import matplotlib.pylab\n')
+hist = hist.replace('matplotlib.pylab.show()', 'matplotlib.pylab.savefig("mesh-quality.pdf")')
 print(hist)
 exec(hist)
 
diff --git a/demo/undocumented/meshfunction-refinement/cpp/CMakeLists.txt b/demo/undocumented/meshfunction-refinement/cpp/CMakeLists.txt
index 6ebca60..5d8dd03 100644
--- a/demo/undocumented/meshfunction-refinement/cpp/CMakeLists.txt
+++ b/demo/undocumented/meshfunction-refinement/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/meshfunction-refinement/cpp/main.cpp b/demo/undocumented/meshfunction-refinement/cpp/main.cpp
index ea53472..d05052c 100644
--- a/demo/undocumented/meshfunction-refinement/cpp/main.cpp
+++ b/demo/undocumented/meshfunction-refinement/cpp/main.cpp
@@ -42,37 +42,37 @@ int main()
   };
 
 
-  UnitSquareMesh mesh(5, 5);
+  auto mesh = std::make_shared<UnitSquareMesh>(5, 5);
 
   parameters["refinement_algorithm"] = "plaza_with_parent_facets";
 
   // Create MeshFunction over cells
-  MeshFunction<std::size_t> right_cells(mesh, mesh.topology().dim(), 0);
+  MeshFunction<std::size_t> right_cells(mesh, mesh->topology().dim(), 0);
   Right right;
   right.mark(right_cells, 1);
 
   // Create MeshFunction over facets
-  MeshFunction<std::size_t> inflow_facets(mesh, mesh.topology().dim() - 1, 0);
+  MeshFunction<std::size_t> inflow_facets(mesh, mesh->topology().dim() - 1, 0);
   Inflow inflow;
   inflow.mark(inflow_facets, 1);
 
   // Mark cells for refinement
-  MeshFunction<bool> cell_markers(mesh, mesh.topology().dim(), false);
+  MeshFunction<bool> cell_markers(mesh, mesh->topology().dim(), false);
   Point p(1.0, 0.0);
-  for (CellIterator c(mesh); !c.end(); ++c)
+  for (CellIterator c(*mesh); !c.end(); ++c)
   {
     if (c->midpoint().distance(p) < 0.5)
       cell_markers[*c] = true;
   }
 
   // Refine mesh
-  adapt(mesh, cell_markers);
+  adapt(*mesh, cell_markers);
 
   // Adapt cell function to refined mesh
-  adapt(right_cells, mesh.child_shared_ptr());
+  adapt(right_cells, mesh->child_shared_ptr());
 
   // Adapt facet function to refined mesh
-  adapt(inflow_facets, mesh.child_shared_ptr());
+  adapt(inflow_facets, mesh->child_shared_ptr());
 
   return 0;
 }
diff --git a/demo/undocumented/mixed-poisson-sphere/python/demo_mixed-poisson-sphere.py b/demo/undocumented/mixed-poisson-sphere/python/demo_mixed-poisson-sphere.py
index 32833c2..ef8b7ab 100644
--- a/demo/undocumented/mixed-poisson-sphere/python/demo_mixed-poisson-sphere.py
+++ b/demo/undocumented/mixed-poisson-sphere/python/demo_mixed-poisson-sphere.py
@@ -32,34 +32,35 @@ import numpy
 mesh = Mesh("../sphere_16.xml.gz")
 
 # Define global normal
-global_normal = Expression(("x[0]", "x[1]", "x[2]"))
+global_normal = Expression(("x[0]", "x[1]", "x[2]"), degree=1)
 mesh.init_cell_orientations(global_normal)
 
 # Define function spaces and basis functions
-V = FunctionSpace(mesh, "RT", 1)
-Q = FunctionSpace(mesh, "DG", 0)
-R = FunctionSpace(mesh, "R", 0)
-W = MixedFunctionSpace((V, Q, R))
+RT1 = FiniteElement("RT", mesh.ufl_cell(), 1)
+DG0 = FiniteElement("DG", mesh.ufl_cell(), 0)
+R = FiniteElement("R", mesh.ufl_cell(), 0)
+W = FunctionSpace(mesh, MixedElement((RT1, DG0, R)))
 
 (sigma, u, r) = TrialFunctions(W)
 (tau, v, t) = TestFunctions(W)
 
-g = Expression("sin(0.5*pi*x[2])")
+g = Expression("sin(0.5*pi*x[2])", degree=2)
 
 # Define forms
 a = (inner(sigma, tau) + div(sigma)*v + div(tau)*u + r*v + t*u)*dx
 L = g*v*dx
 
-# Set PETSc MUMPS parameters (this is required to prevent a memory
-# error when using MUMPS LU solver, which is probably due to the Real
-# space).
+# Tune some factorization options
 if has_petsc():
+    # Avoid factors memory exhaustion due to excessive pivoting
     PETScOptions.set("mat_mumps_icntl_14", 40.0)
     PETScOptions.set("mat_mumps_icntl_7", "0")
+    # Avoid zero pivots on 64-bit SuperLU_dist
+    PETScOptions.set("mat_superlu_dist_colperm", "MMD_ATA")
 
 # Solve problem
 w = Function(W)
-solve(a == L, w)
+solve(a == L, w, solver_parameters={"symmetric": True})
 (sigma, u, r) = w.split()
 
 # Plot CG1 representation of solutions
diff --git a/demo/undocumented/mplot/cpp/README b/demo/undocumented/mplot/cpp/README
new file mode 100644
index 0000000..261d76d
--- /dev/null
+++ b/demo/undocumented/mplot/cpp/README
@@ -0,0 +1,2 @@
+There is no C++ version of this demo because matplotlib
+is Python only library.
diff --git a/demo/undocumented/mplot/python/.gitignore b/demo/undocumented/mplot/python/.gitignore
new file mode 100644
index 0000000..6633554
--- /dev/null
+++ b/demo/undocumented/mplot/python/.gitignore
@@ -0,0 +1,2 @@
+*.png
+*.pdf
diff --git a/demo/undocumented/mplot/python/demo_mplot.py b/demo/undocumented/mplot/python/demo_mplot.py
new file mode 100644
index 0000000..3047767
--- /dev/null
+++ b/demo/undocumented/mplot/python/demo_mplot.py
@@ -0,0 +1,132 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2016 Jan Blechta, Martin Alnæs
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+from __future__ import print_function
+from dolfin import *
+import ufl
+from six.moves import xrange as range
+import os
+
+try:
+    parameters['plotting_backend'] = 'matplotlib'
+except RuntimeError:
+    print("This demo requires matplotlib! Bye.")
+    exit()
+else:
+    import matplotlib.pyplot as plt
+    from mpl_toolkits.mplot3d import axes3d
+
+
+rank = MPI.rank(mpi_comm_world())
+size = MPI.size(mpi_comm_world())
+suffix = "_r%s" % rank if size > 1 else ""
+
+
+def plot_alongside(*args, **kwargs):
+    """Plot supplied functions in single figure with common colorbar.
+    It is users responsibility to supply 'range_min' and 'range_max' in kwargs.
+    """
+    n = len(args)
+    plt.figure(figsize=(4*n+2, 4))
+    projection = "3d" if kwargs.get("mode") == "warp" else None
+
+    for i in range(n):
+        plt.subplot(1, n, i+1, projection=projection)
+        p = plot(args[i], **kwargs)
+
+    plt.tight_layout()
+
+    # Create colorbar
+    plt.subplots_adjust(right=0.8)
+    cbar_ax = plt.gcf().add_axes([0.85, 0.15, 0.05, 0.7])
+    plt.colorbar(p, cax=cbar_ax)
+
+
+def create_interval_mesh(vertices):
+    "Given list of vertex coordinate tuples, build and return a mesh of intervals."
+    gdim = len(vertices[0])
+    mesh = Mesh()
+    me = MeshEditor()
+    me.open(mesh, "interval", 1, gdim)
+
+    # Add vertices to mesh
+    nv = len(vertices)
+    me.init_vertices(nv)
+    for i, v in enumerate(vertices):
+        me.add_vertex(i, *v)
+
+    # Add cells to mesh
+    me.init_cells(nv-1)
+    for i in range(nv-1):
+        c = (i, i+1)
+        me.add_cell(i, *c)
+
+    me.close()
+    assert mesh.ordered()
+    return mesh
+
+
+def interval_mesh(gdim, n):
+    us = [i/float(n-1) for i in range(n)]
+    vertices = [(cos(4.0*DOLFIN_PI*u), sin(4.0*DOLFIN_PI*u), 2.0*u)[-gdim:] for u in us]
+    return create_interval_mesh(vertices)
+
+
+def plot_1d_meshes():
+    # FIXME: This passes fine in parallel although it's not obvious what does it do
+    plt.figure()
+    plot(interval_mesh(1, 30))
+    plt.savefig("mesh_1d%s.png" % suffix)
+
+    plt.figure()
+    plot(interval_mesh(2, 100))
+    plt.savefig("mesh_2d%s.png" % suffix)
+
+    plt.figure()
+    plot(interval_mesh(3, 100))
+    plt.savefig("mesh_3d%s.png" % suffix)
+
+
+def plot_functions():
+    mesh = UnitSquareMesh(8, 8, 'crossed')
+    P1 = FunctionSpace(mesh, "Lagrange", 1)
+    u = interpolate(Expression("x[0]*x[0] + x[1]*x[1]*(x[1]-0.5)", degree=3), P1)
+    v = interpolate(Expression("1.0+x[0]*x[0]", degree=2), P1)
+
+    # Get common range
+    r = {"range_min": min(u.vector().min(), v.vector().min()),
+         "range_max": max(u.vector().max(), v.vector().max())}
+
+    plot_alongside(u, v, **r)
+    plot_alongside(u, v, mode='color', **r)
+    plt.savefig("color_plot%s.pdf" % suffix)
+    plot_alongside(u, v, mode='warp', **r)
+    plt.savefig("warp_plot%s.pdf" % suffix)
+    plot_alongside(u, v, v, mode='warp', **r)
+
+
+def main(argv=None):
+    plot_1d_meshes()
+    plot_functions()
+    if os.environ.get("DOLFIN_NOPLOT", "0") == "0":
+        plt.show()
+
+
+if __name__ == '__main__':
+    import sys
+    main(sys.argv)
diff --git a/demo/undocumented/multimesh-poisson/cpp/CMakeLists.txt b/demo/undocumented/multimesh-poisson/cpp/CMakeLists.txt
index 93ae81b..c77e6f3 100644
--- a/demo/undocumented/multimesh-poisson/cpp/CMakeLists.txt
+++ b/demo/undocumented/multimesh-poisson/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/multimesh-poisson/cpp/MultiMeshPoisson.h b/demo/undocumented/multimesh-poisson/cpp/MultiMeshPoisson.h
index 449eddc..130f437 100644
--- a/demo/undocumented/multimesh-poisson/cpp/MultiMeshPoisson.h
+++ b/demo/undocumented/multimesh-poisson/cpp/MultiMeshPoisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __MULTIMESHPOISSON_H
 #define __MULTIMESHPOISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class multimeshpoisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   multimeshpoisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshpoisson_finite_element_0()
+  ~multimeshpoisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +902,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new multimeshpoisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class multimeshpoisson_dofmap_0: public ufc::dofmap
+class multimeshpoisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  multimeshpoisson_dofmap_0() : ufc::dofmap()
+  multimeshpoisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshpoisson_dofmap_0()
+  ~multimeshpoisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -1041,283 +989,1963 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    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;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new multimeshpoisson_dofmap_0();
-  }
-
-};
-
-/// 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 multimeshpoisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  multimeshpoisson_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshpoisson_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
-    
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-  }
-
-};
-
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
-
-class multimeshpoisson_custom_integral_0_0: public ufc::custom_integral
-{
-public:
-
-  /// Constructor
-  multimeshpoisson_custom_integral_0_0() : ufc::custom_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshpoisson_custom_integral_0_0()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  std::size_t degree() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return 1;
   }
 
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
+  const char * family() const final override
   {
-    return 1;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    
-    // --- Compute geometric quantities on cell 0 ---
-    
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Compute cell volume
-    
-    // Compute circumradius of triangle in 2D
-    
-    
-    // Set quadrature weights
-    const double* W = quadrature_weights;
-    
-    // --- Evaluation of basis function derivatives of order 1 ---
     
-    // Create table FE0_D10 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_D10(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_D10[ip].resize(3);
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Create table FE0_D01 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_D01(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_D01[ip].resize(3);
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
-    // Evaluate basis function derivatives on cell 0
-    static double FE0_dvalues_1_0[6];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
     {
-      // Get current quadrature point and compute values of basis function derivatives
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new multimeshpoisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new multimeshpoisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new multimeshpoisson_finite_element_1();
+  }
+
+};
+
+
+class multimeshpoisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  multimeshpoisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~multimeshpoisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new multimeshpoisson_dofmap_0();
+  }
+
+};
+
+
+class multimeshpoisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  multimeshpoisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~multimeshpoisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new multimeshpoisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new multimeshpoisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new multimeshpoisson_dofmap_1();
+  }
+
+};
+
+
+class multimeshpoisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  multimeshpoisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~multimeshpoisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+  }
+
+};
+
+
+class multimeshpoisson_cutcell_integral_0_otherwise: public ufc::cutcell_integral
+{
+public:
+
+  multimeshpoisson_cutcell_integral_0_otherwise() : ufc::cutcell_integral()
+  {
+    
+  }
+
+  ~multimeshpoisson_cutcell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t num_quadrature_points,
+                       const double * quadrature_points,
+                       const double * quadrature_weights,
+                       int cell_orientation) const final override
+  {
+    
+    // --- Compute geometric quantities on cell 0 ---
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Compute cell volume
+    
+    // Compute circumradius of triangle in 2D
+    
+    
+    // Set quadrature weights
+    const double* W = quadrature_weights;
+    
+    // --- Evaluation of basis function derivatives of order 1 ---
+    
+    // Create table FE0_D10 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_D10(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_D10[ip].resize(3);
+    
+    // Create table FE0_D01 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_D01(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_D01[ip].resize(3);
+    
+    // Evaluate basis function derivatives on cell 0
+    static double FE0_dvalues_1_0[6];
+    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
+    {
+      // Get current quadrature point and compute values of basis function derivatives
+      const double* x = quadrature_points + ip*2;
+      const double* v = coordinate_dofs + 0;
+      multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
       
       // Copy values to table FE0_D10
       for (std::size_t i = 0; i < 3; i++)
@@ -1357,59 +2985,45 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
 
-class multimeshpoisson_custom_integral_0_1: public ufc::custom_integral
+class multimeshpoisson_interface_integral_0_otherwise: public ufc::interface_integral
 {
 public:
 
-  /// Constructor
-  multimeshpoisson_custom_integral_0_1() : ufc::custom_integral()
+  multimeshpoisson_interface_integral_0_otherwise() : ufc::interface_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshpoisson_custom_integral_0_1()
+  ~multimeshpoisson_interface_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 2;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t num_quadrature_points,
+                       const double * quadrature_points,
+                       const double * quadrature_weights,
+                       const double * facet_normals,
+                       int cell_orientation) const final override
   {
     
     // --- Compute geometric quantities on cell 0 ---
     
     // Extract vertex coordinates
-    const double* vertex_coordinates_0 = vertex_coordinates + 0;
+    const double* coordinate_dofs_0 = coordinate_dofs + 0;
     
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -1420,7 +3034,7 @@ public:
     const double volume_0 = std::abs(detJ_0)/2.0;
     
     // Compute circumradius of triangle in 2D
-    const double v1v2_0  = std::sqrt((vertex_coordinates_0[4] - vertex_coordinates_0[2])*(vertex_coordinates_0[4] - vertex_coordinates_0[2]) + (vertex_coordinates_0[5] - vertex_coordinates_0[3])*(vertex_coordinates_0[5] - vertex_coordinates_0[3]) );
+    const double v1v2_0  = std::sqrt((coordinate_dofs_0[4] - coordinate_dofs_0[2])*(coordinate_dofs_0[4] - coordinate_dofs_0[2]) + (coordinate_dofs_0[5] - coordinate_dofs_0[3])*(coordinate_dofs_0[5] - coordinate_dofs_0[3]) );
     const double v0v2_0  = std::sqrt(J_0[3]*J_0[3] + J_0[1]*J_0[1]);
     const double v0v1_0  = std::sqrt(J_0[0]*J_0[0] + J_0[2]*J_0[2]);
     const double circumradius_0 = 0.25*(v1v2_0*v0v2_0*v0v1_0)/(volume_0);
@@ -1429,11 +3043,11 @@ public:
     // --- Compute geometric quantities on cell 1 ---
     
     // Extract vertex coordinates
-    const double* vertex_coordinates_1 = vertex_coordinates + 6;
+    const double* coordinate_dofs_1 = coordinate_dofs + 6;
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -1444,7 +3058,7 @@ public:
     const double volume_1 = std::abs(detJ_1)/2.0;
     
     // Compute circumradius of triangle in 2D
-    const double v1v2_1  = std::sqrt((vertex_coordinates_1[4] - vertex_coordinates_1[2])*(vertex_coordinates_1[4] - vertex_coordinates_1[2]) + (vertex_coordinates_1[5] - vertex_coordinates_1[3])*(vertex_coordinates_1[5] - vertex_coordinates_1[3]) );
+    const double v1v2_1  = std::sqrt((coordinate_dofs_1[4] - coordinate_dofs_1[2])*(coordinate_dofs_1[4] - coordinate_dofs_1[2]) + (coordinate_dofs_1[5] - coordinate_dofs_1[3])*(coordinate_dofs_1[5] - coordinate_dofs_1[3]) );
     const double v0v2_1  = std::sqrt(J_1[3]*J_1[3] + J_1[1]*J_1[1]);
     const double v0v1_1  = std::sqrt(J_1[0]*J_1[0] + J_1[2]*J_1[2]);
     const double circumradius_1 = 0.25*(v1v2_1*v0v2_1*v0v1_1)/(volume_1);
@@ -1466,7 +3080,7 @@ public:
     {
       // Get current quadrature point and compute values of basis functions
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
+      const double* v = coordinate_dofs + 0;
       multimeshpoisson_finite_element_0::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
       
       // Copy values to table FE0
@@ -1480,7 +3094,7 @@ public:
     {
       // Get current quadrature point and compute values of basis functions
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
+      const double* v = coordinate_dofs + 6;
       multimeshpoisson_finite_element_0::_evaluate_basis_all(FE0_values_1, x, v, cell_orientation);
       
       // Copy values to table FE0
@@ -1506,7 +3120,7 @@ public:
     {
       // Get current quadrature point and compute values of basis function derivatives
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
+      const double* v = coordinate_dofs + 0;
       multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
       
       // Copy values to table FE0_D10
@@ -1524,7 +3138,7 @@ public:
     {
       // Get current quadrature point and compute values of basis function derivatives
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
+      const double* v = coordinate_dofs + 6;
       multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
       
       // Copy values to table FE0_D10
@@ -1577,59 +3191,44 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
 
-class multimeshpoisson_custom_integral_0_2: public ufc::custom_integral
+class multimeshpoisson_overlap_integral_0_otherwise: public ufc::overlap_integral
 {
 public:
 
-  /// Constructor
-  multimeshpoisson_custom_integral_0_2() : ufc::custom_integral()
+  multimeshpoisson_overlap_integral_0_otherwise() : ufc::overlap_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshpoisson_custom_integral_0_2()
+  ~multimeshpoisson_overlap_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 2;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t num_quadrature_points,
+                       const double * quadrature_points,
+                       const double * quadrature_weights,
+                       int cell_orientation) const final override
   {
     
     // --- Compute geometric quantities on cell 0 ---
     
     // Extract vertex coordinates
-    const double* vertex_coordinates_0 = vertex_coordinates + 0;
+    const double* coordinate_dofs_0 = coordinate_dofs + 0;
     
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -1644,11 +3243,11 @@ public:
     // --- Compute geometric quantities on cell 1 ---
     
     // Extract vertex coordinates
-    const double* vertex_coordinates_1 = vertex_coordinates + 6;
+    const double* coordinate_dofs_1 = coordinate_dofs + 6;
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -1681,7 +3280,7 @@ public:
     {
       // Get current quadrature point and compute values of basis function derivatives
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
+      const double* v = coordinate_dofs + 0;
       multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
       
       // Copy values to table FE0_D10
@@ -1699,7 +3298,7 @@ public:
     {
       // Get current quadrature point and compute values of basis function derivatives
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
+      const double* v = coordinate_dofs + 6;
       multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
       
       // Copy values to table FE0_D10
@@ -1726,19 +3325,19 @@ public:
     for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
     {
       
-      // Number of operations for primary indices: 396
+      // Number of operations for primary indices: 432
       for (unsigned int j = 0; j < 3; j++)
       {
         for (unsigned int k = 0; k < 3; k++)
         {
-          // Number of operations to compute entry: 13
-          A[(j + 3)*6 + (k + 3)] += (((((FE0_D10[ip][j + 3]) + 0))*(-1.0))*((((FE0_D10[ip][k + 3]) + 0))*(-1.0)) + (((0 + (FE0_D01[ip][j + 3])))*(-1.0))*(((0 + (FE0_D01[ip][k + 3])))*(-1.0)))*W[ip];
-          // Number of operations to compute entry: 11
-          A[(j + 3)*6 + k] += (((((FE0_D10[ip][j + 3]) + 0))*(-1.0))*((FE0_D10[ip][k] + 0)) + (((0 + (FE0_D01[ip][j + 3])))*(-1.0))*((0 + FE0_D01[ip][k])))*W[ip];
-          // Number of operations to compute entry: 11
-          A[j*6 + (k + 3)] += (((0 + FE0_D01[ip][j]))*(((0 + (FE0_D01[ip][k + 3])))*(-1.0)) + ((FE0_D10[ip][j] + 0))*((((FE0_D10[ip][k + 3]) + 0))*(-1.0)))*W[ip];
-          // Number of operations to compute entry: 9
-          A[j*6 + k] += (((0 + FE0_D01[ip][j]))*((0 + FE0_D01[ip][k])) + ((FE0_D10[ip][j] + 0))*((FE0_D10[ip][k] + 0)))*W[ip];
+          // Number of operations to compute entry: 14
+          A[(j + 3)*6 + (k + 3)] += ((((((FE0_D10[ip][j + 3]) + 0))*(-1.0))*((((FE0_D10[ip][k + 3]) + 0))*(-1.0)) + (((0 + (FE0_D01[ip][j + 3])))*(-1.0))*(((0 + (FE0_D01[ip][k + 3])))*(-1.0))))*4.0*W[ip];
+          // Number of operations to compute entry: 12
+          A[(j + 3)*6 + k] += ((((((FE0_D10[ip][j + 3]) + 0))*(-1.0))*((FE0_D10[ip][k] + 0)) + (((0 + (FE0_D01[ip][j + 3])))*(-1.0))*((0 + FE0_D01[ip][k]))))*4.0*W[ip];
+          // Number of operations to compute entry: 12
+          A[j*6 + (k + 3)] += ((((0 + FE0_D01[ip][j]))*(((0 + (FE0_D01[ip][k + 3])))*(-1.0)) + ((FE0_D10[ip][j] + 0))*((((FE0_D10[ip][k + 3]) + 0))*(-1.0))))*4.0*W[ip];
+          // Number of operations to compute entry: 10
+          A[j*6 + k] += ((((0 + FE0_D01[ip][j]))*((0 + FE0_D01[ip][k])) + ((FE0_D10[ip][j] + 0))*((FE0_D10[ip][k] + 0))))*4.0*W[ip];
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -1746,38 +3345,31 @@ public:
 
 };
 
-/// 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 multimeshpoisson_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   multimeshpoisson_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshpoisson_cell_integral_1_otherwise()
+  ~multimeshpoisson_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -1786,7 +3378,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1809,56 +3401,41 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
 
-class multimeshpoisson_custom_integral_1_0: public ufc::custom_integral
+class multimeshpoisson_cutcell_integral_1_otherwise: public ufc::cutcell_integral
 {
 public:
 
-  /// Constructor
-  multimeshpoisson_custom_integral_1_0() : ufc::custom_integral()
+  multimeshpoisson_cutcell_integral_1_otherwise() : ufc::cutcell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshpoisson_custom_integral_1_0()
+  ~multimeshpoisson_cutcell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 1;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t num_quadrature_points,
+                       const double * quadrature_points,
+                       const double * quadrature_weights,
+                       int cell_orientation) const final override
   {
     
     // --- Compute geometric quantities on cell 0 ---
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1886,7 +3463,7 @@ public:
     {
       // Get current quadrature point and compute values of basis functions
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
+      const double* v = coordinate_dofs + 0;
       multimeshpoisson_finite_element_0::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
       
       // Copy values to table FE0
@@ -1928,66 +3505,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class multimeshpoisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   multimeshpoisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshpoisson_form_0()
+  ~multimeshpoisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "077f4cca093ac600dd28f79dfb444f68e1cba075e7fa247c794710f03f3de857c9a1f80680d88dde70d14c589dff14dfba70d03276b1a0dc5c44dffce37fc18e";
+    return "e5230f2cce2577e8ae299f6ad858716c7a551cb9b1352609899bd42ddfaf5841f7a6a1e1afdc8eda868c55f272a114dd516babb4a52cadf5a1ef795843803cbd";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new multimeshpoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new multimeshpoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2006,8 +3575,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2026,211 +3594,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
-    return 3;
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return true;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_interface_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_overlap_integrals() const final override
   {
-    return false;
+    return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
-    switch (subdomain_id)
-    {
-    case 0:
-      {
-        return new multimeshpoisson_custom_integral_0_0();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshpoisson_custom_integral_0_1();
-        break;
-      }
-    case 2:
-      {
-        return new multimeshpoisson_custom_integral_0_2();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new multimeshpoisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return new multimeshpoisson_cutcell_integral_0_otherwise();
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return new multimeshpoisson_interface_integral_0_otherwise();
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
+  {
+    return new multimeshpoisson_overlap_integral_0_otherwise();
+  }
+
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class multimeshpoisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   multimeshpoisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshpoisson_form_1()
+  ~multimeshpoisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "be0796c936a501bd387d56a4b29b5e28871e73c5c891779832611080c2fd1f81df0d5f25e4e4a26a807def704dd00d77ec74e8984f6891345d1dbcdb8ad6f100";
+    return "2789e34dafc7d1968368327a7763bf0a71f55d0fe61acbe8e654613eea64482cd9ae5938c8d6db91c7361009e9faeaf34e34f6653b456de900e336dc52f95e62";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new multimeshpoisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new multimeshpoisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2249,8 +3826,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -2269,135 +3845,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
-    return 1;
+    return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return true;
   }
 
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
-    switch (subdomain_id)
-    {
-    case 0:
-      {
-        return new multimeshpoisson_custom_integral_1_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new multimeshpoisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return new multimeshpoisson_cutcell_integral_1_otherwise();
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -2411,14 +4014,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace MultiMeshPoisson
 {
@@ -2427,43 +4036,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2474,43 +4060,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2521,63 +4084,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshpoisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -2585,7 +4155,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshpoisson_form_0());
+    _ufc_form = std::make_shared<const multimeshpoisson_form_0>();
   }
 
   // Destructor
@@ -2615,57 +4185,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshpoisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshpoisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -2673,69 +4298,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshpoisson_form_1());
+    _ufc_form = std::make_shared<const multimeshpoisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshpoisson_form_1());
+    _ufc_form = std::make_shared<const multimeshpoisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshpoisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshpoisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshpoisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshpoisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2767,18 +4433,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/multimesh-poisson/cpp/MultiMeshPoisson.ufl b/demo/undocumented/multimesh-poisson/cpp/MultiMeshPoisson.ufl
index ddd7e82..b7a06fe 100644
--- a/demo/undocumented/multimesh-poisson/cpp/MultiMeshPoisson.ufl
+++ b/demo/undocumented/multimesh-poisson/cpp/MultiMeshPoisson.ufl
@@ -1,4 +1,4 @@
-# Copyright (C) 2014 Anders Logg
+# Copyright (C) 2014-2015 Anders Logg
 #
 # This file is part of DOLFIN.
 #
@@ -16,7 +16,7 @@
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
 # First added:  2013-06-26
-# Last changed: 2014-06-15
+# Last changed: 2015-10-16
 #
 # The bilinear form a(u, v) and linear form L(v) for a multimesh
 # formulation of Poisson's equation.
@@ -36,26 +36,16 @@ n = FacetNormal(triangle)
 h = 2.0*Circumradius(triangle)
 h = (h('+') + h('-')) / 2
 
-# Define custom measures (FIXME: prettify this)
-dc0 = dc(0, metadata={"num_cells": 1})
-dc1 = dc(1, metadata={"num_cells": 2})
-dc2 = dc(2, metadata={"num_cells": 2})
-
-# Define measures for integration
-dx = dx + dc0 # domain integral
-di = dc1      # interface integral
-do = dc2      # overlap integral
-
 # Parameters
 alpha = 4.0
 beta = 4.0
 
-# Bilinear form
-a = dot(grad(u), grad(v))*dx \
-  - dot(avg(grad(u)), jump(v, n))*di \
-  - dot(avg(grad(v)), jump(u, n))*di \
-  + alpha/h*jump(u)*jump(v)*di \
-  + dot(jump(grad(u)), jump(grad(v)))*do
+# Define bilinear form
+a = dot(grad(u), grad(v))*dX \
+  - dot(avg(grad(u)), jump(v, n))*dI \
+  - dot(avg(grad(v)), jump(u, n))*dI \
+  + alpha/h*jump(u)*jump(v)*dI \
+  + beta*dot(jump(grad(u)), jump(grad(v)))*dO
 
-# Linear form
-L = f*v*dx
+# Define linear form
+L = f*v*dX
diff --git a/demo/undocumented/multimesh-poisson/cpp/compile.log b/demo/undocumented/multimesh-poisson/cpp/compile.log
index cdc3add..a28ef6f 100644
--- a/demo/undocumented/multimesh-poisson/cpp/compile.log
+++ b/demo/undocumented/multimesh-poisson/cpp/compile.log
@@ -1,54 +1,57 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form MultiMeshPoisson
 
 Compiler stage 1: Analyzing form(s)
 -----------------------------------
   
-  Geometric dimension:         2
-  Number of cell subdomains:   0
-  Number of custom subdomains: 3
-  Rank:                        2
-  Arguments:                   '(v_0, v_1)'
-  Number of coefficients:      0
-  Coefficients:                '[]'
-  Unique elements:             'CG1(?)'
-  Unique sub elements:         'CG1(?)'
+  Geometric dimension:            2
+  Number of cell subdomains:      0
+  Number of cutcell subdomains:   0
+  Number of interface subdomains: 0
+  Number of overlap subdomains:   0
+  Rank:                           2
+  Arguments:                      '(v_0, v_1)'
+  Number of coefficients:         0
+  Coefficients:                   '[]'
+  Unique elements:                'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:            'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-  Geometric dimension:         2
-  Number of cell subdomains:   0
-  Number of custom subdomains: 1
-  Rank:                        1
-  Arguments:                   '(v_0)'
-  Number of coefficients:      1
-  Coefficients:                '[w_0]'
-  Unique elements:             'CG1(?)'
-  Unique sub elements:         'CG1(?)'
+  Geometric dimension:          2
+  Number of cell subdomains:    0
+  Number of cutcell subdomains: 0
+  Rank:                         1
+  Arguments:                    '(v_0)'
+  Number of coefficients:       1
+  Coefficients:                 '[w_0]'
+  Unique elements:              'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:          'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -56,21 +59,31 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
+  quadrature_rule:   auto --> default
   quadrature_degree: auto --> 2
+  quadrature_degree: 2
+  Estimated cost of tensor representation: -1
+  representation:    auto --> quadrature
   quadrature_rule:   auto --> default
-  representation:    quadrature
-  quadrature_degree: 0
-  quadrature_rule:   default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0592711 seconds.
+Compiler stage 1 finished in 0.0800791 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -80,7 +93,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000594 seconds
+  36 entries computed in 0.000565 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -88,16 +101,17 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
+  Reusing element from cache
   Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {None: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): [[]], (1, 0): [[]], (0, 0): [[]]}}}}}
+  {None: {FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 1): [[]], (1, 0): [[]], (0, 0): [[]]}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_D01': array([], shape=(0, 1), dtype=float64), 'FE0': array([], shape=(0, 1), dtype=float64)}
@@ -125,14 +139,14 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
+  Reusing element from cache
   Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {None: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): [[]], (1, 0): [[]], (0, 0): [[]]}}}}}
+  {None: {FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 1): [[]], (1, 0): [[]], (0, 0): [[]]}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_D01': array([], shape=(0, 1), dtype=float64), 'FE0': array([], shape=(0, 1), dtype=float64)}
@@ -176,14 +190,14 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
+  Reusing element from cache
   Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {None: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 1): [[]], (1, 0): [[]], (0, 0): [[]]}}}}}
+  {None: {FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 1): [[]], (1, 0): [[]], (0, 0): [[]]}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_D01': array([], shape=(0, 1), dtype=float64), 'FE0': array([], shape=(0, 1), dtype=float64)}
@@ -224,7 +238,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000551 seconds
+  9 entries computed in 0.000511 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -232,15 +246,16 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
+  Reusing element from cache
   Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
   Reusing element from cache
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {None: {FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None): {None: {None: {(0, 0): [[]]}}}}}
+  {None: {FiniteElement('Lagrange', triangle, 1): {None: {None: {(0, 0): [[]]}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0': array([], shape=(0, 1), dtype=float64)}
@@ -264,65 +279,54 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0237761 seconds.
+Compiler stage 2 finished in 0.027504 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000169992 seconds.
+Compiler stage 3 finished in 0.000174046 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -346,18 +350,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.0418749 seconds.
+Compiler stage 4 finished in 0.09027 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000473022 seconds.
+Compiler stage 4.1 finished in 0.000571012 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./MultiMeshPoisson.h.
-Compiler stage 5 finished in 0.000551939 seconds.
+Compiler stage 5 finished in 0.000490904 seconds.
 
-FFC finished in 0.126412 seconds.
+FFC finished in 0.199435 seconds.
+Output written to ./MultiMeshPoisson.h.
diff --git a/demo/undocumented/multimesh-poisson/cpp/main.cpp b/demo/undocumented/multimesh-poisson/cpp/main.cpp
index 53eaf7a..c51d963 100644
--- a/demo/undocumented/multimesh-poisson/cpp/main.cpp
+++ b/demo/undocumented/multimesh-poisson/cpp/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Anders Logg
+// Copyright (C) 2013-2015 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,17 +16,19 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-06-26
-// Last changed: 2014-07-05
+// Last changed: 2016-03-02
 //
 // This demo program solves Poisson's equation on a domain defined by
-// three overlapping and non-matching meshes.
+// three overlapping and non-matching meshes. The solution is computed
+// on a sequence of rotating meshes to test the multimesh
+// functionality.
 
 #include <cmath>
-
 #include <dolfin.h>
 #include "MultiMeshPoisson.h"
 
 using namespace dolfin;
+using std::make_shared;
 
 // Source term (right-hand side)
 class Source : public Expression
@@ -47,96 +49,69 @@ class DirichletBoundary : public SubDomain
 };
 
 // Compute solution for given mesh configuration
-void solve(double t,
-           double x1, double y1,
-           double x2, double y2,
-           bool plot_solution,
-           File& u0_file, File& u1_file, File& u2_file)
+void solve_poisson(double t,
+                   double x1, double y1,
+                   double x2, double y2,
+                   bool plot_solution,
+                   File& u0_file, File& u1_file, File& u2_file)
 {
   // Create meshes
   double r = 0.5;
-  RectangleMesh mesh_0(Point(-r, -r), Point(r, r), 16, 16);
-  RectangleMesh mesh_1(Point(x1 - r, y1 - r), Point(x1 + r, y1 + r), 8, 8);
-  RectangleMesh mesh_2(Point(x2 - r, y2 - r), Point(x2 + r, y2 + r), 8, 8);
-  mesh_1.rotate(70*t);
-  mesh_2.rotate(-70*t);
-
-  // Create function spaces
-  MultiMeshPoisson::FunctionSpace V0(mesh_0);
-  MultiMeshPoisson::FunctionSpace V1(mesh_1);
-  MultiMeshPoisson::FunctionSpace V2(mesh_2);
-
-  // FIXME: Some of this stuff may be wrapped or automated later to
-  // avoid needing to explicitly call add() and build()
+  auto mesh_0 = make_shared<RectangleMesh>(Point(-r, -r), Point(r, r), 16, 16);
+  auto mesh_1 = make_shared<RectangleMesh>(Point(x1 - r, y1 - r), Point(x1 + r, y1 + r), 8, 8);
+  auto mesh_2 = make_shared<RectangleMesh>(Point(x2 - r, y2 - r), Point(x2 + r, y2 + r), 8, 8);
+  mesh_1->rotate(70*t);
+  mesh_2->rotate(-70*t);
+
+  // Build multimesh
+  auto multimesh = make_shared<MultiMesh>();
+  multimesh->add(mesh_0);
+  multimesh->add(mesh_1);
+  multimesh->add(mesh_2);
+  multimesh->build();
+
+  // Create function space
+  auto V = make_shared<MultiMeshPoisson::MultiMeshFunctionSpace>(multimesh);
 
   // Create forms
-  MultiMeshPoisson::BilinearForm a0(V0, V0);
-  MultiMeshPoisson::BilinearForm a1(V1, V1);
-  MultiMeshPoisson::BilinearForm a2(V2, V2);
-  MultiMeshPoisson::LinearForm L0(V0);
-  MultiMeshPoisson::LinearForm L1(V1);
-  MultiMeshPoisson::LinearForm L2(V2);
-
-  // Build multimesh function space
-  MultiMeshFunctionSpace V;
-  V.parameters("multimesh")["quadrature_order"] = 2;
-  V.add(V0);
-  V.add(V1);
-  V.add(V2);
-  V.build();
-
-  // Set coefficients
-  Source f;
-  L0.f = f;
-  L1.f = f;
-  L2.f = f;
-
-  // Build multimesh forms
-  MultiMeshForm a(V, V);
-  MultiMeshForm L(V);
-  a.add(a0);
-  a.add(a1);
-  a.add(a2);
-  L.add(L0);
-  L.add(L1);
-  L.add(L2);
-  a.build();
-  L.build();
-
-  // Create boundary condition
-  Constant zero(0);
-  DirichletBoundary boundary;
-  MultiMeshDirichletBC bc(V, zero, boundary);
+  auto a = make_shared<MultiMeshPoisson::MultiMeshBilinearForm>(V, V);
+  auto L = make_shared<MultiMeshPoisson::MultiMeshLinearForm>(V);
+
+  // Attach coefficients
+  auto f = make_shared<Source>();
+  L->f = f;
 
   // Assemble linear system
-  Matrix A;
-  Vector b;
-  MultiMeshAssembler assembler;
-  assembler.assemble(A, a);
-  assembler.assemble(b, L);
+  auto A = make_shared<Matrix>();
+  auto b = make_shared<Vector>();
+  assemble_multimesh(*A, *a);
+  assemble_multimesh(*b, *L);
 
   // Apply boundary condition
-  bc.apply(A, b);
+  auto zero = make_shared<Constant>(0);
+  auto boundary = make_shared<DirichletBoundary>();
+  auto bc = make_shared<MultiMeshDirichletBC>(V, zero, boundary);
+  bc->apply(*A, *b);
 
   // Compute solution
-  MultiMeshFunction u(V);
-  solve(A, *u.vector(), b);
+  auto u = make_shared<MultiMeshFunction>(V);
+  solve(*A, *u->vector(), *b);
 
   // Save to file
-  u0_file << *u.part(0);
-  u1_file << *u.part(1);
-  u2_file << *u.part(2);
+  u0_file << *u->part(0);
+  u1_file << *u->part(1);
+  u2_file << *u->part(2);
 
   // Plot solution (last time)
   if (plot_solution)
   {
-    plot(V.multimesh());
-    plot(u.part(0), "u_0");
-    plot(u.part(1), "u_1");
-    plot(u.part(2), "u_2");
+    plot(V->multimesh());
+    plot(u->part(0), "u_0");
+    plot(u->part(1), "u_1");
+    plot(u->part(2), "u_2");
     interactive();
   }
-  }
+}
 
 int main(int argc, char* argv[])
 {
@@ -146,10 +121,6 @@ int main(int argc, char* argv[])
     return 0;
   }
 
-  // FIXME: Testing
-  //set_log_level(DBG);
-  parameters["reorder_dofs_serial"] = false;
-
   // Parameters
   const double T = 40.0;
   const std::size_t N = 400;
@@ -173,8 +144,8 @@ int main(int argc, char* argv[])
     const double y2 = sin(t)*cos(2*t);
 
     // Compute solution
-    solve(t, x1, y1, x2, y2, n == N - 1,
-          u0_file, u1_file, u2_file);
+    solve_poisson(t, x1, y1, x2, y2, n == N - 1,
+                  u0_file, u1_file, u2_file);
   }
 
   return 0;
diff --git a/demo/undocumented/multimesh-poisson/python/demo_multimesh-poisson.py b/demo/undocumented/multimesh-poisson/python/demo_multimesh-poisson.py
new file mode 100644
index 0000000..db2e281
--- /dev/null
+++ b/demo/undocumented/multimesh-poisson/python/demo_multimesh-poisson.py
@@ -0,0 +1,132 @@
+# Copyright (C) 2015 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2015-11-05
+# Last changed: 2015-11-17
+#
+# This demo program solves Poisson's equation on a domain defined by
+# three overlapping and non-matching meshes. The solution is computed
+# on a sequence of rotating meshes to test the multimesh
+# functionality.
+
+from dolfin import *
+
+class DirichletBoundary(SubDomain):
+    def inside(self, x, on_boundary):
+        return on_boundary
+
+def solve_poisson(t, x1, y1, x2, y2, plot_solution,
+                  u0_file, u1_file, u2_file):
+    "Compute solution for given mesh configuration"
+
+    # Create meshes
+    r = 0.5
+    mesh_0 = RectangleMesh(Point(-r, -r), Point(r, r), 16, 16)
+    mesh_1 = RectangleMesh(Point(x1 - r, y1 - r), Point(x1 + r, y1 + r), 8, 8)
+    mesh_2 = RectangleMesh(Point(x2 - r, y2 - r), Point(x2 + r, y2 + r), 8, 8)
+    mesh_1.rotate(70*t)
+    mesh_2.rotate(-70*t)
+
+    # Build multimesh
+    multimesh = MultiMesh()
+    multimesh.add(mesh_0)
+    multimesh.add(mesh_1)
+    multimesh.add(mesh_2)
+    multimesh.build()
+
+    # Create function space
+    V = MultiMeshFunctionSpace(multimesh, "Lagrange", 1)
+
+    # Define trial and test functions and right-hand side
+    u = TrialFunction(V)
+    v = TestFunction(V)
+    f = Constant(1)
+
+    # Define facet normal and mesh size
+    n = FacetNormal(multimesh)
+    h = 2.0*Circumradius(multimesh)
+    h = (h('+') + h('-')) / 2
+
+    # Set parameters
+    alpha = 4.0
+    beta = 4.0
+
+    # Define bilinear form
+    a = dot(grad(u), grad(v))*dX \
+      - dot(avg(grad(u)), jump(v, n))*dI \
+      - dot(avg(grad(v)), jump(u, n))*dI \
+      + alpha/h*jump(u)*jump(v)*dI \
+      + beta*dot(jump(grad(u)), jump(grad(v)))*dO
+
+    # Define linear form
+    L = f*v*dX
+
+    # Assemble linear system
+    A = assemble_multimesh(a)
+    b = assemble_multimesh(L)
+
+    # Apply boundary condition
+    zero = Constant(0)
+    boundary = DirichletBoundary()
+    bc = MultiMeshDirichletBC(V, zero, boundary)
+    bc.apply(A, b)
+
+    # Compute solution
+    u = MultiMeshFunction(V)
+    solve(A, u.vector(), b)
+
+    # Save to file
+    u0_file << u.part(0)
+    u1_file << u.part(1)
+    u2_file << u.part(2)
+
+    # Plot solution (last time)
+    if plot_solution:
+        plot(V.multimesh())
+        plot(u.part(0), title="u_0")
+        plot(u.part(1), title="u_1")
+        plot(u.part(2), title="u_2")
+        interactive()
+
+if MPI.size(mpi_comm_world()) > 1:
+    info("Sorry, this demo does not (yet) run in parallel.")
+    exit(0)
+
+# Parameters
+T = 40.0
+N = 400
+dt = T / N
+
+# Files for storing solution
+u0_file = File("u0.pvd")
+u1_file = File("u1.pvd")
+u2_file = File("u2.pvd")
+
+# Iterate over configurations
+for n in range(N):
+    info("Computing solution, step %d / %d." % (n + 1, N))
+
+    # Compute coordinates for meshes
+    t = dt*n
+    x1 = sin(t)*cos(2*t)
+    y1 = cos(t)*cos(2*t)
+    x2 = cos(t)*cos(2*t)
+    y2 = sin(t)*cos(2*t)
+
+    # Compute solution
+    solve_poisson(t, x1, y1, x2, y2, n == N - 1,
+                  u0_file, u1_file, u2_file)
diff --git a/demo/undocumented/multimesh-stokes/cpp/CMakeLists.txt b/demo/undocumented/multimesh-stokes/cpp/CMakeLists.txt
index c0b6c06..fdb3b7c 100644
--- a/demo/undocumented/multimesh-stokes/cpp/CMakeLists.txt
+++ b/demo/undocumented/multimesh-stokes/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/multimesh-stokes/cpp/MultiMeshStokes.h b/demo/undocumented/multimesh-stokes/cpp/MultiMeshStokes.h
index 247679a..af13185 100644
--- a/demo/undocumented/multimesh-stokes/cpp/MultiMeshStokes.h
+++ b/demo/undocumented/multimesh-stokes/cpp/MultiMeshStokes.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __MULTIMESHSTOKES_H
 #define __MULTIMESHSTOKES_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class multimeshstokes_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   multimeshstokes_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_finite_element_0()
+  ~multimeshstokes_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,33 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -159,33 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -195,141 +192,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -339,48 +220,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -459,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -481,81 +358,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -570,9 +427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -582,11 +439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -596,11 +453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -609,9 +466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -632,81 +489,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -721,9 +558,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -733,11 +570,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -747,11 +584,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -760,9 +597,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -783,81 +620,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -872,9 +689,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -884,11 +701,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -898,11 +715,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -911,9 +728,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -930,456 +747,481 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+    case 1:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new multimeshstokes_finite_element_0();
+  }
+
+};
+
+
+class multimeshstokes_finite_element_1: public ufc::finite_element
+{
+public:
+
+  multimeshstokes_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~multimeshstokes_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        return 2;
         break;
       }
-    case 5:
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -1387,30 +1229,49 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
     
     // Compute number of derivatives.
     unsigned int num_derivatives = 1;
@@ -1419,282 +1280,28 @@ public:
       num_derivatives *= 2;
     } // end loop over 'r'
     
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
+      values[r] = 0.0;
     } // end loop over 'r'
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
     {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
     {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
+    return ;
+    }
     
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new multimeshstokes_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class multimeshstokes_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  multimeshstokes_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 12;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1703,674 +1310,776 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
         
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
-      {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -2385,9 +2094,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -2397,11 +2106,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2411,11 +2120,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -2424,9 +2133,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -2438,314 +2147,363 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 2:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
         break;
       }
-    case 3:
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new multimeshstokes_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new multimeshstokes_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new multimeshstokes_finite_element_1();
+  }
+
+};
+
+
+class multimeshstokes_finite_element_2: public ufc::finite_element
+{
+public:
+
+  multimeshstokes_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~multimeshstokes_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -2772,131 +2530,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 1:
       {
         
       // Array of basisvalues
@@ -2923,131 +2566,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 2:
       {
         
       // Array of basisvalues
@@ -3074,131 +2602,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 3:
       {
         
       // Array of basisvalues
@@ -3225,131 +2638,52 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 5:
       {
         
       // Array of basisvalues
@@ -3376,7 +2710,181 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3392,7 +2900,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3495,12 +3003,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 1:
       {
         
       // Array of basisvalues
@@ -3527,7 +3035,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3543,7 +3051,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3646,12 +3154,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 2:
       {
         
       // Array of basisvalues
@@ -3678,7 +3186,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3694,7 +3202,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3797,12 +3305,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 3:
       {
         
       // Array of basisvalues
@@ -3829,7 +3337,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3845,7 +3353,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3948,12 +3456,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 4:
       {
         
       // Array of basisvalues
@@ -3980,7 +3488,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3996,7 +3504,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4099,198 +3607,297 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
+    case 5:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 5:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
-    case 7:
+    case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
-    case 8:
+    case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
-    case 9:
+    case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
-    case 10:
+    case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
-    case 11:
+    case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
     }
@@ -4298,205 +3905,196 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[2];
+    double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[3] = dof_values[7];
-    vertex_values[5] = dof_values[8];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes_finite_element_0();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes_finite_element_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new multimeshstokes_finite_element_1();
+    return new multimeshstokes_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class multimeshstokes_finite_element_2: public ufc::finite_element
+class multimeshstokes_finite_element_3: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  multimeshstokes_finite_element_2() : ufc::finite_element()
+  multimeshstokes_finite_element_3() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_finite_element_2()
+  ~multimeshstokes_finite_element_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_dimension(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4505,302 +4103,2029 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Reset values
-    *values = 0.0;
+    values[0] = 0.0;
+    values[1] = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
         {
-          if (combinations[row][col] + 1 > 1)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 6; u++)
           {
-            combinations[row][col] += 1;
-            break;
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4815,9 +6140,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4827,11 +6152,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4841,11 +6166,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4854,9 +6179,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4868,70 +6193,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 10:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4946,9 +6291,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4958,11 +6303,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4972,11 +6317,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4985,9 +6330,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4999,70 +6344,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 11:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5077,9 +6442,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5089,11 +6454,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5103,11 +6468,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5116,9 +6481,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5130,7 +6495,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -5139,28 +6504,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5172,57 +6535,55 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = 0.0;
+        values[r*2*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 2)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
+        values[r*2*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
@@ -5230,164 +6591,312 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
+    case 6:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
     }
     
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[1];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[6];
+    vertex_values[3] = dof_values[7];
+    vertex_values[5] = dof_values[8];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new multimeshstokes_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new multimeshstokes_finite_element_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new multimeshstokes_finite_element_2();
+    return new multimeshstokes_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class multimeshstokes_finite_element_3: public ufc::finite_element
+class multimeshstokes_finite_element_4: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  multimeshstokes_finite_element_3() : ufc::finite_element()
+  multimeshstokes_finite_element_4() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_finite_element_3()
+  ~multimeshstokes_finite_element_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 15;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5401,16 +6910,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5419,8 +6942,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -5952,20 +7475,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -5974,7 +7495,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -5982,21 +7503,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -6016,7 +7535,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -6028,7 +7547,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6037,8 +7556,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -6136,7 +7655,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6287,7 +7806,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6438,7 +7957,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6589,7 +8108,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6740,7 +8259,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6891,7 +8410,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7042,7 +8561,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7193,7 +8712,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7344,7 +8863,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7495,7 +9014,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7646,7 +9165,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7797,7 +9316,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8302,28 +9821,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -8359,7 +9876,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -8367,22 +9884,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -8393,120 +9908,120 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 12:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 13:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 14:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -8516,86 +10031,84 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[12] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[13] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[14] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -8611,83 +10124,288 @@ public:
     vertex_values[8] = dof_values[14];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new multimeshstokes_finite_element_3();
+        break;
+      }
+    case 1:
+      {
+        return new multimeshstokes_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new multimeshstokes_finite_element_4();
+  }
+
+};
+
+
+class multimeshstokes_dofmap_0: public ufc::dofmap
+{
+public:
+
+  multimeshstokes_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~multimeshstokes_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    return 2;
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    return 2;
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
-    switch (i)
+    switch (facet)
     {
     case 0:
       {
-        return new multimeshstokes_finite_element_1();
+        dofs[0] = 1;
+      dofs[1] = 2;
         break;
       }
     case 1:
       {
-        return new multimeshstokes_finite_element_2();
+        dofs[0] = 0;
+      dofs[1] = 2;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
         break;
       }
     }
     
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    return new multimeshstokes_finite_element_3();
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new multimeshstokes_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class multimeshstokes_dofmap_0: public ufc::dofmap
+class multimeshstokes_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  multimeshstokes_dofmap_0() : ufc::dofmap()
+  multimeshstokes_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_dofmap_0()
+  ~multimeshstokes_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -8698,7 +10416,7 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -8711,50 +10429,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0] + num_global_entities[1];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -8767,25 +10474,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -8793,30 +10498,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
-      dofs[2] = 3;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 4;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 5;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -8837,16 +10544,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -8855,30 +10565,7 @@ public:
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
@@ -8890,71 +10577,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new multimeshstokes_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new multimeshstokes_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new multimeshstokes_dofmap_0();
+    return new multimeshstokes_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class multimeshstokes_dofmap_1: public ufc::dofmap
+class multimeshstokes_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  multimeshstokes_dofmap_1() : ufc::dofmap()
+  multimeshstokes_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_dofmap_1()
+  ~multimeshstokes_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -8978,50 +10653,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2*num_global_entities[0] + 2*num_global_entities[1];
+    return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 1;
         break;
       }
     case 1:
       {
-        return 2;
+        return 1;
         break;
       }
     case 2:
@@ -9034,33 +10698,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9069,9 +10723,6 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
         break;
       }
     case 1:
@@ -9079,9 +10730,6 @@ public:
         dofs[0] = 0;
       dofs[1] = 2;
       dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
         break;
       }
     case 2:
@@ -9089,18 +10737,14 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9121,19 +10765,16 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 8;
           break;
         }
       }
@@ -9152,19 +10793,16 @@ public:
       case 0:
         {
           dofs[0] = 3;
-        dofs[1] = 9;
           break;
         }
       case 1:
         {
           dofs[0] = 4;
-        dofs[1] = 10;
           break;
         }
       case 2:
         {
           dofs[0] = 5;
-        dofs[1] = 11;
           break;
         }
       }
@@ -9180,97 +10818,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes_dofmap_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new multimeshstokes_dofmap_1();
+    return new multimeshstokes_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class multimeshstokes_dofmap_2: public ufc::dofmap
+class multimeshstokes_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  multimeshstokes_dofmap_2() : ufc::dofmap()
+  multimeshstokes_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_dofmap_2()
+  ~multimeshstokes_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9281,7 +10867,7 @@ public:
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -9294,50 +10880,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 0;
+        return 2;
         break;
       }
     case 2:
@@ -9350,19 +10925,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9370,27 +10957,38 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
+      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9411,16 +11009,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 8;
           break;
         }
       }
@@ -9429,7 +11030,33 @@ public:
       }
     case 1:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 9;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+        dofs[1] = 10;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+        dofs[1] = 11;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -9441,65 +11068,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new multimeshstokes_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new multimeshstokes_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new multimeshstokes_dofmap_2();
+    return new multimeshstokes_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class multimeshstokes_dofmap_3: public ufc::dofmap
+class multimeshstokes_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  multimeshstokes_dofmap_3() : ufc::dofmap()
+  multimeshstokes_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_dofmap_3()
+  ~multimeshstokes_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9523,39 +11144,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 15;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 8;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9579,37 +11189,35 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[12] = offset + c.entity_indices[0][0];
-    dofs[13] = offset + c.entity_indices[0][1];
-    dofs[14] = offset + c.entity_indices[0][2];
+    dofs[12] = offset + entity_indices[0][0];
+    dofs[13] = offset + entity_indices[0][1];
+    dofs[14] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9653,9 +11261,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9738,61 +11345,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new multimeshstokes_dofmap_1();
+        return new multimeshstokes_dofmap_3();
         break;
       }
     case 1:
       {
-        return new multimeshstokes_dofmap_2();
+        return new multimeshstokes_dofmap_0();
         break;
       }
     }
@@ -9800,46 +11370,38 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new multimeshstokes_dofmap_3();
+    return new multimeshstokes_dofmap_4();
   }
 
 };
 
-/// 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 multimeshstokes_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   multimeshstokes_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_cell_integral_0_otherwise()
+  ~multimeshstokes_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    32
@@ -9848,7 +11410,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -9903,7 +11465,7 @@ public:
     A[15] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_0_1 + 0.166666666666668*G2_0_0 + 0.166666666666666*G2_0_1;
     A[16] = 0.5*G0_0_0 + 0.5*G2_0_0;
     A[17] = -0.166666666666666*G0_0_1 - 0.166666666666666*G2_0_1;
-    A[18] = 0.666666666666663*G0_0_1 + 0.666666666666663*G2_0_1;
+    A[18] = 0.666666666666664*G0_0_1 + 0.666666666666664*G2_0_1;
     A[19] = 0.0;
     A[20] = -0.666666666666667*G0_0_0 - 0.666666666666666*G0_0_1 - 0.666666666666667*G2_0_0 - 0.666666666666666*G2_0_1;
     A[21] = 0.0;
@@ -9931,9 +11493,9 @@ public:
     A[43] = 0.0;
     A[44] = -0.166666666666667*G4_1;
     A[45] = 0.0;
-    A[46] = 0.666666666666663*G0_1_0 + 0.666666666666663*G2_1_0;
+    A[46] = 0.666666666666664*G0_1_0 + 0.666666666666664*G2_1_0;
     A[47] = 0.666666666666666*G0_0_1 + 0.666666666666666*G2_0_1;
-    A[48] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333331*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666656*G2_0_1 + 0.666666666666656*G2_1_0 + 1.33333333333331*G2_1_1;
+    A[48] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333332*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666656*G2_0_1 + 0.666666666666656*G2_1_0 + 1.33333333333332*G2_1_1;
     A[49] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666656*G0_1_0 - 1.33333333333333*G2_0_0 - 0.666666666666659*G2_0_1 - 0.666666666666656*G2_1_0;
     A[50] = -0.666666666666665*G0_0_1 - 0.666666666666666*G0_1_0 - 1.33333333333332*G0_1_1 - 0.666666666666665*G2_0_1 - 0.666666666666666*G2_1_0 - 1.33333333333332*G2_1_1;
     A[51] = 0.0;
@@ -9950,7 +11512,7 @@ public:
     A[62] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_1 - 0.666666666666666*G2_0_1 - 0.666666666666665*G2_1_1;
     A[63] = -1.33333333333333*G0_0_0 - 0.666666666666656*G0_0_1 - 0.666666666666659*G0_1_0 - 1.33333333333333*G2_0_0 - 0.666666666666656*G2_0_1 - 0.666666666666659*G2_1_0;
     A[64] = 1.33333333333333*G0_0_0 + 0.666666666666659*G0_0_1 + 0.666666666666659*G0_1_0 + 1.33333333333333*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666659*G2_0_1 + 0.666666666666659*G2_1_0 + 1.33333333333333*G2_1_1;
-    A[65] = 0.666666666666665*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666665*G2_1_0;
+    A[65] = 0.666666666666665*G0_0_1 + 0.666666666666666*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666666*G2_1_0;
     A[66] = 0.0;
     A[67] = 0.0;
     A[68] = 0.0;
@@ -9964,7 +11526,7 @@ public:
     A[76] = -0.666666666666667*G0_0_0 - 0.666666666666666*G0_1_0 - 0.666666666666667*G2_0_0 - 0.666666666666666*G2_1_0;
     A[77] = 0.0;
     A[78] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_0 - 1.33333333333332*G0_1_1 - 0.666666666666666*G2_0_1 - 0.666666666666665*G2_1_0 - 1.33333333333332*G2_1_1;
-    A[79] = 0.666666666666665*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666665*G2_1_0;
+    A[79] = 0.666666666666666*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666666*G2_0_1 + 0.666666666666665*G2_1_0;
     A[80] = 1.33333333333333*G0_0_0 + 0.666666666666667*G0_0_1 + 0.666666666666667*G0_1_0 + 1.33333333333333*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666667*G2_0_1 + 0.666666666666667*G2_1_0 + 1.33333333333333*G2_1_1;
     A[81] = 0.0;
     A[82] = 0.0;
@@ -9999,7 +11561,7 @@ public:
     A[111] = 0.166666666666668*G1_0_0 + 0.166666666666666*G1_0_1 + 0.166666666666668*G3_0_0 + 0.166666666666666*G3_0_1;
     A[112] = 0.5*G1_0_0 + 0.5*G3_0_0;
     A[113] = -0.166666666666666*G1_0_1 - 0.166666666666666*G3_0_1;
-    A[114] = 0.666666666666663*G1_0_1 + 0.666666666666663*G3_0_1;
+    A[114] = 0.666666666666664*G1_0_1 + 0.666666666666664*G3_0_1;
     A[115] = 0.0;
     A[116] = -0.666666666666667*G1_0_0 - 0.666666666666666*G1_0_1 - 0.666666666666667*G3_0_0 - 0.666666666666666*G3_0_1;
     A[117] = 0.0;
@@ -10027,9 +11589,9 @@ public:
     A[139] = 0.0;
     A[140] = 0.0;
     A[141] = 0.0;
-    A[142] = 0.666666666666663*G1_1_0 + 0.666666666666663*G3_1_0;
+    A[142] = 0.666666666666664*G1_1_0 + 0.666666666666664*G3_1_0;
     A[143] = 0.666666666666666*G1_0_1 + 0.666666666666666*G3_0_1;
-    A[144] = 1.33333333333333*G1_0_0 + 0.666666666666656*G1_0_1 + 0.666666666666656*G1_1_0 + 1.33333333333331*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666656*G3_0_1 + 0.666666666666656*G3_1_0 + 1.33333333333331*G3_1_1;
+    A[144] = 1.33333333333333*G1_0_0 + 0.666666666666656*G1_0_1 + 0.666666666666656*G1_1_0 + 1.33333333333332*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666656*G3_0_1 + 0.666666666666656*G3_1_0 + 1.33333333333332*G3_1_1;
     A[145] = -1.33333333333333*G1_0_0 - 0.666666666666659*G1_0_1 - 0.666666666666656*G1_1_0 - 1.33333333333333*G3_0_0 - 0.666666666666659*G3_0_1 - 0.666666666666656*G3_1_0;
     A[146] = -0.666666666666665*G1_0_1 - 0.666666666666666*G1_1_0 - 1.33333333333332*G1_1_1 - 0.666666666666665*G3_0_1 - 0.666666666666666*G3_1_0 - 1.33333333333332*G3_1_1;
     A[147] = -0.166666666666666*G5_0 - 0.166666666666665*G5_1;
@@ -10046,7 +11608,7 @@ public:
     A[158] = -0.666666666666666*G1_0_1 - 0.666666666666665*G1_1_1 - 0.666666666666666*G3_0_1 - 0.666666666666665*G3_1_1;
     A[159] = -1.33333333333333*G1_0_0 - 0.666666666666656*G1_0_1 - 0.666666666666659*G1_1_0 - 1.33333333333333*G3_0_0 - 0.666666666666656*G3_0_1 - 0.666666666666659*G3_1_0;
     A[160] = 1.33333333333333*G1_0_0 + 0.666666666666659*G1_0_1 + 0.666666666666659*G1_1_0 + 1.33333333333333*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666659*G3_0_1 + 0.666666666666659*G3_1_0 + 1.33333333333333*G3_1_1;
-    A[161] = 0.666666666666665*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666665*G3_1_0;
+    A[161] = 0.666666666666665*G1_0_1 + 0.666666666666666*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666666*G3_1_0;
     A[162] = 0.166666666666666*G5_0 - 0.166666666666668*G5_1;
     A[163] = 0.166666666666666*G5_0;
     A[164] = 0.333333333333333*G5_0 + 0.166666666666665*G5_1;
@@ -10060,7 +11622,7 @@ public:
     A[172] = -0.666666666666667*G1_0_0 - 0.666666666666666*G1_1_0 - 0.666666666666667*G3_0_0 - 0.666666666666666*G3_1_0;
     A[173] = 0.0;
     A[174] = -0.666666666666666*G1_0_1 - 0.666666666666665*G1_1_0 - 1.33333333333332*G1_1_1 - 0.666666666666666*G3_0_1 - 0.666666666666665*G3_1_0 - 1.33333333333332*G3_1_1;
-    A[175] = 0.666666666666665*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666665*G3_1_0;
+    A[175] = 0.666666666666666*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666666*G3_0_1 + 0.666666666666665*G3_1_0;
     A[176] = 1.33333333333333*G1_0_0 + 0.666666666666667*G1_0_1 + 0.666666666666667*G1_1_0 + 1.33333333333333*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666667*G3_0_1 + 0.666666666666667*G3_1_0 + 1.33333333333333*G3_1_1;
     A[177] = -0.166666666666667*G5_0 + 0.166666666666667*G5_1;
     A[178] = 0.166666666666667*G5_0 + 0.333333333333333*G5_1;
@@ -10114,56 +11676,41 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
 
-class multimeshstokes_custom_integral_0_0: public ufc::custom_integral
+class multimeshstokes_cutcell_integral_0_otherwise: public ufc::cutcell_integral
 {
 public:
 
-  /// Constructor
-  multimeshstokes_custom_integral_0_0() : ufc::custom_integral()
+  multimeshstokes_cutcell_integral_0_otherwise() : ufc::cutcell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_custom_integral_0_0()
+  ~multimeshstokes_cutcell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 1;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t num_quadrature_points,
+                       const double * quadrature_points,
+                       const double * quadrature_weights,
+                       int cell_orientation) const final override
   {
     
     // --- Compute geometric quantities on cell 0 ---
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -10171,8 +11718,13 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     // Compute cell volume
+    const double volume = std::abs(detJ)/2.0;
     
     // Compute circumradius of triangle in 2D
+    const double v1v2  = std::sqrt((coordinate_dofs[4] - coordinate_dofs[2])*(coordinate_dofs[4] - coordinate_dofs[2]) + (coordinate_dofs[5] - coordinate_dofs[3])*(coordinate_dofs[5] - coordinate_dofs[3]) );
+    const double v0v2  = std::sqrt(J[3]*J[3] + J[1]*J[1]);
+    const double v0v1  = std::sqrt(J[0]*J[0] + J[2]*J[2]);
+    const double circumradius = 0.25*(v1v2*v0v2*v0v1)/(volume);
     
     
     // Set quadrature weights
@@ -10191,8 +11743,8 @@ public:
     {
       // Get current quadrature point and compute values of basis functions
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes_finite_element_3::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
+      const double* v = coordinate_dofs + 0;
+      multimeshstokes_finite_element_4::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
       
       // Copy values to table FE0_C2
       for (std::size_t i = 0; i < 15; i++)
@@ -10211,6 +11763,11 @@ public:
     for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
       FE0_C1_D10[ip].resize(15);
     
+    // Create table FE0_C2_D10 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C2_D10(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C2_D10[ip].resize(15);
+    
     // Create table FE0_C0_D01 for basis function derivatives on all cells
     std::vector<std::vector<double> > FE0_C0_D01(num_quadrature_points);
     for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
@@ -10221,14 +11778,19 @@ public:
     for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
       FE0_C1_D01[ip].resize(15);
     
+    // Create table FE0_C2_D01 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C2_D01(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C2_D01[ip].resize(15);
+    
     // Evaluate basis function derivatives on cell 0
     static double FE0_dvalues_1_0[90];
     for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
     {
       // Get current quadrature point and compute values of basis function derivatives
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes_finite_element_3::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
+      const double* v = coordinate_dofs + 0;
+      multimeshstokes_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
       
       // Copy values to table FE0_C0_D10
       for (std::size_t i = 0; i < 15; i++)
@@ -10238,6 +11800,10 @@ public:
       for (std::size_t i = 0; i < 15; i++)
         FE0_C1_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 2];
       
+      // Copy values to table FE0_C2_D10
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C2_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 4];
+      
       // Copy values to table FE0_C0_D01
       for (std::size_t i = 0; i < 15; i++)
         FE0_C0_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 1];
@@ -10245,6 +11811,77 @@ public:
       // Copy values to table FE0_C1_D01
       for (std::size_t i = 0; i < 15; i++)
         FE0_C1_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 3];
+      
+      // Copy values to table FE0_C2_D01
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C2_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 5];
+    } // end loop over 'ip'
+    
+    
+    // --- Evaluation of basis function derivatives of order 2 ---
+    
+    // Create table FE0_C0_D20 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C0_D20(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C0_D20[ip].resize(15);
+    
+    // Create table FE0_C1_D20 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C1_D20(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C1_D20[ip].resize(15);
+    
+    // Create table FE0_C0_D11 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C0_D11(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C0_D11[ip].resize(15);
+    
+    // Create table FE0_C1_D11 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C1_D11(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C1_D11[ip].resize(15);
+    
+    // Create table FE0_C0_D02 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C0_D02(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C0_D02[ip].resize(15);
+    
+    // Create table FE0_C1_D02 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C1_D02(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C1_D02[ip].resize(15);
+    
+    // Evaluate basis function derivatives on cell 0
+    static double FE0_dvalues_2_0[180];
+    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
+    {
+      // Get current quadrature point and compute values of basis function derivatives
+      const double* x = quadrature_points + ip*2;
+      const double* v = coordinate_dofs + 0;
+      multimeshstokes_finite_element_4::_evaluate_basis_derivatives_all(2, FE0_dvalues_2_0, x, v, cell_orientation);
+      
+      // Copy values to table FE0_C0_D20
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C0_D20[ip][0 + i] = FE0_dvalues_2_0[12*i + 0];
+      
+      // Copy values to table FE0_C1_D20
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C1_D20[ip][0 + i] = FE0_dvalues_2_0[12*i + 4];
+      
+      // Copy values to table FE0_C0_D11
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C0_D11[ip][0 + i] = FE0_dvalues_2_0[12*i + 1];
+      
+      // Copy values to table FE0_C1_D11
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C1_D11[ip][0 + i] = FE0_dvalues_2_0[12*i + 5];
+      
+      // Copy values to table FE0_C0_D02
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C0_D02[ip][0 + i] = FE0_dvalues_2_0[12*i + 3];
+      
+      // Copy values to table FE0_C1_D02
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C1_D02[ip][0 + i] = FE0_dvalues_2_0[12*i + 7];
     } // end loop over 'ip'
     
     
@@ -10262,13 +11899,13 @@ public:
     for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
     {
       
-      // Number of operations for primary indices: 6525
+      // Number of operations for primary indices: 17775
       for (unsigned int j = 0; j < 15; j++)
       {
         for (unsigned int k = 0; k < 15; k++)
         {
-          // Number of operations to compute entry: 29
-          A[j*15 + k] += (((((0 + FE0_C0_D01[ip][j]))*((0 + FE0_C0_D01[ip][k])) + ((0 + FE0_C1_D01[ip][j]))*((0 + FE0_C1_D01[ip][k]))) + (((FE0_C0_D10[ip][j] + 0))*((FE0_C0_D10[ip][k] + 0)) + ((FE0_C1_D10[ip][j] + 0))*((FE0_C1_D10[ip][k] + 0)))) + (FE0_C2[ip][j]*((((0 + FE0_C1_D01[ip][k]) + (FE0_C0_D10[ip][k] + 0)))*(-1.0)) + FE0_C2[ip][k]*((((0 + FE0_C1_D01[ip][j]) + (FE0_C0_D10[ip][j] + 0)))*(-1.0))))*W[ip];
+          // Number of operations to compute entry: 79
+          A[j*15 + k] += (((((((((0 + 0 + 0 + FE0_C0_D02[ip][j]) + (FE0_C0_D20[ip][j] + 0 + 0 + 0)))*(-1.0) + ((FE0_C2_D10[ip][j] + 0))*(-1.0)))*(((((0 + 0 + 0 + FE0_C0_D02[ip][k]) + (FE0_C0_D20[ip][k] + 0 + 0 + 0)))*(-1.0) + (FE0_C2_D10[ip][k] + 0))) + (((((0 + 0 + 0 + FE0_C1_D02[ip][j]) + (FE0_C1_D20[ip][j] + 0 + 0 + 0)))*(-1.0) + ((0 + FE0_C2_D01[ip][j]))*(-1.0)))*(((((0 + 0 + 0 + FE0_C1_D02[ip][k]) + (FE0_C1_D20[ip][k] + 0 + 0 + 0)))*(-1.0) + (0 + FE0_C2_D01[ip][k])))))*2.0*circumrad [...]
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -10276,59 +11913,45 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
 
-class multimeshstokes_custom_integral_0_1: public ufc::custom_integral
+class multimeshstokes_interface_integral_0_otherwise: public ufc::interface_integral
 {
 public:
 
-  /// Constructor
-  multimeshstokes_custom_integral_0_1() : ufc::custom_integral()
+  multimeshstokes_interface_integral_0_otherwise() : ufc::interface_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_custom_integral_0_1()
+  ~multimeshstokes_interface_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 2;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t num_quadrature_points,
+                       const double * quadrature_points,
+                       const double * quadrature_weights,
+                       const double * facet_normals,
+                       int cell_orientation) const final override
   {
     
     // --- Compute geometric quantities on cell 0 ---
     
     // Extract vertex coordinates
-    const double* vertex_coordinates_0 = vertex_coordinates + 0;
+    const double* coordinate_dofs_0 = coordinate_dofs + 0;
     
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -10336,18 +11959,23 @@ public:
     compute_jacobian_inverse_triangle_2d(K_0, detJ_0, J_0);
     
     // Compute cell volume
+    const double volume_0 = std::abs(detJ_0)/2.0;
     
     // Compute circumradius of triangle in 2D
+    const double v1v2_0  = std::sqrt((coordinate_dofs_0[4] - coordinate_dofs_0[2])*(coordinate_dofs_0[4] - coordinate_dofs_0[2]) + (coordinate_dofs_0[5] - coordinate_dofs_0[3])*(coordinate_dofs_0[5] - coordinate_dofs_0[3]) );
+    const double v0v2_0  = std::sqrt(J_0[3]*J_0[3] + J_0[1]*J_0[1]);
+    const double v0v1_0  = std::sqrt(J_0[0]*J_0[0] + J_0[2]*J_0[2]);
+    const double circumradius_0 = 0.25*(v1v2_0*v0v2_0*v0v1_0)/(volume_0);
     
     
     // --- Compute geometric quantities on cell 1 ---
     
     // Extract vertex coordinates
-    const double* vertex_coordinates_1 = vertex_coordinates + 6;
+    const double* coordinate_dofs_1 = coordinate_dofs + 6;
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -10355,8 +11983,13 @@ public:
     compute_jacobian_inverse_triangle_2d(K_1, detJ_1, J_1);
     
     // Compute cell volume
+    const double volume_1 = std::abs(detJ_1)/2.0;
     
     // Compute circumradius of triangle in 2D
+    const double v1v2_1  = std::sqrt((coordinate_dofs_1[4] - coordinate_dofs_1[2])*(coordinate_dofs_1[4] - coordinate_dofs_1[2]) + (coordinate_dofs_1[5] - coordinate_dofs_1[3])*(coordinate_dofs_1[5] - coordinate_dofs_1[3]) );
+    const double v0v2_1  = std::sqrt(J_1[3]*J_1[3] + J_1[1]*J_1[1]);
+    const double v0v1_1  = std::sqrt(J_1[0]*J_1[0] + J_1[2]*J_1[2]);
+    const double circumradius_1 = 0.25*(v1v2_1*v0v2_1*v0v1_1)/(volume_1);
     
     
     // Set quadrature weights
@@ -10385,8 +12018,8 @@ public:
     {
       // Get current quadrature point and compute values of basis functions
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes_finite_element_3::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
+      const double* v = coordinate_dofs + 0;
+      multimeshstokes_finite_element_4::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
       
       // Copy values to table FE0_C0
       for (std::size_t i = 0; i < 15; i++)
@@ -10407,8 +12040,8 @@ public:
     {
       // Get current quadrature point and compute values of basis functions
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
-      multimeshstokes_finite_element_3::_evaluate_basis_all(FE0_values_1, x, v, cell_orientation);
+      const double* v = coordinate_dofs + 6;
+      multimeshstokes_finite_element_4::_evaluate_basis_all(FE0_values_1, x, v, cell_orientation);
       
       // Copy values to table FE0_C0
       for (std::size_t i = 0; i < 15; i++)
@@ -10451,8 +12084,8 @@ public:
     {
       // Get current quadrature point and compute values of basis function derivatives
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes_finite_element_3::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
+      const double* v = coordinate_dofs + 0;
+      multimeshstokes_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
       
       // Copy values to table FE0_C0_D10
       for (std::size_t i = 0; i < 15; i++)
@@ -10477,8 +12110,8 @@ public:
     {
       // Get current quadrature point and compute values of basis function derivatives
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
-      multimeshstokes_finite_element_3::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
+      const double* v = coordinate_dofs + 6;
+      multimeshstokes_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
       
       // Copy values to table FE0_C0_D10
       for (std::size_t i = 0; i < 15; i++)
@@ -10518,19 +12151,19 @@ public:
       const double n_11 = - facet_normals[2*ip + 1];
       
       
-      // Number of operations for primary indices: 49500
+      // Number of operations for primary indices: 59400
       for (unsigned int j = 0; j < 15; j++)
       {
         for (unsigned int k = 0; k < 15; k++)
         {
-          // Number of operations to compute entry: 55
-          A[(j + 15)*30 + (k + 15)] += (((((((((FE0_C0_D10[ip][k + 15]) + 0))*0.5)*(((FE0_C0[ip][j + 15]))*n_10) + ((((FE0_C1_D10[ip][k + 15]) + 0))*0.5)*(((FE0_C1[ip][j + 15]))*n_10)) + ((((0 + (FE0_C0_D01[ip][k + 15])))*0.5)*(((FE0_C0[ip][j + 15]))*n_11) + (((0 + (FE0_C1_D01[ip][k + 15])))*0.5)*(((FE0_C1[ip][j + 15]))*n_11))))*(-1.0) + (((((FE0_C0[ip][j + 15]))*n_10 + ((FE0_C1[ip][j + 15]))*n_11))*(((FE0_C2[ip][k + 15]))*0.5) + ((((FE0_C0[ip][k + 15]))*n_10 + ((FE0_C1[ip][k + 15]))*n_1 [...]
-          // Number of operations to compute entry: 55
-          A[(j + 15)*30 + k] += ((((((((0 + FE0_C0_D01[ip][k]))*0.5)*(((FE0_C0[ip][j + 15]))*n_11) + (((0 + FE0_C1_D01[ip][k]))*0.5)*(((FE0_C1[ip][j + 15]))*n_11)) + ((((FE0_C0_D10[ip][k] + 0))*0.5)*(((FE0_C0[ip][j + 15]))*n_10) + (((FE0_C1_D10[ip][k] + 0))*0.5)*(((FE0_C1[ip][j + 15]))*n_10))))*(-1.0) + (((((FE0_C0[ip][j + 15]))*n_10 + ((FE0_C1[ip][j + 15]))*n_11))*FE0_C2[ip][k]*0.5 + ((FE0_C0[ip][k]*n_00 + FE0_C1[ip][k]*n_01))*(((FE0_C2[ip][j + 15]))*0.5))) + (((((((FE0_C0_D10[ip][j + 1 [...]
-          // Number of operations to compute entry: 55
-          A[j*30 + (k + 15)] += (((((((((FE0_C0_D10[ip][k + 15]) + 0))*0.5)*FE0_C0[ip][j]*n_00 + ((((FE0_C1_D10[ip][k + 15]) + 0))*0.5)*FE0_C1[ip][j]*n_00) + ((((0 + (FE0_C0_D01[ip][k + 15])))*0.5)*FE0_C0[ip][j]*n_01 + (((0 + (FE0_C1_D01[ip][k + 15])))*0.5)*FE0_C1[ip][j]*n_01)))*(-1.0) + (((((FE0_C0[ip][k + 15]))*n_10 + ((FE0_C1[ip][k + 15]))*n_11))*FE0_C2[ip][j]*0.5 + ((FE0_C0[ip][j]*n_00 + FE0_C1[ip][j]*n_01))*(((FE0_C2[ip][k + 15]))*0.5))) + ((((((0 + FE0_C0_D01[ip][j]))*0.5)*(((FE0_C [...]
-          // Number of operations to compute entry: 55
-          A[j*30 + k] += ((((((((0 + FE0_C0_D01[ip][k]))*0.5)*FE0_C0[ip][j]*n_01 + (((0 + FE0_C1_D01[ip][k]))*0.5)*FE0_C1[ip][j]*n_01) + ((((FE0_C0_D10[ip][k] + 0))*0.5)*FE0_C0[ip][j]*n_00 + (((FE0_C1_D10[ip][k] + 0))*0.5)*FE0_C1[ip][j]*n_00)))*(-1.0) + (((FE0_C0[ip][j]*n_00 + FE0_C1[ip][j]*n_01))*FE0_C2[ip][k]*0.5 + ((FE0_C0[ip][k]*n_00 + FE0_C1[ip][k]*n_01))*FE0_C2[ip][j]*0.5)) + ((((((0 + FE0_C0_D01[ip][j]))*0.5)*FE0_C0[ip][k]*n_01 + (((0 + FE0_C1_D01[ip][j]))*0.5)*FE0_C1[ip][k]*n_01) [...]
+          // Number of operations to compute entry: 68
+          A[(j + 15)*30 + (k + 15)] += (((((((((FE0_C0_D10[ip][k + 15]) + 0))*0.5)*(((FE0_C0[ip][j + 15]))*n_10) + ((((FE0_C1_D10[ip][k + 15]) + 0))*0.5)*(((FE0_C1[ip][j + 15]))*n_10)) + ((((0 + (FE0_C0_D01[ip][k + 15])))*0.5)*(((FE0_C0[ip][j + 15]))*n_11) + (((0 + (FE0_C1_D01[ip][k + 15])))*0.5)*(((FE0_C1[ip][j + 15]))*n_11))))*(-1.0) + ((((((FE0_C0[ip][j + 15]))*(-1.0))*(((FE0_C0[ip][k + 15]))*(-1.0)) + (((FE0_C1[ip][j + 15]))*(-1.0))*(((FE0_C1[ip][k + 15]))*(-1.0))))*(4.0/(0.5*((2.0*c [...]
+          // Number of operations to compute entry: 66
+          A[(j + 15)*30 + k] += ((((((((0 + FE0_C0_D01[ip][k]))*0.5)*(((FE0_C0[ip][j + 15]))*n_11) + (((0 + FE0_C1_D01[ip][k]))*0.5)*(((FE0_C1[ip][j + 15]))*n_11)) + ((((FE0_C0_D10[ip][k] + 0))*0.5)*(((FE0_C0[ip][j + 15]))*n_10) + (((FE0_C1_D10[ip][k] + 0))*0.5)*(((FE0_C1[ip][j + 15]))*n_10))))*(-1.0) + ((((((FE0_C0[ip][j + 15]))*(-1.0))*FE0_C0[ip][k] + (((FE0_C1[ip][j + 15]))*(-1.0))*FE0_C1[ip][k]))*(4.0/(0.5*((2.0*circumradius_0 + 2.0*circumradius_1)))) + (((((FE0_C0[ip][j + 15]))*n_10 [...]
+          // Number of operations to compute entry: 66
+          A[j*30 + (k + 15)] += (((((((((FE0_C0_D10[ip][k + 15]) + 0))*0.5)*FE0_C0[ip][j]*n_00 + ((((FE0_C1_D10[ip][k + 15]) + 0))*0.5)*FE0_C1[ip][j]*n_00) + ((((0 + (FE0_C0_D01[ip][k + 15])))*0.5)*FE0_C0[ip][j]*n_01 + (((0 + (FE0_C1_D01[ip][k + 15])))*0.5)*FE0_C1[ip][j]*n_01)))*(-1.0) + ((((((FE0_C0[ip][k + 15]))*n_10 + ((FE0_C1[ip][k + 15]))*n_11))*FE0_C2[ip][j]*0.5 + ((FE0_C0[ip][j]*n_00 + FE0_C1[ip][j]*n_01))*(((FE0_C2[ip][k + 15]))*0.5)) + ((FE0_C0[ip][j]*(((FE0_C0[ip][k + 15]))*(-1 [...]
+          // Number of operations to compute entry: 64
+          A[j*30 + k] += ((((((((0 + FE0_C0_D01[ip][k]))*0.5)*FE0_C0[ip][j]*n_01 + (((0 + FE0_C1_D01[ip][k]))*0.5)*FE0_C1[ip][j]*n_01) + ((((FE0_C0_D10[ip][k] + 0))*0.5)*FE0_C0[ip][j]*n_00 + (((FE0_C1_D10[ip][k] + 0))*0.5)*FE0_C1[ip][j]*n_00)))*(-1.0) + ((((FE0_C0[ip][j]*n_00 + FE0_C1[ip][j]*n_01))*FE0_C2[ip][k]*0.5 + ((FE0_C0[ip][k]*n_00 + FE0_C1[ip][k]*n_01))*FE0_C2[ip][j]*0.5) + ((FE0_C0[ip][j]*FE0_C0[ip][k] + FE0_C1[ip][j]*FE0_C1[ip][k]))*(4.0/(0.5*((2.0*circumradius_0 + 2.0*circumra [...]
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -10538,59 +12171,44 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
 
-class multimeshstokes_custom_integral_0_2: public ufc::custom_integral
+class multimeshstokes_overlap_integral_0_otherwise: public ufc::overlap_integral
 {
 public:
 
-  /// Constructor
-  multimeshstokes_custom_integral_0_2() : ufc::custom_integral()
+  multimeshstokes_overlap_integral_0_otherwise() : ufc::overlap_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_custom_integral_0_2()
+  ~multimeshstokes_overlap_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 2;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t num_quadrature_points,
+                       const double * quadrature_points,
+                       const double * quadrature_weights,
+                       int cell_orientation) const final override
   {
     
     // --- Compute geometric quantities on cell 0 ---
     
     // Extract vertex coordinates
-    const double* vertex_coordinates_0 = vertex_coordinates + 0;
+    const double* coordinate_dofs_0 = coordinate_dofs + 0;
     
     // Compute Jacobian
     double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
+    compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
     
     // Compute Jacobian inverse and determinant
     double K_0[4];
@@ -10605,11 +12223,11 @@ public:
     // --- Compute geometric quantities on cell 1 ---
     
     // Extract vertex coordinates
-    const double* vertex_coordinates_1 = vertex_coordinates + 6;
+    const double* coordinate_dofs_1 = coordinate_dofs + 6;
     
     // Compute Jacobian
     double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
+    compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
     
     // Compute Jacobian inverse and determinant
     double K_1[4];
@@ -10652,8 +12270,8 @@ public:
     {
       // Get current quadrature point and compute values of basis function derivatives
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes_finite_element_3::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
+      const double* v = coordinate_dofs + 0;
+      multimeshstokes_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
       
       // Copy values to table FE0_C0_D10
       for (std::size_t i = 0; i < 15; i++)
@@ -10678,8 +12296,8 @@ public:
     {
       // Get current quadrature point and compute values of basis function derivatives
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
-      multimeshstokes_finite_element_3::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
+      const double* v = coordinate_dofs + 6;
+      multimeshstokes_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
       
       // Copy values to table FE0_C0_D10
       for (std::size_t i = 0; i < 15; i++)
@@ -10733,38 +12351,31 @@ public:
 
 };
 
-/// 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 multimeshstokes_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   multimeshstokes_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_cell_integral_1_otherwise()
+  ~multimeshstokes_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    12
@@ -10773,7 +12384,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -10817,56 +12428,41 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
 
-class multimeshstokes_custom_integral_1_0: public ufc::custom_integral
+class multimeshstokes_cutcell_integral_1_otherwise: public ufc::cutcell_integral
 {
 public:
 
-  /// Constructor
-  multimeshstokes_custom_integral_1_0() : ufc::custom_integral()
+  multimeshstokes_cutcell_integral_1_otherwise() : ufc::cutcell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_custom_integral_1_0()
+  ~multimeshstokes_cutcell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 1;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t num_quadrature_points,
+                       const double * quadrature_points,
+                       const double * quadrature_weights,
+                       int cell_orientation) const final override
   {
     
     // --- Compute geometric quantities on cell 0 ---
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -10874,8 +12470,13 @@ public:
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
     // Compute cell volume
+    const double volume = std::abs(detJ)/2.0;
     
     // Compute circumradius of triangle in 2D
+    const double v1v2  = std::sqrt((coordinate_dofs[4] - coordinate_dofs[2])*(coordinate_dofs[4] - coordinate_dofs[2]) + (coordinate_dofs[5] - coordinate_dofs[3])*(coordinate_dofs[5] - coordinate_dofs[3]) );
+    const double v0v2  = std::sqrt(J[3]*J[3] + J[1]*J[1]);
+    const double v0v1  = std::sqrt(J[0]*J[0] + J[2]*J[2]);
+    const double circumradius = 0.25*(v1v2*v0v2*v0v1)/(volume);
     
     
     // Set quadrature weights
@@ -10886,59 +12487,157 @@ public:
     // Create table FE0_C0 for basis function values on all cells
     std::vector<std::vector<double> > FE0_C0(num_quadrature_points);
     for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0[ip].resize(12);
+      FE0_C0[ip].resize(15);
     
     // Create table FE0_C1 for basis function values on all cells
     std::vector<std::vector<double> > FE0_C1(num_quadrature_points);
     for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1[ip].resize(12);
+      FE0_C1[ip].resize(15);
     
     // Evaluate basis functions on cell 0
-    static double FE0_values_0[24];
+    static double FE0_values_0[45];
     for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
     {
       // Get current quadrature point and compute values of basis functions
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes_finite_element_1::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
+      const double* v = coordinate_dofs + 0;
+      multimeshstokes_finite_element_4::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
       
       // Copy values to table FE0_C0
-      for (std::size_t i = 0; i < 12; i++)
-        FE0_C0[ip][0 + i] = FE0_values_0[2*i + 0];
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C0[ip][0 + i] = FE0_values_0[3*i + 0];
       
       // Copy values to table FE0_C1
-      for (std::size_t i = 0; i < 12; i++)
-        FE0_C1[ip][0 + i] = FE0_values_0[2*i + 1];
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C1[ip][0 + i] = FE0_values_0[3*i + 1];
+    } // end loop over 'ip'
+    
+    // --- Evaluation of basis function derivatives of order 1 ---
+    
+    // Create table FE0_C2_D10 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C2_D10(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C2_D10[ip].resize(15);
+    
+    // Create table FE0_C2_D01 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C2_D01(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C2_D01[ip].resize(15);
+    
+    // Evaluate basis function derivatives on cell 0
+    static double FE0_dvalues_1_0[90];
+    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
+    {
+      // Get current quadrature point and compute values of basis function derivatives
+      const double* x = quadrature_points + ip*2;
+      const double* v = coordinate_dofs + 0;
+      multimeshstokes_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
+      
+      // Copy values to table FE0_C2_D10
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C2_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 4];
+      
+      // Copy values to table FE0_C2_D01
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C2_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 5];
+    } // end loop over 'ip'
+    
+    
+    // --- Evaluation of basis function derivatives of order 2 ---
+    
+    // Create table FE0_C0_D20 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C0_D20(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C0_D20[ip].resize(15);
+    
+    // Create table FE0_C1_D20 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C1_D20(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C1_D20[ip].resize(15);
+    
+    // Create table FE0_C0_D11 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C0_D11(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C0_D11[ip].resize(15);
+    
+    // Create table FE0_C1_D11 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C1_D11(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C1_D11[ip].resize(15);
+    
+    // Create table FE0_C0_D02 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C0_D02(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C0_D02[ip].resize(15);
+    
+    // Create table FE0_C1_D02 for basis function derivatives on all cells
+    std::vector<std::vector<double> > FE0_C1_D02(num_quadrature_points);
+    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
+      FE0_C1_D02[ip].resize(15);
+    
+    // Evaluate basis function derivatives on cell 0
+    static double FE0_dvalues_2_0[180];
+    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
+    {
+      // Get current quadrature point and compute values of basis function derivatives
+      const double* x = quadrature_points + ip*2;
+      const double* v = coordinate_dofs + 0;
+      multimeshstokes_finite_element_4::_evaluate_basis_derivatives_all(2, FE0_dvalues_2_0, x, v, cell_orientation);
+      
+      // Copy values to table FE0_C0_D20
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C0_D20[ip][0 + i] = FE0_dvalues_2_0[12*i + 0];
+      
+      // Copy values to table FE0_C1_D20
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C1_D20[ip][0 + i] = FE0_dvalues_2_0[12*i + 4];
+      
+      // Copy values to table FE0_C0_D11
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C0_D11[ip][0 + i] = FE0_dvalues_2_0[12*i + 1];
+      
+      // Copy values to table FE0_C1_D11
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C1_D11[ip][0 + i] = FE0_dvalues_2_0[12*i + 5];
+      
+      // Copy values to table FE0_C0_D02
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C0_D02[ip][0 + i] = FE0_dvalues_2_0[12*i + 3];
+      
+      // Copy values to table FE0_C1_D02
+      for (std::size_t i = 0; i < 15; i++)
+        FE0_C1_D02[ip][0 + i] = FE0_dvalues_2_0[12*i + 7];
     } // end loop over 'ip'
     
+    
     // --- Evaluation of basis functions ---
     
     // Create table FE1_C0 for basis function values on all cells
     std::vector<std::vector<double> > FE1_C0(num_quadrature_points);
     for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C0[ip].resize(15);
+      FE1_C0[ip].resize(12);
     
     // Create table FE1_C1 for basis function values on all cells
     std::vector<std::vector<double> > FE1_C1(num_quadrature_points);
     for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C1[ip].resize(15);
+      FE1_C1[ip].resize(12);
     
     // Evaluate basis functions on cell 0
-    static double FE1_values_0[45];
+    static double FE1_values_0[24];
     for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
     {
       // Get current quadrature point and compute values of basis functions
       const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
+      const double* v = coordinate_dofs + 0;
       multimeshstokes_finite_element_3::_evaluate_basis_all(FE1_values_0, x, v, cell_orientation);
       
       // Copy values to table FE1_C0
-      for (std::size_t i = 0; i < 15; i++)
-        FE1_C0[ip][0 + i] = FE1_values_0[3*i + 0];
+      for (std::size_t i = 0; i < 12; i++)
+        FE1_C0[ip][0 + i] = FE1_values_0[2*i + 0];
       
       // Copy values to table FE1_C1
-      for (std::size_t i = 0; i < 15; i++)
-        FE1_C1[ip][0 + i] = FE1_values_0[3*i + 1];
+      for (std::size_t i = 0; i < 12; i++)
+        FE1_C1[ip][0 + i] = FE1_values_0[2*i + 1];
     } // end loop over 'ip'
     
     // Reset values in the element tensor.
@@ -10962,92 +12661,84 @@ public:
       // Total number of operations to compute function values = 48
       for (unsigned int r = 0; r < 12; r++)
       {
-        F0 += FE0_C0[ip][r]*w[0][r];
-        F1 += FE0_C1[ip][r]*w[0][r];
+        F0 += FE1_C0[ip][r]*w[0][r];
+        F1 += FE1_C1[ip][r]*w[0][r];
       } // end loop over 'r'
       
-      // Number of operations for primary indices: 75
+      // Number of operations for primary indices: 525
       for (unsigned int j = 0; j < 15; j++)
       {
-        // Number of operations to compute entry: 5
-        A[j] += (FE1_C0[ip][j]*F0 + FE1_C1[ip][j]*F1)*W[ip];
+        // Number of operations to compute entry: 35
+        A[j] += ((((((((0 + 0 + 0 + FE0_C0_D02[ip][j]) + (FE0_C0_D20[ip][j] + 0 + 0 + 0)))*(-1.0) + ((FE0_C2_D10[ip][j] + 0))*(-1.0)))*F0 + (((((0 + 0 + 0 + FE0_C1_D02[ip][j]) + (FE0_C1_D20[ip][j] + 0 + 0 + 0)))*(-1.0) + ((0 + FE0_C2_D01[ip][j]))*(-1.0)))*F1))*2.0*circumradius*2.0*circumradius + (FE0_C0[ip][j]*F0 + FE0_C1[ip][j]*F1))*W[ip];
       } // end loop over 'j'
     } // end loop over 'ip'
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class multimeshstokes_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   multimeshstokes_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_form_0()
+  ~multimeshstokes_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "629a11d247d30bc5eacd5b7d94a713fc043c460d2c52f55b8c9050c08d9aec29003d63ec4532655ebab75466ff02631aece914e6b2b1f7e931acedc9a59f67ad";
+    return "eab68f924c8ada51688ca2f2b65f2aef248dbc75887cf16d8c8e4b7fe58f9eaee8ca21b94d37139241acbb5ee616de909257209ce315eb516007b73a96d26310";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new multimeshstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new multimeshstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new multimeshstokes_finite_element_3();
+        return new multimeshstokes_finite_element_4();
         break;
       }
     case 1:
       {
-        return new multimeshstokes_finite_element_3();
+        return new multimeshstokes_finite_element_4();
         break;
       }
     }
@@ -11055,19 +12746,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new multimeshstokes_dofmap_3();
+        return new multimeshstokes_dofmap_4();
         break;
       }
     case 1:
       {
-        return new multimeshstokes_dofmap_3();
+        return new multimeshstokes_dofmap_4();
         break;
       }
     }
@@ -11075,222 +12765,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
-    return 3;
+    return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_cutcell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return true;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
-    switch (subdomain_id)
-    {
-    case 0:
-      {
-        return new multimeshstokes_custom_integral_0_0();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes_custom_integral_0_1();
-        break;
-      }
-    case 2:
-      {
-        return new multimeshstokes_custom_integral_0_2();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new multimeshstokes_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return new multimeshstokes_cutcell_integral_0_otherwise();
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return new multimeshstokes_interface_integral_0_otherwise();
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
+  {
+    return new multimeshstokes_overlap_integral_0_otherwise();
+  }
+
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class multimeshstokes_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   multimeshstokes_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~multimeshstokes_form_1()
+  ~multimeshstokes_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "9b32ea70ced1a4a1c3da5c65146156f8081129146e343a820bf929ab1ab711b5c66fdf8ea2647283211962e98aa6e4bb2ad4799a8dd642efa85c8232ff0f7257";
+    return "77bbe426cf213a8784b087defd5c5ae111a82de60115a2cad6c1d245b5826ae44cec73eb7e645fb051d700f9d451a363f72e0eedd9e93c581f1d9652588562d2";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new multimeshstokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new multimeshstokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new multimeshstokes_finite_element_3();
+        return new multimeshstokes_finite_element_4();
         break;
       }
     case 1:
       {
-        return new multimeshstokes_finite_element_1();
+        return new multimeshstokes_finite_element_3();
         break;
       }
     }
@@ -11298,19 +12997,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new multimeshstokes_dofmap_3();
+        return new multimeshstokes_dofmap_4();
         break;
       }
     case 1:
       {
-        return new multimeshstokes_dofmap_1();
+        return new multimeshstokes_dofmap_3();
         break;
       }
     }
@@ -11318,135 +13016,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
-    return 1;
+    return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return true;
   }
 
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
-    switch (subdomain_id)
-    {
-    case 0:
-      {
-        return new multimeshstokes_custom_integral_1_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new multimeshstokes_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return new multimeshstokes_cutcell_integral_1_otherwise();
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -11460,14 +13185,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace MultiMeshStokes
 {
@@ -11476,43 +13207,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshstokes_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshstokes_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshstokes_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshstokes_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -11523,43 +13231,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshstokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshstokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshstokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshstokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -11570,63 +13255,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshstokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshstokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshstokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshstokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -11634,7 +13326,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes_form_0());
+    _ufc_form = std::make_shared<const multimeshstokes_form_0>();
   }
 
   // Destructor
@@ -11664,57 +13356,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshstokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshstokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshstokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshstokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -11722,69 +13469,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes_form_1());
+    _ufc_form = std::make_shared<const multimeshstokes_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes_form_1());
+    _ufc_form = std::make_shared<const multimeshstokes_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -11816,18 +13604,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/multimesh-stokes/cpp/MultiMeshStokes.ufl b/demo/undocumented/multimesh-stokes/cpp/MultiMeshStokes.ufl
index 0f12a81..30cf049 100644
--- a/demo/undocumented/multimesh-stokes/cpp/MultiMeshStokes.ufl
+++ b/demo/undocumented/multimesh-stokes/cpp/MultiMeshStokes.ufl
@@ -1,4 +1,4 @@
-# Copyright (C) 2014 Anders Logg
+# Copyright (C) 2014-2015 Anders Logg
 #
 # This file is part of DOLFIN.
 #
@@ -16,7 +16,7 @@
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
 # First added:  2014-06-10
-# Last changed: 2014-06-10
+# Last changed: 2015-11-17
 #
 # The bilinear form a(u, v) and linear form L(v) for a multimesh
 # formulation of the Stokes equations.
@@ -36,17 +36,6 @@ f = Coefficient(P2)
 # Define facet normal and mesh size
 n = FacetNormal(triangle)
 h = 2.0*Circumradius(triangle)
-h = (h('+') + h('-')) / 2
-
-# Define custom measures (FIXME: prettify this)
-dc0 = dc(0, metadata={"num_cells": 1})
-dc1 = dc(1, metadata={"num_cells": 2})
-dc2 = dc(2, metadata={"num_cells": 2})
-
-# Define measures for integration
-dx = dx + dc0 # domain integral
-di = dc1      # interface integral
-do = dc2      # overlap integral
 
 # Parameters
 alpha = 4.0
@@ -55,18 +44,28 @@ def tensor_jump(v, n):
     return outer(v('+'), n('+')) + outer(v('-'), n('-'))
 
 def a_h(v, w):
-    return inner(grad(v), grad(w))*dx \
-         - inner(avg(grad(v)), tensor_jump(w, n))*di \
-         - inner(avg(grad(w)), tensor_jump(v, n))*di
+    return inner(grad(v), grad(w))*dX \
+         - inner(avg(grad(v)), tensor_jump(w, n))*dI \
+         - inner(avg(grad(w)), tensor_jump(v, n))*dI \
+         + alpha/avg(h) * inner(jump(v), jump(w))*dI
 
 def b_h(v, q):
-    return -div(v)*q*dx + jump(v, n)*avg(q)*di
+    return -div(v)*q*dX + jump(v, n)*avg(q)*dI
+
+def l_h(v, q, f):
+    return inner(f, v)*dX
+
+def s_O(v, w):
+    return inner(jump(grad(v)), jump(grad(w)))*dO
+
+def s_C(v, q, w, r):
+    return h*h*inner(-div(grad(v)) + grad(q), -div(grad(w)) - grad(r))*dC
 
-def s_h(v, w):
-    return inner(jump(grad(v)), jump(grad(w)))*do
+def l_C(v, q, f):
+    return h*h*inner(f, -div(grad(v)) - grad(q))*dC
 
-# Bilinear form
-a = a_h(u, v) + b_h(v, p) + b_h(u, q) + s_h(u, v)
+# Define bilinear form
+a = a_h(u, v) + b_h(v, p) + b_h(u, q) + s_O(u, v) + s_C(u, p, v, q)
 
-# Linear form
-L = dot(f, v)*dx
+# Define linear form
+L  = l_h(v, q, f) + l_C(v, q, f)
diff --git a/demo/undocumented/multimesh-stokes/cpp/Stokes.h b/demo/undocumented/multimesh-stokes/cpp/Stokes.h
index c153ee8..8cd2d00 100644
--- a/demo/undocumented/multimesh-stokes/cpp/Stokes.h
+++ b/demo/undocumented/multimesh-stokes/cpp/Stokes.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __STOKES_H
 #define __STOKES_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class stokes_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   stokes_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_finite_element_0()
+  ~stokes_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,33 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -159,33 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -195,141 +192,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -339,48 +220,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,19 +277,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,18 +298,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -459,7 +336,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -481,81 +358,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -570,9 +427,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -582,11 +439,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -596,11 +453,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -609,9 +466,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -632,81 +489,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -721,9 +558,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -733,11 +570,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -747,11 +584,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -760,9 +597,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -783,81 +620,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -872,9 +689,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -884,11 +701,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -898,11 +715,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -911,9 +728,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -930,42 +747,2605 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_0();
+  }
+
+};
+
+
+class stokes_finite_element_1: public ufc::finite_element
+{
+public:
+
+  stokes_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokes_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_1();
+  }
+
+};
+
+
+class stokes_finite_element_2: public ufc::finite_element
+{
+public:
+
+  stokes_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokes_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[6][6] = \
@@ -973,7 +3353,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1124,7 +3504,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +3655,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1387,28 +3767,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1444,7 +3822,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1452,558 +3830,292 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokes_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokes_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokes_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 12;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 2:
+    case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 3:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 4:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 5:
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_2();
+  }
+
+};
+
+
+class stokes_finite_element_3: public ufc::finite_element
+{
+public:
+
+  stokes_finite_element_3() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~stokes_finite_element_3() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        return 2;
         break;
       }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        return 2;
         break;
       }
-    case 8:
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -2030,16 +4142,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 1:
       {
         
       // Array of basisvalues
@@ -2066,16 +4178,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 2:
       {
         
       // Array of basisvalues
@@ -2102,16 +4214,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 6; r++)
       {
-        values[1] += coefficients0[r]*basisvalues[r];
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 3:
       {
         
       // Array of basisvalues
@@ -2136,163 +4248,18 @@ public:
       basisvalues[4] *= std::sqrt(4.5);
       basisvalues[3] *= std::sqrt(7.5);
       
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
-      {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 4:
       {
         
       // Array of basisvalues
@@ -2319,131 +4286,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 5:
       {
         
       // Array of basisvalues
@@ -2466,135 +4318,20 @@ public:
       basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 6:
       {
         
       // Array of basisvalues
@@ -2621,131 +4358,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 7:
       {
         
       // Array of basisvalues
@@ -2768,135 +4390,20 @@ public:
       basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 8:
       {
         
       // Array of basisvalues
@@ -2923,131 +4430,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 9:
       {
         
       // Array of basisvalues
@@ -3074,131 +4466,16 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 10:
       {
         
       // Array of basisvalues
@@ -3225,131 +4502,193 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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--)
         {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
+          if (combinations[row][col] + 1 > 1)
+            combinations[row][col] = 0;
+          else
           {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
+            combinations[row][col] += 1;
+            break;
           }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
-    case 7:
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -3376,7 +4715,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3392,7 +4731,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3495,12 +4834,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 1:
       {
         
       // Array of basisvalues
@@ -3527,7 +4866,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3543,7 +4882,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3646,12 +4985,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 2:
       {
         
       // Array of basisvalues
@@ -3678,7 +5017,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3694,7 +5033,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3797,12 +5136,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 3:
       {
         
       // Array of basisvalues
@@ -3829,7 +5168,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3845,7 +5184,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3948,12 +5287,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 4:
       {
         
       // Array of basisvalues
@@ -3980,7 +5319,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[6][6] = \
@@ -3996,7 +5335,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4009,798 +5348,784 @@ public:
       
       // Declare derivative matrix (of polynomial basis).
       double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 7:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 8:
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 9:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 10:
+    case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[6];
-    vertex_values[3] = dof_values[7];
-    vertex_values[5] = dof_values[8];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokes_finite_element_0();
-        break;
-      }
-    case 1:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        return new stokes_finite_element_0();
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new stokes_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class stokes_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  stokes_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~stokes_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
         {
-          if (combinations[row][col] + 1 > 1)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 6; u++)
           {
-            combinations[row][col] += 1;
-            break;
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4815,9 +6140,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4827,11 +6152,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4841,11 +6166,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4854,9 +6179,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4868,70 +6193,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 10:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4946,9 +6291,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4958,11 +6303,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4972,11 +6317,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4985,9 +6330,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4999,70 +6344,90 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 11:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 6; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 6; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5077,9 +6442,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5089,11 +6454,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5103,11 +6468,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 6; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 6; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5116,9 +6481,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 6; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 6; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5130,7 +6495,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -5139,28 +6504,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5172,57 +6535,55 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = 0.0;
+        values[r*2*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 2)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
+        values[r*2*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
@@ -5230,164 +6591,312 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
+    case 6:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 10:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 11:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
     }
     
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[1];
+    double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[8] = vals[1];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[10] = vals[1];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[6];
+    vertex_values[3] = dof_values[7];
+    vertex_values[5] = dof_values[8];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_finite_element_2();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_finite_element_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new stokes_finite_element_2();
+    return new stokes_finite_element_3();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class stokes_finite_element_3: public ufc::finite_element
+class stokes_finite_element_4: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  stokes_finite_element_3() : ufc::finite_element()
+  stokes_finite_element_4() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_finite_element_3()
+  ~stokes_finite_element_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 15;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -5401,16 +6910,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Mixed";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5419,8 +6942,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -5952,20 +7475,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -5974,7 +7495,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3; s++)
       {
         values[r*3 + s] = dof_values[s];
@@ -5982,21 +7503,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -6016,7 +7535,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -6028,7 +7547,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -6037,8 +7556,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -6136,7 +7655,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6287,7 +7806,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6438,7 +7957,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6589,7 +8108,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6740,7 +8259,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -6891,7 +8410,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7042,7 +8561,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7193,7 +8712,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7344,7 +8863,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7495,7 +9014,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7646,7 +9165,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -7797,7 +9316,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -8302,28 +9821,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -8359,7 +9876,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
         values[r*3*num_derivatives + s] = dof_values[s];
@@ -8367,22 +9884,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
@@ -8393,120 +9908,120 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 12:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 13:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
       }
     case 14:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[2];
         break;
@@ -8516,86 +10031,84 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[3];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[12] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[13] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[14] = vals[2];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -8611,41 +10124,154 @@ public:
     vertex_values[8] = dof_values[14];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_finite_element_3();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new stokes_finite_element_4();
+  }
+
+};
+
+
+class stokes_dofmap_0: public ufc::dofmap
+{
+public:
+
+  stokes_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~stokes_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  std::size_t num_element_dofs() const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 3;
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
-    switch (i)
+    switch (d)
     {
     case 0:
       {
-        return new stokes_finite_element_1();
+        return 1;
         break;
       }
     case 1:
       {
-        return new stokes_finite_element_2();
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
         break;
       }
     }
@@ -8653,41 +10279,133 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    return new stokes_finite_element_3();
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new stokes_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_0: public ufc::dofmap
+class stokes_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_0() : ufc::dofmap()
+  stokes_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_0()
+  ~stokes_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -8698,7 +10416,7 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -8711,50 +10429,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0] + num_global_entities[1];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -8767,25 +10474,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -8793,30 +10498,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
-      dofs[2] = 3;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 4;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 5;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -8837,16 +10544,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -8855,30 +10565,7 @@ public:
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
@@ -8890,71 +10577,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_0();
+    return new stokes_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_1: public ufc::dofmap
+class stokes_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_1() : ufc::dofmap()
+  stokes_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_1()
+  ~stokes_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -8978,50 +10653,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 2*num_global_entities[0] + 2*num_global_entities[1];
+    return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 6;
+    return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 2;
+        return 1;
         break;
       }
     case 1:
       {
-        return 2;
+        return 1;
         break;
       }
     case 2:
@@ -9034,33 +10698,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9069,9 +10723,6 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
-      dofs[3] = 7;
-      dofs[4] = 8;
-      dofs[5] = 9;
         break;
       }
     case 1:
@@ -9079,9 +10730,6 @@ public:
         dofs[0] = 0;
       dofs[1] = 2;
       dofs[2] = 4;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 10;
         break;
       }
     case 2:
@@ -9089,18 +10737,14 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 7;
-      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9121,19 +10765,16 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 8;
           break;
         }
       }
@@ -9152,19 +10793,16 @@ public:
       case 0:
         {
           dofs[0] = 3;
-        dofs[1] = 9;
           break;
         }
       case 1:
         {
           dofs[0] = 4;
-        dofs[1] = 10;
           break;
         }
       case 2:
         {
           dofs[0] = 5;
-        dofs[1] = 11;
           break;
         }
       }
@@ -9180,97 +10818,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 2;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new stokes_dofmap_0();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_1();
+    return new stokes_dofmap_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_2: public ufc::dofmap
+class stokes_dofmap_3: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_2() : ufc::dofmap()
+  stokes_dofmap_3() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_2()
+  ~stokes_dofmap_3() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9281,7 +10867,7 @@ public:
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -9294,50 +10880,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 0;
+        return 2;
         break;
       }
     case 2:
@@ -9350,19 +10925,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9370,27 +10957,38 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 7;
+      dofs[4] = 8;
+      dofs[5] = 9;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 10;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 5;
+      dofs[3] = 6;
+      dofs[4] = 7;
+      dofs[5] = 11;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9411,16 +11009,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 6;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 7;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 8;
           break;
         }
       }
@@ -9429,7 +11030,33 @@ public:
       }
     case 1:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 9;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 4;
+        dofs[1] = 10;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 5;
+        dofs[1] = 11;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -9441,65 +11068,59 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new stokes_dofmap_2();
+        break;
+      }
+    case 1:
+      {
+        return new stokes_dofmap_2();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_2();
+    return new stokes_dofmap_3();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class stokes_dofmap_3: public ufc::dofmap
+class stokes_dofmap_4: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  stokes_dofmap_3() : ufc::dofmap()
+  stokes_dofmap_4() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_dofmap_3()
+  ~stokes_dofmap_4() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None), **{'value_shape': (3,) })";
+    return "FFC dofmap for MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1))";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9523,39 +11144,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 15;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 8;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -9579,37 +11189,35 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[12] = offset + c.entity_indices[0][0];
-    dofs[13] = offset + c.entity_indices[0][1];
-    dofs[14] = offset + c.entity_indices[0][2];
+    dofs[12] = offset + entity_indices[0][0];
+    dofs[13] = offset + entity_indices[0][1];
+    dofs[14] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -9653,9 +11261,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -9738,61 +11345,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_dofmap_1();
+        return new stokes_dofmap_3();
         break;
       }
     case 1:
       {
-        return new stokes_dofmap_2();
+        return new stokes_dofmap_0();
         break;
       }
     }
@@ -9800,46 +11370,38 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new stokes_dofmap_3();
+    return new stokes_dofmap_4();
   }
 
 };
 
-/// 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_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   stokes_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~stokes_cell_integral_0_otherwise()
+  ~stokes_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    32
@@ -9848,7 +11410,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -9903,7 +11465,7 @@ public:
     A[15] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_0_1 + 0.166666666666668*G2_0_0 + 0.166666666666666*G2_0_1;
     A[16] = 0.5*G0_0_0 + 0.5*G2_0_0;
     A[17] = -0.166666666666666*G0_0_1 - 0.166666666666666*G2_0_1;
-    A[18] = 0.666666666666663*G0_0_1 + 0.666666666666663*G2_0_1;
+    A[18] = 0.666666666666664*G0_0_1 + 0.666666666666664*G2_0_1;
     A[19] = 0.0;
     A[20] = -0.666666666666667*G0_0_0 - 0.666666666666666*G0_0_1 - 0.666666666666667*G2_0_0 - 0.666666666666666*G2_0_1;
     A[21] = 0.0;
@@ -9931,9 +11493,9 @@ public:
     A[43] = 0.0;
     A[44] = -0.166666666666667*G4_1;
     A[45] = 0.0;
-    A[46] = 0.666666666666663*G0_1_0 + 0.666666666666663*G2_1_0;
+    A[46] = 0.666666666666664*G0_1_0 + 0.666666666666664*G2_1_0;
     A[47] = 0.666666666666666*G0_0_1 + 0.666666666666666*G2_0_1;
-    A[48] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333331*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666656*G2_0_1 + 0.666666666666656*G2_1_0 + 1.33333333333331*G2_1_1;
+    A[48] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333332*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666656*G2_0_1 + 0.666666666666656*G2_1_0 + 1.33333333333332*G2_1_1;
     A[49] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666656*G0_1_0 - 1.33333333333333*G2_0_0 - 0.666666666666659*G2_0_1 - 0.666666666666656*G2_1_0;
     A[50] = -0.666666666666665*G0_0_1 - 0.666666666666666*G0_1_0 - 1.33333333333332*G0_1_1 - 0.666666666666665*G2_0_1 - 0.666666666666666*G2_1_0 - 1.33333333333332*G2_1_1;
     A[51] = 0.0;
@@ -9950,7 +11512,7 @@ public:
     A[62] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_1 - 0.666666666666666*G2_0_1 - 0.666666666666665*G2_1_1;
     A[63] = -1.33333333333333*G0_0_0 - 0.666666666666656*G0_0_1 - 0.666666666666659*G0_1_0 - 1.33333333333333*G2_0_0 - 0.666666666666656*G2_0_1 - 0.666666666666659*G2_1_0;
     A[64] = 1.33333333333333*G0_0_0 + 0.666666666666659*G0_0_1 + 0.666666666666659*G0_1_0 + 1.33333333333333*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666659*G2_0_1 + 0.666666666666659*G2_1_0 + 1.33333333333333*G2_1_1;
-    A[65] = 0.666666666666665*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666665*G2_1_0;
+    A[65] = 0.666666666666665*G0_0_1 + 0.666666666666666*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666666*G2_1_0;
     A[66] = 0.0;
     A[67] = 0.0;
     A[68] = 0.0;
@@ -9964,7 +11526,7 @@ public:
     A[76] = -0.666666666666667*G0_0_0 - 0.666666666666666*G0_1_0 - 0.666666666666667*G2_0_0 - 0.666666666666666*G2_1_0;
     A[77] = 0.0;
     A[78] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_0 - 1.33333333333332*G0_1_1 - 0.666666666666666*G2_0_1 - 0.666666666666665*G2_1_0 - 1.33333333333332*G2_1_1;
-    A[79] = 0.666666666666665*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666665*G2_0_1 + 0.666666666666665*G2_1_0;
+    A[79] = 0.666666666666666*G0_0_1 + 0.666666666666665*G0_1_0 + 0.666666666666666*G2_0_1 + 0.666666666666665*G2_1_0;
     A[80] = 1.33333333333333*G0_0_0 + 0.666666666666667*G0_0_1 + 0.666666666666667*G0_1_0 + 1.33333333333333*G0_1_1 + 1.33333333333333*G2_0_0 + 0.666666666666667*G2_0_1 + 0.666666666666667*G2_1_0 + 1.33333333333333*G2_1_1;
     A[81] = 0.0;
     A[82] = 0.0;
@@ -9999,7 +11561,7 @@ public:
     A[111] = 0.166666666666668*G1_0_0 + 0.166666666666666*G1_0_1 + 0.166666666666668*G3_0_0 + 0.166666666666666*G3_0_1;
     A[112] = 0.5*G1_0_0 + 0.5*G3_0_0;
     A[113] = -0.166666666666666*G1_0_1 - 0.166666666666666*G3_0_1;
-    A[114] = 0.666666666666663*G1_0_1 + 0.666666666666663*G3_0_1;
+    A[114] = 0.666666666666664*G1_0_1 + 0.666666666666664*G3_0_1;
     A[115] = 0.0;
     A[116] = -0.666666666666667*G1_0_0 - 0.666666666666666*G1_0_1 - 0.666666666666667*G3_0_0 - 0.666666666666666*G3_0_1;
     A[117] = 0.0;
@@ -10027,9 +11589,9 @@ public:
     A[139] = 0.0;
     A[140] = 0.0;
     A[141] = 0.0;
-    A[142] = 0.666666666666663*G1_1_0 + 0.666666666666663*G3_1_0;
+    A[142] = 0.666666666666664*G1_1_0 + 0.666666666666664*G3_1_0;
     A[143] = 0.666666666666666*G1_0_1 + 0.666666666666666*G3_0_1;
-    A[144] = 1.33333333333333*G1_0_0 + 0.666666666666656*G1_0_1 + 0.666666666666656*G1_1_0 + 1.33333333333331*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666656*G3_0_1 + 0.666666666666656*G3_1_0 + 1.33333333333331*G3_1_1;
+    A[144] = 1.33333333333333*G1_0_0 + 0.666666666666656*G1_0_1 + 0.666666666666656*G1_1_0 + 1.33333333333332*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666656*G3_0_1 + 0.666666666666656*G3_1_0 + 1.33333333333332*G3_1_1;
     A[145] = -1.33333333333333*G1_0_0 - 0.666666666666659*G1_0_1 - 0.666666666666656*G1_1_0 - 1.33333333333333*G3_0_0 - 0.666666666666659*G3_0_1 - 0.666666666666656*G3_1_0;
     A[146] = -0.666666666666665*G1_0_1 - 0.666666666666666*G1_1_0 - 1.33333333333332*G1_1_1 - 0.666666666666665*G3_0_1 - 0.666666666666666*G3_1_0 - 1.33333333333332*G3_1_1;
     A[147] = -0.166666666666666*G5_0 - 0.166666666666665*G5_1;
@@ -10046,7 +11608,7 @@ public:
     A[158] = -0.666666666666666*G1_0_1 - 0.666666666666665*G1_1_1 - 0.666666666666666*G3_0_1 - 0.666666666666665*G3_1_1;
     A[159] = -1.33333333333333*G1_0_0 - 0.666666666666656*G1_0_1 - 0.666666666666659*G1_1_0 - 1.33333333333333*G3_0_0 - 0.666666666666656*G3_0_1 - 0.666666666666659*G3_1_0;
     A[160] = 1.33333333333333*G1_0_0 + 0.666666666666659*G1_0_1 + 0.666666666666659*G1_1_0 + 1.33333333333333*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666659*G3_0_1 + 0.666666666666659*G3_1_0 + 1.33333333333333*G3_1_1;
-    A[161] = 0.666666666666665*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666665*G3_1_0;
+    A[161] = 0.666666666666665*G1_0_1 + 0.666666666666666*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666666*G3_1_0;
     A[162] = 0.166666666666666*G5_0 - 0.166666666666668*G5_1;
     A[163] = 0.166666666666666*G5_0;
     A[164] = 0.333333333333333*G5_0 + 0.166666666666665*G5_1;
@@ -10060,7 +11622,7 @@ public:
     A[172] = -0.666666666666667*G1_0_0 - 0.666666666666666*G1_1_0 - 0.666666666666667*G3_0_0 - 0.666666666666666*G3_1_0;
     A[173] = 0.0;
     A[174] = -0.666666666666666*G1_0_1 - 0.666666666666665*G1_1_0 - 1.33333333333332*G1_1_1 - 0.666666666666666*G3_0_1 - 0.666666666666665*G3_1_0 - 1.33333333333332*G3_1_1;
-    A[175] = 0.666666666666665*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666665*G3_0_1 + 0.666666666666665*G3_1_0;
+    A[175] = 0.666666666666666*G1_0_1 + 0.666666666666665*G1_1_0 + 0.666666666666666*G3_0_1 + 0.666666666666665*G3_1_0;
     A[176] = 1.33333333333333*G1_0_0 + 0.666666666666667*G1_0_1 + 0.666666666666667*G1_1_0 + 1.33333333333333*G1_1_1 + 1.33333333333333*G3_0_0 + 0.666666666666667*G3_0_1 + 0.666666666666667*G3_1_0 + 1.33333333333333*G3_1_1;
     A[177] = -0.166666666666667*G5_0 + 0.166666666666667*G5_1;
     A[178] = 0.166666666666667*G5_0 + 0.333333333333333*G5_1;
@@ -10114,38 +11676,31 @@ public:
 
 };
 
-/// 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_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   stokes_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~stokes_cell_integral_1_otherwise()
+  ~stokes_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    12
@@ -10154,7 +11709,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -10198,77 +11753,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stokes_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   stokes_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_form_0()
+  ~stokes_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "2ca12cf2343acd77a159a07a20dd1b62bdc1e989e6036a51251be61baa158b2ec86a626227b655bb7061939e283213fab1381290d0f72b150781fc69da751815";
+    return "d3c026511bdd1385b4e56ecc3f19da83d51fc4835731379661f208f56373a6eb2aecc4fbaeee664e1985f9edf441e81caaaf18386ced3b609c580bf47b6aaf8a";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_finite_element_3();
+        return new stokes_finite_element_4();
         break;
       }
     case 1:
       {
-        return new stokes_finite_element_3();
+        return new stokes_finite_element_4();
         break;
       }
     }
@@ -10276,19 +11823,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_dofmap_3();
+        return new stokes_dofmap_4();
         break;
       }
     case 1:
       {
-        return new stokes_dofmap_3();
+        return new stokes_dofmap_4();
         break;
       }
     }
@@ -10296,203 +11842,231 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stokes_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class stokes_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   stokes_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~stokes_form_1()
+  ~stokes_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "43676e2f137cfd4188bb548b1833d00983af00f41426b57e72b0c804401a25e71490a10707082871d12911dbde6adff36393f8da1e94dc3611db8fa1800a19f3";
+    return "e13c435cc005a4412da38ee23ad0d3cf6d5098c580cd3a1faeeb8bfa2177ce6cc5ee82811668cce1fb7d26742e62ef02e5acae25c4ae5d926278f948d0096626";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new stokes_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new stokes_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_finite_element_3();
+        return new stokes_finite_element_4();
         break;
       }
     case 1:
       {
-        return new stokes_finite_element_1();
+        return new stokes_finite_element_3();
         break;
       }
     }
@@ -10500,19 +12074,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new stokes_dofmap_3();
+        return new stokes_dofmap_4();
         break;
       }
     case 1:
       {
-        return new stokes_dofmap_1();
+        return new stokes_dofmap_3();
         break;
       }
     }
@@ -10520,126 +12093,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new stokes_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -10653,14 +12262,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Stokes
 {
@@ -10669,43 +12284,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_3>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_3>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_3>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -10716,43 +12308,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -10763,63 +12332,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -10827,7 +12403,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_0());
+    _ufc_form = std::make_shared<const stokes_form_0>();
   }
 
   // Destructor
@@ -10857,57 +12433,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new stokes_finite_element_3()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new stokes_dofmap_3()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<stokes_finite_element_4>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<stokes_dofmap_4>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -10915,69 +12546,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    _ufc_form = std::make_shared<const stokes_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    _ufc_form = std::make_shared<const stokes_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new stokes_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -11009,18 +12681,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/multimesh-stokes/cpp/compile.log b/demo/undocumented/multimesh-stokes/cpp/compile.log
index 6f988fa..4ab251d 100644
--- a/demo/undocumented/multimesh-stokes/cpp/compile.log
+++ b/demo/undocumented/multimesh-stokes/cpp/compile.log
@@ -1,21 +1,25 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form MultiMeshStokes
 
 Compiler stage 1: Analyzing form(s)
 -----------------------------------
   
-  Geometric dimension:         2
-  Number of cell subdomains:   0
-  Number of custom subdomains: 3
-  Rank:                        2
-  Arguments:                   '(v_0, v_1)'
-  Number of coefficients:      0
-  Coefficients:                '[]'
-  Unique elements:             'Mixed<Vector<2 x CG2(?)>, CG1(?)>'
-  Unique sub elements:         'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)
-                               >, CG1(?), CG2(?)'
+  Geometric dimension:            2
+  Number of cell subdomains:      0
+  Number of cutcell subdomains:   0
+  Number of interface subdomains: 0
+  Number of overlap subdomains:   0
+  Rank:                           2
+  Arguments:                      '(v_0, v_1)'
+  Number of coefficients:         0
+  Coefficients:                   '[]'
+  Unique elements:                'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1
+                                  (?)>'
+  Unique sub elements:            'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1
+                                  (?)>, Vector<2 x CG2(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -53,36 +57,36 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
-  
-  Geometric dimension:         2
-  Number of cell subdomains:   0
-  Number of custom subdomains: 1
-  Rank:                        1
-  Arguments:                   '(v_0)'
-  Number of coefficients:      1
-  Coefficients:                '[w_0]'
-  Unique elements:             'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)
-                               >'
-  Unique sub elements:         'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)
-                               >, CG1(?), CG2(?)'
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
+  
+  Geometric dimension:          2
+  Number of cell subdomains:    0
+  Number of cutcell subdomains: 0
+  Rank:                         1
+  Arguments:                    '(v_0)'
+  Number of coefficients:       1
+  Coefficients:                 '[w_0]'
+  Unique elements:              'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?
+                                )>, Vector<2 x CG1(?)>'
+  Unique sub elements:          'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?
+                                )>, Vector<2 x CG1(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -97,18 +101,25 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
+  quadrature_rule:   auto --> default
   quadrature_degree: auto --> 4
+  quadrature_degree: 4
+  Estimated cost of tensor representation: -1
+  representation:    auto --> quadrature
   quadrature_rule:   auto --> default
-  representation:    quadrature
-  quadrature_degree: 3
-  quadrature_rule:   default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.168046 seconds.
+Compiler stage 1 finished in 0.280428 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -117,10 +128,16 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Computing representation of 5 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -160,7 +177,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00167 seconds
+  900 entries computed in 0.0013 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -169,7 +186,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00156 seconds
+  900 entries computed in 0.00125 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -178,7 +195,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00154 seconds
+  900 entries computed in 0.00125 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -187,7 +204,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00162 seconds
+  900 entries computed in 0.00123 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -196,7 +213,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00155 seconds
+  450 entries computed in 0.0012 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -205,7 +222,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00154 seconds
+  450 entries computed in 0.00119 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -214,7 +231,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00146 seconds
+  450 entries computed in 0.00118 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -223,7 +240,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00154 seconds
+  450 entries computed in 0.00132 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -231,31 +248,32 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
+  Reusing element from cache
   Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {None: {MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): [[[], [], []]], (1, 0): [[[], [], []]], (0, 0): [[[], [], []]]}}}}}
+  {None: {MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): [[[], [], []]], (0, 0): [[[], [], []]], (1, 1): [[[], [], []]], (2, 0): [[[], [], []]], (1, 0): [[[], [], []]], (0, 2): [[[], [], []]]}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
+  {'FE0_C1_D02': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D02': array([], shape=(0, 1), dtype=float64), 'FE [...]
   
-  tables: {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
+  tables: {'FE0_C1_D02': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D02': array([], shape=(0, 1), dtype=float [...]
   
   name_map: {}
   
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE0_C2_D10': 'FE0_C2_D10', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE0_C2_D01': 'FE0_C2_D01', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE0_C1_D02': 'FE0_C1_D02', 'FE0_C1_D01': 'FE0_C1_D01', 'FE0_C1_D20': 'FE0_C1_D20', 'FE0_C2_D11': 'FE0_C2_D11', 'FE0_C2_D10': 'FE0_C2_D10', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C1_D11': 'FE0_C1_D11', 'FE0_C0_D02': 'FE0_C0_D02', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C2_D20': 'FE0_C2_D20', 'FE0_C0_D01': 'FE0_C0_D01', 'FE0_C0_D20': 'FE0_C0_D20', 'FE0_C2_D01': 'FE0_C2_D01', 'FE0_C2_D02': 'FE0_C2_D02', 'FE0_C0_D11': 'FE0_C0_D11', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
   
   QG-utils, psi_tables, unique_tables:
-  {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
+  {'FE0_C1_D02': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D02': array([], shape=(0, 1), dtype=float64), 'FE [...]
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C1_D01', (), False, False), 'FE0_C2_D10': ('FE0_C2_D10', (), False, False), 'FE0_C1_D10': ('FE0_C1_D10', (), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (), False, False), 'FE0_C2_D01': ('FE0_C2_D01', (), False, False), 'FE0_C2': ('FE0_C2', (), False, False), 'FE0_C1': ('FE0_C1', (), False, False), 'FE0_C0': ('FE0_C0', (), False, False)}
+  {'FE0_C1_D02': ('FE0_C1_D02', (), False, False), 'FE0_C1_D01': ('FE0_C1_D01', (), False, False), 'FE0_C1_D20': ('FE0_C1_D20', (), False, False), 'FE0_C2_D11': ('FE0_C2_D11', (), False, False), 'FE0_C2_D10': ('FE0_C2_D10', (), False, False), 'FE0_C1_D10': ('FE0_C1_D10', (), False, False), 'FE0_C1_D11': ('FE0_C1_D11', (), False, False), 'FE0_C0_D02': ('FE0_C0_D02', (), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (), False, False), 'FE0_C2_D20': ('FE0_C2_D20', (), False, False), 'FE0_C0_D [...]
   Transforming custom integral
   Reusing element from cache
   Reusing element from cache
@@ -278,16 +296,40 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
+  Reusing element from cache
   Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {None: {MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): [[[], [], []]], (1, 0): [[[], [], []]], (0, 0): [[[], [], []]]}}}}}
+  {None: {MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): [[[], [], []]], (1, 0): [[[], [], []]], (0, 0): [[[], [], []]]}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
@@ -363,14 +405,14 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
+  Reusing element from cache
   Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {None: {MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): [[[], [], []]], (1, 0): [[[], [], []]], (0, 0): [[[], [], []]]}}}}}
+  {None: {MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): [[[], [], []]], (1, 0): [[[], [], []]], (0, 0): [[[], [], []]]}}}}}
   
   QG-utils, psi_tables, flat_tables:
   {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
@@ -434,7 +476,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  180 entries computed in 0.00178 seconds
+  180 entries computed in 0.00164 seconds
   Shape of reference tensor: (15, 12)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -444,7 +486,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  180 entries computed in 0.00179 seconds
+  180 entries computed in 0.00153 seconds
   Shape of reference tensor: (15, 12)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -453,32 +495,33 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   
   QG-utils, psi_tables:
-  {None: {MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 0): [[[], [], []]]}}}, VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, dim=2, quad_scheme=None): {None: {None: {(0, 0): [[[], []]]}}}}}
+  {None: {MixedElement(VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2), FiniteElement('Lagrange', triangle, 1)): {None: {None: {(0, 1): [[[], [], []]], (0, 0): [[[], [], []]], (1, 1): [[[], [], []]], (2, 0): [[[], [], []]], (1, 0): [[[], [], []]], (0, 2): [[[], [], []]]}}}, VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2): {None: {None: {(0, 0): [[[], []]]}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE1_C0': array([], shape=(0, 1), dtype=float64), 'FE1_C1': array([], shape=(0, 1), dtype=float64), 'FE1_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
+  {'FE0_C1_D02': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE1_C0': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C0 [...]
   
-  tables: {'FE1_C0': array([], shape=(0, 1), dtype=float64), 'FE1_C1': array([], shape=(0, 1), dtype=float64), 'FE1_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
+  tables: {'FE0_C1_D02': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE1_C0': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D20': array([], shape=(0, 1), dtype=float64), [...]
   
   name_map: {}
   
-  inv_name_map: {'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  inv_name_map: {'FE0_C1_D02': 'FE0_C1_D02', 'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE1_C0', 'FE0_C1_D20': 'FE0_C1_D20', 'FE0_C2_D11': 'FE0_C2_D11', 'FE0_C2_D10': 'FE0_C2_D10', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C1_D11': 'FE0_C1_D11', 'FE0_C0_D02': 'FE0_C0_D02', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C2_D20': 'FE0_C2_D20', 'FE0_C0_D01': 'FE0_C0_D01', 'FE0_C0_D20': 'FE0_C0_D20', 'FE0_C2_D01': 'FE0_C2_D01', 'FE0_C2_D02': 'FE0_C2_D02', 'FE1_C1': 'FE1_C1', 'FE0_C0_D11': 'FE0_C0_D11', 'FE0_C2': 'FE0_ [...]
   
   QG-utils, psi_tables, unique_tables:
-  {'FE1_C0': array([], shape=(0, 1), dtype=float64), 'FE1_C1': array([], shape=(0, 1), dtype=float64), 'FE1_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
+  {'FE0_C1_D02': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE1_C0': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C0 [...]
   
   QG-utils, psi_tables, name_map:
-  {'FE1_C0': ('FE1_C0', (), False, False), 'FE1_C1': ('FE1_C1', (), False, False), 'FE1_C2': ('FE1_C2', (), False, False), 'FE0_C1': ('FE0_C1', (), False, False), 'FE0_C0': ('FE0_C0', (), False, False)}
+  {'FE0_C1_D02': ('FE0_C1_D02', (), False, False), 'FE0_C1_D01': ('FE0_C1_D01', (), False, False), 'FE1_C0': ('FE1_C0', (), False, False), 'FE0_C1_D20': ('FE0_C1_D20', (), False, False), 'FE0_C2_D11': ('FE0_C2_D11', (), False, False), 'FE0_C2_D10': ('FE0_C2_D10', (), False, False), 'FE0_C1_D10': ('FE0_C1_D10', (), False, False), 'FE0_C1_D11': ('FE0_C1_D11', (), False, False), 'FE0_C0_D02': ('FE0_C0_D02', (), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (), False, False), 'FE0_C2_D20': ('F [...]
   Transforming custom integral
   Reusing element from cache
   Reusing element from cache
@@ -490,481 +533,81 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.085443 seconds.
+Compiler stage 2 finished in 0.109273 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.00018692 seconds.
+Compiler stage 3 finished in 0.000211 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Generating code for 5 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
-  Removing unused variable: circumradius
-  Removing unused variable: v0v1
-  Removing unused variable: v0v2
-  Removing unused variable: v1v2
-  Removing unused variable: volume
   Removing unused variable: circumradius_1
   Removing unused variable: v0v1_1
   Removing unused variable: v0v2_1
@@ -975,40 +618,26 @@ Compiler stage 4: Generating code
   Removing unused variable: v0v2_0
   Removing unused variable: v1v2_0
   Removing unused variable: volume_0
-  Removing unused variable: circumradius_1
-  Removing unused variable: v0v1_1
-  Removing unused variable: v0v2_1
-  Removing unused variable: v1v2_1
-  Removing unused variable: volume_1
-  Removing unused variable: circumradius_0
-  Removing unused variable: v0v1_0
-  Removing unused variable: v0v2_0
-  Removing unused variable: v1v2_0
-  Removing unused variable: volume_0
-  Removing unused variable: circumradius
-  Removing unused variable: v0v1
-  Removing unused variable: v0v2
-  Removing unused variable: v1v2
-  Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.424748 seconds.
+Compiler stage 4 finished in 0.697197 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.00058198 seconds.
+Compiler stage 4.1 finished in 0.00128889 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./MultiMeshStokes.h.
-Compiler stage 5 finished in 0.00114799 seconds.
+Compiler stage 5 finished in 0.00159502 seconds.
 
-FFC finished in 0.680505 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 1.09069 seconds.
+Output written to ./MultiMeshStokes.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Stokes
 
@@ -1021,9 +650,9 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>'
-  Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)>,
-                              CG1(?), CG2(?)'
+  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1(?)>'
+  Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG1(?)>,
+                              Vector<2 x CG2(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1061,9 +690,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 3
-  quadrature_degree: auto --> 3
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 3
+  quadrature_degree: 3
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -1071,9 +700,10 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)>'
+  Unique elements:           'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)>,
+                              Vector<2 x CG1(?)>'
   Unique sub elements:       'Mixed<Vector<2 x CG2(?)>, CG1(?)>, Vector<2 x CG2(?)>,
-                              CG1(?), CG2(?)'
+                              Vector<2 x CG1(?)>, CG1(?), CG2(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1088,15 +718,18 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.105073 seconds.
+Compiler stage 1 finished in 0.224803 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 4 elements
+  Computing representation of 5 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
@@ -1105,11 +738,19 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 4 dofmaps
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Computing representation of 5 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -1148,7 +789,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00134 seconds
+  900 entries computed in 0.00142 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -1157,7 +798,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00124 seconds
+  900 entries computed in 0.0013 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -1166,7 +807,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00124 seconds
+  900 entries computed in 0.00147 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -1175,7 +816,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.00124 seconds
+  900 entries computed in 0.00252 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -1184,7 +825,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00119 seconds
+  450 entries computed in 0.00148 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -1193,7 +834,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.00121 seconds
+  450 entries computed in 0.0017 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -1202,7 +843,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.0012 seconds
+  450 entries computed in 0.00146 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -1211,7 +852,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  450 entries computed in 0.0012 seconds
+  450 entries computed in 0.00156 seconds
   Shape of reference tensor: (15, 15, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -1219,6 +860,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -1233,7 +875,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  180 entries computed in 0.00149 seconds
+  180 entries computed in 0.00174 seconds
   Shape of reference tensor: (15, 12)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -1243,7 +885,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  180 entries computed in 0.00148 seconds
+  180 entries computed in 0.00178 seconds
   Shape of reference tensor: (15, 12)
   Primary multi index:   rank = 1 dims = [15] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14]]
   Secondary multi index: rank = 1 dims = [12] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11]]
@@ -1252,490 +894,84 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0329821 seconds.
+Compiler stage 2 finished in 0.0471201 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000147104 seconds.
+Compiler stage 3 finished in 0.000224113 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 4 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Generating code for 5 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 4 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 5 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.382806 seconds.
+Compiler stage 4 finished in 0.540751 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000581026 seconds.
+Compiler stage 4.1 finished in 0.000679016 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Stokes.h.
-Compiler stage 5 finished in 0.001019 seconds.
+Compiler stage 5 finished in 0.000924826 seconds.
 
-FFC finished in 0.522917 seconds.
+FFC finished in 0.814984 seconds.
+Output written to ./Stokes.h.
diff --git a/demo/undocumented/multimesh-stokes/cpp/main.cpp b/demo/undocumented/multimesh-stokes/cpp/main.cpp
index 6d0d6c1..554090b 100644
--- a/demo/undocumented/multimesh-stokes/cpp/main.cpp
+++ b/demo/undocumented/multimesh-stokes/cpp/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Anders Logg
+// Copyright (C) 2014-2015 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2014-06-10
-// Last changed: 2014-06-17
+// Last changed: 2016-03-02
 //
 // This demo program solves the Stokes equations on a domain defined
 // by three overlapping and non-matching meshes.
@@ -25,15 +25,7 @@
 #include "MultiMeshStokes.h"
 
 using namespace dolfin;
-
-// Sub domain for Dirichlet boundary condition
-class DirichletBoundary : public SubDomain
-{
-  bool inside(const Array<double>& x, bool on_boundary) const
-  {
-    return on_boundary;
-  }
-};
+using std::make_shared;
 
 // Value for inflow boundary condition for velocity
 class InflowValue : public Expression
@@ -50,15 +42,6 @@ public:
 
 };
 
-// Subdomain for no-slip boundary
-class NoslipBoundary : public SubDomain
-{
-  bool inside(const Array<double>& x, bool on_boundary) const
-  {
-    return on_boundary && (near(x[1], 0.0) || near(x[1], 1.0));
-  }
-};
-
 // Subdomain for inflow boundary
 class InflowBoundary : public SubDomain
 {
@@ -77,15 +60,15 @@ class OutflowBoundary : public SubDomain
   }
 };
 
-class AllDomain : public SubDomain
+// Subdomain for no-slip boundary
+class NoslipBoundary : public SubDomain
 {
   bool inside(const Array<double>& x, bool on_boundary) const
   {
-    return true;
+    return on_boundary && (near(x[1], 0.0) || near(x[1], 1.0));
   }
 };
 
-
 int main(int argc, char* argv[])
 {
   if (dolfin::MPI::size(MPI_COMM_WORLD) > 1)
@@ -94,102 +77,70 @@ int main(int argc, char* argv[])
     return 0;
   }
 
-  // FIXME: Testing
-  //set_log_level(DBG);
-  parameters["reorder_dofs_serial"] = false;
-
   // Create meshes
-  int N = 32;
-  UnitSquareMesh mesh_0(N, N);
-  RectangleMesh  mesh_1(Point(0.2, 0.2), Point(0.6, 0.6), N, N);
-  RectangleMesh  mesh_2(Point(0.4, 0.4), Point(0.8, 0.8), N, N);
+  auto mesh_0 = make_shared<UnitSquareMesh>(16, 16);
+  auto mesh_1 = make_shared<RectangleMesh>(Point(0.2, 0.2), Point(0.6, 0.6), 8, 8);
+  auto mesh_2 = make_shared<RectangleMesh>(Point(0.4, 0.4), Point(0.8, 0.8), 8, 8);
 
-  // Create function spaces
-  MultiMeshStokes::FunctionSpace W0(mesh_0);
-  MultiMeshStokes::FunctionSpace W1(mesh_1);
-  MultiMeshStokes::FunctionSpace W2(mesh_2);
+  // Build multimesh
+  auto multimesh = make_shared<MultiMesh>();
+  multimesh->add(mesh_0);
+  multimesh->add(mesh_1);
+  multimesh->add(mesh_2);
+  multimesh->build();
 
-  // FIXME: Some of this stuff may be wrapped or automated later to
-  // avoid needing to explicitly call add() and build()
+  // Create function space
+  auto W = make_shared<MultiMeshStokes::MultiMeshFunctionSpace>(multimesh);
 
   // Create forms
-  MultiMeshStokes::BilinearForm a0(W0, W0);
-  MultiMeshStokes::BilinearForm a1(W1, W1);
-  MultiMeshStokes::BilinearForm a2(W2, W2);
-  MultiMeshStokes::LinearForm L0(W0);
-  MultiMeshStokes::LinearForm L1(W1);
-  MultiMeshStokes::LinearForm L2(W2);
-
-  // Build multimesh function space
-  MultiMeshFunctionSpace W;
-  W.parameters("multimesh")["quadrature_order"] = 2;
-  W.add(W0);
-  W.add(W1);
-  W.add(W2);
-  W.build();
-
-  // Set coefficients
-  Constant f(0, 0);
-  L0.f = f;
-  L1.f = f;
-  L2.f = f;
-
-  // Build multimesh forms
-  MultiMeshForm a(W, W);
-  MultiMeshForm L(W);
-  a.add(a0);
-  a.add(a1);
-  a.add(a2);
-  L.add(L0);
-  L.add(L1);
-  L.add(L2);
-  a.build();
-  L.build();
+  auto a = make_shared<MultiMeshStokes::MultiMeshBilinearForm>(W, W);
+  auto L = make_shared<MultiMeshStokes::MultiMeshLinearForm>(W);
+
+  // Attach coefficients
+  auto f = make_shared<Constant>(0, 0);
+  L->f = f;
+
+  // Assemble linear system
+  auto A = make_shared<Matrix>();
+  auto b = make_shared<Vector>();
+  assemble_multimesh(*A, *a);
+  assemble_multimesh(*b, *L);
 
   // Create boundary values
-  Constant noslip_value(0, 0);
-  InflowValue inflow_value;
-  Constant outflow_value(0);
+  auto inflow_value  = make_shared<InflowValue>();
+  auto outflow_value = make_shared<Constant>(0);
+  auto noslip_value  = make_shared<Constant>(0, 0);
 
   // Create subdomains for boundary conditions
-  NoslipBoundary noslip_boundary;
-  InflowBoundary inflow_boundary;
-  OutflowBoundary outflow_boundary;
+  auto inflow_boundary  = make_shared<InflowBoundary>();
+  auto outflow_boundary = make_shared<OutflowBoundary>();
+  auto noslip_boundary  = make_shared<NoslipBoundary>();
 
   // Create subspaces for boundary conditions
-  MultiMeshSubSpace V(W, 0);
-  MultiMeshSubSpace Q(W, 1);
+  auto V = make_shared<MultiMeshSubSpace>(*W, 0);
+  auto Q = make_shared<MultiMeshSubSpace>(*W, 1);
 
   // Create boundary conditions
-  MultiMeshDirichletBC bc0(V, noslip_value,  noslip_boundary);
-  MultiMeshDirichletBC bc1(V, inflow_value,  inflow_boundary);
-  MultiMeshDirichletBC bc2(Q, outflow_value, outflow_boundary);
-
-  // Assemble linear system
-  Matrix A;
-  Vector b;
-  MultiMeshAssembler assembler;
-  assembler.assemble(A, a);
-  assembler.assemble(b, L);
+  auto bc0 = make_shared<MultiMeshDirichletBC>(V, noslip_value,  noslip_boundary);
+  auto bc1 = make_shared<MultiMeshDirichletBC>(V, inflow_value,  inflow_boundary);
+  auto bc2 = make_shared<MultiMeshDirichletBC>(Q, outflow_value, outflow_boundary);
 
   // Apply boundary conditions
-  bc0.apply(A, b);
-  bc1.apply(A, b);
-  bc2.apply(A, b);
+  bc0->apply(*A, *b);
+  bc1->apply(*A, *b);
+  bc2->apply(*A, *b);
 
   // Compute solution
   MultiMeshFunction w(W);
-  solve(A, *w.vector(), b);
-
-  /*
+  solve(*A, *w.vector(), *b);
 
-  // Extract solution parts and components
-  Function u0 = (*w.part(0))[0];
-  Function u1 = (*w.part(1))[0];
-  Function u2 = (*w.part(2))[0];
-  Function p0 = (*w.part(0))[1];
-  Function p1 = (*w.part(1))[1];
-  Function p2 = (*w.part(2))[1];
+  // Extract solution components
+  Function& u0 = (*w.part(0))[0];
+  Function& u1 = (*w.part(1))[0];
+  Function& u2 = (*w.part(2))[0];
+  Function& p0 = (*w.part(0))[1];
+  Function& p1 = (*w.part(1))[1];
+  Function& p2 = (*w.part(2))[1];
 
   // Save to file
   File u0_file("u0.pvd");
@@ -206,32 +157,13 @@ int main(int argc, char* argv[])
   p2_file << p2;
 
   // Plot solution
-  plot(W.multimesh());
+  plot(W->multimesh());
   plot(u0, "u_0");
   plot(u1, "u_1");
   plot(u2, "u_2");
   plot(p0, "p_0");
   plot(p1, "p_1");
   plot(p2, "p_2");
-
-  */
-
-  // FIXME: Temporary fix until extraction of subdofmaps works
-  AllDomain all_domain;
-  Constant c(0);
-  MultiMeshDirichletBC bc(Q, c, all_domain);
-  bc.apply(*w.vector());
-  plot(w.part(0), "u_0");
-  plot(w.part(1), "u_1");
-  plot(w.part(2), "u_2");
-  plot(W.multimesh());
-  File u0_file("u0.pvd");
-  File u1_file("u1.pvd");
-  File u2_file("u2.pvd");
-  u0_file << *w.part(0);
-  u1_file << *w.part(1);
-  u2_file << *w.part(2);
-
   interactive();
 
   return 0;
diff --git a/demo/undocumented/multimesh-stokes/python/demo_multimesh-stokes.py b/demo/undocumented/multimesh-stokes/python/demo_multimesh-stokes.py
new file mode 100644
index 0000000..e20540f
--- /dev/null
+++ b/demo/undocumented/multimesh-stokes/python/demo_multimesh-stokes.py
@@ -0,0 +1,167 @@
+# Copyright (C) 2015 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2015-11-11
+# Last changed: 2015-11-24
+#
+# This demo program solves the Stokes equations on a domain defined
+# by three overlapping and non-matching meshes.
+
+from dolfin import *
+
+class InflowBoundary(SubDomain):
+    def inside(self, x, on_boundary):
+        return on_boundary and near(x[0], 0.0)
+
+class OutflowBoundary(SubDomain):
+    def inside(self, x, on_boundary):
+        return on_boundary and near(x[0], 1.0)
+
+class NoslipBoundary(SubDomain):
+    def inside(self, x, on_boundary):
+        return on_boundary and (near(x[1], 0.0) or near(x[1], 1.0))
+
+if MPI.size(mpi_comm_world()) > 1:
+    info("Sorry, this demo does not (yet) run in parallel.")
+    exit(0)
+
+# Create meshes
+mesh_0 = UnitSquareMesh(16, 16)
+mesh_1 = RectangleMesh(Point(0.2, 0.2), Point(0.6, 0.6), 8, 8)
+mesh_2 = RectangleMesh(Point(0.4, 0.4), Point(0.8, 0.8), 8, 8)
+
+# Build multimesh
+multimesh = MultiMesh()
+multimesh.add(mesh_0)
+multimesh.add(mesh_1)
+multimesh.add(mesh_2)
+multimesh.build()
+
+# FIXME: Tensor algebra not supported for multimesh function spaces
+
+# Create function space
+P2 = VectorElement("Lagrange", triangle, 2)
+P1 = FiniteElement("Lagrange", triangle, 1)
+TH = P2 * P1
+W  = MultiMeshFunctionSpace(multimesh, TH)
+
+# Define trial and test functions and right-hand side
+u = TrialFunction(W)
+v = TestFunction(W)
+f = Constant((0, 0))
+
+# Define trial and test functions and right-hand side
+(u, p) = TrialFunctions(W)
+(v, q) = TestFunctions(W)
+
+# Define facet normal and mesh size
+n = FacetNormal(multimesh)
+h = 2.0*Circumradius(multimesh)
+
+# Parameters
+alpha = 4.0
+
+def tensor_jump(v, n):
+    return outer(v('+'), n('+')) + outer(v('-'), n('-'))
+
+def a_h(v, w):
+    return inner(grad(v), grad(w))*dX \
+         - inner(avg(grad(v)), tensor_jump(w, n))*dI \
+         - inner(avg(grad(w)), tensor_jump(v, n))*dI \
+         + alpha/avg(h) * inner(jump(v), jump(w))*dI
+
+def b_h(v, q):
+    return -div(v)*q*dX + jump(v, n)*avg(q)*dI
+
+def l_h(v, q, f):
+    return inner(f, v)*dX
+
+def s_O(v, w):
+    return inner(jump(grad(v)), jump(grad(w)))*dO
+
+def s_C(v, q, w, r):
+    return h*h*inner(-div(grad(v)) + grad(q), -div(grad(w)) - grad(r))*dC
+
+def l_C(v, q, f):
+    return h*h*inner(f, -div(grad(v)) - grad(q))*dC
+
+# Define bilinear form
+a = a_h(u, v) + b_h(v, p) + b_h(u, q) + s_O(u, v) + s_C(u, p, v, q)
+
+# Define linear form
+L  = l_h(v, q, f) + l_C(v, q, f)
+
+# Assemble linear system
+A = assemble_multimesh(a)
+b = assemble_multimesh(L)
+
+# Create boundary values
+inflow_value = Expression(("sin(x[1]*DOLFIN_PI)", "0.0"), degree=2)
+outflow_value = Constant(0)
+noslip_value = Constant((0, 0))
+
+# Create subdomains for boundary conditions
+inflow_boundary = InflowBoundary()
+outflow_boundary = OutflowBoundary()
+noslip_boundary = NoslipBoundary()
+
+# Create subspaces for boundary conditions
+V = MultiMeshSubSpace(W, 0)
+Q = MultiMeshSubSpace(W, 1)
+
+# Create boundary conditions
+bc0 = MultiMeshDirichletBC(V, noslip_value,  noslip_boundary)
+bc1 = MultiMeshDirichletBC(V, inflow_value,  inflow_boundary)
+bc2 = MultiMeshDirichletBC(Q, outflow_value, outflow_boundary)
+
+# Apply boundary conditions
+bc0.apply(A, b)
+bc1.apply(A, b)
+bc2.apply(A, b)
+
+# Compute solution
+w = MultiMeshFunction(W)
+solve(A, w.vector(), b)
+
+# FIXME: w.part(i).split() not working for extracted parts
+# FIXME: since they are only dolfin::Functions
+
+# Extract solution components
+u0 = w.part(0).sub(0)
+u1 = w.part(1).sub(1)
+u2 = w.part(2).sub(0)
+p0 = w.part(0).sub(1)
+p1 = w.part(1).sub(0)
+p2 = w.part(2).sub(1)
+
+# Save to file
+File("u0.pvd") << u0
+File("u1.pvd") << u1
+File("u2.pvd") << u2
+File("p0.pvd") << p0
+File("p1.pvd") << p1
+File("p2.pvd") << p2
+
+# Plot solution
+plot(W.multimesh())
+plot(u0, title="u_0")
+plot(u1, title="u_1")
+plot(u2, title="u_2")
+plot(p0, title="p_0")
+plot(p1, title="p_1")
+plot(p2, title="p_2")
+interactive()
diff --git a/demo/undocumented/multistage-solver/python/demo_multistage-solver.py b/demo/undocumented/multistage-solver/python/demo_multistage-solver.py
index 6a90696..7ae86d7 100644
--- a/demo/undocumented/multistage-solver/python/demo_multistage-solver.py
+++ b/demo/undocumented/multistage-solver/python/demo_multistage-solver.py
@@ -77,7 +77,7 @@ vnorm = sqrt(dot(velocity, velocity))
 F -= h/(2.0*vnorm)*dot(velocity, grad(v))*r*dx
 
 # Set up boundary condition
-g = Expression("(t<=ramp_stop) ? t : 1.0", t=t, ramp_stop=1.0)
+g = Expression("(t<=ramp_stop) ? t : 1.0", t=t, ramp_stop=1.0, degeree=1)
 bc = DirichletBC(Q, g, sub_domains, 1)
 
 # Output file
diff --git a/demo/undocumented/nonmatching-interpolation/cpp/CMakeLists.txt b/demo/undocumented/nonmatching-interpolation/cpp/CMakeLists.txt
index 24e5ff5..168cbcd 100644
--- a/demo/undocumented/nonmatching-interpolation/cpp/CMakeLists.txt
+++ b/demo/undocumented/nonmatching-interpolation/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/nonmatching-interpolation/cpp/P1.h b/demo/undocumented/nonmatching-interpolation/cpp/P1.h
index 1053134..1dbe5da 100644
--- a/demo/undocumented/nonmatching-interpolation/cpp/P1.h
+++ b/demo/undocumented/nonmatching-interpolation/cpp/P1.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __P1_H
 #define __P1_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class p1_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   p1_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_finite_element_0()
+  ~p1_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,69 +902,55 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new p1_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class p1_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   p1_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_dofmap_0()
+  ~p1_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -985,39 +974,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1041,19 +1019,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1079,9 +1055,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -1132,32 +1107,18 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new p1_dofmap_0();
   }
@@ -1171,14 +1132,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace P1
 {
@@ -1187,43 +1154,20 @@ class FunctionSpace: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
diff --git a/demo/undocumented/nonmatching-interpolation/cpp/P3.h b/demo/undocumented/nonmatching-interpolation/cpp/P3.h
index 19756f9..0daa984 100644
--- a/demo/undocumented/nonmatching-interpolation/cpp/P3.h
+++ b/demo/undocumented/nonmatching-interpolation/cpp/P3.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __P3_H
 #define __P3_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class p3_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   p3_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p3_finite_element_0()
+  ~p3_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 10;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -563,20 +576,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -585,26 +596,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -624,7 +633,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -636,7 +645,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -645,8 +654,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -746,21 +755,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -921,21 +930,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1096,21 +1105,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1271,21 +1280,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1446,21 +1455,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1621,21 +1630,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1796,21 +1805,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1971,21 +1980,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2146,21 +2155,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2321,21 +2330,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2455,28 +2464,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2512,7 +2519,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -2520,22 +2527,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -2546,80 +2551,80 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 7:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 8:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 9:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -2629,66 +2634,64 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2696,69 +2699,69 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[8] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[9] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[10] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[11] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[15] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[18] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[19] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new p3_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class p3_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   p3_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p3_dofmap_0()
+  ~p3_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2782,39 +2785,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2838,30 +2830,28 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
+    dofs[3] = offset + 2*entity_indices[1][0];
+    dofs[4] = offset + 2*entity_indices[1][0] + 1;
+    dofs[5] = offset + 2*entity_indices[1][1];
+    dofs[6] = offset + 2*entity_indices[1][1] + 1;
+    dofs[7] = offset + 2*entity_indices[1][2];
+    dofs[8] = offset + 2*entity_indices[1][2] + 1;
     offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
+    dofs[9] = offset + entity_indices[2][0];
     offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2893,9 +2883,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2977,46 +2966,18 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new p3_dofmap_0();
   }
@@ -3030,14 +2991,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace P3
 {
@@ -3046,43 +3013,20 @@ class FunctionSpace: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p3_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p3_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p3_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p3_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p3_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p3_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p3_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
diff --git a/demo/undocumented/nonmatching-interpolation/cpp/compile.log b/demo/undocumented/nonmatching-interpolation/cpp/compile.log
index b6d8123..b31afe7 100644
--- a/demo/undocumented/nonmatching-interpolation/cpp/compile.log
+++ b/demo/undocumented/nonmatching-interpolation/cpp/compile.log
@@ -1,264 +1,116 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling element P3
 
-Compiler stage 1: Analyzing form(s)
------------------------------------
+Compiler stage 1: Analyzing elements(s)
+---------------------------------------
   
-Compiler stage 1 finished in 0.000178814 seconds.
+Compiler stage 1 finished in 0.000187874 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
   Computing representation of 1 elements
   Reusing element from cache
+  Reusing element from cache
   Computing representation of 1 dofmaps
   Reusing element from cache
+  Computing representation of 0 coordinate mappings
   Computing representation of integrals
   Computing representation of forms
   
-Compiler stage 2 finished in 0.175858 seconds.
+Compiler stage 2 finished in 0.27829 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000133038 seconds.
+Compiler stage 3 finished in 0.000135899 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 1 dofmap(s)
+  Generating code for 0 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.161191 seconds.
+Compiler stage 4 finished in 0.153818 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000211954 seconds.
+Compiler stage 4.1 finished in 0.000230074 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./P3.h.
-Compiler stage 5 finished in 0.000582218 seconds.
+Compiler stage 5 finished in 0.000413895 seconds.
 
-FFC finished in 0.338451 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.433404 seconds.
+Output written to ./P3.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling element P1
 
-Compiler stage 1: Analyzing form(s)
------------------------------------
+Compiler stage 1: Analyzing elements(s)
+---------------------------------------
   
-Compiler stage 1 finished in 0.000185966 seconds.
+Compiler stage 1 finished in 0.00022006 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
   Computing representation of 1 elements
   Reusing element from cache
+  Reusing element from cache
   Computing representation of 1 dofmaps
   Reusing element from cache
+  Computing representation of 0 coordinate mappings
   Computing representation of integrals
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0180981 seconds.
+Compiler stage 2 finished in 0.0368788 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000112057 seconds.
+Compiler stage 3 finished in 0.000140905 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 1 element(s)
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 1 dofmap(s)
+  Generating code for 0 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.027163 seconds.
+Compiler stage 4 finished in 0.0291729 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.00019908 seconds.
+Compiler stage 4.1 finished in 0.000222921 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./P1.h.
-Compiler stage 5 finished in 0.00046587 seconds.
+Compiler stage 5 finished in 0.000344992 seconds.
 
-FFC finished in 0.0464959 seconds.
+FFC finished in 0.0673251 seconds.
+Output written to ./P1.h.
diff --git a/demo/undocumented/nonmatching-interpolation/cpp/main.cpp b/demo/undocumented/nonmatching-interpolation/cpp/main.cpp
index 929114e..6b8ef34 100644
--- a/demo/undocumented/nonmatching-interpolation/cpp/main.cpp
+++ b/demo/undocumented/nonmatching-interpolation/cpp/main.cpp
@@ -43,12 +43,12 @@ public:
 int main()
 {
   // Create meshes
-  UnitSquareMesh mesh0(16, 16);
-  UnitSquareMesh mesh1(64, 64);
+  auto mesh0 = std::make_shared<UnitSquareMesh>(16, 16);
+  auto mesh1 = std::make_shared<UnitSquareMesh>(64, 64);
 
   // Create function spaces
-  P3::FunctionSpace V0(mesh0);
-  P1::FunctionSpace V1(mesh1);
+  auto V0 = std::make_shared<P3::FunctionSpace>(mesh0);
+  auto V1 = std::make_shared<P1::FunctionSpace>(mesh1);
 
   // Create functions
   Function f0(V0);
diff --git a/demo/undocumented/nonmatching-projection/cpp/CMakeLists.txt b/demo/undocumented/nonmatching-projection/cpp/CMakeLists.txt
index c909256..0c700b2 100644
--- a/demo/undocumented/nonmatching-projection/cpp/CMakeLists.txt
+++ b/demo/undocumented/nonmatching-projection/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/nonmatching-projection/cpp/P1_projection.h b/demo/undocumented/nonmatching-projection/cpp/P1_projection.h
index c18bebe..0a8cef8 100644
--- a/demo/undocumented/nonmatching-projection/cpp/P1_projection.h
+++ b/demo/undocumented/nonmatching-projection/cpp/P1_projection.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __P1_PROJECTION_H
 #define __P1_PROJECTION_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class p1_projection_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   p1_projection_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_projection_finite_element_0()
+  ~p1_projection_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 10;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,41 +136,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -167,41 +164,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -211,351 +192,558 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
         
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
@@ -563,50 +751,28 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
   {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 10; r++)
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
     
     // Compute number of derivatives.
     unsigned int num_derivatives = 1;
@@ -615,28 +781,262 @@ public:
       num_derivatives *= 2;
     } // end loop over 'r'
     
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
     {
-      values[r] = 0.0;
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
     } // end loop over 'r'
     
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
       return ;
     }
     
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
     {
-    return ;
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new p1_projection_finite_element_0();
+  }
+
+};
+
+
+class p1_projection_finite_element_1: public ufc::finite_element
+{
+public:
+
+  p1_projection_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~p1_projection_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
     }
     
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -645,340 +1045,386 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[8][3];
-    for (unsigned int row = 0; row < 8; row++)
-    {
-      for (unsigned int col = 0; col < 3; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[8][8];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[1] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -993,9 +1439,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1005,11 +1451,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1019,11 +1465,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1032,9 +1478,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1051,109 +1497,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1168,9 +1570,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1180,11 +1582,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1194,11 +1596,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1207,9 +1609,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1226,109 +1628,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1343,9 +1701,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1355,11 +1713,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1369,11 +1727,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1382,9 +1740,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1401,109 +1759,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1518,9 +1832,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1530,11 +1844,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1544,11 +1858,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1557,9 +1871,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1571,114 +1885,70 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1693,9 +1963,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1705,11 +1975,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1719,11 +1989,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1732,9 +2002,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1746,114 +2016,70 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 10; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1868,9 +2094,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1880,11 +2106,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1894,11 +2120,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 10; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 10; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1907,9 +2133,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 10; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1921,12 +2147,363 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new p1_projection_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new p1_projection_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new p1_projection_finite_element_1();
+  }
+
+};
+
+
+class p1_projection_finite_element_2: public ufc::finite_element
+{
+public:
+
+  p1_projection_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~p1_projection_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 10;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
@@ -1961,147 +2538,60 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        derivatives[r] = 0.0;
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 2:
       {
         
       // Array of basisvalues
@@ -2136,147 +2626,104 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        derivatives[r] = 0.0;
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 5:
       {
         
       // Array of basisvalues
@@ -2311,143 +2758,188 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        derivatives[r] = 0.0;
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
@@ -2455,30 +2947,46 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
     
     // Compute number of derivatives.
     unsigned int num_derivatives = 1;
@@ -2487,625 +2995,1420 @@ public:
       num_derivatives *= 2;
     } // end loop over 'r'
     
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
+      values[r] = 0.0;
     } // end loop over 'r'
     
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
     if (n > 3)
     {
-      return ;
+    return ;
     }
     
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[8][3];
+    for (unsigned int row = 0; row < 8; row++)
     {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
+      for (unsigned int col = 0; col < 3; col++)
+        combinations[row][col] = 0;
+    }
     
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
+    // Generate combinations of derivatives
+    for (unsigned int row = 1; row < num_derivatives; row++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int num = 0; num < row; num++)
       {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
+        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;
+          }
+        }
+      }
+    }
     
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    // Compute inverse of Jacobian
+    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[8][8];
+    for (unsigned int j = 0; j < num_derivatives; j++)
     {
-    case 0:
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
       }
-    case 1:
+    }
+    switch (i)
+    {
+    case 0:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 5:
+    case 1:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 9:
+    case 2:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new p1_projection_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class p1_projection_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  p1_projection_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~p1_projection_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
+        {
+          for (unsigned int u = 0; u < 10; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 10; t++)
         {
-          if (combinations[row][col] + 1 > 1)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 10; u++)
           {
-            combinations[row][col] += 1;
-            break;
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            for (unsigned int u = 0; u < 10; u++)
+            {
+              for (unsigned int tu = 0; tu < 10; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 10; s++)
+        {
+          for (unsigned int t = 0; t < 10; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      static const double coefficients0[10] = \
+      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3120,9 +4423,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3132,11 +4435,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3146,11 +4449,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3159,9 +4462,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3178,65 +4481,109 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      static const double coefficients0[10] = \
+      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3251,9 +4598,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3263,11 +4610,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3277,11 +4624,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3290,9 +4637,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3309,65 +4656,109 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
+      static const double coefficients0[10] = \
+      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
+      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
+      double derivatives[8];
+      for (unsigned int r = 0; r < 8; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 3; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -3382,9 +4773,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -3394,11 +4785,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3408,11 +4799,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 3; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 3; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -3421,9 +4812,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 3; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -3444,28 +4835,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -3477,7 +4866,7 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 10; r++)
     {
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
@@ -3486,22 +4875,22 @@ public:
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 3)
     {
       return ;
     }
     
     // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
+    double dof_values[8];
+    for (unsigned int r = 0; r < 8; r++)
     {
       dof_values[r] = 0.0;
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
+    for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -3509,161 +4898,436 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 6:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 7:
+      {
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 8:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 9:
+      {
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[6] = vals[0];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[7] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[8] = vals[0];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[8] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[9] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[10] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[11] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[15] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[18] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[19] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new p1_projection_finite_element_2();
+  }
+
+};
+
+
+class p1_projection_dofmap_0: public ufc::dofmap
+{
+public:
+
+  p1_projection_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~p1_projection_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new p1_projection_finite_element_1();
+    return new p1_projection_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class p1_projection_dofmap_0: public ufc::dofmap
+class p1_projection_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  p1_projection_dofmap_0() : ufc::dofmap()
+  p1_projection_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_projection_dofmap_0()
+  ~p1_projection_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3674,12 +5338,12 @@ public:
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
       {
-        return true;
+        return false;
         break;
       }
     }
@@ -3687,55 +5351,44 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
+    return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 10;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 2;
         break;
       }
     case 1:
       {
-        return 2;
+        return 0;
         break;
       }
     case 2:
       {
-        return 1;
+        return 0;
         break;
       }
     }
@@ -3743,30 +5396,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3774,33 +5420,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
+      dofs[2] = 4;
+      dofs[3] = 5;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
-      dofs[2] = 5;
-      dofs[3] = 6;
+      dofs[2] = 3;
+      dofs[3] = 5;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
-      dofs[2] = 7;
-      dofs[3] = 8;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3821,16 +5466,19 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 3;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 4;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 5;
           break;
         }
       }
@@ -3839,122 +5487,71 @@ public:
       }
     case 1:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 4;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 5;
-        dofs[1] = 6;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 7;
-        dofs[1] = 8;
-          break;
-        }
-      }
-      
+        
         break;
       }
     case 2:
       {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 9;
+        
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new p1_projection_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new p1_projection_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new p1_projection_dofmap_0();
+    return new p1_projection_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class p1_projection_dofmap_1: public ufc::dofmap
+class p1_projection_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  p1_projection_dofmap_1() : ufc::dofmap()
+  p1_projection_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_projection_dofmap_1()
+  ~p1_projection_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3965,12 +5562,12 @@ public:
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
       {
-        return false;
+        return true;
         break;
       }
     }
@@ -3978,39 +5575,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 3;
+    return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 2;
+    return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4021,12 +5607,12 @@ public:
       }
     case 1:
       {
-        return 0;
+        return 2;
         break;
       }
     case 2:
       {
-        return 0;
+        return 1;
         break;
       }
     }
@@ -4034,19 +5620,28 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + 2*entity_indices[1][0];
+    dofs[4] = offset + 2*entity_indices[1][0] + 1;
+    dofs[5] = offset + 2*entity_indices[1][1];
+    dofs[6] = offset + 2*entity_indices[1][1] + 1;
+    dofs[7] = offset + 2*entity_indices[1][2];
+    dofs[8] = offset + 2*entity_indices[1][2] + 1;
+    offset += 2*num_global_entities[1];
+    dofs[9] = offset + entity_indices[2][0];
+    offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4054,27 +5649,32 @@ public:
       {
         dofs[0] = 1;
       dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
       dofs[1] = 2;
+      dofs[2] = 5;
+      dofs[3] = 6;
         break;
       }
     case 2:
       {
         dofs[0] = 0;
       dofs[1] = 1;
+      dofs[2] = 7;
+      dofs[3] = 8;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4113,82 +5713,92 @@ public:
       }
     case 1:
       {
-        
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 3;
+        dofs[1] = 4;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 5;
+        dofs[1] = 6;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 7;
+        dofs[1] = 8;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
       {
-        
+        if (i > 0)
+      {
+      throw std::runtime_error("i is larger than number of entities (0)");
+      }
+      
+      dofs[0] = 9;
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new p1_projection_dofmap_1();
+    return new p1_projection_dofmap_2();
   }
 
 };
 
-/// 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 p1_projection_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   p1_projection_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~p1_projection_cell_integral_0_otherwise()
+  ~p1_projection_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    0
@@ -4197,7 +5807,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4224,38 +5834,31 @@ public:
 
 };
 
-/// 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 p1_projection_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   p1_projection_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~p1_projection_cell_integral_1_otherwise()
+  ~p1_projection_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    10
@@ -4264,7 +5867,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4294,77 +5897,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class p1_projection_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   p1_projection_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_projection_form_0()
+  ~p1_projection_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "52c8d096982a23a3bfc03f770ad68d237051e53889ec0254487f23fab5e3e4a95d618a5af0af524a61c2d495c8239e10d342691867a7dbec485ae128076e58e8";
+    return "ea8284e00827ee6f2efce3a3a357d76fa7efd777c89e134c1afd80eaa2c6c3fe1ab84efde4a0624488e0de44e821f0c62066757672d48b1703871602704038bb";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new p1_projection_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new p1_projection_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new p1_projection_finite_element_1();
+        return new p1_projection_finite_element_0();
         break;
       }
     case 1:
       {
-        return new p1_projection_finite_element_1();
+        return new p1_projection_finite_element_0();
         break;
       }
     }
@@ -4372,19 +5967,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new p1_projection_dofmap_1();
+        return new p1_projection_dofmap_0();
         break;
       }
     case 1:
       {
-        return new p1_projection_dofmap_1();
+        return new p1_projection_dofmap_0();
         break;
       }
     }
@@ -4392,203 +5986,231 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new p1_projection_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class p1_projection_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   p1_projection_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p1_projection_form_1()
+  ~p1_projection_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "9b97b1e8a04b283f5b212fd4145b71e0c6c221c7a2f34828628e124bf45033e03dde2f32a66c498813abf7097558c0afeea73d6dd39771d0ba4c7ecf031b7264";
+    return "e3b6bc43e14322d85eb15e73d4d89fa8dc3c71b1a889b47b908bb3d96ff4ed8a78da966ecdcfd2a614c7fd120b9b39d3ff3e0d3e09d2a555fc10945147a49fdc";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new p1_projection_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new p1_projection_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new p1_projection_finite_element_1();
+        return new p1_projection_finite_element_0();
         break;
       }
     case 1:
       {
-        return new p1_projection_finite_element_0();
+        return new p1_projection_finite_element_2();
         break;
       }
     }
@@ -4596,19 +6218,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new p1_projection_dofmap_1();
+        return new p1_projection_dofmap_0();
         break;
       }
     case 1:
       {
-        return new p1_projection_dofmap_0();
+        return new p1_projection_dofmap_2();
         break;
       }
     }
@@ -4616,126 +6237,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new p1_projection_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -4749,14 +6406,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace P1_projection
 {
@@ -4765,43 +6428,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4812,43 +6452,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_projection_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_projection_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4859,63 +6476,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_projection_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_projection_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new p1_projection_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -4923,7 +6547,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new p1_projection_form_0());
+    _ufc_form = std::make_shared<const p1_projection_form_0>();
   }
 
   // Destructor
@@ -4953,57 +6577,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), mesh)))
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_projection_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p1_projection_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p1_projection_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p1_projection_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p1_projection_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
@@ -5011,69 +6690,110 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new p1_projection_form_1());
+    _ufc_form = std::make_shared<const p1_projection_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
     dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new p1_projection_form_1());
+    _ufc_form = std::make_shared<const p1_projection_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new p1_projection_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new p1_projection_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new p1_projection_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new p1_projection_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -5105,18 +6825,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/nonmatching-projection/cpp/P3.h b/demo/undocumented/nonmatching-projection/cpp/P3.h
index 19756f9..0daa984 100644
--- a/demo/undocumented/nonmatching-projection/cpp/P3.h
+++ b/demo/undocumented/nonmatching-projection/cpp/P3.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __P3_H
 #define __P3_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class p3_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   p3_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p3_finite_element_0()
+  ~p3_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 10;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -563,20 +576,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -585,26 +596,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -624,7 +633,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -636,7 +645,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -645,8 +654,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -746,21 +755,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -921,21 +930,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1096,21 +1105,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1271,21 +1280,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1446,21 +1455,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1621,21 +1630,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1796,21 +1805,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1971,21 +1980,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2146,21 +2155,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2321,21 +2330,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2455,28 +2464,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2512,7 +2519,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -2520,22 +2527,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -2546,80 +2551,80 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 7:
       {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+        y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+      y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 8:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 9:
       {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+        y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+      y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -2629,66 +2634,64 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
+    y[0] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    y[1] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
+    y[0] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    y[1] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2696,69 +2699,69 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.666666666666667*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[7] = 0.666666666666667*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[8] = 0.333333333333333*coordinate_dofs[2] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[9] = 0.333333333333333*coordinate_dofs[3] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[10] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[11] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[5];
+    dof_coordinates[12] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[4];
+    dof_coordinates[13] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[5];
+    dof_coordinates[14] = 0.666666666666667*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2];
+    dof_coordinates[15] = 0.666666666666667*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3];
+    dof_coordinates[16] = 0.333333333333333*coordinate_dofs[0] + 0.666666666666667*coordinate_dofs[2];
+    dof_coordinates[17] = 0.333333333333333*coordinate_dofs[1] + 0.666666666666667*coordinate_dofs[3];
+    dof_coordinates[18] = 0.333333333333333*coordinate_dofs[0] + 0.333333333333333*coordinate_dofs[2] + 0.333333333333333*coordinate_dofs[4];
+    dof_coordinates[19] = 0.333333333333333*coordinate_dofs[1] + 0.333333333333333*coordinate_dofs[3] + 0.333333333333333*coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new p3_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
 class p3_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
   p3_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~p3_dofmap_0()
+  ~p3_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2782,39 +2785,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2838,30 +2830,28 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
+    dofs[3] = offset + 2*entity_indices[1][0];
+    dofs[4] = offset + 2*entity_indices[1][0] + 1;
+    dofs[5] = offset + 2*entity_indices[1][1];
+    dofs[6] = offset + 2*entity_indices[1][1] + 1;
+    dofs[7] = offset + 2*entity_indices[1][2];
+    dofs[8] = offset + 2*entity_indices[1][2] + 1;
     offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
+    dofs[9] = offset + entity_indices[2][0];
     offset += num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2893,9 +2883,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2977,46 +2966,18 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
     return new p3_dofmap_0();
   }
@@ -3030,14 +2991,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace P3
 {
@@ -3046,43 +3013,20 @@ class FunctionSpace: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p3_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p3_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p3_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p3_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p3_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new p3_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new p3_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<p3_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<p3_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
diff --git a/demo/undocumented/nonmatching-projection/cpp/compile.log b/demo/undocumented/nonmatching-projection/cpp/compile.log
index 4e21e37..1f17970 100644
--- a/demo/undocumented/nonmatching-projection/cpp/compile.log
+++ b/demo/undocumented/nonmatching-projection/cpp/compile.log
@@ -1,173 +1,58 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling element P3
 
-Compiler stage 1: Analyzing form(s)
------------------------------------
+Compiler stage 1: Analyzing elements(s)
+---------------------------------------
   
-Compiler stage 1 finished in 0.000192165 seconds.
+Compiler stage 1 finished in 0.00027895 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
   Computing representation of 1 elements
   Reusing element from cache
+  Reusing element from cache
   Computing representation of 1 dofmaps
   Reusing element from cache
+  Computing representation of 0 coordinate mappings
   Computing representation of integrals
   Computing representation of forms
   
-Compiler stage 2 finished in 0.190715 seconds.
+Compiler stage 2 finished in 0.378708 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000137806 seconds.
+Compiler stage 3 finished in 0.000176191 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
   Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Generating code for 1 dofmap(s)
+  Generating code for 0 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.169978 seconds.
+Compiler stage 4 finished in 0.195087 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000224113 seconds.
+Compiler stage 4.1 finished in 0.000282049 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./P3.h.
-Compiler stage 5 finished in 0.000610113 seconds.
+Compiler stage 5 finished in 0.00049305 seconds.
 
-FFC finished in 0.362175 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.575471 seconds.
+Output written to ./P3.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form P1_projection
 
@@ -180,17 +65,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 0
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -198,30 +83,39 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG1(?), CG3(?)'
-  Unique sub elements:       'CG1(?), CG3(?)'
+  Unique elements:           'CG1(?), CG3(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), CG3(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
-Compiler stage 1 finished in 0.211557 seconds.
+Compiler stage 1 finished in 0.382653 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 2 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 2 dofmaps
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
   Extracting monomial form representation from UFL form
@@ -230,7 +124,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000652 seconds
+  9 entries computed in 0.000642 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -238,6 +132,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 0 dims = [] indices = [[]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -246,7 +141,7 @@ Compiler stage 2: Computing intermediate representation
   Precomputing integrals on reference element
   Reusing element from cache
   Reusing element from cache
-  30 entries computed in 0.00101 seconds
+  30 entries computed in 0.000973 seconds
   Shape of reference tensor: (3, 10)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
@@ -255,202 +150,72 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00668907 seconds.
+Compiler stage 2 finished in 0.00975919 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000157118 seconds.
+Compiler stage 3 finished in 0.000184059 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 2 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 2 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.201058 seconds.
+Compiler stage 4 finished in 0.261142 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000511885 seconds.
+Compiler stage 4.1 finished in 0.000678062 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./P1_projection.h.
-Compiler stage 5 finished in 0.00069499 seconds.
+Compiler stage 5 finished in 0.000642061 seconds.
 
-FFC finished in 0.42099 seconds.
+FFC finished in 0.655495 seconds.
+Output written to ./P1_projection.h.
diff --git a/demo/undocumented/nonmatching-projection/cpp/main.cpp b/demo/undocumented/nonmatching-projection/cpp/main.cpp
index 7059e3f..395e41c 100644
--- a/demo/undocumented/nonmatching-projection/cpp/main.cpp
+++ b/demo/undocumented/nonmatching-projection/cpp/main.cpp
@@ -43,19 +43,19 @@ public:
 int main()
 {
   // Create meshes
-  UnitSquareMesh mesh0(16, 16);
-  UnitSquareMesh mesh1(64, 64);
+  auto mesh0 = std::make_shared<UnitSquareMesh>(16, 16);
+  auto mesh1 = std::make_shared<UnitSquareMesh>(64, 64);
 
   // Create P3 function space
-  P3::FunctionSpace V0(mesh0);
+  auto V0 = std::make_shared<P3::FunctionSpace>(mesh0);
 
   // Interpolate expression into V0
   MyExpression e;
-  Function f0(V0);
-  f0.interpolate(e);
+  auto f0 = std::make_shared<Function>(V0);
+  f0->interpolate(e);
 
   // Define variational problem
-  P1_projection::FunctionSpace V1(mesh1);
+  auto V1 = std::make_shared<P1_projection::FunctionSpace>(mesh1);
   P1_projection::BilinearForm a(V1, V1);
   P1_projection::LinearForm L(V1, f0);
 
@@ -64,7 +64,7 @@ int main()
   solve(a == L, f1);
 
   // Plot results
-  plot(f0);
+  plot(*f0);
   plot(f1);
   interactive();
 
diff --git a/demo/undocumented/optimization/python/demo_optimization.py b/demo/undocumented/optimization/python/demo_optimization.py
index ff07548..3e14111 100644
--- a/demo/undocumented/optimization/python/demo_optimization.py
+++ b/demo/undocumented/optimization/python/demo_optimization.py
@@ -38,7 +38,7 @@ u  = Function(P1)
 z  = Function(P1)
 f  = Constant(1.0)
 p  = Function(P0)
-u0 = Expression("x[0]*(1.0 - x[0])*x[1]*(1.0 - x[1])")
+u0 = Expression("x[0]*(1.0 - x[0])*x[1]*(1.0 - x[1])", degree=2)
 
 # Dirichlet boundary
 class DirichletBoundary(SubDomain):
diff --git a/demo/undocumented/parallel-refinement/cpp/CMakeLists.txt b/demo/undocumented/parallel-refinement/cpp/CMakeLists.txt
index bfc697e..c659aa7 100644
--- a/demo/undocumented/parallel-refinement/cpp/CMakeLists.txt
+++ b/demo/undocumented/parallel-refinement/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/parallel-refinement/cpp/main.cpp b/demo/undocumented/parallel-refinement/cpp/main.cpp
index 99e4fae..9672943 100644
--- a/demo/undocumented/parallel-refinement/cpp/main.cpp
+++ b/demo/undocumented/parallel-refinement/cpp/main.cpp
@@ -25,11 +25,11 @@ using namespace dolfin;
 int main()
 {
   // Create mesh
-  UnitSquareMesh mesh(20, 20);
+  auto mesh = std::make_shared<UnitSquareMesh>(20, 20);
 
   // Create MeshFunction to hold cell process rank
   CellFunction<std::size_t>
-    processes0(mesh, dolfin::MPI::rank(mesh.mpi_comm()));
+    processes0(mesh, dolfin::MPI::rank(mesh->mpi_comm()));
 
   // Output cell distribution to VTK file
   File file("processes.pvd");
@@ -37,22 +37,22 @@ int main()
 
   // Mark all cells on process 0 for refinement
   const CellFunction<bool>
-    marker(mesh, (dolfin::MPI::rank(mesh.mpi_comm()) == 0));
+    marker(mesh, (dolfin::MPI::rank(mesh->mpi_comm()) == 0));
 
   // Refine mesh, but keep all new cells on parent process
-  Mesh mesh0 = refine(mesh, marker, false);
+  auto mesh0 = std::make_shared<Mesh>(refine(*mesh, marker, false));
 
   // Create MeshFunction to hold cell process rank
   const CellFunction<std::size_t>
-    processes1(mesh0, dolfin::MPI::rank(mesh.mpi_comm()));
+    processes1(mesh0, dolfin::MPI::rank(mesh->mpi_comm()));
   file << processes1;
 
   // Refine mesh, but this time repartition the mesh after refinement
-  Mesh mesh1 = refine(mesh, marker, true);
+  auto mesh1 = std::make_shared<Mesh>(refine(*mesh, marker, false));
 
   // Create MeshFunction to hold cell process rank
   CellFunction<std::size_t>
-    processes2(mesh1, dolfin::MPI::rank(mesh.mpi_comm()));
+    processes2(mesh1, dolfin::MPI::rank(mesh->mpi_comm()));
   file << processes2;
 
   return 0;
diff --git a/demo/undocumented/parameters/cpp/CMakeLists.txt b/demo/undocumented/parameters/cpp/CMakeLists.txt
index c05053e..384e4fb 100644
--- a/demo/undocumented/parameters/cpp/CMakeLists.txt
+++ b/demo/undocumented/parameters/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/parameters/python/demo_parameters.py b/demo/undocumented/parameters/python/demo_parameters.py
index 7d4c6bc..ab15ada 100644
--- a/demo/undocumented/parameters/python/demo_parameters.py
+++ b/demo/undocumented/parameters/python/demo_parameters.py
@@ -70,10 +70,6 @@ solver_parameters.set_range("max_iterations", 0, 1000)
 solver_parameters["max_iterations"] = 500
 solver_parameters["relative_tolerance"] = 0.1
 
-# Can also access parameter values like this
-solver_parameters.max_iterations = 500
-solver_parameters.relative_tolerance = 0.1
-
 # Set solver parameters as nested parameters of application parameters
 application_parameters.add(solver_parameters)
 
@@ -85,11 +81,6 @@ foo = application_parameters["foo"]
 bar = application_parameters["bar"]
 tol = application_parameters["solver_parameters"]["tolerance"]
 
-# Can also access parameter values like this
-foo = application_parameters.foo
-bar = application_parameters.bar
-tol = application_parameters.solver_parameters.tolerance
-
 # Print parameter values
 print("foo =", foo)
 print("bar =", bar)
diff --git a/demo/undocumented/petsc4py/python/demo_petsc4py.py b/demo/undocumented/petsc4py/python/demo_petsc4py.py
deleted file mode 100644
index 92b896a..0000000
--- a/demo/undocumented/petsc4py/python/demo_petsc4py.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""This demo program solves Poisson's equation
-
-    - div grad u(x, y) = f(x, y)
-
-on the unit square with source f given by
-
-    f(x, y) = 10*exp(-((x - 0.5)^2 + (y - 0.5)^2) / 0.02)
-
-and boundary conditions given by
-
-    u(x, y) = 0        for x = 0 or x = 1
-du/dn(x, y) = sin(5*x) for y = 0 or y = 1
-
-It demonstrates how to extract petsc4py objects from dolfin objects
-and use them in a petsc4py Krylov solver.
-
-Based on "demo/pde/poisson/python/demo_poisson.py"
-"""
-
-# Copyright (C) 2007-2011, 2013 Anders Logg, Lawrence Mitchell
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-
-# Begin demo
-from __future__ import print_function
-from dolfin import *
-from six import print_
-try:
-    from petsc4py import PETSc
-except:
-    print_("*** You need to have petsc4py installed for this demo to run", end=' ')
-    print("Exiting.")
-    exit()
-
-if not has_petsc4py():
-    print_("*** DOLFIN has not been compiled with petsc4py support", end=' ')
-    print("Exiting.")
-    exit()
-
-parameters["linear_algebra_backend"] = "PETSc"
-
-# Create mesh and define function space
-mesh = UnitSquareMesh(32, 32)
-V = FunctionSpace(mesh, "Lagrange", 1)
-
-# Define Dirichlet boundary (x = 0 or x = 1)
-def boundary(x):
-    return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS
-
-# Define boundary condition
-u0 = Constant(0.0)
-bc = DirichletBC(V, u0, boundary)
-
-# Define variational problem
-u = TrialFunction(V)
-v = TestFunction(V)
-f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-g = Expression("sin(5*x[0])")
-a = inner(grad(u), grad(v))*dx
-L = f*v*dx + g*v*ds
-
-# Compute solution
-u = Function(V)
-
-A, b = assemble_system(a, L, bc)
-
-# Fetch underlying PETSc objects
-A_petsc = as_backend_type(A).mat()
-b_petsc = as_backend_type(b).vec()
-x_petsc = as_backend_type(u.vector()).vec()
-
-# Create solver, apply preconditioner and solve system
-ksp = PETSc.KSP().create()
-ksp.setOperators(A_petsc)
-
-pc = PETSc.PC().create()
-pc.setOperators(A_petsc)
-pc.setType(pc.Type.JACOBI)
-ksp.setPC(pc)
-
-ksp.solve(b_petsc, x_petsc)
-
-# Plot solution
-plot(u, interactive=True)
-
-# Save solution to file
-file = File("poisson.pvd")
-file << u
diff --git a/demo/undocumented/plot-qt/cpp/BoundaryMeshFunction.h b/demo/undocumented/plot-qt/cpp/BoundaryMeshFunction.h
deleted file mode 100644
index 8482eb8..0000000
--- a/demo/undocumented/plot-qt/cpp/BoundaryMeshFunction.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2012 Joachim Berdal Haga
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-09-18
-// Last changed: 2012-09-18
-
-#ifndef __BOUNDARY_MESH_FUNCTION_H
-#define __BOUNDARY_MESH_FUNCTION_H
-
-#include <dolfin.h>
-#include <QObject>
-
-class BoundaryMeshFunction : public QObject, public dolfin::MeshFunction<bool>
-{
-  Q_OBJECT
-
-  /// A MeshFunction<bool> on the boundary of a Mesh. The purpose of this class
-  /// is to acceps a toggle signal, which changes the value of a single cell.
-
-public:
-
-  BoundaryMeshFunction(const dolfin::Mesh&);
-
-public slots:
-
-  void toggleCell(int);
-
-private:
-
-  dolfin::BoundaryMesh _bmesh;
-
-};
-
-#endif
diff --git a/demo/undocumented/plot-qt/cpp/CMakeLists.txt b/demo/undocumented/plot-qt/cpp/CMakeLists.txt
deleted file mode 100644
index 4e4cf11..0000000
--- a/demo/undocumented/plot-qt/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,103 +0,0 @@
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-project(demo_plot-qt)
-
-set(SOURCES main.cpp Plotter.cpp PlotWidget.cpp CoordLabel.cpp BoundaryMeshFunction.cpp)
-set(HEADERS Plotter.h PlotWidget.h CoordLabel.h BoundaryMeshFunction.h)
-
-# Ignore whitespace in library paths
-cmake_policy(SET CMP0004 OLD)
-
-# Get DOLFIN configuration data (DOLFINConfig.cmake must be in DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN REQUIRED)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
-endif()
-
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Add special DOLFIN compiler flags
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DOLFIN_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
-# Qt
-find_package(Qt4)
-if (QT_FOUND)
-  include(${QT_USE_FILE})
-  add_definitions(${QT_DEFINITIONS})
-endif()
-
-# VTK
-find_package(VTK NO_MODULE)
-if (VTK_FOUND)
-  include(${VTK_USE_FILE})
-  if ("${VTK_MAJOR_VERSION}" STREQUAL "5")
-    find_library(lib_QVTK QVTK HINTS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
-    find_library(lib_QVTK QVTK HINTS ${VTK_LIBRARY_DIRS})
-    list(APPEND VTK_LIBRARIES "${lib_QVTK}")
-  endif()
-endif()
-
-# If built stand-alone (in demo directory), DOLFIN_ENABLE_FOO are not set. We
-# have to parse the definitions to see if qvtk is enabled in DOLFIN.
-get_directory_property(cmake_defs COMPILE_DEFINITIONS)
-foreach(d ${cmake_defs})
-  if (${d} STREQUAL HAS_QVTK)
-    set(QVTK_ENABLED 1)
-  endif()
-endforeach()
-
-if (QT_FOUND AND VTK_FOUND AND QVTK_ENABLED)
-
-  # Define headers to run moc on. The OPTIONS ... works around a problem with moc+boost (QT bug #22829).
-  qt4_wrap_cpp(HEADERS_MOC ${HEADERS} OPTIONS   -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_BIT_AND_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_BIT_AND_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_BIT_OR_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_BIT_OR_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_BIT_XOR_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_BIT_XOR_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_DIVIDES_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_DIVIDES_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_EQUAL_TO_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_GREATER_EQUAL_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_GREATER_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_LEFT_SHIFT_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_LEFT_SHIFT_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_LESS_EQUAL_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_LESS_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_LOGICAL_AND_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_LOGICAL_OR_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_MINUS_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_MINUS_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_MODULUS_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_MODULUS_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_MULTIPLIES_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_MULTIPLIES_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_NOT_EQUAL_TO_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_PLUS_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_PLUS_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_RIGHT_SHIFT_ASSIGN_HPP_INCLUDED
-                                                -DBOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED
-                                                )
-
-  # Executable
-  add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS_MOC})
-
-  # Target libraries
-  target_link_libraries(${PROJECT_NAME} ${DOLFIN_LIBRARIES} ${DOLFIN_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${VTK_LIBRARIES})
-
-else()
-
-  # Build dummy executable to make regression tests happy on systems without QVTK
-  add_executable(${PROJECT_NAME} main.cpp)
-
-endif()
diff --git a/demo/undocumented/plot-qt/cpp/CoordLabel.cpp b/demo/undocumented/plot-qt/cpp/CoordLabel.cpp
deleted file mode 100644
index 639589f..0000000
--- a/demo/undocumented/plot-qt/cpp/CoordLabel.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2012 Joachim Berdal Haga
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-09-14
-// Last changed: 2012-09-18
-
-#include "CoordLabel.h"
-
-//----------------------------------------------------------------------------
-CoordLabel::CoordLabel(const char *format, QWidget *parent)
-  : QLabel(parent), _format(format)
-{
-}
-//----------------------------------------------------------------------------
-void CoordLabel::setNum(int x)
-{
-  QString txt;
-  txt.sprintf(_format, x);
-  setText(txt);
-}
-//----------------------------------------------------------------------------
-void CoordLabel::setNum(int x, int y)
-{
-  QString txt;
-  txt.sprintf(_format, x, y);
-  setText(txt);
-}
-//----------------------------------------------------------------------------
-void CoordLabel::setNum(double x, double y, double z)
-{
-  QString txt;
-  txt.sprintf(_format, x, y, z);
-  setText(txt);
-}
-//----------------------------------------------------------------------------
diff --git a/demo/undocumented/plot-qt/cpp/CoordLabel.h b/demo/undocumented/plot-qt/cpp/CoordLabel.h
deleted file mode 100644
index 3acad5c..0000000
--- a/demo/undocumented/plot-qt/cpp/CoordLabel.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2012 Joachim Berdal Haga
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-09-18
-// Last changed: 2012-09-18
-
-#ifndef __COORD_LABEL_H
-#define __COORD_LABEL_H
-
-#include <QLabel>
-
-class CoordLabel : public QLabel
-{
-  Q_OBJECT
-
-  /// A simple wrapper around QLabel, to create simple gui elements for
-  /// formatted display of numbers. Add setNum() slots as required.
-
-public:
-
-  CoordLabel(const char *format, QWidget *parent=NULL);
-
-public slots:
-
-  void setNum(int);
-  void setNum(int,int);
-  void setNum(double,double,double);
-
-private:
-
-  const char *_format;
-
-};
-
-#endif
diff --git a/demo/undocumented/plot-qt/cpp/PlotWidget.h b/demo/undocumented/plot-qt/cpp/PlotWidget.h
deleted file mode 100644
index 6f87b6f..0000000
--- a/demo/undocumented/plot-qt/cpp/PlotWidget.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) 2012 Joachim Berdal Haga
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-09-14
-// Last changed: 2012-09-18
-
-#ifndef __PLOT_WIDGET_H
-#define __PLOT_WIDGET_H
-
-#include <QVTKWidget.h>
-
-class PlotWidget : public QVTKWidget
-{
-  Q_OBJECT
-
-  /// Extends QVTKWidget to send signals on mouse move and click.
-
-public:
-
-  PlotWidget(QWidget *parent=NULL);
-
-protected:
-
-  virtual void mouseMoveEvent(QMouseEvent *);
-
-  virtual void mousePressEvent(QMouseEvent *);
-
-  virtual void mouseReleaseEvent(QMouseEvent *);
-
-signals:
-
-  void mouseMoved(int x, int y);
-
-  void mouseClick(int x, int y);
-
-private:
-
-  // Used to decide which mouse event is a click
-  bool button1_click_in_progress;
-
-};
-
-#endif
diff --git a/demo/undocumented/plot-qt/cpp/Plotter.cpp b/demo/undocumented/plot-qt/cpp/Plotter.cpp
deleted file mode 100644
index 6905244..0000000
--- a/demo/undocumented/plot-qt/cpp/Plotter.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (C) 2012 Joachim Berdal Haga
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-09-14
-// Last changed: 2012-09-18
-
-#include <vtkCellPicker.h>
-#include <vtkRenderer.h>
-
-#include <dolfin/plot/VTKWindowOutputStage.h>
-
-#include "Plotter.h"
-
-using namespace dolfin;
-
-//----------------------------------------------------------------------------
-Plotter::Plotter(std::shared_ptr<const Variable> obj, QWidget *parent)
-  : VTKPlotter(obj, new PlotWidget(parent))
-{
-  init();
-}
-//----------------------------------------------------------------------------
-Plotter::Plotter(std::shared_ptr<const Expression> e, std::shared_ptr<const Mesh> m, QWidget *parent)
-  : VTKPlotter(e, m, new PlotWidget(parent))
-{
-  init();
-}
-//----------------------------------------------------------------------------
-bool Plotter::key_pressed(int modifiers, char key, std::string keysym)
-{
-  switch (modifiers + key)
-  {
-    case CONTROL + 'w':
-      // Close window; ignore (or pass to parent widget?)
-      return true;
-  }
-
-  return VTKPlotter::key_pressed(modifiers, key, keysym);
-}
-//----------------------------------------------------------------------------
-void Plotter::init()
-{
-  cur_cell = -1;
-
-  // Use a cell picker (default is prop picker)
-  //vtk_pipeline->get_interactor()->SetPicker(vtkSmartPointer<vtkCellPicker>::New());
-
-  // Receive cursor-position signals
-  get_widget()->setMouseTracking(true);
-  connect(get_widget(), SIGNAL(mouseMoved(int,int)), SLOT(receiveMouseMoved(int,int)));
-  connect(get_widget(), SIGNAL(mouseClick(int,int)), SLOT(receiveMousePress(int,int)));
-
-  // Prevent window move/resize
-  parameters["tile_windows"] = false;
-}
-//----------------------------------------------------------------------------
-void Plotter::receiveMouseMoved(int x, int y)
-{
-  const QSize size = get_widget()->size();
-
-  vtkSmartPointer<vtkCellPicker> picker = vtkSmartPointer<vtkCellPicker>::New();
-  if (picker->Pick(x, size.height()-y-1, 0, vtk_pipeline->get_renderer()))
-  {
-    cur_cell = picker->GetCellId();
-    double *c = picker->GetMapperPosition();
-    emit worldPos(c[0], c[1], c[2]);
-  }
-  else
-  {
-    cur_cell = -1;
-  }
-
-  emit cellId(cur_cell);
-}
-//----------------------------------------------------------------------------
-void Plotter::receiveMousePress(int x, int y)
-{
-  if (cur_cell >= 0)
-  {
-    emit cellPicked(cur_cell);
-  }
-}
-//----------------------------------------------------------------------------
-void Plotter::toggleMesh()
-{
-  // FIXME: Lazy + ugly
-  VTKPlotter::key_pressed(0, 'm', "m");
-}
-//----------------------------------------------------------------------------
-void Plotter::update()
-{
-  VTKPlotter::plot();
-}
-//----------------------------------------------------------------------------
diff --git a/demo/undocumented/plot-qt/cpp/Plotter.h b/demo/undocumented/plot-qt/cpp/Plotter.h
deleted file mode 100644
index c4d26ec..0000000
--- a/demo/undocumented/plot-qt/cpp/Plotter.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (C) 2012 Joachim Berdal Haga
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-09-14
-// Last changed: 2012-09-18
-
-#ifndef __DEMO_PLOTTER_H
-#define __DEMO_PLOTTER_H
-
-#include <QObject>
-#include <QVTKWidget.h>
-#include <dolfin/plot/VTKPlotter.h>
-#include "PlotWidget.h"
-
-class Plotter : public QObject, public dolfin::VTKPlotter
-{
-  Q_OBJECT
-
-  /// Extends VTKPlotter with signals and slots. Additionally adds a cell
-  /// picker interface.
-
-public:
-
-  Plotter(std::shared_ptr<const Variable> obj,
-          QWidget *parent=NULL);
-
-  Plotter(std::shared_ptr<const dolfin::Expression> e,
-          std::shared_ptr<const dolfin::Mesh> m,
-          QWidget *parent=NULL);
-
-  virtual bool key_pressed(int modifiers, char key, std::string keysym);
-
-private slots:
-
-  void receiveMouseMoved(int x, int y);
-  void receiveMousePress(int x, int y);
-
-public slots:
-
-  void toggleMesh();
-
-  void update();
-
-signals:
-
-  void cellId(int);
-
-  void cellPicked(int);
-
-  void worldPos(double,double,double);
-
-private:
-
-  void init();
-
-  int cur_cell;
-};
-
-#endif
diff --git a/demo/undocumented/plot-qt/cpp/main.cpp b/demo/undocumented/plot-qt/cpp/main.cpp
deleted file mode 100644
index 6f54839..0000000
--- a/demo/undocumented/plot-qt/cpp/main.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (C) 2012 Joachim Berdal Haga
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-09-14
-// Last changed: 2012-09-18
-//
-// This demo illustrates embedding the plot window in a Qt application.
-#ifndef HAS_QVTK
-#include <iostream>
-int main()
-{
-  std::cout << "DOLFIN not configured with QVTK. Quitting gracefully."
-            << std::endl;
-  return 0;
-}
-#else
-
-#include <QtGui>
-#include <dolfin.h>
-
-#include "CoordLabel.h"
-#include "BoundaryMeshFunction.h"
-#include "Plotter.h"
-
-using namespace dolfin;
-
-//----------------------------------------------------------------------------
-int main(int argc, char *argv[])
-{
-  if (getenv("DOLFIN_NOPLOT"))
-  {
-    warning("DOLFIN_NOPLOT is set; not running %s", argv[0]);
-    return 0;
-  }
-
-  // Create application and top-level window
-  QApplication app(argc, argv);
-  QWidget window;
-  window.setWindowTitle("Qt embedded plot window demo");
-
-  // Create plotter
-  UnitCubeMesh unit_cube(4, 4, 4);
-  BoundaryMeshFunction meshfunc(unit_cube);
-  Plotter plotter(reference_to_no_delete_pointer(meshfunc));
-  plotter.parameters["range_min"] = 0.0;
-  plotter.parameters["range_max"] = 1.0;
-  plotter.parameters["scalarbar"] = false;
-
-  // All keyboard events are handled by the plotter
-  plotter.get_widget()->grabKeyboard();
-
-  // Create bottom row of labels/buttons
-  CoordLabel *pixel_x_label = new CoordLabel("Pixel: (%d,%d)");
-  CoordLabel *cell_label    = new CoordLabel("Cell: %d");
-  CoordLabel *world_x_label = new CoordLabel("Coordinate: (%.2f,%.2f,%.2f)");
-  QPushButton *toggle       = new QPushButton("Toggle mesh");
-
-  QBoxLayout *sublayout = new QHBoxLayout();
-  sublayout->addWidget(pixel_x_label);
-  sublayout->addWidget(cell_label);
-  sublayout->addWidget(world_x_label);
-  sublayout->addWidget(toggle);
-
-  // Create main layout (the plot window above the row of labels/buttons)
-  QBoxLayout *layout = new QVBoxLayout();
-  layout->addWidget(plotter.get_widget());
-  layout->addLayout(sublayout);
-  window.setLayout(layout);
-
-  // Connect the plotter with the labels and buttons
-  QObject::connect(plotter.get_widget(), SIGNAL(mouseMoved(int,int)), pixel_x_label, SLOT(setNum(int,int)));
-  QObject::connect(&plotter, SIGNAL(cellId(int)), cell_label, SLOT(setNum(int)));
-  QObject::connect(&plotter, SIGNAL(worldPos(double,double,double)), world_x_label, SLOT(setNum(double,double,double)));
-  QObject::connect(toggle, SIGNAL(pressed()), &plotter, SLOT(toggleMesh()));
-
-  // Connect the cell-pick signal to the plotted object and renderer
-  QObject::connect(&plotter, SIGNAL(cellPicked(int)), &meshfunc, SLOT(toggleCell(int)));
-  QObject::connect(&plotter, SIGNAL(cellPicked(int)), &plotter, SLOT(update()));
-
-  // Set window size and show window
-  // FIXME: The plot window isn't correctly sized unless plot() has been called
-  // before resize().
-  plotter.plot();
-  window.resize(700,500);
-  window.show();
-
-  // Enter main event loop
-  return app.exec();
-}
-//----------------------------------------------------------------------------
-
-#endif
diff --git a/demo/undocumented/plot/cpp/CMakeLists.txt b/demo/undocumented/plot/cpp/CMakeLists.txt
index 935c8fd..5a18265 100644
--- a/demo/undocumented/plot/cpp/CMakeLists.txt
+++ b/demo/undocumented/plot/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/point-integral/python/demo_point-integral.py b/demo/undocumented/point-integral/python/demo_point-integral.py
index c0c2ade..606b554 100644
--- a/demo/undocumented/point-integral/python/demo_point-integral.py
+++ b/demo/undocumented/point-integral/python/demo_point-integral.py
@@ -46,13 +46,13 @@ def boundary(x):
 
 def center_func(x):
     return (0.45 <= x[0] and x[0] <= 0.55 and near(x[1], 0.5)) or \
-           0.45 <= x[1] and x[1] <= 0.55 and near(x[0], 0.5) 
+           0.45 <= x[1] and x[1] <= 0.55 and near(x[0], 0.5)
 
 # Define domain for point integral
 center_domain = VertexFunction("size_t", mesh, 0)
 center = AutoSubDomain(center_func)
 center.mark(center_domain, 1)
-dPP = dP[center_domain]
+dPP = dP(subdomain_data=center_domain)
 
 # Define boundary condition
 u0 = Constant(0.0)
@@ -62,7 +62,7 @@ bc = DirichletBC(V, u0, boundary)
 u = TrialFunction(V)
 v = TestFunction(V)
 f = Constant(0.4)
-g = Expression("A*sin(5*x[0])", A=10.0)
+g = Expression("A*sin(5*x[0])", A=10.0, degree=2)
 a = inner(grad(u), grad(v))*dx
 L = f*v*dPP(1) + g*v*ds
 
diff --git a/demo/undocumented/poisson-disc/cpp/CMakeLists.txt b/demo/undocumented/poisson-disc/cpp/CMakeLists.txt
new file mode 100644
index 0000000..8f970ab
--- /dev/null
+++ b/demo/undocumented/poisson-disc/cpp/CMakeLists.txt
@@ -0,0 +1,45 @@
+# This file is automatically generated by running
+#
+#     cmake/scripts/generate-cmakefiles
+#
+# Require CMake 2.8
+cmake_minimum_required(VERSION 2.8)
+
+set(PROJECT_NAME demo_poisson-disc)
+project(${PROJECT_NAME})
+
+# Set verbose output while testing CMake
+#set(CMAKE_VERBOSE_MAKEFILE 1)
+
+# Set CMake behavior
+cmake_policy(SET CMP0004 NEW)
+
+# Get DOLFIN configuration data (DOLFINConfig.cmake must be in
+# DOLFIN_CMAKE_CONFIG_PATH)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
+endif()
+
+# Executable
+add_executable(${PROJECT_NAME} main.cpp)
+
+# Target libraries
+target_link_libraries(${PROJECT_NAME} ${DOLFIN_LIBRARIES})
diff --git a/demo/undocumented/dg-advection-diffusion/cpp/Velocity.h b/demo/undocumented/poisson-disc/cpp/PoissonDisc.h
similarity index 67%
copy from demo/undocumented/dg-advection-diffusion/cpp/Velocity.h
copy to demo/undocumented/poisson-disc/cpp/PoissonDisc.h
index bb1bfdb..87ab9e7 100644
--- a/demo/undocumented/dg-advection-diffusion/cpp/Velocity.h
+++ b/demo/undocumented/poisson-disc/cpp/PoissonDisc.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
-#ifndef __VELOCITY_H
-#define __VELOCITY_H
-
-#include <cmath>
+#ifndef __POISSONDISC_H
+#define __POISSONDISC_H
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
-class velocity_finite_element_0: public ufc::finite_element
+class poissondisc_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  velocity_finite_element_0() : ufc::finite_element()
+  poissondisc_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_finite_element_0()
+  ~poissondisc_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -339,20 +352,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -361,26 +372,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,7 +409,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -412,7 +421,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,8 +430,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -520,7 +529,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -671,7 +680,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -822,7 +831,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -973,7 +982,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1124,7 +1133,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1275,7 +1284,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1387,28 +1396,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1444,7 +1451,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1452,22 +1459,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1478,48 +1483,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1529,50 +1534,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1580,98 +1583,110 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new velocity_finite_element_0();
+    return new poissondisc_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class velocity_finite_element_1: public ufc::finite_element
+class poissondisc_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  velocity_finite_element_1() : ufc::finite_element()
+  poissondisc_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_finite_element_1()
+  ~poissondisc_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 12;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1685,16 +1700,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1703,8 +1732,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2151,20 +2180,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -2173,7 +2200,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -2181,21 +2208,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -2215,7 +2240,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2227,7 +2252,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2236,8 +2261,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2335,7 +2360,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2486,7 +2511,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2637,7 +2662,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2788,7 +2813,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2939,7 +2964,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3090,7 +3115,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3241,7 +3266,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3392,7 +3417,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3543,7 +3568,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3694,7 +3719,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3845,7 +3870,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3996,7 +4021,7 @@ public:
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -4108,28 +4133,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4165,7 +4188,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 12; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -4173,22 +4196,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -4199,96 +4220,96 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 9:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 10:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 11:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -4298,74 +4319,72 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[5] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[6] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[7] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[8] = vals[1];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[9] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[10] = vals[1];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[11] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -4377,41 +4396,52 @@ public:
     vertex_values[5] = dof_values[8];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[19] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[20] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[21] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[22] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[23] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new velocity_finite_element_0();
+        return new poissondisc_finite_element_0();
         break;
       }
     case 1:
       {
-        return new velocity_finite_element_0();
+        return new poissondisc_finite_element_0();
         break;
       }
     }
@@ -4419,41 +4449,34 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new velocity_finite_element_1();
+    return new poissondisc_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class velocity_dofmap_0: public ufc::dofmap
+class poissondisc_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  velocity_dofmap_0() : ufc::dofmap()
+  poissondisc_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_dofmap_0()
+  ~poissondisc_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4477,39 +4500,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4533,25 +4545,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4580,9 +4590,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4656,71 +4665,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new velocity_dofmap_0();
+    return new poissondisc_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class velocity_dofmap_1: public ufc::dofmap
+class poissondisc_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  velocity_dofmap_1() : ufc::dofmap()
+  poissondisc_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~velocity_dofmap_1()
+  ~poissondisc_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 2, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4744,39 +4727,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0] + 2*num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4800,33 +4772,31 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
-    dofs[6] = offset + c.entity_indices[0][0];
-    dofs[7] = offset + c.entity_indices[0][1];
-    dofs[8] = offset + c.entity_indices[0][2];
+    dofs[6] = offset + entity_indices[0][0];
+    dofs[7] = offset + entity_indices[0][1];
+    dofs[8] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[9] = offset + c.entity_indices[1][0];
-    dofs[10] = offset + c.entity_indices[1][1];
-    dofs[11] = offset + c.entity_indices[1][2];
+    dofs[9] = offset + entity_indices[1][0];
+    dofs[10] = offset + entity_indices[1][1];
+    dofs[11] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4864,9 +4834,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4946,55 +4915,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[19] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[20] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[21] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[22] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[23] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new velocity_dofmap_0();
+        return new poissondisc_dofmap_0();
         break;
       }
     case 1:
       {
-        return new velocity_dofmap_0();
+        return new poissondisc_dofmap_0();
         break;
       }
     }
@@ -5002,79 +4940,1651 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new velocity_dofmap_1();
+    return new poissondisc_dofmap_1();
   }
 
 };
 
-// DOLFIN wrappers
 
-// Standard library includes
-#include <string>
+class poissondisc_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poissondisc_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poissondisc_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 49
+    // Total number of operations (multiply-add pairs):                  60
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.5*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.500000000000002*G0_1_1;
+    A[1] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_1_0;
+    A[2] = 0.166666666666666*G0_0_1 + 0.166666666666666*G0_1_1;
+    A[3] = 0.0;
+    A[4] = -0.666666666666668*G0_0_1 - 0.666666666666668*G0_1_1;
+    A[5] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_1_0;
+    A[6] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_0_1;
+    A[7] = 0.5*G0_0_0;
+    A[8] = -0.166666666666666*G0_0_1;
+    A[9] = 0.666666666666664*G0_0_1;
+    A[10] = 0.0;
+    A[11] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_0_1;
+    A[12] = 0.166666666666666*G0_1_0 + 0.166666666666666*G0_1_1;
+    A[13] = -0.166666666666666*G0_1_0;
+    A[14] = 0.5*G0_1_1;
+    A[15] = 0.666666666666667*G0_1_0;
+    A[16] = -0.666666666666667*G0_1_0 - 0.666666666666666*G0_1_1;
+    A[17] = 0.0;
+    A[18] = 0.0;
+    A[19] = 0.666666666666664*G0_1_0;
+    A[20] = 0.666666666666667*G0_0_1;
+    A[21] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333332*G0_1_1;
+    A[22] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666656*G0_1_0;
+    A[23] = -0.666666666666665*G0_0_1 - 0.666666666666666*G0_1_0 - 1.33333333333332*G0_1_1;
+    A[24] = -0.666666666666668*G0_1_0 - 0.666666666666668*G0_1_1;
+    A[25] = 0.0;
+    A[26] = -0.666666666666667*G0_0_1 - 0.666666666666665*G0_1_1;
+    A[27] = -1.33333333333333*G0_0_0 - 0.666666666666656*G0_0_1 - 0.666666666666659*G0_1_0;
+    A[28] = 1.33333333333333*G0_0_0 + 0.666666666666659*G0_0_1 + 0.666666666666659*G0_1_0 + 1.33333333333333*G0_1_1;
+    A[29] = 0.666666666666665*G0_0_1 + 0.666666666666667*G0_1_0;
+    A[30] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_0_1;
+    A[31] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_1_0;
+    A[32] = 0.0;
+    A[33] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_0 - 1.33333333333332*G0_1_1;
+    A[34] = 0.666666666666667*G0_0_1 + 0.666666666666665*G0_1_0;
+    A[35] = 1.33333333333334*G0_0_0 + 0.666666666666668*G0_0_1 + 0.666666666666668*G0_1_0 + 1.33333333333333*G0_1_1;
+  }
+
+};
 
-// DOLFIN includes
-#include <dolfin/common/NoDeleter.h>
-#include <dolfin/fem/FiniteElement.h>
-#include <dolfin/fem/DofMap.h>
-#include <dolfin/fem/Form.h>
-#include <dolfin/function/FunctionSpace.h>
-#include <dolfin/function/GenericFunction.h>
-#include <dolfin/function/CoefficientAssigner.h>
-#include <dolfin/adaptivity/ErrorControl.h>
-#include <dolfin/adaptivity/GoalFunctional.h>
 
-namespace Velocity
+class poissondisc_cell_integral_1_otherwise: public ufc::cell_integral
 {
+public:
+
+  poissondisc_cell_integral_1_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poissondisc_cell_integral_1_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    6
+    // Number of operations (multiply-add pairs) for tensor contraction: 21
+    // Total number of operations (multiply-add pairs):                  30
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0 = det*w[0][0]*(1.0);
+    const double G0_1 = det*w[0][1]*(1.0);
+    const double G0_2 = det*w[0][2]*(1.0);
+    const double G0_3 = det*w[0][3]*(1.0);
+    const double G0_4 = det*w[0][4]*(1.0);
+    const double G0_5 = det*w[0][5]*(1.0);
+    
+    // Compute element tensor
+    A[0] = 0.0166666666666666*G0_0 - 0.00277777777777778*G0_1 - 0.00277777777777778*G0_2 - 0.0111111111111111*G0_3;
+    A[1] = -0.00277777777777778*G0_0 + 0.0166666666666667*G0_1 - 0.00277777777777781*G0_2 - 0.0111111111111111*G0_4;
+    A[2] = -0.00277777777777778*G0_0 - 0.0027777777777778*G0_1 + 0.0166666666666667*G0_2 - 0.0111111111111111*G0_5;
+    A[3] = -0.0111111111111111*G0_0 + 0.0888888888888888*G0_3 + 0.0444444444444443*G0_4 + 0.0444444444444443*G0_5;
+    A[4] = -0.0111111111111111*G0_1 + 0.0444444444444443*G0_3 + 0.0888888888888887*G0_4 + 0.0444444444444443*G0_5;
+    A[5] = -0.0111111111111111*G0_2 + 0.0444444444444443*G0_3 + 0.0444444444444443*G0_4 + 0.0888888888888887*G0_5;
+  }
 
-class FunctionSpace: public dolfin::FunctionSpace
+};
+
+
+class poissondisc_cell_integral_2_otherwise: public ufc::cell_integral
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  poissondisc_cell_integral_2_otherwise() : ufc::cell_integral()
+  {
+    
+  }
 
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), mesh)))
+  ~poissondisc_cell_integral_2_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  // Create standard function space (shared pointer version)
-  FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), *mesh)))
+  const std::vector<bool> & enabled_coefficients() const final override
   {
-    // Do nothing
+    static const std::vector<bool> enabled({true});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute cell volume
+    
+    
+    // Compute circumradius of triangle in 2D
+    
+    
+    // Array of quadrature weights.
+    static const double W25[25] = {0.0114650803515925, 0.0198040831320473, 0.0173415064313656, 0.0087554991821638, 0.00186555216687783, 0.0231612219294983, 0.0400072873861603, 0.0350325045033716, 0.0176874521104834, 0.0037687016953276, 0.0275289856644697, 0.0475518970579538, 0.0416389652151948, 0.021022967487322, 0.00447940679728133, 0.0231612219294983, 0.0400072873861603, 0.0350325045033716, 0.0176874521104834, 0.0037687016953276, 0.0114650803515925, 0.0198040831320473, 0.01734150643136 [...]
+    // Quadrature points on the UFC reference element: (0.0450425935698037, 0.0398098570514687), (0.0376212523451112, 0.198013417873608), (0.0263646449444709, 0.437974810247386), (0.0142857943955714, 0.695464273353636), (0.00462228846504642, 0.901464914201174), (0.221578609552379, 0.0398098570514687), (0.185070710267389, 0.198013417873608), (0.129695936782254, 0.437974810247386), (0.0702762920082817, 0.695464273353636), (0.022738483063764, 0.901464914201174), (0.480095071474266, 0.039809 [...]
+    
+    // Values of basis functions at quadrature points.
+    static const double FE0[25][6] = \
+    {{0.759842524889054, -0.0409849230988147, -0.036640207614552, 0.00717255684496523, 0.145727572487076, 0.164882476492272},
+    {0.404143384962011, -0.0347905350890822, -0.119594790557632, 0.0297980510461639, 0.605418365816316, 0.115025523822223},
+    {0.0382038937201701, -0.0249744559383748, -0.0543309414249183, 0.0461882014671775, 0.938423301877431, 0.0564900002985142},
+    {-0.121759885907613, -0.0138776265525463, 0.271876837668966, 0.0397410384743819, 0.807433832894958, 0.0165858034218534},
+    {-0.0762735703276687, -0.00457955736373819, 0.723813068870285, 0.0166673234982246, 0.338636367163553, 0.00173636815934466},
+    {0.352482461135478, -0.123384449130048, -0.036640207614552, 0.0352840510877737, 0.117616078244268, 0.65464206627708},
+    {0.144254514044104, -0.116568374669637, -0.119594790557632, 0.146585935553368, 0.488630481309112, 0.456692234320685},
+    {-0.0585120870225411, -0.0960538647466012, -0.0543309414249183, 0.227214213208259, 0.75739729013635, 0.224285389849452},
+    {-0.124504469204174, -0.0603987775714151, 0.271876837668966, 0.19549860142211, 0.65167626994723, 0.0658515377372834},
+    {-0.0643063527627087, -0.0217044058396818, 0.723813068870285, 0.0819917787365634, 0.273311911925214, 0.00689399907032823},
+    {-0.0191125161665052, -0.0191125161665052, -0.036640207614552, 0.0764500646660207, 0.0764500646660207, 0.921965110615521},
+    {-0.07940205210781, -0.07940205210781, -0.119594790557632, 0.31760820843124, 0.31760820843124, 0.643182477910772},
+    {-0.123076437918076, -0.123076437918076, -0.0543309414249183, 0.492305751672304, 0.492305751672304, 0.315872313916462},
+    {-0.105896858921167, -0.105896858921168, 0.271876837668966, 0.42358743568467, 0.42358743568467, 0.0927420088040289},
+    {-0.0444129613327222, -0.0444129613327222, 0.723813068870285, 0.177651845330889, 0.177651845330889, 0.00970916313338205},
+    {-0.123384449130048, 0.352482461135478, -0.036640207614552, 0.117616078244268, 0.0352840510877737, 0.65464206627708},
+    {-0.116568374669637, 0.144254514044104, -0.119594790557632, 0.488630481309112, 0.146585935553368, 0.456692234320686},
+    {-0.0960538647466012, -0.0585120870225412, -0.0543309414249183, 0.75739729013635, 0.227214213208259, 0.224285389849452},
+    {-0.0603987775714152, -0.124504469204174, 0.271876837668966, 0.651676269947229, 0.19549860142211, 0.0658515377372834},
+    {-0.0217044058396818, -0.0643063527627086, 0.723813068870285, 0.273311911925214, 0.0819917787365634, 0.00689399907032823},
+    {-0.0409849230988147, 0.759842524889054, -0.036640207614552, 0.145727572487076, 0.00717255684496515, 0.164882476492272},
+    {-0.0347905350890822, 0.404143384962011, -0.119594790557632, 0.605418365816316, 0.0297980510461639, 0.115025523822223},
+    {-0.0249744559383749, 0.0382038937201699, -0.0543309414249183, 0.938423301877431, 0.0461882014671776, 0.0564900002985143},
+    {-0.0138776265525464, -0.121759885907613, 0.271876837668966, 0.807433832894958, 0.0397410384743823, 0.0165858034218535},
+    {-0.00457955736373816, -0.0762735703276687, 0.723813068870285, 0.338636367163553, 0.0166673234982245, 0.00173636815934466}};
+    
+    static const double FEA25_f0[25][3] = \
+    {{0.915147549378728, 0.0450425935698037, 0.0398098570514687},
+    {0.764365329781281, 0.0376212523451112, 0.198013417873608},
+    {0.535660544808143, 0.0263646449444709, 0.437974810247386},
+    {0.290249932250793, 0.0142857943955714, 0.695464273353636},
+    {0.09391279733378, 0.00462228846504642, 0.901464914201174},
+    {0.738611533396152, 0.221578609552379, 0.0398098570514687},
+    {0.616915871859002, 0.185070710267389, 0.198013417873608},
+    {0.43232925297036, 0.129695936782254, 0.437974810247386},
+    {0.234259434638082, 0.0702762920082817, 0.695464273353636},
+    {0.0757966027350624, 0.022738483063764, 0.901464914201174},
+    {0.480095071474266, 0.480095071474266, 0.0398098570514687},
+    {0.400993291063196, 0.400993291063196, 0.198013417873608},
+    {0.281012594876307, 0.281012594876307, 0.437974810247386},
+    {0.152267863323182, 0.152267863323182, 0.695464273353636},
+    {0.0492675428994133, 0.0492675428994132, 0.901464914201174},
+    {0.221578609552379, 0.738611533396152, 0.0398098570514687},
+    {0.185070710267389, 0.616915871859002, 0.198013417873608},
+    {0.129695936782254, 0.43232925297036, 0.437974810247386},
+    {0.0702762920082818, 0.234259434638082, 0.695464273353636},
+    {0.022738483063764, 0.0757966027350624, 0.901464914201174},
+    {0.0450425935698037, 0.915147549378728, 0.0398098570514687},
+    {0.0376212523451112, 0.764365329781281, 0.198013417873608},
+    {0.026364644944471, 0.535660544808143, 0.437974810247386},
+    {0.0142857943955714, 0.290249932250792, 0.695464273353636},
+    {0.00462228846504642, 0.09391279733378, 0.901464914201174}};
+    
+    // Reset values in the element tensor.
+    A[0] = 0.0;
+    // Number of operations to compute geometry constants: 5.
+    double G[5];
+    G[0] = 0.0625*det;
+    G[1] = 0.5*det;
+    G[2] = -0.5*det;
+    G[3] = 0.125*det;
+    G[4] = -0.125*det;
+    
+    // Compute element tensor using UFL quadrature representation
+    // Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
+    
+    // Loop quadrature points for integral.
+    
+    // Declare array to hold physical coordinate of quadrature point.
+    double X25[2];
+    // Number of operations to compute element tensor for following IP loop = 1175
+    for (unsigned int ip = 0; ip < 25; ip++)
+    {
+      
+      // Compute physical coordinate of quadrature point, operations: 10.
+      X25[0] = FEA25_f0[ip][0]*coordinate_dofs[0] +                  FEA25_f0[ip][1]*coordinate_dofs[2] + FEA25_f0[ip][2]*coordinate_dofs[4];
+      X25[1] = FEA25_f0[ip][0]*coordinate_dofs[1] +                  FEA25_f0[ip][1]*coordinate_dofs[3] + FEA25_f0[ip][2]*coordinate_dofs[5];
+      
+      // Coefficient declarations.
+      double F0 = 0.0;
+      
+      // Total number of operations to compute function values = 12
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        F0 += FE0[ip][r]*w[0][r];
+      } // end loop over 'r'
+      
+      // Number of operations to compute ip constants: 24
+      double I[1];
+      // Number of operations: 24
+      I[0] = W25[ip]*(G[0] + F0*(G[2] + F0*det) + X25[0]*X25[0]*(G[4] + F0*G[1] + G[0]*X25[0]*X25[0]) + X25[1]*X25[1]*(G[4] + F0*G[1] + G[0]*X25[1]*X25[1] + G[3]*X25[0]*X25[0]));
+      
+      
+      // Number of operations for primary indices: 1
+      // Number of operations to compute entry: 1
+      A[0] += I[0];
+    } // end loop over 'ip'
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
 
-  // Create standard function space (reference version)
-  FunctionSpace(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class poissondisc_form_0: public ufc::form
+{
+public:
+
+  poissondisc_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  FunctionSpace(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new velocity_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new velocity_dofmap_1()), *mesh, constrained_domain)))
+  ~poissondisc_form_0() override
   {
     // Do nothing
   }
 
-};
+  const char * signature() const final override
+  {
+    return "21290c0cad892d66dd172065a3b6ec583991ca086454c412fbe7c1e0cb0568c1adbe5ac1afa5a81f8fc80fb2c144ccc62b4537bcb016dcb6e329d78a30a6addf";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_coefficients() const final override
+  {
+    return 0;
+  }
+
+  std::size_t original_coefficient_position(std::size_t i) const final override
+  {
+    static const std::vector<std::size_t> position({});
+    return position[i];
+  }
+
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poissondisc_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poissondisc_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poissondisc_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poissondisc_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poissondisc_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poissondisc_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return new poissondisc_cell_integral_0_otherwise();
+  }
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
+  {
+    return 0;
+  }
+
+};
+
+
+class poissondisc_form_1: public ufc::form
+{
+public:
+
+  poissondisc_form_1() : ufc::form()
+  {
+    // Do nothing
+  }
+
+  ~poissondisc_form_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "1639ea954a577825d4f3f74f4c8e0580418ef0b1f81595cb1543ae574e2c9e0d0e0935ee5b48d343efc0875f3caa137a4e96ae645f45bf598b7ffeebfed045b7";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_coefficients() const final override
+  {
+    return 1;
+  }
+
+  std::size_t original_coefficient_position(std::size_t i) const final override
+  {
+    static const std::vector<std::size_t> position({0});
+    return position[i];
+  }
+
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poissondisc_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poissondisc_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poissondisc_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poissondisc_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poissondisc_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poissondisc_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return new poissondisc_cell_integral_1_otherwise();
+  }
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
+  {
+    return 0;
+  }
+
+};
+
+
+class poissondisc_form_2: public ufc::form
+{
+public:
+
+  poissondisc_form_2() : ufc::form()
+  {
+    // Do nothing
+  }
+
+  ~poissondisc_form_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "6456c8bdfdd4d9001a60caab106413dd1f7c344c9b7b8b3e1a5581fc0802e68834370ea5aecc963f4dc9bf8b2458a28efdf304d8f3c6a2dceda4420347f6085f";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t num_coefficients() const final override
+  {
+    return 1;
+  }
+
+  std::size_t original_coefficient_position(std::size_t i) const final override
+  {
+    static const std::vector<std::size_t> position({0});
+    return position[i];
+  }
+
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poissondisc_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poissondisc_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poissondisc_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poissondisc_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return new poissondisc_cell_integral_2_otherwise();
+  }
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
+  {
+    return 0;
+  }
+
+};
+
+// DOLFIN wrappers
+
+// Standard library includes
+#include <string>
+
+// DOLFIN includes
+#include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
+#include <dolfin/fem/FiniteElement.h>
+#include <dolfin/fem/DofMap.h>
+#include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
+#include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
+#include <dolfin/function/GenericFunction.h>
+#include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
+#include <dolfin/adaptivity/ErrorControl.h>
+#include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
+
+namespace PoissonDisc
+{
+
+class CoefficientSpace_f: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh))
+  {
+    // Do nothing
+  }
+
+  // Constructor for constrained function space
+  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh, constrained_domain))
+  {
+    // Do nothing
+  }
+
+};
+
+class CoefficientSpace_uh: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  CoefficientSpace_uh(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh))
+  {
+    // Do nothing
+  }
+
+  // Constructor for constrained function space
+  CoefficientSpace_uh(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh, constrained_domain))
+  {
+    // Do nothing
+  }
+
+};
+
+class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh))
+  {
+    // Do nothing
+  }
+
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh, constrained_domain))
+  {
+    // Do nothing
+  }
+
+};
+
+class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh))
+  {
+    // Do nothing
+  }
+
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh, constrained_domain))
+  {
+    // Do nothing
+  }
+
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
+  // Constructor
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
+    dolfin::Form(2, 0)
+  {
+    _function_spaces[0] = V0;
+    _function_spaces[1] = V1;
+
+    _ufc_form = std::make_shared<const poissondisc_form_0>();
+  }
+
+  // Destructor
+  ~Form_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh))
+  {
+    // Do nothing
+  }
+
+  // Constructor for constrained function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poissondisc_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poissondisc_dofmap_0>(), *mesh, constrained_domain))
+  {
+    // Do nothing
+  }
+
+};
+
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
+typedef CoefficientSpace_f Form_L_FunctionSpace_1;
+
+class Form_L: public dolfin::Form
+{
+public:
+
+  // Constructor
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
+    dolfin::Form(1, 1), f(*this, 0)
+  {
+    _function_spaces[0] = V0;
+
+    _ufc_form = std::make_shared<const poissondisc_form_1>();
+  }
+
+  // Constructor
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::Form(1, 1), f(*this, 0)
+  {
+    _function_spaces[0] = V0;
+
+    this->f = f;
+
+    _ufc_form = std::make_shared<const poissondisc_form_1>();
+  }
+
+  // Destructor
+  ~Form_L()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Constructor
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_L()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::MultiMeshCoefficientAssigner f;
+};
+
+typedef CoefficientSpace_uh Form_M_FunctionSpace_0;
+
+class Form_M: public dolfin::Form
+{
+public:
+
+  // Constructor
+  Form_M(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::Form(0, 1), uh(*this, 0)
+  {
+    _mesh = mesh;
+    _ufc_form = std::make_shared<const poissondisc_form_2>();
+  }
+
+  // Constructor
+  Form_M(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> uh):
+    dolfin::Form(0, 1), uh(*this, 0)
+  {
+    _mesh = mesh;
+    this->uh = uh;
+
+    _ufc_form = std::make_shared<const poissondisc_form_2>();
+  }
+
+  // Destructor
+  ~Form_M()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "uh")
+      return 0;
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "uh";
+    }
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_M_FunctionSpace_0 CoefficientSpace_uh;
+
+  // Coefficients
+  dolfin::CoefficientAssigner uh;
+};
+
+class MultiMeshForm_M: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_M(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::MultiMeshForm(), uh(*this, 0)
+  {
+
+    /// Assign coefficients
+
+  }
+
+  // Constructor
+  MultiMeshForm_M(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> uh):
+    dolfin::MultiMeshForm(), uh(*this, 0)
+  {
+
+    /// Assign coefficients    this->uh = uh;
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_M()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "uh")
+      return 0;
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+    switch (i)
+    {
+    case 0:
+      return "uh";
+    }
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_M_FunctionSpace_0 CoefficientSpace_uh;
+
+  // Coefficients
+  dolfin::MultiMeshCoefficientAssigner uh;
+};
+
+// Class typedefs
+typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
+typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
+typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
+typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
+typedef Form_M Functional;
+typedef MultiMeshForm_M MultiMeshFunctional;
+typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/poisson-disc/cpp/PoissonDisc.ufl b/demo/undocumented/poisson-disc/cpp/PoissonDisc.ufl
new file mode 100644
index 0000000..0097999
--- /dev/null
+++ b/demo/undocumented/poisson-disc/cpp/PoissonDisc.ufl
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2015-2015 Martin Sandve Alnæs
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# The bilinear form a(u, v) and linear form L(v) for
+# Poisson's equation with quadratic isoparametric elements.
+#
+# Compile this form with FFC: ffc -r uflacs -l dolfin PoissonDisc.ufl
+
+# Solving
+# -laplace u = 1
+# u(r=1) = 0
+
+degree = 2
+cell = triangle
+
+coordinate_element = VectorElement("Lagrange", cell, degree)
+mesh = Mesh(coordinate_element)
+
+element = FiniteElement("Lagrange", cell, degree)
+V = FunctionSpace(mesh, element)
+
+u = TrialFunction(V)
+v = TestFunction(V)
+
+x = SpatialCoordinate(mesh)
+
+f = Coefficient(V)
+
+# Variational formulation
+a = dot(grad(u), grad(v))*dx
+L = f*v*dx
+
+# Exact solution
+uexact = (1.0 - x**2) / 4.0
+
+# Error norm functional
+uh = Coefficient(V)
+M = (uh - uexact)**2*dx
diff --git a/demo/undocumented/poisson-disc/cpp/compile.log b/demo/undocumented/poisson-disc/cpp/compile.log
new file mode 100644
index 0000000..f9a6e24
--- /dev/null
+++ b/demo/undocumented/poisson-disc/cpp/compile.log
@@ -0,0 +1,2073 @@
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
+
+Compiling form PoissonDisc
+
+Compiler stage 1: Analyzing form(s)
+-----------------------------------
+  
+  Geometric dimension:       2
+  Number of cell subdomains: 0
+  Rank:                      2
+  Arguments:                 '(v_0, v_1)'
+  Number of coefficients:    0
+  Coefficients:              '[]'
+  Unique elements:           'CG2(?), Vector<2 x CG2(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG2(?)>'
+  
+  Extracting monomial form representation from UFL form
+  Transforming monomial form to reference element
+  Reusing element from cache
+  Estimated cost of tensor representation: 2
+  representation:    auto --> tensor
+  quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
+  
+  Geometric dimension:       2
+  Number of cell subdomains: 0
+  Rank:                      1
+  Arguments:                 '(v_0)'
+  Number of coefficients:    1
+  Coefficients:              '[w_0]'
+  Unique elements:           'CG2(?), Vector<2 x CG2(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG2(?)>'
+  
+  Extracting monomial form representation from UFL form
+  Transforming monomial form to reference element
+  Reusing element from cache
+  Reusing element from cache
+  Estimated cost of tensor representation: 1
+  representation:    auto --> tensor
+  quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
+  
+  Geometric dimension:       2
+  Number of cell subdomains: 0
+  Rank:                      0
+  Arguments:                 '()'
+  Number of coefficients:    1
+  Coefficients:              '[w_1]'
+  Unique elements:           'CG2(?), Vector<2 x CG2(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG2(?)>'
+  
+  Extracting monomial form representation from UFL form
+  Monomial extraction failed: No handler defined for terminal SpatialCoordinate.
+  Estimated cost of tensor representation: -1
+  representation:    auto --> quadrature
+  quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 8
+  quadrature_degree: 8
+  
+Compiler stage 1 finished in 0.189914 seconds.
+
+Compiler stage 2: Computing intermediate representation
+-------------------------------------------------------
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
+  Computing representation of integrals
+  Computing tensor representation
+  Extracting monomial form representation from UFL form
+  Transforming monomial form to reference element
+  Reusing element from cache
+  Reusing element from cache
+  Precomputing integrals on reference element
+  Reusing element from cache
+  144 entries computed in 0.000918 seconds
+  Shape of reference tensor: (6, 6, 2, 2)
+  Primary multi index:   rank = 2 dims = [6, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5]]
+  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
+  Internal multi index:  rank = 0 dims = [] indices = [[]]
+  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
+  External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
+  Reusing element from cache
+  Reusing element from cache
+  Computing tensor representation
+  Extracting monomial form representation from UFL form
+  Transforming monomial form to reference element
+  Reusing element from cache
+  Reusing element from cache
+  Precomputing integrals on reference element
+  Reusing element from cache
+  36 entries computed in 0.000833 seconds
+  Shape of reference tensor: (6, 6)
+  Primary multi index:   rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  Internal multi index:  rank = 0 dims = [] indices = [[]]
+  Secondary multi index: rank = 1 dims = [6] indices = [[0], [1], [2], [3], [4], [5]]
+  External multi index:  rank = 0 dims = [] indices = [[]]
+  Reusing element from cache
+  Reusing element from cache
+  Computing quadrature representation
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  
+  QG-utils, psi_tables:
+  {25: {VectorElement(FiniteElement('Lagrange', triangle, 2), dim=2): {None: {None: {(0, 1): array([[[ -2.66059020e+00,  -2.05746132e+00,  -1.14264218e+00,
+            -1.60999729e-01,   6.24348811e-01,  -1.95444613e+00,
+            -1.46766349e+00,  -7.29317012e-01,   6.29622614e-02,
+             6.96813589e-01,  -9.20380286e-01,  -6.03973164e-01,
+            -1.24050380e-01,   3.90928547e-01,   8.02929828e-01,
+             1.13685562e-01,   2.59717159e-01,   4.81216253e-01,
+             7.18894832e-01,   9.09046068e-01,   8.19829626e-01,
+             8.49514991e-01,   8.94541420e-01,   9.42856822e-01,
+             9.81510846e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  4.77395901e-15,   5.66213743e-15,   6.45317133e-15,
+             6.77236045e-15,   6.77236045e-15,   5.49560397e-15,
+             6.32827124e-15,   6.97358837e-15,   7.04991621e-15,
+             6.77236045e-15,   6.66133815e-15,   7.16093851e-15,
+             7.61196661e-15,   7.49400542e-15,   6.99440506e-15,
+             7.38298311e-15,   7.99360578e-15,   8.10462808e-15,
+             7.77156117e-15,   7.10542736e-15,   7.88258347e-15,
+             8.49320614e-15,   8.66667849e-15,   7.99360578e-15,
+             7.10542736e-15],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[ -8.40760572e-01,  -2.07946329e-01,   7.51899241e-01,
+             1.78185709e+00,   2.60585966e+00,  -8.40760572e-01,
+            -2.07946329e-01,   7.51899241e-01,   1.78185709e+00,
+             2.60585966e+00,  -8.40760572e-01,  -2.07946329e-01,
+             7.51899241e-01,   1.78185709e+00,   2.60585966e+00,
+            -8.40760572e-01,  -2.07946329e-01,   7.51899241e-01,
+             1.78185709e+00,   2.60585966e+00,  -8.40760572e-01,
+            -2.07946329e-01,   7.51899241e-01,   1.78185709e+00,
+             2.60585966e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  1.80170374e-01,   1.50485009e-01,   1.05458580e-01,
+             5.71431776e-02,   1.84891539e-02,   8.86314438e-01,
+             7.40282841e-01,   5.18783747e-01,   2.81105168e-01,
+             9.09539323e-02,   1.92038029e+00,   1.60397316e+00,
+             1.12405038e+00,   6.09071453e-01,   1.97070172e-01,
+             2.95444613e+00,   2.46766349e+00,   1.72931701e+00,
+             9.37037739e-01,   3.03186411e-01,   3.66059020e+00,
+             3.05746132e+00,   2.14264218e+00,   1.16099973e+00,
+             3.75651189e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  3.50135077e+00,   2.26540765e+00,   3.90742938e-01,
+            -1.62085736e+00,  -3.23020847e+00,   2.79520671e+00,
+             1.67560982e+00,  -2.25822291e-02,  -1.84481935e+00,
+            -3.30267325e+00,   1.76114086e+00,   8.11919493e-01,
+            -6.27848861e-01,  -2.17278564e+00,  -3.40878949e+00,
+             7.27075010e-01,  -5.17708304e-02,  -1.23311549e+00,
+            -2.50075193e+00,  -3.51490572e+00,   2.09309461e-02,
+            -6.41568662e-01,  -1.64644066e+00,  -2.72471392e+00,
+            -3.58737050e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[ -1.80170374e-01,  -1.50485009e-01,  -1.05458580e-01,
+            -5.71431776e-02,  -1.84891539e-02,  -8.86314438e-01,
+            -7.40282841e-01,  -5.18783747e-01,  -2.81105168e-01,
+            -9.09539323e-02,  -1.92038029e+00,  -1.60397316e+00,
+            -1.12405038e+00,  -6.09071453e-01,  -1.97070172e-01,
+            -2.95444613e+00,  -2.46766349e+00,  -1.72931701e+00,
+            -9.37037739e-01,  -3.03186411e-01,  -3.66059020e+00,
+            -3.05746132e+00,  -2.14264218e+00,  -1.16099973e+00,
+            -3.75651189e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -2.66059020e+00,  -2.05746132e+00,  -1.14264218e+00,
+            -1.60999729e-01,   6.24348811e-01,  -1.95444613e+00,
+            -1.46766349e+00,  -7.29317012e-01,   6.29622614e-02,
+             6.96813589e-01,  -9.20380286e-01,  -6.03973164e-01,
+            -1.24050380e-01,   3.90928547e-01,   8.02929828e-01,
+             1.13685562e-01,   2.59717159e-01,   4.81216253e-01,
+             7.18894832e-01,   9.09046068e-01,   8.19829626e-01,
+             8.49514991e-01,   8.94541420e-01,   9.42856822e-01,
+             9.81510846e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  4.77395901e-15,   5.66213743e-15,   6.45317133e-15,
+             6.77236045e-15,   6.77236045e-15,   5.49560397e-15,
+             6.32827124e-15,   6.97358837e-15,   7.04991621e-15,
+             6.77236045e-15,   6.66133815e-15,   7.16093851e-15,
+             7.61196661e-15,   7.49400542e-15,   6.99440506e-15,
+             7.38298311e-15,   7.99360578e-15,   8.10462808e-15,
+             7.77156117e-15,   7.10542736e-15,   7.88258347e-15,
+             8.49320614e-15,   8.66667849e-15,   7.99360578e-15,
+             7.10542736e-15]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -8.40760572e-01,  -2.07946329e-01,   7.51899241e-01,
+             1.78185709e+00,   2.60585966e+00,  -8.40760572e-01,
+            -2.07946329e-01,   7.51899241e-01,   1.78185709e+00,
+             2.60585966e+00,  -8.40760572e-01,  -2.07946329e-01,
+             7.51899241e-01,   1.78185709e+00,   2.60585966e+00,
+            -8.40760572e-01,  -2.07946329e-01,   7.51899241e-01,
+             1.78185709e+00,   2.60585966e+00,  -8.40760572e-01,
+            -2.07946329e-01,   7.51899241e-01,   1.78185709e+00,
+             2.60585966e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  1.80170374e-01,   1.50485009e-01,   1.05458580e-01,
+             5.71431776e-02,   1.84891539e-02,   8.86314438e-01,
+             7.40282841e-01,   5.18783747e-01,   2.81105168e-01,
+             9.09539323e-02,   1.92038029e+00,   1.60397316e+00,
+             1.12405038e+00,   6.09071453e-01,   1.97070172e-01,
+             2.95444613e+00,   2.46766349e+00,   1.72931701e+00,
+             9.37037739e-01,   3.03186411e-01,   3.66059020e+00,
+             3.05746132e+00,   2.14264218e+00,   1.16099973e+00,
+             3.75651189e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  3.50135077e+00,   2.26540765e+00,   3.90742938e-01,
+            -1.62085736e+00,  -3.23020847e+00,   2.79520671e+00,
+             1.67560982e+00,  -2.25822291e-02,  -1.84481935e+00,
+            -3.30267325e+00,   1.76114086e+00,   8.11919493e-01,
+            -6.27848861e-01,  -2.17278564e+00,  -3.40878949e+00,
+             7.27075010e-01,  -5.17708304e-02,  -1.23311549e+00,
+            -2.50075193e+00,  -3.51490572e+00,   2.09309461e-02,
+            -6.41568662e-01,  -1.64644066e+00,  -2.72471392e+00,
+            -3.58737050e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -1.80170374e-01,  -1.50485009e-01,  -1.05458580e-01,
+            -5.71431776e-02,  -1.84891539e-02,  -8.86314438e-01,
+            -7.40282841e-01,  -5.18783747e-01,  -2.81105168e-01,
+            -9.09539323e-02,  -1.92038029e+00,  -1.60397316e+00,
+            -1.12405038e+00,  -6.09071453e-01,  -1.97070172e-01,
+            -2.95444613e+00,  -2.46766349e+00,  -1.72931701e+00,
+            -9.37037739e-01,  -3.03186411e-01,  -3.66059020e+00,
+            -3.05746132e+00,  -2.14264218e+00,  -1.16099973e+00,
+            -3.75651189e-01]]]), (1, 0): array([[[ -2.66059020e+00,  -2.05746132e+00,  -1.14264218e+00,
+            -1.60999729e-01,   6.24348811e-01,  -1.95444613e+00,
+            -1.46766349e+00,  -7.29317012e-01,   6.29622614e-02,
+             6.96813589e-01,  -9.20380286e-01,  -6.03973164e-01,
+            -1.24050380e-01,   3.90928547e-01,   8.02929828e-01,
+             1.13685562e-01,   2.59717159e-01,   4.81216253e-01,
+             7.18894832e-01,   9.09046068e-01,   8.19829626e-01,
+             8.49514991e-01,   8.94541420e-01,   9.42856822e-01,
+             9.81510846e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[ -8.19829626e-01,  -8.49514991e-01,  -8.94541420e-01,
+            -9.42856822e-01,  -9.81510846e-01,  -1.13685562e-01,
+            -2.59717159e-01,  -4.81216253e-01,  -7.18894832e-01,
+            -9.09046068e-01,   9.20380286e-01,   6.03973164e-01,
+             1.24050380e-01,  -3.90928547e-01,  -8.02929828e-01,
+             1.95444613e+00,   1.46766349e+00,   7.29317012e-01,
+            -6.29622614e-02,  -6.96813589e-01,   2.66059020e+00,
+             2.05746132e+00,   1.14264218e+00,   1.60999729e-01,
+            -6.24348811e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  1.59239428e-01,   7.92053671e-01,   1.75189924e+00,
+             2.78185709e+00,   3.60585966e+00,   1.59239428e-01,
+             7.92053671e-01,   1.75189924e+00,   2.78185709e+00,
+             3.60585966e+00,   1.59239428e-01,   7.92053671e-01,
+             1.75189924e+00,   2.78185709e+00,   3.60585966e+00,
+             1.59239428e-01,   7.92053671e-01,   1.75189924e+00,
+             2.78185709e+00,   3.60585966e+00,   1.59239428e-01,
+             7.92053671e-01,   1.75189924e+00,   2.78185709e+00,
+             3.60585966e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[ -1.59239428e-01,  -7.92053671e-01,  -1.75189924e+00,
+            -2.78185709e+00,  -3.60585966e+00,  -1.59239428e-01,
+            -7.92053671e-01,  -1.75189924e+00,  -2.78185709e+00,
+            -3.60585966e+00,  -1.59239428e-01,  -7.92053671e-01,
+            -1.75189924e+00,  -2.78185709e+00,  -3.60585966e+00,
+            -1.59239428e-01,  -7.92053671e-01,  -1.75189924e+00,
+            -2.78185709e+00,  -3.60585966e+00,  -1.59239428e-01,
+            -7.92053671e-01,  -1.75189924e+00,  -2.78185709e+00,
+            -3.60585966e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  3.48041982e+00,   2.90697631e+00,   2.03718360e+00,
+             1.10385655e+00,   3.57162035e-01,   2.06813170e+00,
+             1.72738065e+00,   1.21053326e+00,   6.55932571e-01,
+             2.12232479e-01,  -6.05707591e-16,  -6.91411119e-16,
+            -4.13363917e-16,  -1.03919888e-16,   3.29516530e-16,
+            -2.06813170e+00,  -1.72738065e+00,  -1.21053326e+00,
+            -6.55932571e-01,  -2.12232479e-01,  -3.48041982e+00,
+            -2.90697631e+00,  -2.03718360e+00,  -1.10385655e+00,
+            -3.57162035e-01],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -2.66059020e+00,  -2.05746132e+00,  -1.14264218e+00,
+            -1.60999729e-01,   6.24348811e-01,  -1.95444613e+00,
+            -1.46766349e+00,  -7.29317012e-01,   6.29622614e-02,
+             6.96813589e-01,  -9.20380286e-01,  -6.03973164e-01,
+            -1.24050380e-01,   3.90928547e-01,   8.02929828e-01,
+             1.13685562e-01,   2.59717159e-01,   4.81216253e-01,
+             7.18894832e-01,   9.09046068e-01,   8.19829626e-01,
+             8.49514991e-01,   8.94541420e-01,   9.42856822e-01,
+             9.81510846e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -8.19829626e-01,  -8.49514991e-01,  -8.94541420e-01,
+            -9.42856822e-01,  -9.81510846e-01,  -1.13685562e-01,
+            -2.59717159e-01,  -4.81216253e-01,  -7.18894832e-01,
+            -9.09046068e-01,   9.20380286e-01,   6.03973164e-01,
+             1.24050380e-01,  -3.90928547e-01,  -8.02929828e-01,
+             1.95444613e+00,   1.46766349e+00,   7.29317012e-01,
+            -6.29622614e-02,  -6.96813589e-01,   2.66059020e+00,
+             2.05746132e+00,   1.14264218e+00,   1.60999729e-01,
+            -6.24348811e-01]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  1.59239428e-01,   7.92053671e-01,   1.75189924e+00,
+             2.78185709e+00,   3.60585966e+00,   1.59239428e-01,
+             7.92053671e-01,   1.75189924e+00,   2.78185709e+00,
+             3.60585966e+00,   1.59239428e-01,   7.92053671e-01,
+             1.75189924e+00,   2.78185709e+00,   3.60585966e+00,
+             1.59239428e-01,   7.92053671e-01,   1.75189924e+00,
+             2.78185709e+00,   3.60585966e+00,   1.59239428e-01,
+             7.92053671e-01,   1.75189924e+00,   2.78185709e+00,
+             3.60585966e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [ -1.59239428e-01,  -7.92053671e-01,  -1.75189924e+00,
+            -2.78185709e+00,  -3.60585966e+00,  -1.59239428e-01,
+            -7.92053671e-01,  -1.75189924e+00,  -2.78185709e+00,
+            -3.60585966e+00,  -1.59239428e-01,  -7.92053671e-01,
+            -1.75189924e+00,  -2.78185709e+00,  -3.60585966e+00,
+            -1.59239428e-01,  -7.92053671e-01,  -1.75189924e+00,
+            -2.78185709e+00,  -3.60585966e+00,  -1.59239428e-01,
+            -7.92053671e-01,  -1.75189924e+00,  -2.78185709e+00,
+            -3.60585966e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00],
+          [  3.48041982e+00,   2.90697631e+00,   2.03718360e+00,
+             1.10385655e+00,   3.57162035e-01,   2.06813170e+00,
+             1.72738065e+00,   1.21053326e+00,   6.55932571e-01,
+             2.12232479e-01,  -6.05707591e-16,  -6.91411119e-16,
+            -4.13363917e-16,  -1.03919888e-16,   3.29516530e-16,
+            -2.06813170e+00,  -1.72738065e+00,  -1.21053326e+00,
+            -6.55932571e-01,  -2.12232479e-01,  -3.48041982e+00,
+            -2.90697631e+00,  -2.03718360e+00,  -1.10385655e+00,
+            -3.57162035e-01]]]), (0, 0): array([[[ 0.75984252,  0.40414338,  0.03820389, -0.12175989, -0.07627357,
+            0.35248246,  0.14425451, -0.05851209, -0.12450447, -0.06430635,
+           -0.01911252, -0.07940205, -0.12307644, -0.10589686, -0.04441296,
+           -0.12338445, -0.11656837, -0.09605386, -0.06039878, -0.02170441,
+           -0.04098492, -0.03479054, -0.02497446, -0.01387763, -0.00457956],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
+  
+         [[-0.04098492, -0.03479054, -0.02497446, -0.01387763, -0.00457956,
+           -0.12338445, -0.11656837, -0.09605386, -0.06039878, -0.02170441,
+           -0.01911252, -0.07940205, -0.12307644, -0.10589686, -0.04441296,
+            0.35248246,  0.14425451, -0.05851209, -0.12450447, -0.06430635,
+            0.75984252,  0.40414338,  0.03820389, -0.12175989, -0.07627357],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
+  
+         [[-0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+           -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+           -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+           -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+           -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.00717256,  0.02979805,  0.0461882 ,  0.03974104,  0.01666732,
+            0.03528405,  0.14658594,  0.22721421,  0.1954986 ,  0.08199178,
+            0.07645006,  0.31760821,  0.49230575,  0.42358744,  0.17765185,
+            0.11761608,  0.48863048,  0.75739729,  0.65167627,  0.27331191,
+            0.14572757,  0.60541837,  0.9384233 ,  0.80743383,  0.33863637],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.14572757,  0.60541837,  0.9384233 ,  0.80743383,  0.33863637,
+            0.11761608,  0.48863048,  0.75739729,  0.65167627,  0.27331191,
+            0.07645006,  0.31760821,  0.49230575,  0.42358744,  0.17765185,
+            0.03528405,  0.14658594,  0.22721421,  0.1954986 ,  0.08199178,
+            0.00717256,  0.02979805,  0.0461882 ,  0.03974104,  0.01666732],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.16488248,  0.11502552,  0.05649   ,  0.0165858 ,  0.00173637,
+            0.65464207,  0.45669223,  0.22428539,  0.06585154,  0.006894  ,
+            0.92196511,  0.64318248,  0.31587231,  0.09274201,  0.00970916,
+            0.65464207,  0.45669223,  0.22428539,  0.06585154,  0.006894  ,
+            0.16488248,  0.11502552,  0.05649   ,  0.0165858 ,  0.00173637],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+          [ 0.75984252,  0.40414338,  0.03820389, -0.12175989, -0.07627357,
+            0.35248246,  0.14425451, -0.05851209, -0.12450447, -0.06430635,
+           -0.01911252, -0.07940205, -0.12307644, -0.10589686, -0.04441296,
+           -0.12338445, -0.11656837, -0.09605386, -0.06039878, -0.02170441,
+           -0.04098492, -0.03479054, -0.02497446, -0.01387763, -0.00457956]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+          [-0.04098492, -0.03479054, -0.02497446, -0.01387763, -0.00457956,
+           -0.12338445, -0.11656837, -0.09605386, -0.06039878, -0.02170441,
+           -0.01911252, -0.07940205, -0.12307644, -0.10589686, -0.04441296,
+            0.35248246,  0.14425451, -0.05851209, -0.12450447, -0.06430635,
+            0.75984252,  0.40414338,  0.03820389, -0.12175989, -0.07627357]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+          [-0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+           -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+           -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+           -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+           -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+          [ 0.00717256,  0.02979805,  0.0461882 ,  0.03974104,  0.01666732,
+            0.03528405,  0.14658594,  0.22721421,  0.1954986 ,  0.08199178,
+            0.07645006,  0.31760821,  0.49230575,  0.42358744,  0.17765185,
+            0.11761608,  0.48863048,  0.75739729,  0.65167627,  0.27331191,
+            0.14572757,  0.60541837,  0.9384233 ,  0.80743383,  0.33863637]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+          [ 0.14572757,  0.60541837,  0.9384233 ,  0.80743383,  0.33863637,
+            0.11761608,  0.48863048,  0.75739729,  0.65167627,  0.27331191,
+            0.07645006,  0.31760821,  0.49230575,  0.42358744,  0.17765185,
+            0.03528405,  0.14658594,  0.22721421,  0.1954986 ,  0.08199178,
+            0.00717256,  0.02979805,  0.0461882 ,  0.03974104,  0.01666732]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ,  0.        ,  0.        ,  0.        ,  0.        ],
+          [ 0.16488248,  0.11502552,  0.05649   ,  0.0165858 ,  0.00173637,
+            0.65464207,  0.45669223,  0.22428539,  0.06585154,  0.006894  ,
+            0.92196511,  0.64318248,  0.31587231,  0.09274201,  0.00970916,
+            0.65464207,  0.45669223,  0.22428539,  0.06585154,  0.006894  ,
+            0.16488248,  0.11502552,  0.05649   ,  0.0165858 ,  0.00173637]]])}}}, FiniteElement('Lagrange', triangle, 2): {None: {None: {(0, 0): array([[ 0.75984252,  0.40414338,  0.03820389, -0.12175989, -0.07627357,
+           0.35248246,  0.14425451, -0.05851209, -0.12450447, -0.06430635,
+          -0.01911252, -0.07940205, -0.12307644, -0.10589686, -0.04441296,
+          -0.12338445, -0.11656837, -0.09605386, -0.06039878, -0.02170441,
+          -0.04098492, -0.03479054, -0.02497446, -0.01387763, -0.00457956],
+         [-0.04098492, -0.03479054, -0.02497446, -0.01387763, -0.00457956,
+          -0.12338445, -0.11656837, -0.09605386, -0.06039878, -0.02170441,
+          -0.01911252, -0.07940205, -0.12307644, -0.10589686, -0.04441296,
+           0.35248246,  0.14425451, -0.05851209, -0.12450447, -0.06430635,
+           0.75984252,  0.40414338,  0.03820389, -0.12175989, -0.07627357],
+         [-0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+          -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+          -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+          -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307,
+          -0.03664021, -0.11959479, -0.05433094,  0.27187684,  0.72381307],
+         [ 0.00717256,  0.02979805,  0.0461882 ,  0.03974104,  0.01666732,
+           0.03528405,  0.14658594,  0.22721421,  0.1954986 ,  0.08199178,
+           0.07645006,  0.31760821,  0.49230575,  0.42358744,  0.17765185,
+           0.11761608,  0.48863048,  0.75739729,  0.65167627,  0.27331191,
+           0.14572757,  0.60541837,  0.9384233 ,  0.80743383,  0.33863637],
+         [ 0.14572757,  0.60541837,  0.9384233 ,  0.80743383,  0.33863637,
+           0.11761608,  0.48863048,  0.75739729,  0.65167627,  0.27331191,
+           0.07645006,  0.31760821,  0.49230575,  0.42358744,  0.17765185,
+           0.03528405,  0.14658594,  0.22721421,  0.1954986 ,  0.08199178,
+           0.00717256,  0.02979805,  0.0461882 ,  0.03974104,  0.01666732],
+         [ 0.16488248,  0.11502552,  0.05649   ,  0.0165858 ,  0.00173637,
+           0.65464207,  0.45669223,  0.22428539,  0.06585154,  0.006894  ,
+           0.92196511,  0.64318248,  0.31587231,  0.09274201,  0.00970916,
+           0.65464207,  0.45669223,  0.22428539,  0.06585154,  0.006894  ,
+           0.16488248,  0.11502552,  0.05649   ,  0.0165858 ,  0.00173637]])}}}}}
+  
+  QG-utils, psi_tables, flat_tables:
+  {'FE1_C0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
+           0.16488248,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.40414338, -0.03479054, -0.11959479,  0.02979805,  0.60541837,
+           0.11502552,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.03820389, -0.02497446, -0.05433094,  0.0461882 ,  0.9384233 ,
+           0.05649   ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.12175989, -0.01387763,  0.27187684,  0.03974104,  0.80743383,
+           0.0165858 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.07627357, -0.00457956,  0.72381307,  0.01666732,  0.33863637,
+           0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.35248246, -0.12338445, -0.03664021,  0.03528405,  0.11761608,
+           0.65464207,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.14425451, -0.11656837, -0.11959479,  0.14658594,  0.48863048,
+           0.45669223,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.05851209, -0.09605386, -0.05433094,  0.22721421,  0.75739729,
+           0.22428539,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.12450447, -0.06039878,  0.27187684,  0.1954986 ,  0.65167627,
+           0.06585154,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.06430635, -0.02170441,  0.72381307,  0.08199178,  0.27331191,
+           0.006894  ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.01911252, -0.01911252, -0.03664021,  0.07645006,  0.07645006,
+           0.92196511,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.07940205, -0.07940205, -0.11959479,  0.31760821,  0.31760821,
+           0.64318248,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.12307644, -0.12307644, -0.05433094,  0.49230575,  0.49230575,
+           0.31587231,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.10589686, -0.10589686,  0.27187684,  0.42358744,  0.42358744,
+           0.09274201,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.04441296, -0.04441296,  0.72381307,  0.17765185,  0.17765185,
+           0.00970916,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.12338445,  0.35248246, -0.03664021,  0.11761608,  0.03528405,
+           0.65464207,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.11656837,  0.14425451, -0.11959479,  0.48863048,  0.14658594,
+           0.45669223,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.09605386, -0.05851209, -0.05433094,  0.75739729,  0.22721421,
+           0.22428539,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.06039878, -0.12450447,  0.27187684,  0.65167627,  0.1954986 ,
+           0.06585154,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.02170441, -0.06430635,  0.72381307,  0.27331191,  0.08199178,
+           0.006894  ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.04098492,  0.75984252, -0.03664021,  0.14572757,  0.00717256,
+           0.16488248,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.03479054,  0.40414338, -0.11959479,  0.60541837,  0.02979805,
+           0.11502552,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.02497446,  0.03820389, -0.05433094,  0.9384233 ,  0.0461882 ,
+           0.05649   ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.01387763, -0.12175989,  0.27187684,  0.80743383,  0.03974104,
+           0.0165858 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
+           0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.75984252, -0.04098492, -0.03664021,  0.00717256,
+           0.14572757,  0.16488248],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.40414338, -0.03479054, -0.11959479,  0.02979805,
+           0.60541837,  0.11502552],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.03820389, -0.02497446, -0.05433094,  0.0461882 ,
+           0.9384233 ,  0.05649   ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12175989, -0.01387763,  0.27187684,  0.03974104,
+           0.80743383,  0.0165858 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.07627357, -0.00457956,  0.72381307,  0.01666732,
+           0.33863637,  0.00173637],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.35248246, -0.12338445, -0.03664021,  0.03528405,
+           0.11761608,  0.65464207],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.14425451, -0.11656837, -0.11959479,  0.14658594,
+           0.48863048,  0.45669223],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.05851209, -0.09605386, -0.05433094,  0.22721421,
+           0.75739729,  0.22428539],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12450447, -0.06039878,  0.27187684,  0.1954986 ,
+           0.65167627,  0.06585154],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.06430635, -0.02170441,  0.72381307,  0.08199178,
+           0.27331191,  0.006894  ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.01911252, -0.01911252, -0.03664021,  0.07645006,
+           0.07645006,  0.92196511],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.07940205, -0.07940205, -0.11959479,  0.31760821,
+           0.31760821,  0.64318248],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12307644, -0.12307644, -0.05433094,  0.49230575,
+           0.49230575,  0.31587231],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.10589686, -0.10589686,  0.27187684,  0.42358744,
+           0.42358744,  0.09274201],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04441296, -0.04441296,  0.72381307,  0.17765185,
+           0.17765185,  0.00970916],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12338445,  0.35248246, -0.03664021,  0.11761608,
+           0.03528405,  0.65464207],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.11656837,  0.14425451, -0.11959479,  0.48863048,
+           0.14658594,  0.45669223],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.09605386, -0.05851209, -0.05433094,  0.75739729,
+           0.22721421,  0.22428539],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.06039878, -0.12450447,  0.27187684,  0.65167627,
+           0.1954986 ,  0.06585154],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02170441, -0.06430635,  0.72381307,  0.27331191,
+           0.08199178,  0.006894  ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04098492,  0.75984252, -0.03664021,  0.14572757,
+           0.00717256,  0.16488248],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.03479054,  0.40414338, -0.11959479,  0.60541837,
+           0.02979805,  0.11502552],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02497446,  0.03820389, -0.05433094,  0.9384233 ,
+           0.0461882 ,  0.05649   ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.01387763, -0.12175989,  0.27187684,  0.80743383,
+           0.03974104,  0.0165858 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.00457956, -0.07627357,  0.72381307,  0.33863637,
+           0.01666732,  0.00173637]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   3.48041982e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.05746132e+00,  -8.49514991e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   2.90697631e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.14264218e+00,  -8.94541420e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   2.03718360e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.60999729e-01,  -9.42856822e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   1.10385655e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.24348811e-01,  -9.81510846e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.57162035e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.95444613e+00,  -1.13685562e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   2.06813170e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.46766349e+00,  -2.59717159e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   1.72738065e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -7.29317012e-01,  -4.81216253e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   1.21053326e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.29622614e-02,  -7.18894832e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   6.55932571e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.96813589e-01,  -9.09046068e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   2.12232479e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.13685562e-01,   1.95444613e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -2.06813170e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.59717159e-01,   1.46766349e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -1.72738065e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.81216253e-01,   7.29317012e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -1.21053326e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.18894832e-01,  -6.29622614e-02,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -6.55932571e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.09046068e-01,  -6.96813589e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -2.12232479e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.19829626e-01,   2.66059020e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -3.48041982e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.49514991e-01,   2.05746132e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -2.90697631e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.94541420e-01,   1.14264218e+00,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -2.03718360e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.42856822e-01,   1.60999729e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.10385655e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.81510846e-01,  -6.24348811e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01]]), 'FE0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
+           0.16488248],
+         [ 0.40414338, -0.03479054, -0.11959479,  0.02979805,  0.60541837,
+           0.11502552],
+         [ 0.03820389, -0.02497446, -0.05433094,  0.0461882 ,  0.9384233 ,
+           0.05649   ],
+         [-0.12175989, -0.01387763,  0.27187684,  0.03974104,  0.80743383,
+           0.0165858 ],
+         [-0.07627357, -0.00457956,  0.72381307,  0.01666732,  0.33863637,
+           0.00173637],
+         [ 0.35248246, -0.12338445, -0.03664021,  0.03528405,  0.11761608,
+           0.65464207],
+         [ 0.14425451, -0.11656837, -0.11959479,  0.14658594,  0.48863048,
+           0.45669223],
+         [-0.05851209, -0.09605386, -0.05433094,  0.22721421,  0.75739729,
+           0.22428539],
+         [-0.12450447, -0.06039878,  0.27187684,  0.1954986 ,  0.65167627,
+           0.06585154],
+         [-0.06430635, -0.02170441,  0.72381307,  0.08199178,  0.27331191,
+           0.006894  ],
+         [-0.01911252, -0.01911252, -0.03664021,  0.07645006,  0.07645006,
+           0.92196511],
+         [-0.07940205, -0.07940205, -0.11959479,  0.31760821,  0.31760821,
+           0.64318248],
+         [-0.12307644, -0.12307644, -0.05433094,  0.49230575,  0.49230575,
+           0.31587231],
+         [-0.10589686, -0.10589686,  0.27187684,  0.42358744,  0.42358744,
+           0.09274201],
+         [-0.04441296, -0.04441296,  0.72381307,  0.17765185,  0.17765185,
+           0.00970916],
+         [-0.12338445,  0.35248246, -0.03664021,  0.11761608,  0.03528405,
+           0.65464207],
+         [-0.11656837,  0.14425451, -0.11959479,  0.48863048,  0.14658594,
+           0.45669223],
+         [-0.09605386, -0.05851209, -0.05433094,  0.75739729,  0.22721421,
+           0.22428539],
+         [-0.06039878, -0.12450447,  0.27187684,  0.65167627,  0.1954986 ,
+           0.06585154],
+         [-0.02170441, -0.06430635,  0.72381307,  0.27331191,  0.08199178,
+           0.006894  ],
+         [-0.04098492,  0.75984252, -0.03664021,  0.14572757,  0.00717256,
+           0.16488248],
+         [-0.03479054,  0.40414338, -0.11959479,  0.60541837,  0.02979805,
+           0.11502552],
+         [-0.02497446,  0.03820389, -0.05433094,  0.9384233 ,  0.0461882 ,
+           0.05649   ],
+         [-0.01387763, -0.12175989,  0.27187684,  0.80743383,  0.03974104,
+           0.0165858 ],
+         [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
+           0.00173637]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
+            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
+            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
+            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
+            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
+            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
+            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
+            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
+            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
+            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
+            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
+            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
+            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
+            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
+            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
+            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
+            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
+            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
+            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
+            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
+            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
+            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
+            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
+            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
+            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
+            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01]]), 'FE1_C0_D01': array([[ -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
+            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
+            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
+            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
+            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
+            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
+            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
+            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
+            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
+            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
+            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
+            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
+            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
+            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
+            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
+            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
+            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
+            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
+            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
+            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
+            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
+            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
+            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
+            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
+            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
+            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[ -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.05746132e+00,  -8.49514991e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   2.90697631e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.14264218e+00,  -8.94541420e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   2.03718360e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.60999729e-01,  -9.42856822e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   1.10385655e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.24348811e-01,  -9.81510846e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.57162035e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.95444613e+00,  -1.13685562e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   2.06813170e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.46766349e+00,  -2.59717159e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   1.72738065e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -7.29317012e-01,  -4.81216253e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   1.21053326e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.29622614e-02,  -7.18894832e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   6.55932571e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.96813589e-01,  -9.09046068e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   2.12232479e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.13685562e-01,   1.95444613e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -2.06813170e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.59717159e-01,   1.46766349e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -1.72738065e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.81216253e-01,   7.29317012e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -1.21053326e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.18894832e-01,  -6.29622614e-02,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -6.55932571e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.09046068e-01,  -6.96813589e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -2.12232479e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.19829626e-01,   2.66059020e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -3.48041982e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.49514991e-01,   2.05746132e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -2.90697631e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.94541420e-01,   1.14264218e+00,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -2.03718360e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.42856822e-01,   1.60999729e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.10385655e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.81510846e-01,  -6.24348811e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+  
+  tables: {'FE1_C0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
+           0.16488248,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.40414338, -0.03479054, -0.11959479,  0.02979805,  0.60541837,
+           0.11502552,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.03820389, -0.02497446, -0.05433094,  0.0461882 ,  0.9384233 ,
+           0.05649   ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.12175989, -0.01387763,  0.27187684,  0.03974104,  0.80743383,
+           0.0165858 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.07627357, -0.00457956,  0.72381307,  0.01666732,  0.33863637,
+           0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.35248246, -0.12338445, -0.03664021,  0.03528405,  0.11761608,
+           0.65464207,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [ 0.14425451, -0.11656837, -0.11959479,  0.14658594,  0.48863048,
+           0.45669223,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.05851209, -0.09605386, -0.05433094,  0.22721421,  0.75739729,
+           0.22428539,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.12450447, -0.06039878,  0.27187684,  0.1954986 ,  0.65167627,
+           0.06585154,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.06430635, -0.02170441,  0.72381307,  0.08199178,  0.27331191,
+           0.006894  ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.01911252, -0.01911252, -0.03664021,  0.07645006,  0.07645006,
+           0.92196511,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.07940205, -0.07940205, -0.11959479,  0.31760821,  0.31760821,
+           0.64318248,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.12307644, -0.12307644, -0.05433094,  0.49230575,  0.49230575,
+           0.31587231,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.10589686, -0.10589686,  0.27187684,  0.42358744,  0.42358744,
+           0.09274201,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.04441296, -0.04441296,  0.72381307,  0.17765185,  0.17765185,
+           0.00970916,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.12338445,  0.35248246, -0.03664021,  0.11761608,  0.03528405,
+           0.65464207,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.11656837,  0.14425451, -0.11959479,  0.48863048,  0.14658594,
+           0.45669223,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.09605386, -0.05851209, -0.05433094,  0.75739729,  0.22721421,
+           0.22428539,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.06039878, -0.12450447,  0.27187684,  0.65167627,  0.1954986 ,
+           0.06585154,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.02170441, -0.06430635,  0.72381307,  0.27331191,  0.08199178,
+           0.006894  ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.04098492,  0.75984252, -0.03664021,  0.14572757,  0.00717256,
+           0.16488248,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.03479054,  0.40414338, -0.11959479,  0.60541837,  0.02979805,
+           0.11502552,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.02497446,  0.03820389, -0.05433094,  0.9384233 ,  0.0461882 ,
+           0.05649   ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.01387763, -0.12175989,  0.27187684,  0.80743383,  0.03974104,
+           0.0165858 ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ],
+         [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
+           0.00173637,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.75984252, -0.04098492, -0.03664021,  0.00717256,
+           0.14572757,  0.16488248],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.40414338, -0.03479054, -0.11959479,  0.02979805,
+           0.60541837,  0.11502552],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.03820389, -0.02497446, -0.05433094,  0.0461882 ,
+           0.9384233 ,  0.05649   ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12175989, -0.01387763,  0.27187684,  0.03974104,
+           0.80743383,  0.0165858 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.07627357, -0.00457956,  0.72381307,  0.01666732,
+           0.33863637,  0.00173637],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.35248246, -0.12338445, -0.03664021,  0.03528405,
+           0.11761608,  0.65464207],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        ,  0.14425451, -0.11656837, -0.11959479,  0.14658594,
+           0.48863048,  0.45669223],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.05851209, -0.09605386, -0.05433094,  0.22721421,
+           0.75739729,  0.22428539],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12450447, -0.06039878,  0.27187684,  0.1954986 ,
+           0.65167627,  0.06585154],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.06430635, -0.02170441,  0.72381307,  0.08199178,
+           0.27331191,  0.006894  ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.01911252, -0.01911252, -0.03664021,  0.07645006,
+           0.07645006,  0.92196511],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.07940205, -0.07940205, -0.11959479,  0.31760821,
+           0.31760821,  0.64318248],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12307644, -0.12307644, -0.05433094,  0.49230575,
+           0.49230575,  0.31587231],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.10589686, -0.10589686,  0.27187684,  0.42358744,
+           0.42358744,  0.09274201],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04441296, -0.04441296,  0.72381307,  0.17765185,
+           0.17765185,  0.00970916],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.12338445,  0.35248246, -0.03664021,  0.11761608,
+           0.03528405,  0.65464207],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.11656837,  0.14425451, -0.11959479,  0.48863048,
+           0.14658594,  0.45669223],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.09605386, -0.05851209, -0.05433094,  0.75739729,
+           0.22721421,  0.22428539],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.06039878, -0.12450447,  0.27187684,  0.65167627,
+           0.1954986 ,  0.06585154],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02170441, -0.06430635,  0.72381307,  0.27331191,
+           0.08199178,  0.006894  ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.04098492,  0.75984252, -0.03664021,  0.14572757,
+           0.00717256,  0.16488248],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.03479054,  0.40414338, -0.11959479,  0.60541837,
+           0.02979805,  0.11502552],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.02497446,  0.03820389, -0.05433094,  0.9384233 ,
+           0.0461882 ,  0.05649   ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.01387763, -0.12175989,  0.27187684,  0.80743383,
+           0.03974104,  0.0165858 ],
+         [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+           0.        , -0.00457956, -0.07627357,  0.72381307,  0.33863637,
+           0.01666732,  0.00173637]]), 'FE1_C1_D10': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   3.48041982e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.05746132e+00,  -8.49514991e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   2.90697631e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.14264218e+00,  -8.94541420e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   2.03718360e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.60999729e-01,  -9.42856822e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   1.10385655e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.24348811e-01,  -9.81510846e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.57162035e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.95444613e+00,  -1.13685562e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   2.06813170e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.46766349e+00,  -2.59717159e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   1.72738065e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -7.29317012e-01,  -4.81216253e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   1.21053326e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.29622614e-02,  -7.18894832e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   6.55932571e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.96813589e-01,  -9.09046068e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   2.12232479e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.13685562e-01,   1.95444613e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -2.06813170e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.59717159e-01,   1.46766349e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -1.72738065e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.81216253e-01,   7.29317012e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -1.21053326e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.18894832e-01,  -6.29622614e-02,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -6.55932571e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.09046068e-01,  -6.96813589e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -2.12232479e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.19829626e-01,   2.66059020e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -3.48041982e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.49514991e-01,   2.05746132e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -2.90697631e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.94541420e-01,   1.14264218e+00,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -2.03718360e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.42856822e-01,   1.60999729e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.10385655e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.81510846e-01,  -6.24348811e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01]]), 'FE0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
+           0.16488248],
+         [ 0.40414338, -0.03479054, -0.11959479,  0.02979805,  0.60541837,
+           0.11502552],
+         [ 0.03820389, -0.02497446, -0.05433094,  0.0461882 ,  0.9384233 ,
+           0.05649   ],
+         [-0.12175989, -0.01387763,  0.27187684,  0.03974104,  0.80743383,
+           0.0165858 ],
+         [-0.07627357, -0.00457956,  0.72381307,  0.01666732,  0.33863637,
+           0.00173637],
+         [ 0.35248246, -0.12338445, -0.03664021,  0.03528405,  0.11761608,
+           0.65464207],
+         [ 0.14425451, -0.11656837, -0.11959479,  0.14658594,  0.48863048,
+           0.45669223],
+         [-0.05851209, -0.09605386, -0.05433094,  0.22721421,  0.75739729,
+           0.22428539],
+         [-0.12450447, -0.06039878,  0.27187684,  0.1954986 ,  0.65167627,
+           0.06585154],
+         [-0.06430635, -0.02170441,  0.72381307,  0.08199178,  0.27331191,
+           0.006894  ],
+         [-0.01911252, -0.01911252, -0.03664021,  0.07645006,  0.07645006,
+           0.92196511],
+         [-0.07940205, -0.07940205, -0.11959479,  0.31760821,  0.31760821,
+           0.64318248],
+         [-0.12307644, -0.12307644, -0.05433094,  0.49230575,  0.49230575,
+           0.31587231],
+         [-0.10589686, -0.10589686,  0.27187684,  0.42358744,  0.42358744,
+           0.09274201],
+         [-0.04441296, -0.04441296,  0.72381307,  0.17765185,  0.17765185,
+           0.00970916],
+         [-0.12338445,  0.35248246, -0.03664021,  0.11761608,  0.03528405,
+           0.65464207],
+         [-0.11656837,  0.14425451, -0.11959479,  0.48863048,  0.14658594,
+           0.45669223],
+         [-0.09605386, -0.05851209, -0.05433094,  0.75739729,  0.22721421,
+           0.22428539],
+         [-0.06039878, -0.12450447,  0.27187684,  0.65167627,  0.1954986 ,
+           0.06585154],
+         [-0.02170441, -0.06430635,  0.72381307,  0.27331191,  0.08199178,
+           0.006894  ],
+         [-0.04098492,  0.75984252, -0.03664021,  0.14572757,  0.00717256,
+           0.16488248],
+         [-0.03479054,  0.40414338, -0.11959479,  0.60541837,  0.02979805,
+           0.11502552],
+         [-0.02497446,  0.03820389, -0.05433094,  0.9384233 ,  0.0461882 ,
+           0.05649   ],
+         [-0.01387763, -0.12175989,  0.27187684,  0.80743383,  0.03974104,
+           0.0165858 ],
+         [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
+           0.00173637]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
+            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
+            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
+            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
+            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
+            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
+            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
+            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
+            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
+            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
+            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
+            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
+            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
+            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
+            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
+            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
+            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
+            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
+            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
+            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
+            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
+            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
+            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
+            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
+            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
+            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01]]), 'FE1_C0_D01': array([[ -2.66059020e+00,   4.77395901e-15,  -8.40760572e-01,
+            1.80170374e-01,   3.50135077e+00,  -1.80170374e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.05746132e+00,   5.66213743e-15,  -2.07946329e-01,
+            1.50485009e-01,   2.26540765e+00,  -1.50485009e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.14264218e+00,   6.45317133e-15,   7.51899241e-01,
+            1.05458580e-01,   3.90742938e-01,  -1.05458580e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.60999729e-01,   6.77236045e-15,   1.78185709e+00,
+            5.71431776e-02,  -1.62085736e+00,  -5.71431776e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.24348811e-01,   6.77236045e-15,   2.60585966e+00,
+            1.84891539e-02,  -3.23020847e+00,  -1.84891539e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.95444613e+00,   5.49560397e-15,  -8.40760572e-01,
+            8.86314438e-01,   2.79520671e+00,  -8.86314438e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.46766349e+00,   6.32827124e-15,  -2.07946329e-01,
+            7.40282841e-01,   1.67560982e+00,  -7.40282841e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -7.29317012e-01,   6.97358837e-15,   7.51899241e-01,
+            5.18783747e-01,  -2.25822291e-02,  -5.18783747e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.29622614e-02,   7.04991621e-15,   1.78185709e+00,
+            2.81105168e-01,  -1.84481935e+00,  -2.81105168e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.96813589e-01,   6.77236045e-15,   2.60585966e+00,
+            9.09539323e-02,  -3.30267325e+00,  -9.09539323e-02,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -9.20380286e-01,   6.66133815e-15,  -8.40760572e-01,
+            1.92038029e+00,   1.76114086e+00,  -1.92038029e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -6.03973164e-01,   7.16093851e-15,  -2.07946329e-01,
+            1.60397316e+00,   8.11919493e-01,  -1.60397316e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.24050380e-01,   7.61196661e-15,   7.51899241e-01,
+            1.12405038e+00,  -6.27848861e-01,  -1.12405038e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.90928547e-01,   7.49400542e-15,   1.78185709e+00,
+            6.09071453e-01,  -2.17278564e+00,  -6.09071453e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.02929828e-01,   6.99440506e-15,   2.60585966e+00,
+            1.97070172e-01,  -3.40878949e+00,  -1.97070172e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.13685562e-01,   7.38298311e-15,  -8.40760572e-01,
+            2.95444613e+00,   7.27075010e-01,  -2.95444613e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.59717159e-01,   7.99360578e-15,  -2.07946329e-01,
+            2.46766349e+00,  -5.17708304e-02,  -2.46766349e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.81216253e-01,   8.10462808e-15,   7.51899241e-01,
+            1.72931701e+00,  -1.23311549e+00,  -1.72931701e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.18894832e-01,   7.77156117e-15,   1.78185709e+00,
+            9.37037739e-01,  -2.50075193e+00,  -9.37037739e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.09046068e-01,   7.10542736e-15,   2.60585966e+00,
+            3.03186411e-01,  -3.51490572e+00,  -3.03186411e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.19829626e-01,   7.88258347e-15,  -8.40760572e-01,
+            3.66059020e+00,   2.09309461e-02,  -3.66059020e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.49514991e-01,   8.49320614e-15,  -2.07946329e-01,
+            3.05746132e+00,  -6.41568662e-01,  -3.05746132e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.94541420e-01,   8.66667849e-15,   7.51899241e-01,
+            2.14264218e+00,  -1.64644066e+00,  -2.14264218e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.42856822e-01,   7.99360578e-15,   1.78185709e+00,
+            1.16099973e+00,  -2.72471392e+00,  -1.16099973e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.81510846e-01,   7.10542736e-15,   2.60585966e+00,
+            3.75651189e-01,  -3.58737050e+00,  -3.75651189e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[ -2.66059020e+00,  -8.19829626e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   3.48041982e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -2.05746132e+00,  -8.49514991e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   2.90697631e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.14264218e+00,  -8.94541420e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   2.03718360e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.60999729e-01,  -9.42856822e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   1.10385655e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.24348811e-01,  -9.81510846e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.57162035e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.95444613e+00,  -1.13685562e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,   2.06813170e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.46766349e+00,  -2.59717159e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,   1.72738065e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -7.29317012e-01,  -4.81216253e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,   1.21053326e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.29622614e-02,  -7.18894832e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,   6.55932571e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  6.96813589e-01,  -9.09046068e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   2.12232479e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -9.20380286e-01,   9.20380286e-01,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -6.05707591e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -6.03973164e-01,   6.03973164e-01,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -6.91411119e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.24050380e-01,   1.24050380e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -4.13363917e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  3.90928547e-01,  -3.90928547e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.03919888e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.02929828e-01,  -8.02929828e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,   3.29516530e-16,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  1.13685562e-01,   1.95444613e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -2.06813170e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  2.59717159e-01,   1.46766349e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -1.72738065e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  4.81216253e-01,   7.29317012e-01,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -1.21053326e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  7.18894832e-01,  -6.29622614e-02,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -6.55932571e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.09046068e-01,  -6.96813589e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -2.12232479e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.19829626e-01,   2.66059020e+00,   0.00000000e+00,
+            1.59239428e-01,  -1.59239428e-01,  -3.48041982e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.49514991e-01,   2.05746132e+00,   0.00000000e+00,
+            7.92053671e-01,  -7.92053671e-01,  -2.90697631e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  8.94541420e-01,   1.14264218e+00,   0.00000000e+00,
+            1.75189924e+00,  -1.75189924e+00,  -2.03718360e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.42856822e-01,   1.60999729e-01,   0.00000000e+00,
+            2.78185709e+00,  -2.78185709e+00,  -1.10385655e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [  9.81510846e-01,  -6.24348811e-01,   0.00000000e+00,
+            3.60585966e+00,  -3.60585966e+00,  -3.57162035e-01,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]])}
+  
+  name_map: {}
+  
+  inv_name_map: {'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C1_D10': 'FE1_C1_D10', 'FE0': 'FE0', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10'}
+  
+  QG-utils, psi_tables, unique_tables:
+  {'FE0': array([[ 0.75984252, -0.04098492, -0.03664021,  0.00717256,  0.14572757,
+           0.16488248],
+         [ 0.40414338, -0.03479054, -0.11959479,  0.02979805,  0.60541837,
+           0.11502552],
+         [ 0.03820389, -0.02497446, -0.05433094,  0.0461882 ,  0.9384233 ,
+           0.05649   ],
+         [-0.12175989, -0.01387763,  0.27187684,  0.03974104,  0.80743383,
+           0.0165858 ],
+         [-0.07627357, -0.00457956,  0.72381307,  0.01666732,  0.33863637,
+           0.00173637],
+         [ 0.35248246, -0.12338445, -0.03664021,  0.03528405,  0.11761608,
+           0.65464207],
+         [ 0.14425451, -0.11656837, -0.11959479,  0.14658594,  0.48863048,
+           0.45669223],
+         [-0.05851209, -0.09605386, -0.05433094,  0.22721421,  0.75739729,
+           0.22428539],
+         [-0.12450447, -0.06039878,  0.27187684,  0.1954986 ,  0.65167627,
+           0.06585154],
+         [-0.06430635, -0.02170441,  0.72381307,  0.08199178,  0.27331191,
+           0.006894  ],
+         [-0.01911252, -0.01911252, -0.03664021,  0.07645006,  0.07645006,
+           0.92196511],
+         [-0.07940205, -0.07940205, -0.11959479,  0.31760821,  0.31760821,
+           0.64318248],
+         [-0.12307644, -0.12307644, -0.05433094,  0.49230575,  0.49230575,
+           0.31587231],
+         [-0.10589686, -0.10589686,  0.27187684,  0.42358744,  0.42358744,
+           0.09274201],
+         [-0.04441296, -0.04441296,  0.72381307,  0.17765185,  0.17765185,
+           0.00970916],
+         [-0.12338445,  0.35248246, -0.03664021,  0.11761608,  0.03528405,
+           0.65464207],
+         [-0.11656837,  0.14425451, -0.11959479,  0.48863048,  0.14658594,
+           0.45669223],
+         [-0.09605386, -0.05851209, -0.05433094,  0.75739729,  0.22721421,
+           0.22428539],
+         [-0.06039878, -0.12450447,  0.27187684,  0.65167627,  0.1954986 ,
+           0.06585154],
+         [-0.02170441, -0.06430635,  0.72381307,  0.27331191,  0.08199178,
+           0.006894  ],
+         [-0.04098492,  0.75984252, -0.03664021,  0.14572757,  0.00717256,
+           0.16488248],
+         [-0.03479054,  0.40414338, -0.11959479,  0.60541837,  0.02979805,
+           0.11502552],
+         [-0.02497446,  0.03820389, -0.05433094,  0.9384233 ,  0.0461882 ,
+           0.05649   ],
+         [-0.01387763, -0.12175989,  0.27187684,  0.80743383,  0.03974104,
+           0.0165858 ],
+         [-0.00457956, -0.07627357,  0.72381307,  0.33863637,  0.01666732,
+           0.00173637]]), 'FE1_C0_D01': array([[-2.6605902 , -0.84076057,  0.18017037,  3.50135077, -0.18017037],
+         [-2.05746132, -0.20794633,  0.15048501,  2.26540765, -0.15048501],
+         [-1.14264218,  0.75189924,  0.10545858,  0.39074294, -0.10545858],
+         [-0.16099973,  1.78185709,  0.05714318, -1.62085736, -0.05714318],
+         [ 0.62434881,  2.60585966,  0.01848915, -3.23020847, -0.01848915],
+         [-1.95444613, -0.84076057,  0.88631444,  2.79520671, -0.88631444],
+         [-1.46766349, -0.20794633,  0.74028284,  1.67560982, -0.74028284],
+         [-0.72931701,  0.75189924,  0.51878375, -0.02258223, -0.51878375],
+         [ 0.06296226,  1.78185709,  0.28110517, -1.84481935, -0.28110517],
+         [ 0.69681359,  2.60585966,  0.09095393, -3.30267325, -0.09095393],
+         [-0.92038029, -0.84076057,  1.92038029,  1.76114086, -1.92038029],
+         [-0.60397316, -0.20794633,  1.60397316,  0.81191949, -1.60397316],
+         [-0.12405038,  0.75189924,  1.12405038, -0.62784886, -1.12405038],
+         [ 0.39092855,  1.78185709,  0.60907145, -2.17278564, -0.60907145],
+         [ 0.80292983,  2.60585966,  0.19707017, -3.40878949, -0.19707017],
+         [ 0.11368556, -0.84076057,  2.95444613,  0.72707501, -2.95444613],
+         [ 0.25971716, -0.20794633,  2.46766349, -0.05177083, -2.46766349],
+         [ 0.48121625,  0.75189924,  1.72931701, -1.23311549, -1.72931701],
+         [ 0.71889483,  1.78185709,  0.93703774, -2.50075193, -0.93703774],
+         [ 0.90904607,  2.60585966,  0.30318641, -3.51490572, -0.30318641],
+         [ 0.81982963, -0.84076057,  3.6605902 ,  0.02093095, -3.6605902 ],
+         [ 0.84951499, -0.20794633,  3.05746132, -0.64156866, -3.05746132],
+         [ 0.89454142,  0.75189924,  2.14264218, -1.64644066, -2.14264218],
+         [ 0.94285682,  1.78185709,  1.16099973, -2.72471392, -1.16099973],
+         [ 0.98151085,  2.60585966,  0.37565119, -3.5873705 , -0.37565119]]), 'FE1_C0_D10': array([[-2.6605902 , -0.81982963,  0.15923943, -0.15923943,  3.48041982],
+         [-2.05746132, -0.84951499,  0.79205367, -0.79205367,  2.90697631],
+         [-1.14264218, -0.89454142,  1.75189924, -1.75189924,  2.0371836 ],
+         [-0.16099973, -0.94285682,  2.78185709, -2.78185709,  1.10385655],
+         [ 0.62434881, -0.98151085,  3.60585966, -3.60585966,  0.35716204],
+         [-1.95444613, -0.11368556,  0.15923943, -0.15923943,  2.0681317 ],
+         [-1.46766349, -0.25971716,  0.79205367, -0.79205367,  1.72738065],
+         [-0.72931701, -0.48121625,  1.75189924, -1.75189924,  1.21053326],
+         [ 0.06296226, -0.71889483,  2.78185709, -2.78185709,  0.65593257],
+         [ 0.69681359, -0.90904607,  3.60585966, -3.60585966,  0.21223248],
+         [-0.92038029,  0.92038029,  0.15923943, -0.15923943,  0.        ],
+         [-0.60397316,  0.60397316,  0.79205367, -0.79205367,  0.        ],
+         [-0.12405038,  0.12405038,  1.75189924, -1.75189924,  0.        ],
+         [ 0.39092855, -0.39092855,  2.78185709, -2.78185709,  0.        ],
+         [ 0.80292983, -0.80292983,  3.60585966, -3.60585966,  0.        ],
+         [ 0.11368556,  1.95444613,  0.15923943, -0.15923943, -2.0681317 ],
+         [ 0.25971716,  1.46766349,  0.79205367, -0.79205367, -1.72738065],
+         [ 0.48121625,  0.72931701,  1.75189924, -1.75189924, -1.21053326],
+         [ 0.71889483, -0.06296226,  2.78185709, -2.78185709, -0.65593257],
+         [ 0.90904607, -0.69681359,  3.60585966, -3.60585966, -0.21223248],
+         [ 0.81982963,  2.6605902 ,  0.15923943, -0.15923943, -3.48041982],
+         [ 0.84951499,  2.05746132,  0.79205367, -0.79205367, -2.90697631],
+         [ 0.89454142,  1.14264218,  1.75189924, -1.75189924, -2.0371836 ],
+         [ 0.94285682,  0.16099973,  2.78185709, -2.78185709, -1.10385655],
+         [ 0.98151085, -0.62434881,  3.60585966, -3.60585966, -0.35716204]])}
+  
+  QG-utils, psi_tables, name_map:
+  {'FE1_C0': ('FE0', (0, [0, 1, 2, 3, 4, 5]), False, False), 'FE1_C1': ('FE0', (3, [6, 7, 8, 9, 10, 11]), False, False), 'FE1_C1_D10': ('FE1_C0_D10', (5, [6, 7, 9, 10, 11]), False, False), 'FE0': ('FE0', (), False, False), 'FE1_C1_D01': ('FE1_C0_D01', (4, [6, 8, 9, 10, 11]), False, False), 'FE1_C0_D01': ('FE1_C0_D01', (1, [0, 2, 3, 4, 5]), False, False), 'FE1_C0_D10': ('FE1_C0_D10', (2, [0, 1, 3, 4, 5]), False, False)}
+  Transforming cell integral
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of forms
+  
+Compiler stage 2 finished in 0.200003 seconds.
+
+Compiler stage 3: Optimizing intermediate representation
+--------------------------------------------------------
+  Optimising expressions for cell integral
+  
+Compiler stage 3 finished in 0.00335884 seconds.
+
+Compiler stage 4: Generating code
+---------------------------------
+  Generating code for 2 element(s)
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
+  Generating code for integrals
+  Removing unused variable: circumradius
+  Removing unused variable: v0v1
+  Removing unused variable: v0v2
+  Removing unused variable: v1v2
+  Removing unused variable: volume
+  Generating code for forms
+  
+Compiler stage 4 finished in 0.29216 seconds.
+
+Compiler stage 4.1: Generating additional wrapper code
+------------------------------------------------------
+  Generating wrapper code for DOLFIN
+  
+Compiler stage 4.1 finished in 0.00081706 seconds.
+
+Compiler stage 5: Formatting code
+---------------------------------
+  
+Compiler stage 5 finished in 0.000668049 seconds.
+
+FFC finished in 0.687339 seconds.
+Output written to ./PoissonDisc.h.
diff --git a/demo/documented/poisson/cpp/main.cpp b/demo/undocumented/poisson-disc/cpp/main.cpp
similarity index 59%
copy from demo/documented/poisson/cpp/main.cpp
copy to demo/undocumented/poisson-disc/cpp/main.cpp
index c7f8e07..1dc90a3 100644
--- a/demo/documented/poisson/cpp/main.cpp
+++ b/demo/undocumented/poisson-disc/cpp/main.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2011 Anders Logg
+// Copyright (C) 2006-2015 Anders Logg, Martin Sandve Alnæs
 //
 // This file is part of DOLFIN.
 //
@@ -15,24 +15,20 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// First added:  2006-02-07
-// Last changed: 2013-03-11
-//
 // This demo program solves Poisson's equation
 //
 //     - div grad u(x, y) = f(x, y)
 //
-// on the unit square with source f given by
+// on the unit disk with source f given by
 //
-//     f(x, y) = 10*exp(-((x - 0.5)^2 + (y - 0.5)^2) / 0.02)
+//     f(x, y) = 1.0
 //
 // and boundary conditions given by
 //
-//     u(x, y) = 0        for x = 0 or x = 1
-// du/dn(x, y) = sin(5*x) for y = 0 or y = 1
+//     u(x, y) = 0        for x^2 + y^2 = 1
 
 #include <dolfin.h>
-#include "Poisson.h"
+#include "PoissonDisc.h"
 
 using namespace dolfin;
 
@@ -41,18 +37,7 @@ class Source : public Expression
 {
   void eval(Array<double>& values, const Array<double>& x) const
   {
-    double dx = x[0] - 0.5;
-    double dy = x[1] - 0.5;
-    values[0] = 10*exp(-(dx*dx + dy*dy) / 0.02);
-  }
-};
-
-// Normal derivative (Neumann boundary condition)
-class dUdN : public Expression
-{
-  void eval(Array<double>& values, const Array<double>& x) const
-  {
-    values[0] = sin(5*x[0]);
+    values[0] = 1.0;
   }
 };
 
@@ -61,41 +46,48 @@ class DirichletBoundary : public SubDomain
 {
   bool inside(const Array<double>& x, bool on_boundary) const
   {
-    return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS;
+    return on_boundary;
   }
 };
 
 int main()
 {
   // Create mesh and function space
-  UnitSquareMesh mesh(32, 32);
-  Poisson::FunctionSpace V(mesh);
+  int degree = 2;
+  int gdim = 2;
+  auto mesh = std::make_shared<UnitDiscMesh>(MPI_COMM_WORLD, 32, degree, gdim);
+
+  auto V = std::make_shared<PoissonDisc::FunctionSpace>(mesh);
 
   // Define boundary condition
-  Constant u0(0.0);
-  DirichletBoundary boundary;
+  auto u0 = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
   DirichletBC bc(V, u0, boundary);
 
   // Define variational forms
-  Poisson::BilinearForm a(V, V);
-  Poisson::LinearForm L(V);
+  PoissonDisc::BilinearForm a(V, V);
+  PoissonDisc::LinearForm L(V);
 
-  Source f;
-  dUdN g;
+  auto f = std::make_shared<Source>();
   L.f = f;
-  L.g = g;
 
   // Compute solution
-  Function u(V);
-  solve(a == L, u, bc);
+  auto u = std::make_shared<Function>(V);
+  solve(a == L, *u, bc);
+
+  // Error norm functional
+  PoissonDisc::Functional M(mesh);
+  M.uh = u;
+  double uerror = assemble(M);
+  std::cout << uerror << std::endl;
 
   // Save solution in VTK format
-  File file("poisson.pvd");
-  file << u;
+  //File file("poisson.pvd");
+  //file << u;
 
   // Plot solution
-  plot(u);
-  interactive();
+  //plot(u);
+  //interactive();
 
   return 0;
 }
diff --git a/demo/undocumented/poisson-disc/python/demo_poisson-disc.py b/demo/undocumented/poisson-disc/python/demo_poisson-disc.py
new file mode 100644
index 0000000..d356a7b
--- /dev/null
+++ b/demo/undocumented/poisson-disc/python/demo_poisson-disc.py
@@ -0,0 +1,111 @@
+"""This demo program solves Poisson's equation
+
+    - div grad u(x, y) = f(x, y)
+
+on the unit square with source f given by
+
+    f(x, y) = 10*exp(-((x - 0.5)^2 + (y - 0.5)^2) / 0.02)
+
+and boundary conditions given by
+
+    u(x, y) = 0        for x = 0 or x = 1
+du/dn(x, y) = sin(5*x) for y = 0 or y = 1
+"""
+
+# Copyright (C) 2007-2011 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+# Begin demo
+
+from __future__ import print_function
+
+from dolfin import *
+import math
+parameters["form_compiler"]["representation"] = "uflacs"
+
+def compute(nsteps, coordinate_degree, element_degree, gdim):
+    # Create mesh and define function space
+
+    print(nsteps)
+    print(coordinate_degree)
+    print(gdim)
+    mesh = UnitDiscMesh(mpi_comm_world(), nsteps, coordinate_degree, gdim)
+    V = FunctionSpace(mesh, "Lagrange", element_degree)
+
+    # Compute domain area and average h
+    area = assemble(1.0*dx(mesh, degree=2))
+    h = (area / mesh.num_cells())**(1.0 / mesh.topology().dim())
+
+    # Define boundary condition
+    u0 = Constant(0.0)
+    bc = DirichletBC(V, u0, "on_boundary")
+
+    # Define variational problem
+    u = TrialFunction(V)
+    v = TestFunction(V)
+    f = Constant(1.0)
+    a = inner(grad(u), grad(v))*dx(degree=3)
+    L = f*v*dx(degree=3)
+
+    # Compute solution
+    u = Function(V)
+    solve(a == L, u, bc)
+
+    # Compute relative error norm
+    x = SpatialCoordinate(mesh)
+    uexact = (1.0 - x**2) / 4.0
+    M = (u - uexact)**2*dx(degree=5)
+    M0 = uexact**2*dx(degree=5)
+    err = sqrt(assemble(M) / assemble(M0))
+
+    return err, h, area, mesh.num_cells(), u
+
+def compute_rates():
+    "Compute convergence rates for degrees 1 and 2."
+    gdim = 2
+    tdim = gdim
+    for coordinate_degree in (1, 2):
+        for element_degree in (1, 2):
+            print("\nUsing coordinate degree %d, element degree %d" % (coordinate_degree, element_degree))
+            ufile = XDMFFile(mpi_comm_world(), "poisson-disc-degree-x%d-e%d.xdmf" % (coordinate_degree, element_degree))
+            encoding = XDMFFile.Encoding_HDF5 if has_hdf5() else XDMFFile.Encoding_ASCII
+            preverr = None
+            prevh = None
+            for i, nsteps in enumerate((1, 8, 64)):
+                err, h, area, num_cells, u = compute(nsteps, coordinate_degree, element_degree, gdim)
+                if preverr is None:
+                    conv = 0.0
+                    print("conv =  N/A, h = %.3e, err = %.3e, area = %.16f, num_cells = %d" % (h, err, area, num_cells))
+                else:
+                    conv = math.log(preverr/err, prevh/h)
+                    print("conv = %1.2f, h = %.3e, err = %.3e, area = %.16f, num_cells = %d" % (conv, h, err, area, num_cells))
+                preverr = err
+                prevh = h
+
+                # Save solution to file
+                u.rename('u', 'u')
+
+                if MPI.size(mpi_comm_world()) > 1 and encoding == XDMFFile.Encoding_ASCII:
+                    print("XDMF file output not supported in parallel without HDF5")
+                else:
+                    ufile.write(u, encoding)
+
+            # Plot solution
+            #plot(u, title="u, degree=%d" % degree)
+    #interactive()
+
+compute_rates()
diff --git a/demo/undocumented/poisson1D-in-2D/cpp/CMakeLists.txt b/demo/undocumented/poisson1D-in-2D/cpp/CMakeLists.txt
index 8ecfc2a..6711223 100644
--- a/demo/undocumented/poisson1D-in-2D/cpp/CMakeLists.txt
+++ b/demo/undocumented/poisson1D-in-2D/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/poisson1D-in-2D/cpp/Poisson.h b/demo/undocumented/poisson1D-in-2D/cpp/Poisson.h
index 20a0f98..aa9f722 100644
--- a/demo/undocumented/poisson1D-in-2D/cpp/Poisson.h
+++ b/demo/undocumented/poisson1D-in-2D/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('interval', 2)), 1, None)";
+    return "FiniteElement('Lagrange', Cell('interval', 2), 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::interval;
+    return ufc::shape::interval;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[2];
-    compute_jacobian_interval_2d(J, vertex_coordinates);
+    compute_jacobian_interval_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[2];
@@ -108,7 +121,7 @@ public:
     
     
     // Get coordinates and map to the reference (FIAT) element
-    double X = 2*(std::sqrt(std::pow(x[0] - vertex_coordinates[0], 2) + std::pow(x[1] - vertex_coordinates[1], 2)) / detJ) - 1.0;
+    double X = 2*(std::sqrt(std::pow(x[0] - coordinate_dofs[0], 2) + std::pow(x[1] - coordinate_dofs[1], 2)) / detJ) - 1.0;
     
     // Reset values
     *values = 0.0;
@@ -172,20 +185,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -194,26 +205,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 2; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -240,7 +249,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -252,7 +261,7 @@ public:
     
     // Compute Jacobian
     double J[2];
-    compute_jacobian_interval_2d(J, vertex_coordinates);
+    compute_jacobian_interval_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[2];
@@ -261,7 +270,7 @@ public:
     
     
     // Get coordinates and map to the reference (FIAT) element
-    double X = 2*(std::sqrt(std::pow(x[0] - vertex_coordinates[0], 2) + std::pow(x[1] - vertex_coordinates[1], 2)) / detJ) - 1.0;
+    double X = 2*(std::sqrt(std::pow(x[0] - coordinate_dofs[0], 2) + std::pow(x[1] - coordinate_dofs[1], 2)) / detJ) - 1.0;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
     unsigned int combinations_t[1][1];
@@ -558,28 +567,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -615,7 +622,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 2; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives_g; s++)
       {
         values[r*num_derivatives_g + s] = dof_values[s];
@@ -623,22 +630,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -649,16 +654,16 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -668,165 +673,116 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
     vertex_values[1] = dof_values[1];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('interval', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', Cell('interval', 2), 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::interval;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 2;
+    return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -834,149 +790,1380 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
     {
     case 0:
       {
-        dofs[0] = 0;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 1;
+        return 2;
         break;
       }
     }
     
+    return 0;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_size() const final override
   {
-    if (d > 1)
-    {
-    throw std::runtime_error("d is larger than dimension (1)");
-    }
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[2];
+    compute_jacobian_interval_2d(J, coordinate_dofs);
     
-    switch (d)
+    // Compute Jacobian inverse and determinant
+    double K[2];
+    double detJ;
+    compute_jacobian_inverse_interval_2d(K, detJ, J);
+    
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = 2*(std::sqrt(std::pow(x[0] - coordinate_dofs[0], 2) + std::pow(x[1] - coordinate_dofs[1], 2)) / detJ) - 1.0;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
     {
     case 0:
       {
-        if (i > 1)
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
       {
-      throw std::runtime_error("i is larger than number of entities (1)");
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, -0.408248290463863};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
       }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
       
-      switch (i)
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
       {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, 0.408248290463863};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
       }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
       
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, -0.408248290463863};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
-    case 1:
+    case 3:
       {
         
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, 0.408248290463863};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    // Do nothing
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
   {
-    // Do nothing
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    2
-    // Number of operations (multiply-add pairs) for tensor contraction: 0
-    // Total number of operations (multiply-add pairs):                  5
     
-    // Compute Jacobian
-    double J[2];
-    compute_jacobian_interval_2d(J, vertex_coordinates);
+    // Compute number of derivatives.
+    unsigned int num_derivatives_t = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives_t *= 1;
+    } // end loop over 'r'
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives_g = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives_g *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives_g; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[2];
+    compute_jacobian_interval_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[2];
+    double detJ;
+    compute_jacobian_inverse_interval_2d(K, detJ, J);
+    
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = 2*(std::sqrt(std::pow(x[0] - coordinate_dofs[0], 2) + std::pow(x[1] - coordinate_dofs[1], 2)) / detJ) - 1.0;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations_t[1][1];
+    for (unsigned int row = 0; row < 1; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations_t[row][col] = 0;
+    }
+    
+    // Generate combinations of derivatives
+    for (unsigned int row = 1; row < num_derivatives_t; row++)
+    {
+      for (unsigned int num = 0; num < row; num++)
+      {
+        for (unsigned int col = n-1; col+1 > 0; col--)
+        {
+          if (combinations_t[row][col] + 1 > 0)
+            combinations_t[row][col] = 0;
+          else
+          {
+            combinations_t[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations_g[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations_g[row][col] = 0;
+    }
+    
+    // Generate combinations of derivatives
+    for (unsigned int row = 1; row < num_derivatives_g; row++)
+    {
+      for (unsigned int num = 0; num < row; num++)
+      {
+        for (unsigned int col = n-1; col+1 > 0; col--)
+        {
+          if (combinations_g[row][col] + 1 > 1)
+            combinations_g[row][col] = 0;
+          else
+          {
+            combinations_g[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[1][2] = {{K[0], K[1]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][1];
+    for (unsigned int j = 0; j < num_derivatives_g; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives_t; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives_g; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives_t; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations_t[col][k]][combinations_g[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, -0.408248290463863};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[2][2] = \
+      {{0.0, 0.0},
+      {3.46410161513775, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[1];
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives_t; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 2; t++)
+        {
+          for (unsigned int u = 0; u < 2; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations_t[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              for (unsigned int tu = 0; tu < 2; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 2; s++)
+        {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives_g; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives_t; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, 0.408248290463863};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[2][2] = \
+      {{0.0, 0.0},
+      {3.46410161513775, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[1];
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives_t; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 2; t++)
+        {
+          for (unsigned int u = 0; u < 2; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations_t[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              for (unsigned int tu = 0; tu < 2; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 2; s++)
+        {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives_g; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives_t; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, -0.408248290463863};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[2][2] = \
+      {{0.0, 0.0},
+      {3.46410161513775, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[1];
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives_t; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 2; t++)
+        {
+          for (unsigned int u = 0; u < 2; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations_t[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              for (unsigned int tu = 0; tu < 2; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 2; s++)
+        {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives_g; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives_t; s++)
+        {
+          values[num_derivatives_g + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, 0.408248290463863};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[2][2] = \
+      {{0.0, 0.0},
+      {3.46410161513775, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[1];
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives_t; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 2; t++)
+        {
+          for (unsigned int u = 0; u < 2; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations_t[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              for (unsigned int tu = 0; tu < 2; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 2; s++)
+        {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives_g; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives_t; s++)
+        {
+          values[num_derivatives_g + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives_g = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives_g *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives_g; s++)
+      {
+        values[r*2*num_derivatives_g + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives_g; s++)
+      {
+        values[r*2*num_derivatives_g + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[2] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[0];
+    dof_coordinates[5] = coordinate_dofs[1];
+    dof_coordinates[6] = coordinate_dofs[2];
+    dof_coordinates[7] = coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', Cell('interval', 2), 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 0;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 1;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 1)
+    {
+    throw std::runtime_error("d is larger than dimension (1)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 1)
+      {
+      throw std::runtime_error("i is larger than number of entities (1)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', Cell('interval', 2), 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    offset += num_global_entities[0];
+    dofs[2] = offset + entity_indices[0][0];
+    dofs[3] = offset + entity_indices[0][1];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 1;
+      dofs[1] = 3;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 1)
+    {
+    throw std::runtime_error("d is larger than dimension (1)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 1)
+      {
+      throw std::runtime_error("i is larger than number of entities (1)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 2;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
+  }
+
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    2
+    // Number of operations (multiply-add pairs) for tensor contraction: 0
+    // Total number of operations (multiply-add pairs):                  5
+    
+    // Compute Jacobian
+    double J[2];
+    compute_jacobian_interval_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[2];
@@ -998,38 +2185,31 @@ public:
 
 };
 
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   poisson_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
+  ~poisson_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    2
@@ -1038,7 +2218,7 @@ public:
     
     // Compute Jacobian
     double J[2];
-    compute_jacobian_interval_2d(J, vertex_coordinates);
+    compute_jacobian_interval_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[2];
@@ -1059,39 +2239,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class poisson_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   poisson_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_exterior_facet_integral_1_otherwise()
+  ~poisson_exterior_facet_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    2
@@ -1100,7 +2273,7 @@ public:
     
     // Compute Jacobian
     double J[2];
-    compute_jacobian_interval_2d(J, vertex_coordinates);
+    compute_jacobian_interval_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[2];
@@ -1136,66 +2309,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_0()
+  ~poisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "2272d09de5f35a6125afc0d9e24c0de9fd548db2df40077f13022d3a18c428767435ba5c595904f5e1eddd88eff00b04f8ff3a382f21a8ed5bbdc7f18c075001";
+    return "4afb9a043c66fc54ff7ab01aa26698d04bbb2d313531e3fc53952e702c86ba5c2f2dcab8fe64a4b44c580e23b46043faa032a7a64a1a3d232bdcd8a9afef2dbd";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1214,8 +2379,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1234,192 +2398,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  bool has_interface_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_overlap_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new poisson_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "ac33315cccb532ccff104db69c7fe6043623bb50a1858b5b3f1a38988e2f2b6757f0b684070f0446038d04bee1d8613ba5d6d4c72fa6777b1ba0b899a0abe2e8";
+    return "6fcc64da485db75ee3441752c24294b72a05ce22f7b4d75f69ca9d6906f192f8ba8cd0283eb181c2869becdcdfabf8303f6a68b3066a6f96917b1f23f136c1b3";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1443,8 +2635,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1468,126 +2659,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new poisson_exterior_facet_integral_1_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1601,14 +2828,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -1617,43 +2850,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1664,43 +2874,20 @@ class CoefficientSpace_g: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1711,43 +2898,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1758,63 +2922,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1822,7 +2993,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -1852,57 +3023,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_g Form_L_FunctionSpace_2;
@@ -1912,73 +3138,118 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
     this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
-    this->g = *g;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+    else if (name == "g")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    case 1:
+      return "g";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner g;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
-    this->g = g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
-    this->g = *g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+    this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2014,20 +3285,26 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner g;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner g;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/poisson1D-in-2D/cpp/compile.log b/demo/undocumented/poisson1D-in-2D/cpp/compile.log
index 48e1722..566f822 100644
--- a/demo/undocumented/poisson1D-in-2D/cpp/compile.log
+++ b/demo/undocumented/poisson1D-in-2D/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -31,8 +32,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              2
   Coefficients:                        '[w_0, w_1]'
-  Unique elements:                     'CG1(?)'
-  Unique sub elements:                 'CG1(?)'
+  Unique elements:                     'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -40,27 +41,37 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.023597 seconds.
+Compiler stage 1 finished in 0.0383749 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -70,7 +81,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  4 entries computed in 0.000751 seconds
+  4 entries computed in 0.00108 seconds
   Shape of reference tensor: (2, 2, 1, 1)
   Primary multi index:   rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   Secondary multi index: rank = 2 dims = [1, 1] indices = [[0, 0]]
@@ -78,6 +89,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [1, 1] indices = [[0, 0]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -85,7 +97,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  4 entries computed in 0.000697 seconds
+  4 entries computed in 0.000879 seconds
   Shape of reference tensor: (2, 2)
   Primary multi index:   rank = 1 dims = [2] indices = [[0], [1]]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -93,6 +105,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -100,7 +113,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  4 entries computed in 0.00045 seconds
+  4 entries computed in 0.00055 seconds
   Shape of reference tensor: (2, 2)
   Primary multi index:   rank = 1 dims = [2] indices = [[0], [1]]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -109,7 +122,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  4 entries computed in 0.000428 seconds
+  4 entries computed in 0.000541 seconds
   Shape of reference tensor: (2, 2)
   Primary multi index:   rank = 1 dims = [2] indices = [[0], [1]]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -117,58 +130,36 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00780797 seconds.
+Compiler stage 2 finished in 0.015944 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000155926 seconds.
+Compiler stage 3 finished in 0.000236034 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 2 element(s)
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0205941 seconds.
+Compiler stage 4 finished in 0.0596189 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000573874 seconds.
+Compiler stage 4.1 finished in 0.000859022 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000616074 seconds.
+Compiler stage 5 finished in 0.000662804 seconds.
 
-FFC finished in 0.0536659 seconds.
+FFC finished in 0.1162 seconds.
+Output written to ./Poisson.h.
diff --git a/demo/undocumented/poisson1D-in-2D/cpp/main.cpp b/demo/undocumented/poisson1D-in-2D/cpp/main.cpp
index 15043f7..a003ce1 100644
--- a/demo/undocumented/poisson1D-in-2D/cpp/main.cpp
+++ b/demo/undocumented/poisson1D-in-2D/cpp/main.cpp
@@ -49,7 +49,7 @@ double to_interval(const Array<double>& x)
 }
 
 // Rotate the mesh through theta
-void rotate(Mesh & mesh)
+void rotate(Mesh& mesh)
 {
   std::vector<double>& x = mesh.coordinates();
   double tmpx;
@@ -105,22 +105,22 @@ int main()
   BoundaryMesh boundarymesh(squaremesh, "exterior");
 
   // The actual mesh is just the bottom.
-  SubMesh mesh(boundarymesh, BottomEdge());
+  auto mesh = std::make_shared<SubMesh>(boundarymesh, BottomEdge());
 
   // Rotate mesh coordinates.
-  rotate(mesh);
+  rotate(*mesh);
 
   // Create function space
-  Poisson::FunctionSpace V(mesh);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
 
   // Set up BCs
-  Constant zero(0.0);
-  DirichletBoundary boundary;
+  auto zero = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
   DirichletBC bc(V, zero, boundary);
 
   // Create source and flux terms
-  Source f;
-  Flux g;
+  auto f = std::make_shared<Source>();
+  auto g = std::make_shared<Flux>();
 
   // Define variational problem
   Poisson::BilinearForm a(V, V);
diff --git a/demo/undocumented/poisson1D-in-2D/python/demo_poisson1D-in-2D.py b/demo/undocumented/poisson1D-in-2D/python/demo_poisson1D-in-2D.py
index 0f7d09d..6fc53fd 100644
--- a/demo/undocumented/poisson1D-in-2D/python/demo_poisson1D-in-2D.py
+++ b/demo/undocumented/poisson1D-in-2D/python/demo_poisson1D-in-2D.py
@@ -91,8 +91,8 @@ class DirichletBoundary(SubDomain):
 # Define variational problem
 u = TrialFunction(V)
 v = TestFunction(V)
-f = Expression("9.0*pi*pi*sin(3.0*pi*%s)"% rotation.to_interval_c())
-g = Expression("3.0*pi*cos(3.0*pi*%s)"% rotation.to_interval_c())
+f = Expression("9.0*pi*pi*sin(3.0*pi*%s)" % rotation.to_interval_c(), degree=2)
+g = Expression("3.0*pi*cos(3.0*pi*%s)" % rotation.to_interval_c(), degree=2)
 
 a = dot(grad(u), grad(v))*dx
 L = f*v*dx + g*v*ds
diff --git a/demo/undocumented/poisson1D/cpp/CMakeLists.txt b/demo/undocumented/poisson1D/cpp/CMakeLists.txt
index 95c5217..7503d4c 100644
--- a/demo/undocumented/poisson1D/cpp/CMakeLists.txt
+++ b/demo/undocumented/poisson1D/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/poisson1D/cpp/Poisson.h b/demo/undocumented/poisson1D/cpp/Poisson.h
index 9c0afe5..c1ccf23 100644
--- a/demo/undocumented/poisson1D/cpp/Poisson.h
+++ b/demo/undocumented/poisson1D/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('interval', 1)), 1, None)";
+    return "FiniteElement('Lagrange', interval, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::interval;
+    return ufc::shape::interval;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[1];
-    compute_jacobian_interval_1d(J, vertex_coordinates);
+    compute_jacobian_interval_1d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[1];
@@ -108,7 +121,7 @@ public:
     
     
     // Get coordinates and map to the reference (FIAT) element
-    double X = (2.0*x[0] - vertex_coordinates[0] - vertex_coordinates[1]) / J[0];
+    double X = (2.0*x[0] - coordinate_dofs[0] - coordinate_dofs[1]) / J[0];
     
     // Reset values
     *values = 0.0;
@@ -172,20 +185,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -194,26 +205,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 2; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -233,7 +242,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -245,7 +254,7 @@ public:
     
     // Compute Jacobian
     double J[1];
-    compute_jacobian_interval_1d(J, vertex_coordinates);
+    compute_jacobian_interval_1d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[1];
@@ -254,7 +263,7 @@ public:
     
     
     // Get coordinates and map to the reference (FIAT) element
-    double X = (2.0*x[0] - vertex_coordinates[0] - vertex_coordinates[1]) / J[0];
+    double X = (2.0*x[0] - coordinate_dofs[0] - coordinate_dofs[1]) / J[0];
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
     unsigned int combinations[1][1];
@@ -525,28 +534,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -582,7 +589,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 2; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -590,22 +597,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -616,14 +621,14 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
+        y[0] = coordinate_dofs[0];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -633,364 +638,1176 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[1];
-    y[0] = vertex_coordinates[0];
+    y[0] = coordinate_dofs[0];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
     vertex_values[1] = dof_values[1];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('interval', 1)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', interval, 1), dim=1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::interval;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
         return 1;
         break;
       }
-    case 1:
-      {
-        return 0;
-        break;
-      }
     }
     
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
     {
     case 0:
       {
-        dofs[0] = 0;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 1;
+        return 1;
         break;
       }
     }
     
+    return 0;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_size() const final override
   {
-    if (d > 1)
-    {
-    throw std::runtime_error("d is larger than dimension (1)");
-    }
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[1];
+    compute_jacobian_interval_1d(J, coordinate_dofs);
     
-    switch (d)
+    // Compute Jacobian inverse and determinant
+    double K[1];
+    double detJ;
+    compute_jacobian_inverse_interval_1d(K, detJ, J);
+    
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (2.0*x[0] - coordinate_dofs[0] - coordinate_dofs[1]) / J[0];
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
     {
     case 0:
       {
-        if (i > 1)
-      {
-      throw std::runtime_error("i is larger than number of entities (1)");
-      }
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
       
-      switch (i)
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
       {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      }
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, -0.408248290463863};
       
+      // Compute value(s)
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     case 1:
       {
         
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, 0.408248290463863};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     }
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    // Do nothing
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
   {
-    // Do nothing
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    1
-    // Number of operations (multiply-add pairs) for tensor contraction: 0
-    // Total number of operations (multiply-add pairs):                  4
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 1;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
     
     // Compute Jacobian
     double J[1];
-    compute_jacobian_interval_1d(J, vertex_coordinates);
+    compute_jacobian_interval_1d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[1];
     double detJ;
     compute_jacobian_inverse_interval_1d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*K[0]*K[0];
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (2.0*x[0] - coordinate_dofs[0] - coordinate_dofs[1]) / J[0];
     
-    // Compute element tensor
-    A[0] = G0_0_0;
-    A[1] = -G0_0_0;
-    A[2] = -G0_0_0;
-    A[3] = G0_0_0;
-  }
-
-};
-
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[1][1];
+    for (unsigned int row = 0; row < 1; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 0)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[1][1] = {{K[0]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[1][1];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, -0.408248290463863};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[2][2] = \
+      {{0.0, 0.0},
+      {3.46410161513775, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[1];
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 2; t++)
+        {
+          for (unsigned int u = 0; u < 2; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              for (unsigned int tu = 0; tu < 2; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 2; s++)
+        {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, 0.408248290463863};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[2][2] = \
+      {{0.0, 0.0},
+      {3.46410161513775, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[1];
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 2; t++)
+        {
+          for (unsigned int u = 0; u < 2; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              for (unsigned int tu = 0; tu < 2; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 2; s++)
+        {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 1;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[1];
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[1];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[1];
+    y[0] = coordinate_dofs[0];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 1;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', interval, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 0;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 1;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 1)
+    {
+    throw std::runtime_error("d is larger than dimension (1)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 1)
+      {
+      throw std::runtime_error("i is larger than number of entities (1)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', interval, 1), dim=1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 0;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 1;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 1)
+    {
+    throw std::runtime_error("d is larger than dimension (1)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 1)
+      {
+      throw std::runtime_error("i is larger than number of entities (1)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 1;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
+  }
+
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    1
+    // Number of operations (multiply-add pairs) for tensor contraction: 0
+    // Total number of operations (multiply-add pairs):                  4
+    
+    // Compute Jacobian
+    double J[1];
+    compute_jacobian_interval_1d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[1];
+    double detJ;
+    compute_jacobian_inverse_interval_1d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*K[0]*K[0];
+    
+    // Compute element tensor
+    A[0] = G0_0_0;
+    A[1] = -G0_0_0;
+    A[2] = -G0_0_0;
+    A[3] = G0_0_0;
+  }
+
+};
+
+
+class poisson_cell_integral_1_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_1_otherwise() override
+  {
+    
+  }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true, false});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    2
@@ -999,7 +1816,7 @@ public:
     
     // Compute Jacobian
     double J[1];
-    compute_jacobian_interval_1d(J, vertex_coordinates);
+    compute_jacobian_interval_1d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[1];
@@ -1020,39 +1837,32 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class poisson_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   poisson_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~poisson_exterior_facet_integral_1_otherwise()
+  ~poisson_exterior_facet_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    2
@@ -1061,7 +1871,7 @@ public:
     
     // Compute Jacobian
     double J[1];
-    compute_jacobian_interval_1d(J, vertex_coordinates);
+    compute_jacobian_interval_1d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[1];
@@ -1096,66 +1906,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_0()
+  ~poisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "96af22cad8d4a03122f63c60ccf7e2259b991373e54134a1b1771b42cd320dac62328914513a9c8637d922dff2ea0ea1e6b6c59c877b483fd341d0d57e2d14e1";
+    return "9a0befef494b5dd1ff6647eac94553c5266389cfb5027be7ee2d87f4e09dae7bcf52cfda78f26c4720f7b5d3b1aa3c4665fc7f73d8027f5fb5203f1960dc059c";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1174,8 +1976,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1194,192 +1995,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  bool has_interface_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_overlap_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new poisson_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "10030828dac6399fe75c35a4176964bf7b9816ab1d105f440ad07305a5ef3f3da951371976c74a189ec2d483436524a48989ae7f54cd63d8bd89464fce722e1e";
+    return "3341810033a55198b635290a0cbfdaac9a14aa6587a593f9c9100d94493ef882bbb3b112f3d8c14e24e3da5d25ad7527b437fe089441d83fbfb05737a4286b84";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1403,8 +2232,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1428,126 +2256,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new poisson_exterior_facet_integral_1_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1561,14 +2425,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -1577,43 +2447,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1624,43 +2471,20 @@ class CoefficientSpace_g: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1671,43 +2495,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1718,63 +2519,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1782,7 +2590,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -1812,57 +2620,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_g Form_L_FunctionSpace_2;
@@ -1872,73 +2735,118 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
     this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
-    this->g = *g;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+    else if (name == "g")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    case 1:
+      return "g";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner g;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
-    this->g = g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
-    this->g = *g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+    this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -1974,20 +2882,26 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner g;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner g;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/poisson1D/cpp/compile.log b/demo/undocumented/poisson1D/cpp/compile.log
index 03311c0..a097c79 100644
--- a/demo/undocumented/poisson1D/cpp/compile.log
+++ b/demo/undocumented/poisson1D/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<1 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<1 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:                 1
   Number of cell subdomains:           0
@@ -31,8 +32,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              2
   Coefficients:                        '[w_0, w_1]'
-  Unique elements:                     'CG1(?)'
-  Unique sub elements:                 'CG1(?)'
+  Unique elements:                     'CG1(?), Vector<1 x CG1(?)>'
+  Unique sub elements:                 'CG1(?), Vector<1 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -40,27 +41,34 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0179989 seconds.
+Compiler stage 1 finished in 0.0293429 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -70,7 +78,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  4 entries computed in 0.000595 seconds
+  4 entries computed in 0.000765 seconds
   Shape of reference tensor: (2, 2, 1, 1)
   Primary multi index:   rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   Secondary multi index: rank = 2 dims = [1, 1] indices = [[0, 0]]
@@ -78,6 +86,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [1, 1] indices = [[0, 0]]
   External multi index:  rank = 1 dims = [1] indices = [[0]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -85,7 +94,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  4 entries computed in 0.000535 seconds
+  4 entries computed in 0.000694 seconds
   Shape of reference tensor: (2, 2)
   Primary multi index:   rank = 1 dims = [2] indices = [[0], [1]]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -93,6 +102,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -100,7 +110,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  4 entries computed in 0.000357 seconds
+  4 entries computed in 0.000443 seconds
   Shape of reference tensor: (2, 2)
   Primary multi index:   rank = 1 dims = [2] indices = [[0], [1]]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -109,7 +119,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  4 entries computed in 0.00033 seconds
+  4 entries computed in 0.000434 seconds
   Shape of reference tensor: (2, 2)
   Primary multi index:   rank = 1 dims = [2] indices = [[0], [1]]
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
@@ -117,58 +127,36 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00612497 seconds.
+Compiler stage 2 finished in 0.0114579 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000120878 seconds.
+Compiler stage 3 finished in 0.000170946 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 2 element(s)
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0160232 seconds.
+Compiler stage 4 finished in 0.0291698 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000484943 seconds.
+Compiler stage 4.1 finished in 0.000648975 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000500917 seconds.
+Compiler stage 5 finished in 0.000478029 seconds.
 
-FFC finished in 0.0415139 seconds.
+FFC finished in 0.0716321 seconds.
+Output written to ./Poisson.h.
diff --git a/demo/undocumented/poisson1D/cpp/main.cpp b/demo/undocumented/poisson1D/cpp/main.cpp
index ff47627..391036d 100644
--- a/demo/undocumented/poisson1D/cpp/main.cpp
+++ b/demo/undocumented/poisson1D/cpp/main.cpp
@@ -73,19 +73,19 @@ public:
 int main()
 {
   // Create mesh
-  UnitIntervalMesh mesh(50);
+  auto mesh = std::make_shared<UnitIntervalMesh>(50);
 
   // Create function space
-  Poisson::FunctionSpace V(mesh);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
 
   // Set up BCs
-  Constant zero(0.0);
-  DirichletBoundary boundary;
+  auto zero = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
   DirichletBC bc(V, zero, boundary);
 
   // Create source and flux terms
-  Source f;
-  Flux g;
+  auto f = std::make_shared<Source>();
+  auto g = std::make_shared<Flux>();
 
   // Define variational problem
   Poisson::BilinearForm a(V, V);
diff --git a/demo/undocumented/poisson1D/python/demo_poisson1D.py b/demo/undocumented/poisson1D/python/demo_poisson1D.py
index 1b12d08..9878b55 100644
--- a/demo/undocumented/poisson1D/python/demo_poisson1D.py
+++ b/demo/undocumented/poisson1D/python/demo_poisson1D.py
@@ -48,8 +48,8 @@ class DirichletBoundary(SubDomain):
 # Define variational problem
 u = TrialFunction(V)
 v = TestFunction(V)
-f = Expression("9.0*pi*pi*sin(3.0*pi*x[0])")
-g = Expression("3.0*pi*cos(3.0*pi*x[0])")
+f = Expression("9.0*pi*pi*sin(3.0*pi*x[0])", degree=2)
+g = Expression("3.0*pi*cos(3.0*pi*x[0])", degree=2)
 
 a = dot(grad(u), grad(v))*dx
 L = f*v*dx + g*v*ds
diff --git a/demo/undocumented/refinement/cpp/CMakeLists.txt b/demo/undocumented/refinement/cpp/CMakeLists.txt
index b668d38..82305b6 100644
--- a/demo/undocumented/refinement/cpp/CMakeLists.txt
+++ b/demo/undocumented/refinement/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/refinement/cpp/main.cpp b/demo/undocumented/refinement/cpp/main.cpp
index 1e277b5..c1cbdfd 100644
--- a/demo/undocumented/refinement/cpp/main.cpp
+++ b/demo/undocumented/refinement/cpp/main.cpp
@@ -29,31 +29,31 @@ int main()
   File file("mesh.pvd");
 
   // Create mesh of unit square
-  UnitSquareMesh unit_square(5, 5);
-  Mesh mesh(unit_square);
-  file << mesh;
+  auto mesh = std::make_shared<Mesh>(UnitSquareMesh(5, 5));
+
+  file << *mesh;
 
   // Uniform refinement
-  mesh = refine(mesh);
-  file << mesh;
+  mesh = std::make_shared<Mesh>(refine(*mesh));
+  file << *mesh;
 
   // Refine mesh close to x = (0.5, 0.5)
   Point p(0.5, 0.5);
   for (unsigned int i = 0; i < 5; i++)
   {
     // Mark cells for refinement
-    MeshFunction<bool> cell_markers(mesh, mesh.topology().dim(), false);
-    for (CellIterator c(mesh); !c.end(); ++c)
+    MeshFunction<bool> cell_markers(mesh, mesh->topology().dim(), false);
+    for (CellIterator c(*mesh); !c.end(); ++c)
     {
       if (c->midpoint().distance(p) < 0.1)
         cell_markers[*c] = true;
     }
 
     // Refine mesh
-    mesh = refine(mesh, cell_markers);
+    mesh = std::make_shared<Mesh>(refine(*mesh, cell_markers));
 
-    file << mesh;
-    plot(mesh);
+    file << *mesh;
+    plot(*mesh);
     interactive();
   }
 
diff --git a/demo/undocumented/spatial-coordinates/cpp/CMakeLists.txt b/demo/undocumented/spatial-coordinates/cpp/CMakeLists.txt
index 454abba..1142d1d 100644
--- a/demo/undocumented/spatial-coordinates/cpp/CMakeLists.txt
+++ b/demo/undocumented/spatial-coordinates/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/spatial-coordinates/cpp/SpatialCoordinates.h b/demo/undocumented/spatial-coordinates/cpp/SpatialCoordinates.h
index ddee5cb..7364304 100644
--- a/demo/undocumented/spatial-coordinates/cpp/SpatialCoordinates.h
+++ b/demo/undocumented/spatial-coordinates/cpp/SpatialCoordinates.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,107 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __SPATIALCOORDINATES_H
 #define __SPATIALCOORDINATES_H
-
 #include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class spatialcoordinates_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   spatialcoordinates_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~spatialcoordinates_finite_element_0()
+  ~spatialcoordinates_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +122,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -123,33 +137,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -159,33 +165,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -195,141 +193,25 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
         *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
@@ -339,48 +221,44 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
     double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -400,19 +278,19 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
+    if (n > 1)
     {
     return ;
     }
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -421,18 +299,18 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
     {
-      for (unsigned int col = 0; col < 2; col++)
+      for (unsigned int col = 0; col < 1; col++)
         combinations[row][col] = 0;
     }
     
@@ -459,7 +337,7 @@ public:
     
     // Declare transformation matrix
     // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
+    double transform[2][2];
     for (unsigned int j = 0; j < num_derivatives; j++)
     {
       for (unsigned int k = 0; k < num_derivatives; k++)
@@ -481,81 +359,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -570,9 +428,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -582,11 +440,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -596,11 +454,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -609,9 +467,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -632,81 +490,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -721,9 +559,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -733,11 +571,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -747,11 +585,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -760,9 +598,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -783,81 +621,61 @@ public:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -872,9 +690,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -884,11 +702,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -898,11 +716,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -911,9 +729,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -930,236 +748,684 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
-    case 4:
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new spatialcoordinates_finite_element_0();
+  }
+
+};
+
+
+class spatialcoordinates_finite_element_1: public ufc::finite_element
+{
+public:
+
+  spatialcoordinates_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~spatialcoordinates_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        derivatives[r] = 0.0;
+        values[0] += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1174,9 +1440,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1186,11 +1452,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1200,11 +1466,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1213,9 +1479,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1232,85 +1498,65 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
       
       // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
+        for (unsigned int t = 0; t < 3; t++)
         {
-          for (unsigned int u = 0; u < 6; u++)
+          for (unsigned int u = 0; u < 3; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -1325,9 +1571,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -1337,11 +1583,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1351,11 +1597,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
           {
-            for (unsigned int u = 0; u < 6; u++)
+            for (unsigned int u = 0; u < 3; u++)
             {
-              for (unsigned int tu = 0; tu < 6; tu++)
+              for (unsigned int tu = 0; tu < 3; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -1364,9 +1610,271 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
+        for (unsigned int s = 0; s < 3; s++)
         {
-          for (unsigned int t = 0; t < 6; t++)
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -1376,273 +1884,2551 @@ public:
       // Transform derivatives back to physical element
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new spatialcoordinates_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new spatialcoordinates_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new spatialcoordinates_finite_element_1();
+  }
+
+};
+
+
+class spatialcoordinates_finite_element_2: public ufc::finite_element
+{
+public:
+
+  spatialcoordinates_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~spatialcoordinates_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', triangle, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    *values = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 6; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[4][2];
+    for (unsigned int row = 0; row < 4; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[4][4];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[3] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[6] = \
+      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
+      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[6][6] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
+      {1.99999999999992, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
+      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[4];
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[6][6] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 6; t++)
+        {
+          for (unsigned int u = 0; u < 6; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            for (unsigned int u = 0; u < 6; u++)
+            {
+              for (unsigned int tu = 0; tu < 6; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 6; s++)
+        {
+          for (unsigned int t = 0; t < 6; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 5:
+      {
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[5] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    dof_coordinates[7] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
+    dof_coordinates[8] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    dof_coordinates[9] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
+    dof_coordinates[10] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    dof_coordinates[11] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new spatialcoordinates_finite_element_2();
+  }
+
+};
+
+
+class spatialcoordinates_dofmap_0: public ufc::dofmap
+{
+public:
+
+  spatialcoordinates_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~spatialcoordinates_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
         break;
       }
     }
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    return 0;
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new spatialcoordinates_dofmap_0();
+  }
+
+};
+
+
+class spatialcoordinates_dofmap_1: public ufc::dofmap
+{
+public:
+
+  spatialcoordinates_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  ~spatialcoordinates_dofmap_1() override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    // Do nothing
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  const char * signature() const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return true;
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return false;
         break;
       }
-    case 3:
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 2;
         break;
       }
-    case 4:
+    case 1:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
-    case 5:
+    case 2:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return 0;
         break;
       }
     }
     
-    return 0.0;
+    return 0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new spatialcoordinates_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new spatialcoordinates_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new spatialcoordinates_finite_element_0();
+    return new spatialcoordinates_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class spatialcoordinates_dofmap_0: public ufc::dofmap
+class spatialcoordinates_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  spatialcoordinates_dofmap_0() : ufc::dofmap()
+  spatialcoordinates_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~spatialcoordinates_dofmap_0()
+  ~spatialcoordinates_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1666,39 +4452,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -1722,25 +4497,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
+    dofs[3] = offset + entity_indices[1][0];
+    dofs[4] = offset + entity_indices[1][1];
+    dofs[5] = offset + entity_indices[1][2];
     offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -1769,9 +4542,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -1845,76 +4617,49 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new spatialcoordinates_dofmap_0();
+    return new spatialcoordinates_dofmap_2();
   }
 
 };
 
-/// 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 spatialcoordinates_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   spatialcoordinates_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~spatialcoordinates_cell_integral_0_otherwise()
+  ~spatialcoordinates_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
@@ -1923,7 +4668,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1941,81 +4686,74 @@ public:
     
     // Compute element tensor
     A[0] = 0.5*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.500000000000002*G0_1_1;
-    A[1] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_1_0;
+    A[1] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_1_0;
     A[2] = 0.166666666666666*G0_0_1 + 0.166666666666666*G0_1_1;
     A[3] = 0.0;
     A[4] = -0.666666666666668*G0_0_1 - 0.666666666666668*G0_1_1;
-    A[5] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_1_0;
-    A[6] = 0.166666666666668*G0_0_0 + 0.166666666666666*G0_0_1;
+    A[5] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_1_0;
+    A[6] = 0.166666666666668*G0_0_0 + 0.166666666666667*G0_0_1;
     A[7] = 0.5*G0_0_0;
-    A[8] = -0.166666666666667*G0_0_1;
+    A[8] = -0.166666666666666*G0_0_1;
     A[9] = 0.666666666666664*G0_0_1;
     A[10] = 0.0;
     A[11] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_0_1;
     A[12] = 0.166666666666666*G0_1_0 + 0.166666666666666*G0_1_1;
-    A[13] = -0.166666666666667*G0_1_0;
+    A[13] = -0.166666666666666*G0_1_0;
     A[14] = 0.5*G0_1_1;
     A[15] = 0.666666666666667*G0_1_0;
-    A[16] = -0.666666666666667*G0_1_0 - 0.666666666666665*G0_1_1;
+    A[16] = -0.666666666666667*G0_1_0 - 0.666666666666666*G0_1_1;
     A[17] = 0.0;
     A[18] = 0.0;
     A[19] = 0.666666666666664*G0_1_0;
     A[20] = 0.666666666666667*G0_0_1;
-    A[21] = 1.33333333333333*G0_0_0 + 0.666666666666655*G0_0_1 + 0.666666666666655*G0_1_0 + 1.33333333333331*G0_1_1;
-    A[22] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666655*G0_1_0;
+    A[21] = 1.33333333333333*G0_0_0 + 0.666666666666656*G0_0_1 + 0.666666666666656*G0_1_0 + 1.33333333333332*G0_1_1;
+    A[22] = -1.33333333333333*G0_0_0 - 0.666666666666659*G0_0_1 - 0.666666666666656*G0_1_0;
     A[23] = -0.666666666666665*G0_0_1 - 0.666666666666666*G0_1_0 - 1.33333333333332*G0_1_1;
     A[24] = -0.666666666666668*G0_1_0 - 0.666666666666668*G0_1_1;
     A[25] = 0.0;
     A[26] = -0.666666666666667*G0_0_1 - 0.666666666666665*G0_1_1;
-    A[27] = -1.33333333333333*G0_0_0 - 0.666666666666655*G0_0_1 - 0.666666666666659*G0_1_0;
+    A[27] = -1.33333333333333*G0_0_0 - 0.666666666666656*G0_0_1 - 0.666666666666659*G0_1_0;
     A[28] = 1.33333333333333*G0_0_0 + 0.666666666666659*G0_0_1 + 0.666666666666659*G0_1_0 + 1.33333333333333*G0_1_1;
-    A[29] = 0.666666666666665*G0_0_1 + 0.666666666666666*G0_1_0;
-    A[30] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_0_1;
+    A[29] = 0.666666666666665*G0_0_1 + 0.666666666666667*G0_1_0;
+    A[30] = -0.666666666666668*G0_0_0 - 0.666666666666668*G0_0_1;
     A[31] = -0.666666666666668*G0_0_0 - 0.666666666666667*G0_1_0;
     A[32] = 0.0;
     A[33] = -0.666666666666666*G0_0_1 - 0.666666666666665*G0_1_0 - 1.33333333333332*G0_1_1;
-    A[34] = 0.666666666666666*G0_0_1 + 0.666666666666665*G0_1_0;
+    A[34] = 0.666666666666667*G0_0_1 + 0.666666666666665*G0_1_0;
     A[35] = 1.33333333333334*G0_0_0 + 0.666666666666668*G0_0_1 + 0.666666666666668*G0_1_0 + 1.33333333333333*G0_1_1;
   }
 
 };
 
-/// 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 spatialcoordinates_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   spatialcoordinates_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~spatialcoordinates_cell_integral_1_otherwise()
+  ~spatialcoordinates_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2085,8 +4823,8 @@ public:
     {
       
       // Compute physical coordinate of quadrature point, operations: 10.
-      X12[0] = FEA12_f0[ip][0]*vertex_coordinates[0] +                  FEA12_f0[ip][1]*vertex_coordinates[2] + FEA12_f0[ip][2]*vertex_coordinates[4];
-      X12[1] = FEA12_f0[ip][0]*vertex_coordinates[1] +                  FEA12_f0[ip][1]*vertex_coordinates[3] + FEA12_f0[ip][2]*vertex_coordinates[5];
+      X12[0] = FEA12_f0[ip][0]*coordinate_dofs[0] +                  FEA12_f0[ip][1]*coordinate_dofs[2] + FEA12_f0[ip][2]*coordinate_dofs[4];
+      X12[1] = FEA12_f0[ip][0]*coordinate_dofs[1] +                  FEA12_f0[ip][1]*coordinate_dofs[3] + FEA12_f0[ip][2]*coordinate_dofs[5];
       
       // Number of operations to compute ip constants: 11
       double I[1];
@@ -2105,43 +4843,36 @@ public:
 
 };
 
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
 
 class spatialcoordinates_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
 {
 public:
 
-  /// Constructor
   spatialcoordinates_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~spatialcoordinates_exterior_facet_integral_1_otherwise()
+  ~spatialcoordinates_exterior_facet_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -2156,8 +4887,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -2228,8 +4959,8 @@ public:
       {
         
         // Compute physical coordinate of quadrature point, operations: 10.
-        X3[0] = FEA3_f0[ip][0]*vertex_coordinates[0] +                  FEA3_f0[ip][1]*vertex_coordinates[2] + FEA3_f0[ip][2]*vertex_coordinates[4];
-        X3[1] = FEA3_f0[ip][0]*vertex_coordinates[1] +                  FEA3_f0[ip][1]*vertex_coordinates[3] + FEA3_f0[ip][2]*vertex_coordinates[5];
+        X3[0] = FEA3_f0[ip][0]*coordinate_dofs[0] +                  FEA3_f0[ip][1]*coordinate_dofs[2] + FEA3_f0[ip][2]*coordinate_dofs[4];
+        X3[1] = FEA3_f0[ip][0]*coordinate_dofs[1] +                  FEA3_f0[ip][1]*coordinate_dofs[3] + FEA3_f0[ip][2]*coordinate_dofs[5];
         
         // Number of operations to compute ip constants: 4
         double I[1];
@@ -2259,8 +4990,8 @@ public:
       {
         
         // Compute physical coordinate of quadrature point, operations: 10.
-        X3[0] = FEA3_f1[ip][0]*vertex_coordinates[0] +                  FEA3_f1[ip][1]*vertex_coordinates[2] + FEA3_f1[ip][2]*vertex_coordinates[4];
-        X3[1] = FEA3_f1[ip][0]*vertex_coordinates[1] +                  FEA3_f1[ip][1]*vertex_coordinates[3] + FEA3_f1[ip][2]*vertex_coordinates[5];
+        X3[0] = FEA3_f1[ip][0]*coordinate_dofs[0] +                  FEA3_f1[ip][1]*coordinate_dofs[2] + FEA3_f1[ip][2]*coordinate_dofs[4];
+        X3[1] = FEA3_f1[ip][0]*coordinate_dofs[1] +                  FEA3_f1[ip][1]*coordinate_dofs[3] + FEA3_f1[ip][2]*coordinate_dofs[5];
         
         // Number of operations to compute ip constants: 4
         double I[1];
@@ -2290,8 +5021,8 @@ public:
       {
         
         // Compute physical coordinate of quadrature point, operations: 10.
-        X3[0] = FEA3_f2[ip][0]*vertex_coordinates[0] +                  FEA3_f2[ip][1]*vertex_coordinates[2] + FEA3_f2[ip][2]*vertex_coordinates[4];
-        X3[1] = FEA3_f2[ip][0]*vertex_coordinates[1] +                  FEA3_f2[ip][1]*vertex_coordinates[3] + FEA3_f2[ip][2]*vertex_coordinates[5];
+        X3[0] = FEA3_f2[ip][0]*coordinate_dofs[0] +                  FEA3_f2[ip][1]*coordinate_dofs[2] + FEA3_f2[ip][2]*coordinate_dofs[4];
+        X3[1] = FEA3_f2[ip][0]*coordinate_dofs[1] +                  FEA3_f2[ip][1]*coordinate_dofs[3] + FEA3_f2[ip][2]*coordinate_dofs[5];
         
         // Number of operations to compute ip constants: 4
         double I[1];
@@ -2314,77 +5045,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class spatialcoordinates_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   spatialcoordinates_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~spatialcoordinates_form_0()
+  ~spatialcoordinates_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "93a9e6de15168c1b53e577fc0d6aa7449365b3f2425fde638446780769d86eaf2a5581d66ce609ea332fabce82f078b2997155a424dc86ab13186acf61b35fc8";
+    return "8cee0bf13890a9231bf66c3c44c36a24bac7d1666db42f48cc265cabd45c1c80f86678c05d9edd62a234dc2f88873b9ff104eeef8f81de298326c00ddc51cf92";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new spatialcoordinates_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new spatialcoordinates_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new spatialcoordinates_finite_element_0();
+        return new spatialcoordinates_finite_element_2();
         break;
       }
     case 1:
       {
-        return new spatialcoordinates_finite_element_0();
+        return new spatialcoordinates_finite_element_2();
         break;
       }
     }
@@ -2392,19 +5115,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new spatialcoordinates_dofmap_0();
+        return new spatialcoordinates_dofmap_2();
         break;
       }
     case 1:
       {
-        return new spatialcoordinates_dofmap_0();
+        return new spatialcoordinates_dofmap_2();
         break;
       }
     }
@@ -2412,198 +5134,226 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new spatialcoordinates_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class spatialcoordinates_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   spatialcoordinates_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~spatialcoordinates_form_1()
+  ~spatialcoordinates_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "630f1aff5e213a57c7da135235c97f3c760aff8444e9c44f7eed19dd3ff14197bb54490d3a58b613413c948a9f2883b713e55ec9c0cae87dbc974289c0727dff";
+    return "017d662df165567bd556195e054cb352b58bcaba0d9e177392d7db375cca3e65b2b1f42e089976337099062940b7765c6dbbbea9e6a50288b64d3263a221c740";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new spatialcoordinates_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new spatialcoordinates_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new spatialcoordinates_finite_element_0();
+        return new spatialcoordinates_finite_element_2();
         break;
       }
     }
@@ -2611,14 +5361,13 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new spatialcoordinates_dofmap_0();
+        return new spatialcoordinates_dofmap_2();
         break;
       }
     }
@@ -2626,126 +5375,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new spatialcoordinates_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new spatialcoordinates_exterior_facet_integral_1_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -2759,14 +5544,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace SpatialCoordinates
 {
@@ -2775,43 +5566,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<spatialcoordinates_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<spatialcoordinates_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<spatialcoordinates_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<spatialcoordinates_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2822,63 +5590,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<spatialcoordinates_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<spatialcoordinates_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<spatialcoordinates_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<spatialcoordinates_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new spatialcoordinates_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -2886,7 +5661,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new spatialcoordinates_form_0());
+    _ufc_form = std::make_shared<const spatialcoordinates_form_0>();
   }
 
   // Destructor
@@ -2916,77 +5691,123 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), mesh)))
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<spatialcoordinates_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<spatialcoordinates_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new spatialcoordinates_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new spatialcoordinates_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<spatialcoordinates_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<spatialcoordinates_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
-class Form_L: public dolfin::Form
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 0)
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new spatialcoordinates_form_1());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_L: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 0)
   {
     _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new spatialcoordinates_form_1());
+    _ufc_form = std::make_shared<const spatialcoordinates_form_1>();
   }
 
   // Destructor
@@ -3015,16 +5836,76 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_L()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/spatial-coordinates/cpp/compile.log b/demo/undocumented/spatial-coordinates/cpp/compile.log
index aa6927f..c977257 100644
--- a/demo/undocumented/spatial-coordinates/cpp/compile.log
+++ b/demo/undocumented/spatial-coordinates/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form SpatialCoordinates
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
+  Unique elements:           'CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -31,32 +32,43 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              0
   Coefficients:                        '[]'
-  Unique elements:                     'CG2(?)'
-  Unique sub elements:                 'CG2(?)'
+  Unique elements:                     'CG2(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG2(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal SpatialCoordinate.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   Extracting monomial form representation from UFL form
   Monomial extraction failed: No handler defined for terminal SpatialCoordinate.
   Estimated cost of tensor representation: -1
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 5
+  quadrature_degree: 5
   
-Compiler stage 1 finished in 0.0775819 seconds.
+Compiler stage 1 finished in 0.150783 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -66,7 +78,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000659 seconds
+  144 entries computed in 0.000671 seconds
   Shape of reference tensor: (6, 6, 2, 2)
   Primary multi index:   rank = 2 dims = [6, 6] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -74,14 +86,16 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing quadrature representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {12: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+  {12: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
             -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
@@ -189,7 +203,7 @@ Compiler stage 2: Computing intermediate representation
             0.        ,  0.        ],
           [ 0.06308901,  0.87382197,  0.06308901,  0.24928675,  0.50142651,
             0.24928675,  0.31035245,  0.05314505,  0.6365025 ,  0.05314505,
-            0.6365025 ,  0.31035245]]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {None: {(0, 0): array([[-0.05512857, -0.05512857,  0.6533077 , -0.12499898, -0.12499898,
+            0.6365025 ,  0.31035245]]])}}}, FiniteElement('Lagrange', triangle, 2): {None: {None: {(0, 0): array([[-0.05512857, -0.05512857,  0.6533077 , -0.12499898, -0.12499898,
            0.00143058, -0.04749626, -0.11771516, -0.04749626,  0.17376836,
           -0.11771516,  0.17376836],
          [ 0.6533077 , -0.05512857, -0.05512857,  0.00143058, -0.12499898,
@@ -551,9 +565,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {3: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+  {3: {VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {0: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
           [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
   
          [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
@@ -697,7 +712,7 @@ Compiler stage 2: Computing intermediate representation
           [ 0.11270167,  0.5       ,  0.88729833]],
   
          [[ 0.        ,  0.        ,  0.        ],
-          [ 0.        ,  0.        ,  0.        ]]])}}}, FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None): {None: {0: {(0, 0): array([[  1.12757026e-16,   4.16333634e-17,   4.16333634e-17],
+          [ 0.        ,  0.        ,  0.        ]]])}}}, FiniteElement('Lagrange', triangle, 2): {None: {0: {(0, 0): array([[  1.12757026e-16,   4.16333634e-17,   4.16333634e-17],
          [  6.87298335e-01,  -9.71445147e-17,  -8.72983346e-02],
          [ -8.72983346e-02,   8.32667268e-17,   6.87298335e-01],
          [  4.00000000e-01,   1.00000000e+00,   4.00000000e-01],
@@ -893,7 +908,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.101578 seconds.
+Compiler stage 2 finished in 0.111219 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
@@ -902,84 +917,49 @@ Compiler stage 3: Optimizing intermediate representation
   Optimising expressions for facet integral 1
   Optimising expressions for facet integral 2
   
-Compiler stage 3 finished in 0.000700951 seconds.
+Compiler stage 3 finished in 0.000763893 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -997,18 +977,18 @@ Compiler stage 4: Generating code
   Removing unused variable: direction
   Generating code for forms
   
-Compiler stage 4 finished in 0.0758851 seconds.
+Compiler stage 4 finished in 0.156905 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000394106 seconds.
+Compiler stage 4.1 finished in 0.00050807 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./SpatialCoordinates.h.
-Compiler stage 5 finished in 0.000573158 seconds.
+Compiler stage 5 finished in 0.000612974 seconds.
 
-FFC finished in 0.256993 seconds.
+FFC finished in 0.421155 seconds.
+Output written to ./SpatialCoordinates.h.
diff --git a/demo/undocumented/spatial-coordinates/cpp/main.cpp b/demo/undocumented/spatial-coordinates/cpp/main.cpp
index 05f5f4e..3e7531f 100644
--- a/demo/undocumented/spatial-coordinates/cpp/main.cpp
+++ b/demo/undocumented/spatial-coordinates/cpp/main.cpp
@@ -52,19 +52,20 @@ class DirichletBoundary : public SubDomain
 int main()
 {
   // Create mesh and function space
-  UnitSquareMesh mesh(32, 32);
-  SpatialCoordinates::FunctionSpace V(mesh);
+  auto mesh = std::make_shared<UnitSquareMesh>(32, 32);
+  auto V = std::make_shared<SpatialCoordinates::FunctionSpace>(mesh);
 
   // Define boundary condition
-  Constant u0(0.0);
-  DirichletBoundary boundary;
-  DirichletBC bc(V, u0, boundary);
+  auto u0 = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
+  auto bc = std::make_shared<DirichletBC>(V, u0, boundary);
 
   // Define variational problem
-  SpatialCoordinates::BilinearForm a(V, V);
-  SpatialCoordinates::LinearForm L(V);
-  Function u(V);
-  LinearVariationalProblem problem(a, L, u, bc);
+  auto a = std::make_shared<SpatialCoordinates::BilinearForm>(V, V);
+  auto L = std::make_shared<SpatialCoordinates::LinearForm>(V);
+  auto u = std::make_shared<Function>(V);
+  std::vector<std::shared_ptr<const DirichletBC>> bcs = {bc};
+  auto problem = std::make_shared<LinearVariationalProblem>(a, L, u, bcs);
 
   // Compute solution
   LinearVariationalSolver solver(problem);
@@ -73,10 +74,10 @@ int main()
 
   // Save solution in VTK format
   File file("spatial-coordinates.pvd");
-  file << u;
+  file << *u;
 
   // Plot solution
-  plot(u);
+  plot(*u);
   interactive();
 
   return 0;
diff --git a/demo/undocumented/sub-function-assignment/python/demo_sub-function-assignment.py b/demo/undocumented/sub-function-assignment/python/demo_sub-function-assignment.py
index 4819c1d..4700ff6 100644
--- a/demo/undocumented/sub-function-assignment/python/demo_sub-function-assignment.py
+++ b/demo/undocumented/sub-function-assignment/python/demo_sub-function-assignment.py
@@ -30,8 +30,8 @@ V = FunctionSpace(mesh, "CG", 1)
 VV = VectorFunctionSpace(mesh, "CG", 1)
 
 # Define function
-v0 = Expression("sin(2*pi*x[0])*sin(2*pi*x[1])")
-v1 = Expression("cos(2*pi*x[0])*cos(2*pi*x[1])")
+v0 = Expression("sin(2*pi*x[0])*sin(2*pi*x[1])", degree=2)
+v1 = Expression("cos(2*pi*x[0])*cos(2*pi*x[1])", degree=2)
 
 vv1 = Function(VV)
 vv2 = Function(VV)
@@ -50,7 +50,7 @@ tp = time.time() - t0
 
 # Compute interpolation (evaluating dofs)
 t0 = time.time()
-vv1.interpolate(Expression(("v0", "v1"), v0=v0, v1=v1))
+vv1.interpolate(Expression(("v0", "v1"), v0=v0, v1=v1, degree=2))
 ti = time.time() - t0
 
 # Assign mixed function from two scalar functions
diff --git a/demo/undocumented/submesh/cpp/CMakeLists.txt b/demo/undocumented/submesh/cpp/CMakeLists.txt
index 72bb2cd..ebb6997 100644
--- a/demo/undocumented/submesh/cpp/CMakeLists.txt
+++ b/demo/undocumented/submesh/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/submesh/cpp/main.cpp b/demo/undocumented/submesh/cpp/main.cpp
index 57043c6..a818545 100644
--- a/demo/undocumented/submesh/cpp/main.cpp
+++ b/demo/undocumented/submesh/cpp/main.cpp
@@ -15,9 +15,6 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// First added:  2009-02-11
-// Last changed: 2015-06-15
-//
 // This demo program demonstrates how to extract matching sub meshes
 // from a common mesh.
 
@@ -32,15 +29,17 @@ int main()
   {
     bool inside(const Array<double>& x, bool on_boundary) const
     {
-      return x[0] > 1.4 - DOLFIN_EPS and x[0] < 1.6 + DOLFIN_EPS and x[1] < 0.6 + DOLFIN_EPS;
+      return x[0] > 1.4 - DOLFIN_EPS and x[0] < 1.6 + DOLFIN_EPS
+                                                and x[1] < 0.6 + DOLFIN_EPS;
     }
   };
 
   // Create mesh
-  RectangleMesh mesh(Point(0.0, 0.0), Point(3.0, 1.0), 60, 20);
+  auto mesh = std::make_shared<RectangleMesh>(Point(0.0, 0.0),
+                                              Point(3.0, 1.0), 60, 20);
 
   // Create sub domain markers and mark everything as 0
-  MeshFunction<std::size_t> sub_domains(mesh, mesh.topology().dim());
+  MeshFunction<std::size_t> sub_domains(mesh, mesh->topology().dim());
   sub_domains = 0;
 
   // Mark structure domain as 1
@@ -48,20 +47,22 @@ int main()
   structure.mark(sub_domains, 1);
 
   // Extract sub meshes
-  SubMesh fluid_mesh(mesh, sub_domains, 0);
-  SubMesh structure_mesh(mesh, sub_domains, 1);
+  auto fluid_mesh = std::make_shared<SubMesh>(*mesh, sub_domains, 0);
+  auto structure_mesh = std::make_shared<SubMesh>(*mesh, sub_domains, 1);
 
   // Move structure mesh
-  MeshGeometry& geometry = structure_mesh.geometry();
-  for (VertexIterator v(structure_mesh); !v.end(); ++v)
+  MeshGeometry& geometry = structure_mesh->geometry();
+
+  for (VertexIterator v(*structure_mesh); !v.end(); ++v)
   {
-    const double* x = v->x();
-    geometry.x(v->index())[0] += 0.1*x[0]*x[1];
+    std::array<double, 2> x = {{v->x()[0], v->x()[1]}};
+    x[0] += 0.1*x[0]*x[1];
+    geometry.set(v->index(), x.data());
   }
 
   // Move fluid mesh according to structure mesh
-  fluid_mesh.move(structure_mesh);
-  fluid_mesh.smooth();
+  ALE::move(fluid_mesh, *structure_mesh);
+  fluid_mesh->smooth();
 
   // Plot meshes
   plot(fluid_mesh);
diff --git a/demo/undocumented/submesh/python/demo_submesh.py b/demo/undocumented/submesh/python/demo_submesh.py
index d619aff..908dd2e 100644
--- a/demo/undocumented/submesh/python/demo_submesh.py
+++ b/demo/undocumented/submesh/python/demo_submesh.py
@@ -50,7 +50,7 @@ for x in structure_mesh.coordinates():
     x[0] += 0.1*x[0]*x[1]
 
 # Move fluid mesh according to structure mesh
-fluid_mesh.move(structure_mesh)
+ALE.move(fluid_mesh, structure_mesh)
 fluid_mesh.smooth()
 
 # Plot meshes
diff --git a/demo/undocumented/sym-dirichlet-bc/cpp/CMakeLists.txt b/demo/undocumented/sym-dirichlet-bc/cpp/CMakeLists.txt
index 226cb47..ed42f22 100644
--- a/demo/undocumented/sym-dirichlet-bc/cpp/CMakeLists.txt
+++ b/demo/undocumented/sym-dirichlet-bc/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/sym-dirichlet-bc/cpp/Poisson.h b/demo/undocumented/sym-dirichlet-bc/cpp/Poisson.h
index 779d380..5c0016e 100644
--- a/demo/undocumented/sym-dirichlet-bc/cpp/Poisson.h
+++ b/demo/undocumented/sym-dirichlet-bc/cpp/Poisson.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON_H
 #define __POISSON_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_finite_element_0()
+  ~poisson_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +902,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson_dofmap_0: public ufc::dofmap
+class poisson_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson_dofmap_0() : ufc::dofmap()
+  poisson_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_dofmap_0()
+  ~poisson_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -1041,295 +989,1976 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    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;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson_dofmap_0();
-  }
-
-};
-
-/// 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 poisson_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~poisson_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
-    
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-  }
-
-};
-
-/// 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 poisson_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true, false});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    3
-    // Number of operations (multiply-add pairs) for tensor contraction: 7
-    // Total number of operations (multiply-add pairs):                  13
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Compute geometry tensor
-    const double G0_0 = det*w[0][0]*(1.0);
-    const double G0_1 = det*w[0][1]*(1.0);
-    const double G0_2 = det*w[0][2]*(1.0);
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+};
+
+
+class poisson_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_0();
+  }
+
+};
+
+
+class poisson_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson_dofmap_1();
+  }
+
+};
+
+
+class poisson_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+  }
+
+};
+
+
+class poisson_cell_integral_1_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson_cell_integral_1_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson_cell_integral_1_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({true, false});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    3
+    // Number of operations (multiply-add pairs) for tensor contraction: 7
+    // Total number of operations (multiply-add pairs):                  13
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0 = det*w[0][0]*(1.0);
+    const double G0_1 = det*w[0][1]*(1.0);
+    const double G0_2 = det*w[0][2]*(1.0);
+    
+    // Compute element tensor
+    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
+    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
+    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
+  }
+
+};
+
+
+class poisson_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
+{
+public:
+
+  poisson_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
+  {
+    
+  }
+
+  ~poisson_exterior_facet_integral_1_otherwise() override
+  {
     
-    // Compute element tensor
-    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
-    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
-    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
-  }
-
-};
-
-/// This class defines the interface for the tabulation of the
-/// exterior facet tensor corresponding to the local contribution to
-/// a form from the integral over an exterior facet.
-
-class poisson_exterior_facet_integral_1_otherwise: public ufc::exterior_facet_integral
-{
-public:
-
-  /// Constructor
-  poisson_exterior_facet_integral_1_otherwise() : ufc::exterior_facet_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson_exterior_facet_integral_1_otherwise()
-  {
-    // Do nothing
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({false, true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local exterior facet
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               std::size_t facet,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       std::size_t facet,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      10
     // Number of operations (multiply-add pairs) for geometry tensor:    3
@@ -1338,7 +2967,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1351,8 +2980,8 @@ public:
     const unsigned int v1 = edge_vertices[facet][1];
     
     // Compute scale factor (length of edge scaled by length of reference interval)
-    const double dx0 = vertex_coordinates[2*v1 + 0] - vertex_coordinates[2*v0 + 0];
-    const double dx1 = vertex_coordinates[2*v1 + 1] - vertex_coordinates[2*v0 + 1];
+    const double dx0 = coordinate_dofs[2*v1 + 0] - coordinate_dofs[2*v0 + 0];
+    const double dx1 = coordinate_dofs[2*v1 + 1] - coordinate_dofs[2*v0 + 1];
     const double det = std::sqrt(dx0*dx0 + dx1*dx1);
     
     
@@ -1391,66 +3020,58 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_0()
+  ~poisson_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "a56ff760d1b2d36392fecaa89295d221b18d120e912a2917bc2e8573297855e6979ab2d877460aedf3ffaa3771279e271eabec6012cb797b652aa5da059b83ed";
+    return "327a2ebce665f0df9dcdfb386a5f82bed655eb49e6748bfe664bd49258af417c023ae55cb0509c094373c6b9856a9f7f919048c8bddfe52512e528caaee3cde4";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1469,8 +3090,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1489,192 +3109,220 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_custom_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_cutcell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  bool has_cell_integrals() const final override
+  {
+    return true;
+  }
+
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  bool has_interface_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  bool has_overlap_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return true;
+    return 0;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
-    return false;
+    return 0;
   }
 
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new poisson_cell_integral_0_otherwise();
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new poisson_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class poisson_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   poisson_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson_form_1()
+  ~poisson_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "e58507906d4ed11ee413a96a0fc6c639025a4127e4d90f9e99c7bee85f398d70855d6f5e3ae70dcc968b6b0f7967bb5fa54f876c26904fcb75b8950e4bc622c4";
+    return "4b3b1c93f282ab055c940e8938b5687d692b500d84be151f71593ae9d6ad97e0c11f287e5960fa8de2ad6025423bd6e9dc808cf75c5a18587d11a7db9b67ccf0";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 2;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0, 1});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1698,8 +3346,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1723,126 +3370,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return new poisson_exterior_facet_integral_1_otherwise();
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1856,14 +3539,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson
 {
@@ -1872,43 +3561,20 @@ class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1919,43 +3585,20 @@ class CoefficientSpace_g: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_g(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_g(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1966,43 +3609,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -2013,63 +3633,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -2077,7 +3704,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_0());
+    _ufc_form = std::make_shared<const poisson_form_0>();
   }
 
   // Destructor
@@ -2107,57 +3734,112 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
 typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 typedef CoefficientSpace_g Form_L_FunctionSpace_2;
@@ -2167,73 +3849,118 @@ class Form_L: public dolfin::Form
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
     dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
     this->f = f;
     this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    _ufc_form = std::make_shared<const poisson_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->f = *f;
-    this->g = *g;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
+    else if (name == "g")
+      return 1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    case 1:
+      return "g";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+  typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+  dolfin::CoefficientAssigner g;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f, const dolfin::GenericFunction& g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = f;
-    this->g = g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
-    dolfin::Form(1, 2), f(*this, 0), g(*this, 1)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f, std::shared_ptr<const dolfin::GenericFunction> g):
+    dolfin::MultiMeshForm(V0), f(*this, 0), g(*this, 1)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->f = *f;
-    this->g = *g;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
+    this->g = g;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
@@ -2269,20 +3996,26 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
   typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
   typedef Form_L_FunctionSpace_2 CoefficientSpace_g;
 
   // Coefficients
-  dolfin::CoefficientAssigner f;
-  dolfin::CoefficientAssigner g;
+  dolfin::MultiMeshCoefficientAssigner f;
+  dolfin::MultiMeshCoefficientAssigner g;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/sym-dirichlet-bc/cpp/compile.log b/demo/undocumented/sym-dirichlet-bc/cpp/compile.log
index f2c806b..45f0232 100644
--- a/demo/undocumented/sym-dirichlet-bc/cpp/compile.log
+++ b/demo/undocumented/sym-dirichlet-bc/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson
 
@@ -12,17 +13,17 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
   Geometric dimension:                 2
   Number of cell subdomains:           0
@@ -31,8 +32,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                           '(v_0)'
   Number of coefficients:              2
   Coefficients:                        '[w_0, w_1]'
-  Unique elements:                     'CG1(?)'
-  Unique sub elements:                 'CG1(?)'
+  Unique elements:                     'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:                 'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -40,27 +41,35 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0370872 seconds.
+Compiler stage 1 finished in 0.053472 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -70,7 +79,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000552 seconds
+  36 entries computed in 0.000534 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -78,6 +87,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -85,7 +95,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.00047 seconds
+  9 entries computed in 0.000467 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -93,6 +103,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -100,7 +111,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000756 seconds
+  9 entries computed in 0.000747 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -109,7 +120,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000664 seconds
+  9 entries computed in 0.000663 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -118,7 +129,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000656 seconds
+  9 entries computed in 0.00067 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -126,82 +137,72 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00829816 seconds.
+Compiler stage 2 finished in 0.0111842 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000128984 seconds.
+Compiler stage 3 finished in 0.000149965 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.029856 seconds.
+Compiler stage 4 finished in 0.073797 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000513077 seconds.
+Compiler stage 4.1 finished in 0.000574112 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson.h.
-Compiler stage 5 finished in 0.000521898 seconds.
+Compiler stage 5 finished in 0.000458002 seconds.
 
-FFC finished in 0.076679 seconds.
+FFC finished in 0.139964 seconds.
+Output written to ./Poisson.h.
diff --git a/demo/undocumented/sym-dirichlet-bc/cpp/main.cpp b/demo/undocumented/sym-dirichlet-bc/cpp/main.cpp
index 654eab5..df35efa 100644
--- a/demo/undocumented/sym-dirichlet-bc/cpp/main.cpp
+++ b/demo/undocumented/sym-dirichlet-bc/cpp/main.cpp
@@ -84,22 +84,22 @@ int main()
   };
 
   // Create mesh
-  UnitSquareMesh mesh(300, 300);
+  auto mesh = std::make_shared<UnitSquareMesh>(300, 300);
 
   // Create functions
-  Source f;
-  Flux g;
+  auto f = std::make_shared<Source>();
+  auto g = std::make_shared<Flux>();
 
   // Define forms and attach functions
-  Poisson::FunctionSpace V(mesh);
+  auto V = std::make_shared<Poisson::FunctionSpace>(mesh);
   Poisson::BilinearForm a(V, V);
   Poisson::LinearForm L(V);
   L.f = f; L.g = g;
 
   // Create boundary condition
-  Constant u0(0.0);
-  DirichletBoundary boundary;
-  DirichletBC bc(V, u0, boundary);
+  auto u0 = std::make_shared<Constant>(0.0);
+  auto boundary = std::make_shared<DirichletBoundary>();
+  auto bc = std::make_shared<DirichletBC>(V, u0, boundary);
 
   // Create function
   Function u(V);
@@ -115,12 +115,12 @@ int main()
   tic();
   assemble(A, a);
   assemble(b, L);
-  bc.apply(A, b);
+  bc->apply(A, b);
   table("Standard", "Assembly time") = toc();
 
   // Assemble A and b together
   tic();
-  assemble_system(A, b, a, L, bc);
+  assemble_system(A, b, a, L, {bc});
   table("Symmetric", "Assembly time") = toc();
 
   // Display summary
diff --git a/demo/undocumented/sym-dirichlet-bc/python/demo_sym-dirichlet-bc.py b/demo/undocumented/sym-dirichlet-bc/python/demo_sym-dirichlet-bc.py
index c7f259e..280cd8e 100644
--- a/demo/undocumented/sym-dirichlet-bc/python/demo_sym-dirichlet-bc.py
+++ b/demo/undocumented/sym-dirichlet-bc/python/demo_sym-dirichlet-bc.py
@@ -53,8 +53,8 @@ class DirichletBoundary(SubDomain):
 # Define variational problem
 u = TrialFunction(V)
 v = TestFunction(V)
-f = Source()
-g = Flux()
+f = Source(degree=2)
+g = Flux(degree=2)
 a = inner(grad(u), grad(v))*dx
 L = f*v*dx + g*v*ds
 
diff --git a/demo/undocumented/time-series/cpp/CMakeLists.txt b/demo/undocumented/time-series/cpp/CMakeLists.txt
index df7d63e..4f78d58 100644
--- a/demo/undocumented/time-series/cpp/CMakeLists.txt
+++ b/demo/undocumented/time-series/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/timing/python/.gitignore b/demo/undocumented/timing/python/.gitignore
new file mode 100644
index 0000000..6722cd9
--- /dev/null
+++ b/demo/undocumented/timing/python/.gitignore
@@ -0,0 +1 @@
+*.xml
diff --git a/demo/undocumented/timing/python/demo_timing.py b/demo/undocumented/timing/python/demo_timing.py
index b0b8f1a..2612efd 100644
--- a/demo/undocumented/timing/python/demo_timing.py
+++ b/demo/undocumented/timing/python/demo_timing.py
@@ -23,8 +23,8 @@ mesh = UnitSquareMesh(32, 32)
 V = FunctionSpace(mesh, "Lagrange", 1)
 bc = DirichletBC(V, 0.0, lambda x: near(x[0], 0.0) or near(x[0], 1.0))
 u, v = TrialFunction(V), TestFunction(V)
-f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-g = Expression("sin(5*x[0])")
+f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+g = Expression("sin(5*x[0])", degree=2)
 a = inner(grad(u), grad(v))*dx
 L = f*v*dx + g*v*ds
 u = Function(V)
diff --git a/demo/undocumented/waveguide/cpp/CMakeLists.txt b/demo/undocumented/waveguide/cpp/CMakeLists.txt
index 1a35154..39e93be 100644
--- a/demo/undocumented/waveguide/cpp/CMakeLists.txt
+++ b/demo/undocumented/waveguide/cpp/CMakeLists.txt
@@ -12,33 +12,32 @@ project(${PROJECT_NAME})
 #set(CMAKE_VERBOSE_MAKEFILE 1)
 
 # Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
+cmake_policy(SET CMP0004 NEW)
 
 # Get DOLFIN configuration data (DOLFINConfig.cmake must be in
 # DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+find_package(DOLFIN REQUIRED)
+
+if (EXISTS ${DOLFIN_USE_FILE})
+  include(${DOLFIN_USE_FILE})
+
+  # Default build type (can be overridden by user)
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+      "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+  endif()
+else()
+  # Compiler definitions
+  add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+  # Compiler flags
+  set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+  # Include directories
+  include_directories(${DOLFIN_INCLUDE_DIRS})
+  include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
 endif()
 
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
 # Executable
 add_executable(${PROJECT_NAME} main.cpp)
 
diff --git a/demo/undocumented/waveguide/cpp/Forms.h b/demo/undocumented/waveguide/cpp/Forms.h
index d0f8799..58c4173 100644
--- a/demo/undocumented/waveguide/cpp/Forms.h
+++ b/demo/undocumented/waveguide/cpp/Forms.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,102 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __FORMS_H
 #define __FORMS_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class forms_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   forms_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~forms_finite_element_0()
+  ~forms_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('triangle', 2)), 3, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 15;
+    return 3;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -117,367 +121,2756 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
     double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
     
     // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
+    *values = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0, 0.0, 0.0, -0.169533172561123, 0.0841793787126843, -0.11664236870396, 0.0, -0.146820034222103, 0.0729014804399754, -0.101015254455221};
-      
-      static const double coefficients1[10] = \
-      {0.0, 0.0, 0.0, 0.321678327423669, -0.134687005940295, 0.0972019739199672, 0.260579710864614, -0.12987926104263, 0.0976879837895672, -0.0631345340345131};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
-      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
         break;
       }
     case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0, 0.0, 0.0, 0.078246079643595, -0.168358757425368, 0.349927106111882, 0.0, 0.0677630927178938, -0.145802960879951, 0.303045763365663};
-      
-      static const double coefficients1[10] = \
-      {0.0, 0.0, 0.0, -0.16518616813648, 0.235702260395516, -0.272165526975909, -0.120267558860591, 0.146820034222104, -0.224536559755125, 0.176776695296637};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
-      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
         break;
       }
     case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0, 0.0, 0.0, -0.0391230398217976, -0.0841793787126843, -0.349927106111882, 0.0, -0.033881546358947, -0.0729014804399755, -0.303045763365663};
-      
-      static const double coefficients1[10] = \
-      {0.0, 0.0, 0.0, 0.0608580619450188, 0.0, 0.213844342623929, 0.0601337794302956, 0.0395284707521045, 0.112268279877563, -0.138895974875929};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
       // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      for (unsigned int r = 0; r < 3; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
-      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
         break;
       }
-    case 3:
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0, 0.0, 0.0, 0.169533172561123, 0.0841793787126841, 0.116642368703961, 0.0, 0.146820034222103, 0.0729014804399755, 0.101015254455221};
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
       
-      static const double coefficients1[10] = \
-      {0.0, 0.0, 0.0, 0.491211499984792, 0.218866384652979, 0.213844342623928, -0.260579710864614, 0.0169407731794734, -0.0247865033495917, 0.0378807204207079};
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
-      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 4:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0, 0.0, 0.0, -0.0782460796435953, -0.168358757425368, -0.349927106111882, 0.0, -0.067763092717894, -0.145802960879951, -0.303045763365663};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
       
-      static const double coefficients1[10] = \
-      {0.0, 0.0, 0.0, -0.243432247780074, -0.404061017820884, -0.622092633087791, 0.120267558860591, 0.0790569415042094, 0.0787335988751738, -0.126269068069027};
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
-      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    case 5:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      double basisvalues[3] = {0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
       basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
       basisvalues[0] *= std::sqrt(0.5);
       basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
       
       // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0, 0.0, 0.0, 0.0391230398217974, -0.084179378712684, 0.349927106111882, 0.0, 0.0338815463589468, -0.0729014804399754, 0.303045763365663};
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
       
-      static const double coefficients1[10] = \
-      {0.0, 0.0, 0.0, 0.0999811017668155, -0.0841793787126837, 0.563771448735811, -0.0601337794302957, 0.0734100171110521, -0.185169760317538, 0.164149788489734};
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
-      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[2];
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new forms_finite_element_0();
+  }
+
+};
+
+
+class forms_finite_element_1: public ufc::finite_element
+{
+public:
+
+  forms_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~forms_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 6;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new forms_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new forms_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new forms_finite_element_1();
+  }
+
+};
+
+
+class forms_finite_element_2: public ufc::finite_element
+{
+public:
+
+  forms_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~forms_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Nedelec 1st kind H(curl)', triangle, 3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::triangle;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 15;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 3;
+  }
+
+  const char * family() const final override
+  {
+    return "Nedelec 1st kind H(curl)";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0, 0.0, 0.0, -0.169533172561123, 0.0841793787126843, -0.11664236870396, 0.0, -0.146820034222103, 0.0729014804399754, -0.101015254455221};
+      
+      static const double coefficients1[10] = \
+      {0.0, 0.0, 0.0, 0.321678327423669, -0.134687005940295, 0.0972019739199672, 0.260579710864614, -0.12987926104263, 0.0976879837895672, -0.0631345340345131};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
+      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0, 0.0, 0.0, 0.078246079643595, -0.168358757425368, 0.349927106111882, 0.0, 0.0677630927178938, -0.145802960879951, 0.303045763365663};
+      
+      static const double coefficients1[10] = \
+      {0.0, 0.0, 0.0, -0.16518616813648, 0.235702260395516, -0.272165526975909, -0.120267558860591, 0.146820034222104, -0.224536559755125, 0.176776695296637};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
+      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0, 0.0, 0.0, -0.0391230398217976, -0.0841793787126843, -0.349927106111882, 0.0, -0.033881546358947, -0.0729014804399755, -0.303045763365663};
+      
+      static const double coefficients1[10] = \
+      {0.0, 0.0, 0.0, 0.0608580619450188, 0.0, 0.213844342623929, 0.0601337794302956, 0.0395284707521045, 0.112268279877563, -0.138895974875929};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
+      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0, 0.0, 0.0, 0.169533172561123, 0.0841793787126841, 0.116642368703961, 0.0, 0.146820034222103, 0.0729014804399755, 0.101015254455221};
+      
+      static const double coefficients1[10] = \
+      {0.0, 0.0, 0.0, 0.491211499984792, 0.218866384652979, 0.213844342623928, -0.260579710864614, 0.0169407731794734, -0.0247865033495917, 0.0378807204207079};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
+      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0, 0.0, 0.0, -0.0782460796435953, -0.168358757425368, -0.349927106111882, 0.0, -0.067763092717894, -0.145802960879951, -0.303045763365663};
+      
+      static const double coefficients1[10] = \
+      {0.0, 0.0, 0.0, -0.243432247780074, -0.404061017820884, -0.622092633087791, 0.120267558860591, 0.0790569415042094, 0.0787335988751738, -0.126269068069027};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
+      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
+      basisvalues[9] *= std::sqrt(2.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      basisvalues[4] *= std::sqrt(4.5);
+      basisvalues[8] *= std::sqrt(6.0);
+      basisvalues[3] *= std::sqrt(7.5);
+      basisvalues[7] *= std::sqrt(10.0);
+      basisvalues[6] *= std::sqrt(14.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.0, 0.0, 0.0, 0.0391230398217974, -0.084179378712684, 0.349927106111882, 0.0, 0.0338815463589468, -0.0729014804399754, 0.303045763365663};
+      
+      static const double coefficients1[10] = \
+      {0.0, 0.0, 0.0, 0.0999811017668155, -0.0841793787126837, 0.563771448735811, -0.0601337794302957, 0.0734100171110521, -0.185169760317538, 0.164149788489734};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+        values[1] += coefficients1[r]*basisvalues[r];
+      } // end loop over 'r'
+      
+      // Using covariant Piola transform to map values back to the physical element
+      const double tmp_ref0 = values[0];
+      const double tmp_ref1 = values[1];
+      values[0] = (K[0]*tmp_ref0 + K[2]*tmp_ref1);
+      values[1] = (K[1]*tmp_ref0 + K[3]*tmp_ref1);
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      double tmp1 = (1.0 - Y)/2.0;
+      double tmp2 = tmp1*tmp1;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
+      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
+      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
+      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
+      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
+      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[5] *= std::sqrt(1.5);
       basisvalues[9] *= std::sqrt(2.0);
       basisvalues[1] *= std::sqrt(3.0);
       basisvalues[4] *= std::sqrt(4.5);
@@ -943,20 +3336,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -965,7 +3356,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -973,21 +3364,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1007,7 +3396,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1019,7 +3408,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1028,8 +3417,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1132,21 +3521,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1325,21 +3714,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1518,21 +3907,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1711,21 +4100,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -1904,21 +4293,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2097,21 +4486,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2290,21 +4679,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2483,21 +4872,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2676,21 +5065,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -2869,21 +5258,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3062,21 +5451,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3255,21 +5644,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3448,21 +5837,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3641,21 +6030,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3834,21 +6223,21 @@ public:
       {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
+      {5.29150262212919, -4.61061686781004e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660779, 0.0, 0.0, 0.0, 0.0},
       {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
+      {3.46410161513775, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
       {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       static const double dmats1[10][10] = \
       {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.58198889747162, 4.74341649025258, -0.912870929175281, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
       {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
+      {2.64575131106457, 5.18459255872625, -1.49666295470956, 6.83130051063972, -1.05830052442583, 0.305505046330388, 0.0, 0.0, 0.0, 0.0},
+      {2.23606797749982, 2.19089023002068, 2.52982212813469, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
+      {1.73205080756888, -5.09116882454314, 3.91918358845309, 0.0, 9.6994845223857, 4.20000000000001, 0.0, 0.0, 0.0, 0.0},
       {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
@@ -3983,28 +6372,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -4040,7 +6427,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 15; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -4048,22 +6435,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -4074,13 +6459,13 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     switch (i)
     {
     case 0:
       {
-        y[0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-      y[1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
+        y[0] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+      y[1] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (-1.0)*(J[0]*vals[0] + J[2]*vals[1]) + (J[1]*vals[0] + J[3]*vals[1]);
       return result;
@@ -4088,8 +6473,8 @@ public:
       }
     case 1:
       {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (-1.0)*(J[0]*vals[0] + J[2]*vals[1]) + (J[1]*vals[0] + J[3]*vals[1]);
       return result;
@@ -4097,8 +6482,8 @@ public:
       }
     case 2:
       {
-        y[0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
-      y[1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
+        y[0] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[4];
+      y[1] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (-1.0)*(J[0]*vals[0] + J[2]*vals[1]) + (J[1]*vals[0] + J[3]*vals[1]);
       return result;
@@ -4106,8 +6491,8 @@ public:
       }
     case 3:
       {
-        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
-      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
+        y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[4];
+      y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (J[1]*vals[0] + J[3]*vals[1]);
       return result;
@@ -4115,8 +6500,8 @@ public:
       }
     case 4:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (J[1]*vals[0] + J[3]*vals[1]);
       return result;
@@ -4124,8 +6509,8 @@ public:
       }
     case 5:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
-      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
+        y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[4];
+      y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[5];
       f.evaluate(vals, y, c);
       result = (J[1]*vals[0] + J[3]*vals[1]);
       return result;
@@ -4133,8 +6518,8 @@ public:
       }
     case 6:
       {
-        y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
-      y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
+        y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[2];
+      y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (J[0]*vals[0] + J[2]*vals[1]);
       return result;
@@ -4142,8 +6527,8 @@ public:
       }
     case 7:
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (J[0]*vals[0] + J[2]*vals[1]);
       return result;
@@ -4151,8 +6536,8 @@ public:
       }
     case 8:
       {
-        y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
-      y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
+        y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[2];
+      y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[3];
       f.evaluate(vals, y, c);
       result = (J[0]*vals[0] + J[2]*vals[1]);
       return result;
@@ -4174,8 +6559,8 @@ public:
         const double w2 = X_9[r][1];
         
         // Compute affine mapping y = F(X)
-        y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-        y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
+        y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+        y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
         // Evaluate function at physical point
         f.evaluate(vals, y, c);
         // Map function to reference element
@@ -4206,8 +6591,8 @@ public:
         const double w2 = X_10[r][1];
         
         // Compute affine mapping y = F(X)
-        y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-        y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
+        y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+        y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
         // Evaluate function at physical point
         f.evaluate(vals, y, c);
         // Map function to reference element
@@ -4238,8 +6623,8 @@ public:
         const double w2 = X_11[r][1];
         
         // Compute affine mapping y = F(X)
-        y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-        y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
+        y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+        y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
         // Evaluate function at physical point
         f.evaluate(vals, y, c);
         // Map function to reference element
@@ -4270,8 +6655,8 @@ public:
         const double w2 = X_12[r][1];
         
         // Compute affine mapping y = F(X)
-        y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-        y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
+        y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+        y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
         // Evaluate function at physical point
         f.evaluate(vals, y, c);
         // Map function to reference element
@@ -4302,8 +6687,8 @@ public:
         const double w2 = X_13[r][1];
         
         // Compute affine mapping y = F(X)
-        y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-        y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
+        y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+        y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
         // Evaluate function at physical point
         f.evaluate(vals, y, c);
         // Map function to reference element
@@ -4334,8 +6719,8 @@ public:
         const double w2 = X_14[r][1];
         
         // Compute affine mapping y = F(X)
-        y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-        y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
+        y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+        y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
         // Evaluate function at physical point
         f.evaluate(vals, y, c);
         // Map function to reference element
@@ -4355,12 +6740,11 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -4371,49 +6755,49 @@ public:
     double result;
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    y[0] = 0.75*vertex_coordinates[2] + 0.25*vertex_coordinates[4];
-    y[1] = 0.75*vertex_coordinates[3] + 0.25*vertex_coordinates[5];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    y[0] = 0.75*coordinate_dofs[2] + 0.25*coordinate_dofs[4];
+    y[1] = 0.75*coordinate_dofs[3] + 0.25*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (-1.0)*(J[0]*vals[0] + J[2]*vals[1]) + (J[1]*vals[0] + J[3]*vals[1]);
     values[0] = result;
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (-1.0)*(J[0]*vals[0] + J[2]*vals[1]) + (J[1]*vals[0] + J[3]*vals[1]);
     values[1] = result;
-    y[0] = 0.25*vertex_coordinates[2] + 0.75*vertex_coordinates[4];
-    y[1] = 0.25*vertex_coordinates[3] + 0.75*vertex_coordinates[5];
+    y[0] = 0.25*coordinate_dofs[2] + 0.75*coordinate_dofs[4];
+    y[1] = 0.25*coordinate_dofs[3] + 0.75*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (-1.0)*(J[0]*vals[0] + J[2]*vals[1]) + (J[1]*vals[0] + J[3]*vals[1]);
     values[2] = result;
-    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[4];
-    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[5];
+    y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[4];
+    y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (J[1]*vals[0] + J[3]*vals[1]);
     values[3] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[4];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (J[1]*vals[0] + J[3]*vals[1]);
     values[4] = result;
-    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[4];
-    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[5];
+    y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[4];
+    y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[5];
     f.evaluate(vals, y, c);
     result = (J[1]*vals[0] + J[3]*vals[1]);
     values[5] = result;
-    y[0] = 0.75*vertex_coordinates[0] + 0.25*vertex_coordinates[2];
-    y[1] = 0.75*vertex_coordinates[1] + 0.25*vertex_coordinates[3];
+    y[0] = 0.75*coordinate_dofs[0] + 0.25*coordinate_dofs[2];
+    y[1] = 0.75*coordinate_dofs[1] + 0.25*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (J[0]*vals[0] + J[2]*vals[1]);
     values[6] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[2];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (J[0]*vals[0] + J[2]*vals[1]);
     values[7] = result;
-    y[0] = 0.25*vertex_coordinates[0] + 0.75*vertex_coordinates[2];
-    y[1] = 0.25*vertex_coordinates[1] + 0.75*vertex_coordinates[3];
+    y[0] = 0.25*coordinate_dofs[0] + 0.75*coordinate_dofs[2];
+    y[1] = 0.25*coordinate_dofs[1] + 0.75*coordinate_dofs[3];
     f.evaluate(vals, y, c);
     result = (J[0]*vals[0] + J[2]*vals[1]);
     values[8] = result;
@@ -4431,8 +6815,8 @@ public:
       const double w2 = X_9[r][1];
       
       // Compute affine mapping y = F(X)
-      y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-      y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
+      y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+      y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
       // Evaluate function at physical point
       f.evaluate(vals, y, c);
       // Map function to reference element
@@ -4444,238 +6828,637 @@ public:
         result += copy_9[D_9[r][s]]*W_9[r][s];
       } // end loop over 's'
     } // end loop over 'r'
-    values[9] = result;
+    values[9] = result;
+    result = 0.0;
+    double X_10[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
+    int D_10[36][1] = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}};
+    double W_10[36][1] = {{-0.00971097319454}, {-0.0159756941744}, {-0.0129148084988}, {-0.00602410954055}, {-0.00140335236045}, {-8.83197279225e-05}, {-0.014499997977}, {-0.0238542037517}, {-0.0192838239128}, {-0.0089949353583}, {-0.00209542400951}, {-0.000131875132445}, {-0.00678703358623}, {-0.0111654692844}, {-0.00902620543637}, {-0.00421027151037}, {-0.000980807938907}, {-6.17269708946e-05}, {0.00678703358623}, {0.0111654692844}, {0.00902620543637}, {0.00421027151037}, {0.0009808079 [...]
+    double copy_10[2];
+    // Loop over points
+    for (unsigned int r = 0; r < 36; r++)
+    {
+      // Evaluate basis functions for affine mapping
+      const double w0 = 1.0 - X_10[r][0] - X_10[r][1];
+      const double w1 = X_10[r][0];
+      const double w2 = X_10[r][1];
+      
+      // Compute affine mapping y = F(X)
+      y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+      y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
+      // Evaluate function at physical point
+      f.evaluate(vals, y, c);
+      // Map function to reference element
+      copy_10[0] = J[0]*vals[0] + J[2]*vals[1];
+      copy_10[1] = J[1]*vals[0] + J[3]*vals[1];
+      // Loop over directions
+      for (unsigned int s = 0; s < 1; s++)
+      {
+        result += copy_10[D_10[r][s]]*W_10[r][s];
+      } // end loop over 's'
+    } // end loop over 'r'
+    values[10] = result;
+    result = 0.0;
+    double X_11[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
+    int D_11[36][1] = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}};
+    double W_11[36][1] = {{-0.0056494841656}, {-0.00645290853773}, {0.000132112736967}, {0.00571336122195}, {0.00492388644484}, {0.00133303229957}, {-0.0118962371707}, {-0.0135880247038}, {0.000278192558146}, {0.0120307444266}, {0.010368330848}, {0.00280699404177}, {-0.015429623211}, {-0.0176239005959}, {0.0003608205091}, {0.0156040814239}, {0.0134479025608}, {0.00364071931307}, {-0.015429623211}, {-0.0176239005959}, {0.0003608205091}, {0.0156040814239}, {0.0134479025608}, {0.00364071931 [...]
+    double copy_11[2];
+    // Loop over points
+    for (unsigned int r = 0; r < 36; r++)
+    {
+      // Evaluate basis functions for affine mapping
+      const double w0 = 1.0 - X_11[r][0] - X_11[r][1];
+      const double w1 = X_11[r][0];
+      const double w2 = X_11[r][1];
+      
+      // Compute affine mapping y = F(X)
+      y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+      y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
+      // Evaluate function at physical point
+      f.evaluate(vals, y, c);
+      // Map function to reference element
+      copy_11[0] = J[0]*vals[0] + J[2]*vals[1];
+      copy_11[1] = J[1]*vals[0] + J[3]*vals[1];
+      // Loop over directions
+      for (unsigned int s = 0; s < 1; s++)
+      {
+        result += copy_11[D_11[r][s]]*W_11[r][s];
+      } // end loop over 's'
+    } // end loop over 'r'
+    values[11] = result;
+    result = 0.0;
+    double X_12[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
+    int D_12[36][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+    double W_12[36][1] = {{0.00438000703533}, {0.00821012828325}, {0.00852813657368}, {0.00597613827346}, {0.00266246789938}, {0.000529299521057}, {0.00922307258049}, {0.0172882391377}, {0.0179578758575}, {0.0125840795694}, {0.0056064144375}, {0.00111455709092}, {0.0119624829871}, {0.0224231420448}, {0.023291672331}, {0.0163217665744}, {0.00727161547759}, {0.00144559962225}, {0.0119624829871}, {0.0224231420448}, {0.023291672331}, {0.0163217665744}, {0.00727161547759}, {0.00144559962225}, [...]
+    double copy_12[2];
+    // Loop over points
+    for (unsigned int r = 0; r < 36; r++)
+    {
+      // Evaluate basis functions for affine mapping
+      const double w0 = 1.0 - X_12[r][0] - X_12[r][1];
+      const double w1 = X_12[r][0];
+      const double w2 = X_12[r][1];
+      
+      // Compute affine mapping y = F(X)
+      y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+      y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
+      // Evaluate function at physical point
+      f.evaluate(vals, y, c);
+      // Map function to reference element
+      copy_12[0] = J[0]*vals[0] + J[2]*vals[1];
+      copy_12[1] = J[1]*vals[0] + J[3]*vals[1];
+      // Loop over directions
+      for (unsigned int s = 0; s < 1; s++)
+      {
+        result += copy_12[D_12[r][s]]*W_12[r][s];
+      } // end loop over 's'
+    } // end loop over 'r'
+    values[12] = result;
     result = 0.0;
-    double X_10[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
-    int D_10[36][1] = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}};
-    double W_10[36][1] = {{-0.00971097319454}, {-0.0159756941744}, {-0.0129148084988}, {-0.00602410954055}, {-0.00140335236045}, {-8.83197279225e-05}, {-0.014499997977}, {-0.0238542037517}, {-0.0192838239128}, {-0.0089949353583}, {-0.00209542400951}, {-0.000131875132445}, {-0.00678703358623}, {-0.0111654692844}, {-0.00902620543637}, {-0.00421027151037}, {-0.000980807938907}, {-6.17269708946e-05}, {0.00678703358623}, {0.0111654692844}, {0.00902620543637}, {0.00421027151037}, {0.0009808079 [...]
-    double copy_10[2];
+    double X_13[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
+    int D_13[36][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+    double W_13[36][1] = {{-0.00971097319454}, {-0.0159756941744}, {-0.0129148084988}, {-0.00602410954055}, {-0.00140335236045}, {-8.83197279225e-05}, {-0.014499997977}, {-0.0238542037517}, {-0.0192838239128}, {-0.0089949353583}, {-0.00209542400951}, {-0.000131875132445}, {-0.00678703358623}, {-0.0111654692844}, {-0.00902620543637}, {-0.00421027151037}, {-0.000980807938907}, {-6.17269708946e-05}, {0.00678703358623}, {0.0111654692844}, {0.00902620543637}, {0.00421027151037}, {0.0009808079 [...]
+    double copy_13[2];
     // Loop over points
     for (unsigned int r = 0; r < 36; r++)
     {
       // Evaluate basis functions for affine mapping
-      const double w0 = 1.0 - X_10[r][0] - X_10[r][1];
-      const double w1 = X_10[r][0];
-      const double w2 = X_10[r][1];
+      const double w0 = 1.0 - X_13[r][0] - X_13[r][1];
+      const double w1 = X_13[r][0];
+      const double w2 = X_13[r][1];
       
       // Compute affine mapping y = F(X)
-      y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-      y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
+      y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+      y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
       // Evaluate function at physical point
       f.evaluate(vals, y, c);
       // Map function to reference element
-      copy_10[0] = J[0]*vals[0] + J[2]*vals[1];
-      copy_10[1] = J[1]*vals[0] + J[3]*vals[1];
+      copy_13[0] = J[0]*vals[0] + J[2]*vals[1];
+      copy_13[1] = J[1]*vals[0] + J[3]*vals[1];
       // Loop over directions
       for (unsigned int s = 0; s < 1; s++)
       {
-        result += copy_10[D_10[r][s]]*W_10[r][s];
+        result += copy_13[D_13[r][s]]*W_13[r][s];
       } // end loop over 's'
     } // end loop over 'r'
-    values[10] = result;
+    values[13] = result;
     result = 0.0;
-    double X_11[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
-    int D_11[36][1] = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}};
-    double W_11[36][1] = {{-0.0056494841656}, {-0.00645290853773}, {0.000132112736967}, {0.00571336122195}, {0.00492388644484}, {0.00133303229957}, {-0.0118962371707}, {-0.0135880247038}, {0.000278192558146}, {0.0120307444266}, {0.010368330848}, {0.00280699404177}, {-0.015429623211}, {-0.0176239005959}, {0.0003608205091}, {0.0156040814239}, {0.0134479025608}, {0.00364071931307}, {-0.015429623211}, {-0.0176239005959}, {0.0003608205091}, {0.0156040814239}, {0.0134479025608}, {0.00364071931 [...]
-    double copy_11[2];
+    double X_14[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
+    int D_14[36][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+    double W_14[36][1] = {{-0.0056494841656}, {-0.00645290853773}, {0.000132112736967}, {0.00571336122195}, {0.00492388644484}, {0.00133303229957}, {-0.0118962371707}, {-0.0135880247038}, {0.000278192558146}, {0.0120307444266}, {0.010368330848}, {0.00280699404177}, {-0.015429623211}, {-0.0176239005959}, {0.0003608205091}, {0.0156040814239}, {0.0134479025608}, {0.00364071931307}, {-0.015429623211}, {-0.0176239005959}, {0.0003608205091}, {0.0156040814239}, {0.0134479025608}, {0.00364071931 [...]
+    double copy_14[2];
     // Loop over points
     for (unsigned int r = 0; r < 36; r++)
     {
       // Evaluate basis functions for affine mapping
-      const double w0 = 1.0 - X_11[r][0] - X_11[r][1];
-      const double w1 = X_11[r][0];
-      const double w2 = X_11[r][1];
+      const double w0 = 1.0 - X_14[r][0] - X_14[r][1];
+      const double w1 = X_14[r][0];
+      const double w2 = X_14[r][1];
       
       // Compute affine mapping y = F(X)
-      y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-      y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
+      y[0] = w0*coordinate_dofs[0] + w1*coordinate_dofs[2] + w2*coordinate_dofs[4];
+      y[1] = w0*coordinate_dofs[1] + w1*coordinate_dofs[3] + w2*coordinate_dofs[5];
       // Evaluate function at physical point
       f.evaluate(vals, y, c);
       // Map function to reference element
-      copy_11[0] = J[0]*vals[0] + J[2]*vals[1];
-      copy_11[1] = J[1]*vals[0] + J[3]*vals[1];
+      copy_14[0] = J[0]*vals[0] + J[2]*vals[1];
+      copy_14[1] = J[1]*vals[0] + J[3]*vals[1];
       // Loop over directions
       for (unsigned int s = 0; s < 1; s++)
       {
-        result += copy_11[D_11[r][s]]*W_11[r][s];
+        result += copy_14[D_14[r][s]]*W_14[r][s];
       } // end loop over 's'
     } // end loop over 'r'
-    values[11] = result;
-    result = 0.0;
-    double X_12[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
-    int D_12[36][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
-    double W_12[36][1] = {{0.00438000703533}, {0.00821012828325}, {0.00852813657368}, {0.00597613827346}, {0.00266246789938}, {0.000529299521057}, {0.00922307258049}, {0.0172882391377}, {0.0179578758575}, {0.0125840795694}, {0.0056064144375}, {0.00111455709092}, {0.0119624829871}, {0.0224231420448}, {0.023291672331}, {0.0163217665744}, {0.00727161547759}, {0.00144559962225}, {0.0119624829871}, {0.0224231420448}, {0.023291672331}, {0.0163217665744}, {0.00727161547759}, {0.00144559962225}, [...]
-    double copy_12[2];
-    // Loop over points
-    for (unsigned int r = 0; r < 36; r++)
+    values[14] = result;
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[3]*K[2]*3.0 + dof_values[4]*(K[2]*(-3.0)) + dof_values[5]*K[2] + dof_values[6]*K[0]*3.0 + dof_values[7]*(K[0]*(-3.0)) + dof_values[8]*K[0] + dof_values[11]*(K[2]*(1.1990408666e-14)) + dof_values[14]*(K[0]*(-1.07435785403e-14));
+    vertex_values[2] = dof_values[0]*K[2]*3.0 + dof_values[1]*(K[2]*(-3.0)) + dof_values[2]*K[2] + dof_values[6]*(K[0] + K[2]) + dof_values[7]*(K[0]*(-3.0) + K[2]*(-3.0)) + dof_values[8]*(K[0]*3.0 + K[2]*3.0) + dof_values[9]*(K[2]*(-1.52100554374e-14)) + dof_values[10]*(K[2]*(-2.65343302885e-14)) + dof_values[11]*(K[2]*(2.44249065418e-14)) + dof_values[12]*(K[2]*(1.44051437445e-14)) + dof_values[14]*(K[0]*(1.10167927423e-14) + K[2]*(3.43058914609e-14));
+    vertex_values[4] = dof_values[0]*(K[0]*(-1.0)) + dof_values[1]*K[0]*3.0 + dof_values[2]*(K[0]*(-3.0)) + dof_values[3]*(K[0] + K[2]) + dof_values[4]*(K[0]*(-3.0) + K[2]*(-3.0)) + dof_values[5]*(K[0]*3.0 + K[2]*3.0) + dof_values[9]*(K[0]*(-1.1990408666e-14)) + dof_values[11]*(K[0]*(2.13162820728e-14) + K[2]*(-1.06581410364e-14)) + dof_values[12]*(K[0]*(1.14203343109e-14)) + dof_values[14]*(K[0]*(2.54750955873e-14));
+    vertex_values[1] = dof_values[3]*K[3]*3.0 + dof_values[4]*(K[3]*(-3.0)) + dof_values[5]*K[3] + dof_values[6]*K[1]*3.0 + dof_values[7]*(K[1]*(-3.0)) + dof_values[8]*K[1] + dof_values[11]*(K[3]*(1.1990408666e-14)) + dof_values[14]*(K[1]*(-1.07435785403e-14));
+    vertex_values[3] = dof_values[0]*K[3]*3.0 + dof_values[1]*(K[3]*(-3.0)) + dof_values[2]*K[3] + dof_values[6]*(K[1] + K[3]) + dof_values[7]*(K[1]*(-3.0) + K[3]*(-3.0)) + dof_values[8]*(K[1]*3.0 + K[3]*3.0) + dof_values[9]*(K[3]*(-1.52100554374e-14)) + dof_values[10]*(K[3]*(-2.65343302885e-14)) + dof_values[11]*(K[3]*(2.44249065418e-14)) + dof_values[12]*(K[3]*(1.44051437445e-14)) + dof_values[14]*(K[1]*(1.10167927423e-14) + K[3]*(3.43058914609e-14));
+    vertex_values[5] = dof_values[0]*(K[1]*(-1.0)) + dof_values[1]*K[1]*3.0 + dof_values[2]*(K[1]*(-3.0)) + dof_values[3]*(K[1] + K[3]) + dof_values[4]*(K[1]*(-3.0) + K[3]*(-3.0)) + dof_values[5]*(K[1]*3.0 + K[3]*3.0) + dof_values[9]*(K[1]*(-1.1990408666e-14)) + dof_values[11]*(K[1]*(2.13162820728e-14) + K[3]*(-1.06581410364e-14)) + dof_values[12]*(K[1]*(1.14203343109e-14)) + dof_values[14]*(K[1]*(2.54750955873e-14));
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    throw std::runtime_error("tabulate_dof_coordinates is not defined for this element");
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new forms_finite_element_2();
+  }
+
+};
+
+
+class forms_dofmap_0: public ufc::dofmap
+{
+public:
+
+  forms_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~forms_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new forms_dofmap_0();
+  }
+
+};
+
+
+class forms_dofmap_1: public ufc::dofmap
+{
+public:
+
+  forms_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~forms_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
     {
-      // Evaluate basis functions for affine mapping
-      const double w0 = 1.0 - X_12[r][0] - X_12[r][1];
-      const double w1 = X_12[r][0];
-      const double w2 = X_12[r][1];
-      
-      // Compute affine mapping y = F(X)
-      y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-      y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
-      // Evaluate function at physical point
-      f.evaluate(vals, y, c);
-      // Map function to reference element
-      copy_12[0] = J[0]*vals[0] + J[2]*vals[1];
-      copy_12[1] = J[1]*vals[0] + J[3]*vals[1];
-      // Loop over directions
-      for (unsigned int s = 0; s < 1; s++)
+    case 0:
       {
-        result += copy_12[D_12[r][s]]*W_12[r][s];
-      } // end loop over 's'
-    } // end loop over 'r'
-    values[12] = result;
-    result = 0.0;
-    double X_13[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
-    int D_13[36][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
-    double W_13[36][1] = {{-0.00971097319454}, {-0.0159756941744}, {-0.0129148084988}, {-0.00602410954055}, {-0.00140335236045}, {-8.83197279225e-05}, {-0.014499997977}, {-0.0238542037517}, {-0.0192838239128}, {-0.0089949353583}, {-0.00209542400951}, {-0.000131875132445}, {-0.00678703358623}, {-0.0111654692844}, {-0.00902620543637}, {-0.00421027151037}, {-0.000980807938907}, {-6.17269708946e-05}, {0.00678703358623}, {0.0111654692844}, {0.00902620543637}, {0.00421027151037}, {0.0009808079 [...]
-    double copy_13[2];
-    // Loop over points
-    for (unsigned int r = 0; r < 36; r++)
-    {
-      // Evaluate basis functions for affine mapping
-      const double w0 = 1.0 - X_13[r][0] - X_13[r][1];
-      const double w1 = X_13[r][0];
-      const double w2 = X_13[r][1];
-      
-      // Compute affine mapping y = F(X)
-      y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-      y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
-      // Evaluate function at physical point
-      f.evaluate(vals, y, c);
-      // Map function to reference element
-      copy_13[0] = J[0]*vals[0] + J[2]*vals[1];
-      copy_13[1] = J[1]*vals[0] + J[3]*vals[1];
-      // Loop over directions
-      for (unsigned int s = 0; s < 1; s++)
+        return true;
+        break;
+      }
+    case 1:
       {
-        result += copy_13[D_13[r][s]]*W_13[r][s];
-      } // end loop over 's'
-    } // end loop over 'r'
-    values[13] = result;
-    result = 0.0;
-    double X_14[36][2] = {{0.0327753666145, 0.0293164271598}, {0.0287653330126, 0.148078599668}, {0.022386872978, 0.336984690281}, {0.0149015633667, 0.558671518772}, {0.00779187470129, 0.76923386203}, {0.00246669715267, 0.92694567132}, {0.164429241595, 0.0293164271598}, {0.14431148695, 0.148078599668}, {0.112311681781, 0.336984690281}, {0.0747589734626, 0.558671518772}, {0.0390907007328, 0.76923386203}, {0.0123750604174, 0.92694567132}, {0.369529924372, 0.0293164271598}, {0.324318304589, [...]
-    int D_14[36][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
-    double W_14[36][1] = {{-0.0056494841656}, {-0.00645290853773}, {0.000132112736967}, {0.00571336122195}, {0.00492388644484}, {0.00133303229957}, {-0.0118962371707}, {-0.0135880247038}, {0.000278192558146}, {0.0120307444266}, {0.010368330848}, {0.00280699404177}, {-0.015429623211}, {-0.0176239005959}, {0.0003608205091}, {0.0156040814239}, {0.0134479025608}, {0.00364071931307}, {-0.015429623211}, {-0.0176239005959}, {0.0003608205091}, {0.0156040814239}, {0.0134479025608}, {0.00364071931 [...]
-    double copy_14[2];
-    // Loop over points
-    for (unsigned int r = 0; r < 36; r++)
-    {
-      // Evaluate basis functions for affine mapping
-      const double w0 = 1.0 - X_14[r][0] - X_14[r][1];
-      const double w1 = X_14[r][0];
-      const double w2 = X_14[r][1];
-      
-      // Compute affine mapping y = F(X)
-      y[0] = w0*vertex_coordinates[0] + w1*vertex_coordinates[2] + w2*vertex_coordinates[4];
-      y[1] = w0*vertex_coordinates[1] + w1*vertex_coordinates[3] + w2*vertex_coordinates[5];
-      // Evaluate function at physical point
-      f.evaluate(vals, y, c);
-      // Map function to reference element
-      copy_14[0] = J[0]*vals[0] + J[2]*vals[1];
-      copy_14[1] = J[1]*vals[0] + J[3]*vals[1];
-      // Loop over directions
-      for (unsigned int s = 0; s < 1; s++)
+        return false;
+        break;
+      }
+    case 2:
       {
-        result += copy_14[D_14[r][s]]*W_14[r][s];
-      } // end loop over 's'
-    } // end loop over 'r'
-    values[14] = result;
+        return false;
+        break;
+      }
+    }
+    
+    return false;
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  std::size_t topological_dimension() const final override
   {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[3]*K[2]*3.0 + dof_values[4]*(K[2]*(-3.0)) + dof_values[5]*K[2] + dof_values[6]*K[0]*3.0 + dof_values[7]*(K[0]*(-3.0)) + dof_values[8]*K[0] + dof_values[11]*(K[2]*(1.1990408666e-14)) + dof_values[14]*(K[0]*(-1.07435785403e-14));
-    vertex_values[2] = dof_values[0]*K[2]*3.0 + dof_values[1]*(K[2]*(-3.0)) + dof_values[2]*K[2] + dof_values[6]*(K[0] + K[2]) + dof_values[7]*(K[0]*(-3.0) + K[2]*(-3.0)) + dof_values[8]*(K[0]*3.0 + K[2]*3.0) + dof_values[9]*(K[2]*(-1.52100554374e-14)) + dof_values[10]*(K[2]*(-2.65343302885e-14)) + dof_values[11]*(K[2]*(2.44249065418e-14)) + dof_values[12]*(K[2]*(1.44051437445e-14)) + dof_values[14]*(K[0]*(1.10167927423e-14) + K[2]*(3.43058914609e-14));
-    vertex_values[4] = dof_values[0]*(K[0]*(-1.0)) + dof_values[1]*K[0]*3.0 + dof_values[2]*(K[0]*(-3.0)) + dof_values[3]*(K[0] + K[2]) + dof_values[4]*(K[0]*(-3.0) + K[2]*(-3.0)) + dof_values[5]*(K[0]*3.0 + K[2]*3.0) + dof_values[9]*(K[0]*(-1.1990408666e-14)) + dof_values[11]*(K[0]*(2.13162820728e-14) + K[2]*(-1.06581410364e-14)) + dof_values[12]*(K[0]*(1.14203343109e-14)) + dof_values[14]*(K[0]*(2.54750955873e-14));
-    vertex_values[1] = dof_values[3]*K[3]*3.0 + dof_values[4]*(K[3]*(-3.0)) + dof_values[5]*K[3] + dof_values[6]*K[1]*3.0 + dof_values[7]*(K[1]*(-3.0)) + dof_values[8]*K[1] + dof_values[11]*(K[3]*(1.1990408666e-14)) + dof_values[14]*(K[1]*(-1.07435785403e-14));
-    vertex_values[3] = dof_values[0]*K[3]*3.0 + dof_values[1]*(K[3]*(-3.0)) + dof_values[2]*K[3] + dof_values[6]*(K[1] + K[3]) + dof_values[7]*(K[1]*(-3.0) + K[3]*(-3.0)) + dof_values[8]*(K[1]*3.0 + K[3]*3.0) + dof_values[9]*(K[3]*(-1.52100554374e-14)) + dof_values[10]*(K[3]*(-2.65343302885e-14)) + dof_values[11]*(K[3]*(2.44249065418e-14)) + dof_values[12]*(K[3]*(1.44051437445e-14)) + dof_values[14]*(K[1]*(1.10167927423e-14) + K[3]*(3.43058914609e-14));
-    vertex_values[5] = dof_values[0]*(K[1]*(-1.0)) + dof_values[1]*K[1]*3.0 + dof_values[2]*(K[1]*(-3.0)) + dof_values[3]*(K[1] + K[3]) + dof_values[4]*(K[1]*(-3.0) + K[3]*(-3.0)) + dof_values[5]*(K[1]*3.0 + K[3]*3.0) + dof_values[9]*(K[1]*(-1.1990408666e-14)) + dof_values[11]*(K[1]*(2.13162820728e-14) + K[3]*(-1.06581410364e-14)) + dof_values[12]*(K[1]*(1.14203343109e-14)) + dof_values[14]*(K[1]*(2.54750955873e-14));
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
+  std::size_t num_element_dofs() const final override
   {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
+    return 6;
   }
 
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  std::size_t num_facet_dofs() const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    return 4;
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new forms_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new forms_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::dofmap * create() const final override
   {
-    return new forms_finite_element_0();
+    return new forms_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class forms_dofmap_0: public ufc::dofmap
+class forms_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  forms_dofmap_0() : ufc::dofmap()
+  forms_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~forms_dofmap_0()
+  ~forms_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('triangle', 2)), 3, None)";
+    return "FFC dofmap for FiniteElement('Nedelec 1st kind H(curl)', triangle, 3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4699,39 +7482,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 3*num_global_entities[1] + 6*num_global_entities[2];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 15;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -4755,34 +7527,32 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + 3*c.entity_indices[1][0];
-    dofs[1] = offset + 3*c.entity_indices[1][0] + 1;
-    dofs[2] = offset + 3*c.entity_indices[1][0] + 2;
-    dofs[3] = offset + 3*c.entity_indices[1][1];
-    dofs[4] = offset + 3*c.entity_indices[1][1] + 1;
-    dofs[5] = offset + 3*c.entity_indices[1][1] + 2;
-    dofs[6] = offset + 3*c.entity_indices[1][2];
-    dofs[7] = offset + 3*c.entity_indices[1][2] + 1;
-    dofs[8] = offset + 3*c.entity_indices[1][2] + 2;
+    dofs[0] = offset + 3*entity_indices[1][0];
+    dofs[1] = offset + 3*entity_indices[1][0] + 1;
+    dofs[2] = offset + 3*entity_indices[1][0] + 2;
+    dofs[3] = offset + 3*entity_indices[1][1];
+    dofs[4] = offset + 3*entity_indices[1][1] + 1;
+    dofs[5] = offset + 3*entity_indices[1][1] + 2;
+    dofs[6] = offset + 3*entity_indices[1][2];
+    dofs[7] = offset + 3*entity_indices[1][2] + 1;
+    dofs[8] = offset + 3*entity_indices[1][2] + 2;
     offset += 3*num_global_entities[1];
-    dofs[9] = offset + 6*c.entity_indices[2][0];
-    dofs[10] = offset + 6*c.entity_indices[2][0] + 1;
-    dofs[11] = offset + 6*c.entity_indices[2][0] + 2;
-    dofs[12] = offset + 6*c.entity_indices[2][0] + 3;
-    dofs[13] = offset + 6*c.entity_indices[2][0] + 4;
-    dofs[14] = offset + 6*c.entity_indices[2][0] + 5;
+    dofs[9] = offset + 6*entity_indices[2][0];
+    dofs[10] = offset + 6*entity_indices[2][0] + 1;
+    dofs[11] = offset + 6*entity_indices[2][0] + 2;
+    dofs[12] = offset + 6*entity_indices[2][0] + 3;
+    dofs[13] = offset + 6*entity_indices[2][0] + 4;
+    dofs[14] = offset + 6*entity_indices[2][0] + 5;
     offset += 6*num_global_entities[2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -4811,9 +7581,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -4880,69 +7649,53 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    throw std::runtime_error("tabulate_coordinates is not defined for this element");
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new forms_dofmap_0();
+    return new forms_dofmap_2();
   }
 
 };
 
-/// 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 forms_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   forms_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~forms_cell_integral_0_otherwise()
+  ~forms_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -4963,21 +7716,21 @@ public:
     // Quadrature points on the UFC reference element: (0.816847572980459, 0.091576213509771), (0.091576213509771, 0.816847572980459), (0.091576213509771, 0.091576213509771), (0.10810301816807, 0.445948490915965), (0.445948490915965, 0.10810301816807), (0.445948490915965, 0.445948490915965)
     
     // Values of basis functions at quadrature points.
-    static const double FE1_C0_D01[6][15] = \
-    {{-2.84278477949184, 2.60133169408135, -0.632753871377719, 1.85982644165773, -0.63541501841313, 1.61571220921182, 2.32942687730161, -3.32302980327736, -5.80496552817115, 16.7566247559307, 28.2503375501111, -10.3125950058212, -5.56045205045065, 17.1175226659555, -9.82958337834074},
-    {-1.79074768975489, 5.75744296329208, -10.10108767901, 4.75292843843425, -11.6818044606508, 7.13890693033064, -0.0216896923940015, 0.104074179473831, -0.265803924839842, -16.8318933605097, 0.917612187043332, -25.93348252975, 16.7566247559308, 3.45115998442156, 29.6218074867926},
-    {-0.730727158911759, 0.369744598943502, -1.15078897513995, 1.3815974724088, -1.67148522593758, 0.499918661642905, -11.562274986093, 6.6872894314358, -1.92358289948969, 14.9533198088331, -30.9705674032021, -19.4780023354879, 3.68187849877405, 6.7640427126909, 6.50870313497022},
-    {0.565452740291985, -0.671420571424321, 2.08901867938574, -1.60411004260619, 2.74873517605273, -1.05036137707154, 1.90640810299339, -0.306199418639677, 0.748063316684345, -1.03300141506715, 15.1714233065577, 29.9298875179393, -5.8755329743622, -4.86317762376486, -10.3865730231417},
-    {0.793731867204472, 0.0134168093131892, 0.034506537173252, -0.976342443596814, 0.351804343471492, 0.148104039219089, -2.56551891256163, -1.543441746175, -2.01177024702696, 19.6926017532208, 9.24055761475929, -13.0772891857657, -1.03300141506724, -7.82861046966403, -1.82610576392334},
-    {-0.957138495883974, -2.14608846111384, -0.00427037407145248, 2.74910419187173, -1.43784293086166, -1.7876953219163, 3.34906346933697, -2.09584669297285, 1.09505522467394, -15.4312459652902, 2.32121430766113, 18.0366977074507, 10.1368887622925, 18.6226537852274, 17.9196569598769}};
-    
-    static const double FE1_C1_D10[6][15] = \
-    {{10.10108767901, -5.7574429632921, 1.7907476897549, -0.0216896923939726, 0.104074179473838, -0.265803924839889, 4.75292843843424, -11.6818044606508, 7.13890693033065, 16.7566247559307, 27.3788177817851, -11.8221115243628, -16.8318933605096, -22.0002485858417, 13.7614167296771},
-    {0.632753871377707, -2.60133169408132, 2.84278477949182, 2.32942687730165, -3.32302980327736, -5.80496552817115, 1.85982644165772, -0.635415018413122, 1.61571220921181, -5.5604520504506, 0.0460924187174623, 19.7390011677438, 16.7566247559306, 5.19419952107393, 29.6218074867923},
-    {1.15078897513995, -0.369744598943474, 0.73072715891174, -11.562274986093, 6.6872894314358, -1.9235828994897, 1.3815974724088, -1.67148522593759, 0.499918661642889, 3.68187849877416, 9.01872361692118, 2.60348125398805, 14.9533198088331, -32.3537285391062, -17.0822969730473},
-    {-0.0345065371732548, -0.0134168093131665, -0.793731867204488, -2.56551891256161, -1.543441746175, -2.01177024702697, -0.976342443596817, 0.351804343471491, 0.148104039219076, -1.03300141506717, -5.49575921638676, -5.86672266110032, 19.6926017532208, -6.70498584012899, 14.5412022323982},
-    {-2.08901867938574, 0.671420571424334, -0.56545274029199, 1.9064081029934, -0.306199418639672, 0.748063316684321, -1.60411004260618, 2.74873517605271, -1.05036137707154, -5.87553297436212, -11.4266249081851, 0.981651146274374, -1.03300141506718, 33.505754576225, -1.82610576392324},
-    {0.00427037407144955, 2.14608846111387, 0.957138495883958, 3.34906346933699, -2.09584669297284, 1.09505522467392, 2.74910419187172, -1.43784293086166, -1.78769532191632, 10.1368887622926, 24.8302050469698, 7.16786278395084, -15.4312459652903, 16.7808455688634, -7.00811829566281}};
+    static const double FE0_C0_D01[6][15] = \
+    {{-2.84278477949184, 2.60133169408135, -0.632753871377718, 1.85982644165773, -0.635415018413128, 1.61571220921182, 2.32942687730161, -3.32302980327736, -5.80496552817115, 16.7566247559307, 28.2503375501111, -10.3125950058212, -5.56045205045065, 17.1175226659555, -9.82958337834074},
+    {-1.79074768975489, 5.75744296329208, -10.10108767901, 4.75292843843425, -11.6818044606508, 7.13890693033065, -0.021689692394002, 0.104074179473834, -0.265803924839846, -16.8318933605097, 0.917612187043342, -25.93348252975, 16.7566247559308, 3.45115998442157, 29.6218074867925},
+    {-0.730727158911757, 0.369744598943501, -1.15078897513995, 1.3815974724088, -1.67148522593758, 0.499918661642905, -11.562274986093, 6.6872894314358, -1.92358289948969, 14.9533198088331, -30.9705674032021, -19.4780023354879, 3.68187849877406, 6.7640427126909, 6.50870313497023},
+    {0.565452740291985, -0.671420571424322, 2.08901867938574, -1.60411004260619, 2.74873517605273, -1.05036137707154, 1.90640810299339, -0.306199418639676, 0.748063316684344, -1.03300141506715, 15.1714233065577, 29.9298875179393, -5.87553297436219, -4.86317762376486, -10.3865730231417},
+    {0.793731867204473, 0.0134168093131892, 0.0345065371732516, -0.976342443596814, 0.351804343471491, 0.148104039219088, -2.56551891256163, -1.543441746175, -2.01177024702696, 19.6926017532208, 9.24055761475929, -13.0772891857657, -1.03300141506724, -7.82861046966403, -1.82610576392334},
+    {-0.957138495883974, -2.14608846111384, -0.00427037407145336, 2.74910419187173, -1.43784293086166, -1.7876953219163, 3.34906346933697, -2.09584669297285, 1.09505522467394, -15.4312459652902, 2.32121430766113, 18.0366977074507, 10.1368887622925, 18.6226537852274, 17.9196569598769}};
+    
+    static const double FE0_C1_D10[6][15] = \
+    {{10.10108767901, -5.7574429632921, 1.7907476897549, -0.0216896923939655, 0.104074179473834, -0.265803924839887, 4.75292843843424, -11.6818044606508, 7.13890693033065, 16.7566247559307, 27.3788177817851, -11.8221115243628, -16.8318933605096, -22.0002485858417, 13.7614167296771},
+    {0.632753871377706, -2.60133169408132, 2.84278477949182, 2.32942687730165, -3.32302980327736, -5.80496552817115, 1.85982644165772, -0.63541501841312, 1.61571220921181, -5.56045205045061, 0.0460924187174552, 19.7390011677438, 16.7566247559306, 5.19419952107392, 29.6218074867923},
+    {1.15078897513995, -0.369744598943472, 0.730727158911739, -11.562274986093, 6.6872894314358, -1.9235828994897, 1.3815974724088, -1.67148522593759, 0.499918661642887, 3.68187849877416, 9.01872361692117, 2.60348125398806, 14.9533198088331, -32.3537285391062, -17.0822969730473},
+    {-0.0345065371732545, -0.0134168093131667, -0.793731867204488, -2.56551891256162, -1.543441746175, -2.01177024702697, -0.976342443596817, 0.351804343471491, 0.148104039219076, -1.03300141506717, -5.49575921638676, -5.86672266110032, 19.6926017532208, -6.70498584012899, 14.5412022323982},
+    {-2.08901867938574, 0.671420571424334, -0.565452740291991, 1.90640810299341, -0.306199418639673, 0.748063316684322, -1.60411004260618, 2.74873517605271, -1.05036137707154, -5.87553297436212, -11.4266249081851, 0.981651146274372, -1.03300141506719, 33.505754576225, -1.82610576392324},
+    {0.00427037407145088, 2.14608846111387, 0.957138495883958, 3.34906346933699, -2.09584669297285, 1.09505522467393, 2.74910419187172, -1.43784293086166, -1.78769532191632, 10.1368887622926, 24.8302050469698, 7.16786278395084, -15.4312459652903, 16.7808455688634, -7.0081182956628}};
     
     // Reset values in the element tensor.
     for (unsigned int r = 0; r < 225; r++)
@@ -5012,7 +7765,7 @@ public:
         for (unsigned int k = 0; k < 15; k++)
         {
           // Number of operations to compute entry: 12
-          A[j*15 + k] += (FE1_C0_D01[ip][j]*FE1_C0_D01[ip][k]*I[0] + FE1_C0_D01[ip][j]*FE1_C1_D10[ip][k]*I[1] + FE1_C0_D01[ip][k]*FE1_C1_D10[ip][j]*I[1] + FE1_C1_D10[ip][j]*FE1_C1_D10[ip][k]*I[0]);
+          A[j*15 + k] += (FE0_C0_D01[ip][j]*FE0_C0_D01[ip][k]*I[0] + FE0_C0_D01[ip][j]*FE0_C1_D10[ip][k]*I[1] + FE0_C0_D01[ip][k]*FE0_C1_D10[ip][j]*I[1] + FE0_C1_D10[ip][j]*FE0_C1_D10[ip][k]*I[0]);
         } // end loop over 'k'
       } // end loop over 'j'
     } // end loop over 'ip'
@@ -5020,38 +7773,31 @@ public:
 
 };
 
-/// 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 forms_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
   forms_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~forms_cell_integral_1_otherwise()
+  ~forms_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    8
@@ -5060,7 +7806,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -5306,77 +8052,69 @@ public:
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class forms_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
   forms_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~forms_form_0()
+  ~forms_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "110a31625d2d8969b448f643cf07cd2b4fdf9689200f819dd452dd34f3fd67441d9e3b39e08a8855cfb8e4ab9418b1fc64f038253bb953121caabcb698cb08e2";
+    return "5ef7c449a95d7b424e9547ea1c3d1f06f62528b17ae4ce1a269846967409026af4c96e4c25d91f5b45e7fa670566e64f97f09f8d53deac0d681e42447247ea67";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new forms_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new forms_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new forms_finite_element_0();
+        return new forms_finite_element_2();
         break;
       }
     case 1:
       {
-        return new forms_finite_element_0();
+        return new forms_finite_element_2();
         break;
       }
     }
@@ -5384,19 +8122,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new forms_dofmap_0();
+        return new forms_dofmap_2();
         break;
       }
     case 1:
       {
-        return new forms_dofmap_0();
+        return new forms_dofmap_2();
         break;
       }
     }
@@ -5404,203 +8141,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new forms_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
 
 class forms_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
   forms_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~forms_form_1()
+  ~forms_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "c50bd85b4f5a3829c1c46a054562bab94f0e3c71c6778a73bea7c331558b28fe57f1cb2e3bdedf4cd05cc8211fce2c463f6387759f2ee36fcb345cf800e5a1fa";
+    return "108dafa0472311164e3d035eb30e30f4cf3ca036a1737d9e5ebc3b6566301b7e8745210ebbd68d48e8bf6b07ac5d7b23237e4d0bc8f94b17f4dc7d592b22029c";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new forms_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new forms_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new forms_finite_element_0();
+        return new forms_finite_element_2();
         break;
       }
     case 1:
       {
-        return new forms_finite_element_0();
+        return new forms_finite_element_2();
         break;
       }
     }
@@ -5608,19 +8373,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new forms_dofmap_0();
+        return new forms_dofmap_2();
         break;
       }
     case 1:
       {
-        return new forms_dofmap_0();
+        return new forms_dofmap_2();
         break;
       }
     }
@@ -5628,126 +8392,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new forms_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -5761,14 +8561,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Forms
 {
@@ -5777,43 +8583,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<forms_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<forms_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<forms_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<forms_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5824,63 +8607,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<forms_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<forms_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<forms_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<forms_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new forms_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -5888,7 +8678,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new forms_form_0());
+    _ufc_form = std::make_shared<const forms_form_0>();
   }
 
   // Destructor
@@ -5918,51 +8708,86 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<forms_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<forms_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<forms_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<forms_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -5973,63 +8798,70 @@ class Form_L_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<forms_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<forms_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_L_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<forms_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<forms_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new forms_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new forms_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_L: public dolfin::Form
+class Form_L_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new forms_form_1());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_L: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_L(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -6037,7 +8869,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new forms_form_1());
+    _ufc_form = std::make_shared<const forms_form_1>();
   }
 
   // Destructor
@@ -6067,12 +8899,71 @@ public:
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
   typedef Form_L_FunctionSpace_1 TrialSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_L()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_FunctionSpace_1 TrialSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/demo/undocumented/waveguide/cpp/compile.log b/demo/undocumented/waveguide/cpp/compile.log
index a9f2b03..cc38575 100644
--- a/demo/undocumented/waveguide/cpp/compile.log
+++ b/demo/undocumented/waveguide/cpp/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Forms
 
@@ -12,8 +13,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'N1curl3(?)'
-  Unique sub elements:       'N1curl3(?)'
+  Unique elements:           'N1curl3(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'N1curl3(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -34,9 +35,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 4
   representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -44,8 +45,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'N1curl3(?)'
-  Unique sub elements:       'N1curl3(?)'
+  Unique elements:           'N1curl3(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'N1curl3(?), Vector<2 x CG1(?)>, CG1(?)'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -57,18 +58,29 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 6
+  quadrature_degree: 6
   
-Compiler stage 1 finished in 0.264131 seconds.
+Compiler stage 1 finished in 0.426052 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing quadrature representation
@@ -77,81 +89,10 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Reusing element from cache
   Reusing element from cache
+  Reusing element from cache
   
   QG-utils, psi_tables:
-  {6: {VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 1, dim=2, quad_scheme=None): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
-          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
-            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
-             8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
-  
-         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
-             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 1.,  1.,  1.,  1.,  1.,  1.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.],
-          [-1., -1., -1., -1., -1., -1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.],
-          [ 1.,  1.,  1.,  1.,  1.,  1.]],
-  
-         [[ 0.,  0.,  0.,  0.,  0.,  0.],
-          [ 0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
-            0.10810302],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ]],
-  
-         [[ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
-            0.44594849],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ]],
-  
-         [[ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849],
-          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ],
-          [ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
-            0.10810302]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ],
-          [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
-            0.44594849]],
-  
-         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
-            0.        ],
-          [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
-            0.44594849]]])}}}, FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('triangle', 2), label=None, data=None), 3, quad_scheme=None): {None: {None: {(0, 1): array([[[ -2.84278478e+00,  -1.79074769e+00,  -7.30727159e-01,
+  {6: {FiniteElement('Nedelec 1st kind H(curl)', triangle, 3): {None: {None: {(0, 1): array([[[ -2.84278478e+00,  -1.79074769e+00,  -7.30727159e-01,
              5.65452740e-01,   7.93731867e-01,  -9.57138496e-01],
           [  2.96218075e+00,   1.32835210e-01,  -4.64923234e-01,
             -1.82610576e-01,  -3.01323357e-01,   1.05463175e+00]],
@@ -174,7 +115,7 @@ Compiler stage 2: Computing intermediate representation
          [[ -6.35415018e-01,  -1.16818045e+01,  -1.67148523e+00,
              2.74873518e+00,   3.51804343e-01,  -1.43784293e+00],
           [  1.08801856e-14,  -1.00103192e+01,   1.00103192e+01,
-             2.45359288e-14,   1.78964727e+00,  -1.78964727e+00]],
+             2.44249065e-14,   1.78964727e+00,  -1.78964727e+00]],
   
          [[  1.61571221e+00,   7.13890693e+00,   4.99918662e-01,
             -1.05036138e+00,   1.48104039e-01,  -1.78769532e+00],
@@ -259,8 +200,8 @@ Compiler stage 2: Computing intermediate representation
           [  4.75292844e+00,   1.85982644e+00,   1.38159747e+00,
             -9.76342444e-01,  -1.60411004e+00,   2.74910419e+00]],
   
-         [[ -1.00103192e+01,  -2.35718934e-15,   1.00103192e+01,
-             1.78964727e+00,  -1.68395402e-15,  -1.78964727e+00],
+         [[ -1.00103192e+01,   4.28783482e-15,   1.00103192e+01,
+             1.78964727e+00,  -3.12446896e-15,  -1.78964727e+00],
           [ -1.16818045e+01,  -6.35415018e-01,  -1.67148523e+00,
              3.51804343e-01,   2.74873518e+00,  -1.43784293e+00]],
   
@@ -289,8 +230,8 @@ Compiler stage 2: Computing intermediate representation
           [ -1.68318934e+01,   1.67566248e+01,   1.49533198e+01,
              1.96926018e+01,  -1.03300142e+00,  -1.54312460e+01]],
   
-         [[  1.03534800e+01,   1.49063230e-13,  -1.03534800e+01,
-            -2.34858314e+01,   4.52552487e-16,   2.34858314e+01],
+         [[  1.03534800e+01,   1.37292131e-13,  -1.03534800e+01,
+            -2.34858314e+01,   3.00430313e-15,   2.34858314e+01],
           [ -2.20002486e+01,   5.19419952e+00,  -3.23537285e+01,
             -6.70498584e+00,   3.35057546e+01,   1.67808456e+01]],
   
@@ -370,129 +311,82 @@ Compiler stage 2: Computing intermediate representation
          [[ -1.20426966e+00,   3.32963584e-14,   1.20426966e+00,
             -1.27250915e+00,  -8.16768684e-17,   1.27250915e+00],
           [ -2.94692233e+00,   3.44667329e+00,  -1.74265267e+00,
-             1.94464933e+00,  -4.55003309e+00,   3.21715848e+00]]])}}}}}
+             1.94464933e+00,  -4.55003309e+00,   3.21715848e+00]]])}}}, VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2): {None: {None: {(0, 1): array([[[ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00],
+          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [ -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00,
+            -1.00000000e+00,  -1.00000000e+00,  -1.00000000e+00]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  8.88178420e-16,   8.88178420e-16,   8.88178420e-16,
+             8.88178420e-16,   8.88178420e-16,   8.88178420e-16]],
+  
+         [[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+             0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+          [  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
+             1.00000000e+00,   1.00000000e+00,   1.00000000e+00]]]), (1, 0): array([[[-1., -1., -1., -1., -1., -1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 1.,  1.,  1.,  1.,  1.,  1.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.],
+          [-1., -1., -1., -1., -1., -1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.],
+          [ 1.,  1.,  1.,  1.,  1.,  1.]],
+  
+         [[ 0.,  0.,  0.,  0.,  0.,  0.],
+          [ 0.,  0.,  0.,  0.,  0.,  0.]]]), (0, 0): array([[[ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
+            0.10810302],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ]],
+  
+         [[ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
+            0.44594849],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ]],
+  
+         [[ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
+            0.44594849],
+          [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ],
+          [ 0.09157621,  0.09157621,  0.81684757,  0.44594849,  0.44594849,
+            0.10810302]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ],
+          [ 0.81684757,  0.09157621,  0.09157621,  0.10810302,  0.44594849,
+            0.44594849]],
+  
+         [[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
+            0.        ],
+          [ 0.09157621,  0.81684757,  0.09157621,  0.44594849,  0.10810302,
+            0.44594849]]])}}}}}
   
   QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
-         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ -2.25727001e-01,   3.32587646e-01,  -1.26094480e-01,
-            1.05300034e-01,  -9.17337129e-02,   2.46521447e-01,
-            2.87382344e-01,  -9.29480352e-01,   8.32895081e-01,
-            2.23437001e+00,   2.89591927e+00,  -1.87746726e+00,
-           -6.81237797e-01,   8.95564343e-01,  -1.20426966e+00],
-         [ -1.61287863e-01,   5.96892706e-01,  -6.07168080e-01,
-            1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
-            3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
-            8.71894414e-01,   1.77974702e-01,   6.20210589e+00,
-            1.77268277e-14,  -3.55949404e-01,   3.32963584e-14],
-         [ -1.05300034e-01,   9.17337129e-02,  -2.46521447e-01,
-            2.25727001e-01,  -3.32587646e-01,   1.26094480e-01,
-            8.32895081e-01,  -9.29480352e-01,   2.87382344e-01,
-            1.55313221e+00,  -3.79148362e+00,  -3.08173692e+00,
-            6.81237797e-01,   8.95564343e-01,   1.20426966e+00],
-         [  1.56610831e-02,  -1.75812247e-01,   3.72616214e-01,
-           -1.42911998e-01,   4.30314077e-01,  -2.45365299e-01,
-           -4.56367854e-01,   7.23426869e-02,   1.20056157e-01,
-            4.17598615e+00,  -4.21971734e+00,   1.79130134e+00,
-           -7.19839880e-01,   2.05337899e-01,  -1.27250915e+00],
-         [  8.37516399e-02,   1.03469560e-01,  -1.35717240e-01,
-           -8.37516399e-02,  -1.03469560e-01,   1.35717240e-01,
-           -3.88277298e-01,   8.60628155e-01,  -3.88277298e-01,
-            2.73630639e+00,   5.58546202e-01,  -2.92186826e+00,
-           -6.75246453e-16,  -1.11709240e+00,  -8.16768684e-17],
-         [  1.42911998e-01,  -4.30314077e-01,   2.45365299e-01,
-           -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
-            1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
-            3.45614627e+00,   4.01437944e+00,   5.18792192e-01,
-            7.19839880e-01,   2.05337899e-01,   1.27250915e+00]]), 'FE1_C1': array([[  6.07168080e-01,  -5.96892706e-01,   1.61287863e-01,
-            3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
-            1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
-            1.36991113e-14,  -1.77974702e-01,  -3.08261226e-01,
-            8.71894414e-01,   5.46016861e+00,  -2.94692233e+00],
-         [  1.26094480e-01,  -3.32587646e-01,   2.25727001e-01,
-            2.87382344e-01,  -9.29480352e-01,   8.32895081e-01,
-            1.05300034e-01,  -9.17337129e-02,   2.46521447e-01,
-           -6.81237797e-01,  -5.95145951e-01,   1.37771630e+00,
-            2.23437001e+00,  -1.77974702e-01,   3.44667329e+00],
-         [  2.46521447e-01,  -9.17337129e-02,   1.05300034e-01,
-            8.32895081e-01,  -9.29480352e-01,   2.87382344e-01,
-            2.25727001e-01,  -3.32587646e-01,   1.26094480e-01,
-            6.81237797e-01,   1.49071029e+00,   1.73446640e-01,
-            1.55313221e+00,  -4.56460427e+00,  -1.74265267e+00],
-         [  1.35717240e-01,  -1.03469560e-01,  -8.37516399e-02,
-           -3.88277298e-01,   8.60628155e-01,  -3.88277298e-01,
-           -8.37516399e-02,  -1.03469560e-01,   1.35717240e-01,
-           -1.97064587e-15,  -5.58546202e-01,  -9.67430400e-01,
-            2.73630639e+00,  -2.25113904e+00,   1.94464933e+00],
-         [ -3.72616214e-01,   1.75812247e-01,  -1.56610831e-02,
-           -4.56367854e-01,   7.23426869e-02,   1.20056157e-01,
-           -1.42911998e-01,   4.30314077e-01,  -2.45365299e-01,
-           -7.19839880e-01,  -9.99356303e-01,   8.14082413e-01,
-            4.17598615e+00,  -5.58546202e-01,  -4.55003309e+00],
-         [ -2.45365299e-01,   4.30314077e-01,  -1.42911998e-01,
-            1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
-           -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
-            7.19839880e-01,   1.20469420e+00,  -4.58426739e-01,
-            3.45614627e+00,   2.45647694e+00,   3.21715848e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[  1.01010877e+01,  -5.75744296e+00,   1.79074769e+00,
-           -2.16896924e-02,   1.04074179e-01,  -2.65803925e-01,
-            4.75292844e+00,  -1.16818045e+01,   7.13890693e+00,
-            1.67566248e+01,   2.73788178e+01,  -1.18221115e+01,
-           -1.68318934e+01,  -2.20002486e+01,   1.37614167e+01],
-         [  6.32753871e-01,  -2.60133169e+00,   2.84278478e+00,
-            2.32942688e+00,  -3.32302980e+00,  -5.80496553e+00,
-            1.85982644e+00,  -6.35415018e-01,   1.61571221e+00,
-           -5.56045205e+00,   4.60924187e-02,   1.97390012e+01,
-            1.67566248e+01,   5.19419952e+00,   2.96218075e+01],
-         [  1.15078898e+00,  -3.69744599e-01,   7.30727159e-01,
-           -1.15622750e+01,   6.68728943e+00,  -1.92358290e+00,
-            1.38159747e+00,  -1.67148523e+00,   4.99918662e-01,
-            3.68187850e+00,   9.01872362e+00,   2.60348125e+00,
-            1.49533198e+01,  -3.23537285e+01,  -1.70822970e+01],
-         [ -3.45065372e-02,  -1.34168093e-02,  -7.93731867e-01,
-           -2.56551891e+00,  -1.54344175e+00,  -2.01177025e+00,
-           -9.76342444e-01,   3.51804343e-01,   1.48104039e-01,
-           -1.03300142e+00,  -5.49575922e+00,  -5.86672266e+00,
-            1.96926018e+01,  -6.70498584e+00,   1.45412022e+01],
-         [ -2.08901868e+00,   6.71420571e-01,  -5.65452740e-01,
-            1.90640810e+00,  -3.06199419e-01,   7.48063317e-01,
-           -1.60411004e+00,   2.74873518e+00,  -1.05036138e+00,
-           -5.87553297e+00,  -1.14266249e+01,   9.81651146e-01,
-           -1.03300142e+00,   3.35057546e+01,  -1.82610576e+00],
-         [  4.27037407e-03,   2.14608846e+00,   9.57138496e-01,
-            3.34906347e+00,  -2.09584669e+00,   1.09505522e+00,
-            2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
-            1.01368888e+01,   2.48302050e+01,   7.16786278e+00,
-           -1.54312460e+01,   1.67808456e+01,  -7.00811830e+00]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D01': array([[  2.96218075e+00,   5.92436150e+00,  -2.96218075e+00,
+  {'FE0_C1_D01': array([[  2.96218075e+00,   5.92436150e+00,  -2.96218075e+00,
             2.44114232e-01,   1.08801856e-14,  -2.44114232e-01,
             2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
             3.35132495e+01,   5.13064756e+01,  -2.96218075e+01,
@@ -508,7 +402,7 @@ Compiler stage 2: Computing intermediate representation
            -1.87857355e+00,  -8.05270663e+00,  -7.30593654e+00,
             3.75714710e+00,   7.77383974e+00,   1.21363333e+01],
          [ -1.82610576e-01,  -3.65221153e-01,   1.82610576e-01,
-           -5.53748666e-01,   2.45359288e-14,   5.53748666e-01,
+           -5.53748666e-01,   2.44249065e-14,   5.53748666e-01,
            -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
            -2.06600283e+00,  -3.16290796e+00,   1.82610576e+00,
             1.03300142e+00,   6.90770636e+00,   8.31228685e+00],
@@ -521,45 +415,72 @@ Compiler stage 2: Computing intermediate representation
             2.60100015e+00,  -1.78964727e+00,  -8.11352878e-01,
             3.31455693e+00,  -2.10926350e+00,   3.01323357e-01,
             4.26135579e+00,   1.82667578e+01,   1.65727847e+01,
-           -8.52271158e+00,   5.00996158e+00,   1.16907416e+01]]), 'FE1_C0_D01': array([[ -2.84278478e+00,   2.60133169e+00,  -6.32753871e-01,
-            1.85982644e+00,  -6.35415018e-01,   1.61571221e+00,
-            2.32942688e+00,  -3.32302980e+00,  -5.80496553e+00,
-            1.67566248e+01,   2.82503376e+01,  -1.03125950e+01,
-           -5.56045205e+00,   1.71175227e+01,  -9.82958338e+00],
-         [ -1.79074769e+00,   5.75744296e+00,  -1.01010877e+01,
-            4.75292844e+00,  -1.16818045e+01,   7.13890693e+00,
+           -8.52271158e+00,   5.00996158e+00,   1.16907416e+01]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
+           0.        ],
+         [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
+           0.        ],
+         [ 0.81684757,  0.09157621,  0.09157621,  0.        ,  0.        ,
+           0.        ],
+         [ 0.44594849,  0.10810302,  0.44594849,  0.        ,  0.        ,
+           0.        ],
+         [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
+           0.09157621],
+         [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
+           0.81684757],
+         [ 0.        ,  0.        ,  0.        ,  0.81684757,  0.09157621,
+           0.09157621],
+         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.10810302,
+           0.44594849],
+         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
+           0.10810302],
+         [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
+           0.44594849]]), 'FE0_C1_D10': array([[  1.01010877e+01,  -5.75744296e+00,   1.79074769e+00,
            -2.16896924e-02,   1.04074179e-01,  -2.65803925e-01,
-           -1.68318934e+01,   9.17612187e-01,  -2.59334825e+01,
-            1.67566248e+01,   3.45115998e+00,   2.96218075e+01],
-         [ -7.30727159e-01,   3.69744599e-01,  -1.15078898e+00,
-            1.38159747e+00,  -1.67148523e+00,   4.99918662e-01,
+            4.75292844e+00,  -1.16818045e+01,   7.13890693e+00,
+            1.67566248e+01,   2.73788178e+01,  -1.18221115e+01,
+           -1.68318934e+01,  -2.20002486e+01,   1.37614167e+01],
+         [  6.32753871e-01,  -2.60133169e+00,   2.84278478e+00,
+            2.32942688e+00,  -3.32302980e+00,  -5.80496553e+00,
+            1.85982644e+00,  -6.35415018e-01,   1.61571221e+00,
+           -5.56045205e+00,   4.60924187e-02,   1.97390012e+01,
+            1.67566248e+01,   5.19419952e+00,   2.96218075e+01],
+         [  1.15078898e+00,  -3.69744599e-01,   7.30727159e-01,
            -1.15622750e+01,   6.68728943e+00,  -1.92358290e+00,
-            1.49533198e+01,  -3.09705674e+01,  -1.94780023e+01,
-            3.68187850e+00,   6.76404271e+00,   6.50870313e+00],
-         [  5.65452740e-01,  -6.71420571e-01,   2.08901868e+00,
-           -1.60411004e+00,   2.74873518e+00,  -1.05036138e+00,
-            1.90640810e+00,  -3.06199419e-01,   7.48063317e-01,
-           -1.03300142e+00,   1.51714233e+01,   2.99298875e+01,
-           -5.87553297e+00,  -4.86317762e+00,  -1.03865730e+01],
-         [  7.93731867e-01,   1.34168093e-02,   3.45065372e-02,
-           -9.76342444e-01,   3.51804343e-01,   1.48104039e-01,
+            1.38159747e+00,  -1.67148523e+00,   4.99918662e-01,
+            3.68187850e+00,   9.01872362e+00,   2.60348125e+00,
+            1.49533198e+01,  -3.23537285e+01,  -1.70822970e+01],
+         [ -3.45065372e-02,  -1.34168093e-02,  -7.93731867e-01,
            -2.56551891e+00,  -1.54344175e+00,  -2.01177025e+00,
-            1.96926018e+01,   9.24055761e+00,  -1.30772892e+01,
-           -1.03300142e+00,  -7.82861047e+00,  -1.82610576e+00],
-         [ -9.57138496e-01,  -2.14608846e+00,  -4.27037407e-03,
-            2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
+           -9.76342444e-01,   3.51804343e-01,   1.48104039e-01,
+           -1.03300142e+00,  -5.49575922e+00,  -5.86672266e+00,
+            1.96926018e+01,  -6.70498584e+00,   1.45412022e+01],
+         [ -2.08901868e+00,   6.71420571e-01,  -5.65452740e-01,
+            1.90640810e+00,  -3.06199419e-01,   7.48063317e-01,
+           -1.60411004e+00,   2.74873518e+00,  -1.05036138e+00,
+           -5.87553297e+00,  -1.14266249e+01,   9.81651146e-01,
+           -1.03300142e+00,   3.35057546e+01,  -1.82610576e+00],
+         [  4.27037407e-03,   2.14608846e+00,   9.57138496e-01,
             3.34906347e+00,  -2.09584669e+00,   1.09505522e+00,
-           -1.54312460e+01,   2.32121431e+00,   1.80366977e+01,
-            1.01368888e+01,   1.86226538e+01,   1.79196570e+01]]), 'FE1_C0_D10': array([[ -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
+            2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
+            1.01368888e+01,   2.48302050e+01,   7.16786278e+00,
+           -1.54312460e+01,   1.67808456e+01,  -7.00811830e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[ -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
             1.12909928e+00,  -2.65670419e-01,   4.64923234e-01,
             4.25300978e+00,  -1.00103192e+01,   5.75730946e+00,
            -1.87857355e+00,   4.04381286e+00,   2.65670419e+00,
            -1.87857355e+00,   1.03534800e+01,  -3.32088024e+00],
          [  2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
             2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
-            2.44114232e-01,  -2.35718934e-15,  -2.44114232e-01,
+            2.44114232e-01,   4.28783482e-15,  -2.44114232e-01,
            -1.67566248e+01,   5.28638436e+00,  -2.96218075e+01,
-            3.35132495e+01,   1.49063230e-13,   5.92436150e+01],
+            3.35132495e+01,   1.37292131e-13,   5.92436150e+01],
          [  1.12909928e+00,  -2.65670419e-01,   4.64923234e-01,
            -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
            -5.75730946e+00,   1.00103192e+01,  -4.25300978e+00,
@@ -572,38 +493,43 @@ Compiler stage 2: Computing intermediate representation
             4.26135579e+00,  -2.34858314e+01,   7.53308394e+00],
          [ -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
            -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
-           -5.53748666e-01,  -1.68395402e-15,   5.53748666e-01,
+           -5.53748666e-01,  -3.12446896e-15,   5.53748666e-01,
             1.03300142e+00,   1.06525048e+01,   1.82610576e+00,
-           -2.06600283e+00,   4.52552487e-16,  -3.65221153e+00],
+           -2.06600283e+00,   3.00430313e-15,  -3.65221153e+00],
          [ -2.56124854e+00,   6.02646715e-01,  -1.05463175e+00,
             3.31455693e+00,  -2.10926350e+00,   3.01323357e-01,
             2.60100015e+00,  -1.78964727e+00,  -8.11352878e-01,
            -8.52271158e+00,   1.26294600e+01,  -1.50661679e+00,
-            4.26135579e+00,   2.34858314e+01,   7.53308394e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
-           0.09157621],
-         [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
-           0.81684757],
-         [ 0.        ,  0.        ,  0.        ,  0.81684757,  0.09157621,
-           0.09157621],
-         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.10810302,
-           0.44594849],
-         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
-           0.10810302],
-         [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
-           0.44594849]]), 'FE0_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
-           0.        ],
-         [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
-           0.        ],
-         [ 0.81684757,  0.09157621,  0.09157621,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44594849,  0.10810302,  0.44594849,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
-           0.        ]])}
-  
-  tables: {'FE0_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+            4.26135579e+00,   2.34858314e+01,   7.53308394e+00]]), 'FE0_C0_D01': array([[ -2.84278478e+00,   2.60133169e+00,  -6.32753871e-01,
+            1.85982644e+00,  -6.35415018e-01,   1.61571221e+00,
+            2.32942688e+00,  -3.32302980e+00,  -5.80496553e+00,
+            1.67566248e+01,   2.82503376e+01,  -1.03125950e+01,
+           -5.56045205e+00,   1.71175227e+01,  -9.82958338e+00],
+         [ -1.79074769e+00,   5.75744296e+00,  -1.01010877e+01,
+            4.75292844e+00,  -1.16818045e+01,   7.13890693e+00,
+           -2.16896924e-02,   1.04074179e-01,  -2.65803925e-01,
+           -1.68318934e+01,   9.17612187e-01,  -2.59334825e+01,
+            1.67566248e+01,   3.45115998e+00,   2.96218075e+01],
+         [ -7.30727159e-01,   3.69744599e-01,  -1.15078898e+00,
+            1.38159747e+00,  -1.67148523e+00,   4.99918662e-01,
+           -1.15622750e+01,   6.68728943e+00,  -1.92358290e+00,
+            1.49533198e+01,  -3.09705674e+01,  -1.94780023e+01,
+            3.68187850e+00,   6.76404271e+00,   6.50870313e+00],
+         [  5.65452740e-01,  -6.71420571e-01,   2.08901868e+00,
+           -1.60411004e+00,   2.74873518e+00,  -1.05036138e+00,
+            1.90640810e+00,  -3.06199419e-01,   7.48063317e-01,
+           -1.03300142e+00,   1.51714233e+01,   2.99298875e+01,
+           -5.87553297e+00,  -4.86317762e+00,  -1.03865730e+01],
+         [  7.93731867e-01,   1.34168093e-02,   3.45065372e-02,
+           -9.76342444e-01,   3.51804343e-01,   1.48104039e-01,
+           -2.56551891e+00,  -1.54344175e+00,  -2.01177025e+00,
+            1.96926018e+01,   9.24055761e+00,  -1.30772892e+01,
+           -1.03300142e+00,  -7.82861047e+00,  -1.82610576e+00],
+         [ -9.57138496e-01,  -2.14608846e+00,  -4.27037407e-03,
+            2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
+            3.34906347e+00,  -2.09584669e+00,   1.09505522e+00,
+           -1.54312460e+01,   2.32121431e+00,   1.80366977e+01,
+            1.01368888e+01,   1.86226538e+01,   1.79196570e+01]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
@@ -614,36 +540,23 @@ Compiler stage 2: Computing intermediate representation
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
            -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
          [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
-           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0': array([[ -2.25727001e-01,   3.32587646e-01,  -1.26094480e-01,
-            1.05300034e-01,  -9.17337129e-02,   2.46521447e-01,
-            2.87382344e-01,  -9.29480352e-01,   8.32895081e-01,
-            2.23437001e+00,   2.89591927e+00,  -1.87746726e+00,
-           -6.81237797e-01,   8.95564343e-01,  -1.20426966e+00],
-         [ -1.61287863e-01,   5.96892706e-01,  -6.07168080e-01,
-            1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
-            3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
-            8.71894414e-01,   1.77974702e-01,   6.20210589e+00,
-            1.77268277e-14,  -3.55949404e-01,   3.32963584e-14],
-         [ -1.05300034e-01,   9.17337129e-02,  -2.46521447e-01,
-            2.25727001e-01,  -3.32587646e-01,   1.26094480e-01,
-            8.32895081e-01,  -9.29480352e-01,   2.87382344e-01,
-            1.55313221e+00,  -3.79148362e+00,  -3.08173692e+00,
-            6.81237797e-01,   8.95564343e-01,   1.20426966e+00],
-         [  1.56610831e-02,  -1.75812247e-01,   3.72616214e-01,
-           -1.42911998e-01,   4.30314077e-01,  -2.45365299e-01,
-           -4.56367854e-01,   7.23426869e-02,   1.20056157e-01,
-            4.17598615e+00,  -4.21971734e+00,   1.79130134e+00,
-           -7.19839880e-01,   2.05337899e-01,  -1.27250915e+00],
-         [  8.37516399e-02,   1.03469560e-01,  -1.35717240e-01,
-           -8.37516399e-02,  -1.03469560e-01,   1.35717240e-01,
-           -3.88277298e-01,   8.60628155e-01,  -3.88277298e-01,
-            2.73630639e+00,   5.58546202e-01,  -2.92186826e+00,
-           -6.75246453e-16,  -1.11709240e+00,  -8.16768684e-17],
-         [  1.42911998e-01,  -4.30314077e-01,   2.45365299e-01,
-           -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
-            1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
-            3.45614627e+00,   4.01437944e+00,   5.18792192e-01,
-            7.19839880e-01,   2.05337899e-01,   1.27250915e+00]]), 'FE1_C1': array([[  6.07168080e-01,  -5.96892706e-01,   1.61287863e-01,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C1': array([[  6.07168080e-01,  -5.96892706e-01,   1.61287863e-01,
             3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
             1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
             1.36991113e-14,  -1.77974702e-01,  -3.08261226e-01,
@@ -672,57 +585,38 @@ Compiler stage 2: Computing intermediate representation
             1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
            -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
             7.19839880e-01,   1.20469420e+00,  -4.58426739e-01,
-            3.45614627e+00,   2.45647694e+00,   3.21715848e+00]]), 'FE0_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.],
-         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE1_C1_D10': array([[  1.01010877e+01,  -5.75744296e+00,   1.79074769e+00,
-           -2.16896924e-02,   1.04074179e-01,  -2.65803925e-01,
-            4.75292844e+00,  -1.16818045e+01,   7.13890693e+00,
-            1.67566248e+01,   2.73788178e+01,  -1.18221115e+01,
-           -1.68318934e+01,  -2.20002486e+01,   1.37614167e+01],
-         [  6.32753871e-01,  -2.60133169e+00,   2.84278478e+00,
-            2.32942688e+00,  -3.32302980e+00,  -5.80496553e+00,
-            1.85982644e+00,  -6.35415018e-01,   1.61571221e+00,
-           -5.56045205e+00,   4.60924187e-02,   1.97390012e+01,
-            1.67566248e+01,   5.19419952e+00,   2.96218075e+01],
-         [  1.15078898e+00,  -3.69744599e-01,   7.30727159e-01,
-           -1.15622750e+01,   6.68728943e+00,  -1.92358290e+00,
-            1.38159747e+00,  -1.67148523e+00,   4.99918662e-01,
-            3.68187850e+00,   9.01872362e+00,   2.60348125e+00,
-            1.49533198e+01,  -3.23537285e+01,  -1.70822970e+01],
-         [ -3.45065372e-02,  -1.34168093e-02,  -7.93731867e-01,
-           -2.56551891e+00,  -1.54344175e+00,  -2.01177025e+00,
-           -9.76342444e-01,   3.51804343e-01,   1.48104039e-01,
-           -1.03300142e+00,  -5.49575922e+00,  -5.86672266e+00,
-            1.96926018e+01,  -6.70498584e+00,   1.45412022e+01],
-         [ -2.08901868e+00,   6.71420571e-01,  -5.65452740e-01,
-            1.90640810e+00,  -3.06199419e-01,   7.48063317e-01,
-           -1.60411004e+00,   2.74873518e+00,  -1.05036138e+00,
-           -5.87553297e+00,  -1.14266249e+01,   9.81651146e-01,
-           -1.03300142e+00,   3.35057546e+01,  -1.82610576e+00],
-         [  4.27037407e-03,   2.14608846e+00,   9.57138496e-01,
-            3.34906347e+00,  -2.09584669e+00,   1.09505522e+00,
-            2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
-            1.01368888e+01,   2.48302050e+01,   7.16786278e+00,
-           -1.54312460e+01,   1.67808456e+01,  -7.00811830e+00]]), 'FE0_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.],
-         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
-         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
-            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C1_D01': array([[  2.96218075e+00,   5.92436150e+00,  -2.96218075e+00,
+            3.45614627e+00,   2.45647694e+00,   3.21715848e+00]]), 'FE0_C0': array([[ -2.25727001e-01,   3.32587646e-01,  -1.26094480e-01,
+            1.05300034e-01,  -9.17337129e-02,   2.46521447e-01,
+            2.87382344e-01,  -9.29480352e-01,   8.32895081e-01,
+            2.23437001e+00,   2.89591927e+00,  -1.87746726e+00,
+           -6.81237797e-01,   8.95564343e-01,  -1.20426966e+00],
+         [ -1.61287863e-01,   5.96892706e-01,  -6.07168080e-01,
+            1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
+            3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
+            8.71894414e-01,   1.77974702e-01,   6.20210589e+00,
+            1.77268277e-14,  -3.55949404e-01,   3.32963584e-14],
+         [ -1.05300034e-01,   9.17337129e-02,  -2.46521447e-01,
+            2.25727001e-01,  -3.32587646e-01,   1.26094480e-01,
+            8.32895081e-01,  -9.29480352e-01,   2.87382344e-01,
+            1.55313221e+00,  -3.79148362e+00,  -3.08173692e+00,
+            6.81237797e-01,   8.95564343e-01,   1.20426966e+00],
+         [  1.56610831e-02,  -1.75812247e-01,   3.72616214e-01,
+           -1.42911998e-01,   4.30314077e-01,  -2.45365299e-01,
+           -4.56367854e-01,   7.23426869e-02,   1.20056157e-01,
+            4.17598615e+00,  -4.21971734e+00,   1.79130134e+00,
+           -7.19839880e-01,   2.05337899e-01,  -1.27250915e+00],
+         [  8.37516399e-02,   1.03469560e-01,  -1.35717240e-01,
+           -8.37516399e-02,  -1.03469560e-01,   1.35717240e-01,
+           -3.88277298e-01,   8.60628155e-01,  -3.88277298e-01,
+            2.73630639e+00,   5.58546202e-01,  -2.92186826e+00,
+           -6.75246453e-16,  -1.11709240e+00,  -8.16768684e-17],
+         [  1.42911998e-01,  -4.30314077e-01,   2.45365299e-01,
+           -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
+            1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
+            3.45614627e+00,   4.01437944e+00,   5.18792192e-01,
+            7.19839880e-01,   2.05337899e-01,   1.27250915e+00]])}
+  
+  tables: {'FE0_C1_D01': array([[  2.96218075e+00,   5.92436150e+00,  -2.96218075e+00,
             2.44114232e-01,   1.08801856e-14,  -2.44114232e-01,
             2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
             3.35132495e+01,   5.13064756e+01,  -2.96218075e+01,
@@ -738,7 +632,7 @@ Compiler stage 2: Computing intermediate representation
            -1.87857355e+00,  -8.05270663e+00,  -7.30593654e+00,
             3.75714710e+00,   7.77383974e+00,   1.21363333e+01],
          [ -1.82610576e-01,  -3.65221153e-01,   1.82610576e-01,
-           -5.53748666e-01,   2.45359288e-14,   5.53748666e-01,
+           -5.53748666e-01,   2.44249065e-14,   5.53748666e-01,
            -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
            -2.06600283e+00,  -3.16290796e+00,   1.82610576e+00,
             1.03300142e+00,   6.90770636e+00,   8.31228685e+00],
@@ -751,45 +645,72 @@ Compiler stage 2: Computing intermediate representation
             2.60100015e+00,  -1.78964727e+00,  -8.11352878e-01,
             3.31455693e+00,  -2.10926350e+00,   3.01323357e-01,
             4.26135579e+00,   1.82667578e+01,   1.65727847e+01,
-           -8.52271158e+00,   5.00996158e+00,   1.16907416e+01]]), 'FE1_C0_D01': array([[ -2.84278478e+00,   2.60133169e+00,  -6.32753871e-01,
-            1.85982644e+00,  -6.35415018e-01,   1.61571221e+00,
-            2.32942688e+00,  -3.32302980e+00,  -5.80496553e+00,
-            1.67566248e+01,   2.82503376e+01,  -1.03125950e+01,
-           -5.56045205e+00,   1.71175227e+01,  -9.82958338e+00],
-         [ -1.79074769e+00,   5.75744296e+00,  -1.01010877e+01,
-            4.75292844e+00,  -1.16818045e+01,   7.13890693e+00,
+           -8.52271158e+00,   5.00996158e+00,   1.16907416e+01]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
+           0.        ],
+         [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
+           0.        ],
+         [ 0.81684757,  0.09157621,  0.09157621,  0.        ,  0.        ,
+           0.        ],
+         [ 0.44594849,  0.10810302,  0.44594849,  0.        ,  0.        ,
+           0.        ],
+         [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
+           0.        ],
+         [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
+           0.        ]]), 'FE1_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
+           0.09157621],
+         [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
+           0.81684757],
+         [ 0.        ,  0.        ,  0.        ,  0.81684757,  0.09157621,
+           0.09157621],
+         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.10810302,
+           0.44594849],
+         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
+           0.10810302],
+         [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
+           0.44594849]]), 'FE0_C1_D10': array([[  1.01010877e+01,  -5.75744296e+00,   1.79074769e+00,
            -2.16896924e-02,   1.04074179e-01,  -2.65803925e-01,
-           -1.68318934e+01,   9.17612187e-01,  -2.59334825e+01,
-            1.67566248e+01,   3.45115998e+00,   2.96218075e+01],
-         [ -7.30727159e-01,   3.69744599e-01,  -1.15078898e+00,
-            1.38159747e+00,  -1.67148523e+00,   4.99918662e-01,
+            4.75292844e+00,  -1.16818045e+01,   7.13890693e+00,
+            1.67566248e+01,   2.73788178e+01,  -1.18221115e+01,
+           -1.68318934e+01,  -2.20002486e+01,   1.37614167e+01],
+         [  6.32753871e-01,  -2.60133169e+00,   2.84278478e+00,
+            2.32942688e+00,  -3.32302980e+00,  -5.80496553e+00,
+            1.85982644e+00,  -6.35415018e-01,   1.61571221e+00,
+           -5.56045205e+00,   4.60924187e-02,   1.97390012e+01,
+            1.67566248e+01,   5.19419952e+00,   2.96218075e+01],
+         [  1.15078898e+00,  -3.69744599e-01,   7.30727159e-01,
            -1.15622750e+01,   6.68728943e+00,  -1.92358290e+00,
-            1.49533198e+01,  -3.09705674e+01,  -1.94780023e+01,
-            3.68187850e+00,   6.76404271e+00,   6.50870313e+00],
-         [  5.65452740e-01,  -6.71420571e-01,   2.08901868e+00,
-           -1.60411004e+00,   2.74873518e+00,  -1.05036138e+00,
-            1.90640810e+00,  -3.06199419e-01,   7.48063317e-01,
-           -1.03300142e+00,   1.51714233e+01,   2.99298875e+01,
-           -5.87553297e+00,  -4.86317762e+00,  -1.03865730e+01],
-         [  7.93731867e-01,   1.34168093e-02,   3.45065372e-02,
-           -9.76342444e-01,   3.51804343e-01,   1.48104039e-01,
+            1.38159747e+00,  -1.67148523e+00,   4.99918662e-01,
+            3.68187850e+00,   9.01872362e+00,   2.60348125e+00,
+            1.49533198e+01,  -3.23537285e+01,  -1.70822970e+01],
+         [ -3.45065372e-02,  -1.34168093e-02,  -7.93731867e-01,
            -2.56551891e+00,  -1.54344175e+00,  -2.01177025e+00,
-            1.96926018e+01,   9.24055761e+00,  -1.30772892e+01,
-           -1.03300142e+00,  -7.82861047e+00,  -1.82610576e+00],
-         [ -9.57138496e-01,  -2.14608846e+00,  -4.27037407e-03,
-            2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
+           -9.76342444e-01,   3.51804343e-01,   1.48104039e-01,
+           -1.03300142e+00,  -5.49575922e+00,  -5.86672266e+00,
+            1.96926018e+01,  -6.70498584e+00,   1.45412022e+01],
+         [ -2.08901868e+00,   6.71420571e-01,  -5.65452740e-01,
+            1.90640810e+00,  -3.06199419e-01,   7.48063317e-01,
+           -1.60411004e+00,   2.74873518e+00,  -1.05036138e+00,
+           -5.87553297e+00,  -1.14266249e+01,   9.81651146e-01,
+           -1.03300142e+00,   3.35057546e+01,  -1.82610576e+00],
+         [  4.27037407e-03,   2.14608846e+00,   9.57138496e-01,
             3.34906347e+00,  -2.09584669e+00,   1.09505522e+00,
-           -1.54312460e+01,   2.32121431e+00,   1.80366977e+01,
-            1.01368888e+01,   1.86226538e+01,   1.79196570e+01]]), 'FE1_C0_D10': array([[ -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
+            2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
+            1.01368888e+01,   2.48302050e+01,   7.16786278e+00,
+           -1.54312460e+01,   1.67808456e+01,  -7.00811830e+00]]), 'FE1_C1_D10': array([[ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.],
+         [ 0.,  0.,  0., -1.,  1.,  0.]]), 'FE0_C0_D10': array([[ -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
             1.12909928e+00,  -2.65670419e-01,   4.64923234e-01,
             4.25300978e+00,  -1.00103192e+01,   5.75730946e+00,
            -1.87857355e+00,   4.04381286e+00,   2.65670419e+00,
            -1.87857355e+00,   1.03534800e+01,  -3.32088024e+00],
          [  2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
             2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
-            2.44114232e-01,  -2.35718934e-15,  -2.44114232e-01,
+            2.44114232e-01,   4.28783482e-15,  -2.44114232e-01,
            -1.67566248e+01,   5.28638436e+00,  -2.96218075e+01,
-            3.35132495e+01,   1.49063230e-13,   5.92436150e+01],
+            3.35132495e+01,   1.37292131e-13,   5.92436150e+01],
          [  1.12909928e+00,  -2.65670419e-01,   4.64923234e-01,
            -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
            -5.75730946e+00,   1.00103192e+01,  -4.25300978e+00,
@@ -802,72 +723,70 @@ Compiler stage 2: Computing intermediate representation
             4.26135579e+00,  -2.34858314e+01,   7.53308394e+00],
          [ -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
            -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
-           -5.53748666e-01,  -1.68395402e-15,   5.53748666e-01,
+           -5.53748666e-01,  -3.12446896e-15,   5.53748666e-01,
             1.03300142e+00,   1.06525048e+01,   1.82610576e+00,
-           -2.06600283e+00,   4.52552487e-16,  -3.65221153e+00],
+           -2.06600283e+00,   3.00430313e-15,  -3.65221153e+00],
          [ -2.56124854e+00,   6.02646715e-01,  -1.05463175e+00,
             3.31455693e+00,  -2.10926350e+00,   3.01323357e-01,
             2.60100015e+00,  -1.78964727e+00,  -8.11352878e-01,
            -8.52271158e+00,   1.26294600e+01,  -1.50661679e+00,
-            4.26135579e+00,   2.34858314e+01,   7.53308394e+00]]), 'FE0_C1': array([[ 0.        ,  0.        ,  0.        ,  0.09157621,  0.81684757,
-           0.09157621],
-         [ 0.        ,  0.        ,  0.        ,  0.09157621,  0.09157621,
-           0.81684757],
-         [ 0.        ,  0.        ,  0.        ,  0.81684757,  0.09157621,
-           0.09157621],
-         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.10810302,
-           0.44594849],
-         [ 0.        ,  0.        ,  0.        ,  0.44594849,  0.44594849,
-           0.10810302],
-         [ 0.        ,  0.        ,  0.        ,  0.10810302,  0.44594849,
-           0.44594849]]), 'FE0_C0': array([[ 0.09157621,  0.81684757,  0.09157621,  0.        ,  0.        ,
-           0.        ],
-         [ 0.09157621,  0.09157621,  0.81684757,  0.        ,  0.        ,
-           0.        ],
-         [ 0.81684757,  0.09157621,  0.09157621,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44594849,  0.10810302,  0.44594849,  0.        ,  0.        ,
-           0.        ],
-         [ 0.44594849,  0.44594849,  0.10810302,  0.        ,  0.        ,
-           0.        ],
-         [ 0.10810302,  0.44594849,  0.44594849,  0.        ,  0.        ,
-           0.        ]])}
-  
-  name_map: {}
-  
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C1_D10': 'FE1_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE1_C0': array([[ -2.25727001e-01,   3.32587646e-01,  -1.26094480e-01,
-            1.05300034e-01,  -9.17337129e-02,   2.46521447e-01,
-            2.87382344e-01,  -9.29480352e-01,   8.32895081e-01,
-            2.23437001e+00,   2.89591927e+00,  -1.87746726e+00,
-           -6.81237797e-01,   8.95564343e-01,  -1.20426966e+00],
-         [ -1.61287863e-01,   5.96892706e-01,  -6.07168080e-01,
-            1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
-            3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
-            8.71894414e-01,   1.77974702e-01,   6.20210589e+00,
-            1.77268277e-14,  -3.55949404e-01,   3.32963584e-14],
-         [ -1.05300034e-01,   9.17337129e-02,  -2.46521447e-01,
-            2.25727001e-01,  -3.32587646e-01,   1.26094480e-01,
-            8.32895081e-01,  -9.29480352e-01,   2.87382344e-01,
-            1.55313221e+00,  -3.79148362e+00,  -3.08173692e+00,
-            6.81237797e-01,   8.95564343e-01,   1.20426966e+00],
-         [  1.56610831e-02,  -1.75812247e-01,   3.72616214e-01,
-           -1.42911998e-01,   4.30314077e-01,  -2.45365299e-01,
-           -4.56367854e-01,   7.23426869e-02,   1.20056157e-01,
-            4.17598615e+00,  -4.21971734e+00,   1.79130134e+00,
-           -7.19839880e-01,   2.05337899e-01,  -1.27250915e+00],
-         [  8.37516399e-02,   1.03469560e-01,  -1.35717240e-01,
-           -8.37516399e-02,  -1.03469560e-01,   1.35717240e-01,
-           -3.88277298e-01,   8.60628155e-01,  -3.88277298e-01,
-            2.73630639e+00,   5.58546202e-01,  -2.92186826e+00,
-            0.00000000e+00,  -1.11709240e+00,   0.00000000e+00],
-         [  1.42911998e-01,  -4.30314077e-01,   2.45365299e-01,
-           -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
-            1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
-            3.45614627e+00,   4.01437944e+00,   5.18792192e-01,
-            7.19839880e-01,   2.05337899e-01,   1.27250915e+00]]), 'FE1_C1': array([[  6.07168080e-01,  -5.96892706e-01,   1.61287863e-01,
+            4.26135579e+00,   2.34858314e+01,   7.53308394e+00]]), 'FE0_C0_D01': array([[ -2.84278478e+00,   2.60133169e+00,  -6.32753871e-01,
+            1.85982644e+00,  -6.35415018e-01,   1.61571221e+00,
+            2.32942688e+00,  -3.32302980e+00,  -5.80496553e+00,
+            1.67566248e+01,   2.82503376e+01,  -1.03125950e+01,
+           -5.56045205e+00,   1.71175227e+01,  -9.82958338e+00],
+         [ -1.79074769e+00,   5.75744296e+00,  -1.01010877e+01,
+            4.75292844e+00,  -1.16818045e+01,   7.13890693e+00,
+           -2.16896924e-02,   1.04074179e-01,  -2.65803925e-01,
+           -1.68318934e+01,   9.17612187e-01,  -2.59334825e+01,
+            1.67566248e+01,   3.45115998e+00,   2.96218075e+01],
+         [ -7.30727159e-01,   3.69744599e-01,  -1.15078898e+00,
+            1.38159747e+00,  -1.67148523e+00,   4.99918662e-01,
+           -1.15622750e+01,   6.68728943e+00,  -1.92358290e+00,
+            1.49533198e+01,  -3.09705674e+01,  -1.94780023e+01,
+            3.68187850e+00,   6.76404271e+00,   6.50870313e+00],
+         [  5.65452740e-01,  -6.71420571e-01,   2.08901868e+00,
+           -1.60411004e+00,   2.74873518e+00,  -1.05036138e+00,
+            1.90640810e+00,  -3.06199419e-01,   7.48063317e-01,
+           -1.03300142e+00,   1.51714233e+01,   2.99298875e+01,
+           -5.87553297e+00,  -4.86317762e+00,  -1.03865730e+01],
+         [  7.93731867e-01,   1.34168093e-02,   3.45065372e-02,
+           -9.76342444e-01,   3.51804343e-01,   1.48104039e-01,
+           -2.56551891e+00,  -1.54344175e+00,  -2.01177025e+00,
+            1.96926018e+01,   9.24055761e+00,  -1.30772892e+01,
+           -1.03300142e+00,  -7.82861047e+00,  -1.82610576e+00],
+         [ -9.57138496e-01,  -2.14608846e+00,  -4.27037407e-03,
+            2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
+            3.34906347e+00,  -2.09584669e+00,   1.09505522e+00,
+           -1.54312460e+01,   2.32121431e+00,   1.80366977e+01,
+            1.01368888e+01,   1.86226538e+01,   1.79196570e+01]]), 'FE1_C1_D01': array([[  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00],
+         [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
+           -1.00000000e+00,   8.88178420e-16,   1.00000000e+00]]), 'FE1_C0_D01': array([[ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00],
+         [ -1.00000000e+00,   8.88178420e-16,   1.00000000e+00,
+            0.00000000e+00,   0.00000000e+00,   0.00000000e+00]]), 'FE1_C0_D10': array([[-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.],
+         [-1.,  1.,  0.,  0.,  0.,  0.]]), 'FE0_C1': array([[  6.07168080e-01,  -5.96892706e-01,   1.61287863e-01,
             3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
             1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
             1.36991113e-14,  -1.77974702e-01,  -3.08261226e-01,
@@ -885,7 +804,7 @@ Compiler stage 2: Computing intermediate representation
          [  1.35717240e-01,  -1.03469560e-01,  -8.37516399e-02,
            -3.88277298e-01,   8.60628155e-01,  -3.88277298e-01,
            -8.37516399e-02,  -1.03469560e-01,   1.35717240e-01,
-            0.00000000e+00,  -5.58546202e-01,  -9.67430400e-01,
+           -1.97064587e-15,  -5.58546202e-01,  -9.67430400e-01,
             2.73630639e+00,  -2.25113904e+00,   1.94464933e+00],
          [ -3.72616214e-01,   1.75812247e-01,  -1.56610831e-02,
            -4.56367854e-01,   7.23426869e-02,   1.20056157e-01,
@@ -896,7 +815,77 @@ Compiler stage 2: Computing intermediate representation
             1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
            -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
             7.19839880e-01,   1.20469420e+00,  -4.58426739e-01,
-            3.45614627e+00,   2.45647694e+00,   3.21715848e+00]]), 'FE1_C1_D10': array([[  1.01010877e+01,  -5.75744296e+00,   1.79074769e+00,
+            3.45614627e+00,   2.45647694e+00,   3.21715848e+00]]), 'FE0_C0': array([[ -2.25727001e-01,   3.32587646e-01,  -1.26094480e-01,
+            1.05300034e-01,  -9.17337129e-02,   2.46521447e-01,
+            2.87382344e-01,  -9.29480352e-01,   8.32895081e-01,
+            2.23437001e+00,   2.89591927e+00,  -1.87746726e+00,
+           -6.81237797e-01,   8.95564343e-01,  -1.20426966e+00],
+         [ -1.61287863e-01,   5.96892706e-01,  -6.07168080e-01,
+            1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
+            3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
+            8.71894414e-01,   1.77974702e-01,   6.20210589e+00,
+            1.77268277e-14,  -3.55949404e-01,   3.32963584e-14],
+         [ -1.05300034e-01,   9.17337129e-02,  -2.46521447e-01,
+            2.25727001e-01,  -3.32587646e-01,   1.26094480e-01,
+            8.32895081e-01,  -9.29480352e-01,   2.87382344e-01,
+            1.55313221e+00,  -3.79148362e+00,  -3.08173692e+00,
+            6.81237797e-01,   8.95564343e-01,   1.20426966e+00],
+         [  1.56610831e-02,  -1.75812247e-01,   3.72616214e-01,
+           -1.42911998e-01,   4.30314077e-01,  -2.45365299e-01,
+           -4.56367854e-01,   7.23426869e-02,   1.20056157e-01,
+            4.17598615e+00,  -4.21971734e+00,   1.79130134e+00,
+           -7.19839880e-01,   2.05337899e-01,  -1.27250915e+00],
+         [  8.37516399e-02,   1.03469560e-01,  -1.35717240e-01,
+           -8.37516399e-02,  -1.03469560e-01,   1.35717240e-01,
+           -3.88277298e-01,   8.60628155e-01,  -3.88277298e-01,
+            2.73630639e+00,   5.58546202e-01,  -2.92186826e+00,
+           -6.75246453e-16,  -1.11709240e+00,  -8.16768684e-17],
+         [  1.42911998e-01,  -4.30314077e-01,   2.45365299e-01,
+           -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
+            1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
+            3.45614627e+00,   4.01437944e+00,   5.18792192e-01,
+            7.19839880e-01,   2.05337899e-01,   1.27250915e+00]])}
+  
+  name_map: {}
+  
+  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE0_C1_D10': 'FE0_C1_D10', 'FE1_C1_D10': 'FE1_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
+  
+  QG-utils, psi_tables, unique_tables:
+  {'FE0_C1_D01': array([[  2.96218075e+00,   5.92436150e+00,  -2.96218075e+00,
+            2.44114232e-01,   1.08801856e-14,  -2.44114232e-01,
+            2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
+            3.35132495e+01,   5.13064756e+01,  -2.96218075e+01,
+           -1.67566248e+01,  -2.30100456e+01,   1.93890469e+01],
+         [  1.32835210e-01,  -9.29846468e-01,   1.46118731e+00,
+            4.25300978e+00,  -1.00103192e+01,   5.75730946e+00,
+            1.12909928e+00,  -2.65670419e-01,   4.64923234e-01,
+           -1.87857355e+00,   2.30077332e+00,   1.06268168e+01,
+           -1.87857355e+00,   4.32267975e+00,   2.17369257e+00],
+         [ -4.64923234e-01,   2.65670419e-01,  -1.12909928e+00,
+           -5.75730946e+00,   1.00103192e+01,  -4.25300978e+00,
+           -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
+           -1.87857355e+00,  -8.05270663e+00,  -7.30593654e+00,
+            3.75714710e+00,   7.77383974e+00,   1.21363333e+01],
+         [ -1.82610576e-01,  -3.65221153e-01,   1.82610576e-01,
+           -5.53748666e-01,   2.44249065e-14,   5.53748666e-01,
+           -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
+           -2.06600283e+00,  -3.16290796e+00,   1.82610576e+00,
+            1.03300142e+00,   6.90770636e+00,   8.31228685e+00],
+         [ -3.01323357e-01,   2.10926350e+00,  -3.31455693e+00,
+            8.11352878e-01,   1.78964727e+00,  -2.60100015e+00,
+           -2.56124854e+00,   6.02646715e-01,  -1.05463175e+00,
+            4.26135579e+00,  -5.21907365e+00,  -2.41058686e+01,
+            4.26135579e+00,   1.28385721e+01,   3.42899934e+01],
+         [  1.05463175e+00,  -6.02646715e-01,   2.56124854e+00,
+            2.60100015e+00,  -1.78964727e+00,  -8.11352878e-01,
+            3.31455693e+00,  -2.10926350e+00,   3.01323357e-01,
+            4.26135579e+00,   1.82667578e+01,   1.65727847e+01,
+           -8.52271158e+00,   5.00996158e+00,   1.16907416e+01]]), 'FE1_C0': array([[ 0.09157621,  0.81684757,  0.09157621],
+         [ 0.09157621,  0.09157621,  0.81684757],
+         [ 0.81684757,  0.09157621,  0.09157621],
+         [ 0.44594849,  0.10810302,  0.44594849],
+         [ 0.44594849,  0.44594849,  0.10810302],
+         [ 0.10810302,  0.44594849,  0.44594849]]), 'FE0_C1_D10': array([[  1.01010877e+01,  -5.75744296e+00,   1.79074769e+00,
            -2.16896924e-02,   1.04074179e-01,  -2.65803925e-01,
             4.75292844e+00,  -1.16818045e+01,   7.13890693e+00,
             1.67566248e+01,   2.73788178e+01,  -1.18221115e+01,
@@ -925,41 +914,36 @@ Compiler stage 2: Computing intermediate representation
             3.34906347e+00,  -2.09584669e+00,   1.09505522e+00,
             2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
             1.01368888e+01,   2.48302050e+01,   7.16786278e+00,
-           -1.54312460e+01,   1.67808456e+01,  -7.00811830e+00]]), 'FE0_C0_D01': array([[-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.],
-         [-1.,  1.]]), 'FE1_C1_D01': array([[  2.96218075e+00,   5.92436150e+00,  -2.96218075e+00,
-            2.44114232e-01,   1.08801856e-14,  -2.44114232e-01,
-            2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
-            3.35132495e+01,   5.13064756e+01,  -2.96218075e+01,
-           -1.67566248e+01,  -2.30100456e+01,   1.93890469e+01],
-         [  1.32835210e-01,  -9.29846468e-01,   1.46118731e+00,
-            4.25300978e+00,  -1.00103192e+01,   5.75730946e+00,
+           -1.54312460e+01,   1.67808456e+01,  -7.00811830e+00]]), 'FE0_C0_D10': array([[ -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
             1.12909928e+00,  -2.65670419e-01,   4.64923234e-01,
-           -1.87857355e+00,   2.30077332e+00,   1.06268168e+01,
-           -1.87857355e+00,   4.32267975e+00,   2.17369257e+00],
-         [ -4.64923234e-01,   2.65670419e-01,  -1.12909928e+00,
-           -5.75730946e+00,   1.00103192e+01,  -4.25300978e+00,
+            4.25300978e+00,  -1.00103192e+01,   5.75730946e+00,
+           -1.87857355e+00,   4.04381286e+00,   2.65670419e+00,
+           -1.87857355e+00,   1.03534800e+01,  -3.32088024e+00],
+         [  2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
+            2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
+            2.44114232e-01,   0.00000000e+00,  -2.44114232e-01,
+           -1.67566248e+01,   5.28638436e+00,  -2.96218075e+01,
+            3.35132495e+01,   1.37292131e-13,   5.92436150e+01],
+         [  1.12909928e+00,  -2.65670419e-01,   4.64923234e-01,
            -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
-           -1.87857355e+00,  -8.05270663e+00,  -7.30593654e+00,
-            3.75714710e+00,   7.77383974e+00,   1.21363333e+01],
-         [ -1.82610576e-01,  -3.65221153e-01,   1.82610576e-01,
-           -5.53748666e-01,   2.45359288e-14,   5.53748666e-01,
-           -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
-           -2.06600283e+00,  -3.16290796e+00,   1.82610576e+00,
-            1.03300142e+00,   6.90770636e+00,   8.31228685e+00],
-         [ -3.01323357e-01,   2.10926350e+00,  -3.31455693e+00,
-            8.11352878e-01,   1.78964727e+00,  -2.60100015e+00,
+           -5.75730946e+00,   1.00103192e+01,  -4.25300978e+00,
+            3.75714710e+00,   1.43972928e+01,   6.64176049e-01,
+           -1.87857355e+00,  -1.03534800e+01,  -3.32088024e+00],
+         [  3.31455693e+00,  -2.10926350e+00,   3.01323357e-01,
            -2.56124854e+00,   6.02646715e-01,  -1.05463175e+00,
-            4.26135579e+00,  -5.21907365e+00,  -2.41058686e+01,
-            4.26135579e+00,   1.28385721e+01,   3.42899934e+01],
-         [  1.05463175e+00,  -6.02646715e-01,   2.56124854e+00,
-            2.60100015e+00,  -1.78964727e+00,  -8.11352878e-01,
+            8.11352878e-01,   1.78964727e+00,  -2.60100015e+00,
+            4.26135579e+00,   3.61152914e+01,  -6.02646715e+00,
+            4.26135579e+00,  -2.34858314e+01,   7.53308394e+00],
+         [ -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
+           -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
+           -5.53748666e-01,   0.00000000e+00,   5.53748666e-01,
+            1.03300142e+00,   1.06525048e+01,   1.82610576e+00,
+           -2.06600283e+00,   0.00000000e+00,  -3.65221153e+00],
+         [ -2.56124854e+00,   6.02646715e-01,  -1.05463175e+00,
             3.31455693e+00,  -2.10926350e+00,   3.01323357e-01,
-            4.26135579e+00,   1.82667578e+01,   1.65727847e+01,
-           -8.52271158e+00,   5.00996158e+00,   1.16907416e+01]]), 'FE1_C0_D01': array([[ -2.84278478e+00,   2.60133169e+00,  -6.32753871e-01,
+            2.60100015e+00,  -1.78964727e+00,  -8.11352878e-01,
+           -8.52271158e+00,   1.26294600e+01,  -1.50661679e+00,
+            4.26135579e+00,   2.34858314e+01,   7.53308394e+00]]), 'FE0_C0_D01': array([[ -2.84278478e+00,   2.60133169e+00,  -6.32753871e-01,
             1.85982644e+00,  -6.35415018e-01,   1.61571221e+00,
             2.32942688e+00,  -3.32302980e+00,  -5.80496553e+00,
             1.67566248e+01,   2.82503376e+01,  -1.03125950e+01,
@@ -988,44 +972,73 @@ Compiler stage 2: Computing intermediate representation
             2.74910419e+00,  -1.43784293e+00,  -1.78769532e+00,
             3.34906347e+00,  -2.09584669e+00,   1.09505522e+00,
            -1.54312460e+01,   2.32121431e+00,   1.80366977e+01,
-            1.01368888e+01,   1.86226538e+01,   1.79196570e+01]]), 'FE1_C0_D10': array([[ -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
-            1.12909928e+00,  -2.65670419e-01,   4.64923234e-01,
-            4.25300978e+00,  -1.00103192e+01,   5.75730946e+00,
-           -1.87857355e+00,   4.04381286e+00,   2.65670419e+00,
-           -1.87857355e+00,   1.03534800e+01,  -3.32088024e+00],
-         [  2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
-            2.96218075e+00,  -5.92436150e+00,  -2.96218075e+00,
-            2.44114232e-01,   0.00000000e+00,  -2.44114232e-01,
-           -1.67566248e+01,   5.28638436e+00,  -2.96218075e+01,
-            3.35132495e+01,   1.49063230e-13,   5.92436150e+01],
-         [  1.12909928e+00,  -2.65670419e-01,   4.64923234e-01,
-           -1.46118731e+00,   9.29846468e-01,  -1.32835210e-01,
-           -5.75730946e+00,   1.00103192e+01,  -4.25300978e+00,
-            3.75714710e+00,   1.43972928e+01,   6.64176049e-01,
-           -1.87857355e+00,  -1.03534800e+01,  -3.32088024e+00],
-         [  3.31455693e+00,  -2.10926350e+00,   3.01323357e-01,
-           -2.56124854e+00,   6.02646715e-01,  -1.05463175e+00,
-            8.11352878e-01,   1.78964727e+00,  -2.60100015e+00,
-            4.26135579e+00,   3.61152914e+01,  -6.02646715e+00,
-            4.26135579e+00,  -2.34858314e+01,   7.53308394e+00],
-         [ -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
-           -1.82610576e-01,   3.65221153e-01,   1.82610576e-01,
-           -5.53748666e-01,   0.00000000e+00,   5.53748666e-01,
-            1.03300142e+00,   1.06525048e+01,   1.82610576e+00,
-           -2.06600283e+00,   0.00000000e+00,  -3.65221153e+00],
-         [ -2.56124854e+00,   6.02646715e-01,  -1.05463175e+00,
-            3.31455693e+00,  -2.10926350e+00,   3.01323357e-01,
-            2.60100015e+00,  -1.78964727e+00,  -8.11352878e-01,
-           -8.52271158e+00,   1.26294600e+01,  -1.50661679e+00,
-            4.26135579e+00,   2.34858314e+01,   7.53308394e+00]]), 'FE0_C0': array([[ 0.09157621,  0.81684757,  0.09157621],
-         [ 0.09157621,  0.09157621,  0.81684757],
-         [ 0.81684757,  0.09157621,  0.09157621],
-         [ 0.44594849,  0.10810302,  0.44594849],
-         [ 0.44594849,  0.44594849,  0.10810302],
-         [ 0.10810302,  0.44594849,  0.44594849]])}
+            1.01368888e+01,   1.86226538e+01,   1.79196570e+01]]), 'FE1_C0_D01': array([[-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.],
+         [-1.,  1.]]), 'FE0_C1': array([[  6.07168080e-01,  -5.96892706e-01,   1.61287863e-01,
+            3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
+            1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
+            1.36991113e-14,  -1.77974702e-01,  -3.08261226e-01,
+            8.71894414e-01,   5.46016861e+00,  -2.94692233e+00],
+         [  1.26094480e-01,  -3.32587646e-01,   2.25727001e-01,
+            2.87382344e-01,  -9.29480352e-01,   8.32895081e-01,
+            1.05300034e-01,  -9.17337129e-02,   2.46521447e-01,
+           -6.81237797e-01,  -5.95145951e-01,   1.37771630e+00,
+            2.23437001e+00,  -1.77974702e-01,   3.44667329e+00],
+         [  2.46521447e-01,  -9.17337129e-02,   1.05300034e-01,
+            8.32895081e-01,  -9.29480352e-01,   2.87382344e-01,
+            2.25727001e-01,  -3.32587646e-01,   1.26094480e-01,
+            6.81237797e-01,   1.49071029e+00,   1.73446640e-01,
+            1.55313221e+00,  -4.56460427e+00,  -1.74265267e+00],
+         [  1.35717240e-01,  -1.03469560e-01,  -8.37516399e-02,
+           -3.88277298e-01,   8.60628155e-01,  -3.88277298e-01,
+           -8.37516399e-02,  -1.03469560e-01,   1.35717240e-01,
+            0.00000000e+00,  -5.58546202e-01,  -9.67430400e-01,
+            2.73630639e+00,  -2.25113904e+00,   1.94464933e+00],
+         [ -3.72616214e-01,   1.75812247e-01,  -1.56610831e-02,
+           -4.56367854e-01,   7.23426869e-02,   1.20056157e-01,
+           -1.42911998e-01,   4.30314077e-01,  -2.45365299e-01,
+           -7.19839880e-01,  -9.99356303e-01,   8.14082413e-01,
+            4.17598615e+00,  -5.58546202e-01,  -4.55003309e+00],
+         [ -2.45365299e-01,   4.30314077e-01,  -1.42911998e-01,
+            1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
+           -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
+            7.19839880e-01,   1.20469420e+00,  -4.58426739e-01,
+            3.45614627e+00,   2.45647694e+00,   3.21715848e+00]]), 'FE0_C0': array([[ -2.25727001e-01,   3.32587646e-01,  -1.26094480e-01,
+            1.05300034e-01,  -9.17337129e-02,   2.46521447e-01,
+            2.87382344e-01,  -9.29480352e-01,   8.32895081e-01,
+            2.23437001e+00,   2.89591927e+00,  -1.87746726e+00,
+           -6.81237797e-01,   8.95564343e-01,  -1.20426966e+00],
+         [ -1.61287863e-01,   5.96892706e-01,  -6.07168080e-01,
+            1.61287863e-01,  -5.96892706e-01,   6.07168080e-01,
+            3.51821481e-01,  -1.83467426e-01,   3.51821481e-01,
+            8.71894414e-01,   1.77974702e-01,   6.20210589e+00,
+            1.77268277e-14,  -3.55949404e-01,   3.32963584e-14],
+         [ -1.05300034e-01,   9.17337129e-02,  -2.46521447e-01,
+            2.25727001e-01,  -3.32587646e-01,   1.26094480e-01,
+            8.32895081e-01,  -9.29480352e-01,   2.87382344e-01,
+            1.55313221e+00,  -3.79148362e+00,  -3.08173692e+00,
+            6.81237797e-01,   8.95564343e-01,   1.20426966e+00],
+         [  1.56610831e-02,  -1.75812247e-01,   3.72616214e-01,
+           -1.42911998e-01,   4.30314077e-01,  -2.45365299e-01,
+           -4.56367854e-01,   7.23426869e-02,   1.20056157e-01,
+            4.17598615e+00,  -4.21971734e+00,   1.79130134e+00,
+           -7.19839880e-01,   2.05337899e-01,  -1.27250915e+00],
+         [  8.37516399e-02,   1.03469560e-01,  -1.35717240e-01,
+           -8.37516399e-02,  -1.03469560e-01,   1.35717240e-01,
+           -3.88277298e-01,   8.60628155e-01,  -3.88277298e-01,
+            2.73630639e+00,   5.58546202e-01,  -2.92186826e+00,
+            0.00000000e+00,  -1.11709240e+00,   0.00000000e+00],
+         [  1.42911998e-01,  -4.30314077e-01,   2.45365299e-01,
+           -1.56610831e-02,   1.75812247e-01,  -3.72616214e-01,
+            1.20056157e-01,   7.23426869e-02,  -4.56367854e-01,
+            3.45614627e+00,   4.01437944e+00,   5.18792192e-01,
+            7.19839880e-01,   2.05337899e-01,   1.27250915e+00]])}
   
   QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C0_D01', (4, [3, 5]), False, False), 'FE1_C0': ('FE1_C0', (), False, False), 'FE1_C1': ('FE1_C1', (), False, False), 'FE0_C1_D10': ('FE0_C0_D01', (5, [3, 4]), False, False), 'FE1_C1_D10': ('FE1_C1_D10', (), False, False), 'FE0_C0_D10': ('FE0_C0_D01', (2, [0, 1]), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (1, [0, 2]), False, False), 'FE1_C1_D01': ('FE1_C1_D01', (), False, False), 'FE1_C0_D01': ('FE1_C0_D01', (), False, False), 'FE1_C0_D10': ('FE1_C0_D10', (), Fals [...]
+  {'FE0_C1_D01': ('FE0_C1_D01', (), False, False), 'FE1_C0': ('FE1_C0', (0, [0, 1, 2]), False, False), 'FE1_C1': ('FE1_C0', (3, [3, 4, 5]), False, False), 'FE0_C1_D10': ('FE0_C1_D10', (), False, False), 'FE1_C1_D10': ('FE1_C0_D01', (5, [3, 4]), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (), False, False), 'FE1_C1_D01': ('FE1_C0_D01', (4, [3, 5]), False, False), 'FE1_C0_D01': ('FE1_C0_D01', (1, [0, 2]), False, False), 'FE1_C0_D10': ('FE1_C0 [...]
   Transforming cell integral
   Reusing element from cache
   Reusing element from cache
@@ -1048,7 +1061,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  900 entries computed in 0.000955 seconds
+  900 entries computed in 0.000904 seconds
   Shape of reference tensor: (15, 15, 2, 2)
   Primary multi index:   rank = 2 dims = [15, 15] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [2, 14], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],  [...]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -1056,200 +1069,58 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.0863168 seconds.
+Compiler stage 2 finished in 0.0947719 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   Optimising expressions for cell integral
   
-Compiler stage 3 finished in 0.00286603 seconds.
+Compiler stage 3 finished in 0.00343108 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 3 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Removing unused variable: circumradius
   Removing unused variable: v0v1
@@ -1258,18 +1129,18 @@ Compiler stage 4: Generating code
   Removing unused variable: volume
   Generating code for forms
   
-Compiler stage 4 finished in 0.262942 seconds.
+Compiler stage 4 finished in 0.34591 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000401974 seconds.
+Compiler stage 4.1 finished in 0.000487089 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Forms.h.
-Compiler stage 5 finished in 0.000696182 seconds.
+Compiler stage 5 finished in 0.000730991 seconds.
 
-FFC finished in 0.617633 seconds.
+FFC finished in 0.871719 seconds.
+Output written to ./Forms.h.
diff --git a/demo/undocumented/waveguide/cpp/main.cpp b/demo/undocumented/waveguide/cpp/main.cpp
index 8336cce..4c0fbaa 100644
--- a/demo/undocumented/waveguide/cpp/main.cpp
+++ b/demo/undocumented/waveguide/cpp/main.cpp
@@ -44,22 +44,23 @@ int main()
   // Create mesh
   double width = 1.0;
   double height = 0.5;
-  RectangleMesh mesh(Point(0.0, 0.0), Point(width, height), 4, 2);
+  auto mesh = std::make_shared<RectangleMesh>(Point(0.0, 0.0),
+                                              Point(width, height), 4, 2);
 
   // Define the forms - gererates an generalized eigenproblem of the form
   // [S]{h} = k_o^2[T]{h}
   // with the eigenvalues k_o^2 representing the square of the cutoff wavenumber
   // and the corresponding right-eigenvector giving the coefficients of the
   // discrete system used to obtain the approximate field anywhere in the domain
-  Forms::FunctionSpace V(mesh);
+  auto V = std::make_shared<Forms::FunctionSpace>(mesh);
   Forms::Form_a s(V, V);
   Forms::Form_L t(V, V);
 
   // Assemble the system matrices stiffness (S) and mass matrices (T)
-  PETScMatrix S;
-  PETScMatrix T;
-  assemble(S, s);
-  assemble(T, t);
+  auto S = std::make_shared<PETScMatrix>();
+  auto T = std::make_shared<PETScMatrix>();
+  assemble(*S, s);
+  assemble(*T, t);
 
   // Solve the eigen system
   SLEPcEigenSolver esolver(S, T);
@@ -67,19 +68,20 @@ int main()
   esolver.parameters["solver"] = "lapack";
   esolver.solve();
 
-  // The result should have real eigenvalues but due to rounding errors, some of
-  // the resultant eigenvalues may be small complex values.
-  // only consider the real part
+  // The result should have real eigenvalues but due to rounding
+  // errors, some of the resultant eigenvalues may be small complex
+  // values.  only consider the real part
 
-  // Now, the system contains a number of zero eigenvalues (near zero due to
-  // rounding) which are eigenvalues corresponding to the null-space of the curl
-  // operator and are a mathematical construct and do not represent physically
-  // realizable modes.  These are called spurious modes.
-  // So, we need to identify the smallest, non-zero eigenvalue of the system -
-  // which corresponds with cutoff wavenumber of the the dominant cutoff mode.
+  // Now, the system contains a number of zero eigenvalues (near zero
+  // due to rounding) which are eigenvalues corresponding to the
+  // null-space of the curl operator and are a mathematical construct
+  // and do not represent physically realizable modes.  These are
+  // called spurious modes.  So, we need to identify the smallest,
+  // non-zero eigenvalue of the system - which corresponds with cutoff
+  // wavenumber of the the dominant cutoff mode.
   double cutoff = -1.0;
   double lr, lc;
-  for (std::size_t i = 0; i < S.size(1); i++)
+  for (std::size_t i = 0; i < S->size(1); i++)
   {
     esolver.get_eigenvalue(lr, lc, i);
     if (lr > 1 && lc == 0)
diff --git a/doc/CMakeLists.txt b/doc-old/CMakeLists.txt
similarity index 100%
rename from doc/CMakeLists.txt
rename to doc-old/CMakeLists.txt
diff --git a/doc/README b/doc-old/README
similarity index 100%
rename from doc/README
rename to doc-old/README
diff --git a/doc/copy_and_split_demo_doc.py b/doc-old/copy_and_split_demo_doc.py
similarity index 100%
rename from doc/copy_and_split_demo_doc.py
rename to doc-old/copy_and_split_demo_doc.py
diff --git a/doc/generate_api_doc.py b/doc-old/generate_api_doc.py
similarity index 100%
rename from doc/generate_api_doc.py
rename to doc-old/generate_api_doc.py
diff --git a/doc/generate_main_index.py b/doc-old/generate_main_index.py
similarity index 100%
rename from doc/generate_main_index.py
rename to doc-old/generate_main_index.py
diff --git a/doc/man/man1/dolfin-convert.1.gz b/doc-old/man/man1/dolfin-convert.1.gz
similarity index 100%
rename from doc/man/man1/dolfin-convert.1.gz
rename to doc-old/man/man1/dolfin-convert.1.gz
diff --git a/doc/man/man1/dolfin-order.1.gz b/doc-old/man/man1/dolfin-order.1.gz
similarity index 100%
rename from doc/man/man1/dolfin-order.1.gz
rename to doc-old/man/man1/dolfin-order.1.gz
diff --git a/doc/man/man1/dolfin-plot.1.gz b/doc-old/man/man1/dolfin-plot.1.gz
similarity index 100%
rename from doc/man/man1/dolfin-plot.1.gz
rename to doc-old/man/man1/dolfin-plot.1.gz
diff --git a/doc/man/man1/dolfin-version.1.gz b/doc-old/man/man1/dolfin-version.1.gz
similarity index 100%
rename from doc/man/man1/dolfin-version.1.gz
rename to doc-old/man/man1/dolfin-version.1.gz
diff --git a/doc/quick_reference_cpp.rst b/doc-old/quick_reference_cpp.rst
similarity index 100%
rename from doc/quick_reference_cpp.rst
rename to doc-old/quick_reference_cpp.rst
diff --git a/doc/quick_reference_python.rst b/doc-old/quick_reference_python.rst
similarity index 100%
rename from doc/quick_reference_python.rst
rename to doc-old/quick_reference_python.rst
diff --git a/doc/sphinx-common/Makefile b/doc-old/sphinx-common/Makefile
similarity index 100%
copy from doc/sphinx-common/Makefile
copy to doc-old/sphinx-common/Makefile
diff --git a/doc/sphinx-common/README b/doc-old/sphinx-common/README
similarity index 100%
rename from doc/sphinx-common/README
rename to doc-old/sphinx-common/README
diff --git a/doc/sphinx-common/source/conf.py b/doc-old/sphinx-common/source/conf.py
similarity index 100%
copy from doc/sphinx-common/source/conf.py
copy to doc-old/sphinx-common/source/conf.py
diff --git a/doc/sphinx-common/source/index.rst b/doc-old/sphinx-common/source/index.rst
similarity index 100%
rename from doc/sphinx-common/source/index.rst
rename to doc-old/sphinx-common/source/index.rst
diff --git a/doc/sphinx-common/Makefile b/doc/Makefile
similarity index 57%
rename from doc/sphinx-common/Makefile
rename to doc/Makefile
index 61d9077..23a084b 100644
--- a/doc/sphinx-common/Makefile
+++ b/doc/Makefile
@@ -7,13 +7,19 @@ SPHINXBUILD   = sphinx-build
 PAPER         =
 BUILDDIR      = build
 
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
 # Internal variables.
 PAPEROPT_a4     = -D latex_paper_size=a4
 PAPEROPT_letter = -D latex_paper_size=letter
 ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
 
-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
-
+.PHONY: help
 help:
 	@echo "Please use \`make <target>' where <target> is one of"
 	@echo "  html       to make standalone HTML files"
@@ -23,50 +29,66 @@ help:
 	@echo "  json       to make JSON files"
 	@echo "  htmlhelp   to make HTML files and a HTML help project"
 	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  applehelp  to make an Apple Help Book"
 	@echo "  devhelp    to make HTML files and a Devhelp project"
 	@echo "  epub       to make an epub"
 	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
 	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
 	@echo "  text       to make text files"
 	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
 	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  xml        to make Docutils-native XML files"
+	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
 	@echo "  linkcheck  to check all external links for integrity"
 	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+	@echo "  coverage   to run coverage check of the documentation (if enabled)"
 
+.PHONY: clean
 clean:
-	-rm -rf $(BUILDDIR)/*
+	rm -rf $(BUILDDIR)/*
 
+.PHONY: html
 html:
 	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
 	@echo
 	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
 
+.PHONY: dirhtml
 dirhtml:
 	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
 	@echo
 	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
 
+.PHONY: singlehtml
 singlehtml:
 	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
 	@echo
 	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
 
+.PHONY: pickle
 pickle:
 	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
 	@echo
 	@echo "Build finished; now you can process the pickle files."
 
+.PHONY: json
 json:
 	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
 	@echo
 	@echo "Build finished; now you can process the JSON files."
 
+.PHONY: htmlhelp
 htmlhelp:
 	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
 	@echo
 	@echo "Build finished; now you can run HTML Help Workshop with the" \
 	      ".hhp project file in $(BUILDDIR)/htmlhelp."
 
+.PHONY: qthelp
 qthelp:
 	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
 	@echo
@@ -76,6 +98,16 @@ qthelp:
 	@echo "To view the help file:"
 	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/DOLFIN.qhc"
 
+.PHONY: applehelp
+applehelp:
+	$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
+	@echo
+	@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
+	@echo "N.B. You won't be able to view it unless you put it in" \
+	      "~/Library/Documentation/Help or install it in your application" \
+	      "bundle."
+
+.PHONY: devhelp
 devhelp:
 	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
 	@echo
@@ -85,11 +117,13 @@ devhelp:
 	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/DOLFIN"
 	@echo "# devhelp"
 
+.PHONY: epub
 epub:
 	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
 	@echo
 	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
 
+.PHONY: latex
 latex:
 	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
 	@echo
@@ -97,34 +131,86 @@ latex:
 	@echo "Run \`make' in that directory to run these through (pdf)latex" \
 	      "(use \`make latexpdf' here to do that automatically)."
 
+.PHONY: latexpdf
 latexpdf:
 	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
 	@echo "Running LaTeX files through pdflatex..."
-	make -C $(BUILDDIR)/latex all-pdf
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
 	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
 
+.PHONY: latexpdfja
+latexpdfja:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through platex and dvipdfmx..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+.PHONY: text
 text:
 	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
 	@echo
 	@echo "Build finished. The text files are in $(BUILDDIR)/text."
 
+.PHONY: man
 man:
 	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
 	@echo
 	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
 
+.PHONY: texinfo
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+.PHONY: info
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+.PHONY: gettext
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+.PHONY: changes
 changes:
 	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
 	@echo
 	@echo "The overview file is in $(BUILDDIR)/changes."
 
+.PHONY: linkcheck
 linkcheck:
 	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
 	@echo
 	@echo "Link check complete; look for any errors in the above output " \
 	      "or in $(BUILDDIR)/linkcheck/output.txt."
 
+.PHONY: doctest
 doctest:
 	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
 	@echo "Testing of doctests in the sources finished, look at the " \
 	      "results in $(BUILDDIR)/doctest/output.txt."
+
+.PHONY: coverage
+coverage:
+	$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
+	@echo "Testing of coverage in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/coverage/python.txt."
+
+.PHONY: xml
+xml:
+	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+	@echo
+	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+.PHONY: pseudoxml
+pseudoxml:
+	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+	@echo
+	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/doc/source/api.rst b/doc/source/api.rst
new file mode 100644
index 0000000..9b8e608
--- /dev/null
+++ b/doc/source/api.rst
@@ -0,0 +1,7 @@
+.. DOLFIN API documentation
+
+
+API documentation
+=================
+
+*Under development*
diff --git a/doc/sphinx-common/source/conf.py b/doc/source/conf.py
similarity index 52%
rename from doc/sphinx-common/source/conf.py
rename to doc/source/conf.py
index 8bbb7ca..0c777d9 100644
--- a/doc/sphinx-common/source/conf.py
+++ b/doc/source/conf.py
@@ -1,9 +1,10 @@
 # -*- coding: utf-8 -*-
 #
 # DOLFIN documentation build configuration file, created by
-# sphinx-quickstart on Tue May 24 22:58:54 2011.
+# sphinx-quickstart on Fri Mar 18 10:11:41 2016.
 #
-# This file is execfile()d with the current directory set to its containing dir.
+# This file is execfile()d with the current directory set to its
+# containing dir.
 #
 # Note that not all possible configuration values are present in this
 # autogenerated file.
@@ -11,31 +12,34 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
-import sys, os
+import sys
+import os
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 #sys.path.insert(0, os.path.abspath('.'))
 
-# -- General configuration -----------------------------------------------------
+# -- General configuration ------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
-needs_sphinx = '1.1'
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-#extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx',
-#              'sphinx.ext.pngmath']
-
-# Use mahjax maths
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx',
-              'sphinx.ext.mathjax']
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+    'sphinx.ext.todo',
+    'sphinx.ext.mathjax',
+    'sphinx.ext.viewcode',
+]
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
-# The suffix of source filenames.
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+# source_suffix = ['.rst', '.md']
 source_suffix = '.rst'
 
 # The encoding of source files.
@@ -46,20 +50,24 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'DOLFIN'
-copyright = u'DOLFIN Core, https://launchpad.net/~dolfin-core'
+copyright = u'2016, FEniCS Project'
+author = u'FEniCS Project'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = '0.9.11+'
+version = u'2016.1.0'
 # The full version, including alpha/beta/rc tags.
-release = '0.9.11+'
+release = u'2016.1.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
-#language = None
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
@@ -71,7 +79,8 @@ release = '0.9.11+'
 # directories to ignore when looking for source files.
 exclude_patterns = []
 
-# The reST default role (used for this markup: `text`) to use for all documents.
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
 #default_role = None
 
 # If true, '()' will be appended to :func: etc. cross-reference text.
@@ -89,13 +98,20 @@ exclude_patterns = []
 pygments_style = 'sphinx'
 
 # A list of ignored prefixes for module index sorting.
-modindex_common_prefix = ["dolfin.", "dolfin.cpp."]
+#modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = True
 
-# -- Options for HTML output ---------------------------------------------------
+
+# -- Options for HTML output ----------------------------------------------
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'nature'
+#html_theme = 'alabaster'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
@@ -103,11 +119,11 @@ html_theme = 'nature'
 #html_theme_options = {}
 
 # Add any paths that contain custom themes here, relative to this directory.
-html_theme_path = ["_themes"]
+#html_theme_path = []
 
 # The name for this set of Sphinx documents.  If None, it defaults to
 # "<project> v<release> documentation".
-html_title = "FEniCS Project"
+#html_title = None
 
 # A shorter title for the navigation bar.  Default is the same as html_title.
 #html_short_title = None
@@ -116,8 +132,8 @@ html_title = "FEniCS Project"
 # of the sidebar.
 #html_logo = None
 
-# The name of an image file (within the static path) to use as favicon of the
-# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# The name of an image file (relative to this directory) to use as a favicon of
+# the docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
 # pixels large.
 #html_favicon = None
 
@@ -126,6 +142,11 @@ html_title = "FEniCS Project"
 # so a file named "default.css" will overwrite the builtin "default.css".
 html_static_path = ['_static']
 
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
 # using the given strftime format.
 #html_last_updated_fmt = '%b %d, %Y'
@@ -148,7 +169,7 @@ html_static_path = ['_static']
 #html_use_index = True
 
 # If true, the index is split into individual pages for each letter.
-html_split_index = False
+#html_split_index = False
 
 # If true, links to the reST sources are added to the pages.
 #html_show_sourcelink = True
@@ -167,23 +188,45 @@ html_split_index = False
 # This is the file name suffix for HTML files (e.g. ".xhtml").
 #html_file_suffix = None
 
+# Language to be used for generating the HTML full-text search index.
+# Sphinx supports the following languages:
+#   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
+#   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
+#html_search_language = 'en'
+
+# A dictionary with options for the search language support, empty by default.
+# Now only 'ja' uses this config value
+#html_search_options = {'type': 'default'}
+
+# The name of a javascript file (relative to the configuration directory) that
+# implements a search results scorer. If empty, the default will be used.
+#html_search_scorer = 'scorer.js'
+
 # Output file base name for HTML help builder.
 htmlhelp_basename = 'DOLFINdoc'
 
+# -- Options for LaTeX output ---------------------------------------------
 
-# -- Options for LaTeX output --------------------------------------------------
-
-# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
 
 # The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+
+# Latex figure (float) alignment
+#'figure_align': 'htbp',
+}
 
 # Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
+# (source start file, target name, title,
+#  author, documentclass [howto, manual, or own class]).
 latex_documents = [
-  ('index', 'DOLFIN.tex', u'DOLFIN Documentation',
-   u'DOLFIN Team', 'manual'),
+    (master_doc, 'DOLFIN.tex', u'DOLFIN Documentation',
+     u'FEniCS Project', 'manual'),
 ]
 
 # The name of an image file (relative to this directory) to place at the top of
@@ -200,31 +243,115 @@ latex_documents = [
 # If true, show URL addresses after external links.
 #latex_show_urls = False
 
-# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
-
 # Documents to append as an appendix to all manuals.
 #latex_appendices = []
 
 # If false, no module index is generated.
 #latex_domain_indices = True
 
-# Parameters affecting the LaTeX PNGs in the HTML files
-pngmath_latex_preamble = r" \usepackage{stmaryrd} "
 
-# -- Options for manual page output --------------------------------------------
+# -- Options for manual page output ---------------------------------------
 
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    ('index', 'dolfin', u'DOLFIN Documentation',
-     [u'DOLFIN Team'], 1)
+    (master_doc, 'dolfin', u'DOLFIN Documentation',
+     [author], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+    (master_doc, 'DOLFIN', u'DOLFIN Documentation',
+     author, 'DOLFIN', 'One line description of project.',
+     'Miscellaneous'),
 ]
 
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
+
+
+# -- Options for Epub output ----------------------------------------------
+
+# Bibliographic Dublin Core info.
+epub_title = project
+epub_author = author
+epub_publisher = author
+epub_copyright = copyright
+
+# The basename for the epub file. It defaults to the project name.
+#epub_basename = project
+
+# The HTML theme for the epub output. Since the default themes are not
+# optimized for small screen space, using the same theme for HTML and epub
+# output is usually not wise. This defaults to 'epub', a theme designed to save
+# visual space.
+#epub_theme = 'epub'
+
+# The language of the text. It defaults to the language option
+# or 'en' if the language is not set.
+#epub_language = ''
+
+# The scheme of the identifier. Typical schemes are ISBN or URL.
+#epub_scheme = ''
+
+# The unique identifier of the text. This can be a ISBN number
+# or the project homepage.
+#epub_identifier = ''
 
-# Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'http://docs.python.org/': None}
+# A unique identification for the text.
+#epub_uid = ''
 
-# Use docstrings both from __init__ and class when using autodoc for
-# Python classes
-autoclass_content = "both"
+# A tuple containing the cover image and cover page html template filenames.
+#epub_cover = ()
+
+# A sequence of (type, uri, title) tuples for the guide element of content.opf.
+#epub_guide = ()
+
+# HTML files that should be inserted before the pages created by sphinx.
+# The format is a list of tuples containing the path and title.
+#epub_pre_files = []
+
+# HTML files that should be inserted after the pages created by sphinx.
+# The format is a list of tuples containing the path and title.
+#epub_post_files = []
+
+# A list of files that should not be packed into the epub file.
+epub_exclude_files = ['search.html']
+
+# The depth of the table of contents in toc.ncx.
+#epub_tocdepth = 3
+
+# Allow duplicate toc entries.
+#epub_tocdup = True
+
+# Choose between 'default' and 'includehidden'.
+#epub_tocscope = 'default'
+
+# Fix unsupported image types using the Pillow.
+#epub_fix_images = False
+
+# Scale large images.
+#epub_max_image_width = 0
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#epub_show_urls = 'inline'
+
+# If false, no index is generated.
+#epub_use_index = True
diff --git a/doc/source/developer.rst b/doc/source/developer.rst
new file mode 100644
index 0000000..0f4e48e
--- /dev/null
+++ b/doc/source/developer.rst
@@ -0,0 +1,14 @@
+.. DOLFIN developer documentation
+
+Developer resources
+===================
+
+DOLFIN development takes place on `Bitbucket
+<https://bitbucket.org/fencis-project/dolfin>`_.
+
+
+.. toctree::
+   :maxdepth: 2
+
+   styleguide_cpp
+   documenting_dolfin_api
diff --git a/doc/source/documenting_dolfin_api.rst b/doc/source/documenting_dolfin_api.rst
new file mode 100644
index 0000000..5008818
--- /dev/null
+++ b/doc/source/documenting_dolfin_api.rst
@@ -0,0 +1,244 @@
+
+.. _styleguides_sphinx_documenting_interface:
+
+==================================================
+Documenting the interface (Programmer's reference)
+==================================================
+
+The DOLFIN :ref:`Programmer's Reference <documentation>` is generated
+for the DOLFIN C++ library and Python module from the source code
+using the documentation tool `Sphinx
+<http://sphinx.pocoo.org/index.html>`_. This page describes how to
+generate the DOLFIN documentation locally and how to extend the
+contents of the Programmer's Reference.
+
+.. _generate_dolfin_documentation_locally:
+
+How to locally build the DOLFIN documentation
+---------------------------------------------
+
+The DOLFIN documentation can be generated and built from the DOLFIN
+source directly as follows:
+
+* Make sure that `Sphinx <http://sphinx.pocoo.org/index.html>`_ is
+  installed.
+
+* Build DOLFIN (for instructions, see :ref:`installation_from_source`).
+
+* Build the documentation by running:
+
+    make doc
+
+  in the DOLFIN build directory.
+
+For ``make doc`` to successfully run, the DOLFIN Python module must be
+installed.
+
+How to improve and extend the DOLFIN Programmer's reference
+-----------------------------------------------------------
+
+The documentation contents are extracted from specially formatted
+comments (docstring comments) in the source code, converted to
+`reStructuredText <http://docutils.sourceforge.net/rst.html>`_, and
+formatted using `Sphinx <http://sphinx.pocoo.org/index.html>`_. The
+syntax used for these specially formatted comments is described below.
+
+To document a feature,
+
+#. Add appropriate docstring comments to source files (see
+   :ref:`syntax_for_docstring_comments`).
+
+#. If you made changes to C++ header files or docstrings in
+   ``dolfin_dir/dolfin/swig/*.i`` you should update the
+   ``dolfin_dir/dolfin/swig/codeexamples.py`` file with an example
+   snippet if applicable and run the script
+   ``dolfin_dir/dolfin/swig/generate.py`` to update the
+   ``dolfin_dir/dolfin/swig/docstrings.i`` file.
+
+#. Build the documentation as described in
+   :ref:`generate_dolfin_documentation_locally` to check the result.
+
+.. _syntax_for_docstring_comments:
+
+Syntax for docstring comments
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+As Sphinx does not allow sections in the markup for class/function
+documentation, we use *italics* (``*italics*``) and definition lists
+to group information.  This is to keep the markup as simple as
+possible since the reST source for the Python documentation of classes
+and functions will be used 'as is' in the docstrings of the DOLFIN
+module.
+
+Most information can be put in the three sections:
+
+* *Arguments*, which are formatted using definition lists following this
+  structure::
+
+    *Arguments*
+        <name> (<type>)
+            <description>
+        <name2> (<type>)
+            <description>
+
+  For example:
+
+  .. code-block:: rest
+
+      *Arguments*
+          dim (int)
+              some dimension.
+          d (double)
+              some value.
+
+* *Returns*, which is formatted in a similar fashion::
+
+    *Returns*
+        <return type>
+            <description>
+
+  For example:
+
+  .. code-block:: rest
+
+      *Returns*
+          int
+              Some random integer.
+
+* *Example*, a very small code snippet that shows how the
+  class/function works. It does not necessarily have to be a
+  stand-alone program.
+
+.. Links to demos that use the feature being documented should be put in
+.. a ``seealso`` directive.
+
+
+An example of how to document a feature
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To make matters more concrete let's consider the case of writing
+documentation for the member function ``closest_cell`` of the DOLFIN
+``Mesh`` class.  The Python interface to this class is generated by
+Swig and it is not extended in the Python layer.  Writing
+documentation for other classes and functions in DOLFIN which are not
+extended or added in the Python layer follow a similar procedure.
+
+The ``Mesh::closest_cell`` function is defined in the file
+``dolfin_dir/dolfin/mesh/Mesh.h``, and the comment lines and function
+definition look as follows:
+
+.. code-block:: c++
+
+    /// Computes the index of the cell in the mesh which is closest to the
+    /// point query.
+    ///
+    /// *Arguments*
+    ///     point (_Point_)
+    ///         A _Point_ object.
+    ///
+    /// *Returns*
+    ///     uint
+    ///         The index of the cell in the mesh which is closest to point.
+    ///
+    /// *Example*
+    ///     .. code-block:: c++
+    ///
+    ///         UnitSquare mesh(1, 1);
+    ///         Point point(0.0, 2.0);
+    ///         info("%d", mesh.closest_cell(point));
+    ///
+    ///     output::
+    ///
+    ///         1
+    dolfin::uint closest_cell(const Point& point) const;
+
+Note that the documentation of a function or class is placed above the
+definition in the source code.
+The structure and content follow the guidelines in the previous section.
+
+The Point object is a class like Mesh and it is defined in the FEniCS
+interface.  To insert a link to the documentation of this class use
+leading and trailing underscore i.e., ``_Point_``.  When parsing the
+comment lines this string will be substituted with either
+``:cpp:class:`Point``` or ``:py:class:`Point``` depending on whether
+documentation for the C++ or Python interface is being generated.  The
+return type, in this case ``dolfin::uint``, will automatically be
+mapped to the correct Python type when generating the documentation
+for the Python interface. Note that if you are writing documentation
+for one of the functions/classes which are added to the Python layer
+manually you have to add manually the correct links and types.
+
+The example code uses C++ syntax because it is located in the C++
+header file.  Translating this code to a correct Python equivalent is
+rather difficult.  It is therefore necessary to add example code using
+the Python syntax manually.  This code should be put in the
+``dolfin_dir/dolfin/swig/codeexamples.py`` which contains a simple
+dictionary of example code.  The dictionary containing only the
+example code for the example above should look as follows:
+
+.. code-block:: python
+
+    codesnippets = {
+    "Mesh":{
+    "dolfin::uint closest_cell(const Point& point) const":
+    """
+    .. code-block:: python
+
+        >>> mesh = dolfin.UnitSquare(1, 1)
+        >>> point = dolfin.Point(0.0, 2.0)
+        >>> mesh.closest_cell(point)
+        1
+    """}
+    }
+
+The first dictionary contains dictionaries for all classes with code
+examples for each function. Note that the full C++ function signature
+has been used to identify the function to which the code example
+belongs.
+
+After adding the documentation to the ``Mesh.h`` file and Python code example
+to the ``codeexamples.py`` file, you have to run the script
+``dolfin/dolfin/swig/generate.py`` to generate the
+``dolfin/dolfin/swig/docstrings.i`` file and then build DOLFIN to update the
+docstrings in the ``dolfin`` Python module.
+
+Why is the documentation procedure so elaborate?
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The procedure for writing documentation might seem cumbersome so let's have a
+look at the design considerations which have led to this ostensible case of
+overengineering.
+
+The Python interface is (partially) generated automatically using
+`Swig <http://www.swig.org/>`_ from the C++ implementation of DOLFIN.
+Some classes are extended when building (see the ``dolfin/dolfin/swig/*post.i``
+files) while others are added or extended manually in the Python layer defined
+in ``dolfin/site-packages/dolfin``.
+While this approach saves a lot of work when implementing the Python interface
+it puts some constraints on the way the documentation can be handled.
+In addition we have the following design goals for writing and maintaining the
+documentation:
+
+Avoid duplicate text
+    In many cases the documentation of a feature will be virtually identical
+    for the C++ and Python interfaces, and since the Python interface is
+    generated from the C++ code, the documentation should be in the C++ source
+    code.
+    To avoid that the documentation on these pages and the comments in the
+    source code (and the implementation itself) diverge, the documentation
+    should be automatically generated from the C++ source code.
+    Therefore the comments should be written using Sphinx markup.
+
+Help in the Python interpreter
+    The documentation of a class/function when running ``help(dolfin.foo)``
+    in the Python interpreter should be identical to what can be found online.
+    In practice this means that we have to generate the
+    ``dolfin/dolfin/swig/docstrings.i`` file using the comments extracted from
+    the C++ source before building the Python interface with Swig.
+
+Simple markup
+    Since the documentation is written directly in the C++ source code, we want
+    markup to be simple such that we have 'code with comments' rather than
+    'comments with code'.
+    Another reason for preferring simple markup is that it is the raw docstring
+    which will be available from the Python interpreter.
diff --git a/doc/source/help.rst b/doc/source/help.rst
new file mode 100644
index 0000000..a84f6c5
--- /dev/null
+++ b/doc/source/help.rst
@@ -0,0 +1,7 @@
+.. How to get help
+
+
+Getting help
+============
+
+*Under development*
diff --git a/doc/source/index.rst b/doc/source/index.rst
new file mode 100644
index 0000000..e34685d
--- /dev/null
+++ b/doc/source/index.rst
@@ -0,0 +1,29 @@
+.. DOLFIN documentation master file, created by
+   sphinx-quickstart on Fri Mar 18 10:11:41 2016.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+DOLFIN documentation
+====================
+
+*This documentation is under development*
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   installation
+   using
+   help
+   api
+   developer
+
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/doc/source/installation.rst b/doc/source/installation.rst
new file mode 100644
index 0000000..2e76b7d
--- /dev/null
+++ b/doc/source/installation.rst
@@ -0,0 +1,16 @@
+.. DOLFIN installation docs
+
+
+Installation
+============
+
+
+Quick start
+-----------
+
+
+Building from source
+--------------------
+
+Dependencies
+^^^^^^^^^^^^
diff --git a/doc/source/styleguide_cpp.rst b/doc/source/styleguide_cpp.rst
new file mode 100644
index 0000000..fa99076
--- /dev/null
+++ b/doc/source/styleguide_cpp.rst
@@ -0,0 +1,343 @@
+.. _developers_styleguide_cpp:
+
+C++ coding style guide
+======================
+
+Naming conventions
+------------------
+
+Class names
+^^^^^^^^^^^
+Use camel caps for class names:
+
+.. code-block:: c++
+
+    class FooBar
+    {
+      ...
+    };
+
+Function names
+^^^^^^^^^^^^^^
+
+Use lower-case for function names and underscore to separate words:
+
+.. code-block:: c++
+
+    foo();
+    bar();
+    foo_bar(...);
+
+Functions returning a value should be given the name of that value,
+for example:
+
+.. code-block:: c++
+
+    class Array:
+    {
+    public:
+
+      /// Return size of array (number of entries)
+      std::size_t size() const;
+
+    };
+
+In the above example, the function should be named ``size`` rather
+than ``get_size``. On the other hand, a function not returning a value
+but rather taking a variable (by reference) and assigning a value to
+it, should use the ``get_foo`` naming scheme, for example:
+
+.. code-block:: c++
+
+    class Parameters:
+    {
+    public:
+
+      /// Retrieve all parameter keys
+      void get_parameter_keys(std::vector<std::string>& parameter_keys) const;
+
+    };
+
+
+Variable names
+^^^^^^^^^^^^^^
+
+Use lower-case for variable names and underscore to separate words:
+
+.. code-block:: c++
+
+    Foo foo;
+    Bar bar;
+    FooBar foo_bar;
+
+Enum variables and constants
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Enum variables should be lower-case with underscore to separate words:
+
+.. code-block:: c++
+
+    enum Type {foo, bar, foo_bar};
+
+We try to avoid using ``#define`` to define constants, but when
+necessary constants should be capitalized:
+
+.. code-block:: c++
+
+    #define FOO 3.14159265358979
+
+File names
+^^^^^^^^^^
+
+Use camel caps for file names if they contain the
+declaration/definition of a class. Header files should have the suffix
+``.h`` and implementation files should have the suffix ``.cpp``:
+
+.. code-block:: c++
+
+    FooBar.h
+    FooBar.cpp
+
+Use lower-case for file names that contain utilities/functions (not
+classes).
+
+Miscellaneous
+-------------
+
+.. _styleguides_cpp_coding_style_indentation:
+
+Indentation
+^^^^^^^^^^^
+
+Indentation should be two spaces and it should be spaces. Do **not**
+use tab(s).
+
+Comments
+^^^^^^^^
+
+Comment your code, and do it often. Capitalize the first letter and
+don't use punctuation (unless the comment runs over several
+sentences). Here's a good example from ``TopologyComputation.cpp``:
+
+.. code-block:: c++
+
+    // Check if connectivity has already been computed
+    if (connectivity.size() > 0)
+      return;
+
+    // Invalidate ordering
+    mesh._ordered = false;
+
+    // Compute entities if they don't exist
+    if (topology.size(d0) == 0)
+      compute_entities(mesh, d0);
+    if (topology.size(d1) == 0)
+      compute_entities(mesh, d1);
+
+    // Check if connectivity still needs to be computed
+    if (connectivity.size() > 0)
+      return;
+
+    ...
+
+Always use ``//`` for comments and ``///`` for documentation (see
+:ref:`styleguides_sphinx_documenting_interface`). Never use ``/*
+... */``, not even for comments that runs over multiple lines.
+
+Integers and reals
+^^^^^^^^^^^^^^^^^^
+
+Use ``std::size_t`` instead of ``int`` (unless you really want to use
+negative integers or memory usage is critical).
+
+.. code-block:: c++
+
+    std::size_t i = 0;
+    double x = 0.0;
+
+Placement of brackets and indent style
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use the `BSD/Allman <http://en.wikipedia.org/wiki/Indent_style>`_
+style when formatting blocks of code, i.e., curly brackets following
+multiline control statements should appear on the next line and should
+not be indented:
+
+.. code-block:: c++
+
+    for (std::size_t i = 0; i < 10; i++)
+    {
+      ...
+    }
+
+For one line statements, omit the brackets:
+
+.. code-block:: c++
+
+    for (std::size_t i = 0; i < 10; i++)
+      foo(i);
+
+Header file layout
+^^^^^^^^^^^^^^^^^^
+
+Header files should follow the below template:
+
+.. code-block:: c++
+
+    // Copyright (C) 2008 Foo Bar
+    //
+    // This file is part of DOLFIN.
+    //
+    // DOLFIN is free software: you can redistribute it and/or modify
+    // it under the terms of the GNU Lesser General Public License as published by
+    // the Free Software Foundation, either version 3 of the License, or
+    // (at your option) any later version.
+    //
+    // DOLFIN is distributed in the hope that it will be useful,
+    // but WITHOUT ANY WARRANTY; without even the implied warranty of
+    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    // GNU Lesser General Public License for more details.
+    //
+    // You should have received a copy of the GNU Lesser General Public License
+    // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+    //
+    // Modified by Bar Foo 2008
+
+    #ifndef __FOO_H
+    #define __FOO_H
+
+    namespace dolfin
+    {
+
+      class Bar; // Forward declarations here
+
+      /// Documentation of class
+
+      class Foo
+      {
+      public:
+
+        ...
+
+      private:
+
+        ...
+
+      };
+
+    }
+
+    #endif
+
+Implementation file layout
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Implementation files should follow the below template:
+
+.. code-block:: c++
+
+    // Copyright (C) 2008 Foo Bar
+    //
+    // This file is part of DOLFIN.
+    //
+    // DOLFIN is free software: you can redistribute it and/or modify
+    // it under the terms of the GNU Lesser General Public License as published by
+    // the Free Software Foundation, either version 3 of the License, or
+    // (at your option) any later version.
+    //
+    // DOLFIN is distributed in the hope that it will be useful,
+    // but WITHOUT ANY WARRANTY; without even the implied warranty of
+    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    // GNU Lesser General Public License for more details.
+    //
+    // You should have received a copy of the GNU Lesser General Public License
+    // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+    //
+    // Modified by Bar Foo 2008
+
+    #include <dolfin/Foo.h>
+
+    using namespace dolfin;
+
+    //-----------------------------------------------------------------------------
+    Foo::Foo() : // variable initialization here
+    {
+      ...
+    }
+    //-----------------------------------------------------------------------------
+    Foo::~Foo()
+    {
+      // Do nothing
+    }
+    //-----------------------------------------------------------------------------
+
+The horizontal lines above (including the slashes) should be exactly
+79 characters wide.
+
+Including header files and using forward declarations
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Do not use ``#include <dolfin.h>`` or ``#include``
+``<dolfin/dolfin_foo.h>`` inside the DOLFIN source tree. Only include
+the portions of DOLFIN you are actually using.
+
+Include as few header files as possible and use forward declarations
+whenever possible (in header files). Put the ``#include`` in the
+implementation file.  This reduces compilation time and minimizes the
+risk of cyclic dependencies.
+
+Explicit constructors
+^^^^^^^^^^^^^^^^^^^^^
+
+Make all one argument constructors (except copy constructors)
+explicit:
+
+.. code-block:: c++
+
+    class Foo
+    {
+      explicit Foo(std::size_t i);
+    };
+
+Virtual functions
+^^^^^^^^^^^^^^^^^
+
+Always declare inherited virtual functions as virtual in the
+subclasses.  This makes it easier to spot which functions are virtual.
+
+.. code-block:: c++
+
+    class Foo
+    {
+      virtual void foo();
+      virtual void bar() = 0;
+    };
+
+    class Bar : public Foo
+    {
+      virtual void foo();
+      virtual void bar();
+    };
+
+Use of libraries
+----------------
+
+Prefer C++ strings and streams over old C-style ``char*``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``std::string`` instead of ``const char*`` and use
+``std::istream`` and ``std::ostream`` instead of ``FILE``. Avoid
+``printf``, ``sprintf`` and other C functions.
+
+There are some exceptions to this rule where we need to use old
+C-style function calls. One such exception is handling of command-line
+arguments (``char* argv[]``).
+
+Prefer smart pointers over plain pointers
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use ``std::shared_ptr`` and ``std::unique_ptr`` in favour of plain
+pointers. Smart pointers reduce the likelihood of memory leaks and
+make ownership clear. Use ``unique_ptr`` for a pointer that is not
+shared and ``shared_ptr`` when multiple pointers point to the same
+object.
diff --git a/doc/source/using.rst b/doc/source/using.rst
new file mode 100644
index 0000000..0b1b955
--- /dev/null
+++ b/doc/source/using.rst
@@ -0,0 +1,7 @@
+.. How to use DOLFIN
+
+
+Using DOLFIN
+============
+
+*Under development*
diff --git a/dolfin/CMakeLists.txt b/dolfin/CMakeLists.txt
index 9c6dd65..5059aa7 100644
--- a/dolfin/CMakeLists.txt
+++ b/dolfin/CMakeLists.txt
@@ -12,11 +12,6 @@ install(FILES ${CMAKE_BINARY_DIR}/dolfin/common/version.h
   )
 include_directories(${CMAKE_BINARY_DIR})
 
-#set(CMAKE_SKIP_BUILD_RPATH  FALSE)
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-
-# Macros
-
 #------------------------------------------------------------------------------
 # DOLFIN source directories
 
@@ -59,11 +54,6 @@ endforeach()
 #       compiler flags, in which case the path should be appended to
 #       DOLFIN_DEP_SYSTEM_INCLUDE_DIRECTORIES
 
-# libXml2
-list(APPEND DOLFIN_DEP_INCLUDE_DIRECTORIES ${LIBXML2_INCLUDE_DIR})
-list(APPEND DOLFIN_TARGET_LINK_LIBRARIES ${LIBXML2_LIBRARIES})
-list(APPEND DOLFIN_CXX_DEFINITIONS ${LIBXML2_DEFINITIONS})
-
 # UFC
 list(APPEND DOLFIN_DEP_INCLUDE_DIRECTORIES ${UFC_INCLUDE_DIRS})
 
@@ -109,10 +99,6 @@ if (DOLFIN_ENABLE_PETSC AND PETSC_FOUND)
   if (PETSC_CUSP_FOUND)
     list(APPEND DOLFIN_CXX_DEFINITIONS "-DHAS_PETSC_CUSP")
   endif()
-
-  if (PETSC_HAS_TAO)
-      list(APPEND DOLFIN_CXX_DEFINITIONS "-DENABLE_PETSC_TAO")
-  endif()
 endif()
 
 # petsc4py
@@ -141,13 +127,6 @@ if (DOLFIN_ENABLE_CHOLMOD AND CHOLMOD_FOUND)
   list(APPEND DOLFIN_TARGET_LINK_LIBRARIES ${CHOLMOD_LIBRARIES})
 endif()
 
-# PaStiX
-if (DOLFIN_ENABLE_PASTIX AND PASTIX_FOUND)
-  list(APPEND DOLFIN_CXX_DEFINITIONS "-DHAS_PASTIX")
-  list(APPEND DOLFIN_DEP_INCLUDE_DIRECTORIES ${PASTIX_INCLUDE_DIRS})
-  list(APPEND DOLFIN_TARGET_LINK_LIBRARIES ${PASTIX_LIBRARIES})
-endif()
-
 # SCOTCH
 if (DOLFIN_ENABLE_SCOTCH AND SCOTCH_FOUND)
   list(APPEND DOLFIN_CXX_DEFINITIONS "-DHAS_SCOTCH")
@@ -194,57 +173,19 @@ if (DOLFIN_ENABLE_OPENMP AND OPENMP_FOUND)
   if (MINGW)
     list(APPEND DOLFIN_LINK_FLAGS "${OpenMP_CXX_FLAGS}")
   endif()
-
 endif()
 
-# Qt4
-if (DOLFIN_ENABLE_QT AND QT_FOUND)
-  include(${QT_USE_FILE})
-  list(APPEND DOLFIN_CXX_DEFINITIONS "-DHAS_QT4")
-  list(APPEND DOLFIN_DEP_SYSTEM_INCLUDE_DIRECTORIES ${QT_INCLUDE_DIR})
-  list(APPEND DOLFIN_TARGET_LINK_LIBRARIES ${QT_LIBRARIES})
-endif()
 
 # VTK
 if (DOLFIN_ENABLE_VTK AND VTK_FOUND)
   include(${VTK_USE_FILE})
 
-  # The Macports VTK library includes some deprecated gcc code
-  if (APPLE)
-    set(DOLFIN_CXX_FLAGS "${DOLFIN_CXX_FLAGS} -Wno-deprecated")
-  endif()
-
   list(APPEND DOLFIN_CXX_DEFINITIONS "-DHAS_VTK")
   list(APPEND DOLFIN_DEP_SYSTEM_INCLUDE_DIRECTORIES ${VTK_INCLUDE_DIRS})
 
-  foreach (lib ${VTK_LIBRARIES})
-    list(APPEND DOLFIN_VTK_LIBRARIES ${lib})
-  endforeach()
-
-  # Check if the QVTK library is found
-  if (DOLFIN_ENABLE_QT AND QT_FOUND)
-    if ("${VTK_MAJOR_VERSION}" STREQUAL "5")
-      find_library(VTK_LIB_QVTK QVTK HINTS ${VTK_LIBRARY_DIRS} NO_DEFAULT_PATH)
-      find_library(VTK_LIB_QVTK QVTK HINTS ${VTK_LIBRARY_DIRS})
-      if (VTK_LIB_QVTK)
-	list(APPEND DOLFIN_VTK_LIBRARIES ${VTK_LIB_QVTK})
-      endif()
-    else()
-      if (TARGET vtkGUISupportQt)
-	set(VTK_LIB_QVTK TRUE)
-      endif()
-    endif()
-
-    if (VTK_LIB_QVTK)
-      list(APPEND DOLFIN_CXX_DEFINITIONS "-DHAS_QVTK")
-    else()
-      message(STATUS "QVTK not found, disabling QT for plotting")
-    endif()
-  endif()
-
   # Append to EXTRA libraries, so they are not linked with demos (this
   # fails with VTK6 unless the vtk macros are also installed).
-  list(APPEND DOLFIN_EXTRA_TARGET_LINK_LIBRARIES ${DOLFIN_VTK_LIBRARIES})
+  list(APPEND DOLFIN_EXTRA_TARGET_LINK_LIBRARIES ${VTK_LIBRARIES})
 endif()
 
 #------------------------------------------------------------------------------
@@ -259,7 +200,8 @@ add_definitions(${DOLFIN_CXX_DEFINITIONS})
 add_definitions(-DDOLFIN_VERSION="${DOLFIN_VERSION}")
 
 # Just add git revision flag to the one affected file
-set_source_files_properties(common/defines.cpp PROPERTIES COMPILE_FLAGS -DDOLFIN_GIT_COMMIT_HASH=\\\"${GIT_COMMIT_HASH}\\\")
+set_source_files_properties(common/defines.cpp PROPERTIES COMPILE_FLAGS
+  "-DDOLFIN_GIT_COMMIT_HASH=\\\"${GIT_COMMIT_HASH}\\\" -DUFC_SIGNATURE=\\\"${UFC_SIGNATURE}\\\"")
 
 # Add flags
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DOLFIN_CXX_FLAGS}")
@@ -273,40 +215,30 @@ set_target_properties(dolfin PROPERTIES ${DOLFIN_LIBRARY_PROPERTIES})
 # Strip leading and trailing whitespaces
 string(STRIP DOLFIN_TARGET_LINK_LIBRARIES "${DOLFIN_TARGET_LINK_LIBRARIES}")
 
+# Remove duplicate libraries
+if (DOLFIN_TARGET_LINK_LIBRARIES)
+  list(REMOVE_DUPLICATES DOLFIN_TARGET_LINK_LIBRARIES)
+endif()
+if(DOLFIN_EXTRA_TARGET_LINK_LIBRARIES)
+  list(REMOVE_DUPLICATES DOLFIN_EXTRA_TARGET_LINK_LIBRARIES)
+endif()
+
 # Add DOLFIN target libraries
 target_link_libraries(dolfin ${DOLFIN_TARGET_LINK_LIBRARIES}
   ${DOLFIN_EXTRA_TARGET_LINK_LIBRARIES})
+
 #------------------------------------------------------------------------------
 # SWIG
 
 if (PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
 
-  # Make sure we can import the UFC module and that it is compiled
-  # with present version of SWIG
-  execute_process(
-    COMMAND ${PYTHON_EXECUTABLE} -c "from ufc import *; import sys; sys.stdout.write('.'.join([str(int(s)) for s in ufc.__swigversion__.split('.')]))"
-    OUTPUT_VARIABLE UFC_SWIGVERSION
-    RESULT_VARIABLE UFC_MODULE_NOT_FOUND
-    )
-
-  # Check that UFC can be imported
-  if (UFC_MODULE_NOT_FOUND)
-    message(WARNING "Unable to import UFC. Install latest UFC or check that PYTHONPATH is set appropriately. Python will be disabled.")
-  endif()
-
-  # Check that UFC was built with the version of SWIG that is being
-  # used
-  if (NOT UFC_MODULE_NOT_FOUND AND (NOT "${SWIG_VERSION}" STREQUAL "${UFC_SWIGVERSION}"))
-    message(WARNING "UFC compiled with different version of SWIG. Please install SWIG version ${UFC_SWIGVERSION} or recompile UFC with present SWIG.")
-  endif()
-
   # Add numpy defines to DOLFIN_PYTHON_DEFINITIONS
   if (NUMPY_FOUND)
 
     # Set numpy version define
     set(DOLFIN_PYTHON_DEFINITIONS ${DOLFIN_PYTHON_DEFINITIONS};-DNUMPY_VERSION_MAJOR=${NUMPY_VERSION_MAJOR};-DNUMPY_VERSION_MINOR=${NUMPY_VERSION_MINOR};-DNUMPY_VERSION_MICRO=${NUMPY_VERSION_MICRO})
 
-    # Only set define for none depricated API for NUMPY version 1.7
+    # Only set define for none deprecated API for NUMPY version 1.7
     # and larger
     if(NUMPY_VERSION VERSION_GREATER 1.6.2)
       set(DOLFIN_PYTHON_DEFINITIONS ${DOLFIN_PYTHON_DEFINITIONS} -DNPY_NO_DEPRECATED_API=NPY_${NUMPY_VERSION_MAJOR}_${NUMPY_VERSION_MINOR}_API_VERSION)
@@ -314,10 +246,7 @@ if (PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
 
   endif()
 
-  # If suitble UFC SWIG extension is found, add SWIG subdirectory
-  if (NOT UFC_MODULE_NOT_FOUND AND ("${SWIG_VERSION}" STREQUAL "${UFC_SWIGVERSION}"))
-    add_subdirectory(swig)
-  endif()
+  add_subdirectory(swig)
 
 endif()
 
diff --git a/dolfin/adaptivity/AdaptiveLinearVariationalSolver.cpp b/dolfin/adaptivity/AdaptiveLinearVariationalSolver.cpp
index 4e02949..08cf2d7 100644
--- a/dolfin/adaptivity/AdaptiveLinearVariationalSolver.cpp
+++ b/dolfin/adaptivity/AdaptiveLinearVariationalSolver.cpp
@@ -36,15 +36,6 @@ using namespace dolfin;
 
 // ----------------------------------------------------------------------------
 AdaptiveLinearVariationalSolver::
-AdaptiveLinearVariationalSolver(LinearVariationalProblem& problem,
-                                GoalFunctional& goal)
-  : _problem(reference_to_no_delete_pointer(problem))
-{
-  init(reference_to_no_delete_pointer(problem),
-       reference_to_no_delete_pointer(goal));
-}
-// ----------------------------------------------------------------------------
-AdaptiveLinearVariationalSolver::
 AdaptiveLinearVariationalSolver(std::shared_ptr<LinearVariationalProblem> problem,
                                 std::shared_ptr<GoalFunctional> goal)
   : _problem(problem)
@@ -96,7 +87,7 @@ std::shared_ptr<const Function>
 AdaptiveLinearVariationalSolver::solve_primal()
 {
   LinearVariationalProblem& current = _problem->leaf_node();
-  LinearVariationalSolver solver(current);
+  LinearVariationalSolver solver(reference_to_no_delete_pointer(current));
   solver.parameters.update(parameters("linear_variational_solver"));
   solver.solve();
   return current.solution();
diff --git a/dolfin/adaptivity/AdaptiveLinearVariationalSolver.h b/dolfin/adaptivity/AdaptiveLinearVariationalSolver.h
index 2006034..9868bab 100644
--- a/dolfin/adaptivity/AdaptiveLinearVariationalSolver.h
+++ b/dolfin/adaptivity/AdaptiveLinearVariationalSolver.h
@@ -65,16 +65,6 @@ namespace dolfin
   {
   public:
 
-    /// Create AdaptiveLinearVariationalSolver
-    ///
-    /// *Arguments*
-    ///     problem (_LinearVariationalProblem_)
-    ///         The primal problem
-    ///     goal (_GoalFunctional_)
-    ///         The goal functional
-    AdaptiveLinearVariationalSolver(LinearVariationalProblem& problem,
-                                    GoalFunctional& goal);
-
     /// Create AdaptiveLinearVariationalSolver (shared ptr version)
     ///
     /// *Arguments*
@@ -114,8 +104,7 @@ namespace dolfin
     /// *Returns*
     ///     std::vector<_DirichletBC_>
     ///         The primal boundary conditions
-    virtual std::vector<std::shared_ptr<const DirichletBC> >
-      extract_bcs() const;
+    virtual std::vector<std::shared_ptr<const DirichletBC>> extract_bcs() const;
 
     /// Evaluate the goal functional.
     ///
@@ -139,6 +128,7 @@ namespace dolfin
     virtual void adapt_problem(std::shared_ptr<const Mesh> mesh);
 
   protected:
+
     /// Return the number of degrees of freedom for primal problem
     ///
     /// *Returns*
diff --git a/dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.cpp b/dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.cpp
index cd7f0ed..3f7aabb 100644
--- a/dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.cpp
+++ b/dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.cpp
@@ -35,15 +35,6 @@
 using namespace dolfin;
 
 // ----------------------------------------------------------------------------
-AdaptiveNonlinearVariationalSolver::
-AdaptiveNonlinearVariationalSolver(NonlinearVariationalProblem& problem,
-                                   GoalFunctional& goal)
-  : _problem(reference_to_no_delete_pointer(problem))
-{
-  init(reference_to_no_delete_pointer(problem),
-       reference_to_no_delete_pointer(goal));
-}
-// ----------------------------------------------------------------------------
 AdaptiveNonlinearVariationalSolver::AdaptiveNonlinearVariationalSolver(
   std::shared_ptr<NonlinearVariationalProblem> problem,
   std::shared_ptr<GoalFunctional> goal)
@@ -54,8 +45,7 @@ AdaptiveNonlinearVariationalSolver::AdaptiveNonlinearVariationalSolver(
 // ----------------------------------------------------------------------------
 AdaptiveNonlinearVariationalSolver::AdaptiveNonlinearVariationalSolver(
   std::shared_ptr<NonlinearVariationalProblem> problem,
-  std::shared_ptr<Form> goal,
-  std::shared_ptr<ErrorControl> control)
+  std::shared_ptr<Form> goal, std::shared_ptr<ErrorControl> control)
   : _problem(problem)
 {
   this->goal = goal;
@@ -95,7 +85,7 @@ std::shared_ptr<const Function>
 AdaptiveNonlinearVariationalSolver::solve_primal()
 {
   NonlinearVariationalProblem& current = _problem->leaf_node();
-  NonlinearVariationalSolver solver(current);
+  NonlinearVariationalSolver solver(reference_to_no_delete_pointer(current));
   solver.parameters.update(parameters("nonlinear_variational_solver"));
   solver.solve();
   return current.solution();
diff --git a/dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.h b/dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.h
index 6761294..4f6474c 100644
--- a/dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.h
+++ b/dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.h
@@ -65,16 +65,6 @@ namespace dolfin
   {
   public:
 
-    /// Create AdaptiveNonlinearVariationalSolver
-    ///
-    /// *Arguments*
-    ///     problem (_NonlinearVariationalProblem_)
-    ///         The primal problem
-    ///     goal (_GoalFunctional_)
-    ///         The goal functional
-    AdaptiveNonlinearVariationalSolver(NonlinearVariationalProblem& problem,
-                                       GoalFunctional& goal);
-
     /// Create AdaptiveNonlinearVariationalSolver (shared ptr version)
     ///
     /// *Arguments*
@@ -115,7 +105,7 @@ namespace dolfin
     /// *Returns*
     ///     std::vector<_DirichletBC_>
     ///         The primal boundary conditions
-    virtual std::vector<std::shared_ptr<const DirichletBC> >
+    virtual std::vector<std::shared_ptr<const DirichletBC>>
       extract_bcs() const;
 
     /// Evaluate the goal functional.
@@ -140,6 +130,7 @@ namespace dolfin
     virtual void adapt_problem(std::shared_ptr<const Mesh> mesh);
 
   protected:
+
     /// Return the number of degrees of freedom for primal problem
     ///
     /// *Returns*
diff --git a/dolfin/adaptivity/ErrorControl.cpp b/dolfin/adaptivity/ErrorControl.cpp
index 8b1e4b2..068f552 100644
--- a/dolfin/adaptivity/ErrorControl.cpp
+++ b/dolfin/adaptivity/ErrorControl.cpp
@@ -33,12 +33,12 @@
 #include <dolfin/fem/DirichletBC.h>
 #include <dolfin/fem/GenericDofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/LocalAssembler.h>
 #include <dolfin/fem/UFC.h>
 #include <dolfin/fem/LinearVariationalProblem.h>
 #include <dolfin/fem/LinearVariationalSolver.h>
 #include <dolfin/function/Function.h>
 #include <dolfin/function/FunctionSpace.h>
-#include <dolfin/function/SubSpace.h>
 #include <dolfin/function/Constant.h>
 #include <dolfin/function/SpecialFacetFunction.h>
 #include <dolfin/la/Matrix.h>
@@ -47,7 +47,6 @@
 #include <dolfin/mesh/Cell.h>
 #include <dolfin/mesh/Facet.h>
 
-#include "LocalAssembler.h"
 #include "ErrorControl.h"
 
 using namespace dolfin;
@@ -82,7 +81,7 @@ ErrorControl::ErrorControl(std::shared_ptr<Form> a_star,
 
   const Function& bubble = dynamic_cast<const Function&>(*_a_R_T->coefficient(0));
   _bubble_space = bubble.function_space();
-  _cell_bubble.reset(new Function(_bubble_space));
+  _cell_bubble = std::make_shared<Function>(_bubble_space);
   dolfin_assert(_cell_bubble->vector());
   *(_cell_bubble->vector()) = 1.0;
 
@@ -129,8 +128,7 @@ double ErrorControl::estimate_error(const Function& u,
 }
 //-----------------------------------------------------------------------------
 void ErrorControl::compute_dual(
-  Function& z,
-  const std::vector<std::shared_ptr<const DirichletBC>> bcs)
+  Function& z, const std::vector<std::shared_ptr<const DirichletBC>> bcs)
 {
   log(PROGRESS, "Solving dual problem.");
 
@@ -141,7 +139,7 @@ void ErrorControl::compute_dual(
     dolfin_assert(bcs[i]);
 
     // Create shared_ptr to boundary condition
-    std::shared_ptr<DirichletBC> dual_bc_ptr(new DirichletBC(*bcs[i]));
+    auto dual_bc_ptr = std::make_shared<DirichletBC>(*bcs[i]);
 
     // Run homogenize
     dual_bc_ptr->homogenize();
@@ -151,11 +149,11 @@ void ErrorControl::compute_dual(
   }
 
   // Create shared_ptr to dual solution (FIXME: missing interface ...)
-  std::shared_ptr<Function> dual(reference_to_no_delete_pointer(z));
+  auto dual = reference_to_no_delete_pointer(z);
 
   // Solve dual problem
   LinearVariationalProblem dual_problem(_a_star, _L_star, dual, dual_bcs);
-  LinearVariationalSolver solver(dual_problem);
+  LinearVariationalSolver solver(reference_to_no_delete_pointer(dual_problem));
   solver.parameters.update(parameters("dual_variational_solver"));
   solver.solve();
 }
@@ -168,7 +166,7 @@ void ErrorControl::compute_extrapolation(
 
   // Extrapolate
   dolfin_assert(_extrapolation_space);
-  _Ez_h.reset(new Function(_extrapolation_space));
+  _Ez_h = std::make_shared<Function>(_extrapolation_space);
   _Ez_h->extrapolate(z);
 
   // Apply appropriate boundary conditions to extrapolation
@@ -180,7 +178,7 @@ void ErrorControl::compute_indicators(MeshFunction<double>& indicators,
 {
   // Create Function for the strong cell residual (R_T)
   dolfin_assert(_a_R_T);
-  _R_T.reset(new Function(_a_R_T->function_space(1)));
+  _R_T = std::make_shared<Function>(_a_R_T->function_space(1));
 
   // Create SpecialFacetFunction for the strong facet residual (R_dT)
   dolfin_assert(_a_R_dT);
@@ -189,12 +187,16 @@ void ErrorControl::compute_indicators(MeshFunction<double>& indicators,
     f_e.push_back(Function(_a_R_dT->function_space(1)));
 
   if (f_e[0].value_rank() == 0)
-    _R_dT.reset(new SpecialFacetFunction(f_e));
+    _R_dT = std::make_shared<SpecialFacetFunction>(f_e);
   else if (f_e[0].value_rank() == 1)
-    _R_dT.reset(new SpecialFacetFunction(f_e, f_e[0].value_dimension(0)));
+  {
+    _R_dT = std::make_shared<SpecialFacetFunction>(f_e,
+                                                   f_e[0].value_dimension(0));
+  }
   else
   {
-    _R_dT.reset(new SpecialFacetFunction(f_e, f_e[0].value_dimension(0)));
+    _R_dT = std::make_shared<SpecialFacetFunction>(f_e,
+                                                   f_e[0].value_dimension(0));
     dolfin_error("ErrorControl.cpp",
                  "compute error indicators",
                  "Not implemented for tensor-valued functions");
@@ -206,7 +208,7 @@ void ErrorControl::compute_indicators(MeshFunction<double>& indicators,
   // Interpolate dual extrapolation into primal test (dual trial space)
   dolfin_assert(_a_star);
   dolfin_assert(_Ez_h);
-  _Pi_E_z_h.reset(new Function(_a_star->function_space(1)));
+  _Pi_E_z_h = std::make_shared<Function>(_a_star->function_space(1));
   _Pi_E_z_h->interpolate(*_Ez_h);
 
   // Attach coefficients to error indicator form
@@ -232,7 +234,8 @@ void ErrorControl::compute_indicators(MeshFunction<double>& indicators,
   // Convert DG_0 vector to mesh function over cells
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
-    const ArrayView<const dolfin::la_index> dofs = dofmap.cell_dofs(cell->index());
+    const ArrayView<const dolfin::la_index> dofs
+      = dofmap.cell_dofs(cell->index());
     dolfin_assert(dofs.size() == 1);
     indicators[cell->index()] = x[dofs[0]];
   }
@@ -291,7 +294,8 @@ void ErrorControl::compute_cell_residual(Function& R_T, const Function& u)
   // Define matrices for cell-residual problems
   dolfin_assert(V.element());
   const std::size_t N = V.element()->space_dimension();
-  Eigen::MatrixXd A(N, N), b(N, 1);
+  Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
+                Eigen::RowMajor> A(N, N), b(N, 1);
   Eigen::VectorXd x(N);
 
   // Extract cell_domains etc from right-hand side form
@@ -304,17 +308,17 @@ void ErrorControl::compute_cell_residual(Function& R_T, const Function& u)
 
   // Assemble and solve local linear systems
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
     // Get cell vertices
-    cell->get_vertex_coordinates(vertex_coordinates);
+    cell->get_coordinate_dofs(coordinate_dofs);
 
     // Assemble local linear system
-    LocalAssembler::assemble(A, ufc_lhs, vertex_coordinates,
+    LocalAssembler::assemble(A, ufc_lhs, coordinate_dofs,
                              ufc_cell, *cell, cell_domains,
                              exterior_facet_domains, interior_facet_domains);
-    LocalAssembler::assemble(b, ufc_rhs, vertex_coordinates, ufc_cell,
+    LocalAssembler::assemble(b, ufc_rhs, coordinate_dofs, ufc_cell,
                              *cell, cell_domains,
                              exterior_facet_domains, interior_facet_domains);
 
@@ -322,7 +326,8 @@ void ErrorControl::compute_cell_residual(Function& R_T, const Function& u)
     x = A.partialPivLu().solve(b);
 
     // Get local-to-global dof map for cell
-    const ArrayView<const dolfin::la_index> dofs = dofmap.cell_dofs(cell->index());
+    const ArrayView<const dolfin::la_index> dofs
+      = dofmap.cell_dofs(cell->index());
 
     // Plug local solution into global vector
     dolfin_assert(R_T.vector());
@@ -374,7 +379,8 @@ void ErrorControl::compute_facet_residual(SpecialFacetFunction& R_dT,
   const GenericDofMap& dofmap = *V.dofmap();
 
   // Define matrices for facet-residual problems
-  Eigen::MatrixXd A(N, N), b(N, 1);
+  Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
+                Eigen::RowMajor> A(N, N), b(N, 1);
   Eigen::VectorXd x(N);
 
   // Variables to be used for the construction of the cone function
@@ -420,17 +426,17 @@ void ErrorControl::compute_facet_residual(SpecialFacetFunction& R_dT,
 
     // Assemble and solve local linear systems
     ufc::cell ufc_cell;
-    std::vector<double> vertex_coordinates;
+    std::vector<double> coordinate_dofs;
     for (CellIterator cell(mesh); !cell.end(); ++cell)
     {
-      // Get cell vertex_coordinates
-      cell->get_vertex_coordinates(vertex_coordinates);
+      // Get cell coordinate_dofs
+      cell->get_coordinate_dofs(coordinate_dofs);
 
       // Assemble linear system
-      LocalAssembler::assemble(A, ufc_lhs, vertex_coordinates,
+      LocalAssembler::assemble(A, ufc_lhs, coordinate_dofs,
                                ufc_cell, *cell, cell_domains,
                                exterior_facet_domains, interior_facet_domains);
-      LocalAssembler::assemble(b, ufc_rhs, vertex_coordinates,
+      LocalAssembler::assemble(b, ufc_rhs, coordinate_dofs,
                                ufc_cell, *cell, cell_domains,
                                exterior_facet_domains, interior_facet_domains);
 
@@ -448,7 +454,8 @@ void ErrorControl::compute_facet_residual(SpecialFacetFunction& R_dT,
       x = A.partialPivLu().solve(b);
 
       // Get local-to-global dof map for cell
-      const ArrayView<const dolfin::la_index> dofs = dofmap.cell_dofs(cell->index());
+      const ArrayView<const dolfin::la_index> dofs
+        = dofmap.cell_dofs(cell->index());
 
       // Plug local solution into global vector
       dolfin_assert(R_dT[local_facet].vector());
@@ -469,7 +476,8 @@ void ErrorControl::apply_bcs_to_extrapolation(
 
     // Extract SubSpace component
     dolfin_assert(bcs[i]->function_space());
-    const std::vector<std::size_t> component = bcs[i]->function_space()->component();
+    const std::vector<std::size_t> component
+      = bcs[i]->function_space()->component();
 
     // Extract sub-domain
     std::shared_ptr<const SubDomain> sub_domain = bcs[i]->user_sub_domain();
@@ -482,17 +490,29 @@ void ErrorControl::apply_bcs_to_extrapolation(
     if (component.empty())
     {
       if (sub_domain)
-        e_bc.reset(new DirichletBC(_extrapolation_space, bcs[i]->value(), sub_domain, bcs[i]->method()));
+      {
+        e_bc.reset(new DirichletBC(_extrapolation_space, bcs[i]->value(),
+                                   sub_domain, bcs[i]->method()));
+      }
       else
-        e_bc.reset(new DirichletBC(_extrapolation_space, bcs[i]->value(), bcs[i]->markers(), bcs[i]->method()));
+      {
+        e_bc.reset(new DirichletBC(_extrapolation_space, bcs[i]->value(),
+                                   bcs[i]->markers(), bcs[i]->method()));
+      }
     }
     else
     {
-      std::shared_ptr<SubSpace> S(new SubSpace(*_extrapolation_space, component));
+      std::shared_ptr<FunctionSpace> S = _extrapolation_space->sub(component);
       if (sub_domain)
-        e_bc.reset(new DirichletBC(S, bcs[i]->value(), sub_domain, bcs[i]->method()));
+      {
+        e_bc.reset(new DirichletBC(S, bcs[i]->value(), sub_domain,
+                                   bcs[i]->method()));
+      }
       else
-        e_bc.reset(new DirichletBC(S, bcs[i]->value(), bcs[i]->markers(), bcs[i]->method()));
+      {
+        e_bc.reset(new DirichletBC(S, bcs[i]->value(), bcs[i]->markers(),
+                                   bcs[i]->method()));
+      }
     }
     e_bc->homogenize();
 
diff --git a/dolfin/adaptivity/ErrorControl.h b/dolfin/adaptivity/ErrorControl.h
index 0fec115..3b38706 100644
--- a/dolfin/adaptivity/ErrorControl.h
+++ b/dolfin/adaptivity/ErrorControl.h
@@ -195,9 +195,10 @@ namespace dolfin
     void compute_extrapolation(const Function& z,
          const std::vector<std::shared_ptr<const DirichletBC> > bcs);
 
-    friend const ErrorControl& adapt(const ErrorControl& ec,
-                                     std::shared_ptr<const Mesh> adapted_mesh,
-                                     bool adapt_coefficients);
+    friend std::shared_ptr<ErrorControl>
+      adapt(const ErrorControl& ec,
+            std::shared_ptr<const Mesh> adapted_mesh,
+            bool adapt_coefficients);
 
   private:
 
diff --git a/dolfin/adaptivity/Extrapolation.cpp b/dolfin/adaptivity/Extrapolation.cpp
index 515a604..a6540b8 100644
--- a/dolfin/adaptivity/Extrapolation.cpp
+++ b/dolfin/adaptivity/Extrapolation.cpp
@@ -68,7 +68,7 @@ void Extrapolation::extrapolate(Function& w, const Function& v)
 
   // UFC cell view of center cell and vertex coordinate holder
   ufc::cell c0;
-  std::vector<double> vertex_coordinates0;
+  std::vector<double> coordinate_dofs0;
 
   // List of values for each dof of w (multivalued until we average)
   std::vector<std::vector<double>> coefficients;
@@ -79,7 +79,7 @@ void Extrapolation::extrapolate(Function& w, const Function& v)
   for (CellIterator cell0(mesh); !cell0.end(); ++cell0)
   {
     // Update UFC view
-    cell0->get_vertex_coordinates(vertex_coordinates0);
+    cell0->get_coordinate_dofs(coordinate_dofs0);
     cell0->get_cell_data(c0);
 
     // Tabulate dofs for w on cell and store values
@@ -88,7 +88,7 @@ void Extrapolation::extrapolate(Function& w, const Function& v)
 
     // Compute coefficients on this cell
     std::size_t offset = 0;
-    compute_coefficients(coefficients, v, V, W, *cell0, vertex_coordinates0,
+    compute_coefficients(coefficients, v, V, W, *cell0, coordinate_dofs0,
                          c0, dofs, offset);
   }
 
@@ -102,7 +102,7 @@ void Extrapolation::compute_coefficients(
   const FunctionSpace& V,
   const FunctionSpace& W,
   const Cell& cell0,
-  const std::vector<double>& vertex_coordinates0,
+  const std::vector<double>& coordinate_dofs0,
   const ufc::cell& c0,
   const ArrayView<const dolfin::la_index>& dofs,
   std::size_t& offset)
@@ -115,7 +115,7 @@ void Extrapolation::compute_coefficients(
     for (std::size_t k = 0; k < num_sub_spaces; k++)
     {
       compute_coefficients(coefficients, v[k], *V[k], *W[k], cell0,
-                           vertex_coordinates0, c0, dofs, offset);
+                           coordinate_dofs0, c0, dofs, offset);
     }
     return;
   }
@@ -145,7 +145,7 @@ void Extrapolation::compute_coefficients(
   // Add equations on cell and neighboring cells
   dolfin_assert(V.mesh());
   ufc::cell c1;
-  std::vector<double> vertex_coordinates1;
+  std::vector<double> coordinate_dofs1;
 
   // Get unique set of surrounding cells (including cell0)
   std::set<std::size_t> cell_set;
@@ -162,10 +162,10 @@ void Extrapolation::compute_coefficients(
 
     Cell cell1(cell0.mesh(), cell_it);
 
-    cell1.get_vertex_coordinates(vertex_coordinates1);
+    cell1.get_coordinate_dofs(coordinate_dofs1);
     cell1.get_cell_data(c1);
     add_cell_equations(A, b, cell0, cell1,
-                       vertex_coordinates0, vertex_coordinates1,
+                       coordinate_dofs0, coordinate_dofs1,
                        c0, c1, V, W, v,
                        cell2dof2row[cell_it]);
   }
@@ -216,8 +216,8 @@ Extrapolation::add_cell_equations(Eigen::MatrixXd& A,
                                   Eigen::VectorXd& b,
                                   const Cell& cell0,
                                   const Cell& cell1,
-                                  const std::vector<double>& vertex_coordinates0,
-                                  const std::vector<double>& vertex_coordinates1,
+                                  const std::vector<double>& coordinate_dofs0,
+                                  const std::vector<double>& coordinate_dofs1,
                                   const ufc::cell& c0,
                                   const ufc::cell& c1,
                                   const FunctionSpace& V,
@@ -228,12 +228,15 @@ Extrapolation::add_cell_equations(Eigen::MatrixXd& A,
   // Extract coefficients for v on patch cell
   dolfin_assert(V.element());
   std::vector<double> dof_values(V.element()->space_dimension());
-  v.restrict(&dof_values[0], *V.element(), cell1, vertex_coordinates1.data(),
+  v.restrict(&dof_values[0], *V.element(), cell1, coordinate_dofs1.data(),
              c1);
 
-  // Iterate over given local dofs for V on patch cell
+  // Create basis function
   dolfin_assert(W.element());
-  for (auto const &it: dof2row)
+  BasisFunction phi(0, W.element(), coordinate_dofs0);
+
+  // Iterate over given local dofs for V on patch cell
+  for (auto const &it : dof2row)
   {
     const std::size_t i = it.first;
     const std::size_t row = it.second;
@@ -242,11 +245,11 @@ Extrapolation::add_cell_equations(Eigen::MatrixXd& A,
     for (std::size_t j = 0; j < W.element()->space_dimension(); ++j)
     {
       // Create basis function
-      const BasisFunction phi(j, *W.element(), vertex_coordinates0);
+      phi.update_index(j);
 
       // Evaluate dof on basis function
       const double dof_value
-        = V.element()->evaluate_dof(i, phi,  vertex_coordinates1.data(),
+        = V.element()->evaluate_dof(i, phi,  coordinate_dofs1.data(),
                                     c1.orientation, c1);
 
       // Insert dof_value into matrix
diff --git a/dolfin/adaptivity/Extrapolation.h b/dolfin/adaptivity/Extrapolation.h
index 1e893cc..ecaed1f 100644
--- a/dolfin/adaptivity/Extrapolation.h
+++ b/dolfin/adaptivity/Extrapolation.h
@@ -82,7 +82,7 @@ namespace dolfin
       compute_coefficients(std::vector<std::vector<double> >& coefficients,
                            const Function&v, const FunctionSpace& V,
                            const FunctionSpace& W, const Cell& cell0,
-                           const std::vector<double>& vertex_coordinates0,
+                           const std::vector<double>& coordinate_dofs0,
                            const ufc::cell& c0,
                            const ArrayView<const dolfin::la_index>& dofs,
                            std::size_t& offset);
@@ -92,8 +92,8 @@ namespace dolfin
                                  Eigen::VectorXd& b,
                                  const Cell& cell0,
                                  const Cell& cell1,
-                                 const std::vector<double>& vertex_coordinates0,
-                                 const std::vector<double>& vertex_coordinates1,
+                                 const std::vector<double>& coordinate_dofs0,
+                                 const std::vector<double>& coordinate_dofs1,
                                  const ufc::cell& c0,
                                  const ufc::cell& c1,
                                  const FunctionSpace& V,
diff --git a/dolfin/adaptivity/GenericAdaptiveVariationalSolver.cpp b/dolfin/adaptivity/GenericAdaptiveVariationalSolver.cpp
index 311a80b..9f98b63 100644
--- a/dolfin/adaptivity/GenericAdaptiveVariationalSolver.cpp
+++ b/dolfin/adaptivity/GenericAdaptiveVariationalSolver.cpp
@@ -67,7 +67,7 @@ void GenericAdaptiveVariationalSolver::solve(const double tol)
   // Initialize storage of meshes and indicators
   std::string label = parameters["data_label"];
 #ifdef HAS_HDF5
-  TimeSeries series(goal->mesh().mpi_comm(), label);
+  TimeSeries series(goal->mesh()->mpi_comm(), label);
 #endif
 
   // Iterate over a series of meshes
@@ -114,7 +114,8 @@ void GenericAdaptiveVariationalSolver::solve(const double tol)
     dolfin_assert(u->function_space());
     const FunctionSpace& V = *u->function_space();
     dolfin_assert(V.mesh());
-    const Mesh& mesh = *V.mesh();
+    std::shared_ptr<const Mesh> mesh = V.mesh();
+    dolfin_assert(mesh);
 
     // Evaluate goal functional
     log(PROGRESS, "Evaluating goal functional.");
@@ -130,7 +131,7 @@ void GenericAdaptiveVariationalSolver::solve(const double tol)
     log(PROGRESS, "Error estimate is %g (tol = %g).", error_estimate, tol);
     end();
 
-    const int num_cells = mesh.num_cells();
+    const int num_cells = mesh->num_cells();
     const int num_dofs = V.dim();
     datum->add("num_cells", num_cells);
     datum->add("num_dofs", num_dofs);
@@ -148,7 +149,7 @@ void GenericAdaptiveVariationalSolver::solve(const double tol)
     //--- Stage 2: Compute error indicators
     begin(PROGRESS, "Stage %d.2: Computing error indicators...", i);
     timer.start();
-    MeshFunction<double> indicators(mesh, mesh.topology().dim());
+    MeshFunction<double> indicators(mesh, mesh->topology().dim());
     dolfin_assert(u);
     ec.compute_indicators(indicators, *u);
     datum->add("time_compute_indicators", timer.stop());
@@ -156,7 +157,7 @@ void GenericAdaptiveVariationalSolver::solve(const double tol)
     {
 #ifdef HAS_HDF5
       //series.store(indicators, i); // No TimeSeries storage of MeshFunction
-      series.store(mesh, i);
+      series.store(*mesh, i);
 #else
       warning("HDF5 not available, unable to save refinement data as time series.");
 #endif
@@ -165,7 +166,7 @@ void GenericAdaptiveVariationalSolver::solve(const double tol)
 
     //--- Stage 3: Mark mesh for refinement ---
     begin(PROGRESS, "Stage %d.3: Marking mesh for refinement...", i);
-    MeshFunction<bool> markers(mesh, mesh.topology().dim());
+    MeshFunction<bool> markers(mesh, mesh->topology().dim());
     const std::string strategy = parameters["marking_strategy"];
     const double fraction = parameters["marking_fraction"];
     timer.start();
@@ -176,18 +177,18 @@ void GenericAdaptiveVariationalSolver::solve(const double tol)
     //--- Stage 4: Refine mesh ---
     begin(PROGRESS, "Stage %d.4: Refining mesh...", i);
     timer.start();
-    adapt(mesh, markers);
+    adapt(*mesh, markers);
     datum->add("time_adapt_mesh", timer.stop());
     if (parameters["plot_mesh"])
-      plot(mesh.child(), "Refined mesh");
+      plot(mesh->child(), "Refined mesh");
     end();
 
     //--- Stage 5: Update forms ---
     begin(PROGRESS, "Stage %d.5: Updating forms...", i);
     timer.start();
-    adapt_problem(mesh.leaf_node_shared_ptr());
-    adapt(M, mesh.leaf_node_shared_ptr());
-    adapt(ec, mesh.leaf_node_shared_ptr(), false);
+    adapt_problem(mesh->leaf_node_shared_ptr());
+    adapt(M, mesh->leaf_node_shared_ptr());
+    adapt(ec, mesh->leaf_node_shared_ptr(), false);
     datum->add("time_adapt_forms", timer.stop());
     end();
   }
diff --git a/dolfin/adaptivity/LocalAssembler.cpp b/dolfin/adaptivity/LocalAssembler.cpp
deleted file mode 100644
index 0e04793..0000000
--- a/dolfin/adaptivity/LocalAssembler.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright (C) 2011 Marie E. Rognes
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Anders Logg 2013
-//
-// First added:  2011-01-04
-// Last changed: 2013-01-10
-
-#include <dolfin/common/types.h>
-#include <Eigen/Dense>
-
-#include <dolfin/fem/UFC.h>
-#include <dolfin/mesh/Cell.h>
-#include <dolfin/mesh/Facet.h>
-#include "LocalAssembler.h"
-
-using namespace dolfin;
-
-//------------------------------------------------------------------------------
-void
-LocalAssembler::assemble(Eigen::MatrixXd& A,
-                         UFC& ufc,
-                         const std::vector<double>& vertex_coordinates,
-                         ufc::cell& ufc_cell,
-                         const Cell& cell,
-                         const MeshFunction<std::size_t>* cell_domains,
-                         const MeshFunction<std::size_t>* exterior_facet_domains,
-                         const MeshFunction<std::size_t>* interior_facet_domains)
-{
-  // Clear tensor
-  A.setZero();
-
-  cell.get_cell_data(ufc_cell);
-
-  // Assemble contributions from cell integral
-  assemble_cell(A, ufc, vertex_coordinates, ufc_cell, cell, cell_domains);
-
-  // Assemble contributions from facet integrals
-  for (FacetIterator facet(cell); !facet.end(); ++facet)
-  {
-    ufc_cell.local_facet = facet.pos();
-    if (facet->num_entities(cell.dim()) == 2)
-    {
-      assemble_interior_facet(A, ufc, vertex_coordinates, ufc_cell, cell,
-                              *facet, facet.pos(), interior_facet_domains);
-    }
-    else
-    {
-      assemble_exterior_facet(A, ufc, vertex_coordinates, ufc_cell, cell,
-                              *facet, facet.pos(), exterior_facet_domains);
-    }
-  }
-}
-//------------------------------------------------------------------------------
-void LocalAssembler::assemble_cell(Eigen::MatrixXd& A,
-                                   UFC& ufc,
-                                   const std::vector<double>& vertex_coordinates,
-                                   const ufc::cell& ufc_cell,
-                                   const Cell& cell,
-                                   const MeshFunction<std::size_t>* domains)
-{
-  // Skip if there are no cell integrals
-  if (!ufc.form.has_cell_integrals())
-    return;
-
-  // Extract default cell integral
-  ufc::cell_integral* integral = ufc.default_cell_integral.get();
-
-  // Get integral for sub domain (if any)
-  if (domains && !domains->empty())
-    integral = ufc.get_cell_integral((*domains)[cell]);
-
-  // Skip integral if zero
-  if (!integral)
-    return;
-
-  // Update to current cell
-  ufc.update(cell, vertex_coordinates, ufc_cell,
-             integral->enabled_coefficients());
-
-  // Tabulate cell tensor
-  integral->tabulate_tensor(ufc.A.data(),
-                            ufc.w(),
-                            vertex_coordinates.data(),
-                            ufc_cell.orientation);
-
-  // Stuff a_ufc.A into A
-  const std::size_t M = A.rows();
-  const std::size_t N = A.cols();
-  for (std::size_t i = 0; i < M; i++)
-    for (std::size_t j = 0; j < N; j++)
-      A(i, j) += ufc.A[N*i + j];
-}
-//------------------------------------------------------------------------------
-void LocalAssembler::assemble_exterior_facet(Eigen::MatrixXd& A,
-                                  UFC& ufc,
-                                  const std::vector<double>& vertex_coordinates,
-                                  const ufc::cell& ufc_cell,
-                                  const Cell& cell,
-                                  const Facet& facet,
-                                  const std::size_t local_facet,
-                                  const MeshFunction<std::size_t>* domains)
-{
-  // Skip if there are no exterior facet integrals
-  if (!ufc.form.has_exterior_facet_integrals())
-    return;
-
-  // Extract default exterior facet integral
-  ufc::exterior_facet_integral* integral
-    = ufc.default_exterior_facet_integral.get();
-
-  // Get integral for sub domain (if any)
-  if (domains && !domains->empty())
-    integral = ufc.get_exterior_facet_integral((*domains)[facet]);
-
-  // Skip integral if zero
-  if (!integral)
-    return;
-
-  // Update to current cell
-  ufc.update(cell, vertex_coordinates, ufc_cell,
-             integral->enabled_coefficients());
-
-  // Tabulate exterior facet tensor
-  integral->tabulate_tensor(ufc.A.data(),
-                            ufc.w(),
-                            vertex_coordinates.data(),
-                            local_facet,
-                            ufc_cell.orientation);
-
-  // Stuff a_ufc.A into A
-  const std::size_t M = A.rows();
-  const std::size_t N = A.cols();
-  for (std::size_t i = 0; i < M; i++)
-    for (std::size_t j = 0; j < N; j++)
-      A(i, j) += ufc.A[N*i + j];
-}
-//------------------------------------------------------------------------------
-void LocalAssembler::assemble_interior_facet(Eigen::MatrixXd& A,
-                                  UFC& ufc,
-                                  const std::vector<double>& vertex_coordinates,
-                                  const ufc::cell& ufc_cell,
-                                  const Cell& cell,
-                                  const Facet& facet,
-                                  const std::size_t local_facet,
-                                  const MeshFunction<std::size_t>* domains)
-{
-  // Skip if there are no interior facet integrals
-  if (!ufc.form.has_interior_facet_integrals())
-    return;
-
-  // Extract default interior facet integral
-  ufc::interior_facet_integral* integral
-    = ufc.default_interior_facet_integral.get();
-
-  // Get integral for sub domain (if any)
-  if (domains && !domains->empty())
-    integral = ufc.get_interior_facet_integral((*domains)[facet]);
-
-  // Skip integral if zero
-  if (!integral)
-    return;
-
-  // Update to current pair of cells and facets
-  ufc.update(cell, vertex_coordinates, ufc_cell,
-             cell, vertex_coordinates, ufc_cell,
-             integral->enabled_coefficients());
-
-  // Tabulate interior facet tensor on macro element
-  integral->tabulate_tensor(ufc.macro_A.data(), ufc.macro_w(),
-                            vertex_coordinates.data(),
-                            vertex_coordinates.data(),
-                            local_facet, local_facet,
-                            ufc_cell.orientation,
-                            ufc_cell.orientation);
-
-  // Stuff upper left quadrant (corresponding to this cell) into A
-  const std::size_t M = A.rows();
-  const std::size_t N = A.cols();
-  if (N == 1)
-  {
-    for (std::size_t i = 0; i < M; i++)
-      A(i, 0) = ufc.macro_A[i];
-  }
-  else
-  {
-    for (std::size_t i = 0; i < M; i++)
-      for (std::size_t j = 0; j < N; j++)
-        A(i, j) += ufc.macro_A[2*N*i + j];
-  }
-}
-//------------------------------------------------------------------------------
diff --git a/dolfin/adaptivity/LocalAssembler.h b/dolfin/adaptivity/LocalAssembler.h
deleted file mode 100644
index 1d72990..0000000
--- a/dolfin/adaptivity/LocalAssembler.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2011 Marie E. Rognes
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-01-04
-// Last changed: 2011-01-13
-
-#ifndef __LOCAL_ASSEMBLER_H
-#define __LOCAL_ASSEMBLER_H
-
-#include <vector>
-
-#include <dolfin/common/types.h>
-#include <Eigen/Dense>
-
-namespace ufc
-{
-  class cell;
-}
-
-namespace dolfin
-{
-
-  class Cell;
-  class Facet;
-  class UFC;
-  template<typename T> class MeshFunction;
-
-  ///
-  class LocalAssembler
-  {
-
-  public:
-
-    ///
-    static void
-      assemble(Eigen::MatrixXd& A,
-               UFC& ufc,
-               const std::vector<double>& vertex_coordinates,
-               ufc::cell& ufc_cell,
-               const Cell& cell,
-               const MeshFunction<std::size_t>* cell_domains,
-               const MeshFunction<std::size_t>* exterior_facet_domains,
-               const MeshFunction<std::size_t>* interior_facet_domains);
-
-    ///
-    static void assemble_cell(Eigen::MatrixXd& A,
-                              UFC& ufc,
-                              const std::vector<double>& vertex_coordinates,
-                              const ufc::cell& ufc_cell,
-                              const Cell& cell,
-                              const MeshFunction<std::size_t>* domains);
-
-    ///
-    static void
-      assemble_exterior_facet(Eigen::MatrixXd& A,
-                              UFC& ufc,
-                              const std::vector<double>& vertex_coordinates,
-                              const ufc::cell& ufc_cell,
-                              const Cell& cell,
-                              const Facet& facet,
-                              const std::size_t local_facet,
-                              const MeshFunction<std::size_t>* domains);
-
-    ///
-    static void
-      assemble_interior_facet(Eigen::MatrixXd& A,
-                              UFC& ufc,
-                              const std::vector<double>& vertex_coordinates,
-                              const ufc::cell& ufc_cell,
-                              const Cell& cell,
-                              const Facet& facet,
-                              const std::size_t local_facet,
-                              const MeshFunction<std::size_t>* domains);
-  };
-
-}
-
-#endif
diff --git a/dolfin/adaptivity/TimeSeries.cpp b/dolfin/adaptivity/TimeSeries.cpp
index 48d12d9..8dfccb3 100644
--- a/dolfin/adaptivity/TimeSeries.cpp
+++ b/dolfin/adaptivity/TimeSeries.cpp
@@ -54,7 +54,7 @@ void TimeSeries::store_object(MPI_Comm comm, const T& object, double t,
 
   // Get file handle for low level operations
   HDF5File hdf5_file(comm, series_name, mode);
-  const hid_t fid = hdf5_file.hdf5_file_id;
+  const hid_t fid = hdf5_file._hdf5_file_id;
 
   // Find existing datasets (should be equal to number of times)
   std::size_t nobjs = 0;
@@ -214,7 +214,8 @@ void TimeSeries::retrieve(GenericVector& vector, double t,
 
     // Read vectors
     GenericVector& x0(vector);
-    std::shared_ptr<GenericVector> x1 = x0.factory().create_vector();
+    std::shared_ptr<GenericVector> x1
+      = x0.factory().create_vector(x0.mpi_comm());
     hdf5_file.read(x0, "/Vector/" + std::to_string(i0), false);
     hdf5_file.read(*x1, "/Vector/" + std::to_string(i1), false);
 
diff --git a/dolfin/adaptivity/TimeSeries.h b/dolfin/adaptivity/TimeSeries.h
index 3b9ebf2..59fa345 100644
--- a/dolfin/adaptivity/TimeSeries.h
+++ b/dolfin/adaptivity/TimeSeries.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2012 Anders Logg
+// Copyright (C) 2009-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -54,6 +54,16 @@ namespace dolfin
     ///         An MPI communicator
     ///     name (std::string)
     ///         The time series name
+    TimeSeries(std::string name)
+      : TimeSeries(MPI_COMM_WORLD, name) {}
+
+    /// Create empty time series
+    ///
+    /// *Arguments*
+    ///     mpi_comm (MPI_Comm)
+    ///         An MPI communicator
+    ///     name (std::string)
+    ///         The time series name
     TimeSeries(MPI_Comm mpi_comm, std::string name);
 
     /// Destructor
diff --git a/dolfin/adaptivity/adapt.cpp b/dolfin/adaptivity/adapt.cpp
index 79f8fd2..d7f8a6f 100644
--- a/dolfin/adaptivity/adapt.cpp
+++ b/dolfin/adaptivity/adapt.cpp
@@ -28,7 +28,6 @@
 #include <dolfin/fem/LinearVariationalProblem.h>
 #include <dolfin/fem/NonlinearVariationalProblem.h>
 #include <dolfin/function/FunctionSpace.h>
-#include <dolfin/function/SubSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/Function.h>
 #include <dolfin/function/SpecialFacetFunction.h>
@@ -36,8 +35,7 @@
 #include <dolfin/mesh/MeshFunction.h>
 #include <dolfin/mesh/Facet.h>
 #include <dolfin/mesh/Cell.h>
-#include <dolfin/refinement/LocalMeshRefinement.h>
-#include <dolfin/refinement/UniformMeshRefinement.h>
+#include <dolfin/refinement/refine.h>
 #include "ErrorControl.h"
 #include "adapt.h"
 
@@ -55,18 +53,18 @@ void set_parent_child(const T& parent, std::shared_ptr<T> child)
   child->set_parent(reference_to_no_delete_pointer(_parent));
 }
 //-----------------------------------------------------------------------------
-const Mesh& dolfin::adapt(const Mesh& mesh)
+std::shared_ptr<Mesh> dolfin::adapt(const Mesh& mesh)
 {
   // Skip refinement if already refined
   if (mesh.has_child())
   {
     dolfin_debug("Mesh has already been refined, returning child mesh.");
-    return mesh.child();
+    return const_cast<Mesh&>(mesh).child_shared_ptr();
   }
 
   // Refine uniformly
   std::shared_ptr<Mesh> adapted_mesh(new Mesh());
-  UniformMeshRefinement::refine(*adapted_mesh, mesh);
+  refine(*adapted_mesh, mesh);
 
   // Initialize the entities initialized in mesh in adapted_mesh
   for (std::size_t d = 0; d <= mesh.topology().dim(); ++d)
@@ -76,22 +74,22 @@ const Mesh& dolfin::adapt(const Mesh& mesh)
   // Set parent / child
   set_parent_child(mesh, adapted_mesh);
 
-  return *adapted_mesh;
+  return adapted_mesh;
 }
 //-----------------------------------------------------------------------------
-const dolfin::Mesh& dolfin::adapt(const Mesh& mesh,
-                                  const MeshFunction<bool>& cell_markers)
+std::shared_ptr<Mesh> dolfin::adapt(const Mesh& mesh,
+                                    const MeshFunction<bool>& cell_markers)
 {
   // Skip refinement if already refined
   if (mesh.has_child())
   {
     dolfin_debug("Mesh has already been refined, returning child mesh.");
-    return mesh.child();
+    return const_cast<Mesh&>(mesh).child_shared_ptr();
   }
 
   // Call refinement algorithm
   std::shared_ptr<Mesh> adapted_mesh(new Mesh());
-  LocalMeshRefinement::refine(*adapted_mesh, mesh, cell_markers);
+  refine(*adapted_mesh, mesh, cell_markers);
 
   // Initialize the entities initialized in mesh in adapted_mesh
   for (std::size_t d = 0; d <= mesh.topology().dim(); ++d)
@@ -101,10 +99,10 @@ const dolfin::Mesh& dolfin::adapt(const Mesh& mesh,
   // Set parent / child
   set_parent_child(mesh, adapted_mesh);
 
-  return *adapted_mesh;
+  return adapted_mesh;
 }
 //-----------------------------------------------------------------------------
-const dolfin::FunctionSpace& dolfin::adapt(const FunctionSpace& space)
+std::shared_ptr<FunctionSpace> dolfin::adapt(const FunctionSpace& space)
 {
   dolfin_assert(space.mesh());
 
@@ -114,11 +112,12 @@ const dolfin::FunctionSpace& dolfin::adapt(const FunctionSpace& space)
   // Refine space
   adapt(space, space.mesh()->child_shared_ptr());
 
-  return space.child();
+  return const_cast<FunctionSpace*>(&space)->child_shared_ptr();
 }
 //-----------------------------------------------------------------------------
-const dolfin::FunctionSpace& dolfin::adapt(const FunctionSpace& space,
-                                           const MeshFunction<bool>& cell_markers)
+std::shared_ptr<FunctionSpace>
+  dolfin::adapt(const FunctionSpace& space,
+                const MeshFunction<bool>& cell_markers)
 {
   dolfin_assert(space.mesh());
 
@@ -128,11 +127,12 @@ const dolfin::FunctionSpace& dolfin::adapt(const FunctionSpace& space,
   // Refine space
   adapt(space, space.mesh()->child_shared_ptr());
 
-  return space.child();
+  return const_cast<FunctionSpace*>(&space)->child_shared_ptr();
 }
 //-----------------------------------------------------------------------------
-const dolfin::FunctionSpace& dolfin::adapt(const FunctionSpace& space,
-                                           std::shared_ptr<const Mesh> adapted_mesh)
+std::shared_ptr<FunctionSpace>
+  dolfin::adapt(const FunctionSpace& space,
+                std::shared_ptr<const Mesh> adapted_mesh)
 {
 
   // Skip refinement if already refined and child's mesh is the same
@@ -141,7 +141,7 @@ const dolfin::FunctionSpace& dolfin::adapt(const FunctionSpace& space,
       && adapted_mesh.get() == space.child().mesh().get())
   {
     dolfin_debug("Function space has already been refined, returning child space.");
-    return space.child();
+    return const_cast<FunctionSpace&>(space).child_shared_ptr();
   }
 
   // Create DOLFIN finite element and dofmap
@@ -159,12 +159,13 @@ const dolfin::FunctionSpace& dolfin::adapt(const FunctionSpace& space,
   // Set parent / child
   set_parent_child(space, refined_space);
 
-  return *refined_space;
+  return refined_space;
 }
 //-----------------------------------------------------------------------------
-const dolfin::Function& dolfin::adapt(const Function& function,
-                                      std::shared_ptr<const Mesh> adapted_mesh,
-                                      bool interpolate)
+std::shared_ptr<Function>
+  dolfin::adapt(const Function& function,
+                std::shared_ptr<const Mesh> adapted_mesh,
+                bool interpolate)
 {
   // Skip refinement if already refined and if child's mesh matches
   // requested mesh
@@ -172,7 +173,7 @@ const dolfin::Function& dolfin::adapt(const Function& function,
       && adapted_mesh.get() == function.child().function_space()->mesh().get())
   {
     dolfin_debug("Function has already been refined, returning child function.");
-    return function.child();
+    return const_cast<Function&>(function).child_shared_ptr();
   }
 
   // Refine function space
@@ -191,29 +192,31 @@ const dolfin::Function& dolfin::adapt(const Function& function,
   // Set parent / child
   set_parent_child(function, refined_function);
 
-  return *refined_function;
+  return refined_function;
 }
 //-----------------------------------------------------------------------------
-const dolfin::GenericFunction& dolfin::adapt(const GenericFunction& function,
-                                             std::shared_ptr<const Mesh> adapted_mesh)
+std::shared_ptr<GenericFunction>
+  dolfin::adapt(std::shared_ptr<const GenericFunction> function,
+                std::shared_ptr<const Mesh> adapted_mesh)
 {
   // Try casting to a function
-  const Function* f = dynamic_cast<const Function*>(&function);
+  const Function* f = dynamic_cast<const Function*>(function.get());
   if (f)
     return adapt(*f, adapted_mesh);
   else
-    return function;
+    return std::const_pointer_cast<GenericFunction>(function);
 }
 //-----------------------------------------------------------------------------
-const dolfin::Form& dolfin::adapt(const Form& form,
-                                  std::shared_ptr<const Mesh> adapted_mesh,
-                                  bool adapt_coefficients)
+std::shared_ptr<Form>
+  dolfin::adapt(const Form& form,
+                std::shared_ptr<const Mesh> adapted_mesh,
+                bool adapt_coefficients)
 {
   // Skip refinement if already refined
   if (form.has_child())
   {
     dolfin_debug("Form has already been refined, returning child form.");
-    return form.child();
+    return const_cast<Form&>(form).child_shared_ptr();
   }
 
   // Get data
@@ -232,6 +235,10 @@ const dolfin::Form& dolfin::adapt(const Form& form,
     refined_spaces.push_back(space.child_shared_ptr());
   }
 
+  // Create new form (constructor used from Python interface)
+  std::shared_ptr<Form> refined_form(new Form(ufc_form,
+                                              refined_spaces));
+
   // Refine coefficients:
   std::vector<std::shared_ptr<const GenericFunction>> refined_coefficients;
   for (std::size_t i = 0; i < coefficients.size(); i++)
@@ -243,17 +250,12 @@ const dolfin::Form& dolfin::adapt(const Form& form,
     if (function)
     {
       adapt(*function, adapted_mesh, adapt_coefficients);
-      refined_coefficients.push_back(function->child_shared_ptr());
+      refined_form->set_coefficient(i, function->child_shared_ptr());
     }
     else
-      refined_coefficients.push_back(coefficients[i]);
+      refined_form->set_coefficient(i, coefficients[i]);
   }
 
-  // Create new form (constructor used from Python interface)
-  std::shared_ptr<Form> refined_form(new Form(ufc_form,
-                                              refined_spaces,
-                                              refined_coefficients));
-
   // Attach mesh
   refined_form->set_mesh(adapted_mesh);
 
@@ -282,18 +284,18 @@ const dolfin::Form& dolfin::adapt(const Form& form,
   // Set parent / child
   set_parent_child(form, refined_form);
 
-  return *refined_form;
+  return refined_form;
 }
 //-----------------------------------------------------------------------------
-const dolfin::LinearVariationalProblem&
-dolfin::adapt(const LinearVariationalProblem& problem,
-              std::shared_ptr<const Mesh> adapted_mesh)
+std::shared_ptr<LinearVariationalProblem>
+  dolfin::adapt(const LinearVariationalProblem& problem,
+                std::shared_ptr<const Mesh> adapted_mesh)
 {
   // Skip refinement if already refined
   if (problem.has_child())
   {
     dolfin_debug("Linear variational problem has already been refined, returning child problem.");
-    return problem.child();
+    return const_cast<LinearVariationalProblem&>(problem).child_shared_ptr();
   }
 
   // Get data
@@ -314,7 +316,7 @@ dolfin::adapt(const LinearVariationalProblem& problem,
   dolfin_assert(u);
   adapt(*u, adapted_mesh);
   std::shared_ptr<Function> refined_u
-    = reference_to_no_delete_pointer(const_cast<Function&>(u->child()));
+    = std::const_pointer_cast<Function>(u)->child_shared_ptr();
 
   // Refine bcs
   std::shared_ptr<const FunctionSpace> V(problem.trial_space());
@@ -348,18 +350,18 @@ dolfin::adapt(const LinearVariationalProblem& problem,
   // Set parent / child
   set_parent_child(problem, refined_problem);
 
-  return *refined_problem;
+  return refined_problem;
 }
 //-----------------------------------------------------------------------------
-const dolfin::NonlinearVariationalProblem&
-dolfin::adapt(const NonlinearVariationalProblem& problem,
-              std::shared_ptr<const Mesh> adapted_mesh)
+std::shared_ptr<NonlinearVariationalProblem>
+  dolfin::adapt(const NonlinearVariationalProblem& problem,
+                std::shared_ptr<const Mesh> adapted_mesh)
 {
   // Skip refinement if already refined
   if (problem.has_child())
   {
     dolfin_debug("Nonlinear variational problem has already been refined, returning child problem.");
-    return problem.child();
+    return const_cast<NonlinearVariationalProblem&>(problem).child_shared_ptr();
   }
 
   // Get data
@@ -379,8 +381,8 @@ dolfin::adapt(const NonlinearVariationalProblem& problem,
   // Refine solution variable
   dolfin_assert(u);
   adapt(*u, adapted_mesh);
-  std::shared_ptr<Function> refined_u =
-    reference_to_no_delete_pointer(const_cast<Function&>(u->child()));
+  std::shared_ptr<Function> refined_u
+    = std::const_pointer_cast<Function>(u)->child_shared_ptr();
 
   // Refine bcs
   std::shared_ptr<const FunctionSpace> V(problem.trial_space());
@@ -414,12 +416,13 @@ dolfin::adapt(const NonlinearVariationalProblem& problem,
   // Set parent / child
   set_parent_child(problem, refined_problem);
 
-  return *refined_problem;
+  return refined_problem;
 }
 //-----------------------------------------------------------------------------
-const dolfin::DirichletBC& dolfin::adapt(const DirichletBC& bc,
-                                    std::shared_ptr<const Mesh> adapted_mesh,
-                                    const FunctionSpace& S)
+std::shared_ptr<DirichletBC>
+  dolfin::adapt(const DirichletBC& bc,
+                std::shared_ptr<const Mesh> adapted_mesh,
+                const FunctionSpace& S)
 {
   dolfin_assert(adapted_mesh);
 
@@ -429,7 +432,7 @@ const dolfin::DirichletBC& dolfin::adapt(const DirichletBC& bc,
       && adapted_mesh.get() == bc.child().function_space()->mesh().get())
   {
     dolfin_debug("DirichletBC has already been refined, returning child.");
-    return bc.child();
+    return const_cast<DirichletBC&>(bc).child_shared_ptr();
   }
 
   std::shared_ptr<const FunctionSpace> W = bc.function_space();
@@ -446,13 +449,11 @@ const dolfin::DirichletBC& dolfin::adapt(const DirichletBC& bc,
   else
   {
     adapt(S, adapted_mesh);
-    V.reset(new SubSpace(S.child(), component));
+    V = S.child().sub(component);
   }
 
   // Get refined value
-  const GenericFunction& g = adapt(*(bc.value()), adapted_mesh);
-  std::shared_ptr<const GenericFunction>
-    g_ptr(reference_to_no_delete_pointer(g));
+  std::shared_ptr<const GenericFunction> g = adapt(bc.value(), adapted_mesh);
 
   // Extract user_sub_domain
   std::shared_ptr<const SubDomain> user_sub_domain = bc.user_sub_domain();
@@ -462,7 +463,7 @@ const dolfin::DirichletBC& dolfin::adapt(const DirichletBC& bc,
   if (user_sub_domain)
   {
     // Use user defined sub domain if defined
-    refined_bc.reset(new DirichletBC(V, g_ptr, user_sub_domain, bc.method()));
+    refined_bc.reset(new DirichletBC(V, g, user_sub_domain, bc.method()));
   }
   else
   {
@@ -474,19 +475,19 @@ const dolfin::DirichletBC& dolfin::adapt(const DirichletBC& bc,
     std::vector<std::size_t> refined_markers;
     adapt_markers(refined_markers, *adapted_mesh, markers, *W->mesh());
 
-    refined_bc.reset(new DirichletBC(V, g_ptr, refined_markers, bc.method()));
+    refined_bc.reset(new DirichletBC(V, g, refined_markers, bc.method()));
   }
 
   // Set parent / child
   set_parent_child(bc, refined_bc);
 
-  return *refined_bc;
+  return refined_bc;
 }
 //-----------------------------------------------------------------------------
-const dolfin::ErrorControl&
-dolfin::adapt(const ErrorControl& ec,
-              std::shared_ptr<const Mesh> adapted_mesh,
-              bool adapt_coefficients)
+std::shared_ptr<ErrorControl>
+  dolfin::adapt(const ErrorControl& ec,
+                std::shared_ptr<const Mesh> adapted_mesh,
+                bool adapt_coefficients)
 {
   dolfin_assert(adapted_mesh);
 
@@ -494,7 +495,7 @@ dolfin::adapt(const ErrorControl& ec,
   if (ec.has_child())
   {
     dolfin_debug("ErrorControl has already been refined, returning child problem.");
-    return ec.child();
+    return const_cast<ErrorControl&>(ec).child_shared_ptr();
   }
 
   // Refine data
@@ -522,10 +523,10 @@ dolfin::adapt(const ErrorControl& ec,
   // Set parent / child
   set_parent_child(ec, refined_ec);
 
-  return *refined_ec;
+  return refined_ec;
 }
 //-----------------------------------------------------------------------------
-const dolfin::MeshFunction<std::size_t>&
+std::shared_ptr<MeshFunction<std::size_t>>
   dolfin::adapt(const MeshFunction<std::size_t>& mesh_function,
                 std::shared_ptr<const Mesh> adapted_mesh)
 {
@@ -533,7 +534,7 @@ const dolfin::MeshFunction<std::size_t>&
   if (mesh_function.has_child())
   {
     dolfin_debug("MeshFunction has already been refined, returning child");
-    return mesh_function.child();
+    return const_cast<MeshFunction<std::size_t>&>(mesh_function).child_shared_ptr();
   }
 
   dolfin_assert(mesh_function.mesh());
@@ -568,7 +569,7 @@ const dolfin::MeshFunction<std::size_t>&
 
   // Map values of mesh function into refined mesh function
   std::shared_ptr<MeshFunction<std::size_t>>
-    adapted_mesh_function(new MeshFunction<std::size_t>(*adapted_mesh,
+    adapted_mesh_function(new MeshFunction<std::size_t>(adapted_mesh,
                                                         mesh_function.dim()));
   for (std::size_t i = 0; i < adapted_mesh_function->size(); i++)
   {
@@ -583,7 +584,7 @@ const dolfin::MeshFunction<std::size_t>&
   set_parent_child(mesh_function, adapted_mesh_function);
 
   // Return refined mesh function
-  return *adapted_mesh_function;
+  return adapted_mesh_function;
 }
 //-----------------------------------------------------------------------------
 void dolfin::adapt_markers(std::vector<std::size_t>& refined_markers,
diff --git a/dolfin/adaptivity/adapt.h b/dolfin/adaptivity/adapt.h
index ed07e02..2c37660 100644
--- a/dolfin/adaptivity/adapt.h
+++ b/dolfin/adaptivity/adapt.h
@@ -44,23 +44,24 @@ namespace dolfin
   //--- Refinement of meshes ---
 
   /// Refine mesh uniformly
-  const Mesh& adapt(const Mesh& mesh);
+  std::shared_ptr<Mesh> adapt(const Mesh& mesh);
 
   /// Refine mesh based on cell markers
-  const Mesh& adapt(const Mesh& mesh, const MeshFunction<bool>& cell_markers);
+  std::shared_ptr<Mesh> adapt(const Mesh& mesh,
+                              const MeshFunction<bool>& cell_markers);
 
   //--- Refinement of function spaces ---
 
   /// Refine function space uniformly
-  const FunctionSpace& adapt(const FunctionSpace& space);
+  std::shared_ptr<FunctionSpace> adapt(const FunctionSpace& space);
 
   /// Refine function space based on cell markers
-  const FunctionSpace& adapt(const FunctionSpace& space,
-                             const MeshFunction<bool>& cell_markers);
+  std::shared_ptr<FunctionSpace> adapt(const FunctionSpace& space,
+                                       const MeshFunction<bool>& cell_markers);
 
   /// Refine function space based on refined mesh
-  const FunctionSpace& adapt(const FunctionSpace& space,
-                             std::shared_ptr<const Mesh> adapted_mesh);
+  std::shared_ptr<FunctionSpace> adapt(const FunctionSpace& space,
+                                       std::shared_ptr<const Mesh> adapted_mesh);
 
   //--- Refinement of functions ---
 
@@ -79,24 +80,26 @@ namespace dolfin
   /// *Returns*
   ///     _Function__
   ///         The adapted function
-  const Function& adapt(const Function& function,
-                        std::shared_ptr<const Mesh> adapted_mesh,
-                        bool interpolate=true);
+  std::shared_ptr<Function> adapt(const Function& function,
+                                  std::shared_ptr<const Mesh> adapted_mesh,
+                                  bool interpolate=true);
 
   /// Refine GenericFunction based on refined mesh
-  const GenericFunction& adapt(const GenericFunction& function,
-                               std::shared_ptr<const Mesh> adapted_mesh);
+  std::shared_ptr<GenericFunction>
+    adapt(std::shared_ptr<const GenericFunction> function,
+          std::shared_ptr<const Mesh> adapted_mesh);
 
   /// Refine mesh function<std::size_t> based on mesh
-  const MeshFunction<std::size_t>& adapt(const MeshFunction<std::size_t>& mesh_function,
-                                  std::shared_ptr<const Mesh> adapted_mesh);
+  std::shared_ptr<MeshFunction<std::size_t>>
+    adapt(const MeshFunction<std::size_t>& mesh_function,
+          std::shared_ptr<const Mesh> adapted_mesh);
 
   //--- Refinement of boundary conditions ---
 
   /// Refine Dirichlet bc based on refined mesh
-  const DirichletBC& adapt(const DirichletBC& bc,
-                           std::shared_ptr<const Mesh> adapted_mesh,
-                           const FunctionSpace& S);
+  std::shared_ptr<DirichletBC> adapt(const DirichletBC& bc,
+                                     std::shared_ptr<const Mesh> adapted_mesh,
+                                     const FunctionSpace& S);
 
   /// Helper function for refinement of boundary conditions
   void adapt_markers(std::vector<std::size_t>& refined_markers,
@@ -121,19 +124,21 @@ namespace dolfin
   /// *Returns*
   ///     _Form__
   ///         The adapted form
-  const Form& adapt(const Form& form,
-                    std::shared_ptr<const Mesh> adapted_mesh,
-                    bool adapt_coefficients=true);
+  std::shared_ptr<Form> adapt(const Form& form,
+                              std::shared_ptr<const Mesh> adapted_mesh,
+                              bool adapt_coefficients=true);
 
   //--- Refinement of variational problems ---
 
   /// Refine linear variational problem based on mesh
-  const LinearVariationalProblem& adapt(const LinearVariationalProblem& problem,
-                                        std::shared_ptr<const Mesh> adapted_mesh);
+  std::shared_ptr<LinearVariationalProblem>
+    adapt(const LinearVariationalProblem& problem,
+          std::shared_ptr<const Mesh> adapted_mesh);
 
   /// Refine nonlinear variational problem based on mesh
-  const NonlinearVariationalProblem& adapt(const NonlinearVariationalProblem& problem,
-                                           std::shared_ptr<const Mesh> adapted_mesh);
+  std::shared_ptr<NonlinearVariationalProblem>
+    adapt(const NonlinearVariationalProblem& problem,
+          std::shared_ptr<const Mesh> adapted_mesh);
 
   /// Adapt error control object based on adapted mesh
   ///
@@ -150,9 +155,9 @@ namespace dolfin
   /// *Returns*
   ///     _ErrorControl__
   ///         The adapted error control object
-  const ErrorControl& adapt(const ErrorControl& ec,
-                            std::shared_ptr<const Mesh> adapted_mesh,
-                            bool adapt_coefficients=true);
+  std::shared_ptr<ErrorControl> adapt(const ErrorControl& ec,
+                                      std::shared_ptr<const Mesh> adapted_mesh,
+                                      bool adapt_coefficients=true);
 
 
 }
diff --git a/dolfin/adaptivity/adaptivesolve.cpp b/dolfin/adaptivity/adaptivesolve.cpp
index 56d7a49..f745331 100644
--- a/dolfin/adaptivity/adaptivesolve.cpp
+++ b/dolfin/adaptivity/adaptivesolve.cpp
@@ -26,39 +26,39 @@
 
 #include "AdaptiveLinearVariationalSolver.h"
 #include "AdaptiveNonlinearVariationalSolver.h"
+#include "GoalFunctional.h"
 #include "adaptivesolve.h"
 
 //-----------------------------------------------------------------------------
 void dolfin::solve(const Equation& equation, Function& u, const double tol,
                    GoalFunctional& M)
 {
-  // Create empty list of boundary conditions
-  std::vector<const DirichletBC*> bcs;
-
   // Call common adaptive solve function
-  solve(equation, u, bcs, tol, M);
+  solve(equation, u, std::vector<const DirichletBC*>(), tol, M);
 }
 //-----------------------------------------------------------------------------
 void dolfin::solve(const Equation& equation, Function& u,
                    const DirichletBC& bc, const double tol, GoalFunctional& M)
 {
-  // Create list containing single boundary condition
-  std::vector<const DirichletBC*> bcs ={&bc};
-
   // Call common adaptive solve function
-  solve(equation, u, bcs, tol, M);
+  solve(equation, u, {&bc}, tol, M);
 }
 //-----------------------------------------------------------------------------
 void dolfin::solve(const Equation& equation, Function& u,
                    std::vector<const DirichletBC*> bcs,
                    const double tol, GoalFunctional& M)
-
 {
   // Solve linear problem
   if (equation.is_linear())
   {
-    LinearVariationalProblem problem(*equation.lhs(), *equation.rhs(), u, bcs);
-    AdaptiveLinearVariationalSolver solver(problem, M);
+    std::vector<std::shared_ptr<const DirichletBC>> _bcs;
+    for (auto bc : bcs)
+      _bcs.push_back(reference_to_no_delete_pointer(*bc));
+
+    auto problem = std::make_shared<LinearVariationalProblem>(
+      equation.lhs(), equation.rhs(), reference_to_no_delete_pointer(u), _bcs);
+    AdaptiveLinearVariationalSolver
+      solver(problem, std::shared_ptr<GoalFunctional>(&M, [](GoalFunctional*){}));
     solver.solve(tol);
   }
   else
@@ -70,9 +70,7 @@ void dolfin::solve(const Equation& equation, Function& u,
   }
 }
 //-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-void dolfin::solve(const Equation& equation, Function& u,  const Form& J,
+void dolfin::solve(const Equation& equation, Function& u, const Form& J,
                    const double tol, GoalFunctional& M)
 {
   // Create empty list of boundary conditions
@@ -86,32 +84,36 @@ void dolfin::solve(const Equation& equation, Function& u,
                    const DirichletBC& bc, const Form& J, const double tol,
                    GoalFunctional& M)
 {
-  // Create list containing single boundary condition
-  std::vector<const DirichletBC*> bcs = {&bc};
-
   // Call common adaptive solve function with Jacobian
-  solve(equation, u, bcs, J, tol, M);
+  solve(equation, u, {&bc}, J, tol, M);
 }
 //-----------------------------------------------------------------------------
-void dolfin::solve(const Equation& equation,
-                   Function& u,
-                   std::vector<const DirichletBC*> bcs,
-                   const Form& J,
-                   const double tol,
-                   GoalFunctional& M)
+void dolfin::solve(const Equation& equation, Function& u,
+                   std::vector<const DirichletBC*> bcs, const Form& J,
+                   const double tol, GoalFunctional& M)
 
 {
   // Raise error if problem is linear
   if (equation.is_linear())
+  {
     dolfin_error("solve.cpp",
                  "solve nonlinear variational problem adaptively",
                  "Variational problem is linear");
+  }
+
+  // Pack bcs
+  std::vector<std::shared_ptr<const DirichletBC>> _bcs;
+  for (auto bc : bcs)
+    _bcs.push_back(reference_to_no_delete_pointer(*bc));
 
   // Define nonlinear problem
-  NonlinearVariationalProblem problem(*equation.lhs(), u, bcs, J);
+  auto problem = std::make_shared<NonlinearVariationalProblem>(
+    equation.lhs(), reference_to_no_delete_pointer(u), _bcs,
+    reference_to_no_delete_pointer(J));
 
   // Solve nonlinear problem adaptively
-  AdaptiveNonlinearVariationalSolver solver(problem, M);
+  AdaptiveNonlinearVariationalSolver
+    solver(problem, std::shared_ptr<GoalFunctional>(&M, [](GoalFunctional*){}));
   solver.solve(tol);
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/adaptivity/dolfin_adaptivity.h b/dolfin/adaptivity/dolfin_adaptivity.h
index d338f97..7a5331d 100644
--- a/dolfin/adaptivity/dolfin_adaptivity.h
+++ b/dolfin/adaptivity/dolfin_adaptivity.h
@@ -9,7 +9,6 @@
 #include <dolfin/adaptivity/GoalFunctional.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/Extrapolation.h>
-#include <dolfin/adaptivity/LocalAssembler.h>
 #include <dolfin/adaptivity/TimeSeries.h>
 
 #include <dolfin/adaptivity/adapt.h>
diff --git a/dolfin/ale/ALE.cpp b/dolfin/ale/ALE.cpp
index 1a38c6b..6a94b14 100644
--- a/dolfin/ale/ALE.cpp
+++ b/dolfin/ale/ALE.cpp
@@ -24,36 +24,48 @@
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/mesh/BoundaryMesh.h>
 #include <dolfin/mesh/Vertex.h>
+#include <dolfin/fem/fem_utils.h>
+#include <dolfin/la/GenericVector.h>
+#include <dolfin/log/log.h>
 #include "HarmonicSmoothing.h"
 #include "ALE.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-std::shared_ptr<MeshDisplacement> ALE::move(Mesh& mesh,
-                                              const BoundaryMesh& new_boundary)
+std::shared_ptr<MeshDisplacement> ALE::move(std::shared_ptr<Mesh> mesh,
+                                            const BoundaryMesh& new_boundary)
 {
+  dolfin_assert(mesh);
   return HarmonicSmoothing::move(mesh, new_boundary);
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<MeshDisplacement> ALE::move(Mesh& mesh0, const Mesh& mesh1)
+std::shared_ptr<MeshDisplacement> ALE::move(std::shared_ptr<Mesh> mesh0,
+                                            const Mesh& mesh1)
 {
-  // FIXME: Maybe this works in parallel but there is no obvious way to
-  //        test it as SubMesh::init does not work in parallel
+  dolfin_assert(mesh0);
+  if (mesh0->geometry().degree() != 1 || mesh1.geometry().degree() != 1)
+  {
+    dolfin_error("ALE.cpp",
+                 "move mesh",
+                 "This function does not support higher-order mesh geometry");
+  }
+
+  // FIXME: Maybe this works in parallel but there is no obvious way
+  //        to test it as SubMesh::init does not work in parallel
   not_working_in_parallel("Move coordinates of mesh0 according "
                           "to mesh1 with common global vertices");
 
-  // Topological dimension
-  //const std::size_t D = mesh1.topology().dim();
+  dolfin_assert(mesh0);
 
   // Extract boundary meshes
-  BoundaryMesh boundary0(mesh0, "exterior");
+  BoundaryMesh boundary0(*mesh0, "exterior");
   BoundaryMesh boundary1(mesh1, "exterior");
 
   // Get vertex mappings
-  dolfin_assert(mesh0.data().exists("parent_vertex_indices", 0));
+  dolfin_assert(mesh0->data().exists("parent_vertex_indices", 0));
   const std::vector<std::size_t>& local_to_global_0
-    = mesh0.data().array("parent_vertex_indices", 0);
+    = mesh0->data().array("parent_vertex_indices", 0);
 
   dolfin_assert(mesh1.data().exists("parent_vertex_indices", 0));
   const std::vector<std::size_t>& local_to_global_1
@@ -73,7 +85,6 @@ std::shared_ptr<MeshDisplacement> ALE::move(Mesh& mesh0, const Mesh& mesh1)
     mesh_to_boundary_0[boundary_to_mesh_0[i]] = i;
 
   // Iterate over vertices in boundary1
-  const std::size_t dim = mesh0.geometry().dim();
   for (VertexIterator v(boundary1); !v.end(); ++v)
   {
     // Get global vertex index (steps 1 and 2)
@@ -98,9 +109,8 @@ std::shared_ptr<MeshDisplacement> ALE::move(Mesh& mesh0, const Mesh& mesh1)
     const std::size_t boundary_index_0 = it->second;
 
     // Update vertex coordinate
-    double* x = boundary0.geometry().x(boundary_index_0);
-    for (std::size_t i = 0; i < dim; i++)
-      x[i] = v->x()[i];
+    MeshGeometry& geom = boundary0.geometry();
+    geom.set(boundary_index_0, v->x());
   }
 
   // Move mesh
@@ -109,6 +119,13 @@ std::shared_ptr<MeshDisplacement> ALE::move(Mesh& mesh0, const Mesh& mesh1)
 //-----------------------------------------------------------------------------
 void ALE::move(Mesh& mesh, const GenericFunction& displacement)
 {
+  if (mesh.geometry().degree() != 1)
+  {
+    dolfin_error("ALE.cpp",
+                 "move mesh",
+                 "This function does not support higher-order mesh geometry");
+  }
+
   // Check dimensions
   const std::size_t gdim = mesh.geometry().dim();
   if (!((displacement.value_rank() == 0 && gdim == 1) ||
@@ -126,11 +143,21 @@ void ALE::move(Mesh& mesh, const GenericFunction& displacement)
   displacement.compute_vertex_values(vertex_values, mesh);
 
   // Move vertex coordinates
-  std::vector<double>& x = mesh.geometry().x();
-  for (std::size_t d = 0; d < gdim; d++)
+  MeshGeometry& geometry = mesh.geometry();
+  std::vector<double> x(gdim);
+  for (std::size_t i = 0; i < N; i++)
   {
-    for (std::size_t i = 0; i < N; i++)
-      x[i*gdim + d] += vertex_values[d*N + i];
+    for (std::size_t j = 0; j < gdim; j++)
+      x[j] = geometry.x(i, j) + vertex_values[j*N + i];
+    geometry.set(i, x.data());
   }
 }
 //-----------------------------------------------------------------------------
+void ALE::move(Mesh& mesh, const Function& displacement)
+{
+  Function position(displacement.function_space());
+  get_coordinates(position, mesh.geometry());
+  *position.vector() += *displacement.vector();
+  set_coordinates(mesh.geometry(), position);
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/ale/ALE.h b/dolfin/ale/ALE.h
index 1e9435e..df9ceeb 100644
--- a/dolfin/ale/ALE.h
+++ b/dolfin/ale/ALE.h
@@ -42,19 +42,61 @@ namespace dolfin
   {
   public:
 
+
     /// Move coordinates of mesh according to new boundary coordinates.
-    /// Returns displacement (encapsulated in Expression subclass MeshDisplacement)
-    static std::shared_ptr<MeshDisplacement> move(Mesh& mesh,
-                                            const BoundaryMesh& new_boundary);
+    /// Works only for affine meshes.
+    ///
+    /// *Arguments*
+    ///     mesh (_Mesh_)
+    ///         The affine mesh to move.
+    ///     boundary (_BoundaryMesh_)
+    ///         An affine mesh containing just the boundary cells.
+    ///
+    /// *Returns*
+    ///     MeshDisplacement
+    ///         Displacement encapsulated in Expression subclass
+    ///         MeshDisplacement.
+    static std::shared_ptr<MeshDisplacement>
+      move(std::shared_ptr<Mesh> mesh, const BoundaryMesh& new_boundary);
 
-    /// Move coordinates of mesh0 according to mesh1 with common global vertices.
-    /// Returns displacement (encapsulated in Expression subclass MeshDisplacement)
-    static std::shared_ptr<MeshDisplacement> move(Mesh& mesh0,
-                                                    const Mesh& mesh1);
+    /// Move coordinates of mesh according to adjacent mesh with
+    /// common global vertices. Works only for affine meshes.
+    //
+    /// *Arguments*
+    ///     mesh0 (_Mesh_)
+    ///         The affine mesh to move.
+    ///     mesh1 (_Mesh_)
+    ///         The affine mesh to be fit.
+    ///
+    /// *Returns*
+    ///     MeshDisplacement
+    ///         Displacement encapsulated in Expression subclass
+    static std::shared_ptr<MeshDisplacement> move(std::shared_ptr<Mesh> mesh0,
+                                                  const Mesh& mesh1);
 
-    /// Move coordinates of mesh according to displacement function
+    /// Move coordinates of mesh according to displacement function.
+    /// This works only for affine meshes.
+    ///
+    /// NOTE: This cannot be implemented for higher-order geometries
+    ///       as there is no way of constructing function space for
+    ///       position unless supplied as an argument.
+    ///
+    /// *Arguments*
+    ///     mesh (_Mesh_)
+    ///         The affine mesh to move.
+    ///     displacement (_GenericFunction_)
+    ///         A vectorial generic function.
     static void move(Mesh& mesh, const GenericFunction& displacement);
 
+    /// Move coordinates of mesh according to displacement function.
+    ///
+    /// *Arguments*
+    ///     mesh (_Mesh_)
+    ///         The mesh to move.
+    ///     displacement (_Function_)
+    ///         A vectorial Lagrange function of matching degree.
+    static void move(Mesh& mesh, const Function& displacement);
+
   };
 
 }
diff --git a/dolfin/ale/HarmonicSmoothing.cpp b/dolfin/ale/HarmonicSmoothing.cpp
index c3957be..463f18c 100644
--- a/dolfin/ale/HarmonicSmoothing.cpp
+++ b/dolfin/ale/HarmonicSmoothing.cpp
@@ -39,9 +39,18 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-std::shared_ptr<MeshDisplacement> HarmonicSmoothing::move(Mesh& mesh,
-                                            const BoundaryMesh& new_boundary)
+std::shared_ptr<MeshDisplacement>
+HarmonicSmoothing::move(std::shared_ptr<Mesh> mesh,
+                        const BoundaryMesh& new_boundary)
 {
+  dolfin_assert(mesh);
+  if (mesh->geometry().degree() != 1 || new_boundary.geometry().degree() != 1)
+  {
+    dolfin_error("HarmonicSmoothing.cpp",
+                 "move mesh using harmonic smoothing",
+                 "This function does not support higher-order mesh geometry");
+  }
+
   // Now this works regardless of reorder_dofs_serial value
   const bool reorder_dofs_serial = parameters["reorder_dofs_serial"];
   if (!reorder_dofs_serial)
@@ -50,8 +59,8 @@ std::shared_ptr<MeshDisplacement> HarmonicSmoothing::move(Mesh& mesh,
             "parameters[\"reorder_dofs_serial\"] = false");
   }
 
-  const std::size_t D = mesh.topology().dim();
-  const std::size_t d = mesh.geometry().dim();
+  const std::size_t D = mesh->topology().dim();
+  const std::size_t d = mesh->geometry().dim();
 
   // Choose form and function space
   std::shared_ptr<FunctionSpace> V;
@@ -81,7 +90,7 @@ std::shared_ptr<MeshDisplacement> HarmonicSmoothing::move(Mesh& mesh,
   assemble(*A, *form);
 
   // Number of mesh vertices (local)
-  const std::size_t num_vertices = mesh.num_vertices();
+  const std::size_t num_vertices = mesh->num_vertices();
 
   // Dof range
   const dolfin::la_index n0 = V->dofmap()->ownership_range().first;
@@ -150,7 +159,7 @@ std::shared_ptr<MeshDisplacement> HarmonicSmoothing::move(Mesh& mesh,
   // Prepare solver
   // NOTE: GMRES needs to be used until Eigen a4b7b6e or 8dcc4ed is widespread;
   //       afterwards CG can be used again
-  KrylovSolver solver("bicgstab", prec);
+  KrylovSolver solver(mesh->mpi_comm(), "bicgstab", prec);
   solver.parameters["nonzero_initial_guess"] = true;
   solver.set_operator(A);
 
@@ -167,7 +176,7 @@ std::shared_ptr<MeshDisplacement> HarmonicSmoothing::move(Mesh& mesh,
     for (std::size_t i = 0; i < num_boundary_dofs; i++)
     {
       boundary_values[i] = new_boundary.geometry().x(boundary_vertices[i], dim)
-        - mesh.geometry().x(vertex_map[boundary_vertices[i]], dim);
+        - mesh->geometry().x(vertex_map[boundary_vertices[i]], dim);
     }
     b.set(boundary_values.data(), num_boundary_dofs, boundary_dofs.data());
     b.apply("insert");
@@ -184,13 +193,13 @@ std::shared_ptr<MeshDisplacement> HarmonicSmoothing::move(Mesh& mesh,
   }
 
   // Modify mesh coordinates
-  MeshGeometry& geometry = mesh.geometry();
+  MeshGeometry& geometry = mesh->geometry();
   std::vector<double> coord(d);
   for (std::size_t i = 0; i < num_vertices; i++)
   {
     for (std::size_t dim = 0; dim < d; dim++)
       coord[dim] = displacement[dim*num_vertices + i] + geometry.x(i, dim);
-    geometry.set(i, coord);
+    geometry.set(i, coord.data());
   }
 
   // Return calculated displacement
diff --git a/dolfin/ale/HarmonicSmoothing.h b/dolfin/ale/HarmonicSmoothing.h
index 72365da..f548131 100644
--- a/dolfin/ale/HarmonicSmoothing.h
+++ b/dolfin/ale/HarmonicSmoothing.h
@@ -30,10 +30,11 @@ namespace dolfin
   class BoundaryMesh;
   class Mesh;
 
-  /// This class implements harmonic mesh smoothing. Poisson's equation
-  /// is solved with zero right-hand side (Laplace's equation) for each
-  /// coordinate direction to compute new coordinates for all vertices,
-  /// given new locations for the coordinates of the boundary.
+  /// This class implements harmonic mesh smoothing. Poisson's
+  /// equation is solved with zero right-hand side (Laplace's
+  /// equation) for each coordinate direction to compute new
+  /// coordinates for all vertices, given new locations for the
+  /// coordinates of the boundary.
 
   class HarmonicSmoothing
   {
@@ -41,8 +42,8 @@ namespace dolfin
 
     /// Move coordinates of mesh according to new boundary coordinates
     /// and return the displacement
-    static std::shared_ptr<MeshDisplacement> move(Mesh& mesh, 
-                                        const BoundaryMesh& new_boundary);
+    static std::shared_ptr<MeshDisplacement>
+      move(std::shared_ptr<Mesh> mesh, const BoundaryMesh& new_boundary);
 
   };
 
diff --git a/dolfin/ale/MeshDisplacement.cpp b/dolfin/ale/MeshDisplacement.cpp
index 07e4919..cca9ceb 100644
--- a/dolfin/ale/MeshDisplacement.cpp
+++ b/dolfin/ale/MeshDisplacement.cpp
@@ -28,10 +28,11 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-MeshDisplacement::MeshDisplacement(const Mesh& mesh)
-  : Expression(mesh.geometry().dim()), _dim(mesh.geometry().dim())
+MeshDisplacement::MeshDisplacement(std::shared_ptr<const Mesh> mesh)
+  : Expression(mesh->geometry().dim()), _dim(mesh->geometry().dim())
 {
-  const std::size_t D = mesh.topology().dim();
+  dolfin_assert(mesh);
+  const std::size_t D = mesh->topology().dim();
 
   // Choose form and function space
   std::shared_ptr<FunctionSpace> V;
@@ -53,12 +54,11 @@ MeshDisplacement::MeshDisplacement(const Mesh& mesh)
   }
 
   // Store displacement functions
-  _displacements = std::vector<Function> (_dim, Function(V));
+  _displacements = std::vector<Function>(_dim, Function(V));
 }
 //-----------------------------------------------------------------------------
 MeshDisplacement::MeshDisplacement(const MeshDisplacement& mesh_displacement)
-  : Expression(mesh_displacement._dim),
-    _dim(mesh_displacement._dim),
+  : Expression(mesh_displacement._dim), _dim(mesh_displacement._dim),
     _displacements(mesh_displacement._displacements)
 {
   // Do nothing
@@ -95,9 +95,10 @@ void MeshDisplacement::compute_vertex_values(std::vector<double>& vertex_values,
                                              const Mesh& mesh) const
 {
   // TODO: implement also computation on current mesh by
-  //       _displacements[i].vector()->get_local(block, num_vertices, all_dofs)
-  //       which would be merely moving code from HarmonicSmoothing.cpp here.
-  //       This would save some computation performed by compute_vertex_values()
+  //       _displacements[i].vector()->get_local(block, num_vertices,
+  //       all_dofs) which would be merely moving code from
+  //       HarmonicSmoothing.cpp here.  This would save some
+  //       computation performed by compute_vertex_values()
 
   vertex_values.clear();
 
diff --git a/dolfin/ale/MeshDisplacement.h b/dolfin/ale/MeshDisplacement.h
index 8055ad9..9b7eacb 100644
--- a/dolfin/ale/MeshDisplacement.h
+++ b/dolfin/ale/MeshDisplacement.h
@@ -21,6 +21,7 @@
 #ifndef __MESH_DISPLACEMENT_H
 #define __MESH_DISPLACEMENT_H
 
+#include <memory>
 #include <vector>
 #include <ufc.h>
 #include <dolfin/common/Array.h>
@@ -47,7 +48,7 @@ namespace dolfin
     /// *Arguments*
     ///     mesh (_Mesh_)
     ///         Mesh to be displacement defined on.
-    MeshDisplacement(const Mesh& mesh);
+    explicit MeshDisplacement(std::shared_ptr<const Mesh> mesh);
 
     /// Copy constructor
     ///
diff --git a/dolfin/ale/Poisson1D.h b/dolfin/ale/Poisson1D.h
index ff6c59c..e7593a4 100644
--- a/dolfin/ale/Poisson1D.h
+++ b/dolfin/ale/Poisson1D.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON1D_H
 #define __POISSON1D_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson1d_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson1d_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson1d_finite_element_0()
+  ~poisson1d_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('interval', 1)), 1, None)";
+    return "FiniteElement('Lagrange', interval, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::interval;
+    return ufc::shape::interval;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[1];
-    compute_jacobian_interval_1d(J, vertex_coordinates);
+    compute_jacobian_interval_1d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[1];
@@ -108,7 +121,7 @@ public:
     
     
     // Get coordinates and map to the reference (FIAT) element
-    double X = (2.0*x[0] - vertex_coordinates[0] - vertex_coordinates[1]) / J[0];
+    double X = (2.0*x[0] - coordinate_dofs[0] - coordinate_dofs[1]) / J[0];
     
     // Reset values
     *values = 0.0;
@@ -172,20 +185,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -194,26 +205,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 2; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -233,7 +242,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -245,7 +254,7 @@ public:
     
     // Compute Jacobian
     double J[1];
-    compute_jacobian_interval_1d(J, vertex_coordinates);
+    compute_jacobian_interval_1d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[1];
@@ -254,7 +263,7 @@ public:
     
     
     // Get coordinates and map to the reference (FIAT) element
-    double X = (2.0*x[0] - vertex_coordinates[0] - vertex_coordinates[1]) / J[0];
+    double X = (2.0*x[0] - coordinate_dofs[0] - coordinate_dofs[1]) / J[0];
     
     // Declare two dimensional array that holds combinations of derivatives and initialise
     unsigned int combinations[1][1];
@@ -525,28 +534,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -582,7 +589,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 2; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -590,22 +597,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -616,14 +621,14 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
+        y[0] = coordinate_dofs[0];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -633,550 +638,1396 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[1];
-    y[0] = vertex_coordinates[0];
+    y[0] = coordinate_dofs[0];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
     vertex_values[1] = dof_values[1];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson1d_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson1d_dofmap_0: public ufc::dofmap
+class poisson1d_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson1d_dofmap_0() : ufc::dofmap()
+  poisson1d_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson1d_dofmap_0()
+  ~poisson1d_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('interval', 1)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', interval, 1), dim=1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::interval;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
         return 1;
         break;
       }
-    case 1:
-      {
-        return 0;
-        break;
-      }
     }
     
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 0;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 1;
-        break;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 1)
-    {
-    throw std::runtime_error("d is larger than dimension (1)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 1)
-      {
-      throw std::runtime_error("i is larger than number of entities (1)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
+        return 1;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson1d_dofmap_0();
-  }
-
-};
-
-/// 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 poisson1d_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson1d_cell_integral_0_otherwise() : ufc::cell_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Destructor
-  virtual ~poisson1d_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    1
-    // Number of operations (multiply-add pairs) for tensor contraction: 0
-    // Total number of operations (multiply-add pairs):                  4
-    
     // Compute Jacobian
     double J[1];
-    compute_jacobian_interval_1d(J, vertex_coordinates);
+    compute_jacobian_interval_1d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[1];
     double detJ;
     compute_jacobian_inverse_interval_1d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*K[0]*K[0];
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (2.0*x[0] - coordinate_dofs[0] - coordinate_dofs[1]) / J[0];
     
-    // Compute element tensor
-    A[0] = G0_0_0;
-    A[1] = -G0_0_0;
-    A[2] = -G0_0_0;
-    A[3] = G0_0_0;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class poisson1d_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  poisson1d_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson1d_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "049dc8bd8f69b0bd4f3e40d618d8c72e86a367ba4583be707ac4f434c34a4f8b8cc708cfc85b7294300640b2f207e208e9b923cf420dc2f9987164a43b11c256";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 0;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
+    // Reset values
+    *values = 0.0;
     switch (i)
     {
     case 0:
       {
-        return new poisson1d_finite_element_0();
-        break;
-      }
-    case 1:
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
       {
-        return new poisson1d_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, -0.408248290463863};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 2; r++)
       {
-        return new poisson1d_dofmap_0();
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     case 1:
       {
-        return new poisson1d_dofmap_0();
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, 0.408248290463863};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     }
     
-    return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    return 0;
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
   {
-    return 0;
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 1;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[1];
+    compute_jacobian_interval_1d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[1];
+    double detJ;
+    compute_jacobian_inverse_interval_1d(K, detJ, J);
+    
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (2.0*x[0] - coordinate_dofs[0] - coordinate_dofs[1]) / J[0];
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[1][1];
+    for (unsigned int row = 0; row < 1; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 0)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[1][1] = {{K[0]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[1][1];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, -0.408248290463863};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[2][2] = \
+      {{0.0, 0.0},
+      {3.46410161513775, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[1];
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 2; t++)
+        {
+          for (unsigned int u = 0; u < 2; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              for (unsigned int tu = 0; tu < 2; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 2; s++)
+        {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[2] = {0.0, 0.0};
+      
+      // Declare helper variables
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = X;
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        basisvalues[r] *= std::sqrt((0.5 + r));
+      } // end loop over 'r'
+      
+      // Table(s) of coefficients
+      static const double coefficients0[2] = \
+      {0.707106781186547, 0.408248290463863};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[2][2] = \
+      {{0.0, 0.0},
+      {3.46410161513775, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[1];
+      for (unsigned int r = 0; r < 1; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[2][2] = \
+      {{1.0, 0.0},
+      {0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 2; t++)
+        {
+          for (unsigned int u = 0; u < 2; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            for (unsigned int u = 0; u < 2; u++)
+            {
+              for (unsigned int tu = 0; tu < 2; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 2; s++)
+        {
+          for (unsigned int t = 0; t < 2; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 1;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[1];
+    for (unsigned int r = 0; r < 1; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 2; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[1];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[1];
+    y[0] = coordinate_dofs[0];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 1;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson1d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson1d_finite_element_1();
+  }
+
+};
+
+
+class poisson1d_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson1d_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson1d_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', interval, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 0;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 1;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 1)
+    {
+    throw std::runtime_error("d is larger than dimension (1)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 1)
+      {
+      throw std::runtime_error("i is larger than number of entities (1)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson1d_dofmap_0();
+  }
+
+};
+
+
+class poisson1d_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson1d_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson1d_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', interval, 1), dim=1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 1;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 1;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 0;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 1;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 1)
+    {
+    throw std::runtime_error("d is larger than dimension (1)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 1)
+      {
+      throw std::runtime_error("i is larger than number of entities (1)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 1;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson1d_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson1d_dofmap_1();
+  }
+
+};
+
+
+class poisson1d_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson1d_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson1d_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    1
+    // Number of operations (multiply-add pairs) for tensor contraction: 0
+    // Total number of operations (multiply-add pairs):                  4
+    
+    // Compute Jacobian
+    double J[1];
+    compute_jacobian_interval_1d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[1];
+    double detJ;
+    compute_jacobian_inverse_interval_1d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*K[0]*K[0];
+    
+    // Compute element tensor
+    A[0] = G0_0_0;
+    A[1] = -G0_0_0;
+    A[2] = -G0_0_0;
+    A[3] = G0_0_0;
+  }
+
+};
+
+
+class poisson1d_form_0: public ufc::form
+{
+public:
+
+  poisson1d_form_0() : ufc::form()
+  {
+    // Do nothing
+  }
+
+  ~poisson1d_form_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "825d71b1dbe9f4b2b2034c524d971444868566dfe2b564717caf6e0c8ba8e6c22219fcffd7753906d2973f0948898f7f139a770142b0725596ec8594e85edfa6";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_coefficients() const final override
+  {
+    return 0;
+  }
+
+  std::size_t original_coefficient_position(std::size_t i) const final override
+  {
+    static const std::vector<std::size_t> position({});
+    return position[i];
+  }
+
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson1d_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson1d_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson1d_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson1d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson1d_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson1d_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_interior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_vertex_subdomain_id() const final override
+  {
+    return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson1d_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1190,14 +2041,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson1D
 {
@@ -1206,43 +2063,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson1d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson1d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson1d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson1d_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson1d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson1d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson1d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson1d_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson1d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson1d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson1d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson1d_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1253,63 +2087,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson1d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson1d_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson1d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson1d_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson1d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson1d_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson1d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson1d_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson1d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson1d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson1d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson1d_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson1d_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1317,7 +2158,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson1d_form_0());
+    _ufc_form = std::make_shared<const poisson1d_form_0>();
   }
 
   // Destructor
@@ -1347,14 +2188,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/dolfin/ale/Poisson2D.h b/dolfin/ale/Poisson2D.h
index c955334..3894476 100644
--- a/dolfin/ale/Poisson2D.h
+++ b/dolfin/ale/Poisson2D.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON2D_H
 #define __POISSON2D_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson2d_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson2d_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2d_finite_element_0()
+  ~poisson2d_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,141 +902,86 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson2d_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson2d_dofmap_0: public ufc::dofmap
+class poisson2d_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson2d_dofmap_0() : ufc::dofmap()
+  poisson2d_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson2d_dofmap_0()
+  ~poisson2d_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t space_dimension() const final override
   {
-    return 3;
+    return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 2;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
+        return 2;
         break;
       }
     }
@@ -1041,270 +989,1957 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    return 2;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    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;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
+        return 2;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new poisson2d_dofmap_0();
-  }
-
-};
-
-/// 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 poisson2d_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson2d_cell_integral_0_otherwise() : ufc::cell_integral()
+  std::size_t reference_value_size() const final override
   {
-    // Do nothing
+    return 2;
   }
 
-  /// Destructor
-  virtual ~poisson2d_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 11
-    // Total number of operations (multiply-add pairs):                  22
-    
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
     double detJ;
     compute_jacobian_inverse_triangle_2d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
-    // Compute element tensor
-    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
-    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
-    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
-    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
-    A[4] = 0.499999999999999*G0_0_0;
-    A[5] = 0.5*G0_0_1;
-    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
-    A[7] = 0.5*G0_1_0;
-    A[8] = 0.5*G0_1_1;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class poisson2d_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  poisson2d_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson2d_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "7f3815c8e31ab18b282532dab8742e6961eab53ad4e81fa7cb09d956cec41e4af64946224d6780069be4537652b627b48dcbe12cb4f41895baf526eb4e5dcc56";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 0;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
     switch (i)
     {
     case 0:
       {
-        return new poisson2d_finite_element_0();
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
         break;
       }
     case 1:
       {
-        return new poisson2d_finite_element_0();
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[2] = {0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2; s++)
+      {
+        values[r*2 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 2*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
+    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[2][1];
+    for (unsigned int row = 0; row < 2; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[2][2];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, -0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.288675134594813, -0.166666666666667};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[3] = {0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
+      basisvalues[0] *= std::sqrt(0.5);
+      basisvalues[2] *= std::sqrt(1.0);
+      basisvalues[1] *= std::sqrt(3.0);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[3] = \
+      {0.471404520791032, 0.0, 0.333333333333333};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {4.89897948556635, 0.0, 0.0},
+      {0.0, 0.0, 0.0}};
+      
+      static const double dmats1[3][3] = \
+      {{0.0, 0.0, 0.0},
+      {2.44948974278318, 0.0, 0.0},
+      {4.24264068711928, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[2];
+      for (unsigned int r = 0; r < 2; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[3][3] = \
+      {{1.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0},
+      {0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 3; t++)
+        {
+          for (unsigned int u = 0; u < 3; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            for (unsigned int u = 0; u < 3; u++)
+            {
+              for (unsigned int tu = 0; tu < 3; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 3; s++)
+        {
+          for (unsigned int t = 0; t < 3; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 2;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[4];
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 6; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 2*num_derivatives; s++)
+      {
+        values[r*2*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[2];
+    
+    // Declare variable for physical coordinates
+    double y[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    f.evaluate(vals, y, c);
+    values[3] = vals[1];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[2] = dof_values[1];
+    vertex_values[4] = dof_values[2];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[3];
+    vertex_values[3] = dof_values[4];
+    vertex_values[5] = dof_values[5];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 2;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson2d_finite_element_1();
+  }
+
+};
+
+
+class poisson2d_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson2d_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson2d_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    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;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson2d_dofmap_0();
+  }
+
+};
+
+
+class poisson2d_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson2d_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson2d_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 2;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 2*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 6;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 4;
+      dofs[3] = 5;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 2)
+    {
+    throw std::runtime_error("d is larger than dimension (2)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 2)
+      {
+      throw std::runtime_error("i is larger than number of entities (2)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 3;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 4;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 5;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 2;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson2d_dofmap_1();
+  }
+
+};
+
+
+class poisson2d_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson2d_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson2d_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 11
+    // Total number of operations (multiply-add pairs):                  22
+    
+    // Compute Jacobian
+    double J[4];
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[4];
+    double detJ;
+    compute_jacobian_inverse_triangle_2d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
+    
+    // Compute element tensor
+    A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
+    A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
+    A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
+    A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
+    A[4] = 0.499999999999999*G0_0_0;
+    A[5] = 0.5*G0_0_1;
+    A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
+    A[7] = 0.5*G0_1_0;
+    A[8] = 0.5*G0_1_1;
+  }
+
+};
+
+
+class poisson2d_form_0: public ufc::form
+{
+public:
+
+  poisson2d_form_0() : ufc::form()
+  {
+    // Do nothing
+  }
+
+  ~poisson2d_form_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "43feb4df5c0f918b8e0c704dcc3347e7ba836f6789fff2a5eab375cebd1a89b9c11ac8a2672ff5b2e765a36ff221d887ada9a5989db46716fbaeaeda07acdb99";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 2;
+  }
+
+  std::size_t num_coefficients() const final override
+  {
+    return 0;
+  }
+
+  std::size_t original_coefficient_position(std::size_t i) const final override
+  {
+    static const std::vector<std::size_t> position({});
+    return position[i];
+  }
+
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson2d_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson2d_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson2d_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson2d_finite_element_0();
         break;
       }
     }
@@ -1312,8 +2947,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1332,126 +2966,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson2d_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1465,14 +3135,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson2D
 {
@@ -1481,43 +3157,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1528,63 +3181,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson2d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson2d_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson2d_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1592,7 +3252,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson2d_form_0());
+    _ufc_form = std::make_shared<const poisson2d_form_0>();
   }
 
   // Destructor
@@ -1622,14 +3282,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/dolfin/ale/Poisson3D.h b/dolfin/ale/Poisson3D.h
index 3f2405b..9982387 100644
--- a/dolfin/ale/Poisson3D.h
+++ b/dolfin/ale/Poisson3D.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
 #ifndef __POISSON3D_H
 #define __POISSON3D_H
-
-#include <cmath>
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
 class poisson3d_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
   poisson3d_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson3d_finite_element_0()
+  ~poisson3d_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 4;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -108,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -257,20 +270,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -279,26 +290,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -318,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -330,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -339,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -1041,28 +1050,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1098,7 +1105,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -1106,22 +1113,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -1132,36 +1137,36 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -1171,46 +1176,44 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -1219,151 +1222,92 @@ public:
     vertex_values[3] = dof_values[3];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
     return new poisson3d_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class poisson3d_dofmap_0: public ufc::dofmap
+class poisson3d_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  poisson3d_dofmap_0() : ufc::dofmap()
+  poisson3d_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~poisson3d_dofmap_0()
+  ~poisson3d_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  ufc::shape cell_shape() const final override
   {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    case 3:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t space_dimension() const final override
   {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 4;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t value_rank() const final override
   {
-    return 3;
+    return 1;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    case 3:
-      {
-        return 0;
+        return 3;
         break;
       }
     }
@@ -1371,298 +1315,3505 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  std::size_t value_size() const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    return 3;
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  std::size_t reference_value_rank() const final override
   {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-        break;
-      }
-    case 3:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-        break;
-      }
-    }
-    
+    return 1;
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
-    if (d > 3)
-    {
-    throw std::runtime_error("d is larger than dimension (3)");
-    }
-    
-    switch (d)
+    switch (i)
     {
     case 0:
       {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        
+        return 3;
         break;
       }
     }
     
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  std::size_t reference_value_size() const final override
   {
-    return new poisson3d_dofmap_0();
-  }
-
-};
-
-/// 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 poisson3d_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  poisson3d_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
+    return 3;
   }
 
-  /// Destructor
-  virtual ~poisson3d_cell_integral_0_otherwise()
+  std::size_t degree() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * family() const final override
   {
-    static const std::vector<bool> enabled({});
-    return enabled;
+    return "Lagrange";
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    27
-    // Number of operations (multiply-add pairs) for tensor contraction: 28
-    // Total number of operations (multiply-add pairs):                  58
-    
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
     double detJ;
     compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
     
-    // Set scale factor
-    const double det = std::abs(detJ);
     
-    // Compute geometry tensor
-    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
-    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
-    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
-    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
-    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
-    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
-    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
-    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
-    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
-    // Compute element tensor
-    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
-    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
-    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
-    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
-    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
-    A[5] = 0.166666666666667*G0_0_0;
-    A[6] = 0.166666666666667*G0_0_1;
-    A[7] = 0.166666666666667*G0_0_2;
-    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
-    A[9] = 0.166666666666667*G0_1_0;
-    A[10] = 0.166666666666667*G0_1_1;
-    A[11] = 0.166666666666667*G0_1_2;
-    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
-    A[13] = 0.166666666666667*G0_2_0;
-    A[14] = 0.166666666666667*G0_2_1;
-    A[15] = 0.166666666666667*G0_2_2;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class poisson3d_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  poisson3d_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~poisson3d_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "0a1c8620c3fe3a9b075cccbf6831c3b71c838dae9d8115e7ca3bceb16e94994307b7af22c58a3329d1bc1bd249fd11fd8a0f9c8d23c6d43589322d9fc76fa890";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 4:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 5:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 7:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 8:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 9:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 10:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    case 11:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson3d_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson3d_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson3d_finite_element_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new poisson3d_finite_element_1();
+  }
+
+};
+
+
+class poisson3d_dofmap_0: public ufc::dofmap
+{
+public:
+
+  poisson3d_dofmap_0() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson3d_dofmap_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 4;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 3;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 1;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson3d_dofmap_0();
+  }
+
+};
+
+
+class poisson3d_dofmap_1: public ufc::dofmap
+{
+public:
+
+  poisson3d_dofmap_1() : ufc::dofmap()
+  {
+    // Do nothing
+  }
+
+  ~poisson3d_dofmap_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  bool needs_mesh_entities(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return true;
+        break;
+      }
+    case 1:
+      {
+        return false;
+        break;
+      }
+    case 2:
+      {
+        return false;
+        break;
+      }
+    case 3:
+      {
+        return false;
+        break;
+      }
+    }
+    
+    return false;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
+  {
+    return 3*num_global_entities[0];
+  }
+
+  std::size_t num_element_dofs() const final override
+  {
+    return 12;
+  }
+
+  std::size_t num_facet_dofs() const final override
+  {
+    return 9;
+  }
+
+  std::size_t num_entity_dofs(std::size_t d) const final override
+  {
+    switch (d)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    case 1:
+      {
+        return 0;
+        break;
+      }
+    case 2:
+      {
+        return 0;
+        break;
+      }
+    case 3:
+      {
+        return 0;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
+  {
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+  }
+
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
+  {
+    switch (facet)
+    {
+    case 0:
+      {
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 1:
+      {
+        dofs[0] = 0;
+      dofs[1] = 2;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
+        break;
+      }
+    case 2:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
+        break;
+      }
+    case 3:
+      {
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
+        break;
+      }
+    }
+    
+  }
+
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
+  {
+    if (d > 3)
+    {
+    throw std::runtime_error("d is larger than dimension (3)");
+    }
+    
+    switch (d)
+    {
+    case 0:
+      {
+        if (i > 3)
+      {
+      throw std::runtime_error("i is larger than number of entities (3)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
+          break;
+        }
+      }
+      
+        break;
+      }
+    case 1:
+      {
+        
+        break;
+      }
+    case 2:
+      {
+        
+        break;
+      }
+    case 3:
+      {
+        
+        break;
+      }
+    }
+    
+  }
+
+
+  std::size_t num_sub_dofmaps() const final override
+  {
+    return 3;
+  }
+
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return new poisson3d_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new poisson3d_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new poisson3d_dofmap_0();
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  ufc::dofmap * create() const final override
+  {
+    return new poisson3d_dofmap_1();
+  }
+
+};
+
+
+class poisson3d_cell_integral_0_otherwise: public ufc::cell_integral
+{
+public:
+
+  poisson3d_cell_integral_0_otherwise() : ufc::cell_integral()
+  {
+    
+  }
+
+  ~poisson3d_cell_integral_0_otherwise() override
+  {
+    
+  }
+
+  const std::vector<bool> & enabled_coefficients() const final override
+  {
+    static const std::vector<bool> enabled({});
+    return enabled;
+  }
+
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
+  {
+    // Number of operations (multiply-add pairs) for Jacobian data:      3
+    // Number of operations (multiply-add pairs) for geometry tensor:    27
+    // Number of operations (multiply-add pairs) for tensor contraction: 28
+    // Total number of operations (multiply-add pairs):                  58
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    // Set scale factor
+    const double det = std::abs(detJ);
+    
+    // Compute geometry tensor
+    const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1] + K[2]*K[2]);
+    const double G0_0_1 = det*(K[0]*K[3] + K[1]*K[4] + K[2]*K[5]);
+    const double G0_0_2 = det*(K[0]*K[6] + K[1]*K[7] + K[2]*K[8]);
+    const double G0_1_0 = det*(K[3]*K[0] + K[4]*K[1] + K[5]*K[2]);
+    const double G0_1_1 = det*(K[3]*K[3] + K[4]*K[4] + K[5]*K[5]);
+    const double G0_1_2 = det*(K[3]*K[6] + K[4]*K[7] + K[5]*K[8]);
+    const double G0_2_0 = det*(K[6]*K[0] + K[7]*K[1] + K[8]*K[2]);
+    const double G0_2_1 = det*(K[6]*K[3] + K[7]*K[4] + K[8]*K[5]);
+    const double G0_2_2 = det*(K[6]*K[6] + K[7]*K[7] + K[8]*K[8]);
+    
+    // Compute element tensor
+    A[0] = 0.166666666666667*G0_0_0 + 0.166666666666667*G0_0_1 + 0.166666666666667*G0_0_2 + 0.166666666666667*G0_1_0 + 0.166666666666667*G0_1_1 + 0.166666666666667*G0_1_2 + 0.166666666666667*G0_2_0 + 0.166666666666667*G0_2_1 + 0.166666666666667*G0_2_2;
+    A[1] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_1_0 - 0.166666666666667*G0_2_0;
+    A[2] = -0.166666666666667*G0_0_1 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_2_1;
+    A[3] = -0.166666666666667*G0_0_2 - 0.166666666666667*G0_1_2 - 0.166666666666667*G0_2_2;
+    A[4] = -0.166666666666667*G0_0_0 - 0.166666666666667*G0_0_1 - 0.166666666666667*G0_0_2;
+    A[5] = 0.166666666666667*G0_0_0;
+    A[6] = 0.166666666666667*G0_0_1;
+    A[7] = 0.166666666666667*G0_0_2;
+    A[8] = -0.166666666666667*G0_1_0 - 0.166666666666667*G0_1_1 - 0.166666666666667*G0_1_2;
+    A[9] = 0.166666666666667*G0_1_0;
+    A[10] = 0.166666666666667*G0_1_1;
+    A[11] = 0.166666666666667*G0_1_2;
+    A[12] = -0.166666666666667*G0_2_0 - 0.166666666666667*G0_2_1 - 0.166666666666667*G0_2_2;
+    A[13] = 0.166666666666667*G0_2_0;
+    A[14] = 0.166666666666667*G0_2_1;
+    A[15] = 0.166666666666667*G0_2_2;
+  }
+
+};
+
+
+class poisson3d_form_0: public ufc::form
+{
+public:
+
+  poisson3d_form_0() : ufc::form()
+  {
+    // Do nothing
+  }
+
+  ~poisson3d_form_0() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "189addc1337507b593b83849ffa1cefea9e7ba0b840b5af3bb4ed325cf87c935ed2d337a05c0528dfbcb3e32f08357e3ecbac8667972bf14678007bdaef7655d";
+  }
+
+  std::size_t rank() const final override
+  {
+    return 2;
+  }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new poisson3d_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new poisson3d_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1681,8 +4832,7 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1701,126 +4851,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
     return new poisson3d_cell_integral_0_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_default_vertex_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -1834,14 +5020,20 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
 namespace Poisson3D
 {
@@ -1850,43 +5042,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -1897,63 +5066,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_dofmap_0()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_dofmap_0()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<poisson3d_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<poisson3d_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
+
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new poisson3d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new poisson3d_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -1961,7 +5137,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new poisson3d_form_0());
+    _ufc_form = std::make_shared<const poisson3d_form_0>();
   }
 
   // Destructor
@@ -1991,14 +5167,75 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class MultiMeshForm_a: public dolfin::MultiMeshForm
+{
+public:
+
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
+
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
+  }
+
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
+  {
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
+  }
+
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/dolfin/ale/compile.log b/dolfin/ale/compile.log
index f317e5e..db82fd5 100644
--- a/dolfin/ale/compile.log
+++ b/dolfin/ale/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson2D
 
@@ -12,26 +13,34 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.0265331 seconds.
+Compiler stage 1 finished in 0.042064 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -41,7 +50,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000555 seconds
+  36 entries computed in 0.000504 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -49,87 +58,78 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00362301 seconds.
+Compiler stage 2 finished in 0.00598001 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000114918 seconds.
+Compiler stage 3 finished in 0.000126123 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.026233 seconds.
+Compiler stage 4 finished in 0.0667961 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000285864 seconds.
+Compiler stage 4.1 finished in 0.000354052 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson2D.h.
-Compiler stage 5 finished in 0.000430822 seconds.
+Compiler stage 5 finished in 0.000407934 seconds.
 
-FFC finished in 0.0574801 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.116028 seconds.
+Output written to ./Poisson2D.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson1D
 
@@ -142,26 +142,33 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<1 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<1 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.0115571 seconds.
+Compiler stage 1 finished in 0.0147171 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -171,7 +178,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  4 entries computed in 0.000608 seconds
+  4 entries computed in 0.000659 seconds
   Shape of reference tensor: (2, 2, 1, 1)
   Primary multi index:   rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   Secondary multi index: rank = 2 dims = [1, 1] indices = [[0, 0]]
@@ -179,63 +186,42 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [1, 1] indices = [[0, 0]]
   External multi index:  rank = 1 dims = [1] indices = [[0]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00257897 seconds.
+Compiler stage 2 finished in 0.00458789 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000113964 seconds.
+Compiler stage 3 finished in 0.000149012 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Generating code for 2 element(s)
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0145469 seconds.
+Compiler stage 4 finished in 0.0260348 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.00028801 seconds.
+Compiler stage 4.1 finished in 0.000383854 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson1D.h.
-Compiler stage 5 finished in 0.000424862 seconds.
+Compiler stage 5 finished in 0.000404119 seconds.
 
-FFC finished in 0.0297582 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.046602 seconds.
+Output written to ./Poisson1D.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form Poisson3D
 
@@ -248,26 +234,35 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<3 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 0
-  quadrature_degree: auto --> 0
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 0
+  quadrature_degree: 0
   
-Compiler stage 1 finished in 0.045115 seconds.
+Compiler stage 1 finished in 0.0624769 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -277,7 +272,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  144 entries computed in 0.000652 seconds
+  144 entries computed in 0.000613 seconds
   Shape of reference tensor: (4, 4, 3, 3)
   Primary multi index:   rank = 2 dims = [4, 4] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
@@ -285,114 +280,164 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   External multi index:  rank = 1 dims = [3] indices = [[0], [1], [2]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00345516 seconds.
+Compiler stage 2 finished in 0.00681496 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000130177 seconds.
+Compiler stage 3 finished in 0.000151157 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp4
   Removing unused variable: tmp3
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.058244 seconds.
+Compiler stage 4 finished in 0.176386 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000342846 seconds.
+Compiler stage 4.1 finished in 0.000404119 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./Poisson3D.h.
-Compiler stage 5 finished in 0.000532866 seconds.
+Compiler stage 5 finished in 0.000478983 seconds.
 
-FFC finished in 0.108111 seconds.
+FFC finished in 0.247039 seconds.
+Output written to ./Poisson3D.h.
diff --git a/dolfin/common/MPI.cpp b/dolfin/common/MPI.cpp
index 10d125d..6da7b75 100644
--- a/dolfin/common/MPI.cpp
+++ b/dolfin/common/MPI.cpp
@@ -106,42 +106,34 @@ std::size_t dolfin::MPI::global_offset(const MPI_Comm comm,
 #endif
 }
 //-----------------------------------------------------------------------------
-std::pair<std::size_t, std::size_t>
-dolfin::MPI::local_range(const MPI_Comm comm, std::size_t N)
+std::pair<std::int64_t, std::int64_t>
+dolfin::MPI::local_range(const MPI_Comm comm, std::int64_t N)
 {
   return local_range(comm, rank(comm), N);
 }
 //-----------------------------------------------------------------------------
-std::pair<std::size_t, std::size_t>
-dolfin::MPI::local_range(const MPI_Comm comm, unsigned int process,
-                         std::size_t N)
+std::pair<std::int64_t, std::int64_t>
+dolfin::MPI::local_range(const MPI_Comm comm, int process, std::int64_t N)
 {
   return compute_local_range(process, N, size(comm));
 }
 //-----------------------------------------------------------------------------
-std::pair<std::size_t, std::size_t>
-dolfin::MPI::compute_local_range(unsigned int process,
-                                 std::size_t N,
-                                 unsigned int size)
+std::pair<std::int64_t, std::int64_t>
+dolfin::MPI::compute_local_range(int process, std::int64_t N, int size)
 {
+  dolfin_assert(process >= 0);
+  dolfin_assert(N >= 0);
+  dolfin_assert(size > 0);
+
   // Compute number of items per process and remainder
-  const std::size_t n = N / size;
-  const std::size_t r = N % size;
+  const std::int64_t n = N / size;
+  const std::int64_t r = N % size;
 
   // Compute local range
-  std::pair<std::size_t, std::size_t> range;
   if (process < r)
-  {
-    range.first = process*(n + 1);
-    range.second = range.first + n + 1;
-  }
+    return {process*(n + 1), process*(n + 1) + n + 1};
   else
-  {
-    range.first = process*n + r;
-    range.second = range.first + n;
-  }
-
-  return range;
+    return {process*n + r,  process*n + r + n};
 }
 //-----------------------------------------------------------------------------
 unsigned int dolfin::MPI::index_owner(const MPI_Comm comm,
diff --git a/dolfin/common/MPI.h b/dolfin/common/MPI.h
index c1b5254..5c5e0f1 100644
--- a/dolfin/common/MPI.h
+++ b/dolfin/common/MPI.h
@@ -24,8 +24,8 @@
 #ifndef __MPI_DOLFIN_WRAPPER_H
 #define __MPI_DOLFIN_WRAPPER_H
 
+#include <cstdint>
 #include <iostream>
-
 #include <numeric>
 #include <type_traits>
 #include <utility>
@@ -185,20 +185,18 @@ namespace dolfin
 
     /// Return local range for local process, splitting [0, N - 1] into
     /// size() portions of almost equal size
-    static std::pair<std::size_t, std::size_t>
-      local_range(MPI_Comm comm, std::size_t N);
+    static std::pair<std::int64_t, std::int64_t>
+      local_range(MPI_Comm comm, std::int64_t N);
 
     /// Return local range for given process, splitting [0, N - 1] into
     /// size() portions of almost equal size
-    static std::pair<std::size_t, std::size_t>
-      local_range(MPI_Comm comm, unsigned int process,
-                  std::size_t N);
+    static std::pair<std::int64_t, std::int64_t>
+      local_range(MPI_Comm comm, int process, std::int64_t N);
 
     /// Return local range for given process, splitting [0, N - 1] into
     /// size() portions of almost equal size
-    static std::pair<std::size_t, std::size_t>
-      compute_local_range(unsigned int process, std::size_t N,
-                          unsigned int size);
+    static std::pair<std::int64_t, std::int64_t>
+      compute_local_range(int process, std::int64_t N, int size);
 
     /// Return which process owns index (inverse of local_range)
     static unsigned int index_owner(MPI_Comm comm,
@@ -246,16 +244,12 @@ namespace dolfin
   // Specialisations for MPI_Datatypes
   template<> inline MPI_Datatype MPI::mpi_type<float>() { return MPI_FLOAT; }
   template<> inline MPI_Datatype MPI::mpi_type<double>() { return MPI_DOUBLE; }
-  template<> inline MPI_Datatype MPI::mpi_type<short int>()
-  { return MPI_SHORT; }
+  template<> inline MPI_Datatype MPI::mpi_type<short int>() { return MPI_SHORT; }
   template<> inline MPI_Datatype MPI::mpi_type<int>() { return MPI_INT; }
   template<> inline MPI_Datatype MPI::mpi_type<long int>() { return MPI_LONG; }
-  template<> inline MPI_Datatype MPI::mpi_type<unsigned int>()
-  { return MPI_UNSIGNED; }
-  template<> inline MPI_Datatype MPI::mpi_type<unsigned long int>()
-  { return MPI_UNSIGNED_LONG; }
-  template<> inline MPI_Datatype MPI::mpi_type<long long>()
-  { return MPI_LONG_LONG; }
+  template<> inline MPI_Datatype MPI::mpi_type<unsigned int>() { return MPI_UNSIGNED; }
+  template<> inline MPI_Datatype MPI::mpi_type<unsigned long int>() { return MPI_UNSIGNED_LONG; }
+  template<> inline MPI_Datatype MPI::mpi_type<long long>() { return MPI_LONG_LONG; }
   #endif
   //---------------------------------------------------------------------------
   template<typename T>
@@ -621,7 +615,7 @@ namespace dolfin
   {
     #ifdef HAS_MPI
     // Enforce cast to MPI_Op; this is needed because template dispatch may
-    // not recognize this is possible, e.g. C-enum to uint in SGI MPT
+    // not recognize this is possible, e.g. C-enum to unsigned int in SGI MPT
     MPI_Op op = static_cast<MPI_Op>(MPI_MAX);
     return all_reduce(comm, value, op);
     #else
@@ -633,7 +627,7 @@ namespace dolfin
   {
     #ifdef HAS_MPI
     // Enforce cast to MPI_Op; this is needed because template dispatch may
-    // not recognize this is possible, e.g. C-enum to uint in SGI MPT
+    // not recognize this is possible, e.g. C-enum to unsigned int in SGI MPT
     MPI_Op op = static_cast<MPI_Op>(MPI_MIN);
     return all_reduce(comm, value, op);
     #else
@@ -645,7 +639,7 @@ namespace dolfin
   {
     #ifdef HAS_MPI
     // Enforce cast to MPI_Op; this is needed because template dispatch may
-    // not recognize this is possible, e.g. C-enum to uint in SGI MPT
+    // not recognize this is possible, e.g. C-enum to unsigned int in SGI MPT
     MPI_Op op = static_cast<MPI_Op>(MPI_SUM);
     return all_reduce(comm, value, op);
     #else
diff --git a/dolfin/common/SubSystemsManager.cpp b/dolfin/common/SubSystemsManager.cpp
index bb1a819..8151e95 100644
--- a/dolfin/common/SubSystemsManager.cpp
+++ b/dolfin/common/SubSystemsManager.cpp
@@ -137,7 +137,7 @@ int SubSystemsManager::init_mpi(int argc, char* argv[],
 void SubSystemsManager::init_petsc()
 {
   #ifdef HAS_PETSC
-  if (singleton().petsc_initialized )
+  if (singleton().petsc_initialized)
     return;
 
   log(TRACE, "Initializing PETSc (ignoring command-line arguments).");
@@ -177,29 +177,23 @@ void SubSystemsManager::init_petsc(int argc, char* argv[])
 
   PetscBool is_initialized;
   PetscInitialized(&is_initialized);
-  if (is_initialized)
-  {
-    PetscOptionsInsert(&argc, &argv, PETSC_NULL);
-  }
-  else
+  if (!is_initialized)
   {
     // Initialize PETSc
     PetscInitializeNoArguments();
-
-    // Set options to avoid common failures with some 3rd party solvers
-    PetscOptionsSetValue("-mat_mumps_icntl_7", "0");
-    PetscOptionsSetValue("-mat_superlu_dist_colperm", "MMD_AT_PLUS_A");
-
-    // Pass command line arguments to PETSc (will overwrite any
-    // default above)
-    PetscOptionsInsert(&argc, &argv, PETSC_NULL);
   }
 
-  // Set PETSc
+  // Pass command line arguments to PETSc (will overwrite any
+  // default above)
+  #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+  PetscOptionsInsert(&argc, &argv, NULL);
+  #else
+  PetscOptionsInsert(NULL, &argc, &argv, NULL);
+  #endif
 
   #ifdef HAS_SLEPC
   // Initialize SLEPc
-  SlepcInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
+  SlepcInitialize(&argc, &argv, NULL, NULL);
   #endif
 
   // Avoid using default PETSc signal handler
diff --git a/dolfin/common/SubSystemsManager.h b/dolfin/common/SubSystemsManager.h
index ffc9fcd..c51ebdc 100644
--- a/dolfin/common/SubSystemsManager.h
+++ b/dolfin/common/SubSystemsManager.h
@@ -31,6 +31,11 @@ namespace dolfin
   {
   public:
 
+    /// Singleton instance. Calling this ensures singleton instance of
+    /// SubSystemsManager is initialized according to the "Construct
+    /// on First Use" idiom.
+    static SubSystemsManager& singleton();
+
     /// Initialise MPI
     static void init_mpi();
 
@@ -82,9 +87,6 @@ namespace dolfin
     // Finalize PETSc
     static void finalize_petsc();
 
-    // Singleton instance
-    static SubSystemsManager& singleton();
-
     // State variables
     bool petsc_initialized;
     bool control_mpi;
diff --git a/dolfin/common/Timer.cpp b/dolfin/common/Timer.cpp
index a8ebc51..b1d9a60 100644
--- a/dolfin/common/Timer.cpp
+++ b/dolfin/common/Timer.cpp
@@ -66,13 +66,6 @@ double Timer::stop()
   return std::get<0>(elapsed);
 }
 //-----------------------------------------------------------------------------
-double Timer::value() const
-{
-  deprecation("Timer::value()", "1.6.0", "1.7.0", "The method is ill-defined.");
-  const double t = static_cast<double>(_timer.elapsed().wall) * 1e-9;
-  return t;
-}
-//-----------------------------------------------------------------------------
 std::tuple<double, double, double> Timer::elapsed() const
 {
   const auto elapsed = _timer.elapsed();
diff --git a/dolfin/common/Timer.h b/dolfin/common/Timer.h
index dc023d6..bd7fd99 100644
--- a/dolfin/common/Timer.h
+++ b/dolfin/common/Timer.h
@@ -67,9 +67,6 @@ namespace dolfin
     /// into logger
     double stop();
 
-    /// DEPRECATED: Return value of timer (or time at start if not stopped)
-    double value() const;
-
     /// Return wall, user and system time in seconds. Wall-clock time
     /// has precision around 1 microsecond; user and system around
     /// 10 millisecond.
diff --git a/dolfin/common/defines.cpp b/dolfin/common/defines.cpp
index 3680bd5..148f3c9 100644
--- a/dolfin/common/defines.cpp
+++ b/dolfin/common/defines.cpp
@@ -34,6 +34,11 @@ std::string dolfin::dolfin_version()
   return std::string(DOLFIN_VERSION);
 }
 //-------------------------------------------------------------------------
+std::string dolfin::ufc_signature()
+{
+  return std::string(UFC_SIGNATURE);
+}
+//-------------------------------------------------------------------------
 std::string dolfin::git_commit_hash()
 {
   return std::string(DOLFIN_GIT_COMMIT_HASH);
@@ -62,15 +67,6 @@ bool dolfin::has_mpi()
 #endif
 }
 //-------------------------------------------------------------------------
-bool dolfin::has_tao()
-{
-#ifdef ENABLE_PETSC_TAO
-  return true;
-#else
-  return false;
-#endif
-}
-//-------------------------------------------------------------------------
 bool dolfin::has_petsc()
 {
 #ifdef HAS_PETSC
@@ -143,3 +139,12 @@ bool dolfin::has_hdf5()
 #endif
 }
 //-------------------------------------------------------------------------
+bool dolfin::has_vtk()
+{
+#ifdef HAS_VTK
+  return true;
+#else
+  return false;
+#endif
+}
+//-------------------------------------------------------------------------
diff --git a/dolfin/common/defines.h b/dolfin/common/defines.h
index a949943..7406d00 100644
--- a/dolfin/common/defines.h
+++ b/dolfin/common/defines.h
@@ -32,6 +32,9 @@ namespace dolfin
   /// Return DOLFIN version string
   std::string dolfin_version();
 
+  /// Return UFC signature string
+  std::string ufc_signature();
+
   /// Return git changeset hash (returns "unknown" if changeset is
   /// not known)
   std::string git_commit_hash();
@@ -48,10 +51,6 @@ namespace dolfin
   /// Return true if DOLFIN is compiled with PETSc
   bool has_petsc();
 
-  /// Return true if DOLFIN is compiled with PETSc and PETSc version
-  /// provides TAO
-  bool has_tao();
-
   /// Return true if DOLFIN is compiled with SLEPc
   bool has_slepc();
 
@@ -73,6 +72,9 @@ namespace dolfin
   /// Return true if DOLFIN is compiled with HDF5
   bool has_hdf5();
 
+  /// Return true if DOLFIN is compiled with VTK
+  bool has_vtk();
+
 }
 
 #endif
diff --git a/dolfin/common/timing.cpp b/dolfin/common/timing.cpp
index ecc728e..c9cf97a 100644
--- a/dolfin/common/timing.cpp
+++ b/dolfin/common/timing.cpp
@@ -55,11 +55,6 @@ Table dolfin::timings(TimingClear clear, std::set<TimingType> type)
   return LogManager::logger().timings(clear, type);
 }
 //-----------------------------------------------------------------------------
-void dolfin::list_timings(bool reset)
-{
-  LogManager::logger().list_timings(reset);
-}
-//-----------------------------------------------------------------------------
 void dolfin::list_timings(TimingClear clear, std::set<TimingType> type)
 {
   LogManager::logger().list_timings(clear, type);
diff --git a/dolfin/common/timing.h b/dolfin/common/timing.h
index 2265717..68eddf5 100644
--- a/dolfin/common/timing.h
+++ b/dolfin/common/timing.h
@@ -63,14 +63,6 @@ namespace dolfin
   ///         _Table_ with timings
   Table timings(TimingClear clear, std::set<TimingType> type);
 
-  /// **DEPRECATED**: List a summary of timings and tasks, optionally clearing
-  /// stored timings. ``MPI_AVG`` reduction is printed. Collective on
-  /// ``MPI_COMM_WORLD``. Only wall time is printed.
-  void list_timings(bool reset=false);
-  // NOTE: Function marked as 'collective on COMM_WORLD' (instead of
-  //       'collective on Logger::mpi_comm()') as user has no clue what the
-  //       function has to do with Logger
-
   /// List a summary of timings and tasks, optionally clearing stored timings.
   /// ``MPI_AVG`` reduction is printed. Collective on ``MPI_COMM_WORLD``.
   ///
diff --git a/dolfin/common/unittest.h b/dolfin/common/unittest.h
deleted file mode 100644
index 72df69a..0000000
--- a/dolfin/common/unittest.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2007 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2007-05-14
-// Last changed: 2007-05-24
-//
-// Simple macro for DOLFIN unit tests (using cppunit). The macro
-// DOLFIN_TEST removes the need of repeating the same 8 lines of
-// code in every single unit test.
-
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/TestRunner.h>
-#include <cppunit/TestResult.h>
-#include <cppunit/TestResultCollector.h>
-#include <cppunit/CompilerOutputter.h>
-
-#define DOLFIN_TEST \
-CppUnit::TestResult result; \
-CppUnit::TestResultCollector collected_results; \
-result.addListener(&collected_results); \
-CppUnit::TestRunner runner; \
-runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); \
-runner.run(result); \
-CppUnit::CompilerOutputter outputter(&collected_results, std::cerr); \
-outputter.write (); \
-return collected_results.wasSuccessful () ? 0 : 1;
diff --git a/dolfin/common/utils.h b/dolfin/common/utils.h
index 5f0e303..8443c0f 100644
--- a/dolfin/common/utils.h
+++ b/dolfin/common/utils.h
@@ -26,8 +26,8 @@
 
 #include <cstring>
 #include <limits>
-#include <string>
 #include <sstream>
+#include <string>
 #include <vector>
 #include <boost/functional/hash.hpp>
 #include <dolfin/common/MPI.h>
@@ -38,12 +38,20 @@ namespace dolfin
   /// Indent string block
   std::string indent(std::string block);
 
-  /// Return string representation of int
-  template <class T>
-    std::string to_string(T x)
+  /// Return string representation of given container of ints, floats,
+  /// etc.
+  template<typename T>
+    std::string container_to_string(const T& x, std::string delimiter,
+                                    int precision)
   {
     std::stringstream s;
-    s << x;
+    s.precision(precision);
+    if (!x.empty())
+    {
+      s << *x.begin();
+      for (auto it = x.begin() + 1; it != x.end(); ++it)
+        s << delimiter << *it;
+    }
     return s.str();
   }
 
@@ -73,7 +81,7 @@ namespace dolfin
     MPI::gather(mpi_comm, local_hash_tmp, all_hashes);
 
     // Hash the received hash keys
-    boost::hash<std::vector<std::size_t> > hash;
+    boost::hash<std::vector<std::size_t>> hash;
     std::size_t global_hash = hash(all_hashes);
 
     // Broadcast hash key to all processes
@@ -81,23 +89,6 @@ namespace dolfin
     return global_hash;
   }
 
-  /// Fast zero-fill of numeric vectors/blocks.
-  template <class T>
-    void zerofill(T* arr, std::size_t n)
-  {
-    if (std::numeric_limits<T>::is_integer || std::numeric_limits<T>::is_iec559)
-      std::memset(arr, 0, n*sizeof(T));
-    else
-    {
-      // should never happen in practice
-      std::fill_n(arr, n, T(0));
-    }
-  }
-
-  template <class T>
-    void zerofill(std::vector<T>& vec)
-  { zerofill(&vec[0], vec.size()); }
-
 }
 
 #endif
diff --git a/dolfin/common/version.h.in b/dolfin/common/version.h.in
index 2c0ce65..3703195 100644
--- a/dolfin/common/version.h.in
+++ b/dolfin/common/version.h.in
@@ -7,5 +7,6 @@
 #define DOLFIN_VERSION_MICRO   @DOLFIN_VERSION_MICRO_STRIPPED@
 #define DOLFIN_VERSION_STRING  "@DOLFIN_VERSION@"
 #define DOLFIN_VERSION_GIT     "@GIT_COMMIT_HASH@"
+#define UFC_SIGNATURE          "@UFC_SIGNATURE@"
 
 #endif
diff --git a/dolfin/fem/Assembler.cpp b/dolfin/fem/Assembler.cpp
index 696c60e..3343275 100644
--- a/dolfin/fem/Assembler.cpp
+++ b/dolfin/fem/Assembler.cpp
@@ -132,7 +132,8 @@ void Assembler::assemble_cells(
   Timer timer("Assemble cells");
 
   // Extract mesh
-  const Mesh& mesh = a.mesh();
+  dolfin_assert(a.mesh());
+  const Mesh& mesh = *(a.mesh());
 
   // Form rank
   const std::size_t form_rank = ufc.form.rank();
@@ -156,7 +157,7 @@ void Assembler::assemble_cells(
 
   // Assemble over cells
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   Progress p(AssemblerBase::progress_message(A.rank(), "cells"),
              mesh.num_cells());
   for (CellIterator cell(mesh); !cell.end(); ++cell)
@@ -174,8 +175,8 @@ void Assembler::assemble_cells(
 
     // Update to current cell
     cell->get_cell_data(ufc_cell);
-    cell->get_vertex_coordinates(vertex_coordinates);
-    ufc.update(*cell, vertex_coordinates, ufc_cell,
+    cell->get_coordinate_dofs(coordinate_dofs);
+    ufc.update(*cell, coordinate_dofs, ufc_cell,
                integral->enabled_coefficients());
 
     // Get local-to-global dof maps for cell
@@ -192,7 +193,7 @@ void Assembler::assemble_cells(
 
     // Tabulate cell tensor
     integral->tabulate_tensor(ufc.A.data(), ufc.w(),
-                              vertex_coordinates.data(),
+                              coordinate_dofs.data(),
                               ufc_cell.orientation);
 
     // Add entries to global tensor. Either store values cell-by-cell
@@ -221,7 +222,8 @@ void Assembler::assemble_exterior_facets(
   Timer timer("Assemble exterior facets");
 
   // Extract mesh
-  const Mesh& mesh = a.mesh();
+  dolfin_assert(a.mesh());
+  const Mesh& mesh = *(a.mesh());
 
   // Form rank
   const std::size_t form_rank = ufc.form.rank();
@@ -249,7 +251,7 @@ void Assembler::assemble_exterior_facets(
 
   // Assemble over exterior facets (the cells of the boundary)
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   Progress p(AssemblerBase::progress_message(A.rank(), "exterior facets"),
              mesh.num_facets());
   for (FacetIterator facet(mesh); !facet.end(); ++facet)
@@ -282,10 +284,10 @@ void Assembler::assemble_exterior_facets(
 
     // Update UFC cell
     mesh_cell.get_cell_data(ufc_cell, local_facet);
-    mesh_cell.get_vertex_coordinates(vertex_coordinates);
+    mesh_cell.get_coordinate_dofs(coordinate_dofs);
 
     // Update UFC object
-    ufc.update(mesh_cell, vertex_coordinates, ufc_cell,
+    ufc.update(mesh_cell, coordinate_dofs, ufc_cell,
                integral->enabled_coefficients());
 
     // Get local-to-global dof maps for cell
@@ -295,7 +297,7 @@ void Assembler::assemble_exterior_facets(
     // Tabulate exterior facet tensor
     integral->tabulate_tensor(ufc.A.data(),
                               ufc.w(),
-                              vertex_coordinates.data(),
+                              coordinate_dofs.data(),
                               local_facet,
                               ufc_cell.orientation);
 
@@ -322,7 +324,8 @@ void Assembler::assemble_interior_facets(
   Timer timer("Assemble interior facets");
 
   // Extract mesh and coefficients
-  const Mesh& mesh = a.mesh();
+  dolfin_assert(a.mesh());
+  const Mesh& mesh = *(a.mesh());
 
   // MPI rank
   const int my_mpi_rank = MPI::rank(mesh.mpi_comm());
@@ -355,7 +358,7 @@ void Assembler::assemble_interior_facets(
 
   // Assemble over interior facets (the facets of the mesh)
   ufc::cell ufc_cell[2];
-  std::vector<double> vertex_coordinates[2];
+  std::vector<double> coordinate_dofs[2];
   Progress p(AssemblerBase::progress_message(A.rank(), "interior facets"),
              mesh.num_facets());
   for (FacetIterator facet(mesh); !facet.end(); ++facet)
@@ -395,12 +398,12 @@ void Assembler::assemble_interior_facets(
 
     // Update to current pair of cells
     cell0.get_cell_data(ufc_cell[0], local_facet0);
-    cell0.get_vertex_coordinates(vertex_coordinates[0]);
+    cell0.get_coordinate_dofs(coordinate_dofs[0]);
     cell1.get_cell_data(ufc_cell[1], local_facet1);
-    cell1.get_vertex_coordinates(vertex_coordinates[1]);
+    cell1.get_coordinate_dofs(coordinate_dofs[1]);
 
-    ufc.update(cell0, vertex_coordinates[0], ufc_cell[0],
-               cell1, vertex_coordinates[1], ufc_cell[1],
+    ufc.update(cell0, coordinate_dofs[0], ufc_cell[0],
+               cell1, coordinate_dofs[1], ufc_cell[1],
                integral->enabled_coefficients());
 
     // Tabulate dofs for each dimension on macro element
@@ -426,8 +429,8 @@ void Assembler::assemble_interior_facets(
     // Tabulate interior facet tensor on macro element
     integral->tabulate_tensor(ufc.macro_A.data(),
                               ufc.macro_w(),
-                              vertex_coordinates[0].data(),
-                              vertex_coordinates[1].data(),
+                              coordinate_dofs[0].data(),
+                              coordinate_dofs[1].data(),
                               local_facet0,
                               local_facet1,
                               ufc_cell[0].orientation,
@@ -468,7 +471,8 @@ void Assembler::assemble_vertices(
   Timer timer("Assemble vertices");
 
   // Extract mesh
-  const Mesh& mesh = a.mesh();
+  dolfin_assert(a.mesh());
+  const Mesh& mesh = *(a.mesh());
 
   // Compute cell and vertex - cell connectivity if not already
   // computed
@@ -479,7 +483,7 @@ void Assembler::assemble_vertices(
 
   // Logics for shared vertices
   const bool has_shared_vertices = mesh.topology().have_shared_entities(0);
-  const std::map<unsigned int, std::set<unsigned int>>&
+  const std::map<std::int32_t, std::set<unsigned int>>&
     shared_vertices = mesh.topology().shared_entities(0);
 
   // Form rank
@@ -559,7 +563,7 @@ void Assembler::assemble_vertices(
 
   // Assemble over vertices
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   Progress p(AssemblerBase::progress_message(A.rank(), "vertices"),
              mesh.num_vertices());
   for (VertexIterator vert(mesh); !vert.end(); ++vert)
@@ -576,7 +580,7 @@ void Assembler::assemble_vertices(
     if (form_rank == 0 && has_shared_vertices)
     {
       // Find shared processes for this global vertex
-      std::map<unsigned int, std::set<unsigned int>>::const_iterator e;
+      std::map<std::int32_t, std::set<unsigned int>>::const_iterator e;
       e = shared_vertices.find(vert->index());
 
       // If vertex is shared and this rank is not the lowest do not
@@ -611,16 +615,16 @@ void Assembler::assemble_vertices(
 
     // Update UFC cell
     mesh_cell.get_cell_data(ufc_cell);
-    mesh_cell.get_vertex_coordinates(vertex_coordinates);
+    mesh_cell.get_coordinate_dofs(coordinate_dofs);
 
     // Update UFC object
-    ufc.update(mesh_cell, vertex_coordinates, ufc_cell,
+    ufc.update(mesh_cell, coordinate_dofs, ufc_cell,
                integral->enabled_coefficients());
 
     // Tabulate vertex tensor
     integral->tabulate_tensor(ufc.A.data(),
                               ufc.w(),
-                              vertex_coordinates.data(),
+                              coordinate_dofs.data(),
                               local_vertex,
                               ufc_cell.orientation);
 
diff --git a/dolfin/fem/Assembler.h b/dolfin/fem/Assembler.h
index 2a3feee..d678ccf 100644
--- a/dolfin/fem/Assembler.h
+++ b/dolfin/fem/Assembler.h
@@ -68,7 +68,7 @@ namespace dolfin
     /// Assemble tensor from given form over cells. This function is
     /// provided for users who wish to build a customized assembler.
     void assemble_cells(GenericTensor& A, const Form& a, UFC& ufc,
-                        std::shared_ptr<const MeshFunction<std::size_t> > domains,
+                        std::shared_ptr<const MeshFunction<std::size_t>> domains,
                         std::vector<double>* values);
 
     /// Assemble tensor from given form over exterior facets. This
@@ -76,7 +76,7 @@ namespace dolfin
     /// assembler.
     void assemble_exterior_facets(GenericTensor& A, const Form& a,
                                   UFC& ufc,
-                                  std::shared_ptr<const MeshFunction<std::size_t> > domains,
+                                  std::shared_ptr<const MeshFunction<std::size_t>> domains,
                                   std::vector<double>* values);
 
     /// Assemble tensor from given form over interior facets. This
@@ -84,14 +84,14 @@ namespace dolfin
     /// assembler.
     void assemble_interior_facets(GenericTensor& A, const Form& a,
                                   UFC& ufc,
-                                  std::shared_ptr<const MeshFunction<std::size_t> > domains,
-                                  std::shared_ptr<const MeshFunction<std::size_t> > cell_domains,
+                                  std::shared_ptr<const MeshFunction<std::size_t>> domains,
+                                  std::shared_ptr<const MeshFunction<std::size_t>> cell_domains,
                                   std::vector<double>* values);
 
     /// Assemble tensor from given form over vertices. This function is
     /// provided for users who wish to build a customized assembler.
     void assemble_vertices(GenericTensor& A, const Form& a, UFC& ufc,
-                           std::shared_ptr<const MeshFunction<std::size_t> > domains);
+                           std::shared_ptr<const MeshFunction<std::size_t>> domains);
 
   };
 
diff --git a/dolfin/fem/AssemblerBase.cpp b/dolfin/fem/AssemblerBase.cpp
index 848b3f0..fb4c1db 100644
--- a/dolfin/fem/AssemblerBase.cpp
+++ b/dolfin/fem/AssemblerBase.cpp
@@ -63,57 +63,34 @@ void AssemblerBase::init_global_tensor(GenericTensor& A, const Form& a)
     tensor_layout = A.factory().create_layout(a.rank());
     dolfin_assert(tensor_layout);
 
-    // Get dimensions
-    std::vector<std::size_t> global_dimensions;
-    std::vector<std::pair<std::size_t, std::size_t>> local_range;
-    std::vector<std::size_t> block_sizes;
+    // Get dimensions and mapping across processes for each dimension
+    std::vector<std::shared_ptr<const IndexMap>> index_maps;
     for (std::size_t i = 0; i < a.rank(); i++)
     {
       dolfin_assert(dofmaps[i]);
-      global_dimensions.push_back(dofmaps[i]->global_dimension());
-      local_range.push_back(dofmaps[i]->ownership_range());
-      block_sizes.push_back(dofmaps[i]->block_size);
+      index_maps.push_back(dofmaps[i]->index_map());
     }
 
-    // Set block size for sparsity graphs
-    std::size_t block_size = 1;
-    if (a.rank() == 2)
-    {
-      const std::vector<std::size_t> _bs(a.rank(), dofmaps[0]->block_size);
-      block_size = (block_sizes == _bs) ? dofmaps[0]->block_size : 1;
-    }
+    // Get mesh
+    dolfin_assert(a.mesh());
+    const Mesh& mesh = *(a.mesh());
 
     // Initialise tensor layout
-    tensor_layout->init(a.mesh().mpi_comm(), global_dimensions, block_size,
-                        local_range);
+    // FIXME: somewhere need to check block sizes are same on both axes
+    // NOTE: Jan: that will be done on the backend side; IndexMap will
+    //            provide tabulate functions with arbitrary block size;
+    //            moreover the functions will tabulate directly using a
+    //            correct int type
 
-    if (a.rank() > 0)
-    {
-      tensor_layout->local_to_global_map.resize(a.rank());
-      for (std::size_t i = 0; i < a.rank(); ++i)
-      {
-        const std::size_t bs = dofmaps[i]->block_size;
-        const std::size_t local_size
-          = local_range[i].second - local_range[i].first;
-        const std::vector<std::size_t>& local_to_global_unowned
-          = dofmaps[i]->local_to_global_unowned();
-        tensor_layout->local_to_global_map[i].resize(local_size
-                                                  + bs*local_to_global_unowned.size());
-        for (std::size_t j = 0;
-             j < tensor_layout->local_to_global_map[i].size(); ++j)
-        {
-          tensor_layout->local_to_global_map[i][j]
-            = dofmaps[i]->local_to_global_index(j);
-        }
-      }
-    }
+    tensor_layout->init(mesh.mpi_comm(), index_maps,
+                        TensorLayout::Ghosts::UNGHOSTED);
 
     // Build sparsity pattern if required
     if (tensor_layout->sparsity_pattern())
     {
-      GenericSparsityPattern& pattern = *tensor_layout->sparsity_pattern();
+      SparsityPattern& pattern = *tensor_layout->sparsity_pattern();
       SparsityPatternBuilder::build(pattern,
-                                a.mesh(), dofmaps,
+                                mesh, dofmaps,
                                 a.ufc_form()->has_cell_integrals(),
                                 a.ufc_form()->has_interior_facet_integrals(),
                                 a.ufc_form()->has_exterior_facet_integrals(),
@@ -127,10 +104,10 @@ void AssemblerBase::init_global_tensor(GenericTensor& A, const Form& a)
     A.init(*tensor_layout);
     t1.stop();
 
-    // Insert zeros on the diagonal as diagonal entries may be prematurely
-    // optimised away by the linear algebra backend when calling
-    // GenericMatrix::apply, e.g. PETSc does this then errors when matrices
-    // have no diagonal entry inserted.
+    // Insert zeros on the diagonal as diagonal entries may be
+    // prematurely optimised away by the linear algebra backend when
+    // calling GenericMatrix::apply, e.g. PETSc does this then errors
+    // when matrices have no diagonal entry inserted.
     if (A.rank() == 2 && keep_diagonal)
     {
       // Down cast to GenericMatrix
@@ -178,7 +155,8 @@ void AssemblerBase::check(const Form& a)
   a.check();
 
   // Extract mesh and coefficients
-  const Mesh& mesh = a.mesh();
+  dolfin_assert(a.mesh());
+  const Mesh& mesh = *(a.mesh());
   const std::vector<std::shared_ptr<const GenericFunction>>
     coefficients = a.coefficients();
 
@@ -232,33 +210,71 @@ You might have forgotten to specify the value dimension correctly in an Expressi
     }
   }
 
-  // Check that the cell dimension matches the mesh dimension
-  if (a.rank() + a.ufc_form()->num_coefficients() > 0)
+  // Check that the coordinate cell matches the mesh
+  std::unique_ptr<ufc::finite_element>
+    coordinate_element(a.ufc_form()->create_coordinate_finite_element());
+  dolfin_assert(coordinate_element);
+  dolfin_assert(coordinate_element->value_rank() == 1);
+  if (coordinate_element->value_dimension(0) != mesh.geometry().dim())
   {
-    std::unique_ptr<ufc::finite_element>
-      element(a.ufc_form()->create_finite_element(0));
-    dolfin_assert(element);
-    if (mesh.type().cell_type() == CellType::interval && element->cell_shape()
-        != ufc::interval)
+    dolfin_error("AssemblerBase.cpp",
+                 "assemble form",
+                 "Geometric dimension of Mesh does not match value shape of coordinate element in form");
+  }
+  /* TODO: Wanted to check this but we don't have degree() available in ufc::finite_element.
+  if (coordinate_element->degree() != mesh.geometry().degree())
+  {
+    dolfin_error("AssemblerBase.cpp",
+                 "assemble form",
+                 "Mesh geometry degree does not match degree of coordinate element in form");
+  }
+  */
+  switch (mesh.type().cell_type())
+  {
+  case CellType::interval:
+    if (coordinate_element->cell_shape() != ufc::shape::interval)
     {
       dolfin_error("AssemblerBase.cpp",
                    "assemble form",
                    "Mesh cell type (intervals) does not match cell type of form");
     }
-    if (mesh.type().cell_type() == CellType::triangle && element->cell_shape()
-        != ufc::triangle)
+    break;
+  case CellType::triangle:
+    if (coordinate_element->cell_shape() != ufc::shape::triangle)
     {
       dolfin_error("AssemblerBase.cpp",
                    "assemble form",
                    "Mesh cell type (triangles) does not match cell type of form");
     }
-    if (mesh.type().cell_type() == CellType::tetrahedron
-        && element->cell_shape() != ufc::tetrahedron)
+    break;
+  case CellType::tetrahedron:
+    if (coordinate_element->cell_shape() != ufc::shape::tetrahedron)
     {
       dolfin_error("AssemblerBase.cpp",
                    "assemble form",
                    "Mesh cell type (tetrahedra) does not match cell type of form");
     }
+    break;
+  case CellType::quadrilateral:
+    if (coordinate_element->cell_shape() != ufc::shape::quadrilateral)
+    {
+      dolfin_error("AssemblerBase.cpp",
+                   "assemble form",
+                   "Mesh cell type (quadrilateral) does not match cell type of form");
+    }
+    break;
+  case CellType::hexahedron:
+    if (coordinate_element->cell_shape() != ufc::shape::hexahedron)
+    {
+      dolfin_error("AssemblerBase.cpp",
+                   "assemble form",
+                   "Mesh cell type (hexahedron) does not match cell type of form");
+    }
+    break;
+  default:
+    dolfin_error("AssemblerBase.cpp",
+                 "assemble form",
+                 "Mesh cell type is unknown!");
   }
 
   // Check that the mesh is ordered
diff --git a/dolfin/fem/BasisFunction.h b/dolfin/fem/BasisFunction.h
index e4bcfc6..7803bf1 100644
--- a/dolfin/fem/BasisFunction.h
+++ b/dolfin/fem/BasisFunction.h
@@ -21,8 +21,9 @@
 #ifndef __BASIS_FUNCTION_H
 #define __BASIS_FUNCTION_H
 
+#include <memory>
+#include <vector>
 #include <ufc.h>
-#include <dolfin/common/types.h>
 #include <dolfin/fem/FiniteElement.h>
 
 namespace dolfin
@@ -32,12 +33,12 @@ namespace dolfin
   /// used for computation of basis function values and derivatives.
   ///
   /// Evaluation of basis functions is also possible through the use
-  /// of the functions ``evaluate_basis`` and ``evaluate_basis_derivatives``
-  /// available in the _FiniteElement_ class. The BasisFunction class
-  /// relies on these functions for evaluation but also implements the
-  /// ufc::function interface which allows evaluate_dof to be
-  /// evaluated for a basis function (on a possibly different
-  /// element).
+  /// of the functions ``evaluate_basis`` and
+  /// ``evaluate_basis_derivatives`` available in the _FiniteElement_
+  /// class. The BasisFunction class relies on these functions for
+  /// evaluation but also implements the ufc::function interface which
+  /// allows evaluate_dof to be evaluated for a basis function (on a
+  /// possibly different element).
 
   class BasisFunction : public ufc::function
   {
@@ -52,14 +53,22 @@ namespace dolfin
     ///         The element to create basis function on.
     ///     cell (ufc::cell)
     ///         The cell.
-    BasisFunction(std::size_t index, const FiniteElement& element,
-                  const std::vector<double>& vertex_coordinates)
-      : _index(index), _element(element),
-      _vertex_coordinates(vertex_coordinates) {}
+    BasisFunction(std::size_t index,
+                  std::shared_ptr<const FiniteElement> element,
+                  const std::vector<double>& coordinate_dofs)
+      : _index(index), _element(element), _coordinate_dofs(coordinate_dofs) {}
 
     /// Destructor
     ~BasisFunction() {}
 
+    /// Update the basis function index
+    ///
+    /// *Arguments*
+    ///     index (std::size_t)
+    ///         The index of the basis function.
+    void update_index(std::size_t index)
+    { _index = index; }
+
     /// Evaluate basis function at given point
     ///
     /// *Arguments*
@@ -70,8 +79,8 @@ namespace dolfin
     void eval(double* values, const double* x) const
     {
       // Note: assuming cell_orientation = 0
-      _element.evaluate_basis(_index, values, x, _vertex_coordinates.data(),
-                              0);
+      dolfin_assert(_element);
+      _element->evaluate_basis(_index, values, x, _coordinate_dofs.data(), 0);
     }
 
     /// Evaluate all order n derivatives at given point
@@ -86,8 +95,9 @@ namespace dolfin
     void eval_derivatives(double* values, const double* x, std::size_t n) const
     {
       // Note: assuming cell_orientation = 0
-      _element.evaluate_basis_derivatives(_index, n, values, x,
-                                          _vertex_coordinates.data(), 0);
+      dolfin_assert(_element);
+      _element->evaluate_basis_derivatives(_index, n, values, x,
+                                           _coordinate_dofs.data(), 0);
     }
 
     //--- Implementation of ufc::function interface ---
@@ -101,8 +111,7 @@ namespace dolfin
     ///         The coordinates of the point.
     ///     cell (ufc::cell)
     ///         The cell.
-    void evaluate(double* values,
-                  const double* coordinates,
+    void evaluate(double* values, const double* coordinates,
                   const ufc::cell& cell) const
     { eval(values, coordinates); }
 
@@ -112,10 +121,10 @@ namespace dolfin
     std::size_t _index;
 
     // The finite element
-    const FiniteElement& _element;
+    std::shared_ptr<const FiniteElement> _element;
 
-    // Cell vertex coordinates
-    const std::vector<double> _vertex_coordinates;
+    // Cell coordinates
+    const std::vector<double> _coordinate_dofs;
 
   };
 
diff --git a/dolfin/fem/DirichletBC.cpp b/dolfin/fem/DirichletBC.cpp
index 2f2a45d..83202f0 100644
--- a/dolfin/fem/DirichletBC.cpp
+++ b/dolfin/fem/DirichletBC.cpp
@@ -24,9 +24,10 @@
 // First added:  2007-04-10
 // Last changed: 2014-01-23
 
-#include <map>
 #include <cinttypes>
+#include <cmath>
 #include <cstdlib>
+#include <map>
 #include <utility>
 #include <ufc.h>
 
@@ -64,22 +65,6 @@ const std::set<std::string> DirichletBC::methods
 = {"topological", "geometric", "pointwise"};
 
 //-----------------------------------------------------------------------------
-DirichletBC::DirichletBC(const FunctionSpace& V,
-                         const GenericFunction& g,
-                         const SubDomain& sub_domain,
-                         std::string method,
-                         bool check_midpoint)
-  : Hierarchical<DirichletBC>(*this),
-    _function_space(reference_to_no_delete_pointer(V)),
-    _g(reference_to_no_delete_pointer(g)),
-    _method(method),
-    _user_sub_domain(reference_to_no_delete_pointer(sub_domain)),
-    _check_midpoint(check_midpoint)
-{
-  check();
-  parameters = default_parameters();
-}
-//-----------------------------------------------------------------------------
 DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace> V,
                          std::shared_ptr<const GenericFunction> g,
                          std::shared_ptr<const SubDomain> sub_domain,
@@ -87,20 +72,7 @@ DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace> V,
                          bool check_midpoint)
   : Hierarchical<DirichletBC>(*this), _function_space(V), _g(g),
     _method(method), _user_sub_domain(sub_domain),
-    _check_midpoint(check_midpoint)
-{
-  check();
-  parameters = default_parameters();
-}
-//-----------------------------------------------------------------------------
-DirichletBC::DirichletBC(const FunctionSpace& V, const GenericFunction& g,
-                         const MeshFunction<std::size_t>& sub_domains,
-                         std::size_t sub_domain, std::string method)
-  : Hierarchical<DirichletBC>(*this),
-    _function_space(reference_to_no_delete_pointer(V)),
-    _g(reference_to_no_delete_pointer(g)), _method(method),
-    _user_mesh_function(reference_to_no_delete_pointer(sub_domains)),
-    _user_sub_domain_marker(sub_domain), _check_midpoint(true)
+    _num_dofs(0), _check_midpoint(check_midpoint)
 {
   check();
   parameters = default_parameters();
@@ -112,30 +84,19 @@ DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace> V,
                          std::size_t sub_domain,
                          std::string method)
   : Hierarchical<DirichletBC>(*this), _function_space(V), _g(g),
-    _method(method), _user_mesh_function(sub_domains),
+    _method(method), _num_dofs(0), _user_mesh_function(sub_domains),
     _user_sub_domain_marker(sub_domain), _check_midpoint(true)
 {
   check();
   parameters = default_parameters();
 }
 //-----------------------------------------------------------------------------
-DirichletBC::DirichletBC(const FunctionSpace& V, const GenericFunction& g,
-                         std::size_t sub_domain, std::string method)
-  : Hierarchical<DirichletBC>(*this),
-    _function_space(reference_to_no_delete_pointer(V)),
-    _g(reference_to_no_delete_pointer(g)), _method(method),
-    _user_sub_domain_marker(sub_domain),
-    _check_midpoint(true)
-{
-  check();
-  parameters = default_parameters();
-}
-//-----------------------------------------------------------------------------
 DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace> V,
                          std::shared_ptr<const GenericFunction> g,
                          std::size_t sub_domain, std::string method)
   : Hierarchical<DirichletBC>(*this), _function_space(V), _g(g),
-    _method(method), _user_sub_domain_marker(sub_domain), _check_midpoint(true)
+    _method(method), _num_dofs(0), _user_sub_domain_marker(sub_domain),
+    _check_midpoint(true)
 {
   check();
   parameters = default_parameters();
@@ -146,8 +107,8 @@ DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace> V,
                          const std::vector<std::size_t>& markers,
                          std::string method)
   : Hierarchical<DirichletBC>(*this), _function_space(V), _g(g),
-    _method(method), _facets(markers), _user_sub_domain_marker(0),
-    _check_midpoint(true)
+    _method(method), _num_dofs(0), _facets(markers),
+    _user_sub_domain_marker(0), _check_midpoint(true)
 {
   check();
   parameters = default_parameters();
@@ -170,6 +131,7 @@ const DirichletBC& DirichletBC::operator= (const DirichletBC& bc)
   _g = bc._g;
   _method = bc._method;
   _user_sub_domain = bc._user_sub_domain;
+  _num_dofs = bc._num_dofs;
   _facets = bc._facets;
   _cells_to_localdofs = bc._cells_to_localdofs;
   _user_mesh_function = bc._user_mesh_function;
@@ -222,7 +184,7 @@ void DirichletBC::gather(Map& boundary_values) const
   dolfin_assert(_function_space->dofmap());
   const GenericDofMap& dofmap = *_function_space->dofmap();
   const auto& shared_nodes = dofmap.shared_nodes();
-  const int bs = dofmap.block_size;
+  const int bs = dofmap.block_size();
 
   // Create list of boundary values to send to each processor
   std::vector<std::vector<std::size_t>> proc_map0(comm_size);
@@ -241,7 +203,7 @@ void DirichletBC::gather(Map& boundary_values) const
       for (auto proc = shared_node->second.begin();
            proc != shared_node->second.end(); ++proc)
       {
-        proc_map0[*proc].push_back(dofmap.local_to_global_index(bv->first));
+        proc_map0[*proc].push_back(dofmap.index_map()->local_to_global(bv->first));
         proc_map1[*proc].push_back(bv->second);
       }
     }
@@ -257,6 +219,12 @@ void DirichletBC::gather(Map& boundary_values) const
   const std::size_t n1 = dofmap.ownership_range().second;
   const std::size_t owned_size = n1 - n0;
 
+  // Reserve space
+  std::size_t num_dofs = boundary_values.size();
+  for (std::size_t p = 0; p < comm_size; ++p)
+    num_dofs += received_bvc0[p].size();
+  boundary_values.reserve(num_dofs);
+
   // Add the received boundary values to the local boundary values
   for (std::size_t p = 0; p < comm_size; ++p)
   {
@@ -278,20 +246,24 @@ void DirichletBC::gather(Map& boundary_values) const
         const std::imaxdiv_t div = std::imaxdiv(_vec[i].first, bs);
         const std::size_t node = div.quot;
         const int component = div.rem;
+        const std::vector<std::size_t>& local_to_global
+          = dofmap.index_map()->local_to_global_unowned();
 
         // Case 1: dof is not owned by this process
-        auto it = std::find(dofmap.local_to_global_unowned().begin(),
-                            dofmap.local_to_global_unowned().end(),
+        auto it = std::find(local_to_global.begin(),
+                            local_to_global.end(),
                             node);
-        if (it == dofmap.local_to_global_unowned().end())
+        if (it == local_to_global.end())
         {
           // Throw error if dof is not in local map
-          error("Cannot find dof in local_to_global_unowned array");
+          dolfin_error("DirichletBC.cpp",
+                       "gather boundary values",
+                       "Cannot find dof in local_to_global_unowned array");
         }
         else
         {
           const std::size_t pos
-            = std::distance(dofmap.local_to_global_unowned().begin(), it);
+            = std::distance(local_to_global.begin(), it);
           _vec[i].first = owned_size + bs*pos + component;
         }
       }
@@ -301,15 +273,14 @@ void DirichletBC::gather(Map& boundary_values) const
   }
 }
 //-----------------------------------------------------------------------------
-void DirichletBC::get_boundary_values(Map& boundary_values,
-                                      std::string method) const
+void DirichletBC::get_boundary_values(Map& boundary_values) const
 {
   // Create local data
   dolfin_assert(_function_space);
   LocalData data(*_function_space);
 
   // Compute dofs and values
-  compute_bc(boundary_values, data, method);
+  compute_bc(boundary_values, data, _method);
 }
 //-----------------------------------------------------------------------------
 void DirichletBC::zero(GenericMatrix& A) const
@@ -342,7 +313,7 @@ void DirichletBC::zero_columns(GenericMatrix& A,
                                double diag_val) const
 {
   Map bv_map;
-  get_boundary_values(bv_map, _method);
+  get_boundary_values(bv_map);
 
   // Create lookup table of dofs
   //const std::size_t nrows = A.size(0); // should be equal to b.size()
@@ -430,80 +401,6 @@ std::shared_ptr<const SubDomain> DirichletBC::user_sub_domain() const
   return _user_sub_domain;
 }
 //-----------------------------------------------------------------------------
-bool DirichletBC::is_compatible(GenericFunction& v) const
-{
-  // This function only checks the values at vertices when it should
-  // really check that the dof functionals agree. The check here is
-  // neither necessary nor sufficient to guarantee compatible boundary
-  // boundary conditions but a more robust test requires access to the
-  // function space.
-
-  dolfin_error("DirichletBC.cpp",
-               "call is_compatible",
-               "This function has not been updated for the new Function class interface");
-
-  /*
-  // Compute value size
-  std::size_t size = 1;
-  const std::size_t rank = g->function_space().element()->value_rank();
-  for (std::size_t i = 0; i < rank ; i++)
-    size *= g->function_space().element()->value_dimension(i);
-  double* g_values = new double[size];
-  double* v_values = new double[size];
-
-  // Get mesh
-  const Mesh& mesh = _function_space->mesh();
-
-  // Iterate over facets
-  for (std::size_t f = 0; f < facets.size(); f++)
-  {
-    // Create cell and facet
-    std::size_t cell_number  = facets[f].first;
-    std::size_t facet_number = facets[f].second;
-    Cell cell(mesh, cell_number);
-    Facet facet(mesh, facet_number);
-
-    // Make cell and facet available to user-defined function
-    dolfin_error("DirichletBC.cpp",
-                 "add proper message here",
-                 "Does the new GenericFunction class need an 'update' function?");
-    //g->update(cell, facet_number);
-    //v.update(cell, facet_number);
-
-    // Iterate over facet vertices
-    for (VertexIterator vertex(facet); !vertex.end(); ++vertex)
-    {
-      // Evaluate g and v at vertex
-      g->eval(g_values, vertex->x());
-      v.eval(v_values, vertex->x());
-
-      // Check values
-      for (std::size_t i = 0; i < size; i++)
-      {
-        if (std::abs(g_values[i] - v_values[i]) > DOLFIN_EPS)
-        {
-          Point p(mesh.geometry().dim(), vertex->x());
-          cout << "Incompatible function value " << v_values[i] << " at x = " << p << ", should be " << g_values[i] << "." << endl;
-          delete [] g_values;
-          delete [] v_values;
-          return false;
-        }
-      }
-    }
-  }
-
-  delete [] g_values;
-  delete [] v_values;
-  */
-
-  return true;
-}
-//-----------------------------------------------------------------------------
-void DirichletBC::set_value(const GenericFunction& g)
-{
-  _g = reference_to_no_delete_pointer(g);
-}
-//-----------------------------------------------------------------------------
 void DirichletBC::homogenize()
 {
   const std::size_t value_rank = _g->value_rank();
@@ -734,16 +631,17 @@ void DirichletBC::init_from_sub_domain(std::shared_ptr<const SubDomain>
   // FIXME: mainly for convenience (we may reuse mark() in SubDomain).
 
   dolfin_assert(_function_space->mesh());
-  const Mesh& mesh = *_function_space->mesh();
+  std::shared_ptr<const Mesh> mesh = _function_space->mesh();
+  dolfin_assert(mesh);
 
   // Create mesh function for sub domain markers on facets and mark
   // all facet as subdomain 1
-  const std::size_t dim = mesh.topology().dim();
+  const std::size_t dim = mesh->topology().dim();
   _function_space->mesh()->init(dim - 1);
   FacetFunction<std::size_t> sub_domains(mesh, 1);
 
   // Set geometric dimension (needed for SWIG interface)
-  sub_domain->_geometric_dimension = mesh.geometry().dim();
+  sub_domain->_geometric_dimension = mesh->geometry().dim();
 
   // Mark the sub domain as sub domain 0
   sub_domain->mark(sub_domains, 0, _check_midpoint);
@@ -774,11 +672,11 @@ void DirichletBC::init_from_mesh_function(const MeshFunction<std::size_t>& sub_d
 //-----------------------------------------------------------------------------
 void DirichletBC::init_from_mesh(std::size_t sub_domain) const
 {
-  // For this to work, the mesh *needs* to be ordered according to
-  // the UFC ordering before it gets here. So reordering the mesh
-  // here will either have no effect (if the mesh is already ordered
-  // or it won't do anything good (since the markers are wrong anyway).
-  // In conclusion: we don't need to order the mesh here.
+  // For this to work, the mesh *needs* to be ordered according to the
+  // UFC ordering before it gets here. So reordering the mesh here
+  // will either have no effect (if the mesh is already ordered or it
+  // won't do anything good (since the markers are wrong anyway).  In
+  // conclusion: we don't need to order the mesh here.
 
   dolfin_assert(_function_space->mesh());
   const Mesh& mesh = *_function_space->mesh();
@@ -854,7 +752,11 @@ void DirichletBC::compute_bc_topological(Map& boundary_values,
 
   // Create UFC cell
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
+
+  // Allocate space
+  boundary_values.reserve(boundary_values.size()
+                          + _facets.size()*dofmap.num_facet_dofs());
 
   // Iterate over marked
   dolfin_assert(_function_space->element());
@@ -876,12 +778,12 @@ void DirichletBC::compute_bc_topological(Map& boundary_values,
     const size_t facet_local_index = cell.index(facet);
 
     // Update UFC cell geometry data
-    cell.get_vertex_coordinates(vertex_coordinates);
+    cell.get_coordinate_dofs(coordinate_dofs);
     cell.get_cell_data(ufc_cell, facet_local_index);
 
     // Restrict coefficient to cell
     _g->restrict(data.w.data(), *_function_space->element(), cell,
-                 vertex_coordinates.data(), ufc_cell);
+                 coordinate_dofs.data(), ufc_cell);
 
     // Tabulate dofs on cell
     const ArrayView<const dolfin::la_index> cell_dofs
@@ -927,6 +829,10 @@ void DirichletBC::compute_bc_geometric(Map& boundary_values,
   dolfin_assert(_function_space->dofmap());
   const GenericDofMap& dofmap = *_function_space->dofmap();
 
+  // Get finite element
+  dolfin_assert(_function_space->element());
+  const FiniteElement& element = *_function_space->element();
+
   // Initialize facets, needed for geometric search
   log(TRACE, "Computing facets, needed for geometric application of boundary conditions.");
   mesh.init(mesh.topology().dim() - 1);
@@ -938,6 +844,10 @@ void DirichletBC::compute_bc_geometric(Map& boundary_values,
 
   const std::size_t D = mesh.topology().dim();
 
+  // Allocate space using cached size
+  if (_num_dofs > 0)
+    boundary_values.reserve(boundary_values.size() + _num_dofs);
+
   // Iterate over facets
   Progress p("Computing Dirichlet boundary values, geometric search",
              _facets.size());
@@ -954,7 +864,7 @@ void DirichletBC::compute_bc_geometric(Map& boundary_values,
 
     // Create UFC cell object and vertex coordinate holder
     ufc::cell ufc_cell;
-    std::vector<double> vertex_coordinates;
+    std::vector<double> coordinate_dofs;
 
     // Loop the vertices associated with the facet
     for (VertexIterator vertex(facet); !vertex.end(); ++vertex)
@@ -962,7 +872,7 @@ void DirichletBC::compute_bc_geometric(Map& boundary_values,
       // Loop the cells associated with the vertex
       for (CellIterator c(*vertex); !c.end(); ++c)
       {
-        c->get_vertex_coordinates(vertex_coordinates);
+        c->get_coordinate_dofs(coordinate_dofs);
         c->get_cell_data(ufc_cell, local_facet);
 
         bool tabulated = false;
@@ -980,8 +890,8 @@ void DirichletBC::compute_bc_geometric(Map& boundary_values,
           // Tabulate coordinates if not already done
           if (!tabulated)
           {
-            dofmap.tabulate_coordinates(data.coordinates, vertex_coordinates,
-                                        *c);
+            element.tabulate_dof_coordinates(data.coordinates, coordinate_dofs,
+                                             *c);
             tabulated = true;
           }
 
@@ -1001,7 +911,7 @@ void DirichletBC::compute_bc_geometric(Map& boundary_values,
           if (!interpolated)
           {
             _g->restrict(data.w.data(), *_function_space->element(), cell,
-                         vertex_coordinates.data(), ufc_cell);
+                         coordinate_dofs.data(), ufc_cell);
             interpolated = true;
           }
 
@@ -1012,15 +922,14 @@ void DirichletBC::compute_bc_geometric(Map& boundary_values,
       }
     }
   }
+
+  // Store num of bc dofs for better performance next time
+  _num_dofs = boundary_values.size();
 }
 //-----------------------------------------------------------------------------
 void DirichletBC::compute_bc_pointwise(Map& boundary_values,
                                        LocalData& data) const
 {
-  dolfin_assert(_function_space);
-  dolfin_assert(_function_space->element());
-  dolfin_assert(_g);
-
   if (!_user_sub_domain)
   {
     dolfin_error("DirichletBC.cpp",
@@ -1028,11 +937,16 @@ void DirichletBC::compute_bc_pointwise(Map& boundary_values,
                  "A SubDomain is required for pointwise search");
   }
 
-  // Get mesh and dofmap
-  dolfin_assert(_function_space->mesh());
+  dolfin_assert(_g);
+
+// Get mesh, dofmap and element
+  dolfin_assert(_function_space);
   dolfin_assert(_function_space->dofmap());
-  const Mesh& mesh = *_function_space->mesh();
+  dolfin_assert(_function_space->element());
+  dolfin_assert(_function_space->mesh());
   const GenericDofMap& dofmap = *_function_space->dofmap();
+  const FiniteElement& element = *_function_space->element();
+  const Mesh& mesh = *_function_space->mesh();
 
   // Geometric dim
   const std::size_t gdim = mesh.geometry().dim();
@@ -1045,29 +959,34 @@ void DirichletBC::compute_bc_pointwise(Map& boundary_values,
                                  ? std::pair<std::size_t, std::size_t>(0,0)
                                  : dofmap.ownership_range());
 
+  // Allocate space using cached size
+  if (_num_dofs > 0)
+    boundary_values.reserve(boundary_values.size() + _num_dofs);
+
   // Iterate over cells
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   if (MPI::max(mesh.mpi_comm(), _cells_to_localdofs.size()) == 0)
   {
-    // First time around all cells must be iterated over.
-    // Create map from cells attached to boundary to local dofs.
+    // First time around all cells must be iterated over.  Create map
+    // from cells attached to boundary to local dofs.
     Progress p("Computing Dirichlet boundary values, pointwise search",
                mesh.num_cells());
     for (CellIterator cell(mesh); !cell.end(); ++cell)
     {
       // Update UFC cell
-      cell->get_vertex_coordinates(vertex_coordinates);
+      cell->get_coordinate_dofs(coordinate_dofs);
       cell->get_cell_data(ufc_cell);
 
       // Tabulate coordinates of dofs on cell
-      dofmap.tabulate_coordinates(data.coordinates, vertex_coordinates,
-                                  *cell);
+      element.tabulate_dof_coordinates(data.coordinates, coordinate_dofs,
+                                       *cell);
 
       // Tabulate dofs on cell
       const ArrayView<const dolfin::la_index> cell_dofs
         = dofmap.cell_dofs(cell->index());
 
-      // Interpolate function only once and only on cells where necessary
+      // Interpolate function only once and only on cells where
+      // necessary
       bool already_interpolated = false;
 
       // Loop all dofs on cell
@@ -1095,9 +1014,10 @@ void DirichletBC::compute_bc_pointwise(Map& boundary_values,
 
           // Restrict coefficient to cell
           _g->restrict(data.w.data(), *_function_space->element(), *cell,
-                      vertex_coordinates.data(), ufc_cell);
+                      coordinate_dofs.data(), ufc_cell);
 
-          // Put cell index in storage for next time function is called
+          // Put cell index in storage for next time function is
+          // called
           _cells_to_localdofs.insert(std::make_pair(cell->index(), dofs));
         }
 
@@ -1113,7 +1033,7 @@ void DirichletBC::compute_bc_pointwise(Map& boundary_values,
   }
   else
   {
-    // Loop over cells that contain dofs on boundary.
+    // Loop over cells that contain dofs on boundary
     std::map<std::size_t, std::vector<std::size_t>>::const_iterator it;
     for (it = _cells_to_localdofs.begin(); it != _cells_to_localdofs.end();
          ++it)
@@ -1122,16 +1042,16 @@ void DirichletBC::compute_bc_pointwise(Map& boundary_values,
       const Cell cell(mesh, it->first);
 
       // Update UFC cell
-      cell.get_vertex_coordinates(vertex_coordinates);
+      cell.get_coordinate_dofs(coordinate_dofs);
       cell.get_cell_data(ufc_cell);
 
       // Tabulate coordinates of dofs on cell
-      dofmap.tabulate_coordinates(data.coordinates, vertex_coordinates,
-                                  cell);
+      element.tabulate_dof_coordinates(data.coordinates, coordinate_dofs,
+                                       cell);
 
       // Restrict coefficient to cell
       _g->restrict(data.w.data(), *_function_space->element(), cell,
-                    vertex_coordinates.data(), ufc_cell);
+                    coordinate_dofs.data(), ufc_cell);
 
       // Tabulate dofs on cell
       const ArrayView<const dolfin::la_index> cell_dofs
@@ -1149,6 +1069,9 @@ void DirichletBC::compute_bc_pointwise(Map& boundary_values,
       }
     }
   }
+
+  // Store num of bc dofs for better performance next time
+  _num_dofs = boundary_values.size();
 }
 //-----------------------------------------------------------------------------
 bool DirichletBC::on_facet(const double* coordinates, const Facet& facet) const
diff --git a/dolfin/fem/DirichletBC.h b/dolfin/fem/DirichletBC.h
index a64bc1a..380b19a 100644
--- a/dolfin/fem/DirichletBC.h
+++ b/dolfin/fem/DirichletBC.h
@@ -134,24 +134,6 @@ namespace dolfin
     ///
     /// *Arguments*
     ///     V (_FunctionSpace_)
-    ///         The function space.
-    ///     g (_GenericFunction_)
-    ///         The value.
-    ///     sub_domain (_SubDomain_)
-    ///         The subdomain.
-    ///     method (std::string)
-    ///         Optional argument: A string specifying
-    ///         the method to identify dofs.
-    DirichletBC(const FunctionSpace& V,
-                const GenericFunction& g,
-                const SubDomain& sub_domain,
-                std::string method="topological",
-                bool check_midpoint=true);
-
-    /// Create boundary condition for subdomain
-    ///
-    /// *Arguments*
-    ///     V (_FunctionSpace_)
     ///         The function space
     ///     g (_GenericFunction_)
     ///         The value
@@ -180,49 +162,13 @@ namespace dolfin
     ///     method (std::string)
     ///         Optional argument: A string specifying the
     ///         method to identify dofs.
-    DirichletBC(const FunctionSpace& V,
-                const GenericFunction& g,
-                const MeshFunction<std::size_t>& sub_domains,
-                std::size_t sub_domain,
-                std::string method="topological");
-
-    /// Create boundary condition for subdomain specified by index
-    ///
-    /// *Arguments*
-    ///     V (_FunctionSpace_)
-    ///         The function space.
-    ///     g (_GenericFunction_)
-    ///         The value.
-    ///     sub_domains (_MeshFunction_ <std::size_t>)
-    ///         Subdomain markers
-    ///     sub_domain (std::size_t)
-    ///         The subdomain index (number)
-    ///     method (std::string)
-    ///         Optional argument: A string specifying the
-    ///         method to identify dofs.
     DirichletBC(std::shared_ptr<const FunctionSpace> V,
                 std::shared_ptr<const GenericFunction> g,
-                std::shared_ptr<const MeshFunction<std::size_t> > sub_domains,
-                std::size_t sub_domain,
-                std::string method="topological");
-
-    /// Create boundary condition for boundary data included in the mesh
-    ///
-    /// *Arguments*
-    ///     V (_FunctionSpace_)
-    ///         The function space.
-    ///     g (_GenericFunction_)
-    ///         The value.
-    ///     sub_domain (std::size_t)
-    ///         The subdomain index (number)
-    ///     method (std::string)
-    ///         Optional argument: A string specifying the
-    ///         method to identify dofs.
-    DirichletBC(const FunctionSpace& V,
-                const GenericFunction& g,
+                std::shared_ptr<const MeshFunction<std::size_t>> sub_domains,
                 std::size_t sub_domain,
                 std::string method="topological");
 
+    // TODO: Remove/deprecate this function
     /// Create boundary condition for boundary data included in the mesh
     ///
     /// *Arguments*
@@ -328,11 +274,7 @@ namespace dolfin
     /// *Arguments*
     ///     boundary_values (std::unordered_map<std::size_t, double>)
     ///         Map from dof to boundary value.
-    ///     method (std::string)
-    ///         Optional argument: A string specifying which
-    ///         method to use.
-    void get_boundary_values(Map& boundary_values,
-                             std::string method="default") const;
+    void get_boundary_values(Map& boundary_values) const;
 
     /// Get boundary values from neighbour processes. If a method other than
     /// "pointwise" is used, this is necessary to ensure all boundary dofs are
@@ -368,7 +310,7 @@ namespace dolfin
     /// Return boundary markers
     ///
     /// *Returns*
-    ///     std::vector<std::pair<std::size_t, std::size_t> >
+    ///     std::vector<std::pair<std::size_t, std::size_t>>
     ///         Boundary markers (facets stored as pairs of cells and
     ///         local facet numbers).
     const std::vector<std::size_t>& markers() const;
@@ -395,26 +337,6 @@ namespace dolfin
     ///         Shared pointer to subdomain.
     std::shared_ptr<const SubDomain> user_sub_domain() const;
 
-    /// Check if given function is compatible with boundary condition
-    /// (checking only vertex values)
-    ///
-    /// *Arguments*
-    ///     v (_GenericFunction_)
-    ///         The function to check for compatibility
-    ///         with boundary condition.
-    ///
-    /// *Returns*
-    ///     bool
-    ///         True if compatible.
-    bool is_compatible(GenericFunction& v) const;
-
-    /// Set value g for boundary condition, domain remains unchanged
-    ///
-    /// *Arguments*
-    ///     g (_GenericFunction_)
-    ///         The value.
-    void set_value(const GenericFunction& g);
-
     /// Set value g for boundary condition, domain remains unchanged
     ///
     /// *Arguments*
@@ -466,8 +388,8 @@ namespace dolfin
     // Initialize sub domain markers from mesh
     void init_from_mesh(std::size_t sub_domain) const;
 
-    // Compute dofs and values for application of boundary conditions using
-    // given method
+    // Compute dofs and values for application of boundary conditions
+    // using given method
     void compute_bc(Map& boundary_values, LocalData& data,
                     std::string method) const;
 
@@ -487,8 +409,7 @@ namespace dolfin
     bool on_facet(const double* coordinates, const Facet& facet) const;
 
     // Check arguments
-    void check_arguments(GenericMatrix* A,
-                         GenericVector* b,
+    void check_arguments(GenericMatrix* A, GenericVector* b,
                          const GenericVector* x) const;
 
     // The function space (possibly a sub function space)
@@ -510,16 +431,19 @@ namespace dolfin
 
   private:
 
+    // Cached number of bc dofs, used for memory allocation on second use
+    mutable std::size_t _num_dofs;
+
     // Boundary facets, stored by facet index (local to process)
     mutable std::vector<std::size_t> _facets;
 
     // Cells attached to boundary, stored by cell index with map to
     // local dof number
-    mutable std::map<std::size_t, std::vector<std::size_t> >
-    _cells_to_localdofs;
+    mutable std::map<std::size_t, std::vector<std::size_t>>
+      _cells_to_localdofs;
 
     // User defined mesh function
-    std::shared_ptr<const MeshFunction<std::size_t> > _user_mesh_function;
+    std::shared_ptr<const MeshFunction<std::size_t>> _user_mesh_function;
 
     // User defined sub domain marker for mesh or mesh function
     std::size_t _user_sub_domain_marker;
diff --git a/dolfin/fem/DiscreteOperators.cpp b/dolfin/fem/DiscreteOperators.cpp
new file mode 100644
index 0000000..a9d6930
--- /dev/null
+++ b/dolfin/fem/DiscreteOperators.cpp
@@ -0,0 +1,167 @@
+// Copyright (C) 2015 Garth N. Wells
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+#include <vector>
+#include <dolfin/common/ArrayView.h>
+#include <dolfin/fem/GenericDofMap.h>
+#include <dolfin/function/FunctionSpace.h>
+#include <dolfin/la/GenericMatrix.h>
+#include <dolfin/la/Matrix.h>
+#include <dolfin/la/PETScMatrix.h>
+#include <dolfin/la/SparsityPattern.h>
+#include <dolfin/la/TensorLayout.h>
+#include <dolfin/mesh/Edge.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/Vertex.h>
+#include "DiscreteOperators.h"
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+std::shared_ptr<GenericMatrix>
+DiscreteOperators::build_gradient(const FunctionSpace& V0,
+                                  const FunctionSpace& V1)
+{
+  // TODO: This function would be significantly simplified if it was
+  // easier to build matrix sparsity patterns.
+
+  // Get mesh
+  dolfin_assert(V0.mesh());
+  const Mesh& mesh = *(V0.mesh());
+
+  // Check that mesh is the same for both function spaces
+  dolfin_assert(V1.mesh());
+  if (&mesh != V1.mesh().get())
+  {
+    dolfin_error("DiscreteGradient.cpp",
+                 "compute discrete gradient operator",
+                 "function spaces do not share the same mesh");
+  }
+
+  // Check that V0 is a (lowest-order) edge basis
+  mesh.init(1);
+  if (V0.dim() != mesh.size_global(1))
+  {
+    dolfin_error("DiscreteGradient.cpp",
+                 "compute discrete gradient operator",
+                 "function spaces is not a lowest-order edge space");
+  }
+
+  // Check that V1 is a linear nodal basis
+  if (V1.dim() != mesh.size_global(0))
+  {
+    dolfin_error("DiscreteGradient.cpp",
+                 "compute discrete gradient operator",
+                 "function space is not a linear nodal function space");
+  }
+
+  // Build maps from entities to local dof indices
+  const std::vector<dolfin::la_index> edge_to_dof = V0.dofmap()->dofs(mesh, 1);
+  const std::vector<dolfin::la_index> vertex_to_dof
+    = V1.dofmap()->dofs(mesh, 0);
+
+  // Build maps from local dof numbering to global
+  std::vector<std::size_t> local_to_global_map0;
+  std::vector<std::size_t> local_to_global_map1;
+  V0.dofmap()->tabulate_local_to_global_dofs(local_to_global_map0);
+  V1.dofmap()->tabulate_local_to_global_dofs(local_to_global_map1);
+
+  // Declare matrix
+  auto A = std::make_shared<Matrix>();
+
+  // Create layout for initialising tensor
+  std::shared_ptr<TensorLayout> tensor_layout;
+  tensor_layout = A->factory().create_layout(2);
+  dolfin_assert(tensor_layout);
+
+  // Copy index maps from dofmaps
+  std::vector<std::shared_ptr<const IndexMap> > index_maps
+    = {V0.dofmap()->index_map(), V1.dofmap()->index_map()};
+  std::vector<std::pair<std::size_t, std::size_t>> local_range
+    = { V0.dofmap()->ownership_range(), V1.dofmap()->ownership_range()};
+
+  // Initialise tensor layout
+  tensor_layout->init(mesh.mpi_comm(), index_maps,
+                      TensorLayout::Ghosts::UNGHOSTED);
+
+  // Initialize edge -> vertex connections
+  mesh.init(1, 0);
+
+  SparsityPattern& pattern = *tensor_layout->sparsity_pattern();
+  pattern.init(mesh.mpi_comm(), index_maps);
+
+    // Build sparsity pattern
+  if (tensor_layout->sparsity_pattern())
+  {
+    for (EdgeIterator edge(mesh); !edge.end(); ++edge)
+    {
+      // Row index (global indices)
+      const std::size_t row = local_to_global_map0[edge_to_dof[edge->index()]];
+
+      if (row >= local_range[0].first and row < local_range[0].second)
+      {
+        // Column indices (global indices)
+        const Vertex v0(mesh, edge->entities(0)[0]);
+        const Vertex v1(mesh, edge->entities(0)[1]);
+        std::size_t col0 = local_to_global_map1[vertex_to_dof[v0.index()]];
+        std::size_t col1 = local_to_global_map1[vertex_to_dof[v1.index()]];
+
+        pattern.insert_global(row, col0);
+        pattern.insert_global(row, col1);
+      }
+    }
+    pattern.apply();
+  }
+
+  // Initialise matrix
+  A->init(*tensor_layout);
+
+  // Build discrete gradient operator/matrix
+  for (EdgeIterator edge(mesh); !edge.end(); ++edge)
+  {
+    dolfin::la_index row;
+    dolfin::la_index cols[2];
+    double values[2];
+
+    row = local_to_global_map0[edge_to_dof[edge->index()]];
+
+    Vertex v0(mesh, edge->entities(0)[0]);
+    Vertex v1(mesh, edge->entities(0)[1]);
+
+    cols[0] = local_to_global_map1[vertex_to_dof[v0.index()]];
+    cols[1] = local_to_global_map1[vertex_to_dof[v1.index()]];
+    if (v1.global_index() < v0.global_index())
+    {
+      values[0] =  1.0;
+      values[1] = -1.0;
+    }
+    else
+    {
+      values[0] = -1.0;
+      values[1] =  1.0;
+    }
+
+    // Set values in matrix
+    A->set(values, 1, &row, 2, cols);
+  }
+
+  // Finalise matrix
+  A->apply("insert");
+
+  return A;
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/fem/DiscreteOperators.h b/dolfin/fem/DiscreteOperators.h
new file mode 100644
index 0000000..9e4414c
--- /dev/null
+++ b/dolfin/fem/DiscreteOperators.h
@@ -0,0 +1,53 @@
+// Copyright (C) 2015 Garth N. Wells
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef __DOLFIN_DISCRETE_OPERATORS_H
+#define __DOLFIN_DISCRETE_OPERATORS_H
+
+#include <memory>
+
+namespace dolfin
+{
+
+  class FunctionSpace;
+  class GenericMatrix;
+
+  /// This class computes discrete gradient operators (matrices) that
+  /// map derivatives of finite element functions into other finite
+  /// element spaces. An example of where discrete gradient operators
+  /// are required is the creation of algebraic multigrid solvers for
+  /// H(curl) and H(div) problems.
+
+  /// NOTE: This class is highly experimental and likely to change. It
+  /// will eventually be expanded to provide the discrete curl and
+  /// divergence.
+
+  class DiscreteOperators
+  {
+  public:
+
+    /// Build the discrete gradient operator A that takes a w \in H^1
+    /// (P1, nodal Lagrange) to v \in H(curl) (lowest order Nedelec),
+    /// i.e. v = Aw. V0 is the H(curl) space, and V1 is the P1
+    /// Lagrange space.
+    static std::shared_ptr<GenericMatrix>
+      build_gradient(const FunctionSpace& V0, const FunctionSpace& V1);
+
+  };
+}
+
+#endif
diff --git a/dolfin/fem/DofMap.cpp b/dolfin/fem/DofMap.cpp
index 1e17288..6ae58e4 100644
--- a/dolfin/fem/DofMap.cpp
+++ b/dolfin/fem/DofMap.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015 Anders Logg and Garth N. Wells
+// Copyright (C) 2007-2016 Anders Logg and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -15,13 +15,13 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// Modified by Martin Alnes, 2008-2015
-// Modified by Kent-Andre Mardal, 2009
-// Modified by Ola Skavhaug, 2009
-// Modified by Niclas Jansson, 2009
-// Modified by Joachim B Haga, 2012
-// Modified by Mikael Mortensen, 2012
-// Modified by Jan Blechta, 2013
+// Modified by Martin Alnes 2008-2015
+// Modified by Kent-Andre Mardal 2009
+// Modified by Ola Skavhaug 2009
+// Modified by Niclas Jansson 2009
+// Modified by Joachim B Haga 2012
+// Modified by Mikael Mortensen 2012
+// Modified by Jan Blechta 2013
 
 #include <unordered_map>
 
@@ -42,7 +42,8 @@ using namespace dolfin;
 DofMap::DofMap(std::shared_ptr<const ufc::dofmap> ufc_dofmap,
                const Mesh& mesh)
   : _cell_dimension(0), _ufc_dofmap(ufc_dofmap), _is_view(false),
-    _global_dimension(0), _ufc_offset(0), _global_offset(0)
+    _global_dimension(0), _ufc_offset(0), _multimesh_offset(0),
+    _index_map(new IndexMap(mesh.mpi_comm()))
 {
   dolfin_assert(_ufc_dofmap);
 
@@ -54,7 +55,8 @@ DofMap::DofMap(std::shared_ptr<const ufc::dofmap> ufc_dofmap,
                const Mesh& mesh,
                std::shared_ptr<const SubDomain> constrained_domain)
   : _cell_dimension(0), _ufc_dofmap(ufc_dofmap), _is_view(false),
-    _global_dimension(0), _ufc_offset(0), _global_offset(0)
+    _global_dimension(0), _ufc_offset(0), _multimesh_offset(0),
+    _index_map(new IndexMap(mesh.mpi_comm()))
 {
   dolfin_assert(_ufc_dofmap);
 
@@ -67,9 +69,9 @@ DofMap::DofMap(std::shared_ptr<const ufc::dofmap> ufc_dofmap,
 //-----------------------------------------------------------------------------
 DofMap::DofMap(const DofMap& parent_dofmap,
                const std::vector<std::size_t>& component, const Mesh& mesh)
-  : _cell_dimension(0), _is_view(true), _global_dimension(0), _ufc_offset(0),
-    _global_offset(parent_dofmap._global_offset),
-    _local_ownership_size(parent_dofmap._local_ownership_size)
+  : _cell_dimension(0), _ufc_dofmap(0), _is_view(true),
+    _global_dimension(0), _ufc_offset(0), _multimesh_offset(0),
+    _index_map(parent_dofmap._index_map)
 {
   // Build sub-dofmap
   DofMapBuilder::build_sub_map_view(*this, parent_dofmap, component, mesh);
@@ -78,8 +80,8 @@ DofMap::DofMap(const DofMap& parent_dofmap,
 DofMap::DofMap(std::unordered_map<std::size_t, std::size_t>& collapsed_map,
                const DofMap& dofmap_view, const Mesh& mesh)
   : _cell_dimension(0), _ufc_dofmap(dofmap_view._ufc_dofmap), _is_view(false),
-    _global_dimension(0), _ufc_offset(0), _global_offset(0),
-    _local_ownership_size(0)
+    _global_dimension(0), _ufc_offset(0), _multimesh_offset(0),
+    _index_map(new IndexMap(mesh.mpi_comm()))
 {
   dolfin_assert(_ufc_dofmap);
 
@@ -124,19 +126,18 @@ DofMap::DofMap(std::unordered_map<std::size_t, std::size_t>& collapsed_map,
   }
 }
 //-----------------------------------------------------------------------------
-DofMap::DofMap(const DofMap& dofmap)
+DofMap::DofMap(const DofMap& dofmap) : _index_map(dofmap._index_map)
 {
   // Copy data
   _dofmap = dofmap._dofmap;
   _cell_dimension = dofmap._cell_dimension;
   _ufc_dofmap = dofmap._ufc_dofmap;
-  _global_offset = dofmap._global_offset;
-  _local_ownership_size = dofmap._local_ownership_size;
+  _num_mesh_entities_global = dofmap._num_mesh_entities_global;
   _ufc_local_to_local= dofmap._ufc_local_to_local;
   _is_view = dofmap._is_view;
   _global_dimension = dofmap._global_dimension;
   _ufc_offset = dofmap._ufc_offset;
-  _off_process_owner = dofmap._off_process_owner;
+  _multimesh_offset = dofmap._multimesh_offset;
   _shared_nodes = dofmap._shared_nodes;
   _neighbours = dofmap._neighbours;
   constrained_domain = dofmap.constrained_domain;
@@ -154,27 +155,28 @@ std::size_t DofMap::global_dimension() const
 //-----------------------------------------------------------------------------
 std::size_t DofMap::local_dimension(std::string type) const
 {
+  deprecation("DofMap::local_dimension", "2016.1",
+              "Please use dofmap::index_map()->size() instead.");
+
   if (type == "owned")
-    return _local_ownership_size;
+    return _index_map->size(IndexMap::MapSize::OWNED);
   else if (type == "unowned")
-    return block_size*_local_to_global_unowned.size();
+    return _index_map->size(IndexMap::MapSize::UNOWNED);
   else if (type == "all")
-    return _local_ownership_size + block_size*_local_to_global_unowned.size();
+    return _index_map->size(IndexMap::MapSize::ALL);
   else
   {
-    dolfin_error("DofMap.h",
-                 "report DofMap local dimension",
-                 "unknown dof type given. Use either \"owned\", "
-                 "\"unowned\", or \"all\"");
-    return 0;
+    dolfin_error("DofMap.cpp",
+                 "get local dimension",
+                 "Unknown type %s", type.c_str());
   }
+
+  return 0;
 }
 //-----------------------------------------------------------------------------
 std::size_t DofMap::num_element_dofs(std::size_t cell_index) const
 {
   return _cell_dimension;
-  //dolfin_assert(cell_index < _dofmap.size());
-  //return _dofmap[cell_index].size();
 }
 //-----------------------------------------------------------------------------
 std::size_t DofMap::max_element_dofs() const
@@ -197,13 +199,7 @@ std::size_t DofMap::num_facet_dofs() const
 //-----------------------------------------------------------------------------
 std::pair<std::size_t, std::size_t> DofMap::ownership_range() const
 {
-  return std::make_pair(_global_offset,
-                        _local_ownership_size + _global_offset);
-}
-//-----------------------------------------------------------------------------
-const std::vector<int>& DofMap::off_process_owner() const
-{
-  return _off_process_owner;
+  return _index_map->local_range();
 }
 //-----------------------------------------------------------------------------
 const std::unordered_map<int, std::vector<int>>& DofMap::shared_nodes() const
@@ -236,81 +232,6 @@ void DofMap::tabulate_facet_dofs(std::vector<std::size_t>& dofs,
   _ufc_dofmap->tabulate_facet_dofs(dofs.data(), local_facet);
 }
 //-----------------------------------------------------------------------------
-void
-DofMap::tabulate_coordinates(boost::multi_array<double, 2>& coordinates,
-                             const std::vector<double>& vertex_coordinates,
-                             const Cell& cell) const
-{
-  dolfin_assert(_ufc_dofmap);
-
-  // Check dimensions
-  if (coordinates.shape()[0] != num_element_dofs(cell.index()) ||
-      coordinates.shape()[1] != _ufc_dofmap->geometric_dimension())
-  {
-    boost::multi_array<double, 2>::extent_gen extents;
-    const std::size_t cell_dim = num_element_dofs(cell.index());
-    coordinates.resize(extents[cell_dim][_ufc_dofmap->geometric_dimension()]);
-  }
-
-  // Tabulate coordinates
-  _ufc_dofmap->tabulate_coordinates(coordinates.data(),
-                                    vertex_coordinates.data());
-}
-//-----------------------------------------------------------------------------
-std::vector<double> DofMap::tabulate_all_coordinates(const Mesh& mesh) const
-{
-  // Geometric dimension
-  const std::size_t gdim = _ufc_dofmap->geometric_dimension();
-  dolfin_assert(gdim == mesh.geometry().dim());
-
-  if (_is_view)
-  {
-    dolfin_error("DofMap.cpp",
-                 "tabulate_all_coordinates",
-                 "Cannot tabulate coordinates for a DofMap that is a view.");
-  }
-  //const std::size_t offset = ownership_range().first;
-
-  // Number of local dofs (dofs owned by this process)
-  //const std::size_t local_size
-  //  = ownership_range().second - ownership_range().first;
-
-  // Vector to hold coordinates and return
-  std::vector<double> x(gdim*_local_ownership_size);
-
-  // Loop over cells and tabulate dofs
-  boost::multi_array<double, 2> coordinates;
-  std::vector<double> vertex_coordinates;
-  for (CellIterator cell(mesh); !cell.end(); ++cell)
-  {
-    // Update UFC cell
-    cell->get_vertex_coordinates(vertex_coordinates);
-
-    // Get local-to-global map
-    const ArrayView<const dolfin::la_index> dofs = cell_dofs(cell->index());
-
-    // Tabulate dof coordinates on cell
-    tabulate_coordinates(coordinates, vertex_coordinates, *cell);
-
-    // Copy dof coordinates into vector
-    for (std::size_t i = 0; i < dofs.size(); ++i)
-    {
-      const dolfin::la_index dof = dofs[i];
-      if (dof < (dolfin::la_index) _local_ownership_size)
-      {
-        const dolfin::la_index local_index = dof;
-        for (std::size_t j = 0; j < gdim; ++j)
-        {
-          dolfin_assert(gdim*local_index + j < x.size());
-          x[gdim*local_index + j] = coordinates[i][j];
-        }
-      }
-    }
-  }
-
-  return x;
-}
-//-----------------------------------------------------------------------------
 std::shared_ptr<GenericDofMap> DofMap::copy() const
 {
   return std::shared_ptr<GenericDofMap>(new DofMap(*this));
@@ -415,11 +336,15 @@ std::vector<dolfin::la_index> DofMap::dofs() const
   std::vector<la_index> _dofs;
   _dofs.reserve(_dofmap.size()*max_element_dofs());
 
+  const dolfin::la_index local_ownership_size
+    = _index_map->size(IndexMap::MapSize::OWNED);
+  const std::size_t global_offset = _index_map->local_range().first;
+
   // Insert all dofs into a vector (will contain duplicates)
   for (auto dof : _dofmap)
   {
-    if (dof >= 0 && dof < _local_ownership_size)
-      _dofs.push_back(dof + _global_offset);
+    if (dof >= 0 && dof < local_ownership_size)
+      _dofs.push_back(dof + global_offset);
   }
 
   // Sort dofs (required to later remove duplicates)
@@ -434,7 +359,7 @@ std::vector<dolfin::la_index> DofMap::dofs() const
 void DofMap::set(GenericVector& x, double value) const
 {
   dolfin_assert(_dofmap.size() % _cell_dimension == 0);
-  const std::size_t num_cells = _dofmap.size()/_cell_dimension;
+  const std::size_t num_cells = _dofmap.size() / _cell_dimension;
 
   std::vector<double> _value(_cell_dimension, value);
   for (std::size_t i = 0; i < num_cells; ++i)
@@ -445,49 +370,26 @@ void DofMap::set(GenericVector& x, double value) const
   x.apply("insert");
 }
 //-----------------------------------------------------------------------------
-void DofMap::set_x(GenericVector& x, double value, std::size_t component,
-                   const Mesh& mesh) const
-{
-  std::vector<double> x_values;
-  boost::multi_array<double, 2> coordinates;
-  std::vector<double> vertex_coordinates;
-  for (CellIterator cell(mesh); !cell.end(); ++cell)
-  {
-    // Update UFC cell
-    cell->get_vertex_coordinates(vertex_coordinates);
-
-    // Get cell local-to-global map
-    const ArrayView<const dolfin::la_index> dofs = cell_dofs(cell->index());
-
-    // Tabulate dof coordinates
-    tabulate_coordinates(coordinates, vertex_coordinates, *cell);
-    dolfin_assert(coordinates.shape()[0] == dofs.size());
-    dolfin_assert(component < coordinates.shape()[1]);
-
-    // Copy coordinate (it may be possible to avoid this)
-    x_values.resize(dofs.size());
-    for (std::size_t i = 0; i < coordinates.shape()[0]; ++i)
-      x_values[i] = value*coordinates[i][component];
-
-    // Set x[component] values in vector
-    x.set_local(x_values.data(), dofs.size(), dofs.data());
-  }
-}
-//-----------------------------------------------------------------------------
 void DofMap::tabulate_local_to_global_dofs(std::vector<std::size_t>& local_to_global_map) const
 {
-  const int size = _local_ownership_size
-    + block_size*_local_to_global_unowned.size();
-  local_to_global_map.resize(size);
-  for (int i = 0; i < _local_ownership_size; ++i)
-    local_to_global_map[i] = i + _global_offset;
+  const std::size_t bs = _index_map->block_size();
+  const std::vector<std::size_t>& local_to_global_unowned
+    = _index_map->local_to_global_unowned();
+  const std::size_t local_ownership_size
+    = _index_map->size(IndexMap::MapSize::OWNED);
+  local_to_global_map.resize(_index_map->size(IndexMap::MapSize::ALL));
+
+  const std::size_t global_offset = _index_map->local_range().first;
+  for (std::size_t i = 0; i < local_ownership_size; ++i)
+    local_to_global_map[i] = i + global_offset;
 
-  for (std::size_t node = 0; node < _local_to_global_unowned.size(); ++node)
+  for (std::size_t node = 0;
+       node < _index_map->local_to_global_unowned().size(); ++node)
   {
-    for (std::size_t component = 0; component < block_size; ++component)
+    for (std::size_t component = 0; component < bs; ++component)
     {
-      local_to_global_map[block_size*node + component + _local_ownership_size]
-        =  block_size*_local_to_global_unowned[node] + component;
+      local_to_global_map[bs*node + component + local_ownership_size]
+        = bs*local_to_global_unowned[node] + component;
     }
   }
 }
@@ -515,7 +417,10 @@ std::string DofMap::str(bool verbose) const
   if (verbose)
   {
     // Cell loop
-    for (std::size_t i = 0; i < _dofmap.size(); i += _cell_dimension)
+    dolfin_assert(_dofmap.size()%_cell_dimension == 0);
+    const std::size_t ncells = _dofmap.size() / _cell_dimension;
+
+    for (std::size_t i = 0; i < ncells; ++i)
     {
       s << "Local cell index, cell dofmap dimension: " << i
         << ", " << _cell_dimension << std::endl;
@@ -535,16 +440,6 @@ std::string DofMap::str(bool verbose) const
 void DofMap::check_dimensional_consistency(const ufc::dofmap& dofmap,
                                             const Mesh& mesh)
 {
-  // Check geometric dimension
-  if (dofmap.geometric_dimension() != mesh.geometry().dim())
-  {
-    dolfin_error("DofMap.cpp",
-                 "create mapping of degrees of freedom",
-                 "Geometric dimension of the UFC dofmap (dim = %d) and the mesh (dim = %d) do not match",
-                 dofmap.geometric_dimension(),
-                 mesh.geometry().dim());
-  }
-
   // Check topological dimension
   if (dofmap.topological_dimension() != mesh.topology().dim())
   {
diff --git a/dolfin/fem/DofMap.h b/dolfin/fem/DofMap.h
index 125bc2e..31574b0 100644
--- a/dolfin/fem/DofMap.h
+++ b/dolfin/fem/DofMap.h
@@ -28,15 +28,14 @@
 #include <cstdlib>
 #include <map>
 #include <memory>
+#include <unordered_map>
 #include <utility>
 #include <vector>
-#include <boost/multi_array.hpp>
-#include <memory>
-#include <unordered_map>
 #include <ufc.h>
 
 #include <dolfin/common/ArrayView.h>
 #include <dolfin/common/types.h>
+#include <dolfin/la/IndexMap.h>
 #include <dolfin/mesh/Cell.h>
 #include "GenericDofMap.h"
 
@@ -177,15 +176,16 @@ namespace dolfin
     /// *Returns*
     ///     std::vector<unsigned int>
     ///         The map from non-local dofs.
-    const std::vector<int>& off_process_owner() const;
+    const std::vector<int>& off_process_owner() const
+    { return _index_map->off_process_owner(); }
 
     /// Return map from all shared nodes to the sharing processes (not
     /// including the current process) that share it.
     ///
     /// *Returns*
-    ///     std::unordered_map<std::size_t, std::vector<unsigned int> >
+    ///     std::unordered_map<std::size_t, std::vector<unsigned int>>
     ///         The map from dofs to list of processes
-    const std::unordered_map<int, std::vector<int> >& shared_nodes() const;
+    const std::unordered_map<int, std::vector<int>>& shared_nodes() const;
 
     /// Return set of processes that share dofs with this process
     ///
@@ -239,35 +239,19 @@ namespace dolfin
     ///     local_entity (std::size_t)
     ///         The local entity index
     void tabulate_entity_dofs(std::vector<std::size_t>& dofs,
-			      std::size_t dim, std::size_t local_entity) const;
+                              std::size_t dim, std::size_t local_entity) const;
 
-    /// Tabulate the coordinates of all dofs on a cell (UFC cell
-    /// version)
-    ///
-    /// *Arguments*
-    ///     coordinates (boost::multi_array<double, 2>)
-    ///         The coordinates of all dofs on a cell.
-    ///     vertex_coordinates (std::vector<double>)
-    ///         The cell vertex coordinates
-    ///     cell (Cell)
-    ///         The cell.
-    void tabulate_coordinates(boost::multi_array<double, 2>& coordinates,
-                              const std::vector<double>& vertex_coordinates,
-                              const Cell& cell) const;
-
-    /// Tabulate the coordinates of all dofs on this process. This
-    /// function is typically used by preconditioners that require the
-    /// spatial coordinates of dofs, for example for re-partitioning or
-    /// nullspace computations.
+    /// Tabulate globally supported dofs
     ///
     /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh.
-    ///
-    /// *Returns*
-    ///     std::vector<double>
-    ///         The dof coordinates (x0, y0, x1, y1, . . .)
-    std::vector<double> tabulate_all_coordinates(const Mesh& mesh) const;
+    ///     dofs (std::size_t)
+    ///         Degrees of freedom.
+    void tabulate_global_dofs(std::vector<std::size_t>& dofs) const
+    {
+      dolfin_assert(_global_nodes.empty() || block_size() == 1);
+      dofs.resize(_global_nodes.size());
+      std::copy(_global_nodes.cbegin(), _global_nodes.cend(), dofs.begin());
+    }
 
     /// Create a copy of the dof map
     ///
@@ -339,32 +323,14 @@ namespace dolfin
     ///         The value to set.
     void set(GenericVector& x, double value) const;
 
-    /// Set dof entries in vector to the x[i] coordinate of the dof
-    /// spatial coordinate. Parallel layout of vector must be consistent
-    /// with dof map range This function is typically used to
-    /// construct the null space of a matrix operator, e.g. rigid
-    /// body rotations.
-    ///
-    /// *Arguments*
-    ///     vector (_GenericVector_)
-    ///         The vector to set.
-    ///     value (double)
-    ///         The value to multiply to coordinate by.
-    ///     component (std::size_t)
-    ///         The coordinate index.
-    ///     mesh (_Mesh_)
-    ///         The mesh.
-    void set_x(GenericVector& x, double value, std::size_t component,
-               const Mesh& mesh) const;
+    /// Return the map (const access)
+    std::shared_ptr<const IndexMap> index_map() const
+    { return _index_map; }
 
-    /// Return the map from unowned local dofmap nodes to global dofmap
-    /// nodes. Dofmap node is dof index modulo block size.
-    ///
-    /// *Returns*
-    ///     _std::vector<std::size_t>_
-    ///         The unonwed local-to-global node map.
-    const std::vector<std::size_t>& local_to_global_unowned() const
-    { return _local_to_global_unowned; }
+    /// Return the block size for dof maps with components, typically
+    /// used for vector valued functions.
+    int block_size() const
+    { return _index_map->block_size(); }
 
     /// Compute the map from local (this process) dof indices to
     /// global dof indices.
@@ -384,19 +350,11 @@ namespace dolfin
     ///     std::size_t
     ///         The global dof index.
     std::size_t local_to_global_index(int local_index) const
-    {
-      if (local_index < _local_ownership_size)
-        return local_index + _global_offset;
-      else
-      {
-        const std::div_t div = std::div((local_index - _local_ownership_size),
-                                        block_size);
-        const int component = div.rem;
-        const int index = div.quot;
-        dolfin_assert((std::size_t) index < _local_to_global_unowned.size());
-        return block_size*_local_to_global_unowned[index] + component;
-      }
-    }
+    { return _index_map->local_to_global(local_index); }
+
+    /// Return indices of dofs which are owned by other processes
+    const std::vector<std::size_t>& local_to_global_unowned() const
+    { return _index_map->local_to_global_unowned(); }
 
     /// Return informal string representation (pretty-print)
     ///
@@ -425,6 +383,9 @@ namespace dolfin
     // Cell-local-to-dof map (dofs for cell dofmap[i])
     std::vector<dolfin::la_index> _dofmap;
 
+    // List of global nodes
+    std::set<std::size_t> _global_nodes;
+
     // Cell dimension (fixed for all cells)
     std::size_t _cell_dimension;
 
@@ -452,22 +413,18 @@ namespace dolfin
     // UFC dof map offset
     std::size_t _ufc_offset;
 
-    // Number of dofs owned by this process
-    std::size_t _global_offset;
-    int _local_ownership_size;
+    // Multimesh dof map offset
+    std::size_t _multimesh_offset;
+
+    // Object containing information about dof distribution across
+    // processes
+    std::shared_ptr<IndexMap> _index_map;
 
     // Temporary until MultiMeshDofMap runs in parallel
     friend class MultiMeshDofMap;
 
-    // Map from local index of un-owned dofs to global dof index
-    std::vector<std::size_t> _local_to_global_unowned;
-
-    // Map from dofs in local dof map are not owned by this process to
-    // the owner process
-    std::vector<int> _off_process_owner;
-
     // List of processes that share a given dof
-    std::unordered_map<int, std::vector<int> > _shared_nodes;
+    std::unordered_map<int, std::vector<int>> _shared_nodes;
 
     // Neighbours (processes that we share dofs with)
     std::set<int> _neighbours;
diff --git a/dolfin/fem/DofMapBuilder.cpp b/dolfin/fem/DofMapBuilder.cpp
index 9d08a98..33f8d5f 100644
--- a/dolfin/fem/DofMapBuilder.cpp
+++ b/dolfin/fem/DofMapBuilder.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2014 Anders Logg, Ola Skavhaug and Garth N. Wells
+// Copyright (C) 2008-2015 Anders Logg, Ola Skavhaug and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -19,15 +19,13 @@
 // Modified by Garth N. Wells 2010-2012
 // Modified by Mikael Mortensen, 2012.
 // Modified by Joachim B Haga, 2012
-// Modified by Martin Alnaes, 2013
+// Modified by Martin Alnaes, 2013-2015
 // Modified by Chris Richardson, 2014
-//
-// First added:  2008-08-12
-// Last changed: 2013-01-08
 
 #include <cstdlib>
 #include <random>
 #include <utility>
+#include <memory>
 #include <ufc.h>
 
 #include <dolfin/common/Timer.h>
@@ -50,6 +48,7 @@
 
 using namespace dolfin;
 
+
 //-----------------------------------------------------------------------------
 void DofMapBuilder::build(DofMap& dofmap, const Mesh& mesh,
                           std::shared_ptr<const SubDomain> constrained_domain)
@@ -79,14 +78,17 @@ void DofMapBuilder::build(DofMap& dofmap, const Mesh& mesh,
   // Sanity checks on UFC dofmap
   const std::size_t D = mesh.topology().dim();
   dolfin_assert(dofmap._ufc_dofmap);
-  dolfin_assert(dofmap._ufc_dofmap->geometric_dimension()
-                == mesh.geometry().dim());
   dolfin_assert(dofmap._ufc_dofmap->topological_dimension() == D);
 
+  // Extract needs_entities as vector
+  std::vector<bool> needs_entities(D + 1);
+  for (std::size_t d = 0; d <= D; ++d)
+    needs_entities[d] = dofmap._ufc_dofmap->needs_mesh_entities(d);
+
   // For mesh entities required by UFC dofmap, compute number of
   // entities on this process
   const std::vector<std::size_t> num_mesh_entities_local
-    = compute_num_mesh_entities_local(mesh, *dofmap._ufc_dofmap);
+    = compute_num_mesh_entities_local(mesh, needs_entities);
 
   // NOTE: We test for global dofs here because the the function
   // DofMapBuilder::compute_block size cannot distinguish between
@@ -103,7 +105,6 @@ void DofMapBuilder::build(DofMap& dofmap, const Mesh& mesh,
   // is not re-ordered or if global dofs are present)
   const std::size_t bs = (global_dofs.empty() and reorder)
     ? compute_blocksize(*dofmap._ufc_dofmap) : 1;
-  dofmap.block_size = bs;
 
   // Compute a 'node' dofmap based on a UFC dofmap. Returns:
   // - node dofmap (node_dofmap)
@@ -191,17 +192,11 @@ void DofMapBuilder::build(DofMap& dofmap, const Mesh& mesh,
                                node_local_to_global0, mesh,
                                dofmap._global_dimension/bs);
 
-    // Set global offset for dofs owned by this process, and the local
-    // ownership size
-    const std::size_t node_offset_global = MPI::global_offset(mesh.mpi_comm(),
-                                                              num_owned_nodes,
-                                                              true);
-    dofmap._global_offset = bs*node_offset_global;
-    dofmap._local_ownership_size = bs*num_owned_nodes;
+    dofmap._index_map->init(num_owned_nodes, bs);
 
     // Sanity check
     dolfin_assert(MPI::sum(mesh.mpi_comm(),
-                           (std::size_t) dofmap._local_ownership_size)
+       (std::size_t) dofmap._index_map->size(IndexMap::MapSize::OWNED))
                   == dofmap._global_dimension);
 
     // Compute node re-ordering for process index locality and spatial
@@ -211,13 +206,13 @@ void DofMapBuilder::build(DofMap& dofmap, const Mesh& mesh,
     // (c) New local node index to new global node index
     // (d) Old local node index to new local node index
     std::vector<int> node_old_to_new_local;
-    compute_node_reordering(dofmap._local_to_global_unowned,
-                           dofmap._off_process_owner,
-                           node_old_to_new_local,
-                           shared_node_to_processes0,
-                           node_local_to_global0,
-                           node_graph0, node_ownership0, global_nodes0,
-                           mesh.mpi_comm());
+    dolfin_assert(dofmap._index_map);
+    compute_node_reordering(*dofmap._index_map,
+                            node_old_to_new_local,
+                            shared_node_to_processes0,
+                            node_local_to_global0,
+                            node_graph0, node_ownership0, global_nodes0,
+                            mesh.mpi_comm());
 
     // Update UFC-local-to-local map to account for re-ordering
     if (constrained_domain)
@@ -246,6 +241,11 @@ void DofMapBuilder::build(DofMap& dofmap, const Mesh& mesh,
       dofmap._shared_nodes[new_node] = it->second;
     }
 
+    // Update global_nodes for node reordering
+    dofmap._global_nodes.clear();
+    for (auto it = global_nodes0.begin(); it != global_nodes0.end(); ++it)
+      dofmap._global_nodes.insert(node_old_to_new_local[*it]);
+
     // Build dofmap from original node 'dof' map and applying the
     // 'old_to_new_local' map for the re-ordered node indices
     build_dofmap(dofmap_graph, node_graph0, node_old_to_new_local, bs);
@@ -264,12 +264,11 @@ void DofMapBuilder::build(DofMap& dofmap, const Mesh& mesh,
         dofmap._ufc_local_to_local[i] = i;
     }
 
-    dofmap._global_offset = 0;
-    dofmap._local_ownership_size = dofmap._global_dimension;
-
-    dofmap._local_to_global_unowned.clear();
-    dofmap._off_process_owner.clear();
+    dofmap._index_map->init(dofmap._global_dimension, bs);
     dofmap._shared_nodes.clear();
+
+    // Store global nodes
+    dofmap._global_nodes = global_nodes0;
   }
 
   // Clear ufc_local-to-local map if dofmap has no sub-maps
@@ -298,9 +297,17 @@ DofMapBuilder::build_sub_map_view(DofMap& sub_dofmap,
   dolfin_assert(parent_dofmap._ufc_dofmap);
   const ufc::dofmap& parent_ufc_dofmap = *parent_dofmap._ufc_dofmap;
 
+  // Topological dimension
+  const std::size_t D = mesh.topology().dim();
+
+  // Extract needs_entities as vector
+  std::vector<bool> needs_entities(D + 1);
+  for (std::size_t d = 0; d <= D; ++d)
+    needs_entities[d] = parent_ufc_dofmap.needs_mesh_entities(d);
+
   // Generate and number required mesh entities for local UFC map
   const std::vector<std::size_t> num_mesh_entities_local
-    = compute_num_mesh_entities_local(mesh, parent_ufc_dofmap);
+    = compute_num_mesh_entities_local(mesh, needs_entities);
 
   // Initialise UFC offset from parent
   std::size_t ufc_offset = parent_dofmap._ufc_offset;
@@ -322,21 +329,26 @@ DofMapBuilder::build_sub_map_view(DofMap& sub_dofmap,
 
   // Add offset to local UFC dofmap
   for (std::size_t i = 0; i < sub_dofmap_graph.size(); ++i)
+  {
     for (std::size_t j = 0; j < sub_dofmap_graph[i].size(); ++j)
+    {
       sub_dofmap_graph[i][j] += ufc_offset;
+    }
+  }
 
   // Store number of global mesh entities and set global dimension
-  sub_dofmap._num_mesh_entities_global = parent_dofmap._num_mesh_entities_global;
+  sub_dofmap._num_mesh_entities_global
+    = parent_dofmap._num_mesh_entities_global;
   dolfin_assert(!sub_dofmap._num_mesh_entities_global.empty());
   sub_dofmap._global_dimension
     = sub_dofmap._ufc_dofmap->global_dimension(sub_dofmap._num_mesh_entities_global);
 
   // Copy data from parent
-  sub_dofmap._local_to_global_unowned = parent_dofmap._local_to_global_unowned;
-  sub_dofmap._off_process_owner = parent_dofmap._off_process_owner;
+  // FIXME: Do we touch sub_dofmap.index_map() in this routine? If yes, then
+  //        this routine has incorrect constness!
+  sub_dofmap.index_map() = parent_dofmap.index_map();
   sub_dofmap._shared_nodes = parent_dofmap._shared_nodes;
   sub_dofmap._neighbours = parent_dofmap._neighbours;
-  sub_dofmap.block_size = parent_dofmap.block_size;
 
   // Store UFC local to re-ordered local if submap has any submaps
   if (sub_dofmap._ufc_dofmap->num_sub_dofmaps() > 0)
@@ -353,7 +365,7 @@ DofMapBuilder::build_sub_map_view(DofMap& sub_dofmap,
 
   // Map to re-ordered dofs
   const std::vector<int>& local_to_local = parent_dofmap._ufc_local_to_local;
-  const std::size_t bs = parent_dofmap.block_size;
+  const std::size_t bs = parent_dofmap.block_size();
   for (auto cell_map = sub_dofmap_graph.begin();
        cell_map != sub_dofmap_graph.end(); ++cell_map)
   {
@@ -363,9 +375,12 @@ DofMapBuilder::build_sub_map_view(DofMap& sub_dofmap,
       const std::size_t node = div.rem;
       const std::size_t component = div.quot;
 
-        // Get dof from UFC local-to-local map
+      // Get dof from UFC local-to-local map
       dolfin_assert(node < local_to_local.size());
-      const std::size_t current_dof = bs*local_to_local[node] + component;
+      std::size_t current_dof = bs*local_to_local[node] + component;
+
+      // Add multimesh offset
+      current_dof += parent_dofmap._multimesh_offset;
 
       // Set dof index in transformed dofmap
       *dof = current_dof;
@@ -379,7 +394,8 @@ DofMapBuilder::build_sub_map_view(DofMap& sub_dofmap,
   sub_dofmap._dofmap.clear();
   for (auto const &cell_dofs : sub_dofmap_graph)
   {
-    sub_dofmap._dofmap.insert(sub_dofmap._dofmap.end(), cell_dofs.begin(),
+    sub_dofmap._dofmap.insert(sub_dofmap._dofmap.end(),
+                              cell_dofs.begin(),
                               cell_dofs.end());
   }
 }
@@ -395,15 +411,13 @@ std::size_t DofMapBuilder::build_constrained_vertex_indices(
 
   // Get vertex sharing information (local index, [(sharing process p,
   // local index on p)])
-  const std::unordered_map<unsigned int, std::
-                             vector<std::pair<unsigned int, unsigned int>>>&
+  const std::unordered_map<unsigned int,
+                           std::vector<std::pair<unsigned int, unsigned int>>>&
     shared_vertices = DistributedMeshTools::compute_shared_entities(mesh, 0);
 
    // Mark shared vertices
   std::vector<bool> vertex_shared(mesh.num_vertices(), false);
-  std::unordered_map<unsigned int, std::vector<std::pair<unsigned int,
-      unsigned int>>>::const_iterator shared_vertex;
-  for (shared_vertex = shared_vertices.begin();
+  for (auto shared_vertex = shared_vertices.begin();
        shared_vertex != shared_vertices.end(); ++shared_vertex)
   {
     dolfin_assert(shared_vertex->first < vertex_shared.size());
@@ -518,9 +532,7 @@ std::size_t DofMapBuilder::build_constrained_vertex_indices(
   // Request master vertex index from master owner
   std::vector<std::vector<std::size_t>> master_send_buffer(MPI::size(mpi_comm));
   std::vector<std::vector<std::size_t>> local_slave_index(MPI::size(mpi_comm));
-  std::map<unsigned int,
-           std::pair<unsigned int, unsigned int>>::const_iterator master;
-  for (master = slave_to_master_vertices.begin();
+  for (auto master = slave_to_master_vertices.begin();
        master != slave_to_master_vertices.end(); ++master)
   {
     const unsigned int local_index = master->first;
@@ -588,20 +600,26 @@ void DofMapBuilder::build_local_ufc_dofmap(
   // Topological dimension
   const std::size_t D = mesh.topology().dim();
 
+  // Extract needs_entities as vector
+  std::vector<bool> needs_entities(D + 1);
+  for (std::size_t d = 0; d <= D; ++d)
+    needs_entities[d] = ufc_dofmap.needs_mesh_entities(d);
+
   // Generate and number required mesh entities (locally)
   std::vector<std::size_t> num_mesh_entities(D + 1, 0);
   for (std::size_t d = 0; d <= D; ++d)
   {
-    if (ufc_dofmap.needs_mesh_entities(d))
+    if (needs_entities[d])
     {
       mesh.init(d);
       num_mesh_entities[d] = mesh.num_entities(d);
     }
   }
 
-  // Create UFC cell and allocate memory
-  ufc::cell ufc_cell;
-  ufc_cell.entity_indices.resize(D + 1);
+  // Allocate entity indices array
+  std::vector<std::vector<std::size_t>> entity_indices(D+1);
+  for (std::size_t d = 0; d <= D; ++d)
+    entity_indices[d].resize(mesh.type().num_entities(d));
 
   // Build dofmap from ufc::dofmap
   dofmap.resize(mesh.num_cells(),
@@ -609,34 +627,15 @@ void DofMapBuilder::build_local_ufc_dofmap(
   std::vector<std::size_t> dof_holder(ufc_dofmap.num_element_dofs());
   for (CellIterator cell(mesh, "all"); !cell.end(); ++cell)
   {
-    const std::size_t cell_index = cell->index();
-    ufc_cell.orientation = -1;
-    if (!cell->mesh().cell_orientations().empty())
-    {
-      dolfin_assert(cell_index < cell->mesh().cell_orientations().size());
-      ufc_cell.orientation = cell->mesh().cell_orientations()[cell_index];
-    }
-    ufc_cell.topological_dimension = D;
-
-    for (std::size_t d = 0; d < D; d++)
-    {
-      ufc_cell.entity_indices[d].resize(cell->num_entities(d));
-      for (std::size_t i = 0; i < cell->num_entities(d); ++i)
-        ufc_cell.entity_indices[d][i] = cell->entities(d)[i];
-    }
-
-    // Cell index
-    ufc_cell.entity_indices[D].resize(1);
-    ufc_cell.entity_indices[D][0] = cell_index;
-
-    // Local cell index short-cut
-    ufc_cell.index = ufc_cell.entity_indices[D][0];
+    // Fill entity indices array
+    get_cell_entities_local(*cell, entity_indices, needs_entities);
 
     // Tabulate dofs for cell
-    ufc_dofmap.tabulate_dofs(dof_holder.data(), num_mesh_entities,
-                             ufc_cell);
+    ufc_dofmap.tabulate_dofs(dof_holder.data(),
+                             num_mesh_entities,
+                             entity_indices);
     std::copy(dof_holder.begin(), dof_holder.end(),
-              dofmap[cell_index].begin());
+              dofmap[cell->index()].begin());
   }
 }
 //-----------------------------------------------------------------------------
@@ -683,8 +682,8 @@ DofMapBuilder::compute_node_ownership(
   {
     if (shared_nodes[i] == 0)
     {
-      // Shared node - send out to matching process
-      // to determine ownership and other sharing processes
+      // Shared node - send out to matching process to determine
+      // ownership and other sharing processes
 
       // Send global index
       const std::size_t global_index = local_to_global[i];
@@ -696,13 +695,13 @@ DofMapBuilder::compute_node_ownership(
     }
   }
 
-  // Make note of current size of each send buffer
-  // i.e. the number of boundary nodes, labelled '0'
+  // Make note of current size of each send buffer i.e. the number of
+  // boundary nodes, labelled '0'
   for (unsigned int i = 0; i != num_processes; ++i)
     send_buffer[i][0] = send_buffer[i].size() - 1;
 
-  // Additionally send any ghost or ghost-shared nodes
-  // to determine sharing (but not ownership)
+  // Additionally send any ghost or ghost-shared nodes to determine
+  // sharing (but not ownership)
   for (std::size_t i = 0; i < num_nodes_local; ++i)
   {
     if (shared_nodes[i] == -3 or shared_nodes[i] == -2)
@@ -768,7 +767,8 @@ DofMapBuilder::compute_node_ownership(
     {
       std::vector<unsigned int>& gprocs = global_to_procs[*q];
       send_response[i].push_back(gprocs.size());
-      send_response[i].insert(send_response[i].end(), gprocs.begin(), gprocs.end());
+      send_response[i].insert(send_response[i].end(), gprocs.begin(),
+                              gprocs.end());
     }
 
   MPI::all_to_all(mpi_comm, send_response, recv_buffer);
@@ -900,11 +900,12 @@ void DofMapBuilder::compute_global_dofs(
                      "Global degree of freedom has dimension != 1");
       }
 
-      // Create dummy cell argument to tabulate single global dof
-      std::unique_ptr<ufc::cell> ufc_cell(new ufc::cell);
+      // Create dummy entity_indices argument to tabulate single
+      // global dof
+      std::vector<std::vector<std::size_t>> dummy_entity_indices;
       std::size_t dof_local = 0;
       ufc_dofmap->tabulate_dofs(&dof_local, num_mesh_entities_local,
-                                *ufc_cell);
+                                dummy_entity_indices);
 
       // Insert global dof index
       std::pair<std::set<std::size_t>::iterator, bool> ret
@@ -1022,8 +1023,8 @@ std::size_t DofMapBuilder::compute_blocksize(const ufc::dofmap& ufc_dofmap)
       // Assume dof map has block structure, then check
       has_block_structure = true;
 
-      // Create UFC sub-dofmaps and check that all sub dofmaps have the
-      // same number of dofs per entity
+      // Create UFC sub-dofmaps and check that all sub dofmaps have
+      // the same number of dofs per entity
       for (std::size_t i = 1; i < ufc_dofmap.num_sub_dofmaps(); ++i)
       {
         std::unique_ptr<ufc::dofmap>
@@ -1065,13 +1066,18 @@ std::shared_ptr<const ufc::dofmap> DofMapBuilder::build_ufc_node_graph(
   // Topological dimension
   const std::size_t D = mesh.topology().dim();
 
+  // Extract needs_entities as vector
+  std::vector<bool> needs_entities(D + 1);
+  for (std::size_t d = 0; d <= D; ++d)
+    needs_entities[d] = ufc_dofmap->needs_mesh_entities(d);
+
   // Generate and number required mesh entities (local & global, and
   // constrained global)
   std::vector<std::size_t> num_mesh_entities_local(D + 1, 0);
   std::vector<std::size_t> num_mesh_entities_global_unconstrained(D + 1, 0);
   for (std::size_t d = 0; d <= D; ++d)
   {
-    if (ufc_dofmap->needs_mesh_entities(d))
+    if (needs_entities[d])
     {
       mesh.init(d);
       DistributedMeshTools::number_entities(mesh, d);
@@ -1107,16 +1113,17 @@ std::shared_ptr<const ufc::dofmap> DofMapBuilder::build_ufc_node_graph(
   node_dofmap.clear();
   node_dofmap.resize(mesh.num_cells());
 
-  // Holder for UFC 64-bit dofmap integers
-  std::vector<std::size_t> ufc_nodes_global, ufc_nodes_local;
-
   // Get standard local elem2ent dimension
   const std::size_t local_dim = dofmaps[0]->num_element_dofs();
 
-  // Create UFC cell and allocate memory
-  ufc::cell ufc_cell_global, ufc_cell_local;
-  ufc_cell_global.entity_indices.resize(D + 1);
-  ufc_cell_local.entity_indices.resize(D + 1);
+  // Holder for UFC 64-bit dofmap integers
+  std::vector<std::size_t> ufc_nodes_global(local_dim);
+  std::vector<std::size_t> ufc_nodes_local(local_dim);
+
+  // Allocate entity indices array
+  std::vector<std::vector<std::size_t>> entity_indices(D+1);
+  for (std::size_t d = 0; d <= D; ++d)
+    entity_indices[d].resize(mesh.type().num_entities(d));
 
   // Resize local-to-global map
   node_local_to_global.resize(offset_local[1]);
@@ -1124,49 +1131,23 @@ std::shared_ptr<const ufc::dofmap> DofMapBuilder::build_ufc_node_graph(
   // Build dofmaps from ufc::dofmap
   for (CellIterator cell(mesh, "all"); !cell.end(); ++cell)
   {
-    // Set cell orientation
-    int cell_orientation = -1;
-    if(!cell->mesh().cell_orientations().empty())
-    {
-      dolfin_assert(cell->index() < cell->mesh().cell_orientations().size());
-     cell_orientation = cell->mesh().cell_orientations()[cell->index()];
-    }
-    ufc_cell_global.orientation = cell_orientation;
-    ufc_cell_local.orientation = cell_orientation;
-
-    // Get cell data (local)
-    for (std::size_t d = 0; d < D; ++d)
-    {
-      // Get cell local entities
-      ufc_cell_local.entity_indices[d].resize(cell->num_entities(d));
-      for (std::size_t i = 0; i < cell->num_entities(d); ++i)
-        ufc_cell_local.entity_indices[d][i] = cell->entities(d)[i];
-    }
-    ufc_cell_local.entity_indices[D].resize(1);
-    ufc_cell_local.entity_indices[D][0] = cell->index();
-    ufc_cell_local.index = cell->index();
-
-    // Get global cell entities/data (global)
-    cell->get_cell_data(ufc_cell_global);
-    cell->get_cell_topology(ufc_cell_global);
-
     // Get reference to container for cell dofs
     std::vector<la_index>& cell_nodes = node_dofmap[cell->index()];
     cell_nodes.resize(local_dim);
 
     // Tabulate standard UFC dof map for first space (local)
-    ufc_nodes_local.resize(local_dim);
+    get_cell_entities_local(*cell, entity_indices, needs_entities);
     dofmaps[0]->tabulate_dofs(ufc_nodes_local.data(),
                               num_mesh_entities_local,
-                              ufc_cell_local);
+                              entity_indices);
     std::copy(ufc_nodes_local.begin(), ufc_nodes_local.end(),
               cell_nodes.begin());
 
     // Tabulate standard UFC dof map for first space (global)
-    ufc_nodes_global.resize(local_dim);
+    get_cell_entities_global(*cell, entity_indices, needs_entities);
     dofmaps[0]->tabulate_dofs(ufc_nodes_global.data(),
                               num_mesh_entities_global_unconstrained,
-                              ufc_cell_global);
+                              entity_indices);
 
     // Build local-to-global map for nodes
     for (std::size_t i = 0; i < local_dim; ++i)
@@ -1200,6 +1181,11 @@ DofMapBuilder::build_ufc_node_graph_constrained(
   // Topological dimension
   const std::size_t D = mesh.topology().dim();
 
+  // Extract needs_entities as vector
+  std::vector<bool> needs_entities(D + 1);
+  for (std::size_t d = 0; d <= D; ++d)
+    needs_entities[d] = ufc_dofmap->needs_mesh_entities(d);
+
   // Generate and number required mesh entities (local & global, and
   // constrained global)
   std::vector<std::size_t> num_mesh_entities_local(D + 1, 0);
@@ -1207,7 +1193,7 @@ DofMapBuilder::build_ufc_node_graph_constrained(
   std::vector<bool> required_mesh_entities(D + 1, false);
   for (std::size_t d = 0; d <= D; ++d)
   {
-    if (ufc_dofmap->needs_mesh_entities(d))
+    if (needs_entities[d])
     {
       required_mesh_entities[d] = true;
       mesh.init(d);
@@ -1250,15 +1236,17 @@ DofMapBuilder::build_ufc_node_graph_constrained(
   node_dofmap.clear();
   node_dofmap.resize(mesh.num_cells());
 
-  // Holder for UFC 64-bit dofmap integers
-  std::vector<std::size_t> ufc_nodes_local, ufc_nodes_global,
-    ufc_nodes_global_constrained;
-
   // Get standard local element dimension
   const std::size_t local_dim = dofmaps[0]->num_element_dofs();
 
-  // Create UFC cell and allocate memory
-  ufc::cell ufc_cell;
+  // Holder for UFC 64-bit dofmap integers
+  std::vector<std::size_t> ufc_nodes_local(local_dim);
+  std::vector<std::size_t> ufc_nodes_global_constrained(local_dim);
+
+  // Allocate entity indices array
+  std::vector<std::vector<std::size_t>> entity_indices(D+1);
+  for (std::size_t d = 0; d <= D; ++d)
+    entity_indices[d].resize(mesh.type().num_entities(d));
 
   // Resize local-to-global map
   std::vector<std::size_t> node_local_to_global_constrained(offset_local[1]);
@@ -1272,29 +1260,19 @@ DofMapBuilder::build_ufc_node_graph_constrained(
     cell_nodes.resize(local_dim);
 
     // Tabulate standard UFC dof map for first space (local)
-    ufc_nodes_local.resize(local_dim);
-    get_cell_data_local(ufc_cell, *cell);
+    get_cell_entities_local(*cell, entity_indices, needs_entities);
     dofmaps[0]->tabulate_dofs(ufc_nodes_local.data(),
                               num_mesh_entities_local,
-                              ufc_cell);
+                              entity_indices);
     std::copy(ufc_nodes_local.begin(), ufc_nodes_local.end(),
               cell_nodes.begin());
 
-    // Tabulate standard UFC dof map for first space (global)
-    ufc_nodes_global.resize(local_dim);
-    cell->get_cell_data(ufc_cell);
-    cell->get_cell_topology(ufc_cell);
-    dofmaps[0]->tabulate_dofs(ufc_nodes_global.data(),
-                              num_mesh_entities_global_unconstrained,
-                              ufc_cell);
-
     // Tabulate standard UFC dof map for first space (global, constrained)
-    ufc_nodes_global_constrained.resize(local_dim);
-    get_cell_data_global_constrained(ufc_cell, *cell,
-                                     global_entity_indices);
+    get_cell_entities_global_constrained(*cell, entity_indices,
+                                         global_entity_indices, needs_entities);
     dofmaps[0]->tabulate_dofs(ufc_nodes_global_constrained.data(),
                               num_mesh_entities_global,
-                              ufc_cell);
+                              entity_indices);
 
     // Build local-to-global map for nodes
     for (std::size_t i = 0; i < local_dim; ++i)
@@ -1398,7 +1376,7 @@ void DofMapBuilder::compute_constrained_mesh_indices(
       else
       {
         // Get number of entities
-        std::map<unsigned int, std::set<unsigned int>> shared_entities;
+        std::map<std::int32_t, std::set<unsigned int>> shared_entities;
         const std::size_t num_entities
           = DistributedMeshTools::number_entities(mesh,
                                                   slave_to_master_mesh_entities,
@@ -1428,6 +1406,7 @@ void DofMapBuilder::compute_shared_nodes(
   std::fill(shared_nodes.begin(), shared_nodes.end(), -1);
 
   std::vector<std::size_t> facet_nodes(ufc_dofmap.num_facet_dofs());
+
   // Mark dofs associated ghost cells as ghost dofs (provisionally)
   bool has_ghost_cells = false;
   for (CellIterator c(mesh, "all"); !c.end(); ++c)
@@ -1497,8 +1476,7 @@ void DofMapBuilder::compute_shared_nodes(
 }
 //-----------------------------------------------------------------------------
 void DofMapBuilder::compute_node_reordering(
-  std::vector<std::size_t>& local_to_global_unowned,
-  std::vector<int>& off_process_owner,
+  IndexMap& index_map,
   std::vector<int>& old_to_new_local,
   const std::unordered_map<int, std::vector<int>>& node_to_sharing_processes,
   const std::vector<std::size_t>& old_local_to_global,
@@ -1517,7 +1495,9 @@ void DofMapBuilder::compute_node_reordering(
     else if (*node == -1)
       ++unowned_local_size;
     else
-      error("Invalid node ownership index.");
+      dolfin_error("DofMap.cpp",
+                   "compute node reordering",
+                   "Invalid node ownership index.");
   }
   dolfin_assert((unowned_local_size+owned_local_size) == node_ownership.size());
   dolfin_assert((unowned_local_size+owned_local_size)
@@ -1656,8 +1636,8 @@ void DofMapBuilder::compute_node_reordering(
 
   MPI::all_to_all(mpi_comm, send_buffer, recv_buffer);
 
-  local_to_global_unowned.resize(unowned_local_size);
-  off_process_owner.resize(unowned_local_size);
+  std::vector<std::size_t> local_to_global_unowned(unowned_local_size);
+  //  off_process_owner.resize(unowned_local_size);
   std::size_t off_process_node_counter = 0;
 
   for (std::size_t src = 0; src != mpi_size; ++src)
@@ -1674,7 +1654,7 @@ void DofMapBuilder::compute_node_reordering(
       const int received_old_node_index_local = it->second;
       local_to_global_unowned[off_process_node_counter]
         = received_new_node_index_global;
-      off_process_owner[off_process_node_counter] = src;
+      // off_process_owner[off_process_node_counter] = src;
 
       const int new_index_local = owned_local_size + off_process_node_counter;
       dolfin_assert(old_to_new_local[received_old_node_index_local] < 0);
@@ -1682,6 +1662,8 @@ void DofMapBuilder::compute_node_reordering(
       off_process_node_counter++;
     }
 
+  index_map.set_local_to_global(local_to_global_unowned);
+
   // Sanity check
   for (auto it : old_to_new_local)
   {
@@ -1715,68 +1697,105 @@ void DofMapBuilder::build_dofmap(
   }
 }
 //-----------------------------------------------------------------------------
-void DofMapBuilder::get_cell_data_local(ufc::cell& ufc_cell,
-                                        const Cell& cell)
+void DofMapBuilder::get_cell_entities_local(const Cell& cell,
+  std::vector<std::vector<std::size_t>>& entity_indices,
+  const std::vector<bool>& needs_mesh_entities)
 {
   const std::size_t D = cell.mesh().topology().dim();
-  ufc_cell.entity_indices.resize(D + 1);
-
-  // Set cell orientation
-  ufc_cell.orientation = cell.orientation();
-
-  // Set data
+  for (std::size_t d = 0; d < D; ++d)
+    if (needs_mesh_entities[d])
+      for (std::size_t i = 0; i < cell.num_entities(d); ++i)
+        entity_indices[d][i] = cell.entities(d)[i];
+  // Handle cell index separately because cell.entities(D) doesn't work.
+  if (needs_mesh_entities[D])
+    entity_indices[D][0] = cell.index();
+}
+//-----------------------------------------------------------------------------
+void DofMapBuilder::get_cell_entities_global(const Cell& cell,
+  std::vector<std::vector<std::size_t>>& entity_indices,
+  const std::vector<bool>& needs_mesh_entities)
+{
+  const MeshTopology& topology = cell.mesh().topology();
+  const std::size_t D = topology.dim();
   for (std::size_t d = 0; d < D; ++d)
   {
-    // Get cell local entities
-    ufc_cell.entity_indices[d].resize(cell.num_entities(d));
-    for (std::size_t i = 0; i < cell.num_entities(d); ++i)
-      ufc_cell.entity_indices[d][i] = cell.entities(d)[i];
+    if (needs_mesh_entities[d])
+    {
+      if (topology.have_global_indices(d)) // TODO: Check if this ever will be false in here
+      {
+        const std::vector<std::size_t>& global_indices = topology.global_indices(d);
+        for (std::size_t i = 0; i < cell.num_entities(d); ++i)
+          entity_indices[d][i] = global_indices[cell.entities(d)[i]];
+      }
+      else
+      {
+        for (std::size_t i = 0; i < cell.num_entities(d); ++i)
+          entity_indices[d][i] = cell.entities(d)[i];
+      }
+    }
+  }
+  // Handle cell index separately because cell.entities(D) doesn't work.
+  if (needs_mesh_entities[D])
+  {
+    if (topology.have_global_indices(D))
+      entity_indices[D][0] = cell.global_index();
+    else
+      entity_indices[D][0] = cell.index();
   }
-  ufc_cell.entity_indices[D].resize(1);
-  ufc_cell.entity_indices[D][0] = cell.index();
-  ufc_cell.index = cell.index();
 }
+// TODO: The above and below functions are _very_ similar, can they be combined?
 //-----------------------------------------------------------------------------
-void DofMapBuilder::get_cell_data_global_constrained(
-  ufc::cell& ufc_cell, const Cell& cell,
-  const std::vector<std::vector<std::size_t>>& global_entity_indices)
+void DofMapBuilder::get_cell_entities_global_constrained(const Cell& cell,
+  std::vector<std::vector<std::size_t>>& entity_indices,
+  const std::vector<std::vector<std::size_t>>& global_entity_indices,
+  const std::vector<bool>& needs_mesh_entities)
 {
   const std::size_t D = cell.mesh().topology().dim();
-  ufc_cell.entity_indices.resize(D + 1);
-
   for (std::size_t d = 0; d < D; ++d)
   {
-    ufc_cell.entity_indices[d].resize(cell.num_entities(d));
-    if (!global_entity_indices[d].empty())
+    if (needs_mesh_entities[d])
     {
-      ufc_cell.entity_indices[d].resize(cell.num_entities(d));
-      for (std::size_t i = 0; i < cell.num_entities(d); ++i)
+      if (global_entity_indices[d].empty())
       {
-        ufc_cell.entity_indices[d][i]
-          = global_entity_indices[d][cell.entities(d)[i]];
+        dolfin_error("DofMapBuilder.cpp",
+                     "get_cell_entities_global_constrained",
+                     "Missing global entity indices needed for cell entity tabulation.");
       }
+      if (!global_entity_indices[d].empty()) // TODO: Can this be false? If so the entity_indices array will contain garbage
+      {
+        const std::vector<std::size_t>& global_indices = global_entity_indices[d];
+        for (std::size_t i = 0; i < cell.num_entities(d); ++i)
+          entity_indices[d][i] = global_indices[cell.entities(d)[i]];
+      }
+    }
+  }
+  // Handle cell index separately because cell.entities(D) doesn't work.
+  if (needs_mesh_entities[D])
+  {
+    if (global_entity_indices[D].empty())
+    {
+      dolfin_error("DofMapBuilder.cpp",
+                   "get_cell_entities_global_constrained",
+                   "Missing global cell index needed for cell index tabulation.");
     }
+    //entity_indices[D][0] = cell.index(); // This was the line here before, don't understand how that didn't fail miserably.
+    entity_indices[D][0] = global_entity_indices[D][cell.index()];
   }
-  ufc_cell.entity_indices[D].resize(1);
-  ufc_cell.entity_indices[D][0] = cell.index();
-  ufc_cell.index = cell.index();
 }
 //-----------------------------------------------------------------------------
-std::vector<std::size_t>
-DofMapBuilder::compute_num_mesh_entities_local(const Mesh& mesh,
-                                               const ufc::dofmap& ufc_dofmap)
+std::vector<std::size_t> DofMapBuilder::compute_num_mesh_entities_local(
+  const Mesh& mesh, const std::vector<bool>& needs_mesh_entities)
 {
   const std::size_t D = mesh.topology().dim();
   std::vector<std::size_t> num_mesh_entities_local(D + 1);
   for (std::size_t d = 0; d <= D; ++d)
   {
-    if (ufc_dofmap.needs_mesh_entities(d))
+    if (needs_mesh_entities[d])
     {
       mesh.init(d);
       num_mesh_entities_local[d] = mesh.num_entities(d);
     }
   }
-
   return num_mesh_entities_local;
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/fem/DofMapBuilder.h b/dolfin/fem/DofMapBuilder.h
index b94c865..8cb75c6 100644
--- a/dolfin/fem/DofMapBuilder.h
+++ b/dolfin/fem/DofMapBuilder.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2013 Anders Logg, Ola Skavhaug and Garth N. Wells
+// Copyright (C) 2008-2015 Anders Logg, Ola Skavhaug and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -18,15 +18,13 @@
 // Modified by Niclas Jansson 2009.
 // Modified by Garth Wells 2009-2012
 // Modified by Mikael Mortensen 2012.
-//
-// First added:  2008-08-12
-// Last changed: 2012-11-05
+// Modified by Martin Alnaes, 2015
 
 #ifndef __DOF_MAP_BUILDER_H
 #define __DOF_MAP_BUILDER_H
 
-#include <memory>
 #include <map>
+#include <memory>
 #include <set>
 #include <unordered_map>
 #include <utility>
@@ -42,6 +40,7 @@ namespace dolfin
 
   class DofMap;
   class Mesh;
+  class IndexMap;
   class SubDomain;
   class UFC;
 
@@ -52,8 +51,8 @@ namespace dolfin
 
   public:
 
-    /// Build dofmap. The constrained domain may be
-    /// a null pointer, in which case it is ignored.
+    /// Build dofmap. The constrained domain may be a null pointer, in
+    /// which case it is ignored.
     static void build(DofMap& dofmap, const Mesh& dolfin_mesh,
                       std::shared_ptr<const SubDomain> constrained_domain);
 
@@ -176,8 +175,7 @@ namespace dolfin
       const Mesh& mesh);
 
     static void compute_node_reordering(
-      std::vector<std::size_t>& local_to_global_unowned,
-      std::vector<int>& off_process_owner,
+      IndexMap& index_map,
       std::vector<int>& old_to_new_local,
       const std::unordered_map<int, std::vector<int>>& node_to_sharing_processes,
       const std::vector<std::size_t>& old_local_to_global,
@@ -186,18 +184,23 @@ namespace dolfin
       const std::set<std::size_t>& global_nodes,
       const MPI_Comm mpi_comm);
 
-    static void get_cell_data_local(ufc::cell& ufc_cell,
-                                    const Cell& cell);
+    static void get_cell_entities_local(const Cell& cell,
+      std::vector<std::vector<std::size_t>>& entity_indices,
+      const std::vector<bool>& needs_mesh_entities);
+
+    static void get_cell_entities_global(const Cell& cell,
+      std::vector<std::vector<std::size_t>>& entity_indices,
+      const std::vector<bool>& needs_mesh_entities);
 
-    static void get_cell_data_global_constrained(
-      ufc::cell& ufc_cell, const Cell& cell,
-      const std::vector<std::vector<std::size_t>>& global_entity_indices);
+    static void get_cell_entities_global_constrained(const Cell& cell,
+      std::vector<std::vector<std::size_t>>& entity_indices,
+      const std::vector<std::vector<std::size_t>>& global_entity_indices,
+      const std::vector<bool>& needs_mesh_entities);
 
     // Compute number of mesh entities for dimensions required by
     // dofmap
-    static std::vector<std::size_t>
-      compute_num_mesh_entities_local(const Mesh& mesh,
-                                      const ufc::dofmap& ufc_dofmap);
+    static std::vector<std::size_t> compute_num_mesh_entities_local(
+      const Mesh& mesh, const std::vector<bool>& needs_mesh_entities);
 
   };
 }
diff --git a/dolfin/fem/DomainAssigner.cpp b/dolfin/fem/DomainAssigner.cpp
deleted file mode 100644
index 17b72db..0000000
--- a/dolfin/fem/DomainAssigner.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (C) 2011 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-03-09
-// Last changed: 2014-10-03
-
-#include <dolfin/common/NoDeleter.h>
-#include "Form.h"
-#include "DomainAssigner.h"
-
-using namespace dolfin;
-
-//-----------------------------------------------------------------------------
-const CellDomainAssigner&
-CellDomainAssigner::operator= (const MeshFunction<std::size_t>& domains)
-{
-  _form.set_cell_domains(reference_to_no_delete_pointer(domains));
-  return *this;
-}
-//-----------------------------------------------------------------------------
-const CellDomainAssigner&
-CellDomainAssigner::operator= (std::shared_ptr<const MeshFunction<std::size_t>> domains)
-{
-  _form.set_cell_domains(domains);
-  return *this;
-}
-//-----------------------------------------------------------------------------
-const ExteriorFacetDomainAssigner&
-ExteriorFacetDomainAssigner::operator= (const MeshFunction<std::size_t>& domains)
-{
-  _form.set_exterior_facet_domains(reference_to_no_delete_pointer(domains));
-  return *this;
-}
-//-----------------------------------------------------------------------------
-const ExteriorFacetDomainAssigner&
-ExteriorFacetDomainAssigner::operator= (std::shared_ptr<const MeshFunction<std::size_t>> domains)
-{
-  _form.set_exterior_facet_domains(domains);
-  return *this;
-}
-//-----------------------------------------------------------------------------
-const InteriorFacetDomainAssigner&
-InteriorFacetDomainAssigner::operator= (const MeshFunction<std::size_t>& domains)
-{
-  _form.set_interior_facet_domains(reference_to_no_delete_pointer(domains));
-  return *this;
-}
-//-----------------------------------------------------------------------------
-const InteriorFacetDomainAssigner&
-InteriorFacetDomainAssigner::operator= (std::shared_ptr<const MeshFunction<std::size_t>> domains)
-{
-  _form.set_interior_facet_domains(domains);
-  return *this;
-}
-//-----------------------------------------------------------------------------
-const VertexDomainAssigner&
-VertexDomainAssigner::operator= (const MeshFunction<std::size_t>& domains)
-{
-  _form.set_vertex_domains(reference_to_no_delete_pointer(domains));
-  return *this;
-}
-//-----------------------------------------------------------------------------
-const VertexDomainAssigner&
-VertexDomainAssigner::operator= (std::shared_ptr<const MeshFunction<std::size_t>> domains)
-{
-  _form.set_vertex_domains(domains);
-  return *this;
-}
-//-----------------------------------------------------------------------------
diff --git a/dolfin/fem/DomainAssigner.h b/dolfin/fem/DomainAssigner.h
deleted file mode 100644
index f27ba42..0000000
--- a/dolfin/fem/DomainAssigner.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (C) 2011 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-03-09
-// Last changed: 2014-10-03
-
-#ifndef __DOMAIN_ASSIGNER_H
-#define __DOMAIN_ASSIGNER_H
-
-#include <memory>
-
-namespace dolfin
-{
-
-  class Form;
-  template <typename T> class MeshFunction;
-
-  /// These classes are used for assignment of domains to forms:
-  ///
-  ///   a.dx = cell_domains
-  ///   a.ds = exterior_facet_domains
-  ///   a.dS = interior_facet_domains
-  ///
-  /// where the arguments can be either objects/references or
-  /// shared pointers to MeshFunctions.
-
-  /// Assignment of cell domains
-  class CellDomainAssigner
-  {
-  public:
-
-    // Constructor
-    CellDomainAssigner(Form& form) : _form(form) {}
-
-    // Assign reference
-    const CellDomainAssigner& operator= (const MeshFunction<std::size_t>& domains);
-
-    // Assign shared pointer
-    const CellDomainAssigner& operator= (std::shared_ptr<const MeshFunction<std::size_t> > domains);
-
-  private:
-
-    // The form
-    Form& _form;
-
-  };
-
-  /// Assignment of exterior facet domains
-  class ExteriorFacetDomainAssigner
-  {
-  public:
-
-    // Constructor
-    ExteriorFacetDomainAssigner(Form& form) : _form(form) {}
-
-    // Assign reference
-    const ExteriorFacetDomainAssigner& operator= (const MeshFunction<std::size_t>& domains);
-
-    // Assign shared pointer
-    const ExteriorFacetDomainAssigner& operator= (std::shared_ptr<const MeshFunction<std::size_t> > domains);
-
-  private:
-
-    // The form
-    Form& _form;
-
-  };
-
-  /// Assignment of interior facet domains
-  class InteriorFacetDomainAssigner
-  {
-  public:
-
-    // Constructor
-    InteriorFacetDomainAssigner(Form& form) : _form(form) {}
-
-    // Assign reference
-    const InteriorFacetDomainAssigner& operator= (const MeshFunction<std::size_t>& domains);
-
-    // Assign shared pointer
-    const InteriorFacetDomainAssigner& operator= (std::shared_ptr<const MeshFunction<std::size_t> > domains);
-
-  private:
-
-    // The form
-    Form& _form;
-
-  };
-
-  /// Assignment of vertex domains
-  class VertexDomainAssigner
-  {
-  public:
-
-    // Constructor
-    VertexDomainAssigner(Form& form) : _form(form) {}
-
-    // Assign reference
-    const VertexDomainAssigner& operator= (const MeshFunction<std::size_t>& domains);
-
-    // Assign shared pointer
-    const VertexDomainAssigner& operator= (std::shared_ptr<const MeshFunction<std::size_t> > domains);
-
-  private:
-
-    // The form
-    Form& _form;
-
-  };
-
-}
-
-#endif
diff --git a/dolfin/fem/FiniteElement.cpp b/dolfin/fem/FiniteElement.cpp
index c99e100..e922f6b 100644
--- a/dolfin/fem/FiniteElement.cpp
+++ b/dolfin/fem/FiniteElement.cpp
@@ -20,6 +20,7 @@
 
 #include <dolfin/common/utils.h>
 #include <dolfin/log/log.h>
+#include <dolfin/mesh/Cell.h>
 #include "FiniteElement.h"
 
 using namespace dolfin;
@@ -31,12 +32,35 @@ FiniteElement::FiniteElement(std::shared_ptr<const ufc::finite_element> element)
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<const FiniteElement> 
+void FiniteElement::tabulate_dof_coordinates(
+  boost::multi_array<double, 2>& coordinates,
+  const std::vector<double>& coordinate_dofs,
+  const Cell& cell) const
+{
+  dolfin_assert(_ufc_element);
+
+  // Check dimensions
+  const std::size_t dim = this->space_dimension();
+  const std::size_t gdim = this->geometric_dimension();
+  if (coordinates.shape()[0] != dim or coordinates.shape()[1] != gdim)
+  {
+    boost::multi_array<double, 2>::extent_gen extents;
+    coordinates.resize(extents[dim][gdim]);
+  }
+
+  // Tabulate coordinates
+  _ufc_element->tabulate_dof_coordinates(coordinates.data(),
+                                         coordinate_dofs.data());
+}
+//-----------------------------------------------------------------------------
+std::shared_ptr<const FiniteElement>
 FiniteElement::extract_sub_element(const std::vector<std::size_t>& component) const
 {
   // Recursively extract sub element
-  std::shared_ptr<const FiniteElement> sub_finite_element = extract_sub_element(*this, component);
-  log(DBG, "Extracted finite element for sub system: %s", sub_finite_element->signature().c_str());
+  std::shared_ptr<const FiniteElement> sub_finite_element
+    = extract_sub_element(*this, component);
+  log(DBG, "Extracted finite element for sub system: %s",
+      sub_finite_element->signature().c_str());
 
   return sub_finite_element;
 }
@@ -71,7 +95,8 @@ FiniteElement::extract_sub_element(const FiniteElement& finite_element,
   }
 
   // Create sub system
-  std::shared_ptr<const FiniteElement> sub_element = finite_element.create_sub_element(component[0]);
+  std::shared_ptr<const FiniteElement> sub_element
+    = finite_element.create_sub_element(component[0]);
   dolfin_assert(sub_element);
 
   // Return sub system if sub sub system should not be extracted
@@ -82,8 +107,9 @@ FiniteElement::extract_sub_element(const FiniteElement& finite_element,
   std::vector<std::size_t> sub_component;
   for (std::size_t i = 1; i < component.size(); i++)
     sub_component.push_back(component[i]);
-  std::shared_ptr<const FiniteElement> sub_sub_element = extract_sub_element(*sub_element, sub_component);
-  //delete sub_element;
+
+  std::shared_ptr<const FiniteElement> sub_sub_element
+    = extract_sub_element(*sub_element, sub_component);
 
   return sub_sub_element;
 }
diff --git a/dolfin/fem/FiniteElement.h b/dolfin/fem/FiniteElement.h
index 288337a..13203f8 100644
--- a/dolfin/fem/FiniteElement.h
+++ b/dolfin/fem/FiniteElement.h
@@ -21,12 +21,15 @@
 #include <memory>
 #include <vector>
 #include <ufc.h>
+#include <boost/multi_array.hpp>
 #include <dolfin/common/types.h>
 #include <dolfin/log/log.h>
 
 namespace dolfin
 {
 
+  class Cell;
+
   /// This is a wrapper for a UFC finite element (ufc::finite_element).
 
   class FiniteElement
@@ -92,22 +95,22 @@ namespace dolfin
 
     /// Evaluate basis function i at given point in cell
     void evaluate_basis(std::size_t i, double* values, const double* x,
-                        const double* vertex_coordinates,
+                        const double* coordinate_dofs,
                         int cell_orientation) const
     {
       dolfin_assert(_ufc_element);
-      _ufc_element->evaluate_basis(i, values, x, vertex_coordinates,
+      _ufc_element->evaluate_basis(i, values, x, coordinate_dofs,
                                    cell_orientation);
     }
 
     /// Evaluate all basis functions at given point in cell
     void evaluate_basis_all(double* values,
                             const double* x,
-                            const double* vertex_coordinates,
+                            const double* coordinate_dofs,
                             int cell_orientation) const
     {
       dolfin_assert(_ufc_element);
-      _ufc_element->evaluate_basis_all(values, x, vertex_coordinates,
+      _ufc_element->evaluate_basis_all(values, x, coordinate_dofs,
                                        cell_orientation);
     }
 
@@ -116,12 +119,12 @@ namespace dolfin
                                     unsigned int n,
                                     double* values,
                                     const double* x,
-                                    const double* vertex_coordinates,
+                                    const double* coordinate_dofs,
                                     int cell_orientation) const
     {
       dolfin_assert(_ufc_element);
       _ufc_element->evaluate_basis_derivatives(i, n, values, x,
-                                               vertex_coordinates,
+                                               coordinate_dofs,
                                                cell_orientation);
     }
 
@@ -130,67 +133,64 @@ namespace dolfin
     void evaluate_basis_derivatives_all(unsigned int n,
                                         double* values,
                                         const double* x,
-                                        const double* vertex_coordinates,
+                                        const double* coordinate_dofs,
                                         int cell_orientation) const
     {
       dolfin_assert(_ufc_element);
       _ufc_element->evaluate_basis_derivatives_all(n, values, x,
-                                                   vertex_coordinates,
+                                                   coordinate_dofs,
                                                    cell_orientation);
     }
 
     /// Evaluate linear functional for dof i on the function f
     double evaluate_dof(std::size_t i,
                         const ufc::function& function,
-                        const double* vertex_coordinates,
+                        const double* coordinate_dofs,
                         int cell_orientation,
                         const ufc::cell& c) const
     {
       dolfin_assert(_ufc_element);
-      return _ufc_element->evaluate_dof(i, function, vertex_coordinates,
+      return _ufc_element->evaluate_dof(i, function, coordinate_dofs,
                                         cell_orientation, c);
     }
 
     /// Evaluate linear functionals for all dofs on the function f
     void evaluate_dofs(double* values,
                        const ufc::function& f,
-                       const double* vertex_coordinates,
+                       const double* coordinate_dofs,
                        int cell_orientation,
                        const ufc::cell& c) const
     {
       dolfin_assert(_ufc_element);
-      _ufc_element->evaluate_dofs(values, f, vertex_coordinates,
+      _ufc_element->evaluate_dofs(values, f, coordinate_dofs,
                                   cell_orientation, c);
     }
 
     /// Interpolate vertex values from dof values
     void interpolate_vertex_values(double* vertex_values,
                                    double* coefficients,
-                                   const double* vertex_coordinates,
+                                   const double* coordinate_dofs,
                                    int cell_orientation,
                                    const ufc::cell& cell) const
     {
       dolfin_assert(_ufc_element);
       _ufc_element->interpolate_vertex_values(vertex_values, coefficients,
-                                              vertex_coordinates,
+                                              coordinate_dofs,
                                               cell_orientation, cell);
     }
 
-    /// Map coordinate xhat from reference cell to coordinate x in cell
-    void map_from_reference_cell(double* x, const double* xhat,
-                                 const ufc::cell& c) const
-    {
-      dolfin_assert(_ufc_element);
-      _ufc_element->map_from_reference_cell(x, xhat, c);
-    }
-
-    /// Map from coordinate x in cell to coordinate xhat in reference cell
-    void map_to_reference_cell(double* xhat, const double* x,
-                               const ufc::cell& c) const
-    {
-      dolfin_assert(_ufc_element);
-      _ufc_element->map_to_reference_cell(xhat, x, c);
-    }
+    /// Tabulate the coordinates of all dofs on an element
+    ///
+    /// *Arguments*
+    ///     coordinates (boost::multi_array<double, 2>)
+    ///         The coordinates of all dofs on a cell.
+    ///     coordinate_dofs (std::vector<double>)
+    ///         The cell coordinates
+    ///     cell (Cell)
+    ///         The cell.
+    void tabulate_dof_coordinates(boost::multi_array<double, 2>& coordinates,
+                                  const std::vector<double>& coordinate_dofs,
+                                  const Cell& cell) const;
 
     /// Return the number of sub elements (for a mixed element)
     std::size_t num_sub_elements() const
diff --git a/dolfin/fem/Form.cpp b/dolfin/fem/Form.cpp
index 02c582a..1367d1f 100644
--- a/dolfin/fem/Form.cpp
+++ b/dolfin/fem/Form.cpp
@@ -19,7 +19,7 @@
 // Modified by Martin Alnes 2008
 //
 // First added:  2007-12-10
-// Last changed: 2014-02-14
+// Last changed: 2015-11-08
 
 #include <memory>
 #include <string>
@@ -40,19 +40,16 @@ using namespace dolfin;
 
 //-----------------------------------------------------------------------------
 Form::Form(std::size_t rank, std::size_t num_coefficients)
-  : Hierarchical<Form>(*this),
-    dx(*this), ds(*this), dS(*this), dP(*this),
-    _function_spaces(rank), _coefficients(num_coefficients), _rank(rank)
+  : Hierarchical<Form>(*this),  _function_spaces(rank),
+  _coefficients(num_coefficients), _rank(rank)
 {
   // Do nothing
 }
 //-----------------------------------------------------------------------------
 Form::Form(std::shared_ptr<const ufc::form> ufc_form,
-           std::vector<std::shared_ptr<const FunctionSpace>> function_spaces,
-           std::vector<std::shared_ptr<const GenericFunction>> coefficients)
-  : Hierarchical<Form>(*this),
-    dx(*this), ds(*this), dS(*this), dP(*this), _ufc_form(ufc_form),
-    _function_spaces(function_spaces), _coefficients(coefficients),
+           std::vector<std::shared_ptr<const FunctionSpace>> function_spaces)
+  : Hierarchical<Form>(*this), _ufc_form(ufc_form),
+    _function_spaces(function_spaces), _coefficients(ufc_form->num_coefficients()),
     _rank(ufc_form->rank())
 {
   // Do nothing
@@ -85,12 +82,19 @@ std::size_t Form::num_coefficients() const
   }
 }
 //-----------------------------------------------------------------------------
+std::size_t Form::original_coefficient_position(std::size_t i) const
+{
+  dolfin_assert(_ufc_form);
+  return _ufc_form->original_coefficient_position(i);
+}
+//-----------------------------------------------------------------------------
 std::vector<std::size_t> Form::coloring(std::size_t entity_dim) const
 {
   warning("Form::coloring does not properly consider form type.");
 
   // Get mesh
-  const Mesh& mesh = this->mesh();
+  dolfin_assert(this->mesh());
+  const Mesh& mesh = *(this->mesh());
   const std::size_t cell_dim = mesh.topology().dim();
 
   std::vector<std::size_t> _coloring;
@@ -113,7 +117,7 @@ void Form::set_mesh(std::shared_ptr<const Mesh> mesh)
   _mesh = mesh;
 }
 //-----------------------------------------------------------------------------
-const Mesh& Form::mesh() const
+std::shared_ptr<const Mesh> Form::mesh() const
 {
   // In the case when there are no function spaces (in the case of a
   // a functional) the (generated) subclass must set the mesh directly
@@ -135,14 +139,14 @@ const Mesh& Form::mesh() const
     meshes.push_back(_mesh);
 
   // Extract meshes from markers if any
-  if (_cell_domains)
-    meshes.push_back(_cell_domains->mesh());
-  if (_exterior_facet_domains)
-    meshes.push_back(_exterior_facet_domains->mesh());
-  if (_interior_facet_domains)
-    meshes.push_back(_interior_facet_domains->mesh());
-  if (_vertex_domains)
-    meshes.push_back(_vertex_domains->mesh());
+  if (dx)
+    meshes.push_back(dx->mesh());
+  if (ds)
+    meshes.push_back(ds->mesh());
+  if (dS)
+    meshes.push_back(dS->mesh());
+  if (dP)
+    meshes.push_back(dP->mesh());
 
   // Extract meshes from coefficients. Note that this is only done
   // when we don't already have a mesh sine it may otherwise conflict
@@ -179,12 +183,7 @@ const Mesh& Form::mesh() const
 
   // Return first mesh
   dolfin_assert(meshes[0]);
-  return *meshes[0];
-}
-//-----------------------------------------------------------------------------
-std::shared_ptr<const dolfin::Mesh> Form::mesh_shared_ptr() const
-{
-  return _mesh;
+  return meshes[0];
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<const FunctionSpace> Form::function_space(std::size_t i) const
@@ -297,46 +296,46 @@ std::string Form::coefficient_name(std::size_t i) const
 //-----------------------------------------------------------------------------
 std::shared_ptr<const MeshFunction<std::size_t>> Form::cell_domains() const
 {
-  return _cell_domains;
+  return dx;
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<const MeshFunction<std::size_t>> Form::exterior_facet_domains() const
 {
-  return _exterior_facet_domains;
+  return ds;
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<const MeshFunction<std::size_t>> Form::interior_facet_domains() const
 {
-  return _interior_facet_domains;
+  return dS;
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<const MeshFunction<std::size_t>> Form::vertex_domains() const
 {
-  return _vertex_domains;
+  return dP;
 }
 //-----------------------------------------------------------------------------
 void Form::set_cell_domains
 (std::shared_ptr<const MeshFunction<std::size_t>> cell_domains)
 {
-  _cell_domains = cell_domains;
+  dx = cell_domains;
 }
 //-----------------------------------------------------------------------------
 void Form::set_exterior_facet_domains
 (std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains)
 {
-  _exterior_facet_domains = exterior_facet_domains;
+  ds = exterior_facet_domains;
 }
 //-----------------------------------------------------------------------------
 void Form::set_interior_facet_domains
 (std::shared_ptr<const MeshFunction<std::size_t>> interior_facet_domains)
 {
-  _interior_facet_domains = interior_facet_domains;
+  dS = interior_facet_domains;
 }
 //-----------------------------------------------------------------------------
 void Form::set_vertex_domains
 (std::shared_ptr<const MeshFunction<std::size_t>> vertex_domains)
 {
-  _vertex_domains = vertex_domains;
+  dP = vertex_domains;
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<const ufc::form> Form::ufc_form() const
@@ -369,13 +368,15 @@ void Form::check() const
   // Check argument function spaces
   for (std::size_t i = 0; i < _function_spaces.size(); ++i)
   {
-    std::unique_ptr<ufc::finite_element> element(_ufc_form->create_finite_element(i));
+    std::unique_ptr<ufc::finite_element>
+      element(_ufc_form->create_finite_element(i));
     dolfin_assert(element);
     dolfin_assert(_function_spaces[i]->element());
     if (element->signature() != _function_spaces[i]->element()->signature())
     {
       log(ERROR, "Expected element: %s", element->signature());
-      log(ERROR, "Input element:    %s", _function_spaces[i]->element()->signature().c_str());
+      log(ERROR, "Input element:    %s",
+          _function_spaces[i]->element()->signature().c_str());
       dolfin_error("Form.cpp",
                    "assemble form",
                    "Wrong type of function space for argument %d", i);
diff --git a/dolfin/fem/Form.h b/dolfin/fem/Form.h
index 1277c7f..db178a8 100644
--- a/dolfin/fem/Form.h
+++ b/dolfin/fem/Form.h
@@ -30,7 +30,6 @@
 
 #include <dolfin/common/Hierarchical.h>
 #include <dolfin/common/types.h>
-#include "DomainAssigner.h"
 #include "Equation.h"
 
 // Forward declaration
@@ -101,11 +100,8 @@ namespace dolfin
     ///         The UFC form.
     ///     function_spaces (std::vector<_FunctionSpace_>)
     ///         Vector of function spaces.
-    ///     coefficients (std::vector<_GenericFunction_>)
-    ///         Vector of coefficients.
     Form(std::shared_ptr<const ufc::form> ufc_form,
-         std::vector<std::shared_ptr<const FunctionSpace> > function_spaces,
-         std::vector<std::shared_ptr<const GenericFunction> > coefficients);
+         std::vector<std::shared_ptr<const FunctionSpace>> function_spaces);
 
     /// Destructor
     virtual ~Form();
@@ -125,6 +121,13 @@ namespace dolfin
     ///         The number of coefficients.
     std::size_t num_coefficients() const;
 
+    /// Return original coefficient position for each coefficient (0 <= i < n)
+    ///
+    /// *Returns*
+    ///     std::size_t
+    ///         The position of coefficient i in original ufl form coefficients.
+    std::size_t original_coefficient_position(std::size_t i) const;
+
     /// Return coloring type for colored (multi-threaded) assembly of form
     /// over a mesh entity of a given dimension
     ///
@@ -148,15 +151,8 @@ namespace dolfin
     ///
     /// *Returns*
     ///     _Mesh_
-    ///         The mesh.
-    const Mesh& mesh() const;
-
-    /// Return mesh shared pointer (if any)
-    ///
-    /// *Returns*
-    ///     _Mesh_
-    ///         The mesh shared pointer.
-    std::shared_ptr<const Mesh> mesh_shared_ptr() const;
+    ///         Shared pointer to the mesh.
+    std::shared_ptr<const Mesh> mesh() const;
 
     /// Return function space for given argument
     ///
@@ -174,7 +170,7 @@ namespace dolfin
     /// *Returns*
     ///     std::vector<_FunctionSpace_>
     ///         Vector of function space shared pointers.
-    std::vector<std::shared_ptr<const FunctionSpace> > function_spaces() const;
+    std::vector<std::shared_ptr<const FunctionSpace>> function_spaces() const;
 
     /// Set coefficient with given number (shared pointer version)
     ///
@@ -204,7 +200,7 @@ namespace dolfin
     ///     coefficients (std::map<std::string, _GenericFunction_>)
     ///         The map of coefficients.
     void set_coefficients(std::map<std::string,
-                          std::shared_ptr<const GenericFunction> > coefficients);
+                          std::shared_ptr<const GenericFunction>> coefficients);
 
     /// Set some coefficients in given map. Each coefficient in the
     /// given map will be set, if the name of the coefficient matches
@@ -221,7 +217,7 @@ namespace dolfin
     ///     coefficients (std::map<std::string, _GenericFunction_>)
     ///         The map of coefficients.
     void set_some_coefficients(std::map<std::string,
-                               std::shared_ptr<const GenericFunction> > coefficients);
+                               std::shared_ptr<const GenericFunction>> coefficients);
 
     /// Return coefficient with given number
     ///
@@ -250,7 +246,7 @@ namespace dolfin
     /// *Returns*
     ///     std::vector<_GenericFunction_>
     ///         All coefficients.
-    std::vector<std::shared_ptr<const GenericFunction> > coefficients() const;
+    std::vector<std::shared_ptr<const GenericFunction>> coefficients() const;
 
     /// Return the number of the coefficient with this name
     ///
@@ -280,15 +276,15 @@ namespace dolfin
     /// *Returns*
     ///     _MeshFunction_ <std::size_t>
     ///         The cell domains.
-    std::shared_ptr<const MeshFunction<std::size_t> > cell_domains() const;
+    std::shared_ptr<const MeshFunction<std::size_t>> cell_domains() const;
 
     /// Return exterior facet domains (zero pointer if no domains have
     /// been specified)
     ///
     /// *Returns*
-    ///     std::shared_ptr<_MeshFunction_ <std::size_t> >
+    ///     std::shared_ptr<_MeshFunction_ <std::size_t>>
     ///         The exterior facet domains.
-    std::shared_ptr<const MeshFunction<std::size_t> > exterior_facet_domains() const;
+    std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains() const;
 
     /// Return interior facet domains (zero pointer if no domains have
     /// been specified)
@@ -296,7 +292,7 @@ namespace dolfin
     /// *Returns*
     ///     _MeshFunction_ <std::size_t>
     ///         The interior facet domains.
-    std::shared_ptr<const MeshFunction<std::size_t> > interior_facet_domains() const;
+    std::shared_ptr<const MeshFunction<std::size_t>> interior_facet_domains() const;
 
     /// Return vertex domains (zero pointer if no domains have been
     /// specified)
@@ -304,35 +300,36 @@ namespace dolfin
     /// *Returns*
     ///     _MeshFunction_ <std::size_t>
     ///         The vertex domains.
-    std::shared_ptr<const MeshFunction<std::size_t> > vertex_domains() const;
+    std::shared_ptr<const MeshFunction<std::size_t>> vertex_domains() const;
 
     /// Set cell domains
     ///
     /// *Arguments*
     ///     cell_domains (_MeshFunction_ <std::size_t>)
     ///         The cell domains.
-    void set_cell_domains(std::shared_ptr<const MeshFunction<std::size_t> > cell_domains);
+    void set_cell_domains(std::shared_ptr<const MeshFunction<std::size_t>>
+                          cell_domains);
 
     /// Set exterior facet domains
     ///
     /// *Arguments*
     ///     exterior_facet_domains (_MeshFunction_ <std::size_t>)
     ///         The exterior facet domains.
-    void set_exterior_facet_domains(std::shared_ptr<const MeshFunction<std::size_t> > exterior_facet_domains);
+    void set_exterior_facet_domains(std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains);
 
     /// Set interior facet domains
     ///
     /// *Arguments*
     ///     interior_facet_domains (_MeshFunction_ <std::size_t>)
     ///         The interior facet domains.
-    void set_interior_facet_domains(std::shared_ptr<const MeshFunction<std::size_t> > interior_facet_domains);
+    void set_interior_facet_domains(std::shared_ptr<const MeshFunction<std::size_t>> interior_facet_domains);
 
     /// Set vertex domains
     ///
     /// *Arguments*
     ///     vertex_domains (_MeshFunction_ <std::size_t>)
     ///         The vertex domains.
-    void set_vertex_domains(std::shared_ptr<const MeshFunction<std::size_t> > vertex_domains);
+    void set_vertex_domains(std::shared_ptr<const MeshFunction<std::size_t>> vertex_domains);
 
     /// Return UFC form shared pointer
     ///
@@ -350,11 +347,12 @@ namespace dolfin
     /// Comparison operator, returning equation lhs == 0
     Equation operator==(int rhs) const;
 
-    // Assignment of domains
-    CellDomainAssigner dx;
-    ExteriorFacetDomainAssigner ds;
-    InteriorFacetDomainAssigner dS;
-    VertexDomainAssigner dP;
+    // Domain markers (cells, exterior facets, interior facets,
+    // vertices)
+    std::shared_ptr<const MeshFunction<std::size_t>> dx;
+    std::shared_ptr<const MeshFunction<std::size_t>> ds;
+    std::shared_ptr<const MeshFunction<std::size_t>> dS;
+    std::shared_ptr<const MeshFunction<std::size_t>> dP;
 
   protected:
 
@@ -362,26 +360,14 @@ namespace dolfin
     std::shared_ptr<const ufc::form> _ufc_form;
 
     // Function spaces (one for each argument)
-    std::vector<std::shared_ptr<const FunctionSpace> > _function_spaces;
+    std::vector<std::shared_ptr<const FunctionSpace>> _function_spaces;
 
     // Coefficients
-    std::vector<std::shared_ptr<const GenericFunction> > _coefficients;
+    std::vector<std::shared_ptr<const GenericFunction>> _coefficients;
 
     // The mesh (needed for functionals when we don't have any spaces)
     std::shared_ptr<const Mesh> _mesh;
 
-    // Markers for cell domains
-    std::shared_ptr<const MeshFunction<std::size_t> > _cell_domains;
-
-    // Markers for exterior facet domains
-    std::shared_ptr<const MeshFunction<std::size_t> > _exterior_facet_domains;
-
-    // Markers for interior facet domains
-    std::shared_ptr<const MeshFunction<std::size_t> > _interior_facet_domains;
-
-    // Markers for vertex domains
-    std::shared_ptr<const MeshFunction<std::size_t> > _vertex_domains;
-
   private:
 
     const std::size_t _rank;
diff --git a/dolfin/fem/GenericDofMap.h b/dolfin/fem/GenericDofMap.h
index 625727a..847e949 100644
--- a/dolfin/fem/GenericDofMap.h
+++ b/dolfin/fem/GenericDofMap.h
@@ -25,7 +25,6 @@
 #include <map>
 #include <utility>
 #include <vector>
-#include <boost/multi_array.hpp>
 #include <memory>
 #include <unordered_map>
 #include <unordered_set>
@@ -34,6 +33,7 @@
 #include <dolfin/common/ArrayView.h>
 #include <dolfin/common/types.h>
 #include <dolfin/common/Variable.h>
+#include <dolfin/la/IndexMap.h>
 #include <dolfin/log/log.h>
 
 namespace ufc
@@ -56,7 +56,8 @@ namespace dolfin
   public:
 
     /// Constructor
-    GenericDofMap() : block_size(1) {}
+    GenericDofMap()
+    {}
 
     /// True if dof map is a view into another map (is a sub-dofmap)
     virtual bool is_view() const = 0;
@@ -122,19 +123,8 @@ namespace dolfin
                                       std::size_t dim,
                                       std::size_t local_entity) const = 0;
 
-    /// Tabulate the coordinates of all dofs on a cell (UFC cell version)
-    virtual
-      void tabulate_coordinates(boost::multi_array<double, 2>& coordinates,
-                                const std::vector<double>& vertex_coordinates,
-                                const Cell& cell) const = 0;
-
-    /// Tabulate the coordinates of all dofs owned by this
-    /// process. This function is typically used by preconditioners
-    /// that require the spatial coordinates of dofs, for example
-    /// for re-partitioning or nullspace computations. The format for
-    /// the return vector is [x0, y0, z0, x1, y1, z1, . . .].
-    virtual std::vector<double>
-      tabulate_all_coordinates(const Mesh& mesh) const = 0;
+    /// Tabulate globally supported dofs
+    virtual void tabulate_global_dofs(std::vector<std::size_t>& dofs) const = 0;
 
     /// Create a copy of the dof map
     virtual std::shared_ptr<GenericDofMap> copy() const = 0;
@@ -167,18 +157,13 @@ namespace dolfin
     /// matrix operator
     virtual void set(GenericVector& x, double value) const = 0;
 
-    /// Set dof entries in vector to the value*x[i], where x[i] is the
-    /// spatial coordinate of the dof. Parallel layout of vector must
-    /// be consistent with dof map range. This function is typically
-    /// used to construct the null space of a matrix operator, e.g. rigid
-    /// body rotations.
-    virtual void set_x(GenericVector& x, double value, std::size_t component,
-                       const Mesh& mesh) const = 0;
-
     /// Return the map from unowned local dofmap nodes to global dofmap
     /// nodes. Dofmap node is dof index modulo block size.
     virtual const std::vector<std::size_t>& local_to_global_unowned() const = 0;
 
+    /// Index map (const access)
+    virtual std::shared_ptr<const IndexMap> index_map() const = 0;
+
     /// Tabulate map between local (process) and global dof indices
     virtual void tabulate_local_to_global_dofs(std::vector<std::size_t>& local_to_global_map) const = 0;
 
@@ -187,7 +172,7 @@ namespace dolfin
 
     /// Return map from shared nodes to the processes (not including
     /// the current process) that share it.
-    virtual const std::unordered_map<int, std::vector<int> >&
+    virtual const std::unordered_map<int, std::vector<int>>&
       shared_nodes() const = 0;
 
     /// Return set of processes that share dofs with the this process
@@ -200,14 +185,13 @@ namespace dolfin
     /// Return informal string representation (pretty-print)
     virtual std::string str(bool verbose) const = 0;
 
+    /// Get block size
+    virtual int block_size() const = 0;
+
     /// Subdomain mapping constrained boundaries, e.g. periodic
     /// conditions
     std::shared_ptr<const SubDomain> constrained_domain;
 
-    /// Dofmap block size, e.g. 3 for 3D elasticity with a suitable
-    // ordered dofmap
-    std::size_t block_size;
-
   };
 
 }
diff --git a/dolfin/fem/LinearTimeDependentProblem.cpp b/dolfin/fem/LinearTimeDependentProblem.cpp
index 3ce5b80..692a2b5 100644
--- a/dolfin/fem/LinearTimeDependentProblem.cpp
+++ b/dolfin/fem/LinearTimeDependentProblem.cpp
@@ -14,78 +14,21 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-08-17
-// Last changed: 2012-08-20
 
-#include <dolfin/common/NoDeleter.h>
 #include <dolfin/function/Function.h>
-//#include "TensorProductForm.h"
 #include "LinearTimeDependentProblem.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-LinearTimeDependentProblem::
-LinearTimeDependentProblem(const TensorProductForm& a,
-                           const TensorProductForm& L,
-                           Function& u)
-  : Hierarchical<LinearTimeDependentProblem>(*this),
-    _a(reference_to_no_delete_pointer(a)),
-    _l(reference_to_no_delete_pointer(L)),
-    _u(reference_to_no_delete_pointer(u))
-{
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-LinearTimeDependentProblem::
-LinearTimeDependentProblem(const TensorProductForm& a,
-                           const TensorProductForm& L,
-                           Function& u,
-                           const BoundaryCondition& bc)
-  : Hierarchical<LinearTimeDependentProblem>(*this),
-    _a(reference_to_no_delete_pointer(a)),
-    _l(reference_to_no_delete_pointer(L)),
-    _u(reference_to_no_delete_pointer(u))
+LinearTimeDependentProblem::LinearTimeDependentProblem(
+  std::shared_ptr<const TensorProductForm> a,
+  std::shared_ptr<const TensorProductForm> L,
+  std::shared_ptr<Function> u,
+  std::vector<std::shared_ptr<const BoundaryCondition>> bcs)
+  : Hierarchical<LinearTimeDependentProblem>(*this), _a(a), _l(L), _u(u),
+  _bcs(bcs)
 {
-  // Store boundary condition
-  _bcs.push_back(reference_to_no_delete_pointer(bc));
-
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-LinearTimeDependentProblem::
-LinearTimeDependentProblem(const TensorProductForm& a,
-                           const TensorProductForm& L,
-                           Function& u,
-                           std::vector<const BoundaryCondition*> bcs)
-  : Hierarchical<LinearTimeDependentProblem>(*this),
-    _a(reference_to_no_delete_pointer(a)),
-    _l(reference_to_no_delete_pointer(L)),
-    _u(reference_to_no_delete_pointer(u))
-{
-  // Store boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); ++i)
-    _bcs.push_back(reference_to_no_delete_pointer(*bcs[i]));
-
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-LinearTimeDependentProblem::
-LinearTimeDependentProblem(std::shared_ptr<const TensorProductForm> a,
-                           std::shared_ptr<const TensorProductForm> L,
-                           std::shared_ptr<Function> u,
-                           std::vector<std::shared_ptr<const BoundaryCondition>> bcs)
-  : Hierarchical<LinearTimeDependentProblem>(*this),
-    _a(a), _l(L), _u(u)
-{
-  // Store boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); ++i)
-    _bcs.push_back(bcs[i]);
-
   // Check forms
   check_forms();
 }
diff --git a/dolfin/fem/LinearTimeDependentProblem.h b/dolfin/fem/LinearTimeDependentProblem.h
index 39c1d4e..2a97b1a 100644
--- a/dolfin/fem/LinearTimeDependentProblem.h
+++ b/dolfin/fem/LinearTimeDependentProblem.h
@@ -49,29 +49,12 @@ namespace dolfin
   {
   public:
 
-    /// Create linear variational problem without boundary conditions
-    LinearTimeDependentProblem(const TensorProductForm& a,
-                               const TensorProductForm& L,
-                               Function& u);
-
-    /// Create linear variational problem with a single boundary condition
-    LinearTimeDependentProblem(const TensorProductForm& a,
-                             const TensorProductForm& L,
-                             Function& u,
-                             const BoundaryCondition& bc);
-
-    /// Create linear variational problem with a list of boundary conditions
-    LinearTimeDependentProblem(const TensorProductForm& a,
-                             const TensorProductForm& L,
-                             Function& u,
-                             std::vector<const BoundaryCondition*> bcs);
-
-    /// Create linear variational problem with a list of boundary conditions
-    /// (shared pointer version)
+    /// Create linear variational problem with a list of boundary
+    /// conditions (shared pointer version)
     LinearTimeDependentProblem(std::shared_ptr<const TensorProductForm> a,
                                std::shared_ptr<const TensorProductForm> L,
                                std::shared_ptr<Function> u,
-                               std::vector<std::shared_ptr<const BoundaryCondition> > bcs);
+                               std::vector<std::shared_ptr<const BoundaryCondition>> bcs);
 
     /// Return bilinear form
     std::shared_ptr<const TensorProductForm> bilinear_form() const;
@@ -86,7 +69,7 @@ namespace dolfin
     std::shared_ptr<const Function> solution() const;
 
     /// Return boundary conditions
-    std::vector<std::shared_ptr<const BoundaryCondition> > bcs() const;
+    std::vector<std::shared_ptr<const BoundaryCondition>> bcs() const;
 
     /// Return trial space
     std::shared_ptr<const FunctionSpace> trial_space() const;
@@ -109,7 +92,7 @@ namespace dolfin
     std::shared_ptr<Function> _u;
 
     // The boundary conditions
-    std::vector<std::shared_ptr<const BoundaryCondition> > _bcs;
+    std::vector<std::shared_ptr<const BoundaryCondition>> _bcs;
 
   };
 
diff --git a/dolfin/fem/LinearVariationalProblem.cpp b/dolfin/fem/LinearVariationalProblem.cpp
index c080c6d..b51bdf4 100644
--- a/dolfin/fem/LinearVariationalProblem.cpp
+++ b/dolfin/fem/LinearVariationalProblem.cpp
@@ -14,11 +14,7 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-06-22
-// Last changed: 2012-08-17
 
-#include <dolfin/common/NoDeleter.h>
 #include <dolfin/function/Function.h>
 #include "Form.h"
 #include "LinearVariationalProblem.h"
@@ -26,59 +22,14 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-LinearVariationalProblem::LinearVariationalProblem(const Form& a,
- const Form& L, Function& u) : Hierarchical<LinearVariationalProblem>(*this),
-  _a(reference_to_no_delete_pointer(a)), _l(reference_to_no_delete_pointer(L)),
-  _u(reference_to_no_delete_pointer(u))
-{
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-LinearVariationalProblem::LinearVariationalProblem(const Form& a,
-  const Form& L, Function& u, const DirichletBC& bc)
-  : Hierarchical<LinearVariationalProblem>(*this),
-    _a(reference_to_no_delete_pointer(a)),
-    _l(reference_to_no_delete_pointer(L)),
-    _u(reference_to_no_delete_pointer(u))
+LinearVariationalProblem::LinearVariationalProblem(
+  std::shared_ptr<const Form> a,
+  std::shared_ptr<const Form> L,
+  std::shared_ptr<Function> u,
+  std::vector<std::shared_ptr<const DirichletBC>> bcs)
+  : Hierarchical<LinearVariationalProblem>(*this), _a(a), _l(L), _u(u),
+  _bcs(bcs)
 {
-  // Store boundary condition
-  _bcs.push_back(reference_to_no_delete_pointer(bc));
-
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-LinearVariationalProblem::
-LinearVariationalProblem(const Form& a,
-                         const Form& L,
-                         Function& u,
-                         std::vector<const DirichletBC*> bcs)
-  : Hierarchical<LinearVariationalProblem>(*this),
-    _a(reference_to_no_delete_pointer(a)),
-    _l(reference_to_no_delete_pointer(L)),
-    _u(reference_to_no_delete_pointer(u))
-{
-  // Store boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); ++i)
-    _bcs.push_back(reference_to_no_delete_pointer(*bcs[i]));
-
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-LinearVariationalProblem::
-LinearVariationalProblem(std::shared_ptr<const Form> a,
-                         std::shared_ptr<const Form> L,
-                         std::shared_ptr<Function> u,
-                         std::vector<std::shared_ptr<const DirichletBC>> bcs)
-  : Hierarchical<LinearVariationalProblem>(*this),
-    _a(a), _l(L), _u(u)
-{
-  // Store boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); ++i)
-    _bcs.push_back(bcs[i]);
-
   // Check forms
   check_forms();
 }
diff --git a/dolfin/fem/LinearVariationalProblem.h b/dolfin/fem/LinearVariationalProblem.h
index d8abe46..d904e7a 100644
--- a/dolfin/fem/LinearVariationalProblem.h
+++ b/dolfin/fem/LinearVariationalProblem.h
@@ -14,9 +14,6 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-06-22
-// Last changed: 2012-08-20
 
 #ifndef __LINEAR_VARIATIONAL_PROBLEM_H
 #define __LINEAR_VARIATIONAL_PROBLEM_H
@@ -46,29 +43,12 @@ namespace dolfin
   {
   public:
 
-    /// Create linear variational problem without boundary conditions
-    LinearVariationalProblem(const Form& a,
-                             const Form& L,
-                             Function& u);
-
-    /// Create linear variational problem with a single boundary condition
-    LinearVariationalProblem(const Form& a,
-                             const Form& L,
-                             Function& u,
-                             const DirichletBC& bc);
-
-    /// Create linear variational problem with a list of boundary conditions
-    LinearVariationalProblem(const Form& a,
-                             const Form& L,
-                             Function& u,
-                             std::vector<const DirichletBC*> bcs);
-
-    /// Create linear variational problem with a list of boundary conditions
-    /// (shared pointer version)
+    /// Create linear variational problem with a list of boundary
+    /// conditions
     LinearVariationalProblem(std::shared_ptr<const Form> a,
                              std::shared_ptr<const Form> L,
                              std::shared_ptr<Function> u,
-                             std::vector<std::shared_ptr<const DirichletBC> > bcs);
+                             std::vector<std::shared_ptr<const DirichletBC>> bcs);
 
     /// Return bilinear form
     std::shared_ptr<const Form> bilinear_form() const;
@@ -83,7 +63,7 @@ namespace dolfin
     std::shared_ptr<const Function> solution() const;
 
     /// Return boundary conditions
-    std::vector<std::shared_ptr<const DirichletBC> > bcs() const;
+    std::vector<std::shared_ptr<const DirichletBC>> bcs() const;
 
     /// Return trial space
     std::shared_ptr<const FunctionSpace> trial_space() const;
@@ -106,7 +86,7 @@ namespace dolfin
     std::shared_ptr<Function> _u;
 
     // The Dirichlet boundary conditions
-    std::vector<std::shared_ptr<const DirichletBC> > _bcs;
+    std::vector<std::shared_ptr<const DirichletBC>> _bcs;
 
   };
 
diff --git a/dolfin/fem/LinearVariationalSolver.cpp b/dolfin/fem/LinearVariationalSolver.cpp
index 645edcf..3b97f79 100644
--- a/dolfin/fem/LinearVariationalSolver.cpp
+++ b/dolfin/fem/LinearVariationalSolver.cpp
@@ -38,14 +38,6 @@ using namespace dolfin;
 
 //-----------------------------------------------------------------------------
 LinearVariationalSolver::
-LinearVariationalSolver(LinearVariationalProblem& problem)
-  : _problem(reference_to_no_delete_pointer(problem))
-{
-  // Set parameters
-  parameters = default_parameters();
-}
-//-----------------------------------------------------------------------------
-LinearVariationalSolver::
 LinearVariationalSolver(std::shared_ptr<LinearVariationalProblem> problem)
   : _problem(problem)
 {
@@ -66,10 +58,10 @@ void LinearVariationalSolver::solve()
 
   // Get problem data
   dolfin_assert(_problem);
-  std::shared_ptr<const Form> a(_problem->bilinear_form());
-  std::shared_ptr<const Form> L(_problem->linear_form());
-  std::shared_ptr<Function> u(_problem->solution());
-  std::vector<std::shared_ptr<const DirichletBC>> bcs(_problem->bcs());
+  const auto a = _problem->bilinear_form();
+  const auto L = _problem->linear_form();
+  auto u = _problem->solution();
+  auto bcs = _problem->bcs();
 
   dolfin_assert(a);
   dolfin_assert(L);
@@ -77,8 +69,9 @@ void LinearVariationalSolver::solve()
 
   // Create matrix and vector
   dolfin_assert(u->vector());
-  std::shared_ptr<GenericMatrix> A = u->vector()->factory().create_matrix();
-  std::shared_ptr<GenericVector> b = u->vector()->factory().create_vector();
+  MPI_Comm comm = u->vector()->mpi_comm();
+  std::shared_ptr<GenericMatrix> A = u->vector()->factory().create_matrix(comm);
+  std::shared_ptr<GenericVector> b = u->vector()->factory().create_vector(comm);
 
   // Different assembly depending on whether or not the system is symmetric
   if (symmetric)
@@ -91,23 +84,8 @@ void LinearVariationalSolver::solve()
                    "Empty linear forms cannot be used with symmetric assembly");
     }
 
-    // Need to cast to DirichletBC to use assemble_system
-    std::vector<const DirichletBC*> _bcs;
-    for (std::size_t i = 0; i < bcs.size(); i++)
-    {
-      dolfin_assert(bcs[i]);
-      const DirichletBC* _bc = dynamic_cast<const DirichletBC*>(bcs[i].get());
-      if (!_bc)
-      {
-        dolfin_error("LinearVariationalSolver.cpp",
-                     "apply boundary condition in linear variational solver",
-                     "Only Dirichlet boundary conditions may be used for symmetric systems");
-      }
-      _bcs.push_back(_bc);
-    }
-
     // Assemble linear system and apply boundary conditions
-    SystemAssembler assembler(a, L, _bcs);
+    SystemAssembler assembler(a, L, bcs);
     assembler.assemble(*A, *b);
   }
   else
@@ -160,7 +138,7 @@ void LinearVariationalSolver::solve()
       lu_method = solver_type;
 
     // Solve linear system
-    LUSolver solver(lu_method);
+    LUSolver solver(comm, lu_method);
     solver.parameters.update(parameters("lu_solver"));
     solver.parameters["symmetric"] = (bool) parameters["symmetric"];
     solver.solve(*A, *u->vector(), *b);
@@ -196,7 +174,7 @@ void LinearVariationalSolver::solve()
     }
 
     // Solve linear system
-    KrylovSolver solver(solver_type, pc_type);
+    KrylovSolver solver(comm, solver_type, pc_type);
     solver.parameters.update(parameters("krylov_solver"));
     solver.solve(*A, *u->vector(), *b);
   }
diff --git a/dolfin/fem/LinearVariationalSolver.h b/dolfin/fem/LinearVariationalSolver.h
index 0fbe91e..e6a018c 100644
--- a/dolfin/fem/LinearVariationalSolver.h
+++ b/dolfin/fem/LinearVariationalSolver.h
@@ -40,11 +40,7 @@ namespace dolfin
   public:
 
     /// Create linear variational solver for given problem
-    LinearVariationalSolver(LinearVariationalProblem& problem);
-
-    /// Create linear variational solver for given problem (shared
-    /// pointer version)
-    LinearVariationalSolver(std::shared_ptr<LinearVariationalProblem> problem);
+    explicit LinearVariationalSolver(std::shared_ptr<LinearVariationalProblem> problem);
 
     /// Solve variational problem
     void solve();
diff --git a/dolfin/fem/LocalAssembler.cpp b/dolfin/fem/LocalAssembler.cpp
new file mode 100644
index 0000000..5fd7c6c
--- /dev/null
+++ b/dolfin/fem/LocalAssembler.cpp
@@ -0,0 +1,306 @@
+// Copyright (C) 2011 Marie E. Rognes
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// Modified by Anders Logg 2013
+// Modified by Tormod Landet 2015
+//
+// First added:  2011-01-04
+// Last changed: 2015-09-30
+
+#include <dolfin/common/types.h>
+#include <Eigen/Dense>
+
+#include <dolfin/common/Array.h>
+#include <dolfin/fem/Form.h>
+#include <dolfin/fem/GenericDofMap.h>
+#include <dolfin/fem/UFC.h>
+#include <dolfin/function/FunctionSpace.h>
+#include <dolfin/la/GenericTensor.h>
+#include <dolfin/mesh/Cell.h>
+#include <dolfin/mesh/Facet.h>
+#include "LocalAssembler.h"
+
+using namespace dolfin;
+
+//------------------------------------------------------------------------------
+void
+LocalAssembler::assemble(Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
+                         Eigen::RowMajor>& A,
+                         UFC& ufc,
+                         const std::vector<double>& coordinate_dofs,
+                         ufc::cell& ufc_cell,
+                         const Cell& cell,
+                         const MeshFunction<std::size_t>* cell_domains,
+                         const MeshFunction<std::size_t>* exterior_facet_domains,
+                         const MeshFunction<std::size_t>* interior_facet_domains)
+{
+  cell.get_cell_data(ufc_cell);
+
+  // Assemble contributions from cell integral
+  assemble_cell(A, ufc, coordinate_dofs, ufc_cell, cell, cell_domains);
+
+  // Assemble contributions from facet integrals
+  if (ufc.form.has_exterior_facet_integrals()
+      || ufc.form.has_interior_facet_integrals())
+  {
+    for (FacetIterator facet(cell); !facet.end(); ++facet)
+    {
+      ufc_cell.local_facet = facet.pos();
+      const int Ncells = facet->num_entities(cell.dim());
+      if (Ncells == 2)
+      {
+        assemble_interior_facet(A, ufc, coordinate_dofs, ufc_cell, cell,
+                                *facet, facet.pos(), interior_facet_domains,
+                                cell_domains);
+      }
+      else if (Ncells == 1)
+      {
+        assemble_exterior_facet(A, ufc, coordinate_dofs, ufc_cell, cell,
+                                *facet, facet.pos(), exterior_facet_domains);
+      }
+      else
+      {
+        dolfin_error("LocalAssembler.cpp",
+                     "assemble local problem",
+                     "Cell <-> facet connectivity not initialized, found "
+                     "facet with %d connected cells. Expected 1 or 2 cells",
+                     Ncells);
+      }
+    }
+  }
+
+  // Check that there are no vertex integrals
+  if (ufc.form.has_vertex_integrals())
+  {
+    dolfin_error("LocalAssembler.cpp",
+                 "assemble local problem",
+                 "Local problem contains vertex integrals which are not yet "
+                 "supported by LocalAssembler");
+  }
+}
+//------------------------------------------------------------------------------
+void
+LocalAssembler::assemble_cell(Eigen::Matrix<double, Eigen::Dynamic,
+                                            Eigen::Dynamic,
+                                            Eigen::RowMajor>& A,
+                              UFC& ufc,
+                              const std::vector<double>& coordinate_dofs,
+                              const ufc::cell& ufc_cell,
+                              const Cell& cell,
+                              const MeshFunction<std::size_t>* cell_domains)
+{
+  // Skip if there are no cell integrals
+  if (!ufc.form.has_cell_integrals())
+  {
+    // Clear tensor here instead of in assemble() as a small speedup
+    A.setZero();
+    return;
+  }
+
+  // Extract default cell integral
+  ufc::cell_integral* integral = ufc.default_cell_integral.get();
+
+  // Get integral for sub domain (if any)
+  if (cell_domains && !cell_domains->empty())
+    integral = ufc.get_cell_integral((*cell_domains)[cell]);
+
+  // Skip integral if zero
+  if (!integral)
+  {
+    // Clear tensor here instead of in assemble() as a small speedup
+    A.setZero();
+    return;
+  }
+
+  // Update to current cell
+  ufc.update(cell, coordinate_dofs, ufc_cell,
+             integral->enabled_coefficients());
+
+  // Tabulate cell tensor directly into A. This overwrites any
+  // previous values
+  integral->tabulate_tensor(A.data(), ufc.w(),
+                            coordinate_dofs.data(),
+                            ufc_cell.orientation);
+}
+//------------------------------------------------------------------------------
+void
+LocalAssembler::assemble_exterior_facet(Eigen::Matrix<double,
+                                                      Eigen::Dynamic,
+                                                      Eigen::Dynamic,
+                                                      Eigen::RowMajor>& A,
+                        UFC& ufc,
+                        const std::vector<double>& coordinate_dofs,
+                        const ufc::cell& ufc_cell,
+                        const Cell& cell,
+                        const Facet& facet,
+                        const std::size_t local_facet,
+                        const MeshFunction<std::size_t>* exterior_facet_domains)
+{
+  // Skip if there are no exterior facet integrals
+  if (!ufc.form.has_exterior_facet_integrals())
+    return;
+
+  // Extract default exterior facet integral
+  ufc::exterior_facet_integral* integral
+    = ufc.default_exterior_facet_integral.get();
+
+  // Get integral for sub domain (if any)
+  if (exterior_facet_domains && !exterior_facet_domains->empty())
+    integral = ufc.get_exterior_facet_integral((*exterior_facet_domains)[facet]);
+
+  // Skip integral if zero
+  if (!integral)
+    return;
+
+  // Update to current cell
+  ufc.update(cell, coordinate_dofs, ufc_cell,
+             integral->enabled_coefficients());
+
+  // Tabulate exterior facet tensor. Here we cannot tabulate directly
+  // into A since this will overwrite any previously assembled dx, ds
+  // or dS forms
+  integral->tabulate_tensor(ufc.A.data(),
+                            ufc.w(),
+                            coordinate_dofs.data(),
+                            local_facet,
+                            ufc_cell.orientation);
+
+  // Stuff a_ufc.A into A
+  const std::size_t M = A.rows();
+  const std::size_t N = A.cols();
+  for (std::size_t i = 0; i < M; i++)
+    for (std::size_t j = 0; j < N; j++)
+      A(i, j) += ufc.A[N*i + j];
+}
+//------------------------------------------------------------------------------
+void
+LocalAssembler::assemble_interior_facet(Eigen::Matrix<double, Eigen::Dynamic,
+                                                      Eigen::Dynamic,
+                                                      Eigen::RowMajor>& A,
+                        UFC& ufc,
+                        const std::vector<double>& coordinate_dofs,
+                        const ufc::cell& ufc_cell,
+                        const Cell& cell,
+                        const Facet& facet,
+                        const std::size_t local_facet,
+                        const MeshFunction<std::size_t>* interior_facet_domains,
+                        const MeshFunction<std::size_t>* cell_domains)
+{
+  // Skip if there are no interior facet integrals
+  if (!ufc.form.has_interior_facet_integrals())
+    return;
+
+  // Extract default interior facet integral
+  ufc::interior_facet_integral* integral
+    = ufc.default_interior_facet_integral.get();
+
+  // Get integral for sub domain (if any)
+  if (interior_facet_domains && !interior_facet_domains->empty())
+    integral = ufc.get_interior_facet_integral((*interior_facet_domains)[facet]);
+
+  // Skip integral if zero
+  if (!integral)
+    return;
+
+  // Extract mesh
+  const Mesh& mesh = cell.mesh();
+  const std::size_t D = mesh.topology().dim();
+
+  // Get cells incident with facet (which is 0 and 1 here is
+  // arbitrary)
+  dolfin_assert(facet.num_entities(D) == 2);
+  std::size_t cell_index_plus = facet.entities(D)[0];
+  std::size_t cell_index_minus = facet.entities(D)[1];
+  bool local_is_plus = cell_index_plus == cell.index();
+
+  // The convention '+' = 0, '-' = 1 is from ffc
+  const Cell cell0(mesh, cell_index_plus);
+  const Cell cell1(mesh, cell_index_minus);
+
+  // Is this facet on a domain boundary?
+  if (cell_domains && !cell_domains->empty() &&
+      (*cell_domains)[cell_index_plus] < (*cell_domains)[cell_index_minus])
+  {
+    std::swap(cell_index_plus, cell_index_minus);
+  }
+
+  // Get information about the adjacent cell
+  const Cell& cell_adj = local_is_plus ? cell1 : cell0;
+  std::vector<double> coordinate_dofs_adj;
+  ufc::cell ufc_cell_adj;
+  std::size_t local_facet_adj = cell_adj.index(facet);
+  cell_adj.get_coordinate_dofs(coordinate_dofs_adj);
+  cell_adj.get_cell_data(ufc_cell_adj);
+
+  // Get information about plus and minus cells
+  const std::vector<double>* coordinate_dofs0 = nullptr;
+  const std::vector<double>* coordinate_dofs1 = nullptr;
+  const ufc::cell* ufc_cell0 = nullptr;
+  const ufc::cell* ufc_cell1 = nullptr;
+  std::size_t local_facet0, local_facet1;
+  if (local_is_plus)
+  {
+    coordinate_dofs0 = &coordinate_dofs;
+    coordinate_dofs1 = &coordinate_dofs_adj;
+    ufc_cell0 = &ufc_cell;
+    ufc_cell1 = &ufc_cell_adj;
+    local_facet0 = local_facet;
+    local_facet1 = local_facet_adj;
+  }
+  else
+  {
+    coordinate_dofs1 = &coordinate_dofs;
+    coordinate_dofs0 = &coordinate_dofs_adj;
+    ufc_cell1 = &ufc_cell;
+    ufc_cell0 = &ufc_cell_adj;
+    local_facet1 = local_facet;
+    local_facet0 = local_facet_adj;
+  }
+
+  // Update to current pair of cells and facets
+  ufc.update(cell0, *coordinate_dofs0, *ufc_cell0,
+             cell1, *coordinate_dofs1, *ufc_cell1,
+             integral->enabled_coefficients());
+
+  // Tabulate interior facet tensor on macro element
+  integral->tabulate_tensor(ufc.macro_A.data(), ufc.macro_w(),
+                            coordinate_dofs0->data(),
+                            coordinate_dofs1->data(),
+                            local_facet0, local_facet1,
+                            ufc_cell0->orientation,
+                            ufc_cell1->orientation);
+
+  // Stuff upper left quadrant (corresponding to cell_plus) or lower
+  // left quadrant (corresponding to cell_minus) into A depending on
+  // which cell is the local cell
+  const std::size_t M = A.rows();
+  const std::size_t N = A.cols();
+  const std::size_t offset_N = local_is_plus ? 0 : N;
+  const std::size_t offset_M = local_is_plus ? 0 : M;
+  if (N == 1)
+  {
+    for (std::size_t i = 0; i < M; i++)
+      A(i, 0) += ufc.macro_A[i + offset_M];
+  }
+  else
+  {
+    for (std::size_t i = 0; i < M; i++)
+      for (std::size_t j = 0; j < N; j++)
+        A(i, j) += ufc.macro_A[2*N*(i + offset_M) + j + offset_N];
+  }
+}
+//------------------------------------------------------------------------------
diff --git a/dolfin/fem/LocalAssembler.h b/dolfin/fem/LocalAssembler.h
new file mode 100644
index 0000000..53da9c8
--- /dev/null
+++ b/dolfin/fem/LocalAssembler.h
@@ -0,0 +1,111 @@
+// Copyright (C) 2011 Marie E. Rognes
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// First added:  2011-01-04
+// Last changed: 2015-09-30
+
+#ifndef __LOCAL_ASSEMBLER_H
+#define __LOCAL_ASSEMBLER_H
+
+#include <vector>
+
+#include <dolfin/common/types.h>
+#include <Eigen/Dense>
+
+namespace ufc
+{
+  class cell;
+}
+
+namespace dolfin
+{
+
+  class Cell;
+  class Facet;
+  class UFC;
+  template<typename T> class MeshFunction;
+
+  /// Assembly of local cell tensors. Used by the adaptivity and
+  /// LocalSolver functionality in dolfin. The local assembly
+  /// functionality provided here is also wrapped as a free function
+  /// assemble_local(form_a, cell) in Python for easier usage. Used
+  /// from C++ the versions defined below will be faster than the free
+  /// function as less objects need to be created and thrown away
+
+  class LocalAssembler
+  {
+
+  public:
+
+    /// Assemble a local tensor on a cell
+    static void
+      assemble(Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
+                             Eigen::RowMajor>& A,
+               UFC& ufc,
+               const std::vector<double>& coordinate_dofs,
+               ufc::cell& ufc_cell,
+               const Cell& cell,
+               const MeshFunction<std::size_t>* cell_domains,
+               const MeshFunction<std::size_t>* exterior_facet_domains,
+               const MeshFunction<std::size_t>* interior_facet_domains);
+
+    /// Worker method called by assemble() to perform assembly of
+    /// volume integrals (dx)
+    static void assemble_cell(Eigen::Matrix<double, Eigen::Dynamic,
+                                            Eigen::Dynamic,
+                                            Eigen::RowMajor>& A,
+                              UFC& ufc,
+                              const std::vector<double>& coordinate_dofs,
+                              const ufc::cell& ufc_cell,
+                              const Cell& cell,
+                              const MeshFunction<std::size_t>* cell_domains);
+
+    /// Worker method called by assemble() for each of the cell's
+    /// external facets to perform assembly of external facet
+    /// integrals (ds)
+    static void
+      assemble_exterior_facet(Eigen::Matrix<double, Eigen::Dynamic,
+                                            Eigen::Dynamic,
+                                            Eigen::RowMajor>& A,
+                      UFC& ufc,
+                              const std::vector<double>& coordinate_dofs,
+                              const ufc::cell& ufc_cell,
+                              const Cell& cell,
+                              const Facet& facet,
+                              const std::size_t local_facet,
+                              const MeshFunction<std::size_t>* exterior_facet_domains);
+
+    /// Worker method called by assemble() for each of the cell's
+    /// internal facets to perform assembly of internal facet
+    /// integrals (dS)
+    static void
+      assemble_interior_facet(Eigen::Matrix<double, Eigen::Dynamic,
+                                            Eigen::Dynamic,
+                                            Eigen::RowMajor>& A,
+                              UFC& ufc,
+                              const std::vector<double>& coordinate_dofs,
+                              const ufc::cell& ufc_cell,
+                              const Cell& cell,
+                              const Facet& facet,
+                              const std::size_t local_facet,
+                              const MeshFunction<std::size_t>* interior_facet_domains,
+                              const MeshFunction<std::size_t>* cell_domains);
+  };
+
+}
+
+#endif
diff --git a/dolfin/fem/LocalSolver.cpp b/dolfin/fem/LocalSolver.cpp
index 9e77008..8d6858a 100644
--- a/dolfin/fem/LocalSolver.cpp
+++ b/dolfin/fem/LocalSolver.cpp
@@ -15,7 +15,8 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// Modified by Steven Vandekerckhove, 2014.
+// Modified by Steven Vandekerckhove, 2014
+// Modified by Tormod Landet, 2015
 
 #include <array>
 #include <memory>
@@ -23,7 +24,9 @@
 #include <Eigen/Dense>
 
 #include <dolfin/common/ArrayView.h>
+#include <dolfin/common/Timer.h>
 #include <dolfin/common/types.h>
+#include <dolfin/fem/LocalAssembler.h>
 #include <dolfin/function/Function.h>
 #include <dolfin/function/FunctionSpace.h>
 #include <dolfin/la/GenericLinearAlgebraFactory.h>
@@ -40,7 +43,7 @@
 
 using namespace dolfin;
 
-//----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 LocalSolver::LocalSolver(std::shared_ptr<const Form> a,
                          std::shared_ptr<const Form> L,
                          SolverType solver_type)
@@ -51,90 +54,104 @@ LocalSolver::LocalSolver(std::shared_ptr<const Form> a,
   dolfin_assert(L);
   dolfin_assert(L->rank() == 1);
 }
-//----------------------------------------------------------------------------
-LocalSolver::LocalSolver(std::shared_ptr<const Form> a,
-                         SolverType solver_type)
+//-----------------------------------------------------------------------------
+LocalSolver::LocalSolver(std::shared_ptr<const Form> a, SolverType solver_type)
   : _a(a), _solver_type(solver_type)
 {
   dolfin_assert(a);
   dolfin_assert(a->rank() == 2);
 }
-//----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 void LocalSolver::solve_global_rhs(Function& u) const
 {
   // Compute RHS (global)
-  std::shared_ptr<GenericVector> b = u.vector()->factory().create_vector();
+  std::shared_ptr<GenericVector> b
+    = u.vector()->factory().create_vector(u.vector()->mpi_comm());
   dolfin_assert(b);
   dolfin_assert(_formL);
   assemble(*b, *_formL);
 
-  // Solve local problems
+  // Extract the vector where the solution will be stored
   dolfin_assert(u.vector());
-  dolfin_assert(_formL->function_space(0)->dofmap().get());
-  solve_local(*u.vector(), *b, *(_formL->function_space(0)->dofmap()));
+  GenericVector& x = *(u.vector());
+
+  // Solve local problems
+  _solve_local(x, b.get(), nullptr);
 }
-//----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 void LocalSolver::solve_local_rhs(Function& u) const
 {
-  dolfin_assert(_a);
-  dolfin_assert(_formL);
-  dolfin_assert(_a->rank() == 2);
-  dolfin_assert(_formL->rank() == 1);
-
-  // Extract mesh
-  dolfin_assert(_a->function_space(0)->mesh());
-  const Mesh& mesh = *_a->function_space(0)->mesh();
-
-  // Extract vector
+  // Extract the vector where the solution will be stored
   dolfin_assert(u.vector());
   GenericVector& x = *(u.vector());
 
- // Create UFC objects
-  UFC ufc_a(*_a), ufc_L(*_formL);
+  // Loop over all cells and assemble local LHS & RHS which are then solved
+  _solve_local(x, nullptr, nullptr);
+}
+//-----------------------------------------------------------------------------
+void LocalSolver::solve_local(GenericVector& x, const GenericVector& b,
+                              const GenericDofMap& dofmap_b) const
+{
+  _solve_local(x, &b, &dofmap_b);
+}
+//-----------------------------------------------------------------------------
+void LocalSolver::_solve_local(GenericVector& x, const GenericVector* global_b,
+                               const GenericDofMap* dofmap_L) const
+{
+  // Check that we have valid bilinear form
+  dolfin_assert(_a);
+  dolfin_assert(_a->rank() == 2);
+
+  // Set timer
+  Timer timer("Solve local problems");
 
-  // Check whether to use cache for factorizations
-  const bool use_cache = _cholesky_cache.empty()
-    and _lu_cache.empty() ? false : true;
+  // Create UFC objects
+  UFC ufc_a(*_a);
+  std::unique_ptr<UFC> ufc_L;
 
-  // Get cell integrals
-  std::shared_ptr<ufc::cell_integral> integral_a;
-  if (!use_cache)
+  // Check that we have valid linear form or a dofmap for it
+  if (dofmap_L)
+    dolfin_assert(global_b);
+  else
   {
-    integral_a = ufc_a.default_cell_integral;
-    dolfin_assert(integral_a);
+    dolfin_assert(_formL);
+    dolfin_assert(_formL->rank() == 1);
+    dolfin_assert(_formL->function_space(0)->dofmap());
+    dofmap_L = _formL->function_space(0)->dofmap().get();
+    ufc_L.reset(new UFC(*_formL));
   }
-  std::shared_ptr<ufc::cell_integral> integral_L = ufc_L.default_cell_integral;
-  dolfin_assert(integral_L);
 
-  // Get dofmaps
+  // Extract the mesh
+  dolfin_assert(_a->function_space(0)->mesh());
+  const Mesh& mesh = *_a->function_space(0)->mesh();
+
+  // Get bilinear form dofmaps
   std::array<std::shared_ptr<const GenericDofMap>, 2> dofmaps_a
     = {{_a->function_space(0)->dofmap(), _a->function_space(1)->dofmap()}};
   dolfin_assert(dofmaps_a[0] and dofmaps_a[1]);
 
-  dolfin_assert(_formL->function_space(0)->dofmap());
-  std::shared_ptr<const GenericDofMap> dofmap_L
-    = _formL->function_space(0)->dofmap();
-
-  // Check dimensions
-  dolfin_assert(dofmaps_a[0]->global_dimension()
-                == dofmaps_a[1]->global_dimension());
-  dolfin_assert(dofmaps_a[0]->global_dimension()
-                == dofmap_L->global_dimension());
-
-  // Eigen data structures for local tensors
-  Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> A_e;
-  Eigen::VectorXd b_e, x_e;
-
-  // Eigen factorizations
+  // Extract cell_domains etc from left-hand side form
+  const MeshFunction<std::size_t>* cell_domains
+    = _a->cell_domains().get();
+  const MeshFunction<std::size_t>* exterior_facet_domains
+    = _a->exterior_facet_domains().get();
+  const MeshFunction<std::size_t>* interior_facet_domains
+    = _a->interior_facet_domains().get();
+
+  // Eigen data structures and factorisations for cell data structures
+  Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
+                Eigen::RowMajor> A_e, b_e;
+  Eigen::VectorXd x_e;
   Eigen::PartialPivLU<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
                                     Eigen::RowMajor>> lu;
   Eigen::LLT<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
                            Eigen::RowMajor>> cholesky;
+  bool use_cache = !(_cholesky_cache.empty() and _lu_cache.empty());
 
-  // Assemble LHS over cells and solve
+  // Loop over cells and solve local problems
   Progress p("Performing local (cell-wise) solve", mesh.num_cells());
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
     // Get local-to-global dof maps for cell
@@ -144,39 +161,63 @@ void LocalSolver::solve_local_rhs(Function& u) const
       = dofmaps_a[1]->cell_dofs(cell->index());
     const ArrayView<const dolfin::la_index> dofs_L
       = dofmap_L->cell_dofs(cell->index());
-    dolfin_assert(dofs_a0.size() == dofs_a1.size());
-    dolfin_assert(dofs_a0.size() == dofs_L.size());
-
-    // Update to current cell
-    cell->get_vertex_coordinates(vertex_coordinates);
-    cell->get_cell_data(ufc_cell);
-
-    // Resize local RHS vector and copy global RHS data into local
-    // RHS, else compute b_e
-    b_e.resize(dofs_L.size());
-    ufc_L.update(*cell, vertex_coordinates, ufc_cell,
-                 integral_L->enabled_coefficients());
-
-    // Tabulate matrix on cell
-    integral_L->tabulate_tensor(b_e.data(), ufc_L.w(),
-                                vertex_coordinates.data(),
-                                ufc_cell.orientation);
-
-    // Solve local problem
-    if (integral_a)
+
+    // Check that the local matrix is square
+    if (dofs_a0.size() != dofs_a1.size())
+    {
+      dolfin_error("LocalSolver.cpp",
+                   "assemble local LHS",
+                   "Local LHS dimensions is non square (%d x %d) on cell %d",
+                   dofs_a0.size(), dofs_a1.size(), cell->index());
+    }
+
+    // Check that the local RHS matches the LHS
+    if (dofs_a0.size() != dofs_L.size())
+    {
+      dolfin_error("LocalSolver.cpp",
+                   "assemble local RHS",
+                   "Local RHS dimension %d is does not match first dimension "
+                   "%d of LHS on cell %d",
+                   dofs_L.size(), dofs_a0.size(), cell->index());
+    }
+
+    // Update data to current cell
+    cell->get_coordinate_dofs(coordinate_dofs);
+
+    // Assemble the linear form
+    x_e.resize(dofs_L.size());
+    b_e.resize(dofs_L.size(), 1);
+
+    if (global_b)
+    {
+      // Copy global RHS data into local RHS vector
+      global_b->get_local(b_e.data(), dofs_L.size(), dofs_L.data());
+    }
+    else
     {
-      // Update LHS UFC object
-      ufc_a.update(*cell, vertex_coordinates, ufc_cell,
-                   integral_a->enabled_coefficients());
-
-      // Resize A_e and tabulate on for cell
-      const std::size_t dim = dofmaps_a[0]->num_element_dofs(cell->index());
-      dolfin_assert(dim == dofmaps_a[1]->num_element_dofs(cell->index()));
-      A_e.resize(dim, dim);
-      integral_a->tabulate_tensor(A_e.data(), ufc_a.w(),
-                                  vertex_coordinates.data(),
-                                  ufc_cell.orientation);
-      // Solve local problem
+      // Assemble local RHS vector
+      LocalAssembler::assemble(b_e, *ufc_L, coordinate_dofs, ufc_cell,
+                               *cell, cell_domains,
+                               exterior_facet_domains, interior_facet_domains);
+    }
+
+    if (use_cache)
+    {
+      // Use cached factorisations
+      if (_solver_type == SolverType::Cholesky)
+        x_e = _cholesky_cache[cell->index()].solve(b_e);
+      else
+        x_e = _lu_cache[cell->index()].solve(b_e);
+    }
+    else
+    {
+      // Assemble the bilinear form
+      A_e.resize(dofs_a0.size(), dofs_a1.size());
+      LocalAssembler::assemble(A_e, ufc_a, coordinate_dofs,
+                               ufc_cell, *cell, cell_domains,
+                               exterior_facet_domains, interior_facet_domains);
+
+      // Factorise and solve
       if (_solver_type == SolverType::Cholesky)
       {
         cholesky.compute(A_e);
@@ -188,17 +229,11 @@ void LocalSolver::solve_local_rhs(Function& u) const
         x_e = lu.solve(b_e);
       }
     }
-    else
-    {
-      if (_solver_type == SolverType::Cholesky)
-        x_e = _cholesky_cache[cell->index()].solve(b_e);
-      else
-        x_e = _lu_cache[cell->index()].solve(b_e);
-    }
 
-    // Set solution in global vector
-    x.set_local(x_e.data(), dofs_a0.size(), dofs_a0.data());
+    // Insert solution in global vector
+    x.set_local(x_e.data(), dofs_a1.size(), dofs_a1.data());
 
+    // Update progress
     p++;
   }
 
@@ -206,190 +241,84 @@ void LocalSolver::solve_local_rhs(Function& u) const
   x.apply("insert");
 }
 //----------------------------------------------------------------------------
-void LocalSolver::solve_local(GenericVector& x, const GenericVector& b,
-                              const GenericDofMap& dofmap_b) const
+void LocalSolver::factorize()
 {
+  // Check that we have valid bilinear and linear forms
   dolfin_assert(_a);
   dolfin_assert(_a->rank() == 2);
 
-  // Extract mesh
+  // Set timer
+  Timer timer("Factorise local problems");
+
+  // Extract the mesh
   dolfin_assert(_a->function_space(0)->mesh());
   const Mesh& mesh = *_a->function_space(0)->mesh();
 
-  // Check whether to use cache for factorizations
-  const bool use_cache
-    = _cholesky_cache.empty() and _lu_cache.empty() ? false : true;
+  // Resize cache
+  if (_solver_type == SolverType::Cholesky)
+    _cholesky_cache.resize(mesh.num_cells());
+  else
+    _lu_cache.resize(mesh.num_cells());
 
-  // Create UFC object
+  // Create UFC objects
   UFC ufc_a(*_a);
 
-  // Get cell integral
-  std::shared_ptr<ufc::cell_integral> integral_a = ufc_a.default_cell_integral;
-  dolfin_assert(integral_a);
-
   // Get dofmaps
   std::array<std::shared_ptr<const GenericDofMap>, 2> dofmaps_a
     = {{_a->function_space(0)->dofmap(), _a->function_space(1)->dofmap()}};
   dolfin_assert(dofmaps_a[0] and dofmaps_a[1]);
 
-  // Check dimensions
-  dolfin_assert(dofmaps_a[0]->global_dimension()
-                == dofmaps_a[1]->global_dimension());
-  dolfin_assert(dofmaps_a[0]->global_dimension()
-                == dofmap_b.global_dimension());
+  // Extract cell_domains etc from left-hand side form
+  const MeshFunction<std::size_t>* cell_domains
+    = _a->cell_domains().get();
+  const MeshFunction<std::size_t>* exterior_facet_domains
+    = _a->exterior_facet_domains().get();
+  const MeshFunction<std::size_t>* interior_facet_domains
+    = _a->interior_facet_domains().get();
 
-  // Eigen data structures for local tensors
+  // Local dense matrix
   Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> A_e;
-  Eigen::VectorXd b_e, x_e;
-
-  // Eigen factorizations
-  Eigen::PartialPivLU<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
-                                    Eigen::RowMajor>> lu;
-  Eigen::LLT<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
-                           Eigen::RowMajor>> cholesky;
 
-  // Assemble LHS over cells and solve
-  Progress p("Performing local (cell-wise) solve", mesh.num_cells());
+  // Loop over cells and solve local problems
+  Progress p("Performing local (cell-wise) factorization", mesh.num_cells());
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
-    // Get cell dofmaps
-    const ArrayView<const dolfin::la_index> dofs_L
-      = dofmap_b.cell_dofs(cell->index());
+    // Get local-to-global dof maps for cell
     const ArrayView<const dolfin::la_index> dofs_a0
       = dofmaps_a[0]->cell_dofs(cell->index());
+    const ArrayView<const dolfin::la_index> dofs_a1
+      = dofmaps_a[1]->cell_dofs(cell->index());
 
-    // Check dimensions
-    dolfin_assert(dofs_L.size() == dofs_a0.size());
-
-    // Copy global RHS data into local RHS
-    b_e.resize(dofs_L.size());
-    b.get_local(b_e.data(), dofs_L.size(), dofs_L.data());
-
-    // Solve local problem
-    if (!use_cache)
+    // Check that the local matrix is square
+    if (dofs_a0.size() != dofs_a1.size())
     {
-      // Update to current cell
-      cell->get_vertex_coordinates(vertex_coordinates);
-      cell->get_cell_data(ufc_cell);
-
-      // Update LHS UFC object
-      ufc_a.update(*cell, vertex_coordinates, ufc_cell,
-                   integral_a->enabled_coefficients());
-
-      // Resize A_e and tabulate on for cell
-      const std::size_t dim = dofmaps_a[0]->num_element_dofs(cell->index());
-      dolfin_assert(dim == dofmaps_a[1]->num_element_dofs(cell->index()));
-      A_e.resize(dim, dim);
-      integral_a->tabulate_tensor(A_e.data(), ufc_a.w(),
-                                  vertex_coordinates.data(),
-                                  ufc_cell.orientation);
-      // Solve local problem
-      if (_solver_type == SolverType::Cholesky)
-      {
-        cholesky.compute(A_e);
-        x_e = cholesky.solve(b_e);
-      }
-      else
-      {
-        lu.compute(A_e);
-        x_e = lu.solve(b_e);
-      }
+      dolfin_error("LocalSolver.cpp",
+                   "assemble local LHS",
+                   "Local LHS dimensions is non square (%d x %d) on cell %d",
+                   dofs_a0.size(), dofs_a1.size(), cell->index());
     }
-    else
-    {
-      if (_solver_type == SolverType::Cholesky)
-        x_e = _cholesky_cache[cell->index()].solve(b_e);
-      else
-        x_e = _lu_cache[cell->index()].solve(b_e);
-    }
-
-    // Set solution in global vector
-    x.set_local(x_e.data(), dofs_a0.size(), dofs_a0.data());
-
-    p++;
-  }
-
-  // Finalise vector
-  x.apply("insert");
-}
-//----------------------------------------------------------------------------
-void LocalSolver::factorize()
-{
-  // Create UFC object
-  dolfin_assert(_a);
-  UFC ufc(*_a);
 
-  // Check rank
-  dolfin_assert(ufc.form.rank() == 2);
+    // Update data to current cell
+    cell->get_coordinate_dofs(coordinate_dofs);
+    A_e.resize(dofs_a0.size(), dofs_a1.size());
 
-  // Raise error for Point integrals
-  if (ufc.form.has_vertex_integrals())
-  {
-    dolfin_error("LocalSolver.cpp",
-                 "assemble system",
-                 "Point integrals are not supported (yet)");
-  }
-
-  // Extract mesh
-  const Mesh& mesh = _a->mesh();
-
-  // Collect pointers to dof maps
-  std::array<std::shared_ptr<const GenericDofMap>, 2> dofmaps
-    = {{_a->function_space(0)->dofmap(), _a->function_space(1)->dofmap()}};
-  dolfin_assert(dofmaps[0]);
-  dolfin_assert(dofmaps[1]);
+    // Assemble the bilinear form
+    LocalAssembler::assemble(A_e, ufc_a, coordinate_dofs,
+                             ufc_cell, *cell, cell_domains,
+                             exterior_facet_domains, interior_facet_domains);
 
-  // Get cell integral
-  ufc::cell_integral* integral = ufc.default_cell_integral.get();
-  dolfin_assert(integral);
-
-  // Resize LU cache
-  if (_solver_type==SolverType::Cholesky)
-    _cholesky_cache.resize(mesh.num_cells());
-  else
-    _lu_cache.resize(mesh.num_cells());
-
-  // Eigen data structure for cell matrix
-  Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> A;
-
-  // Assemble over cells
-  Progress p("Performing local (cell-wise) solve", mesh.num_cells());
-  ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
-  for (CellIterator cell(mesh); !cell.end(); ++cell)
-  {
-    // Update to current cell and update
-    cell->get_vertex_coordinates(vertex_coordinates);
-    cell->get_cell_data(ufc_cell);
-    ufc.update(*cell, vertex_coordinates, ufc_cell,
-               integral->enabled_coefficients());
-
-    // Get cell dimension
-    std::size_t dim = dofmaps[0]->num_element_dofs(cell->index());
-
-    // Check that local problem is square
-    dolfin_assert(dim == dofmaps[1]->num_element_dofs(cell->index()));
-
-    // Resize element matrix
-    A.resize(dim, dim);
-
-    // Tabulate A on cell
-    integral->tabulate_tensor(A.data(), ufc.w(),
-                              vertex_coordinates.data(),
-                              ufc_cell.orientation);
-
-     // Compute LU decomposition and store
     if (_solver_type == SolverType::Cholesky)
-      _cholesky_cache[cell->index()].compute(A);
+      _cholesky_cache[cell->index()].compute(A_e);
     else
-      _lu_cache[cell->index()].compute(A);
+      _lu_cache[cell->index()].compute(A_e);
 
+    // Update progress
     p++;
   }
 }
-//-----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
 void LocalSolver::clear_factorization()
 {
   _cholesky_cache.clear();
diff --git a/dolfin/fem/LocalSolver.h b/dolfin/fem/LocalSolver.h
index 0d78125..b8890a4 100644
--- a/dolfin/fem/LocalSolver.h
+++ b/dolfin/fem/LocalSolver.h
@@ -14,8 +14,6 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Steven Vandekerckhove, 2014.
 
 #ifndef __LOCAL_SOLVER_H
 #define __LOCAL_SOLVER_H
@@ -30,10 +28,23 @@ namespace dolfin
 {
 
   /// This class solves problems cell-wise. It computes the local
-  /// left-hand side A_local and the local right-hand side b_local
-  /// (for one cell), and solves A_local x_local = b_local. The result
-  /// x_local is copied into the global vector x. The operator A_local
-  /// must be square.
+  /// left-hand side A_local which must be square locally but not
+  /// globally. The right-hand side b_local is either computed locally
+  /// for one cell or globally for all cells depending on which of the
+  /// solve_local_rhs or solve_global_rhs methods which are
+  /// called. You can optionally assemble the right-hand side vector
+  /// yourself and use the solve_local method. You must then provide
+  /// the DofMap of the right-hand side.
+  ///
+  /// The local solver solves A_local x_local = b_local. The result
+  /// x_local is copied into the global vector x of the provided
+  /// Function u. You can optionally call the factorize() method to
+  /// pre-calculate the local left-hand side factorizations to speed
+  /// up repeated applications of the LocalSolver with the same
+  /// LHS. The solve_xxx methods will factorise the LHS A_local
+  /// matrices each time if they are not cached by a previous call to
+  /// factorize. You can chose upon initialization whether you want
+  /// Cholesky or LU (default) factorisations.
   ///
   /// For forms with no coupling across cell edges, this function is
   /// identical to a global solve. For problems with coupling across
@@ -53,14 +64,14 @@ namespace dolfin
   {
   public:
 
-    enum SolverType {LU, Cholesky};
+    enum class SolverType {LU, Cholesky};
 
     /// Constructor (shared pointer version)
     LocalSolver(std::shared_ptr<const Form> a, std::shared_ptr<const Form> L,
-                SolverType solver_type=LU);
+                SolverType solver_type=SolverType::LU);
 
     /// Constructor (shared pointer version)
-    LocalSolver(std::shared_ptr<const Form> a, SolverType solver_type=LU);
+    LocalSolver(std::shared_ptr<const Form> a, SolverType solver_type=SolverType::LU);
 
     /// Solve local (cell-wise) problems A_e x_e = b_e, where A_e is
     /// the cell matrix LHS and b_e is the global RHS vector b
@@ -72,10 +83,13 @@ namespace dolfin
     void solve_global_rhs(Function& u) const;
 
     /// Solve local (cell-wise) problems A_e x_e = b_e where A_e and
-    /// b_e are the cell element tensors. This function is useful for
-    /// computing (approximate) cell-wise projections, for example for
-    /// post-processing. It much more efficient than computing global
-    /// projections.
+    /// b_e are the cell element tensors. Compared to solve_global_rhs
+    /// this function calculates local RHS vectors for each cell and
+    /// hence does not include contributions from neighbouring cells.
+    ///
+    /// This function is useful for computing (approximate) cell-wise
+    /// projections, for example for post-processing. It much more
+    /// efficient than computing global projections.
     void solve_local_rhs(Function& u) const;
 
     /// Solve local problems for given RHS and corresponding dofmap
@@ -83,10 +97,10 @@ namespace dolfin
     void solve_local(GenericVector& x, const GenericVector& b,
                      const GenericDofMap& dofmap_b) const;
 
-    /// Factorise LHS for all cells and store
+    /// Factorise the local LHS matrices for all cells and store in cache
     void factorize();
 
-    /// Reset (clear) any stored factorisations
+    /// Reset (clear) any stored factorizations
     void clear_factorization();
 
   private:
@@ -100,12 +114,17 @@ namespace dolfin
     // Cached LU factorisations of matrices (_spd==false)
     std::vector<Eigen::PartialPivLU<Eigen::Matrix<double, Eigen::Dynamic,
                                                   Eigen::Dynamic,
-                                                  Eigen::RowMajor> > > _lu_cache;
+                                                  Eigen::RowMajor>>> _lu_cache;
 
     // Cached Cholesky factorisations of matrices (_spd==true)
     std::vector<Eigen::LLT<Eigen::Matrix<double, Eigen::Dynamic,
                                          Eigen::Dynamic,
-                                         Eigen::RowMajor> > > _cholesky_cache;
+                                         Eigen::RowMajor>>> _cholesky_cache;
+
+    // Helper function that does the actual calculations
+    void _solve_local(GenericVector& x,
+                      const GenericVector* global_b,
+                      const GenericDofMap* dofmap_L) const;
   };
 
 }
diff --git a/dolfin/fem/MultiMeshAssembler.cpp b/dolfin/fem/MultiMeshAssembler.cpp
index 720822e..a25300f 100644
--- a/dolfin/fem/MultiMeshAssembler.cpp
+++ b/dolfin/fem/MultiMeshAssembler.cpp
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-09-12
-// Last changed: 2015-05-13
+// Last changed: 2015-11-12
 
 #include <dolfin/function/MultiMeshFunctionSpace.h>
 
@@ -99,7 +99,7 @@ void MultiMeshAssembler::_assemble_uncut_cells(GenericTensor& A,
 
   // Initialize variables that will be reused throughout assembly
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
 
   // Iterate over parts
   for (std::size_t part = 0; part < a.num_parts(); part++)
@@ -113,14 +113,16 @@ void MultiMeshAssembler::_assemble_uncut_cells(GenericTensor& A,
     UFC ufc_part(a_part);
 
     // Extract mesh
-    const Mesh& mesh_part = a_part.mesh();
+    dolfin_assert(a_part.mesh());
+    const Mesh& mesh_part = *(a_part.mesh());
 
-    // Get integral for uncut cells
-    ufc::cell_integral* cell_integral = ufc_part.default_cell_integral.get();
+    // FIXME: Handle subdomains
+
+    // Get integral
+    ufc::cell_integral* integral = ufc_part.default_cell_integral.get();
 
     // Skip if we don't have a cell integral
-    if (!cell_integral)
-      continue;
+    if (!integral) continue;
 
     // Get uncut cells
     const std::vector<unsigned int>& uncut_cells = multimesh->uncut_cells(part);
@@ -133,8 +135,8 @@ void MultiMeshAssembler::_assemble_uncut_cells(GenericTensor& A,
 
       // Update to current cell
       cell.get_cell_data(ufc_cell);
-      cell.get_vertex_coordinates(vertex_coordinates);
-      ufc_part.update(cell, vertex_coordinates, ufc_cell);
+      cell.get_coordinate_dofs(coordinate_dofs);
+      ufc_part.update(cell, coordinate_dofs, ufc_cell);
 
       // Get local-to-global dof maps for cell
       for (std::size_t i = 0; i < form_rank; ++i)
@@ -144,10 +146,10 @@ void MultiMeshAssembler::_assemble_uncut_cells(GenericTensor& A,
       }
 
       // Tabulate cell tensor
-      cell_integral->tabulate_tensor(ufc_part.A.data(),
-                                     ufc_part.w(),
-                                     vertex_coordinates.data(),
-                                     ufc_cell.orientation);
+      integral->tabulate_tensor(ufc_part.A.data(),
+                                ufc_part.w(),
+                                coordinate_dofs.data(),
+                                ufc_cell.orientation);
 
       // Add entries to global tensor
       A.add(ufc_part.A.data(), dofs);
@@ -174,7 +176,7 @@ void MultiMeshAssembler::_assemble_cut_cells(GenericTensor& A,
 
   // Initialize variables that will be reused throughout assembly
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
 
   // Iterate over parts
   for (std::size_t part = 0; part < a.num_parts(); part++)
@@ -188,23 +190,16 @@ void MultiMeshAssembler::_assemble_cut_cells(GenericTensor& A,
     UFC ufc_part(a_part);
 
     // Extract mesh
-    const Mesh& mesh_part = a_part.mesh();
+    dolfin_assert(a_part.mesh());
+    const Mesh& mesh_part = *(a_part.mesh());
 
-    // FIXME: We assume that the custom integral associated with cut
-    // FIXME: cells is number 0. This needs to be sorted out in the
-    // FIXME: UFL-UFC interface.
+    // FIXME: Handle subdomains
 
-    // Get integral for cut cells
-    ufc::custom_integral* custom_integral = 0;
-    if (a_part.ufc_form()->max_custom_subdomain_id() > 0)
-    {
-      custom_integral = ufc_part.get_custom_integral(0);
-      dolfin_assert(custom_integral->num_cells() == 1);
-    }
+    // Get integral
+    ufc::cutcell_integral* integral = ufc_part.default_cutcell_integral.get();
 
-    // Skip if we don't have a custom integral
-    if (!custom_integral)
-      continue;
+    // Skip if we don't have a cutcell integral
+    if (!integral) continue;
 
     // Get cut cells and quadrature rules
     const std::vector<unsigned int>& cut_cells = multimesh->cut_cells(part);
@@ -218,8 +213,8 @@ void MultiMeshAssembler::_assemble_cut_cells(GenericTensor& A,
 
       // Update to current cell
       cell.get_cell_data(ufc_cell);
-      cell.get_vertex_coordinates(vertex_coordinates);
-      ufc_part.update(cell, vertex_coordinates, ufc_cell);
+      cell.get_coordinate_dofs(coordinate_dofs);
+      ufc_part.update(cell, coordinate_dofs, ufc_cell);
 
       // Get local-to-global dof maps for cell
       for (std::size_t i = 0; i < form_rank; ++i)
@@ -263,14 +258,13 @@ void MultiMeshAssembler::_assemble_cut_cells(GenericTensor& A,
       }
 
       // Tabulate cell tensor
-      custom_integral->tabulate_tensor(ufc_part.A.data(),
-                                       ufc_part.w(),
-                                       vertex_coordinates.data(),
-                                       num_quadrature_points,
-                                       pr.first.data(),
-                                       pr.second.data(),
-                                       0,
-                                       ufc_cell.orientation);
+      integral->tabulate_tensor(ufc_part.A.data(),
+                                ufc_part.w(),
+                                coordinate_dofs.data(),
+                                num_quadrature_points,
+                                pr.first.data(),
+                                pr.second.data(),
+                                ufc_cell.orientation);
 
       // Add entries to global tensor
       A.add(ufc_part.A.data(), dofs);
@@ -297,8 +291,8 @@ void MultiMeshAssembler::_assemble_interface(GenericTensor& A,
 
   // Initialize variables that will be reused throughout assembly
   ufc::cell ufc_cell[2];
-  std::vector<double> vertex_coordinates[2];
-  std::vector<double> macro_vertex_coordinates;
+  std::vector<double> coordinate_dofs[2];
+  std::vector<double> macro_coordinate_dofs;
 
   // Vector to hold dofs for cells, and a vector holding pointers to same
   std::vector<ArrayView<const dolfin::la_index>> macro_dof_ptrs(form_rank);
@@ -307,149 +301,140 @@ void MultiMeshAssembler::_assemble_interface(GenericTensor& A,
   // Iterate over parts
   for (std::size_t part = 0; part < a.num_parts(); part++)
   {
+    log(PROGRESS, "Assembling multimesh form over interface on part %d.",
+        part);
+
     // Get form for current part
     const Form& a_part = *a.part(part);
 
     // Create data structure for local assembly data
     UFC ufc_part(a_part);
 
-    // FIXME: We assume that the custom integral associated with the
-    // FIXME: interface is number 1.
-    // FIXME: This needs to be sorted out in the UFL-UFC interfaces
-    // FIXME: We also assume that we have exactly two cells, while the UFC
-    // FIXME: interface (but not FFC...) allows an arbitrary number of cells.
+    // FIXME: Handle subdomains
 
     // Get integral
-    ufc::custom_integral* custom_integral = 0;
-    if (a_part.ufc_form()->max_custom_subdomain_id() > 1)
-    {
-      custom_integral = ufc_part.get_custom_integral(1);
-      dolfin_assert(custom_integral->num_cells() == 2);
-    }
+    ufc::interface_integral* integral = ufc_part.default_interface_integral.get();
 
-    // Assemble over interface
-    if (custom_integral)
-    {
-      log(PROGRESS, "Assembling multimesh form over interface on part %d.",
-          part);
+    // Skip if we don't have an interface integral
+    if (!integral) continue;
 
-      // Get quadrature rules
-      const auto& quadrature_rules = multimesh->quadrature_rule_interface(part);
+    // Get quadrature rules
+    const auto& quadrature_rules = multimesh->quadrature_rule_interface(part);
 
-      // Get collision map
-      const auto& cmap = multimesh->collision_map_cut_cells(part);
+    // Get collision map
+    const auto& cmap = multimesh->collision_map_cut_cells(part);
 
-      // Get facet normals
-      const auto& facet_normals = multimesh->facet_normals(part);
+    // Get facet normals
+    const auto& facet_normals = multimesh->facet_normals(part);
 
-      // Iterate over all cut cells in collision map
-      for (auto it = cmap.begin(); it != cmap.end(); ++it)
-      {
-        // Get cut cell
-        const unsigned int cut_cell_index = it->first;
-        const Cell cut_cell(*multimesh->part(part), cut_cell_index);
+    // Iterate over all cut cells in collision map
+    for (auto it = cmap.begin(); it != cmap.end(); ++it)
+    {
+      // Get cut cell
+      const unsigned int cut_cell_index = it->first;
+      const Cell cut_cell(*multimesh->part(part), cut_cell_index);
 
-        // Iterate over cutting cells
-        const auto& cutting_cells = it->second;
-        for (auto jt = cutting_cells.begin(); jt != cutting_cells.end(); jt++)
+      // Iterate over cutting cells
+      const auto& cutting_cells = it->second;
+      for (auto jt = cutting_cells.begin(); jt != cutting_cells.end(); jt++)
+      {
+        // Get cutting part and cutting cell
+        const std::size_t cutting_part = jt->first;
+        const std::size_t cutting_cell_index = jt->second;
+        const Cell cutting_cell(*multimesh->part(cutting_part),
+                                cutting_cell_index);
+
+        // Get quadrature rule for interface part defined by
+        // intersection of the cut and cutting cells
+        const std::size_t k = jt - cutting_cells.begin();
+        dolfin_assert(k < quadrature_rules.at(cut_cell_index).size());
+        const auto& qr = quadrature_rules.at(cut_cell_index)[k];
+
+        // FIXME: There might be quite a few cases when we skip cutting
+        // FIXME: cells because there are no quadrature points. Perhaps
+        // FIXME: we can rewrite this inner loop to avoid unnecessary
+        // FIXME: iterations.
+
+        // Skip if there are no quadrature points
+        const std::size_t num_quadrature_points = qr.second.size();
+        if (num_quadrature_points == 0)
+          continue;
+
+        // Create aliases for cells to simplify notation
+        const Cell& cell_0 = cut_cell;
+        const Cell& cell_1 = cutting_cell;
+
+        // Update to current pair of cells
+        cell_0.get_cell_data(ufc_cell[0], 0);
+        cell_1.get_cell_data(ufc_cell[1], 0);
+        cell_0.get_coordinate_dofs(coordinate_dofs[0]);
+        cell_1.get_coordinate_dofs(coordinate_dofs[1]);
+        ufc_part.update(cell_0, coordinate_dofs[0], ufc_cell[0],
+                        cell_1, coordinate_dofs[1], ufc_cell[1]);
+
+        // Collect vertex coordinates
+        macro_coordinate_dofs.resize(coordinate_dofs[0].size() +
+                                     coordinate_dofs[0].size());
+        std::copy(coordinate_dofs[0].begin(),
+                  coordinate_dofs[0].end(),
+                  macro_coordinate_dofs.begin());
+        std::copy(coordinate_dofs[1].begin(),
+                  coordinate_dofs[1].end(),
+                  macro_coordinate_dofs.begin()
+                  + coordinate_dofs[0].size());
+
+        // Tabulate dofs for each dimension on macro element
+        for (std::size_t i = 0; i < form_rank; i++)
         {
-          // Get cutting part and cutting cell
-          const std::size_t cutting_part = jt->first;
-          const std::size_t cutting_cell_index = jt->second;
-          const Cell cutting_cell(*multimesh->part(cutting_part),
-                                  cutting_cell_index);
-
-          // Get quadrature rule for interface part defined by
-          // intersection of the cut and cutting cells
-          const std::size_t k = jt - cutting_cells.begin();
-          dolfin_assert(k < quadrature_rules.at(cut_cell_index).size());
-          const auto& qr = quadrature_rules.at(cut_cell_index)[k];
-
-          // FIXME: There might be quite a few cases when we skip cutting
-          // FIXME: cells because there are no quadrature points. Perhaps
-          // FIXME: we can rewrite this inner loop to avoid unnecessary
-          // FIXME: iterations.
-
-          // Skip if there are no quadrature points
-          const std::size_t num_quadrature_points = qr.second.size();
-          if (num_quadrature_points == 0)
-            continue;
-
-          // Create aliases for cells to simplify notation
-          const Cell& cell_0 = cut_cell;
-          const Cell& cell_1 = cutting_cell;
-
-          // Update to current pair of cells
-          cell_0.get_cell_data(ufc_cell[0], 0);
-          cell_1.get_cell_data(ufc_cell[1], 0);
-          cell_0.get_vertex_coordinates(vertex_coordinates[0]);
-          cell_1.get_vertex_coordinates(vertex_coordinates[1]);
-          ufc_part.update(cell_0, vertex_coordinates[0], ufc_cell[0],
-                          cell_1, vertex_coordinates[1], ufc_cell[1]);
-
-          // Collect vertex coordinates
-          macro_vertex_coordinates.resize(vertex_coordinates[0].size() +
-                                          vertex_coordinates[0].size());
-          std::copy(vertex_coordinates[0].begin(),
-                    vertex_coordinates[0].end(),
-                    macro_vertex_coordinates.begin());
-          std::copy(vertex_coordinates[1].begin(),
-                    vertex_coordinates[1].end(),
-                    macro_vertex_coordinates.begin()
-                    + vertex_coordinates[0].size());
-
-          // Tabulate dofs for each dimension on macro element
-          for (std::size_t i = 0; i < form_rank; i++)
-          {
-            // Get dofs for cut mesh
-            const auto dofmap_0 = a.function_space(i)->dofmap()->part(part);
-            const auto dofs_0 = dofmap_0->cell_dofs(cell_0.index());
-
-            // Get dofs for cutting mesh
-            const auto dofmap_1
-              = a.function_space(i)->dofmap()->part(cutting_part);
-            const auto dofs_1 = dofmap_1->cell_dofs(cell_1.index());
-
-            // Create space in macro dof vector
-            macro_dofs[i].resize(dofs_0.size() + dofs_1.size());
-
-            // Copy cell dofs into macro dof vector
-            std::copy(dofs_0.begin(), dofs_0.end(),
-                      macro_dofs[i].begin());
-            std::copy(dofs_1.begin(), dofs_1.end(),
-                      macro_dofs[i].begin() + dofs_0.size());
-
-            // Update array view
-            macro_dof_ptrs[i]
-              = ArrayView<const dolfin::la_index>(macro_dofs[i].size(),
-                                                  macro_dofs[i].data());
-          }
+          // Get dofs for cut mesh
+          const auto dofmap_0 = a.function_space(i)->dofmap()->part(part);
+          const auto dofs_0 = dofmap_0->cell_dofs(cell_0.index());
+
+          // Get dofs for cutting mesh
+          const auto dofmap_1
+            = a.function_space(i)->dofmap()->part(cutting_part);
+          const auto dofs_1 = dofmap_1->cell_dofs(cell_1.index());
+
+          // Create space in macro dof vector
+          macro_dofs[i].resize(dofs_0.size() + dofs_1.size());
+
+          // Copy cell dofs into macro dof vector
+          std::copy(dofs_0.begin(), dofs_0.end(),
+                    macro_dofs[i].begin());
+          std::copy(dofs_1.begin(), dofs_1.end(),
+                    macro_dofs[i].begin() + dofs_0.size());
+
+          // Update array view
+          macro_dof_ptrs[i]
+            = ArrayView<const dolfin::la_index>(macro_dofs[i].size(),
+                                                macro_dofs[i].data());
+        }
 
-          // Get facet normals
-          const auto& n = facet_normals.at(cut_cell_index)[k];
+        // Get facet normals
+        const auto& n = facet_normals.at(cut_cell_index)[k];
 
-          // FIXME: We would like to use this assertion (but it fails for 2 meshes)
-          dolfin_assert(n.size() == a_part.mesh().geometry().dim()*num_quadrature_points);
+        // FIXME: We would like to use this assertion (but it fails
+        // for 2 meshes)
+        dolfin_assert(n.size() == a_part.mesh()->geometry().dim()*num_quadrature_points);
 
-          // FIXME: For now, use this assertion (which fails for 3 meshes)
-          //dolfin_assert(n.size() > 0);
+        // FIXME: For now, use this assertion (which fails for 3 meshes)
+        //dolfin_assert(n.size() > 0);
 
-          // FIXME: Cell orientation not supported
-          const int cell_orientation = ufc_cell[0].orientation;
+        // FIXME: Cell orientation not supported
+        const int cell_orientation = ufc_cell[0].orientation;
 
-          // Tabulate interface tensor on macro element
-          custom_integral->tabulate_tensor(ufc_part.macro_A.data(),
-                                           ufc_part.macro_w(),
-                                           macro_vertex_coordinates.data(),
-                                           num_quadrature_points,
-                                           qr.first.data(),
-                                           qr.second.data(),
-                                           n.data(),
-                                           cell_orientation);
+        // Tabulate interface tensor on macro element
+        integral->tabulate_tensor(ufc_part.macro_A.data(),
+                                  ufc_part.macro_w(),
+                                  macro_coordinate_dofs.data(),
+                                  num_quadrature_points,
+                                  qr.first.data(),
+                                  qr.second.data(),
+                                  n.data(),
+                                  cell_orientation);
 
-          // Add entries to global tensor
-          A.add(ufc_part.macro_A.data(), macro_dof_ptrs);
-        }
+        // Add entries to global tensor
+        A.add(ufc_part.macro_A.data(), macro_dof_ptrs);
       }
     }
   }
@@ -477,8 +462,8 @@ void MultiMeshAssembler::_assemble_overlap(GenericTensor& A,
 
   // Initialize variables that will be reused throughout assembly
   ufc::cell ufc_cell[2];
-  std::vector<double> vertex_coordinates[2];
-  std::vector<double> macro_vertex_coordinates;
+  std::vector<double> coordinate_dofs[2];
+  std::vector<double> macro_coordinate_dofs;
 
   // Vector to hold dofs for cells, and a vector holding pointers to same
   std::vector<ArrayView<const dolfin::la_index>> macro_dof_ptrs(form_rank);
@@ -487,133 +472,123 @@ void MultiMeshAssembler::_assemble_overlap(GenericTensor& A,
   // Iterate over parts
   for (std::size_t part = 0; part < a.num_parts(); part++)
   {
+    log(PROGRESS, "Assembling multimesh form over overlap on part %d.", part);
+
     // Get form for current part
     const Form& a_part = *a.part(part);
 
     // Create data structure for local assembly data
     UFC ufc_part(a_part);
 
-    // FIXME: We assume that the custom integral associated with the overlap is number 2.
-    // FIXME: This needs to be sorted out in the UFL-UFC interfaces
-    // FIXME: We also assume that we have exactly two cells, while the UFC
-    // FIXME: interface (but not FFC...) allows an arbitrary number of cells.
+    // FIXME: Handle subdomains
 
     // Get integral
-    ufc::custom_integral* custom_integral = 0;
-    if (a_part.ufc_form()->max_custom_subdomain_id() > 2)
-    {
-      custom_integral = ufc_part.get_custom_integral(2);
-      dolfin_assert(custom_integral->num_cells() == 2);
-    }
+    ufc::overlap_integral* integral = ufc_part.default_overlap_integral.get();
 
-    // Assemble over overlap
-    if (custom_integral)
-    {
-      log(PROGRESS, "Assembling multimesh form over overlap on part %d.", part);
+    // Skip if we don't have an overlap integral
+    if (!integral) continue;
 
-      // Get quadrature rules
-      const auto& quadrature_rules = multimesh->quadrature_rule_overlap(part);
+    // Get quadrature rules
+    const auto& quadrature_rules = multimesh->quadrature_rule_overlap(part);
 
-      // Get collision map
-      const auto& cmap = multimesh->collision_map_cut_cells(part);
+    // Get collision map
+    const auto& cmap = multimesh->collision_map_cut_cells(part);
 
-      // Iterate over all cut cells in collision map
-      for (auto it = cmap.begin(); it != cmap.end(); ++it)
-      {
-        // Get cut cell
-        const unsigned int cut_cell_index = it->first;
-        const Cell cut_cell(*multimesh->part(part), cut_cell_index);
+    // Iterate over all cut cells in collision map
+    for (auto it = cmap.begin(); it != cmap.end(); ++it)
+    {
+      // Get cut cell
+      const unsigned int cut_cell_index = it->first;
+      const Cell cut_cell(*multimesh->part(part), cut_cell_index);
 
-        // Iterate over cutting cells
-        const auto& cutting_cells = it->second;
-        for (auto jt = cutting_cells.begin(); jt != cutting_cells.end(); jt++)
+      // Iterate over cutting cells
+      const auto& cutting_cells = it->second;
+      for (auto jt = cutting_cells.begin(); jt != cutting_cells.end(); jt++)
+      {
+        // Get cutting part and cutting cell
+        const std::size_t cutting_part = jt->first;
+        const std::size_t cutting_cell_index = jt->second;
+        const Cell cutting_cell(*multimesh->part(cutting_part), cutting_cell_index);
+
+        // Get quadrature rule for interface part defined by
+        // intersection of the cut and cutting cells
+        const std::size_t k = jt - cutting_cells.begin();
+        dolfin_assert(k < quadrature_rules.at(cut_cell_index).size());
+        const auto& qr = quadrature_rules.at(cut_cell_index)[k];
+
+        // FIXME: There might be quite a few cases when we skip cutting
+        // FIXME: cells because there are no quadrature points. Perhaps
+        // FIXME: we can rewrite this inner loop to avoid unnecessary
+        // FIXME: iterations.
+
+        // Skip if there are no quadrature points
+        const std::size_t num_quadrature_points = qr.second.size();
+        if (num_quadrature_points == 0)
+          continue;
+
+        // Create aliases for cells to simplify notation
+        const Cell& cell_0 = cut_cell;
+        const Cell& cell_1 = cutting_cell;
+
+        // Update to current pair of cells
+        cell_0.get_cell_data(ufc_cell[0], 0);
+        cell_1.get_cell_data(ufc_cell[1], 0);
+        cell_0.get_coordinate_dofs(coordinate_dofs[0]);
+        cell_1.get_coordinate_dofs(coordinate_dofs[1]);
+        ufc_part.update(cell_0, coordinate_dofs[0], ufc_cell[0],
+                        cell_1, coordinate_dofs[1], ufc_cell[1]);
+
+
+        // Collect vertex coordinates
+        macro_coordinate_dofs.resize(coordinate_dofs[0].size() +
+                                     coordinate_dofs[0].size());
+        std::copy(coordinate_dofs[0].begin(),
+                  coordinate_dofs[0].end(),
+                  macro_coordinate_dofs.begin());
+        std::copy(coordinate_dofs[1].begin(),
+                  coordinate_dofs[1].end(),
+                  macro_coordinate_dofs.begin() + coordinate_dofs[0].size());
+
+        // Tabulate dofs for each dimension on macro element
+        for (std::size_t i = 0; i < form_rank; i++)
         {
-          // Get cutting part and cutting cell
-          const std::size_t cutting_part = jt->first;
-          const std::size_t cutting_cell_index = jt->second;
-          const Cell cutting_cell(*multimesh->part(cutting_part), cutting_cell_index);
-
-          // Get quadrature rule for interface part defined by
-          // intersection of the cut and cutting cells
-          const std::size_t k = jt - cutting_cells.begin();
-          dolfin_assert(k < quadrature_rules.at(cut_cell_index).size());
-          const auto& qr = quadrature_rules.at(cut_cell_index)[k];
-
-          // FIXME: There might be quite a few cases when we skip cutting
-          // FIXME: cells because there are no quadrature points. Perhaps
-          // FIXME: we can rewrite this inner loop to avoid unnecessary
-          // FIXME: iterations.
-
-          // Skip if there are no quadrature points
-          const std::size_t num_quadrature_points = qr.second.size();
-          if (num_quadrature_points == 0)
-            continue;
-
-          // Create aliases for cells to simplify notation
-          const Cell& cell_0 = cut_cell;
-          const Cell& cell_1 = cutting_cell;
-
-          // Update to current pair of cells
-          cell_0.get_cell_data(ufc_cell[0], 0);
-          cell_1.get_cell_data(ufc_cell[1], 0);
-          cell_0.get_vertex_coordinates(vertex_coordinates[0]);
-          cell_1.get_vertex_coordinates(vertex_coordinates[1]);
-          ufc_part.update(cell_0, vertex_coordinates[0], ufc_cell[0],
-                          cell_1, vertex_coordinates[1], ufc_cell[1]);
-
-
-          // Collect vertex coordinates
-          macro_vertex_coordinates.resize(vertex_coordinates[0].size() +
-                                          vertex_coordinates[0].size());
-          std::copy(vertex_coordinates[0].begin(),
-                    vertex_coordinates[0].end(),
-                    macro_vertex_coordinates.begin());
-          std::copy(vertex_coordinates[1].begin(),
-                    vertex_coordinates[1].end(),
-                    macro_vertex_coordinates.begin() + vertex_coordinates[0].size());
-
-          // Tabulate dofs for each dimension on macro element
-          for (std::size_t i = 0; i < form_rank; i++)
-          {
-            // Get dofs for cut mesh
-            const auto dofmap_0 = a.function_space(i)->dofmap()->part(part);
-            const auto dofs_0 = dofmap_0->cell_dofs(cell_0.index());
-
-            // Get dofs for cutting mesh
-            const auto dofmap_1 = a.function_space(i)->dofmap()->part(cutting_part);
-            const auto dofs_1 = dofmap_1->cell_dofs(cell_1.index());
-
-            // Create space in macro dof vector
-            macro_dofs[i].resize(dofs_0.size() + dofs_1.size());
-
-            // Copy cell dofs into macro dof vector
-            std::copy(dofs_0.begin(), dofs_0.end(),
-                      macro_dofs[i].begin());
-            std::copy(dofs_1.begin(), dofs_1.end(),
-                      macro_dofs[i].begin() + dofs_0.size());
-
-            // Update array view
-            macro_dof_ptrs[i]
-              = ArrayView<const dolfin::la_index>(macro_dofs[i].size(),
-                                                  macro_dofs[i].data());
-          }
-
-          // FIXME: Cell orientation not supported
-          const int cell_orientation = ufc_cell[0].orientation;
-
-          // Tabulate overlap tensor on macro element
-          custom_integral->tabulate_tensor(ufc_part.macro_A.data(),
-                                           ufc_part.macro_w(),
-                                           macro_vertex_coordinates.data(),
-                                           num_quadrature_points,
-                                           qr.first.data(),
-                                           qr.second.data(),
-                                           0,
-                                           cell_orientation);
-
-          // Add entries to global tensor
-          A.add(ufc_part.macro_A.data(), macro_dof_ptrs);
+          // Get dofs for cut mesh
+          const auto dofmap_0 = a.function_space(i)->dofmap()->part(part);
+          const auto dofs_0 = dofmap_0->cell_dofs(cell_0.index());
+
+          // Get dofs for cutting mesh
+          const auto dofmap_1 = a.function_space(i)->dofmap()->part(cutting_part);
+          const auto dofs_1 = dofmap_1->cell_dofs(cell_1.index());
+
+          // Create space in macro dof vector
+          macro_dofs[i].resize(dofs_0.size() + dofs_1.size());
+
+          // Copy cell dofs into macro dof vector
+          std::copy(dofs_0.begin(), dofs_0.end(),
+                    macro_dofs[i].begin());
+          std::copy(dofs_1.begin(), dofs_1.end(),
+                    macro_dofs[i].begin() + dofs_0.size());
+
+          // Update array view
+          macro_dof_ptrs[i]
+            = ArrayView<const dolfin::la_index>(macro_dofs[i].size(),
+                                                macro_dofs[i].data());
         }
+
+        // FIXME: Cell orientation not supported
+        const int cell_orientation = ufc_cell[0].orientation;
+
+        // Tabulate overlap tensor on macro element
+        integral->tabulate_tensor(ufc_part.macro_A.data(),
+                                  ufc_part.macro_w(),
+                                  macro_coordinate_dofs.data(),
+                                  num_quadrature_points,
+                                  qr.first.data(),
+                                  qr.second.data(),
+                                  cell_orientation);
+
+        // Add entries to global tensor
+        A.add(ufc_part.macro_A.data(), macro_dof_ptrs);
       }
     }
   }
@@ -634,29 +609,24 @@ void MultiMeshAssembler::_init_global_tensor(GenericTensor& A,
   dolfin_assert(tensor_layout);
 
   // Get dimensions
-  std::vector<std::size_t> global_dimensions;
-  std::vector<std::pair<std::size_t, std::size_t>> local_ranges;
-  std::vector<std::size_t> block_sizes;
+  std::vector<std::shared_ptr<const IndexMap>> index_maps;
   for (std::size_t i = 0; i < a.rank(); i++)
   {
     std::shared_ptr<const MultiMeshFunctionSpace> V = a.function_space(i);
     dolfin_assert(V);
 
-    global_dimensions.push_back(V->dim());
-    local_ranges.push_back(std::make_pair(0, V->dim())); // FIXME: not parallel
+    index_maps.push_back(std::shared_ptr<const IndexMap>
+                         (new IndexMap(MPI_COMM_WORLD, V->dim(), 1)));
   }
 
-  // Set block size
-  const std::size_t block_size = 1;
-
   // Initialise tensor layout
-  tensor_layout->init(MPI_COMM_WORLD,
-                      global_dimensions, block_size, local_ranges);
+  tensor_layout->init(MPI_COMM_WORLD, index_maps,
+                      TensorLayout::Ghosts::UNGHOSTED);
 
   // Build sparsity pattern if required
   if (tensor_layout->sparsity_pattern())
   {
-    GenericSparsityPattern& pattern = *tensor_layout->sparsity_pattern();
+    SparsityPattern& pattern = *tensor_layout->sparsity_pattern();
     SparsityPatternBuilder::build_multimesh_sparsity_pattern(pattern, a);
   }
 
diff --git a/dolfin/fem/MultiMeshDirichletBC.cpp b/dolfin/fem/MultiMeshDirichletBC.cpp
index 3790d1a..b0d1cc1 100644
--- a/dolfin/fem/MultiMeshDirichletBC.cpp
+++ b/dolfin/fem/MultiMeshDirichletBC.cpp
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2014-05-12
-// Last changed: 2014-05-12
+// Last changed: 2016-03-02
 
 #include <dolfin/log/log.h>
 #include <dolfin/common/NoDeleter.h>
@@ -31,27 +31,63 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-MultiMeshDirichletBC::MultiMeshDirichletBC(const MultiMeshFunctionSpace& V,
-                                           const GenericFunction& g,
-                                           const SubDomain& sub_domain,
+MultiMeshDirichletBC::MultiMeshDirichletBC(std::shared_ptr<const MultiMeshFunctionSpace> V,
+                                           std::shared_ptr<const GenericFunction> g,
+                                           std::shared_ptr<const SubDomain> sub_domain,
                                            std::string method,
-                                           bool check_midpoint)
+                                           bool check_midpoint,
+                                           bool exclude_overlapped_boundaries)
+  : _sub_domain(0),
+    _exclude_overlapped_boundaries(exclude_overlapped_boundaries)
 {
-  // Initialize boundary conditions for parts
-  init(reference_to_no_delete_pointer(V),
-       reference_to_no_delete_pointer(g),
-       reference_to_no_delete_pointer(sub_domain),
-       method,
-       check_midpoint);
+  log(PROGRESS, "Initializing multimesh Dirichlet boundary conditions.");
+
+  // Initialize subdomain wrapper
+  _sub_domain.reset(new MultiMeshSubDomain(sub_domain,
+                                           V->multimesh(),
+                                           _exclude_overlapped_boundaries));
+
+  // Iterate over parts
+  for (std::size_t part = 0; part < V->num_parts(); part++)
+  {
+    // Get view of function space for part
+    std::shared_ptr<const FunctionSpace> V_part = V->view(part);
+
+    // Create Dirichlet boundary condition for part
+    std::shared_ptr<DirichletBC> bc(new DirichletBC(V_part,
+                                                    g,
+                                                    _sub_domain,
+                                                    method,
+                                                    check_midpoint));
+
+    // Add to list
+    _bcs.push_back(bc);
+  }
 }
 //-----------------------------------------------------------------------------
 MultiMeshDirichletBC::MultiMeshDirichletBC(std::shared_ptr<const MultiMeshFunctionSpace> V,
-                                           std::shared_ptr<const GenericFunction> g,
-                                           std::shared_ptr<const SubDomain> sub_domain,
-                                           std::string method,
-                                           bool check_midpoint)
+                                          std::shared_ptr<const GenericFunction> g,
+                                          std::shared_ptr<const MeshFunction<std::size_t>> sub_domains,
+                                          std::size_t sub_domain,
+                                          std::size_t part,
+                                          std::string method)
+  : _sub_domain(0),
+    _exclude_overlapped_boundaries(false)
 {
-  init(V, g, sub_domain, method, check_midpoint);
+  // Get view of function space for part
+  std::shared_ptr<const FunctionSpace> V_part = V->view(part);
+
+  // Create Dirichlet boundary condition for part
+  std::shared_ptr<DirichletBC> bc(new DirichletBC(V_part,
+                                                  g,
+                                                  sub_domains,
+                                                  sub_domain,
+                                                  method));
+
+  // Add to list. Note that in this case (as opposed to the case when the
+  // boundary conditions are specified in terms of a subdomain) we will only
+  // have a single boundary condition.
+  _bcs.push_back(bc);
 }
 //-----------------------------------------------------------------------------
 MultiMeshDirichletBC::~MultiMeshDirichletBC()
@@ -61,59 +97,115 @@ MultiMeshDirichletBC::~MultiMeshDirichletBC()
 //-----------------------------------------------------------------------------
 void MultiMeshDirichletBC::apply(GenericMatrix& A) const
 {
-  // Iterate over boundary conditions
-  for (std::size_t part = 0; part < _bcs.size(); part++)
+  // Check whether we have a list of boundary conditions, one for each
+  // part, or if we have a single boundary condition for a single
+  // part.
+
+  if (_sub_domain)
   {
-    // Set current part for subdomain wrapper
-    dolfin_assert(_sub_domain);
-    _sub_domain->set_current_part(part);
+    // Iterate over boundary conditions
+    for (std::size_t part = 0; part < _bcs.size(); part++)
+    {
+      // Set current part for subdomain wrapper
+      dolfin_assert(_sub_domain);
+      _sub_domain->set_current_part(part);
+
+      // Apply boundary condition for current part
+      _bcs[part]->apply(A);
+    }
+  }
+  else
+  {
+    dolfin_assert(_bcs.size() == 1);
 
-    // Apply boundary condition
-    _bcs[part]->apply(A);
+    // Apply the single boundary condition
+    _bcs[0]->apply(A);
   }
 }
 //-----------------------------------------------------------------------------
 void MultiMeshDirichletBC::apply(GenericVector& b) const
 {
-  // Iterate over boundary conditions
-  for (std::size_t part = 0; part < _bcs.size(); part++)
-  {
-    // Set current part for subdomain wrapper
-    dolfin_assert(_sub_domain);
-    _sub_domain->set_current_part(part);
+  // Check whether we have a list of boundary conditions, one for each
+  // part, or if we have a single boundary condition for a single
+  // part.
 
-    // Apply boundary condition
-    _bcs[part]->apply(b);
+  if (_sub_domain)
+  {
+    // Iterate over boundary conditions
+    for (std::size_t part = 0; part < _bcs.size(); part++)
+    {
+      // Set current part for subdomain wrapper
+      dolfin_assert(_sub_domain);
+      _sub_domain->set_current_part(part);
+      
+      // Apply boundary condition
+      _bcs[part]->apply(b);
+    }
   }
+  else
+  {
+    dolfin_assert(_bcs.size() == 1);
+    
+    // Apply the single boundary condition
+    _bcs[0]->apply(b);
+  }  
 }
 //-----------------------------------------------------------------------------
 void MultiMeshDirichletBC::apply(GenericMatrix& A,
                                  GenericVector& b) const
 {
-  // Iterate over boundary conditions
-  for (std::size_t part = 0; part < _bcs.size(); part++)
+  // Check whether we have a list of boundary conditions, one for each
+  // part, or if we have a single boundary condition for a single
+  // part.
+
+  if (_sub_domain)
+  {
+    // Iterate over boundary conditions
+    for (std::size_t part = 0; part < _bcs.size(); part++)
+    {
+      // Set current part for subdomain wrapper
+      dolfin_assert(_sub_domain);
+      _sub_domain->set_current_part(part);
+      
+      // Apply boundary condition
+      _bcs[part]->apply(A, b);
+    }
+  }
+  else
   {
-    // Set current part for subdomain wrapper
-    dolfin_assert(_sub_domain);
-    _sub_domain->set_current_part(part);
+    dolfin_assert(_bcs.size() == 1);
 
-    // Apply boundary condition
-    _bcs[part]->apply(A, b);
+    // Apply the single boundary condition
+    _bcs[0]->apply(A, b);
   }
 }
 //-----------------------------------------------------------------------------
 void MultiMeshDirichletBC::apply(GenericVector& b,
                                  const GenericVector& x) const
 {
-  // Iterate over boundary conditions
-  for (std::size_t part = 0; part < _bcs.size(); part++)
+  // Check whether we have a list of boundary conditions, one for each
+  // part, or if we have a single boundary condition for a single
+  // part.
+
+  if (_sub_domain)
   {
-    // Set current part for subdomain wrapper
-    dolfin_assert(_sub_domain);
-    _sub_domain->set_current_part(part);
+    // Iterate over boundary conditions
+    for (std::size_t part = 0; part < _bcs.size(); part++)
+    {
+      // Set current part for subdomain wrapper
+      dolfin_assert(_sub_domain);
+      _sub_domain->set_current_part(part);
+      
+      // Apply boundary condition
+      _bcs[part]->apply(b, x);
+    }
+  }
+  else
+  {
+    dolfin_assert(_bcs.size() == 1);
 
-    // Apply boundary condition
-    _bcs[part]->apply(b, x);
+    // Apply the single boundary condition
+    _bcs[0]->apply(b, x);
   }
 }
 //-----------------------------------------------------------------------------
@@ -121,56 +213,40 @@ void MultiMeshDirichletBC::apply(GenericMatrix& A,
                                  GenericVector& b,
                                  const GenericVector& x) const
 {
-  // Iterate over boundary conditions
-  for (std::size_t part = 0; part < _bcs.size(); part++)
-  {
-    // Set current part for subdomain wrapper
-    dolfin_assert(_sub_domain);
-    _sub_domain->set_current_part(part);
+  // Check whether we have a list of boundary conditions, one for each
+  // part, or if we have a single boundary condition for a single
+  // part.
 
-    // Apply boundary condition
-    _bcs[part]->apply(A, b, x);
+  if (_sub_domain)
+  {
+    // Iterate over boundary conditions
+    for (std::size_t part = 0; part < _bcs.size(); part++)
+    {
+      // Set current part for subdomain wrapper
+      dolfin_assert(_sub_domain);
+      _sub_domain->set_current_part(part);
+      
+      // Apply boundary condition
+      _bcs[part]->apply(A, b, x);
+    }
   }
-}
-//-----------------------------------------------------------------------------
-void MultiMeshDirichletBC::init(std::shared_ptr<const MultiMeshFunctionSpace> V,
-                                std::shared_ptr<const GenericFunction> g,
-                                std::shared_ptr<const SubDomain> sub_domain,
-                                std::string method,
-                                bool check_midpoint)
-{
-  log(PROGRESS, "Initializing multimesh Dirichlet boundary conditions.");
-
-  // Clear old data if any
-  _bcs.clear();
-
-  // Initialize subdomain wrapper
-  _sub_domain.reset(new MultiMeshSubDomain(sub_domain, V->multimesh()));
-
-  // Iterate over parts
-  for (std::size_t part = 0; part < V->num_parts(); part++)
+  else
   {
-    // Get view of function space for part
-    std::shared_ptr<const FunctionSpace> V_part = V->view(part);
-
-    // Create Dirichlet boundary condition for part
-    std::shared_ptr<DirichletBC> bc(new DirichletBC(V_part,
-                                                    g,
-                                                    _sub_domain,
-                                                    method,
-                                                    check_midpoint));
-
-    // Add to list
-    _bcs.push_back(bc);
+    dolfin_assert(_bcs.size() == 1);
+    
+    // Apply the single boundary condition
+    _bcs[0]->apply(A, b, x);
   }
 }
 //-----------------------------------------------------------------------------
 MultiMeshDirichletBC::MultiMeshSubDomain::MultiMeshSubDomain
 (std::shared_ptr<const SubDomain> sub_domain,
- std::shared_ptr<const MultiMesh> multimesh)
+ std::shared_ptr<const MultiMesh> multimesh,
+ bool exclude_overlapped_boundaries)
   : _user_sub_domain(sub_domain),
     _multimesh(multimesh),
-    _current_part(0)
+    _current_part(0),
+    _exclude_overlapped_boundaries(exclude_overlapped_boundaries)
 {
   // Do nothing
 }
@@ -187,7 +263,7 @@ bool MultiMeshDirichletBC::MultiMeshSubDomain::inside(const Array<double>& x,
 
   // If point is on boundary, check that it really is on the boundary,
   // which it may not be if it is contained in some other mesh.
-  if (on_boundary)
+  if (on_boundary && _exclude_overlapped_boundaries)
   {
     for (std::size_t part = 0; part < _multimesh->num_parts(); part++)
     {
@@ -215,4 +291,3 @@ void MultiMeshDirichletBC::MultiMeshSubDomain::set_current_part
   _current_part = current_part;
 }
 //-----------------------------------------------------------------------------
-
diff --git a/dolfin/fem/MultiMeshDirichletBC.h b/dolfin/fem/MultiMeshDirichletBC.h
index 566e29b..4ea4dc6 100644
--- a/dolfin/fem/MultiMeshDirichletBC.h
+++ b/dolfin/fem/MultiMeshDirichletBC.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Anders Logg
+// Copyright (C) 2014-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2014-05-12
-// Last changed: 2014-05-12
+// Last changed: 2016-03-02
 
 #ifndef __MULTI_MESH_DIRICHLET_BC_H
 #define __MULTI_MESH_DIRICHLET_BC_H
@@ -47,37 +47,49 @@ namespace dolfin
     ///
     /// *Arguments*
     ///     V (_MultiMeshFunctionSpace_)
-    ///         The function space.
+    ///         The function space
     ///     g (_GenericFunction_)
-    ///         The value.
+    ///         The value
     ///     sub_domain (_SubDomain_)
-    ///         The subdomain.
+    ///         The subdomain
     ///     method (std::string)
-    ///         Optional argument: A string specifying
-    ///         the method to identify dofs.
-    MultiMeshDirichletBC(const MultiMeshFunctionSpace& V,
-                         const GenericFunction& g,
-                         const SubDomain& sub_domain,
+    ///         Option passed to DirichletBC.
+    ///     check_midpoint (bool)
+    ///         Option passed to DirichletBC.
+    ///     exclude_overlapped_boundaries (bool)
+    ///         If true, then the variable on_boundary will
+    ///         be set to false for facets that are overlapped
+    ///         by another mesh (irrespective of the layering order
+    ///         of the meshes).
+    MultiMeshDirichletBC(std::shared_ptr<const MultiMeshFunctionSpace> V,
+                         std::shared_ptr<const GenericFunction> g,
+                         std::shared_ptr<const SubDomain> sub_domain,
                          std::string method="topological",
-                         bool check_midpoint=true);
+                         bool check_midpoint=true,
+                         bool exclude_overlapped_boundaries=true);
 
-    /// Create boundary condition for subdomain
+    /// Create boundary condition for subdomain specified by index
     ///
     /// *Arguments*
-    ///     V (_MultiMeshFunctionSpace_)
-    ///         The function space
+    ///     V (_FunctionSpace_)
+    ///         The function space.
     ///     g (_GenericFunction_)
-    ///         The value
-    ///     sub_domain (_SubDomain_)
-    ///         The subdomain
+    ///         The value.
+    ///     sub_domains (_MeshFunction_ <std::size_t>)
+    ///         Subdomain markers
+    ///     sub_domain (std::size_t)
+    ///         The subdomain index (number)
+    ///     part (std::size_t)
+    ///         The part on which to set boundary conditions
     ///     method (std::string)
-    ///         Optional argument: A string specifying
-    ///         the method to identify dofs
+    ///         Optional argument: A string specifying the
+    ///         method to identify dofs.
     MultiMeshDirichletBC(std::shared_ptr<const MultiMeshFunctionSpace> V,
                          std::shared_ptr<const GenericFunction> g,
-                         std::shared_ptr<const SubDomain> sub_domain,
-                         std::string method="topological",
-                         bool check_midpoint=true);
+                         std::shared_ptr<const MeshFunction<std::size_t>> sub_domains,
+                         std::size_t sub_domain,
+                         std::size_t part,
+                         std::string method="topological");
 
     /// Destructor
     ~MultiMeshDirichletBC();
@@ -138,7 +150,8 @@ namespace dolfin
 
       // Constructor
       MultiMeshSubDomain(std::shared_ptr<const SubDomain> sub_domain,
-                         std::shared_ptr<const MultiMesh> multimesh);
+                         std::shared_ptr<const MultiMesh> multimesh,
+                         bool exclude_overlapped_boundaries);
 
       // Destructor
       ~MultiMeshSubDomain();
@@ -160,21 +173,20 @@ namespace dolfin
       // Current part
       std::size_t _current_part;
 
-    };
+      // Check whether to exclude boundaries overlapped by other meshes
+      bool _exclude_overlapped_boundaries;
 
-    // Initialize boundary conditions for parts
-    void init(std::shared_ptr<const MultiMeshFunctionSpace> V,
-              std::shared_ptr<const GenericFunction> g,
-              std::shared_ptr<const SubDomain> sub_domain,
-              std::string method,
-              bool check_midpoint);
+    };
 
     // List of boundary conditions for parts
-    std::vector<std::shared_ptr<const DirichletBC> > _bcs;
+    std::vector<std::shared_ptr<const DirichletBC>> _bcs;
 
     // Wrapper of user-defined subdomain
     mutable std::shared_ptr<MultiMeshSubDomain> _sub_domain;
 
+    // Check whether to exclude boundaries overlapped by other meshes
+    bool _exclude_overlapped_boundaries;
+
   };
 
 }
diff --git a/dolfin/fem/MultiMeshDofMap.cpp b/dolfin/fem/MultiMeshDofMap.cpp
index 1e66cac..154ebd8 100644
--- a/dolfin/fem/MultiMeshDofMap.cpp
+++ b/dolfin/fem/MultiMeshDofMap.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Anders Logg
+// Copyright (C) 2013-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-09-19
-// Last changed: 2014-07-04
+// Last changed: 2016-03-02
 
 #include <dolfin/common/types.h>
 #include <dolfin/common/NoDeleter.h>
@@ -36,7 +36,7 @@ MultiMeshDofMap::MultiMeshDofMap()
 //-----------------------------------------------------------------------------
 MultiMeshDofMap::MultiMeshDofMap(const MultiMeshDofMap& dofmap)
 {
-  _global_dimension = dofmap._global_dimension;
+  _index_map = dofmap._index_map;
   _original_dofmaps = dofmap._original_dofmaps;
   _new_dofmaps = dofmap._new_dofmaps;
 }
@@ -64,17 +64,12 @@ void MultiMeshDofMap::add(std::shared_ptr<const GenericDofMap> dofmap)
       _original_dofmaps.size());
 }
 //-----------------------------------------------------------------------------
-void MultiMeshDofMap::add(const GenericDofMap& dofmap)
-{
-  add(reference_to_no_delete_pointer(dofmap));
-}
-//-----------------------------------------------------------------------------
 void MultiMeshDofMap::build(const MultiMeshFunctionSpace& function_space,
                             const std::vector<dolfin::la_index>& offsets)
 {
   // Compute global dimension
   begin(PROGRESS, "Computing total dimension.");
-  _global_dimension = 0;
+  std::size_t _global_dimension = 0;
   for (std::size_t i = 0; i < num_parts(); i++)
   {
     const std::size_t d = _original_dofmaps[i]->global_dimension();
@@ -109,37 +104,46 @@ void MultiMeshDofMap::build(const MultiMeshFunctionSpace& function_space,
 
     // Add offset
     DofMap& dofmap = static_cast<DofMap&>(*new_dofmap);
+    dofmap._multimesh_offset = _offset;
     for (auto it = dofmap._dofmap.begin(); it != dofmap._dofmap.end(); ++it)
       *it += _offset;
 
     // Increase offset
     offset += _original_dofmaps[part]->global_dimension();
   }
+
+  _index_map.reset(new IndexMap(MPI_COMM_WORLD, _global_dimension, 1));
 }
 //-----------------------------------------------------------------------------
 void MultiMeshDofMap::clear()
 {
-  _global_dimension = 0;
+  _index_map.reset();
   _original_dofmaps.clear();
   _new_dofmaps.clear();
 }
 //-----------------------------------------------------------------------------
 std::size_t MultiMeshDofMap::global_dimension() const
 {
-  return _global_dimension;
+  return _index_map->size(IndexMap::MapSize::GLOBAL);
 }
 //-----------------------------------------------------------------------------
 std::pair<std::size_t, std::size_t> MultiMeshDofMap::ownership_range() const
 {
   // FIXME: Does not run in parallel
-  return std::make_pair<std::size_t, std::size_t>(0, global_dimension());
+  return _index_map->local_range();
 }
 //-----------------------------------------------------------------------------
 const std::vector<int>&
 MultiMeshDofMap::off_process_owner() const
 {
   // FIXME: Does not run in parallel
-  return _original_dofmaps[0]->off_process_owner();
+  return _index_map->off_process_owner();
+}
+//-----------------------------------------------------------------------------
+std::shared_ptr<IndexMap> MultiMeshDofMap::index_map() const
+{
+  // FIXME: Does not run in parallel
+  return _index_map;
 }
 //-----------------------------------------------------------------------------
 std::string MultiMeshDofMap::str(bool verbose) const
diff --git a/dolfin/fem/MultiMeshDofMap.h b/dolfin/fem/MultiMeshDofMap.h
index 99e4c6e..fe78fd9 100644
--- a/dolfin/fem/MultiMeshDofMap.h
+++ b/dolfin/fem/MultiMeshDofMap.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Anders Logg
+// Copyright (C) 2013-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-09-19
-// Last changed: 2014-06-11
+// Last changed: 2016-03-02
 
 #ifndef __MULTI_MESH_DOF_MAP_H
 #define __MULTI_MESH_DOF_MAP_H
@@ -59,20 +59,13 @@ namespace dolfin
     ///         Dofmap (part) number i
     std::shared_ptr<const GenericDofMap> part(std::size_t i) const;
 
-    /// Add dofmap (shared pointer version)
+    /// Add dofmap
     ///
     /// *Arguments*
     ///     dofmap (_GenericDofMap_)
     ///         The dofmap.
     void add(std::shared_ptr<const GenericDofMap> dofmap);
 
-    /// Add dofmap (reference version)
-    ///
-    /// *Arguments*
-    ///     dofmap (_DofMap_)
-    ///         The dofmap.
-    void add(const GenericDofMap& dofmap);
-
     /// Build MultiMesh dofmap
     void build(const MultiMeshFunctionSpace& function_space,
                const std::vector<dolfin::la_index>& offsets);
@@ -92,19 +85,23 @@ namespace dolfin
     /// to owning process
     const std::vector<int>& off_process_owner() const;
 
+    /// Return the map
+    std::shared_ptr<IndexMap> index_map() const;
+
     /// Return informal string representation (pretty-print)
     std::string str(bool verbose) const;
 
   private:
 
-    // Total global dimension (sum of parts)
-    std::size_t _global_dimension;
+    // Index Map containing total global dimension (sum of parts)
+    // FIXME: make it work in parallel
+    std::shared_ptr<IndexMap> _index_map;
 
     // List of original dofmaps
-    std::vector<std::shared_ptr<const GenericDofMap> > _original_dofmaps;
+    std::vector<std::shared_ptr<const GenericDofMap>> _original_dofmaps;
 
     // List of modified dofmaps
-    std::vector<std::shared_ptr<GenericDofMap> > _new_dofmaps;
+    std::vector<std::shared_ptr<GenericDofMap>> _new_dofmaps;
 
   };
 
diff --git a/dolfin/fem/MultiMeshForm.cpp b/dolfin/fem/MultiMeshForm.cpp
index aa46da8..aec8891 100644
--- a/dolfin/fem/MultiMeshForm.cpp
+++ b/dolfin/fem/MultiMeshForm.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Anders Logg
+// Copyright (C) 2013-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-09-12
-// Last changed: 2014-10-16
+// Last changed: 2016-03-02
 
 #include <dolfin/log/log.h>
 #include <dolfin/common/NoDeleter.h>
@@ -33,40 +33,20 @@ MultiMeshForm::MultiMeshForm(std::shared_ptr<const MultiMesh> multimesh)
   _multimesh = multimesh;
 }
 //-----------------------------------------------------------------------------
-MultiMeshForm::MultiMeshForm(const MultiMesh& multimesh)
-  : _rank(0)
-{
-  _multimesh = reference_to_no_delete_pointer(multimesh);
-}
-//-----------------------------------------------------------------------------
 MultiMeshForm::MultiMeshForm(std::shared_ptr<const MultiMeshFunctionSpace> function_space)
   : _rank(0)
 {
   _function_spaces.push_back(function_space);
 }
 //-----------------------------------------------------------------------------
-MultiMeshForm::MultiMeshForm(const MultiMeshFunctionSpace& function_space)
-  : _rank(0)
-{
-  _function_spaces.push_back(reference_to_no_delete_pointer(function_space));
-}
-//-----------------------------------------------------------------------------
 MultiMeshForm::MultiMeshForm(std::shared_ptr<const MultiMeshFunctionSpace> function_space_0,
-                     std::shared_ptr<const MultiMeshFunctionSpace> function_space_1)
+                             std::shared_ptr<const MultiMeshFunctionSpace> function_space_1)
   : _rank(0)
 {
   _function_spaces.push_back(function_space_0);
   _function_spaces.push_back(function_space_1);
 }
 //-----------------------------------------------------------------------------
-MultiMeshForm::MultiMeshForm(const MultiMeshFunctionSpace& function_space_0,
-                     const MultiMeshFunctionSpace& function_space_1)
-  : _rank(0)
-{
-  _function_spaces.push_back(reference_to_no_delete_pointer(function_space_0));
-  _function_spaces.push_back(reference_to_no_delete_pointer(function_space_1));
-}
-//-----------------------------------------------------------------------------
 MultiMeshForm::~MultiMeshForm()
 {
   // Do nothing
@@ -140,11 +120,6 @@ void MultiMeshForm::add(std::shared_ptr<const Form> form)
       _forms.size());
 }
 //-----------------------------------------------------------------------------
-void MultiMeshForm::add(const Form& form)
-{
-  add(reference_to_no_delete_pointer(form));
-}
-//-----------------------------------------------------------------------------
 void MultiMeshForm::build()
 {
   log(PROGRESS, "Building MultiMesh form.");
diff --git a/dolfin/fem/MultiMeshForm.h b/dolfin/fem/MultiMeshForm.h
index d2b8366..90246ec 100644
--- a/dolfin/fem/MultiMeshForm.h
+++ b/dolfin/fem/MultiMeshForm.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Anders Logg
+// Copyright (C) 2013-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-09-12
-// Last changed: 2014-10-16
+// Last changed: 2016-03-02
 
 #ifndef __MULTI_MESH_FORM_H
 #define __MULTI_MESH_FORM_H
@@ -40,25 +40,19 @@ namespace dolfin
   {
   public:
 
-    /// Create empty multimesh functional (shared pointer version)
-    MultiMeshForm(std::shared_ptr<const MultiMesh> multimesh);
+    // FIXME: Test multimesh functionals. Should likely require a multimesh
+    // when instaniated and this constructor should then be removed.
+    MultiMeshForm() {}
 
-    /// Create empty multimesh functional (reference version)
-    MultiMeshForm(const MultiMesh& multimesh);
+    /// Create empty multimesh functional
+    MultiMeshForm(std::shared_ptr<const MultiMesh> multimesh);
 
-    /// Create empty linear multimesh variational form (shared pointer version)
+    /// Create empty linear multimesh variational form
     MultiMeshForm(std::shared_ptr<const MultiMeshFunctionSpace> function_space);
 
-    /// Create empty linear multimesh variational form (reference version)
-    MultiMeshForm(const MultiMeshFunctionSpace& function_space);
-
-    /// Create empty bilinear multimesh variational form (shared pointer version)
+    /// Create empty bilinear multimesh variational form
     MultiMeshForm(std::shared_ptr<const MultiMeshFunctionSpace> function_space_0,
-              std::shared_ptr<const MultiMeshFunctionSpace> function_space_1);
-
-    /// Create empty bilinear multimesh variational form (reference version)
-    MultiMeshForm(const MultiMeshFunctionSpace& function_space_0,
-              const MultiMeshFunctionSpace& function_space_1);
+                  std::shared_ptr<const MultiMeshFunctionSpace> function_space_1);
 
     /// Destructor
     ~MultiMeshForm();
@@ -110,13 +104,6 @@ namespace dolfin
     ///         The form.
     void add(std::shared_ptr<const Form> form);
 
-    /// Add form (reference version)
-    ///
-    /// *Arguments*
-    ///     form (_Form_)
-    ///         The form.
-    void add(const Form& form);
-
     /// Build MultiMesh form
     void build();
 
@@ -132,10 +119,10 @@ namespace dolfin
     std::shared_ptr<const MultiMesh> _multimesh;
 
     // Function spaces (one for each argument)
-    std::vector<std::shared_ptr<const MultiMeshFunctionSpace> > _function_spaces;
+    std::vector<std::shared_ptr<const MultiMeshFunctionSpace>> _function_spaces;
 
     // List of forms (one for each part)
-    std::vector<std::shared_ptr<const Form> > _forms;
+    std::vector<std::shared_ptr<const Form>> _forms;
 
   };
 
diff --git a/dolfin/fem/NonlinearVariationalProblem.cpp b/dolfin/fem/NonlinearVariationalProblem.cpp
index b8b2d83..33d2678 100644
--- a/dolfin/fem/NonlinearVariationalProblem.cpp
+++ b/dolfin/fem/NonlinearVariationalProblem.cpp
@@ -16,157 +16,41 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // Modified by Corrado Maurini, 2013.
-//
-// First added:  2011-06-22
-// Last changed: 2013-03-20
 
-#include <dolfin/common/NoDeleter.h>
 #include <dolfin/function/Function.h>
+#include <dolfin/la/GenericVector.h>
 #include "Form.h"
 #include "NonlinearVariationalProblem.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-NonlinearVariationalProblem::NonlinearVariationalProblem(const Form& F,
-                                                         Function& u)
-  : Hierarchical<NonlinearVariationalProblem>(*this),
-    _residual(reference_to_no_delete_pointer(F)),
-    _u(reference_to_no_delete_pointer(u))
-{
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-NonlinearVariationalProblem::NonlinearVariationalProblem(const Form& F,
-                                                         Function& u,
-                                                         const Form& J)
-  : Hierarchical<NonlinearVariationalProblem>(*this),
-    _residual(reference_to_no_delete_pointer(F)),
-    _jacobian(reference_to_no_delete_pointer(J)),
-    _u(reference_to_no_delete_pointer(u))
-{
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-NonlinearVariationalProblem::NonlinearVariationalProblem(const Form& F,
-                                                         Function& u,
-                                                         const DirichletBC& bc)
-  : Hierarchical<NonlinearVariationalProblem>(*this),
-    _residual(reference_to_no_delete_pointer(F)), _u(reference_to_no_delete_pointer(u))
-{
-  // Store boundary condition
-  _bcs.push_back(reference_to_no_delete_pointer(bc));
-
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-NonlinearVariationalProblem::NonlinearVariationalProblem(const Form& F,
-                                                         Function& u,
-                                                         const DirichletBC& bc,
-                                                         const Form& J)
-  : Hierarchical<NonlinearVariationalProblem>(*this),
-    _residual(reference_to_no_delete_pointer(F)),
-    _jacobian(reference_to_no_delete_pointer(J)),
-    _u(reference_to_no_delete_pointer(u))
-{
-  // Store boundary condition
-  _bcs.push_back(reference_to_no_delete_pointer(bc));
-
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-NonlinearVariationalProblem::NonlinearVariationalProblem(const Form& F,
-                                                         Function& u,
-                                          std::vector<const DirichletBC*> bcs)
-  : Hierarchical<NonlinearVariationalProblem>(*this),
-    _residual(reference_to_no_delete_pointer(F)), _u(reference_to_no_delete_pointer(u))
-{
-  // Store boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); ++i)
-    _bcs.push_back(reference_to_no_delete_pointer(*bcs[i]));
-
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-NonlinearVariationalProblem::NonlinearVariationalProblem(const Form& F,
-                                                         Function& u,
-                                          std::vector<const DirichletBC*> bcs,
-                                          const Form& J)
-  : Hierarchical<NonlinearVariationalProblem>(*this),
-    _residual(reference_to_no_delete_pointer(F)),
-    _jacobian(reference_to_no_delete_pointer(J)),
-    _u(reference_to_no_delete_pointer(u))
-{
-  // Store boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); ++i)
-    _bcs.push_back(reference_to_no_delete_pointer(*bcs[i]));
-
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
-NonlinearVariationalProblem::NonlinearVariationalProblem(
-  std::shared_ptr<const Form> F,
-  std::shared_ptr<Function> u,
-  std::vector<std::shared_ptr<const DirichletBC>> bcs)
-  : Hierarchical<NonlinearVariationalProblem>(*this), _residual(F), _u(u)
-{
-  // Store boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); ++i)
-    _bcs.push_back(bcs[i]);
-
-  // Check forms
-  check_forms();
-}
-//-----------------------------------------------------------------------------
 NonlinearVariationalProblem::NonlinearVariationalProblem(
   std::shared_ptr<const Form> F,
   std::shared_ptr<Function> u,
   std::vector<std::shared_ptr<const DirichletBC>> bcs,
   std::shared_ptr<const Form> J)
-  : Hierarchical<NonlinearVariationalProblem>(*this), _residual(F), _jacobian(J), _u(u)
+  : Hierarchical<NonlinearVariationalProblem>(*this), _residual(F),
+  _jacobian(J), _u(u), _bcs(bcs)
 {
-  // Store boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); ++i)
-    _bcs.push_back(bcs[i]);
-
   // Check forms
   check_forms();
 }
 //-----------------------------------------------------------------------------
-void NonlinearVariationalProblem::set_bounds(
-  std::shared_ptr<const Function> lb_func,
-  std::shared_ptr<const Function> ub_func)
-{
-    set_bounds(*lb_func,*ub_func);
-}
-//-----------------------------------------------------------------------------
 void NonlinearVariationalProblem::set_bounds(const Function& lb_func,
                                              const Function& ub_func)
 {
-    set_bounds(lb_func.vector(),ub_func.vector());
-}
-//-----------------------------------------------------------------------------
-void NonlinearVariationalProblem::set_bounds(const GenericVector& lb,
-                                             const GenericVector& ub)
-{
-    set_bounds(reference_to_no_delete_pointer(lb),
-               reference_to_no_delete_pointer(ub));
+  this->set_bounds(lb_func.vector(), ub_func.vector());
 }
 //-----------------------------------------------------------------------------
 void NonlinearVariationalProblem::set_bounds(
   std::shared_ptr<const GenericVector> lb,
   std::shared_ptr<const GenericVector> ub)
 {
-    this->_lb = lb;
-    this->_ub = ub;
-    dolfin_assert(_lb);
-    dolfin_assert(_ub);
+  dolfin_assert(lb);
+  dolfin_assert(ub);
+  this->_lb = lb;
+  this->_ub = ub;
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<const Form> NonlinearVariationalProblem::residual_form() const
diff --git a/dolfin/fem/NonlinearVariationalProblem.h b/dolfin/fem/NonlinearVariationalProblem.h
index dd145fe..1bea88d 100644
--- a/dolfin/fem/NonlinearVariationalProblem.h
+++ b/dolfin/fem/NonlinearVariationalProblem.h
@@ -16,16 +16,12 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // Modified by Corrado Maurini, 2013.
-//
-// First added:  2011-06-22
-// Last changed: 2013-03-20
 
 #ifndef __NONLINEAR_VARIATIONAL_PROBLEM_H
 #define __NONLINEAR_VARIATIONAL_PROBLEM_H
 
 #include <memory>
 #include <vector>
-
 #include <dolfin/common/Hierarchical.h>
 
 namespace dolfin
@@ -51,78 +47,21 @@ namespace dolfin
   {
   public:
 
-    /// Create nonlinear variational problem without boundary
-    /// conditions.  The Jacobian form is not specified which requires
-    /// the use of a nonlinear solver that does not rely on the
-    /// Jacobian.
-    NonlinearVariationalProblem(const Form& F, Function& u);
-
-    /// Create nonlinear variational problem without boundary
-    /// conditions.  The Jacobian form is specified which allows the
-    /// use of a nonlinear solver that relies on the Jacobian (using
-    /// Newton's method).
-    NonlinearVariationalProblem(const Form& F, Function& u, const Form& J);
-
-    /// Create nonlinear variational problem with a single boundary
-    /// condition.  The Jacobian form is not specified which requires
-    /// the use of a nonlinear solver that does not rely on the
-    /// Jacobian.
-    NonlinearVariationalProblem(const Form& F, Function& u,
-                                const DirichletBC& bc);
-
-    /// Create nonlinear variational problem with a single boundary
-    /// condition.  The Jacobian form is specified which allows the
-    /// use of a nonlinear solver that relies on the Jacobian (using
-    /// Newton's method).
-    NonlinearVariationalProblem(const Form& F, Function& u,
-                                const DirichletBC& bc, const Form& J);
-
-    /// Create nonlinear variational problem with a list of boundary
-    /// conditions.  The Jacobian form is not specified which requires
-    /// the use of a nonlinear solver that does not rely on the
-    /// Jacobian.
-    NonlinearVariationalProblem(const Form& F, Function& u,
-                                std::vector<const DirichletBC*> bcs);
-
-    /// Create nonlinear variational problem with a list of boundary
-    /// conditions.  The Jacobian form is specified which allows the
-    /// use of a nonlinear solver that relies on the Jacobian (using
-    /// Newton's method).
-    NonlinearVariationalProblem(const Form& F, Function& u,
-                                std::vector<const DirichletBC*> bcs,
-                                const Form& J);
-
-    /// Create nonlinear variational problem, shared pointer version.
-    /// The Jacobian form is not specified which requires the use of a
-    /// nonlinear solver that does not rely on the Jacobian.
-    NonlinearVariationalProblem(std::shared_ptr<const Form> F,
-                                std::shared_ptr<Function> u,
-                                std::vector<std::shared_ptr<const DirichletBC> > bcs);
-
     /// Create nonlinear variational problem, shared pointer version.
     /// The Jacobian form is specified which allows the use of a
     /// nonlinear solver that relies on the Jacobian (using Newton's
     /// method).
     NonlinearVariationalProblem(std::shared_ptr<const Form> F,
                                 std::shared_ptr<Function> u,
-                                std::vector<std::shared_ptr<const DirichletBC> > bcs,
-                                std::shared_ptr<const Form> J);
+                                std::vector<std::shared_ptr<const DirichletBC>> bcs,
+                                std::shared_ptr<const Form> J=nullptr);
 
     /// Set the bounds for bound constrained solver
-    void set_bounds(std::shared_ptr<const GenericVector> lb,
-                    std::shared_ptr<const GenericVector> ub);
-
-    /// Set the bounds for bound constrained solver
-    void set_bounds(const GenericVector& lb,
-                    const GenericVector& ub);
+    void set_bounds(const Function& lb_func, const Function& ub_func);
 
     /// Set the bounds for bound constrained solver
-    void set_bounds(std::shared_ptr<const Function> lb_func,
-                    std::shared_ptr<const Function> ub_func);
-
-    /// Set the bounds for bound constrained solver
-    void set_bounds(const Function& lb_func,
-                    const Function& ub_func);
+    void set_bounds(std::shared_ptr<const GenericVector> lb,
+                    std::shared_ptr<const GenericVector> ub);
 
     /// Return residual form
     std::shared_ptr<const Form> residual_form() const;
@@ -137,7 +76,7 @@ namespace dolfin
     std::shared_ptr<const Function> solution() const;
 
     /// Return boundary conditions
-    std::vector<std::shared_ptr<const DirichletBC> > bcs() const;
+    std::vector<std::shared_ptr<const DirichletBC>> bcs() const;
 
     /// Return trial space
     std::shared_ptr<const FunctionSpace> trial_space() const;
@@ -168,16 +107,17 @@ namespace dolfin
     // The residual form
     std::shared_ptr<const Form> _residual;
 
-    // The Jacobian form (pointer may be zero if not provided)
+    // The Jacobian form (pointer may be null if not provided)
     std::shared_ptr<const Form> _jacobian;
 
     // The solution
     std::shared_ptr<Function> _u;
 
     // The boundary conditions
-    std::vector<std::shared_ptr<const DirichletBC> > _bcs;
+    std::vector<std::shared_ptr<const DirichletBC>> _bcs;
 
-    // The lower and upper bounds (pointers may be zero if not provided)
+    // The lower and upper bounds (pointers may be null if not
+    // provided)
     std::shared_ptr<const GenericVector> _lb;
     std::shared_ptr<const GenericVector> _ub;
   };
diff --git a/dolfin/fem/NonlinearVariationalSolver.cpp b/dolfin/fem/NonlinearVariationalSolver.cpp
index 3ef339d..dca0226 100644
--- a/dolfin/fem/NonlinearVariationalSolver.cpp
+++ b/dolfin/fem/NonlinearVariationalSolver.cpp
@@ -29,58 +29,19 @@
 #include "Assembler.h"
 #include "Form.h"
 #include "NonlinearVariationalProblem.h"
+#include "SystemAssembler.h"
 #include "NonlinearVariationalSolver.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-NonlinearVariationalSolver::
-NonlinearVariationalSolver(NonlinearVariationalProblem& problem)
-  : _problem(reference_to_no_delete_pointer(problem))
-{
-  // Set parameters
-  parameters = default_parameters();
-}
-//-----------------------------------------------------------------------------
-NonlinearVariationalSolver::
-NonlinearVariationalSolver(std::shared_ptr<NonlinearVariationalProblem> problem)
+NonlinearVariationalSolver::NonlinearVariationalSolver(std::shared_ptr<NonlinearVariationalProblem> problem)
   : _problem(problem)
 {
   // Set parameters
   parameters = default_parameters();
 }
 //-----------------------------------------------------------------------------
-std::pair<std::size_t, bool>
-NonlinearVariationalSolver::solve(const Function& lb,
-                                  const Function& ub)
-{
-  return solve(lb.vector(), ub.vector());
-}
-//-----------------------------------------------------------------------------
-std::pair<std::size_t, bool>
-NonlinearVariationalSolver::solve(std::shared_ptr<const Function> lb,
-                                  std::shared_ptr<const Function> ub)
-{
-  return solve(*lb,*ub);
-}
-//-----------------------------------------------------------------------------
-std::pair<std::size_t, bool>
-NonlinearVariationalSolver::solve(const GenericVector& lb,
-                                  const GenericVector& ub)
-{
-  return solve(reference_to_no_delete_pointer(lb),
-               reference_to_no_delete_pointer(ub));
-}
-//-----------------------------------------------------------------------------
-std::pair<std::size_t, bool>
-NonlinearVariationalSolver::solve(std::shared_ptr<const GenericVector> lb,
-                                  std::shared_ptr<const GenericVector> ub)
-{
-  // Set bounds and solve
-  this->_problem->set_bounds(lb,ub);
-  return solve();
-}
-//-----------------------------------------------------------------------------
 std::pair<std::size_t, bool> NonlinearVariationalSolver::solve()
 {
   begin("Solving nonlinear variational problem.");
@@ -102,11 +63,12 @@ std::pair<std::size_t, bool> NonlinearVariationalSolver::solve()
                  "Needs PETSc to solve bound constrained problems");
   }
 #endif
+
   // Get problem data
   dolfin_assert(_problem);
-  std::shared_ptr<Function> u(_problem->solution());
+  auto u = _problem->solution();
 
-  // Create nonlinear problem
+  // Create discrete nonlinear problem
   if (!nonlinear_problem)
   {
     nonlinear_problem = std::make_shared<NonlinearDiscreteProblem>(_problem,
@@ -122,6 +84,7 @@ std::pair<std::size_t, bool> NonlinearVariationalSolver::solve()
                    "solve nonlinear variational problem",
                    "Set the \"nonlinear_solver\" parameter to \"snes\" or remove bounds");
     }
+
     // Create Newton solver and set parameters
     if (!newton_solver)
       newton_solver = std::shared_ptr<NewtonSolver>(new NewtonSolver());
@@ -172,8 +135,8 @@ std::pair<std::size_t, bool> NonlinearVariationalSolver::solve()
 // Implementation of NonlinearDiscreteProblem
 //-----------------------------------------------------------------------------
 NonlinearVariationalSolver::NonlinearDiscreteProblem::
-NonlinearDiscreteProblem(std::shared_ptr<NonlinearVariationalProblem> problem,
-                         std::shared_ptr<NonlinearVariationalSolver> solver)
+NonlinearDiscreteProblem(std::shared_ptr<const NonlinearVariationalProblem> problem,
+                         std::shared_ptr<const NonlinearVariationalSolver> solver)
   : _problem(problem), _solver(solver)
 {
   // Do nothing
@@ -189,20 +152,17 @@ NonlinearDiscreteProblem::F(GenericVector& b, const GenericVector& x)
 {
   // Get problem data
   dolfin_assert(_problem);
-  std::shared_ptr<const Form> F(_problem->residual_form());
+  std::shared_ptr<const Form> F = _problem->residual_form();
+  std::shared_ptr<const Form> J = _problem->jacobian_form();
   std::vector<std::shared_ptr<const DirichletBC>> bcs(_problem->bcs());
 
-  // Assemble right-hand side
+  // Create assembler
+  dolfin_assert(J);
   dolfin_assert(F);
-  Assembler assembler;
-  assembler.assemble(b, *F);
+  SystemAssembler assembler(J, F, bcs);
 
-  // Apply boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); i++)
-  {
-    dolfin_assert(bcs[i]);
-    bcs[i]->apply(b, x);
-  }
+  // Assemble right-hand side
+  assembler.assemble(b, x);
 
   // Print vector
   dolfin_assert(_solver);
@@ -217,20 +177,17 @@ NonlinearVariationalSolver::NonlinearDiscreteProblem::J(GenericMatrix& A,
 {
   // Get problem data
   dolfin_assert(_problem);
-  std::shared_ptr<const Form> J(_problem->jacobian_form());
+  std::shared_ptr<const Form> J = _problem->jacobian_form();
+  std::shared_ptr<const Form> F = _problem->residual_form();
   std::vector<std::shared_ptr<const DirichletBC>> bcs(_problem->bcs());
 
-  // Assemble left-hand side
+  // Create assembler
   dolfin_assert(J);
-  Assembler assembler;
-  assembler.assemble(A, *J);
+  dolfin_assert(F);
+  SystemAssembler assembler(J, F, bcs);
 
-  // Apply boundary conditions
-  for (std::size_t i = 0; i < bcs.size(); i++)
-  {
-    dolfin_assert(bcs[i]);
-    bcs[i]->apply(A);
-  }
+  // Assemble left-hand side
+  assembler.assemble(A);
 
   // Print matrix
   dolfin_assert(_solver);
diff --git a/dolfin/fem/NonlinearVariationalSolver.h b/dolfin/fem/NonlinearVariationalSolver.h
index 25a50c2..32c3624 100644
--- a/dolfin/fem/NonlinearVariationalSolver.h
+++ b/dolfin/fem/NonlinearVariationalSolver.h
@@ -28,82 +28,20 @@
 #include <dolfin/nls/NewtonSolver.h>
 #include <dolfin/nls/PETScSNESSolver.h>
 #include "NonlinearVariationalProblem.h"
+#include "SystemAssembler.h"
 
 namespace dolfin
 {
 
-  /// This class implements a solver for nonlinear variational problems.
+  /// This class implements a solver for nonlinear variational
+  /// problems.
 
   class NonlinearVariationalSolver : public Variable
   {
   public:
 
     /// Create nonlinear variational solver for given problem
-    NonlinearVariationalSolver(NonlinearVariationalProblem& problem);
-
-    /// Create nonlinear variational solver for given problem (shared
-    /// pointer version)
-    NonlinearVariationalSolver(std::shared_ptr<NonlinearVariationalProblem> problem);
-
-    /// Solve variational problem with bound constraints defined by
-    /// GenericVectors
-    ///
-    /// *Arguments*
-    ///     lb (_GenericVector_)
-    ///         The linear solver.
-    ///     ub (_GenericVector_)
-    ///         The factory.
-    /// *Returns*
-    ///     std::pair<std::size_t, bool>
-    ///         Pair of number of Newton iterations, and whether
-    ///         iteration converged)
-    std::pair<std::size_t, bool> solve(const GenericVector& lb,
-                                       const GenericVector& ub);
-
-    /// Solve variational problem with bound constraints defined by
-    /// GenericVectors (shared pointer version)
-    ///
-    /// *Arguments*
-    ///     lb (_std::shared_ptr<const GenericVector>_)
-    ///         The linear solver.
-    ///     ub (_std::shared_ptr<const GenericVector>_)
-    ///         The factory.
-    /// *Returns*
-    ///     std::pair<std::size_t, bool>
-    ///         Pair of number of Newton iterations, and whether
-    ///         iteration converged)
-    std::pair<std::size_t, bool>
-      solve(std::shared_ptr<const GenericVector> lb,
-            std::shared_ptr<const GenericVector> ub);
-
-    /// Solve variational problem with bound constraints defined by Functions
-    ///
-    /// *Arguments*
-    ///     lb (_Function_)
-    ///         The linear solver.
-    ///     ub (_Function_)
-    ///         The factory.
-    /// *Returns*
-    ///     std::pair<std::size_t, bool>
-    ///         Pair of number of Newton iterations, and whether
-    ///         iteration converged)
-    std::pair<std::size_t, bool> solve(const Function& lb,
-                                       const Function& ub);
-
-    /// Solve variational problem with bound constraints defined by
-    /// Functions (shared pointer version)
-    ///
-    /// *Arguments*
-    ///     lb (_std::shared_ptr<const Function>_)
-    ///         The linear solver.
-    ///     ub (_std::shared_ptr<const Function>_)
-    ///         The factory.
-    /// *Returns*
-    ///     std::pair<std::size_t, bool>
-    ///         Pair of number of Newton iterations, and whether
-    ///         iteration converged)
-    std::pair<std::size_t, bool> solve(std::shared_ptr<const Function> lb,
-                                       std::shared_ptr<const Function> ub);
+    explicit NonlinearVariationalSolver(std::shared_ptr<NonlinearVariationalProblem> problem);
 
     /// Solve variational problem
     ///
@@ -145,8 +83,8 @@ namespace dolfin
 
       // Constructor
       NonlinearDiscreteProblem(
-        std::shared_ptr<NonlinearVariationalProblem> problem,
-        std::shared_ptr<NonlinearVariationalSolver> solver);
+        std::shared_ptr<const NonlinearVariationalProblem> problem,
+        std::shared_ptr<const NonlinearVariationalSolver> solver);
 
       // Destructor
       ~NonlinearDiscreteProblem();
@@ -160,8 +98,8 @@ namespace dolfin
     private:
 
       // Problem and solver objects
-      std::shared_ptr<NonlinearVariationalProblem> _problem;
-      std::shared_ptr<NonlinearVariationalSolver> _solver;
+      std::shared_ptr<const NonlinearVariationalProblem> _problem;
+      std::shared_ptr<const NonlinearVariationalSolver> _solver;
 
     };
 
diff --git a/dolfin/fem/OpenMpAssembler.cpp b/dolfin/fem/OpenMpAssembler.cpp
index 228a972..105c793 100644
--- a/dolfin/fem/OpenMpAssembler.cpp
+++ b/dolfin/fem/OpenMpAssembler.cpp
@@ -55,7 +55,8 @@ using namespace dolfin;
 void OpenMpAssembler::assemble(GenericTensor& A, const Form& a)
 {
   // Get mesh
-  const Mesh& mesh = a.mesh();
+  dolfin_assert(a.mesh());
+  const Mesh& mesh = *(a.mesh());
 
   if (MPI::size(mesh.mpi_comm()) > 1)
   {
@@ -127,7 +128,8 @@ void OpenMpAssembler::assemble_cells(
   omp_set_num_threads(num_threads);
 
   // Extract mesh
-  const Mesh& mesh = a.mesh();
+  dolfin_assert(a.mesh());
+  const Mesh& mesh = *(a.mesh());
 
   // FIXME: Check that UFC copy constructor is dealing with copying
   // pointers correctly
@@ -188,10 +190,10 @@ void OpenMpAssembler::assemble_cells(
     const int num_cells = colored_cells.size();
 
     ufc::cell ufc_cell;
-    std::vector<double> vertex_coordinates;
+    std::vector<double> coordinate_dofs;
 
     // OpenMP test loop over cells of the same color
-#pragma omp parallel for schedule(guided, 20) firstprivate(ufc, ufc_cell, vertex_coordinates, dofs, integral)
+#pragma omp parallel for schedule(guided, 20) firstprivate(ufc, ufc_cell, coordinate_dofs, dofs, integral)
     for (int cell_index = 0; cell_index < num_cells; ++cell_index)
     {
       // Cell index
@@ -210,8 +212,8 @@ void OpenMpAssembler::assemble_cells(
 
       // Update to current cell
       cell.get_cell_data(ufc_cell);
-      cell.get_vertex_coordinates(vertex_coordinates);
-      ufc.update(cell, vertex_coordinates, ufc_cell,
+      cell.get_coordinate_dofs(coordinate_dofs);
+      ufc.update(cell, coordinate_dofs, ufc_cell,
                  integral->enabled_coefficients());
 
       // Get local-to-global dof maps for cell
@@ -221,7 +223,7 @@ void OpenMpAssembler::assemble_cells(
       // Tabulate cell tensor
       integral->tabulate_tensor(ufc.A.data(),
                                 ufc.w(),
-                                vertex_coordinates.data(),
+                                coordinate_dofs.data(),
                                 ufc_cell.orientation);
 
       // Add entries to global tensor
@@ -258,7 +260,8 @@ void OpenMpAssembler::assemble_cells_and_exterior_facets(
   omp_set_num_threads(num_threads);
 
   // Extract mesh
-  const Mesh& mesh = a.mesh();
+  dolfin_assert(a.mesh());
+  const Mesh& mesh = *(a.mesh());
 
   // Compute facets and facet - cell connectivity if not already computed
   const std::size_t D = mesh.topology().dim();
@@ -322,7 +325,7 @@ void OpenMpAssembler::assemble_cells_and_exterior_facets(
 
   // UFC cell and vertex coordinates
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
 
   // Assemble over cells (loop over colors, then cells of same color)
   const std::size_t num_colors = entities_of_color.size();
@@ -336,7 +339,7 @@ void OpenMpAssembler::assemble_cells_and_exterior_facets(
 
     // OpenMP test loop over cells of the same color
     Progress p(AssemblerBase::progress_message(A.rank(), "cells"), num_colors);
-#pragma omp parallel for schedule(guided, 20) firstprivate(ufc, ufc_cell, vertex_coordinates, dofs, cell_integral, facet_integral)
+#pragma omp parallel for schedule(guided, 20) firstprivate(ufc, ufc_cell, coordinate_dofs, dofs, cell_integral, facet_integral)
     for (int index = 0; index < num_cell_in_color; ++index)
     {
       // Cell index
@@ -351,7 +354,7 @@ void OpenMpAssembler::assemble_cells_and_exterior_facets(
 
       // Update to current cell
       cell.get_cell_data(ufc_cell);
-      cell.get_vertex_coordinates(vertex_coordinates);
+      cell.get_coordinate_dofs(coordinate_dofs);
 
       // Get local-to-global dof maps for cell
       for (std::size_t i = 0; i < form_rank; ++i)
@@ -365,11 +368,11 @@ void OpenMpAssembler::assemble_cells_and_exterior_facets(
       // Tabulate cell tensor if we have a cell_integral
       if (cell_integral)
       {
-        ufc.update(cell, vertex_coordinates, ufc_cell,
+        ufc.update(cell, coordinate_dofs, ufc_cell,
                    cell_integral->enabled_coefficients());
         cell_integral->tabulate_tensor(ufc.A.data(),
                                        ufc.w(),
-                                       vertex_coordinates.data(),
+                                       coordinate_dofs.data(),
                                        ufc_cell.orientation);
       }
       else
@@ -404,13 +407,13 @@ void OpenMpAssembler::assemble_cells_and_exterior_facets(
         //        facet index?
         // Update UFC object
         ufc_cell.local_facet = local_facet;
-        ufc.update(cell, vertex_coordinates, ufc_cell,
+        ufc.update(cell, coordinate_dofs, ufc_cell,
                   facet_integral->enabled_coefficients());
 
         // Tabulate tensor
         facet_integral->tabulate_tensor(ufc.A_facet.data(),
                                         ufc.w(),
-                                        vertex_coordinates.data(),
+                                        coordinate_dofs.data(),
                                         local_facet,
                                         ufc_cell.orientation);
 
@@ -450,7 +453,8 @@ void OpenMpAssembler::assemble_interior_facets(
   warning("OpenMpAssembler::assemble_interior_facets is untested.");
 
   // Extract mesh
-  const Mesh& mesh = a.mesh();
+  dolfin_assert(a.mesh());
+  const Mesh& mesh = *(a.mesh());
 
   // Topological dimension
   const std::size_t D = mesh.topology().dim();
@@ -525,7 +529,7 @@ void OpenMpAssembler::assemble_interior_facets(
 
   // UFC cells and vertex coordinates
   ufc::cell ufc_cell0, ufc_cell1;
-  std::vector<double> vertex_coordinates0, vertex_coordinates1;
+  std::vector<double> coordinate_dofs0, coordinate_dofs1;
 
   // Assemble over interior facets (loop over colours, then cells of same color)
   const std::size_t num_colors = entities_of_color.size();
@@ -540,7 +544,7 @@ void OpenMpAssembler::assemble_interior_facets(
     // OpenMP test loop over cells of the same color
     Progress p(AssemblerBase::progress_message(A.rank(), "interior facets"),
                mesh.num_facets());
-#pragma omp parallel for schedule(guided, 20) firstprivate(ufc, ufc_cell0, ufc_cell1, vertex_coordinates0, vertex_coordinates1, macro_dofs, integral)
+#pragma omp parallel for schedule(guided, 20) firstprivate(ufc, ufc_cell0, ufc_cell1, coordinate_dofs0, coordinate_dofs1, macro_dofs, integral)
     for (int facet_index = 0; facet_index < num_facets; ++facet_index)
     {
       // Facet index
@@ -581,14 +585,14 @@ void OpenMpAssembler::assemble_interior_facets(
       const std::size_t local_facet1 = cell1.index(facet);
 
       // Update UFC cell
-      cell0.get_vertex_coordinates(vertex_coordinates0);
+      cell0.get_coordinate_dofs(coordinate_dofs0);
       cell0.get_cell_data(ufc_cell0, local_facet0);
-      cell1.get_vertex_coordinates(vertex_coordinates1);
+      cell1.get_coordinate_dofs(coordinate_dofs1);
       cell1.get_cell_data(ufc_cell1, local_facet1);
 
       // Update to current pair of cells
-      ufc.update(cell0, vertex_coordinates0, ufc_cell0,
-                 cell1, vertex_coordinates1, ufc_cell1,
+      ufc.update(cell0, coordinate_dofs0, ufc_cell0,
+                 cell1, coordinate_dofs1, ufc_cell1,
                  integral->enabled_coefficients());
 
       // Tabulate dofs for each dimension on macro element
@@ -612,8 +616,8 @@ void OpenMpAssembler::assemble_interior_facets(
       // Tabulate exterior interior facet tensor on macro element
       integral->tabulate_tensor(ufc.macro_A.data(),
                                 ufc.macro_w(),
-                                vertex_coordinates0.data(),
-                                vertex_coordinates1.data(),
+                                coordinate_dofs0.data(),
+                                coordinate_dofs1.data(),
                                 local_facet0,
                                 local_facet1,
                                 ufc_cell0.orientation,
diff --git a/dolfin/fem/OpenMpAssembler.h b/dolfin/fem/OpenMpAssembler.h
index f415c43..6cc5ecc 100644
--- a/dolfin/fem/OpenMpAssembler.h
+++ b/dolfin/fem/OpenMpAssembler.h
@@ -62,20 +62,20 @@ namespace dolfin
 
     // Assemble over cells
     void assemble_cells(GenericTensor& A, const Form& a, UFC& ufc,
-                        std::shared_ptr<const MeshFunction<std::size_t> > domains,
+                        std::shared_ptr<const MeshFunction<std::size_t>> domains,
                         std::vector<double>* values);
 
     // Assemble over exterior facets
     void assemble_cells_and_exterior_facets(GenericTensor& A,
              const Form& a, UFC& ufc,
-             std::shared_ptr<const MeshFunction<std::size_t> > cell_domains,
-             std::shared_ptr<const MeshFunction<std::size_t> > exterior_facet_domains,
+             std::shared_ptr<const MeshFunction<std::size_t>> cell_domains,
+             std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains,
              std::vector<double>* values);
 
     // Assemble over interior facets
     void assemble_interior_facets(GenericTensor& A, const Form& a, UFC& ufc,
-             std::shared_ptr<const MeshFunction<std::size_t> > domains,
-             std::shared_ptr<const MeshFunction<std::size_t> > cell_domains,
+             std::shared_ptr<const MeshFunction<std::size_t>> domains,
+             std::shared_ptr<const MeshFunction<std::size_t>> cell_domains,
              std::vector<double>* values);
 
   };
diff --git a/dolfin/fem/PointSource.cpp b/dolfin/fem/PointSource.cpp
index e3cfe52..867e66c 100644
--- a/dolfin/fem/PointSource.cpp
+++ b/dolfin/fem/PointSource.cpp
@@ -35,15 +35,6 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-PointSource::PointSource(const FunctionSpace& V,
-                         const Point& p,
-                         double magnitude)
-  : _function_space(reference_to_no_delete_pointer(V)), _p(p), _magnitude(magnitude)
-{
-  // Check that function space is scalar
-  check_is_scalar(V);
-}
-//-----------------------------------------------------------------------------
 PointSource::PointSource(std::shared_ptr<const FunctionSpace> V,
                          const Point& p,
                          double magnitude)
@@ -95,14 +86,9 @@ void PointSource::apply(GenericVector& b)
   // Create cell
   const Cell cell(mesh, static_cast<std::size_t>(cell_index));
 
-  // Vertex coordinates
-  const std::size_t gdim = mesh.geometry().dim();
-  const std::size_t num_vertices = cell.num_entities(0);
-  std::vector<double> vertex_coordinates(gdim* num_vertices);
-  const unsigned int* vertices = cell.entities(0);
-  for (std::size_t i = 0; i < num_vertices; i++)
-    for (std::size_t j = 0; j < gdim; j++)
-      vertex_coordinates[i*gdim + j] = mesh.geometry().x(vertices[i])[j];
+  // Cell coordinates
+  std::vector<double> coordinate_dofs;
+  cell.get_coordinate_dofs(coordinate_dofs);
 
   // Evaluate all basis functions at the point()
   dolfin_assert(_function_space->element());
@@ -113,7 +99,7 @@ void PointSource::apply(GenericVector& b)
   cell.get_cell_data(ufc_cell);
   _function_space->element()->evaluate_basis_all(values.data(),
                                                  _p.coordinates(),
-                                                 vertex_coordinates.data(),
+                                                 coordinate_dofs.data(),
                                                  ufc_cell.orientation);
 
   // Scale by magnitude
diff --git a/dolfin/fem/PointSource.h b/dolfin/fem/PointSource.h
index 8db788f..bbee40c 100644
--- a/dolfin/fem/PointSource.h
+++ b/dolfin/fem/PointSource.h
@@ -14,9 +14,9 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-04-13
-// Last changed: 2013-06-23
+
+#ifndef __POINT_SOURCE_H
+#define __POINT_SOURCE_H
 
 #include <memory>
 #include <dolfin/geometry/Point.h>
@@ -39,13 +39,7 @@ namespace dolfin
   public:
 
     /// Create point source at given point of given magnitude
-    PointSource(const FunctionSpace& V,
-                const Point& p,
-                double magnitude=1.0);
-
-    /// Create point source at given point of given magnitude
-    PointSource(std::shared_ptr<const FunctionSpace> V,
-                const Point& p,
+    PointSource(std::shared_ptr<const FunctionSpace> V, const Point& p,
                 double magnitude=1.0);
 
     /// Destructor
@@ -71,3 +65,5 @@ namespace dolfin
   };
 
 }
+
+#endif
diff --git a/dolfin/fem/SparsityPatternBuilder.cpp b/dolfin/fem/SparsityPatternBuilder.cpp
index a0deb52..f1ceba9 100644
--- a/dolfin/fem/SparsityPatternBuilder.cpp
+++ b/dolfin/fem/SparsityPatternBuilder.cpp
@@ -18,27 +18,29 @@
 // Modified by Ola Skavhaug 2007
 // Modified by Anders Logg 2008-2014
 
+#include <algorithm>
+
 #include <dolfin/common/ArrayView.h>
 #include <dolfin/common/MPI.h>
+#include <dolfin/la/SparsityPattern.h>
 #include <dolfin/log/log.h>
 #include <dolfin/log/Progress.h>
-#include <dolfin/la/GenericSparsityPattern.h>
 #include <dolfin/mesh/Cell.h>
 #include <dolfin/mesh/Facet.h>
-#include <dolfin/mesh/Vertex.h>
 #include <dolfin/mesh/Mesh.h>
 #include <dolfin/mesh/MultiMesh.h>
+#include <dolfin/mesh/Vertex.h>
 #include <dolfin/function/FunctionSpace.h>
 #include <dolfin/function/MultiMeshFunctionSpace.h>
-#include "MultiMeshForm.h"
 #include "MultiMeshDofMap.h"
+#include "MultiMeshForm.h"
 #include "SparsityPatternBuilder.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
 void
-SparsityPatternBuilder::build(GenericSparsityPattern& sparsity_pattern,
+SparsityPatternBuilder::build(SparsityPattern& sparsity_pattern,
                               const Mesh& mesh,
                               const std::vector<const GenericDofMap*> dofmaps,
                               bool cells,
@@ -51,30 +53,16 @@ SparsityPatternBuilder::build(GenericSparsityPattern& sparsity_pattern,
 {
   // Get global dimensions and local range
   const std::size_t rank = dofmaps.size();
-  std::vector<std::size_t> global_dimensions(rank);
-  std::vector<std::pair<std::size_t, std::size_t>> local_range(rank);
-  std::vector<ArrayView<const std::size_t>> local_to_global(rank);
-  std::vector<ArrayView<const int>> off_process_owner(rank);
+  std::vector<std::shared_ptr<const IndexMap>> index_maps(rank);
   for (std::size_t i = 0; i < rank; ++i)
   {
-    global_dimensions[i] = dofmaps[i]->global_dimension();
-    local_range[i]       = dofmaps[i]->ownership_range();
-    local_to_global[i].set(dofmaps[i]->local_to_global_unowned());
-    off_process_owner[i].set(dofmaps[i]->off_process_owner());
+    dolfin_assert(dofmaps[i]);
+    index_maps[i] = dofmaps[i]->index_map();
   }
 
-  dolfin_assert(!dofmaps.empty());
-  dolfin_assert(dofmaps[0]);
-  std::vector<std::size_t> block_sizes(rank);
-  for (std::size_t i = 0; i < rank; ++i)
-    block_sizes[i] = dofmaps[i]->block_size;
-
   // Initialise sparsity pattern
   if (init)
-  {
-    sparsity_pattern.init(mesh.mpi_comm(), global_dimensions, local_range,
-                          local_to_global, off_process_owner, block_sizes);
-  }
+    sparsity_pattern.init(mesh.mpi_comm(), index_maps);
 
   // Only build for rank >= 2 (matrices and higher order tensors) that
   // require sparsity details
@@ -87,6 +75,17 @@ SparsityPatternBuilder::build(GenericSparsityPattern& sparsity_pattern,
   // Create vector to point to dofs
   std::vector<ArrayView<const dolfin::la_index>> dofs(rank);
 
+  // Build sparsity pattern for reals (globally supported basis members)
+  // NOTE: It is very important that this is done before other integrals
+  //       so that insertion of global nodes is no-op below
+  // NOTE: We assume that global dofs contribute a whole row which is
+  //       memory suboptimal (for restricted Lagrange multipliers) but very
+  //       fast and certainly much better than quadratic scaling of usual
+  //       insertion below
+  std::vector<std::size_t> global_dofs0;
+  dofmaps[sparsity_pattern.primary_dim()]->tabulate_global_dofs(global_dofs0);
+  sparsity_pattern.insert_full_rows_local(global_dofs0);
+
   // FIXME: We iterate over the entire mesh even if the function space
   // is restricted. This works out fine since the local dofmap
   // returned on each cell will be an empty vector, but we might think
@@ -116,7 +115,6 @@ SparsityPatternBuilder::build(GenericSparsityPattern& sparsity_pattern,
     mesh.init(0, D);
 
     std::vector<std::vector<dolfin::la_index>> global_dofs(rank);
-    //std::vector<const std::vector<dolfin::la_index>* > global_dofs_p(rank);
     std::vector<std::vector<std::size_t>> local_to_local_dofs(rank);
 
     // Resize local dof map vector
@@ -241,20 +239,21 @@ SparsityPatternBuilder::build(GenericSparsityPattern& sparsity_pattern,
 
   if (diagonal)
   {
-    const std::size_t local_size0 = local_range[0].second-local_range[0].first;
-    const std::size_t local_size1 = local_range[1].second-local_range[1].first;
-    const std::size_t local_size = std::min(local_size0, local_size1);
-
-    Progress p("Building sparsity pattern over diagonal", local_size);
-    std::vector<dolfin::la_index> diagonal_dof(1, 0);
-    for (std::size_t i = 0; i < rank; ++i)
-      dofs[i].set(diagonal_dof);
-
-    for (std::size_t j = 0; j < local_size; j++)
+    dolfin_assert(rank == 2);
+    const std::size_t primary_dim = sparsity_pattern.primary_dim();
+    const std::size_t primary_codim = primary_dim == 0 ? 1 : 0;
+    const std::pair<std::size_t, std::size_t> primary_range
+      = index_maps[primary_dim]->local_range();
+    const std::size_t secondary_range
+      = index_maps[primary_codim]->size(IndexMap::MapSize::GLOBAL);
+    const std::size_t diagonal_range
+      = std::min(primary_range.second, secondary_range);
+
+    Progress p("Building sparsity pattern over diagonal",
+               diagonal_range - primary_range.first);
+    for (std::size_t j = primary_range.first; j < diagonal_range; j++)
     {
-      // Insert diagonal non-zeroes in sparsity pattern
-      diagonal_dof[0] = j;
-      sparsity_pattern.insert_local(dofs);
+      sparsity_pattern.insert_global(j, j);
       p++;
     }
   }
@@ -265,28 +264,20 @@ SparsityPatternBuilder::build(GenericSparsityPattern& sparsity_pattern,
 }
 //-----------------------------------------------------------------------------
 void SparsityPatternBuilder::build_multimesh_sparsity_pattern(
-  GenericSparsityPattern& sparsity_pattern,
+  SparsityPattern& sparsity_pattern,
   const MultiMeshForm& form)
 {
   // Get global dimensions and local range
   const std::size_t rank = form.rank();
-  std::vector<std::size_t> global_dimensions(rank);
-  std::vector<std::pair<std::size_t, std::size_t>> local_range(rank);
-  std::vector<ArrayView<const std::size_t>> local_to_global(rank);
-  std::vector<ArrayView<const int>> off_process_owner(rank);
+  std::vector<std::shared_ptr<const IndexMap>> index_maps(rank);
   for (std::size_t i = 0; i < rank; ++i)
   {
-    global_dimensions[i] = form.function_space(i)->dofmap()->global_dimension();
-    local_range[i]       = form.function_space(i)->dofmap()->ownership_range();
-    off_process_owner[i].set(form.function_space(i)->dofmap()->off_process_owner());
+    index_maps[i] = form.function_space(i)->dofmap()->index_map();
   }
 
   // Initialize sparsity pattern
-  const std::vector<std::size_t> block_sizes(rank, 1);
   sparsity_pattern.init(form.function_space(0)->part(0)->mesh()->mpi_comm(),
-                        global_dimensions,
-                        local_range, local_to_global,
-                        off_process_owner, block_sizes);
+                        index_maps);
 
   // Iterate over each part
   for (std::size_t part = 0; part < form.num_parts(); part++)
@@ -322,7 +313,7 @@ void SparsityPatternBuilder::build_multimesh_sparsity_pattern(
 }
 //-----------------------------------------------------------------------------
 void SparsityPatternBuilder::_build_multimesh_sparsity_pattern_interface(
-  GenericSparsityPattern& sparsity_pattern,
+  SparsityPattern& sparsity_pattern,
   const MultiMeshForm& form,
   std::size_t part)
 {
@@ -338,7 +329,7 @@ void SparsityPatternBuilder::_build_multimesh_sparsity_pattern_interface(
 
   // FIXME: We need two different lists here because the interface
   // FIXME: of insert() requires a list of pointers to dofs. Consider
-  // FIXME: improving the interface of GenericSparsityPattern.
+  // FIXME: improving the interface of SparsityPattern.
 
   // Data structure for storing dofs on macro cell (0 + 1)
   std::vector<std::vector<dolfin::la_index>> dofs(form.rank());
diff --git a/dolfin/fem/SparsityPatternBuilder.h b/dolfin/fem/SparsityPatternBuilder.h
index 9a82572..4a1c131 100644
--- a/dolfin/fem/SparsityPatternBuilder.h
+++ b/dolfin/fem/SparsityPatternBuilder.h
@@ -32,9 +32,9 @@ namespace dolfin
 {
 
   class GenericDofMap;
-  class GenericSparsityPattern;
   class Mesh;
   class MultiMeshForm;
+  class SparsityPattern;
 
   /// This class provides functions to compute the sparsity pattern
   /// based on DOF maps
@@ -44,7 +44,7 @@ namespace dolfin
   public:
 
     /// Build sparsity pattern for assembly of given form
-    static void build(GenericSparsityPattern& sparsity_pattern,
+    static void build(SparsityPattern& sparsity_pattern,
                       const Mesh& mesh,
                       const std::vector<const GenericDofMap*> dofmaps,
                       bool cells,
@@ -56,15 +56,15 @@ namespace dolfin
                       bool finalize=true);
 
     /// Build sparsity pattern for assembly of given multimesh form
-    static void build_multimesh_sparsity_pattern
-      (GenericSparsityPattern& sparsity_pattern,
-       const MultiMeshForm& form);
+    static void
+      build_multimesh_sparsity_pattern(SparsityPattern& sparsity_pattern,
+                                       const MultiMeshForm& form);
 
   private:
 
-    /// Build sparsity pattern for interface part of multimesh form
+    // Build sparsity pattern for interface part of multimesh form
     static void _build_multimesh_sparsity_pattern_interface
-      (GenericSparsityPattern& sparsity_pattern,
+      (SparsityPattern& sparsity_pattern,
        const MultiMeshForm& form,
        std::size_t part);
 
diff --git a/dolfin/fem/SystemAssembler.cpp b/dolfin/fem/SystemAssembler.cpp
index d0e9301..931643d 100644
--- a/dolfin/fem/SystemAssembler.cpp
+++ b/dolfin/fem/SystemAssembler.cpp
@@ -20,8 +20,8 @@
 // Modified by Jan Blechta 2013
 // Modified by Martin Alnaes 2013-2015
 
-#include <array>
 #include <algorithm>
+#include <array>
 #include <Eigen/Dense>
 
 #include <dolfin/common/ArrayView.h>
@@ -49,58 +49,9 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-SystemAssembler::SystemAssembler(const Form& a, const Form& L)
-  : _a(reference_to_no_delete_pointer(a)),
-    _l(reference_to_no_delete_pointer(L))
-{
-  // Check arity of forms
-  check_arity(_a, _l);
-}
-//-----------------------------------------------------------------------------
-SystemAssembler::SystemAssembler(const Form& a, const Form& L,
-                                 const DirichletBC& bc)
-  : _a(reference_to_no_delete_pointer(a)),
-    _l(reference_to_no_delete_pointer(L))
-{
-  // Check arity of forms
-  check_arity(_a, _l);
-
-  // Store Dirichlet boundary condition
-  _bcs.push_back(&bc);
-}
-//-----------------------------------------------------------------------------
-SystemAssembler::SystemAssembler(const Form& a, const Form& L,
-                                 const std::vector<const DirichletBC*> bcs)
-  : _a(reference_to_no_delete_pointer(a)),
-    _l(reference_to_no_delete_pointer(L)), _bcs(bcs)
-{
-  // Check arity of forms
-  check_arity(_a, _l);
-}
-//-----------------------------------------------------------------------------
-SystemAssembler::SystemAssembler(std::shared_ptr<const Form> a,
-                                 std::shared_ptr<const Form> L)
-  : _a(a), _l(L)
-{
-  // Check arity of forms
-  check_arity(_a, _l);
-}
-//-----------------------------------------------------------------------------
-SystemAssembler::SystemAssembler(std::shared_ptr<const Form> a,
-                                 std::shared_ptr<const Form> L,
-                                 const DirichletBC& bc)
-  : _a(a), _l(L)
-{
-  // Check arity of forms
-  check_arity(_a, _l);
-
-  // Store Dirichlet boundary condition
-  _bcs.push_back(&bc);
-}
-//-----------------------------------------------------------------------------
 SystemAssembler::SystemAssembler(std::shared_ptr<const Form> a,
                                  std::shared_ptr<const Form> L,
-                                 const std::vector<const DirichletBC*> bcs)
+                                 std::vector<std::shared_ptr<const DirichletBC>> bcs)
   : _a(a), _l(L), _bcs(bcs)
 {
   // Check arity of forms
@@ -147,7 +98,7 @@ void SystemAssembler::check_arity(std::shared_ptr<const Form> a,
     }
   }
 
-  // Check that a is a bilinear form
+  // Check that L is a linear form
   if (L)
   {
     if (L->rank() != 1)
@@ -173,6 +124,28 @@ in SystemAssembler. Taking %s subdomains from bilinear form",
   return a ? a: b;
 }
 //-----------------------------------------------------------------------------
+bool SystemAssembler::check_functionspace_for_bc
+    (std::shared_ptr<const FunctionSpace> fs, std::size_t bc_index)
+{
+  std::shared_ptr<const FunctionSpace> bc_function_space
+    = _bcs[bc_index]->function_space();
+
+  if (*bc_function_space == *fs)
+    return true;
+  else
+  {
+    // Recursively check sub-spaces
+    std::size_t num_sub_elements = fs->element()->num_sub_elements();
+    for (std::size_t i = 0; i != num_sub_elements; ++i)
+      {
+        std::shared_ptr<const FunctionSpace> subspace = (*fs)[i];
+        if (check_functionspace_for_bc(subspace, bc_index))
+          return true;
+      }
+  }
+  return false;
+}
+//-----------------------------------------------------------------------------
 void SystemAssembler::assemble(GenericMatrix* A, GenericVector* b,
                                const GenericVector* x0)
 {
@@ -183,7 +156,8 @@ void SystemAssembler::assemble(GenericMatrix* A, GenericVector* b,
   Timer timer("Assemble system");
 
   // Get mesh
-  const Mesh& mesh = _a->mesh();
+  dolfin_assert(_a->mesh());
+  const Mesh& mesh = *(_a->mesh());
   dolfin_assert(mesh.ordered());
 
   // Get cell domains
@@ -212,7 +186,7 @@ void SystemAssembler::assemble(GenericMatrix* A, GenericVector* b,
   dolfin_assert(_l->rank() == 1);
 
   // Check that forms share a function space
-  if (*_a->function_space(1) != *_l->function_space(0))
+  if (*_a->function_space(0) != *_l->function_space(0))
   {
     dolfin_error("SystemAssembler.cpp",
                  "assemble system",
@@ -246,40 +220,59 @@ void SystemAssembler::assemble(GenericMatrix* A, GenericVector* b,
   Scratch data(*_a, *_l);
 
   // Get Dirichlet dofs and values for local mesh
-  DirichletBC::Map boundary_values;
+  // Determine whether _a is bilinear in the same form
+  std::size_t num_fs
+    = (*_a->function_space(0) == *_a->function_space(1)) ? 1 : 2;
+
+  // Bin boundary conditions according to which form they apply to (if any)
+  std::vector<DirichletBC::Map> boundary_values(num_fs);
   for (std::size_t i = 0; i < _bcs.size(); ++i)
   {
-    _bcs[i]->get_boundary_values(boundary_values);
-    if (MPI::size(mesh.mpi_comm()) > 1 && _bcs[i]->method() != "pointwise")
-      _bcs[i]->gather(boundary_values);
+    // Match the FunctionSpace of the BC
+    // with the (possible sub-)FunctionSpace on each axis of _a.
+    int axis = -1;
+
+    if (check_functionspace_for_bc(_a->function_space(0), i))
+      axis = 0;
+    else if (check_functionspace_for_bc(_a->function_space(1), i))
+      axis = 1;
+
+    // Found!
+    if (axis != -1)
+    {
+      _bcs[i]->get_boundary_values(boundary_values[axis]);
+      if (MPI::size(mesh.mpi_comm()) > 1 && _bcs[i]->method() != "pointwise")
+        _bcs[i]->gather(boundary_values[axis]);
+    }
+
   }
 
   // Modify boundary values for incremental (typically nonlinear)
   // problems
+  // FIXME: not sure what happens when num_fs==2
   if (x0)
   {
     dolfin_assert(x0->size()
                   == _a->function_space(1)->dofmap()->global_dimension());
 
-    const std::size_t num_bc_dofs = boundary_values.size();
+    const std::size_t num_bc_dofs = boundary_values[0].size();
     std::vector<dolfin::la_index> bc_indices;
     std::vector<double> bc_values;
     bc_indices.reserve(num_bc_dofs);
     bc_values.reserve(num_bc_dofs);
 
     // Build list of boundary dofs and values
-    DirichletBC::Map::const_iterator bv;
-    for (bv = boundary_values.begin(); bv != boundary_values.end(); ++bv)
+    for (const auto &bv : boundary_values[0])
     {
-      bc_indices.push_back(bv->first);
-      bc_values.push_back(bv->second);
+      bc_indices.push_back(bv.first);
+      bc_values.push_back(bv.second);
     }
 
     // Modify bc values
     std::vector<double> x0_values(num_bc_dofs);
     x0->get_local(x0_values.data(), num_bc_dofs, bc_indices.data());
     for (std::size_t i = 0; i < num_bc_dofs; i++)
-      boundary_values[bc_indices[i]] = x0_values[i] - bc_values[i];
+      boundary_values[0][bc_indices[i]] = x0_values[i] - bc_values[i];
   }
 
   // Check whether we should do cell-wise or facet-wise assembly
@@ -312,12 +305,13 @@ void SystemAssembler::cell_wise_assembly(
   std::array<GenericTensor*, 2>& tensors,
   std::array<UFC*, 2>& ufc,
   Scratch& data,
-  const DirichletBC::Map& boundary_values,
+  const std::vector<DirichletBC::Map>& boundary_values,
   std::shared_ptr<const MeshFunction<std::size_t>> cell_domains,
   std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains)
 {
   // Extract mesh
-  const Mesh& mesh = ufc[0]->dolfin_form.mesh();
+  dolfin_assert(ufc[0]->dolfin_form.mesh());
+  const Mesh& mesh = *(ufc[0]->dolfin_form.mesh());
 
   // Initialize entities if using external facet integrals
   dolfin_assert(mesh.ordered());
@@ -358,7 +352,7 @@ void SystemAssembler::cell_wise_assembly(
 
   // Iterate over all cells
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   Progress p("Assembling system (cell-wise)", mesh.num_cells());
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
@@ -366,7 +360,7 @@ void SystemAssembler::cell_wise_assembly(
     dolfin_assert(!cell->is_ghost());
 
     // Get cell vertex coordinates
-    cell->get_vertex_coordinates(vertex_coordinates);
+    cell->get_coordinate_dofs(coordinate_dofs);
 
     // Get UFC cell data
     cell->get_cell_data(ufc_cell);
@@ -406,13 +400,13 @@ void SystemAssembler::cell_wise_assembly(
       if (tensor_required)
       {
         // Update to current cell
-        ufc[form]->update(*cell, vertex_coordinates, ufc_cell,
+        ufc[form]->update(*cell, coordinate_dofs, ufc_cell,
                           cell_integrals[form]->enabled_coefficients());
 
         // Tabulate cell tensor
         cell_integrals[form]->tabulate_tensor(ufc[form]->A.data(),
                                               ufc[form]->w(),
-                                              vertex_coordinates.data(),
+                                              coordinate_dofs.data(),
                                               ufc_cell.orientation);
         for (std::size_t i = 0; i < data.Ae[form].size(); ++i)
           data.Ae[form][i] += ufc[form]->A[i];
@@ -460,13 +454,13 @@ void SystemAssembler::cell_wise_assembly(
           {
             // Update to current cell
             cell->get_cell_data(ufc_cell);
-            ufc[form]->update(*cell, vertex_coordinates, ufc_cell,
+            ufc[form]->update(*cell, coordinate_dofs, ufc_cell,
                               exterior_facet_integrals[form]->enabled_coefficients());
 
             // Tabulate exterior facet tensor
             exterior_facet_integrals[form]->tabulate_tensor(ufc[form]->A.data(),
                                                             ufc[form]->w(),
-                                                            vertex_coordinates.data(),
+                                                            coordinate_dofs.data(),
                                                             local_facet,
                                                             ufc_cell.orientation);
             for (std::size_t i = 0; i < data.Ae[form].size(); i++)
@@ -476,9 +470,6 @@ void SystemAssembler::cell_wise_assembly(
       }
     }
 
-    // Check dofmap is the same for LHS columns and RHS vector
-    dolfin_assert(cell_dofs[1][0].data() == cell_dofs[0][1].data());
-
     // Modify local matrix/element for Dirichlet boundary conditions
     apply_bc(data.Ae[0].data(), data.Ae[1].data(), boundary_values,
              cell_dofs[0][0], cell_dofs[0][1]);
@@ -498,13 +489,14 @@ void SystemAssembler::facet_wise_assembly(
   std::array<GenericTensor*, 2>& tensors,
   std::array<UFC*, 2>& ufc,
   Scratch& data,
-  const DirichletBC::Map& boundary_values,
+  const std::vector<DirichletBC::Map>& boundary_values,
   std::shared_ptr<const MeshFunction<std::size_t>> cell_domains,
   std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains,
   std::shared_ptr<const MeshFunction<std::size_t>> interior_facet_domains)
 {
   // Extract mesh
-  const Mesh& mesh = ufc[0]->dolfin_form.mesh();
+  dolfin_assert(ufc[0]->dolfin_form.mesh());
+  const Mesh& mesh = *(ufc[0]->dolfin_form.mesh());
 
   // Compute facets and facet - cell connectivity if not already
   // computed
@@ -568,7 +560,7 @@ void SystemAssembler::facet_wise_assembly(
 
   // Iterate over facets
   std::array<ufc::cell, 2> ufc_cell;
-  std::array<std::vector<double>, 2> vertex_coordinates;
+  std::array<std::vector<double>, 2> coordinate_dofs;
   Progress p("Assembling system (facet-wise)", mesh.num_facets());
   for (FacetIterator facet(mesh); !facet.end(); ++facet)
   {
@@ -600,7 +592,7 @@ void SystemAssembler::facet_wise_assembly(
         cell[c] = Cell(mesh, cell_indices[c]);
         cell_index[c] = cell[c].index();
         local_facet[c] = cell[c].index(*facet);
-        cell[c].get_vertex_coordinates(vertex_coordinates[c]);
+        cell[c].get_coordinate_dofs(coordinate_dofs[c]);
         cell[c].get_cell_data(ufc_cell[c], local_facet[c]);
 
         compute_cell_tensor[c] = !cell_tensor_computed[cell_index[c]];
@@ -721,7 +713,7 @@ void SystemAssembler::facet_wise_assembly(
         vector_size = cell_dofs[1][c][0].size();
       }
       compute_interior_facet_tensor(ufc, ufc_cell,
-                                    vertex_coordinates,
+                                    coordinate_dofs,
                                     tensor_required_cell,
                                     tensor_required_facet,
                                     cell, local_facet,
@@ -834,7 +826,7 @@ void SystemAssembler::facet_wise_assembly(
 
       // Compute cell/facet tensors
       compute_exterior_facet_tensor(data.Ae, ufc, ufc_cell[0],
-                                    vertex_coordinates[0],
+                                    coordinate_dofs[0],
                                     tensor_required_cell,
                                     tensor_required_facet,
                                     cell, *facet,
@@ -864,7 +856,7 @@ void SystemAssembler:: compute_exterior_facet_tensor(
   std::array<std::vector<double>, 2>& Ae,
   std::array<UFC*, 2>& ufc,
   ufc::cell& ufc_cell,
-  std::vector<double>& vertex_coordinates,
+  std::vector<double>& coordinate_dofs,
   const std::array<bool, 2>& tensor_required_cell,
   const std::array<bool, 2>& tensor_required_facet,
   const Cell& cell,
@@ -877,7 +869,7 @@ void SystemAssembler:: compute_exterior_facet_tensor(
   const std::size_t local_facet = cell.index(facet);
 
   // Get cell data
-  cell.get_vertex_coordinates(vertex_coordinates);
+  cell.get_coordinate_dofs(coordinate_dofs);
   cell.get_cell_data(ufc_cell, local_facet);
 
   // Loop over lhs and then rhs facet contributions
@@ -891,11 +883,11 @@ void SystemAssembler:: compute_exterior_facet_tensor(
     if (tensor_required_facet[form])
     {
       // Update UFC object
-      ufc[form]->update(cell, vertex_coordinates, ufc_cell,
+      ufc[form]->update(cell, coordinate_dofs, ufc_cell,
                         exterior_facet_integrals[form]->enabled_coefficients());
       exterior_facet_integrals[form]->tabulate_tensor(ufc[form]->A.data(),
                                                       ufc[form]->w(),
-                                                      vertex_coordinates.data(),
+                                                      coordinate_dofs.data(),
                                                       local_facet,
                                                       ufc_cell.orientation);
       for (std::size_t i = 0; i < Ae[form].size(); i++)
@@ -910,11 +902,11 @@ void SystemAssembler:: compute_exterior_facet_tensor(
       // Compute cell integral, if required
       if (tensor_required_cell[form])
       {
-        ufc[form]->update(cell, vertex_coordinates, ufc_cell,
+        ufc[form]->update(cell, coordinate_dofs, ufc_cell,
                           cell_integrals[form]->enabled_coefficients());
         cell_integrals[form]->tabulate_tensor(ufc[form]->A.data(),
                                               ufc[form]->w(),
-                                              vertex_coordinates.data(),
+                                              coordinate_dofs.data(),
                                               ufc_cell.orientation);
         for (std::size_t i = 0; i < Ae[form].size(); i++)
           Ae[form][i] += ufc[form]->A[i];
@@ -926,7 +918,7 @@ void SystemAssembler:: compute_exterior_facet_tensor(
 void SystemAssembler::compute_interior_facet_tensor(
   std::array<UFC*, 2>& ufc,
   std::array<ufc::cell, 2>& ufc_cell,
-  std::array<std::vector<double>, 2>& vertex_coordinates,
+  std::array<std::vector<double>, 2>& coordinate_dofs,
   const std::array<bool, 2>& tensor_required_cell,
   const std::array<bool, 2>& tensor_required_facet,
   const std::array<Cell, 2>& cell,
@@ -946,14 +938,14 @@ void SystemAssembler::compute_interior_facet_tensor(
     if (tensor_required_facet[form] && facet_owner)
     {
       // Update to current pair of cells
-      ufc[form]->update(cell[0], vertex_coordinates[0], ufc_cell[0],
-                        cell[1], vertex_coordinates[1], ufc_cell[1],
+      ufc[form]->update(cell[0], coordinate_dofs[0], ufc_cell[0],
+                        cell[1], coordinate_dofs[1], ufc_cell[1],
                         interior_facet_integrals[form]->enabled_coefficients());
       // Integrate over facet
       interior_facet_integrals[form]->tabulate_tensor(ufc[form]->macro_A.data(),
                                                       ufc[form]->macro_w(),
-                                                      vertex_coordinates[0].data(),
-                                                      vertex_coordinates[1].data(),
+                                                      coordinate_dofs[0].data(),
+                                                      coordinate_dofs[1].data(),
                                                       local_facet[0],
                                                       local_facet[1],
                                                       ufc_cell[0].orientation,
@@ -968,11 +960,11 @@ void SystemAssembler::compute_interior_facet_tensor(
         // Compute cell tensor, if required
         if (tensor_required_cell[form] and !cell[c].is_ghost())
         {
-          ufc[form]->update(cell[c], vertex_coordinates[c], ufc_cell[c],
+          ufc[form]->update(cell[c], coordinate_dofs[c], ufc_cell[c],
                             cell_integrals[form]->enabled_coefficients());
           cell_integrals[form]->tabulate_tensor(ufc[form]->A.data(),
                                                 ufc[form]->w(),
-                                                vertex_coordinates[c].data(),
+                                                coordinate_dofs[c].data(),
                                                 ufc_cell[c].orientation);
 
           // FIXME: Can the below two blocks be consolidated?
@@ -1027,42 +1019,69 @@ void SystemAssembler::matrix_block_add(
 //-----------------------------------------------------------------------------
 void
 SystemAssembler::apply_bc(double* A, double* b,
-                          const DirichletBC::Map& boundary_values,
+                          const std::vector<DirichletBC::Map>& boundary_values,
                           const ArrayView<const dolfin::la_index>& global_dofs0,
                           const ArrayView<const dolfin::la_index>& global_dofs1)
 {
   dolfin_assert(A);
   dolfin_assert(b);
-  dolfin_assert(global_dofs0.size() == global_dofs1.size());
 
   // Wrap matrix and vector using Eigen
   Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
                            Eigen::RowMajor>>
     _matA(A, global_dofs0.size(), global_dofs1.size());
-  Eigen::Map<Eigen::VectorXd> _b(b, global_dofs1.size());
+  Eigen::Map<Eigen::VectorXd> _b(b, global_dofs0.size());
 
-  // Loop over rows
-  //for (std::size_t i = 0; i < _matA.n_rows; ++i)
-  for (int i = 0; i < _matA.cols(); ++i)
+  if (boundary_values.size() == 1)
   {
-    const std::size_t ii = global_dofs1[i];
-    DirichletBC::Map::const_iterator bc_value = boundary_values.find(ii);
-    if (bc_value != boundary_values.end())
+    // Square matrix with same FunctionSpace on each axis
+    // Loop over columns/rows
+    for (int i = 0; i < _matA.cols(); ++i)
     {
-      // Zero row
-      _matA.row(i).setZero();
+      const std::size_t ii = global_dofs1[i];
+      DirichletBC::Map::const_iterator bc_value = boundary_values[0].find(ii);
+      if (bc_value != boundary_values[0].end())
+      {
+        // Zero row
+        _matA.row(i).setZero();
 
-      // Modify RHS (subtract (bc_column(A))*bc_val from b)
-      _b -= _matA.col(i)*bc_value->second;
+        // Modify RHS (subtract (bc_column(A))*bc_val from b)
+        _b -= _matA.col(i)*bc_value->second;
 
-      // Zero column
-      _matA.col(i).setZero();
+        // Zero column
+        _matA.col(i).setZero();
+
+        // Place 1 on diagonal and bc on RHS (i th row ).
+        _b(i)       = bc_value->second;
+        _matA(i, i) = 1.0;
+      }
+    }
+  }
+  else
+  {
+    // Loop over rows first
+    for (int i = 0; i < _matA.rows(); ++i)
+    {
+      const std::size_t ii = global_dofs0[i];
+      DirichletBC::Map::const_iterator bc_value = boundary_values[0].find(ii);
+      if (bc_value != boundary_values[0].end())
+        _matA.row(i).setZero();
+    }
 
-      // Place 1 on diagonal and bc on RHS (i th row ).
-      _b(i)    = bc_value->second;
-      _matA(i, i) = 1.0;
+    // Loop over columns
+    for (int j = 0; j < _matA.cols(); ++j)
+    {
+      const std::size_t jj = global_dofs1[j];
+      DirichletBC::Map::const_iterator bc_value = boundary_values[1].find(jj);
+      if (bc_value != boundary_values[1].end())
+      {
+        // Modify RHS (subtract (bc_column(A))*bc_val from b)
+        _b -= _matA.col(j)*bc_value->second;
+        _matA.col(j).setZero();
+      }
     }
   }
+
 }
 //-----------------------------------------------------------------------------
 bool SystemAssembler::has_bc(const DirichletBC::Map& boundary_values,
@@ -1082,12 +1101,12 @@ bool SystemAssembler::has_bc(const DirichletBC::Map& boundary_values,
 bool SystemAssembler::cell_matrix_required(
   const GenericTensor* A,
   const void* integral,
-  const DirichletBC::Map& boundary_values,
+  const std::vector<DirichletBC::Map>& boundary_values,
   const ArrayView<const dolfin::la_index>& dofs)
 {
   if (A && integral)
     return true;
-  else if (integral && has_bc(boundary_values, dofs))
+  else if (integral && has_bc(boundary_values[0], dofs))
     return true;
   else
     return false;
diff --git a/dolfin/fem/SystemAssembler.h b/dolfin/fem/SystemAssembler.h
index 53db5b4..0f27c80 100644
--- a/dolfin/fem/SystemAssembler.h
+++ b/dolfin/fem/SystemAssembler.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2013 Kent-Andre Mardal and Garth N. Wells
+// Copyright (C) 2008-2015 Kent-Andre Mardal and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -16,9 +16,6 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // Modified by Anders Logg 2008-2011
-//
-// First added:  2009-06-22
-// Last changed: 2013-04-23
 
 #ifndef __SYSTEM_ASSEMBLER_H
 #define __SYSTEM_ASSEMBLER_H
@@ -53,8 +50,8 @@ namespace dolfin
   template<typename T> class MeshFunction;
   class UFC;
 
-  /// This class provides an assembler for systems of the form
-  /// Ax = b. It differs from the default DOLFIN assembler in that it
+  /// This class provides an assembler for systems of the form Ax =
+  /// b. It differs from the default DOLFIN assembler in that it
   /// applies boundary conditions at the time of assembly, which
   /// preserves any symmetries in A.
 
@@ -63,28 +60,9 @@ namespace dolfin
   public:
 
     /// Constructor
-    SystemAssembler(const Form& a, const Form& L);
-
-    /// Constructor
-    SystemAssembler(const Form& a, const Form& L, const DirichletBC& bc);
-
-    /// Constructor
-    SystemAssembler(const Form& a, const Form& L,
-                    const std::vector<const DirichletBC*> bcs);
-
-    /// Constructor
-    SystemAssembler(std::shared_ptr<const Form> a,
-                    std::shared_ptr<const Form> L);
-
-    /// Constructor
     SystemAssembler(std::shared_ptr<const Form> a,
                     std::shared_ptr<const Form> L,
-                    const DirichletBC& bc);
-
-    /// Constructor
-    SystemAssembler(std::shared_ptr<const Form> a,
-                    std::shared_ptr<const Form> L,
-                    const std::vector<const DirichletBC*> bcs);
+                    std::vector<std::shared_ptr<const DirichletBC>> bcs);
 
     /// Assemble system (A, b)
     void assemble(GenericMatrix& A, GenericVector& b);
@@ -120,6 +98,10 @@ namespace dolfin
     static void check_arity(std::shared_ptr<const Form> a,
                             std::shared_ptr<const Form> L);
 
+    // Check if _bcs[bc_index] is part of FunctionSpace fs
+    bool check_functionspace_for_bc
+      (std::shared_ptr<const FunctionSpace> fs, std::size_t bc_index);
+
     // Assemble system
     void assemble(GenericMatrix* A, GenericVector* b,
                   const GenericVector* x0);
@@ -128,13 +110,13 @@ namespace dolfin
     std::shared_ptr<const Form> _a, _l;
 
     // Boundary conditions
-    std::vector<const DirichletBC*> _bcs;
+    std::vector<std::shared_ptr<const DirichletBC>> _bcs;
 
     static void cell_wise_assembly(
       std::array<GenericTensor*, 2>& tensors,
       std::array<UFC*, 2>& ufc,
       Scratch& data,
-      const DirichletBC::Map& boundary_values,
+      const std::vector<DirichletBC::Map>& boundary_values,
       std::shared_ptr<const MeshFunction<std::size_t>> cell_domains,
       std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains);
 
@@ -142,7 +124,7 @@ namespace dolfin
       std::array<GenericTensor*, 2>& tensors,
       std::array<UFC*, 2>& ufc,
       Scratch& data,
-      const DirichletBC::Map& boundary_values,
+      const std::vector<DirichletBC::Map>& boundary_values,
       std::shared_ptr<const MeshFunction<std::size_t>> cell_domains,
       std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains,
       std::shared_ptr<const MeshFunction<std::size_t>> interior_facet_domains);
@@ -153,7 +135,7 @@ namespace dolfin
       std::array<std::vector<double>, 2>& Ae,
       std::array<UFC*, 2>& ufc,
       ufc::cell& ufc_cell,
-      std::vector<double>& vertex_coordinates,
+      std::vector<double>& coordinate_dofs,
       const std::array<bool, 2>& tensor_required_cell,
       const std::array<bool, 2>& tensor_required_facet,
       const Cell& cell,
@@ -167,7 +149,7 @@ namespace dolfin
     static void compute_interior_facet_tensor(
       std::array<UFC*, 2>& ufc,
       std::array<ufc::cell, 2>& ufc_cell,
-      std::array<std::vector<double>, 2>& vertex_coordinates,
+      std::array<std::vector<double>, 2>& coordinate_dofs,
       const std::array<bool, 2>& tensor_required_cell,
       const std::array<bool, 2>& tensor_required_facet,
       const std::array<Cell, 2>& cell,
@@ -189,7 +171,7 @@ namespace dolfin
       const std::array<std::vector<ArrayView<const la_index>>, 2>& cell_dofs);
 
     static void apply_bc(double* A, double* b,
-                         const DirichletBC::Map& boundary_values,
+                         const std::vector<DirichletBC::Map>& boundary_values,
                          const ArrayView<const dolfin::la_index>& global_dofs0,
                          const ArrayView<const dolfin::la_index>& global_dofs1);
 
@@ -202,7 +184,7 @@ namespace dolfin
     static bool
       cell_matrix_required(const GenericTensor* A,
                            const void* integral,
-                           const DirichletBC::Map& boundary_values,
+                           const std::vector<DirichletBC::Map>& boundary_values,
                            const ArrayView<const dolfin::la_index>& dofs);
 
   };
diff --git a/dolfin/fem/UFC.cpp b/dolfin/fem/UFC.cpp
index f35e712..fe2b775 100644
--- a/dolfin/fem/UFC.cpp
+++ b/dolfin/fem/UFC.cpp
@@ -92,6 +92,24 @@ void UFC::init(const Form& a)
   for (std::size_t i = 0; i < this->form.max_custom_subdomain_id(); i++)
     custom_integrals.push_back(std::shared_ptr<ufc::custom_integral>(this->form.create_custom_integral(i)));
 
+  // Create cutcell integrals
+  default_cutcell_integral
+    = std::shared_ptr<ufc::cutcell_integral>(this->form.create_default_cutcell_integral());
+  for (std::size_t i = 0; i < this->form.max_cutcell_subdomain_id(); i++)
+    cutcell_integrals.push_back(std::shared_ptr<ufc::cutcell_integral>(this->form.create_cutcell_integral(i)));
+
+  // Create interface integrals
+  default_interface_integral
+    = std::shared_ptr<ufc::interface_integral>(this->form.create_default_interface_integral());
+  for (std::size_t i = 0; i < this->form.max_interface_subdomain_id(); i++)
+    interface_integrals.push_back(std::shared_ptr<ufc::interface_integral>(this->form.create_interface_integral(i)));
+
+  // Create overlap integrals
+  default_overlap_integral
+    = std::shared_ptr<ufc::overlap_integral>(this->form.create_default_overlap_integral());
+  for (std::size_t i = 0; i < this->form.max_overlap_subdomain_id(); i++)
+    overlap_integrals.push_back(std::shared_ptr<ufc::overlap_integral>(this->form.create_overlap_integral(i)));
+
   // Get maximum local dimensions
   std::vector<std::size_t> max_element_dofs;
   std::vector<std::size_t> max_macro_element_dofs;
@@ -135,7 +153,7 @@ void UFC::init(const Form& a)
   }
 }
 //-----------------------------------------------------------------------------
-void UFC::update(const Cell& c, const std::vector<double>& vertex_coordinates,
+void UFC::update(const Cell& c, const std::vector<double>& coordinate_dofs,
                  const ufc::cell& ufc_cell,
                  const std::vector<bool> & enabled_coefficients)
 {
@@ -146,13 +164,13 @@ void UFC::update(const Cell& c, const std::vector<double>& vertex_coordinates,
       continue;
     dolfin_assert(coefficients[i]);
     coefficients[i]->restrict(_w[i].data(), coefficient_elements[i], c,
-                              vertex_coordinates.data(), ufc_cell);
+                              coordinate_dofs.data(), ufc_cell);
   }
 }
 //-----------------------------------------------------------------------------
-void UFC::update(const Cell& c0, const std::vector<double>& vertex_coordinates0,
+void UFC::update(const Cell& c0, const std::vector<double>& coordinate_dofs0,
                  const ufc::cell& ufc_cell0,
-                 const Cell& c1, const std::vector<double>& vertex_coordinates1,
+                 const Cell& c1, const std::vector<double>& coordinate_dofs1,
                  const ufc::cell& ufc_cell1,
                  const std::vector<bool> & enabled_coefficients)
 {
@@ -164,14 +182,14 @@ void UFC::update(const Cell& c0, const std::vector<double>& vertex_coordinates0,
     dolfin_assert(coefficients[i]);
     const std::size_t offset = coefficient_elements[i].space_dimension();
     coefficients[i]->restrict(_macro_w[i].data(), coefficient_elements[i],
-                              c0, vertex_coordinates0.data(), ufc_cell0);
+                              c0, coordinate_dofs0.data(), ufc_cell0);
     coefficients[i]->restrict(_macro_w[i].data() + offset,
                               coefficient_elements[i],
-                              c1, vertex_coordinates1.data(), ufc_cell1);
+                              c1, coordinate_dofs1.data(), ufc_cell1);
   }
 }
 //-----------------------------------------------------------------------------
-void UFC::update(const Cell& c, const std::vector<double>& vertex_coordinates,
+void UFC::update(const Cell& c, const std::vector<double>& coordinate_dofs,
                  const ufc::cell& ufc_cell)
 {
   // Restrict coefficients to facet
@@ -179,13 +197,13 @@ void UFC::update(const Cell& c, const std::vector<double>& vertex_coordinates,
   {
     dolfin_assert(coefficients[i]);
     coefficients[i]->restrict(_w[i].data(), coefficient_elements[i], c,
-                              vertex_coordinates.data(), ufc_cell);
+                              coordinate_dofs.data(), ufc_cell);
   }
 }
 //-----------------------------------------------------------------------------
-void UFC::update(const Cell& c0, const std::vector<double>& vertex_coordinates0,
+void UFC::update(const Cell& c0, const std::vector<double>& coordinate_dofs0,
                  const ufc::cell& ufc_cell0,
-                 const Cell& c1, const std::vector<double>& vertex_coordinates1,
+                 const Cell& c1, const std::vector<double>& coordinate_dofs1,
                  const ufc::cell& ufc_cell1)
 {
   // Restrict coefficients to facet
@@ -194,10 +212,10 @@ void UFC::update(const Cell& c0, const std::vector<double>& vertex_coordinates0,
     dolfin_assert(coefficients[i]);
     const std::size_t offset = coefficient_elements[i].space_dimension();
     coefficients[i]->restrict(_macro_w[i].data(), coefficient_elements[i],
-                              c0, vertex_coordinates0.data(), ufc_cell0);
+                              c0, coordinate_dofs0.data(), ufc_cell0);
     coefficients[i]->restrict(_macro_w[i].data() + offset,
                               coefficient_elements[i],
-                              c1, vertex_coordinates1.data(), ufc_cell1);
+                              c1, coordinate_dofs1.data(), ufc_cell1);
   }
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/fem/UFC.h b/dolfin/fem/UFC.h
index 66f6724..2ee90a5 100644
--- a/dolfin/fem/UFC.h
+++ b/dolfin/fem/UFC.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014 Anders Logg
+// Copyright (C) 2007-2015 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -18,7 +18,7 @@
 // Modified by Garth N. Wells 2009
 //
 // First added:  2007-01-17
-// Last changed: 2014-04-24
+// Last changed: 2015-10-23
 
 #ifndef __UFC_DATA_H
 #define __UFC_DATA_H
@@ -61,16 +61,16 @@ namespace dolfin
 
     /// Update current cell
     void update(const Cell& cell,
-                const std::vector<double>& vertex_coordinates0,
+                const std::vector<double>& coordinate_dofs0,
                 const ufc::cell& ufc_cell,
                 const std::vector<bool> & enabled_coefficients);
 
     /// Update current pair of cells for macro element
     void update(const Cell& cell0,
-                const std::vector<double>& vertex_coordinates0,
+                const std::vector<double>& coordinate_dofs0,
                 const ufc::cell& ufc_cell0,
                 const Cell& cell1,
-                const std::vector<double>& vertex_coordinates1,
+                const std::vector<double>& coordinate_dofs1,
                 const ufc::cell& ufc_cell1,
                 const std::vector<bool> & enabled_coefficients);
 
@@ -78,17 +78,17 @@ namespace dolfin
     /// PointIntegralSolver supports the version with
     /// enabled_coefficients)
     void update(const Cell& cell,
-                const std::vector<double>& vertex_coordinates0,
+                const std::vector<double>& coordinate_dofs0,
                 const ufc::cell& ufc_cell);
 
     /// Update current pair of cells for macro element (TODO: Remove
     /// this when PointIntegralSolver supports the version with
     /// enabled_coefficients)
     void update(const Cell& cell0,
-                const std::vector<double>& vertex_coordinates0,
+                const std::vector<double>& coordinate_dofs0,
                 const ufc::cell& ufc_cell0,
                 const Cell& cell1,
-                const std::vector<double>& vertex_coordinates1,
+                const std::vector<double>& coordinate_dofs1,
                 const ufc::cell& ufc_cell1);
 
     /// Pointer to coefficient data. Used to support UFC interface.
@@ -110,29 +110,41 @@ namespace dolfin
     // Finite elements for coefficients
     std::vector<FiniteElement> coefficient_elements;
 
-    // Cell integrals (access through
-    // get_cell_integral to get proper fallback to default)
-    std::vector<std::shared_ptr<ufc::cell_integral> >
+    // Cell integrals (access through get_cell_integral to get proper
+    // fallback to default)
+    std::vector<std::shared_ptr<ufc::cell_integral>>
       cell_integrals;
 
     // Exterior facet integrals (access through
     // get_exterior_facet_integral to get proper fallback to default)
-    std::vector<std::shared_ptr<ufc::exterior_facet_integral> >
+    std::vector<std::shared_ptr<ufc::exterior_facet_integral>>
       exterior_facet_integrals;
 
     // Interior facet integrals (access through
     // get_interior_facet_integral to get proper fallback to default)
-    std::vector<std::shared_ptr<ufc::interior_facet_integral> >
+    std::vector<std::shared_ptr<ufc::interior_facet_integral>>
       interior_facet_integrals;
 
     // Point integrals (access through get_vertex_integral to get
     // proper fallback to default)
-    std::vector<std::shared_ptr<ufc::vertex_integral> >
+    std::vector<std::shared_ptr<ufc::vertex_integral>>
       vertex_integrals;
 
     // Custom integrals (access through get_custom_integral to get
     // proper fallback to default)
-    std::vector<std::shared_ptr<ufc::custom_integral> > custom_integrals;
+    std::vector<std::shared_ptr<ufc::custom_integral>> custom_integrals;
+
+    // Cutcell integrals (access through get_cutcell_integral to get
+    // proper fallback to default)
+    std::vector<std::shared_ptr<ufc::cutcell_integral>> cutcell_integrals;
+
+    // Interface integrals (access through get_interface_integral to
+    // get proper fallback to default)
+    std::vector<std::shared_ptr<ufc::interface_integral>> interface_integrals;
+
+    // Overlap integrals (access through get_overlap_integral to get
+    // proper fallback to default)
+    std::vector<std::shared_ptr<ufc::overlap_integral>> overlap_integrals;
 
   public:
 
@@ -155,6 +167,15 @@ namespace dolfin
     // Default custom integral
     std::shared_ptr<ufc::custom_integral> default_custom_integral;
 
+    // Default cutcell integral
+    std::shared_ptr<ufc::cutcell_integral> default_cutcell_integral;
+
+    // Default interface integral
+    std::shared_ptr<ufc::interface_integral> default_interface_integral;
+
+    // Default overlap integral
+    std::shared_ptr<ufc::overlap_integral> default_overlap_integral;
+
     /// Get cell integral over a given domain, falling back to the
     /// default if necessary
     ufc::cell_integral*
@@ -228,6 +249,45 @@ namespace dolfin
       return default_custom_integral.get();
     }
 
+    /// Get cutcell integral over a given domain, falling back to the
+    /// default if necessary
+    ufc::cutcell_integral * get_cutcell_integral(std::size_t domain)
+    {
+      if (domain < form.max_cutcell_subdomain_id())
+      {
+        ufc::cutcell_integral * integral = cutcell_integrals[domain].get();
+        if (integral)
+          return integral;
+      }
+      return default_cutcell_integral.get();
+    }
+
+    /// Get interface integral over a given domain, falling back to
+    /// the default if necessary
+    ufc::interface_integral * get_interface_integral(std::size_t domain)
+    {
+      if (domain < form.max_interface_subdomain_id())
+      {
+        ufc::interface_integral * integral = interface_integrals[domain].get();
+        if (integral)
+          return integral;
+      }
+      return default_interface_integral.get();
+    }
+
+    /// Get overlap integral over a given domain, falling back to the
+    /// default if necessary
+    ufc::overlap_integral * get_overlap_integral(std::size_t domain)
+    {
+      if (domain < form.max_overlap_subdomain_id())
+      {
+        ufc::overlap_integral * integral = overlap_integrals[domain].get();
+        if (integral)
+          return integral;
+      }
+      return default_overlap_integral.get();
+    }
+
     // Form
     const ufc::form& form;
 
@@ -246,16 +306,16 @@ namespace dolfin
 
     // Coefficients (std::vector<double*> is used to interface with
     // UFC)
-    std::vector<std::vector<double> > _w;
+    std::vector<std::vector<double>> _w;
     std::vector<double*> w_pointer;
 
     // Coefficients on macro element (std::vector<double*> is used to
     // interface with UFC)
-    std::vector<std::vector<double> > _macro_w;
+    std::vector<std::vector<double>> _macro_w;
     std::vector<double*> macro_w_pointer;
 
     // Coefficient functions
-    const std::vector<std::shared_ptr<const GenericFunction> > coefficients;
+    const std::vector<std::shared_ptr<const GenericFunction>> coefficients;
 
   public:
 
diff --git a/dolfin/fem/assemble.cpp b/dolfin/fem/assemble.cpp
index 803dd68..8b4a22b 100644
--- a/dolfin/fem/assemble.cpp
+++ b/dolfin/fem/assemble.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013 Anders Logg
+// Copyright (C) 2007-2015 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -21,12 +21,13 @@
 // Modified by Martin S. Alnaes, 2013.
 //
 // First added:  2007-01-17
-// Last changed: 2013-02-13
+// Last changed: 2015-11-11
 
 #include <dolfin/la/Scalar.h>
 #include "Form.h"
 #include "Assembler.h"
 #include "SystemAssembler.h"
+#include "MultiMeshAssembler.h"
 #include "assemble.h"
 
 using namespace dolfin;
@@ -38,44 +39,29 @@ void dolfin::assemble(GenericTensor& A, const Form& a)
   assembler.assemble(A, a);
 }
 //-----------------------------------------------------------------------------
-void dolfin::assemble_system(GenericMatrix& A,
-                             GenericVector& b,
-                             const Form& a,
-                             const Form& L)
+void dolfin::assemble_system(GenericMatrix& A, GenericVector& b,
+                             const Form& a, const Form& L,
+                             std::vector<std::shared_ptr<const DirichletBC>> bcs)
 {
-  SystemAssembler assembler(a, L);
+  SystemAssembler assembler(reference_to_no_delete_pointer(a),
+                            reference_to_no_delete_pointer(L), bcs);
   assembler.assemble(A, b);
 }
 //-----------------------------------------------------------------------------
-void dolfin::assemble_system(GenericMatrix& A,
-                             GenericVector& b,
-                             const Form& a,
-                             const Form& L,
-                             const DirichletBC& bc)
-{
-  SystemAssembler assembler(a, L, bc);
-  assembler.assemble(A, b);
-}
-//-----------------------------------------------------------------------------
-void dolfin::assemble_system(GenericMatrix& A,
-                             GenericVector& b,
-                             const Form& a,
-                             const Form& L,
-                             const std::vector<const DirichletBC*> bcs)
+void dolfin::assemble_system(GenericMatrix& A, GenericVector& b,
+                             const Form& a, const Form& L,
+                             std::vector<std::shared_ptr<const DirichletBC>> bcs,
+                             const GenericVector& x0)
 {
-  SystemAssembler assembler(a, L, bcs);
-  assembler.assemble(A, b);
+  SystemAssembler assembler(reference_to_no_delete_pointer(a),
+                            reference_to_no_delete_pointer(L), bcs);
+  assembler.assemble(A, b, x0);
 }
 //-----------------------------------------------------------------------------
-void dolfin::assemble_system(GenericMatrix& A,
-                             GenericVector& b,
-                             const Form& a,
-                             const Form& L,
-                             const std::vector<const DirichletBC*> bcs,
-                             const GenericVector& x0)
+void dolfin::assemble_multimesh(GenericTensor& A, const MultiMeshForm& a)
 {
-  SystemAssembler assembler(a, L, bcs);
-  assembler.assemble(A, b, x0);
+  MultiMeshAssembler assembler;
+  assembler.assemble(A, a);
 }
 //-----------------------------------------------------------------------------
 double dolfin::assemble(const Form& a)
diff --git a/dolfin/fem/assemble.h b/dolfin/fem/assemble.h
index c4820af..34988fd 100644
--- a/dolfin/fem/assemble.h
+++ b/dolfin/fem/assemble.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013 Anders Logg
+// Copyright (C) 2007-2015 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -20,17 +20,15 @@
 // Modified by Joachim B. Haga, 2012.
 // Modified by Martin S. Alnaes, 2013.
 //
-// First added:  2007-01-17
-// Last changed: 2013-02-13
-//
-// This file duplicates the Assembler::assemble* and SystemAssembler::assemble*
-// functions in namespace dolfin, and adds special versions returning the value
-// directly for scalars. For documentation, refer to Assemble.h and
-// SystemAssemble.h
+// This file duplicates the Assembler::assemble* and
+// SystemAssembler::assemble* functions in namespace dolfin, and adds
+// special versions returning the value directly for scalars. For
+// documentation, refer to Assemble.h and SystemAssemble.h
 
 #ifndef __ASSEMBLE_H
 #define __ASSEMBLE_H
 
+#include <memory>
 #include <vector>
 
 namespace dolfin
@@ -42,41 +40,26 @@ namespace dolfin
   class GenericTensor;
   class GenericVector;
   template<typename T> class MeshFunction;
-
-  //--- Copies of assembly functions in Assembler.h ---
+  class MultiMeshForm;
 
   /// Assemble tensor
   void assemble(GenericTensor& A, const Form& a);
 
-  /// Assemble system (A, b)
-  void assemble_system(GenericMatrix& A,
-                       GenericVector& b,
-                       const Form& a,
-                       const Form& L);
-
-  /// Assemble system (A, b) and apply Dirichlet boundary condition
-  void assemble_system(GenericMatrix& A,
-                       GenericVector& b,
-                       const Form& a,
-                       const Form& L,
-                       const DirichletBC& bc);
-
   /// Assemble system (A, b) and apply Dirichlet boundary conditions
-  void assemble_system(GenericMatrix& A,
-                       GenericVector& b,
-                       const Form& a,
-                       const Form& L,
-                       const std::vector<const DirichletBC*> bcs);
+  void assemble_system(GenericMatrix& A, GenericVector& b,
+                       const Form& a, const Form& L,
+                       std::vector<std::shared_ptr<const DirichletBC>> bcs);
 
-  /// Assemble system (A, b) on sub domains and apply Dirichlet boundary
-  /// conditions
-  void assemble_system(GenericMatrix& A,
-                       GenericVector& b,
-                       const Form& a,
-                       const Form& L,
-                       const std::vector<const DirichletBC*> bcs,
+  /// Assemble system (A, b) on sub domains and apply Dirichlet
+  /// boundary conditions
+  void assemble_system(GenericMatrix& A, GenericVector& b,
+                       const Form& a, const Form& L,
+                       std::vector<std::shared_ptr<const DirichletBC>> bcs,
                        const GenericVector& x0);
 
+  /// Assemble tensor from multimesh form
+  void assemble_multimesh(GenericTensor& A, const MultiMeshForm& a);
+
   //--- Specialized version for scalars ---
 
   /// Assemble scalar
diff --git a/dolfin/fem/assemble_local.cpp b/dolfin/fem/assemble_local.cpp
new file mode 100644
index 0000000..39170dc
--- /dev/null
+++ b/dolfin/fem/assemble_local.cpp
@@ -0,0 +1,83 @@
+// Copyright (C) 2015 Tormod Landet
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// First added:  2015-09-22
+
+#include <Eigen/Dense>
+
+#include <dolfin/fem/LocalAssembler.h>
+#include <dolfin/function/GenericFunction.h>
+#include <dolfin/function/FunctionSpace.h>
+#include <dolfin/la/GenericTensor.h>
+#include <dolfin/mesh/Cell.h>
+#include "Form.h"
+#include "GenericDofMap.h"
+#include "UFC.h"
+#include "assemble_local.h"
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+void dolfin::assemble_local(const Form& a,
+                            const Cell& cell,
+                            std::vector<double>& tensor)
+{
+  Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> A_e;
+  UFC ufc(a);
+  ufc::cell ufc_cell;
+  std::vector<double> coordinate_dofs;
+
+  // Get size of local tensor
+  std::size_t N, M;
+  if (a.rank() == 0)
+  {
+    N = 1;
+    M = 1;
+  }
+  else if (a.rank() == 1)
+  {
+    N = a.function_space(0)->dofmap()->cell_dofs(cell.index()).size();
+    M = 1;
+  }
+  else
+  {
+    N = a.function_space(0)->dofmap()->cell_dofs(cell.index()).size();
+    M = a.function_space(1)->dofmap()->cell_dofs(cell.index()).size();
+  }
+
+  // Extract cell_domains etc from the form
+  const MeshFunction<std::size_t>* cell_domains =
+    a.cell_domains().get();
+  const MeshFunction<std::size_t>* exterior_facet_domains =
+    a.exterior_facet_domains().get();
+  const MeshFunction<std::size_t>* interior_facet_domains =
+    a.interior_facet_domains().get();
+
+  // Update to the local cell and assemble
+  A_e.resize(N, M);
+  cell.get_coordinate_dofs(coordinate_dofs);
+  LocalAssembler::assemble(A_e, ufc, coordinate_dofs,
+                           ufc_cell, cell, cell_domains,
+                           exterior_facet_domains, interior_facet_domains);
+  
+  // Copy values into the return tensor
+  tensor.resize(N*M);
+  for (std::size_t i = 0; i < N; i++)
+    for (std::size_t j = 0; j < M; j++)
+      tensor[i*M+j] = A_e(i,j);
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/la/STLVector.h b/dolfin/fem/assemble_local.h
similarity index 63%
rename from dolfin/la/STLVector.h
rename to dolfin/fem/assemble_local.h
index c322873..b8e2779 100644
--- a/dolfin/la/STLVector.h
+++ b/dolfin/fem/assemble_local.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Garth N. Wells
+// Copyright (C) 2015 Tormod Landet
 //
 // This file is part of DOLFIN.
 //
@@ -14,20 +14,21 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// First added:  2015-09-22
+//
+// This file adds an easy to use wrapper for the LocalAssembler::assemble
+// routine that can used from Python
 
-#ifndef __DOLFIN_STLVECTOR_H
-#define __DOLFIN_STLVECTOR_H
-
-#include "PETScVector.h"
-#include "EigenVector.h"
+#ifndef __ASSEMBLE_LOCAL_H
+#define __ASSEMBLE_LOCAL_H
 
 namespace dolfin
 {
-  #ifdef HAS_PETSC
-    typedef PETScVector STLVector;
-  #else
-    typedef EigenVector STLVector;
-  #endif
+  /// Assemble form to local tensor on a cell
+  void assemble_local(const Form& a,
+                      const Cell& cell,
+                      std::vector<double>& tensor);
 }
 
 #endif
diff --git a/dolfin/fem/dolfin_fem.h b/dolfin/fem/dolfin_fem.h
index 473c986..f221cb4 100644
--- a/dolfin/fem/dolfin_fem.h
+++ b/dolfin/fem/dolfin_fem.h
@@ -9,9 +9,12 @@
 #include <dolfin/fem/Equation.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/BasisFunction.h>
+#include <dolfin/fem/DiscreteOperators.h>
 #include <dolfin/fem/DirichletBC.h>
 #include <dolfin/fem/PointSource.h>
 #include <dolfin/fem/assemble.h>
+#include <dolfin/fem/assemble_local.h>
+#include <dolfin/fem/LocalAssembler.h>
 #include <dolfin/fem/LocalSolver.h>
 #include <dolfin/fem/solve.h>
 #include <dolfin/fem/Form.h>
diff --git a/dolfin/fem/fem_utils.cpp b/dolfin/fem/fem_utils.cpp
index c35f88d..be314ea 100644
--- a/dolfin/fem/fem_utils.cpp
+++ b/dolfin/fem/fem_utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Johan Hake
+// Copyright (C) 2013, 2015, 2016 Johan Hake, Jan Blechta
 //
 // This file is part of DOLFIN.
 //
@@ -14,15 +14,13 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2013-09-05
-// Last changed: 2013-11-07
 
 #include <dolfin/common/ArrayView.h>
 #include <dolfin/fem/GenericDofMap.h>
 #include <dolfin/function/FunctionSpace.h>
 #include <dolfin/mesh/Mesh.h>
 #include <dolfin/mesh/Vertex.h>
+#include <dolfin/la/GenericVector.h>
 
 #include "fem_utils.h"
 
@@ -31,34 +29,13 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 std::vector<std::size_t> dolfin::dof_to_vertex_map(const FunctionSpace& space)
 {
-  dolfin_assert(space.dofmap());
-  const GenericDofMap& dofmap = *space.dofmap();
-
-  if (dofmap.is_view())
-  {
-    dolfin_error("fem_utils.cpp",
-                 "tabulate dof to vertex map",
-                 "Cannot tabulate dof_to_vertex_map for a subspace");
-  }
-
-  // Get dof to vertex map
+  // Get vertex_to_dof_map and invert it
   const std::vector<dolfin::la_index> vertex_map = vertex_to_dof_map(space);
-
-  // Create return data structure
-  const dolfin::la_index num_dofs
-    = dofmap.ownership_range().second - dofmap.ownership_range().first;
-  std::vector<std::size_t> return_map(num_dofs);
-
-  // Invert dof_map
+  std::vector<std::size_t> return_map(vertex_map.size());
   for (std::size_t i = 0; i < vertex_map.size(); i++)
   {
-    // Skip ghost dofs
-    const dolfin::la_index dof = vertex_map[i];
-    if (dof < num_dofs)
-      return_map[dof] = i;
+    return_map[vertex_map[i]] = i;
   }
-
-  // Return the map
   return return_map;
 }
 //-----------------------------------------------------------------------------
@@ -66,6 +43,8 @@ std::vector<dolfin::la_index>
 dolfin::vertex_to_dof_map(const FunctionSpace& space)
 {
   // Get the mesh
+  dolfin_assert(space.mesh());
+  dolfin_assert(space.dofmap());
   const Mesh& mesh = *space.mesh();
   const GenericDofMap& dofmap = *space.dofmap();
 
@@ -142,3 +121,196 @@ dolfin::vertex_to_dof_map(const FunctionSpace& space)
   return return_map;
 }
 //-----------------------------------------------------------------------------
+void _check_coordinates(const MeshGeometry& geometry, const Function& position)
+{
+  dolfin_assert(position.function_space());
+  dolfin_assert(position.function_space()->mesh());
+  dolfin_assert(position.function_space()->dofmap());
+  dolfin_assert(position.function_space()->element());
+  dolfin_assert(position.function_space()->element()->ufc_element());
+
+  if (position.function_space()->element()->ufc_element()->family()
+          != std::string("Lagrange"))
+
+  {
+    dolfin_error("fem_utils.cpp",
+                 "set/get mesh geometry coordinates from/to function",
+                 "expecting 'Lagrange' finite element family rather than '%s'",
+                 position.function_space()->element()->ufc_element()->family());
+  }
+
+  if (position.value_rank() != 1)
+  {
+    dolfin_error("fem_utils.cpp",
+                 "set/get mesh geometry coordinates from/to function",
+                 "function has incorrect value rank %d, need 1",
+                 position.value_rank());
+  }
+
+  if (position.value_dimension(0) != geometry.dim())
+  {
+    dolfin_error("fem_utils.cpp",
+                 "set/get mesh geometry coordinates from/to function",
+                 "function value dimension %d and geometry dimension %d "
+                 "do not match",
+                 position.value_dimension(0), geometry.dim());
+  }
+
+  if (position.function_space()->element()->ufc_element()->degree()
+          != geometry.degree())
+  {
+    dolfin_error("fem_utils.cpp",
+                 "set/get mesh geometry coordinates from/to function",
+                 "function degree %d and geometry degree %d do not match",
+                 position.function_space()->element()->ufc_element()->degree(),
+                 geometry.degree());
+  }
+}
+//-----------------------------------------------------------------------------
+// This helper function sets geometry from position (if setting) or stores
+// geometry into position (otherwise)
+void _get_set_coordinates(MeshGeometry& geometry, Function& position,
+  const bool setting)
+{
+  auto& x = geometry.x();
+  auto& v = *position.vector();
+  const auto& dofmap = *position.function_space()->dofmap();
+  const auto& mesh = *position.function_space()->mesh();
+  const auto tdim = mesh.topology().dim();
+  const auto gdim = mesh.geometry().dim();
+
+  std::vector<std::size_t> num_local_entities(tdim+1);
+  std::vector<std::size_t> coords_per_entity(tdim+1);
+  std::vector<std::vector<std::vector<std::size_t>>> local_to_local(tdim+1);
+  std::vector<std::vector<std::size_t>> offsets(tdim+1);
+
+  for (std::size_t dim = 0; dim <= tdim; ++dim)
+  {
+    // Get number local entities
+    num_local_entities[dim] = mesh.type().num_entities(dim);
+
+    // Get local-to-local mapping of dofs
+    local_to_local[dim].resize(num_local_entities[dim]);
+    for (std::size_t local_ind = 0; local_ind != num_local_entities[dim]; ++local_ind)
+      dofmap.tabulate_entity_dofs(local_to_local[dim][local_ind], dim, local_ind);
+
+    // Get entity offsets; could be retrieved directly from geometry
+    coords_per_entity[dim] = geometry.num_entity_coordinates(dim);
+    for (std::size_t coord_ind = 0; coord_ind != coords_per_entity[dim]; ++coord_ind)
+    {
+      const auto offset = geometry.get_entity_index(dim, coord_ind, 0);
+      offsets[dim].push_back(offset);
+    }
+  }
+
+  // Initialize needed connectivities
+  for (std::size_t dim = 0; dim <= tdim; ++dim)
+  {
+    if (coords_per_entity[dim] > 0)
+      mesh.init(tdim, dim);
+  }
+
+  ArrayView<const la_index> cell_dofs;
+  std::vector<double> values;
+  const unsigned int* global_entities;
+  std::size_t xi, vi;
+
+  // Get/set cell-by-cell
+  for (CellIterator c(mesh); !c.end(); ++c)
+  {
+    // Get/prepare values and dofs on cell
+    cell_dofs = dofmap.cell_dofs(c->index());
+    values.resize(cell_dofs.size());
+    if (setting)
+      v.get_local(values.data(), cell_dofs.size(), cell_dofs.data());
+
+    // Iterate over all entities on cell
+    for (std::size_t dim = 0; dim <= tdim; ++dim)
+    {
+      // Get local-to-global entity mapping
+      global_entities = c->entities(dim);
+
+      for (std::size_t local_entity = 0;
+           local_entity != num_local_entities[dim]; ++local_entity)
+      {
+        for (std::size_t local_dof = 0; local_dof != coords_per_entity[dim];
+              ++local_dof)
+        {
+          for (std::size_t component = 0; component != gdim; ++component)
+          {
+            // Compute indices
+            xi = gdim*(offsets[dim][local_dof] + global_entities[local_entity])
+               + component;
+            vi = local_to_local[dim][local_entity][gdim*local_dof + component];
+
+            // Set one or other
+            if (setting)
+              x[xi] = values[vi];
+            else
+              values[vi] = x[xi];
+          }
+        }
+      }
+    }
+
+    // Store cell contribution to dof vector (if getting)
+    if (!setting)
+      v.set_local(values.data(), cell_dofs.size(), cell_dofs.data());
+  }
+
+  if (!setting)
+    v.apply("insert");
+}
+//-----------------------------------------------------------------------------
+void dolfin::set_coordinates(MeshGeometry& geometry, const Function& position)
+{
+  _check_coordinates(geometry, position);
+  _get_set_coordinates(geometry, const_cast<Function&>(position), true);
+}
+//-----------------------------------------------------------------------------
+void dolfin::get_coordinates(Function& position, const MeshGeometry& geometry)
+{
+  _check_coordinates(geometry, position);
+  _get_set_coordinates(const_cast<MeshGeometry&>(geometry), position, false);
+}
+//-----------------------------------------------------------------------------
+Mesh dolfin::create_mesh(Function& coordinates)
+{
+  dolfin_assert(coordinates.function_space());
+  dolfin_assert(coordinates.function_space()->element());
+  dolfin_assert(coordinates.function_space()->element()->ufc_element());
+
+  // Fetch old mesh and create new mesh
+  const Mesh& mesh0 = *(coordinates.function_space()->mesh());
+  Mesh mesh1(mesh0.mpi_comm());
+
+  // Assign all data except geometry
+  mesh1._topology = mesh0._topology;
+  mesh1._domains = mesh0._domains;
+  mesh1._data = mesh0._data;
+  if (mesh0._cell_type)
+    mesh1._cell_type.reset(CellType::create(mesh0._cell_type->cell_type()));
+  else
+    mesh1._cell_type.reset();
+  mesh1._ordered = mesh0._ordered;
+  mesh1._cell_orientations = mesh0._cell_orientations;
+
+  // Rename
+  mesh1.rename(mesh0.name(), mesh0.label());
+
+  // Call assignment operator for base class
+  static_cast<Hierarchical<Mesh>>(mesh1) = mesh0;
+
+  // Prepare a new geometry
+  mesh1._geometry.init(mesh0._geometry.dim(),
+    coordinates.function_space()->element()->ufc_element()->degree());
+  std::vector<std::size_t> num_entities(mesh0._topology.dim() + 1);
+  for (std::size_t dim = 0; dim <= mesh0._topology.dim(); ++dim)
+    num_entities[dim] = mesh0._topology.size(dim);
+  mesh1._geometry.init_entities(num_entities);
+
+  // Assign coordinates
+  set_coordinates(mesh1._geometry, coordinates);
+
+  return mesh1;
+}
diff --git a/dolfin/fem/fem_utils.h b/dolfin/fem/fem_utils.h
index 7162cbd..85ee814 100644
--- a/dolfin/fem/fem_utils.h
+++ b/dolfin/fem/fem_utils.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Johan Hake
+// Copyright (C) 2013, 2015, 2016 Johan Hake, Jan Blechta
 //
 // This file is part of DOLFIN.
 //
@@ -14,9 +14,6 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2013-09-05
-// Last changed: 2013-09-09
 
 #ifndef __FEM_UTILS_H
 #define __FEM_UTILS_H
@@ -31,15 +28,19 @@ namespace dolfin
   class FunctionSpace;
 
   /// Return a map between dofs indices and vertex indices
-  /// 
+  ///
   /// Only works for FunctionSpace with dofs exclusively on vertices.
-  /// For MixedFunctionSpaces vertex index is offset with the number
-  /// of dofs per vertex. In parallel the returned map only maps local
-  /// (to processor) dofs.
+  /// For mixed FunctionSpaces vertex index is offset with the number
+  /// of dofs per vertex.
+  ///
+  /// In parallel the returned map maps both owned and unowned dofs
+  /// (using local indices) thus covering all the vertices. Hence the
+  /// returned map is an inversion of _vertex_to_dof_map_.
   ///
   /// *Arguments*
   ///     space (_FunctionSpace_)
-  ///         The FunctionSpace for what the dof to vertex map should be computed for
+  ///         The FunctionSpace for what the dof to vertex map should
+  ///         be computed for
   ///
   /// *Returns*
   ///     std::vector<std::size_t>
@@ -49,18 +50,72 @@ namespace dolfin
   /// Return a map between vertex indices and dofs indices
   ///
   /// Only works for FunctionSpace with dofs exclusively on vertices.
-  /// For MixedFunctionSpaces dof index is offset with the number of
+  /// For mixed FunctionSpaces dof index is offset with the number of
   /// dofs per vertex.
   ///
   /// *Arguments*
   ///     space (_FunctionSpace_)
-  ///         The FunctionSpace for what the vertex to dof map should be computed for
+  ///         The FunctionSpace for what the vertex to dof map should
+  ///         be computed for
   ///
   /// *Returns*
   ///     std::vector<dolfin::la_index>
   ///         The vertex to dof map
   std::vector<dolfin::la_index> vertex_to_dof_map(const FunctionSpace& space);
 
+  class Function;
+  class MeshGeometry;
+
+  /// Sets mesh coordinates from function
+  ///
+  /// Mesh connectivities d-0, d-1, ..., d-r are built on function mesh
+  /// (where d is topological dimension of the mesh and r is maximal
+  /// dimension of entity associated with any coordinate node). Consider
+  /// clearing unneeded connectivities when finished.
+  ///
+  /// *Arguments*
+  ///     geometry (_MeshGeometry_)
+  ///         Mesh geometry to be set
+  ///     position (_Function_)
+  ///         Vectorial Lagrange function with matching degree and mesh
+  void set_coordinates(MeshGeometry& geometry, const Function& position);
+
+  /// Stores mesh coordinates into function
+  ///
+  /// Mesh connectivities d-0, d-1, ..., d-r are built on function mesh
+  /// (where d is topological dimension of the mesh and r is maximal
+  /// dimension of entity associated with any coordinate node). Consider
+  /// clearing unneeded connectivities when finished.
+  ///
+  /// *Arguments*
+  ///     position (_Function_)
+  ///         Vectorial Lagrange function with matching degree and mesh
+  ///     geometry (_MeshGeometry_)
+  ///         Mesh geometry to be stored
+  void get_coordinates(Function& position, const MeshGeometry& geometry);
+
+  class Mesh;
+
+  /// Creates mesh from coordinate function
+  ///
+  /// Topology is given by underlying mesh of the function space and
+  /// geometry is given by function values. Hence resulting mesh
+  /// geometry has a degree of the function space degree. Geometry of
+  /// function mesh is ignored.
+  ///
+  /// Mesh connectivities d-0, d-1, ..., d-r are built on function mesh
+  /// (where d is topological dimension of the mesh and r is maximal
+  /// dimension of entity associated with any coordinate node). Consider
+  /// clearing unneeded connectivities when finished.
+  ///
+  /// *Arguments*
+  ///     position (_Function_)
+  ///         Vectorial Lagrange function with of any degree
+  ///
+  /// *Returns*
+  ///     _Mesh_
+  ///         The mesh
+  Mesh create_mesh(Function& position);
 }
 
 #endif
diff --git a/dolfin/fem/solve.cpp b/dolfin/fem/solve.cpp
index 8283036..5e3211c 100644
--- a/dolfin/fem/solve.cpp
+++ b/dolfin/fem/solve.cpp
@@ -26,94 +26,84 @@
 #include "solve.h"
 
 //-----------------------------------------------------------------------------
-void dolfin::solve(const Equation& equation,
-                   Function& u, Parameters parameters)
+void dolfin::solve(const Equation& equation, Function& u, Parameters parameters)
 {
-  // Create empty list of boundary conditions
-  std::vector<const DirichletBC*> bcs;
-
   // Call common solve function
-  solve(equation, u, bcs, parameters);
+  solve(equation, u, std::vector<const DirichletBC*>(), parameters);
 }
 //-----------------------------------------------------------------------------
-void dolfin::solve(const Equation& equation,
-                   Function& u,
-                   const DirichletBC& bc,
+void dolfin::solve(const Equation& equation, Function& u, const DirichletBC& bc,
 		   Parameters parameters)
 {
-  // Create list containing single boundary condition
-  std::vector<const DirichletBC*> bcs;
-  bcs.push_back(&bc);
-
   // Call common solve function
-  solve(equation, u, bcs, parameters);
+  solve(equation, u, {&bc}, parameters);
 }
 //-----------------------------------------------------------------------------
-void dolfin::solve(const Equation& equation,
-                   Function& u,
-                   std::vector<const DirichletBC*> bcs,
-		   Parameters parameters)
+void dolfin::solve(const Equation& equation, Function& u,
+                   std::vector<const DirichletBC*> bcs, Parameters parameters)
 {
+  // Pack bcs
+  std::vector<std::shared_ptr<const DirichletBC>> _bcs;
+  for (auto bc : bcs)
+    _bcs.push_back(reference_to_no_delete_pointer(*bc));
+
   // Solve linear problem
   if (equation.is_linear())
   {
-    LinearVariationalProblem problem(*equation.lhs(), *equation.rhs(), u, bcs);
-    LinearVariationalSolver solver(problem);
+    LinearVariationalProblem problem(equation.lhs(), equation.rhs(),
+                                     reference_to_no_delete_pointer(u), _bcs);
+    LinearVariationalSolver solver(reference_to_no_delete_pointer(problem));
     solver.parameters.update(parameters);
     solver.solve();
   }
-
-  // Solve nonlinear problem
   else
   {
-    NonlinearVariationalProblem problem(*equation.lhs(), u, bcs);
-    NonlinearVariationalSolver solver(problem);
+    // Solve nonlinear problem
+    NonlinearVariationalProblem problem(equation.lhs(),
+                                        reference_to_no_delete_pointer(u),
+                                        _bcs);
+    NonlinearVariationalSolver solver(reference_to_no_delete_pointer(problem));
     solver.parameters.update(parameters);
     solver.solve();
   }
 }
 //-----------------------------------------------------------------------------
-void dolfin::solve(const Equation& equation,
-                   Function& u,
-                   const Form& J,
+void dolfin::solve(const Equation& equation, Function& u, const Form& J,
 		   Parameters parameters)
 {
-  // Create empty list of boundary conditions
-  std::vector<const DirichletBC*> bcs;
-
   // Call common solve function
-  solve(equation, u, bcs, J, parameters);
+  solve(equation, u, {}, J, parameters);
 }
 //-----------------------------------------------------------------------------
-void dolfin::solve(const Equation& equation,
-                   Function& u,
-                   const DirichletBC& bc,
-                   const Form& J,
-                    Parameters parameters)
+void dolfin::solve(const Equation& equation, Function& u, const DirichletBC& bc,
+                   const Form& J, Parameters parameters)
 {
-  // Create list containing single boundary condition
-  std::vector<const DirichletBC*> bcs;
-  bcs.push_back(&bc);
-
   // Call common solve function
-  solve(equation, u, bcs, J, parameters);
+  solve(equation, u, {&bc}, J, parameters);
 }
 //-----------------------------------------------------------------------------
-void dolfin::solve(const Equation& equation,
-                   Function& u,
-                   std::vector<const DirichletBC*> bcs,
-                   const Form& J,
+void dolfin::solve(const Equation& equation, Function& u,
+                   std::vector<const DirichletBC*> bcs, const Form& J,
 		   Parameters parameters)
 {
   // Check that the problem is linear
   if (equation.is_linear())
+  {
     dolfin_error("solve.cpp",
                  "solve nonlinear variational problem",
                  "Variational problem is linear");
+  }
+
+  // Pack bcs
+  std::vector<std::shared_ptr<const DirichletBC>> _bcs;
+  for (auto bc : bcs)
+    _bcs.push_back(reference_to_no_delete_pointer(*bc));
 
   // Solve nonlinear problem
-  NonlinearVariationalProblem problem(*equation.lhs(), u, bcs, J);
-  NonlinearVariationalSolver solver(problem);
+  NonlinearVariationalProblem problem(equation.lhs(),
+                                      reference_to_no_delete_pointer(u), _bcs,
+                                      reference_to_no_delete_pointer(J));
+  NonlinearVariationalSolver solver(reference_to_no_delete_pointer(problem));
   solver.parameters.update(parameters);
   solver.solve();
 }
diff --git a/dolfin/function/CoefficientAssigner.cpp b/dolfin/function/CoefficientAssigner.cpp
index 2f716d9..52c0106 100644
--- a/dolfin/function/CoefficientAssigner.cpp
+++ b/dolfin/function/CoefficientAssigner.cpp
@@ -16,13 +16,11 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // Modified by Martin Alnes, 2008.
-//
-// First added:  2008-10-28
-// Last changed: 2009-10-04
 
 #include <memory>
 #include <dolfin/common/NoDeleter.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/log/log.h>
 #include "CoefficientAssigner.h"
 
 using namespace dolfin;
@@ -39,9 +37,9 @@ CoefficientAssigner::~CoefficientAssigner()
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-void CoefficientAssigner::operator= (const GenericFunction& coefficient)
+void CoefficientAssigner::operator= (std::shared_ptr<const GenericFunction> coefficient)
 {
-  std::shared_ptr<const GenericFunction> c(&coefficient, NoDeleter());
-  _form.set_coefficient(_number, c);
+  dolfin_assert(coefficient);
+  _form.set_coefficient(_number, coefficient);
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/function/CoefficientAssigner.h b/dolfin/function/CoefficientAssigner.h
index 72e058d..3240cdb 100644
--- a/dolfin/function/CoefficientAssigner.h
+++ b/dolfin/function/CoefficientAssigner.h
@@ -14,14 +14,12 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2008-10-28
-// Last changed: 2009-10-04
 
 #ifndef __COEFFICIENT_ASSIGNER_H
 #define __COEFFICIENT_ASSIGNER_H
 
 #include <cstddef>
+#include <memory>
 
 namespace dolfin
 {
@@ -49,7 +47,7 @@ namespace dolfin
     ~CoefficientAssigner();
 
     /// Assign coefficient
-    void operator= (const GenericFunction& coefficient);
+    void operator= (std::shared_ptr<const GenericFunction> coefficient);
 
   private:
 
diff --git a/dolfin/function/Constant.cpp b/dolfin/function/Constant.cpp
index c7a2f7d..2a4cd14 100644
--- a/dolfin/function/Constant.cpp
+++ b/dolfin/function/Constant.cpp
@@ -21,6 +21,11 @@
 // First added:  2006-02-09
 // Last changed: 2011-11-14
 
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <dolfin/common/utils.h>
 #include <dolfin/log/log.h>
 #include "Constant.h"
 
@@ -122,6 +127,12 @@ Constant::operator double() const
   return _values[0];
 }
 //-----------------------------------------------------------------------------
+std::vector<double> Constant::values() const
+{
+  dolfin_assert(!_values.empty());
+  return _values;
+}
+//-----------------------------------------------------------------------------
 void Constant::eval(Array<double>& values, const Array<double>& x) const
 {
   // Copy values
@@ -129,3 +140,36 @@ void Constant::eval(Array<double>& values, const Array<double>& x) const
     values[j] = _values[j];
 }
 //-----------------------------------------------------------------------------
+std::string Constant::str(bool verbose) const
+{
+  std::ostringstream oss;
+  oss << "<Constant of dimension " << _values.size() << ">";
+
+  if (verbose)
+  {
+    std::ostringstream ossv;
+    if (!_values.empty())
+    {
+      ossv << std::endl << std::endl;
+      if (!_value_shape.empty())
+      {
+        ossv << "Values: ";
+        ossv << "(";
+        // Avoid a trailing ", "
+        std::copy(_values.begin(), _values.end() - 1,
+                  std::ostream_iterator<double>(ossv, ", "));
+        ossv << _values.back();
+        ossv << ")";
+      }
+      else
+      {
+        ossv << "Value: ";
+        ossv << _values[0];
+      }
+    }
+    oss << indent(ossv.str());
+  }
+
+  return oss.str();
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/function/Constant.h b/dolfin/function/Constant.h
index ae140e0..1821c7d 100644
--- a/dolfin/function/Constant.h
+++ b/dolfin/function/Constant.h
@@ -17,9 +17,6 @@
 //
 // Modified by Martin Sandve Alnes, 2008.
 // Modified by Garth N. Wells, 2008-2011.
-//
-// First added:  2006-02-09
-// Last changed: 2011-05-15
 
 #ifndef __CONSTANT_H
 #define __CONSTANT_H
@@ -29,7 +26,7 @@
 
 namespace dolfin
 {
-
+  template<typename T> class Array;
   class Mesh;
 
   /// This class represents a constant-valued expression.
@@ -48,7 +45,6 @@ namespace dolfin
     ///     .. code-block:: c++
     ///
     ///         Constant c(1.0);
-    ///
     explicit Constant(double value);
 
     /// Create vector constant (dim = 2)
@@ -63,7 +59,6 @@ namespace dolfin
     ///     .. code-block:: c++
     ///
     ///         Constant B(0.0, 1.0);
-    ///
     Constant(double value0, double value1);
 
     /// Create vector constant (dim = 3)
@@ -80,7 +75,6 @@ namespace dolfin
     ///     .. code-block:: c++
     ///
     ///         Constant T(0.0, 1.0, 0.0);
-    ///
     Constant(double value0, double value1, double value2);
 
     /// Create vector-valued constant
@@ -131,10 +125,19 @@ namespace dolfin
     ///         The scalar value.
     operator double() const;
 
+    /// Return copy of this Constant's current values
+    ///
+    /// *Returns*
+    ///     std::vector<double>
+    ///         The vector of scalar values of the constant.
+    std::vector<double> values() const;
+
     //--- Implementation of Expression interface ---
 
     void eval(Array<double>& values, const Array<double>& x) const;
 
+    virtual std::string str(bool verbose) const;
+
   private:
 
     // Values of constant function
diff --git a/dolfin/function/Expression.cpp b/dolfin/function/Expression.cpp
index 985ebcd..13f240c 100644
--- a/dolfin/function/Expression.cpp
+++ b/dolfin/function/Expression.cpp
@@ -99,11 +99,11 @@ std::size_t Expression::value_dimension(std::size_t i) const
 void Expression::restrict(double* w,
                           const FiniteElement& element,
                           const Cell& dolfin_cell,
-                          const double* vertex_coordinates,
+                          const double* coordinate_dofs,
                           const ufc::cell& ufc_cell) const
 {
   // Restrict as UFC function (by calling eval)
-  restrict_as_ufc_function(w, element, dolfin_cell, vertex_coordinates,
+  restrict_as_ufc_function(w, element, dolfin_cell, coordinate_dofs,
                            ufc_cell);
 }
 //-----------------------------------------------------------------------------
@@ -144,3 +144,8 @@ void Expression::compute_vertex_values(std::vector<double>& vertex_values,
   }
 }
 //-----------------------------------------------------------------------------
+std::shared_ptr<const FunctionSpace> Expression::function_space() const
+{
+  return std::shared_ptr<const FunctionSpace>();
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/function/Expression.h b/dolfin/function/Expression.h
index 214f11f..3f0db44 100644
--- a/dolfin/function/Expression.h
+++ b/dolfin/function/Expression.h
@@ -143,7 +143,7 @@ namespace dolfin
     virtual void restrict(double* w,
                           const FiniteElement& element,
                           const Cell& dolfin_cell,
-                          const double* vertex_coordinates,
+                          const double* coordinate_dofs,
                           const ufc::cell& ufc_cell) const;
 
     /// Compute values at all mesh vertices.
@@ -156,6 +156,14 @@ namespace dolfin
     virtual void compute_vertex_values(std::vector<double>& vertex_values,
                                        const Mesh& mesh) const;
 
+    /// Return shared pointer to function space (NULL)
+    /// Expression does not have a FunctionSpace
+    ///
+    /// *Returns*
+    ///     _FunctionSpace_
+    ///         Return the shared pointer.
+    virtual std::shared_ptr<const FunctionSpace> function_space() const;
+
   protected:
 
     // Value shape
diff --git a/dolfin/function/Function.cpp b/dolfin/function/Function.cpp
index 641a655..5fc7628 100644
--- a/dolfin/function/Function.cpp
+++ b/dolfin/function/Function.cpp
@@ -48,22 +48,6 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-Function::Function(const FunctionSpace& V) : Hierarchical<Function>(*this),
-  _function_space(reference_to_no_delete_pointer(V)),
-  _allow_extrapolation(dolfin::parameters["allow_extrapolation"])
-{
-  // Check that we don't have a subspace
-  if (!V.component().empty())
-  {
-    dolfin_error("Function.cpp",
-                 "create function",
-                 "Cannot be created from subspace. Consider collapsing the function space");
-  }
-
-  // Initialize vector
-  init_vector();
-}
-//-----------------------------------------------------------------------------
 Function::Function(std::shared_ptr<const FunctionSpace> V)
   : Hierarchical<Function>(*this), _function_space(V),
   _allow_extrapolation(dolfin::parameters["allow_extrapolation"])
@@ -93,36 +77,6 @@ Function::Function(std::shared_ptr<const FunctionSpace> V,
   dolfin_assert(V->dofmap()->global_dimension() <= x->size());
 }
 //-----------------------------------------------------------------------------
-Function::Function(const FunctionSpace& V, std::string filename)
-  : Hierarchical<Function>(*this),
-  _function_space(reference_to_no_delete_pointer(V)),
-  _allow_extrapolation(dolfin::parameters["allow_extrapolation"])
-{
-  // Check that we don't have a subspace
-  if (!V.component().empty())
-  {
-    dolfin_error("Function.cpp",
-                 "create function",
-                 "Cannot be created from subspace. Consider collapsing the function space");
-  }
-
-  // Initialize vector
-  init_vector();
-
-  // Check size of vector
-  if (_vector->size() != _function_space->dim())
-  {
-    dolfin_error("Function.cpp",
-                 "read function from file",
-                 "The number of degrees of freedom (%d) does not match dimension of function space (%d)",
-                 _vector->size(), _function_space->dim());
-  }
-
-  // Read function data from file
-  File file(filename);
-  file >> *this;
-}
-//-----------------------------------------------------------------------------
 Function::Function(std::shared_ptr<const FunctionSpace> V,
                    std::string filename) : Hierarchical<Function>(*this),
   _function_space(V),
@@ -149,7 +103,8 @@ Function::Function(std::shared_ptr<const FunctionSpace> V,
   }
 
   // Read function data from file
-  File file(filename);
+  MPI_Comm comm = _function_space->mesh()->mpi_comm();
+  File file(comm, filename);
   file >> *this;
 }
 //-----------------------------------------------------------------------------
@@ -205,21 +160,13 @@ const Function& Function::operator= (const Function& v)
     std::vector<dolfin::la_index> new_rows(collapsed_map.size());
     std::vector<dolfin::la_index> old_rows(collapsed_map.size());
     std::size_t i = 0;
-    //const std::size_t local_owned_size
-    //  = v._function_space->dofmap()->ownership_range().second
-    //  - v._function_space->dofmap()->ownership_range().first;
     for (entry = collapsed_map.begin(); entry != collapsed_map.end(); ++entry)
     {
       new_rows[i]   = entry->first;
       old_rows[i++] = entry->second;
     }
-    MPI::barrier(MPI_COMM_WORLD);
 
     // Gather values into a vector
-    //std::vector<double> gathered_values;
-    //dolfin_assert(v.vector());
-    //v.vector()->gather(gathered_values, old_rows);
-
     dolfin_assert(v.vector());
     std::vector<double> gathered_values(collapsed_map.size());
     v.vector()->get_local(gathered_values.data(), gathered_values.size(),
@@ -252,7 +199,6 @@ const Function& Function::operator= (const Expression& v)
 //-----------------------------------------------------------------------------
 Function& Function::operator[] (std::size_t i) const
 {
-
   // Check if sub-Function is in the cache, otherwise create and add
   // to cache
   auto sub_function = _sub_functions.find(i);
@@ -273,22 +219,22 @@ Function& Function::operator[] (std::size_t i) const
 //-----------------------------------------------------------------------------
 FunctionAXPY Function::operator+(const Function& other) const
 {
-  return FunctionAXPY(*this, other, FunctionAXPY::ADD_ADD);
+  return FunctionAXPY(*this, other, FunctionAXPY::Direction::ADD_ADD);
 }
 //-----------------------------------------------------------------------------
 FunctionAXPY Function::operator+(const FunctionAXPY& axpy) const
 {
-  return FunctionAXPY(axpy, *this, FunctionAXPY::ADD_ADD);
+  return FunctionAXPY(axpy, *this, FunctionAXPY::Direction::ADD_ADD);
 }
 //-----------------------------------------------------------------------------
 FunctionAXPY Function::operator-(const Function& other) const
 {
-  return FunctionAXPY(*this, other, FunctionAXPY::ADD_SUB);
+  return FunctionAXPY(*this, other, FunctionAXPY::Direction::ADD_SUB);
 }
 //-----------------------------------------------------------------------------
 FunctionAXPY Function::operator-(const FunctionAXPY& axpy) const
 {
-  return FunctionAXPY(axpy, *this, FunctionAXPY::SUB_ADD);
+  return FunctionAXPY(axpy, *this, FunctionAXPY::Direction::SUB_ADD);
 }
 //-----------------------------------------------------------------------------
 FunctionAXPY Function::operator*(double scalar) const
@@ -321,12 +267,6 @@ void Function::operator=(const FunctionAXPY& axpy)
     _vector->axpy(it->first, *(it->second->vector()));
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<const FunctionSpace> Function::function_space() const
-{
-  dolfin_assert(_function_space);
-  return _function_space;
-}
-//-----------------------------------------------------------------------------
 std::shared_ptr<GenericVector> Function::vector()
 {
   dolfin_assert(_vector);
@@ -415,13 +355,13 @@ void Function::eval(Array<double>& values, const Array<double>& x,
   // Create work vector for expansion coefficients
   std::vector<double> coefficients(element.space_dimension());
 
-  // Cell vertices (re-allocated inside function for thread safety)
-  std::vector<double> vertex_coordinates;
-  dolfin_cell.get_vertex_coordinates(vertex_coordinates);
+  // Cell coordinates (re-allocated inside function for thread safety)
+  std::vector<double> coordinate_dofs;
+  dolfin_cell.get_coordinate_dofs(coordinate_dofs);
 
   // Restrict function to cell
   restrict(coefficients.data(), element, dolfin_cell,
-           vertex_coordinates.data(), ufc_cell);
+           coordinate_dofs.data(), ufc_cell);
 
   // Create work vector for basis
   std::vector<double> basis(value_size_loc);
@@ -434,7 +374,7 @@ void Function::eval(Array<double>& values, const Array<double>& x,
   for (std::size_t i = 0; i < element.space_dimension(); ++i)
   {
     element.evaluate_basis(i, basis.data(), x.data(),
-                           vertex_coordinates.data(),
+                           coordinate_dofs.data(),
                            ufc_cell.orientation);
     for (std::size_t j = 0; j < value_size_loc; ++j)
       values[j] += coefficients[i]*basis[j];
@@ -489,19 +429,9 @@ void Function::eval(Array<double>& values,
     eval(values, x);
 }
 //-----------------------------------------------------------------------------
-void Function::non_matching_eval(Array<double>& values,
-                                 const Array<double>& x,
-                                 const ufc::cell& ufc_cell) const
-{
-  deprecation("Function::non_matching_eval(values, x, ufc_cell)", "1.6.0", "1.7.0",
-              "Please use Function::eval(values, x) instead");
-
-  eval(values, x);
-}
-//-----------------------------------------------------------------------------
 void Function::restrict(double* w, const FiniteElement& element,
                         const Cell& dolfin_cell,
-                        const double* vertex_coordinates,
+                        const double* coordinate_dofs,
                         const ufc::cell& ufc_cell) const
 {
   dolfin_assert(w);
@@ -517,22 +447,14 @@ void Function::restrict(double* w, const FiniteElement& element,
     const ArrayView<const dolfin::la_index> dofs
       = dofmap.cell_dofs(dolfin_cell.index());
 
-    if (!dofs.empty())
-    {
-      // Note: We should have dofmap.max_element_dofs() == dofs.size() here.
-      // Pick values from vector(s)
-      _vector->get_local(w, dofs.size(), dofs.data());
-    }
-    else
-    {
-      // Set dofs to zero (zero extension of function space on a Restriction)
-      memset(w, 0, sizeof(*w)*dofmap.max_element_dofs());
-    }
+    // Note: We should have dofmap.max_element_dofs() == dofs.size() here.
+    // Pick values from vector(s)
+    _vector->get_local(w, dofs.size(), dofs.data());
   }
   else
   {
     // Restrict as UFC function (by calling eval)
-    restrict_as_ufc_function(w, element, dolfin_cell, vertex_coordinates,
+    restrict_as_ufc_function(w, element, dolfin_cell, coordinate_dofs,
                              ufc_cell);
   }
 }
@@ -576,21 +498,21 @@ void Function::compute_vertex_values(std::vector<double>& vertex_values,
   // Interpolate vertex values on each cell (using last computed value
   // if not continuous, e.g. discontinuous Galerkin methods)
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   for (CellIterator cell(mesh, "all"); !cell.end(); ++cell)
   {
     // Update to current cell
-    cell->get_vertex_coordinates(vertex_coordinates);
+    cell->get_coordinate_dofs(coordinate_dofs);
     cell->get_cell_data(ufc_cell);
 
     // Pick values from global vector
-    restrict(coefficients.data(), element, *cell, vertex_coordinates.data(),
+    restrict(coefficients.data(), element, *cell, coordinate_dofs.data(),
              ufc_cell);
 
     // Interpolate values at the vertices
     element.interpolate_vertex_values(cell_vertex_values.data(),
                                       coefficients.data(),
-                                      vertex_coordinates.data(),
+                                      coordinate_dofs.data(),
                                       ufc_cell.orientation,
                                       ufc_cell);
 
@@ -618,97 +540,47 @@ void Function::init_vector()
 {
   Timer timer("Init dof vector");
 
-  // Check that function space is not a subspace (view)
+  // Get dof map
   dolfin_assert(_function_space);
-  if (_function_space->dofmap()->is_view())
+  dolfin_assert(_function_space->dofmap());
+  const GenericDofMap& dofmap = *(_function_space->dofmap());
+
+  // Check that function space is not a subspace (view)
+  if (dofmap.is_view())
   {
     dolfin_error("Function.cpp",
                  "initialize vector of degrees of freedom for function",
-                 "Cannot be created from subspace. Consider collapsing the function space");
+                 "Cannot be created from subspace. Consider collapsing the "
+                 "function space");
   }
 
-  // Get dof map
-  dolfin_assert(_function_space->dofmap());
-  const GenericDofMap& dofmap = *(_function_space->dofmap());
+  // Get index map
+  std::shared_ptr<const IndexMap> index_map = dofmap.index_map();
+  dolfin_assert(index_map);
 
-  // Get local range
-  const std::pair<std::size_t, std::size_t> range = dofmap.ownership_range();
+  DefaultFactory factory;
 
-  // Determine ghost vertices if dof map is distributed
-  const std::size_t bs = dofmap.block_size;
-  std::vector<la_index>
-    ghost_indices(bs*dofmap.local_to_global_unowned().size());
-  for (std::size_t i = 0; i < dofmap.local_to_global_unowned().size(); ++i)
-    for (std::size_t j = 0; j < bs; ++j)
-      ghost_indices[bs*i + j] = bs*dofmap.local_to_global_unowned()[i] + j;
+  // Create layout for initialising tensor
+  std::shared_ptr<TensorLayout> tensor_layout;
+  tensor_layout = factory.create_layout(1);
+  dolfin_assert(tensor_layout);
+  dolfin_assert(!tensor_layout->sparsity_pattern());
+  dolfin_assert(_function_space->mesh());
+  tensor_layout->init(_function_space->mesh()->mpi_comm(), {index_map},
+                      TensorLayout::Ghosts::GHOSTED);
 
   // Create vector of dofs
   if (!_vector)
-  {
-    DefaultFactory factory;
-    _vector = factory.create_vector();
-  }
+    _vector = factory.create_vector(_function_space->mesh()->mpi_comm());
   dolfin_assert(_vector);
-
-  // Tabulate local-to-global map for dofs
-  std::vector<std::size_t> local_to_global_map;
-  dofmap.tabulate_local_to_global_dofs(local_to_global_map);
-
-  // Initialize vector of dofs
-  dolfin_assert(_function_space->mesh());
-  if (_vector->empty())
-  {
-    _vector->init(_function_space->mesh()->mpi_comm(), range,
-                  local_to_global_map, ghost_indices);
-  }
-  else
+  if (!_vector->empty())
   {
     dolfin_error("Function.cpp",
                  "initialize vector of degrees of freedom for function",
                  "Cannot re-initialize a non-empty vector. Consider creating a new function");
 
   }
+  _vector->init(*tensor_layout);
   _vector->zero();
 }
 //-----------------------------------------------------------------------------
-void
-Function::compute_ghost_indices(std::pair<std::size_t, std::size_t> range,
-                                std::vector<la_index>& ghost_indices) const
-{
-  // Clear data
-  ghost_indices.clear();
-
-  // Get mesh
-  dolfin_assert(_function_space);
-  dolfin_assert(_function_space->mesh());
-  const Mesh& mesh = *_function_space->mesh();
-
-  // Get dof map
-  dolfin_assert(_function_space->dofmap());
-  const GenericDofMap& dofmap = *(_function_space->dofmap());
-
-  // Get local range
-  const std::size_t n0 = range.first;
-  const std::size_t n1 = range.second;
-
-  // Iterate over local mesh and check which dofs are needed
-  for (CellIterator cell(mesh); !cell.end(); ++cell)
-  {
-    // Get dofs on cell
-    auto dofs = dofmap.cell_dofs(cell->index());
-    for (std::size_t d = 0; d < dofs.size(); ++d)
-    {
-      const std::size_t dof = dofs[d];
-      if (dof < n0 || dof >= n1)
-      {
-        // FIXME: Could we use dolfin::Set here? Or unordered_set?
-        if (std::find(ghost_indices.begin(), ghost_indices.end(), dof)
-            == ghost_indices.end())
-        {
-          ghost_indices.push_back(dof);
-        }
-      }
-    }
-  }
-}
-//-----------------------------------------------------------------------------
diff --git a/dolfin/function/Function.h b/dolfin/function/Function.h
index 5bc5cf2..d773ee8 100644
--- a/dolfin/function/Function.h
+++ b/dolfin/function/Function.h
@@ -64,19 +64,6 @@ namespace dolfin
   {
   public:
 
-    /// Create function on given function space
-    ///
-    /// *Arguments*
-    ///     V (_FunctionSpace_)
-    ///         The function space.
-    ///
-    /// *Example*
-    ///     .. code-block:: c++
-    ///
-    ///         Function u(V);
-    ///
-    explicit Function(const FunctionSpace& V);
-
     /// Create function on given function space (shared data)
     ///
     /// *Arguments*
@@ -97,17 +84,6 @@ namespace dolfin
     Function(std::shared_ptr<const FunctionSpace> V,
              std::shared_ptr<GenericVector> x);
 
-    /// Create function from vector of dofs stored to file
-    ///
-    /// *Arguments*
-    ///     V (_FunctionSpace_)
-    ///         The function space.
-    ///     filename_vector (std::string)
-    ///         The name of the file containing the vector.
-    ///     filename_dofdata (std::string)
-    ///         The name of the file containing the dofmap data.
-    Function(const FunctionSpace& V, std::string filename);
-
     /// Create function from vector of dofs stored to file (shared data)
     ///
     /// *Arguments*
@@ -217,7 +193,11 @@ namespace dolfin
     /// *Returns*
     ///     _FunctionSpace_
     ///         Return the shared pointer.
-    std::shared_ptr<const FunctionSpace> function_space() const;
+    virtual std::shared_ptr<const FunctionSpace> function_space() const
+    {
+      dolfin_assert(_function_space);
+      return _function_space;
+    }
 
     /// Return vector of expansion coefficients (non-const version)
     ///
@@ -271,10 +251,8 @@ namespace dolfin
     ///         The cell.
     ///     ufc_cell (ufc::cell)
     ///         The ufc::cell.
-    void eval(Array<double>& values,
-              const Array<double>& x,
-              const Cell& dolfin_cell,
-              const ufc::cell& ufc_cell) const;
+    void eval(Array<double>& values, const Array<double>& x,
+              const Cell& dolfin_cell, const ufc::cell& ufc_cell) const;
 
     /// Interpolate function (on possibly non-matching meshes)
     ///
@@ -322,20 +300,6 @@ namespace dolfin
     virtual void eval(Array<double>& values, const Array<double>& x,
                       const ufc::cell& cell) const;
 
-    /// Evaluate function for given data (non-matching meshes)
-    /// This method is deprecated as of dolfin 1.6.0.
-    /// Please use eval(values, x) instead.
-    ///
-    /// *Arguments*
-    ///     values (_Array_ <double>)
-    ///         The values at the point.
-    ///     x (_Array_ <double>)
-    ///         The coordinates of the point.
-    ///     cell (ufc::cell)
-    ///         The cell.
-    void non_matching_eval(Array<double>& values, const Array<double>& x,
-                           const ufc::cell& ufc_cell) const;
-
     /// Restrict function to local cell (compute expansion coefficients w)
     ///
     /// *Arguments*
@@ -350,7 +314,7 @@ namespace dolfin
     virtual void restrict(double* w,
                           const FiniteElement& element,
                           const Cell& dolfin_cell,
-                          const double* vertex_coordinates,
+                          const double* coordinate_dofs,
                           const ufc::cell& ufc_cell) const;
 
     /// Compute values at all mesh vertices
@@ -395,16 +359,9 @@ namespace dolfin
     // Collection of sub-functions which share data with the function
     mutable boost::ptr_map<std::size_t, Function> _sub_functions;
 
-    // Compute lists of off-process dofs
-    void compute_off_process_dofs() const;
-
     // Initialize vector
     void init_vector();
 
-    // Get coefficients from the vector(s)
-    void compute_ghost_indices(std::pair<std::size_t, std::size_t> range,
-                               std::vector<la_index>& ghost_indices) const;
-
     // The function space
     std::shared_ptr<const FunctionSpace> _function_space;
 
diff --git a/dolfin/function/FunctionAXPY.cpp b/dolfin/function/FunctionAXPY.cpp
index 4a1652e..489757e 100644
--- a/dolfin/function/FunctionAXPY.cpp
+++ b/dolfin/function/FunctionAXPY.cpp
@@ -46,17 +46,17 @@ FunctionAXPY::FunctionAXPY(const Function& func0, const Function& func1,
                  "Expected Functions to be in the same FunctionSpace");
   }
 
-  const double scale0 = direction % 2 == 0 ? 1.0 : -1.0;
+  const double scale0 = static_cast<int>(direction) % 2 == 0 ? 1.0 : -1.0;
   _pairs.push_back(std::make_pair(scale0, &func0));
 
-  const double scale1 = direction < 2 ? 1.0 : -1.0;
+  const double scale1 = static_cast<int>(direction) < 2 ? 1.0 : -1.0;
   _pairs.push_back(std::make_pair(scale1, &func1));
 }
 //-----------------------------------------------------------------------------
 FunctionAXPY::FunctionAXPY(const FunctionAXPY& axpy, const Function& func,
 			   Direction direction) : _pairs()
 {
-  _register(axpy, direction % 2 == 0 ? 1.0 : -1.0);
+  _register(axpy, static_cast<int>(direction) % 2 == 0 ? 1.0 : -1.0);
   if (_pairs.size()>0 && !_pairs[0].second->in(*func.function_space()))
   {
     dolfin_error("FunctionAXPY.cpp",
@@ -64,7 +64,7 @@ FunctionAXPY::FunctionAXPY(const FunctionAXPY& axpy, const Function& func,
                  "Expected Functions to have the same FunctionSpace");
   }
 
-  const double scale = direction < 2 ? 1.0 : -1.0;
+  const double scale = static_cast<int>(direction) < 2 ? 1.0 : -1.0;
   _pairs.push_back(std::make_pair(scale, &func));
 }
 //-----------------------------------------------------------------------------
@@ -72,8 +72,8 @@ FunctionAXPY::FunctionAXPY(const FunctionAXPY& axpy0,
                            const FunctionAXPY& axpy1,
 			   Direction direction) : _pairs()
 {
-  _register(axpy0, direction % 2 == 0 ? 1.0 : -1.0);
-  _register(axpy1, direction < 2 ? 1.0 : -1.0);
+  _register(axpy0, static_cast<int>(direction) % 2 == 0 ? 1.0 : -1.0);
+  _register(axpy1, static_cast<int>(direction) < 2 ? 1.0 : -1.0);
 }
 //-----------------------------------------------------------------------------
 FunctionAXPY::FunctionAXPY(const FunctionAXPY& axpy) : _pairs(axpy._pairs)
@@ -87,24 +87,29 @@ FunctionAXPY::FunctionAXPY(std::vector<std::pair<double,
   // Do nothing
 }
 //-----------------------------------------------------------------------------
+FunctionAXPY::~FunctionAXPY()
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
 FunctionAXPY FunctionAXPY::operator+(const Function& func) const
 {
-  return FunctionAXPY(*this, func, FunctionAXPY::ADD_ADD);
+  return FunctionAXPY(*this, func, Direction::ADD_ADD);
 }
 //-----------------------------------------------------------------------------
 FunctionAXPY FunctionAXPY::operator+(const FunctionAXPY& axpy) const
 {
-  return FunctionAXPY(*this, axpy, FunctionAXPY::ADD_ADD);
+  return FunctionAXPY(*this, axpy, Direction::ADD_ADD);
 }
 //-----------------------------------------------------------------------------
 FunctionAXPY FunctionAXPY::operator-(const Function& func) const
 {
-  return FunctionAXPY(*this, func, FunctionAXPY::ADD_SUB);
+  return FunctionAXPY(*this, func, Direction::ADD_SUB);
 }
 //-----------------------------------------------------------------------------
 FunctionAXPY FunctionAXPY::operator-(const FunctionAXPY& axpy) const
 {
-  return FunctionAXPY(*this, axpy, FunctionAXPY::ADD_SUB);
+  return FunctionAXPY(*this, axpy, Direction::ADD_SUB);
 }
 //-----------------------------------------------------------------------------
 const std::vector<std::pair<double, const Function*>>&
diff --git a/dolfin/function/FunctionAXPY.h b/dolfin/function/FunctionAXPY.h
index e485d5a..32d1a6c 100644
--- a/dolfin/function/FunctionAXPY.h
+++ b/dolfin/function/FunctionAXPY.h
@@ -29,6 +29,9 @@ namespace dolfin
 
   class Function;
 
+  // FIXME: Straighten out memory management in this class by
+  // switching to smart pointers.
+
   /// This class represents a linear combination of functions. It is
   /// mostly used as an intermediate class for operations such as u =
   /// 3*u0 + 4*u1; where the rhs generates an FunctionAXPY.
@@ -38,13 +41,7 @@ namespace dolfin
   public:
 
     /// Enum to decide what way AXPY is constructed
-    enum Direction
-    {
-      ADD_ADD = 0,
-      SUB_ADD = 1,
-      ADD_SUB = 2,
-      SUB_SUB = 3
-    };
+    enum class Direction : int {ADD_ADD=0, SUB_ADD=1, ADD_SUB=2, SUB_SUB=3};
 
     /// Constructor
     FunctionAXPY(const Function& func, double scalar);
@@ -70,6 +67,9 @@ namespace dolfin
     /// Copy constructor
     FunctionAXPY(const FunctionAXPY& axpy);
 
+    /// Destructor
+    ~FunctionAXPY();
+
     /// Addition operator
     FunctionAXPY operator+(const Function& func) const;
 
@@ -96,7 +96,7 @@ namespace dolfin
     /// Register another AXPY object
     void _register(const FunctionAXPY& axpy0, double scale);
 
-    std::vector<std::pair<double, const Function*> > _pairs;
+    std::vector<std::pair<double, const Function*>> _pairs;
 
   };
 
diff --git a/dolfin/function/FunctionAssigner.cpp b/dolfin/function/FunctionAssigner.cpp
index ebdc855..58dbe4c 100644
--- a/dolfin/function/FunctionAssigner.cpp
+++ b/dolfin/function/FunctionAssigner.cpp
@@ -18,16 +18,15 @@
 // First added:  2013-09-20
 // Last changed: 2014-02-28
 
-#include <utility>
-
 #include <map>
+#include <utility>
 #include <dolfin/common/types.h>
-#include <dolfin/log/log.h>
-#include <dolfin/mesh/Mesh.h>
-#include <dolfin/mesh/Cell.h>
 #include <dolfin/fem/GenericDofMap.h>
 #include <dolfin/function/FunctionSpace.h>
 #include <dolfin/la/GenericVector.h>
+#include <dolfin/log/log.h>
+#include <dolfin/mesh/Cell.h>
+#include <dolfin/mesh/Mesh.h>
 #include "FunctionAssigner.h"
 
 using namespace dolfin;
@@ -424,17 +423,17 @@ void FunctionAssigner::_check_and_build_indices(
     const GenericDofMap& receiving_dofmap = *receiving_spaces[i]->dofmap();
 
     // Get on-process dof ranges
-    const std::size_t bs_assigning = assigning_dofmap.block_size;
+    const std::size_t bs_assigning = assigning_dofmap.block_size();
     const std::size_t assigning_range
       = assigning_dofmap.ownership_range().second
       - assigning_dofmap.ownership_range().first
-      + bs_assigning*assigning_dofmap.local_to_global_unowned().size();
+      + bs_assigning*assigning_dofmap.index_map()->local_to_global_unowned().size();
 
-    const std::size_t bs_receiving = receiving_dofmap.block_size;
+    const std::size_t bs_receiving = receiving_dofmap.block_size();
     const std::size_t receiving_range
       = (receiving_dofmap.ownership_range().second
          - receiving_dofmap.ownership_range().first)
-      + bs_receiving*receiving_dofmap.local_to_global_unowned().size();
+      + bs_receiving*receiving_dofmap.index_map()->local_to_global_unowned().size();
 
     // Create a map between receiving and assigning dofs
     std::map<std::size_t, std::size_t> receiving_assigning_map;
diff --git a/dolfin/function/FunctionSpace.cpp b/dolfin/function/FunctionSpace.cpp
index 074a6e8..9b66442 100644
--- a/dolfin/function/FunctionSpace.cpp
+++ b/dolfin/function/FunctionSpace.cpp
@@ -22,7 +22,7 @@
 // Modified by Ola Skavhaug, 2009.
 //
 // First added:  2008-09-11
-// Last changed: 2014-06-11
+// Last changed: 2015-11-12
 
 #include <vector>
 #include <dolfin/common/utils.h>
@@ -121,6 +121,88 @@ std::size_t FunctionSpace::dim() const
   return _dofmap->global_dimension();
 }
 //-----------------------------------------------------------------------------
+void
+FunctionSpace::interpolate_from_parent(GenericVector& expansion_coefficients,
+                                       const GenericFunction& v) const
+{
+  info("Interpolate from parent to child");
+
+  std::shared_ptr<const FunctionSpace> v_fs = v.function_space();
+
+  // Initialize local arrays
+  std::vector<double> cell_coefficients(_dofmap->max_element_dofs());
+
+  // Iterate over mesh and interpolate on each cell
+  std::vector<double> coordinate_dofs;
+  std::size_t tdim = _mesh->topology().dim();
+  const std::vector<std::size_t>& child_to_parent = _mesh->data().array("parent_cell", tdim);
+
+  for (CellIterator cell(*_mesh); !cell.end(); ++cell)
+  {
+    // Update to current cell
+    cell->get_coordinate_dofs(coordinate_dofs);
+
+    // Get cell orientation
+    int cell_orientation = -1;
+    if (!_mesh->cell_orientations().empty())
+    {
+      dolfin_assert(cell->index() < _mesh->cell_orientations().size());
+      cell_orientation = _mesh->cell_orientations()[cell->index()];
+    }
+
+    Cell parent_cell(*v_fs->mesh(), child_to_parent[cell->index()]);
+    ufc::cell ufc_parent;
+    parent_cell.get_cell_data(ufc_parent);
+
+    // Evaluate on parent cell on which v is defined
+    _element->evaluate_dofs(cell_coefficients.data(), v,
+                            coordinate_dofs.data(),
+                            cell_orientation,
+                            ufc_parent);
+
+    // Tabulate dofs - map from cell to vector
+    const ArrayView<const dolfin::la_index> cell_dofs
+      = _dofmap->cell_dofs(cell->index());
+
+    // Copy dofs to vector
+    expansion_coefficients.set_local(cell_coefficients.data(),
+                                     _dofmap->num_element_dofs(cell->index()),
+                                     cell_dofs.data());
+  }
+
+}
+//-----------------------------------------------------------------------------
+void FunctionSpace::interpolate_from_any(GenericVector& expansion_coefficients,
+                                         const GenericFunction& v) const
+{
+  // Initialize local arrays
+  std::vector<double> cell_coefficients(_dofmap->max_element_dofs());
+
+  // Iterate over mesh and interpolate on each cell
+  ufc::cell ufc_cell;
+  std::vector<double> coordinate_dofs;
+  for (CellIterator cell(*_mesh); !cell.end(); ++cell)
+  {
+    // Update to current cell
+    cell->get_coordinate_dofs(coordinate_dofs);
+    cell->get_cell_data(ufc_cell);
+
+    // Restrict function to cell
+    v.restrict(cell_coefficients.data(), *_element, *cell,
+               coordinate_dofs.data(), ufc_cell);
+
+    // Tabulate dofs
+    const ArrayView<const dolfin::la_index> cell_dofs
+      = _dofmap->cell_dofs(cell->index());
+
+    // Copy dofs to vector
+    expansion_coefficients.set_local(cell_coefficients.data(),
+                                     _dofmap->num_element_dofs(cell->index()),
+                                     cell_dofs.data());
+  }
+
+}
+//-----------------------------------------------------------------------------
 void FunctionSpace::interpolate(GenericVector& expansion_coefficients,
                                 const GenericFunction& v) const
 {
@@ -158,31 +240,18 @@ void FunctionSpace::interpolate(GenericVector& expansion_coefficients,
   }
   expansion_coefficients.zero();
 
-  // Initialize local arrays
-  std::vector<double> cell_coefficients(_dofmap->max_element_dofs());
+  std::shared_ptr<const FunctionSpace> v_fs = v.function_space();
 
-  // Iterate over mesh and interpolate on each cell
-  ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
-  for (CellIterator cell(*_mesh); !cell.end(); ++cell)
+  // Interpolate from parent to child
+  // should also work in parallel provided "parent_cell" data exists
+  if (v_fs and _mesh->has_parent()
+      and v_fs->mesh()->id() == _mesh->parent().id()
+      and _mesh->data().exists("parent_cell", _mesh->topology().dim()))
   {
-    // Update to current cell
-    cell->get_vertex_coordinates(vertex_coordinates);
-    cell->get_cell_data(ufc_cell);
-
-    // Restrict function to cell
-    v.restrict(cell_coefficients.data(), *_element, *cell,
-               vertex_coordinates.data(), ufc_cell);
-
-    // Tabulate dofs
-    const ArrayView<const dolfin::la_index> cell_dofs
-      = _dofmap->cell_dofs(cell->index());
-
-    // Copy dofs to vector
-    expansion_coefficients.set_local(cell_coefficients.data(),
-                                     _dofmap->num_element_dofs(cell->index()),
-                                     cell_dofs.data());
+    interpolate_from_parent(expansion_coefficients, v);
   }
+  else
+    interpolate_from_any(expansion_coefficients, v);
 
   // Finalise changes
   expansion_coefficients.apply("insert");
@@ -269,6 +338,97 @@ std::vector<std::size_t> FunctionSpace::component() const
   return _component;
 }
 //-----------------------------------------------------------------------------
+std::vector<double> FunctionSpace::tabulate_dof_coordinates() const
+{
+  // Geometric dimension
+  dolfin_assert(_mesh);
+  dolfin_assert(_element);
+  const std::size_t gdim = _element->geometric_dimension();
+  dolfin_assert(gdim == _mesh->geometry().dim());
+
+  if (!_component.empty())
+  {
+    dolfin_error("FunctionSpace.cpp",
+                 "tabulate_dof_coordinates",
+                 "Cannot tabulate coordinates for a FunctionSpace that is a subspace.");
+  }
+
+  // Get local size
+  dolfin_assert(_dofmap);
+  std::size_t local_size
+    = _dofmap->index_map()->size(IndexMap::MapSize::OWNED);
+
+  // Vector to hold coordinates and return
+  std::vector<double> x(gdim*local_size);
+
+  // Loop over cells and tabulate dofs
+  boost::multi_array<double, 2> coordinates;
+  std::vector<double> coordinate_dofs;
+  for (CellIterator cell(*_mesh); !cell.end(); ++cell)
+  {
+    // Update UFC cell
+    cell->get_coordinate_dofs(coordinate_dofs);
+
+    // Get local-to-global map
+    const ArrayView<const dolfin::la_index> dofs
+      = _dofmap->cell_dofs(cell->index());
+
+    // Tabulate dof coordinates on cell
+    _element->tabulate_dof_coordinates(coordinates, coordinate_dofs, *cell);
+
+    // Copy dof coordinates into vector
+    for (std::size_t i = 0; i < dofs.size(); ++i)
+    {
+      const dolfin::la_index dof = dofs[i];
+      if (dof < (dolfin::la_index) local_size)
+      {
+        const dolfin::la_index local_index = dof;
+        for (std::size_t j = 0; j < gdim; ++j)
+        {
+          dolfin_assert(gdim*local_index + j < x.size());
+          x[gdim*local_index + j] = coordinates[i][j];
+        }
+      }
+    }
+  }
+
+  return x;
+}
+//-----------------------------------------------------------------------------
+void FunctionSpace::set_x(GenericVector& x, double value,
+                          std::size_t component) const
+{
+  dolfin_assert(_mesh);
+  dolfin_assert(_dofmap);
+  dolfin_assert(_element);
+
+  std::vector<double> x_values;
+  boost::multi_array<double, 2> coordinates;
+  std::vector<double> coordinate_dofs;
+  for (CellIterator cell(*_mesh); !cell.end(); ++cell)
+  {
+    // Update UFC cell
+    cell->get_coordinate_dofs(coordinate_dofs);
+
+    // Get cell local-to-global map
+    const ArrayView<const dolfin::la_index> dofs
+      = _dofmap->cell_dofs(cell->index());
+
+    // Tabulate dof coordinates
+    _element->tabulate_dof_coordinates(coordinates, coordinate_dofs, *cell);
+    dolfin_assert(coordinates.shape()[0] == dofs.size());
+    dolfin_assert(component < coordinates.shape()[1]);
+
+    // Copy coordinate (it may be possible to avoid this)
+    x_values.resize(dofs.size());
+    for (std::size_t i = 0; i < coordinates.shape()[0]; ++i)
+      x_values[i] = value*coordinates[i][component];
+
+    // Set x[component] values in vector
+    x.set_local(x_values.data(), dofs.size(), dofs.data());
+  }
+}
+//-----------------------------------------------------------------------------
 std::string FunctionSpace::str(bool verbose) const
 {
   std::stringstream s;
diff --git a/dolfin/function/FunctionSpace.h b/dolfin/function/FunctionSpace.h
index 8896dcf..67df13c 100644
--- a/dolfin/function/FunctionSpace.h
+++ b/dolfin/function/FunctionSpace.h
@@ -180,6 +180,29 @@ namespace dolfin
     /// Extract subspace for component
     ///
     /// *Arguments*
+    ///     component (std::size_t)
+    ///         Index of the subspace.
+    /// *Returns*
+    ///     _FunctionSpace_
+    ///         The subspace.
+    std::shared_ptr<FunctionSpace> sub(std::size_t component) const
+    { return extract_sub_space({component}); }
+
+    /// Extract subspace for component
+    ///
+    /// *Arguments*
+    ///     component (std::vector<std::size_t>)
+    ///         The component.
+    /// *Returns*
+    ///     _FunctionSpace_
+    ///         The subspace.
+    std::shared_ptr<FunctionSpace>
+    sub(const std::vector<std::size_t>& component) const
+    { return extract_sub_space(component); }
+
+    /// Extract subspace for component
+    ///
+    /// *Arguments*
     ///     component (std::vector<std::size_t>)
     ///         The component.
     ///
@@ -240,6 +263,37 @@ namespace dolfin
     ///         The component (relative to superspace).
     std::vector<std::size_t> component() const;
 
+    /// Tabulate the coordinates of all dofs on this process. This
+    /// function is typically used by preconditioners that require the
+    /// spatial coordinates of dofs, for example for re-partitioning or
+    /// nullspace computations.
+    ///
+    /// *Arguments*
+    ///     mesh (_Mesh_)
+    ///         The mesh.
+    ///
+    /// *Returns*
+    ///     std::vector<double>
+    ///         The dof coordinates (x0, y0, x1, y1, . . .)
+    std::vector<double> tabulate_dof_coordinates() const;
+
+    /// Set dof entries in vector to value*x[i], where [x][i] is the
+    /// coordinate of the dof spatial coordinate. Parallel layout of
+    /// vector must be consistent with dof map range This function is
+    /// typically used to construct the null space of a matrix
+    /// operator, e.g. rigid body rotations.
+    ///
+    /// *Arguments*
+    ///     vector (_GenericVector_)
+    ///         The vector to set.
+    ///     value (double)
+    ///         The value to multiply to coordinate by.
+    ///     component (std::size_t)
+    ///         The coordinate index.
+    ///     mesh (_Mesh_)
+    ///         The mesh.
+    void set_x(GenericVector& x, double value, std::size_t component) const;
+
     /// Return informal string representation (pretty-print)
     ///
     /// *Arguments*
@@ -256,6 +310,15 @@ namespace dolfin
 
   private:
 
+    // General interpolation from any GenericFunction on any mesh
+    void interpolate_from_any(GenericVector& expansion_coefficients,
+                              const GenericFunction& v) const;
+
+    // Specialised interpolate routine when functions are related by a
+    // parent mesh
+    void interpolate_from_parent(GenericVector& expansion_coefficients,
+                                 const GenericFunction& v) const;
+
     // The mesh
     std::shared_ptr<const Mesh> _mesh;
 
@@ -270,7 +333,7 @@ namespace dolfin
 
     // Cache of subspaces
     mutable std::map<std::vector<std::size_t>,
-      std::shared_ptr<FunctionSpace> > _subspaces;
+                     std::shared_ptr<FunctionSpace> > _subspaces;
 
   };
 
diff --git a/dolfin/function/GenericFunction.cpp b/dolfin/function/GenericFunction.cpp
index 4d3dfed..1c593e0 100644
--- a/dolfin/function/GenericFunction.cpp
+++ b/dolfin/function/GenericFunction.cpp
@@ -192,13 +192,13 @@ void GenericFunction::evaluate(double* values,
 void GenericFunction::restrict_as_ufc_function(double* w,
                                                const FiniteElement& element,
                                                const Cell& dolfin_cell,
-                                               const double* vertex_coordinates,
+                                               const double* coordinate_dofs,
                                                const ufc::cell& ufc_cell) const
 {
   dolfin_assert(w);
 
   // Evaluate dofs to get the expansion coefficients
-  element.evaluate_dofs(w, *this, vertex_coordinates, ufc_cell.orientation,
+  element.evaluate_dofs(w, *this, coordinate_dofs, ufc_cell.orientation,
                         ufc_cell);
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/function/GenericFunction.h b/dolfin/function/GenericFunction.h
index 8793da7..b8bc387 100644
--- a/dolfin/function/GenericFunction.h
+++ b/dolfin/function/GenericFunction.h
@@ -23,6 +23,7 @@
 #ifndef __GENERIC_FUNCTION_H
 #define __GENERIC_FUNCTION_H
 
+#include <memory>
 #include <ufc.h>
 #include <dolfin/common/Array.h>
 #include <dolfin/common/Variable.h>
@@ -34,6 +35,7 @@ namespace dolfin
   class Cell;
   class Point;
   class FiniteElement;
+  class FunctionSpace;
 
   /// This is a common base class for functions. Functions can be
   /// evaluated at a given point and they can be restricted to a given
@@ -75,7 +77,7 @@ namespace dolfin
     virtual void restrict(double* w,
                           const FiniteElement& element,
                           const Cell& dolfin_cell,
-                          const double* vertex_coordinates,
+                          const double* coordinate_dofs,
                           const ufc::cell& ufc_cell) const = 0;
 
     /// Compute values at all mesh vertices
@@ -125,13 +127,16 @@ namespace dolfin
                           const double* coordinates,
                           const ufc::cell& cell) const;
 
+    // Pointer to FunctionSpace, if appropriate, otherwise NULL
+    virtual std::shared_ptr<const FunctionSpace> function_space() const = 0;
+
   protected:
 
     // Restrict as UFC function (by calling eval)
     void restrict_as_ufc_function(double* w,
                                   const FiniteElement& element,
                                   const Cell& dolfin_cell,
-                                  const double* vertex_coordinates,
+                                  const double* coordinate_dofs,
                                   const ufc::cell& ufc_cell) const;
 
   };
diff --git a/dolfin/function/LagrangeInterpolator.cpp b/dolfin/function/LagrangeInterpolator.cpp
index 04b4b43..cc9c4e3 100644
--- a/dolfin/function/LagrangeInterpolator.cpp
+++ b/dolfin/function/LagrangeInterpolator.cpp
@@ -74,13 +74,9 @@ void LagrangeInterpolator::interpolate(Function& u, const Expression& u0)
   // Create vector to hold all local values of u
   std::vector<double> local_u_vector(u.vector()->local_size());
 
-  // Get dofmap of this Function
-  dolfin_assert(V.dofmap());
-  const GenericDofMap& dofmap = *V.dofmap();
-
   // Create map from coordinates to dofs sharing that coordinate
   const std::map<std::vector<double>, std::vector<std::size_t>, lt_coordinate>
-    coords_to_dofs = tabulate_coordinates_to_dofs(dofmap, mesh);
+    coords_to_dofs = tabulate_coordinates_to_dofs(V);
 
   // Get a map from global dofs to component number in mixed space
   std::unordered_map<std::size_t, std::size_t> dof_component_map;
@@ -193,13 +189,9 @@ void LagrangeInterpolator::interpolate(Function& u, const Function& u0)
   // Create vector to hold all local values of u
   std::vector<double> local_u_vector(u.vector()->local_size());
 
-  // Get dofmap of u
-  dolfin_assert(V1.dofmap());
-  const GenericDofMap& dofmap = *V1.dofmap();
-
   // Create map from coordinates to dofs sharing that coordinate
   std::map<std::vector<double>, std::vector<std::size_t>, lt_coordinate>
-    coords_to_dofs = tabulate_coordinates_to_dofs(dofmap, mesh1);
+    coords_to_dofs = tabulate_coordinates_to_dofs(V1);
 
   // Get a map from global dofs to component number in mixed space
   std::unordered_map<std::size_t, std::size_t> dof_component_map;
@@ -325,37 +317,45 @@ void LagrangeInterpolator::interpolate(Function& u, const Function& u0)
   u.vector()->apply("insert");
 }
 //-----------------------------------------------------------------------------
-std::map<std::vector<double>, std::vector<std::size_t>, lt_coordinate>
-LagrangeInterpolator::tabulate_coordinates_to_dofs(const GenericDofMap& dofmap,
-                                                   const Mesh& mesh)
+std::map<std::vector<double>, std::vector<std::size_t>,
+         LagrangeInterpolator::lt_coordinate>
+LagrangeInterpolator::tabulate_coordinates_to_dofs(const FunctionSpace& V)
 {
   std::map<std::vector<double>, std::vector<std::size_t>, lt_coordinate>
     coords_to_dofs(lt_coordinate(1.0e-12));
 
+  // Extract mesh, dofmap and element
+  dolfin_assert(V.dofmap());
+  dolfin_assert(V.element());
+  dolfin_assert(V.mesh());
+  const GenericDofMap& dofmap = *V.dofmap();
+  const FiniteElement& element = *V.element();
+  const Mesh& mesh = *V.mesh();
+
   // Geometric dimension
   const std::size_t gdim = mesh.geometry().dim();
 
   // Loop over cells and tabulate dofs
   boost::multi_array<double, 2> coordinates;
-  std::vector<double> vertex_coordinates;
+  std::vector<double> coordinate_dofs;
   std::vector<double> coors(gdim);
 
   // Speed up the computations by only visiting (most) dofs once
   const std::size_t local_size = dofmap.ownership_range().second
-                               - dofmap.ownership_range().first;
+    - dofmap.ownership_range().first;
   RangedIndexSet already_visited(std::make_pair(0, local_size));
 
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
     // Update UFC cell
-    cell->get_vertex_coordinates(vertex_coordinates);
+    cell->get_coordinate_dofs(coordinate_dofs);
 
     // Get local-to-global map
     const ArrayView<const dolfin::la_index> dofs
       = dofmap.cell_dofs(cell->index());
 
     // Tabulate dof coordinates on cell
-    dofmap.tabulate_coordinates(coordinates, vertex_coordinates, *cell);
+    element.tabulate_dof_coordinates(coordinates, coordinate_dofs, *cell);
 
     // Map dofs into coords_to_dofs
     for (std::size_t i = 0; i < dofs.size(); ++i)
@@ -388,7 +388,6 @@ LagrangeInterpolator::extract_dof_component_map(std::unordered_map<std::size_t,
                                                 int* component)
 {
   // Extract sub dofmaps recursively and store dof to component map
-
   if (V.element()->num_sub_elements() == 0)
   {
     std::unordered_map<std::size_t, std::size_t> collapsed_map;
@@ -409,9 +408,10 @@ LagrangeInterpolator::extract_dof_component_map(std::unordered_map<std::size_t,
   }
 }
 //-----------------------------------------------------------------------------
-bool LagrangeInterpolator::in_bounding_box(const std::vector<double>& point,
-                                           const std::vector<double>& bounding_box,
-                                           const double tol)
+bool
+LagrangeInterpolator::in_bounding_box(const std::vector<double>& point,
+                                      const std::vector<double>& bounding_box,
+                                      const double tol)
 {
   // Return false if bounding box is empty
   if (bounding_box.empty())
diff --git a/dolfin/function/LagrangeInterpolator.h b/dolfin/function/LagrangeInterpolator.h
index 1add748..6677341 100644
--- a/dolfin/function/LagrangeInterpolator.h
+++ b/dolfin/function/LagrangeInterpolator.h
@@ -14,56 +14,26 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-//
-// First added:  2014-02-12
-// Last changed:
 
 #ifndef __LAGRANGE_INTERPOLATOR_H
 #define __LAGRANGE_INTERPOLATOR_H
 
+#include <algorithm>
+#include <map>
+#include <unordered_map>
+#include <vector>
+
 namespace dolfin
 {
-  // Comparison operator for hashing coordinates. Note that two
-  // coordinates are considered equal if equal to within specified
-  // tolerance.
-  struct lt_coordinate
-  {
-    lt_coordinate(double tolerance) : TOL(tolerance) {}
-
-    bool operator() (const std::vector<double>& x,
-                     const std::vector<double>& y) const
-    {
-      std::size_t n = std::max(x.size(), y.size());
-      for (std::size_t i = 0; i < n; ++i)
-      {
-        double xx = 0.0;
-        double yy = 0.0;
-        if (i < x.size())
-          xx = x[i];
-        if (i < y.size())
-          yy = y[i];
-
-        if (xx < (yy - TOL))
-          return true;
-        else if (xx > (yy + TOL))
-          return false;
-      }
-      return false;
-    }
-
-    // Tolerance
-    const double TOL;
-  };
 
   class Expression;
   class Function;
+  class FunctionSpace;
   class GenericDofMap;
   class Mesh;
-  class FunctionSpace;
 
-  /// This class interpolates efficiently from a GenericFunction
-  /// to a Lagrange Function
+  /// This class interpolates efficiently from a GenericFunction to a
+  /// Lagrange Function
 
   class LagrangeInterpolator
   {
@@ -76,7 +46,7 @@ namespace dolfin
     ///         The resulting Function
     ///     u0 (_Expression_)
     ///         The Expression to be interpolated.
-    void interpolate(Function& u, const Expression& u0);
+    static void interpolate(Function& u, const Expression& u0);
 
     /// Interpolate function (on possibly non-matching meshes)
     ///
@@ -85,17 +55,53 @@ namespace dolfin
     ///         The resulting Function
     ///     u0 (_Function_)
     ///         The Function to be interpolated.
-    void interpolate(Function& u, const Function& u0);
+    static void interpolate(Function& u, const Function& u0);
 
   private:
 
-    // Create a map from coordinates to a list of dofs that share the coordinate
-    std::map<std::vector<double>, std::vector<std::size_t>, lt_coordinate >
-      tabulate_coordinates_to_dofs(const GenericDofMap& dofmap, const Mesh& mesh);
+    // Comparison operator for hashing coordinates. Note that two
+    // coordinates are considered equal if equal to within specified
+    // tolerance.
+    struct lt_coordinate
+    {
+      lt_coordinate(double tolerance) : TOL(tolerance) {}
+
+      bool operator() (const std::vector<double>& x,
+                       const std::vector<double>& y) const
+      {
+        const std::size_t n = std::max(x.size(), y.size());
+        for (std::size_t i = 0; i < n; ++i)
+        {
+          double xx = 0.0;
+          double yy = 0.0;
+          if (i < x.size())
+            xx = x[i];
+          if (i < y.size())
+            yy = y[i];
+
+          if (xx < (yy - TOL))
+            return true;
+          else if (xx > (yy + TOL))
+            return false;
+        }
+        return false;
+      }
+
+      // Tolerance
+      const double TOL;
+    };
+
+    // Create a map from coordinates to a list of dofs that share the
+    // coordinate
+    static std::map<std::vector<double>, std::vector<std::size_t>,
+                    lt_coordinate>
+    tabulate_coordinates_to_dofs(const FunctionSpace& V);
 
     // Create a map from dof to its component index in Mixed Space
-    void extract_dof_component_map(std::unordered_map<std::size_t, std::size_t>&
-      dof_component_map, const FunctionSpace& V, int* component);
+    static void extract_dof_component_map(std::unordered_map<std::size_t,
+                                          std::size_t>& dof_component_map,
+                                          const FunctionSpace& V,
+                                          int* component);
 
     // Return true if point lies within bounding box
     static bool in_bounding_box(const std::vector<double>& point,
diff --git a/demo/undocumented/plot-qt/cpp/PlotWidget.cpp b/dolfin/function/MultiMeshCoefficientAssigner.cpp
similarity index 51%
rename from demo/undocumented/plot-qt/cpp/PlotWidget.cpp
rename to dolfin/function/MultiMeshCoefficientAssigner.cpp
index dda4bb5..81ef35f 100644
--- a/demo/undocumented/plot-qt/cpp/PlotWidget.cpp
+++ b/dolfin/function/MultiMeshCoefficientAssigner.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Joachim Berdal Haga
+// Copyright (C) 2015-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -15,39 +15,39 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// First added:  2012-09-14
-// Last changed: 2012-09-18
+// First added:  2015-11-05
+// Last changed: 2016-03-02
 
-#include "PlotWidget.h"
-#include <QMouseEvent>
+#include <memory>
+#include <dolfin/common/NoDeleter.h>
+#include <dolfin/function/GenericFunction.h>
+#include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
+#include "MultiMeshCoefficientAssigner.h"
 
-//----------------------------------------------------------------------------
-PlotWidget::PlotWidget(QWidget *parent)
-  : QVTKWidget(parent)
-{
-  setMouseTracking(true);
-}
-//----------------------------------------------------------------------------
-void PlotWidget::mouseMoveEvent(QMouseEvent *event)
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+MultiMeshCoefficientAssigner::MultiMeshCoefficientAssigner
+(MultiMeshForm& form, std::size_t number)
+  : _form(form), _number(number)
 {
-  emit mouseMoved(event->x(), event->y());
-  button1_click_in_progress = false;
-  QVTKWidget::mouseMoveEvent(event);
+  // Do nothing
 }
-//----------------------------------------------------------------------------
-void PlotWidget::mousePressEvent(QMouseEvent *event)
+//-----------------------------------------------------------------------------
+MultiMeshCoefficientAssigner::~MultiMeshCoefficientAssigner()
 {
-  button1_click_in_progress = (event->buttons() == Qt::LeftButton);
-  QVTKWidget::mousePressEvent(event);
+  // Do nothing
 }
-//----------------------------------------------------------------------------
-void PlotWidget::mouseReleaseEvent(QMouseEvent *event)
+//-----------------------------------------------------------------------------
+void MultiMeshCoefficientAssigner::operator=
+(std::shared_ptr<const GenericFunction> coefficient)
 {
-  if (button1_click_in_progress && event->buttons() == Qt::NoButton)
+  // Assign to all parts of form
+  for (std::size_t part = 0; part < _form.num_parts(); part++)
   {
-    emit mouseClick(event->x(), event->y());
+    Form& a = const_cast<Form&>(*_form.part(part));
+    a.set_coefficient(_number, coefficient);
   }
-  QVTKWidget::mouseReleaseEvent(event);
 }
-//----------------------------------------------------------------------------
-
+//-----------------------------------------------------------------------------
diff --git a/dolfin/function/CoefficientAssigner.h b/dolfin/function/MultiMeshCoefficientAssigner.h
similarity index 56%
copy from dolfin/function/CoefficientAssigner.h
copy to dolfin/function/MultiMeshCoefficientAssigner.h
index 72e058d..eff962d 100644
--- a/dolfin/function/CoefficientAssigner.h
+++ b/dolfin/function/MultiMeshCoefficientAssigner.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2009 Anders Logg
+// Copyright (C) 2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -15,21 +15,22 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// First added:  2008-10-28
-// Last changed: 2009-10-04
+// First added:  2015-11-05
+// Last changed: 2016-03-02
 
-#ifndef __COEFFICIENT_ASSIGNER_H
-#define __COEFFICIENT_ASSIGNER_H
+#ifndef __MULTIMESH_COEFFICIENT_ASSIGNER_H
+#define __MULTIMESH_COEFFICIENT_ASSIGNER_H
 
 #include <cstddef>
+#include <memory>
 
 namespace dolfin
 {
 
-  class Form;
+  class MultiMeshForm;
   class GenericFunction;
 
-  /// This class is used for assignment of coefficients to
+  /// This class is used for assignment of multimesh coefficients to
   /// forms, which allows magic like
   ///
   ///   a.f = f
@@ -37,24 +38,29 @@ namespace dolfin
   ///
   /// which will insert the coefficients f and g in the correct
   /// positions in the list of coefficients for the form.
+  ///
+  /// Note that coefficients can also be assigned manually to the
+  /// individual parts of a multimesh form. Assigning to a multimesh
+  /// coefficient assigner will assign the same coefficient to all
+  /// parts of a form.
 
-  class CoefficientAssigner
+  class MultiMeshCoefficientAssigner
   {
   public:
 
-    /// Create coefficient assigner for coefficient with given number
-    CoefficientAssigner(Form& form, std::size_t number);
+    /// Create multimesh coefficient assigner for coefficient with given number
+    MultiMeshCoefficientAssigner(MultiMeshForm& form, std::size_t number);
 
     /// Destructor
-    ~CoefficientAssigner();
+    ~MultiMeshCoefficientAssigner();
 
     /// Assign coefficient
-    void operator= (const GenericFunction& coefficient);
+    void operator= (std::shared_ptr<const GenericFunction> coefficient);
 
   private:
 
-    // The form
-    Form& _form;
+    // The multimesh form
+    MultiMeshForm& _form;
 
     // The number of the coefficient
     std::size_t _number;
diff --git a/dolfin/function/MultiMeshFunction.cpp b/dolfin/function/MultiMeshFunction.cpp
index 4985bc7..b1057bf 100644
--- a/dolfin/function/MultiMeshFunction.cpp
+++ b/dolfin/function/MultiMeshFunction.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Anders Logg
+// Copyright (C) 2013-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-09-25
-// Last changed: 2014-05-23
+// Last changed: 2016-03-02
 
 #include <dolfin/common/NoDeleter.h>
 #include <dolfin/la/GenericVector.h>
@@ -30,13 +30,6 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-MultiMeshFunction::MultiMeshFunction(const MultiMeshFunctionSpace& V)
-  : _function_space(reference_to_no_delete_pointer(V))
-{
-  // Initialize vector
-  init_vector();
-}
-//-----------------------------------------------------------------------------
 MultiMeshFunction::MultiMeshFunction(std::shared_ptr<const MultiMeshFunctionSpace> V)
   : _function_space(V)
 {
@@ -88,6 +81,10 @@ void MultiMeshFunction::init_vector()
   // not handle distributed vectors (since we do not yet handle
   // communication between distributed bounding box trees).
 
+  // FIXME: Dear Developer, this needs to be rewritten as in
+  //        Function::init_vector()! We need to get rid of
+  //        GenericVector::init(MPI_COMM_WORLD, range, local_to_global, ghost_indices);
+
   // Get global size
   const std::size_t N = _function_space->dofmap()->global_dimension();
 
@@ -105,7 +102,7 @@ void MultiMeshFunction::init_vector()
   if (!_vector)
   {
     DefaultFactory factory;
-    _vector = factory.create_vector();
+    _vector = factory.create_vector(MPI_COMM_WORLD);
   }
   dolfin_assert(_vector);
 
@@ -133,6 +130,8 @@ void MultiMeshFunction::init_vector()
 void MultiMeshFunction::compute_ghost_indices(std::pair<std::size_t, std::size_t> range,
                                           std::vector<la_index>& ghost_indices) const
 {
+  // NOTE: Well, don't implement me! Rather rewrite init_vector().
+  //       See Function::init_vector().
   dolfin_not_implemented();
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/function/MultiMeshFunction.h b/dolfin/function/MultiMeshFunction.h
index afd70bf..3d3a9fa 100644
--- a/dolfin/function/MultiMeshFunction.h
+++ b/dolfin/function/MultiMeshFunction.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Anders Logg
+// Copyright (C) 2013-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-09-25
-// Last changed: 2014-05-23
+// Last changed: 2016-03-02
 
 #ifndef __MULTI_MESH_FUNCTION_H
 #define __MULTI_MESH_FUNCTION_H
@@ -45,20 +45,6 @@ namespace dolfin
     /// *Arguments*
     ///     V (_MultiMeshFunctionSpace_)
     ///         The MultiMesh function space.
-    ///
-    /// *Example*
-    ///     .. code-block:: c++
-    ///
-    ///         MultiMeshFunction u(V);
-    ///
-    explicit MultiMeshFunction(const MultiMeshFunctionSpace& V);
-
-    /// Create MultiMesh function on given MultiMesh function space (shared
-    /// pointer version)
-    ///
-    /// *Arguments*
-    ///     V (_MultiMeshFunctionSpace_)
-    ///         The MultiMesh function space.
     explicit MultiMeshFunction(std::shared_ptr<const MultiMeshFunctionSpace> V);
 
     /// Destructor
diff --git a/dolfin/function/MultiMeshFunctionSpace.cpp b/dolfin/function/MultiMeshFunctionSpace.cpp
index e0a6e8f..de2e2e6 100644
--- a/dolfin/function/MultiMeshFunctionSpace.cpp
+++ b/dolfin/function/MultiMeshFunctionSpace.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Anders Logg
+// Copyright (C) 2013-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-08-05
-// Last changed: 2014-06-11
+// Last changed: 2016-03-02
 
 #include <dolfin/log/log.h>
 #include <dolfin/common/NoDeleter.h>
@@ -32,11 +32,11 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-MultiMeshFunctionSpace::MultiMeshFunctionSpace()
-  : _multimesh(new MultiMesh()), _dofmap(new MultiMeshDofMap())
+MultiMeshFunctionSpace::MultiMeshFunctionSpace(std::shared_ptr<const MultiMesh> multimesh)
+  : _multimesh(multimesh),
+    _dofmap(new MultiMeshDofMap())
 {
-  // Set parameters
-  parameters = default_parameters();
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
 MultiMeshFunctionSpace::~MultiMeshFunctionSpace()
@@ -89,18 +89,10 @@ MultiMeshFunctionSpace::add(std::shared_ptr<const FunctionSpace> function_space)
       _function_spaces.size());
 }
 //-----------------------------------------------------------------------------
-void MultiMeshFunctionSpace::add(const FunctionSpace& function_space)
-{
-  add(reference_to_no_delete_pointer(function_space));
-}
-//-----------------------------------------------------------------------------
 void MultiMeshFunctionSpace::build()
 {
   begin(PROGRESS, "Building multimesh function space.");
 
-  // Build multimesh
-  _build_multimesh();
-
   // Build dofmap using empty list of offsets (will be computed)
   std::vector<dolfin::la_index> offsets;
   _build_dofmap(offsets);
@@ -111,8 +103,7 @@ void MultiMeshFunctionSpace::build()
   end();
 }
 //-----------------------------------------------------------------------------
-void MultiMeshFunctionSpace::build(std::shared_ptr<MultiMesh> multimesh,
-                                   const std::vector<dolfin::la_index>& offsets)
+void MultiMeshFunctionSpace::build(const std::vector<dolfin::la_index>& offsets)
 {
   begin(PROGRESS, "Building multimesh subspace.");
 
@@ -125,23 +116,6 @@ void MultiMeshFunctionSpace::build(std::shared_ptr<MultiMesh> multimesh,
   end();
 }
 //-----------------------------------------------------------------------------
-void MultiMeshFunctionSpace::_build_multimesh()
-{
-  // Clear multimesh
-  dolfin_assert(_multimesh);
-  _multimesh->clear();
-
-  // Propagate parameters
-  _multimesh->parameters.update(parameters("multimesh"));
-
-  // Add meshes
-  for (std::size_t i = 0; i < num_parts(); i++)
-    _multimesh->add(_function_spaces[i]->mesh());
-
-  // Build multimesh
-  _multimesh->build();
-}
-//-----------------------------------------------------------------------------
 void MultiMeshFunctionSpace::_build_dofmap(const std::vector<dolfin::la_index>& offsets)
 {
   begin(PROGRESS, "Building multimesh dofmap.");
diff --git a/dolfin/function/MultiMeshFunctionSpace.h b/dolfin/function/MultiMeshFunctionSpace.h
index 15d5b6e..cb6e820 100644
--- a/dolfin/function/MultiMeshFunctionSpace.h
+++ b/dolfin/function/MultiMeshFunctionSpace.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Anders Logg
+// Copyright (C) 2013-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-08-05
-// Last changed: 2014-06-11
+// Last changed: 2016-03-02
 
 #ifndef __MULTI_MESH_FUNCTION_SPACE_H
 #define __MULTI_MESH_FUNCTION_SPACE_H
@@ -46,8 +46,8 @@ namespace dolfin
   {
   public:
 
-    /// Create empty multimesh function space
-    MultiMeshFunctionSpace();
+    /// Create multimesh function space on multimesh (shared pointer version)
+    MultiMeshFunctionSpace(std::shared_ptr<const MultiMesh> multimesh);
 
     /// Destructor
     ~MultiMeshFunctionSpace();
@@ -106,38 +106,19 @@ namespace dolfin
     ///         Function space (part) number i
     std::shared_ptr<const FunctionSpace> view(std::size_t i) const;
 
-    /// Add function space (shared pointer version)
+    /// Add function space
     ///
     /// *Arguments*
     ///     function_space (_FunctionSpace_)
     ///         The function space.
     void add(std::shared_ptr<const FunctionSpace> function_space);
 
-    /// Add function space (reference version)
-    ///
-    /// *Arguments*
-    ///     function_space (_FunctionSpace_)
-    ///         The function space.
-    void add(const FunctionSpace& function_space);
-
     /// Build multimesh function space
     void build();
 
-    /// Build multimesh function space. This function reuses an
-    /// existing multimesh and uses offsets computed from the full
-    /// function spaces on each part.
-    void build(std::shared_ptr<MultiMesh> multimesh,
-               const std::vector<dolfin::la_index>& offsets);
-
-    /// Default parameter values
-    static Parameters default_parameters()
-    {
-      Parameters p("multimesh_functionspace");
-
-      p.add(MultiMesh::default_parameters());
-
-      return p;
-    }
+    /// Build multimesh function space. This function uses offsets
+    /// computed from the full function spaces on each part.
+    void build(const std::vector<dolfin::la_index>& offsets);
 
   private:
 
@@ -151,11 +132,14 @@ namespace dolfin
     std::vector<std::shared_ptr<const FunctionSpace> > _function_space_views;
 
     // Multimesh
-    std::shared_ptr<MultiMesh> _multimesh;
+    std::shared_ptr<const MultiMesh> _multimesh;
 
     // Multimesh dofmap
     std::shared_ptr<MultiMeshDofMap> _dofmap;
 
+    // Quadrature order
+    std::size_t _quadrature_order;
+
     // Build multimesh
     void _build_multimesh();
 
diff --git a/dolfin/function/MultiMeshSubSpace.cpp b/dolfin/function/MultiMeshSubSpace.cpp
index d0aebb2..82469e6 100644
--- a/dolfin/function/MultiMeshSubSpace.cpp
+++ b/dolfin/function/MultiMeshSubSpace.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Anders Logg
+// Copyright (C) 2014-2015 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,12 +16,11 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2014-06-11
-// Last changed: 2014-06-11
+// Last changed: 2015-11-12
 
 #include <memory>
-
 #include <dolfin/common/NoDeleter.h>
-#include "SubSpace.h"
+#include "FunctionSpace.h"
 #include "MultiMeshSubSpace.h"
 
 using namespace dolfin;
@@ -29,7 +28,7 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 MultiMeshSubSpace::MultiMeshSubSpace(MultiMeshFunctionSpace& V,
                                      std::size_t component)
-  : MultiMeshFunctionSpace()
+  : MultiMeshFunctionSpace(V.multimesh())
 {
   // Create array
   std::vector<std::size_t> c = {component};
@@ -41,7 +40,7 @@ MultiMeshSubSpace::MultiMeshSubSpace(MultiMeshFunctionSpace& V,
 MultiMeshSubSpace::MultiMeshSubSpace(MultiMeshFunctionSpace& V,
                                      std::size_t component,
                                      std::size_t sub_component)
-  : MultiMeshFunctionSpace()
+  : MultiMeshFunctionSpace(V.multimesh())
 {
   // Create array
   std::vector<std::size_t> c = {{component, sub_component}};
@@ -52,7 +51,7 @@ MultiMeshSubSpace::MultiMeshSubSpace(MultiMeshFunctionSpace& V,
 //-----------------------------------------------------------------------------
 MultiMeshSubSpace::MultiMeshSubSpace(MultiMeshFunctionSpace& V,
                                      const std::vector<std::size_t>& component)
-  : MultiMeshFunctionSpace()
+  : MultiMeshFunctionSpace(V.multimesh())
 {
   // Build subspace
   _build(V, component);
@@ -74,8 +73,7 @@ void MultiMeshSubSpace::_build(MultiMeshFunctionSpace& V,
     std::shared_ptr<const FunctionSpace> part_space(V.part(part));
 
     // Extract subspace
-    std::shared_ptr<SubSpace>
-      part_subspace(new SubSpace(*part_space, component));
+    auto part_subspace = part_space->sub(component);
 
     // Add the subspace
     this->add(part_subspace);
@@ -85,6 +83,6 @@ void MultiMeshSubSpace::_build(MultiMeshFunctionSpace& V,
   }
 
   // Build multimesh function space from subspaces
-  this->build(V._multimesh, offsets);
+  this->build(offsets);
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/function/MultiMeshSubSpace.h b/dolfin/function/MultiMeshSubSpace.h
index 326281c..ac93502 100644
--- a/dolfin/function/MultiMeshSubSpace.h
+++ b/dolfin/function/MultiMeshSubSpace.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Anders Logg
+// Copyright (C) 2014-2015 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2014-06-11
-// Last changed: 2014-06-11
+// Last changed: 2015-11-12
 
 #ifndef __MULTI_MESH_SUB_SPACE_H
 #define __MULTI_MESH_SUB_SPACE_H
diff --git a/dolfin/function/SpecialFunctions.cpp b/dolfin/function/SpecialFunctions.cpp
index 36c2d36..68d7b97 100644
--- a/dolfin/function/SpecialFunctions.cpp
+++ b/dolfin/function/SpecialFunctions.cpp
@@ -30,24 +30,24 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-MeshCoordinates::MeshCoordinates(const Mesh& mesh)
-  : Expression(mesh.geometry().dim()), _mesh(mesh)
+MeshCoordinates::MeshCoordinates(std::shared_ptr<const Mesh> mesh)
+  : Expression(_mesh->geometry().dim()), _mesh(mesh)
 {
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-void MeshCoordinates::eval(Array<double>& values,
-                           const Array<double>& x,
+void MeshCoordinates::eval(Array<double>& values, const Array<double>& x,
                            const ufc::cell& cell) const
 {
-  dolfin_assert(cell.geometric_dimension == _mesh.geometry().dim());
-  dolfin_assert(x.size() == _mesh.geometry().dim());
+  dolfin_assert(_mesh);
+  dolfin_assert(cell.geometric_dimension == _mesh->geometry().dim());
+  dolfin_assert(x.size() == _mesh->geometry().dim());
 
   for (std::size_t i = 0; i < cell.geometric_dimension; ++i)
     values[i] = x[i];
 }
 //-----------------------------------------------------------------------------
-FacetArea::FacetArea(const Mesh& mesh)
+FacetArea::FacetArea(std::shared_ptr<const Mesh> mesh)
   : _mesh(mesh),
     not_on_boundary("*** Warning: evaluating special function FacetArea on a "
                     "non-facet domain, returning zero.")
@@ -55,15 +55,15 @@ FacetArea::FacetArea(const Mesh& mesh)
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-void FacetArea::eval(Array<double>& values,
-                     const Array<double>& x,
+void FacetArea::eval(Array<double>& values, const Array<double>& x,
                      const ufc::cell& cell) const
 {
-  dolfin_assert(cell.geometric_dimension == _mesh.geometry().dim());
+  dolfin_assert(_mesh);
+  dolfin_assert(cell.geometric_dimension == _mesh->geometry().dim());
 
   if (cell.local_facet >= 0)
   {
-    Cell c(_mesh, cell.index);
+    Cell c(*_mesh, cell.index);
     values[0] = c.facet_area(cell.local_facet);
   }
   else
diff --git a/dolfin/function/SpecialFunctions.h b/dolfin/function/SpecialFunctions.h
index c80f961..db7679d 100644
--- a/dolfin/function/SpecialFunctions.h
+++ b/dolfin/function/SpecialFunctions.h
@@ -25,6 +25,7 @@
 #ifndef __SPECIAL_FUNCTIONS_H
 #define __SPECIAL_FUNCTIONS_H
 
+#include <memory>
 #include <dolfin/log/Event.h>
 #include <dolfin/common/Array.h>
 #include "Expression.h"
@@ -40,27 +41,27 @@ namespace dolfin
   public:
 
     /// Constructor
-    explicit MeshCoordinates(const Mesh& mesh);
+    explicit MeshCoordinates(std::shared_ptr<const Mesh> mesh);
 
     /// Evaluate function
-    void eval(Array<double>& values,
-              const Array<double>& x,
+    void eval(Array<double>& values, const Array<double>& x,
               const ufc::cell& cell) const;
 
   private:
 
     // The mesh
-    const Mesh& _mesh;
+    std::shared_ptr<const Mesh> _mesh;
 
   };
 
-  /// This function represents the area/length of a cell facet on a given mesh.
+  /// This function represents the area/length of a cell facet on a
+  /// given mesh.
   class FacetArea : public Expression
   {
   public:
 
     /// Constructor
-    explicit FacetArea(const Mesh& mesh);
+    explicit FacetArea(std::shared_ptr<const Mesh> mesh);
 
     /// Evaluate function
     void eval(Array<double>& values,
@@ -70,7 +71,7 @@ namespace dolfin
   private:
 
     // The mesh
-    const Mesh& _mesh;
+    std::shared_ptr<const Mesh> _mesh;
 
     // Warning when evaluating on cells
     mutable Event not_on_boundary;
diff --git a/dolfin/function/SubSpace.cpp b/dolfin/function/SubSpace.cpp
deleted file mode 100644
index 596fc08..0000000
--- a/dolfin/function/SubSpace.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (C) 2008 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Garth N. Wells 2009
-//
-// First added:  2008-11-03
-// Last changed: 2014-06-11
-
-#include <dolfin/common/NoDeleter.h>
-#include "SubSpace.h"
-
-using namespace dolfin;
-
-//-----------------------------------------------------------------------------
-SubSpace::SubSpace(const FunctionSpace& V,
-                   std::size_t component)
-  : FunctionSpace(V.mesh(), V.element(), V.dofmap())
-{
-  // Create array
-  std::vector<std::size_t> c = {component};
-
-  // Extract subspace and assign
-  std::shared_ptr<FunctionSpace> _function_space(V.extract_sub_space(c));
-  *static_cast<FunctionSpace*>(this) = *_function_space;
-}
-//-----------------------------------------------------------------------------
-SubSpace::SubSpace(const FunctionSpace& V,
-                   std::size_t component,
-                   std::size_t sub_component)
-  : FunctionSpace(V.mesh(), V.element(), V.dofmap())
-{
-  // Create array
-  std::vector<std::size_t> c ={{component, sub_component}};
-
-  // Extract subspace and assign
-  std::shared_ptr<FunctionSpace> _function_space(V.extract_sub_space(c));
-  *static_cast<FunctionSpace*>(this) = *_function_space;
-}
-//-----------------------------------------------------------------------------
-SubSpace::SubSpace(const FunctionSpace& V,
-                   const std::vector<std::size_t>& component)
-  : FunctionSpace(V.mesh(), V.element(), V.dofmap())
-{
-  // Extract subspace and assign
-  std::shared_ptr<FunctionSpace> _function_space(V.extract_sub_space(component));
-  *static_cast<FunctionSpace*>(this) = *_function_space;
-}
-//-----------------------------------------------------------------------------
diff --git a/dolfin/function/SubSpace.h b/dolfin/function/SubSpace.h
deleted file mode 100644
index 6542e34..0000000
--- a/dolfin/function/SubSpace.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2008 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2008-11-03
-// Last changed: 2008-11-03
-
-#ifndef __SUB_SPACE_H
-#define __SUB_SPACE_H
-
-#include <vector>
-#include "FunctionSpace.h"
-
-namespace dolfin
-{
-
-  /// This class represents a subspace (component) of a function space.
-  ///
-  /// The subspace is specified by an array of indices. For example,
-  /// the array [3, 0, 2] specifies subspace 2 of subspace 0 of
-  /// subspace 3.
-  ///
-  /// A typical example is the function space W = V x P for Stokes.
-  /// Here, V = W[0] is the subspace for the velocity component and
-  /// P = W[1] is the subspace for the pressure component. Furthermore,
-  /// W[0][0] = V[0] is the first component of the velocity space etc.
-
-  class SubSpace : public FunctionSpace
-  {
-  public:
-
-    /// Create subspace for given component (one level)
-    SubSpace(const FunctionSpace& V,
-             std::size_t component);
-
-    /// Create subspace for given component (two levels)
-    SubSpace(const FunctionSpace& V,
-             std::size_t component, std::size_t sub_component);
-
-    /// Create subspace for given component (n levels)
-    SubSpace(const FunctionSpace& V,
-             const std::vector<std::size_t>& component);
-
-  };
-
-}
-
-#endif
diff --git a/dolfin/function/dolfin_function.h b/dolfin/function/dolfin_function.h
index 45c13e7..930d25c 100644
--- a/dolfin/function/dolfin_function.h
+++ b/dolfin/function/dolfin_function.h
@@ -8,7 +8,6 @@
 #include <dolfin/function/FunctionAXPY.h>
 #include <dolfin/function/Function.h>
 #include <dolfin/function/FunctionSpace.h>
-#include <dolfin/function/SubSpace.h>
 #include <dolfin/function/Constant.h>
 #include <dolfin/function/SpecialFunctions.h>
 #include <dolfin/function/SpecialFacetFunction.h>
diff --git a/dolfin/generation/BoxMesh.cpp b/dolfin/generation/BoxMesh.cpp
index cb22491..794b58a 100644
--- a/dolfin/generation/BoxMesh.cpp
+++ b/dolfin/generation/BoxMesh.cpp
@@ -21,6 +21,7 @@
 // First added:  2005-12-02
 // Last changed: 2015-06-15
 
+#include <cmath>
 #include <boost/multi_array.hpp>
 
 #include <dolfin/common/constants.h>
@@ -35,15 +36,13 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 BoxMesh::BoxMesh(const Point& p0, const Point& p1,
                  std::size_t nx, std::size_t ny, std::size_t nz)
-  : Mesh(MPI_COMM_WORLD)
+  : BoxMesh(MPI_COMM_WORLD, p0, p1, nx, ny, nz)
 {
-  build(p0, p1, nx, ny, nz);
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
-BoxMesh::BoxMesh(MPI_Comm comm,
-                 const Point& p0, const Point& p1,
-                 std::size_t nx, std::size_t ny, std::size_t nz)
-  : Mesh(comm)
+BoxMesh::BoxMesh(MPI_Comm comm, const Point& p0, const Point& p1,
+                 std::size_t nx, std::size_t ny, std::size_t nz) : Mesh(comm)
 {
   build(p0, p1, nx, ny, nz);
 }
@@ -51,7 +50,7 @@ BoxMesh::BoxMesh(MPI_Comm comm,
 void BoxMesh::build(const Point& p0, const Point& p1,
                     std::size_t nx, std::size_t ny, std::size_t nz)
 {
-  Timer timer("Generate Box mesh");
+  Timer timer("Build BoxMesh");
 
   // Receive mesh according to parallel policy
   if (MPI::is_receiver(this->mpi_comm()))
diff --git a/dolfin/generation/IntervalMesh.cpp b/dolfin/generation/IntervalMesh.cpp
index 17a26e7..ba2b965 100644
--- a/dolfin/generation/IntervalMesh.cpp
+++ b/dolfin/generation/IntervalMesh.cpp
@@ -21,6 +21,7 @@
 // First added:  2007-11-23
 // Last changed: 2014-02-17
 
+#include <cmath>
 #include "dolfin/common/constants.h"
 #include "dolfin/common/MPI.h"
 #include "dolfin/mesh/CellType.h"
@@ -32,9 +33,9 @@ using namespace dolfin;
 
 //-----------------------------------------------------------------------------
 IntervalMesh::IntervalMesh(std::size_t nx, double a, double b)
-  : Mesh(MPI_COMM_WORLD)
+  : IntervalMesh(MPI_COMM_WORLD, nx, a, b)
 {
-  build(nx, a, b);
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
 IntervalMesh::IntervalMesh(MPI_Comm comm, std::size_t nx, double a, double b)
diff --git a/dolfin/generation/RectangleMesh.cpp b/dolfin/generation/RectangleMesh.cpp
index d84f9ec..9f5295a 100644
--- a/dolfin/generation/RectangleMesh.cpp
+++ b/dolfin/generation/RectangleMesh.cpp
@@ -19,6 +19,7 @@
 // Modified by Nuno Lopes 2008
 // Modified by Kristian B. Oelgaard 2009
 
+#include <cmath>
 #include <boost/multi_array.hpp>
 
 #include <dolfin/common/constants.h>
@@ -32,9 +33,10 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 RectangleMesh::RectangleMesh(const Point& p0, const Point& p1,
                              std::size_t nx, std::size_t ny,
-                             std::string diagonal) : Mesh(MPI_COMM_WORLD)
+                             std::string diagonal)
+  : RectangleMesh(MPI_COMM_WORLD, p0, p1, nx, ny, diagonal)
 {
-  build(p0, p1, nx, ny, diagonal);
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
 RectangleMesh::RectangleMesh(MPI_Comm comm,
diff --git a/dolfin/generation/SphericalShellMesh.cpp b/dolfin/generation/SphericalShellMesh.cpp
new file mode 100644
index 0000000..dbcfbf2
--- /dev/null
+++ b/dolfin/generation/SphericalShellMesh.cpp
@@ -0,0 +1,102 @@
+// Copyright (C) 2015 Chris Richardson
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#include <dolfin/common/MPI.h>
+#include <dolfin/mesh/MeshEditor.h>
+#include <dolfin/mesh/Vertex.h>
+#include <dolfin/mesh/Edge.h>
+#include "SphericalShellMesh.h"
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+SphericalShellMesh::SphericalShellMesh(MPI_Comm comm, std::size_t degree)
+  : Mesh(comm)
+{
+
+  MeshEditor editor;
+  const std::size_t tdim = 2;
+  const std::size_t gdim = 3;
+
+  dolfin_assert(degree > 0 and degree < 3);
+  editor.open(*this, tdim, gdim, degree);
+
+  editor.init_vertices_global(12, 12);
+
+  const double l0 = 2.0/(sqrt(10.0 + 2.0*sqrt(5.0)));
+  const double l1 = l0*(1.0 + sqrt(5.0))/2.0;
+
+  // Generate an icosahedron
+
+  editor.add_vertex(0,  Point(  0,  l0, l1));
+  editor.add_vertex(1,  Point(  0,  l0, -l1));
+  editor.add_vertex(2,  Point(  0, -l0, -l1));
+  editor.add_vertex(3,  Point(  0, -l0, l1));
+  editor.add_vertex(4,  Point( l1,   0, l0));
+  editor.add_vertex(5,  Point(-l1,   0, l0));
+  editor.add_vertex(6,  Point(-l1,   0, -l0));
+  editor.add_vertex(7,  Point( l1,   0, -l0));
+  editor.add_vertex(8,  Point( l0,  l1, 0));
+  editor.add_vertex(9,  Point( l0, -l1, 0));
+  editor.add_vertex(10, Point(-l0, -l1, 0));
+  editor.add_vertex(11, Point(-l0,  l1, 0));
+
+  editor.init_cells_global(20, 20);
+
+  editor.add_cell(0, 0, 4, 8);
+  editor.add_cell(1, 0, 5, 11);
+  editor.add_cell(2, 1, 6, 11);
+  editor.add_cell(3, 1, 7, 8);
+  editor.add_cell(4, 2, 6, 10);
+  editor.add_cell(5, 2, 7, 9);
+  editor.add_cell(6, 3, 4, 9);
+  editor.add_cell(7, 3, 5, 10);
+
+  editor.add_cell( 8, 0, 3, 4);
+  editor.add_cell( 9, 0, 3, 5);
+  editor.add_cell(10, 1, 2, 6);
+  editor.add_cell(11, 1, 2, 7);
+  editor.add_cell(12, 4, 7, 8);
+  editor.add_cell(13, 4, 7, 9);
+  editor.add_cell(14, 5, 6, 10);
+  editor.add_cell(15, 5, 6, 11);
+  editor.add_cell(16, 8, 11, 0);
+  editor.add_cell(17, 8, 11, 1);
+  editor.add_cell(18, 9, 10, 2);
+  editor.add_cell(19, 9, 10, 3);
+
+  if (degree == 2)
+  {
+    // Initialise entities required for this degree polynomial mesh
+    // and allocate space for the point coordinate data
+    editor.init_entities();
+
+    for (EdgeIterator e(*this); !e.end(); ++e)
+    {
+      Point v0 = Vertex(*this, e->entities(0)[0]).point();
+      Point pt = e->midpoint();
+      pt *= v0.norm()/pt.norm();
+
+      // Add Edge-based point
+      editor.add_entity_point(1, 0, e->index(), pt);
+    }
+  }
+
+  editor.close();
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/ale/ALEType.h b/dolfin/generation/SphericalShellMesh.h
similarity index 67%
rename from dolfin/ale/ALEType.h
rename to dolfin/generation/SphericalShellMesh.h
index 1428fc9..42b2d71 100644
--- a/dolfin/ale/ALEType.h
+++ b/dolfin/generation/SphericalShellMesh.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 Solveig Bruvoll and Anders Logg
+// Copyright (C) 2015 Chris Richardson
 //
 // This file is part of DOLFIN.
 //
@@ -15,17 +15,24 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// First added:  2008-05-02
-// Last changed: 2008-08-11
 
-#ifndef __ALE_TYPE_H
-#define __ALE_TYPE_H
+#ifndef __SPHERICAL_SHELL_MESH_H
+#define __SPHERICAL_SHELL_MESH_H
+
+#include <dolfin/common/MPI.h>
+#include <dolfin/mesh/Mesh.h>
 
 namespace dolfin
 {
 
-  /// List of available methods for ALE mesh movement
-  enum ALEType {lagrange, hermite, harmonic};
+  class SphericalShellMesh : public Mesh
+  {
+  public:
+
+    /// Create a spherical shell manifold for testing
+    SphericalShellMesh(MPI_Comm comm, std::size_t degree);
+
+  };
 
 }
 
diff --git a/dolfin/generation/UnitCubeMesh.h b/dolfin/generation/UnitCubeMesh.h
index a133722..52f32bc 100644
--- a/dolfin/generation/UnitCubeMesh.h
+++ b/dolfin/generation/UnitCubeMesh.h
@@ -57,7 +57,7 @@ namespace dolfin
     ///         UnitCubeMesh mesh(32, 32, 32);
     ///
     UnitCubeMesh(std::size_t nx, std::size_t ny, std::size_t nz)
-      : BoxMesh(Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0), nx, ny, nz) {}
+      : UnitCubeMesh(MPI_COMM_WORLD, nx, ny, nz) {}
 
     /// Create a uniform finite element _Mesh_ over the unit cube
     /// [0,1] x [0,1] x [0,1].
diff --git a/dolfin/generation/UnitDiscMesh.cpp b/dolfin/generation/UnitDiscMesh.cpp
new file mode 100644
index 0000000..506b8e7
--- /dev/null
+++ b/dolfin/generation/UnitDiscMesh.cpp
@@ -0,0 +1,127 @@
+// Copyright (C) 2015 Chris Richardson
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+#include <cmath>
+#include <dolfin/common/MPI.h>
+#include <dolfin/mesh/MeshEditor.h>
+#include <dolfin/mesh/Vertex.h>
+#include <dolfin/mesh/Edge.h>
+#include "UnitDiscMesh.h"
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+UnitDiscMesh::UnitDiscMesh(MPI_Comm comm, std::size_t n, std::size_t degree,
+                           std::size_t gdim) : Mesh(comm)
+{
+  dolfin_assert(n > 0);
+
+  if (!(gdim == 2 or gdim == 3))
+  {
+    dolfin_error("UnitDiscMesh.cpp",
+                 "create mesh",
+                 "geometric dimension must be two or three");
+  }
+
+  if (!(degree == 1 or degree == 2))
+  {
+    dolfin_error("UnitDiscMesh.cpp",
+                 "create mesh",
+                 "isoparametric degree must be one or two");
+  }
+
+  MeshEditor editor;
+  editor.open(*this, 2, gdim, degree);
+  editor.init_vertices_global(1 + 3*n*(n + 1), 1 + 3*n*(n + 1));
+
+  std::size_t c = 0;
+  editor.add_vertex(c, Point(0.0, 0.0, 0.0));
+  ++c;
+
+  for (std::size_t i = 1; i <= n; ++i)
+  {
+    for (std::size_t j = 0; j < 6*i; ++j)
+    {
+      const double r = (double)i/(double)n;
+      const double th = 2*M_PI*(double)j/(double)(6*i);
+      const double x = r*cos(th);
+      const double y = r*sin(th);
+      editor.add_vertex(c, Point(x, y, 0));
+      ++c;
+    }
+  }
+
+  editor.init_cells(6*n*n);
+  c = 0;
+  std::size_t base_i = 0;
+  std::size_t row_i = 1;
+  for (std::size_t i = 1; i <= n; ++i)
+  {
+    std::size_t base_m = base_i;
+    base_i = 1 + 3*i*(i - 1);
+    std::size_t row_m = row_i;
+    row_i = 6*i;
+    for (std::size_t k = 0; k != 6; ++k)
+    {
+      for (std::size_t j = 0; j < (i*2 - 1); ++j)
+      {
+        std::size_t i0, i1, i2;
+        if (j%2 == 0)
+        {
+          i0 = base_i + (k*i + j/2)%row_i;
+          i1 = base_i + (k*i + j/2 + 1)%row_i;
+          i2 = base_m + (k*(i-1) + j/2)%row_m;
+        }
+        else
+        {
+          i0 = base_m + (k*(i-1) + j/2)%row_m;
+          i1 = base_m + (k*(i-1) + j/2 + 1)%row_m;
+          i2 = base_i + (k*i + j/2 + 1)%row_i;
+        }
+
+        editor.add_cell(c, i0, i1, i2);
+        ++c;
+      }
+    }
+  }
+
+  // Initialise entities required for this degree polynomial mesh and
+  // allocate space for the point coordinate data
+  if (degree == 2)
+  {
+    editor.init_entities();
+
+    for (EdgeIterator e(*this); !e.end(); ++e)
+    {
+      const Point v0 = Vertex(*this, e->entities(0)[0]).point();
+      const Point v1 = Vertex(*this, e->entities(0)[1]).point();
+      Point pt = e->midpoint();
+
+      if (std::abs(v0.norm() - 1.0) < 1e-6 and
+          std::abs(v1.norm() - 1.0) < 1e-6)
+      {
+        pt *= v0.norm()/pt.norm();
+      }
+
+      // Add Edge-based point
+      editor.add_entity_point(1, 0, e->index(), pt);
+    }
+  }
+
+  editor.close();
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/refinement/UniformMeshRefinement.h b/dolfin/generation/UnitDiscMesh.h
similarity index 63%
rename from dolfin/refinement/UniformMeshRefinement.h
rename to dolfin/generation/UnitDiscMesh.h
index ae62b8a..f68e6db 100644
--- a/dolfin/refinement/UniformMeshRefinement.h
+++ b/dolfin/generation/UnitDiscMesh.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2010 Anders Logg
+// Copyright (C) 2015 Chris Richardson
 //
 // This file is part of DOLFIN.
 //
@@ -15,27 +15,25 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// Modified by Garth N. Wells, 2010
-//
-// First added:  2006-06-07
-// Last changed: 2010-02-26
 
-#ifndef __UNIFORM_MESH_REFINEMENT_H
-#define __UNIFORM_MESH_REFINEMENT_H
+#ifndef __UNIT_DISC_MESH_H
+#define __UNIT_DISC_MESH_H
+
+#include <cstddef>
+#include <dolfin/common/MPI.h>
+#include <dolfin/mesh/Mesh.h>
 
 namespace dolfin
 {
 
-  class Mesh;
-
-  /// This class implements uniform mesh refinement.
-
-  class UniformMeshRefinement
+  class UnitDiscMesh : public Mesh
   {
   public:
 
-    /// Refine mesh uniformly
-    static void refine(Mesh& refined_mesh, const Mesh& mesh);
+    /// Create a unit disc mesh in 2D or 3D geometry with n steps, and
+    /// given degree polynomial mesh
+    UnitDiscMesh(MPI_Comm comm, std::size_t n, std::size_t degree,
+                 std::size_t gdim);
 
   };
 
diff --git a/dolfin/generation/UnitHexMesh.cpp b/dolfin/generation/UnitHexMesh.cpp
index be6dfa2..e502201 100644
--- a/dolfin/generation/UnitHexMesh.cpp
+++ b/dolfin/generation/UnitHexMesh.cpp
@@ -27,9 +27,9 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-UnitHexMesh::UnitHexMesh(std::size_t nx, std::size_t ny, std::size_t nz)
+UnitHexMesh::UnitHexMesh(MPI_Comm comm, std::size_t nx, std::size_t ny,
+                         std::size_t nz) : Mesh(comm)
 {
-
   // Receive mesh according to parallel policy
   if (MPI::is_receiver(this->mpi_comm()))
   {
diff --git a/dolfin/generation/UnitHexMesh.h b/dolfin/generation/UnitHexMesh.h
index 8784e27..1f65ca6 100644
--- a/dolfin/generation/UnitHexMesh.h
+++ b/dolfin/generation/UnitHexMesh.h
@@ -34,7 +34,7 @@ namespace dolfin
 
     /// NB: this code is experimental, just for testing, and will generally not
     /// work with anything else
-    UnitHexMesh(std::size_t nx, std::size_t ny, std::size_t nz);
+    UnitHexMesh(MPI_Comm comm, std::size_t nx, std::size_t ny, std::size_t nz);
 
   };
 
diff --git a/dolfin/generation/UnitIntervalMesh.h b/dolfin/generation/UnitIntervalMesh.h
index 81e9af5..161b722 100644
--- a/dolfin/generation/UnitIntervalMesh.h
+++ b/dolfin/generation/UnitIntervalMesh.h
@@ -52,7 +52,7 @@ namespace dolfin
     ///         // Create a mesh of 25 cells in the interval [0,1]
     ///         UnitIntervalMesh mesh(25);
     ///
-    UnitIntervalMesh(std::size_t nx) : IntervalMesh(nx, 0.0, 1.0) {}
+    UnitIntervalMesh(std::size_t nx) : UnitIntervalMesh(MPI_COMM_WORLD, nx) {}
 
     /// Constructor
     ///
diff --git a/dolfin/generation/UnitQuadMesh.cpp b/dolfin/generation/UnitQuadMesh.cpp
index f84a6d9..5aab775 100644
--- a/dolfin/generation/UnitQuadMesh.cpp
+++ b/dolfin/generation/UnitQuadMesh.cpp
@@ -28,7 +28,8 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-UnitQuadMesh::UnitQuadMesh(std::size_t nx, std::size_t ny)
+UnitQuadMesh::UnitQuadMesh(MPI_Comm comm, std::size_t nx, std::size_t ny)
+  : Mesh(comm)
 {
   // Receive mesh according to parallel policy
   if (MPI::is_receiver(this->mpi_comm()))
diff --git a/dolfin/generation/UnitQuadMesh.h b/dolfin/generation/UnitQuadMesh.h
index d978ef0..6087662 100644
--- a/dolfin/generation/UnitQuadMesh.h
+++ b/dolfin/generation/UnitQuadMesh.h
@@ -33,10 +33,9 @@ namespace dolfin
   {
   public:
 
-
     /// NB: this code is experimental, just for testing, and will generally not
     /// work with anything else
-    UnitQuadMesh(std::size_t nx, std::size_t ny);
+    UnitQuadMesh(MPI_Comm comm, std::size_t nx, std::size_t ny);
 
   };
 
diff --git a/dolfin/generation/UnitSquareMesh.h b/dolfin/generation/UnitSquareMesh.h
index 25914c5..86fde16 100644
--- a/dolfin/generation/UnitSquareMesh.h
+++ b/dolfin/generation/UnitSquareMesh.h
@@ -60,7 +60,7 @@ namespace dolfin
     ///         UnitSquareMesh mesh2(32, 32, "crossed");
     ///
     UnitSquareMesh(std::size_t nx, std::size_t ny, std::string diagonal="right")
-      : RectangleMesh(Point(0.0, 0.0), Point(1.0, 1.0), nx, ny, diagonal) {}
+      : UnitSquareMesh(MPI_COMM_WORLD, nx, ny, diagonal) {}
 
     /// Create a uniform finite element _Mesh_ over the unit square
     /// [0,1] x [0,1].
diff --git a/dolfin/generation/dolfin_generation.h b/dolfin/generation/dolfin_generation.h
index 4ede270..8e99809 100644
--- a/dolfin/generation/dolfin_generation.h
+++ b/dolfin/generation/dolfin_generation.h
@@ -13,5 +13,7 @@
 #include <dolfin/generation/UnitSquareMesh.h>
 #include <dolfin/generation/UnitQuadMesh.h>
 #include <dolfin/generation/UnitHexMesh.h>
+#include <dolfin/generation/UnitDiscMesh.h>
+#include <dolfin/generation/SphericalShellMesh.h>
 
 #endif
diff --git a/dolfin/geometry/BoundingBoxTree.cpp b/dolfin/geometry/BoundingBoxTree.cpp
index eedd852..bc8a03e 100644
--- a/dolfin/geometry/BoundingBoxTree.cpp
+++ b/dolfin/geometry/BoundingBoxTree.cpp
@@ -47,24 +47,8 @@ void BoundingBoxTree::build(const Mesh& mesh)
 //-----------------------------------------------------------------------------
 void BoundingBoxTree::build(const Mesh& mesh, std::size_t tdim)
 {
-  // Select implementation
-  switch (mesh.geometry().dim())
-  {
-  case 1:
-    _tree.reset(new BoundingBoxTree1D());
-    break;
-  case 2:
-    _tree.reset(new BoundingBoxTree2D());
-    break;
-  case 3:
-    _tree.reset(new BoundingBoxTree3D());
-    break;
-  default:
-    dolfin_error("BoundingBoxTree.cpp",
-                 "build bounding box tree",
-                 "Not implemented for geometric dimension %d",
-                 mesh.geometry().dim());
-  }
+
+  _tree = GenericBoundingBoxTree::create(mesh.geometry().dim());
 
   // Build tree
   dolfin_assert(_tree);
@@ -135,6 +119,17 @@ BoundingBoxTree::compute_entity_collisions(const Point& point) const
   return _tree->compute_entity_collisions(point, *_mesh);
 }
 //-----------------------------------------------------------------------------
+std::vector<unsigned int>
+BoundingBoxTree::compute_process_collisions(const Point& point) const
+{
+  // Check that tree has been built
+  _check_built();
+
+  // Delegate call to implementation
+  dolfin_assert(_tree);
+  return _tree->compute_process_collisions(point);
+}
+//-----------------------------------------------------------------------------
 std::pair<std::vector<unsigned int>, std::vector<unsigned int>>
   BoundingBoxTree::compute_entity_collisions(const BoundingBoxTree& tree) const
 {
diff --git a/dolfin/geometry/BoundingBoxTree.h b/dolfin/geometry/BoundingBoxTree.h
index 681a92d..e499009 100644
--- a/dolfin/geometry/BoundingBoxTree.h
+++ b/dolfin/geometry/BoundingBoxTree.h
@@ -129,6 +129,21 @@ namespace dolfin
     std::vector<unsigned int>
     compute_entity_collisions(const Point& point) const;
 
+    /// Compute all collisions between process bounding boxes
+    /// and _Point_. Effectively a list of processes which may
+    /// contain the _Point_.
+    ///
+    /// *Returns*
+    ///     std::vector<unsigned int>
+    ///         A list of process numbers where the _Mesh_
+    ///         may collide with (intersect) the given point.
+    ///
+    /// *Arguments*
+    ///     point (_Point_)
+    ///         The point.
+    std::vector<unsigned int>
+    compute_process_collisions(const Point& point) const;
+
     /// Compute all collisions between entities and _BoundingBoxTree_.
     ///
     /// *Returns*
@@ -250,7 +265,7 @@ namespace dolfin
     void _check_built() const;
 
     // Dimension-dependent implementation
-    std::unique_ptr<GenericBoundingBoxTree> _tree;
+    std::shared_ptr<GenericBoundingBoxTree> _tree;
 
     // Pointer to the mesh. We all know that we don't really want
     // to store a pointer to the mesh here, but without it we will
diff --git a/dolfin/geometry/CollisionDetection.cpp b/dolfin/geometry/CollisionDetection.cpp
index 5ed393f..199d178 100644
--- a/dolfin/geometry/CollisionDetection.cpp
+++ b/dolfin/geometry/CollisionDetection.cpp
@@ -483,14 +483,9 @@ bool CollisionDetection::collides_interval_point(const Point& p0,
   v /= vnorm;
   const double a = v.dot(w) / wnorm;
 
-  // Cosine should be 1
-  if (std::abs(1-a) < DOLFIN_EPS_LARGE)
-  {
-    // Check if projected point is between p0 and p1
-    const double t = v.dot(w);
-    if (t >= 0 and t <= 1)
-      return true;
-  }
+  // Cosine should be 1, and point should lie between p0 and p1
+  if (std::abs(1-a) < DOLFIN_EPS_LARGE and wnorm <= vnorm)
+    return true;
 
   return false;
 }
@@ -555,7 +550,7 @@ bool CollisionDetection::collides_triangle_point(const Point& p0,
   Point r = point - p0;
   // Check point is in plane of triangle (for manifold)
   double volume = r.dot(normal);
-  if (volume > DOLFIN_EPS)
+  if (std::abs(volume) > DOLFIN_EPS)
     return false;
 
   // Compute normal to triangle based on point and first edge
diff --git a/dolfin/geometry/GenericBoundingBoxTree.cpp b/dolfin/geometry/GenericBoundingBoxTree.cpp
index 4ab8936..650ff46 100644
--- a/dolfin/geometry/GenericBoundingBoxTree.cpp
+++ b/dolfin/geometry/GenericBoundingBoxTree.cpp
@@ -23,6 +23,7 @@
 // recursion and is more convenient than sending it around.
 #define MAX_DIM 6
 
+#include <dolfin/common/MPI.h>
 #include <dolfin/geometry/Point.h>
 #include <dolfin/mesh/Mesh.h>
 #include <dolfin/mesh/Cell.h>
@@ -41,6 +42,31 @@ GenericBoundingBoxTree::GenericBoundingBoxTree() : _tdim(0)
   // Do nothing
 }
 //-----------------------------------------------------------------------------
+std::shared_ptr<GenericBoundingBoxTree>
+GenericBoundingBoxTree::create(unsigned int gdim)
+{
+  std::shared_ptr<GenericBoundingBoxTree> tree;
+
+  switch (gdim)
+  {
+  case 1:
+    tree.reset(new BoundingBoxTree1D());
+    break;
+  case 2:
+    tree.reset(new BoundingBoxTree2D());
+    break;
+  case 3:
+    tree.reset(new BoundingBoxTree3D());
+    break;
+  default:
+    dolfin_error("BoundingBoxTree.cpp",
+                 "build bounding box tree",
+                 "Not implemented for geometric dimension %d",
+                 gdim);
+  }
+  return tree;
+}
+//-----------------------------------------------------------------------------
 void GenericBoundingBoxTree::build(const Mesh& mesh, std::size_t tdim)
 {
   // Check dimension
@@ -80,6 +106,30 @@ void GenericBoundingBoxTree::build(const Mesh& mesh, std::size_t tdim)
   log(PROGRESS,
       "Computed bounding box tree with %d nodes for %d entities.",
       num_bboxes(), num_leaves);
+
+  const std::size_t mpi_size = MPI::size(mesh.mpi_comm());
+  if (mpi_size > 1)
+  {
+    // Send root node coordinates to all processes
+    std::vector<double> send_bbox(_bbox_coordinates.end() - _gdim*2,
+                                  _bbox_coordinates.end());
+    std::vector<double> recv_bbox;
+    MPI::all_gather(mesh.mpi_comm(), send_bbox, recv_bbox);
+    std::vector<unsigned int> global_leaves(mpi_size);
+    for (std::size_t i = 0; i != mpi_size; ++i)
+      global_leaves[i] = i;
+
+    _global_tree = create(_gdim);
+    _global_tree->_build(recv_bbox,
+                         global_leaves.begin(), global_leaves.end(), _gdim);
+
+    info("Computed global bounding box tree with %d boxes.",
+         _global_tree->num_bboxes());
+    // Print on rank 0
+    //    if(MPI::rank(mesh.mpi_comm()) == 0)
+    //      std::cout << _global_tree->str() << "\n";
+
+  }
 }
 //-----------------------------------------------------------------------------
 void GenericBoundingBoxTree::build(const std::vector<Point>& points)
@@ -149,6 +199,15 @@ GenericBoundingBoxTree::compute_entity_collisions(const Point& point,
   return entities;
 }
 //-----------------------------------------------------------------------------
+std::vector<unsigned int>
+GenericBoundingBoxTree::compute_process_collisions(const Point& point) const
+{
+  if (_global_tree)
+    return _global_tree->compute_collisions(point);
+
+  return std::vector<unsigned int>(1, 0);
+}
+//-----------------------------------------------------------------------------
 std::pair<std::vector<unsigned int>, std::vector<unsigned int>>
 GenericBoundingBoxTree::compute_entity_collisions(
   const GenericBoundingBoxTree& tree,
@@ -652,24 +711,7 @@ void GenericBoundingBoxTree::build_point_search_tree(const Mesh& mesh) const
     points.push_back(cell->midpoint());
 
   // Select implementation
-  const std::size_t gdim = mesh.geometry().dim();
-  switch (gdim)
-  {
-  case 1:
-    _point_search_tree.reset(new BoundingBoxTree1D());
-    break;
-  case 2:
-    _point_search_tree.reset(new BoundingBoxTree2D());
-    break;
-  case 3:
-    _point_search_tree.reset(new BoundingBoxTree3D());
-    break;
-  default:
-    dolfin_error("BoundingBoxTree.cpp",
-                 "build bounding box tree",
-                 "Not implemented for geometric dimension %d",
-                 gdim);
-  }
+  _point_search_tree = create(mesh.geometry().dim());
 
   // Build tree
   dolfin_assert(_point_search_tree);
@@ -727,3 +769,31 @@ GenericBoundingBoxTree::sort_points(std::size_t axis,
   }
 }
 //-----------------------------------------------------------------------------
+std::string GenericBoundingBoxTree::str(bool verbose)
+{
+  std::stringstream s;
+  tree_print(s, _bboxes.size() - 1);
+  return s.str();
+}
+//-----------------------------------------------------------------------------
+void GenericBoundingBoxTree::tree_print(std::stringstream& s, unsigned int i)
+{
+  std::size_t dim = _bbox_coordinates.size() / _bboxes.size();
+  std::size_t idx = i*dim;
+  s << "[";
+  for (unsigned int j = idx; j != idx + dim; ++j)
+    s << _bbox_coordinates[j] << " ";
+  s << "]\n";
+
+  if (_bboxes[i].child_0 == i)
+    s << "leaf containing entity (" << _bboxes[i].child_1 << ")";
+  else
+  {
+    s << "{";
+    tree_print(s, _bboxes[i].child_0);
+    s << ", \n";
+    tree_print(s, _bboxes[i].child_1);
+    s << "}\n";
+  }
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/geometry/GenericBoundingBoxTree.h b/dolfin/geometry/GenericBoundingBoxTree.h
index 0a3f07c..9a72671 100644
--- a/dolfin/geometry/GenericBoundingBoxTree.h
+++ b/dolfin/geometry/GenericBoundingBoxTree.h
@@ -22,6 +22,7 @@
 #define __GENERIC_BOUNDING_BOX_TREE_H
 
 #include <memory>
+#include <sstream>
 #include <set>
 #include <vector>
 #include <dolfin/geometry/Point.h>
@@ -46,6 +47,9 @@ namespace dolfin
     /// Destructor
     virtual ~GenericBoundingBoxTree() {}
 
+    /// Factory function returning (empty) tree of appropriate dimension
+    static std::shared_ptr<GenericBoundingBoxTree> create(unsigned int dim);
+
     /// Build bounding box tree for mesh entities of given dimension
     void build(const Mesh& mesh, std::size_t tdim);
 
@@ -65,6 +69,10 @@ namespace dolfin
     compute_entity_collisions(const Point& point,
                               const Mesh& mesh) const;
 
+    /// Compute all collisions between processes and _Point_
+    std::vector<unsigned int>
+    compute_process_collisions(const Point& point) const;
+
     /// Compute all collisions between entities and _BoundingBoxTree_
     std::pair<std::vector<unsigned int>, std::vector<unsigned int> >
     compute_entity_collisions(const GenericBoundingBoxTree& tree,
@@ -84,6 +92,9 @@ namespace dolfin
     /// Compute closest point and distance to _Point_
     std::pair<unsigned int, double> compute_closest_point(const Point& point) const;
 
+    /// Print out for debugging
+    std::string str(bool verbose=false);
+
   protected:
 
     // Bounding box data. Leaf nodes are indicated by setting child_0
@@ -105,7 +116,10 @@ namespace dolfin
     std::vector<double> _bbox_coordinates;
 
     // Point search tree used to accelerate distance queries
-    mutable std::unique_ptr<GenericBoundingBoxTree> _point_search_tree;
+    mutable std::shared_ptr<GenericBoundingBoxTree> _point_search_tree;
+
+    // Global tree for mesh ownership of each process (same on all processes)
+    std::shared_ptr<GenericBoundingBoxTree> _global_tree;
 
     // Clear existing data if any
     void clear();
@@ -337,6 +351,10 @@ namespace dolfin
                 const std::vector<unsigned int>::iterator& middle,
                 const std::vector<unsigned int>::iterator& end) = 0;
 
+    // Print out recursively, for debugging
+    void tree_print(std::stringstream& s, unsigned int i);
+
+
   };
 
 }
diff --git a/dolfin/geometry/Point.h b/dolfin/geometry/Point.h
index 3220629..016f8a8 100644
--- a/dolfin/geometry/Point.h
+++ b/dolfin/geometry/Point.h
@@ -24,6 +24,7 @@
 #ifndef __POINT_H
 #define __POINT_H
 
+#include <array>
 #include <cmath>
 #include <iostream>
 #include <dolfin/log/log.h>
@@ -50,7 +51,7 @@ namespace dolfin
     ///     z (double)
     ///         The z-coordinate.
     Point(const double x=0.0, const double y=0.0, const double z=0.0)
-    { _x[0] = x; _x[1] = y; _x[2] = z; }
+      : _x({{x, y, z}}) {}
 
     /// Create point from array
     ///
@@ -59,24 +60,29 @@ namespace dolfin
     ///         Dimension of the array.
     ///     x (double)
     ///         The array to create a Point from.
-    Point(std::size_t dim, const double* x)
-    { for (std::size_t i = 0; i < 3; i++) _x[i] = (i < dim ? x[i] : 0.0); }
+    Point(std::size_t dim, const double* x) : _x({{0.0, 0.0, 0.0}})
+    {
+      for (std::size_t i = 0; i < dim; i++)
+        _x[i] = x[i];
+    }
 
     /// Create point from Array
     ///
     /// *Arguments*
     ///     x (Array<double>)
     ///         Array of coordinates.
-    Point(const Array<double>& x)
-    { for (std::size_t i = 0; i < 3; i++) _x[i] = (i < x.size() ? x[i] : 0.0); }
+    Point(const Array<double>& x) : _x({{0.0, 0.0, 0.0}})
+    {
+      for (std::size_t i = 0; i < x.size(); i++)
+        _x[i] = x[i];
+    }
 
     /// Copy constructor
     ///
     /// *Arguments*
     ///     p (_Point_)
     ///         The object to be copied.
-    Point(const Point& p)
-    { _x[0] = p._x[0]; _x[1] = p._x[1]; _x[2] = p._x[2]; }
+    Point(const Point& p) : _x({{p._x[0], p._x[1], p._x[2]}}) {}
 
     /// Destructor
     ~Point() {}
@@ -135,7 +141,7 @@ namespace dolfin
     ///     list of doubles
     ///         The coordinates.
     double* coordinates()
-    { return _x; }
+    { return _x.data(); }
 
     /// Return coordinate array (const. version)
     ///
@@ -143,7 +149,7 @@ namespace dolfin
     ///     list of doubles
     ///         The coordinates.
     const double* coordinates() const
-    { return _x; }
+    { return _x.data(); }
 
     /// Compute sum of two points
     Point operator+ (const Point& p) const
@@ -183,7 +189,7 @@ namespace dolfin
 
     /// Assignment operator
     const Point& operator= (const Point& p)
-    { _x[0] = p._x[0]; _x[1] = p._x[1]; _x[2] = p._x[2]; return *this; }
+    { _x = {{p._x[0], p._x[1], p._x[2]}}; return *this; }
 
     /// Compute squared distance to given point
     ///
@@ -247,9 +253,7 @@ namespace dolfin
     ///
     ///         3
     double norm() const
-    {
-      return std::sqrt(_x[0]*_x[0] + _x[1]*_x[1] + _x[2]*_x[2]);
-    }
+    { return std::sqrt(_x[0]*_x[0] + _x[1]*_x[1] + _x[2]*_x[2]); }
 
     /// Compute norm of point representing a vector from the origin
     ///
@@ -268,9 +272,7 @@ namespace dolfin
     ///
     ///         9
     double squared_norm() const
-    {
-      return _x[0]*_x[0] + _x[1]*_x[1] + _x[2]*_x[2];
-    }
+    { return _x[0]*_x[0] + _x[1]*_x[1] + _x[2]*_x[2]; }
 
     /// Compute cross product with given vector
     ///
@@ -333,7 +335,7 @@ namespace dolfin
 
   private:
 
-    double _x[3];
+    std::array<double, 3> _x;
 
   };
 
diff --git a/dolfin/graph/CSRGraph.h b/dolfin/graph/CSRGraph.h
index b0344ef..fe0407c 100644
--- a/dolfin/graph/CSRGraph.h
+++ b/dolfin/graph/CSRGraph.h
@@ -44,14 +44,15 @@ namespace dolfin
 
   public:
 
-    /// Access edges individually by using operator()[] to get a node object
+    /// Access edges individually by using operator()[] to get a node
+    /// object
     class node
     {
     public:
-      node(const typename std::vector<T>::const_iterator& begin_it,
-           const typename std::vector<T>::const_iterator& end_it)
-        : begin_edge(begin_it), end_edge(end_it)
-      { }
+
+    node(const typename std::vector<T>::const_iterator& begin_it,
+         const typename std::vector<T>::const_iterator& end_it)
+      : begin_edge(begin_it), end_edge(end_it) {}
 
       /// Iterator pointing to beginning of edges
       typename std::vector<T>::const_iterator begin() const
@@ -70,13 +71,13 @@ namespace dolfin
       { return *(begin_edge + i); }
 
     private:
+
       typename std::vector<T>::const_iterator begin_edge;
       typename std::vector<T>::const_iterator end_edge;
     };
 
     /// Empty CSR Graph
-    CSRGraph() : _node_offsets(1, 0)
-    {}
+    CSRGraph() : _node_offsets(1, 0) {}
 
     /// Create a CSR Graph from a collection of edges (X is a
     /// container some type, e.g. std::vector<unsigned int> or
@@ -105,14 +106,27 @@ namespace dolfin
       calculate_node_distribution();
     }
 
+    /// Create a CSR Graph from ParMETIS style adjacency lists
+    CSRGraph(MPI_Comm mpi_comm, const T* xadj, const T* adjncy, std::size_t n)
+      : _mpi_comm(mpi_comm)
+    {
+      _node_offsets.assign(xadj, xadj + n + 1);
+      _edges.assign(adjncy, adjncy + xadj[n]);
+
+      // Compute node offsets
+      calculate_node_distribution();
+    }
+
     /// Destructor
     ~CSRGraph() {}
 
     /// Vector containing all edges for all local nodes
+    /// ("adjncy" in ParMETIS)
     const std::vector<T>& edges() const
     { return _edges; }
 
     /// Vector containing all edges for all local nodes (non-const)
+    /// ("adjncy" in ParMETIS)
     std::vector<T>& edges()
     { return _edges; }
 
@@ -124,11 +138,17 @@ namespace dolfin
                   _edges.begin() + _node_offsets[i + 1]);
     }
 
+
     /// Vector containing index offsets into edges for all local nodes
-    /// (plus extra entry marking end)
+    /// (plus extra entry marking end) ("xadj" in ParMETIS)
     const std::vector<T>& nodes() const
     { return _node_offsets; }
 
+    /// Vector containing index offsets into edges for all local nodes
+    /// (plus extra entry marking end) ("xadj" in ParMETIS)
+    std::vector<T>& nodes()
+    { return _node_offsets; }
+
     /// Number of local edges in graph
     std::size_t num_edges() const
     { return _edges.size(); }
@@ -152,14 +172,18 @@ namespace dolfin
     const std::vector<T>& node_distribution() const
     { return _node_distribution; }
 
+    /// Return number of nodes (offset) on each process (non-const)
+    std::vector<T>& node_distribution()
+    { return _node_distribution; }
+
   private:
 
     // Compute offset of number of nodes on each process
     void calculate_node_distribution()
     {
       // Communicate number of nodes between all processors
-      const std::size_t num_nodes = size();
-      MPI::all_gather(_mpi_comm, (T) num_nodes, _node_distribution);
+      const T num_nodes = size();
+      MPI::all_gather(_mpi_comm, num_nodes, _node_distribution);
 
       _node_distribution.insert(_node_distribution.begin(), 0);
       for (std::size_t i = 1; i != _node_distribution.size(); ++i)
diff --git a/dolfin/graph/Graph.h b/dolfin/graph/Graph.h
index 00d2ed7..ba513e6 100644
--- a/dolfin/graph/Graph.h
+++ b/dolfin/graph/Graph.h
@@ -26,7 +26,6 @@
 #define BOOST_NO_HASH
 
 #include <boost/graph/adjacency_list.hpp>
-#include <boost/unordered_set.hpp>
 #include <dolfin/common/Set.h>
 
 namespace dolfin
diff --git a/dolfin/graph/GraphBuilder.cpp b/dolfin/graph/GraphBuilder.cpp
index b59be57..81f3e1f 100644
--- a/dolfin/graph/GraphBuilder.cpp
+++ b/dolfin/graph/GraphBuilder.cpp
@@ -34,7 +34,6 @@
 #include <dolfin/common/types.h>
 #include <dolfin/fem/GenericDofMap.h>
 #include <dolfin/mesh/Cell.h>
-#include <dolfin/mesh/LocalMeshData.h>
 #include <dolfin/mesh/MeshEntityIterator.h>
 #include <dolfin/mesh/Vertex.h>
 #include "GraphBuilder.h"
@@ -45,6 +44,8 @@ using namespace dolfin;
 Graph GraphBuilder::local_graph(const Mesh& mesh, const GenericDofMap& dofmap0,
                                                   const GenericDofMap& dofmap1)
 {
+  Timer timer("Build local sparsity graph from dofmaps");
+
   // Create empty graph
   const std::size_t n = dofmap0.global_dimension();
   Graph graph(n);
@@ -112,8 +113,7 @@ Graph GraphBuilder::local_graph(const Mesh& mesh,
     }
 
     // Add edges to graph
-    graph[vertex_entity_index].insert(entity_list0.begin(),
-                                      entity_list0.end());
+    graph[vertex_entity_index].insert(entity_list0.begin(), entity_list0.end());
   }
 
   return graph;
@@ -151,45 +151,92 @@ Graph GraphBuilder::local_graph(const Mesh& mesh,
   return graph;
 }
 //-----------------------------------------------------------------------------
-void GraphBuilder::compute_dual_graph(
-  const MPI_Comm mpi_comm,
-  const LocalMeshData& mesh_data,
-  std::vector<std::set<std::size_t>>& local_graph,
-  std::set<std::size_t>& ghost_vertices)
+std::pair<std::int32_t, std::int32_t>
+GraphBuilder::compute_dual_graph(const MPI_Comm mpi_comm,
+                                 const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                                 const CellType& cell_type,
+                                 const std::int64_t num_global_vertices,
+                                 std::vector<std::vector<std::size_t>>& local_graph,
+                                 std::set<std::int64_t>& ghost_vertices)
 {
+  log(PROGRESS, "Build mesh dual graph");
+
+  // Compute local part of dual graph
   FacetCellMap facet_cell_map;
+  std::int32_t num_local_edges = compute_local_dual_graph(mpi_comm, cell_vertices,
+                                                          cell_type, local_graph,
+                                                          facet_cell_map);
+
+  // Compute nonlocal part
+  std::int32_t num_nonlocal_edges
+    = compute_nonlocal_dual_graph(mpi_comm, cell_vertices, cell_type,
+                                  num_global_vertices, local_graph, facet_cell_map,
+                                  ghost_vertices);
 
-#ifdef HAS_MPI
-  compute_local_dual_graph(mpi_comm, mesh_data, local_graph, facet_cell_map);
-  compute_nonlocal_dual_graph(mpi_comm, mesh_data, local_graph, facet_cell_map,
-                              ghost_vertices);
-  #else
-  compute_local_dual_graph(mpi_comm, mesh_data, local_graph, facet_cell_map);
-  #endif
+  // Shrink to fit
+  local_graph.shrink_to_fit();
+
+  return {num_local_edges, num_nonlocal_edges};
 }
 //-----------------------------------------------------------------------------
-void GraphBuilder::compute_local_dual_graph(
+std::int32_t GraphBuilder::compute_local_dual_graph(
   const MPI_Comm mpi_comm,
-  const LocalMeshData& mesh_data,
-  std::vector<std::set<std::size_t>>& local_graph,
+  const boost::multi_array<std::int64_t, 2>& cell_vertices,
+  const CellType& cell_type,
+  std::vector<std::vector<std::size_t>>& local_graph,
   FacetCellMap& facet_cell_map)
 {
-  Timer timer("Compute local dual graph");
-
-  // List of cell vertices
-  const boost::multi_array<std::size_t, 2>& cell_vertices
-    = mesh_data.cell_vertices;
+  log(PROGRESS, "Build local part of mesh dual graph");
 
-  const std::size_t tdim = mesh_data.tdim;
-  std::unique_ptr<CellType> cell_type(CellType::create(mesh_data.cell_type));
+  const std::int8_t tdim = cell_type.dim();
+  const std::int8_t num_entity_vertices = cell_type.num_vertices(tdim - 1);
+  switch (num_entity_vertices)
+  {
+  case 1:
+    return compute_local_dual_graph_keyed<1>(mpi_comm, cell_vertices,
+                                             cell_type, local_graph,
+                                             facet_cell_map);
+  case 2:
+    return compute_local_dual_graph_keyed<2>(mpi_comm, cell_vertices,
+                                             cell_type, local_graph,
+                                             facet_cell_map);
+    break;
+  case 3:
+    return compute_local_dual_graph_keyed<3>(mpi_comm, cell_vertices,
+                                             cell_type, local_graph,
+                                             facet_cell_map);
+  case 4:
+    return compute_local_dual_graph_keyed<4>(mpi_comm, cell_vertices,
+                                             cell_type, local_graph,
+                                             facet_cell_map);
+  default:
+    dolfin_error("GraphBuilder.cpp",
+                 "compute local part of dual graph",
+                 "Entities with %d vertices not supported",
+                 num_entity_vertices);
+    return 0;
+  }
+}
+//-----------------------------------------------------------------------------
+template<int N>
+std::int32_t GraphBuilder::compute_local_dual_graph_keyed(
+  const MPI_Comm mpi_comm,
+  const boost::multi_array<std::int64_t, 2>& cell_vertices,
+  const CellType& cell_type,
+  std::vector<std::vector<std::size_t>>& local_graph,
+  FacetCellMap& facet_cell_map)
+{
+  Timer timer("Compute local part of mesh dual graph");
 
-  const std::size_t num_local_cells = mesh_data.global_cell_indices.size();
-  const std::size_t num_vertices_per_cell = cell_type->num_entities(0);
-  const std::size_t num_facets_per_cell = cell_type->num_entities(tdim - 1);
-  const std::size_t num_vertices_per_facet = cell_type->num_vertices(tdim - 1);
+  const std::int8_t tdim = cell_type.dim();
+  const std::int32_t num_local_cells = cell_vertices.shape()[0];
+  const std::int8_t num_vertices_per_cell = cell_type.num_entities(0);
+  const std::int8_t num_facets_per_cell = cell_type.num_entities(tdim - 1);
+  const std::int8_t num_vertices_per_facet = cell_type.num_vertices(tdim - 1);
 
-  dolfin_assert(num_local_cells == cell_vertices.shape()[0]);
-  dolfin_assert(num_vertices_per_cell == cell_vertices.shape()[1]);
+  dolfin_assert(N == num_vertices_per_facet);
+  dolfin_assert(num_local_cells == (int) cell_vertices.shape()[0]);
+  dolfin_assert(num_vertices_per_cell == (int) cell_vertices.shape()[1]);
 
   local_graph.resize(num_local_cells);
   facet_cell_map.clear();
@@ -198,89 +245,132 @@ void GraphBuilder::compute_local_dual_graph(
   // (internal to this function, not the user numbering) numbering
 
   // Get offset for this process
-  const std::size_t cell_offset = MPI::global_offset(mpi_comm, num_local_cells,
-                                                     true);
+  const std::int64_t cell_offset = MPI::global_offset(mpi_comm, num_local_cells,
+                                                      true);
+
+  // Create map from cell vertices to entity vertices
+  boost::multi_array<unsigned int, 2>
+    facet_vertices(boost::extents[num_facets_per_cell][num_vertices_per_facet]);
+  std::vector<unsigned int> v(num_vertices_per_cell);
+  std::iota(v.begin(), v.end(), 0);
+  cell_type.create_entities(facet_vertices, tdim - 1, v.data());
+
+  // Vector-of-arrays data structure, which is considerably faster than
+  // vector-of-vectors.
+  std::vector<std::pair<std::array<std::int32_t, N>, std::int32_t>>
+    facets(num_facets_per_cell*num_local_cells);
+
+  // Iterate over all cells and build list of all facets (keyed on
+  // sorted vertex indices), with cell index attached
+  int counter = 0;
+  for (std::int32_t i = 0; i < num_local_cells; ++i)
+  {
+    // Iterate over facets of cell
+    for (std::int8_t j = 0; j < num_facets_per_cell; ++j)
+    {
+      // Get list of facet vertices
+      auto& facet = facets[counter].first;
+      for (std::int8_t k = 0; k < N; ++k)
+        facet[k] = cell_vertices[i][facet_vertices[j][k]];
 
-  // Create map from facet (list of vertex indices) to cells
-  facet_cell_map.rehash((facet_cell_map.size()
-                     + num_local_cells)/facet_cell_map.max_load_factor() + 1);
+      // Sort facet vertices
+      std::sort(facet.begin(), facet.end());
 
-  boost::multi_array<unsigned int, 2> fverts(boost::extents
-                                             [num_facets_per_cell]
-                                             [num_vertices_per_facet]);
+      // Attach local cell index
+      facets[counter].second = i;
 
-  std::vector<unsigned int> cellvtx(num_vertices_per_cell);
-  std::pair<std::vector<std::size_t>, std::size_t> map_entry;
-  map_entry.first.resize(num_vertices_per_facet);
+      // Increment facet counter
+      counter++;
+    }
+  }
 
-  // Iterate over all cells
-  for (std::size_t i = 0; i < num_local_cells; ++i)
-  {
-    map_entry.second = i;
+  // Sort facets
+  std::sort(facets.begin(), facets.end());
 
-    std::copy(cell_vertices[i].begin(), cell_vertices[i].end(),
-              cellvtx.begin());
-    cell_type->create_entities(fverts, tdim - 1, cellvtx.data());
+  // Find maching facets by comparing facet i and facet i -1
+  std::size_t num_local_edges = 0;
+  for (std::size_t i = 1; i < facets.size(); ++i)
+  {
+    const int ii = i;
+    const int jj = i - 1;
 
-    // Iterate over facets in cell
-    for (std::size_t j = 0; j < num_facets_per_cell; ++j)
+    const auto& facet0 = facets[jj].first;
+    const auto& facet1 = facets[ii].first;
+    const int cell_index0 = facets[jj].second;
+    if (std::equal(facet1.begin(), facet1.end(), facet0.begin()))
     {
-      std::copy(fverts[j].begin(),
-                fverts[j].end(), map_entry.first.begin());
-      std::sort(map_entry.first.begin(), map_entry.first.end());
+      // Add edges (directed graph, so add both ways)
+      const int cell_index1 = facets[ii].second;
+      local_graph[cell_index0].push_back(cell_index1 + cell_offset);
+      local_graph[cell_index1].push_back(cell_index0 + cell_offset);
 
-      // Map lookup/insert
-      std::pair<FacetCellMap::iterator, bool> map_lookup
-        = facet_cell_map.insert(map_entry);
+      // Since we've just found a matching pair, the next pair cannot be
+      // matching, so advance 1
+      ++i;
 
-      // If facet was already in the map
-      if (!map_lookup.second)
-      {
-        // Already in map. Connect cells and delete facet from map
-        // Add offset to cell index when inserting into local_graph
-        local_graph[i].insert(map_lookup.first->second + cell_offset);
-        local_graph[map_lookup.first->second].insert(i + cell_offset);
-
-        // Save memory and search time by erasing
-        facet_cell_map.erase(map_lookup.first);
-      }
+      // Increment number of local edges found
+      ++num_local_edges;
+    }
+    else
+    {
+      // No match, so add facet0 to map
+      //facet_cell_map.insert(facet_cell_map.end(), {std::vector<std::size_t>(facet0.begin(),
+      //    facet0.end()), cell_index0});
+      facet_cell_map.push_back({std::vector<std::size_t>(facet0.begin(),
+          facet0.end()), cell_index0});
     }
   }
 
+  // Add last facet, as it's not covered by the above loop. We could
+  // check it against the preceding facet, but it's easier to just
+  // insert it here
+  if (!facets.empty())
+  {
+    const int k = facets.size() - 1;
+    const int cell_index = facets[k].second;
+    facet_cell_map.push_back({std::vector<std::size_t>(facets[k].first.begin(),
+        facets[k].first.end()), cell_index});
+  }
+
+  return num_local_edges;
 }
 //-----------------------------------------------------------------------------
-void GraphBuilder::compute_nonlocal_dual_graph(
+std::int32_t GraphBuilder::compute_nonlocal_dual_graph(
   const MPI_Comm mpi_comm,
-  const LocalMeshData& mesh_data,
-  std::vector<std::set<std::size_t>>& local_graph,
+  const boost::multi_array<std::int64_t, 2>& cell_vertices,
+  const CellType& cell_type,
+  const std::int64_t num_global_vertices,
+  std::vector<std::vector<std::size_t>>& local_graph,
   FacetCellMap& facet_cell_map,
-  std::set<std::size_t>& ghost_vertices)
+  std::set<std::int64_t>& ghost_vertices)
 {
-  Timer timer("Compute non-local dual graph");
+  log(PROGRESS, "Build nonlocal part of mesh dual graph");
+  Timer timer("Compute non-local part of mesh dual graph");
+
+  // Get number of MPI processes, and return if mesh is not distributed
+  const int num_processes = MPI::size(mpi_comm);
+  if (num_processes == 1)
+    return 0;
 
   // At this stage facet_cell map only contains facets->cells with
   // edge facets either interprocess or external boundaries
 
-  const std::size_t tdim = mesh_data.tdim;
-  std::unique_ptr<CellType> cell_type(CellType::create(mesh_data.cell_type));
+  const int tdim = cell_type.dim();
 
   // List of cell vertices
-  const boost::multi_array<std::size_t, 2>& cell_vertices
-    = mesh_data.cell_vertices;
-  const std::size_t num_local_cells = mesh_data.global_cell_indices.size();
-  const std::size_t num_vertices_per_cell = cell_type->num_entities(0);
-  const std::size_t num_vertices_per_facet = cell_type->num_vertices(tdim - 1);
+  const std::int32_t num_local_cells = cell_vertices.shape()[0];
+  const std::int8_t num_vertices_per_cell = cell_type.num_entities(0);
+  const std::int8_t num_vertices_per_facet = cell_type.num_vertices(tdim - 1);
 
-  dolfin_assert(num_local_cells == cell_vertices.shape()[0]);
-  dolfin_assert(num_vertices_per_cell == cell_vertices.shape()[1]);
+  dolfin_assert(num_local_cells == (int) cell_vertices.shape()[0]);
+  dolfin_assert(num_vertices_per_cell == (int) cell_vertices.shape()[1]);
 
   // Compute local edges (cell-cell connections) using global
   // (internal to this function, not the user numbering) numbering
 
   // Get offset for this process
-  const std::size_t offset = MPI::global_offset(mpi_comm, num_local_cells,
-                                                true);
-  const std::size_t num_processes = MPI::size(mpi_comm);
+  const std::int64_t offset = MPI::global_offset(mpi_comm, num_local_cells,
+                                                 true);
 
   // Send facet-cell map to intermediary match-making processes
   std::vector<std::vector<std::size_t>> send_buffer(num_processes);
@@ -289,12 +379,12 @@ void GraphBuilder::compute_nonlocal_dual_graph(
   // Pack map data and send to match-maker process
   for (auto &it : facet_cell_map)
   {
-    // FIXME: Could use a better index? First vertex is slightly skewed
-    //        towards low values - may not be important
+    // FIXME: Could use a better index? First vertex is slightly
+    //        skewed towards low values - may not be important
 
     // Use first vertex of facet to partition into blocks
-    std::size_t dest_proc = MPI::index_owner(mpi_comm, (it.first)[0],
-                                             mesh_data.num_global_vertices);
+    const int dest_proc = MPI::index_owner(mpi_comm, (it.first)[0],
+                                           num_global_vertices);
 
     // Pack map into vectors to send
     send_buffer[dest_proc].insert(send_buffer[dest_proc].end(),
@@ -304,6 +394,7 @@ void GraphBuilder::compute_nonlocal_dual_graph(
     send_buffer[dest_proc].push_back(it.second + offset);
   }
 
+  // FIXME: This does not look memory scalable. Switch to 'post-office' model.
   // Send data
   MPI::all_to_all(mpi_comm, send_buffer, received_buffer);
 
@@ -319,7 +410,7 @@ void GraphBuilder::compute_nonlocal_dual_graph(
   std::pair<std::vector<std::size_t>,
             std::pair<std::size_t, std::size_t>> key;
   key.first.resize(num_vertices_per_facet);
-  for (std::size_t p = 0; p < num_processes; ++p)
+  for (int p = 0; p < num_processes; ++p)
   {
     // Unpack into map
     const std::vector<std::size_t>& data_p = received_buffer[p];
@@ -327,8 +418,7 @@ void GraphBuilder::compute_nonlocal_dual_graph(
          it += (num_vertices_per_facet + 1))
     {
       // Build map key
-      std::copy(it, it + num_vertices_per_facet,
-                key.first.begin());
+      std::copy(it, it + num_vertices_per_facet, key.first.begin());
       key.second.first = p;
       key.second.second = *(it + num_vertices_per_facet);
 
@@ -362,17 +452,28 @@ void GraphBuilder::compute_nonlocal_dual_graph(
   ghost_vertices.clear();
 
   // Flatten received data and insert connected cells into local map
+  std::int32_t num_nonlocal_edges = 0;
   for (std::size_t p = 0; p < received_buffer.size(); ++p)
   {
     const std::vector<std::size_t>& cell_list = received_buffer[p];
     for (std::size_t i = 0; i < cell_list.size(); i += 2)
     {
-      dolfin_assert(cell_list[i] >= offset);
-      dolfin_assert(cell_list[i] - offset < local_graph.size());
+      dolfin_assert((std::int64_t) cell_list[i] >= offset);
+      dolfin_assert((std::int64_t)  (cell_list[i] - offset)
+                    < (std::int64_t) local_graph.size());
+
+      //local_graph[cell_list[i] - offset].insert(cell_list[i + 1]);
+      auto& edges = local_graph[cell_list[i] - offset];
+      auto it = std::find(edges.begin(), edges.end(), cell_list[i + 1]);
+      if (it == local_graph[cell_list[i] - offset].end())
+        edges.push_back(cell_list[i + 1]);
 
-      local_graph[cell_list[i] - offset].insert(cell_list[i + 1]);
       ghost_vertices.insert(cell_list[i + 1]);
     }
+
+    ++num_nonlocal_edges;
   }
+
+  return num_nonlocal_edges;
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/graph/GraphBuilder.h b/dolfin/graph/GraphBuilder.h
index e84b519..e306f9d 100644
--- a/dolfin/graph/GraphBuilder.h
+++ b/dolfin/graph/GraphBuilder.h
@@ -21,6 +21,8 @@
 #ifndef __GRAPH_BUILDER_H
 #define __GRAPH_BUILDER_H
 
+#include <cstdint>
+#include <utility>
 #include <set>
 #include <boost/unordered_map.hpp>
 #include <vector>
@@ -32,8 +34,8 @@ namespace dolfin
 {
 
   // Forward declarations
+  class CellType;
   class GenericDofMap;
-  class LocalMeshData;
   class Mesh;
 
   /// This class builds a Graph corresponding to various objects
@@ -53,38 +55,56 @@ namespace dolfin
 
     /// Build local graph (specialized version)
     static Graph local_graph(const Mesh& mesh, std::size_t dim0,
-                                               std::size_t dim1);
+                             std::size_t dim1);
 
-    /// Build distributed dual graph (cell-cell connections) for from
-    /// LocalMeshData
-    static void
+    /// Build distributed dual graph (cell-cell connections) from
+    /// minimal mesh data, and return (num local edges, num
+    /// non-local edges)
+    static
+      std::pair<std::int32_t, std::int32_t>
       compute_dual_graph(const MPI_Comm mpi_comm,
-                         const LocalMeshData& mesh_data,
-                         std::vector<std::set<std::size_t> >& local_graph,
-                         std::set<std::size_t>& ghost_vertices);
-
+                         const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                         const CellType& cell_type,
+                         const std::int64_t num_global_vertices,
+                         std::vector<std::vector<std::size_t>>& local_graph,
+                         std::set<std::int64_t>& ghost_vertices);
   private:
 
     friend class MeshPartitioning;
 
-    typedef boost::unordered_map<std::vector<std::size_t>, std::size_t>
+    typedef std::vector<std::pair<std::vector<std::size_t>, std::int32_t>>
       FacetCellMap;
 
-    // Build local part of dual graph for mesh
-    static void
+    // Compute local part of the dual graph, and return number of
+    // local edges in the graph (undirected)
+    static std::int32_t
       compute_local_dual_graph(const MPI_Comm mpi_comm,
-                               const LocalMeshData& mesh_data,
-                               std::vector<std::set<std::size_t> >& local_graph,
+                               const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                               const CellType& cell_type,
+                               std::vector<std::vector<std::size_t>>& local_graph,
                                FacetCellMap& facet_cell_map);
 
-    // Build nonlocal part of dual graph for mesh.
-    // GraphBuilder::compute_local_dual_graph should be called first.
-    static void
+    // Compute local part of the dual graph, and return number of
+    // local edges in the graph (undirected)
+    template<int N>
+    static std::int32_t
+      compute_local_dual_graph_keyed(const MPI_Comm mpi_comm,
+                                     const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                                     const CellType& cell_type,
+                                     std::vector<std::vector<std::size_t>>& local_graph,
+                                     FacetCellMap& facet_cell_map);
+
+    // Build nonlocal part of dual graph for mesh and return number of
+    // non-local edges. Note: GraphBuilder::compute_local_dual_graph
+    // should be called before this function is called.
+    static std::int32_t
       compute_nonlocal_dual_graph(const MPI_Comm mpi_comm,
-                                  const LocalMeshData& mesh_data,
-                                  std::vector<std::set<std::size_t> >& local_graph,
+                                  const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                                  const CellType& cell_type,
+                                  const std::int64_t num_global_vertices,
+                                  std::vector<std::vector<std::size_t>>& local_graph,
                                   FacetCellMap& facet_cell_map,
-                                  std::set<std::size_t>& ghost_vertices);
+                                  std::set<std::int64_t>& ghost_vertices);
 
   };
 
diff --git a/dolfin/graph/GraphOrdering.cpp b/dolfin/graph/GraphOrdering.cpp
deleted file mode 100644
index a407d31..0000000
--- a/dolfin/graph/GraphOrdering.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright (C) 2010 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Anders Logg 2011
-//
-// First added:  2010-11-15
-// Last changed: 2011-11-15
-
-#ifdef HAS_TRILINOS
-
-// Included here to avoid a C++ problem with some MPI implementations
-#include <dolfin/common/MPI.h>
-
-#include <zoltan_cpp.h>
-
-#include "dolfin/common/MPI.h"
-#include "dolfin/la/GenericSparsityPattern.h"
-#include "dolfin/la/TensorLayout.h"
-#include "dolfin/log/log.h"
-#include "GraphOrdering.h"
-
-using namespace dolfin;
-
-//-----------------------------------------------------------------------------
-GraphOrdering::GraphOrdering(const TensorLayout& tensor_layout)
-      : _tensor_layout(tensor_layout)
-{
-  if (tensor_layout.rank() != 2)
-  {
-    dolfin_error("GraphOrdering.cpp",
-                 "create matrix re-ordering",
-                 "Zoltan object for sparsity pattern re-ordering can only be used for rank 2 tensors");
-  }
-
-  if (!tensor_layout.sparsity_pattern())
-  {
-    dolfin_error("GraphOrdering.cpp",
-                 "create matrix re-ordering",
-                 "TensorLayout object must a have sparsity pattern");
-  }
-
-  if (tensor_layout.size(0) != tensor_layout.size(1))
-  {
-    dolfin_error("GraphOrdering.cpp",
-                 "create matrix re-ordering",
-                 "Zoltan object for sparsity pattern re-ordering can only be used for square matrices");
-  }
-}
-//-----------------------------------------------------------------------------
-std::vector<std::size_t> GraphOrdering::compute_local_reordering_map()
-{
-  // Initialise Zoltan
-  float version;
-  int argc = 0;
-  char** argv = NULL;
-  Zoltan_Initialize(argc, argv, &version);
-
-  // Create Zoltan object
-  Zoltan zoltan;
-
-  // Set parameters
-  //zoltan.Set_Param( "ORDER_METHOD", "METIS");
-  zoltan.Set_Param( "ORDER_METHOD", "SCOTCH");
-  zoltan.Set_Param( "NUM_GID_ENTRIES", "1");  // global ID is 1 integer
-  zoltan.Set_Param( "NUM_LID_ENTRIES", "1");  // local ID is 1 integer
-  zoltan.Set_Param( "OBJ_WEIGHT_DIM", "0");   // omit object weights
-
-  // Set call-back functions
-  zoltan.Set_Num_Obj_Fn(GraphOrdering::get_number_of_objects, this);
-  zoltan.Set_Obj_List_Fn(GraphOrdering::get_object_list, this);
-  zoltan.Set_Num_Edges_Multi_Fn(GraphOrdering::get_number_edges, this);
-  zoltan.Set_Edge_List_Multi_Fn(GraphOrdering::get_all_edges, this);
-
-  // Create array for global ids that should be re-ordered
-  std::vector<ZOLTAN_ID_TYPE> global_ids(num_global_objects());
-  for (std::size_t i = 0; i < global_ids.size(); ++i)
-    global_ids[i] = i;
-
-  // Create array for re-ordered vertices
-  std::vector<ZOLTAN_ID_TYPE> new_id(num_global_objects());
-
-  // Compute re-ordering
-  int rc = zoltan.Order(1, num_global_objects(), &global_ids[0], &new_id[0]);
-
-  // Check for errors
-  if (rc != ZOLTAN_OK)
-  {
-    dolfin_error("GraphOrdering.cpp",
-                 "compute matrix re-ordering",
-                 "Zoltan partitioning failed");
-  }
-
-  // Copy re-ordering into a vector (in case Zoltan uses something other than std::size_t)
-  std::vector<std::size_t> map(new_id.begin(), new_id.end());
-
-  return map;
-}
-//-----------------------------------------------------------------------------
-int GraphOrdering::num_global_objects() const
-{
-  return _tensor_layout.size(0);
-}
-//-----------------------------------------------------------------------------
-int GraphOrdering::num_local_objects() const
-{
-  return _tensor_layout.size(0);
-}
-//-----------------------------------------------------------------------------
-void GraphOrdering::num_edges_per_vertex(std::vector<std::size_t>& num_edges) const
-{
-  dolfin_assert(_tensor_layout.sparsity_pattern());
-  _tensor_layout.sparsity_pattern()->num_nonzeros_diagonal(num_edges);
-}
-//-----------------------------------------------------------------------------
-const std::vector<std::vector<std::size_t>> GraphOrdering::edges() const
-{
-  dolfin_assert(_tensor_layout.sparsity_pattern());
-  return _tensor_layout.sparsity_pattern()->diagonal_pattern(GenericSparsityPattern::unsorted);
-}
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-int GraphOrdering::get_number_of_objects(void *data, int *ierr)
-{
-  GraphOrdering *objs = (GraphOrdering *)data;
-  *ierr = ZOLTAN_OK;
-  return objs->num_local_objects();
-}
-//-----------------------------------------------------------------------------
-void GraphOrdering::get_object_list(void *data, int sizeGID, int sizeLID,
-                                ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
-                                int wgt_dim, float *obj_wgts, int *ierr)
-{
-  GraphOrdering *objs = (GraphOrdering *)data;
-  *ierr = ZOLTAN_OK;
-  for (int i = 0; i< objs->num_local_objects(); i++)
-  {
-    globalID[i] = i;
-    localID[i] = i;
-  }
-}
-//-----------------------------------------------------------------------------
-void GraphOrdering::get_number_edges(void *data, int num_gid_entries,
-                                       int num_lid_entries,
-                                       int num_obj, ZOLTAN_ID_PTR global_ids,
-                                       ZOLTAN_ID_PTR local_ids, int *num_edges,
-                                       int *ierr)
-{
-  GraphOrdering *objs = (GraphOrdering *)data;
-
-  // Get number of edges for each graph vertex
-  std::vector<std::size_t> number_edges;
-  objs->num_edges_per_vertex(number_edges);
-
-  // Fill array num_edges array
-  for (std::size_t i = 0; i < number_edges.size(); ++i)
-    num_edges[i] = number_edges[i];
-}
-//-----------------------------------------------------------------------------
-void GraphOrdering::get_all_edges(void *data, int num_gid_entries,
-                                  int num_lid_entries, int num_obj,
-                                  ZOLTAN_ID_PTR global_ids,
-                                  ZOLTAN_ID_PTR local_ids,
-                                  int *num_edges,
-                                  ZOLTAN_ID_PTR nbor_global_id,
-                                  int *nbor_procs, int wgt_dim,
-                                  float *ewgts, int *ierr)
-{
-  GraphOrdering *objs = (GraphOrdering *)data;
-  const std::vector<std::vector<std::size_t>> edges = objs->edges();
-
-  std::size_t sum = 0;
-  for (std::size_t i = 0; i < edges.size(); ++i)
-  {
-    dolfin_assert(static_cast<int>(edges[i].size()) == num_edges[i]);
-    for (std::size_t j = 0; j < edges[i].size(); ++j)
-      nbor_global_id[sum*num_gid_entries + j] = edges[i][j];
-    sum += edges[i].size();
-  }
-}
-//-----------------------------------------------------------------------------
-
-#endif
diff --git a/dolfin/graph/GraphOrdering.h b/dolfin/graph/GraphOrdering.h
deleted file mode 100644
index 4d5cd0d..0000000
--- a/dolfin/graph/GraphOrdering.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (C) 2010 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2010-11-15
-// Last changed:
-
-#ifndef __DOLFIN_ZOLTAN_ORDERING_H
-#define __DOLFIN_ZOLTAN_ORDERING_H
-
-#ifdef HAS_TRILINOS
-
-#include <cstddef>
-#include <vector>
-#include <zoltan_cpp.h>
-#include "dolfin/common/Set.h"
-
-namespace dolfin
-{
-
-
-  class TensorLayout;
-
-  /// This class computes re-ordering based on a SparsityPattern graph
-  /// representation of a sparse matrix. It uses Zoltan, which is part of
-  /// Trilinos.
-
-  class GraphOrdering
-  {
-
-  public:
-
-    /// Constructor
-    GraphOrdering(const TensorLayout& tensor_layout);
-
-    /// Compute re-ordering for process (map[old] -> new)
-    std::vector<std::size_t> compute_local_reordering_map();
-
-  private:
-
-    /// Number of global graph vertices
-    int num_global_objects() const;
-
-    /// Number of local graph vertices
-    int num_local_objects() const;
-
-    /// Number of edges per vertex
-    void num_edges_per_vertex(std::vector<std::size_t>& num_edges) const;
-
-    /// Vertex edges
-    const std::vector<std::vector<std::size_t> > edges() const;
-
-    // Zoltan call-back functions
-
-    static int get_number_of_objects(void* data, int* ierr);
-
-    static void get_object_list(void* data, int sizeGID, int sizeLID,
-                                ZOLTAN_ID_PTR globalID,
-                                ZOLTAN_ID_PTR localID, int wgt_dim,
-                                float* obj_wgts, int* ierr);
-
-    static void get_number_edges(void* data, int num_gid_entries,
-                                 int num_lid_entries,
-                                 int num_obj, ZOLTAN_ID_PTR global_ids,
-                                 ZOLTAN_ID_PTR local_ids, int* num_edges,
-                                 int* ierr);
-
-    static void get_all_edges(void* data, int num_gid_entries,
-                              int num_lid_entries, int num_obj,
-                              ZOLTAN_ID_PTR global_ids,
-                              ZOLTAN_ID_PTR local_ids,
-                              int* num_edges,
-                              ZOLTAN_ID_PTR nbor_global_id,
-                              int* nbor_procs, int wgt_dim,
-                              float* ewgts, int* ierr);
-
-
-    // Tensor layout
-    const TensorLayout& _tensor_layout;
-
-  };
-
-}
-
-#endif
-#endif
diff --git a/dolfin/graph/ParMETIS.cpp b/dolfin/graph/ParMETIS.cpp
index 4a8ab1e..c7fec7e 100644
--- a/dolfin/graph/ParMETIS.cpp
+++ b/dolfin/graph/ParMETIS.cpp
@@ -21,13 +21,13 @@
 // First added:  2010-02-10
 // Last changed: 2014-01-09
 
-#include <dolfin/common/Timer.h>
 #include <dolfin/common/MPI.h>
+#include <dolfin/common/Timer.h>
 #include <dolfin/log/log.h>
+#include <dolfin/mesh/CellType.h>
 #include <dolfin/parameter/GlobalParameters.h>
-#include <dolfin/mesh/LocalMeshData.h>
-#include "ParMETIS.h"
 #include "GraphBuilder.h"
+#include "ParMETIS.h"
 
 #ifdef HAS_PARMETIS
 #include <parmetis.h>
@@ -36,69 +36,54 @@
 using namespace dolfin;
 
 #ifdef HAS_PARMETIS
-
-namespace dolfin
-{
-  // This class builds a ParMETIS dual graph
-
-  class ParMETISDualGraph
-  {
-  public:
-
-    // Constructor
-    ParMETISDualGraph(MPI_Comm mpi_comm, const LocalMeshData& mesh_data);
-
-    // Destructor
-    ~ParMETISDualGraph();
-
-    // ParMETIS data
-    std::vector<idx_t> elmdist;
-    std::vector<idx_t> eptr;
-    std::vector<idx_t> eind;
-    idx_t numflag;
-    idx_t* xadj;
-    idx_t* adjncy;
-
-    // Number of partitions (one for each process)
-    idx_t nparts;
-
-    // Strange weight arrays needed by ParMETIS
-    idx_t ncon;
-    std::vector<real_t> tpwgts;
-    std::vector<real_t> ubvec;
-
-    // Prepare remaining arguments for ParMETIS
-    idx_t* elmwgt;
-    idx_t wgtflag;
-    idx_t edgecut;
-
-  };
-}
 //-----------------------------------------------------------------------------
-void ParMETIS::compute_partition(
-  const MPI_Comm mpi_comm,
-  std::vector<std::size_t>& cell_partition,
-  std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs,
-  const LocalMeshData& mesh_data,
-  std::string mode)
+void ParMETIS::compute_partition(const MPI_Comm mpi_comm,
+                                 std::vector<int>& cell_partition,
+                                 std::map<std::int64_t, std::vector<int>>& ghost_procs,
+                                 const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                                 const std::size_t num_global_vertices,
+                                 const CellType& cell_type,
+                                 const std::string mode)
 {
   // Duplicate MPI communicator (ParMETIS does not take const
   // arguments, so duplicate communicator to be sure it isn't changed)
   MPI_Comm comm;
   MPI_Comm_dup(mpi_comm, &comm);
 
-  // Build dual graph
-  ParMETISDualGraph g(mpi_comm, mesh_data);
+  const std::int8_t tdim = cell_type.dim();
+  const std::int8_t num_vertices_per_cell = cell_type.num_vertices(tdim);
+
+  // Create data structures to hold graph
+  CSRGraph<idx_t> csr_graph;
+
+  // Use ParMETIS or DOLFIN dual graph
+  bool use_parmetis_dual_graph = false;
+
+  if (use_parmetis_dual_graph)
+  {
+    // Build dual graph using ParMETIS builder
+    csr_graph = dual_graph(mpi_comm, cell_vertices, num_vertices_per_cell);
+  }
+  else
+  {
+    // Compute dual graph with DOLFIN
+    std::vector<std::vector<std::size_t>> local_graph;
+    std::set<std::int64_t> ghost_vertices;
+    GraphBuilder::compute_dual_graph(mpi_comm, cell_vertices, cell_type,
+                                     num_global_vertices, local_graph,
+                                     ghost_vertices);
 
-  dolfin_assert(g.eptr.size() - 1 == mesh_data.cell_vertices.size());
+    csr_graph = CSRGraph<idx_t>(mpi_comm, local_graph);
+
+  }
 
   // Partition graph
   if (mode == "partition")
-    partition(comm, cell_partition, ghost_procs, g);
+    partition(comm, csr_graph, cell_partition, ghost_procs);
   else if (mode == "adaptive_repartition")
-    adaptive_repartition(comm, cell_partition, g);
+    adaptive_repartition(comm, csr_graph, cell_partition);
   else if (mode == "refine")
-    refine(comm, cell_partition, g);
+    refine(comm, csr_graph, cell_partition);
   else
   {
     dolfin_error("ParMETIS.cpp",
@@ -110,13 +95,12 @@ void ParMETIS::compute_partition(
   MPI_Comm_free(&comm);
 }
 //-----------------------------------------------------------------------------
-void ParMETIS::partition(
-  MPI_Comm mpi_comm,
-  std::vector<std::size_t>& cell_partition,
-  std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs,
-  ParMETISDualGraph& g)
+template <typename T>
+void ParMETIS::partition(MPI_Comm mpi_comm, CSRGraph<T>& csr_graph,
+                         std::vector<int>& cell_partition,
+                         std::map<std::int64_t, std::vector<int>>& ghost_procs)
 {
-  Timer timer1("PARALLEL 1b: Compute graph partition (calling ParMETIS)");
+  Timer timer("Compute graph partition (ParMETIS)");
 
   // Options for ParMETIS
   idx_t options[3];
@@ -124,64 +108,82 @@ void ParMETIS::partition(
   options[1] = 0;
   options[2] = 15;
 
-  // Check that data arrays are not empty
-  dolfin_assert(!g.tpwgts.empty());
-  dolfin_assert(!g.ubvec.empty());
+  // Number of partitions (one for each process)
+  idx_t nparts = MPI::size(mpi_comm);
+
+  // Strange weight arrays needed by ParMETIS
+  idx_t ncon = 1;
+
+  // Prepare remaining arguments for ParMETIS
+  idx_t* elmwgt = NULL;
+  idx_t wgtflag = 0;
+  idx_t edgecut = 0;
+  idx_t numflag = 0;
+  std::vector<real_t> tpwgts(ncon*nparts, 1.0/static_cast<real_t>(nparts));
+  std::vector<real_t> ubvec(ncon, 1.05);
 
   // Call ParMETIS to partition graph
-  const std::size_t num_local_cells = g.eptr.size() - 1;
+  Timer timer1("ParMETIS: call ParMETIS_V3_PartKway");
+  const std::int32_t num_local_cells = csr_graph.size();
   std::vector<idx_t> part(num_local_cells);
   dolfin_assert(!part.empty());
-  int err = ParMETIS_V3_PartKway(g.elmdist.data(), g.xadj, g.adjncy, g.elmwgt,
-                                 NULL, &g.wgtflag, &g.numflag, &g.ncon,
-                                 &g.nparts,
-                                 g.tpwgts.data(), g.ubvec.data(), options,
-                                 &g.edgecut, part.data(),
-                                 &mpi_comm);
+  int err
+    = ParMETIS_V3_PartKway(csr_graph.node_distribution().data(),
+                           csr_graph.nodes().data(),
+                           csr_graph.edges().data(), elmwgt,
+                           NULL, &wgtflag, &numflag, &ncon, &nparts,
+                           tpwgts.data(), ubvec.data(), options,
+                           &edgecut, part.data(), &mpi_comm);
   dolfin_assert(err == METIS_OK);
+  timer1.stop();
 
-  // Work out halo cells for current division of dual graph
-  const unsigned int num_processes = MPI::size(mpi_comm);
-  const unsigned int process_number = MPI::rank(mpi_comm);
-  const idx_t elm_begin = g.elmdist[process_number];
-  const idx_t elm_end = g.elmdist[process_number + 1];
-  const unsigned int ncells = elm_end - elm_begin;
+  Timer timer2("Compute graph halo data (ParMETIS)");
 
-  std::map<idx_t, std::set<unsigned int>> halo_cell_to_remotes;
+  // Work out halo cells for current division of dual graph
+  const auto& elmdist = csr_graph.node_distribution();
+  const auto& xadj = csr_graph.nodes();
+  const auto& adjncy = csr_graph.edges();
+  const std::int32_t num_processes = MPI::size(mpi_comm);
+  const std::int32_t process_number = MPI::rank(mpi_comm);
+  const idx_t elm_begin = elmdist[process_number];
+  const idx_t elm_end = elmdist[process_number + 1];
+  const std::int32_t ncells = elm_end - elm_begin;
+
+  std::map<idx_t, std::set<std::int32_t>> halo_cell_to_remotes;
   // local indexing "i"
-  for(unsigned int i = 0; i < ncells; i++)
+  for(int i = 0; i < ncells; i++)
   {
-    for(idx_t j = g.xadj[i]; j != g.xadj[i + 1]; ++j)
+    for(auto other_cell : csr_graph[i]) //idx_t j = xadj[i]; j != xadj[i + 1]; ++j)
     {
-      const idx_t other_cell = g.adjncy[j];
+      //      const idx_t other_cell = adjncy[j];
       if (other_cell < elm_begin || other_cell >= elm_end)
       {
-        const unsigned int remote = std::upper_bound(g.elmdist.begin(),
-                                       g.elmdist.end() ,
-                                       other_cell) - g.elmdist.begin() - 1;
+        const int remote
+          = std::upper_bound(elmdist.begin(), elmdist.end(), other_cell)
+          - elmdist.begin() - 1;
+
         dolfin_assert(remote < num_processes);
         if (halo_cell_to_remotes.find(i) == halo_cell_to_remotes.end())
-          halo_cell_to_remotes[i] = std::set<unsigned int>();
+          halo_cell_to_remotes[i] = std::set<std::int32_t>();
         halo_cell_to_remotes[i].insert(remote);
       }
     }
   }
 
   // Do halo exchange of cell partition data
-  std::vector<std::vector<std::size_t>> send_cell_partition(num_processes);
-  std::vector<std::vector<std::size_t>> recv_cell_partition(num_processes);
-  for(std::map<idx_t, std::set<unsigned int>>::iterator hcell
-        = halo_cell_to_remotes.begin(); hcell != halo_cell_to_remotes.end();
-      ++hcell)
+  std::vector<std::vector<std::int64_t>> send_cell_partition(num_processes);
+  std::vector<std::vector<std::int64_t>> recv_cell_partition(num_processes);
+  for(const auto& hcell : halo_cell_to_remotes)
   {
-    for(std::set<unsigned int>::iterator proc = hcell->second.begin();
-         proc != hcell->second.end(); ++proc)
+    for(auto proc : hcell.second)
     {
-      dolfin_assert(*proc < num_processes);
+      dolfin_assert(proc < num_processes);
+
       // global cell number
-      send_cell_partition[*proc].push_back(hcell->first + elm_begin);
+      send_cell_partition[proc].push_back(hcell.first + elm_begin);
+
       //partitioning
-      send_cell_partition[*proc].push_back(part[hcell->first]);
+      send_cell_partition[proc].push_back(part[hcell.first]);
     }
   }
 
@@ -190,31 +192,30 @@ void ParMETIS::partition(
 
   // Construct a map from all currently foreign cells to their new
   // partition number
-  std::map<std::size_t, unsigned int> cell_ownership;
-  for (unsigned int i = 0; i < num_processes; ++i)
+  std::map<std::int64_t, std::int32_t> cell_ownership;
+  for (std::int32_t i = 0; i < num_processes; ++i)
   {
-    std::vector<std::size_t>& recv_data = recv_cell_partition[i];
-    for (unsigned int j = 0; j != recv_data.size(); j += 2)
+    std::vector<std::int64_t>& recv_data = recv_cell_partition[i];
+    for (std::size_t j = 0; j < recv_data.size(); j += 2)
     {
-      const std::size_t global_cell = recv_data[j];
-      const unsigned int cell_owner = recv_data[j+1];
+      const std::int64_t global_cell = recv_data[j];
+      const std::int32_t cell_owner = recv_data[j+1];
       cell_ownership[global_cell] = cell_owner;
     }
   }
 
   // Generate mapping for where new boundary cells need to be sent
-  for(unsigned int i = 0; i < ncells; i++)
+  for(std::int32_t i = 0; i < ncells; i++)
   {
     const std::size_t proc_this = part[i];
-    for (idx_t j = g.xadj[i]; j != g.xadj[i + 1]; ++j)
+    for (idx_t j = xadj[i]; j < xadj[i + 1]; ++j)
     {
-      const idx_t other_cell = g.adjncy[j];
+      const idx_t other_cell = adjncy[j];
       std::size_t proc_other;
 
       if (other_cell < elm_begin || other_cell >= elm_end)
       { // remote cell - should be in map
-        const std::map<std::size_t, unsigned int>::const_iterator
-          find_other_proc = cell_ownership.find(other_cell);
+        const auto find_other_proc = cell_ownership.find(other_cell);
         dolfin_assert(find_other_proc != cell_ownership.end());
         proc_other = find_other_proc->second;
       }
@@ -226,26 +227,35 @@ void ParMETIS::partition(
         auto map_it = ghost_procs.find(i);
         if (map_it == ghost_procs.end())
         {
-          dolfin::Set<unsigned int> sharing_processes;
-          sharing_processes.insert(proc_this);
-          sharing_processes.insert(proc_other);
-          ghost_procs.insert(std::make_pair(i, sharing_processes));
+          std::vector<std::int32_t> sharing_processes;
+          sharing_processes.push_back(proc_this);
+          sharing_processes.push_back(proc_other);
+          ghost_procs.insert({i, sharing_processes});
         }
         else
-          map_it->second.insert(proc_other);
+        {
+          // Add to vector if not already there
+          auto it = std::find(map_it->second.begin(), map_it->second.end(), proc_other);
+          if (it == map_it->second.end())
+            map_it->second.push_back(proc_other);
+        }
+
       }
     }
   }
 
+  timer2.stop();
+
   // Copy cell partition data
-  cell_partition = std::vector<std::size_t>(part.begin(), part.end());
+  cell_partition.assign(part.begin(), part.end());
 }
 //-----------------------------------------------------------------------------
+template <typename T>
 void ParMETIS::adaptive_repartition(MPI_Comm mpi_comm,
-                                    std::vector<std::size_t>& cell_partition,
-                                    ParMETISDualGraph& g)
+                                    CSRGraph<T>& csr_graph,
+                                    std::vector<int>& cell_partition)
 {
-  Timer timer1("PARALLEL 1b: Compute graph partition (calling ParMETIS Adaptive Repartition)");
+  Timer timer("Compute graph partition (ParMETIS Adaptive Repartition)");
 
   // Options for ParMETIS
   idx_t options[4];
@@ -257,33 +267,47 @@ void ParMETIS::adaptive_repartition(MPI_Comm mpi_comm,
   // migration if already balanced.  Try PARMETIS_PSR_UNCOUPLED for
   // better edge cut.
 
-  // Check that data arrays are not empty
-  dolfin_assert(!g.tpwgts.empty());
-  dolfin_assert(!g.ubvec.empty());
-
-  // Call ParMETIS to partition graph
+  Timer timer1("ParMETIS: call ParMETIS_V3_AdaptiveRepart");
   const double itr = parameters["ParMETIS_repartitioning_weight"];
   real_t _itr = itr;
-  std::vector<idx_t> part(g.eptr.size() - 1);
+  std::vector<idx_t> part(csr_graph.size());
   std::vector<idx_t> vsize(part.size(), 1);
   dolfin_assert(!part.empty());
-  int err = ParMETIS_V3_AdaptiveRepart(g.elmdist.data(), g.xadj, g.adjncy,
-                                       g.elmwgt, NULL, vsize.data(), &g.wgtflag,
-                                       &g.numflag, &g.ncon, &g.nparts,
-                                       g.tpwgts.data(), g.ubvec.data(), &_itr,
-                                       options, &g.edgecut, part.data(),
+
+  // Number of partitions (one for each process)
+  idx_t nparts = MPI::size(mpi_comm);
+
+  // Remaining ParMETIS parameters
+  idx_t ncon = 1;
+  idx_t* elmwgt = NULL;
+  idx_t wgtflag = 0;
+  idx_t edgecut = 0;
+  idx_t numflag = 0;
+  std::vector<real_t> tpwgts(ncon*nparts, 1.0/static_cast<real_t>(nparts));
+  std::vector<real_t> ubvec(ncon, 1.05);
+
+  // Call ParMETIS to repartition graph
+  int err = ParMETIS_V3_AdaptiveRepart(csr_graph.node_distribution().data(),
+                                       csr_graph.nodes().data(),
+                                       csr_graph.edges().data(),
+                                       elmwgt, NULL, vsize.data(), &wgtflag,
+                                       &numflag, &ncon, &nparts,
+                                       tpwgts.data(), ubvec.data(), &_itr,
+                                       options, &edgecut, part.data(),
                                        &mpi_comm);
   dolfin_assert(err == METIS_OK);
+  timer1.stop();
 
   // Copy cell partition data
-  cell_partition = std::vector<std::size_t>(part.begin(), part.end());
+  cell_partition.assign(part.begin(), part.end());
 }
 //-----------------------------------------------------------------------------
+template<typename T>
 void ParMETIS::refine(MPI_Comm mpi_comm,
-                      std::vector<std::size_t>& cell_partition,
-                      ParMETISDualGraph& g)
+                      CSRGraph<T>& csr_graph,
+                      std::vector<int>& cell_partition)
 {
-  Timer timer1("PARALLEL 1b: Compute graph partition (calling ParMETIS Refine)");
+  Timer timer("Compute graph partition (ParMETIS Refine)");
 
   // Get some MPI data
   const std::size_t process_number = MPI::rank(mpi_comm);
@@ -299,37 +323,58 @@ void ParMETIS::refine(MPI_Comm mpi_comm,
   // migration if already balanced.  Try PARMETIS_PSR_UNCOUPLED for
   // better edge cut.
 
-  // Check that data arrays are not empty
-  dolfin_assert(!g.tpwgts.empty());
-  dolfin_assert(!g.ubvec.empty());
-
   // Partitioning array to be computed by ParMETIS. Prefill with
   // process_number.
-  const std::size_t num_local_cells = g.eptr.size() - 1;
+  const std::size_t num_local_cells = csr_graph.size();
   std::vector<idx_t> part(num_local_cells, process_number);
   dolfin_assert(!part.empty());
 
+  // Number of partitions (one for each process)
+  idx_t nparts = MPI::size(mpi_comm);
+  // Remaining ParMETIS parameters
+  idx_t ncon = 1;
+  idx_t* elmwgt = NULL;
+  idx_t wgtflag = 0;
+  idx_t edgecut = 0;
+  idx_t numflag = 0;
+  std::vector<real_t> tpwgts(ncon*nparts, 1.0/static_cast<real_t>(nparts));
+  std::vector<real_t> ubvec(ncon, 1.05);
+
   // Call ParMETIS to partition graph
-  int err = ParMETIS_V3_RefineKway(g.elmdist.data(), g.xadj, g.adjncy, g.elmwgt,
-                                   NULL, &g.wgtflag, &g.numflag, &g.ncon,
-                                   &g.nparts,
-                                   g.tpwgts.data(), g.ubvec.data(), options,
-                                   &g.edgecut, part.data(), &mpi_comm);
+  Timer timer1("ParMETIS: call ParMETIS_V3_RefineKway");
+  int err =  ParMETIS_V3_RefineKway(csr_graph.node_distribution().data(),
+                                    csr_graph.nodes().data(),
+                                    csr_graph.edges().data(),
+                                    elmwgt, NULL, &wgtflag, &numflag, &ncon,
+                                    &nparts,
+                                    tpwgts.data(), ubvec.data(), options,
+                                    &edgecut, part.data(), &mpi_comm);
   dolfin_assert(err == METIS_OK);
+  timer1.stop();
 
   // Copy cell partition data
-  cell_partition = std::vector<std::size_t>(part.begin(), part.end());
+  cell_partition.assign(part.begin(), part.end());
 }
 //-----------------------------------------------------------------------------
-ParMETISDualGraph::ParMETISDualGraph(MPI_Comm mpi_comm,
-                                     const LocalMeshData& mesh_data)
+CSRGraph<idx_t>
+ParMETIS::dual_graph(MPI_Comm mpi_comm,
+                     const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                     const int num_vertices_per_cell)
 {
+  Timer timer("Build mesh dual graph (ParMETIS)");
+
+  // ParMETIS data
+  std::vector<idx_t> elmdist;
+  std::vector<idx_t> eptr;
+  std::vector<idx_t> eind;
+
+
   // Get number of processes and process number
   const std::size_t num_processes = MPI::size(mpi_comm);
 
   // Get dimensions of local mesh_data
-  const std::size_t num_local_cells = mesh_data.cell_vertices.size();
-  const std::size_t num_cell_vertices = mesh_data.num_vertices_per_cell;
+  const std::size_t num_local_cells = cell_vertices.size();
+  const std::size_t num_cell_vertices = num_vertices_per_cell;
 
   // Check that number of local graph nodes (cells) is > 0
   if (num_local_cells == 0)
@@ -352,10 +397,10 @@ ParMETISDualGraph::ParMETISDualGraph(MPI_Comm mpi_comm,
   eind.assign(num_local_cells*num_cell_vertices, 0);
   for (std::size_t i = 0; i < num_local_cells; i++)
   {
-    dolfin_assert(mesh_data.cell_vertices[i].size() == num_cell_vertices);
+    dolfin_assert(cell_vertices[i].size() == num_cell_vertices);
     eptr[i] = i*num_cell_vertices;
     for (std::size_t j = 0; j < num_cell_vertices; j++)
-      eind[eptr[i] + j] = mesh_data.cell_vertices[i][j];
+      eind[eptr[i] + j] = cell_vertices[i][j];
   }
   eptr[num_local_cells] = num_local_cells*num_cell_vertices;
 
@@ -364,49 +409,36 @@ ParMETISDualGraph::ParMETISDualGraph(MPI_Comm mpi_comm,
 
   // Number of nodes shared for dual graph (partition along facets)
   idx_t ncommonnodes = num_cell_vertices - 1;
-  numflag = 0;
-  xadj = 0;
-  adjncy = 0;
 
   dolfin_assert(!eptr.empty());
   dolfin_assert(!eind.empty());
 
   // Could use GraphBuilder::compute_dual_graph() instead
+  Timer timer1("ParMETIS: call ParMETIS_V3_Mesh2Dual");
+  idx_t* xadj = NULL;
+  idx_t* adjncy = NULL;
+  idx_t numflag = 0;
   int err = ParMETIS_V3_Mesh2Dual(elmdist.data(), eptr.data(), eind.data(),
-                                  &numflag, &ncommonnodes,
-                                  &xadj, &adjncy,
+                                  &numflag, &ncommonnodes, &xadj, &adjncy,
                                   &mpi_comm);
   dolfin_assert(err == METIS_OK);
+  timer1.stop();
 
-
-  // Number of partitions (one for each process)
-  nparts = num_processes;
-
-  // Strange weight arrays needed by ParMETIS
-  ncon = 1;
-  tpwgts.assign(ncon*nparts, 1.0/static_cast<real_t>(nparts));
-  ubvec.assign(ncon, 1.05);
-
-  // Prepare remaining arguments for ParMETIS
-  elmwgt = NULL;
-  wgtflag = 0;
-  edgecut = 0;
-}
-//-----------------------------------------------------------------------------
-ParMETISDualGraph::~ParMETISDualGraph()
-{
-  // Free metis data structures
+  CSRGraph<idx_t> csr_graph(mpi_comm, xadj, adjncy, num_local_cells);
   METIS_Free(xadj);
   METIS_Free(adjncy);
+
+  return csr_graph;
 }
 //-----------------------------------------------------------------------------
 #else
-void ParMETIS::compute_partition(
-  const MPI_Comm mpi_comm,
-  std::vector<std::size_t>& cell_partition,
-  std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs,
-  const LocalMeshData& data,
-  std::string mode)
+void ParMETIS::compute_partition(const MPI_Comm mpi_comm,
+                                 std::vector<int>& cell_partition,
+                                 std::map<std::int64_t, std::vector<int>>& ghost_procs,
+                                 const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                                 const std::size_t num_global_vertices,
+                                 const CellType& cell_type,
+                                 const std::string mode)
 {
   dolfin_error("ParMETIS.cpp",
                "compute mesh partitioning using ParMETIS",
diff --git a/dolfin/graph/ParMETIS.h b/dolfin/graph/ParMETIS.h
index 152b994..9dd7f8b 100644
--- a/dolfin/graph/ParMETIS.h
+++ b/dolfin/graph/ParMETIS.h
@@ -23,18 +23,20 @@
 #ifndef __PARMETIS_PARTITIONER_H
 #define __PARMETIS_PARTITIONER_H
 
+#include <cstdint>
 #include <cstddef>
 #include <vector>
 #include <dolfin/common/MPI.h>
 #include <dolfin/common/Set.h>
 
+#ifdef HAS_PARMETIS
+#include <parmetis.h>
+#endif
+#include "CSRGraph.h"
+
 namespace dolfin
 {
-
-  // Forward declarations
-  class LocalMeshData;
-
-  class ParMETISDualGraph;
+  class CellType;
 
   /// This class provides an interface to ParMETIS
 
@@ -42,42 +44,53 @@ namespace dolfin
   {
   public:
 
-    /// Compute cell partition from local mesh data.
-    /// The output vector cell_partition contains the desired 
-    /// destination process numbers for each cell. 
-    /// Cells shared on multiple processes have an
-    /// entry in ghost_procs pointing to
-    /// the set of sharing process numbers.
-    /// The mode argument determines which ParMETIS function 
-    /// is called. It can be one of "partition", 
-    /// "adaptive_repartition" or "refine". For meshes
-    /// that have already been partitioned or are already well
-    /// partitioned, it can be advantageous to use
-    /// "adaptive_repartition" or "refine".
+    /// Compute cell partition from local mesh data.  The output
+    /// vector cell_partition contains the desired destination process
+    /// numbers for each cell.  Cells shared on multiple processes
+    /// have an entry in ghost_procs pointing to the set of sharing
+    /// process numbers.  The mode argument determines which ParMETIS
+    /// function is called. It can be one of "partition",
+    /// "adaptive_repartition" or "refine". For meshes that have
+    /// already been partitioned or are already well partitioned, it
+    /// can be advantageous to use "adaptive_repartition" or "refine".
     static void compute_partition(const MPI_Comm mpi_comm,
-            std::vector<std::size_t>& cell_partition,
-            std::map<std::size_t, dolfin::Set<unsigned int> >& ghost_procs,
-            const LocalMeshData& mesh_data,
-            std::string mode="partition");
+            std::vector<int>& cell_partition,
+            std::map<std::int64_t, std::vector<int>>& ghost_procs,
+            const boost::multi_array<std::int64_t, 2>& cell_vertices,
+            const std::size_t num_global_vertices,
+            const CellType& cell_type,
+            const std::string mode="partition");
 
   private:
 
 #ifdef HAS_PARMETIS
-    // Standard ParMETIS partition
+    // Create a dual graph from the cell-vertex topology using
+    // ParMETIS built in ParMETIS_V3_Mesh2Dual
+    static CSRGraph<idx_t>
+      dual_graph(MPI_Comm mpi_comm,
+                 const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                 const int num_vertices_per_cell);
+
+    // Standard ParMETIS partition. CSRGraph should be const, but
+    // ParMETIS accesses it non-const, so has to be non-const here
+    template <typename T>
     static void partition(MPI_Comm mpi_comm,
-       std::vector<std::size_t>& cell_partition,
-       std::map<std::size_t, dolfin::Set<unsigned int> >& ghost_procs,
-       ParMETISDualGraph& g);
-
-    // ParMETIS adaptive repartition
-    static void adaptive_repartition(MPI_Comm mpi_comm,
-                                     std::vector<std::size_t>& cell_partition,
-                                     ParMETISDualGraph& g);
-
-    // ParMETIS refine repartition
-    static void refine(MPI_Comm mpi_comm,
-                       std::vector<std::size_t>& cell_partition,
-                       ParMETISDualGraph& g);
+                          CSRGraph<T>& csr_graph,
+                          std::vector<int>& cell_partition,
+                          std::map<std::int64_t, std::vector<int>>& ghost_procs);
+
+    // ParMETIS adaptive repartition. CSRGraph should be const, but
+    // ParMETIS accesses it non-const, so has to be non-const here
+    template <typename T>
+      static void adaptive_repartition(MPI_Comm mpi_comm,
+                                       CSRGraph<T>& csr_graph,
+                                       std::vector<int>& cell_partition);
+
+    // ParMETIS refine repartition. CSRGraph should be const, but
+    // ParMETIS accesses it non-const, so has to be non-const here
+    template <typename T>
+      static void refine(MPI_Comm mpi_comm, CSRGraph<T>& csr_graph,
+                         std::vector<int>& cell_partition);
 #endif
 
 
diff --git a/dolfin/graph/SCOTCH.cpp b/dolfin/graph/SCOTCH.cpp
index a035b60..00a5564 100644
--- a/dolfin/graph/SCOTCH.cpp
+++ b/dolfin/graph/SCOTCH.cpp
@@ -31,11 +31,10 @@
 #include <dolfin/common/Timer.h>
 #include <dolfin/common/MPI.h>
 #include <dolfin/mesh/LocalMeshData.h>
+#include "CSRGraph.h"
 #include "GraphBuilder.h"
 #include "SCOTCH.h"
 
-#include <dolfin/common/dolfin_common.h>
-
 #ifdef HAS_SCOTCH
 extern "C"
 {
@@ -49,29 +48,36 @@ using namespace dolfin;
 #ifdef HAS_SCOTCH
 
 //-----------------------------------------------------------------------------
-void SCOTCH::compute_partition(
-  const MPI_Comm mpi_comm,
-  std::vector<std::size_t>& cell_partition,
-  std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs,
-  const LocalMeshData& mesh_data)
+void SCOTCH::compute_partition(const MPI_Comm mpi_comm,
+                               std::vector<int>& cell_partition,
+                               std::map<std::int64_t, std::vector<int>>& ghost_procs,
+                               const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                               const std::vector<std::size_t>& cell_weight,
+                               const std::int64_t num_global_vertices,
+                               const std::int64_t num_global_cells,
+                               const CellType& cell_type)
 {
   // Create data structures to hold graph
-  std::vector<std::set<std::size_t>> local_graph;
-  std::set<std::size_t> ghost_vertices;
+  CSRGraph<SCOTCH_Num> csr_graph;
+  std::set<std::int64_t> ghost_vertices;
 
-  // Compute local dual graph
-  GraphBuilder::compute_dual_graph(mpi_comm, mesh_data, local_graph,
-                                   ghost_vertices);
+  // Build dual graph. Use scoping to clean up memory
+  {
+    // Compute dual graph (for this parition)
+    std::vector<std::vector<std::size_t>> local_graph;
+    GraphBuilder::compute_dual_graph(mpi_comm, cell_vertices, cell_type,
+                                     num_global_vertices, local_graph,
+                                     ghost_vertices);
 
-  // Compute partitions
-  partition(mpi_comm, local_graph, mesh_data.cell_weight,
-            ghost_vertices, mesh_data.global_cell_indices,
-            mesh_data.num_global_cells, cell_partition, ghost_procs);
+    csr_graph = CSRGraph<SCOTCH_Num>(MPI_COMM_SELF, local_graph);
+  }
 
+  // Compute partitions
+  partition(mpi_comm, csr_graph, cell_weight, ghost_vertices,
+            num_global_cells, cell_partition, ghost_procs);
 }
 //-----------------------------------------------------------------------------
-std::vector<int> SCOTCH::compute_gps(const Graph& graph,
-                                     std::size_t num_passes)
+std::vector<int> SCOTCH::compute_gps(const Graph& graph, std::size_t num_passes)
 {
   // Create strategy string for Gibbs-Poole-Stockmeyer ordering
   std::string strategy = "g{pass= " + std::to_string(num_passes) + "}";
@@ -92,7 +98,7 @@ void SCOTCH::compute_reordering(const Graph& graph,
                                 std::vector<int>& inverse_permutation,
                                 std::string scotch_strategy)
 {
-  Timer timer("SCOTCH graph ordering");
+  Timer timer("Compute SCOTCH graph re-ordering");
 
   // Number of local graph vertices (cells)
   const SCOTCH_Num vertnbr = graph.size();
@@ -117,6 +123,10 @@ void SCOTCH::compute_reordering(const Graph& graph,
     edgetab.insert(edgetab.end(), vertex->begin(), vertex->end());
   }
 
+  // Shrink vectors to hopefully recover an unused memory
+  verttab.shrink_to_fit();
+  edgetab.shrink_to_fit();
+
   // Create SCOTCH graph
   SCOTCH_Graph scotch_graph;
 
@@ -132,6 +142,7 @@ void SCOTCH::compute_reordering(const Graph& graph,
   }
 
   // Build SCOTCH graph
+  Timer timer1("SCOTCH: call SCOTCH_graphBuild");
   if (SCOTCH_graphBuild(&scotch_graph, baseval,
                         vertnbr, &verttab[0], &verttab[1], NULL, NULL,
                         edgenbr, &edgetab[0], NULL))
@@ -140,6 +151,7 @@ void SCOTCH::compute_reordering(const Graph& graph,
                  "partition mesh using SCOTCH",
                  "Error building SCOTCH graph");
   }
+  timer1.stop();
 
   // Check graph data for consistency
   /*
@@ -158,8 +170,6 @@ void SCOTCH::compute_reordering(const Graph& graph,
   SCOTCH_stratInit(&strat);
 
   // Set SCOTCH strategy (if provided)
-  //SCOTCH_stratGraphOrderBuild(&strat, SCOTCH_STRATQUALITY, 0, 0);
-  //SCOTCH_stratGraphOrderBuild(&strat, SCOTCH_STRATSPEED, 0, 0);
   if (!scotch_strategy.empty())
     SCOTCH_stratGraphOrder(&strat, scotch_strategy.c_str());
 
@@ -172,6 +182,7 @@ void SCOTCH::compute_reordering(const Graph& graph,
   SCOTCH_randomReset();
 
   // Compute re-ordering
+  Timer timer2("SCOTCH: call SCOTCH_graphOrder");
   if (SCOTCH_graphOrder(&scotch_graph, &strat, permutation_indices.data(),
                         inverse_permutation_indices.data(), NULL, NULL, NULL))
   {
@@ -179,6 +190,7 @@ void SCOTCH::compute_reordering(const Graph& graph,
                  "re-order graph using SCOTCH",
                  "Error during re-ordering");
   }
+  timer2.stop();
 
   // Clean up SCOTCH objects
   SCOTCH_graphExit(&scotch_graph);
@@ -193,17 +205,18 @@ void SCOTCH::compute_reordering(const Graph& graph,
             inverse_permutation_indices.end(), inverse_permutation.begin());
 }
 //-----------------------------------------------------------------------------
+template<typename T>
 void SCOTCH::partition(
   const MPI_Comm mpi_comm,
-  const std::vector<std::set<std::size_t>>& local_graph,
+  CSRGraph<T>& local_graph,
   const std::vector<std::size_t>& node_weights,
-  const std::set<std::size_t>& ghost_vertices,
-  const std::vector<std::size_t>& global_cell_indices,
+  const std::set<std::int64_t>& ghost_vertices,
   const std::size_t num_global_vertices,
-  std::vector<std::size_t>& cell_partition,
-  std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs)
+  std::vector<int>& cell_partition,
+  std::map<std::int64_t, std::vector<int>>& ghost_procs)
 {
-  Timer timer("Partition graph (calling SCOTCH)");
+  log(PROGRESS, "Compute graph partition using PT-SCOTCH");
+  Timer timer("Compute graph partition (SCOTCH)");
 
   // C-style array indexing
   const SCOTCH_Num baseval = 0;
@@ -220,28 +233,9 @@ void SCOTCH::partition(
   const SCOTCH_Num vertlocnbr = local_graph.size();
   const std::size_t vertgstnbr = vertlocnbr + ghost_vertices.size();
 
-  // Data structures for graph input to SCOTCH (add 1 for case that
-  // local graph size is zero)
-  std::vector<SCOTCH_Num> vertloctab;
-  vertloctab.reserve(local_graph.size() + 1);
-  std::vector<SCOTCH_Num> edgeloctab;
-
-  // Build local graph input for SCOTCH
-  // (number of local + ghost graph vertices (cells),
-  // number of local edges + edges connecting to ghost vertices)
-  SCOTCH_Num edgelocnbr = 0;
-  vertloctab.push_back((SCOTCH_Num) 0);
-  std::vector<std::set<std::size_t>>::const_iterator vertex;
-  for(vertex = local_graph.begin(); vertex != local_graph.end(); ++vertex)
-  {
-    edgelocnbr += vertex->size();
-    vertloctab.push_back(vertloctab.back() + vertex->size());
-    edgeloctab.insert(edgeloctab.end(), vertex->begin(), vertex->end());
-  }
-
-  // Handle case that local graph size is zero
-  if (edgeloctab.empty())
-    edgeloctab.resize(1);
+  // Get graph data
+  std::vector<SCOTCH_Num>& edgeloctab = local_graph.edges();
+  std::vector<SCOTCH_Num>& vertloctab = local_graph.nodes();
 
   // Global data ---------------------------------
 
@@ -276,27 +270,24 @@ void SCOTCH::partition(
                  "Error initializing SCOTCH graph");
   }
 
-  SCOTCH_Num* veloloctab;
+
+  // Handle cell weights (if any)
   std::vector<SCOTCH_Num> vload;
-  if (node_weights.size() == 0)
-    veloloctab = NULL;
-  else
-  {
-    vload.resize(node_weights.size());
-    std::copy(node_weights.begin(), node_weights.end(), vload.begin());
-    veloloctab = vload.data();
-  }
+  if (!node_weights.empty())
+    vload.assign(node_weights.begin(), node_weights.end());
 
   // Build SCOTCH distributed graph
+  Timer timer1("SCOTCH: call SCOTCH_dgraphBuild");
   if (SCOTCH_dgraphBuild(&dgrafdat, baseval, vertlocnbr, vertlocnbr,
-                              &vertloctab[0], NULL, veloloctab, NULL,
-                              edgelocnbr, edgelocnbr,
-                              &edgeloctab[0], NULL, NULL) )
+                         vertloctab.data(), NULL, vload.data(), NULL,
+                         edgeloctab.size(), edgeloctab.size(),
+                         edgeloctab.data(), NULL, NULL) )
   {
     dolfin_error("SCOTCH.cpp",
                  "partition mesh using SCOTCH",
                  "Error building SCOTCH graph");
   }
+  timer1.stop();
 
   // Check graph data for consistency
   #ifdef DEBUG
@@ -311,14 +302,15 @@ void SCOTCH::partition(
   // Number of partitions (set equal to number of processes)
   const SCOTCH_Num npart = num_processes;
 
-  // Partitioning strategy
+  // Initialise partitioning strategy
   SCOTCH_Strat strat;
   SCOTCH_stratInit(&strat);
 
-  // Set strategy (SCOTCH uses very cryptic strings for this, and they
-  // can change between versions)
-  //std::string strategy = "b{sep=m{asc=b{bnd=q{strat=f},org=q{strat=f}},low=q{strat=m{type=h,vert=80,low=h{pass=10}f{bal=0.0005,move=80},asc=b{bnd=d{dif=1,rem=1,pass=40}f{bal=0.005,move=80},org=f{bal=0.005,move=80}}}|m{type=h,vert=80,low=h{pass=10}f{bal=0.0005,move=80},asc=b{bnd=d{dif=1,rem=1,pass=40}f{bal=0.005,move=80},org=f{bal=0.005,move=80}}}},seq=q{strat=m{type=h,vert=80,low=h{pass=10}f{bal=0.0005,move=80},asc=b{bnd=d{dif=1,rem=1,pass=40}f{bal=0.005,move=80},org=f{bal=0.005,move=8 [...]
-  //SCOTCH_stratDgraphMap (&strat, strategy.c_str());
+  // Set SCOTCH strategy
+  //SCOTCH_stratDgraphMapBuild(&strat, SCOTCH_STRATDEFAULT, npart, npart, 0.05);
+  SCOTCH_stratDgraphMapBuild(&strat, SCOTCH_STRATSPEED, npart, npart, 0.05);
+  //SCOTCH_stratDgraphMapBuild(&strat, SCOTCH_STRATQUALITY, npart, npart, 0.05);
+  //SCOTCH_stratDgraphMapBuild(&strat, SCOTCH_STRATSCALABILITY, npart, npart, 0.15);
 
   // Resize vector to hold cell partition indices with enough extra
   // space for ghost cell partition information too When there are no
@@ -332,12 +324,25 @@ void SCOTCH::partition(
   SCOTCH_randomReset();
 
   // Partition graph
+  Timer timer2("SCOTCH: call SCOTCH_dgraphPart");
   if (SCOTCH_dgraphPart(&dgrafdat, npart, &strat, _cell_partition.data()))
   {
     dolfin_error("SCOTCH.cpp",
                  "partition mesh using SCOTCH",
                  "Error during partitioning");
   }
+  timer2.stop();
+
+  /*
+  // Write SCOTCH strategy to file
+  if (dolfin::MPI::rank(MPI_COMM_WORLD) == 0)
+  {
+    FILE* fp;
+    fp = fopen("test.txt", "w");
+    SCOTCH_stratSave(&strat, fp);
+    fclose(fp);
+  }
+  */
 
   // Exchange halo with cell_partition data for ghosts
   // FIXME: check MPI type compatibility with SCOTCH_Num. Getting this
@@ -346,7 +351,7 @@ void SCOTCH::partition(
   MPI_Datatype MPI_SCOTCH_Num;
   if (sizeof(SCOTCH_Num) == 4)
     MPI_SCOTCH_Num = MPI_INT;
-  else if (sizeof(SCOTCH_Num)==8)
+  else if (sizeof(SCOTCH_Num) == 8)
     MPI_SCOTCH_Num = MPI_LONG_LONG_INT;
 
   // Double check size is correct
@@ -354,6 +359,7 @@ void SCOTCH::partition(
   MPI_Type_size(MPI_SCOTCH_Num, &tsize);
   dolfin_assert(tsize == sizeof(SCOTCH_Num));
 
+  Timer timer3("SCOTCH: call SCOTCH_dgraphHalo");
   if (SCOTCH_dgraphHalo(&dgrafdat, (void *)_cell_partition.data(),
                         MPI_SCOTCH_Num))
   {
@@ -361,16 +367,20 @@ void SCOTCH::partition(
                  "partition mesh using SCOTCH",
                  "Error during halo exchange");
   }
+  timer3.stop();
 
   // Get SCOTCH's locally indexed graph
+  Timer timer4("Get SCOTCH graph data");
   SCOTCH_Num* edge_ghost_tab;
   SCOTCH_dgraphData(&dgrafdat,
                     NULL, NULL, NULL, NULL, NULL, NULL,
                     NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                     &edge_ghost_tab, NULL, (MPI_Comm *)&mpi_comm);
+  timer4.stop();
 
   // Iterate through SCOTCH's local compact graph to find partition
   // boundaries and save to map
+  Timer timer5("Extract partition boundaries from SCOTCH graph");
   for(SCOTCH_Num i = 0; i < vertlocnbr; ++i)
   {
     const std::size_t proc_this =  _cell_partition[i];
@@ -382,18 +392,25 @@ void SCOTCH::partition(
         auto map_it = ghost_procs.find(i);
         if (map_it == ghost_procs.end())
         {
-          dolfin::Set<unsigned int> sharing_processes;
-          // Owning process goes first into dolfin::Set
-          // (unordered set) so will always be first.
-          sharing_processes.insert(proc_this);
-          sharing_processes.insert(proc_other);
+          std::vector<int> sharing_processes;
+
+          // Owning process always goes in first to vector
+          sharing_processes.push_back(proc_this);
+          sharing_processes.push_back(proc_other);
           ghost_procs.insert(std::make_pair(i, sharing_processes));
         }
         else
-          map_it->second.insert(proc_other);
+        {
+          // Add to vector if not already there
+          auto it = std::find(map_it->second.begin(), map_it->second.end(),
+                              proc_other);
+          if (it == map_it->second.end())
+            map_it->second.push_back(proc_other);
+        }
       }
     }
   }
+  timer5.stop();
 
   // Clean up SCOTCH objects
   SCOTCH_dgraphExit(&dgrafdat);
@@ -408,19 +425,21 @@ void SCOTCH::partition(
 //-----------------------------------------------------------------------------
 #else
 //-----------------------------------------------------------------------------
-void SCOTCH::compute_partition(
-  const MPI_Comm mpi_comm,
-  std::vector<std::size_t>& cell_partition,
-  std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs,
-  const LocalMeshData& mesh_data)
+void SCOTCH::compute_partition(const MPI_Comm mpi_comm,
+                               std::vector<int>& cell_partition,
+                               std::map<std::int64_t, std::vector<int>>& ghost_procs,
+                               const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                               const std::vector<std::size_t>& cell_weight,
+                               const std::int64_t num_global_vertices,
+                               const std::int64_t num_global_cells,
+                               const CellType& cell_type)
 {
   dolfin_error("SCOTCH.cpp",
                "partition mesh using SCOTCH",
                "DOLFIN has been configured without support for SCOTCH");
 }
 //-----------------------------------------------------------------------------
-std::vector<int> SCOTCH::compute_gps(const Graph& graph,
-                                     std::size_t num_passes)
+std::vector<int> SCOTCH::compute_gps(const Graph& graph, std::size_t num_passes)
 {
   dolfin_error("SCOTCH.cpp",
                "re-order graph using SCOTCH",
@@ -429,8 +448,7 @@ std::vector<int> SCOTCH::compute_gps(const Graph& graph,
 }
 //-----------------------------------------------------------------------------
 std::vector<int>
-SCOTCH::compute_reordering(const Graph& graph,
-                           std::string scotch_strategy)
+SCOTCH::compute_reordering(const Graph& graph, std::string scotch_strategy)
 {
   dolfin_error("SCOTCH.cpp",
                "re-order graph using SCOTCH",
@@ -449,14 +467,14 @@ void SCOTCH::compute_reordering(const Graph& graph,
                "DOLFIN has been configured without support for SCOTCH");
 }
 //-----------------------------------------------------------------------------
+template<typename T>
 void SCOTCH::partition(const MPI_Comm mpi_comm,
-                       const std::vector<std::set<std::size_t>>& local_graph,
+                       CSRGraph<T>& local_graph,
                        const std::vector<std::size_t>& node_weights,
-                       const std::set<std::size_t>& ghost_vertices,
-                       const std::vector<std::size_t>& global_cell_indices,
+                       const std::set<std::int64_t>& ghost_vertices,
                        const std::size_t num_global_vertices,
-                       std::vector<std::size_t>& cell_partition,
-                       std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs)
+                       std::vector<int>& cell_partition,
+                       std::map<std::int64_t, std::vector<int>>& ghost_procs)
 {
   dolfin_error("SCOTCH.cpp",
                "partition mesh using SCOTCH",
diff --git a/dolfin/graph/SCOTCH.h b/dolfin/graph/SCOTCH.h
index 075d971..b0cdbaf 100644
--- a/dolfin/graph/SCOTCH.h
+++ b/dolfin/graph/SCOTCH.h
@@ -22,6 +22,7 @@
 #define __SCOTCH_PARTITIONER_H
 
 #include <cstddef>
+#include <cstdint>
 #include <map>
 #include <set>
 #include <string>
@@ -31,9 +32,12 @@
 #include <dolfin/common/Set.h>
 #include "Graph.h"
 
+#include "CSRGraph.h"
+
 namespace dolfin
 {
   // Forward declarations
+  class CellType;
   class LocalMeshData;
 
   /// This class provides an interface to SCOTCH-PT (parallel version)
@@ -49,12 +53,16 @@ namespace dolfin
     /// process numbers.
     static void compute_partition(
       const MPI_Comm mpi_comm,
-      std::vector<std::size_t>& cell_partition,
-      std::map<std::size_t, dolfin::Set<unsigned int> >& ghost_procs,
-      const LocalMeshData& mesh_data);
+      std::vector<int>& cell_partition,
+      std::map<std::int64_t, std::vector<int>>& ghost_procs,
+      const boost::multi_array<std::int64_t, 2>& cell_vertices,
+      const std::vector<std::size_t>& cell_weight,
+      const std::int64_t num_global_vertices,
+      const std::int64_t num_global_cells,
+      const CellType& cell_type);
 
     /// Compute reordering (map[old] -> new) using
-    /// Gibbs-Poole-Stockmeyer re-ordering
+    /// Gibbs-Poole-Stockmeyer (GPS) re-ordering
     static std::vector<int> compute_gps(const Graph& graph,
                                         std::size_t num_passes=5);
 
@@ -72,16 +80,18 @@ namespace dolfin
 
   private:
 
-    // Compute cell partitions from distributed dual graph
+    // Compute cell partitions from distributed dual graph. Note that
+    // local_graph is not const since we share the data with SCOTCH,
+    // and the SCOTCH interface is not const-correct.
+    template<typename T>
     static void partition(
       const MPI_Comm mpi_comm,
-      const std::vector<std::set<std::size_t> >& local_graph,
+      CSRGraph<T>& local_graph,
       const std::vector<std::size_t>& node_weights,
-      const std::set<std::size_t>& ghost_vertices,
-      const std::vector<std::size_t>& global_cell_indices,
+      const std::set<std::int64_t>& ghost_vertices,
       const std::size_t num_global_vertices,
-      std::vector<std::size_t>& cell_partition,
-      std::map<std::size_t, dolfin::Set<unsigned int> >& ghost_procs);
+      std::vector<int>& cell_partition,
+      std::map<std::int64_t, std::vector<int>>& ghost_procs);
 
   };
 
diff --git a/dolfin/graph/ZoltanPartition.cpp b/dolfin/graph/ZoltanPartition.cpp
deleted file mode 100644
index 03f6536..0000000
--- a/dolfin/graph/ZoltanPartition.cpp
+++ /dev/null
@@ -1,466 +0,0 @@
-// Copyright (C) 2013 Chris Richardson
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2013-02-13
-// Last changed: 2013-02-26
-
-#include<set>
-#include<string>
-#include<vector>
-
-#include <dolfin/common/MPI.h>
-#include <dolfin/common/Timer.h>
-#include <dolfin/mesh/LocalMeshData.h>
-#include <dolfin/parameter/GlobalParameters.h>
-#include "GraphBuilder.h"
-#include "ZoltanPartition.h"
-
-using namespace dolfin;
-
-#ifdef HAS_TRILINOS
-
-//-----------------------------------------------------------------------------
-void
-ZoltanPartition::compute_partition_phg(const MPI_Comm mpi_comm,
-                                       std::vector<std::size_t>& cell_partition,
-                                       const LocalMeshData& mesh_data)
-{
-  Timer timer0("Partition graph (calling Zoltan PHG)");
-
-  // Create data structures to hold graph
-  std::vector<std::set<std::size_t>> local_graph;
-  std::set<std::size_t> ghost_vertices;
-
-  // Compute local dual graph
-  GraphBuilder::compute_dual_graph(mpi_comm, mesh_data, local_graph,
-                                   ghost_vertices);
-
-  // Initialise Zoltan
-  float version;
-  int argc = 0;
-  char** argv = NULL;
-  Zoltan_Initialize(argc, argv, &version);
-
-  // Create Zoltan object
-  Zoltan zoltan;
-
-  // Set Zoltan parameters
-  zoltan.Set_Param("NUM_GID_ENTRIES", "1");
-  zoltan.Set_Param("NUM_LID_ENTRIES", "0");
-
-  zoltan.Set_Param("NUM_GLOBAL_PARTS",
-                   std::to_string(MPI::size(mpi_comm)));
-
-  zoltan.Set_Param("NUM_LOCAL_PARTS", "1");
-  zoltan.Set_Param("LB_METHOD", "GRAPH");
-
-  // Get partition method: 'PARTITION', 'REPARTITION' or 'REFINE'
-  std::string lb_approach = parameters["partitioning_approach"];
-  zoltan.Set_Param("LB_APPROACH", lb_approach.c_str());
-
-  // Repartitioning weighting
-  double phg_repart_multiplier = parameters["Zoltan_PHG_REPART_MULTIPLIER"];
-  zoltan.Set_Param("PHG_REPART_MULTIPLIER",
-                   std::to_string(phg_repart_multiplier));
-
-
-  // Set call-back functions
-  void *mesh_data_ptr = (void *)&mesh_data;
-  zoltan.Set_Num_Obj_Fn(get_number_of_objects, mesh_data_ptr);
-  zoltan.Set_Obj_List_Fn(get_object_list, mesh_data_ptr);
-
-  void *graph_data_ptr = (void *)&local_graph;
-  zoltan.Set_Num_Edges_Multi_Fn(get_number_edges, graph_data_ptr);
-  zoltan.Set_Edge_List_Multi_Fn(get_all_edges, graph_data_ptr);
-
-  // Call Zoltan function to compute partitions
-  int changes = 0;
-  int num_gids = 0;
-  int num_lids = 0;
-  int num_import, num_export;
-  ZOLTAN_ID_PTR import_lids;
-  ZOLTAN_ID_PTR export_lids;
-  ZOLTAN_ID_PTR import_gids;
-  ZOLTAN_ID_PTR export_gids;
-  int* import_procs;
-  int* export_procs;
-  int* import_parts;
-  int* export_parts;
-
-  int rc = zoltan.LB_Partition(changes, num_gids, num_lids,
-           num_import, import_gids, import_lids, import_procs, import_parts,
-           num_export, export_gids, export_lids, export_procs, export_parts);
-
-  dolfin_assert(num_gids == 1);
-  dolfin_assert(num_lids == 0);
-
-  std::size_t proc = MPI::rank(mpi_comm);
-
-  if (rc != ZOLTAN_OK)
-  {
-    dolfin_error("ZoltanPartition.cpp",
-                 "partition mesh using Zoltan",
-                 "Call to Zoltan failed");
-  }
-
-  cell_partition.assign(local_graph.size(), proc);
-
-  std::size_t offset = MPI::global_offset(mpi_comm, local_graph.size(), true);
-  for(int i = 0; i < num_export; ++i)
-  {
-    const std::size_t idx = export_gids[i] - offset;
-    cell_partition[idx] = (std::size_t)export_procs[i];
-  }
-
-  // Free data structures allocated by Zoltan::LB_Partition
-  zoltan.LB_Free_Part(&import_gids, &import_lids, &import_procs, &import_parts);
-  zoltan.LB_Free_Part(&export_gids, &export_lids, &export_procs, &export_parts);
-}
-//-----------------------------------------------------------------------------
-void
-ZoltanPartition::compute_partition_rcb(const MPI_Comm mpi_comm,
-                                       std::vector<std::size_t>& cell_partition,
-                                       const LocalMeshData& mesh_data)
-{
-  Timer timer0("Partition graph (calling Zoltan RCB)");
-
-  // Get number of local graph vertices
-  const std::size_t nlocal = mesh_data.cell_vertices.shape()[0];
-
-  // Initialise Zoltan
-  float version;
-  int argc = 0;
-  char** argv = NULL;
-  Zoltan_Initialize(argc, argv, &version);
-
-  // Create Zoltan object
-  Zoltan zoltan;
-
-  // Set Zoltan parameters
-  zoltan.Set_Param("NUM_GID_ENTRIES", "1");
-  zoltan.Set_Param("NUM_LID_ENTRIES", "0");
-
-  zoltan.Set_Param("NUM_GLOBAL_PARTS",
-                   std::to_string(MPI::size(mpi_comm)));
-
-  zoltan.Set_Param("NUM_LOCAL_PARTS", "1");
-  zoltan.Set_Param("LB_METHOD", "RCB");
-
-  // Set call-back functions
-  void *mesh_data_ptr = (void *)&mesh_data;
-
-  zoltan.Set_Num_Obj_Fn(get_number_of_objects, mesh_data_ptr);
-  zoltan.Set_Obj_List_Fn(get_object_list, mesh_data_ptr);
-  zoltan.Set_Num_Geom_Fn(get_geom, mesh_data_ptr);
-  zoltan.Set_Geom_Multi_Fn(get_all_geom, mesh_data_ptr);
-
-  // Call Zoltan function to compute partitions
-  int changes = 0;
-  int num_gids = 0;
-  int num_lids = 0;
-  int num_import, num_export;
-  ZOLTAN_ID_PTR import_lids;
-  ZOLTAN_ID_PTR export_lids;
-  ZOLTAN_ID_PTR import_gids;
-  ZOLTAN_ID_PTR export_gids;
-  int* import_procs;
-  int* export_procs;
-  int* import_parts;
-  int* export_parts;
-
-  int rc = zoltan.LB_Partition(changes, num_gids, num_lids,
-           num_import, import_gids, import_lids, import_procs, import_parts,
-           num_export, export_gids, export_lids, export_procs, export_parts);
-
-  dolfin_assert(num_gids == 1);
-  dolfin_assert(num_lids == 0);
-
-
-  // Get my process rank
-  const std::size_t my_rank = MPI::rank(mpi_comm);
-
-  if (rc != ZOLTAN_OK)
-  {
-    dolfin_error("ZoltanPartition.cpp",
-                 "partition mesh using Zoltan",
-                 "Call to Zoltan failed");
-  }
-
-  // Assign all nodes to this processor
-  cell_partition.assign(nlocal, my_rank);
-  std::size_t offset = MPI::global_offset(mpi_comm, nlocal, true);
-
-  // Change nodes to be exported to the appropriate remote processor
-  for(int i = 0; i < num_export; ++i)
-  {
-    const std::size_t idx = export_gids[i] - offset;
-    cell_partition[idx] = export_procs[i];
-  }
-
-  // Free data structures allocated by Zoltan::LB_Partition
-  zoltan.LB_Free_Part(&import_gids, &import_lids, &import_procs, &import_parts);
-  zoltan.LB_Free_Part(&export_gids, &export_lids, &export_procs, &export_parts);
-}
-//-----------------------------------------------------------------------------
-int ZoltanPartition::get_number_of_objects(void* data, int* ierr)
-{
-  LocalMeshData* local_mesh_data = (LocalMeshData*)data;
-  *ierr = ZOLTAN_OK;
-  return local_mesh_data->cell_vertices.shape()[0];
-}
-//-----------------------------------------------------------------------------
-void ZoltanPartition::get_object_list(void *data,
-                                      int num_gid_entries,
-                                      int num_lid_entries,
-                                      ZOLTAN_ID_PTR global_id,
-                                      ZOLTAN_ID_PTR local_id, int wgt_dim,
-                                      float* obj_wgts, int* ierr)
-{
-  LocalMeshData* local_mesh_data = (LocalMeshData*)data;
-  dolfin_assert(local_mesh_data);
-
-  // Get MPI communicator
-  const MPI_Comm mpi_comm = local_mesh_data->mpi_comm();
-
-  dolfin_assert(num_gid_entries == 1);
-  dolfin_assert(num_lid_entries == 0);
-
-  const std::size_t nlocal = local_mesh_data->cell_vertices.shape()[0];
-  const std::size_t offset = MPI::global_offset(mpi_comm, nlocal, true);
-
-  for (std::size_t i = 0; i < nlocal; ++i)
-    global_id[i] = i + offset;
-
-  dolfin_assert(wgt_dim == 0);
-  obj_wgts = NULL;
-
-  *ierr = ZOLTAN_OK;
-}
-//-----------------------------------------------------------------------------
-void ZoltanPartition::get_number_edges(void *data,
-                                       int num_gid_entries,
-                                       int num_lid_entries,
-                                       int num_obj, ZOLTAN_ID_PTR global_ids,
-                                       ZOLTAN_ID_PTR local_ids, int *num_edges,
-                                       int *ierr)
-{
-  std::vector<std::set<std::size_t>>* local_graph
-    = (std::vector<std::set<std::size_t>>*)data;
-
-  dolfin_assert(num_gid_entries == 1);
-  dolfin_assert(num_lid_entries == 0);
-  dolfin_assert(num_obj == (int)local_graph->size());
-
-  for (std::size_t i = 0; i < local_graph->size(); ++i)
-    num_edges[i] = (*local_graph)[i].size();
-
-  *ierr = ZOLTAN_OK;
-}
-//-----------------------------------------------------------------------------
-void ZoltanPartition::get_all_edges(void* data,
-                                 int num_gid_entries,
-                                 int num_lid_entries, int num_obj,
-                                 ZOLTAN_ID_PTR global_ids,
-                                 ZOLTAN_ID_PTR local_ids,
-                                 int* num_edges,
-                                 ZOLTAN_ID_PTR nbor_global_id,
-                                 int* nbor_procs, int wgt_dim,
-                                 float* ewgts, int* ierr)
-{
-  error("ZoltanPartition::get_all_edges need to be updated for MPI communicator");
-  /*
-  // Get graph
-  const std::vector<std::set<std::size_t>>* local_graph
-    = (std::vector<std::set<std::size_t>>*)data;
-
-  // MPI communicate
-  const MPI_Comm mpi_comm = local_graph->mpi_comm();
-
-  std::vector<std::size_t> offsets;
-  std::size_t local_offset = MPI::global_offset(mpi_comm, local_graph->size(),
-                                                true);
-  MPI::all_gather(mpi_comm, local_offset, offsets);
-  offsets.push_back(MPI::sum(mpi_comm, local_graph->size()));
-
-  std::size_t i = 0;
-  for(std::vector<std::set<std::size_t>>::iterator node = local_graph->begin();
-      node != local_graph->end(); ++node)
-  {
-    for(std::set<std::size_t>::iterator edge = node->begin();
-        edge != node->end(); ++edge)
-    {
-      nbor_global_id[i] = *edge;
-      nbor_procs[i] = std::upper_bound(offsets.begin(), offsets.end(), *edge)
-        - offsets.begin()-1;
-      i++;
-    }
-  }
-
-  dolfin_assert(wgt_dim == 0);
-  ewgts = NULL;
-  *ierr = ZOLTAN_OK;
-  */
-}
-//-----------------------------------------------------------------------------
-int ZoltanPartition::get_geom(void* data, int* ierr)
-{
-  LocalMeshData* local_mesh_data=(LocalMeshData*)data;
-
-  *ierr = ZOLTAN_OK;
-  return local_mesh_data->gdim;
-}
-//-----------------------------------------------------------------------------
-void ZoltanPartition::get_all_geom(void *data,
-                                   int num_gid_entries, int num_lid_entries,
-                                   int num_obj, ZOLTAN_ID_PTR global_ids,
-                                   ZOLTAN_ID_PTR local_ids,
-                                   int num_dim, double *geom_vec, int *ierr)
-{
-  const LocalMeshData* local_mesh_data=(LocalMeshData*)data;
-  dolfin_assert(local_mesh_data);
-
-  // Get MPI communicator
-  const MPI_Comm mpi_comm = local_mesh_data->mpi_comm();
-
-  dolfin_assert(num_gid_entries == 1);
-  dolfin_assert(num_lid_entries == 0);
-
-  std::size_t gdim = local_mesh_data->gdim;
-  dolfin_assert(num_dim == (int)gdim);
-
-  std::size_t num_local_cells = local_mesh_data->cell_vertices.shape()[0];
-  std::size_t cell_offset = MPI::global_offset(mpi_comm, num_local_cells, true);
-  std::size_t num_vertices_per_cell = local_mesh_data->cell_vertices.shape()[1];
-  dolfin_assert(num_obj == (int)num_local_cells);
-
-  // Work out all ranges for vertices
-  std::size_t num_local_vertices
-    = local_mesh_data->vertex_coordinates.shape()[0];
-  std::vector<std::size_t> vertex_offsets;
-  std::size_t local_vertex_offset
-    = MPI::global_offset(mpi_comm, num_local_vertices, true);
-  MPI::all_gather(mpi_comm, local_vertex_offset, vertex_offsets);
-  vertex_offsets.push_back(MPI::sum(mpi_comm, num_local_vertices));
-
-  // Need to get all vertex coordinates which are referred to by
-  // topology onto this process...
-  std::map<std::size_t, std::vector<double>> vertex;
-
-  // Insert local vertices into map
-  for(std::size_t i = 0; i < num_local_vertices; ++i)
-  {
-    vertex[i + local_vertex_offset]
-      = std::vector<double>(local_mesh_data->vertex_coordinates[i].begin(),
-                            local_mesh_data->vertex_coordinates[i].end());
-  }
-
-  std::size_t num_processes = MPI::size(mpi_comm);
-  std::vector<std::vector<std::size_t>>send_buffer(num_processes);
-  std::vector<std::vector<std::size_t>>receive_buffer(num_processes);
-
-  // Make list of requested remote vertices for each remote process
-  for (std::size_t i = 0; i < num_local_cells; ++i)
-    for (std::size_t j = 0; j < num_vertices_per_cell; ++j)
-    {
-      std::size_t ivtx = local_mesh_data->cell_vertices[i][j];
-      if (ivtx < local_vertex_offset
-         || ivtx >= (local_vertex_offset + num_local_vertices))
-      {
-        // Find owner of this vertex and then add to request list for
-        // that process
-        std::size_t proc = std::upper_bound(vertex_offsets.begin(),
-                                            vertex_offsets.end(), ivtx)
-          - vertex_offsets.begin() - 1;
-        send_buffer[proc].push_back(ivtx);
-      }
-    }
-
-  MPI::all_to_all(mpi_comm, send_buffer, receive_buffer);
-
-  std::vector<std::vector<double>> dsend_buffer(num_processes);
-  std::vector<std::vector<double>> dreceive_buffer(num_processes);
-
-  // Get received requests for vertices from remote processes, and put
-  // together answer to send back
-  for (std::vector<std::vector<std::size_t>>::iterator p
-         = receive_buffer.begin(); p != receive_buffer.end(); ++p)
-  {
-    std::size_t proc = p - receive_buffer.begin();
-    for (std::vector<std::size_t>::iterator vidx = p->begin();
-         vidx != p->end(); ++vidx)
-    {
-      dolfin_assert(*vidx >= local_vertex_offset);
-      dolfin_assert(*vidx < (local_vertex_offset + num_local_vertices));
-      dsend_buffer[proc].insert(dsend_buffer[proc].end(),
-                                local_mesh_data->vertex_coordinates[*vidx - local_vertex_offset].begin(),
-                                local_mesh_data->vertex_coordinates[*vidx - local_vertex_offset].end());
-    }
-  }
-
-  MPI::all_to_all(mpi_comm, dsend_buffer, dreceive_buffer);
-
-  // insert received coordinates into local map.
-  for(std::size_t i = 0; i < num_processes; ++i)
-  {
-    std::vector<double>::iterator vcoords = dreceive_buffer[i].begin();
-    for(std::vector<std::size_t>::iterator v = send_buffer[i].begin();
-        v != send_buffer[i].end(); ++v)
-    {
-      vertex[*v] = std::vector<double>(vcoords, vcoords + gdim);
-      vcoords += gdim;
-    }
-  }
-
-  double *geom_ptr = geom_vec;
-  for (std::size_t i = 0; i < num_local_cells; ++i)
-  {
-    std::vector<double> x(gdim, 0.0);
-    for(std::size_t j = 0; j < num_vertices_per_cell ; ++j)
-    {
-      std::size_t idx
-        = local_mesh_data->cell_vertices[global_ids[i] - cell_offset][j] ;
-      for(std::size_t k=0; k < gdim ; ++k)
-        x[k] += vertex[idx][k];
-    }
-
-    std::copy(x.begin(), x.end(), geom_ptr);
-    geom_ptr += gdim;
-  }
-
-  *ierr = ZOLTAN_OK;
-}
-//-----------------------------------------------------------------------------
-#else
-void ZoltanPartition::compute_partition_phg(const MPI_Comm mpi_comm,
-                                            std::vector<std::size_t>& cell_partition,
-                                            const LocalMeshData& mesh_data)
-{
-  dolfin_error("ZoltanPartition.cpp",
-               "partition mesh using Zoltan",
-               "DOLFIN has been configured without support for Zoltan from Trilinos");
-}
-//-----------------------------------------------------------------------------
-void ZoltanPartition::compute_partition_rcb(const MPI_Comm mpi_comm,
-                                            std::vector<std::size_t>& cell_partition,
-                                            const LocalMeshData& mesh_data)
-{
-  dolfin_error("ZoltanPartition.cpp",
-               "partition mesh using Zoltan",
-               "DOLFIN has been configured without support for Zoltan from Trilinos");
-}
-#endif
-//-----------------------------------------------------------------------------
diff --git a/dolfin/graph/ZoltanPartition.h b/dolfin/graph/ZoltanPartition.h
deleted file mode 100644
index eb6bda4..0000000
--- a/dolfin/graph/ZoltanPartition.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (C) 2013 Chris Richardson
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2013-02-15
-// Last changed: 2013-02-26
-
-#ifndef __DOLFIN_ZOLTAN_PARTITION_H
-#define __DOLFIN_ZOLTAN_PARTITION_H
-
-#include <vector>
-#include <dolfin/common/MPI.h>
-
-#ifdef HAS_TRILINOS
-#include <zoltan_cpp.h>
-#endif
-
-namespace dolfin
-{
-
-  class LocalMeshData;
-
-  /// This class partitions a graph using Zoltan (part of Trilinos).
-
-  class ZoltanPartition
-  {
-
-  public:
-
-    /// Calculate partitioning using Parallel HyperGraph (Zoltan PHG)
-    static void compute_partition_phg(const MPI_Comm mpi_comm,
-                                      std::vector<std::size_t>& cell_partition,
-                                      const LocalMeshData& mesh_data);
-
-    /// Calculate partitioning using recursive block bisection
-    /// (Zoltan RCB - geometric partitioner)
-    static void compute_partition_rcb(const MPI_Comm mpi_comm,
-                                      std::vector<std::size_t>& cell_partition,
-                                      const LocalMeshData& mesh_data);
-
-  private:
-
-    #ifdef HAS_TRILINOS
-
-    static void num_vertex_edges(void * data, unsigned int* num_edges);
-
-    static int get_number_of_objects(void* data, int* ierr);
-
-    static void get_object_list(void *data,
-                                int sizeGID, int sizeLID,
-                                ZOLTAN_ID_PTR global_id,
-                                ZOLTAN_ID_PTR local_id, int wgt_dim,
-                                float* obj_wgts, int* ierr);
-
-    static void get_number_edges(void *data,
-                                 int num_gid_entries,
-                                 int num_lid_entries,
-                                 int num_obj, ZOLTAN_ID_PTR global_ids,
-                                 ZOLTAN_ID_PTR local_ids, int *num_edges,
-                                 int *ierr);
-
-    static void get_all_edges(void* data,
-                              int num_gid_entries,
-                              int num_lid_entries, int num_obj,
-                              ZOLTAN_ID_PTR global_ids,
-                              ZOLTAN_ID_PTR local_ids,
-                              int* num_edges,
-                              ZOLTAN_ID_PTR nbor_global_id,
-                              int* nbor_procs, int wgt_dim,
-                              float* ewgts, int* ierr);
-
-
-    static void get_all_geom(void *data,
-                             int num_gid_entries, int num_lid_entries,
-                             int num_obj,
-                             ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids,
-                             int num_dim, double *geom_vec, int *ierr);
-
-    static int get_geom(void* data, int* ierr);
-
-    #endif
-
-  };
-}
-
-#endif
diff --git a/dolfin/io/Encoder.h b/dolfin/io/Encoder.h
index f46d8f3..984d147 100644
--- a/dolfin/io/Encoder.h
+++ b/dolfin/io/Encoder.h
@@ -34,7 +34,6 @@ extern "C"
 #include <sstream>
 #include <vector>
 #include <utility>
-#include <boost/shared_array.hpp>
 #include "base64.h"
 
 namespace dolfin
@@ -48,7 +47,6 @@ namespace dolfin
 
   namespace Encoder
   {
-
     template<typename T>
     static void encode_base64(const T* data, std::size_t length,
                               std::stringstream& encoded_data)
@@ -67,7 +65,7 @@ namespace dolfin
 
     #ifdef HAS_ZLIB
     template<typename T>
-    static std::pair<boost::shared_array<unsigned char>, std::size_t> compress_data(const std::vector<T>& data)
+    static std::vector<unsigned char> compress_data(const std::vector<T>& data)
     {
       // Compute length of uncompressed data
       const unsigned long uncompressed_size = data.size()*sizeof(T);
@@ -76,18 +74,19 @@ namespace dolfin
       unsigned long compressed_size = (uncompressed_size + (((uncompressed_size)/1000)+1)+12);;
 
       // Allocate space for compressed data
-      boost::shared_array<unsigned char> compressed_data(new unsigned char[compressed_size]);
+      std::vector<unsigned char> compressed_data(compressed_size);
 
       // Compress data
-      if (compress((Bytef*) compressed_data.get(), &compressed_size, (const Bytef*) &data[0], uncompressed_size) != Z_OK)
+      if (compress((Bytef*) compressed_data.data(), &compressed_size,
+                   (const Bytef*) data.data(), uncompressed_size) != Z_OK)
       {
         dolfin_error("Encoder.h",
                      "compress data when writing file",
                      "Zlib error while compressing data");
       }
 
-      // Make pair and return
-      return std::make_pair(compressed_data, compressed_size);
+      // Return data
+      return compressed_data;
     }
     #endif
 
diff --git a/dolfin/io/File.cpp b/dolfin/io/File.cpp
index 8e9ea3c..4234cad 100644
--- a/dolfin/io/File.cpp
+++ b/dolfin/io/File.cpp
@@ -36,7 +36,6 @@
 #include "VTKFile.h"
 #include "X3DFile.h"
 #include "XMLFile.h"
-#include "XDMFFile.h"
 #include "XYZFile.h"
 
 #include "File.h"
@@ -45,9 +44,9 @@ using namespace dolfin;
 
 //-----------------------------------------------------------------------------
 File::File(const std::string filename, std::string encoding)
-  : _mpi_comm(MPI_COMM_WORLD)
+  : File(MPI_COMM_WORLD, filename, encoding)
 {
-  init(MPI_COMM_WORLD, filename, encoding);
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
 File::File(MPI_Comm comm, const std::string filename, std::string encoding)
@@ -57,9 +56,9 @@ File::File(MPI_Comm comm, const std::string filename, std::string encoding)
 }
 //-----------------------------------------------------------------------------
 File::File(const std::string filename, Type type, std::string encoding)
-  : _mpi_comm(MPI_COMM_WORLD)
+  : File(MPI_COMM_WORLD, filename, type, encoding)
 {
-  init(MPI_COMM_WORLD, filename, type, encoding);
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
 File::File(MPI_Comm comm, const std::string filename, Type type,
@@ -80,38 +79,38 @@ File::~File()
 //-----------------------------------------------------------------------------
 void File::operator<<(const std::pair<const Mesh*, double> mesh)
 {
-  file->write(MPI::rank(_mpi_comm));
+  file->_write(MPI::rank(_mpi_comm));
   *file << mesh;
 }
 //-----------------------------------------------------------------------------
 void File::operator<<(const std::pair<const MeshFunction<int>*, double> f)
 {
-  file->write(MPI::rank(_mpi_comm));
+  file->_write(MPI::rank(_mpi_comm));
   *file << f;
 }
 //-----------------------------------------------------------------------------
 void
 File::operator<<(const std::pair<const MeshFunction<std::size_t>*, double> f)
 {
-  file->write(MPI::rank(_mpi_comm));
+  file->_write(MPI::rank(_mpi_comm));
   *file << f;
 }
 //-----------------------------------------------------------------------------
 void File::operator<<(const std::pair<const MeshFunction<double>*, double> f)
 {
-  file->write(MPI::rank(_mpi_comm));
+  file->_write(MPI::rank(_mpi_comm));
   *file << f;
 }
 //-----------------------------------------------------------------------------
 void File::operator<<(const std::pair<const MeshFunction<bool>*, double> f)
 {
-  file->write(MPI::rank(_mpi_comm));
+  file->_write(MPI::rank(_mpi_comm));
   *file << f;
 }
 //-----------------------------------------------------------------------------
 void File::operator<<(const std::pair<const Function*, double> u)
 {
-  file->write(MPI::rank(_mpi_comm));
+  file->_write(MPI::rank(_mpi_comm));
   *file << u;
 }
 //-----------------------------------------------------------------------------
@@ -184,10 +183,6 @@ void File::init(MPI_Comm comm, const std::string filename,
     file.reset(new RAWFile(filename));
   else if (extension == ".xyz")
     file.reset(new XYZFile(filename));
-#ifdef HAS_HDF5
-  else if (extension == ".xdmf")
-    file.reset(new XDMFFile(comm, filename));
-#endif
   else if (extension == ".svg")
     file.reset(new SVGFile(filename));
   else
@@ -204,24 +199,19 @@ void File::init(MPI_Comm comm, const std::string filename, Type type,
 {
   switch (type)
   {
-  case x3d:
+  case Type::x3d:
     file.reset(new X3DFile(filename));
     break;
-  case xdmf:
-#ifdef HAS_HDF5
-    file.reset(new XDMFFile(comm, filename));
-    break;
-#endif
-  case xml:
+  case Type::xml:
     file.reset(new XMLFile(comm, filename));
     break;
-  case vtk:
+  case Type::vtk:
     file.reset(new VTKFile(filename, encoding));
     break;
-  case raw:
+  case Type::raw:
     file.reset(new RAWFile(filename));
     break;
-  case xyz:
+  case Type::xyz:
     file.reset(new XYZFile(filename));
     break;
   default:
diff --git a/dolfin/io/File.h b/dolfin/io/File.h
index 0101c2e..32001d3 100644
--- a/dolfin/io/File.h
+++ b/dolfin/io/File.h
@@ -18,9 +18,6 @@
 // Modified by Magnus Vikstrom 2007
 // Modified by Nuno Lopes 2008
 // Modified by Ola Skavhaug 2009
-//
-// First added:  2002-11-12
-// Last changed: 2013-03-11
 
 #ifndef __FILE_H
 #define __FILE_H
@@ -45,7 +42,6 @@ namespace dolfin
   ///     * RAW    (.raw)
   ///     * SVG    (.svg)
   ///     * XD3    (.xd3)
-  ///     * XDMF   (.xdmf)
   ///     * XML    (.xml)
   ///     * XYZ    (.xyz)
   ///     * VTK    (.pvd)
@@ -55,7 +51,7 @@ namespace dolfin
   public:
 
     /// File formats
-    enum Type {x3d, xdmf, xml, vtk, raw, xyz, binary, svg};
+    enum class Type {x3d, xml, vtk, raw, xyz, binary, svg};
 
     /// Create a file with given name
     ///
@@ -159,7 +155,7 @@ namespace dolfin
     /// Read from file
     template<typename T> void operator>>(T& t)
     {
-      file->read();
+      file->_read();
       *file >> t;
     }
 
@@ -230,7 +226,7 @@ namespace dolfin
     /// Write object to file
     template<typename T> void operator<<(const T& t)
     {
-      file->write(MPI::rank(_mpi_comm));
+      file->_write(MPI::rank(_mpi_comm));
       *file << t;
     }
 
diff --git a/dolfin/io/GenericFile.cpp b/dolfin/io/GenericFile.cpp
index 42ddcdf..5803393 100644
--- a/dolfin/io/GenericFile.cpp
+++ b/dolfin/io/GenericFile.cpp
@@ -328,12 +328,12 @@ void GenericFile::operator<< (const std::map<std::size_t,
   read_not_impl("std::map<std::size_t, std::vector<double>>");
 }
 //-----------------------------------------------------------------------------
-void GenericFile::read()
+void GenericFile::_read()
 {
   opened_read = true;
 }
 //-----------------------------------------------------------------------------
-void GenericFile::write(std::size_t process_number)
+void GenericFile::_write(std::size_t process_number)
 {
   // pvd files should only be cleared by one process
   if (_filetype == "VTK" && process_number > 0)
diff --git a/dolfin/io/GenericFile.h b/dolfin/io/GenericFile.h
index f80e95a..e5d446b 100644
--- a/dolfin/io/GenericFile.h
+++ b/dolfin/io/GenericFile.h
@@ -16,9 +16,6 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // Modified by Ola Skavhaug 2009.
-//
-// First added:  2003-07-15
-// Last changed: 2013-03-11
 
 #ifndef __GENERIC_FILE_H
 #define __GENERIC_FILE_H
@@ -75,9 +72,9 @@ namespace dolfin
     virtual void operator>> (std::map<std::size_t, int>& map);
     virtual void operator>> (std::map<std::size_t, std::size_t>& map);
     virtual void operator>> (std::map<std::size_t, double>& map);
-    virtual void operator>> (std::map<std::size_t, std::vector<int> >& array_map);
-    virtual void operator>> (std::map<std::size_t, std::vector<std::size_t> >& array_map);
-    virtual void operator>> (std::map<std::size_t, std::vector<double> >& array_map);
+    virtual void operator>> (std::map<std::size_t, std::vector<int>>& array_map);
+    virtual void operator>> (std::map<std::size_t, std::vector<std::size_t>>& array_map);
+    virtual void operator>> (std::map<std::size_t, std::vector<double>>& array_map);
     virtual void operator>> (Function& u);
 
     // Output
@@ -112,12 +109,14 @@ namespace dolfin
     virtual void operator<< (const std::map<std::size_t, int>& map);
     virtual void operator<< (const std::map<std::size_t, std::size_t>& map);
     virtual void operator<< (const std::map<std::size_t, double>& map);
-    virtual void operator<< (const std::map<std::size_t, std::vector<int> >& array_map);
-    virtual void operator<< (const std::map<std::size_t, std::vector<std::size_t> >& array_map);
-    virtual void operator<< (const std::map<std::size_t, std::vector<double> >& array_map);
-
-    void read();
-    virtual void write(std::size_t process_number);
+    virtual void operator<< (const std::map<std::size_t, std::vector<int>>& array_map);
+    virtual void operator<< (const std::map<std::size_t,
+                             std::vector<std::size_t> >& array_map);
+    virtual void operator<< (const std::map<std::size_t,
+                             std::vector<double> >& array_map);
+
+    void _read();
+    void _write(std::size_t process_number);
 
     // Return filename
     std::string name() const
diff --git a/dolfin/io/HDF5File.cpp b/dolfin/io/HDF5File.cpp
index 88e1ebd..89601ff 100644
--- a/dolfin/io/HDF5File.cpp
+++ b/dolfin/io/HDF5File.cpp
@@ -46,6 +46,7 @@
 #include <dolfin/mesh/MeshFunction.h>
 #include <dolfin/mesh/MeshValueCollection.h>
 #include <dolfin/mesh/Vertex.h>
+#include <dolfin/parameter/GlobalParameters.h>
 #include "HDF5Attribute.h"
 #include "HDF5Interface.h"
 #include "HDF5Utility.h"
@@ -56,12 +57,15 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 HDF5File::HDF5File(MPI_Comm comm, const std::string filename,
                    const std::string file_mode)
-  : hdf5_file_open(false), hdf5_file_id(0), _mpi_comm(comm)
+  : _hdf5_file_id(0), _mpi_comm(comm)
 {
+  // See https://www.hdfgroup.org/hdf5-quest.html#gzero on zero for
+  // _hdf5_file_id(0)
+
   // HDF5 chunking
   parameters.add("chunking", false);
 
-  // Create directory if required (create on rank 0)
+  // Create directory, if required (create on rank 0)
   if (MPI::rank(_mpi_comm) == 0)
   {
     const boost::filesystem::path path(filename);
@@ -84,9 +88,9 @@ HDF5File::HDF5File(MPI_Comm comm, const std::string filename,
 
   // Open HDF5 file
   const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
-  hdf5_file_id = HDF5Interface::open_file(_mpi_comm, filename, file_mode,
+  _hdf5_file_id = HDF5Interface::open_file(_mpi_comm, filename, file_mode,
                                           mpi_io);
-  hdf5_file_open = true;
+  dolfin_assert(_hdf5_file_id > 0);
 }
 //-----------------------------------------------------------------------------
 HDF5File::~HDF5File()
@@ -97,22 +101,22 @@ HDF5File::~HDF5File()
 void HDF5File::close()
 {
   // Close HDF5 file
-  if (hdf5_file_open)
-    HDF5Interface::close_file(hdf5_file_id);
-  hdf5_file_open = false;
+  if (_hdf5_file_id > 0)
+    HDF5Interface::close_file(_hdf5_file_id);
+  _hdf5_file_id = 0;
 }
 //-----------------------------------------------------------------------------
 void HDF5File::flush()
 {
-  dolfin_assert(hdf5_file_open);
-  HDF5Interface::flush_file(hdf5_file_id);
+  dolfin_assert(_hdf5_file_id > 0);
+  HDF5Interface::flush_file(_hdf5_file_id);
 }
 //-----------------------------------------------------------------------------
 void HDF5File::write(const std::vector<Point>& points,
                      const std::string dataset_name)
 {
   dolfin_assert(points.size() > 0);
-  dolfin_assert(hdf5_file_open);
+  dolfin_assert(_hdf5_file_id > 0);
 
   // Get number of points (global)
   std::size_t num_points_global = MPI::sum(_mpi_comm, points.size());
@@ -129,7 +133,7 @@ void HDF5File::write(const std::vector<Point>& points,
 
   // Write data to file
   //  const bool chunking = parameters["chunking"];
-  std::vector<std::size_t> global_size(2);
+  std::vector<std::int64_t> global_size(2);
   global_size[0] = num_points_global;
   global_size[1] = 3;
 
@@ -140,7 +144,7 @@ void HDF5File::write(const std::vector<Point>& points,
 void HDF5File::write(const std::vector<double>& values,
                      const std::string dataset_name)
 {
-  std::vector<std::size_t> global_size(1, MPI::sum(_mpi_comm, values.size()));
+  std::vector<std::int64_t> global_size(1, MPI::sum(_mpi_comm, values.size()));
   const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
   write_data(dataset_name, values, global_size, mpi_io);
 }
@@ -148,7 +152,7 @@ void HDF5File::write(const std::vector<double>& values,
 void HDF5File::write(const GenericVector& x, const std::string dataset_name)
 {
   dolfin_assert(x.size() > 0);
-  dolfin_assert(hdf5_file_open);
+  dolfin_assert(_hdf5_file_id > 0);
 
   // Get all local data
   std::vector<double> local_data;
@@ -157,9 +161,9 @@ void HDF5File::write(const GenericVector& x, const std::string dataset_name)
   // Write data to file
   std::pair<std::size_t, std::size_t> local_range = x.local_range();
   const bool chunking = parameters["chunking"];
-  const std::vector<std::size_t> global_size(1, x.size());
+  const std::vector<std::int64_t> global_size(1, x.size());
   const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
-  HDF5Interface::write_dataset(hdf5_file_id, dataset_name, local_data,
+  HDF5Interface::write_dataset(_hdf5_file_id, dataset_name, local_data,
                                local_range, global_size, mpi_io, chunking);
 
   // Add partitioning attribute to dataset
@@ -168,33 +172,38 @@ void HDF5File::write(const GenericVector& x, const std::string dataset_name)
   MPI::gather(_mpi_comm, local_range_first, partitions);
   MPI::broadcast(_mpi_comm, partitions);
 
-  HDF5Interface::add_attribute(hdf5_file_id, dataset_name, "partition",
+  HDF5Interface::add_attribute(_hdf5_file_id, dataset_name, "partition",
                                partitions);
 }
 //-----------------------------------------------------------------------------
 void HDF5File::read(GenericVector& x, const std::string dataset_name,
                     const bool use_partition_from_file) const
 {
-  dolfin_assert(hdf5_file_open);
+  dolfin_assert(_hdf5_file_id > 0);
 
   // Check for data set exists
-  if (!HDF5Interface::has_dataset(hdf5_file_id, dataset_name))
-    error("Data set with name \"%s\" does not exist", dataset_name.c_str());
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, dataset_name))
+  {
+    dolfin_error("HDF5File.cpp",
+                 "read vector from file",
+                 "Data set with name \"%s\" does not exist",
+                 dataset_name.c_str());
+  }
 
   // Get dataset rank
-  const std::size_t rank = HDF5Interface::dataset_rank(hdf5_file_id,
+  const std::size_t rank = HDF5Interface::dataset_rank(_hdf5_file_id,
                                                        dataset_name);
 
   if (rank != 1)
     warning("Reading non-scalar data in HDF5 Vector");
 
   // Get global dataset size
-  const std::vector<std::size_t> data_size
-      = HDF5Interface::get_dataset_size(hdf5_file_id, dataset_name);
+  const std::vector<std::int64_t> data_shape
+      = HDF5Interface::get_dataset_shape(_hdf5_file_id, dataset_name);
 
   // Check that rank is 1 or 2
-  dolfin_assert(data_size.size() == 1
-                or (data_size.size() == 2 and data_size[1] == 1));
+  dolfin_assert(data_shape.size() == 1
+                or (data_shape.size() == 2 and data_shape[1] == 1));
 
   // Check input vector, and re-size if not already sized
   if (x.empty())
@@ -204,7 +213,7 @@ void HDF5File::read(GenericVector& x, const std::string dataset_name,
     {
       // Get partition from file
       std::vector<std::size_t> partitions;
-      HDF5Interface::get_attribute(hdf5_file_id, dataset_name, "partition",
+      HDF5Interface::get_attribute(_hdf5_file_id, dataset_name, "partition",
                                    partitions);
 
       // Check that number of MPI processes matches partitioning
@@ -216,7 +225,7 @@ void HDF5File::read(GenericVector& x, const std::string dataset_name,
       }
 
       // Add global size at end of partition vectors
-      partitions.push_back(data_size[0]);
+      partitions.push_back(data_shape[0]);
 
       // Initialise vector
       const std::size_t process_num = MPI::rank(_mpi_comm);
@@ -225,9 +234,9 @@ void HDF5File::read(GenericVector& x, const std::string dataset_name,
       x.init(_mpi_comm, local_range);
     }
     else
-      x.init(_mpi_comm, data_size[0]);
+      x.init(_mpi_comm, data_shape[0]);
   }
-  else if (x.size() != data_size[0])
+  else if ((std::int64_t) x.size() != data_shape[0])
   {
     dolfin_error("HDF5File.cpp",
                  "read vector from file",
@@ -239,7 +248,7 @@ void HDF5File::read(GenericVector& x, const std::string dataset_name,
 
   // Read data from file
   std::vector<double> data;
-  HDF5Interface::read_dataset(hdf5_file_id, dataset_name, local_range, data);
+  HDF5Interface::read_dataset(_hdf5_file_id, dataset_name, local_range, data);
 
   // Set data
   x.set_local(data);
@@ -254,14 +263,22 @@ void HDF5File::write(const Mesh& mesh, const std::string name)
 void HDF5File::write(const Mesh& mesh, std::size_t cell_dim,
                      const std::string name)
 {
+  // FIXME: break up this function
+
   Timer t0("HDF5: write mesh to file");
 
-  CellType::Type cell_type = mesh.type().entity_type(cell_dim);
+  const std::size_t tdim = mesh.topology().dim();
+  const std::size_t gdim = mesh.geometry().dim();
 
-  std::unique_ptr<CellType> celltype(CellType::create(cell_type));
-  std::size_t num_cell_verts = celltype->num_entities(0);
+  const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
+  dolfin_assert(_hdf5_file_id > 0);
 
-  dolfin_assert(hdf5_file_open);
+  CellType::Type cell_type = mesh.type().entity_type(cell_dim);
+  std::unique_ptr<CellType> celltype(CellType::create(cell_type));
+  std::size_t num_cell_points = 0;
+  for (std::size_t i = 0; i <= cell_dim; ++i)
+    num_cell_points +=
+      mesh.geometry().num_entity_coordinates(i)*celltype->num_entities(i);
 
   // ---------- Vertices (coordinates)
   {
@@ -269,36 +286,71 @@ void HDF5File::write(const Mesh& mesh, std::size_t cell_dim,
     const std::string coord_dataset =  name + "/coordinates";
 
     // Copy coordinates and indices and remove off-process values
-    const std::size_t gdim = mesh.geometry().dim();
-    const std::vector<double> vertex_coords
-      = DistributedMeshTools::reorder_vertices_by_global_indices(mesh);
+    std::vector<double> vertex_coords;
+    if (!mpi_io)
+      vertex_coords = mesh.geometry().x();
+    else
+      vertex_coords
+        = DistributedMeshTools::reorder_vertices_by_global_indices(mesh);
 
     // Write coordinates out from each process
-    std::vector<std::size_t> global_size(2);
+    std::vector<std::int64_t> global_size(2);
     global_size[0] = MPI::sum(_mpi_comm, vertex_coords.size()/gdim);
     global_size[1] = gdim;
-    dolfin_assert(global_size[0] == mesh.size_global(0));
-    const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
     write_data(coord_dataset, vertex_coords, global_size, mpi_io);
   }
 
   // ---------- Topology
   {
     // Get/build topology data
-    std::vector<std::size_t> topological_data;
-    topological_data.reserve(mesh.num_entities(cell_dim)*(num_cell_verts));
+    std::vector<std::int64_t> topological_data;
+    topological_data.reserve(mesh.num_entities(cell_dim)*(num_cell_points));
 
     const std::vector<std::size_t>& global_vertices
       = mesh.topology().global_indices(0);
 
     // Permutation to VTK ordering
-    const std::vector<unsigned int> perm = celltype->vtk_mapping();
+    const std::vector<std::int8_t> perm = celltype->vtk_mapping();
 
-    if (cell_dim == mesh.topology().dim() || MPI::size(_mpi_comm) == 1)
+    if (cell_dim == tdim or !mpi_io)
     {
       // Usual case, with cell output, and/or none shared with another
       // process.
-      if (cell_dim == 0)
+      if (mesh.geometry().degree() > 1)
+      {
+        const MeshGeometry& geom = mesh.geometry();
+
+        // Only cope with quadratic for now
+        dolfin_assert(geom.degree() == 2);
+        // FIXME: make it work in parallel
+        dolfin_assert(!mpi_io);
+
+        std::vector<std::size_t> edge_mapping;
+        if (tdim == 1)
+          edge_mapping = {0};
+        else if (tdim == 2)
+          edge_mapping = {2, 0, 1};
+        else
+          edge_mapping = {5, 2, 4, 3, 1, 0};
+
+        for (CellIterator c(mesh); !c.end(); ++c)
+        {
+          // Add indices for vertices and edges
+          for (unsigned int dim = 0; dim != 2; ++dim)
+          {
+            for (unsigned int i = 0; i != celltype->num_entities(dim); ++i)
+            {
+              std::size_t im = (dim == 0) ? i : edge_mapping[i];
+              const std::size_t entity_index
+                = (dim == tdim) ? c->index() : c->entities(dim)[im];
+              const std::size_t local_idx
+                = geom.get_entity_index(dim, 0, entity_index);
+              topological_data.push_back(local_idx);
+            }
+          }
+        }
+      }
+      else if (cell_dim == 0)
       {
         for (VertexIterator v(mesh); !v.end(); ++v)
           topological_data.push_back(v->global_index());
@@ -323,16 +375,14 @@ void HDF5File::write(const Mesh& mesh, std::size_t cell_dim,
       DistributedMeshTools::number_entities(mesh, cell_dim);
 
       const std::size_t mpi_rank = MPI::rank(_mpi_comm);
-      const std::map<unsigned int, std::set<unsigned int>>& shared_entities
+      const std::map<std::int32_t, std::set<unsigned int>>& shared_entities
         = mesh.topology().shared_entities(cell_dim);
 
-      const std::size_t tdim = mesh.topology().dim();
-
       std::set<unsigned int> non_local_entities;
-
       if (mesh.topology().size(tdim) == mesh.topology().ghost_offset(tdim))
       {
-        // No ghost cells - exclude shared entities which are on lower rank processes
+        // No ghost cells - exclude shared entities which are on lower
+        // rank processes
         for (auto sh = shared_entities.begin(); sh != shared_entities.end(); ++sh)
         {
           const unsigned int lowest_proc = *(sh->second.begin());
@@ -342,8 +392,9 @@ void HDF5File::write(const Mesh& mesh, std::size_t cell_dim,
       }
       else
       {
-        // Iterate through ghost cells, adding non-ghost entities which are
-        // in lower rank process cells to a set for exclusion from output
+        // Iterate through ghost cells, adding non-ghost entities
+        // which are in lower rank process cells to a set for
+        // exclusion from output
         for (MeshEntityIterator c(mesh, tdim, "ghost"); !c.end(); ++c)
         {
           const unsigned int cell_owner = c->owner();
@@ -383,11 +434,11 @@ void HDF5File::write(const Mesh& mesh, std::size_t cell_dim,
 
     // Write topology data
     const std::string topology_dataset =  name + "/topology";
-    std::vector<std::size_t> global_size(2);
+    std::vector<std::int64_t> global_size(2);
     global_size[0] = MPI::sum(_mpi_comm,
-                              topological_data.size()/num_cell_verts);
-    global_size[1] = num_cell_verts;
-    dolfin_assert(global_size[0] == mesh.size_global(cell_dim));
+                              topological_data.size()/num_cell_points);
+    global_size[1] = num_cell_points;
+    dolfin_assert(global_size[0] == (std::int64_t) mesh.size_global(cell_dim));
     const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
     write_data(topology_dataset, topological_data, global_size, mpi_io);
 
@@ -405,7 +456,7 @@ void HDF5File::write(const Mesh& mesh, std::size_t cell_dim,
     }
 
     // Add cell type attribute
-    HDF5Interface::add_attribute(hdf5_file_id, topology_dataset, "celltype",
+    HDF5Interface::add_attribute(_hdf5_file_id, topology_dataset, "celltype",
                                  CellType::type2string(cell_type));
 
     // Add partitioning attribute to dataset
@@ -417,7 +468,7 @@ void HDF5File::write(const Mesh& mesh, std::size_t cell_dim,
     std::vector<std::size_t> topology_offset_tmp(1, topology_offset);
     MPI::gather(_mpi_comm, topology_offset_tmp, partitions);
     MPI::broadcast(_mpi_comm, partitions);
-    HDF5Interface::add_attribute(hdf5_file_id, topology_dataset,
+    HDF5Interface::add_attribute(_hdf5_file_id, topology_dataset,
                                  "partition", partitions);
 
     // ---------- Markers
@@ -425,8 +476,8 @@ void HDF5File::write(const Mesh& mesh, std::size_t cell_dim,
     {
       const std::map<std::size_t, std::size_t>& domain
         = mesh.domains().markers(d);
-
-      MeshValueCollection<std::size_t> collection(mesh, d);
+      auto _mesh = reference_to_no_delete_pointer(mesh);
+      MeshValueCollection<std::size_t> collection(_mesh, d);
       std::map<std::size_t, std::size_t>::const_iterator it;
       for (it = domain.begin(); it != domain.end(); ++it)
         collection.set_value(it->first, it->second);
@@ -477,13 +528,14 @@ void HDF5File::read(MeshFunction<double>& meshfunction,
 void HDF5File::write(const MeshFunction<bool>& meshfunction,
                      const std::string name)
 {
-  const Mesh& mesh = *meshfunction.mesh();
+  std::shared_ptr<const Mesh> mesh = meshfunction.mesh();
+  dolfin_assert(mesh);
   const std::size_t cell_dim = meshfunction.dim();
 
   // HDF5 does not support a boolean type,
   // so copy to int with values 1 and 0
   MeshFunction<int> mf(mesh, cell_dim);
-  for (MeshEntityIterator cell(mesh, cell_dim); !cell.end(); ++cell)
+  for (MeshEntityIterator cell(*mesh, cell_dim); !cell.end(); ++cell)
     mf[cell->index()] = (meshfunction[cell->index()] ? 1 : 0);
 
   write_mesh_function(mf, name);
@@ -492,14 +544,16 @@ void HDF5File::write(const MeshFunction<bool>& meshfunction,
 void HDF5File::read(MeshFunction<bool>& meshfunction,
                     const std::string name) const
 {
-  const Mesh& mesh = *meshfunction.mesh();
+  std::shared_ptr<const Mesh> mesh = meshfunction.mesh();
+  dolfin_assert(mesh);
+
   const std::size_t cell_dim = meshfunction.dim();
 
   // HDF5 does not support bool, so use int instead
   MeshFunction<int> mf(mesh, cell_dim);
   read_mesh_function(mf, name);
 
-  for (MeshEntityIterator cell(mesh, cell_dim); !cell.end(); ++cell)
+  for (MeshEntityIterator cell(*mesh, cell_dim); !cell.end(); ++cell)
     meshfunction[cell->index()] = (mf[cell->index()] != 0);
 }
 //-----------------------------------------------------------------------------
@@ -507,13 +561,13 @@ template <typename T>
 void HDF5File::read_mesh_function(MeshFunction<T>& meshfunction,
                                   const std::string mesh_name) const
 {
-  const Mesh& mesh = *meshfunction.mesh();
-
-  dolfin_assert(hdf5_file_open);
+  std::shared_ptr<const Mesh> mesh = meshfunction.mesh();
+  dolfin_assert(mesh);
+  dolfin_assert(_hdf5_file_id > 0);
 
   const std::string topology_name = mesh_name + "/topology";
 
-  if (!HDF5Interface::has_dataset(hdf5_file_id, topology_name))
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, topology_name))
   {
     dolfin_error("HDF5File.cpp",
                  "read topology dataset",
@@ -522,7 +576,7 @@ void HDF5File::read_mesh_function(MeshFunction<T>& meshfunction,
 
   // Look for Coordinates dataset - but not used
   const std::string coordinates_name = mesh_name + "/coordinates";
-  if (!HDF5Interface::has_dataset(hdf5_file_id, coordinates_name))
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, coordinates_name))
   {
     dolfin_error("HDF5File.cpp",
                  "read coordinates dataset",
@@ -531,7 +585,7 @@ void HDF5File::read_mesh_function(MeshFunction<T>& meshfunction,
 
   // Look for Values dataset
   const std::string values_name = mesh_name + "/values";
-  if (!HDF5Interface::has_dataset(hdf5_file_id, values_name))
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, values_name))
   {
     dolfin_error("HDF5File.cpp",
                  "read values dataset",
@@ -539,15 +593,16 @@ void HDF5File::read_mesh_function(MeshFunction<T>& meshfunction,
   }
 
   // --- Topology ---
+
   // Discover size of topology dataset
-  const std::vector<std::size_t> topology_dim
-      = HDF5Interface::get_dataset_size(hdf5_file_id, topology_name);
+  const std::vector<std::int64_t> topology_shape
+      = HDF5Interface::get_dataset_shape(_hdf5_file_id, topology_name);
 
   // Some consistency checks
 
-  const std::size_t num_global_cells = topology_dim[0];
-  const std::size_t vert_per_cell = topology_dim[1];
-  const std::size_t cell_dim = vert_per_cell - 1;
+  const std::size_t num_global_cells = topology_shape[0];
+  const std::size_t vertices_per_cell = topology_shape[1];
+  const std::size_t cell_dim = vertices_per_cell - 1;
 
   // Initialise if called from MeshFunction constructor with filename
   // argument
@@ -563,9 +618,9 @@ void HDF5File::read_mesh_function(MeshFunction<T>& meshfunction,
   }
 
   // Ensure size_global(cell_dim) is set
-  DistributedMeshTools::number_entities(mesh, cell_dim);
+  DistributedMeshTools::number_entities(*mesh, cell_dim);
 
-  if (num_global_cells != mesh.size_global(cell_dim))
+  if (num_global_cells != mesh->size_global(cell_dim))
   {
     dolfin_error("HDF5File.cpp",
                  "read meshfunction topology",
@@ -579,23 +634,23 @@ void HDF5File::read_mesh_function(MeshFunction<T>& meshfunction,
 
   // Read a block of cells
   std::vector<std::size_t> topology_data;
-  topology_data.reserve(num_read_cells*vert_per_cell);
-  HDF5Interface::read_dataset(hdf5_file_id, topology_name, cell_range,
+  topology_data.reserve(num_read_cells*vertices_per_cell);
+  HDF5Interface::read_dataset(_hdf5_file_id, topology_name, cell_range,
                               topology_data);
 
   boost::multi_array_ref<std::size_t, 2>
     topology_array(topology_data.data(),
-                   boost::extents[num_read_cells][vert_per_cell]);
+                   boost::extents[num_read_cells][vertices_per_cell]);
 
   std::vector<T> value_data;
   value_data.reserve(num_read_cells);
-  HDF5Interface::read_dataset(hdf5_file_id, values_name, cell_range,
+  HDF5Interface::read_dataset(_hdf5_file_id, values_name, cell_range,
                               value_data);
 
   // Now send the read data to each process on the basis of the first
   // vertex of the entity, since we do not know the global_index
   const std::size_t num_processes = MPI::size(_mpi_comm);
-  const std::size_t max_vertex = mesh.size_global(0);
+  const std::size_t max_vertex = mesh->size_global(0);
 
   std::vector<std::vector<std::size_t>> send_topology(num_processes);
   std::vector<std::vector<T>> send_values(num_processes);
@@ -626,13 +681,11 @@ void HDF5File::read_mesh_function(MeshFunction<T>& meshfunction,
   // directly to the right place
   std::vector<std::vector<std::size_t>> send_requests(num_processes);
   const std::size_t process_number = MPI::rank(_mpi_comm);
-  for (MeshEntityIterator cell(mesh, cell_dim); !cell.end(); ++cell)
+  for (MeshEntityIterator cell(*mesh, cell_dim, "all"); !cell.end(); ++cell)
   {
     std::vector<std::size_t> cell_topology;
     for (VertexIterator v(*cell); !v.end(); ++v)
-    {
       cell_topology.push_back(v->global_index());
-    }
     std::sort(cell_topology.begin(), cell_topology.end());
 
     // Use first vertex to decide where to send this request
@@ -662,14 +715,14 @@ void HDF5File::read_mesh_function(MeshFunction<T>& meshfunction,
 
   for (std::size_t i = 0; i < receive_values.size(); ++i)
   {
-    dolfin_assert(receive_values[i].size()*vert_per_cell
+    dolfin_assert(receive_values[i].size()*vertices_per_cell
                   == receive_topology[i].size());
     std::vector<std::size_t>::iterator p = receive_topology[i].begin();
     for (std::size_t j = 0; j < receive_values[i].size(); ++j)
     {
-      const std::vector<std::size_t> cell(p, p + vert_per_cell);
+      const std::vector<std::size_t> cell(p, p + vertices_per_cell);
       cell_to_data[cell] = receive_values[i][j];
-      p += vert_per_cell;
+      p += vertices_per_cell;
     }
   }
 
@@ -684,11 +737,11 @@ void HDF5File::read_mesh_function(MeshFunction<T>& meshfunction,
   for (std::size_t i = 0; i < receive_requests.size(); ++i)
   {
     for (std::vector<std::size_t>::iterator p = receive_requests[i].begin();
-         p != receive_requests[i].end(); p += (vert_per_cell + 2))
+         p != receive_requests[i].end(); p += (vertices_per_cell + 2))
     {
-      const std::vector<std::size_t> cell(p, p + vert_per_cell);
-      const std::size_t remote_index = *(p + vert_per_cell);
-      const std::size_t send_to_proc = *(p + vert_per_cell + 1);
+      const std::vector<std::size_t> cell(p, p + vertices_per_cell);
+      const std::size_t remote_index = *(p + vertices_per_cell);
+      const std::size_t send_to_proc = *(p + vertices_per_cell + 1);
 
       const typename VectorKeyMap::iterator find_cell = cell_to_data.find(cell);
       dolfin_assert(find_cell != cell_to_data.end());
@@ -745,7 +798,7 @@ void HDF5File::write_mesh_function(const MeshFunction<T>& meshfunction,
     // Drop duplicate data
     const std::size_t tdim = mesh.topology().dim();
     const std::size_t mpi_rank = MPI::rank(_mpi_comm);
-    const std::map<unsigned int, std::set<unsigned int>>& shared_entities
+    const std::map<std::int32_t, std::set<unsigned int>>& shared_entities
       = mesh.topology().shared_entities(cell_dim);
 
     std::set<unsigned int> non_local_entities;
@@ -753,8 +806,7 @@ void HDF5File::write_mesh_function(const MeshFunction<T>& meshfunction,
     {
       // No ghost cells
       // Exclude shared entities which are on lower rank processes
-      for (auto sh = shared_entities.begin();
-           sh != shared_entities.end(); ++sh)
+      for (auto sh = shared_entities.begin(); sh != shared_entities.end(); ++sh)
       {
         const unsigned int lowest_proc = *(sh->second.begin());
         if (lowest_proc < mpi_rank)
@@ -770,8 +822,10 @@ void HDF5File::write_mesh_function(const MeshFunction<T>& meshfunction,
       {
         const unsigned int cell_owner = c->owner();
         for (MeshEntityIterator ent(*c, cell_dim); !ent.end(); ++ent)
+        {
           if (!ent->is_ghost() && cell_owner < mpi_rank)
-              non_local_entities.insert(ent->index());
+            non_local_entities.insert(ent->index());
+        }
       }
     }
 
@@ -783,16 +837,17 @@ void HDF5File::write_mesh_function(const MeshFunction<T>& meshfunction,
   }
 
   // Write values to HDF5
-  std::vector<std::size_t> global_size(1, MPI::sum(_mpi_comm,
-                                                   data_values.size()));
+  std::vector<std::int64_t> global_size(1, MPI::sum(_mpi_comm,
+                                                    data_values.size()));
   const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
   write_data(name + "/values", data_values, global_size, mpi_io);
 }
 //-----------------------------------------------------------------------------
-void HDF5File::write(const Function& u,  const std::string name,
+void HDF5File::write(const Function& u, const std::string name,
                      double timestamp)
 {
-  if (!HDF5Interface::has_dataset(hdf5_file_id, name))
+  dolfin_assert(_hdf5_file_id > 0);
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, name))
   {
     write(u, name);
     const std::size_t vec_count = 1;
@@ -827,6 +882,7 @@ void HDF5File::write(const Function& u,  const std::string name,
 void HDF5File::write(const Function& u, const std::string name)
 {
   Timer t0("HDF5: write Function");
+  dolfin_assert(_hdf5_file_id > 0);
 
   // Get mesh and dofmap
   dolfin_assert(u.function_space()->mesh());
@@ -871,8 +927,8 @@ void HDF5File::write(const Function& u, const std::string name)
   const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
 
   // Save DOFs on each cell
-  std::vector<std::size_t> global_size(1, MPI::sum(_mpi_comm,
-                                                   cell_dofs.size()));
+  std::vector<std::int64_t> global_size(1, MPI::sum(_mpi_comm,
+                                                    cell_dofs.size()));
   write_data(name + "/cell_dofs", cell_dofs, global_size, mpi_io);
   if (MPI::rank(_mpi_comm) == MPI::size(_mpi_comm) - 1)
     x_cell_dofs.push_back(global_size[0]);
@@ -886,7 +942,7 @@ void HDF5File::write(const Function& u, const std::string name)
   global_size[0] = mesh.size_global(tdim);
   write_data(name + "/cells", cells, global_size, mpi_io);
 
-  HDF5Interface::add_attribute(hdf5_file_id, name, "signature",
+  HDF5Interface::add_attribute(_hdf5_file_id, name, "signature",
                                u.function_space()->element()->signature());
 
   // Save vector
@@ -896,8 +952,7 @@ void HDF5File::write(const Function& u, const std::string name)
 void HDF5File::read(Function& u, const std::string name)
 {
   Timer t0("HDF5: read Function");
-
-  dolfin_assert(hdf5_file_open);
+  dolfin_assert(_hdf5_file_id > 0);
 
   // FIXME: This routine is long and involves a lot of MPI, but it
   // should work for the general case of reading a function that was
@@ -911,7 +966,7 @@ void HDF5File::read(Function& u, const std::string name)
   // Check that the name we have been given corresponds to a "group"
   // If not, then maybe we have been given the vector dataset name
   // directly, so the group name should be one level up.
-  if (!HDF5Interface::has_group(hdf5_file_id, basename))
+  if (!HDF5Interface::has_group(_hdf5_file_id, basename))
   {
     basename = name.substr(0, name.rfind("/"));
     vector_dataset_name = name;
@@ -922,30 +977,53 @@ void HDF5File::read(Function& u, const std::string name)
   const std::string x_cell_dofs_dataset_name = basename + "/x_cell_dofs";
 
   // Check datasets exist
-  if (!HDF5Interface::has_group(hdf5_file_id, basename))
-    error("Group with name \"%s\" does not exist", name.c_str());
-  if (!HDF5Interface::has_dataset(hdf5_file_id, cells_dataset_name))
-    error("Dataset with name \"%s\" does not exist",
-          cells_dataset_name.c_str());
-  if (!HDF5Interface::has_dataset(hdf5_file_id, cell_dofs_dataset_name))
-    error("Dataset with name \"%s\" does not exist",
-          cell_dofs_dataset_name.c_str());
-  if (!HDF5Interface::has_dataset(hdf5_file_id, x_cell_dofs_dataset_name))
-    error("Dataset with name \"%s\" does not exist",
-          x_cell_dofs_dataset_name.c_str());
-
-  // Check if it has the vector_0-dataset. If not, it may be stored with an
-  // older version, and instead have a vector-dataset.
-  if (!HDF5Interface::has_dataset(hdf5_file_id, vector_dataset_name))
+  if (!HDF5Interface::has_group(_hdf5_file_id, basename))
+  {
+    dolfin_error("HDF5File.cpp",
+                 "read function from file",
+                 "Group with name \"%s\" does not exist", name.c_str());
+  }
+
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, cells_dataset_name))
+  {
+    dolfin_error("HDF5File.cpp",
+                 "read function from file",
+                 "Dataset with name \"%s\" does not exist",
+                 cells_dataset_name.c_str());
+  }
+
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, cell_dofs_dataset_name))
+  {
+    dolfin_error("HDF5File.cpp",
+                 "read function from file",
+                 "Dataset with name \"%s\" does not exist",
+                 cell_dofs_dataset_name.c_str());
+  }
+
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, x_cell_dofs_dataset_name))
+  {
+    dolfin_error("HDF5File.cpp",
+                 "read function from file",
+                 "Dataset with name \"%s\" does not exist",
+                 x_cell_dofs_dataset_name.c_str());
+  }
+
+  // Check if it has the vector_0-dataset. If not, it may be stored
+  // with an older version, and instead have a vector-dataset.
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, vector_dataset_name))
   {
     std::string tmp_name = vector_dataset_name;
     const std::size_t N = vector_dataset_name.rfind("/vector_0");
     if (N != std::string::npos)
       vector_dataset_name = vector_dataset_name.substr(0, N) + "/vector";
 
-    if (!HDF5Interface::has_dataset(hdf5_file_id, vector_dataset_name))
-      error("Dataset with name \"%s\" does not exist",
-            tmp_name.c_str());
+    if (!HDF5Interface::has_dataset(_hdf5_file_id, vector_dataset_name))
+    {
+      dolfin_error("HDF5File.cpp",
+                   "read function from file",
+                   "Dataset with name \"%s\" does not exist",
+                   tmp_name.c_str());
+    }
   }
 
   // Get existing mesh and dofmap - these should be pre-existing
@@ -956,11 +1034,10 @@ void HDF5File::read(Function& u, const std::string name)
   const GenericDofMap& dofmap = *u.function_space()->dofmap();
 
   // Get dimension of dataset
-  const std::vector<std::size_t> dataset_size =
-    HDF5Interface::get_dataset_size(hdf5_file_id, cells_dataset_name);
-  const std::size_t num_global_cells = dataset_size[0];
-  if (mesh.size_global(mesh.topology().dim())
-     != num_global_cells)
+  const std::vector<std::int64_t> dataset_shape =
+    HDF5Interface::get_dataset_shape(_hdf5_file_id, cells_dataset_name);
+  const std::size_t num_global_cells = dataset_shape[0];
+  if (mesh.size_global(mesh.topology().dim()) != num_global_cells)
   {
     dolfin_error("HDF5File.cpp",
                  "read Function from file",
@@ -973,64 +1050,58 @@ void HDF5File::read(Function& u, const std::string name)
 
   // Read cells
   std::vector<std::size_t> input_cells;
-  HDF5Interface::read_dataset(hdf5_file_id, cells_dataset_name,
+  HDF5Interface::read_dataset(_hdf5_file_id, cells_dataset_name,
                               cell_range, input_cells);
 
   // Overlap reads of DOF indices, to get full range on each process
   std::vector<std::size_t> x_cell_dofs;
-  HDF5Interface::read_dataset(hdf5_file_id, x_cell_dofs_dataset_name,
+  HDF5Interface::read_dataset(_hdf5_file_id, x_cell_dofs_dataset_name,
                               std::make_pair(cell_range.first,
                                              cell_range.second + 1),
                               x_cell_dofs);
 
   // Read cell-DOF maps
   std::vector<dolfin::la_index> input_cell_dofs;
-  HDF5Interface::read_dataset(hdf5_file_id, cell_dofs_dataset_name,
+  HDF5Interface::read_dataset(_hdf5_file_id, cell_dofs_dataset_name,
                               std::make_pair(x_cell_dofs.front(),
                                              x_cell_dofs.back()),
                               input_cell_dofs);
 
   GenericVector& x = *u.vector();
 
-  const std::vector<std::size_t> vector_size =
-    HDF5Interface::get_dataset_size(hdf5_file_id, vector_dataset_name);
-  const std::size_t num_global_dofs = vector_size[0];
+  const std::vector<std::int64_t> vector_shape =
+    HDF5Interface::get_dataset_shape(_hdf5_file_id, vector_dataset_name);
+  const std::size_t num_global_dofs = vector_shape[0];
   dolfin_assert(num_global_dofs == x.size(0));
   const std::pair<dolfin::la_index, dolfin::la_index>
-    input_vector_range = MPI::local_range(_mpi_comm, vector_size[0]);
+    input_vector_range = MPI::local_range(_mpi_comm, vector_shape[0]);
 
   std::vector<double> input_values;
-  HDF5Interface::read_dataset(hdf5_file_id, vector_dataset_name,
-                              input_vector_range,
-                              input_values);
-
-  // Calculate one (global cell, local_dof_index) to associate
-  // with each item in the vector on this process
+  HDF5Interface::read_dataset(_hdf5_file_id, vector_dataset_name,
+                              input_vector_range, input_values);
 
+  // Calculate one (global cell, local_dof_index) to associate with
+  // each item in the vector on this process
   std::vector<std::size_t> global_cells;
   std::vector<std::size_t> remote_local_dofi;
+  HDF5Utility::map_gdof_to_cell(_mpi_comm, input_cells, input_cell_dofs,
+                                x_cell_dofs, input_vector_range, global_cells,
+                                remote_local_dofi);
 
-  HDF5Utility::map_gdof_to_cell(_mpi_comm,
-                                input_cells, input_cell_dofs,
-                                x_cell_dofs, input_vector_range,
-                                global_cells, remote_local_dofi);
-
-  // At this point, each process has a set of data, and for
-  // each value, a global_cell and local_dof to send it to.
-  // However, it is not known which processes the cells
-  // are actually on.
+  // At this point, each process has a set of data, and for each
+  // value, a global_cell and local_dof to send it to.  However, it is
+  // not known which processes the cells are actually on.
 
   // Find where the needed cells are held
   std::vector<std::pair<std::size_t, std::size_t>>
     cell_ownership = HDF5Utility::cell_owners(mesh, global_cells);
 
-  // Having found the cell location, the actual global_dof index
-  // held by that (cell, local_dof) is needed on the process
-  // which holds the data values
+  // Having found the cell location, the actual global_dof index held
+  // by that (cell, local_dof) is needed on the process which holds
+  // the data values
   std::vector<dolfin::la_index> global_dof;
-  HDF5Utility::get_global_dof(_mpi_comm, cell_ownership,
-                              remote_local_dofi, input_vector_range, dofmap,
-                              global_dof);
+  HDF5Utility::get_global_dof(_mpi_comm, cell_ownership, remote_local_dofi,
+                              input_vector_range, dofmap, global_dof);
 
 
   const std::size_t num_processes = MPI::size(_mpi_comm);
@@ -1054,10 +1125,9 @@ void HDF5File::read(Function& u, const std::string name)
 
     for (std::size_t i = 0; i != n_vector_vals; ++i)
     {
-      const std::size_t dest = std::upper_bound(all_vec_range.begin(),
-                                                all_vec_range.end(),
-                                                global_dof[i])
-                                              - all_vec_range.begin();
+      const std::size_t dest
+        = std::upper_bound(all_vec_range.begin(), all_vec_range.end(),
+                           global_dof[i]) - all_vec_range.begin();
       dolfin_assert(dest < num_processes);
       dolfin_assert(i < input_values.size());
       send_indices[dest].push_back(global_dof[i]);
@@ -1068,9 +1138,7 @@ void HDF5File::read(Function& u, const std::string name)
     MPI::all_to_all(_mpi_comm, send_indices, receive_indices);
   }
 
-  std::vector<double>
-    vector_values(vector_range.second - vector_range.first);
-
+  std::vector<double> vector_values(vector_range.second - vector_range.first);
   for (std::size_t i = 0; i != num_processes; ++i)
   {
     const std::vector<double>& rval = receive_values[i];
@@ -1080,8 +1148,7 @@ void HDF5File::read(Function& u, const std::string name)
     {
       dolfin_assert(rindex[j] >= vector_range.first);
       dolfin_assert(rindex[j] < vector_range.second);
-      vector_values[rindex[j] - vector_range.first]
-        = rval[j];
+      vector_values[rindex[j] - vector_range.first] = rval[j];
     }
   }
 
@@ -1121,9 +1188,8 @@ void HDF5File::write(const MeshValueCollection<bool>& mesh_values,
   MeshValueCollection<int> mvc_int(mesh_values.mesh(), mesh_values.dim());
   const std::map<std::pair<std::size_t, std::size_t>, bool>& values
     = mesh_values.values();
-  for (std::map<std::pair<std::size_t, std::size_t>,
-                bool>::const_iterator mesh_value_it = values.begin();
-       mesh_value_it != values.end(); ++mesh_value_it)
+  for (auto mesh_value_it = values.begin(); mesh_value_it != values.end();
+       ++mesh_value_it)
   {
     mvc_int.set_value(mesh_value_it->first.first, mesh_value_it->first.second,
                       mesh_value_it->second ? 1 : 0);
@@ -1142,9 +1208,8 @@ void HDF5File::read(MeshValueCollection<bool>& mesh_values,
 
   const std::map<std::pair<std::size_t, std::size_t>, int>& values
     = mvc_int.values();
-  for (std::map<std::pair<std::size_t, std::size_t>,
-                int>::const_iterator mesh_value_it = values.begin();
-      mesh_value_it != values.end(); ++mesh_value_it)
+  for (auto mesh_value_it = values.begin(); mesh_value_it != values.end();
+       ++mesh_value_it)
   {
     mesh_values.set_value(mesh_value_it->first.first,
                           mesh_value_it->first.second,
@@ -1154,8 +1219,69 @@ void HDF5File::read(MeshValueCollection<bool>& mesh_values,
 }
 //-----------------------------------------------------------------------------
 template <typename T>
-void HDF5File::write_mesh_value_collection(const MeshValueCollection<T>& mesh_values, const std::string name)
+void HDF5File::write_mesh_value_collection(const MeshValueCollection<T>& mesh_values,
+                                           const std::string name)
 {
+  dolfin_assert(_hdf5_file_id > 0);
+
+  const std::size_t dim = mesh_values.dim();
+  std::shared_ptr<const Mesh> mesh = mesh_values.mesh();
+
+  const std::map<std::pair<std::size_t, std::size_t>, T>& values
+    = mesh_values.values();
+
+  std::unique_ptr<CellType>
+    entity_type(CellType::create(mesh->type().entity_type(dim)));
+  const std::size_t num_vertices_per_entity
+    = (dim == 0) ? 1 : entity_type->num_vertices();
+
+  std::vector<std::size_t> topology;
+  std::vector<T> value_data;
+  topology.reserve(values.size()*num_vertices_per_entity);
+  value_data.reserve(values.size());
+
+  const std::size_t tdim = mesh->topology().dim();
+  mesh->init(tdim, dim);
+  for (auto &p : values)
+  {
+    MeshEntity cell = Cell(*mesh, p.first.first);
+    if (dim != tdim)
+    {
+      const unsigned int entity_local_idx = cell.entities(dim)[p.first.second];
+      cell = MeshEntity(*mesh, dim, entity_local_idx);
+    }
+    for (VertexIterator v(cell); !v.end(); ++v)
+      topology.push_back(v->global_index());
+    value_data.push_back(p.second);
+  }
+
+  const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
+  std::vector<std::int64_t> global_size(2);
+
+  global_size[0] = MPI::sum(_mpi_comm, values.size());
+  global_size[1] = num_vertices_per_entity;
+
+  // FIXME: this should throw an error, but is here because
+  // "mesh domains" call write_mesh_value_collection with empty
+  // datasets sometimes. Remove when mesh domains are removed.
+  if (global_size[0] > 0)
+  {
+    write_data(name + "/topology", topology, global_size, mpi_io);
+
+    global_size[1] = 1;
+    write_data(name + "/values", value_data, global_size, mpi_io);
+    HDF5Interface::add_attribute(_hdf5_file_id, name, "dimension",
+                                 mesh_values.dim());
+  }
+}
+//-----------------------------------------------------------------------------
+template <typename T>
+void HDF5File::write_mesh_value_collection_old(
+                    const MeshValueCollection<T>& mesh_values,
+                    const std::string name)
+{
+  dolfin_assert(_hdf5_file_id > 0);
+
   const std::map<std::pair<std::size_t, std::size_t>, T>& values
     = mesh_values.values();
 
@@ -1166,17 +1292,14 @@ void HDF5File::write_mesh_value_collection(const MeshValueCollection<T>& mesh_va
   std::vector<T> data_values;
   std::vector<std::size_t> entities;
   std::vector<std::size_t> cells;
-
-  for (typename std::map<std::pair<std::size_t, std::size_t>,
-         T>::const_iterator
-         p = values.begin(); p != values.end(); ++p)
+  for (auto p = values.begin(); p != values.end(); ++p)
   {
     cells.push_back(global_cell_index[p->first.first]);
     entities.push_back(p->first.second);
     data_values.push_back(p->second);
   }
 
-  std::vector<std::size_t> global_size(1, MPI::sum(_mpi_comm,
+  std::vector<std::int64_t> global_size(1, MPI::sum(_mpi_comm,
                                                    data_values.size()));
 
   // Only write if the global size is larger than 0
@@ -1187,7 +1310,7 @@ void HDF5File::write_mesh_value_collection(const MeshValueCollection<T>& mesh_va
     write_data(name + "/entities", entities, global_size, mpi_io);
     write_data(name + "/cells", cells, global_size, mpi_io);
 
-    HDF5Interface::add_attribute(hdf5_file_id, name, "dimension",
+    HDF5Interface::add_attribute(_hdf5_file_id, name, "dimension",
                                  mesh_values.dim());
   }
 }
@@ -1197,9 +1320,208 @@ void HDF5File::read_mesh_value_collection(MeshValueCollection<T>& mesh_vc,
                                           const std::string name) const
 {
   Timer t1("HDF5: read mesh value collection");
-  dolfin_assert(hdf5_file_open);
+  dolfin_assert(_hdf5_file_id > 0);
+
+  if (!HDF5Interface::has_group(_hdf5_file_id, name))
+  {
+    dolfin_error("HDF5File.cpp",
+                 "open MeshValueCollection dataset",
+                 "Group \"%s\" not found in file", name.c_str());
+  }
+
+  if (HDF5Interface::has_dataset(_hdf5_file_id, name + "/cells"))
+  {
+    warning("Found old MeshValueCollection format");
+    read_mesh_value_collection_old(mesh_vc, name);
+    return;
+  }
+
+  std::size_t dim = 0;
+  HDF5Interface::get_attribute(_hdf5_file_id, name, "dimension", dim);
+  std::shared_ptr<const Mesh> mesh = mesh_vc.mesh();
+  dolfin_assert(mesh);
+  std::unique_ptr<CellType>
+    entity_type(CellType::create(mesh->type().entity_type(dim)));
+  const std::size_t num_verts_per_entity = entity_type->num_entities(0);
+
+  // Reset MeshValueCollection
   mesh_vc.clear();
-  if (!HDF5Interface::has_group(hdf5_file_id, name))
+  mesh_vc.init(mesh, dim);
+
+  const std::string values_name = name + "/values";
+  const std::string topology_name = name + "/topology";
+
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, values_name))
+  {
+    dolfin_error("HDF5File.cpp",
+                 "open MeshValueCollection dataset",
+                 "Dataset \"%s\" not found in file", values_name.c_str());
+  }
+
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, topology_name))
+  {
+    dolfin_error("HDF5File.cpp",
+                 "open MeshValueCollection dataset",
+                 "Dataset \"%s\" not found in file", topology_name.c_str());
+  }
+
+  // Check both datasets have the same number of entries
+  const std::vector<std::int64_t> values_shape
+      = HDF5Interface::get_dataset_shape(_hdf5_file_id, values_name);
+  const std::vector<std::int64_t> topology_shape
+    = HDF5Interface::get_dataset_shape(_hdf5_file_id, topology_name);
+  dolfin_assert(values_shape[0] == topology_shape[0]);
+
+  // Divide range between processes
+  const std::pair<std::size_t, std::size_t> data_range
+    = MPI::local_range(_mpi_comm, values_shape[0]);
+  const std::size_t local_size = data_range.second - data_range.first;
+
+  // Read local range of values and entities
+  std::vector<T> values_data;
+  values_data.reserve(local_size);
+  HDF5Interface::read_dataset(_hdf5_file_id, values_name, data_range,
+                              values_data);
+  std::vector<std::size_t> topology_data;
+  topology_data.reserve(local_size*num_verts_per_entity);
+  HDF5Interface::read_dataset(_hdf5_file_id, topology_name, data_range,
+                              topology_data);
+
+  /// Basically need to tabulate all entities by vertex, and get their
+  /// local index, transmit them to a 'sorting' host.  Also send the
+  /// read data to the 'sorting' hosts.
+
+  // Ensure the mesh dimension is initialised
+  mesh->init(dim);
+  std::size_t global_vertex_range = mesh->size_global(0);
+  std::vector<std::size_t> v(num_verts_per_entity);
+  const std::size_t num_processes = MPI::size(_mpi_comm);
+
+  // Calculate map from entity vertices to {process, local index}
+  std::map<std::vector<std::size_t>,
+           std::vector<std::size_t>> entity_map;
+
+  std::vector<std::vector<std::size_t>> send_entities(num_processes);
+  std::vector<std::vector<std::size_t>> recv_entities(num_processes);
+
+  for (MeshEntityIterator m(*mesh, dim); !m.end(); ++m)
+  {
+    if (dim == 0)
+      v[0] = m->global_index();
+    else
+    {
+      for (VertexIterator vtx(*m); !vtx.end(); ++vtx)
+        v[vtx.pos()] = vtx->global_index();
+      std::sort(v.begin(), v.end());
+    }
+
+    std::size_t dest = MPI::index_owner(_mpi_comm,
+                                        v[0], global_vertex_range);
+    send_entities[dest].push_back(m->index());
+    send_entities[dest].insert(send_entities[dest].end(),
+                               v.begin(), v.end());
+  }
+
+  MPI::all_to_all(_mpi_comm, send_entities, recv_entities);
+
+  for (std::size_t i = 0; i != num_processes; ++i)
+  {
+    for (std::vector<std::size_t>::const_iterator it
+           = recv_entities[i].begin(); it != recv_entities[i].end();
+         it += (num_verts_per_entity + 1))
+    {
+      std::copy(it + 1, it + num_verts_per_entity + 1, v.begin());
+      auto map_it = entity_map.insert({v, {i, *it}});
+      if (!map_it.second)
+      {
+        // Entry already exists, add to it
+        map_it.first->second.push_back(i);
+        map_it.first->second.push_back(*it);
+      }
+    }
+  }
+
+  // Send data from MeshValueCollection to sorting process
+
+  std::vector<std::vector<T>> send_data(num_processes);
+  std::vector<std::vector<T>> recv_data(num_processes);
+  // Reset send/recv arrays
+  send_entities = std::vector<std::vector<std::size_t>>(num_processes);
+  recv_entities = std::vector<std::vector<std::size_t>>(num_processes);
+
+  std::size_t i = 0;
+  for (auto it = topology_data.begin(); it != topology_data.end();
+       it += num_verts_per_entity)
+  {
+    std::partial_sort_copy(it, it + num_verts_per_entity,
+                           v.begin(), v.end());
+    std::size_t dest = MPI::index_owner(_mpi_comm,
+                                        v[0], global_vertex_range);
+    send_entities[dest].insert(send_entities[dest].end(),
+                               v.begin(), v.end());
+    send_data[dest].push_back(values_data[i]);
+    ++i;
+  }
+
+  MPI::all_to_all(_mpi_comm, send_entities, recv_entities);
+  MPI::all_to_all(_mpi_comm, send_data, recv_data);
+
+  // Reset send arrays
+  send_data = std::vector<std::vector<T>>(num_processes);
+  send_entities = std::vector<std::vector<std::size_t>>(num_processes);
+
+  // Locate entity in map, and send back to data to owning processes
+  for (std::size_t i = 0; i != num_processes; ++i)
+  {
+    dolfin_assert(recv_data[i].size()*num_verts_per_entity
+                  == recv_entities[i].size());
+
+    for (std::size_t j = 0; j != recv_data[i].size(); ++j)
+    {
+      auto it = recv_entities[i].begin() + j*num_verts_per_entity;
+      std::copy(it, it + num_verts_per_entity, v.begin());
+      auto map_it = entity_map.find(v);
+
+      if (map_it == entity_map.end())
+      {
+        dolfin_error("HDF5File.cpp",
+                     "find entity in map",
+                     "Error reading MeshValueCollection");
+      }
+      for (auto p = map_it->second.begin(); p != map_it->second.end(); p += 2)
+      {
+        const std::size_t dest = *p;
+        dolfin_assert(dest < num_processes);
+        send_entities[dest].push_back(*(p + 1));
+        send_data[dest].push_back(recv_data[i][j]);
+      }
+    }
+  }
+
+  // Send to owning processes and set in MeshValueCollection
+  MPI::all_to_all(_mpi_comm, send_entities, recv_entities);
+  MPI::all_to_all(_mpi_comm, send_data, recv_data);
+
+  for (std::size_t i = 0; i != num_processes; ++i)
+  {
+    dolfin_assert(recv_entities[i].size() == recv_data[i].size());
+    for (std::size_t j = 0; j != recv_data[i].size(); ++j)
+    {
+      mesh_vc.set_value(recv_entities[i][j], recv_data[i][j]);
+    }
+  }
+
+}
+//-----------------------------------------------------------------------------
+template <typename T>
+void HDF5File::read_mesh_value_collection_old(MeshValueCollection<T>& mesh_vc,
+                                          const std::string name) const
+{
+  Timer t1("HDF5: read mesh value collection");
+  dolfin_assert(_hdf5_file_id > 0);
+
+  mesh_vc.clear();
+  if (!HDF5Interface::has_group(_hdf5_file_id, name))
   {
     dolfin_error("HDF5File.cpp",
                  "open MeshValueCollection dataset",
@@ -1207,27 +1529,27 @@ void HDF5File::read_mesh_value_collection(MeshValueCollection<T>& mesh_vc,
   }
 
   std::size_t dim = 0;
-  HDF5Interface::get_attribute(hdf5_file_id, name, "dimension", dim);
+  HDF5Interface::get_attribute(_hdf5_file_id, name, "dimension", dim);
 
   const std::string values_name = name + "/values";
   const std::string entities_name = name + "/entities";
   const std::string cells_name = name + "/cells";
 
-  if (!HDF5Interface::has_dataset(hdf5_file_id, values_name))
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, values_name))
   {
     dolfin_error("HDF5File.cpp",
                  "open MeshValueCollection dataset",
                  "Dataset \"%s\" not found in file", values_name.c_str());
   }
 
-  if (!HDF5Interface::has_dataset(hdf5_file_id, entities_name))
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, entities_name))
   {
     dolfin_error("HDF5File.cpp",
                  "open MeshValueCollection dataset",
                  "Dataset \"%s\" not found in file", entities_name.c_str());
   }
 
-  if (!HDF5Interface::has_dataset(hdf5_file_id, cells_name))
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, cells_name))
   {
     dolfin_error("HDF5File.cpp",
                  "open MeshValueCollection dataset",
@@ -1235,36 +1557,37 @@ void HDF5File::read_mesh_value_collection(MeshValueCollection<T>& mesh_vc,
   }
 
   // Check all datasets have the same size
-  const std::vector<std::size_t> values_dim
-      = HDF5Interface::get_dataset_size(hdf5_file_id, values_name);
-  const std::vector<std::size_t> entities_dim
-      = HDF5Interface::get_dataset_size(hdf5_file_id, entities_name);
-  const std::vector<std::size_t> cells_dim
-      = HDF5Interface::get_dataset_size(hdf5_file_id, cells_name);
-  dolfin_assert(values_dim[0] == entities_dim[0]);
-  dolfin_assert(values_dim[0] == cells_dim[0]);
-
-  // Check size of dataset. If small enough, just read on all processes...
+  const std::vector<std::int64_t> values_shape
+      = HDF5Interface::get_dataset_shape(_hdf5_file_id, values_name);
+  const std::vector<std::int64_t> entities_shape
+      = HDF5Interface::get_dataset_shape(_hdf5_file_id, entities_name);
+  const std::vector<std::int64_t> cells_shape
+    = HDF5Interface::get_dataset_shape(_hdf5_file_id, cells_name);
+  dolfin_assert(values_shape[0] == entities_shape[0]);
+  dolfin_assert(values_shape[0] == cells_shape[0]);
+
+  // Check size of dataset. If small enough, just read on all
+  // processes...
 
   // FIXME: optimise value
-  const std::size_t max_data_one = 1048576; // arbitrary 1M
+  const std::int64_t max_data_one = 1048576; // arbitrary 1M
 
-  if (values_dim[0] < max_data_one)
+  if (values_shape[0] < max_data_one)
   {
     // read on all processes
-    const std::pair<std::size_t, std::size_t> range(0, values_dim[0]);
+    const std::pair<std::size_t, std::size_t> range(0, values_shape[0]);
     const std::size_t local_size = range.second - range.first;
 
     std::vector<T> values_data;
     values_data.reserve(local_size);
-    HDF5Interface::read_dataset(hdf5_file_id, values_name, range, values_data);
+    HDF5Interface::read_dataset(_hdf5_file_id, values_name, range, values_data);
     std::vector<std::size_t> entities_data;
     entities_data.reserve(local_size);
-    HDF5Interface::read_dataset(hdf5_file_id, entities_name, range,
+    HDF5Interface::read_dataset(_hdf5_file_id, entities_name, range,
                                 entities_data);
     std::vector<std::size_t> cells_data;
     cells_data.reserve(local_size);
-    HDF5Interface::read_dataset(hdf5_file_id, cells_name, range, cells_data);
+    HDF5Interface::read_dataset(_hdf5_file_id, cells_name, range, cells_data);
 
     // Get global mapping to restore values
     const Mesh& mesh = *mesh_vc.mesh();
@@ -1295,24 +1618,18 @@ void HDF5File::read_mesh_value_collection(MeshValueCollection<T>& mesh_vc,
     std::vector<std::size_t>::const_iterator j = cells_data_index.begin();
     while (i!=global_cell_index.end() && j!=cells_data_index.end())
     {
-
-      // Global cell index is less than the cell_data index read from file
+      // Global cell index is less than the cell_data index read from
+      // file, if global cell index is larger than the cell_data index
+      // read from file, else global cell index is the same as the
+      // cell_data index read from file
       if (*i < cells_data[*j])
-      {
         ++i;
-      }
-
-      // Global cell index is larger than the cell_data index read from file
       else if (*i > cells_data[*j])
-      {
         ++j;
-      }
-
-      // Global cell index is the same as the cell_data index read from file
       else
       {
-        // Here we do not increment j because cells_data_index is ordered
-        // but not *strictly* ordered.
+        // Here we do not increment j because cells_data_index is
+        // ordered but not *strictly* ordered.
         std::size_t lidx = i - global_cell_index.begin();
         mvc_map[std::make_pair(lidx, entities_data[*j])] = values_data[*j];
         ++j;
@@ -1325,21 +1642,21 @@ void HDF5File::read_mesh_value_collection(MeshValueCollection<T>& mesh_vc,
 
     // Divide range between processes
     const std::pair<std::size_t, std::size_t> data_range
-      = MPI::local_range(_mpi_comm, values_dim[0]);
+      = MPI::local_range(_mpi_comm, values_shape[0]);
     const std::size_t local_size = data_range.second - data_range.first;
 
     // Read local range of values, entities and cells
     std::vector<T> values_data;
     values_data.reserve(local_size);
-    HDF5Interface::read_dataset(hdf5_file_id, values_name, data_range,
+    HDF5Interface::read_dataset(_hdf5_file_id, values_name, data_range,
                                 values_data);
     std::vector<std::size_t> entities_data;
     entities_data.reserve(local_size);
-    HDF5Interface::read_dataset(hdf5_file_id, entities_name, data_range,
+    HDF5Interface::read_dataset(_hdf5_file_id, entities_name, data_range,
                                 entities_data);
     std::vector<std::size_t> cells_data;
     cells_data.reserve(local_size);
-    HDF5Interface::read_dataset(hdf5_file_id, cells_name, data_range,
+    HDF5Interface::read_dataset(_hdf5_file_id, cells_name, data_range,
                                 cells_data);
 
     std::vector<std::pair<std::size_t, std::size_t>> cell_ownership;
@@ -1382,171 +1699,345 @@ void HDF5File::read_mesh_value_collection(MeshValueCollection<T>& mesh_vc,
           = local_values[j];
       }
     }
-
   }
 }
 //-----------------------------------------------------------------------------
-void HDF5File::read(Mesh& input_mesh, const std::string mesh_name,
+void HDF5File::read(Mesh& input_mesh, const std::string data_path,
                     bool use_partition_from_file) const
 {
-  Timer t("HDF5: read mesh");
+  dolfin_assert(_hdf5_file_id > 0);
 
-  dolfin_assert(hdf5_file_open);
-
-  const std::string topology_name = mesh_name + "/topology";
-  if (!HDF5Interface::has_dataset(hdf5_file_id, topology_name))
+  // Check that topology data set is found in HDF5 file
+  const std::string topology_path = data_path + "/topology";
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, topology_path))
   {
     dolfin_error("HDF5File.cpp",
                  "read topology dataset",
-                 "Dataset \"%s\" not found", topology_name.c_str());
+                 "Dataset \"%s\" not found", topology_path.c_str());
   }
 
-  const std::string coordinates_name = mesh_name + "/coordinates";
-  if (!HDF5Interface::has_dataset(hdf5_file_id, coordinates_name))
+  // Get topology data
+  std::string cell_type_str;
+  if (HDF5Interface::has_attribute(_hdf5_file_id, topology_path, "celltype"))
+  {
+    HDF5Interface::get_attribute(_hdf5_file_id, topology_path, "celltype",
+                                 cell_type_str);
+  }
+
+  // Create CellType from string
+  std::unique_ptr<CellType> cell_type(CellType::create(cell_type_str));
+  dolfin_assert(cell_type);
+
+  // Check that coordinate data set is found in HDF5 file
+  const std::string geometry_path = data_path + "/coordinates";
+  if (!HDF5Interface::has_dataset(_hdf5_file_id, geometry_path))
   {
     dolfin_error("HDF5File.cpp",
                  "read coordinates dataset",
-                 "Dataset \"%s\" not found", coordinates_name.c_str());
+                 "Dataset \"%s\" not found", geometry_path.c_str());
   }
 
-  // Structure to store local mesh
-  LocalMeshData mesh_data(_mpi_comm);
+  // Get dimensions of coordinate dataset
+  std::vector<std::int64_t> coords_shape
+    = HDF5Interface::get_dataset_shape(_hdf5_file_id, geometry_path);
+  dolfin_assert(coords_shape.size() < 3);
+  if (coords_shape.size() == 1)
+  {
+    dolfin_error("HDF5File.cpp",
+                 "get geometric dimension",
+                 "Cannot determine geometric dimension from one-dimensional array storage in HDF5 file");
+  }
+  else if (coords_shape.size() > 2)
+  {
+    dolfin_error("HDF5File.cpp",
+                 "get geometric dimension",
+                 "Cannot determine geometric dimension from high-rank array storage in HDF5 file");
+  }
+
+  // Extract geometric dimension
+  int gdim = coords_shape[1];
+
+  // Build mesh from data in HDF5 file
+  read(input_mesh, topology_path, geometry_path, gdim, *cell_type, -1,
+       coords_shape[0],
+       use_partition_from_file);
+}
+//-----------------------------------------------------------------------------
+void HDF5File::read(Mesh& input_mesh,
+                    const std::string topology_path,
+                    const std::string geometry_path,
+                    const int gdim, const CellType& cell_type,
+                    const std::int64_t expected_num_global_cells,
+                    const std::int64_t expected_num_global_points,
+                    bool use_partition_from_file) const
+{
+  // FIXME: This function is too big. Split up.
+
+  Timer t("HDF5: read mesh");
+  dolfin_assert(_hdf5_file_id > 0);
+
+  // Create structure to store local mesh
+  LocalMeshData local_mesh_data(_mpi_comm);
+  local_mesh_data.geometry.dim = gdim;
 
   // --- Topology ---
 
-  // Discover size of topology dataset
-  std::vector<std::size_t> topology_dim
-    = HDF5Interface::get_dataset_size(hdf5_file_id, topology_name);
+  // Get number of vertices per cell from CellType
+  const int num_vertices_per_cell = cell_type.num_entities(0);
 
-  std::string cell_type_str;
-  HDF5Interface::get_attribute(hdf5_file_id, topology_name, "celltype", cell_type_str);
+  // Set topology dim and cell type
+  local_mesh_data.topology.dim = cell_type.dim();
+  local_mesh_data.topology.cell_type = cell_type.cell_type();
+  local_mesh_data.topology.num_vertices_per_cell = num_vertices_per_cell;
 
-  std::unique_ptr<CellType> cell_type(CellType::create(cell_type_str));
+  // Discover shape of the topology data set in HDF5 file
+  std::vector<std::int64_t> topology_shape
+    = HDF5Interface::get_dataset_shape(_hdf5_file_id, topology_path);
 
-  const std::size_t num_vertices_per_cell
-    = cell_type->num_entities(0);
+  // If cell type is encoded in HDF5, then check for consistency with cell
+  // type passed into this function
+  if (HDF5Interface::has_attribute(_hdf5_file_id, topology_path, "celltype"))
+  {
+    std::string cell_type_str;
+    HDF5Interface::get_attribute(_hdf5_file_id, topology_path, "celltype",
+                                 cell_type_str);
+    if (cell_type.cell_type() != CellType:: string2type(cell_type_str))
+    {
+      dolfin_error("HDF5File.cpp",
+                   "read topology data",
+                   "Inconsistency between expected cell type and cell type attribie in HDF file");
 
-  mesh_data.tdim = cell_type->dim();
-  mesh_data.cell_type = cell_type->cell_type();
+    }
+  }
 
-  // Get total number of cells, as number of rows in topology dataset
-  const std::size_t num_global_cells = topology_dim[0];
-  mesh_data.num_global_cells = num_global_cells;
+  // Compute number of global cells (handle case that topology may be
+  // arranged a 1D or 2D array)
+  std::int64_t num_global_cells = 0;
+  if (topology_shape.size() == 1)
+  {
+    dolfin_assert(topology_shape[0] % num_vertices_per_cell == 0);
+    num_global_cells = topology_shape[0]/num_vertices_per_cell;
+  }
+  else if (topology_shape.size() == 2)
+  {
+    num_global_cells = topology_shape[0];
+    if (topology_shape[1] != num_vertices_per_cell)
+    {
+      dolfin_error("HDF5File.cpp",
+                   "read topology data",
+                   "Topology in HDF5 file has inconsistent size");
+    }
+  }
+  else
+  {
+    dolfin_error("HDF5File.cpp",
+                 "read coordinate data",
+                 "Topology in HDF5 file has wrong shape");
+  }
 
-  dolfin_assert(num_vertices_per_cell == topology_dim[1]);
-  mesh_data.num_vertices_per_cell = num_vertices_per_cell;
+  // Check number of cells (global)
+  if (expected_num_global_cells >= 0)
+  {
+    // Check number of cells for consistency with expected number of cells
+    if (num_global_cells != expected_num_global_cells)
+    {
+      dolfin_error("HDF5File.cpp",
+                   "read cell data",
+                   "Inconsistentcy between expected number of cells and number of cells in topology in HDF5 file");
+    }
+  }
 
-  // Get partition from file
-  std::vector<std::size_t> partitions;
-  HDF5Interface::get_attribute(hdf5_file_id, topology_name, "partition",
-                               partitions);
+  // Set number of cells (global)
+  local_mesh_data.topology.num_global_cells = num_global_cells;
 
+  // FIXME: 'partition' is a poor descriptor
+  // Get partition from file, if available
+  std::vector<std::size_t> cell_partitions;
+  if (HDF5Interface::has_attribute(_hdf5_file_id, topology_path, "partition"))
+  {
+    HDF5Interface::get_attribute(_hdf5_file_id, topology_path, "partition",
+                                 cell_partitions);
+  }
+
+  // Prepare range of cells to read on this process
   std::pair<std::size_t, std::size_t> cell_range;
 
   // Check whether number of MPI processes matches partitioning, and
   // restore if possible
-  if (MPI::size(_mpi_comm) == partitions.size())
+  if (dolfin::MPI::size(_mpi_comm) == cell_partitions.size())
   {
-    partitions.push_back(num_global_cells);
+    cell_partitions.push_back(num_global_cells);
     const std::size_t proc = MPI::rank(_mpi_comm);
-    cell_range = std::make_pair(partitions[proc], partitions[proc + 1]);
+    cell_range = std::make_pair(cell_partitions[proc], cell_partitions[proc + 1]);
 
     // Restore partitioning if requested
     if (use_partition_from_file)
     {
-      mesh_data.cell_partition
-        = std::vector<std::size_t>(cell_range.second - cell_range.first, proc);
+      local_mesh_data.topology.cell_partition
+        = std::vector<int>(cell_range.second - cell_range.first, proc);
     }
   }
   else
   {
     if (use_partition_from_file)
       warning("Could not use partition from file: wrong size");
-    // Divide up cells ~equally between processes
+
+    // Divide up cells approximately equally between processes
     cell_range = MPI::local_range(_mpi_comm, num_global_cells);
   }
 
-  const std::size_t num_local_cells = cell_range.second - cell_range.first;
+  // Get number of cells to read on this process
+  const int num_local_cells = cell_range.second - cell_range.first;
+
+  // Modify range of array to read for flat HDF5 storage
+  std::pair<std::size_t, std::size_t> cell_data_range = cell_range;
+  if (topology_shape.size() == 1)
+  {
+    cell_data_range.first *= num_vertices_per_cell;
+    cell_data_range.second *= num_vertices_per_cell;
+  }
 
   // Read a block of cells
-  std::vector<std::size_t> topology_data;
+  std::vector<std::int64_t> topology_data;
   topology_data.reserve(num_local_cells*num_vertices_per_cell);
-  HDF5Interface::read_dataset(hdf5_file_id, topology_name, cell_range,
+  HDF5Interface::read_dataset(_hdf5_file_id, topology_path, cell_data_range,
                               topology_data);
 
+  // FIXME: explain this more clearly.
+  // Reconstruct mesh_name from topology_name - needed for
+  // cell_indices and domains
+  std::string mesh_name = topology_path.substr(0, topology_path.rfind("/"));
+
+  // FIXME: Imrpove comment - it's unclear this is about
   // Look for cell indices in dataset, and use if available
-  mesh_data.global_cell_indices.reserve(num_local_cells);
+  std::vector<std::int64_t>& global_cell_indices = local_mesh_data.topology.global_cell_indices;
+  global_cell_indices.clear();
   const std::string cell_indices_name = mesh_name + "/cell_indices";
-  if (HDF5Interface::has_dataset(hdf5_file_id, cell_indices_name))
+  if (HDF5Interface::has_dataset(_hdf5_file_id, cell_indices_name))
   {
-    HDF5Interface::read_dataset(hdf5_file_id, cell_indices_name,
-                                cell_range, mesh_data.global_cell_indices);
+    global_cell_indices.reserve(num_local_cells);
+    HDF5Interface::read_dataset(_hdf5_file_id, cell_indices_name,
+                                cell_range, global_cell_indices);
   }
   else
   {
-    for (std::size_t i = 0; i < num_local_cells; i++)
-      mesh_data.global_cell_indices.push_back(cell_range.first + i);
+    global_cell_indices.resize(num_local_cells);
+    std::iota(global_cell_indices.begin(), global_cell_indices.end(),
+              cell_range.first);
   }
 
+  // FIXME: allocate multi_array data and pass to HDFr read function
+  // to avoid copy
   // Copy to boost::multi_array
-  mesh_data.cell_vertices.resize(boost::extents[num_local_cells][num_vertices_per_cell]);
-  boost::multi_array_ref<std::size_t, 2>
-    topo_data_array(topology_data.data(), boost::extents[num_local_cells][num_vertices_per_cell]);
-
-  // Remap vertices to DOLFIN ordering from VTK/XDMF
-  std::vector<unsigned int> perm = cell_type->vtk_mapping();
-
-  for (std::size_t i = 0; i != num_local_cells; ++i)
-    for (std::size_t j = 0; j != num_vertices_per_cell; ++j)
-      mesh_data.cell_vertices[i][j] = topo_data_array[i][perm[j]];
+  local_mesh_data.topology.cell_vertices.resize(boost::extents[num_local_cells][num_vertices_per_cell]);
+  boost::multi_array_ref<std::int64_t, 2>
+    topology_data_array(topology_data.data(),
+                        boost::extents[num_local_cells][num_vertices_per_cell]);
+
+  // Remap vertices to DOLFIN ordering from VTK/XDMF ordering
+  const std::vector<std::int8_t> perm = cell_type.vtk_mapping();
+  for (int i = 0; i != num_local_cells; ++i)
+  {
+    for (int j = 0; j != num_vertices_per_cell; ++j)
+      local_mesh_data.topology.cell_vertices[i][j] = topology_data_array[i][perm[j]];
+  }
 
   // --- Coordinates ---
+
   // Get dimensions of coordinate dataset
-  std::vector<std::size_t> coords_dim
-    = HDF5Interface::get_dataset_size(hdf5_file_id, coordinates_name);
-  mesh_data.num_global_vertices = coords_dim[0];
-  mesh_data.gdim = coords_dim[1];
-
-  // Divide range into equal blocks for each process
-  const std::pair<std::size_t, std::size_t> vertex_range
-    = MPI::local_range(_mpi_comm, mesh_data.num_global_vertices);
+  std::vector<std::int64_t> coords_shape
+    = HDF5Interface::get_dataset_shape(_hdf5_file_id, geometry_path);
+
+  // Compute number of vertcies
+  if (coords_shape.size() == 1)
+  {
+    dolfin_assert(coords_shape[0] % gdim == 0);
+    local_mesh_data.geometry.num_global_vertices = coords_shape[0]/gdim;
+  }
+  else if (coords_shape.size() == 2)
+  {
+    dolfin_assert((int) coords_shape[1] == gdim);
+    local_mesh_data.geometry.num_global_vertices = coords_shape[0];
+  }
+  else
+  {
+    dolfin_error("HDF5File.cpp",
+                 "read coordinate data",
+                 "Topology in HDF5 file has wrong shape");
+  }
+
+  // Check number of vertices (global) against expected number
+  if (expected_num_global_points >= 0)
+  {
+    // Check number of cells for consistency with expected number of cells
+    if (local_mesh_data.geometry.num_global_vertices != expected_num_global_points)
+    {
+      dolfin_error("HDF5File.cpp",
+                   "read vertex data",
+                   "Inconsistentcy between expected number of vertices and number of vertices in geometry in HDF5 file");
+    }
+  }
+
+  // Divide point range into equal blocks for each process
+  std::pair<std::size_t, std::size_t> vertex_range
+    = MPI::local_range(_mpi_comm, local_mesh_data.geometry.num_global_vertices);
   const std::size_t num_local_vertices
     = vertex_range.second - vertex_range.first;
 
-  // Read vertex data to temporary vector
-  std::vector<double> coordinates_data;
-  coordinates_data.reserve(num_local_vertices*mesh_data.gdim);
-  HDF5Interface::read_dataset(hdf5_file_id, coordinates_name, vertex_range,
-                              coordinates_data);
+  // Modify vertex data range for flat storage
+  std::pair<std::size_t, std::size_t> vertex_data_range = vertex_range;
+  if (coords_shape.size() == 1)
+  {
+    vertex_data_range.first *= gdim;
+    vertex_data_range.second *= gdim;
+  }
 
-  // Copy to boost::multi_array
-  mesh_data.vertex_coordinates.resize(boost::extents[num_local_vertices][mesh_data.gdim]);
-  std::copy(coordinates_data.begin(), coordinates_data.end(),
-            mesh_data.vertex_coordinates.data());
+  // Read vertex data to temporary vector
+  {
+    std::vector<double> coordinates_data;
+    coordinates_data.reserve(num_local_vertices*gdim);
+    HDF5Interface::read_dataset(_hdf5_file_id, geometry_path, vertex_data_range,
+                                coordinates_data);
+
+    // Copy to boost::multi_array
+    local_mesh_data.geometry.vertex_coordinates.resize(boost::extents[num_local_vertices][gdim]);
+    std::copy(coordinates_data.begin(), coordinates_data.end(),
+              local_mesh_data.geometry.vertex_coordinates.data());
+  }
 
+  // FIXME: explain this better - comment is cryptic
   // Fill vertex indices with values - not used in build_distributed_mesh
-  mesh_data.vertex_indices.resize(num_local_vertices);
-  for (std::size_t i = 0; i < mesh_data.vertex_coordinates.size(); ++i)
-    mesh_data.vertex_indices[i] = vertex_range.first + i;
+  local_mesh_data.geometry.vertex_indices.resize(num_local_vertices);
+  for (std::size_t i = 0; i < local_mesh_data.geometry.vertex_coordinates.size(); ++i)
+  {
+    dolfin_assert(i < local_mesh_data.geometry.vertex_indices.size());
+    local_mesh_data.geometry.vertex_indices[i] = vertex_range.first + i;
+  }
 
   t.stop();
 
   // Build distributed mesh
+  // FIXME: Why is the mesh built int HDF5Utility? This should be in
+  // the mesh code.
   if (MPI::size(_mpi_comm) == 1)
-    HDF5Utility::build_local_mesh(input_mesh, mesh_data);
+    HDF5Utility::build_local_mesh(input_mesh, local_mesh_data);
   else
-    MeshPartitioning::build_distributed_mesh(input_mesh, mesh_data);
+  {
+    const std::string ghost_mode = dolfin::parameters["ghost_mode"];
+    MeshPartitioning::build_distributed_mesh(input_mesh, local_mesh_data, ghost_mode);
+  }
 
   // ---- Markers ----
+
   // Check if we have any domains
   for (std::size_t d = 0; d <= input_mesh.topology().dim(); ++d)
   {
-    const std::string marker_dataset = mesh_name + "/domain_"
-      + std::to_string(d);
+    const std::string marker_dataset = mesh_name + "/domain_" + std::to_string(d);
     if (!has_dataset(marker_dataset))
       continue;
 
-    MeshValueCollection<std::size_t> mvc(input_mesh, d);
+    auto _mesh = reference_to_no_delete_pointer(input_mesh);
+    MeshValueCollection<std::size_t> mvc(_mesh, d);
     read_mesh_value_collection(mvc, marker_dataset);
 
     // Get mesh value collection data
@@ -1556,12 +2047,10 @@ void HDF5File::read(Mesh& input_mesh, const std::string mesh_name,
     // Get mesh domain data and fill
     std::map<std::size_t, std::size_t>& markers
       = input_mesh.domains().markers(d);
-    std::map<std::pair<std::size_t, std::size_t>,
-             std::size_t>::const_iterator entry;
     if (d != input_mesh.topology().dim())
     {
       input_mesh.init(d);
-      for (entry = values.begin(); entry != values.end(); ++entry)
+      for (auto entry = values.begin(); entry != values.end(); ++entry)
       {
         const Cell cell(input_mesh, entry->first.first);
         const std::size_t entity_index
@@ -1572,27 +2061,29 @@ void HDF5File::read(Mesh& input_mesh, const std::string mesh_name,
     else
     {
       // Special case for cells
-      for (entry = values.begin(); entry != values.end(); ++entry)
+      for (auto entry = values.begin(); entry != values.end(); ++entry)
         markers[entry->first.first] = entry->second;
     }
   }
-
 }
 //-----------------------------------------------------------------------------
 bool HDF5File::has_dataset(const std::string dataset_name) const
 {
-  dolfin_assert(hdf5_file_open);
-  return HDF5Interface::has_dataset(hdf5_file_id, dataset_name);
+  dolfin_assert(_hdf5_file_id > 0);
+  return HDF5Interface::has_dataset(_hdf5_file_id, dataset_name);
 }
 //-----------------------------------------------------------------------------
 HDF5Attribute HDF5File::attributes(const std::string dataset_name)
 {
-  dolfin_assert(hdf5_file_open);
+  dolfin_assert(_hdf5_file_id > 0);
   if (!has_dataset(dataset_name))
+  {
     dolfin_error("HDF5File.cpp",
                  "accessing attributes",
                  "Dataset \"%s\" not found", dataset_name.c_str());
-  return HDF5Attribute(hdf5_file_id, dataset_name);
+  }
+
+  return HDF5Attribute(_hdf5_file_id, dataset_name);
 }
 //-----------------------------------------------------------------------------
 
diff --git a/dolfin/io/HDF5File.h b/dolfin/io/HDF5File.h
index 0e31620..b2ff2f3 100644
--- a/dolfin/io/HDF5File.h
+++ b/dolfin/io/HDF5File.h
@@ -35,6 +35,7 @@
 namespace dolfin
 {
 
+  class CellType;
   class Function;
   class GenericVector;
   class LocalMeshData;
@@ -45,6 +46,7 @@ namespace dolfin
 
   class HDF5File : public Variable
   {
+
   public:
 
     /// Constructor. file_mode should "a" (append), "w" (write) or "r"
@@ -58,6 +60,9 @@ namespace dolfin
     /// Close file
     void close();
 
+    /// Flush buffered I/O to disk
+    void flush();
+
     /// Write points to file
     void write(const std::vector<Point>& points, const std::string name);
 
@@ -86,18 +91,37 @@ namespace dolfin
     /// Write Function to file with a timestamp
     void write(const Function& u, const std::string name, double timestamp);
 
-    /// Read Function from file and distribute data according to
-    /// the Mesh and dofmap associated with the Function.
-    /// If the 'name' refers to a HDF5 group, then it is assumed
-    /// that the Function data is stored in the datasets within that group.
-    /// If the 'name' refers to a HDF5 dataset within a group, then
-    /// it is assumed that it is a Vector, and the Function will be filled from
-    /// that Vector
+    /// Read Function from file and distribute data according to the
+    /// Mesh and dofmap associated with the Function.  If the 'name'
+    /// refers to a HDF5 group, then it is assumed that the Function
+    /// data is stored in the datasets within that group.  If the
+    /// 'name' refers to a HDF5 dataset within a group, then it is
+    /// assumed that it is a Vector, and the Function will be filled
+    /// from that Vector
     void read(Function& u, const std::string name);
 
-    /// Read Mesh from file and optionally re-use any partition data
-    /// in the file
-    void read(Mesh& mesh, const std::string name,
+    /// Read Mesh from file, using attribute data (e.g., cell type) stored
+    /// in the HDF5 file. Optionally re-use any partition data
+    /// in the file. This function requires all necessary data for
+    /// constructing a Mesh to be present in the HDF5 file.
+    void read(Mesh& mesh, const std::string data_path,
+              bool use_partition_from_file) const;
+
+    /// Construct Mesh with paths to topology and geometry datasets, and
+    /// providing essential meta-data, e.g. geometric dimension and
+    /// cell type. If this data is available in the HDF5 file, it will
+    /// be checked for consistency. Set expected_num_global_cells to a
+    /// negative value if not known.
+    ///
+    /// This function is typically called when using the XDMF format,
+    /// in which case the meta data has alreayd been read from an XML
+    /// file
+    void read(Mesh& input_mesh,
+              const std::string topology_path,
+              const std::string geometry_path,
+              const int gdim , const CellType& cell_type,
+              const std::int64_t expected_num_global_cells,
+              const std::int64_t expected_num_global_points,
               bool use_partition_from_file) const;
 
     /// Write MeshFunction to file in a format suitable for re-reading
@@ -158,8 +182,8 @@ namespace dolfin
     // Get/set attributes of an existing dataset
     HDF5Attribute attributes(const std::string dataset_name);
 
-    /// Flush buffered I/O to disk
-    void flush();
+    hid_t h5_id() const
+    { return _hdf5_file_id; }
 
   private:
 
@@ -177,7 +201,13 @@ namespace dolfin
     void read_mesh_function(MeshFunction<T>& meshfunction,
                             const std::string name) const;
 
-    // Write a MeshValueCollection to file
+    // Write a MeshValueCollection to file (old format)
+    template <typename T>
+    void write_mesh_value_collection_old(
+                                     const MeshValueCollection<T>& mesh_values,
+                                     const std::string name);
+
+    // Write a MeshValueCollection to file (new version using vertex indices)
     template <typename T>
     void write_mesh_value_collection(const MeshValueCollection<T>& mesh_values,
                                      const std::string name);
@@ -187,17 +217,21 @@ namespace dolfin
     void read_mesh_value_collection(MeshValueCollection<T>& mesh_values,
                                     const std::string name) const;
 
+    // Read a MeshValueCollection (old format)
+    template <typename T>
+    void read_mesh_value_collection_old(MeshValueCollection<T>& mesh_values,
+                                    const std::string name) const;
+
     // Write contiguous data to HDF5 data set. Data is flattened into
     // a 1D array, e.g. [x0, y0, z0, x1, y1, z1] for a vector in 3D
     template <typename T>
     void write_data(const std::string dataset_name,
                     const std::vector<T>& data,
-                    const std::vector<std::size_t> global_size,
+                    const std::vector<std::int64_t> global_size,
                     bool use_mpi_io);
 
     // HDF5 file descriptor/handle
-    bool hdf5_file_open;
-    hid_t hdf5_file_id;
+    hid_t _hdf5_file_id;
 
     // MPI communicator
     MPI_Comm _mpi_comm;
@@ -208,10 +242,10 @@ namespace dolfin
   template <typename T>
   void HDF5File::write_data(const std::string dataset_name,
                             const std::vector<T>& data,
-                            const std::vector<std::size_t> global_size,
+                            const std::vector<std::int64_t> global_size,
                             bool use_mpi_io)
   {
-    dolfin_assert(hdf5_file_open);
+    dolfin_assert(_hdf5_file_id > 0);
     dolfin_assert(global_size.size() > 0);
 
     // Get number of 'items'
@@ -233,7 +267,7 @@ namespace dolfin
     if (dset_name[0] != '/')
       dset_name = "/" + dataset_name;
 
-    HDF5Interface::write_dataset(hdf5_file_id, dset_name, data,
+    HDF5Interface::write_dataset(_hdf5_file_id, dset_name, data,
                                  range, global_size, use_mpi_io, chunking);
   }
   //---------------------------------------------------------------------------
diff --git a/dolfin/io/HDF5Interface.cpp b/dolfin/io/HDF5Interface.cpp
index 8b1857a..4122198 100644
--- a/dolfin/io/HDF5Interface.cpp
+++ b/dolfin/io/HDF5Interface.cpp
@@ -69,7 +69,7 @@ hid_t HDF5Interface::open_file(MPI_Comm mpi_comm, const std::string filename,
     {
       dolfin_error("HDF5Interface.cpp",
                    "open HDF5 file",
-                   "File does not exist");
+                   "File \"%s\" does not exist", filename.c_str());
     }
 
     if (mode == "a")
@@ -108,15 +108,31 @@ void HDF5Interface::flush_file(const hid_t hdf5_file_handle)
   dolfin_assert(status != HDF5_FAIL);
 }
 //-----------------------------------------------------------------------------
+std::string HDF5Interface::get_filename(hid_t hdf5_file_handle)
+{
+  // Get length of filename
+  ssize_t length = H5Fget_name(hdf5_file_handle, NULL, 0);
+  dolfin_assert(length > 0);
+
+  // Allocate memory
+  std::vector<char> name(length +1);
+
+  // Retrive filename
+  length = H5Fget_name(hdf5_file_handle, name.data(), length + 1);
+  dolfin_assert(length > 0);
+
+  return std::string(name.begin(), name.end());
+}
+//-----------------------------------------------------------------------------
 const std::string HDF5Interface::get_attribute_type(
                   const hid_t hdf5_file_handle,
-                  const std::string dataset_name,
+                  const std::string dataset_path,
                   const std::string attribute_name)
 {
   herr_t status;
 
   // Open dataset or group by name
-  const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_name.c_str(),
+  const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_path.c_str(),
                                 H5P_DEFAULT);
   dolfin_assert(dset_id != HDF5_FAIL);
 
@@ -171,13 +187,13 @@ const std::string HDF5Interface::get_attribute_type(
 }
 //-----------------------------------------------------------------------------
 void HDF5Interface::delete_attribute(const hid_t hdf5_file_handle,
-                                     const std::string dataset_name,
+                                     const std::string dataset_path,
                                      const std::string attribute_name)
 {
   herr_t status;
 
   // Open dataset or group by name
-  const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_name.c_str(),
+  const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_path.c_str(),
                                 H5P_DEFAULT);
   dolfin_assert(dset_id != HDF5_FAIL);
 
@@ -203,15 +219,14 @@ herr_t HDF5Interface::attribute_iteration_function(hid_t loc_id,
 //-----------------------------------------------------------------------------
 const std::vector<std::string>
 HDF5Interface::list_attributes(const hid_t hdf5_file_handle,
-                               const std::string dataset_name)
+                               const std::string dataset_path)
 {
   // Open dataset or group by name
-  const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_name.c_str(),
+  const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_path.c_str(),
                                 H5P_DEFAULT);
   dolfin_assert(dset_id != HDF5_FAIL);
 
   hsize_t n = 0;
-
   std::vector<std::string> out_string;
   herr_t status = H5Aiterate2(dset_id, H5_INDEX_NAME, H5_ITER_INC, &n,
                               attribute_iteration_function,
@@ -226,14 +241,14 @@ HDF5Interface::list_attributes(const hid_t hdf5_file_handle,
 }
 //-----------------------------------------------------------------------------
 bool HDF5Interface::has_attribute(const hid_t hdf5_file_handle,
-                                  const std::string dataset_name,
+                                  const std::string dataset_path,
                                   const std::string attribute_name)
 {
   herr_t status;
   htri_t has_attr;
 
   // Open dataset or group by name
-  const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_name.c_str(),
+  const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_path.c_str(),
                                 H5P_DEFAULT);
   dolfin_assert(dset_id != HDF5_FAIL);
 
@@ -275,10 +290,10 @@ bool HDF5Interface::has_group(const hid_t hdf5_file_handle,
 }
 //-----------------------------------------------------------------------------
 bool HDF5Interface::has_dataset(const hid_t hdf5_file_handle,
-                                const std::string dataset_name)
+                                const std::string dataset_path)
 {
   hid_t lapl_id = H5Pcreate(H5P_LINK_ACCESS);
-  htri_t link_status = H5Lexists(hdf5_file_handle, dataset_name.c_str(), lapl_id);
+  htri_t link_status = H5Lexists(hdf5_file_handle, dataset_path.c_str(), lapl_id);
   dolfin_assert(link_status >= 0);
 
   // Close link access properties
@@ -321,11 +336,11 @@ void HDF5Interface::add_group(const hid_t hdf5_file_handle,
   }
 }
 //-----------------------------------------------------------------------------
-std::size_t HDF5Interface::dataset_rank(const hid_t hdf5_file_handle,
-                                        const std::string dataset_name)
+int HDF5Interface::dataset_rank(const hid_t hdf5_file_handle,
+                                const std::string dataset_path)
 {
   // Open dataset
-  const hid_t dset_id = H5Dopen2(hdf5_file_handle, dataset_name.c_str(),
+  const hid_t dset_id = H5Dopen2(hdf5_file_handle, dataset_path.c_str(),
                                  H5P_DEFAULT);
   dolfin_assert(dset_id != HDF5_FAIL);
 
@@ -346,12 +361,12 @@ std::size_t HDF5Interface::dataset_rank(const hid_t hdf5_file_handle,
   return rank;
 }
 //-----------------------------------------------------------------------------
-std::vector<std::size_t>
-HDF5Interface::get_dataset_size(const hid_t hdf5_file_handle,
-                                const std::string dataset_name)
+std::vector<std::int64_t>
+HDF5Interface::get_dataset_shape(const hid_t hdf5_file_handle,
+                                 const std::string dataset_path)
 {
   // Open named dataset
-  const hid_t dset_id = H5Dopen2(hdf5_file_handle, dataset_name.c_str(),
+  const hid_t dset_id = H5Dopen2(hdf5_file_handle, dataset_path.c_str(),
                                  H5P_DEFAULT);
   dolfin_assert(dset_id != HDF5_FAIL);
 
@@ -375,11 +390,11 @@ HDF5Interface::get_dataset_size(const hid_t hdf5_file_handle,
   status = H5Dclose(dset_id);
   dolfin_assert(status != HDF5_FAIL);
 
-  return std::vector<std::size_t>(size.begin(), size.end());
+  return std::vector<std::int64_t>(size.begin(), size.end());
 }
 //-----------------------------------------------------------------------------
-std::size_t HDF5Interface::num_datasets_in_group(const hid_t hdf5_file_handle,
-                                                 const std::string group_name)
+int HDF5Interface::num_datasets_in_group(const hid_t hdf5_file_handle,
+                                         const std::string group_name)
 {
   // Get group info by name
   H5G_info_t group_info;
diff --git a/dolfin/io/HDF5Interface.h b/dolfin/io/HDF5Interface.h
index f333672..5527e44 100644
--- a/dolfin/io/HDF5Interface.h
+++ b/dolfin/io/HDF5Interface.h
@@ -22,6 +22,7 @@
 
 #ifdef HAS_HDF5
 
+#include <cstdint>
 #include <vector>
 #include <string>
 
@@ -56,6 +57,8 @@ namespace dolfin
     /// interruption
     static void flush_file(const hid_t hdf5_file_handle);
 
+    static std::string get_filename(hid_t hdf5_file_handle);
+
     /// Write data to existing HDF file as defined by range blocks on
     /// each process
     /// data: data to be written, flattened into 1D vector
@@ -65,19 +68,20 @@ namespace dolfin
     /// use_chunking: whether using chunking or not
     template <typename T>
     static void write_dataset(const hid_t file_handle,
-                              const std::string dataset_name,
+                              const std::string dataset_path,
                               const std::vector<T>& data,
-                              const std::pair<std::size_t, std::size_t> range,
-                              const std::vector<std::size_t> global_size,
+                              const std::pair<std::int64_t, std::int64_t> range,
+                              const std::vector<std::int64_t> global_size,
                               bool use_mpio, bool use_chunking);
 
-    /// Read data from a HDF5 dataset "dataset_name" as defined by
+    /// Read data from a HDF5 dataset "dataset_path" as defined by
     /// range blocks on each process range: the local range on this
-    /// processor data: a flattened 1D array of values
+    /// processor data: a flattened 1D array of values. If range = {-1, -1},
+    /// then all data is read on this process.
     template <typename T>
     static void read_dataset(const hid_t file_handle,
-                             const std::string dataset_name,
-                             const std::pair<std::size_t, std::size_t> range,
+                             const std::string dataset_path,
+                             const std::pair<std::int64_t, std::int64_t> range,
                              std::vector<T>& data);
 
     /// Check for existence of group in HDF5 file
@@ -86,24 +90,24 @@ namespace dolfin
 
     /// Check for existence of dataset in HDF5 file
     static bool has_dataset(const hid_t hdf5_file_handle,
-                            const std::string dataset_name);
+                            const std::string dataset_path);
 
     /// Add group to HDF5 file
     static void add_group(const hid_t hdf5_file_handle,
-                          const std::string dataset_name);
+                          const std::string dataset_path);
 
     /// Get dataset rank
-    static std::size_t dataset_rank(const hid_t hdf5_file_handle,
-                                    const std::string dataset_name);
+    static int dataset_rank(const hid_t hdf5_file_handle,
+                            const std::string dataset_path);
 
     /// Return number of data sets in a group
-    static std::size_t num_datasets_in_group(const hid_t hdf5_file_handle,
-                                             const std::string group_name);
+    static int num_datasets_in_group(const hid_t hdf5_file_handle,
+                                     const std::string group_name);
 
-    /// Get dataset size (size of each dimension)
-    static std::vector<std::size_t>
-      get_dataset_size(const hid_t hdf5_file_handle,
-                       const std::string dataset_name);
+    /// Get dataset shape (size of each dimension)
+    static std::vector<std::int64_t>
+    get_dataset_shape(const hid_t hdf5_file_handle,
+                      const std::string dataset_path);
 
     /// Return list all datasets in named group of file
     static std::vector<std::string> dataset_list(const hid_t hdf5_file_handle,
@@ -111,38 +115,38 @@ namespace dolfin
 
     /// Get type of attribute
     static const std::string
-      get_attribute_type(const hid_t hdf5_file_handle,
-                         const std::string dataset_name,
-                         const std::string attribute_name);
+    get_attribute_type(const hid_t hdf5_file_handle,
+                       const std::string dataset_path,
+                       const std::string attribute_name);
 
     /// Get a named attribute of a dataset of known type
     template <typename T>
     static void get_attribute(const hid_t hdf5_file_handle,
-                              const std::string dataset_name,
+                              const std::string dataset_path,
                               const std::string attribute_name,
                               T& attribute_value);
 
     /// Add attribute to dataset or group
     template <typename T>
     static void add_attribute(const hid_t hdf5_file_handle,
-                              const std::string dataset_name,
+                              const std::string dataset_path,
                               const std::string attribute_name,
                               const T& attribute_value);
 
     /// Delete an attribute from a dataset or group
     static void delete_attribute(const hid_t hdf5_file_handle,
-                                 const std::string dataset_name,
+                                 const std::string dataset_path,
                                  const std::string attribute_name);
 
     /// Check if an attribute exists on a dataset or group
     static bool has_attribute(const hid_t hdf5_file_handle,
-                              const std::string dataset_name,
+                              const std::string dataset_path,
                               const std::string attribute_name);
 
     // List attributes of dataset or group
     static const std::vector<std::string>
-      list_attributes(const hid_t hdf5_file_handle,
-                      const std::string dataset_name);
+    list_attributes(const hid_t hdf5_file_handle,
+                    const std::string dataset_path);
 
   private:
 
@@ -152,28 +156,28 @@ namespace dolfin
                                                void* str);
 
     template <typename T>
-      static void add_attribute_value(const hid_t dset_id,
-                                      const std::string attribute_name,
-                                      const T& attribute_value);
+    static void add_attribute_value(const hid_t dset_id,
+                                    const std::string attribute_name,
+                                    const T& attribute_value);
 
     template <typename T>
-      static void add_attribute_value(const hid_t dset_id,
-                                      const std::string attribute_name,
-                                      const std::vector<T>& attribute_value);
+    static void add_attribute_value(const hid_t dset_id,
+                                    const std::string attribute_name,
+                                    const std::vector<T>& attribute_value);
 
     template <typename T>
-      static void get_attribute_value(const hid_t attr_type,
-                                      const hid_t attr_id,
-                                      T& attribute_value);
+    static void get_attribute_value(const hid_t attr_type,
+                                    const hid_t attr_id,
+                                    T& attribute_value);
 
     template <typename T>
-      static void get_attribute_value(const hid_t attr_type,
-                                      const hid_t attr_id,
-                                      std::vector<T>& attribute_value);
+    static void get_attribute_value(const hid_t attr_type,
+                                    const hid_t attr_id,
+                                    std::vector<T>& attribute_value);
 
     // Return HDF5 data type
     template <typename T>
-      static hid_t hdf5_type()
+    static hid_t hdf5_type()
     {
       dolfin_error("HDF5Interface.cpp",
                    "get HDF5 primitive data type",
@@ -184,12 +188,18 @@ namespace dolfin
   };
 
   //---------------------------------------------------------------------------
+  template <> inline hid_t HDF5Interface::hdf5_type<float>()
+  { return H5T_NATIVE_FLOAT; }
+  //---------------------------------------------------------------------------
   template <> inline hid_t HDF5Interface::hdf5_type<double>()
   { return H5T_NATIVE_DOUBLE; }
   //---------------------------------------------------------------------------
   template <> inline hid_t HDF5Interface::hdf5_type<int>()
   { return H5T_NATIVE_INT; }
   //---------------------------------------------------------------------------
+  template <> inline hid_t HDF5Interface::hdf5_type<std::int64_t>()
+  { return H5T_NATIVE_INT64; }
+  //---------------------------------------------------------------------------
   template <> inline hid_t HDF5Interface::hdf5_type<std::size_t>()
   {
     if (sizeof(std::size_t) == sizeof(unsigned long))
@@ -203,17 +213,14 @@ namespace dolfin
     return 0;
   }
   //---------------------------------------------------------------------------
-  template <> inline hid_t HDF5Interface::hdf5_type<int64_t>()
-  { return H5T_NATIVE_INT64; }
-  //---------------------------------------------------------------------------
   template <typename T>
   inline void
-    HDF5Interface::write_dataset(const hid_t file_handle,
-                                 const std::string dataset_name,
-                                 const std::vector<T>& data,
-                                 const std::pair<std::size_t,std::size_t> range,
-                                 const std::vector<std::size_t> global_size,
-                                 bool use_mpi_io, bool use_chunking)
+  HDF5Interface::write_dataset(const hid_t file_handle,
+                               const std::string dataset_path,
+                               const std::vector<T>& data,
+                               const std::pair<std::int64_t, std::int64_t> range,
+                               const std::vector<int64_t> global_size,
+                               bool use_mpi_io, bool use_chunking)
   {
     // Data rank
     const std::size_t rank = global_size.size();
@@ -266,11 +273,11 @@ namespace dolfin
       chunking_properties = H5P_DEFAULT;
 
     // Check that group exists and recursively create if required
-    const std::string group_name(dataset_name, 0, dataset_name.rfind('/'));
+    const std::string group_name(dataset_path, 0, dataset_path.rfind('/'));
     add_group(file_handle, group_name);
 
-    // Create global dataset (using dataset_name)
-    const hid_t dset_id = H5Dcreate2(file_handle, dataset_name.c_str(), h5type,
+    // Create global dataset (using dataset_path)
+    const hid_t dset_id = H5Dcreate2(file_handle, dataset_path.c_str(), h5type,
                                      filespace0, H5P_DEFAULT,
                                      chunking_properties, H5P_DEFAULT);
     dolfin_assert(dset_id != HDF5_FAIL);
@@ -328,13 +335,13 @@ namespace dolfin
   //---------------------------------------------------------------------------
   template <typename T>
   inline void
-    HDF5Interface::read_dataset(const hid_t file_handle,
-                                const std::string dataset_name,
-                                const std::pair<std::size_t, std::size_t> range,
-                                std::vector<T>& data)
+  HDF5Interface::read_dataset(const hid_t file_handle,
+                              const std::string dataset_path,
+                              const std::pair<std::int64_t, std::int64_t> range,
+                              std::vector<T>& data)
   {
     // Open the dataset
-    const hid_t dset_id = H5Dopen2(file_handle, dataset_name.c_str(),
+    const hid_t dset_id = H5Dopen2(file_handle, dataset_path.c_str(),
                                    H5P_DEFAULT);
     dolfin_assert(dset_id != HDF5_FAIL);
 
@@ -349,19 +356,23 @@ namespace dolfin
     if (rank > 2)
       warning("HDF5Interface::read_dataset untested for rank > 2.");
 
-    // Allocate data for size of each dimension
-    std::vector<hsize_t> dimensions_size(rank);
+    // Allocate data for shape
+    std::vector<hsize_t> shape(rank);
 
     // Get size in each dimension
-    const int ndims = H5Sget_simple_extent_dims(dataspace,
-                                                dimensions_size.data(), NULL);
+    const int ndims = H5Sget_simple_extent_dims(dataspace, shape.data(), NULL);
     dolfin_assert(ndims == rank);
 
     // Hyperslab selection
     std::vector<hsize_t> offset(rank, 0);
-    offset[0]= range.first;
-    std::vector<hsize_t> count(dimensions_size);
-    count[0] = range.second - range.first;
+    std::vector<hsize_t> count = shape;
+    if (range.first != -1 and range.second != -1)
+    {
+      offset[0]= range.first;
+      count[0] = range.second - range.first;
+    }
+    else
+      offset[0]= 0;
 
     // Select a block in the dataset beginning at offset[], with
     // size=count[]
@@ -381,7 +392,7 @@ namespace dolfin
     data.resize(data_size);
 
     // Read data on each process
-    const int h5type = hdf5_type<T>();
+    const hid_t h5type = hdf5_type<T>();
     status = H5Dread(dset_id, h5type, memspace, dataspace, H5P_DEFAULT,
                      data.data());
     dolfin_assert(status != HDF5_FAIL);
@@ -401,14 +412,14 @@ namespace dolfin
   //---------------------------------------------------------------------------
   template <typename T>
   inline void HDF5Interface::get_attribute(hid_t hdf5_file_handle,
-                                           const std::string dataset_name,
+                                           const std::string dataset_path,
                                            const std::string attribute_name,
                                            T& attribute_value)
   {
     herr_t status;
 
     // Open dataset or group by name
-    const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_name.c_str(),
+    const hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_path.c_str(),
                                    H5P_DEFAULT);
     dolfin_assert(dset_id != HDF5_FAIL);
 
@@ -436,13 +447,13 @@ namespace dolfin
   //--------------------------------------------------------------------------
   template <typename T>
   inline void HDF5Interface::add_attribute(const hid_t hdf5_file_handle,
-                                           const std::string dataset_name,
+                                           const std::string dataset_path,
                                            const std::string attribute_name,
                                            const T& attribute_value)
   {
 
     // Open named dataset or group
-    hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_name.c_str(),
+    hid_t dset_id = H5Oopen(hdf5_file_handle, dataset_path.c_str(),
                             H5P_DEFAULT);
     dolfin_assert(dset_id != HDF5_FAIL);
 
@@ -471,9 +482,9 @@ namespace dolfin
   // Specialization below for string
   template<typename T>
   inline void
-    HDF5Interface::add_attribute_value(const hid_t dset_id,
-                                       const std::string attribute_name,
-                                       const T& attribute_value)
+  HDF5Interface::add_attribute_value(const hid_t dset_id,
+                                     const std::string attribute_name,
+                                     const T& attribute_value)
   {
     // Create a scalar dataspace
     hid_t dataspace_id = H5Screate(H5S_SCALAR);
diff --git a/dolfin/io/HDF5Utility.cpp b/dolfin/io/HDF5Utility.cpp
index 6093eec..f55ae3e 100644
--- a/dolfin/io/HDF5Utility.cpp
+++ b/dolfin/io/HDF5Utility.cpp
@@ -306,30 +306,30 @@ void HDF5Utility::build_local_mesh(Mesh& mesh, const LocalMeshData& mesh_data)
 
   // Create mesh for editing
   MeshEditor editor;
-  dolfin_assert(mesh_data.tdim != 0);
-  editor.open(mesh, mesh_data.cell_type, mesh_data.tdim, mesh_data.gdim);
+  dolfin_assert(mesh_data.topology.dim != 0);
+  editor.open(mesh, mesh_data.topology.cell_type, mesh_data.topology.dim, mesh_data.geometry.dim);
 
   // Iterate over vertices and add to mesh
-  editor.init_vertices_global(mesh_data.num_global_vertices,
-                              mesh_data.num_global_vertices);
-  for (std::size_t i = 0; i < mesh_data.num_global_vertices; ++i)
+  editor.init_vertices_global(mesh_data.geometry.num_global_vertices,
+                              mesh_data.geometry.num_global_vertices);
+  for (std::int64_t i = 0; i < mesh_data.geometry.num_global_vertices; ++i)
   {
-    const std::size_t index = mesh_data.vertex_indices[i];
-    const std::vector<double> coords(mesh_data.vertex_coordinates[i].begin(),
-                                     mesh_data.vertex_coordinates[i].end());
-    Point p(mesh_data.gdim, coords.data());
+    const std::size_t index = mesh_data.geometry.vertex_indices[i];
+    const std::vector<double> coords(mesh_data.geometry.vertex_coordinates[i].begin(),
+                                     mesh_data.geometry.vertex_coordinates[i].end());
+    Point p(mesh_data.geometry.dim, coords.data());
     editor.add_vertex(index, p);
   }
 
   // Iterate over cells and add to mesh
-  editor.init_cells_global(mesh_data.num_global_cells,
-                           mesh_data.num_global_cells);
+  editor.init_cells_global(mesh_data.topology.num_global_cells,
+                           mesh_data.topology.num_global_cells);
 
-  for (std::size_t i = 0; i < mesh_data.num_global_cells; ++i)
+  for (std::int64_t i = 0; i < mesh_data.topology.num_global_cells; ++i)
   {
-    const std::size_t index = mesh_data.global_cell_indices[i];
-    const std::vector<std::size_t> v(mesh_data.cell_vertices[i].begin(),
-                                     mesh_data.cell_vertices[i].end());
+    const std::size_t index = mesh_data.topology.global_cell_indices[i];
+    const std::vector<std::size_t> v(mesh_data.topology.cell_vertices[i].begin(),
+                                     mesh_data.topology.cell_vertices[i].end());
     editor.add_cell(index, v);
   }
 
diff --git a/dolfin/io/RAWFile.cpp b/dolfin/io/RAWFile.cpp
index 5d8c8fe..2ab358a 100644
--- a/dolfin/io/RAWFile.cpp
+++ b/dolfin/io/RAWFile.cpp
@@ -180,8 +180,8 @@ void RAWFile::rawNameUpdate(const int counter)
   fileid.fill('0');
   fileid.width(6);
 
-  filestart.assign(_filename, 0, _filename.find("."));
-  extension.assign(_filename, _filename.find("."), _filename.size());
+  filestart.assign(_filename, 0, _filename.find_last_of("."));
+  extension.assign(_filename, _filename.find_last_of("."), _filename.size());
 
   fileid << counter;
   newfilename << filestart << fileid.str() << ".raw";
diff --git a/dolfin/io/VTKWriter.cpp b/dolfin/io/VTKWriter.cpp
index 703f81b..ce027f0 100644
--- a/dolfin/io/VTKWriter.cpp
+++ b/dolfin/io/VTKWriter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2010 Garth N. Wells
+// Copyright (C) 2010-2016 Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -17,10 +17,8 @@
 //
 // Modified by Anders Logg 2011
 // Modified by Johannes Ring 2012
-//
-// First added:  2010-07-19
-// Last changed: 2012-09-14
 
+#include <cstdint>
 #include <fstream>
 #include <ostream>
 #include <sstream>
@@ -268,7 +266,7 @@ void VTKWriter::write_ascii_mesh(const Mesh& mesh, std::size_t cell_dim,
 
   std::unique_ptr<CellType>
     celltype(CellType::create(mesh.type().entity_type(cell_dim)));
-  const std::vector<unsigned int> perm = celltype->vtk_mapping();
+  const std::vector<std::int8_t> perm = celltype->vtk_mapping();
   for (MeshEntityIterator c(mesh, cell_dim); !c.end(); ++c)
   {
     for (unsigned int i = 0; i != c->num_entities(0); ++i)
@@ -303,7 +301,7 @@ void VTKWriter::write_base64_mesh(const Mesh& mesh, std::size_t cell_dim,
   const std::size_t num_cell_vertices = mesh.type().num_vertices(cell_dim);
 
   // Get VTK cell type
-  const boost::uint8_t _vtk_cell_type = vtk_cell_type(mesh, cell_dim);
+  const std::uint8_t _vtk_cell_type = vtk_cell_type(mesh, cell_dim);
 
   // Open file
   std::ofstream file(filename.c_str(), std::ios::app);
@@ -337,12 +335,12 @@ void VTKWriter::write_base64_mesh(const Mesh& mesh, std::size_t cell_dim,
   file << "<DataArray  type=\"UInt32\"  Name=\"connectivity\"  format=\""
        << "binary" << "\">" << std::endl;
   const int size = num_cells*num_cell_vertices;
-  std::vector<boost::uint32_t> cell_data(size);
-  std::vector<boost::uint32_t>::iterator cell_entry = cell_data.begin();
+  std::vector<std::uint32_t> cell_data(size);
+  std::vector<std::uint32_t>::iterator cell_entry = cell_data.begin();
 
   std::unique_ptr<CellType>
     celltype(CellType::create(mesh.type().entity_type(cell_dim)));
-  const std::vector<unsigned int> perm = celltype->vtk_mapping();
+  const std::vector<std::int8_t> perm = celltype->vtk_mapping();
   for (MeshEntityIterator c(mesh, cell_dim); !c.end(); ++c)
   {
     for (unsigned int i = 0; i != c->num_entities(0); ++i)
@@ -356,8 +354,8 @@ void VTKWriter::write_base64_mesh(const Mesh& mesh, std::size_t cell_dim,
   // Write offset into connectivity array for the end of each cell
   file << "<DataArray  type=\"UInt32\"  Name=\"offsets\"  format=\""
        << "binary" << "\">" << std::endl;
-  std::vector<boost::uint32_t> offset_data(num_cells*num_cell_vertices);
-  std::vector<boost::uint32_t>::iterator offset_entry = offset_data.begin();
+  std::vector<std::uint32_t> offset_data(num_cells*num_cell_vertices);
+  std::vector<std::uint32_t>::iterator offset_entry = offset_data.begin();
   for (std::size_t offsets = 1; offsets <= num_cells; offsets++)
     *offset_entry++ = offsets*num_cell_vertices;
 
@@ -368,8 +366,8 @@ void VTKWriter::write_base64_mesh(const Mesh& mesh, std::size_t cell_dim,
   // Write cell type
   file << "<DataArray  type=\"UInt8\"  Name=\"types\"  format=\"" << "binary"
        << "\">" << std::endl;
-  std::vector<boost::uint8_t> type_data(num_cells);
-  std::vector<boost::uint8_t>::iterator type_entry = type_data.begin();
+  std::vector<std::uint8_t> type_data(num_cells);
+  std::vector<std::uint8_t>::iterator type_entry = type_data.begin();
   for (std::size_t types = 0; types < num_cells; types++)
     *type_entry++ = _vtk_cell_type;
 
@@ -383,14 +381,14 @@ void VTKWriter::write_base64_mesh(const Mesh& mesh, std::size_t cell_dim,
   file.close();
 }
 //----------------------------------------------------------------------------
-boost::uint8_t VTKWriter::vtk_cell_type(const Mesh& mesh,
-                                        std::size_t cell_dim)
+std::uint8_t VTKWriter::vtk_cell_type(const Mesh& mesh,
+                                      std::size_t cell_dim)
 {
   // Get cell type
   CellType::Type cell_type = mesh.type().entity_type(cell_dim);
 
   // Determine VTK cell type
-  boost::uint8_t vtk_cell_type = 0;
+  std::uint8_t vtk_cell_type = 0;
   if (cell_type == CellType::tetrahedron)
     vtk_cell_type = 10;
   else if (cell_type == CellType::hexahedron)
diff --git a/dolfin/io/VTKWriter.h b/dolfin/io/VTKWriter.h
index 11b8078..1a24de1 100644
--- a/dolfin/io/VTKWriter.h
+++ b/dolfin/io/VTKWriter.h
@@ -21,9 +21,9 @@
 #ifndef __VTK_WRITER_H
 #define __VTK_WRITER_H
 
+#include <cstdint>
 #include <string>
 #include <vector>
-#include <boost/cstdint.hpp>
 #include "Encoder.h"
 
 namespace dolfin
@@ -75,7 +75,7 @@ namespace dolfin
                                   std::string file, bool compress);
 
     // Get VTK cell type
-    static boost::uint8_t vtk_cell_type(const Mesh& mesh, std::size_t cell_dim);
+    static std::uint8_t vtk_cell_type(const Mesh& mesh, std::size_t cell_dim);
 
     // Compute base64 encoded stream for VTK
     template<typename T>
@@ -113,7 +113,7 @@ namespace dolfin
   {
     std::stringstream stream;
 
-    const boost::uint32_t size = data.size()*sizeof(T);
+    const std::uint32_t size = data.size()*sizeof(T);
     Encoder::encode_base64(&size, 1, stream);
     Encoder::encode_base64(data, stream);
 
@@ -127,24 +127,24 @@ namespace dolfin
   {
     std::stringstream stream;
 
-    boost::uint32_t header[4];
+    std::uint32_t header[4];
     header[0] = 1;
     header[1] = data.size()*sizeof(T);
     header[2] = 0;
 
     // Compress data
-    std::pair<boost::shared_array<unsigned char>, std::size_t>
-      compressed_data = Encoder::compress_data(data);
+    std::vector<unsigned char> compressed_data
+      = Encoder::compress_data(data);
 
     // Length of compressed data
-    header[3] = compressed_data.second;
+    header[3] = compressed_data.size();
 
     // Encode header
     Encoder::encode_base64(&header[0], 4, stream);
 
     // Encode data
-    Encoder::encode_base64(compressed_data.first.get(),
-                           compressed_data.second, stream);
+    Encoder::encode_base64(compressed_data.data(),
+                           compressed_data.size(), stream);
 
     return stream.str();
   }
diff --git a/dolfin/io/X3DFile.cpp b/dolfin/io/X3DFile.cpp
index 6ae5622..6937fb8 100644
--- a/dolfin/io/X3DFile.cpp
+++ b/dolfin/io/X3DFile.cpp
@@ -28,19 +28,20 @@
 #include <dolfin/function/Function.h>
 #include <dolfin/function/FunctionSpace.h>
 #include <dolfin/fem/GenericDofMap.h>
+#include <dolfin/la/GenericVector.h>
 #include <dolfin/log/log.h>
 #include <dolfin/mesh/Cell.h>
 #include <dolfin/mesh/Edge.h>
 #include <dolfin/mesh/Face.h>
 #include <dolfin/mesh/Vertex.h>
-
+#include "X3DOM.h"
 #include "X3DFile.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
 X3DFile::X3DFile(const std::string filename) : GenericFile(filename, "X3D"),
-  facet_type("IndexedFaceSet")
+                                               facet_type("IndexedFaceSet")
 {
   // Do nothing
 }
@@ -52,7 +53,13 @@ X3DFile::~X3DFile()
 //-----------------------------------------------------------------------------
 void X3DFile::operator<< (const Mesh& mesh)
 {
-  write_mesh(mesh);
+  // Build XML tree
+  pugi::xml_document xml_doc;
+  X3DOM::build_x3dom_tree(xml_doc, mesh);
+
+  // Write to file
+  if (MPI::rank(mesh.mpi_comm()) == 0)
+    xml_doc.save_file(_filename.c_str(), "  ");
 }
 //-----------------------------------------------------------------------------
 void X3DFile::operator<< (const MeshFunction<std::size_t>& meshfunction)
@@ -62,7 +69,14 @@ void X3DFile::operator<< (const MeshFunction<std::size_t>& meshfunction)
 //-----------------------------------------------------------------------------
 void X3DFile::operator<< (const Function& u)
 {
-  write_function(u);
+  // Build XML tree
+  pugi::xml_document xml_doc;
+  X3DOM::build_x3dom_tree(xml_doc, u);
+
+  // Write to file
+  dolfin_assert(u.vector());
+  if (MPI::rank(u.vector()->mpi_comm()) == 0)
+    xml_doc.save_file(_filename.c_str(), "  ");
 }
 //-----------------------------------------------------------------------------
 std::string X3DFile::color_palette(const int palette) const
@@ -239,203 +253,6 @@ void X3DFile::write_meshfunction(const MeshFunction<std::size_t>& meshfunction)
   }
 }
 //-----------------------------------------------------------------------------
-void X3DFile::write_function(const Function& u)
-{
-  dolfin_assert(u.function_space()->mesh());
-  const Mesh& mesh = *u.function_space()->mesh();
-
-  // Mesh geometric and topological dimensions
-  const std::size_t gdim = mesh.geometry().dim();
-  const std::size_t tdim = mesh.topology().dim();
-
-  if (gdim !=2 && gdim !=3)
-  {
-    dolfin_error("X3DFile.cpp",
-                 "output mesh",
-                 "X3D will only output 2D or 3D meshes");
-  }
-
-  // Build mesh connectivity
-  mesh.init(tdim - 1 , tdim);
-
-  dolfin_assert(u.function_space()->dofmap());
-  const GenericDofMap& dofmap = *u.function_space()->dofmap();
-
-  // Only allow scalar fields
-  if (u.value_rank() > 1)
-  {
-    dolfin_error("X3DFile.cpp",
-                 "write X3D",
-                 "Can only handle scalar and vector Functions");
-  }
-
-  if (u.value_rank() == 1)
-    warning("X3DFile outputs scalar magnitude of vector field");
-
-  // Only allow vertex centered data
-  const bool vertex_data = (dofmap.max_element_dofs() != 1);
-  if (!vertex_data)
-  {
-    dolfin_error("X3DFile.cpp",
-                 "write X3D",
-                 "Can only handle vertex-based Function at present");
-  }
-
-  // Compute vertex data values
-  std::vector<double> data_values;
-  u.compute_vertex_values(data_values, mesh);
-
-  // Normalise data values
-  if (u.value_rank() == 1)
-  {
-    std::vector<double> magnitude;
-    const std::size_t num_vertices = mesh.num_vertices();
-    for (std::size_t i = 0; i < num_vertices ; ++i)
-    {
-      double val = 0.0;
-      for (std::size_t j = 0; j < u.value_size() ; j++)
-        val += pow(data_values[i + j*num_vertices], 2.0);
-      val = sqrt(val);
-      magnitude.push_back(val);
-    }
-    data_values.resize(magnitude.size());
-    std::copy(magnitude.begin(), magnitude.end(), data_values.begin());
-  }
-
-  // Create pugi document
-  pugi::xml_document xml_doc;
-
-  // Get mesh mix/max dimensions and write XML header
-  const std::vector<double> xpos = mesh_min_max(mesh);
-  output_xml_header(xml_doc, xpos);
-
-  // Get indices of vertices on mesh surface
-  const std::vector<std::size_t> surface_vertices = vertex_index(mesh);
-
-  // Write vertices and vertex data to XML file
-  write_vertices(xml_doc, mesh, surface_vertices);
-  write_values(xml_doc, mesh, surface_vertices, data_values);
-
-  // Save XML file
-  if (MPI::rank(mesh.mpi_comm()) == 0)
-    xml_doc.save_file(_filename.c_str(), "  ");
-}
-//-----------------------------------------------------------------------------
-void X3DFile::write_mesh(const Mesh& mesh)
-{
-  const std::size_t gdim = mesh.geometry().dim();
-  if (gdim !=2 && gdim !=3)
-  {
-    dolfin_error("X3DFile.cpp",
-                 "output mesh",
-                 "X3D will only output 2D or 3D meshes");
-  }
-
-  // Create pugi doc
-  pugi::xml_document xml_doc;
-
-  // For serial - ensure connectivity
-  mesh.init(mesh.topology().dim() - 1 , mesh.topology().dim());
-
-  // Get mesh max and min dimensions and viewpoint
-  const std::vector<double> xpos = mesh_min_max(mesh);
-
-  // Create XML for all mesh vertices on surface
-  output_xml_header(xml_doc, xpos);
-  const std::vector<std::size_t> vecindex = vertex_index(mesh);
-  write_vertices(xml_doc, mesh, vecindex);
-
-  if (MPI::rank(mesh.mpi_comm()) == 0)
-    xml_doc.save_file(_filename.c_str(), "  ");
-}
-//-----------------------------------------------------------------------------
-void X3DFile::write_values(pugi::xml_document& xml_doc, const Mesh& mesh,
-                           const std::vector<std::size_t> vecindex,
-                           const std::vector<double> data_values)
-{
-  const std::size_t tdim = mesh.topology().dim();
-
-  double minval = *std::min_element(data_values.begin(), data_values.end());
-  minval = MPI::min(mesh.mpi_comm(), minval);
-  double maxval = *std::max_element(data_values.begin(), data_values.end());
-  maxval = MPI::max(mesh.mpi_comm(), maxval);
-
-  double scale = 0.0;
-  if (maxval == minval)
-    scale = 1.0;
-  else
-    scale = 255.0/(maxval - minval);
-
-  std::vector<int> local_output;
-  if (facet_type == "IndexedLineSet")
-  {
-    for (EdgeIterator e(mesh); !e.end(); ++e)
-    {
-      bool allow_edge = (tdim == 2);
-
-      // If one of the faces connected to this edge is external, then
-      // output the edge
-      if (!allow_edge)
-      {
-        for (FaceIterator f(*e); !f.end(); ++f)
-        {
-          if (f->num_global_entities(tdim) == 1)
-            allow_edge = true;
-        }
-      }
-
-      if (allow_edge)
-      {
-        for (VertexIterator v(*e); !v.end(); ++v)
-        {
-          local_output.push_back((int)((data_values[v->index()] - minval)
-                                       *scale));
-        }
-        local_output.push_back(-1);
-      }
-    }
-  }
-  else if (facet_type == "IndexedFaceSet")
-  {
-    // Output faces
-    for (FaceIterator f(mesh); !f.end(); ++f)
-    {
-      if (tdim == 2 || f->num_global_entities(tdim) == 1)
-      {
-        for (VertexIterator v(*f); !v.end(); ++v)
-        {
-          local_output.push_back((int)((data_values[v->index()] - minval)
-                                       *scale));
-        }
-        local_output.push_back(-1);
-      }
-    }
-  }
-
-  // Gather up on zero
-  std::vector<int> gathered_output;
-  MPI::gather(mesh.mpi_comm(), local_output, gathered_output);
-  if (MPI::rank(mesh.mpi_comm()) == 0)
-  {
-    pugi::xml_node indexed_face_set = xml_doc.child("X3D")
-      .child("Scene").child("Shape").child(facet_type.c_str());
-    indexed_face_set.append_attribute("colorPerVertex") = "true";
-
-    std::stringstream str_output;
-    for (std::vector<int>::iterator val = gathered_output.begin();
-         val != gathered_output.end(); ++val)
-    {
-      str_output << *val << " ";
-    }
-    indexed_face_set.append_attribute("colorIndex") = str_output.str().c_str();
-
-    // Output colour palette
-    const int palette = 2;
-    pugi::xml_node color = indexed_face_set.append_child("Color");
-    color.append_attribute("color") = color_palette(palette).c_str();
-  }
-}
-//-----------------------------------------------------------------------------
 void X3DFile::write_vertices(pugi::xml_document& xml_doc, const Mesh& mesh,
                              const std::vector<std::size_t> vecindex)
 {
diff --git a/dolfin/io/X3DFile.h b/dolfin/io/X3DFile.h
index 2dd0eda..82cd3b2 100644
--- a/dolfin/io/X3DFile.h
+++ b/dolfin/io/X3DFile.h
@@ -72,22 +72,11 @@ namespace dolfin
     void write_vertices(pugi::xml_document& xml_doc, const Mesh& mesh,
                         const std::vector<std::size_t> vecindex);
 
-    // Output values to XML using a colour palette
-    void write_values(pugi::xml_document& xml_doc, const Mesh& mesh,
-                      const std::vector<std::size_t> vecindex,
-                      const std::vector<double> data_values);
-
     // XML header output
     void output_xml_header(pugi::xml_document& xml_doc,
                            const std::vector<double>& xpos);
 
     // Write out surface mesh to file
-    void write_mesh(const Mesh& mesh);
-
-    // Write out surface mesh to file
-    void write_function(const Function& u);
-
-    // Write out surface mesh to file
     void write_meshfunction(const MeshFunction<std::size_t>& meshfunction);
 
     // Get a string representing a color palette
diff --git a/dolfin/io/X3DOM.cpp b/dolfin/io/X3DOM.cpp
new file mode 100644
index 0000000..e762bcd
--- /dev/null
+++ b/dolfin/io/X3DOM.cpp
@@ -0,0 +1,1059 @@
+// Copyright (C) 2016 Quang T. Ha, Chris Richardson and Garth N. Wells
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <sstream>
+#include <utility>
+#include "pugixml.hpp"
+
+#include <dolfin/common/MPI.h>
+#include <dolfin/fem/GenericDofMap.h>
+#include <dolfin/function/Function.h>
+#include <dolfin/function/FunctionSpace.h>
+#include <dolfin/geometry/Point.h>
+#include <dolfin/log/log.h>
+#include <dolfin/la/GenericVector.h>
+#include <dolfin/mesh/Cell.h>
+#include <dolfin/mesh/Edge.h>
+#include <dolfin/mesh/Face.h>
+#include <dolfin/mesh/Vertex.h>
+
+#include "X3DOM.h"
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+X3DOMParameters::X3DOMParameters()
+  : _representation(Representation::surface_with_edges),
+    _size({{500.0, 400.0}}),
+    _show_viewpoints(false),
+    _diffuse_color({{1.0, 1.0, 1.0}}),
+    _emissive_color({{0.0, 0.0, 0.0}}),
+    _specular_color({{0.0, 0.0, 0.0}}),
+    _background_color({{0.95, 0.95, 0.95}}),
+    _ambient_intensity(0.0),
+    _shininess(0.5),
+    _transparency(0.0),
+    _color_map(default_color_map()),
+    _show_x3d_stats(false)
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_representation(Representation representation)
+{
+  _representation = representation;
+}
+//-----------------------------------------------------------------------------
+X3DOMParameters::Representation X3DOMParameters::get_representation() const
+{
+  return _representation;
+}
+//-----------------------------------------------------------------------------
+std::array<double, 2> X3DOMParameters::get_viewport_size() const
+{
+  return _size;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_diffuse_color(std::array<double, 3> rgb)
+{
+  check_rgb(rgb);
+  _diffuse_color = rgb;
+}
+//-----------------------------------------------------------------------------
+std::array<double, 3> X3DOMParameters::get_diffuse_color() const
+{
+  return _diffuse_color;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_emissive_color(std::array<double, 3> rgb)
+{
+  check_rgb(rgb);
+  _emissive_color = rgb;
+}
+//-----------------------------------------------------------------------------
+std::array<double, 3> X3DOMParameters::get_emissive_color() const
+{
+  return _emissive_color;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_specular_color(std::array<double, 3> rgb)
+{
+  check_rgb(rgb);
+  _specular_color = rgb;
+}
+//-----------------------------------------------------------------------------
+std::array<double, 3> X3DOMParameters::get_specular_color() const
+{
+  return _specular_color;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_background_color(std::array<double, 3> rgb)
+{
+  check_rgb(rgb);
+  _background_color = rgb;
+}
+//-----------------------------------------------------------------------------
+std::array<double, 3> X3DOMParameters::get_background_color() const
+{
+  return _background_color;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_ambient_intensity(double intensity)
+{
+  check_value_range(intensity, 0.0, 1.0);
+  _ambient_intensity = intensity;
+}
+//-----------------------------------------------------------------------------
+double X3DOMParameters::get_ambient_intensity() const
+{
+  return _ambient_intensity;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_shininess(double shininess)
+{
+  check_value_range(shininess, 0.0, 1.0);
+  _shininess = shininess;
+}
+//-----------------------------------------------------------------------------
+double X3DOMParameters::get_shininess() const
+{
+  return _shininess;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_transparency(double transparency)
+{
+  check_value_range(transparency, 0.0, 1.0);
+  _transparency = transparency;
+}
+//-----------------------------------------------------------------------------
+double X3DOMParameters::get_transparency() const
+{
+  return _transparency;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_color_map(const std::vector<double>& color_data)
+{
+  dolfin_assert(color_data.size() == 256*3);
+  _color_map.resize(boost::extents[256][3]);
+  std::copy(color_data.begin(), color_data.end(), _color_map.data());
+}
+//-----------------------------------------------------------------------------
+std::vector<double> X3DOMParameters::get_color_map() const
+{
+  dolfin_assert(_color_map.shape()[0] == 256);
+  dolfin_assert(_color_map.shape()[1] == 3);
+
+  std::vector<double> cmap(256*3);
+  std::copy(_color_map.data(), _color_map.data() + 256*3, cmap.data());
+  return cmap;
+}
+//-----------------------------------------------------------------------------
+boost::multi_array<float, 2> X3DOMParameters::get_color_map_array() const
+{
+  return _color_map;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_viewpoint_buttons(bool show)
+{
+  _show_viewpoints = show;
+}
+//-----------------------------------------------------------------------------
+bool X3DOMParameters::get_viewpoint_buttons() const
+{
+  return _show_viewpoints;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::set_x3d_stats(bool show_stats)
+{
+  _show_x3d_stats = show_stats;
+}
+//-----------------------------------------------------------------------------
+bool X3DOMParameters::get_x3d_stats() const
+{
+  return _show_x3d_stats;
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::check_rgb(std::array<double, 3>& rgb)
+{
+  for (auto c : rgb)
+  {
+    if (c < 0.0 or c > 1.0)
+    {
+      dolfin_error("X3DOM.cpp",
+                   "check validity of RGB (color) values",
+                   "RGB components must be between 0.0 and 1.0");
+    }
+  }
+}
+//-----------------------------------------------------------------------------
+void X3DOMParameters::check_value_range(double value, double lower,
+                                        double upper)
+{
+  dolfin_assert(lower < upper);
+  if (value < lower or value > upper)
+  {
+    dolfin_error("X3DOM.cpp",
+                 "check validity of X3D properties",
+                 "Parameter outside of allowable range of (%f, %f)", lower,
+                 upper);
+  }
+}
+//-----------------------------------------------------------------------------
+boost::multi_array<float, 2> X3DOMParameters::default_color_map()
+{
+  boost::multi_array<float, 2> rgb_map(boost::extents[256][3]);
+
+  // Create RGB palette of 256 colors
+  for (int i = 0; i < 256; ++i)
+  {
+    const double x = (double)i/255.0;
+    const double y = 1.0 - x;
+    rgb_map[i][0] = 4*std::pow(x, 3) - 3*std::pow(x, 4);
+    rgb_map[i][1] = 4*std::pow(x, 2)*(1.0 - std::pow(x, 2));
+    rgb_map[i][2] = 4*std::pow(y, 3) - 3*std::pow(y, 4);
+  }
+
+  return rgb_map;
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+std::string X3DOM::str(const Mesh& mesh, X3DOMParameters parameters)
+{
+  // Build XML doc
+  pugi::xml_document xml_doc;
+  build_x3dom_tree(xml_doc, mesh, parameters);
+
+  // Return as string
+  return to_string(xml_doc, pugi::format_default);
+}
+//-----------------------------------------------------------------------------
+std::string X3DOM::str(const Function& u, X3DOMParameters parameters)
+{
+  // Get values on vertices or facets
+  std::vector<double> vertex_values;
+  std::vector<double> facet_values;
+  get_function_values(u, vertex_values, facet_values);
+
+  // Get mesh
+  dolfin_assert(u.function_space()->mesh());
+  const Mesh& mesh = *u.function_space()->mesh();
+
+  // Build XML doc
+  pugi::xml_document xml_doc;
+  x3dom(xml_doc, mesh, vertex_values, facet_values, parameters);
+
+  // Return as string
+  return to_string(xml_doc, pugi::format_default);
+}
+//-----------------------------------------------------------------------------
+std::string X3DOM::html(const Mesh& mesh, X3DOMParameters parameters)
+{
+  // Build XML doc
+  pugi::xml_document xml_doc;
+  html(xml_doc, mesh, {}, {}, parameters);
+
+  // Return as string
+  return to_string(xml_doc, pugi::format_indent | pugi::format_no_declaration);
+}
+//-----------------------------------------------------------------------------
+std::string X3DOM::html(const Function& u, X3DOMParameters parameters)
+{
+  // Get values on vertices or facets
+  std::vector<double> vertex_values, facet_values;
+  get_function_values(u, vertex_values, facet_values);
+
+  // Get mesh
+  dolfin_assert(u.function_space()->mesh());
+  const Mesh& mesh = *u.function_space()->mesh();
+
+  // Build XML doc
+  pugi::xml_document xml_doc;
+  html(xml_doc, mesh, vertex_values, facet_values, parameters);
+
+  // Return as string
+  return to_string(xml_doc, pugi::format_indent | pugi::format_no_declaration);
+}
+//-----------------------------------------------------------------------------
+void X3DOM::build_x3dom_tree(pugi::xml_document& xml_doc, const Mesh& mesh,
+                             const X3DOMParameters& parameters)
+{
+  x3dom(xml_doc, mesh, {}, {}, parameters);
+}
+//-----------------------------------------------------------------------------
+void X3DOM::build_x3dom_tree(pugi::xml_document& xml_doc,
+                             const Function& u,
+                             const X3DOMParameters& parameters)
+{
+  // Get values on vertices or facets
+  std::vector<double> vertex_values, facet_values;
+  get_function_values(u, vertex_values, facet_values);
+
+  // Get mesh
+  dolfin_assert(u.function_space()->mesh());
+  const Mesh& mesh = *u.function_space()->mesh();
+
+  // Build XML doc
+  x3dom(xml_doc, mesh, vertex_values, facet_values, parameters);
+}
+//-----------------------------------------------------------------------------
+void X3DOM::x3dom(pugi::xml_document& xml_doc, const Mesh& mesh,
+                  const std::vector<double>& vertex_values,
+                  const std::vector<double>& facet_values,
+                  const X3DOMParameters& parameters)
+{
+  // Build X3D XML and add to XML doc
+  add_x3dom_data(xml_doc, mesh, vertex_values, facet_values, parameters);
+}
+//-----------------------------------------------------------------------------
+void X3DOM::html(pugi::xml_document& xml_doc, const Mesh& mesh,
+                 const std::vector<double>& vertex_values,
+                 const std::vector<double>& facet_values,
+                 const X3DOMParameters& parameters)
+{
+  // Add DOCTYPE
+  add_html_doctype(xml_doc);
+
+  // Create 'html' node and add HTML preamble
+  pugi::xml_node html_node = add_html_preamble(xml_doc);
+  dolfin_assert(html_node);
+
+  // Add body node
+  pugi::xml_node body_node = html_node.append_child("body");
+  dolfin_assert(body_node);
+
+  // Add X3D XML data
+  add_x3dom_data(body_node, mesh, vertex_values, facet_values, parameters);
+
+  // Add text mesh info to body node
+  pugi::xml_node mesh_info_node = body_node.append_child("div");
+  dolfin_assert(mesh_info_node);
+  mesh_info_node.append_attribute("style")
+    = "position: absolute; margin: 1%; text-align: left; font-size: 12px; color: black;";
+  std::string data
+    = "Number of vertices: " + std::to_string(mesh.num_vertices())
+    + ", number of cells: " + std::to_string(mesh.num_cells());
+  mesh_info_node.append_child(pugi::node_pcdata).set_value(data.c_str());
+
+  // FIXME: adding viewpoint buttons here is fragile since to may
+  // change in the X3 node. Need to bring the two closer in the code
+  // (in the same function?) to keep consistency
+
+  //Append viewpoint buttons to 'body' (HTML) node
+  if (parameters.get_viewpoint_buttons())
+  {
+    // Add viewpoint control node to HTML (have to add as the first
+    // element)
+    pugi::xml_node viewpoint_control_node = body_node.prepend_child("div");
+    dolfin_assert(viewpoint_control_node);
+    viewpoint_control_node.append_child(pugi::node_pcdata);
+
+    // Add attributes to viewpoint node
+    viewpoint_control_node.append_attribute("id") = "camera_buttons";
+    viewpoint_control_node.append_attribute("style")
+      = "display: inline-flex; position: relative; margin: 1%";
+
+    // Add viewpoints
+    std::vector<std::string> viewpoints = {"front", "back", "left",
+                                           "right", "top", "bottom"};
+    for (auto viewpoint : viewpoints)
+      add_viewpoint_control_option(viewpoint_control_node, viewpoint);
+  }
+}
+//-----------------------------------------------------------------------------
+pugi::xml_node X3DOM::add_html_preamble(pugi::xml_node& xml_node)
+{
+  // Add html node
+  pugi::xml_node html_node = xml_node.append_child("html");
+  dolfin_assert(html_node);
+
+  // Add head node (required for HTML)
+  pugi::xml_node head_node = html_node.append_child("head");
+  dolfin_assert(head_node);
+
+  // Add meta node(s)
+  pugi::xml_node meta_node0 = head_node.append_child("meta");
+  dolfin_assert(meta_node0);
+  meta_node0.append_attribute("http-equiv") = "content-type";
+  meta_node0.append_attribute("content") = "text/html;charset=UTF-8";
+
+  pugi::xml_node meta_node1 = head_node.append_child("meta");
+  dolfin_assert(meta_node1);
+  meta_node1.append_attribute("name") = "generator";
+  meta_node1.append_attribute("content")
+    = "FEniCS/DOLFIN (http://fenicsproject.org)";
+
+  // Add title node
+  pugi::xml_node title_node = head_node.append_child("title");
+  dolfin_assert(title_node);
+  title_node.append_child(pugi::node_pcdata).set_value("FEniCS/DOLFIN X3DOM plot");
+
+  // Add script node
+  pugi::xml_node script_node = head_node.append_child("script");
+  dolfin_assert(script_node);
+  script_node.append_child(pugi::node_pcdata);
+
+  // Set attributes for script node
+  script_node.append_attribute("type") = "text/javascript";
+  script_node.append_attribute("src") = "http://www.x3dom.org/download/x3dom.js";
+
+  // Add link node
+  pugi::xml_node link_node = head_node.append_child("link");
+  dolfin_assert(link_node);
+
+  // Set attributes for link node
+  link_node.append_attribute("rel") = "stylesheet";
+  link_node.append_attribute("type") = "text/css";
+  link_node.append_attribute("href") = "http://www.x3dom.org/download/x3dom.css";
+
+  return html_node;
+}
+//-----------------------------------------------------------------------------
+void X3DOM::add_x3dom_doctype(pugi::xml_node& xml_node)
+{
+  dolfin_assert(xml_node);
+
+  // Try adding X3D doctype (this might not be possible since an HTML
+  // outer layer may have added the doctype, and only one doctype node
+  // is permitted)
+  pugi::xml_node doc_type_node = xml_node.prepend_child(pugi::node_doctype);
+
+  // Set doctype value if it was sucessfully created
+  if (doc_type_node)
+    doc_type_node.set_value("X3D PUBLIC \"ISO//Web3D//DTD X3D 3.2//EN\" \"http://www.web3d.org/specifications/x3d-3.2.dtd\"");
+}
+//-----------------------------------------------------------------------------
+void X3DOM::add_html_doctype(pugi::xml_node& xml_node)
+{
+  dolfin_assert(xml_node);
+  pugi::xml_node doc_type_node = xml_node.prepend_child(pugi::node_doctype);
+  dolfin_assert(doc_type_node);
+  doc_type_node.set_value("html");
+}
+//-----------------------------------------------------------------------------
+pugi::xml_node X3DOM::add_x3d_node(pugi::xml_node& xml_node,
+                                   std::array<double, 2> size, bool show_stats)
+{
+  pugi::xml_node x3d_node = xml_node.append_child("x3d");
+  dolfin_assert(x3d_node);
+
+  // Add on option to show rendering
+  x3d_node.append_attribute("showStat") = show_stats;
+
+  x3d_node.append_attribute("xmlns")
+    = "http://www.web3d.org/specifications/x3d-namespace";
+
+  std::string width = std::to_string(size[0]) + "px";
+  std::string height = std::to_string(size[1]) + "px";
+  x3d_node.append_attribute("width") = width.c_str();
+  x3d_node.append_attribute("height") = height.c_str();
+
+  return x3d_node;
+}
+//-----------------------------------------------------------------------------
+void X3DOM::add_x3dom_data(pugi::xml_node& xml_node, const Mesh& mesh,
+                           const std::vector<double>& vertex_data,
+                           const std::vector<double>& facet_data,
+                           const X3DOMParameters& parameters)
+{
+  // Check that mesh is embedded in 2D or 3D
+  const std::size_t gdim = mesh.geometry().dim();
+  if (gdim != 2 and gdim != 3)
+  {
+    dolfin_error("X3DOM.cpp",
+                 "get X3DOM string representation of a mesh",
+                 "X3D works only for 2D and 3D meshes");
+  }
+
+  // X3D doctype
+  add_x3dom_doctype(xml_node);
+
+  // Add X3D node
+  pugi::xml_node x3d_node = add_x3d_node(xml_node, parameters.get_viewport_size(),
+                                         parameters.get_x3d_stats());
+  dolfin_assert(x3d_node);
+
+  // FIXME: Problem when X3DOM is included in an HTML file that
+  // already has a 'head'.
+
+  // Add head node
+  //pugi::xml_node head_node = x3d_node.append_child("head");
+  //dolfin_assert(head_node);
+
+  // Add meta node to head node, and attributes
+  /*
+  pugi::xml_node meta_node = head_node.append_child("meta");
+  dolfin_assert(meta_node);
+  meta_node.append_attribute("name") = "generator";
+  meta_node.append_attribute("content")
+    = "FEniCS/DOLFIN (http://fenicsproject.org)";
+  */
+
+  // Add scene node
+  pugi::xml_node scene_node = x3d_node.append_child("scene");
+  dolfin_assert(scene_node);
+
+  // Add mesh to 'scene' XML node
+  auto representation = parameters.get_representation();
+  if (representation == X3DOMParameters::Representation::surface_with_edges)
+  {
+    // Add surface and then wireframe
+    add_mesh_data(scene_node, mesh, vertex_data, facet_data, parameters, true);
+    add_mesh_data(scene_node, mesh, {}, {}, parameters, false);
+  }
+  else if (representation == X3DOMParameters::Representation::surface)
+    add_mesh_data(scene_node, mesh, vertex_data, facet_data, parameters, true);
+  else
+    add_mesh_data(scene_node, mesh, {}, {}, parameters, false);
+
+  // Add viewpoint(s)
+  const std::pair<Point, double> position = mesh_centre_and_distance(mesh);
+  add_viewpoint_nodes(scene_node, position.first, position.second,
+                      parameters.get_viewpoint_buttons());
+
+  // Add background color
+  pugi::xml_node background_node = scene_node.append_child("background");
+  dolfin_assert(background_node);
+  background_node.append_child(pugi::node_pcdata);
+  background_node.append_attribute("skyColor")
+    = array_to_string3(parameters.get_background_color()).c_str();
+
+  // Add ambient light
+  pugi::xml_node ambient_light_node = scene_node.append_child("directionalLight");
+  dolfin_assert(ambient_light_node);
+  ambient_light_node.append_child(pugi::node_pcdata);
+  ambient_light_node.append_attribute("ambientIntensity")
+    = parameters.get_ambient_intensity();
+  ambient_light_node.append_attribute("intensity") = 1.0;
+}
+//-----------------------------------------------------------------------------
+void X3DOM::add_mesh_data(pugi::xml_node& xml_node, const Mesh& mesh,
+                          const std::vector<double>& vertex_values,
+                          const std::vector<double>& facet_values,
+                          const X3DOMParameters& parameters,
+                          bool surface)
+{
+  // X3DOM string for surface/wireframe
+  const std::string x3d_type = surface ? "indexedFaceSet" : "indexedLineSet";
+
+  // Get mesh topology and geometry data, and vertex/facet values
+  std::vector<int> topology_data;
+  std::vector<double> geometry_data;
+  std::vector<double> values_data;
+  build_mesh_data(topology_data, geometry_data, values_data,
+                  mesh, vertex_values, facet_values, surface);
+
+  // Add data to XML tree (on root process only)
+  if (dolfin::MPI::rank(mesh.mpi_comm()) == 0)
+  {
+    // Create shape node and append ID attribute
+    pugi::xml_node shape_node = xml_node.append_child("shape");
+    dolfin_assert(shape_node);
+
+    // Create appearance node
+    pugi::xml_node appearance_node = shape_node.append_child("appearance");
+    dolfin_assert(appearance_node);
+
+    // Append color attributes
+    pugi::xml_node material_node = appearance_node.append_child("material");
+    dolfin_assert(material_node);
+    material_node.append_child(pugi::node_pcdata);
+    if (surface)
+    {
+      material_node.append_attribute("diffuseColor")
+        = array_to_string3(parameters.get_diffuse_color()).c_str();
+    }
+
+    material_node.append_attribute("emissiveColor")
+      = array_to_string3(parameters.get_emissive_color()).c_str();
+    material_node.append_attribute("specularColor")
+      = array_to_string3(parameters.get_specular_color()).c_str();
+
+    // Append ??? attributes
+    //
+    material_node.append_attribute("ambientIntensity") = parameters.get_ambient_intensity();
+    material_node.append_attribute("shininess") = parameters.get_shininess();
+    material_node.append_attribute("transparency") = parameters.get_transparency();
+
+    // Add edges node
+    pugi::xml_node indexed_set_node = shape_node.append_child(x3d_type.c_str());
+    dolfin_assert(indexed_set_node);
+    indexed_set_node.append_attribute("solid") = "false";
+
+    // Add color per vertex attribute
+    const bool color_per_vertex = !vertex_values.empty();
+    indexed_set_node.append_attribute("colorPerVertex") = color_per_vertex;
+
+    // Add topology data to edges node
+    std::stringstream topology_str;
+    for (auto c : topology_data)
+      topology_str << c << " ";
+    indexed_set_node.append_attribute("coordIndex") = topology_str.str().c_str();
+
+    // Add coordinate node
+    pugi::xml_node coordinate_node = indexed_set_node.append_child("coordinate");
+    dolfin_assert(coordinate_node);
+    coordinate_node.append_child(pugi::node_pcdata);
+
+    // Add geometry data to coordinate node
+    std::stringstream geometry_str;
+    for (auto x : geometry_data)
+      geometry_str << x << " ";
+    coordinate_node.append_attribute("point") = geometry_str.str().c_str();
+
+    if (!values_data.empty())
+    {
+      if (color_per_vertex)
+        dolfin_assert(3*values_data.size() == geometry_data.size());
+      else
+        dolfin_assert(4*values_data.size() == topology_data.size());
+
+      // Get min/max values
+      const double value_min = *std::min_element(values_data.begin(),
+                                                 values_data.end());
+      const double value_max = *std::max_element(values_data.begin(),
+                                                 values_data.end());
+
+      const double scale = (value_max == value_min) ? 1.0 : 255.0/(value_max - value_min);
+
+      // Get colour map (256 RGB values)
+      boost::multi_array<float, 2> cmap = parameters.get_color_map_array();
+
+      // Add vertex colors
+      std::stringstream color_values;
+      for (auto x : values_data)
+      {
+        const int cindex = scale*std::abs(x - value_min);
+        dolfin_assert(cindex < (int)cmap.shape()[0]);
+        auto color = cmap[cindex];
+        dolfin_assert(color.shape()[0] == 3);
+        color_values << color[0] << " " << color[1] << " " << color[2] << " ";
+      }
+
+      pugi::xml_node color_node = indexed_set_node.append_child("color");
+      dolfin_assert(color_node);
+      color_node.append_child(pugi::node_pcdata);
+      color_node.append_attribute("color") = color_values.str().c_str();
+    }
+  }
+}
+//-----------------------------------------------------------------------------
+void X3DOM::add_viewpoint_control_option(pugi::xml_node& viewpoint_control_node,
+                                         std::string viewpoint_label)
+{
+  dolfin_assert(viewpoint_control_node);
+  pugi::xml_node viewpoint_buttons_node = viewpoint_control_node.append_child("button");
+
+  const std::string one_click_str = "document.getElementById('" + viewpoint_label + "').setAttribute('set_bind','true');";
+  viewpoint_buttons_node.append_attribute("onclick") = one_click_str.c_str();
+  viewpoint_buttons_node.append_attribute("style") = "display: block; margin: 2%";
+  viewpoint_buttons_node.append_child(pugi::node_pcdata).set_value(viewpoint_label.c_str());
+}
+//-----------------------------------------------------------------------------
+void X3DOM::add_viewpoint_nodes(pugi::xml_node& xml_scene_node,
+                                const Point p, double d,
+                                bool show_viewpoint_buttons)
+{
+  // Default viewpoint
+  add_viewpoint_node(xml_scene_node, Viewpoint::default_view, p, d);
+
+  // Add viewpoint nodes
+  if (show_viewpoint_buttons)
+  {
+    add_viewpoint_node(xml_scene_node, Viewpoint::top, p, d);
+    add_viewpoint_node(xml_scene_node, Viewpoint::bottom, p, d);
+    add_viewpoint_node(xml_scene_node, Viewpoint::left, p, d);
+    add_viewpoint_node(xml_scene_node, Viewpoint::right, p, d);
+    add_viewpoint_node(xml_scene_node, Viewpoint::back, p, d);
+    add_viewpoint_node(xml_scene_node, Viewpoint::front, p, d);
+  }
+}
+//-----------------------------------------------------------------------------
+void X3DOM::add_viewpoint_node(pugi::xml_node& xml_scene_node,
+                               Viewpoint viewpoint,
+                               const Point p, const double d)
+{
+  std::string viewpoint_str;
+  std::string orientation;
+  std::string position;
+
+  // Set viewpoint, orientation and position strings
+  switch (viewpoint)
+  {
+  case Viewpoint::top:
+    viewpoint_str = "top";
+    orientation = "-1 0 0 1.5707963267948";
+    position = array_to_string3({{p[0], p[1] + d - p[2], p[2]}});
+    break;
+  case Viewpoint::bottom:
+    viewpoint_str = "bottom";
+    orientation = "1 0 0 1.5707963267948";
+    position = array_to_string3({{p[0], p[1] - d + p[2], p[2]}});
+    break;
+  case Viewpoint::left:
+    viewpoint_str = "left";
+    orientation = "0 1 0 1.5707963267948";
+    position = array_to_string3({{p[0] + d - p[2], p[1], p[2]}});
+    break;
+  case Viewpoint::right:
+    viewpoint_str = "right";
+    orientation = "0 -1 0 1.5707963267948";
+    position = array_to_string3({{p[0] - d + p[2], p[1], p[2]}});
+    break;
+  case Viewpoint::back:
+    viewpoint_str = "back";
+    orientation = "0 1 0 3.1415926535898";
+    position = array_to_string3({{p[0], p[1], p[2] - d}});
+    break;
+  case Viewpoint::front:
+    viewpoint_str = "front";
+    orientation = "0 0 0 1";
+    position = array_to_string3({{p[0], p[1], d}});
+    break;
+  case Viewpoint::default_view:
+    viewpoint_str = "default";
+    orientation = "-0.7071067812 0.7071067812 0 1";
+    position = array_to_string3({{p[0] + 0.7071067812*(d - p[2]),
+            p[1] + 0.7071067812*(d - p[2]),
+            p[2] + 0.7071067812*(d - p[2])}});
+    break;
+  default:
+    dolfin_error("X3DOM.cpp",
+                 "add viewpoint node",
+                 "Unknown Viewpoint enum");
+    break;
+  }
+
+  // Append the node
+  pugi::xml_node viewpoint_node = xml_scene_node.append_child("viewpoint");
+  dolfin_assert(viewpoint_node);
+  viewpoint_node.append_child(pugi::node_pcdata);
+
+  // Add attributes to node
+  viewpoint_node.append_attribute("id") = viewpoint_str.c_str();
+  viewpoint_node.append_attribute("position") = position.c_str();
+
+  viewpoint_node.append_attribute("orientation") = orientation.c_str();
+  viewpoint_node.append_attribute("fieldOfView") = "0.785398";
+  viewpoint_node.append_attribute("centerOfRotation")
+    = array_to_string3({{p[0], p[1], p[2]}}).c_str();
+
+  viewpoint_node.append_attribute("zNear") = "-1";
+  viewpoint_node.append_attribute("zFar") = "-1";
+}
+//-----------------------------------------------------------------------------
+std::pair<Point, double> X3DOM::mesh_centre_and_distance(const Mesh& mesh)
+{
+  // Get dimensions
+  double xmin = std::numeric_limits<double>::max();
+  double xmax = std::numeric_limits<double>::min();
+  double ymin = std::numeric_limits<double>::max();
+  double ymax = std::numeric_limits<double>::min();
+  double zmin = std::numeric_limits<double>::max();
+  double zmax = std::numeric_limits<double>::min();
+
+  for (VertexIterator v(mesh); !v.end(); ++v)
+  {
+    const Point x = v->point();
+    xmin = std::min(xmin, x[0]);
+    xmax = std::max(xmax, x[0]);
+    ymin = std::min(ymin, x[1]);
+    ymax = std::max(ymax, x[1]);
+    zmin = std::min(zmin, x[2]);
+    zmax = std::max(zmax, x[2]);
+  }
+
+  // Get MPI communicator
+  const MPI_Comm mpi_comm = mesh.mpi_comm();
+
+  xmin = dolfin::MPI::min(mpi_comm, xmin);
+  ymin = dolfin::MPI::min(mpi_comm, ymin);
+  zmin = dolfin::MPI::min(mpi_comm, zmin);
+  xmax = dolfin::MPI::max(mpi_comm, xmax);
+  ymax = dolfin::MPI::max(mpi_comm, ymax);
+  zmax = dolfin::MPI::max(mpi_comm, zmax);
+
+  // Compute midpoint of mesh
+  Point midpoint((xmax + xmin)/2.0, (ymax + ymin)/2.0, (zmax + zmin)/2.0);
+
+  // FIXME: explain this
+  double d = std::max(xmax - xmin, ymax - ymin);
+  d = 2.0*std::max(d, zmax - zmin) + zmax ;
+
+  return {midpoint, d};
+}
+//-----------------------------------------------------------------------------
+std::set<int> X3DOM::surface_vertex_indices(const Mesh& mesh)
+{
+  // Get mesh toplogical dimension
+  const std::size_t tdim = mesh.topology().dim();
+
+  // Initialise connectivities
+  mesh.init(tdim - 1);
+  mesh.init(tdim - 1, 0);
+
+  // Fill set of surface vertex indices
+  std::set<int> vertex_set;
+  for (FaceIterator f(mesh); !f.end(); ++f)
+  {
+    // If in 3D, only output exterior faces
+    // FIXME: num_global_entities not working in serial
+    if (tdim == 2 or f->num_global_entities(tdim) == 1)
+    {
+      for (VertexIterator v(*f); !v.end(); ++v)
+        vertex_set.insert(v->index());
+    }
+  }
+
+  return vertex_set;
+}
+//-----------------------------------------------------------------------------
+void X3DOM::get_function_values(const Function& u,
+                                std::vector<double>& vertex_values,
+                                std::vector<double>& facet_values)
+{
+  // Get dofmap and mesh
+  dolfin_assert(u.function_space()->dofmap());
+  const GenericDofMap& dofmap = *u.function_space()->dofmap();
+  dolfin_assert(u.function_space()->mesh());
+  const Mesh& mesh = *u.function_space()->mesh();
+
+  const std::size_t value_rank = u.value_rank();
+
+  // Print warning for vector-valued functions and error for higher
+  // tensors
+  if (value_rank == 1)
+    warning("X3DOM outputs scalar magnitude of vector field");
+  else if (value_rank > 1)
+  {
+    dolfin_error("X3DOM.cpp",
+                 "write X3D",
+                 "Can only handle scalar and vector Functions");
+  }
+
+  // Test for cell-centred data
+  const std::size_t tdim = mesh.topology().dim();
+  std::size_t cell_based_dim = 1;
+  for (std::size_t i = 0; i < value_rank; i++)
+    cell_based_dim *= tdim;
+  const bool vertex_data = !(dofmap.max_element_dofs() == cell_based_dim);
+
+  if (vertex_data)
+  {
+    // Compute vertex data values
+    u.compute_vertex_values(vertex_values, mesh);
+
+    // Compute l2 norm for vector-valued problems
+    if (value_rank == 1)
+    {
+      const std::size_t num_vertices = mesh.num_vertices();
+      std::vector<double> magnitude(num_vertices);
+      for (std::size_t i = 0; i < num_vertices ; ++i)
+      {
+        double val = 0.0;
+        for (std::size_t j = 0; j < u.value_size() ; j++)
+          val += vertex_values[i + j*num_vertices]*vertex_values[i + j*num_vertices];
+        magnitude[i] = std::sqrt(val);
+      }
+
+      // Swap data_values and magnitude
+      std::swap(vertex_values, magnitude);
+    }
+  }
+  else
+  {
+    if (value_rank != 0)
+    {
+      dolfin_error("X3DOM.cpp",
+                   "create X3DOM",
+                   "Can only handle scalar cell-centered Function at present");
+    }
+
+    if (MPI::size(mesh.mpi_comm()) != 1)
+    {
+      dolfin_error("X3DOM.cpp",
+                   "create X3DOM",
+                   "Cell-centered data not supported in parallel");
+    }
+
+    // Get dofs for cell centered data
+    std::vector<dolfin::la_index> dofs(mesh.num_cells());
+    for (std::size_t i = 0; i != mesh.num_cells(); ++i)
+    {
+      // Get dof index of cell data
+      dolfin_assert(dofmap.num_element_dofs(i) == 1);
+      dofs[i] = dofmap.cell_dofs(i)[0];
+    }
+
+    // Get  values from vector
+    std::vector<double> cell_values(dofs.size());
+    dolfin_assert(u.vector());
+    u.vector()->get_local(cell_values.data(), dofs.size(), dofs.data());
+
+    // FIXME: this is inefficient and a bit random for interior facets
+    // (which we don't need) - so needs a redesign.
+    facet_values.resize(mesh.num_facets());
+    if (tdim == 3)
+    {
+      for (FaceIterator f(mesh); !f.end(); ++f)
+        facet_values[f->index()] = cell_values[f->entities(tdim)[0]];
+    }
+    else
+    {
+      // In 2D, facets and cells are the same thing
+      std::swap(facet_values, cell_values);
+    }
+  }
+}
+//-----------------------------------------------------------------------------
+void X3DOM::build_mesh_data(std::vector<int>& topology,
+                            std::vector<double>& geometry,
+                            std::vector<double>& value_data,
+                            const Mesh& mesh,
+                            const std::vector<double>& vertex_values,
+                            const std::vector<double>& facet_values,
+                            bool surface)
+{
+  // Cannot build data from facets and vertices at the same time
+  dolfin_assert(vertex_values.empty() or facet_values.empty());
+
+  // FIXME: also build value_data from facet_values
+
+  // Get topological dimension
+  const std::size_t tdim = mesh.topology().dim();
+
+  // Intialise facet-to-cell connectivity
+  mesh.init(tdim - 1 , tdim);
+
+  // Get vertex indices
+  const std::set<int> vertex_indices = surface_vertex_indices(mesh);
+
+  std::size_t offset = dolfin::MPI::global_offset(mesh.mpi_comm(),
+                                                  vertex_indices.size(), true);
+
+  // Collect up topology of the local part of the mesh which should be
+  // displayed
+  std::vector<int> local_topology;
+  std::vector<double> local_values;
+  std::vector<int> local_facet_indices;
+  if (surface)
+  {
+    // Build face data structure
+    for (FaceIterator f(mesh); !f.end(); ++f)
+    {
+      if (tdim == 2 or f->num_global_entities(tdim) == 1)
+      {
+        local_facet_indices.push_back(f->index());
+
+        for (VertexIterator v(*f); !v.end(); ++v)
+        {
+          // Find position of vertex in set
+          std::size_t index = v->index();
+          std::size_t pos = std::distance(vertex_indices.begin(),
+                                          vertex_indices.find(index));
+          local_topology.push_back(pos + offset);
+        }
+
+        // Add -1 to denote end of entity
+        local_topology.push_back(-1);
+      }
+    }
+  }
+  else
+  {
+    // Build edge data structure
+    for (EdgeIterator e(mesh); !e.end(); ++e)
+    {
+      // For 3D, check if one of the faces connected to this edge is
+      // external, in which case we add the edge
+      bool add_edge = true;
+      if (tdim == 3)
+      {
+        add_edge = false;
+        for (FaceIterator f(*e); !f.end(); ++f)
+        {
+          if (f->num_global_entities(tdim) == 1)
+            add_edge = true;
+        }
+      }
+
+      // Add edge to data structure, if required
+      if (add_edge)
+      {
+        for (VertexIterator v(*e); !v.end(); ++v)
+        {
+          // Find position of vertex in set
+          std::size_t index = v->index();
+          std::size_t pos = std::distance(vertex_indices.begin(),
+                                          vertex_indices.find(index));
+          local_topology.push_back(pos + offset);
+        }
+
+        // Add -1 to denote end of entity
+        local_topology.push_back(-1);
+      }
+    }
+  }
+
+  // Gather up all topology on process 0
+  dolfin::MPI::gather(mesh.mpi_comm(), local_topology, topology);
+
+  // Collect up geometry of all local points
+  std::vector<double> local_geometry;
+  for (auto index : vertex_indices)
+  {
+    Vertex v(mesh, index);
+    const Point p = v.point();
+    for (std::size_t i = 0; i < 3; ++i)
+      local_geometry.push_back(p[i]);
+
+    // Add vertex data
+    if (!vertex_values.empty())
+      local_values.push_back(vertex_values[index]);
+  }
+
+  if (!facet_values.empty())
+  {
+    for (auto index : local_facet_indices)
+      local_values.push_back(facet_values[index]);
+  }
+
+  // Gather up all geometry on process 0 and append to xml
+  dolfin::MPI::gather(mesh.mpi_comm(), local_geometry, geometry);
+
+  value_data = local_values;
+}
+//-----------------------------------------------------------------------------
+std::string X3DOM::array_to_string3(std::array<double, 3> x)
+{
+  std::string str = std::to_string(x[0]) + " " + std::to_string(x[1])
+    + " " + std::to_string(x[2]);
+
+  return str;
+}
+//-----------------------------------------------------------------------------
+std::string X3DOM::to_string(pugi::xml_document& xml_doc, unsigned int flags)
+{
+  // Save XML doc to stringstream
+  std::stringstream s;
+  const std::string indent = "  ";
+  xml_doc.save(s, indent.c_str(), flags);
+
+  // Return string
+  return s.str();
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/io/X3DOM.h b/dolfin/io/X3DOM.h
new file mode 100644
index 0000000..ad592ae
--- /dev/null
+++ b/dolfin/io/X3DOM.h
@@ -0,0 +1,322 @@
+// Copyright (C) 2016 Quang T. Ha, Chris Richardson and Garth N. Wells
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef __DOLFIN_X3DOM_H
+#define __DOLFIN_X3DOM_H
+
+#include <array>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+#include <boost/multi_array.hpp>
+
+#include <dolfin/geometry/Point.h>
+
+// TODO:
+// - Can we order vertices so that attribute 'solid' can be set to true?
+// - Add ambient intensity parameter
+// - Test and add more sanity checks for Functions
+// - Add support for GenericFunction
+// - Add support for MeshFunctions
+// - Add support for DG1 Functions
+// - Add vector support (arrows) - including correct placement for RT0 etc. - advanced
+// - Document all class methods below properly
+
+namespace pugi
+{
+  class xml_node;
+  class xml_document;
+}
+
+namespace dolfin
+{
+
+  /// Class data to store X3DOM view parameters.
+  class X3DOMParameters
+  {
+    // Developer note: X3DOMParameters is declared outside the X3DOM
+    // class because SWIG cannot wrap nested classes.
+
+  public:
+
+    /// X3DOM representation type
+    enum class Representation {surface, surface_with_edges, wireframe};
+
+    /// Constructor (with default parameter settings)
+    X3DOMParameters();
+
+    /// Set representation of object (wireframe, surface or
+    /// surface_with_edges)
+    void set_representation(Representation representation);
+
+    /// Get the current representation of the object (wireframe, surface or
+    /// surface_with_edges)
+    Representation get_representation() const;
+
+    /// Get the size of the viewport
+    std::array<double, 2> get_viewport_size() const;
+
+    /// Set the RGB color of the object
+    void set_diffuse_color(std::array<double, 3> rgb);
+
+    /// Get the RGB diffuse color of the object
+    std::array<double, 3> get_diffuse_color() const;
+
+    /// Set the RGB emissive color
+    void set_emissive_color(std::array<double, 3> rgb);
+
+    /// Get the RGB emissive color
+    std::array<double, 3> get_emissive_color() const;
+
+    /// Set the RGB specular color
+    void set_specular_color(std::array<double, 3> rgb);
+    std::array<double, 3> get_specular_color() const;
+
+    /// Set background RGB color
+    void set_background_color(std::array<double, 3> rgb);
+
+    /// Get background RGB color
+    std::array<double, 3> get_background_color() const;
+
+    /// Set the ambient lighting intensity
+    void set_ambient_intensity(double intensity);
+
+    /// Get the ambient lighting intensity
+    double get_ambient_intensity() const;
+
+    /// Set the surface shininess of the object
+    void set_shininess(double shininess);
+
+    /// Set the surface shininess of the object
+    double get_shininess() const;
+
+    /// Set the transparency (0-1)
+    void set_transparency(double transparency);
+
+    /// Get the transparency (0-1)
+    double get_transparency() const;
+
+    /// Set the color map by supplying a vector of 768 values
+    /// (256*RGB) (using std::vector for Python compatibility via
+    /// SWIG)
+    void set_color_map(const std::vector<double>& color_data);
+
+    /// Get the color map as a vector of 768 values (256*RGB) (using
+    /// std::vector for Python compatibility via SWIG)
+    std::vector<double> get_color_map() const;
+
+    /// Get the color map as a boost::multi_array (256x3)
+    boost::multi_array<float, 2> get_color_map_array() const;
+
+    /// Toggle viewpoint buttons
+    void set_viewpoint_buttons(bool show);
+
+    /// Get the viewpoint button state
+    bool get_viewpoint_buttons() const;
+
+    /// Turn X3D 'statistics' window on/off
+    void set_x3d_stats(bool show);
+
+    // Get the state of the 'statistics' window
+    bool get_x3d_stats() const;
+
+  private:
+
+    // Check that RGB colors are valid. Throws error if value is
+    // not invalid.
+    static void check_rgb(std::array<double, 3>& rgb);
+
+    // Check that value is valid. Throws error if value is not
+    // invalid.
+    static void check_value_range(double value, double lower, double upper);
+
+    // Return a default RGB color map (256 values)
+    static boost::multi_array<float, 2> default_color_map();
+
+    // Surface, surface with edges or wireframe
+    Representation _representation;
+
+    // Dimensions of viewing area
+    std::array<double, 2> _size;
+
+    // Toggle view point buttons
+    bool _show_viewpoints;
+
+    // TODO: document
+    // RGB colours, see http://doc.x3dom.org/author/Shape/Material.html
+    std::array<double, 3> _diffuse_color, _emissive_color, _specular_color,
+      _background_color;
+
+    // TODO: document
+    double _ambient_intensity, _shininess, _transparency;
+
+    // RGB color map (256 values)
+    boost::multi_array<float, 2> _color_map;
+
+    // Turn X3D stats on/off
+    bool _show_x3d_stats;
+  };
+
+  // Forward declarations
+  class Function;
+  class Mesh;
+  class Point;
+
+  /// This class implements output of meshes to X3DOM XML or HTML5
+  /// with X3DOM strings. The latter can be used for interactive visualisation
+  ///
+  /// Developer note: pugixml is used to created X3DOM and HTML5. By
+  /// using pugixml, we produce valid XML, but care must be taken that
+  /// the XML is also valid HTML. This includes not letting pugixml
+  /// create self-closing elements, in cases. E.g., <foo
+  /// bar="foobar"></foo> is fine, but the self-closing syntax <foo
+  /// bar="foobar" /> while being valid XML is is not valid HTML5. See
+  /// https://github.com/x3dom/x3dom/issues/600.
+
+  class X3DOM
+  {
+  public:
+
+    /// Return X3D string for a Mesh
+    static std::string str(const Mesh& mesh,
+                           X3DOMParameters parameters=X3DOMParameters());
+
+    /// Return X3D string for a Function
+    static std::string str(const Function& u,
+                           X3DOMParameters parameters=X3DOMParameters());
+
+    /// Return HTML5 string with embedded X3D for a Mesh
+    static std::string html(const Mesh& mesh,
+                            X3DOMParameters parameters=X3DOMParameters());
+
+
+    /// Return HTML5 string with embedded X3D for a Function
+    static std::string html(const Function& u,
+                            X3DOMParameters parameters=X3DOMParameters());
+
+
+    // Build X3DOM pugixml tree for a Mesh
+    static void
+      build_x3dom_tree(pugi::xml_document& xml_doc,
+                       const Mesh& mesh,
+                       const X3DOMParameters& parameters=X3DOMParameters());
+
+    // Build X3DOM pugixml tree for a Function
+    static void
+      build_x3dom_tree(pugi::xml_document& xml_doc,
+                       const Function& u,
+                       const X3DOMParameters& parameters=X3DOMParameters());
+
+  private:
+
+    // FIXME: This should be a C++11 style enum (enum Viewpoint class
+    // {...};), but a Swig bug needs fixing
+    // (https://github.com/swig/swig/issues/594)
+    enum  Viewpoint {top, bottom, left, right, back, front, default_view};
+
+    // Build X3DOM pugixml tree
+    static void x3dom(pugi::xml_document& xml_doc, const Mesh& mesh,
+                      const std::vector<double>& vertex_values,
+                      const std::vector<double>& facet_values,
+                      const X3DOMParameters& parameters);
+
+    // Build HTML pugixml tree
+    static void html(pugi::xml_document& xml_doc, const Mesh& mesh,
+                     const std::vector<double>& vertex_values,
+                     const std::vector<double>& facet_values,
+                     const X3DOMParameters& parameters);
+
+    // Add HTML preamble (HTML) to XML doc and return 'html' node
+    static pugi::xml_node add_html_preamble(pugi::xml_node& xml_node);
+
+    // Add X3D doctype (an XML document should have no more than one
+    // doc_type node)
+    static void add_x3dom_doctype(pugi::xml_node& xml_node);
+
+    // Add HTML doctype (an XML document should have no more than one
+    // doc_type node)
+    static void add_html_doctype(pugi::xml_node& xml_node);
+
+    // Add X3D node and attributes, and return handle to node (x3D)
+    static pugi::xml_node add_x3d_node(pugi::xml_node& xml_node,
+                                       std::array<double, 2> size,
+                                       bool show_stats);
+
+    // Add X3DOM Mesh data to XML node (X3D)
+    static void add_x3dom_data(pugi::xml_node& xml_node, const Mesh& mesh,
+                               const std::vector<double>& vertex_values,
+                               const std::vector<double>& facet_values,
+                               const X3DOMParameters& parameters);
+
+    // Add mesh topology and geometry to XML. 'surface' flag controls
+    // surface vs wireframe representation (X3D)
+    static void add_mesh_data(pugi::xml_node& xml_node, const Mesh& mesh,
+                              const std::vector<double>& vertex_values,
+                              const std::vector<double>& facet_values,
+                              const X3DOMParameters& parameters,
+                              bool surface);
+
+    // Add viewpoint control (HTML)
+    static void add_viewpoint_control_option(pugi::xml_node& viewpoint_control,
+                                             std::string viewpoint);
+
+    // Add a collection viewpoint nodes (X3D)
+    static void add_viewpoint_nodes(pugi::xml_node& xml_scene,
+                                    const Point p, double d,
+                                    bool show_viewpoint_buttons);
+
+    // Add a single viewpoint node (X3D)
+    static void add_viewpoint_node(pugi::xml_node& xml_scene,
+                                   Viewpoint viewpoint,
+                                   const Point p,
+                                   const double s);
+
+    // Get centre point of mesh bounds, and a reasonable viewpoint
+    // distance from it
+    static std::pair<Point, double> mesh_centre_and_distance(const Mesh& mesh);
+
+    // Get list of vertex indices which are on surface
+    static std::set<int> surface_vertex_indices(const Mesh& mesh);
+
+    // Get the values of a function at vertices, (or on facets for P0)
+    static void get_function_values(const Function& u,
+                                    std::vector<double>& vertex_values,
+                                    std::vector<double>& facet_values);
+
+    // Build topology and geometry data from a Mesh ready for X3DOM
+    // output
+    static void build_mesh_data(std::vector<int>& topology,
+                                std::vector<double>& geometry,
+                                std::vector<double>& value_data,
+                                const Mesh& mesh,
+                                const std::vector<double>& vertex_values,
+                                const std::vector<double>& facet_values,
+                                bool surface);
+
+    // Return "x[0] x[1] x[2]" string from array of color RGB
+    static std::string array_to_string3(std::array<double, 3> x);
+
+    // Utility to convert pugi::xml_document into a std::string
+    static std::string to_string(pugi::xml_document& xml_doc,
+                                 unsigned int flags);
+
+  };
+
+}
+
+#endif
diff --git a/dolfin/io/XDMFFile.cpp b/dolfin/io/XDMFFile.cpp
index 41687ec..663ea70 100644
--- a/dolfin/io/XDMFFile.cpp
+++ b/dolfin/io/XDMFFile.cpp
@@ -17,57 +17,66 @@
 //
 // Modified by Garth N. Wells, 2012
 
-#ifdef HAS_HDF5
-
 #include <iomanip>
+#include <memory>
 #include <ostream>
 #include <sstream>
 #include <string>
 #include <vector>
 #include <boost/algorithm/string.hpp>
+#include <boost/container/vector.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/format.hpp>
+#include <boost/lexical_cast.hpp>
+#include "pugixml.hpp"
 
 #include <dolfin/common/MPI.h>
+#include <dolfin/common/defines.h>
+#include <dolfin/common/utils.h>
 #include <dolfin/function/Function.h>
 #include <dolfin/function/FunctionSpace.h>
 #include <dolfin/fem/GenericDofMap.h>
 #include <dolfin/la/GenericVector.h>
 #include <dolfin/mesh/Cell.h>
 #include <dolfin/mesh/DistributedMeshTools.h>
+#include <dolfin/mesh/Edge.h>
+#include <dolfin/mesh/LocalMeshData.h>
 #include <dolfin/mesh/MeshEntityIterator.h>
 #include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MeshEditor.h>
+#include <dolfin/mesh/MeshPartitioning.h>
+#include <dolfin/mesh/MeshValueCollection.h>
 #include <dolfin/mesh/Vertex.h>
+#include <dolfin/parameter/GlobalParameters.h>
 #include "HDF5File.h"
 #include "HDF5Utility.h"
 #include "XDMFFile.h"
 #include "XDMFxml.h"
+#include "xmlutils.h"
 
 using namespace dolfin;
 
 //----------------------------------------------------------------------------
 XDMFFile::XDMFFile(MPI_Comm comm, const std::string filename)
-  : GenericFile(filename, "XDMF"), _mpi_comm(comm)
+  : _mpi_comm(comm), _hdf5_filemode(""), _current_mesh_name(""),
+    _filename(filename), _counter(0), _xml(new XDMFxml(filename))
 {
-  // Make name for HDF5 file (used to store data)
-  boost::filesystem::path p(filename);
-  p.replace_extension(".h5");
-  hdf5_filename = p.string();
-
-  // File mode will be set when reading or writing
-  hdf5_filemode = "";
-
   // Rewrite the mesh at every time step in a time series. Should be
   // turned off if the mesh remains constant.
   parameters.add("rewrite_function_mesh", true);
 
+  // FIXME: This is only relevant to HDF5
   // Flush datasets to disk at each timestep. Allows inspection of the
   // HDF5 file whilst running, at some performance cost.
   parameters.add("flush_output", false);
 
-  // HDF5 file restart interval. Use 0 to collect all output in one file.
+  // FIXME: This is only relevant to HDF5
+  // HDF5 file restart interval. Use 0 to collect all output in one
+  // file.
   parameters.add("multi_file", 0);
 
+  // Whether to save multi-dataset files as time series, or flat
+  parameters.add("time_series", true);
 }
 //----------------------------------------------------------------------------
 XDMFFile::~XDMFFile()
@@ -75,172 +84,140 @@ XDMFFile::~XDMFFile()
   // Do nothing
 }
 //----------------------------------------------------------------------------
-void XDMFFile::write_quadratic(const Function& u_geom, const Function& u_val)
+void XDMFFile::write(const Mesh& mesh, Encoding encoding)
 {
-  // Experimental. For now, just work with one h5 file, cannot do time
-  // series. Input two P2 Functions, one containing geometry, the
-  // other the values. For a regular mesh, can just interpolate
-  // ("x[0]", "x[1]", "x[2]") onto u_geom.
-
-  boost::filesystem::path p(_filename);
-  p.replace_extension(".h5");
-  hdf5_filename = p.string();
+  write_new(mesh, encoding);
+  return;
 
-  if (counter == 0)
-    hdf5_file.reset(new HDF5File(_mpi_comm, hdf5_filename, "w"));
-  else
-    hdf5_file.reset(new HDF5File(_mpi_comm, hdf5_filename, "a"));
-  hdf5_filemode = "w";
+  check_encoding(encoding);
 
-  // Get mesh and dofmap
-  dolfin_assert(u_geom.function_space()->mesh());
-  dolfin_assert(u_val.function_space()->mesh());
-  dolfin_assert (u_val.function_space()->mesh()->id()
-                 == u_geom.function_space()->mesh()->id());
-  const Mesh& mesh = *u_geom.function_space()->mesh();
+  // Output data name
+  const std::string name = mesh.name();
 
-  const std::size_t tdim = mesh.topology().dim();
+  // Topological and geometric dimensions
   const std::size_t gdim = mesh.geometry().dim();
+  const std::size_t cell_dim = mesh.topology().dim();
 
-  // FIMXE: Could work in 1D, but not yet tested
-  dolfin_assert(tdim == 2 or tdim == 3);
-
-  dolfin_assert(u_geom.function_space()->dofmap());
-  const GenericDofMap& geom_dofmap = *u_geom.function_space()->dofmap();
-
-  // Should be vector components on each edge and vertex
-  dolfin_assert(geom_dofmap.num_entity_dofs(0) == gdim);
-  dolfin_assert(geom_dofmap.num_entity_dofs(1) == gdim);
-
-  // Number of local cells
-  const std::size_t n_cells = mesh.topology().ghost_offset(tdim);
-  std::vector<dolfin::la_index> cell_topology;
+  // Make sure entities are numbered
+  DistributedMeshTools::number_entities(mesh, cell_dim);
 
-  std::vector<std::size_t> local_to_global_map;
-  geom_dofmap.tabulate_local_to_global_dofs(local_to_global_map);
+  // Get number of global cells and points
+  const std::size_t num_global_cells = mesh.size_global(cell_dim);
+  std::size_t num_total_points = 0;
+  for (std::size_t i = 0; i <= mesh.topology().dim(); ++i)
+  {
+    num_total_points +=
+      mesh.geometry().num_entity_coordinates(i)*mesh.size_global(i);
+  }
 
-  // Mapping from dofs to XDMF Edge_3, Tri_6 and Tet_10 layout
-  std::vector<std::size_t> node_mapping;
-  if (tdim == 1)
-    node_mapping = {0, 1, 2};
-  else if (tdim == 2)
-    node_mapping = {0, 1, 2, 5, 3, 4};
-  else
-    node_mapping = {0, 1, 2, 3, 9, 6, 8, 7, 5, 4};
+  const std::string group_name = "/Mesh/" + name;
 
-  // NB relies on the x-component coming first, and ordering xyxy or
-  // xyzxyz etc.
-  for (std::size_t i = 0; i != n_cells; ++i)
+  // Write hdf5 file on all processes
+  if (encoding == Encoding::HDF5)
   {
-    const dolfin::ArrayView<const dolfin::la_index>& cell_dofs_i
-      = geom_dofmap.cell_dofs(i);
-    dolfin_assert(cell_dofs_i.size() == node_mapping.size() * gdim);
-
-    for (auto &node : node_mapping)
+#ifdef HAS_HDF5
+    // Write mesh to HDF5 file
+    // The XML below will obliterate any existing XDMF file
+    if (_hdf5_filemode != "w")
     {
-      const dolfin::la_index idx = cell_dofs_i[node];
-      dolfin_assert(idx < (dolfin::la_index)local_to_global_map.size());
-      cell_topology.push_back(local_to_global_map[idx]/gdim);
+      // Create HDF5 file (truncate)
+      _hdf5_file.reset(new HDF5File(mesh.mpi_comm(),
+                       get_hdf5_filename(_filename), "w"));
+      _hdf5_filemode = "w";
     }
+    _hdf5_file->write(mesh, cell_dim, group_name);
+#else
+    dolfin_error("XDMFile.cpp", "write Mesh", "Need HDF5 support");
+#endif
   }
 
-  const bool mpi_io = MPI::size(_mpi_comm) > 1 ? true : false;
-
-  // Save cell topologies
-  std::vector<std::size_t> global_size(2);
-  global_size[0]
-    = MPI::sum(_mpi_comm, cell_topology.size())/node_mapping.size();
-  global_size[1] = node_mapping.size();
-
-  const std::string h5_mesh_name = "/Mesh/" + std::to_string(counter);
-  current_mesh_name = p.filename().string() + ":" + h5_mesh_name;
-
-  hdf5_file->write_data(h5_mesh_name + "/topology", cell_topology, global_size,
-                        mpi_io);
-
-  // Save coordinates
-  hdf5_file->write(*u_geom.vector(), h5_mesh_name + "/coordinates");
-
-  // Save values
-  const std::string dataset_name = "/Function/" + std::to_string(counter)
-    + "/values";
-  hdf5_file->write(*u_val.vector(), dataset_name);
+  // Write the XML meta description on process zero
+  if (MPI::rank(mesh.mpi_comm()) == 0)
+  {
+    dolfin_assert(_xml);
+    _xml->init_mesh(name);
 
-  const std::size_t value_rank = u_val.value_rank();
-  const std::size_t value_size = u_val.value_size();
+    // Write the topology
+    std::string topology_xml_value;
 
-  if (MPI::rank(_mpi_comm) == 0)
-  {
-    XDMFxml xml(_filename);
+    if (encoding == Encoding::ASCII)
+      topology_xml_value = generate_xdmf_ascii_mesh_topology_data(mesh);
+    else if (encoding == Encoding::HDF5)
+    {
+      const boost::filesystem::path p(get_hdf5_filename(_filename));
+      topology_xml_value = p.filename().string() + ":" + group_name
+        + "/topology";
+    }
 
-    const std::size_t num_total_vertices = u_geom.vector()->size()/gdim;
-    const std::size_t num_global_cells = global_size[0];
+    // Describe topological connectivity
+    _xml->mesh_topology(mesh.type().cell_type(), mesh.geometry().degree(),
+                       num_global_cells, topology_xml_value,
+                       xdmf_format_str(encoding));
 
-    std::string function_name = u_val.name();
-    xml.init_timeseries(function_name, (double)counter, counter);
+    // Write the geometry
+    std::string geometry_xml_value;
 
-    boost::filesystem::path p(hdf5_filename);
-    const std::string mesh_ref = p.filename().string() + ":" + h5_mesh_name;
-    const std::string data_ref = p.filename().string() + ":" + dataset_name;
+    if (encoding == Encoding::ASCII)
+      geometry_xml_value = generate_xdmf_ascii_mesh_geometry_data(mesh);
+    else if (encoding == Encoding::HDF5)
+    {
+      const boost::filesystem::path p(get_hdf5_filename(_filename));
+      geometry_xml_value = p.filename().string() + ":" + group_name
+        + "/coordinates";
+    }
 
-    xml.mesh_topology(mesh.type().cell_type(), 2, num_global_cells, mesh_ref);
-    xml.mesh_geometry(num_total_vertices, gdim, mesh_ref);
+    // Describe geometric coordinates
+    _xml->mesh_geometry(num_total_points, gdim, geometry_xml_value,
+                        xdmf_format_str(encoding));
 
-    xml.data_attribute(function_name, value_rank, true,
-                       num_total_vertices, num_global_cells,
-                       value_size, data_ref);
-    xml.write();
+    _xml->write();
   }
-
-  ++counter;
-  hdf5_file->close();
 }
 //----------------------------------------------------------------------------
-void XDMFFile::operator<< (const Function& u)
+void XDMFFile::write(const Function& u, Encoding encoding)
 {
-  std::pair<const Function*, double> ut(&u, (double) counter);
-  *this << ut;
+  write(u, (double) _counter, encoding);
 }
 //----------------------------------------------------------------------------
-void XDMFFile::operator<< (const std::pair<const Function*, double> ut)
+void XDMFFile::write(const Function& u, double time_step, Encoding encoding)
 {
-  const int mf_interval = parameters["multi_file"];
+  // FIXME: This function is too long. Breal up.
+
+  check_encoding(encoding);
 
   // Conditions for starting a new HDF5 file
-  if ( (mf_interval != 0 and counter%mf_interval == 0) or hdf5_filemode != "w" )
+#ifdef HAS_HDF5
+  if (encoding == Encoding::HDF5)
   {
-    // Make name for HDF5 file (used to store data)
-    boost::filesystem::path p(_filename);
-    p.replace_extension(".h5");
-    hdf5_filename = p.string();
-
-    if (mf_interval != 0)
+    std::string hdf5_filename = get_hdf5_filename(_filename);
+    const int mf_interval = parameters["multi_file"];
+    if ((mf_interval != 0 and _counter % mf_interval == 0)
+        or _hdf5_filemode != "w" )
     {
-      std::stringstream s;
-      s << std::setw(6) << std::setfill('0') << counter;
-      hdf5_filename += "_" + s.str();
+      if (mf_interval != 0)
+      {
+        std::stringstream s;
+        s << std::setw(6) << std::setfill('0') << _counter;
+        hdf5_filename += "_" + s.str();
+      }
+
+      // Create new HDF5 file (truncate),
+      // closing any open file from a previous timestep
+      _hdf5_file.reset(new HDF5File(_mpi_comm, hdf5_filename, "w"));
+      _hdf5_filemode = "w";
     }
 
-    // Create new HDF5 file (truncate),
-    // closing any open file from a previous timestep
-    hdf5_file.reset(new HDF5File(_mpi_comm, hdf5_filename, "w"));
-    hdf5_filemode = "w";
+    dolfin_assert(_hdf5_file);
   }
-
-  dolfin_assert(hdf5_file);
-
-  // Access Function, Mesh, dofmap  and time step
-  dolfin_assert(ut.first);
-  const Function& u = *(ut.first);
+#endif
 
   dolfin_assert(u.function_space()->mesh());
   const Mesh& mesh = *u.function_space()->mesh();
+  const std::size_t degree = mesh.geometry().degree();
 
   dolfin_assert(u.function_space()->dofmap());
   const GenericDofMap& dofmap = *u.function_space()->dofmap();
 
-  const double time_step = ut.second;
-
   // Geometric and topological dimension
   const std::size_t gdim = mesh.geometry().dim();
   const std::size_t tdim = mesh.topology().dim();
@@ -249,55 +226,35 @@ void XDMFFile::operator<< (const std::pair<const Function*, double> ut)
   const std::size_t value_rank = u.value_rank();
   const std::size_t value_size = u.value_size();
 
+  // For 2D vectors and tensors, pad out values with zeros to make 3D
+  // (XDMF does not support 2D data)
   std::size_t padded_value_size = value_size;
+  if (value_rank > 0)
+  {
+    if (value_size == 2)
+      padded_value_size = 3;
+    if (value_size == 4)
+      padded_value_size = 9;
+  }
 
   // Test for cell-centred data
   std::size_t cell_based_dim = 1;
   for (std::size_t i = 0; i < value_rank; i++)
     cell_based_dim *= tdim;
-  const bool vertex_data = !(dofmap.max_element_dofs() == cell_based_dim);
 
-  // Get number of local/global cells/vertices
-  const std::size_t num_local_cells = mesh.topology().ghost_offset(tdim);
-  const std::size_t num_local_vertices = mesh.num_vertices();
-  const std::size_t num_global_cells = mesh.size_global(tdim);
+  const bool vertex_data = !(dofmap.max_element_dofs() == cell_based_dim);
 
   // Get Function data at vertices/cell centres
   std::vector<double> data_values;
-
   if (vertex_data)
-  {
-    u.compute_vertex_values(data_values, mesh);
-
-    // Interleave the values for vector or tensor fields and pad 2D
-    // vectors and tensors to 3D
-    if (value_rank > 0)
-    {
-      if (value_size == 2)
-        padded_value_size = 3;
-      if (value_size == 4)
-        padded_value_size = 9;
-
-      std::vector<double> _data_values(padded_value_size*num_local_vertices,
-                                       0.0);
-      for (std::size_t i = 0; i < num_local_vertices; i++)
-      {
-        for (std::size_t j = 0; j < value_size; j++)
-        {
-          std::size_t tensor_2d_offset = (j > 1 && value_size == 4) ? 1 : 0;
-          _data_values[i*padded_value_size + j + tensor_2d_offset]
-              = data_values[i + j*num_local_vertices];
-        }
-      }
-      data_values = _data_values;
-    }
-  }
+    get_point_data_values(data_values, padded_value_size, u);
   else
   {
     dolfin_assert(u.function_space()->dofmap());
     dolfin_assert(u.vector());
 
     // Allocate memory for function values at cell centres
+    const std::size_t num_local_cells = mesh.topology().ghost_offset(tdim);
     const std::size_t size = num_local_cells*value_size;
 
     // Build lists of dofs and create map
@@ -313,8 +270,8 @@ void XDMFFile::operator<< (const std::pair<const Function*, double> ut)
         dof_set.push_back(dofs[i]);
 
       // Add local dimension to cell offset and increment
-      *(cell_offset + 1)
-        = *(cell_offset) + dofmap.num_element_dofs(cell->index());
+      *(cell_offset + 1) = *(cell_offset)
+        + dofmap.num_element_dofs(cell->index());
       ++cell_offset;
     }
 
@@ -323,11 +280,6 @@ void XDMFFile::operator<< (const std::pair<const Function*, double> ut)
     dolfin_assert(u.vector());
     u.vector()->get_local(data_values.data(), dof_set.size(), dof_set.data());
 
-    if (value_size == 2)
-      padded_value_size = 3;
-    if (value_size == 4)
-      padded_value_size = 9;
-
     cell_offset = offset.begin();
     std::vector<double> _data_values(padded_value_size*num_local_cells, 0.0);
     std::size_t count = 0;
@@ -352,6 +304,7 @@ void XDMFFile::operator<< (const std::pair<const Function*, double> ut)
           _data_values[count++] = data_values[*cell_offset + 2*i + 1];
           ++count;
         }
+
         count += 3;
         ++cell_offset;
       }
@@ -363,6 +316,7 @@ void XDMFFile::operator<< (const std::pair<const Function*, double> ut)
       {
         for (std::size_t i = 0; i < value_size; i++)
           _data_values[count++] = data_values[*cell_offset + i];
+
         ++cell_offset;
       }
     }
@@ -372,335 +326,1786 @@ void XDMFFile::operator<< (const std::pair<const Function*, double> ut)
   // FIXME: Below is messy. Should query HDF5 file writer for existing
   //        mesh name
   // Write mesh to HDF5 file
-  if (parameters["rewrite_function_mesh"] || counter == 0)
+  if (parameters["rewrite_function_mesh"] || _counter == 0)
   {
-    const std::string h5_mesh_name = "/Mesh/" + std::to_string(counter);
-    boost::filesystem::path p(hdf5_filename);
-    current_mesh_name = p.filename().string() + ":" + h5_mesh_name;
-    hdf5_file->write(mesh, h5_mesh_name);
+    if (encoding == Encoding::HDF5)
+    {
+#ifdef HAS_HDF5
+      const std::string h5_mesh_name = "/Mesh/" + std::to_string(_counter);
+      boost::filesystem::path p(get_hdf5_filename(_filename));
+      _current_mesh_name = p.filename().string() + ":" + h5_mesh_name;
+      _hdf5_file->write(mesh, h5_mesh_name);
+#endif
+    }
+    else if (encoding == Encoding::ASCII)
+      _current_mesh_name = "/Xdmf/Domain/Grid";
   }
 
-  // Remove duplicates for vertex-based data
-  std::vector<std::size_t> global_size(2);
+  const bool mpi_io = MPI::size(mesh.mpi_comm()) > 1 ? true : false;
+  std::vector<std::int64_t> global_size(2);
   global_size[1] = padded_value_size;
+
+  std::size_t num_global_points = mesh.size_global(0);
+  const std::size_t num_global_cells = mesh.size_global(tdim);
   if (vertex_data)
   {
-    DistributedMeshTools::reorder_values_by_global_indices(mesh, data_values,
-                                                           padded_value_size);
-    global_size[0] = mesh.size_global(0);
+    if (degree == 2)
+    {
+      dolfin_assert(!mpi_io);
+      num_global_points = mesh.size(0) + mesh.size(1);
+      global_size[0] = num_global_points;
+    }
+    else
+    {
+      // Remove duplicates for vertex-based data in parallel
+      DistributedMeshTools::reorder_values_by_global_indices(mesh, data_values,
+                                                             padded_value_size);
+      global_size[0] = num_global_points;
+    }
   }
   else
-    global_size[0] = mesh.size_global(tdim);
+    global_size[0] = num_global_cells;
 
   // Save data values to HDF5 file.  Vertex/cell values are saved in
   // the hdf5 group /VisualisationVector as distinct from /Vector
   // which is used for solution vectors.
+
   const std::string dataset_name = "/VisualisationVector/"
-    + std::to_string(counter);
+                                   + std::to_string(_counter);
 
-  const bool mpi_io = MPI::size(mesh.mpi_comm()) > 1 ? true : false;
-  hdf5_file->write_data(dataset_name, data_values, global_size, mpi_io);
+#ifdef HAS_HDF5
+  if (encoding == Encoding::HDF5)
+  {
+    _hdf5_file->write_data(dataset_name, data_values, global_size, mpi_io);
 
-  // Flush file. Improves chances of recovering data if
-  // interrupted. Also makes file somewhat readable between writes.
-  if (parameters["flush_output"])
-    hdf5_file->flush();
+    // Flush file. Improves chances of recovering data if
+    // interrupted. Also makes file somewhat readable between writes.
+    if (parameters["flush_output"])
+      _hdf5_file->flush();
+  }
+#endif
 
   // Write the XML meta description (see http://www.xdmf.org) on
   // process zero
-  const std::size_t num_total_vertices = mesh.size_global(0);
+
   if (MPI::rank(mesh.mpi_comm()) == 0)
   {
-    XDMFxml xml(_filename);
-    xml.init_timeseries(u.name(), time_step, counter);
-    xml.mesh_topology(mesh.type().cell_type(), 1, num_global_cells, current_mesh_name);
-    xml.mesh_geometry(num_total_vertices, gdim, current_mesh_name);
+    dolfin_assert(_xml);
+    _xml->init_timeseries(u.name(), time_step, _counter);
 
-    boost::filesystem::path p(hdf5_filename);
-    xml.data_attribute(u.name(), value_rank, vertex_data,
-                       num_total_vertices, num_global_cells,
-                       padded_value_size,
-                       p.filename().string() + ":" + dataset_name);
-    xml.write();
+    if (encoding == Encoding::HDF5)
+    {
+      _xml->mesh_topology(mesh.type().cell_type(), degree,
+                          num_global_cells, _current_mesh_name + "/topology",
+                          xdmf_format_str(encoding));
+      _xml->mesh_geometry(num_global_points, gdim,
+                          _current_mesh_name + "/coordinates",
+                          xdmf_format_str(encoding));
+
+      boost::filesystem::path p(get_hdf5_filename(_filename));
+      _xml->data_attribute(u.name(), value_rank, vertex_data,
+                           num_global_points, num_global_cells,
+                           padded_value_size,
+                           p.filename().string() + ":" + dataset_name,
+                           xdmf_format_str(encoding));
+    }
+    else if (encoding == Encoding::ASCII)
+    {
+      // Add the mesh topology and geometry to the xml data
+      std::string topology_data = generate_xdmf_ascii_mesh_topology_data(mesh);
+      std::string geometry_data = generate_xdmf_ascii_mesh_geometry_data(mesh);
+
+      _xml->mesh_topology(mesh.type().cell_type(), degree,
+                          num_global_cells, topology_data,
+                          xdmf_format_str(encoding));
+      _xml->mesh_geometry(num_global_points, gdim, geometry_data,
+                          xdmf_format_str(encoding));
+
+      // Add the Function vertex data to the xml data
+      _xml->data_attribute(u.name(), value_rank, vertex_data,
+                           num_global_points, num_global_cells,
+                           padded_value_size,
+                           generate_xdmf_ascii_data(data_values, "%.15e"),
+                           xdmf_format_str(encoding));
+    }
+    _xml->write();
   }
 
   // Increment counter
-  counter++;
+  ++_counter;
 }
 //----------------------------------------------------------------------------
-void XDMFFile::operator>> (Mesh& mesh)
+void XDMFFile::write(const MeshFunction<bool>& meshfunction, Encoding encoding)
 {
-  read(mesh, false);
+  write_mesh_function(meshfunction, "%d", encoding);
 }
-//-----------------------------------------------------------------------------
-void XDMFFile::read(Mesh& mesh, bool use_partition_from_file)
+//----------------------------------------------------------------------------
+void XDMFFile::write(const MeshFunction<int>& meshfunction, Encoding encoding)
 {
-  // Prepare HDF5 file
-  if (hdf5_filemode != "r")
-  {
-    hdf5_file.reset(new HDF5File(_mpi_comm, hdf5_filename, "r"));
-    hdf5_filemode = "r";
-  }
-  dolfin_assert(hdf5_file);
-
-  XDMFxml xml(_filename);
-  xml.read();
-
-  // Try to read the mesh from the associated HDF5 file
-  hdf5_file->read(mesh, "/Mesh/" + xml.meshname(), use_partition_from_file);
+  write_mesh_function(meshfunction, "%d", encoding);
+}
+//----------------------------------------------------------------------------
+void XDMFFile::write(const MeshFunction<std::size_t>& meshfunction,
+                     Encoding encoding)
+{
+  write_mesh_function(meshfunction, "%d", encoding);
 }
 //----------------------------------------------------------------------------
-void XDMFFile::operator<< (const Mesh& mesh)
+void XDMFFile::write(const MeshFunction<double>& meshfunction,
+                     Encoding encoding)
+{
+  write_mesh_function(meshfunction, "%.15e", encoding);
+}
+//-----------------------------------------------------------------------------
+void XDMFFile::write(const MeshValueCollection<std::size_t>& mvc,
+                     Encoding encoding)
 {
-  // Write Mesh to HDF5 file
+  //FIXME: make work with ASCII encoding or call dolfin_not_implemented()
+  check_encoding(encoding);
 
-  if (hdf5_filemode != "w")
-  {
-    // Create HDF5 file (truncate)
-    hdf5_file.reset(new HDF5File(mesh.mpi_comm(), hdf5_filename, "w"));
-    hdf5_filemode = "w";
-  }
+  // Provide some very basic functionality for saving
+  // MeshValueCollections mainly for saving values on a boundary mesh
 
-  // Output data name
-  const std::string name = mesh.name();
+  dolfin_assert(mvc.mesh());
+  std::shared_ptr<const Mesh> mesh = mvc.mesh();
 
-  // Topological and geometric dimensions
-  const std::size_t gdim = mesh.geometry().dim();
-  const std::size_t cell_dim = mesh.topology().dim();
+#ifdef HAS_HDF5
+  if (encoding == Encoding::HDF5)
+  {
+    if (_hdf5_filemode != "w")
+    {
+      // Append to existing HDF5 File
+      _hdf5_file.reset(new HDF5File(mesh->mpi_comm(), get_hdf5_filename(_filename), "a"));
+      _hdf5_filemode = "w";
+    }
+  }
+#endif
 
-  // Make sure entities are numbered
-  DistributedMeshTools::number_entities(mesh, cell_dim);
+  if (MPI::sum(mesh->mpi_comm(), mvc.size()) == 0)
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "save empty MeshValueCollection",
+                 "No values in MeshValueCollection");
+  }
 
-  // Get number of global cells and vertices
-  const std::size_t num_global_cells   = mesh.size_global(cell_dim);
-  const std::size_t num_total_vertices = mesh.size_global(0);
+  if (_current_mesh_name == "")
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "save MeshValueCollection",
+                 "A Mesh must be saved first");
+  }
 
-  // Write mesh to HDF5 file
-  // The XML below will obliterate any existing XDMF file
+  const std::size_t cell_dim = mvc.dim();
+  CellType::Type cell_type = mesh->type().entity_type(cell_dim);
 
-  const std::string group_name = "/Mesh/" + name;
-  hdf5_file->write(mesh, cell_dim, group_name);
+  const std::string dataset_name = "/MVC/" + mvc.name();
 
-  // Write the XML meta description on process zero
-  if (MPI::rank(mesh.mpi_comm()) == 0)
+#ifdef HAS_HDF5
+  if (encoding == Encoding::HDF5)
   {
-    XDMFxml xml(_filename);
-    xml.init_mesh(name);
+    // Use HDF5 function to output MeshValueCollection
+    _hdf5_file->write(mvc, dataset_name);
+  }
+#endif
 
-    boost::filesystem::path p(hdf5_filename);
-    const std::string ref = p.filename().string() + ":" + group_name;
+  bool time_series = parameters["time_series"];
 
-    // Describe topological connectivity
-    xml.mesh_topology(mesh.type().cell_type(), 1, num_global_cells, ref);
+  if (MPI::rank(mesh->mpi_comm()) == 0)
+  {
+    dolfin_assert(_xml);
+    if (time_series)
+      _xml->init_timeseries(mvc.name(), (double) _counter, _counter);
+    else
+      _xml->init_mesh(mvc.name());
 
-    // Describe geometric coordinates
-    xml.mesh_geometry(num_total_vertices, gdim, ref);
+    if (encoding == Encoding::HDF5)
+    {
+      boost::filesystem::path p(get_hdf5_filename(_filename));
+      const std::string dataset_ref = p.filename().string() + ":"
+        + dataset_name;
+
+      _xml->mesh_topology(cell_type, 1, mvc.size(), dataset_ref + "/topology",
+                         xdmf_format_str(encoding));
+      _xml->mesh_geometry(mesh->size_global(0), mesh->geometry().dim(),
+                         _current_mesh_name + "/coordinates",
+                         xdmf_format_str(encoding));
+      _xml->data_attribute(mvc.name(), 0, false, mesh->size_global(0),
+                          mvc.size(), 1, dataset_ref + "/values",
+                          xdmf_format_str(encoding));
+    }
+    else if (encoding == Encoding::ASCII)
+    {
+      // FIXME: This will only reference the first mesh geometry
+      _xml->mesh_geometry(mesh->size_global(0), mesh->geometry().dim(),
+                         _current_mesh_name + "/Geometry/DataItem",
+                         xdmf_format_str(encoding), true);
+      write_ascii_mesh_value_collection(mvc, dataset_name);
+    }
 
-    xml.write();
+    _xml->write();
   }
+
+  ++_counter;
 }
-//----------------------------------------------------------------------------
-void XDMFFile::operator<< (const MeshFunction<bool>& meshfunction)
-{
-  write_mesh_function(meshfunction);
-}
-//----------------------------------------------------------------------------
-void XDMFFile::operator<< (const MeshFunction<int>& meshfunction)
-{
-  write_mesh_function(meshfunction);
-}
-//----------------------------------------------------------------------------
-void XDMFFile::operator<< (const MeshFunction<std::size_t>& meshfunction)
-{
-  write_mesh_function(meshfunction);
-}
-//----------------------------------------------------------------------------
-void XDMFFile::operator<< (const MeshFunction<double>& meshfunction)
-{
-  write_mesh_function(meshfunction);
-}
-//----------------------------------------------------------------------------
-void XDMFFile::write(const std::vector<Point>& points)
+//-----------------------------------------------------------------------------
+void XDMFFile::write(const std::vector<Point>& points, Encoding encoding)
 {
-  // Initialise HDF5 file
-  if (hdf5_filemode != "w")
-  {
-    // Create HDF5 file (truncate)
-    hdf5_file.reset(new HDF5File(_mpi_comm, hdf5_filename, "w"));
-    hdf5_filemode = "w";
-  }
+  check_encoding(encoding);
 
+  const std::string group_name = "/Points";
   // Get number of points (global)
   const std::size_t num_global_points = MPI::sum(_mpi_comm, points.size());
 
-  // Write HDF5 file
-  const std::string group_name = "/Points";
-  hdf5_file->write(points, group_name);
+  // Initialise HDF5 file
+  if (encoding == Encoding::HDF5)
+  {
+#ifdef HAS_HDF5
+    if (_hdf5_filemode != "w")
+    {
+      // Create HDF5 file (truncate)
+      _hdf5_file.reset(new HDF5File(_mpi_comm, get_hdf5_filename(_filename), "w"));
+      _hdf5_filemode = "w";
+    }
+
+    // Write HDF5 file
+    _hdf5_file->write(points, group_name);
+#else
+    dolfin_error("XDMFile.cpp", "write vector<Point>", "Need HDF5 support");
+#endif
+  }
+  else if (encoding == Encoding::ASCII)
+  {
+    // FIXME: Make ASCII output work
+    dolfin_not_implemented();
+  }
 
   // The XML created below will obliterate any existing XDMF file
-  write_point_xml(group_name, num_global_points, 0);
+  write_point_xml(group_name, num_global_points, 0, encoding);
 }
 //----------------------------------------------------------------------------
 void XDMFFile::write(const std::vector<Point>& points,
-                     const std::vector<double>& values)
+                     const std::vector<double>& values,
+                     Encoding encoding)
 {
-  // Write clouds of points to XDMF/HDF5 with values
+  // FIXME: make ASCII output work
+  check_encoding(encoding);
 
+  // Write clouds of points to XDMF/HDF5 with values
   dolfin_assert(points.size() == values.size());
 
-  // Initialise HDF5 file
-  if (hdf5_filemode != "w")
-  {
-    // Create HDF5 file (truncate)
-    hdf5_file.reset(new HDF5File(_mpi_comm, hdf5_filename, "w"));
-    hdf5_filemode = "w";
-  }
-
   // Get number of points (global)
   const std::size_t num_global_points = MPI::sum(_mpi_comm, points.size());
-
-  // Write HDF5 file
   const std::string group_name = "/Points";
-  hdf5_file->write(points, group_name);
 
-  const std::string values_name = group_name + "/values";
-  hdf5_file->write(values, values_name);
+  if (encoding == Encoding::HDF5)
+  {
+#ifdef HAS_HDF5
+    // Initialise HDF5 file
+    if (_hdf5_filemode != "w")
+    {
+      // Create HDF5 file (truncate)
+      _hdf5_file.reset(new HDF5File(_mpi_comm, get_hdf5_filename(_filename), "w"));
+      _hdf5_filemode = "w";
+    }
+
+    // Write HDF5 file
+    _hdf5_file->write(points, group_name);
+
+    const std::string values_name = group_name + "/values";
+    _hdf5_file->write(values, values_name);
+#else
+    dolfin_error("XDMFile.cpp", "write vector<Point>", "Need HDF5 support");
+#endif
+  }
 
   // The XML created will obliterate any existing XDMF file
-  write_point_xml(group_name, num_global_points, 1);
+  write_point_xml(group_name, num_global_points, 1, encoding);
 }
 //----------------------------------------------------------------------------
-void XDMFFile::write_point_xml(const std::string group_name,
-                               const std::size_t num_global_points,
-                               const unsigned int value_size)
+void XDMFFile::read(Mesh& mesh, UseFilePartition use_file_partition)
 {
-  // Write the XML meta description on process zero
-  if (MPI::rank(_mpi_comm) == 0)
-  {
-    XDMFxml xml(_filename);
-    xml.init_mesh("Point cloud");
+  read_new(mesh);
+  return;
 
-    // Point topology, no connectivity data
-    xml.mesh_topology(CellType::Type::point, 0, num_global_points, "");
+  // Parse XML file
+  dolfin_assert(_xml);
+  _xml->read();
 
-    // Describe geometric coordinates
-    // FIXME: assumes 3D
-    boost::filesystem::path p(hdf5_filename);
-    xml.mesh_geometry(num_global_points, 3,
-                      p.filename().string() + ":/Points");
+  // Get topology and geometry data
+  const auto topology = _xml->get_topology();
+  const auto geometry = _xml->get_geometry();
 
-    if(value_size != 0)
+  // Create a cell type string (we need to catch the case where
+  // TopologyType == "PolyLine")
+  const std::string cell_type_str
+    = (topology.cell_type == "polyline") ? "interval" : topology.cell_type;
+
+  // Create a DOLFIN cell type from string
+  std::unique_ptr<CellType> cell_type(CellType::create(cell_type_str));
+  dolfin_assert(cell_type);
+
+  // Get geometric and toplogical dimensions
+  const int gdim = geometry.dim;
+  const int tdim = cell_type->dim();
+  dolfin_assert(tdim <= gdim);
+
+  if (topology.format == "HDF")
+  {
+#ifdef HAS_HDF5
+    if (geometry.hdf5_filename != topology.hdf5_filename)
     {
-      dolfin_assert(value_size == 1 || value_size == 3);
-      xml.data_attribute("point_values", 1, true,
-                         num_global_points, num_global_points, value_size,
-                         p.filename().string() + ":" + group_name + "/values");
+      dolfin_error("XDMFFile.cpp",
+                   "read XDMF mesh",
+                   "Topology and geometry file names do not match");
     }
 
-    xml.write();
+    // Close any associated HDF5 which may be open
+    _hdf5_file.reset();
+
+    // Prepend directory name of XDMF file...
+    // FIXME: not robust - topo.hdf5_filename may already be an
+    // absolute path
+    boost::filesystem::path xdmf_path(_filename);
+    boost::filesystem::path hdf5_path(topology.hdf5_filename);
+    HDF5File mesh_file(_mpi_comm, (xdmf_path.parent_path() / hdf5_path).string(), "r");
+
+    // Read the mesh from the associated HDF5 file
+    mesh_file.read(mesh, topology.hdf5_dataset, geometry.hdf5_dataset,
+                   gdim, *cell_type,
+                   topology.num_cells,
+                   geometry.num_points,
+                   static_cast<bool>(use_file_partition));
+#else
+    dolfin_error("XDMFile.cpp", "open Mesh file", "Need HDF5 support");
+#endif
   }
-}
-//----------------------------------------------------------------------------
-template<typename T>
-void XDMFFile::write_mesh_function(const MeshFunction<T>& meshfunction)
-{
-  // Get mesh
-  dolfin_assert(meshfunction.mesh());
-  const Mesh& mesh = *meshfunction.mesh();
-
-  if (hdf5_filemode != "w")
+  else if (topology.format == "XML")
   {
-    // Create HDF5 file (truncate)
-    hdf5_file.reset(new HDF5File(mesh.mpi_comm(), hdf5_filename, "w"));
-    hdf5_filemode = "w";
-  }
+    if (MPI::rank(mesh.mpi_comm()) == 0)
+    {
+      MeshEditor editor;
+      editor.open(mesh, cell_type_str, tdim, gdim);
+
+      // Read geometry
+      editor.init_vertices_global(geometry.num_points, geometry.num_points);
+
+      const auto& g_data = geometry.data;
+      std::istringstream iss(g_data);
+      std::string data_line;
+      std::vector<std::string> coords(gdim);
+      Point p({0.0, 0.0, 0.0});
+      std::size_t index = 0;
+      while(std::getline(iss, data_line))
+      {
+        boost::split(coords, data_line, boost::is_any_of(" "));
+        for (int j = 0; j < gdim; ++j)
+          p[j] = std::stod(coords[j]);
+        editor.add_vertex(index, p);
+        ++index;
+      }
 
-  if (meshfunction.size() == 0)
-  {
-    dolfin_error("XDMFFile.cpp",
-                 "save empty MeshFunction",
-                 "No values in MeshFunction");
-  }
+      if (geometry.num_points != index)
+      {
+        dolfin_error("XDMFFile.cpp",
+                     "parse mesh geometry points",
+                     (boost::format("number of points found in data (%d) does not match xdmf meta data (%d)")
+                      % index % geometry.num_points).str());
+      }
 
-  const std::size_t cell_dim = meshfunction.dim();
-  CellType::Type cell_type = mesh.type().entity_type(cell_dim);
+      // Read topology
+      editor.init_cells_global(topology.num_cells, topology.num_cells);
 
-  // Use HDF5 function to output MeshFunction
-  const std::string h5_mesh_name = "/Mesh/" + std::to_string(counter);
-  boost::filesystem::path p(hdf5_filename);
-  current_mesh_name = p.filename().string() + ":" + h5_mesh_name;
-  hdf5_file->write(meshfunction, h5_mesh_name);
+      const auto& t_data = topology.data;
+      iss.clear();
+      iss.str(t_data);
+      index = 0;
+      std::vector<std::string> splt_str_indices(topology.points_per_cell);
+      std::vector<std::size_t> point_indices(topology.points_per_cell);
+      while(std::getline(iss, data_line))
+      {
+        boost::split(splt_str_indices, data_line, boost::is_any_of(" "));
+        for (std::size_t j = 0; j < topology.points_per_cell; ++j)
+          point_indices[j] = std::stol(splt_str_indices[j]);
 
-  // Saved MeshFunction values are in the /Mesh group
-  const std::string dataset_name = current_mesh_name + "/values";
+        editor.add_cell(index, point_indices);
+        ++index;
+      }
 
-  if (MPI::rank(mesh.mpi_comm()) == 0)
-  {
-    XDMFxml xml(_filename);
-    const std::string meshfunction_name = meshfunction.name();
-    xml.init_timeseries(meshfunction_name, (double)counter, counter);
-    xml.mesh_topology(cell_type, 1, mesh.size_global(cell_dim),
-                      current_mesh_name);
-    xml.mesh_geometry(mesh.size_global(0), mesh.geometry().dim(),
-                      current_mesh_name);
-    xml.data_attribute(meshfunction_name, 0, false, mesh.size_global(0),
-                       mesh.size_global(cell_dim), 1, dataset_name);
-    xml.write();
-  }
+      if (topology.num_cells != index)
+      {
+        dolfin_error("XDMFFile.cpp",
+                     "parse mesh topology",
+                     (boost::format("number of cells found in data (%d) does not match xdmf meta data (%d)")
+                      % index % topology.num_cells).str());
+      }
 
-  counter++;
+      editor.close();
+    }
+  }
 }
 //----------------------------------------------------------------------------
-void XDMFFile::operator>> (MeshFunction<bool>& meshfunction)
+void XDMFFile::read(MeshFunction<bool>& meshfunction)
 {
-  const Mesh& mesh = *meshfunction.mesh();
-  const std::size_t cell_dim = meshfunction.dim();
+  const std::shared_ptr<const Mesh> mesh = meshfunction.mesh();
+  dolfin_assert(mesh);
 
+  const std::size_t cell_dim = meshfunction.dim();
   MeshFunction<std::size_t> mf(mesh, cell_dim);
   read_mesh_function(mf);
 
-  for (MeshEntityIterator cell(mesh, cell_dim); !cell.end(); ++cell)
+  for (MeshEntityIterator cell(*mesh, cell_dim); !cell.end(); ++cell)
     meshfunction[cell->index()] = (mf[cell->index()] == 1);
 }
 //----------------------------------------------------------------------------
-void XDMFFile::operator>> (MeshFunction<int>& meshfunction)
+void XDMFFile::read(MeshFunction<int>& meshfunction)
 {
   read_mesh_function(meshfunction);
 }
 //----------------------------------------------------------------------------
-void XDMFFile::operator>> (MeshFunction<std::size_t>& meshfunction)
+void XDMFFile::read(MeshFunction<std::size_t>& meshfunction)
 {
   read_mesh_function(meshfunction);
 }
 //----------------------------------------------------------------------------
-void XDMFFile::operator>> (MeshFunction<double>& meshfunction)
+void XDMFFile::read(MeshFunction<double>& meshfunction)
 {
   read_mesh_function(meshfunction);
 }
 //----------------------------------------------------------------------------
-template<typename T>
-void XDMFFile::read_mesh_function(MeshFunction<T>& meshfunction)
+void XDMFFile::write_new(const Mesh& mesh, Encoding encoding) const
 {
-  if (hdf5_filemode != "r")
+  // Check that encoding is supported
+  check_encoding(encoding);
+
+  // Create pugi doc
+  pugi::xml_document xml_doc;
+
+  // Add XDMF node and version attribute
+  pugi::xml_node xdmf_node = xml_doc.append_child("Xdmf");
+  dolfin_assert(xdmf_node);
+  xdmf_node.append_attribute("Version") = "3.0";
+
+  // Add domain node and add name attribute
+  pugi::xml_node domain_node = xdmf_node.append_child("Domain");
+  dolfin_assert(domain_node);
+  domain_node.append_attribute("Name") = "Mesh produced by DOLFIN";
+
+  // Add grid node and attributes
+  pugi::xml_node grid_node = domain_node.append_child("Grid");
+  dolfin_assert(grid_node);
+  grid_node.append_attribute("Name") = mesh.name().c_str();
+  grid_node.append_attribute("GridType") = "Uniform";
+
+  // Open a HDF5 file if using HDF5 encoding (truncate)
+  hid_t h5_id = -1;
+  #ifdef HAS_HDF5
+  std::unique_ptr<HDF5File> h5_file;
+  if (encoding == Encoding::HDF5)
   {
-    hdf5_file.reset(new HDF5File(_mpi_comm, hdf5_filename, "r"));
-    hdf5_filemode = "r";
-  }
+    // Open file
+    h5_file.reset(new HDF5File(mesh.mpi_comm(), get_hdf5_filename(_filename), "w"));
+    dolfin_assert(h5_file);
 
-  dolfin_assert(hdf5_file);
+    // Get file handle
+    h5_id = h5_file->h5_id();
+  }
+  #endif
 
-  XDMFxml xml(_filename);
-  xml.read();
-  const std::string mesh_name = xml.meshname();
-  const std::string data_name = xml.dataname();
+  // Add topology node and attributes (including writa data)
+  const int tdim = mesh.topology().dim();
+  const std::int64_t num_global_cells = mesh.size_global(tdim) ;
+  if (num_global_cells < 1e9)
+    add_topology_data<std::int32_t>(_mpi_comm, grid_node, h5_id, "/Mesh", mesh);
+  else
+    add_topology_data<std::int64_t>(_mpi_comm, grid_node, h5_id, "/Mesh", mesh);
 
-  if (mesh_name != data_name)
-    dolfin_error("XMDFFile.cpp",
-                 "read MeshFunction",
-                 "Data and Mesh names do not match in XDMF");
+  // Add geometry node and attributes (including writa data)
+  add_geometry_data(_mpi_comm, grid_node, h5_id, "/Mesh", mesh);
 
-  // Try to read the meshfunction from the associated HDF5 file
-  hdf5_file->read(meshfunction, "/Mesh/" + mesh_name);
+  // Save XML file (on process 0 only)
+  if (MPI::rank(_mpi_comm) == 0)
+    xml_doc.save_file(_filename.c_str(), "  ");
 }
 //----------------------------------------------------------------------------
+void XDMFFile::read_new(Mesh& mesh) const
+{
+  // FIXME: check for duplicated XML nodes
+
+  // Extract parent filepath (required to HDF5 when XDMF stores  relative path
+  // of the HDF5 files(s) and the XDMF is not opened from its own directory)
+  boost::filesystem::path xdmf_filename(_filename);
+  const boost::filesystem::path parent_path = xdmf_filename.parent_path();
+
+  if (!boost::filesystem::exists(xdmf_filename))
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "opening check that XDMF file",
+                 "XDMF file \"%s\" does not exist", _filename.c_str());
+  }
+
+  // Load XML doc from file
+  pugi::xml_document xml_doc;
+  pugi::xml_parse_result result = xml_doc.load_file(_filename.c_str());
+  dolfin_assert(result);
+
+  // Get XDMF node
+  pugi::xml_node xdmf_node = xml_doc.child("Xdmf");
+  dolfin_assert(xdmf_node);
+
+  // Get domain node
+  pugi::xml_node domain_node = xdmf_node.child("Domain");
+  dolfin_assert(domain_node);
+
+  // Get grid node
+  pugi::xml_node grid_node = domain_node.child("Grid");
+  dolfin_assert(grid_node);
+
+  // Get topology node
+  pugi::xml_node topology_node = grid_node.child("Topology");
+  dolfin_assert(topology_node);
+
+  // Get cell type
+  const std::string cell_type_str = get_cell_type(topology_node);
+
+  // Get toplogical dimensions
+  std::unique_ptr<CellType> cell_type(CellType::create(cell_type_str));
+  dolfin_assert(cell_type);
+  const int tdim = cell_type->dim();
+  const std::int64_t num_cells_global = get_num_cells(topology_node);
+
+  // Get geometry node
+  pugi::xml_node geometry_node = grid_node.child("Geometry");
+  dolfin_assert(geometry_node);
+
+  // Determine geometric dimension
+  pugi::xml_attribute geometry_type_attr = geometry_node.attribute("GeometryType");
+  dolfin_assert(geometry_type_attr);
+  int gdim = -1;
+  const std::string geometry_type =  geometry_type_attr.value();
+  if (geometry_type == "XY")
+    gdim = 2;
+  else if (geometry_type == "XYZ")
+    gdim = 3;
+  else
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "determine geometric dimension",
+                 "GeometryType \"%s\" in XDMF file is unknown or unsupported",
+                 geometry_type.c_str());
+  }
+
+  // Get number of points from Geometry dataitem node
+  pugi::xml_node geometry_data_node = geometry_node.child("DataItem");
+  dolfin_assert(geometry_data_node);
+  const std::vector<std::int64_t> gdims = get_dataset_shape(geometry_data_node);
+  dolfin_assert(gdims.size() == 2);
+  const std::int64_t num_points_global = gdims[0];
+  dolfin_assert(gdims[1] == gdim);
+
+  // Get topology dataset node
+  pugi::xml_node topology_data_node = topology_node.child("DataItem");
+  dolfin_assert(topology_data_node);
+
+  if (MPI::size(_mpi_comm) == 1)
+  {
+    build_mesh(mesh, cell_type_str, num_points_global, num_cells_global,
+               cell_type->num_vertices(),
+               tdim, gdim, topology_data_node, geometry_data_node,
+               parent_path);
+  }
+  else
+  {
+    // Build local mesh data structure
+    LocalMeshData local_mesh_data(_mpi_comm);
+    build_local_mesh_data(local_mesh_data, *cell_type, num_points_global,
+                          num_cells_global,
+                          cell_type->num_vertices(), tdim, gdim,
+                          topology_data_node, geometry_data_node,
+                          parent_path);
+    local_mesh_data.check();
+
+    // Build mesh
+    const std::string ghost_mode = dolfin::parameters["ghost_mode"];
+    MeshPartitioning::build_distributed_mesh(mesh, local_mesh_data, ghost_mode);
+  }
+}
+//----------------------------------------------------------------------------
+void XDMFFile::build_mesh(Mesh& mesh, std::string cell_type_str,
+                          std::int64_t num_points, std::int64_t num_cells,
+                          int num_points_per_cell,
+                          int tdim, int gdim,
+                          const pugi::xml_node& topology_dataset_node,
+                          const pugi::xml_node& geometry_dataset_node,
+                          const boost::filesystem::path& relative_path)
+{
+  MeshEditor mesh_editor;
+  mesh_editor.open(mesh, cell_type_str, tdim, gdim);
+
+  // Get topology data vector and add to mesh
+  {
+    // Get the data
+    dolfin_assert(topology_dataset_node);
+    std::vector<std::int32_t> topology_data
+      = get_dataset<std::int32_t>(mesh.mpi_comm(), topology_dataset_node,
+                                  relative_path);
+
+    // Check dims
+
+    // Prepate mesh editor for addition of cells
+    mesh_editor.init_cells_global(num_cells, num_cells);
+
+    // Prepare mesh editor for addition of cells, and add cell topology
+    std::vector<std::size_t> cell_topology(num_points_per_cell);
+    for (std::int64_t i = 0; i < num_cells; ++i)
+    {
+      cell_topology.assign(topology_data.begin() +  i*num_points_per_cell,
+                           topology_data.begin() +  (i + 1)*num_points_per_cell);
+      mesh_editor.add_cell(i, cell_topology);
+    }
+  }
+
+  // Get geometry data vector and add to mesh
+  {
+    // Get geometry data
+    dolfin_assert(geometry_dataset_node);
+    std::vector<double> geometry_data
+      = get_dataset<double>(mesh.mpi_comm(), geometry_dataset_node, relative_path);
+
+    // Check dims
+
+    // Prepare mesh editor for addition of points, and add points
+    mesh_editor.init_vertices_global(num_points, num_points);
+    Point p;
+    for (std::int64_t i = 0; i < num_points; ++i)
+    {
+      for (int j = 0; j < gdim; ++j)
+        p[j] = geometry_data[i*gdim + j];
+      mesh_editor.add_vertex(i, p);
+    }
+  }
+
+  mesh_editor.close();
+}
+//----------------------------------------------------------------------------
+void
+XDMFFile::build_local_mesh_data(LocalMeshData& local_mesh_data,
+                                const CellType& cell_type,
+                                const std::int64_t num_points_global,
+                                const std::int64_t num_cells_global,
+                                const int num_points_per_cell,
+                                const int tdim, const int gdim,
+                                const pugi::xml_node& topology_dataset_node,
+                                const pugi::xml_node& geometry_dataset_node,
+                                const boost::filesystem::path& relative_path)
+{
+  // -- Topology --
+
+  // Get number of vertices per cell from CellType
+  const int num_vertices_per_cell = cell_type.num_entities(0);
+
+  // Set topology attributes
+  local_mesh_data.topology.dim = cell_type.dim();
+  local_mesh_data.topology.cell_type = cell_type.cell_type();
+  local_mesh_data.topology.num_vertices_per_cell = num_vertices_per_cell;
+  local_mesh_data.topology.num_global_cells = num_cells_global;
+
+  // Get share of topology data
+  dolfin_assert(topology_dataset_node);
+  const auto topology_data = get_dataset<std::int64_t>(local_mesh_data.mpi_comm(),
+                                                       topology_dataset_node,
+                                                      relative_path);
+  dolfin_assert(topology_data.size() % num_vertices_per_cell == 0);
+
+  // Wrap topology data as multi-dimensional array
+  const int num_local_cells = topology_data.size()/num_vertices_per_cell;
+  const boost::const_multi_array_ref<std::int64_t, 2>
+    topology_data_array(topology_data.data(),
+                        boost::extents[num_local_cells][num_vertices_per_cell]);
+
+  // Remap vertices to DOLFIN ordering from VTK/XDMF ordering
+  local_mesh_data.topology.cell_vertices.resize(boost::extents[num_local_cells][num_vertices_per_cell]);
+  const std::vector<std::int8_t> perm = cell_type.vtk_mapping();
+  for (int i = 0; i < num_local_cells; ++i)
+  {
+    for (int j = 0; j < num_vertices_per_cell; ++j)
+      local_mesh_data.topology.cell_vertices[i][j] = topology_data_array[i][perm[j]];
+  }
+
+  // Set cell global indices by adding offset
+  const std::int64_t cell_index_offset
+    = MPI::global_offset(local_mesh_data.mpi_comm(), num_local_cells, true);
+  local_mesh_data.topology.global_cell_indices.resize(num_local_cells);
+  std::iota(local_mesh_data.topology.global_cell_indices.begin(),
+            local_mesh_data.topology.global_cell_indices.end(),
+            cell_index_offset);
+
+  // -- Geometry --
+
+  // Set geometry attributes
+  local_mesh_data.geometry.num_global_vertices = num_points_global;
+  local_mesh_data.geometry.dim = gdim;
+
+  // Read geometry dataset
+  dolfin_assert(geometry_dataset_node);
+  const auto geometry_data = get_dataset<double>(local_mesh_data.mpi_comm(),
+                                                 geometry_dataset_node,
+                                                 relative_path);
+  dolfin_assert(geometry_data.size() % gdim == 0);
+
+  // Deduce number of vertices that have been read on this process
+  const int num_local_vertices = geometry_data.size()/gdim;
+
+  // Copy geometry data into LocalMeshData
+  local_mesh_data.geometry.vertex_coordinates.resize(boost::extents[num_local_vertices][gdim]);
+  std::copy(geometry_data.begin(), geometry_data.end(),
+            local_mesh_data.geometry.vertex_coordinates.data());
+
+  // vertex offset
+  const std::int64_t vertex_index_offset
+    = MPI::global_offset(local_mesh_data.mpi_comm(), num_local_vertices, true);
+  local_mesh_data.geometry.vertex_indices.resize(num_local_vertices);
+  std::iota(local_mesh_data.geometry.vertex_indices.begin(),
+            local_mesh_data.geometry.vertex_indices.end(),
+            vertex_index_offset);
+}
+//----------------------------------------------------------------------------
+template<typename T>
+void XDMFFile::add_topology_data(MPI_Comm comm, pugi::xml_node& xml_node,
+                                 hid_t h5_id, const std::string path_prefix,
+                                 const Mesh& mesh)
+{
+  // Get topological dimension
+  const int tdim = mesh.topology().dim();
+
+  // Get number of cells (global) and vertices per cell from mesh
+  const std::int64_t num_cells = mesh.topology().size_global(tdim);
+  const int num_vertices_per_cell = mesh.type().num_vertices(tdim);
+
+  // Get VTK string for cell type
+  const std::string vtk_cell_str
+    = vtk_cell_type_str(mesh.type().entity_type(tdim), 1);
+
+  pugi::xml_node topology_node = xml_node.append_child("Topology");
+  dolfin_assert(topology_node);
+  topology_node.append_attribute("NumberOfElements") = std::to_string(num_cells).c_str();
+  topology_node.append_attribute("TopologyType") = vtk_cell_str.c_str();
+  topology_node.append_attribute("NodesPerElement") = num_vertices_per_cell;
+
+  // Compute packed topology data
+  std::vector<T> topology_data = compute_topology_data<T>(mesh, tdim);
+
+  // Add topology DataItem node
+  const std::string group_name = path_prefix + "/" + mesh.name();
+  const std::string h5_path = group_name + "/topology";
+  const std::vector<std::int64_t> shape = {num_cells, num_vertices_per_cell};
+  add_data_item(comm, topology_node, h5_id, h5_path, topology_data, shape);
+}
+//----------------------------------------------------------------------------
+void XDMFFile::add_geometry_data(MPI_Comm comm, pugi::xml_node& xml_node,
+                                 hid_t h5_id, const std::string path_prefix,
+                                 const Mesh& mesh)
+{
+  const MeshGeometry& mesh_geometry = mesh.geometry();
+  int gdim = mesh_geometry.dim();
+
+  // Compute number of points (global) in mesh (equal to number of vertices
+  // for affine meshes)
+  std::int64_t num_points = 0;
+  for (std::size_t i = 0; i <= mesh.topology().dim(); ++i)
+  {
+    num_points +=
+      mesh_geometry.num_entity_coordinates(i)*mesh.size_global(i);
+  }
+
+  // Add geometry node and attributes
+  pugi::xml_node geometry_node = xml_node.append_child("Geometry");
+  dolfin_assert(geometry_node);
+  dolfin_assert(gdim > 0 and gdim <= 3);
+  const std::string geometry_type = ( gdim == 1 or gdim == 2) ? "XY" : "XYZ";
+  geometry_node.append_attribute("GeometryType") = geometry_type.c_str();
+
+  // Pack geometry data
+  std::vector<double> x
+    = DistributedMeshTools::reorder_vertices_by_global_indices(mesh);
+
+  // XDMF does not support 1D, so handle as special case
+  if (gdim == 1)
+  {
+    // Pad the coordinates with zeros for a dummy Y
+    gdim = 2;
+    std::vector<double> _x(2*x.size(), 0.0);
+    for (std::size_t i = 0; i < x.size(); ++i)
+      _x[2*i] = x[i];
+    std::swap(x, _x);
+  }
+
+  // Add geometry ad DataItem node
+  const std::string group_name = path_prefix + "/" + mesh.name();
+  const std::string h5_path = group_name + "/geometry";
+  const std::vector<std::int64_t> shape = {num_points, gdim};
+  add_data_item(comm, geometry_node, h5_id, h5_path, x, shape);
+}
+//----------------------------------------------------------------------------
+template<typename T>
+void XDMFFile::add_data_item(MPI_Comm comm, pugi::xml_node& xml_node,
+                             hid_t h5_id, const std::string h5_path, const T& x,
+                             const std::vector<std::int64_t> shape)
+{
+  // Add DataItem node
+  dolfin_assert(xml_node);
+  pugi::xml_node data_item_node = xml_node.append_child("DataItem");
+  dolfin_assert(data_item_node);
+
+  // Add dimensions attribute
+  data_item_node.append_attribute("Dimensions")
+    = container_to_string(shape, " ", 16).c_str();
+
+  // Add format attribute
+  if (h5_id < 0)
+  {
+    data_item_node.append_attribute("Format") = "XML";
+    data_item_node.append_child(pugi::node_pcdata).set_value(container_to_string(x, " ", 16).c_str());
+  }
+  else
+  {
+    #ifdef HAS_HDF5
+    data_item_node.append_attribute("Format") = "HDF";
+
+    // Get name of HDF5 file
+    const std::string hdf5_filename = HDF5Interface::get_filename(h5_id);
+    const boost::filesystem::path p(hdf5_filename);
+
+    // Add HDF5 filename and HDF5 internal path to XML file
+    const std::string xdmf_path = p.filename().string() + ":" + h5_path;
+    data_item_node.append_child(pugi::node_pcdata).set_value(xdmf_path.c_str());
+
+    // Compute total number of items and check for consistency with shape
+    dolfin_assert(!shape.empty());
+    std::int64_t num_items_total = 1;
+    for (auto n : shape)
+      num_items_total *= n;
+    dolfin_assert(num_items_total == (std::int64_t) MPI::sum(comm, x.size()));
+
+    // Compute data offset and range of values
+    std::int64_t local_shape0 = x.size();
+    for (std::size_t i = 1; i < shape.size(); ++i)
+    {
+      dolfin_assert(local_shape0 % shape[i] == 0);
+      local_shape0 /= shape[i];
+    }
+    const std::int64_t offset = MPI::global_offset(comm, local_shape0, true);
+    const std::pair<std::int64_t, std::int64_t> local_range
+      = {offset, offset + local_shape0};
+
+    const bool use_mpi_io = MPI::size(comm) == 1 ? false : true;
+    HDF5Interface::write_dataset(h5_id, h5_path, x, local_range, shape, use_mpi_io,
+                                 false);
+    #else
+    // Should never reach this point
+    dolfin_error("XDMFFile.cpp",
+                 "add dataitem",
+                 "DOLFIN has not been configured with hdf5_dataset");
+    #endif
+  }
+}
+//----------------------------------------------------------------------------
+template<typename T>
+std::vector<T> XDMFFile::compute_topology_data(const Mesh& mesh, int cell_dim)
+{
+  // Create vector to store topology data
+  const int num_vertices_per_cell = mesh.type().num_vertices(cell_dim);
+  std::vector<T> topology_data;
+  topology_data.reserve(mesh.num_entities(cell_dim)*(num_vertices_per_cell));
+
+  // Get mesh communicator
+  MPI_Comm comm = mesh.mpi_comm();
+
+  // Pack data
+  const std::vector<std::int8_t> perm = mesh.type().vtk_mapping();
+  if (MPI::size(comm) == 1)
+  {
+    // Simple case when mesh is not distributed
+    const std::vector<size_t>& global_vertices = mesh.topology().global_indices(0);
+    for (MeshEntityIterator c(mesh, cell_dim); !c.end(); ++c)
+    {
+      const unsigned int* entities = c->entities(0);
+      for (unsigned int i = 0; i != c->num_entities(0); ++i)
+        topology_data.push_back(global_vertices[entities[perm[i]]]);
+    }
+  }
+  else
+  {
+    // If not already numbered, number entities of order tdim so
+    // we can get shared_entities
+    DistributedMeshTools::number_entities(mesh, cell_dim);
+
+    // Check if mesh has ghost layers
+    const MeshTopology& topology = mesh.topology();
+    const bool ghosted = (topology.size(cell_dim) == topology.ghost_offset(cell_dim));
+
+    // Get MPI rank
+    const int mpi_rank = MPI::rank(comm);
+
+    // Build set of entities that are on this process but which
+    // should not be output by this process because they will be output
+    // by another process.
+    std::set<int> non_local_entities;
+    if (!ghosted)
+    {
+      // Get shared entities
+      const std::map<std::int32_t, std::set<unsigned int>>& shared_entities
+        = mesh.topology().shared_entities(cell_dim);
+
+      // Iterate over shared entities, and add to exlcusion set
+      // if there is a lower rank process with the entity
+      for (auto e = shared_entities.begin(); e != shared_entities.end(); ++e)
+      {
+        const int lowest_rank_owner = *(e->second.begin());
+        if (lowest_rank_owner < mpi_rank)
+          non_local_entities.insert(e->first);
+      }
+    }
+    else
+    {
+      // Iterate through ghost cells, adding non-ghost entities
+      // which are in lower rank process cells to a set for
+      // exclusion from output
+      for (MeshEntityIterator c(mesh, cell_dim, "ghost"); !c.end(); ++c)
+      {
+        const int cell_owner = c->owner();
+        for (MeshEntityIterator e(*c, cell_dim); !e.end(); ++e)
+        {
+          if (!e->is_ghost() and cell_owner < mpi_rank)
+            non_local_entities.insert(e->index());
+        }
+      }
+    }
+
+    // Generate topology data for this process, with special case
+    // for mesh of points
+    topology_data.reserve(mesh.num_entities(cell_dim)*(num_vertices_per_cell));
+    if (cell_dim == 0)
+    {
+      for (VertexIterator v(mesh); !v.end(); ++v)
+      {
+        if (non_local_entities.find(v->index()) == non_local_entities.end())
+          topology_data.push_back(v->global_index());
+      }
+    }
+    else
+    {
+      // Local-to-global map for point indices
+      const std::vector<std::size_t>& global_vertices
+        = mesh.topology().global_indices(0);
+      for (MeshEntityIterator e(mesh, cell_dim); !e.end(); ++e)
+      {
+        // If not excluded, add to topology
+        if (non_local_entities.find(e->index()) == non_local_entities.end())
+        {
+          for (unsigned int i = 0; i != e->num_entities(0); ++i)
+          {
+            const int local_idx = e->entities(0)[perm[i]];
+            topology_data.push_back(global_vertices[local_idx]);
+          }
+        }
+      }
+    }
+  }
+
+  return topology_data;
+}
+//----------------------------------------------------------------------------
+std::string XDMFFile::get_cell_type(const pugi::xml_node& topology_node)
+{
+  dolfin_assert(topology_node);
+  pugi::xml_attribute type_attr = topology_node.attribute("TopologyType");
+  dolfin_assert(type_attr);
+
+  // Convert XDMF cell type string to DOLFIN cell type string
+  std::string cell_type = type_attr.as_string();
+  boost::algorithm::to_lower(cell_type);
+  if (cell_type == "polyline")
+    cell_type = "interval";
+
+  return cell_type;
+}
+//----------------------------------------------------------------------------
+std::vector<std::int64_t>
+XDMFFile::get_dataset_shape(const pugi::xml_node& dataset_node)
+{
+  // Get Dimensions attribute string
+  dolfin_assert(dataset_node);
+  pugi::xml_attribute dimensions_attr = dataset_node.attribute("Dimensions");
+
+  // Gets dimensions, if attribute is present
+  std::vector<std::int64_t> dims;
+  if (dimensions_attr)
+  {
+    // Split dimensions string
+    const std::string dims_str = dimensions_attr.as_string();
+    std::vector<std::string> dims_list;
+    boost::split(dims_list, dims_str, boost::is_any_of(" "));
+
+    // Cast dims to integers
+    for (auto d : dims_list)
+      dims.push_back(boost::lexical_cast<std::int64_t>(d));
+  }
+
+  return dims;
+}
+//----------------------------------------------------------------------------
+std::int64_t XDMFFile::get_num_cells(const pugi::xml_node& topology_node)
+{
+  dolfin_assert(topology_node);
+
+  // Get number of cells from topology
+  std::int64_t num_cells_topolgy = -1;
+  pugi::xml_attribute num_cells_attr = topology_node.attribute("NumberOfElements");
+  if (num_cells_attr)
+    num_cells_topolgy = num_cells_attr.as_llong();
+
+  // Get number of cells from topology dataset
+  pugi::xml_node topology_dataset_node = topology_node.child("DataItem");
+  dolfin_assert(topology_dataset_node);
+  const std::vector<std::int64_t> tdims = get_dataset_shape(topology_dataset_node);
+
+  // Check that number of cells can be determined
+  if (tdims.size() != 2 and num_cells_topolgy == -1)
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "determine number of cells",
+                 "Cannot determine number of cells if XMDF mesh");
+  }
+
+  // Check for consistency if number of cells appears in both the topology
+  // and DataItem nodes
+  if (num_cells_topolgy != -1 and tdims.size() == 2)
+  {
+    if (num_cells_topolgy != tdims[0])
+    {
+      dolfin_error("XDMFFile.cpp",
+                   "determine number of cells",
+                   "Cannot determine number of cells if XMDF mesh");
+     }
+  }
+
+  return std::max(num_cells_topolgy, tdims[0]);
+}
+//----------------------------------------------------------------------------
+template <typename T>
+std::vector<T> XDMFFile::get_dataset(MPI_Comm comm,
+                                    const pugi::xml_node& dataset_node,
+                                    const boost::filesystem::path& parent_path)
+{
+  // FIXME: Need to sort out datasset dimensions - can't depend on
+  // HDF5 shape, and a Topology data item is not required to have a
+  // 'Dimensions' attribute since the dimensions can be determined
+  // from the number of cells and the cell type (for topology, once
+  // must supply cell type + (number of cells or dimensions).
+  //
+  // A geometry data item must have 'Dimensions' attribute
+
+  dolfin_assert(dataset_node);
+  pugi::xml_attribute format_attr = dataset_node.attribute("Format");
+  dolfin_assert(format_attr);
+
+  // Get data set shape from 'Dimensions' attribute (empty if not available)
+  const std::vector<std::int64_t> shape_xml = get_dataset_shape(dataset_node);
+
+  const std::string format = format_attr.as_string();
+  std::vector<T> data_vector;
+  if (format == "XML")
+  {
+    // Read data and trim any leading/trailing whitespace
+    pugi::xml_node data_node = dataset_node.first_child();
+    dolfin_assert(data_node);
+    std::string data_str = data_node.value();
+
+    // Split data based on spaces and line breaks
+    std::vector<boost::iterator_range<std::string::iterator>> data_vector_str;
+    boost::split(data_vector_str, data_str, boost::is_any_of(" \n"));
+
+    // Add data to numerical vector
+    data_vector.reserve(data_vector_str.size());
+    for (auto& v : data_vector_str)
+    {
+      if (v.begin() != v.end())
+        data_vector.push_back(boost::lexical_cast<T>(boost::copy_range<std::string>(v)));
+    }
+  }
+  else if (format == "HDF")
+  {
+    #ifdef HAS_HDF5
+    // Get file and data path
+    auto paths = XDMFxml::get_hdf5_paths(dataset_node);
+
+    // Handle cases where file path is (a) absolute or (b) relative
+    boost::filesystem::path h5_filepath(paths[0]);
+    if (!h5_filepath.is_absolute())
+      h5_filepath = parent_path / h5_filepath;
+
+    // Open HDF5 for reading
+    HDF5File h5_file(comm, h5_filepath.string(), "r");
+
+    // Get data shape from HDF5 file
+    const std::vector<std::int64_t> shape_hdf5
+      = HDF5Interface::get_dataset_shape(h5_file.h5_id(), paths[1]);
+
+    // FIXME: should we support empty data sets?
+    // Check that data set is not empty
+    dolfin_assert(!shape_hdf5.empty());
+    dolfin_assert(shape_hdf5[0] != 0);
+
+    // Determine range of data to read from HDF5 file. This is
+    // complicated by the XML Dimension attribute and the HDF5 storage
+    // possibly having different shapes, e.g. the HDF5 storgae may be a
+    // flat array.
+    std::pair<std::int64_t, std::int64_t> range;
+    if (shape_xml == shape_hdf5)
+      range = MPI::local_range(comm, shape_hdf5[0]);
+    else if (!shape_xml.empty() and shape_hdf5.size() == 1)
+    {
+      // Size of dims > 0
+      std::int64_t d = 1;
+      for (std::size_t i = 1; i < shape_xml.size(); ++i)
+        d *= shape_xml[i];
+
+      // Check for data size consistency
+      if (d*shape_xml[0] != shape_hdf5[0])
+      {
+        dolfin_error("XDMFFile.cpp",
+                     "reading data from XDMF file",
+                     "Data size in XDMF/XML and size of HDF5 dataset are inconsistent");
+      }
+
+      // Compute data range to read
+      range = MPI::local_range(comm, shape_xml[0]);
+      range.first *= d;
+      range.second *= d;
+    }
+    else
+    {
+      dolfin_error("XDMFFile.cpp",
+                   "reading data from XDMF file",
+                   "This combination of array shapes in XDMF and HDF5 not supported");
+    }
+
+    // Retrieve data
+    HDF5Interface::read_dataset(h5_file.h5_id(), paths[1], range, data_vector);
+    #else
+    // Should never reach this point
+    dolfin_error("XDMFFile.cpp",
+                 "get dataset",
+                 "DOLFIN has not been configured with HDF5");
+    #endif
+  }
+  else
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "reading data from XDMF file",
+                 "Storage format \"%s\" is unknown", format.c_str());
+  }
+
+  // Get dimensions for consistency (if available in DataItem node)
+  if (shape_xml.empty())
+  {
+    std::int64_t size = 1;
+    for (auto dim : shape_xml)
+      size *= dim;
+
+    if (size != (std::int64_t) MPI::sum(comm, data_vector.size()))
+    {
+      dolfin_error("XDMFFile.cpp",
+                   "reading data from XDMF file",
+                   "Data sizes in attribute and size of data read are inconsistent");
+     }
+   }
+
+   return data_vector;
+}
+//----------------------------------------------------------------------------
+std::array<std::string, 2> XDMFFile::get_hdf5_paths(const pugi::xml_node& dataitem_node)
+{
+  // Check that node is a DataItem node
+  dolfin_assert(dataitem_node);
+  xmlutils::check_node_name(dataitem_node, "DataItem");
+
+  // Check that format is HDF
+  pugi::xml_attribute format_attr = dataitem_node.attribute("Format");
+  dolfin_assert(format_attr);
+  const std::string format = format_attr.as_string();
+  if (format.compare("HDF") != 0)
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "extracting HDF5 filename and data path",
+                 "DataItem format \"%s\" is not \"HDF\"", format.c_str());
+  }
+
+  // Get path data
+  pugi::xml_node path_node = dataitem_node.first_child();
+  dolfin_assert(path_node);
+
+  // Create string from path and trim leading and trailing whitespace
+  std::string path = path_node.text().get();
+  boost::algorithm::trim(path);
+
+  // Split string into file path and HD5 internal path
+  std::vector<std::string> paths;
+  boost::split(paths, path, boost::is_any_of(":"));
+  dolfin_assert(paths.size() == 2);
+
+  return {{paths[0], paths[1]}};
+}
+//-----------------------------------------------------------------------------
+template<typename T>
+void XDMFFile::read_mesh_function(MeshFunction<T>& meshfunction)
+{
+  dolfin_assert(_xml);
+  _xml->read();
+
+  Encoding encoding = get_file_encoding();
+  check_encoding(encoding);
+
+  if (encoding == Encoding::HDF5)
+  {
+#ifdef HAS_HDF5
+    const std::string data_name = _xml->dataname();
+    if (_hdf5_filemode != "r")
+    {
+      _hdf5_file.reset(new HDF5File(_mpi_comm, get_hdf5_filename(_filename), "r"));
+      _hdf5_filemode = "r";
+    }
+    dolfin_assert(_hdf5_file);
+
+    // Try to read the meshfunction from the associated HDF5 file
+    _hdf5_file->read(meshfunction, "/Mesh/" + data_name);
+#else
+    dolfin_error("XDMFile.cpp", "open MeshFunction file", "Need HDF5 support");
+#endif
+  }
+  else if (encoding == Encoding::ASCII)
+  {
+    std::vector<std::string> data_lines;
+    const std::string data_set = _xml->get_first_data_set();
+    boost::split(data_lines, data_set, boost::is_any_of("\n"));
+
+    const std::size_t n_lines = data_lines.size();
+    for (std::size_t j = 0; j < n_lines; ++j)
+      meshfunction[j] = boost::lexical_cast<T>(data_lines[j]);
+  }
+}
+//----------------------------------------------------------------------------
+std::string XDMFFile::get_hdf5_filename(std::string xdmf_filename)
+{
+  boost::filesystem::path p(xdmf_filename);
+  p.replace_extension(".h5");
+  if (p.string() == xdmf_filename)
+  {
+    dolfin_error("XDMFile.cpp",
+                  "deduce name of HDF5 file from XDMF filename",
+                  "Filename clash. Check XDMF filename");
+  }
+
+  return p.string();
+}
+//----------------------------------------------------------------------------
+template<typename T>
+void XDMFFile::write_mesh_function(const MeshFunction<T>& meshfunction,
+                                   std::string format, Encoding encoding)
+{
+  check_encoding(encoding);
+
+  // Get mesh
+  dolfin_assert(meshfunction.mesh());
+  std::shared_ptr<const Mesh> mesh = meshfunction.mesh();
+
+#ifdef HAS_HDF5
+  if (encoding == Encoding::HDF5)
+  {
+    if (_hdf5_filemode != "w")
+    {
+      // Create HDF5 file (truncate)
+      _hdf5_file.reset(new HDF5File(mesh->mpi_comm(), get_hdf5_filename(_filename), "w"));
+      _hdf5_filemode = "w";
+    }
+  }
+#endif
+
+  if (meshfunction.size() == 0)
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "save empty MeshFunction",
+                 "No values in MeshFunction");
+  }
+
+  const std::size_t cell_dim = meshfunction.dim();
+  CellType::Type cell_type = mesh->type().entity_type(cell_dim);
+
+  if (encoding == Encoding::HDF5)
+  {
+#ifdef HAS_HDF5
+    // Use HDF5 function to output MeshFunction
+    const std::string h5_mesh_name = "/Mesh/" + std::to_string(_counter);
+    boost::filesystem::path p(get_hdf5_filename(_filename));
+    _current_mesh_name = p.filename().string() + ":" + h5_mesh_name;
+    _hdf5_file->write(meshfunction, h5_mesh_name);
 #endif
+  }
+  else if (encoding == Encoding::ASCII)
+    _current_mesh_name = "/Xdmf/Domain/Grid";
+
+  // Saved MeshFunction values are in the /Mesh group
+  const std::string dataset_name = _current_mesh_name + "/values";
+
+  bool time_series = parameters["time_series"];
+
+  if (MPI::rank(mesh->mpi_comm()) == 0)
+  {
+    dolfin_assert(_xml);
+    const std::string meshfunction_name = meshfunction.name();
+    if (time_series)
+      _xml->init_timeseries(meshfunction_name, (double) _counter, _counter);
+    else
+      _xml->init_mesh(meshfunction_name);
+
+    if (encoding == Encoding::HDF5)
+    {
+      _xml->mesh_topology(cell_type, 1, mesh->size_global(cell_dim),
+                          _current_mesh_name + "/topology",
+                          xdmf_format_str(encoding));
+      _xml->mesh_geometry(mesh->size_global(0), mesh->geometry().dim(),
+                          _current_mesh_name + "/coordinates",
+                          xdmf_format_str(encoding));
+      _xml->data_attribute(meshfunction_name, 0, false, mesh->size_global(0),
+                           mesh->size_global(cell_dim), 1, dataset_name,
+                           xdmf_format_str(encoding));
+    }
+    else if (encoding == Encoding::ASCII)
+    {
+      // Add the mesh topology and geometry to the xml data
+      _xml->mesh_topology(cell_type, 1, mesh->size_global(cell_dim),
+                          generate_xdmf_ascii_mesh_topology_data(*mesh,
+                                                                 cell_dim),
+                          xdmf_format_str(encoding));
+
+      _xml->mesh_geometry(mesh->size_global(0), mesh->geometry().dim(),
+                          generate_xdmf_ascii_mesh_geometry_data(*mesh),
+                          xdmf_format_str(encoding));
+
+      // Note: we use boost::container::vector rather than std::vector
+      // to avoid well known problem with std::vector<bool>
+      // No duplicates - ignore ghost cells if present
+      boost::container::vector<T>
+        data_values(meshfunction.values(), meshfunction.values()
+                    + mesh->topology().ghost_offset(cell_dim));
+
+      _xml->data_attribute(meshfunction_name, 0, false, mesh->size_global(0),
+                           mesh->size_global(cell_dim), 1,
+                           generate_xdmf_ascii_data(data_values, format),
+                           xdmf_format_str(encoding));
+    }
+
+    _xml->write();
+  }
+
+  ++_counter;
+}
+//-----------------------------------------------------------------------------
+void XDMFFile::write_point_xml(const std::string group_name,
+                               const std::size_t num_global_points,
+                               const unsigned int value_size,
+                               Encoding encoding)
+{
+  // FIXME: move to XDMFxml.cpp
+
+  // Write the XML meta description on process zero
+  if (MPI::rank(_mpi_comm) == 0)
+  {
+    dolfin_assert(_xml);
+    _xml->init_mesh("Point cloud");
+
+    // Point topology, no connectivity data
+    _xml->mesh_topology(CellType::Type::point, 0, num_global_points, "",
+                        xdmf_format_str(encoding));
+
+    // Describe geometric coordinates
+    // FIXME: assumes 3D
+    boost::filesystem::path p(get_hdf5_filename(_filename));
+    _xml->mesh_geometry(num_global_points, 3,
+                        p.filename().string() + ":/Points",
+                        xdmf_format_str(encoding));
+
+    if(value_size != 0)
+    {
+      dolfin_assert(value_size == 1 || value_size == 3);
+      _xml->data_attribute("point_values", 0, true,
+                           num_global_points, num_global_points, value_size,
+                           p.filename().string() + ":" + group_name + "/values",
+                           xdmf_format_str(encoding));
+    }
+
+    _xml->write();
+  }
+}
+//----------------------------------------------------------------------------
+void XDMFFile::get_point_data_values(std::vector<double>& data_values,
+                                     std::size_t width,
+                                     const Function& u) const
+{
+  const Mesh& mesh = *u.function_space()->mesh();
+  const std::size_t value_size = u.value_size();
+  const std::size_t value_rank = u.value_rank();
+
+  if (mesh.geometry().degree() == 1)
+  {
+    u.compute_vertex_values(data_values, mesh);
+    const std::size_t num_local_vertices = mesh.size(0);
+
+    if (value_rank > 0)
+    {
+      std::vector<double> _data_values(width*num_local_vertices, 0.0);
+      for (std::size_t i = 0; i < num_local_vertices; i++)
+      {
+        for (std::size_t j = 0; j < value_size; j++)
+        {
+          std::size_t tensor_2d_offset = (j > 1 && value_size == 4) ? 1 : 0;
+          _data_values[i*width + j + tensor_2d_offset]
+            = data_values[i + j*num_local_vertices];
+        }
+      }
+
+      data_values = _data_values;
+    }
+  }
+  else if (mesh.geometry().degree() == 2)
+  {
+    const std::size_t num_local_points = mesh.size(0) + mesh.size(1);
+    data_values.resize(width*num_local_points);
+    std::vector<dolfin::la_index> data_dofs(data_values.size(), 0);
+
+    dolfin_assert(u.function_space()->dofmap());
+    const GenericDofMap& dofmap = *u.function_space()->dofmap();
+
+    // Function can be P1 or P2
+    if (dofmap.num_entity_dofs(1) == 0)
+    {
+      // P1
+      for (CellIterator cell(mesh); !cell.end(); ++cell)
+      {
+        const ArrayView<const dolfin::la_index> dofs
+          = dofmap.cell_dofs(cell->index());
+        std::size_t c = 0;
+        for (std::size_t i = 0; i != value_size; ++i)
+        {
+          for (VertexIterator v(*cell); !v.end(); ++v)
+          {
+            const std::size_t v0 = v->index()*width;
+            data_dofs[v0 + i] = dofs[c];
+            ++c;
+          }
+        }
+      }
+
+      // Get the values at the vertex points
+      const GenericVector& uvec = *u.vector();
+      uvec.get_local(data_values.data(), data_dofs.size(), data_dofs.data());
+
+      // Get midpoint values for Edge points
+      for (EdgeIterator e(mesh); !e.end(); ++e)
+      {
+        const std::size_t v0 = e->entities(0)[0];
+        const std::size_t v1 = e->entities(0)[1];
+        const std::size_t e0 = (e->index() + mesh.size(0))*width;
+        for (std::size_t i = 0; i != value_size; ++i)
+          data_values[e0 + i] = (data_values[v0 + i] + data_values[v1 + i])/2.0;
+      }
+    }
+    else if (dofmap.num_entity_dofs(0) == dofmap.num_entity_dofs(1))
+    {
+      // P2
+      // Go over all cells inserting values
+      // FIXME: a lot of duplication here
+      for (CellIterator cell(mesh); !cell.end(); ++cell)
+      {
+        const ArrayView<const dolfin::la_index> dofs
+          = dofmap.cell_dofs(cell->index());
+        std::size_t c = 0;
+        for (std::size_t i = 0; i != value_size; ++i)
+        {
+          for (VertexIterator v(*cell); !v.end(); ++v)
+          {
+            const std::size_t v0 = v->index()*width;
+            data_dofs[v0 + i] = dofs[c];
+            ++c;
+          }
+          for (EdgeIterator e(*cell); !e.end(); ++e)
+          {
+            const std::size_t e0 = (e->index() + mesh.size(0))*width;
+            data_dofs[e0 + i] = dofs[c];
+            ++c;
+          }
+        }
+      }
+
+      const GenericVector& uvec = *u.vector();
+      uvec.get_local(data_values.data(), data_dofs.size(), data_dofs.data());
+    }
+    else
+    {
+      dolfin_error("XDMFFile.cpp",
+                   "get point values for Function",
+                   "Function appears not to be defined on a P1 or P2 type FunctionSpace");
+    }
+
+    // Blank out empty values of 2D vector and tensor
+    if (value_rank == 1 and value_size == 2)
+    {
+      for (std::size_t i = 0; i < data_values.size(); i += 3)
+        data_values[i + 2] = 0.0;
+    }
+    else if (value_rank == 2 and value_size == 4)
+    {
+      for (std::size_t i = 0; i < data_values.size(); i += 9)
+      {
+        data_values[i + 2] = 0.0;
+        data_values[i + 5] = 0.0;
+        data_values[i + 6] = 0.0;
+        data_values[i + 7] = 0.0;
+        data_values[i + 8] = 0.0;
+      }
+    }
+  }
+}
+//----------------------------------------------------------------------------
+void XDMFFile::check_encoding(Encoding encoding) const
+{
+  if (encoding == Encoding::HDF5 and !has_hdf5())
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "write XDMF file",
+                 "DOLFIN has not been compiled with HDF5 support");
+  }
+
+  if (encoding == Encoding::ASCII and MPI::size(_mpi_comm) != 1)
+  {
+    dolfin_error("XDMFFile.cpp",
+                 "write XDMF file",
+                 "ASCII format is not supported in parallel, use HDF5");
+  }
+}
+//-----------------------------------------------------------------------------
+std::string XDMFFile::generate_xdmf_ascii_mesh_topology_data(const Mesh& mesh)
+{
+  return generate_xdmf_ascii_mesh_topology_data(mesh, mesh.geometry().dim());
+}
+//-----------------------------------------------------------------------------
+std::string
+XDMFFile::generate_xdmf_ascii_mesh_topology_data(const Mesh& mesh,
+                                                 const std::size_t edim)
+{
+  std::unique_ptr<CellType>
+    celltype(CellType::create(mesh.type().entity_type(edim)));
+
+  // Permutation to VTK ordering
+  const std::vector<std::int8_t> perm = celltype->vtk_mapping();
+
+  std::string topology_xml_value;
+  topology_xml_value += "\n";
+  if (edim == 0)
+  {
+    for (VertexIterator v(mesh); !v.end(); ++v)
+    {
+      topology_xml_value
+        += boost::str(boost::format("%d") % v->global_index()) + "\n";
+    }
+  }
+  else
+  {
+    for (MeshEntityIterator c(mesh, edim); !c.end(); ++c)
+    {
+      for (unsigned int i = 0; i != c->num_entities(0); ++i)
+      {
+        const std::size_t local_idx = c->entities(0)[perm[i]];
+        topology_xml_value
+          += boost::str(boost::format("%d") % local_idx) + " ";
+      }
+      topology_xml_value += "\n";
+    }
+  }
+
+  return topology_xml_value;
+}
+//-----------------------------------------------------------------------------
+std::string XDMFFile::generate_xdmf_ascii_mesh_geometry_data(const Mesh& mesh)
+{
+  const std::size_t gdim = mesh.geometry().dim();
+  std::string geometry_xml_value;
+  for (VertexIterator v(mesh); !v.end(); ++v)
+  {
+    geometry_xml_value += "\n";
+    const double* p = v->x();
+    for (size_t i = 0; i < gdim; ++i)
+      geometry_xml_value += boost::str(boost::format("%.15e") % p[i]) + " ";
+  }
+  geometry_xml_value += "\n";
+  return geometry_xml_value;
+}
+//-----------------------------------------------------------------------------
+template<typename T>
+std::string XDMFFile::generate_xdmf_ascii_data(const T& data,
+                                               std::string format)
+{
+  std::string data_str;
+  data_str += "\n";
+  for (std::size_t j = 0; j < data.size(); ++j)
+    data_str += boost::str(boost::format(format) % data[j]) + "\n";
+  return data_str;
+}
+//-----------------------------------------------------------------------------
+template<typename T>
+std::string XDMFFile::generate_xdmf_ascii_data(const T& data)
+{
+  std::string data_str;
+  data_str += "\n";
+  for (std::size_t j = 0; j < data.size(); ++j)
+    data_str += boost::lexical_cast<std::string>(data[j]) + "\n";
+  return data_str;
+}
+//-----------------------------------------------------------------------------
+XDMFFile::Encoding XDMFFile::get_file_encoding() const
+{
+  dolfin_assert(_xml);
+  _xml->read();
+  const std::string xml_encoding_attrib = _xml->data_encoding();
+
+  return get_file_encoding(xml_encoding_attrib);
+}
+//-----------------------------------------------------------------------------
+XDMFFile::Encoding XDMFFile::get_file_encoding(std::string xml_encoding_attrib)
+{
+  return (xml_encoding_attrib == "XML") ? Encoding::ASCII : Encoding::HDF5;
+}
+//-----------------------------------------------------------------------------
+template <typename T> void XDMFFile::write_ascii_mesh_value_collection(
+  const MeshValueCollection<T>& mesh_values,
+  const std::string name)
+{
+  const std::size_t dim = mesh_values.dim();
+  std::shared_ptr<const Mesh> mesh = mesh_values.mesh();
+
+  const std::map<std::pair<std::size_t, std::size_t>, T>& values
+    = mesh_values.values();
+
+  CellType::Type cell_type = mesh->type().entity_type(dim);
+  std::unique_ptr<CellType> entity_type(CellType::create(cell_type));
+
+  std::vector<T> value_data;
+  value_data.reserve(values.size());
+  std::string topology;
+  topology += "\n";
+
+  const std::size_t tdim = mesh->topology().dim();
+  mesh->init(tdim, dim);
+  for (auto &p : values)
+  {
+    MeshEntity cell = Cell(*mesh, p.first.first);
+    if (dim != tdim)
+    {
+      const unsigned int entity_local_idx = cell.entities(dim)[p.first.second];
+      cell = MeshEntity(*mesh, dim, entity_local_idx);
+    }
+
+    for (VertexIterator v(cell); !v.end(); ++v)
+      topology += boost::str(boost::format("%d") % v->global_index()) + " ";
+
+    topology += "\n";
+
+    dolfin_assert(_xml);
+    _xml->mesh_topology(cell_type, 1, mesh_values.size(), topology,
+                        xdmf_format_str(Encoding::ASCII));
+
+    _xml->data_attribute(mesh_values.name(), 0, false,
+                         mesh->size_global(0), mesh_values.size(),
+                         1, generate_xdmf_ascii_data(value_data),
+                         xdmf_format_str(Encoding::ASCII));
+  }
+}
+//-----------------------------------------------------------------------------
+std::string XDMFFile::vtk_cell_type_str(CellType::Type cell_type, int order)
+{
+  // FIXME: Move to CellType?
+  switch (cell_type)
+  {
+  case CellType::Type::point:
+    switch (order)
+    {
+    case 1:
+      return "PolyVertex";
+    }
+  case CellType::Type::interval:
+    switch (order)
+    {
+    case 1:
+      return "PolyLine";
+    case 2:
+      return "Edge_3";
+    }
+  case CellType::Type::triangle:
+    switch (order)
+    {
+    case 1:
+      return "Triangle";
+    case 2:
+      return "Tri_6";
+    }
+  case CellType::Type::quadrilateral:
+    switch (order)
+    {
+    case 1:
+      return "Quadrilateral";
+    case 2:
+      return "Qaud_8";
+    }
+  case CellType::Type::tetrahedron:
+    switch (order)
+    {
+    case 1:
+      return "Tetrahedron";
+    case 2:
+      return "Tet_10";
+    }
+  case CellType::Type::hexahedron:
+    switch (order)
+    {
+    case 1:
+      return "Hexahedron";
+    case 2:
+      return "Hex_20";
+    }
+  default:
+    dolfin_error("XDMFFile.cpp",
+                 "output mesh topology",
+                 "Invalid combination of cell type and order");
+    return "error";
+  }
+}
+//-----------------------------------------------------------------------------
+template <typename X, typename Y>
+std::string XDMFFile::to_string(X x, Y y)
+{
+  return std::to_string(x) + " " + std::to_string(y);
+}
+//-----------------------------------------------------------------------------
+template <typename T>
+std::vector<T> XDMFFile::string_to_vector(const std::vector<std::string>& x_str)
+{
+  std::vector<T> data;
+  for (auto& v : x_str)
+  {
+    if (!v.empty())
+      data.push_back(boost::lexical_cast<T>(v));
+  }
+
+  return data;
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/io/XDMFFile.h b/dolfin/io/XDMFFile.h
index dda1ce2..e083887 100644
--- a/dolfin/io/XDMFFile.h
+++ b/dolfin/io/XDMFFile.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Chris N. Richardson and Garth N. Wells
+// Copyright (C) 2012-2015 Chris N. Richardson and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -20,119 +20,367 @@
 #ifndef __DOLFIN_XDMFFILE_H
 #define __DOLFIN_XDMFFILE_H
 
-#ifdef HAS_HDF5
-
+#include <cstdint>
 #include <memory>
 #include <string>
 #include <utility>
 #include <vector>
 
+#ifdef HAS_HDF5
+#include <hdf5.h>
+#else
+typedef int hid_t;
+#endif
+
 #include <dolfin/common/MPI.h>
 #include <dolfin/common/Variable.h>
-#include "GenericFile.h"
+
+namespace boost
+{
+  namespace filesystem
+  {
+    class path;
+  }
+}
+
+namespace pugi
+{
+  class xml_node;
+}
 
 namespace dolfin
 {
 
   // Forward declarations
   class Function;
+#ifdef HAS_HDF5
   class HDF5File;
+#endif
+  class LocalMeshData;
   class Mesh;
   template<typename T> class MeshFunction;
+  template<typename T> class MeshValueCollection;
   class Point;
+  class XDMFxml;
 
   /// This class supports the output of meshes and functions in XDMF
-  /// (http://www.xdmf.org) format. It creates an XML file that describes
-  /// the data and points to a HDF5 file that stores the actual problem
-  /// data. Output of data in parallel is supported.
+  /// (http://www.xdmf.org) format. It creates an XML file that
+  /// describes the data and points to a HDF5 file that stores the
+  /// actual problem data. Output of data in parallel is supported.
   ///
-  /// XDMF is not suitable for checkpointing as it may decimate
-  /// some data.
+  /// XDMF is not suitable for checkpointing as it may decimate some
+  /// data.
 
-  class XDMFFile : public GenericFile, public Variable
+  class XDMFFile : public Variable
   {
   public:
 
+    /// File encoding type
+    enum class Encoding {HDF5, ASCII};
+
+    /// Re-use any partition stored in file
+    enum class UseFilePartition : bool {yes=true, no=false};
+
+    /// Constructor
+    XDMFFile(const std::string filename)
+      : XDMFFile(MPI_COMM_WORLD, filename) {}
+
     /// Constructor
     XDMFFile(MPI_Comm comm, const std::string filename);
 
     /// Destructor
     ~XDMFFile();
 
-    /// Save a mesh for visualisation, with e.g. ParaView. Creates a HDF5
-    /// file to store the mesh, and a related XDMF file with metadata.
-    void operator<< (const Mesh& mesh);
+    /// Save a mesh to XDMF format, either using an associated HDF5
+    /// file, or storing the data inline as XML Create function on
+    /// given function space
+    ///
+    /// *Arguments*
+    ///     mesh (_Mesh_)
+    ///         A mesh to save.
+    ///     encoding (_Encoding_)
+    ///         Encoding to use: HDF5 or ASCII
+    ///
+    void write(const Mesh& mesh, Encoding encoding=Encoding::HDF5);
 
-    /// Read in a mesh from the associated HDF5 file,
-    /// optionally using stored partitioning, if possible
-    /// when the same number of processes are being used.
-    void read(Mesh& mesh, bool use_partition_from_file);
+    /// Save a Function to XDMF file for visualisation, using an
+    /// associated HDF5 file, or storing the data inline as XML.
+    ///
+    /// *Arguments*
+    ///     u (_Function_)
+    ///         A function to save.
+    ///     encoding (_Encoding_)
+    ///         Encoding to use: HDF5 or ASCII
+    ///
+    void write(const Function& u, Encoding encoding=Encoding::HDF5);
 
-    /// Read in a mesh from the associated HDF5 file
-    void operator>> (Mesh& mesh);
+    /// Save a Function with timestamp to XDMF file for visualisation,
+    /// using an associated HDF5 file, or storing the data inline as
+    /// XML.
+    ///
+    /// *Arguments*
+    ///     u (_Function_)
+    ///         A function to save.
+    ///     t (_double_)
+    ///         Timestep
+    ///     encoding (_Encoding_)
+    ///         Encoding to use: HDF5 or ASCII
+    ///
+    void write(const Function& u, double t, Encoding encoding=Encoding::HDF5);
 
-    /// Save a quadratic Function to a quadratic Mesh defined
-    /// by a geometry Function
-    void write_quadratic(const Function& u_geom, const Function& u_val);
+    /// Save MeshFunction to file using an associated HDF5 file, or
+    /// storing the data inline as XML.
+    ///
+    /// *Arguments*
+    ///     meshfunction (_MeshFunction_)
+    ///         A meshfunction to save.
+    ///     encoding (_Encoding_)
+    ///         Encoding to use: HDF5 or ASCII
+    ///
+    void write(const MeshFunction<bool>& meshfunction,
+               Encoding encoding=Encoding::HDF5);
+    void write(const MeshFunction<int>& meshfunction,
+               Encoding encoding=Encoding::HDF5);
+    void write(const MeshFunction<std::size_t>& meshfunction,
+               Encoding encoding=Encoding::HDF5);
+    void write(const MeshFunction<double>& meshfunction,
+               Encoding encoding=Encoding::HDF5);
 
-    /// Save a Function to XDMF/HDF5 files for visualisation.
-    void operator<< (const Function& u);
+    /// Write out mesh value collection (subset) using an associated
+    /// HDF5 file, or storing the data inline as XML.
+    ///
+    /// *Arguments*
+    ///     mvc (_MeshValueCollection<std::size_t>_)
+    ///         A list of points to save.
+    ///     encoding (_Encoding_)
+    ///         Encoding to use: HDF5 or ASCII
+    ///
+    void write(const MeshValueCollection<std::size_t>& mvc,
+               Encoding encoding=Encoding::HDF5);
 
-    /// Save Function + time stamp to file
-    void operator<< (const std::pair<const Function*, double> ut);
-
-    /// Save MeshFunction to file
-    void operator<< (const MeshFunction<bool>& meshfunction);
-    void operator<< (const MeshFunction<int>& meshfunction);
-    void operator<< (const MeshFunction<std::size_t>& meshfunction);
-    void operator<< (const MeshFunction<double>& meshfunction);
-
-    /// Save a cloud of points to file
-    void write(const std::vector<Point>& points);
+    /// Save a cloud of points to file using an associated HDF5 file,
+    /// or storing the data inline as XML.
+    ///
+    /// *Arguments*
+    ///     points (_std::vector<Point>_)
+    ///         A list of points to save.
+    ///     encoding (_Encoding_)
+    ///         Encoding to use: HDF5 or ASCII
+    ///
+    void write(const std::vector<Point>& points,
+               Encoding encoding=Encoding::HDF5);
 
-    /// Save a cloud of points, with scalar values
+    /// Save a cloud of points, with scalar values using an associated
+    /// HDF5 file, or storing the data inline as XML.
+    ///
+    /// *Arguments*
+    ///     points (_std::vector<Point>_)
+    ///         A list of points to save.
+    ///     values (_std::vector<double>_)
+    ///         A list of values at each point.
+    ///     encoding (_Encoding_)
+    ///         Encoding to use: HDF5 or ASCII
+    ///
     void write(const std::vector<Point>& points,
-               const std::vector<double>& values);
+               const std::vector<double>& values,
+               Encoding encoding=Encoding::HDF5);
 
-    using GenericFile::write;
+    /// Read in a mesh from the associated HDF5 file, optionally using
+    /// stored partitioning, if possible when the same number of
+    /// processes are being used.
+    ///
+    /// *Arguments*
+    ///     mesh (_Mesh_)
+    ///
+    ///     use_partition_from_file (_UseFilePartition_)
+    ///         Use the existing partition information in HDF5 file
+    ///
+    void read(Mesh& mesh,
+              UseFilePartition use_file_partition=UseFilePartition::no);
 
     /// Read first MeshFunction from file
-    void operator>> (MeshFunction<bool>& meshfunction);
-    void operator>> (MeshFunction<int>& meshfunction);
-    void operator>> (MeshFunction<std::size_t>& meshfunction);
-    void operator>> (MeshFunction<double>& meshfunction);
+    void read(MeshFunction<bool>& meshfunction);
+    void read(MeshFunction<int>& meshfunction);
+    void read(MeshFunction<std::size_t>& meshfunction);
+    void read(MeshFunction<double>& meshfunction);
+
+    // Write mesh
+    void write_new(const Mesh& mesh, Encoding encoding=Encoding::HDF5) const;
+
+    // Read mesh
+    void read_new(Mesh& mesh) const;
 
   private:
 
-    // MPI communicator
-    MPI_Comm _mpi_comm;
+    // Build mesh (serial)
+    static void build_mesh(Mesh& mesh, std::string cell_type_str,
+                           std::int64_t num_points, std::int64_t num_cells,
+                           int num_points_per_cell,
+                           int tdim, int gdim,
+                           const pugi::xml_node& topology_dataset_node,
+                           const pugi::xml_node& geometry_dataset_node,
+                           const boost::filesystem::path& parent_path);
 
-    // HDF5 data file
-    std::unique_ptr<HDF5File> hdf5_file;
+   // Build local mesh data structure
+   static void
+   build_local_mesh_data (LocalMeshData& local_mesh_data,
+                          const CellType& cell_type,
+                          const std::int64_t num_points,
+                          const std::int64_t num_cells,
+                          const int num_points_per_cell,
+                          const int tdim, const int gdim,
+                          const pugi::xml_node& topology_dataset_node,
+                          const pugi::xml_node& geometry_dataset_node,
+                          const boost::filesystem::path& parent_path);
+
+    // Add topology node to xml_node (includes writing data to XML or  HDF5
+    // file)
+    template<typename T>
+    static void add_topology_data(MPI_Comm comm, pugi::xml_node& xml_node,
+                                  hid_t h5_id, const std::string path_prefix,
+                                  const Mesh& mesh);
 
-    // HDF5 filename
-    std::string hdf5_filename;
+    // Add geometry node and data to xml_node
+    static void add_geometry_data(MPI_Comm comm, pugi::xml_node& xml_node,
+                                  hid_t h5_id, const std::string path_prefix,
+                                  const Mesh& mesh);
 
-    // HDF5 file mode (r/w)
-    std::string hdf5_filemode;
+    // Add DataItem node to an XML node. If HDF5 is open (h5_id > 0) the data is
+    // written to the HDFF5 file with the path 'h5_path'. Otherwise, data is
+    // witten to the XML node and 'h5_path' is ignored
+    template<typename T>
+    static void add_data_item(MPI_Comm comm, pugi::xml_node& xml_node,
+                              hid_t h5_id, const std::string h5_path, const T& x,
+                              const std::vector<std::int64_t> dimensions);
 
-    // Generic MeshFunction writer
+    // Return topology data on this process as a flat vector
     template<typename T>
-      void write_mesh_function(const MeshFunction<T>& meshfunction);
+    static std::vector<T> compute_topology_data(const Mesh& mesh, int cell_dim);
+
+    // Get DOLFIN cell type string from XML topology node
+    static std::string get_cell_type(const pugi::xml_node& topology_node);
+
+    // Get dimensions from an XML DataSet node
+    static std::vector<std::int64_t>
+      get_dataset_shape(const pugi::xml_node& dataset_node);
+
+    // Get number of cells from an XML Topology node
+    static std::int64_t get_num_cells(const pugi::xml_node& topology_node);
+
+    // Return data associated with a data set node
+    template <typename T>
+    static std::vector<T> get_dataset(MPI_Comm comm,
+                                      const pugi::xml_node& dataset_node,
+                                      const boost::filesystem::path& parent_path);
+
+    // Return (0) HDF5 filename and (1) path in HDF5 file from a DataItem node
+    std::array<std::string, 2> get_hdf5_paths(const pugi::xml_node& dataitem_node);
+
+    static std::string get_hdf5_filename(std::string xdmf_filename);
 
     // Generic MeshFunction reader
     template<typename T>
-      void read_mesh_function(MeshFunction<T>& meshfunction);
+    void read_mesh_function(MeshFunction<T>& meshfunction);
 
-    // Write XML description of point clouds, with value_size = 0, 1 or 3
-    // (for either no point data, scalar, or vector)
+    // Generic MeshFunction writer
+    template<typename T>
+    void write_mesh_function(const MeshFunction<T>& meshfunction,
+                             std::string format, Encoding encoding);
+
+    // Write XML description of point clouds, with value_size = 0, 1
+    // or 3 (for either no point data, scalar, or vector)
     void write_point_xml(const std::string dataset_name,
                          const std::size_t num_global_points,
-                         const unsigned int value_size);
+                         const unsigned int value_size, Encoding encoding);
+
+    // Get point data values for linear or quadratic mesh into
+    // flattened 2D array in data_values with given width
+    void get_point_data_values(std::vector<double>& data_values,
+                               std::size_t width, const Function& u) const;
+
+    // Check whether the requested encoding is supported
+    void check_encoding(Encoding encoding) const;
+
+    // Generate the XDMF format string based on the Encoding
+    // enumeration
+    static std::string xdmf_format_str(Encoding encoding)
+    { return (encoding == XDMFFile::Encoding::HDF5) ? "HDF" : "XML"; }
+
+    // Generate the data string to insert in an xdmf file for the mesh
+    // cell to node connectivity
+    static std::string generate_xdmf_ascii_mesh_topology_data(const Mesh& mesh);
+
+    // Generate the data string to insert in an xdmf file for the mesh
+    // for the topology of entitiy dimension edim -> 0
+    static std::string
+    generate_xdmf_ascii_mesh_topology_data(const Mesh& mesh,
+                                           const std::size_t edim);
+
+    // Generate the data string to insert in an xdmf file for the mesh
+    // point cloud
+    static std::string generate_xdmf_ascii_mesh_geometry_data(const Mesh& mesh);
+
+    // Generate a string of the vertex data numeric values contained
+    // in the data argument which can then be inserted into an xdmf
+    // file. The numeric data is formatted according to the format
+    // argument. E.g:
+    //    generate_xdmf_ascii_data(data_values, "%.15e")
+    template<typename T>
+    static std::string generate_xdmf_ascii_data(const T& data,
+                                                std::string format);
+
+    // As XDMFFile::generate_xdmf_ascii_data, using
+    // boost::lexical_cast to format the numeric data as a string.
+    template<typename T>
+    static std::string generate_xdmf_ascii_data(const T& data);
+
+    // Determine the encoding of the data from the xml file.
+    Encoding get_file_encoding() const;
+
+    // Determine the encoding enumeration value from the xdmf format
+    // string E.g. "XML" or "HDF" See XDMFFile::xdmf_format_str
+    static Encoding get_file_encoding(std::string xdmf_format);
+
+    // Write MVC to ascii string to store in XDMF XML file
+    template <typename T>
+    void write_ascii_mesh_value_collection(const MeshValueCollection<T>& mesh_values,
+                                             std::string data_name);
+
+    static std::string vtk_cell_type_str(CellType::Type cell_type, int order);
+
+    // Return a string of the form "x y"
+    template <typename X, typename Y>
+    static std::string to_string(X x, Y y);
+
+    // Return a vector of numerical values from a vector of stringstream
+    template <typename T>
+    static std::vector<T> string_to_vector(const std::vector<std::string>& x_str);
+
+    // MPI communicator
+    MPI_Comm _mpi_comm;
+
+    // HDF5 data file
+#ifdef HAS_HDF5
+    std::unique_ptr<HDF5File> _hdf5_file;
+#endif
+
+    // HDF5 file mode (r/w)
+    std::string _hdf5_filemode;
 
     // Most recent mesh name
-    std::string current_mesh_name;
+    std::string _current_mesh_name;
+
+    // Cached filename
+    const std::string _filename;
+
+    // Counter for time series
+    std::size_t _counter;
+
+    // The xml document of the XDMF file
+    std::unique_ptr<XDMFxml> _xml;
+
   };
+
 }
-#endif
+
 #endif
diff --git a/dolfin/io/XDMFxml.cpp b/dolfin/io/XDMFxml.cpp
index 2febaff..3fd6e52 100644
--- a/dolfin/io/XDMFxml.cpp
+++ b/dolfin/io/XDMFxml.cpp
@@ -15,11 +15,11 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 
-#ifdef HAS_HDF5
-
+#include <iostream>
 #include <string>
 #include <vector>
 #include <boost/algorithm/string.hpp>
+#include <boost/filesystem.hpp>
 #include <boost/format.hpp>
 
 #include <dolfin/log/log.h>
@@ -28,7 +28,8 @@
 using namespace dolfin;
 
 //----------------------------------------------------------------------------
-XDMFxml::XDMFxml(std::string filename): _filename(filename)
+XDMFxml::XDMFxml(std::string filename): _filename(filename),
+                                        _is_this_first_write(true)
 {
   // Do nothing
 }
@@ -38,15 +39,6 @@ XDMFxml::~XDMFxml()
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-void XDMFxml::header()
-{
-  xml_doc.append_child(pugi::node_doctype).set_value("Xdmf SYSTEM \"Xdmf.dtd\" []");
-  pugi::xml_node xdmf = xml_doc.append_child("Xdmf");
-  xdmf.append_attribute("Version") = "2.0";
-  xdmf.append_attribute("xmlns:xi") = "http://www.w3.org/2001/XInclude";
-  xdmf.append_child("Domain");
-}
-//----------------------------------------------------------------------------
 void XDMFxml::write() const
 {
   // Write XML file
@@ -55,66 +47,138 @@ void XDMFxml::write() const
 //-----------------------------------------------------------------------------
 void XDMFxml::read()
 {
+  // Check that file exsist
+  if (!boost::filesystem::exists(_filename))
+  {
+    dolfin_error("XDMFxml.cpp",
+                 "read XDMF file",
+                 "File does not exist");
+  }
+
+  // Load XML doc from file
   pugi::xml_parse_result result = xml_doc.load_file(_filename.c_str());
+
+  // Check that file was successfully parsed
   if (!result)
   {
     dolfin_error("XDMFxml.cpp",
                  "read mesh from XDMF/H5 files",
-                 "XML parsing error.");
+                 "Error opening XML file");
   }
 }
 //-----------------------------------------------------------------------------
-std::string XDMFxml::meshname() const
+XDMFxml::TopologyData XDMFxml::get_topology() const
 {
   // Topology - check format and get dataset name
   pugi::xml_node xdmf_topology
     = xml_doc.child("Xdmf").child("Domain")
-             .child("Grid").child("Topology").child("DataItem");
-  if (!xdmf_topology)
+             .child("Grid").child("Topology");
+  pugi::xml_node xdmf_topology_data = xdmf_topology.child("DataItem");
+
+  if (!xdmf_topology or !xdmf_topology_data)
   {
     dolfin_error("XDMFxml.cpp",
                  "read mesh from XDMF/H5 files",
                  "XML parsing error. XDMF file should contain only one mesh/dataset");
   }
 
-  const std::string
-    topological_data_format(xdmf_topology.attribute("Format").value());
-  if (topological_data_format != "HDF")
+  XDMFxml::TopologyData tdata;
+  tdata.format = xdmf_topology_data.attribute("Format").value();
+
+  // Usually, the DOLFIN CellType is just the lower case of the VTK name
+  // FIXME: this will fail for 1D and quadratic topology
+  tdata.cell_type = xdmf_topology.attribute("TopologyType").value();
+  boost::to_lower(tdata.cell_type);
+
+  std::string topology_dim(xdmf_topology_data.attribute("Dimensions").as_string());
+  std::vector<std::string> topology_dim_vec;
+  boost::split(topology_dim_vec, topology_dim, boost::is_any_of(" "));
+
+  tdata.num_cells = std::stol(topology_dim_vec[0]);
+  tdata.points_per_cell = std::stol(topology_dim_vec[1]);
+
+  if (tdata.format == "XML")
   {
-    dolfin_error("XDMFxml.cpp",
-                 "read mesh from XDMF/H5 files",
-                 "XML parsing error. Wrong dataset format (not HDF5)");
+    tdata.data = xdmf_topology_data.first_child().value();
+    boost::trim(tdata.data);
   }
+  else if (tdata.format == "HDF")
+  {
+    // Get data paths
+    std::array<std::string, 2> paths = get_hdf5_paths(xdmf_topology_data);
 
-  const std::string topo_ref(xdmf_topology.first_child().value());
-  std::vector<std::string> topo_bits;
-  boost::split(topo_bits, topo_ref, boost::is_any_of(":/"));
-
-  // Should have 5 elements "filename.h5", "", "Mesh", "meshname", "topology"
-  dolfin_assert(topo_bits.size() == 5);
-  dolfin_assert(topo_bits[2] == "Mesh");
-  dolfin_assert(topo_bits[4] == "topology");
+    // Store paths
+    tdata.hdf5_filename = paths[0];
+    tdata.hdf5_dataset = paths[1];
+  }
+  else
+  {
+    dolfin_error("XDMFxml.cpp",
+                 "get topology",
+                 "Unknown data format");
+  }
 
+  return tdata;
+}
+//-----------------------------------------------------------------------------
+XDMFxml::GeometryData XDMFxml::get_geometry() const
+{
   // Geometry - check format and get dataset name
-  pugi::xml_node xdmf_geometry =
-    xml_doc.child("Xdmf").child("Domain").child("Grid").child("Geometry").child("DataItem");
+  pugi::xml_node xdmf_geometry
+    = xml_doc.child("Xdmf").child("Domain").child("Grid").child("Geometry");
   dolfin_assert(xdmf_geometry);
 
-  const std::string geom_fmt(xdmf_geometry.attribute("Format").value());
-  dolfin_assert(geom_fmt == "HDF");
+  pugi::xml_node xdmf_geometry_data = xdmf_geometry.child("DataItem");
+  dolfin_assert(xdmf_geometry_data);
+
+  GeometryData gdata;
+
+  std::string geo_dim(xdmf_geometry_data.attribute("Dimensions").as_string());
+  std::vector<std::string> geo_vec;
+  boost::split(geo_vec, geo_dim, boost::is_any_of(" "));
+
+  gdata.num_points = std::stol(geo_vec[0]);
+  gdata.dim = std::stoul(geo_vec[1]);
+
+  gdata.format = xdmf_geometry_data.attribute("Format").value();
+
+  if (gdata.format == "XML")
+  {
+    gdata.data = xdmf_geometry_data.first_child().value();
+    boost::trim(gdata.data);
+  }
+  else if (gdata.format == "HDF")
+  {
+    // Get data paths
+    std::array<std::string, 2> paths = get_hdf5_paths(xdmf_geometry_data);
+
+    // Store paths
+    gdata.hdf5_filename = paths[0];
+    gdata.hdf5_dataset = paths[1];
+  }
+  else
+  {
+    dolfin_error("XDMFxml.cpp",
+                 "get geometry",
+                 "Unknown data format");
+  }
 
-  const std::string geom_ref(xdmf_geometry.first_child().value());
-  std::vector<std::string> geom_bits;
-  boost::split(geom_bits, geom_ref, boost::is_any_of(":/"));
+  return gdata;
+}
+//-----------------------------------------------------------------------------
+std::string XDMFxml::get_first_data_set() const
+{
+  // Values - check format and get dataset name
+  pugi::xml_node xdmf_values = xml_doc.child("Xdmf").child("Domain").
+      child("Grid").child("Grid").child("Attribute").child("DataItem");
+  dolfin_assert(xdmf_values);
 
-  // Should have 5 elements "filename.h5", "", "Mesh", "meshname",
-  // "coordinates"
-  dolfin_assert(geom_bits.size() == 5);
-  dolfin_assert(geom_bits[2] == "Mesh");
-  dolfin_assert(geom_bits[3] == topo_bits[3]);
-  dolfin_assert(geom_bits[4] == "coordinates");
+  const std::string value_fmt(xdmf_values.attribute("Format").value());
+//  dolfin_assert(value_fmt == "XML");
 
-  return geom_bits[3];
+  std::string data_value(xdmf_values.first_child().value());
+  boost::trim(data_value);
+  return data_value;
 }
 //-----------------------------------------------------------------------------
 std::string XDMFxml::dataname() const
@@ -137,28 +201,42 @@ std::string XDMFxml::dataname() const
   return value_bits[3];
 }
 //-----------------------------------------------------------------------------
+std::string XDMFxml::data_encoding() const
+{
+  // Values - check format and get dataset name
+  pugi::xml_node xdmf_values = xml_doc.child("Xdmf").child("Domain").
+      child("Grid").child("Grid").child("Attribute").child("DataItem");
+  dolfin_assert(xdmf_values);
+
+  const std::string value_fmt(xdmf_values.attribute("Format").value());
+  return value_fmt;
+}
+//-----------------------------------------------------------------------------
 void XDMFxml::data_attribute(std::string name,
                              std::size_t value_rank,
                              bool vertex_data,
                              std::size_t num_total_vertices,
                              std::size_t num_global_cells,
                              std::size_t padded_value_size,
-                             std::string dataset_name)
+                             std::string dataset_name,
+                             std::string format)
 {
   // Grid/Attribute (Function value data)
   pugi::xml_node xdmf_values = xdmf_grid.append_child("Attribute");
   xdmf_values.append_attribute("Name") = name.c_str();
 
   dolfin_assert(value_rank < 3);
+  // 1D Vector should be treated as a Scalar
+  std::size_t apparent_value_rank = (padded_value_size == 1) ? 0 : value_rank;
   static std::vector<std::string> attrib_type
     = {"Scalar", "Vector", "Tensor"};
   xdmf_values.append_attribute("AttributeType")
-    = attrib_type[value_rank].c_str();
+    = attrib_type[apparent_value_rank].c_str();
 
   xdmf_values.append_attribute("Center") = (vertex_data ? "Node" : "Cell");
 
   pugi::xml_node xdmf_data = xdmf_values.append_child("DataItem");
-  xdmf_data.append_attribute("Format") = "HDF";
+  xdmf_data.append_attribute("Format") = format.c_str();
 
   const std::size_t num_total_entities
     = (vertex_data ? num_total_vertices : num_global_cells);
@@ -171,7 +249,9 @@ void XDMFxml::data_attribute(std::string name,
 //-----------------------------------------------------------------------------
 pugi::xml_node XDMFxml::init_mesh(std::string name)
 {
+  // If a new file, add a header
   header();
+
   pugi::xml_node xdmf_domain = xml_doc.child("Xdmf").child("Domain");
   dolfin_assert(xdmf_domain);
   xdmf_grid = xdmf_domain.append_child("Grid");
@@ -185,22 +265,8 @@ pugi::xml_node XDMFxml::init_mesh(std::string name)
 pugi::xml_node XDMFxml::init_timeseries(std::string name, double time_step,
                                         std::size_t counter)
  {
-   if (counter == 0)
-   {
-     // First time step - create document template
-     header();
-   }
-   else
-   {
-     // Subsequent timestep - read in existing XDMF file
-     pugi::xml_parse_result result = xml_doc.load_file(_filename.c_str());
-     if (!result)
-     {
-       dolfin_error("XDMFxml.cpp",
-                    "write data to XDMF file",
-                    "XML parsing error when reading from existing file");
-     }
-   }
+   // If a new file, add a header
+   header();
 
    pugi::xml_node xdmf_domain = xml_doc.child("Xdmf").child("Domain");
    dolfin_assert(xdmf_domain);
@@ -282,7 +348,8 @@ pugi::xml_node XDMFxml::init_timeseries(std::string name, double time_step,
 void XDMFxml::mesh_topology(const CellType::Type cell_type,
                             const std::size_t cell_order,
                             const std::size_t num_global_cells,
-                            const std::string reference)
+                            const std::string xml_value_data,
+                            const std::string format)
 {
   pugi::xml_node xdmf_topology = xdmf_grid.child("Topology");
   pugi::xml_node xdmf_topology_data = xdmf_topology.child("DataItem");
@@ -338,24 +405,24 @@ void XDMFxml::mesh_topology(const CellType::Type cell_type,
                  "Invalid combination of cell type and order");
   }
 
-  if (reference.size() > 0)
+  if (xml_value_data.size() > 0)
   {
     // Refer to all cells and dimensions
     xdmf_topology_data = xdmf_topology.append_child("DataItem");
-    xdmf_topology_data.append_attribute("Format") = "HDF";
+    xdmf_topology_data.append_attribute("Format") = format.c_str();
     const std::string cell_dims = std::to_string(num_global_cells)
       + " " + std::to_string(nodes_per_element);
     xdmf_topology_data.append_attribute("Dimensions") = cell_dims.c_str();
 
-    const std::string topology_reference = reference + "/topology";
-    xdmf_topology_data.append_child(pugi::node_pcdata)
-      .set_value(topology_reference.c_str());
+    xdmf_topology_data.append_child(pugi::node_pcdata).set_value(xml_value_data.c_str());
   }
 }
 //----------------------------------------------------------------------------
 void XDMFxml::mesh_geometry(const std::size_t num_total_vertices,
                             const std::size_t gdim,
-                            const std::string reference)
+                            const std::string xml_value_data,
+                            const std::string format,
+                            const bool is_reference)
 {
   pugi::xml_node xdmf_geometry = xdmf_grid.child("Geometry");
   pugi::xml_node xdmf_geom_data = xdmf_geometry.child("DataItem");
@@ -379,7 +446,10 @@ void XDMFxml::mesh_geometry(const std::size_t num_total_vertices,
   xdmf_geometry.append_attribute("GeometryType") = geometry_type.c_str();
   xdmf_geom_data = xdmf_geometry.append_child("DataItem");
 
-  xdmf_geom_data.append_attribute("Format") = "HDF";
+  if (is_reference)
+    xdmf_geom_data.append_attribute("Reference") = format.c_str();
+  else
+    xdmf_geom_data.append_attribute("Format") = format.c_str();
   std::string geom_dim = std::to_string(num_total_vertices) + " "
     + std::to_string(gdim);
   xdmf_geom_data.append_attribute("Dimensions") = geom_dim.c_str();
@@ -415,8 +485,55 @@ void XDMFxml::mesh_geometry(const std::size_t num_total_vertices,
     xdmf_geom_2.append_child(pugi::node_pcdata).set_value(dummy_zeros.c_str());
   }
 
-  const std::string geometry_reference = reference + "/coordinates";
-  xdmf_geom_data.append_child(pugi::node_pcdata).set_value(geometry_reference.c_str());
+  xdmf_geom_data.append_child(pugi::node_pcdata).set_value(xml_value_data.c_str());
+}
+//-----------------------------------------------------------------------------
+void XDMFxml::header()
+{
+  dolfin_assert(xml_doc);
+
+// If a new file, add a header
+  if (!boost::filesystem::exists(_filename) or _is_this_first_write)
+  {
+    xml_doc.append_child(pugi::node_doctype).set_value("Xdmf SYSTEM \"Xdmf.dtd\" []");
+    pugi::xml_node xdmf = xml_doc.append_child("Xdmf");
+    xdmf.append_attribute("Version") = "2.0";
+    xdmf.append_attribute("xmlns:xi") = "http://www.w3.org/2001/XInclude";
+    xdmf.append_child("Domain");
+
+    write();
+    _is_this_first_write = false;
+  }
+  else
+  {
+    // Read in existing XDMF file
+    pugi::xml_parse_result result = xml_doc.load_file(_filename.c_str());
+    if (!result)
+    {
+      dolfin_error("XDMFxml.cpp",
+                   "write data to XDMF file",
+                   "XML parsing error when reading from existing file");
+    }
+  }
+}
+//----------------------------------------------------------------------------
+std::array<std::string, 2> XDMFxml::get_hdf5_paths(const pugi::xml_node& xml_node)
+{
+  dolfin_assert(xml_node);
+
+  // Get path data
+  pugi::xml_node path_node = xml_node.first_child();
+  dolfin_assert(path_node);
+
+  // Create string from path and trim leading and trailing whitespace
+  std::string path = path_node.text().get();
+  boost::algorithm::trim(path);
+
+  // Split string into file path and HD5 internal path
+  std::vector<std::string> paths;
+  boost::split(paths, path, boost::is_any_of(":"));
+  dolfin_assert(paths.size() == 2);
+
+  return {{paths[0], paths[1]}};
 }
 //-----------------------------------------------------------------------------
-#endif
diff --git a/dolfin/io/XDMFxml.h b/dolfin/io/XDMFxml.h
index 7c1682b..dded602 100644
--- a/dolfin/io/XDMFxml.h
+++ b/dolfin/io/XDMFxml.h
@@ -19,8 +19,7 @@
 #ifndef __DOLFIN_XDMFXML_H
 #define __DOLFIN_XDMFXML_H
 
-#ifdef HAS_HDF5
-
+#include <array>
 #include <string>
 #include <vector>
 #include <dolfin/mesh/CellType.h>
@@ -34,6 +33,29 @@ namespace dolfin
   {
   public:
 
+    class TopologyData
+    {
+    public:
+      std::string format;
+      std::string hdf5_filename;
+      std::string hdf5_dataset;
+      std::string cell_type;
+      std::size_t num_cells;
+      std::size_t points_per_cell;
+      std::string data;
+    };
+
+    class GeometryData
+    {
+    public:
+      std::string format;
+      std::string hdf5_filename;
+      std::string hdf5_dataset;
+      std::size_t num_points;
+      std::size_t dim;
+      std::string data;
+    };
+
     /// Constructor
     XDMFxml(std::string filename);
 
@@ -46,12 +68,24 @@ namespace dolfin
     /// Read from a file
     void read();
 
-    /// Get the (unique) Mesh name from the current XML
-    std::string meshname() const;
+    /// Get the (unique) Mesh topology name, split into three parts
+    /// (file name, dataset name, CellType) from the current XML
+    TopologyData get_topology() const;
+
+    /// Get the (unique) Mesh geometry name, split into two parts
+    /// (file name, dataset name) from the current XML
+    GeometryData get_geometry() const;
 
-    /// Get the (unique) dataset name for a MeshFunction in current XML
+    /// Get the (unique) dataset for a MeshFunction in current XML
+    std::string get_first_data_set() const;
+
+    /// Get the (unique) dataset name for a MeshFunction in current
+    /// XML
     std::string dataname() const;
 
+    /// Get the data encoding. "XML" or "HDF"
+    std::string data_encoding() const;
+
     /// Add a data item to the current grid
     void data_attribute(std::string name,
                         std::size_t value_rank,
@@ -59,14 +93,15 @@ namespace dolfin
                         std::size_t num_total_vertices,
                         std::size_t num_global_cells,
                         std::size_t padded_value_size,
-                        std::string dataset_name);
+                        std::string dataset_name,
+                        std::string format);
 
-    /// Initalise XML for a Mesh-like single output
-    /// returning the xdmf_grid node
+    /// Initalise XML for a Mesh-like single output returning the
+    /// xdmf_grid node
     pugi::xml_node init_mesh(std::string name);
 
-    /// Initialise XML for a TimeSeries-like output
-    /// returning the xdmf_grid node
+    /// Initialise XML for a TimeSeries-like output returning the
+    /// xdmf_grid node
     pugi::xml_node init_timeseries(std::string name, double time_step,
                                    std::size_t counter);
 
@@ -74,18 +109,26 @@ namespace dolfin
     void mesh_topology(const CellType::Type cell_type,
                        const std::size_t cell_order,
                        const std::size_t num_global_cells,
-                       const std::string reference);
+                       const std::string xml_value_data,
+                       const std::string format);
 
     /// Attach geometry to the current grid node
     void mesh_geometry(const std::size_t num_total_vertices,
                        const std::size_t gdim,
-                       const std::string reference);
+                       const std::string xml_value_data,
+                       const std::string format,
+                       const bool is_reference=false);
+
+     // Split HDF5 paths (file path and internal HDF5 path)
+     static
+     std::array<std::string, 2> get_hdf5_paths(const pugi::xml_node& xml_node);
 
   private:
 
     // Generate the XML header generic to all files
     void header();
 
+
     // The XML document
     pugi::xml_document xml_doc;
 
@@ -94,7 +137,10 @@ namespace dolfin
 
     // Filename
     std::string _filename;
+
+    // This is to ensure that when the file is written for the first
+    // time, it overwrites any existing file with the same name.
+    bool _is_this_first_write;
   };
 }
 #endif
-#endif
diff --git a/dolfin/io/XMLFile.cpp b/dolfin/io/XMLFile.cpp
index aebdb5e..c370ed8 100644
--- a/dolfin/io/XMLFile.cpp
+++ b/dolfin/io/XMLFile.cpp
@@ -104,7 +104,9 @@ void XMLFile::operator>> (Mesh& input_mesh)
     }
 
     // Partition and build mesh
-    MeshPartitioning::build_distributed_mesh(input_mesh, local_mesh_data);
+    const std::string ghost_mode = dolfin::parameters["ghost_mode"];
+    MeshPartitioning::build_distributed_mesh(input_mesh, local_mesh_data,
+                                             ghost_mode);
   }
 }
 //-----------------------------------------------------------------------------
@@ -299,7 +301,7 @@ void XMLFile::read_mesh_function(MeshFunction<T>& t,
     // Broadcast and set dimension
 
     // Build local data
-    LocalMeshValueCollection<T> local_data(mvc, dim);
+    LocalMeshValueCollection<T> local_data(_mpi_comm, mvc, dim);
 
     // Distribute MeshValueCollection
     MeshPartitioning::build_distributed_value_collection<T>(mvc, local_data,
@@ -354,7 +356,7 @@ void XMLFile::read_mesh_value_collection(MeshValueCollection<T>& t,
     }
 
     // Create local data and build value collection
-    LocalMeshValueCollection<T> local_data(tmp_collection,
+    LocalMeshValueCollection<T> local_data(_mpi_comm, tmp_collection,
                                            tmp_collection.dim());
 
     // Build mesh value collection
diff --git a/dolfin/io/XMLMesh.cpp b/dolfin/io/XMLMesh.cpp
index 1cf03de..b76e3b5 100644
--- a/dolfin/io/XMLMesh.cpp
+++ b/dolfin/io/XMLMesh.cpp
@@ -167,7 +167,8 @@ void XMLMesh::read_data(MeshData& data, const Mesh& mesh,
     if (node_name == "mesh_function")
     {
       // Create MeshFunction to read data into
-      MeshFunction<std::size_t> mf(mesh);
+      auto _mesh = reference_to_no_delete_pointer(mesh);
+      MeshFunction<std::size_t> mf(_mesh);
 
       // Read  MeshFunction
       //const std::string data_type = it->attribute("type").value();
@@ -214,7 +215,8 @@ void XMLMesh::read_data(MeshData& data, const Mesh& mesh,
       else if (data_set_type == "mesh_function")
       {
         // Create MeshFunction to read data into
-        MeshFunction<std::size_t> mf(mesh);
+        auto _mesh = reference_to_no_delete_pointer(mesh);
+        MeshFunction<std::size_t> mf(_mesh);
 
         // Read  MeshFunction
         const std::string data_type = data_set.attribute("type").value();
@@ -538,7 +540,8 @@ void XMLMesh::write_data(const Mesh& mesh, const MeshData& data,
       }
 
       // Copy data into MeshFunction
-      MeshFunction<std::size_t> mf(mesh, dim);
+      auto _mesh = reference_to_no_delete_pointer(mesh);
+      MeshFunction<std::size_t> mf(_mesh, dim);
       mf.rename(name, name);
       for (std::size_t i = 0; i < mf.size(); ++i)
         mf[i] = array[i];
@@ -566,7 +569,8 @@ void XMLMesh::write_domains(const Mesh& mesh, const MeshDomains& domains,
     {
       const std::map<std::size_t, std::size_t>& domain = domains.markers(d);
 
-      MeshValueCollection<std::size_t> collection(mesh, d);
+      auto _mesh = reference_to_no_delete_pointer(mesh);
+      MeshValueCollection<std::size_t> collection(_mesh, d);
       std::map<std::size_t, std::size_t>::const_iterator it;
       for (it = domain.begin(); it != domain.end(); ++it)
         collection.set_value(it->first, it->second);
diff --git a/dolfin/io/XMLMeshValueCollection.h b/dolfin/io/XMLMeshValueCollection.h
index 94f8646..93612f0 100644
--- a/dolfin/io/XMLMeshValueCollection.h
+++ b/dolfin/io/XMLMeshValueCollection.h
@@ -57,7 +57,7 @@ namespace dolfin
   {
     // Get node
     const pugi::xml_node mvc_node
-      = get_node(xml_node, "mesh_value_collection");
+      = xmlutils::get_node(xml_node, "mesh_value_collection");
     dolfin_assert(mvc_node);
 
     // Get attributes
diff --git a/dolfin/io/XYZFile.cpp b/dolfin/io/XYZFile.cpp
index b6d2e96..e488393 100644
--- a/dolfin/io/XYZFile.cpp
+++ b/dolfin/io/XYZFile.cpp
@@ -128,8 +128,8 @@ void XYZFile::xyz_name_update()
   fileid.fill('0');
   fileid.width(6);
 
-  filestart.assign(_filename, 0, _filename.find("."));
-  extension.assign(_filename, _filename.find("."), _filename.size());
+  filestart.assign(_filename, 0, _filename.find_last_of("."));
+  extension.assign(_filename, _filename.find_last_of("."), _filename.size());
 
   fileid << counter;
   newfilename << filestart << fileid.str() << ".xyz";
diff --git a/dolfin/io/dolfin_io.h b/dolfin/io/dolfin_io.h
index 82d1de1..34afc63 100644
--- a/dolfin/io/dolfin_io.h
+++ b/dolfin/io/dolfin_io.h
@@ -8,5 +8,6 @@
 #include <dolfin/io/XDMFFile.h>
 #include <dolfin/io/HDF5File.h>
 #include <dolfin/io/HDF5Attribute.h>
+#include <dolfin/io/X3DOM.h>
 
 #endif
diff --git a/dolfin/io/pugiconfig.hpp b/dolfin/io/pugiconfig.hpp
index 5ee5131..e50b580 100644
--- a/dolfin/io/pugiconfig.hpp
+++ b/dolfin/io/pugiconfig.hpp
@@ -1,5 +1,5 @@
 /**
- * pugixml parser - version 1.6
+ * pugixml parser - version 1.7
  * --------------------------------------------------------
  * Copyright (C) 2006-2015, by Arseny Kapoulkine (arseny.kapoulkine at gmail.com)
  * Report bugs and download new versions at http://pugixml.org/
@@ -17,6 +17,9 @@
 // Uncomment this to enable wchar_t mode
 // #define PUGIXML_WCHAR_MODE
 
+// Uncomment this to enable compact mode
+// #define PUGIXML_COMPACT
+
 // Uncomment this to disable XPath
 // #define PUGIXML_NO_XPATH
 
diff --git a/dolfin/io/pugixml.cpp b/dolfin/io/pugixml.cpp
index 5b77a27..737733e 100644
--- a/dolfin/io/pugixml.cpp
+++ b/dolfin/io/pugixml.cpp
@@ -1,5 +1,5 @@
 /**
- * pugixml parser - version 1.6
+ * pugixml parser - version 1.7
  * --------------------------------------------------------
  * Copyright (C) 2006-2015, by Arseny Kapoulkine (arseny.kapoulkine at gmail.com)
  * Report bugs and download new versions at http://pugixml.org/
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
+#include <limits.h>
 
 #ifdef PUGIXML_WCHAR_MODE
 #	include <wchar.h>
@@ -105,6 +106,7 @@
 #if defined(__BORLANDC__) && !defined(__MEM_H_USING_LIST)
 using std::memcpy;
 using std::memmove;
+using std::memset;
 #endif
 
 // In some environments MSVC is a compiler but the CRT lacks certain MSVC-specific features
@@ -133,16 +135,16 @@ using std::memmove;
 #if !defined(_MSC_VER) || _MSC_VER >= 1600
 #	include <stdint.h>
 #else
+namespace pugi
+{
 #	ifndef _UINTPTR_T_DEFINED
-// No native uintptr_t in MSVC6 and in some WinCE versions
-typedef size_t uintptr_t;
-#define _UINTPTR_T_DEFINED
+	typedef size_t uintptr_t;
 #	endif
-PUGI__NS_BEGIN
+
 	typedef unsigned __int8 uint8_t;
 	typedef unsigned __int16 uint16_t;
 	typedef unsigned __int32 uint32_t;
-PUGI__NS_END
+}
 #endif
 
 // Memory allocation
@@ -221,42 +223,174 @@ PUGI__NS_BEGIN
 		return static_cast<size_t>(end - s);
 	#endif
 	}
-
-#ifdef PUGIXML_WCHAR_MODE
-	// Convert string to wide string, assuming all symbols are ASCII
-	PUGI__FN void widen_ascii(wchar_t* dest, const char* source)
-	{
-		for (const char* i = source; *i; ++i) *dest++ = *i;
-		*dest = 0;
-	}
-#endif
 PUGI__NS_END
 
-#if !defined(PUGIXML_NO_STL) || !defined(PUGIXML_NO_XPATH)
-// auto_ptr-like buffer holder for exception recovery
+// auto_ptr-like object for exception recovery
 PUGI__NS_BEGIN
-	struct buffer_holder
+	template <typename T, typename D = void(*)(T*)> struct auto_deleter
 	{
-		void* data;
-		void (*deleter)(void*);
+		T* data;
+		D deleter;
 
-		buffer_holder(void* data_, void (*deleter_)(void*)): data(data_), deleter(deleter_)
+		auto_deleter(T* data_, D deleter_): data(data_), deleter(deleter_)
 		{
 		}
 
-		~buffer_holder()
+		~auto_deleter()
 		{
 			if (data) deleter(data);
 		}
 
-		void* release()
+		T* release()
 		{
-			void* result = data;
+			T* result = data;
 			data = 0;
 			return result;
 		}
 	};
 PUGI__NS_END
+
+#ifdef PUGIXML_COMPACT
+PUGI__NS_BEGIN
+	class compact_hash_table
+	{
+	public:
+		compact_hash_table(): _items(0), _capacity(0), _count(0)
+		{
+		}
+
+		void clear()
+		{
+			if (_items)
+			{
+				xml_memory::deallocate(_items);
+				_items = 0;
+				_capacity = 0;
+				_count = 0;
+			}
+		}
+
+		void** find(const void* key)
+		{
+			assert(key);
+
+			if (_capacity == 0) return 0;
+
+			size_t hashmod = _capacity - 1;
+			size_t bucket = hash(key) & hashmod;
+
+			for (size_t probe = 0; probe <= hashmod; ++probe)
+			{
+				item_t& probe_item = _items[bucket];
+
+				if (probe_item.key == key)
+					return &probe_item.value;
+
+				if (probe_item.key == 0)
+					return 0;
+
+				// hash collision, quadratic probing
+				bucket = (bucket + probe + 1) & hashmod;
+			}
+
+			assert(!"Hash table is full");
+			return 0;
+		}
+
+		void** insert(const void* key)
+		{
+			assert(key);
+			assert(_capacity != 0 && _count < _capacity - _capacity / 4);
+
+			size_t hashmod = _capacity - 1;
+			size_t bucket = hash(key) & hashmod;
+
+			for (size_t probe = 0; probe <= hashmod; ++probe)
+			{
+				item_t& probe_item = _items[bucket];
+
+				if (probe_item.key == 0)
+				{
+					probe_item.key = key;
+					_count++;
+					return &probe_item.value;
+				}
+
+				if (probe_item.key == key)
+					return &probe_item.value;
+
+				// hash collision, quadratic probing
+				bucket = (bucket + probe + 1) & hashmod;
+			}
+
+			assert(!"Hash table is full");
+			return 0;
+		}
+
+		bool reserve()
+		{
+			if (_count + 16 >= _capacity - _capacity / 4)
+				return rehash();
+
+			return true;
+		}
+
+	private:
+		struct item_t
+		{
+			const void* key;
+			void* value;
+		};
+
+		item_t* _items;
+		size_t _capacity;
+
+		size_t _count;
+
+		bool rehash();
+
+		static unsigned int hash(const void* key)
+		{
+			unsigned int h = static_cast<unsigned int>(reinterpret_cast<uintptr_t>(key));
+
+			// MurmurHash3 32-bit finalizer
+			h ^= h >> 16;
+			h *= 0x85ebca6bu;
+			h ^= h >> 13;
+			h *= 0xc2b2ae35u;
+			h ^= h >> 16;
+
+			return h;
+		}
+	};
+
+	PUGI__FN_NO_INLINE bool compact_hash_table::rehash()
+	{
+		compact_hash_table rt;
+		rt._capacity = (_capacity == 0) ? 32 : _capacity * 2;
+		rt._items = static_cast<item_t*>(xml_memory::allocate(sizeof(item_t) * rt._capacity));
+
+		if (!rt._items)
+			return false;
+
+		memset(rt._items, 0, sizeof(item_t) * rt._capacity);
+
+		for (size_t i = 0; i < _capacity; ++i)
+			if (_items[i].key)
+				*rt.insert(_items[i].key) = _items[i].value;
+
+		if (_items)
+			xml_memory::deallocate(_items);
+
+		_capacity = rt._capacity;
+		_items = rt._items;
+
+		assert(_count == rt._count);
+
+		return true;
+	}
+
+PUGI__NS_END
 #endif
 
 PUGI__NS_BEGIN
@@ -268,15 +402,34 @@ PUGI__NS_BEGIN
 	#endif
 		;
 
+#ifdef PUGIXML_COMPACT
+	static const uintptr_t xml_memory_block_alignment = 4;
+
+	static const uintptr_t xml_memory_page_alignment = sizeof(void*);
+#else
+	static const uintptr_t xml_memory_block_alignment = sizeof(void*);
+
 	static const uintptr_t xml_memory_page_alignment = 64;
 	static const uintptr_t xml_memory_page_pointer_mask = ~(xml_memory_page_alignment - 1);
+#endif
+
+	// extra metadata bits
 	static const uintptr_t xml_memory_page_contents_shared_mask = 32;
 	static const uintptr_t xml_memory_page_name_allocated_mask = 16;
 	static const uintptr_t xml_memory_page_value_allocated_mask = 8;
 	static const uintptr_t xml_memory_page_type_mask = 7;
+
+	// combined masks for string uniqueness
 	static const uintptr_t xml_memory_page_name_allocated_or_shared_mask = xml_memory_page_name_allocated_mask | xml_memory_page_contents_shared_mask;
 	static const uintptr_t xml_memory_page_value_allocated_or_shared_mask = xml_memory_page_value_allocated_mask | xml_memory_page_contents_shared_mask;
 
+#ifdef PUGIXML_COMPACT
+	#define PUGI__GETPAGE_IMPL(header) (header).get_page()
+#else
+	#define PUGI__GETPAGE_IMPL(header) reinterpret_cast<impl::xml_memory_page*>((header) & impl::xml_memory_page_pointer_mask)
+#endif
+
+	#define PUGI__GETPAGE(n) PUGI__GETPAGE_IMPL((n)->header)
 	#define PUGI__NODETYPE(n) static_cast<xml_node_type>(((n)->header & impl::xml_memory_page_type_mask) + 1)
 
 	struct xml_allocator;
@@ -293,6 +446,12 @@ PUGI__NS_BEGIN
 			result->busy_size = 0;
 			result->freed_size = 0;
 
+		#ifdef PUGIXML_COMPACT
+			result->compact_string_base = 0;
+			result->compact_shared_parent = 0;
+			result->compact_page_marker = 0;
+		#endif
+
 			return result;
 		}
 
@@ -303,6 +462,12 @@ PUGI__NS_BEGIN
 
 		size_t busy_size;
 		size_t freed_size;
+
+	#ifdef PUGIXML_COMPACT
+		char_t* compact_string_base;
+		void* compact_shared_parent;
+		uint32_t* compact_page_marker;
+	#endif
 	};
 
 	struct xml_memory_string_header
@@ -315,6 +480,9 @@ PUGI__NS_BEGIN
 	{
 		xml_allocator(xml_memory_page* root): _root(root), _busy_size(root->busy_size)
 		{
+		#ifdef PUGIXML_COMPACT
+			_hash = 0;
+		#endif
 		}
 
 		xml_memory_page* allocate_page(size_t data_size)
@@ -352,7 +520,8 @@ PUGI__NS_BEGIN
 
 		void* allocate_memory(size_t size, xml_memory_page*& out_page)
 		{
-			if (_busy_size + size > xml_memory_page_size) return allocate_memory_oob(size, out_page);
+			if (PUGI__UNLIKELY(_busy_size + size > xml_memory_page_size))
+				return allocate_memory_oob(size, out_page);
 
 			void* buf = reinterpret_cast<char*>(_root) + sizeof(xml_memory_page) + _busy_size;
 
@@ -363,6 +532,44 @@ PUGI__NS_BEGIN
 			return buf;
 		}
 
+	#ifdef PUGIXML_COMPACT
+		void* allocate_object(size_t size, xml_memory_page*& out_page)
+		{
+			void* result = allocate_memory(size + sizeof(uint32_t), out_page);
+			if (!result) return 0;
+
+			// adjust for marker
+			ptrdiff_t offset = static_cast<char*>(result) - reinterpret_cast<char*>(out_page->compact_page_marker);
+
+			if (PUGI__UNLIKELY(static_cast<uintptr_t>(offset) >= 256 * xml_memory_block_alignment))
+			{
+				// insert new marker
+				uint32_t* marker = static_cast<uint32_t*>(result);
+
+				*marker = static_cast<uint32_t>(reinterpret_cast<char*>(marker) - reinterpret_cast<char*>(out_page));
+				out_page->compact_page_marker = marker;
+
+				// since we don't reuse the page space until we reallocate it, we can just pretend that we freed the marker block
+				// this will make sure deallocate_memory correctly tracks the size
+				out_page->freed_size += sizeof(uint32_t);
+
+				return marker + 1;
+			}
+			else
+			{
+				// roll back uint32_t part
+				_busy_size -= sizeof(uint32_t);
+
+				return result;
+			}
+		}
+	#else
+		void* allocate_object(size_t size, xml_memory_page*& out_page)
+		{
+			return allocate_memory(size, out_page);
+		}
+	#endif
+
 		void deallocate_memory(void* ptr, size_t size, xml_memory_page* page)
 		{
 			if (page == _root) page->busy_size = _busy_size;
@@ -380,7 +587,16 @@ PUGI__NS_BEGIN
 					assert(_root == page);
 
 					// top page freed, just reset sizes
-					page->busy_size = page->freed_size = 0;
+					page->busy_size = 0;
+					page->freed_size = 0;
+
+				#ifdef PUGIXML_COMPACT
+					// reset compact state to maximize efficiency
+					page->compact_string_base = 0;
+					page->compact_shared_parent = 0;
+					page->compact_page_marker = 0;
+				#endif
+
 					_busy_size = 0;
 				}
 				else
@@ -400,15 +616,15 @@ PUGI__NS_BEGIN
 
 		char_t* allocate_string(size_t length)
 		{
-			static const size_t max_encoded_offset = (1 << 16) * sizeof(void*);
+			static const size_t max_encoded_offset = (1 << 16) * xml_memory_block_alignment;
 
 			PUGI__STATIC_ASSERT(xml_memory_page_size <= max_encoded_offset);
 
 			// allocate memory for string and header block
 			size_t size = sizeof(xml_memory_string_header) + length * sizeof(char_t);
 			
-			// round size up to pointer alignment boundary
-			size_t full_size = (size + (sizeof(void*) - 1)) & ~(sizeof(void*) - 1);
+			// round size up to block alignment boundary
+			size_t full_size = (size + (xml_memory_block_alignment - 1)) & ~(xml_memory_block_alignment - 1);
 
 			xml_memory_page* page;
 			xml_memory_string_header* header = static_cast<xml_memory_string_header*>(allocate_memory(full_size, page));
@@ -418,14 +634,14 @@ PUGI__NS_BEGIN
 			// setup header
 			ptrdiff_t page_offset = reinterpret_cast<char*>(header) - reinterpret_cast<char*>(page) - sizeof(xml_memory_page);
 
-			assert(page_offset % sizeof(void*) == 0);
+			assert(page_offset % xml_memory_block_alignment == 0);
 			assert(page_offset >= 0 && static_cast<size_t>(page_offset) < max_encoded_offset);
-			header->page_offset = static_cast<uint16_t>(static_cast<size_t>(page_offset) / sizeof(void*));
+			header->page_offset = static_cast<uint16_t>(static_cast<size_t>(page_offset) / xml_memory_block_alignment);
 
 			// full_size == 0 for large strings that occupy the whole page
-			assert(full_size % sizeof(void*) == 0);
+			assert(full_size % xml_memory_block_alignment == 0);
 			assert(full_size < max_encoded_offset || (page->busy_size == full_size && page_offset == 0));
-			header->full_size = static_cast<uint16_t>(full_size < max_encoded_offset ? full_size / sizeof(void*) : 0);
+			header->full_size = static_cast<uint16_t>(full_size < max_encoded_offset ? full_size / xml_memory_block_alignment : 0);
 
 			// round-trip through void* to avoid 'cast increases required alignment of target type' warning
 			// header is guaranteed a pointer-sized alignment, which should be enough for char_t
@@ -442,17 +658,30 @@ PUGI__NS_BEGIN
 			assert(header);
 
 			// deallocate
-			size_t page_offset = sizeof(xml_memory_page) + header->page_offset * sizeof(void*);
+			size_t page_offset = sizeof(xml_memory_page) + header->page_offset * xml_memory_block_alignment;
 			xml_memory_page* page = reinterpret_cast<xml_memory_page*>(static_cast<void*>(reinterpret_cast<char*>(header) - page_offset));
 
 			// if full_size == 0 then this string occupies the whole page
-			size_t full_size = header->full_size == 0 ? page->busy_size : header->full_size * sizeof(void*);
+			size_t full_size = header->full_size == 0 ? page->busy_size : header->full_size * xml_memory_block_alignment;
 
 			deallocate_memory(header, full_size, page);
 		}
 
+		bool reserve()
+		{
+		#ifdef PUGIXML_COMPACT
+			return _hash->reserve();
+		#else
+			return true;
+		#endif
+		}
+
 		xml_memory_page* _root;
 		size_t _busy_size;
+
+	#ifdef PUGIXML_COMPACT
+		compact_hash_table* _hash;
+	#endif
 	};
 
 	PUGI__FN_NO_INLINE void* xml_allocator::allocate_memory_oob(size_t size, xml_memory_page*& out_page)
@@ -486,58 +715,399 @@ PUGI__NS_BEGIN
 
 			_root->prev->next = page;
 			_root->prev = page;
-		}
 
-		// allocate inside page
-		page->busy_size = size;
+			page->busy_size = size;
+		}
 
 		return reinterpret_cast<char*>(page) + sizeof(xml_memory_page);
 	}
 PUGI__NS_END
 
+#ifdef PUGIXML_COMPACT
+PUGI__NS_BEGIN
+	static const uintptr_t compact_alignment_log2 = 2;
+	static const uintptr_t compact_alignment = 1 << compact_alignment_log2;
+
+	class compact_header
+	{
+	public:
+		compact_header(xml_memory_page* page, unsigned int flags)
+		{
+			PUGI__STATIC_ASSERT(xml_memory_block_alignment == compact_alignment);
+
+			ptrdiff_t offset = (reinterpret_cast<char*>(this) - reinterpret_cast<char*>(page->compact_page_marker));
+			assert(offset % compact_alignment == 0 && static_cast<uintptr_t>(offset) < 256 * compact_alignment);
+
+			_page = static_cast<unsigned char>(offset >> compact_alignment_log2);
+			_flags = static_cast<unsigned char>(flags);
+		}
+
+		void operator&=(uintptr_t mod)
+		{
+			_flags &= static_cast<unsigned char>(mod);
+		}
+
+		void operator|=(uintptr_t mod)
+		{
+			_flags |= static_cast<unsigned char>(mod);
+		}
+
+		uintptr_t operator&(uintptr_t mod) const
+		{
+			return _flags & mod;
+		}
+
+		xml_memory_page* get_page() const
+		{
+			// round-trip through void* to silence 'cast increases required alignment of target type' warnings
+			const char* page_marker = reinterpret_cast<const char*>(this) - (_page << compact_alignment_log2);
+			const char* page = page_marker - *reinterpret_cast<const uint32_t*>(static_cast<const void*>(page_marker));
+
+			return const_cast<xml_memory_page*>(reinterpret_cast<const xml_memory_page*>(static_cast<const void*>(page)));
+		}
+
+	private:
+		unsigned char _page;
+		unsigned char _flags;
+	};
+
+	PUGI__FN xml_memory_page* compact_get_page(const void* object, int header_offset)
+	{
+		const compact_header* header = reinterpret_cast<const compact_header*>(static_cast<const char*>(object) - header_offset);
+
+		return header->get_page();
+	}
+
+	template <int header_offset, typename T> PUGI__FN_NO_INLINE T* compact_get_value(const void* object)
+	{
+		return static_cast<T*>(*compact_get_page(object, header_offset)->allocator->_hash->find(object));
+	}
+
+	template <int header_offset, typename T> PUGI__FN_NO_INLINE void compact_set_value(const void* object, T* value)
+	{
+		*compact_get_page(object, header_offset)->allocator->_hash->insert(object) = value;
+	}
+
+	template <typename T, int header_offset, int start = -126> class compact_pointer
+	{
+	public:
+		compact_pointer(): _data(0)
+		{
+		}
+
+		void operator=(const compact_pointer& rhs)
+		{
+			*this = rhs + 0;
+		}
+
+		void operator=(T* value)
+		{
+			if (value)
+			{
+				// value is guaranteed to be compact-aligned; 'this' is not
+				// our decoding is based on 'this' aligned to compact alignment downwards (see operator T*)
+				// so for negative offsets (e.g. -3) we need to adjust the diff by compact_alignment - 1 to
+				// compensate for arithmetic shift rounding for negative values
+				ptrdiff_t diff = reinterpret_cast<char*>(value) - reinterpret_cast<char*>(this);
+				ptrdiff_t offset = ((diff + int(compact_alignment - 1)) >> compact_alignment_log2) - start;
+
+				if (static_cast<uintptr_t>(offset) <= 253)
+					_data = static_cast<unsigned char>(offset + 1);
+				else
+				{
+					compact_set_value<header_offset>(this, value);
+
+					_data = 255;
+				}
+			}
+			else
+				_data = 0;
+		}
+
+		operator T*() const
+		{
+			if (_data)
+			{
+				if (_data < 255)
+				{
+					uintptr_t base = reinterpret_cast<uintptr_t>(this) & ~(compact_alignment - 1);
+
+					return reinterpret_cast<T*>(base + ((_data - 1 + start) << compact_alignment_log2));
+				}
+				else
+					return compact_get_value<header_offset, T>(this);
+			}
+			else
+				return 0;
+		}
+
+		T* operator->() const
+		{
+			return *this;
+		}
+
+	private:
+		unsigned char _data;
+	};
+
+	template <typename T, int header_offset> class compact_pointer_parent
+	{
+	public:
+		compact_pointer_parent(): _data(0)
+		{
+		}
+
+		void operator=(const compact_pointer_parent& rhs)
+		{
+			*this = rhs + 0;
+		}
+
+		void operator=(T* value)
+		{
+			if (value)
+			{
+				// value is guaranteed to be compact-aligned; 'this' is not
+				// our decoding is based on 'this' aligned to compact alignment downwards (see operator T*)
+				// so for negative offsets (e.g. -3) we need to adjust the diff by compact_alignment - 1 to
+				// compensate for arithmetic shift behavior for negative values
+				ptrdiff_t diff = reinterpret_cast<char*>(value) - reinterpret_cast<char*>(this);
+				ptrdiff_t offset = ((diff + int(compact_alignment - 1)) >> compact_alignment_log2) + 65533;
+
+				if (static_cast<uintptr_t>(offset) <= 65533)
+				{
+					_data = static_cast<unsigned short>(offset + 1);
+				}
+				else
+				{
+					xml_memory_page* page = compact_get_page(this, header_offset);
+
+					if (PUGI__UNLIKELY(page->compact_shared_parent == 0))
+						page->compact_shared_parent = value;
+
+					if (page->compact_shared_parent == value)
+					{
+						_data = 65534;
+					}
+					else
+					{
+						compact_set_value<header_offset>(this, value);
+
+						_data = 65535;
+					}
+				}
+			}
+			else
+			{
+				_data = 0;
+			}
+		}
+
+		operator T*() const
+		{
+			if (_data)
+			{
+				if (_data < 65534)
+				{
+					uintptr_t base = reinterpret_cast<uintptr_t>(this) & ~(compact_alignment - 1);
+
+					return reinterpret_cast<T*>(base + ((_data - 1 - 65533) << compact_alignment_log2));
+				}
+				else if (_data == 65534)
+					return static_cast<T*>(compact_get_page(this, header_offset)->compact_shared_parent);
+				else
+					return compact_get_value<header_offset, T>(this);
+			}
+			else
+				return 0;
+		}
+
+		T* operator->() const
+		{
+			return *this;
+		}
+
+	private:
+		uint16_t _data;
+	};
+
+	template <int header_offset, int base_offset> class compact_string
+	{
+	public:
+		compact_string(): _data(0)
+		{
+		}
+
+		void operator=(const compact_string& rhs)
+		{
+			*this = rhs + 0;
+		}
+
+		void operator=(char_t* value)
+		{
+			if (value)
+			{
+				xml_memory_page* page = compact_get_page(this, header_offset);
+
+				if (PUGI__UNLIKELY(page->compact_string_base == 0))
+					page->compact_string_base = value;
+
+				ptrdiff_t offset = value - page->compact_string_base;
+
+				if (static_cast<uintptr_t>(offset) < (65535 << 7))
+				{
+					// round-trip through void* to silence 'cast increases required alignment of target type' warnings
+					uint16_t* base = reinterpret_cast<uint16_t*>(static_cast<void*>(reinterpret_cast<char*>(this) - base_offset));
+
+					if (*base == 0)
+					{
+						*base = static_cast<uint16_t>((offset >> 7) + 1);
+						_data = static_cast<unsigned char>((offset & 127) + 1);
+					}
+					else
+					{
+						ptrdiff_t remainder = offset - ((*base - 1) << 7);
+
+						if (static_cast<uintptr_t>(remainder) <= 253)
+						{
+							_data = static_cast<unsigned char>(remainder + 1);
+						}
+						else
+						{
+							compact_set_value<header_offset>(this, value);
+
+							_data = 255;
+						}
+					}
+				}
+				else
+				{
+					compact_set_value<header_offset>(this, value);
+
+					_data = 255;
+				}
+			}
+			else
+			{
+				_data = 0;
+			}
+		}
+
+		operator char_t*() const
+		{
+			if (_data)
+			{
+				if (_data < 255)
+				{
+					xml_memory_page* page = compact_get_page(this, header_offset);
+
+					// round-trip through void* to silence 'cast increases required alignment of target type' warnings
+					const uint16_t* base = reinterpret_cast<const uint16_t*>(static_cast<const void*>(reinterpret_cast<const char*>(this) - base_offset));
+					assert(*base);
+
+					ptrdiff_t offset = ((*base - 1) << 7) + (_data - 1);
+
+					return page->compact_string_base + offset;
+				}
+				else
+				{
+					return compact_get_value<header_offset, char_t>(this);
+				}
+			}
+			else
+				return 0;
+		}
+
+	private:
+		unsigned char _data;
+	};
+PUGI__NS_END
+#endif
+
+#ifdef PUGIXML_COMPACT
+namespace pugi
+{
+	struct xml_attribute_struct
+	{
+		xml_attribute_struct(impl::xml_memory_page* page): header(page, 0), namevalue_base(0)
+		{
+			PUGI__STATIC_ASSERT(sizeof(xml_attribute_struct) == 8);
+		}
+
+		impl::compact_header header;
+
+		uint16_t namevalue_base;
+
+		impl::compact_string<4, 2> name;
+		impl::compact_string<5, 3> value;
+
+		impl::compact_pointer<xml_attribute_struct, 6> prev_attribute_c;
+		impl::compact_pointer<xml_attribute_struct, 7, 0> next_attribute;
+	};
+
+	struct xml_node_struct
+	{
+		xml_node_struct(impl::xml_memory_page* page, xml_node_type type): header(page, type - 1), namevalue_base(0)
+		{
+			PUGI__STATIC_ASSERT(sizeof(xml_node_struct) == 12);
+		}
+
+		impl::compact_header header;
+
+		uint16_t namevalue_base;
+
+		impl::compact_string<4, 2> name;
+		impl::compact_string<5, 3> value;
+
+		impl::compact_pointer_parent<xml_node_struct, 6> parent;
+
+		impl::compact_pointer<xml_node_struct, 8, 0> first_child;
+
+		impl::compact_pointer<xml_node_struct,  9>    prev_sibling_c;
+		impl::compact_pointer<xml_node_struct, 10, 0> next_sibling;
+
+		impl::compact_pointer<xml_attribute_struct, 11, 0> first_attribute;
+	};
+}
+#else
 namespace pugi
 {
-	/// A 'name=value' XML attribute structure.
 	struct xml_attribute_struct
 	{
-		/// Default ctor
 		xml_attribute_struct(impl::xml_memory_page* page): header(reinterpret_cast<uintptr_t>(page)), name(0), value(0), prev_attribute_c(0), next_attribute(0)
 		{
 		}
 
 		uintptr_t header;
 
-		char_t* name;	///< Pointer to attribute name.
-		char_t*	value;	///< Pointer to attribute value.
+		char_t*	name;
+		char_t*	value;
 
-		xml_attribute_struct* prev_attribute_c;	///< Previous attribute (cyclic list)
-		xml_attribute_struct* next_attribute;	///< Next attribute
+		xml_attribute_struct* prev_attribute_c;
+		xml_attribute_struct* next_attribute;
 	};
 
-	/// An XML document tree node.
 	struct xml_node_struct
 	{
-		/// Default ctor
-		/// \param type - node type
-		xml_node_struct(impl::xml_memory_page* page, xml_node_type type): header(reinterpret_cast<uintptr_t>(page) | (type - 1)), parent(0), name(0), value(0), first_child(0), prev_sibling_c(0), next_sibling(0), first_attribute(0)
+		xml_node_struct(impl::xml_memory_page* page, xml_node_type type): header(reinterpret_cast<uintptr_t>(page) | (type - 1)), name(0), value(0), parent(0), first_child(0), prev_sibling_c(0), next_sibling(0), first_attribute(0)
 		{
 		}
 
 		uintptr_t header;
 
-		xml_node_struct*		parent;					///< Pointer to parent
+		char_t* name;
+		char_t* value;
 
-		char_t*					name;					///< Pointer to element name.
-		char_t*					value;					///< Pointer to any associated string data.
+		xml_node_struct* parent;
 
-		xml_node_struct*		first_child;			///< First child
-		
-		xml_node_struct*		prev_sibling_c;			///< Left brother (cyclic list)
-		xml_node_struct*		next_sibling;			///< Right brother
-		
-		xml_attribute_struct*	first_attribute;		///< First attribute
+		xml_node_struct* first_child;
+
+		xml_node_struct* prev_sibling_c;
+		xml_node_struct* next_sibling;
+
+		xml_attribute_struct* first_attribute;
 	};
 }
+#endif
 
 PUGI__NS_BEGIN
 	struct xml_extra_buffer
@@ -550,25 +1120,32 @@ PUGI__NS_BEGIN
 	{
 		xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(0), extra_buffers(0)
 		{
+		#ifdef PUGIXML_COMPACT
+			_hash = &hash;
+		#endif
 		}
 
 		const char_t* buffer;
 
 		xml_extra_buffer* extra_buffers;
+
+	#ifdef PUGIXML_COMPACT
+		compact_hash_table hash;
+	#endif
 	};
 
-	inline xml_allocator& get_allocator(const xml_node_struct* node)
+	template <typename Object> inline xml_allocator& get_allocator(const Object* object)
 	{
-		assert(node);
+		assert(object);
 
-		return *reinterpret_cast<xml_memory_page*>(node->header & xml_memory_page_pointer_mask)->allocator;
+		return *PUGI__GETPAGE(object)->allocator;
 	}
 
 	template <typename Object> inline xml_document_struct& get_document(const Object* object)
 	{
 		assert(object);
 
-		return *static_cast<xml_document_struct*>(reinterpret_cast<xml_memory_page*>(object->header & xml_memory_page_pointer_mask)->allocator);
+		return *static_cast<xml_document_struct*>(PUGI__GETPAGE(object)->allocator);
 	}
 PUGI__NS_END
 
@@ -577,7 +1154,8 @@ PUGI__NS_BEGIN
 	inline xml_attribute_struct* allocate_attribute(xml_allocator& alloc)
 	{
 		xml_memory_page* page;
-		void* memory = alloc.allocate_memory(sizeof(xml_attribute_struct), page);
+		void* memory = alloc.allocate_object(sizeof(xml_attribute_struct), page);
+		if (!memory) return 0;
 
 		return new (memory) xml_attribute_struct(page);
 	}
@@ -585,27 +1163,30 @@ PUGI__NS_BEGIN
 	inline xml_node_struct* allocate_node(xml_allocator& alloc, xml_node_type type)
 	{
 		xml_memory_page* page;
-		void* memory = alloc.allocate_memory(sizeof(xml_node_struct), page);
+		void* memory = alloc.allocate_object(sizeof(xml_node_struct), page);
+		if (!memory) return 0;
 
 		return new (memory) xml_node_struct(page, type);
 	}
 
 	inline void destroy_attribute(xml_attribute_struct* a, xml_allocator& alloc)
 	{
-		uintptr_t header = a->header;
+		if (a->header & impl::xml_memory_page_name_allocated_mask)
+			alloc.deallocate_string(a->name);
 
-		if (header & impl::xml_memory_page_name_allocated_mask) alloc.deallocate_string(a->name);
-		if (header & impl::xml_memory_page_value_allocated_mask) alloc.deallocate_string(a->value);
+		if (a->header & impl::xml_memory_page_value_allocated_mask)
+			alloc.deallocate_string(a->value);
 
-		alloc.deallocate_memory(a, sizeof(xml_attribute_struct), reinterpret_cast<xml_memory_page*>(header & xml_memory_page_pointer_mask));
+		alloc.deallocate_memory(a, sizeof(xml_attribute_struct), PUGI__GETPAGE(a));
 	}
 
 	inline void destroy_node(xml_node_struct* n, xml_allocator& alloc)
 	{
-		uintptr_t header = n->header;
+		if (n->header & impl::xml_memory_page_name_allocated_mask)
+			alloc.deallocate_string(n->name);
 
-		if (header & impl::xml_memory_page_name_allocated_mask) alloc.deallocate_string(n->name);
-		if (header & impl::xml_memory_page_value_allocated_mask) alloc.deallocate_string(n->value);
+		if (n->header & impl::xml_memory_page_value_allocated_mask)
+			alloc.deallocate_string(n->value);
 
 		for (xml_attribute_struct* attr = n->first_attribute; attr; )
 		{
@@ -625,7 +1206,7 @@ PUGI__NS_BEGIN
 			child = next;
 		}
 
-		alloc.deallocate_memory(n, sizeof(xml_node_struct), reinterpret_cast<xml_memory_page*>(header & xml_memory_page_pointer_mask));
+		alloc.deallocate_memory(n, sizeof(xml_node_struct), PUGI__GETPAGE(n));
 	}
 
 	inline void append_node(xml_node_struct* child, xml_node_struct* node)
@@ -797,6 +1378,8 @@ PUGI__NS_BEGIN
 
 	PUGI__FN_NO_INLINE xml_node_struct* append_new_node(xml_node_struct* node, xml_allocator& alloc, xml_node_type type = node_element)
 	{
+		if (!alloc.reserve()) return 0;
+
 		xml_node_struct* child = allocate_node(alloc, type);
 		if (!child) return 0;
 
@@ -807,6 +1390,8 @@ PUGI__NS_BEGIN
 
 	PUGI__FN_NO_INLINE xml_attribute_struct* append_new_attribute(xml_node_struct* node, xml_allocator& alloc)
 	{
+		if (!alloc.reserve()) return 0;
+
 		xml_attribute_struct* attr = allocate_attribute(alloc);
 		if (!attr) return 0;
 
@@ -1012,28 +1597,11 @@ PUGI__NS_BEGIN
 		}
 	};
 
-	template <size_t size> struct wchar_selector;
-
-	template <> struct wchar_selector<2>
-	{
-		typedef uint16_t type;
-		typedef utf16_counter counter;
-		typedef utf16_writer writer;
-	};
-
-	template <> struct wchar_selector<4>
+	struct utf8_decoder
 	{
-		typedef uint32_t type;
-		typedef utf32_counter counter;
-		typedef utf32_writer writer;
-	};
+		typedef uint8_t type;
 
-	typedef wchar_selector<sizeof(wchar_t)>::counter wchar_counter;
-	typedef wchar_selector<sizeof(wchar_t)>::writer wchar_writer;
-
-	template <typename Traits, typename opt_swap = opt_false> struct utf_decoder
-	{
-		static inline typename Traits::value_type decode_utf8_block(const uint8_t* data, size_t size, typename Traits::value_type result)
+		template <typename Traits> static inline typename Traits::value_type process(const uint8_t* data, size_t size, typename Traits::value_type result, Traits)
 		{
 			const uint8_t utf8_byte_mask = 0x3f;
 
@@ -1094,29 +1662,34 @@ PUGI__NS_BEGIN
 
 			return result;
 		}
+	};
 
-		static inline typename Traits::value_type decode_utf16_block(const uint16_t* data, size_t size, typename Traits::value_type result)
-		{
-			const uint16_t* end = data + size;
+	template <typename opt_swap> struct utf16_decoder
+	{
+		typedef uint16_t type;
 
-			while (data < end)
+		template <typename Traits> static inline typename Traits::value_type process(const uint16_t* data, size_t size, typename Traits::value_type result, Traits)
+		{
+			while (size)
 			{
-				unsigned int lead = opt_swap::value ? endian_swap(*data) : *data;
+				uint16_t lead = opt_swap::value ? endian_swap(*data) : *data;
 
 				// U+0000..U+D7FF
 				if (lead < 0xD800)
 				{
 					result = Traits::low(result, lead);
 					data += 1;
+					size -= 1;
 				}
 				// U+E000..U+FFFF
 				else if (static_cast<unsigned int>(lead - 0xE000) < 0x2000)
 				{
 					result = Traits::low(result, lead);
 					data += 1;
+					size -= 1;
 				}
 				// surrogate pair lead
-				else if (static_cast<unsigned int>(lead - 0xD800) < 0x400 && data + 1 < end)
+				else if (static_cast<unsigned int>(lead - 0xD800) < 0x400 && size >= 2)
 				{
 					uint16_t next = opt_swap::value ? endian_swap(data[1]) : data[1];
 
@@ -1124,26 +1697,32 @@ PUGI__NS_BEGIN
 					{
 						result = Traits::high(result, 0x10000 + ((lead & 0x3ff) << 10) + (next & 0x3ff));
 						data += 2;
+						size -= 2;
 					}
 					else
 					{
 						data += 1;
+						size -= 1;
 					}
 				}
 				else
 				{
 					data += 1;
+					size -= 1;
 				}
 			}
 
 			return result;
 		}
+	};
 
-		static inline typename Traits::value_type decode_utf32_block(const uint32_t* data, size_t size, typename Traits::value_type result)
-		{
-			const uint32_t* end = data + size;
+	template <typename opt_swap> struct utf32_decoder
+	{
+		typedef uint32_t type;
 
-			while (data < end)
+		template <typename Traits> static inline typename Traits::value_type process(const uint32_t* data, size_t size, typename Traits::value_type result, Traits)
+		{
+			while (size)
 			{
 				uint32_t lead = opt_swap::value ? endian_swap(*data) : *data;
 
@@ -1152,53 +1731,76 @@ PUGI__NS_BEGIN
 				{
 					result = Traits::low(result, lead);
 					data += 1;
+					size -= 1;
 				}
 				// U+10000..U+10FFFF
 				else
 				{
 					result = Traits::high(result, lead);
 					data += 1;
+					size -= 1;
 				}
 			}
 
 			return result;
 		}
+	};
 
-		static inline typename Traits::value_type decode_latin1_block(const uint8_t* data, size_t size, typename Traits::value_type result)
+	struct latin1_decoder
+	{
+		typedef uint8_t type;
+
+		template <typename Traits> static inline typename Traits::value_type process(const uint8_t* data, size_t size, typename Traits::value_type result, Traits)
 		{
-			for (size_t i = 0; i < size; ++i)
+			while (size)
 			{
-				result = Traits::low(result, data[i]);
+				result = Traits::low(result, *data);
+				data += 1;
+				size -= 1;
 			}
 
 			return result;
 		}
+	};
 
-		static inline typename Traits::value_type decode_wchar_block_impl(const uint16_t* data, size_t size, typename Traits::value_type result)
-		{
-			return decode_utf16_block(data, size, result);
-		}
+	template <size_t size> struct wchar_selector;
 
-		static inline typename Traits::value_type decode_wchar_block_impl(const uint32_t* data, size_t size, typename Traits::value_type result)
-		{
-			return decode_utf32_block(data, size, result);
-		}
+	template <> struct wchar_selector<2>
+	{
+		typedef uint16_t type;
+		typedef utf16_counter counter;
+		typedef utf16_writer writer;
+		typedef utf16_decoder<opt_false> decoder;
+	};
 
-		static inline typename Traits::value_type decode_wchar_block(const wchar_t* data, size_t size, typename Traits::value_type result)
-		{
-			return decode_wchar_block_impl(reinterpret_cast<const wchar_selector<sizeof(wchar_t)>::type*>(data), size, result);
-		}
+	template <> struct wchar_selector<4>
+	{
+		typedef uint32_t type;
+		typedef utf32_counter counter;
+		typedef utf32_writer writer;
+		typedef utf32_decoder<opt_false> decoder;
 	};
 
-	template <typename T> PUGI__FN void convert_utf_endian_swap(T* result, const T* data, size_t length)
+	typedef wchar_selector<sizeof(wchar_t)>::counter wchar_counter;
+	typedef wchar_selector<sizeof(wchar_t)>::writer wchar_writer;
+
+	struct wchar_decoder
 	{
-		for (size_t i = 0; i < length; ++i) result[i] = endian_swap(data[i]);
-	}
+		typedef wchar_t type;
+
+		template <typename Traits> static inline typename Traits::value_type process(const wchar_t* data, size_t size, typename Traits::value_type result, Traits traits)
+		{
+			typedef wchar_selector<sizeof(wchar_t)>::decoder decoder;
+
+			return decoder::process(reinterpret_cast<const typename decoder::type*>(data), size, result, traits);
+		}
+	};
 
 #ifdef PUGIXML_WCHAR_MODE
 	PUGI__FN void convert_wchar_endian_swap(wchar_t* result, const wchar_t* data, size_t length)
 	{
-		for (size_t i = 0; i < length; ++i) result[i] = static_cast<wchar_t>(endian_swap(static_cast<wchar_selector<sizeof(wchar_t)>::type>(data[i])));
+		for (size_t i = 0; i < length; ++i)
+			result[i] = static_cast<wchar_t>(endian_swap(static_cast<wchar_selector<sizeof(wchar_t)>::type>(data[i])));
 	}
 #endif
 PUGI__NS_END
@@ -1392,111 +1994,36 @@ PUGI__NS_BEGIN
 			out_buffer = buffer;
 			out_length = length;
 		}
-		else
-		{
-			char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
-			if (!buffer) return false;
-
-			convert_wchar_endian_swap(buffer, data, length);
-			buffer[length] = 0;
-
-			out_buffer = buffer;
-			out_length = length + 1;
-		}
-
-		return true;
-	}
-
-	PUGI__FN bool convert_buffer_utf8(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size)
-	{
-		const uint8_t* data = static_cast<const uint8_t*>(contents);
-		size_t data_length = size;
-
-		// first pass: get length in wchar_t units
-		size_t length = utf_decoder<wchar_counter>::decode_utf8_block(data, data_length, 0);
-
-		// allocate buffer of suitable length
-		char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
-		if (!buffer) return false;
-
-		// second pass: convert utf8 input to wchar_t
-		wchar_writer::value_type obegin = reinterpret_cast<wchar_writer::value_type>(buffer);
-		wchar_writer::value_type oend = utf_decoder<wchar_writer>::decode_utf8_block(data, data_length, obegin);
-
-		assert(oend == obegin + length);
-		*oend = 0;
-
-		out_buffer = buffer;
-		out_length = length + 1;
-
-		return true;
-	}
-
-	template <typename opt_swap> PUGI__FN bool convert_buffer_utf16(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, opt_swap)
-	{
-		const uint16_t* data = static_cast<const uint16_t*>(contents);
-		size_t data_length = size / sizeof(uint16_t);
-
-		// first pass: get length in wchar_t units
-		size_t length = utf_decoder<wchar_counter, opt_swap>::decode_utf16_block(data, data_length, 0);
-
-		// allocate buffer of suitable length
-		char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
-		if (!buffer) return false;
-
-		// second pass: convert utf16 input to wchar_t
-		wchar_writer::value_type obegin = reinterpret_cast<wchar_writer::value_type>(buffer);
-		wchar_writer::value_type oend = utf_decoder<wchar_writer, opt_swap>::decode_utf16_block(data, data_length, obegin);
-
-		assert(oend == obegin + length);
-		*oend = 0;
-
-		out_buffer = buffer;
-		out_length = length + 1;
-
-		return true;
-	}
-
-	template <typename opt_swap> PUGI__FN bool convert_buffer_utf32(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, opt_swap)
-	{
-		const uint32_t* data = static_cast<const uint32_t*>(contents);
-		size_t data_length = size / sizeof(uint32_t);
-
-		// first pass: get length in wchar_t units
-		size_t length = utf_decoder<wchar_counter, opt_swap>::decode_utf32_block(data, data_length, 0);
-
-		// allocate buffer of suitable length
-		char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
-		if (!buffer) return false;
-
-		// second pass: convert utf32 input to wchar_t
-		wchar_writer::value_type obegin = reinterpret_cast<wchar_writer::value_type>(buffer);
-		wchar_writer::value_type oend = utf_decoder<wchar_writer, opt_swap>::decode_utf32_block(data, data_length, obegin);
+		else
+		{
+			char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
+			if (!buffer) return false;
 
-		assert(oend == obegin + length);
-		*oend = 0;
+			convert_wchar_endian_swap(buffer, data, length);
+			buffer[length] = 0;
 
-		out_buffer = buffer;
-		out_length = length + 1;
+			out_buffer = buffer;
+			out_length = length + 1;
+		}
 
 		return true;
 	}
 
-	PUGI__FN bool convert_buffer_latin1(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size)
+	template <typename D> PUGI__FN bool convert_buffer_generic(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, D)
 	{
-		const uint8_t* data = static_cast<const uint8_t*>(contents);
-		size_t data_length = size;
+		const typename D::type* data = static_cast<const typename D::type*>(contents);
+		size_t data_length = size / sizeof(typename D::type);
 
-		// get length in wchar_t units
-		size_t length = data_length;
+		// first pass: get length in wchar_t units
+		size_t length = D::process(data, data_length, 0, wchar_counter());
 
 		// allocate buffer of suitable length
 		char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
 		if (!buffer) return false;
 
-		// convert latin1 input to wchar_t
+		// second pass: convert utf16 input to wchar_t
 		wchar_writer::value_type obegin = reinterpret_cast<wchar_writer::value_type>(buffer);
-		wchar_writer::value_type oend = utf_decoder<wchar_writer>::decode_latin1_block(data, data_length, obegin);
+		wchar_writer::value_type oend = D::process(data, data_length, obegin, wchar_writer());
 
 		assert(oend == obegin + length);
 		*oend = 0;
@@ -1513,13 +2040,16 @@ PUGI__NS_BEGIN
 		xml_encoding wchar_encoding = get_wchar_encoding();
 
 		// fast path: no conversion required
-		if (encoding == wchar_encoding) return get_mutable_buffer(out_buffer, out_length, contents, size, is_mutable);
+		if (encoding == wchar_encoding)
+			return get_mutable_buffer(out_buffer, out_length, contents, size, is_mutable);
 
 		// only endian-swapping is required
-		if (need_endian_swap_utf(encoding, wchar_encoding)) return convert_buffer_endian_swap(out_buffer, out_length, contents, size, is_mutable);
+		if (need_endian_swap_utf(encoding, wchar_encoding))
+			return convert_buffer_endian_swap(out_buffer, out_length, contents, size, is_mutable);
 
 		// source encoding is utf8
-		if (encoding == encoding_utf8) return convert_buffer_utf8(out_buffer, out_length, contents, size);
+		if (encoding == encoding_utf8)
+			return convert_buffer_generic(out_buffer, out_length, contents, size, utf8_decoder());
 
 		// source encoding is utf16
 		if (encoding == encoding_utf16_be || encoding == encoding_utf16_le)
@@ -1527,8 +2057,8 @@ PUGI__NS_BEGIN
 			xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be;
 
 			return (native_encoding == encoding) ?
-				convert_buffer_utf16(out_buffer, out_length, contents, size, opt_false()) :
-				convert_buffer_utf16(out_buffer, out_length, contents, size, opt_true());
+				convert_buffer_generic(out_buffer, out_length, contents, size, utf16_decoder<opt_false>()) :
+				convert_buffer_generic(out_buffer, out_length, contents, size, utf16_decoder<opt_true>());
 		}
 
 		// source encoding is utf32
@@ -1537,24 +2067,25 @@ PUGI__NS_BEGIN
 			xml_encoding native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be;
 
 			return (native_encoding == encoding) ?
-				convert_buffer_utf32(out_buffer, out_length, contents, size, opt_false()) :
-				convert_buffer_utf32(out_buffer, out_length, contents, size, opt_true());
+				convert_buffer_generic(out_buffer, out_length, contents, size, utf32_decoder<opt_false>()) :
+				convert_buffer_generic(out_buffer, out_length, contents, size, utf32_decoder<opt_true>());
 		}
 
 		// source encoding is latin1
-		if (encoding == encoding_latin1) return convert_buffer_latin1(out_buffer, out_length, contents, size);
+		if (encoding == encoding_latin1)
+			return convert_buffer_generic(out_buffer, out_length, contents, size, latin1_decoder());
 
 		assert(!"Invalid encoding");
 		return false;
 	}
 #else
-	template <typename opt_swap> PUGI__FN bool convert_buffer_utf16(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, opt_swap)
+	template <typename D> PUGI__FN bool convert_buffer_generic(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, D)
 	{
-		const uint16_t* data = static_cast<const uint16_t*>(contents);
-		size_t data_length = size / sizeof(uint16_t);
+		const typename D::type* data = static_cast<const typename D::type*>(contents);
+		size_t data_length = size / sizeof(typename D::type);
 
 		// first pass: get length in utf8 units
-		size_t length = utf_decoder<utf8_counter, opt_swap>::decode_utf16_block(data, data_length, 0);
+		size_t length = D::process(data, data_length, 0, utf8_counter());
 
 		// allocate buffer of suitable length
 		char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
@@ -1562,32 +2093,7 @@ PUGI__NS_BEGIN
 
 		// second pass: convert utf16 input to utf8
 		uint8_t* obegin = reinterpret_cast<uint8_t*>(buffer);
-		uint8_t* oend = utf_decoder<utf8_writer, opt_swap>::decode_utf16_block(data, data_length, obegin);
-
-		assert(oend == obegin + length);
-		*oend = 0;
-
-		out_buffer = buffer;
-		out_length = length + 1;
-
-		return true;
-	}
-
-	template <typename opt_swap> PUGI__FN bool convert_buffer_utf32(char_t*& out_buffer, size_t& out_length, const void* contents, size_t size, opt_swap)
-	{
-		const uint32_t* data = static_cast<const uint32_t*>(contents);
-		size_t data_length = size / sizeof(uint32_t);
-
-		// first pass: get length in utf8 units
-		size_t length = utf_decoder<utf8_counter, opt_swap>::decode_utf32_block(data, data_length, 0);
-
-		// allocate buffer of suitable length
-		char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
-		if (!buffer) return false;
-
-		// second pass: convert utf32 input to utf8
-		uint8_t* obegin = reinterpret_cast<uint8_t*>(buffer);
-		uint8_t* oend = utf_decoder<utf8_writer, opt_swap>::decode_utf32_block(data, data_length, obegin);
+		uint8_t* oend = D::process(data, data_length, obegin, utf8_writer());
 
 		assert(oend == obegin + length);
 		*oend = 0;
@@ -1623,7 +2129,7 @@ PUGI__NS_BEGIN
 		if (postfix_length == 0) return get_mutable_buffer(out_buffer, out_length, contents, size, is_mutable);
 
 		// first pass: get length in utf8 units
-		size_t length = prefix_length + utf_decoder<utf8_counter>::decode_latin1_block(postfix, postfix_length, 0);
+		size_t length = prefix_length + latin1_decoder::process(postfix, postfix_length, 0, utf8_counter());
 
 		// allocate buffer of suitable length
 		char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
@@ -1633,7 +2139,7 @@ PUGI__NS_BEGIN
 		memcpy(buffer, data, prefix_length);
 
 		uint8_t* obegin = reinterpret_cast<uint8_t*>(buffer);
-		uint8_t* oend = utf_decoder<utf8_writer>::decode_latin1_block(postfix, postfix_length, obegin + prefix_length);
+		uint8_t* oend = latin1_decoder::process(postfix, postfix_length, obegin + prefix_length, utf8_writer());
 
 		assert(oend == obegin + length);
 		*oend = 0;
@@ -1647,7 +2153,8 @@ PUGI__NS_BEGIN
 	PUGI__FN bool convert_buffer(char_t*& out_buffer, size_t& out_length, xml_encoding encoding, const void* contents, size_t size, bool is_mutable)
 	{
 		// fast path: no conversion required
-		if (encoding == encoding_utf8) return get_mutable_buffer(out_buffer, out_length, contents, size, is_mutable);
+		if (encoding == encoding_utf8)
+			return get_mutable_buffer(out_buffer, out_length, contents, size, is_mutable);
 
 		// source encoding is utf16
 		if (encoding == encoding_utf16_be || encoding == encoding_utf16_le)
@@ -1655,8 +2162,8 @@ PUGI__NS_BEGIN
 			xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be;
 
 			return (native_encoding == encoding) ?
-				convert_buffer_utf16(out_buffer, out_length, contents, size, opt_false()) :
-				convert_buffer_utf16(out_buffer, out_length, contents, size, opt_true());
+				convert_buffer_generic(out_buffer, out_length, contents, size, utf16_decoder<opt_false>()) :
+				convert_buffer_generic(out_buffer, out_length, contents, size, utf16_decoder<opt_true>());
 		}
 
 		// source encoding is utf32
@@ -1665,12 +2172,13 @@ PUGI__NS_BEGIN
 			xml_encoding native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be;
 
 			return (native_encoding == encoding) ?
-				convert_buffer_utf32(out_buffer, out_length, contents, size, opt_false()) :
-				convert_buffer_utf32(out_buffer, out_length, contents, size, opt_true());
+				convert_buffer_generic(out_buffer, out_length, contents, size, utf32_decoder<opt_false>()) :
+				convert_buffer_generic(out_buffer, out_length, contents, size, utf32_decoder<opt_true>());
 		}
 
 		// source encoding is latin1
-		if (encoding == encoding_latin1) return convert_buffer_latin1(out_buffer, out_length, contents, size, is_mutable);
+		if (encoding == encoding_latin1)
+			return convert_buffer_latin1(out_buffer, out_length, contents, size, is_mutable);
 
 		assert(!"Invalid encoding");
 		return false;
@@ -1680,20 +2188,18 @@ PUGI__NS_BEGIN
 	PUGI__FN size_t as_utf8_begin(const wchar_t* str, size_t length)
 	{
 		// get length in utf8 characters
-		return utf_decoder<utf8_counter>::decode_wchar_block(str, length, 0);
+		return wchar_decoder::process(str, length, 0, utf8_counter());
 	}
 
 	PUGI__FN void as_utf8_end(char* buffer, size_t size, const wchar_t* str, size_t length)
 	{
 		// convert to utf8
 		uint8_t* begin = reinterpret_cast<uint8_t*>(buffer);
-		uint8_t* end = utf_decoder<utf8_writer>::decode_wchar_block(str, length, begin);
+		uint8_t* end = wchar_decoder::process(str, length, begin, utf8_writer());
 	
 		assert(begin + size == end);
 		(void)!end;
-
-		// zero-terminate
-		buffer[size] = 0;
+		(void)!size;
 	}
 	
 #ifndef PUGIXML_NO_STL
@@ -1717,7 +2223,7 @@ PUGI__NS_BEGIN
 		const uint8_t* data = reinterpret_cast<const uint8_t*>(str);
 
 		// first pass: get length in wchar_t units
-		size_t length = utf_decoder<wchar_counter>::decode_utf8_block(data, size, 0);
+		size_t length = utf8_decoder::process(data, size, 0, wchar_counter());
 
 		// allocate resulting string
 		std::basic_string<wchar_t> result;
@@ -1727,7 +2233,7 @@ PUGI__NS_BEGIN
 		if (length > 0)
 		{
 			wchar_writer::value_type begin = reinterpret_cast<wchar_writer::value_type>(&result[0]);
-			wchar_writer::value_type end = utf_decoder<wchar_writer>::decode_utf8_block(data, size, begin);
+			wchar_writer::value_type end = utf8_decoder::process(data, size, begin, wchar_writer());
 
 			assert(begin + length == end);
 			(void)!end;
@@ -1737,7 +2243,8 @@ PUGI__NS_BEGIN
 	}
 #endif
 
-	inline bool strcpy_insitu_allow(size_t length, uintptr_t header, uintptr_t header_mask, char_t* target)
+	template <typename Header>
+	inline bool strcpy_insitu_allow(size_t length, const Header& header, uintptr_t header_mask, char_t* target)
 	{
 		// never reuse shared memory
 		if (header & xml_memory_page_contents_shared_mask) return false;
@@ -1753,16 +2260,13 @@ PUGI__NS_BEGIN
 		return target_length >= length && (target_length < reuse_threshold || target_length - length < target_length / 2);
 	}
 
-	PUGI__FN bool strcpy_insitu(char_t*& dest, uintptr_t& header, uintptr_t header_mask, const char_t* source)
+	template <typename String, typename Header>
+	PUGI__FN bool strcpy_insitu(String& dest, Header& header, uintptr_t header_mask, const char_t* source, size_t source_length)
 	{
-		assert(header);
-
-		size_t source_length = strlength(source);
-
 		if (source_length == 0)
 		{
 			// empty string and null pointer are equivalent, so just deallocate old memory
-			xml_allocator* alloc = reinterpret_cast<xml_memory_page*>(header & xml_memory_page_pointer_mask)->allocator;
+			xml_allocator* alloc = PUGI__GETPAGE_IMPL(header)->allocator;
 
 			if (header & header_mask) alloc->deallocate_string(dest);
 			
@@ -1775,20 +2279,24 @@ PUGI__NS_BEGIN
 		else if (dest && strcpy_insitu_allow(source_length, header, header_mask, dest))
 		{
 			// we can reuse old buffer, so just copy the new data (including zero terminator)
-			memcpy(dest, source, (source_length + 1) * sizeof(char_t));
+			memcpy(dest, source, source_length * sizeof(char_t));
+			dest[source_length] = 0;
 			
 			return true;
 		}
 		else
 		{
-			xml_allocator* alloc = reinterpret_cast<xml_memory_page*>(header & xml_memory_page_pointer_mask)->allocator;
+			xml_allocator* alloc = PUGI__GETPAGE_IMPL(header)->allocator;
+
+			if (!alloc->reserve()) return false;
 
 			// allocate new buffer
 			char_t* buf = alloc->allocate_string(source_length + 1);
 			if (!buf) return false;
 
 			// copy the string (including zero terminator)
-			memcpy(buf, source, (source_length + 1) * sizeof(char_t));
+			memcpy(buf, source, source_length * sizeof(char_t));
+			buf[source_length] = 0;
 
 			// deallocate old buffer (*after* the above to protect against overlapping memory and/or allocation failures)
 			if (header & header_mask) alloc->deallocate_string(dest);
@@ -2312,11 +2820,17 @@ PUGI__NS_BEGIN
 	struct xml_parser
 	{
 		xml_allocator alloc;
+		xml_allocator* alloc_state;
 		char_t* error_offset;
 		xml_parse_status error_status;
 		
-		xml_parser(const xml_allocator& alloc_): alloc(alloc_), error_offset(0), error_status(status_ok)
+		xml_parser(xml_allocator* alloc_): alloc(*alloc_), alloc_state(alloc_), error_offset(0), error_status(status_ok)
+		{
+		}
+
+		~xml_parser()
 		{
+			*alloc_state = alloc;
 		}
 
 		// DOCTYPE consists of nested sections of the following possible types:
@@ -2614,6 +3128,7 @@ PUGI__NS_BEGIN
 					{
 						// store value and step over >
 						cursor->value = value;
+
 						PUGI__POPNODE();
 
 						PUGI__ENDSEG();
@@ -2893,18 +3408,15 @@ PUGI__NS_BEGIN
 
 		static xml_parse_result parse(char_t* buffer, size_t length, xml_document_struct* xmldoc, xml_node_struct* root, unsigned int optmsk)
 		{
-			// allocator object is a part of document object
-			xml_allocator& alloc_ = *static_cast<xml_allocator*>(xmldoc);
-
 			// early-out for empty documents
 			if (length == 0)
 				return make_parse_result(PUGI__OPTSET(parse_fragment) ? status_ok : status_no_document_element);
 
 			// get last child of the root before parsing
-			xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c : 0;
+			xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : 0;
 	
 			// create parser on stack
-			xml_parser parser(alloc_);
+			xml_parser parser(static_cast<xml_allocator*>(xmldoc));
 
 			// save last character and make buffer zero-terminated (speeds up parsing)
 			char_t endch = buffer[length - 1];
@@ -2916,9 +3428,6 @@ PUGI__NS_BEGIN
 			// perform actual parsing
 			parser.parse_tree(buffer_data, root, optmsk, endch);
 
-			// update allocator state
-			alloc_ = parser.alloc;
-
 			xml_parse_result result = make_parse_result(parser.error_status, parser.error_offset ? parser.error_offset - buffer : 0);
 			assert(result.offset >= 0 && static_cast<size_t>(result.offset) <= length);
 
@@ -2929,7 +3438,7 @@ PUGI__NS_BEGIN
 					return make_parse_result(status_unrecognized_tag, length - 1);
 
 				// check if there are any element nodes parsed
-				xml_node_struct* first_root_child_parsed = last_root_child ? last_root_child->next_sibling : root->first_child;
+				xml_node_struct* first_root_child_parsed = last_root_child ? last_root_child->next_sibling + 0 : root->first_child+ 0;
 
 				if (!PUGI__OPTSET(parse_fragment) && !has_element_node_siblings(first_root_child_parsed))
 					return make_parse_result(status_no_document_element, length - 1);
@@ -2973,6 +3482,30 @@ PUGI__NS_BEGIN
 		return encoding_utf8;
 	}
 
+	template <typename D, typename T> PUGI__FN size_t convert_buffer_output_generic(typename T::value_type dest, const char_t* data, size_t length, D, T)
+	{
+		PUGI__STATIC_ASSERT(sizeof(char_t) == sizeof(typename D::type));
+
+		typename T::value_type end = D::process(reinterpret_cast<const typename D::type*>(data), length, dest, T());
+
+		return static_cast<size_t>(end - dest) * sizeof(*dest);
+	}
+
+	template <typename D, typename T> PUGI__FN size_t convert_buffer_output_generic(typename T::value_type dest, const char_t* data, size_t length, D, T, bool opt_swap)
+	{
+		PUGI__STATIC_ASSERT(sizeof(char_t) == sizeof(typename D::type));
+
+		typename T::value_type end = D::process(reinterpret_cast<const typename D::type*>(data), length, dest, T());
+
+		if (opt_swap)
+		{
+			for (typename T::value_type i = dest; i != end; ++i)
+				*i = endian_swap(*i);
+		}
+
+		return static_cast<size_t>(end - dest) * sizeof(*dest);
+	}
+
 #ifdef PUGIXML_WCHAR_MODE
 	PUGI__FN size_t get_valid_length(const char_t* data, size_t length)
 	{
@@ -2994,53 +3527,27 @@ PUGI__NS_BEGIN
 	
 		// convert to utf8
 		if (encoding == encoding_utf8)
-		{
-			uint8_t* dest = r_u8;
-			uint8_t* end = utf_decoder<utf8_writer>::decode_wchar_block(data, length, dest);
-
-			return static_cast<size_t>(end - dest);
-		}
+			return convert_buffer_output_generic(r_u8, data, length, wchar_decoder(), utf8_writer());
 
 		// convert to utf16
 		if (encoding == encoding_utf16_be || encoding == encoding_utf16_le)
 		{
-			uint16_t* dest = r_u16;
-
-			// convert to native utf16
-			uint16_t* end = utf_decoder<utf16_writer>::decode_wchar_block(data, length, dest);
-
-			// swap if necessary
 			xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be;
 
-			if (native_encoding != encoding) convert_utf_endian_swap(dest, dest, static_cast<size_t>(end - dest));
-
-			return static_cast<size_t>(end - dest) * sizeof(uint16_t);
+			return convert_buffer_output_generic(r_u16, data, length, wchar_decoder(), utf16_writer(), native_encoding != encoding);
 		}
 
 		// convert to utf32
 		if (encoding == encoding_utf32_be || encoding == encoding_utf32_le)
 		{
-			uint32_t* dest = r_u32;
-
-			// convert to native utf32
-			uint32_t* end = utf_decoder<utf32_writer>::decode_wchar_block(data, length, dest);
-
-			// swap if necessary
 			xml_encoding native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be;
 
-			if (native_encoding != encoding) convert_utf_endian_swap(dest, dest, static_cast<size_t>(end - dest));
-
-			return static_cast<size_t>(end - dest) * sizeof(uint32_t);
+			return convert_buffer_output_generic(r_u32, data, length, wchar_decoder(), utf32_writer(), native_encoding != encoding);
 		}
 
 		// convert to latin1
 		if (encoding == encoding_latin1)
-		{
-			uint8_t* dest = r_u8;
-			uint8_t* end = utf_decoder<latin1_writer>::decode_wchar_block(data, length, dest);
-
-			return static_cast<size_t>(end - dest);
-		}
+			return convert_buffer_output_generic(r_u8, data, length, wchar_decoder(), latin1_writer());
 
 		assert(!"Invalid encoding");
 		return 0;
@@ -3066,41 +3573,20 @@ PUGI__NS_BEGIN
 	{
 		if (encoding == encoding_utf16_be || encoding == encoding_utf16_le)
 		{
-			uint16_t* dest = r_u16;
-
-			// convert to native utf16
-			uint16_t* end = utf_decoder<utf16_writer>::decode_utf8_block(reinterpret_cast<const uint8_t*>(data), length, dest);
-
-			// swap if necessary
 			xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be;
 
-			if (native_encoding != encoding) convert_utf_endian_swap(dest, dest, static_cast<size_t>(end - dest));
-
-			return static_cast<size_t>(end - dest) * sizeof(uint16_t);
+			return convert_buffer_output_generic(r_u16, data, length, utf8_decoder(), utf16_writer(), native_encoding != encoding);
 		}
 
 		if (encoding == encoding_utf32_be || encoding == encoding_utf32_le)
 		{
-			uint32_t* dest = r_u32;
-
-			// convert to native utf32
-			uint32_t* end = utf_decoder<utf32_writer>::decode_utf8_block(reinterpret_cast<const uint8_t*>(data), length, dest);
-
-			// swap if necessary
 			xml_encoding native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be;
 
-			if (native_encoding != encoding) convert_utf_endian_swap(dest, dest, static_cast<size_t>(end - dest));
-
-			return static_cast<size_t>(end - dest) * sizeof(uint32_t);
+			return convert_buffer_output_generic(r_u32, data, length, utf8_decoder(), utf32_writer(), native_encoding != encoding);
 		}
 
 		if (encoding == encoding_latin1)
-		{
-			uint8_t* dest = r_u8;
-			uint8_t* end = utf_decoder<latin1_writer>::decode_utf8_block(reinterpret_cast<const uint8_t*>(data), length, dest);
-
-			return static_cast<size_t>(end - dest);
-		}
+			return convert_buffer_output_generic(r_u8, data, length, utf8_decoder(), latin1_writer());
 
 		assert(!"Invalid encoding");
 		return 0;
@@ -3118,11 +3604,6 @@ PUGI__NS_BEGIN
 			PUGI__STATIC_ASSERT(bufcapacity >= 8);
 		}
 
-		~xml_buffered_writer()
-		{
-			flush();
-		}
-
 		size_t flush()
 		{
 			flush(buffer, bufsize);
@@ -3483,14 +3964,24 @@ PUGI__NS_BEGIN
 		}
 	}
 
-	PUGI__FN void node_output_attributes(xml_buffered_writer& writer, xml_node_struct* node, unsigned int flags)
+	PUGI__FN void node_output_attributes(xml_buffered_writer& writer, xml_node_struct* node, const char_t* indent, size_t indent_length, unsigned int flags, unsigned int depth)
 	{
 		const char_t* default_name = PUGIXML_TEXT(":anonymous");
 
 		for (xml_attribute_struct* a = node->first_attribute; a; a = a->next_attribute)
 		{
-			writer.write(' ');
-			writer.write_string(a->name ? a->name : default_name);
+			if ((flags & (format_indent_attributes | format_raw)) == format_indent_attributes)
+			{
+				writer.write('\n');
+
+				text_output_indent(writer, indent, indent_length, depth + 1);
+			}
+			else
+			{
+				writer.write(' ');
+			}
+
+			writer.write_string(a->name ? a->name + 0 : default_name);
 			writer.write('=', '"');
 
 			if (a->value)
@@ -3500,16 +3991,16 @@ PUGI__NS_BEGIN
 		}
 	}
 
-	PUGI__FN bool node_output_start(xml_buffered_writer& writer, xml_node_struct* node, unsigned int flags)
+	PUGI__FN bool node_output_start(xml_buffered_writer& writer, xml_node_struct* node, const char_t* indent, size_t indent_length, unsigned int flags, unsigned int depth)
 	{
 		const char_t* default_name = PUGIXML_TEXT(":anonymous");
-		const char_t* name = node->name ? node->name : default_name;
+		const char_t* name = node->name ? node->name + 0 : default_name;
 
 		writer.write('<');
 		writer.write_string(name);
 
 		if (node->first_attribute)
-			node_output_attributes(writer, node, flags);
+			node_output_attributes(writer, node, indent, indent_length, flags, depth);
 
 		if (!node->first_child)
 		{
@@ -3528,7 +4019,7 @@ PUGI__NS_BEGIN
 	PUGI__FN void node_output_end(xml_buffered_writer& writer, xml_node_struct* node)
 	{
 		const char_t* default_name = PUGIXML_TEXT(":anonymous");
-		const char_t* name = node->name ? node->name : default_name;
+		const char_t* name = node->name ? node->name + 0 : default_name;
 
 		writer.write('<', '/');
 		writer.write_string(name);
@@ -3542,20 +4033,20 @@ PUGI__NS_BEGIN
 		switch (PUGI__NODETYPE(node))
 		{
 			case node_pcdata:
-				text_output(writer, node->value ? node->value : PUGIXML_TEXT(""), ctx_special_pcdata, flags);
+				text_output(writer, node->value ? node->value + 0 : PUGIXML_TEXT(""), ctx_special_pcdata, flags);
 				break;
 
 			case node_cdata:
-				text_output_cdata(writer, node->value ? node->value : PUGIXML_TEXT(""));
+				text_output_cdata(writer, node->value ? node->value + 0 : PUGIXML_TEXT(""));
 				break;
 
 			case node_comment:
-				node_output_comment(writer, node->value ? node->value : PUGIXML_TEXT(""));
+				node_output_comment(writer, node->value ? node->value + 0 : PUGIXML_TEXT(""));
 				break;
 
 			case node_pi:
 				writer.write('<', '?');
-				writer.write_string(node->name ? node->name : default_name);
+				writer.write_string(node->name ? node->name + 0 : default_name);
 
 				if (node->value)
 				{
@@ -3568,8 +4059,8 @@ PUGI__NS_BEGIN
 
 			case node_declaration:
 				writer.write('<', '?');
-				writer.write_string(node->name ? node->name : default_name);
-				node_output_attributes(writer, node, flags);
+				writer.write_string(node->name ? node->name + 0 : default_name);
+				node_output_attributes(writer, node, PUGIXML_TEXT(""), 0, flags | format_raw, 0);
 				writer.write('?', '>');
 				break;
 
@@ -3599,7 +4090,7 @@ PUGI__NS_BEGIN
 
 	PUGI__FN void node_output(xml_buffered_writer& writer, xml_node_struct* root, const char_t* indent, unsigned int flags, unsigned int depth)
 	{
-		size_t indent_length = ((flags & (format_indent | format_raw)) == format_indent) ? strlength(indent) : 0;
+		size_t indent_length = ((flags & (format_indent | format_indent_attributes)) && (flags & format_raw) == 0) ? strlength(indent) : 0;
 		unsigned int indent_flags = indent_indent;
 
 		xml_node_struct* node = root;
@@ -3627,7 +4118,7 @@ PUGI__NS_BEGIN
 				{
 					indent_flags = indent_newline | indent_indent;
 
-					if (node_output_start(writer, node, flags))
+					if (node_output_start(writer, node, indent, indent_length, flags, depth))
 					{
 						node = node->first_child;
 						depth++;
@@ -3746,7 +4237,8 @@ PUGI__NS_BEGIN
 		return true;
 	}
 
-	PUGI__FN void node_copy_string(char_t*& dest, uintptr_t& header, uintptr_t header_mask, char_t* source, uintptr_t& source_header, xml_allocator* alloc)
+	template <typename String, typename Header>
+	PUGI__FN void node_copy_string(String& dest, Header& header, uintptr_t header_mask, char_t* source, Header& source_header, xml_allocator* alloc)
 	{
 		assert(!dest && (header & header_mask) == 0);
 
@@ -3761,7 +4253,7 @@ PUGI__NS_BEGIN
 				source_header |= xml_memory_page_contents_shared_mask;
 			}
 			else
-				strcpy_insitu(dest, header, header_mask, source);
+				strcpy_insitu(dest, header, header_mask, source, strlength(source));
 		}
 	}
 
@@ -3827,6 +4319,15 @@ PUGI__NS_BEGIN
 		}
 	}
 
+	PUGI__FN void node_copy_attribute(xml_attribute_struct* da, xml_attribute_struct* sa)
+	{
+		xml_allocator& alloc = get_allocator(da);
+		xml_allocator* shared_alloc = (&alloc == &get_allocator(sa)) ? &alloc : 0;
+
+		node_copy_string(da->name, da->header, xml_memory_page_name_allocated_mask, sa->name, sa->header, shared_alloc);
+		node_copy_string(da->value, da->header, xml_memory_page_value_allocated_mask, sa->value, sa->header, shared_alloc);
+	}
+
 	inline bool is_text_node(xml_node_struct* node)
 	{
 		xml_node_type type = PUGI__NODETYPE(node);
@@ -3835,49 +4336,93 @@ PUGI__NS_BEGIN
 	}
 
 	// get value with conversion functions
-	PUGI__FN int get_integer_base(const char_t* value)
+	template <typename U> U string_to_integer(const char_t* value, U minneg, U maxpos)
 	{
+		U result = 0;
 		const char_t* s = value;
 
 		while (PUGI__IS_CHARTYPE(*s, ct_space))
 			s++;
 
-		if (*s == '-')
-			s++;
+		bool negative = (*s == '-');
 
-		return (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10;
-	}
+		s += (*s == '+' || *s == '-');
 
-	PUGI__FN int get_value_int(const char_t* value, int def)
-	{
-		if (!value) return def;
+		bool overflow = false;
+
+		if (s[0] == '0' && (s[1] | ' ') == 'x')
+		{
+			s += 2;
 
-		int base = get_integer_base(value);
+			// since overflow detection relies on length of the sequence skip leading zeros
+			while (*s == '0')
+				s++;
 
-	#ifdef PUGIXML_WCHAR_MODE
-		return static_cast<int>(wcstol(value, 0, base));
-	#else
-		return static_cast<int>(strtol(value, 0, base));
-	#endif
-	}
+			const char_t* start = s;
 
-	PUGI__FN unsigned int get_value_uint(const char_t* value, unsigned int def)
-	{
-		if (!value) return def;
+			for (;;)
+			{
+				if (static_cast<unsigned>(*s - '0') < 10)
+					result = result * 16 + (*s - '0');
+				else if (static_cast<unsigned>((*s | ' ') - 'a') < 6)
+					result = result * 16 + ((*s | ' ') - 'a' + 10);
+				else
+					break;
 
-		int base = get_integer_base(value);
+				s++;
+			}
 
-	#ifdef PUGIXML_WCHAR_MODE
-		return static_cast<unsigned int>(wcstoul(value, 0, base));
-	#else
-		return static_cast<unsigned int>(strtoul(value, 0, base));
-	#endif
+			size_t digits = static_cast<size_t>(s - start);
+
+			overflow = digits > sizeof(U) * 2;
+		}
+		else
+		{
+			// since overflow detection relies on length of the sequence skip leading zeros
+			while (*s == '0')
+				s++;
+
+			const char_t* start = s;
+
+			for (;;)
+			{
+				if (static_cast<unsigned>(*s - '0') < 10)
+					result = result * 10 + (*s - '0');
+				else
+					break;
+
+				s++;
+			}
+
+			size_t digits = static_cast<size_t>(s - start);
+
+			PUGI__STATIC_ASSERT(sizeof(U) == 8 || sizeof(U) == 4 || sizeof(U) == 2);
+
+			const size_t max_digits10 = sizeof(U) == 8 ? 20 : sizeof(U) == 4 ? 10 : 5;
+			const char_t max_lead = sizeof(U) == 8 ? '1' : sizeof(U) == 4 ? '4' : '6';
+			const size_t high_bit = sizeof(U) * 8 - 1;
+
+			overflow = digits >= max_digits10 && !(digits == max_digits10 && (*start < max_lead || (*start == max_lead && result >> high_bit)));
+		}
+
+		if (negative)
+			return (overflow || result > minneg) ? 0 - minneg : 0 - result;
+		else
+			return (overflow || result > maxpos) ? maxpos : result;
 	}
 
-	PUGI__FN double get_value_double(const char_t* value, double def)
+	PUGI__FN int get_value_int(const char_t* value)
 	{
-		if (!value) return def;
+		return string_to_integer<unsigned int>(value, 0 - static_cast<unsigned int>(INT_MIN), INT_MAX);
+	}
+
+	PUGI__FN unsigned int get_value_uint(const char_t* value)
+	{
+		return string_to_integer<unsigned int>(value, 0, UINT_MAX);
+	}
 
+	PUGI__FN double get_value_double(const char_t* value)
+	{
 	#ifdef PUGIXML_WCHAR_MODE
 		return wcstod(value, 0);
 	#else
@@ -3885,10 +4430,8 @@ PUGI__NS_BEGIN
 	#endif
 	}
 
-	PUGI__FN float get_value_float(const char_t* value, float def)
+	PUGI__FN float get_value_float(const char_t* value)
 	{
-		if (!value) return def;
-
 	#ifdef PUGIXML_WCHAR_MODE
 		return static_cast<float>(wcstod(value, 0));
 	#else
@@ -3896,10 +4439,8 @@ PUGI__NS_BEGIN
 	#endif
 	}
 
-	PUGI__FN bool get_value_bool(const char_t* value, bool def)
+	PUGI__FN bool get_value_bool(const char_t* value)
 	{
-		if (!value) return def;
-
 		// only look at first char
 		char_t first = *value;
 
@@ -3908,117 +4449,153 @@ PUGI__NS_BEGIN
 	}
 
 #ifdef PUGIXML_HAS_LONG_LONG
-	PUGI__FN long long get_value_llong(const char_t* value, long long def)
+	PUGI__FN long long get_value_llong(const char_t* value)
 	{
-		if (!value) return def;
-
-		int base = get_integer_base(value);
+		return string_to_integer<unsigned long long>(value, 0 - static_cast<unsigned long long>(LLONG_MIN), LLONG_MAX);
+	}
 
-	#ifdef PUGIXML_WCHAR_MODE
-		#ifdef PUGI__MSVC_CRT_VERSION
-			return _wcstoi64(value, 0, base);
-		#else
-			return wcstoll(value, 0, base);
-		#endif
-	#else
-		#ifdef PUGI__MSVC_CRT_VERSION
-			return _strtoi64(value, 0, base);
-		#else
-			return strtoll(value, 0, base);
-		#endif
-	#endif
+	PUGI__FN unsigned long long get_value_ullong(const char_t* value)
+	{
+		return string_to_integer<unsigned long long>(value, 0, ULLONG_MAX);
 	}
+#endif
 
-	PUGI__FN unsigned long long get_value_ullong(const char_t* value, unsigned long long def)
+	template <typename U>
+	PUGI__FN char_t* integer_to_string(char_t* begin, char_t* end, U value, bool negative)
 	{
-		if (!value) return def;
+		char_t* result = end - 1;
+		U rest = negative ? 0 - value : value;
+
+		do
+		{
+			*result-- = static_cast<char_t>('0' + (rest % 10));
+			rest /= 10;
+		}
+		while (rest);
 
-		int base = get_integer_base(value);
+		assert(result >= begin);
+		(void)begin;
 
-	#ifdef PUGIXML_WCHAR_MODE
-		#ifdef PUGI__MSVC_CRT_VERSION
-			return _wcstoui64(value, 0, base);
-		#else
-			return wcstoull(value, 0, base);
-		#endif
-	#else
-		#ifdef PUGI__MSVC_CRT_VERSION
-			return _strtoui64(value, 0, base);
-		#else
-			return strtoull(value, 0, base);
-		#endif
-	#endif
+		*result = '-';
+
+		return result + !negative;
 	}
-#endif
 
 	// set value with conversion functions
-	PUGI__FN bool set_value_buffer(char_t*& dest, uintptr_t& header, uintptr_t header_mask, char (&buf)[128])
+	template <typename String, typename Header>
+	PUGI__FN bool set_value_ascii(String& dest, Header& header, uintptr_t header_mask, char* buf)
 	{
 	#ifdef PUGIXML_WCHAR_MODE
 		char_t wbuf[128];
-		impl::widen_ascii(wbuf, buf);
+		assert(strlen(buf) < sizeof(wbuf) / sizeof(wbuf[0]));
+
+		size_t offset = 0;
+		for (; buf[offset]; ++offset) wbuf[offset] = buf[offset];
 
-		return strcpy_insitu(dest, header, header_mask, wbuf);
+		return strcpy_insitu(dest, header, header_mask, wbuf, offset);
 	#else
-		return strcpy_insitu(dest, header, header_mask, buf);
+		return strcpy_insitu(dest, header, header_mask, buf, strlen(buf));
 	#endif
 	}
 
-	PUGI__FN bool set_value_convert(char_t*& dest, uintptr_t& header, uintptr_t header_mask, int value)
+	template <typename String, typename Header>
+	PUGI__FN bool set_value_convert(String& dest, Header& header, uintptr_t header_mask, int value)
 	{
-		char buf[128];
-		sprintf(buf, "%d", value);
-	
-		return set_value_buffer(dest, header, header_mask, buf);
+		char_t buf[64];
+		char_t* end = buf + sizeof(buf) / sizeof(buf[0]);
+		char_t* begin = integer_to_string<unsigned int>(buf, end, value, value < 0);
+
+		return strcpy_insitu(dest, header, header_mask, begin, end - begin);
 	}
 
-	PUGI__FN bool set_value_convert(char_t*& dest, uintptr_t& header, uintptr_t header_mask, unsigned int value)
+	template <typename String, typename Header>
+	PUGI__FN bool set_value_convert(String& dest, Header& header, uintptr_t header_mask, unsigned int value)
 	{
-		char buf[128];
-		sprintf(buf, "%u", value);
+		char_t buf[64];
+		char_t* end = buf + sizeof(buf) / sizeof(buf[0]);
+		char_t* begin = integer_to_string<unsigned int>(buf, end, value, false);
 
-		return set_value_buffer(dest, header, header_mask, buf);
+		return strcpy_insitu(dest, header, header_mask, begin, end - begin);
 	}
 
-	PUGI__FN bool set_value_convert(char_t*& dest, uintptr_t& header, uintptr_t header_mask, float value)
+	template <typename String, typename Header>
+	PUGI__FN bool set_value_convert(String& dest, Header& header, uintptr_t header_mask, float value)
 	{
 		char buf[128];
 		sprintf(buf, "%.9g", value);
 
-		return set_value_buffer(dest, header, header_mask, buf);
+		return set_value_ascii(dest, header, header_mask, buf);
 	}
-	
-	PUGI__FN bool set_value_convert(char_t*& dest, uintptr_t& header, uintptr_t header_mask, double value)
+
+	template <typename String, typename Header>
+	PUGI__FN bool set_value_convert(String& dest, Header& header, uintptr_t header_mask, double value)
 	{
 		char buf[128];
 		sprintf(buf, "%.17g", value);
 
-		return set_value_buffer(dest, header, header_mask, buf);
+		return set_value_ascii(dest, header, header_mask, buf);
 	}
 	
-	PUGI__FN bool set_value_convert(char_t*& dest, uintptr_t& header, uintptr_t header_mask, bool value)
+	template <typename String, typename Header>
+	PUGI__FN bool set_value_convert(String& dest, Header& header, uintptr_t header_mask, bool value)
 	{
-		return strcpy_insitu(dest, header, header_mask, value ? PUGIXML_TEXT("true") : PUGIXML_TEXT("false"));
+		return strcpy_insitu(dest, header, header_mask, value ? PUGIXML_TEXT("true") : PUGIXML_TEXT("false"), value ? 4 : 5);
 	}
 
 #ifdef PUGIXML_HAS_LONG_LONG
-	PUGI__FN bool set_value_convert(char_t*& dest, uintptr_t& header, uintptr_t header_mask, long long value)
+	template <typename String, typename Header>
+	PUGI__FN bool set_value_convert(String& dest, Header& header, uintptr_t header_mask, long long value)
 	{
-		char buf[128];
-		sprintf(buf, "%lld", value);
-	
-		return set_value_buffer(dest, header, header_mask, buf);
+		char_t buf[64];
+		char_t* end = buf + sizeof(buf) / sizeof(buf[0]);
+		char_t* begin = integer_to_string<unsigned long long>(buf, end, value, value < 0);
+
+		return strcpy_insitu(dest, header, header_mask, begin, end - begin);
 	}
 
-	PUGI__FN bool set_value_convert(char_t*& dest, uintptr_t& header, uintptr_t header_mask, unsigned long long value)
+	template <typename String, typename Header>
+	PUGI__FN bool set_value_convert(String& dest, Header& header, uintptr_t header_mask, unsigned long long value)
 	{
-		char buf[128];
-		sprintf(buf, "%llu", value);
-	
-		return set_value_buffer(dest, header, header_mask, buf);
+		char_t buf[64];
+		char_t* end = buf + sizeof(buf) / sizeof(buf[0]);
+		char_t* begin = integer_to_string<unsigned long long>(buf, end, value, false);
+
+		return strcpy_insitu(dest, header, header_mask, begin, end - begin);
 	}
 #endif
 
+	PUGI__FN xml_parse_result load_buffer_impl(xml_document_struct* doc, xml_node_struct* root, void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own, char_t** out_buffer)
+	{
+		// check input buffer
+		if (!contents && size) return make_parse_result(status_io_error);
+
+		// get actual encoding
+		xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size);
+
+		// get private buffer
+		char_t* buffer = 0;
+		size_t length = 0;
+
+		if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable)) return impl::make_parse_result(status_out_of_memory);
+
+		// delete original buffer if we performed a conversion
+		if (own && buffer != contents && contents) impl::xml_memory::deallocate(contents);
+
+		// grab onto buffer if it's our buffer, user is responsible for deallocating contents himself
+		if (own || buffer != contents) *out_buffer = buffer;
+
+		// store buffer for offset_debug
+		doc->buffer = buffer;
+
+		// parse
+		xml_parse_result res = impl::xml_parser::parse(buffer, length, doc, root, options);
+
+		// remember encoding
+		res.encoding = buffer_encoding;
+
+		return res;
+	}
+
 	// we need to get length of entire file to load it in memory; the only (relatively) sane way to do it is via seek/tell trick
 	PUGI__FN xml_parse_status get_file_size(FILE* file, size_t& out_result)
 	{
@@ -4059,6 +4636,7 @@ PUGI__NS_BEGIN
 		return status_ok;
 	}
 
+	// This function assumes that buffer has extra sizeof(char_t) writable bytes after size
 	PUGI__FN size_t zero_terminate_buffer(void* buffer, size_t size, xml_encoding encoding) 
 	{
 		// We only need to zero-terminate if encoding conversion does not do it for us
@@ -4083,34 +4661,23 @@ PUGI__NS_BEGIN
 		return size;
 	}
 
-	PUGI__FN xml_parse_result load_file_impl(xml_document& doc, FILE* file, unsigned int options, xml_encoding encoding)
+	PUGI__FN xml_parse_result load_file_impl(xml_document_struct* doc, FILE* file, unsigned int options, xml_encoding encoding, char_t** out_buffer)
 	{
 		if (!file) return make_parse_result(status_file_not_found);
 
 		// get file size (can result in I/O errors)
 		size_t size = 0;
 		xml_parse_status size_status = get_file_size(file, size);
-
-		if (size_status != status_ok)
-		{
-			fclose(file);
-			return make_parse_result(size_status);
-		}
+		if (size_status != status_ok) return make_parse_result(size_status);
 		
 		size_t max_suffix_size = sizeof(char_t);
 
 		// allocate buffer for the whole file
 		char* contents = static_cast<char*>(xml_memory::allocate(size + max_suffix_size));
-
-		if (!contents)
-		{
-			fclose(file);
-			return make_parse_result(status_out_of_memory);
-		}
+		if (!contents) return make_parse_result(status_out_of_memory);
 
 		// read file in memory
 		size_t read_size = fread(contents, 1, size, file);
-		fclose(file);
 
 		if (read_size != size)
 		{
@@ -4119,8 +4686,8 @@ PUGI__NS_BEGIN
 		}
 
 		xml_encoding real_encoding = get_buffer_encoding(encoding, contents, size);
-		
-		return doc.load_buffer_inplace_own(contents, zero_terminate_buffer(contents, size, real_encoding), options, real_encoding);
+
+		return load_buffer_impl(doc, doc, contents, zero_terminate_buffer(contents, size, real_encoding), options, real_encoding, true, true, out_buffer);
 	}
 
 #ifndef PUGIXML_NO_STL
@@ -4129,14 +4696,13 @@ PUGI__NS_BEGIN
 		static xml_stream_chunk* create()
 		{
 			void* memory = xml_memory::allocate(sizeof(xml_stream_chunk));
+			if (!memory) return 0;
 			
 			return new (memory) xml_stream_chunk();
 		}
 
-		static void destroy(void* ptr)
+		static void destroy(xml_stream_chunk* chunk)
 		{
-			xml_stream_chunk* chunk = static_cast<xml_stream_chunk*>(ptr);
-
 			// free chunk chain
 			while (chunk)
 			{
@@ -4160,7 +4726,7 @@ PUGI__NS_BEGIN
 
 	template <typename T> PUGI__FN xml_parse_status load_stream_data_noseek(std::basic_istream<T>& stream, void** out_buffer, size_t* out_size)
 	{
-		buffer_holder chunks(0, xml_stream_chunk<T>::destroy);
+		auto_deleter<xml_stream_chunk<T> > chunks(0, xml_stream_chunk<T>::destroy);
 
 		// read file to a chunk list
 		size_t total = 0;
@@ -4196,7 +4762,7 @@ PUGI__NS_BEGIN
 
 		char* write = buffer;
 
-		for (xml_stream_chunk<T>* chunk = static_cast<xml_stream_chunk<T>*>(chunks.data); chunk; chunk = chunk->next)
+		for (xml_stream_chunk<T>* chunk = chunks.data; chunk; chunk = chunk->next)
 		{
 			assert(write + chunk->size <= buffer + total);
 			memcpy(write, chunk->data, chunk->size);
@@ -4230,7 +4796,7 @@ PUGI__NS_BEGIN
 		size_t max_suffix_size = sizeof(char_t);
 
 		// read stream data into memory (guard against stream exceptions with buffer holder)
-		buffer_holder buffer(xml_memory::allocate(read_length * sizeof(T) + max_suffix_size), xml_memory::deallocate);
+		auto_deleter<void> buffer(xml_memory::allocate(read_length * sizeof(T) + max_suffix_size), xml_memory::deallocate);
 		if (!buffer.data) return status_out_of_memory;
 
 		stream.read(static_cast<T*>(buffer.data), static_cast<std::streamsize>(read_length));
@@ -4248,7 +4814,7 @@ PUGI__NS_BEGIN
 		return status_ok;
 	}
 
-	template <typename T> PUGI__FN xml_parse_result load_stream_impl(xml_document& doc, std::basic_istream<T>& stream, unsigned int options, xml_encoding encoding)
+	template <typename T> PUGI__FN xml_parse_result load_stream_impl(xml_document_struct* doc, std::basic_istream<T>& stream, unsigned int options, xml_encoding encoding, char_t** out_buffer)
 	{
 		void* buffer = 0;
 		size_t size = 0;
@@ -4270,7 +4836,7 @@ PUGI__NS_BEGIN
 
 		xml_encoding real_encoding = get_buffer_encoding(encoding, buffer, size);
 		
-		return doc.load_buffer_inplace_own(buffer, zero_terminate_buffer(buffer, size, real_encoding), options, real_encoding);
+		return load_buffer_impl(doc, doc, buffer, zero_terminate_buffer(buffer, size, real_encoding), options, real_encoding, true, true, out_buffer);
 	}
 #endif
 
@@ -4295,6 +4861,9 @@ PUGI__NS_BEGIN
 		// second pass: convert to utf8
 		as_utf8_end(result, size, str, length);
 
+		// zero-terminate
+		result[size] = 0;
+
 		return result;
 	}
 
@@ -4325,44 +4894,24 @@ PUGI__NS_BEGIN
 		xml_writer_file writer(file);
 		doc.save(writer, indent, flags, encoding);
 
-		int result = ferror(file);
-
-		fclose(file);
-
-		return result == 0;
+		return ferror(file) == 0;
 	}
 
-	PUGI__FN xml_parse_result load_buffer_impl(xml_document_struct* doc, xml_node_struct* root, void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own, char_t** out_buffer)
+	struct name_null_sentry
 	{
-		// check input buffer
-		if (!contents && size) return make_parse_result(status_io_error);
-
-		// get actual encoding
-		xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size);
-
-		// get private buffer
-		char_t* buffer = 0;
-		size_t length = 0;
+		xml_node_struct* node;
+		char_t* name;
 
-		if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable)) return impl::make_parse_result(status_out_of_memory);
-		
-		// delete original buffer if we performed a conversion
-		if (own && buffer != contents && contents) impl::xml_memory::deallocate(contents);
-
-		// store buffer for offset_debug
-		doc->buffer = buffer;
-
-		// parse
-		xml_parse_result res = impl::xml_parser::parse(buffer, length, doc, root, options);
-
-		// remember encoding
-		res.encoding = buffer_encoding;
-
-		// grab onto buffer if it's our buffer, user is responsible for deallocating contents himself
-		if (own || buffer != contents) *out_buffer = buffer;
+		name_null_sentry(xml_node_struct* node_): node(node_), name(node_->name)
+		{
+			node->name = 0;
+		}
 
-		return res;
-	}
+		~name_null_sentry()
+		{
+			node->name = name;
+		}
+	};
 PUGI__NS_END
 
 namespace pugi
@@ -4490,43 +5039,43 @@ namespace pugi
 
 	PUGI__FN const char_t* xml_attribute::as_string(const char_t* def) const
 	{
-		return (_attr && _attr->value) ? _attr->value : def;
+		return (_attr && _attr->value) ? _attr->value + 0 : def;
 	}
 
 	PUGI__FN int xml_attribute::as_int(int def) const
 	{
-		return impl::get_value_int(_attr ? _attr->value : 0, def);
+		return (_attr && _attr->value) ? impl::get_value_int(_attr->value) : def;
 	}
 
 	PUGI__FN unsigned int xml_attribute::as_uint(unsigned int def) const
 	{
-		return impl::get_value_uint(_attr ? _attr->value : 0, def);
+		return (_attr && _attr->value) ? impl::get_value_uint(_attr->value) : def;
 	}
 
 	PUGI__FN double xml_attribute::as_double(double def) const
 	{
-		return impl::get_value_double(_attr ? _attr->value : 0, def);
+		return (_attr && _attr->value) ? impl::get_value_double(_attr->value) : def;
 	}
 
 	PUGI__FN float xml_attribute::as_float(float def) const
 	{
-		return impl::get_value_float(_attr ? _attr->value : 0, def);
+		return (_attr && _attr->value) ? impl::get_value_float(_attr->value) : def;
 	}
 
 	PUGI__FN bool xml_attribute::as_bool(bool def) const
 	{
-		return impl::get_value_bool(_attr ? _attr->value : 0, def);
+		return (_attr && _attr->value) ? impl::get_value_bool(_attr->value) : def;
 	}
 
 #ifdef PUGIXML_HAS_LONG_LONG
 	PUGI__FN long long xml_attribute::as_llong(long long def) const
 	{
-		return impl::get_value_llong(_attr ? _attr->value : 0, def);
+		return (_attr && _attr->value) ? impl::get_value_llong(_attr->value) : def;
 	}
 
 	PUGI__FN unsigned long long xml_attribute::as_ullong(unsigned long long def) const
 	{
-		return impl::get_value_ullong(_attr ? _attr->value : 0, def);
+		return (_attr && _attr->value) ? impl::get_value_ullong(_attr->value) : def;
 	}
 #endif
 
@@ -4537,12 +5086,12 @@ namespace pugi
 
 	PUGI__FN const char_t* xml_attribute::name() const
 	{
-		return (_attr && _attr->name) ? _attr->name : PUGIXML_TEXT("");
+		return (_attr && _attr->name) ? _attr->name + 0 : PUGIXML_TEXT("");
 	}
 
 	PUGI__FN const char_t* xml_attribute::value() const
 	{
-		return (_attr && _attr->value) ? _attr->value : PUGIXML_TEXT("");
+		return (_attr && _attr->value) ? _attr->value + 0 : PUGIXML_TEXT("");
 	}
 
 	PUGI__FN size_t xml_attribute::hash_value() const
@@ -4584,7 +5133,7 @@ namespace pugi
 		set_value(rhs);
 		return *this;
 	}
-	
+
 	PUGI__FN xml_attribute& xml_attribute::operator=(bool rhs)
 	{
 		set_value(rhs);
@@ -4609,14 +5158,14 @@ namespace pugi
 	{
 		if (!_attr) return false;
 		
-		return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs);
+		return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs, impl::strlength(rhs));
 	}
 		
 	PUGI__FN bool xml_attribute::set_value(const char_t* rhs)
 	{
 		if (!_attr) return false;
 
-		return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs);
+		return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, impl::strlength(rhs));
 	}
 
 	PUGI__FN bool xml_attribute::set_value(int rhs)
@@ -4646,7 +5195,7 @@ namespace pugi
 
 		return impl::set_value_convert(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs);
 	}
-	
+
 	PUGI__FN bool xml_attribute::set_value(bool rhs)
 	{
 		if (!_attr) return false;
@@ -4706,7 +5255,7 @@ namespace pugi
 
 	PUGI__FN xml_node::iterator xml_node::begin() const
 	{
-		return iterator(_root ? _root->first_child : 0, _root);
+		return iterator(_root ? _root->first_child + 0 : 0, _root);
 	}
 
 	PUGI__FN xml_node::iterator xml_node::end() const
@@ -4716,7 +5265,7 @@ namespace pugi
 	
 	PUGI__FN xml_node::attribute_iterator xml_node::attributes_begin() const
 	{
-		return attribute_iterator(_root ? _root->first_attribute : 0, _root);
+		return attribute_iterator(_root ? _root->first_attribute + 0 : 0, _root);
 	}
 
 	PUGI__FN xml_node::attribute_iterator xml_node::attributes_end() const
@@ -4776,7 +5325,7 @@ namespace pugi
 	
 	PUGI__FN const char_t* xml_node::name() const
 	{
-		return (_root && _root->name) ? _root->name : PUGIXML_TEXT("");
+		return (_root && _root->name) ? _root->name + 0 : PUGIXML_TEXT("");
 	}
 
 	PUGI__FN xml_node_type xml_node::type() const
@@ -4786,7 +5335,7 @@ namespace pugi
 	
 	PUGI__FN const char_t* xml_node::value() const
 	{
-		return (_root && _root->value) ? _root->value : PUGIXML_TEXT("");
+		return (_root && _root->value) ? _root->value + 0 : PUGIXML_TEXT("");
 	}
 	
 	PUGI__FN xml_node xml_node::child(const char_t* name_) const
@@ -4835,6 +5384,39 @@ namespace pugi
 		return xml_node();
 	}
 
+	PUGI__FN xml_attribute xml_node::attribute(const char_t* name_, xml_attribute& hint_) const
+	{
+		xml_attribute_struct* hint = hint_._attr;
+
+		// if hint is not an attribute of node, behavior is not defined
+		assert(!hint || (_root && impl::is_attribute_of(hint, _root)));
+
+		if (!_root) return xml_attribute();
+
+		// optimistically search from hint up until the end
+		for (xml_attribute_struct* i = hint; i; i = i->next_attribute)
+			if (i->name && impl::strequal(name_, i->name))
+			{
+				// update hint to maximize efficiency of searching for consecutive attributes
+				hint_._attr = i->next_attribute;
+
+				return xml_attribute(i);
+			}
+
+		// wrap around and search from the first attribute until the hint
+		// 'j' null pointer check is technically redundant, but it prevents a crash in case the assertion above fails
+		for (xml_attribute_struct* j = _root->first_attribute; j && j != hint; j = j->next_attribute)
+			if (j->name && impl::strequal(name_, j->name))
+			{
+				// update hint to maximize efficiency of searching for consecutive attributes
+				hint_._attr = j->next_attribute;
+
+				return xml_attribute(j);
+			}
+
+		return xml_attribute();
+	}
+
 	PUGI__FN xml_node xml_node::previous_sibling() const
 	{
 		if (!_root) return xml_node();
@@ -4863,7 +5445,7 @@ namespace pugi
 		if (!_root) return PUGIXML_TEXT("");
 		
 		for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling)
-			if (i->value && impl::is_text_node(i))
+			if (impl::is_text_node(i) && i->value)
 				return i->value;
 
 		return PUGIXML_TEXT("");
@@ -4896,39 +5478,32 @@ namespace pugi
 
 	PUGI__FN bool xml_node::set_name(const char_t* rhs)
 	{
-		switch (type())
-		{
-		case node_pi:
-		case node_declaration:
-		case node_element:
-			return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs);
+		xml_node_type type_ = _root ? PUGI__NODETYPE(_root) : node_null;
 
-		default:
+		if (type_ != node_element && type_ != node_pi && type_ != node_declaration)
 			return false;
-		}
+
+		return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs, impl::strlength(rhs));
 	}
 		
 	PUGI__FN bool xml_node::set_value(const char_t* rhs)
 	{
-		switch (type())
-		{
-		case node_pi:
-		case node_cdata:
-		case node_pcdata:
-		case node_comment:
-		case node_doctype:
-			return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs);
+		xml_node_type type_ = _root ? PUGI__NODETYPE(_root) : node_null;
 
-		default:
+		if (type_ != node_pcdata && type_ != node_cdata && type_ != node_comment && type_ != node_pi && type_ != node_doctype)
 			return false;
-		}
+
+		return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs, impl::strlength(rhs));
 	}
 
 	PUGI__FN xml_attribute xml_node::append_attribute(const char_t* name_)
 	{
 		if (!impl::allow_insert_attribute(type())) return xml_attribute();
 		
-		xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_attribute();
+
+		xml_attribute a(impl::allocate_attribute(alloc));
 		if (!a) return xml_attribute();
 
 		impl::append_attribute(a._attr, _root);
@@ -4942,7 +5517,10 @@ namespace pugi
 	{
 		if (!impl::allow_insert_attribute(type())) return xml_attribute();
 		
-		xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_attribute();
+
+		xml_attribute a(impl::allocate_attribute(alloc));
 		if (!a) return xml_attribute();
 
 		impl::prepend_attribute(a._attr, _root);
@@ -4957,7 +5535,10 @@ namespace pugi
 		if (!impl::allow_insert_attribute(type())) return xml_attribute();
 		if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
 		
-		xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_attribute();
+
+		xml_attribute a(impl::allocate_attribute(alloc));
 		if (!a) return xml_attribute();
 
 		impl::insert_attribute_after(a._attr, attr._attr, _root);
@@ -4972,7 +5553,10 @@ namespace pugi
 		if (!impl::allow_insert_attribute(type())) return xml_attribute();
 		if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
 		
-		xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_attribute();
+
+		xml_attribute a(impl::allocate_attribute(alloc));
 		if (!a) return xml_attribute();
 
 		impl::insert_attribute_before(a._attr, attr._attr, _root);
@@ -4985,48 +5569,81 @@ namespace pugi
 	PUGI__FN xml_attribute xml_node::append_copy(const xml_attribute& proto)
 	{
 		if (!proto) return xml_attribute();
+		if (!impl::allow_insert_attribute(type())) return xml_attribute();
 
-		xml_attribute result = append_attribute(proto.name());
-		result.set_value(proto.value());
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_attribute();
 
-		return result;
+		xml_attribute a(impl::allocate_attribute(alloc));
+		if (!a) return xml_attribute();
+
+		impl::append_attribute(a._attr, _root);
+		impl::node_copy_attribute(a._attr, proto._attr);
+
+		return a;
 	}
 
 	PUGI__FN xml_attribute xml_node::prepend_copy(const xml_attribute& proto)
 	{
 		if (!proto) return xml_attribute();
+		if (!impl::allow_insert_attribute(type())) return xml_attribute();
 
-		xml_attribute result = prepend_attribute(proto.name());
-		result.set_value(proto.value());
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_attribute();
 
-		return result;
+		xml_attribute a(impl::allocate_attribute(alloc));
+		if (!a) return xml_attribute();
+
+		impl::prepend_attribute(a._attr, _root);
+		impl::node_copy_attribute(a._attr, proto._attr);
+
+		return a;
 	}
 
 	PUGI__FN xml_attribute xml_node::insert_copy_after(const xml_attribute& proto, const xml_attribute& attr)
 	{
 		if (!proto) return xml_attribute();
+		if (!impl::allow_insert_attribute(type())) return xml_attribute();
+		if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
 
-		xml_attribute result = insert_attribute_after(proto.name(), attr);
-		result.set_value(proto.value());
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_attribute();
 
-		return result;
+		xml_attribute a(impl::allocate_attribute(alloc));
+		if (!a) return xml_attribute();
+
+		impl::insert_attribute_after(a._attr, attr._attr, _root);
+		impl::node_copy_attribute(a._attr, proto._attr);
+
+		return a;
 	}
 
 	PUGI__FN xml_attribute xml_node::insert_copy_before(const xml_attribute& proto, const xml_attribute& attr)
 	{
 		if (!proto) return xml_attribute();
+		if (!impl::allow_insert_attribute(type())) return xml_attribute();
+		if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
 
-		xml_attribute result = insert_attribute_before(proto.name(), attr);
-		result.set_value(proto.value());
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_attribute();
 
-		return result;
+		xml_attribute a(impl::allocate_attribute(alloc));
+		if (!a) return xml_attribute();
+
+		impl::insert_attribute_before(a._attr, attr._attr, _root);
+		impl::node_copy_attribute(a._attr, proto._attr);
+
+		return a;
 	}
 
 	PUGI__FN xml_node xml_node::append_child(xml_node_type type_)
 	{
 		if (!impl::allow_insert_child(type(), type_)) return xml_node();
 		
-		xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
+
+		xml_node n(impl::allocate_node(alloc, type_));
 		if (!n) return xml_node();
 
 		impl::append_node(n._root, _root);
@@ -5039,8 +5656,11 @@ namespace pugi
 	PUGI__FN xml_node xml_node::prepend_child(xml_node_type type_)
 	{
 		if (!impl::allow_insert_child(type(), type_)) return xml_node();
+
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
 		
-		xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
+		xml_node n(impl::allocate_node(alloc, type_));
 		if (!n) return xml_node();
 
 		impl::prepend_node(n._root, _root);
@@ -5054,8 +5674,11 @@ namespace pugi
 	{
 		if (!impl::allow_insert_child(type(), type_)) return xml_node();
 		if (!node._root || node._root->parent != _root) return xml_node();
+
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
 	
-		xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
+		xml_node n(impl::allocate_node(alloc, type_));
 		if (!n) return xml_node();
 
 		impl::insert_node_before(n._root, node._root);
@@ -5069,8 +5692,11 @@ namespace pugi
 	{
 		if (!impl::allow_insert_child(type(), type_)) return xml_node();
 		if (!node._root || node._root->parent != _root) return xml_node();
+
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
 	
-		xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
+		xml_node n(impl::allocate_node(alloc, type_));
 		if (!n) return xml_node();
 
 		impl::insert_node_after(n._root, node._root);
@@ -5121,7 +5747,10 @@ namespace pugi
 		xml_node_type type_ = proto.type();
 		if (!impl::allow_insert_child(type(), type_)) return xml_node();
 
-		xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
+
+		xml_node n(impl::allocate_node(alloc, type_));
 		if (!n) return xml_node();
 
 		impl::append_node(n._root, _root);
@@ -5135,7 +5764,10 @@ namespace pugi
 		xml_node_type type_ = proto.type();
 		if (!impl::allow_insert_child(type(), type_)) return xml_node();
 
-		xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
+
+		xml_node n(impl::allocate_node(alloc, type_));
 		if (!n) return xml_node();
 
 		impl::prepend_node(n._root, _root);
@@ -5150,7 +5782,10 @@ namespace pugi
 		if (!impl::allow_insert_child(type(), type_)) return xml_node();
 		if (!node._root || node._root->parent != _root) return xml_node();
 
-		xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
+
+		xml_node n(impl::allocate_node(alloc, type_));
 		if (!n) return xml_node();
 
 		impl::insert_node_after(n._root, node._root);
@@ -5165,7 +5800,10 @@ namespace pugi
 		if (!impl::allow_insert_child(type(), type_)) return xml_node();
 		if (!node._root || node._root->parent != _root) return xml_node();
 
-		xml_node n(impl::allocate_node(impl::get_allocator(_root), type_));
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
+
+		xml_node n(impl::allocate_node(alloc, type_));
 		if (!n) return xml_node();
 
 		impl::insert_node_before(n._root, node._root);
@@ -5178,6 +5816,9 @@ namespace pugi
 	{
 		if (!impl::allow_move(*this, moved)) return xml_node();
 
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
+
 		// disable document_buffer_order optimization since moving nodes around changes document order without changing buffer pointers
 		impl::get_document(_root).header |= impl::xml_memory_page_contents_shared_mask;
 
@@ -5191,6 +5832,9 @@ namespace pugi
 	{
 		if (!impl::allow_move(*this, moved)) return xml_node();
 
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
+
 		// disable document_buffer_order optimization since moving nodes around changes document order without changing buffer pointers
 		impl::get_document(_root).header |= impl::xml_memory_page_contents_shared_mask;
 
@@ -5206,6 +5850,9 @@ namespace pugi
 		if (!node._root || node._root->parent != _root) return xml_node();
 		if (moved._root == node._root) return xml_node();
 
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
+
 		// disable document_buffer_order optimization since moving nodes around changes document order without changing buffer pointers
 		impl::get_document(_root).header |= impl::xml_memory_page_contents_shared_mask;
 
@@ -5221,6 +5868,9 @@ namespace pugi
 		if (!node._root || node._root->parent != _root) return xml_node();
 		if (moved._root == node._root) return xml_node();
 
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return xml_node();
+
 		// disable document_buffer_order optimization since moving nodes around changes document order without changing buffer pointers
 		impl::get_document(_root).header |= impl::xml_memory_page_contents_shared_mask;
 
@@ -5240,8 +5890,11 @@ namespace pugi
 		if (!_root || !a._attr) return false;
 		if (!impl::is_attribute_of(a._attr, _root)) return false;
 
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return false;
+
 		impl::remove_attribute(a._attr, _root);
-		impl::destroy_attribute(a._attr, impl::get_allocator(_root));
+		impl::destroy_attribute(a._attr, alloc);
 
 		return true;
 	}
@@ -5255,8 +5908,11 @@ namespace pugi
 	{
 		if (!_root || !n._root || n._root->parent != _root) return false;
 
+		impl::xml_allocator& alloc = impl::get_allocator(_root);
+		if (!alloc.reserve()) return false;
+
 		impl::remove_node(n._root);
-		impl::destroy_node(n._root, impl::get_allocator(_root));
+		impl::destroy_node(n._root, alloc);
 
 		return true;
 	}
@@ -5279,23 +5935,15 @@ namespace pugi
 
 		if (!extra) return impl::make_parse_result(status_out_of_memory);
 
-		// save name; name of the root has to be NULL before parsing - otherwise closing node mismatches will not be detected at the top level
-		char_t* rootname = _root->name;
-		_root->name = 0;
-
-		// parse
-		char_t* buffer = 0;
-		xml_parse_result res = impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &buffer);
-
-		// restore name
-		_root->name = rootname;
-
 		// add extra buffer to the list
-		extra->buffer = buffer;
+		extra->buffer = 0;
 		extra->next = doc->extra_buffers;
 		doc->extra_buffers = extra;
 
-		return res;
+		// name of the root has to be NULL before parsing - otherwise closing node mismatches will not be detected at the top level
+		impl::name_null_sentry sentry(_root);
+
+		return impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &extra->buffer);
 	}
 
 	PUGI__FN xml_node xml_node::find_child_by_attribute(const char_t* name_, const char_t* attr_name, const char_t* attr_value) const
@@ -5306,7 +5954,7 @@ namespace pugi
 			if (i->name && impl::strequal(name_, i->name))
 			{
 				for (xml_attribute_struct* a = i->first_attribute; a; a = a->next_attribute)
-					if (a->name && impl::strequal(attr_name, a->name) && impl::strequal(attr_value, a->value ? a->value : PUGIXML_TEXT("")))
+					if (a->name && impl::strequal(attr_name, a->name) && impl::strequal(attr_value, a->value ? a->value + 0 : PUGIXML_TEXT("")))
 						return xml_node(i);
 			}
 
@@ -5319,7 +5967,7 @@ namespace pugi
 		
 		for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling)
 			for (xml_attribute_struct* a = i->first_attribute; a; a = a->next_attribute)
-				if (a->name && impl::strequal(attr_name, a->name) && impl::strequal(attr_value, a->value ? a->value : PUGIXML_TEXT("")))
+				if (a->name && impl::strequal(attr_name, a->name) && impl::strequal(attr_value, a->value ? a->value + 0 : PUGIXML_TEXT("")))
 					return xml_node(i);
 
 		return xml_node();
@@ -5328,20 +5976,35 @@ namespace pugi
 #ifndef PUGIXML_NO_STL
 	PUGI__FN string_t xml_node::path(char_t delimiter) const
 	{
-		xml_node cursor = *this; // Make a copy.
-		
-		string_t result = cursor.name();
+		if (!_root) return string_t();
+
+		size_t offset = 0;
 
-		while (cursor.parent())
+		for (xml_node_struct* i = _root; i; i = i->parent)
 		{
-			cursor = cursor.parent();
-			
-			string_t temp = cursor.name();
-			temp += delimiter;
-			temp += result;
-			result.swap(temp);
+			offset += (i != _root);
+			offset += i->name ? impl::strlength(i->name) : 0;
+		}
+
+		string_t result;
+		result.resize(offset);
+
+		for (xml_node_struct* j = _root; j; j = j->parent)
+		{
+			if (j != _root)
+				result[--offset] = delimiter;
+
+			if (j->name && *j->name)
+			{
+				size_t length = impl::strlength(j->name);
+
+				offset -= length;
+				memcpy(&result[offset], j->name, length * sizeof(char_t));
+			}
 		}
 
+		assert(offset == 0);
+
 		return result;
 	}
 #endif
@@ -5458,6 +6121,8 @@ namespace pugi
 		impl::xml_buffered_writer buffered_writer(writer, encoding);
 
 		impl::node_output(buffered_writer, _root, indent, flags, depth);
+
+		buffered_writer.flush();
 	}
 
 #ifndef PUGIXML_NO_STL
@@ -5568,49 +6233,49 @@ namespace pugi
 	{
 		xml_node_struct* d = _data();
 
-		return (d && d->value) ? d->value : PUGIXML_TEXT("");
+		return (d && d->value) ? d->value + 0 : PUGIXML_TEXT("");
 	}
 
 	PUGI__FN const char_t* xml_text::as_string(const char_t* def) const
 	{
 		xml_node_struct* d = _data();
 
-		return (d && d->value) ? d->value : def;
+		return (d && d->value) ? d->value + 0 : def;
 	}
 
 	PUGI__FN int xml_text::as_int(int def) const
 	{
 		xml_node_struct* d = _data();
 
-		return impl::get_value_int(d ? d->value : 0, def);
+		return (d && d->value) ? impl::get_value_int(d->value) : def;
 	}
 
 	PUGI__FN unsigned int xml_text::as_uint(unsigned int def) const
 	{
 		xml_node_struct* d = _data();
 
-		return impl::get_value_uint(d ? d->value : 0, def);
+		return (d && d->value) ? impl::get_value_uint(d->value) : def;
 	}
 
 	PUGI__FN double xml_text::as_double(double def) const
 	{
 		xml_node_struct* d = _data();
 
-		return impl::get_value_double(d ? d->value : 0, def);
+		return (d && d->value) ? impl::get_value_double(d->value) : def;
 	}
 
 	PUGI__FN float xml_text::as_float(float def) const
 	{
 		xml_node_struct* d = _data();
 
-		return impl::get_value_float(d ? d->value : 0, def);
+		return (d && d->value) ? impl::get_value_float(d->value) : def;
 	}
 
 	PUGI__FN bool xml_text::as_bool(bool def) const
 	{
 		xml_node_struct* d = _data();
 
-		return impl::get_value_bool(d ? d->value : 0, def);
+		return (d && d->value) ? impl::get_value_bool(d->value) : def;
 	}
 
 #ifdef PUGIXML_HAS_LONG_LONG
@@ -5618,14 +6283,14 @@ namespace pugi
 	{
 		xml_node_struct* d = _data();
 
-		return impl::get_value_llong(d ? d->value : 0, def);
+		return (d && d->value) ? impl::get_value_llong(d->value) : def;
 	}
 
 	PUGI__FN unsigned long long xml_text::as_ullong(unsigned long long def) const
 	{
 		xml_node_struct* d = _data();
 
-		return impl::get_value_ullong(d ? d->value : 0, def);
+		return (d && d->value) ? impl::get_value_ullong(d->value) : def;
 	}
 #endif
 
@@ -5633,7 +6298,7 @@ namespace pugi
 	{
 		xml_node_struct* dn = _data_new();
 
-		return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs) : false;
+		return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs, impl::strlength(rhs)) : false;
 	}
 
 	PUGI__FN bool xml_text::set(int rhs)
@@ -6014,8 +6679,14 @@ namespace pugi
 	{
 		assert(!_root);
 
+	#ifdef PUGIXML_COMPACT
+		const size_t page_offset = sizeof(uint32_t);
+	#else
+		const size_t page_offset = 0;
+	#endif
+
 		// initialize sentinel page
-		PUGI__STATIC_ASSERT(sizeof(impl::xml_memory_page) + sizeof(impl::xml_document_struct) + impl::xml_memory_page_alignment - sizeof(void*) <= sizeof(_memory));
+		PUGI__STATIC_ASSERT(sizeof(impl::xml_memory_page) + sizeof(impl::xml_document_struct) + impl::xml_memory_page_alignment - sizeof(void*) + page_offset <= sizeof(_memory));
 
 		// align upwards to page boundary
 		void* page_memory = reinterpret_cast<void*>((reinterpret_cast<uintptr_t>(_memory) + (impl::xml_memory_page_alignment - 1)) & ~(impl::xml_memory_page_alignment - 1));
@@ -6026,8 +6697,15 @@ namespace pugi
 
 		page->busy_size = impl::xml_memory_page_size;
 
+		// setup first page marker
+	#ifdef PUGIXML_COMPACT
+		// round-trip through void* to avoid 'cast increases required alignment of target type' warning
+		page->compact_page_marker = reinterpret_cast<uint32_t*>(static_cast<void*>(reinterpret_cast<char*>(page) + sizeof(impl::xml_memory_page)));
+		*page->compact_page_marker = sizeof(impl::xml_memory_page);
+	#endif
+
 		// allocate new root
-		_root = new (reinterpret_cast<char*>(page) + sizeof(impl::xml_memory_page)) impl::xml_document_struct(page);
+		_root = new (reinterpret_cast<char*>(page) + sizeof(impl::xml_memory_page) + page_offset) impl::xml_document_struct(page);
 		_root->prev_sibling_c = _root;
 
 		// setup sentinel page
@@ -6055,7 +6733,7 @@ namespace pugi
 		}
 
 		// destroy dynamic storage, leave sentinel page (it's in static memory)
-		impl::xml_memory_page* root_page = reinterpret_cast<impl::xml_memory_page*>(_root->header & impl::xml_memory_page_pointer_mask);
+		impl::xml_memory_page* root_page = PUGI__GETPAGE(_root);
 		assert(root_page && !root_page->prev);
 		assert(reinterpret_cast<char*>(root_page) >= _memory && reinterpret_cast<char*>(root_page) < _memory + sizeof(_memory));
 
@@ -6068,6 +6746,11 @@ namespace pugi
 			page = next;
 		}
 
+	#ifdef PUGIXML_COMPACT
+		// destroy hash table
+		static_cast<impl::xml_document_struct*>(_root)->hash.clear();
+	#endif
+
 		_root = 0;
 	}
 
@@ -6076,14 +6759,14 @@ namespace pugi
 	{
 		reset();
 
-		return impl::load_stream_impl(*this, stream, options, encoding);
+		return impl::load_stream_impl(static_cast<impl::xml_document_struct*>(_root), stream, options, encoding, &_buffer);
 	}
 
 	PUGI__FN xml_parse_result xml_document::load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options)
 	{
 		reset();
 
-		return impl::load_stream_impl(*this, stream, options, encoding_wchar);
+		return impl::load_stream_impl(static_cast<impl::xml_document_struct*>(_root), stream, options, encoding_wchar, &_buffer);
 	}
 #endif
 
@@ -6108,18 +6791,20 @@ namespace pugi
 	{
 		reset();
 
-		FILE* file = fopen(path_, "rb");
+		using impl::auto_deleter; // MSVC7 workaround
+		auto_deleter<FILE, int(*)(FILE*)> file(fopen(path_, "rb"), fclose);
 
-		return impl::load_file_impl(*this, file, options, encoding);
+		return impl::load_file_impl(static_cast<impl::xml_document_struct*>(_root), file.data, options, encoding, &_buffer);
 	}
 
 	PUGI__FN xml_parse_result xml_document::load_file(const wchar_t* path_, unsigned int options, xml_encoding encoding)
 	{
 		reset();
 
-		FILE* file = impl::open_file_wide(path_, L"rb");
+		using impl::auto_deleter; // MSVC7 workaround
+		auto_deleter<FILE, int(*)(FILE*)> file(impl::open_file_wide(path_, L"rb"), fclose);
 
-		return impl::load_file_impl(*this, file, options, encoding);
+		return impl::load_file_impl(static_cast<impl::xml_document_struct*>(_root), file.data, options, encoding, &_buffer);
 	}
 
 	PUGI__FN xml_parse_result xml_document::load_buffer(const void* contents, size_t size, unsigned int options, xml_encoding encoding)
@@ -6167,6 +6852,8 @@ namespace pugi
 		}
 
 		impl::node_output(buffered_writer, _root, indent, flags, 0);
+
+		buffered_writer.flush();
 	}
 
 #ifndef PUGIXML_NO_STL
@@ -6187,14 +6874,18 @@ namespace pugi
 
 	PUGI__FN bool xml_document::save_file(const char* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const
 	{
-		FILE* file = fopen(path_, (flags & format_save_file_text) ? "w" : "wb");
-		return impl::save_file_impl(*this, file, indent, flags, encoding);
+		using impl::auto_deleter; // MSVC7 workaround
+		auto_deleter<FILE, int(*)(FILE*)> file(fopen(path_, (flags & format_save_file_text) ? "w" : "wb"), fclose);
+
+		return impl::save_file_impl(*this, file.data, indent, flags, encoding);
 	}
 
 	PUGI__FN bool xml_document::save_file(const wchar_t* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const
 	{
-		FILE* file = impl::open_file_wide(path_, (flags & format_save_file_text) ? L"w" : L"wb");
-		return impl::save_file_impl(*this, file, indent, flags, encoding);
+		using impl::auto_deleter; // MSVC7 workaround
+		auto_deleter<FILE, int(*)(FILE*)> file(impl::open_file_wide(path_, (flags & format_save_file_text) ? L"w" : L"wb"), fclose);
+
+		return impl::save_file_impl(*this, file.data, indent, flags, encoding);
 	}
 
 	PUGI__FN xml_node xml_document::document_element() const
@@ -6523,18 +7214,26 @@ PUGI__NS_END
 
 // Allocator used for AST and evaluation stacks
 PUGI__NS_BEGIN
+	static const size_t xpath_memory_page_size =
+	#ifdef PUGIXML_MEMORY_XPATH_PAGE_SIZE
+		PUGIXML_MEMORY_XPATH_PAGE_SIZE
+	#else
+		4096
+	#endif
+		;
+
+	static const uintptr_t xpath_memory_block_alignment = sizeof(double) > sizeof(void*) ? sizeof(double) : sizeof(void*);
+
 	struct xpath_memory_block
 	{	
 		xpath_memory_block* next;
 		size_t capacity;
 
-		char data[
-	#ifdef PUGIXML_MEMORY_XPATH_PAGE_SIZE
-			PUGIXML_MEMORY_XPATH_PAGE_SIZE
-	#else
-			4096
-	#endif
-		];
+		union
+		{
+			char data[xpath_memory_page_size];
+			double alignment;
+		};
 	};
 		
 	class xpath_allocator
@@ -6556,12 +7255,12 @@ PUGI__NS_BEGIN
 		
 		void* allocate_nothrow(size_t size)
 		{
-			// align size so that we're able to store pointers in subsequent blocks
-			size = (size + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
+			// round size up to block alignment boundary
+			size = (size + xpath_memory_block_alignment - 1) & ~(xpath_memory_block_alignment - 1);
 
 			if (_root_size + size <= _root->capacity)
 			{
-				void* buf = _root->data + _root_size;
+				void* buf = &_root->data[0] + _root_size;
 				_root_size += size;
 				return buf;
 			}
@@ -6606,12 +7305,12 @@ PUGI__NS_BEGIN
 
 		void* reallocate(void* ptr, size_t old_size, size_t new_size)
 		{
-			// align size so that we're able to store pointers in subsequent blocks
-			old_size = (old_size + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
-			new_size = (new_size + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
+			// round size up to block alignment boundary
+			old_size = (old_size + xpath_memory_block_alignment - 1) & ~(xpath_memory_block_alignment - 1);
+			new_size = (new_size + xpath_memory_block_alignment - 1) & ~(xpath_memory_block_alignment - 1);
 
 			// we can only reallocate the last object
-			assert(ptr == 0 || static_cast<char*>(ptr) + old_size == _root->data + _root_size);
+			assert(ptr == 0 || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size);
 
 			// adjust root size so that we have not allocated the object at all
 			bool only_object = (_root_size == old_size);
@@ -7346,7 +8045,7 @@ PUGI__NS_BEGIN
 	#ifdef PUGIXML_WCHAR_MODE
 		return wcstod(string, 0);
 	#else
-		return atof(string);
+		return strtod(string, 0);
 	#endif
 	}
 
@@ -7587,7 +8286,7 @@ PUGI__NS_BEGIN
 
 	struct xpath_variable_boolean: xpath_variable
 	{
-		xpath_variable_boolean(): value(false)
+		xpath_variable_boolean(): xpath_variable(xpath_type_boolean), value(false)
 		{
 		}
 
@@ -7597,7 +8296,7 @@ PUGI__NS_BEGIN
 
 	struct xpath_variable_number: xpath_variable
 	{
-		xpath_variable_number(): value(0)
+		xpath_variable_number(): xpath_variable(xpath_type_number), value(0)
 		{
 		}
 
@@ -7607,7 +8306,7 @@ PUGI__NS_BEGIN
 
 	struct xpath_variable_string: xpath_variable
 	{
-		xpath_variable_string(): value(0)
+		xpath_variable_string(): xpath_variable(xpath_type_string), value(0)
 		{
 		}
 
@@ -7622,6 +8321,10 @@ PUGI__NS_BEGIN
 
 	struct xpath_variable_node_set: xpath_variable
 	{
+		xpath_variable_node_set(): xpath_variable(xpath_type_node_set)
+		{
+		}
+
 		xpath_node_set value;
 		char_t name[1];
 	};
@@ -7715,7 +8418,29 @@ PUGI__NS_BEGIN
 		}
 	}
 
-	PUGI__FN xpath_variable* get_variable_scratch(char_t (&buffer)[32], xpath_variable_set* set, const char_t* begin, const char_t* end)
+	PUGI__FN bool copy_xpath_variable(xpath_variable* lhs, const xpath_variable* rhs)
+	{
+		switch (rhs->type())
+		{
+		case xpath_type_node_set:
+			return lhs->set(static_cast<const xpath_variable_node_set*>(rhs)->value);
+
+		case xpath_type_number:
+			return lhs->set(static_cast<const xpath_variable_number*>(rhs)->value);
+
+		case xpath_type_string:
+			return lhs->set(static_cast<const xpath_variable_string*>(rhs)->value);
+
+		case xpath_type_boolean:
+			return lhs->set(static_cast<const xpath_variable_boolean*>(rhs)->value);
+
+		default:
+			assert(!"Invalid variable type");
+			return false;
+		}
+	}
+
+	PUGI__FN bool get_variable_scratch(char_t (&buffer)[32], xpath_variable_set* set, const char_t* begin, const char_t* end, xpath_variable** out_result)
 	{
 		size_t length = static_cast<size_t>(end - begin);
 		char_t* scratch = buffer;
@@ -7724,19 +8449,19 @@ PUGI__NS_BEGIN
 		{
 			// need to make dummy on-heap copy
 			scratch = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
-			if (!scratch) return 0;
+			if (!scratch) return false;
 		}
 
 		// copy string to zero-terminated buffer and perform lookup
 		memcpy(scratch, begin, length * sizeof(char_t));
 		scratch[length] = 0;
 
-		xpath_variable* result = set->get(scratch);
+		*out_result = set->get(scratch);
 
 		// free dummy buffer
 		if (scratch != buffer) xml_memory::deallocate(scratch);
 
-		return result;
+		return true;
 	}
 PUGI__NS_END
 
@@ -8715,7 +9440,7 @@ PUGI__NS_BEGIN
 		{
 			assert(a);
 
-			const char_t* name = a->name ? a->name : PUGIXML_TEXT("");
+			const char_t* name = a->name ? a->name + 0 : PUGIXML_TEXT("");
 
 			switch (_test)
 			{
@@ -9898,6 +10623,11 @@ PUGI__NS_BEGIN
 			if (_right) _right->optimize(alloc);
 			if (_next) _next->optimize(alloc);
 
+			optimize_self(alloc);
+		}
+
+		void optimize_self(xpath_allocator* alloc)
+		{
 			// Rewrite [position()=expr] with [expr]
 			// Note that this step has to go before classification to recognize [position()=1]
 			if ((_type == ast_filter || _type == ast_predicate) &&
@@ -10309,7 +11039,9 @@ PUGI__NS_BEGIN
 				if (!_variables)
 					throw_error("Unknown variable: variable set is not provided");
 
-				xpath_variable* var = get_variable_scratch(_scratch, _variables, name.begin, name.end);
+				xpath_variable* var = 0;
+				if (!get_variable_scratch(_scratch, _variables, name.begin, name.end, &var))
+					throw_error_oom();
 
 				if (!var)
 					throw_error("Unknown variable: variable set does not contain the given name");
@@ -10845,19 +11577,18 @@ PUGI__NS_BEGIN
 		static xpath_query_impl* create()
 		{
 			void* memory = xml_memory::allocate(sizeof(xpath_query_impl));
+			if (!memory) return 0;
 
 			return new (memory) xpath_query_impl();
 		}
 
-		static void destroy(void* ptr)
+		static void destroy(xpath_query_impl* impl)
 		{
-			if (!ptr) return;
-			
 			// free all allocated pages
-			static_cast<xpath_query_impl*>(ptr)->alloc.release();
+			impl->alloc.release();
 
 			// free allocator memory (with the first page)
-			xml_memory::deallocate(ptr);
+			xml_memory::deallocate(impl);
 		}
 
 		xpath_query_impl(): root(0), alloc(&block)
@@ -10986,7 +11717,7 @@ namespace pugi
 	}
 #endif
 
-	PUGI__FN void xpath_node_set::_assign(const_iterator begin_, const_iterator end_)
+	PUGI__FN void xpath_node_set::_assign(const_iterator begin_, const_iterator end_, type_t type_)
 	{
 		assert(begin_ <= end_);
 
@@ -11002,6 +11733,7 @@ namespace pugi
 
 			_begin = &_storage;
 			_end = &_storage + size_;
+			_type = type_;
 		}
 		else
 		{
@@ -11025,37 +11757,71 @@ namespace pugi
 			// finalize
 			_begin = storage;
 			_end = storage + size_;
+			_type = type_;
 		}
 	}
 
+#if __cplusplus >= 201103
+	PUGI__FN void xpath_node_set::_move(xpath_node_set& rhs)
+	{
+		_type = rhs._type;
+		_storage = rhs._storage;
+		_begin = (rhs._begin == &rhs._storage) ? &_storage : rhs._begin;
+		_end = _begin + (rhs._end - rhs._begin);
+
+		rhs._type = type_unsorted;
+		rhs._begin = &rhs._storage;
+		rhs._end = rhs._begin;
+	}
+#endif
+
 	PUGI__FN xpath_node_set::xpath_node_set(): _type(type_unsorted), _begin(&_storage), _end(&_storage)
 	{
 	}
 
-	PUGI__FN xpath_node_set::xpath_node_set(const_iterator begin_, const_iterator end_, type_t type_): _type(type_), _begin(&_storage), _end(&_storage)
+	PUGI__FN xpath_node_set::xpath_node_set(const_iterator begin_, const_iterator end_, type_t type_): _type(type_unsorted), _begin(&_storage), _end(&_storage)
 	{
-		_assign(begin_, end_);
+		_assign(begin_, end_, type_);
 	}
 
 	PUGI__FN xpath_node_set::~xpath_node_set()
 	{
-		if (_begin != &_storage) impl::xml_memory::deallocate(_begin);
+		if (_begin != &_storage)
+			impl::xml_memory::deallocate(_begin);
 	}
 		
-	PUGI__FN xpath_node_set::xpath_node_set(const xpath_node_set& ns): _type(ns._type), _begin(&_storage), _end(&_storage)
+	PUGI__FN xpath_node_set::xpath_node_set(const xpath_node_set& ns): _type(type_unsorted), _begin(&_storage), _end(&_storage)
 	{
-		_assign(ns._begin, ns._end);
+		_assign(ns._begin, ns._end, ns._type);
 	}
 	
 	PUGI__FN xpath_node_set& xpath_node_set::operator=(const xpath_node_set& ns)
 	{
 		if (this == &ns) return *this;
-		
-		_type = ns._type;
-		_assign(ns._begin, ns._end);
+
+		_assign(ns._begin, ns._end, ns._type);
+
+		return *this;
+	}
+
+#if __cplusplus >= 201103
+	PUGI__FN xpath_node_set::xpath_node_set(xpath_node_set&& rhs): _type(type_unsorted), _begin(&_storage), _end(&_storage)
+	{
+		_move(rhs);
+	}
+
+	PUGI__FN xpath_node_set& xpath_node_set::operator=(xpath_node_set&& rhs)
+	{
+		if (this == &rhs) return *this;
+
+		if (_begin != &_storage)
+			impl::xml_memory::deallocate(_begin);
+
+		_move(rhs);
 
 		return *this;
 	}
+#endif
 
 	PUGI__FN xpath_node_set::type_t xpath_node_set::type() const
 	{
@@ -11112,7 +11878,7 @@ namespace pugi
 		return error ? error : "No error";
 	}
 
-	PUGI__FN xpath_variable::xpath_variable(): _type(xpath_type_none), _next(0)
+	PUGI__FN xpath_variable::xpath_variable(xpath_value_type type_): _type(type_), _next(0)
 	{
 	}
 
@@ -11211,27 +11977,80 @@ namespace pugi
 
 	PUGI__FN xpath_variable_set::xpath_variable_set()
 	{
-		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i) _data[i] = 0;
+		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
+			_data[i] = 0;
 	}
 
 	PUGI__FN xpath_variable_set::~xpath_variable_set()
 	{
 		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
+			_destroy(_data[i]);
+	}
+
+	PUGI__FN xpath_variable_set::xpath_variable_set(const xpath_variable_set& rhs)
+	{
+		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
+			_data[i] = 0;
+
+		_assign(rhs);
+	}
+
+	PUGI__FN xpath_variable_set& xpath_variable_set::operator=(const xpath_variable_set& rhs)
+	{
+		if (this == &rhs) return *this;
+
+		_assign(rhs);
+
+		return *this;
+	}
+
+#if __cplusplus >= 201103
+	PUGI__FN xpath_variable_set::xpath_variable_set(xpath_variable_set&& rhs)
+	{
+		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
 		{
-			xpath_variable* var = _data[i];
+			_data[i] = rhs._data[i];
+			rhs._data[i] = 0;
+		}
+	}
 
-			while (var)
-			{
-				xpath_variable* next = var->_next;
+	PUGI__FN xpath_variable_set& xpath_variable_set::operator=(xpath_variable_set&& rhs)
+	{
+		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
+		{
+			_destroy(_data[i]);
 
-				impl::delete_xpath_variable(var->_type, var);
+			_data[i] = rhs._data[i];
+			rhs._data[i] = 0;
+		}
 
-				var = next;
-			}
+		return *this;
+	}
+#endif
+
+	PUGI__FN void xpath_variable_set::_assign(const xpath_variable_set& rhs)
+	{
+		xpath_variable_set temp;
+
+		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
+			if (rhs._data[i] && !_clone(rhs._data[i], &temp._data[i]))
+				return;
+
+		_swap(temp);
+	}
+
+	PUGI__FN void xpath_variable_set::_swap(xpath_variable_set& rhs)
+	{
+		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i)
+		{
+			xpath_variable* chain = _data[i];
+
+			_data[i] = rhs._data[i];
+			rhs._data[i] = chain;
 		}
 	}
 
-	PUGI__FN xpath_variable* xpath_variable_set::find(const char_t* name) const
+	PUGI__FN xpath_variable* xpath_variable_set::_find(const char_t* name) const
 	{
 		const size_t hash_size = sizeof(_data) / sizeof(_data[0]);
 		size_t hash = impl::hash_string(name) % hash_size;
@@ -11244,6 +12063,45 @@ namespace pugi
 		return 0;
 	}
 
+	PUGI__FN bool xpath_variable_set::_clone(xpath_variable* var, xpath_variable** out_result)
+	{
+		xpath_variable* last = 0;
+
+		while (var)
+		{
+			// allocate storage for new variable
+			xpath_variable* nvar = impl::new_xpath_variable(var->_type, var->name());
+			if (!nvar) return false;
+
+			// link the variable to the result immediately to handle failures gracefully
+			if (last)
+				last->_next = nvar;
+			else
+				*out_result = nvar;
+
+			last = nvar;
+
+			// copy the value; this can fail due to out-of-memory conditions
+			if (!impl::copy_xpath_variable(nvar, var)) return false;
+
+			var = var->_next;
+		}
+
+		return true;
+	}
+
+	PUGI__FN void xpath_variable_set::_destroy(xpath_variable* var)
+	{
+		while (var)
+		{
+			xpath_variable* next = var->_next;
+
+			impl::delete_xpath_variable(var->_type, var);
+
+			var = next;
+		}
+	}
+
 	PUGI__FN xpath_variable* xpath_variable_set::add(const char_t* name, xpath_value_type type)
 	{
 		const size_t hash_size = sizeof(_data) / sizeof(_data[0]);
@@ -11259,7 +12117,6 @@ namespace pugi
 
 		if (result)
 		{
-			result->_type = type;
 			result->_next = _data[hash];
 
 			_data[hash] = result;
@@ -11294,12 +12151,12 @@ namespace pugi
 
 	PUGI__FN xpath_variable* xpath_variable_set::get(const char_t* name)
 	{
-		return find(name);
+		return _find(name);
 	}
 
 	PUGI__FN const xpath_variable* xpath_variable_set::get(const char_t* name) const
 	{
-		return find(name);
+		return _find(name);
 	}
 
 	PUGI__FN xpath_query::xpath_query(const char_t* query, xpath_variable_set* variables): _impl(0)
@@ -11316,7 +12173,8 @@ namespace pugi
 		}
 		else
 		{
-			impl::buffer_holder impl_holder(qimpl, impl::xpath_query_impl::destroy);
+			using impl::auto_deleter; // MSVC7 workaround
+			auto_deleter<impl::xpath_query_impl> impl(qimpl, impl::xpath_query_impl::destroy);
 
 			qimpl->root = impl::xpath_parser::parse(query, variables, &qimpl->alloc, &_result);
 
@@ -11324,17 +12182,47 @@ namespace pugi
 			{
 				qimpl->root->optimize(&qimpl->alloc);
 
-				_impl = static_cast<impl::xpath_query_impl*>(impl_holder.release());
+				_impl = impl.release();
 				_result.error = 0;
 			}
 		}
 	}
 
+	PUGI__FN xpath_query::xpath_query(): _impl(0)
+	{
+	}
+
 	PUGI__FN xpath_query::~xpath_query()
 	{
-		impl::xpath_query_impl::destroy(_impl);
+		if (_impl)
+			impl::xpath_query_impl::destroy(static_cast<impl::xpath_query_impl*>(_impl));
+	}
+
+#if __cplusplus >= 201103
+	PUGI__FN xpath_query::xpath_query(xpath_query&& rhs)
+	{
+		_impl = rhs._impl;
+		_result = rhs._result;
+		rhs._impl = 0;
+		rhs._result = xpath_parse_result();
 	}
 
+	PUGI__FN xpath_query& xpath_query::operator=(xpath_query&& rhs)
+	{
+		if (this == &rhs) return *this;
+
+		if (_impl)
+			impl::xpath_query_impl::destroy(static_cast<impl::xpath_query_impl*>(_impl));
+
+		_impl = rhs._impl;
+		_result = rhs._result;
+		rhs._impl = 0;
+		rhs._result = xpath_parse_result();
+
+		return *this;
+	}
+#endif
+
 	PUGI__FN xpath_value_type xpath_query::return_type() const
 	{
 		if (!_impl) return xpath_type_none;
@@ -11510,6 +12398,8 @@ namespace pugi
 #undef PUGI__NS_END
 #undef PUGI__FN
 #undef PUGI__FN_NO_INLINE
+#undef PUGI__GETPAGE_IMPL
+#undef PUGI__GETPAGE
 #undef PUGI__NODETYPE
 #undef PUGI__IS_CHARTYPE_IMPL
 #undef PUGI__IS_CHARTYPE
diff --git a/dolfin/io/pugixml.hpp b/dolfin/io/pugixml.hpp
index d59f864..9f7c3fb 100644
--- a/dolfin/io/pugixml.hpp
+++ b/dolfin/io/pugixml.hpp
@@ -1,5 +1,5 @@
 /**
- * pugixml parser - version 1.6
+ * pugixml parser - version 1.7
  * --------------------------------------------------------
  * Copyright (C) 2006-2015, by Arseny Kapoulkine (arseny.kapoulkine at gmail.com)
  * Report bugs and download new versions at http://pugixml.org/
@@ -13,7 +13,7 @@
 
 #ifndef PUGIXML_VERSION
 // Define version macro; evaluates to major * 100 + minor so that it's safe to use in less-than comparisons
-#	define PUGIXML_VERSION 160
+#	define PUGIXML_VERSION 170
 #endif
 
 // Include user configuration file (this can define various configuration macros)
@@ -65,7 +65,7 @@
 
 // If the platform is known to have long long support, enable long long functions
 #ifndef PUGIXML_HAS_LONG_LONG
-#	if defined(__cplusplus) && __cplusplus >= 201103
+#	if __cplusplus >= 201103
 #		define PUGIXML_HAS_LONG_LONG
 #	elif defined(_MSC_VER) && _MSC_VER >= 1400
 #		define PUGIXML_HAS_LONG_LONG
@@ -203,10 +203,13 @@ namespace pugi
 	// Open file using text mode in xml_document::save_file. This enables special character (i.e. new-line) conversions on some systems. This flag is off by default.
 	const unsigned int format_save_file_text = 0x20;
 
+	// Write every attribute on a new line with appropriate indentation. This flag is off by default.
+	const unsigned int format_indent_attributes = 0x40;
+
 	// The default set of formatting flags.
 	// Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
 	const unsigned int format_default = format_indent;
-		
+
 	// Forward declarations
 	struct xml_attribute_struct;
 	struct xml_node_struct;
@@ -463,6 +466,9 @@ namespace pugi
 		xml_node next_sibling(const char_t* name) const;
 		xml_node previous_sibling(const char_t* name) const;
 
+		// Get attribute, starting the search from a hint (and updating hint so that searching for a sequence of attributes is fast)
+		xml_attribute attribute(const char_t* name, xml_attribute& hint) const;
+
 		// Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
 		const char_t* child_value() const;
 
@@ -939,7 +945,7 @@ namespace pugi
 		
 		// Non-copyable semantics
 		xml_document(const xml_document&);
-		const xml_document& operator=(const xml_document&);
+		xml_document& operator=(const xml_document&);
 
 		void create();
 		void destroy();
@@ -1040,7 +1046,7 @@ namespace pugi
 		xpath_value_type _type;
 		xpath_variable* _next;
 
-		xpath_variable();
+		xpath_variable(xpath_value_type type);
 
 		// Non-copyable semantics
 		xpath_variable(const xpath_variable&);
@@ -1072,17 +1078,29 @@ namespace pugi
 	private:
 		xpath_variable* _data[64];
 
-		// Non-copyable semantics
-		xpath_variable_set(const xpath_variable_set&);
-		xpath_variable_set& operator=(const xpath_variable_set&);
+		void _assign(const xpath_variable_set& rhs);
+		void _swap(xpath_variable_set& rhs);
+
+		xpath_variable* _find(const char_t* name) const;
 
-		xpath_variable* find(const char_t* name) const;
+		static bool _clone(xpath_variable* var, xpath_variable** out_result);
+		static void _destroy(xpath_variable* var);
 
 	public:
 		// Default constructor/destructor
 		xpath_variable_set();
 		~xpath_variable_set();
 
+		// Copy constructor/assignment operator
+		xpath_variable_set(const xpath_variable_set& rhs);
+		xpath_variable_set& operator=(const xpath_variable_set& rhs);
+
+	#if __cplusplus >= 201103
+		// Move semantics support
+		xpath_variable_set(xpath_variable_set&& rhs);
+		xpath_variable_set& operator=(xpath_variable_set&& rhs);
+	#endif
+
 		// Add a new variable or get the existing one, if the types match
 		xpath_variable* add(const char_t* name, xpath_value_type type);
 
@@ -1115,9 +1133,18 @@ namespace pugi
 		// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
 		explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
 
+		// Constructor
+		xpath_query();
+
 		// Destructor
 		~xpath_query();
 
+	#if __cplusplus >= 201103
+		// Move semantics support
+		xpath_query(xpath_query&& rhs);
+		xpath_query& operator=(xpath_query&& rhs);
+	#endif
+
 		// Get query expression return type
 		xpath_value_type return_type() const;
 		
@@ -1253,6 +1280,12 @@ namespace pugi
 		xpath_node_set(const xpath_node_set& ns);
 		xpath_node_set& operator=(const xpath_node_set& ns);
 
+	#if __cplusplus >= 201103
+		// Move semantics support
+		xpath_node_set(xpath_node_set&& rhs);
+		xpath_node_set& operator=(xpath_node_set&& rhs);
+	#endif
+
 		// Get collection type
 		type_t type() const;
 		
@@ -1283,7 +1316,8 @@ namespace pugi
 		xpath_node* _begin;
 		xpath_node* _end;
 
-		void _assign(const_iterator begin, const_iterator end);
+		void _assign(const_iterator begin, const_iterator end, type_t type);
+		void _move(xpath_node_set& rhs);
 	};
 #endif
 
diff --git a/dolfin/io/xmlutils.cpp b/dolfin/io/xmlutils.cpp
index 1c9d52b..e523945 100644
--- a/dolfin/io/xmlutils.cpp
+++ b/dolfin/io/xmlutils.cpp
@@ -18,14 +18,15 @@
 // First added:  2011-09-15
 // Last changed: 2011-11-15
 
+#include "pugixml.hpp"
 #include <dolfin/log/log.h>
 #include "xmlutils.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-const pugi::xml_node
-  dolfin::get_node(const pugi::xml_node& xml_node, std::string node_name)
+const pugi::xml_node xmlutils::get_node(const pugi::xml_node& xml_node,
+                                        std::string node_name)
 {
   // Check node itself
   if (xml_node.name() == node_name)
@@ -39,6 +40,34 @@ const pugi::xml_node
                  "read DOLFIN XML data",
                  "Unable to find tag <%s>", node_name.c_str());
   }
+
   return child_node;
 }
 //-----------------------------------------------------------------------------
+void xmlutils::check_node_name(const pugi::xml_node& xml_node,
+                               const std::string name)
+{
+  if (xml_node.name() != name)
+  {
+    dolfin_error("xmlutils.cpp",
+                 "checking XML node name",
+                 "Node name is \"%s\", expecting \"%s\"",
+                  xml_node.name(), name.c_str());
+
+  }
+}
+//-----------------------------------------------------------------------------
+void xmlutils::check_has_attribute(const pugi::xml_node& xml_node,
+                                   const std::string name)
+{
+  const pugi::xml_attribute attr = xml_node.attribute("xml_node");
+  if (!attr)
+  {
+    dolfin_error("xmlutils.cpp",
+                 "checking that XML node has attribute",
+                 "Node  \"%s\" does not have expected attribute \"%s\"",
+                  xml_node.name(), name.c_str());
+
+  }
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/io/xmlutils.h b/dolfin/io/xmlutils.h
index 17fa132..32e55fc 100644
--- a/dolfin/io/xmlutils.h
+++ b/dolfin/io/xmlutils.h
@@ -22,19 +22,33 @@
 #define __XML_UTILS_H
 
 #include <string>
-#include "pugixml.hpp"
 
+namespace pugi
+{
+  class xml_node;
+}
 
 namespace dolfin
 {
 
-  // This file provides a small number of utility functions that may be
-  // useful when parsing XML using pugixml.
+  namespace xmlutils
+  {
+    // This file provides a small number of utility functions that may be
+    // useful when parsing XML using pugixml.
+
+    /// Get XML node with given name, either the given node itself or a
+    /// child node. An error message is thrown if node is not found.
+    const pugi::xml_node get_node(const pugi::xml_node& xml_node,
+                                  std::string node_name);
+
+    // Check that xml_node has name 'name'. If not, throw error.
+    void check_node_name(const pugi::xml_node& xml_node,
+                         const std::string name);
 
-  /// Get XML node with given name, either the given node itself or a
-  /// child node. An error message is thrown if node is not found.
-  const pugi::xml_node get_node(const pugi::xml_node& xml_node,
-                                std::string node_name);
+    // Check that xml_node has attribute 'name'. If not, throw error.
+    void check_has_attribute(const pugi::xml_node& xml_node,
+                             const std::string name);
+  }
 
 }
 
diff --git a/dolfin/la/Amesos2LUSolver.cpp b/dolfin/la/Amesos2LUSolver.cpp
new file mode 100644
index 0000000..68b4c03
--- /dev/null
+++ b/dolfin/la/Amesos2LUSolver.cpp
@@ -0,0 +1,234 @@
+// Copyright (C) 2015 Chris Richardson
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#ifdef HAS_TRILINOS
+
+#include <dolfin/common/constants.h>
+#include <dolfin/common/Timer.h>
+#include <dolfin/log/log.h>
+#include <dolfin/common/MPI.h>
+#include <dolfin/parameter/GlobalParameters.h>
+
+#include "LUSolver.h"
+#include "TpetraMatrix.h"
+#include "TpetraVector.h"
+#include "Amesos2LUSolver.h"
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+std::map<std::string, std::string>
+Amesos2LUSolver::methods()
+{
+  std::map<std::string, std::string> amesos2_methods;
+  amesos2_methods["default"] = "default method";
+#ifdef HAVE_AMESOS2_KLU2
+  amesos2_methods["KLU2"] = "Built in KLU2";
+#endif
+#ifdef HAVE_AMESOS2_BASKER
+  amesos2_methods["Basker"] = "Basker";
+#endif
+#ifdef HAVE_AMESOS2_SUPERLU
+  amesos2_methods["Superlu"] = "Superlu";
+#endif
+#ifdef HAVE_AMESOS2_LAPACK
+  amesos2_methods["Lapack"] = "Lapack (for testing)";
+#endif
+#ifdef HAVE_AMESOS2_MUMPS
+  amesos2_methods["Mumps"] = "MUMPS";
+#endif
+#ifdef HAVE_AMESOS2_SUPERLUDIST
+  amesos2_methods["Superludist"] = "Superludist";
+#endif
+  return amesos2_methods;
+}
+//-----------------------------------------------------------------------------
+Parameters Amesos2LUSolver::default_parameters()
+{
+  Parameters p(LUSolver::default_parameters());
+  p.rename("amesos2_lu_solver");
+
+  return p;
+}
+//-----------------------------------------------------------------------------
+Amesos2LUSolver::Amesos2LUSolver(std::string method)
+{
+  // Set parameter values
+  parameters = default_parameters();
+
+  // Initialize Tpetra LU solver
+  init_solver(method);
+}
+//-----------------------------------------------------------------------------
+Amesos2LUSolver::Amesos2LUSolver(std::shared_ptr<const TpetraMatrix> A,
+                                 std::string method) : _matA(A)
+{
+  // Check dimensions
+  if (A->size(0) != A->size(1))
+  {
+    dolfin_error("Amesos2LUSolver.cpp",
+                 "create Amesos2 LU solver",
+                 "Cannot LU factorize non-square TpetraMatrix");
+  }
+
+  // Set parameter values
+  parameters = default_parameters();
+
+  // Initialize Amesos2 LU solver
+  init_solver(method);
+}
+//-----------------------------------------------------------------------------
+Amesos2LUSolver::~Amesos2LUSolver()
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+void
+Amesos2LUSolver::set_operator(std::shared_ptr<const GenericLinearOperator> A)
+{
+  // Attempt to cast as TpetraMatrix
+  std::shared_ptr<const TpetraMatrix> mat
+    = as_type<const TpetraMatrix>(A);
+  dolfin_assert(mat);
+
+  // Set operator
+  set_operator(mat);
+}
+//-----------------------------------------------------------------------------
+void Amesos2LUSolver::set_operator(std::shared_ptr<const TpetraMatrix> A)
+{
+  _matA = A;
+  dolfin_assert(_matA);
+
+  if (_matA->mat().is_null())
+  {
+    dolfin_error("Amesos2LUSolver.cpp",
+                 "set operator (Amesos2LUSolver::set_operator)",
+                 "cannot set operator if matrix has not been initialized");
+  }
+
+  _solver->setA(_matA->mat());
+  // ierr = KSPSetOperators(_ksp, _matA->mat(), _matA->mat());
+
+}
+//-----------------------------------------------------------------------------
+const GenericLinearOperator& Amesos2LUSolver::get_operator() const
+{
+  if (!_matA)
+  {
+    dolfin_error("Amesos2LUSolver.cpp",
+                 "access operator of Tpetra LU solver",
+                 "Operator has not been set");
+  }
+  return *_matA;
+}
+//-----------------------------------------------------------------------------
+std::size_t Amesos2LUSolver::solve(GenericVector& x, const GenericVector& b)
+{
+  Timer timer("Amesos2 LU solver");
+
+  dolfin_assert(_matA);
+  dolfin_assert(!_matA->mat().is_null());
+
+  // Downcast matrix and vectors
+  const TpetraVector& _b = as_type<const TpetraVector>(b);
+  TpetraVector& _x = as_type<TpetraVector>(x);
+
+  // Check dimensions
+  if (_matA->size(0) != b.size())
+  {
+    dolfin_error("Amesos2LUSolver.cpp",
+                 "solve linear system using Amesos2 LU solver",
+                 "Cannot factorize non-square TpetraMatrix");
+  }
+
+  // Initialize solution vector if required
+  // (make compatible with A in parallel)
+  if (x.empty())
+    _matA->init_vector(x, 1);
+
+  if (Amesos2::query(_method_name) == false)
+  {
+    dolfin_error("Amesos2LUSolver.cpp",
+                 "set solver method",
+                 "\"%s\" not supported", _method_name.c_str());
+  }
+
+  if (_solver.is_null())
+  {
+    _solver = Amesos2::create(_method_name, _matA->mat(),
+                              _x.vec(),
+      Teuchos::rcp_dynamic_cast<const TpetraVector::vector_type>(_b.vec()));
+  }
+  else
+  {
+    _solver->setX(_x.vec());
+    _solver->setB(Teuchos::rcp_dynamic_cast<const TpetraVector::vector_type>(_b.vec()));
+  }
+  _solver->solve();
+
+  return 1;
+}
+//-----------------------------------------------------------------------------
+std::size_t Amesos2LUSolver::solve(const GenericLinearOperator& A,
+                                 GenericVector& x,
+                                 const GenericVector& b)
+{
+  return solve(as_type<const TpetraMatrix>(A),
+               as_type<TpetraVector>(x),
+               as_type<const TpetraVector>(b));
+}
+//-----------------------------------------------------------------------------
+std::size_t Amesos2LUSolver::solve(const TpetraMatrix& A,
+                                   TpetraVector& x,
+                                   const TpetraVector& b)
+{
+  _matA = std::make_shared<TpetraMatrix>(A);
+  return solve(x, b);
+}
+//-----------------------------------------------------------------------------
+std::string Amesos2LUSolver::str(bool verbose) const
+{
+  std::stringstream s;
+
+  if (verbose)
+  {
+    warning("Verbose output for Amesos2LUSolver not implemented yet.");
+  }
+  else
+    s << "<Amesos2LUSolver>";
+
+  return s.str();
+}
+//-----------------------------------------------------------------------------
+void Amesos2LUSolver::init_solver(std::string& method)
+{
+  _method_name = method;
+  if (method == "default")
+  {
+    #ifdef HAVE_AMESOS2_KLU2
+    _method_name = "KLU2";
+    #else
+    dolfin_error("Amesos2LUSolver.cpp", "initialise solver",
+      "Default KLU2 solver not found");
+    #endif
+}
+
+}
+//-----------------------------------------------------------------------------
+#endif
diff --git a/dolfin/la/Amesos2LUSolver.h b/dolfin/la/Amesos2LUSolver.h
new file mode 100644
index 0000000..69beccc
--- /dev/null
+++ b/dolfin/la/Amesos2LUSolver.h
@@ -0,0 +1,104 @@
+// Copyright (C) 2015 Chris Richardson
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#ifndef __DOLFIN_AMESOS2_LU_SOLVER_H
+#define __DOLFIN_AMESOS2_LU_SOLVER_H
+
+#ifdef HAS_TRILINOS
+
+#include "GenericLUSolver.h"
+
+#include <Amesos2_Factory.hpp>
+
+namespace dolfin
+{
+  /// Forward declarations
+  class GenericLinearOperator;
+  class GenericVector;
+  class TpetraMatrix;
+  class TpetraVector;
+
+  /// This class implements the direct solution (LU factorization) for
+  /// linear systems of the form Ax = b.
+  /// It is a wrapper for the Trilinos Amesos2 LU solver.
+
+  class Amesos2LUSolver : public GenericLUSolver
+  {
+  public:
+
+    /// Constructor
+    Amesos2LUSolver(std::string method="default");
+
+    /// Constructor
+    Amesos2LUSolver(std::shared_ptr<const TpetraMatrix> A,
+                    std::string method="default");
+
+    /// Destructor
+    ~Amesos2LUSolver();
+
+    /// Set operator (matrix)
+    void set_operator(std::shared_ptr<const GenericLinearOperator> A);
+
+    /// Set operator (matrix)
+    void set_operator(std::shared_ptr<const TpetraMatrix> A);
+
+    /// Get operator (matrix)
+    const GenericLinearOperator& get_operator() const;
+
+    /// Solve linear system Ax = b
+    std::size_t solve(GenericVector& x, const GenericVector& b);
+
+    /// Solve linear system Ax = b
+    std::size_t solve(const GenericLinearOperator& A,
+                      GenericVector& x,
+                      const GenericVector& b);
+
+    /// Solve linear system Ax = b
+    std::size_t solve(const TpetraMatrix& A,
+                      TpetraVector& x,
+                      const TpetraVector& b);
+
+    /// Return informal string representation (pretty-print)
+    std::string str(bool verbose) const;
+
+    /// Return a list of available solver methods
+    static std::map<std::string, std::string> methods();
+
+    /// Default parameter values
+    static Parameters default_parameters();
+
+  private:
+
+    void init_solver(std::string& method);
+
+    // Reference counted pointer (RCP) to solver
+    Teuchos::RCP<Amesos2::Solver<TpetraMatrix::matrix_type,
+                                 TpetraVector::vector_type>> _solver;
+
+    // Operator (the matrix)
+    std::shared_ptr<const TpetraMatrix> _matA;
+
+    // Method name
+    std::string _method_name;
+  };
+
+}
+
+#endif
+
+#endif
diff --git a/dolfin/la/BelosKrylovSolver.cpp b/dolfin/la/BelosKrylovSolver.cpp
index 82a82ec..9217ea8 100644
--- a/dolfin/la/BelosKrylovSolver.cpp
+++ b/dolfin/la/BelosKrylovSolver.cpp
@@ -18,6 +18,8 @@
 
 #ifdef HAS_TRILINOS
 
+#include <cctype>
+
 #include <dolfin/common/MPI.h>
 #include <dolfin/common/NoDeleter.h>
 #include <dolfin/common/Timer.h>
@@ -29,6 +31,7 @@
 #include "BelosKrylovSolver.h"
 #include "Ifpack2Preconditioner.h"
 #include "MueluPreconditioner.h"
+#include "TrilinosParameters.h"
 
 using namespace dolfin;
 
@@ -38,8 +41,8 @@ std::map<std::string, std::string> BelosKrylovSolver::preconditioners()
   std::map<std::string, std::string> allowed_precs
     = Ifpack2Preconditioner::preconditioners();
 
-  allowed_precs.insert(std::make_pair<std::string, std::string>("muelu",
-                                                                "muelu"));
+  allowed_precs.insert({"muelu", "muelu"});
+  allowed_precs.insert({"amg", "muelu"});
 
   return allowed_precs;
 }
@@ -53,8 +56,11 @@ std::map<std::string, std::string> BelosKrylovSolver::methods()
   result.insert(std::make_pair("default", "default method"));
 
   for (auto &m : methods)
+  {
+    for (auto &c : m)
+      c = std::tolower(c);
     result.insert(std::make_pair(m, m));
-
+  }
   return result;
 }
 //-----------------------------------------------------------------------------
@@ -75,7 +81,7 @@ BelosKrylovSolver::BelosKrylovSolver(std::string method,
 
   if (preconditioner != "none")
   {
-    if (preconditioner == "muelu")
+    if (preconditioner == "muelu" or preconditioner == "amg")
       _prec.reset(new MueluPreconditioner());
     else
       _prec.reset(new Ifpack2Preconditioner(preconditioner));
@@ -84,6 +90,25 @@ BelosKrylovSolver::BelosKrylovSolver(std::string method,
   init(method);
 }
 //-----------------------------------------------------------------------------
+BelosKrylovSolver::BelosKrylovSolver(std::string method,
+  std::shared_ptr<TrilinosPreconditioner> preconditioner)
+  : _prec(preconditioner)
+{
+  // Check that the requested method is known
+  const std::map<std::string, std::string> _methods = methods();
+  if (_methods.find(method) == _methods.end())
+  {
+    dolfin_error("BelosKrylovSolver.cpp",
+                 "create Belos Krylov solver",
+                 "Unknown Krylov method \"%s\"", method.c_str());
+  }
+
+  // Set parameter values
+  parameters = default_parameters();
+
+  init(method);
+}
+//-----------------------------------------------------------------------------
 BelosKrylovSolver::~BelosKrylovSolver()
 {
   // Do nothing
@@ -94,12 +119,8 @@ Parameters BelosKrylovSolver::default_parameters()
   Parameters p(KrylovSolver::default_parameters());
   p.rename("belos_krylov_solver");
 
-  // Norm type used in convergence test
-  // std::set<std::string> allowed_norm_types;
-  // allowed_norm_types.insert("preconditioned");
-  // allowed_norm_types.insert("true");
-  // allowed_norm_types.insert("none");
-  // p.add("convergence_norm_type", allowed_norm_types);
+  Parameters belos_parameters("belos");
+  p.add(belos_parameters);
 
   return p;
 }
@@ -114,8 +135,8 @@ void
 BelosKrylovSolver::set_operators(std::shared_ptr<const GenericLinearOperator> A,
                                  std::shared_ptr<const GenericLinearOperator> P)
 {
-  set_operators(as_type<const TpetraMatrix>(A),
-                as_type<const TpetraMatrix>(P));
+  _set_operators(as_type<const TpetraMatrix>(A),
+                 as_type<const TpetraMatrix>(P));
 }
 //-----------------------------------------------------------------------------
 const TpetraMatrix& BelosKrylovSolver::get_operator() const
@@ -160,20 +181,21 @@ std::string BelosKrylovSolver::str(bool verbose) const
 //-----------------------------------------------------------------------------
 void BelosKrylovSolver::init(const std::string& method)
 {
-  Teuchos::RCP<Teuchos::ParameterList> dummyParams = Teuchos::parameterList();
+  Teuchos::RCP<Teuchos::ParameterList> dummy_params = Teuchos::parameterList();
 
   std::string method_name = method;
   if (method=="default")
     method_name = "GMRES";
 
   Belos::SolverFactory<double, TpetraVector::vector_type, op_type> factory;
-  _solver = factory.create(method_name, dummyParams);
+  _solver = factory.create(method_name, dummy_params);
+
   _problem = Teuchos::rcp(new problem_type);
 }
 //-----------------------------------------------------------------------------
 void BelosKrylovSolver::_set_operator(std::shared_ptr<const TpetraMatrix> A)
 {
-  set_operators(A, A);
+  _set_operators(A, A);
 }
 //-----------------------------------------------------------------------------
 void BelosKrylovSolver::_set_operators(std::shared_ptr<const TpetraMatrix> A,
@@ -215,14 +237,18 @@ std::size_t BelosKrylovSolver::_solve(TpetraVector& x, const TpetraVector& b)
                  _matA->size(0), b.size());
   }
 
-  // Write a message
-  const bool report = parameters["report"];
+  // Get MPI rank
   const int mpi_rank = MPI::rank(_matA->mpi_comm());
 
-  if (report && mpi_rank == 0)
+  // Write a message
+  if (parameters["report"].is_set())
   {
-    info("Solving linear system of size %ld x %ld (Belos Krylov solver).",
-         M, N);
+    const bool report = (bool)parameters["report"];
+    if (report && mpi_rank == 0)
+    {
+      info("Solving linear system of size %ld x %ld (Belos Krylov solver).",
+           M, N);
+    }
   }
 
   // Reinitialize solution vector if necessary
@@ -243,16 +269,18 @@ std::size_t BelosKrylovSolver::_solve(TpetraVector& x, const TpetraVector& b)
   }
 
   // Clear LHS if unless nonzero_initial_guess is set
-  const bool nonzero_guess = parameters["nonzero_initial_guess"];
-  if (!nonzero_guess)
-    x.zero();
+  if (parameters["nonzero_initial_guess"].is_set())
+  {
+    const bool nonzero_guess = (bool) parameters["nonzero_initial_guess"];
+    if (!nonzero_guess)
+      x.zero();
+  }
 
   _problem->setProblem(x.vec(), b.vec());
   _solver->setProblem(_problem);
 
   Belos::ReturnType result =_solver->solve();
   const std::size_t num_iterations = _solver->getNumIters();
-
   if (result == Belos::Converged)
   {
     log(PROGRESS, "Belos Krylov Solver converged in %d iterations.",
@@ -260,19 +288,25 @@ std::size_t BelosKrylovSolver::_solve(TpetraVector& x, const TpetraVector& b)
   }
     else
   {
-    bool error_non_converge = parameters["error_on_nonconvergence"];
-    if (error_non_converge)
-      dolfin_error("BelosKrylovSolver.cpp",
-                   "solve linear system using Belos Krylov solver",
-                   "Solution failed to converge in %d iterations",
-                   num_iterations);
-    else
+    if (parameters["error_on_nonconvergence"].is_set())
     {
-      log(PROGRESS, "Belos Krylov Solver did not converge in %d iterations.",
-          num_iterations);
+      bool error_non_converge = parameters["error_on_nonconvergence"];
+      if (error_non_converge)
+      {
+        dolfin_error("BelosKrylovSolver.cpp",
+                     "solve linear system using Belos Krylov solver",
+                     "Solution failed to converge in %d iterations",
+                     num_iterations);
+      }
+      else
+      {
+        log(PROGRESS, "Belos Krylov Solver did not converge in %d iterations.",
+            num_iterations);
+      }
     }
   }
 
+  // Update ghosts
   x.update_ghost_values();
 
   return num_iterations;
@@ -296,18 +330,22 @@ void BelosKrylovSolver::set_options()
   Teuchos::RCP<Teuchos::ParameterList> solverParams
     = Teuchos::parameterList(*_solver->getCurrentParameters());
 
-  const int gmres_restart = parameters("gmres")["restart"];
-  if (solverParams->isParameter("Num Blocks"))
-      solverParams->set("Num Blocks", gmres_restart);
+  if (parameters["maximum_iterations"].is_set())
+  {
+    const int max_iterations = (int) parameters["maximum_iterations"];
+    solverParams->set("Maximum Iterations", max_iterations);
+  }
 
-  const int max_iterations = parameters["maximum_iterations"];
-  solverParams->set("Maximum Iterations", max_iterations);
+  if (parameters["relative_tolerance"].is_set())
+  {
+    const double rtol = (double) parameters["relative_tolerance"];
+    solverParams->set("Convergence Tolerance", rtol);
+  }
 
-  const double rel_tol = parameters["relative_tolerance"];
-  solverParams->set("Convergence Tolerance", rel_tol);
 
-  const bool monitor_convergence = parameters["monitor_convergence"];
-  if (monitor_convergence)
+  const bool monitor = parameters["monitor_convergence"].is_set() ? (bool) parameters["monitor_convergence"] : false;
+  const bool report = parameters["report"].is_set() ? (bool) parameters["report"] : false;
+  if (monitor or report)
   {
     solverParams->set("Verbosity",
                       Belos::Warnings
@@ -316,8 +354,15 @@ void BelosKrylovSolver::set_options()
                       | Belos::TimingDetails
                       | Belos::FinalSummary);
     solverParams->set("Output Style", (int)Belos::Brief);
-    solverParams->set("Output Frequency", 1);
   }
+
+  if (monitor)
+    solverParams->set("Output Frequency", 1);
+
+  // Copy over any parameters from dolfin parameters in ["belos"]
+  const Parameters& params = parameters("belos");
+  TrilinosParameters::insert_parameters(params, solverParams);
+
   _solver->setParameters(solverParams);
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/la/BelosKrylovSolver.h b/dolfin/la/BelosKrylovSolver.h
index 65b14cf..3c40270 100644
--- a/dolfin/la/BelosKrylovSolver.h
+++ b/dolfin/la/BelosKrylovSolver.h
@@ -42,6 +42,7 @@ namespace dolfin
   class GenericVector;
   class TpetraMatrix;
   class TpetraVector;
+  class TrilinosPreconditioner;
 
   /// This class implements Krylov methods for linear systems
   /// of the form Ax = b. It is a wrapper for the Belos iterative solver
@@ -61,14 +62,9 @@ namespace dolfin
     BelosKrylovSolver(std::string method = "default",
                       std::string preconditioner = "default");
 
-    /// Create Krylov solver for a particular method and
-    /// BelosPreconditioner
-    ///    BelosKrylovSolver(std::string method, Ifpack2Preconditioner& preconditioner);
-
-    /// Create Krylov solver for a particular method and
-    /// BelosPreconditioner (shared_ptr version)
-    //    BelosKrylovSolver(std::string method,
-    //		      std::shared_ptr<Ifpack2Preconditioner> preconditioner);
+    /// Create Krylov solver for a particular method and TrilinosPreconditioner
+    BelosKrylovSolver(std::string method,
+                      std::shared_ptr<TrilinosPreconditioner> preconditioner);
 
     /// Destructor
     ~BelosKrylovSolver();
@@ -98,7 +94,7 @@ namespace dolfin
     std::string str(bool verbose) const;
 
     /// Return Belos pointer
-    //    Teuchos::RCP<Belos::SolverManager<> > ksp() const;
+    //    Teuchos::RCP<Belos::SolverManager<>> solver_manager() const;
 
     /// Return a list of available solver methods
     static std::map<std::string, std::string> methods();
@@ -106,12 +102,15 @@ namespace dolfin
     /// Return a list of available preconditioners
     static std::map<std::string, std::string> preconditioners();
 
-    ///// Set options prefix
-    //void set_options_prefix(std::string prefix);
-
     /// Default parameter values
     static Parameters default_parameters();
 
+    /// Return parameter type: "krylov_solver" or "lu_solver"
+    std::string parameter_type() const
+    {
+      return "krylov_solver";
+    }
+
   private:
 
     friend class Ifpack2Preconditioner;
diff --git a/dolfin/la/BlockMatrix.cpp b/dolfin/la/BlockMatrix.cpp
index c454c6c..a6a62af 100644
--- a/dolfin/la/BlockMatrix.cpp
+++ b/dolfin/la/BlockMatrix.cpp
@@ -147,7 +147,7 @@ void BlockMatrix::mult(const BlockVector& x, BlockVector& y,
 
     // Loop over block columns
     std::shared_ptr<GenericVector>
-      z_tmp = _matA.factory().create_vector();
+      z_tmp = _matA.factory().create_vector(_y.mpi_comm());
     for(std::size_t col = 0; col < matrices.shape()[1]; ++col)
     {
       const GenericVector& _x = *(x.get_block(col));
diff --git a/dolfin/la/BlockVector.h b/dolfin/la/BlockVector.h
index 5cc49c2..9520657 100644
--- a/dolfin/la/BlockVector.h
+++ b/dolfin/la/BlockVector.h
@@ -102,7 +102,7 @@ namespace dolfin
 
   private:
 
-    std::vector<std::shared_ptr<GenericVector> > vectors;
+    std::vector<std::shared_ptr<GenericVector>> vectors;
 
   };
 
diff --git a/dolfin/la/CoordinateMatrix.cpp b/dolfin/la/CoordinateMatrix.cpp
index 5407598..abebf02 100644
--- a/dolfin/la/CoordinateMatrix.cpp
+++ b/dolfin/la/CoordinateMatrix.cpp
@@ -90,8 +90,10 @@ double CoordinateMatrix::norm(std::string norm_type) const
 {
   if (norm_type != "frobenius")
   {
-    error("Do not know to compute %s norm for CoordinateMatrix",
-          norm_type.c_str());
+    dolfin_error("CoordinateMatrix.cpp",
+                 "compute matrix norm",
+                 "Do not know to compute %s norm for CoordinateMatrix",
+                 norm_type.c_str());
   }
 
   double _norm = 0.0;
diff --git a/dolfin/la/DefaultFactory.cpp b/dolfin/la/DefaultFactory.cpp
index b8cbe1b..ec7ca81 100644
--- a/dolfin/la/DefaultFactory.cpp
+++ b/dolfin/la/DefaultFactory.cpp
@@ -23,21 +23,20 @@
 #include <dolfin/parameter/GlobalParameters.h>
 #include "EigenFactory.h"
 #include "PETScFactory.h"
-#include "STLFactory.h"
 #include "TpetraFactory.h"
 #include "DefaultFactory.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-std::shared_ptr<GenericMatrix> DefaultFactory::create_matrix() const
+std::shared_ptr<GenericMatrix> DefaultFactory::create_matrix(MPI_Comm comm) const
 {
-  return factory().create_matrix();
+  return factory().create_matrix(comm);
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<GenericVector> DefaultFactory::create_vector() const
+std::shared_ptr<GenericVector> DefaultFactory::create_vector(MPI_Comm comm) const
 {
-  return factory().create_vector();
+  return factory().create_vector(comm);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<TensorLayout>
@@ -47,22 +46,23 @@ DefaultFactory::create_layout(std::size_t rank) const
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericLinearOperator>
-DefaultFactory::create_linear_operator() const
+DefaultFactory::create_linear_operator(MPI_Comm comm) const
 {
-  return factory().create_linear_operator();
+  return factory().create_linear_operator(comm);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericLUSolver>
-  DefaultFactory::create_lu_solver(std::string method) const
+  DefaultFactory::create_lu_solver(MPI_Comm comm, std::string method) const
 {
-  return factory().create_lu_solver(method);
+  return factory().create_lu_solver(comm, method);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericLinearSolver>
-DefaultFactory::create_krylov_solver(std::string method,
+DefaultFactory::create_krylov_solver(MPI_Comm comm,
+                                     std::string method,
                                      std::string preconditioner) const
 {
-  return factory().create_krylov_solver(method, preconditioner);
+  return factory().create_krylov_solver(comm, method, preconditioner);
 }
 //-----------------------------------------------------------------------------
 std::map<std::string, std::string> DefaultFactory::lu_solver_methods() const
@@ -103,8 +103,6 @@ GenericLinearAlgebraFactory& DefaultFactory::factory()
                  "PETSc linear algebra backend is not available");
     #endif
   }
-  else if (backend == "STL")
-    return STLFactory::instance();
   else if (backend == "Tpetra")
   {
     #ifdef HAS_TRILINOS
diff --git a/dolfin/la/DefaultFactory.h b/dolfin/la/DefaultFactory.h
index 9ff0869..7db0570 100644
--- a/dolfin/la/DefaultFactory.h
+++ b/dolfin/la/DefaultFactory.h
@@ -23,6 +23,7 @@
 
 #include <string>
 #include <memory>
+#include <dolfin/common/MPI.h>
 #include <dolfin/common/types.h>
 #include "GenericLinearAlgebraFactory.h"
 
@@ -43,25 +44,25 @@ namespace dolfin
     virtual ~DefaultFactory() {}
 
     /// Create empty matrix
-    virtual std::shared_ptr<GenericMatrix> create_matrix() const;
+    virtual std::shared_ptr<GenericMatrix> create_matrix(MPI_Comm comm) const;
 
     /// Create empty vector
-    virtual std::shared_ptr<GenericVector> create_vector() const;
+    virtual std::shared_ptr<GenericVector> create_vector(MPI_Comm comm) const;
 
     /// Create empty tensor layout
     virtual std::shared_ptr<TensorLayout> create_layout(std::size_t rank) const;
 
     /// Create empty linear operator
     virtual std::shared_ptr<GenericLinearOperator>
-    create_linear_operator() const;
+      create_linear_operator(MPI_Comm comm) const;
 
     /// Create LU solver
     virtual std::shared_ptr<dolfin::GenericLUSolver>
-    create_lu_solver(std::string method) const;
+    create_lu_solver(MPI_Comm comm, std::string method) const;
 
     /// Create Krylov solver
     virtual std::shared_ptr<dolfin::GenericLinearSolver>
-    create_krylov_solver(std::string method, std::string preconditioner) const;
+    create_krylov_solver(MPI_Comm comm, std::string method, std::string preconditioner) const;
 
     /// Return a list of available LU solver methods
     std::map<std::string, std::string> lu_solver_methods() const;
diff --git a/dolfin/la/EigenFactory.h b/dolfin/la/EigenFactory.h
index 181c673..4770e5c 100644
--- a/dolfin/la/EigenFactory.h
+++ b/dolfin/la/EigenFactory.h
@@ -24,6 +24,7 @@
 #include <memory>
 #include <string>
 
+#include <dolfin/common/MPI.h>
 #include <dolfin/log/log.h>
 #include "EigenKrylovSolver.h"
 #include "EigenLUSolver.h"
@@ -45,31 +46,25 @@ namespace dolfin
     virtual ~EigenFactory() {}
 
     /// Create empty matrix
-    std::shared_ptr<GenericMatrix> create_matrix() const
-    {
-      std::shared_ptr<GenericMatrix> A(new EigenMatrix);
-      return A;
-    }
+    std::shared_ptr<GenericMatrix> create_matrix(MPI_Comm comm) const
+    { return std::make_shared<EigenMatrix>(); }
 
     /// Create empty vector
-    std::shared_ptr<GenericVector> create_vector() const
-    {
-      std::shared_ptr<GenericVector> x(new EigenVector);
-      return x;
-    }
+    std::shared_ptr<GenericVector> create_vector(MPI_Comm comm) const
+    { return std::make_shared<EigenVector>(); }
 
     /// Create empty tensor layout
     std::shared_ptr<TensorLayout> create_layout(std::size_t rank) const
     {
-      bool sparsity = false;
+      TensorLayout::Sparsity sparsity = TensorLayout::Sparsity::DENSE;
       if (rank > 1)
-        sparsity = true;
+        sparsity = TensorLayout::Sparsity::SPARSE;
       std::shared_ptr<TensorLayout> pattern(new TensorLayout(0, sparsity));
       return pattern;
     }
 
     /// Create empty linear operator
-    std::shared_ptr<GenericLinearOperator> create_linear_operator() const
+    std::shared_ptr<GenericLinearOperator> create_linear_operator(MPI_Comm comm) const
     {
       dolfin_not_implemented();
       std::shared_ptr<GenericLinearOperator> A;
@@ -77,14 +72,15 @@ namespace dolfin
     }
 
     /// Create LU solver
-    std::shared_ptr<GenericLUSolver> create_lu_solver(std::string method) const
+    std::shared_ptr<GenericLUSolver> create_lu_solver(MPI_Comm comm, std::string method) const
     {
       return std::shared_ptr<GenericLUSolver>(new EigenLUSolver(method));
     }
 
     /// Create Krylov solver
     std::shared_ptr<GenericLinearSolver>
-    create_krylov_solver(std::string method,
+    create_krylov_solver(MPI_Comm comm,
+                         std::string method,
                          std::string preconditioner) const
     {
       std::shared_ptr<GenericLinearSolver>
diff --git a/dolfin/la/EigenKrylovSolver.cpp b/dolfin/la/EigenKrylovSolver.cpp
index 9cf6aef..7b876d6 100644
--- a/dolfin/la/EigenKrylovSolver.cpp
+++ b/dolfin/la/EigenKrylovSolver.cpp
@@ -115,7 +115,7 @@ void EigenKrylovSolver::set_operators(std::shared_ptr<const EigenMatrix> A,
   dolfin_assert(_matP);
 }
 //-----------------------------------------------------------------------------
-const EigenMatrix& EigenKrylovSolver::get_operator() const
+std::shared_ptr<const EigenMatrix> EigenKrylovSolver::get_operator() const
 {
   if (!_matA)
   {
@@ -123,7 +123,7 @@ const EigenMatrix& EigenKrylovSolver::get_operator() const
                  "access operator for Eigen Krylov solver",
                  "Operator has not been set");
   }
-  return *_matA;
+  return _matA;
 }
 //-----------------------------------------------------------------------------
 std::size_t EigenKrylovSolver::solve(GenericVector& x, const GenericVector& b)
@@ -320,11 +320,8 @@ void EigenKrylovSolver::init(const std::string method,
   }
 
   // Set method and preconditioner
-  _method = method == "default" ? "gmres" : method;
+  _method = (method == "default" ? "gmres" : method);
   _pc = pc;
-
-  // Prepare parameters according to chosen method
-  _init_parameters();
 }
 //-----------------------------------------------------------------------------
 template <typename Solver>
@@ -338,12 +335,13 @@ std::size_t EigenKrylovSolver::call_solver(Solver& solver,
   EigenVector& _x = as_type<EigenVector>(x);
   const EigenVector& _b = as_type<const EigenVector>(b);
 
-  const double eigen_tolerance = _compute_tolerance(*_matA, _x, _b);
-  solver.setTolerance(eigen_tolerance);
+  if (parameters["relative_tolerance"].is_set())
+    solver.setTolerance(parameters["relative_tolerance"]);
 
-  const int max_iterations = parameters["maximum_iterations"];
-  solver.setMaxIterations(max_iterations);
+  if (parameters["maximum_iterations"].is_set())
+    solver.setMaxIterations((int) parameters["maximum_iterations"]);
 
+  // Prepare solver
   solver.compute(_matA->mat());
   if (solver.info() != Eigen::Success)
   {
@@ -352,28 +350,37 @@ std::size_t EigenKrylovSolver::call_solver(Solver& solver,
                  "Preconditioner might fail");
   }
 
-  const bool nonzero_guess = parameters["nonzero_initial_guess"];
-  if (nonzero_guess)
-    _x.vec() = solver.solveWithGuess(_b.vec(), _x.vec());
+  // Call approriate solve function
+  if (parameters["nonzero_initial_guess"].is_set())
+  {
+    const bool nonzero_guess = parameters["nonzero_initial_guess"];
+    if (nonzero_guess)
+      _x.vec() = solver.solveWithGuess(_b.vec(), _x.vec());
+    else
+      _x.vec() = solver.solve(_b.vec());
+  }
   else
     _x.vec() = solver.solve(_b.vec());
+
+  // Get number of solver iterations
   const int num_iterations = solver.iterations();
 
-  bool error_on_nonconvergence = parameters["error_on_nonconvergence"];
+  // Handle case that solver fails to converge
+  bool error_on_nonconvergence = parameters["error_on_nonconvergence"].is_set() ? parameters["error_on_nonconvergence"].is_set() : false;
   if (solver.info() != Eigen::Success)
   {
-    if (num_iterations >= max_iterations)
+    if (num_iterations >= solver.maxIterations())
     {
       if (error_on_nonconvergence)
       {
         dolfin_error("EigenKrylovSolver.cpp",
                      "solve A.x = b",
-                     "Max iterations (%d) exceeded", max_iterations);
+                     "Max iterations (%d) exceeded", solver.maxIterations());
       }
       else
       {
         warning("Krylov solver did not converge in %i iterations",
-                max_iterations);
+                solver.maxIterations());
       }
     }
     else
@@ -387,64 +394,3 @@ std::size_t EigenKrylovSolver::call_solver(Solver& solver,
   return num_iterations;
 }
 //-----------------------------------------------------------------------------
-void EigenKrylovSolver::_init_parameters()
-{
-  if (_method == "cg" || _method == "bicgstab" || _method == "minres")
-  {
-    const std::set<std::string> allowed = {"true"};
-    parameters.add("convergence_norm_type", "true", allowed);
-  }
-  else if (_method == "gmres")
-  {
-    const std::set<std::string> allowed = {"preconditioned"};
-    parameters.add("convergence_norm_type", "preconditioned", allowed);
-    parameters["absolute_tolerance"].reset();
-  }
-  else
-  {
-    // If a flow ends here, then you have forgotten to handle the newly
-    // implemented method here! Please, look into Eigen code and fix it!
-    dolfin_assert(false);
-  }
-}
-//-----------------------------------------------------------------------------
-double EigenKrylovSolver::_compute_tolerance(const EigenMatrix& A,
-                                             const EigenVector& x,
-                                             const EigenVector& b) const
-{
-  if (_method == "cg" || _method == "bicgstab" || _method == "minres")
-  {
-    const double atol = parameters["absolute_tolerance"];
-    const double rtol = parameters["relative_tolerance"];
-
-    const double b_norm = b.norm("l2");
-
-    // Define lazy evaluated residual vector and compute its norm
-    Eigen::VectorXd r0;
-    r0.noalias() = b.vec() - A.mat()*x.vec();
-    const double r0_norm = r0.norm();
-
-    return std::max(rtol*r0_norm, atol) / b_norm;
-  }
-  else if (_method == "gmres")
-  {
-    // NOTE: This could be imlemented but requires computation of P^{-1}
-    //       eigen_tol = max(rtol, atol/||P^{-1} r0||)
-    if (parameters["absolute_tolerance"].is_set())
-    {
-      warning("Absolute tolerance parameter not implemented for Eigen GMRES. "
-              "Ignoring and using just relative tolerance criterion.");
-    }
-    return parameters["relative_tolerance"];
-  }
-  else
-  {
-    // If a flow ends here, then you have forgotten to handle the newly
-    // implemented method here! Please, look into Eigen code and fix it!
-    dolfin_assert(false);
-
-    // Fallback option
-    return parameters["relative_tolerance"];
-  }
-}
-//-----------------------------------------------------------------------------
diff --git a/dolfin/la/EigenKrylovSolver.h b/dolfin/la/EigenKrylovSolver.h
index c7bbce6..6f1632d 100644
--- a/dolfin/la/EigenKrylovSolver.h
+++ b/dolfin/la/EigenKrylovSolver.h
@@ -64,7 +64,7 @@ namespace dolfin
                        std::shared_ptr<const EigenMatrix> P);
 
     /// Get operator (matrix)
-    const EigenMatrix& get_operator() const;
+    std::shared_ptr<const EigenMatrix> get_operator() const;
 
     /// Solve linear system Ax = b and return number of iterations
     std::size_t solve(GenericVector& x, const GenericVector& b);
@@ -92,6 +92,10 @@ namespace dolfin
     /// Default parameter values
     static Parameters default_parameters();
 
+    /// Return parameter type: "krylov_solver" or "lu_solver"
+    std::string parameter_type() const
+    { return "krylov_solver"; }
+
   private:
 
     // Initialize solver
@@ -118,13 +122,6 @@ namespace dolfin
     // Matrix used to construct the preconditioner
     std::shared_ptr<const EigenMatrix> _matP;
 
-    // Prepare parameters; this cannot be done in static update_parameters
-    // as it depends on the method
-    void _init_parameters();
-
-    // Compute tolerance to be passed to Eigen
-    double _compute_tolerance(const EigenMatrix& A, const EigenVector& x,
-                              const EigenVector& b) const;
   };
 
 }
diff --git a/dolfin/la/EigenMatrix.cpp b/dolfin/la/EigenMatrix.cpp
index 5b0fa1d..6b8b173 100644
--- a/dolfin/la/EigenMatrix.cpp
+++ b/dolfin/la/EigenMatrix.cpp
@@ -15,8 +15,9 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 
-#include "EigenMatrix.h"
 #include "EigenFactory.h"
+#include "SparsityPattern.h"
+#include "EigenMatrix.h"
 
 using namespace dolfin;
 
@@ -63,7 +64,7 @@ std::size_t EigenMatrix::size(std::size_t dim) const
 {
   if (dim > 1)
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "access size of Eigen matrix",
                  "Illegal axis (%d), must be 0 or 1", dim);
   }
@@ -73,13 +74,27 @@ std::size_t EigenMatrix::size(std::size_t dim) const
 //---------------------------------------------------------------------------
 double EigenMatrix::norm(std::string norm_type) const
 {
-  if (norm_type == "l2")
+  if (norm_type == "l1")
+  {
+    double _norm = 0.0;
+    for (std::size_t i = 0; i < size(1); ++i)
+      _norm = std::max(_norm, _matA.col(i).cwiseAbs().sum());
+    return _norm;
+  }
+  else if (norm_type == "l2")
     return _matA.squaredNorm();
   else if (norm_type == "frobenius")
     return _matA.norm();
+  else if (norm_type == "linf")
+  {
+    double _norm = 0.0;
+    for (std::size_t i = 0; i < size(0); ++i)
+      _norm = std::max(_norm, _matA.row(i).cwiseAbs().sum());
+    return _norm;
+  }
   else
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "compute norm of Eigen matrix",
                  "Unknown norm type (\"%s\")",
                  norm_type.c_str());
@@ -95,7 +110,9 @@ void EigenMatrix::getrow(std::size_t row_idx,
 
   // Check storage is RowMajor
   if (!eigen_matrix_type::IsRowMajor)
-    error("Cannot get row from ColMajor matrix");
+    dolfin_error("EigenMatrix.cpp",
+                 "get row of Eigen matrix",
+                 "Cannot get row from column major matrix");
 
   // Insert values into std::vectors
   columns.clear();
@@ -214,7 +231,7 @@ void EigenMatrix::mult(const GenericVector& x, GenericVector& y) const
   EigenVector& yy = as_type<EigenVector>(y);
   if (size(1) != xx.size())
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "compute matrix-vector product with Eigen matrix",
                  "Non-matching dimensions for matrix-vector product");
   }
@@ -225,7 +242,7 @@ void EigenMatrix::mult(const GenericVector& x, GenericVector& y) const
 
   if (size(0) != yy.size())
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "compute matrix-vector product with Eigen matrix",
                  "Vector for matrix-vector result has wrong size");
   }
@@ -237,7 +254,7 @@ void EigenMatrix::get_diagonal(GenericVector& x) const
 {
   if (size(1) != size(0) || size(0) != x.size())
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "Get diagonal of a Eigen Matrix",
                  "Matrix and vector dimensions don't match");
   }
@@ -251,7 +268,7 @@ void EigenMatrix::set_diagonal(const GenericVector& x)
 {
   if (size(1) != size(0) || size(0) != x.size())
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "Set diagonal of a Eigen Matrix",
                  "Matrix and vector dimensions don't match");
   }
@@ -269,7 +286,7 @@ void EigenMatrix::transpmult(const GenericVector& x,
 
   if (size(0) != xx.size())
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "compute matrix-vector product with Eigen matrix",
                  "Non-matching dimensions for matrix-vector product");
   }
@@ -280,7 +297,7 @@ void EigenMatrix::transpmult(const GenericVector& x,
 
   if (size(1) != yy.size())
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "compute matrix-vector product with Eigen matrix",
                  "Vector for matrix-vector result has wrong size");
   }
@@ -321,7 +338,7 @@ EigenMatrix:: data() const
   // Check that matrix has been compressed
   if (!_matA.isCompressed())
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "get raw data from EigenMatrix",
                  "Matrix has not been compressed. Try calling EigenMatrix::compress() first");
   }
@@ -364,22 +381,16 @@ void EigenMatrix::init(const TensorLayout& tensor_layout)
 
   // Get sparsity pattern
   dolfin_assert(tensor_layout.sparsity_pattern());
-  const SparsityPattern* pattern_pointer
-    = dynamic_cast<const SparsityPattern*>(tensor_layout.sparsity_pattern().get());
-  if (!pattern_pointer)
-  {
-    dolfin_error("EigenMatrix.h",
-                 "initialize Eigen matrix",
-                 "Cannot convert GenericSparsityPattern to concrete SparsityPattern type");
-  }
+  auto sparsity_pattern = tensor_layout.sparsity_pattern();
+  dolfin_assert(sparsity_pattern);
 
   // Reserve space for non-zeroes and get non-zero pattern
   std::vector<std::size_t> num_nonzeros_per_row;
-  pattern_pointer->num_nonzeros_diagonal(num_nonzeros_per_row);
+  sparsity_pattern->num_nonzeros_diagonal(num_nonzeros_per_row);
   _matA.reserve(num_nonzeros_per_row);
 
   const std::vector<std::vector<std::size_t>> pattern
-    = pattern_pointer->diagonal_pattern(SparsityPattern::sorted);
+    = sparsity_pattern->diagonal_pattern(SparsityPattern::Type::sorted);
 
   if (!eigen_matrix_type::IsRowMajor)
     warning ("Entering sparsity for RowMajor matrix - performance may be affected");
@@ -408,7 +419,7 @@ void EigenMatrix::axpy(double a, const GenericMatrix& A,
   // Check for same size
   if (size(0) != A.size(0) or size(1) != A.size(1))
   {
-    dolfin_error("EigenMatrix.h",
+    dolfin_error("EigenMatrix.cpp",
                  "perform axpy operation with Eigen matrix",
                  "Dimensions don't match");
   }
diff --git a/dolfin/la/EigenMatrix.h b/dolfin/la/EigenMatrix.h
index f1f7eb4..b384f14 100644
--- a/dolfin/la/EigenMatrix.h
+++ b/dolfin/la/EigenMatrix.h
@@ -30,7 +30,6 @@
 #include "EigenVector.h"
 #include "GenericMatrix.h"
 #include "GenericVector.h"
-#include "SparsityPattern.h"
 #include "TensorLayout.h"
 
 namespace dolfin
@@ -75,9 +74,9 @@ namespace dolfin
     virtual std::size_t size(std::size_t dim) const;
 
     /// Return local ownership range
-    virtual std::pair<std::size_t, std::size_t>
+    virtual std::pair<std::int64_t, std::int64_t>
       local_range(std::size_t dim) const
-    { return std::make_pair(0, size(dim)); }
+    { return {0, size(dim)}; }
 
     /// Return number of non-zero entries in matrix
     std::size_t nnz() const;
diff --git a/dolfin/la/EigenVector.cpp b/dolfin/la/EigenVector.cpp
index 1ebaa8c..9415669 100644
--- a/dolfin/la/EigenVector.cpp
+++ b/dolfin/la/EigenVector.cpp
@@ -21,6 +21,7 @@
 #include <sstream>
 #include <unordered_set>
 
+#include <dolfin/log/log.h>
 #include <dolfin/common/Timer.h>
 #include <dolfin/common/Array.h>
 #include "EigenVector.h"
@@ -30,18 +31,30 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-EigenVector::EigenVector() : _x(new Eigen::VectorXd)
+EigenVector::EigenVector() : EigenVector(MPI_COMM_SELF)
 {
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-EigenVector::EigenVector(std::size_t N) : _x(new Eigen::VectorXd(N))
+EigenVector::EigenVector(MPI_Comm comm) : _x(new Eigen::VectorXd),
+                                          _mpi_comm(comm)
 {
+  // Check size of communicator
+  check_mpi_size(comm);
+}
+//-----------------------------------------------------------------------------
+EigenVector::EigenVector(MPI_Comm comm, std::size_t N)
+  : _x(new Eigen::VectorXd(N)), _mpi_comm(comm)
+{
+  // Check size of communicator
+  check_mpi_size(comm);
+
+  // Zero vector
   _x->setZero();
 }
 //-----------------------------------------------------------------------------
 EigenVector::EigenVector(const EigenVector& x)
-  : _x(new Eigen::VectorXd(*(x._x)))
+  : _x(new Eigen::VectorXd(*(x._x))), _mpi_comm(x._mpi_comm)
 {
   // Do nothing
 }
@@ -76,7 +89,7 @@ std::size_t EigenVector::size() const
   return _x->size();
 }
 //-----------------------------------------------------------------------------
-std::pair<std::size_t, std::size_t> EigenVector::local_range() const
+std::pair<std::int64_t, std::int64_t> EigenVector::local_range() const
 {
   return std::make_pair(0, size());
 }
@@ -120,7 +133,7 @@ void EigenVector::add_local(const Array<double>& values)
 void EigenVector::gather(GenericVector& x,
                          const std::vector<dolfin::la_index>& indices) const
 {
-  error("Not implemented");
+  dolfin_not_implemented();
 }
 //-----------------------------------------------------------------------------
 void EigenVector::gather(std::vector<double>& x,
diff --git a/dolfin/la/EigenVector.h b/dolfin/la/EigenVector.h
index 59d96b3..1b95250 100644
--- a/dolfin/la/EigenVector.h
+++ b/dolfin/la/EigenVector.h
@@ -46,11 +46,14 @@ namespace dolfin
   {
   public:
 
-    /// Create empty vector
+    /// Create empty vector (on MPI_COMM_SELF)
     EigenVector();
 
+    /// Create empty vector
+    explicit EigenVector(MPI_Comm comm);
+
     /// Create vector of size N
-    explicit EigenVector(std::size_t N);
+    EigenVector(MPI_Comm comm, std::size_t N);
 
     /// Copy constructor
     EigenVector(const EigenVector& x);
@@ -71,7 +74,7 @@ namespace dolfin
 
     /// Return MPI communicator
     virtual MPI_Comm mpi_comm() const
-    { return MPI_COMM_SELF; }
+    { return _mpi_comm; }
 
     /// Return informal string representation (pretty-print)
     virtual std::string str(bool verbose) const;
@@ -84,13 +87,14 @@ namespace dolfin
     /// Initialize vector to size N
     virtual void init(MPI_Comm comm, std::size_t N)
     {
-      check_mpi_rank(comm);
+      check_mpi_size(comm);
       if (!empty())
       {
         dolfin_error("EigenVector.cpp",
                      "calling EigenVector::init(...)",
                      "Cannot call init for a non-empty vector. Use EigenVector::resize instead");
       }
+
       resize(N);
     }
 
@@ -98,7 +102,7 @@ namespace dolfin
     virtual void init(MPI_Comm comm,
                       std::pair<std::size_t, std::size_t> range)
     {
-      check_mpi_rank(comm);
+      check_mpi_size(comm);
       if (!empty())
       {
         dolfin_error("EigenVector.cpp",
@@ -117,7 +121,7 @@ namespace dolfin
                       const std::vector<std::size_t>& local_to_global_map,
                       const std::vector<la_index>& ghost_indices)
     {
-      check_mpi_rank(comm);
+      check_mpi_size(comm);
       if (!empty())
       {
         dolfin_error("EigenVector.cpp",
@@ -151,7 +155,7 @@ namespace dolfin
     { return size(); }
 
     /// Return local ownership range of a vector
-    virtual std::pair<std::size_t, std::size_t> local_range() const;
+    virtual std::pair<std::int64_t, std::int64_t> local_range() const;
 
     /// Determine whether global vector index is owned by this process
     virtual bool owns_index(std::size_t i) const;
@@ -292,19 +296,22 @@ namespace dolfin
 
   private:
 
-    void check_mpi_rank(const MPI_Comm comm) const
+    static void check_mpi_size(const MPI_Comm comm)
     {
       if (dolfin::MPI::size(comm) > 1)
       {
         dolfin_error("EigenVector.cpp",
                      "creating EigenVector",
-                     "Distributed EigenVector is not supported");
+                     "EigenVector does not support parallel communicators");
       }
     }
 
     // Pointer to Eigen vector object
     std::shared_ptr<Eigen::VectorXd> _x;
 
+    // MPI communicator
+    MPI_Comm _mpi_comm;
+
   };
 
 }
diff --git a/dolfin/la/GenericLUSolver.h b/dolfin/la/GenericLUSolver.h
index 464dc95..9a49d1c 100644
--- a/dolfin/la/GenericLUSolver.h
+++ b/dolfin/la/GenericLUSolver.h
@@ -77,6 +77,12 @@ namespace dolfin
       return 0;
     }
 
+    /// Return parameter type: "krylov_solver" or "lu_solver"
+    virtual std::string parameter_type() const
+    {
+      return "lu_solver";
+    }
+
   };
 
 }
diff --git a/dolfin/la/GenericLinearAlgebraFactory.h b/dolfin/la/GenericLinearAlgebraFactory.h
index dec1d46..cd5fdbc 100644
--- a/dolfin/la/GenericLinearAlgebraFactory.h
+++ b/dolfin/la/GenericLinearAlgebraFactory.h
@@ -26,6 +26,7 @@
 #include <string>
 #include <vector>
 #include <memory>
+#include <dolfin/common/MPI.h>
 #include <dolfin/common/types.h>
 #include <dolfin/log/log.h>
 
@@ -52,25 +53,27 @@ namespace dolfin
     virtual ~GenericLinearAlgebraFactory() {}
 
     /// Create empty matrix
-    virtual std::shared_ptr<GenericMatrix> create_matrix() const = 0;
+    virtual std::shared_ptr<GenericMatrix> create_matrix(MPI_Comm comm) const = 0;
 
     /// Create empty vector
-    virtual std::shared_ptr<GenericVector> create_vector() const = 0;
+    virtual std::shared_ptr<GenericVector>
+      create_vector(MPI_Comm comm) const = 0;
 
     /// Create empty tensor layout
     virtual std::shared_ptr<TensorLayout> create_layout(std::size_t rank) const = 0;
 
     /// Create empty linear operator
     virtual std::shared_ptr<GenericLinearOperator>
-    create_linear_operator() const = 0;
+      create_linear_operator(MPI_Comm comm) const = 0;
 
     /// Create LU solver
     virtual std::shared_ptr<GenericLUSolver>
-    create_lu_solver(std::string method) const = 0;
+    create_lu_solver(MPI_Comm comm, std::string method) const = 0;
 
     /// Create Krylov solver
     virtual std::shared_ptr<GenericLinearSolver>
-    create_krylov_solver(std::string method,
+    create_krylov_solver(MPI_Comm comm,
+                         std::string method,
                          std::string preconditioner) const = 0;
 
     /// Return a list of available LU solver methods.  This function
@@ -103,6 +106,9 @@ namespace dolfin
       void mult(const GenericVector& x, GenericVector& y) const
       { dolfin_not_implemented(); }
 
+      MPI_Comm mpi_comm() const
+      { dolfin_not_implemented(); return MPI_COMM_WORLD; }
+
       std::string str(bool verbose) const
       { dolfin_not_implemented(); return ""; }
 
diff --git a/dolfin/la/GenericLinearOperator.h b/dolfin/la/GenericLinearOperator.h
index edb1910..35e7ce7 100644
--- a/dolfin/la/GenericLinearOperator.h
+++ b/dolfin/la/GenericLinearOperator.h
@@ -61,7 +61,7 @@ namespace dolfin
 
     // Initialize linear operator to match parallel layout of vectors
     // x and y for product y = Ax. Needs to be implemented by backend.
-    virtual void init_layout(const GenericVector& x, 
+    virtual void init_layout(const GenericVector& x,
 			     const GenericVector& y,
 			     GenericLinearOperator* wrapper)
     {
diff --git a/dolfin/la/GenericLinearSolver.h b/dolfin/la/GenericLinearSolver.h
index 3e72bc1..7572371 100644
--- a/dolfin/la/GenericLinearSolver.h
+++ b/dolfin/la/GenericLinearSolver.h
@@ -57,15 +57,6 @@ namespace dolfin
                    "Not supported by current linear algebra backend");
     }
 
-    /// Set null space of the operator (matrix). This is used to solve
-    /// singular systems
-    virtual void set_nullspace(const VectorSpaceBasis& nullspace)
-    {
-      dolfin_error("GenericLinearSolver.h",
-                   "set nullspace for operator",
-                   "Not supported by current linear algebra solver backend");
-    }
-
     /// Solve linear system Ax = b
     virtual std::size_t solve(const GenericLinearOperator& A, GenericVector& x,
                               const GenericVector& b)
diff --git a/dolfin/la/GenericMatrix.cpp b/dolfin/la/GenericMatrix.cpp
index 95b2bf8..8befa07 100644
--- a/dolfin/la/GenericMatrix.cpp
+++ b/dolfin/la/GenericMatrix.cpp
@@ -22,7 +22,6 @@
 
 #include <dolfin/common/constants.h>
 #include <dolfin/common/Timer.h>
-#include "GenericSparsityPattern.h"
 #include "GenericMatrix.h"
 
 using namespace dolfin;
@@ -41,7 +40,7 @@ void GenericMatrix::ident_zeros()
   std::vector<std::size_t> columns;
   std::vector<double> values;
   std::vector<dolfin::la_index> zero_rows;
-  const std::pair<std::size_t, std::size_t> row_range = local_range(0);
+  const std::pair<std::int64_t, std::int64_t> row_range = local_range(0);
   const std::size_t m = row_range.second - row_range.first;
 
   // Check which rows are zero
diff --git a/dolfin/la/GenericMatrix.h b/dolfin/la/GenericMatrix.h
index 144513a..cd96ad6 100644
--- a/dolfin/la/GenericMatrix.h
+++ b/dolfin/la/GenericMatrix.h
@@ -58,7 +58,7 @@ namespace dolfin
     virtual std::size_t size(std::size_t dim) const = 0;
 
     /// Return local ownership range
-    virtual std::pair<std::size_t, std::size_t>
+    virtual std::pair<std::int64_t, std::int64_t>
     local_range(std::size_t dim) const = 0;
 
     /// Return number of non-zero entries in matrix (collective)
@@ -94,7 +94,7 @@ namespace dolfin
     /// Add block of values using global indices
     virtual void
     add(const double* block,
-        const std::vector<ArrayView<const dolfin::la_index> >& rows)
+        const std::vector<ArrayView<const dolfin::la_index>>& rows)
     {
       add(block, rows[0].size(), rows[0].data(),
           rows[1].size(), rows[1].data());
@@ -103,7 +103,7 @@ namespace dolfin
     /// Add block of values using local indices
     virtual void
     add_local(const double* block,
-              const std::vector<ArrayView<const dolfin::la_index> >& rows)
+              const std::vector<ArrayView<const dolfin::la_index>>& rows)
     {
       add_local(block, rows[0].size(), rows[0].data(),
                 rows[1].size(), rows[1].data());
diff --git a/dolfin/la/GenericPreconditioner.h b/dolfin/la/GenericPreconditioner.h
deleted file mode 100644
index cebd498..0000000
--- a/dolfin/la/GenericPreconditioner.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (C) 2012 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-11-09
-// Last changed:
-
-#ifndef __GENERIC_PRECONDITIONER_H
-#define __GENERIC_PRECONDITIONER_H
-
-#include <vector>
-#include <dolfin/log/log.h>
-
-namespace dolfin
-{
-
-  // Forward declarations
-  class GenericVector;
-  class VectorSpaceBasis;
-
-  /// This class provides a common base preconditioners.
-
-  class GenericPreconditioner
-  {
-  public:
-
-    virtual ~GenericPreconditioner() {}
-
-    /// Set the (approximate) null space of the preconditioner operator
-    /// (matrix). This is required for certain preconditioner types,
-    /// e.g. smoothed aggregation multigrid
-    virtual void set_nullspace(const VectorSpaceBasis& nullspace)
-    {
-      dolfin_error("GenericPreconditioner.h",
-                   "set nullspace for preconditioner operator",
-                   "Not supported by current preconditioner type");
-    }
-
-    /// Set the coordinates of the operator (matrix) rows and geometric
-    /// dimension d. This is can be used by required for certain
-    /// preconditioners, e.g. ML. The input for this function can be
-    /// generated using GenericDofMap::tabulate_all_dofs.
-    virtual void set_coordinates(const std::vector<double>& x, std::size_t dim)
-    {
-      dolfin_error("GenericPreconditioner.h",
-                   "set coordinates for preconditioner operator",
-                   "Not supported by current preconditioner type");
-    }
-
-  };
-}
-
-#endif
diff --git a/dolfin/la/GenericSparsityPattern.h b/dolfin/la/GenericSparsityPattern.h
deleted file mode 100644
index 4692422..0000000
--- a/dolfin/la/GenericSparsityPattern.h
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (C) 2007 Ola Skavhaug
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Magnus Vikstrom, 2008.
-// Modified by Anders Logg, 2009.
-// Modified by Garth N. Wells, 2010.
-//
-// First added:  2007-11-30
-// Last changed: 2010-12-30
-
-#ifndef __GENERIC_SPARSITY_PATTERN_H
-#define __GENERIC_SPARSITY_PATTERN_H
-
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include <dolfin/common/ArrayView.h>
-#include <dolfin/common/types.h>
-#include <dolfin/common/MPI.h>
-#include <dolfin/common/Variable.h>
-
-namespace dolfin
-{
-
-  /// Base class (interface) for generic tensor sparsity patterns.
-  /// Currently, this interface is mostly limited to matrices.
-
-  class GenericSparsityPattern : public Variable
-  {
-  public:
-
-    enum Type {sorted, unsorted};
-
-    /// Create empty sparsity pattern
-    GenericSparsityPattern(std::size_t primary_dim)
-      : _primary_dim(primary_dim) {}
-
-    /// Destructor
-    virtual ~GenericSparsityPattern() {}
-
-    /// Initialize sparsity pattern for a generic tensor
-    virtual void
-      init(const MPI_Comm mpi_comm,
-           const std::vector<std::size_t>& dims,
-           const std::vector<std::pair<std::size_t, std::size_t> >& local_range,
-           const std::vector<ArrayView<const std::size_t> >& local_to_global,
-           const std::vector<ArrayView<const int> >& off_process_owner,
-           const std::vector<std::size_t>& block_sizes) = 0;
-
-    /// Insert non-zero entries using global indices
-    virtual void insert_global(const std::vector<
-                               ArrayView<const dolfin::la_index> >& entries) = 0;
-
-    /// Insert non-zero entries using local (process-wise) entries
-    virtual void insert_local(const std::vector<
-                              ArrayView<const dolfin::la_index> >& entries) = 0;
-
-    /// Return rank
-    virtual std::size_t rank() const = 0;
-
-    /// Return primary dimension (e.g., 0=row partition, 1=column
-    /// partition)
-    std::size_t primary_dim() const
-    { return _primary_dim; }
-
-    /// Return local range for dimension dim
-    virtual std::pair<std::size_t, std::size_t>
-      local_range(std::size_t dim) const = 0;
-
-    /// Return total number of nonzeros in local_range
-    virtual std::size_t num_nonzeros() const = 0;
-
-    /// Fill vector with number of nonzeros for diagonal block in
-    /// local_range for primary dimension
-    virtual void
-      num_nonzeros_diagonal(std::vector<std::size_t>& num_nonzeros) const = 0;
-
-    /// Fill vector with number of nonzeros for off-diagonal block in
-    /// local_range for primary dimension
-    virtual void num_nonzeros_off_diagonal(
-      std::vector<std::size_t>& num_nonzeros) const = 0;
-
-    /// Fill vector with number of nonzeros in local_range for primary
-    /// dimension
-    virtual void
-      num_local_nonzeros(std::vector<std::size_t>& num_nonzeros) const = 0;
-
-    /// Return underlying sparsity pattern (diagonal). Options are
-    /// 'sorted' and 'unsorted'.
-    virtual std::vector<std::vector<std::size_t> >
-      diagonal_pattern(Type type) const = 0;
-
-    /// Return underlying sparsity pattern (off-diagonal). Options
-    /// are 'sorted' and 'unsorted'.
-    virtual std::vector<std::vector<std::size_t> >
-      off_diagonal_pattern(Type type) const = 0;
-
-    /// Finalize sparsity pattern
-    virtual void apply() = 0;
-
-    /// Return MPI communicator
-    virtual MPI_Comm mpi_comm() const = 0;
-
-   private:
-
-    // Primary sparsity pattern storage dimension (e.g., 0=row
-    // partition, 1=column partition)
-    const std::size_t _primary_dim;
-
-  };
-
-}
-
-#endif
diff --git a/dolfin/la/GenericTensor.h b/dolfin/la/GenericTensor.h
index 70b7593..fa728db 100644
--- a/dolfin/la/GenericTensor.h
+++ b/dolfin/la/GenericTensor.h
@@ -25,9 +25,12 @@
 #ifndef __GENERIC_TENSOR_H
 #define __GENERIC_TENSOR_H
 
+#include <cstdint>
 #include <exception>
-#include <typeinfo>
 #include <memory>
+#include <typeinfo>
+#include <utility>
+
 #include <dolfin/common/ArrayView.h>
 #include <dolfin/common/MPI.h>
 #include <dolfin/common/types.h>
@@ -64,7 +67,7 @@ namespace dolfin
     virtual std::size_t size(std::size_t dim) const = 0;
 
     /// Return local ownership range
-    virtual std::pair<std::size_t, std::size_t>
+    virtual std::pair<std::int64_t, std::int64_t>
     local_range(std::size_t dim) const = 0;
 
     /// Get block of values
@@ -83,12 +86,12 @@ namespace dolfin
     /// Add block of values using global indices
     virtual
       void add(const double* block,
-           const std::vector<ArrayView<const dolfin::la_index> >& rows) = 0;
+           const std::vector<ArrayView<const dolfin::la_index>>& rows) = 0;
 
     /// Add block of values using local indices
     virtual void add_local(
       const double* block,
-      const std::vector<ArrayView<const dolfin::la_index> >& rows) = 0;
+      const std::vector<ArrayView<const dolfin::la_index>>& rows) = 0;
 
 
     /// Add block of values using global indices
@@ -107,7 +110,7 @@ namespace dolfin
     virtual void apply(std::string mode) = 0;
 
     /// Return MPI communicator
-    virtual MPI_Comm mpi_comm() const = 0;
+    //virtual MPI_Comm mpi_comm() const = 0;
 
     /// Return informal string representation (pretty-print)
     virtual std::string str(bool verbose) const = 0;
diff --git a/dolfin/la/GenericVector.h b/dolfin/la/GenericVector.h
index bec570f..831313c 100644
--- a/dolfin/la/GenericVector.h
+++ b/dolfin/la/GenericVector.h
@@ -28,11 +28,13 @@
 #define __GENERIC_VECTOR_H
 
 #include <algorithm>
+#include <cstdint>
 #include <utility>
 #include <vector>
 #include <dolfin/common/ArrayView.h>
 #include <dolfin/common/types.h>
 #include <dolfin/log/log.h>
+#include "IndexMap.h"
 #include "TensorLayout.h"
 #include "GenericTensor.h"
 
@@ -52,13 +54,37 @@ namespace dolfin
     //--- Implementation of the GenericTensor interface ---
 
     /// Initialize zero tensor using sparsity pattern
+    /// FIXME: This needs to be implemented on backend side! Remove it!
     virtual void init(const TensorLayout& tensor_layout)
     {
       if (!empty())
-        error("GenericVector cannot be initialised more than once");
+      {
+        dolfin_error("GenericVector.h",
+                     "initialize vector",
+                     "Vector cannot be initialised more than once");
+      }
+
       std::vector<dolfin::la_index> ghosts;
+      std::vector<std::size_t> local_to_global(tensor_layout.index_map(0)->size(IndexMap::MapSize::ALL));
+
+      // FIXME: should just pass index_map to init()
+      for (std::size_t i = 0; i != local_to_global.size(); ++i)
+        local_to_global[i] = tensor_layout.index_map(0)->local_to_global(i);
+
+      // FIXME: temporary hack - needs passing tensor layout directly to backend
+      if (tensor_layout.is_ghosted() == TensorLayout::Ghosts::GHOSTED)
+      {
+        const std::size_t nowned
+          = tensor_layout.index_map(0)->size(IndexMap::MapSize::OWNED);
+        const std::size_t nghosts
+          = tensor_layout.index_map(0)->size(IndexMap::MapSize::UNOWNED);
+        ghosts.resize(nghosts);
+        for (std::size_t i = 0; i != nghosts; ++i)
+          ghosts[i] = local_to_global[i + nowned];
+      }
+
       init(tensor_layout.mpi_comm(), tensor_layout.local_range(0),
-           tensor_layout.local_to_global_map[0], ghosts);
+           local_to_global, ghosts);
       zero();
     }
 
@@ -71,7 +97,7 @@ namespace dolfin
     { dolfin_assert(dim == 0); return size(); }
 
     /// Return local ownership range
-    virtual std::pair<std::size_t, std::size_t>
+    virtual std::pair<std::int64_t, std::int64_t>
     local_range(std::size_t dim) const
     { dolfin_assert(dim == 0); return local_range(); }
 
@@ -110,13 +136,13 @@ namespace dolfin
     /// Add block of values using global indices
     virtual void
       add(const double* block,
-          const std::vector<ArrayView<const dolfin::la_index> >& rows)
+          const std::vector<ArrayView<const dolfin::la_index>>& rows)
     { add(block, rows[0].size(), rows[0].data()); }
 
     /// Add block of values using local indices
     virtual void
     add_local(const double* block,
-              const std::vector<ArrayView<const dolfin::la_index> >& rows)
+              const std::vector<ArrayView<const dolfin::la_index>>& rows)
     { add_local(block, rows[0].size(), rows[0].data()); }
 
     /// Set all entries to zero and keep any sparse structure
@@ -142,6 +168,7 @@ namespace dolfin
 
     /// Initialise vector with given ownership range and with ghost
     /// values
+    /// FIXME: Reimplement using init(const TensorLayout&) and deprecate
     virtual void init(MPI_Comm comm,
                       std::pair<std::size_t, std::size_t> range,
                       const std::vector<std::size_t>& local_to_global_map,
@@ -154,7 +181,7 @@ namespace dolfin
     virtual std::size_t local_size() const = 0;
 
     /// Return local ownership range of a vector
-    virtual std::pair<std::size_t, std::size_t> local_range() const = 0;
+    virtual std::pair<std::int64_t, std::int64_t> local_range() const = 0;
 
     /// Determine whether global vector index is owned by this process
     virtual bool owns_index(std::size_t i) const = 0;
diff --git a/dolfin/la/Ifpack2Preconditioner.cpp b/dolfin/la/Ifpack2Preconditioner.cpp
index 4870839..beb9fa0 100644
--- a/dolfin/la/Ifpack2Preconditioner.cpp
+++ b/dolfin/la/Ifpack2Preconditioner.cpp
@@ -31,11 +31,11 @@ Ifpack2Preconditioner::preconditioners()
   std::map<std::string, std::string> precs_available
     =   { {"none", "none"},
           {"default",    "default preconditioner"},
-          {"DIAGONAL",   "Diagonal"},
-          {"RELAXATION", "Jacobi and Gauss-Seidel type relaxation"},
-          {"CHEBYSHEV",  "Chebyshev Polynomial preconditioner"},
-          {"RILUK",      "Relaxed ILU with level k fill"},
-          {"KRYLOV",     "CG/GMRES with zero initial guess"}};
+          {"diagonal",   "Diagonal"},
+          {"relaxation", "Jacobi and Gauss-Seidel type relaxation"},
+          {"chebyshev",  "Chebyshev Polynomial preconditioner"},
+          {"riluk",      "Relaxed ILU with level k fill"},
+          {"krylov",     "CG/GMRES with zero initial guess"}};
   return precs_available;
 }
 //-----------------------------------------------------------------------------
@@ -52,7 +52,7 @@ Ifpack2Preconditioner::Ifpack2Preconditioner(std::string preconditioner)
   }
 
   if (preconditioner == "default")
-    _name = "DIAGONAL";
+    _name = "diagonal";
 }
 //-----------------------------------------------------------------------------
 Ifpack2Preconditioner::~Ifpack2Preconditioner()
diff --git a/dolfin/la/IndexMap.cpp b/dolfin/la/IndexMap.cpp
new file mode 100644
index 0000000..f1130e6
--- /dev/null
+++ b/dolfin/la/IndexMap.cpp
@@ -0,0 +1,138 @@
+// Copyright (C) 2015 Chris Richardson
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+#include <algorithm>
+#include <limits>
+#include "IndexMap.h"
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+IndexMap::IndexMap() : _block_size(1)
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+IndexMap::IndexMap(MPI_Comm mpi_comm)
+  : _mpi_comm(mpi_comm), _rank(MPI::rank(mpi_comm)), _block_size(1)
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+IndexMap::IndexMap(MPI_Comm mpi_comm, std::size_t local_size,
+                   std::size_t block_size)
+  : _mpi_comm(mpi_comm), _rank(MPI::rank(mpi_comm))
+{
+  init(local_size, block_size);
+}
+//-----------------------------------------------------------------------------
+IndexMap::~IndexMap()
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+void IndexMap::init(std::size_t local_size, std::size_t block_size)
+{
+  _block_size = block_size;
+
+  // Calculate offsets
+  MPI::all_gather(_mpi_comm, local_size, _all_ranges);
+
+  const std::size_t mpi_size = MPI::size(_mpi_comm);
+  for (std::size_t i = 1; i != mpi_size; ++i)
+    _all_ranges[i] += _all_ranges[i - 1];
+  _all_ranges.insert(_all_ranges.begin(), 0);
+}
+//-----------------------------------------------------------------------------
+std::pair<std::size_t, std::size_t> IndexMap::local_range() const
+{
+  if(_all_ranges.size() == 0)
+  {
+    warning("Asking for size of uninitialised range");
+    return std::pair<std::size_t, std::size_t>(0, 0);
+  }
+  else
+  {
+    return std::make_pair(_block_size*_all_ranges[_rank],
+                          _block_size*_all_ranges[_rank + 1]);
+  }
+}
+//-----------------------------------------------------------------------------
+std::size_t IndexMap::size(const IndexMap::MapSize type) const
+{
+  if(_all_ranges.size() == 0)
+  {
+    warning("Asking for size of uninitialised range");
+    return 0;
+  }
+
+  const std::size_t owned_size = _block_size*(_all_ranges[_rank + 1]
+                                              - _all_ranges[_rank]);
+  if (type == IndexMap::MapSize::OWNED)
+    return owned_size;
+  else if (type == IndexMap::MapSize::GLOBAL)
+    return _all_ranges.back() * _block_size;
+
+  const std::size_t unowned_size = _local_to_global.size()*_block_size;
+  if (type == IndexMap::MapSize::ALL)
+    return (owned_size + unowned_size);
+  else if (type == IndexMap::MapSize::UNOWNED)
+    return unowned_size;
+  else
+  {
+    dolfin_error("IndexMap.cpp",
+                 "get size",
+                 "Unrecognised option for IndexMap::MapSize");
+  }
+  return 0;
+}
+//-----------------------------------------------------------------------------
+const std::vector<std::size_t>& IndexMap::local_to_global_unowned() const
+{
+  return _local_to_global;
+}
+//-----------------------------------------------------------------------------
+void IndexMap::set_local_to_global(const std::vector<std::size_t>& indices)
+{
+  _local_to_global = indices;
+
+  for (const auto &node : _local_to_global)
+  {
+    const std::size_t p
+      = std::upper_bound(_all_ranges.begin(), _all_ranges.end(), node)
+      - _all_ranges.begin() - 1;
+
+    dolfin_assert(p != _rank);
+    _off_process_owner.push_back(p);
+  }
+}
+//----------------------------------------------------------------------------
+const std::vector<int>& IndexMap::off_process_owner() const
+{
+  return _off_process_owner;
+}
+//----------------------------------------------------------------------------
+int IndexMap::block_size() const
+{
+  return _block_size;
+}
+//----------------------------------------------------------------------------
+MPI_Comm IndexMap::mpi_comm() const
+{
+  return _mpi_comm;
+}
+//----------------------------------------------------------------------------
diff --git a/dolfin/la/IndexMap.h b/dolfin/la/IndexMap.h
new file mode 100644
index 0000000..a47af24
--- /dev/null
+++ b/dolfin/la/IndexMap.h
@@ -0,0 +1,133 @@
+// Copyright (C) 2015 Chris Richardson
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef __INDEX_MAP_H
+#define __INDEX_MAP_H
+
+#include <utility>
+#include <vector>
+#include <dolfin/common/MPI.h>
+
+namespace dolfin
+{
+
+  /// This class represents the distribution index arrays across
+  /// processes. An index array is a contiguous collection of N+1
+  /// indices [0, 1, . . ., N] that are distributed across processes M
+  /// processes. On a given process, the IndexMap stores a portion of
+  /// the index set using local indices [0, 1, . . . , n], and a map
+  /// from the local indices to a unique global index.
+
+  class IndexMap
+  {
+  public:
+
+    enum class MapSize : int32_t { ALL = 0,
+                                   OWNED = 1,
+                                   UNOWNED = 2,
+                                   GLOBAL = 3 };
+
+    /// Constructor
+    IndexMap();
+
+    /// Index map with no data
+    explicit IndexMap(MPI_Comm mpi_comm);
+
+    /// Index map with local size on each process. This constructor
+    /// is collective
+    IndexMap(MPI_Comm mpi_comm, std::size_t local_size, std::size_t block_size);
+
+    /// Destructor
+    ~IndexMap();
+
+    /// Initialise with number of local entries and block size. This
+    /// function is collective
+    void init(std::size_t local_size, std::size_t block_size);
+
+    /// Local range of indices
+    std::pair<std::size_t, std::size_t> local_range() const;
+
+    /// Get number of local indices of type MapSize::OWNED,
+    /// MapSize::UNOWNED, MapSize::ALL or MapSize::GLOBAL
+    std::size_t size(MapSize type) const;
+
+    /// Get local to global map for unowned indices
+    /// (local indexing beyond end of local range)
+    const std::vector<std::size_t>& local_to_global_unowned() const;
+
+    /// Get global index of local index i
+    std::size_t local_to_global(std::size_t i) const;
+
+    /// Set local_to_global map for unowned indices (beyond end of local
+    /// range). Computes and stores off-process owner array.
+    void set_local_to_global(const std::vector<std::size_t>& indices);
+
+    /// Get off process owner for unowned indices
+    const std::vector<int>& off_process_owner() const;
+
+    /// Get block size
+    int block_size() const;
+
+    /// Return MPI communicator
+    MPI_Comm mpi_comm() const;
+
+  private:
+
+    // MPI Communicator
+    MPI_Comm _mpi_comm;
+
+    // Cache rank of mpi_comm (otherwise calls to MPI_Comm_rank can be excessive)
+    unsigned int _rank;
+
+    // Range of ownership of index for all processes
+    std::vector<std::size_t> _all_ranges;
+
+    // Local to global map for off-process entries
+    std::vector<std::size_t> _local_to_global;
+
+    // Off process owner cache
+    std::vector<int> _off_process_owner;
+
+    // Block size
+    int _block_size;
+
+  };
+
+
+  // Function which may appear in a hot loop
+  inline std::size_t IndexMap::local_to_global(std::size_t i) const
+  {
+    // These two calls get hepefully optimized out of hot loops due
+    // to inlining
+    const std::size_t local_size = size(IndexMap::MapSize::OWNED);
+    const std::size_t global_offset = local_range().first;
+
+    if (i < local_size)
+      return (i + global_offset);
+    else
+    {
+      const std::div_t div = std::div((i - local_size), _block_size);
+      const int component = div.rem;
+      const int index = div.quot;
+      dolfin_assert((std::size_t) index < _local_to_global.size());
+      return _block_size*_local_to_global[index] + component;
+    }
+  }
+
+}
+
+#endif
diff --git a/dolfin/la/KrylovSolver.cpp b/dolfin/la/KrylovSolver.cpp
index adcec5f..875f18c 100644
--- a/dolfin/la/KrylovSolver.cpp
+++ b/dolfin/la/KrylovSolver.cpp
@@ -39,67 +39,49 @@ Parameters KrylovSolver::default_parameters()
 {
   Parameters p("krylov_solver");
 
-  p.add("relative_tolerance",      1.0e-6);
-  p.add("absolute_tolerance",      1.0e-15);
-  p.add("divergence_limit",        1.0e4);
-  p.add("maximum_iterations",      10000);
-  p.add("report",                  true);
-  p.add("monitor_convergence",     false);
-  p.add("error_on_nonconvergence", true);
-  p.add("nonzero_initial_guess",   false);
-
-  // GMRES options
-  Parameters p_gmres("gmres");
-  p_gmres.add("restart", 30);
-  p.add(p_gmres);
-
-  // General preconditioner options
-  Parameters p_pc("preconditioner");
-  p_pc.add("shift_nonzero", 0.0);
-
-  // Re-use options
-  std::set<std::string> structure_options;
-  structure_options.insert("same");
-  structure_options.insert("same_nonzero_pattern");
-  structure_options.insert("different_nonzero_pattern");
-  p_pc.add("structure", "different_nonzero_pattern", structure_options);
-
-  p_pc.add("report", false);
-
-  // ILU preconditioner options
-  Parameters p_pc_ilu("ilu");
-  p_pc_ilu.add("fill_level", 0);
-
-  // Schwartz preconditioner options
-  Parameters p_pc_schwarz("schwarz");
-  p_pc_schwarz.add("overlap", 1);
-
-  // Add sub-preconditioner options
-  p_pc.add(p_pc_ilu);
-  p_pc.add(p_pc_schwarz);
-
-  // Add preconditioner options
-  p.add(p_pc);
+  p.add<double>("relative_tolerance");
+  p.add<double>("absolute_tolerance");
+  p.add<double>("divergence_limit");
+  p.add<int>("maximum_iterations");
+  p.add<bool>("report");
+  p.add<bool>("monitor_convergence");
+  p.add<bool>("error_on_nonconvergence");
+  p.add<bool>("nonzero_initial_guess");
 
   return p;
 }
 //-----------------------------------------------------------------------------
-KrylovSolver::KrylovSolver(std::string method, std::string preconditioner)
+KrylovSolver::KrylovSolver(MPI_Comm comm, std::string method,
+                           std::string preconditioner)
 {
   // Initialize solver
-  init(method, preconditioner);
+  init(method, preconditioner, comm);
 }
 //-----------------------------------------------------------------------------
-KrylovSolver::KrylovSolver(std::shared_ptr<const GenericLinearOperator> A,
+KrylovSolver::KrylovSolver(std::string method, std::string preconditioner)
+  : KrylovSolver(MPI_COMM_WORLD, method, preconditioner)
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+KrylovSolver::KrylovSolver(MPI_Comm comm,
+                           std::shared_ptr<const GenericLinearOperator> A,
                            std::string method, std::string preconditioner)
 {
   // Initialize solver
-  init(method, preconditioner);
+  init(method, preconditioner, comm);
 
   // Set operator
   set_operator(A);
 }
 //-----------------------------------------------------------------------------
+KrylovSolver::KrylovSolver(std::shared_ptr<const GenericLinearOperator> A,
+                           std::string method, std::string preconditioner)
+  : KrylovSolver(MPI_COMM_WORLD, A, method, preconditioner)
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
 KrylovSolver::~KrylovSolver()
 {
   // Do nothing
@@ -122,11 +104,6 @@ KrylovSolver::set_operators(std::shared_ptr<const GenericLinearOperator> A,
   solver->set_operators(A, P);
 }
 //-----------------------------------------------------------------------------
-void KrylovSolver::set_nullspace(const VectorSpaceBasis& nullspace)
-{
-  solver->set_nullspace(nullspace);
-}
-//-----------------------------------------------------------------------------
 std::size_t KrylovSolver::solve(GenericVector& x, const GenericVector& b)
 {
   dolfin_assert(solver);
@@ -149,7 +126,7 @@ std::size_t KrylovSolver::solve(const GenericLinearOperator& A,
   return solver->solve(A, x, b);
 }
 //-----------------------------------------------------------------------------
-void KrylovSolver::init(std::string method, std::string preconditioner)
+void KrylovSolver::init(std::string method, std::string preconditioner, MPI_Comm comm)
 {
   // Get default linear algebra factory
   DefaultFactory factory;
@@ -184,7 +161,7 @@ void KrylovSolver::init(std::string method, std::string preconditioner)
   parameters = dolfin::parameters("krylov_solver");
 
   // Initialize solver
-  solver = factory.create_krylov_solver(method, preconditioner);
+  solver = factory.create_krylov_solver(comm, method, preconditioner);
   solver->parameters.update(parameters);
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/la/KrylovSolver.h b/dolfin/la/KrylovSolver.h
index 24e456b..a3e5836 100644
--- a/dolfin/la/KrylovSolver.h
+++ b/dolfin/la/KrylovSolver.h
@@ -28,6 +28,7 @@
 #include <vector>
 #include <memory>
 #include "GenericLinearSolver.h"
+#include <dolfin/common/MPI.h>
 
 namespace dolfin
 {
@@ -45,10 +46,21 @@ namespace dolfin
   public:
 
     /// Constructor
+    KrylovSolver(MPI_Comm comm,
+                 std::string method="default",
+                 std::string preconditioner="default");
+
+    /// Constructor
     KrylovSolver(std::string method="default",
                  std::string preconditioner="default");
 
     /// Constructor
+    KrylovSolver(MPI_Comm comm,
+                 std::shared_ptr<const GenericLinearOperator> A,
+                 std::string method="default",
+                 std::string preconditioner="default");
+
+    /// Constructor
     KrylovSolver(std::shared_ptr<const GenericLinearOperator> A,
                  std::string method="default",
                  std::string preconditioner="default");
@@ -63,10 +75,6 @@ namespace dolfin
     void set_operators(std::shared_ptr<const GenericLinearOperator> A,
                        std::shared_ptr<const GenericLinearOperator> P);
 
-    /// Set null space of the operator (matrix). This is used to solve
-    /// singular systems
-    void set_nullspace(const VectorSpaceBasis& nullspace);
-
     /// Solve linear system Ax = b
     std::size_t solve(GenericVector& x, const GenericVector& b);
 
@@ -95,7 +103,7 @@ namespace dolfin
   private:
 
     // Initialize solver
-    void init(std::string method, std::string preconditioner);
+    void init(std::string method, std::string preconditioner, MPI_Comm comm);
 
     // Solver
     std::shared_ptr<GenericLinearSolver> solver;
diff --git a/dolfin/la/LUSolver.cpp b/dolfin/la/LUSolver.cpp
index 12913d4..aa8c911 100644
--- a/dolfin/la/LUSolver.cpp
+++ b/dolfin/la/LUSolver.cpp
@@ -30,21 +30,33 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-LUSolver::LUSolver(std::string method)
+LUSolver::LUSolver(MPI_Comm comm, std::string method)
 {
-  init(method);
+  init(comm, method);
 }
 //-----------------------------------------------------------------------------
-LUSolver::LUSolver(std::shared_ptr<const GenericLinearOperator> A,
+LUSolver::LUSolver(std::string method) : LUSolver(MPI_COMM_WORLD, method)
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+LUSolver::LUSolver(MPI_Comm comm,
+                   std::shared_ptr<const GenericLinearOperator> A,
                    std::string method)
 {
   // Initialize solver
-  init(method);
+  init(comm, method);
 
   // Set operator
   set_operator(A);
 }
 //-----------------------------------------------------------------------------
+LUSolver::LUSolver(std::shared_ptr<const GenericLinearOperator> A,
+                   std::string method) : LUSolver(MPI_COMM_WORLD, A, method)
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
 LUSolver::~LUSolver()
 {
   // Do nothing
@@ -96,7 +108,7 @@ std::size_t LUSolver::solve_transpose(const GenericLinearOperator& A,
   return solver->solve_transpose(A, x, b);
 }
 //-----------------------------------------------------------------------------
-void LUSolver::init(std::string method)
+void LUSolver::init(MPI_Comm comm, std::string method)
 {
   // Get default linear algebra factory
   DefaultFactory factory;
@@ -118,7 +130,7 @@ void LUSolver::init(std::string method)
   parameters = dolfin::parameters("lu_solver");
 
   // Initialize solver
-  solver = factory.create_lu_solver(method);
+  solver = factory.create_lu_solver(comm, method);
   solver->parameters.update(parameters);
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/la/LUSolver.h b/dolfin/la/LUSolver.h
index 2eb68ab..82851bb 100644
--- a/dolfin/la/LUSolver.h
+++ b/dolfin/la/LUSolver.h
@@ -29,6 +29,7 @@
 #include <string>
 #include <memory>
 #include "GenericLUSolver.h"
+#include <dolfin/common/MPI.h>
 
 namespace dolfin
 {
@@ -44,9 +45,17 @@ namespace dolfin
   public:
 
     /// Constructor
+    LUSolver(MPI_Comm comm, std::string method= "default");
+
+    /// Constructor
     LUSolver(std::string method= "default");
 
     /// Constructor
+    LUSolver(MPI_Comm comm,
+             std::shared_ptr<const GenericLinearOperator> A,
+             std::string method="default");
+
+    /// Constructor
     LUSolver(std::shared_ptr<const GenericLinearOperator> A,
              std::string method="default");
 
@@ -90,16 +99,10 @@ namespace dolfin
       solver->parameters.update(parameters);
     }
 
-    // FIXME: This should not be needed. Need to cleanup linear solver
-    // name jungle: default, lu, iterative, direct, krylov, etc /
-    // Return parameter type: "krylov_solver" or "lu_solver"
-    std::string parameter_type() const
-    { return "lu_solver"; }
-
   private:
 
     // Initialize solver
-    void init(std::string method);
+    void init(MPI_Comm comm, std::string method);
 
     // Solver
     std::shared_ptr<GenericLinearSolver> solver;
diff --git a/dolfin/la/LinearAlgebraObject.h b/dolfin/la/LinearAlgebraObject.h
index 9409c07..a1ebf64 100644
--- a/dolfin/la/LinearAlgebraObject.h
+++ b/dolfin/la/LinearAlgebraObject.h
@@ -23,6 +23,7 @@
 #define __LINEAR_ALGEBRA_OBJECT_H
 
 #include <memory>
+#include <dolfin/common/MPI.h>
 #include <dolfin/common/Variable.h>
 
 namespace dolfin
@@ -110,6 +111,9 @@ namespace dolfin
     virtual std::shared_ptr<LinearAlgebraObject> shared_instance()
     { return std::shared_ptr<LinearAlgebraObject>(); }
 
+    /// Return MPI communicator
+    virtual MPI_Comm mpi_comm() const = 0;
+
   };
 
   /// Cast object to its derived class, if possible (non-const version).
diff --git a/dolfin/la/LinearOperator.cpp b/dolfin/la/LinearOperator.cpp
index d567a1b..50575b1 100644
--- a/dolfin/la/LinearOperator.cpp
+++ b/dolfin/la/LinearOperator.cpp
@@ -19,31 +19,32 @@
 // Last changed: 2012-12-12
 
 #include "DefaultFactory.h"
+#include "GenericVector.h"
 #include "LinearOperator.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
+LinearOperator::LinearOperator()
+{
+  // Initialization is postponed until the backend is accessed to
+  // enable accessing the member function size() to extract the size.
+  // The size would otherwise need to be passed to the constructor of
+  // LinearOperator which is often impractical for subclasses.
+}
+//-----------------------------------------------------------------------------
 LinearOperator::LinearOperator(const GenericVector& x,
                                const GenericVector& y)
 {
   // Create concrete implementation
   DefaultFactory factory;
-  _matA = factory.create_linear_operator();
+  _matA = factory.create_linear_operator(x.mpi_comm());
   dolfin_assert(_matA);
 
   // Initialize implementation
   _matA->init_layout(x, y, this);
 }
 //-----------------------------------------------------------------------------
-LinearOperator::LinearOperator()
-{
-  // Initialization is postponed until the backend is accessed to
-  // enable accessing the member function size() to extract the size.
-  // The size would otherwise need to be passed to the constructor of
-  // LinearOperator which is often impractical for subclasses.
-}
-//-----------------------------------------------------------------------------
 std::string LinearOperator::str(bool verbose) const
 {
   return "<User-defined linear operator>";
diff --git a/dolfin/la/LinearOperator.h b/dolfin/la/LinearOperator.h
index 68904aa..7de3f91 100644
--- a/dolfin/la/LinearOperator.h
+++ b/dolfin/la/LinearOperator.h
@@ -21,6 +21,7 @@
 #define __LINEAR_OPERATOR_H
 
 #include <memory>
+#include <dolfin/common/MPI.h>
 #include "GenericLinearOperator.h"
 
 namespace dolfin
@@ -40,13 +41,13 @@ namespace dolfin
   {
   public:
 
+    /// Create linear operator
+    LinearOperator();
+
     // Create linear operator to match parallel layout of vectors
     // x and y for product y = Ax.
     LinearOperator(const GenericVector& x, const GenericVector& y);
 
-    /// Create linear operator
-    LinearOperator();
-
     /// Destructor
     virtual ~LinearOperator() {}
 
@@ -56,6 +57,10 @@ namespace dolfin
     /// Compute matrix-vector product y = Ax
     virtual void mult(const GenericVector& x, GenericVector& y) const = 0;
 
+    /// Return the MPI communicator
+    virtual MPI_Comm mpi_comm() const
+    { dolfin_assert(_matA); return _matA->mpi_comm(); }
+
     /// Return informal string representation (pretty-print)
     std::string str(bool verbose) const;
 
diff --git a/dolfin/la/LinearSolver.cpp b/dolfin/la/LinearSolver.cpp
index df0c3bf..4dddd78 100644
--- a/dolfin/la/LinearSolver.cpp
+++ b/dolfin/la/LinearSolver.cpp
@@ -29,7 +29,8 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-LinearSolver::LinearSolver(std::string method,
+LinearSolver::LinearSolver(MPI_Comm comm,
+                           std::string method,
                            std::string preconditioner)
 {
   // Get default linear algebra factory
@@ -68,7 +69,7 @@ LinearSolver::LinearSolver(std::string method,
       method = "default";
 
     // Initialize solver
-    solver.reset(new LUSolver(method));
+    solver.reset(new LUSolver(comm, method));
 
     // Set parameter type
     _parameter_type = "lu_solver";
@@ -78,7 +79,7 @@ LinearSolver::LinearSolver(std::string method,
     // Method and preconditioner will be checked by KrylovSolver
 
     // Initialize solver
-    solver.reset(new KrylovSolver(method, preconditioner));
+    solver.reset(new KrylovSolver(comm, method, preconditioner));
 
     // Set parameter type
     _parameter_type = "krylov_solver";
diff --git a/dolfin/la/LinearSolver.h b/dolfin/la/LinearSolver.h
index 3eb97ea..8caf658 100644
--- a/dolfin/la/LinearSolver.h
+++ b/dolfin/la/LinearSolver.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2013 Anders Logg and Garth N. Wells
+// Copyright (C) 2004-2016 Anders Logg and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -15,11 +15,11 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// Modified by Garth N. Wells, 2006-2010.
-// Modified by Ola Skavhaug 2008.
+// Modified by Garth N. Wells 2006-2010
+// Modified by Ola Skavhaug 2008
 //
 // First added:  2004-06-19
-// Last changed: 2014-05-27
+// Last changed: 2016-06-22
 
 #ifndef __LINEAR_SOLVER_H
 #define __LINEAR_SOLVER_H
@@ -29,6 +29,7 @@
 #include <memory>
 #include <dolfin/common/types.h>
 #include "GenericLinearSolver.h"
+#include <dolfin/common/MPI.h>
 
 namespace dolfin
 {
@@ -46,8 +47,14 @@ namespace dolfin
   public:
 
     /// Create linear solver
-    LinearSolver(std::string method = "default",
-                 std::string preconditioner = "default");
+    explicit LinearSolver(std::string method="default",
+                          std::string preconditioner="default")
+      : LinearSolver(MPI_COMM_WORLD, method, preconditioner) {}
+
+    /// Create linear solver
+    explicit LinearSolver(MPI_Comm comm,
+                          std::string method="default",
+                          std::string preconditioner="default");
 
     /// Destructor
     ~LinearSolver();
diff --git a/dolfin/la/MUMPSLUSolver.cpp b/dolfin/la/MUMPSLUSolver.cpp
deleted file mode 100644
index f786ca0..0000000
--- a/dolfin/la/MUMPSLUSolver.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright (C) 2011 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-10-16
-// Last changed:
-
-
-#include <vector>
-
-#include "dolfin/common/NoDeleter.h"
-#include "dolfin/common/MPI.h"
-#include "dolfin/common/types.h"
-#include "dolfin/log/log.h"
-#include "dolfin/log/LogStream.h"
-#include "CoordinateMatrix.h"
-#include "GenericVector.h"
-#include "LUSolver.h"
-#include "MUMPSLUSolver.h"
-
-#ifdef PETSC_HAVE_MUMPS
-
-using namespace dolfin;
-
-// Macros to match MUMPS documentation (C/Fortran indexing issue)
-#define ICNTL(I) icntl[(I)-1]
-#define CNTL(I) cntl[(I)-1]
-#define INFOG(I) infog[(I)-1]
-#define INFO(I) info[(I)-1]
-#define RINFOG(I) rinfog[(I)-1]
-#define RINFO(I) rinfo[(I)-1]
-
-//-----------------------------------------------------------------------------
-Parameters MUMPSLUSolver::default_parameters()
-{
-  Parameters p(LUSolver::default_parameters());
-  p.rename("mumps_lu_solver");
-
-  return p;
-}
-//-----------------------------------------------------------------------------
-MUMPSLUSolver::MUMPSLUSolver(const CoordinateMatrix& A)
-  : _matA(reference_to_no_delete_pointer(A))
-{
-  // Set parameter values
-  parameters = default_parameters();
-}
-//-----------------------------------------------------------------------------
-MUMPSLUSolver::MUMPSLUSolver(std::shared_ptr<const CoordinateMatrix> A)
-  : _matA(A)
-{
-  // Set parameter values
-  parameters = default_parameters();
-}
-//-----------------------------------------------------------------------------
-MUMPSLUSolver::~MUMPSLUSolver()
-{
-  // Do nothing
-}
-//-----------------------------------------------------------------------------
-std::size_t MUMPSLUSolver::solve(GenericVector& x, const GenericVector& b)
-{
-  dolfin_assert(_matA);
-
-  DMUMPS_STRUC_C data;
-
-  data.comm_fortran = -987654;
-
-  // Initialise
-  data.job = -1;
-
-  // Host participates in solve
-  data.par = 1;
-
-  // Output related parameters
-  //data.ICNTL(1) = 6; // error messages
-  //data.ICNTL(2) = 0;
-  //data.ICNTL(3) = 6; // Global information
-  //data.ICNTL(3) = 6; // Global information
-  if (parameters["verbose"])
-    data.ICNTL(4) = 2;
-  else
-    data.ICNTL(4) = 1;
-
-  // Matrix symmetry (0=non-symmetric, 2=symmetric positive defn, 2=symmetric)
-  data.sym = 0;
-  if (parameters["symmetric"])
-    data.sym = 2;
-
-  // Initialise MUMPS
-  dmumps_c(&data);
-
-  // Related to use of ScaLAPACK (+/-. Negative is faster?)
-  //data.ICNTL(13) = -1;
-
-  // Solve transpose (1: A x = b, otherwise A^T x = b)
-  data.ICNTL(9) = 1;
-
-  // FIXME (20=default)
-  data.ICNTL(14) = 20;
-
-  // Reordering (7=automatic)
-  data.ICNTL(7) = 7;
-
-  // Control solution vector (0=solution on root, 1=solution distributed)
-  data.ICNTL(21) = 1;
-
-  // Distributed matrix
-  data.ICNTL(18) = 3;
-
-  // Parallel/serial analysis (0=auto, 1=serial, 2=parallel)
-  if (MPI::size(_matA->mpi_comm()) > 1)
-    data.ICNTL(28) = 2;
-  else
-    data.ICNTL(28) = 0;
-
-  // Parallel graph partitioning library (0=auto, 1=pt-scotch, 2=parmetis)
-  data.ICNTL(29) = 0;
-
-  // Global size
-  dolfin_assert(_matA->size(0) == _matA->size(1));
-  data.n = _matA->size(0);
-
-  if (!_matA->base_one())
-    error("MUMPS requires a CoordinateMatrix with Fortran-style base 1 indexing.");
-
-  // Get matrix coordinate and value data
-  const std::vector<std::size_t>& rows = _matA->rows();
-  const std::vector<std::size_t>& cols = _matA->columns();
-  const std::vector<double>& vals = _matA->values();
-
-  // Number of non-zero entries on this process
-  data.nz_loc = rows.size();
-
-  // Pass matrix data to MUMPS. Trust MUMPS not to change it
-  data.irn_loc = const_cast<int*>(reinterpret_cast<const int*>(rows.data()));
-  data.jcn_loc = const_cast<int*>(reinterpret_cast<const int*>(cols.data()));
-  data.a_loc   = const_cast<double*>(vals.data());
-
-  // Analyse and factorize
-  data.job = 4;
-  dmumps_c(&data);
-  if (data.INFOG(1) < 0)
-    error("MUMPS reported an error during the analysis and factorisation.");
-
-  cout << "Factorisation finished" << endl;
-
-  // Gather RHS on root process and attach
-  std::vector<double> _b;
-  b.gather_on_zero(_b);
-  data.rhs = _b.data();
-
-  // Scaling strategy (77 is default)
-  data.ICNTL(8) = 77;
-
-  // Get size of local solution vector x and create objects to hold solution
-  const std::size_t local_x_size = data.INFO(23);
-  std::vector<int> x_local_indices(local_x_size);
-  std::vector<double> x_local_vals(local_x_size);
-
-  // Attach solution data to MUMPS object
-  data.lsol_loc = local_x_size;
-  data.sol_loc  = x_local_vals.data();
-  data.isol_loc = x_local_indices.data();
-
-  // Solve problem
-  data.job = 3;
-  dmumps_c(&data);
-  if (data.INFOG(1) < 0)
-    error("MUMPS reported an error during the solve.");
-
-  // Shift indices by -1
-  for (std::size_t i = 0; i < local_x_size ; ++i)
-    x_local_indices[i]--;
-
-  // Set x values
-  #if defined(PETSC_USE_64BIT_INDICES)
-  // Cast indices to 64 bit
-  std::vector<dolfin::la_index> _x_local_indices(x_local_indices.begin(),
-                                                 x_local_indices.end());
-  x.set_local(x_local_vals.data(), x_local_indices.size(),
-              _x_local_indices.data());
-  #else
-  x.set_local(x_local_vals.data(), x_local_indices.size(),
-              x_local_indices.data());
-  #endif
-  x.apply("insert");
-
-  // Clean up
-  data.job = -2;
-  dmumps_c(&data);
-
-  return 1;
-}
-//-----------------------------------------------------------------------------
-#endif
diff --git a/dolfin/la/MUMPSLUSolver.h b/dolfin/la/MUMPSLUSolver.h
deleted file mode 100644
index b12de2d..0000000
--- a/dolfin/la/MUMPSLUSolver.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2011 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Garth N. Wells, 2009-2010.
-//
-// First added:  2011-10-16
-// Last changed:
-
-#ifndef __DOLFIN_MUMPS_LU_SOLVER_H
-#define __DOLFIN_MUMPS_LU_SOLVER_H
-
-#include <memory>
-#include <dolfin/common/Variable.h>
-
-#ifdef HAS_PETSC
-#include <petscconf.h>
-#endif
-
-#ifdef PETSC_HAVE_MUMPS
-
-extern "C"
-{
-#include "dmumps_c.h"
-}
-
-namespace dolfin
-{
-  /// Forward declarations
-  class CoordinateMatrix;
-  class GenericVector;
-
-  /// This class implements the direct solution (LU factorization) for
-  /// linear systems of the form Ax = b. It is a wrapper for the MUMPS
-  /// LU solver.
-
-  class MUMPSLUSolver : public Variable
-  {
-  public:
-
-    /// Constructor
-    MUMPSLUSolver(const CoordinateMatrix& A);
-
-    /// Constructor
-    MUMPSLUSolver(std::shared_ptr<const CoordinateMatrix> A);
-
-    /// Destructor
-    ~MUMPSLUSolver();
-
-    /// Solve linear system Ax = b
-    std::size_t solve(GenericVector& x, const GenericVector& b);
-
-    /// Default parameter values
-    static Parameters default_parameters();
-
-  private:
-
-    // Operator (the matrix)
-    std::shared_ptr<const CoordinateMatrix> _matA;
-
-  };
-
-}
-
-#endif
-
-#endif
diff --git a/dolfin/la/Matrix.h b/dolfin/la/Matrix.h
index 36f40c5..53a4f70 100644
--- a/dolfin/la/Matrix.h
+++ b/dolfin/la/Matrix.h
@@ -44,10 +44,10 @@ namespace dolfin
   public:
 
     /// Create empty matrix
-    Matrix()
+    Matrix(MPI_Comm comm=MPI_COMM_WORLD)
     {
       DefaultFactory factory;
-      matrix = factory.create_matrix();
+      matrix = factory.create_matrix(comm);
     }
 
     /// Copy constructor
@@ -74,7 +74,7 @@ namespace dolfin
     { return matrix->size(dim); }
 
     /// Return local ownership range
-    virtual std::pair<std::size_t, std::size_t>
+    virtual std::pair<std::int64_t, std::int64_t>
       local_range(std::size_t dim) const
     { return matrix->local_range(dim); }
 
diff --git a/dolfin/la/MueluPreconditioner.cpp b/dolfin/la/MueluPreconditioner.cpp
index 13e3dbb..b2fb77b 100644
--- a/dolfin/la/MueluPreconditioner.cpp
+++ b/dolfin/la/MueluPreconditioner.cpp
@@ -22,6 +22,7 @@
 #include "BelosKrylovSolver.h"
 #include "KrylovSolver.h"
 #include "MueluPreconditioner.h"
+#include "TrilinosParameters.h"
 
 using namespace dolfin;
 
@@ -39,29 +40,17 @@ MueluPreconditioner::~MueluPreconditioner()
 //-----------------------------------------------------------------------------
 void MueluPreconditioner::init(std::shared_ptr<const TpetraMatrix> P)
 {
-  Teuchos::ParameterList paramList;
-  paramList.set("verbosity", "extreme");
-
-  paramList.set("max levels", 3);
-  paramList.set("coarse: max size", 10);
-  paramList.set("coarse: type", "Klu2");
-  paramList.set("multigrid algorithm", "sa");
-  paramList.set("smoother: type", "RELAXATION");
-
-  Teuchos::ParameterList sparamList;
-  sparamList.set("relaxation: type", "Jacobi");
-  sparamList.set("relaxation: sweeps", 1);
-  sparamList.set("relaxation: damping factor", 0.9);
-  paramList.set("smoother: params", sparamList);
-
-  paramList.set("aggregation: type", "uncoupled");
-  paramList.set("aggregation: min agg size", 3);
-  paramList.set("aggregation: max agg size", 9);
+  // Generate Trilinos parameters from dolfin parameters
+  Teuchos::RCP<Teuchos::ParameterList> paramList(new Teuchos::ParameterList);
+  TrilinosParameters::insert_parameters(parameters, paramList);
 
   // FIXME: why does it need to be non-const when Ifpack2 uses const?
+  std::shared_ptr<TpetraMatrix> P_non_const
+    = std::const_pointer_cast<TpetraMatrix>(P);
+
   _prec = MueLu::CreateTpetraPreconditioner(
-    std::const_pointer_cast<TpetraMatrix>(P)->mat(),
-    paramList);
+                Teuchos::rcp_dynamic_cast<op_type>(P_non_const->mat()),
+                *paramList);
 }
 //-----------------------------------------------------------------------------
 void MueluPreconditioner::set(BelosKrylovSolver& solver)
@@ -76,16 +65,19 @@ std::string MueluPreconditioner::str(bool verbose) const
   if (verbose)
     s << _prec->description() << std::endl;
 
+  // Print off all the possible parameters
+  // FIXME: pipe this to stringstream and output when verbose is set
+  // Teuchos::RCP<const Teuchos::ParameterList> pList = MueLu::MasterList::List();
+  // pList->print();
+
   return s.str();
 }
 //-----------------------------------------------------------------------------
 Parameters MueluPreconditioner::default_parameters()
 {
-  Parameters p(KrylovSolver::default_parameters()("preconditioner"));
+  Parameters p("muelu_preconditioner");
   p.rename("muelu_preconditioner");
-
-  Teuchos::RCP<const Teuchos::ParameterList> pList = MueLu::MasterList::List();
-  pList->print();
+  p.add("verbosity", "low");
 
   return p;
 }
diff --git a/dolfin/la/MueluPreconditioner.h b/dolfin/la/MueluPreconditioner.h
index 12b295f..a518adc 100644
--- a/dolfin/la/MueluPreconditioner.h
+++ b/dolfin/la/MueluPreconditioner.h
@@ -62,6 +62,9 @@ namespace dolfin
 
   private:
 
+    typedef Tpetra::Operator<double, int, dolfin::la_index,
+                             TpetraVector::node_type> op_type;
+
     typedef MueLu::TpetraOperator<double, int, dolfin::la_index,
                                   TpetraVector::node_type> prec_type;
 
diff --git a/dolfin/la/PETScBaseMatrix.cpp b/dolfin/la/PETScBaseMatrix.cpp
index e8742cd..533db7d 100644
--- a/dolfin/la/PETScBaseMatrix.cpp
+++ b/dolfin/la/PETScBaseMatrix.cpp
@@ -20,6 +20,7 @@
 
 #ifdef HAS_PETSC
 
+#include <petscvec.h>
 #include <dolfin/log/log.h>
 #include "GenericVector.h"
 #include "PETScVector.h"
@@ -30,9 +31,15 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 PETScBaseMatrix::PETScBaseMatrix(Mat A) : _matA(A)
 {
-  // Increase reference count
+  // Increase reference count, and throw error if Mat pointer is NULL
   if (_matA)
     PetscObjectReference((PetscObject)_matA);
+  else
+  {
+    dolfin_error("PETScBaseMatrix.cpp",
+                 "intialise with PETSc Mat pointer",
+                 "Cannot wrap PETSc Mat objects that have not been intialized");
+  }
 }
 //-----------------------------------------------------------------------------
 PETScBaseMatrix::~PETScBaseMatrix()
@@ -59,21 +66,26 @@ std::size_t PETScBaseMatrix::size(std::size_t dim) const
                  "Illegal axis (%d), must be 0 or 1", dim);
   }
 
-  if (_matA)
-  {
-    PetscInt m(0), n(0);
-    PetscErrorCode ierr = MatGetSize(_matA, &m, &n);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MetGetSize");
-    if (dim == 0)
-      return m;
-    else
-      return n;
-  }
+  dolfin_assert(_matA);
+  PetscInt m(0), n(0);
+  PetscErrorCode ierr = MatGetSize(_matA, &m, &n);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MetGetSize");
+  if (dim == 0)
+    return m > 0 ? m : 0;
   else
-    return 0;
+    return n > 0 ? n : 0;
+}
+//-----------------------------------------------------------------------------
+std::pair<std::int64_t, std::int64_t> PETScBaseMatrix::size() const
+{
+  dolfin_assert(_matA);
+  PetscInt m(0), n(0);
+  PetscErrorCode ierr = MatGetSize(_matA, &m, &n);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MetGetSize");
+  return {m, n};
 }
 //-----------------------------------------------------------------------------
-std::pair<std::size_t, std::size_t>
+std::pair<std::int64_t, std::int64_t>
 PETScBaseMatrix::local_range(std::size_t dim) const
 {
   dolfin_assert(dim <= 1);
@@ -84,47 +96,32 @@ PETScBaseMatrix::local_range(std::size_t dim) const
                  "Only local row range is available for PETSc matrices");
   }
 
-  if (_matA)
-  {
-    PetscInt m(0), n(0);
-    PetscErrorCode ierr = MatGetOwnershipRange(_matA, &m, &n);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatGetOwnershipRange");
-    return std::make_pair(m, n);
-  }
-  else
-    return std::make_pair(0, 0);
+  dolfin_assert(_matA);
+  PetscInt m(0), n(0);
+  PetscErrorCode ierr = MatGetOwnershipRange(_matA, &m, &n);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatGetOwnershipRange");
+  return {m, n};
 }
 //-----------------------------------------------------------------------------
 void PETScBaseMatrix::init_vector(GenericVector& z, std::size_t dim) const
 {
   dolfin_assert(_matA);
-
   PetscErrorCode ierr;
 
   // Downcast vector
   PETScVector& _z = as_type<PETScVector>(z);
 
   // Create new PETSc vector
-  Vec x = NULL;
+  Vec x = nullptr;
   if (dim == 0)
   {
-    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 5
-    ierr = MatGetVecs(_matA, PETSC_NULL, &x);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatGetVecs");
-    #else
-    ierr = MatCreateVecs(_matA, PETSC_NULL, &x);
+    ierr = MatCreateVecs(_matA, NULL, &x);
     if (ierr != 0) petsc_error(ierr, __FILE__, "MatCreateVecs");
-    #endif
   }
   else if (dim == 1)
   {
-    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 5
-    ierr = MatGetVecs(_matA, &x, PETSC_NULL);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatGetVecs");
-    #else
-    ierr = MatCreateVecs(_matA, &x, PETSC_NULL);
+    ierr = MatCreateVecs(_matA, &x, NULL);
     if (ierr != 0) petsc_error(ierr, __FILE__, "MatCreateVecs");
-    #endif
   }
   else
   {
@@ -133,8 +130,20 @@ void PETScBaseMatrix::init_vector(GenericVector& z, std::size_t dim) const
                  "Dimension must be 0 or 1, not %d", dim);
   }
 
-  // Associate new PETSc vector with _z
-  _z._x = x;
+  // Associate new PETSc Vec with _z (this will increase the reference
+  // count to x)
+  _z.reset(x);
+
+  // Decrease reference count
+  VecDestroy(&x);
+}
+//-----------------------------------------------------------------------------
+MPI_Comm PETScBaseMatrix::mpi_comm() const
+{
+  dolfin_assert(_matA);
+  MPI_Comm mpi_comm = MPI_COMM_NULL;
+  PetscObjectGetComm((PetscObject)_matA, &mpi_comm);
+  return mpi_comm;
 }
 //-----------------------------------------------------------------------------
 
diff --git a/dolfin/la/PETScBaseMatrix.h b/dolfin/la/PETScBaseMatrix.h
index d996843..aa3b7fd 100644
--- a/dolfin/la/PETScBaseMatrix.h
+++ b/dolfin/la/PETScBaseMatrix.h
@@ -25,19 +25,23 @@
 
 #ifdef HAS_PETSC
 
+#include <cinttypes>
+#include <cstddef>
+#include <memory>
 #include <string>
 #include <utility>
-#include <memory>
 #include <petscmat.h>
 
 #include <dolfin/common/types.h>
 #include <dolfin/common/Variable.h>
 #include "PETScObject.h"
+#include "PETScVector.h"
 
 namespace dolfin
 {
 
   class GenericVector;
+  class PETScVector;
 
   /// This class is a base class for matrices that can be used in
   /// PETScKrylovSolver.
@@ -47,7 +51,7 @@ namespace dolfin
   public:
 
     /// Constructor
-    PETScBaseMatrix() : _matA(NULL) {}
+    PETScBaseMatrix() : _matA(nullptr) {}
 
     /// Constructor
     explicit PETScBaseMatrix(Mat A);
@@ -61,8 +65,12 @@ namespace dolfin
     /// Return number of rows (dim = 0) or columns (dim = 1)
     std::size_t size(std::size_t dim) const;
 
+    /// Return number of rows and columns (num_rows, num_cols). PETSc
+    /// returns -1 if size has not been set.
+    std::pair<std::int64_t, std::int64_t> size() const;
+
     /// Return local range along dimension dim
-    std::pair<std::size_t, std::size_t> local_range(std::size_t dim) const;
+    std::pair<std::int64_t, std::int64_t> local_range(std::size_t dim) const;
 
     /// Initialize vector to be compatible with the matrix-vector product
     /// y = Ax. In the parallel case, both size and layout are
@@ -77,6 +85,9 @@ namespace dolfin
     Mat mat() const
     { return _matA; }
 
+    /// Return the MPI communicator
+    MPI_Comm mpi_comm() const;
+
     /// Return informal string representation (pretty-print)
     virtual std::string str(bool verbose) const = 0;
 
diff --git a/dolfin/la/PETScFactory.cpp b/dolfin/la/PETScFactory.cpp
index ed64f81..6b21320 100644
--- a/dolfin/la/PETScFactory.cpp
+++ b/dolfin/la/PETScFactory.cpp
@@ -35,49 +35,43 @@ using namespace dolfin;
 PETScFactory PETScFactory::factory;
 
 //-----------------------------------------------------------------------------
-std::shared_ptr<GenericMatrix> PETScFactory::create_matrix() const
+std::shared_ptr<GenericMatrix> PETScFactory::create_matrix(MPI_Comm comm) const
 {
-  std::shared_ptr<GenericMatrix> A(new PETScMatrix);
-  return A;
+  return std::make_shared<PETScMatrix>(comm);
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<GenericVector> PETScFactory:: create_vector() const
+std::shared_ptr<GenericVector> PETScFactory:: create_vector(MPI_Comm comm) const
 {
-  std::shared_ptr<GenericVector> x(new PETScVector);
-  return x;
+  return std::make_shared<PETScVector>(comm);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<TensorLayout>
 PETScFactory::create_layout(std::size_t rank) const
 {
-  bool sparsity = false;
+  TensorLayout::Sparsity sparsity = TensorLayout::Sparsity::DENSE;
   if (rank > 1)
-    sparsity = true;
-  std::shared_ptr<TensorLayout> pattern(new TensorLayout(0, sparsity));
-  return pattern;
+    sparsity = TensorLayout::Sparsity::SPARSE;
+  return std::make_shared<TensorLayout>(0, sparsity);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericLinearOperator>
-PETScFactory::create_linear_operator() const
+PETScFactory::create_linear_operator(MPI_Comm comm) const
 {
-  std::shared_ptr<GenericLinearOperator> A(new PETScLinearOperator);
-  return A;
+  return std::make_shared<PETScLinearOperator>(comm);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericLUSolver>
-PETScFactory::create_lu_solver(std::string method) const
+PETScFactory::create_lu_solver(MPI_Comm comm, std::string method) const
 {
-  std::shared_ptr<GenericLUSolver> solver(new PETScLUSolver(method));
-  return solver;
+  return std::make_shared<PETScLUSolver>(comm, method);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericLinearSolver>
-PETScFactory::create_krylov_solver(std::string method,
+PETScFactory::create_krylov_solver(MPI_Comm comm,
+                                   std::string method,
                                    std::string preconditioner) const
 {
-  std::shared_ptr<GenericLinearSolver>
-    solver(new PETScKrylovSolver(method, preconditioner));
-  return solver;
+  return std::make_shared<PETScKrylovSolver>(comm, method, preconditioner);
 }
 //-----------------------------------------------------------------------------
 std::map<std::string, std::string> PETScFactory::lu_solver_methods() const
diff --git a/dolfin/la/PETScFactory.h b/dolfin/la/PETScFactory.h
index 559707e..bb66e5d 100644
--- a/dolfin/la/PETScFactory.h
+++ b/dolfin/la/PETScFactory.h
@@ -46,23 +46,26 @@ namespace dolfin
     virtual ~PETScFactory() {}
 
     /// Create empty matrix
-    std::shared_ptr<GenericMatrix> create_matrix() const;
+    std::shared_ptr<GenericMatrix> create_matrix(MPI_Comm comm) const;
 
     /// Create empty vector
-    std::shared_ptr<GenericVector> create_vector() const;
+    std::shared_ptr<GenericVector> create_vector(MPI_Comm comm) const;
 
     /// Create empty tensor layout
     std::shared_ptr<TensorLayout> create_layout(std::size_t rank) const;
 
     /// Create empty linear operator
-    std::shared_ptr<GenericLinearOperator> create_linear_operator() const;
+    std::shared_ptr<GenericLinearOperator>
+      create_linear_operator(MPI_Comm comm) const;
 
     /// Create LU solver
-    std::shared_ptr<GenericLUSolver> create_lu_solver(std::string method) const;
+    std::shared_ptr<GenericLUSolver> create_lu_solver(MPI_Comm comm,
+                                                      std::string method) const;
 
     /// Create Krylov solver
     std::shared_ptr<GenericLinearSolver>
-    create_krylov_solver(std::string method,
+    create_krylov_solver(MPI_Comm comm,
+                         std::string method,
                          std::string preconditioner) const;
 
     /// Return a list of available LU solver methods
diff --git a/dolfin/la/PETScKrylovSolver.cpp b/dolfin/la/PETScKrylovSolver.cpp
index 392ce21..41a3ebf 100644
--- a/dolfin/la/PETScKrylovSolver.cpp
+++ b/dolfin/la/PETScKrylovSolver.cpp
@@ -39,7 +39,7 @@
 
 using namespace dolfin;
 
-// Mapping from method string to PETSc
+// Map from method string to PETSc (for subset of PETSc solvers)
 const std::map<std::string, const KSPType> PETScKrylovSolver::_methods
 = { {"default",  ""},
     {"cg",         KSPCG},
@@ -51,7 +51,7 @@ const std::map<std::string, const KSPType> PETScKrylovSolver::_methods
     {"nash",       KSPNASH},
     {"stcg",       KSPSTCG} };
 
-// Mapping from method string to description
+// Map from method string to description
 const std::map<std::string, std::string>
 PETScKrylovSolver::_methods_descr
 =
@@ -64,14 +64,12 @@ PETScKrylovSolver::_methods_descr
   {"bicgstab",   "Biconjugate gradient stabilized method"} };
 
 //-----------------------------------------------------------------------------
-std::map<std::string, std::string>
-PETScKrylovSolver::methods()
+std::map<std::string, std::string> PETScKrylovSolver::methods()
 {
   return PETScKrylovSolver::_methods_descr;
 }
 //-----------------------------------------------------------------------------
-std::map<std::string, std::string>
-PETScKrylovSolver::preconditioners()
+std::map<std::string, std::string> PETScKrylovSolver::preconditioners()
 {
   return PETScPreconditioner::preconditioners();
 }
@@ -81,24 +79,20 @@ Parameters PETScKrylovSolver::default_parameters()
   Parameters p(KrylovSolver::default_parameters());
   p.rename("petsc_krylov_solver");
 
-  // Norm type used in convergence test
-  std::set<std::string> allowed_norm_types;
-  allowed_norm_types.insert("preconditioned");
-  allowed_norm_types.insert("true");
-  allowed_norm_types.insert("none");
-  p.add("convergence_norm_type", allowed_norm_types);
+  // Allowed norm type used in convergence test (none set)
+  std::set<std::string> allowed_norms = {"preconditioned", "true", "natural", "none"};
+  p.add("convergence_norm_type", allowed_norms);
 
   return p;
 }
 //-----------------------------------------------------------------------------
-PETScKrylovSolver::PETScKrylovSolver(std::string method,
+PETScKrylovSolver::PETScKrylovSolver(MPI_Comm comm, std::string method,
                                      std::string preconditioner)
   : _ksp(NULL), pc_dolfin(NULL),
-    _preconditioner(new PETScPreconditioner(preconditioner)),
-    petsc_nullspace(NULL), preconditioner_set(false)
+    preconditioner_set(false)
 {
-  // Check that the requested method is known
-  if (_methods.count(method) == 0)
+   // Check that the requested method is known
+  if (_methods.find(method) == _methods.end())
   {
     dolfin_error("PETScKrylovSolver.cpp",
                  "create PETSc Krylov solver",
@@ -108,74 +102,115 @@ PETScKrylovSolver::PETScKrylovSolver(std::string method,
   // Set parameter values
   parameters = default_parameters();
 
-  init(method);
+  PetscErrorCode ierr;
+
+  // Create PETSc KSP object
+  ierr = KSPCreate(comm, &_ksp);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPCreate");
+
+  // Set Krylov solver type
+  if (method != "default")
+  {
+    ierr = KSPSetType(_ksp, _methods.find(method)->second);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType");
+  }
+
+  // Set preconditioner type
+  PETScPreconditioner::set_type(*this, preconditioner);
 }
 //-----------------------------------------------------------------------------
 PETScKrylovSolver::PETScKrylovSolver(std::string method,
-                                     PETScPreconditioner& preconditioner)
-  : _ksp(NULL),
-    pc_dolfin(NULL),
-    _preconditioner(reference_to_no_delete_pointer(preconditioner)),
-    petsc_nullspace(NULL),
-    preconditioner_set(false)
+                                     std::string preconditioner)
+  : PETScKrylovSolver(MPI_COMM_WORLD, method, preconditioner)
 {
-  // Set parameter values
-  parameters = default_parameters();
-
-  init(method);
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
-PETScKrylovSolver::PETScKrylovSolver(std::string method,
+PETScKrylovSolver::PETScKrylovSolver(MPI_Comm comm, std::string method,
   std::shared_ptr<PETScPreconditioner> preconditioner)
   : _ksp(NULL), pc_dolfin(NULL), _preconditioner(preconditioner),
-  petsc_nullspace(NULL),
   preconditioner_set(false)
 {
   // Set parameter values
   parameters = default_parameters();
 
-  init(method);
+  PetscErrorCode ierr;
+
+  // Create PETSc KSP object
+  ierr = KSPCreate(comm, &_ksp);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPCreate");
+
+  // Set Krylov solver type
+  if (method != "default")
+  {
+    ierr = KSPSetType(_ksp, _methods.find(method)->second);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType");
+  }
 }
 //-----------------------------------------------------------------------------
 PETScKrylovSolver::PETScKrylovSolver(std::string method,
-                                     PETScUserPreconditioner& preconditioner)
-  : _ksp(NULL), pc_dolfin(&preconditioner), petsc_nullspace(NULL),
-    preconditioner_set(false)
+  std::shared_ptr<PETScPreconditioner> preconditioner)
+  : PETScKrylovSolver(MPI_COMM_WORLD, method, preconditioner)
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+PETScKrylovSolver::PETScKrylovSolver(MPI_Comm comm,
+                                     std::string method,
+                                     std::shared_ptr<PETScUserPreconditioner> preconditioner)
+  : _ksp(NULL), pc_dolfin(preconditioner.get()), preconditioner_set(false)
 {
   // Set parameter values
-  parameters = default_parameters();
+  this->parameters = default_parameters();
+
+  PetscErrorCode ierr;
+
+  // Create PETSc KSP object
+  ierr = KSPCreate(comm, &_ksp);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPCreate");
 
-  init(method);
+  // Set Krylov solver type
+  if (method != "default")
+  {
+    ierr = KSPSetType(_ksp, _methods.find(method)->second);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType");
+  }
 }
 //-----------------------------------------------------------------------------
 PETScKrylovSolver::PETScKrylovSolver(std::string method,
-  std::shared_ptr<PETScUserPreconditioner> preconditioner)
-  : _ksp(NULL), pc_dolfin(preconditioner.get()), petsc_nullspace(NULL),
-    preconditioner_set(false)
+                                     std::shared_ptr<PETScUserPreconditioner> preconditioner)
+  : PETScKrylovSolver(MPI_COMM_WORLD, method, preconditioner)
 {
-  // Set parameter values
-  parameters = default_parameters();
-
-  init(method);
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
-PETScKrylovSolver::PETScKrylovSolver(KSP ksp)
-  : _ksp(ksp), pc_dolfin(0), petsc_nullspace(NULL), preconditioner_set(true)
+PETScKrylovSolver::PETScKrylovSolver(KSP ksp) : _ksp(ksp), pc_dolfin(0),
+                                                preconditioner_set(true)
 {
   // Set parameter values
-  parameters = default_parameters();
+  this->parameters = default_parameters();
 
-  // Increment reference count
+  PetscErrorCode ierr;
   if (_ksp)
-    PetscObjectReference((PetscObject)_ksp);
+  {
+    // Increment reference count since we holding a pointer to it
+    ierr = PetscObjectReference((PetscObject)_ksp);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "PetscObjectReference");
+  }
+  else
+  {
+    dolfin_error("PETScKrylovSolver.cpp",
+                 "intialise PETScKrylovSolver with PETSc KSP object",
+                 "PETSc KSP must be initialised (KSPCreate) before wrapping");
+  }
 }
 //-----------------------------------------------------------------------------
 PETScKrylovSolver::~PETScKrylovSolver()
 {
+  // Decrease reference count for KSP object, and clean-up if
+  // reference count goes to zero.
   if (_ksp)
     KSPDestroy(&_ksp);
-  if (petsc_nullspace)
-    MatNullSpaceDestroy(&petsc_nullspace);
 }
 //-----------------------------------------------------------------------------
 void
@@ -185,84 +220,22 @@ PETScKrylovSolver::set_operator(std::shared_ptr<const GenericLinearOperator> A)
 }
 //-----------------------------------------------------------------------------
 void PETScKrylovSolver::set_operators(
-  std::shared_ptr<const  GenericLinearOperator> A,
+  std::shared_ptr<const GenericLinearOperator> A,
   std::shared_ptr<const GenericLinearOperator> P)
 {
   _set_operators(as_type<const PETScBaseMatrix>(A),
                  as_type<const PETScBaseMatrix>(P));
 }
 //-----------------------------------------------------------------------------
-void PETScKrylovSolver::set_nullspace(const VectorSpaceBasis& nullspace)
-{
-#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 5
-
-  deprecation("PETScKrylovSolver::set_nullspace",
-              "1.6.0", "1.7.0",
-              "Attach the null space to the matrix insetad");
-
-  PetscErrorCode ierr;
-
-  // Copy vectors
-  for (std::size_t i = 0; i < nullspace.dim(); ++i)
-  {
-    dolfin_assert(nullspace[i]);
-    const PETScVector& x = nullspace[i]->down_cast<PETScVector>();
-
-    // Copy vector
-    _nullspace.push_back(x);
-  }
-
-  // Get pointers to underlying PETSc objects and normalize vectors
-  std::vector<Vec> petsc_vec(nullspace.dim());
-  for (std::size_t i = 0; i < nullspace.dim(); ++i)
-  {
-    petsc_vec[i] = _nullspace[i].vec();
-    PetscReal val = 0.0;
-    ierr = VecNormalize(_nullspace[i].vec(), &val);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "VecNormalize");
-  }
-
-  // Create null space
-  if (petsc_nullspace)
-    MatNullSpaceDestroy(&petsc_nullspace);
-  ierr = MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_FALSE, nullspace.dim(),
-                            petsc_vec.data(), &petsc_nullspace);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "MatNullSpaceCreate");
-
-  // Set null space
-  dolfin_assert(_ksp);
-  ierr = KSPSetNullSpace(_ksp, petsc_nullspace);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetNullSpace");
-
-#else
-  dolfin_error("PETScKrylovSolver.cpp",
-               "set null space for solver",
-               "For PETSc version > 3.5 nullspace must be attached to matrix");
-#endif
-}
-//-----------------------------------------------------------------------------
-const PETScBaseMatrix& PETScKrylovSolver::get_operator() const
-{
-  if (!_matA)
-  {
-    dolfin_error("PETScKrylovSolver.cpp",
-                 "access operator for PETSc Krylov solver",
-                 "Operator has not been set");
-  }
-  return *_matA;
-}
-//-----------------------------------------------------------------------------
 std::size_t PETScKrylovSolver::solve(GenericVector& x, const GenericVector& b)
 {
   return solve(as_type<PETScVector>(x), as_type<const PETScVector>(b));
 }
 //-----------------------------------------------------------------------------
 std::size_t PETScKrylovSolver::solve(const GenericLinearOperator& A,
-                                     GenericVector& x,
-                                     const GenericVector& b)
+                                     GenericVector& x, const GenericVector& b)
 {
-  return _solve(as_type<const PETScBaseMatrix>(A),
-                as_type<PETScVector>(x),
+  return _solve(as_type<const PETScBaseMatrix>(A), as_type<PETScVector>(x),
                 as_type<const PETScVector>(b));
 }
 //-----------------------------------------------------------------------------
@@ -287,37 +260,46 @@ std::size_t PETScKrylovSolver::solve(PETScVector& x, const PETScVector& b)
   }
 
   // Write a message
-  const bool report = parameters["report"];
-  if (report && dolfin::MPI::rank(PETSC_COMM_WORLD) == 0)
+  const bool report = this->parameters["report"].is_set() ? this->parameters["report"] : false;
+  if (report and dolfin::MPI::rank(this->mpi_comm()) == 0)
   {
     info("Solving linear system of size %ld x %ld (PETSc Krylov solver).",
          M, N);
   }
 
-  // Reinitialize solution vector if necessary
-  if (x.empty())
+  // Non-zero initial guess to true/false
+  if (this->parameters["nonzero_initial_guess"].is_set())
   {
-    _matA->init_vector(x, 1);
-    x.zero();
+    const bool nonzero_guess = this->parameters["nonzero_initial_guess"];
+    this->set_nonzero_guess(nonzero_guess);
   }
 
-  // Set some PETSc-specific options
-  set_petsc_ksp_options();
-
-  // Set operators
-  //set_petsc_operators();
+  // Monitor convergence
+  if (this->parameters["monitor_convergence"].is_set())
+  {
+    const bool monitor_convergence = parameters["monitor_convergence"];
+    this->monitor(monitor_convergence);
+  }
 
-  // Set near null space for preconditioner
-  if (_preconditioner)
+  // Check if a tolerance has been set
+  if (parameters["relative_tolerance"].is_set()
+      or parameters["absolute_tolerance"].is_set()
+      or parameters["divergence_limit"].is_set()
+      or parameters["maximum_iterations"].is_set())
   {
-    dolfin_assert(_matP);
-    const MatNullSpace pc_nullspace = _preconditioner->near_nullspace();
+    // Set tolerances
+    const double rtol = parameters["relative_tolerance"].is_set() ? (double)parameters["relative_tolerance"] : PETSC_DEFAULT;
+    const double atol = parameters["absolute_tolerance"].is_set() ? (double)parameters["absolute_tolerance"] : PETSC_DEFAULT;
+    const double dtol = parameters["divergence_limit"].is_set() ? (double)parameters["divergence_limit"] : PETSC_DEFAULT;
+    const int max_it  = parameters["maximum_iterations"].is_set() ? (int)parameters["maximum_iterations"] : PETSC_DEFAULT;
+    set_tolerances(rtol, atol, dtol, max_it);
+  }
 
-    if (pc_nullspace && !preconditioner_set)
-    {
-      ierr = MatSetNearNullSpace(_matP->mat(), pc_nullspace);
-      if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetNearNullSpace");
-    }
+  // Initialize solution vector, if necessary
+  if (x.empty())
+  {
+    _matA->init_vector(x, 1);
+    this->set_nonzero_guess(false);
   }
 
   // FIXME: Improve check for re-setting preconditioner, e.g. if
@@ -330,46 +312,33 @@ std::size_t PETScKrylovSolver::solve(PETScVector& x, const PETScVector& b)
     _preconditioner->set(*this);
     preconditioner_set = true;
   }
-  // User defined preconditioner
   else if (pc_dolfin && !preconditioner_set)
   {
+    // User defined preconditioner
     PETScUserPreconditioner::setup(_ksp, *pc_dolfin);
     preconditioner_set = true;
   }
 
   // Set convergence norm type
-  if (parameters["convergence_norm_type"].is_set())
+  if (this->parameters["convergence_norm_type"].is_set())
   {
     const std::string convergence_norm_type
-      = parameters["convergence_norm_type"];
-    if (convergence_norm_type == "true")
-    {
-      ierr = KSPSetNormType(_ksp, KSP_NORM_UNPRECONDITIONED);
-      if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetNormType");
-    }
-    else if (convergence_norm_type == "preconditioned")
-    {
-      ierr = KSPSetNormType(_ksp, KSP_NORM_PRECONDITIONED);
-      if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetNormType");
-    }
-    else if (convergence_norm_type == "none")
-    {
-      ierr = KSPSetNormType(_ksp, KSP_NORM_NONE);
-      if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetNormType");
-    }
+      = this->parameters["convergence_norm_type"];
+    set_norm_type(get_norm_type(convergence_norm_type));
   }
 
   // Solve linear system
-  if (MPI::rank(PETSC_COMM_WORLD) == 0)
+  if (dolfin::MPI::rank(this->mpi_comm()) == 0)
   {
     log(PROGRESS, "PETSc Krylov solver starting to solve %i x %i system.",
         _matA->size(0), _matA->size(1));
   }
 
+  // Solve system
   ierr =  KSPSolve(_ksp, b.vec(), x.vec());
   if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSolve");
 
-  // Update ghost values
+  // Update ghost values in solution vector
   x.update_ghost_values();
 
   // Get the number of iterations
@@ -389,7 +358,7 @@ std::size_t PETScKrylovSolver::solve(PETScVector& x, const PETScVector& b)
     ierr = KSPGetResidualNorm(_ksp, &rnorm);
     if (ierr != 0) petsc_error(ierr, __FILE__, "KSPGetResidualNorm");
     const char *reason_str = KSPConvergedReasons[reason];
-    bool error_on_nonconvergence = parameters["error_on_nonconvergence"];
+    bool error_on_nonconvergence = this->parameters["error_on_nonconvergence"].is_set() ? this->parameters["error_on_nonconvergence"] : false;
     if (error_on_nonconvergence)
     {
       dolfin_error("PETScKrylovSolver.cpp",
@@ -405,54 +374,146 @@ std::size_t PETScKrylovSolver::solve(PETScVector& x, const PETScVector& b)
   }
 
   // Report results
-  if (report && dolfin::MPI::rank(PETSC_COMM_WORLD) == 0)
+  if (report && dolfin::MPI::rank(this->mpi_comm()) == 0)
     write_report(num_iterations, reason);
 
   return num_iterations;
 }
 //-----------------------------------------------------------------------------
+void PETScKrylovSolver::set_nonzero_guess(bool nonzero_guess)
+{
+  dolfin_assert(_ksp);
+  const PetscBool _nonero_guess = nonzero_guess ? PETSC_TRUE : PETSC_FALSE;
+  PetscErrorCode ierr = KSPSetInitialGuessNonzero(_ksp, _nonero_guess);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetIntialGuessNonzero");
+}
+//-----------------------------------------------------------------------------
 void PETScKrylovSolver::set_reuse_preconditioner(bool reuse_pc)
 {
-#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 5
   dolfin_assert(_ksp);
   const PetscBool _reuse_pc = reuse_pc ? PETSC_TRUE : PETSC_FALSE;
   PetscErrorCode ierr = KSPSetReusePreconditioner(_ksp, _reuse_pc);
   if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetReusePreconditioner");
-#else
-  warning("PETScKrylovSolver::set_reuse_preconditioner is only supported for PETSc version 3.5 or later");
-#endif
 }
 //-----------------------------------------------------------------------------
-void PETScKrylovSolver::set_options_prefix(std::string options_prefix)
+void PETScKrylovSolver::set_tolerances(double relative, double absolute,
+                                       double diverged, int max_iter)
 {
-  if (_ksp)
+  dolfin_assert(_ksp);
+  PetscErrorCode ierr = KSPSetTolerances(_ksp, relative, absolute, diverged,
+                                         max_iter);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetTolerances");
+}
+//-----------------------------------------------------------------------------
+void PETScKrylovSolver::set_norm_type(norm_type type)
+{
+  KSPNormType ksp_norm_type = KSP_NORM_DEFAULT;
+  switch (type)
   {
+  case norm_type::none:
+    ksp_norm_type = KSP_NORM_NONE;
+    break;
+  case norm_type::default_norm:
+    ksp_norm_type = KSP_NORM_DEFAULT;
+  case norm_type::preconditioned:
+    ksp_norm_type = KSP_NORM_PRECONDITIONED;
+    break;
+  case norm_type::unpreconditioned:
+    ksp_norm_type = KSP_NORM_UNPRECONDITIONED;
+    break;
+  case norm_type::natural:
+    ksp_norm_type = KSP_NORM_NATURAL;
+    break;
+  default:
     dolfin_error("PETScKrylovSolver.cpp",
-                 "setting PETSc options prefix",
-                 "Cannot set options prefix since PETSc KSP has already been initialized");
+                 "set convergence norm type",
+                 "Unknown norm type");
   }
-  else
-    _petsc_options_prefix = options_prefix;
+
+  dolfin_assert(_ksp);
+  KSPSetNormType(_ksp, ksp_norm_type);
 }
 //-----------------------------------------------------------------------------
-std::string PETScKrylovSolver::get_options_prefix() const
+PETScKrylovSolver::norm_type PETScKrylovSolver::get_norm_type() const
 {
-  if (_ksp)
+  // Get norm type from PETSc
+  dolfin_assert(_ksp);
+  KSPNormType ksp_norm_type = KSP_NORM_DEFAULT;
+  KSPGetNormType(_ksp, &ksp_norm_type);
+
+  // Return appropriate DOLFIN enum type
+  switch (ksp_norm_type)
   {
-    const char* prefix = NULL;
-    KSPGetOptionsPrefix(_ksp, &prefix);
-    return std::string(prefix);
+  case KSP_NORM_NONE:
+    return norm_type::none;
+  case KSP_NORM_PRECONDITIONED:
+    return norm_type::preconditioned;
+  case KSP_NORM_UNPRECONDITIONED:
+    return norm_type::unpreconditioned;
+  case KSP_NORM_NATURAL:
+    return norm_type::natural;
+  case KSP_NORM_DEFAULT:
+    return norm_type::default_norm;
+  default:
+    dolfin_error("PETScKrylovSolver.cpp",
+                 "set convergence norm type",
+                 "Unknown norm type");
+    return norm_type::none;
+  }
+}
+//-----------------------------------------------------------------------------
+void PETScKrylovSolver::monitor(bool monitor_convergence)
+{
+  dolfin_assert(_ksp);
+  PetscErrorCode ierr;
+  if (monitor_convergence)
+  {
+    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+    ierr = KSPMonitorSet(_ksp, KSPMonitorTrueResidualNorm,
+                         PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)_ksp)),
+                         NULL);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
+    #else
+    PetscViewer viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)_ksp));
+    PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
+    PetscViewerAndFormat *vf;
+    PetscViewerAndFormatCreate(viewer,format,&vf);
+    ierr = KSPMonitorSet(_ksp,
+                         (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
+                         vf,
+                         (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
+    #endif
   }
   else
   {
-    warning("PETSc KSP object has not been initialised, therefore prefix has not been set");
-    return std::string();
+    ierr = KSPMonitorCancel(_ksp);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorCancel");
   }
 }
 //-----------------------------------------------------------------------------
-KSP PETScKrylovSolver::ksp() const
+void PETScKrylovSolver::set_options_prefix(std::string options_prefix)
 {
-  return _ksp;
+  // Set options prefix
+  dolfin_assert(_ksp);
+  PetscErrorCode ierr = KSPSetOptionsPrefix(_ksp, options_prefix.c_str());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOptionsPrefix");
+}
+//-----------------------------------------------------------------------------
+std::string PETScKrylovSolver::get_options_prefix() const
+{
+  dolfin_assert(_ksp);
+  const char* prefix = NULL;
+  PetscErrorCode ierr = KSPGetOptionsPrefix(_ksp, &prefix);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPGetOptionsPrefix");
+  return std::string(prefix);
+}
+//-----------------------------------------------------------------------------
+void PETScKrylovSolver::set_from_options() const
+{
+  dolfin_assert(_ksp);
+  PetscErrorCode ierr = KSPSetFromOptions(_ksp);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetFromOptions");
 }
 //-----------------------------------------------------------------------------
 std::string PETScKrylovSolver::str(bool verbose) const
@@ -472,31 +533,38 @@ PETSc KSPView directly.");
   return s.str();
 }
 //-----------------------------------------------------------------------------
-void PETScKrylovSolver::init(const std::string& method)
+MPI_Comm PETScKrylovSolver::mpi_comm() const
 {
-  PetscErrorCode ierr;
-
-  if (_ksp)
-    KSPDestroy(&_ksp);
-
-  // Set up solver environment
-  ierr = KSPCreate(PETSC_COMM_WORLD, &_ksp);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPCreate");
-
-  // Set options prefix (if any)
-  ierr = KSPSetOptionsPrefix(_ksp, _petsc_options_prefix.c_str());
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOptionsPrefix");
-
-  // Set solver type
-  if (method != "default")
+  dolfin_assert(_ksp);
+  MPI_Comm mpi_comm = MPI_COMM_NULL;
+  PetscObjectGetComm((PetscObject)_ksp, &mpi_comm);
+  return mpi_comm;
+}
+//-----------------------------------------------------------------------------
+KSP PETScKrylovSolver::ksp() const
+{
+  return _ksp;
+}
+//-----------------------------------------------------------------------------
+PETScKrylovSolver::norm_type PETScKrylovSolver::get_norm_type(std::string norm)
+{
+  if (norm == "none")
+    return norm_type::none;
+  else if (norm == "default")
+    return norm_type::default_norm;
+  else if (norm == "preconditioned")
+    return norm_type::preconditioned;
+  else if (norm == "true")
+    return norm_type::unpreconditioned;
+  else if (norm == "natural")
+    return norm_type::natural;
+  else
   {
-    ierr = KSPSetType(_ksp, _methods.find(method)->second);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType");
+    dolfin_error("PETScKrylovSolver.cpp",
+                 "get norm type from enum",
+                 "Unknown norm type \"%s\"", norm.c_str());
+    return norm_type::none;
   }
-
-  // Set from options database
-  ierr = KSPSetFromOptions(_ksp);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetFromOptions");
 }
 //-----------------------------------------------------------------------------
 void PETScKrylovSolver::_set_operator(std::shared_ptr<const PETScBaseMatrix> A)
@@ -506,7 +574,7 @@ void PETScKrylovSolver::_set_operator(std::shared_ptr<const PETScBaseMatrix> A)
 //-----------------------------------------------------------------------------
 void
 PETScKrylovSolver::_set_operators(std::shared_ptr<const PETScBaseMatrix> A,
-                                 std::shared_ptr<const PETScBaseMatrix> P)
+                                  std::shared_ptr<const PETScBaseMatrix> P)
 {
   _matA = A;
   _matP = P;
@@ -514,46 +582,13 @@ PETScKrylovSolver::_set_operators(std::shared_ptr<const PETScBaseMatrix> A,
   dolfin_assert(_matP);
   dolfin_assert(_ksp);
 
+  dolfin_assert(_ksp);
   PetscErrorCode ierr;
-
-  // Get parameter
-  #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-  const std::string mat_structure = parameters("preconditioner")["structure"];
-
-  // Set operators with appropriate option
-  if (mat_structure == "same")
-  {
-    ierr = KSPSetOperators(_ksp, _matA->mat(), _matP->mat(),
-                           SAME_PRECONDITIONER);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOperators");
-  }
-  else if (mat_structure == "same_nonzero_pattern")
-  {
-    ierr = KSPSetOperators(_ksp, _matA->mat(), _matP->mat(),
-                           SAME_NONZERO_PATTERN);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOperators");
-  }
-  else if (mat_structure == "different_nonzero_pattern")
-  {
-    ierr = KSPSetOperators(_ksp, _matA->mat(), _matP->mat(),
-                           DIFFERENT_NONZERO_PATTERN);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOperators");
-  }
-  else
-  {
-    dolfin_error("PETScKrylovSolver.cpp",
-                 "set PETSc Krylov solver operators",
-                 "Preconditioner re-use parameter \"%s \" is unknown",
-                 mat_structure.c_str());
-  }
-  #else
   ierr = KSPSetOperators(_ksp, _matA->mat(), _matP->mat());
   if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOperators");
-  #endif
 }
 //-----------------------------------------------------------------------------
-std::size_t PETScKrylovSolver::_solve(const PETScBaseMatrix& A,
-                                      PETScVector& x,
+std::size_t PETScKrylovSolver::_solve(const PETScBaseMatrix& A, PETScVector& x,
                                       const PETScVector& b)
 {
   // Set operator
@@ -564,41 +599,6 @@ std::size_t PETScKrylovSolver::_solve(const PETScBaseMatrix& A,
   return solve(x, b);
 }
 //-----------------------------------------------------------------------------
-void PETScKrylovSolver::set_petsc_ksp_options()
-{
-  PetscErrorCode ierr;
-
-  // GMRES restart parameter
-  const int gmres_restart = parameters("gmres")["restart"];
-  ierr = KSPGMRESSetRestart(_ksp, gmres_restart);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPGMRESSetRestart");
-
-  // Non-zero initial guess
-  const bool nonzero_guess = parameters["nonzero_initial_guess"];
-  PetscBool petsc_nonzero_guess = PETSC_FALSE;
-  if (nonzero_guess)
-    petsc_nonzero_guess = PETSC_TRUE;
-  ierr = KSPSetInitialGuessNonzero(_ksp, petsc_nonzero_guess);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetInitialGuessNonzero");
-
-  // Monitor convergence
-  const bool monitor_convergence = parameters["monitor_convergence"];
-  if (monitor_convergence)
-  {
-    ierr = KSPMonitorSet(_ksp, KSPMonitorTrueResidualNorm, 0, 0);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
-  }
-
-  // Set tolerances
-  const int max_iterations = parameters["maximum_iterations"];
-  ierr = KSPSetTolerances(_ksp,
-                          parameters["relative_tolerance"],
-                          parameters["absolute_tolerance"],
-                          parameters["divergence_limit"],
-                          max_iterations);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetTolerances");
-}
-//-----------------------------------------------------------------------------
 void PETScKrylovSolver::write_report(int num_iterations,
                                      KSPConvergedReason reason)
 {
@@ -631,12 +631,12 @@ void PETScKrylovSolver::write_report(int num_iterations,
   {
     if (pc_type_str == PCASM)
     {
-      ierr = PCASMGetSubKSP(pc, PETSC_NULL, PETSC_NULL, &sub_ksp);
+      ierr = PCASMGetSubKSP(pc, NULL, NULL, &sub_ksp);
       if (ierr != 0) petsc_error(ierr, __FILE__, "PCASMGetSubKSP");
     }
     else if (pc_type_str == PCBJACOBI)
     {
-      ierr = PCBJacobiGetSubKSP(pc, PETSC_NULL, PETSC_NULL, &sub_ksp);
+      ierr = PCBJacobiGetSubKSP(pc, NULL, NULL, &sub_ksp);
       if (ierr != 0) petsc_error(ierr, __FILE__, "PCBJacobiGetSubKSP");
     }
     ierr = KSPGetType(*sub_ksp, &sub_ksp_type);
@@ -710,9 +710,6 @@ void PETScKrylovSolver::check_dimensions(const PETScBaseMatrix& A,
                  "Non-matching dimensions for linear system (matrix has %ld columns and solution vector has %ld rows)",
                  A.size(1), x.size());
   }
-
-  // FIXME: We could implement a more thorough check of local/global
-  // FIXME: dimensions for distributed matrices and vectors here.
 }
 //-----------------------------------------------------------------------------
 
diff --git a/dolfin/la/PETScKrylovSolver.h b/dolfin/la/PETScKrylovSolver.h
index 3ebdaac..a09d19d 100644
--- a/dolfin/la/PETScKrylovSolver.h
+++ b/dolfin/la/PETScKrylovSolver.h
@@ -47,32 +47,46 @@ namespace dolfin
   class PETScSNESSolver;
   class VectorSpaceBasis;
 
-  /// This class implements Krylov methods for linear systems
-  /// of the form Ax = b. It is a wrapper for the Krylov solvers
-  /// of PETSc.
+  /// This class implements Krylov methods for linear systems of the
+  /// form Ax = b. It is a wrapper for the Krylov solvers of PETSc.
 
   class PETScKrylovSolver : public GenericLinearSolver, public PETScObject
   {
   public:
 
-    /// Create Krylov solver for a particular method and names
+    /// Norm types used in convergence testing. Not all solvers types
+    /// support all norm types (see
+    /// http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetNormType.html). Note
+    /// that 'default' is a reserved keyword, so we use 'default_norm'
+    enum class norm_type {none, default_norm, preconditioned, unpreconditioned, natural};
+
+    /// Create Krylov solver for a particular method and named
+    /// preconditioner
+    PETScKrylovSolver(MPI_Comm comm,
+                      std::string method="default",
+                      std::string preconditioner="default");
+
+    /// Create Krylov solver for a particular method and named
     /// preconditioner
-    PETScKrylovSolver(std::string method = "default",
-                      std::string preconditioner = "default");
+    PETScKrylovSolver(std::string method="default",
+                      std::string preconditioner="default");
 
     /// Create Krylov solver for a particular method and
-    /// PETScPreconditioner
-    PETScKrylovSolver(std::string method, PETScPreconditioner& preconditioner);
+    /// PETScPreconditioner (shared_ptr version)
+    PETScKrylovSolver(MPI_Comm comm,
+                      std::string method,
+                      std::shared_ptr<PETScPreconditioner> preconditioner);
 
     /// Create Krylov solver for a particular method and
     /// PETScPreconditioner (shared_ptr version)
     PETScKrylovSolver(std::string method,
-		      std::shared_ptr<PETScPreconditioner> preconditioner);
+                      std::shared_ptr<PETScPreconditioner> preconditioner);
 
     /// Create Krylov solver for a particular method and
-    /// PETScPreconditioner
-    PETScKrylovSolver(std::string method,
-                      PETScUserPreconditioner& preconditioner);
+    /// PETScPreconditioner (shared_ptr version)
+    PETScKrylovSolver(MPI_Comm comm,
+                      std::string method,
+                      std::shared_ptr<PETScUserPreconditioner> preconditioner);
 
     /// Create Krylov solver for a particular method and
     /// PETScPreconditioner (shared_ptr version)
@@ -92,14 +106,6 @@ namespace dolfin
     void set_operators(std::shared_ptr<const GenericLinearOperator> A,
                        std::shared_ptr<const GenericLinearOperator> P);
 
-
-    /// Set null space of the operator (matrix). This is used to solve
-    /// singular systems
-    void set_nullspace(const VectorSpaceBasis& nullspace);
-
-    /// Get operator (matrix)
-    const PETScBaseMatrix& get_operator() const;
-
     /// Solve linear system Ax = b and return number of iterations
     std::size_t solve(GenericVector& x, const GenericVector& b);
 
@@ -110,41 +116,71 @@ namespace dolfin
     std::size_t solve(const GenericLinearOperator& A, GenericVector& x,
                       const GenericVector& b);
 
-    /// Reuse preconditioner if true, otherwise do not, even if matrix
-    /// operator changes (by default preconditioner is re-built if the
-    /// matrix changes)
+    /// Use nonzero intial guess for solution function
+    /// (nonzero_guess=true, the solution vector x will not be zeroed
+    /// before the solver starts)
+    void set_nonzero_guess(bool nonzero_guess);
+
+    /// Reuse preconditioner if true, even if matrix operator changes
+    /// (by default preconditioner will be re-built if the matrix
+    /// changes)
     void set_reuse_preconditioner(bool reuse_pc);
 
-    /// Sets the prefix used by PETSc when searching the options
+    /// Set tolerances (relative residual, alsolute residial, maximum
+    /// number of iterations)
+    void set_tolerances(double relative, double absolute, double diverged,
+                        int max_iter);
+
+    /// Set norm type used in convergence testing - not all solvers
+    /// types support all norm types
+    void set_norm_type(norm_type type);
+
+    /// Get norm type used in convergence testing
+    norm_type get_norm_type() const;
+
+    /// Monitor residual at each iteration
+    void monitor(bool monitor_convergence);
+
+    /// Sets the prefix used by PETSc when searching the PETSc options
     /// database
     void set_options_prefix(std::string options_prefix);
 
-    /// Returns the prefix used by PETSc when searching the options
-    /// database
+    /// Returns the prefix used by PETSc when searching the PETSc
+    /// options database
     std::string get_options_prefix() const;
 
+    /// Set options from PETSc options database
+    void set_from_options() const;
+
     /// Return informal string representation (pretty-print)
     std::string str(bool verbose) const;
 
+    /// Return MPI communicator
+    MPI_Comm mpi_comm() const;
+
     /// Return PETSc KSP pointer
     KSP ksp() const;
 
     /// Return a list of available solver methods
     static std::map<std::string, std::string> methods();
 
-    /// Return a list of available preconditioners
+    /// Return a list of available named preconditioners
     static std::map<std::string, std::string> preconditioners();
 
     /// Default parameter values
     static Parameters default_parameters();
 
+    /// Return parameter type: "krylov_solver" or "lu_solver"
+    std::string parameter_type() const
+    { return "krylov_solver"; }
+
     friend class PETScSNESSolver;
     friend class PETScTAOSolver;
 
   private:
 
-    // Initialize KSP solver
-    void init(const std::string& method);
+    // Return norm_type enum for norm string
+    static PETScKrylovSolver::norm_type get_norm_type(std::string norm);
 
     // Set operator (matrix)
     void _set_operator(std::shared_ptr<const PETScBaseMatrix> A);
@@ -157,24 +193,17 @@ namespace dolfin
     std::size_t _solve(const PETScBaseMatrix& A, PETScVector& x,
                        const PETScVector& b);
 
-    // Set options that affect KSP object
-    void set_petsc_ksp_options();
-
     // Report the number of iterations
     void write_report(int num_iterations, KSPConvergedReason reason);
 
     void check_dimensions(const PETScBaseMatrix& A, const GenericVector& x,
                           const GenericVector& b) const;
 
-    // Prefix for PETSc options database
-    std::string _petsc_options_prefix;
-
     // Available solvers
     static const std::map<std::string, const KSPType> _methods;
 
     // Available solvers descriptions
-    static const std::map<std::string, std::string>
-      _methods_descr;
+    static const std::map<std::string, std::string> _methods_descr;
 
     // PETSc solver pointer
     KSP _ksp;
@@ -191,12 +220,6 @@ namespace dolfin
     // Matrix used to construct the preconditioner
     std::shared_ptr<const PETScBaseMatrix> _matP;
 
-    // Null space vectors
-    std::vector<PETScVector> _nullspace;
-
-    // PETSc null space
-    MatNullSpace petsc_nullspace;
-
     bool preconditioner_set;
 
   };
diff --git a/dolfin/la/PETScLUSolver.cpp b/dolfin/la/PETScLUSolver.cpp
index 91376b8..266528c 100644
--- a/dolfin/la/PETScLUSolver.cpp
+++ b/dolfin/la/PETScLUSolver.cpp
@@ -38,44 +38,34 @@
 
 using namespace dolfin;
 
-// FIXME: Remove these defines now that we have dropped support for
-// older version of PETSc
-
-#define MAT_SOLVER_UMFPACK      MATSOLVERUMFPACK
-#define MAT_SOLVER_MUMPS        MATSOLVERMUMPS
-#define MAT_SOLVER_PASTIX       MATSOLVERPASTIX
-#define MAT_SOLVER_PETSC        MATSOLVERPETSC
-#define MAT_SOLVER_SUPERLU_DIST MATSOLVERSUPERLU_DIST
-#define MAT_SOLVER_SUPERLU      MATSOLVERSUPERLU
-
 // List of available LU solvers
-const std::map<std::string, const MatSolverPackage> PETScLUSolver::_methods
+std::map<std::string, const MatSolverPackage> PETScLUSolver::_methods
 = { {"default", ""},
 #if PETSC_HAVE_UMFPACK || PETSC_HAVE_SUITESPARSE
-    {"umfpack",      MAT_SOLVER_UMFPACK},
+    {"umfpack",      MATSOLVERUMFPACK},
 #endif
 #if PETSC_HAVE_MUMPS
-    {"mumps",        MAT_SOLVER_MUMPS},
+    {"mumps",        MATSOLVERMUMPS},
 #endif
 #if PETSC_HAVE_PASTIX
-    {"pastix",       MAT_SOLVER_PASTIX},
+    {"pastix",       MATSOLVERPASTIX},
 #endif
 #if PETSC_HAVE_SUPERLU
-    {"superlu",      MAT_SOLVER_SUPERLU},
+    {"superlu",      MATSOLVERSUPERLU},
 #endif
 #if PETSC_HAVE_SUPERLU_DIST
-    {"superlu_dist", MAT_SOLVER_SUPERLU_DIST},
+    {"superlu_dist", MATSOLVERSUPERLU_DIST},
 #endif
-    {"petsc",        MAT_SOLVER_PETSC}};
+    {"petsc",        MATSOLVERPETSC}};
 //-----------------------------------------------------------------------------
-const std::map<const MatSolverPackage, const bool>
+std::map<const MatSolverPackage, bool>
 PETScLUSolver::_methods_cholesky
-= { {MAT_SOLVER_UMFPACK,      false},
-    {MAT_SOLVER_MUMPS,        true},
-    {MAT_SOLVER_PASTIX,       true},
-    {MAT_SOLVER_SUPERLU,      false},
-    {MAT_SOLVER_SUPERLU_DIST, false},
-    {MAT_SOLVER_PETSC,        true} };
+= { {MATSOLVERUMFPACK,      false},
+    {MATSOLVERMUMPS,        true},
+    {MATSOLVERPASTIX,       true},
+    {MATSOLVERSUPERLU,      false},
+    {MATSOLVERSUPERLU_DIST, false},
+    {MATSOLVERPETSC,        true} };
 //-----------------------------------------------------------------------------
 const std::map<std::string, std::string>
 PETScLUSolver::_methods_descr
@@ -98,8 +88,7 @@ PETScLUSolver::_methods_descr
     {"petsc", "PETSc built in LU solver"} };
 
 //-----------------------------------------------------------------------------
-std::map<std::string, std::string>
-PETScLUSolver::methods()
+std::map<std::string, std::string> PETScLUSolver::methods()
 {
   return PETScLUSolver::_methods_descr;
 }
@@ -115,31 +104,58 @@ Parameters PETScLUSolver::default_parameters()
   return p;
 }
 //-----------------------------------------------------------------------------
-PETScLUSolver::PETScLUSolver(std::string method) : _ksp(NULL)
+PETScLUSolver::PETScLUSolver(MPI_Comm comm, std::string method)
+  :  PETScLUSolver(MPI_COMM_WORLD, NULL, method)
 {
-  // Set parameter values
-  parameters = default_parameters();
-
-  // Initialize PETSc LU solver
-  init_solver(method);
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
-PETScLUSolver::PETScLUSolver(std::shared_ptr<const PETScMatrix> A,
+PETScLUSolver::PETScLUSolver(std::string method)
+  : PETScLUSolver(MPI_COMM_WORLD, NULL, method)
+{
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+PETScLUSolver::PETScLUSolver(MPI_Comm comm,
+                             std::shared_ptr<const PETScMatrix> A,
                              std::string method) : _ksp(NULL), _matA(A)
 {
   // Check dimensions
-  if (A->size(0) != A->size(1))
+  if (A)
   {
-    dolfin_error("PETScLUSolver.cpp",
-                 "create PETSc LU solver",
-                 "Cannot LU factorize non-square PETSc matrix");
+    if (A->size(0) != A->size(1))
+    {
+      dolfin_error("PETScLUSolver.cpp",
+                  "create PETSc LU solver",
+                  "Cannot LU factorize non-square PETSc matrix");
+    }
   }
-
   // Set parameter values
   parameters = default_parameters();
 
-  // Initialize PETSc LU solver
-  init_solver(method);
+  PetscErrorCode ierr;
+
+  // Create solver
+  ierr = KSPCreate(comm, &_ksp);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPCreate");
+
+  // Select solver (must come after KSPCreate, becuase we get the MPI
+  // communicator from the KSP object)
+  _solver_package = select_solver(comm, method);
+
+  // Make solver preconditioner only
+  ierr = KSPSetType(_ksp, KSPPREONLY);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType");
+
+  // Set from PETSc options
+  KSPSetFromOptions(_ksp);
+}
+//-----------------------------------------------------------------------------
+PETScLUSolver::PETScLUSolver(std::shared_ptr<const PETScMatrix> A,
+                             std::string method)
+  : PETScLUSolver(MPI_COMM_WORLD, A, method)
+{
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
 PETScLUSolver::~PETScLUSolver()
@@ -174,14 +190,8 @@ void PETScLUSolver::set_operator(std::shared_ptr<const PETScMatrix> A)
   }
 
   PetscErrorCode ierr;
-  #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-  ierr = KSPSetOperators(_ksp, _matA->mat(), _matA->mat(),
-                         DIFFERENT_NONZERO_PATTERN);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOperators");
-  #else
   ierr = KSPSetOperators(_ksp, _matA->mat(), _matA->mat());
   if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOperators");
-  #endif
 }
 //-----------------------------------------------------------------------------
 const GenericLinearOperator& PETScLUSolver::get_operator() const
@@ -243,20 +253,9 @@ std::size_t PETScLUSolver::solve(GenericVector& x, const GenericVector& b,
   // Set number of threads if using PaStiX
   if (strcmp(_solver_package, MATSOLVERPASTIX) == 0)
   {
-    if (parameters["num_threads"].is_set())
-    {
-      // Use number of threads specified for LU solver
-      ierr = PetscOptionsSetValue("-mat_pastix_threadnbr",
-                           parameters["num_threads"].value_str().c_str());
-      if (ierr != 0) petsc_error(ierr, __FILE__, "PetscOptionsSetValue");
-    }
-    else
-    {
-      // Use global number of threads
-      ierr = PetscOptionsSetValue("-mat_pastix_threadnbr",
-                        dolfin::parameters["num_threads"].value_str().c_str());
-      if (ierr != 0) petsc_error(ierr, __FILE__, "PetscOptionsSetValue");
-    }
+    const std::size_t num_threads = parameters["num_threads"].is_set() ?
+      parameters["num_threads"] : dolfin::parameters["num_threads"];
+    PETScOptions::set("-mat_pastix_threadnbr", num_threads);
   }
 
   // Solve linear system
@@ -322,29 +321,32 @@ std::size_t PETScLUSolver::solve_transpose(const PETScMatrix& A,
 //-----------------------------------------------------------------------------
 void PETScLUSolver::set_options_prefix(std::string options_prefix)
 {
-  if (_ksp)
-  {
-    dolfin_error("PETScLUSolver.cpp",
-                 "setting PETSc options prefix",
-                 "Cannot set options prefix since PETSc KSP has already been initialized");
-  }
-  else
-    _petsc_options_prefix = options_prefix;
+  dolfin_assert(_ksp);
+  PetscErrorCode ierr = KSPSetOptionsPrefix(_ksp, options_prefix.c_str());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOptionsPrefix");
 }
 //-----------------------------------------------------------------------------
 std::string PETScLUSolver::get_options_prefix() const
 {
-  if (_ksp)
-  {
-    const char* prefix = NULL;
-    KSPGetOptionsPrefix(_ksp, &prefix);
-    return std::string(prefix);
-  }
-  else
-  {
-    warning("PETSc KSP object has not been initialised, therefore prefix has not been set");
-    return std::string();
-  }
+  dolfin_assert(_ksp);
+  const char* prefix = NULL;
+  KSPGetOptionsPrefix(_ksp, &prefix);
+  return std::string(prefix);
+}
+//-----------------------------------------------------------------------------
+void PETScLUSolver::set_from_options() const
+{
+  dolfin_assert(_ksp);
+  PetscErrorCode ierr = KSPSetFromOptions(_ksp);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetFromOptions");
+}
+//-----------------------------------------------------------------------------
+MPI_Comm PETScLUSolver::mpi_comm() const
+{
+  dolfin_assert(_ksp);
+  MPI_Comm mpi_comm = MPI_COMM_NULL;
+  PetscObjectGetComm((PetscObject)_ksp, &mpi_comm);
+  return mpi_comm;
 }
 //-----------------------------------------------------------------------------
 std::string PETScLUSolver::str(bool verbose) const
@@ -368,7 +370,8 @@ KSP PETScLUSolver::ksp() const
   return _ksp;
 }
 //-----------------------------------------------------------------------------
-const MatSolverPackage PETScLUSolver::select_solver(std::string& method) const
+const MatSolverPackage PETScLUSolver::select_solver(MPI_Comm comm,
+                                                    std::string& method)
 {
   // Check package string
   if (_methods.count(method) == 0)
@@ -382,7 +385,7 @@ const MatSolverPackage PETScLUSolver::select_solver(std::string& method) const
   if (method == "default")
   {
     #if defined(PETSC_USE_64BIT_INDICES)
-    if (MPI::size(MPI_COMM_WORLD) == 1)
+    if (MPI::size(comm) == 1)
     {
       #if PETSC_HAVE_UMFPACK || PETSC_HAVE_SUITESPARSE
       method = "umfpack";
@@ -404,7 +407,7 @@ const MatSolverPackage PETScLUSolver::select_solver(std::string& method) const
 
     }
     #else
-    if (MPI::size(MPI_COMM_WORLD) == 1)
+    if (MPI::size(comm) == 1)
     {
       #if PETSC_HAVE_UMFPACK || PETSC_HAVE_SUITESPARSE
       method = "umfpack";
@@ -438,47 +441,16 @@ const MatSolverPackage PETScLUSolver::select_solver(std::string& method) const
     #endif
   }
 
-  return _methods.find(method)->second;
+  auto it = _methods.find(method);
+  dolfin_assert(it !=  _methods.end());
+  return it->second;
 }
 //-----------------------------------------------------------------------------
-bool PETScLUSolver::solver_has_cholesky(const MatSolverPackage package) const
+bool PETScLUSolver::solver_has_cholesky(const MatSolverPackage package)
 {
-  return _methods_cholesky.find(package)->second;
-}
-//-----------------------------------------------------------------------------
-void PETScLUSolver::init_solver(std::string& method)
-{
-  // Select solver
-  _solver_package = select_solver(method);
-
-  // Destroy old solver environment if necessary
-  if (_ksp)
-    KSPDestroy(&_ksp);
-
-  PetscErrorCode ierr;
-
-  // Create solver
-  if (MPI::size(MPI_COMM_WORLD) > 1)
-  {
-    ierr = KSPCreate(PETSC_COMM_WORLD, &_ksp);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPCreate");
-  }
-  else
-  {
-    ierr = KSPCreate(PETSC_COMM_SELF, &_ksp);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPGetPC");
-  }
-
-  // Set options prefix (if any)
-  ierr = KSPSetOptionsPrefix(_ksp, _petsc_options_prefix.c_str());
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetOptionsPrefix");
-
-  // Make solver preconditioner only
-  ierr = KSPSetType(_ksp, KSPPREONLY);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType");
-
-  // Set from PETSc options
-  KSPSetFromOptions(_ksp);
+  auto it = _methods_cholesky.find(package);
+  dolfin_assert(it != _methods_cholesky.end());
+  return it->second;
 }
 //-----------------------------------------------------------------------------
 void PETScLUSolver::configure_ksp(const MatSolverPackage solver_package)
@@ -491,8 +463,8 @@ void PETScLUSolver::configure_ksp(const MatSolverPackage solver_package)
 
   // Set preconditioner to LU factorization/Cholesky as appropriate
 
-  const bool symmetric = parameters["symmetric"];
-  if (symmetric && solver_has_cholesky(solver_package))
+  const bool symmetric = parameters["symmetric"].is_set() ? parameters["symmetric"] : false;
+  if (symmetric and solver_has_cholesky(solver_package))
   {
     ierr = PCSetType(pc, PCCHOLESKY);
     if (ierr != 0) petsc_error(ierr, __FILE__, "PCSetType");
@@ -506,12 +478,6 @@ void PETScLUSolver::configure_ksp(const MatSolverPackage solver_package)
   // Set solver package
   ierr = PCFactorSetMatSolverPackage(pc, solver_package);
   if (ierr != 0) petsc_error(ierr, __FILE__, "PCFactorSetMatSolverPackage");
-
-  // Allow matrices with zero diagonals to be solved
-  ierr = PCFactorSetShiftType(pc, MAT_SHIFT_NONZERO);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "PCFactorSetShiftType");
-  ierr = PCFactorSetShiftAmount(pc, PETSC_DECIDE);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "PCFactorSetShiftAmount");
 }
 //-----------------------------------------------------------------------------
 void PETScLUSolver::pre_report(const PETScMatrix& A) const
@@ -527,9 +493,8 @@ void PETScLUSolver::pre_report(const PETScMatrix& A) const
   if (ierr != 0) petsc_error(ierr, __FILE__, "PCFactorGetMatSolverPackage");
 
   // Get parameter
-  const bool report = parameters["report"];
-
-  if (report && dolfin::MPI::rank(MPI_COMM_WORLD) == 0)
+  const bool report = parameters["report"].is_set() ? parameters["report"] : false;
+  if (report && dolfin::MPI::rank(mpi_comm()) == 0)
   {
     log(PROGRESS,"Solving linear system of size %ld x %ld (PETSc LU solver, %s).",
         A.size(0), A.size(1), solver_type);
diff --git a/dolfin/la/PETScLUSolver.h b/dolfin/la/PETScLUSolver.h
index ee98d99..633cc87 100644
--- a/dolfin/la/PETScLUSolver.h
+++ b/dolfin/la/PETScLUSolver.h
@@ -30,6 +30,7 @@
 #include <string>
 #include <petscksp.h>
 #include <petscpc.h>
+#include <dolfin/common/MPI.h>
 #include "GenericLUSolver.h"
 #include "PETScObject.h"
 
@@ -52,9 +53,17 @@ namespace dolfin
   public:
 
     /// Constructor
+    PETScLUSolver(MPI_Comm comm, std::string method="default");
+
+    /// Constructor
     PETScLUSolver(std::string method="default");
 
     /// Constructor
+    PETScLUSolver(MPI_Comm comm,
+                  std::shared_ptr<const PETScMatrix> A,
+                  std::string method="default");
+
+    /// Constructor
     PETScLUSolver(std::shared_ptr<const PETScMatrix> A,
                   std::string method="default");
 
@@ -104,6 +113,12 @@ namespace dolfin
     /// database
     std::string get_options_prefix() const;
 
+    /// Set options from the PETSc options database
+    void set_from_options() const;
+
+    /// Returns the MPI communicator
+    MPI_Comm mpi_comm() const;
+
     /// Return informal string representation (pretty-print)
     std::string str(bool verbose) const;
 
@@ -117,34 +132,26 @@ namespace dolfin
     static Parameters default_parameters();
 
     friend class PETScSNESSolver;
-
     friend class PETScTAOSolver;
 
   private:
 
-    // Prefix for PETSc options database
-    std::string _petsc_options_prefix;
-
     const MatSolverPackage _solver_package;
 
     // Available LU solvers
-    static const std::map<std::string, const MatSolverPackage> _methods;
+    static std::map<std::string, const MatSolverPackage> _methods;
 
     // Whether those solvers support Cholesky
-    static const std::map<const MatSolverPackage, const bool> _methods_cholesky;
+    static std::map<const MatSolverPackage, bool> _methods_cholesky;
 
     // Available LU solvers descriptions
-    static const std::map<std::string, std::string>
-    _methods_descr;
+    static const std::map<std::string, std::string> _methods_descr;
 
     // Select LU solver type
-    const MatSolverPackage select_solver(std::string& method) const;
+    static const MatSolverPackage select_solver(MPI_Comm comm, std::string& method);
 
     // Does an LU solver support Cholesky?
-    bool solver_has_cholesky(const MatSolverPackage package) const;
-
-    // Initialise solver
-    void init_solver(std::string& method);
+    static bool solver_has_cholesky(const MatSolverPackage package);
 
     // Configure PETSc options
     void configure_ksp(const MatSolverPackage solver_package);
diff --git a/dolfin/la/PETScLinearOperator.cpp b/dolfin/la/PETScLinearOperator.cpp
index d36a8ae..be37a9d 100644
--- a/dolfin/la/PETScLinearOperator.cpp
+++ b/dolfin/la/PETScLinearOperator.cpp
@@ -59,9 +59,12 @@ namespace dolfin
 }
 
 //-----------------------------------------------------------------------------
-PETScLinearOperator::PETScLinearOperator() : _wrapper(0)
+PETScLinearOperator::PETScLinearOperator(MPI_Comm comm) :  PETScBaseMatrix(),
+                                                           _wrapper(nullptr)
 {
-  // Do nothing
+  // Create uninitialised matrix
+  PetscErrorCode ierr = MatCreate(comm, &_matA);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatCreate");
 }
 //-----------------------------------------------------------------------------
 std::size_t PETScLinearOperator::size(std::size_t dim) const
@@ -117,27 +120,33 @@ void PETScLinearOperator::init_layout(const GenericVector& x,
   // Get local range
   std::size_t m_local = M;
   std::size_t n_local = N;
-  if (MPI::size(MPI_COMM_WORLD) > 1)
+  if (MPI::size(x.mpi_comm()) > 1)
   {
-    std::pair<std::size_t, std::size_t> local_range_x = x.local_range();
-    std::pair<std::size_t, std::size_t> local_range_y = y.local_range();
+    std::pair<std::int64_t, std::int64_t> local_range_x = x.local_range();
+    std::pair<std::int64_t, std::int64_t> local_range_y = y.local_range();
     m_local = local_range_y.second - local_range_y.first;
     n_local = local_range_x.second - local_range_x.first;
   }
 
-  // Initialize PETSc matrix
+  dolfin_assert(_matA);
+
+  // FIXME: check that operator is not being re-initialised
+
   PetscErrorCode ierr;
-  if (_matA)
-    MatDestroy(&_matA);
 
-  // Create shell matrix
-  ierr = MatCreateShell(PETSC_COMM_WORLD, m_local, n_local, M, N,
-                        (void*) this, &_matA);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "MatCreateShell");
+  // Set matrix size
+  ierr = MatSetSizes(_matA, m_local, n_local, M, N);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetSizes");
+
+  // Set matrix type to 'shell'
+  ierr = MatSetType(_matA, MATSHELL);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetType");
 
-  // Increase reference count
-  PetscObjectReference((PetscObject)_matA);
+  // Set context
+  ierr = MatShellSetContext(_matA, (void*) this);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetShellContext");
 
+  // Set matrix mult function
   ierr = MatShellSetOperation(_matA, MATOP_MULT, (void (*)()) usermult);
   if (ierr != 0) petsc_error(ierr, __FILE__, "MatShellSetOperation");
 }
diff --git a/dolfin/la/PETScLinearOperator.h b/dolfin/la/PETScLinearOperator.h
index 3b108ca..62ddfe1 100644
--- a/dolfin/la/PETScLinearOperator.h
+++ b/dolfin/la/PETScLinearOperator.h
@@ -46,7 +46,7 @@ namespace dolfin
   public:
 
     /// Constructor
-    PETScLinearOperator();
+    explicit PETScLinearOperator(MPI_Comm comm);
 
     //--- Implementation of the GenericLinearOperator interface ---
 
@@ -56,6 +56,10 @@ namespace dolfin
     /// Compute matrix-vector product y = Ax
     virtual void mult(const GenericVector& x, GenericVector& y) const;
 
+    /// Return MPI communicator
+    virtual MPI_Comm  mpi_comm() const
+    { return PETScBaseMatrix::mpi_comm(); }
+
     /// Return informal string representation (pretty-print)
     virtual std::string str(bool verbose) const;
 
diff --git a/dolfin/la/PETScMatrix.cpp b/dolfin/la/PETScMatrix.cpp
index 664c07d..3d793c8 100644
--- a/dolfin/la/PETScMatrix.cpp
+++ b/dolfin/la/PETScMatrix.cpp
@@ -1,4 +1,5 @@
-// Copyright (C) 2004-2012 Johan Hoffman, Johan Jansson and Anders Logg
+// Copyright (C) 2004-2012 Johan Hoffman, Johan Jansson, Anders Logg
+// and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -27,12 +28,12 @@
 
 #include <iomanip>
 #include <iostream>
+#include <numeric>
 #include <sstream>
 
 #include <dolfin/log/log.h>
 #include <dolfin/common/Timer.h>
 #include <dolfin/common/MPI.h>
-#include "GenericSparsityPattern.h"
 #include "PETScFactory.h"
 #include "PETScVector.h"
 #include "SparsityPattern.h"
@@ -48,23 +49,37 @@ const std::map<std::string, NormType> PETScMatrix::norm_types
     {"frobenius", NORM_FROBENIUS} };
 
 //-----------------------------------------------------------------------------
-PETScMatrix::PETScMatrix() : PETScBaseMatrix(NULL)
+PETScMatrix::PETScMatrix() : PETScMatrix(MPI_COMM_WORLD)
 {
   // Do nothing
 }
 //-----------------------------------------------------------------------------
+PETScMatrix::PETScMatrix(MPI_Comm comm) : PETScBaseMatrix()
+{
+  // Create uninitialised matrix
+  PetscErrorCode ierr = MatCreate(comm, &_matA);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatCreate");
+}
+//-----------------------------------------------------------------------------
 PETScMatrix::PETScMatrix(Mat A) : PETScBaseMatrix(A)
 {
-  // Do nothing (reference count to A is incremented in base class)
+  // Reference count to A is incremented in base class
 }
 //-----------------------------------------------------------------------------
-PETScMatrix::PETScMatrix(const PETScMatrix& A) : PETScBaseMatrix(NULL)
+PETScMatrix::PETScMatrix(const PETScMatrix& A) : PETScBaseMatrix()
 {
-  if (A.mat())
+  dolfin_assert(A.mat());
+  if (!A.empty())
   {
     PetscErrorCode ierr = MatDuplicate(A.mat(), MAT_COPY_VALUES, &_matA);
     if (ierr != 0) petsc_error(ierr, __FILE__, "MatDuplicate");
   }
+  else
+  {
+    // Create uninitialised matrix
+    PetscErrorCode ierr = MatCreate(A.mpi_comm(), &_matA);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "MatCreate");
+  }
 }
 //-----------------------------------------------------------------------------
 PETScMatrix::~PETScMatrix()
@@ -74,239 +89,129 @@ PETScMatrix::~PETScMatrix()
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericMatrix> PETScMatrix::copy() const
 {
-  return std::shared_ptr<GenericMatrix>(new PETScMatrix(*this));
+  return std::make_shared<PETScMatrix>(*this);
 }
 //-----------------------------------------------------------------------------
 void PETScMatrix::init(const TensorLayout& tensor_layout)
 {
+  // Throw error if already initialised
+  if (!empty())
+  {
+    dolfin_error("PETScMatrix.cpp",
+                 "init PETSc matrix",
+                 "PETScMatrix may not be initialized more than once.");
+    MatDestroy(&_matA);
+  }
+
   PetscErrorCode ierr;
 
   // Get global dimensions and local range
   dolfin_assert(tensor_layout.rank() == 2);
   const std::size_t M = tensor_layout.size(0);
   const std::size_t N = tensor_layout.size(1);
-  const std::pair<std::size_t, std::size_t> row_range
+  const std::pair<std::int64_t, std::int64_t> row_range
     = tensor_layout.local_range(0);
-  const std::pair<std::size_t, std::size_t> col_range
+  const std::pair<std::int64_t, std::int64_t> col_range
     = tensor_layout.local_range(1);
   const std::size_t m = row_range.second - row_range.first;
   const std::size_t n = col_range.second - col_range.first;
 
   // Get sparsity pattern
-  dolfin_assert(tensor_layout.sparsity_pattern());
-  const GenericSparsityPattern& sparsity_pattern
-    = *tensor_layout.sparsity_pattern();
+  auto sparsity_pattern = tensor_layout.sparsity_pattern();
 
-  if (_matA)
-  {
-    dolfin_error("PETScMatrix.cpp",
-                 "init PETSc matrix",
-                 "PETScMatrix may not be initialized more than once.");
-    MatDestroy(&_matA);
-  }
+  // Get block size
+  int block_size = tensor_layout.index_map(0)->block_size();
+  if (block_size != tensor_layout.index_map(1)->block_size())
+    block_size = 1;
 
-  // Initialize matrix
-  if (dolfin::MPI::size(sparsity_pattern.mpi_comm()) == 1)
-  {
-    // Get number of nonzeros for each row from sparsity pattern
-    std::vector<std::size_t> num_nonzeros(M);
-    sparsity_pattern.num_nonzeros_diagonal(num_nonzeros);
+  // Get number of nonzeros for each row from sparsity pattern
+  std::vector<std::size_t> num_nonzeros_diagonal, num_nonzeros_off_diagonal;
+  sparsity_pattern->num_nonzeros_diagonal(num_nonzeros_diagonal);
+  sparsity_pattern->num_nonzeros_off_diagonal(num_nonzeros_off_diagonal);
 
-    // Create matrix
-    ierr = MatCreate(PETSC_COMM_SELF, &_matA);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatCreate");
+  // Set matrix size
+  ierr = MatSetSizes(_matA, m, n, M, N);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetSizes");
 
-    // Set options prefix (if any)
-    PetscErrorCode ierr = MatSetOptionsPrefix(_matA, _petsc_options_prefix.c_str());
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetOptionsPrefix");
+  // Apply PETSc options from the options database to the matrix (this
+  // includes changing the matrix type to one specified by the user)
+  ierr = MatSetFromOptions(_matA);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetFromOptions");
 
-    // Set size
-    ierr = MatSetSizes(_matA, M, N, M, N);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetSizes");
+  // Build data to intialise sparsity pattern (modify for block size)
+  std::vector<PetscInt> _num_nonzeros_diagonal(num_nonzeros_diagonal.size()/block_size),
+    _num_nonzeros_off_diagonal(num_nonzeros_off_diagonal.size()/block_size);
 
-    // Set matrix type according to chosen architecture
-    ierr = MatSetType(_matA, MATSEQAIJ);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetType");
+  for (std::size_t i = 0; i < _num_nonzeros_diagonal.size(); ++i)
+    _num_nonzeros_diagonal[i] = num_nonzeros_diagonal[block_size*i]/block_size;
+  for (std::size_t i = 0; i < _num_nonzeros_off_diagonal.size(); ++i)
+    _num_nonzeros_off_diagonal[i] = num_nonzeros_off_diagonal[block_size*i]/block_size;
 
-    // Set block size
-    if (tensor_layout.block_size > 1)
-    {
-     ierr =  MatSetBlockSize(_matA, tensor_layout.block_size);
-     if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetBlockSize");
-    }
+  // Allocate space (using data from sparsity pattern)
+  ierr = MatXAIJSetPreallocation(_matA, block_size,
+                                 _num_nonzeros_diagonal.data(),
+                                 _num_nonzeros_off_diagonal.data(), NULL, NULL);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatXIJSetPreallocation");
 
-    // FIXME: Change to MatSeqAIJSetPreallicationCSR for improved performance?
 
-    // Allocate space (using data from sparsity pattern)
-
-    // Copy number of non-zeros to PetscInt type
-    const std::vector<PetscInt> _num_nonzeros(num_nonzeros.begin(),
-                                              num_nonzeros.end());
-    ierr = MatSeqAIJSetPreallocation(_matA, 0, _num_nonzeros.data());
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatSeqAIJSetPreallocation");
-
-    ISLocalToGlobalMapping petsc_local_to_global0, petsc_local_to_global1;
-    dolfin_assert(tensor_layout.local_to_global_map.size() == 2);
-
-    // Block size
-    const std::size_t bs = tensor_layout.block_size;
-
-    // Set local-to-global mapping
-    std::vector<PetscInt> _map0, _map1;
-    if (tensor_layout.local_to_global_map[0].empty()
-        && tensor_layout.local_to_global_map[1].empty())
-    {
-      dolfin_assert(bs == 1);
-      _map0.resize(M);
-      _map1.resize(N);
-      for (std::size_t i = 0; i < M; ++i)
-        _map0[i] = i;
-      for (std::size_t i = 0; i < N; ++i)
-        _map1[i] = i;
-    }
-    else
-    {
-      #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-      _map0.assign(tensor_layout.local_to_global_map[0].begin(),
-                   tensor_layout.local_to_global_map[0].end());
-      _map1.assign(tensor_layout.local_to_global_map[1].begin(),
-                   tensor_layout.local_to_global_map[1].end());
-      #else
-      _map0 = std::vector<PetscInt>(tensor_layout.local_to_global_map[0].size()/bs);
-      _map1 = std::vector<PetscInt>(tensor_layout.local_to_global_map[1].size()/bs);
-      for (std::size_t i = 0; i < _map0.size(); ++i)
-        _map0[i] = tensor_layout.local_to_global_map[0][i*bs]/bs;
-      for (std::size_t i = 0; i < _map1.size(); ++i)
-        _map1[i] = tensor_layout.local_to_global_map[1][i*bs]/bs;
-      #endif
-    }
-    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-    ISLocalToGlobalMappingCreate(PETSC_COMM_SELF, _map0.size(), _map0.data(),
-                                 PETSC_COPY_VALUES, &petsc_local_to_global0);
-    ISLocalToGlobalMappingCreate(PETSC_COMM_SELF, _map1.size(), _map1.data(),
-                                 PETSC_COPY_VALUES, &petsc_local_to_global1);
-    #else
-    ISLocalToGlobalMappingCreate(PETSC_COMM_SELF, bs, _map0.size(), _map0.data(),
-                                 PETSC_COPY_VALUES, &petsc_local_to_global0);
-    ISLocalToGlobalMappingCreate(PETSC_COMM_SELF, bs, _map1.size(), _map1.data(),
-                                 PETSC_COPY_VALUES, &petsc_local_to_global1);
-    #endif
-    MatSetLocalToGlobalMapping(_matA, petsc_local_to_global0,
-                               petsc_local_to_global1);
-    ISLocalToGlobalMappingDestroy(&petsc_local_to_global0);
-    ISLocalToGlobalMappingDestroy(&petsc_local_to_global1);
-  }
-  else
-  {
-    // Get number of nonzeros for each row from sparsity pattern
-    std::vector<std::size_t> num_nonzeros_diagonal;
-    std::vector<std::size_t> num_nonzeros_off_diagonal;
-    sparsity_pattern.num_nonzeros_diagonal(num_nonzeros_diagonal);
-    sparsity_pattern.num_nonzeros_off_diagonal(num_nonzeros_off_diagonal);
-
-    // Create matrix
-    ierr = MatCreate(PETSC_COMM_WORLD, &_matA);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatCreate");
-
-    // Set options prefix (if any)
-    PetscErrorCode ierr = MatSetOptionsPrefix(_matA, _petsc_options_prefix.c_str());
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetOptionsPrefix");
-
-    // Set size
-    ierr = MatSetSizes(_matA, m, n, M, N);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetSizes");
-
-    // Set matrix type
-    ierr = MatSetType(_matA, MATMPIAIJ);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetType");
-
-    // Set block size
-    if (tensor_layout.block_size > 1)
-    {
-      ierr = MatSetBlockSize(_matA, tensor_layout.block_size);
-      if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetBlockSize");
-    }
-
-    // Apply PETSc options from the options database to the matrix
-    // (this includes changing the matrix type to one specified by the
-    // user)
-    ierr = MatSetFromOptions(_matA);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetFromOptions");
-
-    // Allocate space (using data from sparsity pattern)
-    const std::vector<PetscInt>
-      _num_nonzeros_diagonal(num_nonzeros_diagonal.begin(),
-                             num_nonzeros_diagonal.end());
-    const std::vector<PetscInt>
-      _num_nonzeros_off_diagonal(num_nonzeros_off_diagonal.begin(),
-                                 num_nonzeros_off_diagonal.end());
-    ierr = MatMPIAIJSetPreallocation(_matA, 0, _num_nonzeros_diagonal.data(),
-                                     0, _num_nonzeros_off_diagonal.data());
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatMPIAIJSetPreallocation");
-
-
-    ISLocalToGlobalMapping petsc_local_to_global0, petsc_local_to_global1;
-    dolfin_assert(tensor_layout.local_to_global_map.size() == 2);
-
-    std::vector<PetscInt> _map0, _map1;
-    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-    _map0.assign(tensor_layout.local_to_global_map[0].begin(),
-                 tensor_layout.local_to_global_map[0].end());
-    _map1.assign(tensor_layout.local_to_global_map[1].begin(),
-                 tensor_layout.local_to_global_map[1].end());
-    ISLocalToGlobalMappingCreate(PETSC_COMM_WORLD, _map0.size(), _map0.data(),
-                                 PETSC_COPY_VALUES, &petsc_local_to_global0);
-    ISLocalToGlobalMappingCreate(PETSC_COMM_WORLD, _map1.size(), _map1.data(),
-                                 PETSC_COPY_VALUES, &petsc_local_to_global1);
-    #else
-    // Block size
-    const std::size_t bs = tensor_layout.block_size;
-
-    _map0.resize(tensor_layout.local_to_global_map[0].size()/bs);
-    _map1.resize(tensor_layout.local_to_global_map[1].size()/bs);
-    for (std::size_t i = 0; i < _map0.size(); ++i)
-      _map0[i] = tensor_layout.local_to_global_map[0][i*bs]/bs;
-    for (std::size_t i = 0; i < _map1.size(); ++i)
-      _map1[i] = tensor_layout.local_to_global_map[1][i*bs]/bs;
-    ISLocalToGlobalMappingCreate(PETSC_COMM_WORLD, bs, _map0.size(),
-                                 _map0.data(),
-                                 PETSC_COPY_VALUES, &petsc_local_to_global0);
-    ISLocalToGlobalMappingCreate(PETSC_COMM_WORLD, bs, _map1.size(),
-                                 _map1.data(),
-                                 PETSC_COPY_VALUES, &petsc_local_to_global1);
-    #endif
-
-    MatSetLocalToGlobalMapping(_matA, petsc_local_to_global0,
-                               petsc_local_to_global1);
-
-#if PETSC_VERSION_GE(3, 6, 0)
-    // Note: This should be called after having set the l2g map for
-    // MATIS (this is a dummy call if _matA is not of type MATIS)
-    ierr = MatISSetPreallocation(_matA, 0, _num_nonzeros_diagonal.data(),
-                                 0, _num_nonzeros_off_diagonal.data());
-    if (ierr != 0) petsc_error(ierr, __FILE__, "MatISSetPreallocation");
-#endif
-
-    ISLocalToGlobalMappingDestroy(&petsc_local_to_global0);
-    ISLocalToGlobalMappingDestroy(&petsc_local_to_global1);
-  }
+  // Create pointers to PETSc IndexSet for local-to-globa map
+  ISLocalToGlobalMapping petsc_local_to_global0, petsc_local_to_global1;
+  dolfin_assert(tensor_layout.rank() == 2);
 
-  // Set some options
+  std::vector<PetscInt> _map0, _map1;
+  _map0.resize(tensor_layout.index_map(0)->size(IndexMap::MapSize::ALL)/block_size);
+  _map1.resize(tensor_layout.index_map(1)->size(IndexMap::MapSize::ALL)/block_size);
+
+  for (std::size_t i = 0; i < _map0.size(); ++i)
+    _map0[i] = tensor_layout.index_map(0)->local_to_global(i*block_size)/block_size;
+  for (std::size_t i = 0; i < _map1.size(); ++i)
+    _map1[i] = tensor_layout.index_map(1)->local_to_global(i*block_size)/block_size;
+
+  // FIXME: In many cases the rows and columns could shared a commin
+  // local-to-global map
+
+  // Create PETSc local-to-global map/index set
+  ISLocalToGlobalMappingCreate(mpi_comm(), block_size, _map0.size(), _map0.data(),
+                               PETSC_COPY_VALUES, &petsc_local_to_global0);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "ISLocalToGlobalMappingCreate");
+  ISLocalToGlobalMappingCreate(mpi_comm(), block_size, _map1.size(), _map1.data(),
+                               PETSC_COPY_VALUES, &petsc_local_to_global1);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "ISLocalToGlobalMappingCreate");
+
+  // Set matrix local-to-global maps
+  MatSetLocalToGlobalMapping(_matA, petsc_local_to_global0,
+                             petsc_local_to_global1);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetLocalToGlobalMapping");
+
+  // Note: This should be called after having set the local-to-global
+  // map for MATIS (this is a dummy call if _matA is not of type
+  // MATIS)
+  ierr = MatISSetPreallocation(_matA, 0, _num_nonzeros_diagonal.data(),
+                               0, _num_nonzeros_off_diagonal.data());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatISSetPreallocation");
+
+  // Clean up local-to-global maps
+  ISLocalToGlobalMappingDestroy(&petsc_local_to_global0);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "ISLocalToGlobalMappingDestroy");
+  ISLocalToGlobalMappingDestroy(&petsc_local_to_global1);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "ISLocalToGlobalMappingDestroy");
+
+  // Set some options on _matA object
 
   // Do not allow more entries than have been pre-allocated
   ierr = MatSetOption(_matA, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_TRUE);
   if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetOption");
 
+  // Keep nonzero structure after calling MatZeroRows
   ierr = MatSetOption(_matA, MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
   if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetOption");
-
-  ierr = MatSetUp(_matA);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetUp");
 }
 //-----------------------------------------------------------------------------
 bool PETScMatrix::empty() const
 {
-  return _matA ? false : true;
+  auto sizes = PETScBaseMatrix::size();
+  dolfin_assert((sizes.first < 1 and sizes.second < 1) or (sizes.first > 0 and sizes.second > 0));
+  return (sizes.first < 1) and (sizes.second < 1);
 }
 //-----------------------------------------------------------------------------
 void PETScMatrix::get(double* block,
@@ -506,7 +411,7 @@ void PETScMatrix::mult(const GenericVector& x, GenericVector& y) const
   const PETScVector& xx = as_type<const PETScVector>(x);
   PETScVector& yy = as_type<PETScVector>(y);
 
-  if (size(1) != xx.size())
+  if (this->size(1) != xx.size())
   {
     dolfin_error("PETScMatrix.cpp",
                  "compute matrix-vector product with PETSc matrix",
@@ -647,10 +552,7 @@ void PETScMatrix::apply(std::string mode)
 //-----------------------------------------------------------------------------
 MPI_Comm PETScMatrix::mpi_comm() const
 {
-  dolfin_assert(_matA);
-  MPI_Comm mpi_comm = MPI_COMM_NULL;
-  PetscObjectGetComm((PetscObject)_matA, &mpi_comm);
-  return mpi_comm;
+  return PETScBaseMatrix::mpi_comm();
 }
 //-----------------------------------------------------------------------------
 std::size_t PETScMatrix::nnz() const
@@ -704,30 +606,22 @@ GenericLinearAlgebraFactory& PETScMatrix::factory() const
 //-----------------------------------------------------------------------------
 void PETScMatrix::set_options_prefix(std::string options_prefix)
 {
-  if (_matA)
-  {
-    dolfin_error("PETScMatrix.cpp",
-                 "setting PETSc options prefix",
-                 "Cannot set options prefix since PETSc Mat has already been initialized");
-
-  }
-  else
-    _petsc_options_prefix = options_prefix;
+  dolfin_assert(_matA);
+  MatSetOptionsPrefix(_matA, options_prefix.c_str());
 }
 //-----------------------------------------------------------------------------
 std::string PETScMatrix::get_options_prefix() const
 {
-  if (_matA)
-  {
-    const char* prefix = NULL;
-    MatGetOptionsPrefix(_matA, &prefix);
-    return std::string(prefix);
-  }
-  else
-  {
-    warning("PETSc Mat object has not been initialised, therefore prefix has not been set");
-    return std::string();
-  }
+  dolfin_assert(_matA);
+  const char* prefix = NULL;
+  MatGetOptionsPrefix(_matA, &prefix);
+  return std::string(prefix);
+}
+//-----------------------------------------------------------------------------
+void PETScMatrix::set_from_options()
+{
+  dolfin_assert(_matA);
+  MatSetFromOptions(_matA);
 }
 //-----------------------------------------------------------------------------
 const PETScMatrix& PETScMatrix::operator= (const PETScMatrix& A)
@@ -771,44 +665,30 @@ const PETScMatrix& PETScMatrix::operator= (const PETScMatrix& A)
 //-----------------------------------------------------------------------------
 void PETScMatrix::set_nullspace(const VectorSpaceBasis& nullspace)
 {
-  PetscErrorCode ierr;
-
-  // Copy vectors
-  std::vector<PETScVector> _nullspace;
-  for (std::size_t i = 0; i < nullspace.dim(); ++i)
-  {
-    dolfin_assert(nullspace[i]);
-    const PETScVector& x = nullspace[i]->down_cast<PETScVector>();
-
-    // Copy vector
-    _nullspace.push_back(x);
-  }
+  // Build PETSc nullspace
+  MatNullSpace petsc_ns = create_petsc_nullspace(nullspace);
 
-  // Get pointers to underlying PETSc objects and normalize vectors
-  std::vector<Vec> petsc_vecs;
-  for (auto& basis_vector : _nullspace)
-  {
-    // Store pointer to PETSc Vec
-    petsc_vecs.push_back(basis_vector.vec());
-
-    PetscReal val = 0.0;
-    ierr = VecNormalize(basis_vector.vec(), &val);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "VecNormalize");
-  }
+  // Attach PETSc nullspace to matrix
+  dolfin_assert(_matA);
+  PetscErrorCode ierr = MatSetNullSpace(_matA, petsc_ns);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetNullSpace");
 
-  // Create PETSC nullspace
-  MatNullSpace petsc_nullspace = NULL;
-  ierr = MatNullSpaceCreate(mpi_comm(), PETSC_FALSE, petsc_vecs.size(),
-                            petsc_vecs.data(), &petsc_nullspace);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "MatNullSpaceCreate");
+  // Decrease reference count for nullspace by destroying
+  MatNullSpaceDestroy(&petsc_ns);
+}
+//-----------------------------------------------------------------------------
+void PETScMatrix::set_near_nullspace(const VectorSpaceBasis& nullspace)
+{
+  // Create PETSc nullspace
+  MatNullSpace petsc_ns = create_petsc_nullspace(nullspace);
 
-  // Attach PETSc nullspace to matrix
+  // Attach near  nullspace to matrix
   dolfin_assert(_matA);
-  ierr = MatSetNullSpace(_matA, petsc_nullspace);
+  PetscErrorCode ierr = MatSetNearNullSpace(_matA, petsc_ns);
   if (ierr != 0) petsc_error(ierr, __FILE__, "MatSetNullSpace");
 
   // Decrease reference count for nullspace
-  MatNullSpaceDestroy(&petsc_nullspace);
+  MatNullSpaceDestroy(&petsc_ns);
 }
 //-----------------------------------------------------------------------------
 void PETScMatrix::binary_dump(std::string file_name) const
@@ -816,7 +696,7 @@ void PETScMatrix::binary_dump(std::string file_name) const
   PetscErrorCode ierr;
 
   PetscViewer view_out;
-  ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD, file_name.c_str(),
+  ierr = PetscViewerBinaryOpen(mpi_comm(), file_name.c_str(),
                                FILE_MODE_WRITE, &view_out);
   if (ierr != 0) petsc_error(ierr, __FILE__, "PetscViewerBinaryOpen");
 
@@ -829,7 +709,8 @@ void PETScMatrix::binary_dump(std::string file_name) const
 //-----------------------------------------------------------------------------
 std::string PETScMatrix::str(bool verbose) const
 {
-  if (!_matA)
+  dolfin_assert(_matA);
+  if (this->empty())
     return "<Uninitialized PETScMatrix>";
 
   std::stringstream s;
@@ -840,7 +721,7 @@ std::string PETScMatrix::str(bool verbose) const
     // FIXME: Maybe this could be an option?
     dolfin_assert(_matA);
     PetscErrorCode ierr;
-    if (MPI::size(MPI_COMM_WORLD) > 1)
+    if (MPI::size(mpi_comm()) > 1)
     {
       ierr = MatView(_matA, PETSC_VIEWER_STDOUT_WORLD);
       if (ierr != 0) petsc_error(ierr, __FILE__, "MatView");
@@ -857,5 +738,35 @@ std::string PETScMatrix::str(bool verbose) const
   return s.str();
 }
 //-----------------------------------------------------------------------------
+MatNullSpace PETScMatrix::create_petsc_nullspace(const VectorSpaceBasis& nullspace) const
+{
+  PetscErrorCode ierr;
+
+  // Copy vectors in vector space object
+  std::vector<PETScVector> _nullspace;
+  for (std::size_t i = 0; i < nullspace.dim(); ++i)
+  {
+    dolfin_assert(nullspace[i]);
+    const PETScVector& x = nullspace[i]->down_cast<PETScVector>();
+
+    // Copy vector
+    _nullspace.push_back(x);
+  }
+
+  // Get pointers to underlying PETSc objects
+  std::vector<Vec> petsc_vecs;
+  for (auto& basis_vector : _nullspace)
+    petsc_vecs.push_back(basis_vector.vec());
+
+  // Create PETSC nullspace
+  MatNullSpace petsc_nullspace = NULL;
+  ierr = MatNullSpaceCreate(mpi_comm(), PETSC_FALSE, petsc_vecs.size(),
+                            petsc_vecs.data(), &petsc_nullspace);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatNullSpaceCreate");
+
+  return petsc_nullspace;
+}
+//-----------------------------------------------------------------------------
+
 
 #endif
diff --git a/dolfin/la/PETScMatrix.h b/dolfin/la/PETScMatrix.h
index 442f396..60a92a1 100644
--- a/dolfin/la/PETScMatrix.h
+++ b/dolfin/la/PETScMatrix.h
@@ -1,4 +1,5 @@
-// Copyright (C) 2004-2012 Johan Hoffman, Johan Jansson and Anders Logg
+// Copyright (C) 2004-2012 Johan Hoffman, Johan Jansson, Anders Logg
+// and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -58,10 +59,14 @@ namespace dolfin
   {
   public:
 
-    /// Create empty matrix
+    /// Create empty matrix (on MPI_COMM_WORLD)
     PETScMatrix();
 
-    /// Create a wrapper around a PETSc Mat pointer
+    /// Create empty matrix
+    explicit PETScMatrix(MPI_Comm comm);
+
+    /// Create a wrapper around a PETSc Mat pointer. The Mat object
+    /// should have been created, e.g. via PETSc MatrCreate.
     explicit PETScMatrix(Mat A);
 
     /// Copy constructor
@@ -83,7 +88,7 @@ namespace dolfin
     { return PETScBaseMatrix::size(dim); }
 
     /// Return local ownership range
-    std::pair<std::size_t, std::size_t> local_range(std::size_t dim) const
+    std::pair<std::int64_t, std::int64_t> local_range(std::size_t dim) const
     { return PETScBaseMatrix::local_range(dim); }
 
     /// Return number of non-zero entries in matrix (collective)
@@ -214,19 +219,27 @@ namespace dolfin
     /// database
     std::string get_options_prefix() const;
 
+    /// Call PETSc function MatSetFromOptions on the PETSc Mat object
+    void set_from_options();
+
     /// Assignment operator
     const PETScMatrix& operator= (const PETScMatrix& A);
 
-    /// Attach nullspace to matrix
+    /// Attach nullspace to matrix (typically used by Krylov solvers
+    /// when solving singular systems)
     void set_nullspace(const VectorSpaceBasis& nullspace);
 
+    /// Attach near nullspace to matrix (used by preconditioners, such
+    /// as smoothed aggregation algerbraic multigrid)
+    void set_near_nullspace(const VectorSpaceBasis& nullspace);
+
     /// Dump matrix to PETSc binary format
     void binary_dump(std::string file_name) const;
 
   private:
 
-    // Prefix for PETSc options database
-    std::string _petsc_options_prefix;
+    // Create PETSc nullspace object
+    MatNullSpace create_petsc_nullspace(const VectorSpaceBasis& nullspace) const;
 
     // PETSc norm types
     static const std::map<std::string, NormType> norm_types;
diff --git a/dolfin/la/PETScOptions.cpp b/dolfin/la/PETScOptions.cpp
index 8cecc87..7079bdf 100644
--- a/dolfin/la/PETScOptions.cpp
+++ b/dolfin/la/PETScOptions.cpp
@@ -54,7 +54,11 @@ void PETScOptions::clear(std::string option)
 {
   SubSystemsManager::init_petsc();
   PetscErrorCode ierr;
+  #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
   ierr = PetscOptionsClearValue(option.c_str());
+  #else
+  ierr = PetscOptionsClearValue(NULL, option.c_str());
+  #endif
   if (ierr != 0)
   {
     dolfin_error("PETScOptions.cpp",
diff --git a/dolfin/la/PETScOptions.h b/dolfin/la/PETScOptions.h
index 256716a..2403c03 100644
--- a/dolfin/la/PETScOptions.h
+++ b/dolfin/la/PETScOptions.h
@@ -34,9 +34,9 @@ namespace dolfin
 
   /// These class provides static functions that permit users to set
   /// and retrieve PETSc options via the PETSc option/parameter
-  /// system. The option should be prefixed by '-', e.g.
+  /// system. The option must not be prefixed by '-', e.g.
   ///
-  ///     PETScOptions::set("mat_mumps_icntl_14", 40.0);
+  ///     PETScOptions::set("mat_mumps_icntl_14", 40);
 
   class PETScOptions
   {
@@ -65,8 +65,13 @@ namespace dolfin
 
       PetscErrorCode ierr;
       std::string _option = "-" + option;
+      #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
       ierr = PetscOptionsSetValue(_option.c_str(),
-                           boost::lexical_cast<std::string>(value).c_str());
+               boost::lexical_cast<std::string>(value).c_str());
+      #else
+      ierr = PetscOptionsSetValue(NULL, _option.c_str(),
+               boost::lexical_cast<std::string>(value).c_str());
+      #endif
       if (ierr != 0)
       {
         dolfin_error("PETScOptions.h",
diff --git a/dolfin/la/PETScPreconditioner.cpp b/dolfin/la/PETScPreconditioner.cpp
index cc2acb1..905a962 100644
--- a/dolfin/la/PETScPreconditioner.cpp
+++ b/dolfin/la/PETScPreconditioner.cpp
@@ -84,6 +84,7 @@ PETScPreconditioner::preconditioners()
   return PETScPreconditioner::_methods_descr;
 }
 //-----------------------------------------------------------------------------
+/*
 Parameters PETScPreconditioner::default_parameters()
 {
   Parameters p(KrylovSolver::default_parameters()("preconditioner"));
@@ -97,12 +98,45 @@ Parameters PETScPreconditioner::default_parameters()
 
   return p;
 }
+*/
 //-----------------------------------------------------------------------------
-PETScPreconditioner::PETScPreconditioner(std::string type)
-  : _type(type), petsc_near_nullspace(NULL), gdim(0)
+void PETScPreconditioner::set_type(PETScKrylovSolver& solver, std::string type)
+{
+  // Get KSP object
+  KSP ksp = solver.ksp();
+  if (!ksp)
+  {
+    dolfin_error("PETScPreconditioner.cpp",
+                 "set PETSc preconditioner type",
+                 "PETSc KSP object has not been intialized");
+  }
+
+  // Check that pc type is known
+  auto pc_type_pair = _methods.find(type);
+  if (pc_type_pair == _methods.end())
+  {
+    dolfin_error("PETScPreconditioner.cpp",
+                 "set PETSc preconditioner type",
+                 "Unknown preconditioner type (\"%s\")", type.c_str());
+  }
+
+  PetscErrorCode ierr;
+
+  // Get PETSc PC pointer
+  PC pc = nullptr;
+  ierr = KSPGetPC(ksp, &pc);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "KSPGetPC");
+
+  // Set PC type
+  if (type != "default")
+    ierr = PCSetType(pc, pc_type_pair->second);
+}
+//-----------------------------------------------------------------------------
+PETScPreconditioner::PETScPreconditioner(std::string type) : _type(type),
+                                                             gdim(0)
 {
   // Set parameter values
-  parameters = default_parameters();
+  //parameters = default_parameters();
 
   // Check that the requested method is known
   if (_methods.count(type) == 0)
@@ -115,8 +149,7 @@ PETScPreconditioner::PETScPreconditioner(std::string type)
 //-----------------------------------------------------------------------------
 PETScPreconditioner::~PETScPreconditioner()
 {
-  if (petsc_near_nullspace)
-    MatNullSpaceDestroy(&petsc_near_nullspace);
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
 void PETScPreconditioner::set(PETScKrylovSolver& solver)
@@ -178,29 +211,6 @@ void PETScPreconditioner::set(PETScKrylovSolver& solver)
     ierr = PCSetType(pc, PCGAMG);
     if (ierr != 0) petsc_error(ierr, __FILE__, "PCSetType");
   }
-  else if (_type == "additive_schwarz")
-  {
-    // Select method and overlap
-    ierr = PCSetType(pc, _methods.find("additive_schwarz")->second);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "PCSetType");
-
-    const int schwarz_overlap = parameters("schwarz")["overlap"];
-    PCASMSetOverlap(pc, schwarz_overlap);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "PCASMSetOverlap");
-  }
-  else if (_type != "default")
-  {
-    ierr = PCSetType(pc, _methods.find(_type)->second);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "PCSetType");
-    ierr = PCFactorSetShiftType(pc, MAT_SHIFT_NONZERO);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "PCFactorSetShiftType");
-    ierr = PCFactorSetShiftAmount(pc, parameters["shift_nonzero"]);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "PCFactorSetShiftAmount");
-  }
-
-  const int ilu_levels = parameters("ilu")["fill_level"];
-  ierr = PCFactorSetLevels(pc, ilu_levels);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "PCFactorSetLevels");
 
   // Set physical coordinates for row dofs
   if (!_coordinates.empty())
@@ -214,57 +224,7 @@ void PETScPreconditioner::set(PETScKrylovSolver& solver)
   // Clear memory
   _coordinates.clear();
 
-  std::string prefix = std::string(parameters["options_prefix"]);
-  if (prefix != "default")
-  {
-    // Make sure that the prefix has a '_' at the end if the user
-    // didn't provide it
-    char lastchar = *prefix.rbegin();
-    if (lastchar != '_')
-      prefix += "_";
-
-    PCSetOptionsPrefix(pc, prefix.c_str());
-  }
   PCSetFromOptions(pc);
-
-  // Print preconditioner information
-  const bool report = parameters["report"];
-  if (report)
-  {
-    ierr = PCSetUp(pc);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "PCSetUp");
-    ierr = PCView(pc, PETSC_VIEWER_STDOUT_WORLD);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "PCView");
-  }
-}
-//-----------------------------------------------------------------------------
-void PETScPreconditioner::set_nullspace(const VectorSpaceBasis& near_nullspace)
-{
-  // Clear near nullspace
-  if (petsc_near_nullspace)
-    MatNullSpaceDestroy(&petsc_near_nullspace);
-  _near_nullspace.clear();
-
-  // Copy vectors
-  for (std::size_t i = 0; i < near_nullspace.dim(); ++i)
-  {
-    dolfin_assert(near_nullspace[i]);
-    const PETScVector& x = near_nullspace[i]->down_cast<PETScVector>();
-
-    // Copy vector
-    _near_nullspace.push_back(x);
-  }
-
-  // Get pointers to underlying PETSc objects
-  std::vector<Vec> petsc_vec(near_nullspace.dim());
-  for (std::size_t i = 0; i < near_nullspace.dim(); ++i)
-    petsc_vec[i] = _near_nullspace[i].vec();
-
-  // Create null space
-  PetscErrorCode ierr;
-  ierr = MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_FALSE, near_nullspace.dim(),
-                            petsc_vec.data(), &petsc_near_nullspace);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "MatNullSpaceCreate");
 }
 //-----------------------------------------------------------------------------
 void PETScPreconditioner::set_coordinates(const std::vector<double>& x,
@@ -296,7 +256,7 @@ void PETScPreconditioner::set_fieldsplit(
   {
     // Create IndexSet
     IS is;
-    ierr = ISCreateGeneral(PETSC_COMM_WORLD, fields[i].size(), fields[i].data(),
+    ierr = ISCreateGeneral(solver.mpi_comm(), fields[i].size(), fields[i].data(),
                            PETSC_USE_POINTER, &is);
     if (ierr != 0) petsc_error(ierr, __FILE__, "ISCreateGeneral");
 
diff --git a/dolfin/la/PETScPreconditioner.h b/dolfin/la/PETScPreconditioner.h
index c531f61..26487f6 100644
--- a/dolfin/la/PETScPreconditioner.h
+++ b/dolfin/la/PETScPreconditioner.h
@@ -34,7 +34,6 @@
 #include <dolfin/common/Variable.h>
 #include <dolfin/la/PETScObject.h>
 #include <dolfin/parameter/Parameters.h>
-#include "GenericPreconditioner.h"
 
 namespace dolfin
 {
@@ -49,11 +48,12 @@ namespace dolfin
   /// PETScKrylovSolver and set the preconditioner type and
   /// parameters.
 
-  class PETScPreconditioner : public PETScObject,
-    public GenericPreconditioner, public Variable
+  class PETScPreconditioner : public PETScObject, public Variable
   {
   public:
 
+    static void set_type(PETScKrylovSolver& solver, std::string type);
+
     /// Create a particular preconditioner object
     explicit PETScPreconditioner(std::string type = "default");
 
@@ -63,15 +63,6 @@ namespace dolfin
     /// Set the preconditioner type and parameters
     virtual void set(PETScKrylovSolver& solver);
 
-    /// Set the (near) null space of the preconditioner operator
-    /// (matrix). This is required for certain preconditioner types,
-    /// e.g. smoothed aggregation multigrid
-    void set_nullspace(const VectorSpaceBasis& near_nullspace);
-
-    /// Return the PETSc null space
-    MatNullSpace near_nullspace() const
-    { return petsc_near_nullspace; }
-
     /// Set the coordinates of the operator (matrix) rows and
     /// geometric dimension d. This is can be used by required for
     /// certain preconditioners, e.g. ML. The input for this function
@@ -81,7 +72,7 @@ namespace dolfin
     // FIXME: Document
     void
       set_fieldsplit(PETScKrylovSolver& solver,
-                     const std::vector<std::vector<dolfin::la_index> >& fields,
+                     const std::vector<std::vector<dolfin::la_index>>& fields,
                      const std::vector<std::string>& split_names);
 
     /// Return informal string representation (pretty-print)
@@ -91,7 +82,7 @@ namespace dolfin
     static std::map<std::string, std::string> preconditioners();
 
     /// Default parameter values
-    static Parameters default_parameters();
+    //static Parameters default_parameters();
 
     friend class PETScSNESSolver;
 
@@ -109,12 +100,6 @@ namespace dolfin
     static const std::map<std::string, std::string>
       _methods_descr;
 
-    // Near null space vectors
-    std::vector<PETScVector> _near_nullspace;
-
-    // PETSc near null space.
-    MatNullSpace petsc_near_nullspace;
-
     // Operator row coordinates
     std::vector<double> _coordinates;
 
diff --git a/dolfin/la/PETScUserPreconditioner.cpp b/dolfin/la/PETScUserPreconditioner.cpp
index acd67e8..7e35613 100644
--- a/dolfin/la/PETScUserPreconditioner.cpp
+++ b/dolfin/la/PETScUserPreconditioner.cpp
@@ -26,11 +26,7 @@
 #include <memory>
 
 #include <petscversion.h>
-#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 6
 #include <petsc/private/pcimpl.h>
-#else
-#include <petsc-private/pcimpl.h>
-#endif
 
 #include <dolfin/common/NoDeleter.h>
 #include "PETScVector.h"
diff --git a/dolfin/la/PETScVector.cpp b/dolfin/la/PETScVector.cpp
index 7805bcc..802dd28 100644
--- a/dolfin/la/PETScVector.cpp
+++ b/dolfin/la/PETScVector.cpp
@@ -1,4 +1,5 @@
-// Copyright (C) 2004-2012 Johan Hoffman, Johan Jansson and Anders Logg
+// Copyright (C) 2004-2016 Johan Hoffman, Johan Jansson, Anders Logg
+// and Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -19,22 +20,20 @@
 // Modified by Martin Sandve Alnes 2008
 // Modified by Johannes Ring 2011.
 // Modified by Fredrik Valdmanis 2011-2012
-//
-// First added:  2004
-// Last changed: 2012-08-22
 
 #ifdef HAS_PETSC
 
 #include <cmath>
+#include <cstddef>
+#include <cstring>
 #include <numeric>
 #include <dolfin/common/Timer.h>
 #include <dolfin/common/Array.h>
-#include <dolfin/common/NoDeleter.h>
-#include <dolfin/common/Set.h>
+#include <dolfin/common/MPI.h>
 #include <dolfin/log/log.h>
+#include "SparsityPattern.h"
 #include "PETScVector.h"
 #include "PETScFactory.h"
-#include <dolfin/common/MPI.h>
 
 using namespace dolfin;
 
@@ -42,42 +41,42 @@ const std::map<std::string, NormType> PETScVector::norm_types
 = { {"l1",   NORM_1}, {"l2",   NORM_2},  {"linf", NORM_INFINITY} };
 
 //-----------------------------------------------------------------------------
-PETScVector::PETScVector() : _x(NULL)
+PETScVector::PETScVector() : PETScVector(MPI_COMM_WORLD)
 {
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-PETScVector::PETScVector(MPI_Comm comm, std::size_t N) : _x(NULL)
+PETScVector::PETScVector(MPI_Comm comm) : _x(nullptr)
 {
-  // Empty ghost indices vector
-  const std::vector<la_index> ghost_indices;
-  const std::vector<std::size_t> local_to_global_map;
-
-  // Compute a local range
-  const std::pair<std::size_t, std::size_t> range = MPI::local_range(comm, N);
-  _init(comm, range, local_to_global_map, ghost_indices);
+  PetscErrorCode ierr = VecCreate(comm, &_x);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "VecCreate");
+}
+//-----------------------------------------------------------------------------
+PETScVector::PETScVector(MPI_Comm comm, std::size_t N) : PETScVector(comm)
+{
+  // Compute a local range and initialise vector
+  const auto range = dolfin::MPI::local_range(comm, N);
+  _init(range, {}, {});
 }
 //-----------------------------------------------------------------------------
-PETScVector::PETScVector(const GenericSparsityPattern& sparsity_pattern)
-  : _x(NULL)
+PETScVector::PETScVector(const SparsityPattern& sparsity_pattern)
+  : PETScVector(sparsity_pattern.mpi_comm())
 {
-  std::vector<la_index> ghost_indices;
-  std::vector<std::size_t> local_to_global_map;
-  _init(sparsity_pattern.mpi_comm(), sparsity_pattern.local_range(0),
-        local_to_global_map, ghost_indices);
+  _init(sparsity_pattern.local_range(0), {}, {});
 }
 //-----------------------------------------------------------------------------
-PETScVector::PETScVector(Vec x): _x(x)
+PETScVector::PETScVector(Vec x) : _x(x)
 {
-  // Increase reference count
+  // Increase reference count to PETSc object
   PetscObjectReference((PetscObject)_x);
 }
 //-----------------------------------------------------------------------------
-PETScVector::PETScVector(const PETScVector& v) : _x(NULL)
+PETScVector::PETScVector(const PETScVector& v) : _x(nullptr)
 {
-  PetscErrorCode ierr;
+  dolfin_assert(v._x);
 
   // Create new vector
+  PetscErrorCode ierr;
   ierr = VecDuplicate(v._x, &_x);
   if (ierr != 0) petsc_error(ierr, __FILE__, "VecDuplicate");
 
@@ -95,50 +94,21 @@ PETScVector::~PETScVector()
     VecDestroy(&_x);
 }
 //-----------------------------------------------------------------------------
-bool PETScVector::distributed() const
-{
-  dolfin_assert(_x);
-
-  // Get type
-  VecType petsc_type;
-  PetscErrorCode ierr = VecGetType(_x, &petsc_type);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "VecGetType");
-
-  // Return type
-  bool _distributed = false;
-  if (strcmp(petsc_type, VECMPI) == 0)
-    _distributed = true;
-  else if (strcmp(petsc_type, VECSEQ) == 0)
-    _distributed =  false;
-  else
-  {
-    dolfin_error("PETScVector.cpp",
-                 "check whether PETSc vector is distributed",
-                 "Unknown vector type (\"%s\")", petsc_type);
-  }
-
-  return _distributed;
-}
-//-----------------------------------------------------------------------------
 std::shared_ptr<GenericVector> PETScVector::copy() const
 {
-  return std::shared_ptr<GenericVector>(new PETScVector(*this));
+  return std::make_shared<PETScVector>(*this);
 }
 //-----------------------------------------------------------------------------
 void PETScVector::init(MPI_Comm comm, std::size_t N)
 {
-  const std::pair<std::size_t, std::size_t> range
-    = MPI::local_range(comm, N);
-  init(comm, range);
+  const auto range = dolfin::MPI::local_range(comm, N);
+  _init(range, {}, {});
 }
 //-----------------------------------------------------------------------------
 void PETScVector::init(MPI_Comm comm,
                        std::pair<std::size_t, std::size_t> range)
 {
-  // Create empty ghost indices vector
-  std::vector<la_index> ghost_indices;
-  std::vector<std::size_t> local_to_global_map;
-  init(comm, range, local_to_global_map, ghost_indices);
+  _init(range, {}, {});
 }
 //-----------------------------------------------------------------------------
 void PETScVector::init(MPI_Comm comm,
@@ -146,14 +116,15 @@ void PETScVector::init(MPI_Comm comm,
                        const std::vector<std::size_t>& local_to_global_map,
                        const std::vector<la_index>& ghost_indices)
 {
-  // Re-initialise vector
-  _init(comm, range, local_to_global_map, ghost_indices);
+  // Initialise vector
+  _init(range, local_to_global_map, ghost_indices);
 }
 //-----------------------------------------------------------------------------
 void PETScVector::get_local(std::vector<double>& values) const
 {
   dolfin_assert(_x);
-  const std::size_t local_size = local_range().second - local_range().first;
+  const auto _local_range = local_range();
+  const std::size_t local_size = _local_range.second - _local_range.first;
   values.resize(local_size);
 
   if (local_size == 0)
@@ -175,7 +146,8 @@ void PETScVector::get_local(std::vector<double>& values) const
 void PETScVector::set_local(const std::vector<double>& values)
 {
   dolfin_assert(_x);
-  const std::size_t local_size = local_range().second - local_range().first;
+  const auto _local_range = local_range();
+  const std::size_t local_size = _local_range.second - _local_range.first;
   if (values.size() != local_size)
   {
     dolfin_error("PETScVector.cpp",
@@ -188,8 +160,7 @@ void PETScVector::set_local(const std::vector<double>& values)
 
   // Build array of local indices
   std::vector<PetscInt> rows(local_size, 0);
-  for (std::size_t i = 0; i < local_size; ++i)
-    rows[i] += i;
+  std::iota(rows.begin(), rows.end(), 0);
 
   PetscErrorCode ierr = VecSetValuesLocal(_x, local_size, rows.data(),
                                           values.data(), INSERT_VALUES);
@@ -199,7 +170,8 @@ void PETScVector::set_local(const std::vector<double>& values)
 void PETScVector::add_local(const Array<double>& values)
 {
   dolfin_assert(_x);
-  const std::size_t local_size = local_range().second - local_range().first;
+  const auto _local_range = local_range();
+  const std::size_t local_size = _local_range.second - _local_range.first;
   if (values.size() != local_size)
   {
     dolfin_error("PETScVector.cpp",
@@ -211,12 +183,11 @@ void PETScVector::add_local(const Array<double>& values)
     return;
 
   // Build array of local indices
-  std::vector<PetscInt> rows(local_size, 0);
-  for (std::size_t i = 0; i < local_size; ++i)
-    rows[i] += i;
+  std::vector<PetscInt> rows(local_size);
+  std::iota(rows.begin(), rows.end(), 0);
 
   PetscErrorCode ierr = VecSetValuesLocal(_x, local_size, rows.data(),
-                                     values.data(), ADD_VALUES);
+                                          values.data(), ADD_VALUES);
   if (ierr != 0) petsc_error(ierr, __FILE__, "VecSetValuesLocal");
 }
 //-----------------------------------------------------------------------------
@@ -229,7 +200,8 @@ void PETScVector::get_local(double* block, std::size_t m,
   dolfin_assert(_x);
   PetscErrorCode ierr;
 
-  Vec xg;
+  // Get ghost vector
+  Vec xg = NULL;
   ierr = VecGhostGetLocalForm(_x, &xg);
   if (ierr != 0) petsc_error(ierr, __FILE__, "VecGhostGetLocalForm");
 
@@ -254,6 +226,7 @@ void PETScVector::get_local(double* block, std::size_t m,
     dolfin_assert(xg);
     ierr = VecGetValues(xg, m, rows, block);
     if (ierr != 0) petsc_error(ierr, __FILE__, "VecGetValues");
+
     ierr = VecGhostRestoreLocalForm(_x, &xg);
     if (ierr != 0) petsc_error(ierr, __FILE__, "VecGhostRestoreLocalForm");
   }
@@ -275,8 +248,6 @@ void PETScVector::set(const double* block, std::size_t m,
                       const dolfin::la_index* rows)
 {
   dolfin_assert(_x);
-  if (m == 0)
-    return;
   PetscErrorCode ierr = VecSetValues(_x, m, rows, block, INSERT_VALUES);
   if (ierr != 0) petsc_error(ierr, __FILE__, "VecSetValues");
 }
@@ -285,8 +256,6 @@ void PETScVector::set_local(const double* block, std::size_t m,
                             const dolfin::la_index* rows)
 {
   dolfin_assert(_x);
-  if (m == 0)
-    return;
   PetscErrorCode ierr = VecSetValuesLocal(_x, m, rows, block, INSERT_VALUES);
   if (ierr != 0) petsc_error(ierr, __FILE__, "VecSetValuesLocal");
 }
@@ -295,8 +264,6 @@ void PETScVector::add(const double* block, std::size_t m,
                       const dolfin::la_index* rows)
 {
   dolfin_assert(_x);
-  if (m == 0)
-    return;
   PetscErrorCode ierr = VecSetValues(_x, m, rows, block, ADD_VALUES);
   if (ierr != 0) petsc_error(ierr, __FILE__, "VecSetValues");
 }
@@ -305,8 +272,6 @@ void PETScVector::add_local(const double* block, std::size_t m,
                             const dolfin::la_index* rows)
 {
   dolfin_assert(_x);
-  if (m == 0)
-    return;
   PetscErrorCode ierr = VecSetValuesLocal(_x, m, rows, block, ADD_VALUES);
   if (ierr != 0) petsc_error(ierr, __FILE__, "VecSetValuesLocal");
 }
@@ -344,46 +309,61 @@ void PETScVector::zero()
 //-----------------------------------------------------------------------------
 bool PETScVector::empty() const
 {
-  return size() == 0;
+  return this->size() == 0;
 }
 //-----------------------------------------------------------------------------
 std::size_t PETScVector::size() const
 {
+  dolfin_assert(_x);
+
+  // Return zero if vector type has not been set (Vec has not been
+  // intialised)
+  VecType vec_type = nullptr;
+  VecGetType(_x, &vec_type);
+  if (vec_type == nullptr)
+    return 0;
+
   PetscInt n = 0;
-  if (_x)
-  {
-    PetscErrorCode ierr = VecGetSize(_x, &n);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "VecGetSize");
-  }
-  return n;
+  dolfin_assert(_x);
+  PetscErrorCode ierr = VecGetSize(_x, &n);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "VecGetSize");
+
+  return n > 0 ? n : 0;
 }
 //-----------------------------------------------------------------------------
 std::size_t PETScVector::local_size() const
 {
+  dolfin_assert(_x);
+
+  // Return zero if vector type has not been set
+  VecType vec_type;
+  VecGetType(_x, &vec_type);
+  if (vec_type == NULL)
+    return 0;
+
   PetscInt n = 0;
-  if (_x)
-  {
-    PetscErrorCode ierr = VecGetLocalSize(_x, &n);
-    if (ierr != 0) petsc_error(ierr, __FILE__, "VecGetLocalSize");
-  }
+  PetscErrorCode ierr = VecGetLocalSize(_x, &n);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "VecGetLocalSize");
+
   return n;
 }
 //-----------------------------------------------------------------------------
-std::pair<std::size_t, std::size_t> PETScVector::local_range() const
+std::pair<std::int64_t, std::int64_t> PETScVector::local_range() const
 {
+  dolfin_assert(_x);
+
   PetscInt n0, n1;
   PetscErrorCode ierr = VecGetOwnershipRange(_x, &n0, &n1);
   if (ierr != 0) petsc_error(ierr, __FILE__, "VecGetOwnershipRange");
   dolfin_assert(n0 <= n1);
-  return std::make_pair(n0, n1);
+  return {n0, n1};
 }
 //-----------------------------------------------------------------------------
 bool PETScVector::owns_index(std::size_t i) const
 {
-  if (i >= local_range().first && i < local_range().second)
-    return true;
-  else
-    return false;
+  const auto _local_range = local_range();
+  const std::int64_t _i = i;
+  return _i >= _local_range.first && _i < _local_range.second;
 }
 //-----------------------------------------------------------------------------
 const GenericVector& PETScVector::operator= (const GenericVector& v)
@@ -621,8 +601,9 @@ double PETScVector::sum() const
 double PETScVector::sum(const Array<std::size_t>& rows) const
 {
   dolfin_assert(_x);
-  const std::size_t n0 = local_range().first;
-  const std::size_t n1 = local_range().second;
+  const auto _local_range = local_range();
+  const std::size_t n0 = _local_range.first;
+  const std::size_t n1 = _local_range.second;
 
   // Build sets of local and nonlocal entries
   Set<PetscInt> local_rows;
@@ -636,8 +617,8 @@ double PETScVector::sum(const Array<std::size_t>& rows) const
   }
 
   // Send nonlocal rows indices to other processes
-  const std::size_t num_processes  = MPI::size(mpi_comm());
-  const std::size_t process_number = MPI::rank(mpi_comm());
+  const std::size_t num_processes  = dolfin::MPI::size(mpi_comm());
+  const std::size_t process_number = dolfin::MPI::rank(mpi_comm());
   for (std::size_t i = 1; i < num_processes; ++i)
   {
     // Receive data from process p - i (i steps to the left), send
@@ -648,8 +629,8 @@ double PETScVector::sum(const Array<std::size_t>& rows) const
 
     // Send and receive data
     std::vector<std::size_t> received_nonlocal_rows;
-    MPI::send_recv(mpi_comm(), send_nonlocal_rows.set(), dest,
-                   received_nonlocal_rows, source);
+    dolfin::MPI::send_recv(mpi_comm(), send_nonlocal_rows.set(), dest,
+                           received_nonlocal_rows, source);
 
     // Add rows which reside on this process
     for (std::size_t j = 0; j < received_nonlocal_rows.size(); ++j)
@@ -667,12 +648,17 @@ double PETScVector::sum(const Array<std::size_t>& rows) const
   const double local_sum = std::accumulate(local_values.begin(),
                                            local_values.end(), 0.0);
 
-  return MPI::sum(mpi_comm(), local_sum);
+  return dolfin::MPI::sum(mpi_comm(), local_sum);
 }
 //-----------------------------------------------------------------------------
 std::string PETScVector::str(bool verbose) const
 {
-  if (!_x)
+  dolfin_assert(_x);
+
+  // Check if vector type has not been set
+  VecType vec_type = NULL;
+  VecGetType(_x, &vec_type);
+  if (vec_type == NULL)
     return "<Uninitialized PETScVector>";
 
   PetscErrorCode ierr;
@@ -722,7 +708,7 @@ void PETScVector::gather(GenericVector& y,
     // Initialise vector and make local
     y.init(MPI_COMM_SELF, n);
   }
-  else if (y.size() != n || MPI::size(y.mpi_comm()))
+  else if (y.size() != n || dolfin::MPI::size(y.mpi_comm()))
   {
     dolfin_error("PETScVector.cpp",
                  "gather vector entries",
@@ -730,8 +716,9 @@ void PETScVector::gather(GenericVector& y,
   }
 
 
-  // PETSc will bail out if it receives a NULL pointer even though m == 0.
-  // Can't return from function since function calls are collective.
+  // PETSc will bail out if it receives a NULL pointer even though m
+  // == 0.  Can't return from function since function calls are
+  // collective.
   if (n == 0)
     global_indices.resize(1);
 
@@ -768,7 +755,7 @@ void PETScVector::gather(std::vector<double>& x,
                          const std::vector<dolfin::la_index>& indices) const
 {
   x.resize(indices.size());
-  PETScVector y;
+  PETScVector y(PETSC_COMM_SELF);
   gather(y, indices);
   dolfin_assert(y.local_size() == x.size());
   y.get_local(x);
@@ -778,11 +765,12 @@ void PETScVector::gather_on_zero(std::vector<double>& x) const
 {
   PetscErrorCode ierr;
 
-  if (MPI::rank(mpi_comm()) == 0)
+  if (dolfin::MPI::rank(mpi_comm()) == 0)
     x.resize(size());
   else
     x.resize(0);
 
+  dolfin_assert(_x);
   Vec vout;
   VecScatter scatter;
   ierr = VecScatterCreateToZero(_x, &scatter, &vout);
@@ -795,87 +783,56 @@ void PETScVector::gather_on_zero(std::vector<double>& x) const
   if (ierr != 0) petsc_error(ierr, __FILE__, "VecScatterDestroy");
 
   // Wrap PETSc vector
-  if (MPI::rank(mpi_comm()) == 0)
+  if (dolfin::MPI::rank(mpi_comm()) == 0)
   {
     PETScVector _vout(vout);
     _vout.get_local(x);
   }
 }
 //-----------------------------------------------------------------------------
-void PETScVector::_init(MPI_Comm comm,
-                        std::pair<std::size_t, std::size_t> range,
-                        const std::vector<std::size_t>& local_to_global_map,
-                        const std::vector<la_index>& ghost_indices)
+GenericLinearAlgebraFactory& PETScVector::factory() const
 {
-  PetscErrorCode ierr;
-  if (_x)
-    error("PETScVector cannot be initialized more than once.");
-
-  const std::size_t local_size = range.second - range.first;
-  dolfin_assert(range.second >= range.first);
-
-  // Copy ghost indices
-  ierr = VecCreateGhost(comm, local_size, PETSC_DECIDE,
-                        ghost_indices.size(), ghost_indices.data(), &_x);
-  if (ierr != 0) petsc_error(ierr, __FILE__, "VecCreateGhost");
-
-  // Set options prefix
-  ierr = VecSetOptionsPrefix(_x, _petsc_options_prefix.c_str());
-  if (ierr != 0) petsc_error(ierr, __FILE__, "VecSetOptionsPrefix");
-
-  // Set from PETSc options
-  VecSetFromOptions(_x);
-
-  ISLocalToGlobalMapping petsc_local_to_global;
-  std::vector<PetscInt> _map;
-  if (!local_to_global_map.empty())
-  {
-    _map = std::vector<PetscInt>(local_to_global_map.begin(),
-                                 local_to_global_map.end());
-  }
-  else
-  {
-    const std::size_t size = range.second - range.first;
-    _map.resize(size);
-    for (std::size_t i = 0; i < size; ++i)
-      _map[i] = i + range.first;
-  }
-  #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-  ISLocalToGlobalMappingCreate(PETSC_COMM_SELF, _map.size(), _map.data(),
-                               PETSC_COPY_VALUES, &petsc_local_to_global);
-  #else
-  ISLocalToGlobalMappingCreate(PETSC_COMM_SELF, 1, _map.size(), _map.data(),
-                               PETSC_COPY_VALUES, &petsc_local_to_global);
-  #endif
-  VecSetLocalToGlobalMapping(_x, petsc_local_to_global);
-  ISLocalToGlobalMappingDestroy(&petsc_local_to_global);
+  return PETScFactory::instance();
 }
 //-----------------------------------------------------------------------------
 void PETScVector::set_options_prefix(std::string options_prefix)
 {
-  if (_x)
+  if (!_x)
   {
     dolfin_error("PETScVector.cpp",
                  "setting PETSc options prefix",
-                 "Cannot set options prefix since PETSc Vec has already been initialized");
+                 "Cannot set options prefix since PETSc Vec has not been initialized");
   }
-  else
-    _petsc_options_prefix = options_prefix;
+
+  // Set PETSc options prefix
+  PetscErrorCode ierr = VecSetOptionsPrefix(_x, options_prefix.c_str());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "VecSetOptionsPrefix");
 }
 //-----------------------------------------------------------------------------
 std::string PETScVector::get_options_prefix() const
 {
-  if (_x)
+  if (!_x)
   {
-    const char* prefix = NULL;
-    VecGetOptionsPrefix(_x, &prefix);
-    return std::string(prefix);
+    dolfin_error("PETScVector.cpp",
+                 "get PETSc options prefix",
+                 "Cannot get options prefix since PETSc Vec has not been initialized");
   }
-  else
+
+  const char* prefix = NULL;
+  VecGetOptionsPrefix(_x, &prefix);
+  return std::string(prefix);
+}
+//-----------------------------------------------------------------------------
+void PETScVector::set_from_options()
+{
+  if (!_x)
   {
-    warning("PETSc Vec object has not been initialised, therefore prefix has not been set");
-    return std::string();
+    dolfin_error("PETScVector.cpp",
+                 "call VecSetFromOptions on PETSc Vec object",
+                 "Vec object has not been intialised");
   }
+
+  VecSetFromOptions(_x);
 }
 //-----------------------------------------------------------------------------
 Vec PETScVector::vec() const
@@ -883,9 +840,86 @@ Vec PETScVector::vec() const
   return _x;
 }
 //-----------------------------------------------------------------------------
-GenericLinearAlgebraFactory& PETScVector::factory() const
+void PETScVector::reset(Vec vec)
 {
-  return PETScFactory::instance();
+  dolfin_assert(_x);
+
+  // Decrease reference count to old Vec object
+  VecDestroy(&_x);
+
+  // Store new Vec object and increment reference count
+  _x = vec;
+  PetscObjectReference((PetscObject)_x);
+}
+//-----------------------------------------------------------------------------
+void PETScVector::_init(std::pair<std::size_t, std::size_t> range,
+                        const std::vector<std::size_t>& local_to_global_map,
+                        const std::vector<la_index>& ghost_indices)
+{
+  if (!_x)
+  {
+    dolfin_error("PETScVector.h",
+                 "initialize vector",
+                 "Underlying PETSc Vec has not been intialised");
+  }
+
+  PetscErrorCode ierr;
+
+  // Set from PETSc options. This will set the vector type.
+  VecSetFromOptions(_x);
+
+  // Get local size
+  const std::size_t local_size = range.second - range.first;
+  dolfin_assert(range.second >= range.first);
+
+  // Set vector size
+  VecSetSizes(_x, local_size, PETSC_DECIDE);
+
+  // Get PETSc Vec type
+  VecType vec_type;
+  VecGetType(_x, &vec_type);
+
+  // Add ghost points if Vec type is MPI (throw an error if Vec is not
+  // VECMPI and ghost entry vector is not empty)
+  if (strcmp(vec_type, VECMPI) == 0)
+  {
+    ierr = VecMPISetGhost(_x, ghost_indices.size(), ghost_indices.data());
+    if (ierr != 0) petsc_error(ierr, __FILE__, "VecCreateGhost");
+  }
+  else if (!ghost_indices.empty())
+  {
+    dolfin_error("PETScVector.cpp",
+                 "initialize vector",
+                 "Sequential PETSc Vec objects cannot have ghost entries");
+  }
+
+  // Build local-to-global map
+  std::vector<PetscInt> _map;
+  if (!local_to_global_map.empty())
+  {
+    // Copy data to get correct PETSc integer type
+    _map = std::vector<PetscInt>(local_to_global_map.begin(),
+                                 local_to_global_map.end());
+  }
+  else
+  {
+    // Fill vector with [i0 + 0, i0 + 1, i0 +2, . . .]
+    const std::size_t size = range.second - range.first;
+    _map.assign(size, range.first);
+    std::iota(_map.begin(), _map.end(), range.first);
+  }
+
+  // Create PETSc local-to-global map
+  ISLocalToGlobalMapping petsc_local_to_global;
+  ISLocalToGlobalMappingCreate(PETSC_COMM_SELF, 1, _map.size(), _map.data(),
+                               PETSC_COPY_VALUES, &petsc_local_to_global);
+
+  // Apply local-to-global map to vector
+  VecSetLocalToGlobalMapping(_x, petsc_local_to_global);
+
+  // Clean-up PETSc local-to-global map
+  ISLocalToGlobalMappingDestroy(&petsc_local_to_global);
 }
 //-----------------------------------------------------------------------------
+
 #endif
diff --git a/dolfin/la/PETScVector.h b/dolfin/la/PETScVector.h
index 9b4c404..16de1e4 100644
--- a/dolfin/la/PETScVector.h
+++ b/dolfin/la/PETScVector.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2015 Johan Hoffman, Johan Jansson, Anders Logg
+// Copyright (C) 2004-2016 Johan Hoffman, Johan Jansson, Anders Logg
 // and Garth N. Wells
 //
 // This file is part of DOLFIN.
@@ -22,11 +22,12 @@
 // Modified by Martin Alnæs, 2008.
 // Modified by Fredrik Valdmanis, 2011.
 
-#ifndef __PETSC_VECTOR_H
-#define __PETSC_VECTOR_H
+#ifndef __DOLFIN_PETSC_VECTOR_H
+#define __DOLFIN_PETSC_VECTOR_H
 
 #ifdef HAS_PETSC
 
+#include <cstdint>
 #include <map>
 #include <memory>
 #include <string>
@@ -44,7 +45,7 @@
 namespace dolfin
 {
 
-  class GenericSparsityPattern;
+  class SparsityPattern;
   template<typename T> class Array;
 
   /// This class provides a simple vector class based on PETSc.
@@ -59,19 +60,24 @@ namespace dolfin
   {
   public:
 
-    /// Create empty vector
+    /// Create empty vector (on MPI_COMM_WORLD)
     PETScVector();
 
+    /// Create empty vector on an MPI communicator
+    explicit PETScVector(MPI_Comm comm);
+
     /// Create vector of size N
     PETScVector(MPI_Comm comm, std::size_t N);
 
     /// Create vector
-    explicit PETScVector(const GenericSparsityPattern& sparsity_pattern);
+    explicit PETScVector(const SparsityPattern& sparsity_pattern);
 
     /// Copy constructor
     PETScVector(const PETScVector& x);
 
-    /// Create vector wrapper of PETSc Vec pointer
+    /// Create vector wrapper of PETSc Vec pointer. The reference
+    /// counter of the Vec will be increased, and decreased upon
+    /// destruction of this object.
     explicit PETScVector(Vec x);
 
     /// Destructor
@@ -103,7 +109,8 @@ namespace dolfin
     virtual void init(MPI_Comm comm,
                       std::pair<std::size_t, std::size_t> range);
 
-    /// Initialize vector with given ownership range and with ghost values
+    /// Initialize vector with given ownership range and with ghost
+    /// values
     virtual void init(MPI_Comm comm,
                       std::pair<std::size_t, std::size_t> range,
                       const std::vector<std::size_t>& local_to_global_map,
@@ -122,7 +129,7 @@ namespace dolfin
     virtual std::size_t local_size() const;
 
     /// Return ownership range of a vector
-    virtual std::pair<std::size_t, std::size_t> local_range() const;
+    virtual std::pair<std::int64_t, std::int64_t> local_range() const;
 
     /// Determine whether global vector index is owned by this process
     virtual bool owns_index(std::size_t i) const;
@@ -240,28 +247,27 @@ namespace dolfin
     /// database
     std::string get_options_prefix() const;
 
+    /// Call PETSc function VecSetFromOptions on the underlying Vec
+    /// object
+    void set_from_options();
+
     /// Return pointer to PETSc Vec object
     Vec vec() const;
 
     /// Assignment operator
     const PETScVector& operator= (const PETScVector& x);
 
-    friend class PETScBaseMatrix;
-    friend class PETScMatrix;
+    /// Switch underlying PETSc object. Intended for internal library
+    /// usage.
+    void reset(Vec vec);
 
   private:
 
     // Initialise PETSc vector
-    void _init(MPI_Comm comm, std::pair<std::size_t, std::size_t> range,
+    void _init(std::pair<std::size_t, std::size_t> range,
                const std::vector<std::size_t>& local_to_global_map,
                const std::vector<la_index>& ghost_indices);
 
-    // Return true if vector is distributed
-    bool distributed() const;
-
-    // Prefix for PETSc options database
-    std::string _petsc_options_prefix;
-
     // PETSc Vec pointer
     Vec _x;
 
diff --git a/dolfin/la/PaStiXLUSolver.cpp b/dolfin/la/PaStiXLUSolver.cpp
deleted file mode 100644
index 00bded3..0000000
--- a/dolfin/la/PaStiXLUSolver.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-// Copyright (C) 2011 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-10-19
-// Last changed:
-
-#include <algorithm>
-#include <numeric>
-#include <string>
-#include <vector>
-
-// Necessary since pastix.h does not include it
-#include <stdint.h>
-
-#include "dolfin/common/MPI.h"
-#include "dolfin/common/NoDeleter.h"
-#include "dolfin/common/types.h"
-#include "dolfin/log/log.h"
-#include "dolfin/parameter/GlobalParameters.h"
-#include "GenericVector.h"
-#include "SparsityPattern.h"
-#include "GenericMatrix.h"
-#include "LUSolver.h"
-#include "STLMatrix.h"
-#include "PaStiXLUSolver.h"
-
-#ifdef HAS_PASTIX
-
-extern "C"
-{
-#include <pastix.h>
-}
-
-using namespace dolfin;
-
-//-----------------------------------------------------------------------------
-Parameters PaStiXLUSolver::default_parameters()
-{
-  Parameters p(LUSolver::default_parameters());
-  p.rename("pastix_lu_solver");
-
-  // Number of threads per MPI process
-  p.add<std::size_t>("num_threads");
-
-  // Thread mode (see PaStiX user documentation)
-  const std::set<std::string> thread_modes = {"multiple", "single", "funnel"};
-  p.add<std::string>("thread_mode", thread_modes);
-
-  // Min/max block size for BLAS. This parameters can have a significant
-  // effect on performance. Best settings depends on systems and BLAS
-  // implementation.
-  p.add("min_block_size", 180);
-  p.add("max_block_size", 340);
-
-  // Check matrix for consistency
-  p.add("check_matrix", false);
-
-  // Renumber
-  p.add("renumber", true);
-
-  return p;
-}
-//-----------------------------------------------------------------------------
-PaStiXLUSolver::PaStiXLUSolver(const STLMatrix& A)
-  : A(reference_to_no_delete_pointer(A))
-{
-  // Set parameter values
-  parameters = default_parameters();
-}
-//-----------------------------------------------------------------------------
-PaStiXLUSolver::PaStiXLUSolver(std::shared_ptr<const STLMatrix> A) : A(A)
-{
-  // Set parameter values
-  parameters = default_parameters();
-}
-//-----------------------------------------------------------------------------
-PaStiXLUSolver::~PaStiXLUSolver()
-{
-  // Do nothing
-}
-//-----------------------------------------------------------------------------
-std::size_t PaStiXLUSolver::solve(GenericVector& x, const GenericVector& b)
-{
-  dolfin_assert(A);
-
-  // Get block size from STLMatrix
-  const std::size_t block_size = A->block_size();
-
-  // MPI communicator
-  MPI_Comm mpi_comm = A->mpi_comm();
-
-  // Initialise PaStiX parameters
-  pastix_int_t iparm[IPARM_SIZE];
-  double dparm[DPARM_SIZE];
-  for (int i = 0; i < IPARM_SIZE; i++)
-    iparm[i] = 0;
-  for (int i = 0; i < DPARM_SIZE; i++)
-    dparm[i] = 0;
-
-  // Set default parameters
-  pastix_initParam(iparm, dparm);
-
-  // Set LU or Cholesky depending on operator symmetry
-  const bool symmetric = parameters["symmetric"];
-  if (symmetric)
-  {
-    iparm[IPARM_SYM] = API_SYM_YES;
-    //iparm[IPARM_FACTORIZATION] = API_FACT_LDLT;
-    iparm[IPARM_FACTORIZATION] = API_FACT_LLT;
-  }
-  else
-  {
-    iparm[IPARM_SYM] = API_SYM_NO;
-    iparm[IPARM_FACTORIZATION] = API_FACT_LU;
-  }
-
-  // Number of dofs per node (block size)
-  iparm[IPARM_DOF_NBR] = block_size;
-
-  // Set BLAS block sizes (affects performance)
-  const std::size_t min_block_size = parameters["min_block_size"];
-  iparm[IPARM_MIN_BLOCKSIZE] = min_block_size;
-  const std::size_t max_block_size = parameters["max_block_size"];
-  iparm[IPARM_MAX_BLOCKSIZE] = max_block_size;
-  //iparm[IPARM_ABS] = API_YES;
-
-  // Get matrix data in compressed sparse column format (C indexing)
-  std::vector<double> vals;
-  std::vector<pastix_int_t> rows, col_ptr, local_to_global_cols;
-  A->csc(vals, rows, col_ptr, local_to_global_cols, true, symmetric);
-
-  // Copy local-to-global
-  const std::vector<pastix_int_t> local_to_global_cols_ref
-    = local_to_global_cols;
-
-  // Convert to base 1
-  for (std::size_t i = 0;  i < rows.size(); ++i)
-    rows[i] += 1;
-  for (std::size_t i = 0;  i < col_ptr.size(); ++i)
-    col_ptr[i] += 1;
-  for (std::size_t i = 0;  i < local_to_global_cols.size(); ++i)
-    local_to_global_cols[i] += 1;
-
-  dolfin_assert(local_to_global_cols.size() > 0);
-
-  // Pointers to data structures
-  pastix_int_t* _col_ptr = col_ptr.data();
-  pastix_int_t* _rows = rows.data();
-  pastix_int_t* _local_to_global_cols = local_to_global_cols.data();
-
-  // Graph (matrix) distributed
-  iparm[IPARM_GRAPHDIST] = API_YES;
-
-  // Matrix size
-  const pastix_int_t n = (col_ptr.size() - 1);
-
-  // Check matrix
-  if (parameters["check_matrix"])
-  {
-    double* _vals = vals.data();
-    d_pastix_checkMatrix(mpi_comm, API_VERBOSE_YES, iparm[IPARM_SYM], API_NO,
-  		                   n, &_col_ptr, &_rows, &_vals,
-                         &_local_to_global_cols, block_size);
-  }
-  else
-    iparm[IPARM_MATRIX_VERIFICATION] = API_NO;
-
-  // PaStiX object
-  pastix_data_t* pastix_data = NULL;
-
-  // Number of threads per MPI process
-  if (parameters["num_threads"].is_set())
-  {
-    iparm[IPARM_THREAD_NBR]
-      = std::max((std::size_t) 1, (std::size_t) parameters["num_threads"]);
-  }
-  else
-  {
-    iparm[IPARM_THREAD_NBR] = std::max((std::size_t) 1,
-                            (std::size_t) dolfin::parameters["num_threads"]);
-  }
-
-  // PaStiX threading mode
-  if (parameters["thread_mode"].is_set())
-  {
-    const std::string thread_mode = parameters["thread_mode"];
-    if (thread_mode == "multiple")
-      iparm[IPARM_THREAD_COMM_MODE] = API_THREAD_MULTIPLE;
-    else if (thread_mode == "single")
-      iparm[IPARM_THREAD_COMM_MODE] = API_THREAD_COMM_ONE;
-    else if (thread_mode == "funnel")
-      iparm[IPARM_THREAD_COMM_MODE] = API_THREAD_FUNNELED;
-    else
-    {
-      dolfin_error("PaStiXLUSolver.cpp",
-                   "set PaStiX thread mode",
-                   "Unknown mode \"%s\"", thread_mode.c_str());
-    }
-  }
-
-  // User-supplied RHS
-  iparm[IPARM_RHS_MAKING] = API_RHS_B;
-
-  // Level of verbosity
-  if (parameters["verbose"])
-    iparm[IPARM_VERBOSE] = API_VERBOSE_YES;
-  else
-    iparm[IPARM_VERBOSE] = API_VERBOSE_NO;
-
-  // Allocate space for solver
-  dolfin_assert(local_to_global_cols.size() > 0);
-  std::vector<pastix_int_t> perm(local_to_global_cols.size());
-  std::vector<pastix_int_t> invp(local_to_global_cols.size());
-
-  // Renumbering
-  const bool renumber = parameters["renumber"];
-  if (!renumber)
-  {
-    iparm[IPARM_ORDERING] = API_ORDER_PERSONAL;
-    iparm[IPARM_LEVEL_OF_FILL] = -1;
-    iparm[IPARM_AMALGAMATION_LEVEL]  = 10;
-    for (std::size_t i = 0; i < local_to_global_cols.size(); ++i)
-    {
-      perm[i] = i + 1;
-      std::copy(perm.begin(), perm.end(), invp.begin());
-    }
-  }
-
-  // Number of RHS vectors
-  const pastix_int_t nrhs = 1;
-
-  // Re-order
-  iparm[IPARM_START_TASK] = API_TASK_ORDERING;
-  iparm[IPARM_END_TASK]   = API_TASK_BLEND;
-  d_dpastix(&pastix_data, mpi_comm, n, _col_ptr, _rows, vals.data(),
-            _local_to_global_cols, perm.data(), invp.data(), NULL, nrhs,
-            iparm, dparm);
-
-  // Factorise
-  iparm[IPARM_START_TASK] = API_TASK_NUMFACT;
-  iparm[IPARM_END_TASK]   = API_TASK_NUMFACT;
-  d_dpastix(&pastix_data, mpi_comm, n, _col_ptr, _rows, vals.data(),
-            _local_to_global_cols, perm.data(), invp.data(), NULL, nrhs,
-            iparm, dparm);
-
-  // Get RHS data for this process
-  std::vector<double> _b;
-  std::vector<dolfin::la_index> idx(block_size*n);
-  dolfin_assert((int) local_to_global_cols_ref.size() ==  n);
-  for (std::size_t i = 0; i < local_to_global_cols_ref.size(); ++i)
-    for (std::size_t j = 0; j < block_size; ++j)
-      idx[i*block_size + j] = local_to_global_cols_ref[i]*block_size + j;
-  b.gather(_b, idx);
-
-  // Solve
-  iparm[IPARM_START_TASK] = API_TASK_SOLVE;
-  iparm[IPARM_END_TASK] = API_TASK_SOLVE;
-  d_dpastix(&pastix_data, mpi_comm, n, _col_ptr, _rows, vals.data(),
-            _local_to_global_cols, perm.data(), invp.data(),
-            _b.data(), nrhs, iparm, dparm);
-
-  // Distribute solution
-  x.init(mpi_comm, b.local_range());
-  x.set(_b.data(), idx.size(), idx.data());
-  x.apply("insert");
-
-  // Clean up
-  iparm[IPARM_START_TASK] = API_TASK_CLEAN;
-  iparm[IPARM_END_TASK] = API_TASK_CLEAN;
-  d_dpastix(&pastix_data, mpi_comm, n, NULL, NULL, NULL,
-            _local_to_global_cols,
-            perm.data(), invp.data(),
-            _b.data(), nrhs, iparm, dparm);
-
-  return 1;
-}
-//-----------------------------------------------------------------------------
-#endif
diff --git a/dolfin/la/PaStiXLUSolver.h b/dolfin/la/PaStiXLUSolver.h
deleted file mode 100644
index ce563fa..0000000
--- a/dolfin/la/PaStiXLUSolver.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (C) 2011 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-10-16
-// Last changed:
-
-#ifndef __DOLFIN_PASTIXLUSOLVER_H
-#define __DOLFIN_PASTIXLUSOLVER_H
-
-#include <utility>
-#include <vector>
-#include <memory>
-#include <dolfin/common/types.h>
-#include <dolfin/common/Variable.h>
-
-#ifdef HAS_PASTIX
-
-namespace dolfin
-{
-
-  // Forward declarations
-  class GenericMatrix;
-  class GenericVector;
-  class SparsityPattern;
-  class STLMatrix;
-
-  class PaStiXLUSolver : public Variable
-  {
-  public:
-
-    /// Constructor
-    PaStiXLUSolver(const STLMatrix& A);
-
-    /// Constructor
-    PaStiXLUSolver(std::shared_ptr<const STLMatrix> A);
-
-    /// Destructor
-    virtual ~PaStiXLUSolver();
-
-    /// Solve Ax = b
-    std::size_t solve(GenericVector& x, const GenericVector& b);
-
-    /// Default parameter values
-    static Parameters default_parameters();
-
-  private:
-
-    std::shared_ptr<const STLMatrix> A;
-
-  };
-
-}
-
-#endif
-#endif
diff --git a/dolfin/la/SLEPcEigenSolver.cpp b/dolfin/la/SLEPcEigenSolver.cpp
index c7039d0..a19cea4 100644
--- a/dolfin/la/SLEPcEigenSolver.cpp
+++ b/dolfin/la/SLEPcEigenSolver.cpp
@@ -33,58 +33,107 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-SLEPcEigenSolver::SLEPcEigenSolver(const PETScMatrix& A)
-  : _matA(reference_to_no_delete_pointer(const_cast<PETScMatrix&>(A)))
+SLEPcEigenSolver::SLEPcEigenSolver(MPI_Comm comm)
 {
-  dolfin_assert(A.size(0) == A.size(1));
+  // Set up solver environment
+  EPSCreate(comm, &_eps);
 
   // Set default parameter values
   parameters = default_parameters();
-
-  // Set up solver environment
-  EPSCreate(PETSC_COMM_WORLD, &_eps);
 }
 //-----------------------------------------------------------------------------
-SLEPcEigenSolver::SLEPcEigenSolver(const PETScMatrix& A, const PETScMatrix& B)
-  : _matA(reference_to_no_delete_pointer(A)), _matB(reference_to_no_delete_pointer(B))
+SLEPcEigenSolver::SLEPcEigenSolver(EPS eps) : _eps(eps)
 {
-  dolfin_assert(A.size(0) == A.size(1));
-  dolfin_assert(B.size(0) == A.size(0));
-  dolfin_assert(B.size(1) == A.size(1));
+  PetscErrorCode ierr;
+  if (_eps)
+  {
+    // Increment reference count since we holding a pointer to it
+    ierr = PetscObjectReference((PetscObject)_eps);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "PetscObjectReference");
+  }
+  else
+  {
+    dolfin_error("SLEPcEigenSolver.cpp",
+                 "intialise SLEPcEigenSolver with SLEPc EPS object",
+                 "SLEPc EPS must be initialised (EPSCreate) before wrapping");
+  }
 
   // Set default parameter values
   parameters = default_parameters();
-
-  // Set up solver environment
-  EPSCreate(PETSC_COMM_WORLD, &_eps);
 }
 //-----------------------------------------------------------------------------
 SLEPcEigenSolver::SLEPcEigenSolver(std::shared_ptr<const PETScMatrix> A)
-  : _matA(A)
+  : SLEPcEigenSolver(A,  nullptr)
 {
-  dolfin_assert(A->size(0) == A->size(1));
+  // TODO: deprecate
 
-  // Set default parameter values
-  parameters = default_parameters();
+  // Do nothing (handled by other constructor)
+}
+//-----------------------------------------------------------------------------
+SLEPcEigenSolver::SLEPcEigenSolver(MPI_Comm comm,
+                                   std::shared_ptr<const PETScMatrix> A)
+  : SLEPcEigenSolver(comm, A, nullptr)
+{
+  // TODO: deprecate
 
-  // Set up solver environment
-  EPSCreate(PETSC_COMM_WORLD, &_eps);
+  // Do nothing (handled by other constructor)
 }
 //-----------------------------------------------------------------------------
 SLEPcEigenSolver::SLEPcEigenSolver(std::shared_ptr<const PETScMatrix> A,
                                    std::shared_ptr<const PETScMatrix> B)
-  : _matA(A), _matB(B)
+  : _matA(A), _matB(B), _eps(nullptr)
 
 {
+  // TODO: deprecate
+
+  dolfin_assert(A);
+  dolfin_assert(A->size(0) == A->size(1));
+  if (B)
+  {
+    dolfin_assert(B->size(0) == A->size(0));
+    dolfin_assert(B->size(1) == A->size(1));
+  }
+
+  // Set up solver environment
+  EPSCreate(A->mpi_comm(), &_eps);
+
+  // Set operators
+  dolfin_assert(_eps);
+  if (B)
+    EPSSetOperators(_eps, _matA->mat(), _matB->mat());
+  else
+    EPSSetOperators(_eps, _matA->mat(), NULL);
+
+  // Set default parameter values
+  parameters = default_parameters();
+}
+//-----------------------------------------------------------------------------
+SLEPcEigenSolver::SLEPcEigenSolver(MPI_Comm comm,
+                                   std::shared_ptr<const PETScMatrix> A,
+                                   std::shared_ptr<const PETScMatrix> B)
+  : _matA(A), _matB(B), _eps(nullptr)
+{
+  // TODO: deprecate
+
+  dolfin_assert(A);
   dolfin_assert(A->size(0) == A->size(1));
-  dolfin_assert(B->size(0) == A->size(0));
-  dolfin_assert(B->size(1) == A->size(1));
+  if (B)
+  {
+    dolfin_assert(B->size(0) == A->size(0));
+    dolfin_assert(B->size(1) == A->size(1));
+  }
 
   // Set default parameter values
   parameters = default_parameters();
 
   // Set up solver environment
-  EPSCreate(PETSC_COMM_WORLD, &_eps);
+  EPSCreate(comm, &_eps);
+
+  // Set operators
+  if (B)
+    EPSSetOperators(_eps, _matA->mat(), _matB->mat());
+  else
+    EPSSetOperators(_eps, _matA->mat(), NULL);
 }
 //-----------------------------------------------------------------------------
 SLEPcEigenSolver::~SLEPcEigenSolver()
@@ -94,59 +143,71 @@ SLEPcEigenSolver::~SLEPcEigenSolver()
     EPSDestroy(&_eps);
 }
 //-----------------------------------------------------------------------------
+void SLEPcEigenSolver::set_operators(std::shared_ptr<const PETScMatrix> A,
+                                     std::shared_ptr<const PETScMatrix> B)
+{
+  // Set operators
+  dolfin_assert(_eps);
+  if (B)
+     EPSSetOperators(_eps, _matA->mat(), _matB->mat());
+  else
+    EPSSetOperators(_eps, _matA->mat(), NULL);
+}
+//-----------------------------------------------------------------------------
 void SLEPcEigenSolver::solve()
 {
-  solve(_matA->size(0));
+  // Get operators
+  Mat A, B;
+  dolfin_assert(_eps);
+  EPSGetOperators(_eps, &A, &B);
+
+  // Wrap operator as short-cut to get size
+  PETScMatrix A_wrapped(A);
+  solve(A_wrapped.size(0));
 }
 //-----------------------------------------------------------------------------
 void SLEPcEigenSolver::solve(std::size_t n)
 {
-  dolfin_assert(_matA);
-
-  // Associate matrix (matrices) with eigenvalue solver
-  dolfin_assert(_matA->size(0) == _matA->size(1));
-  if (_matB)
-  {
-    dolfin_assert(_matB->size(0) == _matB->size(1)
-                  && _matB->size(0) == _matA->size(0));
-    EPSSetOperators(_eps, _matA->mat(), _matB->mat());
-  }
-  else
-    EPSSetOperators(_eps, _matA->mat(), NULL);
-
   // Set number of eigenpairs to compute
+  dolfin_assert(_matA);
   dolfin_assert(n <= _matA->size(0));
+  dolfin_assert(_eps);
   EPSSetDimensions(_eps, n, PETSC_DECIDE, PETSC_DECIDE);
 
-  // Set parameters from local parameters
+  // Set parameters set on SLEPcEigenSolver object
   read_parameters();
 
-  // Set parameters from PETSc parameter database
-  std::string prefix = std::string(parameters["options_prefix"]);
-  if (prefix != "default")
-  {
-    // Make sure that the prefix has a '_' at the end if the user
-    // didn't provide it
-    char lastchar = *prefix.rbegin();
-    if (lastchar != '_')
-      prefix += "_";
-
-    EPSSetOptionsPrefix(_eps, prefix.c_str());
-  }
+  // Set any options from the PETSc database
   EPSSetFromOptions(_eps);
 
-  if (parameters["verbose"])
+  // FIXME: need to be able to turn the monitor off
+  if (parameters["verbose"].is_set())
   {
-    KSP ksp;
-    ST st;
-    EPSMonitorSet(_eps, EPSMonitorAll, NULL, NULL);
-    EPSGetST(_eps, &st);
-    STGetKSP(st, &ksp);
-    KSPMonitorSet(ksp, KSPMonitorDefault, NULL, NULL);
-    EPSView(_eps, PETSC_VIEWER_STDOUT_SELF);
+    if (parameters["verbose"])
+    {
+      #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+      KSP ksp;
+      ST st;
+      EPSMonitorSet(_eps, EPSMonitorAll,
+                    PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)_eps)),
+                    NULL);
+      EPSGetST(_eps, &st);
+      STGetKSP(st, &ksp);
+      KSPMonitorSet(ksp, KSPMonitorDefault,
+                    PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ksp)),
+                    NULL);
+      EPSView(_eps, PETSC_VIEWER_STDOUT_SELF);
+      #else
+      PetscViewerAndFormat *vf;
+      PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_DEFAULT, &vf);
+      EPSMonitorSet(_eps,(PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,
+                                             PetscReal*,PetscInt,void*))EPSMonitorAll,vf,
+                    (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+      #endif
+    }
   }
 
-  // Solve
+  // Solve eigenvalue problem
   EPSSolve(_eps);
 
   // Check for convergence
@@ -156,7 +217,7 @@ void SLEPcEigenSolver::solve(std::size_t n)
     warning("Eigenvalue solver did not converge");
 
   // Report solver status
-  dolfin::la_index num_iterations = 0;
+  PetscInt num_iterations = 0;
   EPSGetIterationNumber(_eps, &num_iterations);
 
   EPSType eps_type = NULL;
@@ -187,10 +248,11 @@ void SLEPcEigenSolver::get_eigenpair(double& lr, double& lc,
 void SLEPcEigenSolver::get_eigenvalue(double& lr, double& lc,
                                       std::size_t i) const
 {
-  const dolfin::la_index ii = static_cast<dolfin::la_index>(i);
+  dolfin_assert(_eps);
+  const PetscInt ii = static_cast<PetscInt>(i);
 
   // Get number of computed values
-  dolfin::la_index num_computed_eigenvalues;
+  PetscInt num_computed_eigenvalues;
   EPSGetConverged(_eps, &num_computed_eigenvalues);
 
   if (ii < num_computed_eigenvalues)
@@ -216,10 +278,11 @@ void SLEPcEigenSolver::get_eigenpair(double& lr, double& lc,
                                      PETScVector& r, PETScVector& c,
                                      std::size_t i) const
 {
-  const dolfin::la_index ii = static_cast<dolfin::la_index>(i);
+  dolfin_assert(_eps);
+  const PetscInt ii = static_cast<PetscInt>(i);
 
   // Get number of computed eigenvectors/values
-  dolfin::la_index num_computed_eigenvalues;
+  PetscInt num_computed_eigenvalues;
   EPSGetConverged(_eps, &num_computed_eigenvalues);
 
   if (ii < num_computed_eigenvalues)
@@ -228,8 +291,7 @@ void SLEPcEigenSolver::get_eigenpair(double& lr, double& lc,
     _matA->init_vector(r, 0);
     _matA->init_vector(c, 0);
 
-    dolfin_assert(r.vec());
-    dolfin_assert(c.vec());
+    // Get eigen pairs
     EPSGetEigenpair(_eps, ii, &lr, &lc, r.vec(), c.vec());
   }
   else
@@ -242,26 +304,71 @@ void SLEPcEigenSolver::get_eigenpair(double& lr, double& lc,
 //-----------------------------------------------------------------------------
 std::size_t SLEPcEigenSolver::get_number_converged() const
 {
-  dolfin::la_index num_conv;
+  PetscInt num_conv;
+  dolfin_assert(_eps);
   EPSGetConverged(_eps, &num_conv);
   return num_conv;
 }
 //-----------------------------------------------------------------------------
 void SLEPcEigenSolver::set_deflation_space(const PETScVector& deflation_space)
 {
+  dolfin_assert(_eps);
+  dolfin_assert(deflation_space.vec());
   Vec x = deflation_space.vec();
+  dolfin_assert(_eps);
   EPSSetDeflationSpace(_eps, 1, &x);
 }
 //-----------------------------------------------------------------------------
+void SLEPcEigenSolver::set_options_prefix(std::string options_prefix)
+{
+  // Set options prefix
+  dolfin_assert(_eps);
+  PetscErrorCode ierr = EPSSetOptionsPrefix(_eps, options_prefix.c_str());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "EPSSetOptionsPrefix");
+}
+//-----------------------------------------------------------------------------
+std::string SLEPcEigenSolver::get_options_prefix() const
+{
+  dolfin_assert(_eps);
+  const char* prefix = NULL;
+  PetscErrorCode ierr = EPSGetOptionsPrefix(_eps, &prefix);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "EPSGetOptionsPrefix");
+  return std::string(prefix);
+}
+//-----------------------------------------------------------------------------
 void SLEPcEigenSolver::read_parameters()
 {
-  set_problem_type(parameters["problem_type"]);
-  set_spectrum(parameters["spectrum"]);
-  set_solver(parameters["solver"]);
-  set_tolerance(parameters["tolerance"], parameters["maximum_iterations"]);
-  set_spectral_transform(parameters["spectral_transform"],
-                         parameters["spectral_shift"]);
+  if (parameters["problem_type"].is_set())
+    set_problem_type(parameters["problem_type"]);
+
+  if (parameters["spectrum"].is_set())
+    set_spectrum(parameters["spectrum"]);
+
+  if (parameters["solver"].is_set())
+    set_solver(parameters["solver"]);
+
+  if (parameters["tolerance"].is_set() or parameters["maximum_iterations"].is_set())
+  {
+    const double tol = parameters["tolerance"].is_set() ? (double)parameters["tolerance"] : PETSC_DEFAULT;
+    const int max_it  = parameters["maximum_iterations"].is_set() ? (int)parameters["maximum_iterations"] : PETSC_DEFAULT;
 
+    set_tolerance(tol, max_it);
+  }
+
+  if (parameters["spectral_transform"].is_set())
+  {
+    if (parameters["spectral_shift"].is_set())
+    {
+      set_spectral_transform(parameters["spectral_transform"],
+                             parameters["spectral_shift"]);
+    }
+    else
+    {
+      dolfin_error("SLEPcEigenSolver.cpp",
+                   "set spectral transform",
+                   "For an spectral transform, the spectral shift parameter must be set");
+    }
+  }
 }
 //-----------------------------------------------------------------------------
 void SLEPcEigenSolver::set_problem_type(std::string type)
@@ -270,6 +377,7 @@ void SLEPcEigenSolver::set_problem_type(std::string type)
   if (type == "default")
     return;
 
+  dolfin_assert(_eps);
   if (type == "hermitian")
     EPSSetProblemType(_eps, EPS_HEP);
   else if (type == "non_hermitian")
@@ -294,6 +402,7 @@ void SLEPcEigenSolver::set_spectral_transform(std::string transform,
   if (transform == "default")
     return;
 
+  dolfin_assert(_eps);
   ST st;
   EPSGetST(_eps, &st);
   if (transform == "shift-and-invert")
@@ -316,6 +425,7 @@ void SLEPcEigenSolver::set_spectrum(std::string spectrum)
     return;
 
   // Choose spectrum
+  dolfin_assert(_eps);
   if (spectrum == "largest magnitude")
     EPSSetWhichEigenpairs(_eps, EPS_LARGEST_MAGNITUDE);
   else if (spectrum == "smallest magnitude")
@@ -331,17 +441,20 @@ void SLEPcEigenSolver::set_spectrum(std::string spectrum)
   else if (spectrum == "target magnitude")
   {
     EPSSetWhichEigenpairs(_eps, EPS_TARGET_MAGNITUDE);
-    EPSSetTarget(_eps, parameters["spectral_shift"]);
+    if (parameters["spectral_shift"].is_set())
+      EPSSetTarget(_eps, parameters["spectral_shift"]);
   }
   else if (spectrum == "target real")
   {
     EPSSetWhichEigenpairs(_eps, EPS_TARGET_REAL);
-    EPSSetTarget(_eps, parameters["spectral_shift"]);
+    if (parameters["spectral_shift"].is_set())
+      EPSSetTarget(_eps, parameters["spectral_shift"]);
   }
   else if (spectrum == "target imaginary")
   {
     EPSSetWhichEigenpairs(_eps, EPS_TARGET_IMAGINARY);
-    EPSSetTarget(_eps, parameters["spectral_shift"]);
+    if (parameters["spectral_shift"].is_set())
+      EPSSetTarget(_eps, parameters["spectral_shift"]);
   }
   else
   {
@@ -360,9 +473,9 @@ void SLEPcEigenSolver::set_solver(std::string solver)
   if (solver == "default")
     return;
 
-  // Choose solver
-  // (Note that lanczos will give PETSc error unless problem_type is
-  // set to 'hermitian' or 'gen_hermitian')
+  // Choose solver (Note that lanczos will give PETSc error unless
+  // problem_type is set to 'hermitian' or 'gen_hermitian')
+  dolfin_assert(_eps);
   if (solver == "power")
     EPSSetType(_eps, EPSPOWER);
   else if (solver == "subspace")
@@ -385,15 +498,17 @@ void SLEPcEigenSolver::set_solver(std::string solver)
   }
 }
 //-----------------------------------------------------------------------------
-void SLEPcEigenSolver::set_tolerance(double tolerance, std::size_t maxiter)
+void SLEPcEigenSolver::set_tolerance(double tolerance, int maxiter)
 {
   dolfin_assert(tolerance > 0.0);
+  dolfin_assert(_eps);
   EPSSetTolerances(_eps, tolerance, maxiter);
 }
 //-----------------------------------------------------------------------------
 std::size_t SLEPcEigenSolver::get_iteration_number() const
 {
-  dolfin::la_index num_iter;
+  dolfin_assert(_eps);
+  PetscInt num_iter;
   EPSGetIterationNumber(_eps, &num_iter);
   return num_iter;
 }
diff --git a/dolfin/la/SLEPcEigenSolver.h b/dolfin/la/SLEPcEigenSolver.h
index 04b6e12..3808438 100644
--- a/dolfin/la/SLEPcEigenSolver.h
+++ b/dolfin/la/SLEPcEigenSolver.h
@@ -28,6 +28,7 @@
 #include <memory>
 #include <slepceps.h>
 #include "dolfin/common/types.h"
+#include "dolfin/common/MPI.h"
 #include "PETScObject.h"
 
 namespace dolfin
@@ -38,8 +39,8 @@ namespace dolfin
   class PETScMatrix;
   class PETScVector;
 
-  /// This class provides an eigenvalue solver for PETSc matrices.
-  /// It is a wrapper for the SLEPc eigenvalue solver.
+  /// This class provides an eigenvalue solver for PETSc matrices. It
+  /// is a wrapper for the SLEPc eigenvalue solver.
   ///
   /// The following parameters may be specified to control the solver.
   ///
@@ -54,15 +55,10 @@ namespace dolfin
   ///   "smallest real"       (eigenvalues with smallest double part)
   ///   "largest imaginary"   (eigenvalues with largest imaginary part)
   ///   "smallest imaginary"  (eigenvalues with smallest imaginary part)
-  ///
-  /// For SLEPc versions >= 3.1 , the following values are also possible
-  ///
   ///   "target magnitude"    (eigenvalues closest to target in magnitude)
   ///   "target real"         (eigenvalues closest to target in real part)
   ///   "target imaginary"    (eigenvalues closest to target in imaginary part)
   ///
-  /// The default is "largest magnitude"
-  ///
   /// 2. "solver"
   ///
   /// This parameter controls which algorithm is used by SLEPc.
@@ -76,14 +72,10 @@ namespace dolfin
   ///   "lapack"              (LAPACK, all values, direct, small systems only)
   ///   "arpack"              (ARPACK)
   ///
-  /// The default is "krylov-schur"
-  ///
   /// 3. "tolerance"
   ///
-  /// This parameter controls the tolerance used by SLEPc.
-  /// Possible values are positive double numbers.
-  ///
-  /// The default is 1e-15;
+  /// This parameter controls the tolerance used by SLEPc.  Possible
+  /// values are positive double numbers.
   ///
   /// 4. "maximum_iterations"
   ///
@@ -107,10 +99,11 @@ namespace dolfin
   ///
   /// 6. "spectral_transform"
   ///
-  /// This parameter controls the application of a spectral transform. A
-  /// spectral transform can be used to enhance the convergence of the
-  /// eigensolver and in particular to only compute eigenvalues in the
-  /// interior of the spectrum. Possible values are:
+  /// This parameter controls the application of a spectral
+  /// transform. A spectral transform can be used to enhance the
+  /// convergence of the eigensolver and in particular to only compute
+  /// eigenvalues in the interior of the spectrum. Possible values
+  /// are:
   ///
   ///   "shift-and-invert"      (A shift-and-invert transform)
   ///
@@ -122,30 +115,41 @@ namespace dolfin
   /// 7. "spectral_shift"
   ///
   /// This parameter controls the spectral shift used by the spectral
-  /// transform and must be provided if a spectral transform is given. The
-  /// possible values are real numbers.
-  ///
+  /// transform and must be provided if a spectral transform is
+  /// given. The possible values are real numbers.
 
   class SLEPcEigenSolver : public Variable, public PETScObject
   {
   public:
 
-    /// Create eigenvalue solver for Ax = \lambda x
-    SLEPcEigenSolver(const PETScMatrix& A);
+    /// Create eigenvalue solver
+    explicit SLEPcEigenSolver(MPI_Comm comm);
 
-    /// Create eigenvalue solver Ax = \lambda Bx
-    SLEPcEigenSolver(const PETScMatrix& A, const PETScMatrix& B);
+    /// Create eigenvalue solver from EPS object
+    explicit SLEPcEigenSolver(EPS eps);
 
-    /// Create eigenvalue solver for Ax = \lambda x
-    SLEPcEigenSolver(std::shared_ptr<const PETScMatrix> A);
+    /// Create eigenvalue solver for Ax = \lambda
+    explicit SLEPcEigenSolver(std::shared_ptr<const PETScMatrix> A);
 
     /// Create eigenvalue solver for Ax = \lambda x
+    SLEPcEigenSolver(MPI_Comm comm, std::shared_ptr<const PETScMatrix> A);
+
+    /// Create eigenvalue solver for Ax = \lambda x on MPI_COMM_WORLD
     SLEPcEigenSolver(std::shared_ptr<const PETScMatrix> A,
                      std::shared_ptr<const PETScMatrix> B);
 
+    /// Create eigenvalue solver for Ax = \lambda x
+    SLEPcEigenSolver(MPI_Comm comm, std::shared_ptr<const PETScMatrix> A,
+                     std::shared_ptr<const PETScMatrix> B);
+
     /// Destructor
     ~SLEPcEigenSolver();
 
+    /// Set opeartors (B may be nullptr for regular eigenvalues
+    /// problems)
+    void set_operators(std::shared_ptr<const PETScMatrix> A,
+                       std::shared_ptr<const PETScMatrix> B);
+
     /// Compute all eigenpairs of the matrix A (solve Ax = \lambda x)
     void solve();
 
@@ -183,6 +187,14 @@ namespace dolfin
     /// Set deflation space
     void set_deflation_space(const PETScVector& deflation_space);
 
+    /// Sets the prefix used by PETSc when searching the PETSc options
+    /// database
+    void set_options_prefix(std::string options_prefix);
+
+    /// Returns the prefix used by PETSc when searching the PETSc
+    /// options database
+    std::string get_options_prefix() const;
+
     /// Return SLEPc EPS pointer
     EPS eps() const;
 
@@ -190,16 +202,14 @@ namespace dolfin
     static Parameters default_parameters()
     {
       Parameters p("slepc_eigenvalue_solver");
-
-      p.add("problem_type",       "default");
-      p.add("spectrum",           "largest magnitude");
-      p.add("solver",             "krylov-schur");
-      p.add("tolerance",          1e-15);
-      p.add("maximum_iterations", 10000);
-      p.add("spectral_transform", "default");
-      p.add("spectral_shift",     0.0);
-      p.add("verbose",            false);
-      p.add("options_prefix",     "default");
+      p.add<std::string>("problem_type");
+      p.add<std::string>("spectrum");
+      p.add<std::string>("solver");
+      p.add<double>("tolerance");
+      p.add<int>("maximum_iterations");
+      p.add<std::string>("spectral_transform");
+      p.add<double>("spectral_shift");
+      p.add<bool>("verbose");
 
       return p;
     }
@@ -222,11 +232,10 @@ namespace dolfin
     void set_solver(std::string spectrum);
 
     // Set tolerance
-    void set_tolerance(double tolerance, std::size_t maxiter);
+    void set_tolerance(double tolerance, int maxiter);
 
     // Operators (A x = \lambda x or Ax = \lambda B x)
-    std::shared_ptr<const PETScMatrix> _matA;
-    std::shared_ptr<const PETScMatrix> _matB;
+    std::shared_ptr<const PETScMatrix> _matA, _matB;
 
     // SLEPc solver pointer
     EPS _eps;
diff --git a/dolfin/la/STLFactory.cpp b/dolfin/la/STLFactory.cpp
deleted file mode 100644
index f097e3e..0000000
--- a/dolfin/la/STLFactory.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2007 Ilmar Wilbers
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Anders Logg, 2008.
-//
-// First added:  2008-05-21
-// Last changed: 2008-08-07
-
-#include "STLFactory.h"
-
-using namespace dolfin;
-
-// Singleton instance
-STLFactory STLFactory::factory;
diff --git a/dolfin/la/STLFactory.h b/dolfin/la/STLFactory.h
deleted file mode 100644
index d32fdbb..0000000
--- a/dolfin/la/STLFactory.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (C) 2007 Ilmar Wilbers
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Anders Logg 2008-2012
-// Modified by Garth N. Wells 2012
-//
-// First added:  2008-05-21
-// Last changed: 2012-08-20
-
-#ifndef __DOLFIN_STL_FACTORY_H
-#define __DOLFIN_STL_FACTORY_H
-
-#include <memory>
-#include <dolfin/log/log.h>
-#include "GenericLinearAlgebraFactory.h"
-#include "STLMatrix.h"
-#include "STLVector.h"
-#include "TensorLayout.h"
-#include "Vector.h"
-
-namespace dolfin
-{
-
-  class STLFactory: public GenericLinearAlgebraFactory
-  {
-  public:
-
-    /// Destructor
-    virtual ~STLFactory() {}
-
-    /// Create empty matrix
-    std::shared_ptr<GenericMatrix> create_matrix() const
-    {
-      std::shared_ptr<GenericMatrix> A(new STLMatrix);
-      return A;
-    }
-
-    /// Create empty vector
-    std::shared_ptr<GenericVector> create_vector() const
-    {
-      std::shared_ptr<GenericVector> x(new STLVector);
-      return x;
-    }
-
-    /// Create empty tensor layout
-    std::shared_ptr<TensorLayout> create_layout(std::size_t rank) const
-    {
-      std::shared_ptr<TensorLayout> pattern(new TensorLayout(0, false));
-      return pattern;
-    }
-
-    /// Create empty linear operator
-    std::shared_ptr<GenericLinearOperator> create_linear_operator() const
-    {
-      dolfin_error("STLFactory.h",
-                   "create linear operator",
-                   "Not supported by STL linear algebra backend");
-      std::shared_ptr<GenericLinearOperator>
-        A(new NotImplementedLinearOperator);
-      return A;
-    }
-
-    /// Create LU solver
-    std::shared_ptr<GenericLUSolver>
-      create_lu_solver(std::string method) const
-    {
-      dolfin_error("STLFactory",
-                   "create LU solver",
-                   "LU solver not available for the STL backend");
-      std::shared_ptr<GenericLUSolver> solver;
-      return solver;
-    }
-
-    /// Create Krylov solver
-    std::shared_ptr<GenericLinearSolver>
-      create_krylov_solver(std::string method,
-                           std::string preconditioner) const
-    {
-      dolfin_error("STLFactory",
-                   "create Krylov solver",
-                   "Krylov solver not available for the STL backend");
-      std::shared_ptr<GenericLinearSolver> solver;
-      return solver;
-    }
-
-    /// Return singleton instance
-    static STLFactory& instance()
-    { return factory; }
-
-  protected:
-
-    // Private Constructor
-    STLFactory() {}
-
-    // Singleton instance
-    static STLFactory factory;
-
-  };
-}
-
-#endif
diff --git a/dolfin/la/STLFactoryCSC.cpp b/dolfin/la/STLFactoryCSC.cpp
deleted file mode 100644
index 583b874..0000000
--- a/dolfin/la/STLFactoryCSC.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2012 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-02-21
-// Last changed:
-
-#include "STLFactoryCSC.h"
-
-using namespace dolfin;
-
-// Singleton instance
-STLFactoryCSC STLFactoryCSC::factory;
diff --git a/dolfin/la/STLFactoryCSC.h b/dolfin/la/STLFactoryCSC.h
deleted file mode 100644
index 1cc0ec7..0000000
--- a/dolfin/la/STLFactoryCSC.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (C) 2012 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-02-21
-// Last changed:
-
-#ifndef __DOLFIN_STL_FACTORY_CSC_H
-#define __DOLFIN_STL_FACTORY_CSC_H
-
-#include <memory>
-#include "TensorLayout.h"
-#include "STLFactory.h"
-
-namespace dolfin
-{
-
-  class STLFactoryCSC : public STLFactory
-  {
-  public:
-
-    /// Destructor
-    virtual ~STLFactoryCSC() {}
-
-    /// Create empty tensor layout
-    virtual std::shared_ptr<TensorLayout> create_layout(std::size_t rank) const
-    {
-      std::shared_ptr<TensorLayout> pattern(new TensorLayout(1, false));
-      return pattern;
-    }
-
-    /// Return singleton instance
-    static STLFactoryCSC& instance()
-    { return factory; }
-
-  private:
-
-    /// Private Constructor
-    STLFactoryCSC() {}
-
-    // Singleton instance
-    static STLFactoryCSC factory;
-
-  };
-}
-
-#endif
diff --git a/dolfin/la/STLMatrix.cpp b/dolfin/la/STLMatrix.cpp
deleted file mode 100644
index c2a9a0e..0000000
--- a/dolfin/la/STLMatrix.cpp
+++ /dev/null
@@ -1,470 +0,0 @@
-// Copyright (C) 2007-2012 Anders Logg and Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Ola Skavhaug 2007
-// Modified by Ilmar Wilbers 2008
-//
-// First added:  2007-01-17
-// Last changed: 2012-03-15
-
-#include <algorithm>
-#include <iomanip>
-#include <sstream>
-#include <string>
-#include <utility>
-#include <boost/serialization/utility.hpp>
-
-#include <dolfin/common/Timer.h>
-#include <dolfin/common/MPI.h>
-#include <dolfin/common/types.h>
-#include "STLFactory.h"
-#include "STLFactoryCSC.h"
-#include "STLMatrix.h"
-
-using namespace dolfin;
-
-struct CompareIndex
-{
-  CompareIndex(std::size_t index) : _index(index) {}
-  bool operator()(const std::pair<std::size_t, double>& entry) const
-  { return _index == entry.first; }
-  private:
-    const std::size_t _index;
-};
-
-//-----------------------------------------------------------------------------
-void STLMatrix::init(const TensorLayout& tensor_layout)
-{
-  // Check that sparsity pattern has correct storage (row vs column storage)
-  if (_primary_dim != tensor_layout.primary_dim)
-  {
-    dolfin_error("STLMatrix.cpp",
-                 "initialization of STL matrix",
-                 "Primary storage dim of matrix and tensor layout must be the same");
-  }
-
-  // Get MPI communicator
-  _mpi_comm = tensor_layout.mpi_comm();
-
-  // Set co-dimension
-  std::size_t primary_codim = 1;
-  if (_primary_dim == 1)
-    primary_codim = 0;
-
-  // Set block size
-  _block_size = tensor_layout.block_size;
-
-  _local_range = tensor_layout.local_range(_primary_dim);
-  num_codim_entities = tensor_layout.size(primary_codim);
-
-  const std::size_t num_primary_entiries = _local_range.second
-    - _local_range.first;
-
-  _values.resize(num_primary_entiries);
-
-  // FIXME: Add function to sparsity pattern to get nnz per row to
-  //        to reserve space for vectors
-  //if (tensor_layout.sparsity_pattern()
-  //{
-  //  Reserve space here
-  //}
-}
-//-----------------------------------------------------------------------------
-std::size_t STLMatrix::size(std::size_t dim) const
-{
-  if (dim > 1)
-  {
-    dolfin_error("STLMatrix.cpp",
-                 "access size of STL matrix",
-                 "Illegal axis (%d), must be 0 or 1", dim);
-  }
-
-  if (_primary_dim == 0)
-  {
-    if (dim == 0)
-    {
-      return dolfin::MPI::sum(_mpi_comm,
-                              _local_range.second - _local_range.first);
-    }
-    else
-      return num_codim_entities;
-  }
-  else
-  {
-    if (dim == 0)
-      return num_codim_entities;
-    else
-    {
-      return dolfin::MPI::sum(_mpi_comm,
-                              _local_range.second - _local_range.first);
-    }
-  }
-}
-//-----------------------------------------------------------------------------
-std::pair<std::size_t, std::size_t>
-STLMatrix::local_range(std::size_t dim) const
-{
-  dolfin_assert(dim < 2);
-  if (_primary_dim == 0)
-  {
-    if (dim == 0)
-      return _local_range;
-    else
-      return std::make_pair(0, num_codim_entities);
-  }
-  else
-  {
-    if (dim == 0)
-      return std::make_pair(0, num_codim_entities);
-    else
-      return _local_range;
-  }
-}
-//-----------------------------------------------------------------------------
-void STLMatrix::zero()
-{
-  std::vector<std::vector<std::pair<std::size_t, double>>>::iterator slice;
-  std::vector<std::pair<std::size_t, double>>::iterator entry;
-  for (slice = _values.begin(); slice != _values.end(); ++slice)
-    for (entry = slice->begin(); entry != slice->end(); ++entry)
-      entry->second = 0.0;
-}
-//-----------------------------------------------------------------------------
-void STLMatrix::add(const double* block,
-                    std::size_t m, const dolfin::la_index* rows,
-                    std::size_t n, const dolfin::la_index* cols)
-{
-  // Perform a simple linear search along each column. Otherwise,
-  // append the value (calling push_back).
-
-  const dolfin::la_index* primary_slice = rows;
-  const dolfin::la_index* secondary_slice = cols;
-
-  std::size_t dim   = m;
-  std::size_t codim = n;
-  std::size_t map0  = 1;
-  std::size_t map1  = n;
-  if (_primary_dim == 1)
-  {
-    dim = n;
-    codim = m;
-    map0  = n;
-    map1  = 1;
-  }
-
-  // Iterate over primary dimension
-  for (std::size_t i = 0; i < dim; i++)
-  {
-    // Global primary index
-    const std::size_t I = primary_slice[i];
-
-    // Check if I is a local row/column
-    if (I < _local_range.second && I >= _local_range.first)
-    {
-      const std::size_t I_local = I - _local_range.first;
-
-      assert(I_local < _values.size());
-      std::vector<std::pair<std::size_t, double>>& slice = _values[I_local];
-
-      // Iterate over co-dimension
-      for (std::size_t j = 0; j < codim; j++)
-      {
-        const std::size_t pos = i*map1 + j*map0;
-
-        // Global index
-        const std::size_t J = secondary_slice[j];
-
-        // Check if entry exists and insert
-        std::vector<std::pair<std::size_t, double>>::iterator entry
-              = std::find_if(slice.begin(), slice.end(), CompareIndex(J));
-        if (entry != slice.end())
-          entry->second += block[pos];
-        else
-          slice.push_back(std::make_pair(J, block[pos]));
-      }
-    }
-    else
-    {
-      // Iterate over columns
-      for (std::size_t j = 0; j < n; j++)
-      {
-        // Global column, coordinate
-        const std::size_t J = secondary_slice[j];
-        const std::pair<std::size_t, std::size_t> global_coordinate(I, J);
-        //const std::size_t pos = i*n + j;
-        const std::size_t pos = i*map1 + j*map0;
-
-        boost::unordered_map<std::pair<std::size_t,
-                                       std::size_t>, double>::iterator coord;
-        coord = off_processs_data.find(global_coordinate);
-        if (coord == off_processs_data.end())
-          off_processs_data[global_coordinate] = block[pos];
-        else
-          coord->second += block[pos];
-      }
-    }
-  }
-}
-//-----------------------------------------------------------------------------
-void STLMatrix::apply(std::string mode)
-{
-  Timer timer("Apply (STLMatrix)");
-
-  // Number of processes
-  const std::size_t num_processes = MPI::size(_mpi_comm);
-
-  // Data to send
-  std::vector<std::vector<std::size_t>> send_non_local_rows(num_processes);
-  std::vector<std::vector<std::size_t>> send_non_local_cols(num_processes);
-  std::vector<std::vector<double>> send_non_local_vals(num_processes);
-
-  std::vector<std::size_t> range(2);
-  range[0] = _local_range.first;
-  range[1] = _local_range.second;
-  std::vector<std::size_t> process_ranges;
-  dolfin::MPI::all_gather(_mpi_comm, range, process_ranges);
-
-  // Communicate off-process data
-  boost::unordered_map<std::pair<std::size_t,
-                               std::size_t>, double>::const_iterator entry;
-  for (entry = off_processs_data.begin(); entry != off_processs_data.end();
-       ++entry)
-  {
-    const std::size_t global_row = entry->first.first;
-
-    // FIXME: This can be more efficient by storing sparsity pattern,
-    //        or caching owning process for repeated assembly
-
-    // Get owning process
-    std::size_t owner = 0;
-    for (std::size_t proc = 0; proc < num_processes; ++proc)
-    {
-      if (global_row < process_ranges[2*proc + 1]
-          && global_row >= process_ranges[2*proc])
-      {
-        owner = proc;
-        break;
-      }
-    }
-
-    send_non_local_rows[owner].push_back(global_row);
-    send_non_local_cols[owner].push_back(entry->first.second);
-    send_non_local_vals[owner].push_back(entry->second);
-  }
-
-  // Send/receive data
-  std::vector<std::vector<std::size_t>> received_non_local_rows;
-  std::vector<std::vector<std::size_t>> received_non_local_cols;
-  std::vector<std::vector<double>> received_non_local_vals;
-  dolfin::MPI::all_to_all(_mpi_comm, send_non_local_rows,
-                          received_non_local_rows);
-  dolfin::MPI::all_to_all(_mpi_comm, send_non_local_cols,
-                          received_non_local_cols);
-  dolfin::MPI::all_to_all(_mpi_comm, send_non_local_vals,
-                          received_non_local_vals);
-
-  // Add/insert off-process data
-  for (std::size_t p = 0; p < num_processes; ++p)
-  {
-    const std::vector<std::size_t>& received_non_local_rows_p
-      = received_non_local_rows[p];
-    const std::vector<std::size_t>& received_non_local_cols_p
-      = received_non_local_cols[p];
-    const std::vector<double>& received_non_local_vals_p
-      = received_non_local_vals[p];
-
-    dolfin_assert(received_non_local_rows_p.size()
-           == received_non_local_cols_p.size());
-    dolfin_assert(received_non_local_rows_p.size()
-           == received_non_local_vals_p.size());
-
-    for (std::size_t i = 0; i < received_non_local_rows_p.size(); ++i)
-    {
-      dolfin_assert(received_non_local_rows_p[i] < _local_range.second
-                    && received_non_local_rows_p[i] >= _local_range.first);
-      const std::size_t I_local
-        = received_non_local_rows_p[i] - _local_range.first;
-      dolfin_assert(I_local < _values.size());
-
-      const std::size_t J = received_non_local_cols_p[i];
-      std::vector<std::pair<std::size_t, double>>::iterator e
-            = std::find_if(_values[I_local].begin(), _values[I_local].end(),
-                           CompareIndex(J));
-      if (e != _values[I_local].end())
-        e->second += received_non_local_vals_p[i];
-      else
-        _values[I_local].push_back(std::make_pair(J,
-                                               received_non_local_vals_p[i]));
-    }
-  }
-
-  // Sort columns (csr)/rows (csc)
-  sort();
-}
-//-----------------------------------------------------------------------------
-double STLMatrix::norm(std::string norm_type) const
-{
-  if (norm_type != "frobenius")
-    error("Do not know to compute %s norm for STLMatrix", norm_type.c_str());
-
-  double _norm = 0.0;
-  for (std::size_t i = 0; i < _values.size(); ++i)
-  {
-    for (std::size_t j = 0; j < _values[i].size(); ++j)
-      _norm += _values[i][j].second*_values[i][j].second;
-  }
-  return std::sqrt(dolfin::MPI::sum(_mpi_comm, _norm));
-}
-//-----------------------------------------------------------------------------
-void STLMatrix::getrow(std::size_t row, std::vector<std::size_t>& columns,
-                       std::vector<double>& values) const
-{
-  if (_primary_dim == 1)
-  {
-    dolfin_error("STLMatrix.cpp",
-                 "getting row from matrix",
-                 "A row can only be extract from a STLMatrix that use row-wise storage.");
-  }
-
-  dolfin_assert(row < _local_range.second && row >= _local_range.first);
-  const std::size_t local_row = row - _local_range.first;
-  dolfin_assert(local_row < _values.size());
-
-  // Copy row values
-  columns.resize(_values[local_row].size());
-  values.resize(_values[local_row].size());
-  for (std::size_t i = 0; i < _values[local_row].size(); ++i)
-  {
-    columns[i] = _values[local_row][i].first;
-    values[i]  = _values[local_row][i].second;
-  }
-}
-//-----------------------------------------------------------------------------
-void STLMatrix::ident(std::size_t m, const dolfin::la_index* rows)
-{
-  if (_primary_dim == 1)
-  {
-    dolfin_error("STLMatrix.cpp",
-                 "creating identity row",
-                 "STLMatrix::ident can only be used with row-wise storage.");
-  }
-
-  std::pair<std::size_t, std::size_t> row_range = local_range(0);
-  for (std::size_t i = 0; i < m; ++i)
-  {
-    const std::size_t global_row = rows[i];
-    if (global_row >= row_range.first && global_row < row_range.second)
-    {
-      const std::size_t local_row = global_row - row_range.first;
-      dolfin_assert(local_row < _values.size());
-      for (std::size_t j = 0; j < _values[local_row].size(); ++j)
-        _values[local_row][j].second = 0.0;
-
-      // Place one on diagonal
-      std::vector<std::pair<std::size_t, double>>::iterator diagonal
-          = std::find_if(_values[local_row].begin(), _values[local_row].end(),
-                         CompareIndex(global_row));
-
-      if (diagonal != _values[local_row].end())
-        diagonal->second = 1.0;
-      else
-        _values[local_row].push_back(std::make_pair(global_row, 1.0));
-    }
-  }
-}
-//-----------------------------------------------------------------------------
-const STLMatrix& STLMatrix::operator*= (double a)
-{
-  std::vector<std::vector<std::pair<std::size_t, double>>>::iterator row;
-  std::vector<std::pair<std::size_t, double>>::iterator entry;
-  for (row = _values.begin(); row != _values.end(); ++row)
-    for (entry = row->begin(); entry != row->end(); ++entry)
-      entry->second *=a;
-
-  return *this;
-}
-//-----------------------------------------------------------------------------
-const STLMatrix& STLMatrix::operator/= (double a)
-{
-  return (*this) *= 1.0/a;
-}
-//-----------------------------------------------------------------------------
-std::string STLMatrix::str(bool verbose) const
-{
-  std::stringstream s;
-
-  if (verbose)
-  {
-    if (_primary_dim == 1)
-    {
-      dolfin_error("STLMatrix.cpp",
-                   "verbose string output of matrix",
-                   "Verbose string output is currently supported for row-wise storage only.");
-    }
-
-    s << str(false) << std::endl << std::endl;
-    for (std::size_t i = 0; i < _local_range.second - _local_range.first; i++)
-    {
-      // Sort row data by column index
-      std::vector<std::pair<std::size_t, double>> data = _values[i];
-      std::sort(data.begin(), data.end());
-
-      // Set precision
-      std::stringstream line;
-      line << std::setiosflags(std::ios::scientific);
-      line << std::setprecision(1);
-
-      // Format matrix
-      line << "|";
-      std::vector<std::pair<std::size_t, double>>::const_iterator entry;
-      for (entry = data.begin(); entry != data.end(); ++entry)
-      {
-        line << " (" << i << ", " << entry->first << ", " << entry->second
-             << ")";
-      }
-      line << " |";
-
-      s << line.str().c_str() << std::endl;
-    }
-  }
-  else
-    s << "<STLMatrix of size " << size(0) << " x " << size(1) << ">";
-
-  return s.str();
-}
-//-----------------------------------------------------------------------------
-GenericLinearAlgebraFactory& STLMatrix::factory() const
-{
-  if (_primary_dim == 0)
-    return STLFactory::instance();
-  else
-    return STLFactoryCSC::instance();
-}
-//-----------------------------------------------------------------------------
-std::size_t STLMatrix::nnz() const
-{
-  return dolfin::MPI::sum(_mpi_comm, local_nnz());
-}
-//-----------------------------------------------------------------------------
-std::size_t STLMatrix::local_nnz() const
-{
-  std::size_t _nnz = 0;
-  for (std::size_t i = 0; i < _values.size(); ++i)
-    _nnz += _values[i].size();
-  return _nnz;
-}
-//-----------------------------------------------------------------------------
diff --git a/dolfin/la/STLMatrix.h b/dolfin/la/STLMatrix.h
deleted file mode 100644
index 3d20290..0000000
--- a/dolfin/la/STLMatrix.h
+++ /dev/null
@@ -1,410 +0,0 @@
-// Copyright (C) 2007-2012 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Ola Skavhaug 2007
-// Modified by Garth N. Wells 2007, 2009
-// Modified by Ilmar Wilbers 2008
-//
-// First added:  2007-01-17
-// Last changed: 2012-08-20
-
-#ifndef __DOLFIN_STL_MATRIX_H
-#define __DOLFIN_STL_MATRIX_H
-
-#include <string>
-#include <utility>
-#include <boost/unordered_map.hpp>
-#include <vector>
-
-#include <dolfin/common/types.h>
-#include <dolfin/log/log.h>
-#include "TensorLayout.h"
-#include "GenericMatrix.h"
-
-namespace dolfin
-{
-
-  class GenericSparsityPattern;
-  class GenericVector;
-
-  /// Simple STL-based implementation of the GenericMatrix interface.
-  /// The sparse matrix is stored as a pair of std::vector of
-  /// std::vector, one for the columns and one for the values.
-  ///
-  /// Historically, this class has undergone a number of different
-  /// incarnations, based on various combinations of std::vector,
-  /// std::set and std::map. The current implementation has proven to
-  /// be the fastest.
-
-  class STLMatrix : public GenericMatrix
-  {
-  public:
-
-    /// Create empty matrix
-  STLMatrix(std::size_t primary_dim=0) : _mpi_comm(MPI_COMM_SELF),
-      _primary_dim(primary_dim), _block_size(1), _local_range(0, 0),
-      num_codim_entities(0) {}
-
-    /// Destructor
-    virtual ~STLMatrix() {}
-
-    ///--- Implementation of the GenericTensor interface ---
-
-    /// Initialize zero tensor using sparsity pattern
-    virtual void init(const TensorLayout& tensor_layout);
-
-    /// Return true if empty
-    virtual bool empty() const
-    { return _values.empty(); }
-
-    /// Return size of given dimension
-    virtual std::size_t size(std::size_t dim) const;
-
-    /// Return local ownership range
-    virtual std::pair<std::size_t, std::size_t>
-      local_range(std::size_t dim) const;
-
-    /// Set all entries to zero and keep any sparse structure
-    virtual void zero();
-
-    /// Finalize assembly of tensor
-    virtual void apply(std::string mode);
-
-    /// Return MPI communicator
-    virtual MPI_Comm mpi_comm() const
-    { return _mpi_comm; }
-
-    /// Return informal string representation (pretty-print)
-    virtual std::string str(bool verbose) const;
-
-    //--- Implementation of the GenericMatrix interface ---
-
-    /// Return copy of matrix
-    virtual std::shared_ptr<GenericMatrix> copy() const
-    {
-      std::shared_ptr<GenericMatrix> A(new STLMatrix(*this));
-      return A;
-    }
-
-    /// Initialize vector z to be compatible with the matrix-vector
-    /// product y = Ax. In the parallel case, both size and layout are
-    /// important.
-    ///
-    /// *Arguments*
-    ///     dim (std::size_t)
-    ///         The dimension (axis): dim = 0 --> z = y, dim = 1 --> z = x
-    virtual void init_vector(GenericVector& z, std::size_t dim) const
-    { dolfin_not_implemented(); }
-
-    /// Get block of values
-    virtual void get(double* block, std::size_t m,
-                     const dolfin::la_index* rows, std::size_t n,
-                     const dolfin::la_index* cols) const
-    { dolfin_not_implemented(); }
-
-    /// Set block of values using global indices
-    virtual void set(const double* block, std::size_t m,
-                     const dolfin::la_index* rows, std::size_t n,
-                     const dolfin::la_index* cols)
-    { dolfin_not_implemented(); }
-
-    /// Set block of values using local indices
-    virtual void set_local(const double* block, std::size_t m,
-                           const dolfin::la_index* rows, std::size_t n,
-                           const dolfin::la_index* cols)
-    { dolfin_not_implemented(); }
-
-    /// Add block of values using global indices
-    virtual void add(const double* block, std::size_t m,
-                     const dolfin::la_index* rows, std::size_t n,
-                     const dolfin::la_index* cols);
-
-    /// Add block of values using local indices
-    virtual void add_local(const double* block, std::size_t m,
-                           const dolfin::la_index* rows, std::size_t n,
-                           const dolfin::la_index* cols)
-    { dolfin_not_implemented(); }
-
-    /// Add multiple of given matrix (AXPY operation)
-    virtual void axpy(double a, const GenericMatrix& A,
-                      bool same_nonzero_pattern)
-    { dolfin_not_implemented(); }
-
-    /// Return norm of matrix
-    virtual double norm(std::string norm_type) const;
-
-    /// Get non-zero values of given row
-    virtual void getrow(std::size_t row, std::vector<std::size_t>& columns,
-                        std::vector<double>& values) const;
-
-    /// Set values for given row
-    virtual void setrow(std::size_t row,
-                        const std::vector<std::size_t>& columns,
-                        const std::vector<double>& values)
-    { dolfin_not_implemented(); }
-
-    /// Set given rows (global row indices) to zero
-    virtual void zero(std::size_t m, const dolfin::la_index* rows)
-    { dolfin_not_implemented(); }
-
-    /// Set given rows (local row indices) to zero
-    virtual void zero_local(std::size_t m, const dolfin::la_index* rows)
-    { zero(m, rows); }
-
-    /// Set given rows to identity matrix
-    virtual void ident(std::size_t m, const dolfin::la_index* rows);
-
-    /// Set given rows to identity matrix
-    virtual void ident_local(std::size_t m, const dolfin::la_index* rows)
-    { dolfin_not_implemented(); }
-
-    // Matrix-vector product, y = Ax
-    virtual void mult(const GenericVector& x, GenericVector& y) const
-    { dolfin_not_implemented(); }
-
-    // Matrix-vector product, y = A^T x
-    virtual void transpmult(const GenericVector& x, GenericVector& y) const
-    { dolfin_not_implemented(); }
-
-    /// Get diagonal of a matrix
-    virtual void get_diagonal(GenericVector& x) const
-    { dolfin_not_implemented(); }
-
-    /// Set diagonal of a matrix
-    virtual void set_diagonal(const GenericVector& x)
-    { dolfin_not_implemented(); }
-
-    /// Multiply matrix by given number
-    virtual const STLMatrix& operator*= (double a);
-
-    /// Divide matrix by given number
-    virtual const STLMatrix& operator/= (double a);
-
-    /// Assignment operator
-    virtual const GenericMatrix& operator= (const GenericMatrix& A)
-    { dolfin_not_implemented(); return *this; }
-
-    ///--- Specialized matrix functions ---
-
-    /// Return linear algebra backend factory
-    virtual GenericLinearAlgebraFactory& factory() const;
-
-    ///--- STLMatrix interface ---
-
-    /// Return matrix block size
-    std::size_t block_size() const
-    { return _block_size; }
-
-    /// Clear matrix. Destroys data and sparse layout
-    void clear()
-    {
-      _local_range = std::pair<std::size_t, std::size_t>(0, 0);
-      num_codim_entities = 0;
-      _values.clear();
-      off_processs_data.clear();
-    }
-
-    void sort()
-    {
-      std::vector<std::vector<std::pair<std::size_t, double> > >::iterator row;
-      for (row = _values.begin(); row < _values.end(); ++row)
-        std::sort(row->begin(), row->end());
-    }
-
-    /// Return matrix in CSR format
-    template<typename T>
-    void csr(std::vector<double>& vals, std::vector<T>& cols,
-             std::vector<T>& row_ptr,
-             std::vector<T>& local_to_global_row,
-             bool block,
-             bool symmetric) const;
-
-    /// Return matrix in CSC format
-    template<typename T>
-    void csc(std::vector<double>& vals, std::vector<T>& rows,
-             std::vector<T>& col_ptr,
-             std::vector<T>& local_to_global_col,
-             bool block,
-             bool symmetric) const;
-
-    /// Return number of global non-zero entries
-    std::size_t nnz() const;
-
-    /// Return number of local non-zero entries
-    std::size_t local_nnz() const;
-
-  private:
-
-    // MPI communicator
-    MPI_Comm _mpi_comm;
-
-    /// Return matrix in compressed format
-    template<typename T>
-    void compressed_storage(std::vector<double>& vals,
-                            std::vector<T>& rows,
-                            std::vector<T>& col_ptr,
-                            std::vector<T>& local_to_global_col,
-                            bool block,
-                            bool symmetric) const;
-
-    // Primary dimension (0=row-wise storage, 1=column-wise storage)
-    const std::size_t _primary_dim;
-
-    // Block size, e.g. 3 for 3D elasticity with appropriate dof ordering
-    std::size_t _block_size;
-
-    // Local ownership range (row range for row-wise storage, column
-    // range for column-wise storage)
-    std::pair<std::size_t, std::size_t> _local_range;
-
-    // Number of columns (row-wise storage) or number of rows (column-wise
-    // storage)
-    std::size_t num_codim_entities;
-
-    // Storage of non-zero matrix values
-    std::vector<std::vector<std::pair<std::size_t, double> > > _values;
-
-    // Off-process data ([i, j], value)
-    boost::unordered_map<std::pair<std::size_t, std::size_t>, double>
-      off_processs_data;
-
-  };
-
-  //---------------------------------------------------------------------------
-  // Implementation of templated functions
-  //---------------------------------------------------------------------------
-  template<typename T>
-  void STLMatrix::csr(std::vector<double>& vals, std::vector<T>& cols,
-                      std::vector<T>& row_ptr,
-                      std::vector<T>& local_to_global_row,
-                      bool block,
-                      bool symmetric) const
-  {
-    if (_primary_dim != 0)
-    {
-      dolfin_error("STLMatrix.cpp",
-                   "creating compressed row storage data",
-                   "Cannot create CSR matrix from STLMatrix with column-wise storage.");
-    }
-    compressed_storage(vals, cols, row_ptr, local_to_global_row, block,
-                       symmetric);
-  }
-  //---------------------------------------------------------------------------
-  template<typename T>
-  void STLMatrix::csc(std::vector<double>& vals, std::vector<T>& rows,
-                      std::vector<T>& col_ptr,
-                      std::vector<T>& local_to_global_col,
-                      bool block,
-                      bool symmetric) const
-  {
-    if (_primary_dim != 1)
-    {
-      dolfin_error("STLMatrix.cpp",
-                   "creating compressed column storage data",
-                   "Cannot create CSC matrix from STLMatrix with row-wise storage.");
-    }
-    compressed_storage(vals, rows, col_ptr, local_to_global_col, block,
-                       symmetric);
-  }
-  //---------------------------------------------------------------------------
-  template<typename T>
-  void STLMatrix::compressed_storage(std::vector<double>& vals,
-                                     std::vector<T>& cols,
-                                     std::vector<T>& row_ptr,
-                                     std::vector<T>& local_to_global_row,
-                                     bool block,
-                                     bool symmetric) const
-  {
-    // Reset data structures
-    vals.clear();
-    cols.clear();
-    row_ptr.clear();
-    local_to_global_row.clear();
-
-    // Reserve memory
-    row_ptr.reserve(_values.size() + 1);
-    local_to_global_row.reserve(_values.size());
-
-    // Build CSR data structures
-    row_ptr.push_back(0);
-
-    // Number of local non-zero entries
-    const std::size_t _local_nnz = local_nnz();
-
-    // Number of local rows (columns)
-    const std::size_t num_local_rows = _values.size();
-
-    if (!symmetric)
-    {
-      // Reserve memory
-      vals.reserve(_local_nnz);
-      cols.reserve(_local_nnz);
-
-      // Build data structures
-      for (std::size_t local_row = 0; local_row < num_local_rows;
-           local_row += _block_size)
-      {
-        for (std::size_t column = 0; column < _values[local_row].size();
-             column += _block_size)
-        {
-          cols.push_back(_values[local_row][column].first/_block_size);
-          for (std::size_t b0 = 0; b0 < _block_size; ++b0)
-            for (std::size_t b1 = 0; b1 < _block_size; ++b1)
-              vals.push_back(_values[local_row + b0][column + b1].second);
-        }
-        local_to_global_row.push_back((_local_range.first
-                                       + local_row)/_block_size);
-        row_ptr.push_back(row_ptr.back()+_values[local_row].size()/_block_size);
-      }
-    }
-    else
-    {
-      // Reserve memory
-      vals.reserve((_local_nnz - num_local_rows)/2 + num_local_rows);
-      cols.reserve((_local_nnz - num_local_rows)/2 + num_local_rows);
-
-      // Build data structures
-      for (std::size_t local_row = 0; local_row < _values.size();
-           local_row += _block_size)
-      {
-        const std::size_t global_row_index
-          = (local_row + _local_range.first)/_block_size;
-        std::size_t counter = 0;
-        for (std::size_t column = 0; column < _values[local_row].size();
-             column += _block_size)
-        {
-          const std::size_t index
-            = _values[local_row][column].first/_block_size;
-          if (index >= global_row_index)
-          {
-            cols.push_back(index);
-            for (std::size_t b0 = 0; b0 < _block_size; ++b0)
-              for (std::size_t b1 = 0; b1 < _block_size; ++b1)
-                vals.push_back(_values[local_row + b0][column + b1].second);
-            ++counter;
-          }
-        }
-        local_to_global_row.push_back(global_row_index);
-        row_ptr.push_back(row_ptr.back() + counter);
-      }
-    }
-  }
-//-----------------------------------------------------------------------------
-
-}
-
-#endif
diff --git a/dolfin/la/Scalar.h b/dolfin/la/Scalar.h
index 10cd454..fd569e6 100644
--- a/dolfin/la/Scalar.h
+++ b/dolfin/la/Scalar.h
@@ -15,7 +15,7 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
-// Modified by Garth N. Wells, 2007-2011.
+// Modified by Garth N. Wells, 2007-2015.
 // Modified by Ola Skavhaug, 2007.
 // Modified by Martin Alnaes, 2014.
 
@@ -44,8 +44,12 @@ namespace dolfin
   public:
 
     /// Create zero scalar
-    Scalar() : GenericTensor(), _value(0.0), _local_increment(0.0), _mpi_comm(MPI_COMM_WORLD)
-    { SubSystemsManager::init_mpi(); }
+    Scalar() : Scalar(MPI_COMM_WORLD) {}
+
+    /// Create zero scalar
+    Scalar(MPI_Comm comm) : GenericTensor(), _value(0.0), _local_increment(0.0),
+      _mpi_comm(comm)
+      { SubSystemsManager::init_mpi(); }
 
     /// Destructor
     virtual ~Scalar() {}
@@ -87,13 +91,13 @@ namespace dolfin
     }
 
     /// Return local ownership range
-    virtual std::pair<std::size_t, std::size_t>
+    virtual std::pair<std::int64_t, std::int64_t>
       local_range(std::size_t dim) const
     {
       dolfin_error("Scalar.h",
                    "get local range of scalar",
                    "The local_range() function is not available for scalars");
-      return std::make_pair(0, 0);
+      return {0, 0};
     }
 
     /// Get block of values
@@ -141,7 +145,7 @@ namespace dolfin
 
     /// Add block of values using global indices
     virtual void add(const double* block,
-             const std::vector<ArrayView<const dolfin::la_index> >& rows)
+             const std::vector<ArrayView<const dolfin::la_index>>& rows)
     {
       dolfin_assert(block);
       _local_increment += block[0];
@@ -149,7 +153,7 @@ namespace dolfin
 
     /// Add block of values using local indices
     virtual void add_local(const double* block,
-             const std::vector<ArrayView<const dolfin::la_index> >& rows)
+             const std::vector<ArrayView<const dolfin::la_index>>& rows)
     {
       dolfin_assert(block);
       _local_increment += block[0];
@@ -202,11 +206,13 @@ namespace dolfin
       return f.factory();
     }
 
-    /// Get final value (assumes prior apply(), not part of GenericTensor interface)
+    /// Get final value (assumes prior apply(), not part of
+    /// GenericTensor interface)
     double get_scalar_value() const
     { return _value; }
 
-    /// Add to local increment (added for testing, remove if we add a better way from python)
+    /// Add to local increment (added for testing, remove if we add a
+    /// better way from python)
     void add_local_value(double value)
     { _local_increment += value; }
 
diff --git a/dolfin/la/SparsityPattern.cpp b/dolfin/la/SparsityPattern.cpp
index 602c751..e389601 100644
--- a/dolfin/la/SparsityPattern.cpp
+++ b/dolfin/la/SparsityPattern.cpp
@@ -27,75 +27,44 @@
 #include <dolfin/common/MPI.h>
 #include <dolfin/log/log.h>
 #include <dolfin/log/LogStream.h>
+#include <dolfin/la/IndexMap.h>
 #include "SparsityPattern.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
 SparsityPattern::SparsityPattern(std::size_t primary_dim)
-  : GenericSparsityPattern(primary_dim), _mpi_comm(MPI_COMM_NULL)
+  : _primary_dim(primary_dim), _mpi_comm(MPI_COMM_NULL)
 {
   // Do nothing
 }
 //-----------------------------------------------------------------------------
 SparsityPattern::SparsityPattern(
   const MPI_Comm mpi_comm,
-  const std::vector<std::size_t>& dims,
-  const std::vector<std::pair<std::size_t, std::size_t>>& local_range,
-  const std::vector<ArrayView<const std::size_t>>& local_to_global,
-  const std::vector<ArrayView<const int>>& off_process_owner,
-  const std::vector<std::size_t>& block_sizes,
+  const std::vector<std::shared_ptr<const IndexMap>> index_maps,
   std::size_t primary_dim)
-  : GenericSparsityPattern(primary_dim), _mpi_comm(MPI_COMM_NULL)
+  : _primary_dim(primary_dim), _mpi_comm(MPI_COMM_NULL)
 {
-  init(mpi_comm, dims, local_range, local_to_global, off_process_owner,
-       block_sizes);
+  init(mpi_comm, index_maps);
 }
 //-----------------------------------------------------------------------------
 void SparsityPattern::init(
   const MPI_Comm mpi_comm,
-  const std::vector<std::size_t>& dims,
-  const std::vector<std::pair<std::size_t, std::size_t>>& local_range,
-  const std::vector<ArrayView<const std::size_t>>& local_to_global,
-  const std::vector<ArrayView<const int>>& off_process_owner,
-  const std::vector<std::size_t>& block_sizes)
+  const std::vector<std::shared_ptr<const IndexMap>> index_maps)
 {
   // Only rank 2 sparsity patterns are supported
-  dolfin_assert(dims.size() == 2);
-  dolfin_assert(block_sizes.size() == 2);
+  dolfin_assert(index_maps.size() == 2);
 
   _mpi_comm = mpi_comm;
+  _index_maps = index_maps;
 
   const std::size_t _primary_dim = primary_dim();
 
-  // Check that dimensions match
-  dolfin_assert(dims.size() == local_range.size());
-  dolfin_assert(dims.size() == local_to_global.size());
-  dolfin_assert(dims.size() == off_process_owner.size());
-
   // Clear sparsity pattern data
   diagonal.clear();
   off_diagonal.clear();
   non_local.clear();
-  _off_process_owner.clear();
-
-  // Set block size
-  _block_size = block_sizes;
-
-  // Set ownership range
-  _local_range = local_range;
-
-  // Store copy of local-to-global and nonlocal index to owning
-  // process map
-  _local_to_global.resize(off_process_owner.size());
-  _off_process_owner.resize(off_process_owner.size());
-  for (std::size_t i = 0; i < off_process_owner.size(); ++i)
-  {
-    _local_to_global[i].assign(local_to_global[i].begin(),
-                               local_to_global[i].end());
-    _off_process_owner[i].assign(off_process_owner[i].begin(),
-                                 off_process_owner[i].end());
-  }
+  full_rows.clear();
 
   // Check that primary dimension is valid
   if (_primary_dim > 1)
@@ -105,15 +74,91 @@ void SparsityPattern::init(
                  "Primary dimension must be less than 2 (0=row major, 1=column major");
   }
 
-  const std::size_t local_size
-    = _local_range[_primary_dim].second - _local_range[_primary_dim].first;
+  const std::size_t local_size0
+    = index_maps[_primary_dim]->size(IndexMap::MapSize::OWNED);
+
+  const std::size_t primary_codim = _primary_dim == 0 ? 1 : 0;
+  const std::size_t local_size1
+    = index_maps[primary_codim]->size(IndexMap::MapSize::OWNED);
+  const std::size_t global_size1
+    = index_maps[primary_codim]->size(IndexMap::MapSize::GLOBAL);
 
   // Resize diagonal block
-  diagonal.resize(local_size);
+  diagonal.resize(local_size0);
 
   // Resize off-diagonal block (only needed when local range != global
   // range)
-  off_diagonal.resize(local_size);
+  if (global_size1 > local_size1)
+  {
+    dolfin_assert(MPI::size(_mpi_comm) > 1);
+    off_diagonal.resize(local_size0);
+  }
+  else
+  {
+    dolfin_assert(global_size1 == local_size1);
+    // NOTE: MPI::size(_mpi_comm)==1 does not necessarilly hold. It may be
+    //       rectangle tensor with one very small dimension, e.g. Real space
+  }
+}
+//-----------------------------------------------------------------------------
+void SparsityPattern::insert_global(dolfin::la_index i, dolfin::la_index j)
+{
+  dolfin::la_index i_index = i;
+  dolfin::la_index j_index = j;
+
+  const std::size_t _primary_dim = primary_dim();
+
+  if (_primary_dim != 0)
+  {
+    i_index = j;
+    j_index = i;
+  }
+
+  // Check local range
+  if (MPI::size(_mpi_comm) == 1)
+  {
+    // Sequential mode, do simple insertion if not full row
+    if (full_rows.find(i_index) == full_rows.end())
+      diagonal[i_index].insert(j_index);
+  }
+  else
+  {
+    const std::pair<dolfin::la_index, dolfin::la_index>
+      local_range0 = _index_maps[_primary_dim]->local_range();
+    const std::pair<dolfin::la_index, dolfin::la_index>
+      local_range1 = _index_maps[1 - _primary_dim]->local_range();
+
+    if (local_range0.first <= i_index && i_index < local_range0.second)
+      {
+        // Subtract offset
+        const std::size_t I = i_index - local_range0.first;
+
+        // Full rows are stored separately
+        if (full_rows.find(I) != full_rows.end())
+        {
+          // Do nothing
+          return;
+        }
+
+        // Store local entry in diagonal or off-diagonal block
+        if (local_range1.first <= j_index && j_index < local_range1.second)
+        {
+          dolfin_assert(I < diagonal.size());
+          diagonal[I].insert(j_index);
+        }
+        else
+        {
+          dolfin_assert(I < off_diagonal.size());
+          off_diagonal[I].insert(j_index);
+        }
+      }
+    else
+    {
+      dolfin_error("SparsityPattern.cpp",
+                   "insert using global indices",
+                   "Index must be in the process range");
+    }
+  }
 }
 //-----------------------------------------------------------------------------
 void SparsityPattern::insert_global(
@@ -140,48 +185,64 @@ void SparsityPattern::insert_global(
     map_j = entries[0];
   }
 
+  dolfin_assert(_primary_dim < _index_maps.size());
+  dolfin_assert(primary_codim < _index_maps.size());
   const std::pair<dolfin::la_index, dolfin::la_index>
-    local_range0(_local_range[_primary_dim].first,
-                 _local_range[_primary_dim].second);
+    local_range0 = _index_maps[_primary_dim]->local_range();
   const std::pair<dolfin::la_index, dolfin::la_index>
-    local_range1(_local_range[primary_codim].first,
-                 _local_range[primary_codim].second);
+    local_range1 = _index_maps[primary_codim]->local_range();
+
+  const bool has_full_rows = full_rows.size() > 0;
+  const auto full_rows_end = full_rows.end();
 
   // Check local range
   if (MPI::size(_mpi_comm) == 1)
   {
-    // Sequential mode, do simple insertion
-    for (auto i_index = map_i.begin(); i_index != map_i.end(); ++i_index)
-      diagonal[*i_index].insert(map_j.begin(), map_j.end());
+    // Sequential mode, do simple insertion if not full row
+    for (const auto &i_index : map_i)
+    {
+      dolfin_assert(i_index < (la_index)diagonal.size());
+      if (!has_full_rows || full_rows.find(i_index) == full_rows_end)
+        diagonal[i_index].insert(map_j.begin(), map_j.end());
+    }
   }
   else
   {
-    // Parallel mode, use either diagonal, off_diagonal or non_local
-    for (auto i_index = map_i.begin(); i_index != map_i.end(); ++i_index)
+    // Parallel mode, use either diagonal, off_diagonal, non_local or full_rows
+    for (const auto &i_index : map_i)
     {
-      if (local_range0.first <= *i_index && *i_index < local_range0.second)
+      if (local_range0.first <= i_index && i_index < local_range0.second)
       {
         // Subtract offset
-        const std::size_t I = *i_index - local_range0.first;
+        const std::size_t I = i_index - local_range0.first;
+
+        // Full rows are stored separately
+        if (has_full_rows && full_rows.find(I) != full_rows_end)
+        {
+          // Do nothing
+          continue;
+        }
 
         // Store local entry in diagonal or off-diagonal block
-        for (auto j_index = map_j.begin(); j_index != map_j.end(); ++j_index)
+        for (const auto &j_index : map_j)
         {
-          if (local_range1.first <= *j_index && *j_index < local_range1.second)
+          if (local_range1.first <= j_index && j_index < local_range1.second)
           {
             dolfin_assert(I < diagonal.size());
-            diagonal[I].insert(*j_index);
+            diagonal[I].insert(j_index);
           }
           else
           {
             dolfin_assert(I < off_diagonal.size());
-            off_diagonal[I].insert(*j_index);
+            off_diagonal[I].insert(j_index);
           }
         }
       }
       else
       {
-        error("Row index in SparsityPattern::insert_global must be local to process.");
+        dolfin_error("SparsityPattern.cpp",
+                     "insert using global indices",
+                     "Index must be in the process range");
       }
     }
   }
@@ -210,72 +271,63 @@ void SparsityPattern::insert_local(
     map_j = entries[0];
   }
 
-  const la_index local_size0 = _local_range[_primary_dim].second
-    - _local_range[_primary_dim].first;
-  const la_index local_size1 = _local_range[primary_codim].second
-    - _local_range[primary_codim].first;
-  const la_index offset1 = _local_range[primary_codim].first;
+  std::shared_ptr<const IndexMap> index_map0 = _index_maps[ _primary_dim];
+  std::shared_ptr<const IndexMap> index_map1 = _index_maps[primary_codim];
+  const la_index local_size0 = index_map0->size(IndexMap::MapSize::OWNED);
+  const la_index local_size1 = index_map1->size(IndexMap::MapSize::OWNED);
+
+  const bool has_full_rows = full_rows.size() > 0;
+  const auto full_rows_end = full_rows.end();
 
   // Check local range
   if (MPI::size(_mpi_comm) == 1)
   {
-    // Sequential mode, do simple insertion
-    for (auto i_index = map_i.begin(); i_index != map_i.end(); ++i_index)
-      diagonal[*i_index].insert(map_j.begin(), map_j.end());
+    // Sequential mode, do simple insertion if not full row
+    for (const auto &i_index : map_i)
+    {
+      dolfin_assert(i_index < (la_index)diagonal.size());
+      if (!has_full_rows || full_rows.find(i_index) == full_rows_end)
+        diagonal[i_index].insert(map_j.begin(), map_j.end());
+    }
   }
   else
   {
-    // Parallel mode, use either diagonal, off_diagonal or non_local
-    std::size_t codim_block_size = _block_size[primary_codim];
-    for (auto i_index = map_i.begin(); i_index != map_i.end(); ++i_index)
+    // Parallel mode, use either diagonal, off_diagonal, non_local or full_rows
+    for (const auto &i_index : map_i)
     {
-      if (*i_index < local_size0)
+      // Full rows are stored separately
+      if (has_full_rows && full_rows.find(i_index) != full_rows_end)
+      {
+        // Do nothing
+        continue;
+      }
+
+      if (i_index < local_size0)
       {
         // Store local entry in diagonal or off-diagonal block
-        for (auto j_index = map_j.begin(); j_index != map_j.end(); ++j_index)
+        for (const auto &j_index : map_j)
         {
-          if (*j_index < local_size1)
+          const std::size_t J = index_map1->local_to_global(j_index);
+          if (j_index < local_size1)
           {
-            dolfin_assert(*i_index < (int) diagonal.size());
-            diagonal[*i_index].insert(*j_index + offset1);
+            dolfin_assert(i_index < (int)diagonal.size());
+            diagonal[i_index].insert(J);
           }
           else
           {
-            dolfin_assert(*i_index < (int) off_diagonal.size());
-            const std::div_t div
-              = std::div(int( *j_index - local_size1), (int) codim_block_size);
-            const int j_node = div.quot;
-            const int j_component = div.rem;
-
-            const std::size_t J_node = _local_to_global[primary_codim][j_node];
-            const std::size_t J = codim_block_size*J_node + j_component;
-            off_diagonal[*i_index].insert(J);
+            dolfin_assert(i_index < (int)off_diagonal.size());
+            off_diagonal[i_index].insert(J);
           }
         }
       }
       else
       {
         // Store non-local entry (communicated later during apply())
-        std::size_t codim_block_size = _block_size[primary_codim];
-        for (auto j_index = map_j.begin(); j_index != map_j.end(); ++j_index)
+        for (const auto &j_index : map_j)
         {
-          // Get global index
-          std::size_t J = 0;
-          if (*j_index < local_size1)
-            J = *j_index + offset1;
-          else
-          {
-            const std::div_t div = std::div((int) (*j_index - local_size1),
-                                            (int) codim_block_size);
-            const int j_node = div.quot;
-            const int j_component = div.rem;
-
-            const std::size_t J_node = _local_to_global[primary_codim][j_node];
-            J = codim_block_size*J_node + j_component;
-          }
-
+          const std::size_t J = index_map1->local_to_global(j_index);
           // Store indices
-          non_local.push_back(*i_index);
+          non_local.push_back(i_index);
           non_local.push_back(J);
         }
       }
@@ -283,6 +335,19 @@ void SparsityPattern::insert_local(
   }
 }
 //-----------------------------------------------------------------------------
+void SparsityPattern::insert_full_rows_local(
+  const std::vector<std::size_t>& rows)
+{
+  const std::size_t ghosted_size0 =
+    _index_maps[_primary_dim]->size(IndexMap::MapSize::ALL);
+  full_rows.set().reserve(rows.size());
+  for (const auto row : rows)
+  {
+    dolfin_assert(row < ghosted_size0);
+    full_rows.insert(row);
+  }
+}
+//-----------------------------------------------------------------------------
 std::size_t SparsityPattern::rank() const
 {
   return 2;
@@ -292,17 +357,28 @@ std::pair<std::size_t, std::size_t>
   SparsityPattern::local_range(std::size_t dim) const
 {
   dolfin_assert(dim < 2);
-  return _local_range[dim];
+  return _index_maps[dim]->local_range();
 }
 //-----------------------------------------------------------------------------
 std::size_t SparsityPattern::num_nonzeros() const
 {
   std::size_t nz = 0;
+
+  // Contribution from diagonal and off-diagonal
   for (auto slice = diagonal.begin(); slice != diagonal.end(); ++slice)
     nz += slice->size();
   for (auto slice = off_diagonal.begin(); slice != off_diagonal.end(); ++slice)
     nz += slice->size();
 
+  // Contribution from full rows
+  const std::size_t local_size0 =
+    _index_maps[_primary_dim]->size(IndexMap::MapSize::OWNED);
+  const std::size_t codim = _primary_dim == 0 ? 1 : 0;
+  const std::size_t ncols = _index_maps[codim]->size(IndexMap::MapSize::GLOBAL);
+  for (auto row = full_rows.begin(); row != full_rows.end(); ++row)
+    if (*row < local_size0)
+      nz += ncols;
+
   return nz;
 }
 //-----------------------------------------------------------------------------
@@ -314,6 +390,18 @@ void SparsityPattern::num_nonzeros_diagonal(std::vector<std::size_t>& num_nonzer
   // Get number of nonzeros per generalised row
   for (auto slice = diagonal.begin(); slice != diagonal.end(); ++slice)
     num_nonzeros[slice - diagonal.begin()] = slice->size();
+
+  // Get number of nonzeros per full row
+  if (full_rows.size() > 0)
+  {
+    const std::size_t local_size0 =
+      _index_maps[_primary_dim]->size(IndexMap::MapSize::OWNED);
+    const std::size_t codim = _primary_dim == 0 ? 1 : 0;
+    const std::size_t ncols = _index_maps[codim]->size(IndexMap::MapSize::OWNED);
+    for (const auto row : full_rows)
+      if (row < local_size0)
+        num_nonzeros[row] = ncols;
+  }
 }
 //-----------------------------------------------------------------------------
 void SparsityPattern::num_nonzeros_off_diagonal(std::vector<std::size_t>& num_nonzeros) const
@@ -321,9 +409,27 @@ void SparsityPattern::num_nonzeros_off_diagonal(std::vector<std::size_t>& num_no
   // Resize vector
   num_nonzeros.resize(off_diagonal.size());
 
+  // Return if there is no off-diagonal
+  if (off_diagonal.size() == 0)
+    return;
+
   // Compute number of nonzeros per generalised row
   for (auto slice = off_diagonal.begin(); slice != off_diagonal.end(); ++slice)
     num_nonzeros[slice - off_diagonal.begin()] = slice->size();
+
+  // Get number of nonzeros per full row
+  if (full_rows.size() > 0)
+  {
+    const std::size_t local_size0 =
+      _index_maps[_primary_dim]->size(IndexMap::MapSize::OWNED);
+    const std::size_t codim = _primary_dim == 0 ? 1 : 0;
+    const std::size_t ncols =
+      _index_maps[codim]->size(IndexMap::MapSize::GLOBAL)
+      - _index_maps[codim]->size(IndexMap::MapSize::OWNED);
+    for (const auto row : full_rows)
+      if (row < local_size0)
+        num_nonzeros[row] = ncols;
+  }
 }
 //-----------------------------------------------------------------------------
 void SparsityPattern::num_local_nonzeros(std::vector<std::size_t>& num_nonzeros) const
@@ -351,14 +457,12 @@ void SparsityPattern::apply()
     primary_codim = 0;
 
   const std::pair<dolfin::la_index, dolfin::la_index>
-    local_range0(_local_range[_primary_dim].first,
-                 _local_range[_primary_dim].second);
+    local_range0 = _index_maps[_primary_dim]->local_range();
   const std::pair<dolfin::la_index, dolfin::la_index>
-    local_range1(_local_range[primary_codim].first,
-                 _local_range[primary_codim].second);
-  const std::size_t local_size0 = _local_range[_primary_dim].second
-    - _local_range[_primary_dim].first;
-  const std::size_t offset0 = _local_range[_primary_dim].first;
+    local_range1 = _index_maps[primary_codim]->local_range();
+  const std::size_t local_size0
+    = _index_maps[_primary_dim]->size(IndexMap::MapSize::OWNED);
+  const std::size_t offset0 = local_range0.first;
 
   const std::size_t num_processes = MPI::size(_mpi_comm);
   const std::size_t proc_number = MPI::rank(_mpi_comm);
@@ -374,7 +478,13 @@ void SparsityPattern::apply()
     dolfin_assert(non_local.size() % 2 == 0);
     std::vector<std::vector<std::size_t>> non_local_send(num_processes);
 
-    std::size_t dim_block_size = _block_size[_primary_dim];
+    const std::vector<int>& off_process_owner
+      = _index_maps[_primary_dim]->off_process_owner();
+
+    const std::vector<std::size_t>& local_to_global
+      = _index_maps[_primary_dim]->local_to_global_unowned();
+
+    std::size_t dim_block_size = _index_maps[_primary_dim]->block_size();
     for (std::size_t i = 0; i < non_local.size(); i += 2)
     {
       // Get local indices of off-process dofs
@@ -384,8 +494,8 @@ void SparsityPattern::apply()
       // Figure out which process owns the row
       dolfin_assert(i_index >= local_size0);
       const std::size_t i_offset = (i_index - local_size0)/dim_block_size;
-      dolfin_assert(i_offset < _off_process_owner[_primary_dim].size());
-      const std::size_t p = _off_process_owner[_primary_dim][i_offset];
+      dolfin_assert(i_offset < off_process_owner.size());
+      const std::size_t p = off_process_owner[i_offset];
 
       dolfin_assert(p < num_processes);
       dolfin_assert(p != proc_number);
@@ -401,7 +511,7 @@ void SparsityPattern::apply()
         const int i_node = div.quot;
         const int i_component = div.rem;
 
-        const std::size_t I_node = _local_to_global[_primary_dim][i_node];
+        const std::size_t I_node = local_to_global[i_node];
         I = dim_block_size*I_node + i_component;
       }
 
@@ -424,26 +534,26 @@ void SparsityPattern::apply()
       for (std::size_t i = 0; i < non_local_received_p.size(); i += 2)
       {
         // Get global row and column
-        const std::size_t I = non_local_received_p[i];
-        const std::size_t J = non_local_received_p[i + 1];
+        const dolfin::la_index I = non_local_received_p[i];
+        const dolfin::la_index J = non_local_received_p[i + 1];
 
         // Sanity check
-        if (I < _local_range[_primary_dim].first
-            || I >= _local_range[_primary_dim].second)
+        if (I < local_range0.first
+            || I >= local_range0.second)
         {
           dolfin_error("SparsityPattern.cpp",
                        "apply changes to sparsity pattern",
                        "Received illegal sparsity pattern entry for row/column %d, not in range [%d, %d]",
-                       I, _local_range[_primary_dim].first,
-                       _local_range[_primary_dim].second);
+                       I, local_range0.first,
+                       local_range0.second);
         }
 
         // Get local I index
         const std::size_t i_index = I - offset0;
 
         // Insert in diagonal or off-diagonal block
-        if (_local_range[primary_codim].first <= J &&
-            J < _local_range[primary_codim].second)
+        if (local_range1.first <= J &&
+            J < local_range1.second)
         {
           dolfin_assert(i_index < diagonal.size());
           diagonal[i_index].insert(J);
@@ -487,12 +597,29 @@ SparsityPattern::diagonal_pattern(Type type) const
   for (std::size_t i = 0; i < diagonal.size(); ++i)
     v[i].insert(v[i].begin(), diagonal[i].begin(), diagonal[i].end());
 
-  if (type == sorted)
+  if (type == Type::sorted)
   {
     for (std::size_t i = 0; i < v.size(); ++i)
       std::sort(v[i].begin(), v[i].end());
   }
 
+  if (full_rows.size() > 0)
+  {
+    const std::size_t local_size0 =
+      _index_maps[_primary_dim]->size(IndexMap::MapSize::OWNED);
+    const std::size_t codim = _primary_dim == 0 ? 1 : 0;
+    const auto range1 = _index_maps[codim]->local_range();
+    for (const auto row : full_rows)
+    {
+      if (row >= local_size0)
+        continue;
+      dolfin_assert(v[row].size() == 0);
+      v[row].reserve(range1.second - range1.first);
+      for (std::size_t J = range1.first; J < range1.second; ++J)
+        v[row].push_back(J);
+    }
+  }
+
   return v;
 }
 //-----------------------------------------------------------------------------
@@ -503,12 +630,32 @@ std::vector<std::vector<std::size_t>>
   for (std::size_t i = 0; i < off_diagonal.size(); ++i)
     v[i].insert(v[i].begin(), off_diagonal[i].begin(), off_diagonal[i].end());
 
-  if (type == sorted)
+  if (type == Type::sorted)
   {
     for (std::size_t i = 0; i < v.size(); ++i)
       std::sort(v[i].begin(), v[i].end());
   }
 
+  if (full_rows.size() > 0)
+  {
+    const std::size_t local_size0 =
+      _index_maps[_primary_dim]->size(IndexMap::MapSize::OWNED);
+    const std::size_t codim = _primary_dim == 0 ? 1 : 0;
+    const auto range1 = _index_maps[codim]->local_range();
+    const std::size_t N1 = _index_maps[codim]->size(IndexMap::MapSize::GLOBAL);
+    for (const auto row : full_rows)
+    {
+      if (row >= local_size0)
+        continue;
+      dolfin_assert(v[row].size() == 0);
+      v[row].reserve(N1 - (range1.second - range1.first));
+      for (std::size_t J = 0; J < range1.first; ++J)
+        v[row].push_back(J);
+      for (std::size_t J = range1.second; J < N1; ++J)
+        v[row].push_back(J);
+    }
+  }
+
   return v;
 }
 //-----------------------------------------------------------------------------
@@ -531,10 +678,8 @@ void SparsityPattern::info_statistics() const
   const std::size_t num_nonzeros_total = num_nonzeros_diagonal
     + num_nonzeros_off_diagonal + num_nonzeros_non_local;
 
-  std::size_t size0 = _local_range[0].second; //- _local_range[0].first;
-  std::size_t size1 = _local_range[1].second; //- _local_range[1].first;
-  size0 = MPI::max(_mpi_comm, size0);
-  size1 = MPI::max(_mpi_comm, size1);
+  std::size_t size0 = _index_maps[0]->size(IndexMap::MapSize::GLOBAL);
+  std::size_t size1 = _index_maps[1]->size(IndexMap::MapSize::GLOBAL);
 
   // Return number of entries
   cout << "Matrix of size " << size0 << " x " << size1 << " has "
@@ -553,7 +698,5 @@ void SparsityPattern::info_statistics() const
          << "%)";
     cout << endl;
   }
-
-  MPI::barrier(MPI_COMM_WORLD);
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/la/SparsityPattern.h b/dolfin/la/SparsityPattern.h
index 1a3d7de..697b9e7 100644
--- a/dolfin/la/SparsityPattern.h
+++ b/dolfin/la/SparsityPattern.h
@@ -23,6 +23,7 @@
 #ifndef __SPARSITY_PATTERN_H
 #define __SPARSITY_PATTERN_H
 
+#include <memory>
 #include <string>
 #include <unordered_map>
 #include <utility>
@@ -31,15 +32,16 @@
 #include <dolfin/common/ArrayView.h>
 #include <dolfin/common/Set.h>
 #include <dolfin/common/types.h>
-#include "GenericSparsityPattern.h"
 
 namespace dolfin
 {
 
-  /// This class implements the GenericSparsityPattern interface.  It
-  /// is used by most linear algebra backends.
+  class IndexMap;
 
-  class SparsityPattern : public GenericSparsityPattern
+  /// This class implements a sparsity pattern data structure.  It is
+  /// used by most linear algebra backends.
+
+  class SparsityPattern
   {
 
     // NOTE: Do not change this typedef without performing careful
@@ -49,41 +51,45 @@ namespace dolfin
 
   public:
 
+    enum class Type {sorted, unsorted};
+
     /// Create empty sparsity pattern
     SparsityPattern(std::size_t primary_dim);
 
     /// Create sparsity pattern for a generic tensor
-    SparsityPattern(
-      const MPI_Comm mpi_comm,
-      const std::vector<std::size_t>& dims,
-      const std::vector<std::pair<std::size_t,
-      std::size_t> >& ownership_range,
-      const std::vector<ArrayView<const std::size_t> >& local_to_global,
-      const std::vector<ArrayView<const int> >& off_process_owner,
-      const std::vector<std::size_t>& block_sizes,
-      const std::size_t primary_dim);
+    SparsityPattern(MPI_Comm mpi_comm,
+                    std::vector<std::shared_ptr<const IndexMap>> index_maps,
+                    std::size_t primary_dim);
 
     /// Initialize sparsity pattern for a generic tensor
-    void init(
-      const MPI_Comm mpi_comm,
-      const std::vector<std::size_t>& dims,
-      const std::vector<std::pair<std::size_t,
-      std::size_t> >& ownership_range,
-      const std::vector<ArrayView<const std::size_t> >& local_to_global,
-      const std::vector<ArrayView<const int> >& off_process_owner,
-      const std::vector<std::size_t>& block_sizes);
+    void init(MPI_Comm mpi_comm,
+              std::vector<std::shared_ptr<const IndexMap>> index_maps);
+
+    /// Insert a global entry - will be fixed by apply()
+    void insert_global(dolfin::la_index i, dolfin::la_index j);
 
     /// Insert non-zero entries using global indices
     void insert_global(const std::vector<
-                       ArrayView<const dolfin::la_index> >& entries);
+                       ArrayView<const dolfin::la_index>>& entries);
 
     /// Insert non-zero entries using local (process-wise) indices
     void insert_local(const std::vector<
-                      ArrayView<const dolfin::la_index> >& entries);
+                      ArrayView<const dolfin::la_index>>& entries);
+
+    /// Insert full rows (or columns, according to primary dimension)
+    /// using local (process-wise) indices. This must be called before
+    /// any other sparse insertion occurs to avoid quadratic complexity
+    /// of dense rows insertion
+    void insert_full_rows_local(const std::vector<std::size_t>& rows);
 
     /// Return rank
     std::size_t rank() const;
 
+    /// Return primary dimension (e.g., 0=row partition, 1=column
+    /// partition)
+    std::size_t primary_dim() const
+    { return _primary_dim; }
+
     /// Return local range for dimension dim
     std::pair<std::size_t, std::size_t> local_range(std::size_t dim) const;
 
@@ -97,7 +103,9 @@ namespace dolfin
 
     /// Fill array with number of nonzeros for off-diagonal block in
     /// local_range for dimension 0. For matrices, fill array with
-    /// number of nonzeros per local row for off-diagonal block
+    /// number of nonzeros per local row for off-diagonal block. If
+    /// there is no off-diagonal pattern, the vector is resized to
+    /// zero-length
     void
       num_nonzeros_off_diagonal(std::vector<std::size_t>& num_nonzeros) const;
 
@@ -117,40 +125,42 @@ namespace dolfin
 
     /// Return underlying sparsity pattern (diagonal). Options are
     /// 'sorted' and 'unsorted'.
-    std::vector<std::vector<std::size_t> > diagonal_pattern(Type type) const;
+    std::vector<std::vector<std::size_t>> diagonal_pattern(Type type) const;
 
     /// Return underlying sparsity pattern (off-diagonal). Options are
-    /// 'sorted' and 'unsorted'.
-    std::vector<std::vector<std::size_t> >
-      off_diagonal_pattern(Type type) const;
+    /// 'sorted' and 'unsorted'. Empty vector is returned if there is no
+    /// off-diagonal contribution.
+    std::vector<std::vector<std::size_t>> off_diagonal_pattern(Type type) const;
 
   private:
 
     // Print some useful information
     void info_statistics() const;
 
+    // Primary sparsity pattern storage dimension (e.g., 0=row
+    // partition, 1=column partition)
+    const std::size_t _primary_dim;
+
     // MPI communicator
     MPI_Comm _mpi_comm;
 
-    // Ownership range for each dimension
-    std::vector<std::pair<std::size_t, std::size_t> > _local_range;
+    // IndexMaps for each dimension
+    std::vector<std::shared_ptr<const IndexMap>> _index_maps;
 
     // Sparsity patterns for diagonal and off-diagonal blocks
     std::vector<set_type> diagonal;
     std::vector<set_type> off_diagonal;
 
+    // List of full rows (or columns, according to primary dimension).
+    // Full rows are kept separately to circumvent quadratic scaling
+    // (caused by linear insertion time into dolfin::Set; std::set has
+    // logarithmic insertion, which would result in N log(N) overall
+    // complexity for dense rows)
+    set_type full_rows;
+
     // Sparsity pattern for non-local entries stored as [i0, j0, i1, j1, ...]
     std::vector<std::size_t> non_local;
 
-    // Array map from un-owned local indices to global indices
-    std::vector<std::vector<std::size_t> > _local_to_global;
-
-    // Map from non-local vertex to owning process index
-    std::vector<std::vector<int> > _off_process_owner;
-
-    // Block size
-    std::vector<std::size_t> _block_size;
-
   };
 
 }
diff --git a/dolfin/la/TensorLayout.cpp b/dolfin/la/TensorLayout.cpp
index 16f34b7..67981cb 100644
--- a/dolfin/la/TensorLayout.cpp
+++ b/dolfin/la/TensorLayout.cpp
@@ -14,88 +14,72 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-02-24
-// Last changed:
+
+#include <memory>
 
 #include <dolfin/log/log.h>
 #include <dolfin/log/LogStream.h>
+#include "IndexMap.h"
 #include "SparsityPattern.h"
 #include "TensorLayout.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-TensorLayout::TensorLayout(std::size_t pdim, bool sparsity_pattern)
-  : primary_dim(pdim), block_size(0), _mpi_comm(MPI_COMM_NULL)
+TensorLayout::TensorLayout(std::size_t pdim, Sparsity sparsity_pattern)
+  : primary_dim(pdim), _mpi_comm(MPI_COMM_NULL)
 {
   // Create empty sparsity pattern
-  if (sparsity_pattern)
-    _sparsity_pattern.reset(new SparsityPattern(primary_dim));
+  if (sparsity_pattern == TensorLayout::Sparsity::SPARSE)
+    _sparsity_pattern = std::make_shared<SparsityPattern>(primary_dim);
 }
 //-----------------------------------------------------------------------------
 TensorLayout::TensorLayout(const MPI_Comm mpi_comm,
-                           const std::vector<std::size_t>& dims,
-                           std::size_t pdim, std::size_t bs,
-                           const std::vector<std::pair<std::size_t,
-                           std::size_t>>& ownership_range,
-                           bool sparsity_pattern)
-  : primary_dim(pdim), block_size(bs), local_to_global_map(dims.size()),
-    _mpi_comm(mpi_comm), _shape(dims), _ownership_range(ownership_range)
+             std::vector<std::shared_ptr<const IndexMap>> index_maps,
+             std::size_t pdim,
+             Sparsity sparsity_pattern,
+             Ghosts ghosted)
+  : primary_dim(pdim), _mpi_comm(mpi_comm), _index_maps(index_maps),
+    _ghosted(ghosted)
 {
-  // Only rank 2 sparsity patterns are supported
-  dolfin_assert(!(sparsity_pattern && dims.size() != 2));
+  if (sparsity_pattern == TensorLayout::Sparsity::SPARSE)
+    _sparsity_pattern = std::make_shared<SparsityPattern>(primary_dim);
 
-  // Check that dimensions match
-  dolfin_assert(dims.size() == ownership_range.size());
-
-  // Create empty sparsity pattern
-  if (sparsity_pattern)
-    _sparsity_pattern.reset(new SparsityPattern(primary_dim));
+  // Only rank 2 sparsity patterns are supported
+  dolfin_assert(!(_sparsity_pattern && index_maps.size() != 2));
 }
 //-----------------------------------------------------------------------------
 void TensorLayout::init(
   const MPI_Comm mpi_comm,
-  const std::vector<std::size_t>& dims, std::size_t bs,
-  const std::vector<std::pair<std::size_t, std::size_t>>& ownership_range)
+  const std::vector<std::shared_ptr<const IndexMap>> index_maps,
+  const Ghosts ghosted)
 {
   // Only rank 2 sparsity patterns are supported
-  dolfin_assert(!(_sparsity_pattern && dims.size() != 2));
+  dolfin_assert(!(_sparsity_pattern && index_maps.size() != 2));
 
-  // Check that dimensions match
-  dolfin_assert(dims.size() == ownership_range.size());
-
-  local_to_global_map.resize(dims.size());
-
-  // Store MPI communicator
+  // Store everything
+  _index_maps = index_maps;
   _mpi_comm = mpi_comm;
-
-  // Store dimensions
-  _shape = dims;
-
-  // Store block size
-  block_size = bs;
-
-  // Store ownership range
-  _ownership_range = ownership_range;
+  _ghosted = ghosted;
 }
 //-----------------------------------------------------------------------------
 std::size_t TensorLayout::rank() const
 {
-  return _shape.size();
+  return _index_maps.size();
 }
 //-----------------------------------------------------------------------------
 std::size_t TensorLayout::size(std::size_t i) const
 {
-  dolfin_assert(i < _shape.size());
-  return _shape[i];
+  dolfin_assert(i < _index_maps.size());
+  return _index_maps[i]->size(IndexMap::MapSize::GLOBAL);
 }
 //-----------------------------------------------------------------------------
 std::pair<std::size_t, std::size_t>
 TensorLayout::local_range(std::size_t dim) const
 {
-  dolfin_assert(dim < 2);
-  return _ownership_range[dim];
+  dolfin_assert(dim < _index_maps.size());
+  return _index_maps[dim]->local_range();
+
 }
 //-----------------------------------------------------------------------------
 std::string TensorLayout::str(bool verbose) const
@@ -104,8 +88,8 @@ std::string TensorLayout::str(bool verbose) const
   s << "<TensorLayout for tensor of rank " << rank() << ">" << std::endl;
   for (std::size_t i = 0; i < rank(); i++)
   {
-    s << " Local range for dim " << i << ": [" << _ownership_range[i].first
-        << ", " << _ownership_range[i].second << ")" << std::endl;
+    s << " Local range for dim " << i << ": [" << local_range(i).first
+      << ", " << local_range(i).second << ")" << std::endl;
   }
   return s.str();
 }
diff --git a/dolfin/la/TensorLayout.h b/dolfin/la/TensorLayout.h
index 4fc0f94..7d0a3b7 100644
--- a/dolfin/la/TensorLayout.h
+++ b/dolfin/la/TensorLayout.h
@@ -21,17 +21,18 @@
 #ifndef __TENSOR_LAYOUT_H
 #define __TENSOR_LAYOUT_H
 
+#include <memory>
 #include <string>
 #include <utility>
 #include <vector>
-#include <memory>
 
 #include "dolfin/common/types.h"
 #include "dolfin/common/MPI.h"
-#include "GenericSparsityPattern.h"
 
 namespace dolfin
 {
+  class IndexMap;
+  class SparsityPattern;
 
   /// This class described the size and possibly the sparsity of a
   /// (sparse) tensor. It is used by the linear algebra backends to
@@ -42,22 +43,23 @@ namespace dolfin
 
   public:
 
+    enum class Sparsity : bool { SPARSE = true, DENSE = false };
+    enum class Ghosts : bool { GHOSTED = true, UNGHOSTED = false };
+
     /// Create empty tensor layout
-    TensorLayout(std::size_t primary_dim, bool sparsity_pattern);
+    TensorLayout(std::size_t primary_dim, Sparsity sparsity_pattern);
 
     /// Create a tensor layout
-    TensorLayout(const MPI_Comm mpi_comm,
-                 const std::vector<std::size_t>& dims,
+    TensorLayout(MPI_Comm mpi_comm,
+                 std::vector<std::shared_ptr<const IndexMap>> index_maps,
                  std::size_t primary_dim,
-                 std::size_t block_size,
-                 const std::vector<std::pair<std::size_t, std::size_t> >& ownership_range,
-                 bool sparsity_pattern);
+                 Sparsity sparsity_pattern,
+                 Ghosts ghosted);
 
     /// Initialize tensor layout
-    void init(const MPI_Comm mpi_comm,
-              const std::vector<std::size_t>& dims,
-              std::size_t block_size,
-              const std::vector<std::pair<std::size_t, std::size_t> >& ownership_range);
+    void init(MPI_Comm mpi_comm,
+              std::vector<std::shared_ptr<const IndexMap>> index_maps,
+              Ghosts ghosted);
 
     /// Return rank
     std::size_t rank() const;
@@ -70,11 +72,11 @@ namespace dolfin
     std::pair<std::size_t, std::size_t> local_range(std::size_t dim) const;
 
     /// Return sparsity pattern (possibly null)
-    std::shared_ptr<GenericSparsityPattern> sparsity_pattern()
+    std::shared_ptr<SparsityPattern> sparsity_pattern()
     { return _sparsity_pattern; }
 
     /// Return sparsity pattern (possibly null), const version
-    std::shared_ptr<const GenericSparsityPattern> sparsity_pattern() const
+    std::shared_ptr<const SparsityPattern> sparsity_pattern() const
     { return _sparsity_pattern; }
 
     /// Return informal string representation (pretty-print)
@@ -83,29 +85,36 @@ namespace dolfin
     /// Primary storage dim (e.g., 0=row major, 1=column major)
     const std::size_t primary_dim;
 
-    /// Dofmap block size, e.g. 3 for 3D elasticity with a suitable
-    /// ordered dofmap
-    std::size_t block_size;
-
     /// Return MPI communicator
     MPI_Comm mpi_comm() const
     { return _mpi_comm; }
 
-    std::vector<std::vector<std::size_t> > local_to_global_map;
+    /// Return IndexMap for dimension
+    std::shared_ptr<const IndexMap> index_map(std::size_t i) const
+    {
+      dolfin_assert(i < _index_maps.size());
+      return _index_maps[i];
+    }
+
+    /// Require ghosts
+    Ghosts is_ghosted() const
+    {
+      return _ghosted;
+    }
 
   private:
 
     // MPI communicator
     MPI_Comm _mpi_comm;
 
-    // Shape of tensor
-    std::vector<std::size_t> _shape;
-
-    // Ownership range for each dimension
-    std::vector<std::pair<std::size_t, std::size_t> > _ownership_range;
+    // Index maps
+    std::vector<std::shared_ptr<const IndexMap>> _index_maps;
 
     // Sparsity pattern
-    std::shared_ptr<GenericSparsityPattern> _sparsity_pattern;
+    std::shared_ptr<SparsityPattern> _sparsity_pattern;
+
+    // Ghosted tensor (typically vector) required
+    Ghosts _ghosted = Ghosts::UNGHOSTED;
 
   };
 
diff --git a/dolfin/la/TpetraFactory.cpp b/dolfin/la/TpetraFactory.cpp
index 7c1afec..7b394af 100644
--- a/dolfin/la/TpetraFactory.cpp
+++ b/dolfin/la/TpetraFactory.cpp
@@ -24,6 +24,7 @@
 #include "TpetraMatrix.h"
 #include "TpetraVector.h"
 #include "TpetraFactory.h"
+#include "Amesos2LUSolver.h"
 
 using namespace dolfin;
 
@@ -31,30 +32,27 @@ using namespace dolfin;
 TpetraFactory TpetraFactory::factory;
 
 //-----------------------------------------------------------------------------
-std::shared_ptr<GenericMatrix> TpetraFactory::create_matrix() const
+std::shared_ptr<GenericMatrix> TpetraFactory::create_matrix(MPI_Comm comm) const
 {
-  std::shared_ptr<GenericMatrix> A(new TpetraMatrix);
-  return A;
+  return std::make_shared<TpetraMatrix>();
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<GenericVector> TpetraFactory::create_vector() const
+std::shared_ptr<GenericVector> TpetraFactory::create_vector(MPI_Comm comm) const
 {
-  std::shared_ptr<GenericVector> x(new TpetraVector);
-  return x;
+  return std::make_shared<TpetraVector>(comm);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<TensorLayout>
 TpetraFactory::create_layout(std::size_t rank) const
 {
-  bool sparsity = false;
+  TensorLayout::Sparsity sparsity = TensorLayout::Sparsity::DENSE;
   if (rank > 1)
-    sparsity = true;
-  std::shared_ptr<TensorLayout> pattern(new TensorLayout(0, sparsity));
-  return pattern;
+    sparsity = TensorLayout::Sparsity::SPARSE;
+  return std::make_shared<TensorLayout>(0, sparsity);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericLinearOperator>
-TpetraFactory::create_linear_operator() const
+TpetraFactory::create_linear_operator(MPI_Comm comm) const
 {
   std::shared_ptr<GenericLinearOperator> A; //(new TpetraLinearOperator);
   dolfin_not_implemented();
@@ -63,20 +61,22 @@ TpetraFactory::create_linear_operator() const
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericLUSolver>
-TpetraFactory::create_lu_solver(std::string method) const
+TpetraFactory::create_lu_solver(MPI_Comm comm, std::string method) const
 {
-  std::shared_ptr<GenericLUSolver> solver; //(new TpetraLUSolver(method));
-  dolfin_not_implemented();
-  return solver;
+  return std::make_shared<Amesos2LUSolver>(method);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<GenericLinearSolver>
-TpetraFactory::create_krylov_solver(std::string method,
+TpetraFactory::create_krylov_solver(MPI_Comm comm,
+                                    std::string method,
                                     std::string preconditioner) const
 {
-  std::shared_ptr<GenericLinearSolver>
-    solver(new BelosKrylovSolver(method, preconditioner));
-  return solver;
+  return std::make_shared<BelosKrylovSolver>(method, preconditioner);
+}
+//-----------------------------------------------------------------------------
+std::map<std::string, std::string> TpetraFactory::lu_solver_methods() const
+{
+  return Amesos2LUSolver::methods();
 }
 //-----------------------------------------------------------------------------
 std::map<std::string, std::string> TpetraFactory::krylov_solver_methods() const
diff --git a/dolfin/la/TpetraFactory.h b/dolfin/la/TpetraFactory.h
index a04dbd7..06c1b9a 100644
--- a/dolfin/la/TpetraFactory.h
+++ b/dolfin/la/TpetraFactory.h
@@ -39,28 +39,31 @@ namespace dolfin
     virtual ~TpetraFactory() {}
 
     /// Create empty matrix
-    std::shared_ptr<GenericMatrix> create_matrix() const;
+    std::shared_ptr<GenericMatrix> create_matrix(MPI_Comm comm) const;
 
     /// Create empty vector
-    std::shared_ptr<GenericVector> create_vector() const;
+    std::shared_ptr<GenericVector> create_vector(MPI_Comm comm) const;
 
     /// Create empty tensor layout
     std::shared_ptr<TensorLayout> create_layout(std::size_t rank) const;
 
     /// Create empty linear operator
-    std::shared_ptr<GenericLinearOperator> create_linear_operator() const;
+    std::shared_ptr<GenericLinearOperator>
+    create_linear_operator(MPI_Comm comm) const;
 
     /// Create LU solver
-    std::shared_ptr<GenericLUSolver> create_lu_solver(std::string method) const;
+    std::shared_ptr<GenericLUSolver> create_lu_solver(MPI_Comm comm,
+                                                      std::string method) const;
 
     /// Create Krylov solver
     std::shared_ptr<GenericLinearSolver>
-    create_krylov_solver(std::string method,
+    create_krylov_solver(MPI_Comm comm,
+                         std::string method,
                          std::string preconditioner) const;
 
     /// Return a list of available LU solver methods
-    //    std::vector<std::pair<std::string, std::string> >
-    //      lu_solver_methods() const;
+    std::map<std::string, std::string>
+      lu_solver_methods() const;
 
     /// Return a list of available Krylov solver methods
     std::map<std::string, std::string>
diff --git a/dolfin/la/TpetraMatrix.cpp b/dolfin/la/TpetraMatrix.cpp
index 65552f7..fa271f9 100644
--- a/dolfin/la/TpetraMatrix.cpp
+++ b/dolfin/la/TpetraMatrix.cpp
@@ -23,12 +23,11 @@
 #include <iostream>
 #include <sstream>
 
-#include <dolfin/log/dolfin_log.h>
+#include <dolfin/log/log.h>
 #include <dolfin/common/Timer.h>
 #include <dolfin/common/MPI.h>
 #include "TpetraVector.h"
 #include "TpetraMatrix.h"
-#include "GenericSparsityPattern.h"
 #include "SparsityPattern.h"
 #include "TensorLayout.h"
 #include "TpetraFactory.h"
@@ -53,11 +52,15 @@ TpetraMatrix::TpetraMatrix(Teuchos::RCP<matrix_type> A) : _matA(A)
 //-----------------------------------------------------------------------------
 TpetraMatrix::TpetraMatrix(const TpetraMatrix& A)
 {
-  if (!A._matA.is_null())
-  {
-    // FIXME - just copy mat and maps
-    dolfin_not_implemented();
-  }
+  // Copy NULL to NULL
+  if(A._matA.is_null())
+    return;
+
+  _matA = A._matA->clone(A._matA->getNode());
+
+  index_map[0] = A.index_map[0];
+  index_map[1] = A.index_map[1];
+
 }
 //-----------------------------------------------------------------------------
 TpetraMatrix::~TpetraMatrix()
@@ -73,55 +76,77 @@ std::shared_ptr<GenericMatrix> TpetraMatrix::copy() const
 void TpetraMatrix::init(const TensorLayout& tensor_layout)
 {
   if (!_matA.is_null())
-    error("TpetraMatrix may not be initialized more than once.");
+  {
+    dolfin_error("TpetraMatrix.h",
+                 "initialize matrix",
+                 "Matrix cannot be initialised more than once");
+  }
 
   // Get global dimensions and local range
   dolfin_assert(tensor_layout.rank() == 2);
-  const std::size_t M = tensor_layout.size(0);
-  const std::size_t N = tensor_layout.size(1);
-  const std::pair<std::size_t, std::size_t> row_range
+
+  const std::pair<std::int64_t, std::int64_t> row_range
     = tensor_layout.local_range(0);
   const std::size_t m = row_range.second - row_range.first;
 
+  const std::pair<std::int64_t, std::int64_t> col_range
+    = tensor_layout.local_range(1);
+  const std::size_t n = col_range.second - col_range.first;
+
   // Get sparsity pattern
-  dolfin_assert(tensor_layout.sparsity_pattern());
-  std::shared_ptr<const GenericSparsityPattern> sparsity_pattern
-    = tensor_layout.sparsity_pattern();
+  auto sparsity_pattern = tensor_layout.sparsity_pattern();
+  dolfin_assert(sparsity_pattern);
 
   // Initialize matrix
-  // Insist on square Matrix for now
-  dolfin_assert(M == N);
 
   // Set up MPI Comm
   Teuchos::RCP<const Teuchos::Comm<int>>
     _comm(new Teuchos::MpiComm<int>(sparsity_pattern->mpi_comm()));
 
   // Save the local row and column mapping, so we can use add_local
-  // and set_local later with off-process entries
-  std::vector<dolfin::la_index> global_indices0
-    (tensor_layout.local_to_global_map[0].begin(),
-     tensor_layout.local_to_global_map[0].end());
-  Teuchos::ArrayView<dolfin::la_index> _global_indices0(global_indices0);
-  _row_map = Teuchos::rcp
+  // later with off-process entries
+
+  // Overlapping RowMap
+  index_map[0] = tensor_layout.index_map(0);
+
+  std::vector<dolfin::la_index> global_indices0(m);
+  for (std::size_t i = 0; i < m; ++i)
+  {
+    global_indices0[i]
+      = tensor_layout.index_map(0)->local_to_global(i);
+  }
+
+  // Non-overlapping RangeMap
+  Teuchos::ArrayView<dolfin::la_index>
+    _global_indices0(global_indices0.data(), m);
+  Teuchos::RCP<const map_type> range_map
     (new map_type(Teuchos::OrdinalTraits<dolfin::la_index>::invalid(),
                   _global_indices0, 0, _comm));
 
-  std::vector<dolfin::la_index> global_indices1
-    (tensor_layout.local_to_global_map[1].begin(),
-     tensor_layout.local_to_global_map[1].end());
-  Teuchos::ArrayView<dolfin::la_index> _global_indices1(global_indices1);
-  _col_map = Teuchos::rcp
+  // Overlapping ColMap
+  index_map[1] = tensor_layout.index_map(1);
+
+  std::vector<dolfin::la_index> global_indices1(n);
+  {
+    for (std::size_t i = 0; i < n; ++i)
+      global_indices1[i]
+        = tensor_layout.index_map(1)->local_to_global(i);
+  }
+
+  // Non-overlapping DomainMap
+  Teuchos::ArrayView<dolfin::la_index>
+    _global_indices1(global_indices1.data(), n);
+  Teuchos::RCP<const map_type> domain_map
     (new map_type(Teuchos::OrdinalTraits<dolfin::la_index>::invalid(),
                   _global_indices1, 0, _comm));
 
-  // Make a Tpetra::CrsGraph of the sparsity_pattern
-  typedef Tpetra::CrsGraph<> graph_type;
   std::vector<std::vector<std::size_t>> pattern_diag
-    = sparsity_pattern->diagonal_pattern(GenericSparsityPattern::unsorted);
+    = sparsity_pattern->diagonal_pattern(SparsityPattern::Type::unsorted);
   std::vector<std::vector<std::size_t>> pattern_off
-    = sparsity_pattern->off_diagonal_pattern(GenericSparsityPattern::unsorted);
+    = sparsity_pattern->off_diagonal_pattern(SparsityPattern::Type::unsorted);
+  const bool has_off_diag = pattern_off.size() > 0;
 
-  dolfin_assert(pattern_diag.size() == pattern_off.size());
+  dolfin_assert(pattern_diag.size() == pattern_off.size() || !has_off_diag);
   dolfin_assert(m == pattern_diag.size());
 
   // Get number of non-zeros per row to allocate storage
@@ -132,28 +157,27 @@ void TpetraMatrix::init(const TensorLayout& tensor_layout)
 
   // Create a non-overlapping "row" map for the graph
   // The column map will be auto-generated from the entries.
-  Teuchos::ArrayView<dolfin::la_index>
-    _global_indices_subset(global_indices0.data(), m);
-  Teuchos::RCP<const map_type> graph_row_map
-    (new map_type(Teuchos::OrdinalTraits<dolfin::la_index>::invalid(),
-                  _global_indices_subset, 0, _comm));
 
   Teuchos::RCP<graph_type> crs_graph
-    (new graph_type(graph_row_map, _nnz, Tpetra::StaticProfile));
+    (new graph_type(range_map, _nnz, Tpetra::StaticProfile));
 
   for (std::size_t i = 0; i != m; ++i)
   {
     std::vector<dolfin::la_index> indices(pattern_diag[i].begin(),
                                           pattern_diag[i].end());
-    indices.insert(indices.end(), pattern_off[i].begin(),
-                   pattern_off[i].end());
+    if (has_off_diag)
+    {
+      indices.insert(indices.end(), pattern_off[i].begin(),
+                     pattern_off[i].end());
+    }
 
     Teuchos::ArrayView<dolfin::la_index> _indices(indices);
-    crs_graph->insertGlobalIndices(tensor_layout.local_to_global_map[0][i],
-                                _indices);
+    crs_graph->insertGlobalIndices
+      ((dolfin::la_index)tensor_layout.index_map(0)->local_to_global(i), _indices);
   }
 
-  crs_graph->fillComplete();
+  crs_graph->fillComplete(domain_map, range_map);
+
   _matA = Teuchos::rcp(new matrix_type(crs_graph));
 }
 //-----------------------------------------------------------------------------
@@ -170,35 +194,49 @@ std::size_t TpetraMatrix::size(std::size_t dim) const
   if (_matA.is_null())
     num_elements = 0;
   else if (dim == 0)
-    num_elements = _matA->getRangeMap()->getGlobalNumElements();
+    num_elements = _matA->getRowMap()->getMaxAllGlobalIndex() + 1;
   else
-    num_elements = _matA->getDomainMap()->getGlobalNumElements();
+    num_elements = _matA->getColMap()->getMaxAllGlobalIndex() + 1;
 
   return num_elements;
 }
 //-----------------------------------------------------------------------------
-std::pair<std::size_t, std::size_t>
+std::pair<std::int64_t, std::int64_t>
 TpetraMatrix::local_range(std::size_t dim) const
 {
+  dolfin_assert(!_matA.is_null());
+
   if (dim == 0)
   {
-    Teuchos::RCP<const map_type> a_row_map(_matA->getRowMap());
-    return std::make_pair<std::size_t, std::size_t>
-      (a_row_map->getMinGlobalIndex(), a_row_map->getMaxGlobalIndex() + 1);
+    // Teuchos::RCP<const map_type> a_row_map(_matA->getRowMap());
+    // return std::make_pair<std::size_t, std::size_t>
+    //   (a_row_map->getMinGlobalIndex(), a_row_map->getMaxGlobalIndex() + 1);
+
+    return index_map[0]->local_range();
   }
   else if (dim == 1)
   {
     // FIXME: this is not quite right - column map will have overlap
-    Teuchos::RCP<const map_type> a_col_map(_matA->getColMap());
-    return std::make_pair<std::size_t, std::size_t>
-      (a_col_map->getMinGlobalIndex(), a_col_map->getMaxGlobalIndex() + 1);
+    // Teuchos::RCP<const map_type> a_col_map(_matA->getColMap());
+    // return std::make_pair<std::size_t, std::size_t>
+    //   (a_col_map->getMinGlobalIndex(), a_col_map->getMaxGlobalIndex() + 1);
+
+    return index_map[1]->local_range();
+  }
+  else
+  {
+    dolfin_error("TpetraMatrix.cpp",
+                 "get local range",
+                 "Dimension invalid");
   }
 
-  return std::make_pair(0,0);
+  return std::make_pair(0, 0);
 }
 //-----------------------------------------------------------------------------
 std::size_t TpetraMatrix::nnz() const
 {
+  dolfin_assert(!_matA.is_null());
+
   std::size_t nnz_local = _matA->getCrsGraph()->getNodeNumEntries();
   return MPI::sum(mpi_comm(), nnz_local);
 }
@@ -217,31 +255,44 @@ void TpetraMatrix::init_vector(GenericVector& z, std::size_t dim) const
 
   Teuchos::RCP<const map_type> _map;
   if (dim == 0)
+  {
     _map =_matA->getRangeMap();
+    dolfin_assert(_map->isOneToOne());
+    _z._x_ghosted = Teuchos::rcp(new TpetraVector::vector_type(_map, 1));
+    dolfin_assert(!_z._x_ghosted.is_null());
+    // Get a modifiable view into the ghosted vector
+    _z._x = _z._x_ghosted->offsetViewNonConst(_map, 0);
+  }
   else if (dim == 1)
+  {
     _map = _matA->getDomainMap();
+    dolfin_assert(_map->isOneToOne());
+    _z._x_ghosted = Teuchos::rcp(new TpetraVector::vector_type(_map, 1));
+    dolfin_assert(!_z._x_ghosted.is_null());
+    // Get a modifiable view into the ghosted vector
+    _z._x = _z._x_ghosted->offsetViewNonConst(_map, 0);
+  }
   else
   {
     dolfin_error("TpetraMatrix.cpp",
                  "initialize Tpetra vector to match Tpetra matrix",
                  "Dimension must be 0 or 1, not %d", dim);
   }
-
-  _z._x = Teuchos::rcp(new TpetraVector::vector_type(_map, 1));
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::get(double* block,
-                      std::size_t m, const dolfin::la_index* rows,
-                      std::size_t n, const dolfin::la_index* cols) const
+                       std::size_t m, const dolfin::la_index* rows,
+                       std::size_t n, const dolfin::la_index* cols) const
 {
   // Get matrix entries (must be on this process)
   dolfin_assert(!_matA.is_null());
 
   for (std::size_t i = 0 ; i != m; ++i)
   {
-    Teuchos::ArrayView<const dolfin::la_index> _columns;
-    Teuchos::ArrayView<const double> _data;
-    _matA->getGlobalRowView(rows[i], _columns, _data);
+    Teuchos::ArrayView<dolfin::la_index> _columns;
+    Teuchos::ArrayView<double> _data;
+    std::size_t n;
+    _matA->getGlobalRowCopy(rows[i], _columns, _data, n);
 
     // FIXME: get desired columns from all columns
   }
@@ -249,8 +300,8 @@ void TpetraMatrix::get(double* block,
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::set(const double* block,
-                      std::size_t m, const dolfin::la_index* rows,
-                      std::size_t n, const dolfin::la_index* cols)
+                       std::size_t m, const dolfin::la_index* rows,
+                       std::size_t n, const dolfin::la_index* cols)
 {
   dolfin_assert(!_matA.is_null());
   dolfin_assert(!_matA->isFillComplete());
@@ -265,8 +316,8 @@ void TpetraMatrix::set(const double* block,
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::set_local(const double* block,
-                            std::size_t m, const dolfin::la_index* rows,
-                            std::size_t n, const dolfin::la_index* cols)
+                             std::size_t m, const dolfin::la_index* rows,
+                             std::size_t n, const dolfin::la_index* cols)
 {
   dolfin_assert(!_matA.is_null());
   dolfin_assert(!_matA->isFillComplete());
@@ -275,7 +326,7 @@ void TpetraMatrix::set_local(const double* block,
   std::vector<dolfin::la_index> _global_col_idx;
   _global_col_idx.reserve(n);
   for (std::size_t i = 0 ; i != n; ++i)
-    _global_col_idx.push_back(_col_map->getGlobalElement(cols[i]));
+    _global_col_idx.push_back(index_map[1]->local_to_global(cols[i]));
   Teuchos::ArrayView<const dolfin::la_index> global_col_idx(_global_col_idx);
 
   for (std::size_t i = 0 ; i != m; ++i)
@@ -283,7 +334,7 @@ void TpetraMatrix::set_local(const double* block,
     Teuchos::ArrayView<const double> data(block + i*n, n);
 
     const dolfin::la_index global_row_idx
-      = _row_map->getGlobalElement(rows[i]);
+      = index_map[0]->local_to_global(rows[i]);
     if (global_row_idx != Teuchos::OrdinalTraits<dolfin::la_index>::invalid())
     {
       std::size_t nvalid = _matA->replaceGlobalValues(global_row_idx,
@@ -296,15 +347,14 @@ void TpetraMatrix::set_local(const double* block,
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::add(const double* block,
-                      std::size_t m, const dolfin::la_index* rows,
-                      std::size_t n, const dolfin::la_index* cols)
+                       std::size_t m, const dolfin::la_index* rows,
+                       std::size_t n, const dolfin::la_index* cols)
 {
   dolfin_assert(!_matA.is_null());
   dolfin_assert(!_matA->isFillComplete());
 
   // Tpetra View of column indices
   Teuchos::ArrayView<const dolfin::la_index> column_idx(cols, n);
-
   for (std::size_t i = 0 ; i != m; ++i)
   {
     Teuchos::ArrayView<const double> data(block + i*n, n);
@@ -313,8 +363,8 @@ void TpetraMatrix::add(const double* block,
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::add_local(const double* block,
-                            std::size_t m, const dolfin::la_index* rows,
-                            std::size_t n, const dolfin::la_index* cols)
+                             std::size_t m, const dolfin::la_index* rows,
+                             std::size_t n, const dolfin::la_index* cols)
 {
   dolfin_assert(!_matA.is_null());
   dolfin_assert(!_matA->isFillComplete());
@@ -323,7 +373,7 @@ void TpetraMatrix::add_local(const double* block,
   std::vector<dolfin::la_index> _global_col_idx;
   _global_col_idx.reserve(n);
   for (std::size_t i = 0 ; i != n; ++i)
-    _global_col_idx.push_back(_col_map->getGlobalElement(cols[i]));
+    _global_col_idx.push_back(index_map[1]->local_to_global(cols[i]));
   Teuchos::ArrayView<const dolfin::la_index> global_col_idx(_global_col_idx);
 
   for (std::size_t i = 0 ; i != m; ++i)
@@ -331,7 +381,7 @@ void TpetraMatrix::add_local(const double* block,
     Teuchos::ArrayView<const double> data(block + i*n, n);
 
     const dolfin::la_index global_row_idx
-      = _row_map->getGlobalElement(rows[i]);
+      = index_map[0]->local_to_global(rows[i]);
     if (global_row_idx != Teuchos::OrdinalTraits<dolfin::la_index>::invalid())
     {
       std::size_t nvalid =
@@ -347,20 +397,18 @@ void TpetraMatrix::add_local(const double* block,
 void TpetraMatrix::axpy(double a, const GenericMatrix& A,
                         bool same_nonzero_pattern)
 {
-  const TpetraMatrix& AA = as_type<const TpetraMatrix>(A);
   dolfin_assert(!_matA.is_null());
+  const TpetraMatrix& AA = as_type<const TpetraMatrix>(A);
   dolfin_assert(!AA._matA.is_null());
 
-  // Make const matrix result (cannot add in place)
-  const Teuchos::RCP<const matrix_type> _matB
-    = Teuchos::rcp_dynamic_cast<const matrix_type>(_matA->add(1.0, *AA._matA, a,
-                                                   Teuchos::null, Teuchos::null, Teuchos::null));
+  double one=1;
 
-  std::cout << _matB->description() << "\n";
+  Teuchos::RCP<const matrix_type> matB
+    = Teuchos::rcp_dynamic_cast<const matrix_type>
+    (_matA->add(a, *AA._matA, one, Teuchos::null,Teuchos::null,Teuchos::null));
 
-  // FIXME: copy result in _matB back into _matA
+  _matA = matB->clone(matB->getNode());
 
-  dolfin_not_implemented();
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::getrow(std::size_t row, std::vector<std::size_t>& columns,
@@ -428,13 +476,16 @@ void TpetraMatrix::zero(std::size_t m, const dolfin::la_index* rows)
 
   for (std::size_t i = 0 ; i != m; ++i)
   {
-    Teuchos::ArrayView<const dolfin::la_index> cols;
-    Teuchos::ArrayView<const double> data;
-    _matA->getGlobalRowView(rows[i], cols, data);
-    std::vector<double> z(cols.size(), 0);
-    Teuchos::ArrayView<const double> dataz(z);
-
-    _matA->replaceGlobalValues(rows[i], cols, dataz);
+    const std::size_t ncols = _matA->getNumEntriesInGlobalRow(rows[i]);
+    std::vector<dolfin::la_index> colcols(ncols);
+    Teuchos::ArrayView<dolfin::la_index> cols(colcols);
+    std::vector<double> coldata(ncols);
+    Teuchos::ArrayView<double> data(coldata);
+    std::size_t n;
+    _matA->getGlobalRowCopy(rows[i], cols, data, n);
+    dolfin_assert(n == ncols);
+    std::fill(coldata.begin(), coldata.end(), 0.0);
+    _matA->replaceGlobalValues(rows[i], cols, data);
   }
 }
 //-----------------------------------------------------------------------------
@@ -445,20 +496,22 @@ void TpetraMatrix::zero_local(std::size_t m, const dolfin::la_index* rows)
 
   for (std::size_t i = 0 ; i != m; ++i)
   {
-    Teuchos::ArrayView<const dolfin::la_index> cols;
+    int row = rows[i];
+    Teuchos::ArrayView<const int> cols;
     Teuchos::ArrayView<const double> data;
-    _matA->getLocalRowView(rows[i], cols, data);
+    _matA->getLocalRowView(row, cols, data);
     std::vector<double> z(cols.size(), 0);
     Teuchos::ArrayView<const double> dataz(z);
 
-    _matA->replaceLocalValues(rows[i], cols, dataz);
+    _matA->replaceLocalValues(row, cols, dataz);
   }
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::ident(std::size_t m, const dolfin::la_index* rows)
 {
   dolfin_assert(!_matA.is_null());
-  dolfin_assert(!_matA->isFillComplete());
+  if(_matA->isFillComplete())
+    _matA->resumeFill();
 
   // Clear affected rows to zero
   zero(m, rows);
@@ -570,24 +623,20 @@ void TpetraMatrix::transpmult(const GenericVector& x, GenericVector& y) const
                  "Vector for transpose matrix-vector result has wrong size");
   }
 
-  _matA->apply(*xx._x, *yy._x, Teuchos::TRANS);
+  _matA->apply(*xx._x, *yy._x_ghosted, Teuchos::TRANS);
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::get_diagonal(GenericVector& x) const
 {
   dolfin_assert(!_matA.is_null());
-  dolfin_assert(!_matA->isFillComplete());
-
-  dolfin_not_implemented();
 
   TpetraVector& xx = x.down_cast<TpetraVector>();
-
-  if (!xx._x->getMap()->isSameAs(*_matA->getRowMap()))
-	{
+  if (!xx._x->getMap()->isSameAs(*_matA->getRangeMap()))
+  {
     dolfin_error("TpetraMatrix.cpp",
                  "get diagonal of a Tpetra matrix",
                  "Matrix and vector ColMaps don't match for matrix-vector set");
-	}
+  }
 
   if (size(1) != size(0) || size(0) != xx.size())
   {
@@ -595,7 +644,7 @@ void TpetraMatrix::get_diagonal(GenericVector& x) const
                  "get diagonal of a Tpetra matrix",
                  "Matrix and vector dimensions don't match for matrix-vector set");
   }
-  
+
   if (xx.vec()->getNumVectors() != 1)
   {
     dolfin_error("TpetraMatrix.cpp",
@@ -603,22 +652,17 @@ void TpetraMatrix::get_diagonal(GenericVector& x) const
                  "Vector is a multivector with %d columns instead of 1", xx.vec()->getNumVectors());
   }
 
-  _matA->getLocalDiagCopy(*(xx.vec()->getVectorNonConst(0)));
+  _matA->getLocalDiagCopy(*(xx._x->getVectorNonConst(0)));
 
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::set_diagonal(const GenericVector& x)
 {
   dolfin_assert(!_matA.is_null());
-  dolfin_assert(!_matA->isFillComplete());
+  if(_matA->isFillComplete())
+    _matA->resumeFill();
 
   const TpetraVector& xx = x.down_cast<TpetraVector>();
-
-  if (xx._x->getMap()->isSameAs(*_matA->getRowMap()))
-    std::cout << "Should be OK\n";
-
-  dolfin_not_implemented();
-
   if (size(1) != size(0) || size(0) != xx.size())
   {
     dolfin_error("TpetraMatrix.cpp",
@@ -626,25 +670,42 @@ void TpetraMatrix::set_diagonal(const GenericVector& x)
                  "Matrix and vector dimensions don't match for matrix-vector set");
   }
 
+  dolfin_assert(xx._x->getMap()->isSameAs(*_matA->getRangeMap()));
+  Teuchos::ArrayRCP<const double> xarr = xx._x->getData(0);
+
+  dolfin::la_index col_idx;
+  double val;
+  Teuchos::ArrayView<const dolfin::la_index> global_col_idx(&col_idx, 1);
+  Teuchos::ArrayView<const double> data(&val, 1);
+
+  auto range = xx.local_range();
+  std::int64_t local_size = range.second - range.first;
+  for (std::int64_t i = 0; i < local_size; ++i)
+  {
+    col_idx = range.first + i;
+    val = xarr[i];
+    std::size_t nvalid = _matA->replaceGlobalValues(col_idx,
+                                                    global_col_idx, data);
+    dolfin_assert(nvalid == 1);
+  }
+
   apply("insert");
 }
 //-----------------------------------------------------------------------------
 double TpetraMatrix::norm(std::string norm_type) const
 {
   dolfin_assert(!_matA.is_null());
-  dolfin_not_implemented();
-
-  // Check that norm is known
-  // if (norm_types.count(norm_type) == 0)
-  // {
-  //   dolfin_error("TpetraMatrix.cpp",
-  //                "compute norm of Tpetra matrix",
-  //                "Unknown norm type (\"%s\")", norm_type.c_str());
-  // }
 
-  double value = 0.0;
+  if (norm_type == "frobenius")
+    return _matA->getFrobeniusNorm();
+  else
+  {
+    dolfin_error("TpetraMatrix.cpp",
+                 "compute norm of Tpetra matrix",
+                 "Unknown norm type (\"%s\")", norm_type.c_str());
+  }
 
-  return value;
+  return 0.0;
 }
 //-----------------------------------------------------------------------------
 void TpetraMatrix::apply(std::string mode)
@@ -652,7 +713,7 @@ void TpetraMatrix::apply(std::string mode)
   Timer timer("Apply (TpetraMatrix)");
 
   dolfin_assert(!_matA.is_null());
-  if (mode == "add" or mode == "insert")
+  if (mode == "add" or mode == "insert" or mode == "flush")
     _matA->fillComplete();
   else
   {
@@ -664,6 +725,7 @@ void TpetraMatrix::apply(std::string mode)
 //-----------------------------------------------------------------------------
 MPI_Comm TpetraMatrix::mpi_comm() const
 {
+  dolfin_assert(!_matA.is_null());
   // Unwrap MPI_Comm
   const Teuchos::RCP<const Teuchos::MpiComm<int>> _mpi_comm
     = Teuchos::rcp_dynamic_cast<const Teuchos::MpiComm<int>>(_matA->getComm());
@@ -674,13 +736,18 @@ MPI_Comm TpetraMatrix::mpi_comm() const
 void TpetraMatrix::zero()
 {
   dolfin_assert(!_matA.is_null());
-  dolfin_assert(!_matA->isFillComplete());
+  if(_matA->isFillComplete())
+    _matA->resumeFill();
+
   _matA->setAllToScalar(0.0);
 }
 //-----------------------------------------------------------------------------
 const TpetraMatrix& TpetraMatrix::operator*= (double a)
 {
   dolfin_assert(!_matA.is_null());
+  if(_matA->isFillComplete())
+    _matA->resumeFill();
+
   _matA->scale(a);
   return *this;
 }
@@ -688,7 +755,9 @@ const TpetraMatrix& TpetraMatrix::operator*= (double a)
 const TpetraMatrix& TpetraMatrix::operator/= (double a)
 {
   dolfin_assert(!_matA.is_null());
-  dolfin_assert(!_matA->isFillComplete());
+  if(_matA->isFillComplete())
+    _matA->resumeFill();
+
   _matA->scale(1.0/a);
   return *this;
 }
diff --git a/dolfin/la/TpetraMatrix.h b/dolfin/la/TpetraMatrix.h
index d97e2a2..4c77ba3 100644
--- a/dolfin/la/TpetraMatrix.h
+++ b/dolfin/la/TpetraMatrix.h
@@ -22,9 +22,11 @@
 
 #ifdef HAS_TRILINOS
 
-#include <map>
+#include <array>
+#include <cstdint>
 #include <memory>
 #include <string>
+#include <utility>
 
 #include <Teuchos_GlobalMPISession.hpp>
 #include <Teuchos_oblackholestream.hpp>
@@ -33,13 +35,16 @@
 #include <Tpetra_Vector.hpp>
 #include <Tpetra_Version.hpp>
 
+#include <dolfin/common/types.h>
 #include "GenericMatrix.h"
 
 namespace dolfin
 {
 
-  class TpetraVector;
+  class GenericLinearAlgebraFactory;
+  class IndexMap;
   class TensorLayout;
+  class TpetraVector;
 
   /// This class provides a simple matrix class based on Tpetra.  It
   /// is a wrapper for a Tpetra matrix pointer
@@ -84,7 +89,7 @@ namespace dolfin
     std::size_t size(std::size_t dim) const;
 
     /// Return local ownership range
-    std::pair<std::size_t, std::size_t> local_range(std::size_t dim) const;
+    std::pair<std::int64_t, std::int64_t> local_range(std::size_t dim) const;
 
     // Number of non-zero entries
     std::size_t nnz() const;
@@ -213,16 +218,12 @@ namespace dolfin
 
   private:
 
-    // Tpetra norm types
-    //    static const std::map<std::string, NormType> norm_types;
-
     // The matrix
     Teuchos::RCP<matrix_type> _matA;
 
     // Row and Column maps to allow local indexing of off-process
     // entries needed in add_local() and set_local()
-    Teuchos::RCP<map_type> _row_map;
-    Teuchos::RCP<map_type> _col_map;
+    std::array<std::shared_ptr<const IndexMap>, 2> index_map;
 
   };
 
diff --git a/dolfin/la/TpetraVector.cpp b/dolfin/la/TpetraVector.cpp
index 1b619cb..d2031c6 100644
--- a/dolfin/la/TpetraVector.cpp
+++ b/dolfin/la/TpetraVector.cpp
@@ -21,19 +21,20 @@
 
 #include <cmath>
 #include <numeric>
+#include <unordered_set>
+
 #include <dolfin/common/Timer.h>
 #include <dolfin/common/Array.h>
 #include <dolfin/common/MPI.h>
 #include <dolfin/common/NoDeleter.h>
 #include <dolfin/common/Set.h>
-#include <dolfin/log/dolfin_log.h>
 #include "TpetraFactory.h"
 #include "TpetraVector.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-TpetraVector::TpetraVector()
+TpetraVector::TpetraVector(MPI_Comm comm)
 {
   // Do nothing
 }
@@ -64,31 +65,46 @@ TpetraVector::~TpetraVector()
 //-----------------------------------------------------------------------------
 void TpetraVector::zero()
 {
-  dolfin_assert(!_x.is_null());
+  dolfin_assert(!_x_ghosted.is_null());
   _x_ghosted->putScalar(0.0);
 }
 //-----------------------------------------------------------------------------
 void TpetraVector::apply(std::string mode)
 {
+  if (mode == "insert")
+  {
+    update_ghost_values();
+    return;
+  }
+  else if (mode != "add")
+  {
+    dolfin_error("TpetraVector.cpp",
+                 "finalise vector",
+                 "Unknown mode \"%s\"", mode.c_str());
+  }
+
   dolfin_assert(!_x.is_null());
-  std::cout << "Apply called with: " << mode << "\n";
 
-  Teuchos::RCP<const map_type> xmap(_x->getMap());
+  Teuchos::RCP<const map_type> xmap = _x->getMap();
   Teuchos::RCP<vector_type> y(new vector_type(xmap, 1));
-  Teuchos::RCP<const map_type> ghostmap(_x_ghosted->getMap());
+  Teuchos::RCP<const map_type> ghostmap = _x_ghosted->getMap();
 
   // Export from overlapping map ghostmap, to non-overlapping xmap
-  Tpetra::Export<dolfin::la_index> exporter(ghostmap, xmap);
+  Tpetra::Export<vector_type::local_ordinal_type,
+                 vector_type::global_ordinal_type,
+                 vector_type::node_type> exporter(ghostmap, xmap);
 
   // Forward export to reduction vector
-  if (mode == "add")
-    y->doExport(*_x_ghosted, exporter, Tpetra::ADD);
-  else if (mode == "insert")
-    y->doExport(*_x_ghosted, exporter, Tpetra::INSERT);
+  y->doExport(*_x_ghosted, exporter, Tpetra::ADD);
 
-  // Copy back into _x
-  std::copy(y->getData(0).begin(), y->getData(0).end(),
-            _x->getDataNonConst(0).begin());
+  // Copy back into _x_ghosted
+  Tpetra::Import<vector_type::local_ordinal_type,
+                 vector_type::global_ordinal_type,
+                 vector_type::node_type> importer(xmap, ghostmap);
+  _x_ghosted->doImport(*y, importer, Tpetra::INSERT);
+
+  //  std::copy(y->getData(0).begin(), y->getData(0).end(),
+  //            _x->getDataNonConst(0).begin());
 }
 //-----------------------------------------------------------------------------
 MPI_Comm TpetraVector::mpi_comm() const
@@ -121,9 +137,9 @@ std::shared_ptr<GenericVector> TpetraVector::copy() const
 //-----------------------------------------------------------------------------
 void TpetraVector::init(MPI_Comm comm, std::size_t N)
 {
-  std::pair<std::size_t, std::size_t> range = MPI::local_range(comm, N);
-    std::vector<dolfin::la_index> local_to_global_map;
-    _init(comm, range, local_to_global_map);
+  const std::pair<std::int64_t, std::int64_t> range = MPI::local_range(comm, N);
+  std::vector<dolfin::la_index> local_to_global_map;
+  _init(comm, range, local_to_global_map);
 }
 //-----------------------------------------------------------------------------
 void TpetraVector::init(MPI_Comm comm,
@@ -145,27 +161,28 @@ void TpetraVector::init(MPI_Comm comm,
 //-----------------------------------------------------------------------------
 bool TpetraVector::empty() const
 {
-  return (size() == 0);
+  return size() == 0;
 }
 //-----------------------------------------------------------------------------
 std::size_t TpetraVector::size() const
 {
   if (_x.is_null())
     return 0;
-  return (_x->getMap()->getMaxAllGlobalIndex() + 1);
+  else
+    return _x->getMap()->getMaxAllGlobalIndex() + 1;
 }
 //-----------------------------------------------------------------------------
 std::size_t TpetraVector::local_size() const
 {
   if (_x.is_null())
     return 0;
-  return _x->getLocalLength();
+  else
+    return _x->getLocalLength();
 }
 //-----------------------------------------------------------------------------
-std::pair<std::size_t, std::size_t> TpetraVector::local_range() const
+std::pair<std::int64_t, std::int64_t> TpetraVector::local_range() const
 {
   dolfin_assert(!_x.is_null());
-
   return std::make_pair(_x->getMap()->getMinGlobalIndex(),
                         _x->getMap()->getMaxGlobalIndex() + 1);
 }
@@ -173,17 +190,15 @@ std::pair<std::size_t, std::size_t> TpetraVector::local_range() const
 bool TpetraVector::owns_index(std::size_t i) const
 {
   dolfin_assert(!_x.is_null());
-
-  std::pair<std::size_t, std::size_t> range = local_range();
-  return (i >= range.first and i < range.second);
+  const std::pair<std::int64_t, std::int64_t> range = local_range();
+  return ((std::int64_t) i >= range.first and (std::int64_t) i < range.second);
 }
 //-----------------------------------------------------------------------------
 void TpetraVector::get(double* block, std::size_t m,
                        const dolfin::la_index* rows) const
 {
   dolfin_assert(!_x_ghosted.is_null());
-
-  Teuchos::RCP<const map_type> xmap(_x_ghosted->getMap());
+  Teuchos::RCP<const map_type> xmap = _x_ghosted->getMap();
   Teuchos::ArrayRCP<const double> xarr = _x_ghosted->getData(0);
   for (std::size_t i = 0; i != m; ++i)
   {
@@ -191,8 +206,10 @@ void TpetraVector::get(double* block, std::size_t m,
     if (idx != Teuchos::OrdinalTraits<int>::invalid())
       block[i] = xarr[idx];
     else
+    {
       dolfin_error("TpetraVector.cpp", "get data",
                    "Row %d not valid", rows[i]);
+    }
   }
 }
 //-----------------------------------------------------------------------------
@@ -204,7 +221,9 @@ void TpetraVector::update_ghost_values()
   Teuchos::RCP<const map_type> ghostmap(_x_ghosted->getMap());
 
   // Export from non-overlapping map x, to overlapping ghostmap
-  Tpetra::Import<dolfin::la_index> importer(xmap, ghostmap);
+  Tpetra::Import<vector_type::local_ordinal_type,
+                 vector_type::global_ordinal_type,
+                 vector_type::node_type> importer(xmap, ghostmap);
 
   // FIXME: is this safe, since _x is a view into _x_ghosted?
   _x_ghosted->doImport(*_x, importer, Tpetra::INSERT);
@@ -224,10 +243,12 @@ void TpetraVector::get_local(double* block, std::size_t m,
     if (_x_ghosted->getMap()->isNodeLocalElement(rows[i]))
       block[i] = arr[rows[i]];
     else
+    {
       dolfin_error("TpetraVector.cpp",
                    "get local row",
                    "Row %d is not local on rank %d", rows[i],
                    _x_ghosted->getMap()->getComm()->getRank());
+    }
   }
 }
 //-----------------------------------------------------------------------------
@@ -250,16 +271,13 @@ void TpetraVector::set(const double* block, std::size_t m,
 void TpetraVector::set_local(const double* block, std::size_t m,
                              const dolfin::la_index* rows)
 {
-  dolfin_assert(!_x_ghosted.is_null());
+  dolfin_assert(!_x.is_null());
   for (std::size_t i = 0; i != m; ++i)
   {
-    if(_x_ghosted->getMap()->isNodeLocalElement(rows[i]))
-      _x_ghosted->replaceLocalValue(rows[i], 0, block[i]);
+    if(_x->getMap()->isNodeLocalElement(rows[i]))
+      _x->replaceLocalValue(rows[i], 0, block[i]);
     else
-    {
-      dolfin_error("TpetraVector.cpp", "set data",
-                   "Row %d not valid", rows[i]);
-    }
+      warning("Not setting on row %d", rows[i]);
   }
 }
 //-----------------------------------------------------------------------------
@@ -272,8 +290,10 @@ void TpetraVector::add(const double* block, std::size_t m,
     if(_x_ghosted->getMap()->isNodeGlobalElement(rows[i]))
       _x_ghosted->sumIntoGlobalValue(rows[i], 0, block[i]);
     else
+    {
       dolfin_error("TpetraVector.cpp", "add into row",
                    "Row %d is not local", rows[i]);
+    }
   }
 }
 //-----------------------------------------------------------------------------
@@ -287,9 +307,11 @@ void TpetraVector::add_local(const double* block, std::size_t m,
     if(_x_ghosted->getMap()->isNodeLocalElement(rows[i]))
       _x_ghosted->sumIntoLocalValue(rows[i], 0, block[i]);
     else
+    {
       dolfin_error("TpetraVector.cpp",
                    "add into local row",
                    "Row %d is not local", rows[i]);
+    }
   }
 }
 //-----------------------------------------------------------------------------
@@ -355,8 +377,11 @@ void TpetraVector::gather(GenericVector& y,
                  "Cannot re-initialize gather vector. Must be empty, or have correct size and be a local vector");
   }
 
-  const Tpetra::Export<dolfin::la_index>
+
+  Tpetra::Export<vector_type::local_ordinal_type,
+                 vector_type::global_ordinal_type, vector_type::node_type>
     exporter(_x->getMap(), _y._x->getMap());
+
   _y._x->doExport(*_x, exporter, Tpetra::INSERT);
 }
 //-----------------------------------------------------------------------------
@@ -373,7 +398,6 @@ void TpetraVector::gather(std::vector<double>& x,
 void TpetraVector::gather_on_zero(std::vector<double>& v) const
 {
   dolfin_assert(!_x.is_null());
-
   if (_x->getMap()->getComm()->getRank() == 0)
     v.resize(size());
   else
@@ -385,10 +409,12 @@ void TpetraVector::gather_on_zero(std::vector<double>& v) const
   Teuchos::RCP<vector_type> y(new vector_type(ymap, 1));
 
   // Export from vector x to vector y
-  const Tpetra::Export<dolfin::la_index>
-    exporter(_x->getMap(), y->getMap());
+  Tpetra::Export<vector_type::local_ordinal_type,
+                 vector_type::global_ordinal_type,
+                 vector_type::node_type> exporter(_x->getMap(), ymap);
+
   y->doExport(*_x, exporter, Tpetra::INSERT);
-  Teuchos::ArrayRCP<const double> yarr(y->getData(0));
+  Teuchos::ArrayRCP<const double> yarr = y->getData(0);
   std::copy(yarr.get(), yarr.get() + v.size(), v.begin());
 }
 //-----------------------------------------------------------------------------
@@ -397,7 +423,7 @@ void TpetraVector::axpy(double a, const GenericVector& y)
   dolfin_assert(!_x_ghosted.is_null());
   const TpetraVector& _y = as_type<const TpetraVector>(y);
   dolfin_assert(!_y._x_ghosted.is_null());
-  _x_ghosted->update(1.0, *_y._x_ghosted, a);
+  _x_ghosted->update(a, *_y._x_ghosted, 1.0);
 }
 //-----------------------------------------------------------------------------
 void TpetraVector::abs()
@@ -410,10 +436,13 @@ void TpetraVector::abs()
 double TpetraVector::inner(const GenericVector& y) const
 {
   dolfin_assert(!_x.is_null());
+
   const TpetraVector& _y = as_type<const TpetraVector>(y);
   dolfin_assert(!_y._x.is_null());
+
   std::vector<double> val(1);
   const Teuchos::ArrayView<double> result(val);
+
   _x->dot(*_y._x, result);
   return val[0];
 }
@@ -422,9 +451,16 @@ double TpetraVector::norm(std::string norm_type) const
 {
   dolfin_assert(!_x.is_null());
   typedef Tpetra::MultiVector<>::mag_type mag_type;
+
   std::vector<mag_type> norms(1);
   const Teuchos::ArrayView<mag_type> norm_view(norms);
-  _x->norm2(norm_view);
+  if (norm_type == "l2")
+    _x->norm2(norm_view);
+  else if (norm_type == "l1")
+    _x->norm1(norm_view);
+  else if (norm_type == "linf")
+    _x->normInf(norm_view);
+
   return norms[0];
 }
 //-----------------------------------------------------------------------------
@@ -432,8 +468,7 @@ double TpetraVector::min() const
 {
   dolfin_assert(!_x.is_null());
   Teuchos::ArrayRCP<const double> arr = _x->getData(0);
-  double min_local
-    = *std::min_element(arr.get(), arr.get() + arr.size());
+  double min_local = *std::min_element(arr.get(), arr.get() + arr.size());
 
   return MPI::min(mpi_comm(), min_local);
 }
@@ -442,8 +477,7 @@ double TpetraVector::max() const
 {
   dolfin_assert(!_x.is_null());
   Teuchos::ArrayRCP<const double> arr = _x->getData(0);
-  double max_local
-    = *std::max_element(arr.get(), arr.get() + arr.size());
+  double max_local = *std::max_element(arr.get(), arr.get() + arr.size());
 
   return MPI::max(mpi_comm(), max_local);
 }
@@ -452,12 +486,8 @@ double TpetraVector::sum() const
 {
   dolfin_assert(!_x.is_null());
 
-  Teuchos::ArrayRCP<const double> arr(_x->getData(0));
-
-  double _sum = 0.0;
-  const std::size_t m = local_size();
-  for (std::size_t i = 0; i != m; ++i)
-    _sum += arr[i];
+  Teuchos::ArrayRCP<const double> arr = _x->getData(0);
+  const double _sum = std::accumulate(arr.begin(), arr.end(), 0.0);
 
   return MPI::sum(mpi_comm(), _sum);
 }
@@ -466,17 +496,35 @@ double TpetraVector::sum(const Array<std::size_t>& rows) const
 {
   dolfin_assert(!_x.is_null());
 
-  // FIXME
+  // FIXME - not working in parallel
+
+  Teuchos::ArrayRCP<const double> arr = _x->getData(0);
 
-  dolfin_not_implemented();
+  std::unordered_set<std::size_t> row_set;
+  double _sum = 0.0;
+  for (std::size_t i = 0; i < rows.size(); ++i)
+  {
+    const std::size_t index = rows[i];
+    dolfin_assert(index < size());
+    if(_x->getMap()->isNodeGlobalElement(index))
+    {
+      if (row_set.find(index) == row_set.end())
+      {
+        const dolfin::la_index lindex
+          = _x->getMap()->getLocalElement(index);
+        _sum += arr[lindex];
+        row_set.insert(index);
+      }
+    }
+  }
 
-  return 0.0;
+  return MPI::sum(mpi_comm(), _sum);
 }
 //-----------------------------------------------------------------------------
 const TpetraVector& TpetraVector::operator*= (double a)
 {
-  dolfin_assert(!_x_ghosted.is_null());
-  _x_ghosted->scale(a);
+  dolfin_assert(!_x.is_null());
+  _x->scale(a);
   return *this;
 }
 //-----------------------------------------------------------------------------
@@ -581,11 +629,15 @@ GenericLinearAlgebraFactory& TpetraVector::factory() const
 //-----------------------------------------------------------------------------
 void
 TpetraVector::_init(MPI_Comm comm,
-                    std::pair<std::size_t, std::size_t> local_range,
+                    std::pair<std::int64_t, std::int64_t> local_range,
                     const std::vector<dolfin::la_index>& local_to_global_map)
 {
   if (!_x.is_null())
-    error("TpetraVector cannot be initialized more than once.");
+  {
+    dolfin_error("TpetraVector.h",
+                 "initialize vector",
+                 "Vector cannot be initialised more than once");
+  }
 
   // Make a Trilinos version of the MPI Comm
   Teuchos::RCP<const Teuchos::Comm<int>> _comm(new Teuchos::MpiComm<int>(comm));
@@ -651,6 +703,11 @@ void TpetraVector::mapdump(Teuchos::RCP<const map_type> xmap,
   }
   ss << "\n";
 
+  for (std::size_t j = 0; j != xmap->getNodeNumElements(); ++j)
+    ss << j << " -> " << xmap->getGlobalElement(j) << "\n";
+  ss << "\n";
+
+
   const Teuchos::RCP<const Teuchos::MpiComm<int>> _mpi_comm
     = Teuchos::rcp_dynamic_cast<const Teuchos::MpiComm<int>>(xmap()->getComm());
 
diff --git a/dolfin/la/TpetraVector.h b/dolfin/la/TpetraVector.h
index f4e501e..6f74d00 100644
--- a/dolfin/la/TpetraVector.h
+++ b/dolfin/la/TpetraVector.h
@@ -21,6 +21,7 @@
 
 #ifdef HAS_TRILINOS
 
+#include <cstdint>
 #include <map>
 #include <memory>
 #include <string>
@@ -34,7 +35,6 @@
 #include <Tpetra_Version.hpp>
 
 #include <dolfin/common/types.h>
-#include <dolfin/log/dolfin_log.h>
 #include "GenericVector.h"
 
 namespace dolfin
@@ -61,13 +61,13 @@ namespace dolfin
     vector_type;
 
     /// Create empty vector
-    TpetraVector();
+    TpetraVector(MPI_Comm comm=MPI_COMM_WORLD);
 
     /// Create vector of size N
     TpetraVector(MPI_Comm comm, std::size_t N);
 
     /// Create vector
-    //explicit TpetraVector(const GenericSparsityPattern& sparsity_pattern);
+    //explicit TpetraVector(const SparsityPattern& sparsity_pattern);
 
     /// Copy constructor
     TpetraVector(const TpetraVector& x);
@@ -124,7 +124,7 @@ namespace dolfin
     virtual std::size_t local_size() const;
 
     /// Return ownership range of a vector
-    virtual std::pair<std::size_t, std::size_t> local_range() const;
+    virtual std::pair<std::int64_t, std::int64_t> local_range() const;
 
     /// Determine whether global vector index is owned by this process
     virtual bool owns_index(std::size_t i) const;
@@ -255,7 +255,7 @@ namespace dolfin
   private:
 
     // Initialise Tpetra vector
-    void _init(MPI_Comm comm, std::pair<std::size_t, std::size_t> range,
+    void _init(MPI_Comm comm, std::pair<std::int64_t, std::int64_t> range,
                const std::vector<dolfin::la_index>& local_to_global);
 
     // Tpetra multivector - actually a view into the ghosted vector,
diff --git a/dolfin/la/TrilinosParameters.cpp b/dolfin/la/TrilinosParameters.cpp
new file mode 100644
index 0000000..730ee22
--- /dev/null
+++ b/dolfin/la/TrilinosParameters.cpp
@@ -0,0 +1,82 @@
+// Copyright (C) 2015 Chris Richardson
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#ifdef HAS_TRILINOS
+
+#include "TrilinosParameters.h"
+
+using namespace dolfin;
+//-----------------------------------------------------------------------------
+void TrilinosParameters::insert_parameters(const Parameters& params,
+                  Teuchos::RCP<Teuchos::ParameterList> parameter_list)
+{
+  // Get keys of Parameter in params
+  std::vector<std::string> keys;
+  params.get_parameter_keys(keys);
+
+  for (auto &k : keys)
+  {
+    // Replace "_" with " " in parameter key
+    // because dolfin parameters cannot have spaces in the key name
+    std::string trilinos_key = k;
+    for (auto &c : trilinos_key)
+      if (c == '_')
+        c = ' ';
+
+    const std::string type = params[k].type_str();
+
+    if (type == "int")
+      parameter_list->set(trilinos_key, int(params[k]));
+    else if (type == "double")
+      parameter_list->set(trilinos_key, double(params[k]));
+    else if (type == "bool")
+      parameter_list->set(trilinos_key, bool(params[k]));
+    else if (type == "string")
+      parameter_list->set(trilinos_key, std::string(params[k]));
+    else
+    {
+      dolfin_error("TrilinosParameters.cpp",
+                   "set parameter",
+                   "Cannot parse type \"%s\"", type.c_str());
+    }
+  }
+
+  // Get keys of any parameter subsets in the dolfin parameters
+  keys.clear();
+  params.get_parameter_set_keys(keys);
+  for (auto &k : keys)
+  {
+    // Replace "_" with " " in parameter key
+    // because dolfin parameters cannot have spaces in the key name
+    std::string trilinos_key = k;
+    for (auto &c : trilinos_key)
+      if (c == '_')
+        c = ' ';
+
+    // Create a new ParameterList
+    Teuchos::RCP<Teuchos::ParameterList>
+      sub_parameter_list(new Teuchos::ParameterList(trilinos_key));
+    // Recursively call to add parameters
+    insert_parameters(params(k), sub_parameter_list);
+
+    parameter_list->set(trilinos_key, *sub_parameter_list);
+
+  }
+}
+//-----------------------------------------------------------------------------
+#endif
diff --git a/dolfin/generation/UnitQuadMesh.h b/dolfin/la/TrilinosParameters.h
similarity index 63%
copy from dolfin/generation/UnitQuadMesh.h
copy to dolfin/la/TrilinosParameters.h
index d978ef0..28ec410 100644
--- a/dolfin/generation/UnitQuadMesh.h
+++ b/dolfin/la/TrilinosParameters.h
@@ -16,30 +16,32 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 
-#ifndef __UNITQUADMESH_MESH_H
-#define __UNITQUADMESH_MESH_H
+#ifndef __DOLFIN_TRILINOS_PARAMETERS_H
+#define __DOLFIN_TRILINOS_PARAMETERS_H
 
-#include <string>
-#include <dolfin/common/MPI.h>
-#include <dolfin/mesh/Mesh.h>
+#ifdef HAS_TRILINOS
+
+#include <dolfin/parameter/Parameters.h>
+
+#include <Teuchos_ParameterList.hpp>
 
 namespace dolfin
 {
 
-  /// NB: this code is experimental, just for testing, and will generally not
-  /// work with anything else
 
-  class UnitQuadMesh : public Mesh
+  class TrilinosParameters
   {
-  public:
 
+  public:
 
-    /// NB: this code is experimental, just for testing, and will generally not
-    /// work with anything else
-    UnitQuadMesh(std::size_t nx, std::size_t ny);
+    /// Copy over parameters from a dolfin Parameters object to a Teuchos::ParameterList
+    static void insert_parameters(const Parameters& params,
+                             Teuchos::RCP<Teuchos::ParameterList> parameter_list);
 
   };
 
 }
 
 #endif
+
+#endif
diff --git a/dolfin/la/TrilinosPreconditioner.h b/dolfin/la/TrilinosPreconditioner.h
index ed8aab9..2fe4bd2 100644
--- a/dolfin/la/TrilinosPreconditioner.h
+++ b/dolfin/la/TrilinosPreconditioner.h
@@ -21,20 +21,28 @@
 #ifndef __TRILINOS_PRECONDITIONER_H
 #define __TRILINOS_PRECONDITIONER_H
 
-#include "GenericPreconditioner.h"
+#ifdef HAS_TRILINOS
 
+#include <memory>
 
 namespace dolfin
 {
 
   class BelosKrylovSolver;
+  class TpetraMatrix;
 
   /// This class provides a common base for Trilinos preconditioners.
 
-  class TrilinosPreconditioner: public GenericPreconditioner
+  class TrilinosPreconditioner
   {
   public:
 
+    TrilinosPreconditioner()
+    {}
+
+    ~TrilinosPreconditioner()
+    {}
+
     // Set this preconditioner on a solver
     virtual void set(BelosKrylovSolver& solver) = 0;
 
@@ -45,3 +53,5 @@ namespace dolfin
 }
 
 #endif
+
+#endif
diff --git a/dolfin/la/Vector.h b/dolfin/la/Vector.h
index 21aed8d..d8f721b 100644
--- a/dolfin/la/Vector.h
+++ b/dolfin/la/Vector.h
@@ -46,17 +46,17 @@ namespace dolfin
   public:
 
     /// Create empty vector
-    Vector()
+    Vector(MPI_Comm comm=MPI_COMM_WORLD)
     {
       DefaultFactory factory;
-      vector = factory.create_vector();
+      vector = factory.create_vector(comm);
     }
 
     /// Create vector of size N
     Vector(MPI_Comm comm, std::size_t N)
     {
       DefaultFactory factory;
-      vector = factory.create_vector();
+      vector = factory.create_vector(comm);
       vector->init(comm, N);
     }
 
@@ -125,7 +125,7 @@ namespace dolfin
     { return vector->local_size(); }
 
     /// Return local ownership range of a vector
-    virtual std::pair<std::size_t, std::size_t> local_range() const
+    virtual std::pair<std::int64_t, std::int64_t> local_range() const
     { return vector->local_range(); }
 
     /// Determine whether global vector index is owned by this process
diff --git a/dolfin/la/VectorSpaceBasis.cpp b/dolfin/la/VectorSpaceBasis.cpp
index fd375d0..f74b9ab 100644
--- a/dolfin/la/VectorSpaceBasis.cpp
+++ b/dolfin/la/VectorSpaceBasis.cpp
@@ -20,6 +20,7 @@
 
 #include <cmath>
 #include <dolfin/common/constants.h>
+#include "GenericVector.h"
 #include "VectorSpaceBasis.h"
 
 using namespace dolfin;
@@ -31,7 +32,32 @@ VectorSpaceBasis::VectorSpaceBasis(const std::vector<std::shared_ptr<
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-bool VectorSpaceBasis::is_orthonormal() const
+void VectorSpaceBasis::orthonormalize(double tol)
+{
+  // Loop over each vector in basis
+  for (std::size_t i = 0; i < _basis.size(); ++i)
+  {
+    // Orthogonalize vector i with respect to previously
+    // orthonormalized vectors
+    for (std::size_t j = 0; j < i; ++j)
+    {
+      const double dot_ij = _basis[i]->inner(*_basis[j]);
+      _basis[i]->axpy(-dot_ij, *_basis[j]);
+    }
+
+    if (_basis[i]->norm("l2") < tol)
+    {
+      dolfin_error("VectorSpaceBasis.cpp",
+                   "orthonormalize vector basis",
+                   "Vector space has linear dependency");
+    }
+
+    // Normalise basis function
+    (*_basis[i]) /= _basis[i]->norm("l2");
+  }
+}
+//-----------------------------------------------------------------------------
+bool VectorSpaceBasis::is_orthonormal(double tol) const
 {
   for (std::size_t i = 0; i < _basis.size(); i++)
   {
@@ -41,7 +67,7 @@ bool VectorSpaceBasis::is_orthonormal() const
       dolfin_assert(_basis[j]);
       const double delta_ij = (i == j) ? 1.0 : 0.0;
       const double dot_ij = _basis[i]->inner(*_basis[j]);
-      if (std::abs(delta_ij - dot_ij) > DOLFIN_EPS)
+      if (std::abs(delta_ij - dot_ij) > tol)
         return false;
     }
   }
@@ -49,7 +75,7 @@ bool VectorSpaceBasis::is_orthonormal() const
   return true;
 }
 //-----------------------------------------------------------------------------
-bool VectorSpaceBasis::is_orthogonal() const
+bool VectorSpaceBasis::is_orthogonal(double tol) const
 {
   for (std::size_t i = 0; i < _basis.size(); i++)
   {
@@ -60,7 +86,7 @@ bool VectorSpaceBasis::is_orthogonal() const
       if (i != j)
       {
         const double dot_ij = _basis[i]->inner(*_basis[j]);
-        if (std::abs(dot_ij) > DOLFIN_EPS)
+        if (std::abs(dot_ij) > tol)
           return false;
       }
     }
diff --git a/dolfin/la/VectorSpaceBasis.h b/dolfin/la/VectorSpaceBasis.h
index 97257dc..e88da81 100644
--- a/dolfin/la/VectorSpaceBasis.h
+++ b/dolfin/la/VectorSpaceBasis.h
@@ -21,13 +21,15 @@
 #ifndef __VECTOR_SPACE_BASIS_H
 #define __VECTOR_SPACE_BASIS_H
 
-#include <vector>
 #include <memory>
-#include "GenericVector.h"
+#include <vector>
+
 
 namespace dolfin
 {
 
+  class GenericVector;
+
   /// This class defines a basis for vector spaces,
   /// typically used for expressing nullspaces, transpose nullspaces
   /// and near nullspaces of singular operators
@@ -37,21 +39,26 @@ namespace dolfin
   public:
 
     /// Constructor
-    VectorSpaceBasis(const std::vector<std::shared_ptr<GenericVector> > basis);
+    VectorSpaceBasis(const std::vector<std::shared_ptr<GenericVector>> basis);
 
     /// Destructor
     ~VectorSpaceBasis() {}
 
+    /// Apply the Gram-Schmidt process to orthonormalize the
+    /// basis. Throws an error if a (near) linear dependency is
+    /// detected. Error is thrown if <x_i, x_i> < tol.
+    void orthonormalize(double tol=1.0e-10);
+
     /// Test if basis is orthonormal
-    bool is_orthonormal() const;
+    bool is_orthonormal(double tol=1.0e-10) const;
 
     /// Test if basis is orthogonal
-    bool is_orthogonal() const;
+    bool is_orthogonal(double tol=1.0e-10) const;
 
     /// Orthogonalize x with respect to basis
     void orthogonalize(GenericVector& x) const;
 
-    /// Dimension of the basis
+    /// Number of vectors in the basis
     std::size_t dim() const;
 
     /// Get a particular basis vector
@@ -60,7 +67,7 @@ namespace dolfin
   private:
 
     // Basis vectors
-    const std::vector<std::shared_ptr<GenericVector> > _basis;
+    const std::vector<std::shared_ptr<GenericVector>> _basis;
 
   };
 }
diff --git a/dolfin/la/dolfin_la.h b/dolfin/la/dolfin_la.h
index 7adfa08..d24e134 100644
--- a/dolfin/la/dolfin_la.h
+++ b/dolfin/la/dolfin_la.h
@@ -10,12 +10,10 @@
 
 #include <dolfin/la/GenericTensor.h>
 #include <dolfin/la/GenericMatrix.h>
-#include <dolfin/la/GenericSparsityPattern.h>
 #include <dolfin/la/GenericVector.h>
 #include <dolfin/la/VectorSpaceBasis.h>
 #include <dolfin/la/GenericLinearSolver.h>
 #include <dolfin/la/GenericLUSolver.h>
-#include <dolfin/la/GenericPreconditioner.h>
 
 #include <dolfin/la/PETScOptions.h>
 #include <dolfin/la/PETScObject.h>
@@ -33,10 +31,10 @@
 #include <dolfin/la/PETScKrylovSolver.h>
 #include <dolfin/la/PETScLUSolver.h>
 #include <dolfin/la/BelosKrylovSolver.h>
-#include <dolfin/la/MUMPSLUSolver.h>
-#include <dolfin/la/PaStiXLUSolver.h>
+#include <dolfin/la/TrilinosPreconditioner.h>
+#include <dolfin/la/MueluPreconditioner.h>
+#include <dolfin/la/Ifpack2Preconditioner.h>
 
-#include <dolfin/la/STLMatrix.h>
 #include <dolfin/la/CoordinateMatrix.h>
 #include <dolfin/la/EigenVector.h>
 #include <dolfin/la/PETScVector.h>
@@ -45,12 +43,14 @@
 #include <dolfin/la/TensorLayout.h>
 #include <dolfin/la/SparsityPattern.h>
 
+#include <dolfin/la/IndexMap.h>
+
 #include <dolfin/la/GenericLinearAlgebraFactory.h>
 #include <dolfin/la/DefaultFactory.h>
 #include <dolfin/la/EigenFactory.h>
 #include <dolfin/la/PETScUserPreconditioner.h>
 #include <dolfin/la/PETScFactory.h>
-#include <dolfin/la/STLFactory.h>
+#include <dolfin/la/TpetraFactory.h>
 #include <dolfin/la/SLEPcEigenSolver.h>
 #include <dolfin/la/Vector.h>
 #include <dolfin/la/Matrix.h>
diff --git a/dolfin/la/solve.cpp b/dolfin/la/solve.cpp
index 35a1c18..480ea3a 100644
--- a/dolfin/la/solve.cpp
+++ b/dolfin/la/solve.cpp
@@ -44,7 +44,7 @@ std::size_t dolfin::solve(const GenericLinearOperator& A,
                           std::string preconditioner)
 {
   Timer timer("Solving linear system");
-  LinearSolver solver(method, preconditioner);
+  LinearSolver solver(x.mpi_comm(), method, preconditioner);
   return solver.solve(A, x, b);
 }
 //-----------------------------------------------------------------------------
@@ -164,7 +164,7 @@ double dolfin::residual(const GenericLinearOperator& A,
                         const GenericVector& x,
                         const GenericVector& b)
 {
-  std::shared_ptr<GenericVector> y = x.factory().create_vector();
+  std::shared_ptr<GenericVector> y = x.factory().create_vector(x.mpi_comm());
   A.mult(x, *y);
   *y -= b;
   return y->norm("l2");
@@ -218,10 +218,16 @@ bool dolfin::has_linear_algebra_backend(std::string backend)
     return false;
     #endif
   }
-  else if (backend == "STL")
+  else if (backend == "Tpetra")
+  {
+    #ifdef HAS_TRILINOS
     return true;
-
-  return false;
+    #else
+    return false;
+    #endif
+  }
+  else
+    return false;
 }
 //-------------------------------------------------------------------------
 void dolfin::list_linear_algebra_backends()
@@ -252,8 +258,6 @@ std::map<std::string, std::string> dolfin::linear_algebra_backends()
   backends.insert(std::make_pair("Eigen",
                                  "Template-based linear algebra "
                                  " library" + default_backend["Eigen"]));
-  backends.insert(std::make_pair("STL",
-                                 "Light weight storage backend for Tensors"));
 
   #ifdef HAS_PETSC
   backends.insert(std::make_pair("PETSc",
@@ -261,6 +265,11 @@ std::map<std::string, std::string> dolfin::linear_algebra_backends()
                                  " library" + default_backend["PETSc"]));
   #endif
 
+  #ifdef HAS_TRILINOS
+  backends.insert(std::make_pair("Tpetra",
+    "Powerful MPI parallel linear algebra library"));
+  #endif
+
   return backends;
 }
 //-------------------------------------------------------------------------
diff --git a/dolfin/la/test_nullspace.cpp b/dolfin/la/test_nullspace.cpp
index 72b72fb..d1d5878 100644
--- a/dolfin/la/test_nullspace.cpp
+++ b/dolfin/la/test_nullspace.cpp
@@ -40,7 +40,7 @@ bool dolfin::in_nullspace(const GenericLinearOperator& A,
   // Get factory and create vector for LHS
   dolfin_assert(basis[0]);
   GenericLinearAlgebraFactory& factory = basis[0]->factory();
-  std::shared_ptr<GenericVector> y = factory.create_vector();
+  std::shared_ptr<GenericVector> y = factory.create_vector(basis[0]->mpi_comm());
 
   const GenericMatrix* _A = NULL;
   if (type == "right")
diff --git a/dolfin/log/LogManager.h b/dolfin/log/LogManager.h
index 11e45bc..12bdbfe 100644
--- a/dolfin/log/LogManager.h
+++ b/dolfin/log/LogManager.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2007 Anders Logg
+// Copyright (C) 2003-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -18,7 +18,7 @@
 // Thanks to Jim Tilander for many helpful hints.
 //
 // First added:  2003-03-13
-// Last changed: 2007-05-11
+// Last changed: 2016-06-10
 
 #ifndef __LOG_MANAGER_H
 #define __LOG_MANAGER_H
diff --git a/dolfin/log/LogStream.cpp b/dolfin/log/LogStream.cpp
index 49a443e..a8805b4 100644
--- a/dolfin/log/LogStream.cpp
+++ b/dolfin/log/LogStream.cpp
@@ -16,9 +16,6 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // Modified by Garth N. Wells, 2009.
-//
-// First added:  2003-03-13
-// Last changed: 2009-09-08
 
 #include <dolfin/common/constants.h>
 #include <dolfin/common/Variable.h>
@@ -32,8 +29,8 @@
 using namespace dolfin;
 
 // Definition of the global dolfin::cout and dolfin::endl variables
-LogStream dolfin::cout(LogStream::COUT);
-LogStream dolfin::endl(LogStream::ENDL);
+LogStream dolfin::cout(LogStream::Type::COUT);
+LogStream dolfin::endl(LogStream::Type::ENDL);
 
 //-----------------------------------------------------------------------------
 LogStream::LogStream(Type type) : _type(type)
@@ -48,7 +45,7 @@ LogStream::~LogStream()
 //-----------------------------------------------------------------------------
 LogStream& LogStream::operator<< (const LogStream& stream)
 {
-  if (stream._type == ENDL)
+  if (stream._type == Type::ENDL)
   {
     // Send buffer to log system
     info(buffer.str());
diff --git a/dolfin/log/LogStream.h b/dolfin/log/LogStream.h
index 1c08d83..aedb58f 100644
--- a/dolfin/log/LogStream.h
+++ b/dolfin/log/LogStream.h
@@ -16,9 +16,6 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // Modified by Garth N. Wells 2005.
-//
-// First added:  2003-03-13
-// Last changed: 2009-08-11
 
 #ifndef __LOG_STREAM_H
 #define __LOG_STREAM_H
@@ -44,7 +41,7 @@ namespace dolfin
   public:
 
     /// Stream types
-    enum Type {COUT, ENDL};
+    enum class Type {COUT, ENDL};
 
     /// Create log stream of given type
     LogStream(Type type);
@@ -79,7 +76,8 @@ namespace dolfin
     /// Output for variable (calling str() method)
     LogStream& operator<< (const Variable& variable);
 
-    /// Output for mesh entity (not subclass of Variable for efficiency)
+    /// Output for mesh entity (not subclass of Variable for
+    /// efficiency)
     LogStream& operator<< (const MeshEntity& entity);
 
     /// Output for point (not subclass of Variable for efficiency)
diff --git a/dolfin/log/Logger.cpp b/dolfin/log/Logger.cpp
index 4a8fe0b..3c286fc 100644
--- a/dolfin/log/Logger.cpp
+++ b/dolfin/log/Logger.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2012 Anders Logg
+// Copyright (C) 2003-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -19,21 +19,19 @@
 // Modified by Garth N. Wells, 2011.
 //
 // First added:  2003-03-13
-// Last changed: 2013-11-15
+// Last changed: 2016-06-10
 
 
 #include <fstream>
+#include <functional>
 #include <iomanip>
 #include <iostream>
 #include <sstream>
 #include <stdexcept>
 #include <string>
+#include <thread>
 #include <unistd.h>
 
-#include <boost/bind.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/thread.hpp>
-
 #ifdef __linux__
 #include <sys/types.h>
 #include <unistd.h>
@@ -53,7 +51,7 @@ using namespace dolfin;
 #ifdef __linux__
 void _monitor_memory_usage(dolfin::Logger* logger)
 {
-  assert(logger);
+  dolfin_assert(logger);
 
   // Open statm
   //std::fstream
@@ -76,7 +74,7 @@ void _monitor_memory_usage(dolfin::Logger* logger)
   while (true)
   {
     // Sleep for a while
-    boost::this_thread::sleep(boost::posix_time::seconds(1));
+    std::this_thread::sleep_for(std::chrono::seconds(1));
 
     // Read number of pages from statm
     statm.open(filename.str().c_str());
@@ -161,7 +159,7 @@ void Logger::dolfin_error(std::string location,
     << "*** using the information listed below, you can ask for help at"
     << std::endl
     << "***" << std::endl
-    << "***     fenics at fenicsproject.org"
+    << "***     fenics-support at googlegroups.com"
     << std::endl
     << "***" << std::endl
     << "*** Remember to include the error message listed below and, if possible,"
@@ -189,16 +187,15 @@ void Logger::dolfin_error(std::string location,
 //-----------------------------------------------------------------------------
 void Logger::deprecation(std::string feature,
                          std::string version_deprecated,
-                         std::string version_remove,
                          std::string message) const
 {
   std::stringstream s;
   s << "*** "
     << "-------------------------------------------------------------------------"
     << std::endl
-    << "*** Warning: " << feature << " has been deprecated in DOLFIN version "
+    << "*** Warning: " << feature << " has been deprecated in FEniCS version "
     << version_deprecated << "." << std::endl
-    << "*** It will be removed from version " << version_remove << "."
+    << "*** It will (likely) be removed in the next FEniCS release."
     << std::endl
     << "*** " << message << std::endl
     << "*** "
@@ -292,15 +289,6 @@ void Logger::register_timing(std::string task,
   }
 }
 //-----------------------------------------------------------------------------
-void Logger::list_timings(bool reset)
-{
-  deprecation("dolfin::list_timings(bool)", "1.6.0", "1.7.0",
-              "The method is replaced by another Logger::list_timings(...), "
-              "e.g, 'list_timings(TimingClear_keep, [TimingType_wall])'");
-  list_timings(static_cast<TimingClear>(reset),
-               std::set<TimingType>({ TimingType::wall }));
-}
-//-----------------------------------------------------------------------------
 void Logger::list_timings(TimingClear clear, std::set<TimingType> type)
 {
   // Format and reduce to rank 0
@@ -413,7 +401,7 @@ void Logger::monitor_memory_usage()
   }
 
   // Create thread
-  _thread_monitor_memory_usage.reset(new boost::thread(boost::bind(&_monitor_memory_usage, this)));
+  _thread_monitor_memory_usage.reset(new std::thread(std::bind(&_monitor_memory_usage, this)));
 
   #endif
 }
diff --git a/dolfin/log/Logger.h b/dolfin/log/Logger.h
index d2cceba..aac089f 100644
--- a/dolfin/log/Logger.h
+++ b/dolfin/log/Logger.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2013 Anders Logg, 2015 Jan Blechta
+// Copyright (C) 2003-2016 Anders Logg, 2015 Jan Blechta
 //
 // This file is part of DOLFIN.
 //
@@ -27,6 +27,7 @@
 #include <ostream>
 #include <string>
 #include <set>
+#include <thread>
 #include <tuple>
 
 #include <dolfin/common/timing.h>
@@ -34,9 +35,6 @@
 #include "Table.h"
 #include "LogLevel.h"
 
-// Forward declarations
-namespace boost { class thread; }
-
 namespace dolfin
 {
 
@@ -71,7 +69,6 @@ namespace dolfin
     /// Issue deprecation warning for removed feature
     void deprecation(std::string feature,
                      std::string version_deprecated,
-                     std::string version_remove,
                      std::string message) const;
 
     /// Begin task (increase indentation level)
@@ -109,11 +106,6 @@ namespace dolfin
     /// stored timings
     Table timings(TimingClear clear, std::set<TimingType> type);
 
-    /// **DEPRECATED**: List a summary of timings and tasks, optionally clearing
-    /// stored timings. ``MPI_AVG`` reduction is printed. Collective on
-    /// ``Logger::mpi_comm()``. Only wall time is printed.
-    void list_timings(bool reset=false);
-
     /// List a summary of timings and tasks, optionally clearing stored timings.
     /// ``MPI_AVG`` reduction is printed. Collective on ``Logger::mpi_comm()``.
     void list_timings(TimingClear clear, std::set<TimingType> type);
@@ -167,11 +159,11 @@ namespace dolfin
 
     // List of timings for tasks, map from string to
     // (num_timings, total_wall_time, total_user_time, total_system_time)
-    std::map<std::string, std::tuple<std::size_t, double, double, double> >
+    std::map<std::string, std::tuple<std::size_t, double, double, double>>
        _timings;
 
     // Thread used for monitoring memory usage
-    std::unique_ptr<boost::thread> _thread_monitor_memory_usage;
+    std::unique_ptr<std::thread> _thread_monitor_memory_usage;
 
     // Maximum memory usage so far
     long int _maximum_memory_usage;
diff --git a/dolfin/log/log.cpp b/dolfin/log/log.cpp
index 2e79efd..a8c9f3c 100644
--- a/dolfin/log/log.cpp
+++ b/dolfin/log/log.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2013 Anders Logg
+// Copyright (C) 2003-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -17,20 +17,20 @@
 //
 // Thanks to Jim Tilander for many helpful hints.
 //
-// Modified by Ola Skavhaug 2007,
+// Modified by Ola Skavhaug 2007
 // Modified by Garth N. Wells 2009
 //
 // First added:  2003-03-13
-// Last changed: 2013-04-18
+// Last changed: 2016-06-10
 
 #include <cstdarg>
 #include <cstdlib>
 #include <iostream>
+#include <memory>
 #include <sstream>
 #include <stdarg.h>
 #include <stdio.h>
 
-#include <boost/scoped_array.hpp>
 #include <dolfin/common/constants.h>
 #include <dolfin/common/Variable.h>
 #include <dolfin/common/MPI.h>
@@ -40,7 +40,7 @@
 
 using namespace dolfin;
 
-static boost::scoped_array<char> buffer(0);
+static std::unique_ptr<char[]> buffer;
 static unsigned int buffer_size= 0;
 
 // Buffer allocation
@@ -136,12 +136,10 @@ void dolfin::dolfin_error(std::string location,
 //-----------------------------------------------------------------------------
 void dolfin::deprecation(std::string feature,
                          std::string version_deprecated,
-                         std::string version_remove,
                          std::string message, ...)
 {
   read(buffer.get(), message);
-  LogManager::logger().deprecation(feature, version_deprecated, version_remove,
-                                 buffer.get());
+  LogManager::logger().deprecation(feature, version_deprecated, buffer.get());
 }
 //-----------------------------------------------------------------------------
 void dolfin::log(int log_level, std::string msg, ...)
diff --git a/dolfin/log/log.h b/dolfin/log/log.h
index 74d71a1..8f3e707 100644
--- a/dolfin/log/log.h
+++ b/dolfin/log/log.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2013 Anders Logg and Jim Tilander
+// Copyright (C) 2003-2016 Anders Logg and Jim Tilander
 //
 // This file is part of DOLFIN.
 //
@@ -18,7 +18,7 @@
 // Modified by Ola Skavhaug 2007, 2009
 //
 // First added:  2003-03-13
-// Last changed: 2013-01-07
+// Last changed: 2016-06-10
 
 #ifndef __LOG_H
 #define __LOG_H
@@ -93,13 +93,10 @@ namespace dolfin
   ///        Name of the feature that has been removed.
   ///     version_deprecated (std::string)
   ///        Version number of the release in which the feature is deprecated.
-  ///     version_remove (std::string)
-  ///        Version number of the release in which the feature will be removed.
   ///     message (std::string)
   ///        A format string explaining the deprecation.
   void deprecation(std::string feature,
                    std::string version_deprecated,
-                   std::string version_remove,
                    std::string message, ...);
 
   /// Print message at given debug level
diff --git a/dolfin/math/basic.cpp b/dolfin/math/basic.cpp
index 37a01b9..808438b 100644
--- a/dolfin/math/basic.cpp
+++ b/dolfin/math/basic.cpp
@@ -24,6 +24,7 @@
 #include <cstdlib>
 #include <cmath>
 #include <dolfin/common/constants.h>
+#include <dolfin/log/log.h>
 #include "basic.h"
 
 using namespace dolfin;
@@ -37,8 +38,23 @@ namespace dolfin
 //-----------------------------------------------------------------------------
 std::size_t dolfin::ipow(std::size_t a, std::size_t n)
 {
-  std::size_t p = a;
-  for (std::size_t i = 1; i < n; i++)
+  // Treat special case a==0
+  if (a == 0)
+  {
+    if (n == 0)
+    {
+      // size_t does not have NaN, raise error
+      dolfin_error("math/basic.cpp",
+                   "take power ipow(0, 0)",
+                   "ipow(0, 0) does not have a sense");
+    }
+    return 0;
+  }
+
+  std::size_t p = 1;
+  // NOTE: Overflow not checked! Use __builtin_mul_overflow when
+  //       GCC >= 5, Clang >= 3.8 is required!
+  for (std::size_t i = 0; i < n; i++)
     p *= a;
   return p;
 }
diff --git a/dolfin/math/basic.h b/dolfin/math/basic.h
index 841f507..7fac0f5 100644
--- a/dolfin/math/basic.h
+++ b/dolfin/math/basic.h
@@ -27,7 +27,8 @@
 
 namespace dolfin
 {
-  /// Return a to the power n
+  /// Return a to the power n.
+  /// NOTE: Overflow is not checked!
   std::size_t ipow(std::size_t a, std::size_t n);
 
   /// Return a random number, uniformly distributed between [0.0, 1.0)
diff --git a/dolfin/mesh/BoundaryComputation.cpp b/dolfin/mesh/BoundaryComputation.cpp
index 13e5023..addd772 100644
--- a/dolfin/mesh/BoundaryComputation.cpp
+++ b/dolfin/mesh/BoundaryComputation.cpp
@@ -83,17 +83,17 @@ void BoundaryComputation::compute_boundary(const Mesh& mesh,
 
   // Shared vertices for full mesh
   // FIXME: const_cast
-  const std::map<unsigned int, std::set<unsigned int>> &
+  const std::map<std::int32_t, std::set<unsigned int>>&
     shared_vertices = const_cast<Mesh&>(mesh).topology().shared_entities(0);
 
   // Shared vertices for boundary mesh
-  std::map<unsigned int, std::set<unsigned int>> shared_boundary_vertices;
+  std::map<std::int32_t, std::set<unsigned int>> shared_boundary_vertices;
   if (exterior)
   {
     // Extract shared vertices if vertex is identified as part of globally
     // exterior facet.
     std::vector<std::size_t> boundary_global_indices;
-    for (std::map<unsigned int, std::set<unsigned int>>::const_iterator
+    for (std::map<std::int32_t, std::set<unsigned int>>::const_iterator
         sv_it=shared_vertices.begin(); sv_it != shared_vertices.end(); ++sv_it)
     {
       std::size_t local_mesh_index = sv_it->first;
@@ -176,7 +176,8 @@ void BoundaryComputation::compute_boundary(const Mesh& mesh,
   std::size_t num_owned_vertices = 0;
   std::size_t num_boundary_cells = 0;
 
-  MeshFunction<bool> boundary_facet(mesh, D - 1, false);
+  MeshFunction<bool> boundary_facet(reference_to_no_delete_pointer(mesh),
+                                    D - 1, false);
   for (FacetIterator f(mesh); !f.end(); ++f)
   {
     // Boundary facets are connected to exactly one cell
@@ -204,7 +205,7 @@ void BoundaryComputation::compute_boundary(const Mesh& mesh,
             // Determine "owner" of global_mesh_index
             std::size_t owner = my_rank;
 
-            std::map<unsigned int, std::set<unsigned int>>::const_iterator
+            std::map<std::int32_t, std::set<unsigned int>>::const_iterator
               other_processes_it
               = shared_boundary_vertices.find(local_mesh_index);
             if (other_processes_it != shared_boundary_vertices.end() && D > 1)
@@ -247,15 +248,18 @@ void BoundaryComputation::compute_boundary(const Mesh& mesh,
   */
 
   // Specify number of vertices and cells
-  editor.init_vertices_global(num_boundary_vertices, MPI::sum(mesh.mpi_comm(),
-                                                              num_owned_vertices));
+  editor.init_vertices_global(num_boundary_vertices,
+                              MPI::sum(mesh.mpi_comm(), num_owned_vertices));
   editor.init_cells_global(num_boundary_cells, MPI::sum(mesh.mpi_comm(),
                                                         num_boundary_cells));
 
   // Write vertex map
   MeshFunction<std::size_t>& vertex_map = boundary.entity_map(0);
   if (num_boundary_vertices > 0)
-    vertex_map.init(boundary, 0, num_boundary_vertices);
+  {
+    vertex_map.init(reference_to_no_delete_pointer(boundary), 0,
+                    num_boundary_vertices);
+  }
   std::map<std::size_t, std::size_t>::const_iterator it;
   for (it = boundary_vertices.begin(); it != boundary_vertices.end(); ++it)
     vertex_map[it->second] = it->first;
@@ -350,7 +354,10 @@ void BoundaryComputation::compute_boundary(const Mesh& mesh,
   // Create cells (facets) and map between boundary mesh cells and facets parent
   MeshFunction<std::size_t>& cell_map = boundary.entity_map(D - 1);
   if (num_boundary_cells > 0)
-    cell_map.init(boundary, D - 1, num_boundary_cells);
+  {
+    cell_map.init(reference_to_no_delete_pointer(boundary), D - 1,
+                  num_boundary_cells);
+  }
   std::vector<std::size_t>
     cell(boundary.type().num_vertices(boundary.topology().dim()));
   std::size_t current_cell = 0;
diff --git a/dolfin/mesh/BoundaryComputation.h b/dolfin/mesh/BoundaryComputation.h
index 13267be..1fd5367 100644
--- a/dolfin/mesh/BoundaryComputation.h
+++ b/dolfin/mesh/BoundaryComputation.h
@@ -42,14 +42,13 @@ namespace dolfin
   public:
 
     /// Compute the exterior boundary of a given mesh
-    static void compute_boundary(const Mesh& mesh,
-                                          const std::string type,
-                                          BoundaryMesh& boundary);
+    static void compute_boundary(const Mesh& mesh, const std::string type,
+                                 BoundaryMesh& boundary);
 
     /// Compute the boundary of a given mesh
     static void compute_boundary_common(const Mesh& mesh,
-					                              BoundaryMesh& boundary,
-					                              bool interior_boundary);
+                                        BoundaryMesh& boundary,
+                                        bool interior_boundary);
 
   private:
 
diff --git a/dolfin/mesh/Cell.h b/dolfin/mesh/Cell.h
index 0abfb37..325079a 100644
--- a/dolfin/mesh/Cell.h
+++ b/dolfin/mesh/Cell.h
@@ -107,7 +107,26 @@ namespace dolfin
     double volume() const
     { return _mesh->type().volume(*this); }
 
-    /// Compute diameter of cell
+    /// Compute greatest distance between any two vertices
+    ///
+    /// *Returns*
+    ///     double
+    ///         The greatest distance between any two vertices of the cell.
+    ///
+    /// *Example*
+    ///     .. code-block:: c++
+    ///
+    ///         UnitSquareMesh mesh(1, 1);
+    ///         Cell cell(mesh, 0);
+    ///         info("%g", cell.h());
+    ///
+    ///     output::
+    ///
+    ///         1.41421
+    double h() const
+    { return _mesh->type().h(*this); }
+
+    /// Compute diameter of cell (deprecated)
     ///
     /// *Returns*
     ///     double
@@ -116,7 +135,7 @@ namespace dolfin
     /// *Example*
     ///     .. code-block:: c++
     ///
-    ///         UnitSquare mesh(1, 1);
+    ///         UnitSquareMesh mesh(1, 1);
     ///         Cell cell(mesh, 0);
     ///         info("%g", cell.diameter());
     ///
@@ -126,6 +145,25 @@ namespace dolfin
     double diameter() const
     { return _mesh->type().diameter(*this); }
 
+    /// Compute circumradius of cell
+    ///
+    /// *Returns*
+    ///     double
+    ///         The circumradius of the cell.
+    ///
+    /// *Example*
+    ///     .. code-block:: c++
+    ///
+    ///         UnitSquareMesh mesh(1, 1);
+    ///         Cell cell(mesh, 0);
+    ///         info("%g", cell.circumradius());
+    ///
+    ///     output::
+    ///
+    ///         0.707106
+    double circumradius() const
+    { return _mesh->type().circumradius(*this); }
+
     /// Compute inradius of cell
     ///
     /// *Returns*
@@ -135,7 +173,7 @@ namespace dolfin
     /// *Example*
     ///     .. code-block:: c++
     ///
-    ///         UnitSquare mesh(1, 1);
+    ///         UnitSquareMesh mesh(1, 1);
     ///         Cell cell(mesh, 0);
     ///         info("%g", cell.inradius());
     ///
@@ -163,7 +201,7 @@ namespace dolfin
     /// *Example*
     ///     .. code-block:: c++
     ///
-    ///         UnitSquare mesh(1, 1);
+    ///         UnitSquareMesh mesh(1, 1);
     ///         Cell cell(mesh, 0);
     ///         info("%g", cell.radius_ratio());
     ///
@@ -321,20 +359,53 @@ namespace dolfin
     { return IntersectionTriangulation::triangulate_intersection(*this, entity); }
 
     // FIXME: This function is part of a UFC transition
-    /// Get cell vertex coordinates
-    void get_vertex_coordinates(double* coordinates) const
+    /// Get cell coordinate dofs (not vertex coordinates)
+    void get_coordinate_dofs(std::vector<double>& coordinates) const
     {
-      dolfin_assert(coordinates);
-      const std::size_t gdim = _mesh->geometry().dim();
+      const MeshGeometry& geom = _mesh->geometry();
+      const std::size_t gdim = geom.dim();
+      const std::size_t geom_degree = geom.degree();
       const std::size_t num_vertices = this->num_vertices();
       const unsigned int* vertices = this->entities(0);
-      for (std::size_t i = 0; i < num_vertices; i++)
-        for (std::size_t j = 0; j < gdim; j++)
-          coordinates[i*gdim + j] = _mesh->geometry().x(vertices[i])[j];
+
+      if (geom_degree == 1)
+      {
+        coordinates.resize(num_vertices*gdim);
+        for (std::size_t i = 0; i < num_vertices; ++i)
+          for (std::size_t j = 0; j < gdim; ++j)
+            coordinates[i*gdim + j] = geom.x(vertices[i])[j];
+      }
+      else if (geom_degree == 2)
+      {
+        const std::size_t tdim = _mesh->topology().dim();
+        const std::size_t num_edges = this->num_entities(1);
+        const unsigned int* edges = this->entities(1);
+
+        coordinates.resize((num_vertices + num_edges)*gdim);
+
+        for (std::size_t i = 0; i < num_vertices; ++i)
+          for (std::size_t j = 0; j < gdim; j++)
+            coordinates[i*gdim + j] = geom.x(vertices[i])[j];
+
+        for (std::size_t i = 0; i < num_edges; ++i)
+        {
+          const std::size_t entity_index
+              = (tdim == 1) ? index() : edges[i];
+          const std::size_t point_index
+            = geom.get_entity_index(1, 0, entity_index);
+          for (std::size_t j = 0; j < gdim; ++j)
+            coordinates[(i + num_vertices)*gdim + j] = geom.x(point_index)[j];
+        }
+      }
+      else
+      {
+        dolfin_error("Cell.h", "get coordinate_dofs", "Unsupported mesh degree");
+      }
+
     }
 
     // FIXME: This function is part of a UFC transition
-    /// Get cell vertex coordinates
+    /// Get cell vertex coordinates (not coordinate dofs)
     void get_vertex_coordinates(std::vector<double>& coordinates) const
     {
       const std::size_t gdim = _mesh->geometry().dim();
@@ -417,15 +488,9 @@ namespace dolfin
   {
   public:
 
-    CellFunction(const Mesh& mesh)
-      : MeshFunction<T>(mesh, mesh.topology().dim()) {}
-
     CellFunction(std::shared_ptr<const Mesh> mesh)
       : MeshFunction<T>(mesh, mesh->topology().dim()) {}
 
-    CellFunction(const Mesh& mesh, const T& value)
-      : MeshFunction<T>(mesh, mesh.topology().dim(), value) {}
-
     CellFunction(std::shared_ptr<const Mesh> mesh, const T& value)
       : MeshFunction<T>(mesh, mesh->topology().dim(), value) {}
   };
diff --git a/dolfin/mesh/CellType.cpp b/dolfin/mesh/CellType.cpp
index 0a61bcb..85dc38f 100644
--- a/dolfin/mesh/CellType.cpp
+++ b/dolfin/mesh/CellType.cpp
@@ -20,9 +20,10 @@
 // Modified by Jan Blechta 2013
 //
 // First added:  2006-06-05
-// Last changed: 2013-02-21
+// Last changed: 2016-06-10
 
 #include <algorithm>
+#include <array>
 
 #include <dolfin/geometry/Point.h>
 #include <dolfin/log/log.h>
@@ -41,7 +42,6 @@ using namespace dolfin;
 
 namespace dolfin
 {
-
   // Comparison operator for sorting based on global indices
   class GlobalSort
   {
@@ -56,7 +56,6 @@ namespace dolfin
     const std::vector<std::size_t>& g;
 
   };
-
 }
 
 //-----------------------------------------------------------------------------
@@ -132,7 +131,7 @@ std::string CellType::type2string(Type type)
   case interval:
     return "interval";
   case triangle:
-    return "triangle";
+   return "triangle";
   case tetrahedron:
     return "tetrahedron";
   case quadrilateral:
@@ -159,6 +158,90 @@ CellType::Type CellType::entity_type(std::size_t i) const
  return Type::point;
 }
 //-----------------------------------------------------------------------------
+std::size_t CellType::orientation(const Cell& cell, const Point& up) const
+{
+  Point n = cell.cell_normal();
+  return (n.dot(up) < 0.0 ? 1 : 0);
+}
+//-----------------------------------------------------------------------------
+double CellType::h(const MeshEntity& entity) const
+{
+  // Get mesh geometry
+  const MeshGeometry& geometry = entity.mesh().geometry();
+
+  // Get number of cell vertices
+  const int num_vertices = entity.num_entities(0);
+
+  // Get the coordinates (Points) of the vertices
+  const unsigned int* vertices = entity.entities(0);
+  dolfin_assert(vertices);
+  std::array<Point, 4> points;
+  dolfin_assert(num_vertices <= 4);
+  for (int i = 0; i < num_vertices; ++i)
+    points[i] = geometry.point(vertices[i]);
+
+  // Get maximum edge length
+  double h = 0.0;
+  for (int i = 0; i < num_vertices; ++i)
+  {
+    for (int j = i + 1; j < num_vertices; ++j)
+      h = std::max(h, points[i].distance(points[j]));
+  }
+
+  return h;
+}
+//-----------------------------------------------------------------------------
+double CellType::diameter(const MeshEntity& entity) const
+{
+  deprecation("CellType::diameter()", "2016.1",
+              "Use CellType::circumradius() or CellType::h() instead.");
+
+  return 2.0*circumradius(entity);
+}
+//-----------------------------------------------------------------------------
+double CellType::inradius(const Cell& cell) const
+{
+  // Check cell type
+  if (_cell_type != interval && _cell_type != triangle
+      && _cell_type != tetrahedron)
+  {
+    dolfin_error("Cell.h",
+                 "compute cell inradius",
+                 "formula not implemented for non-simplicial cells");
+  }
+
+  // Pick dim
+  const size_t d = dim();
+
+  // Compute volume
+  const double V = volume(cell);
+
+  // Handle degenerate case
+  if (V == 0.0)
+    return 0.0;
+
+  // Compute total area of facets
+  double A = 0;
+  for (std::size_t i = 0; i <= d; i++)
+    A += facet_area(cell, i);
+
+  // See Jonathan Richard Shewchuk: What Is a Good Linear Finite
+  // Element?, online:
+  // http://www.cs.berkeley.edu/~jrs/papers/elemj.pdf
+  return d*V/A;
+}
+//-----------------------------------------------------------------------------
+double CellType::radius_ratio(const Cell& cell) const
+{
+  const double r = inradius(cell);
+
+  // Handle degenerate case
+  if (r == 0.0)
+    return 0.0;
+  else
+    return dim()*r/circumradius(cell);
+}
+//-----------------------------------------------------------------------------
 bool CellType::ordered(const Cell& cell, const std::vector<std::size_t>&
                        local_to_global_vertex_indices) const
 {
@@ -311,50 +394,3 @@ bool CellType::increasing(std::size_t n0, const unsigned int* v0,
   return true;
 }
 //-----------------------------------------------------------------------------
-std::size_t CellType::orientation(const Cell& cell, const Point& up) const
-{
-  Point n = cell.cell_normal();
-  return (n.dot(up) < 0.0 ? 1 : 0);
-}
-//-----------------------------------------------------------------------------
-double CellType::inradius(const Cell& cell) const
-{
-  // Check cell type
-  if (_cell_type != interval && _cell_type != triangle
-      && _cell_type != tetrahedron)
-  {
-    dolfin_error("Cell.h",
-                 "compute cell inradius",
-                 "formula not implemented for non-simplicial cells");
-  }
-
-  // Pick dim
-  const size_t d = dim();
-
-  // Compute volume
-  const double V = volume(cell);
-
-  // Handle degenerate case
-  if (V == 0.0) {return 0.0;}
-
-  // Compute total area of facets
-  double A = 0;
-  for (std::size_t i = 0; i <= d; i++)
-    A += facet_area(cell, i);
-
-  // See Jonathan Richard Shewchuk: What Is a Good Linear Finite Element?,
-  // online: http://www.cs.berkeley.edu/~jrs/papers/elemj.pdf
-  return d*V/A;
-}
-//-----------------------------------------------------------------------------
-double CellType::radius_ratio(const Cell& cell) const
-{
-  const double r = inradius(cell);
-
-  // Handle degenerate case
-  if (r == 0.0)
-    return 0.0;
-  else
-    return 2.0*dim()*r/diameter(cell);
-}
-//-----------------------------------------------------------------------------
diff --git a/dolfin/mesh/CellType.h b/dolfin/mesh/CellType.h
index f9dc96a..90f2ab1 100644
--- a/dolfin/mesh/CellType.h
+++ b/dolfin/mesh/CellType.h
@@ -25,6 +25,7 @@
 #ifndef __CELL_TYPE_H
 #define __CELL_TYPE_H
 
+#include <cstdint>
 #include <string>
 #include <vector>
 #include <boost/multi_array.hpp>
@@ -68,10 +69,12 @@ namespace dolfin
     static std::string type2string(Type type);
 
     /// Return type of cell
-    Type cell_type() const { return _cell_type; }
+    Type cell_type() const
+    { return _cell_type; }
 
     /// Return type of cell for facets
-    Type facet_type() const { return _facet_type; }
+    Type facet_type() const
+    { return _facet_type; }
 
     /// Return type of cell for entity of dimension i
     Type entity_type(std::size_t i) const;
@@ -95,20 +98,23 @@ namespace dolfin
     /// Return orientation of the cell relative to given up direction
     std::size_t orientation(const Cell& cell, const Point& up) const;
 
-    /// Create entities e of given topological dimension from vertices v
+    /// Create entities e of given topological dimension from
+    /// vertices v
     virtual void create_entities(boost::multi_array<unsigned int, 2>& e,
                                  std::size_t dim,
                                  const unsigned int* v) const = 0;
 
-    /// Refine cell uniformly
-    virtual void refine_cell(Cell& cell, MeshEditor& editor,
-                             std::size_t& current_cell) const = 0;
-
     /// Compute (generalized) volume of mesh entity
     virtual double volume(const MeshEntity& entity) const = 0;
 
-    /// Compute diameter of mesh entity
-    virtual double diameter(const MeshEntity& entity) const = 0;
+    /// Compute greatest distance between any two vertices
+    virtual double h(const MeshEntity& entity) const;
+
+    /// Compute diameter of mesh entity (deprecated)
+    double diameter(const MeshEntity& entity) const;
+
+    /// Compute circumradius of mesh entity
+    virtual double circumradius(const MeshEntity& entity) const = 0;
 
     /// Compute inradius of cell
     virtual double inradius(const Cell& cell) const;
@@ -158,7 +164,7 @@ namespace dolfin
     virtual std::string description(bool plural) const = 0;
 
     /// Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering
-    virtual std::vector<unsigned int> vtk_mapping() const = 0;
+    virtual std::vector<std::int8_t> vtk_mapping() const = 0;
 
   protected:
 
diff --git a/dolfin/mesh/DistributedMeshTools.cpp b/dolfin/mesh/DistributedMeshTools.cpp
index 647a677..1cb540e 100644
--- a/dolfin/mesh/DistributedMeshTools.cpp
+++ b/dolfin/mesh/DistributedMeshTools.cpp
@@ -41,7 +41,7 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 void DistributedMeshTools::number_entities(const Mesh& mesh, std::size_t d)
 {
-  Timer timer("Build mesh number mesh entities");
+  Timer timer("Number distributed mesh entities");
 
   // Return if global entity indices have already been calculated
   if (mesh.topology().have_global_indices(d))
@@ -64,7 +64,7 @@ void DistributedMeshTools::number_entities(const Mesh& mesh, std::size_t d)
   }
 
   // Get shared entities map
-  std::map<unsigned int, std::set<unsigned int>>&
+  std::map<std::int32_t, std::set<unsigned int>>&
     shared_entities = _mesh.topology().shared_entities(d);
 
   // Number entities
@@ -87,16 +87,17 @@ std::size_t DistributedMeshTools::number_entities(
   const std::map<unsigned int, std::pair<unsigned int,
   unsigned int>>& slave_entities,
   std::vector<std::size_t>& global_entity_indices,
-  std::map<unsigned int, std::set<unsigned int>>& shared_entities,
+  std::map<std::int32_t, std::set<unsigned int>>& shared_entities,
   std::size_t d)
 {
-  // Developer note: This function should use global_vertex_indices for
-  // the global mesh indices and *not* access these through the mesh. In
-  // some cases special numbering is passed in which differs from mesh
-  // global numbering, e.g. when computing mesh entity numbering for
-  // problems with periodic boundary conditions.
+  // Developer note: This function should use global_vertex_indices
+  // for the global mesh indices and *not* access these through the
+  // mesh. In some cases special numbering is passed in which differs
+  // from mesh global numbering, e.g. when computing mesh entity
+  // numbering for problems with periodic boundary conditions.
 
-  Timer timer("PARALLEL x: Number mesh entities");
+  log(PROGRESS, "Number mesh entities for distributed mesh (for specified vertex ids).", d);
+  Timer timer("Number mesh entities for distributed mesh (for specified vertex ids)");
 
   // Check that we're not re-numbering vertices (these are fixed at
   // mesh construction)
@@ -162,8 +163,8 @@ std::size_t DistributedMeshTools::number_entities(
     = mesh.topology().global_indices(0);
 
   // Get shared vertices (local index, [sharing processes])
-  const std::map<unsigned int, std::set<unsigned int>>& shared_vertices_local
-                            = mesh.topology().shared_entities(0);
+  const std::map<std::int32_t, std::set<unsigned int>>& shared_vertices_local
+    = mesh.topology().shared_entities(0);
 
   // Compute ownership of entities of dimension d ([entity vertices], data):
   //  [0]: owned and shared (will be numbered by this process, and number
@@ -183,7 +184,7 @@ std::size_t DistributedMeshTools::number_entities(
 
   // Number of entities 'owned' by this process
   const std::size_t num_local_entities = owned_entities.size()
-                                       + owned_shared_entities.size();
+    + owned_shared_entities.size();
 
   // Compute global number of entities and local process offset
   const std::pair<std::size_t, std::size_t> num_global_entities
@@ -195,7 +196,8 @@ std::size_t DistributedMeshTools::number_entities(
 
   // Prepare list of global entity numbers. Check later that nothing
   // is equal to std::numeric_limits<std::size_t>::max()
-  global_entity_indices = std::vector<std::size_t>(mesh.size(d),
+  global_entity_indices
+    = std::vector<std::size_t>(mesh.size(d),
                                std::numeric_limits<std::size_t>::max());
 
   std::map<Entity, EntityData>::const_iterator it;
@@ -360,6 +362,8 @@ DistributedMeshTools::locate_off_process_entities(const std::vector<std::size_t>
                                                   std::size_t dim,
                                                   const Mesh& mesh)
 {
+  Timer timer("Locate off-process entities");
+
   if (dim == 0)
   {
     warning("DistributedMeshTools::host_processes has not been tested for vertices.");
@@ -415,12 +419,17 @@ DistributedMeshTools::locate_off_process_entities(const std::vector<std::size_t>
     std::set<std::size_t> set_of_my_entities(entity_indices.begin(),
                                              entity_indices.end());
 
+    const std::map<std::int32_t, std::set<unsigned int>>& sharing_map
+      = mesh.topology().shared_entities(D);
+
     // FIXME: This can be made more efficient by exploiting fact that
     //        set is sorted
     // Remove local cells from set_of_my_entities to reduce communication
     for (std::size_t j = 0; j < global_entity_indices.size(); ++j)
-      set_of_my_entities.erase(global_entity_indices[j]);
-
+    {
+      if (sharing_map.find(j) == sharing_map.end())
+        set_of_my_entities.erase(global_entity_indices[j]);
+    }
     // Copy entries from set_of_my_entities to my_entities
     my_entities = std::vector<std::size_t>(set_of_my_entities.begin(),
                                            set_of_my_entities.end());
@@ -482,7 +491,7 @@ DistributedMeshTools::locate_off_process_entities(const std::vector<std::size_t>
     {
       const std::size_t global_index = host_processes[j];
       const std::size_t local_index  = host_processes[j + 1];
-      processes[global_index].insert(std::make_pair(dest, local_index));
+      processes[global_index].insert({dest, local_index});
     }
 
     // FIXME: Do later for efficiency
@@ -507,9 +516,12 @@ std::unordered_map<unsigned int,
                    std::vector<std::pair<unsigned int, unsigned int>>>
   DistributedMeshTools::compute_shared_entities(const Mesh& mesh, std::size_t d)
 {
+  log(PROGRESS, "Compute shared mesh entities of dimension %d.", d);
+  Timer timer("Computed shared mesh entities");
+
   // MPI communicator
   const MPI_Comm mpi_comm = mesh.mpi_comm();
-  const unsigned int comm_size = MPI::size(mpi_comm);
+  const int comm_size = MPI::size(mpi_comm);
 
   // Return empty set if running in serial
   if (MPI::size(mpi_comm) == 1)
@@ -524,7 +536,7 @@ std::unordered_map<unsigned int,
   number_entities(mesh, d);
 
   // Get shared entities to processes map
-  const std::map<unsigned int, std::set<unsigned int>>&
+  const std::map<std::int32_t, std::set<unsigned int>>&
     shared_entities = mesh.topology().shared_entities(d);
 
   // Get local-to-global indices map
@@ -538,7 +550,7 @@ std::unordered_map<unsigned int,
   // Pack global indices for sending to sharing processes
   std::vector<std::vector<std::size_t>> send_indices(comm_size);
   std::vector<std::vector<std::size_t>> local_sent_indices(comm_size);
-  std::map<unsigned int, std::set<unsigned int>>::const_iterator shared_entity;
+  std::map<std::int32_t, std::set<unsigned int>>::const_iterator shared_entity;
   for (shared_entity = shared_entities.begin();
        shared_entity != shared_entities.end(); ++shared_entity)
   {
@@ -559,7 +571,7 @@ std::unordered_map<unsigned int,
     {
       send_indices[*dest].push_back(global_index);
       local_sent_indices[*dest].push_back(local_index);
-      global_to_local[*dest].insert(std::make_pair(global_index, local_index));
+      global_to_local[*dest].insert({global_index, local_index});
     }
   }
 
@@ -637,8 +649,7 @@ std::unordered_map<unsigned int,
 
       for (std::size_t i = 0; i < neighbour_local_indices.size(); ++i)
       {
-        shared_local_indices_map[my_local_indices[i]].push_back(std::make_pair(proc,
-                                                                               neighbour_local_indices[i]));
+        shared_local_indices_map[my_local_indices[i]].push_back({proc, neighbour_local_indices[i]});
       }
     }
   }
@@ -649,20 +660,22 @@ std::unordered_map<unsigned int,
 void DistributedMeshTools::compute_entity_ownership(
   const MPI_Comm mpi_comm,
   const std::map<std::vector<std::size_t>, unsigned int>& entities,
-  const std::map<unsigned int, std::set<unsigned int>>& shared_vertices_local,
+  const std::map<std::int32_t, std::set<unsigned int>>& shared_vertices_local,
   const std::vector<std::size_t>& global_vertex_indices,
   std::size_t d,
   std::vector<std::size_t>& owned_entities,
   std::array<std::map<Entity, EntityData>, 2>& shared_entities)
 {
+  log(PROGRESS, "Compute ownership for mesh entities of dimension %d.", d);
+  Timer timer("Compute mesh entity ownership");
+
   // Build global-to-local indices map for shared vertices
   std::map<std::size_t, std::set<unsigned int>> shared_vertices;
-  std::map<unsigned int, std::set<unsigned int>>::const_iterator v;
+  std::map<std::int32_t, std::set<unsigned int>>::const_iterator v;
   for (v = shared_vertices_local.begin(); v != shared_vertices_local.end(); ++v)
   {
-    dolfin_assert(v->first < global_vertex_indices.size());
-    shared_vertices.insert(std::make_pair(global_vertex_indices[v->first],
-                                          v->second));
+    dolfin_assert(v->first < (int) global_vertex_indices.size());
+    shared_vertices.insert({global_vertex_indices[v->first], v->second});
   }
 
   // Entity ownership list ([entity vertices], data):
@@ -847,8 +860,8 @@ void DistributedMeshTools::compute_final_entity_ownership(
       for (std::size_t j = 0; j < entity_size; ++j)
         entity.push_back(received_common_entity_values[p][i++]);
 
-      // Check if received really is an entity on this process (in which
-      // case it will be in owned or unowned entities)
+      // Check if received really is an entity on this process (in
+      // which case it will be in owned or unowned entities)
       bool is_entity = false;
       if (unowned_shared_entities.find(entity) != unowned_shared_entities.end()
           || owned_shared_entities.find(entity) != owned_shared_entities.end())
@@ -865,7 +878,8 @@ void DistributedMeshTools::compute_final_entity_ownership(
     }
   }
 
-  // Send data back (list of requested entities that are really entities)
+  // Send data back (list of requested entities that are really
+  // entities)
   std::vector<std::vector<std::size_t>> received_is_entity_values;
   MPI::all_to_all(mpi_comm, send_is_entity_values, received_is_entity_values);
 
@@ -996,7 +1010,7 @@ DistributedMeshTools::compute_num_global_entities(const MPI_Comm mpi_comm,
                                                  num_entities_to_number.end(),
                                                  (std::size_t)0);
 
-  return std::make_pair(num_global, offset);
+  return {num_global, offset};
 }
 //-----------------------------------------------------------------------------
 void DistributedMeshTools::init_facet_cell_connections(Mesh& mesh)
@@ -1022,7 +1036,7 @@ void DistributedMeshTools::init_facet_cell_connections(Mesh& mesh)
   // facet. Initially copy over from local values.
   std::vector<unsigned int> num_global_neighbors(mesh.num_facets());
 
-  std::map<unsigned int, std::set<unsigned int>>& shared_facets
+  std::map<std::int32_t, std::set<unsigned int>>& shared_facets
     = mesh.topology().shared_entities(D - 1);
 
   // Check if no ghost cells
@@ -1053,15 +1067,15 @@ void DistributedMeshTools::init_facet_cell_connections(Mesh& mesh)
     {
       // Insert shared facets into mapping
       if (f->is_shared())
-        global_to_local_facet.insert(std::make_pair(f->global_index(),
-                                                    f->index()));
+        global_to_local_facet.insert({f->global_index(), f->index()});
       // Copy local values
       const std::size_t n_cells = f->num_entities(D);
       num_global_neighbors[f->index()] = n_cells;
 
       if (f->is_ghost() && n_cells == 1)
       {
-        // Singly attached ghost facet - check with owner of attached cell
+        // Singly attached ghost facet - check with owner of attached
+        // cell
         const Cell c(mesh, f->entities(D)[0]);
         dolfin_assert(c.is_ghost());
         send_facet[c.owner()].push_back(f->global_index());
@@ -1123,7 +1137,7 @@ void DistributedMeshTools::reorder_values_by_global_indices(const Mesh& mesh,
   const MPI_Comm mpi_comm = mesh.mpi_comm();
 
   // Get shared vertices
-  const std::map<unsigned int, std::set<unsigned int>>& shared_vertices
+  const std::map<std::int32_t, std::set<unsigned int>>& shared_vertices
     = mesh.topology().shared_entities(0);
 
   // My process rank
@@ -1133,7 +1147,8 @@ void DistributedMeshTools::reorder_values_by_global_indices(const Mesh& mesh,
   std::set<unsigned int> non_local_vertices;
   if (mesh.topology().size(tdim) == mesh.topology().ghost_offset(tdim))
   {
-    // No ghost cells - exclude shared entities which are on lower rank processes
+    // No ghost cells - exclude shared entities which are on lower
+    // rank processes
     for (auto sh = shared_vertices.begin(); sh != shared_vertices.end(); ++sh)
     {
       const unsigned int lowest_proc = *(sh->second.begin());
@@ -1143,8 +1158,9 @@ void DistributedMeshTools::reorder_values_by_global_indices(const Mesh& mesh,
   }
   else
   {
-    // Iterate through ghost cells, adding non-ghost vertices which are
-    // in lower rank process cells to a set for exclusion from output
+    // Iterate through ghost cells, adding non-ghost vertices which
+    // are in lower rank process cells to a set for exclusion from
+    // output
     for (CellIterator c(mesh, "ghost"); !c.end(); ++c)
     {
       const unsigned int cell_owner = c->owner();
diff --git a/dolfin/mesh/DistributedMeshTools.h b/dolfin/mesh/DistributedMeshTools.h
index 32b344f..87c114f 100644
--- a/dolfin/mesh/DistributedMeshTools.h
+++ b/dolfin/mesh/DistributedMeshTools.h
@@ -52,7 +52,7 @@ namespace dolfin
       const std::map<unsigned int, std::pair<unsigned int,
       unsigned int> >& slave_entities,
       std::vector<std::size_t>& global_entity_indices,
-      std::map<unsigned int, std::set<unsigned int> >& shared_entities,
+      std::map<std::int32_t, std::set<unsigned int> >& shared_entities,
       std::size_t d);
 
     // Compute number of cells connected to each facet
@@ -135,7 +135,7 @@ namespace dolfin
     static void compute_entity_ownership(
       const MPI_Comm mpi_comm,
       const std::map<std::vector<std::size_t>, unsigned int>& entities,
-      const std::map<unsigned int, std::set<unsigned int> >& shared_vertices_local,
+      const std::map<std::int32_t, std::set<unsigned int> >& shared_vertices_local,
       const std::vector<std::size_t>& global_vertex_indices,
       std::size_t d,
       std::vector<std::size_t>& owned_entities,
diff --git a/dolfin/mesh/DynamicMeshEditor.cpp b/dolfin/mesh/DynamicMeshEditor.cpp
index 5bd0d80..59c8ee7 100644
--- a/dolfin/mesh/DynamicMeshEditor.cpp
+++ b/dolfin/mesh/DynamicMeshEditor.cpp
@@ -45,7 +45,6 @@ void DynamicMeshEditor::open(Mesh& mesh, CellType::Type type, std::size_t tdim,
                              std::size_t num_global_cells)
 {
   // Clear old data
-  mesh.clear();
   clear();
 
   // Save data
diff --git a/dolfin/mesh/Edge.h b/dolfin/mesh/Edge.h
index 0f223e9..58946c3 100644
--- a/dolfin/mesh/Edge.h
+++ b/dolfin/mesh/Edge.h
@@ -110,14 +110,9 @@ namespace dolfin
   {
   public:
 
-    EdgeFunction(const Mesh& mesh) : MeshFunction<T>(mesh, 1) {}
-
     EdgeFunction(std::shared_ptr<const Mesh> mesh)
       : MeshFunction<T>(mesh, 1) {}
 
-    EdgeFunction(const Mesh& mesh, const T& value)
-      : MeshFunction<T>(mesh, 1, value) {}
-
     EdgeFunction(std::shared_ptr<const Mesh> mesh, const T& value)
       : MeshFunction<T>(mesh, 1, value) {}
 
diff --git a/dolfin/mesh/Face.h b/dolfin/mesh/Face.h
index d4d4993..06077eb 100644
--- a/dolfin/mesh/Face.h
+++ b/dolfin/mesh/Face.h
@@ -66,14 +66,9 @@ namespace dolfin
   {
   public:
 
-    FaceFunction(const Mesh& mesh) : MeshFunction<T>(mesh, 2) {}
-
     FaceFunction(std::shared_ptr<const Mesh> mesh)
       : MeshFunction<T>(mesh, 2) {}
 
-    FaceFunction(const Mesh& mesh, const T& value)
-      : MeshFunction<T>(mesh, 2, value) {}
-
     FaceFunction(std::shared_ptr<const Mesh> mesh, const T& value)
       : MeshFunction<T>(mesh, 2, value) {}
 
diff --git a/dolfin/mesh/Facet.h b/dolfin/mesh/Facet.h
index 1121600..cee714b 100644
--- a/dolfin/mesh/Facet.h
+++ b/dolfin/mesh/Facet.h
@@ -93,15 +93,9 @@ namespace dolfin
   {
   public:
 
-    FacetFunction(const Mesh& mesh)
-      : MeshFunction<T>(mesh, mesh.topology().dim() - 1) {}
-
     FacetFunction(std::shared_ptr<const Mesh> mesh)
       : MeshFunction<T>(mesh, mesh->topology().dim() - 1) {}
 
-    FacetFunction(const Mesh& mesh, const T& value)
-      : MeshFunction<T>(mesh, mesh.topology().dim() - 1, value) {}
-
     FacetFunction(std::shared_ptr<const Mesh> mesh, const T& value)
       : MeshFunction<T>(mesh, mesh->topology().dim() - 1, value) {}
 
diff --git a/dolfin/mesh/HexahedronCell.cpp b/dolfin/mesh/HexahedronCell.cpp
index ecf37ef..3d5d46d 100644
--- a/dolfin/mesh/HexahedronCell.cpp
+++ b/dolfin/mesh/HexahedronCell.cpp
@@ -124,12 +124,6 @@ void HexahedronCell::create_entities(boost::multi_array<unsigned int, 2>& e,
   }
 }
 //-----------------------------------------------------------------------------
-void HexahedronCell::refine_cell(Cell& cell, MeshEditor& editor,
-                               std::size_t& current_cell) const
-{
-  dolfin_not_implemented();
-}
-//-----------------------------------------------------------------------------
 double HexahedronCell::volume(const MeshEntity& cell) const
 {
   if (cell.dim() != 2)
@@ -158,18 +152,18 @@ double HexahedronCell::volume(const MeshEntity& cell) const
   return 0.0;
 }
 //-----------------------------------------------------------------------------
-double HexahedronCell::diameter(const MeshEntity& cell) const
+double HexahedronCell::circumradius(const MeshEntity& cell) const
 {
   // Check that we get a cell
   if (cell.dim() != 2)
   {
     dolfin_error("HexahedronCell.cpp",
-                 "compute diameter of hexahedron cell",
+                 "compute circumradius of hexahedron cell",
                  "Illegal mesh entity");
   }
 
   dolfin_error("HexahedronCell.cpp",
-               "compute diameter of hexahedron cell",
+               "compute circumradius of hexahedron cell",
                "Don't know how to compute diameter");
 
   dolfin_not_implemented();
diff --git a/dolfin/mesh/HexahedronCell.h b/dolfin/mesh/HexahedronCell.h
index 3d86e78..be8a8bf 100644
--- a/dolfin/mesh/HexahedronCell.h
+++ b/dolfin/mesh/HexahedronCell.h
@@ -51,15 +51,11 @@ namespace dolfin
                          std::size_t dim,
                          const unsigned int* v) const;
 
-    /// Refine cell uniformly
-    void refine_cell(Cell& cell, MeshEditor& editor,
-                     std::size_t& current_cell) const;
-
     /// Compute (generalized) volume (area) of triangle
     double volume(const MeshEntity& triangle) const;
 
     /// Compute diameter of triangle
-    double diameter(const MeshEntity& triangle) const;
+    double circumradius(const MeshEntity& triangle) const;
 
     /// Compute squared distance to given point (3D enabled)
     double squared_distance(const Cell& cell, const Point& point) const;
@@ -94,8 +90,8 @@ namespace dolfin
     std::string description(bool plural) const;
 
     /// Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering
-    std::vector<unsigned int> vtk_mapping() const
-    { return std::vector<unsigned int> {0, 1, 3, 2, 4, 5, 7, 6}; }
+    std::vector<std::int8_t> vtk_mapping() const
+    { return {0, 1, 3, 2, 4, 5, 7, 6}; }
 
   };
 
diff --git a/dolfin/mesh/IntervalCell.cpp b/dolfin/mesh/IntervalCell.cpp
index 2b94abd..5d2e2d4 100644
--- a/dolfin/mesh/IntervalCell.cpp
+++ b/dolfin/mesh/IntervalCell.cpp
@@ -91,31 +91,6 @@ void IntervalCell::create_entities(boost::multi_array<unsigned int, 2>& e,
   e[0][0] = v[0]; e[1][0] = v[1];
 }
 //-----------------------------------------------------------------------------
-void IntervalCell::refine_cell(Cell& cell, MeshEditor& editor,
-                               std::size_t& current_cell) const
-{
-  // Get vertices
-  const unsigned int* v = cell.entities(0);
-  dolfin_assert(v);
-
-  // Get offset for new vertex indices
-  const std::size_t offset = cell.mesh().num_vertices();
-
-  // Compute indices for the three new vertices
-  const std::size_t v0 = v[0];
-  const std::size_t v1 = v[1];
-  const std::size_t e0 = offset + cell.index();
-
-  // Add the two new cells
-  std::vector<std::size_t> new_cell(2);
-
-  new_cell[0] = v0; new_cell[1] = e0;
-  editor.add_cell(current_cell++, new_cell);
-
-  new_cell[0] = e0; new_cell[1] = v1;
-  editor.add_cell(current_cell++, new_cell);
-}
-//-----------------------------------------------------------------------------
 double IntervalCell::volume(const MeshEntity& interval) const
 {
   // Check that we get an interval
@@ -131,21 +106,13 @@ double IntervalCell::volume(const MeshEntity& interval) const
 
   // Get the coordinates of the two vertices
   const unsigned int* vertices = interval.entities(0);
-  const double* x0 = geometry.x(vertices[0]);
-  const double* x1 = geometry.x(vertices[1]);
-
-  // Compute length of interval (line segment)
-  double sum = 0.0;
-  for (std::size_t i = 0; i < geometry.dim(); ++i)
-  {
-    const double dx = x1[i] - x0[i];
-    sum += dx*dx;
-  }
+  const Point x0 = geometry.point(vertices[0]);
+  const Point x1 = geometry.point(vertices[1]);
 
-  return std::sqrt(sum);
+  return x1.distance(x0);
 }
 //-----------------------------------------------------------------------------
-double IntervalCell::diameter(const MeshEntity& interval) const
+double IntervalCell::circumradius(const MeshEntity& interval) const
 {
   // Check that we get an interval
   if (interval.dim() != 1)
@@ -155,8 +122,8 @@ double IntervalCell::diameter(const MeshEntity& interval) const
                  "Illegal mesh entity, not an interval");
   }
 
-  // Diameter is same as volume for interval (line segment)
-  return volume(interval);
+  // Circumradius is half the volume for an interval (line segment)
+  return volume(interval)/2.0;
 }
 //-----------------------------------------------------------------------------
 double IntervalCell::squared_distance(const Cell& cell,
diff --git a/dolfin/mesh/IntervalCell.h b/dolfin/mesh/IntervalCell.h
index ba1a29b..3785a9c 100644
--- a/dolfin/mesh/IntervalCell.h
+++ b/dolfin/mesh/IntervalCell.h
@@ -63,15 +63,11 @@ namespace dolfin
                          std::size_t dim,
                          const unsigned int* v) const;
 
-    /// Refine cell uniformly
-    void refine_cell(Cell& cell, MeshEditor& editor,
-                     std::size_t& current_cell) const;
-
     /// Compute (generalized) volume (length) of interval
     double volume(const MeshEntity& interval) const;
 
-    /// Compute diameter of interval
-    double diameter(const MeshEntity& interval) const;
+    /// Compute circumradius of interval
+    double circumradius(const MeshEntity& interval) const;
 
     /// Compute squared distance to given point (3D enabled)
     double squared_distance(const Cell& cell, const Point& point) const;
@@ -117,8 +113,8 @@ namespace dolfin
     std::string description(bool plural) const;
 
     /// Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering
-    std::vector<unsigned int> vtk_mapping() const
-    { return std::vector<unsigned int> {0, 1}; }
+    std::vector<std::int8_t> vtk_mapping() const
+    { return {0, 1}; }
 
   };
 
diff --git a/dolfin/mesh/LocalMeshData.cpp b/dolfin/mesh/LocalMeshData.cpp
index 543fee2..c7375c8 100644
--- a/dolfin/mesh/LocalMeshData.cpp
+++ b/dolfin/mesh/LocalMeshData.cpp
@@ -20,6 +20,7 @@
 // First added:  2008-11-28
 // Last changed: 2012-11-24
 
+#include <utility>
 #include <dolfin/common/MPI.h>
 #include <dolfin/common/Timer.h>
 #include <dolfin/log/log.h>
@@ -32,18 +33,14 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-LocalMeshData::LocalMeshData(const MPI_Comm mpi_comm)
-  : num_global_vertices(0), num_global_cells(0),
-    num_vertices_per_cell(0), gdim(0), tdim(0), _mpi_comm(mpi_comm)
+LocalMeshData::LocalMeshData(const MPI_Comm mpi_comm) : _mpi_comm(mpi_comm)
 {
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-LocalMeshData::LocalMeshData(const Mesh& mesh)
-  : num_global_vertices(0), num_global_cells(0), num_vertices_per_cell(0),
-    gdim(0), tdim(0), _mpi_comm(mesh.mpi_comm())
+LocalMeshData::LocalMeshData(const Mesh& mesh) : _mpi_comm(mesh.mpi_comm())
 {
-  Timer timer("build LocalMeshData");
+  Timer timer("Build LocalMeshData from local Mesh");
 
   // Extract data on main process and split among processes
   if (MPI::is_broadcaster(mesh.mpi_comm()))
@@ -60,6 +57,15 @@ LocalMeshData::~LocalMeshData()
   // Do nothing
 }
 //-----------------------------------------------------------------------------
+void LocalMeshData::check() const
+{
+  dolfin_assert(geometry.num_global_vertices != -1);
+  dolfin_assert(topology.num_global_cells != -1);
+  dolfin_assert(topology.num_vertices_per_cell  != -1);
+  dolfin_assert(geometry.dim  != -1);
+  dolfin_assert(topology.dim  != -1);
+}
+//-----------------------------------------------------------------------------
 std::string LocalMeshData::str(bool verbose) const
 {
   std::stringstream s;
@@ -71,28 +77,28 @@ std::string LocalMeshData::str(bool verbose) const
 
     s << "  Vertex coordinates" << std::endl;
     s << "  ------------------" << std::endl;
-    for (std::size_t i = 0; i < vertex_coordinates.size(); i++)
+    for (std::size_t i = 0; i < geometry.vertex_coordinates.size(); i++)
     {
       s << "    " << i << ":";
-      for (std::size_t j = 0; j < vertex_coordinates[i].size(); j++)
-        s << " " << vertex_coordinates[i][j];
+      for (std::size_t j = 0; j < geometry.vertex_coordinates[i].size(); j++)
+        s << " " << geometry.vertex_coordinates[i][j];
       s << std::endl;
     }
     s << std::endl;
 
     s << "  Vertex indices" << std::endl;
     s << "  --------------" << std::endl;
-    for (std::size_t i = 0; i < vertex_coordinates.size(); i++)
-      s << "    " << i << ": " << vertex_indices[i] << std::endl;
+    for (std::size_t i = 0; i < geometry.vertex_coordinates.size(); i++)
+      s << "    " << i << ": " << geometry.vertex_indices[i] << std::endl;
     s << std::endl;
 
     s << "  Cell vertices" << std::endl;
     s << "  ------------" << std::endl;
-    for (std::size_t i = 0; i < cell_vertices.shape()[0]; i++)
+    for (std::size_t i = 0; i < topology.cell_vertices.shape()[0]; i++)
     {
       s << "    " << i << ":";
-      for (std::size_t j = 0; j < cell_vertices.shape()[1]; j++)
-        s << " " << cell_vertices[i][j];
+      for (std::size_t j = 0; j < topology.cell_vertices.shape()[1]; j++)
+        s << " " << topology.cell_vertices[i][j];
       s << std::endl;
     }
     s << std::endl;
@@ -100,10 +106,10 @@ std::string LocalMeshData::str(bool verbose) const
   else
   {
     s << "<LocalMeshData with "
-      << vertex_coordinates.size() << " vertices (out of "
-      << num_global_vertices << ") and "
-      << cell_vertices.shape()[0] << " cells (out of "
-      << num_global_cells << ")>";
+      << geometry.vertex_coordinates.size() << " vertices (out of "
+      << geometry.num_global_vertices << ") and "
+      << topology.cell_vertices.shape()[0] << " cells (out of "
+      << topology.num_global_cells << ")>";
   }
 
   return s.str();
@@ -111,14 +117,8 @@ std::string LocalMeshData::str(bool verbose) const
 //-----------------------------------------------------------------------------
 void LocalMeshData::clear()
 {
-  vertex_coordinates.resize(boost::extents[0][0]);
-  vertex_indices.clear();
-  cell_vertices.resize(boost::extents[0][0]);
-  global_cell_indices.clear();
-  num_global_vertices = 0;
-  num_global_cells = 0;
-  gdim = 0;
-  tdim = 0;
+  geometry.clear();
+  topology.clear();
   domain_data.clear();
 }
 //-----------------------------------------------------------------------------
@@ -135,41 +135,37 @@ void LocalMeshData::extract_mesh_data(const Mesh& mesh)
   clear();
 
   // Set scalar data
-  gdim = mesh.geometry().dim();
-  tdim = mesh.topology().dim();
-  num_global_vertices = mesh.num_vertices();
-  num_global_cells = mesh.num_cells();
-  num_vertices_per_cell = mesh.type().num_entities(0);
-  cell_type = mesh.type().cell_type();
+  geometry.dim = mesh.geometry().dim();
+  topology.dim = mesh.topology().dim();
+  geometry.num_global_vertices = mesh.num_vertices();
+  topology.num_global_cells = mesh.num_cells();
+  topology.num_vertices_per_cell = mesh.type().num_entities(0);
+  topology.cell_type = mesh.type().cell_type();
 
   // Get coordinates for all vertices stored on local processor
-  vertex_coordinates.resize(boost::extents[mesh.num_vertices()][gdim]);
+  geometry.vertex_coordinates.resize(boost::extents[mesh.num_vertices()][geometry.dim]);
   for (VertexIterator vertex(mesh); !vertex.end(); ++vertex)
   {
     const std::size_t index = vertex->index();
-    std::copy(vertex->x(), vertex->x() + gdim,
-              vertex_coordinates[index].begin());
+    std::copy(vertex->x(), vertex->x() + geometry.dim,
+              geometry.vertex_coordinates[index].begin());
   }
 
   // Get global vertex indices for all vertices stored on local processor
-  vertex_indices.reserve(mesh.num_vertices());
+  geometry.vertex_indices.reserve(mesh.num_vertices());
   for (VertexIterator vertex(mesh); !vertex.end(); ++vertex)
-    vertex_indices.push_back(vertex->index());
+    geometry.vertex_indices.push_back(vertex->index());
 
   // Get global vertex indices for all cells stored on local processor
-  cell_vertices.resize(boost::extents[mesh.num_cells()][num_vertices_per_cell]);
-  global_cell_indices.reserve(mesh.num_cells());
-  //  std::vector<std::size_t> vertices(num_vertices_per_cell);
+  topology.cell_vertices.resize(boost::extents[mesh.num_cells()][topology.num_vertices_per_cell]);
+  topology.global_cell_indices.reserve(mesh.num_cells());
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
     const std::size_t index = cell->index();
-    global_cell_indices.push_back(index);
-    std::copy(cell->entities(0), cell->entities(0) + num_vertices_per_cell,
-              cell_vertices[index].begin());
+    topology.global_cell_indices.push_back(index);
+    std::copy(cell->entities(0), cell->entities(0) + topology.num_vertices_per_cell,
+              topology.cell_vertices[index].begin());
   }
-
-  cout << "Number of global vertices: " << num_global_vertices << endl;
-  cout << "Number of global cells: "    << num_global_cells << endl;
 }
 //-----------------------------------------------------------------------------
 void LocalMeshData::broadcast_mesh_data(const MPI_Comm mpi_comm)
@@ -177,15 +173,15 @@ void LocalMeshData::broadcast_mesh_data(const MPI_Comm mpi_comm)
   // Get number of processes
   const std::size_t num_processes = MPI::size(mpi_comm);
 
-  // Broadcast simple scalar data
+  // Broadcast simple int scalar data
   {
-    std::vector<std::size_t> values;
-    values.push_back(gdim);
-    values.push_back(tdim);
-    values.push_back(num_global_vertices);
-    values.push_back(num_global_cells);
-    values.push_back(num_vertices_per_cell);
-    values.push_back(cell_type);
+    std::vector<std::int64_t> values;
+    values.push_back(geometry.dim);
+    values.push_back(topology.dim);
+    values.push_back(geometry.num_global_vertices);
+    values.push_back(topology.num_global_cells);
+    values.push_back(topology.num_vertices_per_cell);
+    values.push_back(topology.cell_type);
     MPI::broadcast(mpi_comm, values);
   }
 
@@ -195,76 +191,78 @@ void LocalMeshData::broadcast_mesh_data(const MPI_Comm mpi_comm)
     for (std::size_t p = 0; p < num_processes; p++)
     {
       const std::pair<std::size_t, std::size_t> local_range
-        = MPI::local_range(mpi_comm, p, num_global_vertices);
+        = MPI::local_range(mpi_comm, p, geometry.num_global_vertices);
       log(TRACE, "Sending %d vertices to process %d, range is (%d, %d)",
-          local_range.second - local_range.first, p, local_range.first, local_range.second);
+          local_range.second - local_range.first, p, local_range.first,
+          local_range.second);
 
-      send_values[p].reserve(gdim*(local_range.second - local_range.first));
+      send_values[p].reserve(geometry.dim*(local_range.second - local_range.first));
       for (std::size_t i = local_range.first; i < local_range.second; i++)
       {
         send_values[p].insert(send_values[p].end(),
-                              vertex_coordinates[i].begin(),
-                              vertex_coordinates[i].end());
+                              geometry.vertex_coordinates[i].begin(),
+                              geometry.vertex_coordinates[i].end());
       }
     }
     std::vector<double> values;
     MPI::scatter(mpi_comm, send_values, values);
-    unpack_vertex_coordinates(values);
+    geometry.unpack_vertex_coordinates(values);
   }
 
   // Broadcast global vertex indices
   {
-    std::vector<std::vector<std::size_t>> send_values(num_processes);
+    std::vector<std::vector<std::int64_t>> send_values(num_processes);
     for (std::size_t p = 0; p < num_processes; p++)
     {
       const std::pair<std::size_t, std::size_t> local_range
-        = MPI::local_range(mpi_comm, p, num_global_vertices);
+        = MPI::local_range(mpi_comm, p, geometry.num_global_vertices);
       send_values[p].reserve(local_range.second - local_range.first);
       for (std::size_t i = local_range.first; i < local_range.second; i++)
-        send_values[p].push_back(vertex_indices[i]);
+        send_values[p].push_back(geometry.vertex_indices[i]);
     }
-    MPI::scatter(mpi_comm, send_values, vertex_indices);
+    MPI::scatter(mpi_comm, send_values, geometry.vertex_indices);
   }
 
   dolfin_debug("check");
   // Broadcast cell vertices
   {
-    std::vector<std::vector<std::size_t>> send_values(num_processes);
+    std::vector<std::vector<std::int64_t>> send_values(num_processes);
     for (std::size_t p = 0; p < num_processes; p++)
     {
       const std::pair<std::size_t, std::size_t> local_range
-        = MPI::local_range(mpi_comm, p, num_global_cells);
+        = MPI::local_range(mpi_comm, p, topology.num_global_cells);
       log(TRACE, "Sending %d cells to process %d, range is (%d, %d)",
           local_range.second - local_range.first, p, local_range.first, local_range.second);
       const std::size_t range = local_range.second - local_range.first;
-      send_values[p].reserve(range*(num_vertices_per_cell + 1));
+      send_values[p].reserve(range*(topology.num_vertices_per_cell + 1));
       for (std::size_t i = local_range.first; i < local_range.second; i++)
       {
-        send_values[p].push_back(global_cell_indices[i]);
+        send_values[p].push_back(topology.global_cell_indices[i]);
         send_values[p].insert(send_values[p].end(),
-                              cell_vertices[i].begin(), cell_vertices[i].end());
+                              topology.cell_vertices[i].begin(), topology.cell_vertices[i].end());
       }
     }
-    std::vector<std::size_t> values;
+    std::vector<std::int64_t> values;
     MPI::scatter(mpi_comm, send_values, values);
-    unpack_cell_vertices(values);
+    topology.unpack_cell_vertices(values);
   }
 }
 //-----------------------------------------------------------------------------
 void LocalMeshData::receive_mesh_data(const MPI_Comm mpi_comm)
 {
   dolfin_debug("check");
+
   // Receive simple scalar data
   {
-    std::vector<std::size_t> values;
+    std::vector<std::int64_t> values;
     MPI::broadcast(mpi_comm, values);
     dolfin_assert(values.size() == 6);
-    gdim = values[0];
-    tdim = values[1];
-    num_global_vertices = values[2];
-    num_global_cells = values[3];
-    num_vertices_per_cell = values[4];
-    cell_type = (CellType::Type)values[5];
+    geometry.dim = values[0];
+    topology.dim = values[1];
+    geometry.num_global_vertices = values[2];
+    topology.num_global_cells = values[3];
+    topology.num_vertices_per_cell = values[4];
+    topology.cell_type = (CellType::Type)values[5];
   }
 
   dolfin_debug("check");
@@ -273,41 +271,43 @@ void LocalMeshData::receive_mesh_data(const MPI_Comm mpi_comm)
     std::vector<std::vector<double>> send_values;
     std::vector<double> values;
     MPI::scatter(mpi_comm, send_values, values);
-    unpack_vertex_coordinates(values);
+    geometry.unpack_vertex_coordinates(values);
   }
 
   dolfin_debug("check");
   // Receive global vertex indices
   {
-    std::vector<std::vector<std::size_t>> send_values;
-    MPI::scatter(mpi_comm, send_values, vertex_indices);
+    std::vector<std::vector<std::int64_t>> send_values;
+    MPI::scatter(mpi_comm, send_values, geometry.vertex_indices);
   }
 
   dolfin_debug("check");
-  /// Receive coordinates for vertices
+  // Receive coordinates for vertices
   {
-    std::vector<std::vector<std::size_t>> send_values;
-    std::vector<std::size_t> values;
+    std::vector<std::vector<std::int64_t>> send_values;
+    std::vector<std::int64_t> values;
     MPI::scatter(mpi_comm, send_values, values);
-    unpack_cell_vertices(values);
+    topology.unpack_cell_vertices(values);
   }
 }
 //-----------------------------------------------------------------------------
-void LocalMeshData::unpack_vertex_coordinates(const std::vector<double>& values)
+void
+LocalMeshData::Geometry::unpack_vertex_coordinates(const std::vector<double>& values)
 {
-  dolfin_assert(values.size() % gdim == 0);
-  const std::size_t num_vertices = values.size()/gdim;
-  vertex_coordinates.resize(boost::extents[num_vertices][gdim]);
+  dolfin_assert(values.size() % dim == 0);
+  const std::size_t num_vertices = values.size()/dim;
+  vertex_coordinates.resize(boost::extents[num_vertices][dim]);
   for (std::size_t i = 0; i < num_vertices; i++)
   {
-    std::copy(values.begin() + i*gdim, values.begin() + (i + 1)*gdim,
+    std::copy(values.begin() + i*dim, values.begin() + (i + 1)*dim,
               vertex_coordinates[i].begin());
   }
 
   log(TRACE, "Received %d vertex coordinates", vertex_coordinates.size());
 }
 //-----------------------------------------------------------------------------
-void LocalMeshData::unpack_cell_vertices(const std::vector<std::size_t>& values)
+void
+LocalMeshData::Topology::unpack_cell_vertices(const std::vector<std::int64_t>& values)
 {
   const std::size_t num_cells = values.size()/(num_vertices_per_cell + 1);
   dolfin_assert(values.size() % (num_vertices_per_cell + 1) == 0);
@@ -317,10 +317,39 @@ void LocalMeshData::unpack_cell_vertices(const std::vector<std::size_t>& values)
   for (std::size_t i = 0; i < num_cells; i++)
   {
     global_cell_indices.push_back(values[k++]);
-    for (std::size_t j = 0; j < num_vertices_per_cell; j++)
+    for (int j = 0; j < num_vertices_per_cell; j++)
       cell_vertices[i][j] = values[k++];
   }
 
   log(TRACE, "Received %d cell vertices", cell_vertices.size());
 }
 //-----------------------------------------------------------------------------
+void LocalMeshData::reorder()
+{
+  const int dim0 = topology.cell_vertices.shape()[0];
+  const int dim1 = topology.cell_vertices.shape()[1];
+  dolfin_assert((int) topology.global_cell_indices.size() == dim0);
+
+  // Build a vector of first vertex index for each cell in vertex_indices
+  std::vector<std::pair<std::int64_t, std::int32_t>> keys(dim0);
+  for (int i = 0; i < dim0; ++i)
+    keys[i] = {*std::min_element(topology.cell_vertices[i].begin(), topology.cell_vertices[i].end()), i};
+
+  // Sort
+  std::sort(keys.begin(), keys.end());
+
+  // Copy cell_vertices and cell local-to-global array
+  boost::multi_array<std::int64_t, 2> _cell_vertices(boost::extents[dim0][dim1]);
+  _cell_vertices = topology.cell_vertices;
+  std::vector<std::int64_t> _global_cell_indices = topology.global_cell_indices;
+
+  // Re-map data
+  for (int i = 0; i < dim0; ++i)
+  {
+    auto key = keys[i];
+    topology.global_cell_indices[i] = _global_cell_indices[key.second];
+    for (int j = 0; j < dim1; ++j)
+      topology.cell_vertices[i][j] = _cell_vertices[key.second][j];
+  }
+}
+//-----------------------------------------------------------------------------
diff --git a/dolfin/mesh/LocalMeshData.h b/dolfin/mesh/LocalMeshData.h
index 6d313f1..dae9f52 100644
--- a/dolfin/mesh/LocalMeshData.h
+++ b/dolfin/mesh/LocalMeshData.h
@@ -26,6 +26,7 @@
 #ifndef __LOCAL_MESH_DATA_H
 #define __LOCAL_MESH_DATA_H
 
+#include <cstdint>
 #include <map>
 #include <vector>
 #include <boost/multi_array.hpp>
@@ -60,14 +61,18 @@ namespace dolfin
   public:
 
     /// Create empty local mesh data
-    LocalMeshData(const MPI_Comm mpi_comm);
+    explicit LocalMeshData(const MPI_Comm mpi_comm);
 
     /// Create local mesh data for given mesh
-    LocalMeshData(const Mesh& mesh);
+    explicit LocalMeshData(const Mesh& mesh);
 
     /// Destructor
     ~LocalMeshData();
 
+    /// Check that all essential data has been intialized, and throw error
+    /// if there is a problem
+    void check() const;
+
     /// Return informal string representation (pretty-print)
     std::string str(bool verbose) const;
 
@@ -84,53 +89,89 @@ namespace dolfin
     // Receive mesh data from main process
     void receive_mesh_data(const MPI_Comm mpi_comm);
 
-    // Unpack received vertex coordinates
-    void unpack_vertex_coordinates(const std::vector<double>& values);
+    // Reorder cell data
+    void reorder();
+
+    // Holder for geometry data
+    struct Geometry
+    {
+      Geometry() : dim(-1), num_global_vertices(-1) {}
+
+      // Geometric dimension
+      int dim;
+
+      // Global number of vertices
+      std::int64_t num_global_vertices;
+
+      // Coordinates for all vertices stored on local processor
+      boost::multi_array<double, 2> vertex_coordinates;
+
+      // Global vertex indices for all vertices stored on local processor
+      std::vector<std::int64_t> vertex_indices;
+
+      void clear()
+      {
+        dim = -1;
+        num_global_vertices = -1;
+        vertex_coordinates.resize(boost::extents[0][0]);
+        vertex_indices.clear();
+      }
 
-    // Unpack received cell vertices
-    void unpack_cell_vertices(const std::vector<std::size_t>& values);
+      // Unpack received vertex coordinates
+      void unpack_vertex_coordinates(const std::vector<double>& values);
+    };
+    Geometry geometry;
 
-    // Coordinates for all vertices stored on local processor
-    boost::multi_array<double, 2> vertex_coordinates;
+    // Holder for topology data
+    struct Topology
+    {
+      Topology() : dim(-1), num_global_cells(-1) {}
 
-    // Global vertex indices for all vertices stored on local processor
-    std::vector<std::size_t> vertex_indices;
+      // Topological dimension
+      int dim;
 
-    // Global vertex indices for all cells stored on local processor
-    boost::multi_array<std::size_t, 2> cell_vertices;
+      // Global number of cells
+      std::int64_t num_global_cells;
 
-    // Global cell numbers for all cells stored on local processor
-    std::vector<std::size_t> global_cell_indices;
+      // Number of vertices per cell
+      int num_vertices_per_cell;
 
-    // Optional process owner for each cell in global_cell_indices
-    std::vector<std::size_t> cell_partition;
+      // Global vertex indices for all cells stored on local processor
+      boost::multi_array<std::int64_t, 2> cell_vertices;
 
-    // Optional weight for each cell for partitioning
-    std::vector<std::size_t> cell_weight;
+      // Global cell numbers for all cells stored on local processor
+      std::vector<std::int64_t> global_cell_indices;
 
-    // Global number of vertices
-    std::size_t num_global_vertices;
+      // Optional process owner for each cell in global_cell_indices
+      std::vector<int> cell_partition;
 
-    // Global number of cells
-    std::size_t num_global_cells;
+      // Optional weight for each cell for partitioning
+      std::vector<std::size_t> cell_weight;
 
-    // Number of vertices per cell
-    std::size_t num_vertices_per_cell;
+      // Cell type
+      // FIXME: this should replace the need for num_vertices_per_cell and tdim
+      CellType::Type cell_type;
 
-    // Geometrical dimension
-    std::size_t gdim;
+      void clear()
+      {
+        dim = -1;
+        num_global_cells = -1;
+        num_vertices_per_cell = -1;
+        cell_vertices.resize(boost::extents[0][0]);
+        global_cell_indices.clear();
+        cell_partition.clear();
+        cell_weight.clear();
+      }
 
-    // Topological dimension
-    std::size_t tdim;
+      // Unpack received cell vertices
+      void unpack_cell_vertices(const std::vector<std::int64_t>& values);
 
-    // Cell type
-    // FIXME: this should replace the need for num_vertices_per_cell and tdim
-    CellType::Type cell_type;
+    };
+    Topology topology;
 
     // Mesh domain data [dim](line, (cell_index, local_index, value))
     std::map<std::size_t, std::vector<std::pair<std::pair<std::size_t,
-      std::size_t>, std::size_t> > >
-        domain_data;
+      std::size_t>, std::size_t>>> domain_data;
 
     // Return MPI communicator
     MPI_Comm mpi_comm() const
@@ -138,8 +179,7 @@ namespace dolfin
 
   private:
 
-    // MPI communicator. It is stored because it is used on some
-    // Zoltan call-back functions.
+    // MPI communicator
     MPI_Comm _mpi_comm;
 
   };
diff --git a/dolfin/mesh/LocalMeshValueCollection.h b/dolfin/mesh/LocalMeshValueCollection.h
index 8bf369b..ce20099 100644
--- a/dolfin/mesh/LocalMeshValueCollection.h
+++ b/dolfin/mesh/LocalMeshValueCollection.h
@@ -47,7 +47,7 @@ namespace dolfin
   public:
 
     /// Create local mesh data for given LocalMeshValueCollection
-    LocalMeshValueCollection(const MeshValueCollection<T>& values,
+    LocalMeshValueCollection(MPI_Comm comm, const MeshValueCollection<T>& values,
                              std::size_t dim);
 
     /// Destructor
@@ -79,9 +79,10 @@ namespace dolfin
   // Implementation of LocalMeshValueCollection
   //---------------------------------------------------------------------------
   template <typename T>
-  LocalMeshValueCollection<T>::LocalMeshValueCollection(const MeshValueCollection<T>& values,
-                                                        std::size_t dim)
-    : _dim(dim), _mpi_comm(MPI_COMM_WORLD)
+    LocalMeshValueCollection<T>::LocalMeshValueCollection(MPI_Comm comm,
+                                                          const MeshValueCollection<T>& values,
+                                                          std::size_t dim)
+    : _dim(dim), _mpi_comm(comm)
   {
     // Prepare data
     std::vector<std::vector<std::size_t> > send_indices;
@@ -127,9 +128,7 @@ namespace dolfin
       const std::size_t cell_index = indices[2*i];
       const std::size_t local_entity_index = indices[2*i + 1];
       const T value = v[i];
-      _values.push_back(std::make_pair(std::make_pair(cell_index,
-                                                      local_entity_index),
-                                       value));
+      _values.push_back({{cell_index, local_entity_index}, value});
     }
   }
   //---------------------------------------------------------------------------
diff --git a/dolfin/mesh/Mesh.cpp b/dolfin/mesh/Mesh.cpp
index 1528b48..de3bba5 100644
--- a/dolfin/mesh/Mesh.cpp
+++ b/dolfin/mesh/Mesh.cpp
@@ -54,8 +54,7 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-Mesh::Mesh() : Variable("mesh", "DOLFIN mesh"), Hierarchical<Mesh>(*this),
-               _ordered(false), _mpi_comm(MPI_COMM_WORLD)
+Mesh::Mesh() : Mesh(MPI_COMM_WORLD)
 {
   // Do nothing
 }
@@ -69,22 +68,19 @@ Mesh::Mesh(MPI_Comm comm) : Variable("mesh", "DOLFIN mesh"),
 //-----------------------------------------------------------------------------
 Mesh::Mesh(const Mesh& mesh) : Variable("mesh", "DOLFIN mesh"),
                                Hierarchical<Mesh>(*this), _ordered(false),
-                               _mpi_comm(MPI_COMM_WORLD)
+                               _mpi_comm(mesh.mpi_comm())
 {
   *this = mesh;
 }
 //-----------------------------------------------------------------------------
-Mesh::Mesh(std::string filename) : Variable("mesh", "DOLFIN mesh"),
-                                   Hierarchical<Mesh>(*this), _ordered(false),
-                                   _mpi_comm(MPI_COMM_WORLD)
+Mesh::Mesh(std::string filename) : Mesh(MPI_COMM_WORLD, filename)
 {
-  File file(_mpi_comm, filename);
-  file >> *this;
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
 Mesh::Mesh(MPI_Comm comm, std::string filename)
   : Variable("mesh", "DOLFIN mesh"), Hierarchical<Mesh>(*this), _ordered(false),
-    _mpi_comm(comm)
+  _mpi_comm(comm)
 {
   File file(_mpi_comm, filename);
   file >> *this;
@@ -92,9 +88,10 @@ Mesh::Mesh(MPI_Comm comm, std::string filename)
 //-----------------------------------------------------------------------------
 Mesh::Mesh(MPI_Comm comm, LocalMeshData& local_mesh_data)
   : Variable("mesh", "DOLFIN mesh"), Hierarchical<Mesh>(*this),
-    _ordered(false), _mpi_comm(comm)
+  _ordered(false), _mpi_comm(comm)
 {
-  MeshPartitioning::build_distributed_mesh(*this, local_mesh_data);
+  const std::string ghost_mode = parameters["ghost_mode"];
+  MeshPartitioning::build_distributed_mesh(*this, local_mesh_data, ghost_mode);
 }
 //-----------------------------------------------------------------------------
 Mesh::~Mesh()
@@ -225,17 +222,6 @@ void Mesh::init() const
       init(d0, d1);
 }
 //-----------------------------------------------------------------------------
-void Mesh::clear()
-{
-  _topology.clear();
-  _geometry.clear();
-  _data.clear();
-  _cell_type.reset();
-  _cell_type = 0;
-  _ordered = false;
-  _cell_orientations.clear();
-}
-//-----------------------------------------------------------------------------
 void Mesh::clean()
 {
   const std::size_t D = topology().dim();
@@ -293,21 +279,6 @@ void Mesh::rotate(double angle, std::size_t axis, const Point& point)
   MeshTransformation::rotate(*this, angle, axis, point);
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<MeshDisplacement> Mesh::move(BoundaryMesh& boundary)
-{
-  return ALE::move(*this, boundary);
-}
-//-----------------------------------------------------------------------------
-std::shared_ptr<MeshDisplacement> Mesh::move(Mesh& mesh)
-{
-  return ALE::move(*this, mesh);
-}
-//-----------------------------------------------------------------------------
-void Mesh::move(const GenericFunction& displacement)
-{
-  ALE::move(*this, displacement);
-}
-//-----------------------------------------------------------------------------
 void Mesh::smooth(std::size_t num_iterations)
 {
   MeshSmoothing::smooth(*this, num_iterations);
@@ -368,29 +339,26 @@ std::shared_ptr<BoundingBoxTree> Mesh::bounding_box_tree() const
 //-----------------------------------------------------------------------------
 double Mesh::hmin() const
 {
-  CellIterator cell(*this);
-  double h = cell->diameter();
-  for (; !cell.end(); ++cell)
-    h = std::min(h, cell->diameter());
+  double h = std::numeric_limits<double>::max();
+  for (CellIterator cell(*this); !cell.end(); ++cell)
+    h = std::min(h, cell->h());
 
   return h;
 }
 //-----------------------------------------------------------------------------
 double Mesh::hmax() const
 {
-  CellIterator cell(*this);
-  double h = cell->diameter();
-  for (; !cell.end(); ++cell)
-    h = std::max(h, cell->diameter());
+  double h = 0.0;
+  for (CellIterator cell(*this); !cell.end(); ++cell)
+    h = std::max(h, cell->h());
 
   return h;
 }
 //-----------------------------------------------------------------------------
 double Mesh::rmin() const
 {
-  CellIterator cell(*this);
-  double r = cell->inradius();
-  for (; !cell.end(); ++cell)
+  double r = std::numeric_limits<double>::max();
+  for (CellIterator cell(*this); !cell.end(); ++cell)
     r = std::min(r, cell->inradius());
 
   return r;
@@ -398,9 +366,8 @@ double Mesh::rmin() const
 //-----------------------------------------------------------------------------
 double Mesh::rmax() const
 {
-  CellIterator cell(*this);
-  double r = cell->inradius();
-  for (; !cell.end(); ++cell)
+  double r = 0.0;
+  for (CellIterator cell(*this); !cell.end(); ++cell)
     r = std::max(r, cell->inradius());
 
   return r;
diff --git a/dolfin/mesh/Mesh.h b/dolfin/mesh/Mesh.h
index 6e1d099..afdb7ac 100644
--- a/dolfin/mesh/Mesh.h
+++ b/dolfin/mesh/Mesh.h
@@ -17,16 +17,13 @@
 //
 // Modified by Johan Hoffman 2007
 // Modified by Magnus Vikstrøm 2007
-// Modified by Garth N. Wells 2007-2013
+// Modified by Garth N. Wells 2007-2015
 // Modified by Niclas Jansson 2008
 // Modified by Kristoffer Selim 2008
 // Modified by Andre Massing 2009-2010
 // Modified by Marie E. Rognes 2012
 // Modified by Mikael Mortensen 2012
 // Modified by Jan Blechta 2013
-//
-// First added:  2006-05-08
-// Last changed: 2014-08-11
 
 #ifndef __MESH_H
 #define __MESH_H
@@ -380,9 +377,6 @@ namespace dolfin
     /// Compute all entities and connectivity.
     void init() const;
 
-    /// Clear all mesh data.
-    void clear();
-
     /// Clean out all auxiliary topology data. This clears all
     /// topological data, except the connectivity between cells and
     /// vertices.
@@ -438,38 +432,6 @@ namespace dolfin
     ///         The point around which to rotate the mesh.
     void rotate(double angle, std::size_t axis, const Point& point);
 
-    /// Move coordinates of mesh according to new boundary coordinates.
-    ///
-    /// *Arguments*
-    ///     boundary (_BoundaryMesh_)
-    ///         A mesh containing just the boundary cells.
-    ///
-    /// *Returns*
-    ///     MeshDisplacement
-    ///         Displacement encapsulated in Expression subclass
-    ///         MeshDisplacement.
-    std::shared_ptr<MeshDisplacement> move(BoundaryMesh& boundary);
-
-    /// Move coordinates of mesh according to adjacent mesh with
-    /// common global vertices.
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         A _Mesh_ object.
-    ///
-    /// *Returns*
-    ///     MeshDisplacement
-    ///         Displacement encapsulated in Expression subclass
-    ///         MeshDisplacement.
-    std::shared_ptr<MeshDisplacement> move(Mesh& mesh);
-
-    /// Move coordinates of mesh according to displacement function.
-    ///
-    /// *Arguments*
-    ///     displacement (_GenericFunction_)
-    ///         A _GenericFunction_ object.
-    void move(const GenericFunction& displacement);
-
     /// Smooth internal vertices of mesh by local averaging.
     ///
     /// *Arguments*
@@ -533,15 +495,15 @@ namespace dolfin
     ///     std::vector<std::size_t>
     ///         The colors as a mesh function over entities of the mesh.
     const std::vector<std::size_t>&
-      color(std::vector<std::size_t> coloring_type) const;
+    color(std::vector<std::size_t> coloring_type) const;
 
-    /// Compute minimum cell diameter.
+    /// Compute minimum cell size in mesh, measured greatest distance
+    /// between any two vertices of a cell.
     ///
     /// *Returns*
     ///     double
-    ///         The minimum cell diameter, the diameter is computed as
-    ///         two times the circumradius
-    ///         (http://mathworld.wolfram.com).
+    ///         The minimum cell size. The size is computed using
+    ///         Cell::h()
     ///
     /// *Example*
     ///     .. note::
@@ -549,13 +511,13 @@ namespace dolfin
     ///         No example code available for this function.
     double hmin() const;
 
-    /// Compute maximum cell diameter.
+    /// Compute maximum cell size in mesh, measured greatest distance
+    /// between any two vertices of a cell.
     ///
     /// *Returns*
     ///     double
-    ///         The maximum cell diameter, the diameter is computed as
-    ///         two times the circumradius
-    ///         (http://mathworld.wolfram.com).
+    ///         The maximum cell size. The size is computed using
+    ///         Cell::h()
     ///
     /// *Example*
     ///     .. note::
@@ -634,12 +596,14 @@ namespace dolfin
     MPI_Comm mpi_comm() const
     { return _mpi_comm; }
 
+    // Friend in fem_utils.h
+    friend Mesh create_mesh(Function&);
+
   private:
 
     // Friends
     friend class MeshEditor;
     friend class TopologyComputation;
-    friend class BinaryFile;
 
     // Mesh topology
     MeshTopology _topology;
diff --git a/dolfin/mesh/MeshColoring.cpp b/dolfin/mesh/MeshColoring.cpp
index 1e33049..4303121 100644
--- a/dolfin/mesh/MeshColoring.cpp
+++ b/dolfin/mesh/MeshColoring.cpp
@@ -22,6 +22,7 @@
 // Last changed: 2011-11-14
 
 #include <map>
+#include <memory>
 #include <utility>
 #include <dolfin/common/Array.h>
 #include <dolfin/common/utils.h>
@@ -54,8 +55,7 @@ const std::vector<std::size_t>& MeshColoring::color_cells(Mesh& mesh,
 }
 //-----------------------------------------------------------------------------
 const std::vector<std::size_t>&
-MeshColoring::color(Mesh& mesh,
-                    const std::vector<std::size_t>& coloring_type)
+MeshColoring::color(Mesh& mesh, const std::vector<std::size_t>& coloring_type)
 {
   // Convenience typedefs
   typedef std::pair<std::vector<std::size_t>,
@@ -97,9 +97,10 @@ MeshColoring::color(Mesh& mesh,
   return colors;
 }
 //-----------------------------------------------------------------------------
-std::size_t MeshColoring::compute_colors(const Mesh& mesh,
-                                          std::vector<std::size_t>& colors,
-                                          const std::vector<std::size_t>& coloring_type)
+std::size_t
+MeshColoring::compute_colors(const Mesh& mesh,
+                             std::vector<std::size_t>& colors,
+                             const std::vector<std::size_t>& coloring_type)
 {
   if (coloring_type.front() != coloring_type.back())
   {
@@ -119,31 +120,36 @@ std::size_t MeshColoring::compute_colors(const Mesh& mesh,
   return GraphColoring::compute_local_vertex_coloring(graph, colors);
 }
 //-----------------------------------------------------------------------------
-CellFunction<std::size_t> MeshColoring::cell_colors(const Mesh& mesh,
-                                       std::string coloring_type)
+CellFunction<std::size_t>
+MeshColoring::cell_colors(std::shared_ptr<const Mesh> mesh,
+                          std::string coloring_type)
 {
+  dolfin_assert(mesh);
+
   // Get graph/coloring type
-  const std::size_t dim = MeshColoring::type_to_dim(coloring_type, mesh);
+  const std::size_t dim = MeshColoring::type_to_dim(coloring_type, *mesh);
   std::vector<std::size_t> _coloring_type;
-  _coloring_type.push_back(mesh.topology().dim());
+  _coloring_type.push_back(mesh->topology().dim());
   _coloring_type.push_back(dim);
-  _coloring_type.push_back(mesh.topology().dim());
+  _coloring_type.push_back(mesh->topology().dim());
 
   return cell_colors(mesh, _coloring_type);
 }
 //-----------------------------------------------------------------------------
-CellFunction<std::size_t> MeshColoring::cell_colors(const Mesh& mesh,
-                              const std::vector<std::size_t> coloring_type)
+CellFunction<std::size_t>
+MeshColoring::cell_colors(std::shared_ptr<const Mesh> mesh,
+                          std::vector<std::size_t> coloring_type)
 {
+  dolfin_assert(mesh);
 
   // Get color data
   std::map<std::vector<std::size_t>, std::pair<std::vector<std::size_t>,
            std::vector<std::vector<std::size_t>>>>::const_iterator
     coloring_data;
-  coloring_data = mesh.topology().coloring.find(coloring_type);
+  coloring_data = mesh->topology().coloring.find(coloring_type);
 
   // Check that coloring has been computed
-  if (coloring_data == mesh.topology().coloring.end())
+  if (coloring_data == mesh->topology().coloring.end())
   {
     dolfin_error("MeshColoring.cpp",
                  "get coloring as MeshFunction",
@@ -154,9 +160,10 @@ CellFunction<std::size_t> MeshColoring::cell_colors(const Mesh& mesh,
   const std::vector<std::size_t>& colors = coloring_data->second.first;
 
   CellFunction<std::size_t> mf(mesh);
-  dolfin_assert(colors.size() == mesh.num_entities(coloring_type[0]));
-  for (CellIterator cell(mesh); !cell.end(); ++cell)
+  dolfin_assert(colors.size() == mesh->num_entities(coloring_type[0]));
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
     mf[*cell] = colors[cell->index()];
+
   return mf;
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/mesh/MeshColoring.h b/dolfin/mesh/MeshColoring.h
index 4973816..7f4b6aa 100644
--- a/dolfin/mesh/MeshColoring.h
+++ b/dolfin/mesh/MeshColoring.h
@@ -23,6 +23,7 @@
 #ifndef __MESH_COLORING_H
 #define __MESH_COLORING_H
 
+#include <memory>
 #include <string>
 #include <vector>
 #include "Cell.h"
@@ -40,16 +41,16 @@ namespace dolfin
   public:
 
     /// Color the cells of a mesh for given coloring type, which can
-    /// be one of "vertex", "edge" or "facet". Coloring is saved in the
-    /// mesh topology
+    /// be one of "vertex", "edge" or "facet". Coloring is saved in
+    /// the mesh topology
     static const std::vector<std::size_t>& color_cells(Mesh& mesh,
                                                  std::string coloring_type);
 
     /// Color the cells of a mesh for given coloring type specified by
-    /// topological dimension, which can be one of 0, 1 or D - 1. Coloring
-    /// is saved in the mesh topology
-    static const std::vector<std::size_t>& color(Mesh& mesh,
-                                       const std::vector<std::size_t>& coloring_type);
+    /// topological dimension, which can be one of 0, 1 or D -
+    /// 1. Coloring is saved in the mesh topology
+    static const std::vector<std::size_t>&
+      color(Mesh& mesh, const std::vector<std::size_t>& coloring_type);
 
     /// Compute cell colors for given coloring type specified by
     /// topological dimension, which can be one of 0, 1 or D - 1.
@@ -57,13 +58,16 @@ namespace dolfin
                                std::vector<std::size_t>& colors,
                                const std::vector<std::size_t>& coloring_type);
 
-    /// Return a MeshFunction with the cell colors (used for visualisation)
-    static CellFunction<std::size_t> cell_colors(const Mesh& mesh,
-                                           std::string coloring_type);
+    /// Return a MeshFunction with the cell colors (used for
+    /// visualisation)
+    static CellFunction<std::size_t>
+      cell_colors(std::shared_ptr<const Mesh> mesh,
+                  std::string coloring_type);
 
     /// Return a MeshFunction with the cell colors (used for visualisation)
-    static CellFunction<std::size_t> cell_colors(const Mesh& mesh,
-						                              const std::vector<std::size_t> coloring_type);
+    static CellFunction<std::size_t>
+      cell_colors(std::shared_ptr<const Mesh> mesh,
+                  std::vector<std::size_t> coloring_type);
 
 
     /// Convert coloring type to topological dimension
diff --git a/dolfin/mesh/MeshConnectivity.h b/dolfin/mesh/MeshConnectivity.h
index bbf9d98..b9ec2a6 100644
--- a/dolfin/mesh/MeshConnectivity.h
+++ b/dolfin/mesh/MeshConnectivity.h
@@ -63,8 +63,8 @@ namespace dolfin
     /// Return number of connections for given entity
     std::size_t size(std::size_t entity) const
     {
-      return ( (entity + 1) < index_to_position.size()
-          ? index_to_position[entity + 1] - index_to_position[entity] : 0);
+      return (entity + 1) < index_to_position.size()
+          ? index_to_position[entity + 1] - index_to_position[entity] : 0;
     }
 
     /// Return global number of connections for given entity
@@ -82,8 +82,8 @@ namespace dolfin
     /// Return array of connections for given entity
     const unsigned int* operator() (std::size_t entity) const
     {
-      return ((entity + 1) < index_to_position.size()
-        ? &_connections[index_to_position[entity]] : 0);
+      return (entity + 1) < index_to_position.size()
+        ? &_connections[index_to_position[entity]] : 0;
     }
 
     /// Return contiguous array of connections for all entities
@@ -121,17 +121,18 @@ namespace dolfin
     /// Set all connections for given entity
     void set(std::size_t entity, std::size_t* connections);
 
-    /// Set all connections for all entities (T is a container, e.g.
-    /// a std::vector<std::size_t>, std::set<std::size_t>, etc)
+    /// Set all connections for all entities (T is a '2D' container, e.g. a
+    /// std::vector<<std::vector<std::size_t>>,
+    /// std::vector<<std::set<std::size_t>>, etc)
     template <typename T>
-    void set(const std::vector<T>& connections)
+    void set(const T& connections)
     {
       // Clear old data if any
       clear();
 
       // Initialize offsets and compute total size
       index_to_position.resize(connections.size() + 1);
-      unsigned int size = 0;
+      std::int32_t size = 0;
       for (std::size_t e = 0; e < connections.size(); e++)
       {
         index_to_position[e] = size;
@@ -141,9 +142,10 @@ namespace dolfin
 
       // Initialize connections
       _connections.reserve(size);
-      typename std::vector<T>::const_iterator e;
-      for (e = connections.begin(); e != connections.end(); ++e)
+      for (auto e = connections.begin(); e != connections.end(); ++e)
         _connections.insert(_connections.end(), e->begin(), e->end());
+
+      _connections.shrink_to_fit();
     }
 
     /// Set global number of connections for all local entities
@@ -163,10 +165,6 @@ namespace dolfin
 
   private:
 
-    // Friends
-    friend class BinaryFile;
-    friend class MeshRenumbering;
-
     // Dimensions (only used for pretty-printing)
     std::size_t _d0, _d1;
 
diff --git a/dolfin/mesh/MeshEditor.cpp b/dolfin/mesh/MeshEditor.cpp
index 0eaf664..db571e6 100644
--- a/dolfin/mesh/MeshEditor.cpp
+++ b/dolfin/mesh/MeshEditor.cpp
@@ -41,21 +41,22 @@ MeshEditor::~MeshEditor()
   // Do nothing
 }
 //-----------------------------------------------------------------------------
-void MeshEditor::open(Mesh& mesh, std::size_t tdim, std::size_t gdim)
+void MeshEditor::open(Mesh& mesh, std::size_t tdim,
+                      std::size_t gdim, std::size_t degree)
 {
   switch (tdim)
   {
   case 0:
-    open(mesh, CellType::point, tdim, gdim);
+    open(mesh, CellType::point, tdim, gdim, degree);
     break;
   case 1:
-    open(mesh, CellType::interval, tdim, gdim);
+    open(mesh, CellType::interval, tdim, gdim, degree);
     break;
   case 2:
-    open(mesh, CellType::triangle, tdim, gdim);
+    open(mesh, CellType::triangle, tdim, gdim, degree);
     break;
   case 3:
-    open(mesh, CellType::tetrahedron, tdim, gdim);
+    open(mesh, CellType::tetrahedron, tdim, gdim, degree);
     break;
   default:
     dolfin_error("MeshEditor.cpp",
@@ -65,10 +66,9 @@ void MeshEditor::open(Mesh& mesh, std::size_t tdim, std::size_t gdim)
 }
 //-----------------------------------------------------------------------------
 void MeshEditor::open(Mesh& mesh, CellType::Type type, std::size_t tdim,
-                      std::size_t gdim)
+                      std::size_t gdim, std::size_t degree)
 {
-  // Clear old mesh data
-  mesh.clear();
+  // Clear old data
   clear();
 
   // Save mesh and dimension
@@ -82,6 +82,9 @@ void MeshEditor::open(Mesh& mesh, CellType::Type type, std::size_t tdim,
   // Initialize topological dimension
   mesh._topology.init(tdim);
 
+  // Initialize geometric dimension and degree
+  mesh._geometry.init(gdim, degree);
+
   // Initialize domains
   mesh._domains.init(tdim);
 
@@ -90,16 +93,16 @@ void MeshEditor::open(Mesh& mesh, CellType::Type type, std::size_t tdim,
 }
 //-----------------------------------------------------------------------------
 void MeshEditor::open(Mesh& mesh, std::string type, std::size_t tdim,
-                      std::size_t gdim)
+                      std::size_t gdim, std::size_t degree)
 {
   if (type == "point")
-    open(mesh, CellType::point, tdim, gdim);
+    open(mesh, CellType::point, tdim, gdim, degree);
   else if (type == "interval")
-    open(mesh, CellType::interval, tdim, gdim);
+    open(mesh, CellType::interval, tdim, gdim, degree);
   else if (type == "triangle")
-    open(mesh, CellType::triangle, tdim, gdim);
+    open(mesh, CellType::triangle, tdim, gdim, degree);
   else if (type == "tetrahedron")
-    open(mesh, CellType::tetrahedron, tdim, gdim);
+    open(mesh, CellType::tetrahedron, tdim, gdim, degree);
   else
   {
     dolfin_error("MeshEditor.cpp",
@@ -124,7 +127,34 @@ void MeshEditor::init_vertices_global(std::size_t num_local_vertices,
   _mesh->_topology.init(0, num_local_vertices, num_global_vertices);
   _mesh->_topology.init_ghost(0, num_local_vertices);
   _mesh->_topology.init_global_indices(0, num_local_vertices);
-  _mesh->_geometry.init(_gdim, num_local_vertices);
+  std::vector<std::size_t> num_vertex_points(1, num_local_vertices);
+  _mesh->_geometry.init_entities(num_vertex_points);
+}
+//-----------------------------------------------------------------------------
+void MeshEditor::init_entities()
+{
+  dolfin_assert(_tdim > 0);
+  dolfin_assert(_mesh);
+
+  if (_mesh->topology().size(_tdim) == 0
+      or next_cell != _num_cells)
+  {
+    dolfin_error("MeshEditor.cpp",
+                 "initialise topological entities",
+                 "It is required to add all cells before initialising other entities");
+  }
+
+  // Initialise entities required for this polynomial degree
+  _mesh->order();
+  std::size_t dmax = std::min(_mesh->_geometry.degree(), _tdim);
+  for (std::size_t d = 1; d < dmax; ++d)
+    _mesh->init(d);
+
+  // Create space in the MeshGeometry coordinates for the new entity points
+  std::vector<std::size_t> num_entities(_tdim + 1, 0);
+  for (std::size_t d = 0; d <= _tdim; ++d)
+    num_entities[d] = _mesh->topology().size(d);
+  _mesh->_geometry.init_entities(num_entities);
 }
 //-----------------------------------------------------------------------------
 void MeshEditor::init_cells_global(std::size_t num_local_cells,
@@ -192,8 +222,7 @@ void MeshEditor::add_vertex_global(std::size_t local_index,
   add_vertex_common(local_index, _gdim);
 
   // Set coordinate
-  std::vector<double> x(p.coordinates(), p.coordinates() + _gdim);
-  _mesh->_geometry.set(local_index, x);
+  _mesh->_geometry.set(local_index, p.coordinates());
   _mesh->_topology.set_global_index(0, local_index, global_index);
 }
 //-----------------------------------------------------------------------------
@@ -205,10 +234,17 @@ void MeshEditor::add_vertex_global(std::size_t local_index,
   add_vertex_common(local_index, x.size());
 
   // Set coordinate
-  _mesh->_geometry.set(local_index, x);
+  _mesh->_geometry.set(local_index, x.data());
   _mesh->_topology.set_global_index(0, local_index, global_index);
 }
 //-----------------------------------------------------------------------------
+void MeshEditor::add_entity_point(std::size_t entity_dim, std::size_t order,
+                                  std::size_t index, const Point& p)
+{
+  const std::size_t idx = _mesh->_geometry.get_entity_index(entity_dim, order, index);
+  _mesh->_geometry.set(idx, p.coordinates());
+}
+//-----------------------------------------------------------------------------
 void MeshEditor::add_cell(std::size_t c, std::size_t v0, std::size_t v1)
 {
   dolfin_assert(_tdim == 1);
diff --git a/dolfin/mesh/MeshEditor.h b/dolfin/mesh/MeshEditor.h
index 65572c8..39dab07 100644
--- a/dolfin/mesh/MeshEditor.h
+++ b/dolfin/mesh/MeshEditor.h
@@ -52,15 +52,16 @@ namespace dolfin
     ///         The topological dimension.
     ///     gdim (std::size_t)
     ///         The geometrical dimension.
-    ///
+    ///     degree (std::size_t)
+    ///         The polynomial degree.
     /// *Example*
     ///     .. code-block:: c++
     ///
     ///         Mesh mesh;
     ///         MeshEditor editor;
-    ///         editor.open(mesh, 2, 2);
+    ///         editor.open(mesh, 2, 2, 1);
     ///
-    void open(Mesh& mesh, std::size_t tdim, std::size_t gdim);
+    void open(Mesh& mesh, std::size_t tdim, std::size_t gdim, std::size_t degree=1);
 
     /// Open mesh of given cell type, topological and geometrical dimension
     ///
@@ -73,8 +74,10 @@ namespace dolfin
     ///         The topological dimension.
     ///     gdim (std::size_t)
     ///         The geometrical dimension.
+    ///     degree (std::size_t)
+    ///         The polynomial degree.
     void open(Mesh& mesh, CellType::Type type, std::size_t tdim,
-              std::size_t gdim);
+              std::size_t gdim, std::size_t degree=1);
 
     /// Open mesh of given cell type, topological and geometrical dimension
     ///
@@ -87,7 +90,10 @@ namespace dolfin
     ///         The topological dimension.
     ///     gdim (std::size_t)
     ///         The geometrical dimension.
-    void open(Mesh& mesh, std::string type, std::size_t tdim, std::size_t gdim);
+    ///     degree (std::size_t)
+    ///         The polynomial degree.
+    void open(Mesh& mesh, std::string type, std::size_t tdim,
+              std::size_t gdim, std::size_t degree=1);
 
     /// Specify number of vertices (serial version)
     ///
@@ -106,6 +112,14 @@ namespace dolfin
     void init_vertices(std::size_t num_vertices)
     { init_vertices_global(num_vertices, num_vertices); }
 
+    /// Initialise entities in MeshGeometry
+    ///
+    /// Create required Edges and Faces for the current polynomial degree
+    /// in the mesh topology, so that points can be added for them.
+    /// In order to initialise entities, cells must all be added first.
+    ///
+    void init_entities();
+
     /// Specify number of vertices (distributed version)
     ///
     /// *Arguments*
@@ -113,6 +127,8 @@ namespace dolfin
     ///         The number of vertices on this process.
     ///     num_global_vertices (std::size_t)
     ///         The number of vertices in distributed mesh.
+    ///     degree (std::size_t)
+    ///         The polynomial degree of the mesh.
     ///
     /// *Example*
     ///     .. code-block:: c++
@@ -235,6 +251,10 @@ namespace dolfin
     void add_vertex_global(std::size_t local_index, std::size_t global_index,
                            const std::vector<double>& x);
 
+    /// Add a point in a given entity of dimension entity_dim
+    void add_entity_point(std::size_t entity_dim, std::size_t order,
+                          std::size_t index, const Point& p);
+
     /// Add cell with given vertices (1D)
     ///
     /// *Arguments*
diff --git a/dolfin/mesh/MeshEntity.cpp b/dolfin/mesh/MeshEntity.cpp
index b02266d..c143261 100644
--- a/dolfin/mesh/MeshEntity.cpp
+++ b/dolfin/mesh/MeshEntity.cpp
@@ -155,7 +155,7 @@ unsigned int MeshEntity::owner() const
     dolfin_error("MeshEntity.cpp",
                  "get ownership of entity",
                  "Ownership of non-ghost cells is local process");
-  
+
   return _mesh->topology().cell_owner()[_local_index - offset];
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/mesh/MeshEntity.h b/dolfin/mesh/MeshEntity.h
index c52fc5b..f0c7078 100644
--- a/dolfin/mesh/MeshEntity.h
+++ b/dolfin/mesh/MeshEntity.h
@@ -219,21 +219,21 @@ namespace dolfin
     /// Return set of sharing processes
     std::set<unsigned int> sharing_processes() const
     {
-      const std::map<unsigned int, std::set<unsigned int> >& sharing_map
+      const std::map<std::int32_t, std::set<unsigned int>>& sharing_map
         = _mesh->topology().shared_entities(_dim);
       const auto map_it = sharing_map.find(_local_index);
       if (map_it == sharing_map.end())
-        return std::set<unsigned int>();
+        return {};
       else
         return map_it->second;
     }
 
-    /// Determine if an entity is shared or not    
+    /// Determine if an entity is shared or not
     bool is_shared() const
     {
       if (_mesh->topology().have_shared_entities(_dim))
       {
-        const std::map<unsigned int, std::set<unsigned int> >& sharing_map
+        const std::map<std::int32_t, std::set<unsigned int>>& sharing_map
           = _mesh->topology().shared_entities(_dim);
         return (sharing_map.find(_local_index) != sharing_map.end());
       }
@@ -242,7 +242,7 @@ namespace dolfin
 
     /// Get ownership of this entity - only really valid for cells
     unsigned int owner() const;
-    
+
     // Note: Not a subclass of Variable for efficiency!
     /// Return informal string representation (pretty-print)
     ///
diff --git a/dolfin/mesh/MeshFunction.h b/dolfin/mesh/MeshFunction.h
index 61d81d3..069e021 100644
--- a/dolfin/mesh/MeshFunction.h
+++ b/dolfin/mesh/MeshFunction.h
@@ -27,9 +27,8 @@
 #include <map>
 #include <vector>
 
-#include <boost/scoped_array.hpp>
 #include <memory>
-#include <boost/unordered_set.hpp>
+#include <unordered_set>
 #include <dolfin/common/Hierarchical.h>
 #include <dolfin/common/MPI.h>
 #include <dolfin/common/NoDeleter.h>
@@ -48,14 +47,14 @@ namespace dolfin
   class MeshEntity;
 
   /// A MeshFunction is a function that can be evaluated at a set of
-  /// mesh entities. A MeshFunction is discrete and is only defined
-  /// at the set of mesh entities of a fixed topological dimension.
-  /// A MeshFunction may for example be used to store a global
-  /// numbering scheme for the entities of a (parallel) mesh, marking
-  /// sub domains or boolean markers for mesh refinement.
+  /// mesh entities. A MeshFunction is discrete and is only defined at
+  /// the set of mesh entities of a fixed topological dimension.  A
+  /// MeshFunction may for example be used to store a global numbering
+  /// scheme for the entities of a (parallel) mesh, marking sub
+  /// domains or boolean markers for mesh refinement.
 
   template <typename T> class MeshFunction : public Variable,
-    public Hierarchical<MeshFunction<T> >
+    public Hierarchical<MeshFunction<T>>
   {
   public:
 
@@ -67,13 +66,6 @@ namespace dolfin
     /// *Arguments*
     ///     mesh (_Mesh_)
     ///         The mesh to create mesh function on.
-    explicit MeshFunction(const Mesh& mesh);
-
-    /// Create empty mesh function on given mesh (shared_ptr version)
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh to create mesh function on.
     explicit MeshFunction(std::shared_ptr<const Mesh> mesh);
 
     /// Create mesh function of given dimension on given mesh
@@ -83,16 +75,6 @@ namespace dolfin
     ///         The mesh to create mesh function on.
     ///     dim (std::size_t)
     ///         The mesh entity dimension for the mesh function.
-    MeshFunction(const Mesh& mesh, std::size_t dim);
-
-    /// Create mesh function of given dimension on given mesh
-    /// (shared_ptr version)
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh to create mesh function on.
-    ///     dim (std::size_t)
-    ///         The mesh entity dimension for the mesh function.
     MeshFunction(std::shared_ptr<const Mesh> mesh, std::size_t dim);
 
     /// Create mesh of given dimension on given mesh and initialize
@@ -105,30 +87,9 @@ namespace dolfin
     ///         The mesh entity dimension.
     ///     value (T)
     ///         The value.
-    MeshFunction(const Mesh& mesh, std::size_t dim, const T& value);
-
-    /// Create mesh of given dimension on given mesh and initialize
-    /// to a value (shared_ptr version)
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh to create mesh function on.
-    ///     dim (std::size_t)
-    ///         The mesh entity dimension.
-    ///     value (T)
-    ///         The value.
     MeshFunction(std::shared_ptr<const Mesh> mesh, std::size_t dim,
                  const T& value);
 
-    /// Create function from data file
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh to create mesh function on.
-    ///     filename (std::string)
-    ///         The filename to create mesh function from.
-    MeshFunction(const Mesh& mesh, const std::string filename);
-
     /// Create function from data file (shared_ptr version)
     ///
     /// *Arguments*
@@ -139,16 +100,6 @@ namespace dolfin
     MeshFunction(std::shared_ptr<const Mesh> mesh,
                  const std::string filename);
 
-    /// Create function from a MeshValueCollecion
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh to create mesh function on.
-    ///     value_collection (_MeshValueCollection_ <T>)
-    ///         The mesh value collection for the mesh function data.
-    MeshFunction(const Mesh& mesh,
-                 const MeshValueCollection<T>& value_collection);
-
     /// Create function from a MeshValueCollecion (shared_ptr version)
     ///
     /// *Arguments*
@@ -309,31 +260,9 @@ namespace dolfin
     ///         The mesh.
     ///     dim (std::size_t)
     ///         The dimension.
-    void init(const Mesh& mesh, std::size_t dim);
-
-    /// Initialize mesh function for given topological dimension
-    /// (shared_ptr version)
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh.
-    ///     dim (std::size_t)
-    ///         The dimension.
     void init(std::shared_ptr<const Mesh> mesh, std::size_t dim);
 
     /// Initialize mesh function for given topological dimension of
-    /// given size
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh.
-    ///     dim (std::size_t)
-    ///         The dimension.
-    ///     size (std::size_t)
-    ///         The size.
-    void init(const Mesh& mesh, std::size_t dim, std::size_t size);
-
-    /// Initialize mesh function for given topological dimension of
     /// given size (shared_ptr version)
     ///
     /// *Arguments*
@@ -386,9 +315,10 @@ namespace dolfin
 
   private:
 
-    // Values at the set of mesh entities. We don't use a std::vector<T>
-    // here because it has trouble with bool, which C++ specialises.
-    boost::scoped_array<T> _values;
+    // Values at the set of mesh entities. We don't use a
+    // std::vector<T> here because it has trouble with bool, which C++
+    // specialises.
+    std::unique_ptr<T[]> _values;
 
     // The mesh
     std::shared_ptr<const Mesh> _mesh;
@@ -407,115 +337,62 @@ namespace dolfin
   // Implementation of MeshFunction
   //---------------------------------------------------------------------------
   template <typename T>
-    MeshFunction<T>::MeshFunction() : Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this), _values(0), _dim(0),
-    _size(0)
-  {
-    // Do nothing
-  }
-  //---------------------------------------------------------------------------
-  template <typename T>
-    MeshFunction<T>::MeshFunction(const Mesh& mesh)
-    : Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this),
-    _mesh(reference_to_no_delete_pointer(mesh)), _dim(0), _size(0)
+  MeshFunction<T>::MeshFunction() : MeshFunction(nullptr)
   {
     // Do nothing
   }
   //---------------------------------------------------------------------------
   template <typename T>
-    MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh)
+  MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh)
     : Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this), _mesh(mesh), _dim(0), _size(0)
+      Hierarchical<MeshFunction<T>>(*this), _mesh(mesh), _dim(0), _size(0)
   {
     // Do nothing
   }
   //---------------------------------------------------------------------------
   template <typename T>
-  MeshFunction<T>::MeshFunction(const Mesh& mesh, std::size_t dim)
-    : Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this),
-    _mesh(reference_to_no_delete_pointer(mesh)) , _dim(0), _size(0)
-  {
-    init(dim);
-  }
-  //---------------------------------------------------------------------------
-  template <typename T>
-    MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh,
-                                  std::size_t dim)
+  MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh,
+                                std::size_t dim)
     : Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this), _mesh(mesh), _dim(0), _size(0)
+      Hierarchical<MeshFunction<T>>(*this), _mesh(mesh), _dim(0), _size(0)
   {
     init(dim);
   }
   //---------------------------------------------------------------------------
   template <typename T>
-  MeshFunction<T>::MeshFunction(const Mesh& mesh, std::size_t dim,
-                                const T& value)
-    : Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this),
-    _mesh(reference_to_no_delete_pointer(mesh)), _dim(0), _size(0)
+  MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh,
+                                std::size_t dim, const T& value)
+    : MeshFunction(mesh, dim)
+
   {
-    init(dim);
     set_all(value);
   }
   //---------------------------------------------------------------------------
   template <typename T>
     MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh,
-                                   std::size_t dim, const T& value)
-  : Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this), _mesh(mesh), _dim(0), _size(0)
-  {
-    init(dim);
-    set_all(value);
-  }
-  //---------------------------------------------------------------------------
-  template <typename T>
-  MeshFunction<T>::MeshFunction(const Mesh& mesh, const std::string filename)
-    : Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this),
-    _mesh(reference_to_no_delete_pointer(mesh)), _dim(0), _size(0)
-  {
-    File file(filename);
-    file >> *this;
-  }
-  //---------------------------------------------------------------------------
-  template <typename T>
-    MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh,
                                   const std::string filename)
     : Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this), _mesh(mesh), _dim(0), _size(0)
+    Hierarchical<MeshFunction<T>>(*this), _mesh(mesh), _dim(0), _size(0)
   {
     File file(filename);
     file >> *this;
   }
   //---------------------------------------------------------------------------
   template <typename T>
-  MeshFunction<T>::MeshFunction(const Mesh& mesh,
-    const MeshValueCollection<T>& value_collection) :
-    Variable("f", "unnamed MeshFunction"),
-      Hierarchical<MeshFunction<T> >(*this),
-      _mesh(reference_to_no_delete_pointer(mesh)),
-      _dim(value_collection.dim()), _size(0)
-  {
-    *this = value_collection;
-  }
-  //---------------------------------------------------------------------------
-  template <typename T>
     MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh,
                                   const MeshValueCollection<T>& value_collection)
     : Variable("f", "unnamed MeshFunction"),
-      Hierarchical<MeshFunction<T> >(*this), _mesh(mesh),
+      Hierarchical<MeshFunction<T>>(*this), _mesh(mesh),
       _dim(value_collection.dim()), _size(0)
   {
     *this = value_collection;
   }
   //---------------------------------------------------------------------------
   template <typename T>
-    MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh,
-                                  std::size_t dim, const MeshDomains& domains)
+  MeshFunction<T>::MeshFunction(std::shared_ptr<const Mesh> mesh,
+                                std::size_t dim, const MeshDomains& domains)
     : Variable("f", "unnamed MeshFunction"),
-      Hierarchical<MeshFunction<T> >(*this), _mesh(mesh), _dim(0), _size(0)
+      Hierarchical<MeshFunction<T>>(*this), _mesh(mesh), _dim(0), _size(0)
   {
     dolfin_assert(_mesh);
 
@@ -551,7 +428,7 @@ namespace dolfin
   template <typename T>
   MeshFunction<T>::MeshFunction(const MeshFunction<T>& f) :
     Variable("f", "unnamed MeshFunction"),
-    Hierarchical<MeshFunction<T> >(*this), _dim(0), _size(0)
+    Hierarchical<MeshFunction<T>>(*this), _dim(0), _size(0)
   {
     *this = f;
   }
@@ -566,7 +443,7 @@ namespace dolfin
     _size = f._size;
     std::copy(f._values.get(), f._values.get() + _size, _values.get());
 
-    Hierarchical<MeshFunction<T> >::operator=(f);
+    Hierarchical<MeshFunction<T>>::operator=(f);
 
     return *this;
   }
@@ -592,7 +469,7 @@ namespace dolfin
     set_all(std::numeric_limits<T>::max());
 
     // Iterate over all values
-    boost::unordered_set<std::size_t> entities_values_set;
+    std::unordered_set<std::size_t> entities_values_set;
     typename std::map<std::pair<std::size_t, std::size_t>, T>::const_iterator it;
     const std::map<std::pair<std::size_t, std::size_t>, T>& values
       = mesh_value_collection.values();
@@ -708,7 +585,7 @@ namespace dolfin
     const MeshFunction<T>& MeshFunction<T>::operator= (const T& value)
   {
     set_all(value);
-    //Hierarchical<MeshFunction<T> >::operator=(value);
+    //Hierarchical<MeshFunction<T>>::operator=(value);
     return *this;
   }
   //---------------------------------------------------------------------------
@@ -740,13 +617,6 @@ namespace dolfin
   }
   //---------------------------------------------------------------------------
   template <typename T>
-    void MeshFunction<T>::init(const Mesh& mesh, std::size_t dim)
-  {
-    mesh.init(dim);
-    init(mesh, dim, mesh.size(dim));
-  }
-  //---------------------------------------------------------------------------
-  template <typename T>
     void MeshFunction<T>::init(std::shared_ptr<const Mesh> mesh,
                                std::size_t dim)
   {
@@ -756,22 +626,6 @@ namespace dolfin
   }
   //---------------------------------------------------------------------------
   template <typename T>
-    void MeshFunction<T>::init(const Mesh& mesh, std::size_t dim,
-                               std::size_t size)
-  {
-    // Initialize mesh for entities of given dimension
-    mesh.init(dim);
-    dolfin_assert(mesh.size(dim) == size);
-
-    // Initialize data
-    if (_size != size)
-      _values.reset(new T[size]);
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _dim = dim;
-    _size = size;
-  }
-  //---------------------------------------------------------------------------
-  template <typename T>
     void MeshFunction<T>::init(std::shared_ptr<const Mesh> mesh,
                                std::size_t dim, std::size_t size)
   {
diff --git a/dolfin/mesh/MeshGeometry.cpp b/dolfin/mesh/MeshGeometry.cpp
index 0f04b7e..ad09663 100644
--- a/dolfin/mesh/MeshGeometry.cpp
+++ b/dolfin/mesh/MeshGeometry.cpp
@@ -30,7 +30,7 @@
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
-MeshGeometry::MeshGeometry() : _dim(0)
+MeshGeometry::MeshGeometry() : _dim(0), _degree(1)
 {
   // Do nothing
 }
@@ -42,72 +42,80 @@ MeshGeometry::MeshGeometry(const MeshGeometry& geometry) : _dim(0)
 //-----------------------------------------------------------------------------
 MeshGeometry::~MeshGeometry()
 {
-  clear();
+  // Do nothing
 }
 //-----------------------------------------------------------------------------
 const MeshGeometry& MeshGeometry::operator= (const MeshGeometry& geometry)
 {
-  // Copy data
-  _dim = geometry._dim;
-  coordinates             = geometry.coordinates;
-  position_to_local_index = geometry.position_to_local_index;
-  local_index_to_position = geometry.local_index_to_position;
+  // Try init; may fail with non-matching _dim and _degree
+  init(geometry._dim, geometry._degree);
+
+  // Copy remaining data
+  coordinates = geometry.coordinates;
+  entity_offsets = geometry.entity_offsets;
 
   return *this;
 }
 //-----------------------------------------------------------------------------
 Point MeshGeometry::point(std::size_t n) const
 {
-  double _x = 0.0;
-  double _y = 0.0;
-  double _z = 0.0;
-
-  if ( _dim > 0 )
-    _x = x(n, 0);
-  if ( _dim > 1 )
-    _y = x(n, 1);
-  if ( _dim > 2 )
-    _z = x(n, 2);
-
-  Point p(_x, _y, _z);
-  return p;
+  return Point(_dim, x(n));;
 }
 //-----------------------------------------------------------------------------
-void MeshGeometry::clear()
+void MeshGeometry::init(std::size_t dim, std::size_t degree)
 {
-  _dim  = 0;
-  coordinates.clear();
-  position_to_local_index.clear();
-  local_index_to_position.clear();
+  // Check input
+  if (dim == 0)
+  {
+    dolfin_error("MeshGeometry.cpp",
+                 "initialize mesh geometry",
+                 "Mesh geometry of dimension zero is not supported");
+  }
+  if (degree == 0)
+  {
+    dolfin_error("MeshGeometry.cpp",
+                 "initialize mesh geometry",
+                 "Mesh geometry of degree zero is not supported");
+  }
+
+  // Avoid repeated initialization; would be a hell for UFL
+  if (_dim > 0 && (_dim != dim || _degree != degree))
+  {
+    dolfin_error("MeshGeometry.cpp",
+                 "initialize mesh geometry",
+                 "Mesh geometry cannot be reinitialized with different "
+                 "dimension and/or degree");
+  }
+
+  // Save dimension and degree
+  _dim = dim;
+  _degree = degree;
 }
 //-----------------------------------------------------------------------------
-void MeshGeometry::init(std::size_t dim, std::size_t size)
+void MeshGeometry::init_entities(const std::vector<std::size_t>& num_entities)
 {
-  // Delete old data if any
-  clear();
-
-  // Allocate new data
-  coordinates.resize(dim*size);
-
-  // Allocate new data
-  position_to_local_index.resize(size);
-  local_index_to_position.resize(size);
+  // Check some kind of initialisation has been done
+  dolfin_assert(_dim > 0);
 
-  // Save dimension and size
-  _dim = dim;
+  // Calculate offset into coordinates for each block of points
+  std::size_t offset = 0;
+  entity_offsets.resize(num_entities.size());
+  for (std::size_t i = 0; i != num_entities.size(); ++i)
+  {
+    entity_offsets[i].clear();
+    for (std::size_t j = 0; j != num_entity_coordinates(i); ++j)
+    {
+      entity_offsets[i].push_back(offset);
+      offset += num_entities[i];
+    }
+  }
+  coordinates.resize(_dim*offset);
 }
 //-----------------------------------------------------------------------------
 void MeshGeometry::set(std::size_t local_index,
-                       const std::vector<double>& x)
+                       const double* x)
 {
-  dolfin_assert(x.size() == _dim);
-  std::copy(x.begin(), x.end(), coordinates.begin() + local_index*_dim);
-
-  dolfin_assert(local_index < position_to_local_index.size());
-  position_to_local_index[local_index] = local_index;
-
-  dolfin_assert(local_index < local_index_to_position.size());
-  local_index_to_position[local_index] = local_index;
+  std::copy(x, x +_dim, coordinates.begin() + local_index*_dim);
 }
 //-----------------------------------------------------------------------------
 std::size_t MeshGeometry::hash() const
@@ -124,7 +132,7 @@ std::string MeshGeometry::str(bool verbose) const
   if (verbose)
   {
     s << str(false) << std::endl << std::endl;
-    for (std::size_t i = 0; i < size(); i++)
+    for (std::size_t i = 0; i < num_vertices(); i++)
     {
       s << "  " << i << ":";
       for (std::size_t d = 0; d < _dim; d++)
@@ -134,7 +142,10 @@ std::string MeshGeometry::str(bool verbose) const
     s << std::endl;
   }
   else
-    s << "<MeshGeometry of dimension " << _dim << " and size " << size() << ">";
+  {
+    s << "<MeshGeometry of dimension " << _dim << " and size "
+      << num_vertices() << ">";
+  }
 
   return s.str();
 }
diff --git a/dolfin/mesh/MeshGeometry.h b/dolfin/mesh/MeshGeometry.h
index d226a47..99819e9 100644
--- a/dolfin/mesh/MeshGeometry.h
+++ b/dolfin/mesh/MeshGeometry.h
@@ -18,7 +18,7 @@
 // Modified by Garth N. Wells, 2008.
 //
 // First added:  2006-05-08
-// Last changed: 2010-11-29
+// Last changed: 2016-06-10
 
 #ifndef __MESH_GEOMETRY_H
 #define __MESH_GEOMETRY_H
@@ -30,7 +30,6 @@
 
 namespace dolfin
 {
-
   /// MeshGeometry stores the geometry imposed on a mesh. Currently,
   /// the geometry is represented by the set of coordinates for the
   /// vertices of a mesh, but other representations are possible.
@@ -57,41 +56,64 @@ namespace dolfin
     std::size_t dim() const
     { return _dim; }
 
+    /// Return polynomial degree of coordinate field
+    std::size_t degree() const
+    { return _degree; }
+
     /// Return number of coordinates
     std::size_t size() const
     {
+      deprecation("MeshGeometry::size()", "2016.1",
+                  "Use MeshGeometry::num_vertices() or MeshGeometry::num_points() instead.");
+      return num_vertices();
+    }
+
+    /// Return the number of vertex coordinates
+    std::size_t num_vertices() const
+    {
       dolfin_assert(coordinates.size() % _dim == 0);
+      if (_degree > 1)
+      {
+        dolfin_assert(entity_offsets.size() > 1);
+        dolfin_assert(entity_offsets[1].size() > 0);
+        return entity_offsets[1][0];
+      }
       return coordinates.size()/_dim;
     }
 
-    /// Return value of coordinate with local index n in direction i
-    double& x(std::size_t n, std::size_t i)
+    /// Return the total number of points in the geometry, located on
+    /// any entity
+    std::size_t num_points() const
     {
-      dolfin_assert(n < local_index_to_position.size());
-      dolfin_assert(i < _dim);
-      return coordinates[local_index_to_position[n]*_dim + i];
+      dolfin_assert(coordinates.size() % _dim == 0);
+      return coordinates.size()/_dim;
     }
 
-    /// Return value of coordinate with local index n in direction i
-    double x(std::size_t n, std::size_t i) const
+    const double* vertex_coordinates(std::size_t point_index)
     {
-      dolfin_assert(n < local_index_to_position.size());
-      dolfin_assert(i < _dim);
-      return coordinates[local_index_to_position[n]*_dim + i];
+      dolfin_assert(point_index < num_vertices());
+      return &coordinates[point_index*_dim];
     }
 
-    /// Return array of values for coordinate with local index n
-    double* x(std::size_t n)
+    const double* point_coordinates(std::size_t point_index)
+    {
+      dolfin_assert(point_index*_dim < coordinates.size());
+      return &coordinates[point_index*_dim];
+    }
+
+    /// Return value of coordinate with local index n in direction i
+    double x(std::size_t n, std::size_t i) const
     {
-      dolfin_assert(n < local_index_to_position.size());
-      return &coordinates[local_index_to_position[n]*_dim];
+      dolfin_assert((n*_dim + i) < coordinates.size());
+      dolfin_assert(i < _dim);
+      return coordinates[n*_dim + i];
     }
 
     /// Return array of values for coordinate with local index n
     const double* x(std::size_t n) const
     {
-      dolfin_assert(n < local_index_to_position.size());
-      return &coordinates[local_index_to_position[n]*_dim];
+      dolfin_assert(n*_dim < coordinates.size());
+      return &coordinates[n*_dim];
     }
 
     /// Return array of values for all coordinates
@@ -105,15 +127,47 @@ namespace dolfin
     /// Return coordinate with local index n as a 3D point value
     Point point(std::size_t n) const;
 
-    /// Clear all data
-    void clear();
+    /// Initialize coordinate list to given dimension and degree
+    void init(std::size_t dim, std::size_t degree);
+
+    /// Initialise entities. To be called after init
+    void init_entities(const std::vector<std::size_t>& num_entities);
+
+    /// Get the number of coordinate points per entity for this degree
+    std::size_t num_entity_coordinates(std::size_t entity_dim) const
+    {
+      // Calculate the number of points per entity for Lagrange
+      // elements
+      switch(entity_dim)
+      {
+      case 0:
+        return 1;
+      case 1:
+        return (_degree - 1);
+      case 2:
+        return (_degree - 2)*(_degree - 1)/2;
+      case 3:
+        return (_degree - 3)*(_degree - 2)*(_degree - 1)/6;
+      }
+      dolfin_error("MeshGeometry.h",
+                   "calculate number of points",
+                   "Entity dimension out of range");
+      return 0;
+    }
 
-    /// Initialize coordinate list to given dimension and size
-    void init(std::size_t dim, std::size_t size);
+    /// Get the index for an entity point in coordinates
+    std::size_t get_entity_index(std::size_t entity_dim, std::size_t order,
+                                 std::size_t index) const
+    {
+      dolfin_assert(entity_dim < entity_offsets.size());
+      dolfin_assert(order < entity_offsets[entity_dim].size());
+      const std::size_t idx = (entity_offsets[entity_dim][order] + index);
+      dolfin_assert(idx*_dim < coordinates.size());
+      return idx;
+    }
 
     /// Set value of coordinate
-    //void set(std::size_t n, std::size_t i, double x);
-    void set(std::size_t local_index, const std::vector<double>& x);
+    void set(std::size_t local_index, const double* x);
 
     /// Hash of coordinate values
     ///
@@ -128,20 +182,17 @@ namespace dolfin
 
   private:
 
-    // Friends
-    friend class BinaryFile;
-
     // Euclidean dimension
     std::size_t _dim;
 
-    // Coordinates for all vertices stored as a contiguous array
-    std::vector<double> coordinates;
+    // Polynomial degree (1 = linear, 2 = quadratic etc.)
+    std::size_t _degree;
 
-    // Local coordinate indices (array position -> index)
-    std::vector<unsigned int> position_to_local_index;
+    // Offsets to storage for coordinate points for each entity type
+    std::vector<std::vector<std::size_t>> entity_offsets;
 
-    // Local coordinate indices (local index -> array position)
-    std::vector<unsigned int> local_index_to_position;
+    // Coordinates for all points stored as a contiguous array
+    std::vector<double> coordinates;
 
   };
 
diff --git a/dolfin/mesh/MeshHierarchy.cpp b/dolfin/mesh/MeshHierarchy.cpp
index 9d6dd8b..fe8a44d 100644
--- a/dolfin/mesh/MeshHierarchy.cpp
+++ b/dolfin/mesh/MeshHierarchy.cpp
@@ -18,6 +18,7 @@
 
 #include<map>
 
+#include <dolfin/parameter/GlobalParameters.h>
 #include <dolfin/mesh/DistributedMeshTools.h>
 #include <dolfin/mesh/LocalMeshData.h>
 #include <dolfin/mesh/Mesh.h>
@@ -62,20 +63,22 @@ std::shared_ptr<const MeshHierarchy> MeshHierarchy::refine(
 std::shared_ptr<const MeshHierarchy>
 MeshHierarchy::coarsen(const MeshFunction<bool>& coarsen_markers) const
 {
-  const Mesh& mesh = *(_meshes.back());
+  std::shared_ptr<const Mesh> mesh = _meshes.back();
+  dolfin_assert(mesh);
 
   // Make sure there is a parent MeshHierarchy
   dolfin_assert(_parent != NULL);
-  const Mesh& parent_mesh = *(_parent->_meshes.back());
+  std::shared_ptr<const Mesh> parent_mesh = _parent->_meshes.back();
+  dolfin_assert(parent_mesh);
 
   // Make sure markers are on finest mesh
-  dolfin_assert(coarsen_markers.mesh()->id() == mesh.id());
+  dolfin_assert(coarsen_markers.mesh()->id() == mesh->id());
 
   // FIXME: copy across boundaries in parallel
   std::set<std::size_t> coarsening_vertices;
   if (coarsen_markers.dim() == 0)
   {
-    for (VertexIterator v(mesh); !v.end(); ++v)
+    for (VertexIterator v(*mesh); !v.end(); ++v)
       if (coarsen_markers[*v])
         coarsening_vertices.insert(v->global_index());
   }
@@ -85,7 +88,7 @@ MeshHierarchy::coarsen(const MeshFunction<bool>& coarsen_markers) const
     // entity around a vertex is marked, then the vertex is
     // marked. Should this be "AND"-like behaviour, i.e. require
     // all surrounding entities to be marked?
-    for (MeshEntityIterator c(mesh, coarsen_markers.dim());
+    for (MeshEntityIterator c(*mesh, coarsen_markers.dim());
          !c.end(); ++c)
     {
       if (coarsen_markers[*c])
@@ -101,7 +104,7 @@ MeshHierarchy::coarsen(const MeshFunction<bool>& coarsen_markers) const
 
   // Find edges which were previously refined, but now only mark them
   // if not a parent of a "coarsening" vertex
-  for (EdgeIterator e(parent_mesh); !e.end(); ++e)
+  for (EdgeIterator e(*parent_mesh); !e.end(); ++e)
   {
     auto edge_it = edge_to_vertex.find(e->index());
     if (edge_it != edge_to_vertex.end())
@@ -117,12 +120,12 @@ MeshHierarchy::coarsen(const MeshFunction<bool>& coarsen_markers) const
     }
   }
 
-  std::shared_ptr<Mesh> refined_mesh(new Mesh);
-  std::shared_ptr<MeshHierarchy> refined_hierarchy(new MeshHierarchy);
-  std::shared_ptr<MeshRelation> refined_relation(new MeshRelation);
+  auto refined_mesh = std::make_shared<Mesh>();
+  auto refined_hierarchy = std::make_shared<MeshHierarchy>();
+  auto refined_relation = std::make_shared<MeshRelation>();
 
   // Refine with no redistribution
-  PlazaRefinementND::refine(*refined_mesh, parent_mesh,
+  PlazaRefinementND::refine(*refined_mesh, *parent_mesh,
                             edge_markers, true, *refined_relation);
 
   refined_hierarchy->_meshes = _parent->_meshes;
@@ -178,47 +181,46 @@ std::shared_ptr<Mesh> MeshHierarchy::rebalance() const
                  "rebalance MeshHierarchy", "Not applicable in serial");
 
   LocalMeshData local_mesh_data(coarse_mesh.mpi_comm());
-  local_mesh_data.cell_weight = weight();
+  local_mesh_data.topology.cell_weight = weight();
 
   const std::size_t tdim = coarse_mesh.topology().dim();
-  local_mesh_data.tdim = tdim;
+  local_mesh_data.topology.dim = tdim;
   const std::size_t gdim = coarse_mesh.geometry().dim();
-  local_mesh_data.gdim = gdim;
-  local_mesh_data.num_vertices_per_cell = tdim + 1;
+  local_mesh_data.geometry.dim = gdim;
+  local_mesh_data.topology.num_vertices_per_cell = tdim + 1;
 
   // Cells
 
-  local_mesh_data.num_global_cells = coarse_mesh.size_global(tdim);
+  local_mesh_data.topology.num_global_cells = coarse_mesh.size_global(tdim);
   const std::size_t num_local_cells = coarse_mesh.size(tdim);
-  local_mesh_data.global_cell_indices.resize(num_local_cells);
-  local_mesh_data.cell_vertices.resize(boost::extents[num_local_cells]
-                               [local_mesh_data.num_vertices_per_cell]);
+  local_mesh_data.topology.global_cell_indices.resize(num_local_cells);
+  local_mesh_data.topology.cell_vertices.resize(boost::extents[num_local_cells][local_mesh_data.topology.num_vertices_per_cell]);
 
   for (CellIterator c(coarse_mesh); !c.end(); ++c)
   {
     const std::size_t cell_index = c->index();
-    local_mesh_data.global_cell_indices[cell_index] = c->global_index();
+    local_mesh_data.topology.global_cell_indices[cell_index] = c->global_index();
     for (VertexIterator v(*c); !v.end(); ++v)
-      local_mesh_data.cell_vertices[cell_index][v.pos()] = v->global_index();
+      local_mesh_data.topology.cell_vertices[cell_index][v.pos()] = v->global_index();
   }
 
   // Vertices - must be reordered into global order
 
   const std::size_t num_local_vertices = coarse_mesh.size(0);
-  local_mesh_data.num_global_vertices = coarse_mesh.size_global(0);
-  local_mesh_data.vertex_indices.resize(num_local_vertices);
+  local_mesh_data.geometry.num_global_vertices = coarse_mesh.size_global(0);
+  local_mesh_data.geometry.vertex_indices.resize(num_local_vertices);
   for (VertexIterator v(coarse_mesh); !v.end(); ++v)
-    local_mesh_data.vertex_indices[v->index()] = v->global_index();
-  local_mesh_data.vertex_coordinates.resize(boost::extents[num_local_vertices]
-                                            [gdim]);
+    local_mesh_data.geometry.vertex_indices[v->index()] = v->global_index();
+  local_mesh_data.geometry.vertex_coordinates.resize(boost::extents[num_local_vertices][gdim]);
 
-  std::vector<double> vertex_coords =
+  const std::vector<double> vertex_coords =
     DistributedMeshTools::reorder_vertices_by_global_indices(coarse_mesh);
   std::copy(vertex_coords.begin(), vertex_coords.end(),
-            local_mesh_data.vertex_coordinates.data());
+            local_mesh_data.geometry.vertex_coordinates.data());
 
   std::shared_ptr<Mesh> mesh(new Mesh(coarse_mesh.mpi_comm()));
-  MeshPartitioning::build_distributed_mesh(*mesh, local_mesh_data);
+  const std::string ghost_mode = dolfin::parameters["ghost_mode"];
+  MeshPartitioning::build_distributed_mesh(*mesh, local_mesh_data, ghost_mode);
 
   return mesh;
 }
diff --git a/dolfin/mesh/MeshPartitioning.cpp b/dolfin/mesh/MeshPartitioning.cpp
index 0f2f101..2b73b37 100644
--- a/dolfin/mesh/MeshPartitioning.cpp
+++ b/dolfin/mesh/MeshPartitioning.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2014 Niclas Jansson, Ola Skavhaug, Anders Logg
+// Copyright (C) 2008-2014 Niclas Jansson, Ola Skavhaug, Anders Logg,
 // Garth N. Wells and Chris Richardson
 //
 // This file is part of DOLFIN.
@@ -23,8 +23,10 @@
 //
 
 #include <algorithm>
+#include <cstdint>
 #include <iterator>
 #include <map>
+#include <memory>
 #include <numeric>
 #include <set>
 #include <boost/multi_array.hpp>
@@ -36,9 +38,9 @@
 #include <dolfin/graph/GraphBuilder.h>
 #include <dolfin/graph/ParMETIS.h>
 #include <dolfin/graph/SCOTCH.h>
-#include <dolfin/graph/ZoltanPartition.h>
 #include <dolfin/parameter/GlobalParameters.h>
 
+#include "CellType.h"
 #include "DistributedMeshTools.h"
 #include "Facet.h"
 #include "LocalMeshData.h"
@@ -85,12 +87,14 @@ void MeshPartitioning::build_distributed_mesh(Mesh& mesh)
     LocalMeshData local_mesh_data(mesh);
 
     // Build distributed mesh
-    build_distributed_mesh(mesh, local_mesh_data);
+    const std::string ghost_mode = parameters["ghost_mode"];
+    build_distributed_mesh(mesh, local_mesh_data, ghost_mode);
   }
 }
 //-----------------------------------------------------------------------------
 void MeshPartitioning::build_distributed_mesh(Mesh& mesh,
-                            const std::vector<std::size_t>& cell_destinations)
+                            const std::vector<int>& cell_destinations,
+                            const std::string ghost_mode)
 {
   if (MPI::size(mesh.mpi_comm()) > 1)
   {
@@ -98,81 +102,96 @@ void MeshPartitioning::build_distributed_mesh(Mesh& mesh,
     LocalMeshData local_mesh_data(mesh);
 
     // Attach cell destinations
-    local_mesh_data.cell_partition = cell_destinations;
+    local_mesh_data.topology.cell_partition = cell_destinations;
 
     // Build distributed mesh
-    build_distributed_mesh(mesh, local_mesh_data);
+    build_distributed_mesh(mesh, local_mesh_data, ghost_mode);
   }
 }
 //-----------------------------------------------------------------------------
 void MeshPartitioning::build_distributed_mesh(Mesh& mesh,
-                                              const LocalMeshData& local_data)
+                                              const LocalMeshData& local_data,
+                                              const std::string ghost_mode)
 {
+  log(PROGRESS, "Building distributed mesh");
+
+  Timer timer("Build distributed mesh from local mesh data");
+
+  // Get mesh partitioner
+  const std::string partitioner = parameters["mesh_partitioner"];
+
+  // MPI communicator
+  MPI_Comm comm = mesh.mpi_comm();
+
   // Compute cell partitioning or use partitioning provided in local_data
-  std::vector<std::size_t> cell_partition;
-  std::map<std::size_t, dolfin::Set<unsigned int>> ghost_procs;
-  if (local_data.cell_partition.empty())
-    partition_cells(mesh.mpi_comm(), local_data, cell_partition, ghost_procs);
+  std::vector<int> cell_partition;
+  std::map<std::int64_t, std::vector<int>> ghost_procs;
+  if (local_data.topology.cell_partition.empty())
+    partition_cells(comm, local_data, partitioner, cell_partition, ghost_procs);
   else
   {
-    cell_partition = local_data.cell_partition;
-    dolfin_assert(cell_partition.size()
-                  == local_data.global_cell_indices.size());
-    dolfin_assert(*std::max_element(cell_partition.begin(),
-                                    cell_partition.end())
-                  < MPI::size(mesh.mpi_comm()));
+    // Copy cell partition
+    cell_partition = local_data.topology.cell_partition;
+    dolfin_assert(cell_partition.size() == local_data.topology.global_cell_indices.size());
+    dolfin_assert(*std::max_element(cell_partition.begin(), cell_partition.end())
+                  < (int) MPI::size(comm));
   }
 
-  const std::string ghost_mode = parameters["ghost_mode"];
-
   if (ghost_procs.empty() && ghost_mode != "none")
   {
-    // FIXME: need to generate ghost cell information here
-    // by doing a facet-matching operation "GraphBuilder" style
+    // FIXME: need to generate ghost cell information here by doing a
+    // facet-matching operation "GraphBuilder" style
     dolfin_error("MeshPartitioning.cpp",
                  "build ghost mesh",
                  "Ghost cell information not available");
   }
 
   // Build mesh from local mesh data and provided cell partition
-  build(mesh, local_data, cell_partition, ghost_procs);
+  build(mesh, local_data, cell_partition, ghost_procs, ghost_mode);
 
   // Create MeshDomains from local_data
   // FIXME: probably not working with ghost cells?
   build_mesh_domains(mesh, local_data);
 
-  // Initialise number of globally connected cells to each facet. This is
-  // necessary to distinguish between facets on an exterior boundary and
-  // facets on a partition boundary (see
+  // Initialise number of globally connected cells to each facet. This
+  // is necessary to distinguish between facets on an exterior
+  // boundary and facets on a partition boundary (see
   // https://bugs.launchpad.net/dolfin/+bug/733834).
   DistributedMeshTools::init_facet_cell_connections(mesh);
 }
 //-----------------------------------------------------------------------------
-void MeshPartitioning::partition_cells(
-  const MPI_Comm& mpi_comm,
-  const LocalMeshData& mesh_data,
-  std::vector<std::size_t>& cell_partition,
-  std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs)
+void
+MeshPartitioning::partition_cells(const MPI_Comm& mpi_comm,
+                                  const LocalMeshData& mesh_data,
+                                  const std::string partitioner,
+                                  std::vector<int>& cell_partition,
+                                  std::map<std::int64_t, std::vector<int>>& ghost_procs)
 {
+  log(PROGRESS, "Compute partition of cells across processes");
+
+  // Clear data
+  cell_partition.clear();
+  ghost_procs.clear();
+
+  std::unique_ptr<CellType> cell_type(CellType::create(mesh_data.topology.cell_type));
+  dolfin_assert(cell_type);
 
   // Compute cell partition using partitioner from parameter system
-  const std::string partitioner = parameters["mesh_partitioner"];
   if (partitioner == "SCOTCH")
-    SCOTCH::compute_partition(mpi_comm, cell_partition, ghost_procs, mesh_data);
-  else if (partitioner == "ParMETIS")
   {
-    ParMETIS::compute_partition(mpi_comm, cell_partition, ghost_procs,
-                                mesh_data);
-  }
-  else if (partitioner == "Zoltan_RCB")
-  {
-    ZoltanPartition::compute_partition_rcb(mpi_comm, cell_partition,
-                                           mesh_data);
+    SCOTCH::compute_partition(mpi_comm, cell_partition, ghost_procs,
+                              mesh_data.topology.cell_vertices,
+                              mesh_data.topology.cell_weight,
+                              mesh_data.geometry.num_global_vertices,
+                              mesh_data.topology.num_global_cells,
+                              *cell_type);
   }
-  else if (partitioner == "Zoltan_PHG")
+  else if (partitioner == "ParMETIS")
   {
-    ZoltanPartition::compute_partition_phg(mpi_comm, cell_partition,
-                                           mesh_data);
+    ParMETIS::compute_partition(mpi_comm, cell_partition, ghost_procs,
+                                mesh_data.topology.cell_vertices,
+                                mesh_data.geometry.num_global_vertices,
+                                *cell_type);
   }
   else
   {
@@ -183,86 +202,130 @@ void MeshPartitioning::partition_cells(
 }
 //-----------------------------------------------------------------------------
 void MeshPartitioning::build(Mesh& mesh, const LocalMeshData& mesh_data,
-     const std::vector<std::size_t>& cell_partition,
-     const std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs)
+                             const std::vector<int>& cell_partition,
+                             const std::map<std::int64_t, std::vector<int>>& ghost_procs,
+                             const std::string ghost_mode)
 {
   // Distribute cells
-  Timer timer("PARALLEL 2: Distribute mesh (cells and vertices)");
-
-  // Structure to hold received data about local mesh
-  LocalMeshData new_mesh_data(mesh.mpi_comm());
-
-  // Copy over some basic information
-  new_mesh_data.tdim = mesh_data.tdim;
-  new_mesh_data.gdim = mesh_data.gdim;
-  new_mesh_data.num_global_cells = mesh_data.num_global_cells;
-  new_mesh_data.num_vertices_per_cell
-    = mesh_data.num_vertices_per_cell;
-  new_mesh_data.cell_type = mesh_data.cell_type;
-  new_mesh_data.num_global_vertices = mesh_data.num_global_vertices;
-
-  // Keep tabs on ghost cell ownership
-  std::map<unsigned int, std::set<unsigned int>> shared_cells;
-  // Send cells to processes that need them
-  const unsigned int num_regular_cells =
-    distribute_cells(mesh.mpi_comm(), mesh_data,
-                     cell_partition, ghost_procs,
-                     shared_cells, new_mesh_data);
-
-  const std::string ghost_mode = parameters["ghost_mode"];
+  log(PROGRESS, "Distribute mesh (cell and vertices)");
+
+  Timer timer("Distribute mesh (cells and vertices)");
+
+  // Topological dimension
+  const int tdim = mesh_data.topology.dim;
+
+  const std::int64_t num_global_vertices = mesh_data.geometry.num_global_vertices;
+  const std::int32_t num_cell_vertices = mesh_data.topology.num_vertices_per_cell;
+
+  // FIXME: explain structure of shared_cells
+  // Keep tabs on ghost cell ownership (map from local cell index to
+  // sharing processes)
+
+  // Send cells to processes that need them. Returns
+  // 0. Number of regular cells on this process
+  // 1. Map from local cell index to to sharing process for ghosted cells
+  boost::multi_array<std::int64_t, 2> new_cell_vertices;
+  std::vector<std::int64_t> new_global_cell_indices;
+  std::vector<int> new_cell_partition;
+  std::map<std::int32_t, std::set<unsigned int>> shared_cells;
+
+  // Send cells to owning process accoring to cell_partition, and
+  // receive cells that belong to this process. Also compute auxiliary
+  // data related to sharing,
+  const std::int32_t num_regular_cells
+    = distribute_cells(mesh.mpi_comm(), mesh_data, cell_partition, ghost_procs,
+                       new_cell_vertices, new_global_cell_indices,
+                       new_cell_partition, shared_cells);
 
   if (ghost_mode == "shared_vertex")
   {
-    // Send/receive additional cells
-    // defined by connectivity to the shared vertices.
-    // Add new cells to new_mesh_data
-    distribute_cell_layer(mesh.mpi_comm(),
-                          num_regular_cells,
-                          shared_cells,
-                          new_mesh_data);
+    // Send/receive additional cells defined by connectivity to the shared
+    // vertices.
+    distribute_cell_layer(mesh.mpi_comm(), num_regular_cells,
+                          num_global_vertices, shared_cells, new_cell_vertices,
+                          new_global_cell_indices, new_cell_partition);
   }
   else if (ghost_mode == "none")
   {
     // Resize to remove all ghost cells
-    new_mesh_data.cell_partition.resize(num_regular_cells);
-    new_mesh_data.global_cell_indices.resize(num_regular_cells);
-    const std::size_t num_cell_vertices = mesh_data.num_vertices_per_cell;
-    new_mesh_data.cell_vertices.resize
-      (boost::extents[num_regular_cells][num_cell_vertices]);
+    new_cell_partition.resize(num_regular_cells);
+    new_global_cell_indices.resize(num_regular_cells);
+    new_cell_vertices.resize(boost::extents[num_regular_cells][num_cell_vertices]);
     shared_cells.clear();
   }
 
-#ifdef HAS_SCOTCH
+  #ifdef HAS_SCOTCH
   if (parameters["reorder_cells_gps"])
-    reorder_cells_gps(mesh.mpi_comm(), num_regular_cells,
-                      shared_cells, new_mesh_data);
-#endif
-
-  // Generate mapping from global to local indexing for vertices
-  // also calculating which vertices are 'ghost' and putting them
-  // at the end of the local range
-  std::map<std::size_t, std::size_t> vertex_global_to_local;
-  const std::size_t num_regular_vertices
-    = compute_vertex_mapping(mesh.mpi_comm(),
-                             num_regular_cells, new_mesh_data,
+  {
+    // Create CellType objects based on current cell type
+    std::unique_ptr<CellType> cell_type(CellType::create(mesh_data.topology.cell_type));
+    dolfin_assert(cell_type);
+
+    // Allocate objects to hold re-ordering
+    std::map<std::int32_t, std::set<unsigned int>> reordered_shared_cells;
+    boost::multi_array<std::int64_t, 2> reordered_cell_vertices;
+    std::vector<std::int64_t> reordered_global_cell_indices;
+
+    // Re-order cells
+    reorder_cells_gps(mesh.mpi_comm(), num_regular_cells, *cell_type,
+                     shared_cells, new_cell_vertices, new_global_cell_indices,
+                     reordered_shared_cells, reordered_cell_vertices,
+                     reordered_global_cell_indices);
+
+    // Update to re-ordered indices
+    std::swap(shared_cells, reordered_shared_cells);
+    std::swap(new_cell_vertices, reordered_cell_vertices);
+    std::swap(new_global_cell_indices, reordered_global_cell_indices);
+  }
+  #endif
+
+  // Generate mapping from global to local indexing for vertices also
+  // calculating which vertices are 'ghost' and putting them at the
+  // end of the local range
+  std::vector<std::int64_t> vertex_indices;
+  std::map<std::int64_t, std::int32_t> vertex_global_to_local;
+  const std::int32_t num_regular_vertices
+    = compute_vertex_mapping(mesh.mpi_comm(), num_regular_cells,
+                             new_cell_vertices, vertex_indices,
                              vertex_global_to_local);
 
-#ifdef HAS_SCOTCH
+  #ifdef HAS_SCOTCH
   if (parameters["reorder_vertices_gps"])
+  {
+    // Allocate objects to hold re-ordering
+    std::vector<std::int64_t> reordered_vertex_indices;
+    std::map<std::int64_t, std::int32_t> reordered_vertex_global_to_local;
+
+    // Re-order vertices
     reorder_vertices_gps(mesh.mpi_comm(), num_regular_vertices,
-                         num_regular_cells, vertex_global_to_local,
-                         new_mesh_data);
-#endif
+                         num_regular_cells, num_cell_vertices,
+                         new_cell_vertices, vertex_indices,
+                         vertex_global_to_local, reordered_vertex_indices,
+                         reordered_vertex_global_to_local);
+
+    // Update to re-ordered indices
+    std::swap(vertex_indices, reordered_vertex_indices);
+    std::swap(vertex_global_to_local, reordered_vertex_global_to_local);
+  }
+  #endif
 
   // Send vertices to processes that need them, informing all
   // sharing processes of their destinations
-  std::map<unsigned int, std::set<unsigned int>> shared_vertices;
-  distribute_vertices(mesh.mpi_comm(), mesh_data, new_mesh_data,
-                      vertex_global_to_local, shared_vertices);
+  std::map<std::int32_t, std::set<unsigned int>> shared_vertices;
+  boost::multi_array<double, 2> vertex_coordinates;
+  distribute_vertices(mesh.mpi_comm(), mesh_data, vertex_indices,
+                      vertex_coordinates, vertex_global_to_local,
+                      shared_vertices);
+
   timer.stop();
 
-  // Build mesh from new_mesh_data
-  build_mesh(mesh, vertex_global_to_local, new_mesh_data);
+  // Build lcoal mesh from new_mesh_data
+  build_local_mesh(mesh, new_global_cell_indices, new_cell_vertices,
+                   mesh_data.topology.cell_type, mesh_data.topology.dim,
+                   mesh_data.topology.num_global_cells, vertex_indices,
+                   vertex_coordinates, mesh_data.geometry.dim,
+                   mesh_data.geometry.num_global_vertices,
+                   vertex_global_to_local);
 
   // Fix up some of the ancilliary data about sharing and ownership
   // now that the mesh has been initialised
@@ -271,55 +334,60 @@ void MeshPartitioning::build(Mesh& mesh, const LocalMeshData& mesh_data,
   std::vector<unsigned int>& cell_owner = mesh.topology().cell_owner();
   cell_owner.clear();
   cell_owner.insert(cell_owner.begin(),
-                    new_mesh_data.cell_partition.begin() + num_regular_cells,
-                    new_mesh_data.cell_partition.end());
+                    new_cell_partition.begin() + num_regular_cells,
+                    new_cell_partition.end());
 
   // Set the ghost cell offset
-  mesh.topology().init_ghost(mesh_data.tdim, num_regular_cells);
+  mesh.topology().init_ghost(tdim, num_regular_cells);
 
   // Set the ghost vertex offset
   mesh.topology().init_ghost(0, num_regular_vertices);
 
   // Assign map of shared cells and vertices
-  mesh.topology().shared_entities(mesh_data.tdim) = shared_cells;
+  mesh.topology().shared_entities(mesh_data.topology.dim) = shared_cells;
   mesh.topology().shared_entities(0) = shared_vertices;
 }
 //-----------------------------------------------------------------------------
 void MeshPartitioning::reorder_cells_gps(
   MPI_Comm mpi_comm,
-  unsigned int num_regular_cells,
-  std::map<unsigned int, std::set<unsigned int>>& shared_cells,
-  LocalMeshData& new_mesh_data)
+  const unsigned int num_regular_cells,
+  const CellType& cell_type,
+  const std::map<std::int32_t, std::set<unsigned int>>& shared_cells,
+  const boost::multi_array<std::int64_t, 2>& cell_vertices,
+  const std::vector<std::int64_t>& global_cell_indices,
+  std::map<std::int32_t, std::set<unsigned int>>& reordered_shared_cells,
+  boost::multi_array<std::int64_t, 2>& reordered_cell_vertices,
+  std::vector<std::int64_t>& reordered_global_cell_indices)
 {
-  Timer t("Reorder cells GPS");
+  log(PROGRESS, "Re-order cells during distributed mesh construction");
+
+  Timer timer("Reorder cells using GPS ordering");
 
   // Make dual graph from vertex indices, using GraphBuilder
   // FIXME: this should be reused later to add the facet-cell topology
-  std::vector<std::set<std::size_t>> local_graph;
+  std::vector<std::vector<std::size_t>> local_graph;
   GraphBuilder::FacetCellMap facet_cell_map;
-  GraphBuilder::compute_local_dual_graph(mpi_comm,
-                                         new_mesh_data,
-                                         local_graph,
-                                         facet_cell_map);
-  const std::size_t num_all_cells
-    = new_mesh_data.cell_vertices.shape()[0];
+  GraphBuilder::compute_local_dual_graph(mpi_comm, cell_vertices, cell_type,
+                                         local_graph, facet_cell_map);
 
+  const std::size_t num_all_cells = cell_vertices.shape()[0];
   const std::size_t local_cell_offset
     = MPI::global_offset(mpi_comm, num_all_cells, true);
 
   // Convert between graph types, removing offset
   // FIXME: make all graphs the same type
+
   Graph g_dual;
   // Ignore the ghost cells - they will not be reordered
   // FIXME: reorder ghost cells too
   for (unsigned int i = 0; i != num_regular_cells; ++i)
   {
     dolfin::Set<int> conn_set;
-    for (auto q = local_graph[i].begin();
-         q != local_graph[i].end(); ++q)
+    for (auto q = local_graph[i].begin(); q != local_graph[i].end(); ++q)
     {
       dolfin_assert(*q >= local_cell_offset);
       const int local_index = *q - local_cell_offset;
+
       // Ignore ghost cells in connectivity
       if (local_index < (int)num_regular_cells)
         conn_set.insert(local_index);
@@ -328,65 +396,71 @@ void MeshPartitioning::reorder_cells_gps(
   }
   std::vector<int> remap = SCOTCH::compute_gps(g_dual);
 
-  boost::multi_array<std::size_t, 2>
-    remapped_cell_vertices(new_mesh_data.cell_vertices);
-  std::vector<std::size_t>
-    remapped_global_cell_indices(new_mesh_data.global_cell_indices);
+  // Resize re-ordered cell topology arrray, and copy (copy iss
+  // required because ghosts are not being re-ordered).
+  reordered_cell_vertices.resize(boost::extents[cell_vertices.shape()[0]][cell_vertices.shape()[1]]);
+  reordered_cell_vertices = cell_vertices;
+
+  // Assign old gloabl indeices to re-ordered indices (since ghost
+  // will be be re-ordered, we need to copy them over)
+  reordered_global_cell_indices = global_cell_indices;
 
   for (unsigned int i = 0; i != g_dual.size(); ++i)
   {
     // Remap data
     const unsigned int j = remap[i];
-    remapped_cell_vertices[j] = new_mesh_data.cell_vertices[i];
-    remapped_global_cell_indices[j] = new_mesh_data.global_cell_indices[i];
+    reordered_cell_vertices[j] = cell_vertices[i];
+    reordered_global_cell_indices[j] = global_cell_indices[i];
   }
 
-  std::map<unsigned int, std::set<unsigned int>> remapped_shared_cells;
+  // Clear data
+  reordered_shared_cells.clear();
   for (auto p = shared_cells.begin(); p != shared_cells.end(); ++p)
   {
     const unsigned int cell_index = p->first;
     if (cell_index < num_regular_cells)
-      remapped_shared_cells.insert(std::make_pair
-                                   (remap[cell_index], p->second));
+      reordered_shared_cells.insert({remap[cell_index], p->second});
     else
-      remapped_shared_cells.insert(*p);
+      reordered_shared_cells.insert(*p);
   }
-
-  // Assign
-  new_mesh_data.cell_vertices = remapped_cell_vertices;
-  new_mesh_data.global_cell_indices = remapped_global_cell_indices;
-  shared_cells = remapped_shared_cells;
 }
 //-----------------------------------------------------------------------------
-void MeshPartitioning::reorder_vertices_gps(MPI_Comm mpi_comm,
-     unsigned int num_regular_vertices,
-     unsigned int num_regular_cells,
-     std::map<std::size_t, std::size_t>& vertex_global_to_local,
-     LocalMeshData& new_mesh_data)
+void
+MeshPartitioning::reorder_vertices_gps(MPI_Comm mpi_comm,
+     const std::int32_t num_regular_vertices,
+     const std::int32_t num_regular_cells,
+     const int num_vertices_per_cell,
+     const boost::multi_array<std::int64_t, 2>& cell_vertices,
+     const std::vector<std::int64_t>& vertex_indices,
+     const std::map<std::int64_t, std::int32_t>& vertex_global_to_local,
+     std::vector<std::int64_t>& reordered_vertex_indices,
+     std::map<std::int64_t, std::int32_t>& reordered_vertex_global_to_local)
 {
-  Timer t("Reorder vertices GPS");
+  // Reorder vertices using the Gibbs-Poole-Stockmeyer algorithm of
+  // SCOTCH.
+  // "vertex_indices" and "vertex_global_to_local" are modified.
 
-  const unsigned int num_cell_vertices
-    = new_mesh_data.num_vertices_per_cell;
+  log(PROGRESS, "Re-order vertices during distributed mesh construction");
+  Timer timer("Reorder vertices using GPS ordering");
 
   // Make local real graph (vertices are nodes, edges are edges)
   Graph g(num_regular_vertices);
-  for (unsigned int i = 0; i != num_regular_cells; ++i)
+  for (std::int32_t i = 0; i < num_regular_cells; ++i)
   {
-    for (unsigned int j = 0; j != num_cell_vertices; ++j)
+    for (int j = 0; j < num_vertices_per_cell; ++j)
     {
-      const unsigned int vj
-        = vertex_global_to_local[new_mesh_data.cell_vertices[i][j]];
-      if (vj < num_regular_vertices)
+      auto vj = vertex_global_to_local.find(cell_vertices[i][j]);
+      dolfin_assert(vj != vertex_global_to_local.end());
+      if (vj->second < num_regular_vertices)
       {
-        for (unsigned int k = j + 1; k != num_cell_vertices; ++k)
+        for (int k = j + 1; k < num_vertices_per_cell; ++k)
         {
-          const unsigned int vk
-            = vertex_global_to_local[new_mesh_data.cell_vertices[i][k]];
-          if (vk < num_regular_vertices)
+          auto vk = vertex_global_to_local.find(cell_vertices[i][k]);
+          dolfin_assert(vk != vertex_global_to_local.end());
+          if (vk->second < num_regular_vertices)
           {
-            g[vj].insert(vk);
-            g[vk].insert(vj);
+            g[vj->second].insert(vk->second);
+            g[vk->second].insert(vj->second);
           }
         }
       }
@@ -395,69 +469,68 @@ void MeshPartitioning::reorder_vertices_gps(MPI_Comm mpi_comm,
 
   std::vector<int> remap = SCOTCH::compute_gps(g);
 
-  // Remap global-to-local mapping
-  for (auto p = vertex_global_to_local.begin();
-       p != vertex_global_to_local.end(); ++p)
-    if (p->second < num_regular_vertices)
-      p->second = (std::size_t)remap[p->second];
-
-  // Remap local-to-global mapping
-  std::vector<std::size_t>
-    remapped_vertex_indices(new_mesh_data.vertex_indices);
-  for (unsigned int i = 0; i != num_regular_vertices; ++i)
+  // Remap global-to-local mapping for regular vertices only
+  reordered_vertex_global_to_local = vertex_global_to_local;
+  for (auto p = reordered_vertex_global_to_local.begin();
+        p != reordered_vertex_global_to_local.end(); ++p)
   {
-    const unsigned int j = remap[i];
-    remapped_vertex_indices[j] = new_mesh_data.vertex_indices[i];
+    if (p->second < num_regular_vertices)
+      p->second = remap[p->second];
   }
 
-  // Assign
-  new_mesh_data.vertex_indices = remapped_vertex_indices;
+  // Remap local-to-global mapping for regular vertices
+  const std::int32_t num_indices = vertex_indices.size();
+  reordered_vertex_indices.resize(num_indices);
+  for (std::int32_t i = 0; i < num_regular_vertices; ++i)
+    reordered_vertex_indices[remap[i]] = vertex_indices[i];
+
+  // Copy ghost vertices
+  for (std::int32_t i = num_regular_vertices; i < num_indices; ++i)
+    reordered_vertex_indices[i] = vertex_indices[i];
 }
 //-----------------------------------------------------------------------------
 void MeshPartitioning::distribute_cell_layer(MPI_Comm mpi_comm,
-  unsigned int num_regular_cells,
-  std::map<unsigned int, std::set<unsigned int>>& shared_cells,
-  LocalMeshData& new_mesh_data)
+  const int num_regular_cells,
+  const std::int64_t num_global_vertices,
+  std::map<std::int32_t, std::set<unsigned int>>& shared_cells,
+  boost::multi_array<std::int64_t, 2>& cell_vertices,
+  std::vector<std::int64_t>& global_cell_indices,
+  std::vector<int>& cell_partition)
 {
   Timer timer("Distribute cell layer");
 
-  const unsigned int mpi_size = MPI::size(mpi_comm);
-  const unsigned int mpi_rank = MPI::rank(mpi_comm);
-
-  boost::multi_array<std::size_t, 2>& cell_vertices
-    = new_mesh_data.cell_vertices;
+  const int mpi_size = MPI::size(mpi_comm);
+  const int mpi_rank = MPI::rank(mpi_comm);
 
   // Get set of vertices in ghost cells
-  std::map<std::size_t, std::vector<std::size_t>> sh_vert_to_cell;
+  std::map<std::int64_t, std::vector<std::int64_t>> sh_vert_to_cell;
+
   // Make global-to-local map of shared cells
-  std::map<std::size_t, unsigned int> cell_global_to_local;
-  for (unsigned int i = num_regular_cells; i != cell_vertices.size(); ++i)
+  std::map<std::int64_t, int> cell_global_to_local;
+  for (int i = num_regular_cells; i < (int) cell_vertices.size(); ++i)
   {
     // Add map entry for each vertex
     for(auto p = cell_vertices[i].begin(); p != cell_vertices[i].end(); ++p)
-      sh_vert_to_cell.insert(std::make_pair(*p, std::vector<std::size_t>()));
+      sh_vert_to_cell.insert({*p, std::vector<std::int64_t>()});
 
-    cell_global_to_local.insert(std::make_pair
-                                (new_mesh_data.global_cell_indices[i], i));
+    cell_global_to_local.insert({global_cell_indices[i], i});
   }
 
   // Reduce vertex set to those which also appear in local cells
-  // giving the effective boundary vertices.
-  // Make a map from these vertices to the set of connected cells
-  // (but only adding locally owned cells)
+  // giving the effective boundary vertices.  Make a map from these
+  // vertices to the set of connected cells (but only adding locally
+  // owned cells)
 
-  // Go through all regular cells
-  // to add any previously unshared cells.
-  for (unsigned int i = 0; i != num_regular_cells; ++i)
+  // Go through all regular cells to add any previously unshared
+  // cells.
+  for (int i = 0; i < num_regular_cells; ++i)
   {
-    for (auto v = cell_vertices[i].begin();
-         v != cell_vertices[i].end(); ++v)
+    for (auto v = cell_vertices[i].begin(); v != cell_vertices[i].end(); ++v)
     {
       auto vc_it = sh_vert_to_cell.find(*v);
       if (vc_it != sh_vert_to_cell.end())
       {
-        cell_global_to_local.insert(std::make_pair
-                                    (new_mesh_data.global_cell_indices[i], i));
+        cell_global_to_local.insert({global_cell_indices[i], i});
         vc_it->second.push_back(i);
       }
     }
@@ -465,71 +538,68 @@ void MeshPartitioning::distribute_cell_layer(MPI_Comm mpi_comm,
 
   // Send lists of cells/owners to MPI::index_owner of vertex,
   // collating and sending back out...
-  std::vector<std::vector<std::size_t>> send_vertcells(mpi_size);
-  std::vector<std::vector<std::size_t>> recv_vertcells(mpi_size);
-  for (auto vc_it = sh_vert_to_cell.begin();
-       vc_it != sh_vert_to_cell.end(); ++vc_it)
+  std::vector<std::vector<std::int64_t>> send_vertcells(mpi_size);
+  std::vector<std::vector<std::int64_t>> recv_vertcells(mpi_size);
+  for (auto vc_it = sh_vert_to_cell.begin(); vc_it != sh_vert_to_cell.end(); ++vc_it)
   {
-    const std::size_t dest = MPI::index_owner(mpi_comm,
-                                              vc_it->first,
-                                              new_mesh_data.num_global_vertices);
+    const int dest = MPI::index_owner(mpi_comm, vc_it->first,
+                                      num_global_vertices);
 
-    std::vector<std::size_t>& sendv = send_vertcells[dest];
+    std::vector<std::int64_t>& sendv = send_vertcells[dest];
 
     // Pack as [cell_global_index, this_vertex, [other_vertices]]
     for (auto q = vc_it->second.begin(); q != vc_it->second.end(); ++q)
     {
-      sendv.push_back(new_mesh_data.global_cell_indices[*q]);
+      sendv.push_back(global_cell_indices[*q]);
       sendv.push_back(vc_it->first);
-      for (auto v = new_mesh_data.cell_vertices[*q].begin();
-           v != new_mesh_data.cell_vertices[*q].end(); ++v)
+      for (auto v = cell_vertices[*q].begin(); v != cell_vertices[*q].end(); ++v)
+      {
         if (*v != vc_it->first)
           sendv.push_back(*v);
+      }
     }
   }
 
   MPI::all_to_all(mpi_comm, send_vertcells, recv_vertcells);
 
-  const unsigned int num_cell_vertices
-    = new_mesh_data.cell_vertices.shape()[1];
+  const unsigned int num_cell_vertices = cell_vertices.shape()[1];
 
   // Collect up cells on common vertices
 
   // Reset map
   sh_vert_to_cell.clear();
-
-  for (unsigned int i = 0; i != mpi_size; ++i)
+  for (int i = 0; i < mpi_size; ++i)
   {
-    const std::vector<std::size_t>& recv_i = recv_vertcells[i];
-    for (auto q = recv_i.begin(); q != recv_i.end();
-         q += num_cell_vertices + 1)
+    const std::vector<std::int64_t>& recv_i = recv_vertcells[i];
+    for (auto q = recv_i.begin(); q != recv_i.end(); q += num_cell_vertices + 1)
     {
       const std::size_t vertex_index = *(q + 1);
-      std::vector<std::size_t> cell_set(1, i);
-      cell_set.insert(cell_set.end(), q,
-                      q + num_cell_vertices + 1);
+      std::vector<std::int64_t> cell_set(1, i);
+      cell_set.insert(cell_set.end(), q, q + num_cell_vertices + 1);
 
       // Packing: [owner, cell_index, this_vertex, [other_vertices]]
       // Look for vertex in map, and add the attached cell
       auto it = sh_vert_to_cell.find(vertex_index);
       if (it == sh_vert_to_cell.end())
-        sh_vert_to_cell.insert(std::make_pair(vertex_index, cell_set));
+        sh_vert_to_cell.insert({vertex_index, cell_set});
       else
         it->second.insert(it->second.end(), cell_set.begin(), cell_set.end());
     }
   }
 
   // Clear sending arrays
-  send_vertcells = std::vector<std::vector<std::size_t>>(mpi_size);
+  send_vertcells = std::vector<std::vector<std::int64_t>>(mpi_size);
 
   // Send back out to all processes which share the same vertex
   // FIXME: avoid sending back own cells to owner?
   for (auto p = sh_vert_to_cell.begin(); p != sh_vert_to_cell.end(); ++p)
   {
     for (auto q = p->second.begin(); q != p->second.end();
-         q += (num_cell_vertices + 2))
-      send_vertcells[*q].insert(send_vertcells[*q].end(),
-                                p->second.begin(), p->second.end());
+          q += (num_cell_vertices + 2))
+    {
+      send_vertcells[*q].insert(send_vertcells[*q].end(), p->second.begin(),
+                                p->second.end());
+    }
   }
 
   MPI::all_to_all(mpi_comm, send_vertcells, recv_vertcells);
@@ -537,39 +607,37 @@ void MeshPartitioning::distribute_cell_layer(MPI_Comm mpi_comm,
   // Count up new cells, assign local index, set owner
   // and initialise shared_cells
 
-  const unsigned int num_cells
-    = new_mesh_data.cell_vertices.shape()[0];
+  const unsigned int num_cells = cell_vertices.shape()[0];
   unsigned int count = num_cells;
 
   for (auto p = recv_vertcells.begin(); p != recv_vertcells.end(); ++p)
-    for (auto q = p->begin(); q != p->end();
-         q += num_cell_vertices + 2)
+  {
+    for (auto q = p->begin(); q != p->end(); q += num_cell_vertices + 2)
     {
-      const std::size_t owner = *q;
-      const std::size_t cell_index = *(q + 1);
+      const std::int64_t owner = *q;
+      const std::int64_t cell_index = *(q + 1);
       auto cell_it = cell_global_to_local.find(cell_index);
       if (cell_it == cell_global_to_local.end())
       {
-        cell_global_to_local.insert(std::make_pair(cell_index, count));
-        shared_cells.insert(std::make_pair(count, std::set<unsigned int>()));
-        new_mesh_data.global_cell_indices.push_back(cell_index);
-        new_mesh_data.cell_partition.push_back(owner);
+        cell_global_to_local.insert({cell_index, count});
+        shared_cells.insert({count, std::set<unsigned int>()});
+        global_cell_indices.push_back(cell_index);
+        cell_partition.push_back(owner);
         ++count;
       }
     }
+  }
 
   cell_vertices.resize(boost::extents[count][num_cell_vertices]);
-
   std::set<unsigned int> sharing_procs;
   std::vector<std::size_t> sharing_cells;
-
   std::size_t last_vertex = std::numeric_limits<std::size_t>::max();
   for (auto p = recv_vertcells.begin(); p != recv_vertcells.end(); ++p)
-    for (auto q = p->begin(); q != p->end();
-         q += num_cell_vertices + 2)
+  {
+    for (auto q = p->begin(); q != p->end(); q += num_cell_vertices + 2)
     {
       const std::size_t shared_vertex = *(q + 2);
-      const std::size_t owner = *q;
+      const int owner = *q;
       const std::size_t cell_index = *(q + 1);
       const std::size_t local_index
         = cell_global_to_local.find(cell_index)->second;
@@ -581,8 +649,8 @@ void MeshPartitioning::distribute_cell_layer(MPI_Comm mpi_comm,
           cell_vertices[local_index][j] = *(q + j + 2);
       }
 
-      // If starting on a new shared vertex, dump old data
-      // into shared_cells
+      // If starting on a new shared vertex, dump old data into
+      // shared_cells
       if (shared_vertex != last_vertex)
       {
         last_vertex = shared_vertex;
@@ -590,7 +658,7 @@ void MeshPartitioning::distribute_cell_layer(MPI_Comm mpi_comm,
         {
           auto it = shared_cells.find(*c);
           if (it == shared_cells.end())
-            shared_cells.insert(std::make_pair(*c, sharing_procs));
+            shared_cells.insert({*c, sharing_procs});
           else
             it->second.insert(sharing_procs.begin(), sharing_procs.end());
         }
@@ -600,94 +668,100 @@ void MeshPartitioning::distribute_cell_layer(MPI_Comm mpi_comm,
 
       // Don't include self in sharing processes
       if (owner != mpi_rank)
-        sharing_procs.insert(owner);
+         sharing_procs.insert(owner);
       sharing_cells.push_back(local_index);
     }
+  }
 
   for (auto c = sharing_cells.begin(); c != sharing_cells.end(); ++c)
   {
     auto it = shared_cells.find(*c);
     if (it == shared_cells.end())
-      shared_cells.insert(std::make_pair(*c, sharing_procs));
+      shared_cells.insert({*c, sharing_procs});
     else
       it->second.insert(sharing_procs.begin(), sharing_procs.end());
   }
 
+  // Shrink
+  global_cell_indices.shrink_to_fit();
+  cell_partition.shrink_to_fit();
 }
 //-----------------------------------------------------------------------------
-unsigned int MeshPartitioning::distribute_cells(
+std::int32_t
+MeshPartitioning::distribute_cells(
   const MPI_Comm mpi_comm,
   const LocalMeshData& mesh_data,
-  const std::vector<std::size_t>& cell_partition,
-  const std::map<std::size_t, dolfin::Set<unsigned int>>& ghost_procs,
-  std::map<unsigned int, std::set<unsigned int>>& shared_cells,
-  LocalMeshData& new_mesh_data)
+  const std::vector<int>& cell_partition,
+  const std::map<std::int64_t, std::vector<int>>& ghost_procs,
+  boost::multi_array<std::int64_t, 2>& new_cell_vertices,
+  std::vector<std::int64_t>& new_global_cell_indices,
+  std::vector<int>& new_cell_partition,
+  std::map<std::int32_t, std::set<unsigned int>>& shared_cells)
 {
   // This function takes the partition computed by the partitioner
-  // stored in cell_partition/ghost_procs
-  // Some cells go to multiple destinations.
-  // Each cell is transmitted to its final destination(s) including
-  // its global index, and the cell owner (for ghost cells this
-  // will be different from the destination)
+  // stored in cell_partition/ghost_procs Some cells go to multiple
+  // destinations. Each cell is transmitted to its final
+  // destination(s) including its global index, and the cell owner
+  // (for ghost cells this will be different from the destination)
+
+  log(PROGRESS, "Distribute cells during distributed mesh construction");
 
   Timer timer("Distribute cells");
 
   const std::size_t mpi_size = MPI::size(mpi_comm);
   const std::size_t mpi_rank = MPI::rank(mpi_comm);
 
+  new_cell_partition.clear();
+  shared_cells.clear();
+
   // Get dimensions of local mesh_data
-  const std::size_t num_local_cells = mesh_data.cell_vertices.size();
-  dolfin_assert(mesh_data.global_cell_indices.size() == num_local_cells);
-  const std::size_t num_cell_vertices = mesh_data.num_vertices_per_cell;
-  if (!mesh_data.cell_vertices.empty())
+  const std::size_t num_local_cells = mesh_data.topology.cell_vertices.size();
+  dolfin_assert(mesh_data.topology.global_cell_indices.size() == num_local_cells);
+  const std::size_t num_cell_vertices = mesh_data.topology.num_vertices_per_cell;
+  if (!mesh_data.topology.cell_vertices.empty())
   {
-    if (mesh_data.cell_vertices[0].size() != num_cell_vertices)
+    if (mesh_data.topology.cell_vertices[0].size() != num_cell_vertices)
     {
       dolfin_error("MeshPartitioning.cpp",
                    "distribute cells",
                    "Mismatch in number of cell vertices (%d != %d) on process %d",
-                   mesh_data.cell_vertices[0].size(), num_cell_vertices,
+                   mesh_data.topology.cell_vertices[0].size(), num_cell_vertices,
                    mpi_rank);
     }
   }
 
-  // Send all cells to their destinations including their global indices.
-  // First element of vector is cell count of unghosted cells,
-  // second element is count of ghost cells.
+  // Send all cells to their destinations including their global
+  // indices.  First element of vector is cell count of unghosted
+  // cells, second element is count of ghost cells.
   std::vector<std::vector<std::size_t>>
-    send_cell_vertices(mpi_size, std::vector<std::size_t>(2, 0) );
+    send_cell_vertices(mpi_size, std::vector<std::size_t>(2, 0));
 
   for (unsigned int i = 0; i != cell_partition.size(); ++i)
   {
     // If cell is in ghost_procs map, use that to determine
-    // destinations, otherwise just use the cell_partition
-    // vector
-
+    // destinations, otherwise just use the cell_partition vector
     auto map_it = ghost_procs.find(i);
     if (map_it != ghost_procs.end())
     {
-      const dolfin::Set<unsigned int>& destinations
-        = map_it->second;
-
-      for (auto dest = destinations.begin();
-           dest != destinations.end(); ++dest)
+      const std::vector<int>& destinations = map_it->second;
+      for (auto dest = destinations.begin(); dest != destinations.end(); ++dest)
       {
         // Create reference to destination vector
-        std::vector<std::size_t>& send_cell_dest
-          = send_cell_vertices[*dest];
+        std::vector<std::size_t>& send_cell_dest = send_cell_vertices[*dest];
 
         // Count of ghost cells, followed by ghost processes
         send_cell_dest.push_back(destinations.size());
-        send_cell_dest.insert(send_cell_dest.end(),
-                              destinations.begin(),
+        send_cell_dest.insert(send_cell_dest.end(), destinations.begin(),
                               destinations.end());
 
         // Global cell index
-        send_cell_dest.push_back(mesh_data.global_cell_indices[i]);
+        send_cell_dest.push_back(mesh_data.topology.global_cell_indices[i]);
+
         // Global vertex indices
         send_cell_dest.insert(send_cell_dest.end(),
-                              mesh_data.cell_vertices[i].begin(),
-                              mesh_data.cell_vertices[i].end());
+                              mesh_data.topology.cell_vertices[i].begin(),
+                              mesh_data.topology.cell_vertices[i].end());
+
         // First entry is the owner, so this counts as a 'local' cell
         // subsequent entries are 'remote ghosts'
         if (dest == destinations.begin())
@@ -702,12 +776,14 @@ unsigned int MeshPartitioning::distribute_cells(
       std::vector<std::size_t>& send_cell_dest
         = send_cell_vertices[cell_partition[i]];
       send_cell_dest.push_back(0);
+
       // Global cell index
-      send_cell_dest.push_back(mesh_data.global_cell_indices[i]);
+      send_cell_dest.push_back(mesh_data.topology.global_cell_indices[i]);
+
       // Global vertex indices
       send_cell_dest.insert(send_cell_dest.end(),
-                            mesh_data.cell_vertices[i].begin(),
-                            mesh_data.cell_vertices[i].end());
+                            mesh_data.topology.cell_vertices[i].begin(),
+                            mesh_data.topology.cell_vertices[i].end());
       send_cell_dest[0]++;
     }
   }
@@ -716,8 +792,8 @@ unsigned int MeshPartitioning::distribute_cells(
   std::vector<std::vector<std::size_t>> received_cell_vertices(mpi_size);
   MPI::all_to_all(mpi_comm, send_cell_vertices, received_cell_vertices);
 
-  // Count number of received cells (first entry in vector)
-  // and find out how many ghost cells there are...
+  // Count number of received cells (first entry in vector) and find
+  // out how many ghost cells there are...
   std::size_t local_count = 0;
   std::size_t ghost_count = 0;
   for (std::size_t p = 0; p < mpi_size; ++p)
@@ -730,10 +806,9 @@ unsigned int MeshPartitioning::distribute_cells(
   const std::size_t all_count = ghost_count + local_count;
 
   // Put received mesh data into new_mesh_data structure
-  new_mesh_data.cell_vertices.resize(boost::extents[all_count]
-                                     [num_cell_vertices]);
-  new_mesh_data.global_cell_indices.resize(all_count);
-  new_mesh_data.cell_partition.resize(all_count);
+  new_cell_vertices.resize(boost::extents[all_count][num_cell_vertices]);
+  new_global_cell_indices.resize(all_count);
+  new_cell_partition.resize(all_count);
 
   // Unpack received data
   // Create a map from cells which are shared, to the remote processes
@@ -743,8 +818,7 @@ unsigned int MeshPartitioning::distribute_cells(
   for (std::size_t p = 0; p < mpi_size; ++p)
   {
     std::vector<std::size_t>& received_data = received_cell_vertices[p];
-    for (auto it = received_data.begin() + 2;
-         it != received_data.end();
+    for (auto it = received_data.begin() + 2; it != received_data.end();
          it += (*it + num_cell_vertices + 2))
     {
       auto tmp_it = it;
@@ -752,21 +826,25 @@ unsigned int MeshPartitioning::distribute_cells(
 
       // Determine owner, and indexing.
       // Note that *tmp_it may be equal to mpi_rank
-      const std::size_t owner = (num_ghosts == 0) ? mpi_rank : *tmp_it ;
-      const std::size_t idx = (owner == mpi_rank) ? c : gc ;
+      const std::size_t owner = (num_ghosts == 0) ? mpi_rank : *tmp_it;
+      const std::size_t idx = (owner == mpi_rank) ? c : gc;
 
-      new_mesh_data.cell_partition[idx] = owner;
+      dolfin_assert(idx < new_cell_partition.size());
+      new_cell_partition[idx] = owner;
       if (num_ghosts != 0)
       {
         std::set<unsigned int> proc_set(tmp_it, tmp_it + num_ghosts);
+
         // Remove self from set of sharing processes
         proc_set.erase(mpi_rank);
-        shared_cells.insert(std::make_pair(idx, proc_set));
+        shared_cells.insert({idx, proc_set});
         tmp_it += num_ghosts;
       }
-      new_mesh_data.global_cell_indices[idx] = *tmp_it++;
+
+      new_global_cell_indices[idx] = *tmp_it++;
       for (std::size_t j = 0; j < num_cell_vertices; ++j)
-        new_mesh_data.cell_vertices[idx][j] = *tmp_it++;
+        new_cell_vertices[idx][j] = *tmp_it++;
+
       if (owner == mpi_rank)
         ++c;
       else
@@ -776,39 +854,33 @@ unsigned int MeshPartitioning::distribute_cells(
 
   dolfin_assert(c == local_count);
   dolfin_assert(gc == all_count);
-
   return local_count;
 }
 //-----------------------------------------------------------------------------
-std::size_t MeshPartitioning::compute_vertex_mapping(MPI_Comm mpi_comm,
-                         unsigned int num_regular_cells,
-                         LocalMeshData& new_mesh_data,
-                         std::map<std::size_t, std::size_t>& vertex_global_to_local)
+std::int32_t MeshPartitioning::compute_vertex_mapping(MPI_Comm mpi_comm,
+                 const std::int32_t num_regular_cells,
+                 const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                 std::vector<std::int64_t>& vertex_indices,
+                 std::map<std::int64_t, std::int32_t>& vertex_global_to_local)
 {
+  vertex_indices.clear();
   vertex_global_to_local.clear();
 
-  std::vector<std::size_t>& vertex_indices
-    = new_mesh_data.vertex_indices;
-  dolfin_assert(vertex_indices.size() == 0);
-
-  const boost::multi_array<std::size_t, 2>& cell_vertices
-    = new_mesh_data.cell_vertices;
-
   // Get set of unique vertices from cells and start constructing a
   // global_to_local map.  Ghost vertices will be at the end of the
   // range (v >= num_regular_vertices).
-  std::size_t v = 0;
-  std::size_t num_regular_vertices = 0;
-  for (unsigned int i = 0; i != cell_vertices.size(); ++i)
+  std::int32_t v = 0;
+  std::int32_t num_regular_vertices = 0;
+  const std::int32_t num_cells = cell_vertices.size();
+  for (std::int32_t i = 0; i < num_cells; ++i)
   {
-    for (auto q = cell_vertices[i].begin();
-         q != cell_vertices[i].end(); ++q)
+    for (auto q : cell_vertices[i])
     {
-      auto map_it = vertex_global_to_local.find(*q);
+      auto map_it = vertex_global_to_local.find(q);
       if (map_it == vertex_global_to_local.end())
       {
-        vertex_global_to_local.insert(std::make_pair(*q, v));
-        vertex_indices.push_back(*q);
+        vertex_global_to_local.insert({q, v});
+        vertex_indices.push_back(q);
         ++v;
         if (i < num_regular_cells)
           num_regular_vertices = v;
@@ -822,9 +894,10 @@ std::size_t MeshPartitioning::compute_vertex_mapping(MPI_Comm mpi_comm,
 void MeshPartitioning::distribute_vertices(
   const MPI_Comm mpi_comm,
   const LocalMeshData& mesh_data,
-  LocalMeshData& new_mesh_data,
-  std::map<std::size_t, std::size_t>& vertex_global_to_local,
-  std::map<unsigned int, std::set<unsigned int>>& shared_vertices_local)
+  const std::vector<std::int64_t>& vertex_indices,
+  boost::multi_array<double, 2>& vertex_coordinates,
+  std::map<std::int64_t, std::int32_t>& vertex_global_to_local,
+  std::map<std::int32_t, std::set<unsigned int>>& shared_vertices_local)
 {
   // This function distributes all vertices (coordinates and
   // local-to-global mapping) according to the cells that are stored
@@ -834,16 +907,14 @@ void MeshPartitioning::distribute_vertices(
   // then distributed so that each process learns where it needs to
   // send its vertices.
 
-  Timer t("Distribute vertices");
-
-  std::vector<std::size_t>& vertex_indices
-    = new_mesh_data.vertex_indices;
+  log(PROGRESS, "Distribute vertices during distributed mesh construction");
+  Timer timer("Distribute vertices");
 
   // Get number of processes
-  const std::size_t mpi_size = MPI::size(mpi_comm);
+  const int mpi_size = MPI::size(mpi_comm);
 
   // Get geometric dimension
-  const std::size_t gdim = mesh_data.gdim;
+  const int gdim = mesh_data.geometry.dim;
 
   // Compute where (process number) the vertices we need are located
   // using MPI::index_owner()
@@ -853,7 +924,7 @@ void MeshPartitioning::distribute_vertices(
   {
     // Get process that has required vertex
     const std::size_t location = MPI::index_owner(mpi_comm, *required_vertex,
-                                                  mesh_data.num_global_vertices);
+                                                  mesh_data.geometry.num_global_vertices);
     send_vertex_indices[location].push_back(*required_vertex);
   }
 
@@ -874,21 +945,19 @@ void MeshPartitioning::distribute_vertices(
   // Distribute vertex coordinates
   std::vector<std::vector<double>> send_vertex_coordinates(mpi_size);
   const std::pair<std::size_t, std::size_t> local_vertex_range
-    = MPI::local_range(mpi_comm, mesh_data.num_global_vertices);
-  for (std::size_t p = 0; p < mpi_size; ++p)
+    = MPI::local_range(mpi_comm, mesh_data.geometry.num_global_vertices);
+  for (int p = 0; p < mpi_size; ++p)
   {
     send_vertex_coordinates[p].reserve(received_vertex_indices[p].size()*gdim);
     for (auto q = received_vertex_indices[p].begin();
          q != received_vertex_indices[p].end(); ++q)
     {
-      dolfin_assert(*q >= local_vertex_range.first
-                 && *q < local_vertex_range.second);
+      dolfin_assert(*q >= local_vertex_range.first && *q < local_vertex_range.second);
 
       const std::size_t location = *q - local_vertex_range.first;
-
       send_vertex_coordinates[p].insert(send_vertex_coordinates[p].end(),
-                                        mesh_data.vertex_coordinates[location].begin(),
-                                        mesh_data.vertex_coordinates[location].end());
+                                        mesh_data.geometry.vertex_coordinates[location].begin(),
+                                        mesh_data.geometry.vertex_coordinates[location].end());
     }
   }
 
@@ -899,44 +968,40 @@ void MeshPartitioning::distribute_vertices(
 
   // Count number of received local vertices and check it agrees with map
   std::size_t num_received_vertices = 0;
-  for (std::size_t p = 0; p < mpi_size; ++p)
+  for (int p = 0; p < mpi_size; ++p)
     num_received_vertices += received_vertex_coordinates[p].size()/gdim;
   dolfin_assert(num_received_vertices == vertex_indices.size());
 
-  // Reference for convenience
-  boost::multi_array<double, 2>& vertex_coordinates
-    = new_mesh_data.vertex_coordinates;
+  // Initialise coordinates array
   vertex_coordinates.resize(boost::extents[vertex_indices.size()][gdim]);
 
   // Store coordinates according to global_to_local mapping
-  for (std::size_t p = 0; p < mpi_size; ++p)
+  for (int p = 0; p < mpi_size; ++p)
   {
-    for (std::size_t i = 0;
-         i < received_vertex_coordinates[p].size()/gdim; ++i)
+    for (std::size_t i = 0; i < received_vertex_coordinates[p].size()/gdim; ++i)
     {
-      const std::size_t global_vertex_index
-        = vertex_location[p][i];
+      const std::int64_t global_vertex_index = vertex_location[p][i];
       auto v = vertex_global_to_local.find(global_vertex_index);
       dolfin_assert(v != vertex_global_to_local.end());
       dolfin_assert(vertex_indices[v->second] == global_vertex_index);
-
-      for (std::size_t j = 0; j < gdim; ++j)
-        vertex_coordinates[v->second][j]
-          = received_vertex_coordinates[p][i*gdim + j];
+      for (int j = 0; j < gdim; ++j)
+        vertex_coordinates[v->second][j] = received_vertex_coordinates[p][i*gdim + j];
     }
   }
 }
 //-----------------------------------------------------------------------------
 void MeshPartitioning::build_shared_vertices(MPI_Comm mpi_comm,
-     std::map<unsigned int, std::set<unsigned int>>& shared_vertices_local,
-     const std::map<std::size_t, std::size_t>& vertex_global_to_local,
+     std::map<std::int32_t, std::set<unsigned int>>& shared_vertices_local,
+     const std::map<std::int64_t, std::int32_t>& vertex_global_to_local,
      const std::vector<std::vector<std::size_t>>& received_vertex_indices)
 {
-  const std::size_t mpi_size = MPI::size(mpi_comm);
+  log(PROGRESS, "Build shared vertices during distributed mesh construction");
+
+  const int mpi_size = MPI::size(mpi_comm);
 
   // Generate vertex sharing information
   std::map<std::size_t, std::set<unsigned int>> vertex_to_proc;
-  for (std::size_t p = 0; p < mpi_size; ++p)
+  for (int p = 0; p < mpi_size; ++p)
   {
     for (auto q = received_vertex_indices[p].begin();
          q != received_vertex_indices[p].end(); ++q)
@@ -946,7 +1011,7 @@ void MeshPartitioning::build_shared_vertices(MPI_Comm mpi_comm,
       {
         std::set<unsigned int> proc_set;
         proc_set.insert(p);
-        vertex_to_proc.insert(std::make_pair(*q, proc_set));
+        vertex_to_proc.insert({*q, proc_set});
       }
       else
         map_it->second.insert(p);
@@ -955,31 +1020,29 @@ void MeshPartitioning::build_shared_vertices(MPI_Comm mpi_comm,
 
   std::vector<std::vector<std::size_t>> send_sharing(mpi_size);
   std::vector<std::vector<std::size_t>> recv_sharing(mpi_size);
-  for (auto map_it = vertex_to_proc.begin();
-       map_it != vertex_to_proc.end(); ++map_it)
+  for (auto map_it = vertex_to_proc.begin(); map_it != vertex_to_proc.end(); ++map_it)
   {
     if (map_it->second.size() != 1)
     {
-      for (auto proc = map_it->second.begin();
-           proc != map_it->second.end(); ++proc)
+      for (auto proc = map_it->second.begin(); proc != map_it->second.end(); ++proc)
       {
         std::vector<std::size_t>& ss = send_sharing[*proc];
         ss.push_back(map_it->second.size() - 1);
         ss.push_back(map_it->first);
-        for (auto p =  map_it->second.begin();
-             p != map_it->second.end(); ++p)
+        for (auto p =  map_it->second.begin(); p != map_it->second.end(); ++p)
+        {
           if (*p != *proc)
             ss.push_back(*p);
+        }
       }
     }
   }
 
   MPI::all_to_all(mpi_comm, send_sharing, recv_sharing);
 
-  for (std::size_t p = 0; p < mpi_size; ++p)
+  for (int p = 0; p < mpi_size; ++p)
   {
-    for (auto q = recv_sharing[p].begin(); q != recv_sharing[p].end();
-         q += (*q + 2))
+    for (auto q = recv_sharing[p].begin(); q != recv_sharing[p].end(); q += (*q + 2))
     {
       const std::size_t num_sharing = *q;
       const std::size_t global_vertex_index = *(q + 1);
@@ -990,67 +1053,66 @@ void MeshPartitioning::build_shared_vertices(MPI_Comm mpi_comm,
       const unsigned int local_index = local_index_it->second;
       dolfin_assert(shared_vertices_local.find(local_index)
                     == shared_vertices_local.end());
-      shared_vertices_local.insert(std::make_pair(local_index,
-                                                  sharing_processes));
+      shared_vertices_local.insert({local_index, sharing_processes});
     }
   }
 }
 //-----------------------------------------------------------------------------
-void MeshPartitioning::build_mesh(Mesh& mesh,
-  const std::map<std::size_t, std::size_t>& vertex_global_to_local,
-  const LocalMeshData& new_mesh_data)
+void MeshPartitioning::build_local_mesh(Mesh& mesh,
+  const std::vector<std::int64_t>& global_cell_indices,
+  const boost::multi_array<std::int64_t, 2>& cell_global_vertices,
+  const CellType::Type cell_type,
+  const int tdim,
+  const std::int64_t num_global_cells,
+  const std::vector<std::int64_t>& vertex_indices,
+  const boost::multi_array<double, 2>& vertex_coordinates,
+  const int gdim,
+  const std::int64_t num_global_vertices,
+  const std::map<std::int64_t, std::int32_t>& vertex_global_to_local)
 {
-  Timer timer("PARALLEL 3: Build mesh (from local mesh data)");
-
-  const std::vector<std::size_t>& global_cell_indices
-    = new_mesh_data.global_cell_indices;
-  const boost::multi_array<std::size_t, 2>& cell_global_vertices
-    = new_mesh_data.cell_vertices;
-  const std::vector<std::size_t>& vertex_indices
-    = new_mesh_data.vertex_indices;
-  const boost::multi_array<double, 2>& vertex_coordinates
-    = new_mesh_data.vertex_coordinates;
-
-  const unsigned int gdim = new_mesh_data.gdim;
-  const unsigned int tdim = new_mesh_data.tdim;
+  log(PROGRESS, "Build local mesh during distributed mesh construction");
+  Timer timer("Build local part of distributed mesh (from local mesh data)");
 
   // Open mesh for editing
-  mesh.clear();
   MeshEditor editor;
-  editor.open(mesh, new_mesh_data.cell_type, tdim, gdim);
+  editor.open(mesh, cell_type, tdim, gdim);
 
   // Add vertices
-  editor.init_vertices_global(vertex_coordinates.size(),
-                              new_mesh_data.num_global_vertices);
+  editor.init_vertices_global(vertex_coordinates.size(), num_global_vertices);
   Point point(gdim);
   dolfin_assert(vertex_indices.size() == vertex_coordinates.size());
   for (std::size_t i = 0; i < vertex_coordinates.size(); ++i)
   {
-    for (std::size_t j = 0; j < gdim; ++j)
+    for (std::int8_t j = 0; j < gdim; ++j)
       point[j] = vertex_coordinates[i][j];
     editor.add_vertex_global(i, vertex_indices[i], point);
   }
 
+  // Create CellType
+  std::unique_ptr<CellType> _cell_type(CellType::create(cell_type));
+  dolfin_assert(_cell_type);
+
   // Add cells
-  editor.init_cells_global(cell_global_vertices.size(),
-                           new_mesh_data.num_global_cells);
-  const std::size_t num_cell_vertices = new_mesh_data.num_vertices_per_cell;
+  editor.init_cells_global(cell_global_vertices.size(), num_global_cells);
+
+  const std::int8_t num_cell_vertices = _cell_type->num_vertices();
   std::vector<std::size_t> cell(num_cell_vertices);
   for (std::size_t i = 0; i < cell_global_vertices.size(); ++i)
   {
-    for (std::size_t j = 0; j < num_cell_vertices; ++j)
+    for (std::int8_t j = 0; j < num_cell_vertices; ++j)
     {
       // Get local cell vertex
       auto iter = vertex_global_to_local.find(cell_global_vertices[i][j]);
       dolfin_assert(iter != vertex_global_to_local.end());
       cell[j] = iter->second;
     }
+
     editor.add_cell(i, global_cell_indices[i], cell);
   }
 
   // Close mesh: Note that this must be done after creating the global
-  // vertex map or otherwise the ordering in mesh.close() will be wrong
-  // (based on local numbers).
+  // vertex map or otherwise the ordering in mesh.close() will be
+  // wrong (based on local numbers).
   editor.close();
 }
 //-----------------------------------------------------------------------------
@@ -1092,7 +1154,7 @@ void MeshPartitioning::build_mesh_domains(Mesh& mesh,
     mesh.init(d);
 
     // Create empty MeshValueCollection
-    MeshValueCollection<std::size_t> mvc(mesh, d);
+    MeshValueCollection<std::size_t> mvc(reference_to_no_delete_pointer(mesh), d);
 
     // Get domain data and build mesh value collection
     auto dim_data = domain_data.find(d);
@@ -1118,10 +1180,7 @@ void MeshPartitioning::build_mesh_domains(Mesh& mesh,
 
     // Get map from mesh domains
     std::map<std::size_t, std::size_t>& markers = mesh.domains().markers(d);
-
-    std::map<std::pair<std::size_t, std::size_t>,
-             std::size_t>::const_iterator it;
-    for (it = values.begin(); it != values.end(); ++it)
+    for (auto it = values.begin(); it != values.end(); ++it)
     {
       const std::size_t cell_index = it->first.first;
       const std::size_t local_entity_index = it->first.second;
diff --git a/dolfin/mesh/MeshPartitioning.h b/dolfin/mesh/MeshPartitioning.h
index 41eec8c..ccbf789 100644
--- a/dolfin/mesh/MeshPartitioning.h
+++ b/dolfin/mesh/MeshPartitioning.h
@@ -26,12 +26,14 @@
 #ifndef __MESH_PARTITIONING_H
 #define __MESH_PARTITIONING_H
 
+#include <cstdint>
 #include <map>
 #include <utility>
 #include <vector>
 #include <boost/multi_array.hpp>
 #include <dolfin/log/log.h>
 #include <dolfin/common/Set.h>
+#include "CellType.h"
 #include "DistributedMeshTools.h"
 #include "LocalMeshValueCollection.h"
 #include "Mesh.h"
@@ -39,19 +41,20 @@
 
 namespace dolfin
 {
-  // Developer note: MeshFunction and MeshValueCollection cannot appear
-  // in the implementations that appear in this file of the templated
-  // functions as this leads to a circular dependency. Therefore the
-  // functions are templated over these types.
+  // Developer note: MeshFunction and MeshValueCollection cannot
+  // appear in the implementations that appear in this file of the
+  // templated functions as this leads to a circular
+  // dependency. Therefore the functions are templated over these
+  // types.
 
   template <typename T> class MeshFunction;
   template <typename T> class MeshValueCollection;
   class LocalMeshData;
 
   /// This class partitions and distributes a mesh based on
-  /// partitioned local mesh data.The local mesh data will
-  /// also be repartitioned and redistributed during the computation
-  /// of the mesh partitioning.
+  /// partitioned local mesh data.The local mesh data will also be
+  /// repartitioned and redistributed during the computation of the
+  /// mesh partitioning.
   ///
   /// After partitioning, each process has a local mesh and some data
   /// that couples the meshes together.
@@ -60,18 +63,20 @@ namespace dolfin
   {
   public:
 
-    /// Build a partitioned mesh based from a local mesh on process 0
+    /// Build a distributed mesh from a local mesh on process 0
     static void build_distributed_mesh(Mesh& mesh);
 
-    /// Build a partitioned mesh based from a local mesh on process 0
-    /// with supplied destination processes for each cell
+    /// Build a distributed mesh from a local mesh on process 0, with
+    /// distribution of cells supplied (destination processes for each
+    /// cell)
     static void
-      build_distributed_mesh(Mesh& mesh,
-                             const std::vector<std::size_t>& cell_partition);
+      build_distributed_mesh(Mesh& mesh, const std::vector<int>& cell_partition,
+                             const std::string ghost_mode);
 
-    /// Build a partitioned mesh from local mesh data that is
+    /// Build a distributed mesh from 'local mesh data' that is
     /// distributed across processes
-    static void build_distributed_mesh(Mesh& mesh, const LocalMeshData& data);
+    static void build_distributed_mesh(Mesh& mesh, const LocalMeshData& data,
+                                       const std::string ghost_mode);
 
     /// Build a MeshValueCollection based on LocalMeshValueCollection
     template<typename T>
@@ -82,39 +87,66 @@ namespace dolfin
 
   private:
 
-    // Compute cell partitioning for local mesh data. Returns
-    // cell->process vector for cells in LocalMeshData
-    // and a map from local index->processes to which ghost cells must be sent
-    static void partition_cells(const MPI_Comm& mpi_comm, 
-                                const LocalMeshData& mesh_data,
-         std::vector<std::size_t>& cell_partition,
-         std::map<std::size_t, dolfin::Set<unsigned int> >& ghost_procs);
-
-    // Build mesh from local mesh data with a computed partition
+    // Compute cell partitioning from local mesh data. Returns a
+    // vector 'cell -> process' vector for cells in LocalMeshData, and
+    // a map 'local cell index -> processes' to which ghost cells must
+    // be sent
+    static
+    void partition_cells(const MPI_Comm& mpi_comm,
+                         const LocalMeshData& mesh_data,
+                         const std::string partitioner,
+                         std::vector<int>& cell_partition,
+                         std::map<std::int64_t, std::vector<int>>& ghost_procs);
+
+    // Build a distributed mesh from local mesh data with a computed
+    // partition
     static void build(Mesh& mesh, const LocalMeshData& data,
-     const std::vector<std::size_t>& cell_partition,
-     const std::map<std::size_t, dolfin::Set<unsigned int> >& ghost_procs);
-
-    // Distribute a layer of cells attached by vertex to boundary
-    // updating new_mesh_data and shared_cells
-    static void distribute_cell_layer(MPI_Comm mpi_comm,
-      unsigned int num_regular_cells,
-      std::map<unsigned int, std::set<unsigned int> >& shared_cells,
-      LocalMeshData& new_mesh_data);
-
-    // Reorder cells by Gibbs-Poole-Stockmeyer algorithm (via SCOTCH)
-    static void reorder_cells_gps(MPI_Comm mpi_comm,
-     unsigned int num_regular_cells,
-     std::map<unsigned int, std::set<unsigned int> >& shared_cells,
-     LocalMeshData& new_mesh_data);
-    
-    // Reorder vertices by Gibbs-Poole-Stockmeyer algorithm (via SCOTCH)
-    static void reorder_vertices_gps(MPI_Comm mpi_comm,
-     unsigned int num_regular_vertices,
-     unsigned int num_regular_cells,
-     std::map<std::size_t, std::size_t>& vertex_global_to_local,
-     LocalMeshData& new_mesh_data);
-    
+                      const std::vector<int>& cell_partition,
+                      const std::map<std::int64_t, std::vector<int>>& ghost_procs,
+                      const std::string ghost_mode);
+
+    // FIXME: Improve this docstring
+    // Distribute a layer of cells attached by vertex to boundary updating
+    // new_mesh_data and shared_cells. Used when ghosting by vertex.
+    static
+    void distribute_cell_layer(MPI_Comm mpi_comm,
+                               const int num_regular_cells,
+                               const std::int64_t num_global_vertices,
+                               std::map<std::int32_t, std::set<unsigned int>>& shared_cells,
+                               boost::multi_array<std::int64_t, 2>& cell_vertices,
+                               std::vector<std::int64_t>& global_cell_indices,
+                               std::vector<int>& cell_partition);
+
+    // FIXME: make clearer what goes in and what comes out
+    // Reorder cells by Gibbs-Poole-Stockmeyer algorithm (via SCOTCH). Returns
+    // the tuple (new_shared_cells, new_cell_vertices,new_global_cell_indices).
+    static
+    void reorder_cells_gps(MPI_Comm mpi_comm,
+     const unsigned int num_regular_cells,
+     const CellType& cell_type,
+     const std::map<std::int32_t, std::set<unsigned int>>& shared_cells,
+     const boost::multi_array<std::int64_t, 2>& cell_vertices,
+     const std::vector<std::int64_t>& global_cell_indices,
+     std::map<std::int32_t, std::set<unsigned int>>& reordered_shared_cells,
+     boost::multi_array<std::int64_t, 2>& reordered_cell_vertices,
+     std::vector<std::int64_t>& reordered_global_cell_indices);
+
+    // FIXME: make clearer what goes in and what comes out
+    // Reorder vertices by Gibbs-Poole-Stockmeyer algorithm (via SCOTCH).
+    // Returns the pair (new_vertex_indices, new_vertex_global_to_local).
+    static
+    void
+    reorder_vertices_gps(MPI_Comm mpi_comm,
+     const std::int32_t num_regular_vertices,
+     const std::int32_t num_regular_cells,
+     const int  num_cell_vertices,
+     const boost::multi_array<std::int64_t, 2>& cell_vertices,
+     const std::vector<std::int64_t>& vertex_indices,
+     const std::map<std::int64_t, std::int32_t>& vertex_global_to_local,
+     std::vector<std::int64_t>& reordered_vertex_indices,
+     std::map<std::int64_t, std::int32_t>& reordered_vertex_global_to_local);
+
+    // FIXME: Update, making clear exactly what is computed
     // This function takes the partition computed by the partitioner
     // (which tells us to which process each of the local cells stored in
     // LocalMeshData on this process belongs) and sends the cells
@@ -122,61 +154,75 @@ namespace dolfin
     // along with the list of sharing processes.
     // A new LocalMeshData object is populated with the redistributed
     // cells. Return the number of non-ghost cells on this process.
-    static unsigned int 
+    static
+    std::int32_t
       distribute_cells(const MPI_Comm mpi_comm,
         const LocalMeshData& data,
-        const std::vector<std::size_t>& cell_partition,
-        const std::map<std::size_t, dolfin::Set<unsigned int> >& ghost_procs,
-        std::map<unsigned int, std::set<unsigned int> >& shared_cells,
-        LocalMeshData& new_mesh_data);
-
+        const std::vector<int>& cell_partition,
+        const std::map<std::int64_t, std::vector<int>>& ghost_procs,
+        boost::multi_array<std::int64_t, 2>& new_cell_vertices,
+        std::vector<std::int64_t>& new_global_cell_indices,
+        std::vector<int>& new_cell_partition,
+        std::map<std::int32_t, std::set<unsigned int>>& shared_cells);
+
+    // FIXME: Improve explaination
     // Utility to convert received_vertex_indices into
     // vertex sharing information
     static void build_shared_vertices(MPI_Comm mpi_comm,
-     std::map<unsigned int, std::set<unsigned int> >& shared_vertices,
-     const std::map<std::size_t, std::size_t>& vertex_global_to_local_indices,
-     const std::vector<std::vector<std::size_t> >& received_vertex_indices);
+     std::map<std::int32_t, std::set<unsigned int>>& shared_vertices,
+     const std::map<std::int64_t, std::int32_t>& vertex_global_to_local_indices,
+     const std::vector<std::vector<std::size_t>>& received_vertex_indices);
 
-    // Distribute vertices and vertex sharing information,
-    // returning the number of vertices which are not ghosted.
+    // FIXME: make clear what is computed
+    // Distribute vertices and vertex sharing information
     static void
       distribute_vertices(const MPI_Comm mpi_comm,
         const LocalMeshData& mesh_data,
-        LocalMeshData& new_mesh_data,
-        std::map<std::size_t, std::size_t>& vertex_global_to_local_indices,
-        std::map<unsigned int, std::set<unsigned int> >& shared_vertices_local);
-
-    // Work out the mapping from global index to local index for the set of
-    // vertices which are on this process
-    static std::size_t compute_vertex_mapping(MPI_Comm mpi_comm, 
-                  unsigned int num_regular_cells,
-                  LocalMeshData& new_mesh_data,
-                  std::map<std::size_t, std::size_t>& vertex_global_to_local);
-
+        const std::vector<std::int64_t>& vertex_indices,
+        boost::multi_array<double, 2>& new_vertex_coordinates,
+        std::map<std::int64_t, std::int32_t>& vertex_global_to_local_indices,
+        std::map<std::int32_t, std::set<unsigned int>>& shared_vertices_local);
+
+    // Compute the local->global and global->local maps for all local vertices
+    // on this process, from the global vertex indices on each local cell.
+    // Returns the number of regular (non-ghosted) vertices.
+    static std::int32_t compute_vertex_mapping(MPI_Comm mpi_comm,
+                  const std::int32_t num_regular_cells,
+                  const boost::multi_array<std::int64_t, 2>& cell_vertices,
+                  std::vector<std::int64_t>& vertex_indices,
+                  std::map<std::int64_t, std::int32_t>& vertex_global_to_local);
+
+    // FIXME: Improve pre-conditions explaination
     // Build mesh
-    static void build_mesh(Mesh& mesh,
-      const std::map<std::size_t, std::size_t>& vertex_global_to_local_indices,
-      const LocalMeshData& new_mesh_data);
-            
+    static void build_local_mesh(Mesh& mesh,
+      const std::vector<std::int64_t>& global_cell_indices,
+      const boost::multi_array<std::int64_t, 2>& cell_global_vertices,
+      const CellType::Type cell_type,
+      const int tdim,
+      const std::int64_t num_global_cells,
+      const std::vector<std::int64_t>& vertex_indices,
+      const boost::multi_array<double, 2>& vertex_coordinates,
+      const int gdim,
+      const std::int64_t num_global_vertices,
+      const std::map<std::int64_t, std::int32_t>& vertex_global_to_local_indices);
+
     // Create and attach distributed MeshDomains from local_data
-    static void build_mesh_domains(Mesh& mesh,
-      const LocalMeshData& local_data);
+    static void build_mesh_domains(Mesh& mesh, const LocalMeshData& local_data);
 
     // Create and attach distributed MeshDomains from local_data
     // [entry, (cell_index, local_index, value)]
     template<typename T, typename MeshValueCollection>
     static void build_mesh_value_collection(const Mesh& mesh,
-      const std::vector<std::pair<std::pair<std::size_t, std::size_t>, T> >& local_value_data,
+      const std::vector<std::pair<std::pair<std::size_t, std::size_t>, T>>& local_value_data,
       MeshValueCollection& mesh_values);
   };
-
   //---------------------------------------------------------------------------
   template<typename T>
   void MeshPartitioning::build_distributed_value_collection(MeshValueCollection<T>& values,
              const LocalMeshValueCollection<T>& local_data, const Mesh& mesh)
   {
     // Extract data
-    const std::vector<std::pair<std::pair<std::size_t, std::size_t>, T> >& local_values
+    const std::vector<std::pair<std::pair<std::size_t, std::size_t>, T>>& local_values
       = local_data.values();
 
     // Build MeshValueCollection from local data
@@ -185,7 +231,7 @@ namespace dolfin
   //---------------------------------------------------------------------------
   template<typename T, typename MeshValueCollection>
   void MeshPartitioning::build_mesh_value_collection(const Mesh& mesh,
-    const std::vector<std::pair<std::pair<std::size_t, std::size_t>, T> >& local_value_data,
+    const std::vector<std::pair<std::pair<std::size_t, std::size_t>, T>>& local_value_data,
     MeshValueCollection& mesh_values)
   {
     // Get MPI communicator
@@ -210,7 +256,7 @@ namespace dolfin
     MeshValueCollection& markers = mesh_values;
 
     // Get local mesh data for domains
-    const std::vector< std::pair<std::pair<std::size_t, std::size_t>, T> >&
+    const std::vector< std::pair<std::pair<std::size_t, std::size_t>, T>>&
       ldata = local_value_data;
 
     // Get local local-to-global map
@@ -235,6 +281,9 @@ namespace dolfin
 
     for (std::size_t i = 0; i < ldata.size(); ++i)
     {
+      const std::map<std::int32_t, std::set<unsigned int>>& sharing_map
+        = mesh.topology().shared_entities(D);
+
       const std::size_t global_cell_index = ldata[i].first.first;
       std::map<std::size_t, std::size_t>::const_iterator data
         = map_of_global_entity_indices.find(global_cell_index);
@@ -244,6 +293,10 @@ namespace dolfin
         const std::size_t entity_local_index = ldata[i].first.second;
         const T value = ldata[i].second;
         markers.set_value(local_cell_index, entity_local_index, value);
+
+        // If shared with other processes, add to off process list
+        if (sharing_map.find(local_cell_index) != sharing_map.end())
+          off_process_global_cell_entities.push_back(global_cell_index);
       }
       else
         off_process_global_cell_entities.push_back(global_cell_index);
@@ -251,7 +304,7 @@ namespace dolfin
 
     // Get destinations and local cell index at destination for
     // off-process cells
-    const std::map<std::size_t, std::set<std::pair<std::size_t, std::size_t> > >
+    const std::map<std::size_t, std::set<std::pair<std::size_t, std::size_t>>>
       entity_hosts
       = DistributedMeshTools::locate_off_process_entities(off_process_global_cell_entities,
                                                           D, mesh);
@@ -260,14 +313,14 @@ namespace dolfin
     const std::size_t num_processes = MPI::size(mpi_comm);
 
     // Pack data to send to appropriate process
-    std::vector<std::vector<std::size_t> > send_data0(num_processes);
-    std::vector<std::vector<T> > send_data1(num_processes);
-    std::map<std::size_t, std::set<std::pair<std::size_t, std::size_t> > >::const_iterator entity_host;
+    std::vector<std::vector<std::size_t>> send_data0(num_processes);
+    std::vector<std::vector<T>> send_data1(num_processes);
+    std::map<std::size_t, std::set<std::pair<std::size_t, std::size_t>>>::const_iterator entity_host;
 
     {
       // Build a convenience map in order to speedup the loop over
       // local data
-      std::map<std::size_t, std::set<std::size_t> > map_of_ldata;
+      std::map<std::size_t, std::set<std::size_t>> map_of_ldata;
       for (std::size_t i = 0; i < ldata.size(); ++i)
         map_of_ldata[ldata[i].first.first].insert(i);
 
@@ -275,11 +328,11 @@ namespace dolfin
            ++entity_host)
       {
         const std::size_t host_global_cell_index = entity_host->first;
-        const std::set<std::pair<std::size_t, std::size_t> >& processes_data
+        const std::set<std::pair<std::size_t, std::size_t>>& processes_data
           = entity_host->second;
 
         // Loop over local data
-        std::map<std::size_t, std::set<std::size_t> >::const_iterator ldata_it
+        std::map<std::size_t, std::set<std::size_t>>::const_iterator ldata_it
           = map_of_ldata.find(host_global_cell_index);
         if (ldata_it != map_of_ldata.end())
         {
@@ -289,7 +342,7 @@ namespace dolfin
             const std::size_t local_entity_index = ldata[*it].first.second;
             const T domain_value = ldata[*it].second;
 
-            std::set<std::pair<std::size_t, std::size_t> >::const_iterator process_data;
+            std::set<std::pair<std::size_t, std::size_t>>::const_iterator process_data;
             for (process_data = processes_data.begin();
                  process_data != processes_data.end(); ++process_data)
             {
@@ -305,8 +358,8 @@ namespace dolfin
     }
 
     // Send/receive data
-    std::vector<std::vector<std::size_t> > received_data0;
-    std::vector<std::vector<T> > received_data1;
+    std::vector<std::vector<std::size_t>> received_data0;
+    std::vector<std::vector<T>> received_data1;
     MPI::all_to_all(mpi_comm, send_data0, received_data0);
     MPI::all_to_all(mpi_comm, send_data1, received_data1);
 
diff --git a/dolfin/mesh/MeshQuality.cpp b/dolfin/mesh/MeshQuality.cpp
index 39e6b2a..f701647 100644
--- a/dolfin/mesh/MeshQuality.cpp
+++ b/dolfin/mesh/MeshQuality.cpp
@@ -24,6 +24,7 @@
 #include "Mesh.h"
 #include "MeshFunction.h"
 #include "MeshQuality.h"
+#include "Vertex.h"
 
 using namespace dolfin;
 
@@ -54,7 +55,7 @@ std::pair<double, double> MeshQuality::radius_ratio_min_max(const Mesh& mesh)
 
   qmin = MPI::min(mesh.mpi_comm(), qmin);
   qmax = MPI::max(mesh.mpi_comm(), qmax);
-  return std::make_pair(qmin, qmax);
+  return {qmin, qmax};
 }
 //-----------------------------------------------------------------------------
 std::pair<std::vector<double>, std::vector<double>>
@@ -68,6 +69,11 @@ MeshQuality::radius_ratio_histogram_data(const Mesh& mesh,
   for (std::size_t i = 0; i < num_bins; ++i)
     bins[i] = static_cast<double>(i)*interval + interval/2.0;
 
+  std::cout << interval << std::endl;
+  std::cout << num_bins << std::endl;
+  std::cout << static_cast<double>(num_bins) << std::endl;
+
+
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
     const double ratio = cell->radius_ratio();
@@ -82,7 +88,7 @@ MeshQuality::radius_ratio_histogram_data(const Mesh& mesh,
   for (std::size_t i = 0; i < values.size(); ++i)
     values[i] = MPI::sum(mesh.mpi_comm(), values[i]);
 
-  return std::make_pair(bins, values);
+  return {bins, values};
 }
 //-----------------------------------------------------------------------------
 std::string
@@ -99,6 +105,7 @@ MeshQuality::radius_ratio_matplotlib_histogram(const Mesh& mesh,
   // Create Matplotlib string
   std::stringstream matplotlib;
   matplotlib << "def plot_histogram():" << std::endl;
+  matplotlib << "    import matplotlib.pyplot" << std::endl;
   std::stringstream bins, values;
   bins   << "    bins = [" << data.first[0];
   values << "    values = [" << data.second[0];
@@ -114,22 +121,182 @@ MeshQuality::radius_ratio_matplotlib_histogram(const Mesh& mesh,
   matplotlib << values.str()  << std::endl;
   matplotlib << std::endl;
 
-  matplotlib << "    pylab.xlim([0, 1])" <<  std::endl;
+  matplotlib << "    matplotlib.pylab.xlim([0, 1])" <<  std::endl;
   matplotlib << "    width = 0.7*(bins[1] - bins[0])" << std::endl;
-  matplotlib << "    pylab.xlabel('radius ratio')" << std::endl;
-  matplotlib << "    pylab.ylabel('number of cells')" << std::endl;
-  matplotlib << "    pylab.bar(bins, values, align='center', width=width)"
+  matplotlib << "    matplotlib.pylab.xlabel('radius ratio')" << std::endl;
+  matplotlib << "    matplotlib.pylab.ylabel('number of cells')" << std::endl;
+  matplotlib << "    matplotlib.pylab.bar(bins, values, align='center', width=width)"
              << std::endl;
-  matplotlib << "    pylab.show()" << std::endl;
+  matplotlib << "    matplotlib.pylab.show()" << std::endl;
 
   matplotlib << std::endl;
   matplotlib << "try:" << std::endl;
-  matplotlib << "    import pylab"  << std::endl;
+  matplotlib << "    import matplotlib.pylab"  << std::endl;
   matplotlib << "except ImportError:" << std::endl;
-  matplotlib << "    print(\"Plotting mesh quality histogram requires Matplotlib\")" << std::endl;
+  matplotlib << "    print(\"Plotting mesh quality histogram requires Matplotlib\")"
+             << std::endl;
   matplotlib << "else:" << std::endl;
   matplotlib << "    plot_histogram()" << std::endl;
 
   return matplotlib.str();
 }
 //-----------------------------------------------------------------------------
+void MeshQuality::dihedral_angles(const Cell& cell, std::vector<double>& dh_angle)
+{
+  if (cell.type() < 4)
+  {
+      dolfin_error("MeshQuality.cpp",
+                 "calculate dihedral angles",
+                 "Only works for 3D cells");
+  }
+  // Check cell type
+  // dolfin_assert(cell.type()>=4);
+
+  static std::size_t edges[6][2] = {{2, 3},
+                                    {1, 3},
+                                    {1, 2},
+                                    {0, 3},
+                                    {0, 2},
+                                    {0, 1}};
+  const Mesh& mesh = cell.mesh();
+
+  dh_angle.resize(6);
+  for (unsigned int i = 0; i < 6; ++i)
+  {
+    const std::size_t i0 = cell.entities(0)[edges[i][0]];
+    const std::size_t i1 = cell.entities(0)[edges[i][1]];
+    const std::size_t i2 = cell.entities(0)[edges[5 - i][0]];
+    const std::size_t i3 = cell.entities(0)[edges[5 - i][1]];
+    const Point p0 = Vertex(mesh, i0).point();
+    Point v1 = Vertex(mesh, i1).point() - p0;
+    Point v2 = Vertex(mesh, i2).point() - p0;
+    Point v3 = Vertex(mesh, i3).point() - p0;
+    v1 /= v1.norm();
+    v2 /= v2.norm();
+    v3 /= v3.norm();
+    double cphi = (v2.dot(v3) - v1.dot(v2)*v1.dot(v3)) / (v1.cross(v2).norm() * v1.cross(v3).norm());
+    dh_angle[i] = acos(cphi);
+  }
+}
+//-----------------------------------------------------------------------------
+std::pair<double, double> MeshQuality::dihedral_angles_min_max(const Mesh& mesh)
+{
+  // Get the maximum and minimum value of dihedral angles in cells across a mesh
+  // SHOULD ONLY WORK FOR 3D MESH
+  //CellIterator cell(mesh);
+
+  // Get the angles at each cell
+  //std::vector<double> angs;
+  //dihedral_angles(*cell, angs);
+
+  // Get original min and max
+  double d_ang_min = DOLFIN_PI + 1.0;
+  double d_ang_max = -1.0;
+
+  std::vector<double> angs(6);
+  for (CellIterator cell(mesh); !cell.end(); ++cell)
+  {
+    // Get the angles from the next cell
+    dihedral_angles(*cell, angs);
+
+    // And then update the min and max
+    d_ang_min = std::min(d_ang_min, *std::min_element(angs.begin(), angs.end()));
+    d_ang_max = std::max(d_ang_max, *std::max_element(angs.begin(), angs.end()));
+  }
+
+  d_ang_min = MPI::min(mesh.mpi_comm(), d_ang_min);
+  d_ang_max = MPI::max(mesh.mpi_comm(), d_ang_max);
+
+  return {d_ang_min, d_ang_max};
+}
+//-----------------------------------------------------------------------------
+std::pair<std::vector<double>, std::vector<double>>
+MeshQuality::dihedral_angles_histogram_data(const Mesh& mesh,
+                                         std::size_t num_bins)
+{
+  std::vector<double> bins(num_bins), values(num_bins, 0.0);
+
+  // May need to assert the minimum and maximum possible angle
+  dolfin_assert(dihedral_angles_min_max(mesh).first >= 0.0); // Is this really needed?
+  dolfin_assert(dihedral_angles_min_max(mesh).second <= M_PI);
+
+  // Currently min value is 0.0 and max is M_PI
+  const double interval= M_PI/(static_cast<double>(num_bins));
+
+  for (std::size_t i = 0; i < num_bins; ++i)
+    bins[i] = static_cast<double>(i)*interval + interval/2.0;
+
+  std::vector<double> angs(6);
+  for (CellIterator cell(mesh); !cell.end(); ++cell)
+  {
+    // this one should return the value of the angle
+    dihedral_angles(*cell, angs);
+
+    // Iterate through the collected vector
+    for(std::size_t i = 0; i < angs.size(); i++)
+    {
+      // Compute 'bin' index, and handle special case that angle = M_PI
+        const std::size_t slot
+        = std::min(static_cast<std::size_t>(angs[i]/interval), num_bins -1);
+
+        // const std::size_t slot = static_cast<std::size_t>((angs[i] - d_ang_min)/interval);
+        values[slot] += 1.0;
+    }
+  }
+
+  for (std::size_t i = 0; i < values.size(); ++i)
+  {
+    values[i] = MPI::sum(mesh.mpi_comm(), values[i]);
+  }
+
+  return {bins, values};
+}
+//-----------------------------------------------------------------------------
+std::string
+MeshQuality::dihedral_angles_matplotlib_histogram(const Mesh& mesh,
+                 std::size_t num_intervals)
+{
+  // Compute data
+  std::pair<std::vector<double>, std::vector<double>>
+    data = dihedral_angles_histogram_data(mesh, num_intervals);
+
+  dolfin_assert(!data.first.empty());
+  dolfin_assert(data.first.size() == data.second.size());
+
+  // Create Matplotlib string
+  std::stringstream matplotlib;
+  matplotlib << "def plot_histogram():" << std::endl;
+  matplotlib << "    import matplotlib.pyplot" << std::endl;
+  std::stringstream bins, values;
+  bins   << "    bins = [" << data.first[0];
+  values << "    values = [" << data.second[0];
+  for (std::size_t i = 1; i < data.first.size(); ++i)
+  {
+    bins   << ", " << data.first[i];
+    values << ", " << data.second[i];
+  }
+  bins << "]";
+  values << "]";
+
+  matplotlib << bins.str() << std::endl;
+  matplotlib << values.str()  << std::endl;
+  matplotlib << std::endl;
+
+  matplotlib << "    width = 0.7*(bins[1] - bins[0])" << std::endl;
+  matplotlib << "    matplotlib.pylab.xlabel('dihedral angles')" << std::endl;
+  matplotlib << "    matplotlib.pylab.ylabel('number of edges')" << std::endl; // this is weird...
+  matplotlib << "    matplotlib.pylab.bar(bins, values, align='center', width=width)"
+             << std::endl;
+  matplotlib << "    matplotlib.pylab.show()" << std::endl;
+
+  matplotlib << std::endl;
+  matplotlib << "try:" << std::endl;
+  matplotlib << "    import matplotlib.pylab"  << std::endl;
+  matplotlib << "except ImportError:" << std::endl;
+  matplotlib << "    print(\"Plotting mesh quality histogram requires Matplotlib\")"
+             << std::endl;
+  matplotlib << "else:" << std::endl;
+  matplotlib << "    plot_histogram()" << std::endl;
+
+  return matplotlib.str();
+}
diff --git a/dolfin/mesh/MeshQuality.h b/dolfin/mesh/MeshQuality.h
index 5351881..c084252 100644
--- a/dolfin/mesh/MeshQuality.h
+++ b/dolfin/mesh/MeshQuality.h
@@ -31,7 +31,7 @@
 namespace dolfin
 {
 
-  class Mesh;
+    class Mesh;
 
   /// The class provides functions to quantify mesh quality
 
@@ -82,12 +82,30 @@ namespace dolfin
     /// of cell quality
     static std::pair<std::vector<double>, std::vector<double> >
       radius_ratio_histogram_data(const Mesh& mesh,
-                                  std::size_t num_intervals = 50);
+                                  std::size_t num_bins = 50);
 
     /// Create Matplotlib string to plot cell quality histogram
     static std::string
       radius_ratio_matplotlib_histogram(const Mesh& mesh,
-					std::size_t num_bins = 50);
+					std::size_t num_intervals = 50);
+
+    /// Get internal dihedral angles of a tetrahedral cell
+    static void dihedral_angles(const Cell& cell, std::vector<double>& dh_angle); 
+
+    /// Get internal minimum and maximum dihedral angles of a 3D mesh
+    static std::pair<double, double> 
+        dihedral_angles_min_max(const Mesh& mesh);
+
+    /// Create (dihedral angles, number of cells) data for creating a histogram
+    /// of dihedral
+    static std::pair<std::vector<double>, std::vector<double> >
+      dihedral_angles_histogram_data(const Mesh& mesh,
+                                  std::size_t num_bins = 100);
+
+    /// Create Matplotlib string to plot dihedral angles quality histogram
+    static std::string
+      dihedral_angles_matplotlib_histogram(const Mesh& mesh,
+                                std::size_t num_intervals = 100);
   };
 
 }
diff --git a/dolfin/mesh/MeshRenumbering.cpp b/dolfin/mesh/MeshRenumbering.cpp
index 7d652ba..dfd67fd 100644
--- a/dolfin/mesh/MeshRenumbering.cpp
+++ b/dolfin/mesh/MeshRenumbering.cpp
@@ -172,7 +172,7 @@ void MeshRenumbering::compute_renumbering(const Mesh& mesh,
   new_connections.resize(connections_size);
 
   const std::size_t coordinates_size
-    = mesh.geometry().size()*mesh.geometry().dim();
+    = mesh.geometry().num_vertices()*mesh.geometry().dim();
   new_coordinates.resize(coordinates_size);
 
   typedef std::map<std::vector<std::size_t>, std::pair<std::vector<std::size_t>,
@@ -200,7 +200,7 @@ void MeshRenumbering::compute_renumbering(const Mesh& mesh,
                  "Requested mesh coloring has not been computed");
   }
 
-  // Get coloring data (copies since the data will be deleted mesh.clear())
+  // Get coloring data
   const std::vector<std::size_t>& colors_old = mesh_coloring->second.first;
   const std::vector<std::vector<std::size_t>>&
     entities_of_color_old = mesh_coloring->second.second;
diff --git a/dolfin/mesh/MeshSmoothing.cpp b/dolfin/mesh/MeshSmoothing.cpp
index 5d1a6c2..d846cc7 100644
--- a/dolfin/mesh/MeshSmoothing.cpp
+++ b/dolfin/mesh/MeshSmoothing.cpp
@@ -20,6 +20,8 @@
 // First added:  2008-07-16
 // Last changed: 2011-03-17
 
+#include <cmath>
+
 #include <dolfin/ale/ALE.h>
 #include <dolfin/common/Array.h>
 #include <dolfin/common/constants.h>
@@ -38,7 +40,14 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 void MeshSmoothing::smooth(Mesh& mesh, std::size_t num_iterations)
 {
-  log(PROGRESS, "Smoothing mesh");
+  log(PROGRESS, "Smoothing mesh: %s", mesh.str(false).c_str());
+
+  if (mesh.geometry().degree() != 1)
+  {
+    dolfin_error("MeshSmoothing.cpp",
+                 "smooth mesh",
+                 "This function does not support higher-order mesh geometry");
+  }
 
   // Make sure we have cell-facet connectivity
   mesh.init(mesh.topology().dim(), mesh.topology().dim() - 1);
@@ -52,7 +61,7 @@ void MeshSmoothing::smooth(Mesh& mesh, std::size_t num_iterations)
   // Mark vertices on the boundary so we may skip them
   BoundaryMesh boundary(mesh, "exterior");
   const MeshFunction<std::size_t> vertex_map = boundary.entity_map(0);
-  MeshFunction<bool> on_boundary(mesh, 0);
+  MeshFunction<bool> on_boundary(reference_to_no_delete_pointer(mesh), 0);
   on_boundary = false;
   if (boundary.num_vertices() > 0)
   {
@@ -72,7 +81,6 @@ void MeshSmoothing::smooth(Mesh& mesh, std::size_t num_iterations)
         continue;
 
       // Get coordinates of vertex
-      double* x = mesh.geometry().x(v->index());
       const Point p = v->point();
 
       // Compute center of mass of neighboring vertices
@@ -128,15 +136,20 @@ void MeshSmoothing::smooth(Mesh& mesh, std::size_t num_iterations)
       double r = 0.0;
       for (std::size_t i = 0; i < d; i++)
       {
-        const double dx = xx[i] - x[i];
+        const double dx = xx[i] - p[i];
         r += dx*dx;
       }
       r = std::sqrt(r);
       if (r < DOLFIN_EPS)
         continue;
       rmin = std::min(0.5*rmin, r);
+
+      std::vector<double> new_vertex(mesh.geometry().x(v->index()),
+                                     mesh.geometry().x(v->index()) + d);
       for (std::size_t i = 0; i < d; i++)
-        x[i] += rmin*(xx[i] - x[i])/r;
+        new_vertex[i] += rmin*(xx[i] - p[i])/r;
+      mesh.geometry().set(v->index(), new_vertex.data());
+
     }
   }
 
@@ -148,7 +161,7 @@ void MeshSmoothing::smooth_boundary(Mesh& mesh,
                                     std::size_t num_iterations,
                                     bool harmonic_smoothing)
 {
-  cout << "Smoothing boundary of mesh: " << mesh << endl;
+  log(PROGRESS, "Smoothing boundary of mesh: %s", mesh.str(false).c_str());
 
   // Extract boundary of mesh
   BoundaryMesh boundary(mesh, "exterior");
@@ -164,7 +177,14 @@ void MeshSmoothing::snap_boundary(Mesh& mesh,
                                   const SubDomain& sub_domain,
                                   bool harmonic_smoothing)
 {
-  cout << "Snapping boundary of mesh: " << mesh << endl;
+  log(PROGRESS, "Snapping boundary of mesh: %s", mesh.str(false).c_str());
+
+  if (mesh.geometry().degree() != 1)
+  {
+    dolfin_error("MeshSmoothing.cpp",
+                 "snap mesh boundary",
+                 "This function does not support higher-order mesh geometry");
+  }
 
   // Extract boundary of mesh
   BoundaryMesh boundary(mesh, "exterior");
@@ -175,8 +195,10 @@ void MeshSmoothing::snap_boundary(Mesh& mesh,
   MeshGeometry& geometry = boundary.geometry();
   for (std::size_t i = 0; i < boundary.num_vertices(); i++)
   {
-    Array<double> x(dim, geometry.x(i));
+    Point p = geometry.point(i);
+    Array<double> x(dim, p.coordinates());
     sub_domain.snap(x);
+    geometry.set(i, p.coordinates());
   }
 
   // Move interior vertices
@@ -189,19 +211,23 @@ void MeshSmoothing::move_interior_vertices(Mesh& mesh,
 {
   // Select smoothing of interior vertices
   if (harmonic_smoothing)
-    ALE::move(mesh, boundary);
+  {
+    std::shared_ptr<Mesh> _mesh(&mesh, [](Mesh*){});
+    ALE::move(_mesh, boundary);
+  }
   else
   {
+    if (mesh.geometry().degree() != 1)
+    {
+      dolfin_error("MeshSmoothing.cpp",
+                   "move interior vertices",
+                   "This function does not support higher-order mesh geometry");
+    }
+
     // Use vertex map to update boundary coordinates of original mesh
     const MeshFunction<std::size_t>& vertex_map = boundary.entity_map(0);
-    const std::size_t d = mesh.geometry().dim();
     for (VertexIterator v(boundary); !v.end(); ++v)
-    {
-      const double* xb = v->x();
-      double* xm = mesh.geometry().x(vertex_map[*v]);
-      for (std::size_t i = 0; i < d; i++)
-        xm[i] = xb[i];
-    }
+      mesh.geometry().set(vertex_map[*v], v->x());
   }
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/mesh/MeshTopology.cpp b/dolfin/mesh/MeshTopology.cpp
index 42f75c3..06cf1f8 100644
--- a/dolfin/mesh/MeshTopology.cpp
+++ b/dolfin/mesh/MeshTopology.cpp
@@ -180,19 +180,17 @@ const dolfin::MeshConnectivity& MeshTopology::operator() (std::size_t d0,
   return connectivity[d0][d1];
 }
 //-----------------------------------------------------------------------------
-std::map<unsigned int, std::set<unsigned int>>&
+std::map<std::int32_t, std::set<unsigned int>>&
   MeshTopology::shared_entities(unsigned int dim)
 {
   dolfin_assert(dim <= this->dim());
   return _shared_entities[dim];
 }
 //-----------------------------------------------------------------------------
-const std::map<unsigned int, std::set<unsigned int>>&
+const std::map<std::int32_t, std::set<unsigned int>>&
   MeshTopology::shared_entities(unsigned int dim) const
 {
-  std::map<unsigned int, std::map<unsigned int,
-                                  std::set<unsigned int>>>::const_iterator e;
-  e = _shared_entities.find(dim);
+  auto e = _shared_entities.find(dim);
   if (e == _shared_entities.end())
   {
     dolfin_error("MeshTopology.cpp",
diff --git a/dolfin/mesh/MeshTopology.h b/dolfin/mesh/MeshTopology.h
index 7d762dc..cd78f95 100644
--- a/dolfin/mesh/MeshTopology.h
+++ b/dolfin/mesh/MeshTopology.h
@@ -21,6 +21,7 @@
 #ifndef __MESH_TOPOLOGY_H
 #define __MESH_TOPOLOGY_H
 
+#include <cstdint>
 #include <map>
 #include <utility>
 #include <vector>
@@ -122,12 +123,12 @@ namespace dolfin
 
     /// Return map from shared entities (local index) to processes
     /// that share the entity
-    std::map<unsigned int, std::set<unsigned int> >&
+    std::map<std::int32_t, std::set<unsigned int> >&
       shared_entities(unsigned int dim);
 
     /// Return map from shared entities (local index) to process that
     /// share the entity (const version)
-    const std::map<unsigned int, std::set<unsigned int> >&
+    const std::map<std::int32_t, std::set<unsigned int> >&
       shared_entities(unsigned int dim) const;
 
     /// Return mapping from local ghost cell index to owning process
@@ -167,17 +168,14 @@ namespace dolfin
     //                 to avoid circular dependencies in the header files
     std::map<std::vector<std::size_t>,
       std::pair<std::vector<std::size_t>,
-      std::vector<std::vector<std::size_t> > > > coloring;
+      std::vector<std::vector<std::size_t>>>> coloring;
 
   private:
 
-    // Friends
-    friend class BinaryFile;
-
     // Number of mesh entities for each topological dimension
     std::vector<unsigned int> num_entities;
 
-    // Number of ghost indices for each topological dimension 
+    // Number of ghost indices for each topological dimension
     std::vector<std::size_t> ghost_offset_index;
 
     // Global number of mesh entities for each topological dimension
@@ -188,7 +186,7 @@ namespace dolfin
 
     // For entities of a given dimension d , maps each shared entity
     // (local index) to a list of the processes sharing the vertex
-    std::map<unsigned int, std::map<unsigned int, std::set<unsigned int> > >
+    std::map<unsigned int, std::map<std::int32_t, std::set<unsigned int>>>
       _shared_entities;
 
     // For cells which are "ghosted", locate the owning process,
diff --git a/dolfin/mesh/MeshTransformation.cpp b/dolfin/mesh/MeshTransformation.cpp
index 02a1e1b..7475974 100644
--- a/dolfin/mesh/MeshTransformation.cpp
+++ b/dolfin/mesh/MeshTransformation.cpp
@@ -14,13 +14,11 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-01-16
-// Last changed: 2013-06-28
 
+#include <array>
 #include <cmath>
-
 #include <dolfin/common/constants.h>
+#include <dolfin/geometry/Point.h>
 #include <dolfin/mesh/Mesh.h>
 #include "MeshTransformation.h"
 
@@ -35,13 +33,40 @@ void MeshTransformation::translate(Mesh& mesh, const Point& point)
 
   // Get displacement vector coordinates
   const double* dx = point.coordinates();
+  dolfin_assert(dx);
 
   // Displace all points
-  for (std::size_t i = 0; i < geometry.size(); i++)
+  std::vector<double> x0(gdim);
+  for (std::size_t i = 0; i < geometry.num_vertices(); i++)
   {
-    double* x = geometry.x(i);
     for (std::size_t j = 0; j < gdim; j++)
-      x[j] += dx[j];
+      x0[j] = geometry.x(i, j) + dx[j];
+    geometry.set(i, x0.data());
+  }
+}
+//-----------------------------------------------------------------------------
+void MeshTransformation::rescale(Mesh& mesh, const double scale,
+                                 const Point& center)
+{
+  // Get mesh geometry
+  MeshGeometry& geometry = mesh.geometry();
+  const std::size_t gdim = geometry.dim();
+
+  // Get center coordinates
+  const double* dx = center.coordinates();
+
+  // 1. Displace all points by -dx so that the center coincides with
+  // the origin: x = x - x_center
+  // 2. Scale all points by the scaling factor x = s * x
+  // 3. Displace all points by +dx again x = x + x_center
+  // Summarized: x = s * x + (1 - s) * x_center
+
+  std::vector<double> x0(gdim);
+  for (std::size_t i = 0; i < geometry.num_vertices(); i++)
+  {
+    for (std::size_t j = 0; j < gdim; j++)
+      x0[j] = scale * geometry.x(i, j) + (1-scale)*dx[j];
+    geometry.set(i, x0.data());
   }
 }
 //-----------------------------------------------------------------------------
@@ -52,12 +77,10 @@ void MeshTransformation::rotate(Mesh& mesh, double angle, std::size_t axis)
   const std::size_t gdim = geometry.dim();
 
   // Reset center of mass
-  std::vector<double> c(gdim);
-  for (std::size_t j = 0; j < gdim; j++)
-    c[j] = 0.0;
+  std::vector<double> c(gdim, 0.0);
 
   // Sum all vertex coordinates
-  for (std::size_t i = 0; i < geometry.size(); i++)
+  for (std::size_t i = 0; i < geometry.num_vertices(); i++)
   {
     const double* x = geometry.x(i);
     for (std::size_t j = 0; j < gdim; j++)
@@ -66,7 +89,7 @@ void MeshTransformation::rotate(Mesh& mesh, double angle, std::size_t axis)
 
   // Divide by the number of vertices
   for (std::size_t j = 0; j < gdim; j++)
-    c[j] /= static_cast<double>(geometry.size());
+    c[j] /= static_cast<double>(geometry.num_vertices());
 
   // Set up point
   dolfin_assert(gdim <= 3);
@@ -105,22 +128,22 @@ void MeshTransformation::rotate(Mesh& mesh, double angle, std::size_t axis,
 
     // Rotate all points
     MeshGeometry& geometry = mesh.geometry();
-    for (std::size_t i = 0; i < geometry.size(); i++)
+    std::array<double, 2> xr;
+    for (std::size_t i = 0; i < geometry.num_vertices(); i++)
     {
       // Get coordinate
-      double* x = geometry.x(i);
+      const double* x = geometry.x(i);
 
       // Compute vector from rotation point
       const double dx0 = x[0] - c[0];
       const double dx1 = x[1] - c[1];
 
       // Rotate
-      const double x0 = c[0] + S00*dx0 + S01*dx1;
-      const double x1 = c[1] + S10*dx0 + S11*dx1;
+      xr[0] = c[0] + S00*dx0 + S01*dx1;
+      xr[1] = c[1] + S10*dx0 + S11*dx1;
 
       // Store coordinate
-      x[0] = x0;
-      x[1] = x1;
+      geometry.set(i, xr.data());
     }
   }
   else if (gdim == 3)
@@ -154,10 +177,11 @@ void MeshTransformation::rotate(Mesh& mesh, double angle, std::size_t axis,
 
     // Rotate all points
     MeshGeometry& geometry = mesh.geometry();
-    for (std::size_t i = 0; i < geometry.size(); i++)
+    std::array<double, 3> xr;
+    for (std::size_t i = 0; i < geometry.num_vertices(); i++)
     {
       // Get coordinate
-      double* x = geometry.x(i);
+      const double* x = geometry.x(i);
 
       // Compute vector from rotation point
       const double dx0 = x[0] - c[0];
@@ -165,14 +189,12 @@ void MeshTransformation::rotate(Mesh& mesh, double angle, std::size_t axis,
       const double dx2 = x[2] - c[2];
 
       // Rotate
-      const double x0 = c[0] + R00*dx0 + R01*dx1 + R02*dx2;
-      const double x1 = c[1] + R10*dx0 + R11*dx1 + R12*dx2;
-      const double x2 = c[2] + R20*dx0 + R21*dx1 + R22*dx2;
+      xr[0] = c[0] + R00*dx0 + R01*dx1 + R02*dx2;
+      xr[1] = c[1] + R10*dx0 + R11*dx1 + R12*dx2;
+      xr[2] = c[2] + R20*dx0 + R21*dx1 + R22*dx2;
 
       // Store coordinate
-      x[0] = x0;
-      x[1] = x1;
-      x[2] = x2;
+      geometry.set(i, xr.data());
     }
   }
   else
diff --git a/dolfin/mesh/MeshTransformation.h b/dolfin/mesh/MeshTransformation.h
index bca69b9..d615bf1 100644
--- a/dolfin/mesh/MeshTransformation.h
+++ b/dolfin/mesh/MeshTransformation.h
@@ -24,52 +24,64 @@
 namespace dolfin
 {
 
-   class Mesh;
-   class Point;
+  class Mesh;
+  class Point;
 
   /// This class implements various transformations of the coordinates
   /// of a mesh.
 
-  class MeshTransformation
-  {
-  public:
+class MeshTransformation
+{
+public:
+
+  /// Translate mesh according to a given vector.
+  ///
+  /// *Arguments*
+  ///     mesh (_Mesh_)
+  ///         The mesh
+  ///     point (Point)
+  ///         The vector defining the translation.
+  static void translate(Mesh& mesh, const Point& point);
 
-    /// Translate mesh according to a given vector.
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh
-    ///     point (Point)
-    ///         The vector defining the translation.
-    static void translate(Mesh& mesh, const Point& point);
+  /// Rescale mesh by a given scaling factor with respect to a center
+  /// point.
+  ///
+  /// *Arguments*
+  ///     mesh (_Mesh_)
+  ///         The mesh
+  ///      scale (double)
+  ///         The scaling factor.
+  ///      center (Point)
+  ///         The center of the scaling.
+  static void rescale(Mesh& mesh, const double scale, const Point& center);
 
-    /// Rotate mesh around a coordinate axis through center of mass
-    /// of all mesh vertices
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh.
-    ///     angle (double)
-    ///         The number of degrees (0-360) of rotation.
-    ///     axis (std::size_t)
-    ///         The coordinate axis around which to rotate the mesh.
-    static void rotate(Mesh& mesh, double angle, std::size_t axis);
+  /// Rotate mesh around a coordinate axis through center of mass
+  /// of all mesh vertices
+  ///
+  /// *Arguments*
+  ///     mesh (_Mesh_)
+  ///         The mesh.
+  ///     angle (double)
+  ///         The number of degrees (0-360) of rotation.
+  ///     axis (std::size_t)
+  ///         The coordinate axis around which to rotate the mesh.
+  static void rotate(Mesh& mesh, double angle, std::size_t axis);
 
-    /// Rotate mesh around a coordinate axis through a given point
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh.
-    ///     angle (double)
-    ///         The number of degrees (0-360) of rotation.
-    ///     axis (std::size_t)
-    ///         The coordinate axis around which to rotate the mesh.
-    ///     point (_Point_)
-    ///         The point around which to rotate the mesh.
-    static void rotate(Mesh& mesh, double angle, std::size_t axis,
-                       const Point& p);
+  /// Rotate mesh around a coordinate axis through a given point
+  ///
+  /// *Arguments*
+  ///     mesh (_Mesh_)
+  ///         The mesh.
+  ///     angle (double)
+  ///         The number of degrees (0-360) of rotation.
+  ///     axis (std::size_t)
+  ///         The coordinate axis around which to rotate the mesh.
+  ///     point (_Point_)
+  ///         The point around which to rotate the mesh.
+  static void rotate(Mesh& mesh, double angle, std::size_t axis,
+                     const Point& p);
 
-  };
+};
 
 }
 
diff --git a/dolfin/mesh/MeshValueCollection.h b/dolfin/mesh/MeshValueCollection.h
index 8b1a54d..9d56519 100644
--- a/dolfin/mesh/MeshValueCollection.h
+++ b/dolfin/mesh/MeshValueCollection.h
@@ -77,16 +77,6 @@ namespace dolfin
     ///         The mesh associated with the collection.
     ///     dim (std::size_t)
     ///         The mesh entity dimension for the mesh value collection.
-    MeshValueCollection(const Mesh& mesh, std::size_t dim);
-
-    /// Create a mesh value collection of entities of given dimension
-    /// on a given mesh (shared_ptr version)
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh associated with the collection.
-    ///     dim (std::size_t)
-    ///         The mesh entity dimension for the mesh value collection.
     MeshValueCollection(std::shared_ptr<const Mesh> mesh, std::size_t dim);
 
     /// Create a mesh value collection from a file.
@@ -99,7 +89,7 @@ namespace dolfin
     ///         The XML file name.
     ///     dim (std::size_t)
     ///         The mesh entity dimension for the mesh value collection.
-    MeshValueCollection(const Mesh& mesh, const std::string filename);
+    MeshValueCollection(std::shared_ptr<const Mesh> mesh, const std::string filename);
 
     /// Destructor
     ~MeshValueCollection() {}
@@ -128,16 +118,6 @@ namespace dolfin
     ///         The mesh on which the value collection is defined
     ///     dim (std::size_t)
     ///         The mesh entity dimension for the mesh value collection.
-    void init(const Mesh& mesh, std::size_t dim);
-
-    /// Initialise MeshValueCollection with mesh and dimension
-    /// (shared_ptr version)
-    ///
-    /// *Arguments*
-    ///     mesh (_mesh))
-    ///         The mesh on which the value collection is defined
-    ///     dim (std::size_t)
-    ///         The mesh entity dimension for the mesh value collection.
     void init(std::shared_ptr<const Mesh> mesh, std::size_t dim);
 
     /// Set dimension. This function should not generally be used. It is
@@ -284,15 +264,6 @@ namespace dolfin
   }
   //---------------------------------------------------------------------------
   template <typename T>
-  MeshValueCollection<T>::MeshValueCollection(const Mesh& mesh,
-                                              std::size_t dim)
-    : Variable("m", "unnamed MeshValueCollection"),
-      _mesh(reference_to_no_delete_pointer(mesh)), _dim(dim)
-  {
-    // Do nothing
-  }
-  //---------------------------------------------------------------------------
-  template <typename T>
   MeshValueCollection<T>::MeshValueCollection(std::shared_ptr<const Mesh>
                                               mesh, std::size_t dim)
     : Variable("m", "unnamed MeshValueCollection"), _mesh(mesh), _dim(dim)
@@ -316,7 +287,7 @@ namespace dolfin
            ++cell_index)
       {
         const std::pair<std::size_t, std::size_t> key(cell_index, 0);
-        _values.insert(std::make_pair(key, mesh_function[cell_index]));
+        _values.insert({key, mesh_function[cell_index]});
       }
     }
     else
@@ -341,17 +312,17 @@ namespace dolfin
           // Insert into map
           const std::pair<std::size_t, std::size_t> key(cell.index(),
                                                         local_entity);
-          _values.insert(std::make_pair(key, mesh_function[entity_index]));
+          _values.insert({key, mesh_function[entity_index]});
         }
       }
     }
   }
   //---------------------------------------------------------------------------
   template <typename T>
-  MeshValueCollection<T>::MeshValueCollection(const Mesh& mesh,
-                                              const std::string filename)
+    MeshValueCollection<T>::MeshValueCollection(std::shared_ptr<const Mesh> mesh,
+                                                const std::string filename)
     : Variable("m", "unnamed MeshValueCollection"),
-      _mesh(reference_to_no_delete_pointer(mesh)), _dim(-1)
+      _mesh(mesh), _dim(-1)
   {
     File file(filename);
     file >> *this;
@@ -377,7 +348,7 @@ namespace dolfin
            ++cell_index)
       {
         const std::pair<std::size_t, std::size_t> key(cell_index, 0);
-        _values.insert(std::make_pair(key, mesh_function[cell_index]));
+        _values.insert({key, mesh_function[cell_index]});
       }
     }
     else
@@ -402,7 +373,7 @@ namespace dolfin
           // Insert into map
           const std::pair<std::size_t, std::size_t> key(cell.index(),
                                                         local_entity);
-          _values.insert(std::make_pair(key, mesh_function[entity_index]));
+          _values.insert({key, mesh_function[entity_index]});
         }
       }
     }
@@ -423,15 +394,6 @@ namespace dolfin
   }
   //---------------------------------------------------------------------------
   template <typename T>
-  void MeshValueCollection<T>::init(const Mesh& mesh, std::size_t dim)
-  {
-    mesh.init(dim);
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _dim = dim;
-    _values.clear();
-  }
-  //---------------------------------------------------------------------------
-  template <typename T>
   void MeshValueCollection<T>::init(std::shared_ptr<const Mesh> mesh,
                                     std::size_t dim)
   {
@@ -490,7 +452,7 @@ namespace dolfin
 
     const std::pair<std::size_t, std::size_t> pos(cell_index, local_entity);
     std::pair<typename std::map<std::pair<std::size_t, std::size_t>, T>::iterator, bool>
-      it = _values.insert(std::make_pair(pos, value));
+      it = _values.insert({pos, value});
 
     // If an item with same key already exists the value has not been
     // set and we need to update it
@@ -521,7 +483,7 @@ namespace dolfin
       const std::pair<std::size_t, std::size_t> pos(entity_index, 0);
       std::pair<typename std::map<std::pair<std::size_t,
         std::size_t>, T>::iterator, bool> it;
-      it = _values.insert(std::make_pair(pos, value));
+      it = _values.insert({pos, value});
 
       // If an item with same key already exists the value has not been
       // set and we need to update it
@@ -548,7 +510,7 @@ namespace dolfin
     const std::pair<std::size_t, std::size_t> pos(cell.index(), local_entity);
     std::pair<typename std::map<std::pair<std::size_t,
       std::size_t>, T>::iterator, bool> it;
-    it = _values.insert(std::make_pair(pos, value));
+    it = _values.insert({pos, value});
 
     // If an item with same key already exists the value has not been
     // set and we need to update it
diff --git a/dolfin/mesh/MultiMesh.cpp b/dolfin/mesh/MultiMesh.cpp
index 08a6f99..f4f6ed6 100644
--- a/dolfin/mesh/MultiMesh.cpp
+++ b/dolfin/mesh/MultiMesh.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014 Anders Logg
+// Copyright (C) 2013-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -18,7 +18,9 @@
 // Modified by August Johansson 2014
 //
 // First added:  2013-08-05
-// Last changed: 2014-05-28
+// Last changed: 2016-03-02
+
+#include <cmath>
 
 #include <dolfin/log/log.h>
 #include <dolfin/plot/plot.h>
@@ -36,8 +38,46 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 MultiMesh::MultiMesh()
 {
-  // Set parameters
-  parameters = default_parameters();
+  // Do nothing
+}
+//-----------------------------------------------------------------------------
+MultiMesh::MultiMesh(std::vector<std::shared_ptr<const Mesh>> meshes,
+                     std::size_t quadrature_order)
+{
+  // Add and build
+  for (auto mesh : meshes)
+    add(mesh);
+  build(quadrature_order);
+}
+//-----------------------------------------------------------------------------
+MultiMesh::MultiMesh(std::shared_ptr<const Mesh> mesh_0,
+                     std::size_t quadrature_order)
+{
+  // Add and build
+  add(mesh_0);
+  build(quadrature_order);
+}
+//-----------------------------------------------------------------------------
+MultiMesh::MultiMesh(std::shared_ptr<const Mesh> mesh_0,
+                     std::shared_ptr<const Mesh> mesh_1,
+                     std::size_t quadrature_order)
+{
+  // Add and build
+  add(mesh_0);
+  add(mesh_1);
+  build(quadrature_order);
+}
+//-----------------------------------------------------------------------------
+MultiMesh::MultiMesh(std::shared_ptr<const Mesh> mesh_0,
+                     std::shared_ptr<const Mesh> mesh_1,
+                     std::shared_ptr<const Mesh> mesh_2,
+                     std::size_t quadrature_order)
+{
+  // Add and build
+  add(mesh_0);
+  add(mesh_1);
+  add(mesh_2);
+  build(quadrature_order);
 }
 //-----------------------------------------------------------------------------
 MultiMesh::~MultiMesh()
@@ -143,12 +183,7 @@ void MultiMesh::add(std::shared_ptr<const Mesh> mesh)
       _meshes.size());
 }
 //-----------------------------------------------------------------------------
-void MultiMesh::add(const Mesh& mesh)
-{
-  add(reference_to_no_delete_pointer(mesh));
-}
-//-----------------------------------------------------------------------------
-void MultiMesh::build()
+void MultiMesh::build(std::size_t quadrature_order)
 {
   begin(PROGRESS, "Building multimesh.");
 
@@ -167,10 +202,10 @@ void MultiMesh::build()
 
   // Build quadrature rules of the cut cells' overlap. Do this before
   // we build the quadrature rules of the cut cells
-  _build_quadrature_rules_overlap();
+  _build_quadrature_rules_overlap(quadrature_order);
 
   // Build quadrature rules of the cut cells
-  _build_quadrature_rules_cut_cells();
+  _build_quadrature_rules_cut_cells(quadrature_order);
 
   end();
 }
@@ -370,13 +405,10 @@ void MultiMesh::_build_collision_maps()
   end();
 }
 //-----------------------------------------------------------------------------
-void MultiMesh::_build_quadrature_rules_overlap()
+void MultiMesh::_build_quadrature_rules_overlap(std::size_t quadrature_order)
 {
   begin(PROGRESS, "Building quadrature rules of cut cells' overlap.");
 
-  // Get quadrature order
-  const std::size_t quadrature_order = parameters["quadrature_order"];
-
   // Clear quadrature rules
   _quadrature_rules_overlap.clear();
   _quadrature_rules_interface.clear();
@@ -676,16 +708,10 @@ void MultiMesh::_build_quadrature_rules_overlap()
   end();
 }
 //-----------------------------------------------------------------------------
-void MultiMesh::_build_quadrature_rules_cut_cells()
+void MultiMesh::_build_quadrature_rules_cut_cells(std::size_t quadrature_order)
 {
   begin(PROGRESS, "Building quadrature rules of cut cells.");
 
-  // FIXME: Do we want to check to make sure we
-  // have the same order in the overlapping part?
-
-  // Get quadrature order
-  const std::size_t quadrature_order = parameters["quadrature_order"];
-
   // Clear quadrature rules
   _quadrature_rules_cut_cells.clear();
   _quadrature_rules_cut_cells.resize(num_parts());
@@ -797,6 +823,10 @@ std::size_t MultiMesh::_add_quadrature_rule(quadrature_rule& qr,
 //-----------------------------------------------------------------------------
 void MultiMesh::_plot() const
 {
+  // Developer note: This function is implemented here rather than
+  // in the plot library since it is too specialized to be implemented
+  // there.
+
   cout << "Plotting multimesh with " << num_parts() << " parts" << endl;
 
   // Iterate over parts
@@ -830,7 +860,7 @@ void MultiMesh::_plot() const
     // Plot
     std::stringstream s;
     s << "Map of cell types for multimesh part " << p;
-    plot(f, s.str());
+    dolfin::plot(f, s.str());
   }
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/mesh/MultiMesh.h b/dolfin/mesh/MultiMesh.h
index 2e773f2..689d4cc 100644
--- a/dolfin/mesh/MultiMesh.h
+++ b/dolfin/mesh/MultiMesh.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Anders Logg
+// Copyright (C) 2014-2016 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2014-03-03
-// Last changed: 2014-06-17
+// Last changed: 2016-03-02
 
 #ifndef __MULTI_MESH_H
 #define __MULTI_MESH_H
@@ -54,6 +54,27 @@ namespace dolfin
     /// Create empty multimesh
     MultiMesh();
 
+    /// Create multimesh from given list of meshes
+    MultiMesh(std::vector<std::shared_ptr<const Mesh>> meshes,
+              std::size_t quadrature_order);
+
+    //--- Convenience constructors ---
+
+    /// Create multimesh from one mesh
+    MultiMesh(std::shared_ptr<const Mesh> mesh_0,
+              std::size_t quadrature_order);
+
+    /// Create multimesh from two meshes
+    MultiMesh(std::shared_ptr<const Mesh> mesh_0,
+              std::shared_ptr<const Mesh> mesh_1,
+              std::size_t quadrature_order);
+
+    /// Create multimesh from three meshes
+    MultiMesh(std::shared_ptr<const Mesh> mesh_0,
+              std::shared_ptr<const Mesh> mesh_1,
+              std::shared_ptr<const Mesh> mesh_2,
+              std::size_t quadrature_order);
+
     /// Destructor
     ~MultiMesh();
 
@@ -253,39 +274,22 @@ namespace dolfin
     std::shared_ptr<const BoundingBoxTree>
     bounding_box_tree_boundary(std::size_t part) const;
 
-    /// Add mesh (shared pointer version)
+    /// Add mesh
     ///
     /// *Arguments*
     ///     mesh (_Mesh_)
     ///         The mesh
     void add(std::shared_ptr<const Mesh> mesh);
 
-    /// Add mesh (reference version)
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh
-    void add(const Mesh& mesh);
-
     /// Build multimesh
-    void build();
+    void build(std::size_t quadrature_order=2);
 
     /// Clear multimesh
     void clear();
 
-    /// Default parameter values
-    static Parameters default_parameters()
-    {
-      Parameters p("multimesh");
-
-      p.add("quadrature_order", 1);
-
-      return p;
-    }
-
   private:
 
-    // Friends
+    // Friend (in plot.h)
     friend void plot(std::shared_ptr<const MultiMesh>);
 
     // List of meshes
@@ -432,10 +436,10 @@ namespace dolfin
     //void _build_collision_maps_different_topology();
 
     // Build quadrature rules for the cut cells
-    void _build_quadrature_rules_cut_cells();
+    void _build_quadrature_rules_cut_cells(std::size_t quadrature_order);
 
     // Build quadrature rules for the overlap
-    void _build_quadrature_rules_overlap();
+    void _build_quadrature_rules_overlap(std::size_t quadrature_order);
 
     // Add quadrature rule for simplices in the triangulation
     // array. Returns the number of points generated for each simplex.
diff --git a/dolfin/mesh/PeriodicBoundaryComputation.cpp b/dolfin/mesh/PeriodicBoundaryComputation.cpp
index 02c0e05..25dfc61 100644
--- a/dolfin/mesh/PeriodicBoundaryComputation.cpp
+++ b/dolfin/mesh/PeriodicBoundaryComputation.cpp
@@ -141,7 +141,7 @@ std::map<unsigned int, std::pair<unsigned int, unsigned int>>
           }
 
           // Insert (midpoint coordinates, local index) into map
-          master_coord_to_entity_index.insert(std::make_pair(x, e->index()));
+          master_coord_to_entity_index.insert({x, e->index()});
         }
         else
         {
@@ -266,8 +266,7 @@ std::map<unsigned int, std::pair<unsigned int, unsigned int>>
       if (master_entity_index_p[i] < std::numeric_limits<unsigned int>::max())
       {
         ++num_local_slave_entities;
-        slave_to_master_entity.insert(std::make_pair(sent_slaves_p[i],
-                                      std::make_pair(p, master_entity_index_p[i])));
+        slave_to_master_entity.insert({sent_slaves_p[i], {p, master_entity_index_p[i]}});
       }
     }
   }
@@ -283,7 +282,7 @@ PeriodicBoundaryComputation::masters_slaves(std::shared_ptr<const Mesh> mesh,
   dolfin_assert(mesh);
 
   // Create MeshFunction and initialise to zero
-  MeshFunction<std::size_t> mf(*mesh, dim, 0);
+  MeshFunction<std::size_t> mf(mesh, dim, 0);
 
   // Compute marker
   const std::map<unsigned int, std::pair<unsigned int, unsigned int>>
diff --git a/dolfin/mesh/PointCell.cpp b/dolfin/mesh/PointCell.cpp
index 9d35d40..cb8a540 100644
--- a/dolfin/mesh/PointCell.cpp
+++ b/dolfin/mesh/PointCell.cpp
@@ -85,14 +85,6 @@ void PointCell::create_entities(boost::multi_array<unsigned int, 2>& e,
                "Entities on a point cell are not defined");
 }
 //-----------------------------------------------------------------------------
-void PointCell::refine_cell(Cell& cell, MeshEditor& editor,
-                            std::size_t& current_cell) const
-{
-  dolfin_error("PointCell.cpp",
-               "refine cell",
-               "Refinement of a point cell is not defined");
-}
-//-----------------------------------------------------------------------------
 double PointCell::volume(const MeshEntity& triangle) const
 {
   dolfin_error("PointCell.cpp",
@@ -101,11 +93,12 @@ double PointCell::volume(const MeshEntity& triangle) const
   return 0.0;
 }
 //-----------------------------------------------------------------------------
-double PointCell::diameter(const MeshEntity& triangle) const
+
+double PointCell::circumradius(const MeshEntity& point) const
 {
   dolfin_error("PointCell.cpp",
-               "find diameter of cell",
-               "Diameter of a point cell is not defined");
+               "find circumradious of cell",
+               "Circumradius of a point cell is not defined");
   return 0.0;
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/mesh/PointCell.h b/dolfin/mesh/PointCell.h
index 176bf9f..ac74cae 100644
--- a/dolfin/mesh/PointCell.h
+++ b/dolfin/mesh/PointCell.h
@@ -60,15 +60,11 @@ namespace dolfin
     void order(Cell& cell, const std::vector<std::size_t>&
                local_to_global_vertex_indices) const;
 
-    /// Refine cell uniformly
-    void refine_cell(Cell& cell, MeshEditor& editor,
-                     std::size_t& current_cell) const;
-
     /// Compute (generalized) volume (area) of triangle
     double volume(const MeshEntity& triangle) const;
 
-    /// Compute diameter of triangle
-    double diameter(const MeshEntity& triangle) const;
+    /// Compute circumradius of PointCell
+    double circumradius(const MeshEntity& point) const;
 
     /// Compute squared distance to given point
     double squared_distance(const Cell& cell, const Point& point) const;
@@ -104,8 +100,8 @@ namespace dolfin
     std::string description(bool plural) const;
 
     /// Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering
-    std::vector<unsigned int> vtk_mapping() const
-    { return std::vector<unsigned int> {0}; }
+    std::vector<std::int8_t> vtk_mapping() const
+    { return {0}; }
 
   private:
 
diff --git a/dolfin/mesh/QuadrilateralCell.cpp b/dolfin/mesh/QuadrilateralCell.cpp
index 3394df2..b88c4df 100644
--- a/dolfin/mesh/QuadrilateralCell.cpp
+++ b/dolfin/mesh/QuadrilateralCell.cpp
@@ -98,12 +98,6 @@ void QuadrilateralCell::create_entities(boost::multi_array<unsigned int, 2>& e,
   e[3][0] = v[2]; e[3][1] = v[3];
 }
 //-----------------------------------------------------------------------------
-void QuadrilateralCell::refine_cell(Cell& cell, MeshEditor& editor,
-                                    std::size_t& current_cell) const
-{
-  dolfin_not_implemented();
-}
-//-----------------------------------------------------------------------------
 double QuadrilateralCell::volume(const MeshEntity& cell) const
 {
   if (cell.dim() != 2)
@@ -138,19 +132,19 @@ double QuadrilateralCell::volume(const MeshEntity& cell) const
   return 0.0;
 }
 //-----------------------------------------------------------------------------
-double QuadrilateralCell::diameter(const MeshEntity& cell) const
+double QuadrilateralCell::circumradius(const MeshEntity& cell) const
 {
   // Check that we get a cell
   if (cell.dim() != 2)
   {
     dolfin_error("QuadrilateralCell.cpp",
-                 "compute diameter of quadrilateral cell",
+                 "compute circumradius of quadrilateral cell",
                  "Illegal mesh entity");
   }
 
   dolfin_error("QuadrilateralCell.cpp",
-               "compute diameter of quadrilateral cell",
-               "Don't know how to compute diameter");
+               "compute cirumradius of quadrilateral cell",
+               "Don't know how to compute circumradius");
 
   dolfin_not_implemented();
   return 0.0;
diff --git a/dolfin/mesh/QuadrilateralCell.h b/dolfin/mesh/QuadrilateralCell.h
index d267f4e..db43a2e 100644
--- a/dolfin/mesh/QuadrilateralCell.h
+++ b/dolfin/mesh/QuadrilateralCell.h
@@ -51,15 +51,11 @@ namespace dolfin
                          std::size_t dim,
                          const unsigned int* v) const;
 
-    /// Refine cell uniformly
-    void refine_cell(Cell& cell, MeshEditor& editor,
-                     std::size_t& current_cell) const;
-
     /// Compute (generalized) volume (area) of triangle
     double volume(const MeshEntity& triangle) const;
 
-    /// Compute diameter of triangle
-    double diameter(const MeshEntity& triangle) const;
+    /// Compute circumradius of triangle
+    double circumradius(const MeshEntity& triangle) const;
 
     /// Compute squared distance to given point (3D enabled)
     double squared_distance(const Cell& cell, const Point& point) const;
@@ -94,8 +90,8 @@ namespace dolfin
     std::string description(bool plural) const;
 
     /// Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering
-    std::vector<unsigned int> vtk_mapping() const
-    { return std::vector<unsigned int> {0, 1, 3, 2}; }
+    std::vector<std::int8_t> vtk_mapping() const
+    { return {0, 1, 3, 2}; }
 
   };
 
diff --git a/dolfin/mesh/Restriction.cpp b/dolfin/mesh/Restriction.cpp
deleted file mode 100644
index a30956d..0000000
--- a/dolfin/mesh/Restriction.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (C) 2012 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-11-14
-// Last changed: 2012-11-19
-
-#include <dolfin/common/NoDeleter.h>
-#include "SubDomain.h"
-#include "Restriction.h"
-
-using namespace dolfin;
-
-//-----------------------------------------------------------------------------
-Restriction::Restriction(const Mesh& mesh,
-                         const SubDomain& sub_domain)
-{
-  init_from_subdomain(mesh, sub_domain, mesh.topology().dim());
-}
-//-----------------------------------------------------------------------------
-Restriction::Restriction(const Mesh& mesh,
-                         const SubDomain& sub_domain, std::size_t dim)
-{
-  init_from_subdomain(mesh, sub_domain, dim);
-}
-//-----------------------------------------------------------------------------
-Restriction::Restriction(const MeshFunction<std::size_t>& domain_markers,
-                         std::size_t domain_number)
-  : _domain_markers(reference_to_no_delete_pointer(domain_markers)),
-    _domain_number(domain_number)
-{
-  // Do nothing
-}
-//-----------------------------------------------------------------------------
-Restriction::Restriction(std::shared_ptr<const MeshFunction<std::size_t>> domain_markers,
-                         std::size_t domain_number)
-  : _domain_markers(domain_markers),
-    _domain_number(domain_number)
-{
-  // Do nothing
-}
-//-----------------------------------------------------------------------------
-const Mesh& Restriction::mesh() const
-{
-  dolfin_assert(_domain_markers);
-  return *_domain_markers->mesh();
-}
-//-----------------------------------------------------------------------------
-std::size_t Restriction::dim() const
-{
-  dolfin_assert(_domain_markers);
-  return _domain_markers->dim();
-}
-//-----------------------------------------------------------------------------
-void Restriction::init_from_subdomain(const Mesh& mesh,
-                                      const SubDomain& sub_domain, std::size_t dim)
-{
-  // Create mesh function
-  MeshFunction<std::size_t>* __domain_markers = new MeshFunction<std::size_t>(mesh, dim);
-  dolfin_assert(__domain_markers);
-
-  // Set all markers to 1 and mark current domain as 0
-  __domain_markers->set_all(1);
-  sub_domain.mark(*__domain_markers, 0);
-  _domain_number = 0;
-
-  // Store shared pointer
-  _domain_markers
-    = std::shared_ptr<const MeshFunction<std::size_t>>(__domain_markers);
-}
-//-----------------------------------------------------------------------------
diff --git a/dolfin/mesh/Restriction.h b/dolfin/mesh/Restriction.h
deleted file mode 100644
index 46cf664..0000000
--- a/dolfin/mesh/Restriction.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright (C) 2012 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-11-14
-// Last changed: 2012-11-19
-
-#ifndef __RESTRICTION_H
-#define __RESTRICTION_H
-
-#include <memory>
-#include "MeshFunction.h"
-
-namespace dolfin
-{
-
-  // Forward declarations
-  class SubDomain;
-
-  /// This class represents a restriction of a mesh to a subdomain,
-  /// which can be defined as a subset of all the cells, the facets,
-  /// or possibly lower dimensional entities of the mesh.
-
-  class Restriction
-  {
-  public:
-
-    /// Create cell-based restriction from subdomain
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh
-    ///     sub_domain (_SubDomain_)
-    ///         Sub domain defining the restriction
-    Restriction(const Mesh& mesh, const SubDomain& sub_domain);
-
-    /// Create restriction from subdomain to entities of arbitrary dimension
-    ///
-    /// *Arguments*
-    ///     mesh (_Mesh_)
-    ///         The mesh
-    ///     sub_domain (_SubDomain_)
-    ///         Sub domain defining the restriction
-    ///     dim (std::size_t)
-    ///         Dimension of restriction
-    Restriction(const Mesh& mesh, const SubDomain& sub_domain, std::size_t dim);
-
-    /// Create restriction from domain markers
-    ///
-    /// *Arguments*
-    ///     domain_markers (_MeshFunction_ <std::size_t>)
-    ///         Domain markers for the cells of the mesh.
-    ///     domain_number (std::size_t)
-    ///         Identifier for domain.
-    Restriction(const MeshFunction<std::size_t>& domain_markers,
-                std::size_t domain_number);
-
-    /// Create restriction from domain markers (shared pointer version)
-    ///
-    /// *Arguments*
-    ///     domain_markers (_MeshFunction_ <std::size_t>)
-    ///         Domain markers for the cells of the mesh.
-    ///     domain_number (std::size_t)
-    ///         Identifier for domain.
-    Restriction(std::shared_ptr<const MeshFunction<std::size_t> > domain_markers,
-                std::size_t domain_number);
-
-    /// Return the full unrestricted mesh
-    const Mesh& mesh() const;
-
-    /// Return topological dimension of restriction
-    std::size_t dim() const;
-
-    /// Check whether restriction contains entity
-    bool contains(const MeshEntity& entity) const
-    {
-      dolfin_assert(_domain_markers);
-      return (*_domain_markers)[entity] == _domain_number;
-    }
-
-    /// Check whether restriction contains entity (d, i)
-    bool contains(std::size_t d, std::size_t i) const
-    {
-      dolfin_assert(_domain_markers);
-      dolfin_assert(d == _domain_markers->dim());
-      return (*_domain_markers)[i] == _domain_number;
-    }
-
-  private:
-
-    // Initialize domain markers from subdomain
-    void init_from_subdomain(const Mesh& mesh,
-                             const SubDomain& sub_domain, std::size_t dim);
-
-    // Domain markers
-    std::shared_ptr<const MeshFunction<std::size_t> > _domain_markers;
-
-    // Identifier for domain
-    std::size_t _domain_number;
-
-  };
-
-}
-
-#endif
diff --git a/dolfin/mesh/SubDomain.cpp b/dolfin/mesh/SubDomain.cpp
index 4b21829..217d41b 100644
--- a/dolfin/mesh/SubDomain.cpp
+++ b/dolfin/mesh/SubDomain.cpp
@@ -82,7 +82,7 @@ void SubDomain::mark(Mesh& mesh,
                      bool check_midpoint) const
 {
   //dolfin_assert(mesh.domains().markers(dim));
-  //error("Not yet updated (SubDomain::mark) ");
+  //dolfin_error("Not yet updated (SubDomain::mark) ");
   apply_markers(mesh.domains().markers(dim), dim, sub_domain, mesh,
                 check_midpoint);
 }
diff --git a/dolfin/mesh/SubMesh.cpp b/dolfin/mesh/SubMesh.cpp
index 0edd1cd..9131aa2 100644
--- a/dolfin/mesh/SubMesh.cpp
+++ b/dolfin/mesh/SubMesh.cpp
@@ -22,6 +22,7 @@
 #include <map>
 #include <vector>
 
+#include <dolfin/log/log.h>
 #include "Cell.h"
 #include "Mesh.h"
 #include "MeshEditor.h"
@@ -38,7 +39,8 @@ using namespace dolfin;
 SubMesh::SubMesh(const Mesh& mesh, const SubDomain& sub_domain)
 {
   // Create mesh function and mark sub domain
-  MeshFunction<std::size_t> sub_domains(mesh, mesh.topology().dim());
+  MeshFunction<std::size_t> sub_domains(reference_to_no_delete_pointer(mesh),
+                                        mesh.topology().dim());
   sub_domains = 0;
   sub_domain.mark(sub_domains, 1);
 
@@ -191,7 +193,7 @@ void SubMesh::init(const Mesh& mesh,
   {
     Vertex vertex(mesh, it->first);
     if (MPI::size(mesh.mpi_comm()) > 1)
-      error("SubMesh::init not working in parallel");
+      not_working_in_parallel("SubMesh::init");
 
     // FIXME: Get global vertex index
     editor.add_vertex(it->second, vertex.point());
diff --git a/dolfin/mesh/TetrahedronCell.cpp b/dolfin/mesh/TetrahedronCell.cpp
index 441d719..a1d73af 100644
--- a/dolfin/mesh/TetrahedronCell.cpp
+++ b/dolfin/mesh/TetrahedronCell.cpp
@@ -25,6 +25,7 @@
 // Last changed: 2014-02-13
 
 #include <algorithm>
+#include <cmath>
 #include <boost/multi_array.hpp>
 
 #include <dolfin/log/log.h>
@@ -138,90 +139,6 @@ TetrahedronCell::create_entities(boost::multi_array<unsigned int, 2>& e,
   }
 }
 //-----------------------------------------------------------------------------
-void TetrahedronCell::refine_cell(Cell& cell, MeshEditor& editor,
-                                  std::size_t& current_cell) const
-{
-  // Get vertices and edges
-  const unsigned int* v = cell.entities(0);
-  const unsigned int* e = cell.entities(1);
-  dolfin_assert(v);
-  dolfin_assert(e);
-
-  // Get offset for new vertex indices
-  const std::size_t offset = cell.mesh().num_vertices();
-
-  // Compute indices for the ten new vertices
-  const std::size_t v0 = v[0];
-  const std::size_t v1 = v[1];
-  const std::size_t v2 = v[2];
-  const std::size_t v3 = v[3];
-  const std::size_t e0 = offset + e[find_edge(0, cell)];
-  const std::size_t e1 = offset + e[find_edge(1, cell)];
-  const std::size_t e2 = offset + e[find_edge(2, cell)];
-  const std::size_t e3 = offset + e[find_edge(3, cell)];
-  const std::size_t e4 = offset + e[find_edge(4, cell)];
-  const std::size_t e5 = offset + e[find_edge(5, cell)];
-
-  // Regular refinement creates 8 new cells but we need to be careful
-  // to make the partition in a way that does not make the aspect
-  // ratio worse in each refinement. We do this by cutting the middle
-  // octahedron along the shortest of three possible paths.
-  dolfin_assert(editor._mesh);
-  const Point p0 = editor._mesh->geometry().point(e0);
-  const Point p1 = editor._mesh->geometry().point(e1);
-  const Point p2 = editor._mesh->geometry().point(e2);
-  const Point p3 = editor._mesh->geometry().point(e3);
-  const Point p4 = editor._mesh->geometry().point(e4);
-  const Point p5 = editor._mesh->geometry().point(e5);
-  const double d05 = p0.distance(p5);
-  const double d14 = p1.distance(p4);
-  const double d23 = p2.distance(p3);
-
-  // Data structure to hold cells
-  boost::multi_array<std::size_t, 2> cells(boost::extents[8][4]);
-
-  // First create the 4 congruent tetrahedra at the corners
-  cells[0][0] = v0; cells[0][1] = e3; cells[0][2] = e4; cells[0][3] = e5;
-  cells[1][0] = v1; cells[1][1] = e1; cells[1][2] = e2; cells[1][3] = e5;
-  cells[2][0] = v2; cells[2][1] = e0; cells[2][2] = e2; cells[2][3] = e4;
-  cells[3][0] = v3; cells[3][1] = e0; cells[3][2] = e1; cells[3][3] = e3;
-
-  // Then divide the remaining octahedron into 4 tetrahedra
-  if (d05 <= d14 && d14 <= d23)
-  {
-    cells[4][0] = e0; cells[4][1] = e1; cells[4][2] = e2; cells[4][3] = e5;
-    cells[5][0] = e0; cells[5][1] = e1; cells[5][2] = e3; cells[5][3] = e5;
-    cells[6][0] = e0; cells[6][1] = e2; cells[6][2] = e4; cells[6][3] = e5;
-    cells[7][0] = e0; cells[7][1] = e3; cells[7][2] = e4; cells[7][3] = e5;
-  }
-  else if (d14 <= d23)
-  {
-    cells[4][0] = e0; cells[4][1] = e1; cells[4][2] = e2; cells[4][3] = e4;
-    cells[5][0] = e0; cells[5][1] = e1; cells[5][2] = e3; cells[5][3] = e4;
-    cells[6][0] = e1; cells[6][1] = e2; cells[6][2] = e4; cells[6][3] = e5;
-    cells[7][0] = e1; cells[7][1] = e3; cells[7][2] = e4; cells[7][3] = e5;
-  }
-  else
-  {
-    cells[4][0] = e0; cells[4][1] = e1; cells[4][2] = e2; cells[4][3] = e3;
-    cells[5][0] = e0; cells[5][1] = e2; cells[5][2] = e3; cells[5][3] = e4;
-    cells[6][0] = e1; cells[6][1] = e2; cells[6][2] = e3; cells[6][3] = e5;
-    cells[7][0] = e2; cells[7][1] = e3; cells[7][2] = e4; cells[7][3] = e5;
-  }
-
-  // Add cells
-  for (auto _cell = cells.begin(); _cell != cells.end(); ++_cell)
-    editor.add_cell(current_cell++, *_cell);
-}
-//-----------------------------------------------------------------------------
-void TetrahedronCell::refine_cellIrregular(Cell& cell, MeshEditor& editor,
-					   std::size_t& current_cell,
-                                           std::size_t refinement_rule,
-                                           std::size_t* marked_edges) const
-{
-  dolfin_not_implemented();
-}
-//-----------------------------------------------------------------------------
 double TetrahedronCell::volume(const MeshEntity& tetrahedron) const
 {
   // Check that we get a tetrahedron
@@ -245,10 +162,10 @@ double TetrahedronCell::volume(const MeshEntity& tetrahedron) const
 
   // Get the coordinates of the four vertices
   const unsigned int* vertices = tetrahedron.entities(0);
-  const double* x0 = geometry.x(vertices[0]);
-  const double* x1 = geometry.x(vertices[1]);
-  const double* x2 = geometry.x(vertices[2]);
-  const double* x3 = geometry.x(vertices[3]);
+  const Point x0 = geometry.point(vertices[0]);
+  const Point x1 = geometry.point(vertices[1]);
+  const Point x2 = geometry.point(vertices[2]);
+  const Point x3 = geometry.point(vertices[3]);
 
   // Formula for volume from http://mathworld.wolfram.com
   const double v = (x0[0]*(x1[1]*x2[2] + x3[1]*x1[2] + x2[1]*x3[2]
@@ -263,7 +180,7 @@ double TetrahedronCell::volume(const MeshEntity& tetrahedron) const
   return std::abs(v)/6.0;
 }
 //-----------------------------------------------------------------------------
-double TetrahedronCell::diameter(const MeshEntity& tetrahedron) const
+double TetrahedronCell::circumradius(const MeshEntity& tetrahedron) const
 {
   // Check that we get a tetrahedron
   if (tetrahedron.dim() != 3)
@@ -306,9 +223,9 @@ double TetrahedronCell::diameter(const MeshEntity& tetrahedron) const
   const double s    = 0.5*(la+lb+lc);
   const double area = sqrt(s*(s-la)*(s-lb)*(s-lc));
 
-  // Formula for diameter (2*circumradius) from
-  // http://mathworld.wolfram.com
-  return area/(3.0*volume(tetrahedron));
+  // Formula for circumradius from
+  // http://mathworld.wolfram.com/Tetrahedron.html
+  return area/(6.0*volume(tetrahedron));
 }
 //-----------------------------------------------------------------------------
 double TetrahedronCell::squared_distance(const Cell& cell,
@@ -380,16 +297,10 @@ Point TetrahedronCell::normal(const Cell& cell, std::size_t facet) const
   const MeshGeometry& geometry = cell.mesh().geometry();
 
   // Get the coordinates of the four vertices
-  const double* p0 = geometry.x(v0);
-  const double* p1 = geometry.x(v1);
-  const double* p2 = geometry.x(v2);
-  const double* p3 = geometry.x(v3);
-
-  // Create points from vertex coordinates
-  Point P0(p0[0], p0[1], p0[2]);
-  Point P1(p1[0], p1[1], p1[2]);
-  Point P2(p2[0], p2[1], p2[2]);
-  Point P3(p3[0], p3[1], p3[2]);
+  const Point P0 = geometry.point(v0);
+  const Point P1 = geometry.point(v1);
+  const Point P2 = geometry.point(v2);
+  const Point P3 = geometry.point(v3);
 
   // Create vectors
   Point V0 = P0 - P1;
@@ -431,9 +342,9 @@ double TetrahedronCell::facet_area(const Cell& cell, std::size_t facet) const
 
   // Get the coordinates of the three vertices
   const unsigned int* vertices = f.entities(0);
-  const double* x0 = geometry.x(vertices[0]);
-  const double* x1 = geometry.x(vertices[1]);
-  const double* x2 = geometry.x(vertices[2]);
+  const Point x0 = geometry.point(vertices[0]);
+  const Point x1 = geometry.point(vertices[1]);
+  const Point x2 = geometry.point(vertices[2]);
 
   // Compute area of triangle embedded in R^3
   double v0 = (x0[1]*x1[2] + x0[2]*x2[1] + x1[1]*x2[2])
diff --git a/dolfin/mesh/TetrahedronCell.h b/dolfin/mesh/TetrahedronCell.h
index e78533f..dc30f34 100644
--- a/dolfin/mesh/TetrahedronCell.h
+++ b/dolfin/mesh/TetrahedronCell.h
@@ -60,21 +60,11 @@ namespace dolfin
     void create_entities(boost::multi_array<unsigned int, 2>& e,
                          std::size_t dim, const unsigned int* v) const;
 
-    /// Regular refinement of cell
-    void refine_cell(Cell& cell, MeshEditor& editor,
-                     std::size_t& current_cell) const;
-
-    /// Irregular refinement of cell
-    void refine_cellIrregular(Cell& cell, MeshEditor& editor,
-                              std::size_t& current_cell,
-                              std::size_t refinement_rule,
-                              std::size_t* marked_edges) const;
-
     /// Compute volume of tetrahedron
     double volume(const MeshEntity& tetrahedron) const;
 
-    /// Compute diameter of tetrahedron
-    double diameter(const MeshEntity& tetrahedron) const;
+    /// Compute circumradius of tetrahedron
+    double circumradius(const MeshEntity& tetrahedron) const;
 
     /// Compute squared distance to given point
     double squared_distance(const Cell& cell, const Point& point) const;
@@ -110,8 +100,8 @@ namespace dolfin
     std::string description(bool plural) const;
 
     /// Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering
-    std::vector<unsigned int> vtk_mapping() const
-    { return std::vector<unsigned int> {0, 1, 2, 3}; }
+    std::vector<std::int8_t> vtk_mapping() const
+    { return {0, 1, 2, 3}; }
 
   private:
 
diff --git a/dolfin/mesh/TopologyComputation.cpp b/dolfin/mesh/TopologyComputation.cpp
index 55832d4..fd890c5 100644
--- a/dolfin/mesh/TopologyComputation.cpp
+++ b/dolfin/mesh/TopologyComputation.cpp
@@ -21,6 +21,9 @@
 // Last changed: 2014-07-02
 
 #include <algorithm>
+#include <cstdint>
+#include <string>
+#include <utility>
 #include <vector>
 #include <boost/multi_array.hpp>
 #include <boost/unordered_map.hpp>
@@ -42,6 +45,48 @@ using namespace dolfin;
 //-----------------------------------------------------------------------------
 std::size_t TopologyComputation::compute_entities(Mesh& mesh, std::size_t dim)
 {
+  log(TRACE, "Computing mesh entities of dimension %d", dim);
+
+  // Check if entities have already been computed
+  const MeshTopology& topology = mesh.topology();
+  const MeshConnectivity& ce = topology(topology.dim(), dim);
+  const MeshConnectivity& ev = topology(dim, 0);
+  if (topology.size(dim) > 0)
+  {
+    // Make sure we really have the connectivity
+    if ((ce.empty() && dim != topology.dim()) || (ev.empty() && dim != 0))
+    {
+      dolfin_error("TopologyComputation.cpp",
+                   "compute topological entities",
+                   "Entities of topological dimension %d exist but connectivity is missing", dim);
+    }
+    return topology.size(dim);
+  }
+
+  // Call specialised function to compute entities
+  const CellType& cell_type = mesh.type();
+  const std::int8_t num_entity_vertices = cell_type.num_vertices(dim);
+  switch (num_entity_vertices)
+  {
+    case  1:
+      return TopologyComputation::compute_entities_by_key_matching<1>(mesh, dim);
+    case  2:
+      return TopologyComputation::compute_entities_by_key_matching<2>(mesh, dim);
+    case  3:
+      return TopologyComputation::compute_entities_by_key_matching<3>(mesh, dim);
+    case  4:
+      return TopologyComputation::compute_entities_by_key_matching<4>(mesh, dim);
+    default:
+      dolfin_error("TopologyComputation.cpp",
+                   "compute topological entities",
+                   "Entities with %d vertices not supported",
+                   num_entity_vertices);
+       return 0;
+   }
+}
+//-----------------------------------------------------------------------------
+std::size_t TopologyComputation::compute_entities_old(Mesh& mesh, std::size_t dim)
+{
   // Get mesh topology and connectivity
   MeshTopology& topology = mesh.topology();
   MeshConnectivity& ce = topology(topology.dim(), dim);
@@ -68,8 +113,13 @@ std::size_t TopologyComputation::compute_entities(Mesh& mesh, std::size_t dim)
                  "Connectivity for topological dimension %d exists but entities are missing", dim);
   }
 
+  // Optimisation for common case where facets lie between two cells
+  bool erase_visited_facets = false;
+  if (mesh.geometry().dim() == topology.dim() and dim == topology.dim() - 1)
+    erase_visited_facets = true;
+
   // Start timer
-  Timer timer("compute entities dim = " + to_string(dim));
+  Timer timer("Compute entities dim = " + std::to_string(dim));
 
   // Get cell type
   const CellType& cell_type = mesh.type();
@@ -80,13 +130,12 @@ std::size_t TopologyComputation::compute_entities(Mesh& mesh, std::size_t dim)
   boost::multi_array<unsigned int, 2> e_vertices(boost::extents[m][n]);
 
   // List of entity e indices connected to cell
-  std::vector<std::vector<unsigned int>> connectivity_ce(mesh.num_cells());
+  std::vector<std::size_t> connectivity_ce;
+  connectivity_ce.reserve(mesh.num_cells()*m);
 
   // List of vertex indices connected to entity e
-  std::vector<boost::multi_array<unsigned int , 1>> connectivity_ev;
+  std::vector<boost::multi_array<unsigned int, 1>> connectivity_ev;
 
-  std::size_t current_entity = 0;
-  std::size_t max_ce_connections = 1;
   boost::unordered_map<std::vector<unsigned int>, unsigned int>
     evertices_to_index;
 
@@ -100,31 +149,28 @@ std::size_t TopologyComputation::compute_entities(Mesh& mesh, std::size_t dim)
   evertices_to_index.reserve(max_elements);
   #endif
 
-  const std::size_t tdim = mesh.topology().dim();
+  unsigned int current_entity = 0;
   unsigned int num_regular_entities = 0;
 
+  // Reserve space for vector of vertex indices for each entity
+  std::vector<unsigned int> evec(n);
+
   // Loop over cells
-  for (MeshEntityIterator c(mesh, tdim, "all"); !c.end(); ++c)
+  for (CellIterator c(mesh, "all"); !c.end(); ++c)
   {
-    // Cell index
-    const std::size_t cell_index = c->index();
-
-    // Reserve space to reduce dynamic allocations
-    connectivity_ce[cell_index].reserve(max_ce_connections);
-
     // Get vertices from cell
     const unsigned int* vertices = c->entities(0);
     dolfin_assert(vertices);
 
-    // Create entities
+    // Create entities from vertices
     cell_type.create_entities(e_vertices, dim, vertices);
 
     // Iterate over the given list of entities
-    for (auto entity = e_vertices.begin(); entity != e_vertices.end(); ++entity)
+    for (auto const &entity : e_vertices)
     {
       // Sort entities (to use as map key)
-      std::vector<unsigned int> evec(entity->begin(), entity->end());
-      std::sort(evec.begin(), evec.end());
+      std::partial_sort_copy(entity.begin(), entity.end(),
+                             evec.begin(), evec.end());
 
       // Insert into map
       auto it = evertices_to_index.insert({evec, current_entity});
@@ -133,23 +179,24 @@ std::size_t TopologyComputation::compute_entities(Mesh& mesh, std::size_t dim)
       std::size_t e_index = it.first->second;
 
       // Add entity index to cell - e connectivity
-      connectivity_ce[cell_index].push_back(e_index);
+      connectivity_ce.push_back(e_index);
 
       // If new key was inserted, increment entity counter
       if (it.second)
       {
         // Add list of new entity vertices
-        connectivity_ev.push_back(*entity);
-
-        // Update max vector size (used to reserve space for performance);
-        max_ce_connections = std::max(max_ce_connections,
-                                      connectivity_ce[cell_index].size());
+        connectivity_ev.push_back(entity);
 
         // Increase counter
         ++current_entity;
         if (!c->is_ghost())
           num_regular_entities = current_entity;
       }
+      else
+      {
+        if (erase_visited_facets) // reduce map size for efficiency
+          evertices_to_index.erase(it.first);
+      }
     }
   }
 
@@ -160,7 +207,14 @@ std::size_t TopologyComputation::compute_entities(Mesh& mesh, std::size_t dim)
   topology.init_ghost(dim, num_regular_entities);
 
   // Copy connectivity data into static MeshTopology data structures
-  ce.set(connectivity_ce);
+  std::size_t* connectivity_ce_ptr = connectivity_ce.data();
+  ce.init(mesh.num_cells(), m);
+  for (unsigned int i = 0; i != mesh.num_cells(); ++i)
+  {
+    ce.set(i, connectivity_ce_ptr);
+    connectivity_ce_ptr += m;
+  }
+
   ev.set(connectivity_ev);
 
   return current_entity;
@@ -178,7 +232,7 @@ void TopologyComputation::compute_connectivity(Mesh& mesh,
   //   1. compute_entities():     d  - 0  from dim - 0
   //   2. compute_transpose():    d0 - d1 from d1 - d0
   //   3. compute_intersection(): d0 - d1 from d0 - d' - d1
-  //
+  //   4. compute_from_map():     d0 - d1 from d1 - 0 and d0 - 0
   // Each of these functions assume a set of preconditions that we
   // need to satisfy.
 
@@ -207,7 +261,8 @@ void TopologyComputation::compute_connectivity(Mesh& mesh,
     return;
 
   // Start timer
-  Timer timer("compute connectivity " + to_string(d0) + " - " + to_string(d1));
+  Timer timer("Compute connectivity " + std::to_string(d0) + "-"
+              + std::to_string(d1));
 
   // Decide how to compute the connectivity
   if (d0 == d1)
@@ -226,21 +281,227 @@ void TopologyComputation::compute_connectivity(Mesh& mesh,
   }
   else
   {
-    // These connections should already exist
-    dolfin_assert(!(d0 > 0 && d1 == 0));
-
-    // Choose how to take intersection
-    dolfin_assert(d0 != 0);
-    dolfin_assert(d1 != 0);
-    std::size_t d = 0;
-
-    // Compute connectivity d0 - d - d1 and take intersection
-    compute_connectivity(mesh, d0, d);
-    compute_connectivity(mesh, d, d1);
-    compute_from_intersection(mesh, d0, d1, d);
+    // Compute by mapping vertices from a lower dimension entity
+    // to those of a higher dimension entity
+    compute_from_map(mesh, d0, d1);
   }
 }
 //--------------------------------------------------------------------------
+template<int N>
+std::int32_t TopologyComputation::compute_entities_by_key_matching(Mesh& mesh,
+                                                                   int dim)
+{
+  // Get mesh topology and connectivity
+  MeshTopology& topology = mesh.topology();
+  MeshConnectivity& ce = topology(topology.dim(), dim);
+  MeshConnectivity& ev = topology(dim, 0);
+
+  // Check if entities have already been computed
+  if (topology.size(dim) > 0)
+  {
+    // Make sure we really have the connectivity
+    if ((ce.empty() && dim != (int) topology.dim()) || (ev.empty() && dim != 0))
+    {
+      dolfin_error("TopologyComputation.cpp",
+                   "compute topological entities",
+                   "Entities of topological dimension %d exist but connectivity is missing", dim);
+    }
+    return topology.size(dim);
+  }
+
+  // Make sure connectivity does not already exist
+  if (!ce.empty() || !ev.empty())
+  {
+    dolfin_error("TopologyComputation.cpp",
+                 "compute topological entities",
+                 "Connectivity for topological dimension %d exists but entities are missing", dim);
+  }
+
+  // Start timer
+  Timer timer("Compute entities dim = " + std::to_string(dim));
+
+  // Get cell type
+  const CellType& cell_type = mesh.type();
+
+  // Initialize local array of entities
+  const std::int8_t num_entities = cell_type.num_entities(dim);
+  const int num_vertices = cell_type.num_vertices(dim);
+
+  // Create map from cell vertices to entity vertices
+  boost::multi_array<unsigned int, 2>
+    e_vertices(boost::extents[num_entities][num_vertices]);
+  const int num_vertices_per_cell = cell_type.num_vertices();
+  std::vector<unsigned int> v(num_vertices_per_cell);
+  std::iota(v.begin(), v.end(), 0);
+  cell_type.create_entities(e_vertices, dim, v.data());
+
+  dolfin_assert(N == num_vertices);
+
+  // Create data structure to hold entities
+  // ([vertices key], (cell_local_index, cell index))
+  std::vector<std::pair<std::array<std::int32_t, N>,
+    std::pair<std::int8_t, std::int32_t>>>
+      keyed_entities(num_entities*mesh.num_cells());
+
+  // Loop over cells to build list of keyed entities
+  int entity_counter = 0;
+  for (CellIterator c(mesh, "all"); !c.end(); ++c)
+  {
+    // Get vertices from cell
+    const unsigned int* vertices = c->entities(0);
+    dolfin_assert(vertices);
+
+
+    // Iterate over entities of cell
+    const int cell_index = c->index();
+    for (std::int8_t i = 0; i < num_entities; ++i)
+    {
+      auto& entity_key = keyed_entities[entity_counter].first;
+      for (std::int8_t j = 0; j < num_vertices; ++j)
+        entity_key[j] = vertices[e_vertices[i][j]];
+
+      // Sort entity vertices
+      std::sort(entity_key.begin(), entity_key.end());
+
+      // Attach (local index, cell index), making local_index negative if it is
+      // not a ghost cell. This ensures that non-ghosts come before ghosts when
+      // sorted. The index is corrected later.
+      if (!c->is_ghost())
+        keyed_entities[entity_counter].second = {-i - 1, cell_index};
+      else
+        keyed_entities[entity_counter].second = {i, cell_index};
+
+      // Increment entity counter
+      ++entity_counter;
+    }
+  }
+
+  // Sort entities by key
+  std::sort(keyed_entities.begin(), keyed_entities.end());
+
+  // List of vertex indices connected to entity e
+  std::vector<std::array<int, N>> connectivity_ev;
+  std::vector<std::array<int, N>> connectivity_ev_ghost;
+
+  // List of entity e indices connected to cell
+  boost::multi_array<int, 2>
+    connectivity_ce(boost::extents[mesh.num_cells()][num_entities]);
+
+  // Marker for whether or not the most recently created entity is a ghost
+  // entity
+  bool ghost_entity = false;
+
+  // Find duplicate keys
+  if (keyed_entities.size() > 1)
+  {
+    const auto& e = keyed_entities[0].first;
+    const auto& cell = keyed_entities[0].second;
+
+    const std::int32_t cell_index = cell.second;
+    const std::int8_t local_index = cell.first;
+
+    if (local_index < 0)
+    {
+      // 'Create' new entity and mark that most recently created entity is not a
+      // ghost
+
+      std::int8_t index = -local_index - 1;
+      dolfin_assert(index >= 0);
+      dolfin_assert(index < (int) connectivity_ce[cell_index].size());
+      connectivity_ce[cell_index][index] = connectivity_ev.size();
+
+      connectivity_ev.push_back(e);
+      ghost_entity = false;
+    }
+    else
+    {
+      // 'Create' new entity and mark that most recently created entity is a
+      // ghost
+      dolfin_assert(local_index < (int) connectivity_ce[cell_index].size());
+      connectivity_ce[cell_index][local_index] = -connectivity_ev_ghost.size()  -1;
+      connectivity_ev_ghost.push_back(e);
+      ghost_entity = true;
+    }
+  }
+
+  for (std::size_t i = 1; i < keyed_entities.size(); ++i)
+  {
+    const auto& e1 = keyed_entities[i].first;
+    const auto& cell1 = keyed_entities[i].second;
+
+    const std::int32_t cell_index = cell1.second;
+    const std::int8_t local_index = cell1.first;
+
+    // Compare entity with the preceding entity
+    const auto& e0 = keyed_entities[i - 1].first;
+    if (!std::equal(e1.begin(), e1.end(), e0.begin()))
+    {
+      if (local_index < 0)
+      {
+        // 'Create' new entity and flag that the most recent entity is not a
+        // ghost
+        connectivity_ev.push_back(e1);
+        ghost_entity = false;
+      }
+      else
+      {
+        // 'Create' new entity and flag that the most recent entity is a ghost
+        connectivity_ev_ghost.push_back(e1);
+        ghost_entity = true;
+      }
+    }
+
+    // Set entity index. Use negative index for ghost that will be corrected
+    // later once the number of entities is known
+    const std::int8_t _local_index = (local_index < 0) ? (-local_index - 1) : local_index;
+    dolfin_assert(_local_index >= 0);
+    if (!ghost_entity)
+    {
+      // Not a ghost entity
+      dolfin_assert(_local_index < (int) connectivity_ce[cell_index].size());
+      connectivity_ce[cell_index][_local_index] = connectivity_ev.size() - 1;
+    }
+    else
+    {
+      // Is a ghost entity, so use negative index
+      dolfin_assert(connectivity_ev_ghost.size() > 0);
+      connectivity_ce[cell_index][_local_index] = -connectivity_ev_ghost.size();
+    }
+  }
+
+  // Initialise connectivity data structure
+  topology.init(dim, connectivity_ev.size() + connectivity_ev_ghost.size(),
+                     connectivity_ev.size() + connectivity_ev_ghost.size());
+
+  // Initialise ghost entity offset
+  topology.init_ghost(dim, connectivity_ev.size());
+
+  // Copy connectivity data into static MeshTopology data structures
+  dolfin_assert(connectivity_ce.size() == mesh.num_cells());
+  if (!connectivity_ev_ghost.empty())
+  {
+    // Re-map any ghost enties with the correct index
+    for (unsigned int i = 0; i < mesh.num_cells(); ++i)
+    {
+      for (auto& x : connectivity_ce[i])
+      {
+        if (x < 0)
+          x = (connectivity_ev.size() - x) - 1;
+      }
+    }
+  }
+
+  // Set cell-entity connectivity
+  ce.set(connectivity_ce);
+
+  // Add ghost entity-to-vertices connections to list of rectangular entities
+  connectivity_ev.insert(connectivity_ev.end(), connectivity_ev_ghost.begin(),
+                         connectivity_ev_ghost.end());
+  ev.set(connectivity_ev);
+
+  return connectivity_ev.size();
+}
+//-----------------------------------------------------------------------------
 void TopologyComputation::compute_from_transpose(Mesh& mesh, std::size_t d0,
                                                  std::size_t d1)
 {
@@ -283,6 +544,53 @@ void TopologyComputation::compute_from_transpose(Mesh& mesh, std::size_t d0,
       connectivity.set(e0->index(), e1->index(), tmp[e0->index()]++);
 }
 //----------------------------------------------------------------------------
+void TopologyComputation::compute_from_map(Mesh& mesh,
+                                           std::size_t d0,
+                                           std::size_t d1)
+{
+  dolfin_assert(d1 > 0);
+  dolfin_assert(d0 > d1);
+
+  // Get the type of entity d0
+  std::unique_ptr<CellType> cell_type(CellType::create(mesh.type()
+                                                       .entity_type(d0)));
+
+  MeshConnectivity& connectivity = mesh.topology()(d0, d1);
+  connectivity.init(mesh.size(d0), cell_type->num_entities(d1));
+
+  // Make a map from the sorted d1 entity vertices to the d1 entity index
+  boost::unordered_map<std::vector<unsigned int>, unsigned int>
+    entity_to_index;
+  entity_to_index.reserve(mesh.size(d1));
+
+  const std::size_t num_verts_d1 = mesh.type().num_vertices(d1);
+  std::vector<unsigned int> key(num_verts_d1);
+  for (MeshEntityIterator e(mesh, d1, "all"); !e.end(); ++e)
+  {
+    std::partial_sort_copy(e->entities(0), e->entities(0) + num_verts_d1,
+                           key.begin(), key.end());
+    entity_to_index.insert({key, e->index()});
+  }
+
+  // Search for d1 entities of d0 in map, and recover index
+  std::vector<std::size_t> entities;
+  boost::multi_array<unsigned int, 2> keys;
+  for (MeshEntityIterator e(mesh, d0, "all"); !e.end(); ++e)
+  {
+    entities.clear();
+    cell_type->create_entities(keys, d1, e->entities(0));
+    for (const auto &p : keys)
+    {
+      std::partial_sort_copy(p.begin(), p.end(), key.begin(), key.end());
+      const auto it = entity_to_index.find(key);
+      dolfin_assert(it != entity_to_index.end());
+      entities.push_back(it->second);
+    }
+    connectivity.set(e->index(), entities.data());
+  }
+
+}
+//-----------------------------------------------------------------------------
 void TopologyComputation::compute_from_intersection(Mesh& mesh,
                                                     std::size_t d0,
                                                     std::size_t d1,
diff --git a/dolfin/mesh/TopologyComputation.h b/dolfin/mesh/TopologyComputation.h
index c80b4fd..63c1226 100644
--- a/dolfin/mesh/TopologyComputation.h
+++ b/dolfin/mesh/TopologyComputation.h
@@ -37,19 +37,48 @@ namespace dolfin
   {
   public:
 
-    /// Compute mesh entities of given topological dimension
+    /// Compute mesh entities of given topological dimension, and connectivity
+    /// cell-to-enity (tdim, dim)
     static std::size_t compute_entities(Mesh& mesh, std::size_t dim);
 
+    /// Compute mesh entities of given topological dimension.
+    /// Note: this function will be replaced by the new 'compute_entities'
+    /// function, which is considerably faster, especially for poorly ordered
+    /// mesh.
+    static std::size_t compute_entities_old(Mesh& mesh, std::size_t dim);
+
     /// Compute connectivity for given pair of topological dimensions
     static void compute_connectivity(Mesh& mesh, std::size_t d0,
                                      std::size_t d1);
 
   private:
 
+    // cell-to-enity (tdim, dim). Ths functions builds a list of all entities of
+    // Compute mesh entities of given topological dimension, and connectivity
+    // dimension dim for every cell, keyed by the sorted lists of vertex indices
+    // that make up the entity. Also attached is whether or nor the entity is a
+    // ghost, the local entity index (relative to the generating cell) and the
+    // generating cell index. This list is then sorted, with matching keys
+    // corresponding to a single enity. The entities are numbered such that ghost
+    // entities come after al regular enrities.
+    //
+    // Returns the number of entities
+    //
+    //The function is templated over the number of vertices that make up an
+    //entity of dimension dim. This avoid dynamic memoryt allocations, yielding
+    //significant performance improvements
+    template<int N>
+    static std::int32_t compute_entities_by_key_matching(Mesh& mesh, int dim);
+
     // Compute connectivity from transpose
     static void compute_from_transpose(Mesh& mesh, std::size_t d0,
                                        std::size_t d1);
 
+    // Direct lookup of entity from vertices in a map
+    static void compute_from_map(Mesh& mesh,
+                                 std::size_t d0,
+                                 std::size_t d1);
+
     // Compute connectivity from intersection
     static void compute_from_intersection(Mesh& mesh, std::size_t d0,
                                           std::size_t d1, std::size_t d);
diff --git a/dolfin/mesh/TriangleCell.cpp b/dolfin/mesh/TriangleCell.cpp
index 241d573..e1871ef 100644
--- a/dolfin/mesh/TriangleCell.cpp
+++ b/dolfin/mesh/TriangleCell.cpp
@@ -26,6 +26,7 @@
 // Last changed: 2014-05-22
 
 #include <algorithm>
+#include <cmath>
 #include <dolfin/log/log.h>
 #include "Cell.h"
 #include "MeshEditor.h"
@@ -106,39 +107,6 @@ void TriangleCell::create_entities(boost::multi_array<unsigned int, 2>&  e,
   e[2][0] = v[0]; e[2][1] = v[1];
 }
 //-----------------------------------------------------------------------------
-void TriangleCell::refine_cell(Cell& cell, MeshEditor& editor,
-                               std::size_t& current_cell) const
-{
-  // Get vertices and edges
-  const unsigned int* v = cell.entities(0);
-  const unsigned int* e = cell.entities(1);
-  dolfin_assert(v);
-  dolfin_assert(e);
-
-  // Get offset for new vertex indices
-  const std::size_t offset = cell.mesh().num_vertices();
-
-  // Compute indices for the six new vertices
-  const std::size_t v0 = v[0];
-  const std::size_t v1 = v[1];
-  const std::size_t v2 = v[2];
-  const std::size_t e0 = offset + e[find_edge(0, cell)];
-  const std::size_t e1 = offset + e[find_edge(1, cell)];
-  const std::size_t e2 = offset + e[find_edge(2, cell)];
-
-  // Create four new cells
-  std::vector<std::vector<std::size_t>> cells(4, std::vector<std::size_t>(3));
-  cells[0][0] = v0; cells[0][1] = e2; cells[0][2] = e1;
-  cells[1][0] = v1; cells[1][1] = e0; cells[1][2] = e2;
-  cells[2][0] = v2; cells[2][1] = e1; cells[2][2] = e0;
-  cells[3][0] = e0; cells[3][1] = e1; cells[3][2] = e2;
-
-  // Add cells
-  std::vector<std::vector<std::size_t>>::const_iterator _cell;
-  for (_cell = cells.begin(); _cell != cells.end(); ++_cell)
-    editor.add_cell(current_cell++, *_cell);
-}
-//-----------------------------------------------------------------------------
 double TriangleCell::volume(const MeshEntity& triangle) const
 {
   // Check that we get a triangle
@@ -154,9 +122,9 @@ double TriangleCell::volume(const MeshEntity& triangle) const
 
   // Get the coordinates of the three vertices
   const unsigned int* vertices = triangle.entities(0);
-  const double* x0 = geometry.x(vertices[0]);
-  const double* x1 = geometry.x(vertices[1]);
-  const double* x2 = geometry.x(vertices[2]);
+  const Point x0 = geometry.point(vertices[0]);
+  const Point x1 = geometry.point(vertices[1]);
+  const Point x2 = geometry.point(vertices[2]);
 
   if (geometry.dim() == 2)
   {
@@ -190,7 +158,7 @@ double TriangleCell::volume(const MeshEntity& triangle) const
   return 0.0;
 }
 //-----------------------------------------------------------------------------
-double TriangleCell::diameter(const MeshEntity& triangle) const
+double TriangleCell::circumradius(const MeshEntity& triangle) const
 {
   // Check that we get a triangle
   if (triangle.dim() != 2)
@@ -223,8 +191,9 @@ double TriangleCell::diameter(const MeshEntity& triangle) const
   const double b  = p0.distance(p2);
   const double c  = p0.distance(p1);
 
-  // Formula for diameter (2*circumradius) from http://mathworld.wolfram.com
-  return 0.5*a*b*c / volume(triangle);
+  // Formula for circumradius from
+  // http://mathworld.wolfram.com/Triangle.html
+  return a*b*c/(4.0*volume(triangle));
 }
 //-----------------------------------------------------------------------------
 double TriangleCell::squared_distance(const Cell& cell,
@@ -409,18 +378,10 @@ double TriangleCell::facet_area(const Cell& cell, std::size_t facet) const
   const MeshGeometry& geometry = cell.mesh().geometry();
 
   // Get the coordinates of the two vertices
-  const double* p0 = geometry.x(v0);
-  const double* p1 = geometry.x(v1);
-
-  // Compute distance between vertices
-  double d = 0.0;
-  for (std::size_t i = 0; i < geometry.dim(); i++)
-  {
-    const double dp = p0[i] - p1[i];
-    d += dp*dp;
-  }
+  const Point p0 = geometry.point(v0);
+  const Point p1 = geometry.point(v1);
 
-  return std::sqrt(d);
+  return p1.distance(p0);
 }
 //-----------------------------------------------------------------------------
 void TriangleCell::order(
diff --git a/dolfin/mesh/TriangleCell.h b/dolfin/mesh/TriangleCell.h
index 0717ba6..0958c9f 100644
--- a/dolfin/mesh/TriangleCell.h
+++ b/dolfin/mesh/TriangleCell.h
@@ -57,15 +57,11 @@ namespace dolfin
                          std::size_t dim,
                          const unsigned int* v) const;
 
-    /// Refine cell uniformly
-    void refine_cell(Cell& cell, MeshEditor& editor,
-                     std::size_t& current_cell) const;
-
     /// Compute (generalized) volume (area) of triangle
     double volume(const MeshEntity& triangle) const;
 
     /// Compute diameter of triangle
-    double diameter(const MeshEntity& triangle) const;
+    double circumradius(const MeshEntity& triangle) const;
 
     /// Compute squared distance to given point (3D enabled)
     double squared_distance(const Cell& cell, const Point& point) const;
@@ -109,8 +105,8 @@ namespace dolfin
     std::string description(bool plural) const;
 
     /// Mapping of DOLFIN/UFC vertex ordering to VTK/XDMF ordering
-    std::vector<unsigned int> vtk_mapping() const
-    { return std::vector<unsigned int> {0, 1, 2}; }
+    std::vector<std::int8_t> vtk_mapping() const
+    { return {0, 1, 2}; }
 
   private:
 
diff --git a/dolfin/mesh/Vertex.h b/dolfin/mesh/Vertex.h
index d4832ca..64d05ce 100644
--- a/dolfin/mesh/Vertex.h
+++ b/dolfin/mesh/Vertex.h
@@ -69,14 +69,9 @@ namespace dolfin
   {
   public:
 
-    VertexFunction(const Mesh& mesh) : MeshFunction<T>(mesh, 0) {}
-
     VertexFunction(std::shared_ptr<const Mesh> mesh)
       : MeshFunction<T>(mesh, 0) {}
 
-    VertexFunction(const Mesh& mesh, const T& value)
-      : MeshFunction<T>(mesh, 0, value) {}
-
     VertexFunction(std::shared_ptr<const Mesh> mesh, const T& value)
       : MeshFunction<T>(mesh, 0, value) {}
 
diff --git a/dolfin/mesh/dolfin_mesh.h b/dolfin/mesh/dolfin_mesh.h
index ff68dd2..ab74b02 100644
--- a/dolfin/mesh/dolfin_mesh.h
+++ b/dolfin/mesh/dolfin_mesh.h
@@ -31,7 +31,6 @@
 #include <dolfin/mesh/LocalMeshData.h>
 #include <dolfin/mesh/SubDomain.h>
 #include <dolfin/mesh/SubMesh.h>
-#include <dolfin/mesh/Restriction.h>
 #include <dolfin/mesh/DomainBoundary.h>
 #include <dolfin/mesh/BoundaryMesh.h>
 #include <dolfin/mesh/PeriodicBoundaryComputation.h>
diff --git a/dolfin/multistage/MultiStageScheme.cpp b/dolfin/multistage/MultiStageScheme.cpp
index eb518dc..dc2be53 100644
--- a/dolfin/multistage/MultiStageScheme.cpp
+++ b/dolfin/multistage/MultiStageScheme.cpp
@@ -38,29 +38,9 @@ MultiStageScheme::MultiStageScheme(
     std::vector<int> jacobian_indices,
     unsigned int order,
     const std::string name,
-    const std::string human_form) :
-  Variable(name, ""), _stage_forms(stage_forms), _last_stage(last_stage),
-  _stage_solutions(stage_solutions), _u(u), _t(t), _dt(dt),
-  _dt_stage_offset(dt_stage_offset), _jacobian_indices(jacobian_indices),
-  _order(order), _implicit(false), _human_form(human_form)
-{
-  _check_arguments();
-}
-//-----------------------------------------------------------------------------
-MultiStageScheme::MultiStageScheme(
-    std::vector<std::vector<std::shared_ptr<const Form>>> stage_forms,
-    std::shared_ptr<const Form> last_stage,
-    std::vector<std::shared_ptr<Function>> stage_solutions,
-    std::shared_ptr<Function> u,
-    std::shared_ptr<Constant> t,
-    std::shared_ptr<Constant> dt,
-    std::vector<double> dt_stage_offset,
-    std::vector<int> jacobian_indices,
-    unsigned int order,
-    const std::string name,
     const std::string human_form,
-    std::vector<const DirichletBC* > bcs) :
-  Variable(name, ""), _stage_forms(stage_forms), _last_stage(last_stage),
+    std::vector<std::shared_ptr<const DirichletBC>> bcs)
+: Variable(name, ""), _stage_forms(stage_forms), _last_stage(last_stage),
   _stage_solutions(stage_solutions), _u(u), _t(t), _dt(dt),
   _dt_stage_offset(dt_stage_offset), _jacobian_indices(jacobian_indices),
   _order(order), _implicit(false), _human_form(human_form), _bcs(bcs)
@@ -114,7 +94,7 @@ unsigned int MultiStageScheme::order() const
   return _order;
 }
 //-----------------------------------------------------------------------------
-std::vector<const DirichletBC* > MultiStageScheme::bcs() const
+std::vector<std::shared_ptr<const DirichletBC>> MultiStageScheme::bcs() const
 {
   return _bcs;
 }
@@ -183,7 +163,7 @@ void MultiStageScheme::_check_arguments()
   */
 
   // Check solution is in the same space as the last stage solution
-  if (!(_stage_solutions.size()==0 || \
+  if (!(_stage_solutions.size()==0 or
         _u->in(*_stage_solutions[_stage_solutions.size()-1]->function_space())))
   {
     dolfin_error("MultiStageScheme.cpp",
@@ -203,7 +183,7 @@ void MultiStageScheme::_check_arguments()
     }
 
     // Check we have correct number of forms
-    if (_stage_forms[i].size()==0 || _stage_forms[i].size()>2)
+    if (_stage_forms[i].size()==0 or _stage_forms[i].size()>2)
     {
       dolfin_error("MultiStageScheme.cpp",
 		   "construct MultiStageScheme",
diff --git a/dolfin/multistage/MultiStageScheme.h b/dolfin/multistage/MultiStageScheme.h
index 32ca20a..9ad37cd 100644
--- a/dolfin/multistage/MultiStageScheme.h
+++ b/dolfin/multistage/MultiStageScheme.h
@@ -21,8 +21,8 @@
 #ifndef __BUTCHERSCHEME_H
 #define __BUTCHERSCHEME_H
 
-#include <vector>
 #include <memory>
+#include <vector>
 
 #include <dolfin/common/Variable.h>
 #include <dolfin/function/Function.h>
@@ -45,35 +45,21 @@ namespace dolfin
   public:
 
     /// Constructor
-    /// FIXME: This constructor is a MESS. Needs clean up...
-    MultiStageScheme(std::vector<std::vector<std::shared_ptr<const Form> > > stage_forms,
-		  std::shared_ptr<const Form> last_stage,
-		  std::vector<std::shared_ptr<Function> > stage_solutions,
-		  std::shared_ptr<Function> u,
-		  std::shared_ptr<Constant> t,
-		  std::shared_ptr<Constant> dt,
-		  std::vector<double> dt_stage_offset,
-		  std::vector<int> jacobian_indices,
-		  unsigned int order,
-		  const std::string name,
-		  const std::string human_form);
-
-    /// Constructor with Boundary conditions
-    MultiStageScheme(std::vector<std::vector<std::shared_ptr<const Form> > > stage_forms,
-		  std::shared_ptr<const Form> last_stage,
-		  std::vector<std::shared_ptr<Function> > stage_solutions,
-		  std::shared_ptr<Function> u,
-		  std::shared_ptr<Constant> t,
-		  std::shared_ptr<Constant> dt,
-		  std::vector<double> dt_stage_offset,
-		  std::vector<int> jacobian_indices,
-		  unsigned int order,
-		  const std::string name,
-		  const std::string human_form,
-		  std::vector<const DirichletBC* > bcs);
+    MultiStageScheme(std::vector<std::vector<std::shared_ptr<const Form>>> stage_forms,
+                     std::shared_ptr<const Form> last_stage,
+                     std::vector<std::shared_ptr<Function> > stage_solutions,
+                     std::shared_ptr<Function> u,
+                     std::shared_ptr<Constant> t,
+                     std::shared_ptr<Constant> dt,
+                     std::vector<double> dt_stage_offset,
+                     std::vector<int> jacobian_indices,
+                     unsigned int order,
+                     const std::string name,
+                     const std::string human_form,
+                     std::vector<std::shared_ptr<const DirichletBC>> bcs = {});
 
     /// Return the stages
-    std::vector<std::vector<std::shared_ptr<const Form> > >& stage_forms();
+    std::vector<std::vector<std::shared_ptr<const Form>>>& stage_forms();
 
     /// Return the last stage
     std::shared_ptr<const Form> last_stage();
@@ -100,7 +86,7 @@ namespace dolfin
     unsigned int order() const;
 
     /// Return boundary conditions
-    std::vector<const DirichletBC* > bcs() const;
+    std::vector<std::shared_ptr<const DirichletBC>> bcs() const;
 
     /// Return true if stage is implicit
     bool implicit(unsigned int stage) const;
@@ -121,13 +107,13 @@ namespace dolfin
     void _check_arguments();
 
     // Vector of forms for the different RK stages
-    std::vector<std::vector<std::shared_ptr<const Form> > > _stage_forms;
+    std::vector<std::vector<std::shared_ptr<const Form>>> _stage_forms;
 
     // A linear combination of solutions for the last stage
     std::shared_ptr<const Form> _last_stage;
 
     // Solutions for the different stages
-    std::vector<std::shared_ptr<Function> > _stage_solutions;
+    std::vector<std::shared_ptr<Function>> _stage_solutions;
 
     // The solution
     std::shared_ptr<Function> _u;
@@ -154,7 +140,7 @@ namespace dolfin
     std::string _human_form;
 
     // The boundary conditions
-    std::vector<const DirichletBC* > _bcs;
+    std::vector<std::shared_ptr<const DirichletBC>> _bcs;
 
   };
 
diff --git a/dolfin/multistage/PointIntegralSolver.cpp b/dolfin/multistage/PointIntegralSolver.cpp
index dfd8db6..7f92ecd 100644
--- a/dolfin/multistage/PointIntegralSolver.cpp
+++ b/dolfin/multistage/PointIntegralSolver.cpp
@@ -48,7 +48,7 @@ PointIntegralSolver::PointIntegralSolver(std::shared_ptr<MultiStageScheme> schem
   _mesh(_scheme->last_stage()->mesh()),
   _dofmap(*_scheme->last_stage()->function_space(0)->dofmap()),
   _system_size(_dofmap.num_entity_dofs(0)),
-  _dof_offset(_mesh.type().num_entities(0)),
+  _dof_offset(_mesh->type().num_entities(0)),
   _num_stages(_scheme->stage_forms().size()),
   _local_to_local_dofs(_system_size),
   _vertex_map(), _local_to_global_dofs(_system_size),
@@ -96,6 +96,8 @@ void PointIntegralSolver::reset_stage_solutions()
 //-----------------------------------------------------------------------------
 void PointIntegralSolver::step(double dt)
 {
+  dolfin_assert(_mesh);
+
   const bool reset_stage_solutions_ = parameters["reset_stage_solutions"];
   const bool reset_newton_solver_
     = parameters("newton_solver")["reset_each_step"];
@@ -124,12 +126,12 @@ void PointIntegralSolver::step(double dt)
 
   // Iterate over vertices
   ufc::cell ufc_cell;
-  std::vector<double> vertex_coordinates;
-  for (std::size_t vert_ind = 0; vert_ind < _mesh.num_vertices(); ++vert_ind)
+  std::vector<double> coordinate_dofs;
+  for (std::size_t vert_ind = 0; vert_ind < _mesh->num_vertices(); ++vert_ind)
   {
     // Cell containing vertex
-    const Cell cell(_mesh, _vertex_map[vert_ind].first);
-    cell.get_vertex_coordinates(vertex_coordinates);
+    const Cell cell(*_mesh, _vertex_map[vert_ind].first);
+    cell.get_coordinate_dofs(coordinate_dofs);
     cell.get_cell_data(ufc_cell);
 
     // Get all dofs for cell
@@ -139,7 +141,7 @@ void PointIntegralSolver::step(double dt)
 
     // Tabulate local-local dofmap
     _dofmap.tabulate_entity_dofs(_local_to_local_dofs, 0,
-				 _vertex_map[vert_ind].second);
+                                 _vertex_map[vert_ind].second);
 
     // Fill local to global dof map and check that the dof is owned
     bool owns_all_dofs = true;
@@ -148,8 +150,8 @@ void PointIntegralSolver::step(double dt)
       _local_to_global_dofs[row] = cell_dofs[_local_to_local_dofs[row]];
       if (_local_to_global_dofs[row] >= local_dof_size)
       {
-	owns_all_dofs = false;
-	break;
+        owns_all_dofs = false;
+        break;
       }
     }
 
@@ -163,19 +165,19 @@ void PointIntegralSolver::step(double dt)
       // Update cell
       // TODO: Pass suitable bool vector here to avoid tabulating all
       // coefficient dofs:
-      _ufcs[stage][0]->update(cell, vertex_coordinates, ufc_cell);
+      _ufcs[stage][0]->update(cell, coordinate_dofs, ufc_cell);
       //some_integral.enabled_coefficients());
 
       // Check if we have an explicit stage (only 1 form)
       if (_ufcs[stage].size() == 1)
       {
-        _solve_explicit_stage(vert_ind, stage, ufc_cell, vertex_coordinates);
+        _solve_explicit_stage(vert_ind, stage, ufc_cell, coordinate_dofs);
       }
       // or an implicit stage (2 forms)
       else
       {
         _solve_implicit_stage(vert_ind, stage, cell, ufc_cell,
-                              vertex_coordinates);
+                              coordinate_dofs);
       }
     }
 
@@ -188,13 +190,13 @@ void PointIntegralSolver::step(double dt)
     // Update coefficients for last stage
     // TODO: Pass suitable bool vector here to avoid tabulating all
     // coefficient dofs:
-    _last_stage_ufc->update(cell, vertex_coordinates, ufc_cell);
+    _last_stage_ufc->update(cell, coordinate_dofs, ufc_cell);
     //integral.enabled_coefficients());
 
     // Tabulate cell tensor
     integral.tabulate_tensor(_last_stage_ufc->A.data(), _last_stage_ufc->w(),
-			     vertex_coordinates.data(),
-			     _vertex_map[vert_ind].second,
+                             coordinate_dofs.data(),
+                             _vertex_map[vert_ind].second,
                              ufc_cell.orientation);
 
     // Update solution with a tabulation of the last stage
@@ -219,7 +221,7 @@ void PointIntegralSolver::step(double dt)
 void PointIntegralSolver::_solve_explicit_stage(std::size_t vert_ind,
                                                 unsigned int stage,
                                                 const ufc::cell& ufc_cell,
-                                                const std::vector<double>& vertex_coordinates)
+                                                const std::vector<double>& coordinate_dofs)
 {
   Timer t_expl("Explicit stage");
 
@@ -233,13 +235,13 @@ void PointIntegralSolver::_solve_explicit_stage(std::size_t vert_ind,
   // Tabulate cell tensor
   Timer t_expl_tt("Explicit stage: tabulate_tensor");
   integral.tabulate_tensor(_ufcs[stage][0]->A.data(), _ufcs[stage][0]->w(),
-			   vertex_coordinates.data(), local_vert,
+                           coordinate_dofs.data(), local_vert,
                            ufc_cell.orientation);
   t_expl_tt.stop();
 
   // Extract vertex dofs from tabulated tensor and put them into the
   // local stage solution vector
-  // Extract vertex dofs from tabulated tensor
+  //Extract vertex dofs from tabulated tensor
   for (unsigned int row = 0; row < _system_size; row++)
   {
     _local_stage_solutions[stage][row]
@@ -247,7 +249,8 @@ void PointIntegralSolver::_solve_explicit_stage(std::size_t vert_ind,
   }
 
 
-  // FIXME: This below is dodgy and will sooner or later break in parallel (GNW)
+  // FIXME: This below is dodgy and will sooner or later break in
+  // parallel (GNW)
   // Put solution back into global stage solution vector
   // NOTE: This so an UFC.update (coefficient restriction) would just
   // work
@@ -260,12 +263,12 @@ void PointIntegralSolver::_solve_implicit_stage(std::size_t vert_ind,
                                                 unsigned int stage,
                                                 const Cell& cell,
                                                 const ufc::cell& ufc_cell,
-                                                const std::vector<double>& vertex_coordinates)
+                                                const std::vector<double>& coordinate_dofs)
 {
   Timer t_impl("Implicit stage");
 
   // Do a simplified newton solve
-  _simplified_newton_solve(vert_ind, stage, cell, ufc_cell, vertex_coordinates);
+  _simplified_newton_solve(vert_ind, stage, cell, ufc_cell, coordinate_dofs);
 
   // Put solution back into global stage solution vector
   _scheme->stage_solutions()[stage]->vector()->set_local(_local_stage_solutions[stage].data(),
@@ -278,15 +281,15 @@ void PointIntegralSolver::step_interval(double t0, double t1, double dt)
   if (dt <= 0.0)
   {
     dolfin_error("PointIntegralSolver.cpp",
-		 "stepping PointIntegralSolver",
-		 "Expecting a positive dt");
+                 "stepping PointIntegralSolver",
+                 "Expecting a positive dt");
   }
 
   if (t0 >= t1)
   {
     dolfin_error("PointIntegralSolver.cpp",
-		 "stepping PointIntegralSolver",
-		 "Expecting t0 to be smaller than t1");
+                 "stepping PointIntegralSolver",
+                 "Expecting t0 to be smaller than t1");
   }
 
   // Set start time
@@ -306,12 +309,12 @@ void PointIntegralSolver::step_interval(double t0, double t1, double dt)
 }
 //-----------------------------------------------------------------------------
 void PointIntegralSolver::_compute_jacobian(std::vector<double>& jac,
-					    const std::vector<double>& u,
-					    unsigned int local_vert,
-					    UFC& loc_ufc, const Cell& cell,
-					    const ufc::cell& ufc_cell,
-					    int coefficient_index,
-					    const std::vector<double>& vertex_coordinates)
+                                            const std::vector<double>& u,
+                                            unsigned int local_vert,
+                                            UFC& loc_ufc, const Cell& cell,
+                                            const ufc::cell& ufc_cell,
+                                            int coefficient_index,
+                                            const std::vector<double>& coordinate_dofs)
 {
   const ufc::vertex_integral& J_integral = *loc_ufc.default_vertex_integral;
 
@@ -319,7 +322,7 @@ void PointIntegralSolver::_compute_jacobian(std::vector<double>& jac,
   //Timer t_impl_update("Update_cell");
   // TODO: Pass suitable bool vector here to avoid tabulating all
   // coefficient dofs:
-  loc_ufc.update(cell, vertex_coordinates, ufc_cell);
+  loc_ufc.update(cell, coordinate_dofs, ufc_cell);
   //J_integral.enabled_coefficients());
   //t_impl_update.stop();
 
@@ -335,8 +338,8 @@ void PointIntegralSolver::_compute_jacobian(std::vector<double>& jac,
   // Tabulate Jacobian
   Timer t_impl_tt_jac("Implicit stage: tabulate_tensor (J)");
   J_integral.tabulate_tensor(loc_ufc.A.data(), loc_ufc.w(),
-			     vertex_coordinates.data(),
-			     local_vert,
+                             coordinate_dofs.data(),
+                             local_vert,
                              ufc_cell.orientation);
   t_impl_tt_jac.stop();
 
@@ -346,9 +349,9 @@ void PointIntegralSolver::_compute_jacobian(std::vector<double>& jac,
   {
     for (unsigned int col = 0; col < _system_size; col++)
     {
-      jac[row*_system_size + col] = loc_ufc.A[_local_to_local_dofs[row]*
-					      _dof_offset*_system_size +
-					      _local_to_local_dofs[col]];
+      jac[row*_system_size + col]
+        = loc_ufc.A[_local_to_local_dofs[row]*_dof_offset*_system_size
+                    + _local_to_local_dofs[col]];
     }
   }
   //t_impl_update_jac.stop();
@@ -387,8 +390,8 @@ void PointIntegralSolver::_lu_factorize(std::vector<double>& A)
 }
 //-----------------------------------------------------------------------------
 void PointIntegralSolver::_forward_backward_subst(const std::vector<double>& A,
-						  const std::vector<double>& b,
-						  std::vector<double>& x) const
+                                                  const std::vector<double>& b,
+                                                  std::vector<double>& x) const
 {
   // solves Ax = b with forward backward substitution, provided that
   // A is already LU factorized
@@ -407,7 +410,8 @@ void PointIntegralSolver::_forward_backward_subst(const std::vector<double>& A,
   }
 
   const unsigned int _system_size_m_1 = _system_size-1;
-  x[_system_size_m_1] = x[_system_size_m_1]/A[_system_size_m_1*_system_size+_system_size_m_1];
+  x[_system_size_m_1]
+    = x[_system_size_m_1]/A[_system_size_m_1*_system_size + _system_size_m_1];
 
   // Backward
   for (int i = _system_size-2; i >= 0; i--)
@@ -443,9 +447,9 @@ void PointIntegralSolver::_check_forms()
       // Check form includes at least PointIntegral
       if (!stage_forms[i][j]->ufc_form()->has_vertex_integrals())
       {
-	dolfin_error("PointIntegralSolver.cpp",
-		     "constructing PointIntegralSolver",
-		     "Expecting form to have at least 1 PointIntegral");
+        dolfin_error("PointIntegralSolver.cpp",
+                     "constructing PointIntegralSolver",
+                     "Expecting form to have at least 1 PointIntegral");
       }
 
       // Num dofs per vertex
@@ -453,13 +457,13 @@ void PointIntegralSolver::_check_forms()
         = *stage_forms[i][j]->function_space(0)->dofmap();
       const unsigned int dofs_per_vertex = dofmap.num_entity_dofs(0);
       const unsigned int vert_per_cell
-        = _mesh.topology()(_mesh.topology().dim(), 0).size(0);
+        = _mesh->topology()(_mesh->topology().dim(), 0).size(0);
 
       if (vert_per_cell*dofs_per_vertex != dofmap.max_element_dofs())
       {
-      	dolfin_error("PointIntegralSolver.cpp",
-      		     "constructing PointIntegralSolver",
-      		     "Expecting test space to only have dofs on vertices");
+        dolfin_error("PointIntegralSolver.cpp",
+                     "constructing PointIntegralSolver",
+                     "Expecting test space to only have dofs on vertices");
       }
     }
   }
@@ -467,6 +471,8 @@ void PointIntegralSolver::_check_forms()
 //-----------------------------------------------------------------------------
 void PointIntegralSolver::_init()
 {
+  dolfin_assert(_mesh);
+
   // Get stage forms
   std::vector<std::vector<std::shared_ptr<const Form>>>& stage_forms
     = _scheme->stage_forms();
@@ -487,7 +493,7 @@ void PointIntegralSolver::_init()
     for (unsigned int stage = 0; stage < _num_stages; stage++)
     {
       max_jacobian_index = std::max(_scheme->jacobian_index(stage),
-				    max_jacobian_index);
+                                    max_jacobian_index);
     }
 
     // Create memory for jacobians
@@ -515,41 +521,41 @@ void PointIntegralSolver::_init()
       // Find coefficient index for each of the two implicit forms
       for (unsigned int i = 0; i < 2; i++)
       {
-	for (unsigned int j = 0;  j < stage_forms[stage][i]->num_coefficients();
+        for (unsigned int j = 0;  j < stage_forms[stage][i]->num_coefficients();
              j++)
-	{
-	  // Check if stage solution is the same as coefficient j
-	  if (stage_forms[stage][i]->coefficients()[j]->id()
+        {
+          // Check if stage solution is the same as coefficient j
+          if (stage_forms[stage][i]->coefficients()[j]->id()
               == _scheme->stage_solutions()[stage]->id())
-	  {
-	    _coefficient_index[stage].push_back(j);
-	    break;
-	  }
-	}
+          {
+            _coefficient_index[stage].push_back(j);
+            break;
+          }
+        }
       }
 
       // Check that nonlinear form includes a coefficient index
       // (otherwise it might be some error in the form)
       if (_coefficient_index[stage].size() == 0)
       {
-	dolfin_error("PointIntegralSolver.cpp",
-		     "constructing PointIntegralSolver",
-		     "Expecting nonlinear form of stage: %d to be dependent "\
-		     "on the stage solution.", stage);
+        dolfin_error("PointIntegralSolver.cpp",
+                     "constructing PointIntegralSolver",
+                     "Expecting nonlinear form of stage: %d to be dependent "\
+                     "on the stage solution.", stage);
       }
     }
   }
 
   // Build vertex map
-  _vertex_map.resize(_mesh.num_vertices());
+  _vertex_map.resize(_mesh->num_vertices());
 
   // Init mesh connections
-  _mesh.init(0);
-  const unsigned int dim_t = _mesh.topology().dim();
+  _mesh->init(0);
+  const unsigned int dim_t = _mesh->topology().dim();
 
   // Iterate over vertices and collect cell and local vertex
   // information
-  for (VertexIterator vert(_mesh); !vert.end(); ++vert)
+  for (VertexIterator vert(*_mesh); !vert.end(); ++vert)
   {
     // First look for cell where the vert is local vert 0
     bool local_vert_found = false;
@@ -558,10 +564,10 @@ void PointIntegralSolver::_init()
       // If the first local vertex is the same as the global vertex
       if (cell->entities(0)[0]==vert->index())
       {
-	_vertex_map[vert->index()].first = cell->index();
-	_vertex_map[vert->index()].second = 0;
-	local_vert_found = true;
-	break;
+        _vertex_map[vert->index()].first = cell->index();
+        _vertex_map[vert->index()].second = 0;
+        local_vert_found = true;
+        break;
       }
     }
 
@@ -570,32 +576,30 @@ void PointIntegralSolver::_init()
     // corresponds to
     if (!local_vert_found)
     {
-      const Cell cell0(_mesh, vert->entities(dim_t)[0]);
+      const Cell cell0(*_mesh, vert->entities(dim_t)[0]);
       _vertex_map[vert->index()].first = cell0.index();
 
       unsigned int local_vert_index = 0;
       for (VertexIterator local_vert(cell0); !local_vert.end(); ++local_vert)
       {
-	// If local vert is found
-	if (vert->index() == local_vert->index())
-	{
-	  // Store local vertex index
-	  _vertex_map[vert->index()].second = local_vert_index;
-	  break;
-	}
-
-	// Bump index
-	local_vert_index++;
+        // If local vert is found
+        if (vert->index() == local_vert->index())
+        {
+          // Store local vertex index
+          _vertex_map[vert->index()].second = local_vert_index;
+          break;
+        }
+
+        // Bump index
+        local_vert_index++;
       }
     }
   }
 }
 //-----------------------------------------------------------------------------
 void PointIntegralSolver::_simplified_newton_solve(
-			      std::size_t vert_ind, unsigned int stage,
-			      const Cell& cell,
-			      const ufc::cell& ufc_cell,
-			      const std::vector<double>& vertex_coordinates)
+  std::size_t vert_ind, unsigned int stage, const Cell& cell,
+  const ufc::cell& ufc_cell, const std::vector<double>& coordinate_dofs)
 {
   //Timer _timer_newton_solve("Implicit stage: Newton solve");
   const Parameters& newton_solver_params = parameters("newton_solver");
@@ -647,13 +651,13 @@ void PointIntegralSolver::_simplified_newton_solve(
     // Tabulate residual
     Timer t_impl_tt_F("Implicit stage: tabulate_tensor (F)");
     F_integral.tabulate_tensor(loc_ufc_F.A.data(), loc_ufc_F.w(),
-			       vertex_coordinates.data(),
-			       local_vert,
+                               coordinate_dofs.data(),
+                               local_vert,
                                ufc_cell.orientation);
     t_impl_tt_F.stop();
 
-    // Extract vertex dofs from tabulated tensor, together with the old stage
-    // solution
+    // Extract vertex dofs from tabulated tensor, together with the
+    // old stage solution
     for (unsigned int row=0; row < _system_size; row++)
       _residual[row] = loc_ufc_F.A[_local_to_local_dofs[row]];
 
@@ -663,17 +667,22 @@ void PointIntegralSolver::_simplified_newton_solve(
 
     relative_residual = residual/initial_residual;
 
-    // Check for relative residual convergence together with a check for absolute tolerance
-    // The absolute tolerance check is combined a check that the residual is not changing
+    // Check for relative residual convergence together with a check
+    // for absolute tolerance
+    // The absolute tolerance check is combined a check that the
+    // residual is not changing
     // FIXME: Make the relative_previous_residual check configurable
-    if (relative_residual < rtol || (residual < atol && relative_previous_residual > 0.99))
+    if (relative_residual < rtol || (residual < atol
+                                     && relative_previous_residual > 0.99))
+    {
       break;
+    }
 
     // Should we recompute jacobian
     if (_recompute_jacobian[jac_index] || always_recompute_jacobian)
     {
       _compute_jacobian(jac, u, local_vert, loc_ufc_J, cell, ufc_cell,
-    			coefficient_index_J, vertex_coordinates);
+                        coefficient_index_J, coordinate_dofs);
       _recompute_jacobian[jac_index] = false;
     }
 
@@ -700,84 +709,84 @@ void PointIntegralSolver::_simplified_newton_solve(
 
       if (always_recompute_jacobian)
       {
-	if ((report && vert_ind == report_vertex) || verbose_report)
+        if ((report && vert_ind == report_vertex) || verbose_report)
         {
-	  info("Newton solver after %d iterations. vertex: %d, "	\
-	       "relative_previous_residual: %.3f, "			\
-	       "relative_residual: %.3e, residual: %.3e.",
-	       newton_iterations, vert_ind, relative_previous_residual,
-	       relative_residual, residual);
+          info("Newton solver after %d iterations. vertex: %d, "
+               "relative_previous_residual: %.3f, "
+               "relative_residual: %.3e, residual: %.3e.",
+               newton_iterations, vert_ind, relative_previous_residual,
+               relative_residual, residual);
         }
       }
 
       // If we diverge
       else if (relative_previous_residual > 1)
       {
-	if ((report && vert_ind == report_vertex) || verbose_report)
+        if ((report && vert_ind == report_vertex) || verbose_report)
         {
-	  info("Newton solver diverges after %d iterations. vertex: %d, "		\
-	       "relative_previous_residual: %.3f, "			\
-	       "relative_residual: %.3e, residual: %.3e.",
-	       newton_iterations, vert_ind, relative_previous_residual,
-	       relative_residual, residual);
+          info("Newton solver diverges after %d iterations. vertex: %d, "
+               "relative_previous_residual: %.3f, "
+               "relative_residual: %.3e, residual: %.3e.",
+               newton_iterations, vert_ind, relative_previous_residual,
+               relative_residual, residual);
         }
 
-	// If we have not restarted newton solve previously
-	if (!newton_solve_restared)
-	{
-	  if ((report && vert_ind == report_vertex) || verbose_report)
-	    info("Restarting newton solve for vertex: %d", vert_ind);
+        // If we have not restarted newton solve previously
+        if (!newton_solve_restared)
+        {
+          if ((report && vert_ind == report_vertex) || verbose_report)
+            info("Restarting newton solve for vertex: %d", vert_ind);
 
-	  // Reset flags
-	  newton_solve_restared = true;
-	  always_recompute_jacobian = true;
+          // Reset flags
+          newton_solve_restared = true;
+          always_recompute_jacobian = true;
 
-	  // Reset solution
-	  for (unsigned int row=0; row < _system_size; row++)
+          // Reset solution
+          for (unsigned int row=0; row < _system_size; row++)
           {
-	    loc_ufc_F.w()[coefficient_index_F][_local_to_local_dofs[row]]
+            loc_ufc_F.w()[coefficient_index_F][_local_to_local_dofs[row]]
               = u[row] = _u0[row];
           }
 
-	  // Update variables
-	  _eta = parameters("newton_solver")["eta_0"];
-	  newton_iterations = 0;
-	  relative_previous_residual = prev_residual = initial_residual
+          // Update variables
+          _eta = parameters("newton_solver")["eta_0"];
+          newton_iterations = 0;
+          relative_previous_residual = prev_residual = initial_residual
             = relative_residual = 1.0;
-	  max_iterations = 400;
-	  continue;
-	}
+          max_iterations = 400;
+          continue;
+        }
 
       }
 
       // We converge too slow
       else if (relative_previous_residual >= max_relative_previous_residual ||
-	       residual > (kappa*rtol*(1 - relative_previous_residual)/	\
-			   std::pow(relative_previous_residual,		\
-				    max_iterations - newton_iterations)))
+               residual > (kappa*rtol*(1 - relative_previous_residual) /
+                           std::pow(relative_previous_residual,
+                                    max_iterations - newton_iterations)))
       {
-	if ((report && vert_ind == report_vertex) || verbose_report)
+        if ((report && vert_ind == report_vertex) || verbose_report)
         {
-	  info("Newton solver converges too slow at iteration %d. vertex: %d, " \
-	       "relative_previous_residual: %.3f, "			\
-	       "relative_residual: %.3e, residual: %.3e. Recomputing jacobian.",
-	       newton_iterations, vert_ind, relative_previous_residual,
-	       relative_residual, residual);
+          info("Newton solver converges too slow at iteration %d. vertex: %d, "
+               "relative_previous_residual: %.3f, "
+               "relative_residual: %.3e, residual: %.3e. Recomputing jacobian.",
+               newton_iterations, vert_ind, relative_previous_residual,
+               relative_residual, residual);
         }
-	_recompute_jacobian[jac_index] = true;
+        _recompute_jacobian[jac_index] = true;
       }
       else
       {
-	if ((report && vert_ind == report_vertex) || verbose_report)
+        if ((report && vert_ind == report_vertex) || verbose_report)
         {
-	  info("Newton solver after %d iterations. vertex: %d, "	\
-	       "relative_previous_residual: %.3f, "			\
-	       "relative_residual: %.3e, residual: %.3e.",
-	       newton_iterations, vert_ind, relative_previous_residual,
-	       relative_residual, residual);
+          info("Newton solver after %d iterations. vertex: %d, "
+               "relative_previous_residual: %.3f, "
+               "relative_residual: %.3e, residual: %.3e.",
+               newton_iterations, vert_ind, relative_previous_residual,
+               relative_residual, residual);
         }
-	// Update eta
-	_eta = relative_previous_residual/(1.0 - relative_previous_residual);
+        // Update eta
+        _eta = relative_previous_residual/(1.0 - relative_previous_residual);
       }
     }
 
@@ -786,21 +795,23 @@ void PointIntegralSolver::_simplified_newton_solve(
     {
       if (report)
       {
-	info("Newton solver did not converge after %d iterations. vertex: %d, "	\
-	     "relative_previous_residual: %.3f, "			\
-	     "relative_residual: %.3e, residual: %.3e.", max_iterations, vert_ind,
-	     relative_previous_residual, relative_residual, residual);
+        info("Newton solver did not converge after %d iterations. vertex: %d, "
+             "relative_previous_residual: %.3f, "
+             "relative_residual: %.3e, residual: %.3e.", max_iterations,
+             vert_ind, relative_previous_residual, relative_residual, residual);
       }
-      error("Newton solver in PointIntegralSolver exceeded maximal iterations.");
+      dolfin_error("PointIntegralSolver.h",
+                   "Newton point integral solver",
+                   "Newton solver in PointIntegralSolver exceeded maximal iterations");
     }
 
     // Update solution
     if (std::abs(1.0 - relaxation) < DOLFIN_EPS)
       for (unsigned int i=0; i < u.size(); i++)
-	u[i] -= _dx[i];
+        u[i] -= _dx[i];
     else
       for (unsigned int i=0; i < u.size(); i++)
-	u[i] -= relaxation*_dx[i];
+        u[i] -= relaxation*_dx[i];
 
     // Put solution back into restricted coefficients before tabulate
     // new residual
@@ -815,9 +826,9 @@ void PointIntegralSolver::_simplified_newton_solve(
   if ((report && vert_ind == report_vertex) || verbose_report)
   {
     info("Newton solver converged after %d iterations. vertex: %d, "\
-	 "relative_previous_residual: %.3f, relative_residual: %.3e, "\
-	 "residual: %.3e.", newton_iterations, vert_ind,
-	 relative_previous_residual, relative_residual, residual);
+         "relative_previous_residual: %.3f, relative_residual: %.3e, "\
+         "residual: %.3e.", newton_iterations, vert_ind,
+         relative_previous_residual, relative_residual, residual);
   }
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/multistage/PointIntegralSolver.h b/dolfin/multistage/PointIntegralSolver.h
index 138bdb6..119b2b7 100644
--- a/dolfin/multistage/PointIntegralSolver.h
+++ b/dolfin/multistage/PointIntegralSolver.h
@@ -16,7 +16,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-02-15
-// Last changed: 2014-10-01
+// Last changed: 2016-04-27
 
 #ifndef __POINTINTEGRALSOLVER_H
 #define __POINTINTEGRALSOLVER_H
@@ -47,7 +47,7 @@ namespace dolfin
     /// Constructor
     /// FIXME: Include version where one can pass a Solver and/or
     /// Parameters
-    PointIntegralSolver(std::shared_ptr<MultiStageScheme> scheme);
+    explicit PointIntegralSolver(std::shared_ptr<MultiStageScheme> scheme);
 
     /// Destructor
     ~PointIntegralSolver();
@@ -72,9 +72,8 @@ namespace dolfin
       // Set parameters for NewtonSolver
       Parameters pn("newton_solver");
       pn.add("maximum_iterations", 40);
-      pn.add("recompute_jacobian_for_linear_problems", false);
       pn.add("always_recompute_jacobian", false);
-      pn.add("recompute_jacobian_each_solve", false);
+      pn.add("recompute_jacobian_each_solve", true);
       pn.add("relaxation_parameter", 1., 0., 1.);
       pn.add("relative_tolerance", 1e-10, 1e-20, 2.);
       pn.add("absolute_tolerance", 1e-15, 1e-20, 2.);
@@ -100,39 +99,26 @@ namespace dolfin
 
     // Return number of computations of jacobian
     std::size_t num_jacobian_computations() const
-    {
-      return _num_jacobian_computations;
-    }
+    { return _num_jacobian_computations; }
 
   private:
 
-    // Convergence criteria for simplified Newton solver
-    enum convergence_criteria_t
-    {
-
-      converged,
-      too_slow,
-      exceeds_max_iter,
-      diverge
-
-    };
-
     // In-place LU factorization of jacobian matrix
     void _lu_factorize(std::vector<double>& A);
 
     // Forward backward substitution, assume that mat is already
     // in place LU factorized
     void _forward_backward_subst(const std::vector<double>& A,
-				 const std::vector<double>& b,
-				 std::vector<double>& x) const;
+                                 const std::vector<double>& b,
+                                 std::vector<double>& x) const;
 
     // Compute jacobian using passed UFC form
     void _compute_jacobian(std::vector<double>& jac,
                            const std::vector<double>& u,
-			   unsigned int local_vert, UFC& loc_ufc,
-			   const Cell& cell, const ufc::cell& ufc_cell,
-			   int coefficient_index,
-			   const std::vector<double>& vertex_coordinates);
+                           unsigned int local_vert, UFC& loc_ufc,
+                           const Cell& cell, const ufc::cell& ufc_cell,
+                           int coefficient_index,
+                           const std::vector<double>& coordinate_dofs);
 
     // Compute the norm of a vector
     double _norm(const std::vector<double>& vec) const;
@@ -148,23 +134,23 @@ namespace dolfin
     // Solve an explicit stage
     void _solve_explicit_stage(std::size_t vert_ind, unsigned int stage,
                                const ufc::cell& ufc_cell,
-			       const std::vector<double>& vertex_coordinates);
+                               const std::vector<double>& coordinate_dofs);
 
     // Solve an implicit stage
     void _solve_implicit_stage(std::size_t vert_ind, unsigned int stage,
-			       const Cell& cell, const ufc::cell& ufc_cell,
-			       const std::vector<double>& vertex_coordinates);
+                               const Cell& cell, const ufc::cell& ufc_cell,
+                               const std::vector<double>& coordinate_dofs);
 
     void
       _simplified_newton_solve(std::size_t vert_ind, unsigned int stage,
                                const Cell& cell, const ufc::cell& ufc_cell,
-                               const std::vector<double>& vertex_coordinates);
+                               const std::vector<double>& coordinate_dofs);
 
     // The MultiStageScheme
     std::shared_ptr<MultiStageScheme> _scheme;
 
     // Reference to mesh
-    const Mesh& _mesh;
+    std::shared_ptr<const Mesh> _mesh;
 
     // The dofmap (Same for all stages and forms)
     const GenericDofMap& _dofmap;
@@ -184,14 +170,14 @@ namespace dolfin
 
     // Vertex map between vertices, cells and corresponding local
     // vertex
-    std::vector<std::pair<std::size_t, unsigned int> > _vertex_map;
+    std::vector<std::pair<std::size_t, unsigned int>> _vertex_map;
 
     // Local to global dofs used when solution is fanned out to global
     // vector
     std::vector<dolfin::la_index> _local_to_global_dofs;
 
     // Local stage solutions
-    std::vector<std::vector<double> > _local_stage_solutions;
+    std::vector<std::vector<double>> _local_stage_solutions;
 
     // Local solutions
     std::vector<double> _u0;
@@ -200,19 +186,19 @@ namespace dolfin
     std::vector<double> _dx;
 
     // UFC objects, one for each form
-    std::vector<std::vector<std::shared_ptr<UFC> > > _ufcs;
+    std::vector<std::vector<std::shared_ptr<UFC>>> _ufcs;
 
     // UFC objects for the last form
     std::shared_ptr<UFC> _last_stage_ufc;
 
     // Solution coefficient index in form
-    std::vector<std::vector<int> > _coefficient_index;
+    std::vector<std::vector<int>> _coefficient_index;
 
     // Flag which is set to false once the jacobian has been computed
     std::vector<bool> _recompute_jacobian;
 
     // Jacobians/LU factorized jacobians matrices
-    std::vector<std::vector<double> > _jacobians;
+    std::vector<std::vector<double>> _jacobians;
 
     // Variable used in the estimation of the error of the newton
     // iteration for the first iteration (important for linear
diff --git a/dolfin/multistage/RKSolver.cpp b/dolfin/multistage/RKSolver.cpp
index 2ad8fb5..e0a619e 100644
--- a/dolfin/multistage/RKSolver.cpp
+++ b/dolfin/multistage/RKSolver.cpp
@@ -55,7 +55,7 @@ void RKSolver::step(double dt)
     = _scheme->stage_forms();
   std::vector<std::shared_ptr<Function>>& stage_solutions
     = _scheme->stage_solutions();
-  std::vector<const DirichletBC* > bcs = _scheme->bcs();
+  std::vector<std::shared_ptr<const DirichletBC>> bcs = _scheme->bcs();
 
   // Iterate over stage forms
   for (unsigned int stage=0; stage < stage_forms.size(); stage++)
@@ -86,7 +86,10 @@ void RKSolver::step(double dt)
       // FIXME: applying the bcs on stage solutions are probably wrong...
       // FIXME: Include solver parameters
       // Do a nonlinear solve
-      solve(*stage_forms[stage][0] == 0, *stage_solutions[stage], bcs,
+      std::vector<const DirichletBC*> _bcs(bcs.size());
+      for (std::size_t i = 0; i < bcs.size(); ++i)
+        _bcs[i] = bcs[i].get();
+      solve(*stage_forms[stage][0] == 0, *stage_solutions[stage], _bcs,
             *stage_forms[stage][1]);
     }
   }
diff --git a/dolfin/multistage/RKSolver.h b/dolfin/multistage/RKSolver.h
index e7a78d8..82fad04 100644
--- a/dolfin/multistage/RKSolver.h
+++ b/dolfin/multistage/RKSolver.h
@@ -23,8 +23,6 @@
 
 #include <vector>
 #include <memory>
-
-#include <dolfin/function/FunctionAXPY.h>
 #include <dolfin/fem/Assembler.h>
 #include <dolfin/la/GenericVector.h>
 
@@ -42,7 +40,7 @@ namespace dolfin
 
     /// Constructor
     /// FIXME: Include version where one can pass a Solver and/or Parameters
-    RKSolver(std::shared_ptr<MultiStageScheme> scheme);
+    explicit RKSolver(std::shared_ptr<MultiStageScheme> scheme);
 
     /// Step solver with time step dt
     void step(double dt);
@@ -51,7 +49,7 @@ namespace dolfin
     void step_interval(double t0, double t1, double dt);
 
     /// Return the MultiStageScheme
-    std::shared_ptr<MultiStageScheme> scheme() const 
+    std::shared_ptr<MultiStageScheme> scheme() const
     {return _scheme;}
 
   private:
diff --git a/dolfin/nls/NewtonSolver.cpp b/dolfin/nls/NewtonSolver.cpp
index dce8f0d..1d643ed 100644
--- a/dolfin/nls/NewtonSolver.cpp
+++ b/dolfin/nls/NewtonSolver.cpp
@@ -22,7 +22,9 @@
 // First added:  2005-10-23
 // Last changed: 2014-05-27
 
-#include <iostream>
+#include <cmath>
+#include <string>
+
 #include <dolfin/common/constants.h>
 #include <dolfin/common/NoDeleter.h>
 #include <dolfin/la/GenericLinearSolver.h>
@@ -62,21 +64,23 @@ Parameters NewtonSolver::default_parameters()
   return p;
 }
 //-----------------------------------------------------------------------------
-NewtonSolver::NewtonSolver()
+NewtonSolver::NewtonSolver(MPI_Comm comm)
   : Variable("Newton solver", "unamed"), _newton_iteration(0), _residual(0.0),
-    _residual0(0.0), _matA(new Matrix), _dx(new Vector), _b(new Vector),
-    _mpi_comm(MPI_COMM_WORLD)
+    _residual0(0.0), _matA(new Matrix(comm)), _dx(new Vector(comm)),
+    _b(new Vector(comm)), _mpi_comm(comm)
 {
   // Set default parameters
   parameters = default_parameters();
 }
 //-----------------------------------------------------------------------------
-NewtonSolver::NewtonSolver(std::shared_ptr<GenericLinearSolver> solver,
+NewtonSolver::NewtonSolver(MPI_Comm comm,
+                           std::shared_ptr<GenericLinearSolver> solver,
                            GenericLinearAlgebraFactory& factory)
   : Variable("Newton solver", "unamed"), _newton_iteration(0), _residual(0.0),
-    _residual0(0.0), _solver(solver), _matA(factory.create_matrix()),
-    _dx(factory.create_vector()), _b(factory.create_vector()),
-    _mpi_comm(MPI_COMM_WORLD)
+    _residual0(0.0), _solver(solver), _matA(factory.create_matrix(comm)),
+    _dx(factory.create_vector(comm)),
+    _b(factory.create_vector(comm)),
+    _mpi_comm(comm)
 {
   // Set default parameters
   parameters = default_parameters();
@@ -108,8 +112,7 @@ NewtonSolver::solve(NonlinearProblem& nonlinear_problem,
   const std::string pc_type = parameters["preconditioner"];
   if (!_solver)
   {
-    _solver = std::shared_ptr<LinearSolver>(new LinearSolver(solver_type,
-                                                             pc_type));
+    _solver = std::make_shared<LinearSolver>(x.mpi_comm(), solver_type, pc_type);
   }
   dolfin_assert(_solver);
 
@@ -208,11 +211,11 @@ NewtonSolver::solve(NonlinearProblem& nonlinear_problem,
     const bool error_on_nonconvergence = parameters["error_on_nonconvergence"];
     if (error_on_nonconvergence)
     {
-      if (_newton_iteration == maxiter) 
+      if (_newton_iteration == maxiter)
       {
         dolfin_error("NewtonSolver.cpp",
                      "solve nonlinear system with NewtonSolver",
-                     "Newton solver did not converge because maximum number of iterations reached"); 
+                     "Newton solver did not converge because maximum number of iterations reached");
       }
       else
       {
diff --git a/dolfin/nls/NewtonSolver.h b/dolfin/nls/NewtonSolver.h
index 622fac3..593c11b 100644
--- a/dolfin/nls/NewtonSolver.h
+++ b/dolfin/nls/NewtonSolver.h
@@ -47,16 +47,18 @@ namespace dolfin
   public:
 
     /// Create nonlinear solver
-    NewtonSolver();
+    explicit NewtonSolver(MPI_Comm comm=MPI_COMM_WORLD);
 
     /// Create nonlinear solver using provided linear solver
     ///
     /// *Arguments*
+    ///     comm (_MPI_Ccmm_)
+    ///         The MPI communicator.
     ///     solver (_GenericLinearSolver_)
     ///         The linear solver.
     ///     factory (_GenericLinearAlgebraFactory_)
     ///         The factory.
-    NewtonSolver(std::shared_ptr<GenericLinearSolver> solver,
+    NewtonSolver(MPI_Comm comm, std::shared_ptr<GenericLinearSolver> solver,
                  GenericLinearAlgebraFactory& factory);
 
     /// Destructor
diff --git a/dolfin/nls/PETScSNESSolver.cpp b/dolfin/nls/PETScSNESSolver.cpp
index fd31d6f..9dbc560 100644
--- a/dolfin/nls/PETScSNESSolver.cpp
+++ b/dolfin/nls/PETScSNESSolver.cpp
@@ -42,28 +42,6 @@
 
 using namespace dolfin;
 
-#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR == 3
-// Mapping from method string to PETSc
-const std::map<std::string, std::pair<std::string, const SNESType>>
-PETScSNESSolver::_methods
-= { {"default",     {"default SNES method", ""}},
-    {"ls",          {"Line search method", SNESLS}},
-    ("tr",          {"Trust region method",  SNESTR}},
-    {"test",        {"Tool to verify Jacobian approximation", SNESTEST}},
-    {"ngmres",      {"Nonlinear generalised minimum residual method",
-                     SNESNGMRES}},
-    {"nrichardson", {"Richardson nonlinear method (Picard iteration)",
-                     SNESNRICHARDSON}},
-    {"virs",        {"Reduced space active set solver method (for bounds)",
-                     SNESVIRS}},
-    {"viss",        {"Reduced space active set solver method (for bounds)",
-                     SNESVISS}},
-    {"qn",          {"Limited memory quasi-Newton", SNESQN}},
-    {"ncg",         {"Nonlinear conjugate gradient method", SNESNCG}},
-    {"fas",         {"Full Approximation Scheme nonlinear multigrid method",
-                     SNESFAS}},
-    {"ms",          {"Multistage smoothers", SNESMS}} };
-#elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 4
 // Mapping from method string to PETSc
 const std::map<std::string, std::pair<std::string, const SNESType>>
 PETScSNESSolver::_methods
@@ -88,7 +66,6 @@ PETScSNESSolver::_methods
     {"aspin",        {"Additive-Schwarz Preconditioned Inexact Newton",
                       SNESASPIN}},
     {"ms",           {"Multistage smoothers", SNESMS}} };
-#endif
 
 //-----------------------------------------------------------------------------
 std::vector<std::pair<std::string, std::string>> PETScSNESSolver::methods()
@@ -105,7 +82,6 @@ Parameters PETScSNESSolver::default_parameters()
   p.rename("snes_solver");
   p.add("solution_tolerance", 1.0e-16);
   p.add("maximum_residual_evaluations", 2000);
-  p.add("options_prefix", "default");
   p.remove("convergence_criterion");
   p.remove("relaxation_parameter");
   p.remove("method");
@@ -116,12 +92,33 @@ Parameters PETScSNESSolver::default_parameters()
   return p;
 }
 //-----------------------------------------------------------------------------
-PETScSNESSolver::PETScSNESSolver(std::string nls_type) :
-  _snes(NULL)
+PETScSNESSolver::PETScSNESSolver(MPI_Comm comm) : _snes(nullptr),
+                                                  _has_explicit_bounds(false)
+{
+  // Create SNES object
+  SNESCreate(comm, &_snes);
+
+  // Set parameter values
+  parameters = default_parameters();
+}
+//-----------------------------------------------------------------------------
+PETScSNESSolver::PETScSNESSolver(std::string nls_type) : _snes(nullptr),
+                                                         _has_explicit_bounds(false)
 {
+  // Create SNES object
+  SNESCreate(MPI_COMM_WORLD, &_snes);
+
+  const std::map<std::string, std::pair<std::string, const SNESType>>::const_iterator
+    method = _methods.find(nls_type);
 
   // Check that the requested method is known
-  if (_methods.count(nls_type) == 0)
+  if (method != _methods.end())
+  {
+    // Set solver type
+    if (method->first != "default")
+      SNESSetType(_snes, method->second.second);
+  }
+  else
   {
     dolfin_error("PETScSNESSolver.cpp",
                  "create PETSc SNES solver",
@@ -130,8 +127,6 @@ PETScSNESSolver::PETScSNESSolver(std::string nls_type) :
 
   // Set parameter values
   parameters = default_parameters();
-
-  init(nls_type);
 }
 //-----------------------------------------------------------------------------
 PETScSNESSolver::~PETScSNESSolver()
@@ -140,26 +135,6 @@ PETScSNESSolver::~PETScSNESSolver()
     SNESDestroy(&_snes);
 }
 //-----------------------------------------------------------------------------
-void PETScSNESSolver::init(const std::string& method)
-{
-  if (_snes)
-    SNESDestroy(&_snes);
-
-  // Create SNES object
-  SNESCreate(PETSC_COMM_WORLD, &_snes);
-
-  // Set solver type
-  if (method != "default")
-  {
-    auto it = _methods.find(method);
-    dolfin_assert(it != _methods.end());
-    SNESSetType(_snes, it->second.second);
-  }
-
-  // Set to default to not having explicit bounds
-  has_explicit_bounds = false;
-}
-//-----------------------------------------------------------------------------
 std::pair<std::size_t, bool>
 PETScSNESSolver::solve(NonlinearProblem& nonlinear_problem,
                        GenericVector& x,
@@ -190,14 +165,13 @@ PETScSNESSolver::solve(NonlinearProblem& nonlinear_problem,
     _lb(&lb.down_cast<PETScVector>(), NoDeleter());
   this->lb = _lb;
   this->ub = _ub;
-  has_explicit_bounds = true;
+  _has_explicit_bounds = true;
 
   return this->solve(nonlinear_problem, x);
 }
 //-----------------------------------------------------------------------------
-void
-PETScSNESSolver::init(NonlinearProblem& nonlinear_problem,
-                       GenericVector& x)
+void PETScSNESSolver::init(NonlinearProblem& nonlinear_problem,
+                           GenericVector& x)
 {
   Timer timer("SNES solver init");
   PETScMatrix A;
@@ -205,9 +179,6 @@ PETScSNESSolver::init(NonlinearProblem& nonlinear_problem,
   // Set linear solver parameters
   set_linear_solver_parameters();
 
-  const bool report = parameters["report"];
-
-
   _snes_ctx.nonlinear_problem = &nonlinear_problem;
   _snes_ctx.x = &x.down_cast<PETScVector>();
   VecDuplicate(_snes_ctx.x->vec(), &_snes_ctx.f_tmp);
@@ -224,22 +195,31 @@ PETScSNESSolver::init(NonlinearProblem& nonlinear_problem,
                   &_snes_ctx);
   SNESSetObjective(_snes, PETScSNESSolver::FormObjective, &_snes_ctx);
 
-  std::string prefix = std::string(parameters["options_prefix"]);
-  if (prefix != "default")
+  // Set some options from the parameters
+  if (parameters["report"].is_set())
   {
-    // Make sure that the prefix has a '_' at the end if the user
-    // didn't provide it
-    char lastchar = *prefix.rbegin();
-    if (lastchar != '_')
-      prefix += "_";
-
-    SNESSetOptionsPrefix(_snes, prefix.c_str());
+    if (parameters["report"])
+    {
+      PetscErrorCode ierr;
+      #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+      ierr = SNESMonitorSet(_snes, SNESMonitorDefault,
+                            PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)_snes)),
+                            NULL);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "SNESMonitorSet");
+      #else
+      PetscViewer viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)_snes));
+      PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
+      PetscViewerAndFormat *vf;
+      PetscViewerAndFormatCreate(viewer,format,&vf);
+      ierr = SNESMonitorSet(_snes,
+                            (PetscErrorCode (*)(SNES,PetscInt,PetscReal,void*)) SNESMonitorDefault,
+                            vf,
+                            (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "SNESMonitorSet");
+      #endif
+    }
   }
 
-  // Set some options from the parameters
-  if (report)
-    SNESMonitorSet(_snes, SNESMonitorDefault, PETSC_NULL, PETSC_NULL);
-
   // Set the bounds, if any
   set_bounds(x);
 
@@ -252,14 +232,6 @@ PETScSNESSolver::init(NonlinearProblem& nonlinear_problem,
     SNESSetType(_snes, it->second.second);
 
     // Check if bounds/sign are set when VI method requested
-    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR == 3
-    if ((method == "virs" || method == "viss") && !is_vi())
-    {
-      dolfin_error("PETScSNESSolver.cpp",
-                   "set up SNES VI solver",
-                   "Need to set bounds or sign for virs or viss methods");
-    }
-    #else
     if ((method == "vinewtonrsls" || method == "vinewtonssls") && !is_vi())
     {
       dolfin_error("PETScSNESSolver.cpp",
@@ -267,7 +239,6 @@ PETScSNESSolver::init(NonlinearProblem& nonlinear_problem,
                    "Need to set bounds or sign for vinewtonrsls or vinewtonssls"
                    " methods");
     }
-    #endif
   }
   else if (method == "default" && is_vi())
   {
@@ -276,25 +247,26 @@ PETScSNESSolver::init(NonlinearProblem& nonlinear_problem,
     // AND  b) the user has not set a solver (method == default)
     // THEN set a good method that supports bounds
     // (most methods do not support bounds)
-    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR == 3 && PETSC_VERSION_RELEASE
-    auto it = _methods.find("viss");
-    #else
     auto it = _methods.find("vinewtonssls");
-    #endif
     dolfin_assert(it != _methods.end());
     SNESSetType(_snes, it->second.second);
   }
 
   SNESLineSearch linesearch;
-
-  #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 4
-  SNESGetSNESLineSearch(_snes, &linesearch);
-  #else
   SNESGetLineSearch(_snes, &linesearch);
-  #endif
 
-  if (report)
-    SNESLineSearchSetMonitor(linesearch, PETSC_TRUE);
+  if (parameters["report"].is_set())
+  {
+    if (parameters["report"])
+    {
+      #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+      SNESLineSearchSetMonitor(linesearch, PETSC_TRUE);
+      #else
+      SNESLineSearchMonitor(linesearch);
+      #endif
+    }
+  }
+
   const std::string line_search_type = std::string(parameters["line_search"]);
   SNESLineSearchSetType(linesearch, line_search_type.c_str());
 
@@ -310,6 +282,38 @@ PETScSNESSolver::init(NonlinearProblem& nonlinear_problem,
   SNESSetFromOptions(_snes);
 }
 //-----------------------------------------------------------------------------
+void PETScSNESSolver::set_options_prefix(std::string options_prefix)
+{
+  // Set options prefix
+  dolfin_assert(_snes);
+  PetscErrorCode ierr = SNESSetOptionsPrefix(_snes, options_prefix.c_str());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "SNESSetOptionsPrefix");
+}
+//-----------------------------------------------------------------------------
+std::string PETScSNESSolver::get_options_prefix() const
+{
+  dolfin_assert(_snes);
+  const char* prefix = NULL;
+  PetscErrorCode ierr = SNESGetOptionsPrefix(_snes, &prefix);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "SNESGetOptionsPrefix");
+  return std::string(prefix);
+}
+//-----------------------------------------------------------------------------
+void PETScSNESSolver::set_from_options() const
+{
+  dolfin_assert(_snes);
+  PetscErrorCode ierr = SNESSetFromOptions(_snes);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "SNESSetFromOptions");
+}
+//-----------------------------------------------------------------------------
+MPI_Comm PETScSNESSolver::mpi_comm() const
+{
+  dolfin_assert(_snes);
+  MPI_Comm mpi_comm = MPI_COMM_NULL;
+  PetscObjectGetComm((PetscObject)_snes, &mpi_comm);
+  return mpi_comm;
+}
+//-----------------------------------------------------------------------------
 std::pair<std::size_t, bool>
 PETScSNESSolver::solve(NonlinearProblem& nonlinear_problem,
                        GenericVector& x)
@@ -326,7 +330,7 @@ PETScSNESSolver::solve(NonlinearProblem& nonlinear_problem,
   // same as the vector that holds the current solution
   // guess in the dolfin form.
   PETScVector x_copy(x.down_cast<PETScVector>());
-  SNESSolve(_snes, PETSC_NULL, x_copy.vec());
+  SNESSolve(_snes, NULL, x_copy.vec());
   x.zero();
   x.axpy(1.0, x_copy);
 
@@ -339,8 +343,7 @@ PETScSNESSolver::solve(NonlinearProblem& nonlinear_problem,
 
   const bool report = parameters["report"];
 
-  MPI_Comm comm = MPI_COMM_NULL;
-  PetscObjectGetComm((PetscObject)_snes, &comm);
+  MPI_Comm comm = mpi_comm();
   if (reason > 0 && report && dolfin::MPI::rank(comm) == 0)
   {
     info("PETSc SNES solver converged in %d iterations with convergence reason %s.",
@@ -406,37 +409,6 @@ PetscErrorCode PETScSNESSolver::FormObjective(SNES snes, Vec x,
   return 0;
 }
 //-----------------------------------------------------------------------------
-#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-PetscErrorCode PETScSNESSolver::FormJacobian(SNES snes, Vec x, Mat* A, Mat* P,
-                                             MatStructure* flag, void* ctx)
-{
-  // Interface does not presently support a preconditioner that
-  // differs from operator A
-  if (*A != *P)
-  {
-    dolfin_error("PETScSNESSolver.cpp",
-                 "for Jacobian",
-                 "Matrix object incompatibility. The Jacobian matrix must not be reset when using PETSc SNES.");
-  }
-
-  // Get nonlinear problem object
-  auto snes_ctx = static_cast<struct snes_ctx_t*>(ctx);
-  NonlinearProblem* nonlinear_problem = snes_ctx->nonlinear_problem;
-
-  // Wrap the PETSc objects
-  PETScMatrix A_wrap(*P);
-  PETScVector x_wrap(x);
-
-  // Form Jacobian
-  PETScVector f;
-  nonlinear_problem->form(A_wrap, f, x_wrap);
-  nonlinear_problem->J(A_wrap, x_wrap);
-
-  *flag = SAME_NONZERO_PATTERN;
-
-  return 0;
-}
-#else
 PetscErrorCode PETScSNESSolver::FormJacobian(SNES snes, Vec x, Mat A, Mat P,
                                              void* ctx)
 {
@@ -464,7 +436,6 @@ PetscErrorCode PETScSNESSolver::FormJacobian(SNES snes, Vec x, Mat A, Mat P,
 
   return 0;
 }
-#endif
 //-----------------------------------------------------------------------------
 void PETScSNESSolver::set_linear_solver_parameters()
 {
@@ -478,12 +449,27 @@ void PETScSNESSolver::set_linear_solver_parameters()
   ierr = KSPGetPC(ksp, &pc);
   if (ierr != 0) petsc_error(ierr, __FILE__, "KSPGetPC");
 
-  MPI_Comm comm = MPI_COMM_NULL;
-  PetscObjectGetComm((PetscObject)_snes, &comm);
-
-  if (parameters["report"])
-    KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_NULL, PETSC_NULL);
+  // Get MPI communicator
+  MPI_Comm comm = mpi_comm();
 
+  if (parameters["report"].is_set())
+  {
+    if (parameters["report"])
+    {
+      #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+      KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_VIEWER_STDOUT_(comm), NULL);
+      #else
+      PetscViewer viewer = PETSC_VIEWER_STDOUT_(comm);
+      PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
+      PetscViewerAndFormat *vf;
+      ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
+      ierr = KSPMonitorSet(ksp,
+                           (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorDefault,
+                           vf,
+                           (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+      #endif
+    }
+  }
   const std::string linear_solver  = parameters["linear_solver"];
   const std::string preconditioner = parameters["preconditioner"];
 
@@ -506,10 +492,6 @@ void PETScSNESSolver::set_linear_solver_parameters()
 
     Parameters krylov_parameters = parameters("krylov_solver");
 
-    // GMRES restart parameter
-    const int gmres_restart = krylov_parameters("gmres")["restart"];
-    KSPGMRESSetRestart(ksp, gmres_restart);
-
     // Non-zero initial guess
     const bool nonzero_guess = krylov_parameters["nonzero_initial_guess"];
     if (nonzero_guess)
@@ -518,7 +500,23 @@ void PETScSNESSolver::set_linear_solver_parameters()
       KSPSetInitialGuessNonzero(ksp, PETSC_FALSE);
 
     if (krylov_parameters["monitor_convergence"])
-      KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, 0, 0);
+    {
+      #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+      KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm,
+                    PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ksp)),
+                    NULL);
+
+      #else
+      PetscViewer viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ksp));
+      PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
+      PetscViewerAndFormat *vf;
+      ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
+      ierr = KSPMonitorSet(ksp,
+                         (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
+                         vf,
+                         (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+      #endif
+    }
 
     // Set tolerances
     const int max_iters = krylov_parameters["maximum_iterations"];
@@ -591,21 +589,12 @@ void PETScSNESSolver::set_bounds(GenericVector& x)
     dolfin_assert(_snes);
     const std::string sign   = parameters["sign"];
     const std::string method = parameters["method"];
-    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR == 3
-    if (method != "virs" && method != "viss" && method != "default")
-    {
-      dolfin_error("PETScSNESSolver.cpp",
-                   "set variational inequality bounds",
-                   "Need to use virs or viss methods if bounds are set");
-    }
-    #else
     if (method != "vinewtonrsls" && method != "vinewtonssls" && method != "default")
     {
       dolfin_error("PETScSNESSolver.cpp",
                    "set variational inequality bounds",
                    "Need to use vinewtonrsls or vinewtonssls methods if bounds are set");
     }
-    #endif
 
     if (sign != "default")
     {
@@ -618,24 +607,13 @@ void PETScSNESSolver::set_bounds(GenericVector& x)
       VecDuplicate(_x.vec(), &lb);
       if (sign == "nonnegative")
       {
-        #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-        VecSet(ub, SNES_VI_INF);
-        #else
         VecSet(ub, PETSC_INFINITY);
-        #endif
-
         VecSet(lb, 0.0);
       }
       else if (sign == "nonpositive")
       {
         VecSet(ub, 0.0);
-
-        #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-        VecSet(lb, SNES_VI_INF);
-        #else
         VecSet(lb, PETSC_INFINITY);
-        #endif
-
       }
       else
       {
@@ -648,7 +626,7 @@ void PETScSNESSolver::set_bounds(GenericVector& x)
       VecDestroy(&ub);
       VecDestroy(&lb);
     }
-    else if (has_explicit_bounds == true)
+    else if (_has_explicit_bounds)
     {
       const PETScVector* lb = this->lb.get();
       const PETScVector* ub = this->ub.get();
@@ -660,14 +638,14 @@ void PETScSNESSolver::set_bounds(GenericVector& x)
 bool PETScSNESSolver::is_vi() const
 {
   const std::string sign = parameters["sign"];
-  if (sign != "default" && this->has_explicit_bounds == true)
+  if (sign != "default" && this->_has_explicit_bounds)
   {
     dolfin_error("PETScSNESSolver.cpp",
                  "set variational inequality bounds",
                  "Both the sign parameter and the explicit bounds are set");
     return false;
   }
-  else if (sign != "default" || this->has_explicit_bounds == true)
+  else if (sign != "default" || this->_has_explicit_bounds)
     return true;
   else
     return false;
diff --git a/dolfin/nls/PETScSNESSolver.h b/dolfin/nls/PETScSNESSolver.h
index df3b8d6..e4866ab 100644
--- a/dolfin/nls/PETScSNESSolver.h
+++ b/dolfin/nls/PETScSNESSolver.h
@@ -23,12 +23,13 @@
 #ifdef HAS_PETSC
 
 #include <map>
-#include <petscsnes.h>
 #include <memory>
+#include <petscsnes.h>
+
+#include <dolfin/common/MPI.h>
+#include <dolfin/la/PETScObject.h>
 #include <dolfin/nls/NewtonSolver.h>
 #include <dolfin/parameter/Parameters.h>
-#include <dolfin/la/PETScObject.h>
-#include <dolfin/la/PETScVector.h>
 
 namespace dolfin
 {
@@ -45,6 +46,9 @@ namespace dolfin
   {
   public:
 
+    /// Create SNES solver
+    explicit PETScSNESSolver(MPI_Comm comm);
+
     /// Create SNES solver for a particular method
     PETScSNESSolver(std::string nls_type="default");
 
@@ -92,8 +96,22 @@ namespace dolfin
     /// user wants to access the SNES object directly
     void init(NonlinearProblem& nonlinear_problem, GenericVector& x);
 
+    /// Set options from the PETSc options database
+    void set_from_options() const;
+
+    /// Sets the prefix used by PETSc when searching the PETSc options
+    /// database
+    void set_options_prefix(std::string options_prefix);
+
+    /// Returns the prefix used by PETSc when searching the PETSc
+    /// options database
+    std::string get_options_prefix() const;
+
+    /// Return the MPI communicator
+    MPI_Comm mpi_comm() const;
+
     /// Return a list of available solver methods
-    static std::vector<std::pair<std::string, std::string> > methods();
+    static std::vector<std::pair<std::string, std::string>> methods();
 
     /// Default parameter values
     static Parameters default_parameters();
@@ -129,27 +147,19 @@ namespace dolfin
     // PETSc solver pointer
     SNES _snes;
 
-    // Initialize SNES solver
-    void init(const std::string& method);
-
     // Update the linear solver parameters
     void set_linear_solver_parameters();
 
     // Available solvers
     static const std::map<std::string,
-      std::pair<std::string, const SNESType> > _methods;
+      std::pair<std::string, const SNESType>> _methods;
 
     // The callback for PETSc to compute F, the nonlinear residual
     static PetscErrorCode FormFunction(SNES snes, Vec x, Vec f, void* ctx);
 
     // The callback for PETSc to compute A, the Jacobian
-    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 4
-    static PetscErrorCode FormJacobian(SNES snes, Vec x, Mat* A, Mat* B,
-                                       MatStructure* flag, void* ctx);
-    #else
     static PetscErrorCode FormJacobian(SNES snes, Vec x, Mat A, Mat B,
                                        void* ctx);
-    #endif
 
     static PetscErrorCode FormObjective(SNES snes, Vec x, PetscReal* out,
                                         void* ctx);
@@ -168,7 +178,7 @@ namespace dolfin
     std::shared_ptr<const PETScVector> ub;
 
     // Flag to indicate if explicit bounds are set
-    bool has_explicit_bounds;
+    bool _has_explicit_bounds;
 
     // SNES context
     struct snes_ctx_t _snes_ctx;
diff --git a/dolfin/nls/PETScTAOSolver.cpp b/dolfin/nls/PETScTAOSolver.cpp
index 51e5618..44b6dab 100644
--- a/dolfin/nls/PETScTAOSolver.cpp
+++ b/dolfin/nls/PETScTAOSolver.cpp
@@ -18,12 +18,13 @@
 // First added:  2014-06-22
 // Last changed: 2014-07-27
 
-#ifdef ENABLE_PETSC_TAO
+#ifdef HAS_PETSC
 
 #include <map>
 #include <string>
 #include <utility>
 #include <petscsys.h>
+#include <petscversion.h>
 #include <dolfin/common/MPI.h>
 #include <dolfin/common/Timer.h>
 #include <dolfin/la/KrylovSolver.h>
@@ -77,15 +78,8 @@ Parameters PETScTAOSolver::default_parameters()
   p.add("linear_solver"          , "default");
   p.add("preconditioner"         , "default");
 
-  std::set<std::string> line_searches;
-  line_searches.insert("default");
-  line_searches.insert("unit");
-  line_searches.insert("more-thuente");
-  line_searches.insert("gpcg");
-  line_searches.insert("armijo");
-  line_searches.insert("owarmijo");
-  line_searches.insert("ipm");
-
+  std::set<std::string> line_searches = {"default", "unit", "more-thuente",
+                                         "gpcg", "armijo", "owarmijo", "ipm"};
   p.add("line_search", "default", line_searches);
 
   p.add(KrylovSolver::default_parameters());
@@ -93,12 +87,28 @@ Parameters PETScTAOSolver::default_parameters()
   return p;
 }
 //-----------------------------------------------------------------------------
+PETScTAOSolver::PETScTAOSolver(MPI_Comm comm) : _tao(nullptr),
+                                                _has_bounds(false)
+{
+  // Create TAO object
+  PetscErrorCode ierr = TaoCreate(comm, &_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCreate");
+
+  // Set parameter values
+  parameters = default_parameters();
+
+  // Update parameters when tao/ksp/pc_types are explictly given
+  update_parameters("default", "default", "default");
+}
+//-----------------------------------------------------------------------------
 PETScTAOSolver::PETScTAOSolver(const std::string tao_type,
                                const std::string ksp_type,
-                               const std::string pc_type) : _tao(NULL)
+                               const std::string pc_type) : _tao(NULL),
+                                                            _has_bounds(false)
 {
   // Create TAO object
-  TaoCreate(PETSC_COMM_WORLD, &_tao);
+  PetscErrorCode ierr = TaoCreate(PETSC_COMM_WORLD, &_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCreate");
 
   // Set parameter values
   parameters = default_parameters();
@@ -114,8 +124,8 @@ PETScTAOSolver::~PETScTAOSolver()
 }
 //-----------------------------------------------------------------------------
 void PETScTAOSolver::update_parameters(const std::string tao_type,
-                                  const std::string ksp_type,
-                                  const std::string pc_type)
+                                       const std::string ksp_type,
+                                       const std::string pc_type)
 {
   // Update parameters when tao/ksp/pc_types are explictly given
   if (tao_type != "default")
@@ -131,6 +141,7 @@ void PETScTAOSolver::update_parameters(const std::string tao_type,
 void PETScTAOSolver::set_tao(const std::string tao_type)
 {
   dolfin_assert(_tao);
+  PetscErrorCode ierr;
 
   // Check that the requested method is known
   if (_methods.count(tao_type) == 0)
@@ -142,8 +153,11 @@ void PETScTAOSolver::set_tao(const std::string tao_type)
 
   // In case of an unconstrained minimisation problem, set the TAO
   // method to TAONTL
-  if (!has_bounds && tao_type == "default")
-    TaoSetType(_tao, TAONTL);
+  if (!_has_bounds && tao_type == "default")
+  {
+    ierr = TaoSetType(_tao, TAONTL);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetType");
+  }
   else
   {
     // Set solver type
@@ -151,27 +165,30 @@ void PETScTAOSolver::set_tao(const std::string tao_type)
                                     const TaoType>>::const_iterator it;
     it = _methods.find(tao_type);
     dolfin_assert(it != _methods.end());
-    TaoSetType(_tao, it->second.second);
+    ierr = TaoSetType(_tao, it->second.second);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetType");
   }
 }
 //-----------------------------------------------------------------------------
-std::size_t PETScTAOSolver::solve(OptimisationProblem& optimisation_problem,
-                                  GenericVector& x,
-                                  const GenericVector& lb,
-                                  const GenericVector& ub)
+std::pair<std::size_t, bool>
+PETScTAOSolver::solve(OptimisationProblem& optimisation_problem,
+                      GenericVector& x,
+                      const GenericVector& lb,
+                      const GenericVector& ub)
 {
   // Bound-constrained minimisation problem
-  has_bounds = true;
+  _has_bounds = true;
 
   return solve(optimisation_problem, x.down_cast<PETScVector>(),
                lb.down_cast<PETScVector>(), ub.down_cast<PETScVector>());
 }
 //-----------------------------------------------------------------------------
-std::size_t PETScTAOSolver::solve(OptimisationProblem& optimisation_problem,
-                                  GenericVector& x)
+std::pair<std::size_t, bool>
+PETScTAOSolver::solve(OptimisationProblem& optimisation_problem,
+                      GenericVector& x)
 {
   // Unconstrained minimisation problem
-  has_bounds = false;
+  _has_bounds = false;
   PETScVector lb, ub;
 
   return solve(optimisation_problem, x.down_cast<PETScVector>(), lb, ub);
@@ -181,7 +198,7 @@ void PETScTAOSolver::init(OptimisationProblem& optimisation_problem,
                           PETScVector& x)
 {
   // Unconstrained minimisation problem
-  has_bounds = false;
+  _has_bounds = false;
   PETScVector lb, ub;
   init(optimisation_problem, x.down_cast<PETScVector>(), lb, ub);
 }
@@ -192,6 +209,7 @@ void PETScTAOSolver::init(OptimisationProblem& optimisation_problem,
                           const PETScVector& ub)
 {
   Timer timer("PETSc TAO solver init");
+  PetscErrorCode ierr;
 
   // Form the optimisation problem object
   _tao_ctx.optimisation_problem = &optimisation_problem;
@@ -210,22 +228,34 @@ void PETScTAOSolver::init(OptimisationProblem& optimisation_problem,
   dolfin_assert(_matH.mat());
 
   // Set initial vector
-  TaoSetInitialVector(_tao, x.vec());
+  ierr = TaoSetInitialVector(_tao, x.vec());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetInitialVector");
 
   // Set the bounds in case of a bound-constrained minimisation problem
-  if (has_bounds)
-    TaoSetVariableBounds(_tao, lb.vec(), ub.vec());
+  if (_has_bounds)
+  {
+    ierr = TaoSetVariableBounds(_tao, lb.vec(), ub.vec());
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetVariableBounds");
+  }
 
   // Set the objective function, gradient and Hessian evaluation routines
-  TaoSetObjectiveAndGradientRoutine(_tao, FormFunctionGradient, &_tao_ctx);
-  TaoSetHessianRoutine(_tao, _matH.mat(), _matH.mat(), FormHessian, &_tao_ctx);
+  ierr = TaoSetObjectiveAndGradientRoutine(_tao, FormFunctionGradient, &_tao_ctx);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetObjectiveAndGradientRoutine");
+  ierr = TaoSetHessianRoutine(_tao, _matH.mat(), _matH.mat(), FormHessian, &_tao_ctx);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetHessianRoutine");
 
   // Clear previous monitors
-  TaoCancelMonitors(_tao);
+  ierr = TaoCancelMonitors(_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCancelMonitors");
 
   // Set the monitor
   if (parameters["monitor_convergence"])
-    TaoSetMonitor(_tao, TaoDefaultMonitor, PETSC_NULL, PETSC_NULL);
+  {
+    ierr = TaoSetMonitor(_tao, TaoDefaultMonitor,
+                         PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)_tao)),
+                         NULL);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetMonitor");
+  }
 
   // Check for any TAO command line options
   std::string prefix = std::string(parameters["options_prefix"]);
@@ -236,27 +266,33 @@ void PETScTAOSolver::init(OptimisationProblem& optimisation_problem,
     char lastchar = *prefix.rbegin();
     if (lastchar != '_')
       prefix += "_";
-    TaoSetOptionsPrefix(_tao, prefix.c_str());
+    ierr = TaoSetOptionsPrefix(_tao, prefix.c_str());
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetOptionsPrefix");
   }
-  TaoSetFromOptions(_tao);
+  ierr = TaoSetFromOptions(_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetFromOptions");
 
   // Set the convergence test
-  TaoSetConvergenceTest(_tao, TaoConvergenceTest, this);
+  ierr = TaoSetConvergenceTest(_tao, TaoConvergenceTest, this);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetConvergenceTest");
 }
 //-----------------------------------------------------------------------------
-std::size_t PETScTAOSolver::solve(OptimisationProblem& optimisation_problem,
-                                  PETScVector& x,
-                                  const PETScVector& lb,
-                                  const PETScVector& ub)
+std::pair<std::size_t, bool>
+PETScTAOSolver::solve(OptimisationProblem& optimisation_problem,
+                      PETScVector& x,
+                      const PETScVector& lb,
+                      const PETScVector& ub)
 {
   Timer timer("PETSc TAO solver execution");
+  PetscErrorCode ierr;
 
   // Initialise the TAO solver
   PETScVector x_copy(x);
   init(optimisation_problem, x_copy, lb, ub);
 
   // Solve
-  TaoSolve(_tao);
+  ierr = TaoSolve(_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSolve");
 
   // Get the solution vector
   x.zero();
@@ -267,15 +303,20 @@ std::size_t PETScTAOSolver::solve(OptimisationProblem& optimisation_problem,
 
   // Print the report on convergence and methods used
   if (parameters["report"])
-    TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD);
+  {
+    ierr = TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoView");
+  }
 
   // Check for convergence
   TaoConvergedReason reason;
-  TaoGetConvergedReason(_tao, &reason);
+  ierr = TaoGetConvergedReason(_tao, &reason);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetConvergedReason");
 
   // Get the number of iterations
-  PetscInt num_iterations = 0;
-  TaoGetMaximumIterations(_tao, &num_iterations);
+  PetscInt its = 0;
+  ierr = TaoGetIterationNumber(_tao, &its);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetIterationNumber");
 
   // Report number of iterations
   if (reason >= 0)
@@ -285,11 +326,12 @@ std::size_t PETScTAOSolver::solve(OptimisationProblem& optimisation_problem,
     bool error_on_nonconvergence = parameters["error_on_nonconvergence"];
     if (error_on_nonconvergence)
     {
-      TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD);
+      ierr = TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "TaoView");
       dolfin_error("PETScTAOSolver.cpp",
                    "solve nonlinear optimisation problem",
                    "Solution failed to converge in %i iterations (TAO reason %d)",
-                   num_iterations, reason);
+                   its, reason);
     }
     else
     {
@@ -298,7 +340,7 @@ std::size_t PETScTAOSolver::solve(OptimisationProblem& optimisation_problem,
     }
   }
 
-  return num_iterations;
+  return std::make_pair(its, reason > 0);
 }
 //-----------------------------------------------------------------------------
 PetscErrorCode PETScTAOSolver::FormFunctionGradient(Tao tao, Vec x,
@@ -346,13 +388,21 @@ PetscErrorCode PETScTAOSolver::TaoConvergenceTest(Tao tao, void *ctx)
   PetscInt its;
   PetscReal f, gnorm, cnorm, xdiff;
   TaoConvergedReason reason;
-  TaoGetSolutionStatus(tao, &its, &f, &gnorm, &cnorm, &xdiff, &reason);
+  PetscErrorCode ierr;
+  ierr = TaoGetSolutionStatus(tao, &its, &f, &gnorm, &cnorm, &xdiff, &reason);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetSolutionStatus");
 
   // We enforce Tao to do at least one iteration
   if (its < 1)
-    TaoSetConvergedReason(tao, TAO_CONTINUE_ITERATING);
+  {
+    ierr = TaoSetConvergedReason(tao, TAO_CONTINUE_ITERATING);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetConvergedReason");
+  }
   else
-    TaoDefaultConvergenceTest(tao, &ctx);
+  {
+    ierr = TaoDefaultConvergenceTest(tao, &ctx);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoDefaultConvergenceTest");
+  }
 
   return 0;
 }
@@ -360,36 +410,50 @@ PetscErrorCode PETScTAOSolver::TaoConvergenceTest(Tao tao, void *ctx)
 void PETScTAOSolver::set_tao_options()
 {
   dolfin_assert(_tao);
+  PetscErrorCode ierr;
 
   // Set the TAO solver
   set_tao(parameters["method"]);
 
   // Set tolerances
-  TaoSetTolerances(_tao, parameters["function_absolute_tol"],
-                         parameters["function_relative_tol"],
-                         parameters["gradient_absolute_tol"],
-                         parameters["gradient_relative_tol"],
-                         parameters["gradient_t_tol"]);
+  #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+  ierr = TaoSetTolerances(_tao, parameters["function_absolute_tol"],
+                                parameters["function_relative_tol"],
+                                parameters["gradient_absolute_tol"],
+                                parameters["gradient_relative_tol"],
+                                parameters["gradient_t_tol"]);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetTolerances");
+  #else
+  ierr = TaoSetTolerances(_tao, parameters["gradient_absolute_tol"],
+                                parameters["gradient_relative_tol"],
+                                parameters["gradient_t_tol"]);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetTolerances");
+  #endif
 
   // Set TAO solver maximum iterations
   int maxits = parameters["maximum_iterations"];
-  TaoSetMaximumIterations(_tao, maxits);
+  ierr = TaoSetMaximumIterations(_tao, maxits);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetMaximumIterations");
 
   // Set TAO line search
   const std::string line_search_type = parameters["line_search"];
   if (line_search_type != "default")
   {
     TaoLineSearch linesearch;
-    TaoGetLineSearch(_tao, &linesearch);
-    TaoLineSearchSetType(linesearch, line_search_type.c_str());
+    ierr = TaoGetLineSearch(_tao, &linesearch);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetLineSearch");
+    ierr = TaoLineSearchSetType(linesearch, line_search_type.c_str());
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoLineSearchSetType");
   }
 }
 //-----------------------------------------------------------------------------
 void PETScTAOSolver::set_ksp_options()
 {
   dolfin_assert(_tao);
+  PetscErrorCode ierr;
   KSP ksp;
-  TaoGetKSP(_tao, &ksp);
+  ierr = TaoGetKSP(_tao, &ksp);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetKSP");
   const std::string ksp_type  = parameters["linear_solver"];
   const std::string pc_type = parameters["preconditioner"];
 
@@ -397,7 +461,8 @@ void PETScTAOSolver::set_ksp_options()
   if (ksp)
   {
     PC pc;
-    KSPGetPC(ksp, &pc);
+    ierr = KSPGetPC(ksp, &pc);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPGetPC");
 
     if (ksp_type == "default")
     {
@@ -410,14 +475,16 @@ void PETScTAOSolver::set_ksp_options()
       std::map<std::string, const KSPType>::const_iterator ksp_pair
         = PETScKrylovSolver::_methods.find(ksp_type);
       dolfin_assert(ksp_pair != PETScKrylovSolver::_methods.end());
-      KSPSetType(ksp, ksp_pair->second);
+      ierr = KSPSetType(ksp, ksp_pair->second);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType");
 
       if (pc_type != "default")
       {
         std::map<std::string, const PCType>::const_iterator pc_pair
           = PETScPreconditioner::_methods.find(pc_type);
         dolfin_assert(pc_pair != PETScPreconditioner::_methods.end());
-        PCSetType(pc, pc_pair->second);
+        ierr = PCSetType(pc, pc_pair->second);
+        if (ierr != 0) petsc_error(ierr, __FILE__, "PCSetType");
       }
     }
     else if (ksp_type == "lu" || PETScLUSolver::_methods.count(ksp_type) != 0)
@@ -444,7 +511,7 @@ void PETScTAOSolver::set_ksp_options()
           #else
           lu_method = "petsc";
           warning("Using PETSc native LU solver. Consider configuring PETSc with an efficient LU solver (e.g. UMFPACK, MUMPS).");
-#endif
+          #endif
         }
         else
         {
@@ -456,17 +523,20 @@ void PETScTAOSolver::set_ksp_options()
           lu_method = "mumps";
           #else
           dolfin_error("PETScTAOSolver.cpp",
-                     "solve linear system using PETSc LU solver",
-                     "No suitable solver for parallel LU found. Consider configuring PETSc with MUMPS or SuperLU_dist");
+                       "solve linear system using PETSc LU solver",
+                       "No suitable solver for parallel LU found. Consider configuring PETSc with MUMPS or SuperLU_dist");
           #endif
         }
       }
-      KSPSetType(ksp, KSPPREONLY);
-      PCSetType(pc, PCLU);
+      ierr = KSPSetType(ksp, KSPPREONLY);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType");
+      ierr = PCSetType(pc, PCLU);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "PCSetType");
       std::map<std::string, const MatSolverPackage>::const_iterator lu_pair
         = PETScLUSolver::_methods.find(lu_method);
       dolfin_assert(lu_pair != PETScLUSolver::_methods.end());
-      PCFactorSetMatSolverPackage(pc, lu_pair->second);
+      ierr = PCFactorSetMatSolverPackage(pc, lu_pair->second);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "PCFactorSetMatSolverPackage");
     }
     else     // Unknown KSP method
     {
@@ -478,30 +548,52 @@ void PETScTAOSolver::set_ksp_options()
     // In any case, set the KSP options specified by the user
     Parameters krylov_parameters = parameters("krylov_solver");
 
-    // GMRES restart parameter
-    const int gmres_restart = krylov_parameters("gmres")["restart"];
-    KSPGMRESSetRestart(ksp, gmres_restart);
-
     // Non-zero initial guess
-    const bool nonzero_guess = krylov_parameters["nonzero_initial_guess"];
+    bool nonzero_guess = false;
+    if (krylov_parameters["nonzero_initial_guess"].is_set())
+      nonzero_guess = krylov_parameters["nonzero_initial_guess"];
     if (nonzero_guess)
-      KSPSetInitialGuessNonzero(ksp, PETSC_TRUE);
+    {
+      ierr = KSPSetInitialGuessNonzero(ksp, PETSC_TRUE);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetInitialGuessNonzero");
+    }
     else
-      KSPSetInitialGuessNonzero(ksp, PETSC_FALSE);
+    {
+      ierr = KSPSetInitialGuessNonzero(ksp, PETSC_FALSE);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetInitialGuessNonzero");
+    }
 
     // KSP monitor
-    if (krylov_parameters["monitor_convergence"])
-      KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, 0, 0);
-
-    // Get integer tolerances (to take care of casting to PetscInt)
-    const int max_iter = krylov_parameters["maximum_iterations"];
+    if (krylov_parameters["monitor_convergence"].is_set())
+    {
+      if (krylov_parameters["monitor_convergence"])
+      {
+        #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+        ierr = TaoSetMonitor(_tao, TaoDefaultMonitor,
+                             PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)_tao)),
+                             NULL);
+        if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetMonitor");
+        #else
+        PetscViewer viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ksp));
+        PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
+        PetscViewerAndFormat *vf;
+        ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
+        ierr = KSPMonitorSet(ksp,
+                         (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
+                         vf,
+                         (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
+        #endif
+      }
+    }
 
     // Set tolerances
-    KSPSetTolerances(ksp,
-                     krylov_parameters["relative_tolerance"],
-                     krylov_parameters["absolute_tolerance"],
-                     krylov_parameters["divergence_limit"],
-                     max_iter);
+    const double rtol = krylov_parameters["relative_tolerance"].is_set() ? (double)krylov_parameters["relative_tolerance"] : PETSC_DEFAULT;
+    const double atol = krylov_parameters["absolute_tolerance"].is_set() ? (double)krylov_parameters["absolute_tolerance"] : PETSC_DEFAULT;
+    const double dtol = krylov_parameters["divergence_limit"].is_set() ? (double)krylov_parameters["divergence_limit"] : PETSC_DEFAULT;
+    const int max_it  = krylov_parameters["maximum_iterations"].is_set() ? (int)krylov_parameters["maximum_iterations"] : PETSC_DEFAULT;
+    ierr = KSPSetTolerances(ksp, rtol, atol, dtol, max_it);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetTolerances");
   }
   else
   {
diff --git a/dolfin/nls/PETScTAOSolver.h b/dolfin/nls/PETScTAOSolver.h
index 4a4b528..2dcfbdd 100644
--- a/dolfin/nls/PETScTAOSolver.h
+++ b/dolfin/nls/PETScTAOSolver.h
@@ -21,7 +21,7 @@
 #ifndef __PETSC_TAO_SOLVER_H
 #define __PETSC_TAO_SOLVER_H
 
-#ifdef ENABLE_PETSC_TAO
+#ifdef HAS_PETSC
 
 #include <map>
 #include <petsctao.h>
@@ -48,6 +48,9 @@ namespace dolfin
   {
   public:
 
+    /// Create TAO solver
+    explicit PETScTAOSolver(MPI_Comm comm);
+
     /// Create TAO solver for a particular method
     PETScTAOSolver(const std::string tao_type="default",
                    const std::string ksp_type="default",
@@ -69,12 +72,13 @@ namespace dolfin
     ///         The upper bound.
     ///
     /// *Returns*
-    ///     num_iterations (std::size_t)
-    ///         Number of iterations
-    std::size_t solve(OptimisationProblem& optimisation_problem,
-                      GenericVector& x,
-                      const GenericVector& lb,
-                      const GenericVector& ub);
+    ///     (its, converged) (std::pair<std::size_t, bool>)
+    ///         Pair of number of iterations, and whether
+    ///         iteration converged
+    std::pair<std::size_t, bool> solve(OptimisationProblem& optimisation_problem,
+                                       GenericVector& x,
+                                       const GenericVector& lb,
+                                       const GenericVector& ub);
 
     /// Solve a nonlinear unconstrained minimisation problem
     ///
@@ -85,13 +89,14 @@ namespace dolfin
     ///         The solution vector (initial guess).
     ///
     /// *Returns*
-    ///     num_iterations (std::size_t)
-    ///         Number of iterations
-    std::size_t solve(OptimisationProblem& optimisation_problem,
-                      GenericVector& x);
+    ///     (its, converged) (std::pair<std::size_t, bool>)
+    ///         Pair of number of iterations, and whether
+    ///         iteration converged
+    std::pair<std::size_t, bool> solve(OptimisationProblem& optimisation_problem,
+                                       GenericVector& x);
 
     /// Return a list of available solver methods
-    static std::vector<std::pair<std::string, std::string> > methods();
+    static std::vector<std::pair<std::string, std::string>> methods();
 
     /// Default parameter values
     static Parameters default_parameters();
@@ -129,11 +134,12 @@ namespace dolfin
     ///         The upper bound.
     ///
     /// *Returns*
-    ///     num_iterations (std::size_t)
-    ///         Number of iterations
-    std::size_t solve(OptimisationProblem& optimisation_problem,
-                      PETScVector& x, const PETScVector& lb,
-                      const PETScVector& ub);
+    ///     (its, converged) (std::pair<std::size_t, bool>)
+    ///         Pair of number of iterations, and whether
+    ///         iteration converged
+    std::pair<std::size_t, bool> solve(OptimisationProblem& optimisation_problem,
+                                       PETScVector& x, const PETScVector& lb,
+                                       const PETScVector& ub);
 
     // TAO context for optimisation problems
     struct tao_ctx_t
@@ -159,14 +165,14 @@ namespace dolfin
     void set_tao(const std::string tao_type="default");
 
     // Flag to indicate if the bounds are set
-    bool has_bounds;
+    bool _has_bounds;
 
     // Hessian matrix
     PETScMatrix _matH;
 
     // Available solvers
     static const std::map<std::string,
-                          std::pair<std::string, const TaoType> > _methods;
+      std::pair<std::string, const TaoType>> _methods;
 
     // Compute the nonlinear objective function :math:`f(x)` as well
     // as its gradient :math:`F(x) = f'(x)`
diff --git a/dolfin/nls/TAOLinearBoundSolver.cpp b/dolfin/nls/TAOLinearBoundSolver.cpp
index df813f7..69f0c7b 100644
--- a/dolfin/nls/TAOLinearBoundSolver.cpp
+++ b/dolfin/nls/TAOLinearBoundSolver.cpp
@@ -15,9 +15,10 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 
-#ifdef ENABLE_PETSC_TAO
+#ifdef HAS_PETSC
 
 #include <petsclog.h>
+#include <petscversion.h>
 
 #include <dolfin/common/Timer.h>
 #include <dolfin/common/MPI.h>
@@ -51,43 +52,55 @@ const std::map<std::string, const KSPType> TAOLinearBoundSolver::_ksp_methods
     {"bicgstab",   KSPBCGS} };
 //-----------------------------------------------------------------------------
 // Mapping from method string to description
-const std::map<std::string, std::string>
-  TAOLinearBoundSolver::_methods_descr
+const std::map<std::string, std::string> TAOLinearBoundSolver::_methods_descr
 = { {"default"  ,  "Default Tao method (tao_tron)"},
     {"tron" ,  "Newton Trust Region method"},
     {"bqpip",  "Interior Point Newton Algorithm"},
     {"gpcg" ,  "Gradient Projection Conjugate Gradient"},
     {"blmvm",  "Limited memory variable metric method"} };
 //-----------------------------------------------------------------------------
-std::map<std::string, std::string>
-TAOLinearBoundSolver::methods()
+std::map<std::string, std::string> TAOLinearBoundSolver::methods()
 {
   return TAOLinearBoundSolver::_methods_descr;
 }
 //-----------------------------------------------------------------------------
-std::map<std::string, std::string>
-TAOLinearBoundSolver::krylov_solvers()
+std::map<std::string, std::string> TAOLinearBoundSolver::krylov_solvers()
 {
   return PETScKrylovSolver::methods();
 }
 //-----------------------------------------------------------------------------
-std::map<std::string, std::string>
-TAOLinearBoundSolver::preconditioners()
+std::map<std::string, std::string> TAOLinearBoundSolver::preconditioners()
 {
   return PETScPreconditioner::preconditioners();
 }
 //-----------------------------------------------------------------------------
+TAOLinearBoundSolver::TAOLinearBoundSolver(MPI_Comm comm)
+  : _tao(nullptr), _preconditioner_set(false)
+{
+  PetscErrorCode ierr;
+
+  // Create TAO object
+  ierr = TaoCreate(PETSC_COMM_WORLD, &_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCreate");
+}
+//-----------------------------------------------------------------------------
 TAOLinearBoundSolver::TAOLinearBoundSolver(const std::string method,
                                            const std::string ksp_type,
                                            const std::string pc_type)
-  : _tao(NULL), preconditioner(new PETScPreconditioner(pc_type)),
-    preconditioner_set(false)
+  : _tao(NULL), _preconditioner(new PETScPreconditioner(pc_type)),
+    _preconditioner_set(false)
 {
   // Set parameter values
   parameters = default_parameters();
 
-  //Initialize the Tao solver
-  init(method);
+  PetscErrorCode ierr;
+
+  // Create TAO object
+  ierr = TaoCreate(PETSC_COMM_WORLD, &_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCreate");
+
+  // Set tao solver
+  set_solver(method);
 
   //Set the PETSC KSP used by TAO
   set_ksp(ksp_type);
@@ -97,9 +110,8 @@ TAOLinearBoundSolver::TAOLinearBoundSolver(const std::string method,
       or (method != "default"))
   {
     log(WARNING, "Some preconditioners may be not be applicable to "\
-	"TAO solvers and generate errors.");
+    "TAO solvers and generate errors.");
   }
-
 }
 //-----------------------------------------------------------------------------
 TAOLinearBoundSolver::~TAOLinearBoundSolver()
@@ -121,127 +133,136 @@ TAOLinearBoundSolver::set_operators(std::shared_ptr<const GenericMatrix> A,
 //-----------------------------------------------------------------------------
 void
 TAOLinearBoundSolver::set_operators(std::shared_ptr<const PETScMatrix> A,
-				    std::shared_ptr<const PETScVector> b)
+                                    std::shared_ptr<const PETScVector> b)
 {
-  this->A = A;
-  this->b = b;
-  dolfin_assert(this->A);
-  dolfin_assert(this->b);
+  this->_matA = A;
+  this->_b = b;
 }
 //-----------------------------------------------------------------------------
 std::size_t TAOLinearBoundSolver::solve(const GenericMatrix& A1,
                                         GenericVector& x,
-					const GenericVector& b1,
+                                        const GenericVector& b1,
                                         const GenericVector& xl,
-					const GenericVector& xu)
+                                        const GenericVector& xu)
 {
   return solve(A1.down_cast<PETScMatrix>(),
-	       x.down_cast<PETScVector>(),
-	       b1.down_cast<PETScVector>(),
-	       xl.down_cast<PETScVector>(),
-	       xu.down_cast<PETScVector>());
+               x.down_cast<PETScVector>(),
+               b1.down_cast<PETScVector>(),
+               xl.down_cast<PETScVector>(),
+               xu.down_cast<PETScVector>());
 }
 //-----------------------------------------------------------------------------
 std::size_t TAOLinearBoundSolver::solve(const PETScMatrix& A1,
                                         PETScVector& x,
-					const PETScVector& b1,
+                                        const PETScVector& b1,
                                         const PETScVector& xl,
-					const PETScVector& xu)
+                                        const PETScVector& xu)
 {
+  PetscErrorCode ierr;
 
   // Check symmetry
   dolfin_assert(A1.size(0) == A1.size(1));
 
   // Set operators (A and b)
-  std::shared_ptr<const PETScMatrix> _matA(&A1, NoDeleter());
-  std::shared_ptr<const PETScVector> _b(&b1, NoDeleter());
-  set_operators(_matA,_b);
+  std::shared_ptr<const PETScMatrix> A(&A1, NoDeleter());
+  std::shared_ptr<const PETScVector> b(&b1, NoDeleter());
+  set_operators(A, b);
   dolfin_assert(A->mat());
   //dolfin_assert(b->vec());
 
   // Set initial vector
   dolfin_assert(_tao);
-  TaoSetInitialVector(_tao, x.vec());
+  ierr = TaoSetInitialVector(_tao, x.vec());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetInitialVector");
 
   // Set the bound on the variables
-  TaoSetVariableBounds(_tao, xl.vec(), xu.vec());
+  ierr = TaoSetVariableBounds(_tao, xl.vec(), xu.vec());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetVariableBounds");
 
   // Set the user function, gradient, hessian evaluation routines and
   // data structures
-  TaoSetObjectiveAndGradientRoutine(_tao,
-                                    __TAOFormFunctionGradientQuadraticProblem,
-                                    this);
-  TaoSetHessianRoutine(_tao, A->mat(), A->mat(),
-                       __TAOFormHessianQuadraticProblem, this);
+  ierr = TaoSetObjectiveAndGradientRoutine(_tao,
+           __TAOFormFunctionGradientQuadraticProblem, this);
+  if (ierr != 0) petsc_error(ierr, __FILE__,
+                             "TaoSetObjectiveAndGradientRoutine");
+  ierr = TaoSetHessianRoutine(_tao, A->mat(), A->mat(),
+                              __TAOFormHessianQuadraticProblem, this);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetHessianRoutine");
 
   // Set parameters from local parameters, including ksp parameters
   read_parameters();
 
   // Clear previous monitors
-  TaoCancelMonitors(_tao);
+  ierr = TaoCancelMonitors(_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCancelMonitors");
 
   // Set the monitor
-  if (parameters["monitor_convergence"])
-    TaoSetMonitor(_tao, __TAOMonitor, this, PETSC_NULL);
-
-
-  // Check for any tao command line options
-  std::string prefix = std::string(parameters["options_prefix"]);
-  if (prefix != "default")
+  if (parameters["monitor_convergence"].is_set())
   {
-    // Make sure that the prefix has a '_' at the end if the user
-    // didn't provide it
-    char lastchar = *prefix.rbegin();
-    if (lastchar != '_')
-      prefix += "_";
-
-    TaoSetOptionsPrefix(_tao, prefix.c_str());
+    if (parameters["monitor_convergence"])
+    {
+      ierr = TaoSetMonitor(_tao, __TAOMonitor, this, NULL);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetMonitor");
+    }
   }
-  TaoSetFromOptions(_tao);
 
   // Solve the bound constrained problem
   Timer timer("TAO solver");
   const char* tao_type;
-  TaoGetType(_tao, &tao_type);
+  ierr = TaoGetType(_tao, &tao_type);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetType");
   log(PROGRESS, "Tao solver %s starting to solve %i x %i system", tao_type,
       A->size(0), A->size(1));
 
   // Solve
-  TaoSolve(_tao);
+  ierr = TaoSolve(_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSolve");
 
   // Update ghost values
   x.update_ghost_values();
 
   // Print the report on convergences and methods used
-  if (parameters["report"])
-    TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD);
+  if (parameters["report"].is_set())
+  {
+    if (parameters["report"])
+    {
+      ierr = TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "TaoView");
+    }
+  }
 
   // Check for convergence
   TaoConvergedReason reason;
-  TaoGetConvergedReason(_tao, &reason);
+  ierr = TaoGetConvergedReason(_tao, &reason);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetConvergedReason");
 
   // Get the number of iterations
   PetscInt num_iterations = 0;
-  TaoGetMaximumIterations(_tao, &num_iterations);
+  ierr = TaoGetMaximumIterations(_tao, &num_iterations);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetMaximumIterations");
 
   // Report number of iterations
   if (reason >= 0)
     log(PROGRESS, "Tao solver converged\n");
   else
   {
-    bool error_on_nonconvergence = parameters["error_on_nonconvergence"];
-    if (error_on_nonconvergence)
-    {
-      TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD);
-      dolfin_error("TAOLinearBoundSolver.cpp",
-                   "solve linear system using Tao solver",
-                   "Solution failed to converge in %i iterations (TAO reason %d)",
-                   num_iterations, reason);
-    }
-    else
+    if (parameters["error_on_nonconvergence"].is_set())
     {
-      log(WARNING,  "Tao solver %s failed to converge. Try a different TAO method," \
-	  " adjust some parameters", tao_type);
+      bool error_on_nonconvergence = parameters["error_on_nonconvergence"];
+      if (error_on_nonconvergence)
+      {
+        ierr = TaoView(_tao, PETSC_VIEWER_STDOUT_WORLD);
+        if (ierr != 0) petsc_error(ierr, __FILE__, "TaoView");
+        dolfin_error("TAOLinearBoundSolver.cpp",
+                     "solve linear system using Tao solver",
+                     "Solution failed to converge in %i iterations (TAO reason %d)",
+                     num_iterations, reason);
+      }
+      else
+      {
+        log(WARNING,  "Tao solver %s failed to converge. Try a different TAO method," \
+            " adjust some parameters", tao_type);
+      }
     }
   }
 
@@ -251,44 +272,53 @@ std::size_t TAOLinearBoundSolver::solve(const PETScMatrix& A1,
 void TAOLinearBoundSolver::set_solver(const std::string& method)
 {
   dolfin_assert(_tao);
+  PetscErrorCode ierr;
 
   // Do nothing if default type is specified
   if (method == "default")
-    TaoSetType(_tao, "tron");
+    ierr = TaoSetType(_tao, "tron");
   else
   {
     // Choose solver
     if (method == "tron")
-      TaoSetType(_tao, "tron");
+      ierr = TaoSetType(_tao, "tron");
     else if (method == "blmvm")
-      TaoSetType(_tao, "blmvm" );
+      ierr = TaoSetType(_tao, "blmvm" );
     else if (method == "gpcg")
-      TaoSetType(_tao, "gpcg" );
+      ierr = TaoSetType(_tao, "gpcg" );
     else if (method == "bqpip")
-      TaoSetType(_tao, "bqpip");
+      ierr = TaoSetType(_tao, "bqpip");
     else
     {
       dolfin_error("TAOLinearBoundSolver.cpp",
-		   "set solver for TAO solver",
+                   "set solver for TAO solver",
                    "Unknown solver type (\"%s\")", method.c_str());
+      ierr = 0; // Make compiler happy about uninitialized variable
     }
   }
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetType");
 }
 //-----------------------------------------------------------------------------
 void TAOLinearBoundSolver::set_ksp(std::string ksp_type)
 {
+  PetscErrorCode ierr;
+
   // Set ksp type
   if (ksp_type != "default")
   {
     dolfin_assert(_tao);
     KSP ksp;
-    TaoGetKSP(_tao, &ksp);
+    ierr = TaoGetKSP(_tao, &ksp);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetKSP");
     if (ksp)
-      KSPSetType(ksp, _ksp_methods.find(ksp_type)->second);
+    {
+      ierr = KSPSetType(ksp, _ksp_methods.find(ksp_type)->second);
+      if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetType");
+    }
     else
     {
       log(WARNING, "The selected tao solver does not allow to set a specific "\
-	  "Krylov solver. Option %s is ignored", ksp_type.c_str());
+      "Krylov solver. Option %s is ignored", ksp_type.c_str());
     }
   }
 }
@@ -300,28 +330,41 @@ Tao TAOLinearBoundSolver::tao() const
 //-----------------------------------------------------------------------------
 std::shared_ptr<const PETScMatrix> TAOLinearBoundSolver::get_matrix() const
 {
-  return A;
+  return _matA;
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<const PETScVector> TAOLinearBoundSolver::get_vector() const
 {
-  return b;
+  return _b;
 }
 //-----------------------------------------------------------------------------
 void TAOLinearBoundSolver::read_parameters()
 {
   dolfin_assert(_tao);
+  PetscErrorCode ierr;
 
   // Set tolerances
-  TaoSetTolerances(_tao, parameters["function_absolute_tol"],
-		   parameters["function_relative_tol"],
-		   parameters["gradient_absolute_tol"],
-		   parameters["gradient_relative_tol"],
-		   parameters["gradient_t_tol"]);
+  #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+  ierr = TaoSetTolerances(_tao, parameters["function_absolute_tol"],
+                                parameters["function_relative_tol"],
+                                parameters["gradient_absolute_tol"],
+                                parameters["gradient_relative_tol"],
+                                parameters["gradient_t_tol"]);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetTolerances");
+  #else
+  ierr = TaoSetTolerances(_tao, parameters["gradient_absolute_tol"],
+                                parameters["gradient_relative_tol"],
+                                parameters["gradient_t_tol"]);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetTolerances");
+  #endif
 
   // Set TAO solver maximum iterations
-  int maxits = parameters["maximum_iterations"];
-  TaoSetMaximumIterations(_tao, maxits);
+  if (parameters["maximum_iterations"].is_set())
+  {
+    int maxits = parameters["maximum_iterations"];
+    ierr = TaoSetMaximumIterations(_tao, maxits);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetMaximumIterations");
+  }
 
   // Set ksp_options
   set_ksp_options();
@@ -329,12 +372,18 @@ void TAOLinearBoundSolver::read_parameters()
 //-----------------------------------------------------------------------------
 void TAOLinearBoundSolver::init(const std::string& method)
 {
+  PetscErrorCode ierr;
+
   // Check that nobody else shares this solver
   if (_tao)
-    TaoDestroy(&_tao);
+  {
+    ierr = TaoDestroy(&_tao);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "TaoDestroy");
+  }
 
   // Set up solver environment
-  TaoCreate(PETSC_COMM_WORLD, &_tao);
+  ierr = TaoCreate(PETSC_COMM_WORLD, &_tao);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCreate");
 
   // Set tao solver
   set_solver(method);
@@ -343,40 +392,60 @@ void TAOLinearBoundSolver::init(const std::string& method)
 void TAOLinearBoundSolver::set_ksp_options()
 {
   dolfin_assert(_tao);
+  PetscErrorCode ierr;
+
   KSP ksp;
-  TaoGetKSP(_tao, &ksp);
+  ierr = TaoGetKSP(_tao, &ksp);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetKSP");
+
   if (ksp)
   {
     Parameters krylov_parameters = parameters("krylov_solver");
 
-    // GMRES restart parameter
-    const int gmres_restart = krylov_parameters("gmres")["restart"];
-    KSPGMRESSetRestart(ksp, gmres_restart);
-
     // Non-zero initial guess
-    const bool nonzero_guess = krylov_parameters["nonzero_initial_guess"];
+    bool nonzero_guess = false;
+    if (krylov_parameters["nonzero_initial_guess"].is_set())
+      nonzero_guess = krylov_parameters["nonzero_initial_guess"];
+
     if (nonzero_guess)
-      KSPSetInitialGuessNonzero(ksp, PETSC_TRUE);
+      ierr = KSPSetInitialGuessNonzero(ksp, PETSC_TRUE);
     else
-      KSPSetInitialGuessNonzero(ksp, PETSC_FALSE);
+      ierr = KSPSetInitialGuessNonzero(ksp, PETSC_FALSE);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetInitialGuessNonzero");
 
-    if (krylov_parameters["monitor_convergence"])
-      KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, 0, 0);
+    if (krylov_parameters["monitor_convergence"].is_set())
+    {
+      if (krylov_parameters["monitor_convergence"])
+      {
+        #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 6 && PETSC_VERSION_RELEASE == 1
+        ierr = TaoSetMonitor(_tao, __TAOMonitor, this, NULL);
+        if (ierr != 0) petsc_error(ierr, __FILE__, "TaoSetMonitor");
+        #else
+        PetscViewer viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ksp));
+        PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
+        PetscViewerAndFormat *vf;
+        ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
+        ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
+                             vf,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
+        #endif
+      }
+    }
 
     // Set tolerances
-    const int max_ksp_it = krylov_parameters["maximum_iterations"];
-    KSPSetTolerances(ksp,
-                     krylov_parameters["relative_tolerance"],
-		     krylov_parameters["absolute_tolerance"],
-		     krylov_parameters["divergence_limit"],
-		     max_ksp_it);
+    const double rtol = krylov_parameters["relative_tolerance"].is_set() ? (double)krylov_parameters["relative_tolerance"] : PETSC_DEFAULT;
+    const double atol = krylov_parameters["absolute_tolerance"].is_set() ? (double)krylov_parameters["absolute_tolerance"] : PETSC_DEFAULT;
+    const double dtol = krylov_parameters["divergence_limit"].is_set() ? (double)krylov_parameters["divergence_limit"] : PETSC_DEFAULT;
+    const int max_ksp_it  = krylov_parameters["maximum_iterations"].is_set() ? (int)krylov_parameters["maximum_iterations"] : PETSC_DEFAULT;
+    ierr = KSPSetTolerances(ksp, rtol, atol, dtol, max_ksp_it);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "KSPSetTolerances");
 
     // Set preconditioner
-    if (preconditioner && !preconditioner_set)
+    if (_preconditioner && !_preconditioner_set)
     {
       PETScKrylovSolver dolfin_ksp(ksp);
-      preconditioner->set(dolfin_ksp);
-      preconditioner_set = true;
+      _preconditioner->set(dolfin_ksp);
+      _preconditioner_set = true;
     }
   }
 }
@@ -388,29 +457,37 @@ TAOLinearBoundSolver::__TAOFormFunctionGradientQuadraticProblem(Tao tao,
                                                                 Vec G,
                                                                 void *ptr)
 {
-   PetscReal AXX, bX;
-   const TAOLinearBoundSolver* solver = static_cast<TAOLinearBoundSolver*>(ptr);
-   const PETScMatrix* A = solver->get_matrix().get();
-   const PETScVector* b = solver->get_vector().get();
+  PetscErrorCode ierr;
+  PetscReal AXX, bX;
+
+  dolfin_assert(ptr);
+  const TAOLinearBoundSolver* solver = static_cast<TAOLinearBoundSolver*>(ptr);
+  const PETScMatrix* A = solver->get_matrix().get();
+  const PETScVector* b = solver->get_vector().get();
+  dolfin_assert(A);
+  dolfin_assert(b);
 
-   dolfin_assert(A);
-   dolfin_assert(b);
+  // Calculate AX=A*X and store in G
+  ierr = MatMult(A->mat(), X, G);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "MatMult");
 
-   // Calculate AX=A*X and store in G
-   MatMult(A->mat(), X, G);
+  // Calculate AXX=A*X*X
+  ierr = VecDot(G, X, &AXX);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "VecDot");
 
-   // Calculate AXX=A*X*X
-   VecDot(G, X, &AXX);
+  // Calculate bX=b*X
+  ierr = VecDot(b->vec(), X, &bX);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "VecDot");
 
-   // Calculate bX=b*X
-   VecDot(b->vec(), X, &bX);
+  // Calculate the functional value ener=1/2*A*X*X-b*X
+  dolfin_assert(ener);
+  *ener = 0.5*AXX-bX;
 
-   // Calculate the functional value ener=1/2*A*X*X-b*X
-   *ener = 0.5*AXX-bX;
+  // Calculate the gradient vector G=A*X-b
+  ierr = VecAXPBY(G, -1.0, 1.0, b->vec());
+  if (ierr != 0) petsc_error(ierr, __FILE__, "VecAXPBY");
 
-   // Calculate the gradient vector G=A*X-b
-   VecAXPBY(G, -1.0, 1.0, b->vec());
-   return 0;
+  return 0;
 }
 //-----------------------------------------------------------------------------
 PetscErrorCode
@@ -419,26 +496,33 @@ TAOLinearBoundSolver::__TAOFormHessianQuadraticProblem(Tao tao,
                                                        Mat Hpre,
                                                        void *ptr)
 {
-   const TAOLinearBoundSolver* solver = static_cast<TAOLinearBoundSolver*>(ptr);
-   const PETScMatrix* A = solver->get_matrix().get();
+  dolfin_assert(ptr);
+  const TAOLinearBoundSolver* solver = static_cast<TAOLinearBoundSolver*>(ptr);
+  const PETScMatrix* A = solver->get_matrix().get();
+  dolfin_assert(A);
 
-   dolfin_assert(A);
+  // Set the hessian to the matrix A (quadratic problem)
+  Mat Atmp = A->mat();
+  H = Atmp;
 
-   // Set the hessian to the matrix A (quadratic problem)
-   Mat Atmp = A->mat();
-   H = Atmp;
-   return 0;
+  return 0;
 }
 //------------------------------------------------------------------------------
 PetscErrorCode TAOLinearBoundSolver::__TAOMonitor(Tao tao, void *ctx)
 {
   dolfin_assert(tao);
+  PetscErrorCode ierr;
   PetscInt its;
   PetscReal f, gnorm, cnorm, xdiff;
   TaoConvergedReason reason;
-  TaoGetSolutionStatus(tao, &its, &f, &gnorm, &cnorm, &xdiff, &reason);
+
+  ierr = TaoGetSolutionStatus(tao, &its, &f, &gnorm, &cnorm, &xdiff, &reason);
+  if (ierr != 0) petsc_error(ierr, __FILE__, "TaoGetSolutionStatus");
   if (!(its % 5))
-    PetscPrintf(PETSC_COMM_WORLD,"iteration=%D\tf=%g\n", its, (double)f);
+  {
+    ierr = PetscPrintf(PETSC_COMM_WORLD,"iteration=%D\tf=%g\n", its, (double)f);
+    if (ierr != 0) petsc_error(ierr, __FILE__, "PetscPrintf");
+  }
 
   return 0;
 }
diff --git a/dolfin/nls/TAOLinearBoundSolver.h b/dolfin/nls/TAOLinearBoundSolver.h
index 0a82146..de12929 100644
--- a/dolfin/nls/TAOLinearBoundSolver.h
+++ b/dolfin/nls/TAOLinearBoundSolver.h
@@ -18,7 +18,7 @@
 #ifndef _TAOLinearBoundSolver_H
 #define _TAOLinearBoundSolver_H
 
-#ifdef ENABLE_PETSC_TAO
+#ifdef HAS_PETSC
 
 #include <map>
 #include <memory>
@@ -79,6 +79,9 @@ namespace dolfin
   public:
 
     /// Create TAO bound constrained solver
+    explicit TAOLinearBoundSolver(MPI_Comm comm);
+
+    /// Create TAO bound constrained solver
     TAOLinearBoundSolver(const std::string method = "default",
                          const std::string ksp_type = "default",
                          const std::string pc_type = "default");
@@ -89,20 +92,20 @@ namespace dolfin
     /// Solve the linear variational inequality defined by A and b
     /// with xl =< x <= xu
     std::size_t solve(const GenericMatrix& A, GenericVector& x,
-		      const GenericVector& b, const GenericVector& xl,
-		      const GenericVector& xu);
+                      const GenericVector& b, const GenericVector& xl,
+                      const GenericVector& xu);
 
     /// Solve the linear variational inequality defined by A and b
     /// with xl =< x <= xu
     std::size_t solve(const PETScMatrix& A, PETScVector& x,
                       const PETScVector& b,
-		      const PETScVector& xl, const PETScVector& xu);
+                      const PETScVector& xl, const PETScVector& xu);
 
     // Set the TAO solver type
     void set_solver(const std::string&);
 
     /// Set PETSC Krylov Solver (ksp) used by TAO
-    void set_ksp( const std::string ksp_type = "default");
+    void set_ksp(const std::string ksp_type = "default");
 
     // Return TAO solver pointer
     Tao tao() const;
@@ -149,11 +152,11 @@ namespace dolfin
 
     // Set operators with GenericMatrix and GenericVector
     void set_operators(std::shared_ptr<const GenericMatrix> A,
-		       std::shared_ptr<const GenericVector> b);
+                       std::shared_ptr<const GenericVector> b);
 
     // Set operators with shared pointer to PETSc objects
     void set_operators(std::shared_ptr<const PETScMatrix> A,
-		       std::shared_ptr<const PETScVector> b);
+                       std::shared_ptr<const PETScVector> b);
 
     // Callback for changes in parameter values
     void read_parameters();
@@ -162,8 +165,7 @@ namespace dolfin
     static const std::map<std::string, const KSPType> _ksp_methods;
 
     // Available tao solvers descriptions
-    static const std::map<std::string, std::string>
-      _methods_descr;
+    static const std::map<std::string, std::string> _methods_descr;
 
     // Set options
     void set_ksp_options();
@@ -175,13 +177,13 @@ namespace dolfin
     Tao _tao;
 
     // Petsc preconditioner
-    std::shared_ptr<PETScPreconditioner> preconditioner;
+    std::shared_ptr<PETScPreconditioner> _preconditioner;
 
     // Operator (the matrix) and the vector
-    std::shared_ptr<const PETScMatrix> A;
-    std::shared_ptr<const PETScVector> b;
+    std::shared_ptr<const PETScMatrix> _matA;
+    std::shared_ptr<const PETScVector> _b;
 
-    bool preconditioner_set;
+    bool _preconditioner_set;
 
     // Computes the value of the objective function and its gradient.
     static PetscErrorCode
@@ -198,9 +200,9 @@ namespace dolfin
     //  Monitor the state of the solution at each iteration. The
     //  output printed to the screen is:
     //
-    //	iterate - the current iterate number (>=0)
-    //	f       - the current function value
-    //	gnorm 	- the square of the gradient norm, duality gap, or other
+    //  iterate - the current iterate number (>=0)
+    //  f       - the current function value
+    //  gnorm   - the square of the gradient norm, duality gap, or other
     //             measure
     //            indicating distance from optimality.
     //  cnorm - the infeasibility of the current solution with regard
diff --git a/dolfin/parameter/GlobalParameters.h b/dolfin/parameter/GlobalParameters.h
index 1121ea1..10af91c 100644
--- a/dolfin/parameter/GlobalParameters.h
+++ b/dolfin/parameter/GlobalParameters.h
@@ -110,10 +110,10 @@ namespace dolfin
         #endif
       #endif
       p.add("mesh_partitioner", default_mesh_partitioner,
-            {"ParMETIS", "SCOTCH", "Zoltan_RCB", "Zoltan_PHG", "None"});
+            {"ParMETIS", "SCOTCH", "None"});
 
       // Approaches to partitioning (following Zoltan syntax)
-      // but applies to both Zoltan PHG and ParMETIS
+      // but applies to ParMETIS
       p.add("partitioning_approach", "PARTITION",
             {"PARTITION", "REPARTITION", "REFINE"});
 
@@ -123,14 +123,8 @@ namespace dolfin
       p.add("ParMETIS_repartitioning_weight", 1000.0);
       #endif
 
-      #ifdef HAS_TRILINOS
-      // Zoltan PHG partitioner parameters
-      p.add("Zoltan_PHG_REPART_MULTIPLIER", 1.0);
-      #endif
-
       // Mesh refinement
-      p.add("refinement_algorithm",
-            "plaza",
+      p.add("refinement_algorithm", "plaza",
             {"regular_cut", "plaza", "plaza_with_parent_facets"});
 
       //-- Graphs
@@ -147,15 +141,12 @@ namespace dolfin
 
       // Linear algebra backend
       std::string default_backend = "Eigen";
-      std::set<std::string> allowed_backends = {"STL", "Eigen"};
+      std::set<std::string> allowed_backends = {"Eigen"};
       #ifdef HAS_PETSC
       allowed_backends.insert("PETSc");
       default_backend = "PETSc";
       p.add("use_petsc_signal_handler", false);
       #endif
-      #ifdef HAS_PETSC_CUSP
-      allowed_backends.insert("PETScCusp");
-      #endif
       #ifdef HAS_TRILINOS
       allowed_backends.insert("Tpetra");
         #ifndef HAS_PETSC
diff --git a/dolfin/parameter/Parameters.cpp b/dolfin/parameter/Parameters.cpp
index 82840e4..a306325 100644
--- a/dolfin/parameter/Parameters.cpp
+++ b/dolfin/parameter/Parameters.cpp
@@ -277,7 +277,8 @@ void Parameters::update(const Parameters& parameters)
     const Parameter& other = *it->second;
     Parameter* self = find_parameter(other.key());
 
-    // Skip parameters not in this parameter set (no new parameters added)
+    // Skip parameters not in this parameter set (no new parameters
+    // added)
     if (!self)
     {
       warning("Ignoring unknown parameter \"%s\" in parameter set \"%s\" when updating parameter set \"%s\".",
@@ -288,8 +289,9 @@ void Parameters::update(const Parameters& parameters)
     // Skip unset parameters
     if (!other.is_set())
     {
-      warning("Ignoring unset parameter \"%s\" in parameter set \"%s\" when updating parameter set \"%s\".",
-              other.key().c_str(), parameters.name().c_str(), name().c_str());
+      //warning("Ignoring unset parameter \"%s\" in parameter set \"%s\" when updating parameter set \"%s\".",
+      //        other.key().c_str(), parameters.name().c_str(), name().c_str());
+      self->reset();
       continue;
     }
 
@@ -303,16 +305,21 @@ void Parameters::update(const Parameters& parameters)
     else if (other.type_str() == "string")
       *self = static_cast<std::string>(other);
     else
+    {
       dolfin_error("Parameters.cpp",
                    "update parameter set",
                    "Parameter \"%s\" has unknown type: \"%s\"",
                    other.key().c_str(), other.type_str().c_str());
+    }
   }
 
   // Update nested parameter sets
-  for (const_parameter_set_iterator it = parameters._parameter_sets.begin(); it != parameters._parameter_sets.end(); ++it)
+  for (const_parameter_set_iterator it = parameters._parameter_sets.begin();
+       it != parameters._parameter_sets.end(); ++it)
+  {
     (*this)(it->first).update(*it->second);
-}
+  }
+  }
 //-----------------------------------------------------------------------------
 Parameter& Parameters::operator[] (std::string key)
 {
diff --git a/dolfin/plot/VTKPlotter.cpp b/dolfin/plot/VTKPlotter.cpp
index 1687025..48e826e 100644
--- a/dolfin/plot/VTKPlotter.cpp
+++ b/dolfin/plot/VTKPlotter.cpp
@@ -20,7 +20,7 @@
 // Modified by Joachim B Haga 2012
 //
 // First added:  2012-05-23
-// Last changed: 2014-08-11
+// Last changed: 2015-11-10
 
 #include <dolfin/common/Array.h>
 #include <dolfin/common/Timer.h>
@@ -42,11 +42,6 @@
 #include "VTKPlottableMeshFunction.h"
 #include "VTKPlottableDirichletBC.h"
 
-#ifdef HAS_QVTK
-#include <QApplication>
-#include <QtGlobal>
-#endif
-
 #include <vtkSmartPointer.h>
 #include <vtkCamera.h>
 #include <vtkPolyLine.h>
@@ -70,12 +65,14 @@ using namespace dolfin;
 //----------------------------------------------------------------------------
 namespace // anonymous
 {
-  void round_significant_digits(double &x, double (*rounding)(double), int num_significant_digits)
+  void round_significant_digits(double &x, double (*rounding)(double),
+                                int num_significant_digits)
   {
     if (x != 0.0)
     {
       const int num_digits = std::log10(std::abs(x))+1;
-      const double reduction_factor = std::pow(10.0, num_digits-num_significant_digits);
+      const double reduction_factor
+        = std::pow(10.0, num_digits-num_significant_digits);
       x = rounding(x/reduction_factor)*reduction_factor;
     }
   }
@@ -104,19 +101,24 @@ namespace dolfin
 
     if (dynamic_cast<const Expression*>(var.get()))
     {
-      dolfin_error("plot object", "dolfin::plot", "A mesh must be supplied when plotting an expression");
+      dolfin_error("VTKPlotter.cpp",
+                   "plot object",
+                   "A mesh must be supplied when plotting an expression");
     }
 
     // Any type not listed above
-    dolfin_error("plot object", "dolfin::plot", "Object type not supported for plotting");
+    dolfin_error("VTKPlotter.cpp",
+                 "plot object",
+                 "Object type not supported for plotting");
+
     return NULL; // not reached
   }
 }
 //----------------------------------------------------------------------------
-VTKPlotter::VTKPlotter(std::shared_ptr<const Variable> obj, QVTKWidget *widget)
+VTKPlotter::VTKPlotter(std::shared_ptr<const Variable> obj)
   : _initialized(false),
     _plottable(CreateVTKPlottable(obj)),
-    vtk_pipeline(new VTKWindowOutputStage(widget)),
+    vtk_pipeline(new VTKWindowOutputStage()),
     _frame_counter(0),
     _key(to_key(*obj))
 {
@@ -126,10 +128,10 @@ VTKPlotter::VTKPlotter(std::shared_ptr<const Variable> obj, QVTKWidget *widget)
 }
 //----------------------------------------------------------------------------
 VTKPlotter::VTKPlotter(std::shared_ptr<const Expression> expression,
-    std::shared_ptr<const Mesh> mesh, QVTKWidget *widget)
+                       std::shared_ptr<const Mesh> mesh)
   : _initialized(false),
     _plottable(CreateVTKPlottable(expression, mesh)),
-    vtk_pipeline(new VTKWindowOutputStage(widget)),
+    vtk_pipeline(new VTKWindowOutputStage()),
     _frame_counter(0),
     _key(to_key(*expression))
 {
@@ -154,11 +156,6 @@ void VTKPlotter::plot(std::shared_ptr<const Variable> variable)
     return;
   }
 
-  if (vtk_pipeline->resurrect_window())
-  {
-    active_plotters->push_back(this);
-  }
-
   update_pipeline(variable);
 
   vtk_pipeline->render();
@@ -166,45 +163,35 @@ void VTKPlotter::plot(std::shared_ptr<const Variable> variable)
   _frame_counter++;
 
   // Synthesize key presses from parameters
-  Parameter &param_keys = parameters["input_keys"];
+  Parameter& param_keys = parameters["input_keys"];
   if (param_keys.is_set())
   {
     std::string keys = param_keys;
     for (std::size_t i = 0; i < keys.size(); i++)
     {
       const char c = tolower(keys[i]);
-      const int modifiers = (c == keys[i] ? 0 : SHIFT);
+      const int modifiers
+        = (c == keys[i] ? 0 : static_cast<int>(Modifiers::SHIFT));
       key_pressed(modifiers, c, std::string(&c, 1));
     }
     param_keys.reset();
   }
 
   if (parameters["interactive"])
-  {
     interactive();
-  }
-#ifdef HAS_QVTK
-  else
-  {
-    qApp->processEvents();
-  }
-#endif
 }
 //----------------------------------------------------------------------------
 void VTKPlotter::interactive(bool enter_eventloop)
 {
   init();
 
-  // Abort if DOLFIN_NOPLOT is set to a nonzero value, or if 'Q' has been pressed.
+  // Abort if DOLFIN_NOPLOT is set to a nonzero value, or if 'Q' has
+  // been pressed.
   if (no_plot || run_to_end)
-  {
     return;
-  }
 
   if (parameters["helptext"])
-  {
     vtk_pipeline->set_helptext(get_helptext());
-  }
 
   vtk_pipeline->start_interaction(enter_eventloop);
 }
@@ -217,16 +204,18 @@ void VTKPlotter::init()
   }
   _initialized = true;
 
-  // Check if environment variable DOLFIN_NOPLOT is set to a nonzero value
+  // Check if environment variable DOLFIN_NOPLOT is set to a nonzero
+  // value
   {
     const char *noplot_env;
     noplot_env = getenv("DOLFIN_NOPLOT");
-    no_plot = (noplot_env != NULL && strcmp(noplot_env, "0") != 0 && strcmp(noplot_env, "") != 0);
+    no_plot = (noplot_env != NULL && strcmp(noplot_env, "0") != 0
+               && strcmp(noplot_env, "") != 0);
   }
 
-  // Check if we have a (potential) connection to the X server. In the future,
-  // we may instead use a non-gui output stage in this case.
-#if defined(Q_WS_X11) || defined(VTK_USE_X) // <QtGlobal>, <vtkToolkits.h>
+  // Check if we have a (potential) connection to the X server. In the
+  // future, we may instead use a non-gui output stage in this case.
+#if defined(Q_WS_X11) || defined(VTK_USE_X)
   if (!getenv("DISPLAY") || strcmp(getenv("DISPLAY"), "") == 0)
   {
     warning("DISPLAY not set, disabling plotting");
@@ -241,36 +230,35 @@ void VTKPlotter::init()
   active_plotters_local_copy = active_plotters;
   log(TRACE, "Size of plotter pool is %d.", active_plotters->size());
 
-  // Don't initialize pipeline if no_plot is set, since the pipeline requires a
-  // connection to the X server.
+  // Don't initialize pipeline if no_plot is set, since the pipeline
+  // requires a connection to the X server.
   if (no_plot)
-  {
     return;
-  }
 
-  // Let the plottable set default parameters that depend on user parameters
-  // (like scalar-warped 2d plots, which should be elevated only if user
-  // doesn't set "mode=off").
+  // Let the plottable set default parameters that depend on user
+  // parameters (like scalar-warped 2d plots, which should be elevated
+  // only if user doesn't set "mode=off").
   _plottable->modify_user_parameters(parameters);
 
-  // We first initialize the part of the pipeline that the plotter controls.
-  // This is the part from the Poly data mapper and out, including actor,
-  // renderer, renderwindow and interaction. It also takes care of the scalar
-  // bar and other decorations.
+  // We first initialize the part of the pipeline that the plotter
+  // controls.  This is the part from the Poly data mapper and out,
+  // including actor, renderer, renderwindow and interaction. It also
+  // takes care of the scalar bar and other decorations.
 
   dolfin_assert(vtk_pipeline);
   vtk_pipeline->init(this, parameters);
 
   if (parameters["tile_windows"])
   {
-    // Adjust window position to not completely overlap previous plots.
+    // Adjust window position to not completely overlap previous
+    // plots
     std::size_t num_old_plots = active_plotters->size()-1;
 
     int row=0, col=0, width=0, height=0;
     if (num_old_plots > 0)
     {
-      // Get the size of a window that's already decorated, otherwise the frame
-      // size may be not include all decoration (on X)
+      // Get the size of a window that's already decorated, otherwise
+      // the frame size may be not include all decoration (on X)
       (*active_plotters->begin())->vtk_pipeline->get_window_size(width, height);
 
       int swidth, sheight;
@@ -284,10 +272,6 @@ void VTKPlotter::init()
     }
     vtk_pipeline->place_window(row*width, col*height);
   }
-  else
-  {
-    vtk_pipeline->resurrect_window();
-  }
 
   // Let the plottable initialize its part of the pipeline
   _plottable->init_pipeline(parameters);
@@ -314,7 +298,8 @@ void VTKPlotter::set_title_from(const Variable &variable)
 {
 
   std::stringstream title;
-  title << "Plot of \"" << variable.name() << "\"" << " (" << variable.label() << ")";
+  title << "Plot of \"" << variable.name() << "\"" << " ("
+        << variable.label() << ")";
   parameters["title"] =  title.str();
 }
 //----------------------------------------------------------------------------
@@ -344,17 +329,10 @@ std::string VTKPlotter::get_helptext()
   text << "   p: Save plot to png file\n";
 #endif
   text << "  hH: Show help, or print help to console\n";
-#ifdef HAS_QVTK
-  text << "   I: Enter interactive mode (and pause execution)\n";
-#endif
   text << "  qQ: Continue, or continue to end\n";
   text << " C-c: Abort execution\n";
   text << "\n";
-#ifdef HAS_QVTK
-  text << "Window control:\n";
-  text << " C-w: Close plot window\n";
-  text << " C-q: Close all plot windows\n";
-#endif
+
   return text.str();
 }
 //----------------------------------------------------------------------------
@@ -371,12 +349,12 @@ bool VTKPlotter::key_pressed(int modifiers, char key, std::string keysym)
     vtk_pipeline->render();
     return true;
 
-  case CONTROL + '+': // Up-scale glyphs, etc.
+  case static_cast<int>(Modifiers::CONTROL) + '+': // Up-scale glyphs, etc.
     parameters["scale"] = (double)parameters["scale"] * 1.2;
     rescale();
     vtk_pipeline->render();
     return true;
-  case CONTROL + '-': // Down-scale glyphs, etc.
+  case static_cast<int>(Modifiers::CONTROL) + '-': // Down-scale glyphs, etc.
     parameters["scale"] = (double)parameters["scale"] / 1.2;
     rescale();
     vtk_pipeline->render();
@@ -392,7 +370,7 @@ bool VTKPlotter::key_pressed(int modifiers, char key, std::string keysym)
     vtk_pipeline->render();
     return true;
 
-  case SHIFT + 'h': // Print helptext to console
+  case static_cast<int>(Modifiers::SHIFT) + 'h': // Print helptext to console
     std::cout << get_helptext();
     return true;
 
@@ -400,7 +378,7 @@ bool VTKPlotter::key_pressed(int modifiers, char key, std::string keysym)
     write_png();
     return true;
 
-  case SHIFT + 'p': // Save plot to PDF
+  case static_cast<int>(Modifiers::SHIFT) + 'p': // Save plot to PDF
     write_pdf();
     return true;
 
@@ -422,7 +400,8 @@ bool VTKPlotter::key_pressed(int modifiers, char key, std::string keysym)
         return false;
 
       // Check if label actor is present. If not get from plottable.
-      vtkSmartPointer<vtkActor2D> labels = _plottable->get_vertex_label_actor(vtk_pipeline->get_renderer());
+      vtkSmartPointer<vtkActor2D> labels
+        = _plottable->get_vertex_label_actor(vtk_pipeline->get_renderer());
 
       bool added = vtk_pipeline->add_viewprop(labels);
       if (!added)
@@ -440,9 +419,10 @@ bool VTKPlotter::key_pressed(int modifiers, char key, std::string keysym)
       if (_plottable->dim() > 2)
         return false;
 
-      // Check if label actor is present. If not get from plottable. If it
-      // is, toggle off
-      vtkSmartPointer<vtkActor2D> labels = _plottable->get_cell_label_actor(vtk_pipeline->get_renderer());
+      // Check if label actor is present. If not get from
+      // plottable. If it is, toggle off
+      vtkSmartPointer<vtkActor2D> labels
+        = _plottable->get_cell_label_actor(vtk_pipeline->get_renderer());
 
       bool added = vtk_pipeline->add_viewprop(labels);
       if (!added)
@@ -463,9 +443,9 @@ bool VTKPlotter::key_pressed(int modifiers, char key, std::string keysym)
     }
 
   case 's':
-  case CONTROL + 's':
-  case SHIFT + 's':
-  case CONTROL + SHIFT + 's':
+  case static_cast<int>(Modifiers::CONTROL) + 's':
+  case static_cast<int>(Modifiers::SHIFT) + 's':
+  case static_cast<int>(Modifiers::CONTROL) + static_cast<int>(Modifiers::SHIFT) + 's':
     // shift/control may be mouse-interaction modifiers
     {
 #if (VTK_MAJOR_VERSION == 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION >= 6))
@@ -490,33 +470,21 @@ bool VTKPlotter::key_pressed(int modifiers, char key, std::string keysym)
     vtk_pipeline->render();
     return true;
 
-  case CONTROL + 'w':
-    vtk_pipeline->close_window();
+  case static_cast<int>(Modifiers::CONTROL) + 'w':
     active_plotters->remove(this);
     return true;
 
-  case CONTROL + 'q':
-    foreach (VTKPlotter *plotter, *active_plotters)
-    {
-      plotter->vtk_pipeline->close_window();
-    }
+  case static_cast<int>(Modifiers::CONTROL) + 'q':
     active_plotters->clear();
     vtk_pipeline->stop_interaction();
     return true;
 
-  case SHIFT + 'q':
+  case static_cast<int>(Modifiers::SHIFT) + 'q':
     run_to_end = true;
     vtk_pipeline->stop_interaction();
     return true;
 
-#ifdef HAS_QVTK
-  case SHIFT + 'i': // Enter interactive mode
-    run_to_end = false;
-    interactive();
-    return true;
-#endif
-
-  case CONTROL + 'c':
+  case static_cast<int>(Modifiers::CONTROL) + 'c':
     dolfin_error("VTKPlotter", "continue execution", "Aborted by user");
 
   case 'q':
@@ -528,21 +496,18 @@ bool VTKPlotter::key_pressed(int modifiers, char key, std::string keysym)
   return false;
 }
 //----------------------------------------------------------------------------
-QVTKWidget *VTKPlotter::get_widget() const
-{
-  return vtk_pipeline->get_widget();
-}
-//----------------------------------------------------------------------------
 void VTKPlotter::write_png(std::string filename)
 {
   if (no_plot)
     return;
 
-  if (filename.empty()) {
-    // We construct a filename from the given prefix and static counter.
-    // If a file with that filename exists, the counter is incremented
-    // until a unique filename is found.
-    do {
+  if (filename.empty())
+  {
+    // We construct a filename from the given prefix and static
+    // counter.  If a file with that filename exists, the counter is
+    // incremented until a unique filename is found.
+    do
+    {
       std::stringstream filenamebuilder;
       filenamebuilder << std::string(parameters["prefix"]);
       filenamebuilder << hardcopy_counter++;
@@ -562,11 +527,13 @@ void VTKPlotter::write_pdf(std::string filename)
   if (no_plot)
     return;
 
-  if (filename.empty()) {
-    // We construct a filename from the given prefix and static counter.
-    // If a file with that filename exists, the counter is incremented
-    // until a unique filename is found.
-    do {
+  if (filename.empty())
+  {
+    // We construct a filename from the given prefix and static
+    // counter.  If a file with that filename exists, the counter is
+    // incremented until a unique filename is found.
+    do
+    {
       std::stringstream filenamebuilder;
       filenamebuilder << std::string(parameters["prefix"]);
       filenamebuilder << hardcopy_counter++;
@@ -624,7 +591,10 @@ void VTKPlotter::add_polygon(const Array<double>& points)
   const std::size_t dim = _plottable->dim();
 
   if (points.size() % dim != 0)
-    warning("VTKPlotter::add_polygon() : Size of array is not a multiple of %d", dim);
+  {
+    warning("VTKPlotter::add_polygon() : Size of array is not a multiple of %d",
+            dim);
+  }
 
   const std::size_t numpoints = points.size()/dim;
 
@@ -648,20 +618,23 @@ void VTKPlotter::add_polygon(const Array<double>& points)
   for (std::size_t i = 0; i < numpoints; i++)
     line->GetPointIds()->SetId(i, i);
 
-  vtkSmartPointer<vtkUnstructuredGrid> grid = vtkSmartPointer<vtkUnstructuredGrid>::New();
+  vtkSmartPointer<vtkUnstructuredGrid> grid
+    = vtkSmartPointer<vtkUnstructuredGrid>::New();
   grid->Allocate(1, 1);
 
   grid->InsertNextCell(line->GetCellType(), line->GetPointIds());
   grid->SetPoints(vtk_points);
 
-  vtkSmartPointer<vtkGeometryFilter> extract = vtkSmartPointer<vtkGeometryFilter>::New();
+  vtkSmartPointer<vtkGeometryFilter> extract
+    = vtkSmartPointer<vtkGeometryFilter>::New();
   #if VTK_MAJOR_VERSION <= 5
   extract->SetInput(grid);
   #else
   extract->SetInputData(grid);
   #endif
 
-  vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
+  vtkSmartPointer<vtkPolyDataMapper> mapper
+    = vtkSmartPointer<vtkPolyDataMapper>::New();
   mapper->SetInputConnection(extract->GetOutputPort());
 
   vtkSmartPointer<vtkActor> polygon_actor = vtkSmartPointer<vtkActor>::New();
@@ -686,7 +659,7 @@ void VTKPlotter::rescale()
   {
     _plottable->update_range(range);
 
-    // Round small values (<5% of range) to zero
+    // Round small values (< 5% of range) to zero
     const double diff = range[1]-range[0];
     if (diff != 0 && std::abs(range[0]/diff) < 0.05)
       range[0] = 0;
@@ -698,11 +671,14 @@ void VTKPlotter::rescale()
     round_significant_digits(range[1], std::ceil,  2);
   }
 
-  if (range_min.is_set()) range[0] = range_min;
-  if (range_max.is_set()) range[1] = range_max;
+  if (range_min.is_set())
+    range[0] = range_min;
+  if (range_max.is_set())
+    range[1] = range_max;
 
   _plottable->rescale(range, parameters);
   vtk_pipeline->set_scalar_range(range);
+
   // The rescale may have changed the scene (scalar/vector warping)
   vtk_pipeline->reset_camera_clipping_range();
 }
@@ -712,7 +688,7 @@ void VTKPlotter::update_pipeline(std::shared_ptr<const Variable> variable)
   if (!is_compatible(variable))
   {
     dolfin_error("VTKPlotter.cpp",
-                 "plot()",
+                 "plot object",
                  "The plottable is not compatible with the data");
   }
 
@@ -739,14 +715,15 @@ void VTKPlotter::update_pipeline(std::shared_ptr<const Variable> variable)
   // Update the plottable data
   _plottable->update(variable, parameters, _frame_counter);
 
-  // If this is the first render of this plot and/or the rescale parameter
-  // is set, we read get the min/max values of the data and process them
+  // If this is the first render of this plot and/or the rescale
+  // parameter is set, we read get the min/max values of the data and
+  // process them
   if (_frame_counter == 0 || parameters["rescale"])
     rescale();
 
-  // Set the mapper's connection on each plot. This must be done since the
-  // visualization parameters may have changed since the last frame, and
-  // the input may hence also have changed
+  // Set the mapper's connection on each plot. This must be done since
+  // the visualization parameters may have changed since the last
+  // frame, and the input may hence also have changed
 
   _plottable->connect_to_output(*vtk_pipeline);
   if (_frame_counter == 0)
@@ -767,9 +744,7 @@ void VTKPlotter::all_interactive(bool really)
   }
 
   if (really)
-  {
     run_to_end = false;
-  }
 
   // Prepare interactiveness on every plotter but the first
   foreach (VTKPlotter *plotter, *active_plotters)
@@ -796,20 +771,23 @@ namespace dolfin
   class VTKWindowOutputStage {}; // dummy class
 }
 
-VTKPlotter::VTKPlotter(std::shared_ptr<const Variable>, QVTKWidget*):
-  _initialized(false),
-  _frame_counter(0),
-  no_plot(false)
+VTKPlotter::VTKPlotter(std::shared_ptr<const Variable>)
+  : _initialized(false), _frame_counter(0), no_plot(false)
 {
   init();
 }
+
 VTKPlotter::VTKPlotter(std::shared_ptr<const Expression>,
-		       std::shared_ptr<const Mesh>, QVTKWidget*)  { init(); }
+		       std::shared_ptr<const Mesh>)
+{
+  init();
+}
+
 VTKPlotter::~VTKPlotter() {}
 
-// (Ab)use init() to issue a warning.
-// We also need to initialize the parameter set to avoid tons of warning
-// when running the tests without VTK.
+// (Ab)use init() to issue a warning.  We also need to initialize the
+// parameter set to avoid tons of warning when running the tests
+// without VTK.
 
 void VTKPlotter::init()
 {
@@ -832,12 +810,13 @@ void VTKPlotter::add_polygon  (const Array<double>&)              {}
 void VTKPlotter::all_interactive(bool)                            {}
 void VTKPlotter::set_key(std::string key)                         {}
 
-bool VTKPlotter::key_pressed(int, char, std::string)                    { return false; }
-bool VTKPlotter::is_compatible(std::shared_ptr<const Variable>) const { return false; }
+bool VTKPlotter::key_pressed(int, char, std::string)
+{ return false; }
+bool VTKPlotter::is_compatible(std::shared_ptr<const Variable>) const
+{ return false; }
 
 std::string        VTKPlotter::to_key(const Variable &) { return ""; }
 const std::string& VTKPlotter::key() const              { return _key; }
-QVTKWidget *       VTKPlotter::get_widget() const       { return NULL; }
 
 #endif // HAS_VTK
 
diff --git a/dolfin/plot/VTKPlotter.h b/dolfin/plot/VTKPlotter.h
index d0976c7..18875b9 100644
--- a/dolfin/plot/VTKPlotter.h
+++ b/dolfin/plot/VTKPlotter.h
@@ -32,7 +32,6 @@
 #include <dolfin/parameter/Parameters.h>
 
 class vtkObject;
-class QVTKWidget;
 
 namespace dolfin
 {
@@ -44,12 +43,12 @@ namespace dolfin
   class VTKWindowOutputStage;
   template<typename T> class Array;
 
-  /// This class enables visualization of various DOLFIN entities.
-  /// It supports visualization of meshes, functions, expressions, boundary
-  /// conditions and mesh functions. It can plot data wrapped in classes
-  /// conforming to the GenericVTKPlottable interface.
-  /// The plotter has several parameters that the user can set and adjust to
-  /// affect the appearance and behavior of the plot.
+  /// This class enables visualization of various DOLFIN entities.  It
+  /// supports visualization of meshes, functions, expressions,
+  /// boundary conditions and mesh functions. It can plot data wrapped
+  /// in classes conforming to the GenericVTKPlottable interface.  The
+  /// plotter has several parameters that the user can set and adjust
+  /// to affect the appearance and behavior of the plot.
   ///
   /// A plotter can be created and used in the following way:
   ///
@@ -57,8 +56,9 @@ namespace dolfin
   ///   VTKPlotter plotter(mesh);
   ///   plotter.plot();
   ///
-  /// Parameters can be adjusted at any time and will take effect on the next
-  /// call to the plot() method. The following parameters exist:
+  /// Parameters can be adjusted at any time and will take effect on
+  /// the next call to the plot() method. The following parameters
+  /// exist:
   ///
   /// ============== ============ ================ ====================================
   ///  Name           Value type   Default value              Description
@@ -151,24 +151,23 @@ namespace dolfin
   ///                                                          Color mapping (norm)
   /// =========================  ============================ =====================
   ///
-  /// Expressions and boundary conditions are also visualized according to the
-  /// above table.
+  /// Expressions and boundary conditions are also visualized
+  /// according to the above table.
 
   class VTKPlotter : public Variable
   {
   public:
 
-    /// Create plotter for a variable. If a widget is supplied, this widget
-    /// will be used for drawing, instead of a new top-level widget. Ownership
-    /// is transferred.
-    VTKPlotter(std::shared_ptr<const Variable>, QVTKWidget *widget = NULL);
+    /// Create plotter for a variable. If a widget is supplied, this
+    /// widget will be used for drawing, instead of a new top-level
+    /// widget. Ownership is transferred.
+    VTKPlotter(std::shared_ptr<const Variable>);
 
-    /// Create plotter for an Expression with associated Mesh. If a widget is
-    /// supplied, this widget will be used for drawing, instead of a new
-    /// top-level widget. Ownership is transferred.
+    /// Create plotter for an Expression with associated Mesh. If a
+    /// widget is supplied, this widget will be used for drawing,
+    /// instead of a new top-level widget. Ownership is transferred.
     VTKPlotter(std::shared_ptr<const Expression> expression,
-               std::shared_ptr<const Mesh> mesh,
-               QVTKWidget *wiget = NULL);
+               std::shared_ptr<const Mesh> mesh);
 
     /// Destructor
     virtual ~VTKPlotter();
@@ -211,10 +210,12 @@ namespace dolfin
     bool is_compatible(std::shared_ptr<const Variable> variable) const;
 
     /// Plot the object
-    void plot(std::shared_ptr<const Variable> variable=std::shared_ptr<const Variable>());
+    void plot(std::shared_ptr<const Variable>
+              variable=std::shared_ptr<const Variable>());
 
     // FIXME: Deprecated? What should it do?
-    void update(std::shared_ptr<const Variable> variable=std::shared_ptr<const Variable>())
+    void update(std::shared_ptr<const Variable>
+                variable=std::shared_ptr<const Variable>())
     {
       warning("VTKPlotter::update is deprecated, use ::plot instead");
       plot(variable);
@@ -252,11 +253,11 @@ namespace dolfin
 
     void add_polygon(const Array<double>& points);
 
-    /// Make all plot windows interactive. If really is set, the interactive
-    /// mode is entered even if 'Q' has been pressed.
+    /// Make all plot windows interactive. If really is set, the
+    /// interactive mode is entered even if 'Q' has been pressed.
     static void all_interactive(bool really=false);
 
-    enum Modifiers
+    enum class Modifiers : int
     {
       // Zero low byte, so that a char can be added
       SHIFT    = 0x100,
@@ -264,27 +265,24 @@ namespace dolfin
       CONTROL  = 0x400
     };
 
-    // Called (from within VTKWindowOutputStage) when a key is pressed. Public,
-    // but intended for internal (and subclass) use. Returns true if the
-    // keypress is handled.
+    // Called (from within VTKWindowOutputStage) when a key is
+    // pressed. Public, but intended for internal (and subclass)
+    // use. Returns true if the keypress is handled.
     virtual bool key_pressed(int modifiers, char key, std::string keysym);
 
-    // Returns the QVTKWidget that contains the plot (when compiled with Qt).
-    QVTKWidget *get_widget() const;
-
   protected:
 
-    void update_pipeline(std::shared_ptr<const Variable> variable=std::shared_ptr<const Variable>());
+    void update_pipeline(std::shared_ptr<const Variable>
+                         variable=std::shared_ptr<const Variable>());
 
-    // The pool of plotter objects. Objects register
-    // themselves in the list when created and remove themselves when
-    // destroyed.
-    // Used when calling interactive() (which should have effect on
-    // all plot windows)
+    // The pool of plotter objects. Objects register themselves in the
+    // list when created and remove themselves when destroyed.  Used
+    // when calling interactive() (which should have effect on all
+    // plot windows)
     static std::shared_ptr<std::list<VTKPlotter*> > active_plotters;
 
-    // Initialization common to all constructors.
-    // Setup all pipeline objects and connect them.
+    // Initialization common to all constructors.  Setup all pipeline
+    // objects and connect them.
     void init();
 
     // Has init been called
@@ -293,7 +291,8 @@ namespace dolfin
     // Rescales ranges and glyphs
     void rescale();
 
-    // Set the title parameter from the name and label of the Variable to plot
+    // Set the title parameter from the name and label of the Variable
+    // to plot
     void set_title_from(const Variable &variable);
 
     // Return the hover-over help text
@@ -308,7 +307,8 @@ namespace dolfin
     // The number of plotted frames
     std::size_t _frame_counter;
 
-    // The window id (derived from Variable::id unless overridden by user)
+    // The window id (derived from Variable::id unless overridden by
+    // user)
     std::string _key;
 
     // Counter for the automatically named hardcopies
@@ -321,7 +321,8 @@ namespace dolfin
     // destroyed.
     std::shared_ptr<std::list<VTKPlotter*> > active_plotters_local_copy;
 
-    // Usually false, but if true ('Q' keyboard binding) then all event loops are skipped.
+    // Usually false, but if true ('Q' keyboard binding) then all
+    // event loops are skipped.
     static bool run_to_end;
   };
 
diff --git a/dolfin/plot/VTKWindowOutputStage.cpp b/dolfin/plot/VTKWindowOutputStage.cpp
index 1c6a114..e6283c7 100644
--- a/dolfin/plot/VTKWindowOutputStage.cpp
+++ b/dolfin/plot/VTKWindowOutputStage.cpp
@@ -23,12 +23,6 @@
 
 #ifdef HAS_VTK
 
-#ifdef HAS_QVTK
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QVTKWidget.h>
-#endif
-
 #include <vtkSmartPointer.h>
 #include <vtkPolyDataMapper.h>
 #include <vtkLookupTable.h>
@@ -72,9 +66,8 @@ using namespace dolfin;
 
 // The below is a work-around for Intel compilers which have a problem
 // with unnamed namespaces. See
-//     http://software.intel.com/en-us/articles/compiler-reports-error-1757-when-compiling-chromium-os-code
-// and
-//     https://bugs.launchpad.net/dolfin/+bug/1086526
+// http://software.intel.com/en-us/articles/compiler-reports-error-1757-when-compiling-chromium-os-code
+// and https://bugs.launchpad.net/dolfin/+bug/1086526
 
 namespace d_anonymous { /* empty body */ }
 using namespace d_anonymous;
@@ -84,8 +77,8 @@ namespace d_anonymous
   //----------------------------------------------------------------------------
   class PrivateVTKInteractorStyle : public vtkInteractorStyleTrackballCamera
   {
-    // Create a new style instead of observer callbacks, so that we can
-    // intercept keypresses (like q/e) reliably.
+    // Create a new style instead of observer callbacks, so that we
+    // can intercept keypresses (like q/e) reliably.
   public:
     PrivateVTKInteractorStyle() : _plotter(NULL), _highlighted(false) {}
 
@@ -111,9 +104,9 @@ namespace d_anonymous
       // Note: ALT key doesn't seem to be usable as a modifier.
       std::string keysym = Interactor->GetKeySym();
       char key = Interactor->GetKeyCode();
-      int modifiers = (VTKPlotter::SHIFT   * !!Interactor->GetShiftKey() +
-                       VTKPlotter::ALT     * !!Interactor->GetAltKey()   +
-                       VTKPlotter::CONTROL * !!Interactor->GetControlKey());
+      int modifiers = (static_cast<int>(VTKPlotter::Modifiers::SHIFT) * !!Interactor->GetShiftKey() +
+                       static_cast<int>(VTKPlotter::Modifiers::ALT) * !!Interactor->GetAltKey() +
+                       static_cast<int>(VTKPlotter::Modifiers::CONTROL) * !!Interactor->GetControlKey());
       if (keysym.size() == 1)
       {
         // Fix for things like shift+control+q which isn't sent correctly
@@ -124,7 +117,7 @@ namespace d_anonymous
       if (key && key == toupper(key))
       {
         // Things like '+', '&' which are not really shifted
-        modifiers &= ~VTKPlotter::SHIFT;
+        modifiers &= ~static_cast<int>(VTKPlotter::Modifiers::SHIFT);
       }
 
       log(DBG, "Keypress: %c|%d (%s)", key, modifiers, keysym.c_str());
@@ -178,19 +171,6 @@ namespace d_anonymous
   };
   vtkStandardNewMacro(PrivateVTKBalloonWidget)
   //----------------------------------------------------------------------------
-  #ifdef HAS_QVTK
-  void create_qApp()
-  {
-    if (!qApp)
-    {
-      static int dummy_argc = 0;
-      static char dummy_argv0 = '\0';
-      static char *dummy_argv0_ptr = &dummy_argv0;
-      new QApplication(dummy_argc, &dummy_argv0_ptr);
-    }
-  }
-  #endif
-  //----------------------------------------------------------------------------
   unsigned char gauss_120[256*4] =
   {
   #include "gauss_120.dat"
@@ -199,12 +179,8 @@ namespace d_anonymous
 //----------------------------------------------------------------------------
 // Class VTKWindowOutputStage
 //----------------------------------------------------------------------------
-VTKWindowOutputStage::VTKWindowOutputStage(QVTKWidget *user_widget)
+VTKWindowOutputStage::VTKWindowOutputStage()
 {
-  #ifdef HAS_QVTK
-  widget = user_widget;
-  #endif
-
   vtkMapper::GlobalImmediateModeRenderingOn(); // FIXME: Check if faster or not
 
   // Initialize objects
@@ -230,12 +206,6 @@ VTKWindowOutputStage::~VTKWindowOutputStage()
   // destruction. This destructor tries to impose an order on the most
   // important stuff.
 
-  //log(DBG, "VTK pipeline destroyed");
-
-  #ifdef HAS_QVTK
-  widget = NULL;
-  #endif
-
   helptextActor = NULL;
   balloonRep = NULL;
   balloonwidget = NULL;
@@ -268,27 +238,12 @@ void VTKWindowOutputStage::init(VTKPlotter *parent, const Parameters& p)
     vtkSmartPointer<PrivateVTKInteractorStyle>::New();
   style->_plotter = parent;
 
-  #ifdef HAS_QVTK
-  if (!widget)
-  {
-    // Create new top-level widget -- make sure a QApplication exists first
-    create_qApp();
-    widget = new QVTKWidget();
-  }
-  _renderWindow->SetInteractor(widget->GetInteractor());
-
-  widget->SetRenderWindow(_renderWindow);
-  if (widget->parentWidget())
-    widget->resize(widget->parentWidget()->size());
-  else
-    widget->resize(p["window_width"], p["window_height"]);
-  #else
   _renderWindow->SetInteractor(vtkSmartPointer<vtkRenderWindowInteractor>::New());
   const int width  = p["window_width"];
   const int height = p["window_height"];
   if (width > 0 && height > 0)
     _renderWindow->SetSize(width, height);
-  #endif
+
   _renderWindow->GetInteractor()->SetInteractorStyle(style);
   style->SetCurrentRenderer(_renderer);
 
@@ -378,50 +333,12 @@ void VTKWindowOutputStage::set_helptext(std::string text)
 //----------------------------------------------------------------------------
 void VTKWindowOutputStage::set_window_title(std::string title)
 {
-  #ifdef HAS_QVTK
-  widget->setWindowTitle(title.c_str());
-  #else
   _renderWindow->SetWindowName(title.c_str());
-  #endif
 }
 //----------------------------------------------------------------------------
 std::string VTKWindowOutputStage::get_window_title()
 {
-  #ifdef HAS_QVTK
-  return widget->windowTitle().toStdString();
-  #else
   return _renderWindow->GetWindowName();
-  #endif
-}
-//----------------------------------------------------------------------------
-QVTKWidget *VTKWindowOutputStage::get_widget() const
-{
-  #ifdef HAS_QVTK
-  return widget;
-  #else
-  return NULL;
-  #endif
-}
-//----------------------------------------------------------------------------
-void VTKWindowOutputStage::close_window()
-{
-  #ifdef HAS_QVTK
-  widget->close();
-  #else
-  warning("Window close not implemented on VTK event loop");
-  #endif
-}
-//----------------------------------------------------------------------------
-bool VTKWindowOutputStage::resurrect_window()
-{
-  #ifdef HAS_QVTK
-  if (widget->isHidden())
-  {
-    widget->show();
-    return true;
-  }
-  #endif
-  return false;
 }
 //----------------------------------------------------------------------------
 void VTKWindowOutputStage::start_interaction(bool enter_eventloop)
@@ -429,22 +346,12 @@ void VTKWindowOutputStage::start_interaction(bool enter_eventloop)
   get_interactor()->Initialize();
   render();
   if (enter_eventloop)
-  {
-    #ifdef HAS_QVTK
-    qApp->exec();
-    #else
     get_interactor()->Start();
-    #endif
-  }
 }
 //----------------------------------------------------------------------------
 void VTKWindowOutputStage::stop_interaction()
 {
-  #ifdef HAS_QVTK
-  qApp->quit();
-  #else
   get_interactor()->TerminateApp();
-  #endif
 }
 //----------------------------------------------------------------------------
 void VTKWindowOutputStage::write_png(std::string filename)
@@ -567,39 +474,22 @@ void VTKWindowOutputStage::render()
 //----------------------------------------------------------------------------
 void VTKWindowOutputStage::get_window_size(int& width, int& height)
 {
-  #ifdef HAS_QVTK
-  QSize size = widget->frameSize();
-  width = size.width();
-  height = size.height();
-  #else
   get_interactor()->GetSize(width, height);
   // Guess window decoration (frame) size
   width += 6;
   height += 30;
-  #endif
 }
 //----------------------------------------------------------------------------
 void VTKWindowOutputStage::get_screen_size(int& width, int& height)
 {
-  #ifdef HAS_QVTK
-  QRect geom = QApplication::desktop()->availableGeometry();
-  width = geom.width();
-  height = geom.height();
-  #else
   int *size = _renderWindow->GetScreenSize();
   width = size[0];
   height = size[1];
-  #endif
 }
 //----------------------------------------------------------------------------
 void VTKWindowOutputStage::place_window(int x, int y)
 {
-  #ifdef HAS_QVTK
-  widget->move(x, y);
-  widget->show();
-  #else
   _renderWindow->SetPosition(x, y);
-  #endif
 }
 //----------------------------------------------------------------------------
 bool VTKWindowOutputStage::add_viewprop(vtkSmartPointer<vtkProp> prop)
diff --git a/dolfin/plot/VTKWindowOutputStage.h b/dolfin/plot/VTKWindowOutputStage.h
index 8b2e7fb..42fd02f 100644
--- a/dolfin/plot/VTKWindowOutputStage.h
+++ b/dolfin/plot/VTKWindowOutputStage.h
@@ -58,7 +58,7 @@ namespace dolfin
 
     /// If a widget is supplied, this widget will be used for drawing,
     /// instead of a new top-level widget. Ownership is transferred.
-    VTKWindowOutputStage(QVTKWidget* widget = NULL);
+    VTKWindowOutputStage();
 
     /// Destructor
     ~VTKWindowOutputStage();
@@ -84,20 +84,7 @@ namespace dolfin
     /// Retrieve the window title
     std::string get_window_title();
 
-    /// Return a pointer to the plotting widget. The pointer is valid
-    /// from after init() is called (if no widget was passed in the
-    /// constructor).
-    QVTKWidget *get_widget() const;
-
-    /// Close the plotting window (only Qt). The window is not destroyed.
-    void close_window();
-
-    /// Re-open a previously closed plotting window.
-    bool resurrect_window();
-
-    /// Start interaction, and optionally enter the event loop. In Qt,
-    /// interaction is allowed also before start_interaction is called,
-    /// but updates are only processed when the plot is updated.
+    /// Start interaction, and optionally enter the event loop.
     void start_interaction(bool enter_eventloop=true);
 
     /// Exit the event loop
@@ -151,7 +138,8 @@ namespace dolfin
 
     /// Used by plottables to indicate whether the scene should be
     /// treated as translucent (which requires depth sorting, etc.)
-    void set_translucent(bool onoff, std::size_t topo_dim=3, std::size_t geom_dim=3);
+    void set_translucent(bool onoff, std::size_t topo_dim=3,
+                         std::size_t geom_dim=3);
 
   protected:
 
@@ -188,10 +176,6 @@ namespace dolfin
     vtkSmartPointer<vtkBalloonRepresentation> balloonRep;
     vtkSmartPointer<vtkBalloonWidget> balloonwidget;
 
-    #ifdef HAS_QVTK
-    QVTKWidget *widget;
-    #endif
-
   };
 
 }
diff --git a/dolfin/plot/plot.cpp b/dolfin/plot/plot.cpp
index 8e79482..3b37a81 100644
--- a/dolfin/plot/plot.cpp
+++ b/dolfin/plot/plot.cpp
@@ -20,7 +20,7 @@
 // Modified by Benjamin Kehlet, 2012
 //
 // First added:  2007-05-02
-// Last changed: 2014-06-11
+// Last changed: 2015-11-11
 
 #include <cstdlib>
 #include <sstream>
@@ -113,11 +113,9 @@ void dolfin::interactive(bool really)
   VTKPlotter::all_interactive(really);
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<VTKPlotter> dolfin::plot(const Variable& var,
-                                         std::string title,
-                                         std::string mode)
+void dolfin::plot(const Variable& var, std::string title, std::string mode)
 {
-  return plot(reference_to_no_delete_pointer(var), title, mode);
+  plot(reference_to_no_delete_pointer(var), title, mode);
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<VTKPlotter> dolfin::plot(std::shared_ptr<const Variable> var,
@@ -126,11 +124,9 @@ std::shared_ptr<VTKPlotter> dolfin::plot(std::shared_ptr<const Variable> var,
   return plot(var, new_parameters(title, mode));
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<VTKPlotter> dolfin::plot(const Variable& var,
-                                         const Parameters& p)
+void dolfin::plot(const Variable& var, const Parameters& p)
 {
-  return plot(reference_to_no_delete_pointer(var),
-	      reference_to_no_delete_pointer(p));
+  plot(reference_to_no_delete_pointer(var), reference_to_no_delete_pointer(p));
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<VTKPlotter> dolfin::plot(std::shared_ptr<const Variable> var,
@@ -139,11 +135,10 @@ std::shared_ptr<VTKPlotter> dolfin::plot(std::shared_ptr<const Variable> var,
   return plot_object(var, p, VTKPlotter::to_key(*var));
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<VTKPlotter> dolfin::plot(const Expression& expression,
-                                         const Mesh& mesh,
-                                         std::string title, std::string mode)
+void dolfin::plot(const Expression& expression, const Mesh& mesh,
+                  std::string title, std::string mode)
 {
-  return plot(reference_to_no_delete_pointer(expression),
+  plot(reference_to_no_delete_pointer(expression),
 	      reference_to_no_delete_pointer(mesh), title, mode);
 }
 //-----------------------------------------------------------------------------
@@ -154,21 +149,19 @@ std::shared_ptr<VTKPlotter> dolfin::plot(std::shared_ptr<const Expression> expre
   return plot(expression, mesh, new_parameters(title, mode));
 }
 //-----------------------------------------------------------------------------
-std::shared_ptr<VTKPlotter> dolfin::plot(const Expression& expression,
-                                         const Mesh& mesh,
-                                         const Parameters& p)
+void dolfin::plot(const Expression& expression, const Mesh& mesh,
+                  const Parameters& p)
 {
-  return plot(reference_to_no_delete_pointer(expression),
-	      reference_to_no_delete_pointer(mesh),
-	      reference_to_no_delete_pointer(p));
+  plot(reference_to_no_delete_pointer(expression),
+       reference_to_no_delete_pointer(mesh),
+       reference_to_no_delete_pointer(p));
 }
 //-----------------------------------------------------------------------------
 std::shared_ptr<VTKPlotter> dolfin::plot(std::shared_ptr<const Expression> expression,
                                          std::shared_ptr<const Mesh> mesh,
                                          std::shared_ptr<const Parameters> p)
 {
-  std::shared_ptr<const ExpressionWrapper>
-    wrapper(new ExpressionWrapper(expression, mesh));
+  auto wrapper = std::make_shared<const ExpressionWrapper>(expression, mesh);
   return plot_object(wrapper, p, VTKPlotter::to_key(*expression));
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/plot/plot.h b/dolfin/plot/plot.h
index 2a121a1..6902762 100644
--- a/dolfin/plot/plot.h
+++ b/dolfin/plot/plot.h
@@ -18,7 +18,7 @@
 // Modified by Joachim B Haga 2012
 //
 // First added:  2007-05-02
-// Last changed: 2014-06-11
+// Last changed: 2015-11-11
 
 #ifndef __PLOT_H
 #define __PLOT_H
@@ -46,9 +46,7 @@ namespace dolfin
   //---------------------------------------------------------------------------
 
   /// Plot variable of any supported type
-  std::shared_ptr<VTKPlotter> plot(const Variable&,
-                                   std::string title="",
-                                   std::string mode="auto");
+  void plot(const Variable&, std::string title="", std::string mode="auto");
 
   /// Plot variable (shared_ptr version)
   std::shared_ptr<VTKPlotter> plot(std::shared_ptr<const Variable>,
@@ -56,8 +54,7 @@ namespace dolfin
                                    std::string mode="auto");
 
   /// Plot variable (parameter version)
-  std::shared_ptr<VTKPlotter> plot(const Variable&,
-                                   const Parameters& parameters);
+  void plot(const Variable&, const Parameters& parameters);
 
   /// Plot variable (parameter, shared_ptr version)
   std::shared_ptr<VTKPlotter> plot(std::shared_ptr<const Variable>,
@@ -68,10 +65,8 @@ namespace dolfin
   //---------------------------------------------------------------------------
 
   /// Plot expression
-  std::shared_ptr<VTKPlotter> plot(const Expression& expression,
-                                   const Mesh& mesh,
-                                   std::string title="",
-                                   std::string mode="auto");
+  void plot(const Expression& expression, const Mesh& mesh,
+            std::string title="", std::string mode="auto");
 
   /// Plot expression (shared_ptr version)
   std::shared_ptr<VTKPlotter> plot(std::shared_ptr<const Expression> expression,
@@ -80,9 +75,8 @@ namespace dolfin
                                    std::string mode="auto");
 
   /// Plot expression (parameter version)
-  std::shared_ptr<VTKPlotter> plot(const Expression& expression,
-                                   const Mesh& mesh,
-                                   const Parameters& parameters);
+  void plot(const Expression& expression, const Mesh& mesh,
+            const Parameters& parameters);
 
   /// Plot expression (parameter, shared_ptr version)
   std::shared_ptr<VTKPlotter> plot(std::shared_ptr<const Expression> expression,
@@ -93,12 +87,16 @@ namespace dolfin
   // Specialized utility functions for plotting
   //---------------------------------------------------------------------------
 
+  // FIXME: This is very peculiar code. Why is there are shared_ptr
+  // version when the function does not return an object?
+
   // Plot multimesh
   void plot(const MultiMesh& multimesh);
 
   // Plot multimesh (shared_ptr version)
   void plot(std::shared_ptr<const MultiMesh> multimesh);
 
+
 }
 
 #endif
diff --git a/dolfin/refinement/BisectionRefinement1D.cpp b/dolfin/refinement/BisectionRefinement1D.cpp
index db63212..ea24dc7 100644
--- a/dolfin/refinement/BisectionRefinement1D.cpp
+++ b/dolfin/refinement/BisectionRefinement1D.cpp
@@ -23,16 +23,16 @@
 #include <dolfin/mesh/Vertex.h>
 #include <dolfin/mesh/MeshEditor.h>
 #include "BisectionRefinement1D.h"
+#include "ParallelRefinement.h"
 
 using namespace dolfin;
 
 //-----------------------------------------------------------------------------
 void BisectionRefinement1D::refine(Mesh& refined_mesh,
-                                  const Mesh& mesh,
-                                  const MeshFunction<bool>& cell_markers)
+                                   const Mesh& mesh,
+                                   const MeshFunction<bool>& cell_markers,
+                                   bool redistribute)
 {
-  not_working_in_parallel("BisectionRefinement1D::refine");
-
   if (mesh.topology().dim() != 1)
   {
     dolfin_error("BisectionRefinement1D.cpp",
@@ -40,62 +40,66 @@ void BisectionRefinement1D::refine(Mesh& refined_mesh,
                  "Mesh is not one-dimensional");
   }
 
-  // Count the number of cells in refined mesh
-  std::size_t num_new_vertices = 0;
-
+  ParallelRefinement p_ref(mesh);
+  // Edges are the same as cells in 1D
   for (CellIterator cell(mesh); !cell.end(); ++cell)
-  {
     if (cell_markers[*cell])
-      ++num_new_vertices;
-  }
-
-  // Initialize mesh editor
-  const std::size_t vertex_offset = mesh.num_vertices();
-  const std::size_t num_vertices = vertex_offset + num_new_vertices;
-  const std::size_t num_cells = mesh.num_cells() + num_new_vertices;
+      p_ref.mark(cell->index());
 
-  MeshEditor editor;
-  editor.open(refined_mesh, mesh.topology().dim(), mesh.geometry().dim());
-  editor.init_vertices_global(num_vertices, num_vertices);
-  editor.init_cells_global(num_cells, num_cells);
+  p_ref.create_new_vertices();
+  const std::map<std::size_t, std::size_t>& new_vertex_map
+    = *(p_ref.edge_to_new_vertex());
 
-  // Set vertex coordinates
-  std::size_t current_vertex = 0;
-  for (VertexIterator vertex(mesh); !vertex.end(); ++vertex)
-  {
-    editor.add_vertex(current_vertex, vertex->point());
-    ++current_vertex;
-  }
-
-  std::size_t current_cell = 0;
-  std::vector<std::size_t> cell_data(2);
+  std::vector<std::size_t> parent_cell;
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
-    if (cell_markers[*cell])
-    {
-      editor.add_vertex(current_vertex, cell->midpoint());
+    std::size_t cell_index = cell->index();
 
-      cell_data[0] = cell->entities(0)[0];
-      cell_data[1] = current_vertex;
-      editor.add_cell(current_cell++, cell_data);
-      cell_data[0] = current_vertex;
-      cell_data[1] = cell->entities(0)[1];
-      editor.add_cell(current_cell, cell_data);
+    std::vector<std::size_t> indices;
+    for (VertexIterator v(*cell); !v.end(); ++v)
+      indices.push_back(v->global_index());
 
-      ++current_vertex;
+    if (p_ref.is_marked(cell_index))
+    {
+      auto it = new_vertex_map.find(cell_index);
+      dolfin_assert (it != new_vertex_map.end());
+
+      std::vector<std::size_t> new_cells
+        = {indices[0], it->second,
+           it->second, indices[1]};
+      p_ref.new_cells(new_cells);
+      parent_cell.push_back(cell_index);
+      parent_cell.push_back(cell_index);
     }
     else
     {
-      cell_data[0] = cell->entities(0)[0];
-      cell_data[1] = cell->entities(0)[1];
-      editor.add_cell(current_cell, cell_data);
+      p_ref.new_cell(*cell);
+      parent_cell.push_back(cell_index);
     }
-    ++current_cell;
   }
 
-  // Close mesh editor
-  dolfin_assert(num_cells == current_cell);
-  dolfin_assert(num_vertices == current_vertex);
-  editor.close();
+  const bool serial = (MPI::size(mesh.mpi_comm()) == 1);
+
+  if (serial)
+    p_ref.build_local(refined_mesh);
+  else
+    p_ref.partition(refined_mesh, redistribute);
+
+  if (serial || !redistribute)
+  {
+    // Create parent data on new mesh
+    std::vector<std::size_t>& new_parent_cell
+      = refined_mesh.data().create_array("parent_cell", refined_mesh.topology().dim());
+    new_parent_cell = parent_cell;
+  }
+
+}
+//-----------------------------------------------------------------------------
+void BisectionRefinement1D::refine(Mesh& refined_mesh,
+                                   const Mesh& mesh, bool redistribute)
+{
+  auto _mesh = reference_to_no_delete_pointer(mesh);
+  const CellFunction<bool> cell_markers(_mesh, true);
+  BisectionRefinement1D::refine(refined_mesh, mesh, cell_markers, redistribute);
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/refinement/BisectionRefinement1D.h b/dolfin/refinement/BisectionRefinement1D.h
index 8f96b41..6a541c1 100644
--- a/dolfin/refinement/BisectionRefinement1D.h
+++ b/dolfin/refinement/BisectionRefinement1D.h
@@ -35,7 +35,13 @@ namespace dolfin
     /// Refine mesh based on cell markers
     static void refine(Mesh& refined_mesh,
                        const Mesh& mesh,
-                       const MeshFunction<bool>& cell_markers);
+                       const MeshFunction<bool>& cell_markers,
+                       bool redistribute=false);
+
+    /// Refine mesh uniformly
+    static void refine(Mesh& refined_mesh,
+                       const Mesh& mesh,
+                       bool redistribute=false);
 
   };
 
diff --git a/dolfin/refinement/LocalMeshCoarsening.cpp b/dolfin/refinement/LocalMeshCoarsening.cpp
index 4141871..e98890a 100644
--- a/dolfin/refinement/LocalMeshCoarsening.cpp
+++ b/dolfin/refinement/LocalMeshCoarsening.cpp
@@ -72,7 +72,8 @@ void LocalMeshCoarsening::coarsen_mesh_by_edge_collapse(Mesh& mesh,
   Mesh coarse_mesh(mesh);
 
   // Initialise forbidden cells
-  MeshFunction<bool> cell_forbidden(mesh);
+  auto _mesh = reference_to_no_delete_pointer(mesh);
+  MeshFunction<bool> cell_forbidden(_mesh);
   cell_forbidden.init(mesh.topology().dim());
   for (CellIterator c(mesh); !c.end(); ++c)
     cell_forbidden[c->index()] = false;
@@ -95,12 +96,9 @@ void LocalMeshCoarsening::coarsen_mesh_by_edge_collapse(Mesh& mesh,
 
   // Define cell mapping between old and new mesh
   for (CellIterator c(mesh); !c.end(); ++c)
-  {
     old2new_cell[c->index()] = c->index();
-  }
 
   bool improving = true;
-
   while(improving)
   {
 
@@ -204,14 +202,16 @@ bool LocalMeshCoarsening::coarsen_cell(Mesh& mesh, Mesh& coarse_mesh,
   const std::size_t num_vertices = mesh.size(0);
   const std::size_t num_cells = mesh.size(mesh.topology().dim());
 
+  auto _mesh = reference_to_no_delete_pointer(mesh);
+
   // Initialise forbidden vertices
-  MeshFunction<bool> vertex_forbidden(mesh);
+  MeshFunction<bool> vertex_forbidden(_mesh);
   vertex_forbidden.init(0);
   for (VertexIterator v(mesh); !v.end(); ++v)
     vertex_forbidden[v->index()] = false;
 
   // Initialise boundary vertices
-  MeshFunction<bool> vertex_boundary(mesh);
+  MeshFunction<bool> vertex_boundary(_mesh);
   vertex_boundary.init(0);
   for (VertexIterator v(mesh); !v.end(); ++v)
     vertex_boundary[v->index()] = false;
@@ -243,13 +243,13 @@ bool LocalMeshCoarsening::coarsen_cell(Mesh& mesh, Mesh& coarse_mesh,
   editor.open(coarse_mesh, cell_type.cell_type(),
               mesh.topology().dim(), mesh.geometry().dim());
 
-  MeshFunction<bool> cell_to_remove(mesh);
+  MeshFunction<bool> cell_to_remove(_mesh);
   cell_to_remove.init(mesh.topology().dim());
 
   for (CellIterator ci(mesh); !ci.end(); ++ci)
     cell_to_remove[ci->index()] = false;
 
-  MeshFunction<bool> cell_to_regenerate(mesh);
+  MeshFunction<bool> cell_to_regenerate(_mesh);
   cell_to_regenerate.init(mesh.topology().dim());
   for (CellIterator ci(mesh); !ci.end(); ++ci)
     cell_to_regenerate[ci->index()] = false;
diff --git a/dolfin/refinement/LocalMeshRefinement.cpp b/dolfin/refinement/LocalMeshRefinement.cpp
deleted file mode 100644
index 10bf24c..0000000
--- a/dolfin/refinement/LocalMeshRefinement.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2011 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-02-07
-// Last changed: 2011-11-15
-
-#include <dolfin/parameter/GlobalParameters.h>
-#include <dolfin/log/log.h>
-#include <dolfin/mesh/Mesh.h>
-#include <dolfin/mesh/MeshFunction.h>
-#include "BisectionRefinement1D.h"
-#include "RegularCutRefinement.h"
-#include "PlazaRefinementND.h"
-#include "LocalMeshRefinement.h"
-
-using namespace dolfin;
-
-//-----------------------------------------------------------------------------
-void LocalMeshRefinement::refine(Mesh& refined_mesh,
-                                 const Mesh& mesh,
-                                 const MeshFunction<bool>& cell_markers)
-{
-  not_working_in_parallel("LocalMeshRefinement::refine");
-
-  // Count the number of marked cells
-  const std::size_t n0 = mesh.num_cells();
-  std::size_t n = 0;
-  for (std::size_t i = 0; i < cell_markers.size(); i++)
-  {
-    if (cell_markers[i])
-      n++;
-  }
-  info("%d cells out of %d marked for refinement (%.1f%%).",
-       n, n0, 100.0 * static_cast<double>(n) / static_cast<double>(n0));
-
-  // Call refinement algorithm
-  const std::string refinement_algorithm = parameters["refinement_algorithm"];
-  if (mesh.topology().dim() == 1)
-    BisectionRefinement1D::refine(refined_mesh, mesh, cell_markers);
-  else if (refinement_algorithm == "regular_cut")
-    RegularCutRefinement::refine(refined_mesh, mesh, cell_markers);
-  else if (refinement_algorithm == "plaza")
-    PlazaRefinementND::refine(refined_mesh, mesh, cell_markers, false, false);
-  else if (refinement_algorithm == "plaza_with_parent_facets")
-    PlazaRefinementND::refine(refined_mesh, mesh, cell_markers, false, true);
-  else
-    dolfin_error("LocalMeshRefinement.cpp",
-                 "refine mesh locally",
-                 "Unknown local mesh refinement algorithm: %s. Allowed algorithms are 'regular_cut', 'plaza', 'plaza_with_parent_facets'", refinement_algorithm.c_str());
-
-  // Report the number of refined cells
-  if (refined_mesh.topology().dim() > 0)
-  {
-    const std::size_t n1 = refined_mesh.num_cells();
-    info("Number of cells increased from %d to %d (%.1f%% increase).",
-         n0, n1, 100.0 * (static_cast<double>(n1) / static_cast<double>(n0) - 1.0));
-  }
-  else
-    info("Refined mesh is empty.");
-}
-//-----------------------------------------------------------------------------
diff --git a/dolfin/refinement/LocalMeshRefinement.h b/dolfin/refinement/LocalMeshRefinement.h
deleted file mode 100644
index 853ebe3..0000000
--- a/dolfin/refinement/LocalMeshRefinement.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2011 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2011-02-07
-// Last changed: 2011-02-07
-
-#ifndef __LOCAL_MESH_REFINEMENT_H
-#define __LOCAL_MESH_REFINEMENT_H
-
-namespace dolfin
-{
-
-  class Mesh;
-  template<typename T> class MeshFunction;
-
-  /// This class is provides functionality for local (adaptive) mesh
-  /// refinement. It is a wrapper for various algorithms for local
-  /// mesh refinement implemented as part of DOLFIN and it delegates
-  /// the refinement to a particular refinement algorithm based on the
-  /// value of the global parameter "refinement_algorithm".
-
-  class LocalMeshRefinement
-  {
-  public:
-
-    /// Refine mesh based on cell markers
-    static void refine(Mesh& refined_mesh,
-                       const Mesh& mesh,
-                       const MeshFunction<bool>& cell_markers);
-
-  };
-
-}
-
-#endif
diff --git a/dolfin/refinement/ParallelRefinement.cpp b/dolfin/refinement/ParallelRefinement.cpp
index bb43e83..5abaf92 100644
--- a/dolfin/refinement/ParallelRefinement.cpp
+++ b/dolfin/refinement/ParallelRefinement.cpp
@@ -34,6 +34,7 @@
 #include <dolfin/mesh/MeshEntityIterator.h>
 #include <dolfin/mesh/MeshPartitioning.h>
 #include <dolfin/mesh/Vertex.h>
+#include <dolfin/parameter/GlobalParameters.h>
 
 #include "ParallelRefinement.h"
 
@@ -285,51 +286,51 @@ void ParallelRefinement::build_local(Mesh& new_mesh) const
 void ParallelRefinement::partition(Mesh& new_mesh, bool redistribute) const
 {
   LocalMeshData mesh_data(new_mesh.mpi_comm());
-  mesh_data.tdim = _mesh.topology().dim();
+  mesh_data.topology.dim = _mesh.topology().dim();
   const std::size_t gdim = _mesh.geometry().dim();
-  mesh_data.gdim = gdim;
+  mesh_data.geometry.dim = gdim;
 
-  mesh_data.cell_type = _mesh.type().cell_type();
-  mesh_data.num_vertices_per_cell = mesh_data.tdim + 1;
+  mesh_data.topology.cell_type = _mesh.type().cell_type();
+  mesh_data.topology.num_vertices_per_cell = mesh_data.topology.dim + 1;
 
   // Copy data to LocalMeshData structures
   const std::size_t num_local_cells
-    = new_cell_topology.size()/mesh_data.num_vertices_per_cell;
-  mesh_data.num_global_cells = MPI::sum(_mesh.mpi_comm(), num_local_cells);
-  mesh_data.global_cell_indices.resize(num_local_cells);
+    = new_cell_topology.size()/mesh_data.topology.num_vertices_per_cell;
+  mesh_data.topology.num_global_cells = MPI::sum(_mesh.mpi_comm(), num_local_cells);
+  mesh_data.topology.global_cell_indices.resize(num_local_cells);
   const std::size_t idx_global_offset
     = MPI::global_offset(_mesh.mpi_comm(), num_local_cells, true);
   for (std::size_t i = 0; i < num_local_cells ; i++)
-    mesh_data.global_cell_indices[i] = idx_global_offset + i;
+    mesh_data.topology.global_cell_indices[i] = idx_global_offset + i;
 
-  mesh_data.cell_vertices.resize(boost::extents[num_local_cells]
-                                 [mesh_data.num_vertices_per_cell]);
+  mesh_data.topology.cell_vertices.resize(boost::extents[num_local_cells]
+                                 [mesh_data.topology.num_vertices_per_cell]);
   std::copy(new_cell_topology.begin(), new_cell_topology.end(),
-            mesh_data.cell_vertices.data());
+            mesh_data.topology.cell_vertices.data());
 
   const std::size_t num_local_vertices = new_vertex_coordinates.size()/gdim;
-  mesh_data.num_global_vertices = MPI::sum(_mesh.mpi_comm(),
-                                           num_local_vertices);
-  mesh_data.vertex_coordinates.resize(boost::extents[num_local_vertices]
-                                      [gdim]);
+  mesh_data.geometry.num_global_vertices = MPI::sum(_mesh.mpi_comm(),
+                                                    num_local_vertices);
+  mesh_data.geometry.vertex_coordinates.resize(boost::extents[num_local_vertices][gdim]);
   std::copy(new_vertex_coordinates.begin(), new_vertex_coordinates.end(),
-            mesh_data.vertex_coordinates.data());
+            mesh_data.geometry.vertex_coordinates.data());
 
-  mesh_data.vertex_indices.resize(num_local_vertices);
+  mesh_data.geometry.vertex_indices.resize(num_local_vertices);
   const std::size_t vertex_global_offset
     = MPI::global_offset(_mesh.mpi_comm(), num_local_vertices, true);
   for (std::size_t i = 0; i < num_local_vertices ; ++i)
-    mesh_data.vertex_indices[i] = vertex_global_offset + i;
+    mesh_data.geometry.vertex_indices[i] = vertex_global_offset + i;
 
   if (!redistribute)
   {
     // FIXME: broken by ghost mesh?
     // Set owning process rank to this process rank
-    mesh_data.cell_partition.assign(mesh_data.global_cell_indices.size(),
-                                    MPI::rank(_mesh.mpi_comm()));
+    mesh_data.topology.cell_partition.assign(mesh_data.topology.global_cell_indices.size(),
+                                            MPI::rank(_mesh.mpi_comm()));
   }
 
-  MeshPartitioning::build_distributed_mesh(new_mesh, mesh_data);
+  const std::string ghost_mode = dolfin::parameters["ghost_mode"];
+  MeshPartitioning::build_distributed_mesh(new_mesh, mesh_data, ghost_mode);
 }
 //-----------------------------------------------------------------------------
 void ParallelRefinement::new_cell(const Cell& cell)
@@ -355,7 +356,7 @@ void ParallelRefinement::new_cell(const std::size_t i0, const std::size_t i1,
   new_cell_topology.push_back(i2);
 }
 //-----------------------------------------------------------------------------
-void ParallelRefinement::new_cell(const std::vector<std::size_t>& idx)
+void ParallelRefinement::new_cells(const std::vector<std::size_t>& idx)
 {
   new_cell_topology.insert(new_cell_topology.end(), idx.begin(), idx.end());
 }
diff --git a/dolfin/refinement/ParallelRefinement.h b/dolfin/refinement/ParallelRefinement.h
index a3a5291..4329d38 100644
--- a/dolfin/refinement/ParallelRefinement.h
+++ b/dolfin/refinement/ParallelRefinement.h
@@ -86,7 +86,7 @@ namespace dolfin
     void new_cell(std::size_t i0, std::size_t i1, std::size_t i2,
                   std::size_t i3);
     void new_cell(std::size_t i0, std::size_t i1, std::size_t i2);
-    void new_cell(const std::vector<std::size_t>& idx);
+    void new_cells(const std::vector<std::size_t>& idx);
 
     /// Use vertex and topology data to partition new mesh across processes
     void partition(Mesh& new_mesh, bool redistribute) const;
diff --git a/dolfin/refinement/PlazaRefinementND.cpp b/dolfin/refinement/PlazaRefinementND.cpp
index 1dba8bb..aee82fa 100644
--- a/dolfin/refinement/PlazaRefinementND.cpp
+++ b/dolfin/refinement/PlazaRefinementND.cpp
@@ -19,6 +19,7 @@
 
 #include <boost/multi_array.hpp>
 
+#include <limits>
 #include <vector>
 #include <set>
 #include <map>
@@ -40,15 +41,15 @@ using namespace dolfin;
 
 //-----------------------------------------------------------------------------
 void PlazaRefinementND::get_simplices(
-  std::vector<std::vector<std::size_t>>& simplex_set,
+  std::vector<std::size_t>& simplex_set,
   const std::vector<bool>& marked_edges,
   const std::vector<std::size_t>& longest_edge,
-  std::size_t tdim)
+  std::size_t tdim, bool uniform)
 {
   if (tdim == 2)
   {
     dolfin_assert(longest_edge.size() == 1);
-    get_triangles(simplex_set, marked_edges, longest_edge[0]);
+    get_triangles(simplex_set, marked_edges, longest_edge[0], uniform);
   }
   else if (tdim == 3)
   {
@@ -58,9 +59,10 @@ void PlazaRefinementND::get_simplices(
 }
 //-----------------------------------------------------------------------------
 void PlazaRefinementND::get_triangles
-(std::vector<std::vector<std::size_t>>& tri_set,
+(std::vector<std::size_t>& tri_set,
  const std::vector<bool>& marked_edges,
- const std::size_t longest_edge)
+ const std::size_t longest_edge,
+ bool uniform)
 {
   Timer t0("PLAZA: Get triangles");
 
@@ -78,29 +80,38 @@ void PlazaRefinementND::get_triangles
   const unsigned int e1 = v1 + 3;
   const unsigned int e2 = v2 + 3;
 
-  // Break each half of triangle into one or two sub-triangles
+  // If all edges marked, consider uniform refinement
+  if (uniform and marked_edges[v0] and marked_edges[v1])
+  {
+    tri_set = {e0, e1, v2,
+               e1, e2, v0,
+               e2, e0, v1,
+               e2, e1, e0};
+    return;
+  }
 
+  // Break each half of triangle into one or two sub-triangles
   if (marked_edges[v0])
   {
-    tri_set.push_back(std::vector<std::size_t>{e2, v2, e0});
-    tri_set.push_back(std::vector<std::size_t>{e2, e0, v1});
+    tri_set = {e2, v2, e0,
+               e2, e0, v1};
   }
   else
-    tri_set.push_back(std::vector<std::size_t>{e2, v2, v1});
+    tri_set = {e2, v2, v1};
 
   if (marked_edges[v1])
   {
-    tri_set.push_back(std::vector<std::size_t>{e2, v2, e1});
-    tri_set.push_back(std::vector<std::size_t>{e2, e1, v0});
+    tri_set.insert(tri_set.end(), {e2, v2, e1});
+    tri_set.insert(tri_set.end(), {e2, e1, v0});
   }
   else
-    tri_set.push_back(std::vector<std::size_t>{e2, v2, v0});
+    tri_set.insert(tri_set.end(), {e2, v2, v0});
 }
 //-----------------------------------------------------------------------------
 void PlazaRefinementND::get_tetrahedra(
-  std::vector<std::vector<std::size_t>>& tet_set,
+  std::vector<std::size_t>& tet_set,
   const std::vector<bool>& marked_edges,
-  const std::vector<std::size_t> longest_edge)
+  const std::vector<std::size_t>& longest_edge)
 {
   Timer t0("PLAZA: Get tetrahedra");
 
@@ -184,68 +195,92 @@ void PlazaRefinementND::get_tetrahedra(
   for (std::size_t i = 0; i < 10; ++i)
   {
     for (std::size_t j = i + 1; j < 10; ++j)
+    {
       if (conn[i][j])
       {
         facet_set.clear();
         for (std::size_t k = j + 1; k < 10; ++k)
         {
           if (conn[i][k] && conn[j][k])
-            facet_set.push_back(k);
-        }
-        // Note that j>i and k>j. facet_set is in increasing order, so *q > *p.
-        // Should never repeat same tetrahedron twice.
-        for(auto p = facet_set.begin(); p != facet_set.end(); ++p)
-        {
-          for(auto q = p + 1; q != facet_set.end(); ++q)
           {
-            if(conn[*p][*q])
-            {
-              std::vector<std::size_t> tet{i, j, *p, *q};
-              tet_set.push_back(tet);
-            }
+            // Note that i < j < m < k
+            for (const auto &m : facet_set)
+              if (conn[m][k])
+                tet_set.insert(tet_set.end(), {i, j, m, k});
+            facet_set.push_back(k);
           }
         }
       }
+    }
   }
 }
 //-----------------------------------------------------------------------------
-std::vector<std::size_t> PlazaRefinementND::face_long_edge(const Mesh& mesh)
+void PlazaRefinementND::face_long_edge(std::vector<unsigned int>& long_edge,
+                                       std::vector<bool>& edge_ratio_ok,
+                                       const Mesh& mesh)
 {
   Timer t0("PLAZA: Face long edge");
-
+  const std::size_t tdim = mesh.topology().dim();
+  mesh.init(1);
   mesh.init(2);
-  std::vector<std::size_t> result(mesh.num_faces());
+  mesh.init(2, 1);
+
+  // Storage for face-local index of longest edge
+  long_edge.resize(mesh.num_faces());
+
+  // Check mesh face quality (may be used in 2D to switch to "uniform" refinement)
+  const double min_ratio = sqrt(2.0)/2.0;
+  if (tdim == 2)
+    edge_ratio_ok.resize(mesh.num_faces());
+
+  // Store all edge lengths in Mesh to save recalculating for each Face
+  std::vector<double> edge_length(mesh.num_edges());
+  for (EdgeIterator e(mesh); !e.end(); ++e)
+    edge_length[e->index()] = e->length();
 
   // Get longest edge of each face
   for (FaceIterator f(mesh); !f.end(); ++f)
   {
+    const unsigned int* face_edges = f->entities(1);
+
     std::size_t imax = 0;
-    std::size_t gimax = 0;
     double max_len = 0.0;
+    double min_len = std::numeric_limits<double>::max();
 
-    // Use vertex global index to decide ordering
-    // if lengths are equal
-    for (EdgeIterator e(*f); !e.end(); ++e)
+    for (unsigned int i = 0; i < 3; ++i)
     {
-      const double e_len = e->length();
-      const Vertex v(mesh, f->entities(0)[e.pos()]);
-      const std::size_t global_i = v.global_index();
-      if (e_len > max_len or (e_len == max_len and global_i > gimax))
+      const double e_len = edge_length[face_edges[i]];
+
+      min_len = std::min(e_len, min_len);
+
+      if (e_len > max_len)
       {
         max_len = e_len;
-        imax = e->index();
-        gimax = global_i;
+        imax = i;
+      }
+      else if (tdim == 3 and e_len == max_len)
+      {
+        // If edges are the same length, compare global index of opposite vertex.
+        // Only important so that tetrahedral faces have a matching refinement pattern
+        // across processes.
+        const Vertex vmax(mesh, f->entities(0)[imax]);
+        const Vertex vi(mesh, f->entities(0)[i]);
+        if (vi.global_index() > vmax.global_index())
+          imax = i;
       }
     }
-    result[f->index()] = imax;
-  }
 
-  return result;
+    // Only save edge ratio in 2D
+    if (tdim == 2)
+      edge_ratio_ok[f->index()] = (min_len/max_len >= min_ratio);
+
+    long_edge[f->index()] = face_edges[imax];
+  }
 }
 //-----------------------------------------------------------------------------
 void PlazaRefinementND::enforce_rules(ParallelRefinement& p_ref,
                                       const Mesh& mesh,
-                                      const std::vector<std::size_t>& long_edge)
+                                      const std::vector<unsigned int>& long_edge)
 {
   Timer t0("PLAZA: Enforce rules");
 
@@ -289,13 +324,15 @@ void PlazaRefinementND::refine(Mesh& new_mesh, const Mesh& mesh,
   }
 
   Timer t0("PLAZA: refine");
-  std::vector<std::size_t> long_edge = face_long_edge(mesh);
+  std::vector<unsigned int> long_edge;
+  std::vector<bool> edge_ratio_ok;
+  face_long_edge(long_edge, edge_ratio_ok, mesh);
 
   ParallelRefinement p_ref(mesh);
   p_ref.mark_all();
 
   MeshRelation mesh_relation;
-  do_refine(new_mesh, mesh, p_ref, long_edge, redistribute,
+  do_refine(new_mesh, mesh, p_ref, long_edge, edge_ratio_ok, redistribute,
             calculate_parent_facets, mesh_relation);
 }
 //-----------------------------------------------------------------------------
@@ -313,7 +350,9 @@ void PlazaRefinementND::refine(Mesh& new_mesh, const Mesh& mesh,
   }
 
   Timer t0("PLAZA: refine");
-  std::vector<std::size_t> long_edge = face_long_edge(mesh);
+  std::vector<unsigned int> long_edge;
+  std::vector<bool> edge_ratio_ok;
+  face_long_edge(long_edge, edge_ratio_ok, mesh);
 
   ParallelRefinement p_ref(mesh);
   p_ref.mark(refinement_marker);
@@ -321,7 +360,7 @@ void PlazaRefinementND::refine(Mesh& new_mesh, const Mesh& mesh,
   enforce_rules(p_ref, mesh, long_edge);
 
   MeshRelation mesh_relation;
-  do_refine(new_mesh, mesh, p_ref, long_edge, redistribute,
+  do_refine(new_mesh, mesh, p_ref, long_edge, edge_ratio_ok, redistribute,
             calculate_parent_facets, mesh_relation);
 }
 //-----------------------------------------------------------------------------
@@ -339,20 +378,23 @@ void PlazaRefinementND::refine(Mesh& new_mesh, const Mesh& mesh,
   }
 
   Timer t0("PLAZA: refine");
-  std::vector<std::size_t> long_edge = face_long_edge(mesh);
+  std::vector<unsigned int> long_edge;
+  std::vector<bool> edge_ratio_ok;
+  face_long_edge(long_edge, edge_ratio_ok, mesh);
 
   ParallelRefinement p_ref(mesh);
   p_ref.mark(refinement_marker);
 
   enforce_rules(p_ref, mesh, long_edge);
 
-  do_refine(new_mesh, mesh, p_ref, long_edge, false,
+  do_refine(new_mesh, mesh, p_ref, long_edge, edge_ratio_ok, false,
             calculate_parent_facets, mesh_relation);
 }
 //-----------------------------------------------------------------------------
 void PlazaRefinementND::do_refine(Mesh& new_mesh, const Mesh& mesh,
                                   ParallelRefinement& p_ref,
-                                  const std::vector<std::size_t>& long_edge,
+                                  const std::vector<unsigned int>& long_edge,
+                                  const std::vector<bool>& edge_ratio_ok,
                                   bool redistribute,
                                   bool calculate_parent_facets,
                                   MeshRelation& mesh_relation)
@@ -369,6 +411,7 @@ void PlazaRefinementND::do_refine(Mesh& new_mesh, const Mesh& mesh,
   std::vector<std::size_t> parent_cell;
   std::vector<std::size_t> indices(num_cell_vertices + num_cell_edges);
   std::vector<std::size_t> marked_edge_list;
+  std::vector<std::size_t> simplex_set;
 
   for (CellIterator cell(mesh); !cell.end(); ++cell)
   {
@@ -382,8 +425,7 @@ void PlazaRefinementND::do_refine(Mesh& new_mesh, const Mesh& mesh,
 
     if (marked_edge_list.size() == 0)
     {
-      indices.resize(num_cell_vertices);
-      p_ref.new_cell(indices);
+      p_ref.new_cell(*cell);
       parent_cell.push_back(cell->index());
     }
     else
@@ -404,13 +446,8 @@ void PlazaRefinementND::do_refine(Mesh& new_mesh, const Mesh& mesh,
 
       // Need longest edges of each facet in cell local indexing
       std::vector<std::size_t> longest_edge;
-      if (tdim == 3)
-      {
-        for (FaceIterator f(*cell); !f.end(); ++f)
-          longest_edge.push_back(long_edge[f->index()]);
-      }
-      else if (tdim == 2)
-        longest_edge.push_back(long_edge[cell->index()]);
+      for (FaceIterator f(*cell); !f.end(); ++f)
+        longest_edge.push_back(long_edge[f->index()]);
 
       // Convert to cell local index
       for (auto &p : longest_edge)
@@ -425,17 +462,20 @@ void PlazaRefinementND::do_refine(Mesh& new_mesh, const Mesh& mesh,
         }
       }
 
-      std::vector<std::vector<std::size_t>> simplex_set;
-      get_simplices(simplex_set, markers, longest_edge, tdim);
+      const bool uniform
+        = (tdim == 2) ? edge_ratio_ok[cell->index()] : false;
 
-      // Convert from cell local index to mesh index
-      for (auto &it : simplex_set)
-      {
-        for (auto &vit : it)
-          vit = indices[vit];
-        p_ref.new_cell(it);
+      get_simplices(simplex_set, markers, longest_edge, tdim, uniform);
+
+      // Save parent index
+      const std::size_t ncells = simplex_set.size()/num_cell_vertices;
+      for (std::size_t i = 0; i != ncells; ++i)
         parent_cell.push_back(cell->index());
-      }
+
+      // Convert from cell local index to mesh index and add to cells
+      for (auto &it : simplex_set)
+        it = indices[it];
+      p_ref.new_cells(simplex_set);
     }
   }
 
diff --git a/dolfin/refinement/PlazaRefinementND.h b/dolfin/refinement/PlazaRefinementND.h
index 49c40e8..028b53a 100644
--- a/dolfin/refinement/PlazaRefinementND.h
+++ b/dolfin/refinement/PlazaRefinementND.h
@@ -56,34 +56,39 @@ namespace dolfin
 
     /// Get the subdivision of an original simplex into smaller
     /// simplices, for a given set of marked edges, and the
-    /// longest edge of each facet (cell local indexing)
+    /// longest edge of each facet (cell local indexing).
+    /// A flag indicates if a uniform subdivision is preferable in 2D.
     static void get_simplices
-      (std::vector<std::vector<std::size_t> >& simplex_set,
+      (std::vector<std::size_t>& simplex_set,
        const std::vector<bool>& marked_edges,
        const std::vector<std::size_t>& longest_edge,
-       std::size_t tdim);
+       std::size_t tdim, bool uniform);
 
   private:
 
     // Get the longest edge of each face (using local mesh index)
-    static std::vector<std::size_t> face_long_edge(const Mesh& mesh);
+    static void face_long_edge(std::vector<unsigned int>& long_edge,
+                               std::vector<bool>& edge_ratio_ok,
+                               const Mesh& mesh);
 
-    // 2D version of subdivision
+    // 2D version of subdivision allowing for uniform subdivision (flag)
     static void get_triangles
-      (std::vector<std::vector<std::size_t> >& tri_set,
+      (std::vector<std::size_t>& tri_set,
        const std::vector<bool>& marked_edges,
-       const std::size_t longest_edge);
+       const std::size_t longest_edge,
+       bool uniform);
 
     // 3D version of subdivision
     static void get_tetrahedra
-      (std::vector<std::vector<std::size_t> >& tet_set,
+      (std::vector<std::size_t>& tet_set,
        const std::vector<bool>& marked_edges,
-       const std::vector<std::size_t> longest_edge);
+       const std::vector<std::size_t>& longest_edge);
 
     // Convenient interface for both uniform and marker refinement
     static void do_refine(Mesh& new_mesh, const Mesh& mesh,
                           ParallelRefinement& p_ref,
-                          const std::vector<std::size_t>& long_edge,
+                          const std::vector<unsigned int>& long_edge,
+                          const std::vector<bool>& edge_ratio_ok,
                           bool redistribute,
                           bool calculate_parent_facets,
                           MeshRelation& mesh_relation);
@@ -92,7 +97,7 @@ namespace dolfin
     // of each face must be marked, if any edge of face is marked)
     static void enforce_rules(ParallelRefinement& p_ref,
                               const Mesh& mesh,
-                              const std::vector<std::size_t>& long_edge);
+                              const std::vector<unsigned int>& long_edge);
 
     // Add parent facet markers to new mesh, based on new vertices
     // Only works in 2D at present
diff --git a/dolfin/refinement/RegularCutRefinement.cpp b/dolfin/refinement/RegularCutRefinement.cpp
index 4d62ae8..475f462 100644
--- a/dolfin/refinement/RegularCutRefinement.cpp
+++ b/dolfin/refinement/RegularCutRefinement.cpp
@@ -196,7 +196,7 @@ RegularCutRefinement::compute_markers(std::vector<int>& refinement_markers,
 
     // No refinement
     if (num_marked == 0)
-      refinement_markers[i] = no_refinement;
+      refinement_markers[i] = static_cast<int>(marker_type::no_refinement);
 
     // Mark for bisection
     else if (num_marked == 1 && !is_bisected)
@@ -204,21 +204,23 @@ RegularCutRefinement::compute_markers(std::vector<int>& refinement_markers,
 
     // Mark for regular refinement
     else if (num_marked == edges_per_cell && !is_bisected)
-      refinement_markers[i] = regular_refinement;
+      refinement_markers[i] = static_cast<int>(marker_type::regular_refinement);
 
     // Mark for bisection backtracking
     else if (num_marked == 2 && is_bisected)
-      refinement_markers[i] = backtrack_bisection;
+      refinement_markers[i] = static_cast<int>(marker_type::backtrack_bisection);
 
     // Mark for bisection backtracking and refinement
     else if (num_marked == edges_per_cell && is_bisected)
-      refinement_markers[i] = backtrack_bisection_refine;
+      refinement_markers[i] = static_cast<int>(marker_type::backtrack_bisection_refine);
 
     // Sanity check
     else
+    {
       dolfin_error("RegularCutRefinement.cpp",
                    "compute marked edges",
                    "Unexpected number of edges marked");
+    }
   }
 }
 //-----------------------------------------------------------------------------
@@ -238,16 +240,16 @@ void RegularCutRefinement::refine_marked(Mesh& refined_mesh,
     const int marker = refinement_markers[cell->index()];
     switch (marker)
     {
-    case no_refinement:
+    case static_cast<int>(marker_type::no_refinement):
       num_cells += 1;
       break;
-    case regular_refinement:
+    case static_cast<int>(marker_type::regular_refinement):
       num_cells += 4;
       break;
-    case backtrack_bisection:
+    case static_cast<int>(marker_type::backtrack_bisection):
       num_cells += 2;
       break;
-    case backtrack_bisection_refine:
+    case static_cast<int>(marker_type::backtrack_bisection_refine):
       num_cells += 3;
       break;
     default:
@@ -302,11 +304,9 @@ void RegularCutRefinement::refine_marked(Mesh& refined_mesh,
   {
     // Get marker
     const int marker = refinement_markers[cell->index()];
-
-    if (marker == no_refinement)
+    if (marker == static_cast<int>(marker_type::no_refinement))
     {
       // No refinement: just copy cell to new mesh
-
       std::vector<std::size_t> vertices;
       for (VertexIterator vertex(*cell); !vertex.end(); ++vertex)
         vertices.push_back(vertex->index());
@@ -320,7 +320,7 @@ void RegularCutRefinement::refine_marked(Mesh& refined_mesh,
       {
         const std::size_t bisection_twin = (*bisection_twins)[cell->index()];
         const int twin_marker = refinement_markers[bisection_twin];
-        dolfin_assert(twin_marker == no_refinement);
+        dolfin_assert(twin_marker == static_cast<int>(marker_type::no_refinement));
         if (unrefined_cells[bisection_twin] >= 0)
         {
           const std::size_t i = current_cell - 1;
@@ -330,7 +330,7 @@ void RegularCutRefinement::refine_marked(Mesh& refined_mesh,
         }
       }
     }
-    else if (marker == regular_refinement)
+    else if (marker == static_cast<int>(marker_type::regular_refinement))
     {
       // Regular refinement: divide into sub-simplices
       dolfin_assert(unrefined_cells[cell->index()] == -1);
@@ -363,8 +363,8 @@ void RegularCutRefinement::refine_marked(Mesh& refined_mesh,
       for (_cell = cells.begin(); _cell != cells.end(); ++_cell)
         editor.add_cell(current_cell++, *_cell);
     }
-    else if (marker == backtrack_bisection
-             || marker == backtrack_bisection_refine)
+    else if (marker == static_cast<int>(marker_type::backtrack_bisection)
+             || marker ==static_cast<int>(marker_type::backtrack_bisection_refine))
     {
       // Special case: backtrack bisected cells
       dolfin_assert(unrefined_cells[cell->index()] == -1);
@@ -417,10 +417,13 @@ void RegularCutRefinement::refine_marked(Mesh& refined_mesh,
       // Locate new vertices on bisected edge (if any)
       std::size_t E0 = 0;
       std::size_t E1 = 0;
-      if (marker == backtrack_bisection_refine)
+      if (marker == static_cast<int>(marker_type::backtrack_bisection_refine))
         E0 = offset + marked_edges.find(edges_0[bisection_edges.first]);
-      if (twin_marker == backtrack_bisection_refine)
+      if (twin_marker
+          == static_cast<int>(marker_type::backtrack_bisection_refine))
+      {
         E1 = offset + marked_edges.find(edges_1[bisection_edges.second]);
+      }
 
       // Add middle two cells (always)
       dolfin_assert(cell_data.size() == 3);
@@ -431,7 +434,7 @@ void RegularCutRefinement::refine_marked(Mesh& refined_mesh,
       editor.add_cell(current_cell++, cell_data);
 
       // Add one or two remaining cells in current cell (left)
-      if (marker == backtrack_bisection)
+      if (marker == static_cast<int>(marker_type::backtrack_bisection))
       {
         cell_data[0] = v0; cell_data[1] = e2; cell_data[2] = e1;
         editor.add_cell(current_cell++, cell_data);
@@ -451,7 +454,7 @@ void RegularCutRefinement::refine_marked(Mesh& refined_mesh,
       }
 
       // Add one or two remaining cells in twin cell (right)
-      if (twin_marker == backtrack_bisection)
+      if (twin_marker == static_cast<int>(marker_type::backtrack_bisection))
       {
         cell_data[0] = v1; cell_data[1] = e0; cell_data[2] = e2;
         editor.add_cell(current_cell++, cell_data);
diff --git a/dolfin/refinement/RegularCutRefinement.h b/dolfin/refinement/RegularCutRefinement.h
index 8f2a400..368119b 100644
--- a/dolfin/refinement/RegularCutRefinement.h
+++ b/dolfin/refinement/RegularCutRefinement.h
@@ -47,7 +47,8 @@ namespace dolfin
   private:
 
     // Refinement markers
-    enum { no_refinement=-1, regular_refinement=-2, backtrack_bisection=-3, backtrack_bisection_refine=-4 };
+    enum class marker_type : int { no_refinement=-1, regular_refinement=-2,
+        backtrack_bisection=-3, backtrack_bisection_refine=-4 };
 
     // Compute refinement markers based on initial markers
     static void compute_markers(std::vector<int>& refinement_markers,
diff --git a/dolfin/refinement/UniformMeshRefinement.cpp b/dolfin/refinement/UniformMeshRefinement.cpp
deleted file mode 100644
index 75835d3..0000000
--- a/dolfin/refinement/UniformMeshRefinement.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (C) 2006-2010 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Garth N. Wells, 2010
-//
-// First added:  2006-06-08
-// Last changed: 2014-02-06
-
-#include <dolfin/math/basic.h>
-#include <dolfin/log/log.h>
-#include <dolfin/mesh/Mesh.h>
-#include <dolfin/mesh/MeshTopology.h>
-#include <dolfin/mesh/MeshGeometry.h>
-#include <dolfin/mesh/MeshConnectivity.h>
-#include <dolfin/mesh/MeshEditor.h>
-#include <dolfin/mesh/Vertex.h>
-#include <dolfin/mesh/Edge.h>
-#include <dolfin/mesh/Cell.h>
-#include "UniformMeshRefinement.h"
-
-using namespace dolfin;
-
-//-----------------------------------------------------------------------------
-void UniformMeshRefinement::refine(Mesh& refined_mesh,
-                                   const Mesh& mesh)
-{
-  not_working_in_parallel("UniformMeshRefinement::refine");
-
-  log(TRACE, "Refining simplicial mesh uniformly.");
-
-  // Check that refined_mesh and mesh are not the same
-  if (&refined_mesh == &mesh)
-  {
-    dolfin_error("UniformMeshRefinement.cpp",
-                 "refine mesh",
-                 "Refined_mesh and mesh point to the same object");
-  }
-
-  // Generate cell - edge connectivity if not generated
-  mesh.init(mesh.topology().dim(), 1);
-
-  // Generate edge - vertex connectivity if not generated
-  mesh.init(1, 0);
-
-  // Mesh needs to be ordered (so we can pick right combination of vertices/edges)
-  if (!mesh.ordered())
-    dolfin_error("UniformMeshRefinement.cpp",
-                 "refine mesh",
-                 "Mesh is not ordered according to the UFC numbering convention, consider calling mesh.order()");
-
-  // Get cell type
-  const CellType& cell_type = mesh.type();
-
-  // Open new mesh for editing
-  MeshEditor editor;
-  editor.open(refined_mesh, cell_type.cell_type(),
-              mesh.topology().dim(), mesh.geometry().dim());
-
-  // Get size of mesh
-  const std::size_t num_vertices = mesh.size(0);
-  const std::size_t num_edges = mesh.size(1);
-  const std::size_t num_cells = mesh.size(mesh.topology().dim());
-
-  // Specify number of vertices and cells
-  editor.init_vertices_global(num_vertices + num_edges, num_vertices + num_edges);
-  editor.init_cells_global(ipow(2, mesh.topology().dim())*num_cells,
-                           ipow(2, mesh.topology().dim())*num_cells);
-
-  // Add old vertices
-  std::size_t vertex = 0;
-  for (VertexIterator v(mesh); !v.end(); ++v)
-  {
-    editor.add_vertex(vertex, v->point());
-    vertex++;
-  }
-
-  // Add new vertices
-  for (EdgeIterator e(mesh); !e.end(); ++e)
-  {
-    editor.add_vertex(vertex, e->midpoint());
-    vertex++;
-  }
-
-  // Add cells
-  std::size_t current_cell = 0;
-  for (CellIterator c(mesh); !c.end(); ++c)
-    cell_type.refine_cell(*c, editor, current_cell);
-
-  // Close editor
-  editor.close();
-
-  // Make sure that mesh is ordered after refinement
-  //refined_mesh.order();
-}
-//-----------------------------------------------------------------------------
diff --git a/dolfin/refinement/refine.cpp b/dolfin/refinement/refine.cpp
index f88dccd..59480b8 100644
--- a/dolfin/refinement/refine.cpp
+++ b/dolfin/refinement/refine.cpp
@@ -22,11 +22,15 @@
 
 #include <dolfin/parameter/GlobalParameters.h>
 #include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MeshEditor.h>
+#include <dolfin/mesh/Cell.h>
+#include <dolfin/mesh/Edge.h>
+#include <dolfin/mesh/Vertex.h>
 #include <dolfin/mesh/MeshHierarchy.h>
 #include <dolfin/mesh/MeshFunction.h>
-#include "UniformMeshRefinement.h"
-#include "LocalMeshRefinement.h"
+#include "BisectionRefinement1D.h"
 #include "PlazaRefinementND.h"
+#include "RegularCutRefinement.h"
 #include "refine.h"
 
 using namespace dolfin;
@@ -53,23 +57,25 @@ void dolfin::refine(Mesh& refined_mesh, const Mesh& mesh, bool redistribute)
 
   const std::string refinement_algorithm = parameters["refinement_algorithm"];
   bool parent_facets = (refinement_algorithm == "plaza_with_parent_facets");
-  bool serial = (MPI::size(mesh.mpi_comm()) == 1);
 
   // Dispatch to appropriate refinement function
-  if (serial and (D == 1 or refinement_algorithm == "regular_cut"))
-    UniformMeshRefinement::refine(refined_mesh, mesh);
+  if (D == 1)
+    BisectionRefinement1D::refine(refined_mesh, mesh, redistribute);
   else if(D == 2 or D == 3)
-  {
-    if (refinement_algorithm == "regular_cut")
-      warning("Using Plaza algorithm in parallel");
     PlazaRefinementND::refine(refined_mesh, mesh, redistribute, parent_facets);
-  }
   else
   {
     dolfin_error("refine.cpp",
                  "refine mesh",
-                 "Cannot refine mesh of topological dimension %d in parallel. Only 2D and 3D supported", D);
+                 "Cannot refine mesh of topological dimension %d", D);
   }
+
+  // Report the number of refined cells
+  const std::size_t n0 = mesh.size_global(D);
+  const std::size_t n1 = refined_mesh.size_global(D);
+  info("Number of cells increased from %d to %d (%.1f%% increase).",
+       n0, n1, 100.0 * (static_cast<double>(n1) / static_cast<double>(n0) - 1.0));
+
 }
 //-----------------------------------------------------------------------------
 dolfin::Mesh dolfin::refine(const Mesh& mesh,
@@ -89,24 +95,83 @@ void dolfin::refine(Mesh& refined_mesh, const Mesh& mesh,
 
   const std::string refinement_algorithm = parameters["refinement_algorithm"];
   bool parent_facets = (refinement_algorithm == "plaza_with_parent_facets");
-  bool serial = (MPI::size(mesh.mpi_comm()) == 1);
+
+
 
   // Dispatch to appropriate refinement function
-  if (serial and (D == 1 or refinement_algorithm == "regular_cut"))
-    LocalMeshRefinement::refine(refined_mesh, mesh, cell_markers);
+  if (D == 1)
+    BisectionRefinement1D::refine(refined_mesh, mesh, cell_markers, redistribute);
+  else if (refinement_algorithm == "regular_cut")
+    RegularCutRefinement::refine(refined_mesh, mesh, cell_markers);
   else if (D == 2 or D == 3)
-  {
-    if (refinement_algorithm == "regular_cut")
-      warning("Using Plaza algorithm in parallel");
-
     PlazaRefinementND::refine(refined_mesh, mesh, cell_markers,
                               redistribute, parent_facets);
-  }
   else
   {
     dolfin_error("refine.cpp",
                  "refine mesh",
-                 "Cannot refine mesh of topological dimension %d in parallel. Only 2D and 3D supported", D);
+                 "Cannot refine mesh of topological dimension %d", D);
   }
+
+  // Report the number of refined cells
+  const std::size_t n0 = mesh.size_global(D);
+  const std::size_t n1 = refined_mesh.size_global(D);
+  info("Number of cells increased from %d to %d (%.1f%% increase).",
+       n0, n1, 100.0 * (static_cast<double>(n1) / static_cast<double>(n0) - 1.0));
+
+}
+//-----------------------------------------------------------------------------
+dolfin::Mesh dolfin::p_refine(const Mesh& mesh)
+{
+  Mesh refined_mesh;
+  p_refine(refined_mesh, mesh);
+  return refined_mesh;
+}
+//-----------------------------------------------------------------------------
+void dolfin::p_refine(Mesh& refined_mesh, const Mesh& mesh)
+{
+  MeshEditor editor;
+  if (mesh.geometry().degree() != 1)
+  {
+    dolfin_error("refine.cpp",
+                 "increase polynomial degree of mesh",
+                 "Currently only linear -> quadratic is supported");
+  }
+
+  if (mesh.type().cell_type() != CellType::triangle
+      and mesh.type().cell_type() != CellType::tetrahedron
+      and mesh.type().cell_type() != CellType::interval)
+  {
+    dolfin_error("refine.cpp",
+                 "increase polynomial degree of mesh",
+                 "Unsupported cell type");
+  }
+
+  const std::size_t tdim = mesh.topology().dim();
+  const std::size_t gdim = mesh.geometry().dim();
+
+  editor.open(refined_mesh, tdim, gdim, 2);
+
+  // Copy over mesh
+  editor.init_vertices_global(mesh.size(0), mesh.size_global(0));
+  for (VertexIterator v(mesh); !v.end(); ++v)
+    editor.add_vertex(v->index(), v->point());
+
+  editor.init_cells_global(mesh.size(tdim), mesh.size_global(tdim));
+  std::vector<std::size_t> verts(tdim + 1);
+  for (CellIterator c(mesh); !c.end(); ++c)
+  {
+    std::copy(c->entities(0), c->entities(0) + tdim + 1, verts.begin());
+    editor.add_cell(c->index(), verts);
+  }
+
+  // Initialise edges
+  editor.init_entities();
+
+  // Add points at centres of edges
+  for (EdgeIterator e(refined_mesh); !e.end(); ++e)
+    editor.add_entity_point(1, 0, e->index(), e->midpoint());
+
+  editor.close();
 }
 //-----------------------------------------------------------------------------
diff --git a/dolfin/refinement/refine.h b/dolfin/refinement/refine.h
index b471002..fa048a1 100644
--- a/dolfin/refinement/refine.h
+++ b/dolfin/refinement/refine.h
@@ -121,6 +121,24 @@ namespace dolfin
   void refine(Mesh& refined_mesh, const Mesh& mesh,
               const MeshFunction<bool>& cell_markers, bool redistribute = true);
 
+  /// Increase the polynomial order of the mesh from 1 to 2, i.e. add points
+  /// at the Edge midpoints, to make a quadratic mesh.
+  ///
+  /// *Arguments*
+  ///     refined_mesh (_Mesh_)
+  ///         The mesh that will be the quadratic mesh.
+  ///     mesh (_Mesh_)
+  ///         The original linear mesh.
+  void p_refine(Mesh& refined_mesh, const Mesh& mesh);
+
+  /// Return a p_refined mesh
+  /// Increase the polynomial order of the mesh from 1 to 2, i.e. add points
+  /// at the Edge midpoints, to make a quadratic mesh.
+  ///
+  /// *Arguments*
+  ///     mesh (_Mesh_)
+  ///         The original linear mesh.
+  Mesh p_refine(const Mesh& mesh);
 }
 
 #endif
diff --git a/dolfin/swig/CMakeLists.txt b/dolfin/swig/CMakeLists.txt
index a7b1151..052c1c5 100644
--- a/dolfin/swig/CMakeLists.txt
+++ b/dolfin/swig/CMakeLists.txt
@@ -1,8 +1,7 @@
 project(swig)
 
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-
-# Remove '-Werror', '-Wall' and 'pedantic' flags (if present) when compiling SWIG-generated files
+# Remove '-Werror', '-Wall' and 'pedantic' flags (if present) when
+# compiling SWIG-generated files
 string(REGEX REPLACE "-Wall" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
 string(REGEX REPLACE "-Wall" " " CMAKE_CXX_FLAGS_DEVELOPER "${CMAKE_CXX_FLAGS_DEVELOPER}")
 string(REGEX REPLACE "-Werror=format-security" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@@ -23,6 +22,17 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
   endif()
 endif()
 
+# Prevent clang emitting warnings for SWIG-generated code
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+  set(CLANG_FLAGS "-Wno-logical-not-parentheses -Wno-logical-op-parentheses \
+-Wno-tautological-constant-out-of-range-compare")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_FLAGS}")
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CLANG_FLAGS}")
+  set(CMAKE_CXX_FLAGS_DEVELOPER "${CMAKE_CXX_FLAGS_DEVELOPER} ${CLANG_FLAGS}")
+  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CLANG_FLAGS}")
+  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CLANG_FLAGS}")
+endif()
+
 # Set common include directoris
 include_directories(${NUMPY_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS} ${CMAKE_BINARY_DIR})
 
diff --git a/dolfin/swig/adaptivity/docstrings.i b/dolfin/swig/adaptivity/docstrings.i
index bf2c696..86c51e1 100644
--- a/dolfin/swig/adaptivity/docstrings.i
+++ b/dolfin/swig/adaptivity/docstrings.i
@@ -140,16 +140,6 @@ problem and subsequent h-adaptivity.
 
 * AdaptiveLinearVariationalSolver\ (problem, goal)
 
-  Create AdaptiveLinearVariationalSolver
-  
-  *Arguments*
-      problem (:py:class:`LinearVariationalProblem`)
-          The primal problem
-      goal (:py:class:`GoalFunctional`)
-          The goal functional
-
-* AdaptiveLinearVariationalSolver\ (problem, goal)
-
   Create AdaptiveLinearVariationalSolver (shared ptr version)
   
   *Arguments*
@@ -259,16 +249,6 @@ problem and subsequent h-adaptivity.
 
 * AdaptiveNonlinearVariationalSolver\ (problem, goal)
 
-  Create AdaptiveNonlinearVariationalSolver
-  
-  *Arguments*
-      problem (:py:class:`NonlinearVariationalProblem`)
-          The primal problem
-      goal (:py:class:`GoalFunctional`)
-          The goal functional
-
-* AdaptiveNonlinearVariationalSolver\ (problem, goal)
-
   Create AdaptiveNonlinearVariationalSolver (shared ptr version)
   
   *Arguments*
@@ -523,27 +503,6 @@ mesh as the original function.
 Compute extrapolation w from v
 ";
 
-// Documentation extracted from: (module=adaptivity, header=LocalAssembler.h)
-%feature("docstring")  dolfin::LocalAssembler "
-
-";
-
-%feature("docstring")  dolfin::LocalAssembler::assemble "
-
-";
-
-%feature("docstring")  dolfin::LocalAssembler::assemble_cell "
-
-";
-
-%feature("docstring")  dolfin::LocalAssembler::assemble_exterior_facet "
-
-";
-
-%feature("docstring")  dolfin::LocalAssembler::assemble_interior_facet "
-
-";
-
 // Documentation extracted from: (module=adaptivity, header=TimeSeries.h)
 %feature("docstring")  dolfin::TimeSeries "
 This class stores a time series of objects to file(s) in a
@@ -559,13 +518,27 @@ values will be cleared.
 ";
 
 %feature("docstring")  dolfin::TimeSeries::TimeSeries "
-Create empty time series
+**Overloaded versions**
 
-*Arguments*
-    mpi_comm (:py:class:`MPI`)
-        An MPI communicator
-    name (str)
-        The time series name
+* TimeSeries\ (name)
+
+  Create empty time series
+  
+  *Arguments*
+      mpi_comm (:py:class:`MPI`)
+          An MPI communicator
+      name (str)
+          The time series name
+
+* TimeSeries\ (mpi_comm, name)
+
+  Create empty time series
+  
+  *Arguments*
+      mpi_comm (:py:class:`MPI`)
+          An MPI communicator
+      name (str)
+          The time series name
 ";
 
 %feature("docstring")  dolfin::TimeSeries::store "
diff --git a/dolfin/swig/adaptivity/post.i b/dolfin/swig/adaptivity/post.i
index 9554e7f..cca38ab 100644
--- a/dolfin/swig/adaptivity/post.i
+++ b/dolfin/swig/adaptivity/post.i
@@ -35,4 +35,3 @@ HierarchicalErrorControl.root_node = HierarchicalErrorControl._root_node
 HierarchicalErrorControl.child = HierarchicalErrorControl._child
 HierarchicalErrorControl.parent = HierarchicalErrorControl._parent
 %}
-
diff --git a/dolfin/swig/adaptivity/pre.i b/dolfin/swig/adaptivity/pre.i
index 15ae941..7f8e4df 100644
--- a/dolfin/swig/adaptivity/pre.i
+++ b/dolfin/swig/adaptivity/pre.i
@@ -44,10 +44,16 @@
 %ignore dolfin::GoalFunctional;
 
 //-----------------------------------------------------------------------------
-// To simplify handling of shared_ptr types in PyDOLFIN we ignore the reference
-// version of constructors to these types
-//-----------------------------------------------------------------------------
-%ignore dolfin::AdaptiveLinearVariationalSolver::AdaptiveLinearVariationalSolver(LinearVariationalProblem&);
-%ignore dolfin::AdaptiveNonlinearVariationalSolver::AdaptiveNonlinearVariationalSolver(NonlinearVariationalProblem&);
-
-
+// Wrap adapt return value with PyDOLFIN classes
+//-----------------------------------------------------------------------------
+%pythonappend dolfin::adapt %{
+from dolfin import cpp
+from dolfin.functions import Function, FunctionSpace
+if isinstance(val, cpp.Function):
+    return Function(val)
+if isinstance(val, cpp.FunctionSpace):
+    return FunctionSpace(val)
+# NOTE: Mesh will possibly appear here when Mesh has special PyDOLFIN wrapper
+#       subclassing ufl.Domain
+return val
+%}
diff --git a/dolfin/swig/ale/docstrings.i b/dolfin/swig/ale/docstrings.i
index 6dec04f..f02389f 100644
--- a/dolfin/swig/ale/docstrings.i
+++ b/dolfin/swig/ale/docstrings.i
@@ -34,16 +34,55 @@ the new coordinates for the interior vertices accordingly.
 * move\ (mesh, new_boundary)
 
   Move coordinates of mesh according to new boundary coordinates.
-  Returns displacement (encapsulated in Expression subclass MeshDisplacement)
+  Works only for affine meshes.
+  
+  *Arguments*
+      mesh (:py:class:`Mesh`)
+          The affine mesh to move.
+      boundary (:py:class:`BoundaryMesh`)
+          An affine mesh containing just the boundary cells.
+  
+  *Returns*
+      MeshDisplacement
+          Displacement encapsulated in Expression subclass
+          MeshDisplacement.
 
 * move\ (mesh0, mesh1)
 
-  Move coordinates of mesh0 according to mesh1 with common global vertices.
-  Returns displacement (encapsulated in Expression subclass MeshDisplacement)
+  *Arguments*
+      mesh0 (:py:class:`Mesh`)
+          The affine mesh to move.
+      mesh1 (:py:class:`Mesh`)
+          The affine mesh to be fit.
+  
+  *Returns*
+      MeshDisplacement
+          Displacement encapsulated in Expression subclass
+
+* move\ (mesh, displacement)
+
+  Move coordinates of mesh according to displacement function.
+  This works only for affine meshes.
+  
+  NOTE: This cannot be implemented for higher-order geometries
+        as there is no way of constructing function space for
+        position unless supplied as an argument.
+  
+  *Arguments*
+      mesh (:py:class:`Mesh`)
+          The affine mesh to move.
+      displacement (:py:class:`GenericFunction`)
+          A vectorial generic function.
 
 * move\ (mesh, displacement)
 
-  Move coordinates of mesh according to displacement function
+  Move coordinates of mesh according to displacement function.
+  
+  *Arguments*
+      mesh (:py:class:`Mesh`)
+          The mesh to move.
+      displacement (:py:class:`Function`)
+          A vectorial Lagrange function of matching degree.
 ";
 
 // Documentation extracted from: (module=ale, header=MeshDisplacement.h)
diff --git a/dolfin/swig/common/docstrings.i b/dolfin/swig/common/docstrings.i
index 35222e4..41f12b7 100644
--- a/dolfin/swig/common/docstrings.i
+++ b/dolfin/swig/common/docstrings.i
@@ -32,6 +32,10 @@ otherwise handled automatically.
 Return DOLFIN version string
 ";
 
+%feature("docstring")  dolfin::ufc_signature "
+Return UFC signature string
+";
+
 %feature("docstring")  dolfin::git_commit_hash "
 Return git changeset hash (returns \"unknown\" if changeset is
 not known)
@@ -53,11 +57,6 @@ Return true if DOLFIN is compiled with MPI
 Return true if DOLFIN is compiled with PETSc
 ";
 
-%feature("docstring")  dolfin::has_tao "
-Return true if DOLFIN is compiled with PETSc and PETSc version
-provides TAO
-";
-
 %feature("docstring")  dolfin::has_slepc "
 Return true if DOLFIN is compiled with SLEPc
 ";
@@ -86,6 +85,10 @@ Return true if DOLFIN is compiled with ZLIB
 Return true if DOLFIN is compiled with HDF5
 ";
 
+%feature("docstring")  dolfin::has_vtk "
+Return true if DOLFIN is compiled with VTK
+";
+
 // Documentation extracted from: (module=common, header=types.h)
 // Documentation extracted from: (module=common, header=constants.h)
 // Documentation extracted from: (module=common, header=timing.h)
@@ -135,26 +138,16 @@ stored timings
 ";
 
 %feature("docstring")  dolfin::list_timings "
-**Overloaded versions**
-
-* list_timings\ (reset=false)
-
-  **DEPRECATED**: List a summary of timings and tasks, optionally clearing
-  stored timings. ``MPI_AVG`` reduction is printed. Collective on
-  ``MPI_COMM_WORLD``. Only wall time is printed.
+List a summary of timings and tasks, optionally clearing stored timings.
+``MPI_AVG`` reduction is printed. Collective on ``MPI_COMM_WORLD``.
 
-* list_timings\ (clear, type)
-
-  List a summary of timings and tasks, optionally clearing stored timings.
-  ``MPI_AVG`` reduction is printed. Collective on ``MPI_COMM_WORLD``.
-  
-  *Arguments*
-      clear (TimingClear)
-          * ``TimingClear::clear`` resets stored timings
-          * ``TimingClear::keep`` leaves stored timings intact
-      type (std::set<TimingType>)
-          subset of ``{ TimingType::wall, TimingType::user,
-          TimingType::system }``
+*Arguments*
+    clear (TimingClear)
+        * ``TimingClear::clear`` resets stored timings
+        * ``TimingClear::keep`` leaves stored timings intact
+    type (std::set<TimingType>)
+        subset of ``{ TimingType::wall, TimingType::user,
+        TimingType::system }``
 ";
 
 %feature("docstring")  dolfin::dump_timings_to_xml "
@@ -488,10 +481,6 @@ Stop timer, return wall time elapsed and store timing data
 into logger
 ";
 
-%feature("docstring")  dolfin::Timer::value "
-DEPRECATED: Return value of timer (or time at start if not stopped)
-";
-
 %feature("docstring")  dolfin::Timer::elapsed "
 Return wall, user and system time in seconds. Wall-clock time
 has precision around 1 microsecond; user and system around
@@ -900,6 +889,12 @@ This is a singleton class which manages the initialisation and
 finalisation of various sub systems, such as MPI and PETSc.
 ";
 
+%feature("docstring")  dolfin::SubSystemsManager::singleton "
+Singleton instance. Calling this ensures singleton instance of
+SubSystemsManager is initialized according to the \"Construct
+on First Use\" idiom.
+";
+
 %feature("docstring")  dolfin::SubSystemsManager::init_mpi "
 **Overloaded versions**
 
diff --git a/dolfin/swig/common/post.i b/dolfin/swig/common/post.i
index d697950..1d57470 100644
--- a/dolfin/swig/common/post.i
+++ b/dolfin/swig/common/post.i
@@ -35,6 +35,51 @@ typedef struct {
 
 
 //-----------------------------------------------------------------------------
+// Wrapper of std::terminate, installed into Python exception hook
+//-----------------------------------------------------------------------------
+%noexception dolfin::dolfin_terminate();
+%inline %{
+  #include <signal.h>
+
+  namespace dolfin {
+    void dolfin_terminate() noexcept
+    {
+      // Uninstall OpenMPI signal handlers cluttering stderr (only on POSIX)
+      #ifndef __MINGW32__
+      struct sigaction act;
+      memset(&act, 0, sizeof(act));
+      act.sa_handler = SIG_IGN;
+      sigaction(SIGABRT, &act, NULL);
+      #endif
+
+      // We don't bother with MPI_Abort. This would require taking care of
+      // MPI state. We just assume mpirun catches SIGABRT and sends SIGTERM
+      // to other ranks.
+      std::abort();
+    }
+  }
+%}
+
+%pythoncode %{
+# Install C++ terminate handler into Python (if not interactive)
+# This ensures that std::abort (which is likely to be appropriately
+# interpreted by MPI implementations) is called by sys.excepthook thus
+# avoiding parallel deadlocks when one process raises
+import sys
+def _is_interactive():
+    return hasattr(sys, "ps1") or sys.flags.interactive
+if not _is_interactive():
+    def _new_excepthook(*args):
+        import sys
+        sys.__excepthook__(*args)
+        dolfin_terminate()
+    sys.excepthook = _new_excepthook
+    del _new_excepthook
+del _is_interactive, sys
+%}
+
+
+//-----------------------------------------------------------------------------
 // Instantiate some DOLFIN MPI templates
 //-----------------------------------------------------------------------------
 
@@ -167,4 +212,5 @@ for f in [timings, list_timings, dump_timings_to_xml, timing]:
     doc = doc.replace(" }", "]")
     f.__doc__ = doc
     del doc
+del f
 %}
diff --git a/dolfin/swig/common/pre.i b/dolfin/swig/common/pre.i
index 504410b..d41de19 100644
--- a/dolfin/swig/common/pre.i
+++ b/dolfin/swig/common/pre.i
@@ -29,16 +29,16 @@
 //-----------------------------------------------------------------------------
 // petsc4py/slepc4py typemaps
 //-----------------------------------------------------------------------------
-// This must come early. The petsc4py/slepc4py module defines typemaps which
-// we will later use on %extended classes (in post).  The typemaps
-// must be in scope when swig sees the original class, not the
-// extended definition.
+// This must come early. The petsc4py/slepc4py module defines typemaps
+// which we will later use on %extended classes (in post).  The
+// typemaps must be in scope when swig sees the original class, not
+// the extended definition.
 
 // Remove petsc4py typemaps that check for nullity of pointer
 // and object itself we only care about the former.
 %define %petsc4py_objreft(Type)
 %typemap(check,noblock=1) Type *OUTPUT {
-  if ($1 == PETSC_NULL)
+  if ($1 == NULL)
     %argument_nullref("$type", $symname, $argnum);
  }
 %apply Type *OUTPUT { Type & }
@@ -50,6 +50,7 @@
 %petsc4py_objreft(Vec)
 %petsc4py_objreft(KSP)
 %petsc4py_objreft(SNES)
+%petsc4py_objreft(Tao)
 #endif
 
 #ifdef HAS_SLEPC4PY
@@ -58,6 +59,92 @@
 #endif
 
 //-----------------------------------------------------------------------------
+// Make DOLFIN aware of the types defined in UFC
+//-----------------------------------------------------------------------------
+%{
+#include <ufc.h>
+%}
+// Avoid polluting the dolfin namespace with symbols introduced in
+// ufc.h that we don't need
+%rename("$ignore", regextarget=1, fullname=1) "ufc::.*$";
+
+// Brings back ('un-ignore') some destructors for SWIG to handle
+// shared_ptr wrapping
+%rename("%s", regextarget=1, fullname=1) "ufc::cell::~cell()$";
+%rename("%s", regextarget=1, fullname=1) "ufc::dofmap::~dofmap()$";
+%rename("%s", regextarget=1, fullname=1) "ufc::finite_element::~finite_element()*$";
+%rename("%s", regextarget=1, fullname=1) "ufc::form::~form()*$";
+%rename("%s", regextarget=1, fullname=1) "ufc::function::~function()*$";
+
+// Unignore ufc::shape enum
+%rename(ufc_shape) ufc::shape;
+%rename(interval) ufc::shape::interval;
+%rename(triangle) ufc::shape::triangle;
+%rename(quadrilateral) ufc::shape::quadrilateral;
+%rename(tetrahedron) ufc::shape::tetrahedron;
+%rename(hexahedron) ufc::shape::hexahedron;
+
+// Bring back ufc::cell members that are used in user Python
+// implementations of Expression.eval_cell
+%rename(cell_shape) ufc::cell::cell_shape;
+%rename(index) ufc::cell::index;
+%rename(topological_dimension) ufc::cell::topological_dimension;
+%rename(geometric_dimension) ufc::cell::geometric_dimension;
+%rename(local_facet) ufc::cell::local_facet;
+%rename(mesh_identifier) ufc::cell::mesh_identifier;
+
+// Rename only the symbols we need to ufc_* 'namespace'
+
+%rename(ufc_cell) ufc::cell;
+%rename(ufc_dofmap) ufc::dofmap;
+%rename(ufc_finite_element) ufc::finite_element;
+%rename(ufc_form) ufc::form;
+%rename(ufc_function) ufc::function;
+%include <ufc.h>
+
+// Jit with ctypes will result in factory functions returning just a
+// void * to a new object, these functions will cast them into our
+// swig wrapper type system and make them shared_ptrs in the process
+// to manage their lifetime.
+%inline %{
+std::shared_ptr<const ufc::finite_element> make_ufc_finite_element(void * element)
+{
+  ufc::finite_element * p = static_cast<ufc::finite_element *>(element);
+  return std::shared_ptr<const ufc::finite_element>(p);
+}
+
+std::shared_ptr<const ufc::finite_element> make_ufc_finite_element(std::size_t element)
+{
+  ufc::finite_element * p = reinterpret_cast<ufc::finite_element *>(element);
+  return std::shared_ptr<const ufc::finite_element>(p);
+}
+
+std::shared_ptr<const ufc::dofmap> make_ufc_dofmap(void * dofmap)
+{
+  ufc::dofmap * p = static_cast<ufc::dofmap *>(dofmap);
+  return std::shared_ptr<const ufc::dofmap>(p);
+}
+
+std::shared_ptr<const ufc::dofmap> make_ufc_dofmap(std::size_t dofmap)
+{
+  ufc::dofmap * p = reinterpret_cast<ufc::dofmap *>(dofmap);
+  return std::shared_ptr<const ufc::dofmap>(p);
+}
+
+std::shared_ptr<const ufc::form> make_ufc_form(void * form)
+{
+  ufc::form * p = static_cast<ufc::form *>(form);
+  return std::shared_ptr<const ufc::form>(p);
+}
+
+std::shared_ptr<const ufc::form> make_ufc_form(std::size_t form)
+{
+  ufc::form * p = reinterpret_cast<ufc::form *>(form);
+  return std::shared_ptr<const ufc::form>(p);
+}
+%}
+
+//-----------------------------------------------------------------------------
 // Global modifications to the Array interface
 //-----------------------------------------------------------------------------
 %ignore dolfin::Array::operator=;
@@ -96,8 +183,7 @@
 %ignore dolfin::Hierarchical::operator=;
 
 //-----------------------------------------------------------------------------
-// Ignore all foo and rename foo_shared_ptr to _foo for SWIG >= 2.0
-// and ignore foo_shared_ptr for SWIG < 2.0
+// Ignore all foo and rename foo_shared_ptr to _foo
 //-----------------------------------------------------------------------------
 %ignore dolfin::Hierarchical::parent;
 %rename(_parent) dolfin::Hierarchical::parent_shared_ptr;
diff --git a/dolfin/swig/fem/docstrings.i b/dolfin/swig/fem/docstrings.i
index 2c60c1b..a509e76 100644
--- a/dolfin/swig/fem/docstrings.i
+++ b/dolfin/swig/fem/docstrings.i
@@ -95,16 +95,8 @@ Tabulate the local-to-local mapping of dofs on entity
 (dim, local_entity)
 ";
 
-%feature("docstring")  dolfin::GenericDofMap::tabulate_coordinates "
-Tabulate the coordinates of all dofs on a cell (UFC cell version)
-";
-
-%feature("docstring")  dolfin::GenericDofMap::tabulate_all_coordinates "
-Tabulate the coordinates of all dofs owned by this
-process. This function is typically used by preconditioners
-that require the spatial coordinates of dofs, for example
-for re-partitioning or nullspace computations. The format for
-the return vector is [x0, y0, z0, x1, y1, z1, . . .].
+%feature("docstring")  dolfin::GenericDofMap::tabulate_global_dofs "
+Tabulate globally supported dofs
 ";
 
 %feature("docstring")  dolfin::GenericDofMap::copy "
@@ -143,19 +135,15 @@ function is typically used to construct the null space of a
 matrix operator
 ";
 
-%feature("docstring")  dolfin::GenericDofMap::set_x "
-Set dof entries in vector to the value*x[i], where x[i] is the
-spatial coordinate of the dof. Parallel layout of vector must
-be consistent with dof map range. This function is typically
-used to construct the null space of a matrix operator, e.g. rigid
-body rotations.
-";
-
 %feature("docstring")  dolfin::GenericDofMap::local_to_global_unowned "
 Return the map from unowned local dofmap nodes to global dofmap
 nodes. Dofmap node is dof index modulo block size.
 ";
 
+%feature("docstring")  dolfin::GenericDofMap::index_map "
+Index map (const access)
+";
+
 %feature("docstring")  dolfin::GenericDofMap::tabulate_local_to_global_dofs "
 Tabulate map between local (process) and global dof indices
 ";
@@ -182,6 +170,10 @@ reduce memory use)
 Return informal string representation (pretty-print)
 ";
 
+%feature("docstring")  dolfin::GenericDofMap::block_size "
+Get block size
+";
+
 // Documentation extracted from: (module=fem, header=DofMap.h)
 %feature("docstring")  dolfin::DofMap "
 This class handles the mapping of degrees of freedom. It builds
@@ -313,7 +305,7 @@ Return map from all shared nodes to the sharing processes (not
 including the current process) that share it.
 
 *Returns*
-    std::unordered_map<std::size_t, std::vector<unsigned int> >
+    std::unordered_map<std::size_t, std::vector<unsigned int>>
         The map from dofs to list of processes
 ";
 
@@ -364,32 +356,12 @@ Tabulate local-local mapping of dofs on entity (dim, local_entity)
         The local entity index
 ";
 
-%feature("docstring")  dolfin::DofMap::tabulate_coordinates "
-Tabulate the coordinates of all dofs on a cell (UFC cell
-version)
-
-*Arguments*
-    coordinates (boost::multi_array<double, 2>)
-        The coordinates of all dofs on a cell.
-    vertex_coordinates (numpy.array(float))
-        The cell vertex coordinates
-    cell (Cell)
-        The cell.
-";
-
-%feature("docstring")  dolfin::DofMap::tabulate_all_coordinates "
-Tabulate the coordinates of all dofs on this process. This
-function is typically used by preconditioners that require the
-spatial coordinates of dofs, for example for re-partitioning or
-nullspace computations.
+%feature("docstring")  dolfin::DofMap::tabulate_global_dofs "
+Tabulate globally supported dofs
 
 *Arguments*
-    mesh (:py:class:`Mesh`)
-        The mesh.
-
-*Returns*
-    numpy.array(float)
-        The dof coordinates (x0, y0, x1, y1, . . .)
+    dofs (int)
+        Degrees of freedom.
 ";
 
 %feature("docstring")  dolfin::DofMap::copy "
@@ -458,31 +430,13 @@ matrix operator.
         The value to set.
 ";
 
-%feature("docstring")  dolfin::DofMap::set_x "
-Set dof entries in vector to the x[i] coordinate of the dof
-spatial coordinate. Parallel layout of vector must be consistent
-with dof map range This function is typically used to
-construct the null space of a matrix operator, e.g. rigid
-body rotations.
-
-*Arguments*
-    vector (:py:class:`GenericVector`)
-        The vector to set.
-    value (float)
-        The value to multiply to coordinate by.
-    component (int)
-        The coordinate index.
-    mesh (:py:class:`Mesh`)
-        The mesh.
+%feature("docstring")  dolfin::DofMap::index_map "
+Return the map (const access)
 ";
 
-%feature("docstring")  dolfin::DofMap::local_to_global_unowned "
-Return the map from unowned local dofmap nodes to global dofmap
-nodes. Dofmap node is dof index modulo block size.
-
-*Returns*
-    numpy.array(int)
-        The unonwed local-to-global node map.
+%feature("docstring")  dolfin::DofMap::block_size "
+Return the block size for dof maps with components, typically
+used for vector valued functions.
 ";
 
 %feature("docstring")  dolfin::DofMap::tabulate_local_to_global_dofs "
@@ -506,6 +460,10 @@ Return global dof index for a given local (process) dof index
         The global dof index.
 ";
 
+%feature("docstring")  dolfin::DofMap::local_to_global_unowned "
+Return indices of dofs which are owned by other processes
+";
+
 %feature("docstring")  dolfin::DofMap::str "
 Return informal string representation (pretty-print)
 
@@ -523,13 +481,17 @@ Return informal string representation (pretty-print)
 Return a map between dofs indices and vertex indices
 
 Only works for FunctionSpace with dofs exclusively on vertices.
-For MixedFunctionSpaces vertex index is offset with the number
-of dofs per vertex. In parallel the returned map only maps local
-(to processor) dofs.
+For mixed FunctionSpaces vertex index is offset with the number
+of dofs per vertex.
+
+In parallel the returned map maps both owned and unowned dofs
+(using local indices) thus covering all the vertices. Hence the
+returned map is an inversion of _vertex_to_dof_map_.
 
 *Arguments*
     space (:py:class:`FunctionSpace`)
-        The FunctionSpace for what the dof to vertex map should be computed for
+        The FunctionSpace for what the dof to vertex map should
+        be computed for
 
 *Returns*
     numpy.array(int)
@@ -540,18 +502,71 @@ of dofs per vertex. In parallel the returned map only maps local
 Return a map between vertex indices and dofs indices
 
 Only works for FunctionSpace with dofs exclusively on vertices.
-For MixedFunctionSpaces dof index is offset with the number of
+For mixed FunctionSpaces dof index is offset with the number of
 dofs per vertex.
 
 *Arguments*
     space (:py:class:`FunctionSpace`)
-        The FunctionSpace for what the vertex to dof map should be computed for
+        The FunctionSpace for what the vertex to dof map should
+        be computed for
 
 *Returns*
     std::vector<dolfin::la_index>
         The vertex to dof map
 ";
 
+%feature("docstring")  dolfin::set_coordinates "
+Sets mesh coordinates from function
+
+Mesh connectivities d-0, d-1, ..., d-r are built on function mesh
+(where d is topological dimension of the mesh and r is maximal
+dimension of entity associated with any coordinate node). Consider
+clearing unneeded connectivities when finished.
+
+*Arguments*
+    geometry (:py:class:`MeshGeometry`)
+        Mesh geometry to be set
+    position (:py:class:`Function`)
+        Vectorial Lagrange function with matching degree and mesh
+";
+
+%feature("docstring")  dolfin::get_coordinates "
+Stores mesh coordinates into function
+
+Mesh connectivities d-0, d-1, ..., d-r are built on function mesh
+(where d is topological dimension of the mesh and r is maximal
+dimension of entity associated with any coordinate node). Consider
+clearing unneeded connectivities when finished.
+
+*Arguments*
+    position (:py:class:`Function`)
+        Vectorial Lagrange function with matching degree and mesh
+    geometry (:py:class:`MeshGeometry`)
+        Mesh geometry to be stored
+";
+
+%feature("docstring")  dolfin::create_mesh "
+Creates mesh from coordinate function
+
+Topology is given by underlying mesh of the function space and
+geometry is given by function values. Hence resulting mesh
+geometry has a degree of the function space degree. Geometry of
+function mesh is ignored.
+
+Mesh connectivities d-0, d-1, ..., d-r are built on function mesh
+(where d is topological dimension of the mesh and r is maximal
+dimension of entity associated with any coordinate node). Consider
+clearing unneeded connectivities when finished.
+
+*Arguments*
+    position (:py:class:`Function`)
+        Vectorial Lagrange function with of any degree
+
+*Returns*
+    :py:class:`Mesh`
+        The mesh
+";
+
 // Documentation extracted from: (module=fem, header=Equation.h)
 %feature("docstring")  dolfin::Equation "
 This class represents a variational equation lhs == rhs.
@@ -649,12 +664,16 @@ Evaluate linear functionals for all dofs on the function f
 Interpolate vertex values from dof values
 ";
 
-%feature("docstring")  dolfin::FiniteElement::map_from_reference_cell "
-Map coordinate xhat from reference cell to coordinate x in cell
-";
+%feature("docstring")  dolfin::FiniteElement::tabulate_dof_coordinates "
+Tabulate the coordinates of all dofs on an element
 
-%feature("docstring")  dolfin::FiniteElement::map_to_reference_cell "
-Map from coordinate x in cell to coordinate xhat in reference cell
+*Arguments*
+    coordinates (boost::multi_array<double, 2>)
+        The coordinates of all dofs on a cell.
+    coordinate_dofs (numpy.array(float))
+        The cell coordinates
+    cell (Cell)
+        The cell.
 ";
 
 %feature("docstring")  dolfin::FiniteElement::num_sub_elements "
@@ -688,12 +707,12 @@ This class represents a finite element basis function. It can be
 used for computation of basis function values and derivatives.
 
 Evaluation of basis functions is also possible through the use
-of the functions ``evaluate_basis`` and ``evaluate_basis_derivatives``
-available in the :py:class:`FiniteElement` class. The BasisFunction class
-relies on these functions for evaluation but also implements the
-ufc::function interface which allows evaluate_dof to be
-evaluated for a basis function (on a possibly different
-element).
+of the functions ``evaluate_basis`` and
+``evaluate_basis_derivatives`` available in the :py:class:`FiniteElement`
+class. The BasisFunction class relies on these functions for
+evaluation but also implements the ufc::function interface which
+allows evaluate_dof to be evaluated for a basis function (on a
+possibly different element).
 ";
 
 %feature("docstring")  dolfin::BasisFunction::BasisFunction "
@@ -708,6 +727,14 @@ Create basis function with given index on element on given cell
         The cell.
 ";
 
+%feature("docstring")  dolfin::BasisFunction::update_index "
+Update the basis function index
+
+*Arguments*
+    index (int)
+        The index of the basis function.
+";
+
 %feature("docstring")  dolfin::BasisFunction::eval "
 Evaluate basis function at given point
 
@@ -742,6 +769,25 @@ Evaluate function at given point in cell
         The cell.
 ";
 
+// Documentation extracted from: (module=fem, header=DiscreteOperators.h)
+%feature("docstring")  dolfin::DiscreteOperators "
+This class computes discrete gradient operators (matrices) that
+map derivatives of finite element functions into other finite
+element spaces. An example of where discrete gradient operators
+are required is the creation of algebraic multigrid solvers for
+H(curl) and H(div) problems.
+NOTE: This class is highly experimental and likely to change. It
+will eventually be expanded to provide the discrete curl and
+divergence.
+";
+
+%feature("docstring")  dolfin::DiscreteOperators::build_gradient "
+Build the discrete gradient operator A that takes a w \in H^1
+(P1, nodal Lagrange) to v \in H(curl) (lowest order Nedelec),
+i.e. v = Aw. V0 is the H(curl) space, and V1 is the P1
+Lagrange space.
+";
+
 // Documentation extracted from: (module=fem, header=DirichletBC.h)
 %feature("docstring")  dolfin::DirichletBC "
 This class specifies the interface for setting (strong)
@@ -823,21 +869,6 @@ have no effect. But this is implementation and method specific.
   
   *Arguments*
       V (:py:class:`FunctionSpace`)
-          The function space.
-      g (:py:class:`GenericFunction`)
-          The value.
-      sub_domain (:py:class:`SubDomain`)
-          The subdomain.
-      method (str)
-          Optional argument: A string specifying
-          the method to identify dofs.
-
-* DirichletBC\ (V, g, sub_domain, method=\"topological\", check_midpoint=true)
-
-  Create boundary condition for subdomain
-  
-  *Arguments*
-      V (:py:class:`FunctionSpace`)
           The function space
       g (:py:class:`GenericFunction`)
           The value
@@ -864,38 +895,6 @@ have no effect. But this is implementation and method specific.
           Optional argument: A string specifying the
           method to identify dofs.
 
-* DirichletBC\ (V, g, sub_domains, sub_domain, method=\"topological\")
-
-  Create boundary condition for subdomain specified by index
-  
-  *Arguments*
-      V (:py:class:`FunctionSpace`)
-          The function space.
-      g (:py:class:`GenericFunction`)
-          The value.
-      sub_domains (:py:class:`MeshFunction`)
-          Subdomain markers
-      sub_domain (int)
-          The subdomain index (number)
-      method (str)
-          Optional argument: A string specifying the
-          method to identify dofs.
-
-* DirichletBC\ (V, g, sub_domain, method=\"topological\")
-
-  Create boundary condition for boundary data included in the mesh
-  
-  *Arguments*
-      V (:py:class:`FunctionSpace`)
-          The function space.
-      g (:py:class:`GenericFunction`)
-          The value.
-      sub_domain (int)
-          The subdomain index (number)
-      method (str)
-          Optional argument: A string specifying the
-          method to identify dofs.
-
 * DirichletBC\ (V, g, sub_domain, method=\"topological\")
 
   Create boundary condition for boundary data included in the mesh
@@ -1006,9 +1005,6 @@ it is necessary to call gather() on the returned boundary values.
 *Arguments*
     boundary_values (std::unordered_map<std::size_t, double>)
         Map from dof to boundary value.
-    method (str)
-        Optional argument: A string specifying which
-        method to use.
 ";
 
 %feature("docstring")  dolfin::DirichletBC::gather "
@@ -1077,38 +1073,12 @@ Return shared pointer to subdomain
         Shared pointer to subdomain.
 ";
 
-%feature("docstring")  dolfin::DirichletBC::is_compatible "
-Check if given function is compatible with boundary condition
-(checking only vertex values)
-
-*Arguments*
-    v (:py:class:`GenericFunction`)
-        The function to check for compatibility
-        with boundary condition.
-
-*Returns*
-    bool
-        True if compatible.
-";
-
 %feature("docstring")  dolfin::DirichletBC::set_value "
-**Overloaded versions**
-
-* set_value\ (g)
+Set value g for boundary condition, domain remains unchanged
 
-  Set value g for boundary condition, domain remains unchanged
-  
-  *Arguments*
-      g (:py:class:`GenericFunction`)
-          The value.
-
-* set_value\ (g)
-
-  Set value g for boundary condition, domain remains unchanged
-  
-  *Arguments*
-      g (:py:class:`GenericFunction`)
-          The value.
+*Arguments*
+    g (:py:class:`GenericFunction`)
+        The value.
 ";
 
 %feature("docstring")  dolfin::DirichletBC::homogenize "
@@ -1138,15 +1108,7 @@ delta function to be well defined.
 ";
 
 %feature("docstring")  dolfin::PointSource::PointSource "
-**Overloaded versions**
-
-* PointSource\ (V, p, magnitude=1.0)
-
-  Create point source at given point of given magnitude
-
-* PointSource\ (V, p, magnitude=1.0)
-
-  Create point source at given point of given magnitude
+Create point source at given point of given magnitude
 ";
 
 %feature("docstring")  dolfin::PointSource::apply "
@@ -1169,33 +1131,65 @@ Apply (add) point source to right-hand side vector
 %feature("docstring")  dolfin::assemble_system "
 **Overloaded versions**
 
-* assemble_system\ (A, b, a, L)
+* assemble_system\ (A, b, a, L, bcs)
 
-  Assemble system (A, b)
+  Assemble system (A, b) and apply Dirichlet boundary conditions
 
-* assemble_system\ (A, b, a, L, bc)
+* assemble_system\ (A, b, a, L, bcs, x0)
 
-  Assemble system (A, b) and apply Dirichlet boundary condition
+  Assemble system (A, b) on sub domains and apply Dirichlet
+  boundary conditions
+";
 
-* assemble_system\ (A, b, a, L, bcs)
+%feature("docstring")  dolfin::assemble_multimesh "
+Assemble tensor from multimesh form
+";
 
-  Assemble system (A, b) and apply Dirichlet boundary conditions
+// Documentation extracted from: (module=fem, header=assemble_local.h)
+%feature("docstring")  dolfin::assemble_local "
+Assemble form to local tensor on a cell
+";
 
-* assemble_system\ (A, b, a, L, bcs, x0)
+// Documentation extracted from: (module=fem, header=LocalAssembler.h)
+%feature("docstring")  dolfin::LocalAssembler "
+Assembly of local cell tensors. Used by the adaptivity and
+LocalSolver functionality in dolfin. The local assembly
+functionality provided here is also wrapped as a free function
+assemble_local(form_a, cell) in Python for easier usage. Used
+from C++ the versions defined below will be faster than the free
+function as less objects need to be created and thrown away
+";
+
+%feature("docstring")  dolfin::LocalAssembler::assemble "
+Assemble a local tensor on a cell
+";
 
-  Assemble system (A, b) on sub domains and apply Dirichlet boundary
-  conditions
+%feature("docstring")  dolfin::LocalAssembler::assemble_cell "
+Worker method called by assemble() to perform assembly of
+volume integrals (dx)
+";
+
+%feature("docstring")  dolfin::LocalAssembler::assemble_exterior_facet "
+Worker method called by assemble() for each of the cell's
+external facets to perform assembly of external facet
+integrals (ds)
+";
+
+%feature("docstring")  dolfin::LocalAssembler::assemble_interior_facet "
+Worker method called by assemble() for each of the cell's
+internal facets to perform assembly of internal facet
+integrals (dS)
 ";
 
 // Documentation extracted from: (module=fem, header=LocalSolver.h)
 %feature("docstring")  dolfin::LocalSolver::LocalSolver "
 **Overloaded versions**
 
-* LocalSolver\ (a, L, solver_type=LU)
+* LocalSolver\ (a, L)
 
   Constructor (shared pointer version)
 
-* LocalSolver\ (a, solver_type=LU)
+* LocalSolver\ (a)
 
   Constructor (shared pointer version)
 ";
@@ -1212,10 +1206,13 @@ result is copied into x.
 
 %feature("docstring")  dolfin::LocalSolver::solve_local_rhs "
 Solve local (cell-wise) problems A_e x_e = b_e where A_e and
-b_e are the cell element tensors. This function is useful for
-computing (approximate) cell-wise projections, for example for
-post-processing. It much more efficient than computing global
-projections.
+b_e are the cell element tensors. Compared to solve_global_rhs
+this function calculates local RHS vectors for each cell and
+hence does not include contributions from neighbouring cells.
+
+This function is useful for computing (approximate) cell-wise
+projections, for example for post-processing. It much more
+efficient than computing global projections.
 ";
 
 %feature("docstring")  dolfin::LocalSolver::solve_local "
@@ -1224,11 +1221,11 @@ for RHS
 ";
 
 %feature("docstring")  dolfin::LocalSolver::factorize "
-Factorise LHS for all cells and store
+Factorise the local LHS matrices for all cells and store in cache
 ";
 
 %feature("docstring")  dolfin::LocalSolver::clear_factorization "
-Reset (clear) any stored factorisations
+Reset (clear) any stored factorizations
 ";
 
 // Documentation extracted from: (module=fem, header=solve.h)
@@ -1337,7 +1334,7 @@ and then space number 1 (the trial space).
       num_coefficients (int)
           The number of coefficients.
 
-* Form\ (ufc_form, function_spaces, coefficients)
+* Form\ (ufc_form, function_spaces)
 
   Create form (shared data)
   
@@ -1346,8 +1343,6 @@ and then space number 1 (the trial space).
           The UFC form.
       function_spaces (list of :py:class:`FunctionSpace`)
           Vector of function spaces.
-      coefficients (list of :py:class:`GenericFunction`)
-          Vector of coefficients.
 ";
 
 %feature("docstring")  dolfin::Form::rank "
@@ -1367,6 +1362,14 @@ Return number of coefficients
         The number of coefficients.
 ";
 
+%feature("docstring")  dolfin::Form::original_coefficient_position "
+Return original coefficient position for each coefficient (0 <= i < n)
+
+*Returns*
+    int
+        The position of coefficient i in original ufl form coefficients.
+";
+
 %feature("docstring")  dolfin::Form::coloring "
 Return coloring type for colored (multi-threaded) assembly of form
 over a mesh entity of a given dimension
@@ -1393,15 +1396,7 @@ Extract common mesh from form
 
 *Returns*
     :py:class:`Mesh`
-        The mesh.
-";
-
-%feature("docstring")  dolfin::Form::mesh_shared_ptr "
-Return mesh shared pointer (if any)
-
-*Returns*
-    :py:class:`Mesh`
-        The mesh shared pointer.
+        Shared pointer to the mesh.
 ";
 
 %feature("docstring")  dolfin::Form::function_space "
@@ -1704,44 +1699,16 @@ Build sparsity pattern for assembly of given form
 Build sparsity pattern for assembly of given multimesh form
 ";
 
-%feature("docstring")  dolfin::SparsityPatternBuilder::_build_multimesh_sparsity_pattern_interface "
-Build sparsity pattern for interface part of multimesh form
-";
-
 // Documentation extracted from: (module=fem, header=SystemAssembler.h)
 %feature("docstring")  dolfin::SystemAssembler "
-This class provides an assembler for systems of the form
-Ax = b. It differs from the default DOLFIN assembler in that it
+This class provides an assembler for systems of the form Ax =
+b. It differs from the default DOLFIN assembler in that it
 applies boundary conditions at the time of assembly, which
 preserves any symmetries in A.
 ";
 
 %feature("docstring")  dolfin::SystemAssembler::SystemAssembler "
-**Overloaded versions**
-
-* SystemAssembler\ (a, L)
-
-  Constructor
-
-* SystemAssembler\ (a, L, bc)
-
-  Constructor
-
-* SystemAssembler\ (a, L, bcs)
-
-  Constructor
-
-* SystemAssembler\ (a, L)
-
-  Constructor
-
-* SystemAssembler\ (a, L, bc)
-
-  Constructor
-
-* SystemAssembler\ (a, L, bcs)
-
-  Constructor
+Constructor
 ";
 
 %feature("docstring")  dolfin::SystemAssembler::assemble "
@@ -1784,24 +1751,8 @@ where V is the trial space and V^ is the test space.
 ";
 
 %feature("docstring")  dolfin::LinearVariationalProblem::LinearVariationalProblem "
-**Overloaded versions**
-
-* LinearVariationalProblem\ (a, L, u)
-
-  Create linear variational problem without boundary conditions
-
-* LinearVariationalProblem\ (a, L, u, bc)
-
-  Create linear variational problem with a single boundary condition
-
-* LinearVariationalProblem\ (a, L, u, bcs)
-
-  Create linear variational problem with a list of boundary conditions
-
-* LinearVariationalProblem\ (a, L, u, bcs)
-
-  Create linear variational problem with a list of boundary conditions
-  (shared pointer version)
+Create linear variational problem with a list of boundary
+conditions
 ";
 
 %feature("docstring")  dolfin::LinearVariationalProblem::bilinear_form "
@@ -1842,16 +1793,7 @@ This class implements a solver for linear variational problems.
 ";
 
 %feature("docstring")  dolfin::LinearVariationalSolver::LinearVariationalSolver "
-**Overloaded versions**
-
-* LinearVariationalSolver\ (problem)
-
-  Create linear variational solver for given problem
-
-* LinearVariationalSolver\ (problem)
-
-  Create linear variational solver for given problem (shared
-  pointer version)
+Create linear variational solver for given problem
 ";
 
 %feature("docstring")  dolfin::LinearVariationalSolver::solve "
@@ -1874,80 +1816,20 @@ where V is the trial space and V^ is the test space.
 ";
 
 %feature("docstring")  dolfin::NonlinearVariationalProblem::NonlinearVariationalProblem "
-**Overloaded versions**
-
-* NonlinearVariationalProblem\ (F, u)
-
-  Create nonlinear variational problem without boundary
-  conditions.  The Jacobian form is not specified which requires
-  the use of a nonlinear solver that does not rely on the
-  Jacobian.
-
-* NonlinearVariationalProblem\ (F, u, J)
-
-  Create nonlinear variational problem without boundary
-  conditions.  The Jacobian form is specified which allows the
-  use of a nonlinear solver that relies on the Jacobian (using
-  Newton's method).
-
-* NonlinearVariationalProblem\ (F, u, bc)
-
-  Create nonlinear variational problem with a single boundary
-  condition.  The Jacobian form is not specified which requires
-  the use of a nonlinear solver that does not rely on the
-  Jacobian.
-
-* NonlinearVariationalProblem\ (F, u, bc, J)
-
-  Create nonlinear variational problem with a single boundary
-  condition.  The Jacobian form is specified which allows the
-  use of a nonlinear solver that relies on the Jacobian (using
-  Newton's method).
-
-* NonlinearVariationalProblem\ (F, u, bcs)
-
-  Create nonlinear variational problem with a list of boundary
-  conditions.  The Jacobian form is not specified which requires
-  the use of a nonlinear solver that does not rely on the
-  Jacobian.
-
-* NonlinearVariationalProblem\ (F, u, bcs, J)
-
-  Create nonlinear variational problem with a list of boundary
-  conditions.  The Jacobian form is specified which allows the
-  use of a nonlinear solver that relies on the Jacobian (using
-  Newton's method).
-
-* NonlinearVariationalProblem\ (F, u, bcs)
-
-  Create nonlinear variational problem, shared pointer version.
-  The Jacobian form is not specified which requires the use of a
-  nonlinear solver that does not rely on the Jacobian.
-
-* NonlinearVariationalProblem\ (F, u, bcs, J)
-
-  Create nonlinear variational problem, shared pointer version.
-  The Jacobian form is specified which allows the use of a
-  nonlinear solver that relies on the Jacobian (using Newton's
-  method).
+Create nonlinear variational problem, shared pointer version.
+The Jacobian form is specified which allows the use of a
+nonlinear solver that relies on the Jacobian (using Newton's
+method).
 ";
 
 %feature("docstring")  dolfin::NonlinearVariationalProblem::set_bounds "
 **Overloaded versions**
 
-* set_bounds\ (lb, ub)
-
-  Set the bounds for bound constrained solver
-
-* set_bounds\ (lb, ub)
-
-  Set the bounds for bound constrained solver
-
 * set_bounds\ (lb_func, ub_func)
 
   Set the bounds for bound constrained solver
 
-* set_bounds\ (lb_func, ub_func)
+* set_bounds\ (lb, ub)
 
   Set the bounds for bound constrained solver
 ";
@@ -2006,92 +1888,21 @@ Check whether upper bound have has defined
 
 // Documentation extracted from: (module=fem, header=NonlinearVariationalSolver.h)
 %feature("docstring")  dolfin::NonlinearVariationalSolver "
-This class implements a solver for nonlinear variational problems.
+This class implements a solver for nonlinear variational
+problems.
 ";
 
 %feature("docstring")  dolfin::NonlinearVariationalSolver::NonlinearVariationalSolver "
-**Overloaded versions**
-
-* NonlinearVariationalSolver\ (problem)
-
-  Create nonlinear variational solver for given problem
-
-* NonlinearVariationalSolver\ (problem)
-
-  Create nonlinear variational solver for given problem (shared
-  pointer version)
+Create nonlinear variational solver for given problem
 ";
 
 %feature("docstring")  dolfin::NonlinearVariationalSolver::solve "
-**Overloaded versions**
-
-* solve\ (lb, ub)
-
-  Solve variational problem with bound constraints defined by
-  GenericVectors
-  
-  *Arguments*
-      lb (:py:class:`GenericVector`)
-          The linear solver.
-      ub (:py:class:`GenericVector`)
-          The factory.
-  *Returns*
-      (int, bool)
-          Pair of number of Newton iterations, and whether
-          iteration converged)
-
-* solve\ (lb, ub)
-
-  Solve variational problem with bound constraints defined by
-  GenericVectors (shared pointer version)
-  
-  *Arguments*
-      lb (_std::shared_ptr<const GenericVector>_)
-          The linear solver.
-      ub (_std::shared_ptr<const GenericVector>_)
-          The factory.
-  *Returns*
-      (int, bool)
-          Pair of number of Newton iterations, and whether
-          iteration converged)
-
-* solve\ (lb, ub)
-
-  Solve variational problem with bound constraints defined by Functions
-  
-  *Arguments*
-      lb (:py:class:`Function`)
-          The linear solver.
-      ub (:py:class:`Function`)
-          The factory.
-  *Returns*
-      (int, bool)
-          Pair of number of Newton iterations, and whether
-          iteration converged)
-
-* solve\ (lb, ub)
-
-  Solve variational problem with bound constraints defined by
-  Functions (shared pointer version)
-  
-  *Arguments*
-      lb (_std::shared_ptr<const Function>_)
-          The linear solver.
-      ub (_std::shared_ptr<const Function>_)
-          The factory.
-  *Returns*
-      (int, bool)
-          Pair of number of Newton iterations, and whether
-          iteration converged)
-
-* solve\ ()
+Solve variational problem
 
-  Solve variational problem
-  
-  *Returns*
-      (int, bool)
-          Pair of number of Newton iterations, and whether
-          iteration converged)
+*Returns*
+    (int, bool)
+        Pair of number of Newton iterations, and whether
+        iteration converged)
 ";
 
 %feature("docstring")  dolfin::NonlinearVariationalSolver::default_parameters "
@@ -2127,35 +1938,45 @@ multimesh function spaces.
 %feature("docstring")  dolfin::MultiMeshDirichletBC::MultiMeshDirichletBC "
 **Overloaded versions**
 
-* MultiMeshDirichletBC\ (V, g, sub_domain, method=\"topological\", check_midpoint=true)
+* MultiMeshDirichletBC\ (V, g, sub_domain, method=\"topological\", check_midpoint=true, exclude_overlapped_boundaries=true)
 
   Create boundary condition for subdomain
   
   *Arguments*
       V (:py:class:`MultiMeshFunctionSpace`)
-          The function space.
+          The function space
       g (:py:class:`GenericFunction`)
-          The value.
+          The value
       sub_domain (:py:class:`SubDomain`)
-          The subdomain.
+          The subdomain
       method (str)
-          Optional argument: A string specifying
-          the method to identify dofs.
+          Option passed to DirichletBC.
+      check_midpoint (bool)
+          Option passed to DirichletBC.
+      exclude_overlapped_boundaries (bool)
+          If true, then the variable on_boundary will
+          be set to false for facets that are overlapped
+          by another mesh (irrespective of the layering order
+          of the meshes).
 
-* MultiMeshDirichletBC\ (V, g, sub_domain, method=\"topological\", check_midpoint=true)
+* MultiMeshDirichletBC\ (V, g, sub_domains, sub_domain, part, method=\"topological\")
 
-  Create boundary condition for subdomain
+  Create boundary condition for subdomain specified by index
   
   *Arguments*
-      V (:py:class:`MultiMeshFunctionSpace`)
-          The function space
+      V (:py:class:`FunctionSpace`)
+          The function space.
       g (:py:class:`GenericFunction`)
-          The value
-      sub_domain (:py:class:`SubDomain`)
-          The subdomain
+          The value.
+      sub_domains (:py:class:`MeshFunction`)
+          Subdomain markers
+      sub_domain (int)
+          The subdomain index (number)
+      part (int)
+          The part on which to set boundary conditions
       method (str)
-          Optional argument: A string specifying
-          the method to identify dofs
+          Optional argument: A string specifying the
+          method to identify dofs.
 ";
 
 %feature("docstring")  dolfin::MultiMeshDirichletBC::apply "
@@ -2237,23 +2058,11 @@ Return dofmap (part) number i
 ";
 
 %feature("docstring")  dolfin::MultiMeshDofMap::add "
-**Overloaded versions**
-
-* add\ (dofmap)
-
-  Add dofmap (shared pointer version)
-  
-  *Arguments*
-      dofmap (:py:class:`GenericDofMap`)
-          The dofmap.
+Add dofmap
 
-* add\ (dofmap)
-
-  Add dofmap (reference version)
-  
-  *Arguments*
-      dofmap (:py:class:`DofMap`)
-          The dofmap.
+*Arguments*
+    dofmap (:py:class:`GenericDofMap`)
+        The dofmap.
 ";
 
 %feature("docstring")  dolfin::MultiMeshDofMap::build "
@@ -2279,6 +2088,10 @@ Return map from nonlocal-dofs (that appear in local dof map)
 to owning process
 ";
 
+%feature("docstring")  dolfin::MultiMeshDofMap::index_map "
+Return the map
+";
+
 %feature("docstring")  dolfin::MultiMeshDofMap::str "
 Return informal string representation (pretty-print)
 ";
@@ -2295,27 +2108,15 @@ possibly intersecting meshes.
 
 * MultiMeshForm\ (multimesh)
 
-  Create empty multimesh functional (shared pointer version)
-
-* MultiMeshForm\ (multimesh)
-
-  Create empty multimesh functional (reference version)
-
-* MultiMeshForm\ (function_space)
-
-  Create empty linear multimesh variational form (shared pointer version)
+  Create empty multimesh functional
 
 * MultiMeshForm\ (function_space)
 
-  Create empty linear multimesh variational form (reference version)
-
-* MultiMeshForm\ (function_space_0, function_space_1)
-
-  Create empty bilinear multimesh variational form (shared pointer version)
+  Create empty linear multimesh variational form
 
 * MultiMeshForm\ (function_space_0, function_space_1)
 
-  Create empty bilinear multimesh variational form (reference version)
+  Create empty bilinear multimesh variational form
 ";
 
 %feature("docstring")  dolfin::MultiMeshForm::rank "
@@ -2364,23 +2165,11 @@ Return function space for given argument
 ";
 
 %feature("docstring")  dolfin::MultiMeshForm::add "
-**Overloaded versions**
-
-* add\ (form)
-
-  Add form (shared pointer version)
-  
-  *Arguments*
-      form (:py:class:`Form`)
-          The form.
+Add form (shared pointer version)
 
-* add\ (form)
-
-  Add form (reference version)
-  
-  *Arguments*
-      form (:py:class:`Form`)
-          The form.
+*Arguments*
+    form (:py:class:`Form`)
+        The form.
 ";
 
 %feature("docstring")  dolfin::MultiMeshForm::build "
diff --git a/dolfin/swig/fem/post.i b/dolfin/swig/fem/post.i
index e49d580..861cd4e 100644
--- a/dolfin/swig/fem/post.i
+++ b/dolfin/swig/fem/post.i
@@ -47,8 +47,8 @@
 %pythoncode %{
 def function_space(self):
     "Return the FunctionSpace"
-    from dolfin.functions.functionspace import FunctionSpaceFromCpp
-    return FunctionSpaceFromCpp(self._function_space())
+    from dolfin.functions.functionspace import FunctionSpace
+    return FunctionSpace(self._function_space())
 %}
 }
 
@@ -69,18 +69,18 @@ def function_space(self, i):
          _FunctionSpace_
              Function space shared pointer.
     """
-    from dolfin.functions.functionspace import FunctionSpaceFromCpp
-    return FunctionSpaceFromCpp(self._function_space(i))
+    from dolfin.functions.functionspace import FunctionSpace
+    return FunctionSpace(self._function_space(i))
 %}
 }
 
 //-----------------------------------------------------------------------------
-// Extend GenericDofMap.tabulate_coordinates()
+// Extend FiniteElement.tabulate_dof_coordinates()
 //-----------------------------------------------------------------------------
-%extend dolfin::GenericDofMap {
-  void _tabulate_coordinates(PyObject* coordinates, const Cell& cell)
+%extend dolfin::FiniteElement {
+  void _tabulate_dof_coordinates(PyObject* coordinates, const Cell& cell)
   {
-    // NOTE: No NumPy array check. Assumed everything is coorect!
+    // NOTE: No NumPy array check. Assuming everything is correct!
 
     // Get NumPy array
     PyArrayObject *xa = reinterpret_cast<PyArrayObject*>(coordinates);
@@ -89,24 +89,24 @@ def function_space(self, i):
     boost::multi_array<double, 2> tmparray;
 
     // Get cell vertex coordinates
-    std::vector<double> vertex_coordinates;
-    cell.get_vertex_coordinates(vertex_coordinates);
+    std::vector<double> coordinate_dofs;
+    cell.get_coordinate_dofs(coordinate_dofs);
 
     // Tabulate the coordinates
-    self->tabulate_coordinates(tmparray, vertex_coordinates, cell);
+    self->tabulate_dof_coordinates(tmparray, coordinate_dofs, cell);
 
     // Get geometric dimension
     std::size_t gdim = tmparray.shape()[1];
 
     // Copy data
     double* data = static_cast<double*>(PyArray_DATA(xa));
-    for (std::size_t i = 0; i < self->num_element_dofs(cell.index()); i++)
+    for (std::size_t i = 0; i < self->space_dimension(); i++)
       for (std::size_t j = 0; j < gdim; j++)
         data[i*gdim + j] = tmparray[i][j];
   }
 
 %pythoncode %{
-def tabulate_coordinates(self, cell, coordinates=None):
+def tabulate_dof_coordinates(self, cell, coordinates=None):
     """ Tabulate the coordinates of all dofs on a cell
 
     *Arguments*
@@ -121,8 +121,8 @@ def tabulate_coordinates(self, cell, coordinates=None):
     import numpy as np
 
     # Check coordinate argument
-    gdim = cell.mesh().geometry().dim()
-    shape = (self.max_element_dofs(), gdim)
+    gdim = self.geometric_dimension()
+    shape = (self.space_dimension(), gdim)
     if coordinates is None:
         coordinates = np.zeros(shape, 'd')
     if not isinstance(coordinates, np.ndarray) or \
@@ -133,7 +133,7 @@ def tabulate_coordinates(self, cell, coordinates=None):
               "of 'double' (dtype='d') with shape %s"%str(shape))
 
     # Call the extended method
-    self._tabulate_coordinates(coordinates, cell)
+    self._tabulate_dof_coordinates(coordinates, cell)
     return coordinates
 %}
 }
@@ -156,15 +156,15 @@ def trial_space(self):
     """
     Return the trial space
     """
-    from dolfin.functions.functionspace import FunctionSpaceFromCpp
-    return FunctionSpaceFromCpp(self._trial_space())
+    from dolfin.functions.functionspace import FunctionSpace
+    return FunctionSpace(self._trial_space())
 
 def test_space(self):
     """
     Return the test space
     """
-    from dolfin.functions.functionspace import FunctionSpaceFromCpp
-    return FunctionSpaceFromCpp(self._test_space())
+    from dolfin.functions.functionspace import FunctionSpace
+    return FunctionSpace(self._test_space())
 
 %}
 }
diff --git a/dolfin/swig/fem/pre.i b/dolfin/swig/fem/pre.i
index 141e1a7..dabb776 100644
--- a/dolfin/swig/fem/pre.i
+++ b/dolfin/swig/fem/pre.i
@@ -48,66 +48,13 @@ PROBLEM_RENAMES(LinearVariational)
 PROBLEM_RENAMES(NonlinearVariational)
 
 //-----------------------------------------------------------------------------
-// To simplify handling of shared_ptr types in PyDOLFIN we ignore the reference
-// version of constructors to these types
-//-----------------------------------------------------------------------------
-%ignore dolfin::DirichletBC::DirichletBC(const FunctionSpace&,
-                     const GenericFunction&,
-                     const SubDomain&,
-                     std::string method="topological");
-%ignore dolfin::DirichletBC::DirichletBC(const FunctionSpace&,
-                     const GenericFunction&,
-                     const MeshFunction<std::size_t>&,
-                     std::size_t,
-                     std::string method="topological");
-%ignore dolfin::DirichletBC::DirichletBC(const FunctionSpace&,
-                     const GenericFunction&,
-                     std::size_t,
-                     std::string method="topological");
+// To simplify handling of shared_ptr types in PyDOLFIN we ignore the
+// reference version of constructors to these types
+// -----------------------------------------------------------------------------
 %ignore dolfin::DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace>,
-                     std::shared_ptr<const GenericFunction>,
-                     const std::vector<std::size_t>&,
-                     std::string method="topological");
-%ignore dolfin::LinearVariationalProblem::LinearVariationalProblem(const Form&,
-                                                                   const Form&,
-                                                                   Function&);
-%ignore dolfin::LinearVariationalProblem::LinearVariationalProblem(const Form&,
-                                                     const Form&,
-                                                     Function&,
-                                                     const DirichletBC&);
-%ignore dolfin::LinearVariationalProblem::LinearVariationalProblem(const Form&,
-                                       const Form&,
-                                       Function&,
-                                       std::vector<const DirichletBC*>);
-
-%ignore dolfin::NonlinearVariationalProblem::NonlinearVariationalProblem(const Form&,
-                                                                     Function&);
-%ignore dolfin::NonlinearVariationalProblem::NonlinearVariationalProblem(const Form&,
-                                                                   Function&,
-                                                                   const Form&);
-%ignore dolfin::NonlinearVariationalProblem::NonlinearVariationalProblem(const Form&,
-                                                     Function&,
-                                                     const DirichletBC&);
-%ignore dolfin::NonlinearVariationalProblem::NonlinearVariationalProblem(const Form&,
-                                                     Function&,
-                                                     const DirichletBC&,
-                                                     const Form&);
-%ignore dolfin::NonlinearVariationalProblem::NonlinearVariationalProblem(const Form&,
-                                       Function&,
-                                       std::vector<const DirichletBC*>);
-%ignore dolfin::NonlinearVariationalProblem::NonlinearVariationalProblem(const Form&,
-                                         Function&,
-                                         std::vector<const DirichletBC*>,
-                                         const Form&);
-
-%ignore dolfin::LinearVariationalSolver::LinearVariationalSolver(LinearVariationalProblem&);
-
-%ignore dolfin::NonlinearVariationalSolver::NonlinearVariationalSolver(NonlinearVariationalProblem&);
-
-%ignore dolfin::SystemAssembler::SystemAssembler(const Form&, const Form&);
-%ignore dolfin::SystemAssembler::SystemAssembler(const Form&, const Form&, const DirichletBC&);
-%ignore dolfin::SystemAssembler::SystemAssembler(const Form&, const Form&,
-                         const std::vector<const DirichletBC*>);
+                                         std::shared_ptr<const GenericFunction>,
+                                         const std::vector<std::size_t>&,
+                                         std::string method="topological");
 
 //-----------------------------------------------------------------------------
 // Ignore GenericDofMap::cell_dofs
@@ -124,7 +71,6 @@ PROBLEM_RENAMES(NonlinearVariational)
 // Modifying the interface of DirichletBC
 //-----------------------------------------------------------------------------
 %rename (_function_space) dolfin::DirichletBC::function_space;
-%ignore dolfin::DirichletBC::set_value(const GenericFunction&);
 %ignore dolfin::DirichletBC::gather;
 
 //-----------------------------------------------------------------------------
@@ -145,19 +91,19 @@ PROBLEM_RENAMES(NonlinearVariational)
 // Ignore dolfin::Cell versions of signatures as these now are handled by
 // a typemap
 //-----------------------------------------------------------------------------
-%ignore dolfin::DofMap::tabulate_coordinates(
+%ignore dolfin::FiniteElement::tabulate_dof_coordinates(
                                 boost::multi_array<double, 2>& coordinates,
-                                const std::vector<double>& vertex_coordinates,
+                                const std::vector<double>& coordinate_dofs,
                                 const Cell& cell) const;
 
-%ignore dolfin::GenericDofMap::tabulate_coordinates(
+%ignore dolfin::FiniteElement::tabulate_dof_coordinates(
                                 boost::multi_array<double, 2>& coordinates,
-                                const std::vector<double>& vertex_coordinates,
+                                const std::vector<double>& coordinate_dofs,
                                 const Cell& cell) const;
 
-%ignore dolfin::MultiMeshDofMap::tabulate_coordinates(
+%ignore dolfin::MultiMeshDofMap::tabulate_dof_coordinates(
                                 boost::multi_array<double, 2>& coordinates,
-                                const std::vector<double>& vertex_coordinates,
+                                const std::vector<double>& coordinate_dofs,
                                 const ufc::cell& cell) const;
 
 //-----------------------------------------------------------------------------
@@ -224,7 +170,7 @@ const ufc::cell& (void *argp, bool dolfin_cell, int res)
 //-----------------------------------------------------------------------------
 %typemap (in) std::vector<std::vector<std::shared_ptr<const dolfin::TYPE> > > (std::vector<std::vector<std::shared_ptr<const dolfin::TYPE> > >  tmp_vec_0, std::vector<std::shared_ptr<const dolfin::TYPE> >  tmp_vec_1, std::shared_ptr<dolfin::TYPE> tempshared)
 {
-  // IN_TYPEMAP_STD_VECTOR_OF_POINTERS(TYPE, CONST, CONST_VECTOR), shared_ptr version
+  // IN_TYPEMAP_STD_VECTOR_OF_STD_VECTOR_OF_SHARED_POINTERS(TYPE)
   if (!PyList_Check($input))
     SWIG_exception(SWIG_TypeError, "list of lists of TYPE expected");
 
diff --git a/dolfin/swig/forwarddeclarations.i b/dolfin/swig/forwarddeclarations.i
index a6ee79f..8920d02 100644
--- a/dolfin/swig/forwarddeclarations.i
+++ b/dolfin/swig/forwarddeclarations.i
@@ -68,3 +68,17 @@ namespace dolfin
   class GenericMatrix;
 
 }
+
+//=============================================================================
+// Forward declarations of common types in UFC needed for template
+// instantiations
+//=============================================================================
+
+namespace ufc
+{
+  class cell;
+  class function;
+  class finite_element;
+  class dofmap;
+  class form;
+}
diff --git a/dolfin/swig/function/docstrings.i b/dolfin/swig/function/docstrings.i
index b091d10..70f5cc6 100644
--- a/dolfin/swig/function/docstrings.i
+++ b/dolfin/swig/function/docstrings.i
@@ -245,6 +245,15 @@ Compute values at all mesh vertices.
         The mesh.
 ";
 
+%feature("docstring")  dolfin::Expression::function_space "
+Return shared pointer to function space (NULL)
+Expression does not have a FunctionSpace
+
+*Returns*
+    :py:class:`FunctionSpace`
+        Return the shared pointer.
+";
+
 // Documentation extracted from: (module=function, header=FunctionAXPY.h)
 %feature("docstring")  dolfin::FunctionAXPY "
 This class represents a linear combination of functions. It is
@@ -346,19 +355,6 @@ and :math:`U` is a vector of expansion coefficients for :math:`u_h`.
 
 * Function\ (V)
 
-  Create function on given function space
-  
-  *Arguments*
-      V (:py:class:`FunctionSpace`)
-          The function space.
-  
-  *Example*
-      .. note::
-      
-          No example code available for this function.
-
-* Function\ (V)
-
   Create function on given function space (shared data)
   
   *Arguments*
@@ -380,18 +376,6 @@ and :math:`U` is a vector of expansion coefficients for :math:`u_h`.
 
 * Function\ (V, filename)
 
-  Create function from vector of dofs stored to file
-  
-  *Arguments*
-      V (:py:class:`FunctionSpace`)
-          The function space.
-      filename_vector (str)
-          The name of the file containing the vector.
-      filename_dofdata (str)
-          The name of the file containing the dofmap data.
-
-* Function\ (V, filename)
-
   Create function from vector of dofs stored to file (shared data)
   
   *Arguments*
@@ -640,20 +624,6 @@ Return value dimension for given axis
         The value dimension.
 ";
 
-%feature("docstring")  dolfin::Function::non_matching_eval "
-Evaluate function for given data (non-matching meshes)
-This method is deprecated as of dolfin 1.6.0.
-Please use eval(values, x) instead.
-
-*Arguments*
-    values (numpy.array(float))
-        The values at the point.
-    x (numpy.array(float))
-        The coordinates of the point.
-    cell (ufc::cell)
-        The cell.
-";
-
 %feature("docstring")  dolfin::Function::restrict "
 Restrict function to local cell (compute expansion coefficients w)
 
@@ -838,6 +808,32 @@ Extract subspace for component
         The subspace.
 ";
 
+%feature("docstring")  dolfin::FunctionSpace::sub "
+**Overloaded versions**
+
+* sub\ (component)
+
+  Extract subspace for component
+  
+  *Arguments*
+      component (int)
+          Index of the subspace.
+  *Returns*
+      :py:class:`FunctionSpace`
+          The subspace.
+
+* sub\ (component)
+
+  Extract subspace for component
+  
+  *Arguments*
+      component (numpy.array(int))
+          The component.
+  *Returns*
+      :py:class:`FunctionSpace`
+          The subspace.
+";
+
 %feature("docstring")  dolfin::FunctionSpace::extract_sub_space "
 Extract subspace for component
 
@@ -907,6 +903,39 @@ Return component
         The component (relative to superspace).
 ";
 
+%feature("docstring")  dolfin::FunctionSpace::tabulate_dof_coordinates "
+Tabulate the coordinates of all dofs on this process. This
+function is typically used by preconditioners that require the
+spatial coordinates of dofs, for example for re-partitioning or
+nullspace computations.
+
+*Arguments*
+    mesh (:py:class:`Mesh`)
+        The mesh.
+
+*Returns*
+    numpy.array(float)
+        The dof coordinates (x0, y0, x1, y1, . . .)
+";
+
+%feature("docstring")  dolfin::FunctionSpace::set_x "
+Set dof entries in vector to value*x[i], where [x][i] is the
+coordinate of the dof spatial coordinate. Parallel layout of
+vector must be consistent with dof map range This function is
+typically used to construct the null space of a matrix
+operator, e.g. rigid body rotations.
+
+*Arguments*
+    vector (:py:class:`GenericVector`)
+        The vector to set.
+    value (float)
+        The value to multiply to coordinate by.
+    component (int)
+        The coordinate index.
+    mesh (:py:class:`Mesh`)
+        The mesh.
+";
+
 %feature("docstring")  dolfin::FunctionSpace::str "
 Return informal string representation (pretty-print)
 
@@ -923,36 +952,6 @@ Return informal string representation (pretty-print)
 Print dofmap (useful for debugging)
 ";
 
-// Documentation extracted from: (module=function, header=SubSpace.h)
-%feature("docstring")  dolfin::SubSpace "
-This class represents a subspace (component) of a function space.
-
-The subspace is specified by an array of indices. For example,
-the array [3, 0, 2] specifies subspace 2 of subspace 0 of
-subspace 3.
-
-A typical example is the function space W = V x P for Stokes.
-Here, V = W[0] is the subspace for the velocity component and
-P = W[1] is the subspace for the pressure component. Furthermore,
-W[0][0] = V[0] is the first component of the velocity space etc.
-";
-
-%feature("docstring")  dolfin::SubSpace::SubSpace "
-**Overloaded versions**
-
-* SubSpace\ (V, component)
-
-  Create subspace for given component (one level)
-
-* SubSpace\ (V, component, sub_component)
-
-  Create subspace for given component (two levels)
-
-* SubSpace\ (V, component)
-
-  Create subspace for given component (n levels)
-";
-
 // Documentation extracted from: (module=function, header=Constant.h)
 %feature("docstring")  dolfin::Constant "
 This class represents a constant-valued expression.
@@ -1061,6 +1060,14 @@ Cast to double (for scalar constants)
         The scalar value.
 ";
 
+%feature("docstring")  dolfin::Constant::values "
+Return copy of this Constant's current values
+
+*Returns*
+    numpy.array(float)
+        The vector of scalar values of the constant.
+";
+
 // Documentation extracted from: (module=function, header=SpecialFunctions.h)
 %feature("docstring")  dolfin::MeshCoordinates "
 This Function represents the mesh coordinates on a given mesh.
@@ -1075,7 +1082,8 @@ Evaluate function
 ";
 
 %feature("docstring")  dolfin::FacetArea "
-This function represents the area/length of a cell facet on a given mesh.
+This function represents the area/length of a cell facet on a
+given mesh.
 ";
 
 %feature("docstring")  dolfin::FacetArea::FacetArea "
@@ -1134,29 +1142,11 @@ intersecting meshes.
 ";
 
 %feature("docstring")  dolfin::MultiMeshFunction::MultiMeshFunction "
-**Overloaded versions**
+Create MultiMesh function on given MultiMesh function space
 
-* MultiMeshFunction\ (V)
-
-  Create MultiMesh function on given MultiMesh function space
-  
-  *Arguments*
-      V (:py:class:`MultiMeshFunctionSpace`)
-          The MultiMesh function space.
-  
-  *Example*
-      .. note::
-      
-          No example code available for this function.
-
-* MultiMeshFunction\ (V)
-
-  Create MultiMesh function on given MultiMesh function space (shared
-  pointer version)
-  
-  *Arguments*
-      V (:py:class:`MultiMeshFunctionSpace`)
-          The MultiMesh function space.
+*Arguments*
+    V (:py:class:`MultiMeshFunctionSpace`)
+        The MultiMesh function space.
 ";
 
 %feature("docstring")  dolfin::MultiMeshFunction::part "
@@ -1197,7 +1187,7 @@ structures are empty until build() has been called.
 ";
 
 %feature("docstring")  dolfin::MultiMeshFunctionSpace::MultiMeshFunctionSpace "
-Create empty multimesh function space
+Create multimesh function space on multimesh (shared pointer version)
 ";
 
 %feature("docstring")  dolfin::MultiMeshFunctionSpace::dim "
@@ -1261,23 +1251,11 @@ the collection of parts).
 ";
 
 %feature("docstring")  dolfin::MultiMeshFunctionSpace::add "
-**Overloaded versions**
-
-* add\ (function_space)
-
-  Add function space (shared pointer version)
-  
-  *Arguments*
-      function_space (:py:class:`FunctionSpace`)
-          The function space.
-
-* add\ (function_space)
+Add function space
 
-  Add function space (reference version)
-  
-  *Arguments*
-      function_space (:py:class:`FunctionSpace`)
-          The function space.
+*Arguments*
+    function_space (:py:class:`FunctionSpace`)
+        The function space.
 ";
 
 %feature("docstring")  dolfin::MultiMeshFunctionSpace::build "
@@ -1287,15 +1265,10 @@ the collection of parts).
 
   Build multimesh function space
 
-* build\ (multimesh, offsets)
-
-  Build multimesh function space. This function reuses an
-  existing multimesh and uses offsets computed from the full
-  function spaces on each part.
-";
+* build\ (offsets)
 
-%feature("docstring")  dolfin::MultiMeshFunctionSpace::default_parameters "
-Default parameter values
+  Build multimesh function space. This function uses offsets
+  computed from the full function spaces on each part.
 ";
 
 // Documentation extracted from: (module=function, header=MultiMeshSubSpace.h)
@@ -1464,8 +1437,8 @@ Return the number of receiving functions
 
 // Documentation extracted from: (module=function, header=LagrangeInterpolator.h)
 %feature("docstring")  dolfin::LagrangeInterpolator "
-This class interpolates efficiently from a GenericFunction
-to a Lagrange Function
+This class interpolates efficiently from a GenericFunction to a
+Lagrange Function
 ";
 
 %feature("docstring")  dolfin::LagrangeInterpolator::interpolate "
diff --git a/dolfin/swig/function/post.i b/dolfin/swig/function/post.i
index 154570a..940110d 100644
--- a/dolfin/swig/function/post.i
+++ b/dolfin/swig/function/post.i
@@ -22,7 +22,8 @@
 //-----------------------------------------------------------------------------
 // Extend FunctionAXPY
 //-----------------------------------------------------------------------------
-%extend dolfin::FunctionAXPY {
+%extend dolfin::FunctionAXPY
+{
 %pythoncode %{
 __truediv__ = __div__
 %}
@@ -41,23 +42,23 @@ def __contains__(self,u):
 
 def leaf_node(self):
     "Return the finest FunctionSpace in hierarchy"
-    from dolfin.functions.functionspace import FunctionSpaceFromCpp
-    return FunctionSpaceFromCpp(HierarchicalFunctionSpace._leaf_node(self))
+    from dolfin.functions.functionspace import FunctionSpace
+    return FunctionSpace(HierarchicalFunctionSpace._leaf_node(self))
 
 def root_node(self):
     "Return the coarsest FunctionSpace in hierarchy"
-    from dolfin.functions.functionspace import FunctionSpaceFromCpp
-    return FunctionSpaceFromCpp(HierarchicalFunctionSpace._root_node(self))
+    from dolfin.functions.functionspace import FunctionSpace
+    return FunctionSpace(HierarchicalFunctionSpace._root_node(self))
 
 def child(self):
     "Return the child FunctionSpace in the hierarchy"
-    from dolfin.functions.functionspace import FunctionSpaceFromCpp
-    return FunctionSpaceFromCpp(HierarchicalFunctionSpace._child(self))
+    from dolfin.functions.functionspace import FunctionSpace
+    return FunctionSpace(HierarchicalFunctionSpace._child(self))
 
 def parent(self):
     "Return the parent FunctionSpace in the hierarchy"
-    from dolfin.functions.functionspace import FunctionSpaceFromCpp
-    return FunctionSpaceFromCpp(HierarchicalFunctionSpace._parent(self))
+    from dolfin.functions.functionspace import FunctionSpace
+    return FunctionSpace(HierarchicalFunctionSpace._parent(self))
 
 %}
 }
@@ -116,8 +117,8 @@ def compute_vertex_values(self, mesh=None):
 %pythoncode %{
 def function_space(self):
     "Return the FunctionSpace"
-    from dolfin.functions.functionspace import FunctionSpaceFromCpp
-    return FunctionSpaceFromCpp(self._function_space())
+    from dolfin.functions.functionspace import FunctionSpace
+    return FunctionSpace(self._function_space())
 
 def copy(self, deepcopy=False):
     """
diff --git a/dolfin/swig/function/pre.i b/dolfin/swig/function/pre.i
index a3d8fb7..887de2a 100644
--- a/dolfin/swig/function/pre.i
+++ b/dolfin/swig/function/pre.i
@@ -33,15 +33,9 @@
 // ===========================================================================
 
 //-----------------------------------------------------------------------------
-// Ignore reference (to FunctionSpaces) constructors of Function
-//-----------------------------------------------------------------------------
-%ignore dolfin::Function::Function(const FunctionSpace&);
-%ignore dolfin::Function::Function(const FunctionSpace&, std::string);
-
-//-----------------------------------------------------------------------------
 // Modifying the interface of Function
 //-----------------------------------------------------------------------------
-%rename(_function_space) dolfin::Function::function_space;
+%rename(_function_space) dolfin::GenericFunction::function_space;
 %rename(sub) dolfin::Function::operator[];
 %rename(_assign) dolfin::Function::operator=;
 %rename(_in) dolfin::Function::in;
@@ -49,8 +43,8 @@
 //-----------------------------------------------------------------------------
 // Modifying the interface of FunctionSpace
 //-----------------------------------------------------------------------------
-%rename(sub) dolfin::FunctionSpace::operator[];
 %rename(assign) dolfin::FunctionSpace::operator=;
+%ignore dolfin::FunctionSpace::operator[];
 %ignore dolfin::FunctionSpace::collapse() const;
 
 //-----------------------------------------------------------------------------
@@ -99,6 +93,7 @@
 %feature("nodirector") dolfin::Expression::value_rank;
 %feature("nodirector") dolfin::Expression::str;
 %feature("nodirector") dolfin::Expression::compute_vertex_values;
+%feature("nodirector") dolfin::Expression::function_space;
 
 //-----------------------------------------------------------------------------
 // Macro for defining an in typemap for a const std::vector<std::pair<double, TYPE*> >&
@@ -217,4 +212,3 @@ IN_TYPEMAPS_STD_VECTOR_OF_PAIRS_OF_DOUBLE_AND_POINTER(Function)
 //-----------------------------------------------------------------------------
 %template (HierarchicalFunctionSpace) dolfin::Hierarchical<dolfin::FunctionSpace>;
 %template (HierarchicalFunction) dolfin::Hierarchical<dolfin::Function>;
-
diff --git a/dolfin/swig/generation/docstrings.i b/dolfin/swig/generation/docstrings.i
index af6649f..d2109b7 100644
--- a/dolfin/swig/generation/docstrings.i
+++ b/dolfin/swig/generation/docstrings.i
@@ -379,3 +379,14 @@ NB: this code is experimental, just for testing, and will generally not
 work with anything else
 ";
 
+// Documentation extracted from: (module=generation, header=UnitDiscMesh.h)
+%feature("docstring")  dolfin::UnitDiscMesh::UnitDiscMesh "
+Create a unit disc mesh in 2D or 3D geometry with n steps, and
+given degree polynomial mesh
+";
+
+// Documentation extracted from: (module=generation, header=SphericalShellMesh.h)
+%feature("docstring")  dolfin::SphericalShellMesh::SphericalShellMesh "
+Create a spherical shell manifold for testing
+";
+
diff --git a/dolfin/swig/geometry/docstrings.i b/dolfin/swig/geometry/docstrings.i
index 85108bd..b00f97a 100644
--- a/dolfin/swig/geometry/docstrings.i
+++ b/dolfin/swig/geometry/docstrings.i
@@ -443,6 +443,21 @@ Create empty bounding box tree
           The bounding box tree.
 ";
 
+%feature("docstring")  dolfin::BoundingBoxTree::compute_process_collisions "
+Compute all collisions between process bounding boxes
+and :py:class:`Point`. Effectively a list of processes which may
+contain the :py:class:`Point`.
+
+*Returns*
+    numpy.array(int)
+        A list of process numbers where the :py:class:`Mesh`
+        may collide with (intersect) the given point.
+
+*Arguments*
+    point (:py:class:`Point`)
+        The point.
+";
+
 %feature("docstring")  dolfin::BoundingBoxTree::compute_first_collision "
 Compute first collision between bounding boxes and :py:class:`Point`.
 
@@ -546,6 +561,10 @@ design)
 Constructor
 ";
 
+%feature("docstring")  dolfin::GenericBoundingBoxTree::create "
+Factory function returning (empty) tree of appropriate dimension
+";
+
 %feature("docstring")  dolfin::GenericBoundingBoxTree::build "
 **Overloaded versions**
 
@@ -582,6 +601,10 @@ Constructor
   Compute all collisions between entities and :py:class:`BoundingBoxTree`
 ";
 
+%feature("docstring")  dolfin::GenericBoundingBoxTree::compute_process_collisions "
+Compute all collisions between processes and :py:class:`Point`
+";
+
 %feature("docstring")  dolfin::GenericBoundingBoxTree::compute_first_collision "
 Compute first collision between bounding boxes and :py:class:`Point`
 ";
@@ -598,6 +621,10 @@ Compute closest entity and distance to :py:class:`Point`
 Compute closest point and distance to :py:class:`Point`
 ";
 
+%feature("docstring")  dolfin::GenericBoundingBoxTree::str "
+Print out for debugging
+";
+
 %feature("docstring")  dolfin::GenericBoundingBoxTree::_compute_collisions "
 **Overloaded versions**
 
diff --git a/dolfin/swig/globalincludes.i b/dolfin/swig/globalincludes.i
index 76d8364..f8ba91f 100644
--- a/dolfin/swig/globalincludes.i
+++ b/dolfin/swig/globalincludes.i
@@ -20,8 +20,10 @@
 // First added:  2012-01-17
 // Last changed: 2012-01-18
 
+%include <stdint.i>
+
 // Global shared_ptr classes
-// NOTE: These classes need to be declared for all classes in all combined 
+// NOTE: These classes need to be declared for all classes in all combined
 // NOTE: modules
 %include "dolfin/swig/shared_ptr_classes.i"
 
@@ -37,11 +39,11 @@
 %include <exception.i>
 %include "dolfin/swig/exceptions.i"
 
-// Do not expand default arguments in C++ by generating two an extra 
+// Do not expand default arguments in C++ by generating two an extra
 // function in the SWIG layer. This reduces code bloat.
-// NOTE: Hake Commenting out compactdefaultargs as it creates problems for SWIG 
+// NOTE: Hake Commenting out compactdefaultargs as it creates problems for SWIG
 // NOTE: to evaluate bool arguments with default values where another method with
-// NOTE: the same number of arguments exists. 
+// NOTE: the same number of arguments exists.
 //%feature("compactdefaultargs");
 
 // STL SWIG string class
diff --git a/dolfin/swig/graph/docstrings.i b/dolfin/swig/graph/docstrings.i
index 57820db..86d57cf 100644
--- a/dolfin/swig/graph/docstrings.i
+++ b/dolfin/swig/graph/docstrings.i
@@ -43,8 +43,9 @@ This class builds a Graph corresponding to various objects
 ";
 
 %feature("docstring")  dolfin::GraphBuilder::compute_dual_graph "
-Build distributed dual graph (cell-cell connections) for from
-LocalMeshData
+Build distributed dual graph (cell-cell connections) from
+minimal mesh data, and return (num local edges, num
+non-local edges)
 ";
 
 // Documentation extracted from: (module=graph, header=BoostGraphOrdering.h)
@@ -79,6 +80,6 @@ process numbers.
 
 %feature("docstring")  dolfin::SCOTCH::compute_gps "
 Compute reordering (map[old] -> new) using
-Gibbs-Poole-Stockmeyer re-ordering
+Gibbs-Poole-Stockmeyer (GPS) re-ordering
 ";
 
diff --git a/demo/undocumented/plot-qt/cpp/BoundaryMeshFunction.cpp b/dolfin/swig/graph/pre.i
similarity index 60%
rename from demo/undocumented/plot-qt/cpp/BoundaryMeshFunction.cpp
rename to dolfin/swig/graph/pre.i
index bad3ddd..09854d2 100644
--- a/demo/undocumented/plot-qt/cpp/BoundaryMeshFunction.cpp
+++ b/dolfin/swig/graph/pre.i
@@ -1,4 +1,5 @@
-// Copyright (C) 2012 Joachim Berdal Haga
+/* -*- C -*- */
+// Copyright (C) 2016 Garth N. Wells
 //
 // This file is part of DOLFIN.
 //
@@ -14,24 +15,16 @@
 //
 // You should have received a copy of the GNU Lesser General Public License
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-09-14
-// Last changed: 2012-09-18
-
-#include "BoundaryMeshFunction.h"
 
-using namespace dolfin;
+//=============================================================================
+// SWIG directives for the DOLFIN graph kernel module (pre)
+//
+// The directives in this file are applied _before_ the header files of the
+// modules has been loaded.
+//=============================================================================
 
-//----------------------------------------------------------------------------
-BoundaryMeshFunction::BoundaryMeshFunction(const Mesh& mesh)
-  : _bmesh(mesh, "exterior")
-{
-  MeshFunction<bool>::init(_bmesh, _bmesh.topology().dim());
-  set_all(false);
-}
-//----------------------------------------------------------------------------
-void BoundaryMeshFunction::toggleCell(int id)
-{
-  (*this)[id] = !(*this)[id];
-}
-//----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// Ignore low-level functions
+//-----------------------------------------------------------------------------
+%ignore dolfin::GraphBuilder::compute_dual_graph;
+%ignore dolfin::SCOTCH::compute_partition;
diff --git a/dolfin/swig/io/docstrings.i b/dolfin/swig/io/docstrings.i
index 58225fe..ec2bb8b 100644
--- a/dolfin/swig/io/docstrings.i
+++ b/dolfin/swig/io/docstrings.i
@@ -36,7 +36,6 @@ GenericFile.h. Compatible file formats include:
     * RAW    (.raw)
     * SVG    (.svg)
     * XD3    (.xd3)
-    * XDMF   (.xdmf)
     * XML    (.xml)
     * XYZ    (.xyz)
     * VTK    (.pvd)
@@ -214,72 +213,147 @@ Check if file exists
 // Documentation extracted from: (module=io, header=XDMFFile.h)
 %feature("docstring")  dolfin::XDMFFile "
 This class supports the output of meshes and functions in XDMF
-(http://www.xdmf.org) format. It creates an XML file that describes
-the data and points to a HDF5 file that stores the actual problem
-data. Output of data in parallel is supported.
+(http://www.xdmf.org) format. It creates an XML file that
+describes the data and points to a HDF5 file that stores the
+actual problem data. Output of data in parallel is supported.
 
-XDMF is not suitable for checkpointing as it may decimate
-some data.
+XDMF is not suitable for checkpointing as it may decimate some
+data.
 ";
 
-%feature("docstring")  dolfin::XDMFFile::XDMFFile "
-Constructor
+%feature("docstring")  dolfin::XDMFFile::Encoding "
+File encoding type
 ";
 
-%feature("docstring")  dolfin::XDMFFile::operator<< "
+%feature("docstring")  dolfin::XDMFFile::UseFilePartition "
+Re-use any partition stored in file
+";
+
+%feature("docstring")  dolfin::XDMFFile::XDMFFile "
 **Overloaded versions**
 
-* operator<<\ (mesh)
+* XDMFFile\ (filename)
 
-  Save a mesh for visualisation, with e.g. ParaView. Creates a HDF5
-  file to store the mesh, and a related XDMF file with metadata.
+  Constructor
 
-* operator<<\ (u)
+* XDMFFile\ (comm, filename)
 
-  Save a Function to XDMF/HDF5 files for visualisation.
+  Constructor
+";
 
-* operator<<\ (Function*, ut)
+%feature("docstring")  dolfin::XDMFFile::write "
+**Overloaded versions**
 
-  Save Function + time stamp to file
+* write\ (mesh)
 
-* operator<<\ (meshfunction)
+  Save a mesh to XDMF format, either using an associated HDF5
+  file, or storing the data inline as XML Create function on
+  given function space
+  
+  *Arguments*
+      mesh (:py:class:`Mesh`)
+          A mesh to save.
+      encoding (_Encoding_)
+          Encoding to use: HDF5 or ASCII
+  
 
-  Save MeshFunction to file
-";
+* write\ (u)
 
-%feature("docstring")  dolfin::XDMFFile::read "
-Read in a mesh from the associated HDF5 file,
-optionally using stored partitioning, if possible
-when the same number of processes are being used.
-";
+  Save a Function to XDMF file for visualisation, using an
+  associated HDF5 file, or storing the data inline as XML.
+  
+  *Arguments*
+      u (:py:class:`Function`)
+          A function to save.
+      encoding (_Encoding_)
+          Encoding to use: HDF5 or ASCII
+  
 
-%feature("docstring")  dolfin::XDMFFile::operator>> "
-**Overloaded versions**
+* write\ (u, t)
 
-* operator>>\ (mesh)
+  Save a Function with timestamp to XDMF file for visualisation,
+  using an associated HDF5 file, or storing the data inline as
+  XML.
+  
+  *Arguments*
+      u (:py:class:`Function`)
+          A function to save.
+      t (_double_)
+          Timestep
+      encoding (_Encoding_)
+          Encoding to use: HDF5 or ASCII
+  
 
-  Read in a mesh from the associated HDF5 file
+* write\ (meshfunction)
 
-* operator>>\ (meshfunction)
+  Save MeshFunction to file using an associated HDF5 file, or
+  storing the data inline as XML.
+  
+  *Arguments*
+      meshfunction (:py:class:`MeshFunction`)
+          A meshfunction to save.
+      encoding (_Encoding_)
+          Encoding to use: HDF5 or ASCII
+  
 
-  Read first MeshFunction from file
-";
+* write\ (mvc)
+
+  Write out mesh value collection (subset) using an associated
+  HDF5 file, or storing the data inline as XML.
+  
+  *Arguments*
+      mvc (_MeshValueCollection<std::size_t>_)
+          A list of points to save.
+      encoding (_Encoding_)
+          Encoding to use: HDF5 or ASCII
+  
+
+* write\ (points)
 
-%feature("docstring")  dolfin::XDMFFile::write_quadratic "
-Save a quadratic Function to a quadratic Mesh defined
-by a geometry Function
+  Save a cloud of points to file using an associated HDF5 file,
+  or storing the data inline as XML.
+  
+  *Arguments*
+      points (_std::vector<Point>_)
+          A list of points to save.
+      encoding (_Encoding_)
+          Encoding to use: HDF5 or ASCII
+  
+
+* write\ (points, values)
+
+  Save a cloud of points, with scalar values using an associated
+  HDF5 file, or storing the data inline as XML.
+  
+  *Arguments*
+      points (_std::vector<Point>_)
+          A list of points to save.
+      values (numpy.array(float))
+          A list of values at each point.
+      encoding (_Encoding_)
+          Encoding to use: HDF5 or ASCII
+  
 ";
 
-%feature("docstring")  dolfin::XDMFFile::write "
+%feature("docstring")  dolfin::XDMFFile::read "
 **Overloaded versions**
 
-* write\ (points)
+* read\ (mesh)
 
-  Save a cloud of points to file
+  Read in a mesh from the associated HDF5 file, optionally using
+  stored partitioning, if possible when the same number of
+  processes are being used.
+  
+  *Arguments*
+      mesh (:py:class:`Mesh`)
+  
+      use_partition_from_file (_UseFilePartition_)
+          Use the existing partition information in HDF5 file
+  
 
-* write\ (points, values)
+* read\ (meshfunction)
 
-  Save a cloud of points, with scalar values
+  Read first MeshFunction from file
 ";
 
 // Documentation extracted from: (module=io, header=HDF5File.h)
@@ -292,6 +366,10 @@ Constructor. file_mode should \"a\" (append), \"w\" (write) or \"r\"
 Close file
 ";
 
+%feature("docstring")  dolfin::HDF5File::flush "
+Flush buffered I/O to disk
+";
+
 %feature("docstring")  dolfin::HDF5File::write "
 **Overloaded versions**
 
@@ -363,18 +441,32 @@ Close file
 
 * read\ (u, name)
 
-  Read Function from file and distribute data according to
-  the Mesh and dofmap associated with the Function.
-  If the 'name' refers to a HDF5 group, then it is assumed
-  that the Function data is stored in the datasets within that group.
-  If the 'name' refers to a HDF5 dataset within a group, then
-  it is assumed that it is a Vector, and the Function will be filled from
-  that Vector
+  Read Function from file and distribute data according to the
+  Mesh and dofmap associated with the Function.  If the 'name'
+  refers to a HDF5 group, then it is assumed that the Function
+  data is stored in the datasets within that group.  If the
+  'name' refers to a HDF5 dataset within a group, then it is
+  assumed that it is a Vector, and the Function will be filled
+  from that Vector
+
+* read\ (mesh, data_path, use_partition_from_file)
 
-* read\ (mesh, name, use_partition_from_file)
+  Read Mesh from file, using attribute data (e.g., cell type) stored
+  in the HDF5 file. Optionally re-use any partition data
+  in the file. This function requires all necessary data for
+  constructing a Mesh to be present in the HDF5 file.
 
-  Read Mesh from file and optionally re-use any partition data
-  in the file
+* read\ (input_mesh, topology_path, geometry_path, gdim, cell_type, expected_num_global_cells, expected_num_global_points, use_partition_from_file)
+
+  Construct Mesh with paths to topology and geometry datasets, and
+  providing essential meta-data, e.g. geometric dimension and
+  cell type. If this data is available in the HDF5 file, it will
+  be checked for consistency. Set expected_num_global_cells to a
+  negative value if not known.
+  
+  This function is typically called when using the XDMF format,
+  in which case the meta data has alreayd been read from an XML
+  file
 
 * read\ (meshfunction, name)
 
@@ -409,10 +501,6 @@ Close file
 Check if dataset exists in HDF5 file
 ";
 
-%feature("docstring")  dolfin::HDF5File::flush "
-Flush buffered I/O to disk
-";
-
 // Documentation extracted from: (module=io, header=HDF5Attribute.h)
 %feature("docstring")  dolfin::HDF5Attribute "
 HDF5Attribute gives access to the attributes of a dataset
@@ -498,3 +586,146 @@ Get the names of all the attributes on this dataset as a
 std::vector<std::string>
 ";
 
+// Documentation extracted from: (module=io, header=X3DOM.h)
+%feature("docstring")  dolfin::X3DOMParameters "
+Class data to store X3DOM view parameters.
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::Representation "
+X3DOM representation type
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::X3DOMParameters "
+Constructor (with default parameter settings)
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_representation "
+Set representation of object (wireframe, surface or
+surface_with_edges)
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_representation "
+Get the current representation of the object (wireframe, surface or
+surface_with_edges)
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_viewport_size "
+Get the size of the viewport
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_diffuse_color "
+Set the RGB color of the object
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_diffuse_color "
+Get the RGB diffuse color of the object
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_emissive_color "
+Set the RGB emissive color
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_emissive_color "
+Get the RGB emissive color
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_specular_color "
+Set the RGB specular color
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_background_color "
+Set background RGB color
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_background_color "
+Get background RGB color
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_ambient_intensity "
+Set the ambient lighting intensity
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_ambient_intensity "
+Get the ambient lighting intensity
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_shininess "
+Set the surface shininess of the object
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_shininess "
+Set the surface shininess of the object
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_transparency "
+Set the transparency (0-1)
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_transparency "
+Get the transparency (0-1)
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_color_map "
+Set the color map by supplying a vector of 768 values
+(256*RGB) (using std::vector for Python compatibility via
+SWIG)
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_color_map "
+Get the color map as a vector of 768 values (256*RGB) (using
+std::vector for Python compatibility via SWIG)
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_color_map_array "
+Get the color map as a boost::multi_array (256x3)
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_viewpoint_buttons "
+Toggle viewpoint buttons
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::get_viewpoint_buttons "
+Get the viewpoint button state
+";
+
+%feature("docstring")  dolfin::X3DOMParameters::set_x3d_stats "
+Turn X3D 'statistics' window on/off
+";
+
+%feature("docstring")  dolfin::X3DOM "
+This class implements output of meshes to X3DOM XML or HTML5
+with X3DOM strings. The latter can be used for interactive visualisation
+
+Developer note: pugixml is used to created X3DOM and HTML5. By
+using pugixml, we produce valid XML, but care must be taken that
+the XML is also valid HTML. This includes not letting pugixml
+create self-closing elements, in cases. E.g., <foo
+bar=\"foobar\"></foo> is fine, but the self-closing syntax <foo
+bar=\"foobar\" /> while being valid XML is is not valid HTML5. See
+https://github.com/x3dom/x3dom/issues/600.
+";
+
+%feature("docstring")  dolfin::X3DOM::str "
+**Overloaded versions**
+
+* str\ ()
+
+  Return X3D string for a Mesh
+
+* str\ ()
+
+  Return X3D string for a Function
+";
+
+%feature("docstring")  dolfin::X3DOM::html "
+**Overloaded versions**
+
+* html\ ()
+
+  Return HTML5 string with embedded X3D for a Mesh
+
+* html\ ()
+
+  Return HTML5 string with embedded X3D for a Function
+";
+
diff --git a/dolfin/swig/io/post.i b/dolfin/swig/io/post.i
index 20cb350..336eaf8 100644
--- a/dolfin/swig/io/post.i
+++ b/dolfin/swig/io/post.i
@@ -111,4 +111,28 @@ def __exit__(self, type, value, traceback) :
     self.close()
 %}
 }
+
+%extend dolfin::X3DOMParameters
+{
+%pythoncode %{
+def set_color_map(self, colormap):
+    if (isinstance(colormap, str)):
+        # If we are given a string, try to load the corresponding matplotlib cmap
+        try:
+            import matplotlib.cm
+            import numpy
+            mpl_cmap = matplotlib.cm.get_cmap(colormap)
+            # Flatten colormap to simple list
+            cmap_data = [val for s in [list(mpl_cmap(i)[:3]) for i in range(256)] for val in s]
+            self._set_color_map(numpy.array(cmap_data, dtype='double'))
+        except:
+            # FIXME: raise error or print warning
+            pass
+    else:
+        # Not a string - assume user has supplied valid cmap data as an array
+        self._set_color_map(colormap)
+%}
+}
+
+
 #endif
diff --git a/dolfin/swig/io/pre.i b/dolfin/swig/io/pre.i
index 69602c8..3d6836a 100644
--- a/dolfin/swig/io/pre.i
+++ b/dolfin/swig/io/pre.i
@@ -41,3 +41,5 @@
 %ignore dolfin::HDF5Attribute::get;
 %ignore dolfin::HDF5Attribute::set;
 
+%ignore dolfin::X3DOMParameters::get_color_map_array;
+%rename (_set_color_map) dolfin::X3DOMParameters::set_color_map;
diff --git a/dolfin/swig/la/docstrings.i b/dolfin/swig/la/docstrings.i
index 4dfa416..79f733e 100644
--- a/dolfin/swig/la/docstrings.i
+++ b/dolfin/swig/la/docstrings.i
@@ -70,6 +70,10 @@ different types.
   Return concrete shared ptr instance / unwrap (non-const version)
 ";
 
+%feature("docstring")  dolfin::LinearAlgebraObject::mpi_comm "
+Return MPI communicator
+";
+
 %feature("docstring")  dolfin::LinearAlgebraObject::as_type "
 **Overloaded versions**
 
@@ -181,10 +185,6 @@ Set all entries to zero and keep any sparse structure
 Finalize assembly of tensor
 ";
 
-%feature("docstring")  dolfin::GenericTensor::mpi_comm "
-Return MPI communicator
-";
-
 %feature("docstring")  dolfin::GenericTensor::str "
 Return informal string representation (pretty-print)
 ";
@@ -398,78 +398,6 @@ before using using the object.
 Insert one on the diagonal for all zero rows
 ";
 
-// Documentation extracted from: (module=la, header=GenericSparsityPattern.h)
-%feature("docstring")  dolfin::GenericSparsityPattern "
-Base class (interface) for generic tensor sparsity patterns.
-Currently, this interface is mostly limited to matrices.
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::GenericSparsityPattern "
-Create empty sparsity pattern
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::init "
-Initialize sparsity pattern for a generic tensor
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::insert_global "
-Insert non-zero entries using global indices
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::insert_local "
-Insert non-zero entries using local (process-wise) entries
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::rank "
-Return rank
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::primary_dim "
-Return primary dimension (e.g., 0=row partition, 1=column
-partition)
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::local_range "
-Return local range for dimension dim
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::num_nonzeros "
-Return total number of nonzeros in local_range
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::num_nonzeros_diagonal "
-Fill vector with number of nonzeros for diagonal block in
-local_range for primary dimension
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::num_nonzeros_off_diagonal "
-Fill vector with number of nonzeros for off-diagonal block in
-local_range for primary dimension
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::num_local_nonzeros "
-Fill vector with number of nonzeros in local_range for primary
-dimension
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::diagonal_pattern "
-Return underlying sparsity pattern (diagonal). Options are
-'sorted' and 'unsorted'.
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::off_diagonal_pattern "
-Return underlying sparsity pattern (off-diagonal). Options
-are 'sorted' and 'unsorted'.
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::apply "
-Finalize sparsity pattern
-";
-
-%feature("docstring")  dolfin::GenericSparsityPattern::mpi_comm "
-Return MPI communicator
-";
-
 // Documentation extracted from: (module=la, header=GenericVector.h)
 %feature("docstring")  dolfin::GenericVector "
 This class defines a common interface for vectors.
@@ -481,6 +409,7 @@ This class defines a common interface for vectors.
 * init\ (tensor_layout)
 
   Initialize zero tensor using sparsity pattern
+  FIXME: This needs to be implemented on backend side! Remove it!
 
 * init\ (comm, N)
 
@@ -494,6 +423,7 @@ This class defines a common interface for vectors.
 
   Initialise vector with given ownership range and with ghost
   values
+  FIXME: Reimplement using init(const TensorLayout&) and deprecate
 ";
 
 %feature("docstring")  dolfin::GenericVector::rank "
@@ -771,6 +701,12 @@ and near nullspaces of singular operators
 Constructor
 ";
 
+%feature("docstring")  dolfin::VectorSpaceBasis::orthonormalize "
+Apply the Gram-Schmidt process to orthonormalize the
+basis. Throws an error if a (near) linear dependency is
+detected. Error is thrown if <x_i, x_i> < tol.
+";
+
 %feature("docstring")  dolfin::VectorSpaceBasis::is_orthonormal "
 Test if basis is orthonormal
 ";
@@ -784,7 +720,7 @@ Orthogonalize x with respect to basis
 ";
 
 %feature("docstring")  dolfin::VectorSpaceBasis::dim "
-Dimension of the basis
+Number of vectors in the basis
 ";
 
 %feature("docstring")  dolfin::VectorSpaceBasis::operator[] "
@@ -804,11 +740,6 @@ Set operator (matrix)
 Set operator (matrix) and preconditioner matrix
 ";
 
-%feature("docstring")  dolfin::GenericLinearSolver::set_nullspace "
-Set null space of the operator (matrix). This is used to solve
-singular systems
-";
-
 %feature("docstring")  dolfin::GenericLinearSolver::solve "
 **Overloaded versions**
 
@@ -874,31 +805,17 @@ Set operator (matrix)
   Solve linear system A^Tx = b
 ";
 
-// Documentation extracted from: (module=la, header=GenericPreconditioner.h)
-%feature("docstring")  dolfin::GenericPreconditioner "
-This class provides a common base preconditioners.
-";
-
-%feature("docstring")  dolfin::GenericPreconditioner::set_nullspace "
-Set the (approximate) null space of the preconditioner operator
-(matrix). This is required for certain preconditioner types,
-e.g. smoothed aggregation multigrid
-";
-
-%feature("docstring")  dolfin::GenericPreconditioner::set_coordinates "
-Set the coordinates of the operator (matrix) rows and geometric
-dimension d. This is can be used by required for certain
-preconditioners, e.g. ML. The input for this function can be
-generated using GenericDofMap::tabulate_all_dofs.
+%feature("docstring")  dolfin::GenericLUSolver::parameter_type "
+Return parameter type: \"krylov_solver\" or \"lu_solver\"
 ";
 
 // Documentation extracted from: (module=la, header=PETScOptions.h)
 %feature("docstring")  dolfin::PETScOptions "
 These class provides static functions that permit users to set
 and retrieve PETSc options via the PETSc option/parameter
-system. The option should be prefixed by '-', e.g.
+system. The option must not be prefixed by '-', e.g.
 
-    PETScOptions::set(\"mat_mumps_icntl_14\", 40.0);
+    PETScOptions::set(\"mat_mumps_icntl_14\", 40);
 ";
 
 %feature("docstring")  dolfin::PETScOptions::set "
@@ -971,7 +888,16 @@ PETScKrylovSolver.
 ";
 
 %feature("docstring")  dolfin::PETScBaseMatrix::size "
-Return number of rows (dim = 0) or columns (dim = 1)
+**Overloaded versions**
+
+* size\ (dim)
+
+  Return number of rows (dim = 0) or columns (dim = 1)
+
+* size\ ()
+
+  Return number of rows and columns (num_rows, num_cols). PETSc
+  returns -1 if size has not been set.
 ";
 
 %feature("docstring")  dolfin::PETScBaseMatrix::local_range "
@@ -992,6 +918,10 @@ important.
 Return PETSc Mat pointer
 ";
 
+%feature("docstring")  dolfin::PETScBaseMatrix::mpi_comm "
+Return the MPI communicator
+";
+
 %feature("docstring")  dolfin::PETScBaseMatrix::str "
 Return informal string representation (pretty-print)
 ";
@@ -1213,11 +1143,16 @@ use the standard PETSc interface.
 
 * PETScMatrix\ ()
 
+  Create empty matrix (on MPI_COMM_WORLD)
+
+* PETScMatrix\ (comm)
+
   Create empty matrix
 
 * PETScMatrix\ (A)
 
-  Create a wrapper around a PETSc Mat pointer
+  Create a wrapper around a PETSc Mat pointer. The Mat object
+  should have been created, e.g. via PETSc MatrCreate.
 
 * PETScMatrix\ (A)
 
@@ -1381,8 +1316,18 @@ Returns the prefix used by PETSc when searching the options
 database
 ";
 
+%feature("docstring")  dolfin::PETScMatrix::set_from_options "
+Call PETSc function MatSetFromOptions on the PETSc Mat object
+";
+
 %feature("docstring")  dolfin::PETScMatrix::set_nullspace "
-Attach nullspace to matrix
+Attach nullspace to matrix (typically used by Krylov solvers
+when solving singular systems)
+";
+
+%feature("docstring")  dolfin::PETScMatrix::set_near_nullspace "
+Attach near nullspace to matrix (used by preconditioners, such
+as smoothed aggregation algerbraic multigrid)
 ";
 
 %feature("docstring")  dolfin::PETScMatrix::binary_dump "
@@ -1402,6 +1347,10 @@ Return size of given dimension
 Compute matrix-vector product y = Ax
 ";
 
+%feature("docstring")  dolfin::PETScLinearOperator::mpi_comm "
+Return MPI communicator
+";
+
 %feature("docstring")  dolfin::PETScLinearOperator::str "
 Return informal string representation (pretty-print)
 ";
@@ -1434,16 +1383,6 @@ Create a particular preconditioner object
 Set the preconditioner type and parameters
 ";
 
-%feature("docstring")  dolfin::PETScPreconditioner::set_nullspace "
-Set the (near) null space of the preconditioner operator
-(matrix). This is required for certain preconditioner types,
-e.g. smoothed aggregation multigrid
-";
-
-%feature("docstring")  dolfin::PETScPreconditioner::near_nullspace "
-Return the PETSc null space
-";
-
 %feature("docstring")  dolfin::PETScPreconditioner::set_coordinates "
 Set the coordinates of the operator (matrix) rows and
 geometric dimension d. This is can be used by required for
@@ -1459,10 +1398,6 @@ Return informal string representation (pretty-print)
 Return a list of available preconditioners
 ";
 
-%feature("docstring")  dolfin::PETScPreconditioner::default_parameters "
-Default parameter values
-";
-
 // Documentation extracted from: (module=la, header=TpetraMatrix.h)
 %feature("docstring")  dolfin::TpetraMatrix "
 This class provides a simple matrix class based on Tpetra.  It
@@ -1704,6 +1639,10 @@ Return a list of available preconditioners
 Default parameter values
 ";
 
+%feature("docstring")  dolfin::EigenKrylovSolver::parameter_type "
+Return parameter type: \"krylov_solver\" or \"lu_solver\"
+";
+
 // Documentation extracted from: (module=la, header=EigenLUSolver.h)
 %feature("docstring")  dolfin::EigenLUSolver "
 This class implements the direct solution (LU factorization) for
@@ -1788,33 +1727,44 @@ Default parameter values
 
 // Documentation extracted from: (module=la, header=PETScKrylovSolver.h)
 %feature("docstring")  dolfin::PETScKrylovSolver "
-This class implements Krylov methods for linear systems
-of the form Ax = b. It is a wrapper for the Krylov solvers
-of PETSc.
+This class implements Krylov methods for linear systems of the
+form Ax = b. It is a wrapper for the Krylov solvers of PETSc.
+";
+
+%feature("docstring")  dolfin::PETScKrylovSolver::norm_type "
+Norm types used in convergence testing. Not all solvers types
+support all norm types (see
+http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetNormType.html). Note
+that 'default' is a reserved keyword, so we use 'default_norm'
 ";
 
 %feature("docstring")  dolfin::PETScKrylovSolver::PETScKrylovSolver "
 **Overloaded versions**
 
-* PETScKrylovSolver\ (\"default\", \"default\")
+* PETScKrylovSolver\ (comm, method=\"default\", preconditioner=\"default\")
 
-  Create Krylov solver for a particular method and names
+  Create Krylov solver for a particular method and named
   preconditioner
 
-* PETScKrylovSolver\ (method, preconditioner)
+* PETScKrylovSolver\ (method=\"default\", preconditioner=\"default\")
+
+  Create Krylov solver for a particular method and named
+  preconditioner
+
+* PETScKrylovSolver\ (comm, method, preconditioner)
 
   Create Krylov solver for a particular method and
-  PETScPreconditioner
+  PETScPreconditioner (shared_ptr version)
 
 * PETScKrylovSolver\ (method, preconditioner)
 
   Create Krylov solver for a particular method and
   PETScPreconditioner (shared_ptr version)
 
-* PETScKrylovSolver\ (method, preconditioner)
+* PETScKrylovSolver\ (comm, method, preconditioner)
 
   Create Krylov solver for a particular method and
-  PETScPreconditioner
+  PETScPreconditioner (shared_ptr version)
 
 * PETScKrylovSolver\ (method, preconditioner)
 
@@ -1834,15 +1784,6 @@ Set operator (matrix)
 Set operator (matrix) and preconditioner matrix
 ";
 
-%feature("docstring")  dolfin::PETScKrylovSolver::set_nullspace "
-Set null space of the operator (matrix). This is used to solve
-singular systems
-";
-
-%feature("docstring")  dolfin::PETScKrylovSolver::get_operator "
-Get operator (matrix)
-";
-
 %feature("docstring")  dolfin::PETScKrylovSolver::solve "
 **Overloaded versions**
 
@@ -1859,26 +1800,58 @@ Get operator (matrix)
   Solve linear system Ax = b and return number of iterations
 ";
 
+%feature("docstring")  dolfin::PETScKrylovSolver::set_nonzero_guess "
+Use nonzero intial guess for solution function
+(nonzero_guess=true, the solution vector x will not be zeroed
+before the solver starts)
+";
+
 %feature("docstring")  dolfin::PETScKrylovSolver::set_reuse_preconditioner "
-Reuse preconditioner if true, otherwise do not, even if matrix
-operator changes (by default preconditioner is re-built if the
-matrix changes)
+Reuse preconditioner if true, even if matrix operator changes
+(by default preconditioner will be re-built if the matrix
+changes)
+";
+
+%feature("docstring")  dolfin::PETScKrylovSolver::set_tolerances "
+Set tolerances (relative residual, alsolute residial, maximum
+number of iterations)
+";
+
+%feature("docstring")  dolfin::PETScKrylovSolver::set_norm_type "
+Set norm type used in convergence testing - not all solvers
+types support all norm types
+";
+
+%feature("docstring")  dolfin::PETScKrylovSolver::get_norm_type "
+Get norm type used in convergence testing
+";
+
+%feature("docstring")  dolfin::PETScKrylovSolver::monitor "
+Monitor residual at each iteration
 ";
 
 %feature("docstring")  dolfin::PETScKrylovSolver::set_options_prefix "
-Sets the prefix used by PETSc when searching the options
+Sets the prefix used by PETSc when searching the PETSc options
 database
 ";
 
 %feature("docstring")  dolfin::PETScKrylovSolver::get_options_prefix "
-Returns the prefix used by PETSc when searching the options
-database
+Returns the prefix used by PETSc when searching the PETSc
+options database
+";
+
+%feature("docstring")  dolfin::PETScKrylovSolver::set_from_options "
+Set options from PETSc options database
 ";
 
 %feature("docstring")  dolfin::PETScKrylovSolver::str "
 Return informal string representation (pretty-print)
 ";
 
+%feature("docstring")  dolfin::PETScKrylovSolver::mpi_comm "
+Return MPI communicator
+";
+
 %feature("docstring")  dolfin::PETScKrylovSolver::ksp "
 Return PETSc KSP pointer
 ";
@@ -1888,13 +1861,17 @@ Return a list of available solver methods
 ";
 
 %feature("docstring")  dolfin::PETScKrylovSolver::preconditioners "
-Return a list of available preconditioners
+Return a list of available named preconditioners
 ";
 
 %feature("docstring")  dolfin::PETScKrylovSolver::default_parameters "
 Default parameter values
 ";
 
+%feature("docstring")  dolfin::PETScKrylovSolver::parameter_type "
+Return parameter type: \"krylov_solver\" or \"lu_solver\"
+";
+
 // Documentation extracted from: (module=la, header=PETScLUSolver.h)
 %feature("docstring")  dolfin::PETScLUSolver "
 This class implements the direct solution (LU factorization) for
@@ -1905,10 +1882,18 @@ solver of PETSc.
 %feature("docstring")  dolfin::PETScLUSolver::PETScLUSolver "
 **Overloaded versions**
 
+* PETScLUSolver\ (comm, method=\"default\")
+
+  Constructor
+
 * PETScLUSolver\ (method=\"default\")
 
   Constructor
 
+* PETScLUSolver\ (comm, A, method=\"default\")
+
+  Constructor
+
 * PETScLUSolver\ (A, method=\"default\")
 
   Constructor
@@ -1976,6 +1961,14 @@ Returns the prefix used by PETSc when searching the options
 database
 ";
 
+%feature("docstring")  dolfin::PETScLUSolver::set_from_options "
+Set options from the PETSc options database
+";
+
+%feature("docstring")  dolfin::PETScLUSolver::mpi_comm "
+Returns the MPI communicator
+";
+
 %feature("docstring")  dolfin::PETScLUSolver::str "
 Return informal string representation (pretty-print)
 ";
@@ -2000,8 +1993,16 @@ from Trilinos
 ";
 
 %feature("docstring")  dolfin::BelosKrylovSolver::BelosKrylovSolver "
-Create Krylov solver for a particular method and names
-preconditioner
+**Overloaded versions**
+
+* BelosKrylovSolver\ (\"default\", \"default\")
+
+  Create Krylov solver for a particular method and names
+  preconditioner
+
+* BelosKrylovSolver\ (method, preconditioner)
+
+  Create Krylov solver for a particular method and TrilinosPreconditioner
 ";
 
 %feature("docstring")  dolfin::BelosKrylovSolver::set_operator "
@@ -2044,225 +2045,67 @@ Return a list of available preconditioners
 Default parameter values
 ";
 
-// Documentation extracted from: (module=la, header=MUMPSLUSolver.h)
-%feature("docstring")  dolfin::MUMPSLUSolver "
-This class implements the direct solution (LU factorization) for
-linear systems of the form Ax = b. It is a wrapper for the MUMPS
-LU solver.
-";
-
-%feature("docstring")  dolfin::MUMPSLUSolver::MUMPSLUSolver "
-**Overloaded versions**
-
-* MUMPSLUSolver\ (A)
-
-  Constructor
-
-* MUMPSLUSolver\ (A)
-
-  Constructor
-";
-
-%feature("docstring")  dolfin::MUMPSLUSolver::solve "
-Solve linear system Ax = b
-";
-
-%feature("docstring")  dolfin::MUMPSLUSolver::default_parameters "
-Default parameter values
-";
-
-// Documentation extracted from: (module=la, header=PaStiXLUSolver.h)
-%feature("docstring")  dolfin::PaStiXLUSolver::PaStiXLUSolver "
-**Overloaded versions**
-
-* PaStiXLUSolver\ (A)
-
-  Constructor
-
-* PaStiXLUSolver\ (A)
-
-  Constructor
-";
-
-%feature("docstring")  dolfin::PaStiXLUSolver::solve "
-Solve Ax = b
-";
-
-%feature("docstring")  dolfin::PaStiXLUSolver::default_parameters "
-Default parameter values
-";
-
-// Documentation extracted from: (module=la, header=STLMatrix.h)
-%feature("docstring")  dolfin::STLMatrix "
-Simple STL-based implementation of the GenericMatrix interface.
-The sparse matrix is stored as a pair of std::vector of
-std::vector, one for the columns and one for the values.
-
-Historically, this class has undergone a number of different
-incarnations, based on various combinations of std::vector,
-std::set and std::map. The current implementation has proven to
-be the fastest.
-";
-
-%feature("docstring")  dolfin::STLMatrix::STLMatrix "
-Create empty matrix
-";
-
-%feature("docstring")  dolfin::STLMatrix::init "
---- Implementation of the GenericTensor interface ---
-Initialize zero tensor using sparsity pattern
-";
-
-%feature("docstring")  dolfin::STLMatrix::empty "
-Return true if empty
-";
-
-%feature("docstring")  dolfin::STLMatrix::size "
-Return size of given dimension
+%feature("docstring")  dolfin::BelosKrylovSolver::parameter_type "
+Return parameter type: \"krylov_solver\" or \"lu_solver\"
 ";
 
-%feature("docstring")  dolfin::STLMatrix::local_range "
-Return local ownership range
+// Documentation extracted from: (module=la, header=TrilinosPreconditioner.h)
+%feature("docstring")  dolfin::TrilinosPreconditioner "
+This class provides a common base for Trilinos preconditioners.
 ";
 
-%feature("docstring")  dolfin::STLMatrix::zero "
-**Overloaded versions**
-
-* zero\ ()
-
-  Set all entries to zero and keep any sparse structure
-
-* zero\ (m, rows)
-
-  Set given rows (global row indices) to zero
+// Documentation extracted from: (module=la, header=MueluPreconditioner.h)
+%feature("docstring")  dolfin::MueluPreconditioner "
+Implements Muelu preconditioner from Trilinos
 ";
 
-%feature("docstring")  dolfin::STLMatrix::apply "
-Finalize assembly of tensor
+%feature("docstring")  dolfin::MueluPreconditioner::MueluPreconditioner "
+Create a particular preconditioner object
 ";
 
-%feature("docstring")  dolfin::STLMatrix::mpi_comm "
-Return MPI communicator
+%feature("docstring")  dolfin::MueluPreconditioner::set "
+Set the preconditioner on a solver
 ";
 
-%feature("docstring")  dolfin::STLMatrix::str "
+%feature("docstring")  dolfin::MueluPreconditioner::str "
 Return informal string representation (pretty-print)
 ";
 
-%feature("docstring")  dolfin::STLMatrix::copy "
-Return copy of matrix
-";
-
-%feature("docstring")  dolfin::STLMatrix::init_vector "
-Initialize vector z to be compatible with the matrix-vector
-product y = Ax. In the parallel case, both size and layout are
-important.
-
-*Arguments*
-    dim (int)
-        The dimension (axis): dim = 0 --> z = y, dim = 1 --> z = x
-";
-
-%feature("docstring")  dolfin::STLMatrix::get "
-Get block of values
-";
-
-%feature("docstring")  dolfin::STLMatrix::set "
-Set block of values using global indices
-";
-
-%feature("docstring")  dolfin::STLMatrix::set_local "
-Set block of values using local indices
-";
-
-%feature("docstring")  dolfin::STLMatrix::add "
-Add block of values using global indices
-";
-
-%feature("docstring")  dolfin::STLMatrix::add_local "
-Add block of values using local indices
-";
-
-%feature("docstring")  dolfin::STLMatrix::axpy "
-Add multiple of given matrix (AXPY operation)
-";
-
-%feature("docstring")  dolfin::STLMatrix::norm "
-Return norm of matrix
-";
-
-%feature("docstring")  dolfin::STLMatrix::getrow "
-Get non-zero values of given row
-";
-
-%feature("docstring")  dolfin::STLMatrix::setrow "
-Set values for given row
-";
-
-%feature("docstring")  dolfin::STLMatrix::zero_local "
-Set given rows (local row indices) to zero
-";
-
-%feature("docstring")  dolfin::STLMatrix::ident "
-Set given rows to identity matrix
-";
-
-%feature("docstring")  dolfin::STLMatrix::ident_local "
-Set given rows to identity matrix
-";
-
-%feature("docstring")  dolfin::STLMatrix::get_diagonal "
-Get diagonal of a matrix
-";
-
-%feature("docstring")  dolfin::STLMatrix::set_diagonal "
-Set diagonal of a matrix
-";
-
-%feature("docstring")  dolfin::STLMatrix::operator*= "
-Multiply matrix by given number
-";
-
-%feature("docstring")  dolfin::STLMatrix::operator/= "
-Divide matrix by given number
-";
-
-%feature("docstring")  dolfin::STLMatrix::operator= "
-Assignment operator
+%feature("docstring")  dolfin::MueluPreconditioner::init "
+Initialise preconditioner based on Operator P
 ";
 
-%feature("docstring")  dolfin::STLMatrix::factory "
---- Specialized matrix functions ---
-Return linear algebra backend factory
+%feature("docstring")  dolfin::MueluPreconditioner::default_parameters "
+Default parameter values
 ";
 
-%feature("docstring")  dolfin::STLMatrix::block_size "
---- STLMatrix interface ---
-Return matrix block size
+// Documentation extracted from: (module=la, header=Ifpack2Preconditioner.h)
+%feature("docstring")  dolfin::Ifpack2Preconditioner "
+Implements preconditioners using Ifpack2 from Trilinos
 ";
 
-%feature("docstring")  dolfin::STLMatrix::clear "
-Clear matrix. Destroys data and sparse layout
+%feature("docstring")  dolfin::Ifpack2Preconditioner::Ifpack2Preconditioner "
+Create a particular preconditioner object
 ";
 
-%feature("docstring")  dolfin::STLMatrix::csr "
-Return matrix in CSR format
+%feature("docstring")  dolfin::Ifpack2Preconditioner::set "
+Set the preconditioner type on a solver
 ";
 
-%feature("docstring")  dolfin::STLMatrix::csc "
-Return matrix in CSC format
+%feature("docstring")  dolfin::Ifpack2Preconditioner::str "
+Return informal string representation (pretty-print)
 ";
 
-%feature("docstring")  dolfin::STLMatrix::nnz "
-Return number of global non-zero entries
+%feature("docstring")  dolfin::Ifpack2Preconditioner::init "
+Initialise preconditioner based on Operator P
 ";
 
-%feature("docstring")  dolfin::STLMatrix::local_nnz "
-Return number of local non-zero entries
+%feature("docstring")  dolfin::Ifpack2Preconditioner::preconditioners "
+Return a list of available preconditioners
 ";
 
-%feature("docstring")  dolfin::STLMatrix::compressed_storage "
-Return matrix in compressed format
+%feature("docstring")  dolfin::Ifpack2Preconditioner::default_parameters "
+Default parameter values
 ";
 
 // Documentation extracted from: (module=la, header=CoordinateMatrix.h)
@@ -2294,9 +2137,13 @@ interface which is documented at http://eigen.tuxfamily.org
 
 * EigenVector\ ()
 
+  Create empty vector (on MPI_COMM_SELF)
+
+* EigenVector\ (comm)
+
   Create empty vector
 
-* EigenVector\ (N)
+* EigenVector\ (comm, N)
 
   Create vector of size N
 
@@ -2582,7 +2429,11 @@ use the standard PETSc interface.
 
 * PETScVector\ ()
 
-  Create empty vector
+  Create empty vector (on MPI_COMM_WORLD)
+
+* PETScVector\ (comm)
+
+  Create empty vector on an MPI communicator
 
 * PETScVector\ (comm, N)
 
@@ -2598,7 +2449,9 @@ use the standard PETSc interface.
 
 * PETScVector\ (x)
 
-  Create vector wrapper of PETSc Vec pointer
+  Create vector wrapper of PETSc Vec pointer. The reference
+  counter of the Vec will be increased, and decreased upon
+  destruction of this object.
 ";
 
 %feature("docstring")  dolfin::PETScVector::zero "
@@ -2634,7 +2487,8 @@ Return copy of vector
 
 * init\ (comm, range, local_to_global_map, ghost_indices)
 
-  Initialize vector with given ownership range and with ghost values
+  Initialize vector with given ownership range and with ghost
+  values
 ";
 
 %feature("docstring")  dolfin::PETScVector::empty "
@@ -2828,10 +2682,20 @@ Returns the prefix used by PETSc when searching the options
 database
 ";
 
+%feature("docstring")  dolfin::PETScVector::set_from_options "
+Call PETSc function VecSetFromOptions on the underlying Vec
+object
+";
+
 %feature("docstring")  dolfin::PETScVector::vec "
 Return pointer to PETSc Vec object
 ";
 
+%feature("docstring")  dolfin::PETScVector::reset "
+Switch underlying PETSc object. Intended for internal library
+usage.
+";
+
 // Documentation extracted from: (module=la, header=TpetraVector.h)
 %feature("docstring")  dolfin::TpetraVector "
 This class provides a simple vector class based on Tpetra.  It
@@ -2846,7 +2710,7 @@ vec() and use the standard Tpetra interface.
 %feature("docstring")  dolfin::TpetraVector::TpetraVector "
 **Overloaded versions**
 
-* TpetraVector\ ()
+* TpetraVector\ (comm=MPI_COMM_WORLD)
 
   Create empty vector
 
@@ -3099,7 +2963,7 @@ initialise tensors.
 
   Create empty tensor layout
 
-* TensorLayout\ (mpi_comm, dims, primary_dim, block_size, ownership_range, sparsity_pattern)
+* TensorLayout\ (mpi_comm, index_maps, primary_dim, sparsity_pattern, ghosted)
 
   Create a tensor layout
 ";
@@ -3141,10 +3005,18 @@ Return informal string representation (pretty-print)
 Return MPI communicator
 ";
 
+%feature("docstring")  dolfin::TensorLayout::index_map "
+Return IndexMap for dimension
+";
+
+%feature("docstring")  dolfin::TensorLayout::is_ghosted "
+Require ghosts
+";
+
 // Documentation extracted from: (module=la, header=SparsityPattern.h)
 %feature("docstring")  dolfin::SparsityPattern "
-This class implements the GenericSparsityPattern interface.  It
-is used by most linear algebra backends.
+This class implements a sparsity pattern data structure.  It is
+used by most linear algebra backends.
 ";
 
 %feature("docstring")  dolfin::SparsityPattern::SparsityPattern "
@@ -3154,7 +3026,7 @@ is used by most linear algebra backends.
 
   Create empty sparsity pattern
 
-* SparsityPattern\ (mpi_comm, dims, ownership_range, local_to_global, off_process_owner, block_sizes, primary_dim)
+* SparsityPattern\ (mpi_comm, index_maps, primary_dim)
 
   Create sparsity pattern for a generic tensor
 ";
@@ -3164,17 +3036,37 @@ Initialize sparsity pattern for a generic tensor
 ";
 
 %feature("docstring")  dolfin::SparsityPattern::insert_global "
-Insert non-zero entries using global indices
+**Overloaded versions**
+
+* insert_global\ (i, j)
+
+  Insert a global entry - will be fixed by apply()
+
+* insert_global\ (entries)
+
+  Insert non-zero entries using global indices
 ";
 
 %feature("docstring")  dolfin::SparsityPattern::insert_local "
 Insert non-zero entries using local (process-wise) indices
 ";
 
+%feature("docstring")  dolfin::SparsityPattern::insert_full_rows_local "
+Insert full rows (or columns, according to primary dimension)
+using local (process-wise) indices. This must be called before
+any other sparse insertion occurs to avoid quadratic complexity
+of dense rows insertion
+";
+
 %feature("docstring")  dolfin::SparsityPattern::rank "
 Return rank
 ";
 
+%feature("docstring")  dolfin::SparsityPattern::primary_dim "
+Return primary dimension (e.g., 0=row partition, 1=column
+partition)
+";
+
 %feature("docstring")  dolfin::SparsityPattern::local_range "
 Return local range for dimension dim
 ";
@@ -3192,7 +3084,9 @@ number of nonzeros per local row for diagonal block
 %feature("docstring")  dolfin::SparsityPattern::num_nonzeros_off_diagonal "
 Fill array with number of nonzeros for off-diagonal block in
 local_range for dimension 0. For matrices, fill array with
-number of nonzeros per local row for off-diagonal block
+number of nonzeros per local row for off-diagonal block. If
+there is no off-diagonal pattern, the vector is resized to
+zero-length
 ";
 
 %feature("docstring")  dolfin::SparsityPattern::num_local_nonzeros "
@@ -3215,7 +3109,75 @@ Return underlying sparsity pattern (diagonal). Options are
 
 %feature("docstring")  dolfin::SparsityPattern::off_diagonal_pattern "
 Return underlying sparsity pattern (off-diagonal). Options are
-'sorted' and 'unsorted'.
+'sorted' and 'unsorted'. Empty vector is returned if there is no
+off-diagonal contribution.
+";
+
+// Documentation extracted from: (module=la, header=IndexMap.h)
+%feature("docstring")  dolfin::IndexMap "
+This class represents the distribution index arrays across
+processes. An index array is a contiguous collection of N+1
+indices [0, 1, . . ., N] that are distributed across processes M
+processes. On a given process, the IndexMap stores a portion of
+the index set using local indices [0, 1, . . . , n], and a map
+from the local indices to a unique global index.
+";
+
+%feature("docstring")  dolfin::MapSize::IndexMap "
+**Overloaded versions**
+
+* IndexMap\ ()
+
+  Constructor
+
+* IndexMap\ (mpi_comm)
+
+  Index map with no data
+
+* IndexMap\ (mpi_comm, local_size, block_size)
+
+  Index map with local size on each process. This constructor
+  is collective
+";
+
+%feature("docstring")  dolfin::MapSize::init "
+Initialise with number of local entries and block size. This
+function is collective
+";
+
+%feature("docstring")  dolfin::MapSize::local_range "
+Local range of indices
+";
+
+%feature("docstring")  dolfin::MapSize::size "
+Get number of local indices of type MapSize::OWNED,
+MapSize::UNOWNED, MapSize::ALL or MapSize::GLOBAL
+";
+
+%feature("docstring")  dolfin::MapSize::local_to_global_unowned "
+Get local to global map for unowned indices
+(local indexing beyond end of local range)
+";
+
+%feature("docstring")  dolfin::MapSize::local_to_global "
+Get global index of local index i
+";
+
+%feature("docstring")  dolfin::MapSize::set_local_to_global "
+Set local_to_global map for unowned indices (beyond end of local
+range). Computes and stores off-process owner array.
+";
+
+%feature("docstring")  dolfin::MapSize::off_process_owner "
+Get off process owner for unowned indices
+";
+
+%feature("docstring")  dolfin::MapSize::block_size "
+Get block size
+";
+
+%feature("docstring")  dolfin::MapSize::mpi_comm "
+Return MPI communicator
 ";
 
 // Documentation extracted from: (module=la, header=GenericLinearAlgebraFactory.h)
@@ -3409,39 +3371,55 @@ Return singleton instance
 Private constructor
 ";
 
-// Documentation extracted from: (module=la, header=STLFactory.h)
-%feature("docstring")  dolfin::STLFactory::create_matrix "
+// Documentation extracted from: (module=la, header=TpetraFactory.h)
+%feature("docstring")  dolfin::TpetraFactory::create_matrix "
 Create empty matrix
 ";
 
-%feature("docstring")  dolfin::STLFactory::create_vector "
+%feature("docstring")  dolfin::TpetraFactory::create_vector "
 Create empty vector
 ";
 
-%feature("docstring")  dolfin::STLFactory::create_layout "
+%feature("docstring")  dolfin::TpetraFactory::create_layout "
 Create empty tensor layout
 ";
 
-%feature("docstring")  dolfin::STLFactory::create_linear_operator "
+%feature("docstring")  dolfin::TpetraFactory::create_linear_operator "
 Create empty linear operator
 ";
 
-%feature("docstring")  dolfin::STLFactory::create_lu_solver "
+%feature("docstring")  dolfin::TpetraFactory::create_lu_solver "
 Create LU solver
 ";
 
-%feature("docstring")  dolfin::STLFactory::create_krylov_solver "
+%feature("docstring")  dolfin::TpetraFactory::create_krylov_solver "
 Create Krylov solver
 ";
 
-%feature("docstring")  dolfin::STLFactory::instance "
+%feature("docstring")  dolfin::TpetraFactory::lu_solver_methods "
+Return a list of available LU solver methods
+";
+
+%feature("docstring")  dolfin::TpetraFactory::krylov_solver_methods "
+Return a list of available Krylov solver methods
+";
+
+%feature("docstring")  dolfin::TpetraFactory::krylov_solver_preconditioners "
+Return a list of available preconditioners
+";
+
+%feature("docstring")  dolfin::TpetraFactory::instance "
 Return singleton instance
 ";
 
+%feature("docstring")  dolfin::TpetraFactory::TpetraFactory "
+Private constructor
+";
+
 // Documentation extracted from: (module=la, header=SLEPcEigenSolver.h)
 %feature("docstring")  dolfin::SLEPcEigenSolver "
-This class provides an eigenvalue solver for PETSc matrices.
-It is a wrapper for the SLEPc eigenvalue solver.
+This class provides an eigenvalue solver for PETSc matrices. It
+is a wrapper for the SLEPc eigenvalue solver.
 
 The following parameters may be specified to control the solver.
 
@@ -3456,15 +3434,10 @@ Possible values are
   \"smallest real\"       (eigenvalues with smallest double part)
   \"largest imaginary\"   (eigenvalues with largest imaginary part)
   \"smallest imaginary\"  (eigenvalues with smallest imaginary part)
-
-For SLEPc versions >= 3.1 , the following values are also possible
-
   \"target magnitude\"    (eigenvalues closest to target in magnitude)
   \"target real\"         (eigenvalues closest to target in real part)
   \"target imaginary\"    (eigenvalues closest to target in imaginary part)
 
-The default is \"largest magnitude\"
-
 2. \"solver\"
 
 This parameter controls which algorithm is used by SLEPc.
@@ -3478,14 +3451,10 @@ Possible values are
   \"lapack\"              (LAPACK, all values, direct, small systems only)
   \"arpack\"              (ARPACK)
 
-The default is \"krylov-schur\"
-
 3. \"tolerance\"
 
-This parameter controls the tolerance used by SLEPc.
-Possible values are positive double numbers.
-
-The default is 1e-15;
+This parameter controls the tolerance used by SLEPc.  Possible
+values are positive double numbers.
 
 4. \"maximum_iterations\"
 
@@ -3509,10 +3478,11 @@ extra piece of information. Possible values are:
 
 6. \"spectral_transform\"
 
-This parameter controls the application of a spectral transform. A
-spectral transform can be used to enhance the convergence of the
-eigensolver and in particular to only compute eigenvalues in the
-interior of the spectrum. Possible values are:
+This parameter controls the application of a spectral
+transform. A spectral transform can be used to enhance the
+convergence of the eigensolver and in particular to only compute
+eigenvalues in the interior of the spectrum. Possible values
+are:
 
   \"shift-and-invert\"      (A shift-and-invert transform)
 
@@ -3524,31 +3494,43 @@ The default is no spectral transform.
 7. \"spectral_shift\"
 
 This parameter controls the spectral shift used by the spectral
-transform and must be provided if a spectral transform is given. The
-possible values are real numbers.
-
+transform and must be provided if a spectral transform is
+given. The possible values are real numbers.
 ";
 
 %feature("docstring")  dolfin::SLEPcEigenSolver::SLEPcEigenSolver "
 **Overloaded versions**
 
-* SLEPcEigenSolver\ (A)
+* SLEPcEigenSolver\ (comm)
 
-  Create eigenvalue solver for Ax = \lambda x
+  Create eigenvalue solver
 
-* SLEPcEigenSolver\ (A, B)
+* SLEPcEigenSolver\ (eps)
 
-  Create eigenvalue solver Ax = \lambda Bx
+  Create eigenvalue solver from EPS object
 
 * SLEPcEigenSolver\ (A)
 
+  Create eigenvalue solver for Ax = \lambda
+
+* SLEPcEigenSolver\ (comm, A)
+
   Create eigenvalue solver for Ax = \lambda x
 
 * SLEPcEigenSolver\ (A, B)
 
+  Create eigenvalue solver for Ax = \lambda x on MPI_COMM_WORLD
+
+* SLEPcEigenSolver\ (comm, A, B)
+
   Create eigenvalue solver for Ax = \lambda x
 ";
 
+%feature("docstring")  dolfin::SLEPcEigenSolver::set_operators "
+Set opeartors (B may be nullptr for regular eigenvalues
+problems)
+";
+
 %feature("docstring")  dolfin::SLEPcEigenSolver::solve "
 **Overloaded versions**
 
@@ -3605,6 +3587,16 @@ Get the number of converged eigenvalues
 Set deflation space
 ";
 
+%feature("docstring")  dolfin::SLEPcEigenSolver::set_options_prefix "
+Sets the prefix used by PETSc when searching the PETSc options
+database
+";
+
+%feature("docstring")  dolfin::SLEPcEigenSolver::get_options_prefix "
+Returns the prefix used by PETSc when searching the PETSc
+options database
+";
+
 %feature("docstring")  dolfin::SLEPcEigenSolver::eps "
 Return SLEPc EPS pointer
 ";
@@ -3626,7 +3618,7 @@ based on the default DOLFIN linear algebra backend.
 %feature("docstring")  dolfin::Vector::Vector "
 **Overloaded versions**
 
-* Vector\ ()
+* Vector\ (comm=MPI_COMM_WORLD)
 
   Create empty vector
 
@@ -3875,7 +3867,7 @@ based on the default DOLFIN linear algebra backend.
 %feature("docstring")  dolfin::Matrix::Matrix "
 **Overloaded versions**
 
-* Matrix\ ()
+* Matrix\ (comm=MPI_COMM_WORLD)
 
   Create empty matrix
 
@@ -4045,7 +4037,15 @@ implements the GenericTensor interface for scalars.
 ";
 
 %feature("docstring")  dolfin::Scalar::Scalar "
-Create zero scalar
+**Overloaded versions**
+
+* Scalar\ ()
+
+  Create zero scalar
+
+* Scalar\ (comm)
+
+  Create zero scalar
 ";
 
 %feature("docstring")  dolfin::Scalar::init "
@@ -4129,11 +4129,13 @@ Return a factory for the default linear algebra backend
 ";
 
 %feature("docstring")  dolfin::Scalar::get_scalar_value "
-Get final value (assumes prior apply(), not part of GenericTensor interface)
+Get final value (assumes prior apply(), not part of
+GenericTensor interface)
 ";
 
 %feature("docstring")  dolfin::Scalar::add_local_value "
-Add to local increment (added for testing, remove if we add a better way from python)
+Add to local increment (added for testing, remove if we add a
+better way from python)
 ";
 
 // Documentation extracted from: (module=la, header=LinearSolver.h)
@@ -4142,7 +4144,15 @@ This class provides a general solver for linear systems Ax = b.
 ";
 
 %feature("docstring")  dolfin::LinearSolver::LinearSolver "
-Create linear solver
+**Overloaded versions**
+
+* LinearSolver\ (method=\"default\", preconditioner=\"default\")
+
+  Create linear solver
+
+* LinearSolver\ (comm, method=\"default\", preconditioner=\"default\")
+
+  Create linear solver
 ";
 
 %feature("docstring")  dolfin::LinearSolver::set_operator "
@@ -4188,10 +4198,18 @@ type.
 %feature("docstring")  dolfin::KrylovSolver::KrylovSolver "
 **Overloaded versions**
 
+* KrylovSolver\ (comm, method=\"default\", preconditioner=\"default\")
+
+  Constructor
+
 * KrylovSolver\ (method=\"default\", preconditioner=\"default\")
 
   Constructor
 
+* KrylovSolver\ (comm, A, method=\"default\", preconditioner=\"default\")
+
+  Constructor
+
 * KrylovSolver\ (A, method=\"default\", preconditioner=\"default\")
 
   Constructor
@@ -4205,11 +4223,6 @@ Set operator (matrix)
 Set operator (matrix) and preconditioner matrix
 ";
 
-%feature("docstring")  dolfin::KrylovSolver::set_nullspace "
-Set null space of the operator (matrix). This is used to solve
-singular systems
-";
-
 %feature("docstring")  dolfin::KrylovSolver::solve "
 **Overloaded versions**
 
@@ -4242,10 +4255,18 @@ LU solver for the built-in LA backends.
 %feature("docstring")  dolfin::LUSolver::LUSolver "
 **Overloaded versions**
 
+* LUSolver\ (comm, \"default\")
+
+  Constructor
+
 * LUSolver\ (\"default\")
 
   Constructor
 
+* LUSolver\ (comm, A, method=\"default\")
+
+  Constructor
+
 * LUSolver\ (A, method=\"default\")
 
   Constructor
@@ -4528,6 +4549,10 @@ Return size of given dimension
 Compute matrix-vector product y = Ax
 ";
 
+%feature("docstring")  dolfin::LinearOperator::mpi_comm "
+Return the MPI communicator
+";
+
 %feature("docstring")  dolfin::LinearOperator::str "
 Return informal string representation (pretty-print)
 ";
diff --git a/dolfin/swig/la/post.i b/dolfin/swig/la/post.i
index 74e4798..44844d1 100644
--- a/dolfin/swig/la/post.i
+++ b/dolfin/swig/la/post.i
@@ -878,6 +878,14 @@ AS_BACKEND_TYPE_MACRO(EigenMatrix)
 _matrix_vector_mul_map[EigenMatrix] = [EigenVector]
 %}
 
+#ifdef HAS_TRILINOS
+AS_BACKEND_TYPE_MACRO(TpetraVector)
+AS_BACKEND_TYPE_MACRO(TpetraMatrix)
+%pythoncode %{
+_matrix_vector_mul_map[TpetraMatrix] = [TpetraVector]
+%}
+#endif
+
 #ifdef HAS_PETSC
 AS_BACKEND_TYPE_MACRO(PETScVector)
 AS_BACKEND_TYPE_MACRO(PETScMatrix)
@@ -928,6 +936,13 @@ _matrix_vector_mul_map[PETScLinearOperator] = [PETScVector]
   { snes = self->snes(); }
 }
 
+%feature("docstring") dolfin::PETScTAOSolver::tao "Return petsc4py representation of PETSc TAO solver";
+%extend dolfin::PETScTAOSolver
+{
+  void tao(Tao& tao)
+  { tao = self->tao(); }
+}
+
 #else
 %extend dolfin::PETScBaseMatrix {
     %pythoncode %{
@@ -979,6 +994,16 @@ _matrix_vector_mul_map[PETScLinearOperator] = [PETScVector]
     %}
 }
 
+%extend dolfin::PETScTAOSolver {
+    %pythoncode %{
+        def tao(self):
+            common.dolfin_error("dolfin/swig/la/post.i",
+                                "access PETScTAOSolver objects in python",
+                                "dolfin must be configured with petsc4py enabled")
+            return None
+    %}
+}
+
 #endif  // HAS_PETSC4PY
 #endif  // HAS_PETSC
 
diff --git a/dolfin/swig/la/pre.i b/dolfin/swig/la/pre.i
index 0f7b758..6057251 100644
--- a/dolfin/swig/la/pre.i
+++ b/dolfin/swig/la/pre.i
@@ -170,17 +170,10 @@
 %ignore dolfin::GenericMatrix::setitem;
 %ignore dolfin::GenericMatrix::operator();
 
-// Ignore reference version of constructor
-%ignore dolfin::PETScKrylovSolver(std::string, PETScPreconditioner&);
-%ignore dolfin::PETScKrylovSolver(std::string, PETScUserPreconditioner&);
-%ignore dolfin::PaStiXLUSolver(const STLMatrix& A);
-
 //-----------------------------------------------------------------------------
 // PETSc/SLEPc backend
 //-----------------------------------------------------------------------------
 #ifdef HAS_PETSC
-// Ignore MatNullSpace not properly wrapped by SWIG
-%ignore dolfin::PETScPreconditioner::near_nullspace() const;
 
 // Only ignore C++ accessors if petsc4py is enabled
 #ifdef HAS_PETSC4PY
@@ -189,6 +182,7 @@
 %ignore dolfin::PETScKrylovSolver::ksp() const;
 %ignore dolfin::PETScLUSolver::ksp() const;
 %ignore dolfin::PETScSNESSolver::snes() const;
+%ignore dolfin::PETScTAOSolver::tao() const;
 #else
 // Ignore everything
 %ignore dolfin::PETScVector::vec;
@@ -196,13 +190,11 @@
 %ignore dolfin::PETScKrylovSolver::ksp;
 %ignore dolfin::PETScLUSolver::ksp;
 %ignore dolfin::PETScSNESSolver::snes;
+%ignore dolfin::PETScTAOSolver::tao;
 #endif
 #endif
 
 #ifdef HAS_SLEPC
-%ignore dolfin::SLEPcEigenSolver(const PETScMatrix&);
-%ignore dolfin::SLEPcEigenSolver(const PETScMatrix&, const PETScMatrix&);
-
 // Only ignore C++ accessors if slepc4py is enabled
 #ifdef HAS_SLEPC4PY
 %ignore dolfin::SLEPcEigenSolver::eps() const;
diff --git a/dolfin/swig/log/docstrings.i b/dolfin/swig/log/docstrings.i
index c7ccbb3..2d3b1fe 100644
--- a/dolfin/swig/log/docstrings.i
+++ b/dolfin/swig/log/docstrings.i
@@ -92,8 +92,6 @@ Issue deprecation warning for removed feature
        Name of the feature that has been removed.
     version_deprecated (str)
        Version number of the release in which the feature is deprecated.
-    version_remove (str)
-       Version number of the release in which the feature will be removed.
     message (str)
        A format string explaining the deprecation.
 ";
@@ -231,7 +229,8 @@ Create log stream of given type
 
 * operator<<\ (entity)
 
-  Output for mesh entity (not subclass of Variable for efficiency)
+  Output for mesh entity (not subclass of Variable for
+  efficiency)
 
 * operator<<\ (point)
 
diff --git a/dolfin/swig/math/docstrings.i b/dolfin/swig/math/docstrings.i
index 2c65484..e4f75b1 100644
--- a/dolfin/swig/math/docstrings.i
+++ b/dolfin/swig/math/docstrings.i
@@ -22,7 +22,8 @@
 
 // Documentation extracted from: (module=math, header=basic.h)
 %feature("docstring")  dolfin::ipow "
-Return a to the power n
+Return a to the power n.
+NOTE: Overflow is not checked!
 ";
 
 %feature("docstring")  dolfin::rand "
diff --git a/dolfin/swig/mesh/docstrings.i b/dolfin/swig/mesh/docstrings.i
index 55f2cef..6835407 100644
--- a/dolfin/swig/mesh/docstrings.i
+++ b/dolfin/swig/mesh/docstrings.i
@@ -100,19 +100,24 @@ Return number of entities of given topological dimension
 ";
 
 %feature("docstring")  dolfin::CellType::create_entities "
-Create entities e of given topological dimension from vertices v
-";
-
-%feature("docstring")  dolfin::CellType::refine_cell "
-Refine cell uniformly
+Create entities e of given topological dimension from
+vertices v
 ";
 
 %feature("docstring")  dolfin::CellType::volume "
 Compute (generalized) volume of mesh entity
 ";
 
+%feature("docstring")  dolfin::CellType::h "
+Compute greatest distance between any two vertices
+";
+
 %feature("docstring")  dolfin::CellType::diameter "
-Compute diameter of mesh entity
+Compute diameter of mesh entity (deprecated)
+";
+
+%feature("docstring")  dolfin::CellType::circumradius "
+Compute circumradius of mesh entity
 ";
 
 %feature("docstring")  dolfin::CellType::inradius "
@@ -351,16 +356,25 @@ Assignment
 Return Euclidean dimension of coordinate system
 ";
 
+%feature("docstring")  dolfin::MeshGeometry::degree "
+Return polynomial degree of coordinate field
+";
+
 %feature("docstring")  dolfin::MeshGeometry::size "
 Return number of coordinates
 ";
 
-%feature("docstring")  dolfin::MeshGeometry::x "
-**Overloaded versions**
+%feature("docstring")  dolfin::MeshGeometry::num_vertices "
+Return the number of vertex coordinates
+";
 
-* x\ (n, i)
+%feature("docstring")  dolfin::MeshGeometry::num_points "
+Return the total number of points in the geometry, located on
+any entity
+";
 
-  Return value of coordinate with local index n in direction i
+%feature("docstring")  dolfin::MeshGeometry::x "
+**Overloaded versions**
 
 * x\ (n, i)
 
@@ -370,10 +384,6 @@ Return number of coordinates
 
   Return array of values for coordinate with local index n
 
-* x\ (n)
-
-  Return array of values for coordinate with local index n
-
 * x\ ()
 
   Return array of values for all coordinates
@@ -387,12 +397,24 @@ Return number of coordinates
 Return coordinate with local index n as a 3D point value
 ";
 
-%feature("docstring")  dolfin::MeshGeometry::clear "
-Clear all data
+%feature("docstring")  dolfin::MeshGeometry::init "
+Initialize coordinate list to given dimension and degree
 ";
 
-%feature("docstring")  dolfin::MeshGeometry::init "
-Initialize coordinate list to given dimension and size
+%feature("docstring")  dolfin::MeshGeometry::init_entities "
+Initialise entities. To be called after init
+";
+
+%feature("docstring")  dolfin::MeshGeometry::num_entity_coordinates "
+Get the number of coordinate points per entity for this degree
+";
+
+%feature("docstring")  dolfin::MeshGeometry::get_entity_index "
+Get the index for an entity point in coordinates
+";
+
+%feature("docstring")  dolfin::MeshGeometry::set "
+Set value of coordinate
 ";
 
 %feature("docstring")  dolfin::MeshGeometry::hash "
@@ -951,10 +973,6 @@ sharing of the bounding box tree data structure.
   Compute all entities and connectivity.
 ";
 
-%feature("docstring")  dolfin::Mesh::clear "
-Clear all mesh data.
-";
-
 %feature("docstring")  dolfin::Mesh::clean "
 Clean out all auxiliary topology data. This clears all
 topological data, except the connectivity between cells and
@@ -1021,45 +1039,6 @@ Translate mesh according to a given vector.
           The point around which to rotate the mesh.
 ";
 
-%feature("docstring")  dolfin::Mesh::move "
-**Overloaded versions**
-
-* move\ (boundary)
-
-  Move coordinates of mesh according to new boundary coordinates.
-  
-  *Arguments*
-      boundary (:py:class:`BoundaryMesh`)
-          A mesh containing just the boundary cells.
-  
-  *Returns*
-      MeshDisplacement
-          Displacement encapsulated in Expression subclass
-          MeshDisplacement.
-
-* move\ (mesh)
-
-  Move coordinates of mesh according to adjacent mesh with
-  common global vertices.
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          A :py:class:`Mesh` object.
-  
-  *Returns*
-      MeshDisplacement
-          Displacement encapsulated in Expression subclass
-          MeshDisplacement.
-
-* move\ (displacement)
-
-  Move coordinates of mesh according to displacement function.
-  
-  *Arguments*
-      displacement (:py:class:`GenericFunction`)
-          A :py:class:`GenericFunction` object.
-";
-
 %feature("docstring")  dolfin::Mesh::smooth "
 Smooth internal vertices of mesh by local averaging.
 
@@ -1132,13 +1111,13 @@ Snap boundary vertices of mesh to match given sub domain.
 ";
 
 %feature("docstring")  dolfin::Mesh::hmin "
-Compute minimum cell diameter.
+Compute minimum cell size in mesh, measured greatest distance
+between any two vertices of a cell.
 
 *Returns*
     float
-        The minimum cell diameter, the diameter is computed as
-        two times the circumradius
-        (http://mathworld.wolfram.com).
+        The minimum cell size. The size is computed using
+        Cell::h()
 
 *Example*
     .. code-block:: python
@@ -1149,13 +1128,13 @@ Compute minimum cell diameter.
 ";
 
 %feature("docstring")  dolfin::Mesh::hmax "
-Compute maximum cell diameter.
+Compute maximum cell size in mesh, measured greatest distance
+between any two vertices of a cell.
 
 *Returns*
     float
-        The maximum cell diameter, the diameter is computed as
-        two times the circumradius
-        (http://mathworld.wolfram.com).
+        The maximum cell size. The size is computed using
+        Cell::h()
 
 *Example*
     .. code-block:: python
@@ -1910,8 +1889,21 @@ Compute (generalized) volume of cell
         No example code available for this function.
 ";
 
+%feature("docstring")  dolfin::Cell::h "
+Compute greatest distance between any two vertices
+
+*Returns*
+    float
+        The greatest distance between any two vertices of the cell.
+
+*Example*
+    .. note::
+    
+        No example code available for this function.
+";
+
 %feature("docstring")  dolfin::Cell::diameter "
-Compute diameter of cell
+Compute diameter of cell (deprecated)
 
 *Returns*
     float
@@ -1923,6 +1915,19 @@ Compute diameter of cell
         No example code available for this function.
 ";
 
+%feature("docstring")  dolfin::Cell::circumradius "
+Compute circumradius of cell
+
+*Returns*
+    float
+        The circumradius of the cell.
+
+*Example*
+    .. note::
+    
+        No example code available for this function.
+";
+
 %feature("docstring")  dolfin::Cell::inradius "
 Compute inradius of cell
 
@@ -2100,16 +2105,12 @@ Compute triangulation of intersection with given entity
         num_simplices x (tdim + 1) x gdim
 ";
 
-%feature("docstring")  dolfin::Cell::get_vertex_coordinates "
-**Overloaded versions**
-
-* get_vertex_coordinates\ (coordinates)
-
-  Get cell vertex coordinates
-
-* get_vertex_coordinates\ (coordinates)
+%feature("docstring")  dolfin::Cell::get_coordinate_dofs "
+Get cell coordinate dofs (not vertex coordinates)
+";
 
-  Get cell vertex coordinates
+%feature("docstring")  dolfin::Cell::get_vertex_coordinates "
+Get cell vertex coordinates (not coordinate dofs)
 ";
 
 %feature("docstring")  dolfin::Cell::get_cell_data "
@@ -2236,8 +2237,9 @@ Clear all data
 
 * set\ (connections)
 
-  Set all connections for all entities (T is a container, e.g.
-  a std::vector<std::size_t>, std::set<std::size_t>, etc)
+  Set all connections for all entities (T is a '2D' container, e.g. a
+  std::vector<<std::vector<std::size_t>>,
+  std::vector<<std::set<std::size_t>>, etc)
 ";
 
 %feature("docstring")  dolfin::MeshConnectivity::set_global_size "
@@ -2265,7 +2267,7 @@ Constructor
 %feature("docstring")  dolfin::MeshEditor::open "
 **Overloaded versions**
 
-* open\ (mesh, tdim, gdim)
+* open\ (mesh, tdim, gdim, degree=1)
 
   Open mesh of given topological and geometrical dimension
   
@@ -2276,13 +2278,14 @@ Constructor
           The topological dimension.
       gdim (int)
           The geometrical dimension.
-  
+      degree (int)
+          The polynomial degree.
   *Example*
       .. note::
       
           No example code available for this function.
 
-* open\ (mesh, type, tdim, gdim)
+* open\ (mesh, type, tdim, gdim, degree=1)
 
   Open mesh of given cell type, topological and geometrical dimension
   
@@ -2295,8 +2298,10 @@ Constructor
           The topological dimension.
       gdim (int)
           The geometrical dimension.
+      degree (int)
+          The polynomial degree.
 
-* open\ (mesh, type, tdim, gdim)
+* open\ (mesh, type, tdim, gdim, degree=1)
 
   Open mesh of given cell type, topological and geometrical dimension
   
@@ -2309,6 +2314,8 @@ Constructor
           The topological dimension.
       gdim (int)
           The geometrical dimension.
+      degree (int)
+          The polynomial degree.
 ";
 
 %feature("docstring")  dolfin::MeshEditor::init_vertices "
@@ -2324,6 +2331,15 @@ Specify number of vertices (serial version)
         No example code available for this function.
 ";
 
+%feature("docstring")  dolfin::MeshEditor::init_entities "
+Initialise entities in MeshGeometry
+
+Create required Edges and Faces for the current polynomial degree
+in the mesh topology, so that points can be added for them.
+In order to initialise entities, cells must all be added first.
+
+";
+
 %feature("docstring")  dolfin::MeshEditor::init_vertices_global "
 Specify number of vertices (distributed version)
 
@@ -2332,6 +2348,8 @@ Specify number of vertices (distributed version)
         The number of vertices on this process.
     num_global_vertices (int)
         The number of vertices in distributed mesh.
+    degree (int)
+        The polynomial degree of the mesh.
 
 *Example*
     .. note::
@@ -2455,6 +2473,10 @@ Specify number of cells (distributed version)
           The x-coordinates.
 ";
 
+%feature("docstring")  dolfin::MeshEditor::add_entity_point "
+Add a point in a given entity of dimension entity_dim
+";
+
 %feature("docstring")  dolfin::MeshEditor::add_cell "
 **Overloaded versions**
 
@@ -2636,11 +2658,11 @@ Return data
 // Documentation extracted from: (module=mesh, header=MeshFunction.h)
 %feature("docstring")  dolfin::MeshFunction "
 A MeshFunction is a function that can be evaluated at a set of
-mesh entities. A MeshFunction is discrete and is only defined
-at the set of mesh entities of a fixed topological dimension.
-A MeshFunction may for example be used to store a global
-numbering scheme for the entities of a (parallel) mesh, marking
-sub domains or boolean markers for mesh refinement.
+mesh entities. A MeshFunction is discrete and is only defined at
+the set of mesh entities of a fixed topological dimension.  A
+MeshFunction may for example be used to store a global numbering
+scheme for the entities of a (parallel) mesh, marking sub
+domains or boolean markers for mesh refinement.
 ";
 
 %feature("docstring")  dolfin::MeshFunction::MeshFunction "
@@ -2658,28 +2680,9 @@ sub domains or boolean markers for mesh refinement.
       mesh (:py:class:`Mesh`)
           The mesh to create mesh function on.
 
-* MeshFunction\ (mesh)
-
-  Create empty mesh function on given mesh (shared_ptr version)
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh to create mesh function on.
-
-* MeshFunction\ (mesh, dim)
-
-  Create mesh function of given dimension on given mesh
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh to create mesh function on.
-      dim (int)
-          The mesh entity dimension for the mesh function.
-
 * MeshFunction\ (mesh, dim)
 
   Create mesh function of given dimension on given mesh
-  (shared_ptr version)
   
   *Arguments*
       mesh (:py:class:`Mesh`)
@@ -2700,29 +2703,6 @@ sub domains or boolean markers for mesh refinement.
       value (T)
           The value.
 
-* MeshFunction\ (mesh, dim, value)
-
-  Create mesh of given dimension on given mesh and initialize
-  to a value (shared_ptr version)
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh to create mesh function on.
-      dim (int)
-          The mesh entity dimension.
-      value (T)
-          The value.
-
-* MeshFunction\ (mesh, filename)
-
-  Create function from data file
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh to create mesh function on.
-      filename (str)
-          The filename to create mesh function from.
-
 * MeshFunction\ (mesh, filename)
 
   Create function from data file (shared_ptr version)
@@ -2735,16 +2715,6 @@ sub domains or boolean markers for mesh refinement.
 
 * MeshFunction\ (mesh, value_collection)
 
-  Create function from a MeshValueCollecion
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh to create mesh function on.
-      value_collection (:py:class:`MeshValueCollection`)
-          The mesh value collection for the mesh function data.
-
-* MeshFunction\ (mesh, value_collection)
-
   Create function from a MeshValueCollecion (shared_ptr version)
   
   *Arguments*
@@ -2935,30 +2905,6 @@ Return size (number of entities)
       dim (int)
           The dimension.
 
-* init\ (mesh, dim)
-
-  Initialize mesh function for given topological dimension
-  (shared_ptr version)
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh.
-      dim (int)
-          The dimension.
-
-* init\ (mesh, dim, size)
-
-  Initialize mesh function for given topological dimension of
-  given size
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh.
-      dim (int)
-          The dimension.
-      size (int)
-          The size.
-
 * init\ (mesh, dim, size)
 
   Initialize mesh function for given topological dimension of
@@ -3066,17 +3012,6 @@ means that data may be stored robustly to file.
       dim (int)
           The mesh entity dimension for the mesh value collection.
 
-* MeshValueCollection\ (mesh, dim)
-
-  Create a mesh value collection of entities of given dimension
-  on a given mesh (shared_ptr version)
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh associated with the collection.
-      dim (int)
-          The mesh entity dimension for the mesh value collection.
-
 * MeshValueCollection\ (mesh, filename)
 
   Create a mesh value collection from a file.
@@ -3126,17 +3061,6 @@ means that data may be stored robustly to file.
       dim (int)
           The mesh entity dimension for the mesh value collection.
 
-* init\ (mesh, dim)
-
-  Initialise MeshValueCollection with mesh and dimension
-  (shared_ptr version)
-  
-  *Arguments*
-      mesh (_mesh)
-          The mesh on which the value collection is defined
-      dim (int)
-          The mesh entity dimension for the mesh value collection.
-
 * init\ (dim)
 
   Set dimension. This function should not generally be used. It is
@@ -3278,14 +3202,14 @@ vertex, edge, and facet-based colorings.
 
 %feature("docstring")  dolfin::MeshColoring::color_cells "
 Color the cells of a mesh for given coloring type, which can
-be one of \"vertex\", \"edge\" or \"facet\". Coloring is saved in the
-mesh topology
+be one of \"vertex\", \"edge\" or \"facet\". Coloring is saved in
+the mesh topology
 ";
 
 %feature("docstring")  dolfin::MeshColoring::color "
 Color the cells of a mesh for given coloring type specified by
-topological dimension, which can be one of 0, 1 or D - 1. Coloring
-is saved in the mesh topology
+topological dimension, which can be one of 0, 1 or D -
+1. Coloring is saved in the mesh topology
 ";
 
 %feature("docstring")  dolfin::MeshColoring::compute_colors "
@@ -3298,7 +3222,8 @@ topological dimension, which can be one of 0, 1 or D - 1.
 
 * cell_colors\ (mesh, coloring_type)
 
-  Return a MeshFunction with the cell colors (used for visualisation)
+  Return a MeshFunction with the cell colors (used for
+  visualisation)
 
 * cell_colors\ (mesh, coloring_type)
 
@@ -3332,12 +3257,7 @@ cell-vertex connectivity exists as part of the mesh.
 ";
 
 // Documentation extracted from: (module=mesh, header=MeshTransformation.h)
-%feature("docstring")  dolfin::MeshTransformation "
-This class implements various transformations of the coordinates
-of a mesh.
-";
-
-%feature("docstring")  dolfin::MeshTransformation::translate "
+%feature("docstring")  dolfin::translate "
 Translate mesh according to a given vector.
 
 *Arguments*
@@ -3347,7 +3267,20 @@ Translate mesh according to a given vector.
         The vector defining the translation.
 ";
 
-%feature("docstring")  dolfin::MeshTransformation::rotate "
+%feature("docstring")  dolfin::rescale "
+Rescale mesh by a given scaling factor with respect to a center
+point.
+
+*Arguments*
+    mesh (:py:class:`Mesh`)
+        The mesh
+     scale (double)
+        The scaling factor.
+     center (Point)
+        The center of the scaling.
+";
+
+%feature("docstring")  dolfin::rotate "
 **Overloaded versions**
 
 * rotate\ (mesh, angle, axis)
@@ -3410,6 +3343,11 @@ meshes instead of local mesh data.
   Create local mesh data for given mesh
 ";
 
+%feature("docstring")  dolfin::LocalMeshData::check "
+Check that all essential data has been intialized, and throw error
+if there is a problem
+";
+
 %feature("docstring")  dolfin::LocalMeshData::str "
 Return informal string representation (pretty-print)
 ";
@@ -3647,79 +3585,6 @@ mesh data named \"parent_vertex_indices\".
 Create sub mesh
 ";
 
-// Documentation extracted from: (module=mesh, header=Restriction.h)
-%feature("docstring")  dolfin::Restriction "
-This class represents a restriction of a mesh to a subdomain,
-which can be defined as a subset of all the cells, the facets,
-or possibly lower dimensional entities of the mesh.
-";
-
-%feature("docstring")  dolfin::Restriction::Restriction "
-**Overloaded versions**
-
-* Restriction\ (mesh, sub_domain)
-
-  Create cell-based restriction from subdomain
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh
-      sub_domain (:py:class:`SubDomain`)
-          Sub domain defining the restriction
-
-* Restriction\ (mesh, sub_domain, dim)
-
-  Create restriction from subdomain to entities of arbitrary dimension
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh
-      sub_domain (:py:class:`SubDomain`)
-          Sub domain defining the restriction
-      dim (int)
-          Dimension of restriction
-
-* Restriction\ (domain_markers, domain_number)
-
-  Create restriction from domain markers
-  
-  *Arguments*
-      domain_markers (:py:class:`MeshFunction`)
-          Domain markers for the cells of the mesh.
-      domain_number (int)
-          Identifier for domain.
-
-* Restriction\ (domain_markers, domain_number)
-
-  Create restriction from domain markers (shared pointer version)
-  
-  *Arguments*
-      domain_markers (:py:class:`MeshFunction`)
-          Domain markers for the cells of the mesh.
-      domain_number (int)
-          Identifier for domain.
-";
-
-%feature("docstring")  dolfin::Restriction::mesh "
-Return the full unrestricted mesh
-";
-
-%feature("docstring")  dolfin::Restriction::dim "
-Return topological dimension of restriction
-";
-
-%feature("docstring")  dolfin::Restriction::contains "
-**Overloaded versions**
-
-* contains\ (entity)
-
-  Check whether restriction contains entity
-
-* contains\ (d, i)
-
-  Check whether restriction contains entity (d, i)
-";
-
 // Documentation extracted from: (module=mesh, header=DomainBoundary.h)
 %feature("docstring")  dolfin::DomainBoundary "
 This class provides a SubDomain which picks out the boundary of
@@ -3849,6 +3714,23 @@ of cell quality
 Create Matplotlib string to plot cell quality histogram
 ";
 
+%feature("docstring")  dolfin::MeshQuality::dihedral_angles "
+Get internal dihedral angles of a tetrahedral cell
+";
+
+%feature("docstring")  dolfin::MeshQuality::dihedral_angles_min_max "
+Get internal minimum and maximum dihedral angles of a 3D mesh
+";
+
+%feature("docstring")  dolfin::MeshQuality::dihedral_angles_histogram_data "
+Create (dihedral angles, number of cells) data for creating a histogram
+of dihedral
+";
+
+%feature("docstring")  dolfin::MeshQuality::dihedral_angles_matplotlib_histogram "
+Create Matplotlib string to plot dihedral angles quality histogram
+";
+
 // Documentation extracted from: (module=mesh, header=MultiMesh.h)
 %feature("docstring")  dolfin::MultiMesh "
 This class represents a collection of meshes with arbitrary
@@ -3859,7 +3741,27 @@ been called.
 ";
 
 %feature("docstring")  dolfin::MultiMesh::MultiMesh "
-Create empty multimesh
+**Overloaded versions**
+
+* MultiMesh\ ()
+
+  Create empty multimesh
+
+* MultiMesh\ (meshes, quadrature_order)
+
+  Create multimesh from given list of meshes
+
+* MultiMesh\ (mesh_0, quadrature_order)
+
+  Create multimesh from one mesh
+
+* MultiMesh\ (mesh_0, mesh_1, quadrature_order)
+
+  Create multimesh from two meshes
+
+* MultiMesh\ (mesh_0, mesh_1, mesh_2, quadrature_order)
+
+  Create multimesh from three meshes
 ";
 
 %feature("docstring")  dolfin::MultiMesh::num_parts "
@@ -4063,23 +3965,11 @@ given part
 ";
 
 %feature("docstring")  dolfin::MultiMesh::add "
-**Overloaded versions**
-
-* add\ (mesh)
-
-  Add mesh (shared pointer version)
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh
+Add mesh
 
-* add\ (mesh)
-
-  Add mesh (reference version)
-  
-  *Arguments*
-      mesh (:py:class:`Mesh`)
-          The mesh
+*Arguments*
+    mesh (:py:class:`Mesh`)
+        The mesh
 ";
 
 %feature("docstring")  dolfin::MultiMesh::build "
@@ -4090,10 +3980,6 @@ Build multimesh
 Clear multimesh
 ";
 
-%feature("docstring")  dolfin::MultiMesh::default_parameters "
-Default parameter values
-";
-
 // Documentation extracted from: (module=mesh, header=MeshHierarchy.h)
 %feature("docstring")  dolfin::MeshHierarchy::MeshHierarchy "
 **Overloaded versions**
@@ -4151,9 +4037,9 @@ Rebalance across processes
 // Documentation extracted from: (module=mesh, header=MeshPartitioning.h)
 %feature("docstring")  dolfin::MeshPartitioning "
 This class partitions and distributes a mesh based on
-partitioned local mesh data.The local mesh data will
-also be repartitioned and redistributed during the computation
-of the mesh partitioning.
+partitioned local mesh data.The local mesh data will also be
+repartitioned and redistributed during the computation of the
+mesh partitioning.
 
 After partitioning, each process has a local mesh and some data
 that couples the meshes together.
@@ -4164,16 +4050,17 @@ that couples the meshes together.
 
 * build_distributed_mesh\ (mesh)
 
-  Build a partitioned mesh based from a local mesh on process 0
+  Build a distributed mesh from a local mesh on process 0
 
-* build_distributed_mesh\ (mesh, cell_partition)
+* build_distributed_mesh\ (mesh, cell_partition, ghost_mode)
 
-  Build a partitioned mesh based from a local mesh on process 0
-  with supplied destination processes for each cell
+  Build a distributed mesh from a local mesh on process 0, with
+  distribution of cells supplied (destination processes for each
+  cell)
 
-* build_distributed_mesh\ (mesh, data)
+* build_distributed_mesh\ (mesh, data, ghost_mode)
 
-  Build a partitioned mesh from local mesh data that is
+  Build a distributed mesh from 'local mesh data' that is
   distributed across processes
 ";
 
diff --git a/dolfin/swig/mesh/post.i b/dolfin/swig/mesh/post.i
index 9250dcf..6f9a975 100644
--- a/dolfin/swig/mesh/post.i
+++ b/dolfin/swig/mesh/post.i
@@ -1,5 +1,5 @@
 /* -*- C -*- */
-// Copyright (C) 2006-2009 Anders Logg
+// Copyright (C) 2006-2015 Anders Logg
 //
 // This file is part of DOLFIN.
 //
@@ -20,9 +20,7 @@
 // Modified by Ola Skavhaug 2006-2007
 // Modified by Garth Wells 2007-2010
 // Modified by Johan Hake 2008-2009
-//
-// First added:  2006-09-20
-// Last changed: 2011-03-11
+// Modified by Martin Alnaes 2013-2015
 
 //=============================================================================
 // SWIG directives for the DOLFIN Mesh kernel module (post)
@@ -254,11 +252,6 @@ class MeshFunction(object):
             raise TypeError("expected a 'str' as first argument")
         if tp == "int":
             return MeshFunctionInt(*args)
-        if tp == "uint":
-            from . import common
-            common.deprecation("uint-valued MeshFunction", "1.1.0", "TBA",
-                               "Typename \"uint\" has been changed to \"size_t\".")
-            return MeshFunctionSizet(*args)
         elif tp == "size_t":
             return MeshFunctionSizet(*args)
         elif tp == "double":
@@ -380,11 +373,6 @@ class MeshValueCollection(object):
             raise TypeError("expected a 'str' as first argument")
         if tp == "int":
             return MeshValueCollectionInt(*args)
-        if tp == "uint":
-            from . import common
-            common.deprecation("uint-valued MeshFunction", "1.1.0", "TBA",
-                               "Typename \"uint\" has been changed to \"size_t\".")
-            return MeshValueCollectionSizet(*args)
         elif tp == "size_t":
             return MeshValueCollectionSizet(*args)
         elif tp == "double":
@@ -478,6 +466,13 @@ def cells(self):
 //-----------------------------------------------------------------------------
 // Extend Mesh interface with some ufl_* methods
 //-----------------------------------------------------------------------------
+// TODO: This was intended as steps toward letting dolfin.Mesh inherit from ufl.Mesh.
+//       That seems to be harder than anticipated, because fundamental properties
+//       of dolfin::Mesh are mutable and undefined at construction time.
+//       This work is therefore on hold. I don't think this is a showstopper,
+//       it mainly means the code won't be as clean as I wanted.
+// Note: The extensions to the C++ dolfin::Mesh class here are added to
+//       all C++ subclasses of Mesh by swig, e.g. SubMesh, RectangleMesh, UnitSquareMesh
 %extend dolfin::Mesh
 {
 %pythoncode
@@ -487,59 +482,26 @@ def ufl_id(self):
     return self.id()
 
 def ufl_cell(self):
-    """
-    Returns the ufl cell of the mesh.
-
-    The cell corresponds to the topological dimension of the mesh.
-    """
+    """Returns the ufl cell of the mesh."""
     import ufl
-    tdim = self.topology().dim()
     gdim = self.geometry().dim()
-    dim2domain = { 1: 'interval', 2: 'triangle', 3: 'tetrahedron' }
-    cellname = dim2domain[tdim]
-
-    cellname = CellType.type2string(self.type().cell_type())
-
+    cellname = self.type().description(False)
     return ufl.Cell(cellname, geometric_dimension=gdim)
 
-def ufl_domain(self):
-    """Returns the ufl Domain corresponding to the mesh."""
-    import ufl
-    label = "dolfin_mesh_with_id_%d" % self.id()
-    return ufl.Domain(self.ufl_cell(), label=label, data=self)
-%}
-}
-
-//-----------------------------------------------------------------------------
-// Extend SubMesh interface with some ufl_* methods
-//-----------------------------------------------------------------------------
-// TODO: It would be nice if this was inherited from the Mesh extension above!
-%extend dolfin::SubMesh
-{
-%pythoncode
-%{
-def ufl_id(self):
-    "Returns an id that UFL can use to decide if two objects are the same."
-    return self.id()
-
-def ufl_cell(self):
-    """
-    Returns the ufl cell of the mesh.
-
-    The cell corresponds to the topological dimension of the mesh.
-    """
+def ufl_coordinate_element(self):
+    "Return the finite element of the coordinate vector field of this domain."
     import ufl
-    tdim = self.topology().dim()
-    gdim = self.geometry().dim()
-    dim2domain = { 1: 'interval', 2: 'triangle', 3: 'tetrahedron' }
-    cellname = dim2domain[tdim]
-    return ufl.Cell(cellname, geometric_dimension=gdim)
+    cell = self.ufl_cell()
+    degree = self.geometry().degree()
+    return ufl.VectorElement("Lagrange", cell, degree, dim=cell.geometric_dimension())
 
 def ufl_domain(self):
-    """Returns the ufl Domain corresponding to the mesh."""
+    """Returns the ufl domain corresponding to the mesh."""
     import ufl
-    label = "dolfin_mesh_with_id_%d" % self.id()
-    return ufl.Domain(self.ufl_cell(), label=label, data=self)
+    # Cache object to avoid recreating it a lot
+    if not hasattr(self, "_ufl_domain"):
+        self._ufl_domain = ufl.Mesh(self.ufl_coordinate_element(), ufl_id=self.ufl_id(), cargo=self)
+    return self._ufl_domain
 %}
 }
 
diff --git a/dolfin/swig/mesh/pre.i b/dolfin/swig/mesh/pre.i
index 82fcc62..2dd1141 100644
--- a/dolfin/swig/mesh/pre.i
+++ b/dolfin/swig/mesh/pre.i
@@ -31,21 +31,24 @@
 // modules has been loaded.
 //=============================================================================
 
+%ignore dolfin::LocalMeshData::Geometry;
+%ignore dolfin::LocalMeshData::Topology;
+
 //-----------------------------------------------------------------------------
 // Return NumPy arrays for Mesh::cells() and Mesh::coordinates()
 //-----------------------------------------------------------------------------
 %extend dolfin::Mesh {
   PyObject* _coordinates() {
-    return %make_numpy_array(2, double)(self->num_vertices(),
-					self->geometry().dim(),
-					self->coordinates().data(), true);
+    return %make_numpy_array(2, double)(self->geometry().num_points(),
+                                        self->geometry().dim(),
+                                        self->coordinates().data(), true);
   }
 
   PyObject* _cells() {
     // FIXME: Works only for Mesh with Intervals, Triangles and Tetrahedrons
     return %make_numpy_array(2, uint)(self->num_cells(),
                                       self->type().num_entities(0),
-				      self->cells().data(), false);
+                                      self->cells().data(), false);
   }
 
   PyObject* _cell_orientations()
@@ -84,6 +87,7 @@ ALL_VALUES(dolfin::MeshFunction<std::size_t>, size_t)
 %ignore dolfin::Mesh::coordinates;
 %ignore dolfin::Mesh::cell_orientations;
 %ignore dolfin::MeshFunction::values;
+%warnfilter(503) dolfin::create_mesh;
 
 //-----------------------------------------------------------------------------
 // Rename methods which get called by a re-implemented method from the
@@ -260,38 +264,6 @@ FORWARD_DECLARE_HIERARCHICAL_MESHFUNCTIONS(std::size_t, Sizet)
 // Include shared_ptr declaration of MeshValueCollection
 %shared_ptr(dolfin::MeshValueCollection<TYPE>)
 
-//-----------------------------------------------------------------------------
-// Ignore MeshFunction constructors that take a Mesh reference
-//-----------------------------------------------------------------------------
-%ignore dolfin::MeshFunction<TYPE>::MeshFunction(const Mesh&);
-%ignore dolfin::MeshFunction<TYPE>::MeshFunction(const Mesh&, std::size_t);
-%ignore dolfin::MeshFunction<TYPE>::MeshFunction(const Mesh&, std::size_t, const TYPE&);
-%ignore dolfin::MeshFunction<TYPE>::MeshFunction(const Mesh&, const std::string);
-%ignore dolfin::MeshFunction<TYPE>::MeshFunction(const Mesh&, const MeshValueCollection<T>&);
-
-%ignore dolfin::CellFunction<TYPE>::CellFunction(const Mesh&);
-%ignore dolfin::CellFunction<TYPE>::CellFunction(const Mesh&, const TYPE&);
-
-%ignore dolfin::FacetFunction<TYPE>::FacetFunction(const Mesh&);
-%ignore dolfin::FacetFunction<TYPE>::FacetFunction(const Mesh&, const TYPE&);
-
-%ignore dolfin::FaceFunction<TYPE>::FaceFunction(const Mesh&);
-%ignore dolfin::FaceFunction<TYPE>::FaceFunction(const Mesh&, const TYPE&);
-
-%ignore dolfin::EdgeFunction<TYPE>::EdgeFunction(const Mesh&);
-%ignore dolfin::EdgeFunction<TYPE>::EdgeFunction(const Mesh&, const TYPE&);
-
-%ignore dolfin::VertexFunction<TYPE>::VertexFunction(const Mesh&);
-%ignore dolfin::VertexFunction<TYPE>::VertexFunction(const Mesh&, const TYPE&);
-
-%ignore dolfin::MeshFunction<TYPE>::init(const Mesh&, std::size_t);
-%ignore dolfin::MeshFunction<TYPE>::init(const Mesh&, std::size_t, const T&);
-
-//-----------------------------------------------------------------------------
-// Ignore MeshValueCollection constructors that take a Mesh reference
-//-----------------------------------------------------------------------------
-%ignore dolfin::MeshValueCollection<TYPE>::MeshValueCollection(const Mesh&, std::size_t);
-
 %enddef
 
 FORWARD_DECLARE_MESHFUNCTIONS(unsigned int, UInt)
@@ -314,3 +286,9 @@ FORWARD_DECLARE_MESHFUNCTIONS(std::size_t, Sizet)
 %ignore dolfin::MeshPartitioning::build_distributed_mesh(Mesh&, const std::vector<std::size_t>&);
 %ignore dolfin::MeshPartitioning::build_distributed_mesh(Mesh&, const LocalMeshData&);
 %ignore dolfin::MeshPartitioning::build_distributed_value_collection;
+
+//-----------------------------------------------------------------------------
+// Ignores for MultiMesh
+//-----------------------------------------------------------------------------
+%ignore dolfin::plot(const MultiMesh&);
+%ignore dolfin::plot(std::shared_ptr<const MultiMesh>);
diff --git a/dolfin/swig/modules/common/dependencies.txt b/dolfin/swig/modules/common/dependencies.txt
index f2ceff5..2dc1249 100644
--- a/dolfin/swig/modules/common/dependencies.txt
+++ b/dolfin/swig/modules/common/dependencies.txt
@@ -1 +1 @@
-/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/swig/common/post.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/swig/common/pre.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/swig/defines.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/swig/exceptions.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/swig/forwarddeclarations.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/swig/global [...]
\ No newline at end of file
+/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/swig/common/post.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/swig/common/pre.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/swig/defines.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/swig/exceptions.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/swig/forwarddeclarations.i;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/ [...]
\ No newline at end of file
diff --git a/dolfin/swig/modules/fem/dependencies.txt b/dolfin/swig/modules/fem/dependencies.txt
index feac03d..8d28ce2 100644
--- a/dolfin/swig/modules/fem/dependencies.txt
+++ b/dolfin/swig/modules/fem/dependencies.txt
@@ -1 +1 @@
-/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/ArrayView.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Hierarchical.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/MPI.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/constants.h;/h [...]
\ No newline at end of file
+/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/ArrayView.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Hierarchical.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/MPI.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/com [...]
\ No newline at end of file
diff --git a/dolfin/swig/modules/fem/module.i b/dolfin/swig/modules/fem/module.i
index 7b781a9..d60854c 100644
--- a/dolfin/swig/modules/fem/module.i
+++ b/dolfin/swig/modules/fem/module.i
@@ -42,9 +42,9 @@
 #include "dolfin/parameter/Parameters.h"
 
 // #include types from mesh submodule of module mesh
+#include "dolfin/mesh/MeshGeometry.h"
 #include "dolfin/mesh/Mesh.h"
 #include "dolfin/mesh/MeshEntity.h"
-#include "dolfin/mesh/Vertex.h"
 #include "dolfin/mesh/Face.h"
 #include "dolfin/mesh/Facet.h"
 #include "dolfin/mesh/Cell.h"
@@ -60,9 +60,9 @@
 #include "dolfin/la/GenericLinearOperator.h"
 #include "dolfin/la/GenericTensor.h"
 #include "dolfin/la/GenericMatrix.h"
-#include "dolfin/la/GenericSparsityPattern.h"
 #include "dolfin/la/GenericVector.h"
 #include "dolfin/la/SparsityPattern.h"
+#include "dolfin/la/IndexMap.h"
 #include "dolfin/la/Vector.h"
 #include "dolfin/la/Matrix.h"
 
@@ -85,9 +85,12 @@
 #include "dolfin/fem/Equation.h"
 #include "dolfin/fem/FiniteElement.h"
 #include "dolfin/fem/BasisFunction.h"
+#include "dolfin/fem/DiscreteOperators.h"
 #include "dolfin/fem/DirichletBC.h"
 #include "dolfin/fem/PointSource.h"
 #include "dolfin/fem/assemble.h"
+#include "dolfin/fem/assemble_local.h"
+#include "dolfin/fem/LocalAssembler.h"
 #include "dolfin/fem/LocalSolver.h"
 #include "dolfin/fem/solve.h"
 #include "dolfin/fem/Form.h"
@@ -117,7 +120,6 @@
 #include "dolfin/adaptivity/GoalFunctional.h"
 #include "dolfin/adaptivity/ErrorControl.h"
 #include "dolfin/adaptivity/Extrapolation.h"
-#include "dolfin/adaptivity/LocalAssembler.h"
 #include "dolfin/adaptivity/TimeSeries.h"
 #include "dolfin/adaptivity/adapt.h"
 #include "dolfin/adaptivity/marking.h"
@@ -153,9 +155,9 @@ import_array();
 
 // %import types from submodule mesh of SWIG module mesh
 %include "dolfin/swig/mesh/pre.i"
+%import(package="", module="mesh") "dolfin/mesh/MeshGeometry.h"
 %import(package="", module="mesh") "dolfin/mesh/Mesh.h"
 %import(package="", module="mesh") "dolfin/mesh/MeshEntity.h"
-%import(package="", module="mesh") "dolfin/mesh/Vertex.h"
 %import(package="", module="mesh") "dolfin/mesh/Face.h"
 %import(package="", module="mesh") "dolfin/mesh/Facet.h"
 %import(package="", module="mesh") "dolfin/mesh/Cell.h"
@@ -173,9 +175,9 @@ import_array();
 %import(package="", module="la") "dolfin/la/GenericLinearOperator.h"
 %import(package="", module="la") "dolfin/la/GenericTensor.h"
 %import(package="", module="la") "dolfin/la/GenericMatrix.h"
-%import(package="", module="la") "dolfin/la/GenericSparsityPattern.h"
 %import(package="", module="la") "dolfin/la/GenericVector.h"
 %import(package="", module="la") "dolfin/la/SparsityPattern.h"
+%import(package="", module="la") "dolfin/la/IndexMap.h"
 %import(package="", module="la") "dolfin/la/Vector.h"
 %import(package="", module="la") "dolfin/la/Matrix.h"
 
@@ -205,9 +207,12 @@ import_array();
 %include "dolfin/fem/Equation.h"
 %include "dolfin/fem/FiniteElement.h"
 %include "dolfin/fem/BasisFunction.h"
+%include "dolfin/fem/DiscreteOperators.h"
 %include "dolfin/fem/DirichletBC.h"
 %include "dolfin/fem/PointSource.h"
 %include "dolfin/fem/assemble.h"
+%include "dolfin/fem/assemble_local.h"
+%include "dolfin/fem/LocalAssembler.h"
 %include "dolfin/fem/LocalSolver.h"
 %include "dolfin/fem/solve.h"
 %include "dolfin/fem/Form.h"
@@ -240,7 +245,6 @@ import_array();
 %include "dolfin/adaptivity/GoalFunctional.h"
 %include "dolfin/adaptivity/ErrorControl.h"
 %include "dolfin/adaptivity/Extrapolation.h"
-%include "dolfin/adaptivity/LocalAssembler.h"
 %include "dolfin/adaptivity/TimeSeries.h"
 %include "dolfin/adaptivity/adapt.h"
 %include "dolfin/adaptivity/marking.h"
diff --git a/dolfin/swig/modules/function/dependencies.txt b/dolfin/swig/modules/function/dependencies.txt
index 8b094aa..13f1f25 100644
--- a/dolfin/swig/modules/function/dependencies.txt
+++ b/dolfin/swig/modules/function/dependencies.txt
@@ -1 +1 @@
-/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Hierarchical.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/constants.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/types.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/fem/DofMap.h;/home/ [...]
\ No newline at end of file
+/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Hierarchical.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/constants.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/types.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/f [...]
\ No newline at end of file
diff --git a/dolfin/swig/modules/function/module.i b/dolfin/swig/modules/function/module.i
index 147e9fb..b0af925 100644
--- a/dolfin/swig/modules/function/module.i
+++ b/dolfin/swig/modules/function/module.i
@@ -35,10 +35,6 @@
 #include "dolfin/common/Variable.h"
 #include "dolfin/common/Hierarchical.h"
 
-// #include types from parameter submodule of module common
-#include "dolfin/parameter/Parameter.h"
-#include "dolfin/parameter/Parameters.h"
-
 // #include types from mesh submodule of module mesh
 #include "dolfin/mesh/Mesh.h"
 #include "dolfin/mesh/MeshEntity.h"
@@ -70,7 +66,6 @@
 #include "dolfin/function/FunctionAXPY.h"
 #include "dolfin/function/Function.h"
 #include "dolfin/function/FunctionSpace.h"
-#include "dolfin/function/SubSpace.h"
 #include "dolfin/function/Constant.h"
 #include "dolfin/function/SpecialFunctions.h"
 #include "dolfin/function/SpecialFacetFunction.h"
@@ -111,11 +106,6 @@ import_array();
 %import(package="", module="common") "dolfin/common/Variable.h"
 %import(package="", module="common") "dolfin/common/Hierarchical.h"
 
-// %import types from submodule parameter of SWIG module common
-%include "dolfin/swig/parameter/pre.i"
-%import(package="", module="common") "dolfin/parameter/Parameter.h"
-%import(package="", module="common") "dolfin/parameter/Parameters.h"
-
 // %import types from submodule mesh of SWIG module mesh
 %include "dolfin/swig/mesh/pre.i"
 %import(package="", module="mesh") "dolfin/mesh/Mesh.h"
@@ -153,7 +143,6 @@ import_array();
 %include "dolfin/function/FunctionAXPY.h"
 %include "dolfin/function/Function.h"
 %include "dolfin/function/FunctionSpace.h"
-%include "dolfin/function/SubSpace.h"
 %include "dolfin/function/Constant.h"
 %include "dolfin/function/SpecialFunctions.h"
 %include "dolfin/function/SpecialFacetFunction.h"
diff --git a/dolfin/swig/modules/io/dependencies.txt b/dolfin/swig/modules/io/dependencies.txt
index ab8a26b..e56788d 100644
--- a/dolfin/swig/modules/io/dependencies.txt
+++ b/dolfin/swig/modules/io/dependencies.txt
@@ -1 +1 @@
-/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Hierarchical.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/MPI.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/constants.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/fem/DofMap.h;/home/jo [...]
\ No newline at end of file
+/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Hierarchical.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/MPI.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/constants.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/fem [...]
\ No newline at end of file
diff --git a/dolfin/swig/modules/io/module.i b/dolfin/swig/modules/io/module.i
index 89cbf70..00ecc60 100644
--- a/dolfin/swig/modules/io/module.i
+++ b/dolfin/swig/modules/io/module.i
@@ -43,8 +43,11 @@
 #include "dolfin/log/Table.h"
 
 // #include types from mesh submodule of module mesh
+#include "dolfin/mesh/CellType.h"
 #include "dolfin/mesh/MeshData.h"
 #include "dolfin/mesh/Mesh.h"
+#include "dolfin/mesh/MeshEntity.h"
+#include "dolfin/mesh/Cell.h"
 #include "dolfin/mesh/MeshFunction.h"
 #include "dolfin/mesh/MeshValueCollection.h"
 #include "dolfin/mesh/LocalMeshData.h"
@@ -84,6 +87,7 @@
 #include "dolfin/io/XDMFFile.h"
 #include "dolfin/io/HDF5File.h"
 #include "dolfin/io/HDF5Attribute.h"
+#include "dolfin/io/X3DOM.h"
 
 // NumPy includes
 #define PY_ARRAY_UNIQUE_SYMBOL PyDOLFIN_IO
@@ -117,8 +121,11 @@ import_array();
 
 // %import types from submodule mesh of SWIG module mesh
 %include "dolfin/swig/mesh/pre.i"
+%import(package="", module="mesh") "dolfin/mesh/CellType.h"
 %import(package="", module="mesh") "dolfin/mesh/MeshData.h"
 %import(package="", module="mesh") "dolfin/mesh/Mesh.h"
+%import(package="", module="mesh") "dolfin/mesh/MeshEntity.h"
+%import(package="", module="mesh") "dolfin/mesh/Cell.h"
 %import(package="", module="mesh") "dolfin/mesh/MeshFunction.h"
 %import(package="", module="mesh") "dolfin/mesh/MeshValueCollection.h"
 %import(package="", module="mesh") "dolfin/mesh/LocalMeshData.h"
@@ -168,5 +175,6 @@ import_array();
 %include "dolfin/io/XDMFFile.h"
 %include "dolfin/io/HDF5File.h"
 %include "dolfin/io/HDF5Attribute.h"
+%include "dolfin/io/X3DOM.h"
 %include "dolfin/swig/io/post.i"
 
diff --git a/dolfin/swig/modules/la/dependencies.txt b/dolfin/swig/modules/la/dependencies.txt
index cd63729..c0d7a4c 100644
--- a/dolfin/swig/modules/la/dependencies.txt
+++ b/dolfin/swig/modules/la/dependencies.txt
@@ -1 +1 @@
-/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/ArrayView.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/MPI.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/constants.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/types.h;/home/joh [...]
\ No newline at end of file
+/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/ArrayView.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/MPI.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/constants.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common [...]
\ No newline at end of file
diff --git a/dolfin/swig/modules/la/module.i b/dolfin/swig/modules/la/module.i
index 403e757..d3e1839 100644
--- a/dolfin/swig/modules/la/module.i
+++ b/dolfin/swig/modules/la/module.i
@@ -47,12 +47,10 @@
 #include "dolfin/la/GenericLinearOperator.h"
 #include "dolfin/la/GenericTensor.h"
 #include "dolfin/la/GenericMatrix.h"
-#include "dolfin/la/GenericSparsityPattern.h"
 #include "dolfin/la/GenericVector.h"
 #include "dolfin/la/VectorSpaceBasis.h"
 #include "dolfin/la/GenericLinearSolver.h"
 #include "dolfin/la/GenericLUSolver.h"
-#include "dolfin/la/GenericPreconditioner.h"
 #include "dolfin/la/PETScOptions.h"
 #include "dolfin/la/PETScObject.h"
 #include "dolfin/la/PETScBaseMatrix.h"
@@ -66,21 +64,22 @@
 #include "dolfin/la/PETScKrylovSolver.h"
 #include "dolfin/la/PETScLUSolver.h"
 #include "dolfin/la/BelosKrylovSolver.h"
-#include "dolfin/la/MUMPSLUSolver.h"
-#include "dolfin/la/PaStiXLUSolver.h"
-#include "dolfin/la/STLMatrix.h"
+#include "dolfin/la/TrilinosPreconditioner.h"
+#include "dolfin/la/MueluPreconditioner.h"
+#include "dolfin/la/Ifpack2Preconditioner.h"
 #include "dolfin/la/CoordinateMatrix.h"
 #include "dolfin/la/EigenVector.h"
 #include "dolfin/la/PETScVector.h"
 #include "dolfin/la/TpetraVector.h"
 #include "dolfin/la/TensorLayout.h"
 #include "dolfin/la/SparsityPattern.h"
+#include "dolfin/la/IndexMap.h"
 #include "dolfin/la/GenericLinearAlgebraFactory.h"
 #include "dolfin/la/DefaultFactory.h"
 #include "dolfin/la/EigenFactory.h"
 #include "dolfin/la/PETScUserPreconditioner.h"
 #include "dolfin/la/PETScFactory.h"
-#include "dolfin/la/STLFactory.h"
+#include "dolfin/la/TpetraFactory.h"
 #include "dolfin/la/SLEPcEigenSolver.h"
 #include "dolfin/la/Vector.h"
 #include "dolfin/la/Matrix.h"
@@ -141,12 +140,10 @@ import_array();
 %include "dolfin/la/GenericLinearOperator.h"
 %include "dolfin/la/GenericTensor.h"
 %include "dolfin/la/GenericMatrix.h"
-%include "dolfin/la/GenericSparsityPattern.h"
 %include "dolfin/la/GenericVector.h"
 %include "dolfin/la/VectorSpaceBasis.h"
 %include "dolfin/la/GenericLinearSolver.h"
 %include "dolfin/la/GenericLUSolver.h"
-%include "dolfin/la/GenericPreconditioner.h"
 %include "dolfin/la/PETScOptions.h"
 %include "dolfin/la/PETScObject.h"
 %include "dolfin/la/PETScBaseMatrix.h"
@@ -160,21 +157,22 @@ import_array();
 %include "dolfin/la/PETScKrylovSolver.h"
 %include "dolfin/la/PETScLUSolver.h"
 %include "dolfin/la/BelosKrylovSolver.h"
-%include "dolfin/la/MUMPSLUSolver.h"
-%include "dolfin/la/PaStiXLUSolver.h"
-%include "dolfin/la/STLMatrix.h"
+%include "dolfin/la/TrilinosPreconditioner.h"
+%include "dolfin/la/MueluPreconditioner.h"
+%include "dolfin/la/Ifpack2Preconditioner.h"
 %include "dolfin/la/CoordinateMatrix.h"
 %include "dolfin/la/EigenVector.h"
 %include "dolfin/la/PETScVector.h"
 %include "dolfin/la/TpetraVector.h"
 %include "dolfin/la/TensorLayout.h"
 %include "dolfin/la/SparsityPattern.h"
+%include "dolfin/la/IndexMap.h"
 %include "dolfin/la/GenericLinearAlgebraFactory.h"
 %include "dolfin/la/DefaultFactory.h"
 %include "dolfin/la/EigenFactory.h"
 %include "dolfin/la/PETScUserPreconditioner.h"
 %include "dolfin/la/PETScFactory.h"
-%include "dolfin/la/STLFactory.h"
+%include "dolfin/la/TpetraFactory.h"
 %include "dolfin/la/SLEPcEigenSolver.h"
 %include "dolfin/la/Vector.h"
 %include "dolfin/la/Matrix.h"
diff --git a/dolfin/swig/modules/mesh/dependencies.txt b/dolfin/swig/modules/mesh/dependencies.txt
index a3208d3..cfcb115 100644
--- a/dolfin/swig/modules/mesh/dependencies.txt
+++ b/dolfin/swig/modules/mesh/dependencies.txt
@@ -1 +1 @@
-/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Hierarchical.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/MPI.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Set.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-1.6.0/dolfin/common/constants.h;/home/jo [...]
\ No newline at end of file
+/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Array.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Hierarchical.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/MPI.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/Variable.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/common/constants.h;/home/johannr/dev/fenics/src/dolfin/release/dolfin-2016.1.0/dolfin/fem [...]
\ No newline at end of file
diff --git a/dolfin/swig/modules/mesh/module.i b/dolfin/swig/modules/mesh/module.i
index 022abca..7e9ec86 100644
--- a/dolfin/swig/modules/mesh/module.i
+++ b/dolfin/swig/modules/mesh/module.i
@@ -31,15 +31,10 @@
 // #include types from common submodule of module common
 #include "dolfin/common/constants.h"
 #include "dolfin/common/Array.h"
-#include "dolfin/common/Set.h"
 #include "dolfin/common/Variable.h"
 #include "dolfin/common/Hierarchical.h"
 #include "dolfin/common/MPI.h"
 
-// #include types from parameter submodule of module common
-#include "dolfin/parameter/Parameter.h"
-#include "dolfin/parameter/Parameters.h"
-
 // #include types from la submodule of module la
 #include "dolfin/la/LinearAlgebraObject.h"
 
@@ -84,7 +79,6 @@
 #include "dolfin/mesh/LocalMeshData.h"
 #include "dolfin/mesh/SubDomain.h"
 #include "dolfin/mesh/SubMesh.h"
-#include "dolfin/mesh/Restriction.h"
 #include "dolfin/mesh/DomainBoundary.h"
 #include "dolfin/mesh/BoundaryMesh.h"
 #include "dolfin/mesh/PeriodicBoundaryComputation.h"
@@ -104,6 +98,8 @@
 #include "dolfin/generation/UnitSquareMesh.h"
 #include "dolfin/generation/UnitQuadMesh.h"
 #include "dolfin/generation/UnitHexMesh.h"
+#include "dolfin/generation/UnitDiscMesh.h"
+#include "dolfin/generation/SphericalShellMesh.h"
 
 // #include types from geometry submodule
 #include "dolfin/geometry/Point.h"
@@ -139,16 +135,10 @@ import_array();
 %include "dolfin/swig/common/pre.i"
 %import(package="", module="common") "dolfin/common/constants.h"
 %import(package="", module="common") "dolfin/common/Array.h"
-%import(package="", module="common") "dolfin/common/Set.h"
 %import(package="", module="common") "dolfin/common/Variable.h"
 %import(package="", module="common") "dolfin/common/Hierarchical.h"
 %import(package="", module="common") "dolfin/common/MPI.h"
 
-// %import types from submodule parameter of SWIG module common
-%include "dolfin/swig/parameter/pre.i"
-%import(package="", module="common") "dolfin/parameter/Parameter.h"
-%import(package="", module="common") "dolfin/parameter/Parameters.h"
-
 // %import types from submodule la of SWIG module la
 %include "dolfin/swig/la/pre.i"
 
@@ -197,7 +187,6 @@ import_array();
 %include "dolfin/mesh/LocalMeshData.h"
 %include "dolfin/mesh/SubDomain.h"
 %include "dolfin/mesh/SubMesh.h"
-%include "dolfin/mesh/Restriction.h"
 %include "dolfin/mesh/DomainBoundary.h"
 %include "dolfin/mesh/BoundaryMesh.h"
 %include "dolfin/mesh/PeriodicBoundaryComputation.h"
@@ -218,6 +207,8 @@ import_array();
 %include "dolfin/generation/UnitSquareMesh.h"
 %include "dolfin/generation/UnitQuadMesh.h"
 %include "dolfin/generation/UnitHexMesh.h"
+%include "dolfin/generation/UnitDiscMesh.h"
+%include "dolfin/generation/SphericalShellMesh.h"
 %include "dolfin/swig/generation/post.i"
 
 // %include types from submodule geometry
@@ -234,6 +225,7 @@ import_array();
 %include "dolfin/refinement/refine.h"
 
 // %include types from submodule graph
+%include "dolfin/swig/graph/pre.i"
 %include "dolfin/graph/Graph.h"
 %include "dolfin/graph/GraphBuilder.h"
 %include "dolfin/graph/BoostGraphOrdering.h"
diff --git a/dolfin/swig/multistage/docstrings.i b/dolfin/swig/multistage/docstrings.i
index baf715d..badb7b3 100644
--- a/dolfin/swig/multistage/docstrings.i
+++ b/dolfin/swig/multistage/docstrings.i
@@ -22,16 +22,7 @@
 
 // Documentation extracted from: (module=multistage, header=MultiStageScheme.h)
 %feature("docstring")  dolfin::MultiStageScheme::MultiStageScheme "
-**Overloaded versions**
-
-* MultiStageScheme\ (stage_forms, last_stage, stage_solutions, u, t, dt, dt_stage_offset, jacobian_indices, order, name, human_form)
-
-  Constructor
-  FIXME: This constructor is a MESS. Needs clean up...
-
-* MultiStageScheme\ (stage_forms, last_stage, stage_solutions, u, t, dt, dt_stage_offset, jacobian_indices, order, name, human_form, bcs)
-
-  Constructor with Boundary conditions
+Constructor
 ";
 
 %feature("docstring")  dolfin::MultiStageScheme::stage_forms "
diff --git a/dolfin/swig/nls/docstrings.i b/dolfin/swig/nls/docstrings.i
index 158c573..720bb1a 100644
--- a/dolfin/swig/nls/docstrings.i
+++ b/dolfin/swig/nls/docstrings.i
@@ -52,15 +52,17 @@ equations of the form :math:`F(x) = 0`.
 %feature("docstring")  dolfin::NewtonSolver::NewtonSolver "
 **Overloaded versions**
 
-* NewtonSolver\ ()
+* NewtonSolver\ (comm=MPI_COMM_WORLD)
 
   Create nonlinear solver
 
-* NewtonSolver\ (solver, factory)
+* NewtonSolver\ (comm, solver, factory)
 
   Create nonlinear solver using provided linear solver
   
   *Arguments*
+      comm (:py:class:`MPI`)
+          The MPI communicator.
       solver (:py:class:`GenericLinearSolver`)
           The linear solver.
       factory (:py:class:`GenericLinearAlgebraFactory`)
@@ -178,7 +180,15 @@ iteration.
 ";
 
 %feature("docstring")  dolfin::PETScSNESSolver::PETScSNESSolver "
-Create SNES solver for a particular method
+**Overloaded versions**
+
+* PETScSNESSolver\ (comm)
+
+  Create SNES solver
+
+* PETScSNESSolver\ (nls_type=\"default\")
+
+  Create SNES solver for a particular method
 ";
 
 %feature("docstring")  dolfin::PETScSNESSolver::solve "
@@ -225,6 +235,24 @@ Set up the SNES object, but don't do anything yet, in case the
 user wants to access the SNES object directly
 ";
 
+%feature("docstring")  dolfin::PETScSNESSolver::set_from_options "
+Set options from the PETSc options database
+";
+
+%feature("docstring")  dolfin::PETScSNESSolver::set_options_prefix "
+Sets the prefix used by PETSc when searching the PETSc options
+database
+";
+
+%feature("docstring")  dolfin::PETScSNESSolver::get_options_prefix "
+Returns the prefix used by PETSc when searching the PETSc
+options database
+";
+
+%feature("docstring")  dolfin::PETScSNESSolver::mpi_comm "
+Return the MPI communicator
+";
+
 %feature("docstring")  dolfin::PETScSNESSolver::methods "
 Return a list of available solver methods
 ";
@@ -245,7 +273,15 @@ as bound-constrained minimisation problem
 ";
 
 %feature("docstring")  dolfin::PETScTAOSolver::PETScTAOSolver "
-Create TAO solver for a particular method
+**Overloaded versions**
+
+* PETScTAOSolver\ (comm)
+
+  Create TAO solver
+
+* PETScTAOSolver\ (tao_type=\"default\", ksp_type=\"default\", pc_type=\"default\")
+
+  Create TAO solver for a particular method
 ";
 
 %feature("docstring")  dolfin::PETScTAOSolver::solve "
@@ -266,8 +302,9 @@ Create TAO solver for a particular method
           The upper bound.
   
   *Returns*
-      num_iterations (std::size_t)
-          Number of iterations
+      (int, bool)
+          Pair of number of iterations, and whether
+          iteration converged
 
 * solve\ (optimisation_problem, x)
 
@@ -280,8 +317,9 @@ Create TAO solver for a particular method
           The solution vector (initial guess).
   
   *Returns*
-      num_iterations (std::size_t)
-          Number of iterations
+      (int, bool)
+          Pair of number of iterations, and whether
+          iteration converged
 
 * solve\ (optimisation_problem, x, lb, ub)
 
@@ -298,8 +336,9 @@ Create TAO solver for a particular method
           The upper bound.
   
   *Returns*
-      num_iterations (std::size_t)
-          Number of iterations
+      (int, bool)
+          Pair of number of iterations, and whether
+          iteration converged
 ";
 
 %feature("docstring")  dolfin::PETScTAOSolver::methods "
@@ -348,7 +387,15 @@ It is a wrapper for the TAO bound constrained solver.
 ";
 
 %feature("docstring")  dolfin::TAOLinearBoundSolver::TAOLinearBoundSolver "
-Create TAO bound constrained solver
+**Overloaded versions**
+
+* TAOLinearBoundSolver\ (comm)
+
+  Create TAO bound constrained solver
+
+* TAOLinearBoundSolver\ (\"default\", \"default\", \"default\")
+
+  Create TAO bound constrained solver
 ";
 
 %feature("docstring")  dolfin::TAOLinearBoundSolver::solve "
diff --git a/dolfin/swig/parameter/post.i b/dolfin/swig/parameter/post.i
index 90ebd39..7382262 100644
--- a/dolfin/swig/parameter/post.i
+++ b/dolfin/swig/parameter/post.i
@@ -17,7 +17,7 @@
 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2009-05-12
-// Last changed: 2014-08-25
+// Last changed: 2016-04-19
 //
 // ===========================================================================
 // SWIG directives for the DOLFIN parameter kernel module (post)
@@ -41,6 +41,8 @@ def warn_once(self, msg):
         print(msg)
 
 def value(self):
+    if not self.is_set():
+        return None
     val_type = self.type_str()
     if val_type == "string":
         return str(self)
@@ -100,7 +102,7 @@ def data(self):
         PyObject *o = PyList_GetItem(op,i);
 %#if PY_VERSION_HEX>=0x03000000
         if (PyUnicode_Check(o))
-%#else  
+%#else
         if (PyString_Check(o))
 %#endif
         {
@@ -200,11 +202,13 @@ def __setitem__(self, key, value):
         return
     if key not in self._get_parameter_keys():
         raise KeyError("'%s' is not a parameter"%key)
-    if not isinstance(value,(int,str,float,bool)):
-        raise TypeError("can only set 'int', 'bool', 'float' and 'str' parameters")
+    if not isinstance(value,(int,str,float,bool)) and (value is not None):
+        raise TypeError("can only set 'int', 'bool', 'float' and 'str' for parameter %s" %key)
     par = self._get_parameter(key)
     if isinstance(value,bool):
         par._assign_bool(value)
+    elif value is None:
+        pass
     else:
         par._assign(value)
 
@@ -213,11 +217,13 @@ def update(self, other):
     if not isinstance(other,(Parameters, dict)):
         raise TypeError("expected a 'dict' or a '%s'"%Parameters.__name__)
     for key, other_value in other.items():
-        self_value  = self[key]
-        if isinstance(self_value, Parameters):
+        # Check is self[key] is a Parameter or a parameter set (Parameters)
+        if self.has_parameter_set(key):
+            self_value  = self[key]
             self_value.update(other_value)
         else:
-            setattr(self, key, other_value)
+            self.__setitem__(key, other_value)
+
 
 def to_dict(self):
     """Convert the Parameters to a dict"""
@@ -250,8 +256,30 @@ def __str__(self):
     "p.__str__() <==> str(x)"
     return self.str(False)
 
-__getattr__ = __getitem__
-__setattr__ = __setitem__
+def __getattr__(self, key):
+    # Check that there is still SWIG proxy available; otherwise
+    # implementation below may end up in infinite recursion
+    try:
+        self.__dict__["this"]
+    except KeyError:
+        raise AttributeError("SWIG proxy 'this' defunct on 'Parameters' object")
+
+    # Make sure KeyError is reraised as AttributeError
+    try:
+        return self.__getitem__(key)
+    except KeyError as e:
+        raise AttributeError("'Parameters' object has no attribute '%s'" % e.message)
+
+__getattr__.__doc__ = __getitem__.__doc__
+
+def __setattr__(self, key, value):
+    # Make sure KeyError is reraised as AttributeError
+    try:
+        return self.__setitem__(key, value)
+    except KeyError as e:
+        raise AttributeError("'Parameters' object has no attribute '%s'" % e.message)
+
+__setattr__.__doc__ = __setitem__.__doc__
 
 def iterdata(self):
     """Returns an iterator of a tuple of a parameter key together with its value"""
@@ -345,4 +373,3 @@ std::shared_ptr<dolfin::Parameters> get_global_parameters()
 //parameters = _common.get_global_parameters()
 //del _common.get_global_parameters
 //%}
-
diff --git a/dolfin/swig/plot/docstrings.i b/dolfin/swig/plot/docstrings.i
index 84d30e9..529e80d 100644
--- a/dolfin/swig/plot/docstrings.i
+++ b/dolfin/swig/plot/docstrings.i
@@ -64,12 +64,12 @@ mode is entered even if 'Q' has been pressed.
 
 // Documentation extracted from: (module=plot, header=VTKPlotter.h)
 %feature("docstring")  dolfin::VTKPlotter "
-This class enables visualization of various DOLFIN entities.
-It supports visualization of meshes, functions, expressions, boundary
-conditions and mesh functions. It can plot data wrapped in classes
-conforming to the GenericVTKPlottable interface.
-The plotter has several parameters that the user can set and adjust to
-affect the appearance and behavior of the plot.
+This class enables visualization of various DOLFIN entities.  It
+supports visualization of meshes, functions, expressions,
+boundary conditions and mesh functions. It can plot data wrapped
+in classes conforming to the GenericVTKPlottable interface.  The
+plotter has several parameters that the user can set and adjust
+to affect the appearance and behavior of the plot.
 
 A plotter can be created and used in the following way:
 
@@ -77,8 +77,9 @@ A plotter can be created and used in the following way:
   VTKPlotter plotter(mesh);
   plotter.plot();
 
-Parameters can be adjusted at any time and will take effect on the next
-call to the plot() method. The following parameters exist:
+Parameters can be adjusted at any time and will take effect on
+the next call to the plot() method. The following parameters
+exist:
 
 ============== ============ ================ ====================================
  Name           Value type   Default value              Description
@@ -171,24 +172,24 @@ The default visualization mode for the different plot types are as follows:
                                                          Color mapping (norm)
 =========================  ============================ =====================
 
-Expressions and boundary conditions are also visualized according to the
-above table.
+Expressions and boundary conditions are also visualized
+according to the above table.
 ";
 
 %feature("docstring")  dolfin::VTKPlotter::VTKPlotter "
 **Overloaded versions**
 
-* VTKPlotter\ (Variable>, NULL)
+* VTKPlotter\ (Variable>)
 
-  Create plotter for a variable. If a widget is supplied, this widget
-  will be used for drawing, instead of a new top-level widget. Ownership
-  is transferred.
+  Create plotter for a variable. If a widget is supplied, this
+  widget will be used for drawing, instead of a new top-level
+  widget. Ownership is transferred.
 
-* VTKPlotter\ (expression, mesh, NULL)
+* VTKPlotter\ (expression, mesh)
 
-  Create plotter for an Expression with associated Mesh. If a widget is
-  supplied, this widget will be used for drawing, instead of a new
-  top-level widget. Ownership is transferred.
+  Create plotter for an Expression with associated Mesh. If a
+  widget is supplied, this widget will be used for drawing,
+  instead of a new top-level widget. Ownership is transferred.
 ";
 
 %feature("docstring")  dolfin::VTKPlotter::default_parameters "
@@ -230,7 +231,7 @@ Camera control
 ";
 
 %feature("docstring")  dolfin::VTKPlotter::all_interactive "
-Make all plot windows interactive. If really is set, the interactive
-mode is entered even if 'Q' has been pressed.
+Make all plot windows interactive. If really is set, the
+interactive mode is entered even if 'Q' has been pressed.
 ";
 
diff --git a/dolfin/swig/plot/pre.i b/dolfin/swig/plot/pre.i
index 9f0bbbc..fc82a93 100644
--- a/dolfin/swig/plot/pre.i
+++ b/dolfin/swig/plot/pre.i
@@ -29,6 +29,12 @@
 //-----------------------------------------------------------------------------
 // Ignores for MultiMesh
 //-----------------------------------------------------------------------------
-%ignore dolfin::plot(const MultiMesh& multimesh);
-%ignore dolfin::plot(std::shared_ptr<const MultiMesh> multimesh);
+%ignore dolfin::plot(const MultiMesh&);
+%rename (_plot_multimesh) dolfin::plot(std::shared_ptr<const MultiMesh>);
 
+// Ignore reference versions of plot
+%ignore dolfin::plot(const Variable&, std::string, std::string);
+%ignore dolfin::plot(const Variable&, const Parameters&);
+%ignore dolfin:: plot(const Expression&, const Mesh&, std::string, std::string);
+%ignore dolfin:: plot(const Expression&, const Mesh&, std::string, std::string);
+%ignore dolfin::plot(const Expression&, const Mesh&, const Parameters&);
diff --git a/dolfin/swig/refinement/docstrings.i b/dolfin/swig/refinement/docstrings.i
index ea20d87..faaa423 100644
--- a/dolfin/swig/refinement/docstrings.i
+++ b/dolfin/swig/refinement/docstrings.i
@@ -101,3 +101,28 @@
           distributed mesh.
 ";
 
+%feature("docstring")  dolfin::p_refine "
+**Overloaded versions**
+
+* p_refine\ (refined_mesh, mesh)
+
+  Increase the polynomial order of the mesh from 1 to 2, i.e. add points
+  at the Edge midpoints, to make a quadratic mesh.
+  
+  *Arguments*
+      refined_mesh (:py:class:`Mesh`)
+          The mesh that will be the quadratic mesh.
+      mesh (:py:class:`Mesh`)
+          The original linear mesh.
+
+* p_refine\ (mesh)
+
+  Return a p_refined mesh
+  Increase the polynomial order of the mesh from 1 to 2, i.e. add points
+  at the Edge midpoints, to make a quadratic mesh.
+  
+  *Arguments*
+      mesh (:py:class:`Mesh`)
+          The original linear mesh.
+";
+
diff --git a/dolfin/swig/shared_ptr_classes.i b/dolfin/swig/shared_ptr_classes.i
index fba63eb..cc74f82 100644
--- a/dolfin/swig/shared_ptr_classes.i
+++ b/dolfin/swig/shared_ptr_classes.i
@@ -40,13 +40,12 @@
 %include <std_shared_ptr.i>
 
 //-----------------------------------------------------------------------------
-// Make DOLFIN aware of the types defined in UFC
+// Declare shared_ptr stored types in UFC
 //-----------------------------------------------------------------------------
-%{
-#include <ufc.h>
-%}
-%include <swig/ufc_shared_ptr_classes.i>
-%import(module="ufc") "ufc.h"
+%shared_ptr(ufc::function)
+%shared_ptr(ufc::dofmap)
+%shared_ptr(ufc::finite_element)
+%shared_ptr(ufc::form)
 
 //-----------------------------------------------------------------------------
 // Declare shared_ptr stored types in PyDOLFIN
@@ -112,7 +111,6 @@
 %shared_ptr(dolfin::Hierarchical<dolfin::Mesh>)
 %shared_ptr(dolfin::BoundaryMesh)
 %shared_ptr(dolfin::Mesh)
-%shared_ptr(dolfin::Restriction)
 %shared_ptr(dolfin::SubMesh)
 %shared_ptr(dolfin::UnitTetrahedronMesh)
 %shared_ptr(dolfin::UnitCubeMesh)
@@ -122,6 +120,8 @@
 %shared_ptr(dolfin::UnitSquareMesh)
 %shared_ptr(dolfin::UnitQuadMesh)
 %shared_ptr(dolfin::UnitHexMesh)
+%shared_ptr(dolfin::UnitDiscMesh)
+%shared_ptr(dolfin::SphericalShellMesh)
 %shared_ptr(dolfin::BoxMesh)
 %shared_ptr(dolfin::Box)
 %shared_ptr(dolfin::RectangleMesh)
@@ -160,8 +160,7 @@
 %shared_ptr(dolfin::Matrix)
 %shared_ptr(dolfin::Vector)
 %shared_ptr(dolfin::LinearOperator)
-
-%shared_ptr(dolfin::STLMatrix)
+%shared_ptr(dolfin::IndexMap)
 
 %shared_ptr(dolfin::EigenKrylovSolver)
 %shared_ptr(dolfin::EigenLUSolver)
@@ -184,6 +183,9 @@
 %shared_ptr(dolfin::TpetraVector)
 %shared_ptr(dolfin::TpetraMatrix)
 %shared_ptr(dolfin::BelosKrylovSolver)
+%shared_ptr(dolfin::TrilinosPreconditioner)
+%shared_ptr(dolfin::Ifpack2Preconditioner)
+%shared_ptr(dolfin::MueluPreconditioner)
 #endif
 
 #ifdef HAS_SLEPC
@@ -204,7 +206,6 @@
 %shared_ptr(dolfin::LUSolver)
 
 %shared_ptr(dolfin::TensorLayout)
-%shared_ptr(dolfin::GenericSparsityPattern)
 %shared_ptr(dolfin::SparsityPattern)
 
 // log
@@ -215,6 +216,7 @@
 %shared_ptr(dolfin::File)
 %shared_ptr(dolfin::XDMFFile)
 %shared_ptr(dolfin::HDF5File)
+%shared_ptr(dolfin::X3DOM)
 
 // math
 %shared_ptr(dolfin::Lagrange)
diff --git a/dolfin/swig/typemaps/array.i b/dolfin/swig/typemaps/array.i
index abc2022..f1204cd 100644
--- a/dolfin/swig/typemaps/array.i
+++ b/dolfin/swig/typemaps/array.i
@@ -107,6 +107,7 @@
 
 // Instantiate argument name specific typemaps for non const arguments
 IN_NUMPY_TYPEMAP_FOR_DOLFIN_ARRAY(double, DOUBLE, NPY_DOUBLE, double, values, )
+IN_NUMPY_TYPEMAP_FOR_DOLFIN_ARRAY(double, DOUBLE, NPY_DOUBLE, double, y, )
 IN_NUMPY_TYPEMAP_FOR_DOLFIN_ARRAY(std::size_t, INT32, NPY_UINTP, size_t, indices,)
 IN_NUMPY_TYPEMAP_FOR_DOLFIN_ARRAY(double, DOUBLE, NPY_DOUBLE, double, vertex_values, )
 IN_NUMPY_TYPEMAP_FOR_DOLFIN_ARRAY(dolfin::la_index, INT32, NPY_UINTP, dolfin_index, indices,)
diff --git a/dolfin/swig/typemaps/includes.i b/dolfin/swig/typemaps/includes.i
index fe0d8e0..b792ff1 100644
--- a/dolfin/swig/typemaps/includes.i
+++ b/dolfin/swig/typemaps/includes.i
@@ -29,5 +29,6 @@
 %include dolfin/swig/typemaps/numpy.i
 %include dolfin/swig/typemaps/array.i
 %include dolfin/swig/typemaps/std_vector.i
+%include dolfin/swig/typemaps/std_array.i
 %include dolfin/swig/typemaps/std_set.i
 %include dolfin/swig/typemaps/std_map.i
diff --git a/dolfin/swig/typemaps/std_array.i b/dolfin/swig/typemaps/std_array.i
new file mode 100644
index 0000000..e6bb8cc
--- /dev/null
+++ b/dolfin/swig/typemaps/std_array.i
@@ -0,0 +1,109 @@
+/* -*- C -*- */
+// Copyright (C) 2009-2016 Johan Hake and Garth N. Wells
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+//=============================================================================
+// In this file we declare what types that should be able to be passed
+// using a std::array typemap. It is modelled on std_vector.i
+// =============================================================================
+
+//-----------------------------------------------------------------------------
+// Declare a dummy array class. This makes SWIG aware of the template
+// type
+// -----------------------------------------------------------------------------
+namespace std
+{
+  template <typename T> class array
+  {
+  };
+}
+
+//-----------------------------------------------------------------------------
+// Macro for defining an in typemap for a std::array of primitives passed by
+// value
+//
+// TYPE       : The primitive type
+// TYPE_UPPER : The SWIG specific name of the type used in the array type checks
+//              values SWIG use: INT32 for integer, DOUBLE for double aso.
+// ARG_NAME   : The name of the argument that will be maped as an 'argout'
+//              argument
+// TYPE_NAME  : The name of the pointer type, 'double' for 'double', 'uint' for
+//              'dolfin::uint'
+//-----------------------------------------------------------------------------
+%define PY_SEQUENCE_OF_SCALARS_TO_ARRAY_OF_PRIMITIVES(TYPE, DIM, TYPE_UPPER, \
+                                                      ARG_NAME, TYPE_NAME)
+
+%typecheck(SWIG_TYPECHECK_ ## TYPE_UPPER ## _ARRAY) std::array<TYPE, DIM> ARG_NAME
+{ $1 = PySequence_Check($input) ? 1 : 0; }
+
+%typemap (in, fragment=Py_convert_frag(TYPE_NAME)) std::array<TYPE, DIM> ARG_NAME
+  (std::array<TYPE, DIM> tmp_array, PyObject* item, TYPE value, std::size_t i)
+{
+  // A first sequence test
+  if (!PySequence_Check($input))
+  {
+    SWIG_exception(SWIG_TypeError, "expected a sequence for argument $argnum");
+  }
+
+  // Get sequence length
+  Py_ssize_t pyseq_length = PySequence_Size($input);
+  if (pyseq_length != DIM)
+  {
+    SWIG_exception(SWIG_TypeError, "expected a sequence with length DIM");
+  }
+
+  for (i = 0; i < pyseq_length; i++)
+  {
+    item = PySequence_ITEM($input, i);
+    if(!SWIG_IsOK(Py_convert_ ## TYPE_NAME(item, value)))
+    {
+      Py_DECREF(item);
+      SWIG_exception(SWIG_TypeError, "expected items of sequence to be of type " \
+		     "\"TYPE_NAME\" in argument $argnum");
+    }
+    tmp_array[i] = value;
+    Py_DECREF(item);
+  }
+  $1 = tmp_array;
+}
+%enddef
+
+//-----------------------------------------------------------------------------
+// Macro for out typemaps of primitives of std::array<TYPE, DIM> It returns
+// a NumPy array
+//
+// TYPE       : The primitive type
+// NUMPY_TYPE : The corresponding NumPy type
+//-----------------------------------------------------------------------------
+%define OUT_TYPEMAP_STD_ARRAY_OF_PRIMITIVES(TYPE, DIM, NUMPY_TYPE)
+
+%typemap(out) std::array<TYPE, DIM>
+{
+  npy_intp adims = $1.size();
+
+  $result = PyArray_SimpleNew(1, &adims, NUMPY_TYPE);
+  TYPE* data = static_cast<TYPE*>(PyArray_DATA(reinterpret_cast<PyArrayObject*>($result)));
+  std::copy($1.begin(), $1.end(), data);
+}
+
+%enddef
+
+//-----------------------------------------------------------------------------
+// Run the different macros and instantiate the typemaps
+//-----------------------------------------------------------------------------
+OUT_TYPEMAP_STD_ARRAY_OF_PRIMITIVES(double, 3, NPY_DOUBLE)
+PY_SEQUENCE_OF_SCALARS_TO_ARRAY_OF_PRIMITIVES(double, 3, DOUBLE, rgb, double)
diff --git a/dolfin/swig/typemaps/std_map.i b/dolfin/swig/typemaps/std_map.i
index 900c0f5..d9f22a1 100644
--- a/dolfin/swig/typemaps/std_map.i
+++ b/dolfin/swig/typemaps/std_map.i
@@ -221,6 +221,9 @@ MAP_OUT_TYPEMAPS(std::size_t, int, int, NPY_INT)
 MAP_OUT_TYPEMAPS(std::size_t, double, double, NPY_DOUBLE)
 MAP_OUT_TYPEMAPS(std::size_t, std::size_t, size_t, NPY_UINTP)
 
+// FIXME: Would really like to use std::int32_t
+MAP_OUT_TYPEMAPS(int, unsigned int, uint, NPY_UINT)
+
 
 // Add 'out' typemap for std::map<std::string, std::string>
 %typemap(out) std::map<std::string, std::string> \
diff --git a/dolfin/swig/typemaps/std_pair.i b/dolfin/swig/typemaps/std_pair.i
index 721b4a0..f535207 100644
--- a/dolfin/swig/typemaps/std_pair.i
+++ b/dolfin/swig/typemaps/std_pair.i
@@ -184,6 +184,28 @@ IN_TYPEMAPS_STD_PAIR_OF_POINTER_AND_DOUBLE(MeshFunction<bool>)
 
 }
 
+
+%typecheck(SWIG_TYPECHECK_POINTER) std::pair<std::int64_t, std::int64_t>
+{
+  $1 = PyTuple_Check($input) ? 1 : 0;
+}
+%typemap(in) std::pair<std::int64_t, std::int64_t> (std::pair<std::int64_t, std::int64_t> tmp_pair, long tmp)
+{
+  // Check that we have a tuple
+  if (!PyTuple_Check($input) || PyTuple_Size($input) != 2)
+    SWIG_exception(SWIG_TypeError, "expected a tuple of length 2 of ints.");
+
+  // Get pointers to function and time
+  PyObject* py_first  = PyTuple_GetItem($input, 0);
+  PyObject* py_second = PyTuple_GetItem($input, 1);
+
+  tmp_pair = std::make_pair(PyLong_AsLongLong(py_first), PyLong_AsLongLong(py_second));
+
+  // Assign input variable
+  $1 = tmp_pair;
+}
+
+
 %typecheck(SWIG_TYPECHECK_POINTER) std::pair<double, double>
 {
   $1 = PyTuple_Check($input) ? 1 : 0;
@@ -209,29 +231,26 @@ IN_TYPEMAPS_STD_PAIR_OF_POINTER_AND_DOUBLE(MeshFunction<bool>)
 // Out typemap for std::pair<TYPE,TYPE>
 //-----------------------------------------------------------------------------
 %typemap(out) std::pair<std::size_t, std::size_t>
-{
-  $result = Py_BuildValue("ii", $1.first, $1.second);
-}
+{ $result = Py_BuildValue("ii", $1.first, $1.second); }
+
+%typemap(out) std::pair<std::int64_t, std::int64_t>
+{ $result = Py_BuildValue("LL", $1.first, $1.second); }
+
 %typemap(out) std::pair<std::size_t, bool>
-{
-  $result = Py_BuildValue("ib", $1.first, $1.second);
-}
+{ $result = Py_BuildValue("ib", $1.first, $1.second); }
+
 %typemap(out) std::pair<unsigned int, unsigned int>
-{
-  $result = Py_BuildValue("ii", $1.first, $1.second);
-}
+{ $result = Py_BuildValue("ii", $1.first, $1.second); }
+
 %typemap(out) std::pair<unsigned int, bool>
-{
-  $result = Py_BuildValue("ib", $1.first, $1.second);
-}
+{ $result = Py_BuildValue("ib", $1.first, $1.second); }
+
 %typemap(out) std::pair<double, double>
-{
-  $result = Py_BuildValue("dd", $1.first, $1.second);
-}
+{ $result = Py_BuildValue("dd", $1.first, $1.second); }
+
 %typemap(out) std::pair<unsigned int, double>
-{
-  $result = Py_BuildValue("id", $1.first, $1.second);
-}
+{ $result = Py_BuildValue("id", $1.first, $1.second); }
+
 
 // FIXME: Add macro for the two typemaps below
 
diff --git a/dolfin/swig/typemaps/std_vector.i b/dolfin/swig/typemaps/std_vector.i
index fe971b5..2cbc015 100644
--- a/dolfin/swig/typemaps/std_vector.i
+++ b/dolfin/swig/typemaps/std_vector.i
@@ -655,6 +655,8 @@ TYPEMAPS_STD_VECTOR_OF_POINTERS(GenericFunction)
 TYPEMAPS_STD_VECTOR_OF_POINTERS(GenericVector)
 TYPEMAPS_STD_VECTOR_OF_POINTERS(FunctionSpace)
 TYPEMAPS_STD_VECTOR_OF_POINTERS(Parameters)
+TYPEMAPS_STD_VECTOR_OF_POINTERS(IndexMap)
+TYPEMAPS_STD_VECTOR_OF_POINTERS(GenericDofMap)
 
 #if (DOLFIN_SIZE_T==4)
 ARGOUT_TYPEMAP_STD_VECTOR_OF_PRIMITIVES(std::size_t, INT32, cells, NPY_UINTP)
@@ -748,19 +750,7 @@ IN_TYPEMAP_STD_VECTOR_OF_STD_VECTOR_OF_PRIMITIVES(std::size_t, INT64, facets,
                                                   std_size_t)
 #endif
 
-// Typemaps for GenericSparsityPattern interface
-#if (DOLFIN_SIZE_T==4)
-IN_TYPEMAP_STD_VECTOR_OF_ARRAYVIEW_OF_PRIMITIVES(const std::size_t, INT32,
-                                                 local_to_global, NPY_UINTP,
-                                                 uintp)
-#else
-IN_TYPEMAP_STD_VECTOR_OF_ARRAYVIEW_OF_PRIMITIVES(const std::size_t, INT64,
-                                                 local_to_global, NPY_UINTP,
-                                                 uintp)
-#endif
-IN_TYPEMAP_STD_VECTOR_OF_ARRAYVIEW_OF_PRIMITIVES(const int, INT32,
-                                                 off_process_owner, NPY_INT,
-                                                 intc)
+// Typemaps for SparsityPattern::insert_local/global
 #if (DOLFIN_LA_INDEX_SIZE==4)
 IN_TYPEMAP_STD_VECTOR_OF_ARRAYVIEW_OF_PRIMITIVES(const dolfin::la_index, INT32,
                                                  entries, NPY_INT, int32)
diff --git a/site-packages/dolfin/__init__.py b/site-packages/dolfin/__init__.py
index f1b1f32..6c8671d 100644
--- a/site-packages/dolfin/__init__.py
+++ b/site-packages/dolfin/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Main module for DOLFIN"""
 
 # Special module to handle import issues
diff --git a/site-packages/dolfin/common/__init__.py b/site-packages/dolfin/common/__init__.py
index 21a285c..2ab994e 100644
--- a/site-packages/dolfin/common/__init__.py
+++ b/site-packages/dolfin/common/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """The common module of dolfin"""
 from dolfin.common import globalparameters
 from dolfin.common import constants
diff --git a/site-packages/dolfin/common/constants.py b/site-packages/dolfin/common/constants.py
index 84f788d..9fae121 100644
--- a/site-packages/dolfin/common/constants.py
+++ b/site-packages/dolfin/common/constants.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module allows the user to import the following constants:
 
 * DOLFIN_PI = 3.141592653589793238462
diff --git a/site-packages/dolfin/common/globalparameters.py.in b/site-packages/dolfin/common/globalparameters.py.in
index 7e17974..f96eb25 100644
--- a/site-packages/dolfin/common/globalparameters.py.in
+++ b/site-packages/dolfin/common/globalparameters.py.in
@@ -1,7 +1,7 @@
 """This module defines Python-specific global parameters for DOLFIN by
 adding to the global parameter set defined in C++."""
 
-# Copyright (C) 2009-2010 Anders Logg
+# Copyright (C) 2009-2016 Anders Logg
 #
 # This file is part of DOLFIN.
 #
@@ -17,49 +17,13 @@ adding to the global parameter set defined in C++."""
 #
 # You should have received a copy of the GNU Lesser General Public License
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2009-09-21
-# Last changed: 2011-03-14
-
-from __future__ import print_function
 
 __all__ = ["parameters"]
 
-import ufl
-import six
-from dolfin.cpp import parameters, Parameters, MPI
-
-# Set default form compiler
-form_compiler_name = "ffc"
-
-# Import form compiler
-try:
-    form_compiler = __import__(form_compiler_name)
-except ImportError as message:
-    print(message)
-    raise RuntimeError("Could not import %s form compiler." % form_compiler_name)
-
-# Initialize form compiler parameters
-form_compiler_parameters = Parameters("form_compiler")
-for key, value in six.iteritems(form_compiler.default_parameters()):
-    if key in ["swig_binary", "swig_path"]:
-        continue
-    form_compiler_parameters.add(key, value)
-form_compiler_parameters.add("name", form_compiler_name)
-
-# Special case: handling -1 as "auto" for quadrature_degree in FFC
-if form_compiler_name == "ffc":
-    form_compiler_parameters.remove("quadrature_degree")
-    form_compiler_parameters.add("quadrature_degree", -1)
-    form_compiler_parameters.add("no-evaluate_basis_derivatives", True)
-
-# Increase log level for form compiler to hide output
-form_compiler_parameters["log_level"] = ufl.INFO + 5
-
-# Set prefix when running in parallel
-#if MPI.num_processes(MPI_COMM_WORLD) > 1:
-#    form_compiler_parameters["log_prefix"] = "Process %d: " % MPI.process_number()
+from ffc import default_jit_parameters
+from dolfin.cpp import parameters, Parameters
 
 # Add form compiler parameters to global parameter set
 if not parameters.has_parameter_set("form_compiler"):
+    form_compiler_parameters = Parameters("form_compiler", **default_jit_parameters())
     parameters.add(form_compiler_parameters)
diff --git a/site-packages/dolfin/common/math.py b/site-packages/dolfin/common/math.py
index 3b601c8..6f1cc1c 100644
--- a/site-packages/dolfin/common/math.py
+++ b/site-packages/dolfin/common/math.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Convenience functions that are useful in subdomains and expressions. Matches
 some of the functions in dolfin/math/basic.h."""
 
diff --git a/site-packages/dolfin/common/memory.py b/site-packages/dolfin/common/memory.py
index 2216168..64991c3 100644
--- a/site-packages/dolfin/common/memory.py
+++ b/site-packages/dolfin/common/memory.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2010 Anders Logg
 #
 # This file is part of DOLFIN.
diff --git a/site-packages/dolfin/common/plotting.py b/site-packages/dolfin/common/plotting.py
index d073121..5260aaf 100644
--- a/site-packages/dolfin/common/plotting.py
+++ b/site-packages/dolfin/common/plotting.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2008-2012 Joachim B. Haga and Fredrik Valdmanis
 #
 # This file is part of DOLFIN.
@@ -15,22 +16,356 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
-# Modified by Martin Sandve Alnaes, 2008.
-# Modified by Anders Logg, 2008-2010.
+# Modified by Martin Sandve Alnæs 2008-2015
+# Modified by Anders Logg 2008-2015
 #
 # First added:  2008-03-05
-# Last changed: 2014-08-11
+# Last changed: 2015-11-26
 
 from __future__ import print_function
 import os
+from distutils.version import StrictVersion
+
+import dolfin
 import dolfin.cpp as cpp
 import ufl
+import numpy as np
 
 __all__ = ['plot']
 
+_meshfunction_types = (cpp.MeshFunction, cpp.MeshFunctionBool, cpp.MeshFunctionInt,
+                      cpp.MeshFunctionDouble, cpp.MeshFunctionSizet)
+_plottable_types = (cpp.Function,
+                    cpp.Expression,
+                    cpp.Mesh,
+                    cpp.MultiMesh,
+                    cpp.DirichletBC) + _meshfunction_types
+
+def _has_matplotlib():
+    try:
+        import matplotlib
+    except ImportError:
+        return False
+
+    # Switch to Agg backend if DISPLAY not set
+    if not os.environ.get("DISPLAY"):
+        cpp.log(cpp.PROGRESS, "Environment variable DISPLAY not set. Switching "
+                              "to 'Agg' matplotlib backend.")
+        try:
+            matplotlib.use("Agg")
+        except ValueError as e:
+            cpp.warning("Switching to 'Agg' backend failed with the message:")
+            print('"%s"' % str(e))
+            cpp.warning("Trying to continue...")
+
+    return True
+
+# Add plotting_backend to parameter system (don't need this in C++)
+_available_backends = []
+if cpp.has_vtk():
+    _available_backends.append("vtk")
+if _has_matplotlib():
+    _available_backends.append("matplotlib")
+_available_backends.append("none")
+cpp.parameters.add("plotting_backend", _available_backends[0],
+        _available_backends)
+
+def mesh2triang(mesh):
+    import matplotlib.tri as tri
+    xy = mesh.coordinates()
+    return tri.Triangulation(xy[:, 0], xy[:, 1], mesh.cells())
+
+def mplot_mesh(ax, mesh, **kwargs):
+    tdim = mesh.topology().dim()
+    gdim = mesh.geometry().dim()
+    if gdim == 2 and tdim == 2:
+        color = kwargs.pop("color", '#808080')
+        return ax.triplot(mesh2triang(mesh), color=color, **kwargs)
+    elif gdim == 3 and tdim == 3:
+        bmesh = dolfin.BoundaryMesh(mesh, "exterior", order=False)
+        mplot_mesh(ax, bmesh, **kwargs)
+    elif gdim == 3 and tdim == 2:
+        xy = mesh.coordinates()
+        return ax.plot_trisurf(*[xy[:,i] for i in range(gdim)],
+                triangles=mesh.cells(), **kwargs)
+    elif tdim == 1:
+        x = [mesh.coordinates()[:,i] for i in range(gdim)]
+        if gdim == 1:
+            x.append(np.zeros_like(x[0]))
+            ax.set_yticks([])
+        marker = kwargs.pop('marker', 'o')
+        return ax.plot(*x, marker=marker, **kwargs)
+    else:
+        assert False, "this code should not be reached"
+
+# TODO: This is duplicated somewhere else
+def create_cg1_function_space(mesh, sh):
+    r = len(sh)
+    if r == 0:
+        V = dolfin.FunctionSpace(mesh, "CG", 1)
+    elif r == 1:
+        V = dolfin.VectorFunctionSpace(mesh, "CG", 1, dim=sh[0])
+    else:
+        V = dolfin.TensorFunctionSpace(mesh, "CG", 1, shape=sh)
+    return V
+
+def mplot_expression(ax, f, mesh, **kwargs):
+    # TODO: Can probably avoid creating the function space here by restructuring
+    #       mplot_function a bit so it can handle Expression natively
+    V = create_cg1_function_space(mesh, f.ufl_shape)
+    g = dolfin.interpolate(f, V)
+    return mplot_function(ax, g, **kwargs)
+
+def mplot_function(ax, f, **kwargs):
+    mesh = f.function_space().mesh()
+    gdim = mesh.geometry().dim()
+    tdim = mesh.topology().dim()
+
+    # Extract the function vector in a way that also works for subfunctions
+    try:
+        fvec = f.vector()
+    except RuntimeError:
+        fspace = f.function_space()
+        try:
+            fspace = fspace.collapse()
+        # Happens for part of MultiMeshFunction; no way detecting elsewhere
+        except RuntimeError:
+            cpp.warning("Probably trying to plot MultiMeshFunction "
+                        "part. Continuing without plotting...")
+            return
+        fvec = dolfin.interpolate(f, fspace).vector()
+
+    if fvec.size() == mesh.num_cells():
+        # DG0 cellwise function
+        C = fvec.array() # NB! Assuming here dof ordering matching cell numbering
+        if gdim == 2 and tdim == 2:
+            return ax.tripcolor(mesh2triang(mesh), C, **kwargs)
+        elif gdim == 3 and tdim == 2: # surface in 3d
+            # FIXME: Not tested, probably broken
+            xy = mesh.coordinates()
+            shade = kwargs.pop("shade", True)
+            return ax.plot_trisurf(mesh2triang(mesh), xy[:,2], C, shade=shade, **kwargs)
+        elif gdim == 1 and tdim == 1:
+            x = mesh.coordinates()[:,0]
+            nv = len(x)
+            # Insert duplicate points to get piecewise constant plot
+            xp = np.zeros(2*nv-2)
+            xp[0] = x[0]
+            xp[-1] = x[-1]
+            xp[1:2*nv-3:2] = x[1:-1]
+            xp[2:2*nv-2:2] = x[1:-1]
+            Cp = np.zeros(len(xp))
+            Cp[0:len(Cp)-1:2] = C
+            Cp[1:len(Cp):2] = C
+            return ax.plot(xp, Cp, *kwargs)
+        #elif tdim == 1: # FIXME: Plot embedded line
+        else:
+            raise AttributeError('Matplotlib plotting backend only supports 2D mesh for scalar functions.')
+
+    elif f.value_rank() == 0:
+        # Scalar function, interpolated to vertices
+        # TODO: Handle DG1?
+        C = f.compute_vertex_values(mesh)
+        if gdim == 2 and tdim == 2:
+            mode = kwargs.pop("mode", "color")
+            if mode == "color":
+                shading = kwargs.pop("shading", "flat")
+                return ax.tripcolor(mesh2triang(mesh), C, shading=shading, **kwargs)
+            elif mode == "warp":
+                from matplotlib import cm
+                cmap = kwargs.pop("cmap", cm.jet)
+                linewidths = kwargs.pop("linewidths", 0)
+                return ax.plot_trisurf(mesh2triang(mesh), C, cmap=cmap,
+                        linewidths=linewidths, **kwargs)
+            elif mode == "wireframe":
+                return ax.triplot(mesh2triang(mesh), **kwargs)
+            elif mode == "contour":
+                return ax.tricontour(mesh2triang(mesh), C, **kwargs)
+        elif gdim == 3 and tdim == 2: # surface in 3d
+            # FIXME: Not tested
+            from matplotlib import cm
+            cmap = kwargs.pop("cmap", cm.jet)
+            return ax.plot_trisurf(mesh2triang(mesh), C, cmap=cmap, **kwargs)
+        elif gdim == 3 and tdim == 3:
+            # Volume
+            # TODO: Isosurfaces?
+            # Vertex point cloud
+            X = [mesh.coordinates()[:, i] for i in range(gdim)]
+            return ax.scatter(*X, c=C, **kwargs)
+        elif gdim == 1 and tdim == 1:
+            x = mesh.coordinates()[:,0]
+            ax.set_aspect('auto')
+
+            # Setting limits for Line2D objects
+            vmin = kwargs.pop("vmin", None)
+            vmax = kwargs.pop("vmax", None)
+            ax.set_ylim([vmin, vmax])
+            return ax.plot(x, C, **kwargs)
+        #elif tdim == 1: # FIXME: Plot embedded line
+        else:
+            raise AttributeError('Matplotlib plotting backend only supports 2D mesh for scalar functions.')
+
+    elif f.value_rank() == 1:
+        # Vector function, interpolated to vertices
+        w0 = f.compute_vertex_values(mesh)
+        nv = mesh.num_vertices()
+        if len(w0) != gdim*nv:
+            raise AttributeError('Vector length must match geometric dimension.')
+        X = mesh.coordinates()
+        X = [X[:, i] for i in range(gdim)]
+        U = [w0[i*nv: (i+1)*nv] for i in range(gdim)]
+
+        # Compute magnitude
+        C = U[0]**2
+        for i in range(1,gdim):
+            C += U[i]**2
+        C = np.sqrt(C)
+
+        mode = kwargs.pop("mode", "glyphs")
+        if mode == "glyphs":
+            args = X + U + [C]
+            if gdim == 3:
+                # 3d quiver plot works only since matplotlib 1.4
+                import matplotlib
+                if StrictVersion(matplotlib.__version__) < '1.4':
+                    cpp.warning('Matplotlib version %s does not support 3d '
+                                'quiver plot. Continuing without plotting...'
+                                % matplotlib.__version__)
+                    return
+
+                length = kwargs.pop("length", 0.1)
+                return ax.quiver(*args, length=length, **kwargs)
+            else:
+                return ax.quiver(*args, **kwargs)
+        elif mode == "displacement":
+            Xdef = [X[i] + U[i] for i in range(gdim)]
+            import matplotlib.tri as tri
+            if gdim == 2 and tdim == 2:
+                # FIXME: Not tested
+                triang = tri.Triangulation(Xdef[0], Xdef[1], mesh.cells())
+                shading = kwargs.pop("shading", "flat")
+                return ax.tripcolor(triang, C, shading=shading, **kwargs)
+            else:
+                # Return gracefully to make regression test pass without vtk
+                cpp.warning('Matplotlib plotting backend does not support '
+                            'displacement for %d in %d. Continuing without '
+                            'plotting...' % (tdim, gdim))
+                return
+
+def mplot_meshfunction(ax, obj, **kwargs):
+    mesh = obj.mesh()
+    tdim = mesh.topology().dim()
+    d = obj.dim()
+    if tdim == 2 and d == 2:
+        C = obj.array()
+        triang = mesh2triang(mesh)
+        assert not kwargs.pop("facecolors", None), "Not expecting 'facecolors' in kwargs"
+        return ax.tripcolor(triang, facecolors=C, **kwargs)
+    #elif tdim == 1 and d == 1:
+    #elif d == 0: # vertices
+    else:
+        # Return gracefully to make regression test pass without vtk
+        cpp.warning('Matplotlib plotting backend does not support mesh '
+                    'function of dim %d. Continuing without plotting...' % d)
+        return
+
+def mplot_dirichletbc(ax, obj, **kwargs):
+    raise AttributeError("Matplotlib plotting backend doesn't handle DirichletBC.")
+
+def _plot_matplotlib(obj, mesh, kwargs):
+    if isinstance(obj, (cpp.MultiMesh, cpp.MultiMeshFunction, cpp.MultiMeshDirichletBC)):
+        cpp.warning("Don't know how to plot type %s" % type(obj))
+        return
+
+    # Avoid importing pyplot until used
+    try:
+        import matplotlib.pyplot as plt
+    except:
+        print("*** Warning: matplotlib.pyplot not available, cannot plot")
+        return
+
+    gdim = mesh.geometry().dim()
+    if gdim == 3 or kwargs.get("mode") in ("warp",):
+        # Importing this toolkit has side effects enabling 3d support
+        from mpl_toolkits.mplot3d import axes3d
+        # Enabling the 3d toolbox requires some additional arguments
+        ax = plt.gca(projection='3d')
+    else:
+        ax = plt.gca()
+    ax.set_aspect('equal')
+
+    title = kwargs.pop("title", None)
+    if title is not None:
+        ax.set_title(title)
+
+    # Translate range_min/max kwargs supported by VTKPlotter
+    vmin = kwargs.pop("range_min", None)
+    vmax = kwargs.pop("range_max", None)
+    if vmin and not "vmin" in kwargs:
+        kwargs["vmin"] = vmin
+    if vmax and not "vmax" in kwargs:
+        kwargs["vmax"] = vmax
+
+    # Let's stays consistent and use mode='color' instead of 'surface'
+    if kwargs.get("mode") == "surface":
+        cpp.deprecation("plot kwarg mode='surface'", "2016.1",
+                        "Use mode='color' instead.")
+        kwargs["mode"] = "color"
+
+    # Drop unsupported kwargs and inform user
+    _unsupported_kwargs = ["interactive", "rescale", "wireframe"]
+    for kw in _unsupported_kwargs:
+        if kwargs.pop(kw, None):
+            cpp.warning("Matplotlib backend does not support '%s' kwarg yet. "
+                        "Ignoring it..." % kw)
+
+    if isinstance(obj, cpp.Function):
+        return mplot_function(ax, obj, **kwargs)
+    elif isinstance(obj, cpp.Expression):
+        return mplot_expression(ax, obj, mesh, **kwargs)
+    elif isinstance(obj, cpp.Mesh):
+        return mplot_mesh(ax, obj, **kwargs)
+    elif isinstance(obj, cpp.DirichletBC):
+        return mplot_dirichletbc(ax, obj, **kwargs)
+    elif isinstance(obj, _meshfunction_types):
+        return mplot_meshfunction(ax, obj, **kwargs)
+    else:
+        raise AttributeError('Failed to plot %s' % type(obj))
+
+
 # Compatibility with book
 def _VTKPlotter_write_ps(self, *args, **kwargs) :
-  print("*** Warning: VTKPlotter::write_ps() is not implemented -- use write_pdf instead")
+    print("*** Warning: VTKPlotter::write_ps() is not implemented -- use write_pdf instead")
+
+_objects_referenced_from_plot_windows = {}
+def _plot_cpp(object, mesh, kwargs):
+    # Convert kwargs to cpp format
+    p = cpp.Parameters()
+    for key in kwargs:
+        try:
+            p.add(key, kwargs[key])
+        except TypeError:
+            cpp.warning("Incompatible type for keyword argument \"%s\". Ignoring." % key)
+
+    if isinstance(object, cpp.Expression):
+        plot_object = cpp.plot(object, mesh, p)
+    elif isinstance(object, cpp.MultiMesh):
+        return cpp.io._plot_multimesh(object)
+    else:
+        plot_object = cpp.plot(object, p)
+
+    # Compatibility with book
+    plot_object.write_ps = _VTKPlotter_write_ps
+
+    # Avoid premature deletion of plotted objects if they go out of scope
+    # before the plot window is closed. The plotter itself is safe, since it's
+    # created in the plot() C++ function, not directly from Python. But the
+    # Python plotter proxy may disappear, so we can't store the references
+    # there.
+    global _objects_referenced_from_plot_windows
+    _objects_referenced_from_plot_windows[plot_object.key()] = (object, mesh, p)
+
+    return plot_object
 
 def plot(object, *args, **kwargs):
     """
@@ -42,8 +377,9 @@ def plot(object, *args, **kwargs):
             <dolfin.cpp.MeshFunction>`, a :py:class:`Function
             <dolfin.functions.function.Function>`, a :py:class:`Expression`
             <dolfin.cpp.Expression>, a :py:class:`DirichletBC`
-            <dolfin.cpp.DirichletBC> or a :py:class:`FiniteElement
-            <ufl.FiniteElement>`.
+            <dolfin.cpp.DirichletBC>, a :py:class:`FiniteElement
+            <ufl.FiniteElement>`, or a :py:class:`MultiMesh
+            <dolfin.cpp.MultiMesh>`.
 
     *Examples of usage*
         In the simplest case, to plot only e.g. a mesh, simply use
@@ -81,66 +417,62 @@ def plot(object, *args, **kwargs):
                  interactive = False,           # do not hold plot on screen
                  scalarbar = False,             # hide the color mapping bar
                  hardcopy_prefix = "myplot",    # default plotfile name
-                 scale = 2.0                    # scale the warping/glyphs
-                 title = "Fancy plot"           # Set your own title
+                 scale = 2.0,                   # scale the warping/glyphs
+                 title = "Fancy plot",          # set your own title
+                 backend = "vtk"                # choose plotting backend
                  )
 
     """
 
-    mesh = kwargs.get('mesh')
-
-    p = cpp.Parameters()
-    for key in kwargs:
-        # If there is a "mesh" kwarg it should not be added to the parameters
-        if key != "mesh":
-            try:
-                p.add(key, kwargs[key])
-            except TypeError:
-                cpp.warning("Incompatible type for keyword argument \"%s\". Ignoring." % key)
-
     # Plot element
     if isinstance(object, ufl.FiniteElementBase):
-        if os.environ.get("DOLFIN_NOPLOT", "0") != "0": return
+        if os.environ.get("DOLFIN_NOPLOT", "0") != "0":
+            return
         import ffc
         return ffc.plot(object, *args, **kwargs)
 
-    if mesh is None and len(args) == 1 and isinstance(args[0], cpp.Mesh):
-        mesh = args[0]
-
-    # Plot expression
-    if isinstance(object, cpp.Expression):
-        if mesh is None:
-            raise TypeError("expected a mesh when plotting an expression.")
-        return cpp.plot(object, mesh, p)
+    # Get mesh from explicit mesh kwarg, only positional arg, or via object
+    mesh = kwargs.pop('mesh', None)
+    if isinstance(object, cpp.Mesh):
+        if mesh is not None and mesh.id() != object.id():
+            cpp.dolfin_error("plotting.py",
+                             "plot mesh",
+                             "Got different mesh in plot object and keyword argument")
+        mesh = object
+    if mesh is None:
+        if isinstance(object, cpp.Function):
+            mesh = object.function_space().mesh()
+        elif hasattr(object, "mesh"):
+            mesh = object.mesh()
+
+    # Expressions do not carry their own mesh
+    if isinstance(object, cpp.Expression) and mesh is None:
+        cpp.dolfin_error("plotting.py",
+                         "plot expression",
+                         "Expecting a mesh as keyword argument")
 
     # Try to project if object is not a standard plottable type
-    if not isinstance(object, (cpp.Function, cpp.Expression, cpp.Mesh,
-        cpp.DirichletBC, cpp.MeshFunction, cpp.MeshFunctionBool,
-        cpp.MeshFunctionInt, cpp.MeshFunctionDouble,
-        cpp.MeshFunctionSizet, cpp.DirichletBC)):
-
+    if not isinstance(object, _plottable_types):
         from dolfin.fem.projection import project
         try:
             cpp.info("Object cannot be plotted directly, projecting to"\
-                    " piecewise linears.")
+                     " piecewise linears.")
             object = project(object, mesh=mesh)
+            mesh = object.function_space().mesh()
         except Exception as e:
-            msg = ("Don't know how to plot given object:\n  %s\n"\
-                    "and projection failed:\n  %s") % (str(object), str(e))
-            #raise RuntimeError(msg)
-            raise
-
-    plot_object = cpp.plot(object, p)
-    plot_object.write_ps = _VTKPlotter_write_ps
-
-    # Avoid premature deletion of plotted objects if they go out of scope
-    # before the plot window is closed. The plotter itself is safe, since it's
-    # created in the plot() C++ function, not directly from Python. But the
-    # Python plotter proxy may disappear, so we can't store the references
-    # there.
-    global _objects_referenced_from_plot_windows
-    _objects_referenced_from_plot_windows[plot_object.key()] = (object, mesh, p)
-
-    return plot_object
-
-_objects_referenced_from_plot_windows = {}
+            msg = "Don't know how to plot given object:\n  %s\n" \
+                  "and projection failed:\n  %s" % (str(object), str(e))
+            cpp.dolfin_error("plotting.py", "plot object", msg)
+
+    # Select backend
+    backend = kwargs.pop("backend", None) or cpp.parameters["plotting_backend"]
+    if backend == "vtk":
+        return _plot_cpp(object, mesh, kwargs)
+    elif backend == "matplotlib":
+        return _plot_matplotlib(object, mesh, kwargs)
+    elif backend == "none":
+        cpp.warning("Plotting backend set to 'none'. Plotting disabled.")
+        return
+    else:
+        cpp.dolfin_error("plotting.py", "plot object",
+                         "Unknown plotting backend '%s'" % backend)
diff --git a/site-packages/dolfin/common/time.py b/site-packages/dolfin/common/time.py
index f05b3ed..bcfa14f 100644
--- a/site-packages/dolfin/common/time.py
+++ b/site-packages/dolfin/common/time.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module provides a time class in Python. It is typically used for
 problems involving time stepping ."""
 
diff --git a/site-packages/dolfin/compilemodules/__init__.py b/site-packages/dolfin/compilemodules/__init__.py
index a96b267..7c31d9e 100644
--- a/site-packages/dolfin/compilemodules/__init__.py
+++ b/site-packages/dolfin/compilemodules/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """The compilemodules module of dolfin"""
 from dolfin.compilemodules import compilemodule
 from dolfin.compilemodules import expressions
diff --git a/site-packages/dolfin/compilemodules/compilemodule.py b/site-packages/dolfin/compilemodules/compilemodule.py
index 500579e..889e3cd 100644
--- a/site-packages/dolfin/compilemodules/compilemodule.py
+++ b/site-packages/dolfin/compilemodules/compilemodule.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module provides functionality to compile PyDOLFIN compatible
 extension modules."""
 
@@ -122,8 +123,21 @@ import_array();
 %%{
 #include <ufc.h>
 %%}
-%%include "swig/ufc_shared_ptr_classes.i"
-%%import(module="ufc") "ufc.h"
+%%shared_ptr(ufc::function)
+%%shared_ptr(ufc::dofmap)
+%%shared_ptr(ufc::finite_element)
+%%shared_ptr(ufc::function)
+%%shared_ptr(ufc::form)
+%%ignore ufc::integral;
+%%ignore ufc::cell_integral;
+%%ignore ufc::exterior_facet_integral;
+%%ignore ufc::interior_facet_integral;
+%%ignore ufc::vertex_integral;
+%%ignore ufc::custom_integral;
+%%ignore ufc::cutcell_integral;
+%%ignore ufc::interface_integral;
+%%ignore ufc::overlap_integral;
+%%include <ufc.h>
 
 // Local shared_ptr declarations
 %(shared_ptr_declarations)s
@@ -147,6 +161,9 @@ del tmp, get_swigversion
 
 """
 
+re_symbol = re.compile(r"(?:[a-zA-Z_]*::)*[\w\.]+")
+re_number = re.compile("[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?")
+
 def expression_to_code_fragments(expr, arguments, generic_function_members=None):
     "A help function which extract a dict with code snippets from an expression"
 
@@ -158,7 +175,7 @@ def expression_to_code_fragments(expr, arguments, generic_function_members=None)
 
     for i, c in enumerate(expr):
         # Find groups of connected alphanumeric letters
-        symbols = re.findall(r"(?:[a-zA-Z_]*::)*[\w\.]+", c)
+        symbols = re_symbol.findall(c)
         assert isinstance(symbols, list)
         variables.update(symbols)
         for sym in symbols:
@@ -181,16 +198,12 @@ def expression_to_code_fragments(expr, arguments, generic_function_members=None)
     variables.difference_update(_all_math)
 
     # Remove the numerals from the variables
-    numerals = [v for v in variables if v[0] in "0123456789"]
+    numerals = [v for v in variables if re_number.match(v)]
     variables.difference_update(numerals)
 
     # Remove bool literals
     variables.difference_update(["true", "false"])
 
-    # Remove any exponential representation
-    exponentials = [v for v in variables if bool(re.search("e[0-9,\-,\.,\+]+", v))]
-    variables.difference_update(exponentials+["e"])
-
     # Remove namespace-specified variables
     namespacevars = [v for v in variables if "::" in v]
     variables.difference_update(namespacevars)
diff --git a/site-packages/dolfin/compilemodules/expressions.py b/site-packages/dolfin/compilemodules/expressions.py
index cfd5301..0abe8a9 100644
--- a/site-packages/dolfin/compilemodules/expressions.py
+++ b/site-packages/dolfin/compilemodules/expressions.py
@@ -1,6 +1,7 @@
+# -*- coding: utf-8 -*-
 "This module provides functionality for compilation of strings as dolfin Expressions."
 
-# Copyright (C) 2008-2008 Martin Sandve Alnes
+# Copyright (C) 2008-2008 Martin Sandve Alnæs
 #
 # This file is part of DOLFIN.
 #
diff --git a/site-packages/dolfin/compilemodules/jit.py b/site-packages/dolfin/compilemodules/jit.py
index 140b4a4..f174faf 100644
--- a/site-packages/dolfin/compilemodules/jit.py
+++ b/site-packages/dolfin/compilemodules/jit.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module defines a jit function that wraps the jit function for
 the chosen form compiler."""
 
@@ -20,7 +21,7 @@ the chosen form compiler."""
 #
 # Modified by Anders Logg, 2008-2009.
 # Modified by Garth N. Wells, 2011.
-# Modified by Martin S. Alnes, 2014.
+# Modified by Martin Sandve Alnæs, 2014.
 
 from __future__ import print_function
 
@@ -64,7 +65,8 @@ def mpi_jit_decorator(local_jit, *args, **kwargs):
             return local_jit(*args, **kwargs)
 
         # Compile first on process 0
-        if MPI.rank(mpi_comm) == 0:
+        root = MPI.rank(mpi_comm) == 0
+        if root:
             output = local_jit(*args, **kwargs)
 
         # Wait for the first process to finish
@@ -72,7 +74,7 @@ def mpi_jit_decorator(local_jit, *args, **kwargs):
 
         # Then compile on all other processes (which may then just
         # read the cache)
-        if not MPI.rank(mpi_comm) == 0:
+        if not root:
             output = local_jit(*args,**kwargs)
 
         return output
@@ -80,49 +82,52 @@ def mpi_jit_decorator(local_jit, *args, **kwargs):
     # Return the decorated jit function
     return mpi_jit
 
+import ffc
+
 @mpi_jit_decorator
-def jit(form, form_compiler_parameters=None, mpi_comm=None):
-    """Just-in-time compile any provided form.
+def jit(ufl_object, form_compiler_parameters=None, mpi_comm=None):
+    """Just-in-time compile any provided UFL Form or FiniteElement using FFC.
 
-    It uses the jit function from the form compiler registered by
-    parameters["form_compiler"]["name"].
+    Default parameters from FFC are overridden by parameters["form_compiler"]
+    first and then the form_compiler_parameters argument to this function.
     """
-
-    # Check that form is not empty
-    if isinstance(form, ufl.Form):
-        if form.empty():
-            raise RuntimeError("Form is empty. Cannot pass to JIT compiler.")
-
-    # Import form compiler
-    form_compiler_name = cpp.parameters["form_compiler"]["name"]
-    try:
-        form_compiler = __import__(form_compiler_name)
-    except ImportError as message:
-        print(message)
-        warning("Could not import %s form compiler, falling back to FFC." \
-                % form_compiler_name)
-        try:
-            form_compiler = __import__("ffc")
-        except:
-            cpp.dolfin_error("jit.py",
-                             "perform just-in-time compilation of form",
-                             "Could not import FFC form compiler")
-
-    # Checks on form compiler interface
-    if not (hasattr(form_compiler, 'default_parameters')
-            and hasattr(form_compiler, 'jit')):
-        raise RuntimeError("Form compiler must implement the default_parameters and jit functions.")
-
-    # Prepare form compiler parameters
-    p = form_compiler.default_parameters()
-
-    # Set parameters from global DOLFIN parameter set
-    for key, value in six.iteritems(parameters["form_compiler"]):
-        p[key] = value
-
-    # Override with local parameters if any
-    if form_compiler_parameters:
-        p.update(form_compiler_parameters)
-
+    # Check that form is not empty (workaround for bug in UFL where
+    # bilinear form 0*u*v*dx becomes the functional 0*dx)
+    if isinstance(ufl_object, ufl.Form) and ufl_object.empty():
+        cpp.dolfin_error("jit.py",
+                         "perform just-in-time compilation of form",
+                         "Form is empty. Cannot pass to JIT compiler")
+
+    # Compatibility checks on ffc interface
+    if not (hasattr(ffc, 'default_parameters')
+            and hasattr(ffc, 'jit')
+            and hasattr(ffc, 'ufc_signature')):
+        cpp.dolfin_error("jit.py",
+                         "perform just-in-time compilation of form",
+                         "Form compiler must implement 'default_parameters()', "
+                         "'jit(ufl_object, parameters=None)' "
+                         "and 'ufc_signature()' functions")
+
+    # Check DOLFIN build time UFC matches currently loaded UFC
+    if cpp.__ufcsignature__ != ffc.ufc_signature():
+        cpp.dolfin_error("jit.py",
+                         "perform just-in-time compilation of form",
+                         "DOLFIN was not compiled against matching"
+                         "UFC from current FFC installation.")
+
+    # Prepare form compiler parameters with overrides from dolfin and kwargs
+    p = ffc.default_parameters()
+    p.update(parameters["form_compiler"])
+    p.update(form_compiler_parameters or {})
+    
     # Execute!
-    return form_compiler.jit(form, parameters=p)
+    result = ffc.jit(ufl_object, parameters=p)
+    if isinstance(ufl_object, ufl.Form):
+        compiled_form, module, prefix = result
+        compiled_form = cpp.make_ufc_form(compiled_form)
+        return compiled_form, module, prefix
+    elif isinstance(ufl_object, ufl.FiniteElementBase):
+        ufc_element, ufc_dofmap = result
+        ufc_element = cpp.make_ufc_finite_element(ufc_element)
+        ufc_dofmap = cpp.make_ufc_dofmap(ufc_dofmap)
+        return ufc_element, ufc_dofmap
diff --git a/site-packages/dolfin/compilemodules/subdomains.py b/site-packages/dolfin/compilemodules/subdomains.py
index 9d6c7e0..206428d 100644
--- a/site-packages/dolfin/compilemodules/subdomains.py
+++ b/site-packages/dolfin/compilemodules/subdomains.py
@@ -1,6 +1,7 @@
+# -*- coding: utf-8 -*-
 "This module provides functionality for compilation of strings as dolfin SubDomains."
 
-# Copyright (C) 2008-2008 Martin Sandve Alnes
+# Copyright (C) 2008-2008 Martin Sandve Alnæs
 #
 # This file is part of DOLFIN.
 #
@@ -77,10 +78,10 @@ def expression_to_subdomain(cpparg, classname):
     # Extract code fragments from the expr and defaults
     fragments, members = expression_to_code_fragments(\
         [cpparg], ["x", "on_boundary", "DOLFIN_EPS"])
-    
+
     # Generate code for inside()
     insidecode = "  return %s;" % cpparg
-    
+
     # Generate code for map()
     #mapcode = "..."
 
@@ -137,7 +138,7 @@ def CompiledSubDomain(cppcode, mpi_comm=None, **kwargs):
 
     if not isinstance(cppcode, str):
         raise TypeError("expected a 'str'")
-    
+
     if isinstance(cppcode, str) and "class" in cppcode and \
            "SubDomain" in cppcode:
         members = []
@@ -145,14 +146,14 @@ def CompiledSubDomain(cppcode, mpi_comm=None, **kwargs):
         code = cppcode
 
     else:
-        
+
         classname = "CompiledSubDomain" + hashlib.sha1(cppcode.encode(\
             "utf-8")).hexdigest()
         code, members = expression_to_subdomain(cppcode, classname)
-    
+
     SubDomainClass = compile_subdomain_code(code, classname, mpi_comm=mpi_comm)
-    
-    # Check passed default arguments 
+
+    # Check passed default arguments
     not_allowed = [n for n in dir(cpp.SubDomain) if n[0] !="_"]
     not_allowed += ["cppcode"]
 
@@ -162,14 +163,18 @@ def CompiledSubDomain(cppcode, mpi_comm=None, **kwargs):
             if member not in kwargs:
                 missing.append(member)
         missing = ", ".join("'%s'" % miss for miss in missing)
-        raise RuntimeError("expected a default value to all member "\
-                           "variables in the SubDomain. Missing: %s." % missing)
+        cpp.dolfin_error("subdomains.py",
+                         "compile C++ subdomain",
+                         "Expected a default value to all member "
+                         "variables in the SubDomain. Missing: %s." % missing)
 
     for name in list(kwargs.keys()):
         if name in not_allowed:
-            raise RuntimeError("Parameter name: '%s' is not allowed. It is "\
-                               "part of the interface of SubDomain" % name)
-            
+            cpp.dolfin_error("subdomains.py",
+                             "compile C++ subdomain",
+                             "Parameter name: '%s' is not allowed. It is "
+                             "part of the interface of SubDomain" % name)
+
         if not (all(isinstance(value, (int, float)) \
                     for value in list(kwargs.values()))):
             raise TypeError("expected default arguments for member variables "\
@@ -179,7 +184,7 @@ def CompiledSubDomain(cppcode, mpi_comm=None, **kwargs):
     SubDomainClass.cppcode = cppcode
 
     # Instantiate CompiledSubDomain
-    subdomain = SubDomainClass()    
+    subdomain = SubDomainClass()
 
     # Set default variables
     for member, value in list(kwargs.items()):
diff --git a/site-packages/dolfin/compilemodules/swigimportinfo.py b/site-packages/dolfin/compilemodules/swigimportinfo.py
index a156375..d15dddf 100644
--- a/site-packages/dolfin/compilemodules/swigimportinfo.py
+++ b/site-packages/dolfin/compilemodules/swigimportinfo.py
@@ -11,7 +11,7 @@ except ImportError:
     from dolfin_utils.ordereddict import OrderedDict
 
 # A list of shared_ptr declared classes in dolfin
-shared_ptr_classes = ['AdaptiveLinearVariationalSolver', 'AdaptiveNonlinearVariationalSolver', 'ErrorControl', 'Hierarchical<dolfin::ErrorControl>', 'GenericAdaptiveVariationalSolver', 'GoalFunctional', 'SpecialFacetFunction', 'TimeSeries', 'TimeSeriesHDF5', 'MeshDisplacement', 'Variable', 'Hierarchical<dolfin::Form>', 'GenericDofMap', 'DofMap', 'MultiMeshDofMap', 'Form', 'FiniteElement', 'BasisFunction', 'MultiStageScheme', 'Hierarchical<dolfin::LinearVariationalProblem>', 'Hierarchical [...]
+shared_ptr_classes = ['AdaptiveLinearVariationalSolver', 'AdaptiveNonlinearVariationalSolver', 'ErrorControl', 'Hierarchical<dolfin::ErrorControl>', 'GenericAdaptiveVariationalSolver', 'GoalFunctional', 'SpecialFacetFunction', 'TimeSeries', 'TimeSeriesHDF5', 'MeshDisplacement', 'Variable', 'Hierarchical<dolfin::Form>', 'GenericDofMap', 'DofMap', 'MultiMeshDofMap', 'Form', 'FiniteElement', 'BasisFunction', 'MultiStageScheme', 'Hierarchical<dolfin::LinearVariationalProblem>', 'Hierarchical [...]
 
 # An OrderedDict of all dolfin declared and its meta info
 dolfin_type_def = OrderedDict([\
@@ -24,8 +24,8 @@ dolfin_type_def = OrderedDict([\
 ('IndexSet', {'header': 'dolfin/common/IndexSet.h', 'submodule': 'common', 'derived': [], 'bases': [], 'module': 'common'}),
 ('Set', {'header': 'dolfin/common/Set.h', 'submodule': 'common', 'derived': [], 'bases': [], 'module': 'common'}),
 ('Timer', {'header': 'dolfin/common/Timer.h', 'submodule': 'common', 'derived': [], 'bases': [], 'module': 'common'}),
-('Variable', {'header': 'dolfin/common/Variable.h', 'submodule': 'common', 'derived': ['GenericDofMap', 'PETScVector', 'PETScLUSolver', 'EigenKrylovSolver', 'VTKPlotter', 'UnitIntervalMesh', 'GenericLinearOperator', 'FacetFunction', 'GenericTensor', 'FaceFunction', 'AdaptiveNonlinearVariationalSolver', 'UnitSquareMesh', 'BelosKrylovSolver', 'UnitHexMesh', 'XDMFFile', 'Scalar', 'SparsityPattern', 'MeshCoordinates', 'LinearVariationalSolver', 'LinearAlgebraObject', 'GenericSparsityPattern' [...]
-('Hierarchical', {'header': 'dolfin/common/Hierarchical.h', 'submodule': 'common', 'derived': ['UnitCubeMesh', 'BoundaryMesh', 'SubSpace', 'UnitQuadMesh', 'LinearVariationalProblem', 'GoalFunctional', 'ErrorControl', 'VertexFunction', 'DirichletBC', 'EdgeFunction', 'Function', 'Form', 'UnitIntervalMesh', 'UnitTriangleMesh', 'CellFunction', 'Mesh', 'BoxMesh', 'IntervalMesh', 'SubMesh', 'MeshFunction', 'FacetFunction', 'UnitTetrahedronMesh', 'FaceFunction', 'UnitSquareMesh', 'UnitHexMesh', [...]
+('Variable', {'header': 'dolfin/common/Variable.h', 'submodule': 'common', 'derived': ['SphericalShellMesh', 'GenericDofMap', 'PETScVector', 'PETScLUSolver', 'EigenKrylovSolver', 'VTKPlotter', 'UnitIntervalMesh', 'GenericLinearOperator', 'FacetFunction', 'GenericTensor', 'FaceFunction', 'AdaptiveNonlinearVariationalSolver', 'UnitSquareMesh', 'BelosKrylovSolver', 'UnitHexMesh', 'XDMFFile', 'Scalar', 'LinearOperator', 'MeshCoordinates', 'Ifpack2Preconditioner', 'LinearVariationalSolver', ' [...]
+('Hierarchical', {'header': 'dolfin/common/Hierarchical.h', 'submodule': 'common', 'derived': ['SphericalShellMesh', 'UnitCubeMesh', 'BoundaryMesh', 'UnitQuadMesh', 'LinearVariationalProblem', 'GoalFunctional', 'ErrorControl', 'VertexFunction', 'DirichletBC', 'EdgeFunction', 'Function', 'Form', 'UnitIntervalMesh', 'UnitTriangleMesh', 'CellFunction', 'Mesh', 'BoxMesh', 'IntervalMesh', 'SubMesh', 'MeshFunction', 'FacetFunction', 'UnitTetrahedronMesh', 'FaceFunction', 'UnitSquareMesh', 'Uni [...]
 ('MPI_Comm', {'header': 'dolfin/common/MPI.h', 'submodule': 'common', 'derived': [], 'bases': [], 'module': 'common'}),
 ('MPI', {'header': 'dolfin/common/MPI.h', 'submodule': 'common', 'derived': [], 'bases': [], 'module': 'common'}),
 ('MPIInfo', {'header': 'dolfin/common/MPI.h', 'submodule': 'common', 'derived': [], 'bases': [], 'module': 'common'}),
@@ -46,7 +46,7 @@ dolfin_type_def = OrderedDict([\
 ('MeshGeometry', {'header': 'dolfin/mesh/MeshGeometry.h', 'submodule': 'mesh', 'derived': [], 'bases': [], 'module': 'mesh'}),
 ('MeshDomains', {'header': 'dolfin/mesh/MeshDomains.h', 'submodule': 'mesh', 'derived': [], 'bases': [], 'module': 'mesh'}),
 ('MeshData', {'header': 'dolfin/mesh/MeshData.h', 'submodule': 'mesh', 'derived': [], 'bases': ['Variable'], 'module': 'mesh'}),
-('Mesh', {'header': 'dolfin/mesh/Mesh.h', 'submodule': 'mesh', 'derived': ['UnitCubeMesh', 'BoundaryMesh', 'UnitTetrahedronMesh', 'UnitTriangleMesh', 'UnitQuadMesh', 'UnitSquareMesh', 'UnitHexMesh', 'BoxMesh', 'IntervalMesh', 'UnitIntervalMesh', 'SubMesh', 'RectangleMesh'], 'bases': ['Variable', 'Hierarchical'], 'module': 'mesh'}),
+('Mesh', {'header': 'dolfin/mesh/Mesh.h', 'submodule': 'mesh', 'derived': ['SubMesh', 'SphericalShellMesh', 'UnitCubeMesh', 'BoundaryMesh', 'UnitTetrahedronMesh', 'UnitTriangleMesh', 'UnitQuadMesh', 'UnitSquareMesh', 'UnitHexMesh', 'BoxMesh', 'IntervalMesh', 'UnitIntervalMesh', 'UnitDiscMesh', 'RectangleMesh'], 'bases': ['Variable', 'Hierarchical'], 'module': 'mesh'}),
 ('MeshEntity', {'header': 'dolfin/mesh/MeshEntity.h', 'submodule': 'mesh', 'derived': ['Cell', 'Vertex', 'Face', 'Facet', 'Edge', 'FacetCell'], 'bases': [], 'module': 'mesh'}),
 ('MeshEntityIterator', {'header': 'dolfin/mesh/MeshEntityIterator.h', 'submodule': 'mesh', 'derived': [], 'bases': [], 'module': 'mesh'}),
 ('MeshEntityIteratorBase', {'header': 'dolfin/mesh/MeshEntityIteratorBase.h', 'submodule': 'mesh', 'derived': [], 'bases': [], 'module': 'mesh'}),
@@ -79,7 +79,6 @@ dolfin_type_def = OrderedDict([\
 ('LocalMeshData', {'header': 'dolfin/mesh/LocalMeshData.h', 'submodule': 'mesh', 'derived': [], 'bases': ['Variable'], 'module': 'mesh'}),
 ('SubDomain', {'header': 'dolfin/mesh/SubDomain.h', 'submodule': 'mesh', 'derived': ['DomainBoundary'], 'bases': [], 'module': 'mesh'}),
 ('SubMesh', {'header': 'dolfin/mesh/SubMesh.h', 'submodule': 'mesh', 'derived': [], 'bases': ['Variable', 'Mesh', 'Hierarchical'], 'module': 'mesh'}),
-('Restriction', {'header': 'dolfin/mesh/Restriction.h', 'submodule': 'mesh', 'derived': [], 'bases': [], 'module': 'mesh'}),
 ('DomainBoundary', {'header': 'dolfin/mesh/DomainBoundary.h', 'submodule': 'mesh', 'derived': [], 'bases': ['SubDomain'], 'module': 'mesh'}),
 ('BoundaryMesh', {'header': 'dolfin/mesh/BoundaryMesh.h', 'submodule': 'mesh', 'derived': [], 'bases': ['Variable', 'Mesh', 'Hierarchical'], 'module': 'mesh'}),
 ('PeriodicBoundaryComputation', {'header': 'dolfin/mesh/PeriodicBoundaryComputation.h', 'submodule': 'mesh', 'derived': [], 'bases': [], 'module': 'mesh'}),
@@ -98,6 +97,8 @@ dolfin_type_def = OrderedDict([\
 ('UnitSquareMesh', {'header': 'dolfin/generation/UnitSquareMesh.h', 'submodule': 'generation', 'derived': [], 'bases': ['Variable', 'RectangleMesh', 'Mesh', 'Hierarchical'], 'module': 'mesh'}),
 ('UnitQuadMesh', {'header': 'dolfin/generation/UnitQuadMesh.h', 'submodule': 'generation', 'derived': [], 'bases': ['Variable', 'Mesh', 'Hierarchical'], 'module': 'mesh'}),
 ('UnitHexMesh', {'header': 'dolfin/generation/UnitHexMesh.h', 'submodule': 'generation', 'derived': [], 'bases': ['Variable', 'Mesh', 'Hierarchical'], 'module': 'mesh'}),
+('UnitDiscMesh', {'header': 'dolfin/generation/UnitDiscMesh.h', 'submodule': 'generation', 'derived': [], 'bases': ['Variable', 'Mesh', 'Hierarchical'], 'module': 'mesh'}),
+('SphericalShellMesh', {'header': 'dolfin/generation/SphericalShellMesh.h', 'submodule': 'generation', 'derived': [], 'bases': ['Variable', 'Mesh', 'Hierarchical'], 'module': 'mesh'}),
 ('Point', {'header': 'dolfin/geometry/Point.h', 'submodule': 'geometry', 'derived': [], 'bases': [], 'module': 'mesh'}),
 ('BoundingBoxTree', {'header': 'dolfin/geometry/BoundingBoxTree.h', 'submodule': 'geometry', 'derived': [], 'bases': [], 'module': 'mesh'}),
 ('GenericBoundingBoxTree', {'header': 'dolfin/geometry/GenericBoundingBoxTree.h', 'submodule': 'geometry', 'derived': ['BoundingBoxTree3D'], 'bases': [], 'module': 'mesh'}),
@@ -109,44 +110,43 @@ dolfin_type_def = OrderedDict([\
 ('BoostGraphOrdering', {'header': 'dolfin/graph/BoostGraphOrdering.h', 'submodule': 'graph', 'derived': [], 'bases': [], 'module': 'mesh'}),
 ('SCOTCH', {'header': 'dolfin/graph/SCOTCH.h', 'submodule': 'graph', 'derived': [], 'bases': [], 'module': 'mesh'}),
 ('E', {'header': 'dolfin/la/LinearAlgebraObject.h', 'submodule': 'la', 'derived': [], 'bases': [], 'module': 'la'}),
-('LinearAlgebraObject', {'header': 'dolfin/la/LinearAlgebraObject.h', 'submodule': 'la', 'derived': ['GenericVector', 'Matrix', 'GenericMatrix', 'EigenMatrix', 'GenericTensor', 'LinearOperator', 'PETScMatrix', 'PETScVector', 'STLMatrix', 'Scalar', 'Vector', 'TpetraVector', 'TpetraMatrix', 'GenericLinearOperator', 'EigenVector', 'PETScLinearOperator'], 'bases': ['Variable'], 'module': 'la'}),
-('GenericLinearOperator', {'header': 'dolfin/la/GenericLinearOperator.h', 'submodule': 'la', 'derived': ['Matrix', 'STLMatrix', 'EigenMatrix', 'PETScMatrix', 'GenericMatrix', 'LinearOperator', 'TpetraMatrix', 'PETScLinearOperator'], 'bases': ['Variable', 'LinearAlgebraObject'], 'module': 'la'}),
-('GenericTensor', {'header': 'dolfin/la/GenericTensor.h', 'submodule': 'la', 'derived': ['GenericVector', 'Matrix', 'STLMatrix', 'EigenMatrix', 'PETScMatrix', 'PETScVector', 'GenericMatrix', 'Scalar', 'Vector', 'TpetraVector', 'TpetraMatrix', 'EigenVector'], 'bases': ['Variable', 'LinearAlgebraObject'], 'module': 'la'}),
-('GenericMatrix', {'header': 'dolfin/la/GenericMatrix.h', 'submodule': 'la', 'derived': ['EigenMatrix', 'STLMatrix', 'TpetraMatrix', 'PETScMatrix', 'Matrix'], 'bases': ['Variable', 'GenericTensor', 'LinearAlgebraObject', 'GenericLinearOperator'], 'module': 'la'}),
-('GenericSparsityPattern', {'header': 'dolfin/la/GenericSparsityPattern.h', 'submodule': 'la', 'derived': ['SparsityPattern'], 'bases': ['Variable'], 'module': 'la'}),
+('LinearAlgebraObject', {'header': 'dolfin/la/LinearAlgebraObject.h', 'submodule': 'la', 'derived': ['GenericVector', 'Matrix', 'EigenMatrix', 'GenericTensor', 'LinearOperator', 'PETScMatrix', 'PETScVector', 'GenericMatrix', 'Scalar', 'Vector', 'TpetraVector', 'TpetraMatrix', 'GenericLinearOperator', 'EigenVector', 'PETScLinearOperator'], 'bases': ['Variable'], 'module': 'la'}),
+('GenericLinearOperator', {'header': 'dolfin/la/GenericLinearOperator.h', 'submodule': 'la', 'derived': ['PETScLinearOperator', 'EigenMatrix', 'PETScMatrix', 'GenericMatrix', 'LinearOperator', 'TpetraMatrix', 'Matrix'], 'bases': ['Variable', 'LinearAlgebraObject'], 'module': 'la'}),
+('GenericTensor', {'header': 'dolfin/la/GenericTensor.h', 'submodule': 'la', 'derived': ['GenericVector', 'Matrix', 'EigenMatrix', 'PETScMatrix', 'PETScVector', 'GenericMatrix', 'Scalar', 'Vector', 'TpetraVector', 'TpetraMatrix', 'EigenVector'], 'bases': ['Variable', 'LinearAlgebraObject'], 'module': 'la'}),
+('GenericMatrix', {'header': 'dolfin/la/GenericMatrix.h', 'submodule': 'la', 'derived': ['EigenMatrix', 'TpetraMatrix', 'PETScMatrix', 'Matrix'], 'bases': ['Variable', 'GenericTensor', 'LinearAlgebraObject', 'GenericLinearOperator'], 'module': 'la'}),
 ('GenericVector', {'header': 'dolfin/la/GenericVector.h', 'submodule': 'la', 'derived': ['Vector', 'TpetraVector', 'EigenVector', 'PETScVector'], 'bases': ['Variable', 'GenericTensor', 'LinearAlgebraObject'], 'module': 'la'}),
 ('VectorSpaceBasis', {'header': 'dolfin/la/VectorSpaceBasis.h', 'submodule': 'la', 'derived': [], 'bases': [], 'module': 'la'}),
 ('GenericLinearSolver', {'header': 'dolfin/la/GenericLinearSolver.h', 'submodule': 'la', 'derived': ['GenericLUSolver', 'LinearSolver', 'EigenKrylovSolver', 'PETScKrylovSolver', 'PETScLUSolver', 'EigenLUSolver', 'LUSolver', 'BelosKrylovSolver', 'KrylovSolver'], 'bases': ['Variable'], 'module': 'la'}),
 ('GenericLUSolver', {'header': 'dolfin/la/GenericLUSolver.h', 'submodule': 'la', 'derived': ['PETScLUSolver', 'EigenLUSolver', 'LUSolver'], 'bases': ['Variable', 'GenericLinearSolver'], 'module': 'la'}),
-('GenericPreconditioner', {'header': 'dolfin/la/GenericPreconditioner.h', 'submodule': 'la', 'derived': ['PETScPreconditioner'], 'bases': [], 'module': 'la'}),
 ('PETScOptions', {'header': 'dolfin/la/PETScOptions.h', 'submodule': 'la', 'derived': [], 'bases': [], 'module': 'la'}),
 ('PETScObject', {'header': 'dolfin/la/PETScObject.h', 'submodule': 'la', 'derived': ['PETScUserPreconditioner', 'PETScLinearOperator', 'PETScPreconditioner', 'PETScMatrix', 'PETScKrylovSolver', 'PETScVector', 'PETScLUSolver', 'PETScSNESSolver', 'PETScTAOSolver', 'PETScBaseMatrix', 'TAOLinearBoundSolver', 'SLEPcEigenSolver'], 'bases': [], 'module': 'la'}),
 ('PETScBaseMatrix', {'header': 'dolfin/la/PETScBaseMatrix.h', 'submodule': 'la', 'derived': ['PETScMatrix', 'PETScLinearOperator'], 'bases': ['Variable', 'PETScObject'], 'module': 'la'}),
 ('EigenMatrix', {'header': 'dolfin/la/EigenMatrix.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericMatrix', 'LinearAlgebraObject', 'GenericLinearOperator', 'GenericTensor'], 'module': 'la'}),
 ('PETScMatrix', {'header': 'dolfin/la/PETScMatrix.h', 'submodule': 'la', 'derived': [], 'bases': ['LinearAlgebraObject', 'GenericTensor', 'GenericLinearOperator', 'PETScObject', 'GenericMatrix', 'Variable', 'PETScBaseMatrix'], 'module': 'la'}),
 ('PETScLinearOperator', {'header': 'dolfin/la/PETScLinearOperator.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'PETScBaseMatrix', 'LinearAlgebraObject', 'GenericLinearOperator', 'PETScObject'], 'module': 'la'}),
-('PETScPreconditioner', {'header': 'dolfin/la/PETScPreconditioner.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericPreconditioner', 'PETScObject'], 'module': 'la'}),
+('PETScPreconditioner', {'header': 'dolfin/la/PETScPreconditioner.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'PETScObject'], 'module': 'la'}),
 ('TpetraMatrix', {'header': 'dolfin/la/TpetraMatrix.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericMatrix', 'LinearAlgebraObject', 'GenericLinearOperator', 'GenericTensor'], 'module': 'la'}),
 ('EigenKrylovSolver', {'header': 'dolfin/la/EigenKrylovSolver.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericLinearSolver'], 'module': 'la'}),
 ('EigenLUSolver', {'header': 'dolfin/la/EigenLUSolver.h', 'submodule': 'la', 'derived': [], 'bases': ['GenericLUSolver', 'Variable', 'GenericLinearSolver'], 'module': 'la'}),
 ('PETScKrylovSolver', {'header': 'dolfin/la/PETScKrylovSolver.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericLinearSolver', 'PETScObject'], 'module': 'la'}),
 ('PETScLUSolver', {'header': 'dolfin/la/PETScLUSolver.h', 'submodule': 'la', 'derived': [], 'bases': ['GenericLUSolver', 'Variable', 'GenericLinearSolver', 'PETScObject'], 'module': 'la'}),
 ('BelosKrylovSolver', {'header': 'dolfin/la/BelosKrylovSolver.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericLinearSolver'], 'module': 'la'}),
-('MUMPSLUSolver', {'header': 'dolfin/la/MUMPSLUSolver.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable'], 'module': 'la'}),
-('PaStiXLUSolver', {'header': 'dolfin/la/PaStiXLUSolver.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable'], 'module': 'la'}),
-('STLMatrix', {'header': 'dolfin/la/STLMatrix.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericMatrix', 'LinearAlgebraObject', 'GenericLinearOperator', 'GenericTensor'], 'module': 'la'}),
+('TrilinosPreconditioner', {'header': 'dolfin/la/TrilinosPreconditioner.h', 'submodule': 'la', 'derived': ['Ifpack2Preconditioner', 'MueluPreconditioner'], 'bases': [], 'module': 'la'}),
+('MueluPreconditioner', {'header': 'dolfin/la/MueluPreconditioner.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'TrilinosPreconditioner'], 'module': 'la'}),
+('Ifpack2Preconditioner', {'header': 'dolfin/la/Ifpack2Preconditioner.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'TrilinosPreconditioner'], 'module': 'la'}),
 ('CoordinateMatrix', {'header': 'dolfin/la/CoordinateMatrix.h', 'submodule': 'la', 'derived': [], 'bases': [], 'module': 'la'}),
 ('EigenVector', {'header': 'dolfin/la/EigenVector.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericTensor', 'GenericVector', 'LinearAlgebraObject'], 'module': 'la'}),
 ('PETScVector', {'header': 'dolfin/la/PETScVector.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericTensor', 'GenericVector', 'LinearAlgebraObject', 'PETScObject'], 'module': 'la'}),
 ('TpetraVector', {'header': 'dolfin/la/TpetraVector.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericTensor', 'GenericVector', 'LinearAlgebraObject'], 'module': 'la'}),
 ('TensorLayout', {'header': 'dolfin/la/TensorLayout.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable'], 'module': 'la'}),
-('SparsityPattern', {'header': 'dolfin/la/SparsityPattern.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericSparsityPattern'], 'module': 'la'}),
-('GenericLinearAlgebraFactory', {'header': 'dolfin/la/GenericLinearAlgebraFactory.h', 'submodule': 'la', 'derived': ['DefaultFactory', 'PETScFactory', 'EigenFactory', 'STLFactory'], 'bases': [], 'module': 'la'}),
+('SparsityPattern', {'header': 'dolfin/la/SparsityPattern.h', 'submodule': 'la', 'derived': [], 'bases': [], 'module': 'la'}),
+('IndexMap', {'header': 'dolfin/la/IndexMap.h', 'submodule': 'la', 'derived': [], 'bases': [], 'module': 'la'}),
+('GenericLinearAlgebraFactory', {'header': 'dolfin/la/GenericLinearAlgebraFactory.h', 'submodule': 'la', 'derived': ['DefaultFactory', 'TpetraFactory', 'PETScFactory', 'EigenFactory'], 'bases': [], 'module': 'la'}),
 ('DefaultFactory', {'header': 'dolfin/la/DefaultFactory.h', 'submodule': 'la', 'derived': [], 'bases': ['GenericLinearAlgebraFactory'], 'module': 'la'}),
 ('EigenFactory', {'header': 'dolfin/la/EigenFactory.h', 'submodule': 'la', 'derived': [], 'bases': ['GenericLinearAlgebraFactory'], 'module': 'la'}),
 ('PETScUserPreconditioner', {'header': 'dolfin/la/PETScUserPreconditioner.h', 'submodule': 'la', 'derived': [], 'bases': ['PETScObject'], 'module': 'la'}),
 ('PETScFactory', {'header': 'dolfin/la/PETScFactory.h', 'submodule': 'la', 'derived': [], 'bases': ['GenericLinearAlgebraFactory'], 'module': 'la'}),
-('STLFactory', {'header': 'dolfin/la/STLFactory.h', 'submodule': 'la', 'derived': [], 'bases': ['GenericLinearAlgebraFactory'], 'module': 'la'}),
+('TpetraFactory', {'header': 'dolfin/la/TpetraFactory.h', 'submodule': 'la', 'derived': [], 'bases': ['GenericLinearAlgebraFactory'], 'module': 'la'}),
 ('SLEPcEigenSolver', {'header': 'dolfin/la/SLEPcEigenSolver.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'PETScObject'], 'module': 'la'}),
 ('Vector', {'header': 'dolfin/la/Vector.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericTensor', 'GenericVector', 'LinearAlgebraObject'], 'module': 'la'}),
 ('Matrix', {'header': 'dolfin/la/Matrix.h', 'submodule': 'la', 'derived': [], 'bases': ['Variable', 'GenericMatrix', 'LinearAlgebraObject', 'GenericLinearOperator', 'GenericTensor'], 'module': 'la'}),
@@ -167,8 +167,7 @@ dolfin_type_def = OrderedDict([\
 ('Expression', {'header': 'dolfin/function/Expression.h', 'submodule': 'function', 'derived': ['MeshDisplacement', 'FacetArea', 'Constant', 'SpecialFacetFunction', 'MeshCoordinates'], 'bases': ['Variable', 'ufc::function', 'GenericFunction'], 'module': 'function'}),
 ('FunctionAXPY', {'header': 'dolfin/function/FunctionAXPY.h', 'submodule': 'function', 'derived': [], 'bases': [], 'module': 'function'}),
 ('Function', {'header': 'dolfin/function/Function.h', 'submodule': 'function', 'derived': [], 'bases': ['Variable', 'ufc::function', 'Hierarchical', 'GenericFunction'], 'module': 'function'}),
-('FunctionSpace', {'header': 'dolfin/function/FunctionSpace.h', 'submodule': 'function', 'derived': ['SubSpace'], 'bases': ['Variable', 'Hierarchical'], 'module': 'function'}),
-('SubSpace', {'header': 'dolfin/function/SubSpace.h', 'submodule': 'function', 'derived': [], 'bases': ['Variable', 'Hierarchical', 'FunctionSpace'], 'module': 'function'}),
+('FunctionSpace', {'header': 'dolfin/function/FunctionSpace.h', 'submodule': 'function', 'derived': [], 'bases': ['Variable', 'Hierarchical'], 'module': 'function'}),
 ('Constant', {'header': 'dolfin/function/Constant.h', 'submodule': 'function', 'derived': [], 'bases': ['Variable', 'ufc::function', 'Expression', 'GenericFunction'], 'module': 'function'}),
 ('FacetArea', {'header': 'dolfin/function/SpecialFunctions.h', 'submodule': 'function', 'derived': [], 'bases': ['Variable', 'ufc::function', 'Expression', 'GenericFunction'], 'module': 'function'}),
 ('MeshCoordinates', {'header': 'dolfin/function/SpecialFunctions.h', 'submodule': 'function', 'derived': [], 'bases': ['Variable', 'ufc::function', 'Expression', 'GenericFunction'], 'module': 'function'}),
@@ -178,7 +177,6 @@ dolfin_type_def = OrderedDict([\
 ('MultiMeshSubSpace', {'header': 'dolfin/function/MultiMeshSubSpace.h', 'submodule': 'function', 'derived': [], 'bases': ['MultiMeshFunctionSpace', 'Variable'], 'module': 'function'}),
 ('FunctionAssigner', {'header': 'dolfin/function/FunctionAssigner.h', 'submodule': 'function', 'derived': [], 'bases': [], 'module': 'function'}),
 ('LagrangeInterpolator', {'header': 'dolfin/function/LagrangeInterpolator.h', 'submodule': 'function', 'derived': [], 'bases': [], 'module': 'function'}),
-('lt_coordinate', {'header': 'dolfin/function/LagrangeInterpolator.h', 'submodule': 'function', 'derived': [], 'bases': [], 'module': 'function'}),
 ('Lagrange', {'header': 'dolfin/math/Lagrange.h', 'submodule': 'math', 'derived': [], 'bases': ['Variable'], 'module': 'function'}),
 ('Legendre', {'header': 'dolfin/math/Legendre.h', 'submodule': 'math', 'derived': [], 'bases': [], 'module': 'function'}),
 ('ALE', {'header': 'dolfin/ale/ALE.h', 'submodule': 'ale', 'derived': [], 'bases': [], 'module': 'function'}),
@@ -188,8 +186,10 @@ dolfin_type_def = OrderedDict([\
 ('Equation', {'header': 'dolfin/fem/Equation.h', 'submodule': 'fem', 'derived': [], 'bases': [], 'module': 'fem'}),
 ('FiniteElement', {'header': 'dolfin/fem/FiniteElement.h', 'submodule': 'fem', 'derived': [], 'bases': [], 'module': 'fem'}),
 ('BasisFunction', {'header': 'dolfin/fem/BasisFunction.h', 'submodule': 'fem', 'derived': [], 'bases': ['ufc::function'], 'module': 'fem'}),
+('DiscreteOperators', {'header': 'dolfin/fem/DiscreteOperators.h', 'submodule': 'fem', 'derived': [], 'bases': [], 'module': 'fem'}),
 ('DirichletBC', {'header': 'dolfin/fem/DirichletBC.h', 'submodule': 'fem', 'derived': [], 'bases': ['Variable', 'Hierarchical'], 'module': 'fem'}),
 ('PointSource', {'header': 'dolfin/fem/PointSource.h', 'submodule': 'fem', 'derived': [], 'bases': [], 'module': 'fem'}),
+('LocalAssembler', {'header': 'dolfin/fem/LocalAssembler.h', 'submodule': 'fem', 'derived': [], 'bases': [], 'module': 'fem'}),
 ('LocalSolver', {'header': 'dolfin/fem/LocalSolver.h', 'submodule': 'fem', 'derived': [], 'bases': [], 'module': 'fem'}),
 ('Form', {'header': 'dolfin/fem/Form.h', 'submodule': 'fem', 'derived': ['GoalFunctional'], 'bases': ['Hierarchical'], 'module': 'fem'}),
 ('AssemblerBase', {'header': 'dolfin/fem/AssemblerBase.h', 'submodule': 'fem', 'derived': ['SystemAssembler', 'MultiMeshAssembler', 'Assembler', 'OpenMpAssembler'], 'bases': [], 'module': 'fem'}),
@@ -214,14 +214,16 @@ dolfin_type_def = OrderedDict([\
 ('GoalFunctional', {'header': 'dolfin/adaptivity/GoalFunctional.h', 'submodule': 'adaptivity', 'derived': [], 'bases': ['Hierarchical', 'Form'], 'module': 'fem'}),
 ('ErrorControl', {'header': 'dolfin/adaptivity/ErrorControl.h', 'submodule': 'adaptivity', 'derived': [], 'bases': ['Variable', 'Hierarchical'], 'module': 'fem'}),
 ('Extrapolation', {'header': 'dolfin/adaptivity/Extrapolation.h', 'submodule': 'adaptivity', 'derived': [], 'bases': [], 'module': 'fem'}),
-('LocalAssembler', {'header': 'dolfin/adaptivity/LocalAssembler.h', 'submodule': 'adaptivity', 'derived': [], 'bases': [], 'module': 'fem'}),
 ('TimeSeries', {'header': 'dolfin/adaptivity/TimeSeries.h', 'submodule': 'adaptivity', 'derived': [], 'bases': ['Variable'], 'module': 'fem'}),
 ('VTKPlotter', {'header': 'dolfin/plot/VTKPlotter.h', 'submodule': 'plot', 'derived': [], 'bases': ['Variable'], 'module': 'io'}),
-('GenericFile', {'header': 'dolfin/io/GenericFile.h', 'submodule': 'io', 'derived': ['XDMFFile'], 'bases': [], 'module': 'io'}),
+('GenericFile', {'header': 'dolfin/io/GenericFile.h', 'submodule': 'io', 'derived': [], 'bases': [], 'module': 'io'}),
 ('File', {'header': 'dolfin/io/File.h', 'submodule': 'io', 'derived': [], 'bases': [], 'module': 'io'}),
-('XDMFFile', {'header': 'dolfin/io/XDMFFile.h', 'submodule': 'io', 'derived': [], 'bases': ['Variable', 'GenericFile'], 'module': 'io'}),
+('hid_t', {'header': 'dolfin/io/XDMFFile.h', 'submodule': 'io', 'derived': [], 'bases': [], 'module': 'io'}),
+('XDMFFile', {'header': 'dolfin/io/XDMFFile.h', 'submodule': 'io', 'derived': [], 'bases': ['Variable'], 'module': 'io'}),
 ('HDF5File', {'header': 'dolfin/io/HDF5File.h', 'submodule': 'io', 'derived': [], 'bases': ['Variable'], 'module': 'io'}),
-('HDF5Attribute', {'header': 'dolfin/io/HDF5Attribute.h', 'submodule': 'io', 'derived': [], 'bases': [], 'module': 'io'}),])
+('HDF5Attribute', {'header': 'dolfin/io/HDF5Attribute.h', 'submodule': 'io', 'derived': [], 'bases': [], 'module': 'io'}),
+('X3DOM', {'header': 'dolfin/io/X3DOM.h', 'submodule': 'io', 'derived': [], 'bases': [], 'module': 'io'}),
+('X3DOMParameters', {'header': 'dolfin/io/X3DOM.h', 'submodule': 'io', 'derived': [], 'bases': [], 'module': 'io'}),])
 
 # A map between modules and its submodules
 module_to_submodules = OrderedDict([\
@@ -237,18 +239,18 @@ submodule_info = OrderedDict([\
 ('common', {'headers': ['dolfin/common/init.h', 'dolfin/common/defines.h', 'dolfin/common/version.h', 'dolfin/common/types.h', 'dolfin/common/constants.h', 'dolfin/common/timing.h', 'dolfin/common/Array.h', 'dolfin/common/ArrayView.h', 'dolfin/common/IndexSet.h', 'dolfin/common/Set.h', 'dolfin/common/Timer.h', 'dolfin/common/Variable.h', 'dolfin/common/Hierarchical.h', 'dolfin/common/MPI.h', 'dolfin/common/SubSystemsManager.h'], 'has_post': True, 'module': 'common', 'has_pre': True}),
 ('parameter', {'headers': ['dolfin/parameter/Parameter.h', 'dolfin/parameter/Parameters.h', 'dolfin/parameter/GlobalParameters.h'], 'has_post': True, 'module': 'common', 'has_pre': True}),
 ('log', {'headers': ['dolfin/log/log.h', 'dolfin/log/Event.h', 'dolfin/log/Progress.h', 'dolfin/log/Table.h', 'dolfin/log/LogLevel.h'], 'has_post': True, 'module': 'common', 'has_pre': True}),
-('mesh', {'headers': ['dolfin/mesh/CellType.h', 'dolfin/mesh/MeshTopology.h', 'dolfin/mesh/MeshGeometry.h', 'dolfin/mesh/MeshDomains.h', 'dolfin/mesh/MeshData.h', 'dolfin/mesh/Mesh.h', 'dolfin/mesh/MeshEntity.h', 'dolfin/mesh/MeshEntityIterator.h', 'dolfin/mesh/MeshEntityIteratorBase.h', 'dolfin/mesh/SubsetIterator.h', 'dolfin/mesh/Vertex.h', 'dolfin/mesh/Edge.h', 'dolfin/mesh/Face.h', 'dolfin/mesh/Facet.h', 'dolfin/mesh/Cell.h', 'dolfin/mesh/FacetCell.h', 'dolfin/mesh/MeshConnectivity.h [...]
-('generation', {'headers': ['dolfin/generation/BoxMesh.h', 'dolfin/generation/IntervalMesh.h', 'dolfin/generation/RectangleMesh.h', 'dolfin/generation/UnitTetrahedronMesh.h', 'dolfin/generation/UnitCubeMesh.h', 'dolfin/generation/UnitIntervalMesh.h', 'dolfin/generation/UnitTriangleMesh.h', 'dolfin/generation/UnitSquareMesh.h', 'dolfin/generation/UnitQuadMesh.h', 'dolfin/generation/UnitHexMesh.h'], 'has_post': True, 'module': 'mesh', 'has_pre': False}),
+('mesh', {'headers': ['dolfin/mesh/CellType.h', 'dolfin/mesh/MeshTopology.h', 'dolfin/mesh/MeshGeometry.h', 'dolfin/mesh/MeshDomains.h', 'dolfin/mesh/MeshData.h', 'dolfin/mesh/Mesh.h', 'dolfin/mesh/MeshEntity.h', 'dolfin/mesh/MeshEntityIterator.h', 'dolfin/mesh/MeshEntityIteratorBase.h', 'dolfin/mesh/SubsetIterator.h', 'dolfin/mesh/Vertex.h', 'dolfin/mesh/Edge.h', 'dolfin/mesh/Face.h', 'dolfin/mesh/Facet.h', 'dolfin/mesh/Cell.h', 'dolfin/mesh/FacetCell.h', 'dolfin/mesh/MeshConnectivity.h [...]
+('generation', {'headers': ['dolfin/generation/BoxMesh.h', 'dolfin/generation/IntervalMesh.h', 'dolfin/generation/RectangleMesh.h', 'dolfin/generation/UnitTetrahedronMesh.h', 'dolfin/generation/UnitCubeMesh.h', 'dolfin/generation/UnitIntervalMesh.h', 'dolfin/generation/UnitTriangleMesh.h', 'dolfin/generation/UnitSquareMesh.h', 'dolfin/generation/UnitQuadMesh.h', 'dolfin/generation/UnitHexMesh.h', 'dolfin/generation/UnitDiscMesh.h', 'dolfin/generation/SphericalShellMesh.h'], 'has_post': T [...]
 ('geometry', {'headers': ['dolfin/geometry/Point.h', 'dolfin/geometry/BoundingBoxTree.h', 'dolfin/geometry/GenericBoundingBoxTree.h', 'dolfin/geometry/BoundingBoxTree3D.h', 'dolfin/geometry/MeshPointIntersection.h', 'dolfin/geometry/intersect.h'], 'has_post': True, 'module': 'mesh', 'has_pre': True}),
 ('refinement', {'headers': ['dolfin/refinement/refine.h'], 'has_post': False, 'module': 'mesh', 'has_pre': False}),
-('graph', {'headers': ['dolfin/graph/Graph.h', 'dolfin/graph/GraphBuilder.h', 'dolfin/graph/BoostGraphOrdering.h', 'dolfin/graph/SCOTCH.h'], 'has_post': True, 'module': 'mesh', 'has_pre': False}),
-('la', {'headers': ['dolfin/la/LinearAlgebraObject.h', 'dolfin/la/GenericLinearOperator.h', 'dolfin/la/GenericTensor.h', 'dolfin/la/GenericMatrix.h', 'dolfin/la/GenericSparsityPattern.h', 'dolfin/la/GenericVector.h', 'dolfin/la/VectorSpaceBasis.h', 'dolfin/la/GenericLinearSolver.h', 'dolfin/la/GenericLUSolver.h', 'dolfin/la/GenericPreconditioner.h', 'dolfin/la/PETScOptions.h', 'dolfin/la/PETScObject.h', 'dolfin/la/PETScBaseMatrix.h', 'dolfin/la/EigenMatrix.h', 'dolfin/la/PETScMatrix.h',  [...]
+('graph', {'headers': ['dolfin/graph/Graph.h', 'dolfin/graph/GraphBuilder.h', 'dolfin/graph/BoostGraphOrdering.h', 'dolfin/graph/SCOTCH.h'], 'has_post': True, 'module': 'mesh', 'has_pre': True}),
+('la', {'headers': ['dolfin/la/LinearAlgebraObject.h', 'dolfin/la/GenericLinearOperator.h', 'dolfin/la/GenericTensor.h', 'dolfin/la/GenericMatrix.h', 'dolfin/la/GenericVector.h', 'dolfin/la/VectorSpaceBasis.h', 'dolfin/la/GenericLinearSolver.h', 'dolfin/la/GenericLUSolver.h', 'dolfin/la/PETScOptions.h', 'dolfin/la/PETScObject.h', 'dolfin/la/PETScBaseMatrix.h', 'dolfin/la/EigenMatrix.h', 'dolfin/la/PETScMatrix.h', 'dolfin/la/PETScLinearOperator.h', 'dolfin/la/PETScPreconditioner.h', 'dolf [...]
 ('nls', {'headers': ['dolfin/nls/NonlinearProblem.h', 'dolfin/nls/NewtonSolver.h', 'dolfin/nls/OptimisationProblem.h', 'dolfin/nls/PETScSNESSolver.h', 'dolfin/nls/PETScTAOSolver.h', 'dolfin/nls/TAOLinearBoundSolver.h'], 'has_post': False, 'module': 'la', 'has_pre': True}),
-('function', {'headers': ['dolfin/function/GenericFunction.h', 'dolfin/function/Expression.h', 'dolfin/function/FunctionAXPY.h', 'dolfin/function/Function.h', 'dolfin/function/FunctionSpace.h', 'dolfin/function/SubSpace.h', 'dolfin/function/Constant.h', 'dolfin/function/SpecialFunctions.h', 'dolfin/function/SpecialFacetFunction.h', 'dolfin/function/MultiMeshFunction.h', 'dolfin/function/MultiMeshFunctionSpace.h', 'dolfin/function/MultiMeshSubSpace.h', 'dolfin/function/FunctionAssigner.h' [...]
+('function', {'headers': ['dolfin/function/GenericFunction.h', 'dolfin/function/Expression.h', 'dolfin/function/FunctionAXPY.h', 'dolfin/function/Function.h', 'dolfin/function/FunctionSpace.h', 'dolfin/function/Constant.h', 'dolfin/function/SpecialFunctions.h', 'dolfin/function/SpecialFacetFunction.h', 'dolfin/function/MultiMeshFunction.h', 'dolfin/function/MultiMeshFunctionSpace.h', 'dolfin/function/MultiMeshSubSpace.h', 'dolfin/function/FunctionAssigner.h', 'dolfin/function/assign.h',  [...]
 ('math', {'headers': ['dolfin/math/basic.h', 'dolfin/math/Lagrange.h', 'dolfin/math/Legendre.h'], 'has_post': False, 'module': 'function', 'has_pre': False}),
 ('ale', {'headers': ['dolfin/ale/ALE.h', 'dolfin/ale/MeshDisplacement.h'], 'has_post': False, 'module': 'function', 'has_pre': True}),
-('fem', {'headers': ['dolfin/fem/GenericDofMap.h', 'dolfin/fem/DofMap.h', 'dolfin/fem/fem_utils.h', 'dolfin/fem/Equation.h', 'dolfin/fem/FiniteElement.h', 'dolfin/fem/BasisFunction.h', 'dolfin/fem/DirichletBC.h', 'dolfin/fem/PointSource.h', 'dolfin/fem/assemble.h', 'dolfin/fem/LocalSolver.h', 'dolfin/fem/solve.h', 'dolfin/fem/Form.h', 'dolfin/fem/AssemblerBase.h', 'dolfin/fem/Assembler.h', 'dolfin/fem/SparsityPatternBuilder.h', 'dolfin/fem/SystemAssembler.h', 'dolfin/fem/LinearVariationa [...]
+('fem', {'headers': ['dolfin/fem/GenericDofMap.h', 'dolfin/fem/DofMap.h', 'dolfin/fem/fem_utils.h', 'dolfin/fem/Equation.h', 'dolfin/fem/FiniteElement.h', 'dolfin/fem/BasisFunction.h', 'dolfin/fem/DiscreteOperators.h', 'dolfin/fem/DirichletBC.h', 'dolfin/fem/PointSource.h', 'dolfin/fem/assemble.h', 'dolfin/fem/assemble_local.h', 'dolfin/fem/LocalAssembler.h', 'dolfin/fem/LocalSolver.h', 'dolfin/fem/solve.h', 'dolfin/fem/Form.h', 'dolfin/fem/AssemblerBase.h', 'dolfin/fem/Assembler.h', 'do [...]
 ('multistage', {'headers': ['dolfin/multistage/MultiStageScheme.h', 'dolfin/multistage/RKSolver.h', 'dolfin/multistage/PointIntegralSolver.h'], 'has_post': False, 'module': 'fem', 'has_pre': True}),
-('adaptivity', {'headers': ['dolfin/adaptivity/GenericAdaptiveVariationalSolver.h', 'dolfin/adaptivity/AdaptiveLinearVariationalSolver.h', 'dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.h', 'dolfin/adaptivity/GoalFunctional.h', 'dolfin/adaptivity/ErrorControl.h', 'dolfin/adaptivity/Extrapolation.h', 'dolfin/adaptivity/LocalAssembler.h', 'dolfin/adaptivity/TimeSeries.h', 'dolfin/adaptivity/adapt.h', 'dolfin/adaptivity/marking.h', 'dolfin/adaptivity/adaptivesolve.h'], 'has_post': Tr [...]
+('adaptivity', {'headers': ['dolfin/adaptivity/GenericAdaptiveVariationalSolver.h', 'dolfin/adaptivity/AdaptiveLinearVariationalSolver.h', 'dolfin/adaptivity/AdaptiveNonlinearVariationalSolver.h', 'dolfin/adaptivity/GoalFunctional.h', 'dolfin/adaptivity/ErrorControl.h', 'dolfin/adaptivity/Extrapolation.h', 'dolfin/adaptivity/TimeSeries.h', 'dolfin/adaptivity/adapt.h', 'dolfin/adaptivity/marking.h', 'dolfin/adaptivity/adaptivesolve.h'], 'has_post': True, 'module': 'fem', 'has_pre': True}),
 ('plot', {'headers': ['dolfin/plot/plot.h', 'dolfin/plot/VTKPlotter.h'], 'has_post': False, 'module': 'io', 'has_pre': True}),
-('io', {'headers': ['dolfin/io/GenericFile.h', 'dolfin/io/File.h', 'dolfin/io/XDMFFile.h', 'dolfin/io/HDF5File.h', 'dolfin/io/HDF5Attribute.h'], 'has_post': True, 'module': 'io', 'has_pre': True}),])
+('io', {'headers': ['dolfin/io/GenericFile.h', 'dolfin/io/File.h', 'dolfin/io/XDMFFile.h', 'dolfin/io/HDF5File.h', 'dolfin/io/HDF5Attribute.h', 'dolfin/io/X3DOM.h'], 'has_post': True, 'module': 'io', 'has_pre': True}),])
diff --git a/site-packages/dolfin/cpp/__init__.py b/site-packages/dolfin/cpp/__init__.py
index b693624..716d450 100644
--- a/site-packages/dolfin/cpp/__init__.py
+++ b/site-packages/dolfin/cpp/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Expose names from the compiled cpp modules to the dolfin.cpp
 namespace"""
 
@@ -81,4 +82,5 @@ for module_name in _compiled_modules:
 globals()["__swigversion__"] = getattr(module, "__swigversion__")
 globals()["__pythonversion__"] = getattr(module, "__pythonversion__")
 globals()["__version__"] = common.dolfin_version()
+globals()["__ufcsignature__"] = common.ufc_signature()
 globals()["parameters"] = common.get_global_parameters()
diff --git a/site-packages/dolfin/deprecation.py b/site-packages/dolfin/deprecation.py
index 0d36197..0dc2888 100644
--- a/site-packages/dolfin/deprecation.py
+++ b/site-packages/dolfin/deprecation.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2012 Anders Logg
 #
 # This file is part of DOLFIN.
diff --git a/site-packages/dolfin/fem/__init__.py b/site-packages/dolfin/fem/__init__.py
index 32bead6..bfa4f01 100644
--- a/site-packages/dolfin/fem/__init__.py
+++ b/site-packages/dolfin/fem/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """The function module of dolfin"""
 from dolfin.fem import form
 from dolfin.fem import assembling
@@ -9,6 +10,7 @@ from dolfin.fem import formmanipulations
 
 from .form import *
 from .assembling import *
+from .assembling_local import *
 from .solving import *
 from .adaptivesolving import *
 from .interpolation import *
@@ -23,6 +25,7 @@ from .formmanipulations import *
 
 __all__ = form.__all__ + \
           assembling.__all__ + \
+          assembling_local.__all__ + \
           solving.__all__ + \
           adaptivesolving.__all__ + \
           norms.__all__ + \
diff --git a/site-packages/dolfin/fem/adaptivesolving.py b/site-packages/dolfin/fem/adaptivesolving.py
index 91b7050..6581a2a 100644
--- a/site-packages/dolfin/fem/adaptivesolving.py
+++ b/site-packages/dolfin/fem/adaptivesolving.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module provides a Python layer on top of the C++
 Adaptive*VariationalSolver classes"""
 
@@ -180,8 +181,8 @@ def generate_error_control_forms(problem, goal):
 
     # Paranoid checks added after introduction of multidomain features in ufl:
     for form in [goal]:
-        assert len(form.domains()) > 0, "Error control got as input a form with no domain!"
-        assert len(form.domains()) == 1, "Error control got as input a form with more than one domain!"
+        assert len(form.ufl_domains()) > 0, "Error control got as input a form with no domain!"
+        assert len(form.ufl_domains()) == 1, "Error control got as input a form with more than one domain!"
 
     # Extract primal forms from problem
     is_linear = True
@@ -190,8 +191,8 @@ def generate_error_control_forms(problem, goal):
 
         # Paranoid checks added after introduction of multidomain features in ufl:
         for form in primal:
-            assert len(form.domains()) > 0, "Error control got as input a form with no domain!"
-            assert len(form.domains()) == 1, "Error control got as input a form with more than one domain!"
+            assert len(form.ufl_domains()) > 0, "Error control got as input a form with no domain!"
+            assert len(form.ufl_domains()) == 1, "Error control got as input a form with more than one domain!"
 
     elif isinstance(problem, NonlinearVariationalProblem):
         is_linear = False
@@ -199,8 +200,8 @@ def generate_error_control_forms(problem, goal):
 
         # Paranoid checks added after introduction of multidomain features in ufl:
         for form in [primal]:
-            assert len(form.domains()) > 0, "Error control got as input a form with no domain!"
-            assert len(form.domains()) == 1, "Error control got as input a form with more than one domain!"
+            assert len(form.ufl_domains()) > 0, "Error control got as input a form with no domain!"
+            assert len(form.ufl_domains()) == 1, "Error control got as input a form with more than one domain!"
 
     else:
         cpp.dolfin_error("adaptivesolving.py",
@@ -216,7 +217,7 @@ def generate_error_control_forms(problem, goal):
 
     # Paranoid checks added after introduction of multidomain features in ufl:
     for form in forms:
-        assert len(form.domains()) > 0, "Error control produced a form with no domain!"
-        assert len(form.domains()) == 1, "Error control produced a form with more than one domain!"
+        assert len(form.ufl_domains()) > 0, "Error control produced a form with no domain!"
+        assert len(form.ufl_domains()) == 1, "Error control produced a form with more than one domain!"
 
     return (forms, is_linear)
diff --git a/site-packages/dolfin/fem/assembling.py b/site-packages/dolfin/fem/assembling.py
index 2c4e6ea..ce1f90d 100644
--- a/site-packages/dolfin/fem/assembling.py
+++ b/site-packages/dolfin/fem/assembling.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module provides functionality for form assembly in Python,
 corresponding to the C++ assembly and PDE classes.
 
@@ -26,12 +27,10 @@ rely on the dolfin::Form class which is not used on the Python side."""
 # You should have received a copy of the GNU Lesser General Public License
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
-# Modified by Martin Sandve Alnaes, 2008-2015.
-# Modified by Johan Hake, 2008-2009.
-# Modified by Garth N. Wells, 2008-2013.
-# Modified by Joachim B. Haga, 2012.
-
-__all__ = ["assemble", "assemble_system", "SystemAssembler"]
+# Modified by Martin Sandve Alnæs 2008-2015
+# Modified by Johan Hake 2008-2009
+# Modified by Garth N. Wells 2008-2013
+# Modified by Joachim B. Haga 2012
 
 import types
 
@@ -43,8 +42,15 @@ import dolfin.cpp as cpp
 
 # Local imports
 from dolfin.fem.form import *
+from dolfin.common import parameters
+
+__all__ = ["assemble", "assemble_system", "assemble_multimesh",
+           "SystemAssembler"]
+
 
-def _create_dolfin_form(form, form_compiler_parameters=None):
+def _create_dolfin_form(form,
+                        form_compiler_parameters=None,
+                        function_spaces=None):
     # First check if we got a cpp.Form
     if isinstance(form, cpp.Form):
         # Check that jit compilation has already happened
@@ -55,10 +61,13 @@ def _create_dolfin_form(form, form_compiler_parameters=None):
             cpp.warning("Ignoring form_compiler_parameters when passed a dolfin Form!")
         return form
     elif isinstance(form, ufl.Form):
-        return Form(form, form_compiler_parameters=form_compiler_parameters)
+        return Form(form,
+                    form_compiler_parameters=form_compiler_parameters,
+                    function_spaces=function_spaces)
     else:
         raise TypeError("Invalid form type %s" % (type(form),))
 
+
 # JIT assembler
 def assemble(form,
              tensor=None,
@@ -91,12 +100,13 @@ def assemble(form,
 
     Each call to assemble() will create a new tensor. If the
     ``tensor`` argument is provided, this will be used instead.
-    Sparsity pattern of ``tensor`` is reset iff ``tensor.empty()`` holds.
+    Sparsity pattern of ``tensor`` is reset iff ``tensor.empty()``
+    holds.
 
     If the ``keep_diagonal`` is set to True, assembler ensures that
     potential zeros on a matrix diagonal are kept in sparsity pattern
-    so every diagonal entry can be changed in a future (for example
-    by ident() or ident_zeros()).
+    so every diagonal entry can be changed in a future (for example by
+    ident() or ident_zeros()).
 
     Specific form compiler parameters can be provided by the
     ``form_compiler_parameters`` argument. Form compiler parameters
@@ -112,9 +122,10 @@ def assemble(form,
             A = assemble(inner(grad(u),grad(v))*dx)
             b = assemble(f*v*dx)
 
-        To prescribe the domains over which integrals will be evaluated,
-        create a Measure with the MeshFunction passed as subdomain_data.
-        For instance, using a mesh function marking parts of the boundary:
+        To prescribe the domains over which integrals will be
+        evaluated, create a Measure with the MeshFunction passed as
+        subdomain_data.  For instance, using a mesh function marking
+        parts of the boundary:
 
         .. code-block:: python
 
@@ -133,17 +144,19 @@ def assemble(form,
             b = assemble(L)
 
         For interior facet integrals (dS), cell markers can be used to
-        specify which cell is '+' and which is '-'. The '+' and '-' sides
-        are chosen such that the cell marker value in the cell at the '+'
-        side cell is larger than the cell marker value in the cell at
-        the '-' side cell. If the values are equal or the cell markers
-        are not provided, the sides are chosen arbitrarily.
-
-        Note that currently, cell markers must be associated with a cell
-        type integral (dx), and if you don't have such an integral a workaround
-        is to add the integral of something over an empty domain such as 'f*dx(99)'
-        with 99 a number not occuring among the cell markers. A better interface
-        to handle this case will be provided later.
+        specify which cell is '+' and which is '-'. The '+' and '-'
+        sides are chosen such that the cell marker value in the cell
+        at the '+' side cell is larger than the cell marker value in
+        the cell at the '-' side cell. If the values are equal or the
+        cell markers are not provided, the sides are chosen
+        arbitrarily.
+
+        Note that currently, cell markers must be associated with a
+        cell type integral (dx), and if you don't have such an
+        integral a workaround is to add the integral of something over
+        an empty domain such as 'f*dx(99)' with 99 a number not
+        occuring among the cell markers. A better interface to handle
+        this case will be provided later.
 
         .. code-block:: python
 
@@ -174,11 +187,13 @@ def assemble(form,
         The form ``a`` is now assembled into the PETScMatrix ``A``.
 
     """
+
     # Create dolfin Form object referencing all data needed by assembler
     dolfin_form = _create_dolfin_form(form, form_compiler_parameters)
 
     # Create tensor
-    tensor = _create_tensor(form, dolfin_form.rank(), backend, tensor)
+    comm = dolfin_form.mesh().mpi_comm()
+    tensor = _create_tensor(comm, form, dolfin_form.rank(), backend, tensor)
 
     # Call C++ assemble function
     assembler = cpp.Assembler()
@@ -194,6 +209,72 @@ def assemble(form,
     # Return value
     return tensor
 
+
+# JIT multimesh assembler
+def assemble_multimesh(form,
+                       tensor=None,
+                       form_compiler_parameters=None,
+                       backend=None):
+    "Assemble the given multimesh form and return the corresponding tensor."
+
+    # The form that comes in is (by construction in function.Argument)
+    # defined on the first part of the multimesh. We now need to create
+    # the DOLFIN Forms with the proper function spaces for each part.
+
+    # FIXME: This code makes a number of assumptions and will need to
+    # be revisited and improved.
+
+    # Make sure that we generate code for evaluate_basis_derivatives
+    if not form_compiler_parameters:
+        form_compiler_parameters = parameters['form_compiler']
+    form_compiler_parameters = form_compiler_parameters.copy()
+    form_compiler_parameters["no-evaluate_basis_derivatives"] = False
+
+    # Extract arguments and multimesh function space
+    arguments = form.arguments()
+
+    # Extract multimesh function spaces for arguments
+    V_multi = [v._V_multi for v in arguments]
+
+    # Extract number of parts and rank
+    num_parts = V_multi[0].num_parts()  # check only first
+    rank = len(arguments)
+
+    # Build multimesh DOLFIN form
+    multimesh_form = cpp.MultiMeshForm(*V_multi)
+    for part in range(num_parts):
+
+        # Extract standard function spaces for all arguments on
+        # current part
+        function_spaces = [V_multi[i].part(part) for i in range(rank)]
+
+        # Wrap standard form
+        dolfin_form = _create_dolfin_form(form,
+                                          form_compiler_parameters,
+                                          function_spaces)
+
+        # Add standard form to multimesh form
+        multimesh_form.add(dolfin_form)
+
+    # Build multimesh form
+    multimesh_form.build()
+
+    # Create tensor
+    comm = cpp.mpi_comm_world()
+    tensor = _create_tensor(comm, form, rank, backend, tensor)
+
+    # Call C++ assemble function
+    assembler = cpp.MultiMeshAssembler()
+    assembler.assemble(tensor, multimesh_form)
+
+    # Convert to float for scalars
+    if rank == 0:
+        tensor = tensor.get_scalar_value()
+
+    # Return value
+    return tensor
+
+
 # JIT system assembler
 def assemble_system(A_form,
                     b_form,
@@ -206,8 +287,7 @@ def assemble_system(A_form,
                     A_tensor=None,
                     b_tensor=None,
                     backend=None):
-    """
-    Assemble form(s) and apply any given boundary conditions in a
+    """Assemble form(s) and apply any given boundary conditions in a
     symmetric fashion and return tensor(s).
 
     The standard application of boundary conditions does not
@@ -244,8 +324,12 @@ def assemble_system(A_form,
     b_dolfin_form = _create_dolfin_form(b_form, form_compiler_parameters)
 
     # Create tensors
-    A_tensor = _create_tensor(A_form, A_dolfin_form.rank(), backend, A_tensor)
-    b_tensor = _create_tensor(b_form, b_dolfin_form.rank(), backend, b_tensor)
+    comm_A = A_dolfin_form.mesh().mpi_comm()
+    comm_b = A_dolfin_form.mesh().mpi_comm()
+    A_tensor = _create_tensor(comm_A, A_form, A_dolfin_form.rank(), backend,
+                              A_tensor)
+    b_tensor = _create_tensor(comm_b, b_form, b_dolfin_form.rank(), backend,
+                              b_tensor)
 
     # Check bcs
     bcs = _wrap_in_list(bcs, 'bcs', cpp.DirichletBC)
@@ -262,6 +346,7 @@ def assemble_system(A_form,
 
     return A_tensor, b_tensor
 
+
 def _wrap_in_list(obj, name, types=type):
     if obj is None:
         lst = []
@@ -271,10 +356,12 @@ def _wrap_in_list(obj, name, types=type):
         lst = [obj]
     for obj in lst:
         if not isinstance(obj, types):
-            raise TypeError("expected a (list of) %s as '%s' argument" % (str(types),name))
+            raise TypeError("expected a (list of) %s as '%s' argument" %
+                            (str(types), name))
     return lst
 
-def _create_tensor(form, rank, backend, tensor):
+
+def _create_tensor(mpi_comm, form, rank, backend, tensor):
     "Create tensor for form"
 
     # Check if tensor is supplied by user
@@ -282,27 +369,32 @@ def _create_tensor(form, rank, backend, tensor):
         return tensor
 
     # Check backend argument
-    if (not backend is None) and (not isinstance(backend, cpp.GenericLinearAlgebraFactory)):
+    if (backend is not None) and (not isinstance(backend, cpp.GenericLinearAlgebraFactory)):
         raise TypeError("Provide a GenericLinearAlgebraFactory as 'backend'")
 
     # Create tensor
     if rank == 0:
-        tensor = cpp.Scalar()
+        tensor = cpp.Scalar(mpi_comm)
     elif rank == 1:
-        if backend: tensor = backend.create_vector()
-        else:       tensor = cpp.Vector()
+        if backend:
+            tensor = backend.create_vector(mpi_comm)
+        else:
+            tensor = cpp.Vector(mpi_comm)
     elif rank == 2:
-        if backend: tensor = backend.create_matrix()
-        else:       tensor = cpp.Matrix()
+        if backend:
+            tensor = backend.create_matrix(mpi_comm)
+        else:
+            tensor = cpp.Matrix(mpi_comm)
     else:
         raise RuntimeError("Unable to create tensors of rank %d." % rank)
 
     return tensor
 
+
 class SystemAssembler(cpp.SystemAssembler):
     __doc__ = cpp.SystemAssembler.__doc__
-    def __init__(self, A_form, b_form,
-                 bcs=None,
+
+    def __init__(self, A_form, b_form, bcs=None,
                  form_compiler_parameters=None):
         """
         Create a SystemAssembler
diff --git a/site-packages/dolfin/fem/assembling_local.py b/site-packages/dolfin/fem/assembling_local.py
new file mode 100644
index 0000000..bb85f5e
--- /dev/null
+++ b/site-packages/dolfin/fem/assembling_local.py
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+"""This module provides functionality for cell-wise assembly of forms in
+Python, corresponding to the C++ LocalSolver functionality.
+
+The C++ :py:class:`assemble <dolfin.cpp.assemble_local>` function
+is wrapped with an additional preprocessing step where code is generated
+using the FFC JIT compiler."""
+
+# Copyright (C) 2015 Tormod Landet
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+# Import SWIG-generated extension module (DOLFIN C++)
+import dolfin.cpp as cpp
+
+# Local imports
+from dolfin.fem.assembling import _create_dolfin_form
+
+__all__ = ["assemble_local"]
+
+
+# JIT assembler for local problems
+def assemble_local(form, cell):
+    """Assemble the given form on the given cell and return the
+    corresponding local tensor.
+
+    *Arguments*
+        Depending on the input form, which may be a functional, linear
+        form or bilinear form, a scalar value, a vector or a matrix is
+        returned.
+
+    The ``form`` can be either a UFL Form or a DOLFIN Form. The return
+    value will be a Python float, or an appropriately sized numpy
+    ndarray.
+
+    To understand the connection between the returned local cell
+    tensor and the global tensor the mapping can be found as normal
+    from a function space as V.dofmap().cell_dofs(cell.index()).
+
+    If you pass a UFL form it will be compiled with
+    ``dolfin.Form(form)``. This operation is collective. If you do not
+    run assemble_local on all MPI processes simultaneously you should
+    pre-compile the form first on all ranks.
+
+    """
+    # Create dolfin Form object referencing all data needed by
+    # assembler
+    dolfin_form = _create_dolfin_form(form)
+
+    assert dolfin_form.rank() in (0, 1, 2)
+    tensor = cpp.fem.assemble_local(dolfin_form, cell)
+
+    # Convert to float for scalars and matrix for bilinear forms
+    if dolfin_form.rank() == 0:
+        tensor = tensor[0]
+    elif dolfin_form.rank() == 2:
+        test_dofmap = dolfin_form.function_space(0).dofmap()
+        test_dofs = test_dofmap.cell_dofs(cell.index())
+        N = len(test_dofs)
+        tensor = tensor.reshape((N, -1))
+
+    # Return value
+    return tensor
diff --git a/site-packages/dolfin/fem/bcs.py b/site-packages/dolfin/fem/bcs.py
index 92bf01d..983c78e 100644
--- a/site-packages/dolfin/fem/bcs.py
+++ b/site-packages/dolfin/fem/bcs.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2009-2011 Anders Logg
 #
 # This file is part of DOLFIN.
@@ -20,8 +21,6 @@
 # First added:  2008-10-22
 # Last changed: 2012-08-18
 
-__all__ = ["AutoSubDomain", "DirichletBC", "homogenize"]
-
 import types
 
 import dolfin.cpp as cpp
@@ -30,6 +29,9 @@ from dolfin.compilemodules.subdomains import CompiledSubDomain
 import ufl
 from dolfin.fem.projection import project
 
+__all__ = ["AutoSubDomain", "DirichletBC"]
+
+
 class AutoSubDomain(cpp.SubDomain):
     "Wrapper class for creating a SubDomain from an inside() function."
 
@@ -40,12 +42,12 @@ class AutoSubDomain(cpp.SubDomain):
         if not isinstance(inside_function, types.FunctionType):
             cpp.dolfin_error("bcs.py",
                              "auto-create subdomain",
-                             "Expecting a function (not %s)" % \
-                                 str(type(inside_function)))
+                             "Expecting a function (not %s)" %
+                             str(type(inside_function)))
         self.inside_function = inside_function
 
         # Check the number of arguments
-        if not inside_function.__code__.co_argcount in (1, 2):
+        if inside_function.__code__.co_argcount not in (1, 2):
             cpp.dolfin_error("bcs.py",
                              "auto-create subdomain",
                              "Expecting a function of the form inside(x) or inside(x, on_boundary)")
@@ -61,6 +63,7 @@ class AutoSubDomain(cpp.SubDomain):
         else:
             return self.inside_function(x, on_boundary)
 
+
 class DirichletBC(cpp.DirichletBC):
 
     # Reuse doc-string from cpp.DirichletBC
@@ -74,7 +77,7 @@ class DirichletBC(cpp.DirichletBC):
             if not isinstance(args[0], cpp.DirichletBC):
                 cpp.dolfin_error("bcs.py",
                                  "create DirichletBC",
-                                 "Expecting a DirichleBC as only argument"\
+                                 "Expecting a DirichleBC as only argument"
                                  " for copy constructor")
 
             # Initialize base class
@@ -82,12 +85,14 @@ class DirichletBC(cpp.DirichletBC):
             self.domain_args = args[0].domain_args
             return
 
+        mpi_comm = args[0].mesh().mpi_comm()
+
         # Special case for value specified as float, tuple or similar
         if len(args) >= 2 and not isinstance(args[1], cpp.GenericFunction):
             if isinstance(args[1], ufl.classes.Expr):
                 expr = project(args[1], args[0])
             else:
-                expr = Constant(args[1]) # let Constant handle all problems
+                expr = Constant(args[1])  # let Constant handle all problems
             args = args[:1] + (expr,) + args[2:]
 
         # Special case for sub domain specified as a function
@@ -97,7 +102,7 @@ class DirichletBC(cpp.DirichletBC):
 
         # Special case for sub domain specified as a string
         if len(args) >= 3 and isinstance(args[2], str):
-            sub_domain = CompiledSubDomain(args[2])
+            sub_domain = CompiledSubDomain(args[2], mpi_comm=mpi_comm)
             args = args[:2] + (sub_domain,) + args[3:]
 
         # Store Expression to avoid scoping issue with SWIG directors
@@ -120,7 +125,7 @@ class DirichletBC(cpp.DirichletBC):
 
         # Check for other keyword arguments
         for key in kwargs:
-            if not key in allowed_kwargs:
+            if key not in allowed_kwargs:
                 cpp.dolfin_error("bcs.py",
                                  "create boundary condition",
                                  "Unknown keyword argument \"%s\"" % key)
@@ -130,46 +135,3 @@ class DirichletBC(cpp.DirichletBC):
 
     # Set doc string
     __init__.__doc__ = cpp.DirichletBC.__init__.__doc__
-
-
-def homogenize(bc):
-    """
-    **DEPRECATED**:
-    Return a homogeneous version of the given boundary condition.
-
-    *Arguments*
-        bc
-            a :py:class:`DirichletBC <dolfin.fem.bcs.DirichletBC>` instance,
-            or a list/tuple of
-            :py:class:`DirichletBC <dolfin.fem.bcs.DirichletBC>` instances.
-
-    Other types of boundary conditions are ignored.
-
-    If the given boundary condition is a list of boundary conditions,
-    then a list of homogeneous boundary conditions is returned.
-
-    """
-    # Deprecating it as it is very unclear what should it do
-    # because DirichletBC employs some caching prepared on first use.
-    # So if args of DirichetBC(*args) change it is not clear whether
-    # whether cached dofs should be reused or thrown away on copy
-    # cnstruction
-    cpp.deprecation("Free function 'homogenize(bc)'", "1.6.0", "1.7.0",
-                    "Use member function 'homogenize()' (in a combination"
-                    "with copy constructor 'DirichletBC(bc)'.")
-
-    # Handle case when boundary condition is a list
-    if isinstance(bc, (list, tuple)):
-        bcs = bc
-        return [homogenize(bc) for bc in bcs]
-
-    # Only consider Dirichlet boundary conditions
-    if not isinstance(bc, cpp.DirichletBC):
-        cpp.dolfin_error("bcs.py",
-                         "homogenize boundary condition",
-                         "Can only homogenize DirichletBCs")
-
-    # Return homogenized copy
-    new_bc = DirichletBC(bc)
-    new_bc.homogenize()
-    return new_bc
diff --git a/site-packages/dolfin/fem/errorcontrolgenerator.py b/site-packages/dolfin/fem/errorcontrolgenerator.py
index 2247616..0b364a0 100644
--- a/site-packages/dolfin/fem/errorcontrolgenerator.py
+++ b/site-packages/dolfin/fem/errorcontrolgenerator.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """
 This module provides a DOLFINErrorControlGenerator for handling UFL
 forms defined over DOLFIN objects.
@@ -25,6 +26,7 @@ from ffc.errorcontrol.errorcontrolgenerators import ErrorControlGenerator
 from dolfin import Function, FunctionSpace
 from dolfin.fem.formmanipulations import tear, increase_order
 
+
 class DOLFINErrorControlGenerator(ErrorControlGenerator):
     """
     This class provides a realization of
diff --git a/site-packages/dolfin/fem/form.py b/site-packages/dolfin/fem/form.py
index 61ad28e..dcf1ea8 100644
--- a/site-packages/dolfin/fem/form.py
+++ b/site-packages/dolfin/fem/form.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module defines a Form class that wraps FFC forms and UFC forms
 into a cpp.Form (dolfin::Form)."""
 
@@ -20,15 +21,14 @@ into a cpp.Form (dolfin::Form)."""
 #
 # Modified by Anders Logg, 2008-2011
 # Modified by Marie E. Rognes, 2011
-# Modified by Martin Alnes, 2014-2015
-
-__all__ = ["Form"]
+# Modified by Martin Sandve Alnæs, 2014-2015
 
 # Import SWIG-generated extension module (DOLFIN C++)
 import dolfin.cpp as cpp
 
 # Import ufl and ufc
-import ufl, ufc
+import ufl
+import ufc
 
 # Import JIT compiler
 from dolfin.compilemodules.jit import jit
@@ -36,16 +36,28 @@ from dolfin.compilemodules.jit import jit
 from dolfin.cpp import deprecation
 from dolfin.cpp import MeshFunctionSizet
 
+__all__ = ["Form"]
+
 # Note that we need to store _compiled_form and _compiled_coefficients
 # to prevent Python from garbage-collecting these while still in use.
 # FIXME: Figure out how to solve this with shared_ptr
 
 function_space_error = "Error while extracting test and/or trial spaces. "
 
+
 class Form(cpp.Form):
-    def __init__(self, form, form_compiler_parameters=None):
+    def __init__(self, form,
+                 form_compiler_parameters=None,
+                 function_spaces=None):
         "Create JIT-compiled form from any given form (compiled or not)."
 
+        # Developer note: The function_spaces argument is used to
+        # handle forms defined on multimesh function spaces. These are
+        # really defined over a standard function space (the first of
+        # the spaces) then later recreated on each function space part
+        # and added together to form a multimesh form. This happens in
+        # the function assemble_multimesh.
+
         # Check form argument
         if not isinstance(form, ufl.Form):
             cpp.dolfin_error("form.py",
@@ -53,7 +65,7 @@ class Form(cpp.Form):
                              "Expected a ufl.Form.")
 
         # Cutoff for better error message than ffc would give
-        if not form.empty() and not form.domains():
+        if not form.empty() and not form.ufl_domains():
             cpp.dolfin_error("form.py",
                              "creating dolfin.Form",
                              "The ufl.Form does not include any reference to a mesh.")
@@ -66,9 +78,9 @@ class Form(cpp.Form):
             cpp.dolfin_error("form.py",
                              "creating dolfin.Form",
                              "Expecting subdomain data for a single domain only.")
-        self.subdomains, = list(sd.values()) # Assuming single domain
-        domain, = list(sd.keys()) # Assuming single domain
-        mesh = domain.data()
+        self.subdomains, = list(sd.values())  # Assuming single domain
+        domain, = list(sd.keys())  # Assuming single domain
+        mesh = domain.ufl_cargo()
 
         # Having a mesh in the form is now a strict requirement
         if mesh is None:
@@ -78,50 +90,63 @@ class Form(cpp.Form):
 
         # Jit the module, this will take some time...
         self._compiled_form, module, prefix \
-                             = jit(form, form_compiler_parameters,
-                                   mpi_comm=mesh.mpi_comm())
+            = jit(form, form_compiler_parameters,
+                  mpi_comm=mesh.mpi_comm())
 
         # Extract function spaces of form arguments
-        self.function_spaces = [func.function_space() for func in form.arguments()]
+        if function_spaces is None:
+            self.function_spaces = [func.function_space() for func
+                                    in form.arguments()]
+        else:
+            self.function_spaces = function_spaces
+
+        # Type checking argument function_spaces
+        if not all(isinstance(fs, cpp.FunctionSpace)
+                   for fs in self.function_spaces):
+            raise ValueError(function_space_error +
+                             " Invalid type of test spaces.")
+
+        # Initialize base class
+        cpp.Form.__init__(self, self._compiled_form,
+                          self.function_spaces)
+
+        # Type checking argument function_spaces
+        #r = self._compiled_form.rank()
+        #if len(self.function_spaces) != r:
+        #    raise ValueError(function_space_error +
+        #                     " Wrong number of test spaces (should be %d)." % r)
 
         # Extract coefficients from form (pass only the ones that
         # the compiled form actually uses to the assembler)
         original_coefficients = form.coefficients()
         self.coefficients = []
-        for i in range(self._compiled_form.num_coefficients()):
-            j = self._compiled_form.original_coefficient_position(i)
+        for i in range(self.num_coefficients()):
+            j = self.original_coefficient_position(i)
             self.coefficients.append(original_coefficients[j])
 
-        # Type checking argument function_spaces
-        r = self._compiled_form.rank()
-        if len(self.function_spaces) != r:
-            raise ValueError(function_space_error +
-                  " Wrong number of test spaces (should be %d)." % r)
-        if not all(isinstance(fs, cpp.FunctionSpace) for fs in self.function_spaces):
-            raise ValueError(function_space_error +
-                  " Invalid type of test spaces.")
-
         # Type checking coefficients
-        if not all(isinstance(c, cpp.GenericFunction) for c in self.coefficients):
+        if not all(isinstance(c, cpp.GenericFunction)
+                   for c in self.coefficients):
             coefficient_error = "Error while extracting coefficients. "
             raise TypeError(coefficient_error +
                             "Either provide a dict of cpp.GenericFunctions, " +
                             "or use Function to define your form.")
 
-        # Initialize base class
-        cpp.Form.__init__(self, self._compiled_form,
-                          self.function_spaces, self.coefficients)
-
-        # Attach mesh (because function spaces and coefficients may be empty lists)
-        self.set_mesh(mesh)
+        for i in range(self.num_coefficients()):
+            self.set_coefficient(i, self.coefficients[i])
 
+        # Attach mesh (because function spaces and coefficients may be
+        # empty lists)
+        if not function_spaces:
+            self.set_mesh(mesh)
 
         # Type checking subdomain data
         # Delete None entries
         for k in list(self.subdomains.keys()):
             if self.subdomains[k] is None:
                 del self.subdomains[k]
-        # Check that we have no additional subdomain data (user misspelling)
+        # Check that we have no additional subdomain data (user
+        # misspelling)
         # TODO: Get from ufl list?
         integral_types = ("cell", "exterior_facet", "interior_facet", "vertex")
         additional_keys = set(self.subdomains.keys()) - set(integral_types)
diff --git a/site-packages/dolfin/fem/formmanipulations.py b/site-packages/dolfin/fem/formmanipulations.py
index 2668377..50f3f6b 100644
--- a/site-packages/dolfin/fem/formmanipulations.py
+++ b/site-packages/dolfin/fem/formmanipulations.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2010-2012 Marie E. Rognes
 #
 # This file is part of DOLFIN.
@@ -17,12 +18,13 @@
 #
 # Modified by Johan Hake 2011
 # Modified by Anders Logg 2011
+# Modified by Jan Blechta 2015
 
 import ufl
-import dolfin.cpp as cpp
+from ufl.algorithms import elementtransformations
 
-from dolfin import FunctionSpace, MixedFunctionSpace, VectorFunctionSpace
-from dolfin import Function, TrialFunction, Argument
+import dolfin.cpp as cpp
+from dolfin import FunctionSpace, Function, Argument
 
 
 __all__ = ["derivative", "adjoint", "increase_order", "tear"]
@@ -64,55 +66,57 @@ def derivative(form, u, du=None, coefficient_derivatives=None):
         if any(arg.part() is not None for arg in form_arguments):
             cpp.dolfin_error("formmanipulation.py",
                              "compute derivative of form",
-                             "Cannot automatically create third argument using parts, please supply one")
+                             "Cannot automatically create new Argument using "
+                             "parts, please supply one")
         part = None
 
         if isinstance(u, Function):
             V = u.function_space()
             du = Argument(V, number, part)
+
         elif isinstance(u, (list,tuple)) and all(isinstance(w, Function) for w in u):
-            V = MixedFunctionSpace([w.function_space() for w in u])
+            cpp.deprecation("derivative of form w.r.t. a tuple of Coefficients",
+                            "2016.1",
+                            "Take derivative w.r.t. a single Coefficient on "
+                            "a mixed space instead.")
+
+            # Get mesh
+            mesh = u[0].function_space().mesh()
+            if not all(mesh.id() == v.function_space().mesh().id() for v in u):
+                cpp.dolfin_error("formmanipulation.py",
+                                 "compute derivative of form",
+                                 "Don't know how to compute derivative with "
+                                 "respect to Coefficients on different meshes yet")
+
+            # Build mixed element, space and argument
+            element = ufl.MixedElement([v.function_space().ufl_element() for v in u])
+            V = FunctionSpace(mesh, element)
             du = ufl.split(Argument(V, number, part))
+
         else:
             cpp.dolfin_error("formmanipulation.py",
-                             "compute derivative of form",
-                             "Cannot automatically create third argument, please supply one")
+                             "compute derivative of form w.r.t. '%s'" % u,
+                             "Supply Function as a Coefficient")
+
     return ufl.derivative(form, u, du, coefficient_derivatives)
 
 derivative.__doc__ = ufl.derivative.__doc__
+derivative.__doc__ += """
+
+    A tuple of Coefficients in place of a single Coefficient is not
+    supported in DOLFIN. Supply rather a Function on a mixed space in
+    place of a Coefficient.
+    """
 
 def increase_order(V):
     """
     For a given function space, return the same space, but with a
     higher polynomial degree
     """
-
-    n = V.num_sub_spaces()
-    if n > 0:
-        spaces = []
-        for i in range(n):
-            V_i = V.sub(i)
-            element = V_i.ufl_element()
-            # Handle VectorFunctionSpaces specially
-            if isinstance(element, ufl.VectorElement):
-                if element.family() == "Real":
-                    spaces += [V_i]
-                else:
-                    spaces += [VectorFunctionSpace(V_i.mesh(),
-                                                   element.family(),
-                                                   element.degree() + 1,
-                                                   dim=element.num_sub_elements())]
-            # Handle all else as MixedFunctionSpaces
-            else:
-                spaces += [increase_order(V_i)]
-
-        return MixedFunctionSpace(spaces)
-
-    if V.ufl_element().family() == "Real":
-        return FunctionSpace(V.mesh(), "Real", 0)
-
-    return FunctionSpace(V.mesh(), V.ufl_element().family(),
-                         V.ufl_element().degree() + 1)
+    mesh = V.mesh()
+    element = elementtransformations.increase_order(V.ufl_element())
+    constrained_domain = V.dofmap().constrained_domain
+    return FunctionSpace(mesh, element, constrained_domain=constrained_domain)
 
 def change_regularity(V, family):
     """
@@ -120,24 +124,14 @@ def change_regularity(V, family):
     the finite elements specified by 'family'. Possible families
     are the families supported by the form compiler
     """
+    mesh = V.mesh()
+    element = elementtransformations.change_regularity(V.ufl_element(), family)
+    constrained_domain = V.dofmap().constrained_domain
+    return FunctionSpace(mesh, element, constrained_domain=constrained_domain)
 
-    n = V.num_sub_spaces()
-    if n > 0:
-        return MixedFunctionSpace([change_regularity(V.sub(i), family)
-                                   for i in range(n)])
-
-    element = V.ufl_element()
-    shape = element.value_shape()
-    if not shape:
-        return FunctionSpace(V.mesh(), family, element.degree())
-
-    return MixedFunctionSpace([FunctionSpace(V.mesh(), family, element.degree())
-                               for i in range(shape[0])])
-
-def tear(V_h):
+def tear(V):
     """
     For a given function space, return the corresponding discontinuous
     space
     """
-    W = change_regularity(V_h, "DG")
-    return W
+    return change_regularity(V, "DG")
diff --git a/site-packages/dolfin/fem/interpolation.py b/site-packages/dolfin/fem/interpolation.py
index cf19473..a03a8ee 100644
--- a/site-packages/dolfin/fem/interpolation.py
+++ b/site-packages/dolfin/fem/interpolation.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module provides a simple way to compute the interpolation of a
 :py:class:`Function <dolfin.functions.function.Function>` or
 :py:class:`Expression <dolfin.functions.expression.Expression>` onto a
@@ -23,17 +24,18 @@ finite element space."""
 # First added:  2009-08-29
 # Last changed: 2011-11-15
 
-__all__ = ["interpolate"]
-
 # Local imports
 import dolfin.cpp as cpp
 
-from dolfin.functions.functionspace import FunctionSpaceBase
+from dolfin.functions.functionspace import FunctionSpace
 from dolfin.functions.function import Function
 
+__all__ = ["interpolate"]
+
+
 def interpolate(v, V):
-    """
-    Return interpolation of a given function into a given finite element space.
+    """Return interpolation of a given function into a given finite
+    element space.
 
     *Arguments*
         v
@@ -41,7 +43,7 @@ def interpolate(v, V):
             an :py:class:`Expression <dolfin.functions.expression.Expression>`
         V
             a :py:class:`FunctionSpace (standard, mixed, etc.)
-            <dolfin.functions.functionspace.FunctionSpaceBase>`
+            <dolfin.functions.functionspace.FunctionSpace>`
 
     *Example of usage*
 
@@ -54,7 +56,7 @@ def interpolate(v, V):
     """
 
     # Check arguments
-    if not isinstance(V, FunctionSpaceBase):
+    if not isinstance(V, FunctionSpace):
         cpp.dolfin_error("interpolation.py",
                          "compute interpolation",
                          "Illegal function space for interpolation, not a FunctionSpace (%s)" % str(v))
diff --git a/site-packages/dolfin/fem/norms.py b/site-packages/dolfin/fem/norms.py
index a0934b3..4b3fcf2 100644
--- a/site-packages/dolfin/fem/norms.py
+++ b/site-packages/dolfin/fem/norms.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module provides a simple way to compute various norms of
 :py:class:`Vectors <dolfin.cpp.Vector>` and :py:class:`Functions
 <dolfin.functions.function.Function>`, including the standard
@@ -20,8 +21,6 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 
-__all__ = ["norm", "errornorm"]
-
 import ufl
 from ufl import inner, grad, div, curl, dx, FiniteElement, VectorElement, Coefficient
 from math import sqrt
@@ -32,7 +31,11 @@ from dolfin.cpp import GenericVector, GenericFunction, Function, Mesh, error, Ve
 from dolfin.fem.assembling import assemble
 from dolfin.fem.interpolation import interpolate
 from dolfin.functions.function import Function
-from dolfin.functions.functionspace import FunctionSpace, VectorFunctionSpace, TensorFunctionSpace
+from dolfin.functions.functionspace import FunctionSpace, \
+    VectorFunctionSpace, TensorFunctionSpace
+
+__all__ = ["norm", "errornorm"]
+
 
 def norm(v, norm_type="L2", mesh=None):
     """
@@ -91,14 +94,17 @@ def norm(v, norm_type="L2", mesh=None):
     """
 
     if not isinstance(v, (GenericVector, GenericFunction)):
-        raise TypeError("expected a GenericVector or GenericFunction")
+        cpp.dolfin_error("norms.py",
+                         "compute norm",
+                         "expected a GenericVector or GenericFunction")
 
     # Check arguments
     if not isinstance(norm_type, str):
         cpp.dolfin_error("norms.py",
                          "compute norm",
-                         "Norm type must be a string, not " + str(type(norm_type)))
-    if mesh is not None and not isinstance(mesh, Mesh):
+                         "Norm type must be a string, not " +
+                         str(type(norm_type)))
+    if mesh is not None and not isinstance(mesh, cpp.Mesh):
         cpp.dolfin_error("norms.py",
                          "compute norm",
                          "Expecting a Mesh, not " + str(type(mesh)))
@@ -132,7 +138,8 @@ def norm(v, norm_type="L2", mesh=None):
         else:
             cpp.dolfin_error("norms.py",
                              "compute norm",
-                             "Unknown norm type (\"%s\") for functions" % str(norm_type))
+                             "Unknown norm type (\"%s\") for functions"
+                             % str(norm_type))
     else:
         cpp.dolfin_error("norms.py",
                          "compute norm",
@@ -151,6 +158,7 @@ def norm(v, norm_type="L2", mesh=None):
     else:
         return sqrt(r)
 
+
 def errornorm(u, uh, norm_type="l2", degree_rise=3, mesh=None):
     """
     Compute and return the error :math:`e = u - u_h` in the given norm.
@@ -222,11 +230,11 @@ def errornorm(u, uh, norm_type="l2", degree_rise=3, mesh=None):
                          "Missing mesh")
 
     # Get rank
-    if not u.shape() == uh.shape():
+    if not u.ufl_shape == uh.ufl_shape:
         cpp.dolfin_error("norms.py",
                          "compute error norm",
                          "Value shapes don't match")
-    shape = u.shape()
+    shape = u.ufl_shape
     rank = len(shape)
 
     # Check that uh is associated with a finite element
@@ -247,9 +255,11 @@ def errornorm(u, uh, norm_type="l2", degree_rise=3, mesh=None):
     if rank == 0:
         V = FunctionSpace(mesh, "Discontinuous Lagrange", degree)
     elif rank == 1:
-        V = VectorFunctionSpace(mesh, "Discontinuous Lagrange", degree, dim=shape[0])
+        V = VectorFunctionSpace(mesh, "Discontinuous Lagrange", degree,
+                                dim=shape[0])
     elif rank > 1:
-        V = TensorFunctionSpace(mesh, "Discontinuous Lagrange", degree, shape=shape)
+        V = TensorFunctionSpace(mesh, "Discontinuous Lagrange", degree,
+                                shape=shape)
 
     # Interpolate functions into finite element space
     pi_u = interpolate(u, V)
diff --git a/site-packages/dolfin/fem/projection.py b/site-packages/dolfin/fem/projection.py
index d16bb47..3cbb6be 100644
--- a/site-packages/dolfin/fem/projection.py
+++ b/site-packages/dolfin/fem/projection.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module provides a simple way to compute the projection of a
 :py:class:`Function <dolfin.functions.function.Function>` or an
 :py:class:`Expression <dolfin.functions.expression.Expression>` onto a
@@ -23,8 +24,6 @@ finite element space."""
 # First added:  2008-07-13
 # Last changed: 2011-11-15
 
-__all__ = ['project']
-
 # Import UFL and SWIG-generated extension module (DOLFIN C++)
 import ufl
 import dolfin.cpp as cpp
@@ -35,13 +34,16 @@ from dolfin.functions.expression import *
 from dolfin.functions.functionspace import *
 from dolfin.fem.assembling import *
 
+__all__ = ['project']
+
+
 def project(v, V=None, bcs=None, mesh=None,
             function=None,
-            solver_type="cg",
+            solver_type="lu",
             preconditioner_type="default",
             form_compiler_parameters=None):
-    """
-    Return projection of given expression *v* onto the finite element space *V*.
+    """Return projection of given expression *v* onto the finite element
+    space *V*.
 
     *Arguments*
         v
@@ -79,21 +81,25 @@ def project(v, V=None, bcs=None, mesh=None,
 
     # Try figuring out a function space if not specified
     if V is None:
-        # Create function space based on Expression element if trying to project an Expression
+        # Create function space based on Expression element if trying
+        # to project an Expression
         if isinstance(v, Expression):
             if mesh is not None and isinstance(mesh, cpp.Mesh):
-                V = FunctionSpaceBase(mesh, v.ufl_element())
+                V = FunctionSpace(mesh, v.ufl_element())
             else:
-                raise TypeError("expected a mesh when projecting an Expression")
+                cpp.dolfin_error("projection.py",
+                                 "perform projection",
+                                 "Expected a mesh when projecting an Expression")
         else:
             # Otherwise try extracting function space from expression
             V = _extract_function_space(v, mesh)
 
     # Check arguments
-    if not isinstance(V, FunctionSpaceBase):
+    if not isinstance(V, FunctionSpace):
         cpp.dolfin_error("projection.py",
                          "compute projection",
-                         "Illegal function space for projection, not a FunctionSpace: " + str(v))
+                         "Illegal function space for projection, not a FunctionSpace: " +
+                         str(v))
 
     # Ensure we have a mesh and attach to measure
     if mesh is None:
@@ -117,19 +123,21 @@ def project(v, V=None, bcs=None, mesh=None,
 
     return function
 
+
 def _extract_function_space(expression, mesh):
     """Try to extract a suitable function space for projection of
     given expression."""
 
     # Get mesh from expression
     if mesh is None:
-        domain = expression.domain()
+        domain = expression.ufl_domain()
         if domain is not None:
-            mesh = domain.data()
+            mesh = domain.ufl_cargo()
 
     # Extract mesh from functions
     if mesh is None:
-        # (Not sure if this code is relevant anymore, the above code should cover this)
+        # (Not sure if this code is relevant anymore, the above code
+        # should cover this)
         # Extract functions
         functions = ufl.algorithms.extract_coefficients(expression)
         for f in functions:
@@ -139,17 +147,22 @@ def _extract_function_space(expression, mesh):
                     break
 
     if mesh is None:
-        raise RuntimeError("Unable to project expression, can't find a suitable mesh.")
+        cpp.dolfin_error("projection.py",
+                         "extract function space",
+                         "Unable to project expression, can't find "
+                         "a suitable mesh.")
 
     # Create function space
-    shape = expression.shape()
+    shape = expression.ufl_shape
     if shape == ():
-        V = FunctionSpace(mesh, "CG", 1)
+        V = FunctionSpace(mesh, "Lagrange", 1)
     elif len(shape) == 1:
-        V = VectorFunctionSpace(mesh, "CG", 1, dim=shape[0])
+        V = VectorFunctionSpace(mesh, "Lagrange", 1, dim=shape[0])
     elif len(shape) == 2:
-        V = TensorFunctionSpace(mesh, "CG", 1, shape=shape)
+        V = TensorFunctionSpace(mesh, "Lagrange", 1, shape=shape)
     else:
-        raise RuntimeError("Unable to project expression, unhandled rank, shape is %s." % (shape,))
+        cpp.dolfin_error("projection.py",
+                         "extract function space",
+                         "Unhandled rank, shape is %s." % (shape,))
 
     return V
diff --git a/site-packages/dolfin/fem/solving.py b/site-packages/dolfin/fem/solving.py
index 50e1b9a..ad43e79 100644
--- a/site-packages/dolfin/fem/solving.py
+++ b/site-packages/dolfin/fem/solving.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module provides a small Python layer on top of the C++
 VariationalProblem/Solver classes as well as the solve function."""
 
@@ -21,13 +22,6 @@ VariationalProblem/Solver classes as well as the solve function."""
 # Modified by Marie E. Rognes, 2011.
 # Modified by Johan Hake, 2011.
 
-__all__ = ["LinearVariationalProblem",
-           "LinearVariationalSolver",
-           "LocalSolver",
-           "NonlinearVariationalProblem",
-           "NonlinearVariationalSolver",
-           "solve"]
-
 # Import SWIG-generated extension module (DOLFIN C++)
 import dolfin.cpp as cpp
 
@@ -39,7 +33,16 @@ from dolfin.fem.form import Form
 from dolfin.fem.formmanipulations import derivative
 import six
 
-# Problem classes need special handling since they involve JIT compilation
+__all__ = ["LinearVariationalProblem",
+           "LinearVariationalSolver",
+           "LocalSolver",
+           "NonlinearVariationalProblem",
+           "NonlinearVariationalSolver",
+           "solve"]
+
+# Problem classes need special handling since they involve JIT
+# compilation
+
 
 class LinearVariationalProblem(cpp.LinearVariationalProblem):
 
@@ -81,12 +84,13 @@ class LinearVariationalProblem(cpp.LinearVariationalProblem):
         # Initialize C++ base class
         cpp.LinearVariationalProblem.__init__(self, a, L, u, bcs)
 
+
 class LocalSolver(cpp.LocalSolver):
 
     # Reuse C++ doc-string
     __doc__ = cpp.LocalSolver.__doc__
 
-    def __init__(self, a, L=None, solver_type=cpp.LocalSolver.LU):
+    def __init__(self, a, L=None, solver_type=cpp.LocalSolver.SolverType_LU):
         """Create a local (cell-wise) solver for a linear variational problem
         a(u, v) = L(v).
 
@@ -147,18 +151,16 @@ class NonlinearVariationalProblem(cpp.NonlinearVariationalProblem):
             J = Form(J, form_compiler_parameters=form_compiler_parameters)
 
         # Initialize C++ base class
-        if J is None:
-            cpp.NonlinearVariationalProblem.__init__(self, F, u, bcs)
-        else:
-            cpp.NonlinearVariationalProblem.__init__(self, F, u, bcs, J)
+        cpp.NonlinearVariationalProblem.__init__(self, F, u, bcs, J)
+
 
 # Solver classes are imported directly
 from dolfin.cpp import LinearVariationalSolver, NonlinearVariationalSolver
 from dolfin.fem.adaptivesolving import AdaptiveLinearVariationalSolver
 from dolfin.fem.adaptivesolving import AdaptiveNonlinearVariationalSolver
 
-# Solve function handles both linear systems and variational problems
 
+# Solve function handles both linear systems and variational problems
 def solve(*args, **kwargs):
     """Solve linear system Ax = b or variational problem a == L or F == 0.
 
@@ -188,26 +190,26 @@ def solve(*args, **kwargs):
 
     .. code-block:: python
 
-        list_lu_methods()
+        list_lu_solver_methods()
 
     To list all available Krylov methods, run the following command:
 
     .. code-block:: python
 
-        list_krylov_methods()
+        list_krylov_solver_methods()
 
     To list all available preconditioners, run the following command:
 
     .. code-block:: python
 
-        list_preconditioners()
+        list_krylov_solver_preconditioners()
 
     To list all available solver methods, including LU methods, Krylov
     methods and, possibly, other methods, run the following command:
 
     .. code-block:: python
 
-        list_solver_methods()
+        list_linear_solver_methods()
 
     *2. Solving linear variational problems*
 
@@ -231,7 +233,7 @@ def solve(*args, **kwargs):
 
     .. code-block:: python
 
-        info(LinearVariationalSolver.default_parameters(), 1)
+        info(LinearVariationalSolver.default_parameters(), True)
 
     *3. Solving nonlinear variational problems*
 
@@ -257,9 +259,9 @@ def solve(*args, **kwargs):
 
     For available choices for the 'solver_parameters' kwarg, look at:
 
-        .. code-block:: python
+    .. code-block:: python
 
-        info(NonlinearVariationalSolver.default_parameters(), 1)
+        info(NonlinearVariationalSolver.default_parameters(), True)
 
     *4. Solving linear/nonlinear variational problems adaptively
 
@@ -292,7 +294,8 @@ def solve(*args, **kwargs):
     if "tol" in kwargs:
         _solve_varproblem_adaptive(*args, **kwargs)
 
-    # Call variational problem solver if we get an equation (but not a tolerance)
+    # Call variational problem solver if we get an equation (but not a
+    # tolerance)
     elif isinstance(args[0], ufl.classes.Equation):
         _solve_varproblem(*args, **kwargs)
 
@@ -301,11 +304,12 @@ def solve(*args, **kwargs):
         if kwargs:
             cpp.dolfin_error("solving.py",
                              "solve linear algebra problem",
-                             "Not expecting keyword arguments when solving "\
+                             "Not expecting keyword arguments when solving "
                              "linear algebra problem")
 
         return cpp.la_solve(*args)
 
+
 def _solve_varproblem(*args, **kwargs):
     "Solve variational problem a == L or F == 0"
 
@@ -318,7 +322,7 @@ def _solve_varproblem(*args, **kwargs):
 
         # Create problem
         problem = LinearVariationalProblem(eq.lhs, eq.rhs, u, bcs,
-                    form_compiler_parameters=form_compiler_parameters)
+                                           form_compiler_parameters=form_compiler_parameters)
 
         # Create solver and call solve
         solver = LinearVariationalSolver(problem)
@@ -337,19 +341,20 @@ def _solve_varproblem(*args, **kwargs):
 
         # Create problem
         problem = NonlinearVariationalProblem(eq.lhs, u, bcs, J,
-                    form_compiler_parameters=form_compiler_parameters)
+                                              form_compiler_parameters=form_compiler_parameters)
 
         # Create solver and call solve
         solver = NonlinearVariationalSolver(problem)
         solver.parameters.update(solver_parameters)
         solver.solve()
 
+
 def _solve_varproblem_adaptive(*args, **kwargs):
     "Solve variational problem a == L or F == 0 adaptively"
 
     # Extract arguments
-    eq, u, bcs, J, tol, M, form_compiler_parameters, solver_parameters \
-        = _extract_args(*args, **kwargs)
+    eq, u, bcs, J, tol, M, form_compiler_parameters, \
+        solver_parameters = _extract_args(*args, **kwargs)
 
     # Check that we received the goal functional
     if M is None:
@@ -362,7 +367,7 @@ def _solve_varproblem_adaptive(*args, **kwargs):
 
         # Create problem
         problem = LinearVariationalProblem(eq.lhs, eq.rhs, u, bcs,
-                    form_compiler_parameters=form_compiler_parameters)
+                                           form_compiler_parameters=form_compiler_parameters)
 
         # Create solver and call solve
         solver = AdaptiveLinearVariationalSolver(problem, M)
@@ -381,13 +386,14 @@ def _solve_varproblem_adaptive(*args, **kwargs):
 
         # Create problem
         problem = NonlinearVariationalProblem(eq.lhs, u, bcs, J,
-                    form_compiler_parameters=form_compiler_parameters)
+                                              form_compiler_parameters=form_compiler_parameters)
 
         # Create solver and call solve
         solver = AdaptiveNonlinearVariationalSolver(problem, M)
         solver.parameters.update(solver_parameters)
         solver.solve(tol)
 
+
 def _extract_args(*args, **kwargs):
     "Common extraction of arguments for _solve_varproblem[_adaptive]"
 
@@ -395,23 +401,23 @@ def _extract_args(*args, **kwargs):
     valid_kwargs = ["bcs", "J", "tol", "M",
                     "form_compiler_parameters", "solver_parameters"]
     for kwarg in six.iterkeys(kwargs):
-        if not kwarg in valid_kwargs:
+        if kwarg not in valid_kwargs:
             cpp.dolfin_error("solving.py",
                              "solve variational problem",
-                             "Illegal keyword argument \"%s\"; valid keywords are %s" % \
-                                 (kwarg,
-                                  ", ".join("\"%s\"" % kwarg for kwarg in valid_kwargs)))
+                             "Illegal keyword argument \"%s\"; valid keywords are %s" %
+                             (kwarg,
+                              ", ".join("\"%s\"" % kwarg for kwarg in valid_kwargs)))
 
     # Extract equation
     if not len(args) >= 2:
         cpp.dolfin_error("solving.py",
                          "solve variational problem",
-                         "Missing arguments, expecting solve(lhs == rhs, "\
+                         "Missing arguments, expecting solve(lhs == rhs, "
                          "u, bcs=bcs), where bcs is optional")
     if len(args) > 3:
         cpp.dolfin_error("solving.py",
                          "solve variational problem",
-                         "Too many arguments, expecting solve(lhs == rhs, "\
+                         "Too many arguments, expecting solve(lhs == rhs, "
                          "u, bcs=bcs), where bcs is optional")
 
     # Extract equation
@@ -455,6 +461,7 @@ def _extract_args(*args, **kwargs):
 
     return eq, u, bcs, J, tol, M, form_compiler_parameters, solver_parameters
 
+
 def _extract_eq(eq):
     "Extract and check argument eq"
     if not isinstance(eq, ufl.classes.Equation):
@@ -463,6 +470,7 @@ def _extract_eq(eq):
                          "Expecting first argument to be an Equation")
     return eq
 
+
 def _extract_u(u):
     "Extract and check argument u"
     if not isinstance(u, cpp.Function):
@@ -471,6 +479,7 @@ def _extract_u(u):
                          "Expecting second argument to be a Function")
     return u
 
+
 def _extract_bcs(bcs):
     "Extract and check argument bcs"
     if bcs is None:
diff --git a/site-packages/dolfin/functions/__init__.py b/site-packages/dolfin/functions/__init__.py
index c941abe..fa51560 100644
--- a/site-packages/dolfin/functions/__init__.py
+++ b/site-packages/dolfin/functions/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """The function module of dolfin"""
 
 from dolfin.functions import functionspace
diff --git a/site-packages/dolfin/functions/constant.py b/site-packages/dolfin/functions/constant.py
index 0284c6a..21138b3 100644
--- a/site-packages/dolfin/functions/constant.py
+++ b/site-packages/dolfin/functions/constant.py
@@ -1,6 +1,7 @@
+# -*- coding: utf-8 -*-
 """Create a constant-valued function with given value."""
 
-# Copyright (C) 2008-2009 Anders Logg
+# Copyright (C) 2008-2015 Anders Logg
 #
 # This file is part of DOLFIN.
 #
@@ -18,9 +19,7 @@
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
 # Modified by Johan Hake, 2008.
-#
-# First added:  2008-12-02
-# Last changed: 2010-08-16
+# Modified by Martin Sandve Alnæs, 2008.
 
 from __future__ import print_function
 
@@ -65,13 +64,11 @@ class Constant(ufl.Coefficient, cpp.Constant):
 
         """
 
-        if cell is None:
-            domain = None
-        else:
-            #deprecation_warning("The cell argument is no longer necessary.")
-            domain = ufl.as_domain(cell)
-            if not isinstance(domain, ufl.Domain):
-                raise TypeError("Expected an ufl.Domain as the second argument")
+        # TODO: Either take mesh instead of cell, or drop cell and let
+        # grad(c) be undefined.
+        if cell is not None:
+            cell = ufl.as_cell(cell)
+        ufl_domain = None
 
         array = numpy.array(value)
         rank = len(array.shape)
@@ -79,28 +76,29 @@ class Constant(ufl.Coefficient, cpp.Constant):
 
         # Create UFL element and initialize constant
         if rank == 0:
-            self._ufl_element = ufl.FiniteElement("Real",
-                                                  domain, 0)
+            ufl_element = ufl.FiniteElement("Real", cell, 0)
             cpp.Constant.__init__(self, floats[0])
         elif rank == 1:
-            self._ufl_element = ufl.VectorElement("Real",
-                                                  domain, 0, len(floats))
+            ufl_element = ufl.VectorElement("Real", cell, 0, dim=len(floats))
             cpp.Constant.__init__(self, floats)
         else:
-            self._ufl_element = ufl.TensorElement("Real",
-                                                  domain, 0, shape=array.shape)
+            ufl_element = ufl.TensorElement("Real", cell, 0, shape=array.shape)
             cpp.Constant.__init__(self, list(array.shape), floats)
 
         # Initialize base classes
-        ufl.Coefficient.__init__(self, self._ufl_element, count=self.id())
+        ufl_function_space = ufl.FunctionSpace(ufl_domain, ufl_element)
+        ufl.Coefficient.__init__(self, ufl_function_space, count=self.id())
 
         # Set name as given or automatic
         name = name or "f_%d" % self.count()
         self.rename(name, "a Constant")
 
+    def cell(self):
+        return self.ufl_element().cell()
+
     def __float__(self):
         # Overriding UFL operator in this particular case.
-        if self.shape():
+        if self.ufl_shape:
             raise TypeError("Cannot convert nonscalar constant to float.")
         return cpp.Constant.__float__(self)
 
diff --git a/site-packages/dolfin/functions/expression.py b/site-packages/dolfin/functions/expression.py
index 517dfc6..22f44fb 100644
--- a/site-packages/dolfin/functions/expression.py
+++ b/site-packages/dolfin/functions/expression.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module handles the Expression class in Python.
 
 The Expression class needs special handling and is not mapped directly
@@ -53,7 +54,7 @@ create_compiled_expression_class.
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
 # Modified by Anders Logg, 2008-2009.
-# Modified by Martin S. Alnaes 2013-2014
+# Modified by Martin Sandve Alnæs 2013-2014
 
 from __future__ import print_function
 
@@ -70,6 +71,7 @@ from six import add_metaclass # Requires newer six version than some buildbots h
 
 # Import UFL and SWIG-generated extension module (DOLFIN C++)
 import ufl
+from ufl import product
 from ufl.utils.indexflattening import flatten_multiindex, shape_to_strides
 import dolfin.cpp as cpp
 import numpy
@@ -81,13 +83,15 @@ from dolfin.compilemodules.expressions import compile_expressions
 from functools import reduce
 from six.moves import xrange as range
 
+
 # Local help class
 class UserDefinedParameters(dict):
     """
     Help class to set user defined parameters in Expressions
     """
+
     def __init__(self, expr, **kwargs):
-        assert(isinstance(expr, cpp.Expression))
+        assert isinstance(expr, cpp.Expression)
         self._expr = expr
         dict.__init__(self, **kwargs)
 
@@ -107,45 +111,70 @@ class UserDefinedParameters(dict):
             for name, value in other:
                 self[name] = value
 
+
 def create_compiled_expression_class(cpp_base):
     # Check the cpp_base
-    assert(isinstance(cpp_base, type))
+    assert isinstance(cpp_base, type)
 
-    def __init__(self, cppcode, element=None, cell=None, domain=None, \
-                 degree=None, name=None, label=None, **kwargs):
+    def __init__(self, cppcode, *args, **kwargs):
         """Initialize the Expression """
         # Initialize the cpp base class first and extract value_shape
         cpp_base.__init__(self)
-        value_shape = tuple(self.value_dimension(i) \
+
+        element = kwargs.pop("element", None)
+        degree = kwargs.pop("degree", None)
+        cell = kwargs.pop("cell", None)
+        domain = kwargs.pop("domain", None)
+        name = kwargs.pop("name", None)
+        label = kwargs.pop("label", None)
+        mpi_commm = kwargs.pop("mpi_comm", None)
+
+        value_shape = tuple(self.value_dimension(i)
                             for i in range(self.value_rank()))
 
         # Store the value_shape
         self._value_shape = value_shape
 
+        # Some messy cell/domain handling for compatibility, will be
+        # straightened out later
+        if domain is None:
+            ufl_domain = None
+        else:
+            if isinstance(domain, ufl.domain.AbstractDomain):
+                ufl_domain = domain
+            else:
+                # Probably getting a Mesh here, from existing dolfin
+                # tests. Will be the same later anyway.
+                ufl_domain = domain.ufl_domain()
+            if cell is None:
+                cell = ufl_domain.ufl_cell()
+
+
         # Select an appropriate element if not specified
         if element is None:
-            element = _auto_select_element_from_shape(value_shape, degree, cell, domain)
+            element = _auto_select_element_from_shape(value_shape, degree, cell)
         else:
             # Check that we have an element
             if not isinstance(element, ufl.FiniteElementBase):
                 raise TypeError("The 'element' argument must be a UFL"\
-                      " finite element.")
+                                " finite element.")
 
-            # Check same value shape of compiled expression and passed element
-            if not element.value_shape() == value_shape:
-                raise ValueError("The value shape of the passed 'element',"\
-                      " is not equal to the value shape of the compiled "\
-                      "expression.")
+        # Check that compiled expression and passed element have the
+        # same value shape
+        if not element.value_shape() == value_shape:
+            raise ValueError("The value shape of the passed 'element',"\
+                             " is not equal to the value shape of the compiled "\
+                             "expression.")
 
         # Initialize UFL base class
-        self._ufl_element = element
-        ufl.Coefficient.__init__(self, self._ufl_element, count=self.id())
+        ufl_function_space = ufl.FunctionSpace(ufl_domain, element)
+        ufl.Coefficient.__init__(self, ufl_function_space, count=self.id())
 
         # Set default variables
         for member, value in list(kwargs.items()):
             setattr(self, member, value)
 
-        name = name or "f_" + str(ufl.Coefficient.count(self))
+        name = name or "f_" + str(self.count())
         label = label or "User defined expression"
 
         self.rename(name, label)
@@ -154,16 +183,17 @@ def create_compiled_expression_class(cpp_base):
         self.user_parameters = UserDefinedParameters(self, **kwargs)
 
     # Create and return the class
-    return type("CompiledExpression", (Expression, ufl.Coefficient, cpp_base),\
-                {"__init__":__init__})
+    return type("CompiledExpression", (Expression, ufl.Coefficient, cpp_base),
+                {"__init__": __init__})
+
 
 def create_python_derived_expression_class(class_name, user_bases, user_dict):
     """Return Expression class
 
-    This function is used to create all the dynamically created Expression
-    classes. It takes a class_name, and a compiled cpp.Expression and returns
-    a class that inherits the compiled class together with dolfin.Expression
-    and ufl.Coefficient.
+    This function is used to create all the dynamically created
+    Expression classes. It takes a class_name, and a compiled
+    cpp.Expression and returns a class that inherits the compiled
+    class together with dolfin.Expression and ufl.Coefficient.
 
     *Arguments*
         class_name
@@ -172,15 +202,16 @@ def create_python_derived_expression_class(class_name, user_bases, user_dict):
             User defined bases
         user_dict
             Dict with user specified function or attributes
+
     """
 
     # Check args
-    assert(isinstance(class_name, str))
-    assert(isinstance(user_bases, list))
-    assert(isinstance(user_dict, dict))
+    assert isinstance(class_name, str)
+    assert isinstance(user_bases, list)
+    assert isinstance(user_dict, dict)
 
     # Define the bases
-    assert(all([isinstance(t, (type, type)) for t in user_bases]))
+    assert all([isinstance(t, (type, type)) for t in user_bases])
     bases = tuple([Expression, ufl.Coefficient, cpp.Expression] + user_bases)
 
     user_init = user_dict.pop("__init__", None)
@@ -199,38 +230,51 @@ def create_python_derived_expression_class(class_name, user_bases, user_dict):
         domain = kwargs.get("domain", None)
         name = kwargs.get("name", None)
         label = kwargs.get("label", None)
+        mpi_comm = kwargs.get("mpi_comm", None)
 
-        # Check if user has passed too many arguments if no
-        # user_init is provided
+        # Check if user has passed too many arguments if no user_init
+        # is provided
         if user_init is None:
-            from operator import add
             # First count how many valid kwargs is passed
-            num_valid_kwargs = reduce(add, [kwarg is not None \
-                                      for kwarg in [element, degree, cell, domain, name, label]])
+            num_valid_kwargs = sum(1 if kwarg is not None else 0
+                                   for kwarg in [element, degree, cell, domain,
+                                                 name, label, mpi_comm])
             if len(kwargs) != num_valid_kwargs:
                 raise TypeError("expected only 'kwargs' from one of "\
-                      "'element', 'degree', 'cell', 'domain', 'name' or 'label'")
+                                "'element', 'degree', 'cell', 'domain', 'name', 'label', or 'mpi_comm'")
             if len(args) != 0:
                 raise TypeError("expected no 'args'")
 
+
+        # Some messy cell/domain handling for compatibility, will be
+        # straightened out later
+        if domain is None:
+            ufl_domain = None
+        else:
+            if isinstance(domain, ufl.domain.AbstractDomain):
+                ufl_domain = domain
+            else:
+                # Probably getting a Mesh here, from existing dolfin
+                # tests. Will be the same later anyway.
+                ufl_domain = domain.ufl_domain()
+            if cell is None:
+                cell = ufl_domain.ufl_cell()
+
+
         # Select an appropriate element if not specified
         if element is None:
             element = _auto_select_element_from_shape(self.value_shape(),
-                                                      degree, cell, domain)
-        elif isinstance(element, ufl.FiniteElementBase):
-            pass
+                                                      degree, cell)
         else:
-            raise TypeError("The 'element' argument must be a UFL finite"\
-                  " element.")
+            if not isinstance(element, ufl.FiniteElementBase):
+                raise TypeError("The 'element' argument must be a UFL finite element.")
 
         # Initialize cpp_base class
         cpp.Expression.__init__(self, list(element.value_shape()))
 
         # Initialize UFL base class
-        ufl.Coefficient.__init__(self, element, count=self.id())
-
-        # Why do we store the ufl element here in addition to in ufl.Coefficient? It's available as self.element()...
-        self._ufl_element = element
+        ufl_function_space = ufl.FunctionSpace(ufl_domain, element)
+        ufl.Coefficient.__init__(self, ufl_function_space, count=self.id())
 
         # Calling the user defined_init
         if user_init is not None:
@@ -245,18 +289,18 @@ def create_python_derived_expression_class(class_name, user_bases, user_dict):
     # NOTE: Why not?
 
     ## Collect reserved attributes from both cpp.Function and ufl.Coefficient
-    #reserved_attr = dir(ufl.Coefficient)
-    #reserved_attr.extend(dir(cpp.Function))
+    # reserved_attr = dir(ufl.Coefficient)
+    # reserved_attr.extend(dir(cpp.Function))
     #
-    ## Remove attributes that will be set by python
-    #for attr in ["__module__"]:
+    # # Remove attributes that will be set by python
+    # for attr in ["__module__"]:
     #    while attr in reserved_attr:
     #        reserved_attr.remove(attr)
     #
     ## Check the dict_ for reserved attributes
-    #for attr in reserved_attr:
+    # for attr in reserved_attr:
     #    if attr in dict_:
-    #        raise TypeError("The Function attribute '%s' is reserved by PyDOLFIN."%attr)
+    #        raise TypeError("The Function attribute '%s' is reserved by PyDOLFIN." % attr)
 
     # Add __init__ to the user_dict
     user_dict["__init__"]  = __init__
@@ -264,14 +308,15 @@ def create_python_derived_expression_class(class_name, user_bases, user_dict):
     # Create the class and return it
     return type(class_name, bases, user_dict)
 
+
 class ExpressionMetaClass(type):
     """Meta Class for Expression"""
     def __new__(mcs, class_name, bases, dict_):
         """Returns a new Expression class"""
 
-        assert(isinstance(class_name, str)), "Expecting a 'str'"
-        assert(isinstance(bases, tuple)), "Expecting a 'tuple'"
-        assert(isinstance(dict_, dict)), "Expecting a 'dict'"
+        assert isinstance(class_name, str), "Expecting a 'str'"
+        assert isinstance(bases, tuple), "Expecting a 'tuple'"
+        assert isinstance(dict_, dict), "Expecting a 'dict'"
 
         # First check if we are creating the Expression class
         if class_name == "Expression":
@@ -282,18 +327,21 @@ class ExpressionMetaClass(type):
             #        ...
             if len(bases) > 1 and bases[0] != object:
                 raise TypeError("Cannot name a subclass of Expression:"\
-                      " 'Expression'")
+                                " 'Expression'")
 
-            # Return the new class, which just is the original Expression defined in
-            # this module
+            # Return the new class, which just is the original
+            # Expression defined in this module
             return type.__new__(mcs, class_name, bases, dict_)
 
-        # If creating a fullfledged derived expression class, i.e, inheriting
-        # dolfin.Expression, ufl.Coefficient and cpp.Expression (or a subclass)
-        # then just return the new class.
-        if len(bases) >= 3 and bases[0] == Expression and \
-               bases[1] == ufl.Coefficient and issubclass(bases[2], \
-                                                          cpp.Expression):
+        # If creating a fullfledged derived expression class, i.e,
+        # inheriting dolfin.Expression, ufl.Coefficient and
+        # cpp.Expression (or a subclass) then just return the new
+        # class.
+        if (len(bases) >= 3
+            and bases[0] == Expression
+            and bases[1] == ufl.Coefficient
+            and issubclass(bases[2], cpp.Expression)):
+
             # Return the instantiated class
             return type.__new__(mcs, class_name, bases, dict_)
 
@@ -303,7 +351,8 @@ class ExpressionMetaClass(type):
         # remove Expression, to be added later
         user_bases.remove(Expression)
 
-        # Check the user has provided either an eval or eval_cell method
+        # Check the user has provided either an eval or eval_cell
+        # method
         if not ('eval' in dict_ or 'eval_cell' in dict_):
             raise TypeError("expected an overload 'eval' or 'eval_cell' method")
 
@@ -314,53 +363,51 @@ class ExpressionMetaClass(type):
 
         # Check type and number of arguments of user_eval function
         if not isinstance(user_eval, types.FunctionType):
-            raise TypeError("'%s' attribute must be a 'function'"%eval_name)
-        if eval_name == "eval" and not user_eval.__code__.co_argcount == 3:
+            raise TypeError("'%s' attribute must be a 'function'" % eval_name)
+        if eval_name == "eval" and user_eval.__code__.co_argcount != 3:
             raise TypeError("The overloaded '%s' function must use "\
-                  "three arguments"%eval_name)
-        if eval_name == "eval_cell" and \
-               not user_eval.__code__.co_argcount == 4:
+                            "three arguments" % eval_name)
+        if eval_name == "eval_cell" and user_eval.__code__.co_argcount != 4:
             raise TypeError("The overloaded '%s' function must "\
-                  "use three arguments"%eval_name)
+                            "use three arguments" % eval_name)
 
         return create_python_derived_expression_class(class_name, user_bases, dict_)
 
-#--- The user interface ---
+
+# --- The user interface ---
 
 # Places here so it can be reused in Function
 @add_metaclass(ExpressionMetaClass)
 class Expression(object):
-    """
-    This class represents a user-defined expression.
+    """This class represents a user-defined expression.
 
     Expressions can be used as coefficients in variational forms or
-    interpolated into finite element spaces.
+    interpolated into finite element spaces. An element or degree must
+    be provided.
 
     *Arguments*
         cppcode
            C++ argument, see below
         element
-            Optional element argument
+            Element argument (required if degree is not specified)
         degree
-            Optional element degree when element is not given.
+            Element degree when element is not given.
         cell
             Optional cell argument to used in code generation
         domain
             Optional argument to determine the geometric dimension
-        degree
-            Optional argument to determine the degree of the element
         name
             Optional argument to set name of the Variable
         label
             Optional argument to set label of Variable
-            
+
         mpi_comm
-            Optional argument to allow JIT compilation on mpi groups. The 
+            Optional argument to allow JIT compilation on mpi groups. The
             Expression is only available at ranks in the same group.
             The Expression is JIT compiled on the first rank of the group.
 
-    *1. Simple user-defined JIT-compiled expressions*
-        One may alternatively specify a C++ code for evaluation of the
+    *1. Simple user-defined JIT-compiled expressions* One may
+        alternatively specify a C++ code for evaluation of the
         Expression as follows:
 
         .. code-block:: python
@@ -375,7 +422,10 @@ class Expression(object):
         .. code-block:: python
 
             f2 = Expression((('exp(x[0])','sin(x[1])'),
-                            ('sin(x[0])','tan(x[1])')))
+                            ('sin(x[0])','tan(x[1])')), degree=2)
+
+        Here, the Expression will be interpolated using Lagrange
+        polynomials of degree 2 when used in a form.
 
         In general, a single string expression will be interpreted as
         a scalar, a tuple of strings as a tensor of rank 1 (a vector)
@@ -395,13 +445,13 @@ class Expression(object):
 
         The parameters can be scalars and any scalar valued
         GenericFunction and are all initialized to the passed default
-        value. The user defined parameters can be accessed and set
-        as attributes or via the dict-like user_parameters attribute:
+        value. The user defined parameters can be accessed and set as
+        attributes or via the dict-like user_parameters attribute:
 
         .. code-block:: python
 
             f.A = 5.0
-            f.B = Expression("value", value=6.0)
+            f.B = Expression("value", value=6.0, degree=1)
             f.user_parameters["A"] = 1.0
             f.user_parameters["B"] = Constant(5.0)
 
@@ -409,10 +459,10 @@ class Expression(object):
         value-type. So if a parameter is a float, it can only be
         updated with float.
 
-    *2. Complex user-defined JIT-compiled Expressions*
-        One may also define an Expression using more complicated logic
-        with the 'cppcode' argument. This argument should be a string
-        of C++ code that implements a class that inherits from
+    *2. Complex user-defined JIT-compiled Expressions* One may also
+        define an Expression using more complicated logic with the
+        'cppcode' argument. This argument should be a string of C++
+        code that implements a class that inherits from
         dolfin::Expression.
 
         The following code illustrates how to define an Expression
@@ -434,8 +484,8 @@ class Expression(object):
               {
               }
 
-            void eval(Array<double>& values, const Array<double>& x,
-                      const ufc::cell& c) const
+              void eval(Array<double>& values, const Array<double>& x,
+                        const ufc::cell& c) const
               {
                 assert(cell_data);
                 const Cell cell(*cell_data->mesh(), c.index);
@@ -454,7 +504,7 @@ class Expression(object):
             };'''
 
             cell_data = CellFunction('uint', V.mesh())
-            f = Expression(code)
+            f = Expression(code, degree=1)
             f.cell_data = cell_data
 
         While JIT compiling an Expression the public interface is
@@ -500,13 +550,15 @@ class Expression(object):
               };
             }'''
 
-            e = Expression(code)
+            e = Expression(code, degree=2)
 
-    *3. User-defined expressions by subclassing*
-        The user can subclass Expression and overload the 'eval'
-        function. The value_shape of such an Expression will default
-        to 0. If a user wants a vector or tensor Expression, the
-        value_shape method needs to be overloaded.
+    *3. User-defined expressions by subclassing* The user can subclass
+        Expression and overload the 'eval' function. The value_shape
+        of such an Expression will default to 0. If a user wants a
+        vector or tensor Expression, the value_shape method needs to
+        be overloaded. The user must provide at least the polynomial
+        degree of the finite element basis used when using the
+        Expression in a finite element form.
 
         .. code-block:: python
 
@@ -518,10 +570,10 @@ class Expression(object):
                     value[1] = 250.0*exp(-(dx*dx + dy*dy)/0.01)
                 def value_shape(self):
                     return (2,)
-            f0 = MyExpression0()
+            f0 = MyExpression0(degree=2)
 
         If a user wants to use the Expression in a UFL form and have
-        more controll in which finite element should be used to
+        more control in which finite element should be used to
         interpolate the expression in, the user can pass this
         information using the element kwarg:
 
@@ -544,7 +596,7 @@ class Expression(object):
                     else:
                         value[0] = -1.0
 
-            f2 = MyExpression1()
+            f2 = MyExpression1(degree=1)
 
         The ufc_cell object can be queried for the following data:
 
@@ -558,9 +610,9 @@ class Expression(object):
             ufc_cell.mesh_identifier
 
         The user can customize initialization of derived Expressions.
-        However, because of magic behind the scenes, a user needs to pass
-        optional arguments to __init__ using ``**kwargs``, and _not_
-        calling the base class __init__:
+        However, because of magic behind the scenes, a user needs to
+        pass optional arguments to __init__ using ``**kwargs``, and
+        _not_ calling the base class __init__:
 
         .. code-block:: python
 
@@ -571,7 +623,7 @@ class Expression(object):
                 def eval(self, values, x):
                     ...
 
-            f3 = MyExpression1(mesh=mesh, domain=domain)
+            f3 = MyExpression1(degree=0, mesh=mesh, domain=domain)
 
         Note that subclassing may be significantly slower than using
         JIT-compiled expressions. This is because a callback from C++
@@ -580,12 +632,11 @@ class Expression(object):
 
     """
 
-    def __new__(cls, cppcode=None, element=None, cell=None, domain=None, degree=None, \
-                name=None, label=None, mpi_comm=None, **kwargs):
+    def __new__(cls, cppcode=None, *args, **kwargs):
 
-        # If the __new__ function is called because we are instantiating
-        # a python sub class of Expression, then just return a new instant
-        # of the passed class
+        # If the __new__ function is called because we are
+        # instantiating a python sub class of Expression, then just
+        # return a new instance of the passed class
         if cls.__name__ != "Expression":
             return object.__new__(cls)
 
@@ -598,14 +649,15 @@ class Expression(object):
 
         # Compile module and get the cpp.Expression class
         cpp_base, members = compile_expressions([cppcode],
-                                                [generic_function_members], \
-                                                mpi_comm=mpi_comm)
+                                                [generic_function_members],
+                                                mpi_comm=kwargs.get("mpi_comm"))
         cpp_base, members = cpp_base[0], members[0]
 
         # Check passed default arguments
-        not_allowed = [n for n in dir(cls) if n[0] !="_"]
+        not_allowed = [n for n in dir(cls) if n[0] != "_"]
         not_allowed += ["cppcode", "user_parameters"]
-        _check_kwargs(members, kwargs, not_allowed)
+        valid_kws = ["element", "cell", "domain", "degree", "name", "label", "mpi_comm"]
+        _check_kwargs(members, kwargs, not_allowed, valid_kws)
 
         # Store compile arguments for later use
         cpp_base.cppcode = cppcode
@@ -615,16 +667,14 @@ class Expression(object):
 
     # This method is only included so a user can check what arguments
     # one should use in IPython using tab completion
-    def __init__(self, cppcode=None, element=None, cell=None, domain=None, degree=None, \
-                 name=None, label=None, mpi_comm=None, **kwargs): pass
+    def __init__(self, cppcode=None, element=None, cell=None, domain=None,
+                 degree=None, name=None, label=None, mpi_comm=None, **kwargs):
+        cpp.dolfin_error("expression.py", "initialize Expression",
+                         "Calling 'Expression.__init__' has no effect")
 
     # Reuse the docstring from __new__
     __init__.__doc__ = __new__.__doc__
 
-    def ufl_element(self):
-        "Return the ufl FiniteElement."
-        return self._ufl_element
-
     def __str__(self):
         "x.__str__() <==> print(x)"
         return self.name()
@@ -651,9 +701,9 @@ class Expression(object):
         assert derivatives == () # TODO: Handle derivatives
 
         if component:
-            shape = self.shape()
+            shape = self.ufl_shape
             assert len(shape) == len(component)
-            value_size = ufl.common.product(shape)
+            value_size = product(shape)
             index = flatten_multiindex(component, shape_to_strides(shape))
             values = numpy.zeros(value_size)
             self(*x, values=values)
@@ -721,38 +771,39 @@ class Expression(object):
             raise TypeError("expected at least 1 argument")
 
         # Test for ufl restriction
-        if len(args) == 1 and args[0] in ('+','-'):
-            return ufl.Coefficient.__call__(self, *args)
+        if len(args) == 1 and isinstance(args[0], str):
+            if args[0] in ('+', '-'):
+                return ufl.Coefficient.__call__(self, *args)
 
         # Test for ufl mapping
         if len(args) == 2 and isinstance(args[1], dict) and self in args[1]:
             return ufl.Coefficient.__call__(self, *args)
 
         # Some help variables
-        value_size = ufl.common.product(self.ufl_element().value_shape())
+        value_size = product(self.ufl_element().value_shape())
 
         # If values (return argument) is passed, check the type and length
         values = kwargs.get("values", None)
         if values is not None:
             if not isinstance(values, numpy.ndarray):
                 raise TypeError("expected a NumPy array for 'values'")
-            if len(values) != value_size or \
-                   not numpy.issubdtype(values.dtype, 'd'):
+            if len(values) != value_size or not numpy.issubdtype(values.dtype, 'd'):
                 raise TypeError("expected a double NumPy array of length"\
-                      " %d for return values."%value_size)
+                                " %d for return values." % value_size)
             values_provided = True
         else:
             values_provided = False
             values = numpy.zeros(value_size, dtype='d')
 
         # Get dim if element has any domains
-        domains = self.ufl_element().domains()
-        dim = domains[0].geometric_dimension() if domains else None
+        cell = self.ufl_element().cell()
+        dim = None if cell is None else cell.geometric_dimension()
 
         # Assume all args are x argument
         x = args
 
-        # If only one x argument has been provided, unpack it if it's an iterable
+        # If only one x argument has been provided, unpack it if it's
+        # an iterable
         if len(x) == 1:
             if isinstance(x[0], cpp.Point):
                 if dim is not None:
@@ -773,7 +824,12 @@ class Expression(object):
             raise TypeError("coordinate argument too short")
 
         if dim is None:
-            warning("Evaluating an Expression without knowing the right geometric dimension, assuming %d is correct." % len(x))
+            # Disabled warning as it breaks py.test due to excessive
+            # output, and that code that is warned about is still
+            # officially supported. See
+            # https://bitbucket.org/fenics-project/dolfin/issues/355/
+            # warning("Evaluating an Expression without knowing the right geometric dimension, assuming %d is correct." % len(x))
+            pass
         else:
             if len(x) != dim:
                 raise TypeError("expected the geometry argument to be of "\
@@ -788,7 +844,8 @@ class Expression(object):
 
         return values
 
-#--- Utility functions ---
+
+# --- Utility functions ---
 
 def _check_cppcode(cppcode):
     "Check that cppcode makes sense"
@@ -796,39 +853,37 @@ def _check_cppcode(cppcode):
     # Check that we get a string expression or nested expression
     if not isinstance(cppcode, (str, tuple, list)):
         raise TypeError("Please provide a 'str', 'tuple' or 'list' for "\
-              "the 'cppcode' argument.")
+                        "the 'cppcode' argument.")
+
 
-def _auto_select_element_from_shape(shape, degree=None, cell=None, domain=None):
+def _auto_select_element_from_shape(shape, degree=None, cell=None):
     "Automatically select an appropriate element from cppcode."
 
-    # Cell to domain conversion TODO: deprecate cell argument
-    if domain is None:
-        if cell is None:
-            pass # No domain will result in undefined element
-        else:
-            domain = ufl.as_domain(cell)
-    else:
-        if cell is None:
-            domain = ufl.as_domain(domain) # Got only domain, good!
-        else:
-            raise ValueError("Got both domain and cell, use only domain.")
+    if degree is None:
+        cpp.deprecation("Automatic determination of degree for Expressions",
+                        "2016.1",
+                        "Specify the polynomial degree for interpolation of Expression, or provide a FiniteElement")
 
     # Default element, change to quadrature when working
-    Family = "Lagrange"
+    if degree == 0:
+        Family = "Discontinuous Lagrange"
+    else:
+        Family = "Lagrange"
 
     # Check if scalar, vector or tensor valued
     if len(shape) == 0:
-        element = ufl.FiniteElement(Family, domain, degree)
+        element = ufl.FiniteElement(Family, cell, degree)
     elif len(shape) == 1:
-        element = ufl.VectorElement(Family, domain, degree, dim=shape[0])
+        element = ufl.VectorElement(Family, cell, degree, dim=shape[0])
     else:
-        element = ufl.TensorElement(Family, domain, degree, shape=shape)
+        element = ufl.TensorElement(Family, cell, degree, shape=shape)
 
     cpp.debug("Automatic selection of expression element: " + str(element))
 
     return element
 
-def _check_kwargs(members, kwargs, not_allowed):
+
+def _check_kwargs(members, kwargs, not_allowed, valid):
     """
     Check that all kwargs passed is either scalars or scalar Constants,
     and that the name is allowed
@@ -844,13 +899,13 @@ def _check_kwargs(members, kwargs, not_allowed):
         raise RuntimeError("expected a default value to all member "\
                            "variables in the Expression. Missing: %s." % missing)
 
-    for name in list(kwargs.keys()):
+    for name, value in kwargs.items():
+        if name in valid:
+            continue
         if name in not_allowed:
             raise RuntimeError("Parameter name: '%s' is not allowed. It is "\
                                "part of the interface of Expression" % name)
-
-    if not (all(isinstance(value, (int, float)) or \
-                (isinstance(value, cpp.GenericFunction) and value.value_size()==1) \
-                for value in list(kwargs.values()))):
-        raise TypeError("expected default arguments for member variables "\
-              "to be scalars or a scalar GenericFunctions.")
+        if not (isinstance(value, (int, float)) or
+                (isinstance(value, cpp.GenericFunction) and value.value_size() == 1)):
+            raise TypeError("expected default arguments for member variables "\
+                            "to be scalars or a scalar GenericFunctions.")
diff --git a/site-packages/dolfin/functions/function.py b/site-packages/dolfin/functions/function.py
index 6773cc6..7943a34 100644
--- a/site-packages/dolfin/functions/function.py
+++ b/site-packages/dolfin/functions/function.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module handles the Function class in Python.
 """
 # Copyright (C) 2009-2014 Johan Hake
@@ -17,7 +18,8 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
-# Modified by Martin S. Alnaes 2013-2014
+# Modified by Martin Sandve Alnæs 2013-2014
+# Modified by Anders Logg 2015
 
 __all__ = ["Function", "TestFunction", "TrialFunction", "Argument",
            "TestFunctions", "TrialFunctions"]
@@ -26,11 +28,12 @@ import types
 
 # Import UFL and SWIG-generated extension module (DOLFIN C++)
 import ufl
+from ufl import product
 from ufl.utils.indexflattening import flatten_multiindex, shape_to_strides
 import dolfin.cpp as cpp
 import numpy
 
-from dolfin.functions.functionspace import FunctionSpaceBase
+from dolfin.functions.functionspace import FunctionSpace
 from dolfin.functions.constant import Constant
 from six.moves import xrange as range
 
@@ -48,28 +51,30 @@ def _check_mul_and_division(e, linear_comb, scalar_weight=1.0, multi_index=None)
     from ufl.constantvalue import ScalarValue
     from ufl.classes import ComponentTensor, MultiIndex, Indexed
     from ufl.algebra import Division, Product, Sum
-    #ops = e.operands()
+    #ops = e.ufl_operands
 
     # FIXME: What should be checked!?
-    same_multi_index = lambda x, y: len(x.free_indices()) == len(y.free_indices()) \
-                and list(x.index_dimensions().values()) == list(y.index_dimensions().values())
+    # martinal: This code has never done anything sensible,
+    #   but I don't know what it was supposed to do so I can't fix it.
+    #same_multi_index = lambda x, y: (x.ufl_free_indices == y.ufl_free_indices \
+    #                        and x.ufl_index_dimensions == y.ufl_index_dimensions)
 
-    assert(isinstance(scalar_weight, float))
+    assert isinstance(scalar_weight, float)
 
     # Split passed expression into scalar and expr
     if isinstance(e, Product):
-        for i, op in enumerate(e.operands()):
+        for i, op in enumerate(e.ufl_operands):
             if isinstance(op, ScalarValue) or \
                    (isinstance(op, Constant) and op.value_size()==1):
                 scalar = op
-                expr = e.operands()[1-i]
+                expr = e.ufl_operands[1-i]
                 break
         else:
             _assign_error()
 
         scalar_weight *= float(scalar)
     elif isinstance(e, Division):
-        expr, scalar = e.operands()
+        expr, scalar = e.ufl_operands
         if not (isinstance(scalar, ScalarValue) or \
                 isinstance(scalar, Constant) and scalar.value_rank()==1):
             _assign_error()
@@ -81,14 +86,14 @@ def _check_mul_and_division(e, linear_comb, scalar_weight=1.0, multi_index=None)
     # a Function or another ComponentTensor, where the latter wil
     # result in a recursive call
     if multi_index is not None:
-        assert(isinstance(multi_index, MultiIndex))
-        assert(isinstance(expr, Indexed))
+        assert isinstance(multi_index, MultiIndex)
+        assert isinstance(expr, Indexed)
 
         # Unpack Indexed and check equality with passed multi_index
-        expr, multi_index2 = expr.operands()
-        assert(isinstance(multi_index2, MultiIndex))
-        if not same_multi_index(multi_index, multi_index2):
-            _assign_error()
+        expr, multi_index2 = expr.ufl_operands
+        assert isinstance(multi_index2, MultiIndex)
+        #if not same_multi_index(multi_index, multi_index2):
+        #    _assign_error()
 
     if isinstance(expr, Function):
         linear_comb.append((expr, scalar_weight))
@@ -96,16 +101,14 @@ def _check_mul_and_division(e, linear_comb, scalar_weight=1.0, multi_index=None)
     elif isinstance(expr, (ComponentTensor, Product, Division, Sum)):
         # If componentTensor we need to unpack the MultiIndices
         if isinstance(expr, ComponentTensor):
-            expr, multi_index = expr.operands()
-            if not same_multi_index(multi_index, multi_index2):
-                _error()
+            expr, multi_index = expr.ufl_operands
+            #if not same_multi_index(multi_index, multi_index2):
+            #    _error()
 
         if isinstance(expr, (Product, Division)):
-            linear_comb = _check_mul_and_division(expr, linear_comb, \
-                                                  scalar_weight, multi_index)
+            linear_comb = _check_mul_and_division(expr, linear_comb, scalar_weight, multi_index)
         elif isinstance(expr, Sum):
-            linear_comb = _check_and_extract_functions(expr, linear_comb, \
-                                                       scalar_weight, multi_index)
+            linear_comb = _check_and_extract_functions(expr, linear_comb, scalar_weight, multi_index)
         else:
             _assign_error()
     else:
@@ -135,13 +138,13 @@ def _check_and_extract_functions(e, linear_comb=None, scalar_weight=1.0,
     # Third check a*u*b, u/a/b, a*u/b where a and b are scalars and u
     # is a Tensor
     elif isinstance(e, ComponentTensor):
-        e, multi_index = e.operands()
+        e, multi_index = e.ufl_operands
         linear_comb = _check_mul_and_division(e, linear_comb, scalar_weight, multi_index)
         return linear_comb
 
     # If not Product or Division we expect Sum
     elif isinstance(e, Sum):
-        for op in e.operands():
+        for op in e.ufl_operands:
             linear_comb = _check_and_extract_functions(op, linear_comb, \
                                                        scalar_weight, multi_index)
 
@@ -213,7 +216,10 @@ class Function(ufl.Coefficient, cpp.Function):
 
               f = Function(V)
 
-        - from another Function ``f``
+        - from cpp.Function ``f``
+
+          *Warning: this constructor is intended for internal libray use only.*
+          No copying is done - ``f`` is only wrapped as Function.
 
           .. code-block:: python
 
@@ -223,7 +229,7 @@ class Function(ufl.Coefficient, cpp.Function):
           <dolfin.functions.functionspace.FunctionSpace>` ``V`` and a
           :py:class:`GenericVector <dolfin.cpp.GenericVector>` ``v``
 
-          *Warning: this constructor is intended for internal libray use only*
+          *Warning: this constructor is intended for internal libray use only.*
 
           .. code-block:: python
 
@@ -242,7 +248,8 @@ class Function(ufl.Coefficient, cpp.Function):
 
     def __init__(self, *args, **kwargs):
         """Initialize Function."""
-        # Initial quick check for valid arguments (other checks sprinkled below)
+        # Initial quick check for valid arguments (other checks
+        # sprinkled below)
         if len(args) == 0:
             raise TypeError("expected 1 or more arguments")
 
@@ -250,6 +257,10 @@ class Function(ufl.Coefficient, cpp.Function):
         if isinstance(args[0], Function):
             other = args[0]
             if len(args) == 1:
+                # NOTE: Turn this into error when removing deprecation
+                # warning
+                cpp.deprecation("Function copy constructor", "2016.1",
+                                "Use 'Function.copy(deepcopy=True)' for copying.")
                 self.__init_copy_constructor(other)
             elif len(args) == 2:
                 i = args[1]
@@ -263,11 +274,11 @@ class Function(ufl.Coefficient, cpp.Function):
             other = args[0]
             if len(args) == 1:
                 # If creating a dolfin.Function from a cpp.Function
-                self.__init_cpp_copy_constructor(other)
+                self.__init_from_cpp_function(other)
             else:
                 raise TypeError("expected only one argument when passing cpp.Function"
                                 "to dolfin.Function constructor")
-        elif isinstance(args[0], FunctionSpaceBase):
+        elif isinstance(args[0], FunctionSpace):
             V = args[0]
             # If initialising from a FunctionSpace
             if len(args) == 1:
@@ -293,16 +304,15 @@ class Function(ufl.Coefficient, cpp.Function):
 
     def __init_copy_constructor(self, other):
         cpp.Function.__init__(self, other)
-        ufl.Coefficient.__init__(self, other._element, count=self.id())
+        ufl.Coefficient.__init__(self, other.ufl_function_space(), count=self.id())
 
-    def __init_cpp_copy_constructor(self, other):
-        # Lets be agressive in abusing dynamic typing shall we...
-        self.__class__ = Function
+    def __init_from_cpp_function(self, other):
+        # Assign all the members (including 'this' pointer to SWIG wraper)
+        # NOTE: This in fact performs assignment of C++ context
         self.__dict__ = other.__dict__
 
-        # (Not calling cpp.Function.__init__)
-        ufl.Coefficient.__init__(self, other.function_space().ufl_element(), \
-                                 count=self.id())
+        # Initialize the ufl.FunctionSpace (Not calling cpp.Function.__init__)
+        ufl.Coefficient.__init__(self, other.function_space().ufl_function_space(), count=self.id())
 
     def __init_subfunction_constructor(self, other, i):
         num_sub_spaces = other.function_space().num_sub_spaces()
@@ -311,26 +321,23 @@ class Function(ufl.Coefficient, cpp.Function):
         if not i < num_sub_spaces:
             raise RuntimeError("Can only extract subfunctions "
                                "with i = 0..%d"% num_sub_spaces)
-
         cpp.Function.__init__(self, other, i)
-        ufl.Coefficient.__init__(self, self.function_space().ufl_element(), \
-                                 count=self.id())
+        ufl.Coefficient.__init__(self, self.function_space().ufl_function_space(), count=self.id())
 
     def __init_from_function_space(self, V):
         cpp.Function.__init__(self, V)
-        ufl.Coefficient.__init__(self, V.ufl_element(), count=self.id())
+        ufl.Coefficient.__init__(self, V.ufl_function_space(), count=self.id())
 
     def __init_from_function_space_and_cpp_function(self, V, other):
         # Simple consistency checks on function spaces
         if other.function_space().dim() != V.dim():
             raise ValueError("non matching dimensions on passed FunctionSpaces")
-
         cpp.Function.__init__(self, other)
-        ufl.Coefficient.__init__(self, V.ufl_element(), count=self.id())
+        ufl.Coefficient.__init__(self, V.ufl_function_space(), count=self.id())
 
     def __init_from_function_space_and_function(self, V, other):
         cpp.Function.__init__(self, V, other)
-        ufl.Coefficient.__init__(self, V.ufl_element(), count=self.id())
+        ufl.Coefficient.__init__(self, V.ufl_function_space(), count=self.id())
 
     def sub(self, i, deepcopy = False):
         """
@@ -380,7 +387,7 @@ class Function(ufl.Coefficient, cpp.Function):
             self._assign(rhs)
         elif isinstance(rhs, (Sum, Product, Division, ComponentTensor)):
             if isinstance(rhs, ComponentTensor):
-                rhs, multi_index = rhs.operands()
+                rhs, multi_index = rhs.ufl_operands
             else:
                 multi_index = None
             linear_comb = _check_and_contract_linear_comb(rhs, self, \
@@ -421,10 +428,7 @@ class Function(ufl.Coefficient, cpp.Function):
         Extract any sub functions.
 
         A sub function can be extracted from a discrete function that
-        is in a :py:class:`MixedFunctionSpace
-        <dolfin.functions.functionspace.MixedFunctionSpace>` or in a
-        :py:class:`VectorFunctionSpace
-        <dolfin.functions.functionspace.VectorFunctionSpace>`. The sub
+        is in a mixed, vector, or tensor FunctionSpace. The sub
         function resides in the subspace of the mixed space.
 
         *Arguments*
@@ -438,10 +442,6 @@ class Function(ufl.Coefficient, cpp.Function):
             raise RuntimeError("No subfunctions to extract")
         return tuple(self.sub(i, deepcopy) for i in range(num_sub_spaces))
 
-    def ufl_element(self):
-        """Return ufl element"""
-        return self._element
-
     def __str__(self):
         """Return a pretty print representation of it self.
         """
@@ -465,9 +465,9 @@ class Function(ufl.Coefficient, cpp.Function):
         assert derivatives == () # TODO: Handle derivatives
 
         if component:
-            shape = self.shape()
+            shape = self.ufl_shape
             assert len(shape) == len(component)
-            value_size = ufl.common.product(shape)
+            value_size = product(shape)
             index = flatten_multiindex(component, shape_to_strides(shape))
             values = numpy.zeros(value_size)
             self(*x, values=values)
@@ -477,12 +477,14 @@ class Function(ufl.Coefficient, cpp.Function):
             return self(*x)
 
     def __float__(self):
-        if self.shape() != ():
+        if self.ufl_shape != ():
             raise RuntimeError("Cannot convert nonscalar function to float.")
         elm = self.ufl_element()
         if elm.family() != "Real":
             raise RuntimeError("Cannot convert spatially varying function to float.")
-        # Gather value directly from vector in a parallell safe way
+        # FIXME: This could be much simpler be exploiting that the
+        # vector is ghosted
+        # Gather value directly from vector in a parallel safe way
         vec = self.vector()
         indices = numpy.zeros(1, dtype=cpp.la_index_dtype())
         values = vec.gather(indices)
@@ -546,15 +548,16 @@ class Function(ufl.Coefficient, cpp.Function):
             raise TypeError("expected at least 1 argument")
 
         # Test for ufl restriction
-        if len(args) == 1 and args[0] in ('+','-'):
-            return ufl.Coefficient.__call__(self, *args)
+        if len(args) == 1 and isinstance(args[0], str):
+            if args[0] in ('+', '-'):
+                return ufl.Coefficient.__call__(self, *args)
 
         # Test for ufl mapping
         if len(args) == 2 and isinstance(args[1], dict) and self in args[1]:
             return ufl.Coefficient.__call__(self, *args)
 
         # Some help variables
-        value_size = ufl.common.product(self.ufl_element().value_shape())
+        value_size = product(self.ufl_element().value_shape())
 
         # If values (return argument) is passed, check the type and length
         values = kwargs.get("values", None)
@@ -571,7 +574,7 @@ class Function(ufl.Coefficient, cpp.Function):
             values = numpy.zeros(value_size, dtype='d')
 
         # Get the geometric dimension we live in
-        dim = self.geometric_dimension() # (UFL function)
+        dim = self.ufl_domain().geometric_dimension()
 
         # Assume all args are x argument
         x = args
@@ -608,6 +611,7 @@ class Function(ufl.Coefficient, cpp.Function):
 
 #--- Subclassing of ufl.{Basis, Trial, Test}Function ---
 
+# TODO: Update this message to clarify dolfin.FunctionSpace vs ufl.FunctionSpace
 _ufl_dolfin_difference_message = """\
 When constructing an Argument, TestFunction or TrialFunction,
 you must to provide a FunctionSpace and not a FiniteElement.
@@ -624,13 +628,23 @@ class Argument(ufl.Argument):
     This is the overloaded PyDOLFIN variant.
     """
     def __init__(self, V, number, part=None):
-        if not isinstance(V, FunctionSpaceBase):
-            if isinstance(V, ufl.FiniteElementBase):
+
+        # Check argument
+        if not isinstance(V, (FunctionSpace, cpp.MultiMeshFunctionSpace)):
+            if isinstance(V, (ufl.FiniteElementBase, ufl.FunctionSpace)):
                 raise TypeError(_ufl_dolfin_difference_message)
             else:
                 raise TypeError("Illegal argument for creation of Argument, not a FunctionSpace: " + str(V))
             raise TypeError("Illegal argument for creation of Argument, not a FunctionSpace: " + str(V))
-        ufl.Argument.__init__(self, V.ufl_element(), number, part)
+
+        # Handle MultiMesh
+        if isinstance(V, cpp.MultiMeshFunctionSpace):
+            self._V_multi = V
+            V = V._parts[0]
+
+        # Initialize UFL Argument
+        ufl.Argument.__init__(self, V.ufl_function_space(), number, part)
+
         self._V = V
 
     def function_space(self):
diff --git a/site-packages/dolfin/functions/functionspace.py b/site-packages/dolfin/functions/functionspace.py
index dac6fd4..6ca8099 100644
--- a/site-packages/dolfin/functions/functionspace.py
+++ b/site-packages/dolfin/functions/functionspace.py
@@ -1,10 +1,11 @@
+# -*- coding: utf-8 -*-
 """
 This module contains functionality for function spaces in particular
 discrete function spaces defined over meshes in terms of finite
 elements.
 """
 
-# Copyright (C) 2008-2014 Johan Hake
+# Copyright (C) 2008-2015 Johan Hake
 #
 # This file is part of DOLFIN.
 #
@@ -21,17 +22,17 @@ elements.
 # You should have received a copy of the GNU Lesser General Public License
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
-# Modified by Anders Logg 2008
-# Modified by Martin Alnes 2008-2014
+# Modified by Anders Logg 2008, 2015
+# Modified by Martin Sandve Alnæs 2008-2015
 # Modified by Kent-Andre Mardal 2009
 # Modified by Marie E. Rognes 2012
+# Modified by Jan Blechta 2015
 
-__all__ = ["FunctionSpace", "MixedFunctionSpace",
+__all__ = ["FunctionSpace", "EnrichedFunctionSpace", "MixedFunctionSpace",
            "VectorFunctionSpace", "TensorFunctionSpace",
-           "FunctionSpaceBase","FunctionSpaceFromCpp",
-           "create_ufc_function_spaces"]
+           "FunctionSpaceFromCpp", "FunctionSpaceBase",
+           "MultiMeshFunctionSpace"]
 
-import copy
 import numpy
 
 # Import UFL and SWIG-generated extension module (DOLFIN C++)
@@ -40,7 +41,7 @@ import dolfin.cpp as cpp
 from dolfin.compilemodules.jit import jit
 
 
-def _get_common_mesh_and_constrained_domain(spaces, fstype):
+def _get_common_mesh_and_constrained_domain(spaces):
     mesh = spaces[0].mesh()
     constrained_domain = spaces[0].dofmap().constrained_domain
 
@@ -48,10 +49,11 @@ def _get_common_mesh_and_constrained_domain(spaces, fstype):
     if not all(V.mesh().id() == mesh.id() for V in spaces):
         cpp.dolfin_error("functionspace.py",
                          "create function space",
-                         "Nonmatching meshes for " + fstype + " function space: " \
+                         "Nonmatching meshes for function space: " \
                          + str([V.mesh() for V in spaces]))
 
-    # Also check that all spaces share same constrained_domain map we pass on
+    # Also check that all spaces share same constrained_domain map we
+    # pass on
     ncd = sum(0 if V.dofmap().constrained_domain is None else 1 for V in spaces)
     if ncd == 0:
         # No constrained domains, nothing to check
@@ -68,127 +70,241 @@ def _get_common_mesh_and_constrained_domain(spaces, fstype):
         #    if not cd2 is constrained_domain or cd2.id() == constrained_domain.id():
         #        cpp.dolfin_error("functionspace.py",
         #                         "create function space",
-        #                         "Nonmatching constrained_domain for " + fstype + " function space: " \
+        #                         "Nonmatching constrained_domain for function space: " \
         #                         + str([V.dofmap().constrained_domain for V in spaces]))
     else:
         # Not allowing some to have constrained domain and some not to.
         cpp.dolfin_error("functionspace.py",
                          "create function space",
-                         "Nonmatching constrained_domain for " + fstype + " function space: " \
+                         "Nonmatching constrained_domain for function space: " \
                          + str([V.dofmap().constrained_domain for V in spaces]))
 
     return mesh, constrained_domain
 
 
-def _analyse_mesh_argument(mesh):
-    # Get Mesh or Restriction from Domain or Domain from Mesh or Restriction
-    if not isinstance(mesh, (cpp.Mesh, cpp.Restriction, ufl.Domain)):
-        cpp.dolfin_error("functionspace.py",
-                         "create function space",
-                         "Illegal argument, not a mesh or restriction: " + str(mesh))
-
-    # Interpret mesh argument. This is messy, the design could
-    # probably be improved significantly.
-    if isinstance(mesh, cpp.Mesh):
-        ufl_domain = mesh.ufl_domain() # Passed to ufl
-        mesh = mesh                    # Passed to dolfin
-    elif isinstance(mesh, cpp.Restriction):
-        ufl_domain = mesh.mesh().ufl_domain() # Passed to ufl (loses information about Restriction)
-        mesh = mesh                           # Keep Restriction here,
-    elif isinstance(mesh, ufl.Domain):
-        ufl_domain = mesh    # Passed to ufl
-        mesh = mesh.data()   # Get Mesh or Restriction payload from ufl object
-
-    # Check arguments again
-    if not isinstance(ufl_domain, ufl.Domain):
-        cpp.dolfin_error("functionspace.py",
-                         "create function space",
-                         "Failed to extract Domain: " + str(ufl_domain))
-    if not isinstance(mesh, (cpp.Mesh, cpp.Restriction)):
-        cpp.dolfin_error("functionspace.py",
-                         "create function space",
-                         "Illegal argument, not a mesh or restriction: " + str(mesh))
-    return ufl_domain, mesh
+def _compile_dolfin_element(element, mesh, constrained_domain=None):
+    "Instantiate DOLFIN FiniteElement and DofMap from ufl element."
+
+    # JIT-compile element to get ufc_element and ufc_dofmap
+    ufc_element, ufc_dofmap = jit(element, mpi_comm=mesh.mpi_comm())
+
+    dolfin_element = cpp.FiniteElement(ufc_element)
+
+    if constrained_domain is None:
+        dolfin_dofmap  = cpp.DofMap(ufc_dofmap, mesh)
+    else:
+        dolfin_dofmap  = cpp.DofMap(ufc_dofmap, mesh, constrained_domain)
 
-class FunctionSpaceBase(cpp.FunctionSpace):
+    return dolfin_element, dolfin_dofmap
+
+
+class FunctionSpace(ufl.FunctionSpace, cpp.FunctionSpace):
     "Base class for all function spaces."
 
-    def __init__(self, mesh, element, constrained_domain=None):
-        """Create function space on given mesh for given finite element.
+    def __init__(self, *args, **kwargs):
+        """Create finite element function space.
+
+        **Overloaded versions**
+
+        * FunctionSpace(mesh, element, constrained_domain=None)
+
+          Create function space on given mesh for given finite element
+
+        * FunctionSpace(mesh, family, degree, form_degree=None,
+                        constrained_domain=None, restriction=None)
+
+          Convenience function for specifying element by string, degree, etc.
+
+        * FunctionSpace(cppV)
+
+          Internal library function for wrapping :py:class`cpp.FunctionSpace
+          <dolfin.cpp.FunctionSpace>` into :py:class:`FunctionSpace
+          <dolfin.functions.functionspace.FunctionSpace>`. No copying is done.
 
         *Arguments*
-            mesh
-                A :py:class:`Mesh <dolfin.cpp.Mesh>`
-            element
-                A :py:class:`(UFL) FiniteElement <ufl.FiniteElementBase>`
+            mesh (:py:class:`Mesh <dolfin.cpp.Mesh>`)
+                the mesh
+            element (:py:class:`ufl.FiniteElement <ufl.FiniteElementBase>`)
+                the element
+            family (string)
+                specification of the element family, see below for
+                alternatives.
+            degree (int)
+                the degree of the element.
+            form_degree (int)
+                the form degree (FEEC notation, used when field is
+                viewed as k-form)
+            constrained_domain
+                constrained subdomain with map function.
+            restriction
+                restriction of the element (e.g. to cell facets).
+
+        Which families and degrees that are supported is determined by the
+        form compiler used to generate the element, but typical families
+        include
+
+        =================================  =========
+        Name                               Usage
+        =================================  =========
+        Argyris*                           "ARG"
+        Arnold-Winther*                    "AW"
+        Brezzi-Douglas-Fortin-Marini*      "BDFM"
+        Brezzi-Douglas-Marini              "BDM"
+        Bubble                             "B"
+        Crouzeix-Raviart                   "CR"
+        Discontinuous Lagrange             "DG"
+        Discontinuous Raviart-Thomas       "DRT"
+        Hermite*                           "HER"
+        Lagrange                           "CG"
+        Mardal-Tai-Winther*                "MTW"
+        Morley*                            "MOR"
+        Nedelec 1st kind H(curl)           "N1curl"
+        Nedelec 2nd kind H(curl)           "N2curl"
+        Quadrature                         "Quadrature"
+        Raviart-Thomas                     "RT"
+        Real                               "R"
+        =================================  =========
+
+        *only partly supported.
+
+        *Examples of usage*
+            To define a discrete function space over e.g. the unit square:
+
+            .. code-block:: python
+
+                mesh = UnitSquare(32,32)
+                V = FunctionSpace(mesh, "CG", 1)
+
+            Here, ``"CG"`` stands for Continuous Galerkin, implying the
+            standard Lagrange family of elements. Instead of ``"CG"``, we
+            could have written ``"Lagrange"``. With degree 1, we get the
+            linear Lagrange element. Other examples include:
+
+            .. code-block:: python
+
+                # Discontinuous element of degree 0
+                V = FunctionSpace(mesh, "DG", 0)
+
+                # Brezzi-Douglas-Marini element of degree 2
+                W = FunctionSpace(mesh, "BDM", 2)
+
+                # Real element with one global degree of freedom
+                R = FunctionSpace(mesh, "R", 0)
 
         """
+        if len(args) == 1:
+            self._init_from_cpp(*args, **kwargs)
+        else:
+            if len(args) == 0 or not isinstance(args[0], cpp.Mesh):
+                cpp.dolfin_error("functionspace.py",
+                                 "create function space",
+                                 "Illegal argument, not a mesh: "
+                                 + str(args[0]))
+            elif len(args) == 2:
+                self._init_from_ufl(*args, **kwargs)
+            else:
+                self._init_convenience(*args, **kwargs)
+
+    def _init_from_ufl(self, mesh, element, constrained_domain=None):
+        if not isinstance(element, ufl.FiniteElementBase):
+            cpp.dolfin_error("functionspace.py",
+                             "create function space",
+                             "Illegal argument, not a finite element: "
+                             + str(element))
+        if constrained_domain is not None:
+            if not isinstance(constrained_domain, cpp.SubDomain):
+                cpp.dolfin_error("functionspace.py",
+                                 "create function space",
+                                 "Illegal argument, not a subdomain: "
+                                 + str(constrained_domain))
+
+        # Compile element and dofmap and construct corresponding dolfin objects
+        #if dolfin_element is None or dolfin_dofmap is None:
+        #    assert dolfin_element is None and dolfin_dofmap is None, "Expecting both or none of these."
+        dolfin_element, dolfin_dofmap = _compile_dolfin_element(element, mesh, constrained_domain=constrained_domain)
+
+        # Initialize the cpp.FunctionSpace
+        cpp.FunctionSpace.__init__(self, mesh, dolfin_element, dolfin_dofmap)
+
+        # Initialize the ufl.FunctionSpace
+        ufl.FunctionSpace.__init__(self, mesh.ufl_domain(), element)
 
         # Store reference to constrained domain to avoid possible SWIG
         # director memory error (see
         # https://bitbucket.org/fenics-project/dolfin/issue/71)
+        # TODO: Make constrained_domain private with getter? Attribute access breaks interface consistency.
         self.constrained_domain = constrained_domain
 
+    def _init_convenience(self, mesh, family, degree, form_degree=None,
+                          constrained_domain=None, restriction=None):
         # Check arguments
-        if not isinstance(mesh, (cpp.Mesh, cpp.Restriction)):
+        if not isinstance(family, str):
             cpp.dolfin_error("functionspace.py",
                              "create function space",
-                             "Illegal argument, not a mesh or restriction: " + str(mesh))
-        if not isinstance(element, (ufl.FiniteElementBase)):
+                             "Illegal argument for finite element family, not a string: " + str(family))
+        if not isinstance(degree, int):
             cpp.dolfin_error("functionspace.py",
                              "create function space",
-                             "Illegal argument, not a finite element: " + str(element))
-        if constrained_domain is not None:
-            if not isinstance(constrained_domain, cpp.SubDomain):
-                cpp.dolfin_error("functionspace.py",
-                                 "create function space",
-                                 "Illegal argument, not a subdomain: " + str(constrained_domain))
+                             "Illegal argument for degree, not an integer: "
+                             + str(degree))
 
-        # Store element Note: self._ufl_element cannot be a private
-        # attribute as we want to be able to set the element from a
-        # derived class.
-        self._ufl_element = element
+        # Create UFL element
+        element = ufl.FiniteElement(family, mesh.ufl_cell(), degree,
+                                    form_degree=form_degree)
+        if restriction is not None:
+            element = element[restriction]
 
-        # JIT-compile element to get ufc_element and ufc_dofmap
-        ufc_element, ufc_dofmap = jit(self._ufl_element, mpi_comm=mesh.mpi_comm())
+        self._init_from_ufl(mesh, element,
+                            constrained_domain=constrained_domain)
 
-        # Instantiate DOLFIN FiniteElement and DofMap
-        self._dolfin_element = cpp.FiniteElement(ufc_element)
-        if constrained_domain is not None:
-            if isinstance(mesh, cpp.Restriction):
-                cpp.dolfin_error("functionspace.py",
-                                 "create function space",
-                                 "Cannot use constrained domains together with restrictions.")
-            dolfin_dofmap  = cpp.DofMap(ufc_dofmap, mesh, constrained_domain)
-        else:
-            if isinstance(mesh, cpp.Restriction):
-                dolfin_dofmap = cpp.DofMap(ufc_dofmap, mesh)
-                mesh = mesh.mesh()
-            else:
-                dolfin_dofmap  = cpp.DofMap(ufc_dofmap, mesh)
+    def _init_from_cpp(self, cppV, **kwargs):
+        if not isinstance(cppV, cpp.FunctionSpace):
+            cpp.dolfin_error("functionspace.py",
+                             "create function space",
+                             "Illegal argument for C++ function space, "
+                             "not a cpp.FunctionSpace: " + str(cppV))
+        # We don't want to support copy construction. This would indicate
+        # internal defficiency in the library
+        if isinstance(cppV, FunctionSpace):
+            cpp.dolfin_error("functionspace.py",
+                             "create function space",
+                             "Illegal argument for C++ function space, "
+                             "should not be functions.functionspace.FunctionSpace: " + str(cppV))
+        if len(kwargs) > 0:
+            cpp.dolfin_error("functionspace.py",
+                             "create function space",
+                             "Illegal arguments, did not expect C++ "
+                             "function space and **kwargs: " + str(kwargs))
 
-        # Initialize the cpp_FunctionSpace
-        cpp.FunctionSpace.__init__(self, mesh,
-                                   self._dolfin_element,
-                                   dolfin_dofmap)
+        # Assign all the members (including 'this' pointer to SWIG wraper)
+        # NOTE: This in fact performs assignment of C++ context
+        self.__dict__ = cppV.__dict__
 
-    # FIXME: Sort out consistent interface for access to DOLFIN, UFL and UFC objects...
+        # Reconstruct UFL element from signature
+        ufl_element = eval(self.element().signature(), ufl.__dict__)
 
-    def cell(self):
-        "Return the UFL cell."
-        return self._ufl_element.domain().cell()
+        # Get mesh
+        ufl_domain = self.mesh().ufl_domain()
 
-    #def ufl_domain(self): # TODO: Do we want this?
-    #    "Return the UFL domain."
-    #    return self._ufl_element.domain()
+        # Initialize the ufl.FunctionSpace (not calling cpp.Function.__init__)
+        ufl.FunctionSpace.__init__(self, ufl_domain, ufl_element)
 
-    def ufl_element(self):
-        "Return the UFL element."
-        return self._ufl_element
+    def ufl_function_space(self):
+        return self
+
+    def ufl_cell(self):
+        "Return the UFL cell."
+        return self.ufl_domain().ufl_cell()
+
+    def cell(self):
+        "Return the UFL cell."
+        cpp.deprecation("'FunctionSpace.cell()'", "2016.1",
+                        "Use 'FunctionSpace.ufl_cell()' instead.")
+        return self.ufl_cell()
 
     def dolfin_element(self):
         "Return the DOLFIN element."
-        return self._dolfin_element
+        return self.element()
 
     def __add__(self, other):
         "Create enriched function space."
@@ -201,20 +317,26 @@ class FunctionSpaceBase(cpp.FunctionSpace):
     def __str__(self):
         "Pretty-print."
         return "<Function space of dimension %d (%s)>" % \
-               (self.dofmap().global_dimension(), str(self._ufl_element))
+               (self.dofmap().global_dimension(), str(self.ufl_element()))
+
+    def __eq__(self, other):
+        "Comparison for equality."
+        return ufl.FunctionSpace.__eq__(self, other) \
+           and cpp.FunctionSpace.__eq__(self, other)
+
+    def __ne__(self, other):
+        "Comparison for inequality."
+        return ufl.FunctionSpace.__ne__(self, other) \
+            or cpp.FunctionSpace.__ne__(self, other)
 
     def num_sub_spaces(self):
         "Return the number of sub spaces"
-        return self._dolfin_element.num_sub_elements()
+        return self.dolfin_element().num_sub_elements()
 
     def sub(self, i):
-        "Return the i:th cpp.SubSpace"
-        # Fixme: Should we have a more extensive check other than whats included in
-        # the cpp code?
-        #if i not in self._cpp_sub_spaces.keys():
-            # Store the created subspace to prevent swig garbage collection
-            # Should not be needed as SubSpace is shared_ptr stored
-        #    self._cpp_sub_spaces[i] = FunctionSpaceFromCpp(cpp.SubSpace(self,i))
+        "Return the i-th sub space"
+        # FIXME: Should we have a more extensive check other than
+        # whats includedin the cpp code?
         if not isinstance(i, int):
             raise TypeError("expected an int for 'i'")
         if self.num_sub_spaces() == 1:
@@ -222,9 +344,10 @@ class FunctionSpaceBase(cpp.FunctionSpace):
         if i >= self.num_sub_spaces():
             raise ValueError("Can only extract SubSpaces with i = 0 ... %d" % \
                   (self.num_sub_spaces() - 1))
-        assert(hasattr(self._ufl_element,"sub_elements"))
-        element = self._ufl_element.sub_elements()[i]
-        return FunctionSpaceFromCpp(cpp.FunctionSpace.sub(self, i), element)
+        assert hasattr(self.ufl_element(), "sub_elements")
+
+        # Extend with the python layer
+        return FunctionSpace(cpp.FunctionSpace.sub(self, i))
 
     def extract_sub_space(self, component):
         """
@@ -238,7 +361,6 @@ class FunctionSpaceBase(cpp.FunctionSpace):
             _FunctionSpace_
                 The subspace.
         """
-
         # Transform the argument to a NumPy array
         if not hasattr(component, "__len__"):
             cpp.dolfin_error("functionspace.py",
@@ -249,18 +371,12 @@ class FunctionSpaceBase(cpp.FunctionSpace):
         # Get the cpp version of the FunctionSpace
         cpp_space = cpp.FunctionSpace.extract_sub_space(self, component)
 
-        # Instantiate a ufl finite element based on the dolfin element signature
-        element = eval(cpp_space.element().signature(), ufl.__dict__).reconstruct(domain=self.mesh())
-        return FunctionSpaceFromCpp(cpp_space, element)
+        # Extend with the python layer
+        return FunctionSpace(cpp_space)
 
     def split(self):
-        """
-        Split a mixed functionspace into its sub spaces
-        """
-        S = []
-        for i in range(self.num_sub_spaces()):
-            S.append(self.sub(i))
-        return S
+        """Split a mixed functionspace into its sub spaces"""
+        return [self.sub(i) for i in range(self.num_sub_spaces())]
 
     def collapse(self, collapsed_dofs=False):
         """
@@ -277,398 +393,260 @@ class FunctionSpaceBase(cpp.FunctionSpace):
            dict
                 The map from new to old dofs (optional)
         """
+        # Get the cpp version of the FunctionSpace
         cpp_space, dofs = cpp.FunctionSpace.collapse(self)
-        if collapsed_dofs:
-            return FunctionSpaceFromCpp(cpp_space), dofs
-        return FunctionSpaceFromCpp(cpp_space)
-
-class FunctionSpaceFromCpp(FunctionSpaceBase):
-    "FunctionSpace represents a finite element function space."
-    def __new__(cls, cppV, element=None):
-        if not isinstance(cppV, (cpp.FunctionSpace)):
-            cpp.dolfin_error("functionspace.py",
-                             "create function space",
-                             "Illegal argument, not a cpp.FunctionSpace: " + str(cppV))
-
-        # Lets be agressive in abusing dynamic typing shall we...
-        cppV._dolfin_element = cppV.element()
-        cppV._ufl_element = eval(cppV.element().signature(), ufl.__dict__).reconstruct(domain=cppV.mesh())
-        cppV.__class__ = FunctionSpaceBase
-        return cppV
-
-def create_ufc_function_spaces(mesh, ufc_form, cache=None):
-    """
-    Instantiate cpp.FunctionSpaces from compiled ufc form.
-
-    *Arguments*
-        mesh
-            a :py:class:`Mesh <dolfin.cpp.Mesh>`.
-        ufc_form
-            compiled ufc form
-        cache
-            a 'dict' with already instantiated
-            :py:class:`cpp.FunctionSpaces <dolfin.cpp.FunctionSpace>`.
-
-    *Examples of usage*
-
-        .. code-block:: python
-
-            fs0, c = create_ufc_function_spaces(mesh, ufc_form0)
-            fs1, c = create_ufc_function_spaces(mesh, ufc_form1, c)
-
-    """
-
-    # Initialize return arguments
-    functionspaces = []
-    if cache is None:
-        cache = {}
-
-    # Iterate over all known ufc_finite_elements
-    for i in range(ufc_form.rank() + ufc_form.num_coefficients()):
-        # Create a ufc_finite_elements
-        fe = ufc_form.create_finite_element(i)
-
-        # Use the signature of the element as key in the cache dict
-        fesig = fe.signature()
-
-        # Try to access the cache
-        V = cache.get(fesig)
 
-        # If the cpp.FunctionSpace does not excists in the cache
-        if V is None:
-            # Instantiate a dofmap
-            dm = ufc_form.create_dofmap(i)
+        # Extend with the python layer
+        V = FunctionSpace(cpp_space)
 
-            # Instantiate the UFCFunctionSpace
-            V = UFCFunctionSpace(mesh, fe, dm)
-            cache[fesig] = V
-
-        functionspaces.append(V)
-
-    return functionspaces, cache
-
-class UFCFunctionSpace(cpp.FunctionSpace):
-    "FunctionSpace represents a finite element function space."
-    def __init__(self, mesh, ufc_finite_element, ufc_dofmap, constrained_domain=None):
-        " Initialize a FunctionSpace from ufc data "
-        self._mesh = mesh
-        self._finite_element = cpp.FiniteElement(ufc_finite_element)
-        if constrained_domain is None:
-            self._dofmap = cpp.DofMap(ufc_dofmap, mesh)
+        if collapsed_dofs:
+            return V, dofs
         else:
-            self._dofmap = cpp.DofMap(ufc_dofmap, mesh, constrained_domain)
-        self._ufc_finite_element = ufc_finite_element
-        self._ufc_dofmap = ufc_dofmap
-        cpp.FunctionSpace.__init__(self, self._mesh, self._finite_element, \
-                                   self._dofmap)
-
-        # Store reference to constrained domain to avoid possible SWIG
-        # director memory error (see
-        # https://bitbucket.org/fenics-project/dolfin/issue/71)
-        self.constrained_domain = constrained_domain
-
-class FunctionSpace(FunctionSpaceBase):
-    "FunctionSpace represents a finite element function space."
-
-    def __init__(self, mesh, family, degree, form_degree=None,
-                 constrained_domain=None, restriction=None):
-        """
-        Create finite element function space.
-
-        *Arguments*
-            mesh (:py:class:`Mesh <dolfin.cpp.Mesh>`)
-                the mesh
-            family (string)
-                specification of the element family, see below for
-                alternatives.
-            degree (int)
-                the degree of the element.
-            form_degree (int)
-                the form degree (FEEC notation, used when field is
-                viewed as k-form)
-            constrained_domain
-                constrained subdomain with map function.
-            restriction
-                restriction of the element (e.g. to cell facets).
-
-        Which families and degrees that are supported is determined by the
-        form compiler used to generate the element, but typical families
-        include
-
-        =================================  =========
-        Name                               Usage
-        =================================  =========
-        Argyris*                           "ARG"
-        Arnold-Winther*                    "AW"
-        Brezzi-Douglas-Fortin-Marini*      "BDFM"
-        Brezzi-Douglas-Marini              "BDM"
-        Bubble                             "B"
-        Crouzeix-Raviart                   "CR"
-        Discontinuous Lagrange             "DG"
-        Discontinuous Raviart-Thomas       "DRT"
-        Hermite*                           "HER"
-        Lagrange                           "CG"
-        Mardal-Tai-Winther*                "MTW"
-        Morley*                            "MOR"
-        Nedelec 1st kind H(curl)           "N1curl"
-        Nedelec 2nd kind H(curl)           "N2curl"
-        Quadrature                         "Q"
-        Raviart-Thomas                     "RT"
-        Real                               "R"
-        =================================  =========
-
-        *only partly supported.
+            return V
 
-        *Examples of usage*
-            To define a discrete function space over e.g. the unit square:
-
-            .. code-block:: python
-
-                mesh = UnitSquare(32,32)
-                V = FunctionSpace(mesh, "CG", 1)
-
-            Here, ``"CG"`` stands for Continuous Galerkin, implying the
-            standard Lagrange family of elements. Instead of ``"CG"``, we
-            could have written ``"Lagrange"``. With degree 1, we get the
-            linear Lagrange element. Other examples include:
-
-            .. code-block:: python
-
-                # Discontinuous element of degree 0
-                V = FunctionSpace(mesh, "DG", 0)
-
-                # Brezzi-Douglas-Marini element of degree 2
-                W = FunctionSpace(mesh, "BDM", 2)
-
-                # Real element with one global degree of freedom
-                R = FunctionSpace(mesh, "R", 0)
 
-        """
+def FunctionSpaceFromCpp(cppV):
+    cpp.deprecation("'FunctionSpaceFromCpp'", "2016.1",
+                    "Use 'FunctionSpace(cppV)' instead.")
+    return FunctionSpace(cppV)
 
-        # Check arguments
-        if not isinstance(family, str):
-            cpp.dolfin_error("functionspace.py",
-                             "create function space",
-                             "Illegal argument for finite element family, not a string: " + str(family))
-        if not isinstance(degree, int):
-            cpp.dolfin_error("functionspace.py",
-                             "create function space",
-                             "Illegal argument for degree, not an integer: " + str(degree))
 
-        # Get Mesh or Restriction from Domain or Domain from Mesh or
-        # Restriction
-        ufl_domain, mesh = _analyse_mesh_argument(mesh)
+def FunctionSpaceBase(mesh, element, constrained_domain=None):
+    cpp.deprecation("'FunctionSpaceBase'", "2016.1",
+                    "Use 'FunctionSpace(...)' instead.")
+    return FunctionSpace(mesh, element, constrained_domain=None)
 
-        # Create UFL element
-        element = ufl.FiniteElement(family, ufl_domain, degree, form_degree=form_degree)
-        if restriction is not None:
-            element = element[restriction]
 
-        # Initialize base class
-        FunctionSpaceBase.__init__(self, mesh, element, constrained_domain)
+def EnrichedFunctionSpace(spaces):
+    """
+    Create enriched finite element function space.
 
-        self.___degree = degree
-        self.___family = family
-        self.___mesh = mesh.mesh() if isinstance(mesh, cpp.Restriction) else mesh
-        self.___form_degree = form_degree
+    *Arguments*
+        spaces
+            a list (or tuple) of :py:class:`FunctionSpaces
+            <dolfin.functions.functionspace.FunctionSpace>`.
 
-        # Store reference to constrained domain to avoid possible SWIG
-        # director memory error (see
-        # https://bitbucket.org/fenics-project/dolfin/issue/71)
-        self.constrained_domain = constrained_domain
+    *Usage*
+        The function space may be created by
 
-    def restriction(self, meshfunction):
-        space = FunctionSpace(self.___mesh, self.___family, self.___degree,
-                              form_degree=self.___form_degree)
-        space.attach(meshfunction)
-        return space
+        .. code-block:: python
 
-class EnrichedFunctionSpace(FunctionSpaceBase):
-    "EnrichedFunctionSpace represents an enriched finite element function space."
+            V = EnrichedFunctionSpace(spaces)
 
-    def __init__(self, spaces):
-        """
-        Create enriched finite element function space.
+    """
+    cpp.deprecation("'EnrichedFunctionSpace'", "2016.1",
+                    "Use 'FunctionSpace(mesh, EnrichedElement(...))'.")
 
-        *Arguments*
-            spaces
-                a list (or tuple) of :py:class:`FunctionSpaces
-                <dolfin.functions.functionspace.FunctionSpace>`.
+    # Check arguments
+    if not len(spaces) > 0:
+        cpp.dolfin_error("functionspace.py",
+                         "create enriched function space",
+                         "Need at least one subspace")
+    if not all(isinstance(V, FunctionSpace) for V in spaces):
+        cpp.dolfin_error("functionspace.py",
+                         "create enriched function space",
+                         "Invalid subspaces: " + str(spaces))
 
-        *Usage*
-            The function space may be created by
+    # Get common mesh and constrained_domain, must all be the same
+    mesh, constrained_domain = _get_common_mesh_and_constrained_domain(spaces)
 
-            .. code-block:: python
+    # Create element
+    element = ufl.EnrichedElement(*[V.ufl_element() for V in spaces])
 
-                V = EnrichedFunctionSpace(spaces)
+    return FunctionSpace(mesh, element,
+                         constrained_domain=constrained_domain)
 
-        """
 
-        # Check arguments
-        if not len(spaces) > 0:
-            cpp.dolfin_error("functionspace.py",
-                             "create enriched function space",
-                             "Need at least one subspace")
-        if not all(isinstance(V, FunctionSpaceBase) for V in spaces):
-            cpp.dolfin_error("functionspace.py",
-                             "create enriched function space",
-                             "Invalid subspaces: " + str(spaces))
+def MixedFunctionSpace(spaces):
+    """
+    Create mixed finite element function space.
 
-        # Create element
-        element = ufl.EnrichedElement(*[V.ufl_element() for V in spaces])
+    *Arguments*
+        spaces
+            a list (or tuple) of :py:class:`FunctionSpaces
+            <dolfin.functions.functionspace.FunctionSpace>`.
 
-        # Get common mesh and constrained_domain, must all be the same
-        mesh, constrained_domain = _get_common_mesh_and_constrained_domain(spaces, "enriched")
+    *Examples of usage*
+        The function space may be created by
 
-        # Initialize base class
-        FunctionSpaceBase.__init__(self, mesh, element, constrained_domain=constrained_domain)
+        .. code-block:: python
 
-class MixedFunctionSpace(FunctionSpaceBase):
-    "MixedFunctionSpace represents a mixed finite element function space."
+            V = MixedFunctionSpace(spaces)
 
-    def __init__(self, spaces):
-        """
-        Create mixed finite element function space.
+        ``spaces`` may consist of multiple occurances of the same space:
 
-        *Arguments*
-            spaces
-                a list (or tuple) of :py:class:`FunctionSpaces
-                <dolfin.functions.functionspace.FunctionSpace>`.
+        .. code-block:: python
 
-        *Examples of usage*
-            The function space may be created by
+            P1  = FunctionSpace(mesh, "CG", 1)
+            P2v = VectorFunctionSpace(mesh, "Lagrange", 2)
 
-            .. code-block:: python
+            ME  = MixedFunctionSpace([P2v, P1, P1, P1])
 
-                V = MixedFunctionSpace(spaces)
+    """
+    cpp.deprecation("'MixedFunctionSpace'", "2016.1",
+                    "Use 'FunctionSpace(mesh, MixedElement(...))'.")
 
-            ``spaces`` may consist of multiple occurances of the same space:
+    # Check arguments
+    if not len(spaces) > 0:
+        cpp.dolfin_error("functionspace.py",
+                         "create mixed function space",
+                         "Need at least one subspace")
+    if not all(isinstance(V, FunctionSpace) for V in spaces):
+        cpp.dolfin_error("functionspace.py",
+                         "create mixed function space",
+                         "Invalid subspaces: " + str(spaces))
 
-            .. code-block:: python
+    # Get common mesh and constrained_domain, must all be the same
+    mesh, constrained_domain = _get_common_mesh_and_constrained_domain(spaces)
 
-                P1  = FunctionSpace(mesh, "CG", 1)
-                P2v = VectorFunctionSpace(mesh, "Lagrange", 2)
+    # Create UFL element
+    element = ufl.MixedElement(*[V.ufl_element() for V in spaces])
 
-                ME  = MixedFunctionSpace([P2v, P1, P1, P1])
+    return FunctionSpace(mesh, element,
+                         constrained_domain=constrained_domain)
 
-        """
 
-        # Check arguments
-        if not len(spaces) > 0:
-            cpp.dolfin_error("functionspace.py",
-                             "create mixed function space",
-                             "Need at least one subspace")
-        if not all(isinstance(V, FunctionSpaceBase) for V in spaces):
-            cpp.dolfin_error("functionspace.py",
-                             "create mixed function space",
-                             "Invalid subspaces: " + str(spaces))
+def VectorFunctionSpace(mesh, family, degree, dim=None, form_degree=None,
+                        constrained_domain=None, restriction=None):
+    """Create vector-valued finite element function space.
 
-        # Create UFL element
-        element = ufl.MixedElement(*[V.ufl_element() for V in spaces])
+    Use VectorFunctionSpace if the unknown is a vector field,
+    instead of a :py:class:`FunctionSpace
+    <dolfin.functions.functionspace.FunctionSpace>` object for
+    scalar fields.
 
-        # Get common mesh and constrained_domain, must all be the same
-        mesh, constrained_domain \
-        = _get_common_mesh_and_constrained_domain(spaces, "mixed")
+    *Arguments*
+        mesh (:py:class:`Mesh <dolfin.cpp.Mesh>`)
+            the mesh
+        family (string)
+            a string specifying the element family, see
+            :py:class:`FunctionSpace
+            <dolfin.functions.functionspace.FunctionSpace>` for
+            alternatives.
+        degree (int)
+            the (polynomial) degree of the element.
+        dim (int)
+            an optional argument specifying the number of components.
+        form_degree (int)
+            an optional argument specifying the degree of the
+            k-form (used for FEEC notation)
+
+    If the dim argument is not provided, the dimension will be
+    deduced from the dimension of the mesh.
+
+    *Example of usage*
 
-        # Initialize base class using mesh from first space
-        FunctionSpaceBase.__init__(self, mesh, element, \
-                                   constrained_domain=constrained_domain)
+        .. code-block:: python
 
-class VectorFunctionSpace(MixedFunctionSpace):
-    "VectorFunctionSpace represents a vector-valued finite element function space."
+            V = VectorFunctionSpace(mesh, "CG", 1)
 
-    def __init__(self, mesh, family, degree, dim=None, form_degree=None,
-                 constrained_domain=None, restriction=None):
-        """Create vector-valued finite element function space.
+    """
+    # Create element
+    element = ufl.VectorElement(family, mesh.ufl_cell(), degree, dim=dim,
+                                form_degree=form_degree)
+    if restriction is not None:
+        element = element[restriction]
 
-        Use VectorFunctionSpace if the unknown is a vector field,
-        instead of a :py:class:`FunctionSpace
-        <dolfin.functions.functionspace.FunctionSpace>` object for
-        scalar fields.
+    return FunctionSpace(mesh, element,
+                         constrained_domain=constrained_domain)
 
-        *Arguments*
-            mesh (:py:class:`Mesh <dolfin.cpp.Mesh>`)
-                the mesh
-            family (string)
-                a string specifying the element family, see
-                :py:class:`FunctionSpace
-                <dolfin.functions.functionspace.FunctionSpace>` for
-                alternatives.
-            degree (int)
-                the (polynomial) degree of the element.
-            dim (int)
-                an optional argument specifying the number of components.
-            form_degree (int)
-                an optional argument specifying the degree of the
-                k-form (used for FEEC notation)
 
-        If the dim argument is not provided, the dimension will be
-        deduced from the dimension of the mesh.
+def TensorFunctionSpace(mesh, family, degree, shape=None, symmetry=None,
+                        constrained_domain=None, restriction=None):
+    """Create tensor-valued finite element function space.
 
-        *Example of usage*
+    *Arguments*
+        mesh
+            a :py:class:`Mesh <dolfin.cpp.Mesh>`.
+        family
+            a string specifying the element family,
+            see :py:class:`FunctionSpace
+            <dolfin.functions.functionspace.FunctionSpace>`
+            for alternatives.
+        degree
+            the degree of the element.
+        shape
+            an optional argument specifying the shape of the tensor.
+        symmetry
+            optional argument specifying whether the tensor is symmetric.
+
+    If the shape argument is not provided, the dimension will be
+    deduced from the dimension of the mesh.
+
+    *Example of usage*
 
-            .. code-block:: python
+        .. code-block:: python
 
-                V = VectorFunctionSpace(mesh, "CG", 1)
+            V = TensorFunctionSpace(mesh, "CG", 1)
 
-        """
+    """
+    # Create element
+    element = ufl.TensorElement(family, mesh.ufl_cell(), degree, shape,
+                                symmetry)
+    if restriction is not None:
+        element = element[restriction]
 
-        # Get Mesh or Restriction from Domain or Domain from Mesh or
-        # Restriction
-        ufl_domain, mesh = _analyse_mesh_argument(mesh)
+    return FunctionSpace(mesh, element,
+                         constrained_domain=constrained_domain)
 
-        # Create element
-        element = ufl.VectorElement(family, ufl_domain, degree, dim=dim,
-                                    form_degree=form_degree)
-        if restriction is not None:
-            element = element[restriction]
 
-        # Initialize base class
-        FunctionSpaceBase.__init__(self, mesh, element,
-                                   constrained_domain=constrained_domain)
+def MultiMeshFunctionSpace(multimesh, family, degree=None):
+    """Create multimesh finite element function space.
 
-class TensorFunctionSpace(FunctionSpaceBase):
-    "TensorFunctionSpace represents a tensor-valued finite element function space."
+    *Arguments*
+        multimesh
+            a :py:class:`MultiMesh <dolfin.cpp.MultiMesh>`.
+        family
+            a string specifying the element family,
+            see :py:class:`FunctionSpace
+            <dolfin.functions.functionspace.FunctionSpace>`
+            for alternatives.
+
+            This argument may also be a `FiniteElement`, in
+            which case the `degree` argument should not be
+            specified.
+        degree
+            the degree of the element.
+
+    *Example of usage*
 
-    def __init__(self, mesh, family, degree, shape=None, symmetry=None, \
-                 constrained_domain=None, restriction=None):
-        """Create tensor-valued finite element function space.
+        .. code-block:: python
 
-        *Arguments*
-            mesh
-                a :py:class:`Mesh <dolfin.cpp.Mesh>`.
-            family
-                a string specifying the element family,
-                see :py:class:`FunctionSpace
-                <dolfin.functions.functionspace.FunctionSpace>`
-                for alternatives.
-            degree
-                the degree of the element.
-            shape
-                an optional argument specifying the shape of the tensor.
-            symmetry
-                optional argument specifying whether the tensor is symmetric.
+            V = MultiMeshFunctionSpace(mesh, "CG", 1)
 
-        If the shape argument is not provided, the dimension will be
-        deduced from the dimension of the mesh.
+            element = FiniteElement("Lagrange", triangle, 1)
+            V = MultiMeshFunctionSpace(mesh, element)
 
-        *Example of usage*
+    Note: Multimesh function spaces does currently not support
+    function space algebra. For this reason, mixed function spaces
+    and the like must be created via a finite element.
+    """
 
-            .. code-block:: python
+    # Check arguments
+    if not isinstance(multimesh, cpp.MultiMesh):
+        cpp.dolfin_error("functionspace.py",
+                         "create multimesh function space",
+                         "Illegal argument, not a multimesh: " + str(multimesh))
 
-                V = TensorFunctionSpace(mesh, "CG", 1)
+    # Create element if not supplied
+    if isinstance(family, ufl.FiniteElementBase):
+        element = family
+    else:
+        mesh = multimesh.part(0)
+        element = ufl.FiniteElement(family, mesh.ufl_cell(), degree)
 
-        """
+    # Create and add individual function spaces
+    V = cpp.MultiMeshFunctionSpace(multimesh)
+    V_parts = []
+    for part in range(multimesh.num_parts()):
+        V_part = FunctionSpace(multimesh.part(part), element)
+        V_parts.append(V_part)
+        V.add(V_part)
 
-        # Get Mesh or Restriction from Domain or Domain from Mesh or
-        # Restriction
-        ufl_domain, mesh = _analyse_mesh_argument(mesh)
+    # Build multimesh function space
+    V.build()
 
-        # Create element
-        element = ufl.TensorElement(family, ufl_domain, degree, shape, symmetry)
-        if restriction is not None:
-            element = element[restriction]
+    # Store full function spaces
+    V._parts = V_parts
 
-        # Initialize base class
-        FunctionSpaceBase.__init__(self, mesh, element, \
-                                   constrained_domain=constrained_domain)
+    return V
diff --git a/site-packages/dolfin/functions/specialfunctions.py b/site-packages/dolfin/functions/specialfunctions.py
index 08b8b88..c335348 100644
--- a/site-packages/dolfin/functions/specialfunctions.py
+++ b/site-packages/dolfin/functions/specialfunctions.py
@@ -21,7 +21,7 @@
 #
 # Modified by Johan Hake 2008-2009
 # Modified by Garth N. Wells 2010
-# Modified by Martin S. Alnaes 2013-2014
+# Modified by Martin Sandve Alnæs 2013-2014
 
 __all__ = ["MeshCoordinates", "FacetArea", "FacetNormal", "CellSize", "CellVolume",
            'SpatialCoordinate', 'CellNormal', 'Circumradius', 'MinFacetEdgeLength', 'MaxFacetEdgeLength']
@@ -35,21 +35,33 @@ from dolfin.functions.expression import Expression
 
 def _mesh2domain(mesh):
     "Deprecation mechanism for symbolic geometry."
-    if isinstance(mesh, ufl.Cell):
+
+    # Handle MultiMesh
+    if isinstance(mesh, cpp.MultiMesh):
+        mesh = mesh.part(0)
+
+    if isinstance(mesh, ufl.cell.AbstractCell):
         raise TypeError("Cannot construct geometry from a Cell. Pass the mesh instead, for example use FacetNormal(mesh) instead of FacetNormal(triangle) or triangle.n")
-    return ufl.as_domain(mesh)
+    return mesh.ufl_domain()
 
 class MeshCoordinates(Expression, ufl.Coefficient, cpp.MeshCoordinates):
     def __init__(self, mesh):
         "Create function that evaluates to the mesh coordinates at each vertex."
+        # Initialize C++ part
         cpp.MeshCoordinates.__init__(self, mesh)
-        self._ufl_element = ufl.VectorElement("Lagrange", mesh.ufl_domain(), 1)
-        ufl.Coefficient.__init__(self, self._ufl_element, count=self.id())
+
+        # Initialize UFL part
+        ufl_element = mesh.ufl_domain().ufl_coordinate_element()
+        if ufl_element.family() != "Lagrange" or ufl_element.degree() != 1:
+            cpp.dolfin_error("specialfunctions.py",
+                             "initialize MeshCoordinates",
+                             "dolfin::MeshCoordinates only supports affine meshes")
+        ufl_function_space = ufl.FunctionSpace(mesh.ufl_domain(), ufl_element)
+        ufl.Coefficient.__init__(self, ufl_function_space, count=self.id())
 
 MeshCoordinates.__doc__ = cpp.MeshCoordinates.__doc__
 
 class FacetArea(Expression, ufl.Coefficient, cpp.FacetArea):
-
     def __init__(self, mesh):
         """
         Create function that evaluates to the facet area/length on each facet.
@@ -66,9 +78,19 @@ class FacetArea(Expression, ufl.Coefficient, cpp.FacetArea):
                 fa = FacetArea(mesh)
 
         """
+
+        # Handle MultiMesh
+        if isinstance(mesh, cpp.MultiMesh):
+            mesh = mesh.part(0)
+
+        # Initialize C++ part
         cpp.FacetArea.__init__(self, mesh)
-        self._ufl_element = ufl.FiniteElement("Discontinuous Lagrange", mesh.ufl_domain(), 0)
-        ufl.Coefficient.__init__(self, self._ufl_element, count=self.id())
+
+        # Initialize UFL part
+        # NB! This is defined as a piecewise constant function for each cell, not for each facet!
+        ufl_element = ufl.FiniteElement("Discontinuous Lagrange", mesh.ufl_cell(), 0)
+        ufl_function_space = ufl.FunctionSpace(mesh.ufl_domain(), ufl_element)
+        ufl.Coefficient.__init__(self, ufl_function_space, count=self.id())
 
 FacetArea.__doc__ = cpp.FacetArea.__doc__
 
@@ -90,6 +112,7 @@ def FacetNormal(mesh):
             n = FacetNormal(mesh)
 
     """
+
     return ufl.FacetNormal(_mesh2domain(mesh))
 
 # Simple definition of CellSize via UFL
@@ -109,6 +132,7 @@ def CellSize(mesh):
             h = CellSize(mesh)
 
     """
+
     return 2.0*ufl.Circumradius(_mesh2domain(mesh))
 
 # Simple definition of CellVolume via UFL
@@ -128,6 +152,7 @@ def CellVolume(mesh):
             vol = CellVolume(mesh)
 
     """
+
     return ufl.CellVolume(_mesh2domain(mesh))
 
 # Simple definition of SpatialCoordinate via UFL
@@ -147,6 +172,7 @@ def SpatialCoordinate(mesh):
             vol = SpatialCoordinate(mesh)
 
     """
+
     return ufl.SpatialCoordinate(_mesh2domain(mesh))
 
 # Simple definition of CellNormal via UFL
@@ -166,6 +192,7 @@ def CellNormal(mesh):
             vol = CellNormal(mesh)
 
     """
+
     return ufl.CellNormal(_mesh2domain(mesh))
 
 # Simple definition of Circumradius via UFL
@@ -185,6 +212,7 @@ def Circumradius(mesh):
             vol = Circumradius(mesh)
 
     """
+
     return ufl.Circumradius(_mesh2domain(mesh))
 
 # Simple definition of MinFacetEdgeLength via UFL
@@ -204,6 +232,7 @@ def MinFacetEdgeLength(mesh):
             vol = MinFacetEdgeLength(mesh)
 
     """
+
     return ufl.MinFacetEdgeLength(_mesh2domain(mesh))
 
 # Simple definition of MaxFacetEdgeLength via UFL
@@ -223,4 +252,5 @@ def MaxFacetEdgeLength(mesh):
             vol = MaxFacetEdgeLength(mesh)
 
     """
+
     return ufl.MaxFacetEdgeLength(_mesh2domain(mesh))
diff --git a/site-packages/dolfin/functions/ufc_functionspace.py b/site-packages/dolfin/functions/ufc_functionspace.py
deleted file mode 100644
index 5f54bee..0000000
--- a/site-packages/dolfin/functions/ufc_functionspace.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import dolfin.cpp as cpp
-
-__all__ = ["UFCFunctionSpace", "create_ufc_function_spaces"]
-
-class UFCFunctionSpace(cpp.FunctionSpace):
-    def __init__(self, mesh, ufc_finite_element, ufc_dofmap):
-        self._mesh = mesh
-        self._finite_element     = cpp.FiniteElement(ufc_finite_element)
-        self._dofmap             = cpp.DofMap(ufc_dofmap, mesh)
-        self._ufc_finite_element = ufc_finite_element
-        self._ufc_dofmap         = ufc_dofmap
-        cpp.FunctionSpace.__init__(self, mesh, finite_element, dofmap)
-
-def create_ufc_function_spaces(mesh, ufc_form, cache=None):
-    functionspaces = []
-    if cache is None:
-        cache = {}
-    for i in range(ufc_form.rank() + ufc_form.num_coefficients()):
-        fe = ufc_form.create_finite_element(i)
-        fesig = fe.signature()
-
-        V = cache.get(fesig)
-        if V is None:
-            dm = ufc_form.create_dofmap(i)
-
-            V = UFCFunctionSpace(mesh, fe, dm)
-            cache[fesig] = V
-
-        functionspaces.append(V)
-    return functionspaces, cache
-
-
diff --git a/site-packages/dolfin/importhandler/__init__.py b/site-packages/dolfin/importhandler/__init__.py
index 12d5e3d..6bf6e33 100644
--- a/site-packages/dolfin/importhandler/__init__.py
+++ b/site-packages/dolfin/importhandler/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """The importhandler module of dolfin"""
 
 # NOTE: The automatic documentation system in DOLFIN requires to _not_ define
diff --git a/site-packages/dolfin/mesh/__init__.py b/site-packages/dolfin/mesh/__init__.py
index c9303d8..11c97f7 100644
--- a/site-packages/dolfin/mesh/__init__.py
+++ b/site-packages/dolfin/mesh/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """The mesh module of dolfin"""
 from dolfin.mesh import meshes
 from dolfin.mesh import ale
diff --git a/site-packages/dolfin/mesh/ale.py b/site-packages/dolfin/mesh/ale.py
index ea6f20c..6b15989 100644
--- a/site-packages/dolfin/mesh/ale.py
+++ b/site-packages/dolfin/mesh/ale.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2009-2011 Anders Logg
 #
 # This file is part of DOLFIN.
@@ -42,10 +43,10 @@ def compute_vertex_map(mesh0, mesh1):
     """
 
     # Check arguments
-    if not isinstance(mesh0, Mesh):
-        raise TypeError("expected 'Mesh' as argument")
-    if not isinstance(mesh1, Mesh):
-        raise TypeError("expected 'Mesh' as argument")
+    if not isinstance(mesh0, cpp.Mesh) or not isinstance(mesh1, cpp.Mesh):
+        cpp.dolfin_error("ale.py",
+                         "compute vertex map",
+                         "Expected 'Mesh' as argument")
 
     # Get parent vertex numbers
     vertices0 = mesh0.data().array("parent_vertex_indices", 0)
@@ -89,10 +90,10 @@ def compute_edge_map(mesh0, mesh1):
     """
 
     # Check arguments
-    if not isinstance(mesh0, Mesh):
-        raise TypeError("expected 'Mesh' as argument")
-    if not isinstance(mesh1, Mesh):
-        raise TypeError("expected 'Mesh' as argument")
+    if not isinstance(mesh0, cpp.Mesh) or not isinstance(mesh1, cpp.Mesh):
+        cpp.dolfin_error("ale.py",
+                         "compute edge map",
+                         "Expected 'Mesh' as argument")
 
     # Get parent vertex numbers
     vertices0 = mesh0.data().array("parent_vertex_indices", 0)
@@ -136,10 +137,10 @@ def init_parent_edge_indices(submesh, mesh):
     "Initialize data 'parent_edge_indices' for submesh."
 
     # Check arguments
-    if not isinstance(submesh, Mesh):
-        raise TypeError("expected 'Mesh' as argument")
-    if not isinstance(mesh, Mesh):
-        raise TypeError("expected 'Mesh' as argument")
+    if not isinstance(submesh, cpp.Mesh) or not isinstance(mesh, cpp.Mesh):
+        cpp.dolfin_error("ale.py",
+                         "initialize parent edge indices",
+                         "Expected 'Mesh' as argument")
 
     # Check if edge map has already been computed
     if not submesh.data().exists("parent_edge_indices", 1):
diff --git a/site-packages/dolfin/mesh/boundarysubdomainfinder.py b/site-packages/dolfin/mesh/boundarysubdomainfinder.py
index 306b539..f555c97 100644
--- a/site-packages/dolfin/mesh/boundarysubdomainfinder.py
+++ b/site-packages/dolfin/mesh/boundarysubdomainfinder.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2008 Kent-Andre Mardal
 #
 # This file is part of DOLFIN.
diff --git a/site-packages/dolfin/mesh/meshes.py b/site-packages/dolfin/mesh/meshes.py
index 2b77507..d18abeb 100644
--- a/site-packages/dolfin/mesh/meshes.py
+++ b/site-packages/dolfin/mesh/meshes.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 "This module provides a simple Python wrapper for the SWIG-generated Mesh class"
 
 # Copyright (C) 2012-2014 Anders Logg
@@ -18,10 +19,13 @@
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
 # Modified by Marie E. Rognes (meg at simula.no)
-# Modified by Martin S. Alnaes (martinal at simula.no) 2014
+# Modified by Martin Sandve Alnæs (martinal at simula.no) 2014
 
 __all__ = []
 
+# Import ufl (used by Mesh extensions in dolfin/swig/mesh/post.i)
+import ufl
+
 # Import SWIG-generated extension module (DOLFIN C++)
 import dolfin.cpp as cpp
 
@@ -62,6 +66,10 @@ def __init__(self, *args, **kwargs):
 cpp.Mesh.__cppinit__ = cpp.Mesh.__init__
 cpp.Mesh.__init__ = __init__
 
+def mesh2html(mesh, display_width=800.0):
+    return cpp.X3DOM.html(mesh)
+
 # Attach ipython notebook svg rendering function for 1D and 2D meshes
 from dolfin.mesh.svgtools import mesh2svg
 cpp.Mesh._repr_svg_ = mesh2svg
+cpp.Mesh._repr_html_ = mesh2html
diff --git a/site-packages/dolfin/mesh/refinement.py b/site-packages/dolfin/mesh/refinement.py
index 79cef2e..a36ec1e 100644
--- a/site-packages/dolfin/mesh/refinement.py
+++ b/site-packages/dolfin/mesh/refinement.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 "This module provides uniform and local mesh refinement."
 
 # Copyright (C) 2009 Anders Logg
diff --git a/site-packages/dolfin/mesh/svgtools.py b/site-packages/dolfin/mesh/svgtools.py
index f4c8034..0f23377 100644
--- a/site-packages/dolfin/mesh/svgtools.py
+++ b/site-packages/dolfin/mesh/svgtools.py
@@ -1,7 +1,8 @@
+# -*- coding: utf-8 -*-
 "This module provides a simple SVG renderer of 2D and 1D meshes for use in ipython notebook."
 from six.moves import xrange as range
 
-# Copyright (C) 2013-2014 Martin S. Alnaes
+# Copyright (C) 2013-2014 Martin Sandve Alnæs
 #
 # This file is part of DOLFIN.
 #
@@ -32,6 +33,8 @@ def mesh2svg(mesh, display_width=800.0):
     x = mesh.coordinates()
     num_vertices = x.shape[0]
     d = x.shape[1]
+    if (d == 3):
+        return None
 
     cellname = mesh.ufl_cell().cellname()
     assert d == 1 or d == 2
diff --git a/site-packages/dolfin/multistage/__init__.py b/site-packages/dolfin/multistage/__init__.py
index abbef24..cc16c45 100644
--- a/site-packages/dolfin/multistage/__init__.py
+++ b/site-packages/dolfin/multistage/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """The multistage module of dolfin"""
 from dolfin.multistage import multistagescheme
 from dolfin.multistage import multistagesolvers
diff --git a/site-packages/dolfin/multistage/factorize.py b/site-packages/dolfin/multistage/factorize.py
index 58912b5..ad1063d 100644
--- a/site-packages/dolfin/multistage/factorize.py
+++ b/site-packages/dolfin/multistage/factorize.py
@@ -1,5 +1,6 @@
+# -*- coding: utf-8 -*-
 """ Module to extract scalar expression factors for each test function component."""
-# Copyright (C) 2014 Martin S. Alnaes
+# Copyright (C) 2014 Martin Sandve Alnæs
 #
 # This file is part of DOLFIN.
 #
@@ -25,7 +26,7 @@ from ufl import *
 from ufl.corealg.multifunction import MultiFunction
 from ufl.corealg.map_dag import map_expr_dag
 from ufl.classes import Argument, MultiIndex, Indexed, FixedIndex
-from ufl.log import error
+from ufl.log import error as ufl_error
 
 __all__ = ["extract_tested_expressions"]
 
@@ -41,37 +42,37 @@ class ScalarFactorizer(MultiFunction):
         if self._arg is None:
             self._arg = expr
         elif self._arg is not expr:
-            error("Expecting only one Argument in this algorithm implementation.")
+            ufl_error("Expecting only one Argument in this algorithm implementation.")
         return { component: self._one }
 
     def argument(self, e):
         if e.ufl_shape != ():
-            error("Nonscalar argument {}.".format(str(e)))
+            ufl_error("Nonscalar argument {}.".format(str(e)))
         return self._argument(0, e)
 
     def terminal(self, t):
         if t.ufl_shape != ():
-            error("Nonscalar terminal {}.".format(str(t)))
+            ufl_error("Nonscalar terminal {}.".format(str(t)))
         return t
 
     def indexed(self, e):
         if e.ufl_shape != ():
-            error("Nonscalar indexed {}.".format(str(e)))
+            ufl_error("Nonscalar indexed {}.".format(str(e)))
 
-        v, i = e.operands()
+        v, i = e.ufl_operands
 
         if v._ufl_typecode_ == Argument._ufl_typecode_:
             if len(i) != 1 or not isinstance(i[0], FixedIndex):
-                error("Expecting only vector valued Arguments in this algorithm implementation.")
+                ufl_error("Expecting only vector valued Arguments in this algorithm implementation.")
             return self._argument(int(i[0]), v)
 
         return e
 
     def operator(self, e, *ops):
         if e.ufl_shape != ():
-            error("Nonscalar operator {}.".format(str(e)))
+            ufl_error("Nonscalar operator {}.".format(str(e)))
         if any(isinstance(op, dict) for op in ops):
-            error("Handler for operator {} assumes no Arguments among operands.".format(e._ufl_handler_name_))
+            ufl_error("Handler for operator {} assumes no Arguments among operands.".format(e._ufl_handler_name_))
         return e
 
     def sum(self, e, a, b):
@@ -94,7 +95,7 @@ class ScalarFactorizer(MultiFunction):
                     c[k] = av + bv
             return c
         elif n_a or n_b:
-            error("Cannot add Argument-dependent expression with non-Argument-dependent expression.")
+            ufl_error("Cannot add Argument-dependent expression with non-Argument-dependent expression.")
         else:
             return e
 
@@ -102,7 +103,7 @@ class ScalarFactorizer(MultiFunction):
         a_is_dict = isinstance(a, dict)
         b_is_dict = isinstance(b, dict)
         if a_is_dict and b_is_dict:
-            error("Expecting only one Argument in this algorithm. Products of Arguments are not allowed.")
+            ufl_error("Expecting only one Argument in this algorithm. Products of Arguments are not allowed.")
         elif a_is_dict:
             c = {}
             for k,v in a.items():
@@ -118,7 +119,7 @@ class ScalarFactorizer(MultiFunction):
 
     def division(self, e, a, b):
         if isinstance(b, dict):
-            error("Cannot divide by Arguments.")
+            ufl_error("Cannot divide by Arguments.")
         if isinstance(a, dict):
             c = {}
             for k,v in a.items():
diff --git a/site-packages/dolfin/multistage/multistagescheme.py b/site-packages/dolfin/multistage/multistagescheme.py
index a0d1c9b..36b0e35 100644
--- a/site-packages/dolfin/multistage/multistagescheme.py
+++ b/site-packages/dolfin/multistage/multistagescheme.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module defines different MultiStageScheme classes which can be
 passed to a RKSolver or PointIntegralSolver"""
 
@@ -19,7 +20,7 @@ passed to a RKSolver or PointIntegralSolver"""
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
 # Modified by Patrick Farrell, 2013
-# Modified by Martin Alnes, 2015
+# Modified by Martin Sandve Alnæs, 2015
 
 import numpy as np
 import functools
@@ -44,9 +45,11 @@ from ufl.algorithms import expand_derivatives
 # FIXME: Add support for algebraic parts (at least for implicit)
 # FIXME: Add support for implicit/explicit split ala IMEX schemes
 
+
 def safe_adjoint(x):
     return adjoint(x, reordered_arguments=x.arguments())
 
+
 def safe_action(x, y):
     x = expand_derivatives(x)
     if x.integrals() == ():
@@ -54,6 +57,7 @@ def safe_action(x, y):
     else:
         return ufl_action(x, y)
 
+
 def _check_abc(a, b, c):
     if not (isinstance(a, np.ndarray) and (len(a) == 1 or \
             (len(a.shape)==2 and a.shape[0] == a.shape[1]))):
@@ -102,6 +106,7 @@ def _check_abc(a, b, c):
 
     return a
 
+
 def _check_form(rhs_form):
     if not isinstance(rhs_form, ufl.Form):
         raise TypeError("Expected a ufl.Form as the 5th argument.")
@@ -123,6 +128,7 @@ def _check_form(rhs_form):
 
     return DX
 
+
 def _time_dependent_expressions(rhs_form, time):
     """
     Return a list of expressions which uses the present time as a parameter
@@ -141,15 +147,16 @@ def _time_dependent_expressions(rhs_form, time):
 
     return time_dependent_expressions
 
+
 def _replace_dict_time_dependent_expression(time_dep_expressions, time, dt, c):
     assert(isinstance(c, float))
     replace_dict = {}
     if c == 0.0 or not time_dep_expressions:
         return replace_dict
-    new_time = Expression("time+c*dt", time=time, c=c, dt=dt)
+    new_time = Expression("time + c*dt", time=time, c=c, dt=dt, degree=0)
     for expr, c_names in list(time_dep_expressions.items()):
         assert(isinstance(expr, Expression))
-        kwargs = dict(name=expr.name(), label=expr.label(), \
+        kwargs = dict(name=expr.name(), label=expr.label(),
                       element=expr.ufl_element(), **expr.user_parameters)
         for c_name in c_names:
             kwargs[c_name] = new_time
@@ -205,7 +212,7 @@ def _butcher_scheme_generator(a, b, c, time, solution, rhs_form):
     y_ = solution
     time_ = time
     time_dep_expressions = _time_dependent_expressions(rhs_form, time)
-    zero_ = ufl.zero(*y_.shape())
+    zero_ = ufl.zero(*y_.ufl_shape)
     for i, ki in enumerate(k):
 
         # Check whether the stage is explicit
@@ -216,7 +223,7 @@ def _butcher_scheme_generator(a, b, c, time, solution, rhs_form):
                                   for j in range(i+1)], zero_)
         time = time_ + dt*c[i]
 
-        replace_dict = _replace_dict_time_dependent_expression(time_dep_expressions, \
+        replace_dict = _replace_dict_time_dependent_expression(time_dep_expressions,
                                                                time_, dt, c[i])
 
         replace_dict[y_] = evalargs
@@ -277,6 +284,7 @@ def _butcher_scheme_generator(a, b, c, time, solution, rhs_form):
     return ufl_stage_forms, dolfin_stage_forms, jacobian_indices, last_stage, \
            k, dt, human_form, None
 
+
 def _butcher_scheme_generator_tlm(a, b, c, time, solution, rhs_form, perturbation):
     """
     Generates a list of forms and solutions for a given Butcher tableau
@@ -326,7 +334,7 @@ def _butcher_scheme_generator_tlm(a, b, c, time, solution, rhs_form, perturbatio
     y_ = solution
     time_ = time
     time_dep_expressions = _time_dependent_expressions(rhs_form, time)
-    zero_ = ufl.zero(*y_.shape())
+    zero_ = ufl.zero(*y_.ufl_shape)
     forward_forms = []
     stage_solutions = []
     jacobian_indices = []
@@ -341,7 +349,7 @@ def _butcher_scheme_generator_tlm(a, b, c, time, solution, rhs_form, perturbatio
                                   for j in range(i+1)], zero_)
         time = time_ + dt*c[i]
 
-        replace_dict = _replace_dict_time_dependent_expression(time_dep_expressions, \
+        replace_dict = _replace_dict_time_dependent_expression(time_dep_expressions,
                                                                time_, dt, c[i])
 
         replace_dict[y_] = evalargs
@@ -427,7 +435,8 @@ def _butcher_scheme_generator_tlm(a, b, c, time, solution, rhs_form, perturbatio
     human_form = "\n".join(human_form)
 
     return ufl_stage_forms, dolfin_stage_forms, jacobian_indices, last_stage, \
-           stage_solutions, dt, human_form, perturbation
+        stage_solutions, dt, human_form, perturbation
+
 
 def _butcher_scheme_generator_adm(a, b, c, time, solution, rhs_form, adj):
     """
@@ -478,7 +487,7 @@ def _butcher_scheme_generator_adm(a, b, c, time, solution, rhs_form, adj):
     y_ = solution
     time_ = time
     time_dep_expressions = _time_dependent_expressions(rhs_form, time)
-    zero_ = ufl.zero(*y_.shape())
+    zero_ = ufl.zero(*y_.ufl_shape)
     forward_forms = []
     stage_solutions = []
     jacobian_indices = []
@@ -576,9 +585,9 @@ class MultiStageScheme(cpp.MultiStageScheme):
         self.contraction = contraction
 
         # Pass args to C++ constructor
-        cpp.MultiStageScheme.__init__(self, dolfin_stage_forms, last_stage, \
+        cpp.MultiStageScheme.__init__(self, dolfin_stage_forms, last_stage,
                                       stage_solutions, solution, time, dt,
-                                      dt_stage_offsets, jacobian_indices, order,\
+                                      dt_stage_offsets, jacobian_indices, order,
                                       self.__class__.__name__,
                                       human_form, bcs)
 
@@ -619,11 +628,12 @@ class MultiStageScheme(cpp.MultiStageScheme):
     def to_adm(self, perturbation):
         raise NotImplementedError("'to_adm:' implement in derived classes")
 
+
 class ButcherMultiStageScheme(MultiStageScheme):
     """
     Base class for all MultiStageSchemes
     """
-    def __init__(self, rhs_form, solution, time, bcs, a, b, c, order, \
+    def __init__(self, rhs_form, solution, time, bcs, a, b, c, order,
                  generator=_butcher_scheme_generator):
         bcs = bcs or []
         time = time or Constant(0.0)
@@ -653,7 +663,7 @@ class ButcherMultiStageScheme(MultiStageScheme):
         with respect to that parameter).
         """
 
-        generator = functools.partial(_butcher_scheme_generator_tlm, \
+        generator = functools.partial(_butcher_scheme_generator_tlm,
                                       perturbation=perturbation)
         new_solution = self._solution.copy()
         new_form = ufl.replace(self._rhs_form, {self._solution: new_solution})
@@ -678,6 +688,7 @@ class ButcherMultiStageScheme(MultiStageScheme):
                                        self.a, self.b, self.c, self._order,
                                        generator=generator)
 
+
 class ERK1(ButcherMultiStageScheme):
     """
     Explicit first order Scheme
@@ -688,6 +699,7 @@ class ERK1(ButcherMultiStageScheme):
         c = np.array([0.])
         ButcherMultiStageScheme.__init__(self, rhs_form, solution, t, bcs, a, b, c, 1)
 
+
 class BDF1(ButcherMultiStageScheme):
     """
     Implicit first order scheme
@@ -698,6 +710,7 @@ class BDF1(ButcherMultiStageScheme):
         c = np.array([1.])
         ButcherMultiStageScheme.__init__(self, rhs_form, solution, t, bcs, a, b, c, 1)
 
+
 class ExplicitMidPoint(ButcherMultiStageScheme):
     """
     Explicit 2nd order scheme
@@ -709,6 +722,7 @@ class ExplicitMidPoint(ButcherMultiStageScheme):
         c = np.array([0, 0.5])
         ButcherMultiStageScheme.__init__(self, rhs_form, solution, t, bcs, a, b, c, 2)
 
+
 class CN2(ButcherMultiStageScheme):
     """
     Semi-implicit 2nd order scheme
@@ -720,6 +734,7 @@ class CN2(ButcherMultiStageScheme):
 
         ButcherMultiStageScheme.__init__(self, rhs_form, solution, t, bcs, a, b, c, 2)
 
+
 class ERK4(ButcherMultiStageScheme):
     """
     Explicit 4th order scheme
@@ -735,8 +750,12 @@ class ERK4(ButcherMultiStageScheme):
 
 
 class ESDIRK3(ButcherMultiStageScheme):
-    """
-    Explicit implicit 3rd order scheme
+    """Explicit implicit 3rd order scheme
+
+    See also "Singly diagonally implicit Runge–Kutta methods with an
+    explicit first stage" by A Kværnø - BIT Numerical Mathematics,
+    2004 (p.497)
+
     """
     def __init__(self, rhs_form, solution, t=None, bcs=None):
         a = np.array([[0,                   0,                   0,                   0 ],
@@ -747,9 +766,15 @@ class ESDIRK3(ButcherMultiStageScheme):
         c = a.sum(1)
         ButcherMultiStageScheme.__init__(self, rhs_form, solution, t, bcs, a, b, c, 3)
 
+
 class ESDIRK4(ButcherMultiStageScheme):
     """
     Explicit implicit 4rd order scheme
+
+    See also "Singly diagonally implicit Runge–Kutta methods with an
+    explicit first stage" by A Kværnø - BIT Numerical Mathematics,
+    2004 (p.498)
+
     """
     def __init__(self, rhs_form, solution, t=None, bcs=None):
         a = np.array([[0,                  0,                 0,                  0,                   0],
@@ -762,6 +787,7 @@ class ESDIRK4(ButcherMultiStageScheme):
         c = a.sum(1)
         ButcherMultiStageScheme.__init__(self, rhs_form, solution, t, bcs, a, b, c, 4)
 
+
 # Aliases
 CrankNicolson = CN2
 ExplicitEuler = ERK1
diff --git a/site-packages/dolfin/multistage/multistagesolvers.py b/site-packages/dolfin/multistage/multistagesolvers.py
index b95ee7c..a961478 100644
--- a/site-packages/dolfin/multistage/multistagesolvers.py
+++ b/site-packages/dolfin/multistage/multistagesolvers.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module describes the Python wrapper of the cpp.PointIntegralSolver"""
 
 # Copyright (C) 2013 Johan Hake
diff --git a/site-packages/dolfin/multistage/rushlarsenschemes.py b/site-packages/dolfin/multistage/rushlarsenschemes.py
index 7f5b668..c7b5726 100644
--- a/site-packages/dolfin/multistage/rushlarsenschemes.py
+++ b/site-packages/dolfin/multistage/rushlarsenschemes.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """This module defines different MultiStageScheme classes based on the
 Rush Larsen expicit integration schemes which can be passed to a
 PointIntegralSolver"""
diff --git a/site-packages/dolfin_utils/commands.py b/site-packages/dolfin_utils/commands.py
index 1edef2a..ad7f46b 100644
--- a/site-packages/dolfin_utils/commands.py
+++ b/site-packages/dolfin_utils/commands.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2009 Anders Logg
 #
 # This file is part of DOLFIN.
diff --git a/site-packages/dolfin_utils/cppparser/CppHeaderParser.py b/site-packages/dolfin_utils/cppparser/CppHeaderParser.py
index 98b4d31..48c0ceb 100644
--- a/site-packages/dolfin_utils/cppparser/CppHeaderParser.py
+++ b/site-packages/dolfin_utils/cppparser/CppHeaderParser.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 #!/usr/bin/python
 #
 # Author: Jashua R. Cloutier (contact via https://bitbucket.org/senex)
@@ -48,7 +49,6 @@
 representing the class
 """
 
-from __future__ import print_function
 import ply.lex as lex
 import os
 import sys
@@ -60,10 +60,12 @@ def lineno():
     """Returns the current line number in our program."""
     return inspect.currentframe().f_back.f_lineno
 
-version = __version__ = "2.4.1"
+version = __version__ = "2.7.1"
 
 tokens = [
     'NUMBER',
+    'FLOAT_NUMBER',
+    'TEMPLATE_NAME',
     'NAME',
     'OPEN_PAREN',
     'CLOSE_PAREN',
@@ -98,6 +100,8 @@ tokens = [
 
 t_ignore = " \r.?@\f"
 t_NUMBER = r'[0-9][0-9XxA-Fa-f]*'
+t_FLOAT_NUMBER = r'[-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?'
+t_TEMPLATE_NAME = r'CppHeaderParser_template_[0-9]+'
 t_NAME = r'[<>A-Za-z_~][A-Za-z0-9_]*'
 t_OPEN_PAREN = r'\('
 t_CLOSE_PAREN = r'\)'
@@ -154,7 +158,7 @@ def t_NEWLINE(t):
     t.lexer.lineno += len(t.value)
 
 def t_error(v):
-    print( "Lex error: ", v )
+    print(( "Lex error: ", v ))
 
 lex.lex()
 # Controls error_print
@@ -167,14 +171,14 @@ debug = 0
 debug_trace = 0
 
 def error_print(arg):
-    if print_errors: print("[%4d] %s"%(inspect.currentframe().f_back.f_lineno, arg))
+    if print_errors: print(("[%4d] %s"%(inspect.currentframe().f_back.f_lineno, arg)))
 
 def warning_print(arg):
-    if print_warnings: print("[%4d] %s"%(inspect.currentframe().f_back.f_lineno, arg))
+    if print_warnings: print(("[%4d] %s"%(inspect.currentframe().f_back.f_lineno, arg)))
 
 def debug_print(arg):
     global debug
-    if debug: print("[%4d] %s"%(inspect.currentframe().f_back.f_lineno, arg))
+    if debug: print(("[%4d] %s"%(inspect.currentframe().f_back.f_lineno, arg)))
 
 def trace_print(*arg):
     global debug_trace
@@ -396,7 +400,7 @@ class CppClass(dict):
             if meth['pure_virtual']: r[ meth['name'] ] = meth
         return r
 
-    def __init__(self, nameStack):
+    def __init__(self, nameStack, curTemplate):
         self['nested_classes'] = []
         self['parent'] = None
         self['abstract'] = False
@@ -406,7 +410,9 @@ class CppClass(dict):
         self._public_forward_declares = []
         self['namespace'] = ""
 
-        debug_print( "Class:   %s"%nameStack )
+        debug_print( "Class:    %s"%nameStack )
+        debug_print( "Template: %s"%curTemplate)
+        
         if (len(nameStack) < 2):
             nameStack.insert(1, "")#anonymous struct
         global doxygenCommentCache
@@ -432,6 +438,16 @@ class CppClass(dict):
                 nameStack = new_nameStack
             except: pass
         
+        # Handle final specifier
+        self["final"] = False
+        try:
+            final_index = nameStack.index("final")
+            # Dont trip up the rest of the logic
+            del nameStack[final_index]
+            self["final"] = True
+            trace_print("final")
+        except: pass
+        
         self["name"] = nameStack[1]
         self["line_number"] = detect_lineno(nameStack[0])
         
@@ -526,6 +542,10 @@ class CppClass(dict):
 
         self['inherits'] = inheritList
 
+        if curTemplate:
+            self["template"] = curTemplate
+            trace_print("Setting template to '%s'"%self["template"])
+
         methodAccessSpecificList = {}
         propertyAccessSpecificList = {}
         enumAccessSpecificList = {}
@@ -554,6 +574,7 @@ class CppClass(dict):
         namespace_prefix = ""
         if self["namespace"]: namespace_prefix = self["namespace"] + "::"
         rtn = "%s %s"%(self["declaration_method"], namespace_prefix + self["name"])
+        if self["final"]: rtn += " final"
         if self['abstract']: rtn += '    (abstract)\n'
         else: rtn += '\n'
 
@@ -587,11 +608,12 @@ class CppClass(dict):
         rtn += "  }\n"
         print(rtn)
     
-    def __repr__(self):
+    def __str__(self):
         """Convert class to a string"""
         namespace_prefix = ""
         if self["namespace"]: namespace_prefix = self["namespace"] + "::"
         rtn = "%s %s"%(self["declaration_method"], namespace_prefix + self["name"])
+        if self["final"]: rtn += " final"
         if self['abstract']: rtn += '    (abstract)\n'
         else: rtn += '\n'
 
@@ -643,7 +665,7 @@ class CppUnion( CppClass ):
     """
     
     def __init__(self, nameStack):
-        CppClass.__init__(self, nameStack)
+        CppClass.__init__(self, nameStack, None)
         self["name"] = "union " + self["name"]
         self["members"] = self["properties"]["public"]
     
@@ -657,7 +679,7 @@ class CppUnion( CppClass ):
         print(self)
     
     
-    def __repr__(self):
+    def __str__(self):
         """Convert class to a string"""
         namespace_prefix = ""
         if self["namespace"]: namespace_prefix = self["namespace"] + "::"
@@ -748,8 +770,9 @@ class CppMethod( _CppMethod ):
         if self['destructor']: r.append( 'destructor' )
         return '\n\t\t  '.join( r )
 
-    def __init__(self, nameStack, curClass, methinfo):
+    def __init__(self, nameStack, curClass, methinfo, curTemplate):
         debug_print( "Method:   %s"%nameStack )
+        debug_print( "Template: %s"%curTemplate )
         global doxygenCommentCache
         if len(doxygenCommentCache):
             self["doxygen"] = doxygenCommentCache
@@ -770,13 +793,14 @@ class CppMethod( _CppMethod ):
         self["rtnType"] = self["rtnType"].replace(" >",">").replace(">>", "> >").replace(">>", "> >")
         self["rtnType"] = self["rtnType"].replace(" ,",",")
         
-        self["const"] = False
-        for i in reversed(nameStack):
-            if i == "const":
-                self["const"] = True
-                break
-            elif i == ")":
-                break        
+        for spec in ["const", "final", "override"]:
+            self[spec] = False
+            for i in reversed(nameStack):
+                if i == spec:
+                    self[spec] = True
+                    break
+                elif i == ")":
+                    break
 
         self.update( methinfo )
         self["line_number"] = detect_lineno(nameStack[0])
@@ -798,6 +822,10 @@ class CppMethod( _CppMethod ):
         
         paramsStack = self._params_helper1( nameStack )
         
+        debug_print( "curTemplate: %s"%curTemplate)
+        if curTemplate:
+            self["template"] = curTemplate
+            debug_print( "SET self['template'] to `%s`"%self["template"]) 
 
         params = []
         #See if there is a doxygen comment for the variable
@@ -857,7 +885,7 @@ class CppMethod( _CppMethod ):
         self["parameters"] = params
         self._params_helper2( params )    # mods params inplace
 
-    def __repr__(self):
+    def __str__(self):
         filter_keys = ("parent", "defined", "operator", "returns_reference")
         cpy = dict((k,v) for (k,v) in list(self.items()) if k not in filter_keys)
         return "%s"%cpy
@@ -897,16 +925,38 @@ class CppVariable( _CppVariable ):
     self['namespace'] - Namespace containing the enum
     self['desc'] - Description of the variable if part of a method (optional)
     self['doxygen'] - Doxygen comments associated with the method if they exist
-    self['defaltValue'] - Default value of the variable, this key will only
+    self['defaultValue'] - Default value of the variable, this key will only
         exist if there is a default value
+    self['extern'] - True if its an extern, false if not
     """
     Vars = []
     def __init__(self, nameStack,  **kwargs):
+        debug_print("trace %s"%nameStack)
+        if len(nameStack) and nameStack[0] == "extern":
+            self['extern'] = True
+            del nameStack[0]
+        else:
+            self['extern'] = False
+        
         _stack_ = nameStack
         if "[" in nameStack: #strip off array informatin
             arrayStack = nameStack[nameStack.index("["):]
-            if len(arrayStack) == 3:
-                self["array_size"] = arrayStack[1] 
+            if nameStack.count("[") > 1:
+                debug_print("Multi dimensional array")
+                debug_print("arrayStack=%s"%arrayStack)
+                nums = filter(lambda x: x.isdigit(), arrayStack)
+                # Calculate size by multiplying all dimensions
+                p = 1
+                for n in nums:
+                    p *= int(n)
+                #Multi dimensional array
+                self["array_size"] = p
+                self["multi_dimensional_array"] = 1
+                self["multi_dimensional_array_size"] = "x".join(nums)
+            else:
+                debug_print("Array")
+                if len(arrayStack) == 3:
+                    self["array_size"] = arrayStack[1] 
             nameStack = nameStack[:nameStack.index("[")]
             self["array"] = 1
         else:
@@ -934,7 +984,7 @@ class CppVariable( _CppVariable ):
         elif ("=" in nameStack):
             self["type"] = " ".join(nameStack[:nameStack.index("=") - 1])
             self["name"] = nameStack[nameStack.index("=") - 1]
-            self["defaltValue"] = " ".join(nameStack[nameStack.index("=") + 1:])    # deprecate camelCase in dicts
+            self["defaultValue"] = " ".join(nameStack[nameStack.index("=") + 1:])    # deprecate camelCase in dicts
             self['default'] = " ".join(nameStack[nameStack.index("=") + 1:])
 
         elif is_fundamental(nameStack[-1]) or nameStack[-1] in ['>', '<' , ':', '.']:
@@ -959,8 +1009,8 @@ class CppVariable( _CppVariable ):
         self.init()
         CppVariable.Vars.append( self )        # save and resolve later
     
-    def __repr__(self):
-        keys_white_list = ['constant','name','reference','type','static','pointer','desc', 'line_number']
+    def __str__(self):
+        keys_white_list = ['constant','name','reference','type','static','pointer','desc', 'line_number', 'extern']
         cpy = dict((k,v) for (k,v) in list(self.items()) if k in keys_white_list)
         if "array_size" in self: cpy["array_size"] = self["array_size"]
         return "%s"%cpy
@@ -1070,10 +1120,12 @@ class CppEnum(_CppEnum):
         #Figure out if it has a name
         preBraceStack = nameStack[:nameStack.index("{")]
         postBraceStack = nameStack[nameStack.index("}") + 1:]
+        self["typedef"] = False
         if (len(preBraceStack) == 2 and "typedef" not in nameStack):
             self["name"] = preBraceStack[1]           
         elif len(postBraceStack) and "typedef" in nameStack:
-                self["name"] = " ".join(postBraceStack)
+            self["name"] = " ".join(postBraceStack)
+            self["typedef"] = True
         else: warning_print( 'WARN-enum: nameless enum %s'%nameStack )
         #See if there are instances of this
         if "typedef" not in nameStack and len(postBraceStack):
@@ -1606,7 +1658,10 @@ class _CppHeader( Resolver ):
                     else:
                         trace_print( 'WARN: UNKNOWN RETURN', meth['name'], meth['returns'])
                         meth['returns_unknown'] = True
-
+        
+                if meth["returns"].startswith(": : "):
+                    meth["returns"] = meth["returns"].replace(": : ", "::")
+        
         for cls in list(self.classes.values()):
             methnames = cls.get_all_method_names()
             pvm = cls.get_all_pure_virtual_methods()
@@ -1645,7 +1700,7 @@ class _CppHeader( Resolver ):
     
     def parse_method_type( self, stack ):
         trace_print( 'meth type info', stack )
-        if stack[0] in ':;': stack = stack[1:]
+        if stack[0] in ':;' and stack[1] != ':': stack = stack[1:]
         info = { 
             'debug': ' '.join(stack).replace(' : : ', '::' ).replace(' < ', '<' ).replace(' > ', '> ' ).replace(" >",">").replace(">>", "> >").replace(">>", "> >"), 
             'class':None, 
@@ -1758,11 +1813,11 @@ class _CppHeader( Resolver ):
             trace_print( 'WARN - struct contains methods - skipping' )
             trace_print( self.stack )
             assert 0
-
+        
         info = self.parse_method_type( self.stack )
         if info:
             if info[ 'class' ] and info['class'] in self.classes:     # case where methods are defined outside of class
-                newMethod = CppMethod(self.nameStack, info['name'], info)
+                newMethod = CppMethod(self.nameStack, info['name'], info, self.curTemplate)
                 klass = self.classes[ info['class'] ]
                 klass[ 'methods' ][ 'public' ].append( newMethod )
                 newMethod['parent'] = klass
@@ -1770,7 +1825,7 @@ class _CppHeader( Resolver ):
                 else: newMethod['path'] = klass['name']
                 
             elif self.curClass:    # normal case
-                newMethod = CppMethod(self.nameStack, self.curClass, info)
+                newMethod = CppMethod(self.nameStack, self.curClass, info, self.curTemplate)
                 klass = self.classes[self.curClass]
                 klass['methods'][self.curAccessSpecifier].append(newMethod)
                 newMethod['parent'] = klass
@@ -1778,7 +1833,7 @@ class _CppHeader( Resolver ):
                 else: newMethod['path'] = klass['name']
             else: #non class functions
                 debug_print("FREE FUNCTION")
-                newMethod = CppMethod(self.nameStack, None, info)
+                newMethod = CppMethod(self.nameStack, None, info, self.curTemplate)
                 self.functions.append(newMethod)
             global parseHistory
             parseHistory.append({"braceDepth": self.braceDepth, "item_type": "method", "item": newMethod})
@@ -1795,7 +1850,15 @@ class _CppHeader( Resolver ):
         while stack and stack[-1].isdigit(): stack.pop()    # throw away array size for now
 
         idx = stack.index('typedef')
-        name = namespace + stack[-1]
+        if stack[-1] == "]":
+            try:
+                name = namespace + "".join(stack[-4:])
+                # Strip off the array part so the rest of the parsing is better
+                stack = stack[:-3]
+            except:
+                name = namespace + stack[-1]
+        else:
+            name = namespace + stack[-1]
         s = ''
         for a in stack[idx+1:-1]:
             if a == '{': break
@@ -1823,6 +1886,7 @@ class _CppHeader( Resolver ):
         """Create a Property out of the name stack"""
         global parseHistory
         assert self.stack[-1] == ';'
+        debug_print( "trace" )
         if self.nameStack[0] == 'typedef':
             if self.curClass:
                 typedef = self._parse_typedef( self.stack )
@@ -1859,7 +1923,7 @@ class _CppHeader( Resolver ):
                         self.stack = orig_stack[:] # Not maintained for mucking, but this path it doesnt matter
                         self.evaluate_property_stack()
                     return
-
+            
             newVar = CppVariable(self.nameStack)
             newVar['namespace'] = self.current_namespace()
             if self.curStruct:
@@ -1870,6 +1934,10 @@ class _CppHeader( Resolver ):
                 klass["properties"][self.curAccessSpecifier].append(newVar)
                 newVar['property_of_class'] = klass['name']
             parseHistory.append({"braceDepth": self.braceDepth, "item_type": "variable", "item": newVar})
+        else:
+            debug_print( "Found Global variable" )
+            newVar = CppVariable(self.nameStack)
+            self.variables.append(newVar)
 
         self.stack = []        # CLEAR STACK
 
@@ -1885,6 +1953,14 @@ class _CppHeader( Resolver ):
             error_print( 'ERROR: WRONG BRACE DEPTH' )
             return
         
+        # When dealing with typedefed structs, get rid of typedef keyword to handle later on
+        if self.nameStack[0] == "typedef":
+            del self.nameStack[0]
+            if len(self.nameStack) == 1:
+                self.anon_struct_counter += 1
+                # We cant handle more than 1 anonymous struct, so name them uniquely
+                self.nameStack.append("<anon-struct-%d>"%self.anon_struct_counter)
+        
         if self.nameStack[0] == "class":
             self.curAccessSpecifier = 'private'
         else:#struct
@@ -1895,7 +1971,7 @@ class _CppHeader( Resolver ):
             self.anon_union_counter = [self.braceDepth, 2]
             trace_print( 'NEW UNION', newClass['name'] )
         else:
-            newClass = CppClass(self.nameStack)
+            newClass = CppClass(self.nameStack, self.curTemplate)
             trace_print( 'NEW CLASS', newClass['name'] )
         newClass["declaration_method"] = self.nameStack[0]
         self.classes_order.append( newClass )    # good idea to save ordering
@@ -1994,16 +2070,21 @@ class CppHeader( _CppHeader ):
         self._precomp_macro_buf = [] #for internal purposes, will end up filling out pragmras and defines at the end
 
         self.enums = []
+        self.variables = []
         self.global_enums = {}
         self.nameStack = []
         self.nameSpaces = []
         self.curAccessSpecifier = 'private'    # private is default
+        self.curTemplate = None
         self.accessSpecifierStack = []
         self.accessSpecifierScratch = []
         debug_print("curAccessSpecifier changed/defaulted to %s"%self.curAccessSpecifier)
         self.initextra()
-    
+        # Old namestacks for a given level
+        self.nameStackHistory = []
+        self.anon_struct_counter = 0    
         self.anon_union_counter = [-1, 0]
+        self.templateRegistry = []
     
         if (len(self.headerFileName)):
             fd = open(self.headerFileName)
@@ -2016,7 +2097,37 @@ class CppHeader( _CppHeader ):
             supportedAccessSpecifier[i] = re.sub("[ ]+", " ", supportedAccessSpecifier[i]).strip()
         
         # Strip out template declarations
-        headerFileStr = re.sub("template[\t ]*<[^>]*>", "", headerFileStr)
+        templateSectionsToSliceOut = []
+        try:
+            for m in re.finditer("template[\t ]*<[^>]*>", headerFileStr):
+                start = m.start()
+                # Search for the final '>' which may or may not be caught in the case of nexted <>'s
+                for i in range(start, len(headerFileStr)):
+                    if headerFileStr[i] == '<':
+                        firstBracket = i
+                        break
+                ltgtStackCount = 1
+                #Now look for fianl '>'
+                for i in range(firstBracket + 1, len(headerFileStr)):
+                    if headerFileStr[i] == '<':
+                        ltgtStackCount += 1
+                    elif headerFileStr[i] == '>':
+                        ltgtStackCount -= 1
+                    if ltgtStackCount == 0:
+                        end = i
+                        break
+                templateSectionsToSliceOut.append((start, end))
+            
+            # Now strip out all instances of the template
+            templateSectionsToSliceOut.reverse()
+            for tslice in templateSectionsToSliceOut:
+                # Replace the template symbol with a single symbol
+                template_symbol="CppHeaderParser_template_%d"%len(self.templateRegistry)
+                self.templateRegistry.append(headerFileStr[tslice[0]: tslice[1]+1])
+                newlines = headerFileStr[tslice[0]: tslice[1]].count("\n") * "\n" #Keep line numbers the same
+                headerFileStr = headerFileStr[:tslice[0]] + newlines + " " + template_symbol + " " + headerFileStr[tslice[1] + 1:]
+        except:
+            pass
 
         # Change multi line #defines and expressions to single lines maintaining line nubmers
         # Based from http://stackoverflow.com/questions/2424458/regular-expression-to-match-cs-multiline-preprocessor-statements
@@ -2092,7 +2203,8 @@ class CppHeader( _CppHeader ):
                 tok.value = TagStr(tok.value, lineno=tok.lineno)
                 #debug_print("TOK: %s"%tok)
                 if tok.type == 'NAME' and tok.value in self.IGNORE_NAMES: continue
-                self.stack.append( tok.value )
+                if tok.type != 'TEMPLATE_NAME':
+                    self.stack.append( tok.value )
                 curLine = tok.lineno
                 curChar = tok.lexpos
                 if (tok.type in ('PRECOMP_MACRO', 'PRECOMP_MACRO_CONT')):
@@ -2101,6 +2213,11 @@ class CppHeader( _CppHeader ):
                     self.stack = []
                     self.nameStack = []
                     continue
+                if tok.type == 'TEMPLATE_NAME':
+                    try:
+                        templateId = int(tok.value.replace("CppHeaderParser_template_",""))
+                        self.curTemplate = self.templateRegistry[templateId]
+                    except: pass 
                 if (tok.type == 'OPEN_BRACE'):
                     if len(self.nameStack) >= 2 and is_namespace(self.nameStack):    # namespace {} with no name used in boost, this sets default?
                         if self.nameStack[1] == "__IGNORED_NAMESPACE__CppHeaderParser__":#Used in filtering extern "C"
@@ -2184,6 +2301,8 @@ class CppHeader( _CppHeader ):
                     self.nameStack.append(tok.value)
                 elif (tok.type == 'BACKSLASH'):
                     self.nameStack.append(tok.value)
+                elif (tok.type == 'DIVIDE'):
+                    self.nameStack.append(tok.value)
                 elif (tok.type == 'PIPE'):
                     self.nameStack.append(tok.value)
                 elif (tok.type == 'PERCENT'):
@@ -2193,7 +2312,7 @@ class CppHeader( _CppHeader ):
                 elif (tok.type == 'EXCLAMATION'):
                     self.nameStack.append(tok.value)
                 elif (tok.type == 'SQUOTE'): pass
-                elif (tok.type == 'NUMBER'):
+                elif (tok.type == 'NUMBER' or tok.type == 'FLOAT_NUMBER'):
                     self.nameStack.append(tok.value)
                 elif (tok.type == 'MINUS'):
                     self.nameStack.append(tok.value)
@@ -2264,6 +2383,13 @@ class CppHeader( _CppHeader ):
         self.finalize()
         global parseHistory
         parseHistory = []
+        # Delete some temporary variables
+        for key in ["_precomp_macro_buf", "nameStack", "nameSpaces", "curAccessSpecifier", "accessSpecifierStack",
+            "accessSpecifierScratch", "nameStackHistory", "anon_struct_counter", "anon_union_counter",
+            "_classes_brace_level", "_forward_decls", "stack", "mainClass", "curStruct", "_template_typenames",
+            "_method_body", "braceDepth", "_structs_brace_level", "typedefs_order", "curTemplate", "templateRegistry"]:
+            del self.__dict__[key]
+        
 
     def evaluate_stack(self, token=None):
         """Evaluates the current name stack"""
@@ -2271,6 +2397,7 @@ class CppHeader( _CppHeader ):
         
         self.nameStack = filter_out_attribute_keyword(self.nameStack)
         self.stack = filter_out_attribute_keyword(self.stack)
+        nameStackCopy = self.nameStack[:]
         
         debug_print( "Evaluating stack %s\n       BraceDepth: %s (called from %d)" %(self.nameStack,self.braceDepth, inspect.currentframe().f_back.f_lineno))
         
@@ -2283,6 +2410,8 @@ class CppHeader( _CppHeader ):
         
         if (len(self.curClass)):
             debug_print( "%s (%s) "%(self.curClass, self.curAccessSpecifier))
+        else:
+            debug_print( "<anonymous> (%s) "%self.curAccessSpecifier)
 
         #Filter special case of array with casting in it
         try:
@@ -2295,7 +2424,9 @@ class CppHeader( _CppHeader ):
         except: pass
 
         #if 'typedef' in self.nameStack: self.evaluate_typedef()        # allows nested typedefs, probably a bad idea
-        if not self.curClass and 'typedef' in self.nameStack:
+        if (not self.curClass and 'typedef' in self.nameStack and 
+            (('struct' not in self.nameStack and 'union' not in self.nameStack) or self.stack[-1] == ";") and
+            not is_enum_namestack(self.nameStack)):
             trace_print('STACK', self.stack)
             self.evaluate_typedef()
             return
@@ -2327,21 +2458,28 @@ class CppHeader( _CppHeader ):
             else:
                 #Free function
                 self.evaluate_method_stack()
+        elif (len(self.nameStack) == 1 and len(self.nameStackHistory) > self.braceDepth
+              and (self.nameStackHistory[self.braceDepth][0][0:2] == ["typedef", "struct"] or
+                   self.nameStackHistory[self.braceDepth][0][0:2] == ["typedef", "union"])):
+            # Look for the name of a typedef struct: struct typedef {...] StructName; or unions to get renamed
+            debug_print("found the naming of a union")
+            type_name_to_rename = self.nameStackHistory[self.braceDepth][1]
+            new_name = self.nameStack[0]
+            type_to_rename = self.classes[type_name_to_rename]
+            type_to_rename["name"] = self.nameStack[0]
+            #Now re install it in its new location
+            self.classes[new_name] = type_to_rename
+            del self.classes[type_name_to_rename] 
         elif is_property_namestack(self.nameStack) and self.stack[-1] == ';':
             debug_print( "trace" )
             if self.nameStack[0] in ('class', 'struct') and len(self.stack) == 3: self.evalute_forward_decl()
             elif len(self.nameStack) >= 2 and (self.nameStack[0]=='friend' and self.nameStack[1]=='class'): pass
             else: self.evaluate_property_stack()    # catches class props and structs in a namespace
 
-        elif self.nameStack[0] in ("class", "struct", "union"):
+        elif self.nameStack[0] in ("class", "struct", "union") or self.nameStack[0] == 'typedef' and self.nameStack[1] in ('struct', 'union'):
             #Parsing a union can reuse much of the class parsing
             debug_print( "trace" )
             self.evaluate_class_stack()
-        #elif (self.nameStack[0] == "struct"):
-        #    debug_print( "trace" )
-            ##this causes a bug when structs are nested in protected or private##self.curAccessSpecifier = "public"
-        #    self.evaluate_struct_stack()
-
 
         elif not self.curClass:
             debug_print( "trace" )
@@ -2349,22 +2487,24 @@ class CppHeader( _CppHeader ):
             elif self.curStruct and self.stack[-1] == ';': self.evaluate_property_stack()    # this catches fields of global structs
             self.nameStack = []
             doxygenCommentCache = ""
-            return
         elif (self.braceDepth < 1):
             debug_print( "trace" )
             #Ignore global stuff for now
             debug_print( "Global stuff: %s"%self.nameStack )
             self.nameStack = []
             doxygenCommentCache = ""
-            return
         elif (self.braceDepth > len(self.nameSpaces) + 1):
             debug_print( "trace" )
             self.nameStack = []
             doxygenCommentCache = ""
-            return
 
+        try:
+            self.nameStackHistory[self.braceDepth] = (nameStackCopy, self.curClass)
+        except:
+            self.nameStackHistory.append((nameStackCopy, self.curClass))
         self.nameStack = []        # its a little confusing to have some if/else above return and others not, and then clearning the nameStack down here
         doxygenCommentCache = ""
+        self.curTemplate = None
     
 
     def evaluate_enum_stack(self):
@@ -2392,8 +2532,69 @@ class CppHeader( _CppHeader ):
                     self.evaluate_property_stack()
                 del newEnum["instances"]
 
+    def strip_parent_keys(self):
+        """Strip all parent (and method) keys to prevent loops"""
+        obj_queue = [self]
+        while len(obj_queue):
+            obj = obj_queue.pop()
+            trace_print("pop %s type %s"%(obj, type(obj)))
+            try:
+                if "parent" in obj.keys():
+                    del obj["parent"]
+                    trace_print("Stripped parent from %s"%obj.keys())
+            except: pass
+            try:
+                if "method" in obj.keys():
+                    del obj["method"]
+                    trace_print("Stripped method from %s"%obj.keys())
+            except: pass
+            # Figure out what sub types are one of ours
+            try:
+                if not hasattr(obj, 'keys'):
+                    obj = obj.__dict__
+                for k in obj.keys():
+                    trace_print("-Try key %s"%(k))
+                    trace_print("-type  %s"%(type(obj[k])))
+                    if k in ["nameStackHistory", "parent", "_public_typedefs"]: continue
+                    if type(obj[k]) == list:
+                        for i in obj[k]:
+                            trace_print("push l %s"%i)
+                            obj_queue.append(i)
+                    elif type(obj[k]) == dict: 
+                        if len(obj):
+                            trace_print("push d %s"%obj[k])
+                            obj_queue.append(obj[k])
+                    elif type(obj[k]) == type(type(0)):
+                        if type(obj[k]) == int:
+                            obj[k] = "int"
+                        elif type(obj[k]) == str:
+                            obj[k] = "string"
+                        else:
+                            obj[k] = "???"
+                    trace_print("next key\n")
+            except:
+                trace_print("Exception")
+
+    def toJSON(self, indent=4):
+        """Converts a parsed structure to JSON"""
+        import json
+        self.strip_parent_keys()
+        try:
+            del self.__dict__["classes_order"]
+        except: pass
+        return json.dumps(self.__dict__, indent=indent)
+
 
     def __repr__(self):
+        rtn = {
+          "classes": self.classes,
+          "functions": self.functions,
+          "enums": self.enums,
+          "variables": self.variables,
+        }
+        return repr(rtn)
+
+    def __str__(self):
         rtn = ""
         for className in list(self.classes.keys()):
             rtn += "%s\n"%self.classes[className]
@@ -2401,6 +2602,10 @@ class CppHeader( _CppHeader ):
             rtn += "// functions\n"
             for f in self.functions:
                 rtn += "%s\n"%f
+        if self.variables:
+            rtn += "// variables\n"
+            for f in self.variables:
+                rtn += "%s\n"%f
         if self.enums:
             rtn += "// enums\n"
             for f in self.enums:
diff --git a/site-packages/dolfin_utils/cppparser/__init__.py b/site-packages/dolfin_utils/cppparser/__init__.py
index e0291f4..77a7d65 100644
--- a/site-packages/dolfin_utils/cppparser/__init__.py
+++ b/site-packages/dolfin_utils/cppparser/__init__.py
@@ -1,2 +1,3 @@
+# -*- coding: utf-8 -*-
 from .CppHeaderParser import CppHeader
 from .utils import *
diff --git a/site-packages/dolfin_utils/cppparser/utils.py b/site-packages/dolfin_utils/cppparser/utils.py
index 849c91f..dded3dd 100644
--- a/site-packages/dolfin_utils/cppparser/utils.py
+++ b/site-packages/dolfin_utils/cppparser/utils.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Utilities for parsing DOLFIN files and generaton of SWIG files
 #
 # Copyright (C) 2012 Johan Hake
diff --git a/site-packages/dolfin_utils/documentation/__init__.py b/site-packages/dolfin_utils/documentation/__init__.py
index bb7def6..a182bae 100644
--- a/site-packages/dolfin_utils/documentation/__init__.py
+++ b/site-packages/dolfin_utils/documentation/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 from .extractdocumentation import extract_doc_representation
 from .docstringutils import indent, add_links
 from .generatepythonrst import generate_python_api_documentation
diff --git a/site-packages/dolfin_utils/documentation/docstringutils.py b/site-packages/dolfin_utils/documentation/docstringutils.py
index 528d328..72f65f7 100644
--- a/site-packages/dolfin_utils/documentation/docstringutils.py
+++ b/site-packages/dolfin_utils/documentation/docstringutils.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 "Utility functions for docstring manipulations."
 
 # Copyright (C) 2010 Anders Logg
diff --git a/site-packages/dolfin_utils/documentation/extractdocumentation.py b/site-packages/dolfin_utils/documentation/extractdocumentation.py
index ec19316..eeaa1b5 100644
--- a/site-packages/dolfin_utils/documentation/extractdocumentation.py
+++ b/site-packages/dolfin_utils/documentation/extractdocumentation.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Script to extract documentation from docstrings in *.h files in the DOLFIN
 source tree."""
 
diff --git a/site-packages/dolfin_utils/documentation/generatecpprst.py b/site-packages/dolfin_utils/documentation/generatecpprst.py
index e1158d9..5723f9d 100644
--- a/site-packages/dolfin_utils/documentation/generatecpprst.py
+++ b/site-packages/dolfin_utils/documentation/generatecpprst.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2010 Anders Logg and Kristian Oelgaard
 #
 # This file is part of DOLFIN.
diff --git a/site-packages/dolfin_utils/documentation/generatepythonrst.py b/site-packages/dolfin_utils/documentation/generatepythonrst.py
index c731c2d..d5e8c64 100644
--- a/site-packages/dolfin_utils/documentation/generatepythonrst.py
+++ b/site-packages/dolfin_utils/documentation/generatepythonrst.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2011 Kristian B. Oelgaard
 #
 # This file is part of DOLFIN.
diff --git a/site-packages/dolfin_utils/documentation/indextemplates.py b/site-packages/dolfin_utils/documentation/indextemplates.py
index 2b30c4e..b233d8e 100644
--- a/site-packages/dolfin_utils/documentation/indextemplates.py
+++ b/site-packages/dolfin_utils/documentation/indextemplates.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (C) 2011 Anders Logg, Kristian Oelgaard, and Marie E. Rognes
 #
 # This file is part of DOLFIN.
diff --git a/site-packages/dolfin_utils/meshconvert/abaqus.py b/site-packages/dolfin_utils/meshconvert/abaqus.py
index 64e0592..ef42ef1 100644
--- a/site-packages/dolfin_utils/meshconvert/abaqus.py
+++ b/site-packages/dolfin_utils/meshconvert/abaqus.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Module for converting the  Abaqus mesh format."""
 
 # Copyright (C) 2012 Arve Knudsen and Garth N/ Wells
diff --git a/site-packages/dolfin_utils/meshconvert/meshconvert.py b/site-packages/dolfin_utils/meshconvert/meshconvert.py
index b2c963b..f015072 100644
--- a/site-packages/dolfin_utils/meshconvert/meshconvert.py
+++ b/site-packages/dolfin_utils/meshconvert/meshconvert.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """ Module for converting various mesh formats."""
 
 # Copyright (C) 2006 Anders Logg
@@ -84,15 +85,13 @@ def mesh2xml(ifilename, ofilename):
     """Convert between .mesh and .xml, parser implemented as a
     state machine:
 
-        0 = read 'Dimension'
-        1 = read dimension
-        2 = read 'Vertices'
-        3 = read number of vertices
-        4 = read next vertex
-        5 = read 'Triangles' or 'Tetrahedra'
-        6 = read number of cells
-        7 = read next cell
-        8 = done
+        0 = read 'Vertices'
+        1 = read number of vertices
+        2 = read next vertex
+        3 = read 'Triangles' or 'Tetrahedra'
+        4 = read number of cells
+        5 = read next cell
+        6 = done
 
     """
 
@@ -112,11 +111,14 @@ def mesh2xml(ifilename, ofilename):
         if not line: break
 
         # Remove newline
-        line = line.rstrip("\n\r")
+        line = line.strip(" \n\r").split(" ")
 
-        # Read dimension
-        if  line == "Dimension" or line == " Dimension":
-            line = ifile.readline()
+        # Read dimension either on same line or following line
+        if  line[0] == "Dimension":
+            if (len(line) == 2):
+                line = line[1]
+            else:
+                line = ifile.readline()
             num_dims = int(line)
             if num_dims == 2:
                 cell_type = "triangle"
@@ -157,19 +159,13 @@ def mesh2xml(ifilename, ofilename):
         line = line.rstrip("\n\r")
 
         if state == 0:
-            if line == "Dimension" or line == " Dimension":
-                state += 1
-        elif state == 1:
-            num_dims = int(line)
-            state +=1
-        elif state == 2:
             if line == "Vertices" or line == " Vertices":
                 state += 1
-        elif state == 3:
+        elif state == 1:
             num_vertices = int(line)
             xml_writer.write_header_vertices(ofile, num_vertices)
             state +=1
-        elif state == 4:
+        elif state == 2:
             if num_dims == 2:
                 (x, y, tmp) = line.split()
                 x = float(x)
@@ -185,16 +181,16 @@ def mesh2xml(ifilename, ofilename):
             if num_vertices == num_vertices_read:
                 xml_writer.write_footer_vertices(ofile)
                 state += 1
-        elif state == 5:
+        elif state == 3:
             if (line == "Triangles"  or line == " Triangles") and num_dims == 2:
                 state += 1
             if line == "Tetrahedra" and num_dims == 3:
                 state += 1
-        elif state == 6:
+        elif state == 4:
             num_cells = int(line)
             xml_writer.write_header_cells(ofile, num_cells)
             state +=1
-        elif state == 7:
+        elif state == 5:
             if num_dims == 2:
                 (n0, n1, n2, tmp) = line.split()
                 n0 = int(n0) - 1
@@ -212,11 +208,11 @@ def mesh2xml(ifilename, ofilename):
             if num_cells == num_cells_read:
                 xml_writer.write_footer_cells(ofile)
                 state += 1
-        elif state == 8:
+        elif state == 6:
             break
 
     # Check that we got all data
-    if state == 8:
+    if state == 6:
         print("Conversion done")
     else:
         _error("Missing data, unable to convert")
diff --git a/site-packages/dolfin_utils/meshconvert/xml_writer.py b/site-packages/dolfin_utils/meshconvert/xml_writer.py
index 2ed9579..865e400 100644
--- a/site-packages/dolfin_utils/meshconvert/xml_writer.py
+++ b/site-packages/dolfin_utils/meshconvert/xml_writer.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Module for formatting DOLFIN XML files."""
 
 # Copyright (C) 2012 Garth N. Wells
diff --git a/site-packages/dolfin_utils/ordereddict.py b/site-packages/dolfin_utils/ordereddict.py
index c77844c..6b63ad6 100644
--- a/site-packages/dolfin_utils/ordereddict.py
+++ b/site-packages/dolfin_utils/ordereddict.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (c) 2009 Raymond Hettinger
 #
 # Permission is hereby granted, free of charge, to any person
diff --git a/site-packages/dolfin_utils/pjobs/__init__.py b/site-packages/dolfin_utils/pjobs/__init__.py
index 6d8df1a..12cffdd 100644
--- a/site-packages/dolfin_utils/pjobs/__init__.py
+++ b/site-packages/dolfin_utils/pjobs/__init__.py
@@ -1 +1,2 @@
+# -*- coding: utf-8 -*-
 from pjobs import submit
diff --git a/site-packages/dolfin_utils/pjobs/pjobs.py b/site-packages/dolfin_utils/pjobs/pjobs.py
index 6493c1e..d810b20 100644
--- a/site-packages/dolfin_utils/pjobs/pjobs.py
+++ b/site-packages/dolfin_utils/pjobs/pjobs.py
@@ -1,6 +1,7 @@
+# -*- coding: utf-8 -*-
 #!/usr/bin/env python
 
-# Copyright (C) 2009 Martin Sandve Alnes
+# Copyright (C) 2009 Martin Sandve Alnæs
 #
 # This file is part of DOLFIN.
 #
diff --git a/site-packages/dolfin_utils/pjobs/sge.py b/site-packages/dolfin_utils/pjobs/sge.py
index 400cc43..0230660 100644
--- a/site-packages/dolfin_utils/pjobs/sge.py
+++ b/site-packages/dolfin_utils/pjobs/sge.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 #!/usr/bin/env python
 
 # Copyright (C) 2011 Johan Hake
diff --git a/site-packages/dolfin_utils/pjobs/slurm.py b/site-packages/dolfin_utils/pjobs/slurm.py
index 40cdf2b..f14142a 100644
--- a/site-packages/dolfin_utils/pjobs/slurm.py
+++ b/site-packages/dolfin_utils/pjobs/slurm.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 #!/usr/bin/env python
 
 # Copyright (C) 2013 Johannes Ring
diff --git a/site-packages/dolfin_utils/pjobs/torque.py b/site-packages/dolfin_utils/pjobs/torque.py
index b07b087..3480173 100644
--- a/site-packages/dolfin_utils/pjobs/torque.py
+++ b/site-packages/dolfin_utils/pjobs/torque.py
@@ -1,6 +1,7 @@
+# -*- coding: utf-8 -*-
 #!/usr/bin/env python
 
-# Copyright (C) 2009 Martin Sandve Alnes
+# Copyright (C) 2009 Martin Sandve Alnæs
 #
 # This file is part of DOLFIN.
 #
diff --git a/site-packages/dolfin_utils/test/__init__.py b/site-packages/dolfin_utils/test/__init__.py
index 646b3a0..34220a9 100644
--- a/site-packages/dolfin_utils/test/__init__.py
+++ b/site-packages/dolfin_utils/test/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 
 from .paths import *
 from .fixtures import *
diff --git a/site-packages/dolfin_utils/test/fixtures.py b/site-packages/dolfin_utils/test/fixtures.py
index a0fa82a..666be65 100644
--- a/site-packages/dolfin_utils/test/fixtures.py
+++ b/site-packages/dolfin_utils/test/fixtures.py
@@ -1,6 +1,7 @@
+# -*- coding: utf-8 -*-
 """Shared fixtures for unit tests involving dolfin."""
 
-# Copyright (C) 2014-2014 Martin Sandve Alnaes and Aslak Wigdahl Bergersen
+# Copyright (C) 2014-2014 Martin Sandve Alnæs and Aslak Wigdahl Bergersen
 #
 # This file is part of DOLFIN.
 #
@@ -189,20 +190,20 @@ def set_parameters_fixture(paramname, values, key=lambda x: x):
 
     Usage:
         repr = set_parameters_fixture("form_compiler.representation", ["quadrature", "uflacs"])
-        my_fixture1 = set_parameters_fixture("linear_algebra_backend", ["PETSc", "STL"])
-        my_fixture2 = set_parameters_fixture("linear_algebra_backend", [("Eigen", ""), ("STL", "")], key=lambda x: x[0])
+        my_fixture1 = set_parameters_fixture("linear_algebra_backend", ["PETSc"])
+        my_fixture2 = set_parameters_fixture("linear_algebra_backend", [("Eigen", "")], key=lambda x: x[0])
 
         def test_something0(repr):
             assert repr in ("quadrature", "uflacs")
             assert parameters["form_compiler"]["representation"] == repr
 
         def test_something1(my_fixture1):
-            assert my_fixture1 in ("PETSc", "STL")
-            assert parameters.linear_algebra_backend == my_fixture1
+            assert my_fixture1 in ("PETSc")
+            assert parameters["linear_algebra_backend"] == my_fixture1
 
         def test_something2(my_fixture2):
-            assert my_fixture2[0] in ("Eigen", "STL")
-            assert parameters.linear_algebra_backend == my_fixture2[0]
+            assert my_fixture2[0] in ("Eigen")
+            assert parameters["linear_algebra_backend"] == my_fixture2[0]
 
     Try it and see.
     """
diff --git a/site-packages/dolfin_utils/test/paths.py b/site-packages/dolfin_utils/test/paths.py
index 9087a18..a435c84 100644
--- a/site-packages/dolfin_utils/test/paths.py
+++ b/site-packages/dolfin_utils/test/paths.py
@@ -1,6 +1,7 @@
+# -*- coding: utf-8 -*-
 """Utilities for getting dolfin repository paths."""
 
-# Copyright (C) 2014-2014 Martin Sandve Alnaes
+# Copyright (C) 2014-2014 Martin Sandve Alnæs
 #
 # This file is part of DOLFIN.
 #
diff --git a/site-packages/dolfin_utils/test/skips.py b/site-packages/dolfin_utils/test/skips.py
index 6f623ff..ddd9483 100644
--- a/site-packages/dolfin_utils/test/skips.py
+++ b/site-packages/dolfin_utils/test/skips.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Shared skips for unit tests involving dolfin."""
 
 # Copyright (C) 2014-2014 Aslak Wigdahl Bergersen
@@ -31,8 +32,6 @@ skip_if_not_HDF5 = pytest.mark.skipif(not has_hdf5(),
                                     reason="Skipping unit test(s) depending on HDF5.")
 skip_if_not_PETSc = pytest.mark.skipif(not has_linear_algebra_backend("PETSc"),
                                        reason="Skipping unit test(s) depending on PETSc.")
-skip_if_not_TAO = pytest.mark.skipif(not has_tao(),
-                                       reason="Skipping unit test(s) depending on TAO.")
 skip_if_not_petsc4py = pytest.mark.skipif(not has_petsc4py(),
                                           reason="Skipping unit test(s) depending on petsc4py.")
 
diff --git a/site-packages/dolfin_utils/test/tests.py b/site-packages/dolfin_utils/test/tests.py
index faa8200..2f82d28 100644
--- a/site-packages/dolfin_utils/test/tests.py
+++ b/site-packages/dolfin_utils/test/tests.py
@@ -1,6 +1,7 @@
+# -*- coding: utf-8 -*-
 """Shared fixtures for unit tests involving dolfin."""
 
-# Copyright (C) 2014-2014 Martin Sandve Alnaes and Aslak Wigdahl Bergersen
+# Copyright (C) 2014-2014 Martin Sandve Alnæs and Aslak Wigdahl Bergersen
 #
 # This file is part of DOLFIN.
 #
diff --git a/site-packages/fenics/__init__.py b/site-packages/fenics/__init__.py
index 559b8cd..d312f90 100644
--- a/site-packages/fenics/__init__.py
+++ b/site-packages/fenics/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Main module for FEniCS.
 
 This module is identical with the main DOLFIN module.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
deleted file mode 100644
index ca1d275..0000000
--- a/test/CMakeLists.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-project(dolfin-tests)
-
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-# FIXME: Temporary fix for whitespace error
-cmake_policy(SET CMP0004 OLD)
-
-# Set special link option, see `cmake --help-policy CMP0003`
-if(COMMAND cmake_policy)
-  cmake_policy(SET CMP0003 NEW)
-endif()
-
-# Find DOLFIN config file (not used here, but checks that tests will be able
-# to find it
-find_package(DOLFIN REQUIRED)
-
-# If config file is found, add all demo sub-directories, else print helper
-# message
-if (DOLFIN_FOUND)
-
-  # Build list of all cpp directories
-  file(GLOB_RECURSE initial_list "*/*.cpp")
-
-  set(added_dirs "")
-
-  # Add each C++ demo directory only once
-  foreach (cpp_test ${initial_list})
-
-    # Get directory name
-    get_filename_component(cpp_dir ${cpp_test} PATH)
-
-    # Get last dir name
-    get_filename_component(last_component ${cpp_dir} NAME)
-
-    # Only process if last dirname is cpp
-    if ((${last_component} STREQUAL "cpp"))
-
-      # Check if the director is already added
-      set(already_in "")
-      foreach (dir ${added_dirs})
-	if (${dir} STREQUAL ${cpp_dir})
-	  set(already_in TRUE)
-	endif()
-      endforeach()
-
-      # Schedule directory for compilation
-      if (NOT already_in)
-	list(APPEND added_dirs ${cpp_dir})
-	add_subdirectory(${cpp_dir})
-      endif()
-    endif()
-  endforeach()
-else()
-
-  message(STATUS "Could not locate DOLFINConfig.cmake file. Did you do 'make install' for the DOLFIN library and set the appropriate paths (source <build_dir>/dolfin.conf)?")
-
-endif()
diff --git a/test/codingstyle/test_coding_style.py b/test/codingstyle/test_coding_style.py.in
similarity index 67%
rename from test/codingstyle/test_coding_style.py
rename to test/codingstyle/test_coding_style.py.in
index a136422..e00420a 100755
--- a/test/codingstyle/test_coding_style.py
+++ b/test/codingstyle/test_coding_style.py.in
@@ -22,14 +22,16 @@ import pytest
 
 def pytest_generate_tests(metafunc):
     # List of C++ tests
-    cpp_tests = [dolfin_error, uint]
+    cpp_tests = [dolfin_error, uint, includes]
 
     # List of Python tests
     python_tests = [dolfin_error, raise_exception]
 
-    # Set up paths
-    pwd = os.path.dirname(os.path.abspath(__file__))
-    topdir = os.path.join(pwd, "..", "..")
+    # Source dir (generated by CMake)
+    topdir = "@CMAKE_SOURCE_DIR@"
+    assert os.path.isfile(os.path.join(topdir, 'dolfin', 'dolfin.h'))
+    assert os.path.isfile(os.path.join(topdir, 'site-packages',
+                                       'dolfin', '__init__.py'))
 
     # Check C++ files
     cpp_call = {'topdir': topdir,
@@ -73,7 +75,7 @@ def dolfin_error(code, filename):
 
     # Skip exceptions
     exceptions = ["log.h", "log.cpp", "Logger.h", "Logger.cpp",
-                  "pugixml.cpp", "meshconvert.py"]
+                  "pugixml.cpp", "meshconvert.py", "abaqus.py"]
     if filename in exceptions:
         return True
 
@@ -89,7 +91,14 @@ def raise_exception(code, filename):
     "Test for use of dolfin_error vs raising exception"
 
     # Skip exceptions
-    exceptions = ["meshconvert.py"]
+    exceptions = ["meshconvert.py", "expressions.py", "form.py",
+                  "assembling.py", "multistagescheme.py",
+                  "rushlarsenschemes.py", "expression.py",
+                  "functionspace.py", "constant.py",
+                  "specialfunctions.py", "function.py",
+                  "ordereddict.py", "abaqus.py", "sge.py", "pjobs.py",
+                  "generatepythonrst.py", "CppHeaderParser.py",
+                  "subdomains.py", "plotting.py"]
     if filename in exceptions:
         return True
 
@@ -105,7 +114,8 @@ def uint(code, filename):
     "Test for use of uint"
 
     # Skip exceptions
-    exceptions = []
+    exceptions = ["XMLMeshValueCollection.h", "XMLMesh.cpp",
+                  "XMLMeshFunction.h", "XMLFile.h"]
     if filename in exceptions:
         return True
 
@@ -117,5 +127,24 @@ def uint(code, filename):
     assert False, "* Warning: uint is used in %s when std::size_t should be used" % filename
     return False
 
+def includes(code, filename):
+    "Test of not including dolfin_foo.h which bloat compilation units"
+
+    # Skip exceptions
+    exceptions = ['dolfin.h']
+    if filename in exceptions:
+        return True
+
+    # Check for raising of exception
+    # NOTE: Improve this pattern if it generates false positives
+    r = re.search(r"\bdolfin_[a-zA-Z]*\.h\b", code)
+    if r is None:
+        return True
+
+    # Write an error message
+    assert False, "* Warning: %s should not be included in %s" % (r.group(), filename)
+    return False
+
 if __name__ == "__main__":
-    pytest.main()
+    import sys
+    sys.exit(pytest.main())
diff --git a/test/documentation/verify_demo_code_snippets.py b/test/documentation/verify_demo_code_snippets.py
index cf7008c..68f9913 100755
--- a/test/documentation/verify_demo_code_snippets.py
+++ b/test/documentation/verify_demo_code_snippets.py
@@ -60,8 +60,13 @@ def get_blocks(rst_file, block_type):
     code = False
     block = []
     for e, l in enumerate(lines):
+        # Don't tolerate non-space whitespace
+        if l.lstrip() != l.lstrip(' '):
+            raise RuntimeError("There are tabs or other suspicious whitespace "
+                               " in '%s'!" % rst_file)
         # Get start of code block.
         if "code-block::" in l and block_type in l:
+            assert not code
             code = True
             block = []
             continue
diff --git a/test/regression/test.py b/test/regression/test.py
index 18ee666..96b8406 100644
--- a/test/regression/test.py
+++ b/test/regression/test.py
@@ -112,18 +112,20 @@ def main():
     #       fail. This is meant to protect against usual bad named demos not
     #       executed for ages in regression tests.
     not_implemented = \
-      [os.path.join(demodir, 'undocumented', 'projection-interpolation',    'cpp'), \
-       os.path.join(demodir, 'undocumented', 'interpolation',               'cpp'), \
-       os.path.join(demodir, 'undocumented', 'adaptive-poisson',            'cpp'), \
-       os.path.join(demodir, 'undocumented', 'multistage-solver',           'cpp'), \
-       os.path.join(demodir, 'undocumented', 'smoothing',                   'cpp'), \
-       os.path.join(demodir, 'undocumented', 'overlapping-regions',         'cpp'), \
-       os.path.join(demodir, 'undocumented', 'sub-function-assignment',     'cpp'), \
-       os.path.join(demodir, 'undocumented', 'compiled-extension-module',   'cpp'), \
-       os.path.join(demodir, 'undocumented', 'timing',                      'cpp'), \
-       os.path.join(demodir, 'documented',   'stokes-mini',                 'cpp'), \
-       os.path.join(demodir, 'documented',   'tensor-weighted-poisson',     'cpp'), \
-       os.path.join(demodir, 'documented',   'subdomains-poisson',          'cpp'), \
+      [os.path.join(demodir, 'undocumented', 'projection-interpolation',    'cpp'),
+       os.path.join(demodir, 'undocumented', 'interpolation',               'cpp'),
+       os.path.join(demodir, 'undocumented', 'adaptive-poisson',            'cpp'),
+       os.path.join(demodir, 'undocumented', 'multistage-solver',           'cpp'),
+       os.path.join(demodir, 'undocumented', 'smoothing',                   'cpp'),
+       os.path.join(demodir, 'undocumented', 'overlapping-regions',         'cpp'),
+       os.path.join(demodir, 'undocumented', 'sub-function-assignment',     'cpp'),
+       os.path.join(demodir, 'undocumented', 'compiled-extension-module',   'cpp'),
+       os.path.join(demodir, 'undocumented', 'timing',                      'cpp'),
+       os.path.join(demodir, 'undocumented', 'mplot',                       'cpp'),
+       os.path.join(demodir, 'undocumented', 'coordinates',                 'cpp'),
+       os.path.join(demodir, 'documented',   'stokes-mini',                 'cpp'),
+       os.path.join(demodir, 'documented',   'tensor-weighted-poisson',     'cpp'),
+       os.path.join(demodir, 'documented',   'subdomains-poisson',          'cpp'),
        ]
 
     # Demos to run
@@ -172,32 +174,35 @@ def main():
 
     # List of demos that throw expected errors in parallel
     not_working_in_parallel = \
-      [os.path.join(demodir, 'undocumented', 'adaptive-poisson',            'python'), \
-       os.path.join(demodir, 'undocumented', 'auto-adaptive-navier-stokes', 'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'auto-adaptive-navier-stokes', 'python'), \
-       os.path.join(demodir, 'documented',   'auto-adaptive-poisson',       'cpp'),    \
-       os.path.join(demodir, 'documented',   'auto-adaptive-poisson',       'python'), \
-       os.path.join(demodir, 'undocumented', 'eval',                        'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'eval',                        'python'), \
-       os.path.join(demodir, 'undocumented', 'extrapolation',               'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'extrapolation',               'python'), \
-       os.path.join(demodir, 'undocumented', 'meshfunction-refinement',     'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'nonmatching-interpolation',   'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'nonmatching-interpolation',   'python'), \
-       os.path.join(demodir, 'undocumented', 'nonmatching-projection',      'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'nonmatching-projection',      'python'), \
-       os.path.join(demodir, 'undocumented', 'smoothing',                   'python'), \
-       os.path.join(demodir, 'documented',   'subdomains',                  'cpp'),    \
-       os.path.join(demodir, 'documented',   'subdomains',                  'python'), \
-       os.path.join(demodir, 'undocumented', 'submesh',                     'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'submesh',                     'python'), \
-       os.path.join(demodir, 'undocumented', 'time-series',                 'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'time-series',                 'python'), \
-       os.path.join(demodir, 'undocumented', 'triangulate',                 'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'triangulate',                 'python'), \
-       os.path.join(demodir, 'undocumented', 'poisson1D-in-2D',             'cpp'),    \
-       os.path.join(demodir, 'undocumented', 'poisson1D-in-2D',             'python'), \
-       os.path.join(demodir, 'undocumented', 'compiled-extension-module',   'python'), \
+      [os.path.join(demodir, 'undocumented', 'adaptive-poisson',            'python'),
+       os.path.join(demodir, 'undocumented', 'auto-adaptive-navier-stokes', 'cpp'),
+       os.path.join(demodir, 'undocumented', 'auto-adaptive-navier-stokes', 'python'),
+       os.path.join(demodir, 'documented',   'auto-adaptive-poisson',       'cpp'),
+       os.path.join(demodir, 'documented',   'auto-adaptive-poisson',       'python'),
+       os.path.join(demodir, 'undocumented', 'eval',                        'cpp'),
+       os.path.join(demodir, 'undocumented', 'eval',                        'python'),
+       os.path.join(demodir, 'undocumented', 'extrapolation',               'cpp'),
+       os.path.join(demodir, 'undocumented', 'extrapolation',               'python'),
+       os.path.join(demodir, 'undocumented', 'meshfunction-refinement',     'cpp'),
+       os.path.join(demodir, 'undocumented', 'nonmatching-interpolation',   'cpp'),
+       os.path.join(demodir, 'undocumented', 'nonmatching-interpolation',   'python'),
+       os.path.join(demodir, 'undocumented', 'nonmatching-projection',      'cpp'),
+       os.path.join(demodir, 'undocumented', 'nonmatching-projection',      'python'),
+       os.path.join(demodir, 'undocumented', 'poisson-disc',                'python'),
+       os.path.join(demodir, 'undocumented', 'poisson-disc',                'cpp'),
+       os.path.join(demodir, 'undocumented', 'smoothing',                   'python'),
+       os.path.join(demodir, 'documented',   'subdomains',                  'cpp'),
+       os.path.join(demodir, 'documented',   'subdomains',                  'python'),
+       os.path.join(demodir, 'undocumented', 'submesh',                     'cpp'),
+       os.path.join(demodir, 'undocumented', 'submesh',                     'python'),
+       os.path.join(demodir, 'undocumented', 'time-series',                 'cpp'),
+       os.path.join(demodir, 'undocumented', 'time-series',                 'python'),
+       os.path.join(demodir, 'undocumented', 'triangulate',                 'cpp'),
+       os.path.join(demodir, 'undocumented', 'triangulate',                 'python'),
+       os.path.join(demodir, 'undocumented', 'poisson1D-in-2D',             'cpp'),
+       os.path.join(demodir, 'undocumented', 'poisson1D-in-2D',             'python'),
+       os.path.join(demodir, 'undocumented', 'compiled-extension-module',   'python'),
+       os.path.join(demodir, 'undocumented', 'coordinates',                 'python'),
        ]
 
     failed = []
@@ -256,7 +261,7 @@ def main():
     # Print output for failed tests
     print("")
     if len(failed) > 0:
-        print("%d demo(s) out of %d failed, see demo.log for details." % \
+        print("%d demo(s) out of %d failed, see demo.log for details." %
               (len(failed), total_no_demos))
         file = open("demo.log", "w")
         for (test, interface, prefix, output) in failed:
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
new file mode 100644
index 0000000..87ddf04
--- /dev/null
+++ b/test/unit/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 2.8.2)
+
+project(googletest-download NONE)
+
+# Using ExternalProject to Build GTest and use the Library
+include(ExternalProject)
+
+# Set the build type if it isn't already
+if(NOT CMAKE_BUILD_TYPE)
+  set(CMAKE_BUILD_TYPE Release)
+endif()
+
+# Set default ExternalProject root directory
+set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/GoogleTest)
+
+# Add gtest
+ExternalProject_Add(
+    googletest
+    URL https://github.com/google/googletest/archive/release-1.7.0.tar.gz
+    TIMEOUT 60
+    # PATCH_COMMAND svn patch ${CMAKE_SOURCE_DIR}/gtest.patch ${CMAKE_BINARY_DIR}/ThirdParty/src/googletest
+    # Force separate output paths for debug and release builds to allow easy
+    # identification of correct lib in subsequent TARGET_LINK_LIBRARIES commands
+    CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+               -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG:PATH=DebugLibs
+               -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE:PATH=ReleaseLibs
+               -Dgtest_force_shared_crt=ON
+    # Disable install step
+    INSTALL_COMMAND ""
+    # Wrap download, configure and build steps in a script to log output
+    LOG_DOWNLOAD ON
+    LOG_CONFIGURE ON
+    LOG_BUILD ON)
+
+# Specify include dir
+ExternalProject_Get_Property(googletest source_dir)
+include_directories(${source_dir}/include)
diff --git a/test/unit/common/cpp/CMakeLists.txt b/test/unit/common/cpp/CMakeLists.txt
deleted file mode 100644
index 2ff666d..0000000
--- a/test/unit/common/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# This file is automatically generated by running
-#
-#     cmake/scripts/generate-cmakefiles
-#
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-set(PROJECT_NAME test_common)
-project(${PROJECT_NAME})
-
-# Set verbose output while testing CMake
-#set(CMAKE_VERBOSE_MAKEFILE 1)
-
-# Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
-
-# Get DOLFIN configuration data (DOLFINConfig.cmake must be in
-# DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
-endif()
-
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
-# Executable
-add_executable(test_SubSystemsManager SubSystemsManager.cpp)
-
-# Target libraries
-target_link_libraries(test_SubSystemsManager ${DOLFIN_LIBRARIES})
diff --git a/test/unit/common/cpp/test_cpp_common.py b/test/unit/common/cpp/test_cpp_common.py
deleted file mode 100755
index fb3bde4..0000000
--- a/test/unit/common/cpp/test_cpp_common.py
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env py.test
-from dolfin_utils.test import cpp_tester
-test_cpp_common = cpp_tester
diff --git a/test/unit/cpp/CMakeLists.txt b/test/unit/cpp/CMakeLists.txt
new file mode 100644
index 0000000..4e4c6ab
--- /dev/null
+++ b/test/unit/cpp/CMakeLists.txt
@@ -0,0 +1,90 @@
+project(dolfin-tests)
+
+# Require CMake 2.8
+cmake_minimum_required(VERSION 2.8)
+
+# FIXME: Temporary fix for whitespace error
+cmake_policy(SET CMP0004 OLD)
+
+# Set special link option, see `cmake --help-policy CMP0003`
+if(COMMAND cmake_policy)
+  cmake_policy(SET CMP0003 NEW)
+endif()
+
+# Find DOLFIN config file (not used here, but checks that tests will be able
+# to find it
+find_package(DOLFIN REQUIRED)
+
+# Add GoogleTest Directory
+include_directories(${CMAKE_BINARY_DIR}/GoogleTest/src/googletest/include)
+link_directories(${CMAKE_BINARY_DIR}/GoogleTest/src/googletest-build)
+
+# If config file is found, add all demo sub-directories, else print helper
+# message
+if (DOLFIN_FOUND)
+
+  # Build list of all cpp directories
+  file(GLOB_RECURSE initial_list "*.cpp")
+
+  set(added_files "") # Change to targetting cpp files instead
+
+  # Add each C++ demo directory only once
+  foreach (cpp_test ${initial_list})
+
+    # Get directory
+    get_filename_component(cpp_lib_dir ${cpp_test} DIRECTORY)
+
+    # Get one upper directory
+    get_filename_component(cpp_dir ${cpp_lib_dir} DIRECTORY)
+
+    # Get last dir name
+    get_filename_component(last_component ${cpp_dir} NAME)
+
+    # Only process if last dirname is cpp
+    if ((${last_component} STREQUAL "cpp"))
+      # If you find the cpp lib dir
+      # That means you have allocated the cpp files
+      # Don't need to recheck the directories
+      list(APPEND added_files ${cpp_test})
+
+    endif()
+  endforeach()
+
+  # Set CMake behavior
+  cmake_policy(SET CMP0004 NEW)
+
+  if (EXISTS ${DOLFIN_USE_FILE})
+    include(${DOLFIN_USE_FILE})
+
+    # Default build type (can be overridden by user)
+    if (NOT CMAKE_BUILD_TYPE)
+      set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+        "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
+    endif()
+  else()
+    # Compiler definitions
+    add_definitions(${DOLFIN_CXX_DEFINITIONS})
+
+    # Compiler flags
+    set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+
+    # Include directories
+    include_directories(${DOLFIN_INCLUDE_DIRS})
+    include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
+  endif()
+
+  # Google Test uses threads
+  set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+  find_package(Threads REQUIRED)
+  if (CMAKE_USE_PTHREADS_INIT)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
+  endif()
+
+  add_executable(unittests_cpp ${added_files})
+  target_link_libraries(unittests_cpp ${DOLFIN_LIBRARIES} gtest gtest_main ${CMAKE_THREAD_LIBS_INIT})
+
+else()
+
+  message(STATUS "Could not locate DOLFINConfig.cmake file. Did you do 'make install' for the DOLFIN library and set the appropriate paths (source <build_dir>/dolfin.conf)?")
+
+endif()
diff --git a/test/unit/common/cpp/SubSystemsManager.cpp b/test/unit/cpp/common/SubSystemsManager.cpp
similarity index 63%
rename from test/unit/common/cpp/SubSystemsManager.cpp
rename to test/unit/cpp/common/SubSystemsManager.cpp
index 900e508..660dad5 100644
--- a/test/unit/common/cpp/SubSystemsManager.cpp
+++ b/test/unit/cpp/common/SubSystemsManager.cpp
@@ -21,36 +21,26 @@
 // Unit tests for SubSystemsManager
 
 #include <dolfin.h>
-#include <dolfin/common/unittest.h>
+#include <gtest/gtest.h>
 
 using namespace dolfin;
 
-class TestSubSystemsManager : public CppUnit::TestFixture
+// Test rewritten using Google Test
+TEST(TestSubSystemsManager, test_petsc_user_init)
 {
-  CPPUNIT_TEST_SUITE(TestSubSystemsManager);
-  CPPUNIT_TEST(test_petsc_user_init);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
   // Test user initialisation of PETSc
-  void test_petsc_user_init()
-  {
-    #ifdef HAS_PETSC
-    int argc = 0;
-    char **argv = NULL;
-    PetscInitialize(&argc, &argv, NULL, NULL);
-
-    UnitSquareMesh(12, 12);
-    PETScVector(MPI_COMM_WORLD, 30);
-    #endif
-  }
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(TestSubSystemsManager);
+#ifdef HAS_PETSC
+  int argc = 0;
+  char **argv = NULL;
+  PetscInitialize(&argc, &argv, NULL, NULL);
+
+  UnitSquareMesh(12, 12);
+  PETScVector(MPI_COMM_WORLD, 30);
+#endif
+}
 
-int main()
-{
-  DOLFIN_TEST;
+// Test all
+int SubSystemsManager_main(int argc, char **argv) {
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
 }
diff --git a/test/unit/cpp/function/Expression.cpp b/test/unit/cpp/function/Expression.cpp
new file mode 100644
index 0000000..468b216
--- /dev/null
+++ b/test/unit/cpp/function/Expression.cpp
@@ -0,0 +1,92 @@
+// Copyright (C) 2007 Anders Logg
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// Modified by Garth N. Wells, 2008.
+// Modified by Johannes Ring, 2009.
+// Modified by Benjamin Kehlet 2012
+//
+// First added:  2007-05-24
+// Last changed: 2014-08-12
+//
+// Unit tests for the function library
+
+#include <dolfin.h>
+#include "Projection.h"
+#include <gtest/gtest.h>
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+TEST(Eval, testArbitraryEval)
+{
+  class F0 : public Expression
+  {
+  public:
+    F0() {}
+    void eval(Array<double>& values, const Array<double>& x) const
+    { values[0] = sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]); }
+  };
+
+  class F1 : public Expression
+  {
+  public:
+    F1() {}
+    void eval(Array<double>& values, const Array<double>& x) const
+    { values[0] = 1.0 + 3.0*x[0] + 4.0*x[1] + 0.5*x[2]; }
+  };
+
+  auto mesh = std::make_shared<UnitCubeMesh>(8, 8, 8);
+
+  Array<double> x(3);
+  x[0] = 0.31; x[1] = 0.32; x[2] = 0.33;
+
+  Array<double> u0(1);
+  Array<double> u1(1);
+
+  // User-defined functions (one from finite element space, one not)
+  F0 f0;
+  auto f1 = std::make_shared<F1>();
+
+  // Test evaluation of a user-defined function
+  f0.eval(u0, x);
+  ASSERT_NEAR(u0[0],
+              sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]),
+              DOLFIN_EPS);
+
+  // Test for single core only
+  if (dolfin::MPI::size(mesh->mpi_comm()) == 1)
+  {
+    // Test evaluation of a discrete function
+    auto V = std::make_shared<Projection::FunctionSpace>(mesh);
+    Projection::BilinearForm a(V, V);
+    Projection::LinearForm L(V);
+    L.f = f1;
+    Function g(V);
+    solve(a == L, g);
+
+    const double tol = 1.0e-6;
+    f1->eval(u0, x);
+    g.eval(u1, x);
+    ASSERT_NEAR(u0[0], u1[0], tol);
+  }
+}
+
+// Test all
+int Expression_main(int argc, char **argv) {
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/demo/undocumented/curl-curl/cpp/CurrentDensity.h b/test/unit/cpp/function/Projection.h
similarity index 52%
copy from demo/undocumented/curl-curl/cpp/CurrentDensity.h
copy to test/unit/cpp/function/Projection.h
index d05f18a..717e662 100644
--- a/demo/undocumented/curl-curl/cpp/CurrentDensity.h
+++ b/test/unit/cpp/function/Projection.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,102 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
-#ifndef __CURRENTDENSITY_H
-#define __CURRENTDENSITY_H
-
-#include <cmath>
+#ifndef __PROJECTION_H
+#define __PROJECTION_H
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
-class currentdensity_finite_element_0: public ufc::finite_element
+class projection_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  currentdensity_finite_element_0() : ufc::finite_element()
+  projection_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_finite_element_0()
+  ~projection_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::tetrahedron;
+    return ufc::shape::tetrahedron;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
-    return 6;
+    return 4;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 0;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_dimension(std::size_t i) const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -117,9 +121,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -139,9 +143,7 @@ public:
     
     
     // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
+    *values = 0.0;
     switch (i)
     {
     case 0:
@@ -165,29 +167,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.0, 0.0, 0.0, 0.0};
-      
-      static const double coefficients1[4] = \
-      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
     case 1:
@@ -211,29 +197,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
-      
-      static const double coefficients1[4] = \
-      {0.0, 0.0, 0.0, 0.0};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.182574185835056, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
     case 2:
@@ -257,29 +227,13 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {-0.288675134594813, 0.0, -0.210818510677892, 0.074535599249993};
-      
-      static const double coefficients1[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      static const double coefficients2[4] = \
-      {0.0, 0.0, 0.0, 0.0};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
     case 3:
@@ -303,172 +257,57 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594812, 0.0, 0.0, 0.223606797749979};
-      
-      static const double coefficients1[4] = \
       {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      static const double coefficients2[4] = \
-      {0.577350269189625, -0.182574185835056, -0.105409255338946, 0.149071198499986};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
-      } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
-      
-      static const double coefficients1[4] = \
-      {0.577350269189626, -0.182574185835055, 0.105409255338946, -0.149071198499986};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
-      } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.577350269189626, 0.0, -0.210818510677892, -0.149071198499986};
-      
-      static const double coefficients1[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
-      
       // Compute value(s)
       for (unsigned int r = 0; r < 4; r++)
       {
-        values[0] += coefficients0[r]*basisvalues[r];
-        values[1] += coefficients1[r]*basisvalues[r];
-        values[2] += coefficients2[r]*basisvalues[r];
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
-      
-      // Using covariant Piola transform to map values back to the physical element
-      const double tmp_ref0 = values[0];
-      const double tmp_ref1 = values[1];
-      const double tmp_ref2 = values[2];
-      values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-      values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-      values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
         break;
       }
     }
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
+    double dof_values = 0.0;
     
     // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
+    for (unsigned int r = 0; r < 4; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -480,7 +319,7 @@ public:
     } // end loop over 'r'
     
     // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    for (unsigned int r = 0; r < num_derivatives; r++)
     {
       values[r] = 0.0;
     } // end loop over 'r'
@@ -488,7 +327,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -500,7 +339,7 @@ public:
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -509,9 +348,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -600,13 +439,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.0, 0.0, 0.0, 0.0};
-      
-      static const double coefficients1[4] = \
-      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -629,19 +462,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -735,18 +561,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -754,9 +570,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -782,13 +596,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {-0.288675134594813, 0.0, 0.0, -0.223606797749979};
-      
-      static const double coefficients1[4] = \
-      {0.0, 0.0, 0.0, 0.0};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.182574185835056, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -811,19 +619,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -917,18 +718,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -936,9 +727,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -964,13 +753,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {-0.288675134594813, 0.0, -0.210818510677892, 0.074535599249993};
-      
-      static const double coefficients1[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      static const double coefficients2[4] = \
-      {0.0, 0.0, 0.0, 0.0};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -993,19 +776,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -1099,18 +875,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1118,9 +884,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -1146,14 +910,8 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594812, 0.0, 0.0, 0.223606797749979};
-      
-      static const double coefficients1[4] = \
       {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      static const double coefficients2[4] = \
-      {0.577350269189625, -0.182574185835056, -0.105409255338946, 0.149071198499986};
-      
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
       {{0.0, 0.0, 0.0, 0.0},
@@ -1175,19 +933,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -1281,18 +1032,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1300,56 +1041,1386 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 4:
+    }
+    
+  }
+
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives_all(std::size_t n,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
+                                              int cell_orientation)
+  {
+    // Call evaluate_basis_all if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Set values equal to zero.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.0745355992499929};
-      
-      static const double coefficients1[4] = \
-      {0.577350269189626, -0.182574185835055, 0.105409255338946, -0.149071198499986};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
+        values[r*num_derivatives + s] = 0.0;
+      } // end loop over 's'
+    } // end loop over 'r'
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+      return ;
+    }
+    
+    // Helper variable to hold values of a single dof.
+    double dof_values[3];
+    for (unsigned int r = 0; r < 3; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 4; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
+      {
+        values[r*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
+  {
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    switch (i)
+    {
+    case 0:
+      {
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 1:
+      {
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 2:
+      {
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    case 3:
+      {
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[1];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new projection_finite_element_0();
+  }
+
+};
+
+
+class projection_finite_element_1: public ufc::finite_element
+{
+public:
+
+  projection_finite_element_1() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~projection_finite_element_1() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 12;
+  }
+
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t reference_value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 3;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 3;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
+  {
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Reset values
+    values[0] = 0.0;
+    values[1] = 0.0;
+    values[2] = 0.0;
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[0] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[1] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 9:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 10:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 11:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 4; r++)
+      {
+        values[2] += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values[3] = {0.0, 0.0, 0.0};
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3; s++)
+      {
+        values[r*3 + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < 3*num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 1)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[3][1];
+    for (unsigned int row = 0; row < 3; row++)
+    {
+      for (unsigned int col = 0; col < 1; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[3][3];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
+      }
+    case 3:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
       {{0.0, 0.0, 0.0, 0.0},
       {3.16227766016838, 0.0, 0.0, 0.0},
       {1.82574185835055, 0.0, 0.0, 0.0},
@@ -1357,19 +2428,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -1463,18 +2527,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1482,14 +2536,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 4:
       {
         
       // Array of basisvalues
@@ -1510,13 +2562,7 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.577350269189626, 0.0, -0.210818510677892, -0.149071198499986};
-      
-      static const double coefficients1[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
-      
-      static const double coefficients2[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.0745355992499929};
+      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
       
       // Tables of derivatives of the polynomial base (transpose).
       static const double dmats0[4][4] = \
@@ -1539,19 +2585,12 @@ public:
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare array of reference derivatives on physical element.
-      double derivatives_p[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives_p[r] = 0.0;
-      } // end loop over 'r'
-      
       // Declare derivative matrix (of polynomial basis).
       double dmats[4][4] = \
       {{1.0, 0.0, 0.0, 0.0},
@@ -1645,18 +2684,8 @@ public:
           for (unsigned int t = 0; t < 4; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-            derivatives[num_derivatives + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
-            derivatives[2*num_derivatives + r] += coefficients2[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
         } // end loop over 's'
-        
-        // Using covariant Piola transform to map values back to the physical element
-        const double tmp_ref0 = derivatives[r];
-        const double tmp_ref1 = derivatives[num_derivatives + r];
-        const double tmp_ref2 = derivatives[2*num_derivatives + r];
-        derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1 + K[6]*tmp_ref2);
-        derivatives_p[num_derivatives + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1 + K[7]*tmp_ref2);
-        derivatives_p[2*num_derivatives + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1 + K[8]*tmp_ref2);
       } // end loop over 'r'
       
       // Transform derivatives back to physical element
@@ -1664,403 +2693,169 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives_p[s];
-          values[num_derivatives + r] += transform[r][s]*derivatives_p[num_derivatives + s];
-          values[2*num_derivatives + r] += transform[r][s]*derivatives_p[2*num_derivatives + s];
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[9];
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    
-    double result;
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-      return result;
-        break;
-      }
-    case 1:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-      return result;
-        break;
-      }
-    case 2:
+    case 5:
       {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
-      return result;
-        break;
-      }
-    case 3:
+        
+      // Array of basisvalues
+      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[1] *= std::sqrt(7.5);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[4] = \
+      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-      return result;
-        break;
-      }
-    case 4:
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
-      return result;
-        break;
-      }
-    case 5:
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]);
-      return result;
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
         break;
       }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    
-    double result;
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    result = (-1.0)*(J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-    values[0] = result;
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-    values[1] = result;
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    result = (-1.0)*(J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]) + (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
-    values[2] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    result = (J[2]*vals[0] + J[5]*vals[1] + J[8]*vals[2]);
-    values[3] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    result = (J[1]*vals[0] + J[4]*vals[1] + J[7]*vals[2]);
-    values[4] = result;
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    result = (J[0]*vals[0] + J[3]*vals[1] + J[6]*vals[2]);
-    values[5] = result;
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[3]*K[6] + dof_values[4]*K[3] + dof_values[5]*K[0];
-    vertex_values[3] = dof_values[1]*K[6] + dof_values[2]*K[3] + dof_values[5]*(K[0] + K[3] + K[6]);
-    vertex_values[6] = dof_values[0]*K[6] + dof_values[2]*(K[0]*(-1.0)) + dof_values[4]*(K[0] + K[3] + K[6]);
-    vertex_values[9] = dof_values[0]*(K[3]*(-1.0)) + dof_values[1]*(K[0]*(-1.0)) + dof_values[3]*(K[0] + K[3] + K[6]);
-    vertex_values[1] = dof_values[3]*K[7] + dof_values[4]*K[4] + dof_values[5]*K[1];
-    vertex_values[4] = dof_values[1]*K[7] + dof_values[2]*K[4] + dof_values[5]*(K[1] + K[4] + K[7]);
-    vertex_values[7] = dof_values[0]*K[7] + dof_values[2]*(K[1]*(-1.0)) + dof_values[4]*(K[1] + K[4] + K[7]);
-    vertex_values[10] = dof_values[0]*(K[4]*(-1.0)) + dof_values[1]*(K[1]*(-1.0)) + dof_values[3]*(K[1] + K[4] + K[7]);
-    vertex_values[2] = dof_values[3]*K[8] + dof_values[4]*K[5] + dof_values[5]*K[2];
-    vertex_values[5] = dof_values[1]*K[8] + dof_values[2]*K[5] + dof_values[5]*(K[2] + K[5] + K[8]);
-    vertex_values[8] = dof_values[0]*K[8] + dof_values[2]*(K[2]*(-1.0)) + dof_values[4]*(K[2] + K[5] + K[8]);
-    vertex_values[11] = dof_values[0]*(K[5]*(-1.0)) + dof_values[1]*(K[2]*(-1.0)) + dof_values[3]*(K[2] + K[5] + K[8]);
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new currentdensity_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class currentdensity_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  currentdensity_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~currentdensity_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 4;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
+    case 6:
       {
         
       // Array of basisvalues
@@ -2081,16 +2876,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
+      
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
+      {
+        derivatives[r] = 0.0;
+      } // end loop over 'r'
+      
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
+      
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
+      {
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
+        {
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 7:
       {
         
       // Array of basisvalues
@@ -2111,232 +3033,143 @@ public:
       
       // Table(s) of coefficients
       static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
       
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      static const double dmats1[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      static const double dmats2[4][4] = \
+      {{0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+      // Compute reference derivatives.
+      // Declare array of derivatives on FIAT element.
+      double derivatives[3];
+      for (unsigned int r = 0; r < 3; r++)
       {
-        *values += coefficients0[r]*basisvalues[r];
+        derivatives[r] = 0.0;
       } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
       
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[4][4] = \
+      {{1.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0}};
       
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[3][1];
-    for (unsigned int row = 0; row < 3; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 0;
-    }
-    
-    // Generate combinations of derivatives
-    for (unsigned int row = 1; row < num_derivatives; row++)
-    {
-      for (unsigned int num = 0; num < row; num++)
+      // Loop possible derivatives.
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int col = n-1; col+1 > 0; col--)
+        // Resetting dmats values to compute next derivative.
+        for (unsigned int t = 0; t < 4; t++)
         {
-          if (combinations[row][col] + 1 > 2)
-            combinations[row][col] = 0;
-          else
+          for (unsigned int u = 0; u < 4; u++)
+          {
+            dmats[t][u] = 0.0;
+            if (t == u)
+            {
+            dmats[t][u] = 1.0;
+            }
+            
+          } // end loop over 'u'
+        } // end loop over 't'
+        
+        // Looping derivative order to generate dmats.
+        for (unsigned int s = 0; s < n; s++)
+        {
+          // Updating dmats_old with new values and resetting dmats.
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              dmats_old[t][u] = dmats[t][u];
+              dmats[t][u] = 0.0;
+            } // end loop over 'u'
+          } // end loop over 't'
+          
+          // Update dmats using an inner product.
+          if (combinations[r][s] == 0)
           {
-            combinations[row][col] += 1;
-            break;
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
           }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[3][3];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
+          
+          if (combinations[r][s] == 1)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+          if (combinations[r][s] == 2)
+          {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            for (unsigned int u = 0; u < 4; u++)
+            {
+              for (unsigned int tu = 0; tu < 4; tu++)
+              {
+                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
+              } // end loop over 'tu'
+            } // end loop over 'u'
+          } // end loop over 't'
+          }
+          
+        } // end loop over 's'
+        for (unsigned int s = 0; s < 4; s++)
+        {
+          for (unsigned int t = 0; t < 4; t++)
+          {
+            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
+          } // end loop over 't'
+        } // end loop over 's'
+      } // end loop over 'r'
+      
+      // Transform derivatives back to physical element
+      for (unsigned int r = 0; r < num_derivatives; r++)
       {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+        for (unsigned int s = 0; s < num_derivatives; s++)
+        {
+          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+        } // end loop over 's'
+      } // end loop over 'r'
+        break;
       }
-    }
-    switch (i)
-    {
-    case 0:
+    case 8:
       {
         
       // Array of basisvalues
@@ -2488,12 +3321,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 9:
       {
         
       // Array of basisvalues
@@ -2645,12 +3478,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 10:
       {
         
       // Array of basisvalues
@@ -2802,12 +3635,12 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 11:
       {
         
       // Array of basisvalues
@@ -2959,7 +3792,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[r] += transform[r][s]*derivatives[s];
+          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -2968,28 +3801,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -3001,742 +3832,435 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 4; r++)
+    for (unsigned int r = 0; r < 12; r++)
     {
-      for (unsigned int s = 0; s < num_derivatives; s++)
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
       {
-        values[r*num_derivatives + s] = 0.0;
+        values[r*3*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
     if (n > 1)
     {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[3];
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new currentdensity_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class currentdensity_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  currentdensity_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~currentdensity_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 12;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
+      return ;
     }
     
-    return 0;
+    // Helper variable to hold values of a single dof.
+    double dof_values[9];
+    for (unsigned int r = 0; r < 9; r++)
+    {
+      dof_values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Loop dofs and call evaluate_basis_derivatives.
+    for (unsigned int r = 0; r < 12; r++)
+    {
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      {
+        values[r*3*num_derivatives + s] = dof_values[s];
+      } // end loop over 's'
+    } // end loop over 'r'
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
     
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
+    // Declare variable for physical coordinates
+    double y[3];
     switch (i)
     {
     case 0:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 1:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 2:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 3:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[0];
         break;
       }
     case 4:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[1];
         break;
       }
     case 5:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[1];
+        break;
+      }
+    case 6:
       {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[1];
         break;
       }
     case 7:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[1];
         break;
       }
     case 8:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
+      f.evaluate(vals, y, c);
+      return vals[2];
         break;
       }
     case 9:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
+      f.evaluate(vals, y, c);
+      return vals[2];
         break;
       }
     case 10:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
+      f.evaluate(vals, y, c);
+      return vals[2];
         break;
       }
     case 11:
       {
-        
-      // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[1] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 4; r++)
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
+      f.evaluate(vals, y, c);
+      return vals[2];
+        break;
+      }
+    }
+    
+    return 0.0;
+  }
+
+  void evaluate_dofs(double * values,
+                             const ufc::function& f,
+                             const double * coordinate_dofs,
+                             int cell_orientation,
+                             const ufc::cell& c) const final override
+  {
+    // Declare variables for result of evaluation
+    double vals[3];
+    
+    // Declare variable for physical coordinates
+    double y[3];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[0] = vals[0];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[1] = vals[0];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[2] = vals[0];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[3] = vals[0];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[4] = vals[1];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[5] = vals[1];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[6] = vals[1];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[7] = vals[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
+    f.evaluate(vals, y, c);
+    values[8] = vals[2];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
+    f.evaluate(vals, y, c);
+    values[9] = vals[2];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
+    f.evaluate(vals, y, c);
+    values[10] = vals[2];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
+    f.evaluate(vals, y, c);
+    values[11] = vals[2];
+  }
+
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
+  {
+    // Evaluate function and change variables
+    vertex_values[0] = dof_values[0];
+    vertex_values[3] = dof_values[1];
+    vertex_values[6] = dof_values[2];
+    vertex_values[9] = dof_values[3];
+    // Evaluate function and change variables
+    vertex_values[1] = dof_values[4];
+    vertex_values[4] = dof_values[5];
+    vertex_values[7] = dof_values[6];
+    vertex_values[10] = dof_values[7];
+    // Evaluate function and change variables
+    vertex_values[2] = dof_values[8];
+    vertex_values[5] = dof_values[9];
+    vertex_values[8] = dof_values[10];
+    vertex_values[11] = dof_values[11];
+  }
+
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = coordinate_dofs[0];
+    dof_coordinates[13] = coordinate_dofs[1];
+    dof_coordinates[14] = coordinate_dofs[2];
+    dof_coordinates[15] = coordinate_dofs[3];
+    dof_coordinates[16] = coordinate_dofs[4];
+    dof_coordinates[17] = coordinate_dofs[5];
+    dof_coordinates[18] = coordinate_dofs[6];
+    dof_coordinates[19] = coordinate_dofs[7];
+    dof_coordinates[20] = coordinate_dofs[8];
+    dof_coordinates[21] = coordinate_dofs[9];
+    dof_coordinates[22] = coordinate_dofs[10];
+    dof_coordinates[23] = coordinate_dofs[11];
+    dof_coordinates[24] = coordinate_dofs[0];
+    dof_coordinates[25] = coordinate_dofs[1];
+    dof_coordinates[26] = coordinate_dofs[2];
+    dof_coordinates[27] = coordinate_dofs[3];
+    dof_coordinates[28] = coordinate_dofs[4];
+    dof_coordinates[29] = coordinate_dofs[5];
+    dof_coordinates[30] = coordinate_dofs[6];
+    dof_coordinates[31] = coordinate_dofs[7];
+    dof_coordinates[32] = coordinate_dofs[8];
+    dof_coordinates[33] = coordinate_dofs[9];
+    dof_coordinates[34] = coordinate_dofs[10];
+    dof_coordinates[35] = coordinate_dofs[11];
+  }
+
+  std::size_t num_sub_elements() const final override
+  {
+    return 3;
+  }
+
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
       {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
+        return new projection_finite_element_0();
+        break;
+      }
+    case 1:
+      {
+        return new projection_finite_element_0();
+        break;
+      }
+    case 2:
+      {
+        return new projection_finite_element_0();
         break;
       }
     }
     
+    return 0;
+  }
+
+  ufc::finite_element * create() const final override
+  {
+    return new projection_finite_element_1();
+  }
+
+};
+
+
+class projection_finite_element_2: public ufc::finite_element
+{
+public:
+
+  projection_finite_element_2() : ufc::finite_element()
+  {
+    // Do nothing
+  }
+
+  ~projection_finite_element_2() override
+  {
+    // Do nothing
+  }
+
+  const char * signature() const final override
+  {
+    return "FiniteElement('Lagrange', tetrahedron, 2)";
+  }
+
+  ufc::shape cell_shape() const final override
+  {
+    return ufc::shape::tetrahedron;
+  }
+
+  std::size_t topological_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t geometric_dimension() const final override
+  {
+    return 3;
+  }
+
+  std::size_t space_dimension() const final override
+  {
+    return 10;
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  std::size_t value_rank() const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    return 0;
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
+  std::size_t value_dimension(std::size_t i) const final override
   {
-    // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 12; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
+    return 1;
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  std::size_t value_size() const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    return 1;
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
+  std::size_t reference_value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 2;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
+  static void _evaluate_basis(std::size_t i,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
+                              int cell_orientation)
   {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -3745,9 +4269,9 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
     
     // Compute subdeterminants
     const double d_00 = J[4]*J[8] - J[5]*J[7];
@@ -3766,440 +4290,739 @@ public:
     double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
     
     
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[3][1];
-    for (unsigned int row = 0; row < 3; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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 > 2)
-            combinations[row][col] = 0;
-          else
-          {
-            combinations[row][col] += 1;
-            break;
-          }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[3][3];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
+    // Reset values
+    *values = 0.0;
     switch (i)
     {
     case 0:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        derivatives[r] = 0.0;
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 1:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 2:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 1:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 4:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        derivatives[r] = 0.0;
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 5:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 6:
       {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
-        {
-          for (unsigned int u = 0; u < 4; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
         
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            for (unsigned int u = 0; u < 4; u++)
-            {
-              for (unsigned int tu = 0; tu < 4; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
-        {
-          for (unsigned int t = 0; t < 4; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    case 7:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
+        break;
+      }
+    case 8:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+      
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
+      
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
+      
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
       {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
+        *values += coefficients0[r]*basisvalues[r];
       } // end loop over 'r'
         break;
       }
-    case 2:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
       
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Compute value(s)
+      for (unsigned int r = 0; r < 10; r++)
+      {
+        *values += coefficients0[r]*basisvalues[r];
+      } // end loop over 'r'
+        break;
+      }
+    }
+    
+  }
+
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
+  {
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation)
+  {
+    // Helper variable to hold values of a single dof.
+    double dof_values = 0.0;
+    
+    // Loop dofs and call evaluate_basis
+    for (unsigned int r = 0; r < 10; r++)
+    {
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
+      values[r] = dof_values;
+    } // end loop over 'r'
+  }
+
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
+  {
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
+  }
+
+  static void _evaluate_basis_derivatives(std::size_t i,
+                                          std::size_t n,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
+                                          int cell_orientation)
+  {
+    
+    // Compute number of derivatives.
+    unsigned int num_derivatives = 1;
+    for (unsigned int r = 0; r < n; r++)
+    {
+      num_derivatives *= 3;
+    } // end loop over 'r'
+    
+    // Reset values. Assuming that values is always an array.
+    for (unsigned int r = 0; r < num_derivatives; r++)
+    {
+      values[r] = 0.0;
+    } // end loop over 'r'
+    
+    // Call evaluate_basis if order of derivatives is equal to zero.
+    if (n == 0)
+    {
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
+      return ;
+    }
+    
+    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
+    if (n > 2)
+    {
+    return ;
+    }
+    
+    // Compute Jacobian
+    double J[9];
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
+    
+    // Compute Jacobian inverse and determinant
+    double K[9];
+    double detJ;
+    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
+    
+    
+    // Compute constants
+    const double C0 = coordinate_dofs[9]  + coordinate_dofs[6] + coordinate_dofs[3]  - coordinate_dofs[0];
+    const double C1 = coordinate_dofs[10] + coordinate_dofs[7] + coordinate_dofs[4]  - coordinate_dofs[1];
+    const double C2 = coordinate_dofs[11] + coordinate_dofs[8] + coordinate_dofs[5]  - coordinate_dofs[2];
+    
+    // Compute subdeterminants
+    const double d_00 = J[4]*J[8] - J[5]*J[7];
+    const double d_01 = J[5]*J[6] - J[3]*J[8];
+    const double d_02 = J[3]*J[7] - J[4]*J[6];
+    const double d_10 = J[2]*J[7] - J[1]*J[8];
+    const double d_11 = J[0]*J[8] - J[2]*J[6];
+    const double d_12 = J[1]*J[6] - J[0]*J[7];
+    const double d_20 = J[1]*J[5] - J[2]*J[4];
+    const double d_21 = J[2]*J[3] - J[0]*J[5];
+    const double d_22 = J[0]*J[4] - J[1]*J[3];
+    
+    // Get coordinates and map to the reference (FIAT) element
+    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
+    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
+    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
+    
+    
+    // Declare two dimensional array that holds combinations of derivatives and initialise
+    unsigned int combinations[9][2];
+    for (unsigned int row = 0; row < 9; row++)
+    {
+      for (unsigned int col = 0; col < 2; col++)
+        combinations[row][col] = 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 > 2)
+            combinations[row][col] = 0;
+          else
+          {
+            combinations[row][col] += 1;
+            break;
+          }
+        }
+      }
+    }
+    
+    // Compute inverse of Jacobian
+    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
+    
+    // Declare transformation matrix
+    // Declare pointer to two dimensional array and initialise
+    double transform[9][9];
+    for (unsigned int j = 0; j < num_derivatives; j++)
+    {
+      for (unsigned int k = 0; k < num_derivatives; k++)
+        transform[j][k] = 1;
+    }
+    
+    // Construct transformation matrix
+    for (unsigned int row = 0; row < num_derivatives; row++)
+    {
+      for (unsigned int col = 0; col < num_derivatives; col++)
+      {
+        for (unsigned int k = 0; k < n; k++)
+          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
+      }
+    }
+    switch (i)
+    {
+    case 0:
+      {
+        
+      // Array of basisvalues
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
+      // Declare helper variables
+      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      // Compute basisvalues
+      basisvalues[0] = 1.0;
+      basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
+      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
+      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
+      basisvalues[0] *= std::sqrt(0.75);
+      basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
+      basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
+      basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
+      
+      // Table(s) of coefficients
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
+      
+      // Tables of derivatives of the polynomial base (transpose).
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4214,9 +5037,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4226,11 +5049,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4240,11 +5063,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4254,11 +5077,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4267,9 +5090,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4286,77 +5109,123 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 3:
+    case 1:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double coefficients0[10] = \
+      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      // Declare derivative matrix (of polynomial basis).
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
+      
+      // Declare (auxiliary) derivative matrix (of polynomial basis).
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4371,9 +5240,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4383,11 +5252,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4397,11 +5266,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4411,11 +5280,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4424,9 +5293,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4443,77 +5312,123 @@ public:
       } // end loop over 'r'
         break;
       }
-    case 4:
+    case 2:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4528,9 +5443,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4540,11 +5455,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4554,11 +5469,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4568,11 +5483,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4581,9 +5496,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4595,82 +5510,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 5:
+    case 3:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4685,9 +5646,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4697,11 +5658,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4711,11 +5672,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4725,11 +5686,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4738,9 +5699,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4752,82 +5713,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 6:
+    case 4:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4842,9 +5849,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -4854,11 +5861,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4868,11 +5875,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4882,11 +5889,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -4895,9 +5902,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -4909,82 +5916,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 7:
+    case 5:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -4999,9 +6052,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5011,11 +6064,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5025,11 +6078,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5039,11 +6092,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5052,9 +6105,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5066,82 +6119,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 8:
+    case 6:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, -0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5156,9 +6255,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5168,11 +6267,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5182,11 +6281,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5196,11 +6295,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5209,9 +6308,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5223,82 +6322,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 9:
+    case 7:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.182574185835055, -0.105409255338946, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5313,9 +6458,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5325,11 +6470,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5339,11 +6484,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5353,11 +6498,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5366,9 +6511,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5380,82 +6525,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 10:
+    case 8:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.210818510677892, -0.074535599249993};
+      static const double coefficients0[10] = \
+      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5470,9 +6661,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5482,11 +6673,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5496,11 +6687,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5510,11 +6701,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5523,9 +6714,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5537,82 +6728,128 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
       }
-    case 11:
+    case 9:
       {
         
       // Array of basisvalues
-      double basisvalues[4] = {0.0, 0.0, 0.0, 0.0};
+      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
       
       // Declare helper variables
       double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
+      double tmp1 = 0.25*(Y + Z)*(Y + Z);
+      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
+      double tmp3 = 0.5*(1.0 - Z);
+      double tmp4 = tmp3*tmp3;
       
       // Compute basisvalues
       basisvalues[0] = 1.0;
       basisvalues[1] = tmp0;
+      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
       basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
+      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
+      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
       basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
+      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
+      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
+      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
       basisvalues[0] *= std::sqrt(0.75);
       basisvalues[3] *= std::sqrt(1.25);
+      basisvalues[9] *= std::sqrt(1.75);
       basisvalues[2] *= std::sqrt(2.5);
+      basisvalues[8] *= std::sqrt(3.5);
+      basisvalues[7] *= std::sqrt(5.25);
       basisvalues[1] *= std::sqrt(7.5);
+      basisvalues[6] *= std::sqrt(10.5);
+      basisvalues[5] *= std::sqrt(15.75);
+      basisvalues[4] *= std::sqrt(26.25);
       
       // Table(s) of coefficients
-      static const double coefficients0[4] = \
-      {0.288675134594813, 0.0, 0.0, 0.223606797749979};
+      static const double coefficients0[10] = \
+      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
       
       // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[4][4] = \
-      {{0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0}};
+      static const double dmats0[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {4.58257569495585, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats1[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.59160797830997, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
+      
+      static const double dmats2[10][10] = \
+      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {2.29128784747792, 1.44913767461894, 4.18330013267037, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385683, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
       
       // Compute reference derivatives.
       // Declare array of derivatives on FIAT element.
-      double derivatives[3];
-      for (unsigned int r = 0; r < 3; r++)
+      double derivatives[9];
+      for (unsigned int r = 0; r < 9; r++)
       {
         derivatives[r] = 0.0;
       } // end loop over 'r'
       
       // Declare derivative matrix (of polynomial basis).
-      double dmats[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[4][4] = \
-      {{1.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0}};
+      double dmats_old[10][10] = \
+      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
+      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
       
       // Loop possible derivatives.
       for (unsigned int r = 0; r < num_derivatives; r++)
       {
         // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 4; t++)
+        for (unsigned int t = 0; t < 10; t++)
         {
-          for (unsigned int u = 0; u < 4; u++)
+          for (unsigned int u = 0; u < 10; u++)
           {
             dmats[t][u] = 0.0;
             if (t == u)
@@ -5627,9 +6864,9 @@ public:
         for (unsigned int s = 0; s < n; s++)
         {
           // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
               dmats_old[t][u] = dmats[t][u];
               dmats[t][u] = 0.0;
@@ -5639,11 +6876,11 @@ public:
           // Update dmats using an inner product.
           if (combinations[r][s] == 0)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5653,11 +6890,11 @@ public:
           
           if (combinations[r][s] == 1)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5667,11 +6904,11 @@ public:
           
           if (combinations[r][s] == 2)
           {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
-            for (unsigned int u = 0; u < 4; u++)
+            for (unsigned int u = 0; u < 10; u++)
             {
-              for (unsigned int tu = 0; tu < 4; tu++)
+              for (unsigned int tu = 0; tu < 10; tu++)
               {
                 dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
               } // end loop over 'tu'
@@ -5680,9 +6917,9 @@ public:
           }
           
         } // end loop over 's'
-        for (unsigned int s = 0; s < 4; s++)
+        for (unsigned int s = 0; s < 10; s++)
         {
-          for (unsigned int t = 0; t < 4; t++)
+          for (unsigned int t = 0; t < 10; t++)
           {
             derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
           } // end loop over 't'
@@ -5694,7 +6931,7 @@ public:
       {
         for (unsigned int s = 0; s < num_derivatives; s++)
         {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
+          values[r] += transform[r][s]*derivatives[s];
         } // end loop over 's'
       } // end loop over 'r'
         break;
@@ -5703,28 +6940,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -5736,16 +6971,16 @@ public:
     } // end loop over 'r'
     
     // Set values equal to zero.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 10; r++)
     {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        values[r*3*num_derivatives + s] = 0.0;
+        values[r*num_derivatives + s] = 0.0;
       } // end loop over 's'
     } // end loop over 'r'
     
     // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
+    if (n > 2)
     {
       return ;
     }
@@ -5758,35 +6993,33 @@ public:
     } // end loop over 'r'
     
     // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 12; r++)
+    for (unsigned int r = 0; r < 10; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
+      for (unsigned int s = 0; s < num_derivatives; s++)
       {
-        values[r*3*num_derivatives + s] = dof_values[s];
+        values[r*num_derivatives + s] = dof_values[s];
       } // end loop over 's'
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[3];
+    double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
@@ -5794,110 +7027,92 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
+      y[2] = coordinate_dofs[2];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[3];
+      y[1] = coordinate_dofs[4];
+      y[2] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = coordinate_dofs[6];
+      y[1] = coordinate_dofs[7];
+      y[2] = coordinate_dofs[8];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = coordinate_dofs[9];
+      y[1] = coordinate_dofs[10];
+      y[2] = coordinate_dofs[11];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
     case 6:
       {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
     case 7:
       {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
       f.evaluate(vals, y, c);
-      return vals[1];
+      return vals[0];
         break;
       }
     case 8:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
       f.evaluate(vals, y, c);
-      return vals[2];
+      return vals[0];
         break;
       }
     case 9:
       {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 10:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
+        y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+      y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+      y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
       f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 11:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[2];
+      return vals[0];
         break;
       }
     }
@@ -5905,197 +7120,166 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
-    double vals[3];
+    double vals[1];
     
     // Declare variable for physical coordinates
     double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
+    y[2] = coordinate_dofs[2];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[3];
+    y[1] = coordinate_dofs[4];
+    y[2] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    y[0] = coordinate_dofs[6];
+    y[1] = coordinate_dofs[7];
+    y[2] = coordinate_dofs[8];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    y[0] = coordinate_dofs[9];
+    y[1] = coordinate_dofs[10];
+    y[2] = coordinate_dofs[11];
     f.evaluate(vals, y, c);
     values[3] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[4] = vals[1];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    y[0] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
-    values[5] = vals[1];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[1];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    values[4] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
-    values[7] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
+    values[5] = vals[0];
+    y[0] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
-    values[8] = vals[2];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
+    values[6] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
     f.evaluate(vals, y, c);
-    values[9] = vals[2];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
+    values[7] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
     f.evaluate(vals, y, c);
-    values[10] = vals[2];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
+    values[8] = vals[0];
+    y[0] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    y[1] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    y[2] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
     f.evaluate(vals, y, c);
-    values[11] = vals[2];
+    values[9] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    vertex_values[9] = dof_values[3];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[4];
-    vertex_values[4] = dof_values[5];
-    vertex_values[7] = dof_values[6];
-    vertex_values[10] = dof_values[7];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[8];
-    vertex_values[5] = dof_values[9];
-    vertex_values[8] = dof_values[10];
-    vertex_values[11] = dof_values[11];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    vertex_values[1] = dof_values[1];
+    vertex_values[2] = dof_values[2];
+    vertex_values[3] = dof_values[3];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
+  {
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[6];
+    dof_coordinates[7] = coordinate_dofs[7];
+    dof_coordinates[8] = coordinate_dofs[8];
+    dof_coordinates[9] = coordinate_dofs[9];
+    dof_coordinates[10] = coordinate_dofs[10];
+    dof_coordinates[11] = coordinate_dofs[11];
+    dof_coordinates[12] = 0.5*coordinate_dofs[6] + 0.5*coordinate_dofs[9];
+    dof_coordinates[13] = 0.5*coordinate_dofs[7] + 0.5*coordinate_dofs[10];
+    dof_coordinates[14] = 0.5*coordinate_dofs[8] + 0.5*coordinate_dofs[11];
+    dof_coordinates[15] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[9];
+    dof_coordinates[16] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[10];
+    dof_coordinates[17] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[11];
+    dof_coordinates[18] = 0.5*coordinate_dofs[3] + 0.5*coordinate_dofs[6];
+    dof_coordinates[19] = 0.5*coordinate_dofs[4] + 0.5*coordinate_dofs[7];
+    dof_coordinates[20] = 0.5*coordinate_dofs[5] + 0.5*coordinate_dofs[8];
+    dof_coordinates[21] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[9];
+    dof_coordinates[22] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[10];
+    dof_coordinates[23] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[11];
+    dof_coordinates[24] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[6];
+    dof_coordinates[25] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[7];
+    dof_coordinates[26] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[8];
+    dof_coordinates[27] = 0.5*coordinate_dofs[0] + 0.5*coordinate_dofs[3];
+    dof_coordinates[28] = 0.5*coordinate_dofs[1] + 0.5*coordinate_dofs[4];
+    dof_coordinates[29] = 0.5*coordinate_dofs[2] + 0.5*coordinate_dofs[5];
+  }
+
+  std::size_t num_sub_elements() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new currentdensity_finite_element_1();
-        break;
-      }
-    case 1:
-      {
-        return new currentdensity_finite_element_1();
-        break;
-      }
-    case 2:
-      {
-        return new currentdensity_finite_element_1();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new currentdensity_finite_element_2();
+    return new projection_finite_element_2();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class currentdensity_dofmap_0: public ufc::dofmap
+class projection_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  currentdensity_dofmap_0() : ufc::dofmap()
+  projection_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_dofmap_0()
+  ~projection_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return false;
+        return true;
         break;
       }
     case 1:
       {
-        return true;
+        return false;
         break;
       }
     case 2:
@@ -6113,50 +7297,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[1];
+    return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 6;
+    return 4;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 0;
+        return 1;
         break;
       }
     case 1:
       {
-        return 1;
+        return 0;
         break;
       }
     case 2:
@@ -6174,60 +7347,55 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[1][0];
-    dofs[1] = c.entity_indices[1][1];
-    dofs[2] = c.entity_indices[1][2];
-    dofs[3] = c.entity_indices[1][3];
-    dofs[4] = c.entity_indices[1][4];
-    dofs[5] = c.entity_indices[1][5];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
+    dofs[3] = entity_indices[0][3];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
     case 0:
       {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
+        dofs[0] = 1;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 1:
       {
         dofs[0] = 0;
-      dofs[1] = 3;
-      dofs[2] = 4;
+      dofs[1] = 2;
+      dofs[2] = 3;
         break;
       }
     case 2:
       {
-        dofs[0] = 1;
-      dofs[1] = 3;
-      dofs[2] = 5;
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 3;
         break;
       }
     case 3:
       {
-        dofs[0] = 2;
-      dofs[1] = 4;
-      dofs[2] = 5;
+        dofs[0] = 0;
+      dofs[1] = 1;
+      dofs[2] = 2;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6238,14 +7406,9 @@ public:
     {
     case 0:
       {
-        
-        break;
-      }
-    case 1:
-      {
-        if (i > 5)
+        if (i > 3)
       {
-      throw std::runtime_error("i is larger than number of entities (5)");
+      throw std::runtime_error("i is larger than number of entities (3)");
       }
       
       switch (i)
@@ -6270,20 +7433,15 @@ public:
           dofs[0] = 3;
           break;
         }
-      case 4:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 5:
-        {
-          dofs[0] = 5;
-          break;
-        }
       }
       
         break;
       }
+    case 1:
+      {
+        
+        break;
+      }
     case 2:
       {
         
@@ -6298,77 +7456,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[3] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[4] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[5] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[6] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[7] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[8] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[9] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[10] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[11] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[13] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[14] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[15] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[16] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[17] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new currentdensity_dofmap_0();
+    return new projection_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class currentdensity_dofmap_1: public ufc::dofmap
+class projection_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  currentdensity_dofmap_1() : ufc::dofmap()
+  projection_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_dofmap_1()
+  ~projection_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6397,45 +7523,34 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return num_global_entities[0];
+    return 3*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 4;
+    return 12;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 3;
+    return 9;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 1;
+        return 3;
         break;
       }
     case 1:
@@ -6458,20 +7573,30 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
-    dofs[3] = c.entity_indices[0][3];
+    unsigned int offset = 0;
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[0][0];
+    dofs[5] = offset + entity_indices[0][1];
+    dofs[6] = offset + entity_indices[0][2];
+    dofs[7] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
+    dofs[8] = offset + entity_indices[0][0];
+    dofs[9] = offset + entity_indices[0][1];
+    dofs[10] = offset + entity_indices[0][2];
+    dofs[11] = offset + entity_indices[0][3];
+    offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6480,6 +7605,12 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 5;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 9;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 1:
@@ -6487,6 +7618,12 @@ public:
         dofs[0] = 0;
       dofs[1] = 2;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 6;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 10;
+      dofs[8] = 11;
         break;
       }
     case 2:
@@ -6494,6 +7631,12 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 3;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 7;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 11;
         break;
       }
     case 3:
@@ -6501,15 +7644,20 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 2;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
+      dofs[6] = 8;
+      dofs[7] = 9;
+      dofs[8] = 10;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6530,21 +7678,29 @@ public:
       case 0:
         {
           dofs[0] = 0;
+        dofs[1] = 4;
+        dofs[2] = 8;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
+        dofs[1] = 5;
+        dofs[2] = 9;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
+        dofs[1] = 6;
+        dofs[2] = 10;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
+        dofs[1] = 7;
+        dofs[2] = 11;
           break;
         }
       }
@@ -6570,71 +7726,64 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 0;
+    return 3;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
+    switch (i)
+    {
+    case 0:
+      {
+        return new projection_dofmap_0();
+        break;
+      }
+    case 1:
+      {
+        return new projection_dofmap_0();
+        break;
+      }
+    case 2:
+      {
+        return new projection_dofmap_0();
+        break;
+      }
+    }
+    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new currentdensity_dofmap_1();
+    return new projection_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class currentdensity_dofmap_2: public ufc::dofmap
+class projection_dofmap_2: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  currentdensity_dofmap_2() : ufc::dofmap()
+  projection_dofmap_2() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_dofmap_2()
+  ~projection_dofmap_2() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('tetrahedron', 3)), 1, 3, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', tetrahedron, 2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -6645,7 +7794,7 @@ public:
       }
     case 1:
       {
-        return false;
+        return true;
         break;
       }
     case 2:
@@ -6663,50 +7812,39 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
-    return 3*num_global_entities[0];
+    return num_global_entities[0] + num_global_entities[1];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
-    return 12;
+    return 10;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
-    return 9;
+    return 6;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
     case 0:
       {
-        return 3;
+        return 1;
         break;
       }
     case 1:
       {
-        return 0;
+        return 1;
         break;
       }
     case 2:
@@ -6724,32 +7862,27 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[0][0];
-    dofs[5] = offset + c.entity_indices[0][1];
-    dofs[6] = offset + c.entity_indices[0][2];
-    dofs[7] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[8] = offset + c.entity_indices[0][0];
-    dofs[9] = offset + c.entity_indices[0][1];
-    dofs[10] = offset + c.entity_indices[0][2];
-    dofs[11] = offset + c.entity_indices[0][3];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][3];
     offset += num_global_entities[0];
+    dofs[4] = offset + entity_indices[1][0];
+    dofs[5] = offset + entity_indices[1][1];
+    dofs[6] = offset + entity_indices[1][2];
+    dofs[7] = offset + entity_indices[1][3];
+    dofs[8] = offset + entity_indices[1][4];
+    dofs[9] = offset + entity_indices[1][5];
+    offset += num_global_entities[1];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -6758,12 +7891,9 @@ public:
         dofs[0] = 1;
       dofs[1] = 2;
       dofs[2] = 3;
-      dofs[3] = 5;
-      dofs[4] = 6;
-      dofs[5] = 7;
-      dofs[6] = 9;
-      dofs[7] = 10;
-      dofs[8] = 11;
+      dofs[3] = 4;
+      dofs[4] = 5;
+      dofs[5] = 6;
         break;
       }
     case 1:
@@ -6772,11 +7902,8 @@ public:
       dofs[1] = 2;
       dofs[2] = 3;
       dofs[3] = 4;
-      dofs[4] = 6;
-      dofs[5] = 7;
-      dofs[6] = 8;
-      dofs[7] = 10;
-      dofs[8] = 11;
+      dofs[4] = 7;
+      dofs[5] = 8;
         break;
       }
     case 2:
@@ -6784,12 +7911,9 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 7;
-      dofs[6] = 8;
-      dofs[7] = 9;
-      dofs[8] = 11;
+      dofs[3] = 5;
+      dofs[4] = 7;
+      dofs[5] = 9;
         break;
       }
     case 3:
@@ -6797,21 +7921,17 @@ public:
         dofs[0] = 0;
       dofs[1] = 1;
       dofs[2] = 2;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 6;
-      dofs[6] = 8;
-      dofs[7] = 9;
-      dofs[8] = 10;
+      dofs[3] = 6;
+      dofs[4] = 8;
+      dofs[5] = 9;
         break;
       }
     }
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 3)
     {
@@ -6832,29 +7952,21 @@ public:
       case 0:
         {
           dofs[0] = 0;
-        dofs[1] = 4;
-        dofs[2] = 8;
           break;
         }
       case 1:
         {
           dofs[0] = 1;
-        dofs[1] = 5;
-        dofs[2] = 9;
           break;
         }
       case 2:
         {
           dofs[0] = 2;
-        dofs[1] = 6;
-        dofs[2] = 10;
           break;
         }
       case 3:
         {
           dofs[0] = 3;
-        dofs[1] = 7;
-        dofs[2] = 11;
           break;
         }
       }
@@ -6863,7 +7975,45 @@ public:
       }
     case 1:
       {
-        
+        if (i > 5)
+      {
+      throw std::runtime_error("i is larger than number of entities (5)");
+      }
+      
+      switch (i)
+      {
+      case 0:
+        {
+          dofs[0] = 4;
+          break;
+        }
+      case 1:
+        {
+          dofs[0] = 5;
+          break;
+        }
+      case 2:
+        {
+          dofs[0] = 6;
+          break;
+        }
+      case 3:
+        {
+          dofs[0] = 7;
+          break;
+        }
+      case 4:
+        {
+          dofs[0] = 8;
+          break;
+        }
+      case 5:
+        {
+          dofs[0] = 9;
+          break;
+        }
+      }
+      
         break;
       }
     case 2:
@@ -6880,128 +8030,58 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = vertex_coordinates[0];
-    dof_coordinates[13] = vertex_coordinates[1];
-    dof_coordinates[14] = vertex_coordinates[2];
-    dof_coordinates[15] = vertex_coordinates[3];
-    dof_coordinates[16] = vertex_coordinates[4];
-    dof_coordinates[17] = vertex_coordinates[5];
-    dof_coordinates[18] = vertex_coordinates[6];
-    dof_coordinates[19] = vertex_coordinates[7];
-    dof_coordinates[20] = vertex_coordinates[8];
-    dof_coordinates[21] = vertex_coordinates[9];
-    dof_coordinates[22] = vertex_coordinates[10];
-    dof_coordinates[23] = vertex_coordinates[11];
-    dof_coordinates[24] = vertex_coordinates[0];
-    dof_coordinates[25] = vertex_coordinates[1];
-    dof_coordinates[26] = vertex_coordinates[2];
-    dof_coordinates[27] = vertex_coordinates[3];
-    dof_coordinates[28] = vertex_coordinates[4];
-    dof_coordinates[29] = vertex_coordinates[5];
-    dof_coordinates[30] = vertex_coordinates[6];
-    dof_coordinates[31] = vertex_coordinates[7];
-    dof_coordinates[32] = vertex_coordinates[8];
-    dof_coordinates[33] = vertex_coordinates[9];
-    dof_coordinates[34] = vertex_coordinates[10];
-    dof_coordinates[35] = vertex_coordinates[11];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+
+  std::size_t num_sub_dofmaps() const final override
   {
-    return 3;
+    return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new currentdensity_dofmap_1();
-        break;
-      }
-    case 1:
-      {
-        return new currentdensity_dofmap_1();
-        break;
-      }
-    case 2:
-      {
-        return new currentdensity_dofmap_1();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new currentdensity_dofmap_2();
+    return new projection_dofmap_2();
   }
 
 };
 
-/// 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 currentdensity_cell_integral_0_otherwise: public ufc::cell_integral
+class projection_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
-  currentdensity_cell_integral_0_otherwise() : ufc::cell_integral()
+  projection_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~currentdensity_cell_integral_0_otherwise()
+  ~projection_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
     // Number of operations (multiply-add pairs) for geometry tensor:    0
-    // Number of operations (multiply-add pairs) for tensor contraction: 24
-    // Total number of operations (multiply-add pairs):                  27
+    // Number of operations (multiply-add pairs) for tensor contraction: 50
+    // Total number of operations (multiply-add pairs):                  53
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7015,195 +8095,144 @@ public:
     const double G0_ = det;
     
     // Compute element tensor
-    A[0] = 0.0166666666666666*G0_;
-    A[1] = 0.0083333333333333*G0_;
-    A[2] = 0.0083333333333333*G0_;
-    A[3] = 0.0083333333333333*G0_;
-    A[4] = 0.0;
-    A[5] = 0.0;
-    A[6] = 0.0;
-    A[7] = 0.0;
-    A[8] = 0.0;
-    A[9] = 0.0;
-    A[10] = 0.0;
-    A[11] = 0.0;
-    A[12] = 0.0083333333333333*G0_;
-    A[13] = 0.0166666666666667*G0_;
-    A[14] = 0.00833333333333337*G0_;
-    A[15] = 0.00833333333333337*G0_;
-    A[16] = 0.0;
-    A[17] = 0.0;
-    A[18] = 0.0;
-    A[19] = 0.0;
-    A[20] = 0.0;
-    A[21] = 0.0;
-    A[22] = 0.0;
-    A[23] = 0.0;
-    A[24] = 0.0083333333333333*G0_;
-    A[25] = 0.00833333333333337*G0_;
-    A[26] = 0.0166666666666667*G0_;
-    A[27] = 0.00833333333333337*G0_;
-    A[28] = 0.0;
-    A[29] = 0.0;
-    A[30] = 0.0;
-    A[31] = 0.0;
-    A[32] = 0.0;
-    A[33] = 0.0;
-    A[34] = 0.0;
-    A[35] = 0.0;
-    A[36] = 0.0083333333333333*G0_;
-    A[37] = 0.00833333333333337*G0_;
-    A[38] = 0.00833333333333337*G0_;
-    A[39] = 0.0166666666666667*G0_;
-    A[40] = 0.0;
-    A[41] = 0.0;
-    A[42] = 0.0;
-    A[43] = 0.0;
-    A[44] = 0.0;
-    A[45] = 0.0;
-    A[46] = 0.0;
-    A[47] = 0.0;
-    A[48] = 0.0;
-    A[49] = 0.0;
-    A[50] = 0.0;
-    A[51] = 0.0;
-    A[52] = 0.0166666666666666*G0_;
-    A[53] = 0.0083333333333333*G0_;
-    A[54] = 0.0083333333333333*G0_;
-    A[55] = 0.0083333333333333*G0_;
-    A[56] = 0.0;
-    A[57] = 0.0;
-    A[58] = 0.0;
-    A[59] = 0.0;
-    A[60] = 0.0;
-    A[61] = 0.0;
-    A[62] = 0.0;
-    A[63] = 0.0;
-    A[64] = 0.0083333333333333*G0_;
-    A[65] = 0.0166666666666667*G0_;
-    A[66] = 0.00833333333333337*G0_;
-    A[67] = 0.00833333333333337*G0_;
-    A[68] = 0.0;
-    A[69] = 0.0;
-    A[70] = 0.0;
-    A[71] = 0.0;
-    A[72] = 0.0;
-    A[73] = 0.0;
-    A[74] = 0.0;
-    A[75] = 0.0;
-    A[76] = 0.0083333333333333*G0_;
-    A[77] = 0.00833333333333337*G0_;
-    A[78] = 0.0166666666666667*G0_;
-    A[79] = 0.00833333333333337*G0_;
-    A[80] = 0.0;
-    A[81] = 0.0;
-    A[82] = 0.0;
-    A[83] = 0.0;
-    A[84] = 0.0;
-    A[85] = 0.0;
-    A[86] = 0.0;
-    A[87] = 0.0;
-    A[88] = 0.0083333333333333*G0_;
-    A[89] = 0.00833333333333337*G0_;
-    A[90] = 0.00833333333333337*G0_;
-    A[91] = 0.0166666666666667*G0_;
-    A[92] = 0.0;
-    A[93] = 0.0;
-    A[94] = 0.0;
-    A[95] = 0.0;
-    A[96] = 0.0;
-    A[97] = 0.0;
-    A[98] = 0.0;
-    A[99] = 0.0;
-    A[100] = 0.0;
-    A[101] = 0.0;
-    A[102] = 0.0;
-    A[103] = 0.0;
-    A[104] = 0.0166666666666666*G0_;
-    A[105] = 0.0083333333333333*G0_;
-    A[106] = 0.0083333333333333*G0_;
-    A[107] = 0.0083333333333333*G0_;
-    A[108] = 0.0;
-    A[109] = 0.0;
-    A[110] = 0.0;
-    A[111] = 0.0;
-    A[112] = 0.0;
-    A[113] = 0.0;
-    A[114] = 0.0;
-    A[115] = 0.0;
-    A[116] = 0.0083333333333333*G0_;
-    A[117] = 0.0166666666666667*G0_;
-    A[118] = 0.00833333333333337*G0_;
-    A[119] = 0.00833333333333337*G0_;
-    A[120] = 0.0;
-    A[121] = 0.0;
-    A[122] = 0.0;
-    A[123] = 0.0;
-    A[124] = 0.0;
-    A[125] = 0.0;
-    A[126] = 0.0;
-    A[127] = 0.0;
-    A[128] = 0.0083333333333333*G0_;
-    A[129] = 0.00833333333333337*G0_;
-    A[130] = 0.0166666666666667*G0_;
-    A[131] = 0.00833333333333337*G0_;
-    A[132] = 0.0;
-    A[133] = 0.0;
-    A[134] = 0.0;
-    A[135] = 0.0;
-    A[136] = 0.0;
-    A[137] = 0.0;
-    A[138] = 0.0;
-    A[139] = 0.0;
-    A[140] = 0.0083333333333333*G0_;
-    A[141] = 0.00833333333333337*G0_;
-    A[142] = 0.00833333333333337*G0_;
-    A[143] = 0.0166666666666667*G0_;
+    A[0] = 0.00238095238095238*G0_;
+    A[1] = 0.000396825396825395*G0_;
+    A[2] = 0.000396825396825396*G0_;
+    A[3] = 0.000396825396825396*G0_;
+    A[4] = -0.00238095238095238*G0_;
+    A[5] = -0.00238095238095238*G0_;
+    A[6] = -0.00238095238095238*G0_;
+    A[7] = -0.00158730158730158*G0_;
+    A[8] = -0.00158730158730158*G0_;
+    A[9] = -0.00158730158730158*G0_;
+    A[10] = 0.000396825396825395*G0_;
+    A[11] = 0.00238095238095238*G0_;
+    A[12] = 0.000396825396825396*G0_;
+    A[13] = 0.000396825396825396*G0_;
+    A[14] = -0.00238095238095238*G0_;
+    A[15] = -0.00158730158730158*G0_;
+    A[16] = -0.00158730158730158*G0_;
+    A[17] = -0.00238095238095238*G0_;
+    A[18] = -0.00238095238095238*G0_;
+    A[19] = -0.00158730158730158*G0_;
+    A[20] = 0.000396825396825396*G0_;
+    A[21] = 0.000396825396825396*G0_;
+    A[22] = 0.00238095238095238*G0_;
+    A[23] = 0.000396825396825396*G0_;
+    A[24] = -0.00158730158730159*G0_;
+    A[25] = -0.00238095238095238*G0_;
+    A[26] = -0.00158730158730158*G0_;
+    A[27] = -0.00238095238095238*G0_;
+    A[28] = -0.00158730158730159*G0_;
+    A[29] = -0.00238095238095238*G0_;
+    A[30] = 0.000396825396825396*G0_;
+    A[31] = 0.000396825396825396*G0_;
+    A[32] = 0.000396825396825396*G0_;
+    A[33] = 0.00238095238095238*G0_;
+    A[34] = -0.00158730158730159*G0_;
+    A[35] = -0.00158730158730159*G0_;
+    A[36] = -0.00238095238095238*G0_;
+    A[37] = -0.00158730158730159*G0_;
+    A[38] = -0.00238095238095238*G0_;
+    A[39] = -0.00238095238095238*G0_;
+    A[40] = -0.00238095238095238*G0_;
+    A[41] = -0.00238095238095238*G0_;
+    A[42] = -0.00158730158730159*G0_;
+    A[43] = -0.00158730158730159*G0_;
+    A[44] = 0.0126984126984127*G0_;
+    A[45] = 0.00634920634920635*G0_;
+    A[46] = 0.00634920634920635*G0_;
+    A[47] = 0.00634920634920635*G0_;
+    A[48] = 0.00634920634920634*G0_;
+    A[49] = 0.00317460317460317*G0_;
+    A[50] = -0.00238095238095238*G0_;
+    A[51] = -0.00158730158730158*G0_;
+    A[52] = -0.00238095238095238*G0_;
+    A[53] = -0.00158730158730159*G0_;
+    A[54] = 0.00634920634920635*G0_;
+    A[55] = 0.0126984126984127*G0_;
+    A[56] = 0.00634920634920635*G0_;
+    A[57] = 0.00634920634920635*G0_;
+    A[58] = 0.00317460317460317*G0_;
+    A[59] = 0.00634920634920635*G0_;
+    A[60] = -0.00238095238095238*G0_;
+    A[61] = -0.00158730158730158*G0_;
+    A[62] = -0.00158730158730159*G0_;
+    A[63] = -0.00238095238095238*G0_;
+    A[64] = 0.00634920634920635*G0_;
+    A[65] = 0.00634920634920635*G0_;
+    A[66] = 0.0126984126984127*G0_;
+    A[67] = 0.00317460317460317*G0_;
+    A[68] = 0.00634920634920634*G0_;
+    A[69] = 0.00634920634920635*G0_;
+    A[70] = -0.00158730158730158*G0_;
+    A[71] = -0.00238095238095238*G0_;
+    A[72] = -0.00238095238095238*G0_;
+    A[73] = -0.00158730158730159*G0_;
+    A[74] = 0.00634920634920635*G0_;
+    A[75] = 0.00634920634920635*G0_;
+    A[76] = 0.00317460317460317*G0_;
+    A[77] = 0.0126984126984127*G0_;
+    A[78] = 0.00634920634920635*G0_;
+    A[79] = 0.00634920634920635*G0_;
+    A[80] = -0.00158730158730158*G0_;
+    A[81] = -0.00238095238095238*G0_;
+    A[82] = -0.00158730158730159*G0_;
+    A[83] = -0.00238095238095238*G0_;
+    A[84] = 0.00634920634920634*G0_;
+    A[85] = 0.00317460317460317*G0_;
+    A[86] = 0.00634920634920634*G0_;
+    A[87] = 0.00634920634920635*G0_;
+    A[88] = 0.0126984126984127*G0_;
+    A[89] = 0.00634920634920634*G0_;
+    A[90] = -0.00158730158730158*G0_;
+    A[91] = -0.00158730158730158*G0_;
+    A[92] = -0.00238095238095238*G0_;
+    A[93] = -0.00238095238095238*G0_;
+    A[94] = 0.00317460317460317*G0_;
+    A[95] = 0.00634920634920635*G0_;
+    A[96] = 0.00634920634920635*G0_;
+    A[97] = 0.00634920634920635*G0_;
+    A[98] = 0.00634920634920634*G0_;
+    A[99] = 0.0126984126984127*G0_;
   }
 
 };
 
-/// 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 currentdensity_cell_integral_1_otherwise: public ufc::cell_integral
+class projection_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
-  currentdensity_cell_integral_1_otherwise() : ufc::cell_integral()
+  projection_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~currentdensity_cell_integral_1_otherwise()
+  ~projection_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    216
-    // Number of operations (multiply-add pairs) for tensor contraction: 426
-    // Total number of operations (multiply-add pairs):                  645
+    // Number of operations (multiply-add pairs) for geometry tensor:    10
+    // Number of operations (multiply-add pairs) for tensor contraction: 95
+    // Total number of operations (multiply-add pairs):                  108
     
     // Compute Jacobian
     double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
+    compute_jacobian_tetrahedron_3d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[9];
@@ -7214,203 +8243,95 @@ public:
     const double det = std::abs(detJ);
     
     // Compute geometry tensor
-    const double G0_0_1_2 = det*w[0][0]*K[5]*K[7]*(1.0);
-    const double G0_0_2_1 = det*w[0][0]*K[8]*K[4]*(1.0);
-    const double G0_1_0_2 = det*w[0][1]*K[2]*K[7]*(1.0);
-    const double G0_1_2_0 = det*w[0][1]*K[8]*K[1]*(1.0);
-    const double G0_2_0_1 = det*w[0][2]*K[2]*K[4]*(1.0);
-    const double G0_2_1_0 = det*w[0][2]*K[5]*K[1]*(1.0);
-    const double G0_3_0_2 = det*w[0][3]*K[2]*K[7]*(1.0);
-    const double G0_3_1_2 = det*w[0][3]*K[5]*K[7]*(1.0);
-    const double G0_3_2_0 = det*w[0][3]*K[8]*K[1]*(1.0);
-    const double G0_3_2_1 = det*w[0][3]*K[8]*K[4]*(1.0);
-    const double G0_4_0_1 = det*w[0][4]*K[2]*K[4]*(1.0);
-    const double G0_4_1_0 = det*w[0][4]*K[5]*K[1]*(1.0);
-    const double G0_4_1_2 = det*w[0][4]*K[5]*K[7]*(1.0);
-    const double G0_4_2_1 = det*w[0][4]*K[8]*K[4]*(1.0);
-    const double G0_5_0_1 = det*w[0][5]*K[2]*K[4]*(1.0);
-    const double G0_5_0_2 = det*w[0][5]*K[2]*K[7]*(1.0);
-    const double G0_5_1_0 = det*w[0][5]*K[5]*K[1]*(1.0);
-    const double G0_5_2_0 = det*w[0][5]*K[8]*K[1]*(1.0);
-    const double G1_0_1_2 = det*w[0][0]*K[4]*K[8]*(1.0);
-    const double G1_0_2_1 = det*w[0][0]*K[7]*K[5]*(1.0);
-    const double G1_1_0_2 = det*w[0][1]*K[1]*K[8]*(1.0);
-    const double G1_1_2_0 = det*w[0][1]*K[7]*K[2]*(1.0);
-    const double G1_2_0_1 = det*w[0][2]*K[1]*K[5]*(1.0);
-    const double G1_2_1_0 = det*w[0][2]*K[4]*K[2]*(1.0);
-    const double G1_3_0_2 = det*w[0][3]*K[1]*K[8]*(1.0);
-    const double G1_3_1_2 = det*w[0][3]*K[4]*K[8]*(1.0);
-    const double G1_3_2_0 = det*w[0][3]*K[7]*K[2]*(1.0);
-    const double G1_3_2_1 = det*w[0][3]*K[7]*K[5]*(1.0);
-    const double G1_4_0_1 = det*w[0][4]*K[1]*K[5]*(1.0);
-    const double G1_4_1_0 = det*w[0][4]*K[4]*K[2]*(1.0);
-    const double G1_4_1_2 = det*w[0][4]*K[4]*K[8]*(1.0);
-    const double G1_4_2_1 = det*w[0][4]*K[7]*K[5]*(1.0);
-    const double G1_5_0_1 = det*w[0][5]*K[1]*K[5]*(1.0);
-    const double G1_5_0_2 = det*w[0][5]*K[1]*K[8]*(1.0);
-    const double G1_5_1_0 = det*w[0][5]*K[4]*K[2]*(1.0);
-    const double G1_5_2_0 = det*w[0][5]*K[7]*K[2]*(1.0);
-    const double G2_0_1_2 = det*w[0][0]*K[3]*K[8]*(1.0);
-    const double G2_0_2_1 = det*w[0][0]*K[6]*K[5]*(1.0);
-    const double G2_1_0_2 = det*w[0][1]*K[0]*K[8]*(1.0);
-    const double G2_1_2_0 = det*w[0][1]*K[6]*K[2]*(1.0);
-    const double G2_2_0_1 = det*w[0][2]*K[0]*K[5]*(1.0);
-    const double G2_2_1_0 = det*w[0][2]*K[3]*K[2]*(1.0);
-    const double G2_3_0_2 = det*w[0][3]*K[0]*K[8]*(1.0);
-    const double G2_3_1_2 = det*w[0][3]*K[3]*K[8]*(1.0);
-    const double G2_3_2_0 = det*w[0][3]*K[6]*K[2]*(1.0);
-    const double G2_3_2_1 = det*w[0][3]*K[6]*K[5]*(1.0);
-    const double G2_4_0_1 = det*w[0][4]*K[0]*K[5]*(1.0);
-    const double G2_4_1_0 = det*w[0][4]*K[3]*K[2]*(1.0);
-    const double G2_4_1_2 = det*w[0][4]*K[3]*K[8]*(1.0);
-    const double G2_4_2_1 = det*w[0][4]*K[6]*K[5]*(1.0);
-    const double G2_5_0_1 = det*w[0][5]*K[0]*K[5]*(1.0);
-    const double G2_5_0_2 = det*w[0][5]*K[0]*K[8]*(1.0);
-    const double G2_5_1_0 = det*w[0][5]*K[3]*K[2]*(1.0);
-    const double G2_5_2_0 = det*w[0][5]*K[6]*K[2]*(1.0);
-    const double G3_0_1_2 = det*w[0][0]*K[5]*K[6]*(1.0);
-    const double G3_0_2_1 = det*w[0][0]*K[8]*K[3]*(1.0);
-    const double G3_1_0_2 = det*w[0][1]*K[2]*K[6]*(1.0);
-    const double G3_1_2_0 = det*w[0][1]*K[8]*K[0]*(1.0);
-    const double G3_2_0_1 = det*w[0][2]*K[2]*K[3]*(1.0);
-    const double G3_2_1_0 = det*w[0][2]*K[5]*K[0]*(1.0);
-    const double G3_3_0_2 = det*w[0][3]*K[2]*K[6]*(1.0);
-    const double G3_3_1_2 = det*w[0][3]*K[5]*K[6]*(1.0);
-    const double G3_3_2_0 = det*w[0][3]*K[8]*K[0]*(1.0);
-    const double G3_3_2_1 = det*w[0][3]*K[8]*K[3]*(1.0);
-    const double G3_4_0_1 = det*w[0][4]*K[2]*K[3]*(1.0);
-    const double G3_4_1_0 = det*w[0][4]*K[5]*K[0]*(1.0);
-    const double G3_4_1_2 = det*w[0][4]*K[5]*K[6]*(1.0);
-    const double G3_4_2_1 = det*w[0][4]*K[8]*K[3]*(1.0);
-    const double G3_5_0_1 = det*w[0][5]*K[2]*K[3]*(1.0);
-    const double G3_5_0_2 = det*w[0][5]*K[2]*K[6]*(1.0);
-    const double G3_5_1_0 = det*w[0][5]*K[5]*K[0]*(1.0);
-    const double G3_5_2_0 = det*w[0][5]*K[8]*K[0]*(1.0);
-    const double G4_0_1_2 = det*w[0][0]*K[4]*K[6]*(1.0);
-    const double G4_0_2_1 = det*w[0][0]*K[7]*K[3]*(1.0);
-    const double G4_1_0_2 = det*w[0][1]*K[1]*K[6]*(1.0);
-    const double G4_1_2_0 = det*w[0][1]*K[7]*K[0]*(1.0);
-    const double G4_2_0_1 = det*w[0][2]*K[1]*K[3]*(1.0);
-    const double G4_2_1_0 = det*w[0][2]*K[4]*K[0]*(1.0);
-    const double G4_3_0_2 = det*w[0][3]*K[1]*K[6]*(1.0);
-    const double G4_3_1_2 = det*w[0][3]*K[4]*K[6]*(1.0);
-    const double G4_3_2_0 = det*w[0][3]*K[7]*K[0]*(1.0);
-    const double G4_3_2_1 = det*w[0][3]*K[7]*K[3]*(1.0);
-    const double G4_4_0_1 = det*w[0][4]*K[1]*K[3]*(1.0);
-    const double G4_4_1_0 = det*w[0][4]*K[4]*K[0]*(1.0);
-    const double G4_4_1_2 = det*w[0][4]*K[4]*K[6]*(1.0);
-    const double G4_4_2_1 = det*w[0][4]*K[7]*K[3]*(1.0);
-    const double G4_5_0_1 = det*w[0][5]*K[1]*K[3]*(1.0);
-    const double G4_5_0_2 = det*w[0][5]*K[1]*K[6]*(1.0);
-    const double G4_5_1_0 = det*w[0][5]*K[4]*K[0]*(1.0);
-    const double G4_5_2_0 = det*w[0][5]*K[7]*K[0]*(1.0);
-    const double G5_0_1_2 = det*w[0][0]*K[3]*K[7]*(1.0);
-    const double G5_0_2_1 = det*w[0][0]*K[6]*K[4]*(1.0);
-    const double G5_1_0_2 = det*w[0][1]*K[0]*K[7]*(1.0);
-    const double G5_1_2_0 = det*w[0][1]*K[6]*K[1]*(1.0);
-    const double G5_2_0_1 = det*w[0][2]*K[0]*K[4]*(1.0);
-    const double G5_2_1_0 = det*w[0][2]*K[3]*K[1]*(1.0);
-    const double G5_3_0_2 = det*w[0][3]*K[0]*K[7]*(1.0);
-    const double G5_3_1_2 = det*w[0][3]*K[3]*K[7]*(1.0);
-    const double G5_3_2_0 = det*w[0][3]*K[6]*K[1]*(1.0);
-    const double G5_3_2_1 = det*w[0][3]*K[6]*K[4]*(1.0);
-    const double G5_4_0_1 = det*w[0][4]*K[0]*K[4]*(1.0);
-    const double G5_4_1_0 = det*w[0][4]*K[3]*K[1]*(1.0);
-    const double G5_4_1_2 = det*w[0][4]*K[3]*K[7]*(1.0);
-    const double G5_4_2_1 = det*w[0][4]*K[6]*K[4]*(1.0);
-    const double G5_5_0_1 = det*w[0][5]*K[0]*K[4]*(1.0);
-    const double G5_5_0_2 = det*w[0][5]*K[0]*K[7]*(1.0);
-    const double G5_5_1_0 = det*w[0][5]*K[3]*K[1]*(1.0);
-    const double G5_5_2_0 = det*w[0][5]*K[6]*K[1]*(1.0);
+    const double G0_0 = det*w[0][0]*(1.0);
+    const double G0_1 = det*w[0][1]*(1.0);
+    const double G0_2 = det*w[0][2]*(1.0);
+    const double G0_3 = det*w[0][3]*(1.0);
+    const double G0_4 = det*w[0][4]*(1.0);
+    const double G0_5 = det*w[0][5]*(1.0);
+    const double G0_6 = det*w[0][6]*(1.0);
+    const double G0_7 = det*w[0][7]*(1.0);
+    const double G0_8 = det*w[0][8]*(1.0);
+    const double G0_9 = det*w[0][9]*(1.0);
     
     // Compute element tensor
-    A[0] = -0.0416666666666667*G0_0_1_2 + 0.0416666666666667*G0_0_2_1 - 0.0416666666666667*G0_1_0_2 + 0.0416666666666667*G0_1_2_0 - 0.0416666666666667*G0_2_0_1 + 0.0416666666666667*G0_2_1_0 + 0.0416666666666666*G0_3_0_2 + 0.0416666666666666*G0_3_1_2 - 0.0416666666666667*G0_3_2_0 - 0.0416666666666667*G0_3_2_1 + 0.0416666666666667*G0_4_0_1 - 0.0416666666666667*G0_4_1_0 - 0.0416666666666667*G0_4_1_2 + 0.0416666666666667*G0_4_2_1 - 0.0416666666666667*G0_5_0_1 - 0.0416666666666666*G0_5_0_2 +  [...]
-    A[1] = -0.0416666666666666*G0_0_1_2 + 0.0416666666666667*G0_0_2_1 - 0.0416666666666666*G0_1_0_2 + 0.0416666666666667*G0_1_2_0 - 0.0416666666666667*G0_2_0_1 + 0.0416666666666667*G0_2_1_0 + 0.0416666666666666*G0_3_0_2 + 0.0416666666666666*G0_3_1_2 - 0.0416666666666667*G0_3_2_0 - 0.0416666666666667*G0_3_2_1 + 0.0416666666666667*G0_4_0_1 - 0.0416666666666667*G0_4_1_0 - 0.0416666666666667*G0_4_1_2 + 0.0416666666666667*G0_4_2_1 - 0.0416666666666667*G0_5_0_1 - 0.0416666666666666*G0_5_0_2 +  [...]
-    A[2] = -0.0416666666666666*G0_0_1_2 + 0.0416666666666667*G0_0_2_1 - 0.0416666666666666*G0_1_0_2 + 0.0416666666666667*G0_1_2_0 - 0.0416666666666667*G0_2_0_1 + 0.0416666666666667*G0_2_1_0 + 0.0416666666666666*G0_3_0_2 + 0.0416666666666666*G0_3_1_2 - 0.0416666666666667*G0_3_2_0 - 0.0416666666666667*G0_3_2_1 + 0.0416666666666667*G0_4_0_1 - 0.0416666666666667*G0_4_1_0 - 0.0416666666666667*G0_4_1_2 + 0.0416666666666667*G0_4_2_1 - 0.0416666666666667*G0_5_0_1 - 0.0416666666666666*G0_5_0_2 +  [...]
-    A[3] = -0.0416666666666666*G0_0_1_2 + 0.0416666666666667*G0_0_2_1 - 0.0416666666666666*G0_1_0_2 + 0.0416666666666667*G0_1_2_0 - 0.0416666666666667*G0_2_0_1 + 0.0416666666666667*G0_2_1_0 + 0.0416666666666666*G0_3_0_2 + 0.0416666666666666*G0_3_1_2 - 0.0416666666666667*G0_3_2_0 - 0.0416666666666667*G0_3_2_1 + 0.0416666666666667*G0_4_0_1 - 0.0416666666666667*G0_4_1_0 - 0.0416666666666667*G0_4_1_2 + 0.0416666666666667*G0_4_2_1 - 0.0416666666666667*G0_5_0_1 - 0.0416666666666666*G0_5_0_2 +  [...]
-    A[4] = -0.0416666666666667*G2_0_1_2 + 0.0416666666666667*G2_0_2_1 - 0.0416666666666667*G2_1_0_2 + 0.0416666666666667*G2_1_2_0 - 0.0416666666666667*G2_2_0_1 + 0.0416666666666667*G2_2_1_0 + 0.0416666666666666*G2_3_0_2 + 0.0416666666666666*G2_3_1_2 - 0.0416666666666667*G2_3_2_0 - 0.0416666666666667*G2_3_2_1 + 0.0416666666666667*G2_4_0_1 - 0.0416666666666667*G2_4_1_0 - 0.0416666666666667*G2_4_1_2 + 0.0416666666666667*G2_4_2_1 - 0.0416666666666667*G2_5_0_1 - 0.0416666666666666*G2_5_0_2 +  [...]
-    A[5] = -0.0416666666666666*G2_0_1_2 + 0.0416666666666667*G2_0_2_1 - 0.0416666666666666*G2_1_0_2 + 0.0416666666666667*G2_1_2_0 - 0.0416666666666667*G2_2_0_1 + 0.0416666666666667*G2_2_1_0 + 0.0416666666666666*G2_3_0_2 + 0.0416666666666666*G2_3_1_2 - 0.0416666666666667*G2_3_2_0 - 0.0416666666666667*G2_3_2_1 + 0.0416666666666667*G2_4_0_1 - 0.0416666666666667*G2_4_1_0 - 0.0416666666666667*G2_4_1_2 + 0.0416666666666667*G2_4_2_1 - 0.0416666666666667*G2_5_0_1 - 0.0416666666666666*G2_5_0_2 +  [...]
-    A[6] = -0.0416666666666666*G2_0_1_2 + 0.0416666666666667*G2_0_2_1 - 0.0416666666666666*G2_1_0_2 + 0.0416666666666667*G2_1_2_0 - 0.0416666666666667*G2_2_0_1 + 0.0416666666666667*G2_2_1_0 + 0.0416666666666666*G2_3_0_2 + 0.0416666666666666*G2_3_1_2 - 0.0416666666666667*G2_3_2_0 - 0.0416666666666667*G2_3_2_1 + 0.0416666666666667*G2_4_0_1 - 0.0416666666666667*G2_4_1_0 - 0.0416666666666667*G2_4_1_2 + 0.0416666666666667*G2_4_2_1 - 0.0416666666666667*G2_5_0_1 - 0.0416666666666666*G2_5_0_2 +  [...]
-    A[7] = -0.0416666666666666*G2_0_1_2 + 0.0416666666666667*G2_0_2_1 - 0.0416666666666666*G2_1_0_2 + 0.0416666666666667*G2_1_2_0 - 0.0416666666666667*G2_2_0_1 + 0.0416666666666667*G2_2_1_0 + 0.0416666666666666*G2_3_0_2 + 0.0416666666666666*G2_3_1_2 - 0.0416666666666667*G2_3_2_0 - 0.0416666666666667*G2_3_2_1 + 0.0416666666666667*G2_4_0_1 - 0.0416666666666667*G2_4_1_0 - 0.0416666666666667*G2_4_1_2 + 0.0416666666666667*G2_4_2_1 - 0.0416666666666667*G2_5_0_1 - 0.0416666666666666*G2_5_0_2 +  [...]
-    A[8] = -0.0416666666666667*G4_0_1_2 + 0.0416666666666667*G4_0_2_1 - 0.0416666666666667*G4_1_0_2 + 0.0416666666666667*G4_1_2_0 - 0.0416666666666667*G4_2_0_1 + 0.0416666666666667*G4_2_1_0 + 0.0416666666666666*G4_3_0_2 + 0.0416666666666666*G4_3_1_2 - 0.0416666666666667*G4_3_2_0 - 0.0416666666666667*G4_3_2_1 + 0.0416666666666667*G4_4_0_1 - 0.0416666666666667*G4_4_1_0 - 0.0416666666666667*G4_4_1_2 + 0.0416666666666667*G4_4_2_1 - 0.0416666666666667*G4_5_0_1 - 0.0416666666666666*G4_5_0_2 +  [...]
-    A[9] = -0.0416666666666666*G4_0_1_2 + 0.0416666666666667*G4_0_2_1 - 0.0416666666666666*G4_1_0_2 + 0.0416666666666667*G4_1_2_0 - 0.0416666666666667*G4_2_0_1 + 0.0416666666666667*G4_2_1_0 + 0.0416666666666666*G4_3_0_2 + 0.0416666666666666*G4_3_1_2 - 0.0416666666666667*G4_3_2_0 - 0.0416666666666667*G4_3_2_1 + 0.0416666666666667*G4_4_0_1 - 0.0416666666666667*G4_4_1_0 - 0.0416666666666667*G4_4_1_2 + 0.0416666666666667*G4_4_2_1 - 0.0416666666666667*G4_5_0_1 - 0.0416666666666666*G4_5_0_2 +  [...]
-    A[10] = -0.0416666666666666*G4_0_1_2 + 0.0416666666666667*G4_0_2_1 - 0.0416666666666666*G4_1_0_2 + 0.0416666666666667*G4_1_2_0 - 0.0416666666666667*G4_2_0_1 + 0.0416666666666667*G4_2_1_0 + 0.0416666666666666*G4_3_0_2 + 0.0416666666666666*G4_3_1_2 - 0.0416666666666667*G4_3_2_0 - 0.0416666666666667*G4_3_2_1 + 0.0416666666666667*G4_4_0_1 - 0.0416666666666667*G4_4_1_0 - 0.0416666666666667*G4_4_1_2 + 0.0416666666666667*G4_4_2_1 - 0.0416666666666667*G4_5_0_1 - 0.0416666666666666*G4_5_0_2 + [...]
-    A[11] = -0.0416666666666666*G4_0_1_2 + 0.0416666666666667*G4_0_2_1 - 0.0416666666666666*G4_1_0_2 + 0.0416666666666667*G4_1_2_0 - 0.0416666666666667*G4_2_0_1 + 0.0416666666666667*G4_2_1_0 + 0.0416666666666666*G4_3_0_2 + 0.0416666666666666*G4_3_1_2 - 0.0416666666666667*G4_3_2_0 - 0.0416666666666667*G4_3_2_1 + 0.0416666666666667*G4_4_0_1 - 0.0416666666666667*G4_4_1_0 - 0.0416666666666667*G4_4_1_2 + 0.0416666666666667*G4_4_2_1 - 0.0416666666666667*G4_5_0_1 - 0.0416666666666666*G4_5_0_2 + [...]
+    A[0] = 0.00238095238095238*G0_0 + 0.000396825396825395*G0_1 + 0.000396825396825396*G0_2 + 0.000396825396825396*G0_3 - 0.00238095238095238*G0_4 - 0.00238095238095238*G0_5 - 0.00238095238095238*G0_6 - 0.00158730158730158*G0_7 - 0.00158730158730158*G0_8 - 0.00158730158730158*G0_9;
+    A[1] = 0.000396825396825395*G0_0 + 0.00238095238095238*G0_1 + 0.000396825396825396*G0_2 + 0.000396825396825396*G0_3 - 0.00238095238095238*G0_4 - 0.00158730158730158*G0_5 - 0.00158730158730158*G0_6 - 0.00238095238095238*G0_7 - 0.00238095238095238*G0_8 - 0.00158730158730158*G0_9;
+    A[2] = 0.000396825396825396*G0_0 + 0.000396825396825396*G0_1 + 0.00238095238095238*G0_2 + 0.000396825396825396*G0_3 - 0.00158730158730159*G0_4 - 0.00238095238095238*G0_5 - 0.00158730158730158*G0_6 - 0.00238095238095238*G0_7 - 0.00158730158730159*G0_8 - 0.00238095238095238*G0_9;
+    A[3] = 0.000396825396825396*G0_0 + 0.000396825396825396*G0_1 + 0.000396825396825396*G0_2 + 0.00238095238095238*G0_3 - 0.00158730158730159*G0_4 - 0.00158730158730159*G0_5 - 0.00238095238095238*G0_6 - 0.00158730158730159*G0_7 - 0.00238095238095238*G0_8 - 0.00238095238095238*G0_9;
+    A[4] = -0.00238095238095238*G0_0 - 0.00238095238095238*G0_1 - 0.00158730158730159*G0_2 - 0.00158730158730159*G0_3 + 0.0126984126984127*G0_4 + 0.00634920634920635*G0_5 + 0.00634920634920635*G0_6 + 0.00634920634920635*G0_7 + 0.00634920634920634*G0_8 + 0.00317460317460317*G0_9;
+    A[5] = -0.00238095238095238*G0_0 - 0.00158730158730158*G0_1 - 0.00238095238095238*G0_2 - 0.00158730158730159*G0_3 + 0.00634920634920635*G0_4 + 0.0126984126984127*G0_5 + 0.00634920634920635*G0_6 + 0.00634920634920635*G0_7 + 0.00317460317460317*G0_8 + 0.00634920634920635*G0_9;
+    A[6] = -0.00238095238095238*G0_0 - 0.00158730158730158*G0_1 - 0.00158730158730159*G0_2 - 0.00238095238095238*G0_3 + 0.00634920634920635*G0_4 + 0.00634920634920635*G0_5 + 0.0126984126984127*G0_6 + 0.00317460317460317*G0_7 + 0.00634920634920634*G0_8 + 0.00634920634920635*G0_9;
+    A[7] = -0.00158730158730158*G0_0 - 0.00238095238095238*G0_1 - 0.00238095238095238*G0_2 - 0.00158730158730159*G0_3 + 0.00634920634920635*G0_4 + 0.00634920634920635*G0_5 + 0.00317460317460317*G0_6 + 0.0126984126984127*G0_7 + 0.00634920634920635*G0_8 + 0.00634920634920635*G0_9;
+    A[8] = -0.00158730158730158*G0_0 - 0.00238095238095238*G0_1 - 0.00158730158730159*G0_2 - 0.00238095238095238*G0_3 + 0.00634920634920634*G0_4 + 0.00317460317460317*G0_5 + 0.00634920634920634*G0_6 + 0.00634920634920635*G0_7 + 0.0126984126984127*G0_8 + 0.00634920634920634*G0_9;
+    A[9] = -0.00158730158730158*G0_0 - 0.00158730158730158*G0_1 - 0.00238095238095238*G0_2 - 0.00238095238095238*G0_3 + 0.00317460317460317*G0_4 + 0.00634920634920635*G0_5 + 0.00634920634920635*G0_6 + 0.00634920634920635*G0_7 + 0.00634920634920634*G0_8 + 0.0126984126984127*G0_9;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class currentdensity_form_0: public ufc::form
+
+class projection_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
-  currentdensity_form_0() : ufc::form()
+  projection_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_form_0()
+  ~projection_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "990d5db83b5c540830effab8fb9e6c9a6b475e964da621fcc7e12d54515f2a41fca2eb111437f612206453285044b8ea089d2abd1fc3308c223fa14ca314fc7b";
+    return "a51045c932d5633d5d0ff6cdd2e7ce24aa471d34d3138fa9f6ef66a34ea4b26e9ebbb1cd35672bdfa134dda3b16c96171fd390bdf703e731853c65e7b1cbc57a";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new projection_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new projection_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new currentdensity_finite_element_2();
+        return new projection_finite_element_2();
         break;
       }
     case 1:
       {
-        return new currentdensity_finite_element_2();
+        return new projection_finite_element_2();
         break;
       }
     }
@@ -7418,19 +8339,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new currentdensity_dofmap_2();
+        return new projection_dofmap_2();
         break;
       }
     case 1:
       {
-        return new currentdensity_dofmap_2();
+        return new projection_dofmap_2();
         break;
       }
     }
@@ -7438,203 +8358,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return new projection_cell_integral_0_otherwise();
+  }
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new currentdensity_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class currentdensity_form_1: public ufc::form
+
+class projection_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
-  currentdensity_form_1() : ufc::form()
+  projection_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~currentdensity_form_1()
+  ~projection_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "bc0f411d750898082ec3ad7ea773479307cf0a372a4a9600bbf93b0dfe0743a768b863bcf8f6eaffd88db4795cfda49b6c0bbd4089a104b336abe9eb5fbe850a";
+    return "b46f48f12472849460aaeef75428df45f03cbf7e5e71982657486800128cac564af2c7e6859be4ca7806acf21213e185a39ae9199ece9584b2159606163cd264";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new projection_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new projection_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new currentdensity_finite_element_2();
+        return new projection_finite_element_2();
         break;
       }
     case 1:
       {
-        return new currentdensity_finite_element_0();
+        return new projection_finite_element_2();
         break;
       }
     }
@@ -7642,19 +8590,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new currentdensity_dofmap_2();
+        return new projection_dofmap_2();
         break;
       }
     case 1:
       {
-        return new currentdensity_dofmap_0();
+        return new projection_dofmap_2();
         break;
       }
     }
@@ -7662,126 +8609,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_vertex_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_interface_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_overlap_integrals() const final override
   {
     return false;
   }
 
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return new projection_cell_integral_1_otherwise();
+  }
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new currentdensity_cell_integral_1_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -7795,59 +8778,42 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
-namespace CurrentDensity
+namespace Projection
 {
 
-class CoefficientSpace_T: public dolfin::FunctionSpace
+class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_T(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_T(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for standard function space
+  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_T(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_T(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
+  // Constructor for constrained function space
+  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_0()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7858,43 +8824,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -7905,63 +8848,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -7969,7 +8919,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_0());
+    _ufc_form = std::make_shared<const projection_form_0>();
   }
 
   // Destructor
@@ -7999,133 +8949,229 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
+
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new currentdensity_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new currentdensity_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<projection_finite_element_2>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<projection_dofmap_2>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
-typedef CoefficientSpace_T Form_L_FunctionSpace_1;
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
+typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
 {
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 1), T(*this, 0)
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
+    dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
+    _ufc_form = std::make_shared<const projection_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& T):
-    dolfin::Form(1, 1), T(*this, 0)
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    this->T = T;
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
+    _ufc_form = std::make_shared<const projection_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> T):
-    dolfin::Form(1, 1), T(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->T = *T;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), T(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& T):
-    dolfin::Form(1, 1), T(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->T = T;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> T):
-    dolfin::Form(1, 1), T(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->T = *T;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new currentdensity_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
   virtual std::size_t coefficient_number(const std::string& name) const
   {
-    if (name == "T")
+    if (name == "f")
       return 0;
 
     dolfin::dolfin_error("generated code for class Form",
@@ -8140,7 +9186,7 @@ public:
     switch (i)
     {
     case 0:
-      return "T";
+      return "f";
     }
 
     dolfin::dolfin_error("generated code for class Form",
@@ -8151,18 +9197,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
-  typedef Form_L_FunctionSpace_1 CoefficientSpace_T;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner T;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/test/unit/function/cpp/Projection.ufl b/test/unit/cpp/function/Projection.ufl
similarity index 100%
rename from test/unit/function/cpp/Projection.ufl
rename to test/unit/cpp/function/Projection.ufl
diff --git a/test/unit/cpp/function/compile.log b/test/unit/cpp/function/compile.log
new file mode 100644
index 0000000..d36340a
--- /dev/null
+++ b/test/unit/cpp/function/compile.log
@@ -0,0 +1,260 @@
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
+
+Compiling form Projection
+
+Compiler stage 1: Analyzing form(s)
+-----------------------------------
+  
+  Geometric dimension:       3
+  Number of cell subdomains: 0
+  Rank:                      2
+  Arguments:                 '(v_0, v_1)'
+  Number of coefficients:    0
+  Coefficients:              '[]'
+  Unique elements:           'CG2(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<3 x CG1(?)>, CG1(?)'
+  
+  Extracting monomial form representation from UFL form
+  Transforming monomial form to reference element
+  Reusing element from cache
+  Estimated cost of tensor representation: 0
+  representation:    auto --> tensor
+  quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
+  
+  Geometric dimension:       3
+  Number of cell subdomains: 0
+  Rank:                      1
+  Arguments:                 '(v_0)'
+  Number of coefficients:    1
+  Coefficients:              '[w_0]'
+  Unique elements:           'CG2(?), Vector<3 x CG1(?)>'
+  Unique sub elements:       'CG2(?), Vector<3 x CG1(?)>, CG1(?)'
+  
+  Extracting monomial form representation from UFL form
+  Transforming monomial form to reference element
+  Reusing element from cache
+  Reusing element from cache
+  Estimated cost of tensor representation: 1
+  representation:    auto --> tensor
+  quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 4
+  quadrature_degree: 4
+  
+Compiler stage 1 finished in 0.507837 seconds.
+
+Compiler stage 2: Computing intermediate representation
+-------------------------------------------------------
+  Computing representation of 3 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 3 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
+  Reusing element from cache
+  Computing representation of integrals
+  Computing tensor representation
+  Extracting monomial form representation from UFL form
+  Transforming monomial form to reference element
+  Reusing element from cache
+  Reusing element from cache
+  Precomputing integrals on reference element
+  Reusing element from cache
+  100 entries computed in 0.00175 seconds
+  Shape of reference tensor: (10, 10)
+  Primary multi index:   rank = 2 dims = [10, 10] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 0], [5, 1], [5, 2], [5, 3], [...]
+  Secondary multi index: rank = 0 dims = [] indices = [[]]
+  Internal multi index:  rank = 0 dims = [] indices = [[]]
+  Secondary multi index: rank = 0 dims = [] indices = [[]]
+  External multi index:  rank = 0 dims = [] indices = [[]]
+  Reusing element from cache
+  Reusing element from cache
+  Computing tensor representation
+  Extracting monomial form representation from UFL form
+  Transforming monomial form to reference element
+  Reusing element from cache
+  Reusing element from cache
+  Precomputing integrals on reference element
+  Reusing element from cache
+  100 entries computed in 0.00144 seconds
+  Shape of reference tensor: (10, 10)
+  Primary multi index:   rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
+  Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
+  Internal multi index:  rank = 0 dims = [] indices = [[]]
+  Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
+  External multi index:  rank = 0 dims = [] indices = [[]]
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of forms
+  
+Compiler stage 2 finished in 0.0713201 seconds.
+
+Compiler stage 3: Optimizing intermediate representation
+--------------------------------------------------------
+  
+Compiler stage 3 finished in 0.000255108 seconds.
+
+Compiler stage 4: Generating code
+---------------------------------
+  Generating code for 3 element(s)
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp4
+  Removing unused variable: tmp3
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 3 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
+  Generating code for integrals
+  Generating code for forms
+  
+Compiler stage 4 finished in 0.683495 seconds.
+
+Compiler stage 4.1: Generating additional wrapper code
+------------------------------------------------------
+  Generating wrapper code for DOLFIN
+  
+Compiler stage 4.1 finished in 0.00129294 seconds.
+
+Compiler stage 5: Formatting code
+---------------------------------
+  
+Compiler stage 5 finished in 0.00176716 seconds.
+
+FFC finished in 1.2667 seconds.
+Output written to ./Projection.h.
diff --git a/test/unit/cpp/io/XMLMeshData.cpp b/test/unit/cpp/io/XMLMeshData.cpp
new file mode 100644
index 0000000..5027374
--- /dev/null
+++ b/test/unit/cpp/io/XMLMeshData.cpp
@@ -0,0 +1,75 @@
+// Copyright (C) 2013 Garth N. Wells
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// First added:  2012-05-25
+// Last changed:
+//
+
+#include <dolfin.h>
+#include <gtest/gtest.h>
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+TEST(XMLMeshDataIO, test_write_read)
+{
+  // XML mesh output is not supported in parallel. Add test for
+  // parallel with HDF5 when ready.
+  if (dolfin::MPI::size(MPI_COMM_WORLD) == 1)
+  {
+    const std::size_t value = 10;
+    {
+      UnitSquareMesh mesh(2, 2);
+
+      // Create some mesh data
+      std::vector<std::size_t>& data0 = mesh.data().create_array("v", 0);
+      data0.resize(mesh.num_entities(0), value);
+
+      mesh.init(1);
+      std::vector<std::size_t>& data1 = mesh.data().create_array("e", 1);
+      data1.resize(mesh.num_entities(1), value);
+
+      std::vector<std::size_t>& data2 = mesh.data().create_array("c", 2);
+      data2.resize(mesh.num_entities(2), value);
+
+      File file("mesh_data.xml");
+      file << mesh;
+    }
+
+    {
+      // Read mesh from file
+      Mesh mesh("mesh_data.xml");
+
+      // Access mesh data and check
+      const std::vector<std::size_t>& data0 = mesh.data().array("v", 0);
+      ASSERT_EQ(data0.size(), mesh.num_entities(0));
+      ASSERT_EQ(data0[2], value);
+      const std::vector<std::size_t>& data1 = mesh.data().array("e", 1);
+      ASSERT_EQ(data1.size(), mesh.num_entities(1));
+      ASSERT_EQ(data1[2], value);
+      const std::vector<std::size_t>& data2 = mesh.data().array("c", 2);
+      ASSERT_EQ(data2.size(), mesh.num_entities(2));
+      ASSERT_EQ(data2[2], value);
+    }
+  }
+}
+
+// Test all
+int XMLMeshData_main(int argc, char **argv) {
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/test/unit/cpp/io/XMLMeshValueCollection.cpp b/test/unit/cpp/io/XMLMeshValueCollection.cpp
new file mode 100644
index 0000000..d177b0e
--- /dev/null
+++ b/test/unit/cpp/io/XMLMeshValueCollection.cpp
@@ -0,0 +1,53 @@
+// Copyright (C) 2007 Magnus Vikstrøm
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// First added:  2007-05-29
+// Last changed: 2012-01-12
+//
+
+#include <dolfin.h>
+#include <gtest/gtest.h>
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+TEST(MeshValueCollectionIO, test_read)
+{
+  // Create mesh and read file
+  // Link to the mesh is quite long...
+  auto mesh = std::make_shared<UnitCubeMesh>(5, 5, 5);
+  MeshValueCollection<std::size_t>
+    markers(mesh, "./test/unit/cpp/io/xml_value_collection_ref.xml");
+
+  // Check size
+  ASSERT_EQ(dolfin::MPI::sum(mesh->mpi_comm(), markers.size()),
+            (std::size_t) 6);
+
+  // Check sum of values
+  const std::map<std::pair<std::size_t, std::size_t>, std::size_t>&
+    values = markers.values();
+  std::size_t sum = 0;
+  for (auto it = values.begin(); it != values.end(); ++it)
+    sum += it->second;
+  ASSERT_EQ(dolfin::MPI::sum(mesh->mpi_comm(), sum), (std::size_t) 48);
+}
+
+// Test all
+int XMLMeshValueCollection_main(int argc, char **argv) {
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/test/unit/io/cpp/xml_value_collection_ref.xml b/test/unit/cpp/io/xml_value_collection_ref.xml
similarity index 100%
rename from test/unit/io/cpp/xml_value_collection_ref.xml
rename to test/unit/cpp/io/xml_value_collection_ref.xml
diff --git a/test/unit/cpp/la/LinearOperator.cpp b/test/unit/cpp/la/LinearOperator.cpp
new file mode 100644
index 0000000..9a4da01
--- /dev/null
+++ b/test/unit/cpp/la/LinearOperator.cpp
@@ -0,0 +1,126 @@
+// Copyright (C) 2012 Anders Logg
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// Modified by Johannes Ring 2012
+//
+// First added:  2012-08-21
+// Last changed: 2012-09-19
+//
+// Unit tests for matrix-free linear solvers (LinearOperator)
+
+#include <dolfin.h>
+#include "forms/ReactionDiffusion.h"
+#include "forms/ReactionDiffusionAction.h"
+
+#include <gtest/gtest.h>
+
+using namespace dolfin;
+
+// Backends supporting the LinearOperator interface
+static std::vector<std::string> backends = {"PETSc", "Eigen"};
+
+//-----------------------------------------------------------------------------
+TEST(TestLinearOperator, test_linear_operator)
+{
+  // Define linear operator
+  class MyLinearOperator : public LinearOperator
+  {
+  public:
+
+    MyLinearOperator(Form& a_action, Function& u)
+      : LinearOperator(*u.vector(), *u.vector()),
+        a_action(a_action), u(u)
+    {
+      // Do nothing
+    }
+
+    std::size_t size(std::size_t dim) const
+    { return u.function_space()->dim(); }
+
+    void mult(const GenericVector& x, GenericVector& y) const
+    {
+      // Update coefficient vector
+      *u.vector() = x;
+
+      // Assemble action
+      Assembler assembler;
+      assembler.assemble(y, a_action);
+    }
+
+  private:
+
+    Form& a_action;
+    Function& u;
+
+  };
+
+  // Iterate over backends supporting linear operators
+  for (std::size_t i = 0; i < backends.size(); i++)
+  {
+    // Check whether backend is available
+    if (!has_linear_algebra_backend(backends[i]))
+      continue;
+
+    // Skip testing Eigen in parallel
+    if (dolfin::MPI::size(MPI_COMM_WORLD) > 1
+        && backends[i] == "Eigen")
+    {
+      info("Not running Eigen test in parallel");
+      continue;
+    }
+
+    // Set linear algebra backend
+    parameters["linear_algebra_backend"] = backends[i];
+
+    // Compute reference value by solving ordinary linear system
+    auto mesh = std::make_shared<UnitSquareMesh>(8, 8);
+    auto V = std::make_shared<ReactionDiffusion::FunctionSpace>(mesh);
+    ReactionDiffusion::BilinearForm a(V, V);
+    ReactionDiffusion::LinearForm L(V);
+    auto f = std::make_shared<Constant>(1.0);
+    L.f = f;
+    Matrix A;
+    Vector x, b;
+    assemble(A, a);
+    assemble(b, L);
+    solve(A, x, b, "gmres", "none");
+    const double norm_ref = norm(x, "l2");
+
+    continue;
+
+    // Solve using linear operator defined by form action
+    ReactionDiffusionAction::LinearForm a_action(V);
+    auto u = std::make_shared<Function>(V);
+    a_action.u = u;
+    MyLinearOperator O(a_action, *u);
+    solve(O, x, b, "gmres", "none");
+    const double norm_action = norm(x, "l2");
+
+    // Check results
+      ASSERT_NEAR(norm_ref, norm_action, 1e-10);
+  }
+}
+
+// Test all
+int LinearOperator_main(int argc, char **argv) {
+    // Add backends supporting the LinearOperator interface
+    backends.push_back("PETSc");
+    backends.push_back("Eigen");
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
+//-----------------------------------------------------------------------------
diff --git a/test/unit/cpp/la/Vector.cpp b/test/unit/cpp/la/Vector.cpp
new file mode 100644
index 0000000..fd8f041
--- /dev/null
+++ b/test/unit/cpp/la/Vector.cpp
@@ -0,0 +1,182 @@
+// Copyright (C) 2007 Johan Hake
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// First added:  2008-09-30
+// Last changed: 2012-08-21
+//
+// Unit tests Selected methods for GenericVector
+
+#include <dolfin.h>
+#include <gtest/gtest.h>
+
+using namespace dolfin;
+
+//----------------------------------------------------
+void _test_operators(MPI_Comm comm)
+{
+  Vector v(comm, 10), u(comm, 10);
+  v = 0.0;
+  u = 0.0;
+  ASSERT_EQ(v.sum(), 0.0);
+
+  // operator=(double a)
+  v = 1.0;
+  ASSERT_EQ(v.sum(), v.size());
+
+  // operator=(const GenericVector& x)
+  u = v;
+  ASSERT_EQ(u.sum(), u.size());
+
+  // operator+=(const GenericVector& x)
+  u += v;
+  ASSERT_EQ(u.sum(), 2*u.size());
+
+  // operator-=(const GenericVector& x)
+  u -= v;
+  u -= v;
+  ASSERT_EQ(u.sum(), 0.0);
+
+  // operator*=(double a)
+  v *= 5.0;
+  ASSERT_EQ(v.sum(), v.size()*5.0);
+
+  // operator/=(double a)
+  v /= 2.0;
+  ASSERT_EQ(v.sum(), 2.5*v.size());
+
+  // operator*=(const GenericVector& x)
+  u = 2.0;
+  v*=u;
+  ASSERT_EQ(v.sum(), v.size()*5.0);
+}
+//----------------------------------------------------
+TEST(TestVector, test_backends)
+{
+  // Eigen
+  parameters["linear_algebra_backend"] = "Eigen";
+  _test_operators(MPI_COMM_SELF);
+
+  // PETSc
+#ifdef HAS_PETSC
+  parameters["linear_algebra_backend"] = "PETSc";
+  _test_operators(MPI_COMM_WORLD);
+#endif
+}
+//----------------------------------------------------
+TEST(TestVector, test_init)
+{
+  // Create local and distributed vector layouts
+
+  // Create local vector layout
+  TensorLayout layout_local(0, TensorLayout::Sparsity::DENSE);
+  std::vector<std::shared_ptr<const IndexMap>> index_maps(1);
+  index_maps[0].reset(new IndexMap(MPI_COMM_SELF, 203, 1));
+  layout_local.init(MPI_COMM_SELF, index_maps,
+                    TensorLayout::Ghosts::UNGHOSTED);
+
+  // Create distributed vector layout
+  TensorLayout layout_distributed(0, TensorLayout::Sparsity::DENSE);
+  auto lrange = dolfin::MPI::local_range(MPI_COMM_WORLD, 203);
+  std::size_t nlocal = lrange.second - lrange.first;
+  index_maps[0].reset(new IndexMap(MPI_COMM_SELF, nlocal, 1));
+  layout_distributed.init(MPI_COMM_WORLD, index_maps,
+                          TensorLayout::Ghosts::UNGHOSTED);
+
+  // Vector
+#ifdef HAS_PETSC
+  parameters["linear_algebra_backend"] = "PETSc";
+  {
+    Vector x;
+    x.init(layout_local);
+    ASSERT_EQ(x.size(), (std::size_t) 203);
+
+    Vector y;
+    y.init(layout_distributed);
+    ASSERT_EQ(x.size(), (std::size_t) 203);
+    }
+#endif
+
+  // Eigen
+  {
+    EigenVector x;
+    x.init(layout_local);
+    ASSERT_EQ(x.size(), (std::size_t) 203);
+  }
+
+  // PETSc
+#ifdef HAS_PETSC
+  {
+    PETScVector x;
+    x.init(layout_local);
+    ASSERT_EQ(x.size(), (std::size_t) 203);
+
+    PETScVector y;
+    y.init(layout_distributed);
+    ASSERT_EQ(y.size(), (std::size_t) 203);
+  }
+#endif
+}
+//----------------------------------------------------
+TEST(TestVector, test_get_local_empty)
+{
+  // Create local and distributed vector layouts
+  const std::vector<std::size_t> dims(1, 203);
+
+  // Create local vector layout
+  TensorLayout layout_local(0, TensorLayout::Sparsity::DENSE);
+  std::vector<std::shared_ptr<const IndexMap>> index_maps(1);
+  index_maps[0].reset(new IndexMap(MPI_COMM_SELF, 203, 1));
+  layout_local.init(MPI_COMM_SELF, index_maps,
+                    TensorLayout::Ghosts::UNGHOSTED);
+
+  // Create distributed vector layout
+  TensorLayout layout_distributed(0, TensorLayout::Sparsity::DENSE);
+  auto lrange = dolfin::MPI::local_range(MPI_COMM_WORLD, 203);
+  std::size_t nlocal = lrange.second - lrange.first;
+  index_maps[0].reset(new IndexMap(MPI_COMM_SELF, nlocal, 1));
+  layout_distributed.init(MPI_COMM_WORLD, index_maps,
+                          TensorLayout::Ghosts::UNGHOSTED);
+
+  // Vector
+#ifdef HAS_PETSC
+  parameters["linear_algebra_backend"] = "PETSc";
+  {
+    Vector x;
+    x.init(layout_local);
+    ASSERT_EQ(x.size(), (std::size_t) 203);
+
+    Vector y;
+    y.init(layout_distributed);
+    ASSERT_EQ(y.size(), (std::size_t) 203);
+
+    //:get_local(double* block, std::size_t m,
+    //           const dolfin::la_index* rows) const
+
+    double* block = NULL;
+    dolfin::la_index* rows = NULL;
+    x.get_local(block, 0, rows);
+    y.get_local(block, 0, rows);
+
+  }
+#endif
+}
+
+// Test all
+int Vector_main(int argc, char **argv) {
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h b/test/unit/cpp/la/forms/ReactionDiffusion.h
similarity index 55%
copy from demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h
copy to test/unit/cpp/la/forms/ReactionDiffusion.h
index 0eb8c0c..a2acaed 100644
--- a/demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h
+++ b/test/unit/cpp/la/forms/ReactionDiffusion.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
-#ifndef __DG0_EPS_XX_H
-#define __DG0_EPS_XX_H
-
-#include <cmath>
+#ifndef __REACTIONDIFFUSION_H
+#define __REACTIONDIFFUSION_H
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
-class dg0_eps_xx_finite_element_0: public ufc::finite_element
+class reactiondiffusion_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_finite_element_0() : ufc::finite_element()
+  reactiondiffusion_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_finite_element_0()
+  ~reactiondiffusion_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,98 +902,104 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new dg0_eps_xx_finite_element_0();
+    return new reactiondiffusion_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class dg0_eps_xx_finite_element_1: public ufc::finite_element
+class reactiondiffusion_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_finite_element_1() : ufc::finite_element()
+  reactiondiffusion_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_finite_element_1()
+  ~reactiondiffusion_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1004,16 +1013,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1022,8 +1045,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1206,20 +1229,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1228,7 +1249,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1236,21 +1257,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1270,7 +1289,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1282,7 +1301,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1291,8 +1310,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2137,28 +2156,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2194,7 +2211,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2202,22 +2219,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2228,48 +2243,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -2279,50 +2294,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2334,378 +2347,75 @@ public:
     vertex_values[5] = dof_values[5];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_finite_element_0();
+        return new reactiondiffusion_finite_element_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new dg0_eps_xx_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class dg0_eps_xx_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  dg0_eps_xx_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~dg0_eps_xx_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 1;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return new reactiondiffusion_finite_element_0();
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new dg0_eps_xx_finite_element_2();
+    return new reactiondiffusion_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class dg0_eps_xx_dofmap_0: public ufc::dofmap
+class reactiondiffusion_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_dofmap_0() : ufc::dofmap()
+  reactiondiffusion_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_dofmap_0()
+  ~reactiondiffusion_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2729,39 +2439,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2785,19 +2484,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2823,9 +2520,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2876,65 +2572,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new dg0_eps_xx_dofmap_0();
+    return new reactiondiffusion_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class dg0_eps_xx_dofmap_1: public ufc::dofmap
+class reactiondiffusion_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_dofmap_1() : ufc::dofmap()
+  reactiondiffusion_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_dofmap_1()
+  ~reactiondiffusion_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2958,39 +2634,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3014,25 +2679,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3064,9 +2727,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3120,43 +2782,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_dofmap_0();
+        return new reactiondiffusion_dofmap_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_dofmap_0();
+        return new reactiondiffusion_dofmap_0();
         break;
       }
     }
@@ -3164,257 +2807,47 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new dg0_eps_xx_dofmap_1();
+    return new reactiondiffusion_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class dg0_eps_xx_dofmap_2: public ufc::dofmap
+class reactiondiffusion_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_dofmap_2() : ufc::dofmap()
+  reactiondiffusion_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_dofmap_2()
+  ~reactiondiffusion_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    static const std::vector<bool> enabled({});
+    return enabled;
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return true;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[2];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 1;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 0;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 1;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    dofs[0] = c.entity_indices[2][0];
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new dg0_eps_xx_dofmap_2();
-  }
-
-};
-
-/// 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 dg0_eps_xx_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  dg0_eps_xx_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~dg0_eps_xx_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    0
-    // Number of operations (multiply-add pairs) for tensor contraction: 0
-    // Total number of operations (multiply-add pairs):                  3
+    // Number of operations (multiply-add pairs) for geometry tensor:    8
+    // Number of operations (multiply-add pairs) for tensor contraction: 20
+    // Total number of operations (multiply-add pairs):                  31
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3426,54 +2859,59 @@ public:
     
     // Compute geometry tensor
     const double G0_ = det;
+    const double G1_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
+    const double G1_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
+    const double G1_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
+    const double G1_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
     
     // Compute element tensor
-    A[0] = 0.5*G0_;
+    A[0] = 0.0833333333333334*G0_ + 0.499999999999999*G1_0_0 + 0.5*G1_0_1 + 0.5*G1_1_0 + 0.5*G1_1_1;
+    A[1] = 0.0416666666666667*G0_ - 0.499999999999999*G1_0_0 - 0.5*G1_1_0;
+    A[2] = 0.0416666666666667*G0_ - 0.5*G1_0_1 - 0.5*G1_1_1;
+    A[3] = 0.0416666666666667*G0_ - 0.499999999999999*G1_0_0 - 0.5*G1_0_1;
+    A[4] = 0.0833333333333333*G0_ + 0.499999999999999*G1_0_0;
+    A[5] = 0.0416666666666666*G0_ + 0.5*G1_0_1;
+    A[6] = 0.0416666666666667*G0_ - 0.5*G1_1_0 - 0.5*G1_1_1;
+    A[7] = 0.0416666666666666*G0_ + 0.5*G1_1_0;
+    A[8] = 0.0833333333333333*G0_ + 0.5*G1_1_1;
   }
 
 };
 
-/// 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 dg0_eps_xx_cell_integral_1_otherwise: public ufc::cell_integral
+class reactiondiffusion_cell_integral_1_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_cell_integral_1_otherwise() : ufc::cell_integral()
+  reactiondiffusion_cell_integral_1_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_cell_integral_1_otherwise()
+  ~reactiondiffusion_cell_integral_1_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
     static const std::vector<bool> enabled({true});
     return enabled;
   }
 
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    6
-    // Number of operations (multiply-add pairs) for tensor contraction: 3
-    // Total number of operations (multiply-add pairs):                  12
+    // Number of operations (multiply-add pairs) for geometry tensor:    3
+    // Number of operations (multiply-add pairs) for tensor contraction: 7
+    // Total number of operations (multiply-add pairs):                  13
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3484,88 +2922,81 @@ public:
     const double det = std::abs(detJ);
     
     // Compute geometry tensor
-    const double G0_0_0 = det*w[0][0]*K[0]*(1.0);
-    const double G0_0_1 = det*w[0][0]*K[2]*(1.0);
-    const double G0_1_0 = det*w[0][1]*K[0]*(1.0);
-    const double G0_2_1 = det*w[0][2]*K[2]*(1.0);
+    const double G0_0 = det*w[0][0]*(1.0);
+    const double G0_1 = det*w[0][1]*(1.0);
+    const double G0_2 = det*w[0][2]*(1.0);
     
     // Compute element tensor
-    A[0] = -0.5*G0_0_0 - 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_2_1;
+    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
+    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
+    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class dg0_eps_xx_form_0: public ufc::form
+
+class reactiondiffusion_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_form_0() : ufc::form()
+  reactiondiffusion_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_form_0()
+  ~reactiondiffusion_form_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "3a7d6cf5f936940a07586e666d248364c6c76be4fb59ab04802186cc019e746e821846bc912106cfbdc6564ebde9761ffad57f79ba3425159c2c30d4994ba45d";
+    return "7a9cbd007c437b18c71d4983dc0fc6234fed236f407c4a235df229a0b8b8fbc23e3968067ef1e22fecc84cd2f01564c21641aa34cb895c21ddcc072d8b7ac387";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 2;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 0;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new reactiondiffusion_finite_element_1();
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new reactiondiffusion_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
+
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_finite_element_2();
+        return new reactiondiffusion_finite_element_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_finite_element_2();
+        return new reactiondiffusion_finite_element_0();
         break;
       }
     }
@@ -3573,19 +3004,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_dofmap_2();
+        return new reactiondiffusion_dofmap_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_dofmap_2();
+        return new reactiondiffusion_dofmap_0();
         break;
       }
     }
@@ -3593,203 +3023,231 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  std::size_t max_exterior_facet_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
+  bool has_cutcell_integrals() const final override
+  {
+    return false;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::cell_integral * create_default_cell_integral() const final override
+  {
+    return new reactiondiffusion_cell_integral_0_otherwise();
+  }
+
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
-    return new dg0_eps_xx_cell_integral_0_otherwise();
+    return 0;
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
 
 };
 
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class dg0_eps_xx_form_1: public ufc::form
+
+class reactiondiffusion_form_1: public ufc::form
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_form_1() : ufc::form()
+  reactiondiffusion_form_1() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_form_1()
+  ~reactiondiffusion_form_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "038741e0ed19978c39773b2bd83665df732ab93a1ec0a900710b031eb2fbba2b3bf6bd7a181f6c1a206a45aecf1405c7ec66129fbcc1f64cad3d282f1a7c5690";
+    return "92c518e8d0beb49f0835ca6333b891530ac780c1757521b8add952f7823551f2029560f0f1c361aeb61c5d6664af01c47d85599f161e4fdf4b43e8af78c2089a";
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  std::size_t rank() const final override
   {
     return 1;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  std::size_t num_coefficients() const final override
   {
     return 1;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
     static const std::vector<std::size_t> position({0});
     return position[i];
   }
 
+  ufc::finite_element * create_coordinate_finite_element() const final override
+  {
+    return new reactiondiffusion_finite_element_1();
+  }
+
+  ufc::dofmap * create_coordinate_dofmap() const final override
+  {
+    return new reactiondiffusion_dofmap_1();
+   }
+
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
+  {
+    return nullptr;
+  }
 
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_finite_element_2();
+        return new reactiondiffusion_finite_element_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_finite_element_1();
+        return new reactiondiffusion_finite_element_0();
         break;
       }
     }
@@ -3797,19 +3255,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_dofmap_2();
+        return new reactiondiffusion_dofmap_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_dofmap_1();
+        return new reactiondiffusion_dofmap_0();
         break;
       }
     }
@@ -3817,126 +3274,162 @@ public:
     return 0;
   }
 
+  std::size_t max_cell_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
+  std::size_t max_interface_subdomain_id() const final override
+  {
+    return 0;
+  }
 
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
+  std::size_t max_overlap_subdomain_id() const final override
+  {
+    return 0;
+  }
+
+  bool has_cell_integrals() const final override
   {
     return true;
   }
 
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
+  bool has_exterior_facet_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_interior_facet_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
+  bool has_vertex_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
+  bool has_custom_integrals() const final override
   {
     return false;
   }
 
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
+  bool has_cutcell_integrals() const final override
   {
     return false;
   }
 
+  bool has_interface_integrals() const final override
+  {
+    return false;
+  }
+
+  bool has_overlap_integrals() const final override
+  {
+    return false;
+  }
+
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
+
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
+  {
+    return 0;
+  }
 
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return new dg0_eps_xx_cell_integral_1_otherwise();
+    return new reactiondiffusion_cell_integral_1_otherwise();
   }
 
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::interface_integral * create_default_interface_integral() const final override
+  {
+    return 0;
+  }
+
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -3950,59 +3443,42 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
-namespace DG0_eps_xx
+namespace ReactionDiffusion
 {
 
-class CoefficientSpace_u: public dolfin::FunctionSpace
+class CoefficientSpace_f: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for standard function space
+  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusion_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusion_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
+  // Constructor for constrained function space
+  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusion_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusion_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4013,43 +3489,20 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusion_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusion_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusion_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusion_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4060,63 +3513,70 @@ class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh)))
+  // Constructor for standard function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusion_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusion_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
+  // Constructor for constrained function space
+  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusion_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusion_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+};
 
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh, constrained_domain)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
   }
 
 };
 
-class Form_a: public dolfin::Form
+class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
+      add(V);
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_0());
+    // Build multimesh function space
+    build();
   }
 
+};
+
+class Form_a: public dolfin::Form
+{
+public:
+
   // Constructor
   Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
     dolfin::Form(2, 0)
@@ -4124,7 +3584,7 @@ public:
     _function_spaces[0] = V0;
     _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_0());
+    _ufc_form = std::make_shared<const reactiondiffusion_form_0>();
   }
 
   // Destructor
@@ -4154,133 +3614,229 @@ public:
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
   typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
 
   // Coefficients
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
+  // Constructor
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V1, V0)
+  {
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
+
+  }
+
+  // Destructor
+  ~MultiMeshForm_a()
+  {}
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh)))
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return 0;
   }
 
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh)))
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    // Do nothing
+
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "There are no coefficients");
+    return "unnamed";
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
+  // Typedefs
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
+
+  // Coefficients
+};
 
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+  // Constructor for standard function space
+  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
+    dolfin::FunctionSpace(mesh,
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusion_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusion_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusion_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusion_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
-typedef CoefficientSpace_u Form_L_FunctionSpace_1;
+class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
+{
+public:
+
+  // Constructor for multimesh function space
+  Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
+  {
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
+
+    // Build multimesh function space
+    build();
+  }
+
+};
+
+typedef CoefficientSpace_f Form_L_FunctionSpace_1;
 
 class Form_L: public dolfin::Form
 {
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 1), u(*this, 0)
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
+    dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
+    _ufc_form = std::make_shared<const reactiondiffusion_form_1>();
   }
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u):
-    dolfin::Form(1, 1), u(*this, 0)
+  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::Form(1, 1), f(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    _function_spaces[0] = V0;
 
-    this->u = u;
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
+    _ufc_form = std::make_shared<const reactiondiffusion_form_1>();
   }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+  // Destructor
+  ~Form_L()
+  {}
 
-    this->u = *u;
+  /// Return the number of the coefficient with this name
+  virtual std::size_t coefficient_number(const std::string& name) const
+  {
+    if (name == "f")
+      return 0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return 0;
   }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), u(*this, 0)
+  /// Return the name of the coefficient with this number
+  virtual std::string coefficient_name(std::size_t i) const
   {
-    _function_spaces[0] = V0;
+    switch (i)
+    {
+    case 0:
+      return "f";
+    }
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
+    dolfin::dolfin_error("generated code for class Form",
+                         "access coefficient data",
+                         "Invalid coefficient");
+    return "unnamed";
   }
 
+  // Typedefs
+  typedef Form_L_FunctionSpace_0 TestSpace;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
+
+  // Coefficients
+  dolfin::CoefficientAssigner f;
+};
+
+class MultiMeshForm_L: public dolfin::MultiMeshForm
+{
+public:
+
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u):
-    dolfin::Form(1, 1), u(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
 
-    this->u = u;
+    // Build multimesh form
+    build();
+
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 1), u(*this, 0)
+  MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
+    dolfin::MultiMeshForm(V0), f(*this, 0)
   {
-    _function_spaces[0] = V0;
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_L(V0->part(part)));
+      add(a);
+    }
+
+    // Build multimesh form
+    build();
 
-    this->u = *u;
+    /// Assign coefficients
+    this->f = f;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_L()
   {}
 
   /// Return the number of the coefficient with this name
   virtual std::size_t coefficient_number(const std::string& name) const
   {
-    if (name == "u")
+    if (name == "f")
       return 0;
 
     dolfin::dolfin_error("generated code for class Form",
@@ -4295,7 +3851,7 @@ public:
     switch (i)
     {
     case 0:
-      return "u";
+      return "f";
     }
 
     dolfin::dolfin_error("generated code for class Form",
@@ -4306,18 +3862,24 @@ public:
 
   // Typedefs
   typedef Form_L_FunctionSpace_0 TestSpace;
-  typedef Form_L_FunctionSpace_1 CoefficientSpace_u;
+  typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner f;
 };
 
 // Class typedefs
 typedef Form_a BilinearForm;
+typedef MultiMeshForm_a MultiMeshBilinearForm;
 typedef Form_a JacobianForm;
+typedef MultiMeshForm_a MultiMeshJacobianForm;
 typedef Form_L LinearForm;
+typedef MultiMeshForm_L MultiMeshLinearForm;
 typedef Form_L ResidualForm;
+typedef MultiMeshForm_L MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/test/unit/la/cpp/forms/ReactionDiffusion.ufl b/test/unit/cpp/la/forms/ReactionDiffusion.ufl
similarity index 100%
rename from test/unit/la/cpp/forms/ReactionDiffusion.ufl
rename to test/unit/cpp/la/forms/ReactionDiffusion.ufl
diff --git a/demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h b/test/unit/cpp/la/forms/ReactionDiffusionAction.h
similarity index 53%
copy from demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h
copy to test/unit/cpp/la/forms/ReactionDiffusionAction.h
index 0eb8c0c..c872a06 100644
--- a/demo/undocumented/elastodynamics/cpp/DG0_eps_xx.h
+++ b/test/unit/cpp/la/forms/ReactionDiffusionAction.h
@@ -1,5 +1,5 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
+// This code conforms with the UFC specification version 2016.1.0
+// and was automatically generated by FFC version 2016.1.0.
 //
 // This code was generated with the option '-l dolfin' and
 // contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -13,93 +13,106 @@
 //   error_control:                  False
 //   form_postfix:                   True
 //   format:                         'dolfin'
-//   no_ferari:                      True
 //   optimize:                       True
 //   precision:                      15
-//   quadrature_degree:              'auto'
+//   quadrature_degree:              -1
 //   quadrature_rule:                'auto'
 //   representation:                 'auto'
-//   restrict_keyword:               ''
 //   split:                          False
 
-#ifndef __DG0_EPS_XX_H
-#define __DG0_EPS_XX_H
-
-#include <cmath>
+#ifndef __REACTIONDIFFUSIONACTION_H
+#define __REACTIONDIFFUSIONACTION_H
 #include <stdexcept>
-#include <fstream>
 #include <ufc.h>
 
-/// This class defines the interface for a finite element.
-
-class dg0_eps_xx_finite_element_0: public ufc::finite_element
+class reactiondiffusionaction_finite_element_0: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_finite_element_0() : ufc::finite_element()
+  reactiondiffusionaction_finite_element_0() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_finite_element_0()
+  ~reactiondiffusionaction_finite_element_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 3;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 0;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 0;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
+  {
+    return 1;
+  }
+
+  std::size_t reference_value_size() const final override
+  {
+    return 1;
+  }
+
+  std::size_t degree() const final override
   {
     return 1;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -108,8 +121,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -207,20 +220,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -229,26 +240,24 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
       values[r] = dof_values;
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -268,7 +277,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -280,7 +289,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -289,8 +298,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -742,28 +751,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -799,7 +806,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 3; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < num_derivatives; s++)
       {
         values[r*num_derivatives + s] = dof_values[s];
@@ -807,22 +814,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
@@ -833,24 +838,24 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
@@ -860,38 +865,36 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[1];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -899,98 +902,104 @@ public:
     vertex_values[2] = dof_values[2];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 0;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new dg0_eps_xx_finite_element_0();
+    return new reactiondiffusionaction_finite_element_0();
   }
 
 };
 
-/// This class defines the interface for a finite element.
 
-class dg0_eps_xx_finite_element_1: public ufc::finite_element
+class reactiondiffusionaction_finite_element_1: public ufc::finite_element
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_finite_element_1() : ufc::finite_element()
+  reactiondiffusionaction_finite_element_1() : ufc::finite_element()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_finite_element_1()
+  ~reactiondiffusionaction_finite_element_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
+  ufc::shape cell_shape() const final override
   {
-    return ufc::triangle;
+    return ufc::shape::triangle;
   }
 
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t geometric_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
+  std::size_t space_dimension() const final override
   {
     return 6;
   }
 
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
+  std::size_t value_rank() const final override
+  {
+    return 1;
+  }
+
+  std::size_t value_dimension(std::size_t i) const final override
+  {
+    switch (i)
+    {
+    case 0:
+      {
+        return 2;
+        break;
+      }
+    }
+    
+    return 0;
+  }
+
+  std::size_t value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t reference_value_rank() const final override
   {
     return 1;
   }
 
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
+  std::size_t reference_value_dimension(std::size_t i) const final override
   {
     switch (i)
     {
@@ -1004,16 +1013,30 @@ public:
     return 0;
   }
 
-  /// Evaluate basis function i at given point x in cell (actual implementation)
+  std::size_t reference_value_size() const final override
+  {
+    return 2;
+  }
+
+  std::size_t degree() const final override
+  {
+    return 1;
+  }
+
+  const char * family() const final override
+  {
+    return "Lagrange";
+  }
+
   static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
+                              double * values,
+                              const double * x,
+                              const double * coordinate_dofs,
                               int cell_orientation)
   {
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1022,8 +1045,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -1206,20 +1229,18 @@ public:
     
   }
 
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
+  void evaluate_basis(std::size_t i,
+                      double * values,
+                      const double * x,
+                      const double * coordinate_dofs,
+                      int cell_orientation) const final override
   {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
+  static void _evaluate_basis_all(double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
                                   int cell_orientation)
   {
     // Helper variable to hold values of a single dof.
@@ -1228,7 +1249,7 @@ public:
     // Loop dofs and call evaluate_basis
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2; s++)
       {
         values[r*2 + s] = dof_values[s];
@@ -1236,21 +1257,19 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
+  void evaluate_basis_all(double * values,
+                          const double * x,
+                          const double * coordinate_dofs,
+                          int cell_orientation) const final override
   {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives(std::size_t i,
                                           std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
+                                          double * values,
+                                          const double * x,
+                                          const double * coordinate_dofs,
                                           int cell_orientation)
   {
     
@@ -1270,7 +1289,7 @@ public:
     // Call evaluate_basis if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -1282,7 +1301,7 @@ public:
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -1291,8 +1310,8 @@ public:
     
     
     // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
+    const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
+    const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
     
     // Get coordinates and map to the reference (FIAT) element
     double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
@@ -2137,28 +2156,26 @@ public:
     
   }
 
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
+  void evaluate_basis_derivatives(std::size_t i,
+                                  std::size_t n,
+                                  double * values,
+                                  const double * x,
+                                  const double * coordinate_dofs,
+                                  int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
   static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
+                                              double * values,
+                                              const double * x,
+                                              const double * coordinate_dofs,
                                               int cell_orientation)
   {
     // Call evaluate_basis_all if order of derivatives is equal to zero.
     if (n == 0)
     {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
       return ;
     }
     
@@ -2194,7 +2211,7 @@ public:
     // Loop dofs and call evaluate_basis_derivatives.
     for (unsigned int r = 0; r < 6; r++)
     {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
+      _evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
       for (unsigned int s = 0; s < 2*num_derivatives; s++)
       {
         values[r*2*num_derivatives + s] = dof_values[s];
@@ -2202,22 +2219,20 @@ public:
     } // end loop over 'r'
   }
 
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
+  void evaluate_basis_derivatives_all(std::size_t n,
+                                      double * values,
+                                      const double * x,
+                                      const double * coordinate_dofs,
+                                      int cell_orientation) const final override
   {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
+    _evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
   }
 
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
+  double evaluate_dof(std::size_t i,
+                      const ufc::function& f,
+                      const double * coordinate_dofs,
+                      int cell_orientation,
+                      const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
@@ -2228,48 +2243,48 @@ public:
     {
     case 0:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 1:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 2:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[0];
         break;
       }
     case 3:
       {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
+        y[0] = coordinate_dofs[0];
+      y[1] = coordinate_dofs[1];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 4:
       {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
+        y[0] = coordinate_dofs[2];
+      y[1] = coordinate_dofs[3];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
       }
     case 5:
       {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
+        y[0] = coordinate_dofs[4];
+      y[1] = coordinate_dofs[5];
       f.evaluate(vals, y, c);
       return vals[1];
         break;
@@ -2279,50 +2294,48 @@ public:
     return 0.0;
   }
 
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
+  void evaluate_dofs(double * values,
                              const ufc::function& f,
-                             const double* vertex_coordinates,
+                             const double * coordinate_dofs,
                              int cell_orientation,
-                             const ufc::cell& c) const
+                             const ufc::cell& c) const final override
   {
     // Declare variables for result of evaluation
     double vals[2];
     
     // Declare variable for physical coordinates
     double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[2] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
+    y[0] = coordinate_dofs[0];
+    y[1] = coordinate_dofs[1];
     f.evaluate(vals, y, c);
     values[3] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
+    y[0] = coordinate_dofs[2];
+    y[1] = coordinate_dofs[3];
     f.evaluate(vals, y, c);
     values[4] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
+    y[0] = coordinate_dofs[4];
+    y[1] = coordinate_dofs[5];
     f.evaluate(vals, y, c);
     values[5] = vals[1];
   }
 
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
+  void interpolate_vertex_values(double * vertex_values,
+                                 const double * dof_values,
+                                 const double * coordinate_dofs,
+                                 int cell_orientation,
+                                 const ufc::cell& c) const final override
   {
     // Evaluate function and change variables
     vertex_values[0] = dof_values[0];
@@ -2334,378 +2347,75 @@ public:
     vertex_values[5] = dof_values[5];
   }
 
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
+  void tabulate_dof_coordinates(double * dof_coordinates,
+                                const double * coordinate_dofs) const final override
   {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
+    dof_coordinates[0] = coordinate_dofs[0];
+    dof_coordinates[1] = coordinate_dofs[1];
+    dof_coordinates[2] = coordinate_dofs[2];
+    dof_coordinates[3] = coordinate_dofs[3];
+    dof_coordinates[4] = coordinate_dofs[4];
+    dof_coordinates[5] = coordinate_dofs[5];
+    dof_coordinates[6] = coordinate_dofs[0];
+    dof_coordinates[7] = coordinate_dofs[1];
+    dof_coordinates[8] = coordinate_dofs[2];
+    dof_coordinates[9] = coordinate_dofs[3];
+    dof_coordinates[10] = coordinate_dofs[4];
+    dof_coordinates[11] = coordinate_dofs[5];
   }
 
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
+  std::size_t num_sub_elements() const final override
   {
     return 2;
   }
 
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
+  ufc::finite_element * create_sub_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_finite_element_0();
+        return new reactiondiffusionaction_finite_element_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new dg0_eps_xx_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class dg0_eps_xx_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  dg0_eps_xx_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~dg0_eps_xx_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 1;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
+        return new reactiondiffusionaction_finite_element_0();
         break;
       }
     }
     
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
+  ufc::finite_element * create() const final override
   {
-    return new dg0_eps_xx_finite_element_2();
+    return new reactiondiffusionaction_finite_element_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class dg0_eps_xx_dofmap_0: public ufc::dofmap
+class reactiondiffusionaction_dofmap_0: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_dofmap_0() : ufc::dofmap()
+  reactiondiffusionaction_dofmap_0() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_dofmap_0()
+  ~reactiondiffusionaction_dofmap_0() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
+    return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2729,39 +2439,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 3;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 2;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2785,19 +2484,17 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
-    dofs[0] = c.entity_indices[0][0];
-    dofs[1] = c.entity_indices[0][1];
-    dofs[2] = c.entity_indices[0][2];
+    dofs[0] = entity_indices[0][0];
+    dofs[1] = entity_indices[0][1];
+    dofs[2] = entity_indices[0][2];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -2823,9 +2520,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -2876,65 +2572,45 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 0;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new dg0_eps_xx_dofmap_0();
+    return new reactiondiffusionaction_dofmap_0();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class dg0_eps_xx_dofmap_1: public ufc::dofmap
+class reactiondiffusionaction_dofmap_1: public ufc::dofmap
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_dofmap_1() : ufc::dofmap()
+  reactiondiffusionaction_dofmap_1() : ufc::dofmap()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_dofmap_1()
+  ~reactiondiffusionaction_dofmap_1() override
   {
     // Do nothing
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const char * signature() const final override
   {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 1, 2, None)";
+    return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
+  bool needs_mesh_entities(std::size_t d) const final override
   {
     switch (d)
     {
@@ -2958,39 +2634,28 @@ public:
     return false;
   }
 
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
+  std::size_t topological_dimension() const final override
   {
     return 2;
   }
 
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
+  std::size_t global_dimension(const std::vector<std::size_t>&
+                               num_global_entities) const final override
   {
     return 2*num_global_entities[0];
   }
 
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
+  std::size_t num_element_dofs() const final override
   {
     return 6;
   }
 
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
+  std::size_t num_facet_dofs() const final override
   {
     return 4;
   }
 
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
+  std::size_t num_entity_dofs(std::size_t d) const final override
   {
     switch (d)
     {
@@ -3014,25 +2679,23 @@ public:
     return 0;
   }
 
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
+  void tabulate_dofs(std::size_t * dofs,
+                     const std::vector<std::size_t>& num_global_entities,
+                     const std::vector<std::vector<std::size_t>>& entity_indices) const final override
   {
     unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
+    dofs[0] = offset + entity_indices[0][0];
+    dofs[1] = offset + entity_indices[0][1];
+    dofs[2] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[0][0];
-    dofs[4] = offset + c.entity_indices[0][1];
-    dofs[5] = offset + c.entity_indices[0][2];
+    dofs[3] = offset + entity_indices[0][0];
+    dofs[4] = offset + entity_indices[0][1];
+    dofs[5] = offset + entity_indices[0][2];
     offset += num_global_entities[0];
   }
 
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
+  void tabulate_facet_dofs(std::size_t * dofs,
+                           std::size_t facet) const final override
   {
     switch (facet)
     {
@@ -3064,9 +2727,8 @@ public:
     
   }
 
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
+  void tabulate_entity_dofs(std::size_t * dofs,
+                            std::size_t d, std::size_t i) const final override
   {
     if (d > 2)
     {
@@ -3120,43 +2782,24 @@ public:
     
   }
 
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[0];
-    dof_coordinates[7] = vertex_coordinates[1];
-    dof_coordinates[8] = vertex_coordinates[2];
-    dof_coordinates[9] = vertex_coordinates[3];
-    dof_coordinates[10] = vertex_coordinates[4];
-    dof_coordinates[11] = vertex_coordinates[5];
-  }
 
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
+  std::size_t num_sub_dofmaps() const final override
   {
     return 2;
   }
 
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
+  ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_dofmap_0();
+        return new reactiondiffusionaction_dofmap_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_dofmap_0();
+        return new reactiondiffusionaction_dofmap_0();
         break;
       }
     }
@@ -3164,257 +2807,47 @@ public:
     return 0;
   }
 
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
+  ufc::dofmap * create() const final override
   {
-    return new dg0_eps_xx_dofmap_1();
+    return new reactiondiffusionaction_dofmap_1();
   }
 
 };
 
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
 
-class dg0_eps_xx_dofmap_2: public ufc::dofmap
+class reactiondiffusionaction_cell_integral_0_otherwise: public ufc::cell_integral
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_dofmap_2() : ufc::dofmap()
+  reactiondiffusionaction_cell_integral_0_otherwise() : ufc::cell_integral()
   {
-    // Do nothing
+    
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_dofmap_2()
+  ~reactiondiffusionaction_cell_integral_0_otherwise() override
   {
-    // Do nothing
+    
   }
 
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
+  const std::vector<bool> & enabled_coefficients() const final override
   {
-    return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 2)), 0, None)";
+    static const std::vector<bool> enabled({true});
+    return enabled;
   }
 
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return true;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[2];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 1;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 0;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 1;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    dofs[0] = c.entity_indices[2][0];
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new dg0_eps_xx_dofmap_2();
-  }
-
-};
-
-/// 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 dg0_eps_xx_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  dg0_eps_xx_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~dg0_eps_xx_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
+  void tabulate_tensor(double * A,
+                       const double * const * w,
+                       const double * coordinate_dofs,
+                       int cell_orientation) const final override
   {
     // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    0
-    // Number of operations (multiply-add pairs) for tensor contraction: 0
-    // Total number of operations (multiply-add pairs):                  3
+    // Number of operations (multiply-add pairs) for geometry tensor:    23
+    // Number of operations (multiply-add pairs) for tensor contraction: 23
+    // Total number of operations (multiply-add pairs):                  49
     
     // Compute Jacobian
     double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
+    compute_jacobian_triangle_2d(J, coordinate_dofs);
     
     // Compute Jacobian inverse and determinant
     double K[4];
@@ -3425,147 +2858,89 @@ public:
     const double det = std::abs(detJ);
     
     // Compute geometry tensor
-    const double G0_ = det;
+    const double G0_0 = det*w[0][0]*(1.0);
+    const double G0_1 = det*w[0][1]*(1.0);
+    const double G0_2 = det*w[0][2]*(1.0);
+    const double G1_0_0_0 = det*(w[0][0]*((K[0]*K[0] + K[1]*K[1])));
+    const double G1_0_0_1 = det*(w[0][0]*((K[0]*K[2] + K[1]*K[3])));
+    const double G1_0_1_0 = det*(w[0][1]*((K[0]*K[0] + K[1]*K[1])));
+    const double G1_0_2_1 = det*(w[0][2]*((K[0]*K[2] + K[1]*K[3])));
+    const double G1_1_0_0 = det*(w[0][0]*((K[2]*K[0] + K[3]*K[1])));
+    const double G1_1_0_1 = det*(w[0][0]*((K[2]*K[2] + K[3]*K[3])));
+    const double G1_1_1_0 = det*(w[0][1]*((K[2]*K[0] + K[3]*K[1])));
+    const double G1_1_2_1 = det*(w[0][2]*((K[2]*K[2] + K[3]*K[3])));
     
     // Compute element tensor
-    A[0] = 0.5*G0_;
+    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2 + 0.499999999999999*G1_0_0_0 + 0.5*G1_0_0_1 - 0.499999999999999*G1_0_1_0 - 0.5*G1_0_2_1 + 0.5*G1_1_0_0 + 0.5*G1_1_0_1 - 0.5*G1_1_1_0 - 0.5*G1_1_2_1;
+    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2 - 0.499999999999999*G1_0_0_0 - 0.5*G1_0_0_1 + 0.499999999999999*G1_0_1_0 + 0.5*G1_0_2_1;
+    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2 - 0.5*G1_1_0_0 - 0.5*G1_1_0_1 + 0.5*G1_1_1_0 + 0.5*G1_1_2_1;
   }
 
 };
 
-/// 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 dg0_eps_xx_cell_integral_1_otherwise: public ufc::cell_integral
+class reactiondiffusionaction_form_0: public ufc::form
 {
 public:
 
-  /// Constructor
-  dg0_eps_xx_cell_integral_1_otherwise() : ufc::cell_integral()
+  reactiondiffusionaction_form_0() : ufc::form()
   {
     // Do nothing
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_cell_integral_1_otherwise()
+  ~reactiondiffusionaction_form_0() override
   {
     // Do nothing
   }
 
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
+  const char * signature() const final override
   {
-    static const std::vector<bool> enabled({true});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    6
-    // Number of operations (multiply-add pairs) for tensor contraction: 3
-    // Total number of operations (multiply-add pairs):                  12
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*w[0][0]*K[0]*(1.0);
-    const double G0_0_1 = det*w[0][0]*K[2]*(1.0);
-    const double G0_1_0 = det*w[0][1]*K[0]*(1.0);
-    const double G0_2_1 = det*w[0][2]*K[2]*(1.0);
-    
-    // Compute element tensor
-    A[0] = -0.5*G0_0_0 - 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_2_1;
+    return "a3791fad147a0cf1359488c9cff7bd64b2f048bcca6822849492b88a32158ceacaffa7144e11f87f25fcd688294e45f9f00821a541978c95efe069a8148506ed";
   }
 
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class dg0_eps_xx_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  dg0_eps_xx_form_0() : ufc::form()
+  std::size_t rank() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_form_0()
+  std::size_t num_coefficients() const final override
   {
-    // Do nothing
+    return 1;
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  std::size_t original_coefficient_position(std::size_t i) const final override
   {
-    return "3a7d6cf5f936940a07586e666d248364c6c76be4fb59ab04802186cc019e746e821846bc912106cfbdc6564ebde9761ffad57f79ba3425159c2c30d4994ba45d";
+    static const std::vector<std::size_t> position({0});
+    return position[i];
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  ufc::finite_element * create_coordinate_finite_element() const final override
   {
-    return 2;
+    return new reactiondiffusionaction_finite_element_1();
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  ufc::dofmap * create_coordinate_dofmap() const final override
   {
-    return 0;
-  }
+    return new reactiondiffusionaction_dofmap_1();
+   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  ufc::coordinate_mapping * create_coordinate_mapping() const final override
   {
-    static const std::vector<std::size_t> position({});
-    return position[i];
+    return nullptr;
   }
 
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::finite_element * create_finite_element(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_finite_element_2();
+        return new reactiondiffusionaction_finite_element_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_finite_element_2();
+        return new reactiondiffusionaction_finite_element_0();
         break;
       }
     }
@@ -3573,19 +2948,18 @@ public:
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::dofmap * create_dofmap(std::size_t i) const final override
   {
     switch (i)
     {
     case 0:
       {
-        return new dg0_eps_xx_dofmap_2();
+        return new reactiondiffusionaction_dofmap_0();
         break;
       }
     case 1:
       {
-        return new dg0_eps_xx_dofmap_2();
+        return new reactiondiffusionaction_dofmap_0();
         break;
       }
     }
@@ -3593,350 +2967,162 @@ public:
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  std::size_t max_cell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  std::size_t max_exterior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  std::size_t max_interior_facet_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  std::size_t max_vertex_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  std::size_t max_custom_subdomain_id() const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  std::size_t max_cutcell_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  std::size_t max_interface_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  std::size_t max_overlap_subdomain_id() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  bool has_cell_integrals() const final override
   {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new dg0_eps_xx_cell_integral_0_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
+    return true;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  bool has_exterior_facet_integrals() const final override
   {
-    return 0;
+    return false;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  bool has_interior_facet_integrals() const final override
   {
-    return 0;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class dg0_eps_xx_form_1: public ufc::form
-{
-public:
-
-  /// Constructor
-  dg0_eps_xx_form_1() : ufc::form()
-  {
-    // Do nothing
+    return false;
   }
 
-  /// Destructor
-  virtual ~dg0_eps_xx_form_1()
+  bool has_vertex_integrals() const final override
   {
-    // Do nothing
+    return false;
   }
 
-  /// Return a string identifying the form
-  virtual const char* signature() const
+  bool has_custom_integrals() const final override
   {
-    return "038741e0ed19978c39773b2bd83665df732ab93a1ec0a900710b031eb2fbba2b3bf6bd7a181f6c1a206a45aecf1405c7ec66129fbcc1f64cad3d282f1a7c5690";
+    return false;
   }
 
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
+  bool has_cutcell_integrals() const final override
   {
-    return 1;
+    return false;
   }
 
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
+  bool has_interface_integrals() const final override
   {
-    return 1;
+    return false;
   }
 
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
+  bool has_overlap_integrals() const final override
   {
-    static const std::vector<std::size_t> position({0});
-    return position[i];
+    return false;
   }
 
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
+  ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new dg0_eps_xx_finite_element_2();
-        break;
-      }
-    case 1:
-      {
-        return new dg0_eps_xx_finite_element_1();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
+  ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
   {
-    switch (i)
-    {
-    case 0:
-      {
-        return new dg0_eps_xx_dofmap_2();
-        break;
-      }
-    case 1:
-      {
-        return new dg0_eps_xx_dofmap_1();
-        break;
-      }
-    }
-    
     return 0;
   }
 
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
+  ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
+  ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
+  ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
+  ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
+  ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
+  ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
   {
     return 0;
   }
 
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
+  ufc::cell_integral * create_default_cell_integral() const final override
   {
-    return 0;
+    return new reactiondiffusionaction_cell_integral_0_otherwise();
   }
 
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
+  ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
+  ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
+  ufc::vertex_integral * create_default_vertex_integral() const final override
   {
     return 0;
   }
 
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new dg0_eps_xx_cell_integral_1_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
+  ufc::custom_integral * create_default_custom_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
+  ufc::cutcell_integral * create_default_cutcell_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
+  ufc::interface_integral * create_default_interface_integral() const final override
   {
     return 0;
   }
 
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
+  ufc::overlap_integral * create_default_overlap_integral() const final override
   {
     return 0;
   }
@@ -3950,59 +3136,42 @@ public:
 
 // DOLFIN includes
 #include <dolfin/common/NoDeleter.h>
+#include <dolfin/mesh/Mesh.h>
+#include <dolfin/mesh/MultiMesh.h>
 #include <dolfin/fem/FiniteElement.h>
 #include <dolfin/fem/DofMap.h>
 #include <dolfin/fem/Form.h>
+#include <dolfin/fem/MultiMeshForm.h>
 #include <dolfin/function/FunctionSpace.h>
+#include <dolfin/function/MultiMeshFunctionSpace.h>
 #include <dolfin/function/GenericFunction.h>
 #include <dolfin/function/CoefficientAssigner.h>
+#include <dolfin/function/MultiMeshCoefficientAssigner.h>
 #include <dolfin/adaptivity/ErrorControl.h>
 #include <dolfin/adaptivity/GoalFunctional.h>
+#include <dolfin/la/GenericVector.h>
 
-namespace DG0_eps_xx
+namespace ReactionDiffusionAction
 {
 
 class CoefficientSpace_u: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), *mesh)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusionaction_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusionaction_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_1()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_1()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusionaction_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusionaction_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
@@ -4013,118 +3182,70 @@ class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
+  // Constructor for standard function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusionaction_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusionaction_dofmap_0>(), *mesh))
   {
     // Do nothing
   }
 
-  // Create standard function space (shared pointer version)
+  // Constructor for constrained function space
   Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
     dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh, constrained_domain)))
+                          std::make_shared<const dolfin::FiniteElement>(std::make_shared<reactiondiffusionaction_finite_element_0>()),
+                          std::make_shared<const dolfin::DofMap>(std::make_shared<reactiondiffusionaction_dofmap_0>(), *mesh, constrained_domain))
   {
     // Do nothing
   }
 
 };
 
-class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
+class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
 {
 public:
 
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh)))
+  // Constructor for multimesh function space
+  Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
   {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
+    // Create and add standard function spaces
+    for (std::size_t part = 0; part < multimesh->num_parts(); part++)
+    {
+      std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
+      add(V);
+    }
 
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh, constrained_domain)))
-  {
-    // Do nothing
+    // Build multimesh function space
+    build();
   }
 
 };
 
+typedef CoefficientSpace_u Form_a_FunctionSpace_1;
+
 class Form_a: public dolfin::Form
 {
 public:
 
   // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V0):
+    dolfin::Form(1, 1), u(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
+    _function_spaces[0] = V0;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_0());
+    _ufc_form = std::make_shared<const reactiondiffusionaction_form_0>();
   }
 
   // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 0)
+  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
+    dolfin::Form(1, 1), u(*this, 0)
   {
     _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_0());
+    this->u = u;
+
+    _ufc_form = std::make_shared<const reactiondiffusionaction_form_0>();
   }
 
   // Destructor
@@ -4134,147 +3255,84 @@ public:
   /// Return the number of the coefficient with this name
   virtual std::size_t coefficient_number(const std::string& name) const
   {
+    if (name == "u")
+      return 0;
 
     dolfin::dolfin_error("generated code for class Form",
                          "access coefficient data",
-                         "There are no coefficients");
+                         "Invalid coefficient");
     return 0;
   }
 
   /// Return the name of the coefficient with this number
   virtual std::string coefficient_name(std::size_t i) const
   {
+    switch (i)
+    {
+    case 0:
+      return "u";
+    }
 
     dolfin::dolfin_error("generated code for class Form",
                          "access coefficient data",
-                         "There are no coefficients");
+                         "Invalid coefficient");
     return "unnamed";
   }
 
   // Typedefs
   typedef Form_a_FunctionSpace_0 TestSpace;
-  typedef Form_a_FunctionSpace_1 TrialSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_FunctionSpace_1 CoefficientSpace_u;
 
   // Coefficients
+  dolfin::CoefficientAssigner u;
 };
 
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new dg0_eps_xx_finite_element_2()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new dg0_eps_xx_dofmap_2()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-typedef CoefficientSpace_u Form_L_FunctionSpace_1;
-
-class Form_L: public dolfin::Form
+class MultiMeshForm_a: public dolfin::MultiMeshForm
 {
 public:
 
   // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 1), u(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
+    dolfin::MultiMeshForm(V0), u(*this, 0)
   {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
-  }
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->u = u;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
-  }
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V0->part(part)));
+      add(a);
+    }
 
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
+    // Build multimesh form
+    build();
 
-    this->u = *u;
+    /// Assign coefficients
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
   }
 
   // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), u(*this, 0)
+  MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
+    dolfin::MultiMeshForm(V0), u(*this, 0)
   {
-    _function_spaces[0] = V0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
-  }
+    // Create and add standard forms
+    std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
+    for (std::size_t part = 0; part < num_parts; part++)
+    {
+      std::shared_ptr<const dolfin::Form> a(new Form_a(V0->part(part)));
+      add(a);
+    }
 
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = V0;
+    // Build multimesh form
+    build();
 
+    /// Assign coefficients
     this->u = u;
 
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    this->u = *u;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new dg0_eps_xx_form_1());
   }
 
   // Destructor
-  ~Form_L()
+  ~MultiMeshForm_a()
   {}
 
   /// Return the number of the coefficient with this name
@@ -4305,19 +3363,21 @@ public:
   }
 
   // Typedefs
-  typedef Form_L_FunctionSpace_0 TestSpace;
-  typedef Form_L_FunctionSpace_1 CoefficientSpace_u;
+  typedef Form_a_FunctionSpace_0 TestSpace;
+  typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
+  typedef Form_a_FunctionSpace_1 CoefficientSpace_u;
 
   // Coefficients
-  dolfin::CoefficientAssigner u;
+  dolfin::MultiMeshCoefficientAssigner u;
 };
 
 // Class typedefs
-typedef Form_a BilinearForm;
-typedef Form_a JacobianForm;
-typedef Form_L LinearForm;
-typedef Form_L ResidualForm;
+typedef Form_a LinearForm;
+typedef MultiMeshForm_a MultiMeshLinearForm;
+typedef Form_a ResidualForm;
+typedef MultiMeshForm_a MultiMeshResidualForm;
 typedef Form_a::TestSpace FunctionSpace;
+typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
 
 }
 
diff --git a/test/unit/la/cpp/forms/ReactionDiffusionAction.ufl b/test/unit/cpp/la/forms/ReactionDiffusionAction.ufl
similarity index 100%
rename from test/unit/la/cpp/forms/ReactionDiffusionAction.ufl
rename to test/unit/cpp/la/forms/ReactionDiffusionAction.ufl
diff --git a/test/unit/la/cpp/forms/compile.log b/test/unit/cpp/la/forms/compile.log
similarity index 64%
rename from test/unit/la/cpp/forms/compile.log
rename to test/unit/cpp/la/forms/compile.log
index 09f64bc..0bd8bfb 100644
--- a/test/unit/la/cpp/forms/compile.log
+++ b/test/unit/cpp/la/forms/compile.log
@@ -1,5 +1,6 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form ReactionDiffusionAction
 
@@ -12,8 +13,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -22,18 +23,26 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 3
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.0376461 seconds.
+Compiler stage 1 finished in 0.0799441 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -45,7 +54,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000584 seconds
+  9 entries computed in 0.0012 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -54,7 +63,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000667 seconds
+  36 entries computed in 0.00134 seconds
   Shape of reference tensor: (3, 2, 3, 2)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 3 dims = [2, 3, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [0, 2, 0], [0, 2, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1], [1, 2, 0], [1, 2, 1]]
@@ -62,87 +71,78 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 3 dims = [2, 3, 2] indices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [0, 2, 0], [0, 2, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1], [1, 2, 0], [1, 2, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00481796 seconds.
+Compiler stage 2 finished in 0.017679 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000141859 seconds.
+Compiler stage 3 finished in 0.000244141 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.0341699 seconds.
+Compiler stage 4 finished in 0.115897 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000468969 seconds.
+Compiler stage 4.1 finished in 0.000643969 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./ReactionDiffusionAction.h.
-Compiler stage 5 finished in 0.000569105 seconds.
+Compiler stage 5 finished in 0.000732899 seconds.
 
-FFC finished in 0.0781419 seconds.
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
+FFC finished in 0.215677 seconds.
+Output written to ./ReactionDiffusionAction.h.
+This is FFC, the FEniCS Form Compiler, version 2016.1.0.
+UFC backend version 2016.1.0, signature 1b14b3cad537cb974523d529928ad9bde02ef657.
+For further information, visit https://bitbucket.org/fenics-project/ffc/.
 
 Compiling form ReactionDiffusion
 
@@ -155,8 +155,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0, v_1)'
   Number of coefficients:    0
   Coefficients:              '[]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -165,9 +165,9 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 2
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
   Geometric dimension:       2
   Number of cell subdomains: 0
@@ -175,8 +175,8 @@ Compiler stage 1: Analyzing form(s)
   Arguments:                 '(v_0)'
   Number of coefficients:    1
   Coefficients:              '[w_0]'
-  Unique elements:           'CG1(?)'
-  Unique sub elements:       'CG1(?)'
+  Unique elements:           'CG1(?), Vector<2 x CG1(?)>'
+  Unique sub elements:       'CG1(?), Vector<2 x CG1(?)>'
   
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -184,18 +184,26 @@ Compiler stage 1: Analyzing form(s)
   Reusing element from cache
   Estimated cost of tensor representation: 1
   representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 2
-  quadrature_degree: auto --> 2
   quadrature_rule:   auto --> default
+  quadrature_degree: auto --> 2
+  quadrature_degree: 2
   
-Compiler stage 1 finished in 0.045191 seconds.
+Compiler stage 1 finished in 0.103298 seconds.
 
 Compiler stage 2: Computing intermediate representation
 -------------------------------------------------------
-  Computing representation of 1 elements
+  Computing representation of 2 elements
+  Reusing element from cache
+  Reusing element from cache
+  Reusing element from cache
   Reusing element from cache
   Reusing element from cache
-  Computing representation of 1 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 2 dofmaps
+  Reusing element from cache
+  Reusing element from cache
+  Computing representation of 1 coordinate mappings
   Reusing element from cache
   Computing representation of integrals
   Computing tensor representation
@@ -207,7 +215,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.000642 seconds
+  9 entries computed in 0.000757 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 0 dims = [] indices = [[]]
@@ -216,7 +224,7 @@ Compiler stage 2: Computing intermediate representation
   External multi index:  rank = 0 dims = [] indices = [[]]
   Precomputing integrals on reference element
   Reusing element from cache
-  36 entries computed in 0.000681 seconds
+  36 entries computed in 0.00088 seconds
   Shape of reference tensor: (3, 3, 2, 2)
   Primary multi index:   rank = 2 dims = [3, 3] indices = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
@@ -224,6 +232,7 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
   External multi index:  rank = 1 dims = [2] indices = [[0], [1]]
   Reusing element from cache
+  Reusing element from cache
   Computing tensor representation
   Extracting monomial form representation from UFL form
   Transforming monomial form to reference element
@@ -231,7 +240,7 @@ Compiler stage 2: Computing intermediate representation
   Reusing element from cache
   Precomputing integrals on reference element
   Reusing element from cache
-  9 entries computed in 0.00167 seconds
+  9 entries computed in 0.00076 seconds
   Shape of reference tensor: (3, 3)
   Primary multi index:   rank = 1 dims = [3] indices = [[0], [1], [2]]
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
@@ -239,82 +248,72 @@ Compiler stage 2: Computing intermediate representation
   Secondary multi index: rank = 1 dims = [3] indices = [[0], [1], [2]]
   External multi index:  rank = 0 dims = [] indices = [[]]
   Reusing element from cache
+  Reusing element from cache
   Computing representation of forms
   
-Compiler stage 2 finished in 0.00873399 seconds.
+Compiler stage 2 finished in 0.0150092 seconds.
 
 Compiler stage 3: Optimizing intermediate representation
 --------------------------------------------------------
   
-Compiler stage 3 finished in 0.000158787 seconds.
+Compiler stage 3 finished in 0.000590086 seconds.
 
 Compiler stage 4: Generating code
 ---------------------------------
-  Generating code for 1 element(s)
+  Generating code for 2 element(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
   Removing unused variable: tmp2
   Removing unused variable: tmp1
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Removing unused variable: tmp2
+  Removing unused variable: tmp1
+  Generating code for 2 dofmap(s)
+  Generating code for 1 coordinate_mapping(s)
   Generating code for integrals
   Generating code for forms
   
-Compiler stage 4 finished in 0.037117 seconds.
+Compiler stage 4 finished in 0.120591 seconds.
 
 Compiler stage 4.1: Generating additional wrapper code
 ------------------------------------------------------
   Generating wrapper code for DOLFIN
   
-Compiler stage 4.1 finished in 0.000626087 seconds.
+Compiler stage 4.1 finished in 0.000885963 seconds.
 
 Compiler stage 5: Formatting code
 ---------------------------------
   
-Output written to ./ReactionDiffusion.h.
-Compiler stage 5 finished in 0.000672817 seconds.
+Compiler stage 5 finished in 0.000840187 seconds.
 
-FFC finished in 0.0928571 seconds.
+FFC finished in 0.241861 seconds.
+Output written to ./ReactionDiffusion.h.
diff --git a/test/unit/cpp/mesh/Mesh.cpp b/test/unit/cpp/mesh/Mesh.cpp
new file mode 100644
index 0000000..6274623
--- /dev/null
+++ b/test/unit/cpp/mesh/Mesh.cpp
@@ -0,0 +1,240 @@
+// Copyright (C) 2007 Anders Logg
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// Modified by Benjamin Kehlet 2012
+//
+// First added:  2007-05-14
+// Last changed: 2012-11-12
+//
+// Unit tests for the mesh library
+
+#include <dolfin.h>
+#include <gtest/gtest.h>
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+TEST(SimpleShapesTest, testUnitSquareMesh)
+{
+  // Create mesh of unit square
+  UnitSquareMesh mesh(5, 7);
+  ASSERT_EQ(mesh.num_vertices(), (std::size_t) 48);
+  ASSERT_EQ(mesh.num_cells(), (std::size_t) 70);
+}
+//-----------------------------------------------------------------------------
+TEST(SimpleShapesTest, testUnitCubeMesh)
+{
+  // Create mesh of unit cube
+  UnitCubeMesh mesh(5, 7, 9);
+  ASSERT_EQ(mesh.num_vertices(), (std::size_t) 480);
+  ASSERT_EQ(mesh.num_cells(), (std::size_t) 1890);
+}
+//-----------------------------------------------------------------------------
+TEST(MeshRefinement, testRefineUnitSquareMesh)
+{
+  // Refine mesh of unit square
+  UnitSquareMesh mesh0(5, 7);
+  Mesh mesh1 = refine(mesh0);
+  ASSERT_EQ(mesh1.num_vertices(), (std::size_t) 165);
+  ASSERT_EQ(mesh1.num_cells(), (std::size_t) 280);
+}
+//-----------------------------------------------------------------------------
+TEST(MeshRefinement, testRefineUnitCubeMesh)
+{
+  // Refine mesh of unit cube
+  UnitCubeMesh mesh0(5, 7, 9);
+  Mesh mesh1 = refine(mesh0);
+  ASSERT_EQ(mesh1.num_vertices(), (std::size_t) 3135);
+  ASSERT_EQ(mesh1.num_cells(), (std::size_t) 15120);
+}
+//-----------------------------------------------------------------------------
+TEST(MeshIterators, testVertexIterators)
+{
+  // Iterate over vertices
+  UnitCubeMesh mesh(5, 5, 5);
+  unsigned int n = 0;
+  for (VertexIterator v(mesh); !v.end(); ++v)
+    n++;
+  ASSERT_EQ(n, mesh.num_vertices());
+}
+//-----------------------------------------------------------------------------
+TEST(MeshIterators, testEdgeIterators)
+{
+  // Iterate over edges
+  UnitCubeMesh mesh(5, 5, 5);
+  unsigned int n = 0;
+  for (EdgeIterator e(mesh); !e.end(); ++e)
+    n++;
+  ASSERT_EQ(n, mesh.num_edges());
+}
+//-----------------------------------------------------------------------------
+TEST(MeshIterators, testFaceIterators)
+{
+  // Iterate over faces
+  UnitCubeMesh mesh(5, 5, 5);
+  unsigned int n = 0;
+  for (FaceIterator f(mesh); !f.end(); ++f)
+    n++;
+  ASSERT_EQ(n, mesh.num_faces());
+}
+//-----------------------------------------------------------------------------
+TEST(MeshIterators, testFacetIterators)
+{
+  // Iterate over facets
+  UnitCubeMesh mesh(5, 5, 5);
+  unsigned int n = 0;
+  for (FacetIterator f(mesh); !f.end(); ++f)
+    n++;
+  ASSERT_EQ(n, mesh.num_facets());
+}
+//-----------------------------------------------------------------------------
+TEST(MeshIterators, testCellIterators)
+{
+  // Iterate over cells
+  UnitCubeMesh mesh(5, 5, 5);
+  unsigned int n = 0;
+  for (CellIterator c(mesh); !c.end(); ++c)
+    n++;
+  ASSERT_EQ(n, mesh.num_cells());
+}
+//-----------------------------------------------------------------------------
+TEST(MeshIterators, testMixedIterators)
+{
+  // Iterate over vertices of cells
+  UnitCubeMesh mesh(5, 5, 5);
+  unsigned int n = 0;
+  for (CellIterator c(mesh); !c.end(); ++c)
+    for (VertexIterator v(*c); !v.end(); ++v)
+      n++;
+  ASSERT_EQ(n, 4*mesh.num_cells());
+}
+//-----------------------------------------------------------------------------
+TEST(BoundaryExtraction, testBoundaryComputation)
+{
+  // Compute boundary of mesh
+  UnitCubeMesh mesh(2, 2, 2);
+  BoundaryMesh boundary(mesh, "exterior");
+  ASSERT_EQ(boundary.num_vertices(), (std::size_t) 26);
+  ASSERT_EQ(boundary.num_cells(), (std::size_t) 48);
+}
+//-----------------------------------------------------------------------------
+TEST(BoundaryExtraction, testBoundaryBoundary)
+{
+  // Compute boundary of boundary
+  //
+  // Note that we can't do
+  //
+  //   BoundaryMesh b0(mesh);
+  //   BoundaryMesh b1(b0);
+  //
+  // since b1 would then be a copy of b0 (copy
+  // constructor in Mesh will be used).
+
+  UnitCubeMesh mesh(2, 2, 2);
+  BoundaryMesh b0(mesh, "exterior");
+  b0.order();
+  BoundaryMesh b1(b0, "exterior");
+  ASSERT_EQ(b1.num_vertices(), (std::size_t) 0);
+  ASSERT_EQ(b1.num_cells(), (std::size_t) 0);
+}
+//-----------------------------------------------------------------------------
+TEST(MeshFunctions, testAssign)
+{
+  /// Assign value of mesh function
+  auto mesh = std::make_shared<UnitSquareMesh>(3, 3);
+  MeshFunction<int> f(mesh, 0);
+  f[3] = 10;
+  Vertex v(*mesh, 3);
+  ASSERT_EQ(f[v], 10);
+}
+//-----------------------------------------------------------------------------
+TEST(InputOutput, testMeshXML2D)
+{
+  // Write and read 2D mesh to/from file
+  UnitSquareMesh mesh_out(3, 3);
+  Mesh mesh_in;
+  File file("unitsquare.xml");
+  file << mesh_out;
+  file >> mesh_in;
+  ASSERT_EQ(mesh_in.num_vertices(), (std::size_t) 16);
+}
+//-----------------------------------------------------------------------------
+TEST(InputOutput, testMeshXML3D)
+{
+  // Write and read 3D mesh to/from file
+  UnitCubeMesh mesh_out(3, 3, 3);
+  Mesh mesh_in;
+  File file("unitcube.xml");
+  file << mesh_out;
+  file >> mesh_in;
+  ASSERT_EQ(mesh_in.num_vertices(), (std::size_t) 64);
+}
+//-----------------------------------------------------------------------------
+TEST(InputOutput, testMeshFunction)
+{
+  // Write and read mesh function to/from file
+  auto mesh = std::make_shared<UnitSquareMesh>(1, 1);
+  MeshFunction<int> f(mesh, 0);
+  f[0] = 2;
+  f[1] = 4;
+  f[2] = 6;
+  f[3] = 8;
+  File file("meshfunction.xml");
+  file << f;
+  MeshFunction<int> g(mesh, 0);
+  file >> g;
+  for (VertexIterator v(*mesh); !v.end(); ++v)
+    ASSERT_EQ(f[*v], g[*v]);
+}
+
+//-----------------------------------------------
+TEST(PyCCInterface, testGetGeometricalDimension)
+{
+  // Get geometrical dimension of mesh
+  UnitSquareMesh mesh(5, 5);
+  ASSERT_EQ(mesh.geometry().dim(), (std::size_t) 2);
+}
+//-----------------------------------------------------------------------------
+TEST(PyCCInterface, testGetCoordinates)
+{
+  // Get coordinates of vertices
+  UnitSquareMesh mesh(5, 5);
+  ASSERT_EQ(mesh.geometry().num_vertices(), (std::size_t) 36);
+}
+//-----------------------------------------------------------------------------
+TEST(PyCCInterface, testGetCells)
+{
+  // Get cells of mesh
+  UnitSquareMesh mesh(5, 5);
+  ASSERT_EQ(mesh.topology().size(2), (std::size_t) 50);
+}
+
+// Test all
+int Mesh_main(int argc, char **argv) {
+    testing::InitGoogleTest(&argc, argv);
+
+    // FIXME: Only the following test works in Parallel
+    // Failed: SimpleShapes; MeshRefinement; BoundaryExtraction
+    // MeshFunctions; InputOutput; PyCCInterface
+    if (dolfin::MPI::size(MPI_COMM_WORLD) != 1)
+    {
+      ::testing::GTEST_FLAG(filter) = "MeshIterators.*";
+    }
+    return RUN_ALL_TESTS();
+
+}
+//-----------------------------------------------------------------------------
diff --git a/test/unit/cpp/mesh/MeshFunction.cpp b/test/unit/cpp/mesh/MeshFunction.cpp
new file mode 100644
index 0000000..e099363
--- /dev/null
+++ b/test/unit/cpp/mesh/MeshFunction.cpp
@@ -0,0 +1,85 @@
+// Copyright (C) 2013 Garth N. Wells
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// First added:  2013-05-30
+// Last changed:
+//
+// Unit tests for MeshFunction
+
+#include <dolfin.h>
+#include <gtest/gtest.h>
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+TEST(MeshFunctions, test_create_from_domains)
+{
+  // Create mesh
+  std::shared_ptr<Mesh> mesh(new UnitSquareMesh(3, 3));
+  dolfin_assert(mesh);
+
+  const std::size_t D = mesh->topology().dim();
+
+  // Test setting all values
+  for (std::size_t d = 0; d <= D; ++d)
+  {
+    // Create MeshDomains object
+    MeshDomains mesh_domains;
+    mesh_domains.init(D);
+
+    mesh->init(d);
+
+    // Build mesh domain
+    std::map<std::size_t, std::size_t>& domain = mesh_domains.markers(d);
+    for (std::size_t i = 0; i < mesh->num_entities(d); ++i)
+      domain.insert(std::make_pair(i, i));
+
+    // Create MeshFunction and test values
+    MeshFunction<std::size_t> mf(mesh, d, mesh_domains);
+    for (std::size_t i = 0; i < mf.size(); ++i)
+      ASSERT_EQ(mf[i], i);
+  }
+
+  // Test setting some values only
+  for (std::size_t d = 0; d <= D; ++d)
+  {
+    // Create MeshDomains object
+    MeshDomains mesh_domains;
+    mesh_domains.init(D);
+
+    mesh->init(d);
+
+    // Build mesh domain
+    std::map<std::size_t, std::size_t>& domain = mesh_domains.markers(d);
+    const std::size_t num_entities = mesh->num_entities(d);
+    for (std::size_t i = num_entities/2; i < num_entities; ++i)
+      domain.insert(std::make_pair(i, i));
+
+    // Create MeshFunction and test values
+    MeshFunction<std::size_t> mf(mesh, d, mesh_domains);
+    for (std::size_t i = 0; i < num_entities/2; ++i)
+      ASSERT_EQ(mf[i], std::numeric_limits<std::size_t>::max());
+    for (std::size_t i = num_entities/2; i < mf.size(); ++i)
+      ASSERT_EQ(mf[i], i);
+  }
+}
+
+// Test all
+int MeshFunction_main(int argc, char **argv) {
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/test/unit/cpp/mesh/MeshValueCollection.cpp b/test/unit/cpp/mesh/MeshValueCollection.cpp
new file mode 100644
index 0000000..eac0477
--- /dev/null
+++ b/test/unit/cpp/mesh/MeshValueCollection.cpp
@@ -0,0 +1,174 @@
+// Copyright (C) 2007 Anders Logg
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// First added:  2007-05-14
+// Last changed: 2012-01-11
+//
+// Unit tests for the mesh library
+
+#include <dolfin.h>
+#include <gtest/gtest.h>
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+TEST(MeshValueCollections, testAssign2DCells)
+{
+  auto mesh = std::make_shared<UnitSquareMesh>(3, 3);
+  const std::size_t ncells = mesh->num_cells();
+  MeshValueCollection<int> f(mesh, 2);
+  bool all_new = true;
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+  {
+    bool this_new;
+    const int value = ncells - cell->index();
+    this_new = f.set_value(cell->index(), value);
+    all_new = all_new && this_new;
+  }
+  MeshValueCollection<int> g(mesh, 2);
+  g = f;
+  ASSERT_EQ(ncells, f.size());
+  ASSERT_EQ(ncells, g.size());
+  ASSERT_TRUE(all_new);
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+  {
+    const int value = ncells - cell->index();
+    ASSERT_EQ(value, g.get_value(cell->index(), 0));
+  }
+}
+//-----------------------------------------------------------------------------
+TEST(MeshValueCollections, testAssign2DFacets)
+{
+  auto mesh = std::make_shared<UnitSquareMesh>(3, 3);
+  mesh->init(2,1);
+  const std::size_t ncells = mesh->num_cells();
+  MeshValueCollection<int> f(mesh, 1);
+  bool all_new = true;
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+  {
+    const int value = ncells - cell->index();
+    for (std::size_t i = 0; i < cell->num_entities(1); ++i)
+    {
+      bool this_new;
+      this_new = f.set_value(cell->index(), i, value + i);
+      all_new = all_new && this_new;
+    }
+  }
+  MeshValueCollection<int> g(mesh, 1);
+  g = f;
+  ASSERT_EQ(ncells*3, f.size());
+  ASSERT_EQ(ncells*3, g.size());
+  ASSERT_TRUE(all_new);
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+  {
+    for (std::size_t i = 0; i < cell->num_entities(1); ++i)
+    {
+      const int value = ncells - cell->index() + i;
+      ASSERT_EQ(value, g.get_value(cell->index(), i));
+    }
+  }
+}
+//-----------------------------------------------------------------------------
+TEST(MeshValueCollections, testAssign2DVertices)
+{
+  auto mesh = std::make_shared<UnitSquareMesh>(3, 3);
+  mesh->init(2, 0);
+  const std::size_t ncells = mesh->num_cells();
+  MeshValueCollection<int> f(mesh, 0);
+  bool all_new = true;
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+  {
+    const int value = ncells - cell->index();
+    for (std::size_t i = 0; i < cell->num_entities(0); ++i)
+    {
+      bool this_new;
+      this_new = f.set_value(cell->index(), i, value+i);
+      all_new = all_new && this_new;
+    }
+  }
+  MeshValueCollection<int> g(mesh, 0);
+  g = f;
+  ASSERT_EQ(ncells*3, f.size());
+  ASSERT_EQ(ncells*3, g.size());
+  ASSERT_TRUE(all_new);
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+  {
+    for (std::size_t i = 0; i < cell->num_entities(0); ++i)
+    {
+      const int value = ncells - cell->index() + i;
+      ASSERT_EQ(value, g.get_value(cell->index(), i));
+    }
+  }
+}
+//-----------------------------------------------------------------------------
+TEST(MeshValueCollections, testMeshFunctionAssign2DCells)
+{
+  auto mesh = std::make_shared<UnitSquareMesh>(3, 3);
+  const std::size_t ncells = mesh->num_cells();
+  MeshFunction<int> f(mesh, 2, 0);
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+    f[cell->index()] = ncells - cell->index();
+  MeshValueCollection<int> g(mesh, 2);
+  g = f;
+  ASSERT_EQ(ncells, f.size());
+  ASSERT_EQ(ncells, g.size());
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+  {
+    const int value = ncells - cell->index();
+    ASSERT_EQ(value, g.get_value(cell->index(), 0));
+  }
+}
+//-----------------------------------------------------------------------------
+TEST(MeshValueCollections, testMeshFunctionAssign2DFacets)
+{
+  auto mesh = std::make_shared<UnitSquareMesh>(3, 3);
+  mesh->init(1);
+  MeshFunction<int> f(mesh, 1, 25);
+  MeshValueCollection<int> g(mesh, 1);
+  g = f;
+  ASSERT_EQ(mesh->num_facets(), f.size());
+  ASSERT_EQ(mesh->num_cells()*3, g.size());
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+  {
+    for (std::size_t i = 0; i < cell->num_entities(1); ++i)
+      ASSERT_EQ(25, g.get_value(cell->index(), i));
+  }
+}
+//-----------------------------------------------------------------------------
+TEST(MeshValueCollections, testMeshFunctionAssign2DVertices)
+{
+  auto mesh = std::make_shared<UnitSquareMesh>(3, 3);
+  mesh->init(0);
+  MeshFunction<int> f(mesh, 0, 25);
+  MeshValueCollection<int> g(mesh, 0);
+  g = f;
+  ASSERT_EQ(mesh->num_vertices(), f.size());
+  ASSERT_EQ(mesh->num_cells()*3, g.size());
+  for (CellIterator cell(*mesh); !cell.end(); ++cell)
+  {
+    for (std::size_t i = 0; i < cell->num_entities(0); ++i)
+      ASSERT_EQ(25, g.get_value(cell->index(), i));
+  }
+}
+
+
+// Test all
+int MeshValueCollection_main(int argc, char **argv) {
+    testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
+
diff --git a/test/unit/cpp/multimesh/MultiMesh.cpp b/test/unit/cpp/multimesh/MultiMesh.cpp
new file mode 100644
index 0000000..99a46d7
--- /dev/null
+++ b/test/unit/cpp/multimesh/MultiMesh.cpp
@@ -0,0 +1,307 @@
+// Copyright (C) 2014 August Johansson and Anders Logg
+//
+// This file is part of DOLFIN.
+//
+// DOLFIN is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// DOLFIN is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+//
+// First added:  2014-03-10
+// Last changed: 2015-06-04
+//
+// Unit tests for MultiMesh
+
+#include <dolfin.h>
+#include <dolfin/geometry/SimplexQuadrature.h>
+#include <gtest/gtest.h>
+
+using namespace dolfin;
+
+// This test was commented out in the original file
+// TEST(MultiMeshes, test_multiple_meshes_quadrature) {
+//     set_log_level(DBG);
+
+//     // Create multimesh from three triangle meshes of the unit square
+
+//     // Many meshes, but not more than three overlap => this works
+//     UnitCubeMesh mesh_0(11, 12, 13);
+//     BoxMesh mesh_1(Point(0.1, 0.1, 0.1),    Point(0.9, 0.9, 0.9),    13, 11, 12);
+//     BoxMesh mesh_2(Point(0.2, 0.2, 0.2),    Point(0.95, 0.95, 0.8),  11, 13, 11);
+//     BoxMesh mesh_3(Point(0.94, 0.01, 0.01), Point(0.98, 0.99, 0.99), 1, 11, 11);
+//     BoxMesh mesh_4(Point(0.01, 0.01, 0.01), Point(0.02, 0.02, 0.02), 1, 1, 1);
+
+//     // // Completely nested 2D: can't do no more than three meshes
+//     // UnitSquareMesh mesh_0(1, 1);
+//     // RectangleMesh mesh_1(Point(0.1, 0.1), Point(0.9, 0.9, 1, 1);
+//     // RectangleMesh mesh_2(Point(0.2, 0.2), Point(0.8, 0.8, 1, 1);
+//     // RectangleMesh mesh_3(Point(0.3, 0.3), Point(0.7, 0.7, 1, 1);
+//     // RectangleMesh mesh_4(Point(0.4, 0.4), Point(0.6, 0.6, 1, 1);
+
+//     // // Completely nested 3D: can't do no more than three meshes
+//     // UnitCubeMesh mesh_0(2, 3, 4);
+//     // BoxMesh mesh_1(Point(0.1, 0.1, 0.1),    Point(0.9, 0.9, 0.9),    4, 3, 2);
+//     // BoxMesh mesh_2(Point(0.2, 0.2, 0.2),    Point(0.8, 0.8, 0.8),    3, 4, 3);
+//     // BoxMesh mesh_3(Point(0.8, 0.01, 0.01),  Point(0.9, 0.99, 0.99),  4, 2, 3);
+//     // BoxMesh mesh_4(Point(0.01, 0.01, 0.01), Point(0.02, 0.02, 0.02), 1, 1, 1);
+
+//     // Build the multimesh
+//     MultiMesh multimesh;
+//     multimesh.add(mesh_0);
+//     multimesh.add(mesh_1);
+//     multimesh.add(mesh_2);
+//     multimesh.add(mesh_3);
+//     multimesh.add(mesh_4);
+//     multimesh.build();
+
+//     // Exact volume is known
+//     const double exact_volume = 1;
+//     double volume = 0;
+
+//     // Sum contribution from all parts
+//     std::cout << "Sum contributions\n";
+//     for (std::size_t part = 0; part < multimesh.num_parts(); part++)
+//     {
+//       std::cout << "% part " << part;
+//       double part_volume = 0;
+
+//       // Uncut cell volume given by function volume
+//       const auto uncut_cells = multimesh.uncut_cells(part);
+//       for (auto it = uncut_cells.begin(); it != uncut_cells.end(); ++it)
+//       {
+//         const Cell cell(*multimesh.part(part), *it);
+//         volume += cell.volume();
+//         part_volume += cell.volume();
+//       }
+
+//       std::cout << "\t uncut volume "<< part_volume<<' ';
+
+//       // Cut cell volume given by quadrature rule
+//       const auto& cut_cells = multimesh.cut_cells(part);
+//       for (auto it = cut_cells.begin(); it != cut_cells.end(); ++it)
+//       {
+//         const auto& qr = multimesh.quadrature_rule_cut_cell(part, *it);
+//         for (std::size_t i = 0; i < qr.second.size(); ++i)
+//         {
+//           volume += qr.second[i];
+//           part_volume += qr.second[i];
+//         }
+//       }
+//       std::cout << "\ttotal volume " << part_volume << std::endl;
+//     }
+
+//     std::cout<<std::setprecision(13) << "exact volume " << exact_volume<<'\n'
+//               << "volume " << volume<<std::endl;
+//     ASSERT_NEAR(exact_volume, volume, DOLFIN_EPS_LARGE);
+// }
+
+//-----------------------------------------------------------------------------
+TEST(MultiMeshes, test_multiple_meshes_interface_quadrature)
+{
+  // // These three meshes are ok
+  // UnitSquareMesh mesh_0(1, 1);
+  // RectangleMesh mesh_1(Point(0.1, 0.1), Point(0.9, 0.9), 1, 1);
+  // RectangleMesh mesh_2(Point(0.2, 0.2), Point(0.8, 0.8), 1, 1);
+  // double exact_volume = 4*(0.9-0.1); // mesh0 and mesh1
+  // exact_volume += 4*(0.8-0.2); // mesh1 and mesh2
+  
+  // UnitCubeMesh mesh_0(1, 2, 3);
+  // BoxMesh mesh_1(Point(0.1, 0.1, 0.1),    Point(0.9, 0.9, 0.9),  2,3,4); //2, 3, 4);
+  // BoxMesh mesh_2(Point(-0.1, -0.1, -0.1), Point(0.7, 0.7, 0.7),  4, 3, 2);
+  // BoxMesh mesh_3(Point(0.51, 0.51, 0.51), Point( 0.7, 0.7, 0.7), 1, 1, 1); //4, 3, 2);
+  // BoxMesh mesh_4(Point(0.3, 0.3, 0.3),    Point(0.7, 0.7, 0.7),  1, 1, 1);
+  // double exact_volume = 0.8*0.8*6; // for mesh_0 and mesh_1
+  // exact_volume += 0.4*0.4*6; // for mesh_1 and mesh_4
+  
+  auto mesh_0 = std::make_shared<UnitCubeMesh>(1, 1, 1);
+  auto mesh_1 = std::make_shared<BoxMesh>(Point(0.1, 0.1, 0.1), Point(0.9, 0.9, 0.9), 1, 1, 1);
+  auto mesh_2 = std::make_shared<BoxMesh>(Point(0.2, 0.2, 0.2), Point(0.8, 0.8, 0.8), 1, 1, 1);
+  // BoxMesh mesh_3(Point(0.51, 0.51, 0.51), Point(0.7, 0.7, 0.7), 1, 1, 1); //4, 3, 2);
+  // BoxMesh mesh_4(Point(0.3, 0.3, 0.3),    Point(0.7, 0.7, 0.7), 1, 1, 1);
+  double exact_volume = (0.9 - 0.1)*(0.9 - 0.1)*6; // for mesh_0 and mesh_1
+  exact_volume += (0.8 - 0.2)*(0.8 - 0.2)*6; // mesh_1 and mesh_2
+  
+  // UnitCubeMesh mesh_0(1, 1, 1);
+  // MeshEditor editor;
+  // Mesh mesh_1;
+  // editor.open(mesh_1, 3, 3);
+  // editor.init_vertices(4);
+  // editor.init_cells(1);
+  // editor.add_vertex(0, Point(0.7, 0.1, -0.1));
+  // editor.add_vertex(1, Point(0.7, 0.3, -0.1));
+  // editor.add_vertex(2, Point(0.5, 0.1, -0.1));
+  // editor.add_vertex(3, Point(0.7, 0.1, 0.1));
+  // editor.add_cell(0, 0,1,2,3);
+  // editor.close();
+  
+  // Mesh mesh_2;
+  // editor.open(mesh_2, 3,3);
+  // editor.init_vertices(4);
+  // editor.init_cells(1);
+  // editor.add_vertex(0, Point(0.7, 0.1, -0.2));
+  // editor.add_vertex(1, Point(0.7, 0.3, -0.2));
+  // editor.add_vertex(2, Point(0.5, 0.1, -0.2));
+  // editor.add_vertex(3, Point(0.7, 0.1, 0.05));
+  // editor.add_cell(0, 0,1,2,3);
+  // editor.close();
+  
+  //double exact_volume = 0.8*0.8*6; // for mesh_0 and mesh_1
+  //exact_volume += 0.4*0.4*6; // for mesh_1 and mesh_4
+  
+  // MeshEditor editor;
+  // Mesh mesh_0;
+  // editor.open(mesh_0, 2, 2);
+  // editor.init_vertices(3);
+  // editor.init_cells(1);
+  // editor.add_vertex(0, Point(0.,0.));
+  // editor.add_vertex(1, Point(2.,0.));
+  // editor.add_vertex(2, Point(1.,2.));
+  // editor.add_cell(0, 0,1,2);
+  // editor.close();
+  
+  // Mesh mesh_1;
+  // editor.open(mesh_1, 2, 2);
+  // editor.init_vertices(3);
+  // editor.init_cells(1);
+  // editor.add_vertex(0, Point(0.,-0.5));
+  // editor.add_vertex(1, Point(2.,-0.5));
+  // editor.add_vertex(2, Point(1.,1.5));
+  // editor.add_cell(0, 0,1,2);
+  // editor.close();
+  
+  // Mesh mesh_2;
+  // editor.open(mesh_2, 2, 2);
+  // editor.init_vertices(3);
+  // editor.init_cells(1);
+  // editor.add_vertex(0, Point(0.,-1.));
+  // editor.add_vertex(1, Point(2.,-1.));
+  // editor.add_vertex(2, Point(1.,1.));
+  // editor.add_cell(0, 0,1,2);
+  // editor.close();
+  
+  // double exact_volume = 2*std::sqrt(0.75*0.75 + 1.5*1.5); // mesh_0 and mesh_1
+  // exact_volume += 2*std::sqrt(0.5*0.5 + 1*1); // mesh_0 and mesh_2
+  // exact_volume += 2*std::sqrt(0.75*0.75 + 1.5*1.5); // mesh_1and mesh_2
+  // double volume = 0;
+  
+  // // These three meshes are ok.
+  // MeshEditor editor;
+  // Mesh mesh_0;
+  // editor.open(mesh_0, 2, 2);
+  // editor.init_vertices(3);
+  // editor.init_cells(1);
+  // editor.add_vertex(0, Point(0.,0.));
+  // editor.add_vertex(1, Point(2.,0.));
+  // editor.add_vertex(2, Point(1.,2.));
+  // editor.add_cell(0, 0,1,2);
+  // editor.close();
+  
+  // Mesh mesh_1;
+  // editor.open(mesh_1, 2, 2);
+  // editor.init_vertices(3);
+  // editor.init_cells(1);
+  // editor.add_vertex(0, Point(1.5,-2.));
+  // editor.add_vertex(1, Point(4.,0.));
+  // editor.add_vertex(2, Point(1.5,2));
+  // editor.add_cell(0, 0,1,2);
+  // editor.close();
+  
+  // Mesh mesh_2;
+  // editor.open(mesh_2, 2, 2);
+  // editor.init_vertices(3);
+  // editor.init_cells(1);
+  // editor.add_vertex(0, Point(3.,0.5));
+  // editor.add_vertex(1, Point(-1.,0.5));
+  // editor.add_vertex(2, Point(1.,-1.5));
+  // editor.add_cell(0, 0,1,2);
+  // editor.close();
+  
+  // double exact_volume = (1.5-0.25) + (1-0.5); // mesh_0, mesh_1 and mesh_2
+  // exact_volume += (3-1.5) + std::sqrt(1.5*1.5 + 1.5*1.5); // mesh_1 and mesh_2
+  
+  File("mesh_0.xml") << *mesh_0;
+  File("mesh_1.xml") << *mesh_1;
+  File("mesh_2.xml") << *mesh_2;
+
+  // Build the multimesh
+  MultiMesh multimesh;
+  multimesh.add(mesh_0);
+  multimesh.add(mesh_1);
+  multimesh.add(mesh_2);
+  //multimesh.add(mesh_3);
+  //multimesh.add(mesh_4);
+  multimesh.build();
+
+  // Sum contribution from all parts
+  std::cout << "\n\n Sum up\n\n";
+  double volume = 0;
+  for (std::size_t part = 0; part < multimesh.num_parts(); part++)
+  {
+    std::cout << "% part " << part << '\n';
+    double part_volume = 0;
+    
+    const auto& quadrature_rules = multimesh.quadrature_rule_interface(part);
+    
+    // Get collision map
+    const auto& cmap = multimesh.collision_map_cut_cells(part);
+    for (auto it = cmap.begin(); it != cmap.end(); ++it)
+    {
+      const unsigned int cut_cell_index = it->first;
+      
+      // Iterate over cutting cells
+      const auto& cutting_cells = it->second;
+      for (auto jt = cutting_cells.begin(); jt != cutting_cells.end(); jt++)
+      {
+        //const std::size_t cutting_part = jt->first;
+        //const std::size_t cutting_cell_index = jt->second;
+        
+        // Get quadrature rule for interface part defined by
+        // intersection of the cut and cutting cells
+        const std::size_t k = jt - cutting_cells.begin();
+        dolfin_assert(k < quadrature_rules.at(cut_cell_index).size());
+        const auto& qr = quadrature_rules.at(cut_cell_index)[k];
+        
+        for (std::size_t j = 0; j < qr.second.size(); ++j)
+        {
+          volume += qr.second[j];
+          part_volume += qr.second[j];
+        }
+        
+      }
+    }
+    
+    std::cout<<"part volume " << part_volume<<std::endl;
+  }
+  
+  std::cout << "exact volume " << exact_volume<<'\n'
+            << "volume " << volume<<std::endl;
+  ASSERT_NEAR(exact_volume, volume, 10*DOLFIN_EPS_LARGE);
+}
+//-----------------------------------------------------------------------------
+TEST(MultiMeshes, test_assembly)
+{
+ // FIXME: Reimplement when functionals are in place again
+}
+
+// Test all
+int MultiMesh_main(int argc, char **argv) {
+  // Test not working in parallel
+  if (dolfin::MPI::size(MPI_COMM_WORLD) > 1)
+  {
+    info("Skipping unit test in parallel.");
+    info("OK");
+    return 0;
+  }
+
+  testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}
+//-----------------------------------------------------------------------------
diff --git a/test/unit/parameter/cpp/Parameters.cpp b/test/unit/cpp/parameter/Parameters.cpp
similarity index 70%
rename from test/unit/parameter/cpp/Parameters.cpp
rename to test/unit/cpp/parameter/Parameters.cpp
index b86bcf1..dde817c 100644
--- a/test/unit/parameter/cpp/Parameters.cpp
+++ b/test/unit/cpp/parameter/Parameters.cpp
@@ -21,26 +21,12 @@
 // Unit tests for the parameter library
 
 #include <dolfin.h>
-#include <dolfin/common/unittest.h>
+#include <gtest/gtest.h>
 
 using namespace dolfin;
 
-class InputOutput : public CppUnit::TestFixture
+TEST(InputOutput, test_simple)
 {
-  CPPUNIT_TEST_SUITE(InputOutput);
-  CPPUNIT_TEST(test_simple);
-  CPPUNIT_TEST(test_nested);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void test_simple()
-  {
-    // Not working in parallel, even if only process 0 writes and
-    // others wait for a barrier. Skipping this in parallel for now.
-    if (dolfin::MPI::size(MPI_COMM_WORLD) > 1)
-      return;
-
     // Create some parameters
     Parameters p0("test");
     p0.add("filename", "foo.txt");
@@ -64,19 +50,14 @@ public:
     bool monitor_convergence(p1["monitor_convergence"]);
 
     // Check values
-    CPPUNIT_ASSERT(filename == "foo.txt");
-    CPPUNIT_ASSERT(maxiter == 100);
-    CPPUNIT_ASSERT(tolerance == 0.001);
-    CPPUNIT_ASSERT(monitor_convergence == true);
-  }
-
-  void test_nested()
-  {
-    // Not working in parallel, even if only process 0 writes and
-    // others wait for a barrier. Skipping this in parallel for now.
-    if (dolfin::MPI::size(MPI_COMM_WORLD) > 1)
-      return;
+    ASSERT_EQ(filename, "foo.txt");
+    ASSERT_EQ(maxiter, (std::size_t) 100);
+    ASSERT_DOUBLE_EQ(tolerance, 0.001);
+    ASSERT_TRUE(monitor_convergence);
+}
 
+TEST(InputOutput, test_nested)
+{
     // Create some nested parameters
     Parameters p0("test");
     Parameters p00("sub0");
@@ -107,18 +88,25 @@ public:
     bool monitor_convergence(p1("sub0")["monitor_convergence"]);
 
     // Check values
-    CPPUNIT_ASSERT(foo == "bar");
-    CPPUNIT_ASSERT(filename == "foo.txt");
-    CPPUNIT_ASSERT(maxiter == 100);
-    CPPUNIT_ASSERT(tolerance == 0.001);
-    CPPUNIT_ASSERT(monitor_convergence == true);
-  }
-
-};
+    ASSERT_EQ(foo, "bar");
+    ASSERT_EQ(filename, "foo.txt");
+    ASSERT_EQ(maxiter, (std::size_t) 100);
+    ASSERT_DOUBLE_EQ(tolerance, 0.001);
+    ASSERT_TRUE(monitor_convergence);
+}
 
+// Test all
+int Parameter_main(int argc, char **argv) {
 
-int main()
-{
-  CPPUNIT_TEST_SUITE_REGISTRATION(InputOutput);
-  DOLFIN_TEST;
+    // Not working in parallel, even if only process 0 writes and
+    // others wait for a barrier. Skipping this in parallel for now.
+      if (dolfin::MPI::size(MPI_COMM_WORLD) > 1)
+      {
+        info("Skipping unit test in parallel.");
+        info("OK");
+        return 0;
+      }
+
+  testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
 }
diff --git a/test/unit/io/cpp/test_cpp_io.py b/test/unit/cpp/test_cpp_unit.py
similarity index 71%
rename from test/unit/io/cpp/test_cpp_io.py
rename to test/unit/cpp/test_cpp_unit.py
index 1184a83..63cbf69 100755
--- a/test/unit/io/cpp/test_cpp_io.py
+++ b/test/unit/cpp/test_cpp_unit.py
@@ -1,3 +1,3 @@
 #!/usr/bin/env py.test
 from dolfin_utils.test import cpp_tester
-test_cpp_io = cpp_tester
+test_cpp = cpp_tests
diff --git a/test/unit/function/cpp/CMakeLists.txt b/test/unit/function/cpp/CMakeLists.txt
deleted file mode 100644
index b079013..0000000
--- a/test/unit/function/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# This file is automatically generated by running
-#
-#     cmake/scripts/generate-cmakefiles
-#
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-set(PROJECT_NAME test_function)
-project(${PROJECT_NAME})
-
-# Set verbose output while testing CMake
-#set(CMAKE_VERBOSE_MAKEFILE 1)
-
-# Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
-
-# Get DOLFIN configuration data (DOLFINConfig.cmake must be in
-# DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
-endif()
-
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
-# Executable
-add_executable(test_Expression Expression.cpp)
-
-# Target libraries
-target_link_libraries(test_Expression ${DOLFIN_LIBRARIES})
diff --git a/test/unit/function/cpp/Expression.cpp b/test/unit/function/cpp/Expression.cpp
deleted file mode 100644
index 3a4aad5..0000000
--- a/test/unit/function/cpp/Expression.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (C) 2007 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Garth N. Wells, 2008.
-// Modified by Johannes Ring, 2009.
-// Modified by Benjamin Kehlet 2012
-//
-// First added:  2007-05-24
-// Last changed: 2014-08-12
-//
-// Unit tests for the function library
-
-#include <dolfin.h>
-#include <dolfin/common/unittest.h>
-#include "Projection.h"
-
-using namespace dolfin;
-
-class Eval : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(Eval);
-  CPPUNIT_TEST(testArbitraryEval);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void testArbitraryEval()
-  {
-    class F0 : public Expression
-    {
-    public:
-
-      F0() {}
-
-      void eval(Array<double>& values, const Array<double>& x) const
-      {
-        values[0] = sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]);
-      }
-    };
-
-    class F1 : public Expression
-    {
-    public:
-
-      F1() {}
-
-      void eval(Array<double>& values, const Array<double>& x) const
-      {
-        values[0] = 1.0 + 3.0*x[0] + 4.0*x[1] + 0.5*x[2];
-      }
-    };
-
-    UnitCubeMesh mesh(8, 8, 8);
-
-    Array<double> x(3);
-    x[0] = 0.31; x[1] = 0.32; x[2] = 0.33;
-
-    Array<double> u0(1);
-    Array<double> u1(1);
-
-    // User-defined functions (one from finite element space, one not)
-    F0 f0;
-    F1 f1;
-
-    // Test evaluation of a user-defined function
-    f0.eval(u0, x);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(u0[0],
-                                 sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]),
-                                 DOLFIN_EPS);
-
-    if (dolfin::MPI::size(mesh.mpi_comm()) == 1)
-    {
-      // Test evaluation of a discrete function
-      Projection::FunctionSpace V(mesh);
-      Projection::BilinearForm a(V, V);
-      Projection::LinearForm L(V);
-      L.f = f1;
-      Function g(V);
-      solve(a == L, g);
-
-      const double tol = 1.0e-6;
-      f1.eval(u0, x);
-      g.eval(u1, x);
-      CPPUNIT_ASSERT(std::abs(u0[0]-u1[0]) < tol);
-    }
-  }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(Eval);
-
-int main()
-{
-  DOLFIN_TEST;
-}
diff --git a/test/unit/function/cpp/Projection.h b/test/unit/function/cpp/Projection.h
deleted file mode 100644
index fafdf94..0000000
--- a/test/unit/function/cpp/Projection.h
+++ /dev/null
@@ -1,4488 +0,0 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
-//
-// This code was generated with the option '-l dolfin' and
-// contains DOLFIN-specific wrappers that depend on DOLFIN.
-// 
-// This code was generated with the following parameters:
-// 
-//   convert_exceptions_to_warnings: False
-//   cpp_optimize:                   True
-//   cpp_optimize_flags:             '-O2'
-//   epsilon:                        1e-14
-//   error_control:                  False
-//   form_postfix:                   True
-//   format:                         'dolfin'
-//   no_ferari:                      True
-//   optimize:                       True
-//   precision:                      15
-//   quadrature_degree:              'auto'
-//   quadrature_rule:                'auto'
-//   representation:                 'auto'
-//   restrict_keyword:               ''
-//   split:                          False
-
-#ifndef __PROJECTION_H
-#define __PROJECTION_H
-
-#include <cmath>
-#include <stdexcept>
-#include <fstream>
-#include <ufc.h>
-
-/// This class defines the interface for a finite element.
-
-class projection_finite_element_0: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  projection_finite_element_0() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~projection_finite_element_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::tetrahedron;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 10;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[9]  + vertex_coordinates[6] + vertex_coordinates[3]  - vertex_coordinates[0];
-    const double C1 = vertex_coordinates[10] + vertex_coordinates[7] + vertex_coordinates[4]  - vertex_coordinates[1];
-    const double C2 = vertex_coordinates[11] + vertex_coordinates[8] + vertex_coordinates[5]  - vertex_coordinates[2];
-    
-    // Compute subdeterminants
-    const double d_00 = J[4]*J[8] - J[5]*J[7];
-    const double d_01 = J[5]*J[6] - J[3]*J[8];
-    const double d_02 = J[3]*J[7] - J[4]*J[6];
-    const double d_10 = J[2]*J[7] - J[1]*J[8];
-    const double d_11 = J[0]*J[8] - J[2]*J[6];
-    const double d_12 = J[1]*J[6] - J[0]*J[7];
-    const double d_20 = J[1]*J[5] - J[2]*J[4];
-    const double d_21 = J[2]*J[3] - J[0]*J[5];
-    const double d_22 = J[0]*J[4] - J[1]*J[3];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (d_00*(2.0*x[0] - C0) + d_10*(2.0*x[1] - C1) + d_20*(2.0*x[2] - C2)) / detJ;
-    double Y = (d_01*(2.0*x[0] - C0) + d_11*(2.0*x[1] - C1) + d_21*(2.0*x[2] - C2)) / detJ;
-    double Z = (d_02*(2.0*x[0] - C0) + d_12*(2.0*x[1] - C1) + d_22*(2.0*x[2] - C2)) / detJ;
-    
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[9][2];
-    for (unsigned int row = 0; row < 9; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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 > 2)
-            combinations[row][col] = 0;
-          else
-          {
-            combinations[row][col] += 1;
-            break;
-          }
-        }
-      }
-    }
-    
-    // Compute inverse of Jacobian
-    const double Jinv[3][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}, {K[6], K[7], K[8]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[9][9];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, -0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, 0.050395263067897, 0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189625, 0.0608580619450185, -0.0351364184463153, -0.0248451997499977, 0.0650600048632355, -0.050395263067897, -0.0411475599898912, 0.0290957186981323, 0.0237565548366599, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0702728368926307, -0.0248451997499977, 0.0, 0.0, 0.0, 0.0872871560943969, -0.0475131096733199, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {-0.0577350269189626, 0.0, 0.0, 0.074535599249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.100790526135794};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, 0.140545673785261, 0.0993807989999907, 0.0, 0.0, 0.0, 0.0, 0.1187827741833, -0.0671936840905293};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, -0.0702728368926307, 0.0993807989999907, 0.0, 0.0, 0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.121716123890037, 0.0702728368926307, -0.0993807989999906, 0.0, 0.100790526135794, -0.0205737799949456, -0.087287156094397, -0.01187827741833, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, -0.0702728368926306, 0.0993807989999906, 0.0, 0.0, -0.102868899974728, 0.0, -0.0593913870916499, -0.0671936840905293};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, -0.121716123890037, 0.0702728368926306, -0.0993807989999906, 0.0, -0.100790526135794, 0.0205737799949456, -0.0872871560943969, -0.01187827741833, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = 0.5*(2.0 + Y + Z + 2.0*X);
-      double tmp1 = 0.25*(Y + Z)*(Y + Z);
-      double tmp2 = 0.5*(1.0 + Z + 2.0*Y);
-      double tmp3 = 0.5*(1.0 - Z);
-      double tmp4 = tmp3*tmp3;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[4] = 1.5*tmp0*basisvalues[1] - 0.5*tmp1*basisvalues[0];
-      basisvalues[2] = 0.5*(2.0 + 3.0*Y + Z)*basisvalues[0];
-      basisvalues[5] = (0.5*(2.0 + 3.0*Y + Z) + 1.0*(1.0 + Y))*basisvalues[1];
-      basisvalues[7] = (1.66666666666667*tmp2 + 0.111111111111111*tmp3)*basisvalues[2] - 0.555555555555556*tmp4*basisvalues[0];
-      basisvalues[3] = (2.0*Z + 1.0)*basisvalues[0];
-      basisvalues[8] = (3.0*Z + 2.0)*basisvalues[2];
-      basisvalues[6] = (3.0*Z + 2.0)*basisvalues[1];
-      basisvalues[9] = basisvalues[3]*(0.3125 + 1.875*Z) - 0.5625*basisvalues[0];
-      basisvalues[0] *= std::sqrt(0.75);
-      basisvalues[3] *= std::sqrt(1.25);
-      basisvalues[9] *= std::sqrt(1.75);
-      basisvalues[2] *= std::sqrt(2.5);
-      basisvalues[8] *= std::sqrt(3.5);
-      basisvalues[7] *= std::sqrt(5.25);
-      basisvalues[1] *= std::sqrt(7.5);
-      basisvalues[6] *= std::sqrt(10.5);
-      basisvalues[5] *= std::sqrt(15.75);
-      basisvalues[4] *= std::sqrt(26.25);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.23094010767585, 0.0, -0.140545673785261, -0.0993807989999906, -0.130120009726471, 0.0, 0.0, 0.0290957186981323, 0.02375655483666, 0.0167984210226323};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {6.32455532033676, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 11.2249721603218, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.58257569495586, 0.0, 8.36660026534076, -1.18321595661993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.74165738677395, 0.0, 0.0, 8.69482604771367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.47722557505166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747796, 7.24568837309473, 4.18330013267038, -0.591607978309969, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338698, 0.0, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.64575131106462, 0.0, 9.66091783079296, 0.683130051063982, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.24037034920394, 0.0, 0.0, 7.52994023880668, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats2[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.16227766016838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.82574185835055, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.16397779494322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.29128784747792, 1.44913767461894, 4.18330013267038, -0.591607978309961, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.87082869338701, 7.09929573971955, 0.0, 4.34741302385684, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.32287565553231, 0.0, 3.86436713231719, -0.34156502553199, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.08012344973463, 0.0, 7.09929573971954, 2.50998007960221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-3.81881307912991, 0.0, 0.0, 8.87411967464943, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[9];
-      for (unsigned int r = 0; r < 9; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 2)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats2[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 3;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[9];
-    for (unsigned int r = 0; r < 9; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      y[2] = vertex_coordinates[2];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[3];
-      y[1] = vertex_coordinates[4];
-      y[2] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[6];
-      y[1] = vertex_coordinates[7];
-      y[2] = vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = vertex_coordinates[9];
-      y[1] = vertex_coordinates[10];
-      y[2] = vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-      y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[3];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    y[2] = vertex_coordinates[2];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[3];
-    y[1] = vertex_coordinates[4];
-    y[2] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[6];
-    y[1] = vertex_coordinates[7];
-    y[2] = vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = vertex_coordinates[9];
-    y[1] = vertex_coordinates[10];
-    y[2] = vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-    vertex_values[3] = dof_values[3];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new projection_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class projection_dofmap_0: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  projection_dofmap_0() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~projection_dofmap_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3)), 2, None)";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return true;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    case 3:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0] + num_global_entities[1];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 10;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 6;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 1;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    case 3:
-      {
-        return 0;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    dofs[3] = offset + c.entity_indices[0][3];
-    offset += num_global_entities[0];
-    dofs[4] = offset + c.entity_indices[1][0];
-    dofs[5] = offset + c.entity_indices[1][1];
-    dofs[6] = offset + c.entity_indices[1][2];
-    dofs[7] = offset + c.entity_indices[1][3];
-    dofs[8] = offset + c.entity_indices[1][4];
-    dofs[9] = offset + c.entity_indices[1][5];
-    offset += num_global_entities[1];
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 5;
-      dofs[5] = 6;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 7;
-      dofs[5] = 8;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 3;
-      dofs[3] = 5;
-      dofs[4] = 7;
-      dofs[5] = 9;
-        break;
-      }
-    case 3:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 2;
-      dofs[3] = 6;
-      dofs[4] = 8;
-      dofs[5] = 9;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 3)
-    {
-    throw std::runtime_error("d is larger than dimension (3)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 3)
-      {
-      throw std::runtime_error("i is larger than number of entities (3)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        if (i > 5)
-      {
-      throw std::runtime_error("i is larger than number of entities (5)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 6;
-          break;
-        }
-      case 3:
-        {
-          dofs[0] = 7;
-          break;
-        }
-      case 4:
-        {
-          dofs[0] = 8;
-          break;
-        }
-      case 5:
-        {
-          dofs[0] = 9;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    case 3:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = vertex_coordinates[6];
-    dof_coordinates[7] = vertex_coordinates[7];
-    dof_coordinates[8] = vertex_coordinates[8];
-    dof_coordinates[9] = vertex_coordinates[9];
-    dof_coordinates[10] = vertex_coordinates[10];
-    dof_coordinates[11] = vertex_coordinates[11];
-    dof_coordinates[12] = 0.5*vertex_coordinates[6] + 0.5*vertex_coordinates[9];
-    dof_coordinates[13] = 0.5*vertex_coordinates[7] + 0.5*vertex_coordinates[10];
-    dof_coordinates[14] = 0.5*vertex_coordinates[8] + 0.5*vertex_coordinates[11];
-    dof_coordinates[15] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[9];
-    dof_coordinates[16] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[10];
-    dof_coordinates[17] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[11];
-    dof_coordinates[18] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
-    dof_coordinates[19] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
-    dof_coordinates[20] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
-    dof_coordinates[21] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[9];
-    dof_coordinates[22] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[10];
-    dof_coordinates[23] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[11];
-    dof_coordinates[24] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
-    dof_coordinates[25] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
-    dof_coordinates[26] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
-    dof_coordinates[27] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
-    dof_coordinates[28] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
-    dof_coordinates[29] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new projection_dofmap_0();
-  }
-
-};
-
-/// 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 projection_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  projection_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~projection_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    0
-    // Number of operations (multiply-add pairs) for tensor contraction: 50
-    // Total number of operations (multiply-add pairs):                  53
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_ = det;
-    
-    // Compute element tensor
-    A[0] = 0.00238095238095238*G0_;
-    A[1] = 0.000396825396825395*G0_;
-    A[2] = 0.000396825396825396*G0_;
-    A[3] = 0.000396825396825396*G0_;
-    A[4] = -0.00238095238095238*G0_;
-    A[5] = -0.00238095238095238*G0_;
-    A[6] = -0.00238095238095238*G0_;
-    A[7] = -0.00158730158730158*G0_;
-    A[8] = -0.00158730158730158*G0_;
-    A[9] = -0.00158730158730158*G0_;
-    A[10] = 0.000396825396825395*G0_;
-    A[11] = 0.00238095238095238*G0_;
-    A[12] = 0.000396825396825396*G0_;
-    A[13] = 0.000396825396825396*G0_;
-    A[14] = -0.00238095238095238*G0_;
-    A[15] = -0.00158730158730158*G0_;
-    A[16] = -0.00158730158730158*G0_;
-    A[17] = -0.00238095238095238*G0_;
-    A[18] = -0.00238095238095238*G0_;
-    A[19] = -0.00158730158730158*G0_;
-    A[20] = 0.000396825396825396*G0_;
-    A[21] = 0.000396825396825396*G0_;
-    A[22] = 0.00238095238095238*G0_;
-    A[23] = 0.000396825396825396*G0_;
-    A[24] = -0.00158730158730159*G0_;
-    A[25] = -0.00238095238095238*G0_;
-    A[26] = -0.00158730158730158*G0_;
-    A[27] = -0.00238095238095238*G0_;
-    A[28] = -0.00158730158730159*G0_;
-    A[29] = -0.00238095238095238*G0_;
-    A[30] = 0.000396825396825396*G0_;
-    A[31] = 0.000396825396825396*G0_;
-    A[32] = 0.000396825396825396*G0_;
-    A[33] = 0.00238095238095238*G0_;
-    A[34] = -0.00158730158730159*G0_;
-    A[35] = -0.00158730158730159*G0_;
-    A[36] = -0.00238095238095238*G0_;
-    A[37] = -0.00158730158730159*G0_;
-    A[38] = -0.00238095238095238*G0_;
-    A[39] = -0.00238095238095238*G0_;
-    A[40] = -0.00238095238095238*G0_;
-    A[41] = -0.00238095238095238*G0_;
-    A[42] = -0.00158730158730159*G0_;
-    A[43] = -0.00158730158730159*G0_;
-    A[44] = 0.0126984126984127*G0_;
-    A[45] = 0.00634920634920635*G0_;
-    A[46] = 0.00634920634920635*G0_;
-    A[47] = 0.00634920634920635*G0_;
-    A[48] = 0.00634920634920634*G0_;
-    A[49] = 0.00317460317460317*G0_;
-    A[50] = -0.00238095238095238*G0_;
-    A[51] = -0.00158730158730158*G0_;
-    A[52] = -0.00238095238095238*G0_;
-    A[53] = -0.00158730158730159*G0_;
-    A[54] = 0.00634920634920635*G0_;
-    A[55] = 0.0126984126984127*G0_;
-    A[56] = 0.00634920634920635*G0_;
-    A[57] = 0.00634920634920635*G0_;
-    A[58] = 0.00317460317460317*G0_;
-    A[59] = 0.00634920634920635*G0_;
-    A[60] = -0.00238095238095238*G0_;
-    A[61] = -0.00158730158730158*G0_;
-    A[62] = -0.00158730158730159*G0_;
-    A[63] = -0.00238095238095238*G0_;
-    A[64] = 0.00634920634920635*G0_;
-    A[65] = 0.00634920634920635*G0_;
-    A[66] = 0.0126984126984127*G0_;
-    A[67] = 0.00317460317460317*G0_;
-    A[68] = 0.00634920634920634*G0_;
-    A[69] = 0.00634920634920635*G0_;
-    A[70] = -0.00158730158730158*G0_;
-    A[71] = -0.00238095238095238*G0_;
-    A[72] = -0.00238095238095238*G0_;
-    A[73] = -0.00158730158730159*G0_;
-    A[74] = 0.00634920634920635*G0_;
-    A[75] = 0.00634920634920635*G0_;
-    A[76] = 0.00317460317460317*G0_;
-    A[77] = 0.0126984126984127*G0_;
-    A[78] = 0.00634920634920635*G0_;
-    A[79] = 0.00634920634920635*G0_;
-    A[80] = -0.00158730158730158*G0_;
-    A[81] = -0.00238095238095238*G0_;
-    A[82] = -0.00158730158730159*G0_;
-    A[83] = -0.00238095238095238*G0_;
-    A[84] = 0.00634920634920634*G0_;
-    A[85] = 0.00317460317460317*G0_;
-    A[86] = 0.00634920634920634*G0_;
-    A[87] = 0.00634920634920635*G0_;
-    A[88] = 0.0126984126984127*G0_;
-    A[89] = 0.00634920634920634*G0_;
-    A[90] = -0.00158730158730158*G0_;
-    A[91] = -0.00158730158730158*G0_;
-    A[92] = -0.00238095238095238*G0_;
-    A[93] = -0.00238095238095238*G0_;
-    A[94] = 0.00317460317460317*G0_;
-    A[95] = 0.00634920634920635*G0_;
-    A[96] = 0.00634920634920635*G0_;
-    A[97] = 0.00634920634920635*G0_;
-    A[98] = 0.00634920634920634*G0_;
-    A[99] = 0.0126984126984127*G0_;
-  }
-
-};
-
-/// 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 projection_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  projection_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~projection_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    10
-    // Number of operations (multiply-add pairs) for tensor contraction: 95
-    // Total number of operations (multiply-add pairs):                  108
-    
-    // Compute Jacobian
-    double J[9];
-    compute_jacobian_tetrahedron_3d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[9];
-    double detJ;
-    compute_jacobian_inverse_tetrahedron_3d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0 = det*w[0][0]*(1.0);
-    const double G0_1 = det*w[0][1]*(1.0);
-    const double G0_2 = det*w[0][2]*(1.0);
-    const double G0_3 = det*w[0][3]*(1.0);
-    const double G0_4 = det*w[0][4]*(1.0);
-    const double G0_5 = det*w[0][5]*(1.0);
-    const double G0_6 = det*w[0][6]*(1.0);
-    const double G0_7 = det*w[0][7]*(1.0);
-    const double G0_8 = det*w[0][8]*(1.0);
-    const double G0_9 = det*w[0][9]*(1.0);
-    
-    // Compute element tensor
-    A[0] = 0.00238095238095238*G0_0 + 0.000396825396825395*G0_1 + 0.000396825396825396*G0_2 + 0.000396825396825396*G0_3 - 0.00238095238095238*G0_4 - 0.00238095238095238*G0_5 - 0.00238095238095238*G0_6 - 0.00158730158730158*G0_7 - 0.00158730158730158*G0_8 - 0.00158730158730158*G0_9;
-    A[1] = 0.000396825396825395*G0_0 + 0.00238095238095238*G0_1 + 0.000396825396825396*G0_2 + 0.000396825396825396*G0_3 - 0.00238095238095238*G0_4 - 0.00158730158730158*G0_5 - 0.00158730158730158*G0_6 - 0.00238095238095238*G0_7 - 0.00238095238095238*G0_8 - 0.00158730158730158*G0_9;
-    A[2] = 0.000396825396825396*G0_0 + 0.000396825396825396*G0_1 + 0.00238095238095238*G0_2 + 0.000396825396825396*G0_3 - 0.00158730158730159*G0_4 - 0.00238095238095238*G0_5 - 0.00158730158730158*G0_6 - 0.00238095238095238*G0_7 - 0.00158730158730159*G0_8 - 0.00238095238095238*G0_9;
-    A[3] = 0.000396825396825396*G0_0 + 0.000396825396825396*G0_1 + 0.000396825396825396*G0_2 + 0.00238095238095238*G0_3 - 0.00158730158730159*G0_4 - 0.00158730158730159*G0_5 - 0.00238095238095238*G0_6 - 0.00158730158730159*G0_7 - 0.00238095238095238*G0_8 - 0.00238095238095238*G0_9;
-    A[4] = -0.00238095238095238*G0_0 - 0.00238095238095238*G0_1 - 0.00158730158730159*G0_2 - 0.00158730158730159*G0_3 + 0.0126984126984127*G0_4 + 0.00634920634920635*G0_5 + 0.00634920634920635*G0_6 + 0.00634920634920635*G0_7 + 0.00634920634920634*G0_8 + 0.00317460317460317*G0_9;
-    A[5] = -0.00238095238095238*G0_0 - 0.00158730158730158*G0_1 - 0.00238095238095238*G0_2 - 0.00158730158730159*G0_3 + 0.00634920634920635*G0_4 + 0.0126984126984127*G0_5 + 0.00634920634920635*G0_6 + 0.00634920634920635*G0_7 + 0.00317460317460317*G0_8 + 0.00634920634920635*G0_9;
-    A[6] = -0.00238095238095238*G0_0 - 0.00158730158730158*G0_1 - 0.00158730158730159*G0_2 - 0.00238095238095238*G0_3 + 0.00634920634920635*G0_4 + 0.00634920634920635*G0_5 + 0.0126984126984127*G0_6 + 0.00317460317460317*G0_7 + 0.00634920634920634*G0_8 + 0.00634920634920635*G0_9;
-    A[7] = -0.00158730158730158*G0_0 - 0.00238095238095238*G0_1 - 0.00238095238095238*G0_2 - 0.00158730158730159*G0_3 + 0.00634920634920635*G0_4 + 0.00634920634920635*G0_5 + 0.00317460317460317*G0_6 + 0.0126984126984127*G0_7 + 0.00634920634920635*G0_8 + 0.00634920634920635*G0_9;
-    A[8] = -0.00158730158730158*G0_0 - 0.00238095238095238*G0_1 - 0.00158730158730159*G0_2 - 0.00238095238095238*G0_3 + 0.00634920634920634*G0_4 + 0.00317460317460317*G0_5 + 0.00634920634920634*G0_6 + 0.00634920634920635*G0_7 + 0.0126984126984127*G0_8 + 0.00634920634920634*G0_9;
-    A[9] = -0.00158730158730158*G0_0 - 0.00158730158730158*G0_1 - 0.00238095238095238*G0_2 - 0.00238095238095238*G0_3 + 0.00317460317460317*G0_4 + 0.00634920634920635*G0_5 + 0.00634920634920635*G0_6 + 0.00634920634920635*G0_7 + 0.00634920634920634*G0_8 + 0.0126984126984127*G0_9;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class projection_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  projection_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~projection_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "8ec192d748e0b1d80c50374dc4ed888f38dc673f73ebde37aa4a590682079661dd09e689716f540725f7f8309ef06755a6f1db9c4ec2fb29e4b712258735e921";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 0;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new projection_finite_element_0();
-        break;
-      }
-    case 1:
-      {
-        return new projection_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new projection_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new projection_dofmap_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 0;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new projection_cell_integral_0_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class projection_form_1: public ufc::form
-{
-public:
-
-  /// Constructor
-  projection_form_1() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~projection_form_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "14280f26afff16c433cf2017cc4e5a8311d176b7ed68f7c087c7e5f4c219ef81820bc16f078b41360f191473f0abb75e6353ddf46a811574bf764685e083de9a";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 1;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 1;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({0});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new projection_finite_element_0();
-        break;
-      }
-    case 1:
-      {
-        return new projection_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new projection_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new projection_dofmap_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 0;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new projection_cell_integral_1_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-// DOLFIN wrappers
-
-// Standard library includes
-#include <string>
-
-// DOLFIN includes
-#include <dolfin/common/NoDeleter.h>
-#include <dolfin/fem/FiniteElement.h>
-#include <dolfin/fem/DofMap.h>
-#include <dolfin/fem/Form.h>
-#include <dolfin/function/FunctionSpace.h>
-#include <dolfin/function/GenericFunction.h>
-#include <dolfin/function/CoefficientAssigner.h>
-#include <dolfin/adaptivity/ErrorControl.h>
-#include <dolfin/adaptivity/GoalFunctional.h>
-
-namespace Projection
-{
-
-class CoefficientSpace_f: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 0)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_0());
-  }
-
-  // Destructor
-  ~Form_a()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "There are no coefficients");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "There are no coefficients");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_a_FunctionSpace_0 TestSpace;
-  typedef Form_a_FunctionSpace_1 TrialSpace;
-
-  // Coefficients
-};
-
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new projection_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new projection_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-typedef CoefficientSpace_f Form_L_FunctionSpace_1;
-
-class Form_L: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
-  }
-
-  // Constructor
-  Form_L(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 = std::shared_ptr<const ufc::form>(new projection_form_1());
-  }
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::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 = std::shared_ptr<const ufc::form>(new projection_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
-  }
-
-  // Constructor
-  Form_L(std::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 = std::shared_ptr<const ufc::form>(new projection_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    this->f = *f;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new projection_form_1());
-  }
-
-  // Destructor
-  ~Form_L()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-    if (name == "f")
-      return 0;
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      return "f";
-    }
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_L_FunctionSpace_0 TestSpace;
-  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
-
-  // Coefficients
-  dolfin::CoefficientAssigner f;
-};
-
-// Class typedefs
-typedef Form_a BilinearForm;
-typedef Form_a JacobianForm;
-typedef Form_L LinearForm;
-typedef Form_L ResidualForm;
-typedef Form_a::TestSpace FunctionSpace;
-
-}
-
-#endif
diff --git a/test/unit/function/cpp/compile.log b/test/unit/function/cpp/compile.log
deleted file mode 100644
index cda1662..0000000
--- a/test/unit/function/cpp/compile.log
+++ /dev/null
@@ -1,236 +0,0 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
-
-Compiling form Projection
-
-Compiler stage 1: Analyzing form(s)
------------------------------------
-  
-  Geometric dimension:       3
-  Number of cell subdomains: 0
-  Rank:                      2
-  Arguments:                 '(v_0, v_1)'
-  Number of coefficients:    0
-  Coefficients:              '[]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
-  
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Estimated cost of tensor representation: 0
-  representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
-  quadrature_rule:   auto --> default
-  
-  Geometric dimension:       3
-  Number of cell subdomains: 0
-  Rank:                      1
-  Arguments:                 '(v_0)'
-  Number of coefficients:    1
-  Coefficients:              '[w_0]'
-  Unique elements:           'CG2(?)'
-  Unique sub elements:       'CG2(?)'
-  
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Reusing element from cache
-  Estimated cost of tensor representation: 1
-  representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
-  quadrature_rule:   auto --> default
-  
-Compiler stage 1 finished in 0.180447 seconds.
-
-Compiler stage 2: Computing intermediate representation
--------------------------------------------------------
-  Computing representation of 1 elements
-  Reusing element from cache
-  Reusing element from cache
-  Computing representation of 1 dofmaps
-  Reusing element from cache
-  Computing representation of integrals
-  Computing tensor representation
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Reusing element from cache
-  Precomputing integrals on reference element
-  Reusing element from cache
-  100 entries computed in 0.00125 seconds
-  Shape of reference tensor: (10, 10)
-  Primary multi index:   rank = 2 dims = [10, 10] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [4, 8], [4, 9], [5, 0], [5, 1], [5, 2], [5, 3], [...]
-  Secondary multi index: rank = 0 dims = [] indices = [[]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 0 dims = [] indices = [[]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Reusing element from cache
-  Computing tensor representation
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Reusing element from cache
-  Precomputing integrals on reference element
-  Reusing element from cache
-  100 entries computed in 0.0013 seconds
-  Shape of reference tensor: (10, 10)
-  Primary multi index:   rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
-  Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 1 dims = [10] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Reusing element from cache
-  Computing representation of forms
-  
-Compiler stage 2 finished in 0.00756216 seconds.
-
-Compiler stage 3: Optimizing intermediate representation
---------------------------------------------------------
-  
-Compiler stage 3 finished in 0.000164986 seconds.
-
-Compiler stage 4: Generating code
----------------------------------
-  Generating code for 1 element(s)
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 1 dofmap(s)
-  Generating code for integrals
-  Generating code for forms
-  
-Compiler stage 4 finished in 0.25871 seconds.
-
-Compiler stage 4.1: Generating additional wrapper code
-------------------------------------------------------
-  Generating wrapper code for DOLFIN
-  
-Compiler stage 4.1 finished in 0.000765085 seconds.
-
-Compiler stage 5: Formatting code
----------------------------------
-  
-Output written to ./Projection.h.
-Compiler stage 5 finished in 0.000854969 seconds.
-
-FFC finished in 0.448875 seconds.
diff --git a/test/unit/function/cpp/test_cpp_function.py b/test/unit/function/cpp/test_cpp_function.py
deleted file mode 100755
index f42b284..0000000
--- a/test/unit/function/cpp/test_cpp_function.py
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env py.test
-from dolfin_utils.test import cpp_tester
-test_cpp_function = cpp_tester
diff --git a/test/unit/io/cpp/CMakeLists.txt b/test/unit/io/cpp/CMakeLists.txt
deleted file mode 100644
index 21de7f8..0000000
--- a/test/unit/io/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-# This file is automatically generated by running
-#
-#     cmake/scripts/generate-cmakefiles
-#
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-set(PROJECT_NAME test_io)
-project(${PROJECT_NAME})
-
-# Set verbose output while testing CMake
-#set(CMAKE_VERBOSE_MAKEFILE 1)
-
-# Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
-
-# Get DOLFIN configuration data (DOLFINConfig.cmake must be in
-# DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
-endif()
-
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
-# Executable
-add_executable(test_XMLMeshValueCollection XMLMeshValueCollection.cpp)
-add_executable(test_XMLMeshData XMLMeshData.cpp)
-
-# Target libraries
-target_link_libraries(test_XMLMeshValueCollection ${DOLFIN_LIBRARIES})
-target_link_libraries(test_XMLMeshData ${DOLFIN_LIBRARIES})
diff --git a/test/unit/io/cpp/XMLMeshData.cpp b/test/unit/io/cpp/XMLMeshData.cpp
deleted file mode 100644
index b546b2a..0000000
--- a/test/unit/io/cpp/XMLMeshData.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (C) 2013 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2012-05-25
-// Last changed:
-//
-
-#include <dolfin.h>
-#include <dolfin/common/unittest.h>
-
-using namespace dolfin;
-
-class XMLMeshDataIO : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(XMLMeshDataIO);
-  CPPUNIT_TEST(test_write_read);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void test_write_read()
-  {
-    // XML mesh output is not supported in parallel. Add test for
-    // parallel with HDF5 when ready.
-    if (dolfin::MPI::size(MPI_COMM_WORLD) == 1)
-    {
-      const std::size_t value = 10;
-      {
-        UnitSquareMesh mesh(2, 2);
-
-        // Create some mesh data
-        std::vector<std::size_t>& data0 = mesh.data().create_array("v", 0);
-        data0.resize(mesh.num_entities(0), value);
-
-        mesh.init(1);
-        std::vector<std::size_t>& data1 = mesh.data().create_array("e", 1);
-        data1.resize(mesh.num_entities(1), value);
-
-        std::vector<std::size_t>& data2 = mesh.data().create_array("c", 2);
-        data2.resize(mesh.num_entities(2), value);
-
-        File file("mesh_data.xml");
-        file << mesh;
-      }
-
-      {
-        // Read mesh from file
-        Mesh mesh("mesh_data.xml");
-
-        // Access mesh data and check
-        const std::vector<std::size_t>& data0 = mesh.data().array("v", 0);
-        CPPUNIT_ASSERT(data0.size() == mesh.num_entities(0));
-        CPPUNIT_ASSERT(data0[2] == value);
-        const std::vector<std::size_t>& data1 = mesh.data().array("e", 1);
-        CPPUNIT_ASSERT(data1.size() == mesh.num_entities(1));
-        CPPUNIT_ASSERT(data1[2] == value);
-        const std::vector<std::size_t>& data2 = mesh.data().array("c", 2);
-        CPPUNIT_ASSERT(data2.size() == mesh.num_entities(2));
-        CPPUNIT_ASSERT(data2[2] == value);
-      }
-    }
-  }
-};
-
-
-CPPUNIT_TEST_SUITE_REGISTRATION(XMLMeshDataIO);
-
-int main()
-{
-  DOLFIN_TEST;
-}
diff --git a/test/unit/io/cpp/XMLMeshValueCollection.cpp b/test/unit/io/cpp/XMLMeshValueCollection.cpp
deleted file mode 100644
index ff04a77..0000000
--- a/test/unit/io/cpp/XMLMeshValueCollection.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (C) 2007 Magnus Vikstrøm
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2007-05-29
-// Last changed: 2012-01-12
-//
-
-#include <dolfin.h>
-#include <dolfin/mesh/LocalMeshData.h>
-#include <dolfin/common/unittest.h>
-
-using namespace dolfin;
-
-class MeshValueCollectionIO : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(MeshValueCollectionIO);
-  CPPUNIT_TEST(test_read);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void test_read()
-  {
-    // Create mesh and read file
-    UnitCubeMesh mesh(5, 5, 5);
-    MeshValueCollection<std::size_t>
-      markers(mesh, "xml_value_collection_ref.xml");
-
-    // Check size
-    CPPUNIT_ASSERT(dolfin::MPI::sum(mesh.mpi_comm(), markers.size()) == 6);
-
-    // Check sum of values
-    const std::map<std::pair<std::size_t, std::size_t>, std::size_t>&
-      values = markers.values();
-    std::map<std::pair<std::size_t, std::size_t>,
-             std::size_t>::const_iterator it;
-    std::size_t sum = 0;
-    for (it = values.begin(); it != values.end(); ++it)
-      sum += it->second;
-    CPPUNIT_ASSERT(dolfin::MPI::sum(mesh.mpi_comm(), sum) == 48);
-  }
-
-};
-
-
-CPPUNIT_TEST_SUITE_REGISTRATION(MeshValueCollectionIO);
-
-int main()
-{
-  DOLFIN_TEST;
-}
diff --git a/test/unit/la/cpp/CMakeLists.txt b/test/unit/la/cpp/CMakeLists.txt
deleted file mode 100644
index 2cd566f..0000000
--- a/test/unit/la/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-# This file is automatically generated by running
-#
-#     cmake/scripts/generate-cmakefiles
-#
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-set(PROJECT_NAME test_la)
-project(${PROJECT_NAME})
-
-# Set verbose output while testing CMake
-#set(CMAKE_VERBOSE_MAKEFILE 1)
-
-# Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
-
-# Get DOLFIN configuration data (DOLFINConfig.cmake must be in
-# DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
-endif()
-
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
-# Executable
-add_executable(test_Vector Vector.cpp)
-add_executable(test_LinearOperator LinearOperator.cpp)
-
-# Target libraries
-target_link_libraries(test_Vector ${DOLFIN_LIBRARIES})
-target_link_libraries(test_LinearOperator ${DOLFIN_LIBRARIES})
diff --git a/test/unit/la/cpp/LinearOperator.cpp b/test/unit/la/cpp/LinearOperator.cpp
deleted file mode 100644
index f9ce640..0000000
--- a/test/unit/la/cpp/LinearOperator.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (C) 2012 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Johannes Ring 2012
-//
-// First added:  2012-08-21
-// Last changed: 2012-09-19
-//
-// Unit tests for matrix-free linear solvers (LinearOperator)
-
-#include <dolfin.h>
-#include <dolfin/common/unittest.h>
-#include "forms/ReactionDiffusion.h"
-#include "forms/ReactionDiffusionAction.h"
-
-using namespace dolfin;
-
-// Backends supporting the LinearOperator interface
-std::vector<std::string> backends;
-
-class TestLinearOperator : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(TestLinearOperator);
-  CPPUNIT_TEST(test_linear_operator);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void test_linear_operator()
-  {
-    // Define linear operator
-    class MyLinearOperator : public LinearOperator
-    {
-    public:
-
-      MyLinearOperator(Form& a_action, Function& u)
-        : LinearOperator(*u.vector(), *u.vector()),
-	  a_action(a_action), u(u)
-      {
-        // Do nothing
-      }
-
-      std::size_t size(std::size_t dim) const
-      { return u.function_space()->dim(); }
-
-      void mult(const GenericVector& x, GenericVector& y) const
-      {
-        // Update coefficient vector
-        *u.vector() = x;
-
-        // Assemble action
-        Assembler assembler;
-        assembler.assemble(y, a_action);
-      }
-
-    private:
-
-      Form& a_action;
-      Function& u;
-
-    };
-
-    // Iterate over backends supporting linear operators
-    for (std::size_t i = 0; i < backends.size(); i++)
-    {
-      // Check whether backend is available
-      if (!has_linear_algebra_backend(backends[i]))
-	continue;
-
-      // Skip testing Eigen in parallel
-      if (dolfin::MPI::size(MPI_COMM_WORLD) > 1
-          && backends[i] == "Eigen")
-      {
-	info("Not running Eigen test in parallel");
-	continue;
-      }
-
-      // Set linear algebra backend
-      parameters["linear_algebra_backend"] = backends[i];
-
-      // Compute reference value by solving ordinary linear system
-      UnitSquareMesh mesh(8, 8);
-      ReactionDiffusion::FunctionSpace V(mesh);
-      ReactionDiffusion::BilinearForm a(V, V);
-      ReactionDiffusion::LinearForm L(V);
-      Constant f(1.0);
-      L.f = f;
-      Matrix A;
-      Vector x, b;
-      assemble(A, a);
-      assemble(b, L);
-      solve(A, x, b, "gmres", "none");
-      const double norm_ref = norm(x, "l2");
-
-      continue;
-
-      // Solve using linear operator defined by form action
-      ReactionDiffusionAction::LinearForm a_action(V);
-      Function u(V);
-      a_action.u = u;
-      MyLinearOperator O(a_action, u);
-      solve(O, x, b, "gmres", "none");
-      const double norm_action = norm(x, "l2");
-
-      // Check results
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(norm_ref, norm_action, 1e-10);
-    }
-  }
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(TestLinearOperator);
-
-int main()
-{
-  // Add backends supporting the LinearOperator interface
-  backends.push_back("PETSc");
-  backends.push_back("Eigen");
-
-  DOLFIN_TEST;
-}
diff --git a/test/unit/la/cpp/Vector.cpp b/test/unit/la/cpp/Vector.cpp
deleted file mode 100644
index b7286f8..0000000
--- a/test/unit/la/cpp/Vector.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright (C) 2007 Johan Hake
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2008-09-30
-// Last changed: 2012-08-21
-//
-// Unit tests Selected methods for GenericVector
-
-#include <dolfin.h>
-#include <dolfin/common/unittest.h>
-
-using namespace dolfin;
-
-class TestVector : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(TestVector);
-  CPPUNIT_TEST(test_backends);
-  CPPUNIT_TEST(test_init);
-  CPPUNIT_TEST(test_get_local_empty);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void test_backends()
-  {
-    // Eigen
-    parameters["linear_algebra_backend"] = "Eigen";
-    _test_operators(MPI_COMM_SELF);
-
-    // FIXME: Outcommented STL backend to circumvent infinite loops as
-    // FIXME: seen on one buildbot
-    // STL
-    //parameters["linear_algebra_backend"] = "STL";
-    //_test_operators();
-
-    // PETSc
-    #ifdef HAS_PETSC
-    parameters["linear_algebra_backend"] = "PETSc";
-    _test_operators(MPI_COMM_WORLD);
-    #endif
-  }
-
-  void _test_operators(MPI_Comm comm)
-  {
-    Vector v(comm, 10), u(comm, 10);
-    v = 0.0;
-    u = 0.0;
-    CPPUNIT_ASSERT(v.sum() == 0.0);
-
-    // operator=(double a)
-    v = 1.0;
-    CPPUNIT_ASSERT(v.sum() == v.size());
-
-    // operator=(const GenericVector& x)
-    u = v;
-    CPPUNIT_ASSERT(u.sum() == u.size());
-
-    // operator+=(const GenericVector& x)
-    u += v;
-    CPPUNIT_ASSERT(u.sum() == 2*u.size());
-
-    // operator-=(const GenericVector& x)
-    u -= v;
-    u -= v;
-    CPPUNIT_ASSERT(u.sum() == 0.0);
-
-    // operator*=(double a)
-    v *= 5.0;
-    CPPUNIT_ASSERT(v.sum() == v.size()*5.0);
-
-    // operator/=(double a)
-    v /= 2.0;
-    CPPUNIT_ASSERT(v.sum() == 2.5*v.size());
-
-    // operator*=(const GenericVector& x)
-    u = 2.0;
-    v*=u;
-    CPPUNIT_ASSERT(v.sum() == v.size()*5.0);
-
-  }
-
-  void test_init()
-  {
-    // Create local and distributed vector layouts
-    const std::vector<std::size_t> dims(1, 203);
-
-    // Create local vector layout
-    TensorLayout layout_local(0, false);
-    std::vector<std::pair<std::size_t, std::size_t> >
-      local_range(1, std::make_pair(0, 203));
-    layout_local.init(MPI_COMM_SELF, dims, 1, local_range);
-
-    // Create distributed vector layout
-    TensorLayout layout_distributed(0, false);
-    std::vector<std::pair<std::size_t, std::size_t> >
-      ownership_range(1, dolfin::MPI::local_range(MPI_COMM_WORLD, 203));
-    layout_distributed.init(MPI_COMM_WORLD, dims, 1, ownership_range);
-
-    // Vector
-    #ifdef HAS_PETSC
-    parameters["linear_algebra_backend"] = "PETSc";
-    {
-      Vector x;
-      x.init(layout_local);
-      CPPUNIT_ASSERT(x.size() == 203);
-
-      Vector y;
-      y.init(layout_distributed);
-      CPPUNIT_ASSERT(y.size() == 203);
-    }
-    #endif
-
-    // Eigen
-    {
-      EigenVector x;
-      x.init(layout_local);
-      CPPUNIT_ASSERT(x.size() == 203);
-    }
-
-    // PETSc
-    #ifdef HAS_PETSC
-    {
-      PETScVector x;
-      x.init(layout_local);
-      CPPUNIT_ASSERT(x.size() == 203);
-
-      PETScVector y;
-      y.init(layout_distributed);
-      CPPUNIT_ASSERT(y.size() == 203);
-    }
-    #endif
-
-  }
-
-  void test_get_local_empty()
-  {
-    // Create local and distributed vector layouts
-    const std::vector<std::size_t> dims(1, 203);
-
-    // Create local vector layout
-    TensorLayout layout_local(0, false);
-    std::vector<std::pair<std::size_t, std::size_t> >
-      local_range(1, std::make_pair(0, 203));
-    layout_local.init(MPI_COMM_SELF, dims, 1, local_range);
-
-    // Create distributed vector layout
-    TensorLayout layout_distributed(0, false);
-    std::vector<std::pair<std::size_t, std::size_t> >
-      ownership_range(1, dolfin::MPI::local_range(MPI_COMM_WORLD, 203));
-    layout_distributed.init(MPI_COMM_WORLD, dims, 1, ownership_range);
-
-    // Vector
-    #ifdef HAS_PETSC
-    parameters["linear_algebra_backend"] = "PETSc";
-    {
-      Vector x;
-      x.init(layout_local);
-      CPPUNIT_ASSERT(x.size() == 203);
-
-      Vector y;
-      y.init(layout_distributed);
-      CPPUNIT_ASSERT(y.size() == 203);
-
-      //:get_local(double* block, std::size_t m,
-      //           const dolfin::la_index* rows) const
-
-      double* block = NULL;
-      dolfin::la_index* rows = NULL;
-      x.get_local(block, 0, rows);
-      y.get_local(block, 0, rows);
-
-    }
-    #endif
-
-  }
-
-
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(TestVector);
-
-int main()
-{
-  DOLFIN_TEST;
-}
diff --git a/test/unit/la/cpp/forms/ReactionDiffusion.h b/test/unit/la/cpp/forms/ReactionDiffusion.h
deleted file mode 100644
index 424b1c4..0000000
--- a/test/unit/la/cpp/forms/ReactionDiffusion.h
+++ /dev/null
@@ -1,2127 +0,0 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
-//
-// This code was generated with the option '-l dolfin' and
-// contains DOLFIN-specific wrappers that depend on DOLFIN.
-// 
-// This code was generated with the following parameters:
-// 
-//   convert_exceptions_to_warnings: False
-//   cpp_optimize:                   True
-//   cpp_optimize_flags:             '-O2'
-//   epsilon:                        1e-14
-//   error_control:                  False
-//   form_postfix:                   True
-//   format:                         'dolfin'
-//   no_ferari:                      True
-//   optimize:                       True
-//   precision:                      15
-//   quadrature_degree:              'auto'
-//   quadrature_rule:                'auto'
-//   representation:                 'auto'
-//   restrict_keyword:               ''
-//   split:                          False
-
-#ifndef __REACTIONDIFFUSION_H
-#define __REACTIONDIFFUSION_H
-
-#include <cmath>
-#include <stdexcept>
-#include <fstream>
-#include <ufc.h>
-
-/// This class defines the interface for a finite element.
-
-class reactiondiffusion_finite_element_0: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  reactiondiffusion_finite_element_0() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusion_finite_element_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new reactiondiffusion_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class reactiondiffusion_dofmap_0: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  reactiondiffusion_dofmap_0() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusion_dofmap_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 3;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 2;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             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(std::size_t* dofs,
-                                   std::size_t 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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new reactiondiffusion_dofmap_0();
-  }
-
-};
-
-/// 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 reactiondiffusion_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  reactiondiffusion_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusion_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    8
-    // Number of operations (multiply-add pairs) for tensor contraction: 20
-    // Total number of operations (multiply-add pairs):                  31
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_ = det;
-    const double G1_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
-    const double G1_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
-    const double G1_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
-    const double G1_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
-    
-    // Compute element tensor
-    A[0] = 0.0833333333333334*G0_ + 0.499999999999999*G1_0_0 + 0.5*G1_0_1 + 0.5*G1_1_0 + 0.5*G1_1_1;
-    A[1] = 0.0416666666666667*G0_ - 0.499999999999999*G1_0_0 - 0.5*G1_1_0;
-    A[2] = 0.0416666666666667*G0_ - 0.5*G1_0_1 - 0.5*G1_1_1;
-    A[3] = 0.0416666666666667*G0_ - 0.499999999999999*G1_0_0 - 0.5*G1_0_1;
-    A[4] = 0.0833333333333333*G0_ + 0.499999999999999*G1_0_0;
-    A[5] = 0.0416666666666666*G0_ + 0.5*G1_0_1;
-    A[6] = 0.0416666666666667*G0_ - 0.5*G1_1_0 - 0.5*G1_1_1;
-    A[7] = 0.0416666666666666*G0_ + 0.5*G1_1_0;
-    A[8] = 0.0833333333333333*G0_ + 0.5*G1_1_1;
-  }
-
-};
-
-/// 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 reactiondiffusion_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  reactiondiffusion_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusion_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    3
-    // Number of operations (multiply-add pairs) for tensor contraction: 7
-    // Total number of operations (multiply-add pairs):                  13
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0 = det*w[0][0]*(1.0);
-    const double G0_1 = det*w[0][1]*(1.0);
-    const double G0_2 = det*w[0][2]*(1.0);
-    
-    // Compute element tensor
-    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
-    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
-    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class reactiondiffusion_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  reactiondiffusion_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusion_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "4b50aa84c3db26e07d565c5d0052419d9eb355e66e2ca4ed277db119e8838a3c816249ac0a8ffc4809f758410b05234c8713ffffbcb15c972e12fc6ad86b9f3b";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 0;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new reactiondiffusion_finite_element_0();
-        break;
-      }
-    case 1:
-      {
-        return new reactiondiffusion_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new reactiondiffusion_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new reactiondiffusion_dofmap_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 0;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new reactiondiffusion_cell_integral_0_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class reactiondiffusion_form_1: public ufc::form
-{
-public:
-
-  /// Constructor
-  reactiondiffusion_form_1() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusion_form_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "9b3ffdf60467e039d8e8a97e79c7ff10aafc42a857591aa4af5591dbc4c3a0fdb2fddbef0bbdd9059db18858572b02dab934b8253fc38648f9f82876cd336c76";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 1;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 1;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({0});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new reactiondiffusion_finite_element_0();
-        break;
-      }
-    case 1:
-      {
-        return new reactiondiffusion_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new reactiondiffusion_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new reactiondiffusion_dofmap_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 0;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new reactiondiffusion_cell_integral_1_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-// DOLFIN wrappers
-
-// Standard library includes
-#include <string>
-
-// DOLFIN includes
-#include <dolfin/common/NoDeleter.h>
-#include <dolfin/fem/FiniteElement.h>
-#include <dolfin/fem/DofMap.h>
-#include <dolfin/fem/Form.h>
-#include <dolfin/function/FunctionSpace.h>
-#include <dolfin/function/GenericFunction.h>
-#include <dolfin/function/CoefficientAssigner.h>
-#include <dolfin/adaptivity/ErrorControl.h>
-#include <dolfin/adaptivity/GoalFunctional.h>
-
-namespace ReactionDiffusion
-{
-
-class CoefficientSpace_f: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_f(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusion_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 0)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusion_form_0());
-  }
-
-  // Destructor
-  ~Form_a()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "There are no coefficients");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "There are no coefficients");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_a_FunctionSpace_0 TestSpace;
-  typedef Form_a_FunctionSpace_1 TrialSpace;
-
-  // Coefficients
-};
-
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusion_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusion_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-typedef CoefficientSpace_f Form_L_FunctionSpace_1;
-
-class Form_L: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusion_form_1());
-  }
-
-  // Constructor
-  Form_L(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 = std::shared_ptr<const ufc::form>(new reactiondiffusion_form_1());
-  }
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::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 = std::shared_ptr<const ufc::form>(new reactiondiffusion_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusion_form_1());
-  }
-
-  // Constructor
-  Form_L(std::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 = std::shared_ptr<const ufc::form>(new reactiondiffusion_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
-    dolfin::Form(1, 1), f(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    this->f = *f;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusion_form_1());
-  }
-
-  // Destructor
-  ~Form_L()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-    if (name == "f")
-      return 0;
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      return "f";
-    }
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_L_FunctionSpace_0 TestSpace;
-  typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
-
-  // Coefficients
-  dolfin::CoefficientAssigner f;
-};
-
-// Class typedefs
-typedef Form_a BilinearForm;
-typedef Form_a JacobianForm;
-typedef Form_L LinearForm;
-typedef Form_L ResidualForm;
-typedef Form_a::TestSpace FunctionSpace;
-
-}
-
-#endif
diff --git a/test/unit/la/cpp/forms/ReactionDiffusionAction.h b/test/unit/la/cpp/forms/ReactionDiffusionAction.h
deleted file mode 100644
index fed5b99..0000000
--- a/test/unit/la/cpp/forms/ReactionDiffusionAction.h
+++ /dev/null
@@ -1,1689 +0,0 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
-//
-// This code was generated with the option '-l dolfin' and
-// contains DOLFIN-specific wrappers that depend on DOLFIN.
-// 
-// This code was generated with the following parameters:
-// 
-//   convert_exceptions_to_warnings: False
-//   cpp_optimize:                   True
-//   cpp_optimize_flags:             '-O2'
-//   epsilon:                        1e-14
-//   error_control:                  False
-//   form_postfix:                   True
-//   format:                         'dolfin'
-//   no_ferari:                      True
-//   optimize:                       True
-//   precision:                      15
-//   quadrature_degree:              'auto'
-//   quadrature_rule:                'auto'
-//   representation:                 'auto'
-//   restrict_keyword:               ''
-//   split:                          False
-
-#ifndef __REACTIONDIFFUSIONACTION_H
-#define __REACTIONDIFFUSIONACTION_H
-
-#include <cmath>
-#include <stdexcept>
-#include <fstream>
-#include <ufc.h>
-
-/// This class defines the interface for a finite element.
-
-class reactiondiffusionaction_finite_element_0: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  reactiondiffusionaction_finite_element_0() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusionaction_finite_element_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 3;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 3; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[2][1];
-    for (unsigned int row = 0; row < 2; row++)
-    {
-      for (unsigned int col = 0; col < 1; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[2][2];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, -0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.288675134594813, -0.166666666666667};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[3] = {0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[3] = \
-      {0.471404520791032, 0.0, 0.333333333333333};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0},
-      {0.0, 0.0, 0.0}};
-      
-      static const double dmats1[3][3] = \
-      {{0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[2];
-      for (unsigned int r = 0; r < 2; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[3][3] = \
-      {{1.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0},
-      {0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 3; t++)
-        {
-          for (unsigned int u = 0; u < 3; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            for (unsigned int u = 0; u < 3; u++)
-            {
-              for (unsigned int tu = 0; tu < 3; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 3; s++)
-        {
-          for (unsigned int t = 0; t < 3; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 1)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[2];
-    for (unsigned int r = 0; r < 2; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 3; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new reactiondiffusionaction_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class reactiondiffusionaction_dofmap_0: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  reactiondiffusionaction_dofmap_0() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusionaction_dofmap_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 1, None)";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 3;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 2;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             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(std::size_t* dofs,
-                                   std::size_t 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(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new reactiondiffusionaction_dofmap_0();
-  }
-
-};
-
-/// 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 reactiondiffusionaction_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  reactiondiffusionaction_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusionaction_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    23
-    // Number of operations (multiply-add pairs) for tensor contraction: 23
-    // Total number of operations (multiply-add pairs):                  49
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0 = det*w[0][0]*(1.0);
-    const double G0_1 = det*w[0][1]*(1.0);
-    const double G0_2 = det*w[0][2]*(1.0);
-    const double G1_0_0_0 = det*(w[0][0]*((K[0]*K[0] + K[1]*K[1])));
-    const double G1_0_0_1 = det*(w[0][0]*((K[0]*K[2] + K[1]*K[3])));
-    const double G1_0_1_0 = det*(w[0][1]*((K[0]*K[0] + K[1]*K[1])));
-    const double G1_0_2_1 = det*(w[0][2]*((K[0]*K[2] + K[1]*K[3])));
-    const double G1_1_0_0 = det*(w[0][0]*((K[2]*K[0] + K[3]*K[1])));
-    const double G1_1_0_1 = det*(w[0][0]*((K[2]*K[2] + K[3]*K[3])));
-    const double G1_1_1_0 = det*(w[0][1]*((K[2]*K[0] + K[3]*K[1])));
-    const double G1_1_2_1 = det*(w[0][2]*((K[2]*K[2] + K[3]*K[3])));
-    
-    // Compute element tensor
-    A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2 + 0.499999999999999*G1_0_0_0 + 0.5*G1_0_0_1 - 0.499999999999999*G1_0_1_0 - 0.5*G1_0_2_1 + 0.5*G1_1_0_0 + 0.5*G1_1_0_1 - 0.5*G1_1_1_0 - 0.5*G1_1_2_1;
-    A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2 - 0.499999999999999*G1_0_0_0 - 0.5*G1_0_0_1 + 0.499999999999999*G1_0_1_0 + 0.5*G1_0_2_1;
-    A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2 - 0.5*G1_1_0_0 - 0.5*G1_1_0_1 + 0.5*G1_1_1_0 + 0.5*G1_1_2_1;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class reactiondiffusionaction_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  reactiondiffusionaction_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~reactiondiffusionaction_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "1a5930ea37f63399dfa314e0e0f840bd2c605baf5e96fc39424163644c92b1173e0349e56ff1a51650279ca58b4d4e2beaef45b2498c50d85a1339fb7ac34b9b";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 1;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 1;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({0});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new reactiondiffusionaction_finite_element_0();
-        break;
-      }
-    case 1:
-      {
-        return new reactiondiffusionaction_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new reactiondiffusionaction_dofmap_0();
-        break;
-      }
-    case 1:
-      {
-        return new reactiondiffusionaction_dofmap_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 0;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new reactiondiffusionaction_cell_integral_0_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-// DOLFIN wrappers
-
-// Standard library includes
-#include <string>
-
-// DOLFIN includes
-#include <dolfin/common/NoDeleter.h>
-#include <dolfin/fem/FiniteElement.h>
-#include <dolfin/fem/DofMap.h>
-#include <dolfin/fem/Form.h>
-#include <dolfin/function/FunctionSpace.h>
-#include <dolfin/function/GenericFunction.h>
-#include <dolfin/function/CoefficientAssigner.h>
-#include <dolfin/adaptivity/ErrorControl.h>
-#include <dolfin/adaptivity/GoalFunctional.h>
-
-namespace ReactionDiffusionAction
-{
-
-class CoefficientSpace_u: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusionaction_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusionaction_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusionaction_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusionaction_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_u(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusionaction_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusionaction_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_u(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusionaction_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusionaction_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusionaction_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusionaction_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusionaction_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusionaction_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusionaction_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusionaction_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new reactiondiffusionaction_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new reactiondiffusionaction_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-typedef CoefficientSpace_u Form_a_FunctionSpace_1;
-
-class Form_a: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusionaction_form_0());
-  }
-
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->u = u;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusionaction_form_0());
-  }
-
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->u = *u;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusionaction_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusionaction_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    this->u = u;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusionaction_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> u):
-    dolfin::Form(1, 1), u(*this, 0)
-  {
-    _function_spaces[0] = V0;
-
-    this->u = *u;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new reactiondiffusionaction_form_0());
-  }
-
-  // Destructor
-  ~Form_a()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-    if (name == "u")
-      return 0;
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      return "u";
-    }
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_a_FunctionSpace_0 TestSpace;
-  typedef Form_a_FunctionSpace_1 CoefficientSpace_u;
-
-  // Coefficients
-  dolfin::CoefficientAssigner u;
-};
-
-// Class typedefs
-typedef Form_a LinearForm;
-typedef Form_a ResidualForm;
-typedef Form_a::TestSpace FunctionSpace;
-
-}
-
-#endif
diff --git a/test/unit/la/cpp/test_cpp_la.py b/test/unit/la/cpp/test_cpp_la.py
deleted file mode 100755
index 4d82757..0000000
--- a/test/unit/la/cpp/test_cpp_la.py
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env py.test
-from dolfin_utils.test import cpp_tester
-test_cpp_la = cpp_tester
diff --git a/test/unit/mesh/cpp/CMakeLists.txt b/test/unit/mesh/cpp/CMakeLists.txt
deleted file mode 100644
index 78aa85c..0000000
--- a/test/unit/mesh/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-# This file is automatically generated by running
-#
-#     cmake/scripts/generate-cmakefiles
-#
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-set(PROJECT_NAME test_mesh)
-project(${PROJECT_NAME})
-
-# Set verbose output while testing CMake
-#set(CMAKE_VERBOSE_MAKEFILE 1)
-
-# Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
-
-# Get DOLFIN configuration data (DOLFINConfig.cmake must be in
-# DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
-endif()
-
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
-# Executable
-add_executable(test_MeshFunction MeshFunction.cpp)
-add_executable(test_Mesh Mesh.cpp)
-add_executable(test_MeshValueCollection MeshValueCollection.cpp)
-
-# Target libraries
-target_link_libraries(test_MeshFunction ${DOLFIN_LIBRARIES})
-target_link_libraries(test_Mesh ${DOLFIN_LIBRARIES})
-target_link_libraries(test_MeshValueCollection ${DOLFIN_LIBRARIES})
diff --git a/test/unit/mesh/cpp/Mesh.cpp b/test/unit/mesh/cpp/Mesh.cpp
deleted file mode 100644
index db3f228..0000000
--- a/test/unit/mesh/cpp/Mesh.cpp
+++ /dev/null
@@ -1,322 +0,0 @@
-// Copyright (C) 2007 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// Modified by Benjamin Kehlet 2012
-//
-// First added:  2007-05-14
-// Last changed: 2012-11-12
-//
-// Unit tests for the mesh library
-
-#include <dolfin.h>
-#include <dolfin/common/unittest.h>
-
-using namespace dolfin;
-
-class SimpleShapes : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(SimpleShapes);
-  CPPUNIT_TEST(testUnitSquareMesh);
-  CPPUNIT_TEST(testUnitCubeMesh);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void testUnitSquareMesh()
-  {
-    // Create mesh of unit square
-    UnitSquareMesh mesh(5, 7);
-    CPPUNIT_ASSERT(mesh.num_vertices() == 48);
-    CPPUNIT_ASSERT(mesh.num_cells() == 70);
-  }
-
-  void testUnitCubeMesh()
-  {
-    // Create mesh of unit cube
-    UnitCubeMesh mesh(5, 7, 9);
-    CPPUNIT_ASSERT(mesh.num_vertices() == 480);
-    CPPUNIT_ASSERT(mesh.num_cells() == 1890);
-  }
-
-};
-
-class MeshRefinement : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(MeshRefinement);
-  CPPUNIT_TEST(testRefineUnitSquareMesh);
-  CPPUNIT_TEST(testRefineUnitCubeMesh);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void testRefineUnitSquareMesh()
-  {
-    // Refine mesh of unit square
-    UnitSquareMesh mesh0(5, 7);
-    Mesh mesh1 = refine(mesh0);
-    CPPUNIT_ASSERT(mesh1.num_vertices() == 165);
-    CPPUNIT_ASSERT(mesh1.num_cells() == 280);
-  }
-
-  void testRefineUnitCubeMesh()
-  {
-    // Refine mesh of unit cube
-    UnitCubeMesh mesh0(5, 7, 9);
-    Mesh mesh1 = refine(mesh0);
-    CPPUNIT_ASSERT(mesh1.num_vertices() == 3135);
-    CPPUNIT_ASSERT(mesh1.num_cells() == 15120);
-  }
-
-};
-
-class MeshIterators : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(MeshIterators);
-  CPPUNIT_TEST(testVertexIterators);
-  CPPUNIT_TEST(testEdgeIterators);
-  CPPUNIT_TEST(testFaceIterators);
-  CPPUNIT_TEST(testFacetIterators);
-  CPPUNIT_TEST(testCellIterators);
-  CPPUNIT_TEST(testMixedIterators);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void testVertexIterators()
-  {
-    // Iterate over vertices
-    UnitCubeMesh mesh(5, 5, 5);
-    unsigned int n = 0;
-    for (VertexIterator v(mesh); !v.end(); ++v)
-      n++;
-    CPPUNIT_ASSERT(n == mesh.num_vertices());
-  }
-
-  void testEdgeIterators()
-  {
-    // Iterate over edges
-    UnitCubeMesh mesh(5, 5, 5);
-    unsigned int n = 0;
-    for (EdgeIterator e(mesh); !e.end(); ++e)
-      n++;
-    CPPUNIT_ASSERT(n == mesh.num_edges());
-  }
-
-  void testFaceIterators()
-  {
-    // Iterate over faces
-    UnitCubeMesh mesh(5, 5, 5);
-    unsigned int n = 0;
-    for (FaceIterator f(mesh); !f.end(); ++f)
-      n++;
-    CPPUNIT_ASSERT(n == mesh.num_faces());
-  }
-
-  void testFacetIterators()
-  {
-    // Iterate over facets
-    UnitCubeMesh mesh(5, 5, 5);
-    unsigned int n = 0;
-    for (FacetIterator f(mesh); !f.end(); ++f)
-      n++;
-    CPPUNIT_ASSERT(n == mesh.num_facets());
-  }
-
-  void testCellIterators()
-  {
-    // Iterate over cells
-    UnitCubeMesh mesh(5, 5, 5);
-    unsigned int n = 0;
-    for (CellIterator c(mesh); !c.end(); ++c)
-      n++;
-    CPPUNIT_ASSERT(n == mesh.num_cells());
-  }
-
-  void testMixedIterators()
-  {
-    // Iterate over vertices of cells
-    UnitCubeMesh mesh(5, 5, 5);
-    unsigned int n = 0;
-    for (CellIterator c(mesh); !c.end(); ++c)
-      for (VertexIterator v(*c); !v.end(); ++v)
-        n++;
-    CPPUNIT_ASSERT(n == 4*mesh.num_cells());
-  }
-
-};
-
-class BoundaryExtraction : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(BoundaryExtraction);
-  CPPUNIT_TEST(testBoundaryComputation);
-  CPPUNIT_TEST(testBoundaryBoundary);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void testBoundaryComputation()
-  {
-    // Compute boundary of mesh
-    UnitCubeMesh mesh(2, 2, 2);
-    BoundaryMesh boundary(mesh, "exterior");
-    CPPUNIT_ASSERT(boundary.num_vertices() == 26);
-    CPPUNIT_ASSERT(boundary.num_cells() == 48);
-  }
-
-  void testBoundaryBoundary()
-  {
-    // Compute boundary of boundary
-    //
-    // Note that we can't do
-    //
-    //   BoundaryMesh b0(mesh);
-    //   BoundaryMesh b1(b0);
-    //
-    // since b1 would then be a copy of b0 (copy
-    // constructor in Mesh will be used).
-
-    UnitCubeMesh mesh(2, 2, 2);
-    BoundaryMesh b0(mesh, "exterior");
-    b0.order();
-    BoundaryMesh b1(b0, "exterior");
-    CPPUNIT_ASSERT(b1.num_vertices() == 0);
-    CPPUNIT_ASSERT(b1.num_cells() == 0);
-  }
-
-};
-
-class MeshFunctions : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(MeshFunctions);
-  CPPUNIT_TEST(testAssign);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void testAssign()
-  {
-    /// Assign value of mesh function
-    UnitSquareMesh mesh(3, 3);
-    MeshFunction<int> f(mesh, 0);
-    f[3] = 10;
-    Vertex v(mesh, 3);
-    CPPUNIT_ASSERT(f[v] == 10);
-  }
-
-};
-
-class InputOutput : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(InputOutput);
-  CPPUNIT_TEST(testMeshXML2D);
-  CPPUNIT_TEST(testMeshXML3D);
-  CPPUNIT_TEST(testMeshFunction);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void testMeshXML2D()
-  {
-    // Write and read 2D mesh to/from file
-    UnitSquareMesh mesh_out(3, 3);
-    Mesh mesh_in;
-    File file("unitsquare.xml");
-    file << mesh_out;
-    file >> mesh_in;
-    CPPUNIT_ASSERT(mesh_in.num_vertices() == 16);
-  }
-
-  void testMeshXML3D()
-  {
-    // Write and read 3D mesh to/from file
-    UnitCubeMesh mesh_out(3, 3, 3);
-    Mesh mesh_in;
-    File file("unitcube.xml");
-    file << mesh_out;
-    file >> mesh_in;
-    CPPUNIT_ASSERT(mesh_in.num_vertices() == 64);
-  }
-
-  void testMeshFunction()
-  {
-    // Write and read mesh function to/from file
-    UnitSquareMesh mesh(1, 1);
-    MeshFunction<int> f(mesh, 0);
-    f[0] = 2;
-    f[1] = 4;
-    f[2] = 6;
-    f[3] = 8;
-    File file("meshfunction.xml");
-    file << f;
-    MeshFunction<int> g(mesh, 0);
-    file >> g;
-    for (VertexIterator v(mesh); !v.end(); ++v)
-      CPPUNIT_ASSERT(f[*v] == g[*v]);
-  }
-
-};
-
-class PyCCInterface : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(PyCCInterface);
-  CPPUNIT_TEST(testGetGeometricalDimension);
-  CPPUNIT_TEST(testGetCoordinates);
-  CPPUNIT_TEST(testGetCells);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void testGetGeometricalDimension()
-  {
-    // Get geometrical dimension of mesh
-    UnitSquareMesh mesh(5, 5);
-    CPPUNIT_ASSERT(mesh.geometry().dim() == 2);
-  }
-
-  void testGetCoordinates()
-  {
-    // Get coordinates of vertices
-    UnitSquareMesh mesh(5, 5);
-    CPPUNIT_ASSERT(mesh.geometry().size() == 36);
-  }
-
-  void testGetCells()
-  {
-    // Get cells of mesh
-    UnitSquareMesh mesh(5, 5);
-    CPPUNIT_ASSERT(mesh.topology().size(2) == 50);
-  }
-
-};
-
-int main()
-{
-  CPPUNIT_TEST_SUITE_REGISTRATION(MeshIterators);
-
-  // FIXME: The following test breaks in parallel
-  if (dolfin::MPI::size(MPI_COMM_WORLD) == 1)
-  {
-    CPPUNIT_TEST_SUITE_REGISTRATION(SimpleShapes);
-    CPPUNIT_TEST_SUITE_REGISTRATION(MeshRefinement);
-    CPPUNIT_TEST_SUITE_REGISTRATION(BoundaryExtraction);
-    CPPUNIT_TEST_SUITE_REGISTRATION(MeshFunctions);
-    CPPUNIT_TEST_SUITE_REGISTRATION(InputOutput);
-    CPPUNIT_TEST_SUITE_REGISTRATION(PyCCInterface);
-  }
-
-  DOLFIN_TEST;
-}
diff --git a/test/unit/mesh/cpp/MeshFunction.cpp b/test/unit/mesh/cpp/MeshFunction.cpp
deleted file mode 100644
index d3f7d3d..0000000
--- a/test/unit/mesh/cpp/MeshFunction.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (C) 2013 Garth N. Wells
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2013-05-30
-// Last changed:
-//
-// Unit tests for MeshFunction
-
-#include <dolfin.h>
-#include <dolfin/common/unittest.h>
-
-using namespace dolfin;
-
-class MeshFunctions : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(MeshFunctions);
-  CPPUNIT_TEST(test_create_from_domains);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void test_create_from_domains()
-  {
-    // Create mesh
-    std::shared_ptr<Mesh> mesh(new UnitSquareMesh(3, 3));
-    dolfin_assert(mesh);
-
-    const std::size_t D = mesh->topology().dim();
-
-    // Test setting all values
-    for (std::size_t d = 0; d <= D; ++d)
-    {
-      // Create MeshDomains object
-      MeshDomains mesh_domains;
-      mesh_domains.init(D);
-
-      mesh->init(d);
-
-      // Build mesh domain
-      std::map<std::size_t, std::size_t>& domain = mesh_domains.markers(d);
-      for (std::size_t i = 0; i < mesh->num_entities(d); ++i)
-        domain.insert(std::make_pair(i, i));
-
-      // Create MeshFunction and test values
-      MeshFunction<std::size_t> mf(mesh, d, mesh_domains);
-      for (std::size_t i = 0; i < mf.size(); ++i)
-        CPPUNIT_ASSERT(mf[i] == i);
-    }
-
-    // Test setting some values only
-    for (std::size_t d = 0; d <= D; ++d)
-    {
-      // Create MeshDomains object
-      MeshDomains mesh_domains;
-      mesh_domains.init(D);
-
-      mesh->init(d);
-
-      // Build mesh domain
-      std::map<std::size_t, std::size_t>& domain = mesh_domains.markers(d);
-      const std::size_t num_entities = mesh->num_entities(d);
-      for (std::size_t i = num_entities/2; i < num_entities; ++i)
-        domain.insert(std::make_pair(i, i));
-
-      // Create MeshFunction and test values
-      MeshFunction<std::size_t> mf(mesh, d, mesh_domains);
-      for (std::size_t i = 0; i < num_entities/2; ++i)
-        CPPUNIT_ASSERT(mf[i] == std::numeric_limits<std::size_t>::max());
-      for (std::size_t i = num_entities/2; i < mf.size(); ++i)
-        CPPUNIT_ASSERT(mf[i] == i);
-    }
-
-
-  }
-
-};
-
-
-int main()
-{
-  CPPUNIT_TEST_SUITE_REGISTRATION(MeshFunctions);
-  DOLFIN_TEST;
-}
diff --git a/test/unit/mesh/cpp/MeshValueCollection.cpp b/test/unit/mesh/cpp/MeshValueCollection.cpp
deleted file mode 100644
index 1ec93f8..0000000
--- a/test/unit/mesh/cpp/MeshValueCollection.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (C) 2007 Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2007-05-14
-// Last changed: 2012-01-11
-//
-// Unit tests for the mesh library
-
-#include <dolfin.h>
-#include <dolfin/common/unittest.h>
-
-using namespace dolfin;
-
-class MeshValueCollections : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(MeshValueCollections);
-  CPPUNIT_TEST(testAssign2DCells);
-  CPPUNIT_TEST(testAssign2DFacets);
-  CPPUNIT_TEST(testAssign2DVertices);
-  CPPUNIT_TEST(testMeshFunctionAssign2DCells);
-  CPPUNIT_TEST(testMeshFunctionAssign2DFacets);
-  CPPUNIT_TEST(testMeshFunctionAssign2DVertices);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void testAssign2DCells()
-  {
-    UnitSquareMesh mesh(3, 3);
-    const std::size_t ncells = mesh.num_cells();
-    MeshValueCollection<int> f(mesh, 2);
-    bool all_new = true;
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-    {
-      bool this_new;
-      const int value = ncells - cell->index();
-      this_new = f.set_value(cell->index(), value);
-      all_new = all_new && this_new;
-    }
-    MeshValueCollection<int> g(mesh, 2);
-    g = f;
-    CPPUNIT_ASSERT_EQUAL(ncells, f.size());
-    CPPUNIT_ASSERT_EQUAL(ncells, g.size());
-    CPPUNIT_ASSERT(all_new);
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-    {
-      const int value = ncells - cell->index();
-      CPPUNIT_ASSERT_EQUAL(value, g.get_value(cell->index(), 0));
-    }
-  }
-
-  void testAssign2DFacets()
-  {
-    UnitSquareMesh mesh(3, 3);
-    mesh.init(2,1);
-    const std::size_t ncells = mesh.num_cells();
-    MeshValueCollection<int> f(mesh, 1);
-    bool all_new = true;
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-    {
-      const int value = ncells - cell->index();
-      for (std::size_t i = 0; i < cell->num_entities(1); ++i)
-      {
-        bool this_new;
-        this_new = f.set_value(cell->index(), i, value + i);
-        all_new = all_new && this_new;
-      }
-    }
-    MeshValueCollection<int> g(mesh, 1);
-    g = f;
-    CPPUNIT_ASSERT_EQUAL(ncells*3, f.size());
-    CPPUNIT_ASSERT_EQUAL(ncells*3, g.size());
-    CPPUNIT_ASSERT(all_new);
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-    {
-      for (std::size_t i = 0; i < cell->num_entities(1); ++i)
-      {
-        const int value = ncells - cell->index() + i;
-        CPPUNIT_ASSERT_EQUAL(value, g.get_value(cell->index(), i));
-      }
-    }
-  }
-
-  void testAssign2DVertices()
-  {
-    UnitSquareMesh mesh(3, 3);
-    mesh.init(2, 0);
-    const std::size_t ncells = mesh.num_cells();
-    MeshValueCollection<int> f(mesh, 0);
-    bool all_new = true;
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-    {
-      const int value = ncells - cell->index();
-      for (std::size_t i = 0; i < cell->num_entities(0); ++i)
-      {
-        bool this_new;
-        this_new = f.set_value(cell->index(), i, value+i);
-        all_new = all_new && this_new;
-      }
-    }
-    MeshValueCollection<int> g(mesh, 0);
-    g = f;
-    CPPUNIT_ASSERT_EQUAL(ncells*3, f.size());
-    CPPUNIT_ASSERT_EQUAL(ncells*3, g.size());
-    CPPUNIT_ASSERT(all_new);
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-    {
-      for (std::size_t i = 0; i < cell->num_entities(0); ++i)
-      {
-        const int value = ncells - cell->index() + i;
-        CPPUNIT_ASSERT_EQUAL(value, g.get_value(cell->index(), i));
-      }
-    }
-  }
-
-  void testMeshFunctionAssign2DCells()
-  {
-    UnitSquareMesh mesh(3, 3);
-    const std::size_t ncells = mesh.num_cells();
-    MeshFunction<int> f(mesh, 2, 0);
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-      f[cell->index()] = ncells - cell->index();
-    MeshValueCollection<int> g(mesh, 2);
-    g = f;
-    CPPUNIT_ASSERT_EQUAL(ncells, f.size());
-    CPPUNIT_ASSERT_EQUAL(ncells, g.size());
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-    {
-      const int value = ncells - cell->index();
-      CPPUNIT_ASSERT_EQUAL(value, g.get_value(cell->index(), 0));
-    }
-  }
-
-  void testMeshFunctionAssign2DFacets()
-  {
-    UnitSquareMesh mesh(3, 3);
-    mesh.init(1);
-    MeshFunction<int> f(mesh, 1, 25);
-    MeshValueCollection<int> g(mesh, 1);
-    g = f;
-    CPPUNIT_ASSERT_EQUAL(mesh.num_facets(), f.size());
-    CPPUNIT_ASSERT_EQUAL(mesh.num_cells()*3, g.size());
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-    {
-      for (std::size_t i = 0; i < cell->num_entities(1); ++i)
-        CPPUNIT_ASSERT_EQUAL(25, g.get_value(cell->index(), i));
-    }
-  }
-
-  void testMeshFunctionAssign2DVertices()
-  {
-    UnitSquareMesh mesh(3, 3);
-    mesh.init(0);
-    MeshFunction<int> f(mesh, 0, 25);
-    MeshValueCollection<int> g(mesh, 0);
-    g = f;
-    CPPUNIT_ASSERT_EQUAL(mesh.num_vertices(), f.size());
-    CPPUNIT_ASSERT_EQUAL(mesh.num_cells()*3, g.size());
-    for (CellIterator cell(mesh); !cell.end(); ++cell)
-    {
-      for (std::size_t i = 0; i < cell->num_entities(0); ++i)
-        CPPUNIT_ASSERT_EQUAL(25, g.get_value(cell->index(), i));
-    }
-  }
-
-};
-
-
-int main()
-{
-  CPPUNIT_TEST_SUITE_REGISTRATION(MeshValueCollections);
-  DOLFIN_TEST;
-}
diff --git a/test/unit/mesh/cpp/test_cpp_mesh.py b/test/unit/mesh/cpp/test_cpp_mesh.py
deleted file mode 100755
index 62a488b..0000000
--- a/test/unit/mesh/cpp/test_cpp_mesh.py
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env py.test
-from dolfin_utils.test import cpp_tester
-test_cpp_mesh = cpp_tester
diff --git a/test/unit/multimesh/cpp/CMakeLists.txt b/test/unit/multimesh/cpp/CMakeLists.txt
deleted file mode 100644
index 3175847..0000000
--- a/test/unit/multimesh/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# This file is automatically generated by running
-#
-#     cmake/scripts/generate-cmakefiles
-#
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-set(PROJECT_NAME test_multimesh)
-project(${PROJECT_NAME})
-
-# Set verbose output while testing CMake
-#set(CMAKE_VERBOSE_MAKEFILE 1)
-
-# Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
-
-# Get DOLFIN configuration data (DOLFINConfig.cmake must be in
-# DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
-endif()
-
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
-# Executable
-add_executable(test_MultiMesh MultiMesh.cpp)
-
-# Target libraries
-target_link_libraries(test_MultiMesh ${DOLFIN_LIBRARIES})
diff --git a/test/unit/multimesh/cpp/MultiMesh.cpp b/test/unit/multimesh/cpp/MultiMesh.cpp
deleted file mode 100644
index 7ee01fd..0000000
--- a/test/unit/multimesh/cpp/MultiMesh.cpp
+++ /dev/null
@@ -1,442 +0,0 @@
-// Copyright (C) 2014 August Johansson and Anders Logg
-//
-// This file is part of DOLFIN.
-//
-// DOLFIN is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// DOLFIN is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-//
-// First added:  2014-03-10
-// Last changed: 2015-06-04
-//
-// Unit tests for MultiMesh
-
-#include <dolfin.h>
-#include <dolfin/common/unittest.h>
-#include <dolfin/geometry/SimplexQuadrature.h>
-
-#include "MultiMeshStokes2D.h"
-
-using namespace dolfin;
-
-class MultiMeshes : public CppUnit::TestFixture
-{
-  CPPUNIT_TEST_SUITE(MultiMeshes);
-  //CPPUNIT_TEST(test_multiple_meshes_quadrature);
-  CPPUNIT_TEST(test_multiple_meshes_interface_quadrature);
-  CPPUNIT_TEST(test_assembly);
-  CPPUNIT_TEST_SUITE_END();
-
-public:
-
-  void test_multiple_meshes_quadrature()
-  {
-    set_log_level(DEBUG);
-
-    // Create multimesh from three triangle meshes of the unit square
-
-    // Many meshes, but not more than three overlap => this works
-    UnitCubeMesh mesh_0(11, 12, 13);
-    BoxMesh mesh_1(Point(0.1, 0.1, 0.1),    Point(0.9, 0.9, 0.9),    13, 11, 12);
-    BoxMesh mesh_2(Point(0.2, 0.2, 0.2),    Point(0.95, 0.95, 0.8),  11, 13, 11);
-    BoxMesh mesh_3(Point(0.94, 0.01, 0.01), Point(0.98, 0.99, 0.99), 1, 11, 11);
-    BoxMesh mesh_4(Point(0.01, 0.01, 0.01), Point(0.02, 0.02, 0.02), 1, 1, 1);
-
-    // // Completely nested 2D: can't do no more than three meshes
-    // UnitSquareMesh mesh_0(1, 1);
-    // RectangleMesh mesh_1(Point(0.1, 0.1), Point(0.9, 0.9, 1, 1);
-    // RectangleMesh mesh_2(Point(0.2, 0.2), Point(0.8, 0.8, 1, 1);
-    // RectangleMesh mesh_3(Point(0.3, 0.3), Point(0.7, 0.7, 1, 1);
-    // RectangleMesh mesh_4(Point(0.4, 0.4), Point(0.6, 0.6, 1, 1);
-
-    // // Completely nested 3D: can't do no more than three meshes
-    // UnitCubeMesh mesh_0(2, 3, 4);
-    // BoxMesh mesh_1(Point(0.1, 0.1, 0.1),    Point(0.9, 0.9, 0.9),    4, 3, 2);
-    // BoxMesh mesh_2(Point(0.2, 0.2, 0.2),    Point(0.8, 0.8, 0.8),    3, 4, 3);
-    // BoxMesh mesh_3(Point(0.8, 0.01, 0.01),  Point(0.9, 0.99, 0.99),  4, 2, 3);
-    // BoxMesh mesh_4(Point(0.01, 0.01, 0.01), Point(0.02, 0.02, 0.02), 1, 1, 1);
-
-    // Build the multimesh
-    MultiMesh multimesh;
-    multimesh.add(mesh_0);
-    multimesh.add(mesh_1);
-    multimesh.add(mesh_2);
-    multimesh.add(mesh_3);
-    multimesh.add(mesh_4);
-    multimesh.build();
-
-    // Exact volume is known
-    const double exact_volume = 1;
-    double volume = 0;
-
-    // Sum contribution from all parts
-    std::cout << "Sum contributions\n";
-    for (std::size_t part = 0; part < multimesh.num_parts(); part++)
-    {
-      std::cout << "% part " << part;
-      double part_volume = 0;
-
-      // Uncut cell volume given by function volume
-      const auto uncut_cells = multimesh.uncut_cells(part);
-      for (auto it = uncut_cells.begin(); it != uncut_cells.end(); ++it)
-      {
-        const Cell cell(*multimesh.part(part), *it);
-        volume += cell.volume();
-        part_volume += cell.volume();
-      }
-
-      std::cout << "\t uncut volume "<< part_volume<<' ';
-
-      // Cut cell volume given by quadrature rule
-      const auto& cut_cells = multimesh.cut_cells(part);
-      for (auto it = cut_cells.begin(); it != cut_cells.end(); ++it)
-      {
-        const auto& qr = multimesh.quadrature_rule_cut_cell(part, *it);
-        for (std::size_t i = 0; i < qr.second.size(); ++i)
-        {
-          volume += qr.second[i];
-          part_volume += qr.second[i];
-        }
-      }
-      std::cout << "\ttotal volume " << part_volume<< std::endl;
-    }
-
-    std::cout<<std::setprecision(13) << "exact volume " << exact_volume<<'\n'
-              << "volume " << volume<<std::endl;
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(exact_volume, volume, DOLFIN_EPS_LARGE);
-  }
-
-  void test_multiple_meshes_interface_quadrature()
-  {
-    // // These three meshes are ok
-    // UnitSquareMesh mesh_0(1, 1);
-    // RectangleMesh mesh_1(Point(0.1, 0.1), Point(0.9, 0.9), 1, 1);
-    // RectangleMesh mesh_2(Point(0.2, 0.2), Point(0.8, 0.8), 1, 1);
-    // double exact_volume = 4*(0.9-0.1); // mesh0 and mesh1
-    // exact_volume += 4*(0.8-0.2); // mesh1 and mesh2
-
-    // UnitCubeMesh mesh_0(1, 2, 3);
-    // BoxMesh mesh_1(Point(0.1, 0.1, 0.1),    Point(0.9, 0.9, 0.9),  2,3,4); //2, 3, 4);
-    // BoxMesh mesh_2(Point(-0.1, -0.1, -0.1), Point(0.7, 0.7, 0.7),  4, 3, 2);
-    // BoxMesh mesh_3(Point(0.51, 0.51, 0.51), Point( 0.7, 0.7, 0.7), 1, 1, 1); //4, 3, 2);
-    // BoxMesh mesh_4(Point(0.3, 0.3, 0.3),    Point(0.7, 0.7, 0.7),  1, 1, 1);
-    // double exact_volume = 0.8*0.8*6; // for mesh_0 and mesh_1
-    // exact_volume += 0.4*0.4*6; // for mesh_1 and mesh_4
-
-    UnitCubeMesh mesh_0(1, 1, 1);
-    BoxMesh mesh_1(Point(0.1, 0.1, 0.1), Point(0.9, 0.9, 0.9), 1, 1, 1);
-    BoxMesh mesh_2(Point(0.2, 0.2, 0.2), Point(0.8, 0.8, 0.8), 1, 1, 1);
-    // BoxMesh mesh_3(Point(0.51, 0.51, 0.51), Point(0.7, 0.7, 0.7), 1, 1, 1); //4, 3, 2);
-    // BoxMesh mesh_4(Point(0.3, 0.3, 0.3),    Point(0.7, 0.7, 0.7), 1, 1, 1);
-    double exact_volume = (0.9 - 0.1)*(0.9 - 0.1)*6; // for mesh_0 and mesh_1
-    exact_volume += (0.8 - 0.2)*(0.8 - 0.2)*6; // mesh_1 and mesh_2
-
-    // UnitCubeMesh mesh_0(1, 1, 1);
-    // MeshEditor editor;
-    // Mesh mesh_1;
-    // editor.open(mesh_1, 3, 3);
-    // editor.init_vertices(4);
-    // editor.init_cells(1);
-    // editor.add_vertex(0, Point(0.7, 0.1, -0.1));
-    // editor.add_vertex(1, Point(0.7, 0.3, -0.1));
-    // editor.add_vertex(2, Point(0.5, 0.1, -0.1));
-    // editor.add_vertex(3, Point(0.7, 0.1, 0.1));
-    // editor.add_cell(0, 0,1,2,3);
-    // editor.close();
-
-    // Mesh mesh_2;
-    // editor.open(mesh_2, 3,3);
-    // editor.init_vertices(4);
-    // editor.init_cells(1);
-    // editor.add_vertex(0, Point(0.7, 0.1, -0.2));
-    // editor.add_vertex(1, Point(0.7, 0.3, -0.2));
-    // editor.add_vertex(2, Point(0.5, 0.1, -0.2));
-    // editor.add_vertex(3, Point(0.7, 0.1, 0.05));
-    // editor.add_cell(0, 0,1,2,3);
-    // editor.close();
-
-    //double exact_volume = 0.8*0.8*6; // for mesh_0 and mesh_1
-    //exact_volume += 0.4*0.4*6; // for mesh_1 and mesh_4
-
-    // MeshEditor editor;
-    // Mesh mesh_0;
-    // editor.open(mesh_0, 2, 2);
-    // editor.init_vertices(3);
-    // editor.init_cells(1);
-    // editor.add_vertex(0, Point(0.,0.));
-    // editor.add_vertex(1, Point(2.,0.));
-    // editor.add_vertex(2, Point(1.,2.));
-    // editor.add_cell(0, 0,1,2);
-    // editor.close();
-
-    // Mesh mesh_1;
-    // editor.open(mesh_1, 2, 2);
-    // editor.init_vertices(3);
-    // editor.init_cells(1);
-    // editor.add_vertex(0, Point(0.,-0.5));
-    // editor.add_vertex(1, Point(2.,-0.5));
-    // editor.add_vertex(2, Point(1.,1.5));
-    // editor.add_cell(0, 0,1,2);
-    // editor.close();
-
-    // Mesh mesh_2;
-    // editor.open(mesh_2, 2, 2);
-    // editor.init_vertices(3);
-    // editor.init_cells(1);
-    // editor.add_vertex(0, Point(0.,-1.));
-    // editor.add_vertex(1, Point(2.,-1.));
-    // editor.add_vertex(2, Point(1.,1.));
-    // editor.add_cell(0, 0,1,2);
-    // editor.close();
-
-    // double exact_volume = 2*std::sqrt(0.75*0.75 + 1.5*1.5); // mesh_0 and mesh_1
-    // exact_volume += 2*std::sqrt(0.5*0.5 + 1*1); // mesh_0 and mesh_2
-    // exact_volume += 2*std::sqrt(0.75*0.75 + 1.5*1.5); // mesh_1and mesh_2
-    // double volume = 0;
-
-    // // These three meshes are ok.
-    // MeshEditor editor;
-    // Mesh mesh_0;
-    // editor.open(mesh_0, 2, 2);
-    // editor.init_vertices(3);
-    // editor.init_cells(1);
-    // editor.add_vertex(0, Point(0.,0.));
-    // editor.add_vertex(1, Point(2.,0.));
-    // editor.add_vertex(2, Point(1.,2.));
-    // editor.add_cell(0, 0,1,2);
-    // editor.close();
-
-    // Mesh mesh_1;
-    // editor.open(mesh_1, 2, 2);
-    // editor.init_vertices(3);
-    // editor.init_cells(1);
-    // editor.add_vertex(0, Point(1.5,-2.));
-    // editor.add_vertex(1, Point(4.,0.));
-    // editor.add_vertex(2, Point(1.5,2));
-    // editor.add_cell(0, 0,1,2);
-    // editor.close();
-
-    // Mesh mesh_2;
-    // editor.open(mesh_2, 2, 2);
-    // editor.init_vertices(3);
-    // editor.init_cells(1);
-    // editor.add_vertex(0, Point(3.,0.5));
-    // editor.add_vertex(1, Point(-1.,0.5));
-    // editor.add_vertex(2, Point(1.,-1.5));
-    // editor.add_cell(0, 0,1,2);
-    // editor.close();
-
-    // double exact_volume = (1.5-0.25) + (1-0.5); // mesh_0, mesh_1 and mesh_2
-    // exact_volume += (3-1.5) + std::sqrt(1.5*1.5 + 1.5*1.5); // mesh_1 and mesh_2
-
-    File("mesh_0.xml") << mesh_0;
-    File("mesh_1.xml") << mesh_1;
-    File("mesh_2.xml") << mesh_2;
-
-    // Build the multimesh
-    MultiMesh multimesh;
-    multimesh.add(mesh_0);
-    multimesh.add(mesh_1);
-    multimesh.add(mesh_2);
-    //multimesh.add(mesh_3);
-    //multimesh.add(mesh_4);
-    multimesh.build();
-
-    // Sum contribution from all parts
-    std::cout << "\n\n Sum up\n\n";
-    double volume = 0;
-    for (std::size_t part = 0; part < multimesh.num_parts(); part++)
-    {
-      std::cout << "% part " << part << '\n';
-      double part_volume = 0;
-
-      const auto& quadrature_rules = multimesh.quadrature_rule_interface(part);
-
-      // Get collision map
-      const auto& cmap = multimesh.collision_map_cut_cells(part);
-      for (auto it = cmap.begin(); it != cmap.end(); ++it)
-      {
-        const unsigned int cut_cell_index = it->first;
-
-        // Iterate over cutting cells
-        const auto& cutting_cells = it->second;
-        for (auto jt = cutting_cells.begin(); jt != cutting_cells.end(); jt++)
-        {
-          //const std::size_t cutting_part = jt->first;
-          //const std::size_t cutting_cell_index = jt->second;
-
-          // Get quadrature rule for interface part defined by
-          // intersection of the cut and cutting cells
-          const std::size_t k = jt - cutting_cells.begin();
-          dolfin_assert(k < quadrature_rules.at(cut_cell_index).size());
-          const auto& qr = quadrature_rules.at(cut_cell_index)[k];
-
-          for (std::size_t j = 0; j < qr.second.size(); ++j)
-          {
-            volume += qr.second[j];
-            part_volume += qr.second[j];
-          }
-
-        }
-      }
-
-      std::cout<<"part volume " << part_volume<<std::endl;
-    }
-
-    std::cout << "exact volume " << exact_volume<<'\n'
-              << "volume " << volume<<std::endl;
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(exact_volume, volume, DOLFIN_EPS_LARGE);
-  }
-
-  void test_assembly()
-  {
-    // Set some parameters
-    parameters["reorder_dofs_serial"] = false;
-
-    // Some parameters
-    const std::size_t N = 4;
-    const std::size_t n = 2;
-    const double b1 = 1.0;
-    const double b2 = 1.0;
-
-    // Right-hand side
-    class Source : public Expression
-    {
-    public:
-      Source() : Expression(2) {}
-
-      void eval(Array<double>& values, const Array<double>& x) const
-      {
-        values[0] = 2*DOLFIN_PI*sin(2*DOLFIN_PI*x[1])*
-          (cos(2*DOLFIN_PI*x[0]) -
-           2*DOLFIN_PI*DOLFIN_PI*cos(2*DOLFIN_PI*x[0]) +
-           DOLFIN_PI*DOLFIN_PI);
-        values[1] = 2*DOLFIN_PI*sin(2*DOLFIN_PI*x[0])*
-          (cos(2*DOLFIN_PI*x[1]) +
-           2*DOLFIN_PI*DOLFIN_PI*cos(2*DOLFIN_PI*x[1]) -
-           DOLFIN_PI*DOLFIN_PI);
-      }
-    } source;
-
-    // Subdomain for no-slip boundary
-    class DirichletBoundary : public SubDomain
-    {
-      bool inside(const Array<double>& x, bool on_boundary) const
-      {
-        return on_boundary and
-          (near(x[0], 0) || near(x[0], 1) ||
-           near(x[1], 0) || near(x[1], 1));
-      }
-    } dirichlet_boundary;
-
-    // Create meshes
-    UnitSquareMesh mesh_0(N, N);
-    const double c = 0.123123;
-    RectangleMesh mesh_1(Point(0.5 - c, 0.5 - c), Point(0.5 + c, 0.5 + c), n, n);
-    mesh_1.rotate(37, 2);
-
-    // Create function spaces
-    MultiMeshStokes2D::FunctionSpace W0(mesh_0);
-    MultiMeshStokes2D::FunctionSpace W1(mesh_1);
-
-    // Create forms
-    MultiMeshStokes2D::BilinearForm a0(W0, W0);
-    MultiMeshStokes2D::BilinearForm a1(W1, W1);
-    MultiMeshStokes2D::LinearForm L0(W0);
-    MultiMeshStokes2D::LinearForm L1(W1);
-    MultiMeshStokes2D::Functional M0(mesh_0);
-    MultiMeshStokes2D::Functional M1(mesh_1);
-
-    // Build multimesh function space
-    MultiMeshFunctionSpace W;
-    W.parameters("multimesh")["quadrature_order"] = 3;
-    W.add(W0);
-    W.add(W1);
-    W.build();
-
-    // Create constants
-    Constant beta_1(b1);
-    Constant beta_2(b2);
-
-    // Create solution function
-    MultiMeshFunction w(W);
-
-    // Set coefficients
-    a0.w0 = beta_1;
-    a1.w0 = beta_1;
-    a0.w1 = beta_2;
-    a1.w1 = beta_2;
-    L0.w0 = source;
-    L1.w0 = source;
-    L0.w1 = beta_2;
-    L1.w1 = beta_2;
-    M0.w0 = *w.part(0);
-    M1.w0 = *w.part(1);
-
-    // Build multimesh forms
-    MultiMeshForm a(W, W);
-    MultiMeshForm L(W);
-    MultiMeshForm M(W);
-    a.add(a0);
-    a.add(a1);
-    L.add(L0);
-    L.add(L1);
-    M.add(M0);
-    M.add(M1);
-    a.build();
-    L.build();
-    M.build();
-
-    // Create subspaces for boundary conditions
-    MultiMeshSubSpace V(W, 0);
-    MultiMeshSubSpace Q(W, 1);
-
-    // Create boundary condition
-    Constant zero(0, 0);
-    MultiMeshDirichletBC bc(V, zero, dirichlet_boundary);
-
-    // Assemble system matrix and right-hand side
-    Matrix A;
-    Vector b;
-    MultiMeshAssembler assembler;
-    assembler.assemble(A, a);
-    assembler.assemble(b, L);
-
-    // Apply boundary condition
-    bc.apply(A, b);
-
-    // Compute solutipon
-    solve(A, *w.vector(), b);
-
-    // Compute squared L2 norm of solution
-    Scalar m;
-    assembler.assemble(m, M);
-
-    // Check value
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(2.217133856286212, m.get_scalar_value(), 1e-12);
-  }
-
-};
-
-int main()
-{
-  // Test not working in parallel
-  if (dolfin::MPI::size(MPI_COMM_WORLD) > 1)
-  {
-    info("Skipping unit test in parallel.");
-    info("OK");
-    return 0;
-  }
-
-  CPPUNIT_TEST_SUITE_REGISTRATION(MultiMeshes);
-  DOLFIN_TEST;
-}
diff --git a/test/unit/multimesh/cpp/MultiMeshStokes2D.h b/test/unit/multimesh/cpp/MultiMeshStokes2D.h
deleted file mode 100644
index f5f354f..0000000
--- a/test/unit/multimesh/cpp/MultiMeshStokes2D.h
+++ /dev/null
@@ -1,20923 +0,0 @@
-// This code conforms with the UFC specification version 1.6.0
-// and was automatically generated by FFC version 1.6.0.
-//
-// This code was generated with the option '-l dolfin' and
-// contains DOLFIN-specific wrappers that depend on DOLFIN.
-// 
-// This code was generated with the following parameters:
-// 
-//   convert_exceptions_to_warnings: False
-//   cpp_optimize:                   True
-//   cpp_optimize_flags:             '-O2'
-//   epsilon:                        1e-14
-//   error_control:                  False
-//   form_postfix:                   True
-//   format:                         'dolfin'
-//   no_ferari:                      True
-//   optimize:                       True
-//   precision:                      15
-//   quadrature_degree:              'auto'
-//   quadrature_rule:                'auto'
-//   representation:                 'auto'
-//   restrict_keyword:               ''
-//   split:                          False
-
-#ifndef __MULTIMESHSTOKES2D_H
-#define __MULTIMESHSTOKES2D_H
-
-#include <cmath>
-#include <stdexcept>
-#include <fstream>
-#include <ufc.h>
-
-/// This class defines the interface for a finite element.
-
-class multimeshstokes2d_finite_element_0: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_finite_element_0() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_finite_element_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 1;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    
-    // Get coordinates and map to the reference (FIAT) element
-    
-    // Reset values
-    *values = 0.0;
-    
-    // Array of basisvalues
-    double basisvalues[1] = {0.0};
-    
-    // Declare helper variables
-    
-    // Compute basisvalues
-    basisvalues[0] = 1.0;
-    
-    // Table(s) of coefficients
-    static const double coefficients0[1] = \
-    {1.0};
-    
-    // Compute value(s)
-    for (unsigned int r = 0; r < 1; r++)
-    {
-      *values += coefficients0[r]*basisvalues[r];
-    } // end loop over 'r'
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis.
-    _evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 0)
-    {
-    return ;
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Element is constant, calling evaluate_basis_derivatives.
-    _evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[0];
-    vertex_values[2] = dof_values[0];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new multimeshstokes2d_finite_element_0();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class multimeshstokes2d_finite_element_1: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_finite_element_1() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_finite_element_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 10;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[8][3];
-    for (unsigned int row = 0; row < 8; row++)
-    {
-      for (unsigned int col = 0; col < 3; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[8][8];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[8];
-    for (unsigned int r = 0; r < 8; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 10; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new multimeshstokes2d_finite_element_1();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class multimeshstokes2d_finite_element_2: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_finite_element_2() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_finite_element_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "VectorElement('Lagrange', Domain(Cell('triangle', 2)), 3, 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 20;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 10:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 12:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 13:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 14:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 15:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 16:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 17:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 18:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 19:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[2] = {0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 20; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2; s++)
-      {
-        values[r*2 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 2*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[8][3];
-    for (unsigned int row = 0; row < 8; row++)
-    {
-      for (unsigned int col = 0; col < 3; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[8][8];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 10:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 12:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 13:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 14:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 15:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 16:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 17:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 18:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 19:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 20; r++)
-    {
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[16];
-    for (unsigned int r = 0; r < 16; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 20; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 2*num_derivatives; s++)
-      {
-        values[r*2*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 10:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 12:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 13:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 14:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 15:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 16:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 17:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 18:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 19:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[2];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[12] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[13] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[14] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[15] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[16] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[17] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[18] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[19] = vals[1];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[2] = dof_values[1];
-    vertex_values[4] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[10];
-    vertex_values[3] = dof_values[11];
-    vertex_values[5] = dof_values[12];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_finite_element_1();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes2d_finite_element_1();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new multimeshstokes2d_finite_element_2();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class multimeshstokes2d_finite_element_3: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_finite_element_3() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_finite_element_3()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 6;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 0;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    return 1;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    *values = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        *values += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values = 0.0;
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
-      values[r] = dof_values;
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[4][2];
-    for (unsigned int row = 0; row < 4; row++)
-    {
-      for (unsigned int col = 0; col < 2; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[4][4];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[4];
-      for (unsigned int r = 0; r < 4; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 2)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[4];
-    for (unsigned int r = 0; r < 4; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 6; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < num_derivatives; s++)
-      {
-        values[r*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[1];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[1] = dof_values[1];
-    vertex_values[2] = dof_values[2];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 0;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new multimeshstokes2d_finite_element_3();
-  }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class multimeshstokes2d_finite_element_4: public ufc::finite_element
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_finite_element_4() : ufc::finite_element()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_finite_element_4()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the finite element
-  virtual const char* signature() const
-  {
-    return "MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 3, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None), **{'value_shape': (3,) })";
-  }
-
-  /// Return the cell shape
-  virtual ufc::shape cell_shape() const
-  {
-    return ufc::triangle;
-  }
-
-  /// Return the topological dimension of the cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the finite element function space
-  virtual std::size_t space_dimension() const
-  {
-    return 26;
-  }
-
-  /// Return the rank of the value space
-  virtual std::size_t value_rank() const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the value space for axis i
-  virtual std::size_t value_dimension(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Evaluate basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation)
-  {
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Reset values
-    values[0] = 0.0;
-    values[1] = 0.0;
-    values[2] = 0.0;
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[0] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 10:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 12:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 13:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 14:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 15:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 16:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 17:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 18:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 19:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 10; r++)
-      {
-        values[1] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 20:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 21:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 22:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 23:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 24:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    case 25:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Compute value(s)
-      for (unsigned int r = 0; r < 6; r++)
-      {
-        values[2] += coefficients0[r]*basisvalues[r];
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis(std::size_t i,
-                              double* values,
-                              const double* x,
-                              const double* vertex_coordinates,
-                              int cell_orientation) const
-  {
-    _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation)
-  {
-    // Helper variable to hold values of a single dof.
-    double dof_values[3] = {0.0, 0.0, 0.0};
-    
-    // Loop dofs and call evaluate_basis
-    for (unsigned int r = 0; r < 26; r++)
-    {
-      _evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3; s++)
-      {
-        values[r*3 + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_all(double* values,
-                                  const double* x,
-                                  const double* vertex_coordinates,
-                                  int cell_orientation) const
-  {
-    _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation)
-  {
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Reset values. Assuming that values is always an array.
-    for (unsigned int r = 0; r < 3*num_derivatives; r++)
-    {
-      values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Call evaluate_basis if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis(i, values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-    return ;
-    }
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    
-    // Compute constants
-    const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
-    const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
-    
-    // Get coordinates and map to the reference (FIAT) element
-    double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
-    double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
-    
-    // Declare two dimensional array that holds combinations of derivatives and initialise
-    unsigned int combinations[8][3];
-    for (unsigned int row = 0; row < 8; row++)
-    {
-      for (unsigned int col = 0; col < 3; col++)
-        combinations[row][col] = 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] = {{K[0], K[1]}, {K[2], K[3]}};
-    
-    // Declare transformation matrix
-    // Declare pointer to two dimensional array and initialise
-    double transform[8][8];
-    for (unsigned int j = 0; j < num_derivatives; j++)
-    {
-      for (unsigned int k = 0; k < num_derivatives; k++)
-        transform[j][k] = 1;
-    }
-    
-    // Construct transformation matrix
-    for (unsigned int row = 0; row < num_derivatives; row++)
-    {
-      for (unsigned int col = 0; col < num_derivatives; col++)
-      {
-        for (unsigned int k = 0; k < n; k++)
-          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
-      }
-    }
-    switch (i)
-    {
-    case 0:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 1:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 2:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 3:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 4:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 5:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 6:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 7:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 8:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 9:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 10:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, -0.0288675134594813, -0.0166666666666667, 0.0782460796435951, 0.0606091526731326, 0.0349927106111883, -0.0601337794302955, -0.0508223195384204, -0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 11:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0288675134594813, -0.0166666666666666, 0.0782460796435952, -0.0606091526731327, 0.0349927106111883, 0.0601337794302955, -0.0508223195384204, 0.0393667994375868, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 12:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.0471404520791032, 0.0, 0.0333333333333334, 0.0, 0.0, 0.104978131833565, 0.0, 0.0, 0.0, 0.0909137290096989};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 13:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, 0.117369119465393, 0.0606091526731327, -0.0787335988751736, 0.0, 0.101644639076841, -0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 14:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, 0.151522881682832, 0.0262445329583912, 0.0, 0.0, 0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 15:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, 0.117369119465393, -0.0606091526731326, -0.0787335988751736, 0.0, 0.101644639076841, 0.131222664791956, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 16:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.0, 0.3, 0.0, -0.151522881682832, 0.0262445329583912, 0.0, 0.0, -0.131222664791956, -0.136370593514548};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 17:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, -0.259807621135332, -0.15, -0.0782460796435952, 0.090913729009699, 0.0962299541807677, 0.180401338290886, 0.0508223195384204, -0.0131222664791956, -0.0227284322524247};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 18:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.106066017177982, 0.259807621135332, -0.15, -0.0782460796435952, -0.090913729009699, 0.0962299541807678, -0.180401338290886, 0.0508223195384204, 0.0131222664791956, -0.0227284322524248};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 19:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[6] = basisvalues[3]*1.66666666666667*tmp0 - basisvalues[1]*0.666666666666667*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[7] = basisvalues[3]*(2.5 + 3.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[9] = basisvalues[5]*(0.05 + Y*1.75) - basisvalues[2]*0.7;
-      basisvalues[8] = basisvalues[4]*(0.54 + Y*2.1) - basisvalues[1]*0.56;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[9] *= std::sqrt(2.0);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[8] *= std::sqrt(6.0);
-      basisvalues[3] *= std::sqrt(7.5);
-      basisvalues[7] *= std::sqrt(10.0);
-      basisvalues[6] *= std::sqrt(14.0);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[10] = \
-      {0.636396103067893, 0.0, 0.0, -0.234738238930785, 0.0, -0.262445329583912, 0.0, -0.203289278153682, 0.0, 0.090913729009699};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {5.29150262212919, -4.18873211845248e-14, -2.99332590941916, 13.6626010212795, 0.0, 0.611010092660781, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 4.38178046004134, 0.0, 0.0, 12.5219806739988, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {3.46410161513776, 0.0, 7.83836717690618, 0.0, 0.0, 8.40000000000001, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[10][10] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711929, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025258, -0.912870929175279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {1.99999999999992, 6.12372435695794, 3.53553390593274, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.64575131106457, 5.18459255872626, -1.49666295470957, 6.83130051063973, -1.05830052442583, 0.30550504633039, 0.0, 0.0, 0.0, 0.0},
-      {2.23606797749982, 2.19089023002067, 2.52982212813468, 8.08290376865477, 6.26099033699941, -1.80739222823012, 0.0, 0.0, 0.0, 0.0},
-      {1.73205080756888, -5.09116882454314, 3.9191835884531, 0.0, 9.69948452238569, 4.20000000000001, 0.0, 0.0, 0.0, 1.15463194561016e-14},
-      {5.00000000000002, 0.0, -2.82842712474623, 0.0, 0.0, 12.1243556529822, 0.0, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[10][10] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 10; t++)
-        {
-          for (unsigned int u = 0; u < 10; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            for (unsigned int u = 0; u < 10; u++)
-            {
-              for (unsigned int tu = 0; tu < 10; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 10; s++)
-        {
-          for (unsigned int t = 0; t < 10; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 20:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582063, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 21:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582064, 0.0544331053951818};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 22:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.0, 0.0, 0.2, 0.0, 0.0, 0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 23:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.23094010767585, 0.133333333333333, 0.0, 0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 24:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, -0.23094010767585, 0.133333333333333, 0.0, -0.188561808316413, -0.163299316185545};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    case 25:
-      {
-        
-      // Array of basisvalues
-      double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      
-      // Declare helper variables
-      double tmp0 = (1.0 + Y + 2.0*X)/2.0;
-      double tmp1 = (1.0 - Y)/2.0;
-      double tmp2 = tmp1*tmp1;
-      
-      // Compute basisvalues
-      basisvalues[0] = 1.0;
-      basisvalues[1] = tmp0;
-      basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
-      basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
-      basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
-      basisvalues[5] = basisvalues[2]*(0.111111111111111 + Y*1.66666666666667) - basisvalues[0]*0.555555555555556;
-      basisvalues[0] *= std::sqrt(0.5);
-      basisvalues[2] *= std::sqrt(1.0);
-      basisvalues[5] *= std::sqrt(1.5);
-      basisvalues[1] *= std::sqrt(3.0);
-      basisvalues[4] *= std::sqrt(4.5);
-      basisvalues[3] *= std::sqrt(7.5);
-      
-      // Table(s) of coefficients
-      static const double coefficients0[6] = \
-      {0.471404520791032, 0.0, -0.266666666666667, -0.243432247780074, 0.0, 0.0544331053951817};
-      
-      // Tables of derivatives of the polynomial base (transpose).
-      static const double dmats0[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.89897948556635, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 9.48683298050515, 0.0, 0.0, 0.0, 0.0},
-      {3.99999999999999, 0.0, 7.07106781186547, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
-      
-      static const double dmats1[6][6] = \
-      {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.44948974278318, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {4.24264068711928, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {2.58198889747162, 4.74341649025257, -0.91287092917528, 0.0, 0.0, 0.0},
-      {1.99999999999991, 6.12372435695794, 3.53553390593273, 0.0, 0.0, 0.0},
-      {-2.30940107675849, 0.0, 8.16496580927727, 0.0, 0.0, 0.0}};
-      
-      // Compute reference derivatives.
-      // Declare array of derivatives on FIAT element.
-      double derivatives[8];
-      for (unsigned int r = 0; r < 8; r++)
-      {
-        derivatives[r] = 0.0;
-      } // end loop over 'r'
-      
-      // Declare derivative matrix (of polynomial basis).
-      double dmats[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Declare (auxiliary) derivative matrix (of polynomial basis).
-      double dmats_old[6][6] = \
-      {{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
-      {0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
-      
-      // Loop possible derivatives.
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        // Resetting dmats values to compute next derivative.
-        for (unsigned int t = 0; t < 6; t++)
-        {
-          for (unsigned int u = 0; u < 6; u++)
-          {
-            dmats[t][u] = 0.0;
-            if (t == u)
-            {
-            dmats[t][u] = 1.0;
-            }
-            
-          } // end loop over 'u'
-        } // end loop over 't'
-        
-        // Looping derivative order to generate dmats.
-        for (unsigned int s = 0; s < n; s++)
-        {
-          // Updating dmats_old with new values and resetting dmats.
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              dmats_old[t][u] = dmats[t][u];
-              dmats[t][u] = 0.0;
-            } // end loop over 'u'
-          } // end loop over 't'
-          
-          // Update dmats using an inner product.
-          if (combinations[r][s] == 0)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-          if (combinations[r][s] == 1)
-          {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            for (unsigned int u = 0; u < 6; u++)
-            {
-              for (unsigned int tu = 0; tu < 6; tu++)
-              {
-                dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
-              } // end loop over 'tu'
-            } // end loop over 'u'
-          } // end loop over 't'
-          }
-          
-        } // end loop over 's'
-        for (unsigned int s = 0; s < 6; s++)
-        {
-          for (unsigned int t = 0; t < 6; t++)
-          {
-            derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
-          } // end loop over 't'
-        } // end loop over 's'
-      } // end loop over 'r'
-      
-      // Transform derivatives back to physical element
-      for (unsigned int r = 0; r < num_derivatives; r++)
-      {
-        for (unsigned int s = 0; s < num_derivatives; s++)
-        {
-          values[2*num_derivatives + r] += transform[r][s]*derivatives[s];
-        } // end loop over 's'
-      } // end loop over 'r'
-        break;
-      }
-    }
-    
-  }
-
-  /// Evaluate order n derivatives of basis function i at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives(std::size_t i,
-                                          std::size_t n,
-                                          double* values,
-                                          const double* x,
-                                          const double* vertex_coordinates,
-                                          int cell_orientation) const
-  {
-    _evaluate_basis_derivatives(i, n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (actual implementation)
-  static void _evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation)
-  {
-    // Call evaluate_basis_all if order of derivatives is equal to zero.
-    if (n == 0)
-    {
-      _evaluate_basis_all(values, x, vertex_coordinates, cell_orientation);
-      return ;
-    }
-    
-    // Compute number of derivatives.
-    unsigned int num_derivatives = 1;
-    for (unsigned int r = 0; r < n; r++)
-    {
-      num_derivatives *= 2;
-    } // end loop over 'r'
-    
-    // Set values equal to zero.
-    for (unsigned int r = 0; r < 26; r++)
-    {
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = 0.0;
-      } // end loop over 's'
-    } // end loop over 'r'
-    
-    // If order of derivatives is greater than the maximum polynomial degree, return zeros.
-    if (n > 3)
-    {
-      return ;
-    }
-    
-    // Helper variable to hold values of a single dof.
-    double dof_values[24];
-    for (unsigned int r = 0; r < 24; r++)
-    {
-      dof_values[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Loop dofs and call evaluate_basis_derivatives.
-    for (unsigned int r = 0; r < 26; r++)
-    {
-      _evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
-      for (unsigned int s = 0; s < 3*num_derivatives; s++)
-      {
-        values[r*3*num_derivatives + s] = dof_values[s];
-      } // end loop over 's'
-    } // end loop over 'r'
-  }
-
-  /// Evaluate order n derivatives of all basis functions at given point x in cell (non-static member function)
-  virtual void evaluate_basis_derivatives_all(std::size_t n,
-                                              double* values,
-                                              const double* x,
-                                              const double* vertex_coordinates,
-                                              int cell_orientation) const
-  {
-    _evaluate_basis_derivatives_all(n, values, x, vertex_coordinates, cell_orientation);
-  }
-
-  /// Evaluate linear functional for dof i on the function f
-  virtual double evaluate_dof(std::size_t i,
-                              const ufc::function& f,
-                              const double* vertex_coordinates,
-                              int cell_orientation,
-                              const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    switch (i)
-    {
-    case 0:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 1:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 2:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 3:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 4:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 5:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 6:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 7:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 8:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 9:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[0];
-        break;
-      }
-    case 10:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 11:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 12:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 13:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 14:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 15:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 16:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 17:
-      {
-        y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-      y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 18:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 19:
-      {
-        y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-      y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[1];
-        break;
-      }
-    case 20:
-      {
-        y[0] = vertex_coordinates[0];
-      y[1] = vertex_coordinates[1];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 21:
-      {
-        y[0] = vertex_coordinates[2];
-      y[1] = vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 22:
-      {
-        y[0] = vertex_coordinates[4];
-      y[1] = vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 23:
-      {
-        y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 24:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    case 25:
-      {
-        y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-      y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-      f.evaluate(vals, y, c);
-      return vals[2];
-        break;
-      }
-    }
-    
-    return 0.0;
-  }
-
-  /// Evaluate linear functionals for all dofs on the function f
-  virtual void evaluate_dofs(double* values,
-                             const ufc::function& f,
-                             const double* vertex_coordinates,
-                             int cell_orientation,
-                             const ufc::cell& c) const
-  {
-    // Declare variables for result of evaluation
-    double vals[3];
-    
-    // Declare variable for physical coordinates
-    double y[2];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[0] = vals[0];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[1] = vals[0];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[2] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[3] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[4] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[5] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[6] = vals[0];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[7] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[8] = vals[0];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[9] = vals[0];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[10] = vals[1];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[11] = vals[1];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[12] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[13] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[14] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[15] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[16] = vals[1];
-    y[0] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    y[1] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[17] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[18] = vals[1];
-    y[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    y[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[19] = vals[1];
-    y[0] = vertex_coordinates[0];
-    y[1] = vertex_coordinates[1];
-    f.evaluate(vals, y, c);
-    values[20] = vals[2];
-    y[0] = vertex_coordinates[2];
-    y[1] = vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[21] = vals[2];
-    y[0] = vertex_coordinates[4];
-    y[1] = vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[22] = vals[2];
-    y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[23] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    f.evaluate(vals, y, c);
-    values[24] = vals[2];
-    y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-    f.evaluate(vals, y, c);
-    values[25] = vals[2];
-  }
-
-  /// Interpolate vertex values from dof values
-  virtual void interpolate_vertex_values(double* vertex_values,
-                                         const double* dof_values,
-                                         const double* vertex_coordinates,
-                                         int cell_orientation,
-                                         const ufc::cell& c) const
-  {
-    // Evaluate function and change variables
-    vertex_values[0] = dof_values[0];
-    vertex_values[3] = dof_values[1];
-    vertex_values[6] = dof_values[2];
-    // Evaluate function and change variables
-    vertex_values[1] = dof_values[10];
-    vertex_values[4] = dof_values[11];
-    vertex_values[7] = dof_values[12];
-    // Evaluate function and change variables
-    vertex_values[2] = dof_values[20];
-    vertex_values[5] = dof_values[21];
-    vertex_values[8] = dof_values[22];
-  }
-
-  /// Map coordinate xhat from reference cell to coordinate x in cell
-  virtual void map_from_reference_cell(double* x,
-                                       const double* xhat,
-                                       const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_from_reference_cell not yet implemented.");
-  }
-
-  /// Map from coordinate x in cell to coordinate xhat in reference cell
-  virtual void map_to_reference_cell(double* xhat,
-                                     const double* x,
-                                     const ufc::cell& c) const
-  {
-    throw std::runtime_error("map_to_reference_cell not yet implemented.");
-  }
-
-  /// Return the number of sub elements (for a mixed element)
-  virtual std::size_t num_sub_elements() const
-  {
-    return 2;
-  }
-
-  /// Create a new finite element for sub element i (for a mixed element)
-  virtual ufc::finite_element* create_sub_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_finite_element_2();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes2d_finite_element_3();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::finite_element* create() const
-  {
-    return new multimeshstokes2d_finite_element_4();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class multimeshstokes2d_dofmap_0: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_dofmap_0() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_dofmap_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for FiniteElement('Real', Domain(Cell('triangle', 2)), 0, None)";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return false;
-        break;
-      }
-    case 1:
-      {
-        return false;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 1;
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 1;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 0;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 0;
-        break;
-      }
-    case 1:
-      {
-        return 0;
-        break;
-      }
-    case 2:
-      {
-        return 1;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    dofs[0] = 0;
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        
-        break;
-      }
-    case 1:
-      {
-        
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 0;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[1] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new multimeshstokes2d_dofmap_0();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class multimeshstokes2d_dofmap_1: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_dofmap_1() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_dofmap_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 3, None)";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return true;
-        break;
-      }
-    case 2:
-      {
-        return true;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0] + 2*num_global_entities[1] + num_global_entities[2];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 10;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 4;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 2;
-        break;
-      }
-    case 2:
-      {
-        return 1;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 5;
-      dofs[3] = 6;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 7;
-      dofs[3] = 8;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 4;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 5;
-        dofs[1] = 6;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 7;
-        dofs[1] = 8;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 9;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new multimeshstokes2d_dofmap_1();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class multimeshstokes2d_dofmap_2: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_dofmap_2() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_dofmap_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for VectorElement('Lagrange', Domain(Cell('triangle', 2)), 3, 2, None)";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return true;
-        break;
-      }
-    case 2:
-      {
-        return true;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 2*num_global_entities[0] + 4*num_global_entities[1] + 2*num_global_entities[2];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 20;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 8;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 2;
-        break;
-      }
-    case 1:
-      {
-        return 4;
-        break;
-      }
-    case 2:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
-    dofs[10] = offset + c.entity_indices[0][0];
-    dofs[11] = offset + c.entity_indices[0][1];
-    dofs[12] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[13] = offset + 2*c.entity_indices[1][0];
-    dofs[14] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[15] = offset + 2*c.entity_indices[1][1];
-    dofs[16] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[17] = offset + 2*c.entity_indices[1][2];
-    dofs[18] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[19] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 11;
-      dofs[5] = 12;
-      dofs[6] = 13;
-      dofs[7] = 14;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 10;
-      dofs[5] = 12;
-      dofs[6] = 15;
-      dofs[7] = 16;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 7;
-      dofs[3] = 8;
-      dofs[4] = 10;
-      dofs[5] = 11;
-      dofs[6] = 17;
-      dofs[7] = 18;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 10;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 11;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 12;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 4;
-        dofs[2] = 13;
-        dofs[3] = 14;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 5;
-        dofs[1] = 6;
-        dofs[2] = 15;
-        dofs[3] = 16;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 7;
-        dofs[1] = 8;
-        dofs[2] = 17;
-        dofs[3] = 18;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 9;
-      dofs[1] = 19;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[20] = vertex_coordinates[0];
-    dof_coordinates[21] = vertex_coordinates[1];
-    dof_coordinates[22] = vertex_coordinates[2];
-    dof_coordinates[23] = vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[4];
-    dof_coordinates[25] = vertex_coordinates[5];
-    dof_coordinates[26] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[27] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[28] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[29] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[30] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[31] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[32] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[33] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[34] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[35] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[36] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[37] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[38] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[39] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 2;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_dofmap_1();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes2d_dofmap_1();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new multimeshstokes2d_dofmap_2();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class multimeshstokes2d_dofmap_3: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_dofmap_3() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_dofmap_3()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None)";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return true;
-        break;
-      }
-    case 2:
-      {
-        return false;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return num_global_entities[0] + num_global_entities[1];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 6;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 3;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 1;
-        break;
-      }
-    case 1:
-      {
-        return 1;
-        break;
-      }
-    case 2:
-      {
-        return 0;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + c.entity_indices[1][0];
-    dofs[4] = offset + c.entity_indices[1][1];
-    dofs[5] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 4;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 5;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 4;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 5;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 2:
-      {
-        
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[7] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[8] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[9] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[10] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[11] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 0;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new multimeshstokes2d_dofmap_3();
-  }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class multimeshstokes2d_dofmap_4: public ufc::dofmap
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_dofmap_4() : ufc::dofmap()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_dofmap_4()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the dofmap
-  virtual const char* signature() const
-  {
-    return "FFC dofmap for MixedElement(VectorElement('Lagrange', Domain(Cell('triangle', 2)), 3, 2, None), FiniteElement('Lagrange', Domain(Cell('triangle', 2)), 2, None), **{'value_shape': (3,) })";
-  }
-
-  /// Return true iff mesh entities of topological dimension d are needed
-  virtual bool needs_mesh_entities(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return true;
-        break;
-      }
-    case 1:
-      {
-        return true;
-        break;
-      }
-    case 2:
-      {
-        return true;
-        break;
-      }
-    }
-    
-    return false;
-  }
-
-  /// Return the topological dimension of the associated cell shape
-  virtual std::size_t topological_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the geometric dimension of the associated cell shape
-  virtual std::size_t geometric_dimension() const
-  {
-    return 2;
-  }
-
-  /// Return the dimension of the global finite element function space
-  virtual std::size_t global_dimension(const std::vector<std::size_t>&
-                                       num_global_entities) const
-  {
-    return 3*num_global_entities[0] + 5*num_global_entities[1] + 2*num_global_entities[2];
-  }
-
-  /// Return the dimension of the local finite element function space for a cell
-  virtual std::size_t num_element_dofs() const
-  {
-    return 26;
-  }
-
-  /// Return the number of dofs on each cell facet
-  virtual std::size_t num_facet_dofs() const
-  {
-    return 11;
-  }
-
-  /// Return the number of dofs associated with each cell entity of dimension d
-  virtual std::size_t num_entity_dofs(std::size_t d) const
-  {
-    switch (d)
-    {
-    case 0:
-      {
-        return 3;
-        break;
-      }
-    case 1:
-      {
-        return 5;
-        break;
-      }
-    case 2:
-      {
-        return 2;
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Tabulate the local-to-global mapping of dofs on a cell
-  virtual void tabulate_dofs(std::size_t* dofs,
-                             const std::vector<std::size_t>& num_global_entities,
-                             const ufc::cell& c) const
-  {
-    unsigned int offset = 0;
-    dofs[0] = offset + c.entity_indices[0][0];
-    dofs[1] = offset + c.entity_indices[0][1];
-    dofs[2] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[3] = offset + 2*c.entity_indices[1][0];
-    dofs[4] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[5] = offset + 2*c.entity_indices[1][1];
-    dofs[6] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[7] = offset + 2*c.entity_indices[1][2];
-    dofs[8] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[9] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
-    dofs[10] = offset + c.entity_indices[0][0];
-    dofs[11] = offset + c.entity_indices[0][1];
-    dofs[12] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[13] = offset + 2*c.entity_indices[1][0];
-    dofs[14] = offset + 2*c.entity_indices[1][0] + 1;
-    dofs[15] = offset + 2*c.entity_indices[1][1];
-    dofs[16] = offset + 2*c.entity_indices[1][1] + 1;
-    dofs[17] = offset + 2*c.entity_indices[1][2];
-    dofs[18] = offset + 2*c.entity_indices[1][2] + 1;
-    offset += 2*num_global_entities[1];
-    dofs[19] = offset + c.entity_indices[2][0];
-    offset += num_global_entities[2];
-    dofs[20] = offset + c.entity_indices[0][0];
-    dofs[21] = offset + c.entity_indices[0][1];
-    dofs[22] = offset + c.entity_indices[0][2];
-    offset += num_global_entities[0];
-    dofs[23] = offset + c.entity_indices[1][0];
-    dofs[24] = offset + c.entity_indices[1][1];
-    dofs[25] = offset + c.entity_indices[1][2];
-    offset += num_global_entities[1];
-  }
-
-  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
-  virtual void tabulate_facet_dofs(std::size_t* dofs,
-                                   std::size_t facet) const
-  {
-    switch (facet)
-    {
-    case 0:
-      {
-        dofs[0] = 1;
-      dofs[1] = 2;
-      dofs[2] = 3;
-      dofs[3] = 4;
-      dofs[4] = 11;
-      dofs[5] = 12;
-      dofs[6] = 13;
-      dofs[7] = 14;
-      dofs[8] = 21;
-      dofs[9] = 22;
-      dofs[10] = 23;
-        break;
-      }
-    case 1:
-      {
-        dofs[0] = 0;
-      dofs[1] = 2;
-      dofs[2] = 5;
-      dofs[3] = 6;
-      dofs[4] = 10;
-      dofs[5] = 12;
-      dofs[6] = 15;
-      dofs[7] = 16;
-      dofs[8] = 20;
-      dofs[9] = 22;
-      dofs[10] = 24;
-        break;
-      }
-    case 2:
-      {
-        dofs[0] = 0;
-      dofs[1] = 1;
-      dofs[2] = 7;
-      dofs[3] = 8;
-      dofs[4] = 10;
-      dofs[5] = 11;
-      dofs[6] = 17;
-      dofs[7] = 18;
-      dofs[8] = 20;
-      dofs[9] = 21;
-      dofs[10] = 25;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
-  virtual void tabulate_entity_dofs(std::size_t* dofs,
-                                    std::size_t d, std::size_t i) const
-  {
-    if (d > 2)
-    {
-    throw std::runtime_error("d is larger than dimension (2)");
-    }
-    
-    switch (d)
-    {
-    case 0:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 0;
-        dofs[1] = 10;
-        dofs[2] = 20;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 1;
-        dofs[1] = 11;
-        dofs[2] = 21;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 2;
-        dofs[1] = 12;
-        dofs[2] = 22;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 1:
-      {
-        if (i > 2)
-      {
-      throw std::runtime_error("i is larger than number of entities (2)");
-      }
-      
-      switch (i)
-      {
-      case 0:
-        {
-          dofs[0] = 3;
-        dofs[1] = 4;
-        dofs[2] = 13;
-        dofs[3] = 14;
-        dofs[4] = 23;
-          break;
-        }
-      case 1:
-        {
-          dofs[0] = 5;
-        dofs[1] = 6;
-        dofs[2] = 15;
-        dofs[3] = 16;
-        dofs[4] = 24;
-          break;
-        }
-      case 2:
-        {
-          dofs[0] = 7;
-        dofs[1] = 8;
-        dofs[2] = 17;
-        dofs[3] = 18;
-        dofs[4] = 25;
-          break;
-        }
-      }
-      
-        break;
-      }
-    case 2:
-      {
-        if (i > 0)
-      {
-      throw std::runtime_error("i is larger than number of entities (0)");
-      }
-      
-      dofs[0] = 9;
-      dofs[1] = 19;
-        break;
-      }
-    }
-    
-  }
-
-  /// Tabulate the coordinates of all dofs on a cell
-  virtual void tabulate_coordinates(double* dof_coordinates,
-                                    const double* vertex_coordinates) const
-  {
-    dof_coordinates[0] = vertex_coordinates[0];
-    dof_coordinates[1] = vertex_coordinates[1];
-    dof_coordinates[2] = vertex_coordinates[2];
-    dof_coordinates[3] = vertex_coordinates[3];
-    dof_coordinates[4] = vertex_coordinates[4];
-    dof_coordinates[5] = vertex_coordinates[5];
-    dof_coordinates[6] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[7] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[8] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[9] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[10] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[11] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[12] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[13] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[14] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[15] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[16] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[17] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[18] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[19] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[20] = vertex_coordinates[0];
-    dof_coordinates[21] = vertex_coordinates[1];
-    dof_coordinates[22] = vertex_coordinates[2];
-    dof_coordinates[23] = vertex_coordinates[3];
-    dof_coordinates[24] = vertex_coordinates[4];
-    dof_coordinates[25] = vertex_coordinates[5];
-    dof_coordinates[26] = 0.666666666666667*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[27] = 0.666666666666667*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[28] = 0.333333333333333*vertex_coordinates[2] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[29] = 0.333333333333333*vertex_coordinates[3] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[30] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[31] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[32] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[4];
-    dof_coordinates[33] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[5];
-    dof_coordinates[34] = 0.666666666666667*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2];
-    dof_coordinates[35] = 0.666666666666667*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3];
-    dof_coordinates[36] = 0.333333333333333*vertex_coordinates[0] + 0.666666666666667*vertex_coordinates[2];
-    dof_coordinates[37] = 0.333333333333333*vertex_coordinates[1] + 0.666666666666667*vertex_coordinates[3];
-    dof_coordinates[38] = 0.333333333333333*vertex_coordinates[0] + 0.333333333333333*vertex_coordinates[2] + 0.333333333333333*vertex_coordinates[4];
-    dof_coordinates[39] = 0.333333333333333*vertex_coordinates[1] + 0.333333333333333*vertex_coordinates[3] + 0.333333333333333*vertex_coordinates[5];
-    dof_coordinates[40] = vertex_coordinates[0];
-    dof_coordinates[41] = vertex_coordinates[1];
-    dof_coordinates[42] = vertex_coordinates[2];
-    dof_coordinates[43] = vertex_coordinates[3];
-    dof_coordinates[44] = vertex_coordinates[4];
-    dof_coordinates[45] = vertex_coordinates[5];
-    dof_coordinates[46] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
-    dof_coordinates[47] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
-    dof_coordinates[48] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
-    dof_coordinates[49] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
-    dof_coordinates[50] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
-    dof_coordinates[51] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
-  }
-
-  /// Return the number of sub dofmaps (for a mixed element)
-  virtual std::size_t num_sub_dofmaps() const
-  {
-    return 2;
-  }
-
-  /// Create a new dofmap for sub dofmap i (for a mixed element)
-  virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_dofmap_2();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes2d_dofmap_3();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new class instance
-  virtual ufc::dofmap* create() const
-  {
-    return new multimeshstokes2d_dofmap_4();
-  }
-
-};
-
-/// 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 multimeshstokes2d_cell_integral_0_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_cell_integral_0_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_cell_integral_0_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({false, false});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    32
-    // Number of operations (multiply-add pairs) for tensor contraction: 1122
-    // Total number of operations (multiply-add pairs):                  1157
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*K[0]*K[0]*(1.0);
-    const double G0_0_1 = det*K[0]*K[2]*(1.0);
-    const double G0_1_0 = det*K[2]*K[0]*(1.0);
-    const double G0_1_1 = det*K[2]*K[2]*(1.0);
-    const double G1_0_0 = det*K[0]*K[0]*(1.0);
-    const double G1_0_1 = det*K[0]*K[2]*(1.0);
-    const double G1_1_0 = det*K[2]*K[0]*(1.0);
-    const double G1_1_1 = det*K[2]*K[2]*(1.0);
-    const double G2_0_0 = det*K[1]*K[1]*(1.0);
-    const double G2_0_1 = det*K[1]*K[3]*(1.0);
-    const double G2_1_0 = det*K[3]*K[1]*(1.0);
-    const double G2_1_1 = det*K[3]*K[3]*(1.0);
-    const double G3_0_0 = det*K[1]*K[1]*(1.0);
-    const double G3_0_1 = det*K[1]*K[3]*(1.0);
-    const double G3_1_0 = det*K[3]*K[1]*(1.0);
-    const double G3_1_1 = det*K[3]*K[3]*(1.0);
-    const double G4_0 = det*K[0]*(1.0);
-    const double G4_1 = det*K[2]*(1.0);
-    const double G5_0 = det*K[1]*(1.0);
-    const double G5_1 = det*K[3]*(1.0);
-    const double G6_0 = det*K[0]*(1.0);
-    const double G6_1 = det*K[2]*(1.0);
-    const double G7_0 = det*K[1]*(1.0);
-    const double G7_1 = det*K[3]*(1.0);
-    
-    // Compute element tensor
-    A[0] = 0.425000000000001*G0_0_0 + 0.425000000000001*G0_0_1 + 0.425000000000001*G0_1_0 + 0.425000000000001*G0_1_1 + 0.425000000000001*G2_0_0 + 0.425000000000001*G2_0_1 + 0.425000000000001*G2_1_0 + 0.425000000000001*G2_1_1;
-    A[1] = -0.0875*G0_0_0 - 0.087500000000001*G0_1_0 - 0.0875*G2_0_0 - 0.087500000000001*G2_1_0;
-    A[2] = -0.0875000000000008*G0_0_1 - 0.0875000000000011*G0_1_1 - 0.0875000000000008*G2_0_1 - 0.0875000000000011*G2_1_1;
-    A[3] = -0.0374999999999985*G0_0_0 - 0.0374999999999999*G0_0_1 - 0.0374999999999999*G0_1_0 - 0.0375000000000025*G0_1_1 - 0.0374999999999985*G2_0_0 - 0.0374999999999999*G2_0_1 - 0.0374999999999999*G2_1_0 - 0.0375000000000025*G2_1_1;
-    A[4] = -0.0375000000000004*G0_0_0 - 0.0374999999999976*G0_0_1 - 0.0375000000000009*G0_1_0 - 0.0374999999999977*G0_1_1 - 0.0375000000000004*G2_0_0 - 0.0374999999999976*G2_0_1 - 0.0375000000000009*G2_1_0 - 0.0374999999999977*G2_1_1;
-    A[5] = 0.0375000000000009*G0_0_0 - 0.675000000000001*G0_0_1 + 0.0375000000000021*G0_1_0 - 0.675000000000001*G0_1_1 + 0.0375000000000009*G2_0_0 - 0.675000000000001*G2_0_1 + 0.0375000000000021*G2_1_0 - 0.675000000000001*G2_1_1;
-    A[6] = 0.0375000000000004*G0_0_0 + 0.3375*G0_0_1 + 0.0375000000000009*G0_1_0 + 0.3375*G0_1_1 + 0.0375000000000004*G2_0_0 + 0.3375*G2_0_1 + 0.0375000000000009*G2_1_0 + 0.3375*G2_1_1;
-    A[7] = -0.675000000000002*G0_0_0 + 0.0375000000000012*G0_0_1 - 0.675000000000002*G0_1_0 + 0.0375000000000023*G0_1_1 - 0.675000000000002*G2_0_0 + 0.0375000000000012*G2_0_1 - 0.675000000000002*G2_1_0 + 0.0375000000000023*G2_1_1;
-    A[8] = 0.337500000000001*G0_0_0 + 0.0374999999999982*G0_0_1 + 0.337500000000002*G0_1_0 + 0.0375000000000007*G0_1_1 + 0.337500000000001*G2_0_0 + 0.0374999999999982*G2_0_1 + 0.337500000000002*G2_1_0 + 0.0375000000000007*G2_1_1;
-    A[9] = 0.0;
-    A[10] = 0.0;
-    A[11] = 0.0;
-    A[12] = 0.0;
-    A[13] = 0.0;
-    A[14] = 0.0;
-    A[15] = 0.0;
-    A[16] = 0.0;
-    A[17] = 0.0;
-    A[18] = 0.0;
-    A[19] = 0.0;
-    A[20] = 0.0750000000000001*G4_0 + 0.0750000000000001*G4_1;
-    A[21] = 0.0;
-    A[22] = 0.0;
-    A[23] = 0.0166666666666666*G4_0 + 0.016666666666667*G4_1;
-    A[24] = 0.0166666666666669*G4_0 + 0.0166666666666673*G4_1;
-    A[25] = 0.0166666666666667*G4_0 + 0.0166666666666673*G4_1;
-    A[26] = -0.0875*G0_0_0 - 0.087500000000001*G0_0_1 - 0.0875*G2_0_0 - 0.087500000000001*G2_0_1;
-    A[27] = 0.424999999999999*G0_0_0 + 0.424999999999999*G2_0_0;
-    A[28] = 0.0875000000000007*G0_0_1 + 0.0875000000000007*G2_0_1;
-    A[29] = 0.0374999999999995*G0_0_0 + 0.7125*G0_0_1 + 0.0374999999999995*G2_0_0 + 0.7125*G2_0_1;
-    A[30] = 0.0375000000000002*G0_0_0 - 0.300000000000001*G0_0_1 + 0.0375000000000002*G2_0_0 - 0.300000000000001*G2_0_1;
-    A[31] = -0.037500000000001*G0_0_0 - 0.037500000000001*G2_0_0;
-    A[32] = -0.0375000000000003*G0_0_0 - 0.0375000000000003*G2_0_0;
-    A[33] = 0.337499999999999*G0_0_0 + 0.299999999999996*G0_0_1 + 0.337499999999999*G2_0_0 + 0.299999999999996*G2_0_1;
-    A[34] = -0.674999999999998*G0_0_0 - 0.712499999999996*G0_0_1 - 0.674999999999998*G2_0_0 - 0.712499999999996*G2_0_1;
-    A[35] = 0.0;
-    A[36] = 0.0;
-    A[37] = 0.0;
-    A[38] = 0.0;
-    A[39] = 0.0;
-    A[40] = 0.0;
-    A[41] = 0.0;
-    A[42] = 0.0;
-    A[43] = 0.0;
-    A[44] = 0.0;
-    A[45] = 0.0;
-    A[46] = 0.0;
-    A[47] = -0.0749999999999998*G4_0;
-    A[48] = 0.0;
-    A[49] = -0.0166666666666666*G4_0;
-    A[50] = -0.0166666666666669*G4_0;
-    A[51] = -0.0166666666666668*G4_0;
-    A[52] = -0.0875000000000008*G0_1_0 - 0.0875000000000011*G0_1_1 - 0.0875000000000008*G2_1_0 - 0.0875000000000011*G2_1_1;
-    A[53] = 0.0875000000000007*G0_1_0 + 0.0875000000000007*G2_1_0;
-    A[54] = 0.425000000000001*G0_1_1 + 0.425000000000001*G2_1_1;
-    A[55] = -0.3*G0_1_0 + 0.0375000000000007*G0_1_1 - 0.3*G2_1_0 + 0.0375000000000007*G2_1_1;
-    A[56] = 0.7125*G0_1_0 + 0.0374999999999988*G0_1_1 + 0.7125*G2_1_0 + 0.0374999999999988*G2_1_1;
-    A[57] = 0.3*G0_1_0 + 0.337500000000002*G0_1_1 + 0.3*G2_1_0 + 0.337500000000002*G2_1_1;
-    A[58] = -0.7125*G0_1_0 - 0.675*G0_1_1 - 0.7125*G2_1_0 - 0.675*G2_1_1;
-    A[59] = -0.0375000000000022*G0_1_1 - 0.0375000000000022*G2_1_1;
-    A[60] = -0.0375000000000005*G0_1_1 - 0.0375000000000005*G2_1_1;
-    A[61] = 0.0;
-    A[62] = 0.0;
-    A[63] = 0.0;
-    A[64] = 0.0;
-    A[65] = 0.0;
-    A[66] = 0.0;
-    A[67] = 0.0;
-    A[68] = 0.0;
-    A[69] = 0.0;
-    A[70] = 0.0;
-    A[71] = 0.0;
-    A[72] = 0.0;
-    A[73] = 0.0;
-    A[74] = -0.0749999999999999*G4_1;
-    A[75] = -0.0166666666666669*G4_1;
-    A[76] = -0.0166666666666669*G4_1;
-    A[77] = -0.0166666666666672*G4_1;
-    A[78] = -0.0374999999999986*G0_0_0 - 0.0374999999999999*G0_0_1 - 0.0374999999999999*G0_1_0 - 0.0375000000000025*G0_1_1 - 0.0374999999999986*G2_0_0 - 0.0374999999999999*G2_0_1 - 0.0374999999999999*G2_1_0 - 0.0375000000000025*G2_1_1;
-    A[79] = 0.0374999999999995*G0_0_0 + 0.7125*G0_1_0 + 0.0374999999999995*G2_0_0 + 0.7125*G2_1_0;
-    A[80] = -0.3*G0_0_1 + 0.0375000000000007*G0_1_1 - 0.3*G2_0_1 + 0.0375000000000007*G2_1_1;
-    A[81] = 1.6875*G0_0_0 + 0.843750000000003*G0_0_1 + 0.843750000000003*G0_1_0 + 1.68750000000001*G0_1_1 + 1.6875*G2_0_0 + 0.843750000000003*G2_0_1 + 0.843750000000003*G2_1_0 + 1.68750000000001*G2_1_1;
-    A[82] = -0.3375*G0_0_0 + 0.843749999999993*G0_0_1 - 0.168750000000004*G0_1_0 - 0.337500000000009*G0_1_1 - 0.3375*G2_0_0 + 0.843749999999993*G2_0_1 - 0.168750000000004*G2_1_0 - 0.337500000000009*G2_1_1;
-    A[83] = 0.337500000000001*G0_0_0 + 0.168750000000002*G0_0_1 + 0.16875*G0_1_0 + 0.337500000000001*G2_0_0 + 0.168750000000002*G2_0_1 + 0.16875*G2_1_0;
-    A[84] = 0.3375*G0_0_0 + 0.168750000000004*G0_0_1 + 0.168750000000004*G0_1_0 + 0.3375*G2_0_0 + 0.168750000000004*G2_0_1 + 0.168750000000004*G2_1_0;
-    A[85] = 0.168749999999995*G0_0_1 + 0.168749999999997*G0_1_0 + 0.33749999999999*G0_1_1 + 0.168749999999995*G2_0_1 + 0.168749999999997*G2_1_0 + 0.33749999999999*G2_1_1;
-    A[86] = -0.843749999999995*G0_0_1 - 0.843749999999997*G0_1_0 - 1.6875*G0_1_1 - 0.843749999999995*G2_0_1 - 0.843749999999997*G2_1_0 - 1.6875*G2_1_1;
-    A[87] = -2.025*G0_0_0 - 1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.025*G2_0_0 - 1.0125*G2_0_1 - 1.0125*G2_1_0;
-    A[88] = 0.0;
-    A[89] = 0.0;
-    A[90] = 0.0;
-    A[91] = 0.0;
-    A[92] = 0.0;
-    A[93] = 0.0;
-    A[94] = 0.0;
-    A[95] = 0.0;
-    A[96] = 0.0;
-    A[97] = 0.0;
-    A[98] = 0.0375000000000001*G4_0 + 0.0374999999999997*G4_1;
-    A[99] = -0.0375000000000001*G4_0 - 0.15*G4_1;
-    A[100] = 0.0749999999999999*G4_0 + 0.0375000000000004*G4_1;
-    A[101] = -0.3*G4_0 - 0.15*G4_1;
-    A[102] = 0.0;
-    A[103] = -0.15*G4_0 - 0.150000000000001*G4_1;
-    A[104] = -0.0375000000000004*G0_0_0 - 0.0375000000000009*G0_0_1 - 0.0374999999999977*G0_1_0 - 0.0374999999999977*G0_1_1 - 0.0375000000000004*G2_0_0 - 0.0375000000000009*G2_0_1 - 0.0374999999999977*G2_1_0 - 0.0374999999999977*G2_1_1;
-    A[105] = 0.0375000000000002*G0_0_0 - 0.300000000000001*G0_1_0 + 0.0375000000000002*G2_0_0 - 0.300000000000001*G2_1_0;
-    A[106] = 0.7125*G0_0_1 + 0.0374999999999988*G0_1_1 + 0.7125*G2_0_1 + 0.0374999999999988*G2_1_1;
-    A[107] = -0.3375*G0_0_0 - 0.168750000000004*G0_0_1 + 0.843749999999993*G0_1_0 - 0.337500000000009*G0_1_1 - 0.3375*G2_0_0 - 0.168750000000004*G2_0_1 + 0.843749999999993*G2_1_0 - 0.337500000000009*G2_1_1;
-    A[108] = 1.6875*G0_0_0 + 0.843749999999999*G0_0_1 + 0.843749999999999*G0_1_0 + 1.6875*G0_1_1 + 1.6875*G2_0_0 + 0.843749999999999*G2_0_1 + 0.843749999999999*G2_1_0 + 1.6875*G2_1_1;
-    A[109] = 0.337500000000002*G0_0_0 + 0.16875*G0_0_1 + 0.168750000000005*G0_1_0 + 0.337500000000002*G2_0_0 + 0.16875*G2_0_1 + 0.168750000000005*G2_1_0;
-    A[110] = -1.6875*G0_0_0 - 0.843749999999996*G0_0_1 - 0.843749999999999*G0_1_0 - 1.6875*G2_0_0 - 0.843749999999996*G2_0_1 - 0.843749999999999*G2_1_0;
-    A[111] = 0.168749999999999*G0_0_1 + 0.168749999999999*G0_1_0 + 0.337500000000004*G0_1_1 + 0.168749999999999*G2_0_1 + 0.168749999999999*G2_1_0 + 0.337500000000004*G2_1_1;
-    A[112] = 0.168750000000004*G0_0_1 + 0.16875*G0_1_0 + 0.33750000000001*G0_1_1 + 0.168750000000004*G2_0_1 + 0.16875*G2_1_0 + 0.33750000000001*G2_1_1;
-    A[113] = -1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.02500000000001*G0_1_1 - 1.0125*G2_0_1 - 1.0125*G2_1_0 - 2.02500000000001*G2_1_1;
-    A[114] = 0.0;
-    A[115] = 0.0;
-    A[116] = 0.0;
-    A[117] = 0.0;
-    A[118] = 0.0;
-    A[119] = 0.0;
-    A[120] = 0.0;
-    A[121] = 0.0;
-    A[122] = 0.0;
-    A[123] = 0.0;
-    A[124] = 0.0375*G4_0 + 0.0375000000000002*G4_1;
-    A[125] = 0.0375*G4_0 + 0.0750000000000001*G4_1;
-    A[126] = -0.15*G4_0 - 0.0375000000000003*G4_1;
-    A[127] = -0.15*G4_0 - 0.299999999999998*G4_1;
-    A[128] = -0.15*G4_0 - 0.149999999999999*G4_1;
-    A[129] = 0.0;
-    A[130] = 0.0375000000000009*G0_0_0 + 0.0375000000000021*G0_0_1 - 0.675000000000001*G0_1_0 - 0.675000000000001*G0_1_1 + 0.0375000000000009*G2_0_0 + 0.0375000000000021*G2_0_1 - 0.675000000000001*G2_1_0 - 0.675000000000001*G2_1_1;
-    A[131] = -0.037500000000001*G0_0_0 - 0.037500000000001*G2_0_0;
-    A[132] = 0.3*G0_0_1 + 0.337500000000002*G0_1_1 + 0.3*G2_0_1 + 0.337500000000002*G2_1_1;
-    A[133] = 0.337500000000001*G0_0_0 + 0.16875*G0_0_1 + 0.168750000000002*G0_1_0 + 0.337500000000001*G2_0_0 + 0.16875*G2_0_1 + 0.168750000000002*G2_1_0;
-    A[134] = 0.337500000000002*G0_0_0 + 0.168750000000005*G0_0_1 + 0.16875*G0_1_0 + 0.337500000000002*G2_0_0 + 0.168750000000005*G2_0_1 + 0.16875*G2_1_0;
-    A[135] = 1.6875*G0_0_0 + 0.843749999999998*G0_0_1 + 0.843749999999998*G0_1_0 + 1.6875*G0_1_1 + 1.6875*G2_0_0 + 0.843749999999998*G2_0_1 + 0.843749999999998*G2_1_0 + 1.6875*G2_1_1;
-    A[136] = -0.337500000000002*G0_0_0 - 1.18125*G0_0_1 - 0.16875*G0_1_0 - 1.35*G0_1_1 - 0.337500000000002*G2_0_0 - 1.18125*G2_0_1 - 0.16875*G2_1_0 - 1.35*G2_1_1;
-    A[137] = 0.84375*G0_0_1 + 0.843750000000001*G0_1_0 + 0.84375*G2_0_1 + 0.843750000000001*G2_1_0;
-    A[138] = -0.168750000000002*G0_0_1 - 0.168750000000003*G0_1_0 - 0.168750000000002*G2_0_1 - 0.168750000000003*G2_1_0;
-    A[139] = -2.025*G0_0_0 - 1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.025*G2_0_0 - 1.0125*G2_0_1 - 1.0125*G2_1_0;
-    A[140] = 0.0;
-    A[141] = 0.0;
-    A[142] = 0.0;
-    A[143] = 0.0;
-    A[144] = 0.0;
-    A[145] = 0.0;
-    A[146] = 0.0;
-    A[147] = 0.0;
-    A[148] = 0.0;
-    A[149] = 0.0;
-    A[150] = 0.0375000000000001*G4_0 - 0.1125*G4_1;
-    A[151] = -0.0375*G4_0;
-    A[152] = -0.0750000000000001*G4_0 - 0.0374999999999998*G4_1;
-    A[153] = 0.0;
-    A[154] = 0.3*G4_0 + 0.149999999999999*G4_1;
-    A[155] = 0.15*G4_0;
-    A[156] = 0.0375000000000004*G0_0_0 + 0.0375000000000009*G0_0_1 + 0.3375*G0_1_0 + 0.3375*G0_1_1 + 0.0375000000000004*G2_0_0 + 0.0375000000000009*G2_0_1 + 0.3375*G2_1_0 + 0.3375*G2_1_1;
-    A[157] = -0.0375000000000003*G0_0_0 - 0.0375000000000003*G2_0_0;
-    A[158] = -0.7125*G0_0_1 - 0.675*G0_1_1 - 0.7125*G2_0_1 - 0.675*G2_1_1;
-    A[159] = 0.3375*G0_0_0 + 0.168750000000004*G0_0_1 + 0.168750000000004*G0_1_0 + 0.3375*G2_0_0 + 0.168750000000004*G2_0_1 + 0.168750000000004*G2_1_0;
-    A[160] = -1.6875*G0_0_0 - 0.843749999999999*G0_0_1 - 0.843749999999996*G0_1_0 - 1.6875*G2_0_0 - 0.843749999999999*G2_0_1 - 0.843749999999996*G2_1_0;
-    A[161] = -0.337500000000002*G0_0_0 - 0.16875*G0_0_1 - 1.18125*G0_1_0 - 1.35*G0_1_1 - 0.337500000000002*G2_0_0 - 0.16875*G2_0_1 - 1.18125*G2_1_0 - 1.35*G2_1_1;
-    A[162] = 1.6875*G0_0_0 + 0.843749999999996*G0_0_1 + 0.843749999999996*G0_1_0 + 1.6875*G0_1_1 + 1.6875*G2_0_0 + 0.843749999999996*G2_0_1 + 0.843749999999996*G2_1_0 + 1.6875*G2_1_1;
-    A[163] = -0.168749999999999*G0_0_1 - 0.16875*G0_1_0 - 0.168749999999999*G2_0_1 - 0.16875*G2_1_0;
-    A[164] = -0.168750000000004*G0_0_1 - 0.16875*G0_1_0 - 0.168750000000004*G2_0_1 - 0.16875*G2_1_0;
-    A[165] = 1.0125*G0_0_1 + 1.0125*G0_1_0 + 1.0125*G2_0_1 + 1.0125*G2_1_0;
-    A[166] = 0.0;
-    A[167] = 0.0;
-    A[168] = 0.0;
-    A[169] = 0.0;
-    A[170] = 0.0;
-    A[171] = 0.0;
-    A[172] = 0.0;
-    A[173] = 0.0;
-    A[174] = 0.0;
-    A[175] = 0.0;
-    A[176] = -0.0375*G4_0 + 0.0375000000000002*G4_1;
-    A[177] = -0.0375*G4_0;
-    A[178] = 0.15*G4_0 + 0.1125*G4_1;
-    A[179] = 0.15*G4_0;
-    A[180] = 0.15*G4_0 - 0.150000000000001*G4_1;
-    A[181] = 0.0;
-    A[182] = -0.675000000000002*G0_0_0 - 0.675000000000002*G0_0_1 + 0.0375000000000012*G0_1_0 + 0.0375000000000023*G0_1_1 - 0.675000000000002*G2_0_0 - 0.675000000000002*G2_0_1 + 0.0375000000000012*G2_1_0 + 0.0375000000000023*G2_1_1;
-    A[183] = 0.337499999999999*G0_0_0 + 0.299999999999996*G0_1_0 + 0.337499999999999*G2_0_0 + 0.299999999999996*G2_1_0;
-    A[184] = -0.0375000000000022*G0_1_1 - 0.0375000000000022*G2_1_1;
-    A[185] = 0.168749999999997*G0_0_1 + 0.168749999999995*G0_1_0 + 0.33749999999999*G0_1_1 + 0.168749999999997*G2_0_1 + 0.168749999999995*G2_1_0 + 0.33749999999999*G2_1_1;
-    A[186] = 0.168749999999999*G0_0_1 + 0.168749999999999*G0_1_0 + 0.337500000000004*G0_1_1 + 0.168749999999999*G2_0_1 + 0.168749999999999*G2_1_0 + 0.337500000000004*G2_1_1;
-    A[187] = 0.843750000000001*G0_0_1 + 0.84375*G0_1_0 + 0.843750000000001*G2_0_1 + 0.84375*G2_1_0;
-    A[188] = -0.16875*G0_0_1 - 0.168749999999999*G0_1_0 - 0.16875*G2_0_1 - 0.168749999999999*G2_1_0;
-    A[189] = 1.6875*G0_0_0 + 0.843749999999996*G0_0_1 + 0.843749999999996*G0_1_0 + 1.6875*G0_1_1 + 1.6875*G2_0_0 + 0.843749999999996*G2_0_1 + 0.843749999999996*G2_1_0 + 1.6875*G2_1_1;
-    A[190] = -1.35*G0_0_0 - 0.168749999999996*G0_0_1 - 1.18124999999999*G0_1_0 - 0.337499999999993*G0_1_1 - 1.35*G2_0_0 - 0.168749999999996*G2_0_1 - 1.18124999999999*G2_1_0 - 0.337499999999993*G2_1_1;
-    A[191] = -1.0125*G0_0_1 - 1.01249999999999*G0_1_0 - 2.025*G0_1_1 - 1.0125*G2_0_1 - 1.01249999999999*G2_1_0 - 2.025*G2_1_1;
-    A[192] = 0.0;
-    A[193] = 0.0;
-    A[194] = 0.0;
-    A[195] = 0.0;
-    A[196] = 0.0;
-    A[197] = 0.0;
-    A[198] = 0.0;
-    A[199] = 0.0;
-    A[200] = 0.0;
-    A[201] = 0.0;
-    A[202] = -0.1125*G4_0 + 0.0374999999999998*G4_1;
-    A[203] = -0.0374999999999996*G4_0 - 0.0749999999999995*G4_1;
-    A[204] = -0.0375000000000001*G4_1;
-    A[205] = 0.0;
-    A[206] = 0.150000000000001*G4_1;
-    A[207] = 0.149999999999999*G4_0 + 0.300000000000001*G4_1;
-    A[208] = 0.337500000000001*G0_0_0 + 0.337500000000002*G0_0_1 + 0.0374999999999982*G0_1_0 + 0.0375000000000007*G0_1_1 + 0.337500000000001*G2_0_0 + 0.337500000000002*G2_0_1 + 0.0374999999999982*G2_1_0 + 0.0375000000000007*G2_1_1;
-    A[209] = -0.674999999999998*G0_0_0 - 0.712499999999996*G0_1_0 - 0.674999999999998*G2_0_0 - 0.712499999999996*G2_1_0;
-    A[210] = -0.0375000000000005*G0_1_1 - 0.0375000000000005*G2_1_1;
-    A[211] = -0.843749999999997*G0_0_1 - 0.843749999999995*G0_1_0 - 1.6875*G0_1_1 - 0.843749999999997*G2_0_1 - 0.843749999999995*G2_1_0 - 1.6875*G2_1_1;
-    A[212] = 0.16875*G0_0_1 + 0.168750000000004*G0_1_0 + 0.33750000000001*G0_1_1 + 0.16875*G2_0_1 + 0.168750000000004*G2_1_0 + 0.33750000000001*G2_1_1;
-    A[213] = -0.168750000000003*G0_0_1 - 0.168750000000002*G0_1_0 - 0.168750000000003*G2_0_1 - 0.168750000000002*G2_1_0;
-    A[214] = -0.16875*G0_0_1 - 0.168750000000004*G0_1_0 - 0.16875*G2_0_1 - 0.168750000000004*G2_1_0;
-    A[215] = -1.35*G0_0_0 - 1.18124999999999*G0_0_1 - 0.168749999999996*G0_1_0 - 0.337499999999993*G0_1_1 - 1.35*G2_0_0 - 1.18124999999999*G2_0_1 - 0.168749999999996*G2_1_0 - 0.337499999999993*G2_1_1;
-    A[216] = 1.6875*G0_0_0 + 0.843749999999994*G0_0_1 + 0.843749999999994*G0_1_0 + 1.68749999999999*G0_1_1 + 1.6875*G2_0_0 + 0.843749999999994*G2_0_1 + 0.843749999999994*G2_1_0 + 1.68749999999999*G2_1_1;
-    A[217] = 1.0125*G0_0_1 + 1.0125*G0_1_0 + 1.0125*G2_0_1 + 1.0125*G2_1_0;
-    A[218] = 0.0;
-    A[219] = 0.0;
-    A[220] = 0.0;
-    A[221] = 0.0;
-    A[222] = 0.0;
-    A[223] = 0.0;
-    A[224] = 0.0;
-    A[225] = 0.0;
-    A[226] = 0.0;
-    A[227] = 0.0;
-    A[228] = 0.0375000000000005*G4_0 - 0.0374999999999997*G4_1;
-    A[229] = 0.1125*G4_0 + 0.15*G4_1;
-    A[230] = -0.0375*G4_1;
-    A[231] = 0.149999999999998*G4_1;
-    A[232] = 0.0;
-    A[233] = -0.149999999999999*G4_0 + 0.149999999999999*G4_1;
-    A[234] = 0.0;
-    A[235] = 0.0;
-    A[236] = 0.0;
-    A[237] = -2.025*G0_0_0 - 1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.025*G2_0_0 - 1.0125*G2_0_1 - 1.0125*G2_1_0;
-    A[238] = -1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.02500000000001*G0_1_1 - 1.0125*G2_0_1 - 1.0125*G2_1_0 - 2.02500000000001*G2_1_1;
-    A[239] = -2.025*G0_0_0 - 1.0125*G0_0_1 - 1.0125*G0_1_0 - 2.025*G2_0_0 - 1.0125*G2_0_1 - 1.0125*G2_1_0;
-    A[240] = 1.0125*G0_0_1 + 1.0125*G0_1_0 + 1.0125*G2_0_1 + 1.0125*G2_1_0;
-    A[241] = -1.01249999999999*G0_0_1 - 1.0125*G0_1_0 - 2.025*G0_1_1 - 1.01249999999999*G2_0_1 - 1.0125*G2_1_0 - 2.025*G2_1_1;
-    A[242] = 1.0125*G0_0_1 + 1.0125*G0_1_0 + 1.0125*G2_0_1 + 1.0125*G2_1_0;
-    A[243] = 4.05*G0_0_0 + 2.025*G0_0_1 + 2.025*G0_1_0 + 4.05*G0_1_1 + 4.05*G2_0_0 + 2.025*G2_0_1 + 2.025*G2_1_0 + 4.05*G2_1_1;
-    A[244] = 0.0;
-    A[245] = 0.0;
-    A[246] = 0.0;
-    A[247] = 0.0;
-    A[248] = 0.0;
-    A[249] = 0.0;
-    A[250] = 0.0;
-    A[251] = 0.0;
-    A[252] = 0.0;
-    A[253] = 0.0;
-    A[254] = -0.0750000000000002*G4_0 - 0.0750000000000001*G4_1;
-    A[255] = 0.075*G4_0;
-    A[256] = 0.0750000000000001*G4_1;
-    A[257] = 0.3*G4_0 + 0.300000000000001*G4_1;
-    A[258] = -0.3*G4_0;
-    A[259] = -0.3*G4_1;
-    A[260] = 0.0;
-    A[261] = 0.0;
-    A[262] = 0.0;
-    A[263] = 0.0;
-    A[264] = 0.0;
-    A[265] = 0.0;
-    A[266] = 0.0;
-    A[267] = 0.0;
-    A[268] = 0.0;
-    A[269] = 0.0;
-    A[270] = 0.425000000000001*G1_0_0 + 0.425000000000001*G1_0_1 + 0.425000000000001*G1_1_0 + 0.425000000000001*G1_1_1 + 0.425000000000001*G3_0_0 + 0.425000000000001*G3_0_1 + 0.425000000000001*G3_1_0 + 0.425000000000001*G3_1_1;
-    A[271] = -0.0875*G1_0_0 - 0.087500000000001*G1_1_0 - 0.0875*G3_0_0 - 0.087500000000001*G3_1_0;
-    A[272] = -0.0875000000000008*G1_0_1 - 0.0875000000000011*G1_1_1 - 0.0875000000000008*G3_0_1 - 0.0875000000000011*G3_1_1;
-    A[273] = -0.0374999999999985*G1_0_0 - 0.0374999999999999*G1_0_1 - 0.0374999999999999*G1_1_0 - 0.0375000000000025*G1_1_1 - 0.0374999999999985*G3_0_0 - 0.0374999999999999*G3_0_1 - 0.0374999999999999*G3_1_0 - 0.0375000000000025*G3_1_1;
-    A[274] = -0.0375000000000004*G1_0_0 - 0.0374999999999976*G1_0_1 - 0.0375000000000009*G1_1_0 - 0.0374999999999977*G1_1_1 - 0.0375000000000004*G3_0_0 - 0.0374999999999976*G3_0_1 - 0.0375000000000009*G3_1_0 - 0.0374999999999977*G3_1_1;
-    A[275] = 0.0375000000000009*G1_0_0 - 0.675000000000001*G1_0_1 + 0.0375000000000021*G1_1_0 - 0.675000000000001*G1_1_1 + 0.0375000000000009*G3_0_0 - 0.675000000000001*G3_0_1 + 0.0375000000000021*G3_1_0 - 0.675000000000001*G3_1_1;
-    A[276] = 0.0375000000000004*G1_0_0 + 0.3375*G1_0_1 + 0.0375000000000009*G1_1_0 + 0.3375*G1_1_1 + 0.0375000000000004*G3_0_0 + 0.3375*G3_0_1 + 0.0375000000000009*G3_1_0 + 0.3375*G3_1_1;
-    A[277] = -0.675000000000002*G1_0_0 + 0.0375000000000012*G1_0_1 - 0.675000000000002*G1_1_0 + 0.0375000000000023*G1_1_1 - 0.675000000000002*G3_0_0 + 0.0375000000000012*G3_0_1 - 0.675000000000002*G3_1_0 + 0.0375000000000023*G3_1_1;
-    A[278] = 0.337500000000001*G1_0_0 + 0.0374999999999982*G1_0_1 + 0.337500000000002*G1_1_0 + 0.0375000000000007*G1_1_1 + 0.337500000000001*G3_0_0 + 0.0374999999999982*G3_0_1 + 0.337500000000002*G3_1_0 + 0.0375000000000007*G3_1_1;
-    A[279] = 0.0;
-    A[280] = 0.0750000000000001*G5_0 + 0.0750000000000001*G5_1;
-    A[281] = 0.0;
-    A[282] = 0.0;
-    A[283] = 0.0166666666666666*G5_0 + 0.016666666666667*G5_1;
-    A[284] = 0.0166666666666669*G5_0 + 0.0166666666666673*G5_1;
-    A[285] = 0.0166666666666667*G5_0 + 0.0166666666666673*G5_1;
-    A[286] = 0.0;
-    A[287] = 0.0;
-    A[288] = 0.0;
-    A[289] = 0.0;
-    A[290] = 0.0;
-    A[291] = 0.0;
-    A[292] = 0.0;
-    A[293] = 0.0;
-    A[294] = 0.0;
-    A[295] = 0.0;
-    A[296] = -0.0875*G1_0_0 - 0.087500000000001*G1_0_1 - 0.0875*G3_0_0 - 0.087500000000001*G3_0_1;
-    A[297] = 0.424999999999999*G1_0_0 + 0.424999999999999*G3_0_0;
-    A[298] = 0.0875000000000007*G1_0_1 + 0.0875000000000007*G3_0_1;
-    A[299] = 0.0374999999999995*G1_0_0 + 0.7125*G1_0_1 + 0.0374999999999995*G3_0_0 + 0.7125*G3_0_1;
-    A[300] = 0.0375000000000002*G1_0_0 - 0.300000000000001*G1_0_1 + 0.0375000000000002*G3_0_0 - 0.300000000000001*G3_0_1;
-    A[301] = -0.037500000000001*G1_0_0 - 0.037500000000001*G3_0_0;
-    A[302] = -0.0375000000000003*G1_0_0 - 0.0375000000000003*G3_0_0;
-    A[303] = 0.337499999999999*G1_0_0 + 0.299999999999996*G1_0_1 + 0.337499999999999*G3_0_0 + 0.299999999999996*G3_0_1;
-    A[304] = -0.674999999999998*G1_0_0 - 0.712499999999996*G1_0_1 - 0.674999999999998*G3_0_0 - 0.712499999999996*G3_0_1;
-    A[305] = 0.0;
-    A[306] = 0.0;
-    A[307] = -0.0749999999999998*G5_0;
-    A[308] = 0.0;
-    A[309] = -0.0166666666666666*G5_0;
-    A[310] = -0.0166666666666669*G5_0;
-    A[311] = -0.0166666666666668*G5_0;
-    A[312] = 0.0;
-    A[313] = 0.0;
-    A[314] = 0.0;
-    A[315] = 0.0;
-    A[316] = 0.0;
-    A[317] = 0.0;
-    A[318] = 0.0;
-    A[319] = 0.0;
-    A[320] = 0.0;
-    A[321] = 0.0;
-    A[322] = -0.0875000000000008*G1_1_0 - 0.0875000000000011*G1_1_1 - 0.0875000000000008*G3_1_0 - 0.0875000000000011*G3_1_1;
-    A[323] = 0.0875000000000007*G1_1_0 + 0.0875000000000007*G3_1_0;
-    A[324] = 0.425000000000001*G1_1_1 + 0.425000000000001*G3_1_1;
-    A[325] = -0.3*G1_1_0 + 0.0375000000000007*G1_1_1 - 0.3*G3_1_0 + 0.0375000000000007*G3_1_1;
-    A[326] = 0.7125*G1_1_0 + 0.0374999999999988*G1_1_1 + 0.7125*G3_1_0 + 0.0374999999999988*G3_1_1;
-    A[327] = 0.3*G1_1_0 + 0.337500000000002*G1_1_1 + 0.3*G3_1_0 + 0.337500000000002*G3_1_1;
-    A[328] = -0.7125*G1_1_0 - 0.675*G1_1_1 - 0.7125*G3_1_0 - 0.675*G3_1_1;
-    A[329] = -0.0375000000000022*G1_1_1 - 0.0375000000000022*G3_1_1;
-    A[330] = -0.0375000000000005*G1_1_1 - 0.0375000000000005*G3_1_1;
-    A[331] = 0.0;
-    A[332] = 0.0;
-    A[333] = 0.0;
-    A[334] = -0.0749999999999999*G5_1;
-    A[335] = -0.0166666666666669*G5_1;
-    A[336] = -0.0166666666666669*G5_1;
-    A[337] = -0.0166666666666672*G5_1;
-    A[338] = 0.0;
-    A[339] = 0.0;
-    A[340] = 0.0;
-    A[341] = 0.0;
-    A[342] = 0.0;
-    A[343] = 0.0;
-    A[344] = 0.0;
-    A[345] = 0.0;
-    A[346] = 0.0;
-    A[347] = 0.0;
-    A[348] = -0.0374999999999986*G1_0_0 - 0.0374999999999999*G1_0_1 - 0.0374999999999999*G1_1_0 - 0.0375000000000025*G1_1_1 - 0.0374999999999986*G3_0_0 - 0.0374999999999999*G3_0_1 - 0.0374999999999999*G3_1_0 - 0.0375000000000025*G3_1_1;
-    A[349] = 0.0374999999999995*G1_0_0 + 0.7125*G1_1_0 + 0.0374999999999995*G3_0_0 + 0.7125*G3_1_0;
-    A[350] = -0.3*G1_0_1 + 0.0375000000000007*G1_1_1 - 0.3*G3_0_1 + 0.0375000000000007*G3_1_1;
-    A[351] = 1.6875*G1_0_0 + 0.843750000000003*G1_0_1 + 0.843750000000003*G1_1_0 + 1.68750000000001*G1_1_1 + 1.6875*G3_0_0 + 0.843750000000003*G3_0_1 + 0.843750000000003*G3_1_0 + 1.68750000000001*G3_1_1;
-    A[352] = -0.3375*G1_0_0 + 0.843749999999993*G1_0_1 - 0.168750000000004*G1_1_0 - 0.337500000000009*G1_1_1 - 0.3375*G3_0_0 + 0.843749999999993*G3_0_1 - 0.168750000000004*G3_1_0 - 0.337500000000009*G3_1_1;
-    A[353] = 0.337500000000001*G1_0_0 + 0.168750000000002*G1_0_1 + 0.16875*G1_1_0 + 0.337500000000001*G3_0_0 + 0.168750000000002*G3_0_1 + 0.16875*G3_1_0;
-    A[354] = 0.3375*G1_0_0 + 0.168750000000004*G1_0_1 + 0.168750000000004*G1_1_0 + 0.3375*G3_0_0 + 0.168750000000004*G3_0_1 + 0.168750000000004*G3_1_0;
-    A[355] = 0.168749999999995*G1_0_1 + 0.168749999999997*G1_1_0 + 0.33749999999999*G1_1_1 + 0.168749999999995*G3_0_1 + 0.168749999999997*G3_1_0 + 0.33749999999999*G3_1_1;
-    A[356] = -0.843749999999995*G1_0_1 - 0.843749999999997*G1_1_0 - 1.6875*G1_1_1 - 0.843749999999995*G3_0_1 - 0.843749999999997*G3_1_0 - 1.6875*G3_1_1;
-    A[357] = -2.025*G1_0_0 - 1.0125*G1_0_1 - 1.0125*G1_1_0 - 2.025*G3_0_0 - 1.0125*G3_0_1 - 1.0125*G3_1_0;
-    A[358] = 0.0375000000000001*G5_0 + 0.0374999999999997*G5_1;
-    A[359] = -0.0375000000000001*G5_0 - 0.15*G5_1;
-    A[360] = 0.0749999999999999*G5_0 + 0.0375000000000004*G5_1;
-    A[361] = -0.3*G5_0 - 0.15*G5_1;
-    A[362] = 0.0;
-    A[363] = -0.15*G5_0 - 0.150000000000001*G5_1;
-    A[364] = 0.0;
-    A[365] = 0.0;
-    A[366] = 0.0;
-    A[367] = 0.0;
-    A[368] = 0.0;
-    A[369] = 0.0;
-    A[370] = 0.0;
-    A[371] = 0.0;
-    A[372] = 0.0;
-    A[373] = 0.0;
-    A[374] = -0.0375000000000004*G1_0_0 - 0.0375000000000009*G1_0_1 - 0.0374999999999977*G1_1_0 - 0.0374999999999977*G1_1_1 - 0.0375000000000004*G3_0_0 - 0.0375000000000009*G3_0_1 - 0.0374999999999977*G3_1_0 - 0.0374999999999977*G3_1_1;
-    A[375] = 0.0375000000000002*G1_0_0 - 0.300000000000001*G1_1_0 + 0.0375000000000002*G3_0_0 - 0.300000000000001*G3_1_0;
-    A[376] = 0.7125*G1_0_1 + 0.0374999999999988*G1_1_1 + 0.7125*G3_0_1 + 0.0374999999999988*G3_1_1;
-    A[377] = -0.3375*G1_0_0 - 0.168750000000004*G1_0_1 + 0.843749999999993*G1_1_0 - 0.337500000000009*G1_1_1 - 0.3375*G3_0_0 - 0.168750000000004*G3_0_1 + 0.843749999999993*G3_1_0 - 0.337500000000009*G3_1_1;
-    A[378] = 1.6875*G1_0_0 + 0.843749999999999*G1_0_1 + 0.843749999999999*G1_1_0 + 1.6875*G1_1_1 + 1.6875*G3_0_0 + 0.843749999999999*G3_0_1 + 0.843749999999999*G3_1_0 + 1.6875*G3_1_1;
-    A[379] = 0.337500000000002*G1_0_0 + 0.16875*G1_0_1 + 0.168750000000005*G1_1_0 + 0.337500000000002*G3_0_0 + 0.16875*G3_0_1 + 0.168750000000005*G3_1_0;
-    A[380] = -1.6875*G1_0_0 - 0.843749999999996*G1_0_1 - 0.843749999999999*G1_1_0 - 1.6875*G3_0_0 - 0.843749999999996*G3_0_1 - 0.843749999999999*G3_1_0;
-    A[381] = 0.168749999999999*G1_0_1 + 0.168749999999999*G1_1_0 + 0.337500000000004*G1_1_1 + 0.168749999999999*G3_0_1 + 0.168749999999999*G3_1_0 + 0.337500000000004*G3_1_1;
-    A[382] = 0.168750000000004*G1_0_1 + 0.16875*G1_1_0 + 0.33750000000001*G1_1_1 + 0.168750000000004*G3_0_1 + 0.16875*G3_1_0 + 0.33750000000001*G3_1_1;
-    A[383] = -1.0125*G1_0_1 - 1.0125*G1_1_0 - 2.02500000000001*G1_1_1 - 1.0125*G3_0_1 - 1.0125*G3_1_0 - 2.02500000000001*G3_1_1;
-    A[384] = 0.0375*G5_0 + 0.0375000000000002*G5_1;
-    A[385] = 0.0375*G5_0 + 0.0750000000000001*G5_1;
-    A[386] = -0.15*G5_0 - 0.0375000000000003*G5_1;
-    A[387] = -0.15*G5_0 - 0.299999999999998*G5_1;
-    A[388] = -0.15*G5_0 - 0.149999999999999*G5_1;
-    A[389] = 0.0;
-    A[390] = 0.0;
-    A[391] = 0.0;
-    A[392] = 0.0;
-    A[393] = 0.0;
-    A[394] = 0.0;
-    A[395] = 0.0;
-    A[396] = 0.0;
-    A[397] = 0.0;
-    A[398] = 0.0;
-    A[399] = 0.0;
-    A[400] = 0.0375000000000009*G1_0_0 + 0.0375000000000021*G1_0_1 - 0.675000000000001*G1_1_0 - 0.675000000000001*G1_1_1 + 0.0375000000000009*G3_0_0 + 0.0375000000000021*G3_0_1 - 0.675000000000001*G3_1_0 - 0.675000000000001*G3_1_1;
-    A[401] = -0.037500000000001*G1_0_0 - 0.037500000000001*G3_0_0;
-    A[402] = 0.3*G1_0_1 + 0.337500000000002*G1_1_1 + 0.3*G3_0_1 + 0.337500000000002*G3_1_1;
-    A[403] = 0.337500000000001*G1_0_0 + 0.16875*G1_0_1 + 0.168750000000002*G1_1_0 + 0.337500000000001*G3_0_0 + 0.16875*G3_0_1 + 0.168750000000002*G3_1_0;
-    A[404] = 0.337500000000002*G1_0_0 + 0.168750000000005*G1_0_1 + 0.16875*G1_1_0 + 0.337500000000002*G3_0_0 + 0.168750000000005*G3_0_1 + 0.16875*G3_1_0;
-    A[405] = 1.6875*G1_0_0 + 0.843749999999998*G1_0_1 + 0.843749999999998*G1_1_0 + 1.6875*G1_1_1 + 1.6875*G3_0_0 + 0.843749999999998*G3_0_1 + 0.843749999999998*G3_1_0 + 1.6875*G3_1_1;
-    A[406] = -0.337500000000002*G1_0_0 - 1.18125*G1_0_1 - 0.16875*G1_1_0 - 1.35*G1_1_1 - 0.337500000000002*G3_0_0 - 1.18125*G3_0_1 - 0.16875*G3_1_0 - 1.35*G3_1_1;
-    A[407] = 0.84375*G1_0_1 + 0.843750000000001*G1_1_0 + 0.84375*G3_0_1 + 0.843750000000001*G3_1_0;
-    A[408] = -0.168750000000002*G1_0_1 - 0.168750000000003*G1_1_0 - 0.168750000000002*G3_0_1 - 0.168750000000003*G3_1_0;
-    A[409] = -2.025*G1_0_0 - 1.0125*G1_0_1 - 1.0125*G1_1_0 - 2.025*G3_0_0 - 1.0125*G3_0_1 - 1.0125*G3_1_0;
-    A[410] = 0.0375000000000001*G5_0 - 0.1125*G5_1;
-    A[411] = -0.0375*G5_0;
-    A[412] = -0.0750000000000001*G5_0 - 0.0374999999999998*G5_1;
-    A[413] = 0.0;
-    A[414] = 0.3*G5_0 + 0.149999999999999*G5_1;
-    A[415] = 0.15*G5_0;
-    A[416] = 0.0;
-    A[417] = 0.0;
-    A[418] = 0.0;
-    A[419] = 0.0;
-    A[420] = 0.0;
-    A[421] = 0.0;
-    A[422] = 0.0;
-    A[423] = 0.0;
-    A[424] = 0.0;
-    A[425] = 0.0;
-    A[426] = 0.0375000000000004*G1_0_0 + 0.0375000000000009*G1_0_1 + 0.3375*G1_1_0 + 0.3375*G1_1_1 + 0.0375000000000004*G3_0_0 + 0.0375000000000009*G3_0_1 + 0.3375*G3_1_0 + 0.3375*G3_1_1;
-    A[427] = -0.0375000000000003*G1_0_0 - 0.0375000000000003*G3_0_0;
-    A[428] = -0.7125*G1_0_1 - 0.675*G1_1_1 - 0.7125*G3_0_1 - 0.675*G3_1_1;
-    A[429] = 0.3375*G1_0_0 + 0.168750000000004*G1_0_1 + 0.168750000000004*G1_1_0 + 0.3375*G3_0_0 + 0.168750000000004*G3_0_1 + 0.168750000000004*G3_1_0;
-    A[430] = -1.6875*G1_0_0 - 0.843749999999999*G1_0_1 - 0.843749999999996*G1_1_0 - 1.6875*G3_0_0 - 0.843749999999999*G3_0_1 - 0.843749999999996*G3_1_0;
-    A[431] = -0.337500000000002*G1_0_0 - 0.16875*G1_0_1 - 1.18125*G1_1_0 - 1.35*G1_1_1 - 0.337500000000002*G3_0_0 - 0.16875*G3_0_1 - 1.18125*G3_1_0 - 1.35*G3_1_1;
-    A[432] = 1.6875*G1_0_0 + 0.843749999999996*G1_0_1 + 0.843749999999996*G1_1_0 + 1.6875*G1_1_1 + 1.6875*G3_0_0 + 0.843749999999996*G3_0_1 + 0.843749999999996*G3_1_0 + 1.6875*G3_1_1;
-    A[433] = -0.168749999999999*G1_0_1 - 0.16875*G1_1_0 - 0.168749999999999*G3_0_1 - 0.16875*G3_1_0;
-    A[434] = -0.168750000000004*G1_0_1 - 0.16875*G1_1_0 - 0.168750000000004*G3_0_1 - 0.16875*G3_1_0;
-    A[435] = 1.0125*G1_0_1 + 1.0125*G1_1_0 + 1.0125*G3_0_1 + 1.0125*G3_1_0;
-    A[436] = -0.0375*G5_0 + 0.0375000000000002*G5_1;
-    A[437] = -0.0375*G5_0;
-    A[438] = 0.15*G5_0 + 0.1125*G5_1;
-    A[439] = 0.15*G5_0;
-    A[440] = 0.15*G5_0 - 0.150000000000001*G5_1;
-    A[441] = 0.0;
-    A[442] = 0.0;
-    A[443] = 0.0;
-    A[444] = 0.0;
-    A[445] = 0.0;
-    A[446] = 0.0;
-    A[447] = 0.0;
-    A[448] = 0.0;
-    A[449] = 0.0;
-    A[450] = 0.0;
-    A[451] = 0.0;
-    A[452] = -0.675000000000002*G1_0_0 - 0.675000000000002*G1_0_1 + 0.0375000000000012*G1_1_0 + 0.0375000000000023*G1_1_1 - 0.675000000000002*G3_0_0 - 0.675000000000002*G3_0_1 + 0.0375000000000012*G3_1_0 + 0.0375000000000023*G3_1_1;
-    A[453] = 0.337499999999999*G1_0_0 + 0.299999999999996*G1_1_0 + 0.337499999999999*G3_0_0 + 0.299999999999996*G3_1_0;
-    A[454] = -0.0375000000000022*G1_1_1 - 0.0375000000000022*G3_1_1;
-    A[455] = 0.168749999999997*G1_0_1 + 0.168749999999995*G1_1_0 + 0.33749999999999*G1_1_1 + 0.168749999999997*G3_0_1 + 0.168749999999995*G3_1_0 + 0.33749999999999*G3_1_1;
-    A[456] = 0.168749999999999*G1_0_1 + 0.168749999999999*G1_1_0 + 0.337500000000004*G1_1_1 + 0.168749999999999*G3_0_1 + 0.168749999999999*G3_1_0 + 0.337500000000004*G3_1_1;
-    A[457] = 0.843750000000001*G1_0_1 + 0.84375*G1_1_0 + 0.843750000000001*G3_0_1 + 0.84375*G3_1_0;
-    A[458] = -0.16875*G1_0_1 - 0.168749999999999*G1_1_0 - 0.16875*G3_0_1 - 0.168749999999999*G3_1_0;
-    A[459] = 1.6875*G1_0_0 + 0.843749999999996*G1_0_1 + 0.843749999999996*G1_1_0 + 1.6875*G1_1_1 + 1.6875*G3_0_0 + 0.843749999999996*G3_0_1 + 0.843749999999996*G3_1_0 + 1.6875*G3_1_1;
-    A[460] = -1.35*G1_0_0 - 0.168749999999996*G1_0_1 - 1.18124999999999*G1_1_0 - 0.337499999999993*G1_1_1 - 1.35*G3_0_0 - 0.168749999999996*G3_0_1 - 1.18124999999999*G3_1_0 - 0.337499999999993*G3_1_1;
-    A[461] = -1.0125*G1_0_1 - 1.01249999999999*G1_1_0 - 2.025*G1_1_1 - 1.0125*G3_0_1 - 1.01249999999999*G3_1_0 - 2.025*G3_1_1;
-    A[462] = -0.1125*G5_0 + 0.0374999999999998*G5_1;
-    A[463] = -0.0374999999999996*G5_0 - 0.0749999999999995*G5_1;
-    A[464] = -0.0375000000000001*G5_1;
-    A[465] = 0.0;
-    A[466] = 0.150000000000001*G5_1;
-    A[467] = 0.149999999999999*G5_0 + 0.300000000000001*G5_1;
-    A[468] = 0.0;
-    A[469] = 0.0;
-    A[470] = 0.0;
-    A[471] = 0.0;
-    A[472] = 0.0;
-    A[473] = 0.0;
-    A[474] = 0.0;
-    A[475] = 0.0;
-    A[476] = 0.0;
-    A[477] = 0.0;
-    A[478] = 0.337500000000001*G1_0_0 + 0.337500000000002*G1_0_1 + 0.0374999999999982*G1_1_0 + 0.0375000000000007*G1_1_1 + 0.337500000000001*G3_0_0 + 0.337500000000002*G3_0_1 + 0.0374999999999982*G3_1_0 + 0.0375000000000007*G3_1_1;
-    A[479] = -0.674999999999998*G1_0_0 - 0.712499999999996*G1_1_0 - 0.674999999999998*G3_0_0 - 0.712499999999996*G3_1_0;
-    A[480] = -0.0375000000000005*G1_1_1 - 0.0375000000000005*G3_1_1;
-    A[481] = -0.843749999999997*G1_0_1 - 0.843749999999995*G1_1_0 - 1.6875*G1_1_1 - 0.843749999999997*G3_0_1 - 0.843749999999995*G3_1_0 - 1.6875*G3_1_1;
-    A[482] = 0.16875*G1_0_1 + 0.168750000000004*G1_1_0 + 0.33750000000001*G1_1_1 + 0.16875*G3_0_1 + 0.168750000000004*G3_1_0 + 0.33750000000001*G3_1_1;
-    A[483] = -0.168750000000003*G1_0_1 - 0.168750000000002*G1_1_0 - 0.168750000000003*G3_0_1 - 0.168750000000002*G3_1_0;
-    A[484] = -0.16875*G1_0_1 - 0.168750000000004*G1_1_0 - 0.16875*G3_0_1 - 0.168750000000004*G3_1_0;
-    A[485] = -1.35*G1_0_0 - 1.18124999999999*G1_0_1 - 0.168749999999996*G1_1_0 - 0.337499999999993*G1_1_1 - 1.35*G3_0_0 - 1.18124999999999*G3_0_1 - 0.168749999999996*G3_1_0 - 0.337499999999993*G3_1_1;
-    A[486] = 1.6875*G1_0_0 + 0.843749999999994*G1_0_1 + 0.843749999999994*G1_1_0 + 1.68749999999999*G1_1_1 + 1.6875*G3_0_0 + 0.843749999999994*G3_0_1 + 0.843749999999994*G3_1_0 + 1.68749999999999*G3_1_1;
-    A[487] = 1.0125*G1_0_1 + 1.0125*G1_1_0 + 1.0125*G3_0_1 + 1.0125*G3_1_0;
-    A[488] = 0.0375000000000005*G5_0 - 0.0374999999999997*G5_1;
-    A[489] = 0.1125*G5_0 + 0.15*G5_1;
-    A[490] = -0.0375*G5_1;
-    A[491] = 0.149999999999998*G5_1;
-    A[492] = 0.0;
-    A[493] = -0.149999999999999*G5_0 + 0.149999999999999*G5_1;
-    A[494] = 0.0;
-    A[495] = 0.0;
-    A[496] = 0.0;
-    A[497] = 0.0;
-    A[498] = 0.0;
-    A[499] = 0.0;
-    A[500] = 0.0;
-    A[501] = 0.0;
-    A[502] = 0.0;
-    A[503] = 0.0;
-    A[504] = 0.0;
-    A[505] = 0.0;
-    A[506] = 0.0;
-    A[507] = -2.025*G1_0_0 - 1.0125*G1_0_1 - 1.0125*G1_1_0 - 2.025*G3_0_0 - 1.0125*G3_0_1 - 1.0125*G3_1_0;
-    A[508] = -1.0125*G1_0_1 - 1.0125*G1_1_0 - 2.02500000000001*G1_1_1 - 1.0125*G3_0_1 - 1.0125*G3_1_0 - 2.02500000000001*G3_1_1;
-    A[509] = -2.025*G1_0_0 - 1.0125*G1_0_1 - 1.0125*G1_1_0 - 2.025*G3_0_0 - 1.0125*G3_0_1 - 1.0125*G3_1_0;
-    A[510] = 1.0125*G1_0_1 + 1.0125*G1_1_0 + 1.0125*G3_0_1 + 1.0125*G3_1_0;
-    A[511] = -1.01249999999999*G1_0_1 - 1.0125*G1_1_0 - 2.025*G1_1_1 - 1.01249999999999*G3_0_1 - 1.0125*G3_1_0 - 2.025*G3_1_1;
-    A[512] = 1.0125*G1_0_1 + 1.0125*G1_1_0 + 1.0125*G3_0_1 + 1.0125*G3_1_0;
-    A[513] = 4.05*G1_0_0 + 2.025*G1_0_1 + 2.025*G1_1_0 + 4.05*G1_1_1 + 4.05*G3_0_0 + 2.025*G3_0_1 + 2.025*G3_1_0 + 4.05*G3_1_1;
-    A[514] = -0.0750000000000002*G5_0 - 0.0750000000000001*G5_1;
-    A[515] = 0.075*G5_0;
-    A[516] = 0.0750000000000001*G5_1;
-    A[517] = 0.3*G5_0 + 0.300000000000001*G5_1;
-    A[518] = -0.3*G5_0;
-    A[519] = -0.3*G5_1;
-    A[520] = 0.0750000000000001*G6_0 + 0.0750000000000001*G6_1;
-    A[521] = 0.0;
-    A[522] = 0.0;
-    A[523] = 0.0375000000000001*G6_0 + 0.0374999999999997*G6_1;
-    A[524] = 0.0375*G6_0 + 0.0375000000000002*G6_1;
-    A[525] = 0.0375000000000001*G6_0 - 0.1125*G6_1;
-    A[526] = -0.0375*G6_0 + 0.0375000000000002*G6_1;
-    A[527] = -0.1125*G6_0 + 0.0374999999999998*G6_1;
-    A[528] = 0.0375000000000005*G6_0 - 0.0374999999999997*G6_1;
-    A[529] = -0.0750000000000002*G6_0 - 0.0750000000000001*G6_1;
-    A[530] = 0.0750000000000001*G7_0 + 0.0750000000000001*G7_1;
-    A[531] = 0.0;
-    A[532] = 0.0;
-    A[533] = 0.0375000000000001*G7_0 + 0.0374999999999997*G7_1;
-    A[534] = 0.0375*G7_0 + 0.0375000000000002*G7_1;
-    A[535] = 0.0375000000000001*G7_0 - 0.1125*G7_1;
-    A[536] = -0.0375*G7_0 + 0.0375000000000002*G7_1;
-    A[537] = -0.1125*G7_0 + 0.0374999999999998*G7_1;
-    A[538] = 0.0375000000000005*G7_0 - 0.0374999999999997*G7_1;
-    A[539] = -0.0750000000000002*G7_0 - 0.0750000000000001*G7_1;
-    A[540] = 0.0;
-    A[541] = 0.0;
-    A[542] = 0.0;
-    A[543] = 0.0;
-    A[544] = 0.0;
-    A[545] = 0.0;
-    A[546] = 0.0;
-    A[547] = -0.0749999999999998*G6_0;
-    A[548] = 0.0;
-    A[549] = -0.0375000000000001*G6_0 - 0.15*G6_1;
-    A[550] = 0.0375*G6_0 + 0.0750000000000001*G6_1;
-    A[551] = -0.0375*G6_0;
-    A[552] = -0.0375*G6_0;
-    A[553] = -0.0374999999999996*G6_0 - 0.0749999999999995*G6_1;
-    A[554] = 0.1125*G6_0 + 0.15*G6_1;
-    A[555] = 0.075*G6_0;
-    A[556] = 0.0;
-    A[557] = -0.0749999999999998*G7_0;
-    A[558] = 0.0;
-    A[559] = -0.0375000000000001*G7_0 - 0.15*G7_1;
-    A[560] = 0.0375*G7_0 + 0.0750000000000001*G7_1;
-    A[561] = -0.0375*G7_0;
-    A[562] = -0.0375*G7_0;
-    A[563] = -0.0374999999999996*G7_0 - 0.0749999999999995*G7_1;
-    A[564] = 0.1125*G7_0 + 0.15*G7_1;
-    A[565] = 0.075*G7_0;
-    A[566] = 0.0;
-    A[567] = 0.0;
-    A[568] = 0.0;
-    A[569] = 0.0;
-    A[570] = 0.0;
-    A[571] = 0.0;
-    A[572] = 0.0;
-    A[573] = 0.0;
-    A[574] = -0.0749999999999999*G6_1;
-    A[575] = 0.0749999999999999*G6_0 + 0.0375000000000004*G6_1;
-    A[576] = -0.15*G6_0 - 0.0375000000000003*G6_1;
-    A[577] = -0.0750000000000001*G6_0 - 0.0374999999999998*G6_1;
-    A[578] = 0.15*G6_0 + 0.1125*G6_1;
-    A[579] = -0.0375000000000001*G6_1;
-    A[580] = -0.0375*G6_1;
-    A[581] = 0.0750000000000001*G6_1;
-    A[582] = 0.0;
-    A[583] = 0.0;
-    A[584] = -0.0749999999999999*G7_1;
-    A[585] = 0.0749999999999999*G7_0 + 0.0375000000000004*G7_1;
-    A[586] = -0.15*G7_0 - 0.0375000000000003*G7_1;
-    A[587] = -0.0750000000000001*G7_0 - 0.0374999999999998*G7_1;
-    A[588] = 0.15*G7_0 + 0.1125*G7_1;
-    A[589] = -0.0375000000000001*G7_1;
-    A[590] = -0.0375*G7_1;
-    A[591] = 0.0750000000000001*G7_1;
-    A[592] = 0.0;
-    A[593] = 0.0;
-    A[594] = 0.0;
-    A[595] = 0.0;
-    A[596] = 0.0;
-    A[597] = 0.0;
-    A[598] = 0.0166666666666666*G6_0 + 0.016666666666667*G6_1;
-    A[599] = -0.0166666666666666*G6_0;
-    A[600] = -0.0166666666666669*G6_1;
-    A[601] = -0.3*G6_0 - 0.15*G6_1;
-    A[602] = -0.15*G6_0 - 0.299999999999998*G6_1;
-    A[603] = 0.0;
-    A[604] = 0.15*G6_0;
-    A[605] = 0.0;
-    A[606] = 0.149999999999998*G6_1;
-    A[607] = 0.3*G6_0 + 0.300000000000001*G6_1;
-    A[608] = 0.0166666666666666*G7_0 + 0.016666666666667*G7_1;
-    A[609] = -0.0166666666666666*G7_0;
-    A[610] = -0.0166666666666669*G7_1;
-    A[611] = -0.3*G7_0 - 0.15*G7_1;
-    A[612] = -0.15*G7_0 - 0.299999999999998*G7_1;
-    A[613] = 0.0;
-    A[614] = 0.15*G7_0;
-    A[615] = 0.0;
-    A[616] = 0.149999999999998*G7_1;
-    A[617] = 0.3*G7_0 + 0.300000000000001*G7_1;
-    A[618] = 0.0;
-    A[619] = 0.0;
-    A[620] = 0.0;
-    A[621] = 0.0;
-    A[622] = 0.0;
-    A[623] = 0.0;
-    A[624] = 0.0166666666666669*G6_0 + 0.0166666666666673*G6_1;
-    A[625] = -0.0166666666666669*G6_0;
-    A[626] = -0.0166666666666669*G6_1;
-    A[627] = 0.0;
-    A[628] = -0.15*G6_0 - 0.149999999999999*G6_1;
-    A[629] = 0.3*G6_0 + 0.149999999999999*G6_1;
-    A[630] = 0.15*G6_0 - 0.150000000000001*G6_1;
-    A[631] = 0.150000000000001*G6_1;
-    A[632] = 0.0;
-    A[633] = -0.3*G6_0;
-    A[634] = 0.0166666666666669*G7_0 + 0.0166666666666673*G7_1;
-    A[635] = -0.0166666666666669*G7_0;
-    A[636] = -0.0166666666666669*G7_1;
-    A[637] = 0.0;
-    A[638] = -0.15*G7_0 - 0.149999999999999*G7_1;
-    A[639] = 0.3*G7_0 + 0.149999999999999*G7_1;
-    A[640] = 0.15*G7_0 - 0.150000000000001*G7_1;
-    A[641] = 0.150000000000001*G7_1;
-    A[642] = 0.0;
-    A[643] = -0.3*G7_0;
-    A[644] = 0.0;
-    A[645] = 0.0;
-    A[646] = 0.0;
-    A[647] = 0.0;
-    A[648] = 0.0;
-    A[649] = 0.0;
-    A[650] = 0.0166666666666667*G6_0 + 0.0166666666666673*G6_1;
-    A[651] = -0.0166666666666668*G6_0;
-    A[652] = -0.0166666666666672*G6_1;
-    A[653] = -0.15*G6_0 - 0.150000000000001*G6_1;
-    A[654] = 0.0;
-    A[655] = 0.15*G6_0;
-    A[656] = 0.0;
-    A[657] = 0.149999999999999*G6_0 + 0.300000000000001*G6_1;
-    A[658] = -0.149999999999999*G6_0 + 0.149999999999999*G6_1;
-    A[659] = -0.3*G6_1;
-    A[660] = 0.0166666666666667*G7_0 + 0.0166666666666673*G7_1;
-    A[661] = -0.0166666666666668*G7_0;
-    A[662] = -0.0166666666666672*G7_1;
-    A[663] = -0.15*G7_0 - 0.150000000000001*G7_1;
-    A[664] = 0.0;
-    A[665] = 0.15*G7_0;
-    A[666] = 0.0;
-    A[667] = 0.149999999999999*G7_0 + 0.300000000000001*G7_1;
-    A[668] = -0.149999999999999*G7_0 + 0.149999999999999*G7_1;
-    A[669] = -0.3*G7_1;
-    A[670] = 0.0;
-    A[671] = 0.0;
-    A[672] = 0.0;
-    A[673] = 0.0;
-    A[674] = 0.0;
-    A[675] = 0.0;
-  }
-
-};
-
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
-
-class multimeshstokes2d_custom_integral_0_0: public ufc::custom_integral
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_custom_integral_0_0() : ufc::custom_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_custom_integral_0_0()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({false, true});
-    return enabled;
-  }
-
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 1;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
-  {
-    
-    // --- Compute geometric quantities on cell 0 ---
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Compute cell volume
-    const double volume = std::abs(detJ)/2.0;
-    
-    // Compute circumradius of triangle in 2D
-    const double v1v2  = std::sqrt((vertex_coordinates[4] - vertex_coordinates[2])*(vertex_coordinates[4] - vertex_coordinates[2]) + (vertex_coordinates[5] - vertex_coordinates[3])*(vertex_coordinates[5] - vertex_coordinates[3]) );
-    const double v0v2  = std::sqrt(J[3]*J[3] + J[1]*J[1]);
-    const double v0v1  = std::sqrt(J[0]*J[0] + J[2]*J[2]);
-    const double circumradius = 0.25*(v1v2*v0v2*v0v1)/(volume);
-    
-    
-    // Set quadrature weights
-    const double* W = quadrature_weights;
-    
-    // --- Evaluation of basis functions ---
-    
-    // Create table FE0_C2 for basis function values on all cells
-    std::vector<std::vector<double> > FE0_C2(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C2[ip].resize(26);
-    
-    // Evaluate basis functions on cell 0
-    static double FE0_values_0[78];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis functions
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C2
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C2[ip][0 + i] = FE0_values_0[3*i + 2];
-    } // end loop over 'ip'
-    
-    // --- Evaluation of basis function derivatives of order 1 ---
-    
-    // Create table FE0_C0_D10 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C0_D10(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0_D10[ip].resize(26);
-    
-    // Create table FE0_C1_D10 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C1_D10(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1_D10[ip].resize(26);
-    
-    // Create table FE0_C2_D10 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C2_D10(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C2_D10[ip].resize(26);
-    
-    // Create table FE0_C0_D01 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C0_D01(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0_D01[ip].resize(26);
-    
-    // Create table FE0_C1_D01 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C1_D01(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1_D01[ip].resize(26);
-    
-    // Create table FE0_C2_D01 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C2_D01(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C2_D01[ip].resize(26);
-    
-    // Evaluate basis function derivatives on cell 0
-    static double FE0_dvalues_1_0[156];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis function derivatives
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C0_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 0];
-      
-      // Copy values to table FE0_C1_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 2];
-      
-      // Copy values to table FE0_C2_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C2_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 4];
-      
-      // Copy values to table FE0_C0_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 1];
-      
-      // Copy values to table FE0_C1_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 3];
-      
-      // Copy values to table FE0_C2_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C2_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 5];
-    } // end loop over 'ip'
-    
-    
-    // --- Evaluation of basis function derivatives of order 2 ---
-    
-    // Create table FE0_C0_D20 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C0_D20(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0_D20[ip].resize(26);
-    
-    // Create table FE0_C1_D20 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C1_D20(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1_D20[ip].resize(26);
-    
-    // Create table FE0_C0_D11 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C0_D11(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0_D11[ip].resize(26);
-    
-    // Create table FE0_C1_D11 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C1_D11(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1_D11[ip].resize(26);
-    
-    // Create table FE0_C0_D02 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C0_D02(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0_D02[ip].resize(26);
-    
-    // Create table FE0_C1_D02 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C1_D02(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1_D02[ip].resize(26);
-    
-    // Evaluate basis function derivatives on cell 0
-    static double FE0_dvalues_2_0[312];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis function derivatives
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_derivatives_all(2, FE0_dvalues_2_0, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C0_D20
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D20[ip][0 + i] = FE0_dvalues_2_0[12*i + 0];
-      
-      // Copy values to table FE0_C1_D20
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D20[ip][0 + i] = FE0_dvalues_2_0[12*i + 4];
-      
-      // Copy values to table FE0_C0_D11
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D11[ip][0 + i] = FE0_dvalues_2_0[12*i + 1];
-      
-      // Copy values to table FE0_C1_D11
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D11[ip][0 + i] = FE0_dvalues_2_0[12*i + 5];
-      
-      // Copy values to table FE0_C0_D02
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D02[ip][0 + i] = FE0_dvalues_2_0[12*i + 3];
-      
-      // Copy values to table FE0_C1_D02
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D02[ip][0 + i] = FE0_dvalues_2_0[12*i + 7];
-    } // end loop over 'ip'
-    
-    
-    // --- Evaluation of basis functions ---
-    
-    // Create table FE1 for basis function values on all cells
-    std::vector<std::vector<double> > FE1(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1[ip].resize(1);
-    
-    // Evaluate basis functions on cell 0
-    static double FE1_values_0[1];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis functions
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_0::_evaluate_basis_all(FE1_values_0, x, v, cell_orientation);
-      
-      // Copy values to table FE1
-      for (std::size_t i = 0; i < 1; i++)
-        FE1[ip][0 + i] = FE1_values_0[1*i + 0];
-    } // end loop over 'ip'
-    
-    // Reset values in the element tensor.
-    for (unsigned int r = 0; r < 676; r++)
-    {
-      A[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Compute element tensor using UFL quadrature representation
-    // Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
-    
-    // Loop quadrature points for integral.
-    // Number of operations to compute element tensor for following IP loop = unknown
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      
-      // Coefficient declarations.
-      double F0 = 0.0;
-      
-      // Total number of operations to compute function values = 2
-      for (unsigned int r = 0; r < 1; r++)
-      {
-        F0 += FE1[ip][0]*w[1][0];
-      } // end loop over 'r'
-      
-      // Number of operations for primary indices: 54080
-      for (unsigned int j = 0; j < 26; j++)
-      {
-        for (unsigned int k = 0; k < 26; k++)
-        {
-          // Number of operations to compute entry: 80
-          A[j*26 + k] += ((((((((((0 + 0 + 0 + FE0_C0_D02[ip][j]) + (FE0_C0_D20[ip][j] + 0 + 0 + 0)))*(-1.0) + ((FE0_C2_D10[ip][j] + 0))*(-1.0)))*(((((0 + 0 + 0 + FE0_C0_D02[ip][k]) + (FE0_C0_D20[ip][k] + 0 + 0 + 0)))*(-1.0) + (FE0_C2_D10[ip][k] + 0))) + (((((0 + 0 + 0 + FE0_C1_D02[ip][j]) + (FE0_C1_D20[ip][j] + 0 + 0 + 0)))*(-1.0) + ((0 + FE0_C2_D01[ip][j]))*(-1.0)))*(((((0 + 0 + 0 + FE0_C1_D02[ip][k]) + (FE0_C1_D20[ip][k] + 0 + 0 + 0)))*(-1.0) + (0 + FE0_C2_D01[ip][k])))))*2.0*circumra [...]
-        } // end loop over 'k'
-      } // end loop over 'j'
-    } // end loop over 'ip'
-  }
-
-};
-
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
-
-class multimeshstokes2d_custom_integral_0_1: public ufc::custom_integral
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_custom_integral_0_1() : ufc::custom_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_custom_integral_0_1()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({false, false});
-    return enabled;
-  }
-
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 2;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
-  {
-    
-    // --- Compute geometric quantities on cell 0 ---
-    
-    // Extract vertex coordinates
-    const double* vertex_coordinates_0 = vertex_coordinates + 0;
-    
-    // Compute Jacobian
-    double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
-    
-    // Compute Jacobian inverse and determinant
-    double K_0[4];
-    double detJ_0;
-    compute_jacobian_inverse_triangle_2d(K_0, detJ_0, J_0);
-    
-    // Compute cell volume
-    const double volume_0 = std::abs(detJ_0)/2.0;
-    
-    // Compute circumradius of triangle in 2D
-    const double v1v2_0  = std::sqrt((vertex_coordinates_0[4] - vertex_coordinates_0[2])*(vertex_coordinates_0[4] - vertex_coordinates_0[2]) + (vertex_coordinates_0[5] - vertex_coordinates_0[3])*(vertex_coordinates_0[5] - vertex_coordinates_0[3]) );
-    const double v0v2_0  = std::sqrt(J_0[3]*J_0[3] + J_0[1]*J_0[1]);
-    const double v0v1_0  = std::sqrt(J_0[0]*J_0[0] + J_0[2]*J_0[2]);
-    const double circumradius_0 = 0.25*(v1v2_0*v0v2_0*v0v1_0)/(volume_0);
-    
-    
-    // --- Compute geometric quantities on cell 1 ---
-    
-    // Extract vertex coordinates
-    const double* vertex_coordinates_1 = vertex_coordinates + 6;
-    
-    // Compute Jacobian
-    double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
-    
-    // Compute Jacobian inverse and determinant
-    double K_1[4];
-    double detJ_1;
-    compute_jacobian_inverse_triangle_2d(K_1, detJ_1, J_1);
-    
-    // Compute cell volume
-    const double volume_1 = std::abs(detJ_1)/2.0;
-    
-    // Compute circumradius of triangle in 2D
-    const double v1v2_1  = std::sqrt((vertex_coordinates_1[4] - vertex_coordinates_1[2])*(vertex_coordinates_1[4] - vertex_coordinates_1[2]) + (vertex_coordinates_1[5] - vertex_coordinates_1[3])*(vertex_coordinates_1[5] - vertex_coordinates_1[3]) );
-    const double v0v2_1  = std::sqrt(J_1[3]*J_1[3] + J_1[1]*J_1[1]);
-    const double v0v1_1  = std::sqrt(J_1[0]*J_1[0] + J_1[2]*J_1[2]);
-    const double circumradius_1 = 0.25*(v1v2_1*v0v2_1*v0v1_1)/(volume_1);
-    
-    
-    // Set quadrature weights
-    const double* W = quadrature_weights;
-    
-    // --- Evaluation of basis functions ---
-    
-    // Create table FE0_C0 for basis function values on all cells
-    std::vector<std::vector<double> > FE0_C0(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0[ip].resize(52);
-    
-    // Create table FE0_C1 for basis function values on all cells
-    std::vector<std::vector<double> > FE0_C1(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1[ip].resize(52);
-    
-    // Create table FE0_C2 for basis function values on all cells
-    std::vector<std::vector<double> > FE0_C2(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C2[ip].resize(52);
-    
-    // Evaluate basis functions on cell 0
-    static double FE0_values_0[78];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis functions
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C0
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0[ip][0 + i] = FE0_values_0[3*i + 0];
-      
-      // Copy values to table FE0_C1
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1[ip][0 + i] = FE0_values_0[3*i + 1];
-      
-      // Copy values to table FE0_C2
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C2[ip][0 + i] = FE0_values_0[3*i + 2];
-    } // end loop over 'ip'
-    
-    // Evaluate basis functions on cell 1
-    static double FE0_values_1[78];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis functions
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_all(FE0_values_1, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C0
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0[ip][26 + i] = FE0_values_1[3*i + 0];
-      
-      // Copy values to table FE0_C1
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1[ip][26 + i] = FE0_values_1[3*i + 1];
-      
-      // Copy values to table FE0_C2
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C2[ip][26 + i] = FE0_values_1[3*i + 2];
-    } // end loop over 'ip'
-    
-    // --- Evaluation of basis function derivatives of order 1 ---
-    
-    // Create table FE0_C0_D10 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C0_D10(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0_D10[ip].resize(52);
-    
-    // Create table FE0_C1_D10 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C1_D10(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1_D10[ip].resize(52);
-    
-    // Create table FE0_C0_D01 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C0_D01(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0_D01[ip].resize(52);
-    
-    // Create table FE0_C1_D01 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C1_D01(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1_D01[ip].resize(52);
-    
-    // Evaluate basis function derivatives on cell 0
-    static double FE0_dvalues_1_0[156];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis function derivatives
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C0_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 0];
-      
-      // Copy values to table FE0_C1_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 2];
-      
-      // Copy values to table FE0_C0_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 1];
-      
-      // Copy values to table FE0_C1_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 3];
-    } // end loop over 'ip'
-    
-    // Evaluate basis function derivatives on cell 1
-    static double FE0_dvalues_1_1[156];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis function derivatives
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C0_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D10[ip][26 + i] = FE0_dvalues_1_1[6*i + 0];
-      
-      // Copy values to table FE0_C1_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D10[ip][26 + i] = FE0_dvalues_1_1[6*i + 2];
-      
-      // Copy values to table FE0_C0_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D01[ip][26 + i] = FE0_dvalues_1_1[6*i + 1];
-      
-      // Copy values to table FE0_C1_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D01[ip][26 + i] = FE0_dvalues_1_1[6*i + 3];
-    } // end loop over 'ip'
-    
-    
-    // Reset values in the element tensor.
-    for (unsigned int r = 0; r < 2704; r++)
-    {
-      A[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Compute element tensor using UFL quadrature representation
-    // Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
-    
-    // Loop quadrature points for integral.
-    // Number of operations to compute element tensor for following IP loop = unknown
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Set facet normal components for current quadrature point
-      const double n_00 =   facet_normals[2*ip + 0];
-      const double n_10 = - facet_normals[2*ip + 0];
-      const double n_01 =   facet_normals[2*ip + 1];
-      const double n_11 = - facet_normals[2*ip + 1];
-      
-      
-      // Number of operations for primary indices: 178464
-      for (unsigned int j = 0; j < 26; j++)
-      {
-        for (unsigned int k = 0; k < 26; k++)
-        {
-          // Number of operations to compute entry: 68
-          A[(j + 26)*52 + (k + 26)] += (((((((((FE0_C0_D10[ip][k + 26]) + 0))*0.5)*(((FE0_C0[ip][j + 26]))*n_10) + ((((FE0_C1_D10[ip][k + 26]) + 0))*0.5)*(((FE0_C1[ip][j + 26]))*n_10)) + ((((0 + (FE0_C0_D01[ip][k + 26])))*0.5)*(((FE0_C0[ip][j + 26]))*n_11) + (((0 + (FE0_C1_D01[ip][k + 26])))*0.5)*(((FE0_C1[ip][j + 26]))*n_11))))*(-1.0) + ((((((FE0_C0[ip][j + 26]))*(-1.0))*(((FE0_C0[ip][k + 26]))*(-1.0)) + (((FE0_C1[ip][j + 26]))*(-1.0))*(((FE0_C1[ip][k + 26]))*(-1.0))))*(90.0/(0.5*((2.0* [...]
-          // Number of operations to compute entry: 66
-          A[(j + 26)*52 + k] += ((((((((0 + FE0_C0_D01[ip][k]))*0.5)*(((FE0_C0[ip][j + 26]))*n_11) + (((0 + FE0_C1_D01[ip][k]))*0.5)*(((FE0_C1[ip][j + 26]))*n_11)) + ((((FE0_C0_D10[ip][k] + 0))*0.5)*(((FE0_C0[ip][j + 26]))*n_10) + (((FE0_C1_D10[ip][k] + 0))*0.5)*(((FE0_C1[ip][j + 26]))*n_10))))*(-1.0) + ((((((FE0_C0[ip][j + 26]))*(-1.0))*FE0_C0[ip][k] + (((FE0_C1[ip][j + 26]))*(-1.0))*FE0_C1[ip][k]))*(90.0/(0.5*((2.0*circumradius_0 + 2.0*circumradius_1)))) + (((((FE0_C0[ip][j + 26]))*n_1 [...]
-          // Number of operations to compute entry: 66
-          A[j*52 + (k + 26)] += (((((((((FE0_C0_D10[ip][k + 26]) + 0))*0.5)*FE0_C0[ip][j]*n_00 + ((((FE0_C1_D10[ip][k + 26]) + 0))*0.5)*FE0_C1[ip][j]*n_00) + ((((0 + (FE0_C0_D01[ip][k + 26])))*0.5)*FE0_C0[ip][j]*n_01 + (((0 + (FE0_C1_D01[ip][k + 26])))*0.5)*FE0_C1[ip][j]*n_01)))*(-1.0) + ((((((FE0_C0[ip][k + 26]))*n_10 + ((FE0_C1[ip][k + 26]))*n_11))*FE0_C2[ip][j]*0.5 + ((FE0_C0[ip][j]*n_00 + FE0_C1[ip][j]*n_01))*(((FE0_C2[ip][k + 26]))*0.5)) + ((FE0_C0[ip][j]*(((FE0_C0[ip][k + 26]))*(-1 [...]
-          // Number of operations to compute entry: 64
-          A[j*52 + k] += ((((((((0 + FE0_C0_D01[ip][k]))*0.5)*FE0_C0[ip][j]*n_01 + (((0 + FE0_C1_D01[ip][k]))*0.5)*FE0_C1[ip][j]*n_01) + ((((FE0_C0_D10[ip][k] + 0))*0.5)*FE0_C0[ip][j]*n_00 + (((FE0_C1_D10[ip][k] + 0))*0.5)*FE0_C1[ip][j]*n_00)))*(-1.0) + ((((FE0_C0[ip][j]*n_00 + FE0_C1[ip][j]*n_01))*FE0_C2[ip][k]*0.5 + ((FE0_C0[ip][k]*n_00 + FE0_C1[ip][k]*n_01))*FE0_C2[ip][j]*0.5) + ((FE0_C0[ip][j]*FE0_C0[ip][k] + FE0_C1[ip][j]*FE0_C1[ip][k]))*(90.0/(0.5*((2.0*circumradius_0 + 2.0*circumr [...]
-        } // end loop over 'k'
-      } // end loop over 'j'
-    } // end loop over 'ip'
-  }
-
-};
-
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
-
-class multimeshstokes2d_custom_integral_0_2: public ufc::custom_integral
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_custom_integral_0_2() : ufc::custom_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_custom_integral_0_2()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true, false});
-    return enabled;
-  }
-
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 2;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
-  {
-    
-    // --- Compute geometric quantities on cell 0 ---
-    
-    // Extract vertex coordinates
-    const double* vertex_coordinates_0 = vertex_coordinates + 0;
-    
-    // Compute Jacobian
-    double J_0[4];
-    compute_jacobian_triangle_2d(J_0, vertex_coordinates_0);
-    
-    // Compute Jacobian inverse and determinant
-    double K_0[4];
-    double detJ_0;
-    compute_jacobian_inverse_triangle_2d(K_0, detJ_0, J_0);
-    
-    // Compute cell volume
-    
-    // Compute circumradius of triangle in 2D
-    
-    
-    // --- Compute geometric quantities on cell 1 ---
-    
-    // Extract vertex coordinates
-    const double* vertex_coordinates_1 = vertex_coordinates + 6;
-    
-    // Compute Jacobian
-    double J_1[4];
-    compute_jacobian_triangle_2d(J_1, vertex_coordinates_1);
-    
-    // Compute Jacobian inverse and determinant
-    double K_1[4];
-    double detJ_1;
-    compute_jacobian_inverse_triangle_2d(K_1, detJ_1, J_1);
-    
-    // Compute cell volume
-    
-    // Compute circumradius of triangle in 2D
-    
-    
-    // Set quadrature weights
-    const double* W = quadrature_weights;
-    
-    // --- Evaluation of basis function derivatives of order 1 ---
-    
-    // Create table FE0_C0_D10 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C0_D10(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0_D10[ip].resize(52);
-    
-    // Create table FE0_C1_D10 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C1_D10(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1_D10[ip].resize(52);
-    
-    // Create table FE0_C0_D01 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C0_D01(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0_D01[ip].resize(52);
-    
-    // Create table FE0_C1_D01 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE0_C1_D01(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1_D01[ip].resize(52);
-    
-    // Evaluate basis function derivatives on cell 0
-    static double FE0_dvalues_1_0[156];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis function derivatives
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C0_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 0];
-      
-      // Copy values to table FE0_C1_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D10[ip][0 + i] = FE0_dvalues_1_0[6*i + 2];
-      
-      // Copy values to table FE0_C0_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 1];
-      
-      // Copy values to table FE0_C1_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D01[ip][0 + i] = FE0_dvalues_1_0[6*i + 3];
-    } // end loop over 'ip'
-    
-    // Evaluate basis function derivatives on cell 1
-    static double FE0_dvalues_1_1[156];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis function derivatives
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C0_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D10[ip][26 + i] = FE0_dvalues_1_1[6*i + 0];
-      
-      // Copy values to table FE0_C1_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D10[ip][26 + i] = FE0_dvalues_1_1[6*i + 2];
-      
-      // Copy values to table FE0_C0_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C0_D01[ip][26 + i] = FE0_dvalues_1_1[6*i + 1];
-      
-      // Copy values to table FE0_C1_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE0_C1_D01[ip][26 + i] = FE0_dvalues_1_1[6*i + 3];
-    } // end loop over 'ip'
-    
-    
-    // --- Evaluation of basis functions ---
-    
-    // Create table FE1 for basis function values on all cells
-    std::vector<std::vector<double> > FE1(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1[ip].resize(2);
-    
-    // Evaluate basis functions on cell 0
-    static double FE1_values_0[1];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis functions
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_0::_evaluate_basis_all(FE1_values_0, x, v, cell_orientation);
-      
-      // Copy values to table FE1
-      for (std::size_t i = 0; i < 1; i++)
-        FE1[ip][0 + i] = FE1_values_0[1*i + 0];
-    } // end loop over 'ip'
-    
-    // Evaluate basis functions on cell 1
-    static double FE1_values_1[1];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis functions
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 6;
-      multimeshstokes2d_finite_element_0::_evaluate_basis_all(FE1_values_1, x, v, cell_orientation);
-      
-      // Copy values to table FE1
-      for (std::size_t i = 0; i < 1; i++)
-        FE1[ip][1 + i] = FE1_values_1[1*i + 0];
-    } // end loop over 'ip'
-    
-    // Reset values in the element tensor.
-    for (unsigned int r = 0; r < 2704; r++)
-    {
-      A[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Compute element tensor using UFL quadrature representation
-    // Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
-    
-    // Loop quadrature points for integral.
-    // Number of operations to compute element tensor for following IP loop = unknown
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      
-      // Coefficient declarations.
-      double F0 = 0.0;
-      
-      // Total number of operations to compute function values = 2
-      for (unsigned int r = 0; r < 1; r++)
-      {
-        F0 += FE1[ip][0]*w[0][0];
-      } // end loop over 'r'
-      
-      // Number of operations for primary indices: 59488
-      for (unsigned int j = 0; j < 26; j++)
-      {
-        for (unsigned int k = 0; k < 26; k++)
-        {
-          // Number of operations to compute entry: 26
-          A[(j + 26)*52 + (k + 26)] += (((((((FE0_C0_D10[ip][j + 26]) + 0))*(-1.0))*((((FE0_C0_D10[ip][k + 26]) + 0))*(-1.0)) + ((((FE0_C1_D10[ip][j + 26]) + 0))*(-1.0))*((((FE0_C1_D10[ip][k + 26]) + 0))*(-1.0))) + ((((0 + (FE0_C0_D01[ip][j + 26])))*(-1.0))*(((0 + (FE0_C0_D01[ip][k + 26])))*(-1.0)) + (((0 + (FE0_C1_D01[ip][j + 26])))*(-1.0))*(((0 + (FE0_C1_D01[ip][k + 26])))*(-1.0)))))*F0*W[ip];
-          // Number of operations to compute entry: 22
-          A[(j + 26)*52 + k] += (((((((FE0_C0_D10[ip][j + 26]) + 0))*(-1.0))*((FE0_C0_D10[ip][k] + 0)) + ((((FE0_C1_D10[ip][j + 26]) + 0))*(-1.0))*((FE0_C1_D10[ip][k] + 0))) + ((((0 + (FE0_C0_D01[ip][j + 26])))*(-1.0))*((0 + FE0_C0_D01[ip][k])) + (((0 + (FE0_C1_D01[ip][j + 26])))*(-1.0))*((0 + FE0_C1_D01[ip][k])))))*F0*W[ip];
-          // Number of operations to compute entry: 22
-          A[j*52 + (k + 26)] += (((((0 + FE0_C0_D01[ip][j]))*(((0 + (FE0_C0_D01[ip][k + 26])))*(-1.0)) + ((0 + FE0_C1_D01[ip][j]))*(((0 + (FE0_C1_D01[ip][k + 26])))*(-1.0))) + (((FE0_C0_D10[ip][j] + 0))*((((FE0_C0_D10[ip][k + 26]) + 0))*(-1.0)) + ((FE0_C1_D10[ip][j] + 0))*((((FE0_C1_D10[ip][k + 26]) + 0))*(-1.0)))))*F0*W[ip];
-          // Number of operations to compute entry: 18
-          A[j*52 + k] += (((((0 + FE0_C0_D01[ip][j]))*((0 + FE0_C0_D01[ip][k])) + ((0 + FE0_C1_D01[ip][j]))*((0 + FE0_C1_D01[ip][k]))) + (((FE0_C0_D10[ip][j] + 0))*((FE0_C0_D10[ip][k] + 0)) + ((FE0_C1_D10[ip][j] + 0))*((FE0_C1_D10[ip][k] + 0)))))*F0*W[ip];
-        } // 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 multimeshstokes2d_cell_integral_1_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_cell_integral_1_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_cell_integral_1_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true, false});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    20
-    // Number of operations (multiply-add pairs) for tensor contraction: 166
-    // Total number of operations (multiply-add pairs):                  189
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0 = det*w[0][0]*(1.0);
-    const double G0_1 = det*w[0][1]*(1.0);
-    const double G0_2 = det*w[0][2]*(1.0);
-    const double G0_3 = det*w[0][3]*(1.0);
-    const double G0_4 = det*w[0][4]*(1.0);
-    const double G0_5 = det*w[0][5]*(1.0);
-    const double G0_6 = det*w[0][6]*(1.0);
-    const double G0_7 = det*w[0][7]*(1.0);
-    const double G0_8 = det*w[0][8]*(1.0);
-    const double G0_9 = det*w[0][9]*(1.0);
-    const double G1_10 = det*w[0][10]*(1.0);
-    const double G1_11 = det*w[0][11]*(1.0);
-    const double G1_12 = det*w[0][12]*(1.0);
-    const double G1_13 = det*w[0][13]*(1.0);
-    const double G1_14 = det*w[0][14]*(1.0);
-    const double G1_15 = det*w[0][15]*(1.0);
-    const double G1_16 = det*w[0][16]*(1.0);
-    const double G1_17 = det*w[0][17]*(1.0);
-    const double G1_18 = det*w[0][18]*(1.0);
-    const double G1_19 = det*w[0][19]*(1.0);
-    
-    // Compute element tensor
-    A[0] = 0.00565476190476195*G0_0 + 0.000818452380952388*G0_1 + 0.000818452380952388*G0_2 + 0.00200892857142856*G0_3 + 0.00200892857142856*G0_4 + 0.00133928571428575*G0_5 + 0.00133928571428575*G0_7 + 0.0026785714285714*G0_9;
-    A[1] = 0.000818452380952388*G0_0 + 0.00565476190476195*G0_1 + 0.000818452380952388*G0_2 + 0.00133928571428575*G0_3 + 0.00200892857142857*G0_5 + 0.00200892857142857*G0_6 + 0.00133928571428575*G0_8 + 0.00267857142857142*G0_9;
-    A[2] = 0.000818452380952388*G0_0 + 0.000818452380952388*G0_1 + 0.00565476190476195*G0_2 + 0.00133928571428575*G0_4 + 0.00133928571428575*G0_6 + 0.00200892857142857*G0_7 + 0.00200892857142857*G0_8 + 0.00267857142857142*G0_9;
-    A[3] = 0.00200892857142856*G0_0 + 0.00133928571428575*G0_1 + 0.0401785714285717*G0_3 - 0.0140624999999999*G0_4 - 0.00401785714285714*G0_5 - 0.0100446428571428*G0_6 - 0.0100446428571428*G0_7 + 0.0200892857142856*G0_8 + 0.0120535714285713*G0_9;
-    A[4] = 0.00200892857142856*G0_0 + 0.00133928571428575*G0_2 - 0.0140624999999999*G0_3 + 0.0401785714285717*G0_4 - 0.0100446428571428*G0_5 + 0.0200892857142856*G0_6 - 0.00401785714285714*G0_7 - 0.0100446428571428*G0_8 + 0.0120535714285713*G0_9;
-    A[5] = 0.00133928571428575*G0_0 + 0.00200892857142857*G0_1 - 0.00401785714285714*G0_3 - 0.0100446428571428*G0_4 + 0.0401785714285717*G0_5 - 0.0140624999999999*G0_6 + 0.0200892857142856*G0_7 - 0.0100446428571428*G0_8 + 0.0120535714285715*G0_9;
-    A[6] = 0.00200892857142857*G0_1 + 0.00133928571428575*G0_2 - 0.0100446428571428*G0_3 + 0.0200892857142856*G0_4 - 0.0140624999999999*G0_5 + 0.0401785714285718*G0_6 - 0.0100446428571428*G0_7 - 0.00401785714285715*G0_8 + 0.0120535714285714*G0_9;
-    A[7] = 0.00133928571428575*G0_0 + 0.00200892857142857*G0_2 - 0.0100446428571428*G0_3 - 0.00401785714285714*G0_4 + 0.0200892857142856*G0_5 - 0.0100446428571428*G0_6 + 0.0401785714285717*G0_7 - 0.0140624999999999*G0_8 + 0.0120535714285715*G0_9;
-    A[8] = 0.00133928571428575*G0_1 + 0.00200892857142857*G0_2 + 0.0200892857142856*G0_3 - 0.0100446428571428*G0_4 - 0.0100446428571428*G0_5 - 0.00401785714285714*G0_6 - 0.0140624999999999*G0_7 + 0.0401785714285717*G0_8 + 0.0120535714285714*G0_9;
-    A[9] = 0.0026785714285714*G0_0 + 0.00267857142857142*G0_1 + 0.00267857142857142*G0_2 + 0.0120535714285713*G0_3 + 0.0120535714285713*G0_4 + 0.0120535714285715*G0_5 + 0.0120535714285714*G0_6 + 0.0120535714285715*G0_7 + 0.0120535714285714*G0_8 + 0.144642857142856*G0_9;
-    A[10] = 0.00565476190476195*G1_10 + 0.000818452380952388*G1_11 + 0.000818452380952388*G1_12 + 0.00200892857142856*G1_13 + 0.00200892857142856*G1_14 + 0.00133928571428575*G1_15 + 0.00133928571428575*G1_17 + 0.0026785714285714*G1_19;
-    A[11] = 0.000818452380952388*G1_10 + 0.00565476190476195*G1_11 + 0.000818452380952388*G1_12 + 0.00133928571428575*G1_13 + 0.00200892857142857*G1_15 + 0.00200892857142857*G1_16 + 0.00133928571428575*G1_18 + 0.00267857142857142*G1_19;
-    A[12] = 0.000818452380952388*G1_10 + 0.000818452380952388*G1_11 + 0.00565476190476195*G1_12 + 0.00133928571428575*G1_14 + 0.00133928571428575*G1_16 + 0.00200892857142857*G1_17 + 0.00200892857142857*G1_18 + 0.00267857142857142*G1_19;
-    A[13] = 0.00200892857142856*G1_10 + 0.00133928571428575*G1_11 + 0.0401785714285717*G1_13 - 0.0140624999999999*G1_14 - 0.00401785714285714*G1_15 - 0.0100446428571428*G1_16 - 0.0100446428571428*G1_17 + 0.0200892857142856*G1_18 + 0.0120535714285713*G1_19;
-    A[14] = 0.00200892857142856*G1_10 + 0.00133928571428575*G1_12 - 0.0140624999999999*G1_13 + 0.0401785714285717*G1_14 - 0.0100446428571428*G1_15 + 0.0200892857142856*G1_16 - 0.00401785714285714*G1_17 - 0.0100446428571428*G1_18 + 0.0120535714285713*G1_19;
-    A[15] = 0.00133928571428575*G1_10 + 0.00200892857142857*G1_11 - 0.00401785714285714*G1_13 - 0.0100446428571428*G1_14 + 0.0401785714285717*G1_15 - 0.0140624999999999*G1_16 + 0.0200892857142856*G1_17 - 0.0100446428571428*G1_18 + 0.0120535714285715*G1_19;
-    A[16] = 0.00200892857142857*G1_11 + 0.00133928571428575*G1_12 - 0.0100446428571428*G1_13 + 0.0200892857142856*G1_14 - 0.0140624999999999*G1_15 + 0.0401785714285718*G1_16 - 0.0100446428571428*G1_17 - 0.00401785714285715*G1_18 + 0.0120535714285714*G1_19;
-    A[17] = 0.00133928571428575*G1_10 + 0.00200892857142857*G1_12 - 0.0100446428571428*G1_13 - 0.00401785714285714*G1_14 + 0.0200892857142856*G1_15 - 0.0100446428571428*G1_16 + 0.0401785714285717*G1_17 - 0.0140624999999999*G1_18 + 0.0120535714285715*G1_19;
-    A[18] = 0.00133928571428575*G1_11 + 0.00200892857142857*G1_12 + 0.0200892857142856*G1_13 - 0.0100446428571428*G1_14 - 0.0100446428571428*G1_15 - 0.00401785714285714*G1_16 - 0.0140624999999999*G1_17 + 0.0401785714285717*G1_18 + 0.0120535714285714*G1_19;
-    A[19] = 0.0026785714285714*G1_10 + 0.00267857142857142*G1_11 + 0.00267857142857142*G1_12 + 0.0120535714285713*G1_13 + 0.0120535714285713*G1_14 + 0.0120535714285715*G1_15 + 0.0120535714285714*G1_16 + 0.0120535714285715*G1_17 + 0.0120535714285714*G1_18 + 0.144642857142856*G1_19;
-    A[20] = 0.0;
-    A[21] = 0.0;
-    A[22] = 0.0;
-    A[23] = 0.0;
-    A[24] = 0.0;
-    A[25] = 0.0;
-  }
-
-};
-
-/// This class defines the interface for the tabulation of the
-/// tensor corresponding to the local contribution to a form from
-/// the integral over a custom domain defined in terms of a set of
-/// quadrature points and weights.
-
-class multimeshstokes2d_custom_integral_1_0: public ufc::custom_integral
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_custom_integral_1_0() : ufc::custom_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_custom_integral_1_0()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true, true});
-    return enabled;
-  }
-
-  /// Return the number of cells involved in evaluation of the integral
-  virtual std::size_t num_cells() const
-  {
-    return 1;
-  }
-
-  /// Tabulate the tensor for the contribution from a custom domain
-  virtual void tabulate_tensor(double* A,
-                               const double * const * w,
-                               const double* vertex_coordinates,
-                               std::size_t num_quadrature_points,
-                               const double* quadrature_points,
-                               const double* quadrature_weights,
-                               const double* facet_normals,
-                               int cell_orientation) const
-  {
-    
-    // --- Compute geometric quantities on cell 0 ---
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Compute cell volume
-    const double volume = std::abs(detJ)/2.0;
-    
-    // Compute circumradius of triangle in 2D
-    const double v1v2  = std::sqrt((vertex_coordinates[4] - vertex_coordinates[2])*(vertex_coordinates[4] - vertex_coordinates[2]) + (vertex_coordinates[5] - vertex_coordinates[3])*(vertex_coordinates[5] - vertex_coordinates[3]) );
-    const double v0v2  = std::sqrt(J[3]*J[3] + J[1]*J[1]);
-    const double v0v1  = std::sqrt(J[0]*J[0] + J[2]*J[2]);
-    const double circumradius = 0.25*(v1v2*v0v2*v0v1)/(volume);
-    
-    
-    // Set quadrature weights
-    const double* W = quadrature_weights;
-    
-    // --- Evaluation of basis functions ---
-    
-    // Create table FE0_C0 for basis function values on all cells
-    std::vector<std::vector<double> > FE0_C0(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C0[ip].resize(20);
-    
-    // Create table FE0_C1 for basis function values on all cells
-    std::vector<std::vector<double> > FE0_C1(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE0_C1[ip].resize(20);
-    
-    // Evaluate basis functions on cell 0
-    static double FE0_values_0[40];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis functions
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_2::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
-      
-      // Copy values to table FE0_C0
-      for (std::size_t i = 0; i < 20; i++)
-        FE0_C0[ip][0 + i] = FE0_values_0[2*i + 0];
-      
-      // Copy values to table FE0_C1
-      for (std::size_t i = 0; i < 20; i++)
-        FE0_C1[ip][0 + i] = FE0_values_0[2*i + 1];
-    } // end loop over 'ip'
-    
-    // --- Evaluation of basis functions ---
-    
-    // Create table FE1_C0 for basis function values on all cells
-    std::vector<std::vector<double> > FE1_C0(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C0[ip].resize(26);
-    
-    // Create table FE1_C1 for basis function values on all cells
-    std::vector<std::vector<double> > FE1_C1(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C1[ip].resize(26);
-    
-    // Evaluate basis functions on cell 0
-    static double FE1_values_0[78];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis functions
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_all(FE1_values_0, x, v, cell_orientation);
-      
-      // Copy values to table FE1_C0
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C0[ip][0 + i] = FE1_values_0[3*i + 0];
-      
-      // Copy values to table FE1_C1
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C1[ip][0 + i] = FE1_values_0[3*i + 1];
-    } // end loop over 'ip'
-    
-    // --- Evaluation of basis function derivatives of order 1 ---
-    
-    // Create table FE1_C2_D10 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE1_C2_D10(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C2_D10[ip].resize(26);
-    
-    // Create table FE1_C2_D01 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE1_C2_D01(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C2_D01[ip].resize(26);
-    
-    // Evaluate basis function derivatives on cell 0
-    static double FE1_dvalues_1_0[156];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis function derivatives
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_derivatives_all(1, FE1_dvalues_1_0, x, v, cell_orientation);
-      
-      // Copy values to table FE1_C2_D10
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C2_D10[ip][0 + i] = FE1_dvalues_1_0[6*i + 4];
-      
-      // Copy values to table FE1_C2_D01
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C2_D01[ip][0 + i] = FE1_dvalues_1_0[6*i + 5];
-    } // end loop over 'ip'
-    
-    
-    // --- Evaluation of basis function derivatives of order 2 ---
-    
-    // Create table FE1_C0_D20 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE1_C0_D20(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C0_D20[ip].resize(26);
-    
-    // Create table FE1_C1_D20 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE1_C1_D20(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C1_D20[ip].resize(26);
-    
-    // Create table FE1_C0_D11 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE1_C0_D11(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C0_D11[ip].resize(26);
-    
-    // Create table FE1_C1_D11 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE1_C1_D11(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C1_D11[ip].resize(26);
-    
-    // Create table FE1_C0_D02 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE1_C0_D02(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C0_D02[ip].resize(26);
-    
-    // Create table FE1_C1_D02 for basis function derivatives on all cells
-    std::vector<std::vector<double> > FE1_C1_D02(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE1_C1_D02[ip].resize(26);
-    
-    // Evaluate basis function derivatives on cell 0
-    static double FE1_dvalues_2_0[312];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis function derivatives
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_4::_evaluate_basis_derivatives_all(2, FE1_dvalues_2_0, x, v, cell_orientation);
-      
-      // Copy values to table FE1_C0_D20
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C0_D20[ip][0 + i] = FE1_dvalues_2_0[12*i + 0];
-      
-      // Copy values to table FE1_C1_D20
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C1_D20[ip][0 + i] = FE1_dvalues_2_0[12*i + 4];
-      
-      // Copy values to table FE1_C0_D11
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C0_D11[ip][0 + i] = FE1_dvalues_2_0[12*i + 1];
-      
-      // Copy values to table FE1_C1_D11
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C1_D11[ip][0 + i] = FE1_dvalues_2_0[12*i + 5];
-      
-      // Copy values to table FE1_C0_D02
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C0_D02[ip][0 + i] = FE1_dvalues_2_0[12*i + 3];
-      
-      // Copy values to table FE1_C1_D02
-      for (std::size_t i = 0; i < 26; i++)
-        FE1_C1_D02[ip][0 + i] = FE1_dvalues_2_0[12*i + 7];
-    } // end loop over 'ip'
-    
-    
-    // --- Evaluation of basis functions ---
-    
-    // Create table FE2 for basis function values on all cells
-    std::vector<std::vector<double> > FE2(num_quadrature_points);
-    for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
-      FE2[ip].resize(1);
-    
-    // Evaluate basis functions on cell 0
-    static double FE2_values_0[1];
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      // Get current quadrature point and compute values of basis functions
-      const double* x = quadrature_points + ip*2;
-      const double* v = vertex_coordinates + 0;
-      multimeshstokes2d_finite_element_0::_evaluate_basis_all(FE2_values_0, x, v, cell_orientation);
-      
-      // Copy values to table FE2
-      for (std::size_t i = 0; i < 1; i++)
-        FE2[ip][0 + i] = FE2_values_0[1*i + 0];
-    } // end loop over 'ip'
-    
-    // Reset values in the element tensor.
-    for (unsigned int r = 0; r < 26; r++)
-    {
-      A[r] = 0.0;
-    } // end loop over 'r'
-    
-    // Compute element tensor using UFL quadrature representation
-    // Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
-    
-    // Loop quadrature points for integral.
-    // Number of operations to compute element tensor for following IP loop = unknown
-    for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
-    {
-      
-      // Coefficient declarations.
-      double F0 = 0.0;
-      double F1 = 0.0;
-      double F2 = 0.0;
-      
-      // Total number of operations to compute function values = 2
-      for (unsigned int r = 0; r < 1; r++)
-      {
-        F0 += FE2[ip][0]*w[1][0];
-      } // end loop over 'r'
-      
-      // Total number of operations to compute function values = 80
-      for (unsigned int r = 0; r < 20; r++)
-      {
-        F1 += FE0_C0[ip][r]*w[0][r];
-        F2 += FE0_C1[ip][r]*w[0][r];
-      } // end loop over 'r'
-      
-      // Number of operations for primary indices: 936
-      for (unsigned int j = 0; j < 26; j++)
-      {
-        // Number of operations to compute entry: 36
-        A[j] += (((((((((0 + 0 + 0 + FE1_C0_D02[ip][j]) + (FE1_C0_D20[ip][j] + 0 + 0 + 0)))*(-1.0) + ((FE1_C2_D10[ip][j] + 0))*(-1.0)))*F1 + (((((0 + 0 + 0 + FE1_C1_D02[ip][j]) + (FE1_C1_D20[ip][j] + 0 + 0 + 0)))*(-1.0) + ((0 + FE1_C2_D01[ip][j]))*(-1.0)))*F2))*2.0*circumradius*2.0*circumradius)*F0 + (FE1_C0[ip][j]*F1 + FE1_C1[ip][j]*F2))*W[ip];
-      } // 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 multimeshstokes2d_cell_integral_2_otherwise: public ufc::cell_integral
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_cell_integral_2_otherwise() : ufc::cell_integral()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_cell_integral_2_otherwise()
-  {
-    // Do nothing
-  }
-
-  /// Tabulate which form coefficients are used by this integral
-  virtual const std::vector<bool> & enabled_coefficients() const
-  {
-    static const std::vector<bool> enabled({true});
-    return enabled;
-  }
-
-  /// Tabulate the tensor for the contribution from a local cell
-  virtual void tabulate_tensor(double*  A,
-                               const double * const *  w,
-                               const double*  vertex_coordinates,
-                               int cell_orientation) const
-  {
-    // Number of operations (multiply-add pairs) for Jacobian data:      3
-    // Number of operations (multiply-add pairs) for geometry tensor:    264
-    // Number of operations (multiply-add pairs) for tensor contraction: 175
-    // Total number of operations (multiply-add pairs):                  442
-    
-    // Compute Jacobian
-    double J[4];
-    compute_jacobian_triangle_2d(J, vertex_coordinates);
-    
-    // Compute Jacobian inverse and determinant
-    double K[4];
-    double detJ;
-    compute_jacobian_inverse_triangle_2d(K, detJ, J);
-    
-    // Set scale factor
-    const double det = std::abs(detJ);
-    
-    // Compute geometry tensor
-    const double G0_0_0 = det*w[0][0]*w[0][0]*(1.0);
-    const double G0_0_1 = det*w[0][0]*w[0][1]*(1.0);
-    const double G0_0_2 = det*w[0][0]*w[0][2]*(1.0);
-    const double G0_0_3 = det*w[0][0]*w[0][3]*(1.0);
-    const double G0_0_4 = det*w[0][0]*w[0][4]*(1.0);
-    const double G0_0_5 = det*w[0][0]*w[0][5]*(1.0);
-    const double G0_0_7 = det*w[0][0]*w[0][7]*(1.0);
-    const double G0_0_9 = det*w[0][0]*w[0][9]*(1.0);
-    const double G0_1_0 = det*w[0][1]*w[0][0]*(1.0);
-    const double G0_1_1 = det*w[0][1]*w[0][1]*(1.0);
-    const double G0_1_2 = det*w[0][1]*w[0][2]*(1.0);
-    const double G0_1_3 = det*w[0][1]*w[0][3]*(1.0);
-    const double G0_1_5 = det*w[0][1]*w[0][5]*(1.0);
-    const double G0_1_6 = det*w[0][1]*w[0][6]*(1.0);
-    const double G0_1_8 = det*w[0][1]*w[0][8]*(1.0);
-    const double G0_1_9 = det*w[0][1]*w[0][9]*(1.0);
-    const double G0_2_0 = det*w[0][2]*w[0][0]*(1.0);
-    const double G0_2_1 = det*w[0][2]*w[0][1]*(1.0);
-    const double G0_2_2 = det*w[0][2]*w[0][2]*(1.0);
-    const double G0_2_4 = det*w[0][2]*w[0][4]*(1.0);
-    const double G0_2_6 = det*w[0][2]*w[0][6]*(1.0);
-    const double G0_2_7 = det*w[0][2]*w[0][7]*(1.0);
-    const double G0_2_8 = det*w[0][2]*w[0][8]*(1.0);
-    const double G0_2_9 = det*w[0][2]*w[0][9]*(1.0);
-    const double G0_3_0 = det*w[0][3]*w[0][0]*(1.0);
-    const double G0_3_1 = det*w[0][3]*w[0][1]*(1.0);
-    const double G0_3_3 = det*w[0][3]*w[0][3]*(1.0);
-    const double G0_3_4 = det*w[0][3]*w[0][4]*(1.0);
-    const double G0_3_5 = det*w[0][3]*w[0][5]*(1.0);
-    const double G0_3_6 = det*w[0][3]*w[0][6]*(1.0);
-    const double G0_3_7 = det*w[0][3]*w[0][7]*(1.0);
-    const double G0_3_8 = det*w[0][3]*w[0][8]*(1.0);
-    const double G0_3_9 = det*w[0][3]*w[0][9]*(1.0);
-    const double G0_4_0 = det*w[0][4]*w[0][0]*(1.0);
-    const double G0_4_2 = det*w[0][4]*w[0][2]*(1.0);
-    const double G0_4_3 = det*w[0][4]*w[0][3]*(1.0);
-    const double G0_4_4 = det*w[0][4]*w[0][4]*(1.0);
-    const double G0_4_5 = det*w[0][4]*w[0][5]*(1.0);
-    const double G0_4_6 = det*w[0][4]*w[0][6]*(1.0);
-    const double G0_4_7 = det*w[0][4]*w[0][7]*(1.0);
-    const double G0_4_8 = det*w[0][4]*w[0][8]*(1.0);
-    const double G0_4_9 = det*w[0][4]*w[0][9]*(1.0);
-    const double G0_5_0 = det*w[0][5]*w[0][0]*(1.0);
-    const double G0_5_1 = det*w[0][5]*w[0][1]*(1.0);
-    const double G0_5_3 = det*w[0][5]*w[0][3]*(1.0);
-    const double G0_5_4 = det*w[0][5]*w[0][4]*(1.0);
-    const double G0_5_5 = det*w[0][5]*w[0][5]*(1.0);
-    const double G0_5_6 = det*w[0][5]*w[0][6]*(1.0);
-    const double G0_5_7 = det*w[0][5]*w[0][7]*(1.0);
-    const double G0_5_8 = det*w[0][5]*w[0][8]*(1.0);
-    const double G0_5_9 = det*w[0][5]*w[0][9]*(1.0);
-    const double G0_6_1 = det*w[0][6]*w[0][1]*(1.0);
-    const double G0_6_2 = det*w[0][6]*w[0][2]*(1.0);
-    const double G0_6_3 = det*w[0][6]*w[0][3]*(1.0);
-    const double G0_6_4 = det*w[0][6]*w[0][4]*(1.0);
-    const double G0_6_5 = det*w[0][6]*w[0][5]*(1.0);
-    const double G0_6_6 = det*w[0][6]*w[0][6]*(1.0);
-    const double G0_6_7 = det*w[0][6]*w[0][7]*(1.0);
-    const double G0_6_8 = det*w[0][6]*w[0][8]*(1.0);
-    const double G0_6_9 = det*w[0][6]*w[0][9]*(1.0);
-    const double G0_7_0 = det*w[0][7]*w[0][0]*(1.0);
-    const double G0_7_2 = det*w[0][7]*w[0][2]*(1.0);
-    const double G0_7_3 = det*w[0][7]*w[0][3]*(1.0);
-    const double G0_7_4 = det*w[0][7]*w[0][4]*(1.0);
-    const double G0_7_5 = det*w[0][7]*w[0][5]*(1.0);
-    const double G0_7_6 = det*w[0][7]*w[0][6]*(1.0);
-    const double G0_7_7 = det*w[0][7]*w[0][7]*(1.0);
-    const double G0_7_8 = det*w[0][7]*w[0][8]*(1.0);
-    const double G0_7_9 = det*w[0][7]*w[0][9]*(1.0);
-    const double G0_8_1 = det*w[0][8]*w[0][1]*(1.0);
-    const double G0_8_2 = det*w[0][8]*w[0][2]*(1.0);
-    const double G0_8_3 = det*w[0][8]*w[0][3]*(1.0);
-    const double G0_8_4 = det*w[0][8]*w[0][4]*(1.0);
-    const double G0_8_5 = det*w[0][8]*w[0][5]*(1.0);
-    const double G0_8_6 = det*w[0][8]*w[0][6]*(1.0);
-    const double G0_8_7 = det*w[0][8]*w[0][7]*(1.0);
-    const double G0_8_8 = det*w[0][8]*w[0][8]*(1.0);
-    const double G0_8_9 = det*w[0][8]*w[0][9]*(1.0);
-    const double G0_9_0 = det*w[0][9]*w[0][0]*(1.0);
-    const double G0_9_1 = det*w[0][9]*w[0][1]*(1.0);
-    const double G0_9_2 = det*w[0][9]*w[0][2]*(1.0);
-    const double G0_9_3 = det*w[0][9]*w[0][3]*(1.0);
-    const double G0_9_4 = det*w[0][9]*w[0][4]*(1.0);
-    const double G0_9_5 = det*w[0][9]*w[0][5]*(1.0);
-    const double G0_9_6 = det*w[0][9]*w[0][6]*(1.0);
-    const double G0_9_7 = det*w[0][9]*w[0][7]*(1.0);
-    const double G0_9_8 = det*w[0][9]*w[0][8]*(1.0);
-    const double G0_9_9 = det*w[0][9]*w[0][9]*(1.0);
-    const double G1_10_10 = det*w[0][10]*w[0][10]*(1.0);
-    const double G1_10_11 = det*w[0][10]*w[0][11]*(1.0);
-    const double G1_10_12 = det*w[0][10]*w[0][12]*(1.0);
-    const double G1_10_13 = det*w[0][10]*w[0][13]*(1.0);
-    const double G1_10_14 = det*w[0][10]*w[0][14]*(1.0);
-    const double G1_10_15 = det*w[0][10]*w[0][15]*(1.0);
-    const double G1_10_17 = det*w[0][10]*w[0][17]*(1.0);
-    const double G1_10_19 = det*w[0][10]*w[0][19]*(1.0);
-    const double G1_11_10 = det*w[0][11]*w[0][10]*(1.0);
-    const double G1_11_11 = det*w[0][11]*w[0][11]*(1.0);
-    const double G1_11_12 = det*w[0][11]*w[0][12]*(1.0);
-    const double G1_11_13 = det*w[0][11]*w[0][13]*(1.0);
-    const double G1_11_15 = det*w[0][11]*w[0][15]*(1.0);
-    const double G1_11_16 = det*w[0][11]*w[0][16]*(1.0);
-    const double G1_11_18 = det*w[0][11]*w[0][18]*(1.0);
-    const double G1_11_19 = det*w[0][11]*w[0][19]*(1.0);
-    const double G1_12_10 = det*w[0][12]*w[0][10]*(1.0);
-    const double G1_12_11 = det*w[0][12]*w[0][11]*(1.0);
-    const double G1_12_12 = det*w[0][12]*w[0][12]*(1.0);
-    const double G1_12_14 = det*w[0][12]*w[0][14]*(1.0);
-    const double G1_12_16 = det*w[0][12]*w[0][16]*(1.0);
-    const double G1_12_17 = det*w[0][12]*w[0][17]*(1.0);
-    const double G1_12_18 = det*w[0][12]*w[0][18]*(1.0);
-    const double G1_12_19 = det*w[0][12]*w[0][19]*(1.0);
-    const double G1_13_10 = det*w[0][13]*w[0][10]*(1.0);
-    const double G1_13_11 = det*w[0][13]*w[0][11]*(1.0);
-    const double G1_13_13 = det*w[0][13]*w[0][13]*(1.0);
-    const double G1_13_14 = det*w[0][13]*w[0][14]*(1.0);
-    const double G1_13_15 = det*w[0][13]*w[0][15]*(1.0);
-    const double G1_13_16 = det*w[0][13]*w[0][16]*(1.0);
-    const double G1_13_17 = det*w[0][13]*w[0][17]*(1.0);
-    const double G1_13_18 = det*w[0][13]*w[0][18]*(1.0);
-    const double G1_13_19 = det*w[0][13]*w[0][19]*(1.0);
-    const double G1_14_10 = det*w[0][14]*w[0][10]*(1.0);
-    const double G1_14_12 = det*w[0][14]*w[0][12]*(1.0);
-    const double G1_14_13 = det*w[0][14]*w[0][13]*(1.0);
-    const double G1_14_14 = det*w[0][14]*w[0][14]*(1.0);
-    const double G1_14_15 = det*w[0][14]*w[0][15]*(1.0);
-    const double G1_14_16 = det*w[0][14]*w[0][16]*(1.0);
-    const double G1_14_17 = det*w[0][14]*w[0][17]*(1.0);
-    const double G1_14_18 = det*w[0][14]*w[0][18]*(1.0);
-    const double G1_14_19 = det*w[0][14]*w[0][19]*(1.0);
-    const double G1_15_10 = det*w[0][15]*w[0][10]*(1.0);
-    const double G1_15_11 = det*w[0][15]*w[0][11]*(1.0);
-    const double G1_15_13 = det*w[0][15]*w[0][13]*(1.0);
-    const double G1_15_14 = det*w[0][15]*w[0][14]*(1.0);
-    const double G1_15_15 = det*w[0][15]*w[0][15]*(1.0);
-    const double G1_15_16 = det*w[0][15]*w[0][16]*(1.0);
-    const double G1_15_17 = det*w[0][15]*w[0][17]*(1.0);
-    const double G1_15_18 = det*w[0][15]*w[0][18]*(1.0);
-    const double G1_15_19 = det*w[0][15]*w[0][19]*(1.0);
-    const double G1_16_11 = det*w[0][16]*w[0][11]*(1.0);
-    const double G1_16_12 = det*w[0][16]*w[0][12]*(1.0);
-    const double G1_16_13 = det*w[0][16]*w[0][13]*(1.0);
-    const double G1_16_14 = det*w[0][16]*w[0][14]*(1.0);
-    const double G1_16_15 = det*w[0][16]*w[0][15]*(1.0);
-    const double G1_16_16 = det*w[0][16]*w[0][16]*(1.0);
-    const double G1_16_17 = det*w[0][16]*w[0][17]*(1.0);
-    const double G1_16_18 = det*w[0][16]*w[0][18]*(1.0);
-    const double G1_16_19 = det*w[0][16]*w[0][19]*(1.0);
-    const double G1_17_10 = det*w[0][17]*w[0][10]*(1.0);
-    const double G1_17_12 = det*w[0][17]*w[0][12]*(1.0);
-    const double G1_17_13 = det*w[0][17]*w[0][13]*(1.0);
-    const double G1_17_14 = det*w[0][17]*w[0][14]*(1.0);
-    const double G1_17_15 = det*w[0][17]*w[0][15]*(1.0);
-    const double G1_17_16 = det*w[0][17]*w[0][16]*(1.0);
-    const double G1_17_17 = det*w[0][17]*w[0][17]*(1.0);
-    const double G1_17_18 = det*w[0][17]*w[0][18]*(1.0);
-    const double G1_17_19 = det*w[0][17]*w[0][19]*(1.0);
-    const double G1_18_11 = det*w[0][18]*w[0][11]*(1.0);
-    const double G1_18_12 = det*w[0][18]*w[0][12]*(1.0);
-    const double G1_18_13 = det*w[0][18]*w[0][13]*(1.0);
-    const double G1_18_14 = det*w[0][18]*w[0][14]*(1.0);
-    const double G1_18_15 = det*w[0][18]*w[0][15]*(1.0);
-    const double G1_18_16 = det*w[0][18]*w[0][16]*(1.0);
-    const double G1_18_17 = det*w[0][18]*w[0][17]*(1.0);
-    const double G1_18_18 = det*w[0][18]*w[0][18]*(1.0);
-    const double G1_18_19 = det*w[0][18]*w[0][19]*(1.0);
-    const double G1_19_10 = det*w[0][19]*w[0][10]*(1.0);
-    const double G1_19_11 = det*w[0][19]*w[0][11]*(1.0);
-    const double G1_19_12 = det*w[0][19]*w[0][12]*(1.0);
-    const double G1_19_13 = det*w[0][19]*w[0][13]*(1.0);
-    const double G1_19_14 = det*w[0][19]*w[0][14]*(1.0);
-    const double G1_19_15 = det*w[0][19]*w[0][15]*(1.0);
-    const double G1_19_16 = det*w[0][19]*w[0][16]*(1.0);
-    const double G1_19_17 = det*w[0][19]*w[0][17]*(1.0);
-    const double G1_19_18 = det*w[0][19]*w[0][18]*(1.0);
-    const double G1_19_19 = det*w[0][19]*w[0][19]*(1.0);
-    
-    // Compute element tensor
-    A[0] = 0.00565476190476195*G0_0_0 + 0.000818452380952388*G0_0_1 + 0.000818452380952388*G0_0_2 + 0.00200892857142856*G0_0_3 + 0.00200892857142856*G0_0_4 + 0.00133928571428575*G0_0_5 + 0.00133928571428575*G0_0_7 + 0.0026785714285714*G0_0_9 + 0.000818452380952388*G0_1_0 + 0.00565476190476195*G0_1_1 + 0.000818452380952388*G0_1_2 + 0.00133928571428575*G0_1_3 + 0.00200892857142857*G0_1_5 + 0.00200892857142857*G0_1_6 + 0.00133928571428575*G0_1_8 + 0.00267857142857142*G0_1_9 + 0.000818452380 [...]
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class multimeshstokes2d_form_0: public ufc::form
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_form_0() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_form_0()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "0fdae5e25fb8b86a50a2ba088b0c6c53f830ae334a6d978e008eb2a1465743539833faf458b402dddd00ea8db6001d75936cd49415d2acf94840eaf805132d43";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 2;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 2;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({0, 1});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_finite_element_4();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes2d_finite_element_4();
-        break;
-      }
-    case 2:
-      {
-        return new multimeshstokes2d_finite_element_0();
-        break;
-      }
-    case 3:
-      {
-        return new multimeshstokes2d_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_dofmap_4();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes2d_dofmap_4();
-        break;
-      }
-    case 2:
-      {
-        return new multimeshstokes2d_dofmap_0();
-        break;
-      }
-    case 3:
-      {
-        return new multimeshstokes2d_dofmap_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 3;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return true;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    switch (subdomain_id)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_custom_integral_0_0();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes2d_custom_integral_0_1();
-        break;
-      }
-    case 2:
-      {
-        return new multimeshstokes2d_custom_integral_0_2();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new multimeshstokes2d_cell_integral_0_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class multimeshstokes2d_form_1: public ufc::form
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_form_1() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_form_1()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "ea70c7b31aa28ab86009b6f0adfabc74bd54a87bd7684519306bfeaeb8bdd51cb9e163fdefccf31cb8d074d9c1604b473b78d1db21fe29ff5f924d8f2a7e72b4";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 1;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 2;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({0, 1});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_finite_element_4();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes2d_finite_element_2();
-        break;
-      }
-    case 2:
-      {
-        return new multimeshstokes2d_finite_element_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_dofmap_4();
-        break;
-      }
-    case 1:
-      {
-        return new multimeshstokes2d_dofmap_2();
-        break;
-      }
-    case 2:
-      {
-        return new multimeshstokes2d_dofmap_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 1;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return true;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    switch (subdomain_id)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_custom_integral_1_0();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new multimeshstokes2d_cell_integral_1_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-/// This class defines the interface for the assembly of the global
-/// tensor corresponding to a form with r + n arguments, that is, a
-/// mapping
-///
-///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
-///
-/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
-/// global tensor A is defined by
-///
-///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
-///
-/// where each argument Vj represents the application to the
-/// sequence of basis functions of Vj and w1, w2, ..., wn are given
-/// fixed functions (coefficients).
-
-class multimeshstokes2d_form_2: public ufc::form
-{
-public:
-
-  /// Constructor
-  multimeshstokes2d_form_2() : ufc::form()
-  {
-    // Do nothing
-  }
-
-  /// Destructor
-  virtual ~multimeshstokes2d_form_2()
-  {
-    // Do nothing
-  }
-
-  /// Return a string identifying the form
-  virtual const char* signature() const
-  {
-    return "4ba235b1c9b726eff869f53f2fff120176b66f4a3ac71f36cfcdac2a60554170048ea811edb9f4fb2144ec803897c4b939c8c31a9e6835a19323c0c33163cefa";
-  }
-
-
-  /// Return the rank of the global tensor (r)
-  virtual std::size_t rank() const
-  {
-    return 0;
-  }
-
-  /// Return the number of coefficients (n)
-  virtual std::size_t num_coefficients() const
-  {
-    return 1;
-  }
-
-  /// Return original coefficient position for each coefficient (0 <= i < n)
-  virtual std::size_t original_coefficient_position(std::size_t i) const
-  {
-    static const std::vector<std::size_t> position({0});
-    return position[i];
-  }
-
-
-  /// Create a new finite element for argument function i
-  virtual ufc::finite_element* create_finite_element(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_finite_element_4();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-  /// Create a new dofmap for argument function i
-  virtual ufc::dofmap* create_dofmap(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      {
-        return new multimeshstokes2d_dofmap_4();
-        break;
-      }
-    }
-    
-    return 0;
-  }
-
-
-  /// Return the number of cell domains
-  virtual std::size_t max_cell_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of exterior facet domains
-  virtual std::size_t max_exterior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of interior facet domains
-  virtual std::size_t max_interior_facet_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of vertex domains
-  virtual std::size_t max_vertex_subdomain_id() const
-  {
-    return 0;
-  }
-
-  /// Return the number of custom domains
-  virtual std::size_t max_custom_subdomain_id() const
-  {
-    return 0;
-  }
-
-
-  /// Return whether the form has any cell integrals
-  virtual bool has_cell_integrals() const
-  {
-    return true;
-  }
-
-  /// Return whether the form has any exterior facet integrals
-  virtual bool has_exterior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any interior facet integrals
-  virtual bool has_interior_facet_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any vertex integrals
-  virtual bool has_vertex_integrals() const
-  {
-    return false;
-  }
-
-  /// Return whether the form has any custom integrals
-  virtual bool has_custom_integrals() const
-  {
-    return false;
-  }
-
-
-  /// Create a new cell integral on sub domain subdomain_id
-  virtual ufc::cell_integral* create_cell_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new exterior facet integral on sub domain subdomain_id
-  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on sub domain subdomain_id
-  virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on sub domain subdomain_id
-  virtual ufc::vertex_integral* create_vertex_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on sub domain subdomain_id
-  virtual ufc::custom_integral* create_custom_integral(std::size_t subdomain_id) const
-  {
-    return 0;
-  }
-
-
-  /// Create a new cell integral on everywhere else
-  virtual ufc::cell_integral* create_default_cell_integral() const
-  {
-    return new multimeshstokes2d_cell_integral_2_otherwise();
-  }
-
-  /// Create a new exterior facet integral on everywhere else
-  virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new interior facet integral on everywhere else
-  virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new vertex integral on everywhere else
-  virtual ufc::vertex_integral* create_default_vertex_integral() const
-  {
-    return 0;
-  }
-
-  /// Create a new custom integral on everywhere else
-  virtual ufc::custom_integral* create_default_custom_integral() const
-  {
-    return 0;
-  }
-
-};
-
-// DOLFIN wrappers
-
-// Standard library includes
-#include <string>
-
-// DOLFIN includes
-#include <dolfin/common/NoDeleter.h>
-#include <dolfin/fem/FiniteElement.h>
-#include <dolfin/fem/DofMap.h>
-#include <dolfin/fem/Form.h>
-#include <dolfin/function/FunctionSpace.h>
-#include <dolfin/function/GenericFunction.h>
-#include <dolfin/function/CoefficientAssigner.h>
-#include <dolfin/adaptivity/ErrorControl.h>
-#include <dolfin/adaptivity/GoalFunctional.h>
-
-namespace MultiMeshStokes2D
-{
-
-class CoefficientSpace_w0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_w0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_w0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class CoefficientSpace_w1: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_0()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_w1(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_0()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  CoefficientSpace_w1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_0()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  CoefficientSpace_w1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_0()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_0()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_a_FunctionSpace_1(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-typedef CoefficientSpace_w0 Form_a_FunctionSpace_2;
-
-typedef CoefficientSpace_w1 Form_a_FunctionSpace_3;
-
-class Form_a: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0):
-    dolfin::Form(2, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_0());
-  }
-
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& w0, const dolfin::GenericFunction& w1):
-    dolfin::Form(2, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->w0 = w0;
-    this->w1 = w1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_0());
-  }
-
-  // Constructor
-  Form_a(const dolfin::FunctionSpace& V1, const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> w0, std::shared_ptr<const dolfin::GenericFunction> w1):
-    dolfin::Form(2, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-    _function_spaces[1] = reference_to_no_delete_pointer(V1);
-
-    this->w0 = *w0;
-    this->w1 = *w1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(2, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& w0, const dolfin::GenericFunction& w1):
-    dolfin::Form(2, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->w0 = w0;
-    this->w1 = w1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_0());
-  }
-
-  // Constructor
-  Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w0, std::shared_ptr<const dolfin::GenericFunction> w1):
-    dolfin::Form(2, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = V0;
-    _function_spaces[1] = V1;
-
-    this->w0 = *w0;
-    this->w1 = *w1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_0());
-  }
-
-  // Destructor
-  ~Form_a()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-    if (name == "w0")
-      return 0;
-    else if (name == "w1")
-      return 1;
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      return "w0";
-    case 1:
-      return "w1";
-    }
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_a_FunctionSpace_0 TestSpace;
-  typedef Form_a_FunctionSpace_1 TrialSpace;
-  typedef Form_a_FunctionSpace_2 CoefficientSpace_w0;
-  typedef Form_a_FunctionSpace_3 CoefficientSpace_w1;
-
-  // Coefficients
-  dolfin::CoefficientAssigner w0;
-  dolfin::CoefficientAssigner w1;
-};
-
-class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
-{
-public:
-
-  //--- Constructors for standard function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), mesh)))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), *mesh)))
-  {
-    // Do nothing
-  }
-
-  //--- Constructors for constrained function space, 2 different versions ---
-
-  // Create standard function space (reference version)
-  Form_L_FunctionSpace_0(const dolfin::Mesh& mesh, const dolfin::SubDomain& constrained_domain):
-    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), mesh,
-                              dolfin::reference_to_no_delete_pointer(constrained_domain))))
-  {
-    // Do nothing
-  }
-
-  // Create standard function space (shared pointer version)
-  Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
-    dolfin::FunctionSpace(mesh,
-                          std::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(std::shared_ptr<ufc::finite_element>(new multimeshstokes2d_finite_element_4()))),
-                          std::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(std::shared_ptr<ufc::dofmap>(new multimeshstokes2d_dofmap_4()), *mesh, constrained_domain)))
-  {
-    // Do nothing
-  }
-
-};
-
-typedef CoefficientSpace_w0 Form_L_FunctionSpace_1;
-
-typedef CoefficientSpace_w1 Form_L_FunctionSpace_2;
-
-class Form_L: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0):
-    dolfin::Form(1, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_1());
-  }
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& w0, const dolfin::GenericFunction& w1):
-    dolfin::Form(1, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->w0 = w0;
-    this->w1 = w1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_1());
-  }
-
-  // Constructor
-  Form_L(const dolfin::FunctionSpace& V0, std::shared_ptr<const dolfin::GenericFunction> w0, std::shared_ptr<const dolfin::GenericFunction> w1):
-    dolfin::Form(1, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = reference_to_no_delete_pointer(V0);
-
-    this->w0 = *w0;
-    this->w1 = *w1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
-    dolfin::Form(1, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = V0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& w0, const dolfin::GenericFunction& w1):
-    dolfin::Form(1, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = V0;
-
-    this->w0 = w0;
-    this->w1 = w1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_1());
-  }
-
-  // Constructor
-  Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> w0, std::shared_ptr<const dolfin::GenericFunction> w1):
-    dolfin::Form(1, 2), w0(*this, 0), w1(*this, 1)
-  {
-    _function_spaces[0] = V0;
-
-    this->w0 = *w0;
-    this->w1 = *w1;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_1());
-  }
-
-  // Destructor
-  ~Form_L()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-    if (name == "w0")
-      return 0;
-    else if (name == "w1")
-      return 1;
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      return "w0";
-    case 1:
-      return "w1";
-    }
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_L_FunctionSpace_0 TestSpace;
-  typedef Form_L_FunctionSpace_1 CoefficientSpace_w0;
-  typedef Form_L_FunctionSpace_2 CoefficientSpace_w1;
-
-  // Coefficients
-  dolfin::CoefficientAssigner w0;
-  dolfin::CoefficientAssigner w1;
-};
-
-typedef CoefficientSpace_w0 Form_M_FunctionSpace_0;
-
-class Form_M: public dolfin::Form
-{
-public:
-
-  // Constructor
-  Form_M(const dolfin::Mesh& mesh):
-    dolfin::Form(0, 1), w0(*this, 0)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_2());
-  }
-
-  // Constructor
-  Form_M(const dolfin::Mesh& mesh, const dolfin::GenericFunction& w0):
-    dolfin::Form(0, 1), w0(*this, 0)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->w0 = w0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_2());
-  }
-
-  // Constructor
-  Form_M(const dolfin::Mesh& mesh, std::shared_ptr<const dolfin::GenericFunction> w0):
-    dolfin::Form(0, 1), w0(*this, 0)
-  {
-    _mesh = reference_to_no_delete_pointer(mesh);
-    this->w0 = *w0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_2());
-  }
-
-  // Constructor
-  Form_M(std::shared_ptr<const dolfin::Mesh> mesh):
-    dolfin::Form(0, 1), w0(*this, 0)
-  {
-    _mesh = mesh;
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_2());
-  }
-
-  // Constructor
-  Form_M(std::shared_ptr<const dolfin::Mesh> mesh, const dolfin::GenericFunction& w0):
-    dolfin::Form(0, 1), w0(*this, 0)
-  {
-    _mesh = mesh;
-    this->w0 = w0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_2());
-  }
-
-  // Constructor
-  Form_M(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::GenericFunction> w0):
-    dolfin::Form(0, 1), w0(*this, 0)
-  {
-    _mesh = mesh;
-    this->w0 = *w0;
-
-    _ufc_form = std::shared_ptr<const ufc::form>(new multimeshstokes2d_form_2());
-  }
-
-  // Destructor
-  ~Form_M()
-  {}
-
-  /// Return the number of the coefficient with this name
-  virtual std::size_t coefficient_number(const std::string& name) const
-  {
-    if (name == "w0")
-      return 0;
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return 0;
-  }
-
-  /// Return the name of the coefficient with this number
-  virtual std::string coefficient_name(std::size_t i) const
-  {
-    switch (i)
-    {
-    case 0:
-      return "w0";
-    }
-
-    dolfin::dolfin_error("generated code for class Form",
-                         "access coefficient data",
-                         "Invalid coefficient");
-    return "unnamed";
-  }
-
-  // Typedefs
-  typedef Form_M_FunctionSpace_0 CoefficientSpace_w0;
-
-  // Coefficients
-  dolfin::CoefficientAssigner w0;
-};
-
-// Class typedefs
-typedef Form_a BilinearForm;
-typedef Form_a JacobianForm;
-typedef Form_L LinearForm;
-typedef Form_L ResidualForm;
-typedef Form_M Functional;
-typedef Form_a::TestSpace FunctionSpace;
-
-}
-
-#endif
diff --git a/test/unit/multimesh/cpp/MultiMeshStokes2D.ufl b/test/unit/multimesh/cpp/MultiMeshStokes2D.ufl
deleted file mode 100644
index 4d42dc8..0000000
--- a/test/unit/multimesh/cpp/MultiMeshStokes2D.ufl
+++ /dev/null
@@ -1,104 +0,0 @@
-# Copyright (C) 2014 August Johansson and Anders Logg
-#
-# Licensed under the GNU LGPL, version 3 or any later version.
-#
-# First added:  2015-05-28
-# Last changed: 2015-06-04
-#
-# This module defines the bilinear form a(u, v) and linear form L(v)
-# for a multimesh formulation of the Stokes equations.
-
-from ufl import *
-
-ORDER = 3
-
-def stokes(domain):
-
-    # Define element
-    P2 = VectorElement("Lagrange", domain, ORDER)
-    P1 = FiniteElement("Lagrange", domain, ORDER - 1)
-    TH = P2 * P1
-
-    # Define trial and test functions and right-hand side
-    (u, p) = TrialFunctions(TH)
-    (v, q) = TestFunctions(TH)
-    (U, P) = Coefficients(TH)
-    f = Coefficient(P2)
-
-    # Define facet normal and mesh size
-    n = FacetNormal(domain)
-    h = 2.0*Circumradius(domain)
-
-    # Define custom measures (FIXME: prettify this)
-    dc0 = dc(0, metadata={"num_cells": 1})
-    dc1 = dc(1, metadata={"num_cells": 2})
-    dc2 = dc(2, metadata={"num_cells": 2})
-
-    # Define measures for integration
-    dX = dx + dc0 # domain integral
-    di = dc1      # interface integral
-    do = dc2      # overlap integral
-
-    # Define constants for stabilization terms
-    beta_1 = Constant(domain)
-    beta_2 = Constant(domain)
-
-    # Parameters
-    alpha = 10.0*ORDER*ORDER
-
-    def tensor_jump(v, n):
-        return outer(v('+'), n('+')) + outer(v('-'), n('-'))
-
-    # Standard Nitsche
-    def a_h(v, w):
-        return inner(grad(v), grad(w))*dX \
-            - inner(avg(grad(v)), tensor_jump(w, n))*di \
-            - inner(avg(grad(w)), tensor_jump(v, n))*di \
-            + alpha/avg(h) * inner(jump(v), jump(w))*di
-
-    # Jump stabilization (formerly s_h)
-    def a_O(v, w):
-        return inner(jump(grad(v)), jump(grad(w)))*do
-
-    # Mixed
-    def b_h(v, q):
-        return -div(v)*q*dX + jump(v, n)*avg(q)*di
-
-    # Least squares stab
-    def d_h(v, q, w, r):
-        return h*h*inner(-div(grad(v)) + grad(q),
-                         -div(grad(w)) - grad(r))*dc0
-
-    # Least squares stab in rhs
-    def d_h_rhs(v, q, f):
-        return h*h*inner(f, -div(grad(v)) - grad(q))*dc0
-
-    # Right-hand side
-    def l_h(v):
-        return dot(f, v)*dX
-
-    # Standard forms for debugging
-    def _a_h(v, w):
-        return inner(grad(v), grad(w))*dx + inner(grad(v), grad(w))*dc0
-    def _b_h(v, q):
-        return -div(v)*q*dx
-    def _l_h(v):
-        return dot(f, v)*dx + dot(f, v)*dc0
-
-    # Bilinear form
-    a  = a_h(u, v)
-    a += b_h(v, p) + b_h(u, q)
-    a += beta_1*a_O(u, v)
-    a += beta_2*d_h(u, p, v, q)
-
-    # Linear form
-    L  = l_h(v)
-    L += beta_2*d_h_rhs(v, q, f)
-
-    # Functional: squared L2 norm of velocity
-    M = dot(U, U)*dx
-
-    return a, L, M
-
-# Create forms
-a, L, M = stokes(triangle)
diff --git a/test/unit/multimesh/cpp/compile.log b/test/unit/multimesh/cpp/compile.log
deleted file mode 100644
index 2728da7..0000000
--- a/test/unit/multimesh/cpp/compile.log
+++ /dev/null
@@ -1,1402 +0,0 @@
-This is FFC, the FEniCS Form Compiler, version 1.6.0.
-For further information, visit http://www.fenics.org/ffc/.
-
-Compiling form MultiMeshStokes2D
-
-Compiler stage 1: Analyzing form(s)
------------------------------------
-  
-  Geometric dimension:         2
-  Number of cell subdomains:   0
-  Number of custom subdomains: 3
-  Rank:                        2
-  Arguments:                   '(v_0, v_1)'
-  Number of coefficients:      2
-  Coefficients:                '[w_2, w_3]'
-  Unique elements:             'Mixed<Vector<2 x CG3(?)>, CG2(?)>, R0(?)'
-  Unique sub elements:         'Mixed<Vector<2 x CG3(?)>, CG2(?)>, R0(?), Vector<2 x
-                                CG3(?)>, CG2(?), CG3(?)'
-  
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Estimated cost of tensor representation: 2
-  representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
-  quadrature_rule:   auto --> default
-  Estimated cost of tensor representation: -1
-  representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 5
-  quadrature_degree: auto --> 5
-  quadrature_rule:   auto --> default
-  Estimated cost of tensor representation: -1
-  representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
-  quadrature_rule:   auto --> default
-  Estimated cost of tensor representation: -1
-  representation:    auto --> quadrature
-  Selecting quadrature degree based on total polynomial degree of integrand: 4
-  quadrature_degree: auto --> 4
-  quadrature_rule:   auto --> default
-  
-  Geometric dimension:         2
-  Number of cell subdomains:   0
-  Number of custom subdomains: 1
-  Rank:                        1
-  Arguments:                   '(v_0)'
-  Number of coefficients:      2
-  Coefficients:                '[w_1, w_3]'
-  Unique elements:             'Mixed<Vector<2 x CG3(?)>, CG2(?)>, Vector<2 x CG3(?)
-                               >, R0(?)'
-  Unique sub elements:         'Mixed<Vector<2 x CG3(?)>, CG2(?)>, Vector<2 x CG3(?)
-                               >, R0(?), CG2(?), CG3(?)'
-  
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Estimated cost of tensor representation: 1
-  representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
-  quadrature_rule:   auto --> default
-  representation:    quadrature
-  quadrature_degree: 5
-  quadrature_rule:   default
-  
-  Geometric dimension:       2
-  Number of cell subdomains: 0
-  Rank:                      0
-  Arguments:                 '()'
-  Number of coefficients:    1
-  Coefficients:              '[w_0]'
-  Unique elements:           'Mixed<Vector<2 x CG3(?)>, CG2(?)>'
-  Unique sub elements:       'Mixed<Vector<2 x CG3(?)>, CG2(?)>, Vector<2 x CG3(?)>,
-                              CG2(?), CG3(?)'
-  
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Estimated cost of tensor representation: 2
-  representation:    auto --> tensor
-  Selecting quadrature degree based on total polynomial degree of integrand: 6
-  quadrature_degree: auto --> 6
-  quadrature_rule:   auto --> default
-  
-Compiler stage 1 finished in 0.39963 seconds.
-
-Compiler stage 2: Computing intermediate representation
--------------------------------------------------------
-  Computing representation of 5 elements
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing representation of 5 dofmaps
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing representation of integrals
-  Computing tensor representation
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Precomputing integrals on reference element
-  Reusing element from cache
-  2704 entries computed in 0.0025 seconds
-  Shape of reference tensor: (26, 26, 2, 2)
-  Primary multi index:   rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  2704 entries computed in 0.00233 seconds
-  Shape of reference tensor: (26, 26, 2, 2)
-  Primary multi index:   rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  2704 entries computed in 0.00226 seconds
-  Shape of reference tensor: (26, 26, 2, 2)
-  Primary multi index:   rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  2704 entries computed in 0.0022 seconds
-  Shape of reference tensor: (26, 26, 2, 2)
-  Primary multi index:   rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 2 dims = [2, 2] indices = [[0, 0], [0, 1], [1, 0], [1, 1]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  1352 entries computed in 0.00206 seconds
-  Shape of reference tensor: (26, 26, 2)
-  Primary multi index:   rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  1352 entries computed in 0.00213 seconds
-  Shape of reference tensor: (26, 26, 2)
-  Primary multi index:   rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  1352 entries computed in 0.00198 seconds
-  Shape of reference tensor: (26, 26, 2)
-  Primary multi index:   rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  1352 entries computed in 0.00258 seconds
-  Shape of reference tensor: (26, 26, 2)
-  Primary multi index:   rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 1 dims = [2] indices = [[0], [1]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Reusing element from cache
-  Reusing element from cache
-  Computing quadrature representation
-  Reusing element from cache
-  Reusing element from cache
-  Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  
-  QG-utils, psi_tables:
-  {None: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): [[]]}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 3, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): [[[], [], []]], (0, 0): [[[], [], []]], (1, 1): [[[], [], []]], (2, 0): [[[], [], [...]
-  
-  QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D02': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D02': array([], shape=(0, 1), dtype=float64), 'FE [...]
-  
-  tables: {'FE0_C1_D02': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D02': array([], shape=(0, 1), dtype=float [...]
-  
-  name_map: {}
-  
-  inv_name_map: {'FE0_C1_D02': 'FE0_C1_D02', 'FE0_C1_D01': 'FE0_C1_D01', 'FE0_C1_D20': 'FE0_C1_D20', 'FE0_C2_D11': 'FE0_C2_D11', 'FE0_C2_D10': 'FE0_C2_D10', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C1_D11': 'FE0_C1_D11', 'FE0_C0_D02': 'FE0_C0_D02', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C2_D20': 'FE0_C2_D20', 'FE0_C0_D01': 'FE0_C0_D01', 'FE0_C0_D20': 'FE0_C0_D20', 'FE0_C2_D01': 'FE0_C2_D01', 'FE0_C2_D02': 'FE0_C2_D02', 'FE1': 'FE1', 'FE0_C0_D11': 'FE0_C0_D11', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', ' [...]
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE0_C1_D02': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D20': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D02': array([], shape=(0, 1), dtype=float64), 'FE [...]
-  
-  QG-utils, psi_tables, name_map:
-  {'FE0_C1_D02': ('FE0_C1_D02', (), False, False), 'FE0_C1_D01': ('FE0_C1_D01', (), False, False), 'FE0_C1_D20': ('FE0_C1_D20', (), False, False), 'FE0_C2_D11': ('FE0_C2_D11', (), False, False), 'FE0_C2_D10': ('FE0_C2_D10', (), False, False), 'FE0_C1_D10': ('FE0_C1_D10', (), False, False), 'FE0_C1_D11': ('FE0_C1_D11', (), False, False), 'FE0_C0_D02': ('FE0_C0_D02', (), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (), False, False), 'FE0_C2_D20': ('FE0_C2_D20', (), False, False), 'FE0_C0_D [...]
-  Transforming custom integral
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing quadrature representation
-  Reusing element from cache
-  Reusing element from cache
-  Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  
-  QG-utils, psi_tables:
-  {None: {MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 3, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): [[[], [], []]], (1, 0): [[[], [], []]], (0, 0): [[[], [], []]]}}}}}
-  
-  QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
-  
-  tables: {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
-  
-  name_map: {}
-  
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE0_C2_D10': 'FE0_C2_D10', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE0_C2_D01': 'FE0_C2_D01', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([], shape=(0, 1), dtype=float64)}
-  
-  QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C1_D01', (), False, False), 'FE0_C2_D10': ('FE0_C2_D10', (), False, False), 'FE0_C1_D10': ('FE0_C1_D10', (), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (), False, False), 'FE0_C2_D01': ('FE0_C2_D01', (), False, False), 'FE0_C2': ('FE0_C2', (), False, False), 'FE0_C1': ('FE0_C1', (), False, False), 'FE0_C0': ('FE0_C0', (), False, False)}
-  Transforming custom integral
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing quadrature representation
-  Reusing element from cache
-  Reusing element from cache
-  Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  
-  QG-utils, psi_tables:
-  {None: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): [[]]}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 3, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): [[[], [], []]], (1, 0): [[[], [], []]], (0, 0): [[[], [], []]]}}}}}
-  
-  QG-utils, psi_tables, flat_tables:
-  {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE1': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([] [...]
-  
-  tables: {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE1': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0':  [...]
-  
-  name_map: {}
-  
-  inv_name_map: {'FE0_C1_D01': 'FE0_C1_D01', 'FE0_C2_D10': 'FE0_C2_D10', 'FE0_C1_D10': 'FE0_C1_D10', 'FE0_C0_D10': 'FE0_C0_D10', 'FE0_C0_D01': 'FE0_C0_D01', 'FE0_C2_D01': 'FE0_C2_D01', 'FE1': 'FE1', 'FE0_C2': 'FE0_C2', 'FE0_C1': 'FE0_C1', 'FE0_C0': 'FE0_C0'}
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE0_C1_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D10': array([], shape=(0, 1), dtype=float64), 'FE0_C0_D01': array([], shape=(0, 1), dtype=float64), 'FE0_C2_D01': array([], shape=(0, 1), dtype=float64), 'FE1': array([], shape=(0, 1), dtype=float64), 'FE0_C2': array([], shape=(0, 1), dtype=float64), 'FE0_C1': array([], shape=(0, 1), dtype=float64), 'FE0_C0': array([] [...]
-  
-  QG-utils, psi_tables, name_map:
-  {'FE0_C1_D01': ('FE0_C1_D01', (), False, False), 'FE0_C2_D10': ('FE0_C2_D10', (), False, False), 'FE0_C1_D10': ('FE0_C1_D10', (), False, False), 'FE0_C0_D10': ('FE0_C0_D10', (), False, False), 'FE0_C0_D01': ('FE0_C0_D01', (), False, False), 'FE0_C2_D01': ('FE0_C2_D01', (), False, False), 'FE1': ('FE1', (), False, False), 'FE0_C2': ('FE0_C2', (), False, False), 'FE0_C1': ('FE0_C1', (), False, False), 'FE0_C0': ('FE0_C0', (), False, False)}
-  Transforming custom integral
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing tensor representation
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Precomputing integrals on reference element
-  Reusing element from cache
-  Reusing element from cache
-  520 entries computed in 0.00233 seconds
-  Shape of reference tensor: (26, 20)
-  Primary multi index:   rank = 1 dims = [26] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25]]
-  Secondary multi index: rank = 1 dims = [20] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 1 dims = [20] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  Reusing element from cache
-  520 entries computed in 0.00222 seconds
-  Shape of reference tensor: (26, 20)
-  Primary multi index:   rank = 1 dims = [26] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25]]
-  Secondary multi index: rank = 1 dims = [20] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 1 dims = [20] indices = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing quadrature representation
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Optimization not available for custom integrals, skipping optimization.
-  Vector elements not yet supported in custom integrals so element for coordinate function x will not be generated.
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  
-  QG-utils, psi_tables:
-  {None: {FiniteElement('Real', Domain(Cell('triangle', 2), label=None, data=None), 0, quad_scheme=None): {None: {None: {(0, 0): [[]]}}}, MixedElement(*[VectorElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 3, dim=2, quad_scheme=None), FiniteElement('Lagrange', Domain(Cell('triangle', 2), label=None, data=None), 2, quad_scheme=None)], **{'value_shape': (3,) }): {None: {None: {(0, 1): [[[], [], []]], (0, 0): [[[], [], []]], (1, 1): [[[], [], []]], (2, 0): [[[], [], [...]
-  
-  QG-utils, psi_tables, flat_tables:
-  {'FE1_C0_D11': array([], shape=(0, 1), dtype=float64), 'FE1_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE1_C0': array([], shape=(0, 1), dtype=float64), 'FE1_C1': array([], shape=(0, 1), dtype=float64), 'FE1_C2': array([], shape=(0, 1), dtype=float64), 'FE1_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE1_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE1_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE1_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE1_C0_D20': a [...]
-  
-  tables: {'FE1_C0_D11': array([], shape=(0, 1), dtype=float64), 'FE1_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE1_C0': array([], shape=(0, 1), dtype=float64), 'FE1_C1': array([], shape=(0, 1), dtype=float64), 'FE1_C2': array([], shape=(0, 1), dtype=float64), 'FE1_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE1_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE1_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE1_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE1_C0 [...]
-  
-  name_map: {}
-  
-  inv_name_map: {'FE1_C0_D02': 'FE1_C0_D02', 'FE1_C2_D01': 'FE1_C2_D01', 'FE1_C1_D02': 'FE1_C1_D02', 'FE1_C0': 'FE1_C0', 'FE1_C1': 'FE1_C1', 'FE1_C2': 'FE1_C2', 'FE1_C1_D11': 'FE1_C1_D11', 'FE1_C1_D10': 'FE1_C1_D10', 'FE1_C2_D10': 'FE1_C2_D10', 'FE1_C2_D11': 'FE1_C2_D11', 'FE1_C0_D20': 'FE1_C0_D20', 'FE2': 'FE2', 'FE1_C2_D02': 'FE1_C2_D02', 'FE1_C1_D20': 'FE1_C1_D20', 'FE1_C1_D01': 'FE1_C1_D01', 'FE1_C0_D01': 'FE1_C0_D01', 'FE1_C0_D10': 'FE1_C0_D10', 'FE1_C0_D11': 'FE1_C0_D11', 'FE1_C2_D [...]
-  
-  QG-utils, psi_tables, unique_tables:
-  {'FE1_C0_D11': array([], shape=(0, 1), dtype=float64), 'FE1_C1_D20': array([], shape=(0, 1), dtype=float64), 'FE1_C0': array([], shape=(0, 1), dtype=float64), 'FE1_C1': array([], shape=(0, 1), dtype=float64), 'FE1_C2': array([], shape=(0, 1), dtype=float64), 'FE1_C1_D11': array([], shape=(0, 1), dtype=float64), 'FE1_C1_D10': array([], shape=(0, 1), dtype=float64), 'FE1_C2_D10': array([], shape=(0, 1), dtype=float64), 'FE1_C2_D11': array([], shape=(0, 1), dtype=float64), 'FE1_C0_D20': a [...]
-  
-  QG-utils, psi_tables, name_map:
-  {'FE1_C0_D02': ('FE1_C0_D02', (), False, False), 'FE1_C2_D01': ('FE1_C2_D01', (), False, False), 'FE1_C1_D02': ('FE1_C1_D02', (), False, False), 'FE1_C0': ('FE1_C0', (), False, False), 'FE1_C1': ('FE1_C1', (), False, False), 'FE1_C2': ('FE1_C2', (), False, False), 'FE1_C1_D11': ('FE1_C1_D11', (), False, False), 'FE1_C1_D10': ('FE1_C1_D10', (), False, False), 'FE1_C2_D10': ('FE1_C2_D10', (), False, False), 'FE1_C2_D11': ('FE1_C2_D11', (), False, False), 'FE1_C0_D20': ('FE1_C0_D20', (),  [...]
-  Transforming custom integral
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Computing tensor representation
-  Extracting monomial form representation from UFL form
-  Transforming monomial form to reference element
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Reusing element from cache
-  Precomputing integrals on reference element
-  Reusing element from cache
-  676 entries computed in 0.00162 seconds
-  Shape of reference tensor: (26, 26)
-  Primary multi index:   rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Precomputing integrals on reference element
-  Reusing element from cache
-  676 entries computed in 0.00157 seconds
-  Shape of reference tensor: (26, 26)
-  Primary multi index:   rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  Internal multi index:  rank = 0 dims = [] indices = [[]]
-  Secondary multi index: rank = 2 dims = [26, 26] indices = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [0, 8], [0, 9], [0, 10], [0, 11], [0, 12], [0, 13], [0, 14], [0, 15], [0, 16], [0, 17], [0, 18], [0, 19], [0, 20], [0, 21], [0, 22], [0, 23], [0, 24], [0, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [1, 14], [1, 15], [1, 16], [1, 17], [1, 18], [1, 19], [1, 20], [1, 21], [1, 22], [1, 23], [ [...]
-  External multi index:  rank = 0 dims = [] indices = [[]]
-  Reusing element from cache
-  Computing representation of forms
-  
-Compiler stage 2 finished in 0.138526 seconds.
-
-Compiler stage 3: Optimizing intermediate representation
---------------------------------------------------------
-  
-Compiler stage 3 finished in 0.000207901 seconds.
-
-Compiler stage 4: Generating code
----------------------------------
-  Generating code for 5 element(s)
-  Removing unused variable: tmp2
-  Removing unused variable: tmp1
-  Removing unused variable: tmp0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: Y
-  Removing unused variable: X
-  Removing unused variable: C1
-  Removing unused variable: C0
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Removing unused variable: tmp7
-  Removing unused variable: tmp6
-  Removing unused variable: tmp5
-  Removing unused variable: tt
-  Removing unused variable: ss
-  Removing unused variable: rr
-  Generating code for 5 dofmap(s)
-  Generating code for integrals
-  Removing unused variable: circumradius_1
-  Removing unused variable: v0v1_1
-  Removing unused variable: v0v2_1
-  Removing unused variable: v1v2_1
-  Removing unused variable: volume_1
-  Removing unused variable: circumradius_0
-  Removing unused variable: v0v1_0
-  Removing unused variable: v0v2_0
-  Removing unused variable: v1v2_0
-  Removing unused variable: volume_0
-  Generating code for forms
-  
-Compiler stage 4 finished in 1.17328 seconds.
-
-Compiler stage 4.1: Generating additional wrapper code
-------------------------------------------------------
-  Generating wrapper code for DOLFIN
-  
-Compiler stage 4.1 finished in 0.000983953 seconds.
-
-Compiler stage 5: Formatting code
----------------------------------
-  
-Output written to ./MultiMeshStokes2D.h.
-Compiler stage 5 finished in 0.00233912 seconds.
-
-FFC finished in 1.71538 seconds.
diff --git a/test/unit/multimesh/cpp/test_cpp_multimesh.py b/test/unit/multimesh/cpp/test_cpp_multimesh.py
deleted file mode 100755
index 861a0d4..0000000
--- a/test/unit/multimesh/cpp/test_cpp_multimesh.py
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env py.test
-from dolfin_utils.test import cpp_tester
-test_cpp_multimesh = cpp_tester
diff --git a/test/unit/parameter/cpp/CMakeLists.txt b/test/unit/parameter/cpp/CMakeLists.txt
deleted file mode 100644
index ced8c12..0000000
--- a/test/unit/parameter/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# This file is automatically generated by running
-#
-#     cmake/scripts/generate-cmakefiles
-#
-# Require CMake 2.8
-cmake_minimum_required(VERSION 2.8)
-
-set(PROJECT_NAME test_parameter)
-project(${PROJECT_NAME})
-
-# Set verbose output while testing CMake
-#set(CMAKE_VERBOSE_MAKEFILE 1)
-
-# Set CMake behavior
-cmake_policy(SET CMP0004 OLD)
-
-# Get DOLFIN configuration data (DOLFINConfig.cmake must be in
-# DOLFIN_CMAKE_CONFIG_PATH)
-find_package(DOLFIN)
-
-# Need to get VTK config because VTK uses advanced VTK features which
-# mean it's not enough to just link to the DOLFIN target. See
-# http://www.vtk.org/pipermail/vtk-developers/2013-October/014402.html
-find_package(VTK HINTS ${VTK_DIR} $ENV{VTK_DIR} NO_MODULE QUIET)
-
-# Default build type (can be overridden by user)
-if (NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
-    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
-endif()
-
-# Compiler definitions
-add_definitions(${DOLFIN_CXX_DEFINITIONS})
-
-# Compiler flags
-set(CMAKE_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
-
-# Include directories
-include_directories(${DOLFIN_INCLUDE_DIRS})
-include_directories(SYSTEM ${DOLFIN_3RD_PARTY_INCLUDE_DIRS})
-
-# Executable
-add_executable(test_Parameters Parameters.cpp)
-
-# Target libraries
-target_link_libraries(test_Parameters ${DOLFIN_LIBRARIES})
diff --git a/test/unit/parameter/cpp/test_cpp_parameter.py b/test/unit/parameter/cpp/test_cpp_parameter.py
deleted file mode 100755
index cdde64c..0000000
--- a/test/unit/parameter/cpp/test_cpp_parameter.py
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env py.test
-from dolfin_utils.test import cpp_tester
-test_cpp_parameter = cpp_tester
diff --git a/test/unit/python/adaptivity/test_error_control.py b/test/unit/python/adaptivity/test_error_control.py
index a85de8e..d0c7625 100755
--- a/test/unit/python/adaptivity/test_error_control.py
+++ b/test/unit/python/adaptivity/test_error_control.py
@@ -85,12 +85,12 @@ def ec(problem, goal):
 def test_check_domains(goal, mesh, a, L):
     # Asserting that domains are ok before trying error control generation
     msg = "Expecting only the domain from the mesh to get here through u."
-    assert len(goal.domains()) == 1, msg
-    assert goal.domains()[0] == mesh.ufl_domain(), msg
-    assert len(a.domains()) == 1, msg
-    assert a.domains()[0] == mesh.ufl_domain(), msg
-    assert len(L.domains()) == 1, msg
-    assert L.domains()[0] == mesh.ufl_domain(), msg
+    assert len(goal.ufl_domains()) == 1, msg
+    assert goal.ufl_domains()[0] == mesh.ufl_domain(), msg
+    assert len(a.ufl_domains()) == 1, msg
+    assert a.ufl_domains()[0] == mesh.ufl_domain(), msg
+    assert len(L.ufl_domains()) == 1, msg
+    assert L.ufl_domains()[0] == mesh.ufl_domain(), msg
 
 
 @skip_in_parallel
diff --git a/test/unit/python/adaptivity/test_time_series.py b/test/unit/python/adaptivity/test_time_series.py
index 8d847ec..02b594b 100755
--- a/test/unit/python/adaptivity/test_time_series.py
+++ b/test/unit/python/adaptivity/test_time_series.py
@@ -23,9 +23,10 @@ from __future__ import print_function
 import pytest
 from dolfin import *
 import os
-from dolfin_utils.test import skip_in_parallel, fixture, tempdir
+from dolfin_utils.test import skip_in_parallel, skip_if_not_HDF5, fixture, tempdir
 
 @skip_in_parallel
+ at skip_if_not_HDF5
 def test_retrieve_all_connectivities(tempdir):
     _test_retrieve(tempdir, "test_retrieve_all_connectivities")
 
@@ -72,6 +73,7 @@ def _test_retrieve(tempdir, basename):
 
 
 @skip_in_parallel
+ at skip_if_not_HDF5
 def test_subdirectory(tempdir):
     "Test that retrieve/store works with nonexisting subdirectory"
     filename = os.path.join(tempdir, "test_subdirectory")
diff --git a/test/unit/python/ale/test_harmonic_smoothing.py b/test/unit/python/ale/test_harmonic_smoothing.py
index 515dfe8..a2eb70b 100755
--- a/test/unit/python/ale/test_harmonic_smoothing.py
+++ b/test/unit/python/ale/test_harmonic_smoothing.py
@@ -23,22 +23,21 @@ from __future__ import print_function
 import pytest
 from dolfin import UnitSquareMesh, BoundaryMesh, Expression, \
                    CellFunction, SubMesh, Constant, MPI, MeshQuality,\
-                   mpi_comm_world
+                   mpi_comm_world, ALE
 from dolfin_utils.test import skip_in_parallel
 
 def test_HarmonicSmoothing():
-    #print("Testing HarmonicSmoothing::move(Mesh& mesh, "const BoundaryMesh& new_boundary)")
 
     # Create some mesh and its boundary
     mesh = UnitSquareMesh(10, 10)
     boundary = BoundaryMesh(mesh, 'exterior')
 
     # Move boundary
-    disp = Expression(("0.3*x[0]*x[1]", "0.5*(1.0-x[1])"))
-    boundary.move(disp)
+    disp = Expression(("0.3*x[0]*x[1]", "0.5*(1.0-x[1])"), degree=2)
+    ALE.move(boundary, disp)
 
     # Move mesh according to given boundary
-    mesh.move(boundary)
+    ALE.move(mesh, boundary)
 
     # Check that new boundary topology corresponds to given one
     boundary_new = BoundaryMesh(mesh, 'exterior')
@@ -57,7 +56,6 @@ def test_HarmonicSmoothing():
 
 @skip_in_parallel
 def test_ale():
-    #print("Testing ALE::move(Mesh& mesh0, const Mesh& mesh1)")
 
     # Create some mesh
     mesh = UnitSquareMesh(4, 5)
@@ -75,10 +73,10 @@ def test_ale():
 
     # Move submesh0
     disp = Constant(("0.1", "-0.1"))
-    submesh0.move(disp)
+    ALE.move(submesh0, disp)
 
     # Move and smooth submesh1 accordignly
-    submesh1.move(submesh0)
+    ALE.move(submesh1, submesh0)
 
     # Move mesh accordingly
     parent_vertex_indices_0 = \
diff --git a/test/unit/python/book/README b/test/unit/python/book/README
index feac99f..99a4c03 100644
--- a/test/unit/python/book/README
+++ b/test/unit/python/book/README
@@ -37,9 +37,15 @@ should be listeed in this file:
 
 * DOLFIN 1.5:
   - python/chapter_10.py: change all UnitSquareMesh(2, 2) to UnitSquareMesh(3, 3)
-    so they can run in parallel with 3 processes without failing 
+    so they can run in parallel with 3 processes without failing
 
 * DOLFIN 1.6
 
   - chapter_1_files/transient/diffusion/sin_daD.py:
     update for interface change in RectangleMesh(x0, ...) --> RectangleMesh(Point(x0, y0), ...)
+
+* DOLFIN 2016.1
+
+  - python/book/test_chapter_10.py: change dss = ds[neumann_boundary] -> ds(subdomain_data=neumann_boundary)
+  - python/book/chapter_1_files/stationary/poisson/d6_p2D.py: change
+    'FunctionSpace(mesh, family, degree=degree)' -> 'FunctionSpace(mesh, family, degree)'
diff --git a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/alg_newton_np.py b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/alg_newton_np.py
index 18fff57..a65d154 100644
--- a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/alg_newton_np.py
+++ b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/alg_newton_np.py
@@ -107,7 +107,7 @@ with f=0, q(u) = (1+u)^m, u=0 at x=0 and u=1 at x=1.
 """ % (mesh, convergence))
 
 # Find max error
-u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m)
+u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m, degree=6)
 u_e = interpolate(u_exact, V)
 diff = numpy.abs(u_e.vector().array() - u.vector().array()).max()
 print('Max error:', diff)
diff --git a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/pde_newton_np.py b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/pde_newton_np.py
index 5ee5976..d35bc6c 100644
--- a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/pde_newton_np.py
+++ b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/pde_newton_np.py
@@ -104,7 +104,7 @@ with f=0, q(u) = (1+u)^m, u=0 at x=0 and u=1 at x=1.
 """ % (mesh, convergence))
 
 # Find max error
-u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m)
+u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m, degree=6)
 u_e = interpolate(u_exact, V)
 diff = numpy.abs(u_e.vector().array() - u.vector().array()).max()
 print('Max error:', diff)
diff --git a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/picard_np.py b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/picard_np.py
index 7d77361..d157e28 100644
--- a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/picard_np.py
+++ b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/picard_np.py
@@ -77,7 +77,7 @@ with f=0, q(u) = (1+u)^m, u=0 at x=0 and u=1 at x=1.
 """ % (mesh, convergence))
 
 # Find max error
-u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m)
+u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m, degree=degree+2)
 u_e = interpolate(u_exact, V)
 diff = numpy.abs(u_e.vector().array() - u.vector().array()).max()
 print('Max error:', diff)
diff --git a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/vp1_np.py b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/vp1_np.py
index 4bba97d..79eaf64 100644
--- a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/vp1_np.py
+++ b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/vp1_np.py
@@ -85,9 +85,7 @@ if iterative_solver:
     prm['newton_solver']['krylov_solver']['maximum_iterations'] = 1000
     prm['newton_solver']['krylov_solver']['monitor_convergence'] = True
     prm['newton_solver']['krylov_solver']['nonzero_initial_guess'] = False
-    prm['newton_solver']['krylov_solver']['gmres']['restart'] = 40
-    prm['newton_solver']['krylov_solver']['preconditioner']['structure'] = 'same_nonzero_pattern'
-    prm['newton_solver']['krylov_solver']['preconditioner']['ilu']['fill_level'] = 0
+
 PROGRESS = 16
 set_log_level(PROGRESS)
 solver.solve()
@@ -99,7 +97,7 @@ with f=0, q(u) = (1+u)^m, u=0 at x=0 and u=1 at x=1.
 """ % mesh)
 
 # Find max error
-u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m)
+u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m, degree=6)
 u_e = interpolate(u_exact, V)
 import numpy
 diff = numpy.abs(u_e.vector().array() - u_.vector().array()).max()
diff --git a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/vp2_np.py b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/vp2_np.py
index f05570b..b0b0226 100644
--- a/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/vp2_np.py
+++ b/test/unit/python/book/chapter_1_files/stationary/nonlinear_poisson/vp2_np.py
@@ -85,9 +85,6 @@ if iterative_solver:
     prm['newton_solver']['krylov_solver']['maximum_iterations'] = 1000
     prm['newton_solver']['krylov_solver']['monitor_convergence'] = True
     prm['newton_solver']['krylov_solver']['nonzero_initial_guess'] = False
-    prm['newton_solver']['krylov_solver']['gmres']['restart'] = 40
-    prm['newton_solver']['krylov_solver']['preconditioner']['structure'] = 'same_nonzero_pattern'
-    prm['newton_solver']['krylov_solver']['preconditioner']['ilu']['fill_level'] = 0
 PROGRESS = 16
 set_log_level(PROGRESS)
 
@@ -100,7 +97,7 @@ with f=0, q(u) = (1+u)^m, u=0 at x=0 and u=1 at x=1.
 """ % mesh)
 
 # Find max error
-u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m)
+u_exact = Expression('pow((pow(2, m+1)-1)*x[0] + 1, 1.0/(m+1)) - 1', m=m, degree=6)
 u_e = interpolate(u_exact, V)
 import numpy
 diff = numpy.abs(u_e.vector().array() - u_.vector().array()).max()
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/d1_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/d1_p2D.py
index ecc1e81..315b660 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/d1_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/d1_p2D.py
@@ -15,7 +15,7 @@ mesh = UnitSquareMesh(6, 4)
 V = FunctionSpace(mesh, 'Lagrange', 1)
 
 # Define boundary conditions
-u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 
 def u0_boundary(x, on_boundary):
     return on_boundary
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/d2_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/d2_p2D.py
index 635f1ac..1c91200 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/d2_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/d2_p2D.py
@@ -16,7 +16,7 @@ mesh = UnitSquareMesh(60, 40)
 V = FunctionSpace(mesh, 'Lagrange', 1)
 
 # Define boundary conditions
-u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 
 def u0_boundary(x, on_boundary):
     return on_boundary
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/d3_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/d3_p2D.py
index b27298d..a8fc0ce 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/d3_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/d3_p2D.py
@@ -18,7 +18,7 @@ mesh = UnitSquareMesh(60, 40)
 V = FunctionSpace(mesh, 'Lagrange', 1)
 
 # Define boundary conditions
-u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 
 def u0_boundary(x, on_boundary):
     return on_boundary
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/d4_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/d4_p2D.py
index 1000ea3..f436e98 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/d4_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/d4_p2D.py
@@ -17,7 +17,7 @@ mesh = UnitSquareMesh(3, 3)
 V = FunctionSpace(mesh, 'Lagrange', 1)
 
 # Define boundary conditions
-u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 
 def u0_boundary(x, on_boundary):
     return on_boundary
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/d5_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/d5_p2D.py
index 1153fdc..421af3d 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/d5_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/d5_p2D.py
@@ -19,7 +19,7 @@ V = FunctionSpace(mesh, 'Lagrange', 1)
 
 
 # Define boundary conditions
-u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 def u0_boundary(x, on_boundary):
     return on_boundary
 
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/d6_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/d6_p2D.py
index 0056388..43841a2 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/d6_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/d6_p2D.py
@@ -11,7 +11,7 @@ import sys
 def compute(nx, ny, degree):
     # Create mesh and define function space
     mesh = UnitSquareMesh(nx, ny)
-    V = FunctionSpace(mesh, 'Lagrange', degree=degree)
+    V = FunctionSpace(mesh, 'Lagrange', degree)
 
     # Define boundary conditions
 
@@ -23,7 +23,7 @@ def compute(nx, ny, degree):
     # Exact solution
     omega = 1.0
     u_e = Expression('sin(omega*pi*x[0])*sin(omega*pi*x[1])',
-                     omega=omega)
+                     omega=omega, degree=degree+1)
 
     # Define variational problem
     u = TrialFunction(V)
@@ -58,7 +58,7 @@ def compute(nx, ny, degree):
 
     # Explicit interpolation of u_e to higher-order elements,
     # u will also be interpolated to the space Ve before integration
-    Ve = FunctionSpace(mesh, 'Lagrange', degree=5)
+    Ve = FunctionSpace(mesh, 'Lagrange', 5)
     u_e_Ve = interpolate(u_e, Ve)
     error = (u - u_e_Ve)**2*dx
     E3 = sqrt(assemble(error))
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/dn1_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/dn1_p2D.py
index fa0623e..d229050 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/dn1_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/dn1_p2D.py
@@ -18,7 +18,7 @@ mesh = UnitSquareMesh(3, 2)
 V = FunctionSpace(mesh, 'Lagrange', 1)
 
 # Define Dirichlet boundary conditions
-u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 
 class DirichletBoundary(SubDomain):
     def inside(self, x, on_boundary):
@@ -33,7 +33,7 @@ bc = DirichletBC(V, u0, u0_boundary)
 u = TrialFunction(V)
 v = TestFunction(V)
 f = Constant(-6.0)
-g = Expression('-4*x[1]')
+g = Expression('-4*x[1]', degree=1)
 a = inner(grad(u), grad(v))*dx
 L = f*v*dx - g*v*ds
 
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/dn2_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/dn2_p2D.py
index 3ad2cf4..c4e4e03 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/dn2_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/dn2_p2D.py
@@ -22,7 +22,7 @@ V = FunctionSpace(mesh, 'Lagrange', 1)
 
 # Define Dirichlet conditions for x=0 boundary
 
-u_L = Expression('1 + 2*x[1]*x[1]')
+u_L = Expression('1 + 2*x[1]*x[1]', degree=2)
 
 class LeftBoundary(SubDomain):
     def inside(self, x, on_boundary):
@@ -33,7 +33,7 @@ Gamma_0 = DirichletBC(V, u_L, LeftBoundary())
 
 # Define Dirichlet conditions for x=1 boundary
 
-u_R = Expression('2 + 2*x[1]*x[1]')
+u_R = Expression('2 + 2*x[1]*x[1]', degree=2)
 
 class RightBoundary(SubDomain):
     def inside(self, x, on_boundary):
@@ -48,7 +48,7 @@ bcs = [Gamma_0, Gamma_1]
 u = TrialFunction(V)
 v = TestFunction(V)
 f = Constant(-6.0)
-g = Expression('-4*x[1]')
+g = Expression('-4*x[1]', degree=1)
 a = inner(grad(u), grad(v))*dx
 L = f*v*dx - g*v*ds
 
@@ -73,7 +73,7 @@ for i in range(len(u_array)):
 
 
 # Exact solution:
-u_exact = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u_exact = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 
 # Verification
 u_e = interpolate(u_exact, V)
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/dn3_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/dn3_p2D.py
index edcae67..5c4120e 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/dn3_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/dn3_p2D.py
@@ -20,7 +20,7 @@ V = FunctionSpace(mesh, 'Lagrange', 1)
 
 # Define Dirichlet conditions for x=0 boundary
 
-u_L = Expression('1 + 2*x[1]*x[1]')
+u_L = Expression('1 + 2*x[1]*x[1]', degree=2)
 
 class LeftBoundary(SubDomain):
     def inside(self, x, on_boundary):
@@ -31,7 +31,7 @@ Gamma_0 = DirichletBC(V, u_L, LeftBoundary())
 
 # Define Dirichlet conditions for x=1 boundary
 
-u_R = Expression('2 + 2*x[1]*x[1]')
+u_R = Expression('2 + 2*x[1]*x[1]', degree=2)
 
 class RightBoundary(SubDomain):
     def inside(self, x, on_boundary):
@@ -46,7 +46,7 @@ bcs = [Gamma_0, Gamma_1]
 u = TrialFunction(V)
 v = TestFunction(V)
 f = Constant(-6.0)
-g = Expression('-4*x[1]')
+g = Expression('-4*x[1]', degree=1)
 a = inner(grad(u), grad(v))*dx
 L = f*v*dx - g*v*ds
 
@@ -97,7 +97,7 @@ for i in range(len(u_array)):
 
 
 # Exact solution:
-u_exact = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u_exact = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 
 # Verification
 u_e = interpolate(u_exact, V)
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/dn4_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/dn4_p2D.py
index 51889a7..05fa9f5 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/dn4_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/dn4_p2D.py
@@ -21,7 +21,7 @@ V = FunctionSpace(mesh, 'Lagrange', 1)
 
 # Define Dirichlet conditions for x=0 boundary
 
-u_L = Expression('1 + 2*x[1]*x[1]')
+u_L = Expression('1 + 2*x[1]*x[1]', degree=2)
 
 class LeftBoundary(SubDomain):
     def inside(self, x, on_boundary):
@@ -32,7 +32,7 @@ Gamma_0 = DirichletBC(V, u_L, LeftBoundary())
 
 # Define Dirichlet conditions for x=1 boundary
 
-u_R = Expression('2 + 2*x[1]*x[1]')
+u_R = Expression('2 + 2*x[1]*x[1]', degree=2)
 
 class RightBoundary(SubDomain):
     def inside(self, x, on_boundary):
@@ -47,7 +47,7 @@ bcs = [Gamma_0, Gamma_1]
 u = TrialFunction(V)
 v = TestFunction(V)
 f = Constant(-6.0)
-g = Expression('-4*x[1]')
+g = Expression('-4*x[1]', degree=1)
 a = inner(grad(u), grad(v))*dx
 L = f*v*dx - g*v*ds
 
@@ -113,7 +113,7 @@ if mesh.num_cells() <= 30:
 
 
 # Exact solution:
-u_exact = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u_exact = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 
 # Verification
 u_e = interpolate(u_exact, V)
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/dnr_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/dnr_p2D.py
index c2e3b00..2218efb 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/dnr_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/dnr_p2D.py
@@ -31,7 +31,7 @@ class LowerRobinBoundary(SubDomain):
 
 Gamma_R = LowerRobinBoundary()
 Gamma_R.mark(boundary_parts, 0)
-q = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+q = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 p = Constant(100)  # arbitrary function can go here
 
 # Mark upper boundary facets as subdomain 1
@@ -42,7 +42,7 @@ class UpperNeumannBoundary(SubDomain):
 
 Gamma_N = UpperNeumannBoundary()
 Gamma_N.mark(boundary_parts, 1)
-g = Expression('-4*x[1]')
+g = Expression('-4*x[1]', degree=1)
 
 # Mark left boundary as subdomain 2
 class LeftBoundary(SubDomain):
@@ -65,8 +65,8 @@ Gamma_1.mark(boundary_parts, 3)
 #-------------- Solution and problem definition step -----------------
 # given mesh and boundary_parts
 
-u_L = Expression('1 + 2*x[1]*x[1]')
-u_R = Expression('2 + 2*x[1]*x[1]')
+u_L = Expression('1 + 2*x[1]*x[1]', degree=2)
+u_R = Expression('2 + 2*x[1]*x[1]', degree=2)
 bcs = [DirichletBC(V, u_L, boundary_parts, 2),
        DirichletBC(V, u_R, boundary_parts, 3)]
 
@@ -94,7 +94,7 @@ solve(A, u.vector(), b, 'lu')
 print(mesh)
 
 # Verification
-u_exact = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u_exact = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 u_e = interpolate(u_exact, V)
 print('Max error:', abs(u_e.vector().array() - u.vector().array()).max())
 
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/mat2_p2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/mat2_p2D.py
index 8e8e068..eb07b72 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/mat2_p2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/mat2_p2D.py
@@ -86,7 +86,7 @@ solve(a == L, u, bcs)
 # Compare numerical and exact solution
 u_e_expr = Expression('x[1] <= 0.5 ? 2*x[1]*k1/(k0+k1) : '\
                       '((2*x[1]-1)*k0 + k1)/(k0+k1)',
-                      k0=k_values[0], k1=k_values[1])
+                      k0=k_values[0], k1=k_values[1], degree=3)
 u_e = interpolate(u_e_expr, V)
 u_e_array = u_e.vector().array()
 u_nodal_values = u.vector()
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/membrane1.py b/test/unit/python/book/chapter_1_files/stationary/poisson/membrane1.py
index 5522958..b4db2cf 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/membrane1.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/membrane1.py
@@ -38,7 +38,7 @@ v = TestFunction(V)
 a = inner(nabla_grad(w), nabla_grad(v))*dx
 f = Expression('4*exp(-0.5*(pow((R*x[0] - x0)/sigma, 2)) '
                      '-0.5*(pow((R*x[1] - y0)/sigma, 2)))',
-               R=R, x0=x0, y0=y0, sigma=sigma)
+               R=R, x0=x0, y0=y0, sigma=sigma, degree=2)
 L = f*v*dx
 
 # Compute solution
@@ -62,7 +62,7 @@ print('Maximum real deflection is', max_D)
 
 # Verification for "flat" pressure (large sigma)
 if sigma >= 50:
-    w_exact = Expression('1 - x[0]*x[0] - x[1]*x[1]')
+    w_exact = Expression('1 - x[0]*x[0] - x[1]*x[1]', degree=2)
     w_e = interpolate(w_exact, V)
     w_e_array = w_e.vector().array()
     w_array = w.vector().array()
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/membrane1v.py b/test/unit/python/book/chapter_1_files/stationary/poisson/membrane1v.py
index 78e16a8..b0ce758 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/membrane1v.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/membrane1v.py
@@ -34,7 +34,7 @@ v = TestFunction(V)
 a = inner(nabla_grad(w), nabla_grad(v))*dx
 f = Expression('4*exp(-0.5*(pow((R*x[0] - x0)/sigma, 2)) '
                '     - 0.5*(pow((R*x[1] - y0)/sigma, 2)))',
-               R=R, x0=x0, y0=y0, sigma=sigma)
+               R=R, x0=x0, y0=y0, sigma=sigma, degree=2)
 L = f*v*dx
 
 # Compute solution
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/paD.py b/test/unit/python/book/chapter_1_files/stationary/poisson/paD.py
index b80ec14..468334b 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/paD.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/paD.py
@@ -48,7 +48,7 @@ solve(a == L, u, bcs)
 print(mesh)
 
 # Verification
-u_exact = Expression('x[0]*x[0]')
+u_exact = Expression('x[0]*x[0]', degree=2)
 u_e = interpolate(u_exact, V)
 print('Max error:', \
       numpy.abs(u_e.vector().array() - u.vector().array()).max())
diff --git a/test/unit/python/book/chapter_1_files/stationary/poisson/vcp2D.py b/test/unit/python/book/chapter_1_files/stationary/poisson/vcp2D.py
index ea7b6b2..bc1301f 100644
--- a/test/unit/python/book/chapter_1_files/stationary/poisson/vcp2D.py
+++ b/test/unit/python/book/chapter_1_files/stationary/poisson/vcp2D.py
@@ -22,7 +22,7 @@ mesh = UnitSquareMesh(nx, ny)
 V = FunctionSpace(mesh, 'Lagrange', 1)
 
 # Define boundary conditions
-u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]')
+u0 = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
 
 class DirichletBoundary(SubDomain):
     def inside(self, x, on_boundary):
@@ -34,8 +34,8 @@ bc = DirichletBC(V, u0, u0_boundary)
 # Define variational problem
 u = TrialFunction(V)
 v = TestFunction(V)
-p = Expression('x[0] + x[1]')
-f = Expression('-8*x[0] - 10*x[1]')
+p = Expression('x[0] + x[1]', degree=1)
+f = Expression('-8*x[0] - 10*x[1]', degree=1)
 a = p*inner(nabla_grad(u), nabla_grad(v))*dx
 L = f*v*dx
 
diff --git a/test/unit/python/book/chapter_1_files/transient/diffusion/d1_d2D.py b/test/unit/python/book/chapter_1_files/transient/diffusion/d1_d2D.py
index aa601ab..1f306ee 100644
--- a/test/unit/python/book/chapter_1_files/transient/diffusion/d1_d2D.py
+++ b/test/unit/python/book/chapter_1_files/transient/diffusion/d1_d2D.py
@@ -15,7 +15,7 @@ V = FunctionSpace(mesh, 'Lagrange', 1)
 # Define boundary conditions
 alpha = 3; beta = 1.2
 u0 = Expression('1 + x[0]*x[0] + alpha*x[1]*x[1] + beta*t',
-                alpha=alpha, beta=beta, t=0)
+                alpha=alpha, beta=beta, t=0, degree=1)
 
 class Boundary(SubDomain):  # define the Dirichlet boundary
     def inside(self, x, on_boundary):
diff --git a/test/unit/python/book/chapter_1_files/transient/diffusion/d2_d2D.py b/test/unit/python/book/chapter_1_files/transient/diffusion/d2_d2D.py
index de2240e..327a514 100644
--- a/test/unit/python/book/chapter_1_files/transient/diffusion/d2_d2D.py
+++ b/test/unit/python/book/chapter_1_files/transient/diffusion/d2_d2D.py
@@ -16,7 +16,7 @@ V = FunctionSpace(mesh, 'Lagrange', 1)
 # Define boundary conditions
 alpha = 3; beta = 1.2
 u0 = Expression('1 + x[0]*x[0] + alpha*x[1]*x[1] + beta*t',
-                alpha=alpha, beta=beta, t=0)
+                alpha=alpha, beta=beta, t=0, degree=2)
 
 class Boundary(SubDomain):  # define the Dirichlet boundary
     def inside(self, x, on_boundary):
@@ -47,7 +47,7 @@ K = assemble(a_K)
 A = M + dt*K
 
 # f term
-f = Expression('beta - 2 - 2*alpha', beta=beta, alpha=alpha)
+f = Expression('beta - 2 - 2*alpha', beta=beta, alpha=alpha, degree=0)
 
 # Compute solution
 u = Function(V)
diff --git a/test/unit/python/book/chapter_1_files/transient/diffusion/sin_daD.py b/test/unit/python/book/chapter_1_files/transient/diffusion/sin_daD.py
index 048f597..d51b105 100644
--- a/test/unit/python/book/chapter_1_files/transient/diffusion/sin_daD.py
+++ b/test/unit/python/book/chapter_1_files/transient/diffusion/sin_daD.py
@@ -36,7 +36,7 @@ T_A = 10
 omega = 7.27E-5
 
 T_0 = Expression('T_R + T_A*sin(omega*t)',
-                 T_R=T_R, T_A=T_A, omega=omega, t=0.0)
+                 T_R=T_R, T_A=T_A, omega=omega, t=0.0, degree=2)
 
 def surface(x, on_boundary):
     return on_boundary and abs(x[d-1]) < 1E-14
@@ -66,7 +66,7 @@ kappa_str[3] = 'x[0] > -W/4 && x[0] < W/4 '\
 
 # Alternative way of defining the kappa function
 class Kappa(Expression):
-    def eval(self, value, x):
+    def eval(self, value, x, **kwargs):
         """x: spatial point, value[0]: function value."""
         d = len(x)  # no of space dimensions
         material = 0  # 0: outside, 1: inside
@@ -85,8 +85,7 @@ class Kappa(Expression):
 
 # Physical parameters
 kappa = Expression(kappa_str[d],
-                   D=D, W=W, kappa_0=kappa_0, kappa_1=kappa_1)
-#kappa = Kappa(V)
+                   D=D, W=W, kappa_0=kappa_0, kappa_1=kappa_1, degree=0)
 
 # soil:
 rho = 1500
@@ -114,7 +113,7 @@ T = Function(V)   # unknown at the new time level
 
 # hack for plotting (first surface must span all values (?))
 dummy = Expression('T_R - T_A/2.0 + 2*T_A*(x[%g]+D)' % (d-1),
-                   T_R=T_R, T_A=T_A, D=D)
+                   T_R=T_R, T_A=T_A, D=D, dgeree=1)
 
 # Make all plot commands inctive
 import scitools.misc
@@ -161,7 +160,7 @@ def line_plot():
 
     ev.savefig('tmp_%04d.png' % counter)
     time.sleep(0.1)
-    
+
 def T_exact(x):
     a = sqrt(omega*rho*c/(2*kappa_0))
     return T_R + T_A*exp(a*x)*numpy.sin(omega*t + a*x)
@@ -185,7 +184,7 @@ while t <= t_stop:
 
     total_flux = assemble(flux)
     print('Total flux:', total_flux)
-    
+
     t += dt
     T_1.assign(T)
     counter += 1
diff --git a/test/unit/python/book/test_chapter_10.py b/test/unit/python/book/test_chapter_10.py
index 652d9ff..3302a63 100755
--- a/test/unit/python/book/test_chapter_10.py
+++ b/test/unit/python/book/test_chapter_10.py
@@ -31,7 +31,7 @@ from dolfin_utils.test import * #cd_tempdir, pushpop_parameters, skip_in_paralle
 
 def create_data(A=None):
     "This function creates data used in the tests below"
-    mesh = UnitSquareMesh(3, 3)
+    mesh = UnitSquareMesh(4, 4)
     V = FunctionSpace(mesh, "Lagrange", 1)
     u = TrialFunction(V)
     v = TestFunction(V)
@@ -388,7 +388,7 @@ def test_p21_box_1():
     mesh = UnitSquareMesh(3, 3)
     V = VectorFunctionSpace(mesh, "Lagrange", 2)
     Q = FunctionSpace(mesh, "Lagrange", 1)
-    W = V*Q
+    #W = V*Q # deprecated!
 
 
 @use_gc_barrier
@@ -426,9 +426,9 @@ def test_p22_box_2():
 @use_gc_barrier
 def test_p23_box_1():
     mesh = UnitSquareMesh(3, 3)
-    V = VectorFunctionSpace(mesh, "Lagrange", 2)
-    Q = FunctionSpace(mesh, "Lagrange", 1)
-    W = V*Q
+    V = VectorElement("Lagrange", mesh.ufl_cell(), 2)
+    Q = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    W = FunctionSpace(mesh, V*Q)
 
     w = Function(W)
     u, p = w.split()
@@ -441,7 +441,7 @@ def test_p24_box_1():
     class MyExpression(Expression):
         def eval(self, values, x):
             values[0] = sin(x[0])*cos(x[1])
-    f = MyExpression()
+    f = MyExpression(degree=1)
     print(f((0.5, 0.5)))
 
 
@@ -453,14 +453,14 @@ def test_p24_box_2():
             values[1] = cos(x[1])
         def value_shape(self):
             return (2,)
-    g = MyExpression()
+    g = MyExpression(degree=1)
     print(g((0.5, 0.5)))
 
 
 @use_gc_barrier
 def test_p24_box_3():
-    f = Expression("sin(x[0])*cos(x[1])")
-    g = Expression(("sin(x[0])", "cos(x[1])"))
+    f = Expression("sin(x[0])*cos(x[1])", degree=1)
+    g = Expression(("sin(x[0])", "cos(x[1])"), degree=1)
 
 
 @use_gc_barrier
@@ -469,7 +469,7 @@ def test_p25_box_1():
     T = 1.0
     dt = 0.5
 
-    h = Expression("t*sin(x[0])*cos(x[1])", t=0.0)
+    h = Expression("t*sin(x[0])*cos(x[1])", t=0.0, degree=1)
     while t < T:
         h.t = t
         t += dt
@@ -481,7 +481,7 @@ def test_p26_box_1():
     V = VectorFunctionSpace(mesh, "Lagrange", 1)
     u = TrialFunction(V)
     v = TestFunction(V)
-    f = Expression(("0.0", "0.0"))
+    f = Expression(("0.0", "0.0"), degree=0)
 
     E = 10.0
     nu = 0.3
@@ -537,7 +537,8 @@ def test_p30_box_1():
             return x[0] < 0.5 + DOLFIN_EPS and on_boundary
     neumann_boundary = NeumannBoundary()
 
-    dss = ds[neumann_boundary]
+    # Changed from notation dss = ds[neumann_boundary]
+    dss = ds(subdomain_data=neumann_boundary)
     a = g*v*dss(0) + h*v*dss(1)
 
 
@@ -551,7 +552,7 @@ def test_p30_box_2():
     class DirichletBoundary(SubDomain):
         def inside(self, x, on_boundary):
             return x[0] > 0.5 - DOLFIN_EPS and on_boundary
-    u_0 = DirichletValue()
+    u_0 = DirichletValue(degree=2)
     Gamma_D = DirichletBoundary()
     bc = DirichletBC(V, u_0, Gamma_D)
 
@@ -560,7 +561,7 @@ def test_p30_box_2():
 def test_p31_box_1():
     mesh = UnitSquareMesh(3, 3)
     V = FunctionSpace(mesh, "CG", 1)
-    u_0 = Expression("sin(x[0])")
+    u_0 = Expression("sin(x[0])", degree=1)
     bc = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
 
 
@@ -569,7 +570,7 @@ def test_p31_box_2():
     mesh = UnitSquareMesh(3, 3)
     V = FunctionSpace(mesh, "CG", 1)
     A, x, b = create_data()
-    u_0 = Expression("sin(x[0])")
+    u_0 = Expression("sin(x[0])", degree=1)
     bc = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
     u = Function(V)
 
@@ -581,7 +582,7 @@ def test_p31_box_2():
 def test_p32_box_1():
     mesh = UnitSquareMesh(3, 3)
     V = FunctionSpace(mesh, "CG", 1)
-    u_0 = Expression("sin(x[0])")
+    u_0 = Expression("sin(x[0])", degree=1)
     bc0 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
     bc1 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
     bc2 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
@@ -599,8 +600,8 @@ def test_p32_box_1():
 def test_p32_box_2():
     mesh = UnitSquareMesh(3, 3)
     V = FunctionSpace(mesh, "CG", 1)
-    f = Expression("0.0")
-    u_0 = Expression("sin(x[0])")
+    f = Expression("0.0", degree=0)
+    u_0 = Expression("sin(x[0])", degree=1)
     bc0 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
     bc1 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
     bc2 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
@@ -621,8 +622,8 @@ def test_p32_box_2():
 def test_p32_box_3():
     mesh = UnitSquareMesh(3, 3)
     V = FunctionSpace(mesh, "CG", 1)
-    f = Expression("0.0")
-    u_0 = Expression("sin(x[0])")
+    f = Expression("0.0", degree=0)
+    u_0 = Expression("sin(x[0])", degree=1)
     bc0 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
     bc1 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
     bc2 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
@@ -646,8 +647,8 @@ def test_p32_box_3():
 def test_p33_box_1():
     mesh = UnitSquareMesh(3, 3)
     V = FunctionSpace(mesh, "CG", 1)
-    f = Expression("0.0")
-    u_0 = Expression("sin(x[0])")
+    f = Expression("0.0", degree=0)
+    u_0 = Expression("sin(x[0])", degree=1)
     bc0 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
     bc1 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
     bc2 = DirichletBC(V, u_0, "x[0] > 0.5 && on_boundary")
@@ -733,6 +734,7 @@ def test_p36_box_1(cd_tempdir, pushpop_parameters):
 
 
 @skip_in_parallel
+ at skip_if_not_HDF5
 def test_p37_box_1(cd_tempdir):
     mesh = UnitSquareMesh(3, 3)
     V = FunctionSpace(mesh, "CG", 1)
@@ -749,6 +751,7 @@ def test_p37_box_1(cd_tempdir):
 
 
 @skip_in_parallel
+ at skip_if_not_HDF5
 def test_p37_box_2():
     time_series = TimeSeries(mpi_comm_world(), "simulation_data")
     mesh = UnitSquareMesh(3, 3)
@@ -853,9 +856,9 @@ def test_p41_box_2():
     solver = KrylovSolver()
     solver.parameters["absolute_tolerance"] = 1e-6
     solver.parameters["report"] = True
-    solver.parameters["gmres"]["restart"] = 50
+    #solver.parameters["gmres"]["restart"] = 50
     #solver.parameters["preconditioner"]["reuse"] = True
-    solver.parameters["preconditioner"]["structure"] = "same"
+    #solver.parameters["preconditioner"]["structure"] = "same"
 
 
 @use_gc_barrier
@@ -867,7 +870,7 @@ def test_p42_box_1():
 
 @use_gc_barrier
 def test_p42_box_2(pushpop_parameters):
-    d = dict(num_threads=4, krylov_solver=dict(absolute_tolerance=1e-6))
+    d = dict(num_threads=4, krylov_solver=dict(absolute_tolerance=1.0e-6))
     parameters.update(d)
 
 
@@ -929,14 +932,14 @@ def test_p47_box_2():
         def eval(self, values, x):
             values[0] = sin(x[0])
     v = TestFunction(V)
-    f = Source()
+    f = Source(degree=1)
     L = f*v*dx
     assemble(L)
 
 
 @use_gc_barrier
 def test_p48_box_1():
-    e = Expression("sin(x[0])")
+    e = Expression("sin(x[0])", degree=2)
 
 
 @use_gc_barrier
@@ -945,14 +948,15 @@ def test_p49_box_1():
     V = FunctionSpace(mesh, "Lagrange", 1)
     u = TrialFunction(V)
     v = TestFunction(V)
-    c = Expression("sin(x[0])")
+    c = Expression("sin(x[0])", degree=2)
     a = c*dot(grad(u), grad(v))*dx
     A = assemble(a)
 
 
 @use_gc_barrier
 def test_p50_box_1(pushpop_parameters):
-    parameters["form_compiler"]["name"] = "sfc"
+    # This parameter has been removed, as no other form compilers exist today:
+    pass  # parameters["form_compiler"]["name"] = "sfc"
 
 
 @use_gc_barrier
diff --git a/test/unit/python/fem/test_assembler.py b/test/unit/python/fem/test_assembler.py
index 500d968..351317e 100755
--- a/test/unit/python/fem/test_assembler.py
+++ b/test/unit/python/fem/test_assembler.py
@@ -28,7 +28,7 @@ import os
 import numpy
 from dolfin import *
 
-from dolfin_utils.test import skip_in_parallel, filedir
+from dolfin_utils.test import skip_in_parallel, filedir, pushpop_parameters
 
 
 def test_cell_size_assembly_1D():
@@ -55,8 +55,9 @@ def test_cell_assembly_1D():
     assert round(assemble(a).norm("frobenius") - A_frobenius_norm, 10) == 0
     assert round(assemble(L).norm("l2") - b_l2_norm, 10) == 0
 
+
 @skip_in_parallel
-def test_cell_assembly_1D_multithreaded():
+def test_cell_assembly_1D_multithreaded(pushpop_parameters):
 
     mesh = UnitIntervalMesh(48)
     V = FunctionSpace(mesh, "CG", 1)
@@ -75,7 +76,6 @@ def test_cell_assembly_1D_multithreaded():
     parameters["num_threads"] = 4
     assert round(assemble(a).norm("frobenius") - A_frobenius_norm, 10) == 0
     assert round(assemble(L).norm("l2") - b_l2_norm, 10) == 0
-    parameters["num_threads"] = 0
 
 
 def test_cell_assembly():
@@ -92,7 +92,7 @@ def test_cell_assembly():
     a = inner(epsilon(v), epsilon(u))*dx
     L = inner(v, f)*dx
 
-    A_frobenius_norm =  4.3969686527582512
+    A_frobenius_norm = 4.3969686527582512
     b_l2_norm = 0.95470326978246278
 
     # Assemble A and b
@@ -115,7 +115,7 @@ def test_cell_assembly_multithreaded():
     a = inner(epsilon(v), epsilon(u))*dx
     L = inner(v, f)*dx
 
-    A_frobenius_norm =  4.3969686527582512
+    A_frobenius_norm = 4.3969686527582512
     b_l2_norm = 0.95470326978246278
 
     # Assemble A and b
@@ -163,7 +163,7 @@ def test_facet_assembly():
 
 
 @skip_in_parallel
-def test_facet_assembly_multithreaded():
+def test_facet_assembly_multithreaded(pushpop_parameters):
     mesh = UnitSquareMesh(24, 24)
     V = FunctionSpace(mesh, "DG", 1)
 
@@ -197,7 +197,6 @@ def test_facet_assembly_multithreaded():
     parameters["num_threads"] = 4
     assert round(assemble(a).norm("frobenius") - A_frobenius_norm, 10) == 0
     assert round(assemble(L).norm("l2") - b_l2_norm, 10) == 0
-    parameters["num_threads"] = 0
 
 
 def test_functional_assembly():
@@ -210,8 +209,9 @@ def test_functional_assembly():
     M1 = f*ds(mesh)
     assert round(assemble(M1) - 4.0, 7) == 0
 
+
 @skip_in_parallel
-def test_functional_assembly_multithreaded():
+def test_functional_assembly_multithreaded(pushpop_parameters):
 
     mesh = UnitSquareMesh(24, 24)
 
@@ -224,7 +224,6 @@ def test_functional_assembly_multithreaded():
 
     parameters["num_threads"] = 4
     assert round(assemble(M0) - 1.0, 7) == 0
-    parameters["num_threads"] = 0
 
 
 def test_subdomain_and_fulldomain_assembly_meshdomains():
@@ -239,9 +238,11 @@ def test_subdomain_and_fulldomain_assembly_meshdomains():
     class F0(SubDomain):
         def inside(self, x, inside):
             return near(x[0], 0.0)
+
     class F1(SubDomain):
         def inside(self, x, inside):
             return near(x[1], 0.0)
+
     class F2(SubDomain):
         def inside(self, x, inside):
             return near(x[2], 0.0)
@@ -250,9 +251,11 @@ def test_subdomain_and_fulldomain_assembly_meshdomains():
     class S0(SubDomain):
         def inside(self, x, inside):
             return x[0] > 0.25
+
     class S1(SubDomain):
         def inside(self, x, inside):
             return x[0] > 0.5
+
     class S2(SubDomain):
         def inside(self, x, inside):
             return x[0] > 0.75
@@ -263,23 +266,25 @@ def test_subdomain_and_fulldomain_assembly_meshdomains():
     f2 = F2()
     f0.mark_facets(mesh, 0)
     f1.mark_facets(mesh, 1)
-    f2.mark_facets(mesh, 3) # NB! 3, to leave a gap
+    f2.mark_facets(mesh, 3)  # NB! 3, to leave a gap
 
     s0 = S0()
     s1 = S1()
     s2 = S2()
     s0.mark_cells(mesh, 0)
     s1.mark_cells(mesh, 1)
-    s2.mark_cells(mesh, 3) # NB! 3, to leave a gap
+    s2.mark_cells(mesh, 3)  # NB! 3, to leave a gap
 
     # Assemble forms on subdomains and full domain and compare
     krange = list(range(5))
     for dmu in (dx, ds):
         full = assemble(Constant(3.0)*dmu(mesh))
-        subplusfull = [assemble(Constant(3.0)*dmu(mesh) + Constant(1.0)*dmu(k, domain=mesh)) for k in krange]
+        subplusfull = [assemble(Constant(3.0)*dmu(mesh) +
+                                Constant(1.0)*dmu(k, domain=mesh))
+                       for k in krange]
         sub = [assemble(Constant(1.0)*dmu(k, domain=mesh)) for k in krange]
         for k in krange:
-	    #print sub[k] + full, subplusfull[k]
+            # print sub[k] + full, subplusfull[k]
             assert round(sub[k] + full - subplusfull[k], 7) == 0
 
 
@@ -289,22 +294,26 @@ def test_subdomain_assembly_form_1():
 
     mesh = UnitSquareMesh(4, 4)
 
-    # Define some haphazardly chosen cell/facet function
+    # Define cell/facet function
+    class Left(SubDomain):
+        def inside(self, x, on_boundary):
+            return x[0] < 0.49
     subdomains = CellFunction("size_t", mesh)
     subdomains.set_all(0)
-    subdomains[0] = 1
-    subdomains[1] = 1
+    left = Left()
+    left.mark(subdomains, 1)
 
+    class RightBoundary(SubDomain):
+        def inside(self, x, on_boundary):
+            return x[0] > 0.95
     boundaries = FacetFunction("size_t", mesh)
     boundaries.set_all(0)
-    boundaries[0] = 1
-    boundaries[1] = 1
-    boundaries[2] = 1
-    boundaries[3] = 1
+    right = RightBoundary()
+    right.mark(boundaries, 1)
 
     V = FunctionSpace(mesh, "CG", 2)
-    f = Expression("x[0] + 2")
-    g = Expression("x[1] + 1")
+    f = Expression("x[0] + 2", degree=1)
+    g = Expression("x[1] + 1", degree=1)
 
     f = interpolate(f, V)
     g = interpolate(g, V)
@@ -312,33 +321,25 @@ def test_subdomain_assembly_form_1():
     mesh1 = subdomains.mesh()
     mesh2 = boundaries.mesh()
     assert mesh1.id() == mesh2.id()
-    assert mesh1.ufl_domain().label() == mesh2.ufl_domain().label()
+    assert mesh1.ufl_domain().ufl_id() == mesh2.ufl_domain().ufl_id()
 
-    dxs = dx[subdomains]
-    dss = ds[boundaries]
-    assert dxs.domain() == None
-    assert dss.domain() == None
+    dxs = dx(subdomain_data=subdomains)
+    dss = ds(subdomain_data=boundaries)
+    assert dxs.ufl_domain() == None
+    assert dss.ufl_domain() == None
     assert dxs.subdomain_data() == subdomains
     assert dss.subdomain_data() == boundaries
 
     M = f*f*dxs(0) + g*f*dxs(1) + f*f*dss(1)
-    assert M.domains() == (mesh.ufl_domain(),)
+    assert M.ufl_domains() == (mesh.ufl_domain(),)
     sd = M.subdomain_data()[mesh.ufl_domain()]
     assert sd["cell"] == subdomains
     assert sd["exterior_facet"] == boundaries
 
     # Check that subdomains are respected
-    reference = 7.33040364583
+    reference = 15.0
     assert round(assemble(M) - reference, 10) == 0
 
-    # This feature has been removed:
-    # Check that given exterior_facet_domains override
-    #new_boundaries = FacetFunction("size_t", mesh)
-    #new_boundaries.set_all(0)
-    #reference2 = 6.2001953125
-    #value2 = assemble(M, exterior_facet_domains=new_boundaries)
-    #assert round(value2 - reference2, 10) == 0
-
     # Check that the form itself assembles as before
     assert round(assemble(M) - reference, 10) == 0
 
@@ -350,32 +351,36 @@ def test_subdomain_assembly_form_1():
     b = action(F, f)
 
     # Check that domain data carries across transformations:
-    reference = 0.0626219513355
+    reference = 0.136477465659
     assert round(assemble(b).norm("l2") - reference, 8) == 0
 
 
 @skip_in_parallel
-def test_subdomain_assembly_form_1_multithreaded():
+def test_subdomain_assembly_form_1_multithreaded(pushpop_parameters):
     "Test assembly over subdomains with markers stored as part of form"
 
     mesh = UnitSquareMesh(4, 4)
 
-    # Define some haphazardly chosen cell/facet function
+    # Define cell/facet function
+    class Left(SubDomain):
+        def inside(self, x, on_boundary):
+            return x[0] < 0.49
     subdomains = CellFunction("size_t", mesh)
     subdomains.set_all(0)
-    subdomains[0] = 1
-    subdomains[1] = 1
+    left = Left()
+    left.mark(subdomains, 1)
 
+    class RightBoundary(SubDomain):
+        def inside(self, x, on_boundary):
+            return x[0] > 0.95
     boundaries = FacetFunction("size_t", mesh)
     boundaries.set_all(0)
-    boundaries[0] = 1
-    boundaries[1] = 1
-    boundaries[2] = 1
-    boundaries[3] = 1
+    right = RightBoundary()
+    right.mark(boundaries, 1)
 
     V = FunctionSpace(mesh, "CG", 2)
-    f = Expression("x[0] + 2")
-    g = Expression("x[1] + 1")
+    f = Expression("x[0] + 2", degree=1)
+    g = Expression("x[1] + 1", degree=1)
 
     f = interpolate(f, V)
     g = interpolate(g, V)
@@ -383,50 +388,34 @@ def test_subdomain_assembly_form_1_multithreaded():
     mesh1 = subdomains.mesh()
     mesh2 = boundaries.mesh()
     assert mesh1.id() == mesh2.id()
-    assert mesh1.ufl_domain().label() == mesh2.ufl_domain().label()
+    assert mesh1.ufl_domain().ufl_id() == mesh2.ufl_domain().ufl_id()
 
-    dxs = dx[subdomains]
-    dss = ds[boundaries]
-    assert dxs.domain() == None
-    assert dss.domain() == None
+    dxs = dx(subdomain_data=subdomains)
+    dss = ds(subdomain_data=boundaries)
+    assert dxs.ufl_domain() == None
+    assert dss.ufl_domain() == None
     assert dxs.subdomain_data() == subdomains
     assert dss.subdomain_data() == boundaries
 
     M = f*f*dxs(0) + g*f*dxs(1) + f*f*dss(1)
-    assert M.domains() == (mesh.ufl_domain(),)
+    assert M.ufl_domains() == (mesh.ufl_domain(),)
     sd = M.subdomain_data()[mesh.ufl_domain()]
     assert sd["cell"] == subdomains
     assert sd["exterior_facet"] == boundaries
 
     # Check that subdomains are respected
-    reference = 7.33040364583
+    reference = 15.0
     assert round(assemble(M) - reference, 10) == 0
 
     # Assemble form (multi-threaded)
     parameters["num_threads"] = 4
     assert round(assemble(M) - reference, 10) == 0
-    parameters["num_threads"] = 0
-
-    # This feature has been removed:
-    # Check that given exterior_facet_domains override
-    #new_boundaries = FacetFunction("size_t", mesh)
-    #new_boundaries.set_all(0)
-    #reference2 = 6.2001953125
-    #value2 = assemble(M, exterior_facet_domains=new_boundaries)
-    #assert round(value2 - reference2, 10) == 0
-    # Assemble form (multi-threaded)
-    #parameters["num_threads"] = 4
-    #assert round(assemble(M, exterior_facet_domains=new_boundaries) -
-    #             reference2, 10) == 0
-    #parameters["num_threads"] = 0
 
     # Check that the form itself assembles as before
     assert round(assemble(M) - reference, 10) == 0
 
     # Assemble form  (multi-threaded)
-    parameters["num_threads"] = 4
     assert round(assemble(M) - reference, 10) == 0
-    parameters["num_threads"] = 0
 
     # Take action of derivative of M on f
     df = TestFunction(V)
@@ -436,13 +425,11 @@ def test_subdomain_assembly_form_1_multithreaded():
     b = action(F, f)
 
     # Check that domain data carries across transformations:
-    reference = 0.0626219513355
+    reference = 0.136477465659
     assert round(assemble(b).norm("l2") - reference, 8) == 0
 
     # Assemble form  (multi-threaded)
-    parameters["num_threads"] = 4
     assert round(assemble(b).norm("l2") - reference, 8) == 0
-    parameters["num_threads"] = 0
 
 
 def test_subdomain_assembly_form_2():
@@ -496,12 +483,14 @@ def test_colored_cell_assembly():
     v = TestFunction(V)
     u = TrialFunction(V)
     f = Constant((10, 20, 30))
+
     def epsilon(v):
         return 0.5*(grad(v) + grad(v).T)
+
     a = inner(epsilon(v), epsilon(u))*dx
     L = inner(v, f)*dx
 
-    A_frobenius_norm =  4.3969686527582512
+    A_frobenius_norm = 4.3969686527582512
     b_l2_norm = 0.95470326978246278
 
     # Assemble A and b
@@ -519,10 +508,14 @@ def test_nonsquare_assembly():
     """Test assembly of a rectangular matrix"""
 
     mesh = UnitSquareMesh(16, 16)
-    V = VectorFunctionSpace(mesh, "CG", 2)
-    Q = FunctionSpace(mesh, "CG", 1)
 
+    V = VectorElement("Lagrange", mesh.ufl_cell(), 2)
+    Q = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
     W = V*Q
+    V = FunctionSpace(mesh, V)
+    Q = FunctionSpace(mesh, Q)
+    W = FunctionSpace(mesh, W)
+
     (v, q) = TestFunctions(W)
     (u, p) = TrialFunctions(W)
     a = div(v)*p*dx
@@ -542,9 +535,9 @@ def test_nonsquare_assembly_multithreaded():
 
     mesh = UnitSquareMesh(16, 16)
 
-    V = VectorFunctionSpace(mesh, "CG", 2)
-    Q = FunctionSpace(mesh, "CG", 1)
-    W = V*Q
+    V = VectorElement("Lagrange", mesh.ufl_cell(), 2)
+    Q = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    W = FunctionSpace(mesh, V*Q)
 
     (v, q) = TestFunctions(W)
     (u, p) = TrialFunctions(W)
@@ -558,7 +551,7 @@ def test_nonsquare_assembly_multithreaded():
 
 
 @skip_in_parallel
-def test_reference_assembly(filedir):
+def test_reference_assembly(filedir, pushpop_parameters):
     "Test assembly against a reference solution"
 
     # NOTE: This test is not robust as it relies on specific
@@ -597,11 +590,9 @@ def test_reference_assembly(filedir):
         D = M - M0
         assert round(numpy.linalg.norm(D, 'fro') - 0.0, 7) == 0
 
-        parameters["reorder_dofs_serial"] = reorder_dofs
-
     except:
         print("Cannot run this test without SciPy")
-        parameters["reorder_dofs_serial"] = reorder_dofs
+
 
 def test_ways_to_pass_mesh_to_assembler():
     mesh = UnitSquareMesh(16, 16)
@@ -618,13 +609,13 @@ def test_ways_to_pass_mesh_to_assembler():
     # A function equal to x[0] for comparison
     V = FunctionSpace(mesh, "CG", 1)
     f = Function(V)
-    f.interpolate(Expression("x[0]"))
+    f.interpolate(Expression("x[0]", degree=1))
 
     # An expression equal to x[0], with different geometry info:
-    e = Expression("x[0]") # nothing
-    e2 = Expression("x[0]", cell=mesh.ufl_cell()) # cell
-    e3 = Expression("x[0]", element=V.ufl_element()) # ufl element
-    e4 = Expression("x[0]", domain=mesh) # ufl.Domain (this one holds mesh reference)
+    e = Expression("x[0]", degree=1)  # nothing
+    e2 = Expression("x[0]", cell=mesh.ufl_cell(), degree=1)  # cell
+    e3 = Expression("x[0]", element=V.ufl_element())  # ufl element
+    e4 = Expression("x[0]", domain=mesh, degree=1)  # mesh
 
     # Provide mesh in measure:
     dx2 = Measure("dx", domain=mesh)
@@ -633,9 +624,11 @@ def test_ways_to_pass_mesh_to_assembler():
     assert round(1.0 - assemble(Constant(1.0)*dx2), 7) == 0
 
     # Try with cell argument to Constant as well:
-    assert round(1.0 - assemble(Constant(1.0, cell=mesh.ufl_cell())*dx(mesh))) == 0
+    assert round(1.0 - assemble(Constant(1.0,
+                                         cell=mesh.ufl_cell())*dx(mesh))) == 0
     assert round(1.0 - assemble(Constant(1.0, cell=mesh.ufl_cell())*dx2)) == 0
-    assert round(1.0 - assemble(Constant(1.0, cell=mesh.ufl_cell())*dx(mesh))) == 0
+    assert round(1.0 - assemble(Constant(1.0,
+                                         cell=mesh.ufl_cell())*dx(mesh))) == 0
     assert round(1.0 - assemble(Constant(1.0, cell=mesh.ufl_cell())*dx2)) == 0
 
     # Geometric quantities with mesh in domain:
@@ -653,7 +646,7 @@ def test_ways_to_pass_mesh_to_assembler():
     assert round(0.5 - assemble(e*dx(mesh)), 7) == 0
     assert round(0.5 - assemble(e2*dx(mesh)), 7) == 0
     assert round(0.5 - assemble(e3*dx(mesh)), 7) == 0
-    assert round(0.5 - assemble(e4*dx), 7) == 0 # e4 has a domain with mesh reference
+    assert round(0.5 - assemble(e4*dx), 7) == 0  # e4 has a domain with mesh reference
     assert round(0.5 - assemble(e4*dx(mesh)), 7) == 0
 
     # Geometric quantities with mesh in domain:
diff --git a/test/unit/python/fem/test_dirichlet_bc.py b/test/unit/python/fem/test_dirichlet_bc.py
index 1c4958a..123d5ab 100755
--- a/test/unit/python/fem/test_dirichlet_bc.py
+++ b/test/unit/python/fem/test_dirichlet_bc.py
@@ -56,10 +56,10 @@ def test_director_lifetime():
     v, u = TestFunction(V), TrialFunction(V)
 
     A0 = assemble(v*u*dx)
-    bc0 = DirichletBC(V, BoundaryFunction(), Boundary())
+    bc0 = DirichletBC(V, BoundaryFunction(degree=1), Boundary())
     bc0.apply(A0)
 
-    bc1 = DirichletBC(V, Expression("1.0"), CompiledSubDomain("on_boundary"))
+    bc1 = DirichletBC(V, Expression("1.0", degree=0), CompiledSubDomain("on_boundary"))
     A1 = assemble(v*u*dx)
     bc1.apply(A1)
 
@@ -123,7 +123,7 @@ def test_bc_for_piola_on_manifolds():
     side = CompiledSubDomain("near(x[2], 0.0)")
     mesh = SubMesh(BoundaryMesh(UnitCubeMesh(n, n, n), "exterior"), side)
     square = UnitSquareMesh(n, n)
-    mesh.init_cell_orientations(Expression(("0.0", "0.0", "1.0")))
+    mesh.init_cell_orientations(Expression(("0.0", "0.0", "1.0"), degree=0))
 
     RT1 = lambda mesh: FunctionSpace(mesh, "RT", 1)
     RT2 = lambda mesh: FunctionSpace(mesh, "RT", 2)
@@ -133,7 +133,7 @@ def test_bc_for_piola_on_manifolds():
     BDM2 = lambda mesh: FunctionSpace(mesh, "BDM", 2)
     N1curl1 = lambda mesh: FunctionSpace(mesh, "N1curl", 1)
     N2curl1 = lambda mesh: FunctionSpace(mesh, "N2curl", 1)
-    N1curl2 = lambda mesh:FunctionSpace(mesh, "N1curl", 2)
+    N1curl2 = lambda mesh: FunctionSpace(mesh, "N1curl", 2)
     N2curl2 = lambda mesh: FunctionSpace(mesh, "N2curl", 2)
     elements = [N1curl1, N2curl1,  N1curl2, N2curl2, RT1, RT2, BDM1,
                 BDM2, DRT1, DRT2]
diff --git a/test/unit/python/fem/test_discrete_operators.py b/test/unit/python/fem/test_discrete_operators.py
new file mode 100755
index 0000000..3623030
--- /dev/null
+++ b/test/unit/python/fem/test_discrete_operators.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env py.test
+
+"""Unit tests for the DiscreteOperator class"""
+
+# Copyright (C) 2015 Garth N. Wells
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+from __future__ import print_function
+import pytest
+import numpy as np
+from dolfin import *
+
+from dolfin_utils.test import *
+
+
+def test_gradient():
+    """Test discrete gradient computation (typically used for curl-curl
+    AMG preconditioners"""
+
+    def compute_discrete_gradient(mesh):
+        V = FunctionSpace(mesh, "Lagrange", 1)
+        W = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
+
+        G = DiscreteOperators.build_gradient(W, V)
+        num_edges = mesh.size_global(1)
+        assert G.size(0) == num_edges
+        assert G.size(1) == mesh.size_global(0)
+        assert round(G.norm("frobenius") - sqrt(2.0*num_edges), 8) == 0.0
+
+    meshes = [UnitSquareMesh(11, 6), UnitCubeMesh(4, 3, 7)]
+    for mesh in meshes:
+        compute_discrete_gradient(mesh)
+
+
+def test_incompatible_spaces():
+    "Test that error is thrown when function spaces are not compatible"
+
+    mesh = UnitSquareMesh(13, 7)
+    V = FunctionSpace(mesh, "Lagrange", 1)
+    W = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
+    with pytest.raises(RuntimeError):
+        G = DiscreteOperators.build_gradient(V, W)
+    with pytest.raises(RuntimeError):
+        G = DiscreteOperators.build_gradient(V, V)
+    with pytest.raises(RuntimeError):
+        G = DiscreteOperators.build_gradient(W, W)
+
+    V = FunctionSpace(mesh, "Lagrange", 2)
+    with pytest.raises(RuntimeError):
+        G = DiscreteOperators.build_gradient(W, V)
diff --git a/test/unit/python/fem/test_dofmap.py b/test/unit/python/fem/test_dofmap.py
old mode 100755
new mode 100644
index d3ede03..4df144e
--- a/test/unit/python/fem/test_dofmap.py
+++ b/test/unit/python/fem/test_dofmap.py
@@ -26,59 +26,39 @@ from dolfin import *
 
 from dolfin_utils.test import *
 
+
 @fixture
 def mesh():
     return UnitSquareMesh(4, 4)
 
+
 @fixture
 def V(mesh):
     return FunctionSpace(mesh, "Lagrange", 1)
 
+
 @fixture
 def Q(mesh):
     return VectorFunctionSpace(mesh, "Lagrange", 1)
 
+
 @fixture
-def W(V, Q):
-    return V*Q
+def W(mesh):
+    V = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    Q = VectorElement("Lagrange", mesh.ufl_cell(), 1)
+    return FunctionSpace(mesh, V*Q)
 
 
 reorder_dofs = set_parameters_fixture("reorder_dofs_serial", [True, False])
 
 
-def test_tabulate_coord(mesh, V, W):
-
-    L0  = W.sub(0)
-    L1  = W.sub(1)
-    L01 = L1.sub(0)
-    L11 = L1.sub(1)
-
-    coord0 = np.zeros((3,2), dtype="d")
-    coord1 = np.zeros((3,2), dtype="d")
-    coord2 = np.zeros((3,2), dtype="d")
-    coord3 = np.zeros((3,2), dtype="d")
-
-    for cell in cells(mesh):
-        V.dofmap().tabulate_coordinates(cell, coord0)
-        L0.dofmap().tabulate_coordinates(cell, coord1)
-        L01.dofmap().tabulate_coordinates(cell, coord2)
-        L11.dofmap().tabulate_coordinates(cell, coord3)
-        coord4 = L1.dofmap().tabulate_coordinates(cell)
-
-        assert (coord0 == coord1).all()
-        assert (coord0 == coord2).all()
-        assert (coord0 == coord3).all()
-        assert (coord4[:3] == coord0).all()
-        assert (coord4[3:] == coord0).all()
-
-
 def test_tabulate_all_coordinates(mesh, V, W):
     D = mesh.geometry().dim()
     V_dofmap = V.dofmap()
     W_dofmap = W.dofmap()
 
-    all_coords_V = V_dofmap.tabulate_all_coordinates(V.mesh())
-    all_coords_W = W_dofmap.tabulate_all_coordinates(W.mesh())
+    all_coords_V = V.tabulate_dof_coordinates()
+    all_coords_W = W.tabulate_dof_coordinates()
     local_size_V = V_dofmap.ownership_range()[1]-V_dofmap.ownership_range()[0]
     local_size_W = W_dofmap.ownership_range()[1]-W_dofmap.ownership_range()[0]
 
@@ -114,15 +94,13 @@ def test_tabulate_all_coordinates(mesh, V, W):
 
 def test_tabulate_dofs(mesh, W):
 
-    L0   = W.sub(0)
-    L1   = W.sub(1)
-    L01  = L1.sub(0)
-    L11  = L1.sub(1)
+    L0 = W.sub(0)
+    L1 = W.sub(1)
+    L01 = L1.sub(0)
+    L11 = L1.sub(1)
 
     for i, cell in enumerate(cells(mesh)):
-
         dofs0 = L0.dofmap().cell_dofs(cell.index())
-
         dofs1 = L01.dofmap().cell_dofs(cell.index())
         dofs2 = L11.dofmap().cell_dofs(cell.index())
         dofs3 = L1.dofmap().cell_dofs(cell.index())
@@ -143,6 +121,7 @@ def test_tabulate_coord_periodic():
     class PeriodicBoundary2(SubDomain):
         def inside(self, x, on_boundary):
             return x[0] < DOLFIN_EPS
+
         def map(self, x, y):
             y[0] = x[0] - 1.0
             y[1] = x[1]
@@ -152,28 +131,29 @@ def test_tabulate_coord_periodic():
 
     mesh = UnitSquareMesh(4, 4)
 
-    V = FunctionSpace(mesh, "Lagrange", 1,  \
-                      constrained_domain=periodic_boundary)
-    Q = VectorFunctionSpace(mesh, "Lagrange", 1,  \
-                            constrained_domain=periodic_boundary)
+    V = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    Q = VectorElement("Lagrange", mesh.ufl_cell(), 1)
     W = V*Q
 
-    L0  = W.sub(0)
-    L1  = W.sub(1)
+    V = FunctionSpace(mesh, V, constrained_domain=periodic_boundary)
+    W = FunctionSpace(mesh, W, constrained_domain=periodic_boundary)
+
+    L0 = W.sub(0)
+    L1 = W.sub(1)
     L01 = L1.sub(0)
     L11 = L1.sub(1)
 
-    coord0 = np.zeros((3,2), dtype="d")
-    coord1 = np.zeros((3,2), dtype="d")
-    coord2 = np.zeros((3,2), dtype="d")
-    coord3 = np.zeros((3,2), dtype="d")
+    coord0 = np.zeros((3, 2), dtype="d")
+    coord1 = np.zeros((3, 2), dtype="d")
+    coord2 = np.zeros((3, 2), dtype="d")
+    coord3 = np.zeros((3, 2), dtype="d")
 
     for cell in cells(mesh):
-        V.dofmap().tabulate_coordinates(cell, coord0)
-        L0.dofmap().tabulate_coordinates(cell, coord1)
-        L01.dofmap().tabulate_coordinates(cell, coord2)
-        L11.dofmap().tabulate_coordinates(cell, coord3)
-        coord4 = L1.dofmap().tabulate_coordinates(cell)
+        V.element().tabulate_dof_coordinates(cell, coord0)
+        L0.element().tabulate_dof_coordinates(cell, coord1)
+        L01.element().tabulate_dof_coordinates(cell, coord2)
+        L11.element().tabulate_dof_coordinates(cell, coord3)
+        coord4 = L1.element().tabulate_dof_coordinates(cell)
 
         assert (coord0 == coord1).all()
         assert (coord0 == coord2).all()
@@ -187,6 +167,7 @@ def test_tabulate_dofs_periodic():
     class PeriodicBoundary2(SubDomain):
         def inside(self, x, on_boundary):
             return x[0] < DOLFIN_EPS
+
         def map(self, x, y):
             y[0] = x[0] - 1.0
             y[1] = x[1]
@@ -196,15 +177,18 @@ def test_tabulate_dofs_periodic():
     # Create periodic boundary
     periodic_boundary = PeriodicBoundary2()
 
-    V = FunctionSpace(mesh, "Lagrange", 2, constrained_domain=periodic_boundary)
-    Q = VectorFunctionSpace(mesh, "Lagrange", 2, \
-                            constrained_domain=periodic_boundary)
+    V = FiniteElement("Lagrange", mesh.ufl_cell(), 2)
+    Q = VectorElement("Lagrange", mesh.ufl_cell(), 2)
     W = V*Q
 
-    L0   = W.sub(0)
-    L1   = W.sub(1)
-    L01  = L1.sub(0)
-    L11  = L1.sub(1)
+    V = FunctionSpace(mesh, V, constrained_domain=periodic_boundary)
+    Q = FunctionSpace(mesh, Q, constrained_domain=periodic_boundary)
+    W = FunctionSpace(mesh, W, constrained_domain=periodic_boundary)
+
+    L0 = W.sub(0)
+    L1 = W.sub(1)
+    L01 = L1.sub(0)
+    L11 = L1.sub(1)
 
     # Check dimensions
     assert V.dim() == 110
@@ -215,9 +199,7 @@ def test_tabulate_dofs_periodic():
     assert L11.dim() == V.dim()
 
     for i, cell in enumerate(cells(mesh)):
-
         dofs0 = L0.dofmap().cell_dofs(cell.index())
-
         dofs1 = L01.dofmap().cell_dofs(cell.index())
         dofs2 = L11.dofmap().cell_dofs(cell.index())
         dofs3 = L1.dofmap().cell_dofs(cell.index())
@@ -234,40 +216,50 @@ def test_tabulate_dofs_periodic():
 
 
 def test_global_dof_builder():
-
     mesh = UnitSquareMesh(3, 3)
 
-    V = VectorFunctionSpace(mesh, "CG", 1)
-    Q = FunctionSpace(mesh, "CG", 1)
-    R = FunctionSpace(mesh, "R", 0)
+    V = VectorElement("CG", mesh.ufl_cell(), 1)
+    Q = FiniteElement("CG", mesh.ufl_cell(), 1)
+    R = FiniteElement("R",  mesh.ufl_cell(), 0)
 
-    W = MixedFunctionSpace([Q, Q, Q, R])
-    W = MixedFunctionSpace([Q, Q, R, Q])
-    W = MixedFunctionSpace([V, R])
-    W = MixedFunctionSpace([R, V])
+    W = FunctionSpace(mesh, MixedElement([Q, Q, Q, R]))
+    W = FunctionSpace(mesh, MixedElement([Q, Q, R, Q]))
+    W = FunctionSpace(mesh, V*R)
+    W = FunctionSpace(mesh, R*V)
 
 
 def test_dof_to_vertex_map(mesh, reorder_dofs):
 
+    def _test_maps_consistency(space):
+        v2d = vertex_to_dof_map(space)
+        d2v = dof_to_vertex_map(space)
+        assert len(v2d) == len(d2v)
+        assert np.all(v2d[d2v] == np.arange(len(v2d)))
+        assert np.all(d2v[v2d] == np.arange(len(d2v)))
+
     # Check for both reordered and UFC ordered dofs
-    V = FunctionSpace(mesh, "Lagrange", 1)
-    Q = VectorFunctionSpace(mesh, "Lagrange", 1)
-    W = V*Q
+    v = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    q = VectorElement("Lagrange", mesh.ufl_cell(), 1)
+    w = v*q
+
+    V = FunctionSpace(mesh, v)
+    Q = FunctionSpace(mesh, q)
+    W = FunctionSpace(mesh, w)
+
+    _test_maps_consistency(V)
+    _test_maps_consistency(Q)
+    _test_maps_consistency(W)
 
     u = Function(V)
-    e = Expression("x[0]+x[1]")
+    e = Expression("x[0] + x[1]", degree=1)
     u.interpolate(e)
 
     vert_values = mesh.coordinates().sum(1)
-    func_values = -1*np.ones(len(vert_values))
-    func_values[dof_to_vertex_map(V)] = u.vector().array()
+    func_values = np.empty(len(vert_values))
+    u.vector().get_local(func_values, vertex_to_dof_map(V))
+    assert round(max(abs(func_values - vert_values)), 7) == 0
 
-    for v_val, f_val in zip(vert_values, func_values):
-        # Do not compare dofs owned by other process
-        if f_val != -1:
-            assert round(f_val - v_val, 7) == 0
-
-    c0 = Constant((1,2))
+    c0 = Constant((1, 2))
     u0 = Function(Q)
     u0.interpolate(c0)
 
@@ -276,14 +268,15 @@ def test_dof_to_vertex_map(mesh, reorder_dofs):
     vert_values[::2] = 1
     vert_values[1::2] = 2
 
-    u1.vector().set_local(vert_values[dof_to_vertex_map(Q)].copy())
+    dim = Q.dofmap().index_map().size(IndexMap.MapSize_OWNED)
+    u1.vector().set_local(vert_values[dof_to_vertex_map(Q)[:dim]].copy())
     assert round((u0.vector()-u1.vector()).sum() - 0.0, 7) == 0
 
     W = FunctionSpace(mesh, "DG", 0)
     with pytest.raises(RuntimeError):
         dof_to_vertex_map(W)
 
-    W = Q*FunctionSpace(mesh, "R", 0)
+    W = FunctionSpace(mesh, q*FiniteElement("R", mesh.ufl_cell(), 0))
     with pytest.raises(RuntimeError):
         dof_to_vertex_map(W)
 
@@ -332,12 +325,12 @@ def test_entity_dofs(mesh):
 
     V = VectorFunctionSpace(mesh, "CG", 1)
 
-    # Note this numbering is dependent on FFC and can change This
-    # test is here just to check that we get correct numbers
-    # mapped from ufc generated code to dolfin
-    for i, cdofs in enumerate([[0,3], [1,4], [2,5]]):
+    # Note this numbering is dependent on FFC and can change This test
+    # is here just to check that we get correct numbers mapped from
+    # ufc generated code to dolfin
+    for i, cdofs in enumerate([[0, 3], [1, 4], [2, 5]]):
         dofs = V.dofmap().tabulate_entity_dofs(0, i)
-        assert all(d==cd for d, cd in zip(dofs, cdofs))
+        assert all(d == cd for d, cd in zip(dofs, cdofs))
 
 
 def test_clear_sub_map_data_scalar(mesh):
@@ -361,11 +354,11 @@ def test_clear_sub_map_data_scalar(mesh):
 
 def test_clear_sub_map_data_vector(mesh):
     mesh = UnitSquareMesh(8, 8)
-    V = FunctionSpace(mesh, "Lagrange", 1)
-    W = V*V
+    P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    W = FunctionSpace(mesh, P1*P1)
 
     # Check block size
-    assert W.dofmap().block_size == 2
+    assert W.dofmap().block_size() == 2
 
     W.dofmap().clear_sub_map_data()
     with pytest.raises(RuntimeError):
@@ -377,26 +370,28 @@ def test_clear_sub_map_data_vector(mesh):
 def test_block_size(mesh):
     meshes = [UnitSquareMesh(8, 8), UnitCubeMesh(4, 4, 4)]
     for mesh in meshes:
-        V = FunctionSpace(mesh, "Lagrange", 2)
-        assert V.dofmap().block_size == 1
+        P2 = FiniteElement("Lagrange", mesh.ufl_cell(), 2)
+
+        V = FunctionSpace(mesh, P2)
+        assert V.dofmap().block_size() == 1
 
-        W = V*V
-        assert W.dofmap().block_size == 2
+        V = FunctionSpace(mesh, P2*P2)
+        assert V.dofmap().block_size() == 2
 
         for i in range(1, 6):
-            W = MixedFunctionSpace([V]*i)
-            assert W.dofmap().block_size == i
+            W = FunctionSpace(mesh, MixedElement(i*[P2]))
+            assert W.dofmap().block_size() == i
 
         V = VectorFunctionSpace(mesh, "Lagrange", 2)
-        assert V.dofmap().block_size == mesh.geometry().dim()
+        assert V.dofmap().block_size() == mesh.geometry().dim()
 
 
 def test_block_size_real(mesh):
     mesh = UnitIntervalMesh(12)
-    V = FunctionSpace(mesh, 'DG', 0)
-    R = FunctionSpace(mesh, 'R', 0)
-    X = MixedFunctionSpace([V, R])
-    assert X.dofmap().block_size == 1
+    V = FiniteElement('DG', mesh.ufl_cell(), 0)
+    R = FiniteElement('R',  mesh.ufl_cell(), 0)
+    X = FunctionSpace(mesh, V*R)
+    assert X.dofmap().block_size() == 1
 
 
 @skip_in_serial
@@ -418,14 +413,14 @@ def test_local_dimension(V, Q, W):
         dofmap = space.dofmap()
         local_to_global_map = dofmap.tabulate_local_to_global_dofs()
         ownership_range = dofmap.ownership_range()
-        dim1 = dofmap.local_dimension('owned')
-        dim2 = dofmap.local_dimension('unowned')
-        dim3 = dofmap.local_dimension('all')
+        dim1 = dofmap.index_map().size(IndexMap.MapSize_OWNED)
+        dim2 = dofmap.index_map().size(IndexMap.MapSize_UNOWNED)
+        dim3 = dofmap.index_map().size(IndexMap.MapSize_ALL)
         assert dim1 == ownership_range[1] - ownership_range[0]
         assert dim3 == local_to_global_map.size
         assert dim1 + dim2 == dim3
-        with pytest.raises(RuntimeError):
-            dofmap.local_dimension('foo')
+        # with pytest.raises(RuntimeError):
+        #    dofmap.index_map().size('foo')
 
 
 @skip_in_parallel
@@ -444,8 +439,9 @@ def test_dofs_dim(mesh, V, Q, W):
                   FunctionSpace(mesh, "Lagrange", 3)]
 
         if tdim > 1:
-            vspaces = [VectorFunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1),
-                       VectorFunctionSpace(mesh, "Nedelec 1st kind H(curl)", 2),
+            N1 = "Nedelec 1st kind H(curl)"
+            vspaces = [VectorFunctionSpace(mesh, N1, 1),
+                       VectorFunctionSpace(mesh, N1, 2),
                        VectorFunctionSpace(mesh, "RT", 1)]
             spaces = spaces + vspaces
 
diff --git a/test/unit/python/fem/test_dp_assemble.py b/test/unit/python/fem/test_dp_assemble.py
index 2cc16d9..3bf9c05 100755
--- a/test/unit/python/fem/test_dp_assemble.py
+++ b/test/unit/python/fem/test_dp_assemble.py
@@ -27,12 +27,14 @@ from dolfin import *
 
 from dolfin_utils.test import *
 
- at pytest.fixture(params=[1,2,3])
+
+ at pytest.fixture(params=[1, 2, 3])
 def dim(request):
     return request.param
 
+
 def _create_dp_problem(dim):
-    assert dim in [1,2,3]
+    assert dim in [1, 2, 3]
     if dim == 1:
         mesh = UnitIntervalMesh(20)
     elif dim == 2:
@@ -40,15 +42,15 @@ def _create_dp_problem(dim):
     else:
         mesh = UnitCubeMesh(4, 4, 4)
 
-    V = FunctionSpace(mesh, "P", 1)
-    VV = V*V
+    P1 = FiniteElement("P", mesh.ufl_cell(), 1)
+    V = FunctionSpace(mesh, P1)
+    VV = FunctionSpace(mesh, P1*P1)
 
     # Create expression used to interpolate initial data
     y_dim = 1 if dim > 1 else 0
     z_dim = 2 if dim > 2 else (1 if dim > 1 else 0)
-    e = Expression("x[0]+2*x[{}]+x[{}]".format(y_dim, z_dim))
-    ee = Expression(["x[0]+x[{}]".format(z_dim),
-                     "x[0]*x[{}]+x[{}]".format(y_dim, z_dim)])
+    e = Expression("x[0] + 2*x[{}] + x[{}]".format(y_dim, z_dim), degree=2)
+    ee = Expression(["x[0]+x[{}]".format(z_dim), "x[0]*x[{}]+x[{}]".format(y_dim, z_dim)], degree=2)
 
     # Create coefficients
     u = interpolate(e, V)
@@ -61,15 +63,16 @@ def _create_dp_problem(dim):
     UU = TrialFunction(VV)
 
     # Subdomains
-    subdomain = AutoSubDomain(lambda x, on_boundary: x[0]<=0.5)
-    disjoint_subdomain = AutoSubDomain(lambda x, on_boundary: x[0]>0.5)
-    vertex_domain = VertexFunction("size_t", mesh , 0)
+    subdomain = AutoSubDomain(lambda x, on_boundary: x[0] <= 0.5)
+    disjoint_subdomain = AutoSubDomain(lambda x, on_boundary: x[0] > 0.5)
+    vertex_domain = VertexFunction("size_t", mesh, 0)
     subdomain.mark(vertex_domain, 1)
-    bc = DirichletBC(VV, Constant((0,0)), disjoint_subdomain)
-    dPP = dP[vertex_domain]
+    bc = DirichletBC(VV, Constant((0, 0)), disjoint_subdomain)
+    dPP = dP(subdomain_data=vertex_domain)
 
     return (u, uu), (v, vv), (U, UU), dPP, bc
 
+
 @use_gc_barrier
 def test_scalar_assemble(dim):
     eps = 1000*DOLFIN_EPS
@@ -86,6 +89,7 @@ def test_scalar_assemble(dim):
     bc.apply(uu.vector())
     assert abs(scalar_value-uu.vector().sum()) < eps
 
+
 @use_gc_barrier
 def test_vector_assemble(dim):
     eps = 1000*DOLFIN_EPS
@@ -96,13 +100,14 @@ def test_vector_assemble(dim):
     vec = assemble(u*v*dPP)
     assert sum(np.absolute(vec.array() - u.vector().array())) < eps
 
-    vec = assemble(inner(uu,vv)*dP)
+    vec = assemble(inner(uu, vv)*dP)
     assert sum(np.absolute(vec.array() - uu.vector().array())) < eps
 
-    vec = assemble(inner(uu,vv)*dPP(1))
+    vec = assemble(inner(uu, vv)*dPP(1))
     bc.apply(uu.vector())
     assert sum(np.absolute(vec.array() - uu.vector().array())) < eps
 
+
 @use_gc_barrier
 def test_matrix_assemble(dim):
     eps = 1000*DOLFIN_EPS
@@ -116,8 +121,8 @@ def test_matrix_assemble(dim):
     # and populate it with values from local vector
     loc_range = u.vector().local_range()
     vec_mat = np.zeros_like(mat.array())
-    vec_mat[range(loc_range[1]-loc_range[0]),
-            range(loc_range[0],loc_range[1])] = u.vector().array()
+    vec_mat[range(loc_range[1] - loc_range[0]),
+            range(loc_range[0], loc_range[1])] = u.vector().array()
 
     assert np.sum(np.absolute(mat.array() - vec_mat)) < eps
 
@@ -128,7 +133,7 @@ def test_matrix_assemble(dim):
     # and populate it with values from local vector
     loc_range = uu.vector().local_range()
     vec_mat = np.zeros_like(mat.array())
-    vec_mat[range(loc_range[1]-loc_range[0]),
-            range(loc_range[0],loc_range[1])] = uu.vector().array()
+    vec_mat[range(loc_range[1] - loc_range[0]),
+            range(loc_range[0], loc_range[1])] = uu.vector().array()
 
     assert np.sum(np.absolute(mat.array() - vec_mat)) < eps
diff --git a/test/unit/python/fem/test_finite_element.py b/test/unit/python/fem/test_finite_element.py
index 415638b..24ee1ed 100755
--- a/test/unit/python/fem/test_finite_element.py
+++ b/test/unit/python/fem/test_finite_element.py
@@ -28,27 +28,33 @@ from dolfin import *
 from six.moves import xrange as range
 from dolfin_utils.test import fixture
 
+
 @fixture
 def mesh():
     return UnitSquareMesh(4, 4)
 
+
 @fixture
 def V(mesh):
     return FunctionSpace(mesh, "CG", 1)
 
+
 @fixture
 def Q(mesh):
     return VectorFunctionSpace(mesh, "CG", 1)
 
+
 @fixture
-def W(V, Q):
-    return V * Q
+def W(mesh):
+    V = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    Q = VectorElement("Lagrange", mesh.ufl_cell(), 1)
+    return FunctionSpace(mesh, V*Q)
 
 
 def test_evaluate_dofs(W, mesh, V):
 
-    e = Expression("x[0]+x[1]")
-    e2 = Expression(("x[0]+x[1]", "x[0]+x[1]"))
+    e = Expression("x[0] + x[1]", degree=1)
+    e2 = Expression(("x[0] + x[1]", "x[0] + x[1]"), degree=1)
 
     coords = numpy.zeros((3, 2), dtype="d")
     coord = numpy.zeros(2, dtype="d")
@@ -58,17 +64,17 @@ def test_evaluate_dofs(W, mesh, V):
     values3 = numpy.zeros(3, dtype="d")
     values4 = numpy.zeros(6, dtype="d")
 
-    L0  = W.sub(0)
-    L1  = W.sub(1)
+    L0 = W.sub(0)
+    L1 = W.sub(1)
     L01 = L1.sub(0)
     L11 = L1.sub(1)
 
     for cell in cells(mesh):
         vx = cell.get_vertex_coordinates()
         orientation = cell.orientation()
-        V.dofmap().tabulate_coordinates(cell, coords)
+        V.element().tabulate_dof_coordinates(cell, coords)
         for i in range(coords.shape[0]):
-            coord[:] = coords[i,:]
+            coord[:] = coords[i, :]
             values0[i] = e(*coord)
         L0.element().evaluate_dofs(values1, e, vx, orientation, cell)
         L01.element().evaluate_dofs(values2, e, vx, orientation, cell)
@@ -82,6 +88,7 @@ def test_evaluate_dofs(W, mesh, V):
             assert round(values4[:3][i] - values0[i], 7) == 0
             assert round(values4[3:][i] - values0[i], 7) == 0
 
+
 def test_evaluate_dofs_manifolds_affine():
     "Testing evaluate_dofs vs tabulated coordinates."
 
@@ -98,7 +105,7 @@ def test_evaluate_dofs_manifolds_affine():
     CG22 = FunctionSpace(mesh2, "CG", 2)
     elements = [DG0, DG1, CG1, CG2, DG20, DG21, CG21, CG22]
 
-    f = Expression("x[0]+x[1]")
+    f = Expression("x[0] + x[1]", degree=1)
     for V in elements:
         sdim = V.element().space_dimension()
         gdim = V.mesh().geometry().dim()
@@ -109,9 +116,9 @@ def test_evaluate_dofs_manifolds_affine():
         for cell in cells(V.mesh()):
             vx = cell.get_vertex_coordinates()
             orientation = cell.orientation()
-            V.dofmap().tabulate_coordinates(cell, coords)
+            V.element().tabulate_dof_coordinates(cell, coords)
             for i in range(coords.shape[0]):
-                coord[:] = coords[i,:]
+                coord[:] = coords[i, :]
                 values0[i] = f(*coord)
             V.element().evaluate_dofs(values1, f, vx, orientation, cell)
             for i in range(sdim):
@@ -120,23 +127,23 @@ def test_evaluate_dofs_manifolds_affine():
 
 def test_tabulate_coord(V, W, mesh):
 
-    coord0 = numpy.zeros((3,2), dtype="d")
-    coord1 = numpy.zeros((3,2), dtype="d")
-    coord2 = numpy.zeros((3,2), dtype="d")
-    coord3 = numpy.zeros((3,2), dtype="d")
-    coord4 = numpy.zeros((6,2), dtype="d")
+    coord0 = numpy.zeros((3, 2), dtype="d")
+    coord1 = numpy.zeros((3, 2), dtype="d")
+    coord2 = numpy.zeros((3, 2), dtype="d")
+    coord3 = numpy.zeros((3, 2), dtype="d")
+    coord4 = numpy.zeros((6, 2), dtype="d")
 
-    L0  = W.sub(0)
-    L1  = W.sub(1)
+    L0 = W.sub(0)
+    L1 = W.sub(1)
     L01 = L1.sub(0)
     L11 = L1.sub(1)
 
     for cell in cells(mesh):
-        V.dofmap().tabulate_coordinates(cell, coord0)
-        L0.dofmap().tabulate_coordinates(cell, coord1)
-        L01.dofmap().tabulate_coordinates(cell, coord2)
-        L11.dofmap().tabulate_coordinates(cell, coord3)
-        L1.dofmap().tabulate_coordinates(cell, coord4)
+        V.element().tabulate_dof_coordinates(cell, coord0)
+        L0.element().tabulate_dof_coordinates(cell, coord1)
+        L01.element().tabulate_dof_coordinates(cell, coord2)
+        L11.element().tabulate_dof_coordinates(cell, coord3)
+        L1.element().tabulate_dof_coordinates(cell, coord4)
 
         assert (coord0 == coord1).all()
         assert (coord0 == coord2).all()
diff --git a/test/unit/python/fem/test_form.py b/test/unit/python/fem/test_form.py
index 7745bb9..3a4f219 100755
--- a/test/unit/python/fem/test_form.py
+++ b/test/unit/python/fem/test_form.py
@@ -31,40 +31,49 @@ from dolfin_utils.test import skip_in_parallel, fixture
 
 @fixture
 def square():
-    return UnitSquareMesh(2, 2)
+    return UnitSquareMesh(8, 8)
+
 
 @fixture
 def square_boundary(square):
     return BoundaryMesh(square, "exterior")
 
+
 @fixture
 def cube_boundary(cube):
     return BoundaryMesh(cube, "exterior")
 
+
 @fixture
 def cube():
     return UnitCubeMesh(2, 2, 2)
 
+
 @fixture
 def V1(square_boundary):
     return FunctionSpace(square_boundary, "CG", 1)
 
+
 @fixture
 def VV1(square_boundary):
     return VectorFunctionSpace(square_boundary, "CG", 1)
 
+
 @fixture
 def Q1(square_boundary):
     return FunctionSpace(square_boundary, "DG", 0)
 
+
 @fixture
 def V2(cube_boundary):
     return FunctionSpace(cube_boundary, "CG", 1)
 
+
 @fixture
 def VV2(cube_boundary):
     return VectorFunctionSpace(cube_boundary, "CG", 1)
 
+
 @fixture
 def Q2(cube_boundary):
     return FunctionSpace(cube_boundary, "DG", 0)
@@ -72,6 +81,10 @@ def Q2(cube_boundary):
 
 def test_assemble_functional(V1, V2):
 
+    mesh = V1.mesh()
+    surfacearea = assemble(1*dx(mesh))
+    assert round(surfacearea - 4.0, 7) == 0
+
     u = Function(V1)
     u.vector()[:] = 1.0
     surfacearea = assemble(u*dx)
@@ -82,12 +95,12 @@ def test_assemble_functional(V1, V2):
     surfacearea = assemble(u*dx)
     assert round(surfacearea - 6.0, 7) == 0
 
-    f = Expression("1.0")
+    f = Expression("1.0", degree=0)
     u = interpolate(f, V1)
     surfacearea = assemble(u*dx)
     assert round(surfacearea - 4.0, 7) == 0
 
-    f = Expression("1.0")
+    f = Expression("1.0", degree=0)
     u = interpolate(f, V2)
     surfacearea = assemble(u*dx)
     assert round(surfacearea - 6.0, 7) == 0
@@ -99,7 +112,7 @@ def test_assemble_linear(V1, Q1, square_boundary, V2, Q2, cube_boundary):
     w = TestFunction(Q1)
     u.vector()[:] = 0.5
     facetareas = MPI.sum(square_boundary.mpi_comm(),
-                          assemble(u*w*dx).array().sum())
+                         assemble(u*w*dx).array().sum())
     assert round(facetareas - 2.0, 7) == 0
 
     u = Function(V2)
@@ -124,7 +137,7 @@ def test_assemble_linear(V1, Q1, square_boundary, V2, Q2, cube_boundary):
     a = MPI.sum(mesh.mpi_comm(),
                 assemble(inner(u, v)*ds).array().sum())
     b = MPI.sum(bdry.mpi_comm(),
-                 assemble(inner(bu, bv)*dx).array().sum())
+                assemble(inner(bu, bv)*dx).array().sum())
     assert round(a - b, 7) == 0
 
 
@@ -139,7 +152,7 @@ def test_assemble_bilinear_1D_2D(square, V1, square_boundary):
     bv = TestFunction(V1)
 
     a = MPI.sum(square.mpi_comm(),
-                 assemble(inner(u, v)*ds).array().sum())
+                assemble(inner(u, v)*ds).array().sum())
     b = MPI.sum(square_boundary.mpi_comm(),
                 assemble(inner(bu, bv)*dx).array().sum())
     assert round(a - b, 7) == 0
@@ -149,10 +162,13 @@ def test_assemble_bilinear_1D_2D(square, V1, square_boundary):
     bottom = FacetFunctionSizet(square)
     bottom.set_all(0)
     subdomain.mark(bottom, 1)
-    dss = ds[bottom]
+    dss = ds(subdomain_data=bottom)
     foo = MPI.sum(square.mpi_comm(),
-               abs(assemble(inner(grad(u)[0], grad(v)[0])*dss(1)).array()).sum())
-    # Assemble over all cells of submesh created from subset of boundary mesh
+                  abs(assemble(inner(grad(u)[0],
+                                     grad(v)[0])*dss(1)).array()).sum())
+
+    # Assemble over all cells of submesh created from subset of
+    # boundary mesh
     bottom2 = CellFunctionSizet(square_boundary)
     bottom2.set_all(0)
     subdomain.mark(bottom2, 1)
@@ -160,7 +176,8 @@ def test_assemble_bilinear_1D_2D(square, V1, square_boundary):
     bu = TrialFunction(BV)
     bv = TestFunction(BV)
     bar = MPI.sum(square_boundary.mpi_comm(),
-                  abs(assemble(inner(grad(bu)[0], grad(bv)[0])*dx).array()).sum())
+                  abs(assemble(inner(grad(bu)[0],
+                                     grad(bv)[0])*dx).array()).sum())
     # Should give same result
     assert round(bar - foo, 7) == 0
 
@@ -187,10 +204,13 @@ def test_assemble_bilinear_2D_3D(cube, V2, cube_boundary):
     bottom = FacetFunctionSizet(cube)
     bottom.set_all(0)
     subdomain.mark(bottom, 1)
-    dss = ds[bottom]
+    dss = ds(subdomain_data=bottom)
     foo = MPI.sum(cube.mpi_comm(),
-               abs(assemble(inner(grad(u)[0], grad(v)[0])*dss(1)).array()).sum())
-    # Assemble over all cells of submesh created from subset of boundary mesh
+                  abs(assemble(inner(grad(u)[0],
+                                     grad(v)[0])*dss(1)).array()).sum())
+
+    # Assemble over all cells of submesh created from subset of
+    # boundary mesh
     bottom2 = CellFunctionSizet(cube_boundary)
     bottom2.set_all(0)
     subdomain.mark(bottom2, 1)
@@ -198,7 +218,9 @@ def test_assemble_bilinear_2D_3D(cube, V2, cube_boundary):
     bu = TrialFunction(BV)
     bv = TestFunction(BV)
     bar = MPI.sum(cube_boundary.mpi_comm(),
-                   abs(assemble(inner(grad(bu)[0], grad(bv)[0])*dx).array()).sum())
+                  abs(assemble(inner(grad(bu)[0],
+                                     grad(bv)[0])*dx).array()).sum())
+
     # Should give same result
     assert round(bar - foo, 7) == 0
 
@@ -210,38 +232,56 @@ def base():
     square = UnitSquareMesh(n, n)
 
     square3d = SubMesh(BoundaryMesh(UnitCubeMesh(n, n, n), "exterior"), plane)
-    global_normal = Expression(("0.0", "1.0", "0.0"))
+    global_normal = Expression(("0.0", "1.0", "0.0"), degree=0)
     square3d.init_cell_orientations(global_normal)
 
-    RT2 = FunctionSpace(square, "RT", 1)
-    RT3 = FunctionSpace(square3d, "RT", 1)
-    DG2 = FunctionSpace(square, "DG", 0)
-    DG3 = FunctionSpace(square3d, "DG", 0)
+    RT2 = FiniteElement("RT", square.ufl_cell(), 1)
+    RT3 = FiniteElement("RT", square3d.ufl_cell(), 1)
+    DG2 = FiniteElement("DG", square.ufl_cell(), 0)
+    DG3 = FiniteElement("DG", square3d.ufl_cell(), 0)
+
+    return [(RT2, RT3), (DG2, DG3), (square, square3d)]
 
-    return [(RT2, RT3), (DG2, DG3)]
 
 @fixture
 def RT2(base):
-    return base[0][0]
+    return FunctionSpace(base[2][0], base[0][0])
+
 
 @fixture
 def RT3(base):
-    return base[0][1]
+    return FunctionSpace(base[2][1], base[0][1])
+
 
 @fixture
 def W2(base):
-    return base[0][0] * base[1][0]
+    """ RT2 * DG2 """
+    return FunctionSpace(base[2][0], base[0][0] * base[1][0])
+
 
 @fixture
 def W3(base):
-    return base[0][1] * base[1][1]
+    """ RT3 * DG3 """
+    return FunctionSpace(base[2][1], base[0][1] * base[1][1])
+
+
+ at fixture
+def QQ2(base):
+    """ DG2 * DG2 """
+    return FunctionSpace(base[2][0], base[1][0] * base[1][0])
+
+
+ at fixture
+def QQ3(base):
+    """ DG3 * DG3 """
+    return FunctionSpace(base[2][1], base[1][1] * base[1][1])
 
 
 @skip_in_parallel
 def test_basic_rt(RT2, RT3):
 
-    f2 = Expression(("2.0", "1.0"))
-    f3 = Expression(("1.0", "0.0", "2.0"))
+    f2 = Expression(("2.0", "1.0"), degree=0)
+    f3 = Expression(("1.0", "0.0", "2.0"), degree=0)
 
     u2 = TrialFunction(RT2)
     u3 = TrialFunction(RT3)
@@ -251,8 +291,8 @@ def test_basic_rt(RT2, RT3):
     # Project
     pw2 = project(f2, RT2)
     pw3 = project(f3, RT3)
-    pa2 = assemble(inner(pw2, pw2)*dx)
-    pa3 = assemble(inner(pw3, pw3)*dx)
+    pa2 = assemble(pw2**2*dx)
+    pa3 = assemble(pw3**2*dx)
 
     # Project explicitly
     a2 = inner(u2, v2)*dx
@@ -267,15 +307,18 @@ def test_basic_rt(RT2, RT3):
     b3 = assemble(L3)
     solve(A2, w2.vector(), b2)
     solve(A3, w3.vector(), b3)
-    a2 = assemble(inner(w2, w2)*dx)
-    a3 = assemble(inner(w3, w3)*dx)
+    a2 = assemble(w2**2*dx)
+    a3 = assemble(w3**2*dx)
 
     # Compare various results
-    assert round((w2.vector() - pw2.vector()).norm("l2") - 0.0, 5) == 0
+    assert round((w2.vector() - pw2.vector()).norm("l2"), 4) == 0
+    assert round((w3.vector() - pw3.vector()).norm("l2"), 4) == 0
+    # 2d
+    assert round(a2 - 5.0, 7) == 0
+    assert round(pa2 - 5.0, 7) == 0
+    # 3d
     assert round(a3 - 5.0, 7) == 0
-    assert round(a2 - a3, 7) == 0
-    assert round(pa2 - a2, 7) == 0
-    assert round(pa2 - pa3, 6) == 0
+    assert round(pa3 - 5.0, 6) == 0
 
 
 @skip_in_parallel
@@ -307,39 +350,48 @@ def test_mixed_poisson_solve(W2, W3):
 def m():
     return 3
 
+
 @fixture
 def cube(m):
     return UnitCubeMesh(m, m, m)
 
+
 @fixture
 def cube_boundary(cube):
     return BoundaryMesh(cube, "exterior")
 
+
 @fixture
 def plane():
     return CompiledSubDomain("near(x[1], 0.0)")
 
+
 @fixture
 def square_boundary_(m):
     square = UnitSquareMesh(m, m)
     return BoundaryMesh(square, "exterior")
 
+
 @fixture
 def line():
     return CompiledSubDomain("near(x[0], 0.0)")
 
+
 @fixture
 def mesh3(cube_boundary, plane):
     return BoundaryMesh(SubMesh(cube_boundary, plane), "exterior")
 
+
 @fixture
 def bottom1(square_boundary_, plane):
     return SubMesh(square_boundary_, plane)
 
+
 @fixture
 def bottom2(cube_boundary, plane):
     return SubMesh(cube_boundary, plane)
 
+
 @fixture
 def bottom3(mesh3, line):
     return SubMesh(mesh3, line)
@@ -461,3 +513,49 @@ def test_facetarea(bottom1, bottom2, bottom3, m):
     a = area*ds
     b1 = assemble(a)
     assert round(b0 - b1, 7) == 0
+
+
+ at skip_in_parallel
+def test_derivative(QQ2, QQ3):
+    for W in [QQ2, QQ3]:
+        w = Function(W)
+        dim = w.value_dimension(0)
+        w.interpolate(Constant([42.0*(i+1) for i in range(dim)]))
+
+        # Derivative w.r.t. mixed space
+        u, v = split(w)
+        F = u*v*dx
+        dF = derivative(F, w)
+        b1 = assemble(dF)
+
+
+def test_coefficient_derivatives(V1, V2):
+    for V in [V1, V2]:
+        f = Function(V)
+        g = Function(V)
+        v = TestFunction(V)
+        u = TrialFunction(V)
+
+        f.interpolate(Expression("1.0 + x[0] + x[1]", degree=1))
+        g.interpolate(Expression("2.0 + x[0] + x[1]", degree=1))
+
+        # Since g = f + 1, define dg/df = 1
+        cd = {g: 1}
+
+        # Handle relation between g and f in derivative
+        M = g**2*dx
+        L = derivative(M, f, v, coefficient_derivatives=cd)
+        a = derivative(L, f, u, coefficient_derivatives=cd)
+        A0 = assemble(a).norm('frobenius')
+        b0 = assemble(L).norm('l2')
+
+        # Manually construct the above case
+        M = g**2*dx
+        L = 2*g*v*dx
+        a = 2*u*v*dx
+        A1 = assemble(a).norm('frobenius')
+        b1 = assemble(L).norm('l2')
+
+        # Compare
+        assert round(A0 - A1, 7) == 0.0
+        assert round(b0 - b1, 7) == 0.0
diff --git a/test/unit/python/fem/test_interior_facet_integral_sides.py b/test/unit/python/fem/test_interior_facet_integral_sides.py
index e178ee2..8640656 100755
--- a/test/unit/python/fem/test_interior_facet_integral_sides.py
+++ b/test/unit/python/fem/test_interior_facet_integral_sides.py
@@ -3,6 +3,7 @@ import ufl
 from dolfin import *
 from dolfin_utils.test import skip_in_parallel
 
+
 @skip_in_parallel
 def test_interior_facet_integral_sides():
     n = 1
@@ -11,14 +12,15 @@ def test_interior_facet_integral_sides():
     subdomain = AutoSubDomain(lambda x, on_boundary: x[0] > x[1]-DOLFIN_EPS)
 
     V = FunctionSpace(mesh, "DG", 0)
-    f = interpolate(Expression("x[0]"), V)
+    f = interpolate(Expression("x[0]", degree=1), V)
 
     # Define forms picking value of f from + and - sides
     scale = 1.0/ufl.FacetArea(mesh)
     Mp = f('+')*scale*dS(domain=mesh)
     Mm = f('-')*scale*dS(domain=mesh)
 
-    # Hack to attach cell markers to dS integral... Need to find a UFL solution to this.
+    # Hack to attach cell markers to dS integral... Need to find a UFL
+    # solution to this.
     Mh = Constant(0)*dx(99, domain=mesh, subdomain_data=markers)
     Mp = Mp + Mh
     Mm = Mm + Mh
diff --git a/test/unit/python/fem/test_local_assembler.py b/test/unit/python/fem/test_local_assembler.py
new file mode 100755
index 0000000..ac6d4a9
--- /dev/null
+++ b/test/unit/python/fem/test_local_assembler.py
@@ -0,0 +1,159 @@
+#!/usr/bin/env py.test
+
+"""Unit tests for local assembly"""
+
+# Copyright (C) 2015 Tormod Landet
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+from __future__ import division
+import numpy
+from dolfin import *
+from dolfin_utils.test import set_parameters_fixture
+
+
+ghost_mode = set_parameters_fixture("ghost_mode", ["shared_facet"])
+
+
+def test_local_assembler_1D():
+    mesh = UnitIntervalMesh(20)
+    V = FunctionSpace(mesh, 'CG', 1)
+    u = TrialFunction(V)
+    v = TestFunction(V)
+    c = Cell(mesh, 0)
+
+    a_scalar = Constant(1)*dx(domain=mesh)
+    a_vector = v*dx
+    a_matrix = u*v*dx
+
+    A_scalar = assemble_local(a_scalar, c)
+    A_vector = assemble_local(a_vector, c)
+    A_matrix = assemble_local(a_matrix, c)
+
+    assert isinstance(A_scalar, float)
+    assert near(A_scalar, 0.05)
+
+    assert isinstance(A_vector, numpy.ndarray)
+    assert A_vector.shape == (2,)
+    assert near(A_vector[0], 0.025)
+    assert near(A_vector[1], 0.025)
+
+    assert isinstance(A_matrix, numpy.ndarray)
+    assert A_matrix.shape == (2, 2)
+    assert near(A_matrix[0, 0], 1/60)
+    assert near(A_matrix[0, 1], 1/120)
+    assert near(A_matrix[1, 0], 1/120)
+    assert near(A_matrix[1, 1], 1/60)
+
+
+def test_local_assembler_on_facet_integrals(ghost_mode):
+    mesh = UnitSquareMesh(4, 4, 'right')
+    Vcg = FunctionSpace(mesh, 'CG', 1)
+    Vdg = FunctionSpace(mesh, 'DG', 0)
+    Vdgt = FunctionSpace(mesh, 'DGT', 1)
+
+    v = TestFunction(Vdgt)
+    n = FacetNormal(mesh)
+
+    # Initialize DG function "w" in discontinuous pattern
+    w = Expression('(1.0 + pow(x[0], 2.2) + 1/(0.1 + pow(x[1], 3)))*300.0',
+                   element=Vdg.ufl_element())
+
+    # Define form that tests that the correct + and - values are used
+    L = w('-')*v('+')*dS
+
+    # Compile form. This is collective
+    L = Form(L)
+
+    # Get global cell 10. This will return a cell only on one of the
+    # processes
+    c = get_cell_at(mesh, 5/12, 1/3, 0)
+
+    if c:
+        # Assemble locally on the selected cell
+        b_e = assemble_local(L, c)
+
+        # Compare to values from phonyx (fully independent
+        # implementation)
+        b_phonyx = numpy.array([266.55210302, 266.55210302, 365.49000122,
+                                365.49000122,          0.0,          0.0])
+        error = sum((b_e - b_phonyx)**2)**0.5
+        error = float(error)  # MPI.max does strange things to numpy.float64
+
+    else:
+        error = 0.0
+
+    error = MPI.max(mpi_comm_world(), float(error))
+    assert error < 1e-8
+
+
+def test_local_assembler_on_facet_integrals2(ghost_mode):
+    mesh = UnitSquareMesh(4, 4)
+    Vu = VectorFunctionSpace(mesh, 'DG', 1)
+    Vv = FunctionSpace(mesh, 'DGT', 1)
+    u = TrialFunction(Vu)
+    v = TestFunction(Vv)
+    n = FacetNormal(mesh)
+
+    # Define form
+    a = dot(u, n)*v*ds
+    for R in '+-':
+        a += dot(u(R), n(R))*v(R)*dS
+
+    # Compile form. This is collective
+    a = Form(a)
+
+    # Get global cell 0. This will return a cell only on one of the
+    # processes
+    c = get_cell_at(mesh, 1/6, 1/12, 0)
+
+    if c:
+        A_e = assemble_local(a, c)
+        A_correct = numpy.array([[0, 1/12, 1/24, 0, 0, 0],
+                                 [0, 1/24, 1/12, 0, 0, 0],
+                                 [-1/12, 0, -1/24, 1/12, 0, 1/24],
+                                 [-1/24, 0, -1/12, 1/24, 0, 1/12],
+                                 [0, 0, 0, -1/12, -1/24, 0],
+                                 [0, 0, 0, -1/24, -1/12, 0]])
+        error = ((A_e - A_correct)**2).sum()**0.5
+        error = float(error)  # MPI.max does strange things to numpy.float64
+
+    else:
+        error = 0.0
+
+    error = MPI.max(mpi_comm_world(), float(error))
+    assert error < 1e-16
+
+
+def get_cell_at(mesh, x, y, z, eps=1e-3):
+    """Return the cell with the given midpoint or None if not found. The
+    function also checks that the cell is found on one of the
+    processes when running in parallel to avoid that the above tests
+    always suceed if the cell is not found on any of the processes.
+
+    """
+    found = None
+    for cell in cells(mesh):
+        mp = cell.midpoint()
+        if abs(mp.x() - x) + abs(mp.y() - y) + abs(mp.y() - y) < eps:
+            found = cell
+            break
+
+    # Make sure this cell is on at least one of the parallel processes
+    marker = 1 if found is not None else 0
+    assert MPI.max(mpi_comm_world(), marker) == 1
+
+    return found
diff --git a/test/unit/python/fem/test_local_solver.py b/test/unit/python/fem/test_local_solver.py
index 8bbd19e..573cfd1 100755
--- a/test/unit/python/fem/test_local_solver.py
+++ b/test/unit/python/fem/test_local_solver.py
@@ -19,14 +19,16 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
-# Modified by Steven Vandekerckhove, 2014.
-#
-# First added:  2013-02-13
-# Last changed: 2014-11-18
+# Modified by Steven Vandekerckhove, 2014
+# Modified by Tormod Landet, 2015
 
 import pytest
 import numpy
 from dolfin import *
+from dolfin_utils.test import skip_in_parallel
+from dolfin_utils.test import set_parameters_fixture
+ghost_mode = set_parameters_fixture("ghost_mode", ["shared_facet"])
+
 
 def test_solve_global_rhs():
     mesh = UnitCubeMesh(2, 3, 3)
@@ -39,7 +41,7 @@ def test_solve_global_rhs():
     # Forms for projection
     a, L = inner(v, u)*dx, inner(v, f)*dx
 
-    solvers = [LocalSolver.LU, LocalSolver.Cholesky]
+    solvers = [LocalSolver.SolverType_LU, LocalSolver.SolverType_Cholesky]
     for solver_type in solvers:
 
         # First solve
@@ -63,7 +65,8 @@ def test_solve_global_rhs():
         error = assemble((u - f)*(u - f)*dx)
         assert round(error, 10) == 0
 
-def test_solve_local_rhs():
+
+def test_solve_local_rhs(ghost_mode):
     mesh = UnitCubeMesh(1, 5, 1)
     V = FunctionSpace(mesh, "Lagrange", 2)
     W = FunctionSpace(mesh, "Lagrange", 2)
@@ -74,7 +77,7 @@ def test_solve_local_rhs():
     # Forms for projection
     a, L = inner(v, u)*dx, inner(v, f)*dx
 
-    solvers = [LocalSolver.LU, LocalSolver.Cholesky]
+    solvers = [LocalSolver.SolverType_LU, LocalSolver.SolverType_Cholesky]
     for solver_type in solvers:
 
         # First solve
@@ -95,12 +98,41 @@ def test_solve_local_rhs():
         local_solver.solve_local_rhs(u)
         assert round((u.vector() - x).norm("l2") - 0.0, 10) == 0
 
-def test_local_solver_dg():
-    mesh = UnitIntervalMesh(50)
+
+def test_solve_local_rhs_facet_integrals(ghost_mode):
+    mesh = UnitSquareMesh(4, 4)
+
+    Vu = VectorFunctionSpace(mesh, 'DG', 1)
+    Vv = FunctionSpace(mesh, 'DGT', 1)
+    u = TrialFunction(Vu)
+    v = TestFunction(Vv)
+
+    n = FacetNormal(mesh)
+    w = Constant([1, 1])
+
+    a = dot(u, n)*v*ds
+    L = dot(w, n)*v*ds
+
+    for R in '+-':
+        a += dot(u(R), n(R))*v(R)*dS
+        L += dot(w(R), n(R))*v(R)*dS
+
+    u = Function(Vu)
+    local_solver = LocalSolver(a, L)
+    local_solver.solve_local_rhs(u)
+
+    x = u.vector().copy()
+    x[:] = 1
+    assert round((u.vector() - x).norm('l2'), 10) == 0
+
+
+def test_local_solver_dg(ghost_mode):
+    # Ghosted mesh in 1D not supported
+    mesh = UnitSquareMesh(50, 1)
     U = FunctionSpace(mesh, "DG", 2)
 
     # Set initial values
-    u0 = interpolate(Expression("cos(pi*x[0])"), U)
+    u0 = interpolate(Expression("cos(pi*x[0])", degree=2), U)
 
     # Define test and trial functions
     v, u = TestFunction(U), TrialFunction(U)
@@ -127,18 +159,19 @@ def test_local_solver_dg():
     assert round((u_lu.vector() - u_ls.vector()).norm("l2"), 12) == 0
 
     # Compute solution with local solver (Cholesky) and compare
-    local_solver = LocalSolver(a, L, True)
+    local_solver = LocalSolver(a, L, LocalSolver.SolverType_Cholesky)
     u_ls = Function(U)
     local_solver.solve_global_rhs(u_ls)
     assert round((u_lu.vector() - u_ls.vector()).norm("l2"), 12) == 0
 
 
-def test_solve_local():
-    mesh = UnitIntervalMesh(50)
+def test_solve_local(ghost_mode):
+    # Ghosted mesh in 1D not supported
+    mesh = UnitSquareMesh(50, 1)
     U = FunctionSpace(mesh, "DG", 2)
 
     # Set initial values
-    u0 = interpolate(Expression("cos(pi*x[0])"), U)
+    u0 = interpolate(Expression("cos(pi*x[0])", degree=2), U)
 
     # Define test and trial functions
     v, u = TestFunction(U), TrialFunction(U)
@@ -166,7 +199,7 @@ def test_solve_local():
     assert round((u_lu.vector() - u_ls.vector()).norm("l2"), 12) == 0
 
     # Compute solution with local solver (Cholesky) and compare
-    local_solver = LocalSolver(a, solver_type=LocalSolver.Cholesky)
+    local_solver = LocalSolver(a, solver_type=LocalSolver.SolverType_Cholesky)
     u_ls = Function(U)
     local_solver.solve_local(u_ls.vector(), b, U.dofmap())
     assert round((u_lu.vector() - u_ls.vector()).norm("l2"), 12) == 0
diff --git a/test/unit/python/fem/test_manifolds.py b/test/unit/python/fem/test_manifolds.py
index 05235b6..42fd4d1 100755
--- a/test/unit/python/fem/test_manifolds.py
+++ b/test/unit/python/fem/test_manifolds.py
@@ -33,11 +33,13 @@ import os
 import numpy
 from dolfin_utils.test import *
 
+
 # Subdomain to extract bottom boundary.
 class BottomEdge(SubDomain):
     def inside(self, x, on_boundary):
         return near(x[2], 0.0)
 
+
 class Rotation:
     """Class implementing rotations of the unit plane through an angle
     of phi about the x axis followed by theta about the z axis."""
@@ -65,19 +67,20 @@ class Rotation:
         of the image of x mapped back to the horizontal plane."""
 
         return "("+" + ".join(["%.17f * x[%d]" % (a, j)
-                               for (j,a) in enumerate(self.invmat[i,:])])+")"
+                               for (j, a) in enumerate(self.invmat[i, :])])+")"
 
     def rotate(self, mesh):
         """Rotate mesh through phi then theta."""
 
-        mesh.coordinates()[:,:] = \
-            numpy.dot(mesh.coordinates()[:,:], self.mat.T)
+        mesh.coordinates()[:, :] = \
+            numpy.dot(mesh.coordinates()[:, :], self.mat.T)
 
     def rotate_point(self, point):
         """Rotate point through phi then theta."""
 
         return numpy.dot(point, self.mat.T)
 
+
 def poisson_2d():
 
     # Create mesh and define function space
@@ -95,8 +98,8 @@ def poisson_2d():
     # Define variational problem
     u = TrialFunction(V)
     v = TestFunction(V)
-    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
-    g = Expression("sin(5*x[0])")
+    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
+    g = Expression("sin(5*x[0])", degree=2)
     a = inner(grad(u), grad(v))*dx
     L = f*v*dx + g*v*ds
 
@@ -111,9 +114,7 @@ def poisson_manifold():
 
     # Create mesh
     cubemesh = UnitCubeMesh(32, 32, 2)
-
     boundarymesh = BoundaryMesh(cubemesh, "exterior")
-
     mesh = SubMesh(boundarymesh, BottomEdge())
 
     rotation = Rotation(numpy.pi/4, numpy.pi/4)
@@ -134,11 +135,11 @@ def poisson_manifold():
     # Define variational problem
     u = TrialFunction(V)
     v = TestFunction(V)
-    f = Expression(("10*exp(-(pow(x[0] - %.17f, 2) "
-                    + " + pow(x[1] - %.17f, 2)"
-                    + " + pow(x[2] - %.17f, 2)) / 0.02)")\
-                       % tuple(rotation.rotate_point([0.5,0.5,0])))
-    g = Expression("sin(5*%s)"%rotation.x(0))
+    f = Expression(("10*exp(-(pow(x[0] - %.17f, 2)" +
+                    " + pow(x[1] - %.17f, 2)" +
+                    " + pow(x[2] - %.17f, 2)) / 0.02)")
+                   % tuple(rotation.rotate_point([0.5, 0.5, 0])), degree=2)
+    g = Expression("sin(5*%s)" % rotation.x(0), degree=2)
 
     a = inner(grad(u), grad(v))*dx
     L = f*v*dx + g*v*ds
@@ -154,11 +155,11 @@ def rotate_2d_mesh(theta):
     """Unit square mesh in 2D rotated through theta about the x and z
     axes."""
 
-    cubemesh = UnitCubeMesh(1,1,1)
+    cubemesh = UnitCubeMesh(1, 1, 1)
     boundarymesh = BoundaryMesh(cubemesh, "exterior")
     mesh = SubMesh(boundarymesh, BottomEdge())
 
-    mesh.init_cell_orientations(Expression(("0.","0.","1.")))
+    mesh.init_cell_orientations(Expression(("0.", "0.", "1."), degree=0))
 
     rotation = Rotation(theta, theta)
     rotation.rotate(mesh)
@@ -168,14 +169,17 @@ def rotate_2d_mesh(theta):
 
 @skip_in_parallel
 def test_poisson2D_in_3D():
-    """This test solves Poisson's equation on a unit square in 2D,
-    and then on a unit square embedded in 3D and rotated pi/4
-    radians about each of the z and x axes."""
+    """This test solves Poisson's equation on a unit square in 2D, and
+    then on a unit square embedded in 3D and rotated pi/4 radians
+    about each of the z and x axes.
+
+    """
 
     u_2D = poisson_2d()
     u_manifold = poisson_manifold()
 
-    assert round(u_2D.vector().norm("l2") - u_manifold.vector().norm("l2"), 10) == 0
+    assert round(u_2D.vector().norm("l2") - u_manifold.vector().norm("l2"),
+                 10) == 0
     assert round(u_2D.vector().max() - u_manifold.vector().max(), 10) == 0
     assert round(u_2D.vector().min() - u_manifold.vector().min(), 10) == 0
 
@@ -187,7 +191,7 @@ def test_basis_evaluation_2D_in_3D():
     unaffected by rotations."""
 
     basemesh = rotate_2d_mesh(0.0)
-    rotmesh  = rotate_2d_mesh(numpy.pi/4)
+    rotmesh = rotate_2d_mesh(numpy.pi/4)
     rotation = Rotation(numpy.pi/4, numpy.pi/4)
 
     for i in range(4):
@@ -206,7 +210,8 @@ def test_basis_evaluation_2D_in_3D():
 
 
 def basis_test(family, degree, basemesh, rotmesh, rotation, piola=False):
-    basis_derivatives = parameters["form_compiler"]["no-evaluate_basis_derivatives"]
+    ffc_option = "no-evaluate_basis_derivatives"
+    basis_derivatives = parameters["form_compiler"][ffc_option]
     parameters["form_compiler"]["no-evaluate_basis_derivatives"] = False
 
     f_base = FunctionSpace(basemesh, family, degree)
@@ -236,7 +241,8 @@ def basis_test(family, degree, basemesh, rotmesh, rotation, piola=False):
                                                 cell_base.orientation())
 
                 f_base.element().evaluate_basis_derivatives(i, 1, derivs_base,
-                                                            point, vertex_coordinates_base,
+                                                            point,
+                                                            vertex_coordinates_base,
                                                             cell_base.orientation())
 
                 f_rot.element().evaluate_basis(i, values_rot,
@@ -254,7 +260,8 @@ def basis_test(family, degree, basemesh, rotmesh, rotation, piola=False):
 
                     derivs_rot2 = derivs_rot.reshape(f_rot.element().value_dimension(0),3)
                     derivs_base2 = derivs_base.reshape(f_base.element().value_dimension(0),3)
-                    # If D is the unrotated derivative tensor, then RDR^T is the rotated version.
+                    # If D is the unrotated derivative tensor, then
+                    # RDR^T is the rotated version.
                     derivs_cmp = numpy.dot(rotation.mat,
                                             rotation.rotate_point(derivs_base2))
                 else:
@@ -268,11 +275,13 @@ def basis_test(family, degree, basemesh, rotmesh, rotation, piola=False):
 
     parameters["form_compiler"]["no-evaluate_basis_derivatives"] = basis_derivatives
 
+
 @use_gc_barrier
 def test_elliptic_eqn_on_intersecting_surface(datadir):
     """Solves -grad^2 u + u = f on domain of two intersecting square
      surfaces embedded in 3D with natural bcs. Test passes if at end
      \int u dx = \int f dx over whole domain
+
     """
     # This needs to be odd
     #num_vertices_side = 31
@@ -299,7 +308,7 @@ def test_elliptic_eqn_on_intersecting_surface(datadir):
                 value[0] = 0.0
 
     f = Function(V)
-    f.interpolate(Source())
+    f.interpolate(Source(degree=2))
 
     a = inner(grad(u), grad(v))*dx + u*v*dx
     L = f*v*dx
@@ -313,6 +322,7 @@ def test_elliptic_eqn_on_intersecting_surface(datadir):
     # test passes if f_tot = u_tot
     assert abs(f_tot - u_tot) < 1e-7
 
+
 def make_mesh(num_vertices_side):
     # each square has unit side length
     domain_size = 1.0
diff --git a/test/unit/python/fem/test_symbolic_geometry_assembly.py b/test/unit/python/fem/test_symbolic_geometry_assembly.py
new file mode 100755
index 0000000..315fc55
--- /dev/null
+++ b/test/unit/python/fem/test_symbolic_geometry_assembly.py
@@ -0,0 +1,873 @@
+#!/usr/bin/env py.test
+from dolfin import *
+import ufl
+import numpy
+import sys
+import pytest
+from dolfin_utils.test import set_parameters_fixture, skip_in_parallel
+
+from ufl.classes import CellOrientation, CellNormal, CellCoordinate, \
+CellOrigin, Jacobian, JacobianInverse, JacobianDeterminant
+
+# This was for debugging, don't enable this permanently here in tests
+# parameters["reorder_dofs_serial"] = False
+
+# Hack to skip uflacs parameter if not installed. There's probably a
+# cleaner way to do this with pytest.
+try:
+    import uflacs
+    _uflacs = ["uflacs"]
+except:
+    _uflacs = []
+any_representation = set_parameters_fixture("form_compiler.representation",
+                                            ["quadrature"] + _uflacs)
+uflacs_representation_only \
+    = set_parameters_fixture("form_compiler.representation",
+                             _uflacs)
+
+
+def create_mesh(vertices, cells, cellname="simplex"):
+    """Given list of vertex coordinate tuples and cell vertex index
+tuples, build and return a mesh.
+
+    """
+
+    # Get dimensions
+    gdim = len(vertices[0])
+
+    # Automatic choice of cellname for simplices
+    if cellname == "simplex":
+        num_cell_vertices = len(cells[0])
+        cellname = {1: "vertex",
+                    2: "interval",
+                    3: "triangle",
+                    4: "tetrahedron",
+                    }[num_cell_vertices]
+
+    # Indirect error checking and determination of tdim via ufl
+    ufl_cell = ufl.Cell(cellname, gdim)
+    tdim = ufl_cell.topological_dimension()
+
+    # Create mesh to return
+    mesh = Mesh()
+
+    # Open mesh in editor
+    me = MeshEditor()
+    me.open(mesh, cellname, tdim, gdim)
+
+    # Add vertices to mesh
+    me.init_vertices(len(vertices))
+    for i, v in enumerate(vertices):
+        me.add_vertex(i, *v)
+
+    # Add cells to mesh
+    me.init_cells(len(cells))
+    for i, c in enumerate(cells):
+        me.add_cell(i, *c)
+
+    me.close()
+
+    return mesh
+
+
+def create_line_mesh(vertices):
+    """Given list of vertex coordinate tuples, build and return a mesh of
+intervals.
+
+    """
+
+    # Get dimensions
+    gdim = len(vertices[0])
+    tdim = 1
+
+    # Automatic choice of cellname for simplices
+    cellname = "interval"
+
+    # Indirect error checking and determination of tdim via ufl
+    ufl_cell = ufl.Cell(cellname, gdim)
+    assert tdim == ufl_cell.topological_dimension()
+
+    # Create mesh to return
+    mesh = Mesh()
+
+    # Open mesh in editor
+    me = MeshEditor()
+    me.open(mesh, cellname, tdim, gdim)
+
+    # Add vertices to mesh
+    nv = len(vertices)
+    me.init_vertices(nv)
+
+    for i, v in enumerate(vertices):
+        me.add_vertex(i, *v)
+
+    # TODO: Systematically swap around vertex ordering to test cell orientation
+
+    # Add cells to mesh
+    me.init_cells(nv-1)
+    for i in range(nv-1):
+        c = (i, i+1)
+        me.add_cell(i, *c)
+
+    me.close()
+
+    return mesh
+
+line_resolution = 8
+
+
+ at pytest.fixture
+def line1d(request):
+    n = line_resolution
+    us = [i/float(n-1) for i in range(n)]
+    vertices = [(u**2,) for u in us]
+    return create_line_mesh(vertices)
+
+
+ at pytest.fixture
+def rline1d(request):
+    n = line_resolution
+    us = [i/float(n-1) for i in range(n)]
+    vertices = [(u**2,) for u in us]
+    vertices = list(reversed(vertices))  # same as line1d, just reversed here
+    return create_line_mesh(vertices)
+
+
+ at pytest.fixture
+def line2d(request):
+    n = line_resolution
+    us = [i/float(n-1) for i in range(n)]
+    vertices = [(cos(DOLFIN_PI*u), sin(DOLFIN_PI*u)) for u in us]
+    mesh = create_line_mesh(vertices)
+    mesh.init_cell_orientations(Expression(("0.0", "1.0"), degree=0))
+    return mesh
+
+
+ at pytest.fixture
+def rline2d(request):
+    n = line_resolution
+    us = [i/float(n-1) for i in range(n)]
+    vertices = [(cos(DOLFIN_PI*u), sin(DOLFIN_PI*u)) for u in us]
+    vertices = list(reversed(vertices))  # same as line2d, just reversed here
+    mesh = create_line_mesh(vertices)
+    mesh.init_cell_orientations(Expression(("0.0", "1.0"), degree=0))
+    return mesh
+
+
+ at pytest.fixture
+def line3d(request):
+    n = line_resolution
+    us = [i/float(n-1) for i in range(n)]
+    vertices = [(cos(4.0*DOLFIN_PI*u),
+                 sin(4.0*DOLFIN_PI*u),
+                 2.0*u) for u in us]
+    mesh = create_line_mesh(vertices)
+    return mesh
+
+
+ at pytest.fixture
+def rline3d(request):
+    n = line_resolution
+    us = [i/float(n-1) for i in range(n)]
+    vertices = [(cos(4.0*DOLFIN_PI*u),
+                 sin(4.0*DOLFIN_PI*u),
+                 2.0*u) for u in us]
+    vertices = list(reversed(vertices))  # same as line3d, just reversed here
+    mesh = create_line_mesh(vertices)
+    return mesh
+
+
+ at pytest.fixture
+def square2d(request):
+    cellname = "triangle"
+    side = sqrt(sqrt(3.0))
+    vertices = [
+        (0.0, 0.0),
+        (side, side),
+        (side, 0.0),
+        (0.0, side),
+        ]
+    cells = [
+        (0, 1, 2),
+        (0, 1, 3),
+        ]
+    mesh = create_mesh(vertices, cells)
+    return mesh
+
+
+ at pytest.fixture
+def square3d(request):
+    cellname = "triangle"
+    vertices = [
+        (0.0, 0.0, 1.0),
+        (1.0, 1.0, 1.0),
+        (1.0, 0.0, 0.0),
+        (0.0, 1.0, 0.0),
+        ]
+    cells = [
+        (0, 1, 2),
+        (0, 1, 3),
+        ]
+    mesh = create_mesh(vertices, cells)
+    mesh.init_cell_orientations(Expression(("0.0", "0.0", "1.0"), degree=0))
+
+    return mesh
+
+
+ at skip_in_parallel
+def test_line_meshes(line1d, line2d, line3d, rline1d, rline2d, rline3d):
+    "Check some properties of the meshes created for these tests."
+    assert line1d.geometry().dim() == 1
+    assert line2d.geometry().dim() == 2
+    assert line3d.geometry().dim() == 3
+    assert line1d.topology().dim() == 1
+    assert line2d.topology().dim() == 1
+    assert line3d.topology().dim() == 1
+
+
+ at skip_in_parallel
+def test_write_line_meshes_to_files(line1d, line2d, line3d, rline1d, rline2d,
+                                    rline3d, uflacs_representation_only):
+    # Enable to write meshes to file for inspection (plot doesn't work
+    # for 1d in 2d/3d)
+    # CellNormal is only supported by uflacs
+    if 0:
+        File("line1d.xdmf") << line1d
+        File("line2d.xdmf") << line2d
+        File("line3d.xdmf") << line3d
+        File("rline1d.xdmf") << rline1d
+        File("rline2d.xdmf") << rline2d
+        File("rline3d.xdmf") << rline3d
+        File("line2dnormal.xdmf") << project(CellNormal(line2d),
+                                             VectorFunctionSpace(line2d,
+                                                                 "DG", 0))
+        File("rline2dnormal.xdmf") << project(CellNormal(rline2d),
+                                              VectorFunctionSpace(rline2d,
+                                                                  "DG", 0))
+
+
+ at skip_in_parallel
+ at pytest.mark.parametrize("mesh", [
+    line1d(None),
+    line2d(None),
+    line3d(None),
+    rline1d(None),
+    rline2d(None),
+    rline3d(None), ])
+def test_manifold_line_geometry(mesh, uflacs_representation_only):
+    assert uflacs_representation_only == "uflacs"
+    assert parameters["form_compiler"]["representation"] == "uflacs"
+
+    # Create cell markers and integration measure
+    mf = CellFunction("size_t", mesh)
+    for i in range(mesh.num_cells()):
+        mf[i] = i
+    dx = Measure("dx", domain=mesh, subdomain_data=mf)
+    coords = mesh.coordinates()
+    cells = mesh.cells()
+
+    # Create symbolic geometry for current mesh
+    x = SpatialCoordinate(mesh)
+    X = CellCoordinate(mesh)
+    co = CellOrientation(mesh)
+    cn = CellNormal(mesh)
+    J = Jacobian(mesh)
+    detJ = JacobianDeterminant(mesh)
+    K = JacobianInverse(mesh)
+    vol = CellVolume(mesh)
+
+    # Check that length computed via integral doesn't change with
+    # refinement
+    length = assemble(1.0*dx)
+    mesh2 = refine(mesh)
+    assert mesh2.num_cells() == 2*mesh.num_cells()
+    dx2 = Measure("dx")
+    length2 = assemble(1.0*dx2(mesh2))
+    assert round(length - length2, 7) == 0.0
+
+    # Check that number of cells can be computed correctly by scaling
+    # integral by |detJ|^-1
+    num_cells = assemble(1.0/abs(detJ)*dx)
+    assert round(num_cells - mesh.num_cells(), 7) == 0.0
+
+    # Check that norm of Jacobian column matches detJ and volume
+    assert round(length - assemble(sqrt(J[:, 0]**2)/abs(detJ)*dx), 7) == 0.0
+    assert round(assemble((vol-abs(detJ))*dx), 7) == 0.0
+    assert round(length - assemble(vol/abs(detJ)*dx), 7) == 0.0
+
+    gdim, tdim = J.ufl_shape
+
+    # Checks on each cell separately
+    for i in range(mesh.num_cells()):
+        mf[i] = 0
+    for i in range(mesh.num_cells()):
+        mf[i] = 1  # mark this cell
+        x0 = Constant(tuple(coords[cells[i][0], :]))
+
+        # Integrate x components over a cell and compare with midpoint
+        # computed from coords
+        for j in range(gdim):
+            xm = 0.5*(coords[cells[i][0], j] + coords[cells[i][1], j])
+            assert round(assemble(x[j]/abs(detJ)*dx(1)) - xm, 7) == 0.0
+
+        # Jacobian column is pointing away from x0
+        assert assemble(dot(J[:, 0], x-x0)*dx(1)) > 0.0
+
+        # Check affine coordinate relations x=x0+J*X, X=K*(x-x0), K*J=I
+        assert round(assemble((x - (x0+J*X))**2*dx(1)), 7) == 0.0
+        assert round(assemble((X - K*(x-x0))**2*dx(1)), 7) == 0.0
+        assert round(assemble((K*J - Identity(tdim))**2*dx(1)), 7) == 0.0
+
+        # Jacobian column is orthogonal to cell normal
+        if gdim == 2:
+            assert round(assemble(dot(J[:, 0], cn)*dx(1)), 7) == 0.0
+
+            # Create 3d tangent and cell normal vectors
+            tangent = as_vector((J[0, 0], J[1, 0], 0.0))
+            tangent = co * tangent / sqrt(tangent**2)
+            normal = as_vector((cn[0], cn[1], 0.0))
+            up = cross(tangent, normal)
+
+            # Check that t,n,up are orthogonal
+            assert round(assemble(dot(tangent, normal)*dx(1)), 7) == 0.0
+            assert round(assemble(dot(tangent, up)*dx(1)), 7) == 0.0
+            assert round(assemble(dot(normal, up)*dx(1)), 7) == 0.0
+            assert round(assemble((cross(up, tangent) - normal)**2*dx(1)),
+                         7) == 0.0
+
+            assert round(assemble(up**2*dx(1)), 7) > 0.0
+            assert round(assemble((up[0]**2 + up[1]**2)*dx(1)), 7) == 0.0
+            assert round(assemble(up[2]*dx(1)), 7) > 0.0
+        mf[i] = 0  # unmark this cell
+
+
+ at skip_in_parallel
+def test_manifold_area(square3d, any_representation):
+    """Integrate literal expressions over manifold cells, no function
+spaces involved."""
+    mesh = square3d
+    area = sqrt(3.0)  # known area of mesh
+
+    # Assembling mesh area scaled by a literal
+    assert round(assemble(0.0*dx(mesh)) - 0.0*area, 7) == 0.0
+    assert round(assemble(1.0*dx(mesh)) - 1.0*area, 7) == 0.0
+    assert round(assemble(3.0*dx(mesh)) - 3.0*area, 7) == 0.0
+
+
+ at skip_in_parallel
+def test_manifold_dg0_functions(square3d, any_representation):
+    mesh = square3d
+    area = sqrt(3.0)  # known area of mesh
+
+    mf = CellFunction("size_t", mesh)
+    mf[0] = 0
+    mf[1] = 1
+    dx = Measure("dx", domain=mesh, subdomain_data=mf)
+
+    x = SpatialCoordinate(mesh)
+
+    U0 = FunctionSpace(mesh, "DG", 0)
+    V0 = VectorFunctionSpace(mesh, "DG", 0)
+
+    # Project constants to scalar and vector DG0 spaces on manifold
+    u0 = project(1.0, U0)
+    v0v = (1.0, 2.0, 3.0)
+    v0 = project(as_vector(v0v), V0)
+    assert round(sum(u0.vector().array()) - 2*1, 7) == 0.0
+    assert round(sum(v0.vector().array()) - 2*(1+2+3), 7) == 0.0
+
+    # Integrate piecewise constant functions over manifold cells
+    assert round(assemble(u0*dx(0)) - 0.5*area) == 0.0
+    assert round(assemble(u0*dx(1)) - 0.5*area) == 0.0
+    assert round(assemble(u0*dx) - area) == 0.0
+    assert round(assemble(v0[0]*dx) - v0v[0]*area) == 0.0
+    assert round(assemble(v0[1]*dx) - v0v[1]*area) == 0.0
+    assert round(assemble(v0[2]*dx) - v0v[2]*area) == 0.0
+
+    # Project x to scalar and vector DG0 spaces on manifold
+    u0x = project(x[0], U0)  # cell averages of x[0]: 2/3, 1/3, sum = 3/3
+    v0x = project(x, V0)  # cell averages of x[:]: (2/3, 1/3, 2/3), (1/3, 2/3, 2/3), sum = 10/3
+    assert round(sum(u0x.vector().array()) - 3.0/3.0, 7) == 0.0
+    assert round(sum(v0x.vector().array()) - 10.0/3.0, 7) == 0.0
+
+    # Evaluate in all corners and cell midpoints, value should be the
+    # same constant everywhere
+    points = [
+        (0.0, 0.0, 1.0),
+        (1.0, 1.0, 1.0),
+        (1.0, 0.0, 0.0),
+        (0.0, 1.0, 0.0),
+        (1.0/3.0, 2.0/3.0, 2.0/3.0),
+        (2.0/3.0, 1.0/3.0, 2.0/3.0),
+        ]
+    for point in points:
+        assert round(sum((v0(point) - numpy.asarray(v0v))**2), 7) == 0.0
+
+
+ at skip_in_parallel
+def test_manifold_cg1_functions(square3d, any_representation):
+    mesh = square3d
+    area = sqrt(3.0)  # known area of mesh
+
+    mf = CellFunction("size_t", mesh)
+    mf[0] = 0
+    mf[1] = 1
+    dx = Measure("dx", domain=mesh, subdomain_data=mf)
+
+    # We need unit testing of some symbolic quantities to pinpoint any
+    # sign problems etc. in the right places
+    x = SpatialCoordinate(mesh)
+
+    U1 = FunctionSpace(mesh, "CG", 1)
+    V1 = VectorFunctionSpace(mesh, "CG", 1)
+
+    # Project piecewise linears to scalar and vector CG1 spaces on
+    # manifold
+    u1 = project(x[0], U1)
+    v1 = project(x, V1)
+    # exact x in vertices is [0,0,0, 1,1,1, 1,0,0, 0,1,0],
+    # so sum(x[0] for each vertex) is therefore sum(0 1 1 0):
+    assert round(sum(u1.vector().array()) - (0+1+1+0), 7) == 0.0
+    # and sum(x components for each vertex) is sum(1, 3, 1, 1):
+    assert round(sum(v1.vector().array()) - (1+3+1+1), 7) == 0.0
+
+    # Integrate piecewise constant functions over manifold cells,
+    # computing midpoint coordinates
+    midpoints = [
+        (1.0/3.0, 2.0/3.0, 2.0/3.0),
+        (2.0/3.0, 1.0/3.0, 2.0/3.0),
+        ]
+    mp = midpoints
+    assert round(assemble(u1*dx(0)) - mp[0][0]) == 0.0
+    assert round(assemble(u1*dx(1)) - mp[1][0]) == 0.0
+    assert round(assemble(v1[0]*dx(0)) - mp[0][0]) == 0.0
+    assert round(assemble(v1[1]*dx(0)) - mp[0][1]) == 0.0
+    assert round(assemble(v1[2]*dx(0)) - mp[0][2]) == 0.0
+    assert round(assemble(v1[0]*dx(1)) - mp[1][0]) == 0.0
+    assert round(assemble(v1[1]*dx(1)) - mp[1][1]) == 0.0
+    assert round(assemble(v1[2]*dx(1)) - mp[1][2]) == 0.0
+
+
+ at skip_in_parallel
+def test_manifold_coordinate_projection(square3d, any_representation):
+    mesh = square3d
+
+    # Project x to a CG1 Function, i.e. setting up for v1(x) = x
+    V1 = VectorFunctionSpace(mesh, "CG", 1)
+    x = SpatialCoordinate(mesh)
+    v1 = project(x, V1)
+
+    # Check that v1(x) = x holds component-wise in squared l2 norm
+    assert round(assemble((v1-x)**2*dx), 7) == 0.0
+    assert round(assemble((v1[0]-x[0])**2*dx), 7) == 0.0
+    assert round(assemble((v1[1]-x[1])**2*dx), 7) == 0.0
+    assert round(assemble((v1[2]-x[2])**2*dx), 7) == 0.0
+    assert round(assemble((v1[0]-x[0])**2*dx(0)), 7) == 0.0
+    assert round(assemble((v1[1]-x[1])**2*dx(0)), 7) == 0.0
+    assert round(assemble((v1[2]-x[2])**2*dx(0)), 7) == 0.0
+    assert round(assemble((v1[0]-x[0])**2*dx(1)), 7) == 0.0
+    assert round(assemble((v1[1]-x[1])**2*dx(1)), 7) == 0.0
+    assert round(assemble((v1[2]-x[2])**2*dx(1)), 7) == 0.0
+
+
+ at skip_in_parallel
+def test_manifold_point_evaluation(square3d, any_representation):
+    mesh = square3d
+
+    # Project x to a CG1 Function, i.e. setting up for v1(x) = x
+    V1 = VectorFunctionSpace(mesh, "CG", 1)
+    x = SpatialCoordinate(mesh)
+    v1 = project(x, V1)
+
+    # Evaluate in all corners and cell midpoints,
+    # value should equal the evaluation coordinate
+    # Because bounding box tree doesn't handle manifolds,
+    # we have to specify which cell each point is in.
+    points = [[
+        (0.0, 0.0, 1.0),  # vertex of both cells
+        (1.0, 1.0, 1.0),  # vertex of both cells
+        (1.0, 0.0, 0.0),  # vertex of cell 0 only
+        (2.0/3.0, 1.0/3.0, 2.0/3.0),  # midpoint of cell 0
+        ], [
+        (0.0, 0.0, 1.0),  # vertex of both cells
+        (1.0, 1.0, 1.0),  # vertex of both cells
+        (0.0, 1.0, 0.0),  # vertex of cell 1 only
+        (1.0/3.0, 2.0/3.0, 2.0/3.0),  # midpoint of cell 1
+        ]]
+    values = numpy.zeros(3)
+    bb = mesh.bounding_box_tree()
+    for cellid in (0, 1):
+        for point in points[cellid]:
+            v1.eval_cell(values, numpy.asarray(point), Cell(mesh, cellid))
+            assert round(values[0] - point[0], 7) == 0.0  # expecting v1(x) = x
+            assert round(values[1] - point[1], 7) == 0.0  # expecting v1(x) = x
+            assert round(values[2] - point[2], 7) == 0.0  # expecting v1(x) = x
+            # print cellid, [round(v,2) for v in point],
+            # [round(v,2) for v in values]
+
+
+# Some symbolic quantities are only available through uflacs
+ at skip_in_parallel
+def test_manifold_symbolic_geometry(square3d, uflacs_representation_only):
+    mesh = square3d
+    area = sqrt(3.0)  # known area of mesh
+    A = area/2.0  # area of single cell
+    Aref = 0.5  # 0.5 is the area of the UFC reference triangle
+
+    mf = CellFunction("size_t", mesh)
+    mf[0] = 0
+    mf[1] = 1
+    dx = Measure("dx", domain=mesh, subdomain_data=mf)
+
+    U0 = FunctionSpace(mesh, "DG", 0)
+    V0 = VectorFunctionSpace(mesh, "DG", 0)
+
+    # 0 means up=+1.0, 1 means down=-1.0
+    orientations = mesh.cell_orientations()
+    assert orientations[0] == 1  # down
+    assert orientations[1] == 0  # up
+
+    # Check cell orientation, should be -1.0 (down) and +1.0 (up) on
+    # the two cells respectively by construction
+    co = CellOrientation(mesh)
+    co0 = assemble(co/A*dx(0))
+    co1 = assemble(co/A*dx(1))
+    assert round(abs(co0) - 1.0, 7) == 0.0  # should be +1 or -1
+    assert round(abs(co1) - 1.0, 7) == 0.0  # should be +1 or -1
+    assert round(co1 + co0, 7) == 0.0  # should cancel out
+    assert round(co0 - -1.0, 7) == 0.0  # down
+    assert round(co1 - +1.0, 7) == 0.0  # up
+
+    # Check cell normal directions component for component
+    cn = CellNormal(mesh)
+    assert assemble(cn[0]/A*dx(0)) > 0.0
+    assert assemble(cn[0]/A*dx(1)) < 0.0
+    assert assemble(cn[1]/A*dx(0)) < 0.0
+    assert assemble(cn[1]/A*dx(1)) > 0.0
+    assert assemble(cn[2]/A*dx(0)) > 0.0
+    assert assemble(cn[2]/A*dx(1)) > 0.0
+    # Check cell normal normalization
+    assert round(assemble(cn**2/A*dx(0)) - 1.0, 7) == 0.0
+    assert round(assemble(cn**2/A*dx(1)) - 1.0, 7) == 0.0
+
+    # Check coordinates with various consistency checking
+    x = SpatialCoordinate(mesh)
+    X = CellCoordinate(mesh)
+    J = Jacobian(mesh)
+    detJ = JacobianDeterminant(mesh)  # pseudo-determinant
+    K = JacobianInverse(mesh)  # pseudo-inverse
+    vol = CellVolume(mesh)
+
+    # This is not currently implemented in uflacs:
+    # x0 = CellOrigin(mesh)
+    # But by happy accident, x0 is the same vertex for both our triangles:
+    x0 = as_vector((0.0, 0.0, 1.0))
+
+    # Check integration area vs detJ
+    for k in range(2):
+        # Validate known cell area A
+        assert round(assemble(1.0*dx(k)) - A, 7) == 0.0
+        assert round(assemble(1.0/A*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A*dx(k)) - A**2, 7) == 0.0
+        # Compare abs(detJ) to A
+        A2 = Aref*abs(detJ)
+        assert round(assemble((A-A2)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble(1.0/A2*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A2*dx(k)) - A**2, 7) == 0.0
+        # Validate cell orientation
+        assert round(assemble(co*dx(k)) - A*(1 if k == 1 else -1), 7) == 0.0
+        # Compare co*detJ to A (detJ is pseudo-determinant with sign
+        # restored, *co again is equivalent to abs())
+        A3 = Aref*co*detJ
+        assert round(assemble((A-A3)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble((A2-A3)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble(1.0/A3*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A3*dx(k)) - A**2, 7) == 0.0
+        # Compare vol to A
+        A4 = vol
+        assert round(assemble((A-A4)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble((A2-A4)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble((A3-A4)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble(1.0/A4*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A4*dx(k)) - A**2, 7) == 0.0
+
+    # Check integral of reference coordinate components over reference
+    # triangle: \int_0^1 \int_0^{1-x} x dy dx = 1/6
+    Xmp = (1.0/6.0, 1.0/6.0)
+    for k in range(2):
+        for j in range(2):
+            # Scale by detJ^-1 to get reference cell integral
+            assert round(assemble(X[j]/abs(detJ)*dx(k)) - Xmp[j], 7) == 0.0
+
+    # Check average of physical coordinate components over each cell:
+    xmp = [(2.0/3.0, 1.0/3.0, 2.0/3.0),  # midpoint of cell 0
+           (1.0/3.0, 2.0/3.0, 2.0/3.0),  # midpoint of cell 1
+           ]
+    for k in range(2):
+        for i in range(3):
+            # Scale by A^-1 to get average of x, not integral
+            assert round(assemble(x[i]/A*dx(k)) - xmp[k][i], 7) == 0.0
+
+    # Check affine coordinate relations x=x0+J*X, X=K*(x-x0), K*J=I
+    assert round(assemble((x - (x0+J*X))**2*dx), 7) == 0.0
+    assert round(assemble((X - K*(x-x0))**2*dx), 7) == 0.0
+    assert round(assemble((K*J - Identity(2))**2/A*dx), 7) == 0.0
+
+
+ at skip_in_parallel
+def test_manifold_piola_mapped_functions(square3d, any_representation):
+    mesh = square3d
+    area = sqrt(3.0)  # known area of mesh
+    A = area/2.0
+
+    mf = CellFunction("size_t", mesh)
+    mf[0] = 0
+    mf[1] = 1
+    dx = Measure("dx", domain=mesh, subdomain_data=mf)
+
+    x = SpatialCoordinate(mesh)
+
+    J = Jacobian(mesh)
+    detJ = JacobianDeterminant(mesh)  # pseudo-determinant
+    K = JacobianInverse(mesh)  # pseudo-inverse
+
+    Q1 = VectorFunctionSpace(mesh, "CG", 1)
+    U1 = VectorFunctionSpace(mesh, "DG", 1)
+    V1 = FunctionSpace(mesh, "N1div", 1)
+    W1 = FunctionSpace(mesh, "N1curl", 1)
+
+    dq = TestFunction(Q1)
+    du = TestFunction(U1)
+    dv = TestFunction(V1)
+    dw = TestFunction(W1)
+
+    assert U1.ufl_element().mapping() == "identity"
+    assert V1.ufl_element().mapping() == "contravariant Piola"
+    assert W1.ufl_element().mapping() == "covariant Piola"
+
+    if any_representation != "uflacs":
+        return
+
+    # Check that projection test fails if it should fail:
+    vec = Constant((0.0, 0.0, 0.0))
+    q1 = project(vec, Q1)
+    u1 = project(vec, U1)
+    v1 = project(vec, V1)
+    w1 = project(vec, W1)
+    # Projection of zero gets us zero for all spaces
+    assert assemble(q1**2*dx) == 0.0
+    assert assemble(u1**2*dx) == 0.0
+    assert assemble(v1**2*dx) == 0.0
+    assert assemble(w1**2*dx) == 0.0
+    # Changing vec to nonzero, check that dM/df != 0 at f=0
+    vec = Constant((2.0, 2.0, 2.0))
+    assert round(assemble(derivative((q1-vec)**2*dx, q1)).norm('l2') -
+                 assemble(-4.0*sum(dq)*dx).norm('l2'), 7) == 0.0
+    assert round(assemble(derivative((u1-vec)**2*dx, u1)).norm('l2') -
+                 assemble(-4.0*sum(du)*dx).norm('l2'), 7) == 0.0
+    assert round(assemble(derivative((v1-vec)**2*dx, v1)).norm('l2') -
+                 assemble(-4.0*sum(dv)*dx).norm('l2'), 7) == 0.0
+    assert round(assemble(derivative((w1-vec)**2*dx, w1)).norm('l2') -
+                 assemble(-4.0*sum(dw)*dx).norm('l2'), 7) == 0.0
+
+    # Project piecewise linears to scalar and vector CG1 spaces on
+    # manifold
+    vec = Constant((1.0, 1.0, 1.0))
+    q1 = project(vec, Q1)
+    u1 = project(vec, U1)
+    v1 = project(vec, V1)
+    w1 = project(vec, W1)
+
+    # If vec can be represented exactly in space this should be zero:
+    assert round(assemble((q1-vec)**2*dx), 7) == 0.0
+    assert round(assemble((u1-vec)**2*dx), 7) == 0.0
+    assert round(assemble((v1-vec)**2*dx), 7) > 0.0  # Exact representation not possible?
+    assert round(assemble((w1-vec)**2*dx), 7) > 0.0  # Exact representation not possible?
+
+    # In the l2norm projection is correct these should be zero:
+    assert round(assemble(derivative((q1-vec)**2*dx, v1)).norm('l2'), 7) == 0.0
+    assert round(assemble(derivative((u1-vec)**2*dx, w1)).norm('l2'), 7) == 0.0
+    assert round(assemble(derivative((v1-vec)**2*dx, v1)).norm('l2'), 7) == 0.0
+    assert round(assemble(derivative((w1-vec)**2*dx, w1)).norm('l2'), 7) == 0.0
+
+    # Hdiv mapping of a local constant vector should be representable
+    # in hdiv conforming space
+    vec = (1.0/detJ)*J*as_vector((3.0, 5.0))
+    q1 = project(vec, Q1)
+    u1 = project(vec, U1)
+    v1 = project(vec, V1)
+    w1 = project(vec, W1)
+    assert round(assemble((q1-vec)**2*dx), 7) > 0.0  # Exact representation not possible?
+    assert round(assemble((u1-vec)**2*dx), 7) == 0.0
+    assert round(assemble((v1-vec)**2*dx), 7) == 0.0
+    assert round(assemble((w1-vec)**2*dx), 7) > 0.0  # Exact representation not possible?
+
+    # Hcurl mapping of a local constant vector should be representable
+    # in hcurl conforming space
+    vec = K.T*as_vector((5.0, 2.0))
+    q1 = project(vec, Q1)
+    u1 = project(vec, U1)
+    v1 = project(vec, V1)
+    w1 = project(vec, W1)
+    assert round(assemble((q1-vec)**2*dx), 7) > 0.0  # Exact representation not possible?
+    assert round(assemble((u1-vec)**2*dx), 7) == 0.0
+    assert round(assemble((v1-vec)**2*dx), 7) > 0.0  # Exact representation not possible?
+    assert round(assemble((w1-vec)**2*dx), 7) == 0.0
+
+
+# Some symbolic quantities are only available through uflacs
+ at skip_in_parallel
+def test_tetrahedron_symbolic_geometry(uflacs_representation_only):
+    mesh = UnitCubeMesh(1, 1, 1)
+    assert mesh.num_cells() == 6
+    gdim = mesh.geometry().dim()
+    tdim = mesh.topology().dim()
+
+    area = 1.0  # known volume of mesh
+    A = area/6.0  # volume of single cell
+    Aref = 1.0/6.0  # the volume of the UFC reference tetrahedron
+
+    mf = CellFunction("size_t", mesh)
+    for i in range(mesh.num_cells()):
+        mf[i] = i
+    dx = Measure("dx", domain=mesh, subdomain_data=mf)
+
+    U0 = FunctionSpace(mesh, "DG", 0)
+    V0 = VectorFunctionSpace(mesh, "DG", 0)
+    U1 = FunctionSpace(mesh, "DG", 1)
+    V1 = VectorFunctionSpace(mesh, "DG", 1)
+
+    # Check coordinates with various consistency checking
+    x = SpatialCoordinate(mesh)
+    X = CellCoordinate(mesh)
+    J = Jacobian(mesh)
+    detJ = JacobianDeterminant(mesh)
+    K = JacobianInverse(mesh)
+    vol = CellVolume(mesh)
+
+    # Check integration area vs detJ
+    coordinates = mesh.coordinates()
+    cells = mesh.cells()
+    for k in range(mesh.num_cells()):
+        # This is not currently implemented in uflacs:
+        # x0 = CellOrigin(mesh)
+        # But we can extract it from the mesh for a given cell k
+        x0 = as_vector(coordinates[cells[k][0]][:])
+        # Validate known cell volume A
+        assert round(assemble(1.0*dx(k)) - A, 7) == 0.0
+        assert round(assemble(1.0/A*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A*dx(k)) - A**2, 7) == 0.0
+        # Compare abs(detJ) to A
+        A2 = Aref*abs(detJ)
+        assert round(assemble((A-A2)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble(1.0/A2*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A2*dx(k)) - A**2, 7) == 0.0
+        # Compare vol to A
+        A4 = vol
+        assert round(assemble((A-A4)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble((A2-A4)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble(1.0/A4*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A4*dx(k)) - A**2, 7) == 0.0
+
+    # Check integral of reference coordinate components over reference
+    # tetrahedron:
+    Xmp = (1.0/24.0, 1.0/24.0, 1.0/24.0)  # not validated analytically
+    for k in range(mesh.num_cells()):
+        for j in range(tdim):
+            # Scale by detJ^-1 to get reference cell integral
+            assert round(assemble(X[j]/abs(detJ)*dx(k)) - Xmp[j], 7) == 0.0
+
+    # Check average of physical coordinate components over each cell:
+    for k in range(mesh.num_cells()):
+        # Compute average of vertex coordinates extracted from mesh
+        verts = [coordinates[i][:] for i in cells[k]]
+        vavg = sum(verts[1:], verts[0])/len(verts)
+        for i in range(gdim):
+            # Scale by A^-1 to get average of x, not integral
+            assert round(assemble(x[i]/A*dx(k)) - vavg[i], 7) == 0.0
+
+    # Check affine coordinate relations x=x0+J*X, X=K*(x-x0), K*J=I
+    for k in range(mesh.num_cells()):
+        x0 = as_vector(coordinates[cells[k][0]][:])
+        assert round(assemble((x - (x0+J*X))**2*dx(k)), 7) == 0.0
+        assert round(assemble((X - K*(x-x0))**2*dx(k)), 7) == 0.0
+        assert round(assemble((K*J - Identity(tdim))**2/A*dx(k)), 7) == 0.0
+
+
+# Some symbolic quantities are only available through uflacs
+ at skip_in_parallel
+def test_triangle_symbolic_geometry(uflacs_representation_only):
+    mesh = UnitSquareMesh(1, 1)
+    assert mesh.num_cells() == 2
+    gdim = mesh.geometry().dim()
+    tdim = mesh.topology().dim()
+
+    area = 1.0  # known volume of mesh
+    A = area/2.0  # volume of single cell
+    Aref = 1.0/2.0  # the volume of the UFC reference triangle
+
+    mf = CellFunction("size_t", mesh)
+    for i in range(mesh.num_cells()):
+        mf[i] = i
+    dx = Measure("dx", domain=mesh, subdomain_data=mf)
+
+    U0 = FunctionSpace(mesh, "DG", 0)
+    V0 = VectorFunctionSpace(mesh, "DG", 0)
+    U1 = FunctionSpace(mesh, "DG", 1)
+    V1 = VectorFunctionSpace(mesh, "DG", 1)
+
+    # Check coordinates with various consistency checking
+    x = SpatialCoordinate(mesh)
+    X = CellCoordinate(mesh)
+    J = Jacobian(mesh)
+    detJ = JacobianDeterminant(mesh)
+    K = JacobianInverse(mesh)
+    vol = CellVolume(mesh)
+
+    # Check integration area vs detJ
+    coordinates = mesh.coordinates()
+    cells = mesh.cells()
+    for k in range(mesh.num_cells()):
+        # This is not currently implemented in uflacs:
+        # x0 = CellOrigin(mesh)
+        # But we can extract it from the mesh for a given cell k
+        x0 = as_vector(coordinates[cells[k][0]][:])
+        # Validate known cell volume A
+        assert round(assemble(1.0*dx(k)) - A, 7) == 0.0
+        assert round(assemble(1.0/A*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A*dx(k)) - A**2, 7) == 0.0
+        # Compare abs(detJ) to A
+        A2 = Aref*abs(detJ)
+        assert round(assemble((A-A2)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble(1.0/A2*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A2*dx(k)) - A**2, 7) == 0.0
+        # Compare vol to A
+        A4 = vol
+        assert round(assemble((A-A4)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble((A2-A4)**2*dx(k)) - 0.0, 7) == 0.0
+        assert round(assemble(1.0/A4*dx(k)) - 1.0, 7) == 0.0
+        assert round(assemble(A4*dx(k)) - A**2, 7) == 0.0
+
+    # Check integral of reference coordinate components over reference
+    # triangle:
+    Xmp = (1.0/6.0, 1.0/6.0)
+    for k in range(mesh.num_cells()):
+        for j in range(tdim):
+            # Scale by detJ^-1 to get reference cell integral
+            assert round(assemble(X[j]/abs(detJ)*dx(k)) - Xmp[j], 7) == 0.0
+
+    # Check average of physical coordinate components over each cell:
+    for k in range(mesh.num_cells()):
+        # Compute average of vertex coordinates extracted from mesh
+        verts = [coordinates[i][:] for i in cells[k]]
+        vavg = sum(verts[1:], verts[0])/len(verts)
+        for i in range(gdim):
+            # Scale by A^-1 to get average of x, not integral
+            assert round(assemble(x[i]/A*dx(k)) - vavg[i], 7) == 0.0
+
+    # Check affine coordinate relations x=x0+J*X, X=K*(x-x0), K*J=I
+    for k in range(mesh.num_cells()):
+        x0 = as_vector(coordinates[cells[k][0]][:])
+        assert round(assemble((x - (x0+J*X))**2*dx(k)), 7) == 0.0
+        assert round(assemble((X - K*(x-x0))**2*dx(k)), 7) == 0.0
+        assert round(assemble((K*J - Identity(tdim))**2/A*dx(k)), 7) == 0.0
diff --git a/test/unit/python/fem/test_system_assembler.py b/test/unit/python/fem/test_system_assembler.py
index ae9c6a5..50428bd 100755
--- a/test/unit/python/fem/test_system_assembler.py
+++ b/test/unit/python/fem/test_system_assembler.py
@@ -85,7 +85,7 @@ def test_cell_assembly_bc():
     L = inner(f, v)*dx
 
     A_frobenius_norm = 96.847818767384
-    b_l2_norm =  96.564760289080
+    b_l2_norm = 96.564760289080
 
     # Assemble system
     A, b = assemble_system(a, L, bc)
@@ -200,7 +200,7 @@ def test_vertex_assembly():
     center_domain = VertexFunction("size_t", mesh, 0)
     center = AutoSubDomain(center_func)
     center.mark(center_domain, 1)
-    dPP = dP[center_domain]
+    dPP = dP(subdomain_data=center_domain)
 
     # Define variational problem
     u = TrialFunction(V)
@@ -222,7 +222,7 @@ def test_incremental_assembly():
         V = FunctionSpace(mesh, 'CG', 1)
         u, v = TrialFunction(V), TestFunction(V)
         a, L = inner(grad(u), grad(v))*dx, f*v*dx
-        uD = Expression("42.0*(2.0*x[0]-1.0)")
+        uD = Expression("42.0*(2.0*x[0]-1.0)", degree=1)
         bc = DirichletBC(V, uD, "on_boundary")
 
         # Initialize initial guess by some number
@@ -365,3 +365,72 @@ def test_facet_assembly_cellwise_insertion(filedir):
     # Run tests
     run_test(UnitIntervalMesh(10))
     run_test(Mesh(os.path.join(filedir, "gmsh_unit_interval.xml")))
+
+
+def test_non_square_assembly():
+    mesh = UnitSquareMesh(14, 14)
+
+    def bound(x):
+        return (x[0] == 0)
+
+    # Assemble four blocks in VxV, VxQ, QxV and VxV
+    P2 = VectorElement("Lagrange", mesh.ufl_cell(), 2)
+    P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    Q = FunctionSpace(mesh, P1)
+    V = FunctionSpace(mesh, P2)
+    u = TrialFunction(V)
+    v = TestFunction(V)
+    p = TrialFunction(Q)
+    q = TestFunction(Q)
+
+    a00 = inner(grad(u), grad(v))*dx
+    a01 = dot(grad(p), v)*dx
+    a10 = q*div(u)*dx
+    a11 = p*q*dx
+    L0 = dot(Constant((0.0, 0.0)), v)*dx
+    L1 = Constant(0.0)*q*dx
+    bc = DirichletBC(V.sub(0), Constant(1.0), bound)
+
+    assembler = SystemAssembler(a00, L0, bc)
+    A = Matrix()
+    b = Vector()
+    assembler.assemble(A, b)
+    Anorm1 = A.norm("frobenius")**2
+
+    assembler = SystemAssembler(a01, L0, bc)
+    A = Matrix()
+    assembler.add_values = True
+    assembler.assemble(A, b)
+    Anorm1 += A.norm("frobenius")**2
+    bnorm1 = b.norm("l2")**2
+
+    assembler = SystemAssembler(a10, L1, bc)
+    A = Matrix()
+    b = Vector()
+    assembler.assemble(A, b)
+    Anorm1 += A.norm("frobenius")**2
+
+    assembler = SystemAssembler(a11, L1, bc)
+    A = Matrix()
+    assembler.add_values = True
+    assembler.assemble(A, b)
+    Anorm1 += A.norm("frobenius")**2
+    bnorm1 += b.norm("l2")**2
+
+    # Same problem as a MixedFunctionSpace
+    W = FunctionSpace(mesh, P2*P1)
+    u, p = TrialFunctions(W)
+    v, q = TestFunctions(W)
+
+    a = inner(grad(u), grad(v))*dx + dot(grad(p), v)*dx + q*div(u)*dx + p*q*dx
+    L = dot(Constant((0.0, 0.0)), v)*dx + Constant(0.0)*q*dx
+    bc = DirichletBC(W.sub(0).sub(0), Constant(1.0), bound)
+    assembler = SystemAssembler(a, L, bc)
+    A = Matrix()
+    b = Vector()
+    assembler.assemble(A, b)
+
+    bnorm2 = b.norm("l2")**2
+    Anorm2 = A.norm("frobenius")**2
+    assert round(1.0 - bnorm1/bnorm2, 10) == 0
+    assert round(1.0 - Anorm1/Anorm2, 10) == 0
diff --git a/test/unit/python/fem/test_variational_problem.py b/test/unit/python/fem/test_variational_problem.py
new file mode 100755
index 0000000..e2554dd
--- /dev/null
+++ b/test/unit/python/fem/test_variational_problem.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env py.test
+
+"""Unit tests for the Nonlinear- and Linear-VariationalProblem classes"""
+
+# Copyright (C) 2016 Garth N. Wells
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+import pytest
+from dolfin import *
+from dolfin_utils.test import *
+
+ at use_gc_barrier
+def test_linear_construction():
+    "Test construction of LinearVariationalProblem"
+
+    mesh = UnitSquareMesh(4, 4)
+    V = FunctionSpace(mesh, "Lagrange", 1)
+    u = TrialFunction(V)
+    v = TestFunction(V)
+    f = Constant(100.0)
+
+    a = dot(grad(u), grad(v))*dx + u*v*dx
+    L = f*v*dx
+
+    bc = DirichletBC(V, 0.0, DomainBoundary())
+
+    w = Function(V)
+    with pytest.raises(TypeError):
+        problem = LinearVariationalProblem(a, L)
+    with pytest.raises(RuntimeError):
+        problem = LinearVariationalProblem(a, L, [bc])
+    with pytest.raises(RuntimeError):
+        problem = LinearVariationalProblem(a, L, [bc], w)
+    problem = LinearVariationalProblem(a, L, w, [])
+    problem = LinearVariationalProblem(a, L, w, [bc])
+    problem = LinearVariationalProblem(a, L, w, [bc, bc])
+
+
+ at use_gc_barrier
+def test_nonlinear_construction():
+    "Test construction of NonlinearVariationalProblem"
+
+    mesh = UnitSquareMesh(4, 4)
+    V = FunctionSpace(mesh, "Lagrange", 1)
+    u = Function(V)
+    du = TrialFunction(V)
+    v = TestFunction(V)
+    f = Constant(100.0)
+
+    F = dot(grad(u), grad(v))*dx + u*v*dx - f*v*dx
+    J = derivative(F, u, du)
+    bc = DirichletBC(V, 0.0, DomainBoundary())
+
+    with pytest.raises(RuntimeError):
+        problem = NonlinearVariationalProblem(F, u, J)
+    problem = NonlinearVariationalProblem(F, u)
+    problem = NonlinearVariationalProblem(F, u, [])
+    problem = NonlinearVariationalProblem(F, u, [], J)
+    problem = NonlinearVariationalProblem(F, u, J=J, bcs=[])
diff --git a/test/unit/python/function/test_constant.py b/test/unit/python/function/test_constant.py
index 7305850..9068fd0 100755
--- a/test/unit/python/function/test_constant.py
+++ b/test/unit/python/function/test_constant.py
@@ -37,9 +37,9 @@ def test_name_argument():
 
 def testConstantInit():
     c0 = Constant(1.)
-    c1 = Constant([2,3], interval)
-    c2 = Constant([[2,3], [3,4]], triangle)
-    c3 = Constant(array([2,3]), tetrahedron)
+    c1 = Constant([2, 3], interval)
+    c2 = Constant([[2, 3], [3, 4]], triangle)
+    c3 = Constant(array([2, 3]), tetrahedron)
 
     # FIXME:
     assert c0.cell() is None
@@ -47,17 +47,18 @@ def testConstantInit():
     assert c2.cell() == triangle
     assert c3.cell() == tetrahedron
 
-    assert c0.shape() == ()
-    assert c1.shape() == (2,)
-    assert c2.shape() == (2,2)
-    assert c3.shape() == (2,)
+    assert c0.ufl_shape == ()
+    assert c1.ufl_shape == (2,)
+    assert c2.ufl_shape == (2, 2)
+    assert c3.ufl_shape == (2,)
 
 
 def testGrad():
     import ufl
-    zero = ufl.constantvalue.Zero((2,3))
+    zero = ufl.constantvalue.Zero((2, 3))
     c0 = Constant(1.)
-    c3 = Constant(array([2,3]), tetrahedron)
+    c3 = Constant(array([2, 3]), tetrahedron)
+
     def gradient(c):
         return grad(c)
     with pytest.raises(UFLException):
@@ -73,13 +74,39 @@ def test_compute_vertex_values():
     e0 = Constant(1)
     e1 = Constant((1, 2, 3))
 
-    #e0_values = zeros(mesh.num_vertices(),dtype='d')
-    #e1_values = zeros(mesh.num_vertices()*3,dtype='d')
+    # e0_values = zeros(mesh.num_vertices(),dtype='d')
+    # e1_values = zeros(mesh.num_vertices()*3,dtype='d')
 
     e0_values = e0.compute_vertex_values(mesh)
     e1_values = e1.compute_vertex_values(mesh)
 
-    assert all(e0_values==1)
-    assert all(e1_values[:mesh.num_vertices()]==1)
-    assert all(e1_values[mesh.num_vertices():mesh.num_vertices()*2]==2)
-    assert all(e1_values[mesh.num_vertices()*2:mesh.num_vertices()*3]==3)
+    assert all(e0_values == 1)
+    assert all(e1_values[:mesh.num_vertices()] == 1)
+    assert all(e1_values[mesh.num_vertices():mesh.num_vertices()*2] == 2)
+    assert all(e1_values[mesh.num_vertices()*2:mesh.num_vertices()*3] == 3)
+
+
+def test_values():
+    import numpy as np
+
+    c0 = Constant(1.)
+    c0_vals = c0.values()
+    assert np.all(c0_vals == np.array([1.], dtype=np.double))
+
+    c1 = Constant((1., 2.))
+    c1_vals = c1.values()
+    assert np.all(c1_vals == np.array([1., 2.], dtype=np.double))
+
+    c2 = Constant((1., 2., 3.))
+    c2_vals = c2.values()
+    assert np.all(c2_vals == np.array([1., 2., 3.], dtype=np.double))
+
+
+def test_str():
+    c0 = Constant(1.)
+    c0.str(False)
+    c0.str(True)
+
+    c1 = Constant((1., 2., 3.))
+    c1.str(False)
+    c1.str(True)
diff --git a/test/unit/python/function/test_constrained_function_space.py b/test/unit/python/function/test_constrained_function_space.py
index 97e486d..dec863e 100755
--- a/test/unit/python/function/test_constrained_function_space.py
+++ b/test/unit/python/function/test_constrained_function_space.py
@@ -26,16 +26,20 @@ import pytest
 import numpy
 from dolfin import *
 
+
 class PeriodicBoundary2(SubDomain):
     def __init__(self, tolerance=DOLFIN_EPS):
         SubDomain.__init__(self, tolerance)
         self.tol = tolerance
+
     def inside(self, x, on_boundary):
         return bool(x[0] < self.tol and x[0] > -self.tol and on_boundary)
+
     def map(self, x, y):
         y[0] = x[0] - 1.0
         y[1] = x[1]
 
+
 class PeriodicBoundary3(SubDomain):
     def inside(self, x, on_boundary):
         return bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)
@@ -45,6 +49,7 @@ class PeriodicBoundary3(SubDomain):
         y[1] = x[1]
         y[2] = x[2]
 
+
 def test_instantiation():
     """ A rudimentary test for instantiation"""
 
@@ -52,23 +57,28 @@ def test_instantiation():
     mesh = UnitCubeMesh(8, 8, 8)
     V = FunctionSpace(mesh, "CG", 1, constrained_domain=sub_domain)
 
+
 def test_instantiation_mixed_element():
-    """ A rudimentary test for instantiation with mixed elements"""
+    """A rudimentary test for instantiation with mixed elements"""
 
     pbc = PeriodicBoundary2()
     mesh = UnitSquareMesh(8, 8)
-    V = FunctionSpace(mesh, "Lagrange", 1, constrained_domain=pbc)
-    VV = V*V
+    P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    VV = FunctionSpace(mesh, P1*P1, constrained_domain=pbc)
+
 
 def test_instantiation_mixed_element_real():
-    """ A rudimentary test for instantiation with mixed elements that include a real space"""
+    """A rudimentary test for instantiation with mixed elements that
+    include a real space
+    """
 
     pbc = PeriodicBoundary2()
     mesh = UnitSquareMesh(8, 8)
-    V = FunctionSpace(mesh, "Lagrange", 1, constrained_domain=pbc)
-    R = FunctionSpace(mesh, "Real", 0, constrained_domain=pbc)
-    VV = V*R
-    VV = R*V
+    P1 = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
+    R = FiniteElement("Real", mesh.ufl_cell(), 0)
+    VV = FunctionSpace(mesh, P1*R, constrained_domain=pbc)
+    VV = FunctionSpace(mesh, R*P1, constrained_domain=pbc)
+
 
 def test_instantiation_no_vertex_element_2D():
     """ A rudimentary test for instantiation for element that does
@@ -78,6 +88,7 @@ def test_instantiation_no_vertex_element_2D():
     mesh = UnitSquareMesh(8, 8)
     V = FunctionSpace(mesh, "BDM", 1, constrained_domain=pbc)
 
+
 def test_instantiation_no_vertex_element_3D():
     """ A rudimentary test for instantiation for element that does
     not require number of vertices (3D)"""
@@ -86,12 +97,14 @@ def test_instantiation_no_vertex_element_3D():
     mesh = UnitCubeMesh(8, 8, 9)
     V = FunctionSpace(mesh, "BDM", 1, constrained_domain=pbc)
 
+
 def test_director_lifetime():
     """Test for problems with objects with directors going out
     of scope"""
 
     mesh = UnitSquareMesh(8, 8)
-    V = FunctionSpace(mesh, "Lagrange", 1, constrained_domain=PeriodicBoundary2())
+    V = FunctionSpace(mesh, "Lagrange", 1,
+                      constrained_domain=PeriodicBoundary2())
 
 
 def test_tolerance():
@@ -111,9 +124,10 @@ def test_tolerance():
 
     for dim in range(mesh.geometry().dim()):
         periodic_pairs = PeriodicBoundaryComputation.compute_periodic_pairs(mesh, pbc, dim)
-        num_periodic_pairs0 =  len(periodic_pairs)
+        num_periodic_pairs0 = len(periodic_pairs)
 
-        periodic_pairs = PeriodicBoundaryComputation.compute_periodic_pairs(mesh_perturb, pbc_tol, dim)
+        periodic_pairs = PeriodicBoundaryComputation.compute_periodic_pairs(mesh_perturb,
+                                                                            pbc_tol, dim)
         num_periodic_pairs1 = len(periodic_pairs)
         assert num_periodic_pairs0 == num_periodic_pairs1
 
@@ -128,7 +142,8 @@ def test_solution():
 
     class DirichletBoundary(SubDomain):
         def inside(self, x, on_boundary):
-            return bool((x[1] < DOLFIN_EPS or x[1] > (1.0 - DOLFIN_EPS)) and on_boundary)
+            return bool((x[1] < DOLFIN_EPS or x[1] > (1.0 - DOLFIN_EPS)) and
+                        on_boundary)
 
     # Dirichlet boundary condition
     dirichlet_boundary = DirichletBoundary()
diff --git a/test/unit/python/function/test_expression.py b/test/unit/python/function/test_expression.py
index b6e87cf..2b0e2fd 100755
--- a/test/unit/python/function/test_expression.py
+++ b/test/unit/python/function/test_expression.py
@@ -23,35 +23,40 @@
 
 import pytest
 from dolfin import *
-from math   import sin, cos, exp, tan
-from numpy  import array, zeros, float_
+from math import sin, cos, exp, tan
+from numpy import array, zeros, float_
 
 from dolfin_utils.test import fixture, skip_in_parallel
 
+
 @fixture
 def mesh():
     return UnitCubeMesh(8, 8, 8)
 
+
 @fixture
 def V(mesh):
     return FunctionSpace(mesh, 'CG', 1)
 
+
 @fixture
 def W(mesh):
     return VectorFunctionSpace(mesh, 'CG', 1)
 
 
-def test_arbitraryEval(mesh):
+def test_arbitrary_eval(mesh):
     class F0(Expression):
-          def eval(self, values, x):
-              values[0] = sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])
+        def eval(self, values, x):
+            values[0] = sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])
 
-    f0 = F0(name="f0", label="My expression")
-    f1 = Expression("a*sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])", \
+    f0 = F0(name="f0", label="My expression", degree=2)
+    f1 = Expression("a*sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])",
                     degree=2, a=1., name="f1")
     x = array([0.31, 0.32, 0.33])
-    u00 = zeros(1); u01 = zeros(1)
-    u10 = zeros(1); u20 = zeros(1)
+    u00 = zeros(1)
+    u01 = zeros(1)
+    u10 = zeros(1)
+    u20 = zeros(1)
 
     # Check usergeneration of name and label
     assert f0.name() == "f0"
@@ -62,21 +67,21 @@ def test_arbitraryEval(mesh):
     assert f1.label() == "User defined expression"
 
     # Check outgeneration of name
-    count = int(F0().name()[2:])
-    assert F0().count() == count+1
+    count = int(F0(degree=0).name()[2:])
+    assert F0(degree=0).count() == count + 1
 
     # Test original and vs short evaluation
     f0.eval(u00, x)
-    f0(x, values = u01)
+    f0(x, values=u01)
     assert round(u00[0] - u01[0], 7) == 0
 
     # Evaluation with and without return value
-    f1(x, values = u10);
-    u11 = f1(x);
+    f1(x, values=u10)
+    u11 = f1(x)
     assert round(u10[0] - u11, 7) == 0
 
     # Test *args for coordinate argument
-    f1(0.31, 0.32, 0.33, values = u20)
+    f1(0.31, 0.32, 0.33, values=u20)
     u21 = f0(0.31, 0.32, 0.33)
     assert round(u20[0] - u21, 7) == 0
 
@@ -90,6 +95,10 @@ def test_arbitraryEval(mesh):
     assert round(u11 - same_result, 7) == 0
     assert round(u21 - same_result, 7) == 0
 
+    # For MUMPS, increase estimated require memory increase. Typically
+    # required for small meshes in 3D (solver is called by 'project')
+    PETScOptions.set("mat_mumps_icntl_14", 40)
+
     x = (mesh.coordinates()[0]+mesh.coordinates()[1])/2
     f2 = Expression("1.0 + 3.0*x[0] + 4.0*x[1] + 0.5*x[2]", degree=2)
     V2 = FunctionSpace(mesh, 'CG', 2)
@@ -102,6 +111,9 @@ def test_arbitraryEval(mesh):
     assert round(u3 - u4, 7) == 0
     assert round(u3 - u5, 4) == 0
 
+    PETScOptions.set("mat_mumps_icntl_14", 20)
+
+
 def test_ufl_eval():
     class F0(Expression):
         def eval(self, values, x):
@@ -112,22 +124,24 @@ def test_ufl_eval():
             values[0] = x[0]**2
             values[1] = x[1]**2
             values[2] = x[2]**2
+
         def value_shape(self):
             return (3,)
 
-    f0 = F0()
-    v0 = V0()
+    f0 = F0(degree=2)
+    v0 = V0(degree=2)
 
     x = (2.0, 1.0, 3.0)
 
-    # Test ufl evaluation through mapping (overriding the Expression with N here):
+    # Test ufl evaluation through mapping (overriding the Expression
+    # with N here):
     def N(x):
         return x[0]**2 + x[1] + 3*x[2]
 
-    assert f0(x, { f0: N }) == 14
+    assert f0(x, {f0: N}) == 14
 
     a = f0**2
-    b = a(x, { f0: N })
+    b = a(x, {f0: N})
     assert b == 196
 
     # Test ufl evaluation together with Expression evaluation by dolfin
@@ -135,9 +149,10 @@ def test_ufl_eval():
     assert f0(x) == f0(*x)
     assert (f0**2)(x) == f0(*x)**2
     # vector
-    assert all(a == b for a,b in zip(v0(x), v0(*x)))
-    assert dot(v0,v0)(x) == sum(v**2 for v in v0(*x))
-    assert dot(v0,v0)(x) == 98
+    assert all(a == b for a, b in zip(v0(x), v0(*x)))
+    assert dot(v0, v0)(x) == sum(v**2 for v in v0(*x))
+    assert dot(v0, v0)(x) == 98
+
 
 def test_overload_and_call_back(V, mesh):
     class F0(Expression):
@@ -147,6 +162,7 @@ def test_overload_and_call_back(V, mesh):
     class F1(Expression):
         def __init__(self, mesh, *arg, **kwargs):
             self.mesh = mesh
+
         def eval_cell(self, values, x, cell):
             c = Cell(self.mesh, cell.index)
             values[0] = sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])
@@ -164,13 +180,14 @@ def test_overload_and_call_back(V, mesh):
     assert round(s1 - ref, 7) == 0
     assert round(s2 - ref, 7) == 0
 
+
 def test_wrong_eval():
     # Test wrong evaluation
     class F0(Expression):
         def eval(self, values, x):
             values[0] = sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])
 
-    f0 = F0()
+    f0 = F0(degree=2)
     f1 = Expression("sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])", degree=2)
 
     for f in [f0, f1]:
@@ -179,15 +196,16 @@ def test_wrong_eval():
         with pytest.raises(TypeError):
             f([])
         with pytest.raises(TypeError):
-            f(0.5, 0.5, 0.5, values = zeros(3,'i'))
+            f(0.5, 0.5, 0.5, values=zeros(3, 'i'))
         with pytest.raises(TypeError):
             f([0.3, 0.2, []])
         with pytest.raises(TypeError):
             f(0.3, 0.2, {})
         with pytest.raises(TypeError):
-            f(zeros(3), values = zeros(4))
+            f(zeros(3), values=zeros(4))
         with pytest.raises(TypeError):
-            f(zeros(4), values = zeros(3))
+            f(zeros(4), values=zeros(3))
+
 
 def test_no_write_to_const_array():
     class F1(Expression):
@@ -195,8 +213,8 @@ def test_no_write_to_const_array():
             x[0] = 1.0
             values[0] = sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])
 
-    mesh = UnitCubeMesh(3,3,3)
-    f1 = F1()
+    mesh = UnitCubeMesh(3, 3, 3)
+    f1 = F1(degree=1)
     with pytest.raises(Exception):
         assemble(f1*dx(mesh))
 
@@ -204,22 +222,23 @@ def test_no_write_to_const_array():
 def test_compute_vertex_values(mesh):
     from numpy import zeros, all, array
 
-    e0 = Expression("1")
-    e1 = Expression(("1", "2", "3"))
+    e0 = Expression("1", degree=0)
+    e1 = Expression(("1", "2", "3"), degree=0)
 
     e0_values = e0.compute_vertex_values(mesh)
     e1_values = e1.compute_vertex_values(mesh)
 
-    assert all(e0_values==1)
-    assert all(e1_values[:mesh.num_vertices()]==1)
-    assert all(e1_values[mesh.num_vertices():mesh.num_vertices()*2]==2)
-    assert all(e1_values[mesh.num_vertices()*2:mesh.num_vertices()*3]==3)
+    assert all(e0_values == 1)
+    assert all(e1_values[:mesh.num_vertices()] == 1)
+    assert all(e1_values[mesh.num_vertices():mesh.num_vertices()*2] == 2)
+    assert all(e1_values[mesh.num_vertices()*2:mesh.num_vertices()*3] == 3)
 
 
 def test_wrong_sub_classing():
 
     def noAttributes():
-        class NoAttributes(Expression):pass
+        class NoAttributes(Expression):
+            pass
 
     def wrongEvalAttribute():
         class WrongEvalAttribute(Expression):
@@ -246,21 +265,23 @@ def test_wrong_sub_classing():
         class Deprecated(Expression):
             def eval(self, values, x):
                 pass
+
             def dim(self):
                 return 2
+
         e = Deprecated()
 
     def noDefaultValues():
         Expression("a")
 
     def wrongDefaultType():
-        Expression("a", a="1")
+        Expression("a", a="1", degree=1)
 
     def wrongParameterNames0():
-        Expression("long", str=1.0)
+        Expression("long", str=1.0, degree=1)
 
     def wrongParameterNames1():
-        Expression("user_parameters", user_parameters=1.0)
+        Expression("user_parameters", user_parameters=1.0, degree=1)
 
     with pytest.raises(TypeError):
         noAttributes()
@@ -283,14 +304,17 @@ def test_wrong_sub_classing():
     with pytest.raises(RuntimeError):
         wrongParameterNames1()
 
+
 def test_element_instantiation():
     class F0(Expression):
         def eval(self, values, x):
             values[0] = 1.0
+
     class F1(Expression):
         def eval(self, values, x):
             values[0] = 1.0
             values[1] = 1.0
+
         def value_shape(self):
             return (2,)
 
@@ -300,58 +324,72 @@ def test_element_instantiation():
             values[1] = 1.0
             values[2] = 1.0
             values[3] = 1.0
+
         def value_shape(self):
-            return (2,2)
+            return (2, 2)
 
-    e0 = Expression("1")
+    e0 = Expression("1", degree=0)
     assert e0.ufl_element().cell() is None
 
-    e1 = Expression("1", cell=triangle)
+    e1 = Expression("1", cell=triangle, degree=0)
     assert not e1.ufl_element().cell() is None
 
     e2 = Expression("1", cell=triangle, degree=2)
     assert e2.ufl_element().degree() == 2
 
-    e3 = Expression(["1", "1"], cell=triangle)
+    e3 = Expression(["1", "1"], cell=triangle, degree=0)
     assert isinstance(e3.ufl_element(), VectorElement)
 
-    e4 = Expression((("1", "1"), ("1", "1")), cell=triangle)
+    e4 = Expression((("1", "1"), ("1", "1")), cell=triangle, degree=0)
     assert isinstance(e4.ufl_element(), TensorElement)
 
-    f0 = F0()
+    f0 = F0(degree=0)
     assert f0.ufl_element().cell() is None
 
-    f1 = F0(cell=triangle)
+    f1 = F0(cell=triangle, degree=0)
     assert not f1.ufl_element().cell() is None
 
     f2 = F0(cell=triangle, degree=2)
     assert f2.ufl_element().degree() == 2
 
-    f3 = F1(cell=triangle)
+    f3 = F1(cell=triangle, degree=0)
     assert isinstance(f3.ufl_element(), VectorElement)
 
-    f4 = F2(cell=triangle)
+    f4 = F2(cell=triangle, degree=0)
     assert isinstance(f4.ufl_element(), TensorElement)
 
-def test_exponent_init():
-    e0 = Expression("1e10")
-    assert e0(0,0,0) == 1e10
 
-    e1 = Expression("1e-10")
-    assert e1(0,0,0) == 1e-10
+def test_num_literal():
+    e0 = Expression("1e10", degree=0)
+    assert e0(0, 0, 0) == 1e10
+
+    e1 = Expression("1e-10", degree=0)
+    assert e1(0, 0, 0) == 1e-10
+
+    e2 = Expression("1e+10", degree=0)
+    assert e2(0, 0, 0) == 1e+10
+
+    e3 = Expression(".5", degree=0)
+    assert e3(0, 0, 0) == 0.5
+
+    e4 = Expression("x[0] * sin(.5)", degree=2)
+    assert e4(0, 0, 0) == 0.
+
+    e5 = Expression(["2*t0", "-t0"], t0=1.0, degree=0)
+    values = e5(0, 0, 0)
+    assert values[0] == 2.
+    assert values[1] == -1.
 
-    e2 = Expression("1e+10")
-    assert e2(0,0,0) == 1e+10
 
 def test_name_space_usage(mesh):
-    e0 = Expression("std::sin(x[0])*cos(x[1])")
-    e1 = Expression("sin(x[0])*std::cos(x[1])")
-    assert round(assemble(e0*dx(mesh)) - \
-            assemble(e1*dx(mesh)), 7) == 0
+    e0 = Expression("std::sin(x[0])*cos(x[1])", degree=2)
+    e1 = Expression("sin(x[0])*std::cos(x[1])", degree=2)
+    assert round(assemble(e0*dx(mesh)) - assemble(e1*dx(mesh)), 7) == 0
+
 
 def test_generic_function_attributes(mesh, V):
     tc = Constant(2.0)
-    te = Expression("value", value=tc)
+    te = Expression("value", value=tc, degree=0)
 
     assert round(tc(0) - te(0), 7) == 0
     tc.assign(1.0)
@@ -360,43 +398,45 @@ def test_generic_function_attributes(mesh, V):
     tf = Function(V)
     tf.vector()[:] = 1.0
 
-    e0 = Expression(["2*t", "-t"], t=tc)
-    e1 = Expression(["2*t", "-t"], t=1.0)
-    e2 = Expression("t", t=te)
-    e3 = Expression("t", t=tf)
+    e0 = Expression(["2*t", "-t"], t=tc, degree=0)
+    e1 = Expression(["2*t0", "-t0"], t0=1.0, degree=0)
+    e2 = Expression("t", t=te, degree=0)
+    e3 = Expression("t", t=tf, degree=0)
 
-    assert round(assemble(inner(e0,e0)*dx(mesh)) -\
-                 assemble(inner(e1,e1)*dx(mesh)), 7) == 0
+    assert (round(assemble(inner(e0, e0)*dx(mesh)) -
+                  assemble(inner(e1, e1)*dx(mesh)), 7) == 0)
 
-    assert round(assemble(inner(e2,e2)*dx(mesh)) - \
-                 assemble(inner(e3,e3)*dx(mesh)), 7) == 0
+    assert (round(assemble(inner(e2, e2)*dx(mesh)) -
+                  assemble(inner(e3, e3)*dx(mesh)), 7) == 0)
 
     tc.assign(3.0)
-    e1.t = float(tc)
+    e1.t0 = float(tc)
 
-    assert round(assemble(inner(e0,e0)*dx(mesh)) - \
-                 assemble(inner(e1,e1)*dx(mesh)), 7) == 0
+    assert (round(assemble(inner(e0, e0)*dx(mesh)) -
+                  assemble(inner(e1, e1)*dx(mesh)), 7) == 0)
 
     tc.assign(5.0)
 
-    assert assemble(inner(e2,e2)*dx(mesh)) != assemble(inner(e3,e3)*dx(mesh))
+    assert assemble(inner(e2, e2)*dx(mesh)) != assemble(inner(e3, e3)*dx(mesh))
 
-    assert round(assemble(e0[0]*dx(mesh)) - \
-                 assemble(2*e2*dx(mesh)), 7) == 0
+    assert (round(assemble(e0[0]*dx(mesh)) -
+                  assemble(2*e2*dx(mesh)), 7) == 0)
 
     e2.t = e3.t
 
-    assert round(assemble(inner(e2,e2)*dx(mesh)) - \
-                 assemble(inner(e3,e3)*dx(mesh)), 7) == 0
+    assert (round(assemble(inner(e2, e2)*dx(mesh)) -
+                  assemble(inner(e3, e3)*dx(mesh)), 7) == 0)
+
+    W = FunctionSpace(mesh, V.ufl_element()*V.ufl_element())
 
     # Test wrong kwargs
     with pytest.raises(TypeError):
-        Expression("t", t=Constant((1,0)))
+        Expression("t", t=Constant((1, 0)), degree=0)
     with pytest.raises(TypeError):
-        Expression("t", t=Function(V*V))
+        Expression("t", t=Function(W), degree=0)
 
     # Test non-scalar GenericFunction
-    f2 = Function(V*V)
+    f2 = Function(W)
     e2.t = f2
 
     with pytest.raises(RuntimeError):
@@ -424,6 +464,7 @@ def test_generic_function_attributes(mesh, V):
     with pytest.raises(KeyError):
         te.user_parameters.__setitem__("values", 1.0)
 
+
 def test_doc_string_eval():
     """
     This test tests all features documented in the doc string of
@@ -431,28 +472,30 @@ def test_doc_string_eval():
     need also be updated in the docstring.
     """
 
-    square = UnitSquareMesh(10,10)
+    square = UnitSquareMesh(10, 10)
     V = VectorFunctionSpace(square, "CG", 1)
 
-    f0 = Expression('sin(x[0]) + cos(x[1])')
-    f1 = Expression(('cos(x[0])', 'sin(x[1])'), element = V.ufl_element())
-    assert round(f0(0,0) - sum(f1(0,0)), 7) == 0
+    f0 = Expression('sin(x[0]) + cos(x[1])', degree=1)
+    f1 = Expression(('cos(x[0])', 'sin(x[1])'), element=V.ufl_element())
+    assert round(f0(0, 0) - sum(f1(0, 0)), 7) == 0
 
-    f2 = Expression((('exp(x[0])','sin(x[1])'),
-                     ('sin(x[0])','tan(x[1])')))
-    assert round(sum(f2(0,0)) - 1.0, 7) == 0
+    f2 = Expression((('exp(x[0])', 'sin(x[1])'),
+                     ('sin(x[0])', 'tan(x[1])')), degree=1)
+    assert round(sum(f2(0, 0)) - 1.0, 7) == 0
 
-    f = Expression('A*sin(x[0]) + B*cos(x[1])', A=2.0, B=Constant(4.0))
+    f = Expression('A*sin(x[0]) + B*cos(x[1])', A=2.0, B=Constant(4.0),
+                   degree=2)
     assert round(f(pi/4, pi/4) - 6./sqrt(2), 7) == 0
 
     f.A = 5.0
-    f.B = Expression("value", value=6.0)
+    f.B = Expression("value", value=6.0, degree=0)
     assert round(f(pi/4, pi/4) - 11./sqrt(2), 7) == 0
 
     f.user_parameters["A"] = 1.0
     f.user_parameters["B"] = Constant(5.0)
     assert round(f(pi/4, pi/4) - 6./sqrt(2), 7) == 0
 
+
 @skip_in_parallel
 def test_doc_string_complex_compiled_expression(mesh):
     """
@@ -494,11 +537,11 @@ def test_doc_string_complex_compiled_expression(mesh):
       }
     };'''
 
-    cell_data = CellFunction('uint', mesh)
+    cell_data = CellFunction('size_t', mesh)
     cell_data.set_all(3)
-    CompiledSubDomain("x[0]<=0.25").mark(cell_data, 0)
-    CompiledSubDomain("x[0]>0.25 && x[0]<0.75").mark(cell_data, 1)
-    CompiledSubDomain("x[0]>=0.75").mark(cell_data, 2)
+    CompiledSubDomain("x[0] <= 0.25").mark(cell_data, 0)
+    CompiledSubDomain("x[0] > 0.25 && x[0] < 0.75").mark(cell_data, 1)
+    CompiledSubDomain("x[0] >= 0.75").mark(cell_data, 2)
 
     # Points manually chosen to be in cells marked in cell_data as 0, 1, 2
     p0 = Point(0.1, 1.0, 0)
@@ -528,7 +571,7 @@ def test_doc_string_complex_compiled_expression(mesh):
     values = zeros(1, dtype=float_)
 
     # Create compiled expression and attach cell data
-    f = Expression(code)
+    f = Expression(code, degree=2)
     f.cell_data = cell_data
 
     coords = array([p0.x(), p0.y(), p0.z()], dtype=float_)
@@ -543,6 +586,7 @@ def test_doc_string_complex_compiled_expression(mesh):
     f.eval_cell(values, coords, c2)
     assert values[0] == exp(-p2.y())
 
+
 @pytest.mark.slow
 @skip_in_parallel
 def test_doc_string_compiled_expression_with_system_headers():
@@ -573,8 +617,8 @@ def test_doc_string_compiled_expression_with_system_headers():
         {
           const std::shared_ptr<const Mesh> mesh = u->function_space()->mesh();
           const std::shared_ptr<const GenericDofMap> dofmap = u->function_space()->dofmap();
-          const uint ncells = mesh->num_cells();
-          uint ndofs_per_cell;
+          const std::size_t ncells = mesh->num_cells();
+          std::size_t ndofs_per_cell;
           if (ncells > 0)
           {
             CellIterator cell(*mesh);
@@ -588,7 +632,7 @@ def test_doc_string_compiled_expression_with_system_headers():
       };
     }'''
 
-    e = Expression(code_compile)
+    e = Expression(code_compile, degree=1)
     assert hasattr(e, "update")
 
     # Test not compile
@@ -611,8 +655,8 @@ def test_doc_string_compiled_expression_with_system_headers():
         {
           const std::shared_ptr<const Mesh> mesh = u->function_space()->mesh();
           const std::shared_ptr<const GenericDofMap> dofmap = u->function_space()->dofmap();
-          const uint ncells = mesh->num_cells();
-          uint ndofs_per_cell;
+          const std::size_t ncells = mesh->num_cells();
+          std::size_t ndofs_per_cell;
           if (ncells > 0)
           {
             CellIterator cell(*mesh);
@@ -629,14 +673,15 @@ def test_doc_string_compiled_expression_with_system_headers():
     with pytest.raises(Exception):
         Expression(code_not_compile)
 
+
 def test_doc_string_python_expressions(mesh):
-    """
-    This test tests all features documented in the doc string of
-    Expression. If this test breaks and it is fixed the corresponding fixes
-    need also be updated in the docstring.
+    """This test tests all features documented in the doc string of
+    Expression. If this test breaks and it is fixed the corresponding
+    fixes need also be updated in the docstring.
+
     """
 
-    square = UnitSquareMesh(4,4)
+    square = UnitSquareMesh(4, 4)
 
     class MyExpression0(Expression):
         def eval(self, value, x):
@@ -644,13 +689,14 @@ def test_doc_string_python_expressions(mesh):
             dy = x[1] - 0.5
             value[0] = 500.0*exp(-(dx*dx + dy*dy)/0.02)
             value[1] = 250.0*exp(-(dx*dx + dy*dy)/0.01)
+
         def value_shape(self):
             return (2,)
 
-    f0 = MyExpression0()
-    values = f0(0.2,0.3)
-    dx = 0.2-0.5
-    dy = 0.3-0.5
+    f0 = MyExpression0(degree=2)
+    values = f0(0.2, 0.3)
+    dx = 0.2 - 0.5
+    dy = 0.3 - 0.5
 
     assert round(values[0] - 500.0*exp(-(dx*dx + dy*dy)/0.02), 7) == 0
     assert round(values[1] - 250.0*exp(-(dx*dx + dy*dy)/0.01), 7) == 0
@@ -660,28 +706,30 @@ def test_doc_string_python_expressions(mesh):
 
     class MyExpression1(Expression):
         def eval_cell(self_expr, value, x, ufc_cell):
+            # Check attributes in ufc cell
+            for attr in ufc_cell_attrs:
+                  assert hasattr(ufc_cell, attr)
+
             if ufc_cell.index > 10:
                 value[0] = 1.0
             else:
                 value[0] = -1.0
 
-            # Check attributes in ufc cell
-            for attr in ufc_cell_attrs:
-                  assert hasattr(ufc_cell, attr)
-
-    f1 = MyExpression1()
+    f1 = MyExpression1(degree=0)
     assemble(f1*ds(square))
 
     class MyExpression2(Expression):
-        def __init__(self, mesh, domain):
+        def __init__(self, mesh, domain, *arg, **kwargs):
             self._mesh = mesh
             self._domain = domain
+
         def eval(self, values, x):
             pass
 
-    cell_data = CellFunction('uint', square)
+    cell_data = CellFunction('size_t', square)
 
-    f3 = MyExpression2(square, cell_data)
+    P1 = FiniteElement("Lagrange", square.ufl_cell(), 1)
+    f3 = MyExpression2(square, cell_data, element=P1)
 
     assert id(f3._mesh) == id(square)
     assert id(f3._domain) == id(cell_data)
diff --git a/test/unit/python/function/test_function.py b/test/unit/python/function/test_function.py
index 71e83c5..f7fc67b 100755
--- a/test/unit/python/function/test_function.py
+++ b/test/unit/python/function/test_function.py
@@ -25,18 +25,22 @@ import ufl
 
 from dolfin_utils.test import *
 
+
 @fixture
 def mesh():
     return UnitCubeMesh(8, 8, 8)
 
+
 @fixture
 def R(mesh):
     return FunctionSpace(mesh, 'R', 0)
 
+
 @fixture
 def V(mesh):
     return FunctionSpace(mesh, 'CG', 1)
 
+
 @fixture
 def W(mesh):
     return VectorFunctionSpace(mesh, 'CG', 1)
@@ -45,11 +49,10 @@ def W(mesh):
 def test_name_argument(W):
     u = Function(W)
     v = Function(W, name="v")
-    g = Function(v, name="g")
     assert u.name() == "f_%d" % u.count()
     assert v.name() == "v"
     assert str(v) == "v"
-    assert g.name() == "g"
+
 
 def test_in_function_space(W):
     u = Function(W)
@@ -60,6 +63,7 @@ def test_in_function_space(W):
     for i, usub in enumerate(u.split()):
         assert usub in W.sub(i)
 
+
 def test_compute_vertex_values(V, W, mesh):
     from numpy import zeros, all, array
     u = Function(V)
@@ -71,7 +75,8 @@ def test_compute_vertex_values(V, W, mesh):
     u_values = u.compute_vertex_values(mesh)
     v_values = v.compute_vertex_values(mesh)
 
-    assert all(u_values==1)
+    assert all(u_values == 1)
+
 
 def test_assign(V, W):
     from ufl.algorithms import replace
@@ -83,13 +88,13 @@ def test_assign(V, W):
         u2 = Function(V0)
         u3 = Function(V1)
 
-        u.vector()[:] =  1.0
+        u.vector()[:] = 1.0
         u0.vector()[:] = 2.0
         u1.vector()[:] = 3.0
         u2.vector()[:] = 4.0
         u3.vector()[:] = 5.0
 
-        scalars = {u:1.0, u0:2.0, u1:3.0, u2:4.0, u3:5.0}
+        scalars = {u: 1.0, u0: 2.0, u1: 3.0, u2: 4.0, u3: 5.0}
 
         uu = Function(V0)
         uu.assign(2*u)
@@ -103,29 +108,29 @@ def test_assign(V, W):
         expr = 3*u-4*u1-0.1*4*u*4+u2+3*u0/3./0.5
         expr_scalar = 3-4*3-0.1*4*4+4.+3*2./3./0.5
         uu.assign(expr)
-        assert round(uu.vector().sum() -\
-                      float(expr_scalar*uu.vector().size()), 7) == 0
+        assert (round(uu.vector().sum() -
+                      float(expr_scalar*uu.vector().size()), 7) == 0)
 
         # Test expression scaling
         expr = 3*expr
         expr_scalar *= 3
         uu.assign(expr)
-        assert round(uu.vector().sum() - \
-                      float(expr_scalar*uu.vector().size()), 7) == 0
+        assert (round(uu.vector().sum() -
+                      float(expr_scalar*uu.vector().size()), 7) == 0)
 
         # Test expression scaling
         expr = expr/4.5
         expr_scalar /= 4.5
         uu.assign(expr)
-        assert round(uu.vector().sum() - \
-                      float(expr_scalar*uu.vector().size()), 7) == 0
+        assert (round(uu.vector().sum() -
+                      float(expr_scalar*uu.vector().size()), 7) == 0)
 
         # Test self assignment
         expr = 3*u - Constant(5)*u2 + u1 - 5*u
         expr_scalar = 3 - 5*4. + 3. - 5
         u.assign(expr)
-        assert round(u.vector().sum() - \
-                      float(expr_scalar*u.vector().size()), 7) == 0
+        assert (round(u.vector().sum() -
+                      float(expr_scalar*u.vector().size()), 7) == 0)
 
         # Test zero assignment
         u.assign(-u2/2+2*u1-u1/0.5+u2*0.5)
@@ -133,7 +138,7 @@ def test_assign(V, W):
 
         # Test errounious assignments
         uu = Function(V1)
-        f = Expression("1.0")
+        f = Expression("1.0", degree=0)
         with pytest.raises(RuntimeError):
             uu.assign(1.0)
         with pytest.raises(RuntimeError):
@@ -156,7 +161,7 @@ def test_axpy(V, W):
         u2 = Function(V0)
         u3 = Function(V1)
 
-        u.vector()[:] =  1.0
+        u.vector()[:] = 1.0
         u0.vector()[:] = 2.0
         u1.vector()[:] = 3.0
         u2.vector()[:] = 4.0
@@ -166,58 +171,58 @@ def test_axpy(V, W):
         u.assign(axpy)
         expr_scalar = 3*2
 
-        assert round(u.vector().sum() - \
-                      float(expr_scalar*u.vector().size()), 7) == 0
+        assert (round(u.vector().sum() -
+                      float(expr_scalar*u.vector().size()), 7) == 0)
 
         axpy = FunctionAXPY([(2.0, u1), (3.0, u2)])
 
         u.assign(axpy)
         expr_scalar = 3*2+3*4.0
 
-        assert round(u.vector().sum() - \
-                     float(expr_scalar*u.vector().size()), 7) == 0
+        assert (round(u.vector().sum() -
+                      float(expr_scalar*u.vector().size()), 7) == 0)
 
         axpy = axpy*3
         u.assign(axpy)
         expr_scalar *= 3
 
-        assert round(u.vector().sum() - \
-                      float(expr_scalar*u.vector().size()), 7) == 0
+        assert (round(u.vector().sum() -
+                      float(expr_scalar*u.vector().size()), 7) == 0)
 
         axpy0 = axpy/5
         u.assign(axpy0)
         expr_scalar0 = expr_scalar/5
 
-        assert round(u.vector().sum() - \
-                      float(expr_scalar0*u.vector().size()), 7) == 0
+        assert (round(u.vector().sum() -
+                      float(expr_scalar0*u.vector().size()), 7) == 0)
 
         axpy1 = axpy0+axpy
         u.assign(axpy1)
         expr_scalar1 = expr_scalar0 + expr_scalar
 
-        assert round(u.vector().sum() - \
-                      float(expr_scalar1*u.vector().size()), 7) == 0
+        assert (round(u.vector().sum() -
+                      float(expr_scalar1*u.vector().size()), 7) == 0)
 
         axpy1 = axpy0-axpy
         u.assign(axpy1)
         expr_scalar1 = expr_scalar0 - expr_scalar
 
-        assert round(u.vector().sum() - \
-                      float(expr_scalar1*u.vector().size()), 7) == 0
+        assert (round(u.vector().sum() -
+                      float(expr_scalar1*u.vector().size()), 7) == 0)
 
         axpy1 = axpy0+u1
         u.assign(axpy1)
         expr_scalar1 = expr_scalar0 + 3.0
 
-        assert round(u.vector().sum() - \
-                      float(expr_scalar1*u.vector().size()), 7) == 0
+        assert (round(u.vector().sum() -
+                      float(expr_scalar1*u.vector().size()), 7) == 0)
 
         axpy1 = axpy0-u2
         u.assign(axpy1)
         expr_scalar1 = expr_scalar0 - 4.0
 
-        assert round(u.vector().sum() - \
-                      float(expr_scalar1*u.vector().size()), 7) == 0
+        assert (round(u.vector().sum() -
+                      float(expr_scalar1*u.vector().size()), 7) == 0)
 
         with pytest.raises(RuntimeError):
             FunctionAXPY(u, u3, 0)
@@ -225,22 +230,25 @@ def test_axpy(V, W):
         axpy = FunctionAXPY(u3, 2.0)
 
         with pytest.raises(RuntimeError):
-            axpy+u
+            axpy + u
+
 
 def test_call(R, V, W, mesh):
     from numpy import zeros, all, array
     u0 = Function(R)
     u1 = Function(V)
     u2 = Function(W)
-    e0=Expression("x[0]+x[1]+x[2]")
-    e1=Expression(("x[0]+x[1]+x[2]", "x[0]-x[1]-x[2]", "x[0]+x[1]+x[2]"))
+    e0 = Expression("x[0] + x[1] + x[2]", degree=1)
+    e1 = Expression(("x[0] + x[1] + x[2]",
+                     "x[0] - x[1] - x[2]",
+                     "x[0] + x[1] + x[2]"), degree=1)
 
     u0.vector()[:] = 1.0
     u1.interpolate(e0)
     u2.interpolate(e1)
 
-    p0 = (Vertex(mesh,0).point()+Vertex(mesh,1).point())/2
-    x0 = (mesh.coordinates()[0]+mesh.coordinates()[1])/2
+    p0 = (Vertex(mesh, 0).point() + Vertex(mesh, 1).point())/2
+    x0 = (mesh.coordinates()[0] + mesh.coordinates()[1])/2
     x1 = tuple(x0)
 
     assert round(u0(*x1) - u0(x0), 7) == 0
@@ -257,28 +265,33 @@ def test_call(R, V, W, mesh):
     assert all(values == u2(x0))
 
     with pytest.raises(TypeError):
-        u0([0,0,0,0])
+        u0([0, 0, 0, 0])
     with pytest.raises(TypeError):
-        u0([0,0])
+        u0([0, 0])
+
 
 def test_constant_float_conversion():
     c = Constant(3.45)
     assert float(c) == 3.45
 
+
 def test_real_function_float_conversion1(R):
     c = Function(R)
     assert float(c) == 0.0
 
+
 def test_real_function_float_conversion2(R):
     c = Function(R)
     c.assign(Constant(2.34))
     assert float(c) == 2.34
 
+
 def test_real_function_float_conversion3(R):
     c = Function(R)
     c.vector()[:] = 1.23
     assert float(c) == 1.23
 
+
 def test_scalar_conditions(R):
     c = Function(R)
     c.vector()[:] = 1.5
@@ -293,7 +306,9 @@ def test_scalar_conditions(R):
 
     # == is used in ufl to compare equivalent representations,
     # <,> result in LT/GT expressions, bool conversion is illegal
-    # Note that 1.5 < 0 == False == 1.5 < 1, but that is not what we compare here:
+
+    # Note that 1.5 < 0 == False == 1.5 < 1, but that is not what we
+    # compare here:
     assert not (c < 0) == (c < 1)
     # This protects from "if c < 0: ..." misuse:
     with pytest.raises(ufl.UFLException):
@@ -301,23 +316,27 @@ def test_scalar_conditions(R):
     with pytest.raises(ufl.UFLException):
         not c < 0
 
+
 def test_interpolation_mismatch_rank0(W):
-    f = Expression("1.0")
+    f = Expression("1.0", degree=0)
     with pytest.raises(RuntimeError):
         interpolate(f, W)
 
+
 def test_interpolation_mismatch_rank1(W):
-    f = Expression(("1.0", "1.0"))
+    f = Expression(("1.0", "1.0"), degree=0)
     with pytest.raises(RuntimeError):
         interpolate(f, W)
 
+
 def test_interpolation_jit_rank0(V):
-    f = Expression("1.0")
+    f = Expression("1.0", degree=0)
     w = interpolate(f, V)
     x = w.vector()
     assert x.max() == 1
     assert x.min() == 1
 
+
 @skip_in_parallel
 def test_extrapolation(V):
     original_parameters = parameters["allow_extrapolation"]
@@ -335,34 +354,34 @@ def test_extrapolation(V):
     parameters["allow_extrapolation"] = True
     f1 = Function(V1)
     f1.vector()[:] = 1.0
-    assert round(f1(0.,-1) - 1.0, 7) == 0
+    assert round(f1(0., -1) - 1.0, 7) == 0
 
     parameters["allow_extrapolation"] = False
     f2 = Function(V2)
     with pytest.raises(RuntimeError):
-        f2.__call__((0.,-1.))
+        f2.__call__((0., -1.))
 
     parameters["allow_extrapolation"] = True
     f3 = Function(V2)
     f3.vector()[:] = 1.0
-    assert round(f3(0.,-1) - 1.0, 7) == 0
+    assert round(f3(0., -1) - 1.0, 7) == 0
 
     parameters["allow_extrapolation"] = original_parameters
 
     f1 = Function(V1)
     f1.set_allow_extrapolation(True)
     f1.vector()[:] = 1.0
-    assert round(f1(0.,-1) - 1.0, 7) == 0
+    assert round(f1(0., -1) - 1.0, 7) == 0
 
     f2 = Function(V2)
 
     f2.set_allow_extrapolation(False)
     with pytest.raises(RuntimeError):
-        f2.__call__((0.,-1.))
+        f2.__call__((0., -1.))
 
     f2.set_allow_extrapolation(True)
     f2.vector()[:] = 1.0
-    assert round(f2(0.,-1) - 1.0, 7) == 0
+    assert round(f2(0., -1) - 1.0, 7) == 0
 
     f2.set_allow_extrapolation(True)
     assert f2.get_allow_extrapolation() is True
@@ -373,97 +392,12 @@ def test_extrapolation(V):
 
 
 def test_interpolation_jit_rank1(W):
-    f = Expression(("1.0", "1.0", "1.0"))
+    f = Expression(("1.0", "1.0", "1.0"), degree=0)
     w = interpolate(f, W)
     x = w.vector()
     assert x.max() == 1
     assert x.min() == 1
 
-def xtest_restricted_function_equals_its_interpolation_and_projection_in_dg():
-    class Side0(SubDomain):
-        def inside(self, x, on_boundary):
-            return x[0] <= 0.55
-
-    class Side1(SubDomain):
-        def inside(self, x, on_boundary):
-            return x[0] >= 0.45
-
-    mesh = UnitSquareMesh(10,10)
-    dim = 2
-
-    sd0 = MeshFunctionSizet(mesh, dim)
-    sd1 = MeshFunctionSizet(mesh, dim)
-
-    Side0().mark(sd0, 1)
-    Side1().mark(sd1, 2)
-
-    r0 = Restriction(sd0, 1)
-    r1 = Restriction(sd1, 2)
-
-    Vt = FunctionSpace(mesh, "DG", 1)
-    V0 = FunctionSpace(r0, "CG", 1)
-    V1 = FunctionSpace(r1, "CG", 1)
-
-    ft = Function(Vt)
-    f0 = Function(V0)
-    f1 = Function(V1)
-
-    f0.interpolate(Expression("x[0]*x[0]"))
-    f1.interpolate(Expression("x[1]*x[1]"))
-    ft.interpolate(f0)
-    gt = project(f1+f0, Vt)
-
-    f0v = assemble(f0*dx(1, subdomain_data=sd0))
-    f1v = assemble(f1*dx(2, subdomain_data=sd1))
-    ftv = assemble(ft*dx(1, subdomain_data=sd0))
-    gtv = assemble(gt*dx)
-
-    assert round(f0v - ftv, 7) == 0
-    assert round(f0v+f1v - gtv, 7) == 0
-
- at skip_in_parallel
-def xtest_restricted_function_equals_its_interpolation_and_projection_in_dg(self):
-    class Side0(SubDomain):
-        def inside(self, x, on_boundary):
-            return x[0] <= 0.55
-
-    class Side1(SubDomain):
-        def inside(self, x, on_boundary):
-            return x[0] >= 0.45
-
-    mesh = UnitSquareMesh(10,10)
-    dim = 2
-
-    sd0 = MeshFunctionSizet(mesh, dim)
-    sd1 = MeshFunctionSizet(mesh, dim)
-
-    Side0().mark(sd0, 1)
-    Side1().mark(sd1, 2)
-
-    r0 = Restriction(sd0, 1)
-    r1 = Restriction(sd1, 2)
-
-    Vt = FunctionSpace(mesh, "DG", 1)
-    V0 = FunctionSpace(r0, "CG", 1)
-    V1 = FunctionSpace(r1, "CG", 1)
-
-    ft = Function(Vt)
-    f0 = Function(V0)
-    f1 = Function(V1)
-
-    f0.interpolate(Expression("x[0]*x[0]"))
-    f1.interpolate(Expression("x[1]*x[1]"))
-    ft.interpolate(f0)
-    gt = project(f1+f0, Vt)
-
-    f0v = assemble(f0*dx(1, subdomain_data=sd0))
-    f1v = assemble(f1*dx(2, subdomain_data=sd1))
-    ftv = assemble(ft*dx(1, subdomain_data=sd0))
-    gtv = assemble(gt*dx)
-
-    self.assertAlmostEqual(f0v, ftv)
-    self.assertAlmostEqual(f0v+f1v, gtv)
-
 
 @skip_in_parallel
 def test_interpolation_old(V, W, mesh):
@@ -476,18 +410,19 @@ def test_interpolation_old(V, W, mesh):
         def eval(self, values, x):
             values[0] = 1.0
             values[1] = 1.0
+            values[2] = 1.0
+
         def value_shape(self):
-            return (2,)
+            return (3,)
 
     # Scalar interpolation
-    f0 = F0()
+    f0 = F0(degree=0)
     f = Function(V)
     f.interpolate(f0)
     assert round(f.vector().norm("l1") - mesh.num_vertices(), 7) == 0
 
     # Vector interpolation
-    f1 = F1()
-    W = V * V
+    f1 = F1(degree=0)
     f = Function(W)
     f.interpolate(f1)
-    assert round(f.vector().norm("l1") - 2*mesh.num_vertices(), 7) == 0
+    assert round(f.vector().norm("l1") - 3*mesh.num_vertices(), 7) == 0
diff --git a/test/unit/python/function/test_function_assigner.py b/test/unit/python/function/test_function_assigner.py
index 6122ba1..250aae1 100755
--- a/test/unit/python/function/test_function_assigner.py
+++ b/test/unit/python/function/test_function_assigner.py
@@ -57,20 +57,27 @@ def RR(mesh):
     return VectorFunctionSpace(mesh, "R", 0)
 
 @fixt
-def QQV(QQ, V):
-    return QQ*V
+def QQV(mesh):
+    QQ = VectorElement("CG", mesh.ufl_cell(), 2)
+    V = FiniteElement("CG", mesh.ufl_cell(), 1)
+    return FunctionSpace(mesh, QQ*V)
 
 @fixt
-def WW(W):
-    return W * W
+def WW(mesh):
+    W = VectorElement("CG", mesh.ufl_cell(), 1)
+    return FunctionSpace(mesh, W*W)
 
 @fixt
-def WR(W, R):
-    return W * R
+def WR(mesh):
+    W = VectorElement("CG", mesh.ufl_cell(), 1)
+    R = FiniteElement("R", mesh.ufl_cell(), 0)
+    return FunctionSpace(mesh, W*R)
 
 @fixt
-def WRR(W, RR):
-    return W * RR
+def WRR(mesh):
+    W = VectorElement("CG", mesh.ufl_cell(), 1)
+    RR = VectorElement("R", mesh.ufl_cell(), 0)
+    return FunctionSpace(mesh, W*RR)
 
 @fixt
 def u0(V):
diff --git a/test/unit/python/function/test_function_space.py b/test/unit/python/function/test_function_space.py
index 982d16d..ad22d89 100755
--- a/test/unit/python/function/test_function_space.py
+++ b/test/unit/python/function/test_function_space.py
@@ -42,8 +42,10 @@ def W(mesh):
     return VectorFunctionSpace(mesh, 'CG', 1)
 
 @fixture
-def Q(W, V):
-    return W*V
+def Q(mesh):
+    W = VectorElement('CG', mesh.ufl_cell(), 1)
+    V = FiniteElement('CG', mesh.ufl_cell(), 1)
+    return FunctionSpace(mesh, W*V)
 
 @fixture
 def f(V):
@@ -64,13 +66,13 @@ def W2(g):
 
 def test_python_interface(V, V2, W, W2, Q):
     # Test Python interface of cpp generated FunctionSpace
-    assert isinstance(V, FunctionSpaceBase)
-    assert isinstance(W, FunctionSpaceBase)
-    assert isinstance(V2, FunctionSpaceBase)
-    assert isinstance(W2, FunctionSpaceBase)
+    assert isinstance(V, FunctionSpace)
+    assert isinstance(W, FunctionSpace)
+    assert isinstance(V2, FunctionSpace)
+    assert isinstance(W2, FunctionSpace)
 
-    assert V.cell() == V2.cell()
-    assert W.cell() == W2.cell()
+    assert V.ufl_cell() == V2.ufl_cell()
+    assert W.ufl_cell() == W2.ufl_cell()
     assert V.dolfin_element().signature() == V2.dolfin_element().signature()
     assert W.dolfin_element().signature() == W2.dolfin_element().signature()
     assert V.ufl_element() == V2.ufl_element()
@@ -78,9 +80,6 @@ def test_python_interface(V, V2, W, W2, Q):
     assert W.id() == W2.id()
     assert V.id() == V2.id()
 
-    Q2 = W2*V2
-    assert Q2.dim() == Q.dim()
-
 def test_component(V, W, Q):
     assert not W.component()
     assert not V.component()
@@ -123,7 +122,7 @@ def test_collapse(W, V):
     Vs = W.sub(2)
     with pytest.raises(RuntimeError):
         Function(Vs)
-    assert Vs.dofmap().cell_dofs(0)[0] !=  V.dofmap().cell_dofs(0)[0]
+    assert Vs.dofmap().cell_dofs(0)[0] != V.dofmap().cell_dofs(0)[0]
 
     # Collapse the space it should now be the same as V
     Vc, dofmap_new_old = Vs.collapse(True)
@@ -133,7 +132,8 @@ def test_collapse(W, V):
     assert len(f0.vector()) == len(f1.vector())
 
 def test_argument_equality(mesh, V, V2, W, W2):
-    "Placed this test here because it's mainly about detecting differing function spaces."
+    """Placed this test here because it's mainly about detecting differing
+function spaces."""
     mesh2 = UnitCubeMesh(8, 8, 8)
     V3 = FunctionSpace(mesh2, 'CG', 1)
     W3 = VectorFunctionSpace(mesh2, 'CG', 1)
@@ -146,8 +146,8 @@ def test_argument_equality(mesh, V, V2, W, W2):
         assert v2 == v
         assert V != V3
         assert V2 != V3
-        assert not(v == v3)
-        assert not(v2 == v3)
+        assert not v == v3
+        assert not v2 == v3
         assert v != v3
         assert v2 != v3
         assert v != v3
diff --git a/test/unit/python/function/test_lagrange_interpolator.py b/test/unit/python/function/test_lagrange_interpolator.py
index df186ca..992d1fa 100755
--- a/test/unit/python/function/test_lagrange_interpolator.py
+++ b/test/unit/python/function/test_lagrange_interpolator.py
@@ -26,10 +26,12 @@ import pytest
 import numpy
 from dolfin import *
 
+
 class Quadratic2D(Expression):
     def eval(self, values, x):
         values[0] = x[0]*x[0] + x[1]*x[1] + 1.0
 
+
 class Quadratic3D(Expression):
     def eval(self, values, x):
         values[0] = x[0]*x[0] + x[1]*x[1] + x[2]*x[2] + 1.0
@@ -38,8 +40,8 @@ class Quadratic3D(Expression):
 def test_functional2D():
     """Test integration of function interpolated in non-matching meshes"""
 
-    f = Quadratic2D()
-    
+    f = Quadratic2D(degree=2)
+
     ll = LagrangeInterpolator()
 
     # Interpolate quadratic function on course mesh
@@ -61,10 +63,11 @@ def test_functional2D():
     ll.interpolate(u1, u0)
     assert round(assemble(u0*dx) - assemble(u1*dx), 10) == 0
 
+
 def test_functional3D():
     """Test integration of function interpolated in non-matching meshes"""
 
-    f = Quadratic3D()
+    f = Quadratic3D(degree=2)
 
     ll = LagrangeInterpolator()
 
diff --git a/test/unit/python/function/test_nonmatching_interpolation.py b/test/unit/python/function/test_nonmatching_interpolation.py
index d63b208..3f9720d 100755
--- a/test/unit/python/function/test_nonmatching_interpolation.py
+++ b/test/unit/python/function/test_nonmatching_interpolation.py
@@ -27,19 +27,22 @@ import numpy
 from dolfin import *
 from dolfin_utils.test import skip_in_parallel
 
+
 class Quadratic2D(Expression):
     def eval(self, values, x):
         values[0] = x[0]*x[0] + x[1]*x[1] + 1.0
 
+
 class Quadratic3D(Expression):
     def eval(self, values, x):
         values[0] = x[0]*x[0] + x[1]*x[1] + x[2]*x[2] + 1.0
 
+
 @skip_in_parallel
 def test_functional2D():
     """Test integration of function interpolated in non-matching meshes"""
 
-    f = Quadratic2D()
+    f = Quadratic2D(degree=2)
 
     # Interpolate quadratic function on course mesh
     mesh0 = UnitSquareMesh(8, 8)
@@ -64,7 +67,7 @@ def test_functional2D():
 def test_functional3D():
     """Test integration of function interpolated in non-matching meshes"""
 
-    f = Quadratic3D()
+    f = Quadratic3D(degree=2)
 
     # Interpolate quadratic function on course mesh
     mesh0 = UnitCubeMesh(4, 4, 4)
diff --git a/test/unit/python/geometry/test_bounding_box_tree.py b/test/unit/python/geometry/test_bounding_box_tree.py
index 0882d15..0a4e382 100755
--- a/test/unit/python/geometry/test_bounding_box_tree.py
+++ b/test/unit/python/geometry/test_bounding_box_tree.py
@@ -26,6 +26,7 @@ import numpy
 from dolfin import BoundingBoxTree
 from dolfin import UnitIntervalMesh, UnitSquareMesh, UnitCubeMesh
 from dolfin import Point
+from dolfin import MeshEntity
 from dolfin import MPI, mpi_comm_world
 from dolfin_utils.test import skip_in_parallel
 
@@ -57,7 +58,12 @@ def test_compute_collisions_point_2d():
         tree = BoundingBoxTree()
         tree.build(mesh, dim)
         entities = tree.compute_collisions(p)
-        assert set(entities) == reference[dim]
+        for e in entities:
+            ent = MeshEntity(mesh, dim, e)
+            mp = ent.midpoint()
+            x = (mp.x(), mp.y())
+            print("test: {}".format(x))
+        #assert set(entities) == reference[dim]
 
 @skip_in_parallel
 def test_compute_collisions_point_3d():
@@ -72,7 +78,12 @@ def test_compute_collisions_point_3d():
         tree = BoundingBoxTree()
         tree.build(mesh, dim)
         entities = tree.compute_collisions(p)
-        assert set(entities) == reference[dim]
+
+        # FIXME: Face and edges tests are excluded because test
+        # mistakingly relies on the face and edge indices
+        tdim = mesh.topology().dim()
+        if dim != tdim - 1 and dim != tdim - 2:
+            assert set(entities) == reference[dim]
 
 
 #--- compute_collisions with tree ---
@@ -318,6 +329,8 @@ def test_compute_first_collision_1d():
 @skip_in_parallel
 def test_compute_first_collision_2d():
 
+    # FIXME: This test should not use facet indices as there are no guarantees
+    # on how DOLFIN numbers facets
     reference = {1: [226],
                   2: [136, 137]}
 
@@ -327,7 +340,11 @@ def test_compute_first_collision_2d():
         tree = BoundingBoxTree()
         tree.build(mesh, dim)
         first = tree.compute_first_collision(p)
-        assert first in reference[dim]
+
+        # FIXME: Facet test is excluded because it mistakingly relies in the
+        # facet indices
+        if dim != mesh.topology().dim() - 1:
+            assert first in reference[dim]
 
     tree = mesh.bounding_box_tree()
     first = tree.compute_first_collision(p)
@@ -336,6 +353,9 @@ def test_compute_first_collision_2d():
 @skip_in_parallel
 def test_compute_first_collision_3d():
 
+    # FIXME: This test should not use facet indices as there are no guarantees
+    # on how DOLFIN numbers facets
+
     reference = {1: [1364],
                   2: [1967, 1968, 1970, 1972, 1974, 1976],
                   3: [876, 877, 878, 879, 880, 881]}
@@ -346,7 +366,12 @@ def test_compute_first_collision_3d():
         tree = BoundingBoxTree()
         tree.build(mesh, dim)
         first = tree.compute_first_collision(p)
-        assert first in reference[dim]
+
+        # FIXME: Face and test is excluded because it mistakingly
+        # relies in the facet indices
+        tdim = mesh.topology().dim()
+        if dim != tdim - 1 and dim != tdim - 2:
+            assert first in reference[dim]
 
     tree = mesh.bounding_box_tree()
     first = tree.compute_first_collision(p)
diff --git a/test/unit/python/geometry/test_coordinates.py b/test/unit/python/geometry/test_coordinates.py
new file mode 100755
index 0000000..b3a634e
--- /dev/null
+++ b/test/unit/python/geometry/test_coordinates.py
@@ -0,0 +1,125 @@
+#!/usr/bin/env py.test
+
+"""Unit tests for coordinates interface"""
+
+# Copyright (C) 2016 Jan Blechta
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+from __future__ import print_function
+import pytest
+import numpy as np
+
+from dolfin import UnitIntervalMesh, UnitSquareMesh, UnitCubeMesh, UnitDiscMesh
+from dolfin import FunctionSpace, VectorFunctionSpace, Function, mpi_comm_world
+from dolfin import get_coordinates, set_coordinates, Mesh
+from dolfin import Expression, interpolate
+from dolfin_utils.test import skip_in_parallel, fixture
+
+
+ at fixture
+def meshes_p1():
+    return UnitIntervalMesh(10), UnitSquareMesh(3, 3), UnitCubeMesh(2, 2, 2)
+
+
+ at fixture
+def meshes_p2():
+    return UnitDiscMesh(mpi_comm_world(), 1, 2, 2), UnitDiscMesh(mpi_comm_world(), 1, 2, 3)
+
+
+def _test_get_set_coordinates(mesh):
+    # Get coords
+    V = FunctionSpace(mesh, mesh.ufl_coordinate_element())
+    c = Function(V)
+    get_coordinates(c, mesh.geometry())
+
+    # Check correctness of got coords
+    _check_coords(mesh, c)
+
+    # Backup and zero coords
+    coords = mesh.coordinates()
+    coords_old = coords.copy()
+    coords[:] = 0.0
+    assert np.all(mesh.coordinates() == 0.0)
+
+    # Set again to old value
+    set_coordinates(mesh.geometry(), c)
+
+    # Check
+    assert np.all(mesh.coordinates() == coords_old)
+
+
+def _check_coords(mesh, c):
+    # FIXME: This does not work for higher-order geometries although it should
+    if mesh.geometry().degree() > 1:
+        return
+
+    # Compare supplied c with interpolation of x
+    class X(Expression):
+        def eval(self, values, x):
+            values[:] = x[:]
+    x = X(domain=mesh, element=mesh.ufl_coordinate_element())
+    x = interpolate(x, c.function_space())
+    x.vector()[:] -= c.vector()
+    assert np.isclose(x.vector().norm("l1"), 0.0)
+
+
+def test_linear(meshes_p1):
+    for mesh in meshes_p1:
+        _test_get_set_coordinates(mesh)
+
+
+ at skip_in_parallel(reason="FunctionSpace(UnitDiscMesh) not working in parallel")
+def test_higher_order(meshes_p2):
+    for mesh in meshes_p2:
+        _test_get_set_coordinates(mesh)
+
+
+def test_raises(meshes_p1):
+    mesh1, mesh2 = meshes_p1[:2]
+
+    # Wrong FE family
+    V = VectorFunctionSpace(mesh2, "Discontinuous Lagrange", 1)
+    c = Function(V)
+    with pytest.raises(RuntimeError):
+        get_coordinates(c, mesh2.geometry())
+    with pytest.raises(RuntimeError):
+        set_coordinates(mesh2.geometry(), c)
+
+    # Wrong value rank
+    V = FunctionSpace(mesh2, "Lagrange", 1)
+    c = Function(V)
+    with pytest.raises(RuntimeError):
+        get_coordinates(c, mesh2.geometry())
+    with pytest.raises(RuntimeError):
+        set_coordinates(mesh2.geometry(), c)
+
+    # Wrong value shape
+    V = VectorFunctionSpace(mesh2, "Lagrange", mesh2.geometry().degree(),
+            dim=mesh2.geometry().dim() - 1)
+    c = Function(V)
+    with pytest.raises(RuntimeError):
+        get_coordinates(c, mesh2.geometry())
+    with pytest.raises(RuntimeError):
+        set_coordinates(mesh2.geometry(), c)
+
+    # Non-matching degree
+    V = VectorFunctionSpace(mesh2, "Lagrange", mesh2.geometry().degree() + 1)
+    c = Function(V)
+    with pytest.raises(RuntimeError):
+        get_coordinates(c, mesh2.geometry())
+    with pytest.raises(RuntimeError):
+        set_coordinates(mesh2.geometry(), c)
diff --git a/test/unit/python/geometry/test_issues.py b/test/unit/python/geometry/test_issues.py
index 2a10da9..0413a23 100755
--- a/test/unit/python/geometry/test_issues.py
+++ b/test/unit/python/geometry/test_issues.py
@@ -37,7 +37,7 @@ def test_issue_97():
     L = 1000
     mesh = BoxMesh(Point(0, 0, 0), Point(L, L, L), N, N, N)
     V = FunctionSpace(mesh, 'CG', 1)
-    v = interpolate(Expression('x[0]'), V)
+    v = interpolate(Expression('x[0]', degree=1), V)
     x = Point(0.5*L, 0.5*L, 0.5*L)
     vx = v(x)
 
diff --git a/test/unit/python/io/test_HDF5.py b/test/unit/python/io/test_HDF5.py
index 685af81..087032d 100755
--- a/test/unit/python/io/test_HDF5.py
+++ b/test/unit/python/io/test_HDF5.py
@@ -168,7 +168,7 @@ def test_save_and_read_function(tempdir):
     Q = FunctionSpace(mesh, "CG", 3)
     F0 = Function(Q)
     F1 = Function(Q)
-    E = Expression("x[0]")
+    E = Expression("x[0]", degree=1)
     F0.interpolate(E)
 
     # Save to HDF5 File
diff --git a/test/unit/python/io/test_HDF5_series.py b/test/unit/python/io/test_HDF5_series.py
index f3e81fb..84a1f69 100644
--- a/test/unit/python/io/test_HDF5_series.py
+++ b/test/unit/python/io/test_HDF5_series.py
@@ -33,7 +33,7 @@ def test_save_and_read_function_timeseries(tempdir):
     Q = FunctionSpace(mesh, "CG", 3)
     F0 = Function(Q)
     F1 = Function(Q)
-    E = Expression("t*x[0]", t = 0.0)
+    E = Expression("t*x[0]", t = 0.0, degree=1)
     F0.interpolate(E)
 
     # Save to HDF5 File
@@ -56,4 +56,3 @@ def test_save_and_read_function_timeseries(tempdir):
         result = F0.vector() - F1.vector()
         assert len(result.array().nonzero()[0]) == 0
     hdf5_file.close()
-
diff --git a/test/unit/python/io/test_SVG.py b/test/unit/python/io/test_SVG.py
index ee44b16..58e81b8 100755
--- a/test/unit/python/io/test_SVG.py
+++ b/test/unit/python/io/test_SVG.py
@@ -38,3 +38,12 @@ def test_write_mesh_3d(cd_tempdir):
     mesh = UnitCubeMesh(8, 8, 8)
     f = File("3d.svg")
     f << mesh
+
+def test_ipython_svg(cd_tempdir):
+    # Test IPython SVG repr hooks
+    mesh2d = UnitSquareMesh(8, 8)
+    svg = mesh2d._repr_svg_()
+    assert '<svg' in svg
+    mesh3d = UnitCubeMesh(8, 8, 8)
+    svg = mesh3d._repr_svg_()
+    assert svg is None
diff --git a/test/unit/python/io/test_X3D.py b/test/unit/python/io/test_X3D.py
index 0bd1f46..9135e20 100755
--- a/test/unit/python/io/test_X3D.py
+++ b/test/unit/python/io/test_X3D.py
@@ -18,6 +18,7 @@
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 
 import pytest
+import numpy
 from dolfin import *
 import os
 from dolfin_utils.test import fixture, cd_tempdir
@@ -50,15 +51,72 @@ def test_save_facet_meshfunction2D(cd_tempdir):
     #with pytest.raises(RuntimeError):
     #    file << mf
 
+
 def test_save_cell_meshfunctio22D(cd_tempdir):
     mesh = UnitCubeMesh(16, 16, 16)
     mf = CellFunction("size_t", mesh, 12)
     file = File("cell_mf3D.x3d")
     file << mf
 
+
 def test_save_facet_meshfunction3D(cd_tempdir):
     mesh = UnitCubeMesh(16, 16, 16)
     mf = FacetFunction("size_t", mesh, 12)
     file = File("facet_mf3D.x3d")
     #with pytest.raises(RuntimeError):
     #    file << mf
+
+
+def test_mesh_str():
+    mesh = UnitCubeMesh(2, 2, 2)
+    str = X3DOM.str(mesh)
+    mesh = UnitSquareMesh(5, 3)
+    str = X3DOM.str(mesh)
+
+
+def test_mesh_html():
+    mesh = UnitCubeMesh(2, 2, 2)
+    str = X3DOM.html(mesh)
+    mesh = UnitSquareMesh(5, 3)
+    str = X3DOM.html(mesh)
+    # test IPython display hook:
+    html = mesh._repr_html_()
+
+
+def test_x3dom_parameters():
+    p = X3DOMParameters()
+
+    # Test Representation
+
+    # Get colour
+    c0 = p.get_diffuse_color()
+
+    # Set colour
+    c0 = [0.1, 0.2, 0.1]
+    p.set_diffuse_color(c0)
+    c1 = p.get_diffuse_color()
+    assert numpy.array_equal(c0, c1)
+
+    c0 = (0.1, 0.2, 0.1)
+    p.set_diffuse_color(c0)
+    c1 = p.get_diffuse_color()
+    assert numpy.array_equal(c0, c1)
+
+    c0 = numpy.array([0.1, 0.2, 0.1])
+    p.set_diffuse_color(c0)
+    c1 = p.get_diffuse_color()
+    assert numpy.array_equal(c0, c1)
+
+    # Test wrong length color sequences
+    with pytest.raises(TypeError):
+        c0 = [0.1, 0.2, 0.1, 0.2]
+        p.set_diffuse_color(c0)
+
+    with pytest.raises(TypeError):
+        c0 = [0.1, 0.2]
+        p.set_diffuse_color(c0)
+
+    # Test invalid RGB value
+    with pytest.raises(RuntimeError):
+        c0 = [0.1, 0.2, 1.2]
+        p.set_diffuse_color(c0)
diff --git a/test/unit/python/io/test_XDMF.py b/test/unit/python/io/test_XDMF.py
index 9fb6ed9..e160bc6 100755
--- a/test/unit/python/io/test_XDMF.py
+++ b/test/unit/python/io/test_XDMF.py
@@ -22,324 +22,322 @@ import os
 from dolfin import *
 from dolfin_utils.test import skip_if_not_HDF5, skip_in_parallel, fixture, tempdir
 
+# Currently supported XDMF file encoding
+encodings = (XDMFFile.Encoding_HDF5, XDMFFile.Encoding_ASCII)
 
- at skip_if_not_HDF5
-def test_save_and_load_1d_mesh(tempdir):
+
+def invalid_config(encoding):
+    return (not has_hdf5() and encoding == XDMFFile.Encoding_HDF5) \
+        or (encoding == XDMFFile.Encoding_ASCII and MPI.size(mpi_comm_world()) > 1)
+
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_and_load_1d_mesh(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "mesh.xdmf")
     mesh = UnitIntervalMesh(32)
 
-    file = File(filename)
-    file << mesh
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mesh
+    file.write(mesh, encoding)
     del file
 
-    mesh2 = Mesh(filename)
+    mesh2 = Mesh()
+    file = XDMFFile(mpi_comm_world(), filename)
+    file.read(mesh2, False)
     assert mesh.size_global(0) == mesh2.size_global(0)
     dim = mesh.topology().dim()
     assert mesh.size_global(dim) == mesh2.size_global(dim)
 
- at skip_if_not_HDF5
-def test_save_and_load_2d_mesh(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_and_load_2d_mesh(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "mesh_2D.xdmf")
     mesh = UnitSquareMesh(32, 32)
 
-    file = File(filename)
-    file << mesh
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mesh
+    file.write(mesh, encoding)
     del file
 
-    mesh2 = Mesh(filename)
+    mesh2 = Mesh()
+    file = XDMFFile(mpi_comm_world(), filename)
+    file.read(mesh2, False)
     assert mesh.size_global(0) == mesh2.size_global(0)
     dim = mesh.topology().dim()
     assert mesh.size_global(dim) == mesh2.size_global(dim)
 
- at skip_if_not_HDF5
-def test_save_and_load_3d_mesh(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_and_load_3d_mesh(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "mesh_3D.xdmf")
     mesh = UnitCubeMesh(8, 8, 8)
 
-    file = File(filename)
-    file << mesh
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mesh
+    file.write(mesh, encoding)
     del file
 
-    mesh2 = Mesh(filename)
+    mesh2 = Mesh()
+    file = XDMFFile(mpi_comm_world(), filename)
+    file.read(mesh2, False)
     assert mesh.size_global(0) == mesh2.size_global(0)
     dim = mesh.topology().dim()
     assert mesh.size_global(dim) == mesh2.size_global(dim)
 
- at skip_if_not_HDF5
-def test_save_1d_scalar(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_1d_scalar(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename1 = os.path.join(tempdir, "u1.xdmf")
     filename2 = os.path.join(tempdir, "u1_.xdmf")
     mesh = UnitIntervalMesh(32)
-    V = FunctionSpace(mesh, "Lagrange", 2) # FIXME: This randomly hangs in parallel
+    V = FunctionSpace(mesh, "Lagrange", 2)  # FIXME: This randomly hangs in parallel
     u = Function(V)
     u.vector()[:] = 1.0
 
-    file = File(filename1)
-    file << u
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename2)
-    file << u
+    file.write(u, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_2d_scalar(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_2d_scalar(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "u2.xdmf")
     mesh = UnitSquareMesh(16, 16)
     V = FunctionSpace(mesh, "Lagrange", 2)  # FIXME: This randomly hangs in parallel
     u = Function(V)
     u.vector()[:] = 1.0
 
-    file = File(mesh.mpi_comm(), filename)
-    file << u
-    del file
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << u
+    file.write(u, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_3d_scalar(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_3d_scalar(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "u3.xdmf")
     mesh = UnitCubeMesh(8, 8, 8)
     V = FunctionSpace(mesh, "Lagrange", 2)
     u = Function(V)
     u.vector()[:] = 1.0
-    file = File(mesh.mpi_comm(), filename)
-    file << u
-    del file
+
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << u
+    file.write(u, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_2d_vector(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_2d_vector(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "u_2dv.xdmf")
     mesh = UnitSquareMesh(16, 16)
     V = VectorFunctionSpace(mesh, "Lagrange", 2)
     u = Function(V)
     c = Constant((1.0, 2.0))
     u.interpolate(c)
-    file = File(mesh.mpi_comm(), filename)
-    file << u
-    del file
+
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << u
+    file.write(u, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_3d_vector(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_3d_vector(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "u_3Dv.xdmf")
-    mesh = UnitCubeMesh(1, 1, 1)
+    mesh = UnitCubeMesh(2, 2, 2)
     u = Function(VectorFunctionSpace(mesh, "Lagrange", 1))
     c = Constant((1.0, 2.0, 3.0))
     u.interpolate(c)
-    file = File(mesh.mpi_comm(), filename)
-    file << u
-    del file
+
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << u
+    file.write(u, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_3d_vector_series(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_3d_vector_series(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "u_3D.xdmf")
     mesh = UnitCubeMesh(8, 8, 8)
     u = Function(VectorFunctionSpace(mesh, "Lagrange", 2))
-    file = File(mesh.mpi_comm(), filename)
-
-    u.vector()[:] = 1.0
-    file << (u, 0.1)
-
-    u.vector()[:] = 2.0
-    file << (u, 0.2)
-
-    u.vector()[:] = 3.0
-    file << (u, 0.3)
-
-    del file
 
     file = XDMFFile(mesh.mpi_comm(), filename)
 
     u.vector()[:] = 1.0
-    file << (u, 0.1)
+    file.write(u, 0.1, encoding)
 
     u.vector()[:] = 2.0
-    file << (u, 0.2)
+    file.write(u, 0.2, encoding)
 
     u.vector()[:] = 3.0
-    file << (u, 0.3)
+    file.write(u, 0.3, encoding)
 
     del file
 
- at skip_if_not_HDF5
-def test_save_2d_tensor(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_2d_tensor(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "tensor.xdmf")
     mesh = UnitSquareMesh(16, 16)
     u = Function(TensorFunctionSpace(mesh, "Lagrange", 2))
     u.vector()[:] = 1.0
 
-    file = File(mesh.mpi_comm(), filename)
-    file << u
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << u
+    file.write(u, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_3d_tensor(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_3d_tensor(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "u3t.xdmf")
     mesh = UnitCubeMesh(8, 8, 8)
     u = Function(TensorFunctionSpace(mesh, "Lagrange", 2))
     u.vector()[:] = 1.0
-    file = File(mesh.mpi_comm(), filename)
-    file << u
-    del file
+
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << u
+    file.write(u, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_1d_mesh(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_1d_mesh(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "mf_1D.xdmf")
     mesh = UnitIntervalMesh(32)
     mf = CellFunction("size_t", mesh)
     for cell in cells(mesh):
         mf[cell] = cell.index()
 
-    file = File(mesh.mpi_comm(), filename)
-    file << mf
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mf
+    file.write(mf, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_2D_cell_function(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_2D_cell_function(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "mf_2D.xdmf")
     mesh = UnitSquareMesh(32, 32)
     mf = CellFunction("size_t", mesh)
     for cell in cells(mesh):
         mf[cell] = cell.index()
 
-    file = File(mesh.mpi_comm(), filename)
-    file << mf
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mf
+    file.write(mf, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_3D_cell_function(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_3D_cell_function(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     mesh = UnitCubeMesh(8, 8, 8)
     mf = CellFunction("size_t", mesh)
     for cell in cells(mesh):
         mf[cell] = cell.index()
     filename = os.path.join(tempdir, "mf_3D.xdmf")
 
-    file = File(mesh.mpi_comm(), filename)
-    file << mf
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mf
+    file.write(mf, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_2D_facet_function(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_2D_facet_function(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     mesh = UnitSquareMesh(32, 32)
     mf = FacetFunction("size_t", mesh)
     for facet in facets(mesh):
         mf[facet] = facet.index()
     filename = os.path.join(tempdir, "mf_facet_2D.xdmf")
 
-    file = File(mesh.mpi_comm(), filename)
-    file << mf
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mf
+    file.write(mf, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_3D_facet_function(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_3D_facet_function(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     mesh = UnitCubeMesh(8, 8, 8)
     mf = FacetFunction("size_t", mesh)
     for facet in facets(mesh):
         mf[facet] = facet.index()
     filename = os.path.join(tempdir, "mf_facet_3D.xdmf")
 
-    file = File(mesh.mpi_comm(), filename)
-    file << mf
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mf
+    file.write(mf, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_3D_edge_function(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_3D_edge_function(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     mesh = UnitCubeMesh(8, 8, 8)
     mf = EdgeFunction("size_t", mesh)
     for edge in edges(mesh):
         mf[edge] = edge.index()
 
-    file = File(mesh.mpi_comm(), os.path.join(tempdir, "mf_edge_3D.xdmf"))
-    file << mf
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), os.path.join(tempdir, "mf_edge_3D.xdmf"))
-    file << mf
+    file.write(mf, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_2D_vertex_function(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_2D_vertex_function(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     mesh = UnitSquareMesh(32, 32)
     mf = VertexFunction("size_t", mesh)
     for vertex in vertices(mesh):
         mf[vertex] = vertex.index()
     filename = os.path.join(tempdir, "mf_vertex_2D.xdmf")
 
-    file = File(mesh.mpi_comm(), filename)
-    file << mf
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mf
+    file.write(mf, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_3D_vertex_function(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_3D_vertex_function(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     filename = os.path.join(tempdir, "mf_vertex_3D.xdmf")
     mesh = UnitCubeMesh(8, 8, 8)
     mf = VertexFunction("size_t", mesh)
     for vertex in vertices(mesh):
         mf[vertex] = vertex.index()
 
-    file = File(mesh.mpi_comm(), filename)
-    file << mf
-    del file
-
     file = XDMFFile(mesh.mpi_comm(), filename)
-    file << mf
+    file.write(mf, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_points_2D(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_points_2D(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     import numpy
     mesh = UnitSquareMesh(16, 16)
     points, values = [], []
@@ -349,15 +347,24 @@ def test_save_points_2D(tempdir):
     vals = numpy.array(values)
 
     file = XDMFFile(mesh.mpi_comm(), os.path.join(tempdir, "points_2D.xdmf"))
-    file.write(points)
+    if encoding == XDMFFile.Encoding_ASCII: # Not implemented
+        with pytest.raises(RuntimeError):
+            file.write(points, encoding)
+    else:
+        file.write(points, encoding)
     del file
 
-    file = XDMFFile(mesh.mpi_comm(), os.path.join(tempdir, "points_values_2D.xdmf"))
-    file.write(points, vals)
+    file = XDMFFile(mesh.mpi_comm(), os.path.join(tempdir,
+                                                  "points_values_2D.xdmf"))
+
+    file.write(points, vals, encoding)
     del file
 
- at skip_if_not_HDF5
-def test_save_points_3D(tempdir):
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_points_3D(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
     import numpy
     mesh = UnitCubeMesh(4, 4, 4)
     points, values = [], []
@@ -367,9 +374,44 @@ def test_save_points_3D(tempdir):
     vals = numpy.array(values)
 
     file = XDMFFile(mesh.mpi_comm(), os.path.join(tempdir, "points_3D.xdmf"))
-    file.write(points)
+    if encoding == XDMFFile.Encoding_ASCII: # Not implemented
+        with pytest.raises(RuntimeError):
+            file.write(points, encoding)
+    else:
+        file.write(points, encoding)
     del file
 
     file = XDMFFile(mesh.mpi_comm(), os.path.join(tempdir, "points_values_3D.xdmf"))
-    file.write(points, vals)
+
+    file.write(points, vals, encoding)
     del file
+
+
+ at pytest.mark.parametrize("encoding", encodings)
+def test_save_mesh_value_collection(tempdir, encoding):
+    if invalid_config(encoding):
+        pytest.xfail("XDMF unsupported in current configuration")
+    mesh = UnitCubeMesh(4, 4, 4)
+    tdim = mesh.topology().dim()
+
+    meshfn = CellFunction("size_t", mesh, 0)
+    meshfn.rename("volume_marker", "Volume Markers")
+    for c in cells(mesh):
+        if c.midpoint().y() > 0.1:
+            meshfn[c] = 1
+        if c.midpoint().y() > 0.9:
+            meshfn[c] = 2
+
+    for mvc_dim in range(0, tdim + 1):
+        mvc = MeshValueCollection("size_t", mesh, 2)
+        mvc.rename("dim_%d_marker" % mvc_dim, "BC")
+        mesh.init(mvc_dim, tdim)
+        for e in cpp.entities(mesh, mvc_dim):
+            if (e.midpoint().x() > 0.5):
+                mvc.set_value(e.index(), 1)
+
+        xdmf = XDMFFile(mesh.mpi_comm(), os.path.join(tempdir, "mvc_%d.xdmf"
+                                                      % mvc_dim))
+        xdmf.parameters['time_series'] = False
+        xdmf.write(meshfn, encoding)
+        xdmf.write(mvc, encoding)
diff --git a/test/unit/python/io/test_XDMF_cell_output.py b/test/unit/python/io/test_XDMF_cell_output.py
index 3f98f0b..2ff9188 100644
--- a/test/unit/python/io/test_XDMF_cell_output.py
+++ b/test/unit/python/io/test_XDMF_cell_output.py
@@ -30,11 +30,11 @@ def test_xdmf_cell_scalar_ghost(cd_tempdir, ghost_mode):
     mesh = UnitSquareMesh(n, n)
     Q = FunctionSpace(mesh, "DG", 0)
     F = Function(Q)
-    E = Expression("x[0]")
+    E = Expression("x[0]", degree=1)
     F.interpolate(E)
 
-    xdmf = File("dg0.xdmf")
-    xdmf << F
+    xdmf = XDMFFile(mesh.mpi_comm(), "dg0.xdmf")
+    xdmf.write(F)
     del xdmf
 
     hdf = HDF5File(mesh.mpi_comm(), "dg0.h5", "r")
diff --git a/test/unit/python/io/test_XMLFunction.py b/test/unit/python/io/test_XMLFunction.py
index ca442f2..55c08de 100755
--- a/test/unit/python/io/test_XMLFunction.py
+++ b/test/unit/python/io/test_XMLFunction.py
@@ -26,7 +26,7 @@ def test_save_and_read_xml_function(cd_tempdir):
     Q = FunctionSpace(mesh, "CG", 3)
     F0 = Function(Q)
     F1 = Function(Q)
-    E = Expression("x[0]")
+    E = Expression("x[0]", degree=1)
     F0.interpolate(E)
 
     # Save to XML File
diff --git a/test/unit/python/jit/test_jit.py b/test/unit/python/jit/test_jit.py
index 0844334..8589a3f 100755
--- a/test/unit/python/jit/test_jit.py
+++ b/test/unit/python/jit/test_jit.py
@@ -23,12 +23,13 @@ import pytest
 from dolfin import *
 from dolfin_utils.test import skip_if_not_PETSc, skip_in_serial, skip_if_not_petsc4py
 
+
 def test_nasty_jit_caching_bug():
 
     # This may result in something like "matrices are not aligned"
     # from FIAT if the JIT caching does not recognize that the two
     # forms are different
-    
+
     default_parameters = parameters["form_compiler"]["representation"]
     for representation in ["tensor", "quadrature"]:
 
@@ -42,13 +43,13 @@ def test_nasty_jit_caching_bug():
 
     parameters["form_compiler"]["representation"] = default_parameters
 
+
 @skip_if_not_PETSc
 def test_compile_extension_module():
 
-    # This test should do basically the same as the docstring of
-    # the compile_extension_module function in compilemodule.py.
-    # Remember to update the docstring if the test is modified!
-
+    # This test should do basically the same as the docstring of the
+    # compile_extension_module function in compilemodule.py.  Remember
+    # to update the docstring if the test is modified!
 
     from numpy import arange, exp
     code = """
@@ -82,13 +83,14 @@ def test_compile_extension_module_kwargs():
     m0 = compile_extension_module('', cppargs='')
     assert not m2.__file__ == m0.__file__
 
+
 @skip_if_not_petsc4py
 @skip_in_serial
 def test_mpi_dependent_jiting():
     # FIXME: Not a proper unit test...
     from dolfin import Expression, UnitSquareMesh, Function, TestFunction, \
          Form, FunctionSpace, dx, CompiledSubDomain, SubSystemsManager
-    
+
     # Init petsc (needed to initalize petsc and slepc collectively on
     # all processes)
     SubSystemsManager.init_petsc()
@@ -102,7 +104,7 @@ def test_mpi_dependent_jiting():
         import petsc4py.PETSc as petsc
     except:
         return
-    
+
     # Set communicator and get process information
     comm = mpi.COMM_WORLD
     group = comm.Get_group()
@@ -114,17 +116,18 @@ def test_mpi_dependent_jiting():
 
     rank = comm.Get_rank()
     group_comm_0 = petsc.Comm(comm.Create(group.Incl(range(1))))
-    group_comm_1 = petsc.Comm(comm.Create(group.Incl(range(1,2))))
+    group_comm_1 = petsc.Comm(comm.Create(group.Incl(range(1, 2))))
 
     if size > 2:
         group_comm_2 = petsc.Comm(comm.Create(group.Incl(range(2,size))))
 
     if rank == 0:
-        e = Expression("4", mpi_comm=group_comm_0)
+        e = Expression("4", mpi_comm=group_comm_0, degree=0)
 
     elif rank == 1:
-        e = Expression("5", mpi_comm=group_comm_1)
-        domain = CompiledSubDomain("on_boundary", mpi_comm=group_comm_1)
+        e = Expression("5", mpi_comm=group_comm_1, degree=0)
+        domain = CompiledSubDomain("on_boundary", mpi_comm=group_comm_1,
+                                   degree=0)
 
     else:
         mesh = UnitSquareMesh(group_comm_2, 2, 2)
diff --git a/test/unit/python/la/test_krylov_solver.py b/test/unit/python/la/test_krylov_solver.py
index 4d2e16e..e18a1d9 100755
--- a/test/unit/python/la/test_krylov_solver.py
+++ b/test/unit/python/la/test_krylov_solver.py
@@ -22,14 +22,14 @@
 from __future__ import print_function
 import pytest
 from dolfin import *
-from dolfin_utils.test import skip_if_not_PETSc, skip_in_parallel
+from dolfin_utils.test import skip_if_not_PETSc, skip_in_parallel, pushpop_parameters
+
 
 @skip_if_not_PETSc
-def test_krylov_samg_solver_elasticity():
+def test_krylov_samg_solver_elasticity(pushpop_parameters):
     "Test PETScKrylovSolver with smoothed aggregation AMG"
 
     # Set backend
-    previous_backend = parameters["linear_algebra_backend"]
     parameters["linear_algebra_backend"] = "PETSc"
 
     def build_nullspace(V, x):
@@ -39,17 +39,19 @@ def test_krylov_samg_solver_elasticity():
         nullspace_basis = [x.copy() for i in range(3)]
 
         # Build translational null space basis
-        V.sub(0).dofmap().set(nullspace_basis[0], 1.0);
-        V.sub(1).dofmap().set(nullspace_basis[1], 1.0);
+        V.sub(0).dofmap().set(nullspace_basis[0], 1.0)
+        V.sub(1).dofmap().set(nullspace_basis[1], 1.0)
 
         # Build rotational null space basis
-        V.sub(0).dofmap().set_x(nullspace_basis[2], -1.0, 1, V.mesh());
-        V.sub(1).dofmap().set_x(nullspace_basis[2], 1.0, 0, V.mesh());
+        V.sub(0).set_x(nullspace_basis[2], -1.0, 1)
+        V.sub(1).set_x(nullspace_basis[2], 1.0, 0)
 
         for x in nullspace_basis:
             x.apply("insert")
 
-        return VectorSpaceBasis(nullspace_basis)
+        null_space = VectorSpaceBasis(nullspace_basis)
+        null_space.orthonormalize()
+        return null_space
 
     def amg_solve(N, method):
         # Elasticity parameters
@@ -79,13 +81,18 @@ def test_krylov_samg_solver_elasticity():
         # Create solution function
         u = Function(V)
 
-        # Create near null space basis
+        # Create near null space basis and orthonormalize
         null_space = build_nullspace(V, u.vector())
 
-        # Create PETSC smoothed aggregation AMG preconditioner,
-        # attach near null space and create CG solver
+        # Attached near-null space to matrix
+        as_backend_type(A).set_near_nullspace(null_space)
+
+        # Test that basis is orthonormal
+        assert null_space.is_orthonormal()
+
+        # Create PETSC smoothed aggregation AMG preconditioner, and
+        # create CG solver
         pc = PETScPreconditioner(method)
-        pc.set_nullspace(null_space)
         solver = PETScKrylovSolver("cg", pc)
 
         # Set matrix operator
@@ -94,52 +101,32 @@ def test_krylov_samg_solver_elasticity():
         # Compute solution and return number of iterations
         return solver.solve(u.vector(), b)
 
-
     # Set some multigrid smoother parameters
     PETScOptions.set("mg_levels_ksp_type", "chebyshev")
     PETScOptions.set("mg_levels_pc_type", "jacobi")
 
-    # Improve estimate of eigenvalues for Chebyshev smoothing (PETSc
-    # version<3.6 option)
-    PETScOptions.set("mg_levels_est_ksp_type", "cg")
-    PETScOptions.set("mg_levels_est_ksp_max_it", 50)
-    PETScOptions.set("gamg_est_ksp_type", "cg")
-    PETScOptions.set("gamg_est_ksp_max_it", 50)
-
-    # Improve estimate of eigenvalues for Chebyshev smoothing (more
-    # recent PETSc option)
+    # Improve estimate of eigenvalues for Chebyshev smoothing
+    PETScOptions.set("mg_levels_esteig_ksp_type", "cg")
     PETScOptions.set("mg_levels_ksp_chebyshev_esteig_steps", 50)
 
     # Build list of smoothed aggregation preconditioners
     methods = ["petsc_amg"]
-    if "ml_amg" in PETScPreconditioner.preconditioners():
-        methods.append("ml_amg")
+    # if "ml_amg" in PETScPreconditioner.preconditioners():
+    #    methods.append("ml_amg")
 
     # Test iteration count with increasing mesh size for each
     # preconditioner
     for method in methods:
-        for N in [4, 8, 16, 32, 64]:
+        for N in [8, 16, 32, 64]:
             print("Testing method '{}' with {} x {} mesh".format(method, N, N))
             niter = amg_solve(N, method)
-            assert niter < 12
-
-    parameters["linear_algebra_backend"] = previous_backend
+            assert niter < 18
 
 
 @skip_if_not_PETSc
 def test_krylov_reuse_pc():
     "Test preconditioner re-use with PETScKrylovSolver"
 
-    # Test requires PETSc version 3.5 or later. Use petsc4py to check
-    # version number.
-    try:
-        from petsc4py import PETSc
-    except ImportError:
-        pytest.skip("petsc4py required to check PETSc version")
-    else:
-        if not PETSc.Sys.getVersion() >= (3, 5, 0):
-            pytest.skip("PETSc version must be 3.5  of higher")
-
     # Define problem
     mesh = UnitSquareMesh(8, 8)
     V = FunctionSpace(mesh, 'Lagrange', 1)
@@ -204,3 +191,65 @@ def test_krylov_reuse_pc():
     x = PETScVector()
     num_iter = solver.solve(x, b)
     assert num_iter == num_iter_mod
+
+
+def test_krylov_tpetra():
+    if not has_linear_algebra_backend("Tpetra"):
+        return
+
+    mesh = UnitCubeMesh(10, 10, 10)
+    Q = FunctionSpace(mesh, "CG", 1)
+    v = TestFunction(Q)
+    u = TrialFunction(Q)
+    a = dot(grad(u), grad(v))*dx
+    L = v*dx
+
+    def bound(x):
+        return x[0] == 0
+
+    bc = DirichletBC(Q, Constant(0.0), bound)
+
+    A = TpetraMatrix()
+    b = TpetraVector()
+    assemble(a, A)
+    assemble(L, b)
+    bc.apply(A)
+    bc.apply(b)
+
+    mp = MueluPreconditioner()
+    mlp = mp.parameters
+    mlp['verbosity'] = 'extreme'
+    mlp.add("max_levels", 10)
+    mlp.add("coarse:_max_size", 10)
+    mlp.add("coarse:_type", "KLU2")
+    mlp.add("multigrid_algorithm", "sa")
+    mlp.add("aggregation:_type", "uncoupled")
+    mlp.add("aggregation:_min_agg_size", 3)
+    mlp.add("aggregation:_max_agg_size", 7)
+
+    pre_paramList = Parameters("smoother:_pre_params")
+    pre_paramList.add("relaxation:_type", "Symmetric Gauss-Seidel")
+    pre_paramList.add("relaxation:_sweeps", 1)
+    pre_paramList.add("relaxation:_damping_factor", 0.6)
+    mlp.add("smoother:_pre_type", "RELAXATION")
+    mlp.add(pre_paramList)
+
+    post_paramList = Parameters("smoother:_post_params")
+    post_paramList.add("relaxation:_type", "Symmetric Gauss-Seidel")
+    post_paramList.add("relaxation:_sweeps", 1)
+    post_paramList.add("relaxation:_damping_factor", 0.9)
+    mlp.add("smoother:_post_type", "RELAXATION")
+    mlp.add(post_paramList)
+
+    solver = BelosKrylovSolver("cg", mp)
+    solver.parameters['relative_tolerance'] = 1e-8
+    solver.parameters['monitor_convergence'] = False
+    solver.parameters['belos'].add("Maximum_Iterations", 150)
+
+    solver.set_operator(A)
+
+    u = TpetraVector()
+    n_iter = solver.solve(u, b)
+
+    # Number of iterations should be around 15
+    assert n_iter < 50
diff --git a/test/unit/python/la/test_la_basic.py b/test/unit/python/la/test_la_basic.py
index d8a92e1..de4cd15 100755
--- a/test/unit/python/la/test_la_basic.py
+++ b/test/unit/python/la/test_la_basic.py
@@ -32,23 +32,13 @@ from dolfin_utils.test import *
 
 # Lists of backends supporting or not supporting data access
 data_backends = []
-no_data_backends = [("PETSc", "")]
+no_data_backends = [("PETSc", ""), ("Tpetra", "")]
 
 # Add serial only backends
 if MPI.size(mpi_comm_world()) == 1:
     # TODO: What about "Dense" and "Sparse"? The sub_backend wasn't
     # used in the old test.
     data_backends += [("Eigen", "")]
-    no_data_backends += [("PETScCusp", "")]
-
-# TODO: STL tests were disabled in old test framework, and do not work now:
-# If we have PETSc, STL Vector gets typedefed to one of these and data
-# test will not work. If none of these backends are available
-# STLVector defaults to EigenVEctor, which data will work
-#if has_linear_algebra_backend("PETSc"):
-#    no_data_backends += [("STL", "")]
-#else:
-#    data_backends += [("STL", "")]
 
 # Remove backends we haven't built with
 data_backends = [b for b in data_backends if has_linear_algebra_backend(b[0])]
diff --git a/test/unit/python/la/test_linear_operator.py b/test/unit/python/la/test_linear_operator.py
index 5637315..aa31927 100755
--- a/test/unit/python/la/test_linear_operator.py
+++ b/test/unit/python/la/test_linear_operator.py
@@ -26,6 +26,7 @@ from dolfin_utils.test import *
 
 backends = ["PETSc"]
 
+
 # Backends supporting the LinearOperator interface
 @pytest.mark.parametrize('backend', backends)
 def test_linear_operator(backend):
diff --git a/test/unit/python/la/test_matrix.py b/test/unit/python/la/test_matrix.py
index 63ed079..4021be5 100755
--- a/test/unit/python/la/test_matrix.py
+++ b/test/unit/python/la/test_matrix.py
@@ -34,24 +34,13 @@ from dolfin_utils.test import *
 # Lists of backends supporting or not supporting FooMatrix::data()
 # access
 data_backends = []
-no_data_backends = [("PETSc", "")]
+no_data_backends = [("PETSc", ""), ("Tpetra", "")]
 
 # Add serial only backends
 if MPI.size(mpi_comm_world()) == 1:
     # TODO: What about "Dense" and "Sparse"? The sub_backend wasn't
     # used in the old test.
     data_backends += [("Eigen", "")]
-    no_data_backends += [("PETScCusp", "")]
-
-
-# TODO: STL tests were disabled in old test framework, and do not work now:
-# If we have PETSc, STL Vector gets typedefed to one of these and data
-# test will not work. If none of these backends are available
-# STLVector defaults to EigenVEctor, which data will work
-#if has_linear_algebra_backend("PETSc"):
-#    no_data_backends += [("STL", "")]
-#else:
-#    data_backends += [("STL", "")]
 
 # Remove backends we haven't built with
 data_backends = [b for b in data_backends if has_linear_algebra_backend(b[0])]
@@ -197,21 +186,6 @@ class TestMatrixForAnyBackend:
             except ImportError:
                 pass
 
-    #def create_sparsity_pattern(self):
-    #    "Create a sparsity pattern"
-    #    mesh = UnitSquareMesh(34, 33)
-    #
-    #    V = FunctionSpace(mesh, "Lagrange", 2)
-    #    W = FunctionSpace(mesh, "Lagrange", 1)
-    #
-    #    v = TestFunction(V)
-    #    u = TrialFunction(V)
-    #    s = TrialFunction(W)
-    #
-    #    # Forms
-    #    a = dot(grad(u), grad(v))*dx
-    #    b = v*s*dx
-
     def test_create_empty_matrix(self, any_backend):
         A = Matrix()
         assert A.size(0) == 0
@@ -238,15 +212,13 @@ class TestMatrixForAnyBackend:
         assert B0.size(1) == B1.size(1)
         assert round(B0.norm("frobenius") - B1.norm("frobenius"), 7) == 0
 
-    @pytest.mark.skipif(MPI.size(mpi_comm_world()) > 1, reason="Disabled because it tends to crash the tests in parallel.")
-    @pytest.mark.slow
     def test_ident_zeros(self, use_backend, any_backend):
         self.backend, self.sub_backend = any_backend
 
         # Check that PETScMatrix::ident_zeros() rethrows PETSc error
         if self.backend[0:5] == "PETSc":
             A, B = self.assemble_matrices(use_backend=use_backend)
-            with pytest.raises(Exception):
+            with pytest.raises(RuntimeError):
                 A.ident_zeros()
 
         # Assemble matrix A with diagonal entries
@@ -368,3 +340,9 @@ class TestMatrixForAnyBackend:
         A, B = self.assemble_matrices()
         assert A.nnz() == 2992
         assert B.nnz() == 9398
+
+        A, B = self.assemble_matrices(keep_diagonal=True)
+        assert A.nnz() == 4589
+        # NOTE: Following should never be tested because diagonal is not
+        #       invariant w.r.t. different row and column dof reordering!
+        #assert B.nnz() == ??
diff --git a/test/unit/python/la/test_nullspace.py b/test/unit/python/la/test_nullspace.py
index c9be89a..54fa8e5 100755
--- a/test/unit/python/la/test_nullspace.py
+++ b/test/unit/python/la/test_nullspace.py
@@ -26,20 +26,39 @@ from dolfin_utils.test import *
 backends = ["PETSc", skip_in_parallel("Eigen")]
 
 def build_elastic_nullspace(V, x):
-    """Function to build nullspace for 2D elasticity"""
+    """Function to build nullspace for 2D/3D elasticity"""
+
+    # Get geometric dim
+    gdim = V.mesh().geometry().dim()
+    assert gdim == 2 or gdim == 3
+
+    # Set dimension of nullspace
+    dim = 3 if gdim == 2 else 6
 
     # Create list of vectors for null space
-    nullspace_basis = [x.copy() for i in range(3)]
+    nullspace_basis = [x.copy() for i in range(dim)]
 
     # Build translational null space basis
-    V.sub(0).dofmap().set(nullspace_basis[0], 1.0);
-    V.sub(1).dofmap().set(nullspace_basis[1], 1.0);
+    for i in range(gdim):
+        V.sub(i).dofmap().set(nullspace_basis[i], 1.0);
 
     # Build rotational null space basis
-    V.sub(0).dofmap().set_x(nullspace_basis[2], -1.0, 1, V.mesh());
-    V.sub(1).dofmap().set_x(nullspace_basis[2], 1.0, 0, V.mesh());
+    if gdim == 2:
+        V.sub(0).set_x(nullspace_basis[2], -1.0, 1);
+        V.sub(1).set_x(nullspace_basis[2], 1.0, 0);
+    elif gdim == 3:
+        V.sub(0).set_x(nullspace_basis[3], -1.0, 1);
+        V.sub(1).set_x(nullspace_basis[3],  1.0, 0);
+
+        V.sub(0).set_x(nullspace_basis[4],  1.0, 2);
+        V.sub(2).set_x(nullspace_basis[4], -1.0, 0);
+
+        V.sub(2).set_x(nullspace_basis[5],  1.0, 1);
+        V.sub(1).set_x(nullspace_basis[5], -1.0, 2);
+
     for x in nullspace_basis:
         x.apply("insert")
+
     return VectorSpaceBasis(nullspace_basis)
 
 
@@ -54,17 +73,41 @@ def build_broken_elastic_nullspace(V, x):
     V.sub(1).dofmap().set(nullspace_basis[1], 1.0);
 
     # Build rotational null space basis
-    V.sub(0).dofmap().set_x(nullspace_basis[2], -1.0, 1, V.mesh());
-    V.sub(1).dofmap().set_x(nullspace_basis[2], 1.0, 0, V.mesh());
+    V.sub(0).set_x(nullspace_basis[2], -1.0, 1);
+    V.sub(1).set_x(nullspace_basis[2], 1.0, 0);
 
     # Add vector that is not in nullspace
-    V.sub(1).dofmap().set_x(nullspace_basis[3], 1.0, 1, V.mesh());
+    V.sub(1).set_x(nullspace_basis[3], 1.0, 1);
 
     for x in nullspace_basis:
         x.apply("insert")
     return VectorSpaceBasis(nullspace_basis)
 
 
+def test_nullspace_orthogonal():
+    """Test that null spaces orthogonalisation"""
+    meshes = [UnitSquareMesh(12, 12), UnitCubeMesh(4, 4, 4)]
+    for mesh in meshes:
+        for p in range(1, 4):
+            V = VectorFunctionSpace(mesh, 'CG', p)
+            zero = Constant([0.0]*mesh.geometry().dim())
+            L = dot(TestFunction(V), zero)*dx
+            x = assemble(L)
+
+            # Build nullspace
+            null_space = build_elastic_nullspace(V, x)
+
+            assert not null_space.is_orthogonal()
+            assert not null_space.is_orthonormal()
+
+            # Orthogonalise nullspace
+            null_space.orthonormalize()
+
+            # Checl that null space basis is orthonormal
+            assert null_space.is_orthogonal()
+            assert null_space.is_orthonormal()
+
+
 @pytest.mark.parametrize('backend', backends)
 def test_nullspace_check(backend):
     # Check whether backend is available
diff --git a/test/unit/python/la/test_petsc.py b/test/unit/python/la/test_petsc.py
index fb441c6..91ece31 100755
--- a/test/unit/python/la/test_petsc.py
+++ b/test/unit/python/la/test_petsc.py
@@ -23,10 +23,83 @@ GenericFoo interface"""
 from __future__ import print_function
 import pytest
 from dolfin import *
-from dolfin_utils.test import skip_if_not_PETSc, skip_in_parallel
+from dolfin_utils.test import skip_if_not_PETSc, skip_in_parallel, pushpop_parameters
+
+
+ at skip_if_not_PETSc
+def test_vector():
+    "Test PETScVector interface"
+
+    prefix = "my_vector_"
+    x = PETScVector(mpi_comm_world())
+    x.set_options_prefix(prefix)
+
+    assert x.get_options_prefix() == prefix
+    x.init(mpi_comm_world(), 300)
+    assert x.get_options_prefix() == prefix
+
+
+def test_krylov_solver_norm_type():
+    "Check setting of norm type used in testing for convergence by PETScKrylovSolver"
+
+    norm_type = (PETScKrylovSolver.norm_type_default_norm,
+                 PETScKrylovSolver.norm_type_natural,
+                 PETScKrylovSolver.norm_type_preconditioned,
+                 PETScKrylovSolver.norm_type_none,
+                 PETScKrylovSolver.norm_type_unpreconditioned)
+    for norm in norm_type:
+        # Solve a system of equations
+        mesh = UnitSquareMesh(4, 4)
+        V = FunctionSpace(mesh, "Lagrange", 1)
+        u, v = TrialFunction(V), TestFunction(V)
+        a = u*v*dx
+        L = Constant(1.0)*v*dx
+        A, b = assemble(a), assemble(L)
+
+        solver = PETScKrylovSolver("cg")
+        solver.parameters["maximum_iterations"] = 2
+        solver.parameters["error_on_nonconvergence"] = False
+        solver.set_norm_type(norm)
+        solver.set_operator(A)
+        solver.solve(b.copy(), b)
+        solver.get_norm_type()
+
+        if norm is not PETScKrylovSolver.norm_type_default_norm:
+            assert solver.get_norm_type() == norm
+
+
+ at skip_if_not_PETSc
+def test_krylov_solver_options_prefix(pushpop_parameters):
+    "Test set/get PETScKrylov solver prefix option"
+
+    # Set backend
+    parameters["linear_algebra_backend"] = "PETSc"
+
+    # Prefix
+    prefix = "test_foo_"
+
+    # Create solver and set prefix
+    solver = PETScKrylovSolver()
+    solver.set_options_prefix(prefix)
+
+    # Check prefix (pre solve)
+    assert solver.get_options_prefix() == prefix
+
+    # Solve a system of equations
+    mesh = UnitSquareMesh(4, 4)
+    V = FunctionSpace(mesh, "Lagrange", 1)
+    u, v = TrialFunction(V), TestFunction(V)
+    a, L = u*v*dx, Constant(1.0)*v*dx
+    A,b  = assemble(a), assemble(L)
+    solver.set_operator(A)
+    solver.solve(b.copy(), b)
+
+    # Check prefix (post solve)
+    assert solver.get_options_prefix() == prefix
+
 
 @skip_if_not_PETSc
-def test_options_prefix():
+def test_options_prefix(pushpop_parameters):
     "Test set/get prefix option for PETSc objects"
 
     def run_test(A, init_function):
@@ -37,7 +110,7 @@ def test_options_prefix():
         A.set_options_prefix(prefix)
 
         # Get prefix (should be empty since vector has been initialised)
-        assert not A.get_options_prefix()
+        #assert not A.get_options_prefix()
 
         # Initialise vector
         init_function(A)
@@ -46,8 +119,8 @@ def test_options_prefix():
         assert A.get_options_prefix() == prefix
 
         # Try changing prefix post-intialisation (should throw error)
-        with pytest.raises(RuntimeError):
-            A.set_options_prefix("test")
+        #with pytest.raises(RuntimeError):
+        #    A.set_options_prefix("test")
 
     # Test vector
     def init_vector(x):
diff --git a/test/unit/python/la/test_scalar.py b/test/unit/python/la/test_scalar.py
index 91b3f9a..3b747de 100755
--- a/test/unit/python/la/test_scalar.py
+++ b/test/unit/python/la/test_scalar.py
@@ -21,6 +21,7 @@
 
 from dolfin import *
 
+
 def test_scalar_parallel_sum():
     a = Scalar()
     b = 1.0
@@ -28,6 +29,7 @@ def test_scalar_parallel_sum():
     a.apply("add")
     assert round(a.get_scalar_value() - b*MPI.size(a.mpi_comm()), 7) == 0
 
+
 def test_scalar_assembly():
     mesh = UnitSquareMesh(3, 3)
 
diff --git a/test/unit/python/la/test_tensor_layout.py b/test/unit/python/la/test_tensor_layout.py
new file mode 100644
index 0000000..872163e
--- /dev/null
+++ b/test/unit/python/la/test_tensor_layout.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env py.test
+
+"""Unit tests for TensorLayout and SparsityPattern interface"""
+
+# Copyright (C) 2015 Jan Blechta
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+from __future__ import print_function
+import pytest
+from dolfin import *
+import numpy as np
+
+from dolfin_utils.test import *
+
+
+backends = list(linear_algebra_backends().keys())
+if MPI.size(mpi_comm_world()) > 1 and 'Eigen' in backends:
+    backends.remove('Eigen')
+backend = set_parameters_fixture("linear_algebra_backend", backends)
+
+ at fixture
+def mesh():
+    return UnitSquareMesh(10, 10)
+
+ at fixture
+def V(mesh):
+    return FunctionSpace(mesh, 'Lagrange', 1)
+
+ at fixture
+def VV(mesh):
+    return VectorFunctionSpace(mesh, 'Lagrange', 1)
+
+ at fixture
+def TH(mesh):
+    P2 = VectorElement('Lagrange', mesh.ufl_cell(), 2)
+    P1 = FiniteElement('Lagrange', mesh.ufl_cell(), 1)
+    return FunctionSpace(mesh, P2*P1)
+
+ at fixture
+def VR(mesh):
+    P1 = FiniteElement('Lagrange', mesh.ufl_cell(), 1)
+    R = FiniteElement('Real', mesh.ufl_cell(), 0)
+    return FunctionSpace(mesh, P1*R)
+
+
+def test_layout_and_pattern_interface(backend, V, VV, TH, VR):
+    for V in [V, VV, TH]:
+        m = V.mesh()
+        c = m.mpi_comm()
+        d = V.dofmap()
+        i = d.index_map()
+
+        # Poisson problem
+        u = TrialFunction(V)
+        v = TestFunction(V)
+        a = inner(grad(u), grad(v))*dx
+        f = Expression(np.full(v.ufl_shape, "x[0]*x[1]", dtype=object).tolist(), degree=2)
+        L = inner(f, v)*dx
+
+        # Test ghosted vector (for use as dofs of FE function)
+        t0 = TensorLayout(0, TensorLayout.Sparsity_DENSE)
+        t0.init(c, [i], TensorLayout.Ghosts_GHOSTED)
+        x = Vector()
+        x.init(t0)
+        u = Function(V, x)
+
+        # Test unghosted vector (for assembly of rhs)
+        t1 = TensorLayout(0, TensorLayout.Sparsity_DENSE)
+        t1.init(c, [i], TensorLayout.Ghosts_UNGHOSTED)
+        b = Vector()
+        b.init(t1)
+        assemble(L, tensor=b)
+
+        # Build sparse tensor layout (for assembly of matrix)
+        t2 = TensorLayout(0, TensorLayout.Sparsity_SPARSE)
+        t2.init(c, [i, i], TensorLayout.Ghosts_UNGHOSTED)
+        s2 = t2.sparsity_pattern()
+        s2.init(c, [i, i])
+        SparsityPatternBuilder.build(s2, m, [d, d],
+                                     True, False, False, False,
+                                     False, init=False)
+        A = Matrix()
+        A.init(t2)
+        assemble(a, tensor=A)
+
+        # Test sparsity pattern consistency
+        diag = s2.num_nonzeros_diagonal()
+        off_diag = s2.num_nonzeros_off_diagonal()
+        # Sequential pattern returns just empty off_diagonal
+        off_diag = off_diag if off_diag.any() else np.zeros(diag.shape, diag.dtype)
+        local = s2.num_local_nonzeros()
+        assert (local == diag + off_diag).all()
+        assert local.sum() == s2.num_nonzeros()
+
+        # Check that solve passes smoothly
+        ud = np.full(v.ufl_shape, 0, dtype=object).tolist()
+        bc = DirichletBC(V, ud, lambda x, b: b)
+        bc.apply(A)
+        bc.apply(b)
+        solve(A, x, b)
diff --git a/test/unit/python/la/test_vector.py b/test/unit/python/la/test_vector.py
index bdb9f2d..7ac21ea 100755
--- a/test/unit/python/la/test_vector.py
+++ b/test/unit/python/la/test_vector.py
@@ -34,22 +34,13 @@ from dolfin_utils.test import *
 # Lists of backends supporting or not supporting GenericVector::data()
 # access
 data_backends = []
-no_data_backends = ["PETSc"]
+no_data_backends = ["PETSc", "Tpetra"]
 
 # Add serial only backends
 if MPI.size(mpi_comm_world()) == 1:
     # TODO: What about "Dense" and "Sparse"? The sub_backend wasn't
     # used in the old test.
     data_backends += ["Eigen"]
-    no_data_backends += ["PETScCusp"]
-
-# If we have PETSc, STL Vector gets typedefed to one of these and data
-# test will not work. If none of these backends are available
-# STLVector defaults to EigenVEctor, which data will work
-if has_linear_algebra_backend("PETSc"):
-    no_data_backends += ["STL"]
-else:
-    data_backends += ["STL"]
 
 # Remove backends we haven't built with
 data_backends = list(filter(has_linear_algebra_backend, data_backends))
diff --git a/test/unit/python/math/test_math.py b/test/unit/python/math/test_math.py
index ac1f7ba..6e32fa8 100755
--- a/test/unit/python/math/test_math.py
+++ b/test/unit/python/math/test_math.py
@@ -87,3 +87,21 @@ def test_between():
 
             # Check that we can fail for fairly close values
             assert not between(v, (v2p, v2m))
+
+def test_ipow():
+    with pytest.raises(RuntimeError):
+        ipow(0, 0)
+    assert ipow(0, 1) == 0
+    assert ipow(0, 10) == 0
+    assert ipow(0, 12345) == 0
+    assert ipow(1, 12345) == 1
+    assert ipow(12345, 0) == 1
+    assert ipow(12345, 1) == 12345
+    assert ipow(2, 15) == 32768
+
+ at pytest.mark.xfail
+def test_ipow_overflow():
+    # This will fail because of overflow in dolfin/math/basic.cpp
+    # on 64-bit size_t. When __builtin_mul_overflow is employed
+    # to do the check, exception will be raised instead.
+    assert ipow(3, 41) == 3**41
diff --git a/test/unit/python/mesh/test_boundary_mesh.py b/test/unit/python/mesh/test_boundary_mesh.py
index 2d7e09c..f632f5e 100755
--- a/test/unit/python/mesh/test_boundary_mesh.py
+++ b/test/unit/python/mesh/test_boundary_mesh.py
@@ -38,6 +38,7 @@ def test_1D_mesh():
     assert bmesh1.size_global(0) == 2
     assert bmesh1.topology().dim() == 0
 
+
 def test_2D_mesh():
     mesh = UnitSquareMesh(8, 8)
 
@@ -47,6 +48,7 @@ def test_2D_mesh():
     assert bmesh1.size_global(1) == 4*8
     assert bmesh1.topology().dim() == 1
 
+
 def test_3D_mesh():
     mesh = UnitCubeMesh(8, 8, 8)
 
@@ -54,4 +56,4 @@ def test_3D_mesh():
     bmesh1 = BoundaryMesh(mesh, "exterior")
     assert MPI.sum(mesh.mpi_comm(), bmesh1.num_cells()) == 6*8*8*2
     assert bmesh1.size_global(2) == 6*8*8*2
-    assert bmesh1.topology().dim() == 2
\ No newline at end of file
+    assert bmesh1.topology().dim() == 2
diff --git a/test/unit/python/mesh/test_cell.py b/test/unit/python/mesh/test_cell.py
index 0967a03..1f361d1 100755
--- a/test/unit/python/mesh/test_cell.py
+++ b/test/unit/python/mesh/test_cell.py
@@ -28,6 +28,7 @@ from dolfin import *
 
 from dolfin_utils.test import skip_in_parallel
 
+
 @skip_in_parallel
 def test_distance_interval():
 
@@ -37,6 +38,7 @@ def test_distance_interval():
     assert round(cell.distance(Point(-1.0)) - 1.0, 7) == 0
     assert round(cell.distance(Point(0.5)) - 0.0, 7) == 0
 
+
 @skip_in_parallel
 def test_distance_triangle():
 
@@ -47,13 +49,13 @@ def test_distance_triangle():
     assert round(cell.distance(Point(-1.0, 0.5)) - 1, 7) == 0
     assert round(cell.distance(Point(0.5, 0.5)) - 0.0, 7) == 0
 
+
 @skip_in_parallel
 def test_distance_tetrahedron():
 
     mesh = UnitCubeMesh(1, 1, 1)
     cell = Cell(mesh, 5)
 
-    assert round(cell.distance(Point(-1.0, -1.0, -1.0)) - \
-                  numpy.sqrt(3), 7) == 0
+    assert round(cell.distance(Point(-1.0, -1.0, -1.0))-numpy.sqrt(3), 7) == 0
     assert round(cell.distance(Point(-1.0, 0.5, 0.5)) - 1, 7) == 0
     assert round(cell.distance(Point(0.5, 0.5, 0.5)) - 0.0, 7) == 0
diff --git a/test/unit/python/mesh/test_edge.py b/test/unit/python/mesh/test_edge.py
index fcfcdfb..3831e18 100755
--- a/test/unit/python/mesh/test_edge.py
+++ b/test/unit/python/mesh/test_edge.py
@@ -26,14 +26,17 @@ import pytest
 from dolfin import *
 from dolfin_utils.test import fixture, skip_in_parallel
 
+
 @fixture
 def cube():
     return UnitCubeMesh(5, 5, 5)
 
+
 @fixture
 def square():
     return UnitSquareMesh(5, 5)
 
+
 @pytest.fixture(scope='module', params=range(2))
 def meshes(cube, square, request):
     mesh = [cube, square]
@@ -48,6 +51,7 @@ def test_2DEdgeLength(square):
         length += e.length()
     assert round(length - 19.07106781186544708362, 7) == 0
 
+
 @skip_in_parallel
 def test_3DEdgeLength(cube):
     """Iterate over edges and sum length."""
diff --git a/test/unit/python/mesh/test_face.py b/test/unit/python/mesh/test_face.py
index 8803f17..dc72cd7 100755
--- a/test/unit/python/mesh/test_face.py
+++ b/test/unit/python/mesh/test_face.py
@@ -26,10 +26,12 @@ import pytest
 from dolfin import *
 from dolfin_utils.test import skip_in_parallel, fixture
 
+
 @fixture
 def cube():
     return UnitCubeMesh(5, 5, 5)
 
+
 @fixture
 def square():
     return UnitSquareMesh(5, 5)
diff --git a/test/unit/python/mesh/test_ghost_mesh.py b/test/unit/python/mesh/test_ghost_mesh.py
new file mode 100755
index 0000000..269ea96
--- /dev/null
+++ b/test/unit/python/mesh/test_ghost_mesh.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env py.test
+
+"Unit tests for ghosted meshes"
+
+# Copyright (C) 2016 Garth N. Wells
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+
+from __future__ import print_function
+import pytest
+import numpy
+from dolfin import *
+import os
+
+from dolfin_utils.test import fixture, skip_in_parallel, xfail_in_parallel, cd_tempdir, pushpop_parameters
+
+
+# See https://bitbucket.org/fenics-project/dolfin/issues/579
+def xtest_ghost_vertex_1d(pushpop_parameters):
+    parameters["ghost_mode"] = "shared_vertex"
+    mesh = UnitIntervalMesh(20)
+    #print("Test: {}".format(MPI.sum(mesh.mpi_comm(), mesh.num_cells())))
+
+
+def xtest_ghost_facet_1d(pushpop_parameters):
+    parameters["ghost_mode"] = "shared_facet"
+    mesh = UnitIntervalMesh(20)
+
+
+def test_ghost_2d(pushpop_parameters):
+    modes = ["shared_vertex", "shared_facet"]
+    for mode in modes:
+        parameters["ghost_mode"] = mode
+        N = 8
+        num_cells = 128
+
+        mesh = UnitSquareMesh(N, N)
+        if MPI.size(mesh.mpi_comm()) > 1:
+            assert MPI.sum(mesh.mpi_comm(), mesh.num_cells()) > num_cells
+
+        parameters["reorder_cells_gps"] = True
+        parameters["reorder_vertices_gps"] = False
+        mesh = UnitSquareMesh(N, N)
+        if MPI.size(mesh.mpi_comm()) > 1:
+            assert MPI.sum(mesh.mpi_comm(), mesh.num_cells()) > num_cells
+
+        parameters["reorder_cells_gps"] = True
+        parameters["reorder_vertices_gps"] = True
+        mesh = UnitSquareMesh(N, N)
+        if MPI.size(mesh.mpi_comm()) > 1:
+            assert MPI.sum(mesh.mpi_comm(), mesh.num_cells()) > num_cells
+
+        parameters["reorder_cells_gps"] = False
+        parameters["reorder_vertices_gps"] = True
+        mesh = UnitSquareMesh(N, N)
+        if MPI.size(mesh.mpi_comm()) > 1:
+            assert MPI.sum(mesh.mpi_comm(), mesh.num_cells()) > num_cells
+
+
+def test_ghost_3d(pushpop_parameters):
+    modes = ["shared_vertex", "shared_facet"]
+    for mode in modes:
+        parameters["ghost_mode"] = mode
+        N = 2
+        num_cells = 48
+
+        mesh = UnitCubeMesh(N, N, N)
+        if MPI.size(mesh.mpi_comm()) > 1:
+            assert MPI.sum(mesh.mpi_comm(), mesh.num_cells()) > num_cells
+
+        parameters["reorder_cells_gps"] = True
+        parameters["reorder_vertices_gps"] = False
+        mesh = UnitCubeMesh(N, N, N)
+        if MPI.size(mesh.mpi_comm()) > 1:
+            assert MPI.sum(mesh.mpi_comm(), mesh.num_cells()) > num_cells
+
+        parameters["reorder_cells_gps"] = True
+        parameters["reorder_vertices_gps"] = True
+        mesh = UnitCubeMesh(N, N, N)
+        if MPI.size(mesh.mpi_comm()) > 1:
+            assert MPI.sum(mesh.mpi_comm(), mesh.num_cells()) > num_cells
+
+        parameters["reorder_cells_gps"] = False
+        parameters["reorder_vertices_gps"] = True
+        mesh = UnitCubeMesh(N, N, N)
+        if MPI.size(mesh.mpi_comm()) > 1:
+            assert MPI.sum(mesh.mpi_comm(), mesh.num_cells()) > num_cells
diff --git a/test/unit/python/mesh/test_manifold_point_search.py b/test/unit/python/mesh/test_manifold_point_search.py
old mode 100644
new mode 100755
index 23d0f04..2e6764e
--- a/test/unit/python/mesh/test_manifold_point_search.py
+++ b/test/unit/python/mesh/test_manifold_point_search.py
@@ -3,9 +3,7 @@ import pytest
 import numpy
 from dolfin import *
 
-xfail = pytest.mark.xfail
 
- at xfail
 def test_manifold_point_search():
     # Simple two-triangle surface in 3d
     vertices = [
@@ -17,7 +15,7 @@ def test_manifold_point_search():
     cells = [
         (0, 1, 2),
         (0, 1, 3),
-        ]
+    ]
     mesh = Mesh()
     me = MeshEditor()
     me.open(mesh, "triangle", 2, 3)
@@ -29,8 +27,11 @@ def test_manifold_point_search():
         me.add_cell(i, *c)
     me.close()
 
-    mesh.init_cell_orientations(Expression(("0.0", "0.0", "1.0")))
+    mesh.init_cell_orientations(Expression(("0.0", "0.0", "1.0"), degree=0))
 
     bb = mesh.bounding_box_tree()
-    assert bb.compute_first_entity_collision(Point(2.0/3.0, 1.0/3.0, 2.0/3.0)) == 0 # passes
-    assert bb.compute_first_entity_collision(Point(1.0/3.0, 2.0/3.0, 2.0/3.0)) == 1 # fails
+    p = Point(2.0/3.0, 1.0/3.0, 2.0/3.0)
+    assert bb.compute_first_entity_collision(p) == 0
+
+    p = Point(1.0/3.0, 2.0/3.0, 2.0/3.0)
+    assert bb.compute_first_entity_collision(p) == 1
diff --git a/test/unit/python/mesh/test_mesh.py b/test/unit/python/mesh/test_mesh.py
index 7c8c0a6..6d84fa5 100755
--- a/test/unit/python/mesh/test_mesh.py
+++ b/test/unit/python/mesh/test_mesh.py
@@ -36,6 +36,7 @@ import os
 
 from dolfin_utils.test import fixture, skip_in_parallel, xfail_in_parallel, cd_tempdir
 
+
 @fixture
 def mesh1d():
     # Create 1D mesh with degenerate cell
@@ -43,6 +44,7 @@ def mesh1d():
     mesh1d.coordinates()[4] = mesh1d.coordinates()[3]
     return mesh1d
 
+
 @fixture
 def mesh2d():
     # Create 2D mesh with one equilateral triangle
@@ -50,6 +52,7 @@ def mesh2d():
     mesh2d.coordinates()[3] += 0.5*(sqrt(3.0)-1.0)
     return mesh2d
 
+
 @fixture
 def mesh3d():
     # Create 3D mesh with regular tetrahedron and degenerate cells
@@ -58,45 +61,55 @@ def mesh3d():
     mesh3d.coordinates()[7][1] = 0.0
     return mesh3d
 
+
 @fixture
 def c0(mesh3d):
     # Original tetrahedron from UnitCubeMesh(1, 1, 1)
     return Cell(mesh3d, 0)
 
+
 @fixture
 def c1(mesh3d):
     # Degenerate cell
     return Cell(mesh3d, 1)
 
+
 @fixture
 def c5(mesh3d):
     # Regular tetrahedron with edge sqrt(2)
     return Cell(mesh3d, 5)
 
+
 @fixture
 def interval():
     return UnitIntervalMesh(10)
 
+
 @fixture
 def square():
     return UnitSquareMesh(5, 5)
 
+
 @fixture
 def rectangle():
     return RectangleMesh(Point(0, 0), Point(2, 2), 5, 5)
 
+
 @fixture
 def cube():
     return UnitCubeMesh(3, 3, 3)
 
+
 @fixture
 def box():
     return BoxMesh(Point(0, 0, 0), Point(2, 2, 2), 2, 2, 5)
 
+
 @fixture
 def mesh():
     return UnitSquareMesh(3, 3)
 
+
 @fixture
 def f(mesh):
     return MeshFunction('int', mesh, 0)
@@ -113,12 +126,13 @@ def test_UFLCell(interval, square, rectangle, cube, box):
 
 def test_UFLDomain(interval, square, rectangle, cube, box):
     import ufl
+
     def _check_ufl_domain(mesh):
         domain = mesh.ufl_domain()
         assert mesh.geometry().dim() == domain.geometric_dimension()
         assert mesh.topology().dim() == domain.topological_dimension()
-        assert mesh.ufl_cell() == domain.cell()
-        assert str(mesh.id()) in domain.label()
+        assert mesh.ufl_cell() == domain.ufl_cell()
+        assert mesh.id() == domain.ufl_id()
 
     _check_ufl_domain(interval)
     _check_ufl_domain(square)
@@ -178,24 +192,27 @@ def test_UnitCubeMeshDistributedLocal():
     assert mesh.num_vertices() == 480
     assert mesh.num_cells() == 1890
 
+
 def test_UnitQuadMesh():
-    mesh = UnitQuadMesh(5, 7)
+    mesh = UnitQuadMesh(mpi_comm_world(), 5, 7)
     assert mesh.size_global(0) == 48
     assert mesh.size_global(2) == 35
 
+
 def test_UnitHexMesh():
-    mesh = UnitHexMesh(5, 7, 9)
+    mesh = UnitHexMesh(mpi_comm_world(), 5, 7, 9)
     assert mesh.size_global(0) == 480
     assert mesh.size_global(3) == 315
 
- at skip_in_parallel
-def test_LocalRefineUnitIntervalMesh():
+
+def test_RefineUnitIntervalMesh():
     """Refine mesh of unit interval."""
-    mesh = UnitIntervalMesh(10)
+    mesh = UnitIntervalMesh(20)
     cell_markers = CellFunction("bool", mesh)
-    cell_markers[7] = True
+    cell_markers[0] = (MPI.rank(mesh.mpi_comm()) == 0)
     mesh2 = refine(mesh, cell_markers)
-    assert mesh2.num_cells() == 11
+    assert mesh2.size_global(0) == 22
+    assert mesh2.size_global(1) == 21
 
 
 def test_RefineUnitSquareMesh():
@@ -221,6 +238,7 @@ def test_BoundaryComputation():
     assert boundary.size_global(0) == 26
     assert boundary.size_global(2) == 48
 
+
 @xfail_in_parallel
 def test_BoundaryBoundary():
     """Compute boundary of boundary."""
@@ -239,6 +257,7 @@ def test_Assign(mesh, f):
     v = Vertex(mesh, 3)
     assert f[v] == 10
 
+
 @skip_in_parallel
 def test_Write(cd_tempdir, f):
     """Construct and save a simple meshfunction."""
@@ -248,26 +267,29 @@ def test_Write(cd_tempdir, f):
     file = File("saved_mesh_function.xml")
     file << f
 
+
 @skip_in_parallel
 def test_Read(cd_tempdir):
     """Construct and save a simple meshfunction. Then read it back from
     file."""
-    #mf = mesh.data().create_mesh_function("mesh_data_function", 2)
-    #print "***************", mf
-    #mf[0] = 3
-    #mf[1] = 4
-
-    #f[0] = 1
-    #f[1] = 2
-    #file = File("saved_mesh_function.xml")
-    #file << f
-    #f = MeshFunction('int', mesh, "saved_mesh_function.xml")
-    #assert all(f.array() == f.array())
+    # mf = mesh.data().create_mesh_function("mesh_data_function", 2)
+    # print "***************", mf
+    # mf[0] = 3
+    # mf[1] = 4
+
+    # f[0] = 1
+    # f[1] = 2
+    # file = File("saved_mesh_function.xml")
+    # file << f
+    # f = MeshFunction('int', mesh, "saved_mesh_function.xml")
+    # assert all(f.array() == f.array())
+
 
 @skip_in_parallel
 def test_SubsetIterators(mesh):
     def inside1(x):
         return x[0] <= 0.5
+
     def inside2(x):
         return x[0] >= 0.5
     sd1 = AutoSubDomain(inside1)
@@ -289,7 +311,7 @@ def test_SubsetIterators(mesh):
 def test_MeshXML2D(cd_tempdir):
     """Write and read 2D mesh to/from file"""
     mesh_out = UnitSquareMesh(3, 3)
-    mesh_in  = Mesh()
+    mesh_in = Mesh()
     file = File("unitsquare.xml")
     file << mesh_out
     file >> mesh_in
@@ -300,7 +322,7 @@ def test_MeshXML2D(cd_tempdir):
 def test_MeshXML3D(cd_tempdir):
     """Write and read 3D mesh to/from file"""
     mesh_out = UnitCubeMesh(3, 3, 3)
-    mesh_in  = Mesh()
+    mesh_in = Mesh()
     file = File("unitcube.xml")
     file << mesh_out
     file >> mesh_in
@@ -351,13 +373,21 @@ def test_cell_inradius(c0, c1, c5):
 
 
 @skip_in_parallel
-def test_cell_diameter(c0, c1, c5):
+def test_cell_circumradius(c0, c1, c5):
     from math import isnan
-    assert round(c0.diameter() - sqrt(3.0), 7) == 0
+    assert round(c0.circumradius() - sqrt(3.0)/2.0, 7) == 0
     # Implementation of diameter() does not work accurately
     # for degenerate cells - sometimes yields NaN
-    assert isnan(c1.diameter())
-    assert round(c5.diameter() - sqrt(3.0), 7) == 0
+    assert isnan(c1.circumradius())
+    assert round(c5.circumradius() - sqrt(3.0)/2.0, 7) == 0
+
+
+ at skip_in_parallel
+def test_cell_h(c0, c1, c5):
+    from math import isnan
+    assert round(c0.h() - sqrt(2.0), 7) == 0
+    assert round(c1.h() - sqrt(2.0), 7) == 0
+    assert round(c5.h() - sqrt(2.0), 7) == 0
 
 
 @skip_in_parallel
@@ -368,7 +398,7 @@ def test_cell_radius_ratio(c0, c1, c5):
 
 
 @skip_in_parallel
-def test_hmin_hmax(mesh1d, mesh2d, mesh3d):
+def xtest_hmin_hmax(mesh1d, mesh2d, mesh3d):
     assert round(mesh1d.hmin() - 0.0, 7) == 0
     assert round(mesh1d.hmax() - 0.25, 7) == 0
     assert round(mesh2d.hmin() - sqrt(2.0), 7) == 0
@@ -395,7 +425,7 @@ def test_basic_cell_orientations():
     print(len(orientations))
     assert len(orientations) == 0
 
-    mesh.init_cell_orientations(Expression(("0.0", "1.0", "0.0")))
+    mesh.init_cell_orientations(Expression(("0.0", "1.0", "0.0"), degree=0))
     orientations = mesh.cell_orientations()
     assert len(orientations) == mesh.num_cells()
     for i in range(mesh.num_cells()):
@@ -406,12 +436,12 @@ def test_basic_cell_orientations():
 def test_cell_orientations():
     "Test that cell orientations update as expected."
     mesh = UnitIntervalMesh(12)
-    mesh.init_cell_orientations(Expression(("0.0", "1.0", "0.0")))
+    mesh.init_cell_orientations(Expression(("0.0", "1.0", "0.0"), degree=0))
     for i in range(mesh.num_cells()):
         assert mesh.cell_orientations()[i] == 0
 
     mesh = UnitSquareMesh(2, 2)
-    mesh.init_cell_orientations(Expression(("0.0", "0.0", "1.0")))
+    mesh.init_cell_orientations(Expression(("0.0", "0.0", "1.0"), degree=0))
     reference = numpy.array((0, 1, 0, 1, 0, 1, 0, 1))
     # Only compare against reference in serial (don't know how to
     # compare in parallel)
@@ -419,12 +449,13 @@ def test_cell_orientations():
         assert mesh.cell_orientations()[i] == reference[i]
 
     mesh = BoundaryMesh(UnitSquareMesh(2, 2), "exterior")
-    mesh.init_cell_orientations(Expression(("x[0]", "x[1]", "x[2]")))
+    mesh.init_cell_orientations(Expression(("x[0]", "x[1]", "x[2]"), degree=1))
     print(mesh.cell_orientations())
 
 
 def test_shared_entities():
-    for ind, MeshClass in enumerate([UnitIntervalMesh, UnitSquareMesh, UnitCubeMesh]):
+    for ind, MeshClass in enumerate([UnitIntervalMesh, UnitSquareMesh,
+                                     UnitCubeMesh]):
         dim = ind+1
         args = [4]*dim
         mesh = MeshClass(*args)
@@ -433,7 +464,8 @@ def test_shared_entities():
         # FIXME: Implement a proper test
         for shared_dim in range(dim+1):
             assert isinstance(mesh.topology().shared_entities(shared_dim), dict)
-            assert isinstance(mesh.topology().global_indices(shared_dim), numpy.ndarray)
+            assert isinstance(mesh.topology().global_indices(shared_dim),
+                              numpy.ndarray)
 
             EntityIterator = {0: vertices, 1: edges, 2: faces, 3: cells}[shared_dim]
             if mesh.topology().have_shared_entities(shared_dim):
diff --git a/test/unit/python/mesh/test_mesh_coloring.py b/test/unit/python/mesh/test_mesh_coloring.py
index 7138b4e..e63ce2e 100755
--- a/test/unit/python/mesh/test_mesh_coloring.py
+++ b/test/unit/python/mesh/test_mesh_coloring.py
@@ -25,12 +25,13 @@
 import pytest
 from dolfin import *
 
+
 def test_by_entity_cell_coloring():
     """Color mesh cells by connections."""
 
     # Get coloring libraries
     default_parameter = parameters["graph_coloring_library"]
-    coloring_libraries =  parameters.get_range("graph_coloring_library")
+    coloring_libraries = parameters.get_range("graph_coloring_library")
     for coloring_library in coloring_libraries:
         parameters["graph_coloring_library"] = coloring_library
         mesh = UnitCubeMesh(16, 16, 16)
diff --git a/test/unit/python/mesh/test_mesh_data.py b/test/unit/python/mesh/test_mesh_data.py
index bc404f9..7145ef4 100755
--- a/test/unit/python/mesh/test_mesh_data.py
+++ b/test/unit/python/mesh/test_mesh_data.py
@@ -25,13 +25,9 @@
 import pytest
 from dolfin import *
 
+
 def test_meshfunction():
     "Test input/output"
 
     mesh = UnitCubeMesh(3, 3, 3)
-
     f = mesh.data().create_array("foo", 3)
-    #f[:] = 0.0
-    #g = mesh.data().array("foo")
-
-    #assert len(g) == mesh.num_vertices()
diff --git a/test/unit/python/mesh/test_mesh_editor.py b/test/unit/python/mesh/test_mesh_editor.py
index 65c3ccc..1c20577 100755
--- a/test/unit/python/mesh/test_mesh_editor.py
+++ b/test/unit/python/mesh/test_mesh_editor.py
@@ -24,13 +24,14 @@
 
 from dolfin import *
 
+
 def test_triangle_mesh():
 
     # Create mesh object and open editor
     mesh = Mesh()
     editor = MeshEditor()
     editor.open(mesh, 2, 2)
-    editor.init_vertices(3) # test both versions of interface
+    editor.init_vertices(3)  # test both versions of interface
     editor.init_vertices_global(3, 3)
     editor.init_cells(1)    # test both versions of interface
     editor.init_cells_global(1, 1)
diff --git a/test/unit/python/mesh/test_mesh_function.py b/test/unit/python/mesh/test_mesh_function.py
index add0be4..65264a2 100755
--- a/test/unit/python/mesh/test_mesh_function.py
+++ b/test/unit/python/mesh/test_mesh_function.py
@@ -28,20 +28,24 @@ from dolfin import *
 from six.moves import xrange as range
 from dolfin_utils.test import fixture
 
+
 @pytest.fixture(scope="module", params=range(5))
 def name(request):
     names = ["Cell", "Vertex", "Edge", "Face", "Facet"]
     return names[request.param]
 
+
 @pytest.fixture(scope="module", params=range(4))
 def tp(request):
     tps = ['int', 'size_t', 'bool', 'double']
     return tps[request.param]
 
+
 @fixture
 def mesh():
     return UnitCubeMesh(3, 3, 3)
 
+
 @fixture
 def funcs(mesh):
     names = ["Cell", "Vertex", "Edge", "Face", "Facet"]
@@ -49,14 +53,15 @@ def funcs(mesh):
     funcs = {}
     for tp in tps:
         for name in names:
-            funcs[(tp, name)] = eval("%sFunction('%s', mesh)"%\
-                                       (name, tp))
+            funcs[(tp, name)] = eval("%sFunction('%s', mesh)" % (name, tp))
     return funcs
 
+
 @fixture
 def cube():
     return UnitCubeMesh(8, 8, 8)
 
+
 @fixture
 def f(cube):
     return MeshFunction('int', cube, 0)
@@ -69,9 +74,10 @@ def test_size(tp, name, funcs, mesh):
         assert a == b
     else:
         a = len(funcs[(tp, name)])
-        b = getattr(mesh, "num_%ss"%name.lower())()
+        b = getattr(mesh, "num_%ss" % name.lower())()
         assert a == b
 
+
 def test_access_type(tp, name, funcs):
     type_dict = dict(int=int, size_t=int, double=float, bool=bool)
     assert isinstance(funcs[(tp, name)][0], type_dict[tp])
@@ -80,22 +86,22 @@ def test_access_type(tp, name, funcs):
 def test_numpy_access(funcs, tp, name):
     values = funcs[(tp, name)].array()
     values[:] = numpy.random.rand(len(values))
-    assert all(values[i]==funcs[(tp, name)][i] \
-        		 for i in range(len(values)))
+    assert all(values[i] == funcs[(tp, name)][i] for i in range(len(values)))
+
 
 def test_iterate(tp, name, funcs):
-     for index, value in enumerate(funcs[(tp, name)]):
-         pass
-     assert index == len(funcs[(tp, name)])-1
-     with pytest.raises(IndexError):
-          funcs[(tp, name)].__getitem__(len(funcs[(tp, name)]))
+    for index, value in enumerate(funcs[(tp, name)]):
+        pass
+    assert index == len(funcs[(tp, name)])-1
+    with pytest.raises(IndexError):
+        funcs[(tp, name)].__getitem__(len(funcs[(tp, name)]))
 
 
 def test_setvalues(tp, funcs, name):
     if tp != 'bool':
         with pytest.raises(TypeError):
             funcs[(tp, name)].__setitem__(len(funcs[(tp, name)])-1, "jada")
-            
+
 
 def test_Create(cube):
     """Create MeshFunctions."""
diff --git a/test/unit/python/mesh/test_mesh_markers.py b/test/unit/python/mesh/test_mesh_markers.py
index 72fa9a3..63805ec 100755
--- a/test/unit/python/mesh/test_mesh_markers.py
+++ b/test/unit/python/mesh/test_mesh_markers.py
@@ -35,15 +35,19 @@ def test_subdomain_marking():
     class F0(SubDomain):
         def inside(self, x, inside):
             return near(x[0], 0.0)
+
     class F1(SubDomain):
         def inside(self, x, inside):
             return near(x[0], 1.0)
+
     class F2(SubDomain):
         def inside(self, x, inside):
             return near(x[1], 0.0)
+
     class F3(SubDomain):
         def inside(self, x, inside):
             return near(x[1], 1.0)
+
     class F4(SubDomain):
         def inside(self, x, inside):
             return near(x[2], 0.0)
diff --git a/test/unit/python/mesh/test_mesh_quality.py b/test/unit/python/mesh/test_mesh_quality.py
index b4cfb9b..6f83215 100755
--- a/test/unit/python/mesh/test_mesh_quality.py
+++ b/test/unit/python/mesh/test_mesh_quality.py
@@ -37,6 +37,7 @@ def test_radius_ratio_triangle():
     for c in cells(mesh):
         assert round(ratios[c] - 0.828427124746, 7) == 0
 
+
 def test_radius_ratio_tetrahedron():
 
     # Create mesh and compute ratios
@@ -44,7 +45,7 @@ def test_radius_ratio_tetrahedron():
     ratios = MeshQuality.radius_ratios(mesh)
     for c in cells(mesh):
         assert round(ratios[c] - 0.717438935214, 7) == 0
-        #print ratio[c]
+
 
 def test_radius_ratio_triangle_min_max():
 
@@ -60,6 +61,7 @@ def test_radius_ratio_triangle_min_max():
     assert round(rmin - 0.0, 7) == 0
     assert round(rmax - 0.0, 7) == 0
 
+
 def test_radius_ratio_tetrahedron_min_max():
 
     # Create mesh, collpase and compute min ratio
@@ -74,8 +76,8 @@ def test_radius_ratio_tetrahedron_min_max():
     assert round(rmax - 0.0, 7) == 0
     assert round(rmax - 0.0, 7) == 0
 
-def test_radius_ratio_matplotlib():
 
+def test_radius_ratio_matplotlib():
     # Create mesh, collpase and compute min ratio
     mesh = UnitCubeMesh(12, 12, 12)
     test = MeshQuality.radius_ratio_matplotlib_histogram(mesh, 5)
@@ -106,3 +108,16 @@ def test_radius_ratio_min_radius_ratio_max():
     rmin, rmax = MeshQuality.radius_ratio_min_max(mesh3d)
     assert round(rmin - 0.0, 7) == 0
     assert round(rmax - 1.0, 7) == 0
+
+def test_dihedral_angles_min_max():
+    # Create 3D mesh with regular tetrahedron
+    mesh = UnitCubeMesh(1, 1, 1)
+    dang_min, dang_max = MeshQuality.dihedral_angles_min_max(mesh)
+    assert round(dang_min*(180/numpy.pi) - 45.0) == 0
+    assert round(dang_max*(180/numpy.pi) - 90.0) == 0
+
+def test_dihedral_angles_matplotlib():
+    # Create mesh, collpase and compute min ratio
+    mesh = UnitCubeMesh(12, 12, 12)
+    test = MeshQuality.dihedral_angles_matplotlib_histogram(mesh, 5)
+    print(test)
diff --git a/test/unit/python/mesh/test_mesh_transformation.py b/test/unit/python/mesh/test_mesh_transformation.py
index 314a646..af8a8dd 100755
--- a/test/unit/python/mesh/test_mesh_transformation.py
+++ b/test/unit/python/mesh/test_mesh_transformation.py
@@ -18,23 +18,22 @@
 #
 # You should have received a copy of the GNU Lesser General Public License
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2012-01-16
-# Last changed: 2013-06-28
-
 
 from dolfin import *
 
+
 def test_translate_2d():
     mesh = UnitSquareMesh(8, 8)
     p = Point(1, 2)
     mesh.translate(p)
 
+
 def test_translate_3d():
     mesh = UnitCubeMesh(8, 8, 8)
     p = Point(1, 2, 3)
     mesh.translate(p)
 
+
 def test_rotate_2d():
     mesh = UnitSquareMesh(8, 8)
     p = Point(1, 2)
@@ -42,6 +41,7 @@ def test_rotate_2d():
     mesh.rotate(10, 2)
     mesh.rotate(10, 2, p)
 
+
 def test_rotate_3d():
     mesh = UnitCubeMesh(8, 8, 8)
     p = Point(1, 2, 3)
@@ -49,3 +49,21 @@ def test_rotate_3d():
     mesh.rotate(30, 1)
     mesh.rotate(30, 2)
     mesh.rotate(30, 0, p)
+
+
+def test_rescale_2d():
+    mesh = UnitSquareMesh(8, 8)
+    p = Point(4, 4)
+    s = 1.5
+    MeshTransformation.rescale(mesh, s, p)
+    comm = mesh.mpi_comm()
+    assert MPI.sum(comm, sum(c.volume() for c in cells(mesh))) == s*s
+
+
+def test_rescale_3d():
+    mesh = UnitCubeMesh(8, 8, 8)
+    p = Point(4, 4, 4)
+    s = 1.5
+    MeshTransformation.rescale(mesh, s, p)
+    comm = mesh.mpi_comm()
+    assert MPI.sum(comm, sum(c.volume() for c in cells(mesh))) == s*s*s
diff --git a/test/unit/python/mesh/test_mesh_value_collection.py b/test/unit/python/mesh/test_mesh_value_collection.py
index 08edfb5..187c141 100755
--- a/test/unit/python/mesh/test_mesh_value_collection.py
+++ b/test/unit/python/mesh/test_mesh_value_collection.py
@@ -44,13 +44,14 @@ def test_assign_2D_cells():
         value = ncells - cell.index()
         assert value, g.get_value(cell.index() == 0)
 
-    old_value = g.get_value(0,0)
-    g.set_value(0, 0, old_value+1)
-    assert old_value+1 == g.get_value(0, 0)
+    old_value = g.get_value(0, 0)
+    g.set_value(0, 0, old_value + 1)
+    assert old_value + 1 == g.get_value(0, 0)
+
 
 def test_assign_2D_facets():
     mesh = UnitSquareMesh(3, 3)
-    mesh.init(2,1)
+    mesh.init(2, 1)
     ncells = mesh.num_cells()
     f = MeshValueCollection("int", mesh, 1)
     all_new = True
@@ -70,9 +71,10 @@ def test_assign_2D_facets():
         for i, facet in enumerate(facets(cell)):
             assert value+i == g.get_value(cell.index(), i)
 
+
 def test_assign_2D_vertices():
     mesh = UnitSquareMesh(3, 3)
-    mesh.init(2,0)
+    mesh.init(2, 0)
     ncells = mesh.num_cells()
     f = MeshValueCollection("int", mesh, 0)
     all_new = True
@@ -92,6 +94,7 @@ def test_assign_2D_vertices():
         for i, vert in enumerate(vertices(cell)):
             assert value+i == g.get_value(cell.index(), i)
 
+
 def test_mesh_function_assign_2D_cells():
     mesh = UnitSquareMesh(3, 3)
     ncells = mesh.num_cells()
@@ -115,7 +118,7 @@ def test_mesh_function_assign_2D_cells():
     global_indices = mesh.topology().global_indices(2)
     ncells_global = mesh.size_global(2)
     for cell in cells(mesh):
-        if global_indices[cell.index()] in [5,8,10]:
+        if global_indices[cell.index()] in [5, 8, 10]:
             continue
         value = ncells_global - global_indices[cell.index()]
         h.set_value(cell.index(), int(value))
@@ -123,13 +126,14 @@ def test_mesh_function_assign_2D_cells():
     f3 = MeshFunction("int", mesh, h)
 
     values = f3.array()
-    values[values>ncells_global] = 0.
+    values[values > ncells_global] = 0.
 
     info(str(values))
     info(str(values.sum()))
 
     assert MPI.sum(mesh.mpi_comm(), values.sum()*1.0) == 140.
 
+
 def test_mesh_function_assign_2D_facets():
     mesh = UnitSquareMesh(3, 3)
     mesh.init(1)
@@ -152,6 +156,7 @@ def test_mesh_function_assign_2D_facets():
         for i, facet in enumerate(facets(cell)):
             assert f2[facet] == g.get_value(cell.index(), i)
 
+
 def test_mesh_function_assign_2D_vertices():
     mesh = UnitSquareMesh(3, 3)
     mesh.init(0)
diff --git a/test/unit/python/mesh/test_multi_mesh_integration.py b/test/unit/python/mesh/test_multi_mesh_integration.py
index 6b17bf9..ef5f625 100755
--- a/test/unit/python/mesh/test_multi_mesh_integration.py
+++ b/test/unit/python/mesh/test_multi_mesh_integration.py
@@ -20,7 +20,7 @@
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 #
 # First added:  2014-03-04
-# Last changed: 2014-03-10
+# Last changed: 2015-11-30
 
 from __future__ import print_function
 import numpy
@@ -30,6 +30,7 @@ from six.moves import xrange as range
 
 from dolfin_utils.test import skip_in_parallel
 
+
 def triangulation_to_mesh_2d(triangulation):
     editor = MeshEditor()
     mesh = Mesh()
@@ -45,6 +46,7 @@ def triangulation_to_mesh_2d(triangulation):
     editor.close()
     return mesh
 
+
 @skip_in_parallel
 def test_integrate():
     # Create two meshes of the unit square
@@ -76,29 +78,6 @@ def test_integrate():
         #print("quadrature")
         #print(qr)
 
-    V_0 = FunctionSpace(mesh_0, "CG", 1)
-    V_1 = FunctionSpace(mesh_1, "CG", 1)
-
-    V_multi = MultiMeshFunctionSpace()
-    V_multi.add(V_0)
-    V_multi.add(V_1)
-    V_multi.build()
-
-    u = MultiMeshFunction(V_multi)
-    u.vector()[:] = 1.
-
-    v_0 = Function(V_0)
-    v_1 = Function(V_1)
-    v_0.vector()[:] = 1.
-    v_1.vector()[:] = 1.
-
-    L_multi = MultiMeshForm(V_multi)
-    L_0 = Form(v_0*dx)
-    L_1 = Form(v_1*dx)
-    L_multi.add(L_0)
-    L_multi.add(L_1)
-    L_multi.build()
-
     # area = assemble(L_0) + assemble(L_1)
     # MMA = MultiMeshAssembler()
     # area = MMA.assemble(L_multi)
diff --git a/test/unit/python/mesh/test_periodic_boundary_computation.py b/test/unit/python/mesh/test_periodic_boundary_computation.py
index a9954f0..8811d8a 100755
--- a/test/unit/python/mesh/test_periodic_boundary_computation.py
+++ b/test/unit/python/mesh/test_periodic_boundary_computation.py
@@ -28,21 +28,25 @@ from dolfin import *
 
 from dolfin_utils.test import *
 
+
 @fixture
 def periodic_boundary():
     class PeriodicBoundary(SubDomain):
         def inside(self, x, on_boundary):
             return x[0] < DOLFIN_EPS
+
         def map(self, x, y):
             y[0] = x[0] - 1.0
             y[1] = x[1]
 
     return PeriodicBoundary()
 
+
 @fixture
 def pbc():
     return PeriodicBoundaryComputation()
 
+
 @fixture
 def mesh():
     return UnitSquareMesh(4, 4)
@@ -53,7 +57,7 @@ def test_ComputePeriodicPairs(pbc, periodic_boundary, mesh):
 
     # Verify that correct number of periodic pairs are computed
     vertices = pbc.compute_periodic_pairs(mesh, periodic_boundary, 0)
-    edges    = pbc.compute_periodic_pairs(mesh, periodic_boundary, 1)
+    edges = pbc.compute_periodic_pairs(mesh, periodic_boundary, 1)
     assert len(vertices) == 5
     assert len(edges) == 4
 
diff --git a/test/unit/python/mesh/test_sub_domain.py b/test/unit/python/mesh/test_sub_domain.py
index 669cb26..cc24e8b 100755
--- a/test/unit/python/mesh/test_sub_domain.py
+++ b/test/unit/python/mesh/test_sub_domain.py
@@ -22,11 +22,11 @@
 # First added:  2013-06-24
 # Last changed: 2013-06-24
 
-
 import numpy as np
 from dolfin import *
 import pytest
 
+
 def test_compiled_subdomains():
     def noDefaultValues():
         CompiledSubDomain("a")
@@ -44,6 +44,7 @@ def test_compiled_subdomains():
     with pytest.raises(RuntimeError):
         wrongParameterNames()
 
+
 def test_creation_and_marking():
 
     class Left(SubDomain):
@@ -55,52 +56,50 @@ def test_creation_and_marking():
             return x[0] > 1.0 - DOLFIN_EPS
 
     subdomain_pairs = [(Left(), Right()),
-                        (AutoSubDomain(\
-                            lambda x, on_boundary: x[0] < DOLFIN_EPS),
-                        AutoSubDomain(\
-                            lambda x, on_boundary: x[0] > 1.0 - DOLFIN_EPS)),
-                        (CompiledSubDomain("near(x[0], a)", a = 0.0),
-                        CompiledSubDomain("near(x[0], a)", a = 1.0)),
-                        (CompiledSubDomain("near(x[0], 0.0)"),
+                       (AutoSubDomain(lambda x, on_boundary: x[0] < DOLFIN_EPS),
+                        AutoSubDomain(lambda x, on_boundary: x[0] > 1.0 - DOLFIN_EPS)),
+                       (CompiledSubDomain("near(x[0], a)", a=0.0),
+                        CompiledSubDomain("near(x[0], a)", a=1.0)),
+                       (CompiledSubDomain("near(x[0], 0.0)"),
                         CompiledSubDomain("near(x[0], 1.0)"))]
 
     empty = CompiledSubDomain("false")
     every = CompiledSubDomain("true")
 
-    for ind, MeshClass in enumerate([UnitIntervalMesh, UnitSquareMesh, UnitCubeMesh]):
-        dim = ind+1
+    for ind, MeshClass in enumerate([UnitIntervalMesh, UnitSquareMesh,
+                                     UnitCubeMesh]):
+        dim = ind + 1
         args = [10]*dim
         mesh = MeshClass(*args)
 
         mesh.init()
 
         for left, right in subdomain_pairs:
-
             for MeshFunc, f_dim in [(VertexFunction, 0),
-                                    (FacetFunction, dim-1),
+                                    (FacetFunction, dim - 1),
                                     (CellFunction, dim)]:
                 f = MeshFunc("size_t", mesh, 0)
 
                 left.mark(f, 1)
                 right.mark(f, 2)
 
-                correct = {(1,0):1,
-                            (1,0):1,
-                            (1,1):0,
-                            (2,0):11,
-                            (2,1):10,
-                            (2,2):0,
-                            (3,0):121,
-                            (3,2):200,
-                            (3,3):0}
+                correct = {(1, 0): 1,
+                           (1, 0): 1,
+                           (1, 1): 0,
+                           (2, 0): 11,
+                           (2, 1): 10,
+                           (2, 2): 0,
+                           (3, 0): 121,
+                           (3, 2): 200,
+                           (3, 3): 0}
 
                 # Check that the number of marked entities are at least the
                 # correct number (it can be larger in parallel)
                 assert all(value >= correct[dim, f_dim]
-                            for value in [
-                              MPI.sum(mesh.mpi_comm(), float((f.array()==2).sum())),
-                              MPI.sum(mesh.mpi_comm(), float((f.array()==1).sum())),
-                              ])
+                for value in [
+                        MPI.sum(mesh.mpi_comm(), float((f.array() == 2).sum())),
+                        MPI.sum(mesh.mpi_comm(), float((f.array() == 1).sum())),
+                ])
 
         for MeshFunc, f_dim in [(VertexFunction, 0),
                                 (FacetFunction, dim-1),
@@ -111,5 +110,5 @@ def test_creation_and_marking():
             every.mark(f, 2)
 
             # Check that the number of marked entities is correct
-            assert sum(f.array()==1) == 0
-            assert sum(f.array()==2) == mesh.num_entities(f_dim)
+            assert sum(f.array() == 1) == 0
+            assert sum(f.array() == 2) == mesh.num_entities(f_dim)
diff --git a/test/unit/python/mesh/test_sub_mesh.py b/test/unit/python/mesh/test_sub_mesh.py
index 751e717..f9c63c6 100755
--- a/test/unit/python/mesh/test_sub_mesh.py
+++ b/test/unit/python/mesh/test_sub_mesh.py
@@ -25,6 +25,7 @@ from dolfin import *
 import six
 from dolfin_utils.test import skip_in_parallel, datadir
 
+
 @pytest.fixture(scope='module', params=range(3))
 def MeshFunc(request):
     test_mesh = [(UnitIntervalMesh, (10,)),
@@ -32,6 +33,7 @@ def MeshFunc(request):
                  (UnitCubeMesh, (10, 10, 10))]
     return test_mesh[request.param]
 
+
 @skip_in_parallel
 def test_creation(MeshFunc):
     """Create SubMesh."""
@@ -43,7 +45,7 @@ def test_creation(MeshFunc):
     domains = CellFunction("size_t", mesh, 0)
     for cell in cells(mesh):
         # Mark half the cells
-        if cell.index()>mesh.num_cells()/2:
+        if cell.index() > mesh.num_cells()/2:
             break
         domains[cell] = 1
         mesh.domains().set_marker((cell.index(), 1), dim_t)
@@ -59,17 +61,18 @@ def test_creation(MeshFunc):
     for cell0, cell1 in zip(cells(smesh0), cells(smesh1)):
         assert cell0.index() == cell1.index()
         assert smesh0.domains().get_marker(cell0.index(), dim_t) == \
-               smesh1.domains().get_marker(cell1.index(), dim_t)
+            smesh1.domains().get_marker(cell1.index(), dim_t)
 
     # This test passed for unittest because it called SubMesh((mesh, 2))
     # and not SubMesh(mesh, 2)
-    #with pytest.raises(RuntimeError):
+    # with pytest.raises(RuntimeError):
     #    SubMesh(mesh, 2)
 
     mesh = MeshFunc(*args)
     with pytest.raises(RuntimeError):
         SubMesh(mesh, 1)
 
+
 @skip_in_parallel
 def test_facet_domain_propagation(datadir):
 
@@ -87,14 +90,17 @@ def test_facet_domain_propagation(datadir):
 
     for value in [5, 10, 15]:
         sum_parent = 0
-        sum_inner  = 0
-        sum_outer  = 0
+        sum_inner = 0
+        sum_outer = 0
         for key, val in six.iteritems(parent_facets):
-            if val == value: sum_parent += val
+            if val == value:
+                sum_parent += val
         for key, val in six.iteritems(inner_facets):
-            if val == value: sum_inner += val
+            if val == value:
+                sum_inner += val
         for key, val in six.iteritems(outer_facets):
-            if val == value: sum_outer += val
+            if val == value:
+                sum_outer += val
 
         assert sum_outer == sum_inner
         assert sum_outer == sum_parent
@@ -106,7 +112,7 @@ def test_facet_domain_propagation(datadir):
 
     # Check we have the same number of value-marked facets
     for value in [5, 10, 15]:
-        assert ((inner_facets.array()==value).sum() ==
-                (outer_facets.array()==value).sum())
-        assert ((parent_facets.array()==value).sum() ==
-                (outer_facets.array()==value).sum())
+        assert ((inner_facets.array() == value).sum() ==
+                (outer_facets.array() == value).sum())
+        assert ((parent_facets.array() == value).sum() ==
+                (outer_facets.array() == value).sum())
diff --git a/test/unit/python/meshconvert/test_mesh_converter.py b/test/unit/python/meshconvert/test_mesh_converter.py
index 89a65db..ec82581 100755
--- a/test/unit/python/meshconvert/test_mesh_converter.py
+++ b/test/unit/python/meshconvert/test_mesh_converter.py
@@ -78,7 +78,7 @@ class Tester:
         self.assertEqual(A.ufl_shape, B.ufl_shape)
         self.assertEqual(inner(A-B, A-B)(None), 0)
 
- 
+
 class TestCase(Tester):
     def _get_tempfname(self, suffix=None):
         fd, fname = tempfile.mkstemp(suffix=suffix)
@@ -340,7 +340,8 @@ class TestGmsh(_ConverterTest):
         self.assert_(ended)
         self.assert_(handler.closed)
 
-    def test_1D_facet_markings_2 (self):
+    # FIXME: test disabled, see https://bitbucket.org/fenics-project/dolfin/issues/682
+    def xtest_1D_facet_markings_2 (self):
         """
         Test to see if the 1D facet markings behave as expected.
         2 vertices marked
@@ -348,7 +349,8 @@ class TestGmsh(_ConverterTest):
         marked_facets = [0,2]
         self._facet_marker_driver(1, 2, marked_facets, 11)
 
-    def test_2D_facet_markings_1 (self):
+    # FIXME: test disabled, see https://bitbucket.org/fenics-project/dolfin/issues/682
+    def xtest_2D_facet_markings_1 (self):
         """
         Test to see if the 2D facet markings behave as expected.
         1 edge marked
@@ -356,7 +358,8 @@ class TestGmsh(_ConverterTest):
         marked_facets = [7]
         self._facet_marker_driver(2, 1, marked_facets, 8)
 
-    def test_2D_facet_markings_2 (self):
+    # FIXME: test disabled, see https://bitbucket.org/fenics-project/dolfin/issues/682
+    def xtest_2D_facet_markings_2 (self):
         """
         Test to see if the 2D facet markings behave as expected.
         2 edges marked
@@ -364,7 +367,8 @@ class TestGmsh(_ConverterTest):
         marked_facets = [2,5]
         self._facet_marker_driver(2, 2, marked_facets, 8)
 
-    def test_2D_facet_markings_3 (self):
+    # FIXME: test disabled, see https://bitbucket.org/fenics-project/dolfin/issues/682
+    def xtest_2D_facet_markings_3 (self):
         """
         Test to see if the 2D facet markings behave as expected.
         3 edges marked
@@ -372,7 +376,8 @@ class TestGmsh(_ConverterTest):
         marked_facets = [5,6,7]
         self._facet_marker_driver(2, 3, marked_facets, 8)
 
-    def test_2D_facet_markings_4 (self):
+    # FIXME: test disabled, see https://bitbucket.org/fenics-project/dolfin/issues/682
+    def xtest_2D_facet_markings_4 (self):
         """
         Test to see if the 2D facet markings behave as expected.
         4 edges marked
@@ -380,7 +385,8 @@ class TestGmsh(_ConverterTest):
         marked_facets = [2,5,6,7]
         self._facet_marker_driver(2, 4, marked_facets, 8)
 
-    def test_3D_facet_markings_1 (self):
+    # FIXME: test disabled, see https://bitbucket.org/fenics-project/dolfin/issues/682
+    def xtest_3D_facet_markings_1 (self):
         """
         Test the marking of 3D facets
         Unit cube, 1 Face marked
diff --git a/utils/xml/convertall b/test/unit/python/mpipipe.sh
old mode 100644
new mode 100755
similarity index 53%
rename from utils/xml/convertall
rename to test/unit/python/mpipipe.sh
index 44f0049..6522d12
--- a/utils/xml/convertall
+++ b/test/unit/python/mpipipe.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
-#
-# Copyright (C) 2006 Anders Logg
+
+# Copyright (C) 2015 Martin Alnæs
+# Copyright (C) 2015 Johannes Ring
 #
 # This file is part of DOLFIN.
 #
@@ -16,25 +17,22 @@
 #
 # You should have received a copy of the GNU Lesser General Public License
 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# Convert all DOLFIN XML files in a directory from
-# the old DOLFIN XML format to the new format
 
-# Unpack all .xml.gz files if any
-for f in *.xml.gz; do
-	echo "Unpacking $f..."
-	gunzip $f
-done
+# This script redirects output from a command to output.MYRANK
 
-# Convert all .xml files
-for f in *.xml; do
-	echo "Converting $f..."
-	mv $f $f.old
-	dolfin-convert -i xml-old $f.old $f
-done
+# See: http://docs.roguewave.com/threadspotter/2012.1/linux/manual_html/apas03.html
+if [ ! -z $OMPI_COMM_WORLD_RANK ]; then
+    MYRANK=$OMPI_COMM_WORLD_RANK
+elif [ ! -z $PMI_RANK ]; then
+    MYRANK=$PMI_RANK
+else
+    MYRANK=`python -c "import dolfin;c=dolfin.mpi_comm_world();r=dolfin.MPI.rank(c);print(r);dolfin.MPI.barrier(c)"`
+fi
 
-# Pack all .xml files
-for f in *.xml; do
-	echo "Packing $f..."
-	gzip $f
-done
+OUT=output.$MYRANK
+echo My rank is $MYRANK, writing to $OUT
+if [ $MYRANK -eq 0 ]; then
+  $@ | tee $OUT
+else
+  $@ > $OUT
+fi
diff --git a/test/unit/python/multistage/test_RK_solver.py b/test/unit/python/multistage/test_RK_solver.py
index ac441a5..97503b9 100755
--- a/test/unit/python/multistage/test_RK_solver.py
+++ b/test/unit/python/multistage/test_RK_solver.py
@@ -54,7 +54,7 @@ def test_butcher_schemes_scalar():
     form = u*v*dx
 
     tstop = 1.0
-    u_true = Expression("exp(t)", t=tstop)
+    u_true = Expression("exp(t)", t=tstop, degree=2)
 
     for Scheme in [ForwardEuler, ExplicitMidPoint, RK4,
                    BackwardEuler, CN2, ESDIRK3, ESDIRK4]:
@@ -85,7 +85,7 @@ def test_butcher_schemes_vector():
     form = inner(as_vector((-u[1], u[0])), v)*dx
 
     tstop = 1.0
-    u_true = Expression(("cos(t)", "sin(t)"), t=tstop)
+    u_true = Expression(("cos(t)", "sin(t)"), t=tstop, degree=2)
 
     for Scheme in [ForwardEuler, ExplicitMidPoint, RK4,
                    BackwardEuler, CN2, ESDIRK3, ESDIRK4]:
diff --git a/test/unit/python/multistage/test_point_integral_solver.py b/test/unit/python/multistage/test_point_integral_solver.py
index 000b817..f20658d 100755
--- a/test/unit/python/multistage/test_point_integral_solver.py
+++ b/test/unit/python/multistage/test_point_integral_solver.py
@@ -61,11 +61,11 @@ def test_butcher_schemes_scalar_time(Scheme, optimize):
     tstop = 1.0
     weight = Constant(2)
     u_true = Expression("u0 + 2*t + pow(t, 2)/2. + weight*pow(t, 3)/3. - "\
-                        "pow(t, 5)/5.", t=tstop, u0=u0, weight=weight)
+                        "pow(t, 5)/5.", t=tstop, u0=u0, weight=weight, degree=2)
 
     u = Function(V)
-    compound_time_expr = Expression("weight*time*time", weight=weight, \
-                                    element=time.element(), time=time)
+    compound_time_expr = Expression("weight*time*time", weight=weight,
+                                    element=time.ufl_element(), time=time, degree=2)
     form = (2+time+compound_time_expr-time**4)*v*dP
 
     scheme = Scheme(form, u, time)
@@ -88,19 +88,19 @@ def test_butcher_schemes_scalar(Scheme, optimize):
 
     if Scheme in scalar_excludes:
         return
-    
+
     mesh = UnitSquareMesh(10, 10)
     V = FunctionSpace(mesh, "CG", 1)
     v = TestFunction(V)
 
     tstop = 1.0
-    u_true = Expression("1.0-(exp(-t))", t=tstop)
+    u_true = Expression("1.0-(exp(-t))", t=tstop, degree=2)
 
     u = Function(V)
     form = (1-u)*v*dP
 
     scheme = Scheme(form, u)
-        
+
     info(scheme)
     u_errors = []
     solver = PointIntegralSolver(scheme)
@@ -133,13 +133,13 @@ def test_butcher_schemes_vector(Scheme, optimize):
     V = VectorFunctionSpace(mesh, "CG", 1, dim=2)
     v = TestFunction(V)
     tstop = 1.0
-    u_true = Expression(("cos(t)", "sin(t)"), t=tstop)
+    u_true = Expression(("cos(t)", "sin(t)"), t=tstop, degree=2)
 
     u = Function(V)
     form = (-u[1]*v[0]+u[0]*v[1])*dP
 
     scheme = Scheme(form, u)
-        
+
     info(scheme)
     solver = PointIntegralSolver(scheme)
     u_errors = []
diff --git a/test/unit/python/nls/test_PETScSNES_solver.py b/test/unit/python/nls/test_PETScSNES_solver.py
index d570c14..0e86912 100755
--- a/test/unit/python/nls/test_PETScSNES_solver.py
+++ b/test/unit/python/nls/test_PETScSNES_solver.py
@@ -88,11 +88,11 @@ def J(V, u, F):
 
 @fixture
 def lb(V):
-    return Function(interpolate(Constant(0.), V))
+    return interpolate(Constant(0.), V)
 
 @fixture
 def ub(V):
-    return Function(interpolate(Constant(100.), V))
+    return interpolate(Constant(100.), V)
 
 @fixture
 def newton_solver_parameters():
@@ -140,19 +140,23 @@ def test_snes_solver_bound_functions(F, u, bcs, J, \
                                      parameter_backend):
     u.interpolate(Constant(-1000.0))
     problem = NonlinearVariationalProblem(F, u, bcs, J)
+    problem.set_bounds(lb, ub)
+
     solver  = NonlinearVariationalSolver(problem)
     solver.parameters.update(snes_solver_parameters_bounds)
-    solver.solve(lb, ub)
+    solver.solve()
     assert u.vector().min() >= 0
 
 
 @skip_if_not_PETSc
 def test_snes_solver_bound_vectors(F, u, bcs, J, snes_solver_parameters_bounds,
-                                    lb, ub, parameter_degree, \
+                                   lb, ub, parameter_degree, \
                                    parameter_backend):
     u.interpolate(Constant(-1000.0))
     problem = NonlinearVariationalProblem(F, u, bcs, J)
+    problem.set_bounds(lb, ub)
+
     solver  = NonlinearVariationalSolver(problem)
     solver.parameters.update(snes_solver_parameters_bounds)
-    solver.solve(lb.vector(), ub.vector())
+    solver.solve()
     assert u.vector().min() >= 0
diff --git a/test/unit/python/nls/test_PETScTAOSolver.py b/test/unit/python/nls/test_PETScTAOSolver.py
old mode 100644
new mode 100755
index fd57328..e0014c9
--- a/test/unit/python/nls/test_PETScTAOSolver.py
+++ b/test/unit/python/nls/test_PETScTAOSolver.py
@@ -35,7 +35,7 @@ from dolfin_utils.test import *
 
 backend = set_parameters_fixture("linear_algebra_backend", ["PETSc"])
 
- at skip_if_not_TAO
+ at skip_if_not_PETSc
 def test_tao_linear_bound_solver(backend):
     "Test PETScTAOSolver"
 
diff --git a/test/unit/python/nls/test_TAO_linear_bound_solver.py b/test/unit/python/nls/test_TAO_linear_bound_solver.py
index 511a868..5680157 100755
--- a/test/unit/python/nls/test_TAO_linear_bound_solver.py
+++ b/test/unit/python/nls/test_TAO_linear_bound_solver.py
@@ -47,7 +47,7 @@ from dolfin_utils.test import *
 
 backend = set_parameters_fixture("linear_algebra_backend", ["PETSc"])
 
- at skip_if_not_TAO
+ at skip_if_not_PETSc
 def test_tao_linear_bound_solver(backend):
     "Test TAOLinearBoundSolver"
 
diff --git a/test/unit/python/parallel-assembly-solve/test_solve_result_against_reference.py b/test/unit/python/parallel-assembly-solve/test_solve_result_against_reference.py
index 1a0798d..0db4b94 100755
--- a/test/unit/python/parallel-assembly-solve/test_solve_result_against_reference.py
+++ b/test/unit/python/parallel-assembly-solve/test_solve_result_against_reference.py
@@ -113,6 +113,10 @@ def test_computed_norms_against_references():
               (UnitCubeMesh(4, 4, 4),  "4x4x4 unit cube")]
     degrees = [1, 2, 3, 4]
 
+    # For MUMPS, increase estimated require memory increase. Typically
+    # required for high order elements on small meshes in 3D
+    PETScOptions.set("mat_mumps_icntl_14", 40)
+
     # Iterate over test cases and collect results
     results = []
     for mesh in meshes:
@@ -121,6 +125,9 @@ def test_computed_norms_against_references():
             norm = compute_norm(mesh[0], degree)
             results.append((mesh[1], degree, norm))
 
+    # Change option back to default
+    PETScOptions.set("mat_mumps_icntl_14", 20)
+
     # Check results
     errors = check_results(results, reference, tol)
 
diff --git a/test/unit/python/parameter/test_parameters.py b/test/unit/python/parameter/test_parameters.py
index 4a8647f..df8b0d0 100755
--- a/test/unit/python/parameter/test_parameters.py
+++ b/test/unit/python/parameter/test_parameters.py
@@ -112,6 +112,12 @@ def test_nested(tempdir):
     assert p1["sub0"]["monitor_convergence"] == True
 
 @skip_in_parallel
+def test_parameters_update(tempdir):
+    p0 = parameters.copy()
+    p1 = parameters.copy()
+    p1.update(p0)
+
+ at skip_in_parallel
 def test_nested_read_existing(tempdir):
     """Test that we can read in a nested parameter database into
        an existing (and matching) parameter database"""
@@ -140,4 +146,5 @@ def test_solver_parameters():
     assert krylov_solver.parameters["absolute_tolerance"] == 1.23456
 
     # Reset parameters so that other tests will continue to work
-    parameters["krylov_solver"]["absolute_tolerance"] = absolute_tolerance
+    if absolute_tolerance is not None:
+        parameters["krylov_solver"]["absolute_tolerance"] = absolute_tolerance
diff --git a/utils/gid/DOLFIN.bas b/utils/gid/DOLFIN.bas
deleted file mode 100644
index 138b6d9..0000000
--- a/utils/gid/DOLFIN.bas
+++ /dev/null
@@ -1,17 +0,0 @@
-*#FILE_EXTENSION .xml
-*realformat "%-f"
-<?xml version="1.0"?>
-<dolfin xmlns:dolfin="http://fenicsproject.org">
-  <mesh celltype="tetrahedron" dim="3">
-    <vertices size="*npoin">
-*loop nodes
-      <vertex index="*operation(nodesnum-1)" x="*nodescoord(1)" y="*nodescoord(2)" z="*nodescoord(3)"/>
-*end nodes
-    </vertices>
-    <cells size="*nelem">
-*loop elems
-      <tetrahedron index="*operation(elemsnum-1)" v0="*operation(elemsconec(1)-1)" v1="*operation(elemsconec(2)-1)" v2="*operation(elemsconec(3)-1)" v3="*operation(elemsconec(4)-1)" />
-*end elems
-    </cells>
-  </mesh>
-</dolfin>
diff --git a/utils/matlab/meshindex.m b/utils/matlab/meshindex.m
deleted file mode 100644
index 20af389..0000000
--- a/utils/matlab/meshindex.m
+++ /dev/null
@@ -1,54 +0,0 @@
-function index = meshindex(p, t)
-
-% MESHINDEX - COMPUTE APPROXIMATE MULTI-ADAPTIVE EFFICIENCY INDEX FOR MESH
-%
-% Usage: index = meshindex(p, t)
-%
-%   p - points    (exported from PDE Toolbox)
-%   t - triangles (exported from PDE Toolbox)
-%	
-% Copyright (C) 2005 Anders Logg
-%
-% This file is part of DOLFIN.
-%
-% DOLFIN is free software: you can redistribute it and/or modify
-% it under the terms of the GNU Lesser General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% DOLFIN is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU Lesser General Public License for more details.
-%
-% You should have received a copy of the GNU Lesser General Public License
-% along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-
-hmin = 1.0;
-hlist = hmin*ones(size(p, 2), 1);
-
-for triangle = t
-
-  i0 = triangle(1);
-  i1 = triangle(2);
-  i2 = triangle(3);
-
-  p0 = p(:, i0);
-  p1 = p(:, i1);
-  p2 = p(:, i2);
-
-  h0 = norm(p1 - p0);
-  h1 = norm(p2 - p1);
-  h2 = norm(p0 - p2);
-
-  h = min([h0, h1, h2]);
-
-  hlist(i0) = min(hlist(i0), h);
-  hlist(i1) = min(hlist(i1), h);
-  hlist(i2) = min(hlist(i2), h);
-
-  hmin = min(h, hmin);
-
-end
-
-index = (length(hlist) / hmin) / sum(1.0 ./ hlist);
diff --git a/utils/matlab/plotcontroller.m b/utils/matlab/plotcontroller.m
deleted file mode 100644
index aa7a2dc..0000000
--- a/utils/matlab/plotcontroller.m
+++ /dev/null
@@ -1,35 +0,0 @@
-% Copyright (C) 2005 Anders Logg
-%
-% This file is part of DOLFIN.
-%
-% DOLFIN is free software: you can redistribute it and/or modify
-% it under the terms of the GNU Lesser General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% DOLFIN is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU Lesser General Public License for more details.
-%
-% You should have received a copy of the GNU Lesser General Public License
-% along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-% 
-% Simple script for evaluating the performance of
-% different time step controllers.
-
-clf
-
-subplot(2,1,1)
-plot(t, k)
-
-subplot(2,1,2)
-e = k.*abs(r);
-semilogy(t, e);
-hold on
-plot(t, 2.0*tol*ones(size(t)))
-plot(t, 1.0*tol*ones(size(t)))
-plot(t, 0.5*tol*ones(size(t)))
-grid on
-xlabel('t')
-ylabel('e')
diff --git a/utils/matlab/plotslab.m b/utils/matlab/plotslab.m
deleted file mode 100644
index 7d7d4e2..0000000
--- a/utils/matlab/plotslab.m
+++ /dev/null
@@ -1,173 +0,0 @@
-% Copyright (C) 2003-2005 Anders Logg
-% Copyright (C) 2003 Johan Hoffman
-%
-% This file is part of DOLFIN.
-%
-% DOLFIN is free software: you can redistribute it and/or modify
-% it under the terms of the GNU Lesser General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% DOLFIN is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU Lesser General Public License for more details.
-%
-% You should have received a copy of the GNU Lesser General Public License
-% along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-%
-% First added:  2003-11-07
-% Last changed: 2005
-
-function M = plotslab(debugfile, interval, drawupdates, drawtext, saveps, savepng)
-
-% Usage: M = plotslab(debugfile, interval, drawupdates, drawtext, saveps, savepng)
-%
-% Draws and creates a movie M of a time slab. A debug file
-% is created by DOLFIN when the option 'debug time steps'
-% is specified.
-%
-% Arguments:
-%
-%   debugfile   - name of file containing time stepping data
-%   interval    - plot elements within interval
-%   drawupdates - blink element updates
-%   drawtext    - draw extra text
-%   saveps      - save a postscript file for each frame
-%   savepng     - save a png file for each frame
-
-% Load the steps
-disp('Loading file...')
-timesteps = load(debugfile);
-
-% Get the number of components
-N  = max(timesteps(:,2)) + 1;
-
-% Get the time interval
-T1 = interval(1);
-T2 = interval(2);
-
-% Create figure
-clf
-axis([T1 T2 -0.3*N 1.2*N])
-axis off
-hold on
-if drawtext
-  h1 = text(T1,1.1*N,'Action:');
-  h2 = text(T1,-0.1*N,['t = ' num2str(T1)]);
-  h3 = text(T1,-0.15*N,['i = ' num2str(0)]);
-end
-plot([T1 T2],[0 0],'k');
-framecount = 1;
-iterations = 0;
-
-% Clear the movie
-clear M
-
-% Step to the correct position
-for i = 1:size(timesteps,1)
-
-  a  = timesteps(i,1);
-  n  = timesteps(i,2);
-  t1 = timesteps(i,3);
-  t2 = timesteps(i,4); 
-
-  if t2 >= T1
-    break;
-  end
-
-end
-
-% Draw the elements
-for j = i:size(timesteps, 1)
-
-  % Get next element
-  a  = timesteps(j,1);
-  n  = timesteps(j,2);
-  t1 = timesteps(j,3);
-  t2 = timesteps(j,4);
-
-  % Go to next element if we don't want to draw updates
-  if ~drawupdates & a == 1
-    continue
-  end
-  
-  % Check if we have finished
-  if t1 > T2
-    break
-  end
-
-  % Check action
-  switch a
-    case 0
-      
-      % Draw a new box
-      %c = [128 156 178]/256;
-      c = 'b';
-      drawbox([t1 n], [t2 (n+1)], c);
-
-      % Draw text
-      if ( drawtext )
-	set(h1, 'String', 'Action: Creating new element')
-	set(h2, 'String', ['t = ' num2str(t1)])
-	set(h3, 'String', ['i = ' num2str(n)])
-      end
-
-    case 1
-
-      % Blink box
-      %c = [0 98 178]/256;
-      c = 'r';
-      cc = [250 130 180]/256;
-      drawbox([t1 n], [t2 (n+1)], c);
-
-      % Draw text
-      if ( drawtext )
-	set(h1, 'String', 'Action: Updating element')
-	set(h2, 'String', ['t = ' num2str(t1)])
-	set(h3, 'String', ['i = ' num2str(n)])
-      end
-      
-      % Save frame
-      drawnow
-      M(framecount) = getframe;
-      if saveps
-	print('-depsc', ['frame_' sprintf('%.4d', framecount) '.eps'])
-      elseif savepng
-	print('-dpng', '-r0', ['frame_' sprintf('%.4d', framecount) '.png'])
-      else
-	disp('Press any key to continue')
-	pause
-      end		  
-      framecount = framecount + 1;
-
-      % Restore box
-      %c = [128 156 178]/256;
-      c = 'b';
-      drawbox([t1 n], [t2 (n+1)], c);
-
-  end  
-  
-  % Save frame
-  drawnow
-  M(framecount) = getframe;
-  if saveps
-    print('-depsc', ['frame_' sprintf('%.4d', framecount) '.eps'])
-  elseif savepng
-    print('-dpng', '-r0', ['frame_' sprintf('%.4d', framecount) '.png'])
-  else
-    disp('Press any key to continue')
-    pause
-  end		  
-  framecount = framecount + 1;
-  
-end
-
-function drawbox(x, y, c)
-
-% This function draws a box from x to y with color c
-
-x1 = [x(1) y(1) y(1) x(1)];
-x2 = [x(2) x(2) y(2) y(2)];
-
-fill(x1, x2, c)
diff --git a/utils/matlab/xmlmatrix.m b/utils/matlab/xmlmatrix.m
deleted file mode 100644
index 1a1ce45..0000000
--- a/utils/matlab/xmlmatrix.m
+++ /dev/null
@@ -1,72 +0,0 @@
-function xmlmatrix(filename, A)
-
-% XMLMATRIX - SAVE MATRIX TO DOLFIN IN XML FORMAT
-%
-% Usage: xmlmatrix(filename, A)
-%
-%   A - a matrix
-%
-% Copyright (C) 2004 Georgios Foufas
-%
-% This file is part of DOLFIN.
-%
-% DOLFIN is free software: you can redistribute it and/or modify
-% it under the terms of the GNU Lesser General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% DOLFIN is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU Lesser General Public License for more details.
-%
-% You should have received a copy of the GNU Lesser General Public License
-% along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-%
-% Modified by Anders Logg 2004-2005.
-%
-% First added:  2004-02-10
-% Last changed: 2005
-
-% Tolerance for sparse matrix
-tol = 1e-16;
-
-% Open file
-fp = fopen(filename,'w');
-
-%Get matrix size
-nrows = size(A,1);
-ncols = size(A,2);
-
-% Write header
-fprintf(fp,'<?xml version="1.0" encoding="UTF-8"?>\n\n');
-fprintf(fp,'<dolfin xmlns:dolfin="http://www.phi.chalmers.se/dolfin/">\n');
-
-% Write matrix values
-disp('Writing matrix...')
-fprintf(fp,'  <sparsematrix rows="%d" columns="%d">\n',nrows,ncols);  
-
-for i=1:nrows
-  
-  % Compute size of row
-  size = round(length(find(abs(A(i,:)) > tol)));
-  
-  fprintf(fp,'    <row row="%d" size="%d"/>\n', i-1, size);
-  
-  for j=1:ncols
-    element = A(i,j);
-    if abs(element) > tol
-      fprintf(fp,'      <element column="%d" value="%f"/>\n', j-1, A(i,j));
-    end
-  end
-  
-  fprintf(fp,'    </row>\n');
-
-end
-
-fprintf(fp,'  </sparsematrix>\n');
-fprintf(fp,'</dolfin>\n');  
-
-% Close file
-fclose(fp);
-disp('Done')
diff --git a/utils/matlab/xmlmesh.m b/utils/matlab/xmlmesh.m
deleted file mode 100644
index c6ae134..0000000
--- a/utils/matlab/xmlmesh.m
+++ /dev/null
@@ -1,97 +0,0 @@
-function xmlmesh(filename, p, t)
-
-% XMLMESH - SAVE MATLAB 2D (AND FEMLAB 3D) MESH TO DOLFIN XML FORMAT
-%
-% Usage: xmlmesh(filename,p,t)
-%
-%   p - points    (exported from PDE Toolbox)
-%   t - triangles (exported from PDE Toolbox)
-%
-% Copyright (C) 2004 Erik Svensson
-%
-% This file is part of DOLFIN.
-%
-% DOLFIN is free software: you can redistribute it and/or modify
-% it under the terms of the GNU Lesser General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% DOLFIN is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU Lesser General Public License for more details.
-%
-% You should have received a copy of the GNU Lesser General Public License
-% along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-%
-% Modified by Anders Logg 2004-2005.
-% Modified by Marie Rognes 2009.
-%
-% First added:  2004-02-10
-% Last changed: 2009-11-18
-
-% Open file
-fp = fopen(filename, 'w');
-disp('Exporting mesh to DOLFIN XML format')
-
-% Get number of points and triangles
-np = size(p, 2);
-nt = size(t, 2);
-
-% Write header
-fprintf(fp,'<?xml version="1.0" encoding="UTF-8"?>\n\n');
-fprintf(fp,'<dolfin xmlns:dolfin="http://www.fenics.org/dolfin">\n');
-
-% 2D mesh
-if (size(p, 1) == 2)
-
-  % Write nodes
-  fprintf(fp,'  <mesh celltype="triangle" dim="2">\n');
-  disp('Writing vertices...')
-  fprintf(fp,'    <vertices size="%d">\n',np);
-  for n=1:np
-    fprintf(fp,'      <vertex index="%d" x="%f" y="%f" z="0.0"/>\n', ...
-	    n - 1, p(1, n), p(2, n));
-  end
-  fprintf(fp,'    </vertices>\n');
-
-  % Write cells
-  disp('Writing cells...')
-  fprintf(fp,'    <cells size="%d">\n',nt);
-  for n=1:nt
-    fprintf(fp,'      <triangle index="%d" v0="%d" v1="%d" v2="%d"/>\n', ...
-	    n - 1, t(1, n) - 1, t(2, n) - 1, t(3, n) - 1);
-  end
-  fprintf(fp,'    </cells>\n');
-  fprintf(fp,'  </mesh>\n');
-  fprintf(fp,'</dolfin>\n');
-
-% 3D mesh
-elseif (size(p, 1) == 3)
-
-  % Write nodes
-  disp('Writing nodes...')
-  fprintf(fp,'  <mesh>\n');
-  fprintf(fp,'    <vertices size="%d">\n',np);
-  for n=1:np
-    fprintf(fp,'      <vertex name="%d" x="%f" y="%f" z="%f"/>\n', ...
-            n - 1, p(1, n), p(2, n), p(3, n));
-  end
-  fprintf(fp,'    </vertices>\n');
-
-  % Write cells
-  disp('Writing cells...')
-  fprintf(fp,'    <cells size="%d">\n',nt);
-  for n=1:nt
-    fprintf(fp,'      <tetrahedron name="%d" n0="%d" n1="%d" n2="%d" n3="%d"/>\n', ...
-            n-1, t (1, n) - 1, t(2, n) - 1, t(3, n) - 1, t(4, n) - 1);
-  end
-  fprintf(fp,'    </cells>\n');
-  fprintf(fp,'  </mesh>\n');
-  fprintf(fp,'</dolfin>\n');
-
-end
-
-% Close file
-fclose(fp);
-disp('Done')
diff --git a/utils/matlab/xmlvector.m b/utils/matlab/xmlvector.m
deleted file mode 100644
index 435cdea..0000000
--- a/utils/matlab/xmlvector.m
+++ /dev/null
@@ -1,58 +0,0 @@
-function xmlvector(filename, x)
-
-% XMLVECTOR - SAVE VECTOR TO DOLFIN IN XML FORMAT
-%
-% Usage: xmlvector(filename, x)
-%
-%   x - a vector
-%
-% Copyright (C) 2004 Georgios Foufas
-%
-% This file is part of DOLFIN.
-%
-% DOLFIN is free software: you can redistribute it and/or modify
-% it under the terms of the GNU Lesser General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% DOLFIN is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU Lesser General Public License for more details.
-%
-% You should have received a copy of the GNU Lesser General Public License
-% along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-%
-% Modified by Anders Logg 2004-2005.
-%
-% First added:  2004-02-10
-% Last changed: 2005
-
-
-% Open file
-fp = fopen(filename,'w');
-
-% Row or column  vector??
-ssize = size(x,1);
-if(ssize == 1)
-  ssize = size(x,2);
-end
-
-% Write header
-fprintf(fp,'<?xml version="1.0" encoding="UTF-8"?>\n\n');
-fprintf(fp,'<dolfin xmlns:dolfin="http://www.phi.chalmers.se/dolfin/">\n');
-
-% Write vector values
-disp('Writing vector...')
-fprintf(fp,'  <vector size="%d">\n',ssize);  
-
-for n = 1:ssize
-  fprintf(fp,'    <element row="%d" value="%f"/>\n', n-1, x(n));
-end
-
-fprintf(fp,'  </vector>\n');
-fprintf(fp,'</dolfin>\n');  
- 
-% Close file
-fclose(fp);
-disp('Done')
diff --git a/utils/octave/README b/utils/octave/README
deleted file mode 100644
index 8891bdb..0000000
--- a/utils/octave/README
+++ /dev/null
@@ -1,28 +0,0 @@
-Notes about the pdeplot, pdesurf and pdemesh Octave functions:
-
-These functions are Free Software reimplementations of the corresponding
-functions in Matlab's PDE Toolbox.
-
-They require the external program "ivview" included in the open source
-Open Inventor distribution which can be obtained from
-
-	http://oss.sgi.com/projects/inventor/.
-
-Open Inventor also exists in the package system of some Linux
-distributions, such as Debian (the package inventor-clients).
-
-They have been verified to work in Octave 2.1.50.
-
-Example usage:
-
-> pdemesh(points, edges, cells)
-> pdesurf(points, cells, u)
-
-Bugs and comments on features:
-
-The functions use the "popen2" call in Octave to communicate with
-"ivview", and this does not always work correctly, "ivview" can
-sometimes hang. This is presumably an Octave bug.
-
-The pdeplot function is a far from complete reimplementation of the 
-Matlab pdeplot.
diff --git a/utils/octave/pdemesh.m b/utils/octave/pdemesh.m
deleted file mode 100644
index ad294ff..0000000
--- a/utils/octave/pdemesh.m
+++ /dev/null
@@ -1,29 +0,0 @@
-function h = pdemesh(p, e, t, u)
-
-% Plots the mesh described by p, e, t (points, edges, triangles).
-%
-% Copyright (C) 2004-2005 Johan Jansson
-%
-% This file is part of DOLFIN.
-%
-% DOLFIN is free software: you can redistribute it and/or modify
-% it under the terms of the GNU Lesser General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% DOLFIN is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU Lesser General Public License for more details.
-%
-% You should have received a copy of the GNU Lesser General Public License
-% along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-%
-% First added:  2004-01-23
-% Last changed: 2005
-
-if(nargin == 3)
-  u = zeros(size(p, 2), 1);
-end
-
-pdeplot(p, [], t, 'xydata', u)
diff --git a/utils/octave/pdeplot.m b/utils/octave/pdeplot.m
deleted file mode 100644
index 2ededfc..0000000
--- a/utils/octave/pdeplot.m
+++ /dev/null
@@ -1,230 +0,0 @@
-function h = pdeplot(p, e, t, p1, u)
-
-% Plots the scalar solution u on the mesh described by p, e, t (points, edges,
-% triangles).
-%
-% Copyright (C) 2004-2005 Johan Jansson
-%
-% This file is part of DOLFIN.
-%
-% DOLFIN is free software: you can redistribute it and/or modify
-% it under the terms of the GNU Lesser General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% DOLFIN is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU Lesser General Public License for more details.
-%
-% You should have received a copy of the GNU Lesser General Public License
-% along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-%
-% First added:  2004-01-23
-% Last changed: 2005
-
-%u = v1;
-
-color1 = [0.0 1.0 0.0];
-color2 = [1.0 0.0 0.0];
-
-%Compute some useful information about the geometry
-
-pmax = max(p');
-pmin = min(p');
-
-umin = min(u);
-umax = max(u);
-
-urange = umax - umin;
-
-if(urange == 0)
-  urange = 1;
-end
-
-
-%offset = max([umax / 100 1e-3]);
-offset = urange / 100;
-%  offset
-
-%  center = [(max(p(1, :)) + min(p(1, :))) / 2
-%	    (max(p(2, :)) + min(p(2, :))) / 2]; 
-%  centeru = (max(u) + min(u)) / 2;
-
-center = (pmax + pmin) / 2;
-centeru = (umax + umin) / 2;
-
-%Assume that u is xydata
-  
-fname = tempname;
-%[fd, fdout, pid] = popen2('ivview', 'w');
-[fd, fdout, pid] = popen2('ivview', '');
-%[fd, fdout, pid] = popen2('SceneViewer -', '');
-%fd = fopen(fname, 'w');
-  
-fprintf(fd, '#Inventor V2.1 ascii\n\n');
-
-fprintf(fd, 'Separator\n');
-fprintf(fd, '{\n');
-
-fprintf(fd, ' OrthographicCamera\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  position %f %f %f\n', 0, 0, 5);
-fprintf(fd, '  focalDistance %f\n', 5);
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' ShapeHints\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  creaseAngle 1.5\n');
-fprintf(fd, '  vertexOrdering COUNTERCLOCKWISE\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' Scale\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  scaleFactor %f %f %f\n', 1.5 / (2 * center(1)), 1.5 / (2 * center(2)), 1 / (urange));
-
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' Translation\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  translation %f %f %f\n', -center(1), -center(2), -centeru);
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' LightModel\n');
-fprintf(fd, ' {\n');
-%  fprintf(fd, ' model PHONG\n');
-fprintf(fd, '  model BASE_COLOR\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, 'Separator\n');
-fprintf(fd, '{\n');
-fprintf(fd, ' Font\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  size 20\n');
-fprintf(fd, ' }\n');
-fprintf(fd, ' Translation\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  translation 0.0 1.05 0\n');
-fprintf(fd, ' }\n');
-fprintf(fd, ' Text2\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  string \"Title\"\n');
-fprintf(fd, ' }\n');
-fprintf(fd, '}\n');
-
-fprintf(fd, ' Material\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  ambientColor 0.5 0.5 0.5\n');
-fprintf(fd, '  specularColor 0.8 0.8 0.8\n');
-fprintf(fd, '  diffuseColor\n');
-fprintf(fd, '  [\n');
-  
-for i = 1:size(u, 1)
-  value = (u(i) - umin) / urange;
-  color = (1 - value) * color1 + value * color2;
-  %color
-  
-  if(i < size(u, 1))
-    fprintf(fd, '   %f %f %f,\n', color(1), color(2), color(3));
-  else
-    fprintf(fd, '   %f %f %f\n', color(1), color(2), color(3));
-  end
-end
-
-fprintf(fd, '  ]\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' MaterialBinding\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  value PER_VERTEX_INDEXED\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' Coordinate3\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  point\n');
-fprintf(fd, '  [\n');
-	  
-for i = 1:size(p, 2)
-  if(i < size(p, 2))
-    fprintf(fd, '   %f %f %f,\n', p(1, i), p(2, i), u(i));
-  else
-    fprintf(fd, '   %f %f %f\n', p(1, i), p(2, i), u(i));
-  end
-end
-
-fprintf(fd, '  ]\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' IndexedFaceSet\n');
-fprintf(fd, ' {\n');
-
-fprintf(fd, '  coordIndex\n');
-fprintf(fd, '  [\n');
-  
-for i = 1:size(t, 2)
-  if(i < size(t, 2))
-    fprintf(fd, '   %d, %d, %d, -1,\n', t(1, i) - 1, t(2, i) - 1, t(3, i) - 1);
-  else
-    fprintf(fd, '   %d, %d, %d, -1\n', t(1, i) - 1, t(2, i) - 1, t(3, i) - 1);
-  end
-end
-
-fprintf(fd, '  ]\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' Material\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  diffuseColor    0.1 0.1 0.1\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' MaterialBinding\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  value OVERALL\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' Coordinate3\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  point\n');
-fprintf(fd, '  [\n');
-  
-for i = 1:size(p, 2)
-  if(i < size(p, 2))
-    fprintf(fd, '   %f %f %f,\n', p(1, i), p(2, i), u(i) + offset);
-  else
-    fprintf(fd, '   %f %f %f\n', p(1, i), p(2, i), u(i) + offset);
-  end
-end
-
-fprintf(fd, '  ]\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, ' IndexedLineSet\n');
-fprintf(fd, ' {\n');
-fprintf(fd, '  coordIndex\n');
-fprintf(fd, '  [\n');
-  
-for i = 1:size(t, 2)
-  if(i < size(t, 2))
-    fprintf(fd, '   %d, %d, -1,\n', t(1, i) - 1, t(2, i) - 1);
-    fprintf(fd, '   %d, %d, -1,\n', t(2, i) - 1, t(3, i) - 1);
-    fprintf(fd, '   %d, %d, -1,\n', t(3, i) - 1, t(1, i) - 1);
-  else
-    fprintf(fd, '   %d, %d, -1,\n', t(1, i) - 1, t(2, i) - 1);
-    fprintf(fd, '   %d, %d, -1,\n', t(2, i) - 1, t(3, i) - 1);
-    fprintf(fd, '   %d, %d, -1\n', t(3, i) - 1, t(1, i) - 1);
-  end
-end
-
-fprintf(fd, '  ]\n');
-fprintf(fd, ' }\n');
-
-fprintf(fd, '}\n');
-
-fclose(fd);
-
-%cmd = sprintf('SceneViewer %s', fname);
-%system(cmd, 1, 'async');
-
-%sleep(1);
-
-%unlink(fname);
diff --git a/utils/octave/pdesurf.m b/utils/octave/pdesurf.m
deleted file mode 100644
index b7f6585..0000000
--- a/utils/octave/pdesurf.m
+++ /dev/null
@@ -1,26 +0,0 @@
-function h = pdesurf(p, t, u)
-
-% Plots the scalar solution u on the mesh described by p, t (points,
-% triangles).							    
-%
-% Copyright (C) 2004-2005 Johan Jansson
-%
-% This file is part of DOLFIN.
-%
-% DOLFIN is free software: you can redistribute it and/or modify
-% it under the terms of the GNU Lesser General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% DOLFIN is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU Lesser General Public License for more details.
-%
-% You should have received a copy of the GNU Lesser General Public License
-% along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-%
-% First added:  2004-01-23
-% Last changed: 2005
-
-pdeplot(p, [], t, 'xydata', u)
diff --git a/utils/python/README b/utils/python/README
deleted file mode 100644
index e8de05f..0000000
--- a/utils/python/README
+++ /dev/null
@@ -1,2 +0,0 @@
-Place for random Python utilities that we may or may not want to include
-as part of the official DOLFIN Python interface.
diff --git a/utils/python/extract2d b/utils/python/extract2d
deleted file mode 100755
index 288afb4..0000000
--- a/utils/python/extract2d
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/env python
-#
-# Extract two-dimensional DOLFIN mesh from three-dimensional DOLFIN mesh.
-#
-# Usage: extract2d mesh.xml
-#
-# Copyright (C) 2008 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2007-09-02
-# Last changed: 2008-09-12
-
-import sys
-
-if not len(sys.argv) == 2:
-    print "Usage: extract2D mesh.xml"
-    sys.exit(1)
-
-from dolfin import *
-
-# Read mesh
-filename = sys.argv[1]
-mesh = Mesh(filename)
-
-# Check geometry
-if not mesh.geometry().dim() == 3:
-    print "Not a 3D mesh"
-    sys.exit(1)
-
-# Create boundary mesh
-boundary = BoundaryMesh(mesh)
-
-# Extract cells and vertices on the boundary
-eps = 1e-12
-cells = []
-coordinates = boundary.coordinates()
-vertex_map = {}
-vertex_coordinates = []
-k = 0
-for cell in boundary.cells():
-    xs = coordinates[cell]
-    if all([x[2] < eps for x in xs]):
-        cells.append(cell)
-        for vertex in cell:
-            if not vertex in vertex_map:
-                vertex_map[vertex] = k
-                vertex_coordinates.append(coordinates[vertex])
-                k += 1
-
-# Write mesh
-file = open(filename.split(".")[0] + "-2d.xml", "w")
-file.write("""\
-<?xml version="1.0" encoding="UTF-8"?>
-
-<dolfin xmlns:dolfin="http://fenicsproject.org">
-  <mesh celltype="triangle" dim="2">
-    <vertices size="%d">
-""" % len(vertex_map))
-for i in range(len(vertex_map)):
-    x = vertex_coordinates[i]
-    file.write('      <vertex index="%d" x="%.16e" y="%.16e"/>\n' % (i, x[0], x[1]))
-file.write("""\
-    </vertices>
-    <cells size="%d">
-""" % len(cells))
-for i in range(len(cells)):
-    v = [vertex_map[v] for v in cells[i]]
-    file.write('      <triangle index="%d" v0="%d" v1="%d" v2="%d"/>\n' % (i, v[0], v[1], v[2]))
-file.write("""
-    </cells>
-  </mesh>
-</dolfin>
-""")
-file.close()
diff --git a/utils/swig/dolfin-swig b/utils/swig/dolfin-swig
deleted file mode 100755
index f89c1d3..0000000
--- a/utils/swig/dolfin-swig
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/usr/bin/env python
-
-import os, sys
-from dolfin_utils.commands import getoutput
-
-debug = False
-
-# Simple tool to automatically convert a header file (with
-# implementation) including DOLFIN classes or functions to a Python
-# module.
-
-usage = """
-Usage: %s sourcefile [modulename]
-
-Example: dolfin-swig Poisson3D.h poisson3dform
-""" % os.path.basename(sys.argv[0])
-
-if len(sys.argv) < 2:
-    print usage
-
-name = sys.argv[1]
-name = name.rstrip(".h")
-
-if(len(sys.argv) > 2):
-    modulename = sys.argv[2]
-else:
-    lowername = name.lower()
-    modulename = lowername
-
-swigfile = modulename + ".i"
-
-print "Generating the SWIG interface file for the %s module" % name
-
-swigsource = """%%module %s
-
-%%{
-#include <dolfin.h>
-#include <string>
-
-#include \"%s.h\"
-
-using namespace dolfin;
-%%}
-
-%%typemap(python,in) real = double; 
-%%typemap(python,out) real = double; 
-%%typemap(python,in) uint = int; 
-%%typemap(python,out) uint = int; 
-
-// Typemaps for dolfin::real array arguments in virtual methods
-// probably not very safe
-%%typemap(directorin) dolfin::real [] {
-  {
-    // Custom typemap
-    $input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, $owner);
-  }
-}
-
-%%typemap(directorin) dolfin::real const [] {
-  {
-    // Custom typemap
-    $input = SWIG_NewPointerObj((void *) $1_name, $1_descriptor, $owner);
-  }
-}
-
-%%include \"typemaps.i\"
-%%include \"std_string.i\"
-
-%%include \"carrays.i\"
-
-%%include \"%s.i\"
-
-%%array_functions(dolfin::real, realArray);
-
-%%feature(\"director\") Function;
-%%feature(\"director\") BoundaryCondition;
-%%feature(\"director\") ODE;
-
-%%ignore dolfin::dolfin_set;
-%%ignore dolfin::dolfin_set_aptr;
-
-%%import \"dolfin.h\"
-%%import \"dolfin/constants.h\"
-
-/* function imports */
-
-%%import \"dolfin/Function.h\"
-
-/* fem imports */
-
-%%include \"dolfin/FiniteElementSpec.h\"
-%%include \"dolfin/BoundaryCondition.h\"
-%%include \"dolfin/FiniteElement.h\"
-
-/* form imports */
-
-%%include \"dolfin/Form.h\"
-%%include \"dolfin/BilinearForm.h\"
-%%include \"dolfin/LinearForm.h\"
-
-/* form include */
-
-%%include \"%s.h\"
-""" % (modulename, name, name, name)
-
-swigoutput = open(swigfile, 'w')
-swigoutput.write(swigsource)
-swigoutput.close()
-
-#print "Building the Python module"
-
-debugout = getoutput("swig -python -c++ -nodefault -dirprot `pkg-config --cflags-only-I dolfin` -o %s_wrap.cpp %s" % (modulename, swigfile))
-
-if debug:
-    print debugout
-
-# FIXME: Workaround for apparent bug in SWIG, try to fix the bug.
-
-interfacefile = open("%s_wrap.cpp" % modulename)
-
-tmpfile = open("tmp.cpp", 'w')
-
-stext = "dolfin::%s::dolfin::" % name
-rtext = "dolfin::"
-
-for s in interfacefile.xreadlines():
-    tmpfile.write(s.replace(stext, rtext))
-
-interfacefile.close()
-tmpfile.close()
-
-debugout = getoutput("mv tmp.cpp %s_wrap.cpp" % modulename)
-
-if debug:
-    print debugout
-
-# FIXME:
-# Compilation still not compiler-independent
-
-#print "Compiling generated code"
-
-debugout = getoutput("`pkg-config --variable=compiler dolfin` `pkg-config --variable=swigcflags dolfin` `pkg-config --cflags-only-I dolfin` -I. -g -fPIC  -c -o %s_wrap.o %s_wrap.cpp" % (modulename, modulename))
-
-if debug:
-    print debugout
-
-# FIXME:
-# Generating shared library still not compiler-independent (syntax likely
-# only works for GCC)
-
-#print "Linking generated code"
-
-debugout = getoutput("`pkg-config --variable=compiler dolfin` -g -shared %s_wrap.o -o _%s.so `pkg-config --libs dolfin`" % (modulename, modulename))
-
-if debug:
-    print debugout
diff --git a/utils/system/monitor b/utils/system/monitor
deleted file mode 100644
index 936052c..0000000
--- a/utils/system/monitor
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2005 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005-12-13
-# Last changed: 2005-12-13
-#            
-# Monitor memory usage for given command. This script
-# will probably only work on Linux.
-#
-# Note that this script runs the given command as a new
-# process, so killing the script (ctrl-c) won't kill the
-# running process.
-
-exec $* &
-pid="$!"
-
-echo "Monitoring memory usage for process with id $pid..."
-PIDFILE="/proc/$pid/status"
-while [ 1 ]; do
-    if [ -e $PIDFILE ]; then
-	cat $PIDFILE | grep VmSize | awk '{ print $2/1024" MB"}'
-    else
-	exit 0
-    fi
-    sleep 1
-done
diff --git a/utils/tetgen/dolfin-tetgen b/utils/tetgen/dolfin-tetgen
deleted file mode 100755
index 4859791..0000000
--- a/utils/tetgen/dolfin-tetgen
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2009 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# Simple script for mesh STL geometry with TetGen and converting to DOLFIN XML format
-
-import sys, os
-
-# Check command-line arguments
-if len(sys.argv) != 3:
-    print "Usage: dolfin-tetgen mesh.stl mesh.xml"
-    sys.exit(1)
-stl_file = sys.argv[1]
-xml_file = sys.argv[2]
-
-# Run TetGen
-os.system("tetgen -g -p %s" % stl_file)
-
-# Convert to DOLFIN
-mesh_file = stl_file.split(".stl")[0] + ".1" + ".mesh"
-os.system("dolfin-convert %s %s" % (mesh_file, xml_file))
diff --git a/utils/vim/macros b/utils/vim/macros
deleted file mode 100644
index 5b3e9d2..0000000
--- a/utils/vim/macros
+++ /dev/null
@@ -1,6 +0,0 @@
-set tabstop=2
-set   shiftwidth=2
-map ,ih "%pbd$0"adwp0v$~0"bdwddi// Copyright (C) 2006 :r !echo $USER 
~$a.kJo// Licensed under the GNU LGPL Version 2.1.
//
// First added:  :r !date +'\%F'
kJo// Last changed: :r !date +'\%F'
kJo
#ifndef __FOO_H
#define __FOO_H

#include <dolfin/constants.h>

namespace dolfin
{

/// Documentation of class Foo

class Foo
{
public:

/// Constructor
Foo();

/// Destructor
~Foo();

private:

};

}

#endif:%s/Foo/\=@a/g

:%s/FOO/\=@b/g

-map ,ic "%pbd$0"1dwddi// Copyright (C) 2006 :r !echo $USER 
~$a.kJo// Licensed under the GNU LGPL Version 2.1.
//
// First added:  :r !date +'\%F'
kJo// Last changed: :r !date +'\%F'
kJo
#include <dolfin/Foo.h>

using namespace dolfin;

//-----------------------------------------------------------------------------
Foo::Foo()
{
// Do nothing
}
//-----------------------------------------------------------------------------
Foo::~Foo()
{
// Do nothing
}
//-----------------------------------------------------------------------------:%s/Foo/\=@2/g

-map ,OH :split
:e %<.h
-map ,OC :split
:e %<.cpp

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/fenics/dolfin.git



More information about the debian-science-commits mailing list